|
@@ -1,10 +1,7 @@
|
|
|
package com.ruoyi.project.task.controller;
|
|
package com.ruoyi.project.task.controller;
|
|
|
|
|
|
|
|
import java.sql.Time;
|
|
import java.sql.Time;
|
|
|
-import java.util.ArrayList;
|
|
|
|
|
-import java.util.Calendar;
|
|
|
|
|
-import java.util.Date;
|
|
|
|
|
-import java.util.List;
|
|
|
|
|
|
|
+import java.util.*;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
@@ -20,7 +17,9 @@ import com.ruoyi.project.base.service.ITBasePlantService;
|
|
|
import com.ruoyi.project.base.service.ITBasePointService;
|
|
import com.ruoyi.project.base.service.ITBasePointService;
|
|
|
import com.ruoyi.project.base.service.ITBaseRegionService;
|
|
import com.ruoyi.project.base.service.ITBaseRegionService;
|
|
|
import com.ruoyi.project.check.domain.TCheckCheckpoints;
|
|
import com.ruoyi.project.check.domain.TCheckCheckpoints;
|
|
|
|
|
+import com.ruoyi.project.check.domain.TCheckLawitems;
|
|
|
import com.ruoyi.project.check.service.ITCheckCheckpointsService;
|
|
import com.ruoyi.project.check.service.ITCheckCheckpointsService;
|
|
|
|
|
+import com.ruoyi.project.check.service.ITCheckLawitemsService;
|
|
|
import com.ruoyi.project.task.mapper.TTaskInspectionPlanMapper;
|
|
import com.ruoyi.project.task.mapper.TTaskInspectionPlanMapper;
|
|
|
import com.ruoyi.system.service.ISysDictTypeService;
|
|
import com.ruoyi.system.service.ISysDictTypeService;
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
@@ -76,6 +75,9 @@ public class TTaskInspectionPlanController extends BaseController {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private ITCheckCheckpointsService tCheckCheckpointsService;
|
|
private ITCheckCheckpointsService tCheckCheckpointsService;
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private ITCheckLawitemsService tCheckLawitemsService;
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 查询检测计划列表
|
|
* 查询检测计划列表
|
|
|
*/
|
|
*/
|
|
@@ -132,6 +134,7 @@ public class TTaskInspectionPlanController extends BaseController {
|
|
|
int nowQuarter = DateUtils.getNowQuarter(); // 获取当前季度
|
|
int nowQuarter = DateUtils.getNowQuarter(); // 获取当前季度
|
|
|
Calendar calendar = Calendar.getInstance(); // 获取当前时间
|
|
Calendar calendar = Calendar.getInstance(); // 获取当前时间
|
|
|
String year = String.valueOf(calendar.get(Calendar.YEAR)); // 获取当前年份
|
|
String year = String.valueOf(calendar.get(Calendar.YEAR)); // 获取当前年份
|
|
|
|
|
+ List<TCheckLawitems> tCheckLawitems = tCheckLawitemsService.selectTCheckLawitemsByLawStatus();
|
|
|
for (TBasePlant tBasePlant : tBasePlantService.selectAllPlantName()) {// 查询已审核所有装置
|
|
for (TBasePlant tBasePlant : tBasePlantService.selectAllPlantName()) {// 查询已审核所有装置
|
|
|
// 查询今年当前季度是否有监测计划
|
|
// 查询今年当前季度是否有监测计划
|
|
|
QueryWrapper<TTaskInspectionPlan> plansWrapper = new QueryWrapper<TTaskInspectionPlan>().eq("plan_year", year).eq("plan_quarter", nowQuarter).eq("plant_id", tBasePlant.getPlantId()).eq("del_flag", 0);
|
|
QueryWrapper<TTaskInspectionPlan> plansWrapper = new QueryWrapper<TTaskInspectionPlan>().eq("plan_year", year).eq("plan_quarter", nowQuarter).eq("plant_id", tBasePlant.getPlantId()).eq("del_flag", 0);
|
|
@@ -155,7 +158,6 @@ public class TTaskInspectionPlanController extends BaseController {
|
|
|
tTaskInspectionPlan.setInspectionPlanName(tBasePlant.getPlantName() + "_" + year + "第" + nowQuarter + "季度检测计划");
|
|
tTaskInspectionPlan.setInspectionPlanName(tBasePlant.getPlantName() + "_" + year + "第" + nowQuarter + "季度检测计划");
|
|
|
if (nowQuarter == 1 && nowQuarter == 3) {
|
|
if (nowQuarter == 1 && nowQuarter == 3) {
|
|
|
// 当前季度为1、3季度时,检测频次为一季一次
|
|
// 当前季度为1、3季度时,检测频次为一季一次
|
|
|
- // TODO 当装置中没有动密封点时,跳过此计划
|
|
|
|
|
tTaskInspectionPlan.setDetectionFrequency("2");
|
|
tTaskInspectionPlan.setDetectionFrequency("2");
|
|
|
// 检测结束时间为开始时间+3个月
|
|
// 检测结束时间为开始时间+3个月
|
|
|
tTaskInspectionPlan.setEndTime(DateUtils.addTime(new Date(), Calendar.MONTH, 3));
|
|
tTaskInspectionPlan.setEndTime(DateUtils.addTime(new Date(), Calendar.MONTH, 3));
|
|
@@ -170,11 +172,22 @@ public class TTaskInspectionPlanController extends BaseController {
|
|
|
// 统计当前装置下的所有(动)密封点
|
|
// 统计当前装置下的所有(动)密封点
|
|
|
QueryWrapper<TBasePoint> points = new QueryWrapper<TBasePoint>().eq("plant_id", tBasePlant.getPlantId()).eq("del_flag", 0).eq("approve_status", 2);
|
|
QueryWrapper<TBasePoint> points = new QueryWrapper<TBasePoint>().eq("plant_id", tBasePlant.getPlantId()).eq("del_flag", 0).eq("approve_status", 2);
|
|
|
|
|
|
|
|
- // TODO: 当1、3季度时需要加上动密封点的判断
|
|
|
|
|
|
|
+ // 当1、3季度时仅查询动密封点
|
|
|
|
|
+ // 匹配法规标准
|
|
|
if (nowQuarter == 1 && nowQuarter == 3) {
|
|
if (nowQuarter == 1 && nowQuarter == 3) {
|
|
|
-// points.in("point_type",);
|
|
|
|
|
|
|
+ Set<String> pointTypes = new HashSet<>();
|
|
|
|
|
+ for (TCheckLawitems lawitem : tCheckLawitems) {
|
|
|
|
|
+ if (lawitem.getPlantType().equals(tBasePlant.getPlantType())&&lawitem.getDetectionFrequency().equals("2")){
|
|
|
|
|
+ pointTypes.add(lawitem.getPointType());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ points.in("point_type",pointTypes);
|
|
|
}
|
|
}
|
|
|
Integer count = tBasePointMapper.selectCount(points);
|
|
Integer count = tBasePointMapper.selectCount(points);
|
|
|
|
|
+ if (count==0){
|
|
|
|
|
+ // 当前计划中没有密封点时,跳过此计划
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
tTaskInspectionPlan.setPointNum(count.toString());
|
|
tTaskInspectionPlan.setPointNum(count.toString());
|
|
|
tTaskInspectionPlan.setCreaterCode(getUserId());
|
|
tTaskInspectionPlan.setCreaterCode(getUserId());
|
|
|
tTaskInspectionPlan.setCreatedate(new Date());
|
|
tTaskInspectionPlan.setCreatedate(new Date());
|
|
@@ -185,11 +198,11 @@ public class TTaskInspectionPlanController extends BaseController {
|
|
|
tTaskInspectionPlan.setPlanQuarter(String.valueOf(nowQuarter));
|
|
tTaskInspectionPlan.setPlanQuarter(String.valueOf(nowQuarter));
|
|
|
tTaskInspectionPlans.add(tTaskInspectionPlan);
|
|
tTaskInspectionPlans.add(tTaskInspectionPlan);
|
|
|
|
|
|
|
|
- // TODO:匹配法规标准
|
|
|
|
|
// 新增检测点
|
|
// 新增检测点
|
|
|
List<TCheckCheckpoints> tCheckCheckpoints = new ArrayList<>();
|
|
List<TCheckCheckpoints> tCheckCheckpoints = new ArrayList<>();
|
|
|
List<TBasePoint> tBasePoints = tBasePointMapper.selectList(points);
|
|
List<TBasePoint> tBasePoints = tBasePointMapper.selectList(points);
|
|
|
for (TBasePoint tBasePoint : tBasePoints) {
|
|
for (TBasePoint tBasePoint : tBasePoints) {
|
|
|
|
|
+
|
|
|
TCheckCheckpoints tCheckCheckpoint = new TCheckCheckpoints();
|
|
TCheckCheckpoints tCheckCheckpoint = new TCheckCheckpoints();
|
|
|
tCheckCheckpoint.setPointId(tBasePoint.getPointId());
|
|
tCheckCheckpoint.setPointId(tBasePoint.getPointId());
|
|
|
tCheckCheckpoint.setPlantName(tBasePlant.getPlantName());
|
|
tCheckCheckpoint.setPlantName(tBasePlant.getPlantName());
|
|
@@ -198,7 +211,7 @@ public class TTaskInspectionPlanController extends BaseController {
|
|
|
// tCheckCheckpoint.setRegionName(tBaseRegionService.selectTBaseRegionById(tBasePoint.getRegionId()).getRegionName());
|
|
// tCheckCheckpoint.setRegionName(tBaseRegionService.selectTBaseRegionById(tBasePoint.getRegionId()).getRegionName());
|
|
|
tCheckCheckpoint.setRegionId(tBasePoint.getRegionId());
|
|
tCheckCheckpoint.setRegionId(tBasePoint.getRegionId());
|
|
|
tCheckCheckpoint.setLayer(tBasePoint.getLayer());
|
|
tCheckCheckpoint.setLayer(tBasePoint.getLayer());
|
|
|
-// TBaseDevice tBaseDevice = tBaseDeviceService.selectTBaseDeviceById(tBasePoint.getPointId());
|
|
|
|
|
|
|
+// TBaseDevice tBaseDevice = tBaseDeviceService.selectTBaseDeviceById(tBasePoint.getDevId());
|
|
|
// tCheckCheckpoint.setDevName(tBaseDevice.getDevDescribe());
|
|
// tCheckCheckpoint.setDevName(tBaseDevice.getDevDescribe());
|
|
|
// tCheckCheckpoint.setDevCode(tBaseDevice.getDevCode());
|
|
// tCheckCheckpoint.setDevCode(tBaseDevice.getDevCode());
|
|
|
tCheckCheckpoint.setDevId(tBasePoint.getDevId());
|
|
tCheckCheckpoint.setDevId(tBasePoint.getDevId());
|