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 d2b2412..7609ca4 100644 --- a/src/main/java/com/cm/inspection/dao/check/ICheckDao.java +++ b/src/main/java/com/cm/inspection/dao/check/ICheckDao.java @@ -71,4 +71,14 @@ public interface ICheckDao { * @throws SearchException */ Integer countCheck(Map params) throws SearchException; + + /** + * 检查列表(简单格式) + * + * @param params + * @return + * @throws SearchException + */ + List listCheckSimple(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 aa0bbdc..10ae8e4 100644 --- a/src/main/java/com/cm/inspection/service/check/ICheckService.java +++ b/src/main/java/com/cm/inspection/service/check/ICheckService.java @@ -279,4 +279,13 @@ public interface ICheckService { * @throws SearchException */ Integer countCheck(Map params) throws SearchException; + + /** + * 检查列表(简单格式) + * + * @param params + * @return + * @throws SearchException + */ + List listCheckSimple(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 9728770..85654bf 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 @@ -708,6 +708,11 @@ public class CheckServiceImpl extends BaseService implements ICheckService { return checkDao.countCheck(params); } + @Override + public List listCheckSimple(Map params) throws SearchException { + return checkDao.listCheckSimple(params); + } + /** * 获取用户ID * 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 13d448f..b0d1c2d 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 @@ -4,6 +4,7 @@ import com.cm.common.exception.SearchException; import com.cm.common.plugin.pojo.dtos.datadictionary.DataDictionaryDTO; import com.cm.common.plugin.service.datadictionary.IDataDictionaryService; import com.cm.common.result.SuccessResultData; +import com.cm.inspection.pojo.dtos.check.CheckDTO; import com.cm.inspection.pojo.dtos.gridpersonnel.GridPersonnelDTO; import com.cm.inspection.service.BaseService; import com.cm.inspection.service.check.ICheckService; @@ -12,11 +13,14 @@ import com.cm.inspection.service.count.ICountService; import com.cm.inspection.service.enterprise.IEnterpriseService; import com.cm.inspection.service.enterpriseofgridoperator.IEnterpriseOfGridOperatorService; import com.cm.inspection.service.gridpersonnel.IGridPersonnelService; +import com.cm.inspection.service.process.IProcessService; +import org.activiti.engine.task.Task; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.math.BigDecimal; import java.util.ArrayList; +import java.util.LinkedHashSet; import java.util.List; import java.util.Map; @@ -45,6 +49,8 @@ public class CountServiceImpl extends BaseService implements ICountService { private IEnterpriseService enterpriseService; @Autowired private IEnterpriseOfGridOperatorService enterpriseOfGridOperatorService; + @Autowired + private IProcessService processService; @Override public SuccessResultData> countWorkTable(String startDate, String endDate) throws SearchException { @@ -180,7 +186,11 @@ public class CountServiceImpl extends BaseService implements ICountService { resultListMap.put("checkCount", checkCount); resultListMap.put("completeRatio", checkPlanCount == null ? 0 : new BigDecimal((double) checkCount / checkPlanCount).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()); // 待复查企业 + List listNeedReCheck = listNeedReCheckIds(userIdList); + List checkDTOs = listNeedReCheck(listNeedReCheck, year); + resultListMap.put("needReCheck", checkDTOs.size()); // 超期企业 + // 企业隐患总数 // 隐患整改总数 // 整改率 @@ -194,6 +204,47 @@ public class CountServiceImpl extends BaseService implements ICountService { return new SuccessResultData<>(result); } + + + /** + * 统计需要复查 + * + * @param checkIdList + * @param year + * @return + */ + private List listNeedReCheck(List checkIdList, String year) { + if (checkIdList.isEmpty()) { + return new ArrayList<>(); + } + Map params = getHashMap(4); + params.put("checkIdList", checkIdList); + params.put("year", year); + return checkService.listCheckSimple(params); + } + + /** + * 获取检查ID列表 + * + * @param userIds + * @return + */ + private List listNeedReCheckIds(List userIdList) { + List checkIdList = new ArrayList<>(); + for (String userId : userIdList) { + List tasks = processService.listTaskByAssignee(userId); + LinkedHashSet linkedHashSet = new LinkedHashSet<>(); + for (Task task : tasks) { + Object isKeyObj = processService.getTaskVariableByTaskId(task.getId(), "isReport"); + if (isKeyObj != null && Integer.parseInt(isKeyObj.toString()) == 1) { + linkedHashSet.add(processService.getTaskVariableByTaskId(task.getId(), "lastCheckId").toString()); + } + } + checkIdList.addAll(linkedHashSet); + } + return checkIdList; + } + /** * 统计地区认领企业 * diff --git a/src/main/resources/mybatis/mapper/check/check-mapper.xml b/src/main/resources/mybatis/mapper/check/check-mapper.xml index a82365e..6c4b5c4 100644 --- a/src/main/resources/mybatis/mapper/check/check-mapper.xml +++ b/src/main/resources/mybatis/mapper/check/check-mapper.xml @@ -383,6 +383,34 @@ #{userIdList[${index}]} + + AND + check_id IN + + #{checkIds[${index}]} + + + + + + \ No newline at end of file