1、报告生成修改状态;
2、设备全部归档,修改计划完成状态;
This commit is contained in:
@@ -5,11 +5,13 @@ import cn.hutool.core.date.DatePattern;
|
|||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
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.njcn.common.pojo.enums.common.DataStateEnum;
|
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.gather.detection.pojo.vo.DetectionData;
|
import com.njcn.gather.detection.pojo.vo.DetectionData;
|
||||||
import com.njcn.gather.device.device.pojo.vo.PqDevVO;
|
import com.njcn.gather.device.device.pojo.vo.PqDevVO;
|
||||||
import com.njcn.gather.device.device.service.IPqDevService;
|
import com.njcn.gather.device.device.service.IPqDevService;
|
||||||
|
import com.njcn.gather.device.pojo.enums.DevReportStateEnum;
|
||||||
import com.njcn.gather.device.script.pojo.po.PqScript;
|
import com.njcn.gather.device.script.pojo.po.PqScript;
|
||||||
import com.njcn.gather.device.script.pojo.po.PqScriptCheckData;
|
import com.njcn.gather.device.script.pojo.po.PqScriptCheckData;
|
||||||
import com.njcn.gather.device.script.pojo.po.PqScriptDtls;
|
import com.njcn.gather.device.script.pojo.po.PqScriptDtls;
|
||||||
@@ -98,7 +100,17 @@ public class ReportServiceImpl implements IReportService {
|
|||||||
System.out.println("报告生成成功!");
|
System.out.println("报告生成成功!");
|
||||||
|
|
||||||
// 将改设备的报告生成状态调整为已生成
|
// 将改设备的报告生成状态调整为已生成
|
||||||
iPqDevService.updatePqDevReportState(devReportParam.getDevId(),1);
|
iPqDevService.updatePqDevReportState(devReportParam.getDevId(), 1);
|
||||||
|
|
||||||
|
// 判断该计划下是否所有设备报告已生成,如果已生成则将计划状态改为已完成
|
||||||
|
int count = iPqDevService.countUnReportDev(devReportParam.getPlanId());
|
||||||
|
if(count == 0){
|
||||||
|
LambdaUpdateWrapper<AdPlan> updateWrapper = new LambdaUpdateWrapper<>();
|
||||||
|
updateWrapper.eq(AdPlan::getId, devReportParam.getPlanId())
|
||||||
|
.set(AdPlan::getReportState, DevReportStateEnum.GENERATED.getValue());
|
||||||
|
adPlanService.update(updateWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
@@ -355,7 +367,7 @@ public class ReportServiceImpl implements IReportService {
|
|||||||
private String devValue(String dataJson, double baseValue) {
|
private String devValue(String dataJson, double baseValue) {
|
||||||
DetectionData tempA = JSONUtil.toBean(dataJson, DetectionData.class);
|
DetectionData tempA = JSONUtil.toBean(dataJson, DetectionData.class);
|
||||||
if (Objects.nonNull(tempA) && Objects.nonNull(tempA.getData())) {
|
if (Objects.nonNull(tempA) && Objects.nonNull(tempA.getData())) {
|
||||||
return doubleRound(4, (tempA.getData()/100) * baseValue);
|
return doubleRound(4, (tempA.getData() / 100) * baseValue);
|
||||||
}
|
}
|
||||||
return "/";
|
return "/";
|
||||||
}
|
}
|
||||||
@@ -379,7 +391,7 @@ public class ReportServiceImpl implements IReportService {
|
|||||||
private void fillMapValueT(SingleNonHarmParam singleNonHarmParam, Map<String, String> dataModelMap, String tSymbol) {
|
private void fillMapValueT(SingleNonHarmParam singleNonHarmParam, Map<String, String> dataModelMap, String tSymbol) {
|
||||||
AdNonHarmonicResult adNonHarmonicResult = adNonHarmonicService.getSingleResult(singleNonHarmParam);
|
AdNonHarmonicResult adNonHarmonicResult = adNonHarmonicService.getSingleResult(singleNonHarmParam);
|
||||||
if (Objects.nonNull(adNonHarmonicResult)) {
|
if (Objects.nonNull(adNonHarmonicResult)) {
|
||||||
dataModelMap.put("${".concat(tSymbol).concat("}"), devValue(adNonHarmonicResult.getTValue(), 1));
|
dataModelMap.put("${".concat(tSymbol).concat("}"), devValue(adNonHarmonicResult.getTValue(), 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,12 +34,6 @@
|
|||||||
<version>1.0.0</version>
|
<version>1.0.0</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>com.njcn.gather</groupId>
|
|
||||||
<artifactId>detection</artifactId>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.alibaba</groupId>
|
<groupId>com.alibaba</groupId>
|
||||||
<artifactId>fastjson</artifactId>
|
<artifactId>fastjson</artifactId>
|
||||||
|
|||||||
@@ -21,5 +21,7 @@ public interface PqDevMapper extends MPJBaseMapper<PqDev> {
|
|||||||
* @Date: 2024/12/12 11:46
|
* @Date: 2024/12/12 11:46
|
||||||
*/
|
*/
|
||||||
List<PreDetection> selectDevInfo(@Param("devIds") List<String> devIds);
|
List<PreDetection> selectDevInfo(@Param("devIds") List<String> devIds);
|
||||||
|
|
||||||
|
void finishPlan(@Param("planId")String planId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -48,5 +48,9 @@
|
|||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<update id="finishPlan" >
|
||||||
|
update ad_plan set Test_State = 2 where id = #{planId}
|
||||||
|
</update>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
||||||
|
|||||||
@@ -189,4 +189,6 @@ public interface IPqDevService extends IService<PqDev> {
|
|||||||
boolean updateResult(List<String> ids,String code);
|
boolean updateResult(List<String> ids,String code);
|
||||||
|
|
||||||
void updatePqDevReportState(String devId, int i);
|
void updatePqDevReportState(String devId, int i);
|
||||||
|
|
||||||
|
int countUnReportDev(String planId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ import com.njcn.gather.device.monitor.pojo.po.PqMonitor;
|
|||||||
import com.njcn.gather.device.monitor.pojo.vo.PqMonitorExcel;
|
import com.njcn.gather.device.monitor.pojo.vo.PqMonitorExcel;
|
||||||
import com.njcn.gather.device.monitor.service.IPqMonitorService;
|
import com.njcn.gather.device.monitor.service.IPqMonitorService;
|
||||||
import com.njcn.gather.device.pojo.enums.*;
|
import com.njcn.gather.device.pojo.enums.*;
|
||||||
import com.njcn.gather.plan.service.IAdPlanService;
|
|
||||||
import com.njcn.gather.storage.service.DetectionDataDealService;
|
import com.njcn.gather.storage.service.DetectionDataDealService;
|
||||||
import com.njcn.gather.system.dictionary.pojo.po.DictData;
|
import com.njcn.gather.system.dictionary.pojo.po.DictData;
|
||||||
import com.njcn.gather.system.dictionary.service.IDictDataService;
|
import com.njcn.gather.system.dictionary.service.IDictDataService;
|
||||||
@@ -53,7 +52,6 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
|||||||
private final IDictDataService dictDataService;
|
private final IDictDataService dictDataService;
|
||||||
private final IPqMonitorService pqMonitorService;
|
private final IPqMonitorService pqMonitorService;
|
||||||
private final DetectionDataDealService detectionDataDealService;
|
private final DetectionDataDealService detectionDataDealService;
|
||||||
private final IAdPlanService adPlanService;
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -461,9 +459,9 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
|||||||
.eq(PqDev::getState, DataStateEnum.ENABLE.getCode())
|
.eq(PqDev::getState, DataStateEnum.ENABLE.getCode())
|
||||||
.ne(PqDev::getCheckState, CheckStateEnum.DOCUMENTED.getValue());
|
.ne(PqDev::getCheckState, CheckStateEnum.DOCUMENTED.getValue());
|
||||||
int count = this.count(queryWrapper);
|
int count = this.count(queryWrapper);
|
||||||
if(count == 0 ){
|
if (count == 0) {
|
||||||
// 如果非归档状态的设备数量为0,则更新计划已完成
|
// 如果非归档状态的设备数量为0,则更新计划已完成
|
||||||
adPlanService.finishPlan(pqDev.getPlanId());
|
this.baseMapper.finishPlan(pqDev.getPlanId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -511,6 +509,16 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
|||||||
this.update(updateWrapper);
|
this.update(updateWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int countUnReportDev(String planId) {
|
||||||
|
// 查询该计划下所有设备的检测状态,是否有未生成的
|
||||||
|
LambdaQueryWrapper<PqDev> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(PqDev::getPlanId, planId)
|
||||||
|
.eq(PqDev::getState, DataStateEnum.ENABLE.getCode())
|
||||||
|
.ne(PqDev::getReportState, DevReportStateEnum.GENERATED.getValue());
|
||||||
|
return this.count(queryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取检测状态饼状图数据
|
* 获取检测状态饼状图数据
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user