1、检测计划、被检设备导入导出功能调整
2、多台设备类型同时进行脚本与ICD检验时Socket异常中断
This commit is contained in:
@@ -5,6 +5,8 @@ import com.njcn.gather.plan.pojo.po.AdPlan;
|
||||
import com.njcn.gather.report.pojo.po.PqReport;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @date 2024-12-09
|
||||
@@ -27,5 +29,13 @@ public interface AdPlanMapper extends MPJBaseMapper<AdPlan> {
|
||||
* @return
|
||||
*/
|
||||
PqReport getPqReportById(String id);
|
||||
|
||||
/**
|
||||
* 获取所有报告模板名称
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<String> listAllReportTemplateName();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -17,5 +17,10 @@
|
||||
WHERE id = #{id}
|
||||
and state = 1
|
||||
</select>
|
||||
<select id="listAllReportTemplateName" resultType="java.lang.String">
|
||||
SELECT concat(name, '_', version) as name
|
||||
FROM pq_report
|
||||
WHERE state = 1
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
|
||||
@@ -60,6 +60,7 @@ public class AdPlanParam {
|
||||
private List<String> devIds;
|
||||
|
||||
@ApiModelProperty(value = "是否关联报告")
|
||||
@NotNull(message = DetectionValidMessage.ASSOCIATE_REPORT_NOT_NULL)
|
||||
private Integer associateReport;
|
||||
|
||||
@ApiModelProperty(value = "报告模板名称")
|
||||
|
||||
@@ -33,19 +33,30 @@ public class AdPlanExcel {
|
||||
@NotBlank(message = DetectionValidMessage.ERRORSYS_NOT_BLANK)
|
||||
private String errorSysId;
|
||||
|
||||
@Excel(name = "是否做守时检测*", width = 15, replace = {"否_0", "是_1"}, needMerge = true, orderNum = "5")
|
||||
@Excel(name = "数据处理原则*", width = 20, needMerge = true, orderNum = "5")
|
||||
@NotBlank(message = DetectionValidMessage.DATA_RULE_NOT_BLANK)
|
||||
private String dataRule;
|
||||
|
||||
@Excel(name = "是否做守时检测*", width = 20, replace = {"否_0", "是_1"}, needMerge = true, orderNum = "6")
|
||||
@NotNull(message = DetectionValidMessage.TIMECHECK_NOT_NULL)
|
||||
private Integer timeCheck;
|
||||
|
||||
@Excel(name = "检测状态*", width = 10, replace = {"未检_0", "检测中_1", "检测完成_2"}, needMerge = true, orderNum = "6")
|
||||
@Excel(name = "关联报告模版*", width = 20, replace = {"否_0", "是_1"}, needMerge = true, orderNum = "7")
|
||||
@NotNull(message = DetectionValidMessage.ASSOCIATE_REPORT_NOT_NULL)
|
||||
private Integer associateReport;
|
||||
|
||||
@Excel(name = "报告模版(当关联报告模版为是时必填)", width = 40, needMerge = true, orderNum = "8")
|
||||
private String reportTemplateId;
|
||||
|
||||
@Excel(name = "检测状态*", width = 10, replace = {"未检_0", "检测中_1", "检测完成_2"}, needMerge = true, orderNum = "9")
|
||||
@NotNull(message = DetectionValidMessage.TEST_STATE_NOT_NULL)
|
||||
private Integer testState;
|
||||
|
||||
@Excel(name = "报告生成状态*", width = 15, replace = {"未生成_0", "部分生成_1", "全部生成_2"}, needMerge = true, orderNum = "7")
|
||||
@Excel(name = "报告生成状态*", width = 15, replace = {"未生成_0", "部分生成_1", "全部生成_2"}, needMerge = true, orderNum = "10")
|
||||
@NotNull(message = DetectionValidMessage.REPORT_STATE_NOT_NULL)
|
||||
private Integer reportState;
|
||||
|
||||
@Excel(name = "检测结果*", width = 10, replace = {"不符合_0", "符合_1", "未检_2"}, needMerge = true, orderNum = "8")
|
||||
@Excel(name = "检测结果*", width = 10, replace = {"不符合_0", "符合_1", "未检_2"}, needMerge = true, orderNum = "11")
|
||||
@NotNull(message = DetectionValidMessage.CHECK_RESULT_STATE_NOT_NULL)
|
||||
private Integer result;
|
||||
}
|
||||
|
||||
@@ -14,6 +14,6 @@ import java.util.List;
|
||||
public class CNPlanExcel extends AdPlanExcel {
|
||||
|
||||
|
||||
@ExcelCollection(name = "绑定的设备", orderNum = "9")
|
||||
@ExcelCollection(name = "绑定的设备", orderNum = "12")
|
||||
private List<CNDevExcel> devices;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.njcn.gather.plan.pojo.vo;
|
||||
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import cn.afterturn.easypoi.excel.annotation.ExcelCollection;
|
||||
import com.njcn.gather.device.pojo.vo.ProvinceDevExcel;
|
||||
import lombok.Data;
|
||||
@@ -13,6 +14,6 @@ import java.util.List;
|
||||
@Data
|
||||
public class ProvincePlanExcel extends AdPlanExcel {
|
||||
|
||||
@ExcelCollection(name = "绑定的设备", orderNum = "9")
|
||||
@ExcelCollection(name = "绑定的设备", orderNum = "12")
|
||||
private List<ProvinceDevExcel> devices;
|
||||
}
|
||||
|
||||
@@ -38,8 +38,8 @@ import com.njcn.gather.plan.service.IAdPlanService;
|
||||
import com.njcn.gather.plan.service.IAdPlanSourceService;
|
||||
import com.njcn.gather.pojo.enums.DetectionResponseEnum;
|
||||
import com.njcn.gather.report.pojo.po.PqReport;
|
||||
import com.njcn.gather.script.pojo.po.PqScript;
|
||||
import com.njcn.gather.script.pojo.po.PqScriptDtls;
|
||||
import com.njcn.gather.script.service.IPqScriptCheckDataService;
|
||||
import com.njcn.gather.script.service.IPqScriptDtlsService;
|
||||
import com.njcn.gather.script.service.IPqScriptService;
|
||||
import com.njcn.gather.source.pojo.po.PqSource;
|
||||
@@ -104,7 +104,6 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
||||
private final IDevTypeService devTypeService;
|
||||
private final IDictTypeService dictTypeService;
|
||||
private final AdHarmonicService adHarmonicService;
|
||||
private final IPqScriptCheckDataService pqScriptCheckDataService;
|
||||
|
||||
@Override
|
||||
public Page<AdPlanVO> listAdPlan(AdPlanParam.QueryParam queryParam) {
|
||||
@@ -308,6 +307,14 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
||||
if (StrUtil.isNotBlank(adPlan.getErrorSysId())) {
|
||||
adPlan.setErrorSysId(pqErrSysService.getPqErrSysById(adPlan.getErrorSysId()).getName());
|
||||
}
|
||||
if (StrUtil.isNotBlank(adPlan.getDataRule())) {
|
||||
String dataRule = adPlan.getDataRule();
|
||||
adPlan.setDataRule(dictDataService.getDictDataById(dataRule).getName());
|
||||
}
|
||||
if (StrUtil.isNotBlank(adPlan.getReportTemplateId())) {
|
||||
PqReport report = this.baseMapper.getPqReportById(adPlan.getReportTemplateId());
|
||||
adPlan.setReportTemplateId(report.getName() + "_" + report.getVersion());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -632,6 +639,8 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
||||
if (!PatternEnum.CONTRAST.getValue().equals(patternCode) && datasourceIds.length > 1) {
|
||||
throw new BusinessException(DetectionResponseEnum.IMPORT_DATASOURCE_ERROR);
|
||||
}
|
||||
planExcel.setAssociateReport(0);
|
||||
planExcel.setReportTemplateId(null);
|
||||
|
||||
List<String> sourceIds = pqSourceService.listPqSourceIdByName(sourceNames);
|
||||
adPlanSourceService.addAdPlanSource(planId, sourceIds);
|
||||
@@ -712,6 +721,9 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
||||
if (!PatternEnum.CONTRAST.getValue().equals(patternCode) && datasourceIds.length > 1) {
|
||||
throw new BusinessException(DetectionResponseEnum.IMPORT_DATASOURCE_ERROR);
|
||||
}
|
||||
if ((planExcel.getAssociateReport().equals(1) && "".equals(planExcel.getReportTemplateId()))) {
|
||||
throw new BusinessException(DetectionResponseEnum.IMPORT_REPORT_TEMPLATE_ERROR);
|
||||
}
|
||||
|
||||
List<String> sourceIds = pqSourceService.listPqSourceIdByName(sourceNames);
|
||||
adPlanSourceService.addAdPlanSource(planId, sourceIds);
|
||||
@@ -826,13 +838,46 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
||||
private void reverseVisualize(List<AdPlan> planList) {
|
||||
planList.forEach(adPlan -> {
|
||||
String[] datasourceIds = adPlan.getDatasourceId().split(StrUtil.COMMA);
|
||||
adPlan.setDatasourceId(Arrays.stream(datasourceIds).map(id -> DataSourceEnum.getValueByMsg(id)).collect(Collectors.joining(StrUtil.COMMA)));
|
||||
adPlan.setDatasourceId(Arrays.stream(datasourceIds).map(id -> {
|
||||
String value = DataSourceEnum.getValueByMsg(id);
|
||||
if (StrUtil.isBlank(value)) {
|
||||
throw new BusinessException(DetectionResponseEnum.DATA_SOURCE_NOT_EXIST);
|
||||
} else {
|
||||
return value;
|
||||
}
|
||||
}).collect(Collectors.joining(StrUtil.COMMA)));
|
||||
|
||||
adPlan.setScriptId(pqScriptService.getPqScriptByName(adPlan.getScriptId()).getId());
|
||||
PqScript pqScript = pqScriptService.getPqScriptByName(adPlan.getScriptId());
|
||||
if (ObjectUtil.isNull(pqScript)) {
|
||||
throw new BusinessException(DetectionResponseEnum.SCRIPT_NOT_EXIST);
|
||||
} else {
|
||||
adPlan.setScriptId(pqScript.getId());
|
||||
}
|
||||
|
||||
adPlan.setErrorSysId(pqErrSysService.getPqErrSysByName(adPlan.getErrorSysId()).getId());
|
||||
PqErrSys pqErrSys = pqErrSysService.getPqErrSysByName(adPlan.getErrorSysId());
|
||||
if (ObjectUtil.isNull(pqErrSys)) {
|
||||
throw new BusinessException(DetectionResponseEnum.ERROR_SYSTEM_NOT_EXIST);
|
||||
} else {
|
||||
adPlan.setErrorSysId(pqErrSys.getId());
|
||||
}
|
||||
|
||||
DictData dataRuleDictData = dictDataService.getDictDataByName(adPlan.getDataRule());
|
||||
if (ObjectUtil.isNull(dataRuleDictData)) {
|
||||
throw new BusinessException(DetectionResponseEnum.DATA_RULE_NOT_EXIST);
|
||||
} else {
|
||||
adPlan.setDataRule(dataRuleDictData.getId());
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(adPlan.getReportTemplateId())) {
|
||||
String[] split = adPlan.getReportTemplateId().split("_");
|
||||
String reportId = this.baseMapper.getReportIdByNameAndVersion(split[0], split[1]);
|
||||
if (ObjectUtil.isNull(reportId)) {
|
||||
throw new BusinessException(DetectionResponseEnum.REPORT_TEMPLATE_NOT_EXIST);
|
||||
} else {
|
||||
adPlan.setReportTemplateId(reportId);
|
||||
}
|
||||
}
|
||||
adPlan.setCode(this.generateCode());
|
||||
|
||||
adPlan.setState(DataStateEnum.ENABLE.getCode());
|
||||
// 默认为顶级检测计划
|
||||
adPlan.setFatherPlanId(CommonEnum.FATHER_ID.getValue());
|
||||
@@ -1070,41 +1115,68 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
||||
pullDown.setStrings(errSysNameList);
|
||||
pullDowns.add(pullDown);
|
||||
|
||||
// 数据处理原则
|
||||
dictType = dictTypeService.getByCode("Data_Rule");
|
||||
if (ObjectUtil.isNotNull(dictType)) {
|
||||
List<DictData> dictDataList = dictDataService.getDictDataByTypeId(dictType.getId());
|
||||
|
||||
pullDown = new PullDown();
|
||||
pullDown.setFirstCol(5);
|
||||
pullDown.setLastCol(5);
|
||||
pullDown.setStrings(dictDataList.stream().map(DictData::getName).collect(Collectors.toList()));
|
||||
pullDowns.add(pullDown);
|
||||
}
|
||||
|
||||
// 是否做守时检测
|
||||
pullDown = new PullDown();
|
||||
pullDown.setFirstCol(5);
|
||||
pullDown.setLastCol(5);
|
||||
pullDown.setFirstCol(6);
|
||||
pullDown.setLastCol(6);
|
||||
pullDown.setStrings(Arrays.asList("是", "否"));
|
||||
pullDowns.add(pullDown);
|
||||
|
||||
// 是否关联报告模板
|
||||
pullDown = new PullDown();
|
||||
pullDown.setFirstCol(7);
|
||||
pullDown.setLastCol(7);
|
||||
pullDown.setStrings(Arrays.asList("是", "否"));
|
||||
pullDowns.add(pullDown);
|
||||
|
||||
// 报告模板
|
||||
List<String> strings = this.baseMapper.listAllReportTemplateName();
|
||||
pullDown = new PullDown();
|
||||
pullDown.setFirstCol(8);
|
||||
pullDown.setLastCol(8);
|
||||
pullDown.setStrings(strings);
|
||||
pullDowns.add(pullDown);
|
||||
|
||||
// 检测状态
|
||||
pullDown = new PullDown();
|
||||
pullDown.setFirstCol(6);
|
||||
pullDown.setLastCol(6);
|
||||
pullDown.setFirstCol(9);
|
||||
pullDown.setLastCol(9);
|
||||
pullDown.setStrings(Arrays.asList(CheckStateEnum.UNCHECKED.getMsg(), CheckStateEnum.CHECKING.getMsg(), CheckStateEnum.CHECKED.getMsg()));
|
||||
pullDowns.add(pullDown);
|
||||
|
||||
// 报告生成状态
|
||||
pullDown = new PullDown();
|
||||
pullDown.setFirstCol(7);
|
||||
pullDown.setLastCol(7);
|
||||
pullDown.setFirstCol(10);
|
||||
pullDown.setLastCol(10);
|
||||
pullDown.setStrings(Arrays.asList(PlanReportStateEnum.REPORT_STATE_NOT_GENERATED.getMsg(), PlanReportStateEnum.REPORT_STATE_PARTIALLY_GENERATED.getMsg(), PlanReportStateEnum.REPORT_STATE_ALL_GENERATED.getMsg()));
|
||||
pullDowns.add(pullDown);
|
||||
|
||||
//检测结果
|
||||
pullDown = new PullDown();
|
||||
pullDown.setFirstCol(8);
|
||||
pullDown.setLastCol(8);
|
||||
pullDown.setFirstCol(11);
|
||||
pullDown.setLastCol(11);
|
||||
pullDown.setStrings(Arrays.asList(CheckResultEnum.UNCHECKED.getMsg(), CheckResultEnum.ACCORD.getMsg(), CheckResultEnum.UNCHECKED.getMsg()));
|
||||
pullDowns.add(pullDown);
|
||||
|
||||
switch (scene) {
|
||||
case PROVINCE_PLATFORM:
|
||||
List<PullDown> provinceDevPullDownList = pqDevService.getProvinceDevPullDownList(9);
|
||||
List<PullDown> provinceDevPullDownList = pqDevService.getProvinceDevPullDownList(12);
|
||||
pullDowns.addAll(provinceDevPullDownList);
|
||||
break;
|
||||
case LEAVE_FACTORY_TEST:
|
||||
List<PullDown> cnDevPullDownList = pqDevService.getCNDevPullDownList(9);
|
||||
List<PullDown> cnDevPullDownList = pqDevService.getCNDevPullDownList(12);
|
||||
pullDowns.addAll(cnDevPullDownList);
|
||||
break;
|
||||
case SELF_TEST:
|
||||
|
||||
Reference in New Issue
Block a user