ad92f2b1cb294c4c8194d23099b1d05b32d56de2.svn-base 49 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840
  1. package cn.com.goldenwater.dcproj.service.impl.homepage;
  2. import cn.com.goldenwater.dcproj.constValue.AdCodeLabel;
  3. import cn.com.goldenwater.dcproj.constValue.BisInspEnum;
  4. import cn.com.goldenwater.dcproj.constValue.BisInspTypeEnum;
  5. import cn.com.goldenwater.dcproj.dao.BisInspAllObjDao;
  6. import cn.com.goldenwater.dcproj.dao.BisInspAllRlationPersDao;
  7. import cn.com.goldenwater.dcproj.dao.BisInspPblmDao;
  8. import cn.com.goldenwater.dcproj.dao.PersPositionDao;
  9. import cn.com.goldenwater.dcproj.dto.*;
  10. import cn.com.goldenwater.dcproj.model.BisInspPblm;
  11. import cn.com.goldenwater.dcproj.model.DuchaObj;
  12. import cn.com.goldenwater.dcproj.model.ObjPerson;
  13. import cn.com.goldenwater.dcproj.param.IndexParam;
  14. import cn.com.goldenwater.dcproj.param.IndexParamPage;
  15. import cn.com.goldenwater.dcproj.param.IndexPblmParam;
  16. import cn.com.goldenwater.dcproj.service.OlBisInspOrgService;
  17. import cn.com.goldenwater.dcproj.service.PcIndexService;
  18. import cn.com.goldenwater.dcproj.utils.AdLevelUtil;
  19. import cn.com.goldenwater.dcproj.utils.EnumUtil;
  20. import cn.com.goldenwater.dcproj.utils.InspUtils;
  21. import com.github.pagehelper.PageHelper;
  22. import com.github.pagehelper.PageInfo;
  23. import org.apache.commons.lang3.StringUtils;
  24. import org.springframework.beans.factory.annotation.Autowired;
  25. import org.springframework.stereotype.Service;
  26. import org.springframework.transaction.annotation.Transactional;
  27. import java.text.SimpleDateFormat;
  28. import java.time.LocalDate;
  29. import java.time.LocalDateTime;
  30. import java.time.format.DateTimeFormatter;
  31. import java.time.temporal.TemporalAdjusters;
  32. import java.util.*;
  33. @Service
  34. @Transactional
  35. public class PcIndexServiceImpl implements PcIndexService {
  36. @Autowired
  37. private BisInspPblmDao inspPblmDao;
  38. @Autowired
  39. private BisInspAllObjDao inspAllObjDao;
  40. @Autowired
  41. private BisInspAllRlationPersDao bisInspAllRlationPersDao;
  42. @Autowired
  43. private PersPositionDao persPositionDao;
  44. @Autowired
  45. private OlBisInspOrgService inspOrgService;
  46. @Override
  47. public Map<String, String> timeCount(String orgId) {
  48. LocalDateTime time = LocalDateTime.now();
  49. DateTimeFormatter dtf2 = DateTimeFormatter.ofPattern("yyyy-MM-dd");
  50. //获取天
  51. String dayDesc = dtf2.format(time);
  52. BisInspPblm bisInspPblm = new BisInspPblm();
  53. bisInspPblm.setProvince(inspOrgService.getProvince(orgId));
  54. bisInspPblm.setFindTime(dayDesc);
  55. int total = inspPblmDao.selectCount(bisInspPblm);
  56. bisInspPblm.setFindTime(null);
  57. Map<String, String> params = new HashMap<>();
  58. params.put("day", total + "");
  59. dtf2 = DateTimeFormatter.ofPattern("yyyy-MM");
  60. String monthDesc = dtf2.format(time);
  61. bisInspPblm.setMonthTime(monthDesc);
  62. total = inspPblmDao.selectCount(bisInspPblm);
  63. bisInspPblm.setMonthTime(null);
  64. params.put("month", total + "");
  65. //获取一周内数据
  66. //改为周一到当前时间
  67. String weekTme = LocalDate.now().minusDays(LocalDate.now().getDayOfWeek().getValue() - 1).format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
  68. bisInspPblm.setStartTime(weekTme);
  69. total = inspPblmDao.selectCount(bisInspPblm);
  70. params.put("week", total + "");
  71. return params;
  72. }
  73. @Override
  74. public List<DcTypeDto> countGroup(IndexParam indexParam) {
  75. indexParam.setOrgIds(InspUtils.setOrgIds(indexParam.getOrgIds()));
  76. List<DcTypeDto> list = inspAllObjDao.countGroup(getIndexParam(indexParam));
  77. Map<String,DcTypeDto> map = this.convertToTree(list);
  78. return new ArrayList<DcTypeDto>(map.values());
  79. }
  80. private Map<String,DcTypeDto> convertToTree(List<DcTypeDto> list){
  81. Map<String,DcTypeDto> map = new TreeMap<>(String::compareTo);
  82. for (DcTypeDto dcTypeDto : list) {
  83. BisInspTypeEnum typeEnum = EnumUtil.getBisInspTypeEnum(dcTypeDto.getObjType());
  84. if (typeEnum == null) {
  85. DcTypeDto otherDto = null;
  86. if (map.keySet().contains("其他类")) {
  87. otherDto = map.get("其他类");
  88. } else {
  89. otherDto = new DcTypeDto();
  90. otherDto.setTotal("0");
  91. otherDto.setName("其他类");
  92. otherDto.setLevel("1");
  93. otherDto.setChildren(new ArrayList<>());
  94. map.put("其他类",otherDto);
  95. }
  96. otherDto.setTotal(Long.valueOf(otherDto.getTotal())+ Long.valueOf(dcTypeDto.getTotal()) + "");
  97. otherDto.getChildren().add(dcTypeDto);
  98. } else {
  99. if (!map.containsKey(typeEnum.getParentCode())) {
  100. DcTypeDto dto = new DcTypeDto();
  101. dto.setLevel("1");
  102. List<DcTypeDto> child = new ArrayList<>();
  103. child.add(dcTypeDto);
  104. dto.setChildren(child);
  105. dto.setName(typeEnum.getParentName());
  106. dto.setTotal(dcTypeDto.getTotal());
  107. map.put(typeEnum.getParentCode(),dto);
  108. } else {
  109. DcTypeDto dto = map.get(typeEnum.getParentCode());
  110. dto.setTotal(Long.valueOf(dto.getTotal())+Long.valueOf(dcTypeDto.getTotal()) + "");
  111. dto.getChildren().add(dcTypeDto);
  112. }
  113. }
  114. }
  115. return map;
  116. }
  117. @Override
  118. public List<DcTypeDto> countPerson(IndexParam indexParam) {
  119. indexParam.setOrgIds(InspUtils.setOrgIds(indexParam.getOrgIds()));
  120. Map<String,DcTypeDto> map = this.convertToTree(inspAllObjDao.countPerson(getIndexParam(indexParam)));
  121. return new ArrayList<DcTypeDto>(map.values());
  122. }
  123. @Override
  124. public List<DcTypeDto> countDucha(IndexParam indexParam) {
  125. indexParam.setOrgIds(InspUtils.setOrgIds(indexParam.getOrgIds()));
  126. List<DcTypeDto> list = inspAllObjDao.countDcByType(getIndexParam(indexParam));
  127. Map<String,DcTypeDto> map = this.convertToTree(list);
  128. return new ArrayList<DcTypeDto>(map.values());
  129. }
  130. @Override
  131. public List<DcTypeDto> countPblmByType(IndexParam indexParam) {
  132. indexParam.setOrgIds(InspUtils.setOrgIds(indexParam.getOrgIds()));
  133. List<DcTypeDto> typeDtoList = inspAllObjDao.countPblmByType(getIndexParam(indexParam));
  134. Map<String,DcTypeDto> map = this.convertToTree(typeDtoList);
  135. return new ArrayList<DcTypeDto>(map.values());
  136. }
  137. private List<DcTypeDto> getTypeDto(List<DcTypeDto> typeDtoList) {
  138. for (DcTypeDto typeDto : typeDtoList) {
  139. String name = typeDto.getName();
  140. if (BisInspEnum.REVER.getDesc().equals(name)) {
  141. typeDto.setObjType(BisInspEnum.REVER.getValue());
  142. }
  143. if (BisInspEnum.VILL.getDesc().equals(name)) {
  144. typeDto.setObjType(BisInspEnum.VILL.getValue());
  145. }
  146. if (BisInspEnum.TRACK.getDesc().equals(name)) {
  147. typeDto.setObjType(BisInspEnum.TRACK.getValue());
  148. }
  149. if (BisInspEnum.EMPWT.getDesc().equals(name)) {
  150. typeDto.setObjType(BisInspEnum.EMPWT.getValue());
  151. }
  152. if (BisInspEnum.EMPWTRUN.getDesc().equals(name)) {
  153. typeDto.setObjType(BisInspEnum.EMPWTRUN.getValue());
  154. }
  155. if (BisInspEnum.GRW.getDesc().equals(name)) {
  156. typeDto.setObjType(BisInspEnum.GRW.getValue());
  157. }
  158. if (BisInspEnum.WAGA.getDesc().equals(name)) {
  159. typeDto.setObjType(BisInspEnum.WAGA.getValue());
  160. }
  161. }
  162. //省级只保留 小水库和人饮
  163. for (int i = typeDtoList.size() - 1; i >= 0; i--) {
  164. String objType = typeDtoList.get(i).getObjType();
  165. if (!objType.equalsIgnoreCase(BisInspEnum.VILL.getValue()) && !objType.equalsIgnoreCase(BisInspEnum.REVER.getValue())
  166. ) {
  167. typeDtoList.remove(i);
  168. }
  169. }
  170. return typeDtoList;
  171. }
  172. @Override
  173. public List<DcTypeDto> countPlanByOrgOrType(String type, String orgId) {
  174. IndexParam indexParam = new IndexParam();
  175. if ("pType".equals(type)) {
  176. return inspAllObjDao.countObjByType(getIndexParam(indexParam));
  177. }
  178. return inspAllObjDao.countObjByOrg(getIndexParam(indexParam));
  179. }
  180. @Override
  181. public List<DcTypeDto> countPlan(IndexParam indexParam) {
  182. indexParam.setOrgIds(InspUtils.setOrgIds(indexParam.getOrgIds()));
  183. return inspAllObjDao.countObjbyParam(getIndexParam(indexParam));
  184. }
  185. @Override
  186. public List<DcTypeDto> countPlanByPro(IndexParam indexParam) {
  187. indexParam.setOrgIds(InspUtils.setOrgIds(indexParam.getOrgIds()));
  188. return inspAllObjDao.countPlanByPro(getIndexParam(indexParam));
  189. }
  190. @Override
  191. public List<DcTypeDto> countPblm(IndexParam indexParam) {
  192. indexParam.setOrgIds(InspUtils.setOrgIds(indexParam.getOrgIds()));
  193. List<DcTypeDto> typeDtoList = inspAllObjDao.countPblmbyParam(getIndexParam(indexParam));
  194. for (DcTypeDto typeDto : typeDtoList) {
  195. indexParam.setpTypes(typeDto.getObjType());
  196. List<DcPblmDto> pblmDtoList = inspAllObjDao.countPblmByObjType(getIndexParam(indexParam));
  197. typeDto.setPblmDtoList(pblmDtoList);
  198. }
  199. Map<String,DcTypeDto> map = this.convertToTree(typeDtoList);
  200. return new ArrayList<DcTypeDto>(map.values());
  201. }
  202. @Override
  203. public List<DcTypeDto> countGroupByPro(IndexParam indexParam) {
  204. indexParam.setOrgIds(InspUtils.setOrgIds(indexParam.getOrgIds()));
  205. return inspAllObjDao.countGroupByPro(getIndexParam(indexParam));
  206. }
  207. @Override
  208. public List<DcTypeDto> countPersonByPro(IndexParam indexParam) {
  209. indexParam.setOrgIds(InspUtils.setOrgIds(indexParam.getOrgIds()));
  210. return inspAllObjDao.countPersonByPro(getIndexParam(indexParam));
  211. }
  212. @Override
  213. public List<DcPblmDto> countPblmByPro(IndexParam indexParam) {
  214. indexParam.setOrgIds(InspUtils.setOrgIds(indexParam.getOrgIds()));
  215. List<DcPblmDto> typeDtoList = inspAllObjDao.countPblmbyPro(getIndexParam(indexParam));
  216. List<String> pblmDtoList = new ArrayList<>();
  217. List<DcPblmDto> typeDtoes = new ArrayList<>();
  218. for (DcPblmDto pblmDto : typeDtoList) {
  219. if (!pblmDtoList.contains(pblmDto.getName())) {
  220. pblmDtoList.add(pblmDto.getName());
  221. }
  222. }
  223. for (String str : pblmDtoList) {
  224. DcPblmDto dto = new DcPblmDto();
  225. dto.setName(str);
  226. int total = 0;
  227. List<DcPblmDto> dtoList = new ArrayList<>();
  228. for (DcPblmDto pblmDto : typeDtoList) {
  229. if (pblmDto.getName().equals(str)) {
  230. dto.setAdCode(pblmDto.getAdCode());
  231. total += pblmDto.getTotal();
  232. dtoList.add(pblmDto);
  233. }
  234. }
  235. dto.setPblmDtoList(dtoList);
  236. dto.setTotal(total);
  237. typeDtoes.add(dto);
  238. }
  239. return typeDtoes;
  240. }
  241. @Override
  242. public PersOnlineDto countPersOnline(IndexParam indexParam) {
  243. if (StringUtils.isBlank(indexParam.getEndTime())) {
  244. SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  245. Calendar calendar = Calendar.getInstance();
  246. indexParam.setEndTime(sdf.format(calendar.getTime()));
  247. calendar.set(Calendar.HOUR, calendar.get(Calendar.HOUR) - 2);
  248. indexParam.setStartTime(sdf.format(calendar.getTime()));
  249. }
  250. int ret = bisInspAllRlationPersDao.selectCountOnlinePers(indexParam.getStartTime(), indexParam.getEndTime(), indexParam.getOrgId());
  251. int retgroup = persPositionDao.countGroupOnline(indexParam.getStartTime(), indexParam.getEndTime(), indexParam.getOrgId());
  252. PersOnlineDto pers = new PersOnlineDto();
  253. pers.setCountGroup(retgroup);
  254. pers.setCountPers(ret);
  255. return pers;
  256. }
  257. @Override
  258. public List<CountTime> countPblmByTime(IndexPblmParam indexPblmParam) {
  259. if (!StringUtils.isEmpty(indexPblmParam.getOrgIds())) {
  260. indexPblmParam.setOrgIds(InspUtils.setOrgIds(indexPblmParam.getOrgIds()));
  261. }
  262. if (!StringUtils.isEmpty(indexPblmParam.getAdCode())) {
  263. Map<String, Object> map = AdLevelUtil.SubAd(indexPblmParam.getAdCode());
  264. indexPblmParam.setAdCode(String.valueOf(map.get("subAd")));
  265. }
  266. if (!StringUtils.isEmpty(indexPblmParam.getType())) {
  267. indexPblmParam.setType(InspUtils.setOrgIds(indexPblmParam.getType()));
  268. }
  269. List<CountTime> list = new ArrayList<>();
  270. indexPblmParam = getIndexPblmParam(indexPblmParam);
  271. if (!"".equals(indexPblmParam.getPblmState()) && "inc".equals(indexPblmParam.getPblmState())) {
  272. switch (indexPblmParam.getDtype()) {
  273. case "day":
  274. DateTimeFormatter dtfDay = DateTimeFormatter.ofPattern("yyyy-MM-dd");
  275. LocalDate dttm = LocalDate.parse(indexPblmParam.getEttm(), dtfDay);
  276. if (StringUtils.isEmpty(indexPblmParam.getSttm())) {
  277. indexPblmParam.setSttm(dttm.minusDays(6).format(dtfDay));
  278. }
  279. indexPblmParam.setSeltime(dttm.minusDays(6).format(dtfDay));
  280. list.addAll(inspPblmDao.countPblmIncByDay(indexPblmParam));
  281. break;
  282. case "week":
  283. int currWeekCount = 0;
  284. int oneWeekCount = 0;
  285. int twoWeekCount = 0;
  286. int tWeekCount = 0;
  287. int fWeekCount = 0;
  288. DateTimeFormatter dtfWeek = DateTimeFormatter.ofPattern("yyyy-MM-dd");
  289. LocalDate dtWeek = LocalDate.parse(indexPblmParam.getEttm(), dtfWeek);
  290. if (StringUtils.isEmpty(indexPblmParam.getSttm())) {
  291. indexPblmParam.setSttm(dtWeek.minusDays(dtWeek.getDayOfWeek().getValue() - 1).format(dtfWeek));
  292. currWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
  293. indexPblmParam.setSttm(dtWeek.minusWeeks(1).minusDays(dtWeek.getDayOfWeek().getValue() - 1).format(dtfWeek));
  294. indexPblmParam.setEttm(dtWeek.minusWeeks(1).minusDays(dtWeek.getDayOfWeek().getValue() - 1).plusDays(6).format(dtfWeek));
  295. oneWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
  296. indexPblmParam.setSttm(dtWeek.minusWeeks(2).minusDays(dtWeek.getDayOfWeek().getValue() - 1).format(dtfWeek));
  297. indexPblmParam.setEttm(dtWeek.minusWeeks(2).minusDays(dtWeek.getDayOfWeek().getValue() - 1).plusDays(6).format(dtfWeek));
  298. twoWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
  299. indexPblmParam.setSttm(dtWeek.minusWeeks(3).minusDays(dtWeek.getDayOfWeek().getValue() - 1).format(dtfWeek));
  300. indexPblmParam.setEttm(dtWeek.minusWeeks(3).minusDays(dtWeek.getDayOfWeek().getValue() - 1).plusDays(6).format(dtfWeek));
  301. tWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
  302. indexPblmParam.setSttm(dtWeek.minusWeeks(4).minusDays(dtWeek.getDayOfWeek().getValue() - 1).format(dtfWeek));
  303. indexPblmParam.setEttm(dtWeek.minusWeeks(4).minusDays(dtWeek.getDayOfWeek().getValue() - 1).plusDays(6).format(dtfWeek));
  304. fWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
  305. } else {
  306. String sttm = indexPblmParam.getSttm();
  307. if (dtWeek.minusDays(dtWeek.getDayOfWeek().getValue() - 1).format(dtfWeek).compareTo(sttm) <= 0) {
  308. currWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
  309. } else if (dtWeek.minusWeeks(1).minusDays(dtWeek.getDayOfWeek().getValue() - 1).format(dtfWeek).compareTo(sttm) <= 0) {
  310. indexPblmParam.setSttm(dtWeek.minusDays(dtWeek.getDayOfWeek().getValue() - 1).format(dtfWeek));
  311. currWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
  312. indexPblmParam.setSttm(sttm);
  313. indexPblmParam.setEttm(dtWeek.minusWeeks(1).minusDays(dtWeek.getDayOfWeek().getValue() - 1).plusDays(6).format(dtfWeek));
  314. oneWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
  315. } else if (dtWeek.minusWeeks(2).minusDays(dtWeek.getDayOfWeek().getValue() - 1).format(dtfWeek).compareTo(sttm) <= 0) {
  316. indexPblmParam.setSttm(dtWeek.minusDays(dtWeek.getDayOfWeek().getValue() - 1).format(dtfWeek));
  317. currWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
  318. indexPblmParam.setSttm(dtWeek.minusWeeks(1).minusDays(dtWeek.getDayOfWeek().getValue() - 1).format(dtfWeek));
  319. indexPblmParam.setEttm(dtWeek.minusWeeks(1).minusDays(dtWeek.getDayOfWeek().getValue() - 1).plusDays(6).format(dtfWeek));
  320. oneWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
  321. indexPblmParam.setSttm(sttm);
  322. indexPblmParam.setEttm(dtWeek.minusWeeks(2).minusDays(dtWeek.getDayOfWeek().getValue() - 1).plusDays(6).format(dtfWeek));
  323. twoWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
  324. } else if (dtWeek.minusWeeks(3).minusDays(dtWeek.getDayOfWeek().getValue() - 1).format(dtfWeek).compareTo(sttm) <= 0) {
  325. indexPblmParam.setSttm(dtWeek.minusDays(dtWeek.getDayOfWeek().getValue() - 1).format(dtfWeek));
  326. currWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
  327. indexPblmParam.setSttm(dtWeek.minusWeeks(1).minusDays(dtWeek.getDayOfWeek().getValue() - 1).format(dtfWeek));
  328. indexPblmParam.setEttm(dtWeek.minusWeeks(1).minusDays(dtWeek.getDayOfWeek().getValue() - 1).plusDays(6).format(dtfWeek));
  329. oneWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
  330. indexPblmParam.setSttm(dtWeek.minusWeeks(2).minusDays(dtWeek.getDayOfWeek().getValue() - 1).format(dtfWeek));
  331. indexPblmParam.setEttm(dtWeek.minusWeeks(2).minusDays(dtWeek.getDayOfWeek().getValue() - 1).plusDays(6).format(dtfWeek));
  332. twoWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
  333. indexPblmParam.setSttm(sttm);
  334. indexPblmParam.setEttm(dtWeek.minusWeeks(3).minusDays(dtWeek.getDayOfWeek().getValue() - 1).plusDays(6).format(dtfWeek));
  335. tWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
  336. } else if (dtWeek.minusWeeks(4).minusDays(dtWeek.getDayOfWeek().getValue() - 1).format(dtfWeek).compareTo(sttm) <= 0) {
  337. indexPblmParam.setSttm(dtWeek.minusDays(dtWeek.getDayOfWeek().getValue() - 1).format(dtfWeek));
  338. currWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
  339. indexPblmParam.setSttm(dtWeek.minusWeeks(1).minusDays(dtWeek.getDayOfWeek().getValue() - 1).format(dtfWeek));
  340. indexPblmParam.setEttm(dtWeek.minusWeeks(1).minusDays(dtWeek.getDayOfWeek().getValue() - 1).plusDays(6).format(dtfWeek));
  341. oneWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
  342. indexPblmParam.setSttm(dtWeek.minusWeeks(2).minusDays(dtWeek.getDayOfWeek().getValue() - 1).format(dtfWeek));
  343. indexPblmParam.setEttm(dtWeek.minusWeeks(2).minusDays(dtWeek.getDayOfWeek().getValue() - 1).plusDays(6).format(dtfWeek));
  344. twoWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
  345. indexPblmParam.setSttm(dtWeek.minusWeeks(3).minusDays(dtWeek.getDayOfWeek().getValue() - 1).format(dtfWeek));
  346. indexPblmParam.setEttm(dtWeek.minusWeeks(3).minusDays(dtWeek.getDayOfWeek().getValue() - 1).plusDays(6).format(dtfWeek));
  347. tWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
  348. indexPblmParam.setSttm(sttm);
  349. indexPblmParam.setEttm(dtWeek.minusWeeks(4).minusDays(dtWeek.getDayOfWeek().getValue() - 1).plusDays(6).format(dtfWeek));
  350. fWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
  351. } else {
  352. indexPblmParam.setSttm(dtWeek.minusDays(dtWeek.getDayOfWeek().getValue() - 1).format(dtfWeek));
  353. currWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
  354. indexPblmParam.setSttm(dtWeek.minusWeeks(1).minusDays(dtWeek.getDayOfWeek().getValue() - 1).format(dtfWeek));
  355. indexPblmParam.setEttm(dtWeek.minusWeeks(1).minusDays(dtWeek.getDayOfWeek().getValue() - 1).plusDays(6).format(dtfWeek));
  356. oneWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
  357. indexPblmParam.setSttm(dtWeek.minusWeeks(2).minusDays(dtWeek.getDayOfWeek().getValue() - 1).format(dtfWeek));
  358. indexPblmParam.setEttm(dtWeek.minusWeeks(2).minusDays(dtWeek.getDayOfWeek().getValue() - 1).plusDays(6).format(dtfWeek));
  359. twoWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
  360. indexPblmParam.setSttm(dtWeek.minusWeeks(3).minusDays(dtWeek.getDayOfWeek().getValue() - 1).format(dtfWeek));
  361. indexPblmParam.setEttm(dtWeek.minusWeeks(3).minusDays(dtWeek.getDayOfWeek().getValue() - 1).plusDays(6).format(dtfWeek));
  362. tWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
  363. indexPblmParam.setSttm(dtWeek.minusWeeks(4).minusDays(dtWeek.getDayOfWeek().getValue() - 1).format(dtfWeek));
  364. indexPblmParam.setEttm(dtWeek.minusWeeks(4).minusDays(dtWeek.getDayOfWeek().getValue() - 1).plusDays(6).format(dtfWeek));
  365. fWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
  366. }
  367. }
  368. CountTime currCount = new CountTime();
  369. currCount.setName("本周");
  370. currCount.setValue(currWeekCount);
  371. CountTime oneCount = new CountTime();
  372. oneCount.setName("前1周");
  373. oneCount.setValue(oneWeekCount);
  374. CountTime twoCount = new CountTime();
  375. twoCount.setName("前2周");
  376. twoCount.setValue(twoWeekCount);
  377. CountTime threeCount = new CountTime();
  378. threeCount.setName("前3周");
  379. threeCount.setValue(tWeekCount);
  380. CountTime fourCount = new CountTime();
  381. fourCount.setName("前4周");
  382. fourCount.setValue(fWeekCount);
  383. list.add(fourCount);
  384. list.add(threeCount);
  385. list.add(twoCount);
  386. list.add(oneCount);
  387. list.add(currCount);
  388. break;
  389. case "month":
  390. DateTimeFormatter dtfMon = DateTimeFormatter.ofPattern("yyyy-MM-dd");
  391. LocalDate dtMon = LocalDate.parse(indexPblmParam.getEttm(), dtfMon);
  392. if (StringUtils.isEmpty(indexPblmParam.getSttm())) {
  393. indexPblmParam.setSttm(dtMon.minusMonths(4).format(dtfMon));
  394. }
  395. indexPblmParam.setSeltime(dtMon.minusMonths(4).format(dtfMon));
  396. list.addAll(inspPblmDao.countPblmIncByMonth(indexPblmParam));
  397. break;
  398. }
  399. } else if (!"".equals(indexPblmParam.getPblmState()) && "total".equals(indexPblmParam.getPblmState())) {
  400. switch (indexPblmParam.getDtype()) {
  401. case "day":
  402. int day1 = 0;
  403. int day2 = 0;
  404. int day3 = 0;
  405. int day4 = 0;
  406. int day5 = 0;
  407. int day6 = 0;
  408. int day7 = 0;
  409. CountTime time1 = new CountTime();
  410. CountTime time2 = new CountTime();
  411. CountTime time3 = new CountTime();
  412. CountTime time4 = new CountTime();
  413. CountTime time5 = new CountTime();
  414. CountTime time6 = new CountTime();
  415. CountTime time7 = new CountTime();
  416. DateTimeFormatter dtfDay = DateTimeFormatter.ofPattern("yyyy-MM-dd");
  417. LocalDate dttm = LocalDate.parse(indexPblmParam.getEttm(), dtfDay);
  418. time7.setName(String.valueOf(dttm.getDayOfMonth()));
  419. time6.setName(String.valueOf(dttm.minusDays(1).getDayOfMonth()));
  420. time5.setName(String.valueOf(dttm.minusDays(2).getDayOfMonth()));
  421. time4.setName(String.valueOf(dttm.minusDays(3).getDayOfMonth()));
  422. time3.setName(String.valueOf(dttm.minusDays(4).getDayOfMonth()));
  423. time2.setName(String.valueOf(dttm.minusDays(5).getDayOfMonth()));
  424. time1.setName(String.valueOf(dttm.minusDays(6).getDayOfMonth()));
  425. if (StringUtils.isEmpty(indexPblmParam.getSttm())) {
  426. day7 = inspPblmDao.countPblmByTime(indexPblmParam);
  427. indexPblmParam.setEttm(dttm.minusDays(1).format(dtfDay));
  428. day6 = inspPblmDao.countPblmByTime(indexPblmParam);
  429. indexPblmParam.setEttm(dttm.minusDays(2).format(dtfDay));
  430. day5 = inspPblmDao.countPblmByTime(indexPblmParam);
  431. indexPblmParam.setEttm(dttm.minusDays(3).format(dtfDay));
  432. day4 = inspPblmDao.countPblmByTime(indexPblmParam);
  433. indexPblmParam.setEttm(dttm.minusDays(4).format(dtfDay));
  434. day3 = inspPblmDao.countPblmByTime(indexPblmParam);
  435. indexPblmParam.setEttm(dttm.minusDays(5).format(dtfDay));
  436. day2 = inspPblmDao.countPblmByTime(indexPblmParam);
  437. indexPblmParam.setEttm(dttm.minusDays(6).format(dtfDay));
  438. day1 = inspPblmDao.countPblmByTime(indexPblmParam);
  439. } else {
  440. String sttm = indexPblmParam.getSttm();
  441. if (sttm.compareTo(dttm.minusDays(1).format(dtfDay)) >= 0) {
  442. day7 = inspPblmDao.countPblmByTime(indexPblmParam);
  443. indexPblmParam.setEttm(dttm.minusDays(1).format(dtfDay));
  444. day6 = inspPblmDao.countPblmByTime(indexPblmParam);
  445. } else if (sttm.compareTo(dttm.minusDays(2).format(dtfDay)) >= 0) {
  446. day7 = inspPblmDao.countPblmByTime(indexPblmParam);
  447. indexPblmParam.setEttm(dttm.minusDays(1).format(dtfDay));
  448. day6 = inspPblmDao.countPblmByTime(indexPblmParam);
  449. indexPblmParam.setEttm(dttm.minusDays(2).format(dtfDay));
  450. day5 = inspPblmDao.countPblmByTime(indexPblmParam);
  451. } else if (sttm.compareTo(dttm.minusDays(3).format(dtfDay)) >= 0) {
  452. day7 = inspPblmDao.countPblmByTime(indexPblmParam);
  453. indexPblmParam.setEttm(dttm.minusDays(1).format(dtfDay));
  454. day6 = inspPblmDao.countPblmByTime(indexPblmParam);
  455. indexPblmParam.setEttm(dttm.minusDays(2).format(dtfDay));
  456. day5 = inspPblmDao.countPblmByTime(indexPblmParam);
  457. indexPblmParam.setEttm(dttm.minusDays(3).format(dtfDay));
  458. day4 = inspPblmDao.countPblmByTime(indexPblmParam);
  459. } else if (sttm.compareTo(dttm.minusDays(4).format(dtfDay)) >= 0) {
  460. day7 = inspPblmDao.countPblmByTime(indexPblmParam);
  461. indexPblmParam.setEttm(dttm.minusDays(1).format(dtfDay));
  462. day6 = inspPblmDao.countPblmByTime(indexPblmParam);
  463. indexPblmParam.setEttm(dttm.minusDays(2).format(dtfDay));
  464. day5 = inspPblmDao.countPblmByTime(indexPblmParam);
  465. indexPblmParam.setEttm(dttm.minusDays(3).format(dtfDay));
  466. day4 = inspPblmDao.countPblmByTime(indexPblmParam);
  467. indexPblmParam.setEttm(dttm.minusDays(4).format(dtfDay));
  468. day3 = inspPblmDao.countPblmByTime(indexPblmParam);
  469. } else if (sttm.compareTo(dttm.minusDays(5).format(dtfDay)) >= 0) {
  470. day7 = inspPblmDao.countPblmByTime(indexPblmParam);
  471. indexPblmParam.setEttm(dttm.minusDays(1).format(dtfDay));
  472. day6 = inspPblmDao.countPblmByTime(indexPblmParam);
  473. indexPblmParam.setEttm(dttm.minusDays(2).format(dtfDay));
  474. day5 = inspPblmDao.countPblmByTime(indexPblmParam);
  475. indexPblmParam.setEttm(dttm.minusDays(3).format(dtfDay));
  476. day4 = inspPblmDao.countPblmByTime(indexPblmParam);
  477. indexPblmParam.setEttm(dttm.minusDays(4).format(dtfDay));
  478. day3 = inspPblmDao.countPblmByTime(indexPblmParam);
  479. indexPblmParam.setEttm(dttm.minusDays(5).format(dtfDay));
  480. day2 = inspPblmDao.countPblmByTime(indexPblmParam);
  481. } else if (sttm.compareTo(dttm.minusDays(6).format(dtfDay)) >= 0) {
  482. day7 = inspPblmDao.countPblmByTime(indexPblmParam);
  483. indexPblmParam.setEttm(dttm.minusDays(1).format(dtfDay));
  484. day6 = inspPblmDao.countPblmByTime(indexPblmParam);
  485. indexPblmParam.setEttm(dttm.minusDays(2).format(dtfDay));
  486. day5 = inspPblmDao.countPblmByTime(indexPblmParam);
  487. indexPblmParam.setEttm(dttm.minusDays(3).format(dtfDay));
  488. day4 = inspPblmDao.countPblmByTime(indexPblmParam);
  489. indexPblmParam.setEttm(dttm.minusDays(4).format(dtfDay));
  490. day3 = inspPblmDao.countPblmByTime(indexPblmParam);
  491. indexPblmParam.setEttm(dttm.minusDays(5).format(dtfDay));
  492. day2 = inspPblmDao.countPblmByTime(indexPblmParam);
  493. indexPblmParam.setEttm(dttm.minusDays(6).format(dtfDay));
  494. day1 = inspPblmDao.countPblmByTime(indexPblmParam);
  495. } else {
  496. day7 = inspPblmDao.countPblmByTime(indexPblmParam);
  497. indexPblmParam.setEttm(dttm.minusDays(1).format(dtfDay));
  498. day6 = inspPblmDao.countPblmByTime(indexPblmParam);
  499. indexPblmParam.setEttm(dttm.minusDays(2).format(dtfDay));
  500. day5 = inspPblmDao.countPblmByTime(indexPblmParam);
  501. indexPblmParam.setEttm(dttm.minusDays(3).format(dtfDay));
  502. day4 = inspPblmDao.countPblmByTime(indexPblmParam);
  503. indexPblmParam.setEttm(dttm.minusDays(4).format(dtfDay));
  504. day3 = inspPblmDao.countPblmByTime(indexPblmParam);
  505. indexPblmParam.setEttm(dttm.minusDays(5).format(dtfDay));
  506. day2 = inspPblmDao.countPblmByTime(indexPblmParam);
  507. indexPblmParam.setEttm(dttm.minusDays(6).format(dtfDay));
  508. day1 = inspPblmDao.countPblmByTime(indexPblmParam);
  509. }
  510. }
  511. time7.setValue(day7);
  512. time6.setValue(day6);
  513. time5.setValue(day5);
  514. time4.setValue(day4);
  515. time3.setValue(day3);
  516. time2.setValue(day2);
  517. time1.setValue(day1);
  518. list.add(time1);
  519. list.add(time2);
  520. list.add(time3);
  521. list.add(time4);
  522. list.add(time5);
  523. list.add(time6);
  524. list.add(time7);
  525. break;
  526. case "week":
  527. int currWeekCount = 0;
  528. int oneWeekCount = 0;
  529. int twoWeekCount = 0;
  530. int tWeekCount = 0;
  531. int fWeekCount = 0;
  532. DateTimeFormatter dtfWeek = DateTimeFormatter.ofPattern("yyyy-MM-dd");
  533. LocalDate wktm = LocalDate.parse(indexPblmParam.getEttm(), dtfWeek);
  534. if (StringUtils.isEmpty(indexPblmParam.getSttm())) {
  535. //本周
  536. currWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
  537. //上周日
  538. indexPblmParam.setEttm(wktm.minusDays(wktm.getDayOfWeek().getValue()).format(dtfWeek));
  539. oneWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
  540. //前两周
  541. indexPblmParam.setEttm(wktm.minusWeeks(1).minusDays(wktm.getDayOfWeek().getValue()).format(dtfWeek));
  542. twoWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
  543. //前三周
  544. indexPblmParam.setEttm(wktm.minusWeeks(2).minusDays(wktm.getDayOfWeek().getValue()).format(dtfWeek));
  545. tWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
  546. //前四周
  547. indexPblmParam.setEttm(wktm.minusWeeks(3).minusDays(wktm.getDayOfWeek().getValue()).format(dtfWeek));
  548. fWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
  549. } else {
  550. String sttm = indexPblmParam.getSttm();
  551. if (sttm.compareTo(wktm.minusDays(wktm.getDayOfWeek().getValue() - 1).format(dtfWeek)) >= 0) {
  552. //与本周一比较
  553. currWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
  554. } else if (sttm.compareTo(wktm.minusWeeks(1).minusDays(wktm.getDayOfWeek().getValue() - 1).format(dtfWeek)) >= 0) {
  555. //与上周一比较
  556. currWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
  557. indexPblmParam.setEttm(wktm.minusDays(wktm.getDayOfWeek().getValue()).format(dtfWeek));
  558. oneWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
  559. } else if (sttm.compareTo(wktm.minusWeeks(2).minusDays(wktm.getDayOfWeek().getValue() - 1).format(dtfWeek)) >= 0) {
  560. //与前两周
  561. currWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
  562. indexPblmParam.setEttm(wktm.minusDays(wktm.getDayOfWeek().getValue()).format(dtfWeek));
  563. oneWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
  564. indexPblmParam.setEttm(wktm.minusWeeks(1).minusDays(wktm.getDayOfWeek().getValue()).format(dtfWeek));
  565. twoWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
  566. } else if (sttm.compareTo(wktm.minusWeeks(3).minusDays(wktm.getDayOfWeek().getValue() - 1).format(dtfWeek)) >= 0) {
  567. //前三周
  568. currWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
  569. indexPblmParam.setEttm(wktm.minusDays(wktm.getDayOfWeek().getValue()).format(dtfWeek));
  570. oneWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
  571. indexPblmParam.setEttm(wktm.minusWeeks(1).minusDays(wktm.getDayOfWeek().getValue()).format(dtfWeek));
  572. twoWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
  573. indexPblmParam.setEttm(wktm.minusWeeks(2).minusDays(wktm.getDayOfWeek().getValue()).format(dtfWeek));
  574. tWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
  575. } else {
  576. //前四周
  577. currWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
  578. indexPblmParam.setEttm(wktm.minusDays(wktm.getDayOfWeek().getValue()).format(dtfWeek));
  579. oneWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
  580. indexPblmParam.setEttm(wktm.minusWeeks(1).minusDays(wktm.getDayOfWeek().getValue()).format(dtfWeek));
  581. twoWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
  582. indexPblmParam.setEttm(wktm.minusWeeks(2).minusDays(wktm.getDayOfWeek().getValue()).format(dtfWeek));
  583. tWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
  584. indexPblmParam.setEttm(wktm.minusWeeks(3).minusDays(wktm.getDayOfWeek().getValue()).format(dtfWeek));
  585. fWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
  586. }
  587. }
  588. CountTime currCount = new CountTime();
  589. currCount.setName("本周");
  590. currCount.setValue(currWeekCount);
  591. CountTime oneCount = new CountTime();
  592. oneCount.setName("前1周");
  593. oneCount.setValue(oneWeekCount);
  594. CountTime twoCount = new CountTime();
  595. twoCount.setName("前2周");
  596. twoCount.setValue(twoWeekCount);
  597. CountTime threeCount = new CountTime();
  598. threeCount.setName("前3周");
  599. threeCount.setValue(tWeekCount);
  600. CountTime fourCount = new CountTime();
  601. fourCount.setName("前4周");
  602. fourCount.setValue(fWeekCount);
  603. list.add(fourCount);
  604. list.add(threeCount);
  605. list.add(twoCount);
  606. list.add(oneCount);
  607. list.add(currCount);
  608. break;
  609. case "month":
  610. int mon1 = 0;
  611. int mon2 = 0;
  612. int mon3 = 0;
  613. int mon4 = 0;
  614. int mon5 = 0;
  615. CountTime monTime1 = new CountTime();
  616. CountTime monTime2 = new CountTime();
  617. CountTime monTime3 = new CountTime();
  618. CountTime monTime4 = new CountTime();
  619. CountTime monTime5 = new CountTime();
  620. DateTimeFormatter dtfMonth = DateTimeFormatter.ofPattern("yyyy-MM-dd");
  621. LocalDate montm = LocalDate.parse(indexPblmParam.getEttm(), dtfMonth);
  622. if (StringUtils.isEmpty(indexPblmParam.getSttm())) {
  623. mon5 = inspPblmDao.countPblmByTime(indexPblmParam);
  624. //获取上月最后一天
  625. indexPblmParam.setEttm(montm.minusMonths(1).with(TemporalAdjusters.lastDayOfMonth()).format(dtfMonth));
  626. mon4 = inspPblmDao.countPblmByTime(indexPblmParam);
  627. indexPblmParam.setEttm(montm.minusMonths(2).with(TemporalAdjusters.lastDayOfMonth()).format(dtfMonth));
  628. mon3 = inspPblmDao.countPblmByTime(indexPblmParam);
  629. monTime3.setName(String.valueOf(montm.minusMonths(2).getMonthValue()));
  630. monTime3.setValue(mon3);
  631. indexPblmParam.setEttm(montm.minusMonths(3).with(TemporalAdjusters.lastDayOfMonth()).format(dtfMonth));
  632. mon2 = inspPblmDao.countPblmByTime(indexPblmParam);
  633. indexPblmParam.setEttm(montm.minusMonths(4).with(TemporalAdjusters.lastDayOfMonth()).format(dtfMonth));
  634. mon1 = inspPblmDao.countPblmByTime(indexPblmParam);
  635. } else {
  636. String sttm = indexPblmParam.getSttm();
  637. if (sttm.compareTo(montm.with(TemporalAdjusters.firstDayOfMonth()).format(dtfMonth)) >= 0) {
  638. //大于本月第一天
  639. mon5 = inspPblmDao.countPblmByTime(indexPblmParam);
  640. } else if (sttm.compareTo(montm.minusMonths(1).with(TemporalAdjusters.firstDayOfMonth()).format(dtfMonth)) >= 0) {
  641. //大于上月第一天
  642. mon5 = inspPblmDao.countPblmByTime(indexPblmParam);
  643. indexPblmParam.setEttm(montm.minusMonths(1).with(TemporalAdjusters.lastDayOfMonth()).format(dtfMonth));
  644. mon4 = inspPblmDao.countPblmByTime(indexPblmParam);
  645. } else if (sttm.compareTo(montm.minusMonths(2).with(TemporalAdjusters.firstDayOfMonth()).format(dtfMonth)) >= 0) {
  646. //大于上上月第一天
  647. mon5 = inspPblmDao.countPblmByTime(indexPblmParam);
  648. indexPblmParam.setEttm(montm.minusMonths(1).with(TemporalAdjusters.lastDayOfMonth()).format(dtfMonth));
  649. mon4 = inspPblmDao.countPblmByTime(indexPblmParam);
  650. indexPblmParam.setEttm(montm.minusMonths(2).with(TemporalAdjusters.lastDayOfMonth()).format(dtfMonth));
  651. mon3 = inspPblmDao.countPblmByTime(indexPblmParam);
  652. } else if (sttm.compareTo(montm.minusMonths(3).with(TemporalAdjusters.firstDayOfMonth()).format(dtfMonth)) >= 0) {
  653. //大于上上上月第一天
  654. mon5 = inspPblmDao.countPblmByTime(indexPblmParam);
  655. indexPblmParam.setEttm(montm.minusMonths(1).with(TemporalAdjusters.lastDayOfMonth()).format(dtfMonth));
  656. mon4 = inspPblmDao.countPblmByTime(indexPblmParam);
  657. indexPblmParam.setEttm(montm.minusMonths(2).with(TemporalAdjusters.lastDayOfMonth()).format(dtfMonth));
  658. mon3 = inspPblmDao.countPblmByTime(indexPblmParam);
  659. indexPblmParam.setEttm(montm.minusMonths(3).with(TemporalAdjusters.lastDayOfMonth()).format(dtfMonth));
  660. mon2 = inspPblmDao.countPblmByTime(indexPblmParam);
  661. } else {
  662. mon5 = inspPblmDao.countPblmByTime(indexPblmParam);
  663. indexPblmParam.setEttm(montm.minusMonths(1).with(TemporalAdjusters.lastDayOfMonth()).format(dtfMonth));
  664. mon4 = inspPblmDao.countPblmByTime(indexPblmParam);
  665. indexPblmParam.setEttm(montm.minusMonths(2).with(TemporalAdjusters.lastDayOfMonth()).format(dtfMonth));
  666. mon3 = inspPblmDao.countPblmByTime(indexPblmParam);
  667. indexPblmParam.setEttm(montm.minusMonths(3).with(TemporalAdjusters.lastDayOfMonth()).format(dtfMonth));
  668. mon2 = inspPblmDao.countPblmByTime(indexPblmParam);
  669. indexPblmParam.setEttm(montm.minusMonths(4).with(TemporalAdjusters.lastDayOfMonth()).format(dtfMonth));
  670. mon1 = inspPblmDao.countPblmByTime(indexPblmParam);
  671. }
  672. }
  673. monTime5.setName(String.valueOf(montm.getMonthValue()));
  674. monTime5.setValue(mon5);
  675. monTime4.setName(String.valueOf(montm.minusMonths(1).getMonthValue()));
  676. monTime4.setValue(mon4);
  677. monTime3.setName(String.valueOf(montm.minusMonths(2).getMonthValue()));
  678. monTime3.setValue(mon3);
  679. monTime2.setName(String.valueOf(montm.minusMonths(3).getMonthValue()));
  680. monTime2.setValue(mon2);
  681. monTime1.setName(String.valueOf(montm.minusMonths(4).getMonthValue()));
  682. monTime1.setValue(mon1);
  683. list.add(monTime1);
  684. list.add(monTime2);
  685. list.add(monTime3);
  686. list.add(monTime4);
  687. list.add(monTime5);
  688. break;
  689. }
  690. }
  691. return list;
  692. }
  693. @Override
  694. public PageInfo<ObjGroup> countGroupByAdCode(IndexParamPage indexParam) {
  695. PageHelper.startPage(indexParam.getPageNum(), indexParam.getPageSize());
  696. List<ObjGroup> objGroupList = inspAllObjDao.countGroupByAdCode(getIndexParamPage(indexParam));
  697. return new PageInfo<ObjGroup>(objGroupList);
  698. }
  699. @Override
  700. public PageInfo<ObjPerson> findPerByAdCode(IndexParamPage indexParamPage) {
  701. PageHelper.startPage(indexParamPage.getPageNum(), indexParamPage.getPageSize());
  702. List<ObjPerson> objGroupList = inspAllObjDao.findPerByAdCode(getIndexParamPage(indexParamPage));
  703. return new PageInfo<ObjPerson>(objGroupList);
  704. }
  705. @Override
  706. public PageInfo<DuchaObj> findObjByAdCode(IndexParamPage indexParamPage) {
  707. PageHelper.startPage(indexParamPage.getPageNum(), indexParamPage.getPageSize());
  708. List<DuchaObj> objGroupList = inspAllObjDao.findObjByAdCode(getIndexParamPage(indexParamPage));
  709. return new PageInfo<DuchaObj>(objGroupList);
  710. }
  711. @Override
  712. public PageInfo<BisInspPblm> findPblmByAdCode(IndexParamPage indexParamPage) {
  713. PageHelper.startPage(indexParamPage.getPageNum(), indexParamPage.getPageSize());
  714. List<BisInspPblm> objGroupList = inspAllObjDao.findPblmByAdCode(getIndexParamPage(indexParamPage));
  715. return new PageInfo<BisInspPblm>(objGroupList);
  716. }
  717. @Override
  718. public List<DcTypeDto> findGroupCountByAdCode(IndexParamPage indexParam) {
  719. List<DcTypeDto> objGroupCountList = inspAllObjDao.findGroupCountByAdCode(getIndexParamPage(indexParam));
  720. return objGroupCountList;
  721. }
  722. @Override
  723. public List<DcTypeDto> findPerCountByAdCode(IndexParamPage indexParamPage) {
  724. List<DcTypeDto> objGroupCountList = inspAllObjDao.findPerCountByAdCode(getIndexParamPage(indexParamPage));
  725. return objGroupCountList;
  726. }
  727. @Override
  728. public List<DcTypeDto> findObjCountByAdCode(IndexParamPage indexParamPage) {
  729. List<DcTypeDto> objGroupCountList = inspAllObjDao.findObjCountByAdCode(getIndexParamPage(indexParamPage));
  730. return objGroupCountList;
  731. }
  732. private IndexParam getIndexParam(IndexParam indexParam) {
  733. String province = indexParam.getProvince();
  734. if ("".equals(province)) {
  735. indexParam.setLength("2");
  736. indexParam.setOtherLength("0000000000");
  737. } else {
  738. int total = province.length();
  739. int length = province.replace(AdCodeLabel.START_PARENT_ADCODE, "").length() + 2;
  740. StringBuffer buffer = new StringBuffer();
  741. for (int i = 0; i < total - length; i++) {
  742. buffer.append("0");
  743. }
  744. indexParam.setOtherLength(buffer.toString());
  745. indexParam.setLength(length + "");
  746. }
  747. indexParam.setProvince(province);
  748. return indexParam;
  749. }
  750. private IndexPblmParam getIndexPblmParam(IndexPblmParam pblmParam) {
  751. String province = pblmParam.getProvince();
  752. if ("".equals(province)) {
  753. pblmParam.setLength("2");
  754. pblmParam.setOtherLength("0000000000");
  755. } else {
  756. int total = province.length();
  757. int length = province.replace(AdCodeLabel.START_PARENT_ADCODE, "").length() + 2;
  758. StringBuffer buffer = new StringBuffer();
  759. for (int i = 0; i < total - length; i++) {
  760. buffer.append("0");
  761. }
  762. pblmParam.setOtherLength(buffer.toString());
  763. pblmParam.setLength(length + "");
  764. }
  765. pblmParam.setProvince(province);
  766. return pblmParam;
  767. }
  768. private IndexParamPage getIndexParamPage(IndexParamPage indexParamPage) {
  769. String province = indexParamPage.getProvince();
  770. if ("".equals(province)) {
  771. indexParamPage.setLength("2");
  772. indexParamPage.setOtherLength("0000000000");
  773. } else {
  774. int total = province.length();
  775. int length = province.replace(AdCodeLabel.START_PARENT_ADCODE, "").length() + 2;
  776. StringBuffer buffer = new StringBuffer();
  777. for (int i = 0; i < total - length; i++) {
  778. buffer.append("0");
  779. }
  780. indexParamPage.setOtherLength(buffer.toString());
  781. indexParamPage.setLength(length + "");
  782. }
  783. indexParamPage.setProvince(province);
  784. return indexParamPage;
  785. }
  786. @Override
  787. public List<DcTypeDto> findPblmCountByAdCode(IndexParamPage indexParamPage) {
  788. List<DcTypeDto> objGroupCountList = inspAllObjDao.findPblmCountByAdCode(getIndexParamPage(indexParamPage));
  789. return objGroupCountList;
  790. }
  791. }