diff --git a/src/main/java/com/cm/inspection/controller/apis/count/CountController.java b/src/main/java/com/cm/inspection/controller/apis/count/CountController.java index 5b70990..306168e 100644 --- a/src/main/java/com/cm/inspection/controller/apis/count/CountController.java +++ b/src/main/java/com/cm/inspection/controller/apis/count/CountController.java @@ -159,4 +159,24 @@ public class CountController extends AbstractController { return countService.countHiddenDangerReportDetail(year); } + @ApiOperation(value = "企业检查情况表", notes = "企业检查情况表接口") + @ApiImplicitParams({ + @ApiImplicitParam(name = "year", value = "年份", paramType = "path"), + }) + @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) + @GetMapping("countenterprisechecktable/{year}") + public SuccessResultData> countEnterpriseCheckTable(@PathVariable("year") String year) { + return countService.countEnterpriseCheckTable(year); + } + + @ApiOperation(value = "计划实际检查情况表", notes = "计划实际检查情况表接口") + @ApiImplicitParams({ + @ApiImplicitParam(name = "year", value = "年份", paramType = "path"), + }) + @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) + @GetMapping("countenterpriseplanrealchecktable/{year}") + public SuccessResultData> countEnterprisePlanRealCheckTable(@PathVariable("year") String year) { + return countService.countEnterprisePlanRealCheckTable(year); + } + } diff --git a/src/main/java/com/cm/inspection/dao/check/ICheckDao.java b/src/main/java/com/cm/inspection/dao/check/ICheckDao.java index 7609ca4..13bc234 100644 --- a/src/main/java/com/cm/inspection/dao/check/ICheckDao.java +++ b/src/main/java/com/cm/inspection/dao/check/ICheckDao.java @@ -81,4 +81,12 @@ public interface ICheckDao { */ List listCheckSimple(Map params) throws SearchException; + /** + * 统计企业的检查数 + * + * @param params + * @return + * @throws SearchException + */ + Integer countEnterpriseCheck(Map params) throws SearchException; } diff --git a/src/main/java/com/cm/inspection/service/check/ICheckService.java b/src/main/java/com/cm/inspection/service/check/ICheckService.java index 10ae8e4..b53165d 100644 --- a/src/main/java/com/cm/inspection/service/check/ICheckService.java +++ b/src/main/java/com/cm/inspection/service/check/ICheckService.java @@ -288,4 +288,13 @@ public interface ICheckService { * @throws SearchException */ List listCheckSimple(Map params) throws SearchException; + + /** + * 企业检查情况表 + * + * @param params + * @return + * @throws SearchException + */ + Integer countEnterpriseCheck(Map params) throws SearchException; } diff --git a/src/main/java/com/cm/inspection/service/check/impl/CheckServiceImpl.java b/src/main/java/com/cm/inspection/service/check/impl/CheckServiceImpl.java index 85654bf..82c71d9 100644 --- a/src/main/java/com/cm/inspection/service/check/impl/CheckServiceImpl.java +++ b/src/main/java/com/cm/inspection/service/check/impl/CheckServiceImpl.java @@ -713,6 +713,12 @@ public class CheckServiceImpl extends BaseService implements ICheckService { return checkDao.listCheckSimple(params); } + @Override + public Integer countEnterpriseCheck(Map params) throws SearchException { + Integer result = checkDao.countEnterpriseCheck(params); + return result == null ? 0 : result; + } + /** * 获取用户ID * diff --git a/src/main/java/com/cm/inspection/service/checkplan/ICheckPlanService.java b/src/main/java/com/cm/inspection/service/checkplan/ICheckPlanService.java index 8a762a4..eab419e 100644 --- a/src/main/java/com/cm/inspection/service/checkplan/ICheckPlanService.java +++ b/src/main/java/com/cm/inspection/service/checkplan/ICheckPlanService.java @@ -175,4 +175,15 @@ public interface ICheckPlanService { * @throws SearchException */ Integer countCheckPlanByUserIdsAndYear(List userIdList, String year) throws SearchException; + + /** + * 统计年度月度检查计划 + * + * @param userIdList + * @param year + * @param month + * @return + * @throws SearchException + */ + Integer countCheckPlanByUserIdsAndYearMonth(List userIdList, String year, int month) throws SearchException; } diff --git a/src/main/java/com/cm/inspection/service/checkplan/impl/CheckPlanServiceImpl.java b/src/main/java/com/cm/inspection/service/checkplan/impl/CheckPlanServiceImpl.java index 9c880fb..503eaef 100644 --- a/src/main/java/com/cm/inspection/service/checkplan/impl/CheckPlanServiceImpl.java +++ b/src/main/java/com/cm/inspection/service/checkplan/impl/CheckPlanServiceImpl.java @@ -1,6 +1,5 @@ package com.cm.inspection.service.checkplan.impl; -import com.cm.common.exception.ParamsException; import com.cm.common.exception.RemoveException; import com.cm.common.exception.SaveException; import com.cm.common.exception.SearchException; @@ -24,7 +23,9 @@ import org.joda.time.DateTime; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import java.util.*; +import java.util.Arrays; +import java.util.List; +import java.util.Map; /** * @ClassName: CheckPlanServiceImpl @@ -248,6 +249,16 @@ public class CheckPlanServiceImpl extends BaseService implements ICheckPlanServi return result == null ? 0 : result; } + @Override + public Integer countCheckPlanByUserIdsAndYearMonth(List userIdList, String year, int month) throws SearchException { + Map params = getHashMap(5); + params.put("userIdList", userIdList); + params.put("year", year); + params.put("month", month); + Integer result = checkPlanDao.countTotalCheckPlan(params); + return result == null ? 0 : result; + } + @Override public SuccessResultData> countCurrentMonthCheckPlanOfMine() throws SearchException { return countCurrentMonthCheckPlanOfMine(null); diff --git a/src/main/java/com/cm/inspection/service/count/ICountService.java b/src/main/java/com/cm/inspection/service/count/ICountService.java index b4e6f8f..c114710 100644 --- a/src/main/java/com/cm/inspection/service/count/ICountService.java +++ b/src/main/java/com/cm/inspection/service/count/ICountService.java @@ -72,4 +72,22 @@ public interface ICountService { * @throws SearchException */ SuccessResultData> countHiddenDangerReportDetail(String year) throws Exception; + + /** + * 企业检查情况表 + * + * @param year + * @return + * @throws SearchException + */ + SuccessResultData> countEnterpriseCheckTable(String year) throws SearchException; + + /** + * 计划实际检查情况表 + * + * @param year + * @return + * @throws SearchException + */ + SuccessResultData> countEnterprisePlanRealCheckTable(String year) throws SearchException; } diff --git a/src/main/java/com/cm/inspection/service/count/impl/CountServiceImpl.java b/src/main/java/com/cm/inspection/service/count/impl/CountServiceImpl.java index c0bc54e..72b164a 100644 --- a/src/main/java/com/cm/inspection/service/count/impl/CountServiceImpl.java +++ b/src/main/java/com/cm/inspection/service/count/impl/CountServiceImpl.java @@ -26,10 +26,8 @@ import org.apache.commons.lang3.StringUtils; import org.joda.time.DateTime; import org.joda.time.format.DateTimeFormat; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.scheduling.config.ScheduledTaskRegistrar; import org.springframework.stereotype.Service; -import java.math.BigDecimal; import java.util.*; /** @@ -170,7 +168,7 @@ public class CountServiceImpl extends BaseService implements ICountService { // 地区企业认领总数 Integer enterpriseReceiveCount = countEnterpriseOfArea(areaDTO.getDictionaryId(), year); resultListMap.put("enterpriseReceiveCount", enterpriseReceiveCount); - resultListMap.put("enterpriseReceiveRatio", enterpriseCount == 0 ? 0 : new BigDecimal((double) enterpriseReceiveCount / enterpriseCount).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue() * 100); + resultListMap.put("enterpriseReceiveRatio", enterpriseCount == 0 ? 0 : String.format("%.2f", (double) enterpriseReceiveCount / enterpriseCount * 100)); resultList.add(resultListMap); } Map result = getHashMap(3); @@ -198,7 +196,7 @@ public class CountServiceImpl extends BaseService implements ICountService { // 实际检查企业统计 Integer checkCount = getCheckCountByYear(userIdList, year); resultListMap.put("checkCount", checkCount); - resultListMap.put("completeRatio", checkPlanCount == null || checkPlanCount == 0 ? 0 : new BigDecimal((double) checkCount / checkPlanCount).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()); + resultListMap.put("completeRatio", checkPlanCount == null || checkPlanCount == 0 ? 0 : String.format("%.2f", (double) checkCount / checkPlanCount * 100)); // 待复查企业 List listNeedReCheck = listNeedReCheckIds(userIdList); List checkDTOs = listNeedReCheck(listNeedReCheck, year); @@ -216,7 +214,7 @@ public class CountServiceImpl extends BaseService implements ICountService { Integer countRectification = countCheckHiddenDanger - countReCheckHiddenDanger; resultListMap.put("countRectification", countRectification); // 整改率 - resultListMap.put("rectificationRate", countCheckHiddenDanger == null || countCheckHiddenDanger == 0 ? 0 : new BigDecimal((double) countRectification / countCheckHiddenDanger).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()); + resultListMap.put("rectificationRate", countCheckHiddenDanger == null || countCheckHiddenDanger == 0 ? 0 : String.format("%.2f", (double) countRectification / countCheckHiddenDanger * 100)); // 不配合次数(上报条数) Integer countUnCoordination = countUnCoordination(userIdList, year); resultListMap.put("countUnCoordination", countUnCoordination); @@ -278,6 +276,74 @@ public class CountServiceImpl extends BaseService implements ICountService { return new SuccessResultData<>(result); } + @Override + public SuccessResultData> countEnterpriseCheckTable(String year) throws SearchException { + LOG.debug("获取三级区域"); + List areaDTOs = dataDictionaryService.listDictionaryByParentId("3f62e230-47a5-4ad9-ab01-08fd2c5218d8"); + List> resultList = new ArrayList<>(); + Map params = getHashMap(3); + params.put("year", year); + for (DataDictionaryDTO areaDTO : areaDTOs) { + Map resultListMap = getHashMap(4); + resultListMap.put("areaName", areaDTO.getDictionaryName()); + // 网格员的Id列表 + List userIdList = listGridPersonnelUserId(areaDTO.getDictionaryId()); + params.put("userIdList", userIdList); + // 统计检查多少家 + Integer enterpriseCheckCount = checkService.countEnterpriseCheck(params); + resultListMap.put("enterpriseCheckCount", enterpriseCheckCount); + // 统计地区有多少企业 + params.put("isLogOff", 0); + params.put("area3", areaDTO.getDictionaryId()); + params.put("year", year); + Integer enterpriseCount = enterpriseService.countEnterpriseReturnInteger(params); + resultListMap.put("enterpriseCount", enterpriseCount); + // 覆盖率 + resultListMap.put("coverage", enterpriseCount == 0 ? 0 : String.format("%.2f", (double) enterpriseCheckCount / enterpriseCount * 100)); + resultList.add(resultListMap); + } + Map result = getHashMap(4); + result.put("year", year); + result.put("resultList", resultList); + return new SuccessResultData<>(result); + } + + @Override + public SuccessResultData> countEnterprisePlanRealCheckTable(String year) throws SearchException { + LOG.debug("获取三级区域"); + List areaDTOs = dataDictionaryService.listDictionaryByParentId("3f62e230-47a5-4ad9-ab01-08fd2c5218d8"); + List> resultList = new ArrayList<>(); + Map params = getHashMap(3); + for (DataDictionaryDTO areaDTO : areaDTOs) { + Map resultListMap = getHashMap(4); + resultListMap.put("areaName", areaDTO.getDictionaryName()); + // 网格员的Id列表 + List userIdList = listGridPersonnelUserId(areaDTO.getDictionaryId()); + params.put("userIdList", userIdList); + List> yearMonthList = new ArrayList<>(); + for (int month = 1; month <= 12; month++) { + Map yearMonthMap = getHashMap(3); + yearMonthMap.put("month", month); + Integer planCount = checkPlanService.countCheckPlanByUserIdsAndYearMonth(userIdList, year, month); + yearMonthMap.put("planCount", planCount); + // 计划总数 + params.remove("month"); + params.put("yearMonth", String.format("%s-%02d", year, month)); + // 统计检查多少家 + Integer enterpriseCheckCount = checkService.countEnterpriseCheck(params); + yearMonthMap.put("enterpriseCheckCount", enterpriseCheckCount); + yearMonthMap.put("completionRate", planCount == 0 ? 0 : String.format("%.2f", (double) enterpriseCheckCount / planCount * 100)); + yearMonthList.add(yearMonthMap); + } + resultListMap.put("yearMonthList", yearMonthList); + resultList.add(resultListMap); + } + Map result = getHashMap(4); + result.put("year", year); + result.put("resultList", resultList); + return new SuccessResultData<>(result); + } + /** * 构建检查结果到检查项中 * @@ -626,8 +692,8 @@ public class CountServiceImpl extends BaseService implements ICountService { */ private SuccessResultData> returnCountResult(List> resultList, String startDate, String endDate) { Map result = getHashMap(5); - result.put("startDate", startDate.substring(0, 7).replace("-", "年")); - result.put("endDate", endDate.substring(0, 7).replace("-", "年")); + result.put("startDate", startDate.substring(0, 7).replace("-", "年") +"月"); + result.put("endDate", endDate.substring(0, 7).replace("-", "年") +"月"); result.put("resultList", resultList); return new SuccessResultData<>(result); } @@ -734,7 +800,7 @@ public class CountServiceImpl extends BaseService implements ICountService { resultListMap.put("rectificationCount", rectificationCount); int totalRectificationCount = unRectificationCount + rectificationCount; // 整改率 - resultListMap.put("rectificationRatio", totalRectificationCount == 0 ? 0 : new BigDecimal((double) rectificationCount / (unRectificationCount + rectificationCount)).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue() * 100); + resultListMap.put("rectificationRatio", totalRectificationCount == 0 ? 0 : String.format("%.2f", (double) rectificationCount / (unRectificationCount + rectificationCount) * 100)); } } diff --git a/src/main/resources/mybatis/mapper/check/check-mapper.xml b/src/main/resources/mybatis/mapper/check/check-mapper.xml index 27894f0..9bf1904 100644 --- a/src/main/resources/mybatis/mapper/check/check-mapper.xml +++ b/src/main/resources/mybatis/mapper/check/check-mapper.xml @@ -421,4 +421,35 @@ + + + \ No newline at end of file diff --git a/src/main/resources/mybatis/mapper/checkplan/checkplan-mapper.xml b/src/main/resources/mybatis/mapper/checkplan/checkplan-mapper.xml index 84ff653..47d2624 100644 --- a/src/main/resources/mybatis/mapper/checkplan/checkplan-mapper.xml +++ b/src/main/resources/mybatis/mapper/checkplan/checkplan-mapper.xml @@ -218,6 +218,10 @@ AND check_plan_year = #{year} + + AND + check_plan_month = #{month} + \ No newline at end of file diff --git a/src/main/resources/static/route/count/list-countcheckdetailtable.html b/src/main/resources/static/route/count/list-countcheckdetailtable.html new file mode 100644 index 0000000..45dc491 --- /dev/null +++ b/src/main/resources/static/route/count/list-countcheckdetailtable.html @@ -0,0 +1,150 @@ + + + + + + + + + + + + + + +
+
+
+
+
+
+
+
+ +
+ + +
+
+ +
+
+
+
+
+
+ + + + \ No newline at end of file diff --git a/src/main/resources/static/route/count/list-countchecktable.html b/src/main/resources/static/route/count/list-countchecktable.html new file mode 100644 index 0000000..20b63ad --- /dev/null +++ b/src/main/resources/static/route/count/list-countchecktable.html @@ -0,0 +1,154 @@ + + + + + + + + + + + + + + +
+
+
+
+
+
+
+
+ +
+
+ +
+ + +
+
+ +
+
+
+
+
+
+ + + + \ No newline at end of file diff --git a/src/main/resources/static/route/count/list-countenterprisechecktable.html b/src/main/resources/static/route/count/list-countenterprisechecktable.html new file mode 100644 index 0000000..591b8d1 --- /dev/null +++ b/src/main/resources/static/route/count/list-countenterprisechecktable.html @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + +
+
+
+
+
+
+
+
+ +
+ + +
+
+ +
+
+
+
+
+
+ + + + \ No newline at end of file diff --git a/src/main/resources/static/route/count/list-countenterpriseplanrealchecktable.html b/src/main/resources/static/route/count/list-countenterpriseplanrealchecktable.html new file mode 100644 index 0000000..52dbaf2 --- /dev/null +++ b/src/main/resources/static/route/count/list-countenterpriseplanrealchecktable.html @@ -0,0 +1,156 @@ + + + + + + + + + + + + + + +
+
+
+
+
+
+
+
+ +
+ + +
+
+ +
+
+
+
+
+
+ + + + \ No newline at end of file diff --git a/src/main/resources/static/route/count/list-countenterprisereceive.html b/src/main/resources/static/route/count/list-countenterprisereceive.html new file mode 100644 index 0000000..3e9a6a7 --- /dev/null +++ b/src/main/resources/static/route/count/list-countenterprisereceive.html @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + +
+
+
+
+
+
+
+
+ +
+ + +
+
+ +
+
+
+
+
+
+ + + + \ No newline at end of file diff --git a/src/main/resources/static/route/count/list-counthiddendangerreportdetail.html b/src/main/resources/static/route/count/list-counthiddendangerreportdetail.html new file mode 100644 index 0000000..8b71aff --- /dev/null +++ b/src/main/resources/static/route/count/list-counthiddendangerreportdetail.html @@ -0,0 +1,63 @@ + + + + + + + + + + + + + +
+
+
+ + + + + + + + + + + + + +
地区计划数
昆都仑区20
+ +
+
+
+ + + + \ No newline at end of file diff --git a/src/main/resources/static/route/count/list-countindustryenterprisetable.html b/src/main/resources/static/route/count/list-countindustryenterprisetable.html new file mode 100644 index 0000000..a58d906 --- /dev/null +++ b/src/main/resources/static/route/count/list-countindustryenterprisetable.html @@ -0,0 +1,104 @@ + + + + + + + + + + + + + + +
+
+
+
+
+
+
+ +
+
+ +
+
+
+
+
+
+ + + + \ No newline at end of file diff --git a/src/main/resources/static/route/count/list-countworktable.html b/src/main/resources/static/route/count/list-countworktable.html new file mode 100644 index 0000000..b0d31a3 --- /dev/null +++ b/src/main/resources/static/route/count/list-countworktable.html @@ -0,0 +1,137 @@ + + + + + + + + + + + + + + +
+
+
+
+
+
+
+
+ +
+
+ +
+ + +
+
+ +
+
+
+
+
+
+ + + + \ No newline at end of file