package cn.com.goldenwater.dcproj.controller.index; import cn.com.goldenwater.core.web.BaseController; import cn.com.goldenwater.core.web.BaseResponse; import cn.com.goldenwater.dcproj.constValue.BisInspEnum; import cn.com.goldenwater.dcproj.dao.BisInspPblmDao; import cn.com.goldenwater.dcproj.model.*; import cn.com.goldenwater.dcproj.param.*; import cn.com.goldenwater.dcproj.service.*; import cn.com.goldenwater.dcproj.target.Authority; import cn.com.goldenwater.dcproj.utils.*; import cn.com.goldenwater.id.util.UuidUtil; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.util.*; @Api(value = "APP 小水库,人饮工程,水毁工程doc导出", tags = "APP 小水库,人饮工程,水毁工程doc导出") @Controller @RequestMapping("/") public class IndexController extends BaseController { private Logger logger = LoggerFactory.getLogger(getClass()); @Value("${export.basePath.docx}") private String docxPath; @Value("${web.upload-path}") private String uploadPath; @Value("${getFile.prefix}") private String filePreFix; @Value("${export.basePath.docx.path}") private String baseDocxPath; @Autowired private BisInspPblmDao bisInspPblmDao; @Autowired private OlBisInspOrgService olBisInspOrgService; @RequestMapping(value = "index",method = RequestMethod.GET) public String index() { return "/index"; } @ApiOperation(value = "人饮导出问题列表-html展示") @RequestMapping(value = "page/vill/doc", method = RequestMethod.POST) public String villDoc(@ApiParam(name = "villParam", value = "villParam", required = true) @RequestBody VillParam villParam , Model model) { String orgIds = InspUtils.setOrgIds(villParam.getOrgIds()); villParam.setOrgIds(orgIds); villParam.setCodes(InspUtils.setOrgIds(villParam.getCodes())); villParam.setOrgId(getCurrentOrgId()); villParam.setProvince(olBisInspOrgService.getProvince(getCurrentOrgId())); List pblmList = InspPblmUtils.setPblmList(bisInspPblmDao.findVillPlbmList(villParam)); DocType docType = new DocType(); docType.setpType(BisInspEnum.VILL.getValue()); docType.setHasVedio(villParam.getHasVedio()); docType.setIfCasePblm(villParam.getIfCasePblm()); docType.setEndTime(villParam.getEndTime()); docType.setPblmIds(InspPblmUtils.getPblms(pblmList)); docType.setProvince(olBisInspOrgService.getProvince(getCurrentOrgId())); docType.setOrgId(getCurrentOrgId()); docType.setPersId(villParam.getPersId()); docType.setStartTime(villParam.getStartTime()); docType.setFindTime(villParam.getFindTime()); List pblmDocList = bisInspPblmDao.findPblmBindFiles(docType); List>>>> valMap = getValMap2(pblmList, pblmDocList, BisInspEnum.VILL.getValue()); model.addAttribute("datas", valMap); model.addAttribute("objName", BisInspEnum.VILL.getDesc()); return "/pblmDoc"; } @ApiOperation(value = "水毁导出问题列表-html展示") @RequestMapping(value = "page/track/doc", method = RequestMethod.POST) public String trackDoc(@ApiParam(name = "trackParam", value = "trackParam", required = true) @RequestBody TrackParam trackParam , Model model) { String orgIds = InspUtils.setOrgIds(trackParam.getOrgIds()); trackParam.setOrgIds(orgIds); trackParam.setCodes(InspUtils.setOrgIds(trackParam.getCodes())); trackParam.setOrgId(getCurrentOrgId()); trackParam.setProvince(olBisInspOrgService.getProvince(getCurrentOrgId())); List pblmList = InspPblmUtils.setPblmList(bisInspPblmDao.findTrackPlbmList(trackParam)); DocType docType = new DocType(); docType.setpType(BisInspEnum.TRACK.getValue()); docType.setHasVedio(trackParam.getHasVedio()); docType.setIfCasePblm(trackParam.getIfCasePblm()); docType.setEndTime(trackParam.getEndTime()); docType.setPblmIds(InspPblmUtils.getPblms(pblmList)); docType.setPersId(trackParam.getPersId()); docType.setProvince(olBisInspOrgService.getProvince(getCurrentOrgId())); docType.setOrgId(getCurrentOrgId()); docType.setStartTime(trackParam.getStartTime()); docType.setFindTime(trackParam.getFindTime()); List pblmDocList = bisInspPblmDao.findPblmBindFiles(docType); List>>>> valMap = getValMap2(pblmList, pblmDocList, BisInspEnum.TRACK.getValue()); model.addAttribute("datas", valMap); model.addAttribute("objName", BisInspEnum.TRACK.getDesc()); return "/pblmDoc"; } @ApiOperation(value = "淤地坝导出问题列表-html展示") @RequestMapping(value = "page/sd/doc", method = RequestMethod.POST) public String sdDoc(@ApiParam(name = "param", value = "param", required = true) @RequestBody SdPblmParam param , Model model) { String orgIds = InspUtils.setOrgIds(param.getOrgIds()); param.setOrgIds(orgIds); param.setOrgId(getCurrentOrgId()); param.setProvince(olBisInspOrgService.getProvince(getCurrentOrgId())); param.setCodes(InspUtils.setOrgIds(param.getCodes())); List pblmList = InspPblmUtils.setPblmList(bisInspPblmDao.findSdPblmList(param)); DocType docType = new DocType(); docType.setpType(BisInspEnum.SD.getValue()); docType.setPblmIds(InspPblmUtils.getPblms(pblmList)); docType.setHasVedio(param.getHasVedio()); docType.setIfCasePblm(param.getIfCasePblm()); docType.setEndTime(param.getEndTime()); docType.setPersId(param.getPersId()); docType.setProvince(olBisInspOrgService.getProvince(getCurrentOrgId())); docType.setOrgId(getCurrentOrgId()); docType.setStartTime(param.getStartTime()); docType.setFindTime(param.getFindTime()); List pblmDocList = bisInspPblmDao.findPblmBindFiles(docType); List>>>> valMap = getValMap2(pblmList, pblmDocList, BisInspEnum.SD.getValue()); model.addAttribute("datas", valMap); model.addAttribute("objName", BisInspEnum.SD.getDesc()); return "/pblmDoc"; } @Authority @ApiOperation(value = "淤地坝导出问题列表-html展示") @RequestMapping(value = "page/pblm/doc", method = RequestMethod.POST) public String pblmDoc(@ApiParam(name = "param", value = "param", required = true) @RequestBody PblmParam param , Model model) { String orgIds = InspUtils.setOrgIds(param.getOrgIds()); param.setOrgIds(orgIds); param.setOrgId(getCurrentOrgId()); param.setProvince(olBisInspOrgService.getProvince(getCurrentOrgId())); param.setCodes(InspUtils.setOrgIds(param.getCodes())); List pblmList = InspPblmUtils.setPblmList(bisInspPblmDao.findPblmList(param)); DocType docType = new DocType(); docType.setpType(param.getpType()); docType.setHasVedio(param.getHasVedio()); docType.setIfCasePblm(param.getIfCasePblm()); docType.setEndTime(param.getEndTime()); docType.setPersId(param.getPersId()); docType.setPblmIds(InspPblmUtils.getPblms(pblmList)); docType.setStartTime(param.getStartTime()); docType.setProvince(olBisInspOrgService.getProvince(getCurrentOrgId())); docType.setOrgId(getCurrentOrgId()); docType.setFindTime(param.getFindTime()); List pblmDocList = bisInspPblmDao.findPblmBindFiles(docType); List>>>> valMap = getValMap2(pblmList, pblmDocList, param.getpType()); model.addAttribute("datas", valMap); BisInspEnum bisInspEnum = EnumUtil.getBisInspEnum(param.getpType()); if (bisInspEnum == null) { model.addAttribute("objName", "问题导出"); } else { model.addAttribute("objName", bisInspEnum.getDesc()); } return "/pblmDoc"; } @ApiOperation(value = "地下水导出问题列表-html展示") @RequestMapping(value = "page/grw/doc", method = RequestMethod.POST) public String grwDoc(@ApiParam(name = "waterParam", value = "waterParam", required = true) @RequestBody UnderWaterParam waterParam , Model model) { String orgIds = InspUtils.setOrgIds(waterParam.getOrgIds()); waterParam.setOrgIds(orgIds); waterParam.setProvince(olBisInspOrgService.getProvince(getCurrentOrgId())); waterParam.setOrgId(getCurrentOrgId()); waterParam.setCodes(InspUtils.setOrgIds(waterParam.getCodes())); List pblmList = InspPblmUtils.setPblmList(bisInspPblmDao.findWaterPlbmList(waterParam)); DocType docType = new DocType(); docType.setpType(BisInspEnum.GRW.getValue()); docType.setHasVedio(waterParam.getHasVedio()); docType.setIfCasePblm(waterParam.getIfCasePblm()); docType.setPblmIds(InspPblmUtils.getPblms(pblmList)); docType.setEndTime(waterParam.getEndTime()); docType.setStartTime(waterParam.getStartTime()); docType.setProvince(olBisInspOrgService.getProvince(getCurrentOrgId())); docType.setOrgId(getCurrentOrgId()); docType.setPersId(waterParam.getPersId()); docType.setFindTime(waterParam.getFindTime()); List pblmDocList = bisInspPblmDao.findPblmBindFiles(docType); List>>>> valMap = getValMap2(pblmList, pblmDocList, BisInspEnum.GRW.getValue()); model.addAttribute("datas", valMap); model.addAttribute("objName", BisInspEnum.GRW.getDesc()); return "/pblmDoc"; } @ApiOperation(value = "水闸导出问题列表-html展示") @RequestMapping(value = "page/waga/doc", method = RequestMethod.POST) public String wagaDoc(@ApiParam(name = "wagaParam", value = "wagaParam", required = true) @RequestBody WagaParam wagaParam , Model model) { String orgIds = InspUtils.setOrgIds(wagaParam.getOrgIds()); wagaParam.setOrgIds(orgIds); wagaParam.setProvince(olBisInspOrgService.getProvince(getCurrentOrgId())); wagaParam.setOrgId(getCurrentOrgId()); wagaParam.setPersId(getCurrentPersId()); wagaParam.setCodes(InspUtils.setOrgIds(wagaParam.getCodes())); List pblmList = InspPblmUtils.setPblmList(bisInspPblmDao.findWagaPlbmList(wagaParam)); logger.info("水闸导出数据条数--》" + pblmList.size()); DocType docType = new DocType(); docType.setpType(BisInspEnum.WAGA.getValue()); docType.setHasVedio(wagaParam.getHasVedio()); docType.setProvince(olBisInspOrgService.getProvince(getCurrentOrgId())); docType.setOrgId(getCurrentOrgId()); docType.setPblmIds(InspPblmUtils.getPblms(pblmList)); docType.setIfCasePblm(wagaParam.getIfCasePblm()); docType.setEndTime(wagaParam.getEndTime()); docType.setStartTime(wagaParam.getStartTime()); docType.setPersId(wagaParam.getPersId()); docType.setFindTime(wagaParam.getFindTime()); List pblmDocList = bisInspPblmDao.findPblmBindFiles(docType); List>>>> valMap = getValMap2(pblmList, pblmDocList, BisInspEnum.WAGA.getValue()); model.addAttribute("datas", valMap); model.addAttribute("objName", BisInspEnum.WAGA.getDesc()); return "/pblmDoc"; } @ApiOperation(value = "重点工程导出问题列表-html展示") @RequestMapping(value = "page/keyReg/doc", method = RequestMethod.POST) public String keyRegDoc(@ApiParam(name = "keyRegPatam", value = "keyRegPatam", required = true) @RequestBody KeyRegPatam keyRegPatam , Model model) { String orgIds = InspUtils.setOrgIds(keyRegPatam.getOrgIds()); keyRegPatam.setOrgIds(orgIds); keyRegPatam.setProvince(olBisInspOrgService.getProvince(getCurrentOrgId())); keyRegPatam.setCodes(InspUtils.setOrgIds(keyRegPatam.getCodes())); keyRegPatam.setOrgId(getCurrentOrgId()); List keypblmList = InspPblmUtils.setKeyPblmList(bisInspPblmDao.findKeyRegPlbmList(keyRegPatam)); DocType docType = new DocType(); docType.setpType(BisInspEnum.EMPWT.getValue()); docType.setHasVedio(keyRegPatam.getHasVedio()); docType.setIfCasePblm(keyRegPatam.getIfCasePblm()); docType.setEndTime(keyRegPatam.getEndTime()); docType.setPblmIds(InspPblmUtils.getKeyPblms(keypblmList)); docType.setProvince(olBisInspOrgService.getProvince(getCurrentOrgId())); docType.setOrgId(getCurrentOrgId()); docType.setStartTime(keyRegPatam.getStartTime()); docType.setPersId(keyRegPatam.getPersId()); docType.setFindTime(keyRegPatam.getFindTime()); List pblmDocList = bisInspPblmDao.findPblmBindFiles(docType); List pblmList = new ArrayList<>(); for (BisInspPblm inspPblm : keypblmList) { pblmList.add(inspPblm); } List>>>> valMap = getValMap2(pblmList, pblmDocList, BisInspEnum.EMPWT.getValue()); model.addAttribute("datas", valMap); model.addAttribute("objName", BisInspEnum.EMPWT.getDesc()); return "/pblmDoc"; } // @ApiOperation(value = "小水库导出问题列表-html展示") @RequestMapping(value = "page/rever/doc", method = RequestMethod.POST) public String reverDoc(@ApiParam(name = "persId", value = "persId", required = true) @RequestBody ReverParam reverParam , Model model) { reverParam.setPersId(reverParam.getPersId()); String orgIds = InspUtils.setOrgIds(reverParam.getOrgIds()); reverParam.setOrgIds(orgIds); reverParam.setOrgId(getCurrentOrgId()); reverParam.setProvince(olBisInspOrgService.getProvince(getCurrentOrgId())); reverParam.setCodes(InspUtils.setOrgIds(reverParam.getCodes())); List pblmList = InspPblmUtils.setPblmList(bisInspPblmDao.findReverPlbmList(reverParam)); DocType docType = new DocType(); docType.setpType(BisInspEnum.REVER.getValue()); docType.setHasVedio(reverParam.getHasVedio()); docType.setIfCasePblm(reverParam.getIfCasePblm()); docType.setOrgId(getCurrentOrgId()); docType.setEndTime(reverParam.getEndTime()); docType.setPblmIds(InspPblmUtils.getPblms(pblmList)); docType.setStartTime(reverParam.getStartTime()); docType.setPersId(reverParam.getPersId()); docType.setProvince(olBisInspOrgService.getProvince(getCurrentOrgId())); docType.setFindTime(reverParam.getFindTime()); List pblmDocList = bisInspPblmDao.findPblmBindFiles(docType); List>>>> valMap = getValMap2(pblmList, pblmDocList, BisInspEnum.REVER.getValue()); model.addAttribute("datas", valMap); model.addAttribute("objName", BisInspEnum.REVER.getDesc()); return "/pblmDoc"; } private List>>>> getValMap2(List pblmList, List pblmDocList, String pType) { List pblmDocs = new ArrayList<>(); List reverList = new ArrayList<>(); List checkList = new ArrayList<>(); List reverCheckList = new ArrayList<>(); //数据整理 for (BisInspPblm bisInspPblm : pblmList) { PblmDoc doc = new PblmDoc(); if (StringUtils.isBlank(bisInspPblm.getInspPblmName())) { continue; } if (BisInspEnum.REVER.getValue().equals(pType) && !reverList.contains(bisInspPblm.getInspPblmsName()) && StringUtils.isNotBlank(bisInspPblm.getInspPblmsName())) { reverList.add(bisInspPblm.getInspPblmsName()); } if (BisInspEnum.WAGA.getValue().equals(pType) && !reverList.contains(bisInspPblm.getInspPblmsName())) { reverList.add(bisInspPblm.getInspPblmsName()); } else if (!BisInspEnum.REVER.getValue().equals(pType) && !reverList.contains(bisInspPblm.getInspPblmName())) { reverList.add(bisInspPblm.getInspPblmName()); } if (!checkList.contains(bisInspPblm.getNm())) { checkList.add(bisInspPblm.getNm()); } if (StringUtils.isNotBlank(bisInspPblm.getCheckPoint())) { if (!BisInspEnum.GRW.getValue().equals(pType)) { if (!reverCheckList.contains(bisInspPblm.getInspPblmsName() + ":" + bisInspPblm.getCheckPoint())) { reverCheckList.add(bisInspPblm.getInspPblmsName() + ":" + bisInspPblm.getCheckPoint()); } } else { if (!reverCheckList.contains(bisInspPblm.getInspPblmName() + ":" + bisInspPblm.getCheckPoint())) { reverCheckList.add(bisInspPblm.getInspPblmName() + ":" + bisInspPblm.getCheckPoint()); } } } else if (!BisInspEnum.REVER.getValue().equals(pType)) { if (BisInspEnum.VILL.getValue().equals(pType)) { bisInspPblm.setCheckPoint(bisInspPblm.getInspPblmsName()); bisInspPblm.setInspPblmsName(bisInspPblm.getInspPblmName()); if (StringUtils.isNotBlank(bisInspPblm.getCheckPoint())) { if (!reverCheckList.contains(bisInspPblm.getInspPblmsName() + ":" + bisInspPblm.getCheckPoint())) { reverCheckList.add(bisInspPblm.getInspPblmsName() + ":" + bisInspPblm.getCheckPoint()); } } } else { if (!reverCheckList.contains(bisInspPblm.getInspPblmName() + ":" + bisInspPblm.getNm())) { reverCheckList.add(bisInspPblm.getInspPblmName() + ":" + bisInspPblm.getNm()); } } } doc.setCheckPoint(bisInspPblm.getCheckPoint()); doc.setPblmId(bisInspPblm.getPblmId()); doc.setRsName(bisInspPblm.getNm()); doc.setAdFullName(bisInspPblm.getAdFullName()); doc.setInspPblmDesc(bisInspPblm.getInspPblmDesc()); doc.setOrgNm(bisInspPblm.getOrgNm()); String adFullname = ""; if (StringUtils.isNotBlank(bisInspPblm.getAdFullName())) { adFullname = bisInspPblm.getAdFullName(); } String desc = ""; if (StringUtils.isNotBlank(bisInspPblm.getInspPblmDesc())) { desc = bisInspPblm.getInspPblmDesc(); } if (adFullname.contains(doc.getRsName())) { if ("".equals(adFullname)) { doc.setNote(desc); } else { doc.setNote(adFullname + "," + desc); } } else { doc.setNote(adFullname + "," + doc.getRsName() + "," + desc); } if (doc.getNote().startsWith(",")) { String note = doc.getNote().substring(1, doc.getNote().length()); doc.setNote(note); } if (BisInspEnum.REVER.getValue().equals(pType) || BisInspEnum.VILL.getValue().equals(pType) || BisInspEnum.WAGA.getValue().equals(pType)) { doc.setInspPblmName(bisInspPblm.getInspPblmsName()); } else { doc.setInspPblmName(bisInspPblm.getInspPblmName()); } doc.setPersName(bisInspPblm.getPersName()); for (PblmDoc pblmDoc : pblmDocList) { if (bisInspPblm.getPblmId().equals(pblmDoc.getPblmId())) { doc.setFileExtes(pblmDoc.getFileExtes()); doc.setFilePathes(pblmDoc.getFilePathes()); if (StringUtils.isNotBlank(pblmDoc.getFilePathes())) { doc.setFileArrays(pblmDoc.getFilePathes().split(",")); } else { doc.setFileArrays(new String[]{}); } } } pblmDocs.add(doc); } //将数据包装为key.value List>>>> valMap = new ArrayList<>(); int count = 1; int num = 1; for (String dd : reverList) { Map>>> bmap = new HashMap<>(); List>> secMap = new ArrayList<>(); num = 1; for (String rever : reverCheckList) { if (rever.contains(dd)) { Map> map = new HashMap<>(); List pblmDocs1 = new ArrayList<>(); int vv = 1; String repearDesc = ""; for (PblmDoc pblmDoc : pblmDocs) { boolean repeat = false; if (StringUtils.isNotBlank(pblmDoc.getCheckPoint()) && (BisInspEnum.GRW.getValue().equals(pType) || BisInspEnum.REVER.getValue().equals(pType) || BisInspEnum.VILL.getValue().equals(pType) || BisInspEnum.WAGA.getValue().equals(pType)) || BisInspEnum.SD.getValue().equals(pType) || BisInspEnum.WIU.getValue().equals(pType) || BisInspEnum.SWHS.getValue().equals(pType)) { if (rever.contains(pblmDoc.getInspPblmName() + ":" + pblmDoc.getCheckPoint())) { if (!pblmDoc.getNote().contains("(" + vv + ")")) { if (repearDesc.equals(pblmDoc.getNote())) { pblmDoc.setNote(""); } else { repearDesc = pblmDoc.getNote(); pblmDoc.setNote("(" + vv + ")" + pblmDoc.getNote()); repeat = true; } } if (!pblmDocs1.contains(pblmDoc)) { pblmDoc.setNote(changeNote(vv, pblmDoc.getNote())); pblmDocs1.add(pblmDoc); if (repeat) { vv++; } } } } else if (rever.contains(pblmDoc.getInspPblmName() + ":" + pblmDoc.getRsName())) { if (!pblmDoc.getNote().contains("(" + vv + ")")) { if (repearDesc.equals(pblmDoc.getNote())) { pblmDoc.setNote(""); } else { repearDesc = pblmDoc.getNote(); pblmDoc.setNote("(" + vv + ")" + pblmDoc.getNote()); repeat = true; } } if (!pblmDocs1.contains(pblmDoc)) { pblmDoc.setNote(changeNote(vv, pblmDoc.getNote())); pblmDocs1.add(pblmDoc); if (repeat) { vv++; } } } } if (rever.contains(":")) { String[] revers = rever.split(":"); map.put(num + "、" + revers[1], pblmDocs1); } else { map.put(num + "、" + rever, pblmDocs1); } num++; secMap.add(map); } } bmap.put("(" + InspPblmUtils.toChinese(count + "") + ")" + dd, secMap); count++; valMap.add(bmap); } return valMap; } private String changeNote(int vv, String note) { int prev = vv - 1; if (note.startsWith("(" + prev + ")")) { note = note.replaceFirst("(" + prev + ")", ""); } return note; } @Value("${server.port}") private String serverPort; // @ApiOperation(value = "小水库导出问题列表-导出doc") @RequestMapping(value = "/rever/doc", method = RequestMethod.POST) @ResponseBody public BaseResponse> reverDoc(HttpServletRequest request, HttpServletResponse response, @RequestBody ReverParam reverParam) { String title = UuidUtil.uuid() + "_rever"; String url = request.getScheme() + "://127.0.0.1:" + serverPort + request.getContextPath(); url = url + "/page/rever/doc"; String path = exportWord(title, url, reverParam,request); Map params = new HashMap<>(); params.put("downloadPath", path); return buildSuccessResponse(params); } @ApiOperation(value = "水闸导出问题列表-导出doc") @RequestMapping(value = "/keyReg/doc", method = RequestMethod.POST) @ResponseBody public BaseResponse> keyRegDoc(HttpServletRequest request, HttpServletResponse response, @RequestBody KeyRegPatam keyRegPatam) { String title = UuidUtil.uuid() + "_keyReg"; String url = request.getScheme() + "://127.0.0.1:" + serverPort + request.getContextPath(); url = url + "/page/keyReg/doc"; String path = exportWord(title, url, keyRegPatam,request); Map params = new HashMap<>(); params.put("downloadPath", path); return buildSuccessResponse(params); } @ApiOperation(value = "水毁导出问题列表-导出doc") @RequestMapping(value = "/track/doc", method = RequestMethod.POST) @ResponseBody public BaseResponse> trackDoc(HttpServletRequest request, HttpServletResponse response, @RequestBody TrackParam trackParam) { String title = UuidUtil.uuid() + "_track"; String url = request.getScheme() + "://127.0.0.1:" + serverPort + request.getContextPath(); url = url + "/page/track/doc"; String path = exportWord(title, url, trackParam,request); Map params = new HashMap<>(); params.put("downloadPath", path); return buildSuccessResponse(params); } @ApiOperation(value = "水闸导出问题列表-导出doc") @RequestMapping(value = "/waga/doc", method = RequestMethod.POST) @ResponseBody public BaseResponse> wagaDoc(HttpServletRequest request, HttpServletResponse response, @RequestBody WagaParam wagaParam) { String title = UuidUtil.uuid() + "_waga"; String url = request.getScheme() + "://127.0.0.1:" + serverPort + request.getContextPath(); url = url + "/page/waga/doc"; logger.info("水闸地址--》" + url); String path = exportWord(title, url, wagaParam,request); Map params = new HashMap<>(); params.put("downloadPath", path); return buildSuccessResponse(params); } @ApiOperation(value = "地下水导出问题列表-导出doc") @RequestMapping(value = "/grw/doc", method = RequestMethod.POST) @ResponseBody public BaseResponse> grwDoc(HttpServletRequest request, HttpServletResponse response, @RequestBody UnderWaterParam waterParam) { String title = UuidUtil.uuid() + "_grw"; String url = request.getScheme() + "://127.0.0.1:" + serverPort + request.getContextPath(); url = url + "/page/grw/doc"; String path = exportWord(title, url, waterParam,request); Map params = new HashMap<>(); params.put("downloadPath", path); return buildSuccessResponse(params); } @ApiOperation(value = "人饮导出问题列表-导出doc") @RequestMapping(value = "/vill/doc", method = RequestMethod.POST) @ResponseBody public BaseResponse> villDoc(HttpServletRequest request, HttpServletResponse response, @RequestBody VillParam villParam) { String title = UuidUtil.uuid() + "_vill"; String url = request.getScheme() + "://127.0.0.1:" + serverPort + request.getContextPath(); url = url + "/page/vill/doc"; String path = exportWord(title, url, villParam,request); Map params = new HashMap<>(); params.put("downloadPath", path); return buildSuccessResponse(params); } @ApiOperation(value = "淤地坝导出问题列表-导出doc") @RequestMapping(value = "/sd/doc", method = RequestMethod.POST) @ResponseBody public BaseResponse> sdDoc(HttpServletRequest request, HttpServletResponse response, @RequestBody SdPblmParam param) { String title = UuidUtil.uuid() + "_sd"; String url = request.getScheme() + "://127.0.0.1:" + serverPort + request.getContextPath(); url = url + "/page/sd/doc"; String path = exportWord(title, url, param,request); Map params = new HashMap<>(); params.put("downloadPath", path); return buildSuccessResponse(params); } @ApiOperation(value = "通用导出问题列表-导出doc") @RequestMapping(value = "/pblm/doc", method = RequestMethod.POST) @ResponseBody public BaseResponse> pblmDoc(HttpServletRequest request, @RequestBody PblmParam param) { String title = UuidUtil.uuid() + "_pblm"; String url = request.getScheme() + "://127.0.0.1:" + serverPort + request.getContextPath(); url = url + "/page/pblm/doc"; String path = exportWord(title, url, param,request); Map params = new HashMap<>(); params.put("downloadPath", path); return buildSuccessResponse(params); } private String exportWord( String title, String url, Object params,HttpServletRequest request) { String content=HttpUtil.resultBody(url,params,request); try { uploadPath = uploadPath.replace(filePreFix, ""); String filename = WorldExoprtWithPicUtils.createWord(title, content, docxPath, uploadPath,""); return baseDocxPath + filename; } catch (Exception e) { e.printStackTrace(); } return null; } }