poi导出模板(我的备份)

/**
* There are <a href="https://github.com/thinkgem/jeesite">JeeSite</a> code generation
*/
package com.bns.modules.cadre.selection.web;
import java.awt.image.BufferedImage;
import java.io.BufferedOutputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.lang.reflect.Method;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
import javax.imageio.ImageIO;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFClientAnchor;
import org.apache.poi.hssf.usermodel.HSSFFont;
import org.apache.poi.hssf.usermodel.HSSFPatriarch;
import org.apache.poi.hssf.usermodel.HSSFRichTextString;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.hssf.util.CellRangeAddress;
import org.apache.poi.hssf.util.HSSFColor;
import org.apache.poi.hssf.util.Region;
import org.apache.poi.ss.formula.functions.T;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Workbook;
import org.jxls.common.Context;
import org.jxls.util.JxlsHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.bns.component.export.ExcelExport;
import com.bns.component.export.QRCodeUtils;
import com.bns.modules.cadre.selection.service.DemocracyRecommendService;
import com.bns.modules.cadre.selection.service.MotionService;
import com.bns.modules.common.empUtils.service.EmpUtilsService;
import com.bns.modules.common.utils.CommonUtil;
import com.bns.modules.common.utils.StandardManage;
import com.bns.utils.FormBean;
import com.bns.utils.FormBeanUtils;
import com.google.common.collect.Maps;
import com.thinkgem.jeesite.common.config.Global;
import com.thinkgem.jeesite.common.persistence.Page;
import com.thinkgem.jeesite.common.utils.DateUtils;
import com.thinkgem.jeesite.common.utils.excel.ImportExcel;
import com.thinkgem.jeesite.common.web.BaseController;
import com.thinkgem.jeesite.modules.sys.entity.Dict;
import com.thinkgem.jeesite.modules.sys.entity.User;
import com.thinkgem.jeesite.modules.sys.utils.DictUtils;
import com.thinkgem.jeesite.modules.sys.utils.UserUtils;
/**
* 民主推荐Controller
*
* @author wzq
* @version 2018-07-26
*/
@Controller
@RequestMapping(value = "${adminPath}/selection/democracyRecommend")
public class DemocracyRecommendController extends BaseController {
    @Autowired
    private DemocracyRecommendService democracyRecommendService;
    @Autowired
    private MotionService motionService;
    /**
* 民主推荐查询
*
* @param formbean
* @param request
* @param response
* @param model
* @return
* @author klx
*/
    @RequestMapping(value = {"list", ""})
    public String list(FormBean formbean, HttpServletRequest request, HttpServletResponse response, Model model) {
        FormBeanUtils.preDeal(formbean, request);
        Page<Map<String, Object>> page = democracyRecommendService.getDemocraticRecommendProcessPageList(new Page<Map<String, Object>>(request, response), formbean);
        model.addAttribute("map", formbean);
        model.addAttribute("page", page);
        return "modules/cadre/selection/democracyRecommendList";
    }
    /**
* 民主推荐保存
*
* @param formbean
* @param request
* @param response
* @return
* @author klx
*/
    @RequestMapping(value = "saveQuasiPersonList")
    public
    @ResponseBody
    Map<String, Object> saveQuasiPersonList(FormBean formbean, Model model,String tvNumId,String pid, RedirectAttributes redirectAttributes) {
        String result = StandardManage.OPERATE_SUCCESS;
        Map<String, Object> bean = formbean.getBean();
        Date day=new Date();
        //获取当前用户
        User user = UserUtils.getUser();
        String UPDATE_BY="";
        if(user != null && null != user.getLoginName()){
            UPDATE_BY=user.getLoginName();
        }
        try {
            formbean.getBean().put("tvNumId", tvNumId.split(","));
            formbean.getBean().put("pid", pid);
            //取得挺谈话推荐的人员集合
            List<Map<String, Object>> list = democracyRecommendService.getDemocraticRecommendProcessNoPageList(FormBeanUtils.parse(bean));
            if(list != null && list.size()>0){
                for (Map<String, Object> m:list){
                    //根据人是编号判断是否拟任人中是否存在该人员,存在就不新增
                    String ZGH = m.get("ZGH").toString();
                    String PROCESS_ID =pid;
                    Map<String, Object> zghMap = Maps.newHashMap();
                    zghMap.put("ZGH", ZGH);
                    zghMap.put("PROCESS_ID", PROCESS_ID);
                    //判断拟任人是否存在
                    List<Map<String, Object>> quasiPersonList = democracyRecommendService.getQuasiPersonList(zghMap,null);
                    if(quasiPersonList != null && quasiPersonList.size()>0){
                        bean.put("result", "拟任人存在重复");
                        return bean;
                    }
                }
                for (Map<String, Object> m:list){
                    Map<String, Object> insertQuasiPersonMap = Maps.newHashMap();
                    //根据人是编号判断是否拟任人中是否存在该人员,存在就不新增
                    insertQuasiPersonMap.put("NUM_ID", EmpUtilsService.getBeanId());
                    insertQuasiPersonMap.put("PROCESS_ID", pid);
                    insertQuasiPersonMap.put("EMP_ID", m.get("ZGH"));
                    insertQuasiPersonMap.put("BASE_INFO_ID",m.get("PER_NUM_ID"));
                    insertQuasiPersonMap.put("NUMBER_ID",m.get("SFZJH"));
                    insertQuasiPersonMap.put("PERSON_POST",m.get("EP_NUM_ID"));
                    //1正常2淘汰,拟任人阶段码:正常/淘汰
                    insertQuasiPersonMap.put("QUASI_STAGE","1");
                    insertQuasiPersonMap.put("CREATE_BY",UPDATE_BY );
                    insertQuasiPersonMap.put("CREATE_DATE", day);
                    insertQuasiPersonMap.put("UPDATE_BY", UPDATE_BY);
                    insertQuasiPersonMap.put("UPDATE_DATE", day);
                    insertQuasiPersonMap.put("DEL_FLAG","0" );
                    democracyRecommendService.insertQuasiPerson(insertQuasiPersonMap);
                }
            }
            bean.put("result", result);
        }
        catch (Exception e) {
            e.printStackTrace();
            result = StandardManage.OPERATE_FAIL;
            bean.put("result", result);
        }
        return bean;
    }
    /**
* 民主推荐查询
*
* @param formbean
* @param request
* @param response
* @param model
* @return
* @author klx
* @throws ParseException
*/
    @RequestMapping(value = "addQuasiPersonList")
    public String addQuasiPersonList(FormBean formbean, HttpServletRequest request, HttpServletResponse response, Model model) throws ParseException {
        FormBeanUtils.preDeal(formbean, request);
        String pid = request.getParameter("pid");
        formbean.getBean().put("pid", pid);
        SimpleDateFormat format = new SimpleDateFormat("yyyy-M-dd");
        Page<Map<String, Object>> page = democracyRecommendService.getThtjVotePersonPageList(new Page<Map<String, Object>>(request, response), formbean);
        if(page != null && page.getList() != null && page.getList().size()>0){
            for (Map<String, Object> map:page.getList()){
                if(map.containsKey("XB") && map.get("XB")!= null && !("").equals(map.get("XB").toString().trim())){
                    map.put("XB",DictUtils.getDictLabel(map.get("XB").toString(), "XB", ""));
                } else{
                    map.put("XB", "");
                }
                if(map.containsKey("csrq") && map.get("csrq")!= null && !("").equals(map.get("csrq").toString().trim())){
                    map.put("csrq",DateUtils.formatDate(format.parse(map.get("csrq").toString()), "yyyy-MM-dd"));
                } else{
                    map.put("csrq", "");
                }
                if(map.containsKey("zzmm") && map.get("zzmm")!= null && !("").equals(map.get("zzmm").toString().trim())){
                    map.put("zzmm",DictUtils.getDictLabel(map.get("zzmm").toString(), "ZZMM", ""));
                } else{
                    map.put("zzmm", "");
                }
            }
        }
        model.addAttribute("map", formbean);
        model.addAttribute("page", page);
        model.addAttribute("pid", pid);
        return "modules/cadre/selection/democracyRecommendAddQuasiPersonList";
    }
    /**
* 民主推荐页面
*
* @param id
* @param formbean
* @param request
* @param response
* @param model
* @return
* @author klx
* @throws ParseException
*/
    @RequestMapping(value = "form")
    public String form(String numid, String addFlag,String voteFlag,String hytjId,String did,
    String D_PRESERVE04,FormBean formbean, Model model,HttpServletRequest request, HttpServletResponse response) throws ParseException {
        User user = UserUtils.getUser();
        Map<String, Object> idMap1 = Maps.newHashMap();
        idMap1.put("NUM_ID", did);
        idMap1.put("oneRound", "oneRound");
        Map<String, Object> idMap2 = Maps.newHashMap();
        idMap2.put("NUM_ID", did);
        idMap2.put("secondRound", "secondRound");
        List<Map<String, Object>> idList1 = democracyRecommendService.getMztjHytjId(idMap1);
        List<Map<String, Object>> idList2 = democracyRecommendService.getMztjHytjId(idMap2);
        String hytjId1 ="";
        String hytjId2 ="";
        String twoVoteFlag = "1";
        if(idList1 != null && idList1.size()>0){
            hytjId1 = idList1.get(0).get("NUM_ID").toString();
        }
        if(idList2 != null && idList2.size()>0){
            hytjId2 = idList2.get(0).get("NUM_ID").toString();
        }
        //存的是认识表id,登录后用教职工号去取
        Map<String, Object> bean = formbean.getBean();
        if(null == bean){
            bean = Maps.newHashMap();
        }
        if (StringUtils.isNotEmpty(numid)) {
            bean.put("NUM_ID", numid);
            bean.put("addFlag", addFlag);
        }
        bean = democracyRecommendService.getDemocracyRecommendProcessEnty(bean);
        if(null != bean){
            if(StringUtils.isNotEmpty(voteFlag)){
                if(2== Integer.parseint(voteFlag)){
                    twoVoteFlag ="2";
                    hytjId = hytjId2;
                } else{
                    twoVoteFlag ="1";
                    hytjId = hytjId1;
                }
            } else{
                if(null != bean.get("D_PRESERVE05")){
                    if( 6 > Integer.parseint(bean.get("D_PRESERVE05").toString()) && 0!=Integer.parseint(bean.get("D_PRESERVE05").toString())){
                        twoVoteFlag ="1";
                        hytjId = hytjId1;
                    } else if( 6 <= Integer.parseint(bean.get("D_PRESERVE05").toString())){
                        twoVoteFlag ="2";
                        hytjId = hytjId2;
                    } else if( 0 == Integer.parseint(bean.get("D_PRESERVE05").toString())){
                        twoVoteFlag ="2";
                        hytjId = hytjId2;
                    } else{
                        twoVoteFlag ="1";
                        hytjId = hytjId1;
                    }
                } else{
                    twoVoteFlag ="1";
                    hytjId = hytjId1;
                }
            }
            Map<String, Object> entity = Maps.newHashMap();
            entity.put("LOGIN_NAME", user.getLoginName());
            entity =motionService.getTMidRsPartyId(entity);
            if(null != entity){
                String HANDLE_ID = entity.get("NUM_ID").toString();
                String NAME = entity.get("XM").toString();
                bean.put("HYTJ_HANDLE_ID_HID",HANDLE_ID);
                bean.put("HYTJ_NAME_HID", NAME);
            } else{
                bean.put("HYTJ_HANDLE_ID_HID","");
                bean.put("HYTJ_NAME_HID", "");
            }
            Date finishDate = new Date();
            bean.put("finishDate", finishDate);
        }
        Map<String, Object> obj = formbean.getBean();
        obj.put("HYTJ_ID", hytjId);
        obj.put("voteFlag", twoVoteFlag);
        List<Map<String, Object>> democracyRecommendList = democracyRecommendService.gettCadreHytjHxmdList(obj);
        SimpleDateFormat format = new SimpleDateFormat("yyyy-M-dd");
        int listSize = 0;
        String baseInfoId = "";
        if(democracyRecommendList != null && democracyRecommendList.size()>0){
            listSize = democracyRecommendList.size();
            for (Map<String, Object> map:democracyRecommendList){
                baseInfoId += map.get("PER_NUM_ID")+",";
                if(map.containsKey("XB") && map.get("XB")!= null && !("").equals(map.get("XB").toString().trim())){
                    map.put("XB",DictUtils.getDictLabel(map.get("XB").toString(), "XB", ""));
                } else{
                    map.put("XB", "");
                }
                if(map.containsKey("csrq") && map.get("csrq")!= null && !("").equals(map.get("csrq").toString().trim())){
                    map.put("csrq",DateUtils.formatDate(format.parse(map.get("csrq").toString()), "yyyy-MM-dd"));
                } else{
                    map.put("csrq", "");
                }
                if(map.containsKey("zzmm") && map.get("zzmm")!= null && !("").equals(map.get("zzmm").toString().trim())){
                    map.put("zzmm",DictUtils.getDictLabel(map.get("zzmm").toString(), "ZZMM", ""));
                } else{
                    map.put("zzmm", "");
                }
            }
        }
        if(!("").equals(baseInfoId)){
            baseInfoId = baseInfoId.substring(0,baseInfoId.length()-1);
        }
        Map<String, Object> map = Maps.newHashMap();
        List<Map<String, Object>> hytjVotelist = null;
        map.put("HYTJ_ID", hytjId);
        map.put("voteFlag", twoVoteFlag);
        if(null != democracyRecommendService.gettCadreHytjVotelist(map) && democracyRecommendService.gettCadreHytjVotelist(map).size() >0){
            hytjVotelist = democracyRecommendService.gettCadreHytjVotelist(map);
        }
        //取得谈话推荐的集合数据
        Map<String, Object> thtjMap = Maps.newHashMap();
        List<Map<String, Object>> thtjVotelist = null;
        thtjMap.put("NUM_ID", numid);
        if(null != democracyRecommendService.getmztjVoteList(thtjMap) && democracyRecommendService.getmztjVoteList(thtjMap).size() >0){
            thtjVotelist = democracyRecommendService.getmztjVoteList(thtjMap);
        }
        //取得谈话信息
        Map<String, Object> thtjInfo = democracyRecommendService.getTHTJInfo(thtjMap);
        Map<String, Object> zghMap = Maps.newHashMap();
        zghMap.put("PROCESS_ID", numid);
        //取得你任人集合,确认拟任人
        List<Map<String, Object>> quasiPersonList = democracyRecommendService.getQuasiPersonList(zghMap,null);
        if(quasiPersonList != null && quasiPersonList.size()>0){
            for (Map<String, Object> quasiPersonMap:quasiPersonList){
                if(quasiPersonMap.containsKey("XB") && quasiPersonMap.get("XB")!= null && !("").equals(quasiPersonMap.get("XB").toString().trim())){
                    quasiPersonMap.put("XB",DictUtils.getDictLabel(quasiPersonMap.get("XB").toString(), "XB", ""));
                } else{
                    quasiPersonMap.put("XB", "");
                }
                if(quasiPersonMap.containsKey("csrq") && quasiPersonMap.get("csrq")!= null && !("").equals(quasiPersonMap.get("csrq").toString().trim())){
                    quasiPersonMap.put("csrq",DateUtils.formatDate(format.parse(quasiPersonMap.get("csrq").toString()), "yyyy-MM-dd"));
                } else{
                    quasiPersonMap.put("csrq", "");
                }
                if(quasiPersonMap.containsKey("zzmm") && quasiPersonMap.get("zzmm")!= null && !("").equals(quasiPersonMap.get("zzmm").toString().trim())){
                    quasiPersonMap.put("zzmm",DictUtils.getDictLabel(quasiPersonMap.get("zzmm").toString(), "ZZMM", ""));
                } else{
                    quasiPersonMap.put("zzmm", "");
                }
            }
        }
        //取得会议推荐的数据
        Map<String, Object> hytjMap = Maps.newHashMap();
        hytjMap.put("NUM_ID", numid);
        hytjMap.put("addFlag", addFlag);
        hytjMap.put("PRESERVE04", twoVoteFlag);
        Map<String, Object> hytjInfo = democracyRecommendService.getDemocracyRecommendHytjInfo(hytjMap);
        if(bean != null && hytjInfo !=null){
            if(hytjInfo.containsKey("TPFS") && null != hytjInfo.get("TPFS")){
                bean.put("TPFS", hytjInfo.get("TPFS"));
            } else{
                bean.put("TPFS", "");
            }
        }
        //取得综合评价信息
        Map<String, Object> zhpjMap = Maps.newHashMap();
        //会议id
        zhpjMap.put("THTJ_ID",hytjId);
        List<Map<String, Object>> zhpjList = democracyRecommendService.getZHPJVoteSumList(zhpjMap);
        //取得民主测评信息
        Map<String, Object> mzcpMap = Maps.newHashMap();
        //会议id
        mzcpMap.put("THTJ_ID",hytjId);
        mzcpMap = democracyRecommendService.getMZCPVoteSum(mzcpMap);
        model.addAttribute("zhpjList", zhpjList);
        model.addAttribute("mzcpMap", mzcpMap);
        model.addAttribute("addFlag", addFlag);
        model.addAttribute("twoVoteFlag", twoVoteFlag);
        model.addAttribute("quasiPersonList", quasiPersonList);
        model.addAttribute("thtjInfo", thtjInfo);
        model.addAttribute("hytjInfo", hytjInfo);
        model.addAttribute("D_PRESERVE04", D_PRESERVE04);
        model.addAttribute("thtjVotelist", thtjVotelist);
        model.addAttribute("hytjId1", hytjId1);
        model.addAttribute("hytjId2", hytjId2);
        model.addAttribute("hytjVotelist", hytjVotelist);
        model.addAttribute("empNameIdHid", baseInfoId);
        model.addAttribute("list", democracyRecommendList);
        model.addAttribute("listSize", listSize);
        model.addAttribute("map", new FormBean(bean));
        return "modules/cadre/selection/democracyRecommendForm";
    }
    /**
* 民主推荐保存
*
* @param formbean
* @param request
* @param response
* @return
* @author wzq
*/
    @RequestMapping(value = "save")
    public
    @ResponseBody
    String save(FormBean formbean, Model model, RedirectAttributes redirectAttributes) {
        String result = StandardManage.OPERATE_SUCCESS;
        Map<String, Object> bean = formbean.getBean();
        try {
            democracyRecommendService.saveDemocracyRecommend(FormBeanUtils.parse(bean));
        }
        catch (Exception e) {
            e.printStackTrace();
            result = StandardManage.OPERATE_FAIL;
        }
        return result;
    }
    /**
* 民主推荐删除
*
* @param request
* @param response
* @return
* @author wzq
* @throws IOException
* @throws ServletException
*/
    @RequestMapping(value = "deleteTalkPerson")
    public
    @ResponseBody
    Map<String, Object> deleteTalkPerson(String numid,String addFlag,String did,HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String msg = StandardManage.OPERATE_SUCCESS;
        Map<String, Object> result = Maps.newHashMap();
        if (StringUtils.isEmpty(numid)) {
            msg = StandardManage.OPERATE_FAIL;
        }
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("NUM_ID", numid);
        try {
            democracyRecommendService.deletePartTimeApplication(map);
        }
        catch (Exception e) {
            e.printStackTrace();
            msg = StandardManage.OPERATE_FAIL;
        }
        result.put("result", msg);
        return result;
    }
    /**
* 拟任人删除
*
* @param request
* @param response
* @return
* @author
* @throws IOException
* @throws ServletException
*/
    @RequestMapping(value = "deleteQuaisPerson")
    public
    @ResponseBody
    Map<String, Object> deleteQuaisPerson(String numid,String addFlag,String did,HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String msg = StandardManage.OPERATE_SUCCESS;
        Map<String, Object> result = Maps.newHashMap();
        if (StringUtils.isEmpty(numid)) {
            msg = StandardManage.OPERATE_FAIL;
        }
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("NUM_ID", numid);
        try {
            democracyRecommendService.deleteQuasiPerson(map);
        }
        catch (Exception e) {
            e.printStackTrace();
            msg = StandardManage.OPERATE_FAIL;
        }
        result.put("result", msg);
        return result;
    }
    /**
* 候选人删除
*
* @param request
* @param response
* @return
* @author
* @throws IOException
* @throws ServletException
*/
    @RequestMapping(value = "deleteCandidate")
    public
    @ResponseBody
    Map<String, Object> deleteCandidate (String numid,String addFlag,String did,HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String msg = StandardManage.OPERATE_SUCCESS;
        Map<String, Object> result = Maps.newHashMap();
        if (StringUtils.isEmpty(numid)) {
            msg = StandardManage.OPERATE_FAIL;
        }
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("NUM_ID", numid);
        try {
            democracyRecommendService.deleteCandidate(map);
        }
        catch (Exception e) {
            e.printStackTrace();
            msg = StandardManage.OPERATE_FAIL;
        }
        result.put("result", msg);
        return result;
    }
    /**
* 民主推荐导出列表
*
* @param formBean
* @param request
* @param response
* @param redirectAttributes
* @throws IOException
* @author KLX
* @throws ParseException
*/
    @RequestMapping(value = "candidateExport")
    public String candidateExport(FormBean formBean,String PROCESS_ID,String hytjId,String voteFlag, HttpServletRequest request, HttpServletResponse response,
    RedirectAttributes redirectAttributes) throws IOException, ParseException {
        Map<String, Object> bean = Maps.newHashMap();
        SimpleDateFormat format = new SimpleDateFormat("yyyy-M-dd");
        bean.put("HYTJ_ID", hytjId);
        bean.put("voteFlag", voteFlag);
        List<Map<String, Object>> list = democracyRecommendService.gettCadreHytjHxmdList(bean);
        int index = 0;
        if (list != null && list.size()>0) {
            for (Map<String, Object> map : list) {
                if(map != null && map.size() >0){
                    index++;
                    map.put("INDEX", index);
                    //姓名
                    if(map.containsKey("XM")){
                        map.put("XM",map.get("XM").toString());
                    } else{
                        map.put("XM","");
                    }
                    //性别
                    if(map.containsKey("XB")){
                        map.put("XB",DictUtils.getDictLabel(map.get("XB").toString(), "XB", ""));
                    } else{
                        map.put("XB","");
                    }
                    //出生年月
                    if(map.containsKey("CSRQ")){
                        map.put("CSRQ",DateUtils.formatDate(format.parse(map.get("CSRQ").toString()), "yyyy-MM-dd"));
                    } else{
                        map.put("CSRQ","");
                    }
                    //政治面目
                    if(map.containsKey("ZZMM")){
                        map.put("ZZMM",DictUtils.getDictLabel(map.get("ZZMM").toString(), "ZZMM", ""));
                    } else{
                        map.put("ZZMM","");
                    }
                    //现任职务
                    if(map.containsKey("DUTIES")){
                        map.put("DUTIES",map.get("DUTIES"));
                    } else{
                        map.put("DUTIES","");
                    }
                    //任现职时间
                    if(map.containsKey("TENURE")){
                        map.put("TENURE",DateUtils.formatDate(format.parse(map.get("TENURE").toString()), "yyyy-MM-dd"));
                    } else{
                        map.put("TENURE","");
                    }
                    //任同职级时间
                    if(map.containsKey("LEVEL_TENURE")){
                        map.put("LEVEL_TENURE",DateUtils.formatDate(format.parse(map.get("LEVEL_TENURE").toString()), "yyyy-MM-dd"));
                    } else{
                        map.put("LEVEL_TENURE","");
                    }
                }
            }
        }
        String filename = "民主推荐候选名单" + "(" + DateUtils.getDate("yyyyMMdd") + ").xlsx";
        try {
            ExcelExport excelExport = new ExcelExport(request, filename, "MZTJCandidatesListExcel.xlsx");
            excelExport.addData("list", list);
            excelExport.export(response);
        }
        catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
    /**
* 民主推荐查询
*
* @param formbean
* @param request
* @param response
* @param model
* @return
* @author wzq
*/
    @RequestMapping(value = "addPersonList")
    public String addPersonList(FormBean formbean, HttpServletRequest request, HttpServletResponse response, Model model) {
        FormBeanUtils.preDeal(formbean, request);
        Page<Map<String, Object>> page = democracyRecommendService.getDemocraticRecommendProcessPageList(new Page<Map<String, Object>>(request, response), formbean);
        model.addAttribute("map", formbean);
        model.addAttribute("page", page);
        return "modules/cadre/selection/democracyRecommendAddPersonList";
    }
    /**
* 民主推荐,班子换届 一轮投票
*
* @param formbean
* @param request
* @param response
* @param model
* @return
* @author klx
*/
    @RequestMapping(value = "roundOfVote")
    public String roundOfVote(FormBean formbean, HttpServletRequest request, HttpServletResponse response, Model model) {
        FormBeanUtils.preDeal(formbean, request);
        Page<Map<String, Object>> page = democracyRecommendService.getDemocraticRecommendProcessPageList(new Page<Map<String, Object>>(request, response), formbean);
        model.addAttribute("map", formbean);
        model.addAttribute("page", page);
        return "modules/cadre/selection/democracyRecommendRoundOfVoting";
    }
    /**
* 民主推荐,其他投票
*
* @param formbean
* @param request
* @param response
* @param model
* @return
* @author klx
*/
    @RequestMapping(value = "otherOfVote")
    public String otherOfVote(FormBean formbean, HttpServletRequest request, HttpServletResponse response, Model model) {
        FormBeanUtils.preDeal(formbean, request);
        Page<Map<String, Object>> page = democracyRecommendService.getDemocraticRecommendProcessPageList(new Page<Map<String, Object>>(request, response), formbean);
        model.addAttribute("map", formbean);
        model.addAttribute("page", page);
        return "modules/cadre/selection/democracyRecommendOtherOfVoting";
    }
    /**
* 选择人员列表(正式党员,预备党员)民主推荐,选择人员
* @author Changjielai
* @param excIds 排除的人员id
* @param formbean
* @param request
* @param response
* @param model
* @param orgId
* @return klx
*/
    @RequestMapping(value = "partyMzSelectList")
    public String partyMzSelectList(String excIds,String numIds,String roleId,String mid,String pid,FormBean formbean, HttpServletRequest request, HttpServletResponse response, Model model) {
        FormBeanUtils.preDeal(formbean, request);
        Page<Map<String, Object>> page = null;
        String twoVoteFlag = "";
        Map<String, Object> bean = Maps.newHashMap();
        if (StringUtils.isNotEmpty(pid)) {
            bean.put("NUM_ID", pid);
            bean.put("addFlag", "add");
        }
        bean = democracyRecommendService.getDemocracyRecommendProcessEnty(bean);
        if(null != bean && null != bean.get("D_PRESERVE05")){
            if( 6 > Integer.parseint(bean.get("D_PRESERVE05").toString()) && 0!=Integer.parseint(bean.get("D_PRESERVE05").toString())){
                twoVoteFlag ="1";
            } else if( 6 <= Integer.parseint(bean.get("D_PRESERVE05").toString())){
                twoVoteFlag ="2";
            } else if( 0 == Integer.parseint(bean.get("D_PRESERVE05").toString())){
                twoVoteFlag ="2";
            } else{
                twoVoteFlag ="1";
            }
        } else{
            twoVoteFlag ="1";
        }
        if("1".equals(twoVoteFlag)){
            //1轮
            if(StringUtils.isNotEmpty(roleId)){
                //取得未选择的拟任人的参数
                formbean.getBean().put("roleId", roleId.split(","));
            }
            page = democracyRecommendService.candidateSelectPageList(new Page<Map<String, Object>>(request, response), formbean);
        } else if ("2".equals(twoVoteFlag)){
            if(StringUtils.isNotEmpty(mid)){
                Map<String, Object> idMap1 = Maps.newHashMap();
                idMap1.put("NUM_ID", mid);
                idMap1.put("oneRound", "oneRound");
                String hytjId = "";
                List<Map<String, Object>> idList1 = democracyRecommendService.getMztjHytjId(idMap1);
                if(idList1 != null && idList1.size()>0){
                    hytjId = idList1.get(0).get("NUM_ID").toString();
                }
                Map<String, Object> obj = formbean.getBean();
                obj.put("HYTJ_ID", hytjId);
                obj.put("voteFlag", "1");
                List<Map<String, Object>> democracyRecommendList = democracyRecommendService.gettCadreHytjHxmdList(obj);
                String baseInfoId = "";
                if(democracyRecommendList != null && democracyRecommendList.size()>0){
                    for (Map<String, Object> map:democracyRecommendList){
                        baseInfoId += map.get("PER_NUM_ID")+",";
                    }
                }
                if(!("").equals(baseInfoId)){
                    baseInfoId = baseInfoId.substring(0,baseInfoId.length()-1);
                }
                if(StringUtils.isNotEmpty(roleId)){
                    //取得未选择的拟任人的参数
                    formbean.getBean().put("roleId", roleId.split(","));
                }
                //取得未选择的拟任人的参数
                formbean.getBean().put("BASE_INFO_ID", baseInfoId.split(","));
            }
            page = democracyRecommendService.candidateSelectPageList(new Page<Map<String, Object>>(request, response), formbean);
        }
        //2轮
        FormBeanUtils.afterDeal(formbean, request);
        model.addAttribute("map", formbean);
        model.addAttribute("page", page);
        model.addAttribute("roleId", roleId);
        model.addAttribute("mid", mid);
        model.addAttribute("pid", pid);
        return "modules/common/empUtils/partyMzSelectList";
    }
    /**
* 选择人员列表(正式党员,预备党员)民主推荐,选择人员,参会名单
* @author Changjielai
* @param excIds 排除的人员id
* @param formbean
* @param request
* @param response
* @param model
* @param orgId
* @return klx
*/
    @RequestMapping(value = "partyMzMettingSelectList")
    public String partyMzMettingSelectList(String excIds,String numIds,String roleId,FormBean formbean, HttpServletRequest request, HttpServletResponse response, Model model) {
        FormBeanUtils.preDeal(formbean, request);
        /*formbean.getBean().put("TABLE", "T_CADRE_USER_INFO");
if(StringUtils.isNotEmpty(numIds)){
formbean.getBean().put("BASE_INFO_ID", numIds.split(","));
}
*/
        Page<Map<String, Object>> page = democracyRecommendService.candidateSelectPageList(new Page<Map<String, Object>>(request, response), formbean);
        FormBeanUtils.afterDeal(formbean, request);
        model.addAttribute("map", formbean);
        model.addAttribute("page", page);
        model.addAttribute("roleId", roleId);
        return "modules/common/empUtils/partyMzMettingSelectList";
    }
    /**
* 添加候选名单,返回的回显函数
*
* @param formbean
* @param request
* @param response
* @param model
* @return
* @author klx
*/
    @RequestMapping(value = "partyMzAjaxSelectList")
    public @ResponseBody Map<String, Object> partyMzAjaxSelectList(FormBean formbean, String numIds,String PROCESS_ID,String hytjId,String voteFlag,Model model,HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
        String result = StandardManage.OPERATE_SUCCESS;
        Map<String, Object> bean = Maps.newHashMap();
        Map<String, Object> entity = Maps.newHashMap();
        SimpleDateFormat format = new SimpleDateFormat("yyyy-M-dd");
        //获取当前用户
        User user = UserUtils.getUser();
        String CREATE_BY="";
        if(user != null && null != user.getLoginName()){
            CREATE_BY=user.getLoginName();
        }
        List<Map<String, Object>> page = null;
        try {
            if(StringUtils.isNotEmpty(numIds)){
                bean.put("BASE_INFO_ID", numIds.split(","));
            }
            page = democracyRecommendService.candidateSelectNoPageList(bean, formbean);
            if(page != null && page.size() >0){
                for (Map<String, Object> map : page){
                    Date day=new Date();
                    map.put("NUM_ID",EmpUtilsService.getBeanId());
                    //民主推荐下会议推荐ID
                    map.put("HYTJ_ID",hytjId);
                    //教职工号
                    map.put("QUASI_ID",map.get("ZGH"));
                    map.put("LS",voteFlag);
                    map.put("PRESERVE01",voteFlag);
                    map.put("CREATE_DATE",day);
                    map.put("CREATE_BY",CREATE_BY);
                    map.put("DEL_FLAG","0");
                }
                entity.put("list", page);
                //將數據更新到數據庫
                democracyRecommendService.inserttCadreHytjHxmdList(entity);
            }
            Map<String, Object> obj = Maps.newHashMap();
            obj.put("HYTJ_ID", hytjId);
            obj.put("voteFlag", voteFlag);
            List<Map<String, Object>> listPage = democracyRecommendService.gettCadreHytjHxmdList(obj);
            String empNameIdAllHid = "";
            if(listPage != null && listPage.size()>0){
                for (Map<String, Object> map : listPage){
                    empNameIdAllHid += map.get("PER_NUM_ID")+",";
                    //性别
                    if(map.containsKey("XB")){
                        map.put("XB",DictUtils.getDictLabel(map.get("XB").toString(), "XB", ""));
                    } else{
                        map.put("XB","");
                    }
                    if(map.containsKey("ZZMM") && map.get("ZZMM")!= null && !("").equals(map.get("ZZMM").toString().trim())){
                        map.put("ZZMM",DictUtils.getDictLabel(map.get("zzmm").toString(), "ZZMM", ""));
                    } else{
                        map.put("ZZMM", "");
                    }
                    //时间
                    if(map.containsKey("CSRQ")&& null!= map.get("CSRQ") && !("").equals(map.get("CSRQ").toString().trim())){
                        map.put("CSRQ",DateUtils.formatDate(format.parse(map.get("CSRQ").toString()), "yyyy-MM-dd"));
                    } else{
                        map.put("CSRQ","");
                    }
                    //时间
                    if(map.containsKey("DUTIES")&& null!= map.get("DUTIES") && !("").equals(map.get("DUTIES").toString().trim())){
                    } else{
                        map.put("DUTIES","");
                    }
                    //zhiwu
                    if(map.containsKey("TENURE")&& null!= map.get("TENURE") && !("").equals(map.get("TENURE").toString().trim())){
                    } else{
                        map.put("TENURE","");
                    }
                    //时间
                    if(map.containsKey("LEVEL_TENURE")&& null!= map.get("LEVEL_TENURE") && !("").equals(map.get("LEVEL_TENURE").toString().trim())){
                    } else{
                        map.put("LEVEL_TENURE","");
                    }
                }
                bean.put("list", listPage);
            }
            if(!("").equals(empNameIdAllHid)){
                empNameIdAllHid = empNameIdAllHid.substring(0,empNameIdAllHid.length()-1);
            }
            bean.put("result", result);
            bean.put("empNameIdAllHid", empNameIdAllHid);
        }
        catch (Exception e) {
            e.printStackTrace();
            result = StandardManage.OPERATE_FAIL;
            bean.put("result", result);
        }
        return bean;
    }
    /**
* 导入刷新候选名单数据,返回的回显函数
*
* @param formbean
* @param request
* @param response
* @param model
* @return
* @author klx
*/
    @RequestMapping(value = "MzAjaxSelectPersonList")
    public @ResponseBody Map<String, Object> MzAjaxSelectPersonList(FormBean formbean, String numIds,String PROCESS_ID,String addFlag,String hytjId,String voteFlag,Model model,HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
        String result = StandardManage.OPERATE_SUCCESS;
        Map<String, Object> bean = formbean.getBean();
        bean.put("HYTJ_ID", hytjId);
        bean.put("voteFlag", voteFlag);
        SimpleDateFormat format = new SimpleDateFormat("yyyy-M-dd");
        try {
            List<Map<String, Object>> listPage = democracyRecommendService.gettCadreHytjHxmdList(bean);
            if(listPage != null && listPage.size()>0){
                for (Map<String, Object> map : listPage){
                    //性别
                    if(map.containsKey("XB")){
                        map.put("XB",DictUtils.getDictLabel(map.get("XB").toString(), "XB", ""));
                    } else{
                        map.put("XB","");
                    }
                    if(map.containsKey("ZZMM") && map.get("ZZMM")!= null && !("").equals(map.get("ZZMM").toString().trim())){
                        map.put("ZZMM",DictUtils.getDictLabel(map.get("zzmm").toString(), "ZZMM", ""));
                    } else{
                        map.put("ZZMM", "");
                    }
                    //时间
                    if(map.containsKey("CSRQ")&& null!= map.get("CSRQ") && !("").equals(map.get("CSRQ").toString().trim())){
                        map.put("CSRQ",DateUtils.formatDate(format.parse(map.get("CSRQ").toString()), "yyyy-MM-dd"));
                    } else{
                        map.put("CSRQ","");
                    }
                    //时间
                    if(map.containsKey("DUTIES")&& null!= map.get("DUTIES") && !("").equals(map.get("DUTIES").toString().trim())){
                    } else{
                        map.put("DUTIES","");
                    }
                    //zhiwu
                    if(map.containsKey("TENURE")&& null!= map.get("TENURE") && !("").equals(map.get("TENURE").toString().trim())){
                    } else{
                        map.put("TENURE","");
                    }
                    //时间
                    if(map.containsKey("LEVEL_TENURE")&& null!= map.get("LEVEL_TENURE") && !("").equals(map.get("LEVEL_TENURE").toString().trim())){
                    } else{
                        map.put("LEVEL_TENURE","");
                    }
                }
            }
            bean.put("list", listPage);
            bean.put("result", result);
        }
        catch (Exception e) {
            e.printStackTrace();
            result = StandardManage.OPERATE_FAIL;
            bean.put("result", result);
        }
        return bean;
    }
    /* */
    /**
* 解析表头
*
* @author Changjielai
* @param exportInfo
* @return
*/
    /*
private static Map<String, Object> getExportInfo(String exportInfo) {
Map<String, Object> exportMap = Maps.newHashMap();
if (com.thinkgem.jeesite.common.utils.StringUtils.isNotEmpty(exportInfo)) {
JSONArray exportInfoArray = JSONArray.fromObject(exportInfo);
List<String> headerList = Lists.newArrayList();
List<String> codeList = Lists.newArrayList();
String[] columnName = new String[exportInfoArray.size()];
for (int i = 0; i < exportInfoArray.size(); i++) {
JSONObject jsonObject = exportInfoArray.getJSONObject(i);
columnName[i] = jsonObject.getString("column");
headerList.add(jsonObject.getString("name"));
codeList.add(jsonObject.getString("code"));
}
exportMap.put("headerList", headerList);
exportMap.put("codeList", codeList);
exportMap.put("columnName", columnName);
}
return exportMap;
}*/
    //导出
    @RequestMapping(value = "import", method = RequestMethod.POST)
    @ResponseBody
    public Object importFile(MultipartFile file,String paramID, String voteFlag,RedirectAttributes redirectAttributes) {
        Map<String, Object> result = new HashMap<>();
        Date day=new Date();
        Boolean falg = true;
        //获取当前用户
        User user = UserUtils.getUser();
        String CREATE_BY="";
        if(user != null && null != user.getLoginName()){
            CREATE_BY=user.getLoginName();
        }
        try {
            List<String> list = new ArrayList<String>();
            int successNum = 0;
            int failureNum = 0;
            StringBuilder failureMsg = new StringBuilder();
            StringBuilder message = new StringBuilder("<br>");
            ImportExcel ei = new ImportExcel(file, 1, 0);
            int len = ei.getLastDataRowNum();
            for (int i = 2; i < len; i++) {
                Row row = ei.getRow(i);
                Object cell0 = getCellValue(row, 0).toString().trim();
                Object cell1 = getCellValue(row, 1).toString().trim();
                // 判断是否全部为空
                if (StringUtils.isEmpty(cell0.toString())&&StringUtils.isEmpty(cell1.toString())) {
                    continue;
                }
                // 验证
                StringBuilder msg = new StringBuilder();
                if (StringUtils.isEmpty(cell0.toString())) {
                    msg.append("教职工号缺失,");
                } else if (cell0.toString().length() > 30) {
                    msg.append("教职工号输入过长,");
                }
                if (StringUtils.isNotEmpty(cell0.toString())) {
                    if (list.contains(cell0.toString())) {
                        msg.append("教职工号重复,");
                    } else {
                        // 判断数据库是否有相同拟任人数据
                        Map<String, Object> searchParams = new HashMap<>();
                        searchParams.put("ZGH", cell0);
                        searchParams.put("HYTJ_ID", paramID);
                        List<Map<String, Object>> remindList = democracyRecommendService.gettCadreHytjHxmdList(searchParams);
                        if (CollectionUtils.isNotEmpty(remindList)) {
                            falg = false;
                            msg.append("教职工号重复,");
                        } else {
                            list.add(cell0.toString());
                        }
                        //判断人事表是否有该编号的人
                        List<Map<String, Object>> cadre = democracyRecommendService.candidateSelectListByOneZGH(searchParams);
                        if(cadre == null || cadre.size() <=0){
                            falg = false;
                            msg.append("人员在人事系统中不存在");
                        }
                        if(falg){
                            List<Map<String, Object>> objList = new ArrayList<Map<String,Object>>();
                            Map<String, Object> m = Maps.newHashMap();
                            Map<String, Object> entity = Maps.newHashMap();
                            m.put("NUM_ID",EmpUtilsService.getBeanId());
                            //民主推荐下会议推荐ID
                            m.put("HYTJ_ID",paramID);
                            //教职工号
                            m.put("QUASI_ID",cadre.get(0).get("ZGH"));
                            m.put("LS",voteFlag);
                            m.put("PRESERVE01",voteFlag);
                            m.put("CREATE_DATE",day);
                            m.put("CREATE_BY",CREATE_BY);
                            m.put("DEL_FLAG","0");
                            objList.add(m);
                            entity.put("list", objList);
                            democracyRecommendService.inserttCadreHytjHxmdList(entity);
                            successNum++;
                        }
                        falg = true;
                    }
                }
                if (msg.length() > 0) {
                    msg.insert(0, "第" + (i + 1) + "行,");
                    msg.deleteCharAt(msg.length() - 1);
                    msg.append(";<br>");
                    message.append(msg);
                    failureNum++;
                    continue;
                }
            }
            if (failureNum > 0) {
                failureMsg.insert(0, ",失败 " + failureNum + " 条记录。");
            }
            result.put("error_code", 0);
            result.put("message", "已成功导入 " + successNum + " 条记录" + failureMsg + message);
            return result;
            // addMessage(redirectAttributes, "已成功导入 " + successNum + " 条记录" + failureMsg + message);
        }
        catch (Exception e) {
            result.put("error_code", 10000);
            result.put("message", "导入失败!失败信息:" + e.getMessage());
            return result;
            // addMessage(redirectAttributes, "导入失败!失败信息:" + e.getMessage());
        }
    }
    @RequestMapping(value = "reload", method = RequestMethod.POST)
    public String reload(HttpServletRequest request, HttpServletResponse response,
    RedirectAttributes redirectAttributes) throws Exception {
        return "redirect:" + Global.getAdminPath() + "/selection/democracyRecommend/?repage";
    }
    @RequestMapping(value = "import/template")
    public String importFileTemplate(HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes)
    throws Exception {
        democracyRecommendService.exporTemplate(request, response);
        return null;
    }
    /**
* 保存投票方案
*
* @param formbean
* @param request
* @param response
* @return
* @author KLX
* @throws IOExceptionE
*/
    @RequestMapping(value = "insertTCadreMztjHytj")
    public @ResponseBody Map<String, Object> insertTCadreMztjHytj(FormBean formbean, Model model,
    HttpServletRequest request, HttpServletResponse response,
    RedirectAttributes redirectAttributes) throws IOException {
        String result = StandardManage.OPERATE_SUCCESS;
        Map<String, Object> map = Maps.newHashMap();
        Date day=new Date();
        String voteFlag = request.getParameter("voteFlagHid");
        String hytjid = request.getParameter("hytjIdHid");
        //获取当前用户
        User user = UserUtils.getUser();
        String UPDATE_BY="";
        if(user != null && null != user.getLoginName()){
            UPDATE_BY=user.getLoginName();
        }
        Map<String, Object> bean = formbean.getBean();
        if(bean != null ){
            bean.put("UPDATE_BY", UPDATE_BY);
            bean.put("UPDATE_DATE", day);
            bean.put("NUM_ID", hytjid);
            if(null != voteFlag && "2".equals(voteFlag)){
                bean.put("voteFlag", "2");
            } else{
                bean.put("voteFlag", "1");
            }
        }
        try {
            democracyRecommendService.updateTCadreMztjHytj(FormBeanUtils.parse(bean));
        }
        catch (Exception e) {
            e.printStackTrace();
            result = StandardManage.OPERATE_FAIL;
        }
        map.put("result", result);
        return map;
    }
    //生成二维码
    @RequestMapping(value = "exportQR")
    public void exportImg(FormBean formBean,String isCanVoteFlag,String PROCESS_ID,String HYTJ_NUM_ID,String voteFlag,String transitionType, HttpServletRequest request, HttpServletResponse response) throws ParseException {
        ZipOutputStream zos = null;
        try {
            Map<String, Object> searchParams = Maps.newHashMap();
            searchParams.put("NUM_ID", PROCESS_ID);
            Map<String, Object> result = democracyRecommendService.getDemocracyRecommendProcessEnty(searchParams);
            String fileName = "";
            String year = "";
            String name = "";
            if(result != null ){
                if(result.containsKey("PROCESS_NAME") && null != result.get("PROCESS_NAME")){
                    name = result.get("PROCESS_NAME").toString();
                }
                if(result.containsKey("PROCESS_YEAR") && null != result.get("PROCESS_YEAR")){
                    year = result.get("PROCESS_YEAR").toString();
                }
                fileName = name +"-民主推荐投票";
                result.put("fileName", fileName);
            }
            response.setContentType("application/octet-stream");
            // 指明response的返回对象是文件流
            response.setHeader("Content-Disposition", "attachment;filename=" + java.net.URLEncoder.encode(fileName, "UTF-8") + ".zip");
            // 设置在下载框默认显示的文件名
            zos = new ZipOutputStream(response.getOutputStream());
            String url = CommonUtil.getServerUrl(request);
            String code = "";
            if(("0").equals(transitionType)){
                //班子换届页面
                code = url + "/mobile/selection/democracyRecommendRoundOfVoting/list?PROCESS_ID="+PROCESS_ID+"&HYTJ_NUM_ID="+HYTJ_NUM_ID+"&voteFlag="+voteFlag+"&isCanVoteFlag="+isCanVoteFlag;
            } else{
                //其他投票页面
                code = url + "/mobile/selection/democracyRecommendOtherOfVoting/list?PROCESS_ID="+PROCESS_ID+"&HYTJ_NUM_ID="+HYTJ_NUM_ID+"&voteFlag="+voteFlag+"&isCanVoteFlag="+isCanVoteFlag;
            }
            // 生成二维码
            BufferedImage image = QRCodeUtils.createQRCode(code);
            image = QRCodeUtils.meetOtherVoit(image, result);
            zos.putNextEntry(new ZipEntry(fileName + ".png"));
            // 命名
            ImageIO.write(image, "png",zos);
            zos.flush();
            zos.close();
        }
        catch (IOException e) {
            e.printStackTrace();
        }
        finally {
            if (zos != null) {
                try {
                    zos.flush();
                    zos.close();
                }
                catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
    /**
* 结束投票,更新爷们民主推荐下谈话推荐投票数据,t_cadre_mztj_vote
*
* @param formbean
* @param request
* @param response
* @return
* @author KLX
* @throws IOException
*/
    @RequestMapping(value = "showTCadreMztjVote")
    public @ResponseBody Map<String, Object> showTCadreMztjVote(FormBean formbean, Model model,String HYTJ_ID,String voteFlag,
    HttpServletRequest request, HttpServletResponse response,
    RedirectAttributes redirectAttributes) throws IOException {
        String result = StandardManage.OPERATE_SUCCESS;
        //取得1轮实投票数
        Map<String, Object> voteSumBean = Maps.newHashMap();
        voteSumBean.put("HYTJ_NUM_ID", HYTJ_ID);
        voteSumBean.put("voteFlag", voteFlag);
        //取得一轮投票的总票数
        Map<String, Object> voteSumMap = democracyRecommendService.getvoteSum(voteSumBean);
        int voteSum = 0;
        if( null != voteSumMap && voteSumMap.get("voteSum") != null){
            voteSum = Integer.parseint(voteSumMap.get("voteSum").toString());
        }
        /* //更新会议推荐的实投票数
Map<String, Object> voteBean = Maps.newHashMap();
voteBean.put("NUM_ID", HYTJ_ID);
voteBean.put("HYTJ_ACTUAL_NUM", (voteSum==0?"0":voteSum));
voteBean.put("voteFlag", voteFlag);
democracyRecommendService.updateTCadreMztjHytj(voteBean);*/
        Map<String, Object> map = Maps.newHashMap();
        List<Map<String, Object>> list = null;
        map.put("HYTJ_ID", HYTJ_ID);
        map.put("voteFlag", voteFlag);
        try {
            if(null != democracyRecommendService.gettCadreHytjVotelist(map) && democracyRecommendService.gettCadreHytjVotelist(map).size() >0){
                list = democracyRecommendService.gettCadreHytjVotelist(map);
            }
        }
        catch (Exception e) {
            e.printStackTrace();
            result = StandardManage.OPERATE_FAIL;
        }
        map.put("result", result);
        map.put("voteSum", voteSum);
        map.put("list", list);
        return map;
    }
    /**
* 二轮投票,把一轮投票的候选名单更新到二轮投票的候选名单中
*
* @param formbean
* @param request
* @param response
* @return
* @author KLX
* @throws IOException
*/
    @RequestMapping(value = "updateHytjHxmdAjax")
    public @ResponseBody Map<String, Object> updateHytjHxmdAjax(FormBean formbean, Model model,String HYTJ_ID,String voteFlag,
    String HYTJ_NUM_ID,String did,HttpServletRequest request, HttpServletResponse response,
    RedirectAttributes redirectAttributes) throws IOException {
        String result = StandardManage.OPERATE_SUCCESS;
        //取得会议推荐信息
        Map<String, Object> hytjmap = Maps.newHashMap();
        hytjmap.put("NUM_ID", HYTJ_NUM_ID);
        Map<String, Object> hytjInfo = democracyRecommendService.getMztjHytjInfo(hytjmap);
        String id = EmpUtilsService.getBeanId();
        if(hytjInfo != null){
            Map<String, Object> hytjObj = Maps.newHashMap();
            hytjObj.put("NUM_ID", id);
            hytjObj.put("DEMOCRATIC_ID",hytjInfo.get("DEMOCRATIC_ID"));
            hytjObj.put("HYTJ_STATUS", hytjInfo.get("HYTJ_STATUS"));
            hytjObj.put("HANDLE_ID", hytjInfo.get("HANDLE_ID"));
            hytjObj.put("MOTION_COMPLETE", hytjInfo.get("MOTION_COMPLETE"));
            hytjObj.put("HYTJ_RANGE", hytjInfo.get("HYTJ_RANGE"));
            hytjObj.put("HYTJ_NAMELIST", hytjInfo.get("HYTJ_NAMELIST"));
            hytjObj.put("SHOULD_NUM", "0");
            hytjObj.put("ACTUAL_NUM", "0");
            hytjObj.put("CREATE_DATE", hytjInfo.get("CREATE_DATE"));
            hytjObj.put("CREATE_BY", hytjInfo.get("CREATE_BY"));
            hytjObj.put("PRESERVE03", hytjInfo.get("PRESERVE03"));
            hytjObj.put("DEL_FLAG", hytjInfo.get("DEL_FLAG"));
            hytjObj.put("TPFS", hytjInfo.get("TPFS"));
            //二轮会议推荐的标识
            hytjObj.put("PRESERVE04", "2");
            democracyRecommendService.insertMztjHytj(hytjObj);
        }
        Map<String, Object> map = Maps.newHashMap();
        //获取当前用户
        /* User user = UserUtils.getUser();
String CREATE_BY="";
if(user != null && null != user.getLoginName()){
CREATE_BY=user.getLoginName();
}*/
        try {
            /* Map<String, Object> obj = formbean.getBean();
obj.put("HYTJ_ID", HYTJ_ID);
obj.put("voteFlag", "1");
List<Map<String, Object>> hxmdList = democracyRecommendService.gettCadreHytjHxmdList(obj);
Map<String, Object> listMap = formbean.getBean();
if(null != hxmdList && hxmdList.size()>0){
for(Map<String, Object> m:hxmdList){
Date day=new Date();
if(m.containsKey("PRESERVE01") && null != m.get("PRESERVE01")){
m.put("PRESERVE01", "2");
}else{
m.put("PRESERVE01", "2");
}
if(m.containsKey("NUM_ID") && null != m.get("NUM_ID")){
m.put("NUM_ID", EmpUtilsService.getBeanId());
}else{
m.put("NUM_ID",EmpUtilsService.getBeanId());
}
m.put("CREATE_BY",CREATE_BY);
m.put("CREATE_DATE",day);
m.put("LS","2");
m.put("HYTJ_ID",id);
}
listMap.put("list", hxmdList);
democracyRecommendService.inserttCadreHytjHxmdList(listMap);
}*/
            Map<String, Object> idMap1 = Maps.newHashMap();
            idMap1.put("NUM_ID", did);
            idMap1.put("oneRound", "oneRound");
            Map<String, Object> idMap2 = Maps.newHashMap();
            idMap2.put("NUM_ID", did);
            idMap2.put("secondRound", "secondRound");
            List<Map<String, Object>> idList1 = democracyRecommendService.getMztjHytjId(idMap1);
            List<Map<String, Object>> idList2 = democracyRecommendService.getMztjHytjId(idMap2);
            String hytjId1 ="";
            String hytjId2 ="";
            if(idList1 != null && idList1.size()>0){
                hytjId1 = idList1.get(0).get("NUM_ID").toString();
            }
            if(idList2 != null && idList2.size()>0){
                hytjId2 = idList2.get(0).get("NUM_ID").toString();
            }
            map.put("hytjId1", hytjId1);
            map.put("hytjId2", hytjId2);
            map.put("result", result);
        }
        catch (Exception e) {
            e.printStackTrace();
            map.put("hytjId1", "");
            map.put("hytjId2", "");
            result = StandardManage.OPERATE_FAIL;
            map.put("result", result);
        }
        return map;
    }
    /**
* 完成投票方案
*
* @param formbean
* @param request
* @param response
* @return
* @author KLX
* @throws IOException
*/
    @RequestMapping(value = "finishedCadreMztjHytj")
    public @ResponseBody Map<String, Object> finishedCadreMztjHytj(FormBean formbean, Model model,String voteFlag,String hytjid,
    String D_NUM_ID,String THTJ_NUM_ID,HttpServletRequest request, HttpServletResponse response,
    RedirectAttributes redirectAttributes) throws IOException {
        String MOTION_COMPLETE_NEW = request
        .getParameter("MOTION_COMPLETE_NEW");
        String HANDLE_ID = request.getParameter("HANDLE_ID");
        String empName = request.getParameter("empNameHid");
        String zgh ="";
        //根据id查出教职工号
        Map<String, Object> zghMap = Maps.newHashMap();
        zghMap.put("NUM_ID", HANDLE_ID);
        List<Map<String, Object>> zghList = democracyRecommendService.getRsPartyZghById(zghMap);
        if(zghList != null && zghList.size() >0){
            zgh = zghList.get(0).get("ZGH").toString();
        }
        String result = StandardManage.OPERATE_SUCCESS;
        Map<String, Object> map = Maps.newHashMap();
        Date day=new Date();
        //获取当前用户
        User user = UserUtils.getUser();
        String UPDATE_BY="";
        if(user != null && null != user.getLoginName()){
            UPDATE_BY=user.getLoginName();
        }
        Map<String, Object> bean = formbean.getBean();
        Map<String, Object> updaeMap = Maps.newHashMap();
        String PRESERVE04Str = "";
        try {
            if(null != bean){
                //将会议投票的数据更新到谈话推荐
                Map<String, Object> thtjMap = Maps.newHashMap();
                Map<String, Object> talkMap = Maps.newHashMap();
                List<Map<String, Object>> list= new ArrayList<Map<String,Object>>();
                List<Map<String, Object>> hytjVotelist = null;
                thtjMap.put("HYTJ_ID", hytjid);
                thtjMap.put("voteFlag", voteFlag);
                if(null != democracyRecommendService.gettCadreHytjVotelist(thtjMap) && democracyRecommendService.gettCadreHytjVotelist(thtjMap).size() >0){
                    hytjVotelist = democracyRecommendService.gettCadreHytjVotelist(thtjMap);
                    for (Map<String, Object> m : hytjVotelist){
                        Map<String, Object> talkParamterMap = Maps.newHashMap();
                        talkParamterMap.put("NUM_ID",EmpUtilsService.getBeanId());
                        talkParamterMap.put("DEL_FLAG","0");
                        talkParamterMap.put("QUASI_ID",m.get("QUASI_ID"));
                        talkParamterMap.put("POST_ID",m.get("POST_ID"));
                        talkParamterMap.put("EFFECTIVE_NUM","");
                        talkParamterMap.put("GET_NUM","");
                        talkParamterMap.put("THTJ_ID",THTJ_NUM_ID);
                        talkParamterMap.put("LS",m.get("LS"));
                        talkParamterMap.put("CREATE_BY",UPDATE_BY );
                        talkParamterMap.put("CREATE_DATE", day);
                        talkParamterMap.put("UPDATE_BY", UPDATE_BY);
                        talkParamterMap.put("UPDATE_DATE", day);
                        list.add(talkParamterMap);
                    }
                    talkMap.put("list", list);
                    democracyRecommendService.insertLisMztjVoteAddPerson(FormBeanUtils.parse(talkMap));
                }
                //更新父节点里的子节点状态的状态
                if(null != bean.get("DD_PRESERVE04") && bean.get("DD_PRESERVE04").toString().length() >0){
                    PRESERVE04Str = bean.get("DD_PRESERVE04").toString();
                    if(PRESERVE04Str.length() != (PRESERVE04Str.indexOf("-")+1)){
                        PRESERVE04Str = PRESERVE04Str.substring((PRESERVE04Str.indexOf("-")+1)) ;
                    } else{
                        PRESERVE04Str ="";
                    }
                }
                updaeMap.put("NUM_ID", D_NUM_ID);
                updaeMap.put("UPDATE_BY", UPDATE_BY);
                updaeMap.put("UPDATE_DATE", day);
                //更新子节点的字符拼接
                updaeMap.put("PRESERVE04", PRESERVE04Str);
                democracyRecommendService.updateDemocraticRecommend(updaeMap);
            }
            if(null != voteFlag && "2".equals(voteFlag)){
                if(bean != null ){
                    bean.put("UPDATE_BY", UPDATE_BY);
                    bean.put("UPDATE_DATE", day);
                    bean.put("NUM_ID", hytjid);
                    bean.put("HYTJ_STATUS", "1");
                    bean.put("MOTION_COMPLETE", MOTION_COMPLETE_NEW);
                    bean.put("HANDLE_ID", zgh);
                    bean.put("PRESERVE05", empName);
                    if(null != voteFlag && "2".equals(voteFlag)){
                        bean.put("voteFlag", "2");
                    } else{
                        bean.put("voteFlag", "1");
                    }
                }
                //更新二次投票的数据
                democracyRecommendService.updateTCadreMztjHytj(FormBeanUtils.parse(bean));
                ////更新第一次投票的数据
                Map<String, Object> m = Maps.newHashMap();
                m.put("HYTJ_STATUS", "1");
                m.put("D_NUM_ID", D_NUM_ID);
                m.put("voteFlag", "1");
                m.put("MOTION_COMPLETE", MOTION_COMPLETE_NEW);
                m.put("HANDLE_ID", HANDLE_ID);
                m.put("PRESERVE05", empName);
                democracyRecommendService.updateTCadreMztjHytj(FormBeanUtils.parse(m));
            }
            if(null != voteFlag && "1".equals(voteFlag)){
                if(bean != null ){
                    bean.put("UPDATE_BY", UPDATE_BY);
                    bean.put("UPDATE_DATE", day);
                    bean.put("NUM_ID", hytjid);
                    bean.put("HYTJ_STATUS", "1");
                    bean.put("MOTION_COMPLETE", MOTION_COMPLETE_NEW);
                    bean.put("HANDLE_ID", HANDLE_ID);
                    bean.put("PRESERVE05", empName);
                    if(null != voteFlag && "2".equals(voteFlag)){
                        bean.put("voteFlag", "2");
                    } else{
                        bean.put("voteFlag", "1");
                    }
                }
                democracyRecommendService.updateTCadreMztjHytj(FormBeanUtils.parse(bean));
            }
        }
        catch (Exception e) {
            e.printStackTrace();
            result = StandardManage.OPERATE_FAIL;
        }
        map.put("result", result);
        return map;
    }
    /**
* 更新民主推荐子节点的阶段标识方案
*
* @param formbean
* @param request
* @param response
* @return
* @author KLX
* @throws IOException
*/
    @RequestMapping(value = "updateDemocraticRecommend")
    public @ResponseBody Map<String, Object> updateDemocraticRecommend(FormBean formbean, Model model,String voteFlag,String D_PRESERVE05,
    String D_PRESERVE04,String D_NUM_ID,HttpServletRequest request, HttpServletResponse response,
    RedirectAttributes redirectAttributes) throws IOException {
        String result = StandardManage.OPERATE_SUCCESS;
        Map<String, Object> map = Maps.newHashMap();
        Map<String, Object> bean = formbean.getBean();
        try {
            if(bean != null ){
                //民主推荐的主键
                bean.put("NUM_ID", D_NUM_ID);
                //民主推荐下各阶段的标识
                bean.put("PRESERVE05", D_PRESERVE05);
                //更新二次投票的数据
                democracyRecommendService.updateDemocraticRecommend(FormBeanUtils.parse(bean));
            }
        }
        catch (Exception e) {
            e.printStackTrace();
            result = StandardManage.OPERATE_FAIL;
        }
        map.put("result", result);
        return map;
    }
    /**
* 初始化会议和民主c测评数据
*
* @param formbean
* @param request
* @param response
* @return
* @author KLX
* @throws IOException
*/
    @RequestMapping(value = "meetingAndmzcpShow")
    public @ResponseBody Map<String, Object> meetingAndmzcpShow(FormBean formbean, Model model,String pid,String twoVoteFlag,
    String D_NUM_ID,HttpServletRequest request, HttpServletResponse response,
    RedirectAttributes redirectAttributes) throws IOException {
        // 获取当前用户
        User user = UserUtils.getUser();
        String CREATE_BY = "";
        if (user != null && null != user.getLoginName()) {
            CREATE_BY = user.getLoginName();
        }
        Date day = new Date();
        String result = StandardManage.OPERATE_SUCCESS;
        Map<String, Object> map = Maps.newHashMap();
        Map<String, Object> idMap1 = Maps.newHashMap();
        idMap1.put("NUM_ID", D_NUM_ID);
        idMap1.put("oneRound", "oneRound");
        Map<String, Object> idMap2 = Maps.newHashMap();
        idMap2.put("NUM_ID", D_NUM_ID);
        idMap2.put("secondRound", "secondRound");
        List<Map<String, Object>> idList1 = democracyRecommendService.getMztjHytjId(idMap1);
        List<Map<String, Object>> idList2 = democracyRecommendService.getMztjHytjId(idMap2);
        String hytjId1 ="";
        String hytjId2 ="";
        String hytjId = "";
        String voteFlag ="";
        if(idList1 != null && idList1.size()>0){
            hytjId1 = idList1.get(0).get("NUM_ID").toString();
        }
        if(idList2 != null && idList2.size()>0){
            hytjId2 = idList2.get(0).get("NUM_ID").toString();
        }
        if(null != twoVoteFlag && !("").equals(twoVoteFlag)){
            if("1".equals(twoVoteFlag)){
                hytjId = hytjId1;
                voteFlag ="1";
            } else if("2".equals(twoVoteFlag)){
                hytjId = hytjId2;
                voteFlag ="1";
            }
        } else{
            hytjId = hytjId1;
            voteFlag ="1";
        }
        Map<String, Object> bean = Maps.newHashMap();
        bean.put("PROCESS_ID", pid);
        // 现任任免表职务
        List<Map<String, Object>> selectionList = democracyRecommendService
        .getSelectionList(bean, null);
        try {
            if(selectionList != null && selectionList.size() >0 ){
                for (Map<String, Object> m:selectionList){
                    Map<String, Object> selectionMap = Maps.newHashMap();
                    selectionMap.put("NUM_ID", EmpUtilsService.getBeanId());
                    selectionMap.put("THTJ_ID", hytjId);
                    selectionMap.put("BASE_INFO_ID",m.get("TMRP_NUM_ID") );
                    selectionMap.put("SELECTION_ID",m.get("TCS_NUM_ID"));
                    selectionMap.put("ZHPJ_DUTIES", m.get("DUTIES"));
                    selectionMap.put("DEL_FLAG", "0");
                    //selectionMap.put("PRESERVE01", "");
                    selectionMap.put("CREATE_BY", CREATE_BY);
                    selectionMap.put("CREATE_DATE",day );
                    selectionMap.put("UPDATE_BY", CREATE_BY);
                    selectionMap.put("UPDATE_DATE", day);
                    democracyRecommendService.insertZhpj(selectionMap);
                }
            }
        }
        catch (Exception e) {
            e.printStackTrace();
            result = StandardManage.OPERATE_FAIL;
        }
        map.put("result", result);
        return map;
    }
    /**
* 民主推荐,添加人员页面
*
* @param formbean
* @param request
* @param response
* @param model
* @return
* @author klx
*/
    @RequestMapping(value = "addDemocraticRecommendationPersonForm")
    public String addDemocraticRecommendationPersonForm(FormBean formbean,String processId,String thtjNumId,String twoVoteFlag, HttpServletRequest request, HttpServletResponse response, Model model) {
        FormBeanUtils.preDeal(formbean, request);
        Map<String, Object> bean = Maps.newHashMap();
        bean.put("PROCESS_ID", processId);
        bean.put("thtjNumId", thtjNumId);
        bean.put("twoVoteFlag", twoVoteFlag);
        //职务集合
        List<Dict> electivePostList = democracyRecommendService.getelectivePostDictListByProcessId(bean);
        model.addAttribute("postList", electivePostList);
        model.addAttribute("bean", bean);
        model.addAttribute("map", formbean);
        return "modules/cadre/selection/addDemocraticRecommendationPersonForm";
    }
    /**
* 民主推荐保存
*
* @param formbean
* @param request
* @param response
* @return
* @author klx
*/
    @RequestMapping(value = "insertLisMztjVoteAddPerson")
    public
    @ResponseBody
    String saveTalkAddPerson(FormBean formbean, Model model,RedirectAttributes redirectAttributes) {
        String result = StandardManage.OPERATE_SUCCESS;
        Map<String, Object> bean = formbean.getBean();
        Date day=new Date();
        //获取当前用户
        User user = UserUtils.getUser();
        String UPDATE_BY="";
        if(user != null && null != user.getLoginName()){
            UPDATE_BY=user.getLoginName();
        }
        List<Map<String, Object>> list= new ArrayList<Map<String,Object>>();
        try {
            if(bean != null ){
                String zgh ="";
                //根据id查出教职工号
                Map<String, Object> zghMap = Maps.newHashMap();
                zghMap.put("NUM_ID", bean.get("QUASI_ID"));
                List<Map<String, Object>> zghList = democracyRecommendService.getRsPartyZghById(zghMap);
                if(zghList != null && zghList.size() >0){
                    zgh = zghList.get(0).get("ZGH").toString();
                }
                //查询库里是否已有拟任人
                Map<String, Object> map = Maps.newHashMap();
                map.put("QUASI_ID", zgh);
                map.put("POST_ID", bean.get("POST_ID"));
                map.put("NUM_ID", bean.get("NUM_ID"));
                List<Map<String, Object>> mztjVotelist = democracyRecommendService.getmztjVoteList(map);
                if(mztjVotelist != null && mztjVotelist.size()>0){
                    result ="该人员已有相同的职务";
                } else{
                    bean.put("NUM_ID",EmpUtilsService.getBeanId());
                    bean.put("DEL_FLAG","0");
                    bean.put("QUASI_ID",zgh);
                    bean.put("POST_ID",bean.get("POST_ID"));
                    bean.put("EFFECTIVE_NUM",bean.get("EFFECTIVE_NUM"));
                    bean.put("GET_NUM",bean.get("GET_NUM"));
                    bean.put("THTJ_ID",bean.get("thtjNumId"));
                    bean.put("LS",bean.get("LS"));
                    bean.put("CREATE_BY",UPDATE_BY );
                    bean.put("CREATE_DATE", day);
                    bean.put("UPDATE_BY", UPDATE_BY);
                    bean.put("UPDATE_DATE", day);
                    list.add(bean);
                    bean.put("list", list);
                    democracyRecommendService.insertLisMztjVoteAddPerson(FormBeanUtils.parse(bean));
                    Map<String, Object> postMap = Maps.newHashMap();
                    postMap.put("POST_ID",bean.get("POST_ID"));
                    postMap.put("EFFECTIVE_NUM",bean.get("EFFECTIVE_NUM"));
                    postMap.put("THTJ_ID",bean.get("thtjNumId"));
                    //更新通知我的有效票数
                    democracyRecommendService.updateMztjVoteAddPerson(FormBeanUtils.parse(postMap));
                }
            }
        }
        catch (Exception e) {
            e.printStackTrace();
            result = StandardManage.OPERATE_FAIL;
        }
        return result;
    }
    /**
* 完成投票谈话推荐
*
* @param formbean
* @param request
* @param response
* @return
* @author KLX
* @throws IOException
*/
    @RequestMapping(value = "finishedTalk")
    public @ResponseBody Map<String, Object> finishedTalk(FormBean formbean, Model model,String numid,String THTJ_NUM_ID,String twoVoteFlag,String D_NUM_ID,
    HttpServletRequest request, HttpServletResponse response,
    RedirectAttributes redirectAttributes) throws IOException {
        String MOTION_COMPLETE_NEW = request
        .getParameter("MOTION_COMPLETE_NEW");
        String HANDLE_ID = request.getParameter("HANDLE_ID");
        String empName = request.getParameter("empName");
        String zgh ="";
        //根据id查出教职工号
        Map<String, Object> zghMap = Maps.newHashMap();
        zghMap.put("NUM_ID", HANDLE_ID);
        List<Map<String, Object>> zghList = democracyRecommendService.getRsPartyZghById(zghMap);
        if(zghList != null && zghList.size() >0){
            zgh = zghList.get(0).get("ZGH").toString();
        }
        //取得谈话推荐的集合数据
        Map<String, Object> thtjMap = Maps.newHashMap();
        List<Map<String, Object>> thtjVotelist = null;
        thtjMap.put("NUM_ID", numid);
        thtjMap.put("LS", twoVoteFlag);
        if(null != democracyRecommendService.getmztjVoteList(thtjMap) && democracyRecommendService.getmztjVoteList(thtjMap).size() >0){
            thtjVotelist = democracyRecommendService.getmztjVoteList(thtjMap);
        }
        String result = StandardManage.OPERATE_SUCCESS;
        Map<String, Object> mapEntity = Maps.newHashMap();
        Map<String, Object> map = Maps.newHashMap();
        List<Map<String, Object>> mapList = new ArrayList<Map<String,Object>>();
        Date day=new Date();
        //获取当前用户
        User user = UserUtils.getUser();
        String UPDATE_BY="";
        if(user != null && null != user.getLoginName()){
            UPDATE_BY=user.getLoginName();
        }
        Map<String, Object> bean = formbean.getBean();
        String PRESERVE04Str = "";
        Map<String, Object> updaeMap = Maps.newHashMap();
        try {
            if(bean != null ){
                bean.put("UPDATE_BY", UPDATE_BY);
                bean.put("UPDATE_DATE", day);
                bean.put("HYTJ_STATUS", "1");
                bean.put("MOTION_COMPLETE", MOTION_COMPLETE_NEW);
                bean.put("HANDLE_ID", zgh);
                bean.put("NUM_ID", THTJ_NUM_ID);
                bean.put("PRESERVE05", empName);
                //更新谈话推荐
                democracyRecommendService.updateMztjThtjInfo(FormBeanUtils.parse(bean));
                if(thtjVotelist != null && thtjVotelist.size()>0){
                    for (Map<String, Object> m:thtjVotelist){
                        Map<String, Object> mapMap = Maps.newHashMap();
                        mapMap.put("NUM_ID", MapUtils.getObject(bean, "NUM_ID" + m.get("NUM_ID"), null));
                        mapMap.put("EFFECTIVE_NUM", MapUtils.getObject(bean, "EFFECTIVE_NUM" + m.get("NUM_ID"), null));
                        mapMap.put("GET_NUM", MapUtils.getObject(bean, "GET_NUM" + m.get("NUM_ID"), null));
                        mapMap.put("PROBABILITY", MapUtils.getObject(bean, "PROBABILITY" + m.get("NUM_ID"), null));
                        mapMap.put("UPDATE_BY", UPDATE_BY);
                        mapMap.put("UPDATE_DATE", day);
                        if(mapMap.get("NUM_ID") != null ){
                            mapList.add(mapMap);
                        }
                    }
                }
                if(mapList != null && mapList.size()>0){
                    mapEntity.put("list", mapList);
                    //更新谈话投票
                    democracyRecommendService.updateLisMztjVoteAddPerson(mapEntity);
                }
                //更新父节点里的子节点状态的状态
                if(null != bean.get("TD_PRESERVE04") && bean.get("TD_PRESERVE04").toString().length() >0){
                    PRESERVE04Str = bean.get("TD_PRESERVE04").toString();
                    if(PRESERVE04Str.length() != (PRESERVE04Str.indexOf("-")+1)){
                        PRESERVE04Str = PRESERVE04Str.substring((PRESERVE04Str.indexOf("-")+1)) ;
                    } else{
                        PRESERVE04Str = "";
                    }
                }
                updaeMap.put("NUM_ID", D_NUM_ID);
                updaeMap.put("UPDATE_BY", UPDATE_BY);
                updaeMap.put("UPDATE_DATE", day);
                //更新子节点的字符拼接
                updaeMap.put("PRESERVE04", PRESERVE04Str);
                democracyRecommendService.updateDemocraticRecommend(updaeMap);
            }
        }
        catch (Exception e) {
            e.printStackTrace();
            result = StandardManage.OPERATE_FAIL;
        }
        map.put("result", result);
        return map;
    }
    /**
* 完成更新民主推荐父节点
*
* @param formbean
* @param request
* @param response
* @return
* @author KLX
* @throws IOException
*/
    @RequestMapping(value = "finisheddemocracyRecommendForm")
    public @ResponseBody Map<String, Object> finisheddemocracyRecommendForm(FormBean formbean, Model model,String voteFlag,String hytjid,
    String D_NUM_ID,String pid,HttpServletRequest request, HttpServletResponse response,
    RedirectAttributes redirectAttributes) throws IOException {
        String MOTION_COMPLETE_NEW = request
        .getParameter("MOTION_COMPLETE_NEW");
        String HANDLE_ID = request.getParameter("HANDLE_ID");
        String zgh ="";
        //根据id查出教职工号
        Map<String, Object> zghMap = Maps.newHashMap();
        zghMap.put("NUM_ID", HANDLE_ID);
        List<Map<String, Object>> zghList = democracyRecommendService.getRsPartyZghById(zghMap);
        if(zghList != null && zghList.size() >0){
            zgh = zghList.get(0).get("ZGH").toString();
        }
        String result = StandardManage.OPERATE_SUCCESS;
        Map<String, Object> map = Maps.newHashMap();
        Date day=new Date();
        //获取当前用户
        User user = UserUtils.getUser();
        String UPDATE_BY="";
        if(user != null && null != user.getLoginName()){
            UPDATE_BY=user.getLoginName();
        }
        Map<String, Object> bean = formbean.getBean();
        String PRESERVE01Str = "";
        String PRESERVE04Str = "";
        //如果是最后一个流程并且为归档,就更新主流程的状态为关闭3
        String STATUS = "";
        try {
            if(bean != null){
                //如果是最后一个流程并且为归档,就更新主流程的状态为关闭3
                if(null != bean.get("P_PRESERVE01") && bean.get("P_PRESERVE01").toString().length() >0){
                    PRESERVE01Str = bean.get("P_PRESERVE01").toString();
                    if(PRESERVE01Str.length() != (PRESERVE01Str.indexOf("-")+1)){
                        PRESERVE01Str = PRESERVE01Str.substring((PRESERVE01Str.indexOf("-")+1)) ;
                        if(null == PRESERVE01Str || ("").equals(PRESERVE01Str.trim())){
                            STATUS = "3";
                        } else{
                            //主流程都完成了,没有归档有试用期,此时更新主流程状态为关闭3
                            if(PRESERVE01Str.indexOf("7-") == 0 ){
                                STATUS = "3";
                            }
                        }
                    } else{
                        PRESERVE01Str ="";
                        STATUS = "3";
                    }
                }
                //更新父节点里的子节点状态的状态
                if(null != bean.get("FD_PRESERVE04") && bean.get("FD_PRESERVE04").toString().length() >0){
                    PRESERVE04Str = bean.get("FD_PRESERVE04").toString();
                    if(PRESERVE04Str.length() != (PRESERVE04Str.indexOf("-")+1)){
                        PRESERVE04Str = PRESERVE04Str.substring((PRESERVE04Str.indexOf("-")+1)) ;
                    } else{
                        PRESERVE04Str ="";
                    }
                }
                bean.put("NUM_ID", D_NUM_ID);
                bean.put("MOTION_COMPLETE", MOTION_COMPLETE_NEW);
                bean.put("HANDLE_ID", zgh);
                bean.put("UPDATE_BY", UPDATE_BY);
                bean.put("UPDATE_DATE", day);
                bean.put("DEMOCRATIC_STATUS", "1");
                //更新子节点的字符拼接
                bean.put("PRESERVE04", PRESERVE04Str);
                democracyRecommendService.updateDemocraticRecommend(FormBeanUtils.parse(bean));
                Map<String, Object> proMap = Maps.newHashMap();
                proMap.put("NUM_ID", pid);
                proMap.put("UPDATE_BY", UPDATE_BY);
                proMap.put("UPDATE_DATE", day);
                proMap.put("STATUS", STATUS);
                //更新父节点的字符拼接
                proMap.put("PRESERVE01", PRESERVE01Str);
                democracyRecommendService.updateSelectionProcess(proMap);
            }
        }
        catch (Exception e) {
            e.printStackTrace();
            result = StandardManage.OPERATE_FAIL;
        }
        map.put("result", result);
        return map;
    }
    //候选名单选择人员,不能出现已经选择的人
    @RequestMapping(value = "partyAllUserSelectList")
    public String partyAllUserSelectList(String excIds,String orgId,FormBean formbean, HttpServletRequest request, HttpServletResponse response, Model model) {
        FormBeanUtils.preDeal(formbean, request);
        formbean.getBean().put("TABLE",null);
        Page<Map<String, Object>> page = EmpUtilsService.partySelectList(new Page<Map<String, Object>>(request, response), formbean);
        FormBeanUtils.afterDeal(formbean, request);
        model.addAttribute("map", formbean);
        model.addAttribute("page", page);
        return "modules/common/empUtils/partyAllUserSelectList";
    }
    /**
* 民主推荐结果导出列表
*
* @param formBean
* @param request
* @param response
* @param redirectAttributes
* @throws IOException
* @author KLX
* @throws ParseException
*/
    @RequestMapping(value = "importExcelMztjjg")
    public String importExcelMztjjg(FormBean formBean,String PROCESS_ID, HttpServletRequest request, HttpServletResponse response,
    String PROCESS_TYPE,String D_NUM_ID, RedirectAttributes redirectAttributes) throws IOException, ParseException {
        Map<String, Object> idMap1 = Maps.newHashMap();
        idMap1.put("NUM_ID", D_NUM_ID);
        idMap1.put("oneRound", "oneRound");
        Map<String, Object> idMap2 = Maps.newHashMap();
        idMap2.put("NUM_ID", D_NUM_ID);
        idMap2.put("secondRound", "secondRound");
        List<Map<String, Object>> idList1 = democracyRecommendService.getMztjHytjId(idMap1);
        List<Map<String, Object>> idList2 = democracyRecommendService.getMztjHytjId(idMap2);
        String hytjId1 ="";
        String hytjId2 ="";
        if(idList1 != null && idList1.size()>0){
            hytjId1 = idList1.get(0).get("NUM_ID").toString();
        }
        if(idList2 != null && idList2.size()>0){
            hytjId2 = idList2.get(0).get("NUM_ID").toString();
        }
        Map<String, Object> zghMap = Maps.newHashMap();
        zghMap.put("PROCESS_ID", PROCESS_ID);
        //取得会议推荐1轮
        List<Map<String, Object>> hytjPersonList1 = null;
        //取得会议推荐2轮
        List<Map<String, Object>> hytjPersonList2 = null;
        //取得谈话推荐的集合数据
        Map<String, Object> thtjMap = Maps.newHashMap();
        List<Map<String, Object>> thtjVotelist = null;
        thtjMap.put("NUM_ID", PROCESS_ID);
        if(null != democracyRecommendService.getmztjVoteList(thtjMap) && democracyRecommendService.getmztjVoteList(thtjMap).size() >0){
            thtjVotelist = democracyRecommendService.getmztjVoteList(thtjMap);
        }
        //会议投票
        Map<String, Object> map = Maps.newHashMap();
        map.put("HYTJ_ID", hytjId1);
        map.put("voteFlag", "1");
        if(null != democracyRecommendService.gettCadreHytjVotelist(map) && democracyRecommendService.gettCadreHytjVotelist(map).size() >0){
            hytjPersonList1 = democracyRecommendService.gettCadreHytjVotelist(map);
        }
        //会议投票2
        Map<String, Object> map2 = Maps.newHashMap();
        map2.put("HYTJ_ID", hytjId2);
        map2.put("voteFlag", "2");
        if(null != democracyRecommendService.gettCadreHytjVotelist(map) && democracyRecommendService.gettCadreHytjVotelist(map).size() >0){
            if(StringUtils.isNotEmpty(hytjId2)){
                hytjPersonList2 = democracyRecommendService.gettCadreHytjVotelist(map2);
            }
        }
        Map<String, Object> processEnty = Maps.newHashMap();
        processEnty.put("NUM_ID", PROCESS_ID);
        processEnty = democracyRecommendService.getDemocracyRecommendProcessEnty(processEnty);
        String title = "";
        // 职务集合
        Map<String, Object> postMap = Maps.newHashMap();
        postMap.put("PROCESS_ID", PROCESS_ID);
        List<Map<String, Object>> electivePostList = democracyRecommendService
        .getelectivePostListByProcessId(postMap);
        OutputStream fos = response.getOutputStream();
        BufferedOutputStream bos = new BufferedOutputStream(fos);
        ZipOutputStream zos = new ZipOutputStream(bos);
        String excelPath = request.getSession().getServletContext().getRealPath("/WEB-INF/template/excel/MZTJTJJGOTHERExcel.xlsx");
        File file = new File(excelPath);
        int index = 0;
        if(electivePostList != null && electivePostList.size()>0){
            for (Map<String, Object> tempMap:electivePostList){
                //民主推荐结果
                Map<String, Object> mztjResultMap = Maps.newHashMap();
                mztjResultMap.put("THTJ_ID",processEnty.get("THTJ_NUM_ID"));
                mztjResultMap.put("HYTJ_ID1",hytjId1);
                mztjResultMap.put("HYTJ_ID2",hytjId2);
                mztjResultMap.put("POST_ID",tempMap.get("EP_NUM_ID"));
                List<Map<String, Object>> mztjResultList = null;
                if(null !=democracyRecommendService.getMZTJJGlist(mztjResultMap) && democracyRecommendService.getMZTJJGlist(mztjResultMap).size()>0){
                    mztjResultList = democracyRecommendService.getMZTJJGlist(mztjResultMap);
                    ++index;
                    Map<String, Object>objMap = Maps.newHashMap();
                    objMap.put("TNUM", thtjVotelist != null ? ("("+thtjVotelist.size()+"人)"):"");
                    objMap.put("MNUM1", hytjPersonList1 != null ? ("("+hytjPersonList1.size()+"人)"):"");
                    objMap.put("MNUM2", hytjPersonList2 != null ? ("("+hytjPersonList2.size()+"人)"):"");
                    InputStream input = new FileInputStream(file);
                    //定义文件的输出流,但是这是作为zip流的一部分
                    ByteArrayOutputStream output = new ByteArrayOutputStream();
                    //用jxlsHelper来处理xlxs输出了流
                    JxlsHelper jxlsHelper = JxlsHelper.getInstance();
                    //将map数据放到context中
                    Context context = new Context(objMap);
                    context.putVar("list", mztjResultList);
                    //流文件
                    jxlsHelper.processTemplate(input, output, context);
                    //命名文件
                    title = "("+DictUtils.getDictLabel(processEnty.get("PROCESS_TYPE").toString(), "LCLX", "")+")"+tempMap.get("EP_POST_NAME") +"岗位民主推荐情况汇总";
                    String filename = title;
                    zos.putNextEntry(new ZipEntry(title+index+".xlsx"));
                    response.setHeader("Content-disposition", "attachment;success=true;filename =" +new String(filename.getBytes("utf-8"),"iso-8859-1")+ ".zip");
                    //把xlsx输出流作为输入流输入到zip输出流中
                    zos.write(output.toByteArray());
                    zos.closeEntry();
                    output.close();
                }
            }
        }
        zos.flush();
        zos.close();
        return null;
    }
    /* */
    /**
* 民主推荐结果导出列表,班子换届
*
* @param formBean
* @param request
* @param response
* @param redirectAttributes
* @throws IOException
* @author KLX
* @throws ParseException importExcelMztjjgPoi
*/
    /*
@SuppressWarnings("deprecation")
@RequestMapping(value = "importExcelMztjjgPoi11")
public String importExcelMztjjgPoi(FormBean formBean,String PROCESS_ID, HttpServletRequest request, HttpServletResponse response,
String PROCESS_TYPE,String D_NUM_ID) throws IOException {
//创建HSSFWorkbook对象(excel的文档对象)
HSSFWorkbook wb = new HSSFWorkbook();
//建立新的sheet对象(excel的表单)
HSSFSheet sheet=wb.createSheet("成绩表");
//在sheet里创建第一行,参数为行索引(excel的行),可以是0~65535之间的任何一个
HSSFRow row1=sheet.createRow(0);
//创建单元格(excel的单元格,参数为列索引,可以是0~255之间的任何一个
HSSFCellStyle cellStyle = wb.createCellStyle();
//设置居中:
cellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER); // 居中
HSSFCell cell=row1.createCell(0);
cell.setCellStyle(cellStyle);
// 职务集合
Map<String, Object> postMap = Maps.newHashMap();
postMap.put("PROCESS_ID", PROCESS_ID);
//会议推荐和谈话推荐合并单元格的数量
int titleMergeCell = 0;
List<Map<String, Object>> electivePostList = democracyRecommendService
.getelectivePostListByProcessId(postMap);
if(null != electivePostList && electivePostList.size() >0){
titleMergeCell = electivePostList.size();
//设置单元格内容
cell.setCellValue("民主推荐结果");
//合并单元格CellRangeAddress构造参数依次表示起始行,截至行,起始列, 截至列
sheet.addMergedRegion(new CellRangeAddress(0,0,0,titleMergeCell+titleMergeCell+titleMergeCell));
//在sheet里创建第二行
HSSFRow row2=sheet.createRow(1);
HSSFCell cell1=row2.createCell(0);
HSSFCell cell2= row2.createCell(1);
HSSFCell cell3=row2.createCell((1+titleMergeCell));
HSSFCell cell4=row2.createCell((1+titleMergeCell+titleMergeCell));
cell1.setCellStyle(cellStyle);
cell2.setCellStyle(cellStyle);
cell3.setCellStyle(cellStyle);
cell4.setCellStyle(cellStyle);
//创建单元格并设置单元格内容
row2.createCell(0).setCellValue("姓名");
row2.createCell(1).setCellValue("会议推荐(1人)");
row2.createCell((1+titleMergeCell)).setCellValue("谈话推荐(2人)");
row2.createCell((1+titleMergeCell+titleMergeCell)).setCellValue("合计票(3人)");
//上或者下从0开始会议推荐
sheet.addMergedRegion(new Region(1, (short) 1, 1, (short) (titleMergeCell)));
//上或者下从0开始谈话推荐
sheet.addMergedRegion(new Region(1, (short) (1+titleMergeCell), 1, (short) (titleMergeCell+titleMergeCell)));
//上或者下从0开始合计票
sheet.addMergedRegion(new Region(1, (short) (1+titleMergeCell+titleMergeCell), 1, (short) (titleMergeCell+titleMergeCell+titleMergeCell)));
//在sheet里创建第三行
HSSFRow row3=sheet.createRow(2);
row3.createCell(0).setCellValue("李明");
row3.createCell(1).setCellValue("As178");
row3.createCell(2).setCellValue(87);
row3.createCell(3).setCellValue(78);
row3.createCell(4).setCellValue(78);
//.....省略部分代码
}
//输出Excel文件
OutputStream output=response.getOutputStream();
response.reset();
response.setHeader("Content-disposition", "attachment; filename=details.xls");
response.setContentType("application/msexcel");
wb.write(output);
output.close();
return null;
}*/
    /**
* 民主推荐结果导出列表,班子换届
*
* @param formBean
* @param request
* @param response
* @param redirectAttributes
* @throws IOException
* @author KLX
* @throws ParseException importExcelMztjjgPoi
*/
    @SuppressWarnings("deprecation")
    @RequestMapping(value = "importExcelMztjjgPoi")
    public String importExcelMztjjgPoi1(FormBean formBean,String PROCESS_ID, HttpServletRequest request, HttpServletResponse response,
    String PROCESS_TYPE,String D_NUM_ID) throws IOException {
        OutputStream fos = response.getOutputStream();
        BufferedOutputStream bos = new BufferedOutputStream(fos);
        ZipOutputStream zos = new ZipOutputStream(bos);
        //创建HSSFWorkbook对象(excel的文档对象)
        HSSFWorkbook wb = new HSSFWorkbook();
        //建立新的sheet对象(excel的表单)
        HSSFSheet sheet=wb.createSheet("成绩表");
        //在sheet里创建第一行,参数为行索引(excel的行),可以是0~65535之间的任何一个
        HSSFRow row1=sheet.createRow(0);
        //创建单元格(excel的单元格,参数为列索引,可以是0~255之间的任何一个
        HSSFCellStyle cellStyle = wb.createCellStyle();
        //设置居中:
        cellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
        // 居中
        HSSFCell cell=row1.createCell(0);
        cell.setCellStyle(cellStyle);
        // 职务集合
        Map<String, Object> postMap = Maps.newHashMap();
        postMap.put("PROCESS_ID", PROCESS_ID);
        //会议推荐和谈话推荐合并单元格的数量
        int titleMergeCell = 0;
        List<Map<String, Object>> electivePostList = democracyRecommendService
        .getelectivePostListByProcessId(postMap);
        if(null != electivePostList && electivePostList.size() >0){
            titleMergeCell = electivePostList.size();
            //设置单元格内容
            cell.setCellValue("民主推荐结果");
            //合并单元格CellRangeAddress构造参数依次表示起始行,截至行,起始列, 截至列
            sheet.addMergedRegion(new CellRangeAddress(0,0,0,titleMergeCell+titleMergeCell+titleMergeCell));
            //在sheet里创建第二行
            HSSFRow row2=sheet.createRow(1);
            HSSFCell cell1=row2.createCell(0);
            HSSFCell cell2= row2.createCell(1);
            HSSFCell cell3=row2.createCell((1+titleMergeCell));
            HSSFCell cell4=row2.createCell((1+titleMergeCell+titleMergeCell));
            cell1.setCellStyle(cellStyle);
            cell2.setCellStyle(cellStyle);
            cell3.setCellStyle(cellStyle);
            cell4.setCellStyle(cellStyle);
            //创建单元格并设置单元格内容
            row2.createCell(0).setCellValue("姓名");
            row2.createCell(1).setCellValue("会议推荐(1人)");
            row2.createCell((1+titleMergeCell)).setCellValue("谈话推荐(2人)");
            row2.createCell((1+titleMergeCell+titleMergeCell)).setCellValue("合计票(3人)");
            //上或者下从0开始会议推荐
            sheet.addMergedRegion(new Region(1, (short) 1, 1, (short) (titleMergeCell)));
            //上或者下从0开始谈话推荐
            sheet.addMergedRegion(new Region(1, (short) (1+titleMergeCell), 1, (short) (titleMergeCell+titleMergeCell)));
            //上或者下从0开始合计票
            sheet.addMergedRegion(new Region(1, (short) (1+titleMergeCell+titleMergeCell), 1, (short) (titleMergeCell+titleMergeCell+titleMergeCell)));
            /*//在sheet里创建第三行
HSSFRow row3=sheet.createRow(2);
row3.createCell(0).setCellValue("李明");
row3.createCell(1).setCellValue("As178");
row3.createCell(2).setCellValue(87);
row3.createCell(3).setCellValue(78);
row3.createCell(4).setCellValue(78);*/
            //.....省略部分代码
        }
        //创建HSSFWorkbook对象(excel的文档对象)
        HSSFWorkbook wb1 = new HSSFWorkbook();
        //建立新的sheet对象(excel的表单)
        HSSFSheet shee1t=wb1.createSheet("成绩表");
        //在sheet里创建第一行,参数为行索引(excel的行),可以是0~65535之间的任何一个
        HSSFRow r1=sheet.createRow(0);
        //创建单元格(excel的单元格,参数为列索引,可以是0~255之间的任何一个
        HSSFCellStyle cellStyle1 = wb.createCellStyle();
        //设置居中:
        cellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
        // 居中
        HSSFCell cell1=r1.createCell(0);
        cell1.setCellStyle(cellStyle);
        // 职务集合
        Map<String, Object> postMap1 = Maps.newHashMap();
        postMap1.put("PROCESS_ID", PROCESS_ID);
        //会议推荐和谈话推荐合并单元格的数量
        int titleMergeCell1 = 0;
        List<Map<String, Object>> electivePostList1 = democracyRecommendService
        .getelectivePostListByProcessId(postMap1);
        if(null != electivePostList1 && electivePostList1.size() >0){
            titleMergeCell1 = electivePostList1.size();
            //设置单元格内容
            cell1.setCellValue("民主推荐结果");
            //合并单元格CellRangeAddress构造参数依次表示起始行,截至行,起始列, 截至列
            sheet.addMergedRegion(new CellRangeAddress(0,0,0,titleMergeCell+titleMergeCell+titleMergeCell));
            //在sheet里创建第二行
            HSSFRow r2=sheet.createRow(1);
            //创建单元格并设置单元格内容
            r2.createCell(0).setCellValue("姓名1");
            r2.createCell(1).setCellValue("会议推荐(11人)");
            r2.createCell((1+titleMergeCell)).setCellValue("谈话推荐(21人)");
            r2.createCell((1+titleMergeCell+titleMergeCell)).setCellValue("合计票(31人)");
            //上或者下从0开始会议推荐
            sheet.addMergedRegion(new Region(1, (short) 1, 1, (short) (titleMergeCell)));
            //上或者下从0开始谈话推荐
            sheet.addMergedRegion(new Region(1, (short) (1+titleMergeCell), 1, (short) (titleMergeCell+titleMergeCell)));
            //上或者下从0开始合计票
            sheet.addMergedRegion(new Region(1, (short) (1+titleMergeCell+titleMergeCell), 1, (short) (titleMergeCell+titleMergeCell+titleMergeCell)));
            /*//在sheet里创建第三行
HSSFRow row3=sheet.createRow(2);
row3.createCell(0).setCellValue("李明");
row3.createCell(1).setCellValue("As178");
row3.createCell(2).setCellValue(87);
row3.createCell(3).setCellValue(78);
row3.createCell(4).setCellValue(78);*/
            //.....省略部分代码
        }
        //定义文件的输出流,但是这是作为zip流的一部分
        ByteArrayOutputStream output = new ByteArrayOutputStream();
        wb.write(output);
        wb1.write(output);
        //流文件
        String filename = "konlgin";
        //命名文件
        zos.putNextEntry(new ZipEntry("f.xls"));
        zos.putNextEntry(new ZipEntry("f1.xls"));
        response.setHeader("Content-disposition", "attachment;success=true;filename =" +new String(filename.getBytes("utf-8"),"iso-8859-1")+ ".zip");
        // response.setContentType("application/msexcel");
        //把xlsx输出流作为输入流输入到zip输出流中
        zos.write(output.toByteArray());
        zos.closeEntry();
        output.close();
        zos.flush();
        zos.close();
        return null;
        /*
//输出Excel文件
OutputStream output=response.getOutputStream();
response.reset();
response.setHeader("Content-disposition", "attachment; filename=details.xls");
response.setContentType("application/msexcel");
wb.write(output);
output.close();*/
    }
}

 

posted @ 2018-11-24 13:13  程序员小明1024  阅读(623)  评论(0编辑  收藏  举报