完善设备检测完成后,修改计划的检测结果状态接口
This commit is contained in:
@@ -25,5 +25,7 @@ public interface PqDevMapper extends MPJBaseMapper<PqDev> {
|
||||
void finishPlan(@Param("planId")String planId);
|
||||
|
||||
void updateReportState(@Param("id")String id);
|
||||
|
||||
void updatePlanCheckResult(@Param("planId")String planId, @Param("checkResult")Integer checkResult);
|
||||
}
|
||||
|
||||
|
||||
@@ -56,5 +56,11 @@
|
||||
<update id="updateReportState" >
|
||||
update pq_dev set Report_State = 1 where id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="updatePlanCheckResult">
|
||||
update ad_plan set Result = #{checkResult} where id = #{planId}
|
||||
</update>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.poi.PullDown;
|
||||
import com.njcn.db.mybatisplus.constant.DbConstant;
|
||||
import com.njcn.gather.device.mapper.PqDevMapper;
|
||||
import com.njcn.gather.device.pojo.enums.TimeCheckResultEnum;
|
||||
import com.njcn.gather.device.pojo.enums.*;
|
||||
import com.njcn.gather.device.pojo.param.PqDevParam;
|
||||
import com.njcn.gather.device.pojo.po.PqDev;
|
||||
import com.njcn.gather.device.pojo.vo.CNDevExcel;
|
||||
@@ -28,9 +28,6 @@ import com.njcn.gather.device.service.IPqDevService;
|
||||
import com.njcn.gather.monitor.pojo.po.PqMonitor;
|
||||
import com.njcn.gather.monitor.pojo.vo.PqMonitorExcel;
|
||||
import com.njcn.gather.monitor.service.IPqMonitorService;
|
||||
import com.njcn.gather.device.pojo.enums.*;
|
||||
import com.njcn.gather.type.entity.DevType;
|
||||
import com.njcn.gather.type.service.IDevTypeService;
|
||||
import com.njcn.gather.storage.service.DetectionDataDealService;
|
||||
import com.njcn.gather.system.config.pojo.po.SysTestConfig;
|
||||
import com.njcn.gather.system.config.service.ISysTestConfigService;
|
||||
@@ -38,6 +35,8 @@ import com.njcn.gather.system.dictionary.pojo.po.DictData;
|
||||
import com.njcn.gather.system.dictionary.pojo.po.DictType;
|
||||
import com.njcn.gather.system.dictionary.service.IDictDataService;
|
||||
import com.njcn.gather.system.dictionary.service.IDictTypeService;
|
||||
import com.njcn.gather.type.entity.DevType;
|
||||
import com.njcn.gather.type.service.IDevTypeService;
|
||||
import com.njcn.gather.util.DeviceUtil;
|
||||
import com.njcn.web.factory.PageFactory;
|
||||
import com.njcn.web.utils.ExcelUtil;
|
||||
@@ -165,7 +164,7 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
collect.forEach((k, v) -> {
|
||||
str.append(k + ": ");
|
||||
for (int i = 0; i < v.size(); i++) {
|
||||
if ( i==v.size()-1) {
|
||||
if (i == v.size() - 1) {
|
||||
str.append(v.get(i).getName());
|
||||
} else {
|
||||
str.append(v.get(i).getName() + ",");
|
||||
@@ -588,6 +587,21 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
// 如果非归档状态的设备数量为0,则更新计划已完成
|
||||
this.baseMapper.finishPlan(pqDev.getPlanId());
|
||||
}
|
||||
queryWrapper.clear();
|
||||
|
||||
queryWrapper.eq(PqDev::getPlanId, pqDev.getPlanId())
|
||||
.eq(PqDev::getState, DataStateEnum.ENABLE.getCode());
|
||||
List<PqDev> pqDevList = this.list(queryWrapper);
|
||||
if (CollUtil.isNotEmpty(pqDevList)) {
|
||||
Set<Integer> checkResultSet = pqDevList.stream().map(PqDev::getCheckResult).collect(Collectors.toSet());
|
||||
if (checkResultSet.contains(CheckResultEnum.UNCHECKED.getValue())) {
|
||||
this.baseMapper.updatePlanCheckResult(pqDev.getPlanId(), CheckResultEnum.UNCHECKED.getValue());
|
||||
} else if (checkResultSet.contains(CheckResultEnum.NOT_ACCORD.getValue())) {
|
||||
this.baseMapper.updatePlanCheckResult(pqDev.getPlanId(), CheckResultEnum.NOT_ACCORD.getValue());
|
||||
} else {
|
||||
this.baseMapper.updatePlanCheckResult(pqDev.getPlanId(), CheckResultEnum.ACCORD.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user