This commit is contained in:
ls
2025-05-26 10:59:10 +08:00
parent 777d7cba5c
commit aeb676bc6b
3 changed files with 42 additions and 42 deletions

View File

@@ -76,7 +76,7 @@ public class ExperimentDeviationEquipmentController
@PostMapping(value = "/add") @PostMapping(value = "/add")
public Result<String> add(@RequestBody ExperimentDeviationEquipment experimentDeviationEquipment) { public Result<String> add(@RequestBody ExperimentDeviationEquipment experimentDeviationEquipment) {
String equipmentNo = experimentDeviationEquipment.getEquipmentNo(); String equipmentNo = experimentDeviationEquipment.getEquipmentNo();
if (StringUtils.isNotBlank(equipmentNo)) { if (StringUtils.isNotBlank(equipmentNo) && StringUtils.isBlank(experimentDeviationEquipment.getMeasurementValidity())) {
Equipment equipment = equipmentService.getByManagementNo(equipmentNo); Equipment equipment = equipmentService.getByManagementNo(equipmentNo);
experimentDeviationEquipment.setMeasurementValidity(equipment.getExpireDate()); experimentDeviationEquipment.setMeasurementValidity(equipment.getExpireDate());
} }

View File

@@ -288,13 +288,11 @@ public class ExperimentDocServiceImpl extends ServiceImpl<ExperimentDocMapper, E
RadiationMapDTO radiationMap = JSON.parseObject(radiationDetailJson, RadiationMapDTO.class); RadiationMapDTO radiationMap = JSON.parseObject(radiationDetailJson, RadiationMapDTO.class);
List<RadiationDetailDTO> detailDTOList = radiationMap.assembleDetails(); List<RadiationDetailDTO> detailDTOList = radiationMap.assembleDetails();
maxPoint = detailDTOList.stream().map(obj -> obj.getPoint()) // 获取point字段 maxPoint = detailDTOList.stream().map(obj -> obj.getPoint()) // 获取point字段
.filter(point -> StringUtils.isNotBlank(point)) .filter(point -> StringUtils.isNotBlank(point)).filter(str -> str.matches("-?\\d+(\\.\\d+)?")) // 只保留数字格式的字符串
.filter(str -> str.matches("-?\\d+(\\.\\d+)?")) // 只保留数字格式的字符串
.mapToDouble(Double::parseDouble) // 转换为double .mapToDouble(Double::parseDouble) // 转换为double
.max(); .max();
maxRate = detailDTOList.stream().map(obj -> obj.getActualMeasurementRate()) // 获取point字段 maxRate = detailDTOList.stream().map(obj -> obj.getActualMeasurementRate()) // 获取point字段
.filter(point -> StringUtils.isNotBlank(point)) .filter(point -> StringUtils.isNotBlank(point)).filter(str -> str.matches("-?\\d+(\\.\\d+)?")) // 只保留数字格式的字符串
.filter(str -> str.matches("-?\\d+(\\.\\d+)?")) // 只保留数字格式的字符串
.mapToDouble(Double::parseDouble) // 转换为double .mapToDouble(Double::parseDouble) // 转换为double
.max(); .max();
} }
@@ -328,11 +326,9 @@ public class ExperimentDocServiceImpl extends ServiceImpl<ExperimentDocMapper, E
params.put("审核人员姓名", Optional.ofNullable(sysUserService.getById(experimentReport.getAuditor())).map(SysUser::getRealname) params.put("审核人员姓名", Optional.ofNullable(sysUserService.getById(experimentReport.getAuditor())).map(SysUser::getRealname)
.orElse("")); .orElse(""));
params.put("校对人员姓名", Optional.ofNullable(sysUserService.getById(experimentReport.getProofreader())) params.put("校对人员姓名", Optional.ofNullable(sysUserService.getById(experimentReport.getProofreader()))
.map(SysUser::getRealname) .map(SysUser::getRealname).orElse(""));
.orElse(""));
params.put("批准人员姓名", Optional.ofNullable(sysUserService.getById(experimentReport.getConfirmer())) params.put("批准人员姓名", Optional.ofNullable(sysUserService.getById(experimentReport.getConfirmer()))
.map(SysUser::getRealname) .map(SysUser::getRealname).orElse(""));
.orElse(""));
params.put("报告生成日期", formatDate(experimentReport.getCreateTime())); params.put("报告生成日期", formatDate(experimentReport.getCreateTime()));
params.put("批准日期", experimentReport.getConfirmerTime()); params.put("批准日期", experimentReport.getConfirmerTime());
params.put("校对日期", experimentReport.getProofreaderTime()); params.put("校对日期", experimentReport.getProofreaderTime());
@@ -372,16 +368,12 @@ public class ExperimentDocServiceImpl extends ServiceImpl<ExperimentDocMapper, E
if (CollUtil.isNotEmpty(sampleInfoList)) { if (CollUtil.isNotEmpty(sampleInfoList)) {
for (int i = 0; i < sampleInfoList.size(); i++) { for (int i = 0; i < sampleInfoList.size(); i++) {
JSONObject info = sampleInfoList.get(i); JSONObject info = sampleInfoList.get(i);
params.put("table" + i, Tables.of( params.put("table" + i, Tables.of(new String[][] {new String[] {"试验样品名称", getStringOrDefault(info,
new String[][] {new String[] {"试验样品名称", getStringOrDefault(info, "sampleName"), "试验样品型号", "sampleName"), "试验样品型号", getStringOrDefault(info, "sampleModel")},
getStringOrDefault(info, "sampleModel")}, new String[] {"批 次", getStringOrDefault(info, "sampleBatch"), "试验样品编号", getStringOrDefault(info,
new String[] {"批 次", getStringOrDefault(info, "sampleBatch"), "试验样品编号", "sampleType")}, new String[] {"生产厂家", getStringOrDefault(info, "sampleManufacturer"),
getStringOrDefault( "试验样品数量", sampleInfoList.size() + ""}, new String[] {"放置地点", "", "接收日期", ""},})
info, .border(BorderStyle.DEFAULT).create());
"sampleType")},
new String[] {"生产厂家", getStringOrDefault(info, "sampleManufacturer"), "试验样品数量",
sampleInfoList.size() + ""},
new String[] {"放置地点", "", "接收日期", ""},}).border(BorderStyle.DEFAULT).create());
String imgUrls = info.getString("picture"); String imgUrls = info.getString("picture");
if (StringUtils.isNotBlank(imgUrls)) { if (StringUtils.isNotBlank(imgUrls)) {
if (!StringUtils.startsWith(imgUrls, "http")) { if (!StringUtils.startsWith(imgUrls, "http")) {
@@ -465,8 +457,7 @@ public class ExperimentDocServiceImpl extends ServiceImpl<ExperimentDocMapper, E
String actualMeasurementPoint = list.stream().map(x -> x.getPoint()).filter(point -> StringUtils.isNotBlank(point)).collect( String actualMeasurementPoint = list.stream().map(x -> x.getPoint()).filter(point -> StringUtils.isNotBlank(point)).collect(
Collectors.joining(",")); Collectors.joining(","));
OptionalDouble maxMeasurementPoint = list.stream().map(obj -> obj.getPoint()) // 获取point字段 OptionalDouble maxMeasurementPoint = list.stream().map(obj -> obj.getPoint()) // 获取point字段
.filter(point -> StringUtils.isNotBlank(point)) .filter(point -> StringUtils.isNotBlank(point)).filter(str -> str.matches("-?\\d+(\\.\\d+)?")) // 只保留数字格式的字符串
.filter(str -> str.matches("-?\\d+(\\.\\d+)?")) // 只保留数字格式的字符串
.mapToDouble(Double::parseDouble) // 转换为double .mapToDouble(Double::parseDouble) // 转换为double
.max(); .max();
@@ -493,6 +484,9 @@ public class ExperimentDocServiceImpl extends ServiceImpl<ExperimentDocMapper, E
return ""; return "";
} }
@Autowired
private IEquipmentService equipmentService;
private Map<String, Object> assembleSbsyjlb(String experimentId) { private Map<String, Object> assembleSbsyjlb(String experimentId) {
List<ExperimentDeviationEquipment> equipmentList = experimentDeviationEquipmentService.getByExperimentId(experimentId); List<ExperimentDeviationEquipment> equipmentList = experimentDeviationEquipmentService.getByExperimentId(experimentId);
Experiment experiment = experimentService.getById(experimentId); Experiment experiment = experimentService.getById(experimentId);
@@ -503,10 +497,10 @@ public class ExperimentDocServiceImpl extends ServiceImpl<ExperimentDocMapper, E
params.put("index", i + 1); params.put("index", i + 1);
params.put("设备名称", Optional.ofNullable(v.getEquipmentName()).orElse("")); params.put("设备名称", Optional.ofNullable(v.getEquipmentName()).orElse(""));
params.put("管理编号", Optional.ofNullable(v.getEquipmentNo()).orElse("")); params.put("管理编号", Optional.ofNullable(v.getEquipmentNo()).orElse(""));
String measurementValidity = v.getMeasurementValidity();
params.put("使用日期", experiment.getStartDate()); params.put("使用日期", experiment.getStartDate());
params.put("归还日期", experiment.getEndDate()); params.put("归还日期", experiment.getEndDate());
params.put("计量有效期", Optional.ofNullable(measurementValidity).orElse("")); Equipment equipment = equipmentService.getByManagementNo(v.getEquipmentNo());
params.put("计量有效期", Optional.ofNullable(equipment).map(s -> s.getExpireDate()).orElse(""));
params.put("异常记录", ""); params.put("异常记录", "");
list.add(params); list.add(params);
} }
@@ -537,8 +531,7 @@ public class ExperimentDocServiceImpl extends ServiceImpl<ExperimentDocMapper, E
params.put("校对人名称", Optional.ofNullable(latestReport).map(v -> sysUserService.getById(v.getProofreader())) params.put("校对人名称", Optional.ofNullable(latestReport).map(v -> sysUserService.getById(v.getProofreader()))
.map(SysUser::getRealname).orElse("")); .map(SysUser::getRealname).orElse(""));
params.put("审核时间", Optional.ofNullable(latestReport) params.put("审核时间", Optional.ofNullable(latestReport).map(v -> DateUtils.formatDate(v.getProofreaderTime(), "yyyy 年 M 月 d 日"))
.map(v -> DateUtils.formatDate(v.getProofreaderTime(), "yyyy 年 M 月 d 日"))
.orElse(" 年 月 日")); .orElse(" 年 月 日"));
params.put("负责人名称", experiment.getSupervisorName()); params.put("负责人名称", experiment.getSupervisorName());
@@ -589,45 +582,37 @@ public class ExperimentDocServiceImpl extends ServiceImpl<ExperimentDocMapper, E
root.put("电子加速器", hasElectronics ? "☑电子加速器" : "□电子加速器"); root.put("电子加速器", hasElectronics ? "☑电子加速器" : "□电子加速器");
root.put("质子加速器", hasProton ? "☑质子加速器" : "□质子加速器"); root.put("质子加速器", hasProton ? "☑质子加速器" : "□质子加速器");
OptionalDouble maxEnergy = detailDTOList.stream().map(obj -> obj.getEnergy()) // 获取point字段 OptionalDouble maxEnergy = detailDTOList.stream().map(obj -> obj.getEnergy()) // 获取point字段
.filter(point -> StringUtils.isNotBlank(point)) .filter(point -> StringUtils.isNotBlank(point)).filter(str -> str.matches("-?\\d+(\\.\\d+)?")) // 只保留数字格式的字符串
.filter(str -> str.matches("-?\\d+(\\.\\d+)?")) // 只保留数字格式的字符串
.mapToDouble(Double::parseDouble) // 转换为double .mapToDouble(Double::parseDouble) // 转换为double
.max(); .max();
OptionalDouble maxBeam = detailDTOList.stream().map(obj -> obj.getBeam()) // 获取point字段 OptionalDouble maxBeam = detailDTOList.stream().map(obj -> obj.getBeam()) // 获取point字段
.filter(point -> StringUtils.isNotBlank(point)) .filter(point -> StringUtils.isNotBlank(point)).filter(str -> str.matches("-?\\d+(\\.\\d+)?")) // 只保留数字格式的字符串
.filter(str -> str.matches("-?\\d+(\\.\\d+)?")) // 只保留数字格式的字符串
.mapToDouble(Double::parseDouble) // 转换为double .mapToDouble(Double::parseDouble) // 转换为double
.max(); .max();
OptionalDouble maxElectronEnergy = detailDTOList.stream().map(obj -> obj.getElectronEnergy()) // 获取point字段 OptionalDouble maxElectronEnergy = detailDTOList.stream().map(obj -> obj.getElectronEnergy()) // 获取point字段
.filter(point -> StringUtils.isNotBlank(point)) .filter(point -> StringUtils.isNotBlank(point)).filter(str -> str.matches("-?\\d+(\\.\\d+)?")) // 只保留数字格式的字符串
.filter(str -> str.matches("-?\\d+(\\.\\d+)?")) // 只保留数字格式的字符串
.mapToDouble(Double::parseDouble) // 转换为double .mapToDouble(Double::parseDouble) // 转换为double
.max(); .max();
OptionalDouble maxTubeCurrent = detailDTOList.stream().map(obj -> obj.getTubeCurrent()) // 获取point字段 OptionalDouble maxTubeCurrent = detailDTOList.stream().map(obj -> obj.getTubeCurrent()) // 获取point字段
.filter(point -> StringUtils.isNotBlank(point)) .filter(point -> StringUtils.isNotBlank(point)).filter(str -> str.matches("-?\\d+(\\.\\d+)?")) // 只保留数字格式的字符串
.filter(str -> str.matches("-?\\d+(\\.\\d+)?")) // 只保留数字格式的字符串
.mapToDouble(Double::parseDouble) // 转换为double .mapToDouble(Double::parseDouble) // 转换为double
.max(); .max();
OptionalDouble maxProtonEnergy = detailDTOList.stream().map(obj -> obj.getProtonEnergy()) // 获取point字段 OptionalDouble maxProtonEnergy = detailDTOList.stream().map(obj -> obj.getProtonEnergy()) // 获取point字段
.filter(point -> StringUtils.isNotBlank(point)) .filter(point -> StringUtils.isNotBlank(point)).filter(str -> str.matches("-?\\d+(\\.\\d+)?")) // 只保留数字格式的字符串
.filter(str -> str.matches("-?\\d+(\\.\\d+)?")) // 只保留数字格式的字符串
.mapToDouble(Double::parseDouble) // 转换为double .mapToDouble(Double::parseDouble) // 转换为double
.max(); .max();
OptionalDouble maxScanArea = detailDTOList.stream().map(obj -> obj.getScanArea()) // 获取point字段 OptionalDouble maxScanArea = detailDTOList.stream().map(obj -> obj.getScanArea()) // 获取point字段
.filter(point -> StringUtils.isNotBlank(point)) .filter(point -> StringUtils.isNotBlank(point)).filter(str -> str.matches("-?\\d+(\\.\\d+)?")) // 只保留数字格式的字符串
.filter(str -> str.matches("-?\\d+(\\.\\d+)?")) // 只保留数字格式的字符串
.mapToDouble(Double::parseDouble) // 转换为double .mapToDouble(Double::parseDouble) // 转换为double
.max(); .max();
OptionalDouble maxX = detailDTOList.stream().map(obj -> obj.getXy()) // 获取point字段 OptionalDouble maxX = detailDTOList.stream().map(obj -> obj.getXy()) // 获取point字段
.filter(point -> StringUtils.isNotBlank(point)) .filter(point -> StringUtils.isNotBlank(point)).map(str -> str.split(",")[0]) // 只保留数字格式的字符串
.map(str -> str.split(",")[0]) // 只保留数字格式的字符串
.mapToDouble(Double::parseDouble) // 转换为double .mapToDouble(Double::parseDouble) // 转换为double
.max(); .max();
OptionalDouble maxY = detailDTOList.stream().map(obj -> obj.getXy()) // 获取point字段 OptionalDouble maxY = detailDTOList.stream().map(obj -> obj.getXy()) // 获取point字段
.filter(point -> StringUtils.isNotBlank(point)) .filter(point -> StringUtils.isNotBlank(point)).map(str -> str.split(",")[0]) // 只保留数字格式的字符串
.map(str -> str.split(",")[0]) // 只保留数字格式的字符串
.mapToDouble(Double::parseDouble) // 转换为double .mapToDouble(Double::parseDouble) // 转换为double
.max(); .max();
@@ -660,6 +645,21 @@ public class ExperimentDocServiceImpl extends ServiceImpl<ExperimentDocMapper, E
root.put("均匀性", maxX.orElse(0) + "," + maxY.orElse(0)); root.put("均匀性", maxX.orElse(0) + "," + maxY.orElse(0));
root.put("辐射环境", environmentSelectStr); root.put("辐射环境", environmentSelectStr);
root.put("试验类型", typeSelectStr); root.put("试验类型", typeSelectStr);
Optional<String> first = detailDTOList.stream().filter(v -> StringUtils.isNotBlank(v.getCalibrationDistance())).map(
s -> s.getCalibrationDistance()).findFirst();
root.put("标定距离", first.orElse(""));
OptionalDouble maxActualMeasurementRate = detailDTOList.stream().map(obj -> obj.getActualMeasurementRate()) // 获取point字段
.filter(point -> StringUtils.isNotBlank(point)).filter(str -> str.matches("-?\\d+(\\.\\d+)?")) // 只保留数字格式的字符串
.mapToDouble(Double::parseDouble) // 转换为double
.max();
OptionalDouble maxPoint = detailDTOList.stream().map(obj -> obj.getPoint()) // 获取point字段
.filter(point -> StringUtils.isNotBlank(point)).filter(str -> str.matches("-?\\d+(\\.\\d+)?")) // 只保留数字格式的字符串
.mapToDouble(Double::parseDouble) // 转换为double
.max();
root.put("剂量率", maxActualMeasurementRate);
root.put("总剂量", maxPoint);
return root; return root;
} }

Binary file not shown.