1、检测计划、被检设备导入导出功能调整

2、多台设备类型同时进行脚本与ICD检验时Socket异常中断
This commit is contained in:
caozehui
2025-05-26 15:21:21 +08:00
parent 8bc8a97e83
commit 57b08a99c6
13 changed files with 217 additions and 43 deletions

View File

@@ -21,7 +21,7 @@ public class CNDevExcel {
@NotBlank(message = DetectionValidMessage.PREINVESTMENT_PLAN_NOT_BLANK)
private String preinvestmentPlan;
@Excel(name = "设备编号(开始编号-结束编号,编号为数字)*", width = 50, orderNum = "2")
@Excel(name = "装置编号(开始编号-结束编号,编号为数字)*", width = 50, orderNum = "2")
@NotBlank(message = DetectionValidMessage.NAME_NOT_BLANK)
@Pattern(regexp = PatternRegex.CN_DEV_NAME_REGEX_IMPORT, message = DetectionValidMessage.CN_DEV_NAME_FORMAT_ERROR)
private String name;

View File

@@ -39,7 +39,7 @@ public class ProvinceDevExcel implements Serializable {
@NotBlank(message = DetectionValidMessage.MANUFACTURER_NOT_BLANK)
private String manufacturer;
@Excel(name = "出厂日期*", width = 25, format = "yyyy-MM-dd", orderNum = "8")
@Excel(name = "出厂日期yyyy-MM-dd*", width = 25, format = "yyyy-MM-dd", orderNum = "8")
@NotNull(message = DetectionValidMessage.CREATEDATETIME_NOT_NULL)
private LocalDate createDate;
@@ -75,4 +75,13 @@ public class ProvinceDevExcel implements Serializable {
@NotNull(message = DetectionValidMessage.PORT_NOT_NULL)
@Range(min = 1, max = 65535, message = DetectionValidMessage.PORT_RANGE_ERROR)
private Integer port;
@Excel(name = "样品编号", width = 20, orderNum = "17")
private String sampleId;
@Excel(name = "送样日期yyyy-MM-dd", width = 25, format = "yyyy-MM-dd", orderNum = "18")
private String arrivedDate;
@Excel(name="委托方", width = 40, orderNum = "19")
private String delegate;
}

View File

@@ -82,10 +82,10 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
public Page<PqDevVO> listPqDevs(PqDevParam.QueryParam queryParam) {
Page<PqDev> page1 = this.page(new Page<>(PageFactory.getPageNum(queryParam), PageFactory.getPageSize(queryParam)), this.getQueryWrapper(queryParam));
page1.getRecords().forEach(p -> {
if (ObjectUtil.isNotNull(p.getSeries())) {
if (StrUtil.isNotBlank(p.getSeries())) {
p.setSeries(EncryptionUtil.decoderString(1, p.getSeries()));
}
if (ObjectUtil.isNotNull(p.getDevKey())) {
if (StrUtil.isNotBlank(p.getDevKey())) {
p.setDevKey(EncryptionUtil.decoderString(1, p.getDevKey()));
}
});
@@ -688,6 +688,9 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
} else {
throw new BusinessException(DetectionResponseEnum.SERIES_AND_DEVKEY_NOT_BLANK);
}
} else {
pqDev.setSeries(null);
pqDev.setDevKey(null);
}
String name = pqDev.getName();
@@ -730,7 +733,7 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
this.checkRepeat(param, false);
pqDev.setManufacturer("8fa73802c9e1abab973adcbeb0d58567"); // 南京灿能字典项目对应的id
long count = newDevList.stream().filter(dev -> dev.getName().equals(pqDev.getName())).count();
long count = newDevList.stream().filter(dev -> dev.getName().equals(pqDev.getName()) && dev.getCreateId().equals(pqDev.getCreateId())).count();
if (count == 0) {
newDevList.add(pqDev);
}
@@ -837,12 +840,17 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
pullDown.setStrings(Arrays.asList("", ""));
pullDowns.add(pullDown);
// 是否支持系数校准
// pullDown = new PullDown();
// pullDown.setFirstCol(startCol + 11);
// pullDown.setLastCol(startCol + 11);
// pullDown.setStrings(Arrays.asList("是", "否"));
// pullDowns.add(pullDown);
// 委托方
dictType = dictTypeService.getByCode("Delegate");
if (ObjectUtil.isNotNull(dictType)) {
dictDataList = dictDataService.getDictDataByTypeId(dictType.getId());
pullDown = new PullDown();
pullDown.setFirstCol(startCol + 15);
pullDown.setLastCol(startCol + 15);
pullDown.setStrings(dictDataList.stream().map(DictData::getName).collect(Collectors.toList()));
pullDowns.add(pullDown);
}
return pullDowns;
}
@@ -925,11 +933,26 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
*/
public void reverseVisualizeCNDev(List<PqDev> pqDevs, String patternId) {
pqDevs.forEach(pqDev -> {
pqDev.setPreinvestmentPlan(dictDataService.getDictDataByName(pqDev.getPreinvestmentPlan()).getId());
DictData preinvestmentPlanDictData = dictDataService.getDictDataByName(pqDev.getPreinvestmentPlan());
if (ObjectUtil.isNull(preinvestmentPlanDictData)) {
throw new BusinessException(DetectionResponseEnum.PREINVESTMENT_PLAN_NOT_EXIST);
} else {
pqDev.setPreinvestmentPlan(preinvestmentPlanDictData.getId());
}
DevType devType = devTypeService.getByName(pqDev.getDevType());
pqDev.setDevType(devType.getId());
if (ObjectUtil.isNull(devType)) {
throw new BusinessException(DetectionResponseEnum.DEV_TYPE_NOT_EXIST);
} else {
pqDev.setDevType(devType.getId());
}
pqDev.setPattern(patternId);
pqDev.setProtocol(dictDataService.getDictDataByName(pqDev.getProtocol()).getId());
DictData protocolDictData = dictDataService.getDictDataByName(pqDev.getProtocol());
if (ObjectUtil.isNull(protocolDictData)) {
throw new BusinessException(DetectionResponseEnum.PROTOCOL_NOT_EXIST);
} else {
pqDev.setProtocol(protocolDictData.getId());
}
pqDev.setCreateDate(LocalDateTime.now().toLocalDate());
pqDev.setCreateId(pqDev.getName());
pqDev.setTimeCheckResult(TimeCheckResultEnum.UNKNOWN.getValue());
@@ -1010,6 +1033,9 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
} else {
throw new BusinessException(DetectionResponseEnum.SERIES_AND_DEVKEY_NOT_BLANK);
}
} else {
pqDev.setSeries(null);
pqDev.setDevKey(null);
}
String name = pqDev.getName();
@@ -1051,7 +1077,7 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
param.setDevType(pqDev.getDevType());
this.checkRepeat(param, false);
long count = newDevList.stream().filter(dev -> dev.getName().equals(pqDev.getName())).count();
long count = newDevList.stream().filter(dev -> dev.getName().equals(pqDev.getName()) && dev.getCreateId().equals(pqDev.getCreateId())).count();
if (count == 0) {
newDevList.add(pqDev);
}
@@ -1068,6 +1094,9 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
pqDev.setDevType(devTypeService.getById(pqDev.getDevType()).getName());
pqDev.setManufacturer(dictDataService.getDictDataById(pqDev.getManufacturer()).getName());
pqDev.setProtocol(dictDataService.getDictDataById(pqDev.getProtocol()).getName());
if (StrUtil.isNotBlank(pqDev.getDelegate())) {
pqDev.setDelegate(dictDataService.getDictDataById(pqDev.getDelegate()).getName());
}
});
}
@@ -1075,10 +1104,32 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
public void reverseVisualizeProvinceDev(List<PqDev> pqDevs, String patternId) {
pqDevs.forEach(pqDev -> {
DevType devType = devTypeService.getByName(pqDev.getDevType());
pqDev.setDevType(devType.getId());
if (ObjectUtil.isNull(devType)) {
throw new BusinessException(DetectionResponseEnum.DEV_TYPE_NOT_EXIST);
} else {
pqDev.setDevType(devType.getId());
}
pqDev.setPattern(patternId);
pqDev.setManufacturer(dictDataService.getDictDataByName(pqDev.getManufacturer()).getId());
pqDev.setProtocol(dictDataService.getDictDataByName(pqDev.getProtocol()).getId());
DictData manufacturerDictData = dictDataService.getDictDataByName(pqDev.getManufacturer());
if (ObjectUtil.isNull(manufacturerDictData)) {
throw new BusinessException(DetectionResponseEnum.MANUFACTURER_NOT_EXIST);
} else {
pqDev.setManufacturer(manufacturerDictData.getId());
}
DictData protocolDictData = dictDataService.getDictDataByName(pqDev.getProtocol());
if (ObjectUtil.isNull(protocolDictData)) {
throw new BusinessException(DetectionResponseEnum.PROTOCOL_NOT_EXIST);
} else {
pqDev.setProtocol(protocolDictData.getId());
}
if (StrUtil.isNotBlank(pqDev.getDelegate())) {
DictData delegateDictData = dictDataService.getDictDataByName(pqDev.getDelegate());
if (ObjectUtil.isNull(delegateDictData)) {
throw new BusinessException(DetectionResponseEnum.DELEGATE_NOT_EXIST);
} else {
pqDev.setDelegate(delegateDictData.getId());
}
}
pqDev.setTimeCheckResult(TimeCheckResultEnum.UNKNOWN.getValue());
pqDev.setFactorCheckResult(FactorCheckResultEnum.UNKNOWN.getValue());
pqDev.setCheckState(CheckStateEnum.UNCHECKED.getValue());