新增相关统计接口
This commit is contained in:
parent
ea43afd3b2
commit
f5fc338f63
@ -71,4 +71,14 @@ public interface ICheckDao {
|
|||||||
* @throws SearchException
|
* @throws SearchException
|
||||||
*/
|
*/
|
||||||
Integer countCheck(Map<String, Object> params) throws SearchException;
|
Integer countCheck(Map<String, Object> params) throws SearchException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查列表(简单格式)
|
||||||
|
*
|
||||||
|
* @param params
|
||||||
|
* @return
|
||||||
|
* @throws SearchException
|
||||||
|
*/
|
||||||
|
List<CheckDTO> listCheckSimple(Map<String, Object> params) throws SearchException;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -279,4 +279,13 @@ public interface ICheckService {
|
|||||||
* @throws SearchException
|
* @throws SearchException
|
||||||
*/
|
*/
|
||||||
Integer countCheck(Map<String, Object> params) throws SearchException;
|
Integer countCheck(Map<String, Object> params) throws SearchException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查列表(简单格式)
|
||||||
|
*
|
||||||
|
* @param params
|
||||||
|
* @return
|
||||||
|
* @throws SearchException
|
||||||
|
*/
|
||||||
|
List<CheckDTO> listCheckSimple(Map<String, Object> params) throws SearchException;
|
||||||
}
|
}
|
||||||
|
@ -708,6 +708,11 @@ public class CheckServiceImpl extends BaseService implements ICheckService {
|
|||||||
return checkDao.countCheck(params);
|
return checkDao.countCheck(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<CheckDTO> listCheckSimple(Map<String, Object> params) throws SearchException {
|
||||||
|
return checkDao.listCheckSimple(params);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取用户ID
|
* 获取用户ID
|
||||||
*
|
*
|
||||||
|
@ -4,6 +4,7 @@ import com.cm.common.exception.SearchException;
|
|||||||
import com.cm.common.plugin.pojo.dtos.datadictionary.DataDictionaryDTO;
|
import com.cm.common.plugin.pojo.dtos.datadictionary.DataDictionaryDTO;
|
||||||
import com.cm.common.plugin.service.datadictionary.IDataDictionaryService;
|
import com.cm.common.plugin.service.datadictionary.IDataDictionaryService;
|
||||||
import com.cm.common.result.SuccessResultData;
|
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.pojo.dtos.gridpersonnel.GridPersonnelDTO;
|
||||||
import com.cm.inspection.service.BaseService;
|
import com.cm.inspection.service.BaseService;
|
||||||
import com.cm.inspection.service.check.ICheckService;
|
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.enterprise.IEnterpriseService;
|
||||||
import com.cm.inspection.service.enterpriseofgridoperator.IEnterpriseOfGridOperatorService;
|
import com.cm.inspection.service.enterpriseofgridoperator.IEnterpriseOfGridOperatorService;
|
||||||
import com.cm.inspection.service.gridpersonnel.IGridPersonnelService;
|
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.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.LinkedHashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@ -45,6 +49,8 @@ public class CountServiceImpl extends BaseService implements ICountService {
|
|||||||
private IEnterpriseService enterpriseService;
|
private IEnterpriseService enterpriseService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private IEnterpriseOfGridOperatorService enterpriseOfGridOperatorService;
|
private IEnterpriseOfGridOperatorService enterpriseOfGridOperatorService;
|
||||||
|
@Autowired
|
||||||
|
private IProcessService processService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SuccessResultData<Map<String, Object>> countWorkTable(String startDate, String endDate) throws SearchException {
|
public SuccessResultData<Map<String, Object>> countWorkTable(String startDate, String endDate) throws SearchException {
|
||||||
@ -180,7 +186,11 @@ public class CountServiceImpl extends BaseService implements ICountService {
|
|||||||
resultListMap.put("checkCount", checkCount);
|
resultListMap.put("checkCount", checkCount);
|
||||||
resultListMap.put("completeRatio", checkPlanCount == null ? 0 : new BigDecimal((double) checkCount / checkPlanCount).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
|
resultListMap.put("completeRatio", checkPlanCount == null ? 0 : new BigDecimal((double) checkCount / checkPlanCount).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
|
||||||
// 待复查企业
|
// 待复查企业
|
||||||
|
List<String> listNeedReCheck = listNeedReCheckIds(userIdList);
|
||||||
|
List<CheckDTO> checkDTOs = listNeedReCheck(listNeedReCheck, year);
|
||||||
|
resultListMap.put("needReCheck", checkDTOs.size());
|
||||||
// 超期企业
|
// 超期企业
|
||||||
|
|
||||||
// 企业隐患总数
|
// 企业隐患总数
|
||||||
// 隐患整改总数
|
// 隐患整改总数
|
||||||
// 整改率
|
// 整改率
|
||||||
@ -194,6 +204,47 @@ public class CountServiceImpl extends BaseService implements ICountService {
|
|||||||
return new SuccessResultData<>(result);
|
return new SuccessResultData<>(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 统计需要复查
|
||||||
|
*
|
||||||
|
* @param checkIdList
|
||||||
|
* @param year
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private List<CheckDTO> listNeedReCheck(List<String> checkIdList, String year) {
|
||||||
|
if (checkIdList.isEmpty()) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
Map<String, Object> params = getHashMap(4);
|
||||||
|
params.put("checkIdList", checkIdList);
|
||||||
|
params.put("year", year);
|
||||||
|
return checkService.listCheckSimple(params);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取检查ID列表
|
||||||
|
*
|
||||||
|
* @param userIds
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private List<String> listNeedReCheckIds(List<String> userIdList) {
|
||||||
|
List<String> checkIdList = new ArrayList<>();
|
||||||
|
for (String userId : userIdList) {
|
||||||
|
List<Task> tasks = processService.listTaskByAssignee(userId);
|
||||||
|
LinkedHashSet<String> 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;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 统计地区认领企业
|
* 统计地区认领企业
|
||||||
*
|
*
|
||||||
|
@ -383,6 +383,34 @@
|
|||||||
#{userIdList[${index}]}
|
#{userIdList[${index}]}
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
|
<if test="checkIdList != null and checkIdList.size > 0">
|
||||||
|
AND
|
||||||
|
check_id IN
|
||||||
|
<foreach collection="checkIdList" index="index" open="(" separator="," close=")">
|
||||||
|
#{checkIds[${index}]}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!-- 检查列表(简单格式) -->
|
||||||
|
<select id="listCheckSimple" parameterType="map" resultMap="checkDTO">
|
||||||
|
SELECT
|
||||||
|
*
|
||||||
|
FROM
|
||||||
|
gen_check
|
||||||
|
WHERE
|
||||||
|
is_delete = 0
|
||||||
|
<if test="year != null and year != ''">
|
||||||
|
AND
|
||||||
|
LEFT(gmt_create, 4) = #{year}
|
||||||
|
</if>
|
||||||
|
<if test="checkIdList != null and checkIdList.size > 0">
|
||||||
|
AND
|
||||||
|
check_id IN
|
||||||
|
<foreach collection="checkIdList" index="index" open="(" separator="," close=")">
|
||||||
|
#{checkIds[${index}]}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
Loading…
Reference in New Issue
Block a user