代码调整、修改设备检测人bug

This commit is contained in:
caozehui
2025-03-28 09:32:50 +08:00
parent fef01b692a
commit 48408859b1
22 changed files with 107 additions and 39 deletions

View File

@@ -140,7 +140,7 @@ public class PqDevController extends BaseController {
@ApiImplicitParam(name = "file", value = "被检设备数据文件", required = true),
@ApiImplicitParam(name = "patternId", value = "模式id", required = true)
})
public HttpResult<String> importDev(@RequestParam("file") MultipartFile file, @RequestParam("patternId") String patternId, HttpServletResponse response) {
public HttpResult<Object> importDev(@RequestParam("file") MultipartFile file, @RequestParam("patternId") String patternId, HttpServletResponse response) {
String methodDescribe = getMethodDescribe("importDev");
LogUtil.njcnDebug(log, "{},上传文件为:{}", methodDescribe, file.getOriginalFilename());
boolean fileType = FileUtil.judgeFileIsExcel(file.getOriginalFilename());
@@ -187,14 +187,14 @@ public class PqDevController extends BaseController {
@PostMapping("/documented")
@ApiOperation("设备归档")
@ApiImplicitParam(name = "id", value = "设备id", required = true)
public HttpResult<List<PqDev>> documented(@RequestBody List<String> ids) {
public HttpResult<Boolean> documented(@RequestBody List<String> ids) {
String methodDescribe = getMethodDescribe("documented");
LogUtil.njcnDebug(log, "{}设备id为{}", methodDescribe, ids);
boolean result = pqDevService.documented(ids);
if (result) {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
} else {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
}
}
}

View File

@@ -41,5 +41,12 @@ public interface PqDevMapper extends MPJBaseMapper<PqDev> {
* @param testState
*/
void updatePlanTestState(@Param("planId")String planId, @Param("testState")Integer testState);
/**
* 根据计划id获取脚本id
*
* @param planId
*/
String getScriptIdByPlanId(String planId);
}

View File

@@ -66,6 +66,8 @@
update ad_plan set Test_State = #{testState} where id = #{planId}
</update>
<select id="getScriptIdByPlanId" resultType="java.lang.String">
SELECT Script_Id FROM ad_plan WHERE id = #{planId}
</select>
</mapper>

View File

@@ -151,9 +151,10 @@ public interface IPqDevService extends IService<PqDev> {
* @param ids
* @param valueType
* @param code
* @param userId
* @return
*/
boolean updateResult(List<String> ids, List<String> valueType, String code);
boolean updateResult(List<String> ids, List<String> valueType, String code,String userId);
void updatePqDevReportState(String devId, int i);

View File

@@ -31,7 +31,11 @@ import com.njcn.gather.device.pojo.vo.ProvinceDevExcel;
import com.njcn.gather.device.service.IPqDevService;
import com.njcn.gather.monitor.pojo.po.PqMonitor;
import com.njcn.gather.monitor.service.IPqMonitorService;
import com.njcn.gather.plan.pojo.po.AdPlan;
import com.njcn.gather.plan.service.IAdPlanService;
import com.njcn.gather.pojo.enums.DetectionResponseEnum;
import com.njcn.gather.report.pojo.DevReportParam;
import com.njcn.gather.report.service.IPqReportService;
import com.njcn.gather.storage.service.DetectionDataDealService;
import com.njcn.gather.system.cfg.pojo.enums.SceneEnum;
import com.njcn.gather.system.cfg.pojo.po.SysTestConfig;
@@ -495,11 +499,12 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
}
@Override
public boolean updateResult(List<String> ids, List<String> valueType, String code) {
public boolean updateResult(List<String> ids, List<String> valueType, String code,String userId) {
if (CollUtil.isNotEmpty(ids)) {
SysTestConfig config = sysTestConfigService.getOneConfig();
Map<String, Integer> result = detectionDataDealService.devResult(ids, valueType, code);
List<PqDev> list = this.list(new LambdaQueryWrapper<PqDev>().in(PqDev::getId, ids));
for (PqDev pqDev : list) {
if (result.containsKey(pqDev.getId())) {
Integer checkState;
@@ -518,7 +523,7 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
.set(PqDev::getReCheckNum, i)
.set(PqDev::getCheckState, checkState)
.set(PqDev::getCheckResult, result.get(pqDev.getId()))
.set(PqDev::getCheckBy, RequestUtil.getUserId())
.set(PqDev::getCheckBy, userId)
.set(PqDev::getCheckTime, LocalDateTime.now())
.set(PqDev::getReportState, DevReportStateEnum.NOT_GENERATED.getValue())
.eq(PqDev::getId, pqDev.getId()));