bd28193b99f659e020eac280f3a95e653b4610aa.svn-base 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603
  1. package cn.com.goldenwater.dcproj.controller.index;
  2. import cn.com.goldenwater.core.web.BaseController;
  3. import cn.com.goldenwater.core.web.BaseResponse;
  4. import cn.com.goldenwater.dcproj.constValue.BisInspEnum;
  5. import cn.com.goldenwater.dcproj.dao.BisInspPblmDao;
  6. import cn.com.goldenwater.dcproj.model.*;
  7. import cn.com.goldenwater.dcproj.param.*;
  8. import cn.com.goldenwater.dcproj.service.*;
  9. import cn.com.goldenwater.dcproj.target.Authority;
  10. import cn.com.goldenwater.dcproj.utils.*;
  11. import cn.com.goldenwater.id.util.UuidUtil;
  12. import io.swagger.annotations.Api;
  13. import io.swagger.annotations.ApiOperation;
  14. import io.swagger.annotations.ApiParam;
  15. import org.apache.commons.lang3.StringUtils;
  16. import org.slf4j.Logger;
  17. import org.slf4j.LoggerFactory;
  18. import org.springframework.beans.factory.annotation.Autowired;
  19. import org.springframework.beans.factory.annotation.Value;
  20. import org.springframework.stereotype.Controller;
  21. import org.springframework.ui.Model;
  22. import org.springframework.web.bind.annotation.*;
  23. import javax.servlet.http.HttpServletRequest;
  24. import javax.servlet.http.HttpServletResponse;
  25. import java.util.*;
  26. @Api(value = "APP 小水库,人饮工程,水毁工程doc导出", tags = "APP 小水库,人饮工程,水毁工程doc导出")
  27. @Controller
  28. @RequestMapping("/")
  29. public class IndexController extends BaseController {
  30. private Logger logger = LoggerFactory.getLogger(getClass());
  31. @Value("${export.basePath.docx}")
  32. private String docxPath;
  33. @Value("${web.upload-path}")
  34. private String uploadPath;
  35. @Value("${getFile.prefix}")
  36. private String filePreFix;
  37. @Value("${export.basePath.docx.path}")
  38. private String baseDocxPath;
  39. @Autowired
  40. private BisInspPblmDao bisInspPblmDao;
  41. @Autowired
  42. private OlBisInspOrgService olBisInspOrgService;
  43. @RequestMapping(value = "index",method = RequestMethod.GET)
  44. public String index() {
  45. return "/index";
  46. }
  47. @ApiOperation(value = "人饮导出问题列表-html展示")
  48. @RequestMapping(value = "page/vill/doc", method = RequestMethod.POST)
  49. public String villDoc(@ApiParam(name = "villParam", value = "villParam", required = true) @RequestBody VillParam villParam
  50. , Model model) {
  51. String orgIds = InspUtils.setOrgIds(villParam.getOrgIds());
  52. villParam.setOrgIds(orgIds);
  53. villParam.setCodes(InspUtils.setOrgIds(villParam.getCodes()));
  54. villParam.setOrgId(getCurrentOrgId());
  55. villParam.setProvince(olBisInspOrgService.getProvince(getCurrentOrgId()));
  56. List<BisInspPblm> pblmList = InspPblmUtils.setPblmList(bisInspPblmDao.findVillPlbmList(villParam));
  57. DocType docType = new DocType();
  58. docType.setpType(BisInspEnum.VILL.getValue());
  59. docType.setHasVedio(villParam.getHasVedio());
  60. docType.setIfCasePblm(villParam.getIfCasePblm());
  61. docType.setEndTime(villParam.getEndTime());
  62. docType.setPblmIds(InspPblmUtils.getPblms(pblmList));
  63. docType.setProvince(olBisInspOrgService.getProvince(getCurrentOrgId()));
  64. docType.setOrgId(getCurrentOrgId());
  65. docType.setPersId(villParam.getPersId());
  66. docType.setStartTime(villParam.getStartTime());
  67. docType.setFindTime(villParam.getFindTime());
  68. List<PblmDoc> pblmDocList = bisInspPblmDao.findPblmBindFiles(docType);
  69. List<Map<String, List<Map<String, List<PblmDoc>>>>> valMap = getValMap2(pblmList, pblmDocList, BisInspEnum.VILL.getValue());
  70. model.addAttribute("datas", valMap);
  71. model.addAttribute("objName", BisInspEnum.VILL.getDesc());
  72. return "/pblmDoc";
  73. }
  74. @ApiOperation(value = "水毁导出问题列表-html展示")
  75. @RequestMapping(value = "page/track/doc", method = RequestMethod.POST)
  76. public String trackDoc(@ApiParam(name = "trackParam", value = "trackParam", required = true) @RequestBody TrackParam trackParam
  77. , Model model) {
  78. String orgIds = InspUtils.setOrgIds(trackParam.getOrgIds());
  79. trackParam.setOrgIds(orgIds);
  80. trackParam.setCodes(InspUtils.setOrgIds(trackParam.getCodes()));
  81. trackParam.setOrgId(getCurrentOrgId());
  82. trackParam.setProvince(olBisInspOrgService.getProvince(getCurrentOrgId()));
  83. List<BisInspPblm> pblmList = InspPblmUtils.setPblmList(bisInspPblmDao.findTrackPlbmList(trackParam));
  84. DocType docType = new DocType();
  85. docType.setpType(BisInspEnum.TRACK.getValue());
  86. docType.setHasVedio(trackParam.getHasVedio());
  87. docType.setIfCasePblm(trackParam.getIfCasePblm());
  88. docType.setEndTime(trackParam.getEndTime());
  89. docType.setPblmIds(InspPblmUtils.getPblms(pblmList));
  90. docType.setPersId(trackParam.getPersId());
  91. docType.setProvince(olBisInspOrgService.getProvince(getCurrentOrgId()));
  92. docType.setOrgId(getCurrentOrgId());
  93. docType.setStartTime(trackParam.getStartTime());
  94. docType.setFindTime(trackParam.getFindTime());
  95. List<PblmDoc> pblmDocList = bisInspPblmDao.findPblmBindFiles(docType);
  96. List<Map<String, List<Map<String, List<PblmDoc>>>>> valMap = getValMap2(pblmList, pblmDocList, BisInspEnum.TRACK.getValue());
  97. model.addAttribute("datas", valMap);
  98. model.addAttribute("objName", BisInspEnum.TRACK.getDesc());
  99. return "/pblmDoc";
  100. }
  101. @ApiOperation(value = "淤地坝导出问题列表-html展示")
  102. @RequestMapping(value = "page/sd/doc", method = RequestMethod.POST)
  103. public String sdDoc(@ApiParam(name = "param", value = "param", required = true) @RequestBody SdPblmParam param
  104. , Model model) {
  105. String orgIds = InspUtils.setOrgIds(param.getOrgIds());
  106. param.setOrgIds(orgIds);
  107. param.setOrgId(getCurrentOrgId());
  108. param.setProvince(olBisInspOrgService.getProvince(getCurrentOrgId()));
  109. param.setCodes(InspUtils.setOrgIds(param.getCodes()));
  110. List<BisInspPblm> pblmList = InspPblmUtils.setPblmList(bisInspPblmDao.findSdPblmList(param));
  111. DocType docType = new DocType();
  112. docType.setpType(BisInspEnum.SD.getValue());
  113. docType.setPblmIds(InspPblmUtils.getPblms(pblmList));
  114. docType.setHasVedio(param.getHasVedio());
  115. docType.setIfCasePblm(param.getIfCasePblm());
  116. docType.setEndTime(param.getEndTime());
  117. docType.setPersId(param.getPersId());
  118. docType.setProvince(olBisInspOrgService.getProvince(getCurrentOrgId()));
  119. docType.setOrgId(getCurrentOrgId());
  120. docType.setStartTime(param.getStartTime());
  121. docType.setFindTime(param.getFindTime());
  122. List<PblmDoc> pblmDocList = bisInspPblmDao.findPblmBindFiles(docType);
  123. List<Map<String, List<Map<String, List<PblmDoc>>>>> valMap = getValMap2(pblmList, pblmDocList, BisInspEnum.SD.getValue());
  124. model.addAttribute("datas", valMap);
  125. model.addAttribute("objName", BisInspEnum.SD.getDesc());
  126. return "/pblmDoc";
  127. }
  128. @Authority
  129. @ApiOperation(value = "淤地坝导出问题列表-html展示")
  130. @RequestMapping(value = "page/pblm/doc", method = RequestMethod.POST)
  131. public String pblmDoc(@ApiParam(name = "param", value = "param", required = true) @RequestBody PblmParam param
  132. , Model model) {
  133. String orgIds = InspUtils.setOrgIds(param.getOrgIds());
  134. param.setOrgIds(orgIds);
  135. param.setOrgId(getCurrentOrgId());
  136. param.setProvince(olBisInspOrgService.getProvince(getCurrentOrgId()));
  137. param.setCodes(InspUtils.setOrgIds(param.getCodes()));
  138. List<BisInspPblm> pblmList = InspPblmUtils.setPblmList(bisInspPblmDao.findPblmList(param));
  139. DocType docType = new DocType();
  140. docType.setpType(param.getpType());
  141. docType.setHasVedio(param.getHasVedio());
  142. docType.setIfCasePblm(param.getIfCasePblm());
  143. docType.setEndTime(param.getEndTime());
  144. docType.setPersId(param.getPersId());
  145. docType.setPblmIds(InspPblmUtils.getPblms(pblmList));
  146. docType.setStartTime(param.getStartTime());
  147. docType.setProvince(olBisInspOrgService.getProvince(getCurrentOrgId()));
  148. docType.setOrgId(getCurrentOrgId());
  149. docType.setFindTime(param.getFindTime());
  150. List<PblmDoc> pblmDocList = bisInspPblmDao.findPblmBindFiles(docType);
  151. List<Map<String, List<Map<String, List<PblmDoc>>>>> valMap = getValMap2(pblmList, pblmDocList, param.getpType());
  152. model.addAttribute("datas", valMap);
  153. BisInspEnum bisInspEnum = EnumUtil.getBisInspEnum(param.getpType());
  154. if (bisInspEnum == null) {
  155. model.addAttribute("objName", "问题导出");
  156. } else {
  157. model.addAttribute("objName", bisInspEnum.getDesc());
  158. }
  159. return "/pblmDoc";
  160. }
  161. @ApiOperation(value = "地下水导出问题列表-html展示")
  162. @RequestMapping(value = "page/grw/doc", method = RequestMethod.POST)
  163. public String grwDoc(@ApiParam(name = "waterParam", value = "waterParam", required = true) @RequestBody UnderWaterParam waterParam
  164. , Model model) {
  165. String orgIds = InspUtils.setOrgIds(waterParam.getOrgIds());
  166. waterParam.setOrgIds(orgIds);
  167. waterParam.setProvince(olBisInspOrgService.getProvince(getCurrentOrgId()));
  168. waterParam.setOrgId(getCurrentOrgId());
  169. waterParam.setCodes(InspUtils.setOrgIds(waterParam.getCodes()));
  170. List<BisInspPblm> pblmList = InspPblmUtils.setPblmList(bisInspPblmDao.findWaterPlbmList(waterParam));
  171. DocType docType = new DocType();
  172. docType.setpType(BisInspEnum.GRW.getValue());
  173. docType.setHasVedio(waterParam.getHasVedio());
  174. docType.setIfCasePblm(waterParam.getIfCasePblm());
  175. docType.setPblmIds(InspPblmUtils.getPblms(pblmList));
  176. docType.setEndTime(waterParam.getEndTime());
  177. docType.setStartTime(waterParam.getStartTime());
  178. docType.setProvince(olBisInspOrgService.getProvince(getCurrentOrgId()));
  179. docType.setOrgId(getCurrentOrgId());
  180. docType.setPersId(waterParam.getPersId());
  181. docType.setFindTime(waterParam.getFindTime());
  182. List<PblmDoc> pblmDocList = bisInspPblmDao.findPblmBindFiles(docType);
  183. List<Map<String, List<Map<String, List<PblmDoc>>>>> valMap = getValMap2(pblmList, pblmDocList, BisInspEnum.GRW.getValue());
  184. model.addAttribute("datas", valMap);
  185. model.addAttribute("objName", BisInspEnum.GRW.getDesc());
  186. return "/pblmDoc";
  187. }
  188. @ApiOperation(value = "水闸导出问题列表-html展示")
  189. @RequestMapping(value = "page/waga/doc", method = RequestMethod.POST)
  190. public String wagaDoc(@ApiParam(name = "wagaParam", value = "wagaParam", required = true) @RequestBody WagaParam wagaParam
  191. , Model model) {
  192. String orgIds = InspUtils.setOrgIds(wagaParam.getOrgIds());
  193. wagaParam.setOrgIds(orgIds);
  194. wagaParam.setProvince(olBisInspOrgService.getProvince(getCurrentOrgId()));
  195. wagaParam.setOrgId(getCurrentOrgId());
  196. wagaParam.setPersId(getCurrentPersId());
  197. wagaParam.setCodes(InspUtils.setOrgIds(wagaParam.getCodes()));
  198. List<BisInspPblm> pblmList = InspPblmUtils.setPblmList(bisInspPblmDao.findWagaPlbmList(wagaParam));
  199. logger.info("水闸导出数据条数--》" + pblmList.size());
  200. DocType docType = new DocType();
  201. docType.setpType(BisInspEnum.WAGA.getValue());
  202. docType.setHasVedio(wagaParam.getHasVedio());
  203. docType.setProvince(olBisInspOrgService.getProvince(getCurrentOrgId()));
  204. docType.setOrgId(getCurrentOrgId());
  205. docType.setPblmIds(InspPblmUtils.getPblms(pblmList));
  206. docType.setIfCasePblm(wagaParam.getIfCasePblm());
  207. docType.setEndTime(wagaParam.getEndTime());
  208. docType.setStartTime(wagaParam.getStartTime());
  209. docType.setPersId(wagaParam.getPersId());
  210. docType.setFindTime(wagaParam.getFindTime());
  211. List<PblmDoc> pblmDocList = bisInspPblmDao.findPblmBindFiles(docType);
  212. List<Map<String, List<Map<String, List<PblmDoc>>>>> valMap = getValMap2(pblmList, pblmDocList, BisInspEnum.WAGA.getValue());
  213. model.addAttribute("datas", valMap);
  214. model.addAttribute("objName", BisInspEnum.WAGA.getDesc());
  215. return "/pblmDoc";
  216. }
  217. @ApiOperation(value = "重点工程导出问题列表-html展示")
  218. @RequestMapping(value = "page/keyReg/doc", method = RequestMethod.POST)
  219. public String keyRegDoc(@ApiParam(name = "keyRegPatam", value = "keyRegPatam", required = true) @RequestBody KeyRegPatam keyRegPatam
  220. , Model model) {
  221. String orgIds = InspUtils.setOrgIds(keyRegPatam.getOrgIds());
  222. keyRegPatam.setOrgIds(orgIds);
  223. keyRegPatam.setProvince(olBisInspOrgService.getProvince(getCurrentOrgId()));
  224. keyRegPatam.setCodes(InspUtils.setOrgIds(keyRegPatam.getCodes()));
  225. keyRegPatam.setOrgId(getCurrentOrgId());
  226. List<KeyRegPblm> keypblmList = InspPblmUtils.setKeyPblmList(bisInspPblmDao.findKeyRegPlbmList(keyRegPatam));
  227. DocType docType = new DocType();
  228. docType.setpType(BisInspEnum.EMPWT.getValue());
  229. docType.setHasVedio(keyRegPatam.getHasVedio());
  230. docType.setIfCasePblm(keyRegPatam.getIfCasePblm());
  231. docType.setEndTime(keyRegPatam.getEndTime());
  232. docType.setPblmIds(InspPblmUtils.getKeyPblms(keypblmList));
  233. docType.setProvince(olBisInspOrgService.getProvince(getCurrentOrgId()));
  234. docType.setOrgId(getCurrentOrgId());
  235. docType.setStartTime(keyRegPatam.getStartTime());
  236. docType.setPersId(keyRegPatam.getPersId());
  237. docType.setFindTime(keyRegPatam.getFindTime());
  238. List<PblmDoc> pblmDocList = bisInspPblmDao.findPblmBindFiles(docType);
  239. List<BisInspPblm> pblmList = new ArrayList<>();
  240. for (BisInspPblm inspPblm : keypblmList) {
  241. pblmList.add(inspPblm);
  242. }
  243. List<Map<String, List<Map<String, List<PblmDoc>>>>> valMap = getValMap2(pblmList, pblmDocList, BisInspEnum.EMPWT.getValue());
  244. model.addAttribute("datas", valMap);
  245. model.addAttribute("objName", BisInspEnum.EMPWT.getDesc());
  246. return "/pblmDoc";
  247. }
  248. //
  249. @ApiOperation(value = "小水库导出问题列表-html展示")
  250. @RequestMapping(value = "page/rever/doc", method = RequestMethod.POST)
  251. public String reverDoc(@ApiParam(name = "persId", value = "persId", required = true) @RequestBody ReverParam reverParam
  252. , Model model) {
  253. reverParam.setPersId(reverParam.getPersId());
  254. String orgIds = InspUtils.setOrgIds(reverParam.getOrgIds());
  255. reverParam.setOrgIds(orgIds);
  256. reverParam.setOrgId(getCurrentOrgId());
  257. reverParam.setProvince(olBisInspOrgService.getProvince(getCurrentOrgId()));
  258. reverParam.setCodes(InspUtils.setOrgIds(reverParam.getCodes()));
  259. List<BisInspPblm> pblmList = InspPblmUtils.setPblmList(bisInspPblmDao.findReverPlbmList(reverParam));
  260. DocType docType = new DocType();
  261. docType.setpType(BisInspEnum.REVER.getValue());
  262. docType.setHasVedio(reverParam.getHasVedio());
  263. docType.setIfCasePblm(reverParam.getIfCasePblm());
  264. docType.setOrgId(getCurrentOrgId());
  265. docType.setEndTime(reverParam.getEndTime());
  266. docType.setPblmIds(InspPblmUtils.getPblms(pblmList));
  267. docType.setStartTime(reverParam.getStartTime());
  268. docType.setPersId(reverParam.getPersId());
  269. docType.setProvince(olBisInspOrgService.getProvince(getCurrentOrgId()));
  270. docType.setFindTime(reverParam.getFindTime());
  271. List<PblmDoc> pblmDocList = bisInspPblmDao.findPblmBindFiles(docType);
  272. List<Map<String, List<Map<String, List<PblmDoc>>>>> valMap = getValMap2(pblmList, pblmDocList, BisInspEnum.REVER.getValue());
  273. model.addAttribute("datas", valMap);
  274. model.addAttribute("objName", BisInspEnum.REVER.getDesc());
  275. return "/pblmDoc";
  276. }
  277. private List<Map<String, List<Map<String, List<PblmDoc>>>>> getValMap2(List<BisInspPblm> pblmList, List<PblmDoc> pblmDocList, String pType) {
  278. List<PblmDoc> pblmDocs = new ArrayList<>();
  279. List<String> reverList = new ArrayList<>();
  280. List<String> checkList = new ArrayList<>();
  281. List<String> reverCheckList = new ArrayList<>();
  282. //数据整理
  283. for (BisInspPblm bisInspPblm : pblmList) {
  284. PblmDoc doc = new PblmDoc();
  285. if (StringUtils.isBlank(bisInspPblm.getInspPblmName())) {
  286. continue;
  287. }
  288. if (BisInspEnum.REVER.getValue().equals(pType) && !reverList.contains(bisInspPblm.getInspPblmsName()) && StringUtils.isNotBlank(bisInspPblm.getInspPblmsName())) {
  289. reverList.add(bisInspPblm.getInspPblmsName());
  290. }
  291. if (BisInspEnum.WAGA.getValue().equals(pType) && !reverList.contains(bisInspPblm.getInspPblmsName())) {
  292. reverList.add(bisInspPblm.getInspPblmsName());
  293. } else if (!BisInspEnum.REVER.getValue().equals(pType) && !reverList.contains(bisInspPblm.getInspPblmName())) {
  294. reverList.add(bisInspPblm.getInspPblmName());
  295. }
  296. if (!checkList.contains(bisInspPblm.getNm())) {
  297. checkList.add(bisInspPblm.getNm());
  298. }
  299. if (StringUtils.isNotBlank(bisInspPblm.getCheckPoint())) {
  300. if (!BisInspEnum.GRW.getValue().equals(pType)) {
  301. if (!reverCheckList.contains(bisInspPblm.getInspPblmsName() + ":" + bisInspPblm.getCheckPoint())) {
  302. reverCheckList.add(bisInspPblm.getInspPblmsName() + ":" + bisInspPblm.getCheckPoint());
  303. }
  304. } else {
  305. if (!reverCheckList.contains(bisInspPblm.getInspPblmName() + ":" + bisInspPblm.getCheckPoint())) {
  306. reverCheckList.add(bisInspPblm.getInspPblmName() + ":" + bisInspPblm.getCheckPoint());
  307. }
  308. }
  309. } else if (!BisInspEnum.REVER.getValue().equals(pType)) {
  310. if (BisInspEnum.VILL.getValue().equals(pType)) {
  311. bisInspPblm.setCheckPoint(bisInspPblm.getInspPblmsName());
  312. bisInspPblm.setInspPblmsName(bisInspPblm.getInspPblmName());
  313. if (StringUtils.isNotBlank(bisInspPblm.getCheckPoint())) {
  314. if (!reverCheckList.contains(bisInspPblm.getInspPblmsName() + ":" + bisInspPblm.getCheckPoint())) {
  315. reverCheckList.add(bisInspPblm.getInspPblmsName() + ":" + bisInspPblm.getCheckPoint());
  316. }
  317. }
  318. } else {
  319. if (!reverCheckList.contains(bisInspPblm.getInspPblmName() + ":" + bisInspPblm.getNm())) {
  320. reverCheckList.add(bisInspPblm.getInspPblmName() + ":" + bisInspPblm.getNm());
  321. }
  322. }
  323. }
  324. doc.setCheckPoint(bisInspPblm.getCheckPoint());
  325. doc.setPblmId(bisInspPblm.getPblmId());
  326. doc.setRsName(bisInspPblm.getNm());
  327. doc.setAdFullName(bisInspPblm.getAdFullName());
  328. doc.setInspPblmDesc(bisInspPblm.getInspPblmDesc());
  329. doc.setOrgNm(bisInspPblm.getOrgNm());
  330. String adFullname = "";
  331. if (StringUtils.isNotBlank(bisInspPblm.getAdFullName())) {
  332. adFullname = bisInspPblm.getAdFullName();
  333. }
  334. String desc = "";
  335. if (StringUtils.isNotBlank(bisInspPblm.getInspPblmDesc())) {
  336. desc = bisInspPblm.getInspPblmDesc();
  337. }
  338. if (adFullname.contains(doc.getRsName())) {
  339. if ("".equals(adFullname)) {
  340. doc.setNote(desc);
  341. } else {
  342. doc.setNote(adFullname + "," + desc);
  343. }
  344. } else {
  345. doc.setNote(adFullname + "," + doc.getRsName() + "," + desc);
  346. }
  347. if (doc.getNote().startsWith(",")) {
  348. String note = doc.getNote().substring(1, doc.getNote().length());
  349. doc.setNote(note);
  350. }
  351. if (BisInspEnum.REVER.getValue().equals(pType) || BisInspEnum.VILL.getValue().equals(pType) || BisInspEnum.WAGA.getValue().equals(pType)) {
  352. doc.setInspPblmName(bisInspPblm.getInspPblmsName());
  353. } else {
  354. doc.setInspPblmName(bisInspPblm.getInspPblmName());
  355. }
  356. doc.setPersName(bisInspPblm.getPersName());
  357. for (PblmDoc pblmDoc : pblmDocList) {
  358. if (bisInspPblm.getPblmId().equals(pblmDoc.getPblmId())) {
  359. doc.setFileExtes(pblmDoc.getFileExtes());
  360. doc.setFilePathes(pblmDoc.getFilePathes());
  361. if (StringUtils.isNotBlank(pblmDoc.getFilePathes())) {
  362. doc.setFileArrays(pblmDoc.getFilePathes().split(","));
  363. } else {
  364. doc.setFileArrays(new String[]{});
  365. }
  366. }
  367. }
  368. pblmDocs.add(doc);
  369. }
  370. //将数据包装为key.value
  371. List<Map<String, List<Map<String, List<PblmDoc>>>>> valMap = new ArrayList<>();
  372. int count = 1;
  373. int num = 1;
  374. for (String dd : reverList) {
  375. Map<String, List<Map<String, List<PblmDoc>>>> bmap = new HashMap<>();
  376. List<Map<String, List<PblmDoc>>> secMap = new ArrayList<>();
  377. num = 1;
  378. for (String rever : reverCheckList) {
  379. if (rever.contains(dd)) {
  380. Map<String, List<PblmDoc>> map = new HashMap<>();
  381. List<PblmDoc> pblmDocs1 = new ArrayList<>();
  382. int vv = 1;
  383. String repearDesc = "";
  384. for (PblmDoc pblmDoc : pblmDocs) {
  385. boolean repeat = false;
  386. 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)) {
  387. if (rever.contains(pblmDoc.getInspPblmName() + ":" + pblmDoc.getCheckPoint())) {
  388. if (!pblmDoc.getNote().contains("(" + vv + ")")) {
  389. if (repearDesc.equals(pblmDoc.getNote())) {
  390. pblmDoc.setNote("");
  391. } else {
  392. repearDesc = pblmDoc.getNote();
  393. pblmDoc.setNote("(" + vv + ")" + pblmDoc.getNote());
  394. repeat = true;
  395. }
  396. }
  397. if (!pblmDocs1.contains(pblmDoc)) {
  398. pblmDoc.setNote(changeNote(vv, pblmDoc.getNote()));
  399. pblmDocs1.add(pblmDoc);
  400. if (repeat) {
  401. vv++;
  402. }
  403. }
  404. }
  405. } else if (rever.contains(pblmDoc.getInspPblmName() + ":" + pblmDoc.getRsName())) {
  406. if (!pblmDoc.getNote().contains("(" + vv + ")")) {
  407. if (repearDesc.equals(pblmDoc.getNote())) {
  408. pblmDoc.setNote("");
  409. } else {
  410. repearDesc = pblmDoc.getNote();
  411. pblmDoc.setNote("(" + vv + ")" + pblmDoc.getNote());
  412. repeat = true;
  413. }
  414. }
  415. if (!pblmDocs1.contains(pblmDoc)) {
  416. pblmDoc.setNote(changeNote(vv, pblmDoc.getNote()));
  417. pblmDocs1.add(pblmDoc);
  418. if (repeat) {
  419. vv++;
  420. }
  421. }
  422. }
  423. }
  424. if (rever.contains(":")) {
  425. String[] revers = rever.split(":");
  426. map.put(num + "、" + revers[1], pblmDocs1);
  427. } else {
  428. map.put(num + "、" + rever, pblmDocs1);
  429. }
  430. num++;
  431. secMap.add(map);
  432. }
  433. }
  434. bmap.put("(" + InspPblmUtils.toChinese(count + "") + ")" + dd, secMap);
  435. count++;
  436. valMap.add(bmap);
  437. }
  438. return valMap;
  439. }
  440. private String changeNote(int vv, String note) {
  441. int prev = vv - 1;
  442. if (note.startsWith("(" + prev + ")")) {
  443. note = note.replaceFirst("(" + prev + ")", "");
  444. }
  445. return note;
  446. }
  447. @Value("${server.port}")
  448. private String serverPort;
  449. //
  450. @ApiOperation(value = "小水库导出问题列表-导出doc")
  451. @RequestMapping(value = "/rever/doc", method = RequestMethod.POST)
  452. @ResponseBody
  453. public BaseResponse<Map<String, String>> reverDoc(HttpServletRequest request, HttpServletResponse response, @RequestBody ReverParam reverParam) {
  454. String title = UuidUtil.uuid() + "_rever";
  455. String url = request.getScheme() + "://127.0.0.1:" + serverPort + request.getContextPath();
  456. url = url + "/page/rever/doc";
  457. String path = exportWord(title, url, reverParam,request);
  458. Map<String, String> params = new HashMap<>();
  459. params.put("downloadPath", path);
  460. return buildSuccessResponse(params);
  461. }
  462. @ApiOperation(value = "水闸导出问题列表-导出doc")
  463. @RequestMapping(value = "/keyReg/doc", method = RequestMethod.POST)
  464. @ResponseBody
  465. public BaseResponse<Map<String, String>> keyRegDoc(HttpServletRequest request, HttpServletResponse response, @RequestBody KeyRegPatam keyRegPatam) {
  466. String title = UuidUtil.uuid() + "_keyReg";
  467. String url = request.getScheme() + "://127.0.0.1:" + serverPort + request.getContextPath();
  468. url = url + "/page/keyReg/doc";
  469. String path = exportWord(title, url, keyRegPatam,request);
  470. Map<String, String> params = new HashMap<>();
  471. params.put("downloadPath", path);
  472. return buildSuccessResponse(params);
  473. }
  474. @ApiOperation(value = "水毁导出问题列表-导出doc")
  475. @RequestMapping(value = "/track/doc", method = RequestMethod.POST)
  476. @ResponseBody
  477. public BaseResponse<Map<String, String>> trackDoc(HttpServletRequest request, HttpServletResponse response, @RequestBody TrackParam trackParam) {
  478. String title = UuidUtil.uuid() + "_track";
  479. String url = request.getScheme() + "://127.0.0.1:" + serverPort + request.getContextPath();
  480. url = url + "/page/track/doc";
  481. String path = exportWord(title, url, trackParam,request);
  482. Map<String, String> params = new HashMap<>();
  483. params.put("downloadPath", path);
  484. return buildSuccessResponse(params);
  485. }
  486. @ApiOperation(value = "水闸导出问题列表-导出doc")
  487. @RequestMapping(value = "/waga/doc", method = RequestMethod.POST)
  488. @ResponseBody
  489. public BaseResponse<Map<String, String>> wagaDoc(HttpServletRequest request, HttpServletResponse response, @RequestBody WagaParam wagaParam) {
  490. String title = UuidUtil.uuid() + "_waga";
  491. String url = request.getScheme() + "://127.0.0.1:" + serverPort + request.getContextPath();
  492. url = url + "/page/waga/doc";
  493. logger.info("水闸地址--》" + url);
  494. String path = exportWord(title, url, wagaParam,request);
  495. Map<String, String> params = new HashMap<>();
  496. params.put("downloadPath", path);
  497. return buildSuccessResponse(params);
  498. }
  499. @ApiOperation(value = "地下水导出问题列表-导出doc")
  500. @RequestMapping(value = "/grw/doc", method = RequestMethod.POST)
  501. @ResponseBody
  502. public BaseResponse<Map<String, String>> grwDoc(HttpServletRequest request, HttpServletResponse response, @RequestBody UnderWaterParam waterParam) {
  503. String title = UuidUtil.uuid() + "_grw";
  504. String url = request.getScheme() + "://127.0.0.1:" + serverPort + request.getContextPath();
  505. url = url + "/page/grw/doc";
  506. String path = exportWord(title, url, waterParam,request);
  507. Map<String, String> params = new HashMap<>();
  508. params.put("downloadPath", path);
  509. return buildSuccessResponse(params);
  510. }
  511. @ApiOperation(value = "人饮导出问题列表-导出doc")
  512. @RequestMapping(value = "/vill/doc", method = RequestMethod.POST)
  513. @ResponseBody
  514. public BaseResponse<Map<String, String>> villDoc(HttpServletRequest request, HttpServletResponse response, @RequestBody VillParam villParam) {
  515. String title = UuidUtil.uuid() + "_vill";
  516. String url = request.getScheme() + "://127.0.0.1:" + serverPort + request.getContextPath();
  517. url = url + "/page/vill/doc";
  518. String path = exportWord(title, url, villParam,request);
  519. Map<String, String> params = new HashMap<>();
  520. params.put("downloadPath", path);
  521. return buildSuccessResponse(params);
  522. }
  523. @ApiOperation(value = "淤地坝导出问题列表-导出doc")
  524. @RequestMapping(value = "/sd/doc", method = RequestMethod.POST)
  525. @ResponseBody
  526. public BaseResponse<Map<String, String>> sdDoc(HttpServletRequest request, HttpServletResponse response, @RequestBody SdPblmParam param) {
  527. String title = UuidUtil.uuid() + "_sd";
  528. String url = request.getScheme() + "://127.0.0.1:" + serverPort + request.getContextPath();
  529. url = url + "/page/sd/doc";
  530. String path = exportWord(title, url, param,request);
  531. Map<String, String> params = new HashMap<>();
  532. params.put("downloadPath", path);
  533. return buildSuccessResponse(params);
  534. }
  535. @ApiOperation(value = "通用导出问题列表-导出doc")
  536. @RequestMapping(value = "/pblm/doc", method = RequestMethod.POST)
  537. @ResponseBody
  538. public BaseResponse<Map<String, String>> pblmDoc(HttpServletRequest request, @RequestBody PblmParam param) {
  539. String title = UuidUtil.uuid() + "_pblm";
  540. String url = request.getScheme() + "://127.0.0.1:" + serverPort + request.getContextPath();
  541. url = url + "/page/pblm/doc";
  542. String path = exportWord(title, url, param,request);
  543. Map<String, String> params = new HashMap<>();
  544. params.put("downloadPath", path);
  545. return buildSuccessResponse(params);
  546. }
  547. private String exportWord( String title, String url, Object params,HttpServletRequest request) {
  548. String content=HttpUtil.resultBody(url,params,request);
  549. try {
  550. uploadPath = uploadPath.replace(filePreFix, "");
  551. String filename = WorldExoprtWithPicUtils.createWord(title, content, docxPath, uploadPath,"");
  552. return baseDocxPath + filename;
  553. } catch (Exception e) {
  554. e.printStackTrace();
  555. }
  556. return null;
  557. }
  558. }