实验报告
This commit is contained in:
@@ -436,6 +436,15 @@ public class DateUtils extends PropertyEditorSupport {
|
||||
return getSdFormat(pattern).format(getCalendar().getTime());
|
||||
}
|
||||
|
||||
public static String formatDate(String dateStr, String pattern) {
|
||||
try {
|
||||
Date date = parseDate(dateStr, "yyyy-MM-dd HH:mm");
|
||||
return getSdFormat(pattern).format(date);
|
||||
} catch (ParseException e) {
|
||||
return dateStr;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 指定日期按指定格式显示
|
||||
*
|
||||
|
||||
@@ -10,5 +10,5 @@ import org.jeecg.modules.database.entity.Equipment;
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IEquipmentService extends IService<Equipment> {
|
||||
|
||||
Equipment getByManagementNo(String managementNo);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.jeecg.modules.database.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.jeecg.modules.database.entity.Equipment;
|
||||
import org.jeecg.modules.database.mapper.EquipmentMapper;
|
||||
@@ -15,4 +16,8 @@ import org.springframework.stereotype.Service;
|
||||
@Service
|
||||
public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment> implements IEquipmentService {
|
||||
|
||||
@Override
|
||||
public Equipment getByManagementNo(String managementNo) {
|
||||
return getOne(new LambdaQueryWrapper<Equipment>().eq(Equipment::getManagementNo, managementNo), false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,12 +2,17 @@ package org.jeecg.modules.database.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.jeecg.modules.database.entity.Equipment;
|
||||
import org.jeecg.modules.database.entity.ExperimentDeviationEquipment;
|
||||
import org.jeecg.modules.database.mapper.ExperimentDeviationEquipmentMapper;
|
||||
import org.jeecg.modules.database.service.IEquipmentService;
|
||||
import org.jeecg.modules.database.service.IExperimentDeviationEquipmentService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @Description: 试验加偏设备信息
|
||||
@@ -18,8 +23,28 @@ import java.util.List;
|
||||
@Service
|
||||
public class ExperimentDeviationEquipmentServiceImpl extends ServiceImpl<ExperimentDeviationEquipmentMapper, ExperimentDeviationEquipment>
|
||||
implements IExperimentDeviationEquipmentService {
|
||||
@Autowired
|
||||
private IEquipmentService equipmentService;
|
||||
|
||||
@Override
|
||||
public List<ExperimentDeviationEquipment> getByExperimentId(String experimentId) {
|
||||
return list(new LambdaQueryWrapper<ExperimentDeviationEquipment>().eq(ExperimentDeviationEquipment::getExperimentId, experimentId));
|
||||
List<ExperimentDeviationEquipment> list = list(
|
||||
new LambdaQueryWrapper<ExperimentDeviationEquipment>().eq(ExperimentDeviationEquipment::getExperimentId, experimentId));
|
||||
list.forEach(this::assembleDetails);
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExperimentDeviationEquipment getById(Serializable id) {
|
||||
ExperimentDeviationEquipment byId = super.getById(id);
|
||||
this.assembleDetails(byId);
|
||||
return byId;
|
||||
}
|
||||
|
||||
private void assembleDetails(ExperimentDeviationEquipment experimentDeviationEquipment) {
|
||||
Equipment one = equipmentService.getByManagementNo(experimentDeviationEquipment.getEquipmentNo());
|
||||
if (Objects.nonNull(one)) {
|
||||
experimentDeviationEquipment.setEquipmentName(one.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -495,6 +495,7 @@ public class ExperimentDocServiceImpl extends ServiceImpl<ExperimentDocMapper, E
|
||||
|
||||
private Map<String, Object> assembleSbsyjlb(String experimentId) {
|
||||
List<ExperimentDeviationEquipment> equipmentList = experimentDeviationEquipmentService.getByExperimentId(experimentId);
|
||||
Experiment experiment = experimentService.getById(experimentId);
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (int i = 0; i < equipmentList.size(); i++) {
|
||||
ExperimentDeviationEquipment v = equipmentList.get(i);
|
||||
@@ -503,14 +504,13 @@ public class ExperimentDocServiceImpl extends ServiceImpl<ExperimentDocMapper, E
|
||||
params.put("设备名称", Optional.ofNullable(v.getEquipmentName()).orElse(""));
|
||||
params.put("管理编号", Optional.ofNullable(v.getEquipmentNo()).orElse(""));
|
||||
String measurementValidity = v.getMeasurementValidity();
|
||||
params.put("使用日期", "");
|
||||
params.put("归还日期", "");
|
||||
params.put("使用日期", experiment.getStartDate());
|
||||
params.put("归还日期", experiment.getEndDate());
|
||||
params.put("计量有效期", Optional.ofNullable(measurementValidity).orElse(""));
|
||||
params.put("异常记录", "");
|
||||
list.add(params);
|
||||
}
|
||||
|
||||
Experiment experiment = experimentService.getById(experimentId);
|
||||
Map<String, Object> root = new HashMap<>();
|
||||
root.put("equipment", list);
|
||||
root.put("试验编号", experiment.getExperimentNo());
|
||||
@@ -525,35 +525,141 @@ public class ExperimentDocServiceImpl extends ServiceImpl<ExperimentDocMapper, E
|
||||
}
|
||||
ExperimentReport latestReport = experimentReportService.getLatestReport(experimentId);
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("批准人员姓名", Optional.ofNullable(latestReport).map(v -> sysUserService.getById(v.getConfirmer()))
|
||||
params.put("批准人员名称", Optional.ofNullable(latestReport).map(v -> sysUserService.getById(v.getConfirmer()))
|
||||
.map(SysUser::getRealname).orElse(""));
|
||||
params.put("批准时间", Optional.ofNullable(latestReport).map(v -> DateUtils.formatDate(v.getConfirmerTime(), "yyyy 年 M 月 d 日"))
|
||||
.orElse(" 年 月 日"));
|
||||
|
||||
params.put("审核人名称", Optional.ofNullable(latestReport).map(v -> sysUserService.getById(v.getAuditor()))
|
||||
.map(SysUser::getRealname).orElse(""));
|
||||
params.put("审核时间", Optional.ofNullable(latestReport).map(v -> DateUtils.formatDate(v.getAuditorTime(), "yyyy 年 M 月 d 日"))
|
||||
.orElse(" 年 月 日"));
|
||||
|
||||
params.put("校对人名称", Optional.ofNullable(latestReport).map(v -> sysUserService.getById(v.getProofreader()))
|
||||
.map(SysUser::getRealname).orElse(""));
|
||||
params.put("负责人名称", experiment.getSupervisorName());
|
||||
params.put("审核时间", Optional.ofNullable(latestReport)
|
||||
.map(v -> DateUtils.formatDate(v.getProofreaderTime(), "yyyy 年 M 月 d 日"))
|
||||
.orElse(" 年 月 日"));
|
||||
|
||||
params.put("负责人名称", experiment.getSupervisorName());
|
||||
params.put("试验完成时间", DateUtils.formatDate(experiment.getEndDate(), "yyyy 年 M 月 d 日"));
|
||||
|
||||
params.put("编写时间", DateUtils.formatDate(experiment.getStartDate(), "yyyy 年 M 月 d 日"));
|
||||
params.put("试验报告名称", experiment.getName());
|
||||
params.put("试验编号", experiment.getExperimentNo());
|
||||
params.put("校对驳回意见", Optional.ofNullable(latestReport).map(ExperimentReport::getProofreaderMemo).orElse(""));
|
||||
params.put("审核驳回意见", Optional.ofNullable(latestReport).map(ExperimentReport::getAuditorMemo).orElse(""));
|
||||
params.put("批准驳回意见", Optional.ofNullable(latestReport).map(ExperimentReport::getConfirmerMemo).orElse(""));
|
||||
params.put("校对驳回意见", Optional.ofNullable(latestReport).map(ExperimentReport::getProofreaderMemo).orElse("无"));
|
||||
params.put("审核驳回意见", Optional.ofNullable(latestReport).map(ExperimentReport::getAuditorMemo).orElse("无"));
|
||||
params.put("批准驳回意见", Optional.ofNullable(latestReport).map(ExperimentReport::getConfirmerMemo).orElse("无"));
|
||||
|
||||
return new HashMap<>();
|
||||
return params;
|
||||
}
|
||||
|
||||
private Map<String, Object> assembleFzsyjhb(String experimentId) {
|
||||
Experiment experiment = experimentService.getById(experimentId);
|
||||
Map<String, Object> root = new HashMap<>();
|
||||
root.put("试验编号", experiment.getExperimentNo());
|
||||
root.put("能量", "");
|
||||
root.put("束流", "");
|
||||
root.put("X能量", "");
|
||||
root.put("管电流", "");
|
||||
root.put("管电压", "");
|
||||
root.put("质子能量", "");
|
||||
root.put("面积", "");
|
||||
root.put("均衡性", "");
|
||||
root.put("试验开始时间", DateUtils.formatDate(experiment.getStartDate(), "yyyy 年 M 月 d 日"));
|
||||
root.put("试验结束时间", DateUtils.formatDate(experiment.getEndDate(), "yyyy 年 M 月 d 日"));
|
||||
List<ExperimentRadiationProcess> radiationProcessList = experimentRadiationProcessService.getByExperimentId(experimentId);
|
||||
boolean hasXgy = false, hasDgy = false, hasX = false, hasElectronics = false, hasProton = false;
|
||||
List<RadiationDetailDTO> detailDTOList = new ArrayList<>();
|
||||
for (ExperimentRadiationProcess radiationProcess : radiationProcessList) {
|
||||
String radiationDetailJson = radiationProcess.getRadiationDetail();
|
||||
RadiationMapDTO radiationMap = JSON.parseObject(radiationDetailJson, RadiationMapDTO.class);
|
||||
if (CollUtil.isNotEmpty(radiationMap.getXgy())) {
|
||||
hasXgy = true;
|
||||
}
|
||||
if (CollUtil.isNotEmpty(radiationMap.getDgy())) {
|
||||
hasDgy = true;
|
||||
}
|
||||
if (CollUtil.isNotEmpty(radiationMap.getX())) {
|
||||
hasX = true;
|
||||
}
|
||||
if (CollUtil.isNotEmpty(radiationMap.getElectronics())) {
|
||||
hasElectronics = true;
|
||||
}
|
||||
if (CollUtil.isNotEmpty(radiationMap.getProton())) {
|
||||
hasProton = true;
|
||||
}
|
||||
detailDTOList.addAll(radiationMap.assembleDetails());
|
||||
}
|
||||
root.put("小钴源", hasXgy ? "☑小钴源" : "□小钴源");
|
||||
root.put("大钴源", hasDgy ? "☑大钴源" : "□大钴源");
|
||||
root.put("X光机", hasX ? "☑X光机" : "□X光机");
|
||||
root.put("电子加速器", hasElectronics ? "☑电子加速器" : "□电子加速器");
|
||||
root.put("质子加速器", hasProton ? "☑质子加速器" : "□质子加速器");
|
||||
OptionalDouble maxEnergy = detailDTOList.stream().map(obj -> obj.getEnergy()) // 获取point字段
|
||||
.filter(point -> StringUtils.isNotBlank(point))
|
||||
.filter(str -> str.matches("-?\\d+(\\.\\d+)?")) // 只保留数字格式的字符串
|
||||
.mapToDouble(Double::parseDouble) // 转换为double
|
||||
.max();
|
||||
OptionalDouble maxBeam = detailDTOList.stream().map(obj -> obj.getBeam()) // 获取point字段
|
||||
.filter(point -> StringUtils.isNotBlank(point))
|
||||
.filter(str -> str.matches("-?\\d+(\\.\\d+)?")) // 只保留数字格式的字符串
|
||||
.mapToDouble(Double::parseDouble) // 转换为double
|
||||
.max();
|
||||
OptionalDouble maxElectronEnergy = detailDTOList.stream().map(obj -> obj.getElectronEnergy()) // 获取point字段
|
||||
.filter(point -> StringUtils.isNotBlank(point))
|
||||
.filter(str -> str.matches("-?\\d+(\\.\\d+)?")) // 只保留数字格式的字符串
|
||||
.mapToDouble(Double::parseDouble) // 转换为double
|
||||
.max();
|
||||
OptionalDouble maxTubeCurrent = detailDTOList.stream().map(obj -> obj.getTubeCurrent()) // 获取point字段
|
||||
.filter(point -> StringUtils.isNotBlank(point))
|
||||
.filter(str -> str.matches("-?\\d+(\\.\\d+)?")) // 只保留数字格式的字符串
|
||||
.mapToDouble(Double::parseDouble) // 转换为double
|
||||
.max();
|
||||
OptionalDouble maxProtonEnergy = detailDTOList.stream().map(obj -> obj.getProtonEnergy()) // 获取point字段
|
||||
.filter(point -> StringUtils.isNotBlank(point))
|
||||
.filter(str -> str.matches("-?\\d+(\\.\\d+)?")) // 只保留数字格式的字符串
|
||||
.mapToDouble(Double::parseDouble) // 转换为double
|
||||
.max();
|
||||
OptionalDouble maxScanArea = detailDTOList.stream().map(obj -> obj.getScanArea()) // 获取point字段
|
||||
.filter(point -> StringUtils.isNotBlank(point))
|
||||
.filter(str -> str.matches("-?\\d+(\\.\\d+)?")) // 只保留数字格式的字符串
|
||||
.mapToDouble(Double::parseDouble) // 转换为double
|
||||
.max();
|
||||
|
||||
OptionalDouble maxX = detailDTOList.stream().map(obj -> obj.getXy()) // 获取point字段
|
||||
.filter(point -> StringUtils.isNotBlank(point))
|
||||
.map(str -> str.split(",")[0]) // 只保留数字格式的字符串
|
||||
.mapToDouble(Double::parseDouble) // 转换为double
|
||||
.max();
|
||||
|
||||
OptionalDouble maxY = detailDTOList.stream().map(obj -> obj.getXy()) // 获取point字段
|
||||
.filter(point -> StringUtils.isNotBlank(point))
|
||||
.map(str -> str.split(",")[0]) // 只保留数字格式的字符串
|
||||
.mapToDouble(Double::parseDouble) // 转换为double
|
||||
.max();
|
||||
|
||||
String environmentSelect = detailDTOList.stream().map(obj -> obj.getEnvironmentSelect()) // 获取point字段
|
||||
.filter(point -> StringUtils.isNotBlank(point)).findFirst().orElse("");
|
||||
String typeSelect = detailDTOList.stream().map(obj -> obj.getTypeSelect()) // 获取point字段
|
||||
.filter(point -> StringUtils.isNotBlank(point)).findFirst().orElse("");
|
||||
String environmentSelectStr = "□真空 □大气";
|
||||
if (StringUtils.equals(environmentSelect, "真空")) {
|
||||
environmentSelectStr = "☑真空 □大气";
|
||||
}
|
||||
if (StringUtils.equals(environmentSelect, "大气")) {
|
||||
environmentSelectStr = "□真空 ☑大气 ";
|
||||
}
|
||||
String typeSelectStr = "□标定 □辐照";
|
||||
if (StringUtils.equals(typeSelect, "标定")) {
|
||||
typeSelectStr = "☑标定 □辐照";
|
||||
}
|
||||
if (StringUtils.equals(typeSelect, "辐照")) {
|
||||
typeSelectStr = "□标定 ☑辐照 ";
|
||||
}
|
||||
|
||||
root.put("电子能量", maxElectronEnergy.orElse(0));
|
||||
root.put("束流", maxBeam.orElse(0));
|
||||
root.put("X能量", maxEnergy.orElse(0));
|
||||
root.put("管电流", maxTubeCurrent.orElse(0));
|
||||
root.put("管电压", "0");
|
||||
root.put("质子能量", maxProtonEnergy.orElse(0));
|
||||
root.put("面积", maxScanArea.orElse(0));
|
||||
root.put("均匀性", maxX.orElse(0) + "," + maxY.orElse(0));
|
||||
root.put("辐射环境", environmentSelectStr);
|
||||
root.put("试验类型", typeSelectStr);
|
||||
return root;
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user