Browse Source

#检修卡配置修改

zhongwei
yang_shj 8 months ago
parent
commit
05a6e3b804
  1. 6
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/dto/OperDefectRepeatRatioDTO.java
  2. 3
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/mapper/AlarmHandleMapper.xml
  3. 76
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/OperDefectServiceImpl.java
  4. 5
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/controller/OverConfigController.java
  5. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/OverConfigService.java
  6. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/OverDetailsService.java
  7. 1
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/impl/OverConfigServiceImpl.java
  8. 15
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/impl/OverDetailsServiceImpl.java

6
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/dto/OperDefectRepeatRatioDTO.java

@ -27,9 +27,13 @@ public class OperDefectRepeatRatioDTO {
// @ApiModelProperty(value = "缺陷等级名称") // @ApiModelProperty(value = "缺陷等级名称")
// private String defectLevelName; // private String defectLevelName;
@ApiModelProperty(value = "发生数量") @ApiModelProperty(value = "重复缺陷发生数量")
private Long happenNum = 0L; private Long happenNum = 0L;
@ApiModelProperty(value = "缺陷发生总数")
private Long happenSumNum = 0L;
@ApiModelProperty(value = "占总缺陷的比率") @ApiModelProperty(value = "占总缺陷的比率")
private Double happenRatio = 0.0; private Double happenRatio = 0.0;

3
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/mapper/AlarmHandleMapper.xml

@ -4,9 +4,10 @@
<select id="selectHandlePage" resultType="com.hnac.hzims.alarm.config.vo.AlarmHandleVo"> <select id="selectHandlePage" resultType="com.hnac.hzims.alarm.config.vo.AlarmHandleVo">
SELECT H.*,S.NAME AS STATION_NAME SELECT H.*,S.NAME AS STATION_NAME,F.PROCESS_INSTANCE_ID
FROM HZIMS_ALARM_HANDLE H FROM HZIMS_ALARM_HANDLE H
LEFT JOIN HZIMS_OPERATION.HZIMS_STATION S ON H.STATION_CODE = S.CODE LEFT JOIN HZIMS_OPERATION.HZIMS_STATION S ON H.STATION_CODE = S.CODE
LEFT JOIN HZIMS_ALARM_HANDLE_FLOW F ON H.ALARM_ID = F.ALARM_ID
<where> <where>
H.IS_DELETED = 0 H.IS_DELETED = 0
<if test="param.stationCode != null"> <if test="param.stationCode != null">

76
hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/OperDefectServiceImpl.java

@ -730,26 +730,29 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
sheet.addMergedRegion(repeat_religon); sheet.addMergedRegion(repeat_religon);
currentRow++; currentRow++;
//表头2
CellRangeAddress repeat_head2_cell_religon = new CellRangeAddress(currentRow, currentRow, (short) 0, (short) 2);
sheet.addMergedRegion(repeat_head2_cell_religon);
HSSFRow repeat_head2 = sheet.createRow(currentRow); HSSFRow repeat_head2 = sheet.createRow(currentRow);
this.setFullHeadCell(wb, repeat_head2, (short) 9, 0); this.setFullHeadCell(wb, repeat_head2, (short) 9, 0);
HSSFCell repeat_head2_cell1 = repeat_head2.getCell(3); HSSFCell repeat_head2_cell1 = repeat_head2.getCell(1);
CellRangeAddress repeat_head2_cell1_religon = new CellRangeAddress(currentRow, currentRow, (short) 3, (short) 4); CellRangeAddress repeat_head2_cell1_religon = new CellRangeAddress(currentRow, currentRow, (short) 1, (short) 2);
sheet.addMergedRegion(repeat_head2_cell1_religon); sheet.addMergedRegion(repeat_head2_cell1_religon);
repeat_head2_cell1.setCellValue("发生数量"); repeat_head2_cell1.setCellValue("重复发生数量");
HSSFCell repeat_head2_cell2 = repeat_head2.getCell(5); HSSFCell repeat_head2_cell2 = repeat_head2.getCell(3);
CellRangeAddress repeat_head2_cell2_religon = new CellRangeAddress(currentRow, currentRow, (short) 5, (short) 6); CellRangeAddress repeat_head2_cell2_religon = new CellRangeAddress(currentRow, currentRow, (short) 3, (short) 4);
sheet.addMergedRegion(repeat_head2_cell2_religon); sheet.addMergedRegion(repeat_head2_cell2_religon);
repeat_head2_cell2.setCellValue("占重复缺陷总数的比率(%)"); repeat_head2_cell2.setCellValue("占重复缺陷总数的比率(%)");
HSSFCell repeat_head2_cell3 = repeat_head2.getCell(7);
CellRangeAddress repeat_head2_cell3_religon = new CellRangeAddress(currentRow, currentRow, (short) 7, (short) 8); HSSFCell repeat_head2_cell3 = repeat_head2.getCell(5);
CellRangeAddress repeat_head2_cell3_religon = new CellRangeAddress(currentRow, currentRow, (short) 5, (short) 6);
sheet.addMergedRegion(repeat_head2_cell3_religon); sheet.addMergedRegion(repeat_head2_cell3_religon);
repeat_head2_cell3.setCellValue("占总缺陷的比率(%)"); repeat_head2_cell3.setCellValue("总发生数量");
HSSFCell repeat_head2_cell4 = repeat_head2.getCell(7);
CellRangeAddress repeat_head2_cell4_religon = new CellRangeAddress(currentRow, currentRow, (short) 7, (short) 8);
sheet.addMergedRegion(repeat_head2_cell4_religon);
repeat_head2_cell4.setCellValue("占总缺陷的比率(%)");
currentRow++; currentRow++;
@ -759,8 +762,6 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
this.setFullHeadCell(wb, repeat_row, (short) 9, 1); this.setFullHeadCell(wb, repeat_row, (short) 9, 1);
//第一列 //第一列
HSSFCell repeat_cell1 = repeat_row.getCell(0); HSSFCell repeat_cell1 = repeat_row.getCell(0);
CellRangeAddress repeat_content_religon = new CellRangeAddress(currentRow, currentRow, (short) 0, (short) 2);
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())) {
@ -771,22 +772,28 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
repeat_cell1.setCellValue(repeat.get(i).getDefectLevel()); repeat_cell1.setCellValue(repeat.get(i).getDefectLevel());
} }
//第二列 //第二列
HSSFCell repeat_cell2 = repeat_row.getCell(3); HSSFCell repeat_cell2 = repeat_row.getCell(1);
CellRangeAddress repeat_content_religon1 = new CellRangeAddress(currentRow, currentRow, (short) 3, (short) 4); CellRangeAddress repeat_content_religon1 = new CellRangeAddress(currentRow, currentRow, (short) 1, (short) 2);
sheet.addMergedRegion(repeat_content_religon1); sheet.addMergedRegion(repeat_content_religon1);
repeat_cell2.setCellValue(repeat.get(i).getHappenNum()); repeat_cell2.setCellValue(repeat.get(i).getHappenNum());
//第三列 //第三列
HSSFCell repeat_cell3 = repeat_row.getCell(5); HSSFCell repeat_cell3 = repeat_row.getCell(3);
CellRangeAddress repeat_content_religon2 = new CellRangeAddress(currentRow, currentRow, (short) 5, (short) 6); CellRangeAddress repeat_content_religon2 = new CellRangeAddress(currentRow, currentRow, (short) 3, (short) 4);
sheet.addMergedRegion(repeat_content_religon2); sheet.addMergedRegion(repeat_content_religon2);
repeat_cell3.setCellValue(this.dealDouble(repeat.get(i).getRepeatRatio())); repeat_cell3.setCellValue(this.dealDouble(repeat.get(i).getRepeatRatio()));
//第四列 //第四列
HSSFCell repeat_cell4 = repeat_row.getCell(7); HSSFCell repeat_cell4 = repeat_row.getCell(5);
CellRangeAddress repeat_content_religon3 = new CellRangeAddress(currentRow, currentRow, (short) 7, (short) 8); CellRangeAddress repeat_content_religon3 = new CellRangeAddress(currentRow, currentRow, (short) 5, (short) 6);
sheet.addMergedRegion(repeat_content_religon3); sheet.addMergedRegion(repeat_content_religon3);
repeat_cell4.setCellValue(this.dealDouble(repeat.get(i).getHappenRatio())); repeat_cell4.setCellValue(repeat.get(i).getHappenSumNum());
//第五列
HSSFCell repeat_cell5 = repeat_row.getCell(7);
CellRangeAddress repeat_content_religon4 = new CellRangeAddress(currentRow, currentRow, (short) 7, (short) 8);
sheet.addMergedRegion(repeat_content_religon4);
repeat_cell5.setCellValue(this.dealDouble(repeat.get(i).getHappenRatio()));
currentRow++; currentRow++;
} }
return currentRow; return currentRow;
@ -944,7 +951,7 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
List<String> deptList ; List<String> deptList ;
R<List<Dept>> res = sysClient.getDeptByCurrentUser(); R<List<Dept>> res = sysClient.getDeptByCurrentUser();
if (res.isSuccess() && CollectionUtil.isNotEmpty(res.getData())) { if (res.isSuccess() && CollectionUtil.isNotEmpty(res.getData())) {
deptList = res.getData().stream().map(Dept::getId).map(s -> s.toString()).collect(Collectors.toList()); deptList = res.getData().stream().map(Dept::getId).map(Object::toString).collect(Collectors.toList());
} else { } else {
throw new WebServiceException("该用户没有此权限"); throw new WebServiceException("该用户没有此权限");
} }
@ -961,35 +968,46 @@ 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.stream().filter(s -> s.getDefectNum() > 1 && s.getDefectLevel() != null).collect(Collectors.summingInt(OperDefectStatisticsCodeDTO::getDefectNum)); int totalRepeat = repetStatistics.stream().filter(s -> s.getDefectNum() > 1 && s.getDefectLevel() != null).mapToInt(OperDefectStatisticsCodeDTO::getDefectNum).sum();
//等级重复统计 //等级重复统计
Map<String, IntSummaryStatistics> repeatList = repetStatistics.stream().filter(s -> s.getDefectNum() > 1 && s.getDefectLevel() != null).collect(Collectors.groupingBy(OperDefectStatisticsCodeDTO::getDefectLevel, Collectors.summarizingInt(OperDefectStatisticsCodeDTO::getDefectNum))); Map<String, IntSummaryStatistics> repeatList = repetStatistics.stream().filter(s -> s.getDefectNum() > 1 && s.getDefectLevel() != null).collect(Collectors.groupingBy(OperDefectStatisticsCodeDTO::getDefectLevel, Collectors.summarizingInt(OperDefectStatisticsCodeDTO::getDefectNum)));
//缺陷等级分类总数统计
Map<String, IntSummaryStatistics> sums = repetStatistics.stream().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());
if (repeatList.get(one.getDefectLevel()) != null) { if (repeatList.get(one.getDefectLevel()) != null) {
one.setHappenNum(repeatList.get(one.getDefectLevel()).getSum()); one.setHappenNum(repeatList.get(one.getDefectLevel()).getSum());
one.setHappenRatio(one.getHappenNum() / Double.valueOf(total)); one.setRepeatRatio(one.getHappenNum() / (double) totalRepeat);
one.setRepeatRatio(one.getHappenNum() / Double.valueOf(totalRepeat)); }
if(sums.containsKey(one.getDefectLevel())){
one.setHappenSumNum(sums.get(one.getDefectLevel()).getSum());
one.setHappenRatio(one.getHappenSumNum() / (double) total);
} }
OperDefectRepeatRatioDTO two = new OperDefectRepeatRatioDTO(); OperDefectRepeatRatioDTO two = new OperDefectRepeatRatioDTO();
two.setDefectLevel(DefectConstant.DefectLevelEnum.TWO.getStatus()); two.setDefectLevel(DefectConstant.DefectLevelEnum.TWO.getStatus());
if (repeatList.get(two.getDefectLevel()) != null) { if (repeatList.get(two.getDefectLevel()) != null) {
two.setHappenNum(repeatList.get(two.getDefectLevel()).getSum()); two.setHappenNum(repeatList.get(two.getDefectLevel()).getSum());
two.setHappenRatio(two.getHappenNum() / Double.valueOf(total)); two.setRepeatRatio(two.getHappenNum() / (double) totalRepeat);
two.setRepeatRatio(two.getHappenNum() / Double.valueOf(totalRepeat)); }
if(sums.containsKey(two.getDefectLevel())){
two.setHappenSumNum(sums.get(two.getDefectLevel()).getSum());
two.setHappenRatio(two.getHappenSumNum() / (double) total);
} }
OperDefectRepeatRatioDTO three = new OperDefectRepeatRatioDTO(); OperDefectRepeatRatioDTO three = new OperDefectRepeatRatioDTO();
three.setDefectLevel(DefectConstant.DefectLevelEnum.THREE.getStatus()); three.setDefectLevel(DefectConstant.DefectLevelEnum.THREE.getStatus());
if (repeatList.get(three.getDefectLevel()) != null) { if (repeatList.get(three.getDefectLevel()) != null) {
three.setHappenNum(repeatList.get(three.getDefectLevel()).getSum()); three.setHappenNum(repeatList.get(three.getDefectLevel()).getSum());
three.setHappenRatio(three.getHappenNum() / Double.valueOf(total)); three.setRepeatRatio(three.getHappenNum() / (double) totalRepeat);
three.setRepeatRatio(three.getHappenNum() / Double.valueOf(totalRepeat)); }
if(sums.containsKey(three.getDefectLevel())){
three.setHappenSumNum(sums.get(three.getDefectLevel()).getSum());
three.setHappenRatio(three.getHappenSumNum() / (double) total);
} }
OperDefectRepeatRatioDTO addUp = OperDefectRepeatRatioDTO.builder().defectLevel("合计").happenNum(one.getHappenNum() + two.getHappenNum() + three.getHappenNum()).happenRatio(one.getHappenRatio() + two.getHappenRatio() + three.getHappenRatio()).repeatRatio(1.00).build(); OperDefectRepeatRatioDTO addUp = OperDefectRepeatRatioDTO.builder().defectLevel("合计").happenNum(one.getHappenNum() + two.getHappenNum() + three.getHappenNum()).happenSumNum(one.getHappenSumNum() + two.getHappenSumNum() + three.getHappenSumNum()).happenRatio(1.0).repeatRatio(1.00).build();
if (addUp.getHappenNum().equals(0L)) { if (addUp.getHappenNum().equals(0L)) {
addUp.setRepeatRatio(0.0); addUp.setRepeatRatio(0.0);
} }

5
hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/controller/OverConfigController.java

@ -7,6 +7,7 @@ import com.hnac.hzims.common.logs.enums.BusinessType;
import com.hnac.hzims.common.logs.enums.OperatorType; import com.hnac.hzims.common.logs.enums.OperatorType;
import com.hnac.hzims.operational.fill.entity.OverConfigEntity; import com.hnac.hzims.operational.fill.entity.OverConfigEntity;
import com.hnac.hzims.operational.fill.service.OverConfigService; import com.hnac.hzims.operational.fill.service.OverConfigService;
import com.hnac.hzims.operational.fill.service.OverDetailsService;
import com.hnac.hzims.operational.fill.vo.OverConfigVo; import com.hnac.hzims.operational.fill.vo.OverConfigVo;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -30,6 +31,8 @@ public class OverConfigController extends BladeController {
private final OverConfigService service; private final OverConfigService service;
private final OverDetailsService detailsService;
/** /**
* 新增 * 新增
*/ */
@ -47,7 +50,7 @@ public class OverConfigController extends BladeController {
@ApiOperationSupport(order = 2) @ApiOperationSupport(order = 2)
@ApiOperation(value = "逻辑删除", notes = "传入id字符串以逗号分隔") @ApiOperation(value = "逻辑删除", notes = "传入id字符串以逗号分隔")
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
return R.status(service.deleteLogic(Func.toLongList(ids))); return R.status(detailsService.clear(Func.toLongList(ids)));
} }
/** /**

3
hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/OverConfigService.java

@ -8,6 +8,8 @@ import org.springblade.core.mp.base.BaseService;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import java.util.List;
/** /**
* 检修配置接口 * 检修配置接口
*/ */
@ -18,4 +20,5 @@ public interface OverConfigService extends BaseService<OverConfigEntity> {
int getSort(); int getSort();
boolean checkOverName(String overName); boolean checkOverName(String overName);
} }

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/OverDetailsService.java

@ -16,4 +16,6 @@ import java.util.List;
public interface OverDetailsService extends BaseService<OverDetailsEntity> { public interface OverDetailsService extends BaseService<OverDetailsEntity> {
R<IPage<OverDetailsVo>> pageCondition(OverDetailsVo vo, Query query); R<IPage<OverDetailsVo>> pageCondition(OverDetailsVo vo, Query query);
boolean clear(List<Long> longList);
} }

1
hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/impl/OverConfigServiceImpl.java

@ -6,7 +6,6 @@ import com.hnac.hzims.operational.fill.entity.OverConfigEntity;
import com.hnac.hzims.operational.fill.mapper.OverConfigMapper; import com.hnac.hzims.operational.fill.mapper.OverConfigMapper;
import com.hnac.hzims.operational.fill.service.OverConfigService; import com.hnac.hzims.operational.fill.service.OverConfigService;
import com.hnac.hzims.operational.fill.vo.OverConfigVo; import com.hnac.hzims.operational.fill.vo.OverConfigVo;
import com.hnac.hzims.operational.fill.wrapper.OtherWrapper;
import com.hnac.hzims.operational.fill.wrapper.OverConfigWrapper; import com.hnac.hzims.operational.fill.wrapper.OverConfigWrapper;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;

15
hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/impl/OverDetailsServiceImpl.java

@ -2,6 +2,7 @@ package com.hnac.hzims.operational.fill.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.operational.fill.entity.OverConfigEntity; import com.hnac.hzims.operational.fill.entity.OverConfigEntity;
import com.hnac.hzims.operational.fill.entity.OverDetailsEntity; import com.hnac.hzims.operational.fill.entity.OverDetailsEntity;
import com.hnac.hzims.operational.fill.mapper.OverDetailsMapper; import com.hnac.hzims.operational.fill.mapper.OverDetailsMapper;
@ -11,10 +12,12 @@ import com.hnac.hzims.operational.fill.vo.OverDetailsVo;
import com.hnac.hzims.operational.fill.wrapper.OverDetailsWrapper; import com.hnac.hzims.operational.fill.wrapper.OverDetailsWrapper;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.log.exception.ServiceException;
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.mp.support.Query; import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.ObjectUtil; import org.springblade.core.tool.utils.ObjectUtil;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -56,4 +59,16 @@ public class OverDetailsServiceImpl extends BaseServiceImpl<OverDetailsMapper, O
return R.data(pages.setRecords(list)); return R.data(pages.setRecords(list));
} }
@Override
public boolean clear(List<Long> ids) {
List<OverDetailsEntity> details = this.list(Wrappers.<OverDetailsEntity>lambdaQuery()
.in(OverDetailsEntity::getOverConfigId,ids)
.eq(OverDetailsEntity::getIsDeleted,0)
);
if(CollectionUtil.isNotEmpty(details)){
throw new ServiceException("该检修卡分类已在检修填报数据中引用,无法删除!");
}
return this.configService.deleteLogic(ids);
}
} }

Loading…
Cancel
Save