5c4bec9e067baf63a4cd9daab5ae48b370926ba9.svn-base 121 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203
  1. package cn.com.goldenwater.dcproj.service.impl.other;
  2. import cn.com.goldenwater.core.service.AbstractCrudService;
  3. import cn.com.goldenwater.dcproj.constValue.BisInspBsEnum;
  4. import cn.com.goldenwater.dcproj.constValue.BisInspEnum;
  5. import cn.com.goldenwater.dcproj.constValue.SimpleReportEnum;
  6. import cn.com.goldenwater.dcproj.dao.*;
  7. import cn.com.goldenwater.dcproj.dto.*;
  8. import cn.com.goldenwater.dcproj.model.*;
  9. import cn.com.goldenwater.dcproj.param.*;
  10. import cn.com.goldenwater.dcproj.service.BisInspStatService;
  11. import cn.com.goldenwater.dcproj.service.GwComFileService;
  12. import cn.com.goldenwater.dcproj.service.OlBisInspOrgService;
  13. import cn.com.goldenwater.dcproj.utils.DateUtils;
  14. import cn.com.goldenwater.dcproj.utils.InspUtils;
  15. import cn.com.goldenwater.util.common.SqlUtils;
  16. import freemarker.template.Configuration;
  17. import freemarker.template.Template;
  18. import freemarker.template.TemplateException;
  19. import org.apache.commons.collections.MapUtils;
  20. import org.apache.commons.collections.map.HashedMap;
  21. import org.apache.commons.lang.StringUtils;
  22. import org.slf4j.Logger;
  23. import org.slf4j.LoggerFactory;
  24. import org.springframework.beans.factory.annotation.Autowired;
  25. import org.springframework.beans.factory.annotation.Value;
  26. import org.springframework.stereotype.Service;
  27. import org.springframework.transaction.annotation.Transactional;
  28. import java.io.*;
  29. import java.nio.charset.StandardCharsets;
  30. import java.text.SimpleDateFormat;
  31. import java.util.*;
  32. import java.util.stream.Collectors;
  33. import static cn.com.goldenwater.dcproj.constValue.SimpleReportEnum.*;
  34. import static cn.com.goldenwater.dcproj.utils.InspUtils.setOrgIds;
  35. import static cn.com.goldenwater.dcproj.utils.WordUtils.getImageString;
  36. /**
  37. * 督查简报生成WORD 业务实现类。
  38. *
  39. * <p>使用FreeMarker技术生成WORD,进行数据的替换和填充
  40. *
  41. * @author lhc
  42. * @author lyz
  43. * @date 2019-10-16
  44. * @date 2019-10-31
  45. */
  46. @Service
  47. @Transactional
  48. public class BisInspStatServiceImpl extends AbstractCrudService<BisInspStat, BisInspStatParam> implements BisInspStatService {
  49. private Logger logger = LoggerFactory.getLogger(getClass());
  50. @Value("${export.templatePath}" + "/dcjb/")
  51. private String templatePath;
  52. @Value("${small.upload-path}")
  53. public String imgPathPrefix;
  54. private static final String TEMP_FILE_NAME = "statDoc.ftl";
  55. private static final String RSVR_TEMP_FILE_NAME = "rsvrDoc.ftl";
  56. private Configuration configuration;
  57. @Autowired
  58. private BisInspStatDao bisInspStatDao;
  59. @Autowired
  60. private OlBisInspOrgService olBisInspOrgService;
  61. @Autowired
  62. private VersionDao versionDao;
  63. @Autowired
  64. private BisInspPblmDao bisInspPblmDao;
  65. @Autowired
  66. private GwComFileService gwComFileService;
  67. @Autowired
  68. private AttWagaRgstrDao attWagaRgstrDao;
  69. @Autowired
  70. private BisInspWtdstDao bisInspWtdstDao;
  71. @Autowired
  72. private BisInspRsvrRgstrDao bisInspRsvrRgstrDao;
  73. /**
  74. * 农饮工程列表
  75. */
  76. @Autowired
  77. private BisInspVlgdrinkProjManageDao bisInspVlgdrinkProjManageDao;
  78. public BisInspStatServiceImpl(BisInspStatDao bisInspStatDao) {
  79. super(bisInspStatDao);
  80. this.bisInspStatDao = bisInspStatDao;
  81. configuration = new Configuration(Configuration.DEFAULT_INCOMPATIBLE_IMPROVEMENTS);
  82. configuration.setDefaultEncoding("utf-8");
  83. }
  84. @Override
  85. public String getRsvrDocByTm(String fileName, String month, String persId, String currentOrgId) throws IOException {
  86. Map<String, Object> dataMap = new HashMap<>();
  87. String filePath = templatePath + "/" + fileName;
  88. this.getRsvrDataMap(dataMap,persId, null ,month,currentOrgId);
  89. /*
  90. 替换模板
  91. dataMap 要填入模本的数据文件
  92. 设置模本装置方法和路径,FreeMarker支持多种模板装载方法。可以从servlet,classpath,数据库装载,
  93. 这里我们的模板是放在template包下面
  94. */
  95. // 装载路径
  96. configuration.setDirectoryForTemplateLoading(new File(templatePath));
  97. // 通过模板名称获取模板
  98. Template template = configuration.getTemplate(RSVR_TEMP_FILE_NAME);
  99. // 开始装载并输出
  100. if (template != null) {
  101. //输出文档路径及名称
  102. File outFile = new File(filePath);
  103. Writer out = null;
  104. FileOutputStream fos = null;
  105. try {
  106. fos = new FileOutputStream(outFile);
  107. OutputStreamWriter oWriter = new OutputStreamWriter(fos, StandardCharsets.UTF_8);
  108. //这个地方对流的编码不可或缺,使用main()单独调用时,应该可以,但是如果是web请求导出时导出后word文档就会打不开,并且包XML文件错误。主要是编码格式不正确,无法解析。
  109. //out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outFile)));
  110. out = new BufferedWriter(oWriter);
  111. //向模板里替换数据
  112. template.process(dataMap, out);
  113. } catch (FileNotFoundException | TemplateException e) {
  114. e.printStackTrace();
  115. } finally {
  116. if (out != null) {
  117. out.close();
  118. }
  119. if (fos != null) {
  120. fos.close();
  121. }
  122. }
  123. }
  124. //输出文件到指定路径
  125. return filePath;
  126. }
  127. private void getRsvrDataMap(Map<String, Object> dataMap, String persId , String ifCasePblm, String month, String currentOrgId) {
  128. //设置组信息
  129. String id = this.setGroupInfo(dataMap,persId,month,currentOrgId);
  130. Map<String,BisInspStatRsvrInfoDto> dtoMap = new HashedMap();
  131. //设置登记信息
  132. String rgstrId = this.setRgstrInfo(id,dataMap,persId,currentOrgId,dtoMap);
  133. //问题统计信息
  134. this.setPblmInfo(rgstrId,dataMap,"1",dtoMap);
  135. }
  136. /**
  137. * 根据登记表id得到问题信息
  138. * @param rgstrId
  139. * @param dataMap
  140. */
  141. private void setPblmInfo(String rgstrId, Map<String, Object> dataMap,String objType ,Map<String,BisInspStatRsvrInfoDto> dtoMap) {
  142. List<BisInspPblm> pblmList = new ArrayList<>();
  143. if (StringUtils.isNotBlank(rgstrId)) {
  144. BisInspPblmParam pblmParam = new BisInspPblmParam();
  145. pblmParam.setObjType(objType);
  146. pblmParam.setRegid(rgstrId);
  147. pblmList = this.bisInspPblmDao.getPblmListByRegId(pblmParam);
  148. }
  149. Long normal = new Long(0);
  150. Long heavier = new Long(0);
  151. Long serious = new Long(0);
  152. Long superSerious = new Long(0);
  153. Map<String,List<String>> adCodeMap = new HashedMap();
  154. Long allRsvr = new Long(0);
  155. //统计信息
  156. //三个责任人
  157. Map<String,List<String>> perMap = new HashedMap();//去重过滤
  158. Long persSize = new Long(0);//责任人总数
  159. Long pblmHasWiunWaoLegPers = new Long(0);//未落实行政责任人
  160. Long pblmHasWiunWaoLegPersOne = new Long(0);
  161. Long pblmHasWiunWaoLegPersTwo = new Long(0);
  162. Map<String,Long> hasWiunWaoLegPersAdMap = new HashedMap();
  163. Long pblmWiunWaoLegPersResu = new Long(0);//行政责任人履职差
  164. Long pblmWiunWaoLegPersResuOne = new Long(0);
  165. Long pblmWiunWaoLegPersResuTwo = new Long(0);
  166. Long pblmWiunWaoLegPersTrain = new Long(0);//岗位培训
  167. Long pblmWiunWaoLegPersTrainOne = new Long(0);//岗位培训
  168. Long pblmWiunWaoLegPersTrainTwo = new Long(0);//岗位培训
  169. Long pblmHasTechPers = new Long(0);//未落实责任人
  170. Long pblmHasTechPersOne = new Long(0);
  171. Long pblmHasTechPersTwo = new Long(0);
  172. Map<String,Long> hasTechPersAdMap = new HashedMap();
  173. Long pblmTechPersResu = new Long(0);//技术责任人履职差
  174. Long pblmTechPersResuOne = new Long(0);
  175. Long pblmTechPersResuTwo = new Long(0);
  176. Long pblmTechPersResuTrain = new Long(0);//岗位培训
  177. Long pblmTechPersResuTrainOne = new Long(0);//岗位培训
  178. Long pblmTechPersResuTrainTwo = new Long(0);//岗位培训
  179. Long pblmHasPatrolPers = new Long(0);//未落实责任人
  180. Long pblmHasPatrolPersOne = new Long(0);
  181. Long pblmHasPatrolPersTwo = new Long(0);
  182. Map<String,Long> hasPatrolPersAdMap = new HashedMap();
  183. Long pblmPatrolPersResu = new Long(0);//巡查责任人履职差
  184. Long pblmPatrolPersResuOne = new Long(0);
  185. Long pblmPatrolPersResuTwo = new Long(0);
  186. Long pblmPatrolPersResuTrain = new Long(0);//岗位培训
  187. Long pblmPatrolPersResuTrainOne = new Long(0);//岗位培训
  188. Long pblmPatrolPersResuTrainTwo = new Long(0);//岗位培训
  189. List<String> rgstrIdList = new ArrayList<>();
  190. //三个重点环节
  191. Long pblmRainForc = new Long(0);//雨水情预测
  192. Long pblmRainForcOne = new Long(0);
  193. Long pblmRainForcTwo = new Long(0);
  194. Long pblmSchPlanSameExta = new Long(0);
  195. Long pblmSchPlanSameExtaOne = new Long(0);
  196. Long pblmSchPlanSameExtaTwo = new Long(0);
  197. Long pblmSchPlanSameAppr = new Long(0);
  198. Long pblmSchPlanSameApprOne = new Long(0);
  199. Long pblmSchPlanSameApprTwo = new Long(0);
  200. Long pblmSchPlanSameEmer = new Long(0);
  201. Long pblmSchPlanSameEmerOne = new Long(0);
  202. Long pblmSchPlanSameEmerTwo = new Long(0);
  203. Long pblmSchPlanSameSpeed = new Long(0);
  204. Long pblmSchPlanSameSpeedOne = new Long(0);
  205. Long pblmSchPlanSameSpeedTwo = new Long(0);
  206. Long pblmEmerPlanSameExta = new Long(0);
  207. Long pblmEmerPlanSameExtaOne = new Long(0);
  208. Long pblmEmerPlanSameExtaTwo = new Long(0);
  209. Long pblmEmerPlanSameAppr = new Long(0);
  210. Long pblmEmerPlanSameApprOne = new Long(0);
  211. Long pblmEmerPlanSameApprTwo = new Long(0);
  212. Long pblmEmerPlanSameEmer = new Long(0);
  213. Long pblmEmerPlanSameEmerOne = new Long(0);
  214. Long pblmEmerPlanSameEmerTwo = new Long(0);
  215. Long pblmEmerPlanSameSpeed = new Long(0);
  216. Long pblmEmerPlanSameSpeedOne = new Long(0);
  217. Long pblmEmerPlanSameSpeedTwo = new Long(0);
  218. Long diskRunInfoOne = new Long(0);
  219. Long diskRunInfoTwo = new Long(0);
  220. Long hasSetMainFlOne = new Long(0);
  221. Long hasSetMainFlTwo = new Long(0);
  222. for (BisInspPblm bisInspPblm : pblmList) {
  223. if (StringUtils.isBlank(bisInspPblm.getInspPblmCate())) {
  224. continue;
  225. }
  226. if (StringUtils.isNotBlank(bisInspPblm.getPblmDesc())) {
  227. if ( bisInspPblm.getPblmDesc().contains("渗漏范围和渗漏量不断增大,影响运行安全)混凝土或砌石坝坝")) {
  228. diskRunInfoOne++;
  229. }
  230. if (bisInspPblm.getPblmDesc().contains("挡水建筑物存在明显变形、不稳定或有滑坡迹象")){
  231. diskRunInfoTwo++;
  232. }
  233. if (bisInspPblm.getPblmDesc().contains("岸坡及边墙失稳") || bisInspPblm.getPblmDesc().contains("(泄洪建筑物位于土坝上或采用坝下泄洪洞)岸坡及")){
  234. hasSetMainFlOne++;
  235. }
  236. if (bisInspPblm.getPblmDesc().contains("泄洪时冲刷坝体及下游坝脚")){
  237. hasSetMainFlTwo++;
  238. }
  239. }
  240. if ("1".equals(bisInspPblm.getIfCasePblm())) {
  241. this.setPblmImgInfo(dataMap,bisInspPblm,adCodeMap,allRsvr);
  242. }
  243. if (!rgstrIdList.contains(bisInspPblm.getRgstrId())) {
  244. rgstrIdList.add(bisInspPblm.getRgstrId());
  245. persSize++;
  246. }
  247. switch (bisInspPblm.getInspPblmCate()) {
  248. case "0":
  249. normal++;
  250. break;
  251. case "1":
  252. heavier++;
  253. break;
  254. case "2":
  255. serious++;
  256. break;
  257. case "3":
  258. superSerious++;
  259. break;
  260. }
  261. if (StringUtils.isBlank(bisInspPblm.getRgstrId()) || dtoMap.get(bisInspPblm.getRgstrId()) == null) { continue;}
  262. if (StringUtils.isBlank(bisInspPblm.getPblmDesc())) { continue;}
  263. //三个责任人统计
  264. if (bisInspPblm.getInspPblmName().contains(SimpleReportEnum.REVER_INFO2.getTitle())) {
  265. if ("行政责任人".equals(bisInspPblm.getCheckPoint())) {
  266. //根据问题描述来决定是哪个类别
  267. if ("无行政责任人".equals(bisInspPblm.getPblmDesc())) {
  268. boolean flag = false;
  269. List<String> rgstrIdList1 = perMap.get("wiunPer");
  270. if (rgstrIdList1 == null) {
  271. rgstrIdList1 = new ArrayList<>();
  272. rgstrIdList1.add(bisInspPblm.getRgstrId());
  273. flag =true;
  274. perMap.put("wiunPer", rgstrIdList1);
  275. } else {
  276. if (!rgstrIdList1.contains(bisInspPblm.getRgstrId())) {
  277. rgstrIdList1.add(bisInspPblm.getRgstrId());
  278. flag = true;
  279. }
  280. }
  281. if (flag) {
  282. pblmHasWiunWaoLegPers++;
  283. if ("4".equals(dtoMap.get(bisInspPblm.getRgstrId()).getEngScal())) {
  284. pblmHasWiunWaoLegPersOne++;
  285. } else if ("5".equals(dtoMap.get(bisInspPblm.getRgstrId()).getEngScal())) {
  286. pblmHasWiunWaoLegPersTwo++;
  287. }
  288. }
  289. if (StringUtils.isNotBlank(bisInspPblm.getAdFullName())) {
  290. String[] adNames = bisInspPblm.getAdFullName().split("-");
  291. if (StringUtils.isNotBlank(adNames[0])) {
  292. if (hasWiunWaoLegPersAdMap.containsKey(adNames[0])) {
  293. hasWiunWaoLegPersAdMap.put(adNames[0], hasWiunWaoLegPersAdMap.get(adNames[0]) + 1);
  294. } else {
  295. hasWiunWaoLegPersAdMap.put(adNames[0], new Long(1));
  296. }
  297. }
  298. }
  299. } else if (bisInspPblm.getPblmDesc().contains("履责情况差")) {
  300. List<String> rgstrIdList1 = perMap.get("wiunResu");
  301. boolean flag = false;
  302. if (rgstrIdList1 == null) {
  303. rgstrIdList1 = new ArrayList<>();
  304. rgstrIdList1.add(bisInspPblm.getRgstrId());
  305. flag = true;
  306. perMap.put("wiunResu", rgstrIdList1);
  307. } else {
  308. if (!rgstrIdList1.contains(bisInspPblm.getRgstrId())) {
  309. flag=true;
  310. rgstrIdList1.add(bisInspPblm.getRgstrId());
  311. }
  312. }
  313. if (flag) {
  314. pblmWiunWaoLegPersResu++;
  315. if ("4".equals(dtoMap.get(bisInspPblm.getRgstrId()).getEngScal())) {
  316. pblmWiunWaoLegPersResuOne++;
  317. } else if ("5".equals(dtoMap.get(bisInspPblm.getRgstrId()).getEngScal())) {
  318. pblmWiunWaoLegPersResuTwo++;
  319. }
  320. }
  321. } else if (bisInspPblm.getPblmDesc().contains("未参加过岗位培训")) {
  322. boolean flag = false;
  323. List<String> rgstrIdList1 = perMap.get("wiunTrain");
  324. if (rgstrIdList1 == null) {
  325. flag = true;
  326. rgstrIdList1 = new ArrayList<>();
  327. rgstrIdList1.add(bisInspPblm.getRgstrId());
  328. perMap.put("wiunTrain", rgstrIdList1);
  329. } else {
  330. if (!rgstrIdList1.contains(bisInspPblm.getRgstrId())) {
  331. flag = true;
  332. rgstrIdList1.add(bisInspPblm.getRgstrId());
  333. }
  334. }
  335. if (flag) {
  336. pblmWiunWaoLegPersTrain++;
  337. if ("4".equals(dtoMap.get(bisInspPblm.getRgstrId()).getEngScal())) {
  338. pblmWiunWaoLegPersTrainOne++;
  339. } else if ("5".equals(dtoMap.get(bisInspPblm.getRgstrId()).getEngScal())) {
  340. pblmWiunWaoLegPersTrainTwo++;
  341. }
  342. }
  343. }
  344. }
  345. else if ("技术责任人".equals(bisInspPblm.getCheckPoint())) {
  346. //根据问题描述来决定是哪个类别
  347. if ("无技术责任人".equals(bisInspPblm.getPblmDesc())){
  348. List<String> rgstrIdList1 = perMap.get("techPer");
  349. boolean flage = false;
  350. if (rgstrIdList1 == null) {
  351. rgstrIdList1 = new ArrayList<>();
  352. flage = true;
  353. rgstrIdList1.add(bisInspPblm.getRgstrId());
  354. perMap.put("techPer",rgstrIdList1);
  355. } else {
  356. if (!rgstrIdList1.contains(bisInspPblm.getRgstrId())) {
  357. rgstrIdList1.add(bisInspPblm.getRgstrId());
  358. flage = true;
  359. }
  360. }
  361. if (flage) {
  362. pblmHasTechPers++;
  363. if ("4".equals(dtoMap.get(bisInspPblm.getRgstrId()).getEngScal())) {
  364. pblmHasTechPersOne++;
  365. } else if ("5".equals(dtoMap.get(bisInspPblm.getRgstrId()).getEngScal())) {
  366. pblmHasTechPersTwo++;
  367. }
  368. }
  369. if (StringUtils.isNotBlank(bisInspPblm.getAdFullName())){
  370. String []adNames = bisInspPblm.getAdFullName().split("-");
  371. if (StringUtils.isNotBlank(adNames[0])) {
  372. if (hasTechPersAdMap.containsKey(adNames[0])) {
  373. hasTechPersAdMap.put(adNames[0], hasTechPersAdMap.get(adNames[0] + 1));
  374. } else {
  375. hasTechPersAdMap.put(adNames[0], new Long(1));
  376. }
  377. }
  378. }
  379. } else if (bisInspPblm.getPblmDesc().contains("履责情况差")) {
  380. boolean flage = false;
  381. List<String> rgstrIdList1 = perMap.get("techResu");
  382. if (rgstrIdList1 == null) {
  383. rgstrIdList1 = new ArrayList<>();
  384. rgstrIdList1.add(bisInspPblm.getRgstrId());
  385. perMap.put("techResu",rgstrIdList1);
  386. flage = true;
  387. } else {
  388. if (!rgstrIdList1.contains(bisInspPblm.getRgstrId())) {
  389. rgstrIdList1.add(bisInspPblm.getRgstrId());
  390. flage = true;
  391. }
  392. }
  393. if (flage) {
  394. pblmTechPersResu++;
  395. if ("4".equals(dtoMap.get(bisInspPblm.getRgstrId()).getEngScal())) {
  396. pblmTechPersResuOne++;
  397. } else if ("5".equals(dtoMap.get(bisInspPblm.getRgstrId()).getEngScal())) {
  398. pblmTechPersResuTwo++;
  399. }
  400. }
  401. } else if (bisInspPblm.getPblmDesc().contains("未参加过岗位培训")) {
  402. boolean flage = false;
  403. List<String> rgstrIdList1 = perMap.get("techTrain");
  404. if (rgstrIdList1 == null) {
  405. rgstrIdList1 = new ArrayList<>();
  406. flage =true;
  407. rgstrIdList1.add(bisInspPblm.getRgstrId());
  408. perMap.put("techTrain",rgstrIdList1);
  409. } else {
  410. if (!rgstrIdList1.contains(bisInspPblm.getRgstrId())) {
  411. rgstrIdList1.add(bisInspPblm.getRgstrId());
  412. flage = true;
  413. }
  414. }
  415. if (flage) {
  416. pblmTechPersResuTrain++;
  417. if ("4".equals(dtoMap.get(bisInspPblm.getRgstrId()).getEngScal())) {
  418. pblmTechPersResuTrainOne++;
  419. } else if ("5".equals(dtoMap.get(bisInspPblm.getRgstrId()).getEngScal())) {
  420. pblmTechPersResuTrainTwo++;
  421. }
  422. }
  423. }
  424. } else if ("巡查责任人".equals(bisInspPblm.getCheckPoint())) {
  425. //根据问题描述来决定是哪个类别
  426. if ("无巡查责任人".equals(bisInspPblm.getPblmDesc())){
  427. boolean flage = false;
  428. List<String> rgstrIdList1 = perMap.get("patrolPer");
  429. if (rgstrIdList1 == null) {
  430. rgstrIdList1 = new ArrayList<>();
  431. rgstrIdList1.add(bisInspPblm.getRgstrId());
  432. perMap.put("patrolPer",rgstrIdList1);
  433. flage = true;
  434. } else {
  435. if (!rgstrIdList1.contains(bisInspPblm.getRgstrId())) {
  436. rgstrIdList1.add(bisInspPblm.getRgstrId());
  437. flage = true;
  438. }
  439. }
  440. if (flage) {
  441. pblmHasPatrolPers++;
  442. if ("4".equals(dtoMap.get(bisInspPblm.getRgstrId()).getEngScal())) {
  443. pblmHasPatrolPersOne++;
  444. } else if ("5".equals(dtoMap.get(bisInspPblm.getRgstrId()).getEngScal())) {
  445. pblmHasPatrolPersTwo++;
  446. }
  447. }
  448. if (StringUtils.isNotBlank(bisInspPblm.getAdFullName())){
  449. String []adNames = bisInspPblm.getAdFullName().split("-");
  450. if (StringUtils.isNotBlank(adNames[0])) {
  451. if (hasPatrolPersAdMap.containsKey(adNames[0])) {
  452. hasPatrolPersAdMap.put(adNames[0], (hasPatrolPersAdMap.get(adNames[0]) == null ? 0 : hasPatrolPersAdMap.get(adNames[0])) + 1);
  453. } else {
  454. hasPatrolPersAdMap.put(adNames[0], new Long(1));
  455. }
  456. }
  457. }
  458. } else if (bisInspPblm.getPblmDesc().contains("履责情况差")) {
  459. boolean flage = false;
  460. List<String> rgstrIdList1 = perMap.get("patrolResu");
  461. if (rgstrIdList1 == null) {
  462. rgstrIdList1 = new ArrayList<>();
  463. rgstrIdList1.add(bisInspPblm.getRgstrId());
  464. flage = true;
  465. perMap.put("patrolResu",rgstrIdList1);
  466. } else {
  467. if (!rgstrIdList1.contains(bisInspPblm.getRgstrId())) {
  468. rgstrIdList1.add(bisInspPblm.getRgstrId());
  469. flage = true;
  470. }
  471. }
  472. if (flage) {
  473. pblmPatrolPersResu++;
  474. if ("4".equals(dtoMap.get(bisInspPblm.getRgstrId()).getEngScal())) {
  475. pblmPatrolPersResuOne++;
  476. } else if ("5".equals(dtoMap.get(bisInspPblm.getRgstrId()).getEngScal())) {
  477. pblmPatrolPersResuTwo++;
  478. }
  479. }
  480. } else if (bisInspPblm.getPblmDesc().contains("未参加过岗位培训")) {
  481. boolean flage = false;
  482. List<String> rgstrIdList1 = perMap.get("patrolTrain");
  483. if (rgstrIdList1 == null) {
  484. rgstrIdList1 = new ArrayList<>();
  485. rgstrIdList1.add(bisInspPblm.getRgstrId());
  486. perMap.put("patrolTrain",rgstrIdList1);
  487. flage =true;
  488. } else {
  489. if (!rgstrIdList1.contains(bisInspPblm.getRgstrId())) {
  490. rgstrIdList1.add(bisInspPblm.getRgstrId());
  491. flage = true;
  492. }
  493. }
  494. if (flage) {
  495. pblmPatrolPersResuTrain++;
  496. if ("4".equals(dtoMap.get(bisInspPblm.getRgstrId()).getEngScal())) {
  497. pblmPatrolPersResuTrainOne++;
  498. } else if ("5".equals(dtoMap.get(bisInspPblm.getRgstrId()).getEngScal())) {
  499. pblmPatrolPersResuTrainTwo++;
  500. }
  501. }
  502. }
  503. }
  504. }
  505. //三个重点环节统计
  506. if (bisInspPblm.getInspPblmName().contains(SimpleReportEnum.REVER_INFO3.getTitle())) {
  507. if (bisInspPblm.getCheckPoint().contains("预测预报能力")) {
  508. boolean flag = false;
  509. List<String> rgstrIdList1 = perMap.get("rainForc");
  510. if (rgstrIdList1 == null) {
  511. rgstrIdList1 = new ArrayList<>();
  512. rgstrIdList1.add(bisInspPblm.getRgstrId());
  513. perMap.put("rainForc",rgstrIdList1);
  514. flag = true;
  515. } else {
  516. if(!rgstrIdList1.contains(bisInspPblm.getRgstrId())) {
  517. rgstrIdList1.add(bisInspPblm.getRgstrId());
  518. flag = true;
  519. }
  520. }
  521. if (flag) {
  522. pblmRainForc++;
  523. if ("4".equals(dtoMap.get(bisInspPblm.getRgstrId()).getEngScal())) {
  524. pblmRainForcOne++;
  525. } else if ("5".equals(dtoMap.get(bisInspPblm.getRgstrId()).getEngScal())) {
  526. pblmRainForcTwo++;
  527. }
  528. }
  529. }else if (bisInspPblm.getCheckPoint().contains("运用方案")){
  530. //描述分类
  531. if (bisInspPblm.getPblmDesc().contains("无水库调度运用方案")) {
  532. boolean flag = false;
  533. List<String> rgstrIdList1 = perMap.get("pblmSchPlanSameExta");
  534. if (rgstrIdList1 == null) {
  535. rgstrIdList1 = new ArrayList<>();
  536. rgstrIdList1.add(bisInspPblm.getRgstrId());
  537. perMap.put("pblmSchPlanSameExta",rgstrIdList1);
  538. flag = true;
  539. } else {
  540. if(!rgstrIdList1.contains(bisInspPblm.getRgstrId())) {
  541. rgstrIdList1.add(bisInspPblm.getRgstrId());
  542. flag = true;
  543. }
  544. }
  545. if (flag) {
  546. pblmSchPlanSameExta++;
  547. if ("4".equals(dtoMap.get(bisInspPblm.getRgstrId()).getEngScal())) {
  548. pblmSchPlanSameExtaOne++;
  549. } else if ("5".equals(dtoMap.get(bisInspPblm.getRgstrId()).getEngScal())) {
  550. pblmSchPlanSameExtaTwo++;
  551. }
  552. }
  553. } else if (bisInspPblm.getPblmDesc().contains("未获得批复或未备案")) {
  554. boolean flag = false;
  555. List<String> rgstrIdList1 = perMap.get("pblmSchPlanSameAppr");
  556. if (rgstrIdList1 == null) {
  557. rgstrIdList1 = new ArrayList<>();
  558. rgstrIdList1.add(bisInspPblm.getRgstrId());
  559. perMap.put("pblmSchPlanSameAppr",rgstrIdList1);
  560. flag = true;
  561. } else {
  562. if(!rgstrIdList1.contains(bisInspPblm.getRgstrId())) {
  563. rgstrIdList1.add(bisInspPblm.getRgstrId());
  564. flag = true;
  565. }
  566. }
  567. if (flag) {
  568. pblmSchPlanSameAppr++;
  569. if ("4".equals(dtoMap.get(bisInspPblm.getRgstrId()).getEngScal())) {
  570. pblmSchPlanSameApprOne++;
  571. } else if ("5".equals(dtoMap.get(bisInspPblm.getRgstrId()).getEngScal())) {
  572. pblmSchPlanSameApprTwo++;
  573. }
  574. }
  575. } else if (bisInspPblm.getPblmDesc().contains("进行演练")) {
  576. boolean flag = false;
  577. List<String> rgstrIdList1 = perMap.get("pblmSchPlanSameEmer");
  578. if (rgstrIdList1 == null) {
  579. rgstrIdList1 = new ArrayList<>();
  580. rgstrIdList1.add(bisInspPblm.getRgstrId());
  581. perMap.put("pblmSchPlanSameEmer",rgstrIdList1);
  582. flag = true;
  583. } else {
  584. if(!rgstrIdList1.contains(bisInspPblm.getRgstrId())) {
  585. rgstrIdList1.add(bisInspPblm.getRgstrId());
  586. flag = true;
  587. }
  588. }
  589. if (flag) {
  590. pblmSchPlanSameEmer++;
  591. if ("4".equals(dtoMap.get(bisInspPblm.getRgstrId()).getEngScal())) {
  592. pblmSchPlanSameEmerOne++;
  593. } else if ("5".equals(dtoMap.get(bisInspPblm.getRgstrId()).getEngScal())) {
  594. pblmSchPlanSameEmerTwo++;
  595. }
  596. }
  597. } else if (bisInspPblm.getPblmDesc().contains("可操作性")) {
  598. boolean flag = false;
  599. List<String> rgstrIdList1 = perMap.get("pblmSchPlanSameSpeed");
  600. if (rgstrIdList1 == null) {
  601. rgstrIdList1 = new ArrayList<>();
  602. rgstrIdList1.add(bisInspPblm.getRgstrId());
  603. perMap.put("pblmSchPlanSameSpeed",rgstrIdList1);
  604. flag = true;
  605. } else {
  606. if(!rgstrIdList1.contains(bisInspPblm.getRgstrId())) {
  607. rgstrIdList1.add(bisInspPblm.getRgstrId());
  608. flag = true;
  609. }
  610. }
  611. if (flag) {
  612. pblmSchPlanSameSpeed++;
  613. if ("4".equals(dtoMap.get(bisInspPblm.getRgstrId()).getEngScal())) {
  614. pblmSchPlanSameSpeedOne++;
  615. } else if ("5".equals(dtoMap.get(bisInspPblm.getRgstrId()).getEngScal())) {
  616. pblmSchPlanSameSpeedTwo++;
  617. }
  618. }
  619. }
  620. } else if (bisInspPblm.getCheckPoint().contains("应急预案")) {
  621. if (bisInspPblm.getPblmDesc().contains("无安全")) {
  622. boolean flag = false;
  623. List<String> rgstrIdList1 = perMap.get("pblmEmerPlanSameExta");
  624. if (rgstrIdList1 == null) {
  625. rgstrIdList1 = new ArrayList<>();
  626. rgstrIdList1.add(bisInspPblm.getRgstrId());
  627. perMap.put("pblmEmerPlanSameExta",rgstrIdList1);
  628. flag = true;
  629. } else {
  630. if(!rgstrIdList1.contains(bisInspPblm.getRgstrId())) {
  631. rgstrIdList1.add(bisInspPblm.getRgstrId());
  632. flag = true;
  633. }
  634. }
  635. if (flag) {
  636. pblmEmerPlanSameExta++;
  637. if ("4".equals(dtoMap.get(bisInspPblm.getRgstrId()).getEngScal())) {
  638. pblmEmerPlanSameExtaOne++;
  639. } else if ("5".equals(dtoMap.get(bisInspPblm.getRgstrId()).getEngScal())) {
  640. pblmEmerPlanSameExtaTwo++;
  641. }
  642. }
  643. } else if (bisInspPblm.getPblmDesc().contains("未获得批复或未备案")) {
  644. boolean flag = false;
  645. List<String> rgstrIdList1 = perMap.get("pblmEmerPlanSameAppr");
  646. if (rgstrIdList1 == null) {
  647. rgstrIdList1 = new ArrayList<>();
  648. rgstrIdList1.add(bisInspPblm.getRgstrId());
  649. perMap.put("pblmEmerPlanSameAppr",rgstrIdList1);
  650. flag = true;
  651. } else {
  652. if(!rgstrIdList1.contains(bisInspPblm.getRgstrId())) {
  653. rgstrIdList1.add(bisInspPblm.getRgstrId());
  654. flag = true;
  655. }
  656. }
  657. if (flag) {
  658. pblmEmerPlanSameAppr++;
  659. if ("4".equals(dtoMap.get(bisInspPblm.getRgstrId()).getEngScal())) {
  660. pblmEmerPlanSameApprOne++;
  661. } else if ("5".equals(dtoMap.get(bisInspPblm.getRgstrId()).getEngScal())) {
  662. pblmEmerPlanSameApprTwo++;
  663. }
  664. }
  665. } else if (bisInspPblm.getPblmDesc().contains("未进行演练")) {
  666. boolean flag = false;
  667. List<String> rgstrIdList1 = perMap.get("pblmEmerPlanSameEmer");
  668. if (rgstrIdList1 == null) {
  669. flag = true;
  670. rgstrIdList1 = new ArrayList<>();
  671. rgstrIdList1.add(bisInspPblm.getRgstrId());
  672. perMap.put("pblmEmerPlanSameEmer",rgstrIdList1);
  673. } else {
  674. if(!rgstrIdList1.contains(bisInspPblm.getRgstrId())) {
  675. rgstrIdList1.add(bisInspPblm.getRgstrId());
  676. flag = true;
  677. }
  678. }
  679. if (flag) {
  680. pblmEmerPlanSameEmer++;
  681. if ("4".equals(dtoMap.get(bisInspPblm.getRgstrId()).getEngScal())) {
  682. pblmEmerPlanSameEmerOne++;
  683. } else if ("5".equals(dtoMap.get(bisInspPblm.getRgstrId()).getEngScal())) {
  684. pblmEmerPlanSameEmerTwo++;
  685. }
  686. }
  687. } else if (bisInspPblm.getPblmDesc().contains("可操作性")) {
  688. boolean flag = false;
  689. List<String> rgstrIdList1 = perMap.get("pblmEmerPlanSameSpeed");
  690. if (rgstrIdList1 == null) {
  691. rgstrIdList1 = new ArrayList<>();
  692. rgstrIdList1.add(bisInspPblm.getRgstrId());
  693. flag = true;
  694. perMap.put("pblmEmerPlanSameSpeed",rgstrIdList1);
  695. } else {
  696. if(!rgstrIdList1.contains(bisInspPblm.getRgstrId())) {
  697. rgstrIdList1.add(bisInspPblm.getRgstrId());
  698. flag = true;
  699. }
  700. }
  701. if (flag) {
  702. pblmEmerPlanSameSpeed++;
  703. if ("4".equals(dtoMap.get(bisInspPblm.getRgstrId()).getEngScal())) {
  704. pblmEmerPlanSameSpeedOne++;
  705. } else if ("5".equals(dtoMap.get(bisInspPblm.getRgstrId()).getEngScal())) {
  706. pblmEmerPlanSameSpeedTwo++;
  707. }
  708. }
  709. }
  710. }
  711. }
  712. }
  713. dataMap.put("normal",normal);
  714. dataMap.put("heavier",heavier);
  715. dataMap.put("serious",serious);
  716. dataMap.put("superSerious",superSerious);
  717. dataMap.put("adCodeSize",adCodeMap.keySet().size());
  718. dataMap.put("adCodeRsvr",allRsvr);
  719. List<Map<String,Object>> adList = new LinkedList<>();
  720. for (String key : adCodeMap.keySet()) {
  721. Map<String,Object> map = new HashedMap();
  722. map.put("adName",key);
  723. map.put("rsvrSize",adCodeMap.get(key).size());
  724. adList.add(map);
  725. }
  726. dataMap.put("adList",adList);
  727. dataMap.put("pblmHasWiunWaoLegPers",pblmHasWiunWaoLegPers);
  728. dataMap.put("pblmHasWiunWaoLegPersOne",pblmHasWiunWaoLegPersOne);
  729. dataMap.put("pblmHasWiunWaoLegPersTwo",pblmHasWiunWaoLegPersTwo);
  730. dataMap.put("pblmHasWiunWaoLegPersPer",pblmHasWiunWaoLegPers == 0?0:pblmHasWiunWaoLegPers * 100 / persSize);
  731. dataMap.put("pblmWiunWaoLegPersResu",pblmWiunWaoLegPersResu);
  732. dataMap.put("pblmWiunWaoLegPersResuOne",pblmWiunWaoLegPersResuOne);
  733. dataMap.put("pblmWiunWaoLegPersResuTwo",pblmWiunWaoLegPersResuTwo);
  734. dataMap.put("pblmWiunWaoLegPersResuPer",pblmWiunWaoLegPersResu == 0?0:pblmWiunWaoLegPersResu * 100 / persSize);
  735. dataMap.put("pblmWiunWaoLegPersTrain",pblmWiunWaoLegPersTrain);
  736. dataMap.put("pblmWiunWaoLegPersTrainOne",pblmWiunWaoLegPersTrainOne);
  737. dataMap.put("pblmWiunWaoLegPersTrainTwo",pblmWiunWaoLegPersTrainTwo);
  738. dataMap.put("pblmWiunWaoLegPersTrainPer",pblmWiunWaoLegPersTrain == 0?0:pblmWiunWaoLegPersTrain * 100 / persSize);
  739. dataMap.put("pblmHasTechPers",pblmHasTechPers);
  740. dataMap.put("pblmHasTechPersOne",pblmHasTechPersOne);
  741. dataMap.put("pblmHasTechPersTwo",pblmHasTechPersTwo);
  742. dataMap.put("pblmHasTechPersPer",pblmHasTechPers == 0?0:pblmHasTechPers * 100 / persSize);
  743. dataMap.put("pblmTechPersResu",pblmTechPersResu);
  744. dataMap.put("pblmTechPersResuOne",pblmTechPersResuOne);
  745. dataMap.put("pblmTechPersResuTwo",pblmTechPersResuTwo);
  746. dataMap.put("pblmTechPersResuPer",pblmTechPersResu == 0?0:pblmTechPersResu * 100 / persSize);
  747. dataMap.put("pblmTechPersResuTrain",pblmTechPersResuTrain);
  748. dataMap.put("pblmTechPersResuTrainOne",pblmTechPersResuTrainOne);
  749. dataMap.put("pblmTechPersResuTrainTwo",pblmTechPersResuTrainTwo);
  750. dataMap.put("pblmTechPersResuTrainPer",pblmTechPersResuTrain == 0?0:pblmTechPersResuTrain * 100 / persSize);
  751. dataMap.put("pblmHasPatrolPers",pblmHasPatrolPers);
  752. dataMap.put("pblmHasPatrolPersOne",pblmHasPatrolPersOne);
  753. dataMap.put("pblmHasPatrolPersTwo",pblmHasPatrolPersTwo);
  754. dataMap.put("pblmHasPatrolPersPer",pblmHasPatrolPers == 0?0:pblmHasPatrolPers * 100 / persSize);
  755. dataMap.put("pblmPatrolPersResu",pblmPatrolPersResu);
  756. dataMap.put("pblmPatrolPersResuOne",pblmPatrolPersResuOne);
  757. dataMap.put("pblmPatrolPersResuTwo",pblmPatrolPersResuTwo);
  758. dataMap.put("pblmPatrolPersResuPer",pblmPatrolPersResu == 0?0:pblmPatrolPersResu * 100 / persSize);
  759. dataMap.put("pblmPatrolPersResuTrain",pblmPatrolPersResuTrain);
  760. dataMap.put("pblmPatrolPersResuTrainOne",pblmPatrolPersResuTrainOne);
  761. dataMap.put("pblmPatrolPersResuTrainTwo",pblmPatrolPersResuTrainTwo);
  762. dataMap.put("pblmPatrolPersResuTrainPer",pblmPatrolPersResuTrain == 0?0:pblmPatrolPersResuTrain * 100 / persSize);
  763. //区域列表
  764. List<Map<String,Object>> wiunAdList = new LinkedList<>();
  765. for (String key : hasWiunWaoLegPersAdMap.keySet()) {
  766. Map<String,Object> map = new HashedMap();
  767. map.put("adName",key);
  768. map.put("rsvrSize",hasWiunWaoLegPersAdMap.get(key) == null ? 0 :hasWiunWaoLegPersAdMap.get(key) );
  769. wiunAdList.add(map);
  770. }
  771. dataMap.put("wiunAdList",wiunAdList);
  772. List<Map<String,Object>> techAdList = new LinkedList<>();
  773. for (String key : hasTechPersAdMap.keySet()) {
  774. Map<String,Object> map = new HashedMap();
  775. map.put("adName",key);
  776. map.put("rsvrSize",hasTechPersAdMap.get(key) ==null?0:hasTechPersAdMap.get(key));
  777. techAdList.add(map);
  778. }
  779. dataMap.put("techAdList",techAdList);
  780. List<Map<String,Object>> patrolAdList = new LinkedList<>();
  781. for (String key : hasPatrolPersAdMap.keySet()) {
  782. Map<String,Object> map = new HashedMap();
  783. map.put("adName",key);
  784. map.put("rsvrSize",hasPatrolPersAdMap.get(key) == null?0 : hasPatrolPersAdMap.get(key));
  785. patrolAdList.add(map);
  786. }
  787. dataMap.put("patrolAdList",patrolAdList);
  788. dataMap.put("pblmRainForc",pblmRainForc);
  789. dataMap.put("pblmRainForcOne",pblmRainForcOne);
  790. dataMap.put("pblmRainForcTwo",pblmRainForcTwo);
  791. dataMap.put("pblmRainForcPer",pblmRainForc == 0?0:pblmRainForc*100/persSize);
  792. dataMap.put("pblmSchPlanSameExta",pblmSchPlanSameExta);
  793. dataMap.put("pblmSchPlanSameExtaOne",pblmSchPlanSameExtaOne);
  794. dataMap.put("pblmSchPlanSameExtaTwo",pblmSchPlanSameExtaTwo);
  795. dataMap.put("pblmSchPlanSameExtaPer",pblmSchPlanSameExta == 0?0:pblmSchPlanSameExta*100/persSize);
  796. dataMap.put("pblmSchPlanSameAppr",pblmSchPlanSameAppr);
  797. dataMap.put("pblmSchPlanSameApprOne",pblmSchPlanSameApprOne);
  798. dataMap.put("pblmSchPlanSameApprTwo",pblmSchPlanSameApprTwo);
  799. dataMap.put("pblmSchPlanSameApprPer",pblmSchPlanSameAppr == 0?0:pblmSchPlanSameAppr*100/persSize);
  800. dataMap.put("pblmSchPlanSameEmer",pblmSchPlanSameEmer);
  801. dataMap.put("pblmSchPlanSameEmerOne",pblmSchPlanSameEmerOne);
  802. dataMap.put("pblmSchPlanSameEmerTwo",pblmSchPlanSameEmerTwo);
  803. dataMap.put("pblmSchPlanSameEmerPer",pblmSchPlanSameEmer == 0?0:pblmSchPlanSameEmer*100/persSize);
  804. dataMap.put("pblmSchPlanSameSpeed",pblmSchPlanSameSpeed);
  805. dataMap.put("pblmSchPlanSameSpeedOne",pblmSchPlanSameSpeedOne);
  806. dataMap.put("pblmSchPlanSameSpeedTwo",pblmSchPlanSameSpeedTwo);
  807. dataMap.put("pblmSchPlanSameSpeedPer",pblmSchPlanSameSpeed == 0?0:pblmSchPlanSameSpeed*100/persSize);
  808. dataMap.put("pblmEmerPlanSameExta",pblmEmerPlanSameExta);
  809. dataMap.put("pblmEmerPlanSameExtaOne",pblmEmerPlanSameExtaOne);
  810. dataMap.put("pblmEmerPlanSameExtaTwo",pblmEmerPlanSameExtaTwo);
  811. dataMap.put("pblmEmerPlanSameExtaPer",pblmEmerPlanSameExta == 0?0:pblmEmerPlanSameExta*100/persSize);
  812. dataMap.put("pblmEmerPlanSameAppr",pblmEmerPlanSameAppr);
  813. dataMap.put("pblmEmerPlanSameApprOne",pblmEmerPlanSameApprOne);
  814. dataMap.put("pblmEmerPlanSameApprTwo",pblmEmerPlanSameApprTwo);
  815. dataMap.put("pblmEmerPlanSameApprPer",pblmEmerPlanSameAppr == 0?0:pblmEmerPlanSameAppr*100/persSize);
  816. dataMap.put("pblmEmerPlanSameEmer",pblmEmerPlanSameEmer);
  817. dataMap.put("pblmEmerPlanSameEmerOne",pblmEmerPlanSameEmerOne);
  818. dataMap.put("pblmEmerPlanSameEmerTwo",pblmEmerPlanSameEmerTwo);
  819. dataMap.put("pblmEmerPlanSameEmerPer",pblmEmerPlanSameEmer == 0?0:pblmEmerPlanSameEmer*100/persSize);
  820. dataMap.put("pblmEmerPlanSameSpeed",pblmEmerPlanSameSpeed);
  821. dataMap.put("pblmEmerPlanSameSpeedOne",pblmEmerPlanSameSpeedOne);
  822. dataMap.put("pblmEmerPlanSameSpeedTwo",pblmEmerPlanSameSpeedTwo);
  823. dataMap.put("pblmEmerPlanSameSpeedPer",pblmEmerPlanSameSpeed == 0?0:pblmEmerPlanSameSpeed*100/persSize);
  824. dataMap.put("diskRunInfoOne",diskRunInfoOne);
  825. dataMap.put("diskRunInfoTwo",diskRunInfoTwo);
  826. dataMap.put("hasSetMainFlOne",hasSetMainFlOne);
  827. dataMap.put("hasSetMainFlTwo",hasSetMainFlTwo);
  828. dataMap.put("diskRunInfoOnePer",diskRunInfoOne == 0?0:diskRunInfoOne/Long.valueOf(dataMap.get("rsvrSize").toString()));
  829. dataMap.put("diskRunInfoTwoPer",diskRunInfoTwo == 0?0:diskRunInfoTwo/Long.valueOf(dataMap.get("rsvrSize").toString()));
  830. dataMap.put("hasSetMainFlOnePer",hasSetMainFlOne == 0?0:hasSetMainFlOne/Long.valueOf(dataMap.get("rsvrSize").toString()));
  831. dataMap.put("hasSetMainFlTwoPer",hasSetMainFlTwo == 0?0:hasSetMainFlTwo/Long.valueOf(dataMap.get("rsvrSize").toString()));
  832. if (!dataMap.containsKey("SK_ZeRenRen")) {
  833. dataMap.put("SK_ZeRenRen", new ArrayList<>());
  834. }
  835. if (!dataMap.containsKey("SK_ZhongDianHuanJie")) {
  836. dataMap.put("SK_ZhongDianHuanJie", new ArrayList<>());
  837. }
  838. if (!dataMap.containsKey("SK_YunXingGuanLi")) {
  839. dataMap.put("SK_YunXingGuanLi", new ArrayList<>());
  840. }
  841. if (!dataMap.containsKey("SK_AnQuanJianDing")) {
  842. dataMap.put("SK_AnQuanJianDing", new ArrayList<>());
  843. }
  844. if (!dataMap.containsKey("SK_GongChengShiTi")) {
  845. dataMap.put("SK_GongChengShiTi", new ArrayList<>());
  846. }
  847. if (!dataMap.containsKey("SK_SheBeiSheShi")) {
  848. dataMap.put("SK_SheBeiSheShi", new ArrayList<>());
  849. }
  850. }
  851. private void setPblmImgInfo(Map<String, Object> dataMap, BisInspPblm bisInspPblm,Map<String,List<String>> adCodeMap, Long allRsvr) {
  852. //是否包含在六个枚举中
  853. String key = null;
  854. if (bisInspPblm.getInspPblmName().contains(SimpleReportEnum.REVER_INFO2.getTitle())) {
  855. key = SimpleReportEnum.REVER_INFO2.getValue();
  856. } else if (bisInspPblm.getInspPblmName().contains(SimpleReportEnum.REVER_INFO3.getTitle())){
  857. key = SimpleReportEnum.REVER_INFO3.getValue();
  858. } else if (SimpleReportEnum.REVER_INFO5.getTitle().equals(bisInspPblm.getInspPblmName())) {
  859. //运行管理,安全鉴定
  860. if ("安全鉴定".equals(bisInspPblm.getCheckPoint())) {
  861. key = "SK_AnQuanJianDing";
  862. } else {
  863. key = SimpleReportEnum.REVER_INFO5.getValue();
  864. }
  865. } else if (SimpleReportEnum.REVER_INFO1.getTitle().equals(bisInspPblm.getInspPblmName())) {
  866. key = SimpleReportEnum.REVER_INFO5.getValue();
  867. } else if (SimpleReportEnum.REVER_INFO6.getTitle().equals(bisInspPblm.getInspPblmName())) {
  868. if ("除险加固".equals(bisInspPblm.getCheckPoint())) {
  869. key = "SK_AnQuanJianDing";
  870. } else {
  871. key = SimpleReportEnum.REVER_INFO6.getValue();
  872. }
  873. } else if (SimpleReportEnum.REVER_INFO7.getTitle().equals(bisInspPblm.getInspPblmName())) {
  874. if ("金结机电设备".equals(bisInspPblm.getCheckPoint())){
  875. key = SimpleReportEnum.REVER_INFO7.getValue();
  876. }
  877. }
  878. if (key == null) {
  879. return;
  880. }
  881. List list = null;
  882. if (dataMap.containsKey(key)) {
  883. list = (List) dataMap.get(key);
  884. } else {
  885. list = new LinkedList();
  886. }
  887. HashMap<String, Object> itemMap = new HashMap<>(2);
  888. itemMap.put("index",list.size() + 1);
  889. itemMap.put("rsvrNm",bisInspPblm.getRsName());
  890. if (StringUtils.isNotBlank(bisInspPblm.getAdFullName())) {
  891. String []adNames = bisInspPblm.getAdFullName().split("-");
  892. itemMap.put("pro",(adNames != null && adNames.length > 0 )? adNames[0] : "xx");
  893. itemMap.put("city",(adNames != null && adNames.length > 1 )? adNames[1] : "xx");
  894. itemMap.put("country",(adNames != null && adNames.length > 2 )? adNames[2] : "xx");
  895. if (adCodeMap.containsKey(adNames[0])) {
  896. List<String> rgstrList = adCodeMap.get(adNames[0]);
  897. if (!rgstrList.contains(bisInspPblm.getRgstrId())) {
  898. rgstrList.add(bisInspPblm.getRgstrId());
  899. allRsvr++;
  900. }
  901. } else {
  902. allRsvr++;
  903. List<String> rgstrList = new ArrayList<>();
  904. rgstrList.add(bisInspPblm.getRgstrId());
  905. adCodeMap.put(adNames[0],rgstrList);
  906. }
  907. }
  908. itemMap.put("inspPblmDesc",bisInspPblm.getInspPblmDesc());
  909. // 获取图片列表
  910. List<GwComFile> gwFiles = gwComFileService.findFileByBiz(bisInspPblm.getPblmId());
  911. itemMap.put("imgs", new LinkedList<HashMap<String, String>>() {{
  912. Optional.ofNullable(gwFiles).orElse(new ArrayList<GwComFile>() {{
  913. add(new GwComFile());
  914. }}).forEach(y -> {
  915. add(new HashMap<String, String>(2) {{
  916. String href = imgPathPrefix.replace("/upload", "") + y.getFilePath() + ".jpg";
  917. logger.debug("图片路径:" + href);
  918. put("href", getImageString(href));
  919. put("desc", y.getAbs() == null ? "图片描述" + y.getFilePath() : y.getAbs());
  920. put("name", y.getFilePath());
  921. put("src", y.getFilePath());
  922. }});
  923. });
  924. }});
  925. list.add(itemMap);
  926. dataMap.put(key,list);
  927. }
  928. /**
  929. * 设置组信息,返回组id
  930. * @param dataMap
  931. * @param persId
  932. * @param currentOrgId
  933. * @return
  934. */
  935. private String setGroupInfo(Map<String, Object> dataMap, String persId, String month, String currentOrgId) {
  936. String[] date = month.split("-");
  937. List<BisInspStatGroupInfoDto> bisInspStatGroupInfoDtoList = bisInspStatDao.getGroupInfo("001",persId,date[0], date[1],currentOrgId);
  938. int groupSize = bisInspStatGroupInfoDtoList.size();
  939. String id = bisInspStatGroupInfoDtoList.stream().map(x -> x.getId()).collect(Collectors.joining(","));
  940. Integer perSize = 0;
  941. if (StringUtils.isNotBlank(id)) {
  942. perSize = bisInspStatDao.getPersonCount(InspUtils.setOrgIds(id));
  943. }
  944. dataMap.put("groupSize",groupSize);
  945. dataMap.put("perSize", perSize);
  946. dataMap.put("month", Integer.valueOf(date[1]).toString());
  947. return id;
  948. }
  949. private String setRgstrInfo(String id,Map<String, Object> dataMap, String persId, String currentOrgId, Map<String,BisInspStatRsvrInfoDto> dtoMap) {
  950. //查询列表
  951. List<BisInspStatRsvrInfoDto> list = new ArrayList<>();
  952. if (StringUtils.isNotBlank(id)) {
  953. list = bisInspStatDao.getRsvrInfoList(InspUtils.setOrgIds(id));
  954. }
  955. String rgstrId = null;//上一个rgstrId,排除重复值
  956. //水库数量
  957. Long rsvrSize = new Long(0);
  958. Long rsvrSizeLitOne = new Long(0);//小一
  959. Long rsveSizeLitTwo = new Long(0);//小二
  960. List<String> proList = new ArrayList<>();//省
  961. List<String> cityList = new ArrayList<>();//市
  962. List<String> countryList = new ArrayList<>();//县
  963. List<String> countryPertList = new ArrayList<>();//贫困县
  964. //水库发挥效益
  965. Long benefitsSize = new Long(0);//发挥效益水库数量
  966. Long ifEffective = new Long(0);//是否发挥效益
  967. Long ifEffectiveNo = new Long(0);
  968. Double wsfdws = new Double(0);//发挥效益的饮用水源供水量
  969. Double areaIrr = new Double(0);
  970. //运行管理
  971. Long mngrnSize = new Long(0);//运行管理水库数量
  972. Long safeCommentPerfect = new Long(0);//安全总体评价1正常安全运行
  973. Long safeCommentGood = new Long(0);
  974. Long safeCommentBad = new Long(0);
  975. Long ifFsltdzRun = new Long(0);
  976. Long ifFsltdzRunNo = new Long(0);
  977. Long ifFsltdzNoOne = new Long(0);
  978. Long ifFsltdzNoTwo = new Long(0);
  979. Long hasWdEmnic = new Long(0);//需要无经费来源
  980. Long ifManageRegRel = new Long(0);
  981. Long ifManageRegRelNo = new Long(0);
  982. Long ifManageReg = new Long(0);//需错误注册信息
  983. Long ifDamWarnLogo = new Long(0);
  984. Long ifDamWarnLogoNo = new Long(0);
  985. //三个责任人
  986. Long dutySize = new Long(0);//三个责任人水库数量
  987. //行政责任人
  988. Long hasWiunWaoLegPers = new Long(0);
  989. Map<String,List<String>> hasWiunWaoLegPersMap = new HashedMap();
  990. Long hasWiunWaoLegPersNo = new Long(0);
  991. Long hasWiunWaoLegPersNoOne = new Long(0);
  992. Long hasWiunWaoLegPersNoTwo = new Long(0);
  993. Long wiunWaoLegPersResuPerfect = new Long(0);
  994. Long wiunWaoLegPersResuGood = new Long(0);
  995. Long wiunWaoLegPersResuBad = new Long(0);
  996. Long wiunWaoLegPersResuBadOne = new Long(0);
  997. Long wiunWaoLegPersResuBadTwo = new Long(0);
  998. Long wiunWaoLegPersTrain = new Long(0);
  999. Long wiunWaoLegPersTrainNo = new Long(0);
  1000. Long wiunWaoLegPersTrainNoOne = new Long(0);
  1001. Long wiunWaoLegPersTrainNoTwo = new Long(0);
  1002. //技术责任人
  1003. Long hasTechPers = new Long(0);
  1004. Long hasTechPersNo = new Long(0);
  1005. Long techPersResuPerfect = new Long(0);
  1006. Long techPersResuGood = new Long(0);
  1007. Long techPersResuBad = new Long(0);
  1008. Long techPersTrain = new Long(0);
  1009. Long techPersTrainNo = new Long(0);
  1010. //巡查责任人
  1011. Long hasPatrolPers = new Long(0);
  1012. Long patrolPersResuPerfect = new Long(0);
  1013. Long patrolPersResuGood = new Long(0);
  1014. Long patrolPersResuBad = new Long(0);
  1015. Long patrolPersTrain = new Long(0);
  1016. Long patrolPersTrainNo = new Long(0);
  1017. Long hasAttendTrain = new Long(0);
  1018. /*** **/
  1019. //三个重点
  1020. Long thrqSize = new Long(0);
  1021. Long rainForc = new Long(0);
  1022. Long rainForcNo = new Long(0);
  1023. Long rainForcNote = new Long(0);
  1024. Long rainForcNoteNo = new Long(0);
  1025. //调度运用方案
  1026. Long schPlanSameExta = new Long(0);
  1027. Long schPlanSameExtaNo = new Long(0);
  1028. Long schPlanSameAppr = new Long(0);
  1029. Long schPlanSameApprNo = new Long(0);
  1030. Long schPlanSameSpeedPerfect = new Long(0);
  1031. Long schPlanSameSpeedGood = new Long(0);
  1032. Long schPlanSameSpeedBad = new Long(0);
  1033. //安全应急预案
  1034. Long emerPlanSameExta = new Long(0);
  1035. Long emerPlanSameExtaNo = new Long(0);
  1036. Long emerPlanSameAppr = new Long(0);
  1037. Long emerPlanSameApprNo = new Long(0);
  1038. Long emerPlanSameEme = new Long(0);
  1039. Long emerPlanSameEmeNo = new Long(0);
  1040. Long emerPlanSameSpeedPerfect = new Long(0);
  1041. Long emerPlanSameSpeedGood = new Long(0);
  1042. Long emerPlanSameSpeedBad = new Long(0);
  1043. /**** **/
  1044. //工程实体
  1045. Long proSize = new Long(0);
  1046. //挡水建筑物运行状况
  1047. Long diskRunInfoPerfect = new Long(0);
  1048. Long diskRunInfoGood = new Long(0);
  1049. Long diskRunInfoBad = new Long(0);
  1050. //泄洪建筑物
  1051. Long hasSetMainFl = new Long(0);
  1052. Long isMainFlNormalPerfect = new Long(0);
  1053. Long isMainFlNormalGood = new Long(0);
  1054. Long isMainFlNormalBad = new Long(0);
  1055. //放水建筑物
  1056. Long hasSetPourFl = new Long(0);
  1057. Long pourFyIsNormalPerfect = new Long(0);
  1058. Long pourFyIsNormalGood = new Long(0);
  1059. Long pourFyIsNormalBad = new Long(0);
  1060. //安全鉴定
  1061. Long ifDamSafeReq = new Long(0);
  1062. Long ifDamSafeReqNo = new Long(0);
  1063. Long ifDamSafe = new Long(0); //未开展水库数量,其他水库
  1064. Long notReinForce = new Long(0);
  1065. Long ifDamSafeRul = new Long(0);
  1066. Long ifDamSafeRulNo = new Long(0);
  1067. Long ifDamSafeDepRul = new Long(0);
  1068. Long ifDamSafeDepRulNo = new Long(0);
  1069. Long ifDamSafeThr = new Long(0);
  1070. Long ifReinForceOne = new Long(0);//已实施除险加固
  1071. Long reinForceRunPerfect = new Long(0);
  1072. Long reinForceRunGood = new Long(0);
  1073. Long reinForceRunBad = new Long(0);
  1074. Long reinForceRun3 = new Long(0);
  1075. Long reinForceRun3No = new Long(0);
  1076. Long ifReinForceTwo = new Long(0);//正在进行除险加固
  1077. Long ifReinImpGve = new Long(0);
  1078. Long ifReinImpGveNo = new Long(0);
  1079. Long ifReinImpGveOne = new Long(0);
  1080. Long ifReinImpGveOneNo = new Long(0);
  1081. Long ifReinImpPlan = new Long(0);
  1082. Long ifReinImpPlanNo = new Long(0);
  1083. StringBuilder sb = new StringBuilder("");
  1084. if (list != null && !list.isEmpty()) {
  1085. sb.append("and t.regid in (");
  1086. }
  1087. //开始轮询登记表信息
  1088. for (BisInspStatRsvrInfoDto dto : list) {
  1089. if (dto.getRgstrId().equals(rgstrId)) {
  1090. //过滤重复数据
  1091. continue;
  1092. }
  1093. rgstrId = dto.getRgstrId();
  1094. dtoMap.put(rgstrId,dto);
  1095. //水库基本信息
  1096. rsvrSize++;
  1097. if (rsvrSize % 1000 == 0) {
  1098. sb.delete(sb.length() -1,sb.length()).append(" ) or t.regid in (");
  1099. } else {
  1100. sb.append("'").append(rgstrId).append("'").append(",");
  1101. }
  1102. if ("4".equals(dto.getEngScal())) {
  1103. rsvrSizeLitOne++;
  1104. } else if ("5".equals(dto.getEngScal())) {
  1105. rsveSizeLitTwo++;
  1106. }
  1107. if (StringUtils.isNotBlank(dto.getAdCode())) {
  1108. String proCode = dto.getAdCode().substring(0,2);
  1109. if (!proList.contains(proCode)) {
  1110. proList.add(proCode);
  1111. }
  1112. String cityCode = dto.getAdCode().substring(0,4);
  1113. if (!cityList.contains(cityCode)) {
  1114. cityList.add(cityCode);
  1115. }
  1116. String countrCode = dto.getAdCode().substring(0,6);
  1117. if (!countryList.contains(countrCode)) {
  1118. countryList.add(countrCode);
  1119. }
  1120. if ("1".equals(dto.getIsPoveryt())) {
  1121. if (!countryPertList.contains(countrCode)) {
  1122. countryPertList.add(cityCode);
  1123. }
  1124. }
  1125. }
  1126. //水库发挥效益
  1127. if (StringUtils.isNotBlank(dto.getBenefitsId())) {
  1128. benefitsSize++;
  1129. if (dto.getWsfdws() != null) {
  1130. wsfdws = wsfdws + dto.getWsfdws();
  1131. }
  1132. if (StringUtils.isNotBlank(dto.getAreaIrr())) {
  1133. areaIrr += Double.valueOf(dto.getAreaIrr());
  1134. }
  1135. if (StringUtils.isNotBlank(dto.getIfEffective())) {
  1136. Map<String,Long> map = this.setCommonInfo(dto.getIfEffective(),ifEffective,ifEffectiveNo,null);
  1137. ifEffective = map.get("1");
  1138. ifEffectiveNo = map.get("2");
  1139. }
  1140. }
  1141. //运行管理
  1142. if (StringUtils.isNotBlank(dto.getMngrnId())) {
  1143. mngrnSize++;
  1144. Map<String,Long> map = null;
  1145. map = this.setCommonInfo(dto.getSafeComment(),safeCommentPerfect,safeCommentGood,safeCommentBad);
  1146. safeCommentPerfect = map==null? safeCommentPerfect: map.get("1");
  1147. safeCommentGood = map==null?safeCommentGood: map.get("2");
  1148. safeCommentBad = map==null?safeCommentBad: map.get("3");
  1149. map = this.setCommonInfo(dto.getIfFsltdzRun(),ifFsltdzRun,ifFsltdzRunNo,null);
  1150. ifFsltdzRun = map==null?ifFsltdzRun:map.get("1");
  1151. ifFsltdzRunNo = map==null?ifFsltdzRunNo:map.get("2");
  1152. map = this.setCommonInfo(dto.getIfFsltdzNo(),ifFsltdzNoOne,ifFsltdzNoTwo,null);
  1153. ifFsltdzNoOne = map==null?ifFsltdzNoOne: map.get("1");
  1154. ifFsltdzNoTwo = map==null?ifFsltdzNoTwo:map.get("2");
  1155. map = this.setCommonInfo(dto.getHasWdEmnic(),null,hasWdEmnic,null);
  1156. hasWdEmnic =map==null?hasWdEmnic: map.get("2");
  1157. map = this.setCommonInfo(dto.getIfManageRegRel(),null,ifManageReg,null);
  1158. ifManageReg = map==null?ifManageReg:map.get("2");
  1159. map = this.setCommonInfo(dto.getIfManageReg(),ifManageRegRel,ifManageRegRelNo,null);
  1160. ifManageRegRel = map==null?ifManageRegRel:map.get("1");
  1161. ifManageRegRelNo = map==null?ifManageRegRelNo:map.get("2");
  1162. map = this.setCommonInfo(dto.getIfDamWarnLogo(),ifDamWarnLogo,ifDamWarnLogoNo,null);
  1163. ifDamWarnLogo = map==null?ifDamWarnLogo:map.get("1");
  1164. ifDamWarnLogoNo = map==null?ifDamWarnLogoNo:map.get("2");
  1165. }
  1166. //三个责任人
  1167. if (StringUtils.isNotBlank(dto.getDutyId())) {
  1168. dutySize++;
  1169. Map<String,Long> map = null;
  1170. map = this.setCommonInfo(dto.getHasWiunWaoLegPers(),hasWiunWaoLegPers,hasWiunWaoLegPersNo,null);
  1171. hasWiunWaoLegPers = map==null?hasWiunWaoLegPers:map.get("1");
  1172. hasWiunWaoLegPersNo = map==null?hasWiunWaoLegPersNo:map.get("2");
  1173. if ("2".equals(dto.getHasWiunWaoLegPers())) {
  1174. //区域
  1175. if ("4".equals(dto.getEngScal())) {
  1176. hasWiunWaoLegPersNoOne++;
  1177. } else if ("5".equals(dto.getEngScal())) {
  1178. hasWiunWaoLegPersNoTwo++;
  1179. }
  1180. }
  1181. map = this.setCommonInfo(dto.getWiunWaoLegPersResu(),wiunWaoLegPersResuPerfect,wiunWaoLegPersResuGood,wiunWaoLegPersResuBad);
  1182. wiunWaoLegPersResuPerfect = map==null? wiunWaoLegPersResuPerfect: map.get("1");
  1183. wiunWaoLegPersResuGood = map==null?wiunWaoLegPersResuGood: map.get("2");
  1184. wiunWaoLegPersResuBad = map==null?wiunWaoLegPersResuBad: map.get("3");
  1185. if ("3".equals(dto.getWiunWaoLegPersResu())){
  1186. if ("4".equals(dto.getEngScal())) {
  1187. wiunWaoLegPersResuBadOne++;
  1188. } else if ("5".equals(dto.getEngScal())) {
  1189. wiunWaoLegPersResuBadTwo++;
  1190. }
  1191. }
  1192. map = this.setCommonInfo(dto.getWiunWaoLegPersTrain(),wiunWaoLegPersTrain,wiunWaoLegPersTrainNo,null);
  1193. wiunWaoLegPersTrain = map==null? wiunWaoLegPersTrain: map.get("1");
  1194. wiunWaoLegPersTrainNo = map==null?wiunWaoLegPersTrainNo: map.get("2");
  1195. if ("2".equals(dto.getWiunWaoLegPersTrain())) {
  1196. if ("4".equals(dto.getEngScal())) {
  1197. wiunWaoLegPersTrainNoOne++;
  1198. } else if ("5".equals(dto.getEngScal())) {
  1199. wiunWaoLegPersTrainNoTwo++;
  1200. }
  1201. }
  1202. map = this.setCommonInfo(dto.getHasTechPers(),hasTechPers,hasTechPersNo,null);
  1203. hasTechPers = map==null? hasTechPers: map.get("1");
  1204. hasTechPersNo = map==null?hasTechPersNo: map.get("2");
  1205. map = this.setCommonInfo(dto.getTechPersResu(),techPersResuPerfect,techPersResuGood,techPersResuBad);
  1206. techPersResuPerfect = map==null? techPersResuPerfect: map.get("1");
  1207. techPersResuGood = map==null?techPersResuGood: map.get("2");
  1208. techPersResuBad = map==null?techPersResuBad: map.get("3");
  1209. map = this.setCommonInfo(dto.getTechPersTrain(),techPersTrain,techPersTrainNo,null);
  1210. techPersTrain = map==null? techPersTrain: map.get("1");
  1211. techPersTrainNo = map==null?techPersTrainNo: map.get("2");
  1212. map = this.setCommonInfo(dto.getHasPatrolPers(),hasPatrolPers,null,null);
  1213. hasPatrolPers = map==null? hasPatrolPers: map.get("1");
  1214. map = this.setCommonInfo(dto.getPatrolPersResu(),patrolPersResuPerfect,patrolPersResuGood,patrolPersResuBad);
  1215. patrolPersResuPerfect = map==null? patrolPersResuPerfect: map.get("1");
  1216. patrolPersResuGood = map==null?patrolPersResuGood: map.get("2");
  1217. patrolPersResuBad = map==null?patrolPersResuBad: map.get("3");
  1218. map = this.setCommonInfo(dto.getPatrolPersTrain(),patrolPersTrain,patrolPersTrainNo,null);
  1219. patrolPersTrain = map==null? patrolPersTrain: map.get("1");
  1220. patrolPersTrainNo = map==null?patrolPersTrainNo: map.get("2");
  1221. map = this.setCommonInfo(dto.getHasAttendTrain(),hasAttendTrain,null,null);
  1222. hasAttendTrain = map==null? hasAttendTrain: map.get("1");
  1223. }
  1224. //三个重点
  1225. if(StringUtils.isNotBlank(dto.getThrqId())) {
  1226. thrqSize++;
  1227. Map<String,Long> map = null;
  1228. map = this.setCommonInfo(dto.getRainForc(),rainForc,rainForcNo,null);
  1229. rainForc = map==null? rainForc: map.get("1");
  1230. rainForcNo = map==null?rainForcNo: map.get("2");
  1231. map = this.setCommonInfo(dto.getRainForcNote(),rainForcNote,rainForcNoteNo,null);
  1232. rainForcNote = map==null? rainForcNote: map.get("1");
  1233. rainForcNoteNo = map==null?rainForcNoteNo: map.get("2");
  1234. map = this.setCommonInfo(dto.getSchPlanSameExta(),schPlanSameExta,schPlanSameExtaNo,null);
  1235. schPlanSameExta = map==null? schPlanSameExta: map.get("1");
  1236. schPlanSameExtaNo = map==null?schPlanSameExtaNo: map.get("2");
  1237. map = this.setCommonInfo(dto.getSchPlanSameAppr(),schPlanSameAppr,schPlanSameApprNo,null);
  1238. schPlanSameAppr = map==null? schPlanSameAppr: map.get("1");
  1239. schPlanSameApprNo = map==null?schPlanSameApprNo: map.get("2");
  1240. map = this.setCommonInfo(dto.getSchPlanSameSpeed(),schPlanSameSpeedPerfect,schPlanSameSpeedGood,schPlanSameSpeedBad);
  1241. schPlanSameSpeedPerfect = map==null? schPlanSameSpeedPerfect: map.get("1");
  1242. schPlanSameSpeedGood = map==null?schPlanSameSpeedGood: map.get("2");
  1243. schPlanSameSpeedBad = map==null?schPlanSameSpeedBad: map.get("3");
  1244. map = this.setCommonInfo(dto.getEmerPlanSameExta(),emerPlanSameExta,emerPlanSameExtaNo,null);
  1245. emerPlanSameExta = map==null? emerPlanSameExta: map.get("1");
  1246. emerPlanSameExtaNo = map==null?emerPlanSameExtaNo: map.get("2");
  1247. map = this.setCommonInfo(dto.getEmerPlanSameAppr(),emerPlanSameAppr,emerPlanSameApprNo,null);
  1248. emerPlanSameAppr = map==null? emerPlanSameAppr: map.get("1");
  1249. emerPlanSameApprNo = map==null?emerPlanSameApprNo: map.get("2");
  1250. map = this.setCommonInfo(dto.getEmerPlanSameEme(),emerPlanSameEme,emerPlanSameEmeNo,null);
  1251. emerPlanSameEme = map==null? emerPlanSameEme: map.get("1");
  1252. emerPlanSameEmeNo = map==null?emerPlanSameEmeNo: map.get("2");
  1253. map = this.setCommonInfo(dto.getEmerPlanSameSpeed(),emerPlanSameSpeedPerfect,emerPlanSameSpeedGood,emerPlanSameSpeedBad);
  1254. emerPlanSameSpeedPerfect = map==null? emerPlanSameSpeedPerfect: map.get("1");
  1255. emerPlanSameSpeedGood = map==null?emerPlanSameSpeedGood: map.get("2");
  1256. emerPlanSameSpeedBad = map==null?emerPlanSameSpeedBad: map.get("3");
  1257. }
  1258. //工程实体
  1259. if (StringUtils.isNotBlank(dto.getProId())) {
  1260. proSize++;
  1261. Map<String,Long> map = null;
  1262. map = this.setCommonInfo(dto.getDiskRunInfo(),diskRunInfoPerfect,diskRunInfoGood,diskRunInfoBad);
  1263. diskRunInfoPerfect = map==null? diskRunInfoPerfect: map.get("1");
  1264. diskRunInfoGood = map==null?diskRunInfoGood: map.get("2");
  1265. diskRunInfoBad = map==null?diskRunInfoBad: map.get("3");
  1266. map = this.setCommonInfo(dto.getHasSetMainFl(),hasSetMainFl,null,null);
  1267. hasSetMainFl = map==null? hasSetMainFl: map.get("1");
  1268. map = this.setCommonInfo(dto.getIsMainFlNormal(),isMainFlNormalPerfect,isMainFlNormalGood,isMainFlNormalBad);
  1269. isMainFlNormalPerfect = map==null? isMainFlNormalPerfect: map.get("1");
  1270. isMainFlNormalGood = map==null?isMainFlNormalGood: map.get("2");
  1271. isMainFlNormalBad = map==null?isMainFlNormalBad: map.get("3");
  1272. map = this.setCommonInfo(dto.getHasSetPourFl(),hasSetPourFl,null,null);
  1273. hasSetPourFl = map==null? hasSetPourFl: map.get("1");
  1274. if ("1".equals(dto.getHasSetPourFl())) {
  1275. map = this.setCommonInfo(dto.getPourFyIsNormal(), pourFyIsNormalPerfect, pourFyIsNormalGood, pourFyIsNormalBad);
  1276. pourFyIsNormalPerfect = map == null ? pourFyIsNormalPerfect : map.get("1");
  1277. pourFyIsNormalGood = map == null ? pourFyIsNormalGood : map.get("2");
  1278. pourFyIsNormalBad = map == null ? pourFyIsNormalBad : map.get("3");
  1279. }
  1280. map = this.setCommonInfo(dto.getIfDamSafeReq(),ifDamSafeReq,ifDamSafeReqNo,null);
  1281. ifDamSafeReq = map==null? ifDamSafeReq: map.get("1");
  1282. ifDamSafeReqNo = map==null? ifDamSafeReqNo: map.get("2");
  1283. map = this.setCommonInfo(dto.getIfDamSafe(),null,ifDamSafe,null);
  1284. ifDamSafe = map==null?ifDamSafe: map.get("2");
  1285. map = this.setCommonInfo(dto.getNotReinForce(),notReinForce,null,null);
  1286. notReinForce = map==null? notReinForce: map.get("1");
  1287. map = this.setCommonInfo(dto.getIfDamSafeRul(),ifDamSafeRul,ifDamSafeRulNo,null);
  1288. ifDamSafeRul = map==null? ifDamSafeRul: map.get("1");
  1289. ifDamSafeRulNo = map==null?ifDamSafeRulNo: map.get("2");
  1290. map = this.setCommonInfo(dto.getIfDamSafeDepRul(),ifDamSafeDepRul,ifDamSafeDepRulNo,null);
  1291. ifDamSafeDepRul = map==null? ifDamSafeDepRul: map.get("1");
  1292. ifDamSafeDepRulNo = map==null?ifDamSafeDepRulNo: map.get("2");
  1293. map = this.setCommonInfo(dto.getIfDamSafeThr(),ifDamSafeThr,null,null);
  1294. ifDamSafeThr = map==null? ifDamSafeThr: map.get("1");
  1295. if ("1".equals(dto.getIfDamSafeThr())) {
  1296. map = this.setCommonInfo(dto.getIfReinForce(), ifReinForceOne, ifReinForceTwo, null);
  1297. ifReinForceOne = map == null ? ifReinForceOne : map.get("1");
  1298. ifReinForceTwo = map == null ? ifReinForceTwo : map.get("2");
  1299. if ("1".equals(dto.getIfReinForce())) {
  1300. map = this.setCommonInfo(dto.getIfReinImpGve(),ifReinImpGveOne,ifReinImpGveOneNo,null);
  1301. ifReinImpGveOne = map==null? ifReinImpGve: map.get("1");
  1302. ifReinImpGveOneNo = map==null?ifReinImpGveNo: map.get("2");
  1303. map = this.setCommonInfo(dto.getReinForceRun(),reinForceRunPerfect,reinForceRunGood,reinForceRunBad);
  1304. reinForceRunPerfect = map==null? reinForceRunPerfect: map.get("1");
  1305. reinForceRunGood = map==null?reinForceRunGood: map.get("2");
  1306. reinForceRunBad = map==null?reinForceRunBad: map.get("3");
  1307. map = this.setCommonInfo(dto.getReinForceRun3(),reinForceRun3,reinForceRun3No,null);
  1308. reinForceRun3 = map==null? reinForceRun3: map.get("1");
  1309. reinForceRun3No = map==null?reinForceRun3No: map.get("2");
  1310. } else if ("2".equals(dto.getIfReinForce())) {
  1311. map = this.setCommonInfo(dto.getIfReinImpGve(),ifReinImpGve,ifReinImpGveNo,null);
  1312. ifReinImpGve = map==null? ifReinImpGve: map.get("1");
  1313. ifReinImpGveNo = map==null?ifReinImpGveNo: map.get("2");
  1314. map = this.setCommonInfo(dto.getIfReinImpPlan(),ifReinImpPlan,ifReinImpPlanNo,null);
  1315. ifReinImpPlan = map==null? ifReinImpPlan: map.get("1");
  1316. ifReinImpPlanNo = map==null?ifReinImpPlanNo: map.get("2");
  1317. }
  1318. }
  1319. }
  1320. }
  1321. //字段写入
  1322. dataMap.put("rsvrSize",rsvrSize);
  1323. dataMap.put("rsvrSizeLitOne",rsvrSizeLitOne);
  1324. dataMap.put("rsveSizeLitTwo",rsveSizeLitTwo);
  1325. dataMap.put("provinceSize",proList.size());
  1326. dataMap.put("citySize",cityList.size());
  1327. dataMap.put("countrtSize",countryList.size());
  1328. dataMap.put("countryPertSize",countryPertList.size());
  1329. dataMap.put("benefitsSize",benefitsSize);
  1330. dataMap.put("ifEffective",ifEffective);
  1331. dataMap.put("ifEffectiveNo",ifEffectiveNo);
  1332. dataMap.put("ifEffectivePer",ifEffective == 0 ? 0 : ifEffective * 100 / benefitsSize);
  1333. dataMap.put("ifEffectiveNoPer",ifEffectiveNo == 0 ? 0 : ifEffectiveNo * 100 / benefitsSize);
  1334. dataMap.put("wsfdws",wsfdws / 10000);
  1335. dataMap.put("areaIrr",areaIrr / 10000);
  1336. dataMap.put("mngrnSize",mngrnSize);
  1337. dataMap.put("safeCommentPerfect",safeCommentPerfect);
  1338. dataMap.put("safeCommentGood",safeCommentGood);
  1339. dataMap.put("safeCommentBad",safeCommentBad);
  1340. dataMap.put("safeCommentPerfectPer",safeCommentPerfect==0?0 : safeCommentPerfect * 100 / rsvrSize);
  1341. dataMap.put("safeCommentGoodPer",safeCommentGood == 0?0:safeCommentGood * 100 /rsvrSize);
  1342. dataMap.put("safeCommentBadPer",safeCommentBad == 0 ? 0:safeCommentBad * 100 / rsvrSize);
  1343. dataMap.put("ifFsltdzRun",ifFsltdzRun);
  1344. dataMap.put("ifFsltdzRunNo",ifFsltdzRunNo);
  1345. dataMap.put("ifFsltdzNoOne",ifFsltdzNoOne);
  1346. dataMap.put("ifFsltdzNoTwo",ifFsltdzNoTwo);
  1347. dataMap.put("hasWdEmnic",hasWdEmnic);
  1348. dataMap.put("ifManageRegRel",ifManageRegRel);
  1349. dataMap.put("ifManageRegRelNo",ifManageRegRelNo);
  1350. dataMap.put("ifManageReg",ifManageReg);
  1351. dataMap.put("ifDamWarnLogo",ifDamWarnLogo);
  1352. dataMap.put("ifDamWarnLogoNo",ifDamWarnLogoNo);
  1353. dataMap.put("ifFsltdzRunPer",ifFsltdzRun ==0 ? 0:ifFsltdzRun * 100 /mngrnSize);
  1354. dataMap.put("ifFsltdzRunNoPer", ifFsltdzRunNo ==0 ? 0:ifFsltdzRunNo * 100 /mngrnSize);
  1355. dataMap.put("ifFsltdzNoOnePer", ifFsltdzNoOne ==0 ? 0:ifFsltdzNoOne * 100 /mngrnSize);
  1356. dataMap.put("ifFsltdzNoTwoPer", ifFsltdzNoTwo ==0 ? 0:ifFsltdzNoTwo * 100 /mngrnSize);
  1357. dataMap.put("hasWdEmnicPer", hasWdEmnic ==0 ? 0:hasWdEmnic * 100 /mngrnSize);
  1358. dataMap.put("ifManageRegRelPer", ifManageRegRel ==0 ? 0:ifManageRegRel * 100 /mngrnSize);
  1359. dataMap.put("ifManageRegRelNoPer", ifManageRegRelNo ==0 ? 0:ifManageRegRelNo * 100 /mngrnSize);
  1360. dataMap.put("ifManageRegPer", ifManageReg ==0 ? 0:ifManageReg * 100 /mngrnSize);
  1361. dataMap.put("ifDamWarnLogoPer", ifDamWarnLogo ==0 ? 0:ifDamWarnLogo * 100 /mngrnSize);
  1362. dataMap.put("ifDamWarnLogoNoPer", ifDamWarnLogoNo ==0 ? 0:ifDamWarnLogoNo * 100 /mngrnSize);
  1363. dataMap.put("dutySize",dutySize);
  1364. dataMap.put("hasWiunWaoLegPers",hasWiunWaoLegPers);
  1365. dataMap.put("hasWiunWaoLegPersPer",hasWiunWaoLegPers == 0 ? 0: hasWiunWaoLegPers * 100 / dutySize);
  1366. dataMap.put("hasWiunWaoLegPersNo",hasWiunWaoLegPersNo);
  1367. dataMap.put("hasWiunWaoLegPersNoOne",hasWiunWaoLegPersNoOne);
  1368. dataMap.put("hasWiunWaoLegPersNoTwo",hasWiunWaoLegPersNoTwo);
  1369. dataMap.put("hasWiunWaoLegPersNoPer",hasWiunWaoLegPersNo == 0 ? 0: hasWiunWaoLegPersNo * 100 / dutySize);
  1370. dataMap.put("wiunWaoLegPersResuPerfect",wiunWaoLegPersResuPerfect);
  1371. dataMap.put("wiunWaoLegPersResuGood",wiunWaoLegPersResuGood);
  1372. dataMap.put("wiunWaoLegPersResuBad",wiunWaoLegPersResuBad);
  1373. dataMap.put("wiunWaoLegPersResuPerfectPer",wiunWaoLegPersResuPerfect == 0? 0 : wiunWaoLegPersResuPerfect * 100 / dutySize);
  1374. dataMap.put("wiunWaoLegPersResuGoodPer",wiunWaoLegPersResuGood == 0?0 : wiunWaoLegPersResuGood * 100/dutySize);
  1375. dataMap.put("wiunWaoLegPersResuBadPer",wiunWaoLegPersResuBad == 0?0 : wiunWaoLegPersResuBad * 100/dutySize);
  1376. dataMap.put("wiunWaoLegPersTrain",wiunWaoLegPersTrain);
  1377. dataMap.put("wiunWaoLegPersTrainNo",wiunWaoLegPersTrainNo);
  1378. dataMap.put("wiunWaoLegPersTrainPer",wiunWaoLegPersTrain == 0? 0: wiunWaoLegPersTrain* 100/dutySize);
  1379. dataMap.put("wiunWaoLegPersTrainNoPer",wiunWaoLegPersTrainNo == 0? 0: wiunWaoLegPersTrainNo*100/dutySize);
  1380. dataMap.put("hasTechPers",hasTechPers);
  1381. dataMap.put("hasTechPersNo",hasTechPersNo);
  1382. dataMap.put("hasTechPersNoPer",hasTechPersNo == 0 ? 0 : hasTechPersNo * 100 /dutySize);
  1383. dataMap.put("techPersResuPerfect",techPersResuPerfect);
  1384. dataMap.put("techPersResuGood",techPersResuGood);
  1385. dataMap.put("techPersResuBad",techPersResuBad);
  1386. dataMap.put("techPersTrain",techPersTrain);
  1387. dataMap.put("techPersTrainNo",techPersTrainNo);
  1388. dataMap.put("hasTechPersPer",hasTechPers == 0? 0: hasTechPers* 100/dutySize);
  1389. dataMap.put("techPersResuPerfectPer",techPersResuPerfect == 0?0 :techPersResuPerfect*100/dutySize);
  1390. dataMap.put("techPersResuGoodPer",techPersResuGood == 0?0 :techPersResuGood*100/dutySize);
  1391. dataMap.put("techPersResuBadPer", techPersResuBad == 0?0 :techPersResuBad*100/dutySize);
  1392. dataMap.put("techPersTrainPer", techPersTrain == 0?0 :techPersTrain*100/dutySize);
  1393. dataMap.put("techPersTrainNoPer", techPersTrainNo == 0?0 :techPersTrainNo*100/dutySize);
  1394. dataMap.put("hasPatrolPers",hasPatrolPers);
  1395. dataMap.put("patrolPersResuPerfect",patrolPersResuPerfect);
  1396. dataMap.put("patrolPersResuGood",patrolPersResuGood);
  1397. dataMap.put("patrolPersResuBad",patrolPersResuBad);
  1398. dataMap.put("patrolPersTrain",patrolPersTrain);
  1399. dataMap.put("patrolPersTrainNo",patrolPersTrainNo);
  1400. dataMap.put("hasAttendTrain",hasAttendTrain);
  1401. dataMap.put("hasPatrolPersPer", hasPatrolPers == 0?0 :hasPatrolPers*100/dutySize);
  1402. dataMap.put("patrolPersResuPerfectPer", patrolPersResuPerfect == 0?0 :patrolPersResuPerfect*100/dutySize);
  1403. dataMap.put("patrolPersResuGoodPer", patrolPersResuGood == 0?0 :patrolPersResuGood*100/dutySize);
  1404. dataMap.put("patrolPersResuBadPer", patrolPersResuBad == 0?0 :patrolPersResuBad*100/dutySize);
  1405. dataMap.put("patrolPersTrainPer", patrolPersTrain == 0?0 :patrolPersTrain*100/dutySize);
  1406. dataMap.put("patrolPersTrainNoPer", patrolPersTrainNo == 0?0 :patrolPersTrainNo*100/dutySize);
  1407. dataMap.put("hasAttendTrainPer", hasAttendTrain == 0?0 :hasAttendTrain*100/dutySize);
  1408. dataMap.put("thrqSize",thrqSize);
  1409. dataMap.put("rainForc",rainForc);
  1410. dataMap.put("rainForcPer",rainForc == 0?0: rainForc*100/thrqSize);
  1411. dataMap.put("rainForcNo",rainForcNo);
  1412. dataMap.put("rainForcNoPer",rainForcNo == 0?0 : rainForcNo * 100/thrqSize);
  1413. dataMap.put("rainForcNote",rainForcNote);
  1414. dataMap.put("rainForcNoteNo",rainForcNoteNo);
  1415. dataMap.put("rainForcNotePer", rainForcNote == 0?0: rainForcNote*100/thrqSize);
  1416. dataMap.put("rainForcNoteNoPer", rainForcNoteNo == 0?0: rainForcNoteNo*100/thrqSize);
  1417. dataMap.put("schPlanSameExta",schPlanSameExta);
  1418. dataMap.put("schPlanSameExtaNo",schPlanSameExtaNo);
  1419. dataMap.put("schPlanSameAppr",schPlanSameAppr);
  1420. dataMap.put("schPlanSameApprNo",schPlanSameApprNo);
  1421. dataMap.put("schPlanSameSpeedPerfect",schPlanSameSpeedPerfect);
  1422. dataMap.put("schPlanSameSpeedGood",schPlanSameSpeedGood);
  1423. dataMap.put("schPlanSameSpeedBad",schPlanSameSpeedBad);
  1424. dataMap.put("schPlanSameExtaPer", schPlanSameExta == 0?0: schPlanSameExta*100/thrqSize);
  1425. dataMap.put("schPlanSameExtaNoPer", schPlanSameExtaNo == 0?0: schPlanSameExtaNo*100/thrqSize);
  1426. dataMap.put("schPlanSameApprPer", schPlanSameAppr == 0?0: schPlanSameAppr*100/thrqSize);
  1427. dataMap.put("schPlanSameApprNoPer", schPlanSameApprNo == 0?0: schPlanSameApprNo*100/thrqSize);
  1428. dataMap.put("schPlanSameSpeedPerfectPer", schPlanSameSpeedPerfect == 0?0: schPlanSameSpeedPerfect*100/thrqSize);
  1429. dataMap.put("schPlanSameSpeedGoodPer", schPlanSameSpeedGood == 0?0: schPlanSameSpeedGood*100/thrqSize);
  1430. dataMap.put("schPlanSameSpeedBadPer", schPlanSameSpeedBad == 0?0: schPlanSameSpeedBad*100/thrqSize);
  1431. dataMap.put("emerPlanSameExta",emerPlanSameExta);
  1432. dataMap.put("emerPlanSameExtaNo",emerPlanSameExtaNo);
  1433. dataMap.put("emerPlanSameAppr",emerPlanSameAppr);
  1434. dataMap.put("emerPlanSameApprNo",emerPlanSameApprNo);
  1435. dataMap.put("emerPlanSameEme",emerPlanSameEme);
  1436. dataMap.put("emerPlanSameEmeNo",emerPlanSameEmeNo);
  1437. dataMap.put("emerPlanSameSpeedPerfect",emerPlanSameSpeedPerfect);
  1438. dataMap.put("emerPlanSameSpeedGood",emerPlanSameSpeedGood);
  1439. dataMap.put("emerPlanSameSpeedBad",emerPlanSameSpeedBad);
  1440. dataMap.put("emerPlanSameExtaPer", emerPlanSameExta == 0?0: emerPlanSameExta*100/thrqSize);
  1441. dataMap.put("emerPlanSameExtaNoPer", emerPlanSameExtaNo == 0?0: emerPlanSameExtaNo*100/thrqSize);
  1442. dataMap.put("emerPlanSameApprPer", emerPlanSameAppr == 0?0: emerPlanSameAppr*100/thrqSize);
  1443. dataMap.put("emerPlanSameApprNoPer", emerPlanSameApprNo == 0?0: emerPlanSameApprNo*100/thrqSize);
  1444. dataMap.put("emerPlanSameEmePer", emerPlanSameEme == 0?0: emerPlanSameEme*100/thrqSize);
  1445. dataMap.put("emerPlanSameEmeNoPer", emerPlanSameEmeNo == 0?0: emerPlanSameEmeNo*100/thrqSize);
  1446. dataMap.put("emerPlanSameSpeedPerfectPer", emerPlanSameSpeedPerfect == 0?0: emerPlanSameSpeedPerfect*100/thrqSize);
  1447. dataMap.put("emerPlanSameSpeedGoodPer", emerPlanSameSpeedGood == 0?0: emerPlanSameSpeedGood*100/thrqSize);
  1448. dataMap.put("emerPlanSameSpeedBadPer", emerPlanSameSpeedBad == 0?0: emerPlanSameSpeedBad*100/thrqSize);
  1449. dataMap.put("proSize",proSize);
  1450. dataMap.put("diskRunInfoPerfect",diskRunInfoPerfect);
  1451. dataMap.put("diskRunInfoGood",diskRunInfoGood);
  1452. dataMap.put("diskRunInfoBad",diskRunInfoBad);
  1453. dataMap.put("diskRunInfoPerfectPer",diskRunInfoPerfect == 0 ? 0: diskRunInfoPerfect * 100/proSize);
  1454. dataMap.put("diskRunInfoGoodPer", diskRunInfoGood == 0 ? 0: diskRunInfoGood * 100/proSize);
  1455. dataMap.put("diskRunInfoBadPer", diskRunInfoBad == 0 ? 0: diskRunInfoBad * 100/proSize);
  1456. dataMap.put("hasSetMainFl",hasSetMainFl);
  1457. dataMap.put("isMainFlNormalPerfect",isMainFlNormalPerfect);
  1458. dataMap.put("isMainFlNormalGood",isMainFlNormalGood);
  1459. dataMap.put("isMainFlNormalBad",isMainFlNormalBad);
  1460. dataMap.put("hasSetMainFlPer", hasSetMainFl == 0 ? 0: hasSetMainFl * 100/proSize);
  1461. dataMap.put("isMainFlNormalPerfectPer", isMainFlNormalPerfect == 0 ? 0: isMainFlNormalPerfect * 100/proSize);
  1462. dataMap.put("isMainFlNormalGoodPer", isMainFlNormalGood == 0 ? 0: isMainFlNormalGood * 100/proSize);
  1463. dataMap.put("isMainFlNormalBadPer", isMainFlNormalBad == 0 ? 0: isMainFlNormalBad * 100/proSize);
  1464. dataMap.put("hasSetPourFl",hasSetPourFl);
  1465. dataMap.put("pourFyIsNormalPerfect",pourFyIsNormalPerfect);
  1466. dataMap.put("pourFyIsNormalGood",pourFyIsNormalGood);
  1467. dataMap.put("pourFyIsNormalBad",pourFyIsNormalBad);
  1468. dataMap.put("hasSetPourFlPer", hasSetPourFl == 0 ? 0: hasSetPourFl * 100/proSize);
  1469. dataMap.put("pourFyIsNormalPerfectPer", pourFyIsNormalPerfect == 0 ? 0: pourFyIsNormalPerfect * 100/proSize);
  1470. dataMap.put("pourFyIsNormalGoodPer", pourFyIsNormalGood == 0 ? 0: pourFyIsNormalGood * 100/proSize);
  1471. dataMap.put("pourFyIsNormalBadPer", pourFyIsNormalBad == 0 ? 0: pourFyIsNormalBad * 100/proSize);
  1472. dataMap.put("ifDamSafeReq",ifDamSafeReq);
  1473. dataMap.put("ifDamSafeReqNo",ifDamSafeReqNo);
  1474. dataMap.put("ifDamSafeReqNoAll",proSize - ifDamSafeReq);
  1475. dataMap.put("ifDamSafe",ifDamSafe);
  1476. dataMap.put("ifDamSafePer",ifDamSafe == 0 ? 0 : ifDamSafe * 100/proSize);
  1477. dataMap.put("notReinForce",notReinForce);
  1478. dataMap.put("ifDamSafeRul",ifDamSafeRul);
  1479. dataMap.put("ifDamSafeRulNo",ifDamSafeRulNo);
  1480. dataMap.put("ifDamSafeDepRul",ifDamSafeDepRul);
  1481. dataMap.put("ifDamSafeDepRulNo",ifDamSafeDepRulNo);
  1482. dataMap.put("ifDamSafeDepRulNoPer",ifDamSafeDepRulNo ==0?0:ifDamSafeDepRulNo*100/proSize);
  1483. dataMap.put("ifDamSafeThr",ifDamSafeThr);
  1484. dataMap.put("ifReinForceOne",ifReinForceOne);
  1485. dataMap.put("reinForceRunPerfect",reinForceRunPerfect);
  1486. dataMap.put("reinForceRunGood",reinForceRunGood);
  1487. dataMap.put("reinForceRunBad",reinForceRunBad);
  1488. dataMap.put("reinForceRun3",reinForceRun3);
  1489. dataMap.put("reinForceRun3No",reinForceRun3No);
  1490. dataMap.put("ifReinForceTwo",ifReinForceTwo);
  1491. dataMap.put("ifReinImpGve",ifReinImpGve);
  1492. dataMap.put("ifReinImpGveNo",ifReinImpGveNo);
  1493. dataMap.put("ifReinImpGveOne",ifReinImpGveOne);
  1494. dataMap.put("ifReinImpGveOneNo",ifReinImpGveOneNo);
  1495. dataMap.put("ifReinImpPlan",ifReinImpPlan);
  1496. dataMap.put("ifReinImpPlanNo",ifReinImpPlanNo);
  1497. dataMap.put("ifDamSafeReqPer", ifDamSafeReq == 0 ? 0: ifDamSafeReq * 100/proSize);
  1498. dataMap.put("ifDamSafeReqNoPer", ifDamSafeReqNo == 0 ? 0: ifDamSafeReqNo * 100/proSize);
  1499. dataMap.put("ifDamSafePer", ifDamSafe == 0 ? 0: ifDamSafe * 100/proSize);
  1500. dataMap.put("notReinForcePer", notReinForce == 0 ? 0: notReinForce * 100/proSize);
  1501. dataMap.put("ifDamSafeRulPer", ifDamSafeRul == 0 ? 0: ifDamSafeRul * 100/proSize);
  1502. dataMap.put("ifDamSafeRulNoPer", ifDamSafeRulNo == 0 ? 0: ifDamSafeRulNo * 100/proSize);
  1503. dataMap.put("ifDamSafeDepRulPer", ifDamSafeDepRul == 0 ? 0: ifDamSafeDepRul * 100/proSize);
  1504. dataMap.put("ifDamSafeThrPer", ifDamSafeThr == 0 ? 0: ifDamSafeThr * 100/proSize);
  1505. dataMap.put("ifReinForceOnePer", ifReinForceOne == 0 ? 0: ifReinForceOne * 100/proSize);
  1506. dataMap.put("reinForceRunPerfectPer", reinForceRunPerfect == 0 ? 0: reinForceRunPerfect * 100/proSize);
  1507. dataMap.put("reinForceRunGoodPer", reinForceRunGood == 0 ? 0: reinForceRunGood * 100/proSize);
  1508. dataMap.put("reinForceRunBadPer", reinForceRunBad == 0 ? 0: reinForceRunBad * 100/proSize);
  1509. dataMap.put("reinForceRun3Per", reinForceRun3 == 0 ? 0: reinForceRun3 * 100/proSize);
  1510. dataMap.put("reinForceRun3NoPer", reinForceRun3No == 0 ? 0: reinForceRun3No * 100/proSize);
  1511. dataMap.put("ifReinForceTwoPer", ifReinForceTwo == 0 ? 0: ifReinForceTwo * 100/proSize);
  1512. dataMap.put("ifReinImpGvePer", ifReinImpGve == 0 ? 0: ifReinImpGve * 100/proSize);
  1513. dataMap.put("ifReinImpGveNoPer", ifReinImpGveNo == 0 ? 0: ifReinImpGveNo * 100/proSize);
  1514. dataMap.put("ifReinImpGveOnePer", ifReinImpGveOne == 0 ? 0: ifReinImpGveOne * 100/proSize);
  1515. dataMap.put("ifReinImpGveOneNoPer", ifReinImpGveOneNo == 0 ? 0: ifReinImpGveOneNo * 100/proSize);
  1516. dataMap.put("ifReinImpPlanPer", ifReinImpPlan == 0 ? 0: ifReinImpPlan * 100/proSize);
  1517. dataMap.put("ifReinImpPlanNoPer", ifReinImpPlanNo == 0 ? 0: ifReinImpPlanNo * 100/proSize);
  1518. if (sb.length() > 0) {
  1519. return sb.delete(sb.length() - 1, sb.length()).append(")").toString();
  1520. }
  1521. return "";
  1522. }
  1523. private Map<String,Long> setCommonInfo(String ifEffective, Long param, Long param1,Long param2) {
  1524. if (StringUtils.isBlank(ifEffective) || "0".equals(ifEffective)) {
  1525. return null;
  1526. }
  1527. switch (ifEffective) {
  1528. case "1":
  1529. if (param != null) {
  1530. param++;
  1531. }
  1532. break;
  1533. case "2":
  1534. if (param1 != null) {
  1535. param1 ++;
  1536. }
  1537. break;
  1538. case "3":
  1539. if (param2 != null) {
  1540. param2++;
  1541. }
  1542. break;
  1543. default:
  1544. return null;
  1545. }
  1546. Map<String,Long> map = new HashedMap();
  1547. map.put("1",param);
  1548. map.put("2",param1);
  1549. map.put("3",param2);
  1550. return map;
  1551. }
  1552. @Override
  1553. public String getDocByTm(String fileName, String stTm, String enTm,Map<String,Object> map,String orgId) throws IOException {
  1554. Map<String, Object> dataMap = new HashMap<>();
  1555. String filePath = templatePath + "/" + fileName;
  1556. Date stTmDate = DateUtils.Str2Date(stTm);
  1557. Date enTmDate = DateUtils.Str2Date(enTm);
  1558. String curentTm = DateUtils.Date2Str(new Date(), "yyyy年M月d日");
  1559. dataMap.put("tmTitle", curentTm + "(第XX期)");
  1560. dataMap.put("tm", DateUtils.Date2Str(stTmDate, "M月d日") + "至" + DateUtils.Date2Str(enTmDate, "M月d日"));
  1561. //获取信息的业务逻辑
  1562. dataMap = this.getDataMap(dataMap, stTm, enTm ,map,orgId);
  1563. /*
  1564. 替换模板
  1565. dataMap 要填入模本的数据文件
  1566. 设置模本装置方法和路径,FreeMarker支持多种模板装载方法。可以从servlet,classpath,数据库装载,
  1567. 这里我们的模板是放在template包下面
  1568. */
  1569. // 装载路径
  1570. configuration.setDirectoryForTemplateLoading(new File(templatePath));
  1571. // 通过模板名称获取模板
  1572. Template template = configuration.getTemplate(TEMP_FILE_NAME);
  1573. // 开始装载并输出
  1574. if (template != null) {
  1575. //输出文档路径及名称
  1576. File outFile = new File(filePath);
  1577. Writer out = null;
  1578. FileOutputStream fos = null;
  1579. try {
  1580. fos = new FileOutputStream(outFile);
  1581. OutputStreamWriter oWriter = new OutputStreamWriter(fos, StandardCharsets.UTF_8);
  1582. //这个地方对流的编码不可或缺,使用main()单独调用时,应该可以,但是如果是web请求导出时导出后word文档就会打不开,并且包XML文件错误。主要是编码格式不正确,无法解析。
  1583. //out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outFile)));
  1584. out = new BufferedWriter(oWriter);
  1585. //向模板里替换数据
  1586. template.process(dataMap, out);
  1587. } catch (FileNotFoundException | TemplateException e) {
  1588. e.printStackTrace();
  1589. } finally {
  1590. if (out != null) {
  1591. out.close();
  1592. }
  1593. if (fos != null) {
  1594. fos.close();
  1595. }
  1596. }
  1597. }
  1598. //输出文件到指定路径
  1599. return filePath;
  1600. }
  1601. private Map<String, Object> getDataMap(Map<String, Object> dataMap, String stTm, String enTm, Map<String,Object> map,String orgId) {
  1602. //1.获取督查办督查组信息
  1603. dataMap = this.getDcInfo(dataMap, stTm, enTm);
  1604. //2.获取版本信息
  1605. dataMap = this.getVesionInfo(dataMap);
  1606. //3.获取流域督查组信息
  1607. dataMap = this.getDcBsInfo(dataMap, stTm, enTm);
  1608. //4.督查工作
  1609. dataMap = this.getDcRegsitInfo(dataMap, stTm, enTm);
  1610. //5.严重问题概述 水利工程和运行显示工程名称,其他显示类别,目前有农村引水安全,小型水库,水毁修复,水闸
  1611. this.getDcBigPblmDesc(dataMap, stTm, enTm);
  1612. //6.水利工程详细描述
  1613. this.getDcBigPblmDetailByKeyReg(dataMap, stTm, enTm);
  1614. //7.农村引水安全
  1615. this.getDcBigPblmDetailByVill(dataMap, stTm, enTm, map,orgId);
  1616. //8.小型水库
  1617. this.getDcBigPblmDetailByRever(dataMap, stTm, enTm, map,orgId);
  1618. //9.水毁修复
  1619. this.getDcBigPblmDetailByTrack(dataMap, stTm, enTm, map,orgId);
  1620. //10.水闸
  1621. this.getDcBigPblmDetailByWaga(dataMap, stTm, enTm, map,orgId);
  1622. return dataMap;
  1623. }
  1624. private void getDcBigPblmDetailByWaga(Map<String, Object> dataMap, String stTm, String enTm, Map<String,Object> map,String orgId) {
  1625. SimpleReportEnum[] wagas = Arrays.stream(SimpleReportEnum.values()).filter(e -> e.toString().contains("WAGA_")).toArray(SimpleReportEnum[]::new);
  1626. String persId = MapUtils.getString(map,"persId");
  1627. String ifCasePblm = MapUtils.getString(map,"ifCasePblm");
  1628. // 获取水闸问题数据
  1629. WagaParam wagaParam = new WagaParam();
  1630. wagaParam.setIfCasePblm(ifCasePblm);
  1631. wagaParam.setPersId(persId);
  1632. wagaParam.setStartTime(stTm);
  1633. wagaParam.setOrgId(orgId);
  1634. wagaParam.setEndTime(enTm);
  1635. List<BisInspPblm> bisInspBaseDtos = bisInspPblmDao.findWagaPlbmList(wagaParam);
  1636. Arrays.stream(wagas).forEach(waga -> {
  1637. dataMap.put(waga.getValue(), this.getSingleTypePblmListByRever(waga,bisInspBaseDtos));
  1638. });
  1639. // 获取督查水闸数据
  1640. TypeParam typeParam = new TypeParam();
  1641. typeParam.setPresId(persId);
  1642. typeParam.setSttm(stTm);
  1643. typeParam.setOrgId(orgId);
  1644. typeParam.setEntm(enTm);
  1645. typeParam.setInIdsSql(SqlUtils.getinIdsSql(persId,olBisInspOrgService.getProvince(orgId)));
  1646. List<BisInspWagaRgstrDto> list = attWagaRgstrDao.findPcWagaPage(typeParam);
  1647. // 水闸开始综述部分
  1648. // 1.多少个单位
  1649. dataMap.put("wagaRiverNameCountSum",list.stream().map(BisInspWagaRgstrDto::getRiverName).distinct().count());
  1650. // 单位名称列表
  1651. dataMap.put("wagaRiverNames",String.join(",",list.stream().map(BisInspWagaRgstrDto::getRiverName).distinct().collect(Collectors.toList())));
  1652. // 2.多少组
  1653. dataMap.put("wagaGroupCountSum",list.stream().map(BisInspWagaRgstrDto::getGroupId).distinct().count());
  1654. // 3.多少人
  1655. dataMap.put("wagaPersonCountSum",bisInspStatDao.getPersonCount(setOrgIds(String.join(",",list.stream().map(BisInspWagaRgstrDto::getGroupId).distinct().collect(Collectors.toList())))));
  1656. // 4.多少个省
  1657. dataMap.put("wagaProvinceCountSum",list.stream().map(x -> Optional.ofNullable(x.getAdFullName()).orElse("").split("-")[0]).distinct().count());
  1658. // 5.检查水闸多少座
  1659. dataMap.put("wagaCountSum",list.size());
  1660. // 6.发现问题多少项
  1661. dataMap.put("wagaPblmCountSum",bisInspBaseDtos.size());
  1662. // 7.截止多少年多少月多少日 今天吗?
  1663. dataMap.put("nowDate",new SimpleDateFormat("yyyy年MM月dd日").format(new Date()));
  1664. // 8.累计检查水闸多少座
  1665. dataMap.put("allWagaCountSum",bisInspStatDao.getWagaCount());
  1666. // 9.发现问题多少项
  1667. dataMap.put("allWagaPblmCountSum",bisInspStatDao.getWagaPblmCount());
  1668. }
  1669. private void getDcBigPblmDetailByTrack(Map<String, Object> dataMap, String stTm, String enTm, Map<String,Object> map,String orgId) {
  1670. SimpleReportEnum[] tracks = Arrays.stream(SimpleReportEnum.values()).filter(e -> e.toString().contains("TRACK_")).toArray(SimpleReportEnum[]::new);
  1671. String persId = MapUtils.getString(map,"persId");
  1672. String ifCasePblm = MapUtils.getString(map,"ifCasePblm");
  1673. // 获取水毁问题数据
  1674. TrackParam trackParam = new TrackParam();
  1675. trackParam.setIfCasePblm(ifCasePblm);
  1676. trackParam.setPersId(persId);
  1677. trackParam.setStartTime(stTm);
  1678. trackParam.setOrgId(orgId);
  1679. trackParam.setEndTime(enTm);
  1680. List<BisInspPblm> bisInspBaseDtos = bisInspPblmDao.findTrackPlbmList(trackParam);
  1681. Arrays.stream(tracks).forEach(track -> {
  1682. dataMap.put(track.getValue(), this.getSingleTypePblmListByRever(track,bisInspBaseDtos));
  1683. });
  1684. // 获取水毁督查数据
  1685. BisInspWtdstDtoListParam typeParam = new BisInspWtdstDtoListParam();
  1686. typeParam.setPersGuid(persId);
  1687. typeParam.setStartDate(stTm);
  1688. typeParam.setOrgId(orgId);
  1689. typeParam.setEndDate(enTm);
  1690. List<BisInspWtdstDetailDto> list = bisInspWtdstDao.findDtoList(typeParam);
  1691. // 水毁开始综述部分
  1692. // 1.多少个单位
  1693. dataMap.put("trackRiverNameCountSum",list.stream().map(BisInspWtdstDetailDto::getChkCom).distinct().count());
  1694. // 单位名称列表
  1695. dataMap.put("trackRiverNames",String.join(",",list.stream().map(BisInspWtdstDetailDto::getChkCom).distinct().collect(Collectors.toList())));
  1696. // 2.多少组
  1697. dataMap.put("trackGroupCountSum",list.stream().map(BisInspWtdstDetailDto::getGroupNm).distinct().count());
  1698. // 3.多少人
  1699. dataMap.put("trackPersonCountSum",bisInspStatDao.getPersonCount(setOrgIds(String.join(",",list.stream().map(BisInspWtdstDetailDto::getGroupId).distinct().collect(Collectors.toList())))));
  1700. // 4.多少个省
  1701. dataMap.put("trackProvinceCountSum",list.stream().map(x -> Optional.ofNullable(x.getLocNm()).orElse("").split("-")[0]).distinct().count());
  1702. // 5.检查水毁多少座
  1703. dataMap.put("trackCountSum",list.size());
  1704. // 6.发现问题多少项
  1705. dataMap.put("trackPblmCountSum",bisInspBaseDtos.size());
  1706. // 7.截止多少年多少月多少日 今天吗?
  1707. dataMap.put("nowDate",new SimpleDateFormat("yyyy年MM月dd日").format(new Date()));
  1708. // 8.累计检查水毁多少座
  1709. dataMap.put("allTrackCountSum",bisInspStatDao.getTrackCount());
  1710. // 9.发现问题多少项
  1711. dataMap.put("allTrackPblmCountSum",bisInspStatDao.getTrackPblmCount());
  1712. }
  1713. private void getDcBigPblmDetailByRever(Map<String, Object> dataMap, String stTm, String enTm, Map<String,Object> map,String orgId) {
  1714. SimpleReportEnum[] revers = Arrays.stream(SimpleReportEnum.values()).filter(e -> e.toString().contains("REVER_")).toArray(SimpleReportEnum[]::new);
  1715. String persId = MapUtils.getString(map,"persId");
  1716. String ifCasePblm = MapUtils.getString(map,"ifCasePblm");
  1717. // 获取水库问题数据
  1718. ReverParam reverParam = new ReverParam();
  1719. reverParam.setIfCasePblm(ifCasePblm);
  1720. reverParam.setPersId(persId);
  1721. reverParam.setOrgId(orgId);
  1722. reverParam.setStartTime(stTm);
  1723. reverParam.setEndTime(enTm);
  1724. List<BisInspPblm> bisInspBaseDtos = bisInspPblmDao.findReverPlbmList(reverParam);
  1725. Arrays.stream(revers).forEach(rever -> {
  1726. dataMap.put(rever.getValue(), this.getSingleTypePblmListByRever(rever,bisInspBaseDtos));
  1727. });
  1728. // 获取水库督查数据
  1729. TypeParam typeParam = new TypeParam();
  1730. typeParam.setPresId(persId);
  1731. typeParam.setSttm(stTm);
  1732. typeParam.setOrgId(orgId);
  1733. typeParam.setEntm(enTm);
  1734. typeParam.setpType("1");
  1735. List<BisInspRsvrRgstrPcDto> list = bisInspRsvrRgstrDao.findPcPage(typeParam);
  1736. // 水库开始综述部分
  1737. // 1.多少个单位
  1738. dataMap.put("reverRiverNameCountSum",list.stream().map(BisInspRsvrRgstrPcDto::getRiverName).distinct().count());
  1739. // 单位名称
  1740. dataMap.put("reverRiverNames", String.join(",",list.stream().map(BisInspRsvrRgstrPcDto::getRiverName).distinct().collect(Collectors.toList())));
  1741. // 2.多少组
  1742. dataMap.put("reverGroupCountSum",list.stream().map(BisInspRsvrRgstrPcDto::getGroupName).distinct().count());
  1743. // 3.多少人
  1744. dataMap.put("reverPersonCountSum",bisInspStatDao.getPersonCount(setOrgIds(String.join(",",list.stream().map(BisInspRsvrRgstrPcDto::getId).distinct().collect(Collectors.toList())))));
  1745. // 4.多少个省
  1746. dataMap.put("reverProvinceCountSum",list.stream().map(x -> Optional.ofNullable(x.getAdFullName()).orElse("").split("-")[0]).distinct().count());
  1747. // 5.检查水库多少座
  1748. dataMap.put("reverCountSum",list.size());
  1749. // 小I型
  1750. dataMap.put("reverOneCountSum",list.stream().filter(x -> "4".equals(x.getEngScal())).count());
  1751. // 小II型
  1752. dataMap.put("reverTwoCountSum",list.stream().filter(x -> "5".equals(x.getEngScal())).count());
  1753. // 6.发现问题多少项
  1754. dataMap.put("reverPblmCountSum",bisInspBaseDtos.size());
  1755. // 7.截止多少年多少月多少日 今天吗? 先取今天,也有可能是传过来的
  1756. dataMap.put("nowDate",new SimpleDateFormat("yyyy年MM月dd日").format(new Date()));
  1757. // 8.累计检查水库多少座
  1758. dataMap.put("allReverCountSum",bisInspStatDao.getReverCount(null));
  1759. // 小I型
  1760. dataMap.put("allReverOneCountSum",bisInspStatDao.getReverCount("4"));
  1761. // 小II型
  1762. dataMap.put("allReverTwoCountSum",bisInspStatDao.getReverCount("5"));
  1763. // 9.发现问题多少项
  1764. dataMap.put("allReverPblmCountSum",bisInspStatDao.getReverPblmCount(null));
  1765. // 小I型
  1766. dataMap.put("allReverPblmOneCountSum",bisInspStatDao.getReverPblmCount("4"));
  1767. // 小II型
  1768. dataMap.put("allReverPblmTwoCountSum",bisInspStatDao.getReverPblmCount("5"));
  1769. }
  1770. private void getDcBigPblmDetailByVill(Map<String, Object> dataMap, String stTm, String enTm, Map<String,Object> map,String orgId) {
  1771. SimpleReportEnum[] vills = Arrays.stream(SimpleReportEnum.values()).filter(e -> e.toString().contains("VILL_")).toArray(SimpleReportEnum[]::new);
  1772. String persId = MapUtils.getString(map,"persId");
  1773. String ifCasePblm = MapUtils.getString(map,"ifCasePblm");
  1774. VillParam villParam = new VillParam();
  1775. villParam.setIfCasePblm(ifCasePblm);
  1776. villParam.setPersId(persId);
  1777. villParam.setStartTime(stTm);
  1778. villParam.setEndTime(enTm);
  1779. villParam.setOrgId(orgId);
  1780. List<BisInspPblm> bisInspBaseDtos = bisInspPblmDao.findVillPlbmList(villParam);
  1781. List<BisInspPblm> list1 = bisInspBaseDtos.stream().filter(x -> "用水户情况".equals(x.getInspPblmName())).collect(Collectors.toList());
  1782. List<BisInspPblm> list2 = bisInspBaseDtos.stream().filter(x -> "农村饮水工程".equals(x.getInspPblmName())).collect(Collectors.toList());
  1783. List<BisInspPblm> list3 = bisInspBaseDtos.stream().filter(x -> "水源地".equals(x.getInspPblmName())).collect(Collectors.toList());
  1784. // 农饮工程特殊处理
  1785. GetVillPageByNodeIdParam p = new GetVillPageByNodeIdParam();
  1786. p.setNodeId("002");
  1787. p.setStartDate(stTm);
  1788. p.setOrgId(orgId);
  1789. p.setEndDate(enTm);
  1790. List<BisInspVlgdrinkProjManageDcdxDto> list = bisInspVlgdrinkProjManageDao.getPageByNodeId(p);
  1791. Arrays.stream(vills).forEach(vill -> {
  1792. if(vill == VILL_SAFETY1 || vill == VILL_SAFETY2 || vill == VILL_SAFETY3 || vill == VILL_SAFETY4 || vill == VILL_SAFETY5){
  1793. dataMap.put(vill.getValue(), this.getSingleTypePblmListByRever(vill, list1));
  1794. }else if(vill == VILL_SAFETY6 ){
  1795. // 一、运行管理
  1796. // 1.是否24小时不间断供水 1.IS_24H_SUPPLY 1是 0否
  1797. // 2.有无取水许可证 1有 0无 isInsLicence
  1798. // 3.有无卫生许可证 1有 0无 isSanLicence
  1799. List<String> cwsCodeList = list.stream().filter(x -> "1".equals(x.getIs24hSupply()) || "1".equals(x.getIsInsLicence()) || "1".equals(x.getIsSanLicence()))
  1800. .map(BisInspVlgdrinkProjManageDcdxDto::getCwsCode).distinct().collect(Collectors.toList());
  1801. List<BisInspPblm> pblmList = list2.stream().filter(x -> cwsCodeList.contains(x.getCwsCode())).distinct().collect(Collectors.toList());
  1802. dataMap.put(vill.getValue(), this.getSingleTypePblmListByVill(vill, pblmList));
  1803. }else if(vill == VILL_SAFETY7){
  1804. // 二、净化消毒
  1805. // 1.是否配备净化设施设备 1是 0否 isHavecleanEqui
  1806. // 2.是否配备消毒设备 1是 0否 isHavedisinfect
  1807. List<String> cwsCodeList = list.stream().filter(x -> "1".equals(x.getIsHavecleanEqui()) || "1".equals(x.getIsHavedisinfect()))
  1808. .map(BisInspVlgdrinkProjManageDcdxDto::getCwsCode).distinct().collect(Collectors.toList());
  1809. List<BisInspPblm> pblmList = list2.stream().filter(x -> cwsCodeList.contains(x.getCwsCode())).distinct().collect(Collectors.toList());
  1810. dataMap.put(vill.getValue(), this.getSingleTypePblmListByVill(vill, pblmList));
  1811. }else if(vill == VILL_SAFETY8){
  1812. // 三、水质检测
  1813. // 1.有无水质检测报告 1是 0否 isHavereport
  1814. // 2.水质检测是否达标 1是 0否 isQuailtyGood
  1815. // 3.水质是否达标 1是 0否 isDailycheckGood
  1816. List<String> cwsCodeList = list.stream().filter(x -> "1".equals(x.getIsHavereport()) || "1".equals(x.getIsQuailtyGood()) || "1".equals(x.getIsDailycheckGood()))
  1817. .map(BisInspVlgdrinkProjManageDcdxDto::getCwsCode).distinct().collect(Collectors.toList());
  1818. List<BisInspPblm> pblmList = list2.stream().filter(x -> cwsCodeList.contains(x.getCwsCode())).distinct().collect(Collectors.toList());
  1819. dataMap.put(vill.getValue(), this.getSingleTypePblmListByVill(vill, pblmList));
  1820. }else if(vill == VILL_SAFETY9){
  1821. // 四、自动化系统
  1822. // 1.是否配备自动化控制系统 1是 0否 isAutosystem
  1823. // 2.是否正常运行 1是 0否 isAutosysGood
  1824. List<String> cwsCodeList = list.stream().filter(x -> "1".equals(x.getIsAutosystem()) || "1".equals(x.getIsAutosysGood()))
  1825. .map(BisInspVlgdrinkProjManageDcdxDto::getCwsCode).distinct().collect(Collectors.toList());
  1826. List<BisInspPblm> pblmList = list2.stream().filter(x -> cwsCodeList.contains(x.getCwsCode())).distinct().collect(Collectors.toList());
  1827. dataMap.put(vill.getValue(), this.getSingleTypePblmListByVill(vill, pblmList));
  1828. }else if(vill == VILL_SAFETY10){
  1829. // 五、管网、蓄水池
  1830. dataMap.put(vill.getValue(), this.getSingleTypePblmListByVill(vill, new ArrayList<>()));
  1831. }else if(vill == VILL_SAFETY11){
  1832. // 六、其他
  1833. // 1.是否配备视频安防系统 1是 0否 isVideoSystem
  1834. // 2.是否正常运行视频安防系统 1是 0否 isVideosysGood
  1835. List<String> cwsCodeList = list.stream().filter(x -> "1".equals(x.getIsVideoSystem()) || "1".equals(x.getIsVideosysGood()))
  1836. .map(BisInspVlgdrinkProjManageDcdxDto::getCwsCode).distinct().collect(Collectors.toList());
  1837. List<BisInspPblm> pblmList = list2.stream().filter(x -> cwsCodeList.contains(x.getCwsCode())).distinct().collect(Collectors.toList());
  1838. dataMap.put(vill.getValue(), this.getSingleTypePblmListByVill(vill, pblmList));
  1839. }
  1840. else if(vill == VILL_SAFETY12 || vill == VILL_SAFETY13 || vill == VILL_SAFETY14 || vill == VILL_SAFETY15 || vill == VILL_SAFETY16){
  1841. dataMap.put(vill.getValue(), this.getSingleTypePblmListByRever(vill, list3));
  1842. }
  1843. });
  1844. // 人饮开始综述部分
  1845. // 1.多少个单位
  1846. dataMap.put("villRiverNameCountSum",list.stream().map(VillDcdxBaseDto::getChkCom).distinct().count());
  1847. // 单位名称
  1848. dataMap.put("villRiverNames", String.join(",",list.stream().map(VillDcdxBaseDto::getChkCom).distinct().collect(Collectors.toList())));
  1849. // 2.多少组
  1850. dataMap.put("villGroupCountSum",list.stream().map(VillDcdxBaseDto::getGroupNm).distinct().count());
  1851. // 3.多少人
  1852. // 4.多少个省
  1853. dataMap.put("villProvinceCountSum",bisInspBaseDtos.stream().map(x -> Optional.ofNullable(x.getAdFullName()).orElse("").split("-")[0]).distinct().count());
  1854. // 5.检查人饮多少座
  1855. dataMap.put("villCountSum",list.size());
  1856. // 6.发现问题多少项
  1857. dataMap.put("villPblmCountSum",bisInspBaseDtos.size());
  1858. // 7.截止多少年多少月多少日 今天吗? 先取今天,也有可能是传过来的
  1859. dataMap.put("nowDate",new SimpleDateFormat("yyyy年MM月dd日").format(new Date()));
  1860. // 8.累计检查人饮多少座
  1861. // dataMap.put("allVillCountSum",bisInspStatDao.getVillCount(null));
  1862. // 9.发现问题多少项
  1863. // dataMap.put("allVillPblmCountSum",bisInspStatDao.getVillPblmCount(null));
  1864. }
  1865. private LinkedList<HashMap<String, Object>> getSingleTypePblmListByRever(SimpleReportEnum e, List<BisInspPblm> list) {
  1866. // 返回单个问题类型的数据结构
  1867. return new LinkedList<HashMap<String, Object>>() {{
  1868. List<BisInspPblm> itemList = list.stream().filter(x -> e.getTitle().equals(x.getInspPblmsName()) || e.getTitle().equals(x.getInspPblmName())).distinct().collect(Collectors.toList());
  1869. for(int i = 0;i<itemList.size();i++){
  1870. BisInspPblm bisInspPblm = Optional.ofNullable(itemList.get(i)).orElse(new BisInspPblm());
  1871. HashMap<String, Object> itemMap = new HashMap<>(2);
  1872. itemMap.put("content", "(" + (i+1) + ")"
  1873. + Optional.ofNullable(bisInspPblm.getAdFullName()).orElse("").replace("-","") + bisInspPblm.getNm() + ","
  1874. + bisInspPblm.getInspPblmDesc());
  1875. // 获取图片列表
  1876. List<GwComFile> gwFiles = gwComFileService.findFileByBiz(bisInspPblm.getPblmId());
  1877. setImgContent(itemMap,gwFiles);
  1878. add(itemMap);
  1879. }
  1880. }};
  1881. }
  1882. private LinkedList<HashMap<String, Object>> getSingleTypePblmListByVill(SimpleReportEnum e, List<BisInspPblm> itemList) {
  1883. // 返回单个问题类型的数据结构
  1884. return new LinkedList<HashMap<String, Object>>() {{
  1885. for(int i = 0;i<itemList.size();i++){
  1886. BisInspPblm bisInspPblm = itemList.get(i);
  1887. HashMap<String, Object> itemMap = new HashMap<>(2);
  1888. itemMap.put("content", "(" + (i+1) + ")"
  1889. + Optional.ofNullable(bisInspPblm.getAdFullName()).orElse("").replace("-","") + bisInspPblm.getNm() + ","
  1890. + bisInspPblm.getInspPblmDesc());
  1891. // 获取图片列表
  1892. List<GwComFile> gwFiles = gwComFileService.findFileByBiz(bisInspPblm.getPblmId());
  1893. setImgContent(itemMap,gwFiles);
  1894. add(itemMap);
  1895. }
  1896. }};
  1897. }
  1898. private void setImgContent(HashMap<String, Object> itemMap,List<GwComFile> gwFiles){
  1899. itemMap.put("imgs", new LinkedList<HashMap<String, String>>() {{
  1900. Optional.ofNullable(gwFiles).orElse(new ArrayList<GwComFile>() {{
  1901. add(new GwComFile());
  1902. }}).forEach(y -> add(new HashMap<String, String>(2) {{
  1903. logger.debug("图片路径:" + imgPathPrefix.replace("/upload", "") + y.getFilePath() + ".jpg");
  1904. put("href", getImageString(imgPathPrefix.replace("/upload", "") + y.getFilePath() + ".jpg"));
  1905. put("desc", y.getAbs() == null ? "图片描述" : y.getAbs());
  1906. put("name", y.getFilePath());
  1907. put("src", y.getFilePath());
  1908. }}));
  1909. }});
  1910. }
  1911. /**
  1912. * 获取水利工程建设和运行数据
  1913. *
  1914. * @param dataMap 最终数据集
  1915. * @param stTm 开始时间
  1916. * @param enTm 结束时间
  1917. */
  1918. private void getDcBigPblmDetailByKeyReg(Map<String, Object> dataMap, String stTm, String enTm) {
  1919. // 全部的问题个数 数据来源
  1920. List<KeyRegPblm> pblmList = bisInspStatDao.getBigPblmEmpwtNm(stTm, enTm);
  1921. // 包含的工程名称
  1922. List<String> bigPblmEmpwtNmList = pblmList.stream().map(BisInspPblm::getNm).distinct().collect(Collectors.toList());
  1923. List<HashMap<String, Object>> listData = new LinkedList<>();
  1924. // 对这些工程进行逐个详细介绍
  1925. for (String title : bigPblmEmpwtNmList) {
  1926. HashMap<String, Object> map = new HashMap<>();
  1927. // 工程名称
  1928. map.put(TITLE.getValue(), title);
  1929. // 单个工程问题列表
  1930. List<KeyRegPblm> pblmSingle = pblmList.stream().filter(x -> x.getNm().equals(title)).collect(Collectors.toList());
  1931. // 标段名称列表
  1932. List<String> secNameList = pblmSingle.stream().map(KeyRegPblm::getSecName).distinct().filter(StringUtils::isNotBlank).collect(Collectors.toList());
  1933. map.put("secCounts", secNameList.size());
  1934. map.put("secNames", String.join(",", secNameList));
  1935. // 共发现问题多少项
  1936. map.put("pblmSum", pblmSingle.size());
  1937. // 施工单位多少项
  1938. map.put("pblmConsUnitSum", pblmSingle.stream().filter(x -> ILLEGAL_BEHAVIOR4.getValue().equals(x.getReviOrg())).collect(Collectors.toList()).size());
  1939. // 设计单位多少项
  1940. map.put("pblmDesiUnitSum", pblmSingle.stream().filter(x -> ILLEGAL_BEHAVIOR2.getValue().equals(x.getReviOrg())).collect(Collectors.toList()).size());
  1941. SimpleReportEnum[] illegals = SimpleReportEnum.values();
  1942. for (SimpleReportEnum illegal : illegals) {
  1943. if (illegal == ILLEGAL_BEHAVIOR1 || illegal == ILLEGAL_BEHAVIOR2 || illegal == ILLEGAL_BEHAVIOR3 || illegal == ILLEGAL_BEHAVIOR4
  1944. || illegal == ILLEGAL_BEHAVIOR5 || illegal == ILLEGAL_BEHAVIOR6 || illegal == ILLEGAL_BEHAVIOR7 || illegal == MASS_DEFECT) {
  1945. // 单个工程开始循环添加各类工程问题
  1946. map.put(illegal.getValue(), new LinkedList<HashMap<String, Object>>() {{
  1947. List<KeyRegPblm> itemList = pblmSingle.stream().filter(x -> illegal.getTitle().equals(
  1948. illegal == MASS_DEFECT ? x.getInspPblmName() : x.getReviOrg()
  1949. )).collect(Collectors.toList());
  1950. for (int i = 0; i < itemList.size(); i++) {
  1951. HashMap<String, Object> itemMap = new HashMap<>(2);
  1952. itemMap.put("content", "(" + (i + 1) + ")" + itemList.get(i).getSecName() + itemList.get(i).getInspPblmDesc());
  1953. // 获取图片列表
  1954. List<GwComFile> gwFiles = gwComFileService.findFileByBiz(itemList.get(i).getPblmId());
  1955. itemMap.put("imgs", new LinkedList<HashMap<String, String>>() {{
  1956. Optional.ofNullable(gwFiles).orElse(new ArrayList<GwComFile>() {{
  1957. add(new GwComFile());
  1958. }}).forEach(y -> {
  1959. add(new HashMap<String, String>(2) {{
  1960. String href = imgPathPrefix.replace("/upload", "") + y.getFilePath() + ".jpg";
  1961. logger.debug("图片路径:" + href);
  1962. put("href", getImageString(href));
  1963. put("desc", y.getAbs() == null ? "图片描述" + y.getFilePath() : y.getAbs());
  1964. put("name", y.getFilePath());
  1965. put("src", y.getFilePath());
  1966. }});
  1967. });
  1968. }});
  1969. add(itemMap);
  1970. }
  1971. }});
  1972. }
  1973. }
  1974. listData.add(map);
  1975. }
  1976. dataMap.put("bigPblmEmpwtNmListDetail", listData);
  1977. }
  1978. private Map<String, Object> getDcBigPblmDesc(Map<String, Object> dataMap, String stTm, String enTm) {
  1979. try {
  1980. // 1.指定时间内存在典型问题的水利工程建设名称
  1981. List<String> bigPblmEmpwtNmList = bisInspStatDao.getBigPblmEmpwtNm(stTm, enTm).stream().map(x -> x.getNm() + ":## ").distinct().collect(Collectors.toList());
  1982. dataMap.put("bigPblmEmpwtNmList", bigPblmEmpwtNmList);
  1983. // 2.指定时间内存在典型问题的水利工程运行名称
  1984. // TODO:暂时跳过
  1985. // 3.指定时间内存在典型问题的水库的名称
  1986. // 4.其他类型的,暂时写死
  1987. } catch (Exception e) {
  1988. e.printStackTrace();
  1989. }
  1990. return dataMap;
  1991. }
  1992. public String getMapString(Map<String, Object> map) {
  1993. String text = "";
  1994. for (String key : map.keySet()) {
  1995. text += map.get(key) + ",";
  1996. }
  1997. if (text.length() > 0) {
  1998. text = text.substring(0, text.length() - 1);
  1999. }
  2000. return text;
  2001. }
  2002. /**
  2003. * 督查办-获取督查办督查组和人员信息
  2004. *
  2005. * @param dataMap Map<String, Object>
  2006. * @param stTm 开始时间
  2007. * @param enTm 结束时间
  2008. * @return dataMap
  2009. */
  2010. public Map<String, Object> getDcInfo(Map<String, Object> dataMap, String stTm, String enTm) {
  2011. List<BisInspStatGroupInfoDto> bisInspStatGroupInfoDtoList = bisInspStatDao.getDcGroupInfo(stTm, enTm);
  2012. int dcGroupSize = 0;
  2013. int dcGroupPersonSize = 0;
  2014. Map<String, Object> dcTypeMap = new HashMap<>();
  2015. for (BisInspStatGroupInfoDto bisInspStatGroupInfoDto : bisInspStatGroupInfoDtoList) {
  2016. if (bisInspStatGroupInfoDto.getId().length() == 12) {
  2017. dcGroupSize++;
  2018. int curentPerCon = bisInspStatGroupInfoDto.getPersCoun() == null ? 0 : Integer.parseInt(bisInspStatGroupInfoDto.getPersCoun());
  2019. dcGroupPersonSize = dcGroupPersonSize + curentPerCon;
  2020. String dcType = bisInspStatGroupInfoDto.getId().substring(0, 3);
  2021. for (BisInspEnum enums : BisInspEnum.values()) {
  2022. if (dcType.equals(enums.getRlation())) {
  2023. dcTypeMap.put(dcType, enums.getDesc());
  2024. }
  2025. }
  2026. }
  2027. }
  2028. //督查组总数
  2029. dataMap.put("dcGroup", dcGroupSize);
  2030. //督查组人员总数
  2031. dataMap.put("dcGropuPerson", dcGroupPersonSize);
  2032. //开始时间到结束时间共督查多少种类型
  2033. dataMap.put("dcTypeList", this.getMapString(dcTypeMap));
  2034. return dataMap;
  2035. }
  2036. /**
  2037. * 督查办-获取APP版本信息
  2038. *
  2039. * @param dataMap Map<String, Object>
  2040. * @return dataMap
  2041. */
  2042. public Map<String, Object> getVesionInfo(Map<String, Object> dataMap) {
  2043. Version version = versionDao.getLatestVersion();
  2044. //最新版本号
  2045. dataMap.put("newAppVersion", version.getAppName());
  2046. //共更新多少次
  2047. dataMap.put("appVersionCount", version.getCon());
  2048. //最后更新内容
  2049. dataMap.put("updateCon", version.getUpdateContent());
  2050. return dataMap;
  2051. }
  2052. /**
  2053. * 流域机构-获取流域督查组和人员信息
  2054. *
  2055. * @param dataMap Map<String, Object>
  2056. * @param stTm 开始时间
  2057. * @param enTm 结束时间
  2058. * @return dataMap
  2059. */
  2060. public Map<String, Object> getDcBsInfo(Map<String, Object> dataMap, String stTm, String enTm) {
  2061. List<BisInspStatGroupInfoDto> bisInspStatGroupInfoDtoList = bisInspStatDao.getBsGroupInfo(stTm, enTm);
  2062. int dcGroupSize = 0;
  2063. int dcGroupPersonSize = 0;
  2064. int dcBsSize = 0;
  2065. Map<String, Object> dcBsMap = new HashMap<>();
  2066. Map<String, Object> dcTypeMap = new HashMap<>();
  2067. Map<String, Object> dcBsNot = new HashMap<>();
  2068. for (BisInspStatGroupInfoDto bisInspStatGroupInfoDto : bisInspStatGroupInfoDtoList) {
  2069. if (bisInspStatGroupInfoDto.getId().length() == 12) {
  2070. dcGroupSize++;
  2071. int curentPerCon = bisInspStatGroupInfoDto.getPersCoun() == null ? 0 : Integer.parseInt(bisInspStatGroupInfoDto.getPersCoun());
  2072. dcGroupPersonSize = dcGroupPersonSize + curentPerCon;
  2073. String dcType = bisInspStatGroupInfoDto.getId().substring(0, 3);
  2074. dcBsMap.put(bisInspStatGroupInfoDto.getDepId(), bisInspStatGroupInfoDto.getDepNm());
  2075. for (BisInspEnum enums : BisInspEnum.values()) {
  2076. if (dcType.equals(enums.getRlation())) {
  2077. dcTypeMap.put(dcType, enums.getDesc());
  2078. }
  2079. }
  2080. }
  2081. }
  2082. //找出不在结果集里
  2083. for (BisInspBsEnum enums : BisInspBsEnum.values()) {
  2084. if (null == dcBsMap.get(enums.getKey())) {
  2085. dcBsNot.put(enums.getKey(), enums.getDesc());
  2086. }
  2087. }
  2088. //流域机构个数
  2089. dataMap.put("dcBsSize", dcBsMap.keySet().size());
  2090. //流域机构个数
  2091. dataMap.put("dcBsGroup", dcGroupSize);
  2092. //督查组人员总数
  2093. dataMap.put("dcBsGropuPerson", dcGroupPersonSize);
  2094. //开始时间到结束时间共督查多少种类型
  2095. dataMap.put("dcBsTypeList", getMapString(dcTypeMap));
  2096. //开始时间到结束时间共督查多少种类型
  2097. dataMap.put("dcBsNot", getMapString(dcBsNot));
  2098. return dataMap;
  2099. }
  2100. /**
  2101. * 督查工作-获取督查组反馈情况信息
  2102. *
  2103. * @param dataMap Map<String, Object>
  2104. * @return dataMap
  2105. */
  2106. public Map<String, Object> getDcRegsitInfo(Map<String, Object> dataMap, String stTm, String enTm) {
  2107. List<BisInspStatGroupInfoDto> bisInspStatGroupInfoDtoList = bisInspStatDao.getDcRegsitInfo(stTm, enTm);
  2108. // TODO: 待实现
  2109. return dataMap;
  2110. }
  2111. }