比对-被检设备导入微调

This commit is contained in:
caozehui
2025-11-07 15:13:07 +08:00
parent 61f149b562
commit f10debe2f2
4 changed files with 75 additions and 19 deletions

View File

@@ -169,4 +169,24 @@ public class PqDevController extends BaseController {
Map<String, List<String>> result = pqDevService.listSelectOptions(pattern);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.UPLOAD)
@PostMapping(value = "/ttt")
@ApiOperation("批量导入被检设备")
@ApiImplicitParams({
@ApiImplicitParam(name = "file", value = "被检设备数据文件", required = true),
@ApiImplicitParam(name = "patternId", value = "模式id", required = true)
})
public HttpResult ttt(@RequestParam("file") MultipartFile file, @RequestParam("patternId") String patternId, @RequestParam("planId") String planId, @RequestParam(value = "cover", defaultValue = "0") Integer cover, HttpServletResponse response) {
String methodDescribe = getMethodDescribe("ttt");
LogUtil.njcnDebug(log, "{},上传文件为:{}", methodDescribe, file.getOriginalFilename());
boolean fileType = FileUtil.judgeFileIsExcel(file.getOriginalFilename());
if (!fileType) {
throw new BusinessException(CommonResponseEnum.FILE_XLSX_ERROR);
}
if ("null".equals(planId)) {
planId = null;
}
return pqDevService.importDev(file, patternId, planId, response, cover);
}
}

View File

@@ -38,8 +38,8 @@ public class ContrastDevExcel implements Serializable {
@Pattern(regexp = PatternRegex.DEV_NAME_REGEX, message = DetectionValidMessage.NAME_FORMAT_ERROR)
private String name;
@Excel(name = "设备序列号*", width = 20, needMerge = true, orderNum = "5")
@NotBlank(message = DetectionValidMessage.FACTORYNO_NOT_BLANK)
@Excel(name = "设备序列号", width = 20, needMerge = true, orderNum = "5")
// @NotBlank(message = DetectionValidMessage.FACTORYNO_NOT_BLANK)
private String createId;
@Excel(name = "设备类型*", width = 20, needMerge = true, orderNum = "6")
@@ -91,8 +91,8 @@ public class ContrastDevExcel implements Serializable {
@NotNull(message = DetectionValidMessage.INSPECT_DATE_NOT_NULL)
private LocalDate inspectDate;
@Excel(name = "谐波系统设备id*", width = 30, needMerge = true, orderNum = "18")
@NotBlank(message = DetectionValidMessage.HARM_SYS_ID_NOT_BLANK)
@Excel(name = "谐波系统设备id", width = 30, needMerge = true, orderNum = "18")
// @NotBlank(message = DetectionValidMessage.HARM_SYS_ID_NOT_BLANK)
private String harmSysId;
@ExcelCollection(name = "监测点信息", orderNum = "19")

View File

@@ -68,6 +68,7 @@ import java.time.LocalDateTime;
import java.util.*;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* @author caozehui
@@ -1340,9 +1341,11 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
if (CollUtil.isNotEmpty(hasList)) {
importPqDev.setId(hasList.get(0).getId());
for (PqMonitorExcel pqMonitorExcel : pqMonitorExcelList) {
PqMonitor pqMonitor = BeanUtil.copyProperties(pqMonitorExcel, PqMonitor.class);
pqMonitor.setDevId(importPqDev.getId());
monitorList.add(pqMonitor);
PqMonitor monitor = BeanUtil.copyProperties(pqMonitorExcel, PqMonitor.class);
monitor.setDevId(importPqDev.getId());
monitor.setPt(pqMonitorExcel.getPt1() + StrUtil.C_COLON + pqMonitorExcel.getPt2());
monitor.setCt(pqMonitorExcel.getCt1() + StrUtil.C_COLON + pqMonitorExcel.getCt2());
monitorList.add(monitor);
}
importPqDev.setMonitorList(monitorList);
finalUpdateDevList.add(importPqDev);
@@ -1366,6 +1369,8 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
for (PqMonitorExcel pqMonitorExcel : pqMonitorExcelList) {
PqMonitor monitor = BeanUtil.copyProperties(pqMonitorExcel, PqMonitor.class);
monitor.setDevId(importPqDev.getId());
monitor.setPt(pqMonitorExcel.getPt1() + StrUtil.C_COLON + pqMonitorExcel.getPt2());
monitor.setCt(pqMonitorExcel.getCt1() + StrUtil.C_COLON + pqMonitorExcel.getCt2());
monitorList.add(monitor);
}
importPqDev.setMonitorList(monitorList);
@@ -1375,6 +1380,8 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
for (PqMonitorExcel pqMonitorExcel : pqMonitorExcelList) {
PqMonitor monitor = BeanUtil.copyProperties(pqMonitorExcel, PqMonitor.class);
monitor.setDevId(importPqDev.getId());
monitor.setPt(pqMonitorExcel.getPt1() + StrUtil.C_COLON + pqMonitorExcel.getPt2());
monitor.setCt(pqMonitorExcel.getCt1() + StrUtil.C_COLON + pqMonitorExcel.getCt2());
monitorList.add(monitor);
}
importPqDev.setMonitorList(monitorList);
@@ -1496,13 +1503,19 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
if (ObjectUtil.isNotNull(dictType)) {
dictDataList = dictDataService.getDictDataByTypeId(dictType.getId());
pullDown = new PullDown();
pullDown.setFirstCol(startCol + 24);
pullDown.setLastCol(startCol + 24);
pullDown.setFirstCol(startCol + 26);
pullDown.setLastCol(startCol + 26);
pullDown.setStrings(dictDataList.stream().map(DictData::getName).collect(Collectors.toList()));
pullDowns.add(pullDown);
}
pullDown = new PullDown();
pullDown.setFirstCol(startCol + 27);
pullDown.setLastCol(startCol + 27);
pullDown.setStrings(Stream.iterate(1, x -> x + 1).limit(10).map(String::valueOf).collect(Collectors.toList()));
pullDowns.add(pullDown);
return pullDowns;
}
@@ -1564,7 +1577,22 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
contrastDevExcels.forEach(contrastDevExcel -> {
List<PqMonitor> monitorList = pqMonitorService.listPqMonitorByDevIds(Collections.singletonList(contrastDevExcel.getId()));
pqMonitorService.visualizeMonitor(monitorList);
List<PqMonitorExcel> pqMonitorExcelList = BeanUtil.copyToList(monitorList, PqMonitorExcel.class);
List<PqMonitorExcel> pqMonitorExcelList = new ArrayList<>();
for (int i = 0; i < monitorList.size(); i++) {
PqMonitor pqMonitor = monitorList.get(i);
PqMonitorExcel pqMonitorExcel = BeanUtil.copyProperties(pqMonitor, PqMonitorExcel.class);
String pt = pqMonitor.getPt();
String[] split1 = pt.split(String.valueOf(StrUtil.C_COLON));
pqMonitorExcel.setPt1(split1[0]);
pqMonitorExcel.setPt2(split1[1]);
String ct = pqMonitor.getCt();
String[] split2 = ct.split(String.valueOf(StrUtil.C_COLON));
pqMonitorExcel.setCt1(split2[0]);
pqMonitorExcel.setCt2(split2[1]);
pqMonitorExcelList.add(pqMonitorExcel);
}
contrastDevExcel.setPqMonitorExcelList(pqMonitorExcelList);
});
}

View File

@@ -14,11 +14,11 @@ import javax.validation.constraints.NotNull;
@Data
public class PqMonitorExcel {
@Excel(name = "谐波系统监测点ID*", width = 20, orderNum = "1")
@NotBlank(message = DetectionValidMessage.MONITOR_ID_NOT_BLANK)
@Excel(name = "谐波系统监测点ID", width = 20, orderNum = "1")
// @NotBlank(message = DetectionValidMessage.MONITOR_ID_NOT_BLANK)
private String harmSysId;
@Excel(name = "所属母线*", width = 20, orderNum = "2")
@Excel(name = "母线名称*", width = 20, orderNum = "2")
@NotBlank(message = DetectionValidMessage.BELONG_LINE_NOT_BLANK)
private String busbar;
@@ -30,19 +30,27 @@ public class PqMonitorExcel {
@NotNull(message = DetectionValidMessage.MONITOR_NUM_NOT_NULL)
private Integer num;
@Excel(name = "PT变比(pt1:pt2)*", width = 20, orderNum = "5")
@Excel(name = "PT一次变比*", width = 20, orderNum = "5")
@NotBlank(message = DetectionValidMessage.PT_NOT_BLANK)
private String pt;
private String pt1;
@Excel(name = "CT变比(ct1:ct2)*", width = 20, orderNum = "6")
@Excel(name = "PT二次变比*", width = 20, orderNum = "6")
@NotBlank(message = DetectionValidMessage.PT_NOT_BLANK)
private String pt2;
@Excel(name = "CT一次变比*", width = 20, orderNum = "7")
@NotBlank(message = DetectionValidMessage.CT_NOT_BLANK)
private String ct;
private String ct1;
@Excel(name = "接线方式*", width = 20, orderNum = "7")
@Excel(name = "CT二次变比*", width = 20, orderNum = "8")
@NotBlank(message = DetectionValidMessage.CT_NOT_BLANK)
private String ct2;
@Excel(name = "接线方式*", width = 20, orderNum = "9")
@NotBlank(message = DetectionValidMessage.CONNECTION_NOT_BLANK)
private String connection;
@Excel(name = "统计间隔*", width = 10, orderNum = "8")
@Excel(name = "统计间隔*", width = 20, orderNum = "10")
@NotNull(message = DetectionValidMessage.STAT_INTERVAL_NOT_NULL)
private Integer statInterval;
}