|
@@ -1,11 +1,27 @@
|
|
|
package com.ruoyi.project.check.service.impl;
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Date;
|
|
|
import java.util.List;
|
|
|
+
|
|
|
+import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
+import com.ruoyi.common.utils.StringUtils;
|
|
|
+import com.ruoyi.project.base.domain.TBasePoint;
|
|
|
+import com.ruoyi.project.base.mapper.TBasePointMapper;
|
|
|
+import com.ruoyi.project.check.domain.TCheckRepairpoints;
|
|
|
+import com.ruoyi.project.check.mapper.TCheckRepairpointsMapper;
|
|
|
+import com.ruoyi.project.task.domain.TTaskInspection;
|
|
|
+import com.ruoyi.project.task.mapper.TTaskInspectionMapper;
|
|
|
+import org.apache.commons.collections4.CollectionUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import com.ruoyi.project.check.mapper.TCheckCheckpointsMapper;
|
|
|
import com.ruoyi.project.check.domain.TCheckCheckpoints;
|
|
|
import com.ruoyi.project.check.service.ITCheckCheckpointsService;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
+
|
|
|
+import static com.ruoyi.common.utils.SecurityUtils.getUserId;
|
|
|
|
|
|
/**
|
|
|
* 检测点Service业务层处理
|
|
@@ -19,6 +35,15 @@ public class TCheckCheckpointsServiceImpl implements ITCheckCheckpointsService
|
|
|
@Autowired
|
|
|
private TCheckCheckpointsMapper tCheckCheckpointsMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private TCheckRepairpointsMapper tCheckRepairpointsMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private TBasePointMapper tBasePointMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private TTaskInspectionMapper tTaskInspectionMapper;
|
|
|
+
|
|
|
/**
|
|
|
* 查询检测点
|
|
|
*
|
|
@@ -130,4 +155,135 @@ public class TCheckCheckpointsServiceImpl implements ITCheckCheckpointsService
|
|
|
{
|
|
|
return tCheckCheckpointsMapper.deleteTCheckCheckpointsByCheckId(checkId);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional
|
|
|
+ public AjaxResult toApprove(TCheckCheckpoints tCheckCheckpoints) {
|
|
|
+ int i = tCheckCheckpointsMapper.updateApproveStatusByIds(tCheckCheckpoints);//更新检测点审核状态
|
|
|
+ List<TCheckRepairpoints> tCheckRepairpoints = new ArrayList<>();
|
|
|
+ if (i > 0) {//更新成功
|
|
|
+ if (2 == tCheckCheckpoints.getApproveStatus()) {// 审核通过
|
|
|
+// 查询当前任务
|
|
|
+ TTaskInspection tTaskInspection = tTaskInspectionMapper.selectTTaskInspectionById(tCheckCheckpoints.getInspectionId());
|
|
|
+ //根据检测id查询所有监测点
|
|
|
+ List<TCheckCheckpoints> points = tCheckCheckpointsMapper.selectPointsByIds(tCheckCheckpoints.getCheckIds());
|
|
|
+ //更新已检测点数和未检测点数
|
|
|
+ tTaskInspection.setTaskDoneNum(new BigDecimal(StringUtils.isNotEmpty(tTaskInspection.getTaskDoneNum()) ? tTaskInspection.getTaskDoneNum() : "0").add(new BigDecimal(points.size())).toString());
|
|
|
+ tTaskInspection.setTaskUndoneNum(new BigDecimal(tTaskInspection.getTaskNum()).subtract(new BigDecimal(tTaskInspection.getTaskDoneNum())).toString());
|
|
|
+ tTaskInspectionMapper.updateTTaskInspection(tTaskInspection);
|
|
|
+ for (TCheckCheckpoints point : points) {
|
|
|
+ // 如果当前检测点泄露程度不为未泄露,将该检测点添加到待维修点中
|
|
|
+ if (!point.getLeakageDegree().equals("1")) {
|
|
|
+ TCheckRepairpoints tCheckRepairpoint = new TCheckRepairpoints();
|
|
|
+ tCheckRepairpoint.setPointId(point.getPointId());
|
|
|
+ tCheckRepairpoint.setNetTestValue(point.getNetTestValue());
|
|
|
+ tCheckRepairpoint.setPlantName(point.getPlantName());
|
|
|
+ tCheckRepairpoint.setRegionName(point.getRegionName());
|
|
|
+ tCheckRepairpoint.setLayer(point.getLayer());
|
|
|
+ tCheckRepairpoint.setDevName(point.getDevName());
|
|
|
+ tCheckRepairpoint.setDevCode(point.getDevCode());
|
|
|
+ tCheckRepairpoint.setGroupCode(point.getGroupCode());
|
|
|
+ tCheckRepairpoint.setExtendCode(point.getExtendCode());
|
|
|
+ tCheckRepairpoint.setPointType(point.getPointType());
|
|
|
+ tCheckRepairpoint.setInstrumentCode(point.getInstrumentCode());
|
|
|
+ tCheckRepairpoint.setLeakagePosition(point.getLeakagePosition());
|
|
|
+ tCheckRepairpoint.setLeakageDegree(point.getLeakageDegree());
|
|
|
+// tCheckRepairpoint.setApproveStatus(0L);
|
|
|
+ tCheckRepairpoint.setCreaterCode(getUserId());
|
|
|
+ tCheckRepairpoint.setCreatedate(new Date());
|
|
|
+ tCheckRepairpoint.setUpdaterCode(getUserId());
|
|
|
+ tCheckRepairpoint.setUpdatedate(new Date());
|
|
|
+ tCheckRepairpoint.setPlantId(point.getPlantId());
|
|
|
+ tCheckRepairpoint.setRegionId(point.getRegionId());
|
|
|
+ tCheckRepairpoint.setDevId(point.getDevId());
|
|
|
+ tCheckRepairpoint.setInstrumentId(point.getInstrumentId());
|
|
|
+ tCheckRepairpoint.setPlantType(point.getPlantType());
|
|
|
+ tCheckRepairpoint.setMediumType(point.getMediumType());
|
|
|
+ tCheckRepairpoints.add(tCheckRepairpoint);
|
|
|
+ }
|
|
|
+ // 更新密封点数据
|
|
|
+ TBasePoint tBasePoint = new TBasePoint();
|
|
|
+ tBasePoint.setPointId(point.getPointId());
|
|
|
+ tBasePoint.setNetTestValue(point.getNetTestValue());
|
|
|
+ tBasePoint.setLeakageDegree(point.getLeakageDegree());
|
|
|
+ tBasePointMapper.updateTBasePoint(tBasePoint);
|
|
|
+ }
|
|
|
+ if (CollectionUtils.isNotEmpty(tCheckRepairpoints)) {
|
|
|
+ tCheckRepairpointsMapper.insertTCheckRepairpointsByList(tCheckRepairpoints);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else
|
|
|
+ return AjaxResult.error("");
|
|
|
+ return AjaxResult.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional
|
|
|
+ public AjaxResult approveAll(TCheckCheckpoints tCheckCheckpoints) {
|
|
|
+ long status = tCheckCheckpoints.getApproveStatus();
|
|
|
+ tCheckCheckpoints.setApproveStatus(null);
|
|
|
+ List<TCheckCheckpoints> list = tCheckCheckpointsMapper.selectTCheckCheckpointsList(tCheckCheckpoints);
|
|
|
+ if (list.size() == 0) {
|
|
|
+ return AjaxResult.success();
|
|
|
+ }
|
|
|
+ List<Long> ids = new ArrayList<>();
|
|
|
+ for (TCheckCheckpoints t : list
|
|
|
+ ) {
|
|
|
+ ids.add(t.getCheckId());
|
|
|
+ }
|
|
|
+ TCheckCheckpoints newCheckpoints = new TCheckCheckpoints();
|
|
|
+ newCheckpoints.setApproveStatus(status);
|
|
|
+ newCheckpoints.setCheckIds(ids.toArray(new Long[ids.size()]));
|
|
|
+ int i = tCheckCheckpointsMapper.updateApproveStatusByIds(newCheckpoints);
|
|
|
+ List<TCheckRepairpoints> tCheckRepairpoints = new ArrayList<>();
|
|
|
+ if (i > 0) {
|
|
|
+ if (2 == status) {
|
|
|
+ TTaskInspection tTaskInspection = tTaskInspectionMapper.selectTTaskInspectionById(tCheckCheckpoints.getInspectionId());
|
|
|
+ List<TCheckCheckpoints> points = tCheckCheckpointsMapper.selectPointsByIds(newCheckpoints.getCheckIds());
|
|
|
+ tTaskInspection.setTaskDoneNum(new BigDecimal(StringUtils.isNotEmpty(tTaskInspection.getTaskDoneNum()) ? tTaskInspection.getTaskDoneNum() : "0").add(new BigDecimal(points.size())).toString());
|
|
|
+ tTaskInspection.setTaskUndoneNum(new BigDecimal(tTaskInspection.getTaskNum()).subtract(new BigDecimal(tTaskInspection.getTaskDoneNum())).toString());
|
|
|
+ tTaskInspectionMapper.updateTTaskInspection(tTaskInspection);
|
|
|
+ for (TCheckCheckpoints point : points) {
|
|
|
+ if (!point.getLeakageDegree().equals("1")) {
|
|
|
+ TCheckRepairpoints tCheckRepairpoint = new TCheckRepairpoints();
|
|
|
+ tCheckRepairpoint.setPointId(point.getPointId());
|
|
|
+ tCheckRepairpoint.setNetTestValue(point.getNetTestValue());
|
|
|
+ tCheckRepairpoint.setPlantName(point.getPlantName());
|
|
|
+ tCheckRepairpoint.setRegionName(point.getRegionName());
|
|
|
+ tCheckRepairpoint.setLayer(point.getLayer());
|
|
|
+ tCheckRepairpoint.setDevName(point.getDevName());
|
|
|
+ tCheckRepairpoint.setDevCode(point.getDevCode());
|
|
|
+ tCheckRepairpoint.setGroupCode(point.getGroupCode());
|
|
|
+ tCheckRepairpoint.setExtendCode(point.getExtendCode());
|
|
|
+ tCheckRepairpoint.setPointType(point.getPointType());
|
|
|
+ tCheckRepairpoint.setInstrumentCode(point.getInstrumentCode());
|
|
|
+ tCheckRepairpoint.setLeakagePosition(point.getLeakagePosition());
|
|
|
+ tCheckRepairpoint.setLeakageDegree(point.getLeakageDegree());
|
|
|
+// tCheckRepairpoint.setApproveStatus(0L);
|
|
|
+ tCheckRepairpoint.setCreaterCode(getUserId());
|
|
|
+ tCheckRepairpoint.setCreatedate(new Date());
|
|
|
+ tCheckRepairpoint.setUpdaterCode(getUserId());
|
|
|
+ tCheckRepairpoint.setUpdatedate(new Date());
|
|
|
+ tCheckRepairpoint.setPlantId(point.getPlantId());
|
|
|
+ tCheckRepairpoint.setRegionId(point.getRegionId());
|
|
|
+ tCheckRepairpoint.setDevId(point.getDevId());
|
|
|
+ tCheckRepairpoint.setInstrumentId(point.getInstrumentId());
|
|
|
+ tCheckRepairpoint.setPlantType(point.getPlantType());
|
|
|
+ tCheckRepairpoint.setMediumType(point.getMediumType());
|
|
|
+ tCheckRepairpoints.add(tCheckRepairpoint);
|
|
|
+ }
|
|
|
+ TBasePoint tBasePoint = new TBasePoint();
|
|
|
+ tBasePoint.setPointId(point.getPointId());
|
|
|
+ tBasePoint.setNetTestValue(point.getNetTestValue());
|
|
|
+ tBasePoint.setLeakageDegree(point.getLeakageDegree());
|
|
|
+ tBasePointMapper.updateTBasePoint(tBasePoint);// 更新密封点数据
|
|
|
+ }
|
|
|
+ if (CollectionUtils.isNotEmpty(tCheckRepairpoints)) {
|
|
|
+ tCheckRepairpointsMapper.insertTCheckRepairpointsByList(tCheckRepairpoints);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else
|
|
|
+ return AjaxResult.error();
|
|
|
+ return AjaxResult.success();
|
|
|
+ }
|
|
|
}
|