|
|
@ -2,7 +2,10 @@ package com.hnac.hzims.operational.defect.service.impl; |
|
|
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
import com.hnac.hzims.operational.access.constants.AccessConstants; |
|
|
|
import com.hnac.hzims.operational.access.constants.AccessConstants; |
|
|
|
import com.hnac.hzims.operational.access.entity.OperAccessPlanEntity; |
|
|
|
import com.hnac.hzims.operational.access.entity.OperAccessPlanEntity; |
|
|
|
import com.hnac.hzims.operational.access.entity.OperAccessTaskEntity; |
|
|
|
import com.hnac.hzims.operational.access.entity.OperAccessTaskEntity; |
|
|
@ -36,6 +39,7 @@ import org.apache.poi.ss.util.CellRangeAddress; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
import org.springblade.core.log.exception.ServiceException; |
|
|
|
import org.springblade.core.log.exception.ServiceException; |
|
|
|
|
|
|
|
import org.springblade.core.mp.base.BaseEntity; |
|
|
|
import org.springblade.core.mp.base.BaseServiceImpl; |
|
|
|
import org.springblade.core.mp.base.BaseServiceImpl; |
|
|
|
import org.springblade.core.mp.support.Condition; |
|
|
|
import org.springblade.core.mp.support.Condition; |
|
|
|
import org.springblade.core.secure.utils.AuthUtil; |
|
|
|
import org.springblade.core.secure.utils.AuthUtil; |
|
|
@ -90,6 +94,7 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope |
|
|
|
/** |
|
|
|
/** |
|
|
|
* 开始问题处理流程 |
|
|
|
* 开始问题处理流程 |
|
|
|
* 问题处理流程的第一个处理节点人key 必须是 problemUser |
|
|
|
* 问题处理流程的第一个处理节点人key 必须是 problemUser |
|
|
|
|
|
|
|
* |
|
|
|
* @param |
|
|
|
* @param |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -103,10 +108,7 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope |
|
|
|
defectEntity.setTenantId(phenomenonEntity.getTenantId()); |
|
|
|
defectEntity.setTenantId(phenomenonEntity.getTenantId()); |
|
|
|
save(defectEntity); |
|
|
|
save(defectEntity); |
|
|
|
|
|
|
|
|
|
|
|
Kv variables = Kv.create() |
|
|
|
Kv variables = Kv.create().set(ProcessConstant.TASK_VARIABLE_CREATE_USER, "taskUser_" + phenomenonEntity.getCreateUser()).set(DefectConstant.PROCESS_VARIABLE_HANDLE_USER, "taskUser_" + phenomenonEntity.getHandler()); |
|
|
|
.set(ProcessConstant.TASK_VARIABLE_CREATE_USER, "taskUser_" + phenomenonEntity.getCreateUser()) |
|
|
|
|
|
|
|
.set(DefectConstant.PROCESS_VARIABLE_HANDLE_USER, "taskUser_" + phenomenonEntity.getHandler()) |
|
|
|
|
|
|
|
; |
|
|
|
|
|
|
|
R<BladeFlow> result = flowClient.startProcessInstanceContainNameByKey(defectEntity.getProcDefId(), FlowUtil.getBusinessKey("hzims_oper_defect", String.valueOf(defectEntity.getId())), processName, variables); |
|
|
|
R<BladeFlow> result = flowClient.startProcessInstanceContainNameByKey(defectEntity.getProcDefId(), FlowUtil.getBusinessKey("hzims_oper_defect", String.valueOf(defectEntity.getId())), processName, variables); |
|
|
|
if (result.isSuccess()) { |
|
|
|
if (result.isSuccess()) { |
|
|
|
BladeFlow flow = result.getData(); |
|
|
|
BladeFlow flow = result.getData(); |
|
|
@ -124,6 +126,7 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 处理问题 |
|
|
|
* 处理问题 |
|
|
|
|
|
|
|
* |
|
|
|
* @param flow |
|
|
|
* @param flow |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -175,6 +178,7 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 获取缺陷的统计月报 |
|
|
|
* 获取缺陷的统计月报 |
|
|
|
|
|
|
|
* |
|
|
|
* @param month 格式:"2021-01" |
|
|
|
* @param month 格式:"2021-01" |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -249,6 +253,7 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope |
|
|
|
public List<OperDefectEntity> getDefectList(String emCode, List<String> list) { |
|
|
|
public List<OperDefectEntity> getDefectList(String emCode, List<String> list) { |
|
|
|
return this.baseMapper.selectDefectList(emCode, list); |
|
|
|
return this.baseMapper.selectDefectList(emCode, list); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public List<OperDefectEntity> getDefectByEmCodeList(String emCode) { |
|
|
|
public List<OperDefectEntity> getDefectByEmCodeList(String emCode) { |
|
|
|
return this.baseMapper.selectDefectByEmCodeList(emCode); |
|
|
|
return this.baseMapper.selectDefectByEmCodeList(emCode); |
|
|
@ -262,8 +267,7 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope |
|
|
|
|
|
|
|
|
|
|
|
defectReportsVOList = operDefectVOS.stream().map(operDefectVO -> { |
|
|
|
defectReportsVOList = operDefectVOS.stream().map(operDefectVO -> { |
|
|
|
User finder = UserCache.getUser(operDefectVO.getFinder()); |
|
|
|
User finder = UserCache.getUser(operDefectVO.getFinder()); |
|
|
|
String finderAndTime = (ObjectUtil.isNotEmpty(finder) && StringUtil.isNotBlank(finder.getName()) ? finder.getName() : operDefectVO.getFinder().toString()) |
|
|
|
String finderAndTime = (ObjectUtil.isNotEmpty(finder) && StringUtil.isNotBlank(finder.getName()) ? finder.getName() : operDefectVO.getFinder().toString()) + ":" + DateFormatUtils.format(operDefectVO.getFindTime(), DateUtil.PATTERN_DATETIME); |
|
|
|
+ ":" + DateFormatUtils.format(operDefectVO.getFindTime(), DateUtil.PATTERN_DATETIME); |
|
|
|
|
|
|
|
String handlerAndTime = ""; |
|
|
|
String handlerAndTime = ""; |
|
|
|
if (Func.isNotEmpty(operDefectVO.getHandler())) { |
|
|
|
if (Func.isNotEmpty(operDefectVO.getHandler())) { |
|
|
|
User handler = UserCache.getUser(operDefectVO.getHandler()); |
|
|
|
User handler = UserCache.getUser(operDefectVO.getHandler()); |
|
|
@ -272,8 +276,7 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope |
|
|
|
handlerAndTime = String.format("%s:%s", handlerName, handleTime); |
|
|
|
handlerAndTime = String.format("%s:%s", handlerName, handleTime); |
|
|
|
} |
|
|
|
} |
|
|
|
String seriousSituation = DictCache.getValue(DefectConstant.LEVEL_CODE_DICT_KEY, operDefectVO.getDefectLevel()); |
|
|
|
String seriousSituation = DictCache.getValue(DefectConstant.LEVEL_CODE_DICT_KEY, operDefectVO.getDefectLevel()); |
|
|
|
return DefectReportsVO.builder().faultName(operDefectVO.getFaultName()).seriousSituation(seriousSituation) |
|
|
|
return DefectReportsVO.builder().faultName(operDefectVO.getFaultName()).seriousSituation(seriousSituation).finderAndTime(finderAndTime).handlerAndTime(handlerAndTime).handleSituation(operDefectVO.getConclusion()).build(); |
|
|
|
.finderAndTime(finderAndTime).handlerAndTime(handlerAndTime).handleSituation(operDefectVO.getConclusion()).build(); |
|
|
|
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
|
|
return defectReportsVOList; |
|
|
|
return defectReportsVOList; |
|
|
@ -300,15 +303,12 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope |
|
|
|
operDefectVO = OperDefectWrapper.build().entityVO(detail); |
|
|
|
operDefectVO = OperDefectWrapper.build().entityVO(detail); |
|
|
|
//获取检修计划
|
|
|
|
//获取检修计划
|
|
|
|
IOperAccessPlanService planService = SpringUtil.getBean(OperAccessPlanServiceImpl.class); |
|
|
|
IOperAccessPlanService planService = SpringUtil.getBean(OperAccessPlanServiceImpl.class); |
|
|
|
OperAccessPlanEntity accessPlanEntity = planService.getOne(Wrappers.<OperAccessPlanEntity>lambdaQuery() |
|
|
|
OperAccessPlanEntity accessPlanEntity = planService.getOne(Wrappers.<OperAccessPlanEntity>lambdaQuery().eq(OperAccessPlanEntity::getDefectId, detail.getId())); |
|
|
|
.eq(OperAccessPlanEntity::getDefectId,detail.getId()) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(accessPlanEntity)) { |
|
|
|
if (ObjectUtil.isNotEmpty(accessPlanEntity)) { |
|
|
|
operDefectVO.setAccessPlanId(accessPlanEntity.getId()); |
|
|
|
operDefectVO.setAccessPlanId(accessPlanEntity.getId()); |
|
|
|
if (ObjectUtil.isNotEmpty(accessPlanEntity.getStatus()) && accessPlanEntity.getStatus() > AccessConstants.PLAN_DRAFT) { |
|
|
|
if (ObjectUtil.isNotEmpty(accessPlanEntity.getStatus()) && accessPlanEntity.getStatus() > AccessConstants.PLAN_DRAFT) { |
|
|
|
operDefectVO.setEditStatus(0); |
|
|
|
operDefectVO.setEditStatus(0); |
|
|
|
} |
|
|
|
} else { |
|
|
|
else { |
|
|
|
|
|
|
|
operDefectVO.setEditStatus(1); |
|
|
|
operDefectVO.setEditStatus(1); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -318,6 +318,7 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 获取安全检查消缺项统计 |
|
|
|
* 获取安全检查消缺项统计 |
|
|
|
|
|
|
|
* |
|
|
|
* @param startDate 开始时间 |
|
|
|
* @param startDate 开始时间 |
|
|
|
* @param endDate 结束时间 |
|
|
|
* @param endDate 结束时间 |
|
|
|
* @param dept 机构ID |
|
|
|
* @param dept 机构ID |
|
|
@ -328,18 +329,13 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope |
|
|
|
public SafeCheckStatisticVO getDefectCheck(String startDate, String endDate, Long dept, String defectType) { |
|
|
|
public SafeCheckStatisticVO getDefectCheck(String startDate, String endDate, Long dept, String defectType) { |
|
|
|
SafeCheckStatisticVO vo = new SafeCheckStatisticVO(); |
|
|
|
SafeCheckStatisticVO vo = new SafeCheckStatisticVO(); |
|
|
|
//获取消缺总数
|
|
|
|
//获取消缺总数
|
|
|
|
LambdaQueryWrapper<OperPhenomenonEntity> wrapper = Wrappers.<OperPhenomenonEntity>lambdaQuery() |
|
|
|
LambdaQueryWrapper<OperPhenomenonEntity> wrapper = Wrappers.<OperPhenomenonEntity>lambdaQuery().eq(OperPhenomenonEntity::getCreateDept, dept).ge(OperPhenomenonEntity::getPlanStartTime, startDate).le(OperPhenomenonEntity::getPlanStartTime, endDate).eq(OperPhenomenonEntity::getIsDefect, 1); |
|
|
|
.eq(OperPhenomenonEntity::getCreateDept,dept) |
|
|
|
|
|
|
|
.ge(OperPhenomenonEntity::getPlanStartTime,startDate) |
|
|
|
|
|
|
|
.le(OperPhenomenonEntity::getPlanStartTime,endDate) |
|
|
|
|
|
|
|
.eq(OperPhenomenonEntity::getIsDefect,1); |
|
|
|
|
|
|
|
//缺陷等级为Ⅰ级缺陷时为重大缺陷 其他为一般缺陷
|
|
|
|
//缺陷等级为Ⅰ级缺陷时为重大缺陷 其他为一般缺陷
|
|
|
|
if ("1".equals(defectType)) { |
|
|
|
if ("1".equals(defectType)) { |
|
|
|
vo.setProjectType(Constants.SafeCheckProjectEnum.SERIOUS_DEFECT.getType()); |
|
|
|
vo.setProjectType(Constants.SafeCheckProjectEnum.SERIOUS_DEFECT.getType()); |
|
|
|
vo.setProjectTypeName(Constants.SafeCheckProjectEnum.SERIOUS_DEFECT.getName()); |
|
|
|
vo.setProjectTypeName(Constants.SafeCheckProjectEnum.SERIOUS_DEFECT.getName()); |
|
|
|
wrapper.eq(OperPhenomenonEntity::getDefectLevel, DefectConstant.DefectLevelEnum.ONE.getStatus()); |
|
|
|
wrapper.eq(OperPhenomenonEntity::getDefectLevel, DefectConstant.DefectLevelEnum.ONE.getStatus()); |
|
|
|
} |
|
|
|
} else if ("2".equals(defectType)) { |
|
|
|
else if("2".equals(defectType)){ |
|
|
|
|
|
|
|
vo.setProjectType(Constants.SafeCheckProjectEnum.NORMAL_DEFECT.getType()); |
|
|
|
vo.setProjectType(Constants.SafeCheckProjectEnum.NORMAL_DEFECT.getType()); |
|
|
|
vo.setProjectTypeName(Constants.SafeCheckProjectEnum.NORMAL_DEFECT.getName()); |
|
|
|
vo.setProjectTypeName(Constants.SafeCheckProjectEnum.NORMAL_DEFECT.getName()); |
|
|
|
wrapper.ne(OperPhenomenonEntity::getDefectLevel, DefectConstant.DefectLevelEnum.ONE.getStatus()); |
|
|
|
wrapper.ne(OperPhenomenonEntity::getDefectLevel, DefectConstant.DefectLevelEnum.ONE.getStatus()); |
|
|
@ -347,9 +343,7 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope |
|
|
|
List<OperPhenomenonEntity> operPhenomenonEntities = operPhenomenonMapper.selectList(wrapper); |
|
|
|
List<OperPhenomenonEntity> operPhenomenonEntities = operPhenomenonMapper.selectList(wrapper); |
|
|
|
if (CollectionUtil.isNotEmpty(operPhenomenonEntities)) { |
|
|
|
if (CollectionUtil.isNotEmpty(operPhenomenonEntities)) { |
|
|
|
//获取消缺率
|
|
|
|
//获取消缺率
|
|
|
|
List<OperPhenomenonEntity> finishDefects = operPhenomenonEntities.stream().filter( |
|
|
|
List<OperPhenomenonEntity> finishDefects = operPhenomenonEntities.stream().filter(p -> ObjectUtil.isNotEmpty(p.getConclusionStatus()) && "1".equals(p.getConclusionStatus())).collect(Collectors.toList()); |
|
|
|
p-> ObjectUtil.isNotEmpty(p.getConclusionStatus()) && "1".equals(p.getConclusionStatus()) |
|
|
|
|
|
|
|
).collect(Collectors.toList()); |
|
|
|
|
|
|
|
vo.setTotal(operPhenomenonEntities.size()); |
|
|
|
vo.setTotal(operPhenomenonEntities.size()); |
|
|
|
vo.setQualified(finishDefects.size()); |
|
|
|
vo.setQualified(finishDefects.size()); |
|
|
|
vo.setQualifiedRate(new BigDecimal(finishDefects.size() / (double) operPhenomenonEntities.size() * 100).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()); |
|
|
|
vo.setQualifiedRate(new BigDecimal(finishDefects.size() / (double) operPhenomenonEntities.size() * 100).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()); |
|
|
@ -359,6 +353,7 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 根据流程ID判断该缺陷是否能执行 |
|
|
|
* 根据流程ID判断该缺陷是否能执行 |
|
|
|
|
|
|
|
* |
|
|
|
* @param processInstanceId 流程ID |
|
|
|
* @param processInstanceId 流程ID |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -397,6 +392,7 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 创建标题单元格样式 |
|
|
|
* 创建标题单元格样式 |
|
|
|
|
|
|
|
* |
|
|
|
* @param wb |
|
|
|
* @param wb |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -425,6 +421,7 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 创建表格内容单元格样式 |
|
|
|
* 创建表格内容单元格样式 |
|
|
|
|
|
|
|
* |
|
|
|
* @param wb |
|
|
|
* @param wb |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -449,6 +446,7 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 设置缺陷月报表excel导出-本月与前几月缺陷报表内单元格 |
|
|
|
* 设置缺陷月报表excel导出-本月与前几月缺陷报表内单元格 |
|
|
|
|
|
|
|
* |
|
|
|
* @param sheet |
|
|
|
* @param sheet |
|
|
|
* @param currentRow |
|
|
|
* @param currentRow |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -509,14 +507,11 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope |
|
|
|
HSSFCell compare_content_cell1 = row.getCell(0); |
|
|
|
HSSFCell compare_content_cell1 = row.getCell(0); |
|
|
|
if ("1".equals(currentRatioDTO.getDefectLevel())) { |
|
|
|
if ("1".equals(currentRatioDTO.getDefectLevel())) { |
|
|
|
compare_content_cell1.setCellValue("一类缺陷"); |
|
|
|
compare_content_cell1.setCellValue("一类缺陷"); |
|
|
|
} |
|
|
|
} else if ("2".equals(currentRatioDTO.getDefectLevel())) { |
|
|
|
else if("2".equals(currentRatioDTO.getDefectLevel())){ |
|
|
|
|
|
|
|
compare_content_cell1.setCellValue("二类缺陷"); |
|
|
|
compare_content_cell1.setCellValue("二类缺陷"); |
|
|
|
} |
|
|
|
} else if ("3".equals(currentRatioDTO.getDefectLevel())) { |
|
|
|
else if("3".equals(currentRatioDTO.getDefectLevel())){ |
|
|
|
|
|
|
|
compare_content_cell1.setCellValue("三类缺陷"); |
|
|
|
compare_content_cell1.setCellValue("三类缺陷"); |
|
|
|
} |
|
|
|
} else if ("合计".equals(currentRatioDTO.getDefectLevel())) { |
|
|
|
else if("合计".equals(currentRatioDTO.getDefectLevel())){ |
|
|
|
|
|
|
|
compare_content_cell1.setCellValue(currentRatioDTO.getDefectLevel()); |
|
|
|
compare_content_cell1.setCellValue(currentRatioDTO.getDefectLevel()); |
|
|
|
} |
|
|
|
} |
|
|
|
HSSFCell compare_content_cell2 = row.getCell(1); |
|
|
|
HSSFCell compare_content_cell2 = row.getCell(1); |
|
|
@ -543,6 +538,7 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 设置缺陷月报表excel导出-管理指标(本月)表内单元格 |
|
|
|
* 设置缺陷月报表excel导出-管理指标(本月)表内单元格 |
|
|
|
|
|
|
|
* |
|
|
|
* @param wb |
|
|
|
* @param wb |
|
|
|
* @param sheet |
|
|
|
* @param sheet |
|
|
|
* @param currentRow 记录表格中叠加后的数据 |
|
|
|
* @param currentRow 记录表格中叠加后的数据 |
|
|
@ -617,6 +613,7 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 设置缺陷月报表excel导出-重复分类缺陷汇总表内单元格 |
|
|
|
* 设置缺陷月报表excel导出-重复分类缺陷汇总表内单元格 |
|
|
|
|
|
|
|
* |
|
|
|
* @param wb |
|
|
|
* @param wb |
|
|
|
* @param sheet |
|
|
|
* @param sheet |
|
|
|
* @param currentRow 记录表格中叠加后的数据 |
|
|
|
* @param currentRow 记录表格中叠加后的数据 |
|
|
@ -665,14 +662,11 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope |
|
|
|
sheet.addMergedRegion(repeat_content_religon); |
|
|
|
sheet.addMergedRegion(repeat_content_religon); |
|
|
|
if ("1".equals(repeat.get(i).getDefectLevel())) { |
|
|
|
if ("1".equals(repeat.get(i).getDefectLevel())) { |
|
|
|
repeat_cell1.setCellValue("一类缺陷"); |
|
|
|
repeat_cell1.setCellValue("一类缺陷"); |
|
|
|
} |
|
|
|
} else if ("2".equals(repeat.get(i).getDefectLevel())) { |
|
|
|
else if("2".equals(repeat.get(i).getDefectLevel())){ |
|
|
|
|
|
|
|
repeat_cell1.setCellValue("二类缺陷"); |
|
|
|
repeat_cell1.setCellValue("二类缺陷"); |
|
|
|
} |
|
|
|
} else if ("3".equals(repeat.get(i).getDefectLevel())) { |
|
|
|
else if("3".equals(repeat.get(i).getDefectLevel())){ |
|
|
|
|
|
|
|
repeat_cell1.setCellValue("三类缺陷"); |
|
|
|
repeat_cell1.setCellValue("三类缺陷"); |
|
|
|
} |
|
|
|
} else if ("合计".equals(repeat.get(i).getDefectLevel())) { |
|
|
|
else if("合计".equals(repeat.get(i).getDefectLevel())){ |
|
|
|
|
|
|
|
repeat_cell1.setCellValue(repeat.get(i).getDefectLevel()); |
|
|
|
repeat_cell1.setCellValue(repeat.get(i).getDefectLevel()); |
|
|
|
} |
|
|
|
} |
|
|
|
//第二列
|
|
|
|
//第二列
|
|
|
@ -699,6 +693,7 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 补全合并单元格时 表格行所有单元格 |
|
|
|
* 补全合并单元格时 表格行所有单元格 |
|
|
|
|
|
|
|
* |
|
|
|
* @param headRow |
|
|
|
* @param headRow |
|
|
|
* @param rowLen |
|
|
|
* @param rowLen |
|
|
|
* @param status 0:设置表头样式 1:设置内容样式 |
|
|
|
* @param status 0:设置表头样式 1:设置内容样式 |
|
|
@ -708,8 +703,7 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope |
|
|
|
HSSFCell hssfcell = headRow.createCell(i); |
|
|
|
HSSFCell hssfcell = headRow.createCell(i); |
|
|
|
if (status == 0) { |
|
|
|
if (status == 0) { |
|
|
|
hssfcell.setCellStyle(this.setHeadCellStyle(wb)); |
|
|
|
hssfcell.setCellStyle(this.setHeadCellStyle(wb)); |
|
|
|
} |
|
|
|
} else if (status == 1) { |
|
|
|
else if(status == 1){ |
|
|
|
|
|
|
|
hssfcell.setCellStyle(this.setContentCellStyle(wb)); |
|
|
|
hssfcell.setCellStyle(this.setContentCellStyle(wb)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -717,6 +711,7 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 处理double数据保留两位小数 |
|
|
|
* 处理double数据保留两位小数 |
|
|
|
|
|
|
|
* |
|
|
|
* @param num |
|
|
|
* @param num |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -730,6 +725,7 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 获取当前月统计数据 |
|
|
|
* 获取当前月统计数据 |
|
|
|
|
|
|
|
* |
|
|
|
* @param month |
|
|
|
* @param month |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -740,6 +736,7 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 当年1月 - 当前月获取缺陷等级统计数据 |
|
|
|
* 当年1月 - 当前月获取缺陷等级统计数据 |
|
|
|
|
|
|
|
* |
|
|
|
* @param month "2021-01" |
|
|
|
* @param month "2021-01" |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -765,6 +762,7 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 获取按月管理指标统计数据 |
|
|
|
* 获取按月管理指标统计数据 |
|
|
|
|
|
|
|
* |
|
|
|
* @param month |
|
|
|
* @param month |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -785,6 +783,7 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 获取重复缺陷等级统计数据 |
|
|
|
* 获取重复缺陷等级统计数据 |
|
|
|
|
|
|
|
* |
|
|
|
* @param month |
|
|
|
* @param month |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -795,16 +794,9 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope |
|
|
|
//总缺陷数
|
|
|
|
//总缺陷数
|
|
|
|
int total = repetStatistics.stream().mapToInt(OperDefectStatisticsCodeDTO::getDefectNum).sum(); |
|
|
|
int total = repetStatistics.stream().mapToInt(OperDefectStatisticsCodeDTO::getDefectNum).sum(); |
|
|
|
//总重复缺陷数
|
|
|
|
//总重复缺陷数
|
|
|
|
int totalRepeat = repetStatistics |
|
|
|
int totalRepeat = repetStatistics.stream().filter(s -> s.getDefectNum() > 1 && s.getDefectLevel() != null).collect(Collectors.summingInt(OperDefectStatisticsCodeDTO::getDefectNum)); |
|
|
|
.stream() |
|
|
|
|
|
|
|
.filter(s-> s.getDefectNum() > 1 && s.getDefectLevel() != null ) |
|
|
|
|
|
|
|
.collect(Collectors.summingInt(OperDefectStatisticsCodeDTO::getDefectNum)); |
|
|
|
|
|
|
|
//等级重复统计
|
|
|
|
//等级重复统计
|
|
|
|
Map<String, IntSummaryStatistics> repeatList = repetStatistics |
|
|
|
Map<String, IntSummaryStatistics> repeatList = repetStatistics.stream().filter(s -> s.getDefectNum() > 1 && s.getDefectLevel() != null).collect(Collectors.groupingBy(OperDefectStatisticsCodeDTO::getDefectLevel, Collectors.summarizingInt(OperDefectStatisticsCodeDTO::getDefectNum))); |
|
|
|
.stream() |
|
|
|
|
|
|
|
.filter(s -> s.getDefectNum() > 1 && s.getDefectLevel() != null ) |
|
|
|
|
|
|
|
.collect(Collectors.groupingBy(OperDefectStatisticsCodeDTO::getDefectLevel, |
|
|
|
|
|
|
|
Collectors.summarizingInt(OperDefectStatisticsCodeDTO::getDefectNum))); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
OperDefectRepeatRatioDTO one = new OperDefectRepeatRatioDTO(); |
|
|
|
OperDefectRepeatRatioDTO one = new OperDefectRepeatRatioDTO(); |
|
|
|
one.setDefectLevel(DefectConstant.DefectLevelEnum.ONE.getStatus()); |
|
|
|
one.setDefectLevel(DefectConstant.DefectLevelEnum.ONE.getStatus()); |
|
|
@ -830,12 +822,7 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope |
|
|
|
three.setRepeatRatio(three.getHappenNum() / Double.valueOf(totalRepeat)); |
|
|
|
three.setRepeatRatio(three.getHappenNum() / Double.valueOf(totalRepeat)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
OperDefectRepeatRatioDTO addUp = OperDefectRepeatRatioDTO.builder() |
|
|
|
OperDefectRepeatRatioDTO addUp = OperDefectRepeatRatioDTO.builder().defectLevel("合计").happenNum(one.getHappenNum() + two.getHappenNum() + three.getHappenNum()).happenRatio(one.getHappenRatio() + two.getHappenRatio() + three.getHappenRatio()).repeatRatio(1.00).build(); |
|
|
|
.defectLevel("合计") |
|
|
|
|
|
|
|
.happenNum(one.getHappenNum() + two.getHappenNum() + three.getHappenNum()) |
|
|
|
|
|
|
|
.happenRatio(one.getHappenRatio() + two.getHappenRatio() + three.getHappenRatio()) |
|
|
|
|
|
|
|
.repeatRatio(1.00) |
|
|
|
|
|
|
|
.build(); |
|
|
|
|
|
|
|
if (addUp.getHappenNum().equals(0L)) { |
|
|
|
if (addUp.getHappenNum().equals(0L)) { |
|
|
|
addUp.setRepeatRatio(0.0); |
|
|
|
addUp.setRepeatRatio(0.0); |
|
|
|
} |
|
|
|
} |
|
|
@ -856,13 +843,11 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope |
|
|
|
three.setDefectLevel(DefectConstant.DefectLevelEnum.THREE.getStatus()); |
|
|
|
three.setDefectLevel(DefectConstant.DefectLevelEnum.THREE.getStatus()); |
|
|
|
|
|
|
|
|
|
|
|
//等级统计
|
|
|
|
//等级统计
|
|
|
|
Map<String, IntSummaryStatistics> collectLevel = dtos.stream().filter(s-> s.getDefectLevel() != null).collect(Collectors.groupingBy(OperDefectStatisticsStatusDTO::getDefectLevel, |
|
|
|
Map<String, IntSummaryStatistics> collectLevel = dtos.stream().filter(s -> s.getDefectLevel() != null).collect(Collectors.groupingBy(OperDefectStatisticsStatusDTO::getDefectLevel, Collectors.summarizingInt(OperDefectStatisticsStatusDTO::getDefectNum))); |
|
|
|
Collectors.summarizingInt(OperDefectStatisticsStatusDTO::getDefectNum))); |
|
|
|
|
|
|
|
//总缺陷数
|
|
|
|
//总缺陷数
|
|
|
|
int total = dtos.stream().mapToInt(OperDefectStatisticsStatusDTO::getDefectNum).sum(); |
|
|
|
int total = dtos.stream().mapToInt(OperDefectStatisticsStatusDTO::getDefectNum).sum(); |
|
|
|
//状态统计
|
|
|
|
//状态统计
|
|
|
|
Map<String, IntSummaryStatistics> collectStatus = dtos.stream().collect(Collectors.groupingBy(OperDefectStatisticsStatusDTO::getHandleStatus, |
|
|
|
Map<String, IntSummaryStatistics> collectStatus = dtos.stream().collect(Collectors.groupingBy(OperDefectStatisticsStatusDTO::getHandleStatus, Collectors.summarizingInt(OperDefectStatisticsStatusDTO::getDefectNum))); |
|
|
|
Collectors.summarizingInt(OperDefectStatisticsStatusDTO::getDefectNum))); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (OperDefectStatisticsStatusDTO dto : dtos) { |
|
|
|
for (OperDefectStatisticsStatusDTO dto : dtos) { |
|
|
|
if (dto.getDefectLevel() != null) { |
|
|
|
if (dto.getDefectLevel() != null) { |
|
|
@ -882,20 +867,13 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
int solveNum = collectStatus.get(DefectConstant.HandlerStatusEnum.FINISH_STATUS.getStatus()) == null ? 0 : (int) collectStatus.get(DefectConstant.HandlerStatusEnum.FINISH_STATUS.getStatus()).getSum(); |
|
|
|
int solveNum = collectStatus.get(DefectConstant.HandlerStatusEnum.FINISH_STATUS.getStatus()) == null ? 0 : (int) collectStatus.get(DefectConstant.HandlerStatusEnum.FINISH_STATUS.getStatus()).getSum(); |
|
|
|
OperDefectRatioDTO addUp = OperDefectRatioDTO.builder() |
|
|
|
OperDefectRatioDTO addUp = OperDefectRatioDTO.builder().happenNum(total).happenRatio(total == 0 ? 0 : 1.00).defectLevel("合计").sovleRatio(solveNum == 0 ? 0 : 1.00).sovleNum(solveNum).build(); |
|
|
|
.happenNum(total) |
|
|
|
|
|
|
|
.happenRatio(total == 0 ? 0 : 1.00) |
|
|
|
|
|
|
|
.defectLevel("合计") |
|
|
|
|
|
|
|
.sovleRatio(solveNum == 0 ? 0 : 1.00) |
|
|
|
|
|
|
|
.sovleNum(solveNum) |
|
|
|
|
|
|
|
.build(); |
|
|
|
|
|
|
|
re.addAll(Arrays.asList(one, two, three, addUp)); |
|
|
|
re.addAll(Arrays.asList(one, two, three, addUp)); |
|
|
|
return re; |
|
|
|
return re; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void setReturnRatio(int total, OperDefectRatioDTO ratio, OperDefectStatisticsStatusDTO dto, |
|
|
|
private void setReturnRatio(int total, OperDefectRatioDTO ratio, OperDefectStatisticsStatusDTO dto, Map<String, IntSummaryStatistics> collectLevel, Map<String, IntSummaryStatistics> collectStatus) { |
|
|
|
Map<String, IntSummaryStatistics> collectLevel, Map<String, IntSummaryStatistics> collectStatus){ |
|
|
|
|
|
|
|
if (dto.getHandleStatus().equals(DefectConstant.HandlerStatusEnum.FINISH_STATUS.getStatus())) { |
|
|
|
if (dto.getHandleStatus().equals(DefectConstant.HandlerStatusEnum.FINISH_STATUS.getStatus())) { |
|
|
|
ratio.setSovleNum(dto.getDefectNum()); |
|
|
|
ratio.setSovleNum(dto.getDefectNum()); |
|
|
|
ratio.setSovleRatio(Double.valueOf(dto.getDefectNum()) / collectStatus.get(DefectConstant.HandlerStatusEnum.FINISH_STATUS.getStatus()).getSum()); |
|
|
|
ratio.setSovleRatio(Double.valueOf(dto.getDefectNum()) / collectStatus.get(DefectConstant.HandlerStatusEnum.FINISH_STATUS.getStatus()).getSum()); |
|
|
@ -909,24 +887,49 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 更新缺陷信息 |
|
|
|
* 更新缺陷信息 |
|
|
|
|
|
|
|
* |
|
|
|
* @param entity |
|
|
|
* @param entity |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public boolean updateDefectInfo(OperDefectEntity entity) { |
|
|
|
public boolean updateDefectInfo(OperDefectEntity entity) { |
|
|
|
return this.update(Wrappers.<OperDefectEntity>lambdaUpdate() |
|
|
|
return this.update(Wrappers.<OperDefectEntity>lambdaUpdate().set(OperDefectEntity::getActHours, entity.getActHours()).set(OperDefectEntity::getActStartTime, entity.getActStartTime()).set(OperDefectEntity::getActEndTime, entity.getActEndTime()).set(OperDefectEntity::getDisposeDesc, entity.getDisposeDesc()).eq(OperDefectEntity::getDefectCode, entity.getDefectCode())); |
|
|
|
.set(OperDefectEntity::getActHours, entity.getActHours()) |
|
|
|
|
|
|
|
.set(OperDefectEntity::getActStartTime,entity.getActStartTime()) |
|
|
|
|
|
|
|
.set(OperDefectEntity::getActEndTime,entity.getActEndTime()) |
|
|
|
|
|
|
|
.set(OperDefectEntity::getDisposeDesc,entity.getDisposeDesc()) |
|
|
|
|
|
|
|
.eq(OperDefectEntity::getDefectCode,entity.getDefectCode())); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public boolean updateDefectHanderState(OperDefectEntity entity) { |
|
|
|
public boolean updateDefectHanderState(OperDefectEntity entity) { |
|
|
|
return this.update(Wrappers.<OperDefectEntity>lambdaUpdate() |
|
|
|
return this.update(Wrappers.<OperDefectEntity>lambdaUpdate().set(OperDefectEntity::getHandleStatus, entity.getHandleStatus()).eq(OperDefectEntity::getDefectCode, entity.getDefectCode())); |
|
|
|
.set(OperDefectEntity::getHandleStatus, entity.getHandleStatus()) |
|
|
|
} |
|
|
|
.eq(OperDefectEntity::getDefectCode,entity.getDefectCode())); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 分页查询 |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param operDefectEntityPage |
|
|
|
|
|
|
|
* @param defect |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public IPage<OperDefectEntity> selectPage(Page<OperDefectEntity> operDefectEntityPage, OperDefectEntity defect) { |
|
|
|
|
|
|
|
LambdaQueryWrapper<OperDefectEntity> queryWrapper = new LambdaQueryWrapper<>(); |
|
|
|
|
|
|
|
queryWrapper.like(StringUtils.isNotBlank(defect.getDefectCode()), OperDefectEntity::getDefectCode, defect.getDefectCode()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//缺陷编号
|
|
|
|
|
|
|
|
queryWrapper.ge(defect.getActStartTime() != null, OperDefectEntity::getActStartTime, defect.getActStartTime()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
queryWrapper.le(defect.getActEndTime() != null, OperDefectEntity::getActEndTime, defect.getActEndTime()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
queryWrapper.ge(defect.getStartTime() != null, OperDefectEntity::getCreateTime, defect.getStartTime()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
queryWrapper.le(defect.getEndTime() != null, OperDefectEntity::getCreateTime, defect.getEndTime()); |
|
|
|
|
|
|
|
//区域Id
|
|
|
|
|
|
|
|
queryWrapper.eq(BaseEntity::getCreateDept, defect.getCreateDept()); |
|
|
|
|
|
|
|
//年月查询
|
|
|
|
|
|
|
|
queryWrapper.apply(defect.getYearMonth() != null, "date_format(CREATE_TIME,'%Y-%m') = '" + |
|
|
|
|
|
|
|
defect.getYearMonth() + "'"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
queryWrapper.orderByDesc(OperDefectEntity::getActStartTime); |
|
|
|
|
|
|
|
return baseMapper.selectPage(operDefectEntityPage, queryWrapper); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|