| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603 |
- 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<BisInspPblm> 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<PblmDoc> pblmDocList = bisInspPblmDao.findPblmBindFiles(docType);
- List<Map<String, List<Map<String, List<PblmDoc>>>>> 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<BisInspPblm> 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<PblmDoc> pblmDocList = bisInspPblmDao.findPblmBindFiles(docType);
- List<Map<String, List<Map<String, List<PblmDoc>>>>> 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<BisInspPblm> 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<PblmDoc> pblmDocList = bisInspPblmDao.findPblmBindFiles(docType);
- List<Map<String, List<Map<String, List<PblmDoc>>>>> 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<BisInspPblm> 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<PblmDoc> pblmDocList = bisInspPblmDao.findPblmBindFiles(docType);
- List<Map<String, List<Map<String, List<PblmDoc>>>>> 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<BisInspPblm> 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<PblmDoc> pblmDocList = bisInspPblmDao.findPblmBindFiles(docType);
- List<Map<String, List<Map<String, List<PblmDoc>>>>> 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<BisInspPblm> 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<PblmDoc> pblmDocList = bisInspPblmDao.findPblmBindFiles(docType);
- List<Map<String, List<Map<String, List<PblmDoc>>>>> 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<KeyRegPblm> 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<PblmDoc> pblmDocList = bisInspPblmDao.findPblmBindFiles(docType);
- List<BisInspPblm> pblmList = new ArrayList<>();
- for (BisInspPblm inspPblm : keypblmList) {
- pblmList.add(inspPblm);
- }
- List<Map<String, List<Map<String, List<PblmDoc>>>>> 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<BisInspPblm> 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<PblmDoc> pblmDocList = bisInspPblmDao.findPblmBindFiles(docType);
- List<Map<String, List<Map<String, List<PblmDoc>>>>> valMap = getValMap2(pblmList, pblmDocList, BisInspEnum.REVER.getValue());
- model.addAttribute("datas", valMap);
- model.addAttribute("objName", BisInspEnum.REVER.getDesc());
- return "/pblmDoc";
- }
- private List<Map<String, List<Map<String, List<PblmDoc>>>>> getValMap2(List<BisInspPblm> pblmList, List<PblmDoc> pblmDocList, String pType) {
- List<PblmDoc> pblmDocs = new ArrayList<>();
- List<String> reverList = new ArrayList<>();
- List<String> checkList = new ArrayList<>();
- List<String> 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<Map<String, List<Map<String, List<PblmDoc>>>>> valMap = new ArrayList<>();
- int count = 1;
- int num = 1;
- for (String dd : reverList) {
- Map<String, List<Map<String, List<PblmDoc>>>> bmap = new HashMap<>();
- List<Map<String, List<PblmDoc>>> secMap = new ArrayList<>();
- num = 1;
- for (String rever : reverCheckList) {
- if (rever.contains(dd)) {
- Map<String, List<PblmDoc>> map = new HashMap<>();
- List<PblmDoc> 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<Map<String, String>> 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<String, String> params = new HashMap<>();
- params.put("downloadPath", path);
- return buildSuccessResponse(params);
- }
-
- @ApiOperation(value = "水闸导出问题列表-导出doc")
- @RequestMapping(value = "/keyReg/doc", method = RequestMethod.POST)
- @ResponseBody
- public BaseResponse<Map<String, String>> 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<String, String> params = new HashMap<>();
- params.put("downloadPath", path);
- return buildSuccessResponse(params);
- }
-
- @ApiOperation(value = "水毁导出问题列表-导出doc")
- @RequestMapping(value = "/track/doc", method = RequestMethod.POST)
- @ResponseBody
- public BaseResponse<Map<String, String>> 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<String, String> params = new HashMap<>();
- params.put("downloadPath", path);
- return buildSuccessResponse(params);
- }
-
- @ApiOperation(value = "水闸导出问题列表-导出doc")
- @RequestMapping(value = "/waga/doc", method = RequestMethod.POST)
- @ResponseBody
- public BaseResponse<Map<String, String>> 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<String, String> params = new HashMap<>();
- params.put("downloadPath", path);
- return buildSuccessResponse(params);
- }
-
- @ApiOperation(value = "地下水导出问题列表-导出doc")
- @RequestMapping(value = "/grw/doc", method = RequestMethod.POST)
- @ResponseBody
- public BaseResponse<Map<String, String>> 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<String, String> params = new HashMap<>();
- params.put("downloadPath", path);
- return buildSuccessResponse(params);
- }
-
- @ApiOperation(value = "人饮导出问题列表-导出doc")
- @RequestMapping(value = "/vill/doc", method = RequestMethod.POST)
- @ResponseBody
- public BaseResponse<Map<String, String>> 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<String, String> params = new HashMap<>();
- params.put("downloadPath", path);
- return buildSuccessResponse(params);
- }
-
- @ApiOperation(value = "淤地坝导出问题列表-导出doc")
- @RequestMapping(value = "/sd/doc", method = RequestMethod.POST)
- @ResponseBody
- public BaseResponse<Map<String, String>> 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<String, String> params = new HashMap<>();
- params.put("downloadPath", path);
- return buildSuccessResponse(params);
- }
-
- @ApiOperation(value = "通用导出问题列表-导出doc")
- @RequestMapping(value = "/pblm/doc", method = RequestMethod.POST)
- @ResponseBody
- public BaseResponse<Map<String, String>> 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<String, String> 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;
- }
- }
|