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 d08d7f9..d1bfa92 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 @@ -161,6 +161,21 @@ public class CountController extends AbstractController { return new SuccessResultData<>(result); } + @ApiOperation(value = "网格员检查统计详情表", notes = "网格员检查统计详情表接口") + @ApiImplicitParams({ + @ApiImplicitParam(name = "year", value = "年份", paramType = "path"), + @ApiImplicitParam(name = "areaId", value = "地区ID", paramType = "path"), + @ApiImplicitParam(name = "areaLevel", value = "地区等级", paramType = "path"), + }) + @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) + @GetMapping("count-grid-check-detail-table/{year}/{areaId}/{areaLevel}") + public SuccessResultData> countGridCheckDetailTable(@PathVariable("year") String year, + @PathVariable("areaId") String areaId, + @PathVariable("areaLevel") Integer areaLevel) { + Map result = countService.countGridCheckDetailTable(areaId, areaLevel, year); + return new SuccessResultData<>(result); + } + @ApiOperation(value = "隐患上报详情表", notes = "隐患上报详情表接口") @ApiImplicitParams({ @ApiImplicitParam(name = "year", value = "年份", paramType = "path"), 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 0a6fe83..8cfe44c 100644 --- a/src/main/java/com/cm/inspection/service/count/ICountService.java +++ b/src/main/java/com/cm/inspection/service/count/ICountService.java @@ -74,6 +74,16 @@ public interface ICountService { */ SuccessResultData> countCheckDetailTable(String areaId, Integer areaLevel, String year) throws SearchException; + /** + * 检查网格统计详情表 + * + * @param areaId + * @param areaLevel + * @param year + * @return + */ + Map countGridCheckDetailTable(String areaId, Integer areaLevel, String year); + /** * 隐患上报详情表 * @@ -115,4 +125,5 @@ public interface ICountService { * @throws SearchException */ SuccessResultData> countCurrentMonthOfMine(String token) 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 48acb33..97ef2f1 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 @@ -258,6 +258,76 @@ public class CountServiceImpl extends BaseService implements ICountService { return new SuccessResultData<>(result); } + @Override + public Map countGridCheckDetailTable(String areaId, Integer areaLevel, String year) { + Map params = getHashMap(5); + if (areaLevel == 2) { + params.put("area2", areaId); + } else if (areaLevel == 3) { + params.put("area3", areaId); + } else if (areaLevel == 4) { + params.put("area4", areaId); + } else if (areaLevel == 5) { + params.put("area5", areaId); + } else { + params.put("area1", areaId); + } + params.put("level", areaLevel); + List> resultList = new ArrayList<>(); + List gridPersonnelDTOs = gridPersonnelService.listGridPersonnel(params); + for (GridPersonnelDTO gridPersonnelDTO : gridPersonnelDTOs) { + List userIdList = new ArrayList<>(); + String[] userIdArray = gridPersonnelDTO.getUserId().split("\\|"); + String userId = userIdArray[0]; + String userName = userIdArray[2]; + userIdList.add(userId); + Map resultListMap = getHashMap(16); + resultListMap.put("areaId", userId); + resultListMap.put("areaName", userName); + // 地区认领企业总数 + Integer enterpriseReceiveCount = countEnterpriseOfGridAndArea(userId, areaId, areaLevel, year); // enterpriseOfGridOperatorService.countClaimedEnterprise(userId); + resultListMap.put("enterpriseReceiveCount", enterpriseReceiveCount); + // 年度计划数量 + Integer checkPlanCount = checkPlanService.countCheckPlanByUserIdsAndYear(userIdList, year); + resultListMap.put("checkPlanCount", checkPlanCount); + // 实际检查企业统计 + Integer checkCount = getCheckCountByYear(userIdList, year); + resultListMap.put("checkCount", checkCount); + resultListMap.put("completeRatio", checkPlanCount == null || checkPlanCount == 0 ? 0 : String.format("%.2f", (double) checkCount / checkPlanCount * 100)); + // 待复查企业 + List listNeedReCheck = listNeedReCheckIds(userIdList); + List checkDTOs = listNeedReCheck(listNeedReCheck, year); + resultListMap.put("needReCheck", checkDTOs.size()); + // 超期企业 + resultListMap.put("countTimeoutCheck", countTimeoutCheck(checkDTOs)); + // 获取隐患列表 + List checkItemOptionDTOs = listCheckItemOptionDTO(); + // 企业检查隐患总数 + Integer countCheckHiddenDanger = countCheckHiddenDanger(checkItemOptionDTOs, userIdList, year); + resultListMap.put("countCheckHiddenDanger", countCheckHiddenDanger); + // 企业复查隐患总数 + Integer countReCheckHiddenDanger = countReCheckHiddenDanger(checkItemOptionDTOs, userIdList, year); + // 需复查隐患数 + resultListMap.put("countReCheckHiddenDanger", countReCheckHiddenDanger); + // 复查整改总数 + Integer countRectification = countCheckHiddenDanger - countReCheckHiddenDanger; + resultListMap.put("countRectification", countRectification); + // 立即整改(现场整改)数量 + Integer countImmediatelyRectification = countImmediatelyRectification(checkItemOptionDTOs, userIdList, year); + resultListMap.put("countImmediatelyRectification", countImmediatelyRectification); + // 整改率 + resultListMap.put("rectificationRate", countCheckHiddenDanger == null || countCheckHiddenDanger == 0 ? 0 : String.format("%.2f", (double) countRectification / countCheckHiddenDanger * 100)); + // 不配合次数(上报条数) + Integer countUnCoordination = countUnCoordination(userIdList, year); + resultListMap.put("countUnCoordination", countUnCoordination); + resultList.add(resultListMap); + } + Map result = getHashMap(5); + result.put("year", year); + result.put("resultList", resultList); + return result; + } + /** * 立即整改数量 * @@ -797,6 +867,25 @@ public class CountServiceImpl extends BaseService implements ICountService { return enterpriseOfGridOperatorService.countEnterpriseOfArea(params); } + /** + * 统计网格员认领企业 + * + * @param userId + * @param areaId + * @param areaLevel + * @param year + * @return + */ + private Integer countEnterpriseOfGridAndArea(String userId, String areaId, Integer areaLevel, String year) { + Map params = getHashMap(6); + params.put("isLogOff", 0); + setParentArea(areaId, areaLevel, params); + params.put("year", year); + params.put("userId", userId); + + return enterpriseOfGridOperatorService.countEnterpriseOfArea(params); + } + /** * 设置统计返回结果 * diff --git a/src/main/java/com/cm/inspection/service/enterpriseofgridoperator/IEnterpriseOfGridOperatorService.java b/src/main/java/com/cm/inspection/service/enterpriseofgridoperator/IEnterpriseOfGridOperatorService.java index f59b070..0795c09 100644 --- a/src/main/java/com/cm/inspection/service/enterpriseofgridoperator/IEnterpriseOfGridOperatorService.java +++ b/src/main/java/com/cm/inspection/service/enterpriseofgridoperator/IEnterpriseOfGridOperatorService.java @@ -1,7 +1,6 @@ package com.cm.inspection.service.enterpriseofgridoperator; import com.cm.common.exception.RemoveException; -import com.cm.common.exception.SaveException; import com.cm.common.exception.SearchException; import com.cm.common.pojo.ListPage; import com.cm.common.result.SuccessResult; @@ -200,6 +199,14 @@ public interface IEnterpriseOfGridOperatorService { */ SuccessResultList> listPageUnclaimedEnterpriseOfMine(String token, ListPage page) throws SearchException; + /** + * 认领企业总数 + * + * @param userId + * @return + */ + Integer countClaimedEnterprise(String userId); + /** * 统计我的未认领企业 * @@ -227,6 +234,14 @@ public interface IEnterpriseOfGridOperatorService { */ Integer countEnterpriseOfGridOperator(Map params) throws SearchException; + /** + * 统计网格员企业 + * + * @param userId + * @return + */ + Integer countEnterpriseOfGridOperator(String userId); + /** * 企业网格员列表(简单格式) * @@ -259,4 +274,6 @@ public interface IEnterpriseOfGridOperatorService { * @return */ List listEnterpriseIdByUserId(String userId); + + } diff --git a/src/main/java/com/cm/inspection/service/enterpriseofgridoperator/impl/EnterpriseOfGridOperatorServiceImpl.java b/src/main/java/com/cm/inspection/service/enterpriseofgridoperator/impl/EnterpriseOfGridOperatorServiceImpl.java index 56f7bd8..da71b1a 100644 --- a/src/main/java/com/cm/inspection/service/enterpriseofgridoperator/impl/EnterpriseOfGridOperatorServiceImpl.java +++ b/src/main/java/com/cm/inspection/service/enterpriseofgridoperator/impl/EnterpriseOfGridOperatorServiceImpl.java @@ -3,15 +3,12 @@ package com.cm.inspection.service.enterpriseofgridoperator.impl; import com.cm.common.component.SecurityComponent; import com.cm.common.exception.ParamsException; import com.cm.common.exception.RemoveException; -import com.cm.common.exception.SaveException; import com.cm.common.exception.SearchException; import com.cm.common.pojo.ListPage; import com.cm.common.result.SuccessResult; import com.cm.common.result.SuccessResultData; import com.cm.common.result.SuccessResultList; import com.cm.common.token.app.AppTokenManager; -import com.cm.common.token.app.entity.AppToken; -import com.cm.common.token.app.entity.AppTokenUser; import com.cm.common.utils.HashMapUtil; import com.cm.common.utils.UUIDUtil; import com.cm.inspection.dao.enterpriseofgridoperator.IEnterpriseOfGridOperatorDao; @@ -27,7 +24,10 @@ import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; /** * @ClassName: EnterpriseOfGridOperatorServiceImpl @@ -247,6 +247,14 @@ public class EnterpriseOfGridOperatorServiceImpl extends BaseService implements return new SuccessResultList<>(enterpriseOfGridOperatorDTOs, pageInfo.getPageNum(), pageInfo.getTotal()); } + @Override + public Integer countClaimedEnterprise(String userId) { + Map params = getHashMap(2); + params.put("userId", userId); + Integer countResult = enterpriseOfGridOperatorDao.countClaimedEnterprise(params); + return countResult == null ? 0 : countResult; + } + @Override public SuccessResultData countUnclaimedEnterpriseOfMine(String token) throws SearchException { String userId = AppTokenManager.getInstance().getToken(token).getAppTokenUser().getId(); @@ -271,6 +279,13 @@ public class EnterpriseOfGridOperatorServiceImpl extends BaseService implements return count == null ? 0 : count; } + @Override + public Integer countEnterpriseOfGridOperator(String userId) { + Map params = getHashMap(2); + params.put("userId", userId); + return countEnterpriseOfGridOperator(params); + } + @Override public List listSimple(Map params) throws SearchException { return enterpriseOfGridOperatorDao.listSimple(params); diff --git a/src/main/resources/application-test.yml b/src/main/resources/application-test.yml index 4bce60c..8048b06 100644 --- a/src/main/resources/application-test.yml +++ b/src/main/resources/application-test.yml @@ -20,14 +20,14 @@ spring: max-request-size: 1GB datasource: druid: - url: jdbc:mysql://49.233.36.36:6688/db_cloud_inspection?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&autoReconnect=true&failOverReadOnly=false&useSSL=false -# url: jdbc:mysql://127.0.0.1:3306/db_cloud_inspection?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&autoReconnect=true&failOverReadOnly=false&useSSL=false +# url: jdbc:mysql://49.233.36.36:6688/db_cloud_inspection?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&autoReconnect=true&failOverReadOnly=false&useSSL=false + url: jdbc:mysql://127.0.0.1:3306/db_cloud_inspection?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&autoReconnect=true&failOverReadOnly=false&useSSL=false db-type: mysql driver-class-name: com.mysql.jdbc.Driver - username: wanggeng -# username: root - password: WenG>2132997 -# password: root +# username: wanggeng + username: root +# password: WenG>2132997 + password: root initial-size: 2 min-idle: 2 max-active: 5 diff --git a/src/main/resources/mybatis/mapper/enterpriseofgridoperator/enterpriseofgridoperator-mapper.xml b/src/main/resources/mybatis/mapper/enterpriseofgridoperator/enterpriseofgridoperator-mapper.xml index 56cb16e..70b432c 100644 --- a/src/main/resources/mybatis/mapper/enterpriseofgridoperator/enterpriseofgridoperator-mapper.xml +++ b/src/main/resources/mybatis/mapper/enterpriseofgridoperator/enterpriseofgridoperator-mapper.xml @@ -620,6 +620,12 @@ wt1.enterprise_id FROM gen_enterprise_of_grid_operator wt1 + WHERE + wt1.is_delete = 0 + + AND + wt1.user_id = #{userId} + GROUP BY wt1.enterprise_id ) diff --git a/src/main/resources/static/route/count/list-countcheckdetailtable-grid.html b/src/main/resources/static/route/count/list-countcheckdetailtable-grid.html new file mode 100644 index 0000000..4860735 --- /dev/null +++ b/src/main/resources/static/route/count/list-countcheckdetailtable-grid.html @@ -0,0 +1,169 @@ + + + + + + + + + + + + + + +
+
+
+
+
+
+
+
+ +
+ + +
+
+ +
+
+
+
+
+
+ + + + \ 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 index d01c5dd..313756c 100644 --- a/src/main/resources/static/route/count/list-countcheckdetailtable.html +++ b/src/main/resources/static/route/count/list-countcheckdetailtable.html @@ -44,6 +44,7 @@ 待复查(家) 隐患情况 上报(家次) + 人员统计 计划(家) @@ -76,6 +77,7 @@ {{item.countImmediatelyRectification ? item.countImmediatelyRectification : 0}} {{item.rectificationRate ? item.rectificationRate : 0}}% {{item.countUnCoordination ? item.countUnCoordination : 0}} + {{# } }} @@ -154,6 +156,17 @@ }); }); + $(document).on('click', '.area-grid', function() { + var areaId = this.dataset.areaId; + var areaName = this.dataset.areaName; + top.dialog.open({ + url: top.restAjax.path('route/count/list-countcheckdetailtable-grid.html?areaId={areaId}&areaLevel={areaLevel}', [areaId, parseInt(areaLevel)]), + title: areaName +'本级网格员综合统计', + width: '99%', + height: '99%' + }); + }); + $(document).on('click', '#print', function() { var bodyHtml = $('html'); var html = bodyHtml.clone();