新增相关统计
This commit is contained in:
parent
f5fc338f63
commit
c7d310271d
@ -144,9 +144,19 @@ public class CountController extends AbstractController {
|
|||||||
@ApiImplicitParam(name = "year", value = "年份", paramType = "path"),
|
@ApiImplicitParam(name = "year", value = "年份", paramType = "path"),
|
||||||
})
|
})
|
||||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
@GetMapping("countCheckDetailTable/{year}")
|
@GetMapping("countcheckdetailtable/{year}")
|
||||||
public SuccessResultData<Map<String, Object>> countCheckDetailTable(@PathVariable("year") String year) {
|
public SuccessResultData<Map<String, Object>> countCheckDetailTable(@PathVariable("year") String year) {
|
||||||
return countService.countCheckDetailTable(year);
|
return countService.countCheckDetailTable(year);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "隐患上报详情表", notes = "隐患上报详情表接口")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "year", value = "年份", paramType = "path"),
|
||||||
|
})
|
||||||
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
|
@GetMapping("counthiddendangerreportdetail/{year}")
|
||||||
|
public SuccessResultData<Map<String, Object>> countHiddenDangerReportDetail(@PathVariable("year") String year) {
|
||||||
|
return countService.countHiddenDangerReportDetail(year);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -83,4 +83,12 @@ public interface IHiddenDangerReportDao {
|
|||||||
*/
|
*/
|
||||||
List<CheckItemDTO> listCheckItemByCheckId(Map<String, Object> params) throws SearchException;
|
List<CheckItemDTO> listCheckItemByCheckId(Map<String, Object> params) throws SearchException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 隐患上报简单列表
|
||||||
|
*
|
||||||
|
* @param params
|
||||||
|
* @return
|
||||||
|
* @throws SearchException
|
||||||
|
*/
|
||||||
|
List<HiddenDangerReportDTO> listHiddenDangerReportSimple(Map<String, Object> params) throws SearchException;
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ import com.cm.inspection.pojo.vos.hiddendangerreport.HiddenDangerReportVO;
|
|||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -17,7 +18,7 @@ import java.util.List;
|
|||||||
* @Version: 1.0
|
* @Version: 1.0
|
||||||
**/
|
**/
|
||||||
@ApiModel
|
@ApiModel
|
||||||
public class CheckDTO {
|
public class CheckDTO implements Serializable {
|
||||||
|
|
||||||
@ApiModelProperty(name = "checkId", value = "主键")
|
@ApiModelProperty(name = "checkId", value = "主键")
|
||||||
private String checkId;
|
private String checkId;
|
||||||
|
@ -3,6 +3,8 @@ package com.cm.inspection.pojo.dtos.enterprise;
|
|||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ClassName: EnterpriseDTO
|
* @ClassName: EnterpriseDTO
|
||||||
* @Description: 企业
|
* @Description: 企业
|
||||||
@ -11,7 +13,7 @@ import io.swagger.annotations.ApiModelProperty;
|
|||||||
* @Version: 1.0
|
* @Version: 1.0
|
||||||
**/
|
**/
|
||||||
@ApiModel
|
@ApiModel
|
||||||
public class EnterpriseDTO {
|
public class EnterpriseDTO implements Serializable {
|
||||||
|
|
||||||
@ApiModelProperty(name = "enterpriseId", value = "主键")
|
@ApiModelProperty(name = "enterpriseId", value = "主键")
|
||||||
private String enterpriseId;
|
private String enterpriseId;
|
||||||
|
@ -63,4 +63,13 @@ public interface ICountService {
|
|||||||
* @throws SearchException
|
* @throws SearchException
|
||||||
*/
|
*/
|
||||||
SuccessResultData<Map<String, Object>> countCheckDetailTable(String year) throws SearchException;
|
SuccessResultData<Map<String, Object>> countCheckDetailTable(String year) throws SearchException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 隐患上报详情表
|
||||||
|
*
|
||||||
|
* @param year
|
||||||
|
* @return
|
||||||
|
* @throws SearchException
|
||||||
|
*/
|
||||||
|
SuccessResultData<Map<String, Object>> countHiddenDangerReportDetail(String year) throws SearchException;
|
||||||
}
|
}
|
||||||
|
@ -4,25 +4,32 @@ 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.common.utils.HashMapUtil;
|
||||||
import com.cm.inspection.pojo.dtos.check.CheckDTO;
|
import com.cm.inspection.pojo.dtos.check.CheckDTO;
|
||||||
|
import com.cm.inspection.pojo.dtos.checkitem.CheckItemDTO;
|
||||||
|
import com.cm.inspection.pojo.dtos.checkitemoption.CheckItemOptionDTO;
|
||||||
import com.cm.inspection.pojo.dtos.gridpersonnel.GridPersonnelDTO;
|
import com.cm.inspection.pojo.dtos.gridpersonnel.GridPersonnelDTO;
|
||||||
|
import com.cm.inspection.pojo.dtos.hiddendangerreport.HiddenDangerReportDTO;
|
||||||
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;
|
||||||
|
import com.cm.inspection.service.checkitem.ICheckItemService;
|
||||||
|
import com.cm.inspection.service.checkitemoption.ICheckItemOptionService;
|
||||||
import com.cm.inspection.service.checkplan.ICheckPlanService;
|
import com.cm.inspection.service.checkplan.ICheckPlanService;
|
||||||
import com.cm.inspection.service.count.ICountService;
|
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.hiddendangerreport.IHiddenDangerReportService;
|
||||||
import com.cm.inspection.service.process.IProcessService;
|
import com.cm.inspection.service.process.IProcessService;
|
||||||
import org.activiti.engine.task.Task;
|
import org.activiti.engine.task.Task;
|
||||||
|
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.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.*;
|
||||||
import java.util.LinkedHashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When you feel like quitting. Think about why you started
|
* When you feel like quitting. Think about why you started
|
||||||
@ -51,6 +58,12 @@ public class CountServiceImpl extends BaseService implements ICountService {
|
|||||||
private IEnterpriseOfGridOperatorService enterpriseOfGridOperatorService;
|
private IEnterpriseOfGridOperatorService enterpriseOfGridOperatorService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private IProcessService processService;
|
private IProcessService processService;
|
||||||
|
@Autowired
|
||||||
|
private IHiddenDangerReportService hiddenDangerReportService;
|
||||||
|
@Autowired
|
||||||
|
private ICheckItemOptionService checkItemOptionService;
|
||||||
|
@Autowired
|
||||||
|
private ICheckItemService checkItemService;
|
||||||
|
|
||||||
@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 {
|
||||||
@ -171,7 +184,7 @@ public class CountServiceImpl extends BaseService implements ICountService {
|
|||||||
List<DataDictionaryDTO> areaDTOs = dataDictionaryService.listDictionaryByParentId("3f62e230-47a5-4ad9-ab01-08fd2c5218d8");
|
List<DataDictionaryDTO> areaDTOs = dataDictionaryService.listDictionaryByParentId("3f62e230-47a5-4ad9-ab01-08fd2c5218d8");
|
||||||
List<Map<String, Object>> resultList = new ArrayList<>();
|
List<Map<String, Object>> resultList = new ArrayList<>();
|
||||||
for (DataDictionaryDTO areaDTO : areaDTOs) {
|
for (DataDictionaryDTO areaDTO : areaDTOs) {
|
||||||
Map<String, Object> resultListMap = getHashMap(10);
|
Map<String, Object> resultListMap = getHashMap(16);
|
||||||
resultListMap.put("areaName", areaDTO.getDictionaryName());
|
resultListMap.put("areaName", areaDTO.getDictionaryName());
|
||||||
// 地区认领企业总数
|
// 地区认领企业总数
|
||||||
Integer enterpriseReceiveCount = countEnterpriseOfArea(areaDTO.getDictionaryId(), year);
|
Integer enterpriseReceiveCount = countEnterpriseOfArea(areaDTO.getDictionaryId(), year);
|
||||||
@ -184,18 +197,28 @@ public class CountServiceImpl extends BaseService implements ICountService {
|
|||||||
// 实际检查企业统计
|
// 实际检查企业统计
|
||||||
Integer checkCount = getCheckCountByYear(userIdList, year);
|
Integer checkCount = getCheckCountByYear(userIdList, year);
|
||||||
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 || checkPlanCount == 0 ? 0 : new BigDecimal((double) checkCount / checkPlanCount).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
|
||||||
// 待复查企业
|
// 待复查企业
|
||||||
List<String> listNeedReCheck = listNeedReCheckIds(userIdList);
|
List<String> listNeedReCheck = listNeedReCheckIds(userIdList);
|
||||||
List<CheckDTO> checkDTOs = listNeedReCheck(listNeedReCheck, year);
|
List<CheckDTO> checkDTOs = listNeedReCheck(listNeedReCheck, year);
|
||||||
resultListMap.put("needReCheck", checkDTOs.size());
|
resultListMap.put("needReCheck", checkDTOs.size());
|
||||||
// 超期企业
|
// 超期企业
|
||||||
|
resultListMap.put("countTimeoutCheck", countTimeoutCheck(checkDTOs));
|
||||||
// 企业隐患总数
|
// 获取隐患列表
|
||||||
// 隐患整改总数
|
List<CheckItemOptionDTO> checkItemOptionDTOs = listCheckItemOptionDTO();
|
||||||
|
// 企业检查隐患总数
|
||||||
|
Integer countCheckHiddenDanger = countCheckHiddenDanger(checkItemOptionDTOs, userIdList, year);
|
||||||
|
resultListMap.put("countCheckHiddenDanger", countCheckHiddenDanger);
|
||||||
|
// 企业复查隐患总数
|
||||||
|
Integer countReCheckHiddenDanger = countReCheckHiddenDanger(checkItemOptionDTOs, userIdList, year);
|
||||||
|
// 复查整改总数
|
||||||
|
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());
|
||||||
// 不配合次数(上报条数)
|
// 不配合次数(上报条数)
|
||||||
|
Integer countUnCoordination = countUnCoordination(userIdList, year);
|
||||||
|
resultListMap.put("countUnCoordination", countUnCoordination);
|
||||||
resultList.add(resultListMap);
|
resultList.add(resultListMap);
|
||||||
}
|
}
|
||||||
Map<String, Object> result = getHashMap(5);
|
Map<String, Object> result = getHashMap(5);
|
||||||
@ -204,7 +227,239 @@ public class CountServiceImpl extends BaseService implements ICountService {
|
|||||||
return new SuccessResultData<>(result);
|
return new SuccessResultData<>(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SuccessResultData<Map<String, Object>> countHiddenDangerReportDetail(String year) throws SearchException {
|
||||||
|
LOG.debug("获取三级区域");
|
||||||
|
List<DataDictionaryDTO> areaDTOs = dataDictionaryService.listDictionaryByParentId("3f62e230-47a5-4ad9-ab01-08fd2c5218d8");
|
||||||
|
// 获取检查项列表
|
||||||
|
List<CheckItemDTO> checkItemDTOs = listCheckItemDTO();
|
||||||
|
// 检查项详细列表
|
||||||
|
List<CheckItemOptionDTO> checkItemOptionDTOs = listCheckItemOptionDTO();
|
||||||
|
// 组合检查项
|
||||||
|
|
||||||
|
List<Map<String, Object>> resultList = new ArrayList<>();
|
||||||
|
for (DataDictionaryDTO areaDTO : areaDTOs) {
|
||||||
|
Map<String, Object> resultListMap = getHashMap(3);
|
||||||
|
resultListMap.put("areaName", areaDTO.getDictionaryName());
|
||||||
|
// 网格员的Id列表
|
||||||
|
List<String> userIdList = listGridPersonnelUserId(areaDTO.getDictionaryId());
|
||||||
|
List<HiddenDangerReportDTO> listHiddenDangerReport = hiddenDangerReportService.listHiddenDangerReportSimpleByUserIdsYear(userIdList, year);
|
||||||
|
for (CheckItemOptionDTO checkItemOptionDTO : checkItemOptionDTOs) {
|
||||||
|
int checkCount = 0;
|
||||||
|
for (HiddenDangerReportDTO hiddenDangerReportDTO : listHiddenDangerReport) {
|
||||||
|
// 检查项相同
|
||||||
|
if (StringUtils.equals(checkItemOptionDTO.getCheckItemId(), hiddenDangerReportDTO.getCheckItemId()) &&
|
||||||
|
StringUtils.equals(checkItemOptionDTO.getCheckItemOptionId(), hiddenDangerReportDTO.getCheckItemOptionId())) {
|
||||||
|
checkCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Map<String, Object> checkItemOptionMap = HashMapUtil.beanToMap(checkItemOptionDTO);
|
||||||
|
checkItemOptionMap.put("checkCount", checkCount);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<Map<String, Object>> listCheckItem(List<CheckItemDTO> checkItemDTOs) throws Exception {
|
||||||
|
List<Map<String, Object>> checkItemMapList = new ArrayList<>();
|
||||||
|
if (checkItemDTOs) {
|
||||||
|
return checkItemMapList;
|
||||||
|
}
|
||||||
|
// 处理一级选项
|
||||||
|
for (CheckItemDTO checkItemDTO : checkItemDTOs) {
|
||||||
|
if (checkItemDTO.getCheckItemParentId() == null || checkItemDTO.getCheckItemParentId() == 0) {
|
||||||
|
checkItemMapList.add(HashMapUtil.beanToMap(checkItemDTO));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 处理二级选项
|
||||||
|
for (Map<String, Object> checkItemMap : checkItemMapList) {
|
||||||
|
List<Map<String, Object>> subCheckItemList = new ArrayList<>();
|
||||||
|
for (CheckItemDTO checkItemDTO : checkItemDTOs) {
|
||||||
|
if (StringUtils.equals(checkItemMap.get("checkItemId").toString(), checkItemDTO.getCheckItemParentId())) {
|
||||||
|
subCheckItemList.add(HashMapUtil.beanToMap(checkItemDTO));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 处理选项
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buildCheckItem(List<CheckItemDTO> checkItemDTOs) {
|
||||||
|
List<Map<String, Object>> checkItemMapList = new ArrayList<>();
|
||||||
|
for (CheckItemDTO checkItemDTO : checkItemDTOs) {
|
||||||
|
if (checkItemDTO.getCheckItemParentId() == null || StringUtils.equals(checkItemDTO.getCheckItemParentId(), "0")) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 统计因不配合上报的
|
||||||
|
*
|
||||||
|
* @param userIdList
|
||||||
|
* @param year
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private Integer countUnCoordination(List<String> userIdList, String year) {
|
||||||
|
Map<String, Object> params = getHashMap(4);
|
||||||
|
params.put("userIdList", userIdList);
|
||||||
|
params.put("year", year);
|
||||||
|
params.put("isCoordination", 0);
|
||||||
|
return checkService.countCheck(params);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查项列表
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private List<CheckItemDTO> listCheckItemDTO() {
|
||||||
|
Map<String, Object> params = getHashMap(0);
|
||||||
|
return checkItemService.listCheckItem(params);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查项列表
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private List<CheckItemOptionDTO> listCheckItemOptionDTO() {
|
||||||
|
Map<String, Object> params = getHashMap(0);
|
||||||
|
return checkItemOptionService.listCheckItemOption(params);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 统计复查数量
|
||||||
|
*
|
||||||
|
* @param checkItemOptionDTOs
|
||||||
|
* @param userIdList
|
||||||
|
* @param year
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private Integer countReCheckHiddenDanger(List<CheckItemOptionDTO> checkItemOptionDTOs, List<String> userIdList, String year) {
|
||||||
|
if (checkItemOptionDTOs.isEmpty()) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (userIdList.isEmpty()) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
List<CheckDTO> checkDTOs = listCheckDTO(userIdList, year, 2);
|
||||||
|
// 无上报记录
|
||||||
|
if (checkDTOs.isEmpty()) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
List<String> checkIds = listCheckId(checkDTOs);
|
||||||
|
return countHiddenDanger(checkItemOptionDTOs, checkIds, year);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 统计隐患问题
|
||||||
|
*
|
||||||
|
* @param checkIds
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private Integer countCheckHiddenDanger(List<CheckItemOptionDTO> checkItemOptionDTOs, List<String> userIdList, String year) {
|
||||||
|
if (checkItemOptionDTOs.isEmpty()) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (userIdList.isEmpty()) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
List<CheckDTO> checkDTOs = listCheckDTO(userIdList, year, 1);
|
||||||
|
// 无上报记录
|
||||||
|
if (checkDTOs.isEmpty()) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
List<String> checkIds = listCheckId(checkDTOs);
|
||||||
|
return countHiddenDanger(checkItemOptionDTOs, checkIds, year);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 统计隐患数量
|
||||||
|
*
|
||||||
|
* @param checkItemOptionDTOs
|
||||||
|
* @param checkIds
|
||||||
|
* @param year
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private Integer countHiddenDanger(List<CheckItemOptionDTO> checkItemOptionDTOs, List<String> checkIds, String year) {
|
||||||
|
int countHiddenDanger = 0;
|
||||||
|
// 获取上报的隐患列表
|
||||||
|
List<HiddenDangerReportDTO> listHiddenDangerReport = hiddenDangerReportService.listHiddenDangerReportSimpleByCheckIdsAndYear(checkIds, year);
|
||||||
|
for (CheckItemOptionDTO checkItemOptionDTO : checkItemOptionDTOs) {
|
||||||
|
for (HiddenDangerReportDTO hiddenDangerReportDTO : listHiddenDangerReport) {
|
||||||
|
// 判断选择项
|
||||||
|
if (!StringUtils.equals(checkItemOptionDTO.getCheckItemId(), hiddenDangerReportDTO.getCheckItemId())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// 判断选择结果
|
||||||
|
if (!StringUtils.equals(checkItemOptionDTO.getCheckItemOptionId(), hiddenDangerReportDTO.getCheckItemOptionId())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// 如果是错误选择结果,进行统计
|
||||||
|
if (checkItemOptionDTO.getIsWrong() == 1) {
|
||||||
|
countHiddenDanger++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return countHiddenDanger;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查ID列表
|
||||||
|
*
|
||||||
|
* @param checkDTOs
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private List<String> listCheckId(List<CheckDTO> checkDTOs) {
|
||||||
|
List<String> checkIds = new ArrayList<>();
|
||||||
|
for (CheckDTO checkDTO : checkDTOs) {
|
||||||
|
checkIds.add(checkDTO.getCheckId());
|
||||||
|
}
|
||||||
|
return checkIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查列表
|
||||||
|
*
|
||||||
|
* @param userIdList
|
||||||
|
* @param year
|
||||||
|
* @param checkType
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private List<CheckDTO> listCheckDTO(List<String> userIdList, String year, int checkType) {
|
||||||
|
Map<String, Object> params = getHashMap(6);
|
||||||
|
params.put("userIdList", userIdList);
|
||||||
|
params.put("year", year);
|
||||||
|
params.put("checkType", checkType);
|
||||||
|
// 用户上报的隐患列表
|
||||||
|
return checkService.listCheckSimple(params);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 统计超时的检查
|
||||||
|
*
|
||||||
|
* @param checkDTOList
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private Integer countTimeoutCheck(List<CheckDTO> checkDTOList) {
|
||||||
|
if (checkDTOList == null || checkDTOList.size() == 0) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
DateTime now = DateTime.now();
|
||||||
|
int timeoutCount = 0;
|
||||||
|
for (CheckDTO checkDTO : checkDTOList) {
|
||||||
|
if (checkDTO.getRectificationDays() == null || checkDTO.getRectificationDays() == 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
String gmtCreate = checkDTO.getGmtCreate();
|
||||||
|
DateTime gmtCreateDatetime = DateTimeFormat.forPattern("yyyy-MM-dd").parseDateTime(gmtCreate.substring(0, 10));
|
||||||
|
DateTime endTime = gmtCreateDatetime.plusDays(checkDTO.getRectificationDays());
|
||||||
|
if (now.isAfter(endTime)) {
|
||||||
|
timeoutCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return timeoutCount;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 统计需要复查
|
* 统计需要复查
|
||||||
@ -214,11 +469,11 @@ public class CountServiceImpl extends BaseService implements ICountService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private List<CheckDTO> listNeedReCheck(List<String> checkIdList, String year) {
|
private List<CheckDTO> listNeedReCheck(List<String> checkIdList, String year) {
|
||||||
if (checkIdList.isEmpty()) {
|
if (checkIdList == null || checkIdList.isEmpty()) {
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
Map<String, Object> params = getHashMap(4);
|
Map<String, Object> params = getHashMap(4);
|
||||||
params.put("checkIdList", checkIdList);
|
params.put("checkIds", checkIdList);
|
||||||
params.put("year", year);
|
params.put("year", year);
|
||||||
return checkService.listCheckSimple(params);
|
return checkService.listCheckSimple(params);
|
||||||
}
|
}
|
||||||
@ -302,7 +557,7 @@ public class CountServiceImpl extends BaseService implements ICountService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private Integer getCheckTotalCount(List<String> userIdList, String startDate, String endDate) {
|
private Integer getCheckTotalCount(List<String> userIdList, String startDate, String endDate) {
|
||||||
if (userIdList.isEmpty()) {
|
if (userIdList == null || userIdList.isEmpty()) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
Map<String, Object> params = getHashMap(7);
|
Map<String, Object> params = getHashMap(7);
|
||||||
@ -321,7 +576,7 @@ public class CountServiceImpl extends BaseService implements ICountService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private Integer getCheckCount(List<String> userIdList, String startDate, String endDate) {
|
private Integer getCheckCount(List<String> userIdList, String startDate, String endDate) {
|
||||||
if (userIdList.isEmpty()) {
|
if (userIdList == null || userIdList.isEmpty()) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
Map<String, Object> params = getHashMap(7);
|
Map<String, Object> params = getHashMap(7);
|
||||||
@ -340,7 +595,7 @@ public class CountServiceImpl extends BaseService implements ICountService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private Integer getCheckCountByYear(List<String> userIdList, String year) {
|
private Integer getCheckCountByYear(List<String> userIdList, String year) {
|
||||||
if (userIdList.isEmpty()) {
|
if (userIdList == null || userIdList.isEmpty()) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
Map<String, Object> params = getHashMap(7);
|
Map<String, Object> params = getHashMap(7);
|
||||||
|
@ -146,4 +146,33 @@ public interface IHiddenDangerReportService {
|
|||||||
* @throws SearchException
|
* @throws SearchException
|
||||||
*/
|
*/
|
||||||
List<HiddenDangerReportDTO> listHiddenDangerReportByCheckIdAndCheckItemId(String checkId, String checkItemId) throws SearchException;
|
List<HiddenDangerReportDTO> listHiddenDangerReportByCheckIdAndCheckItemId(String checkId, String checkItemId) throws SearchException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查项上报列表(通过检查ID列表和year)
|
||||||
|
*
|
||||||
|
* @param checkIds
|
||||||
|
* @param year
|
||||||
|
* @return
|
||||||
|
* @throws SearchException
|
||||||
|
*/
|
||||||
|
List<HiddenDangerReportDTO> listHiddenDangerReportSimpleByCheckIdsAndYear(List<String> checkIds, String year) throws SearchException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查项上报列表(通过year)
|
||||||
|
*
|
||||||
|
* @param year
|
||||||
|
* @return
|
||||||
|
* @throws SearchException
|
||||||
|
*/
|
||||||
|
List<HiddenDangerReportDTO> listHiddenDangerReportSimpleByYear(String year) throws SearchException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查项上报列表(通过用户列表和年份)
|
||||||
|
*
|
||||||
|
* @param userIds
|
||||||
|
* @param year
|
||||||
|
* @return
|
||||||
|
* @throws SearchException
|
||||||
|
*/
|
||||||
|
List<HiddenDangerReportDTO> listHiddenDangerReportSimpleByUserIdsYear(List<String> userIds, String year) throws SearchException;
|
||||||
}
|
}
|
||||||
|
@ -167,4 +167,32 @@ public class HiddenDangerReportServiceImpl extends BaseService implements IHidde
|
|||||||
return hiddenDangerReportDao.listHiddenDangerReport(params);
|
return hiddenDangerReportDao.listHiddenDangerReport(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<HiddenDangerReportDTO> listHiddenDangerReportSimpleByCheckIdsAndYear(List<String> checkIds, String year) throws SearchException {
|
||||||
|
if(checkIds == null || checkIds.isEmpty()) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
Map<String, Object> params = getHashMap(3);
|
||||||
|
params.put("checkIds", checkIds);
|
||||||
|
params.put("year", year);
|
||||||
|
return hiddenDangerReportDao.listHiddenDangerReportSimple(params);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<HiddenDangerReportDTO> listHiddenDangerReportSimpleByYear(String year) throws SearchException {
|
||||||
|
Map<String, Object> params = getHashMap(2);
|
||||||
|
params.put("year", year);
|
||||||
|
return hiddenDangerReportDao.listHiddenDangerReportSimple(params);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<HiddenDangerReportDTO> listHiddenDangerReportSimpleByUserIdsYear(List<String> userIds, String year) throws SearchException {
|
||||||
|
if(userIds == null || userIds.isEmpty()) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
Map<String, Object> params = getHashMap(2);
|
||||||
|
params.put("userIds", userIds);
|
||||||
|
params.put("year", year);
|
||||||
|
return hiddenDangerReportDao.listHiddenDangerReportSimple(params);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.cm.inspection.dao.check.ICheckDao">
|
<mapper namespace="com.cm.inspection.dao.check.ICheckDao">
|
||||||
|
<cache/>
|
||||||
|
|
||||||
<resultMap id="checkDTO" type="com.cm.inspection.pojo.dtos.check.CheckDTO">
|
<resultMap id="checkDTO" type="com.cm.inspection.pojo.dtos.check.CheckDTO">
|
||||||
<id column="check_id" property="checkId"/>
|
<id column="check_id" property="checkId"/>
|
||||||
@ -39,7 +40,7 @@
|
|||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<!-- 新增检查表 -->
|
<!-- 新增检查表 -->
|
||||||
<insert id="saveCheck" parameterType="map">
|
<insert id="saveCheck" parameterType="map" flushCache="true">
|
||||||
INSERT INTO gen_check(
|
INSERT INTO gen_check(
|
||||||
check_id,
|
check_id,
|
||||||
enterprise_id,
|
enterprise_id,
|
||||||
@ -80,7 +81,7 @@
|
|||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<!-- 删除检查表 -->
|
<!-- 删除检查表 -->
|
||||||
<update id="removeCheck" parameterType="map">
|
<update id="removeCheck" parameterType="map" flushCache="true">
|
||||||
UPDATE
|
UPDATE
|
||||||
gen_check
|
gen_check
|
||||||
SET
|
SET
|
||||||
@ -95,7 +96,7 @@
|
|||||||
</update>
|
</update>
|
||||||
|
|
||||||
<!-- 修改检查表 -->
|
<!-- 修改检查表 -->
|
||||||
<update id="updateCheck" parameterType="map">
|
<update id="updateCheck" parameterType="map" flushCache="true">
|
||||||
UPDATE
|
UPDATE
|
||||||
gen_check
|
gen_check
|
||||||
SET
|
SET
|
||||||
@ -411,6 +412,13 @@
|
|||||||
#{checkIds[${index}]}
|
#{checkIds[${index}]}
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
|
<if test="userIdList != null and userIdList.size > 0">
|
||||||
|
AND
|
||||||
|
creator IN
|
||||||
|
<foreach collection="userIdList" index="index" open="(" separator="," close=")">
|
||||||
|
#{userIdList[${index}]}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
@ -1,6 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.cm.inspection.dao.enterprise.IEnterpriseDao">
|
<mapper namespace="com.cm.inspection.dao.enterprise.IEnterpriseDao">
|
||||||
|
<cache/>
|
||||||
|
|
||||||
<resultMap id="enterpriseDTO" type="com.cm.inspection.pojo.dtos.enterprise.EnterpriseDTO">
|
<resultMap id="enterpriseDTO" type="com.cm.inspection.pojo.dtos.enterprise.EnterpriseDTO">
|
||||||
<id column="enterprise_id" property="enterpriseId"/>
|
<id column="enterprise_id" property="enterpriseId"/>
|
||||||
|
@ -67,7 +67,7 @@
|
|||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<!-- 新增网格员的企业 -->
|
<!-- 新增网格员的企业 -->
|
||||||
<insert id="saveEnterpriseOfGridOperator" parameterType="map">
|
<insert id="saveEnterpriseOfGridOperator" parameterType="map" flushCache="true">
|
||||||
INSERT INTO gen_enterprise_of_grid_operator(
|
INSERT INTO gen_enterprise_of_grid_operator(
|
||||||
enterprise_of_grid_operator_id,
|
enterprise_of_grid_operator_id,
|
||||||
user_id,
|
user_id,
|
||||||
@ -90,7 +90,7 @@
|
|||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<!-- 删除网格员的企业 -->
|
<!-- 删除网格员的企业 -->
|
||||||
<update id="removeEnterpriseOfGridOperator" parameterType="map">
|
<update id="removeEnterpriseOfGridOperator" parameterType="map" flushCache="true">
|
||||||
UPDATE
|
UPDATE
|
||||||
gen_enterprise_of_grid_operator
|
gen_enterprise_of_grid_operator
|
||||||
SET
|
SET
|
||||||
@ -105,7 +105,7 @@
|
|||||||
</update>
|
</update>
|
||||||
|
|
||||||
<!-- 删除网格员的企业(物理删除) -->
|
<!-- 删除网格员的企业(物理删除) -->
|
||||||
<delete id="deleteEnterpriseOfGridOperator">
|
<delete id="deleteEnterpriseOfGridOperator" flushCache="true">
|
||||||
DELETE FROM
|
DELETE FROM
|
||||||
gen_enterprise_of_grid_operator
|
gen_enterprise_of_grid_operator
|
||||||
WHERE
|
WHERE
|
||||||
@ -123,7 +123,7 @@
|
|||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<!-- 修改网格员的企业 -->
|
<!-- 修改网格员的企业 -->
|
||||||
<update id="updateEnterpriseOfGridOperator" parameterType="map">
|
<update id="updateEnterpriseOfGridOperator" parameterType="map" flushCache="true">
|
||||||
UPDATE
|
UPDATE
|
||||||
gen_enterprise_of_grid_operator
|
gen_enterprise_of_grid_operator
|
||||||
SET
|
SET
|
||||||
|
@ -264,4 +264,32 @@
|
|||||||
t1.type
|
t1.type
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<!-- 隐患上报简单列表 -->
|
||||||
|
<select id="listHiddenDangerReportSimple" parameterType="map" resultMap="hiddenDangerReportDTO">
|
||||||
|
SELECT
|
||||||
|
*
|
||||||
|
FROM
|
||||||
|
gen_hidden_danger_report
|
||||||
|
WHERE
|
||||||
|
is_delete = 0
|
||||||
|
<if test="year != null and year != ''">
|
||||||
|
AND
|
||||||
|
LEFT(gmt_create, 4) = #{year}
|
||||||
|
</if>
|
||||||
|
<if test="userIds != null and userIds.size > 0">
|
||||||
|
AND
|
||||||
|
creator IN
|
||||||
|
<foreach collection="userIds" index="index" open="(" separator="," close=")">
|
||||||
|
#{userIds[${index}]}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
<if test="checkIds != null and checkIds.size > 0">
|
||||||
|
AND
|
||||||
|
check_id IN
|
||||||
|
<foreach collection="checkIds" index="index" open="(" separator="," close=")">
|
||||||
|
#{checkIds[${index}]}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
@ -2,6 +2,10 @@
|
|||||||
<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd">
|
<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd">
|
||||||
<configuration>
|
<configuration>
|
||||||
|
|
||||||
|
<settings>
|
||||||
|
<setting name="cacheEnabled" value="true"/>
|
||||||
|
</settings>
|
||||||
|
|
||||||
<typeAliases>
|
<typeAliases>
|
||||||
<typeAlias type="java.util.Map" alias="map"/>
|
<typeAlias type="java.util.Map" alias="map"/>
|
||||||
<typeAlias type="java.util.List" alias="list"/>
|
<typeAlias type="java.util.List" alias="list"/>
|
||||||
|
Loading…
Reference in New Issue
Block a user