荧光数据接口

This commit is contained in:
2025-11-15 13:48:47 +08:00
parent 4394c4ecf8
commit 6e3e604fca
36 changed files with 625 additions and 38 deletions

View File

@@ -31,7 +31,7 @@ import static com.zt.plat.framework.apilog.core.enums.OperateTypeEnum.*;
@Tag(name = "管理后台 - 荧光采集记录") @Tag(name = "管理后台 - 荧光采集记录")
@RestController @RestController
@RequestMapping("/qms/business-XRF-data") @RequestMapping("/qms/business-xrf-data")
@Validated @Validated
public class BusinessXRFDataController implements BusinessControllerMarker { public class BusinessXRFDataController implements BusinessControllerMarker {

View File

@@ -63,6 +63,10 @@ public class BatchSampleAnalysisColumnRespVO implements Serializable {
@Schema(description = "单位") @Schema(description = "单位")
private String unit; private String unit;
/** 类型project元素parameter参数 **/
@Schema(description = "类型project元素parameter参数")
private String type;
@Schema(description = "填写方式") @Schema(description = "填写方式")
private String fillingWay; private String fillingWay;

View File

@@ -54,8 +54,8 @@ public class BusinessAssayProjectAndParameterRespVO implements Serializable {
@Schema(description = "元素或参数配置参数编号") @Schema(description = "元素或参数配置参数编号")
private Integer paramNo; private Integer paramNo;
/** 类型(1元素2:参数) **/ /** 类型(project元素parameter:参数) **/
@Schema(description = "类型project元素2:参数)") @Schema(description = "类型project元素parameter:参数)")
private String type; private String type;
@Schema(description = "填写方式") @Schema(description = "填写方式")

View File

@@ -14,7 +14,7 @@ import static com.zt.plat.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH
public class BusinessXRFDataPageReqVO extends PageParam { public class BusinessXRFDataPageReqVO extends PageParam {
@Schema(description = "设备编号") @Schema(description = "设备编号")
private Long deviceNo; private String deviceNo;
@Schema(description = "荧光线名称", example = "王五") @Schema(description = "荧光线名称", example = "王五")
private String lineName; private String lineName;
@@ -44,6 +44,9 @@ public class BusinessXRFDataPageReqVO extends PageParam {
@Schema(description = "分样子样ID", example = "13189") @Schema(description = "分样子样ID", example = "13189")
private Long businessSubSampleId; private Long businessSubSampleId;
@Schema(description = "检测任务ID", example = "16505")
private Long businessAssayTaskDataId;
@Schema(description = "检测数据") @Schema(description = "检测数据")
private String assayData; private String assayData;

View File

@@ -0,0 +1,85 @@
package com.zt.plat.module.qms.business.bus.controller.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import com.zt.plat.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static com.zt.plat.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 荧光采集记录分页 Request VO")
@Data
public class BusinessXRFDataReqVO {
@Schema(description = "设备编号")
private String deviceNo;
@Schema(description = "荧光线名称", example = "王五")
private String lineName;
@Schema(description = "荧光样品id", example = "13273")
private String xRFSampleId;
@Schema(description = "荧光样品id列表")
private List<String> xRFSampleIdList;
@Schema(description = "样品编号")
private String sampleCode;
@Schema(description = "样品名称", example = "李四")
private String sampleName;
@Schema(description = "样品时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] sampleTime;
@Schema(description = "分析人")
private String assayOperator;
@Schema(description = "样品主样ID", example = "29288")
private Long businessBaseSampleId;
@Schema(description = "样品分样ID", example = "4878")
private Long businessSubParentSampleId;
@Schema(description = "分样子样ID", example = "13189")
private Long businessSubSampleId;
@Schema(description = "检测任务ID", example = "16505")
private Long businessAssayTaskDataId;
@Schema(description = "检测数据")
private String assayData;
@Schema(description = "是否为检查创建数据")
private Integer isCheckCreate;
@Schema(description = "是否已匹配")
private Integer isMatched;
@Schema(description = "是否已上报")
private Integer isReported;
@Schema(description = "上报人")
private String reporter;
@Schema(description = "上报时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] reportTime;
@Schema(description = "乐观锁", example = "4171")
private Integer updateCount;
@Schema(description = "所属部门")
private String systemDepartmentCode;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
@Schema(description = "备注")
private String remark;
}

View File

@@ -18,7 +18,7 @@ public class BusinessXRFDataRespVO {
@Schema(description = "设备编号", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "设备编号", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("设备编号") @ExcelProperty("设备编号")
private Long deviceNo; private String deviceNo;
@Schema(description = "荧光线名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五") @Schema(description = "荧光线名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
@ExcelProperty("荧光线名称") @ExcelProperty("荧光线名称")
@@ -56,6 +56,9 @@ public class BusinessXRFDataRespVO {
@ExcelProperty("分样子样ID") @ExcelProperty("分样子样ID")
private Long businessSubSampleId; private Long businessSubSampleId;
@Schema(description = "检测任务ID", example = "16505")
private Long businessAssayTaskDataId;
@Schema(description = "检测数据", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "检测数据", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("检测数据") @ExcelProperty("检测数据")
private String assayData; private String assayData;

View File

@@ -16,7 +16,7 @@ public class BusinessXRFDataSaveReqVO {
@Schema(description = "设备编号", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "设备编号", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "设备编号不能为空") @NotNull(message = "设备编号不能为空")
private Long deviceNo; private String deviceNo;
@Schema(description = "荧光线名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五") @Schema(description = "荧光线名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
@NotEmpty(message = "荧光线名称不能为空") @NotEmpty(message = "荧光线名称不能为空")
@@ -49,6 +49,9 @@ public class BusinessXRFDataSaveReqVO {
@NotNull(message = "分样子样ID不能为空") @NotNull(message = "分样子样ID不能为空")
private Long businessSubSampleId; private Long businessSubSampleId;
@Schema(description = "检测任务ID", example = "16505")
private Long businessAssayTaskDataId;
@Schema(description = "检测数据", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "检测数据", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "检测数据不能为空") @NotEmpty(message = "检测数据不能为空")
private String assayData; private String assayData;

View File

@@ -37,7 +37,7 @@ public class BusinessXRFDataDO extends BusinessBaseDO {
* 设备编号 * 设备编号
*/ */
@TableField("DEV_NO") @TableField("DEV_NO")
private Long deviceNo; private String deviceNo;
/** /**
* 荧光线名称 * 荧光线名称
*/ */
@@ -84,6 +84,11 @@ public class BusinessXRFDataDO extends BusinessBaseDO {
@TableField("BSN_SB_SMP_ID") @TableField("BSN_SB_SMP_ID")
private Long businessSubSampleId; private Long businessSubSampleId;
/** /**
* 检测任务ID
*/
@TableField("BSN_ASY_TSK_DAT_ID")
private Long businessAssayTaskDataId;
/**
* 检测数据 * 检测数据
*/ */
@TableField("ASY_DAT") @TableField("ASY_DAT")

View File

@@ -119,6 +119,17 @@ public interface BusinessAssayTaskDataMapper extends BaseMapperX<BusinessAssayTa
.eq(BusinessAssayTaskDataDO::getId, businessAssayTaskDataId)); .eq(BusinessAssayTaskDataDO::getId, businessAssayTaskDataId));
} }
default BusinessAssayTaskDataExtendRespVO selectBySampleCode(String sampleCode) {
return selectJoinOne(BusinessAssayTaskDataExtendRespVO.class, new MPJLambdaWrapperX<BusinessAssayTaskDataDO>()
.leftJoin(BusinessSubSampleDO.class, BusinessSubSampleDO::getId, BusinessAssayTaskDataDO::getBusinessSubSampleId)
.selectAll(BusinessAssayTaskDataDO.class)
.selectAs(BusinessSubSampleDO::getSampleName, BusinessAssayTaskDataExtendRespVO::getSampleName)
.selectAs(BusinessSubSampleDO::getSampleCode, BusinessAssayTaskDataExtendRespVO::getSampleCode)
.selectAs(BusinessSubSampleDO::getSampleAssayCode, BusinessAssayTaskDataExtendRespVO::getSampleAssayCode)
.eq(BusinessSubSampleDO::getSampleAssayCode, sampleCode)
.eq(BusinessAssayTaskDataDO::getIsReported, QmsCommonConstant.NO));
}
default List<BusinessAssayTaskDataExtendRespVO> selectResultAssessmentList(BusinessAssayTaskDataReqVO reqVO) { default List<BusinessAssayTaskDataExtendRespVO> selectResultAssessmentList(BusinessAssayTaskDataReqVO reqVO) {
MPJLambdaWrapper<BusinessAssayTaskDataDO> mpjLambdaWrapper = new MPJLambdaWrapper<BusinessAssayTaskDataDO>() MPJLambdaWrapper<BusinessAssayTaskDataDO> mpjLambdaWrapper = new MPJLambdaWrapper<BusinessAssayTaskDataDO>()
.leftJoin(ConfigAssayMethodDO.class, ConfigAssayMethodDO::getId, BusinessAssayTaskDataDO::getConfigAssayMethodId) .leftJoin(ConfigAssayMethodDO.class, ConfigAssayMethodDO::getId, BusinessAssayTaskDataDO::getConfigAssayMethodId)
@@ -320,4 +331,5 @@ public interface BusinessAssayTaskDataMapper extends BaseMapperX<BusinessAssayTa
*/ */
List<UnAssignTaskedSubSampleRespVO> selectUnAssignTaskedSubSample(); List<UnAssignTaskedSubSampleRespVO> selectUnAssignTaskedSubSample();
} }

View File

@@ -5,6 +5,9 @@ import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.module.qms.business.bus.controller.vo.*; import com.zt.plat.module.qms.business.bus.controller.vo.*;
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessXRFDataDO; import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessXRFDataDO;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX; import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import java.util.List;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
/** /**
* 荧光采集记录 Mapper * 荧光采集记录 Mapper
@@ -26,6 +29,34 @@ public interface BusinessXRFDataMapper extends BaseMapperX<BusinessXRFDataDO> {
.eqIfPresent(BusinessXRFDataDO::getBusinessBaseSampleId, reqVO.getBusinessBaseSampleId()) .eqIfPresent(BusinessXRFDataDO::getBusinessBaseSampleId, reqVO.getBusinessBaseSampleId())
.eqIfPresent(BusinessXRFDataDO::getBusinessSubParentSampleId, reqVO.getBusinessSubParentSampleId()) .eqIfPresent(BusinessXRFDataDO::getBusinessSubParentSampleId, reqVO.getBusinessSubParentSampleId())
.eqIfPresent(BusinessXRFDataDO::getBusinessSubSampleId, reqVO.getBusinessSubSampleId()) .eqIfPresent(BusinessXRFDataDO::getBusinessSubSampleId, reqVO.getBusinessSubSampleId())
.eqIfPresent(BusinessXRFDataDO::getBusinessAssayTaskDataId, reqVO.getBusinessAssayTaskDataId())
.eqIfPresent(BusinessXRFDataDO::getAssayData, reqVO.getAssayData())
.eqIfPresent(BusinessXRFDataDO::getIsCheckCreate, reqVO.getIsCheckCreate())
.eqIfPresent(BusinessXRFDataDO::getIsMatched, reqVO.getIsMatched())
.eqIfPresent(BusinessXRFDataDO::getIsReported, reqVO.getIsReported())
.eqIfPresent(BusinessXRFDataDO::getReporter, reqVO.getReporter())
.betweenIfPresent(BusinessXRFDataDO::getReportTime, reqVO.getReportTime())
.eqIfPresent(BusinessXRFDataDO::getUpdateCount, reqVO.getUpdateCount())
.eqIfPresent(BusinessXRFDataDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
.betweenIfPresent(BusinessXRFDataDO::getCreateTime, reqVO.getCreateTime())
.eqIfPresent(BusinessXRFDataDO::getRemark, reqVO.getRemark())
.orderByDesc(BusinessXRFDataDO::getId));
}
default List<BusinessXRFDataDO> selectList(BusinessXRFDataReqVO reqVO) {
return selectList(new LambdaQueryWrapperX<BusinessXRFDataDO>()
.eqIfPresent(BusinessXRFDataDO::getDeviceNo, reqVO.getDeviceNo())
.likeIfPresent(BusinessXRFDataDO::getLineName, reqVO.getLineName())
.eqIfPresent(BusinessXRFDataDO::getXRFSampleId, reqVO.getXRFSampleId())
.inIfPresent(BusinessXRFDataDO::getXRFSampleId, reqVO.getXRFSampleIdList())
.eqIfPresent(BusinessXRFDataDO::getSampleCode, reqVO.getSampleCode())
.likeIfPresent(BusinessXRFDataDO::getSampleName, reqVO.getSampleName())
.betweenIfPresent(BusinessXRFDataDO::getSampleTime, reqVO.getSampleTime())
.eqIfPresent(BusinessXRFDataDO::getAssayOperator, reqVO.getAssayOperator())
.eqIfPresent(BusinessXRFDataDO::getBusinessBaseSampleId, reqVO.getBusinessBaseSampleId())
.eqIfPresent(BusinessXRFDataDO::getBusinessSubParentSampleId, reqVO.getBusinessSubParentSampleId())
.eqIfPresent(BusinessXRFDataDO::getBusinessSubSampleId, reqVO.getBusinessSubSampleId())
.eqIfPresent(BusinessXRFDataDO::getBusinessAssayTaskDataId, reqVO.getBusinessAssayTaskDataId())
.eqIfPresent(BusinessXRFDataDO::getAssayData, reqVO.getAssayData()) .eqIfPresent(BusinessXRFDataDO::getAssayData, reqVO.getAssayData())
.eqIfPresent(BusinessXRFDataDO::getIsCheckCreate, reqVO.getIsCheckCreate()) .eqIfPresent(BusinessXRFDataDO::getIsCheckCreate, reqVO.getIsCheckCreate())
.eqIfPresent(BusinessXRFDataDO::getIsMatched, reqVO.getIsMatched()) .eqIfPresent(BusinessXRFDataDO::getIsMatched, reqVO.getIsMatched())

View File

@@ -291,6 +291,9 @@ public class SampleEntrustGenSampleDataCmp extends NodeComponent {
} else { } else {
isCreateZhy = true; isCreateZhy = true;
MaterialAssayStandardMethodDO materialAssayStandardMethodDO = materialAssayStandardMethodMapper.selectByBaseSampleIdAndDictionaryProjectId(businessSampleEntrustDetailDO.getBaseSampleId(), sDictionaryProjectId); MaterialAssayStandardMethodDO materialAssayStandardMethodDO = materialAssayStandardMethodMapper.selectByBaseSampleIdAndDictionaryProjectId(businessSampleEntrustDetailDO.getBaseSampleId(), sDictionaryProjectId);
if (materialAssayStandardMethodDO == null) {
throw new ServiceException(1_032_100_000, "商检样品检测项目存在金银但未找到S配置");
}
configAssayMethodZhy = configAssayMethodMapper.selectById(materialAssayStandardMethodDO.getConfigAssayMethodId()); configAssayMethodZhy = configAssayMethodMapper.selectById(materialAssayStandardMethodDO.getConfigAssayMethodId());
} }

View File

@@ -402,6 +402,7 @@ public class SampleAnalysisAuditServiceImpl implements SampleAnalysisAuditServic
datas.add(map); datas.add(map);
} }
resultJsonObject.put("all", datas);
Map<String, List<Map<String, Object>>> map = datas.stream().collect(Collectors.groupingBy(g -> (String) g.get("analysisType"))); Map<String, List<Map<String, Object>>> map = datas.stream().collect(Collectors.groupingBy(g -> (String) g.get("analysisType")));
for (Map.Entry<String, List<Map<String, Object>>> entry : map.entrySet()) { for (Map.Entry<String, List<Map<String, Object>>> entry : map.entrySet()) {
resultJsonObject.put(entry.getKey(), entry.getValue()); resultJsonObject.put(entry.getKey(), entry.getValue());

View File

@@ -150,8 +150,8 @@ public class SampleAnalysisServiceImpl implements SampleAnalysisService {
//处理列 //处理列
List<BatchSampleAnalysisColumnRespVO> cloumns = new ArrayList<>(); List<BatchSampleAnalysisColumnRespVO> cloumns = new ArrayList<>();
cloumns.add(new BatchSampleAnalysisColumnRespVO("sampleCode", "sampleCode", "样品编号", "200px", "200px", "string", null, null, null, null, false, null, null, null, null, null)); cloumns.add(new BatchSampleAnalysisColumnRespVO("sampleCode", "sampleCode", "样品编号", "200px", "200px", "string", null, null, null, null, false, null, null, null, null, null, null));
cloumns.add(new BatchSampleAnalysisColumnRespVO("sampleName", "sampleName", "样品名称", "200px", "200px", "string", null, null, null, null, false, null, null, null, null, null)); cloumns.add(new BatchSampleAnalysisColumnRespVO("sampleName", "sampleName", "样品名称", "200px", "200px", "string", null, null, null, null, false, null, null, null, null, null, null));
//cloumns.add(new BatchSampleAnalysisColumnRespVO("cupNumber", "cupNumber", "杯号", "200px", "200px", "string", null, null, null, null, true, null)); //cloumns.add(new BatchSampleAnalysisColumnRespVO("cupNumber", "cupNumber", "杯号", "200px", "200px", "string", null, null, null, null, true, null));
@@ -167,7 +167,7 @@ public class SampleAnalysisServiceImpl implements SampleAnalysisService {
String fieldIndex = "e" + ep.getDicId(); String fieldIndex = "e" + ep.getDicId();
String title = ep.getShowName() + (StringUtils.isBlank(ep.getUnit()) ? "" : "(" + ep.getUnit() + ")"); String title = ep.getShowName() + (StringUtils.isBlank(ep.getUnit()) ? "" : "(" + ep.getUnit() + ")");
boolean isEdit = StringUtils.isBlank(ep.getFormula()); boolean isEdit = StringUtils.isBlank(ep.getFormula());
cloumns.add(new BatchSampleAnalysisColumnRespVO(fieldIndex, fieldIndex + ".value", title, "", "120px", ep.getDataType(), ep.getDecimalPosition(), null, ep.getFormula(), ep.getParamNo(), isEdit, ep.getUnit(), ep.getFillingWay(), ep.getGroupDictionaryBusinessId(), ep.getGroupDictionaryBusinessKey(), ep.getGroupDictionaryBusinessName())); cloumns.add(new BatchSampleAnalysisColumnRespVO(fieldIndex, fieldIndex + ".value", title, "", "120px", ep.getDataType(), ep.getDecimalPosition(), null, ep.getFormula(), ep.getParamNo(), isEdit, ep.getUnit(), "project", ep.getFillingWay(), ep.getGroupDictionaryBusinessId(), ep.getGroupDictionaryBusinessKey(), ep.getGroupDictionaryBusinessName()));
if (StringUtils.isNotEmpty(ep.getFormula())) { if (StringUtils.isNotEmpty(ep.getFormula())) {
BusinessAssayParameterDataReqVO parameterDataSearch = new BusinessAssayParameterDataReqVO(); BusinessAssayParameterDataReqVO parameterDataSearch = new BusinessAssayParameterDataReqVO();
@@ -177,7 +177,7 @@ public class SampleAnalysisServiceImpl implements SampleAnalysisService {
fieldIndex = "p" + p.getDicId(); fieldIndex = "p" + p.getDicId();
title = p.getShowName() + (StringUtils.isBlank(p.getUnit()) ? "" : "(" + p.getUnit() + ")"); title = p.getShowName() + (StringUtils.isBlank(p.getUnit()) ? "" : "(" + p.getUnit() + ")");
isEdit = StringUtils.isBlank(p.getFormula()); isEdit = StringUtils.isBlank(p.getFormula());
cloumns.add(new BatchSampleAnalysisColumnRespVO(fieldIndex, fieldIndex + ".value", title, "", "120px", p.getDataType(), p.getDecimalPosition(), null, p.getFormula(), p.getParamNo(), isEdit, p.getUnit(), p.getFillingWay(), p.getGroupDictionaryBusinessId(), p.getGroupDictionaryBusinessKey(), p.getGroupDictionaryBusinessName())); cloumns.add(new BatchSampleAnalysisColumnRespVO(fieldIndex, fieldIndex + ".value", title, "", "120px", p.getDataType(), p.getDecimalPosition(), null, p.getFormula(), p.getParamNo(), isEdit, p.getUnit(), "parameter", p.getFillingWay(), p.getGroupDictionaryBusinessId(), p.getGroupDictionaryBusinessKey(), p.getGroupDictionaryBusinessName()));
} }
} }
} }
@@ -406,8 +406,8 @@ public class SampleAnalysisServiceImpl implements SampleAnalysisService {
//处理列 //处理列
List<BatchSampleAnalysisColumnRespVO> cloumns = new ArrayList<>(); List<BatchSampleAnalysisColumnRespVO> cloumns = new ArrayList<>();
cloumns.add(new BatchSampleAnalysisColumnRespVO("sampleCode", "sampleCode", "样品编号", "200px", "200px", "string", null, null, null, null, false, null, null, null, null, null)); cloumns.add(new BatchSampleAnalysisColumnRespVO("sampleCode", "sampleCode", "样品编号", "200px", "200px", "string", null, null, null, null, false, null, null, null, null, null, null));
cloumns.add(new BatchSampleAnalysisColumnRespVO("sampleName", "sampleName", "样品名称", "200px", "200px", "string", null, null, null, null, false, null, null, null, null, null)); cloumns.add(new BatchSampleAnalysisColumnRespVO("sampleName", "sampleName", "样品名称", "200px", "200px", "string", null, null, null, null, false, null, null, null, null, null, null));
//cloumns.add(new BatchSampleAnalysisColumnRespVO("cupNumber", "cupNumber", "杯号", "200px", "200px", "string", null, null, null, null, true, null)); //cloumns.add(new BatchSampleAnalysisColumnRespVO("cupNumber", "cupNumber", "杯号", "200px", "200px", "string", null, null, null, null, true, null));
@@ -422,7 +422,7 @@ public class SampleAnalysisServiceImpl implements SampleAnalysisService {
String fieldIndex = "e" + ep.getDicId(); String fieldIndex = "e" + ep.getDicId();
String title = ep.getShowName() + (StringUtils.isBlank(ep.getUnit()) ? "" : "(" + ep.getUnit() + ")"); String title = ep.getShowName() + (StringUtils.isBlank(ep.getUnit()) ? "" : "(" + ep.getUnit() + ")");
boolean isEdit = StringUtils.isBlank(ep.getFormula()); boolean isEdit = StringUtils.isBlank(ep.getFormula());
cloumns.add(new BatchSampleAnalysisColumnRespVO(fieldIndex, fieldIndex + ".value", title, "", "120px", ep.getDataType(), ep.getDecimalPosition(), null, ep.getFormula(), ep.getParamNo(), isEdit, ep.getUnit(), ep.getFillingWay(), ep.getGroupDictionaryBusinessId(), ep.getGroupDictionaryBusinessKey(), ep.getGroupDictionaryBusinessName())); cloumns.add(new BatchSampleAnalysisColumnRespVO(fieldIndex, fieldIndex + ".value", title, "", "120px", ep.getDataType(), ep.getDecimalPosition(), null, ep.getFormula(), ep.getParamNo(), isEdit, ep.getUnit(), "project", ep.getFillingWay(), ep.getGroupDictionaryBusinessId(), ep.getGroupDictionaryBusinessKey(), ep.getGroupDictionaryBusinessName()));
if (StringUtils.isNotEmpty(ep.getFormula())) { if (StringUtils.isNotEmpty(ep.getFormula())) {
BusinessAssayParameterDataReqVO parameterDataSearch = new BusinessAssayParameterDataReqVO(); BusinessAssayParameterDataReqVO parameterDataSearch = new BusinessAssayParameterDataReqVO();
@@ -432,7 +432,7 @@ public class SampleAnalysisServiceImpl implements SampleAnalysisService {
fieldIndex = "p" + p.getDicId(); fieldIndex = "p" + p.getDicId();
title = p.getShowName() + (StringUtils.isBlank(p.getUnit()) ? "" : "(" + p.getUnit() + ")"); title = p.getShowName() + (StringUtils.isBlank(p.getUnit()) ? "" : "(" + p.getUnit() + ")");
isEdit = StringUtils.isBlank(p.getFormula()); isEdit = StringUtils.isBlank(p.getFormula());
cloumns.add(new BatchSampleAnalysisColumnRespVO(fieldIndex, fieldIndex + ".value", title, "", "120px", p.getDataType(), p.getDecimalPosition(), null, p.getFormula(), p.getParamNo(), isEdit, p.getUnit(), p.getFillingWay(), p.getGroupDictionaryBusinessId(), p.getGroupDictionaryBusinessKey(), p.getGroupDictionaryBusinessName())); cloumns.add(new BatchSampleAnalysisColumnRespVO(fieldIndex, fieldIndex + ".value", title, "", "120px", p.getDataType(), p.getDecimalPosition(), null, p.getFormula(), p.getParamNo(), isEdit, p.getUnit(), "parameter", p.getFillingWay(), p.getGroupDictionaryBusinessId(), p.getGroupDictionaryBusinessKey(), p.getGroupDictionaryBusinessName()));
} }
} }
} }
@@ -492,8 +492,8 @@ public class SampleAnalysisServiceImpl implements SampleAnalysisService {
//处理列 //处理列
List<BatchSampleAnalysisColumnRespVO> cloumns = new ArrayList<>(); List<BatchSampleAnalysisColumnRespVO> cloumns = new ArrayList<>();
cloumns.add(new BatchSampleAnalysisColumnRespVO("sampleCode", "sampleCode", "样品编号", "200px", "200px", "string", null, null, null, null, false, null, null, null, null, null)); cloumns.add(new BatchSampleAnalysisColumnRespVO("sampleCode", "sampleCode", "样品编号", "200px", "200px", "string", null, null, null, null, false, null, null, null, null, null, null));
cloumns.add(new BatchSampleAnalysisColumnRespVO("sampleName", "sampleName", "样品名称", "200px", "200px", "string", null, null, null, null, false, null, null, null, null, null)); cloumns.add(new BatchSampleAnalysisColumnRespVO("sampleName", "sampleName", "样品名称", "200px", "200px", "string", null, null, null, null, false, null, null, null, null, null, null));
//处理数据 //处理数据
List<Map<String, Object>> datas = new ArrayList<>(); List<Map<String, Object>> datas = new ArrayList<>();
@@ -511,7 +511,7 @@ public class SampleAnalysisServiceImpl implements SampleAnalysisService {
String fieldIndex = "p" + p.getDicId(); String fieldIndex = "p" + p.getDicId();
String title = p.getShowName() + (StringUtils.isBlank(p.getUnit()) ? "" : "(" + p.getUnit() + ")"); String title = p.getShowName() + (StringUtils.isBlank(p.getUnit()) ? "" : "(" + p.getUnit() + ")");
boolean isEdit = StringUtils.isBlank(p.getFormula()); boolean isEdit = StringUtils.isBlank(p.getFormula());
cloumns.add(new BatchSampleAnalysisColumnRespVO(fieldIndex, fieldIndex + ".value", title, "", "120px", p.getDataType(), p.getDecimalPosition(), null, p.getFormula(), p.getParamNo(), isEdit, p.getUnit(), p.getFillingWay(), p.getGroupDictionaryBusinessId(), p.getGroupDictionaryBusinessKey(), p.getGroupDictionaryBusinessName())); cloumns.add(new BatchSampleAnalysisColumnRespVO(fieldIndex, fieldIndex + ".value", title, "", "120px", p.getDataType(), p.getDecimalPosition(), null, p.getFormula(), p.getParamNo(), isEdit, p.getUnit(), "parameter", p.getFillingWay(), p.getGroupDictionaryBusinessId(), p.getGroupDictionaryBusinessKey(), p.getGroupDictionaryBusinessName()));
} }
@@ -551,7 +551,7 @@ public class SampleAnalysisServiceImpl implements SampleAnalysisService {
String fieldIndex = "e" + ep.getDicId(); String fieldIndex = "e" + ep.getDicId();
String title = ep.getShowName() + (StringUtils.isBlank(ep.getUnit()) ? "" : "(" + ep.getUnit() + ")"); String title = ep.getShowName() + (StringUtils.isBlank(ep.getUnit()) ? "" : "(" + ep.getUnit() + ")");
boolean isEdit = StringUtils.isBlank(ep.getFormula()); boolean isEdit = StringUtils.isBlank(ep.getFormula());
cloumns.add(new BatchSampleAnalysisColumnRespVO(fieldIndex, fieldIndex + ".value", title, "", "120px", ep.getDataType(), ep.getDecimalPosition(), null, ep.getFormula(), ep.getParamNo(), isEdit, ep.getUnit(), ep.getFillingWay(), ep.getGroupDictionaryBusinessId(), ep.getGroupDictionaryBusinessKey(), ep.getGroupDictionaryBusinessName())); cloumns.add(new BatchSampleAnalysisColumnRespVO(fieldIndex, fieldIndex + ".value", title, "", "120px", ep.getDataType(), ep.getDecimalPosition(), null, ep.getFormula(), ep.getParamNo(), isEdit, ep.getUnit(), "project", ep.getFillingWay(), ep.getGroupDictionaryBusinessId(), ep.getGroupDictionaryBusinessKey(), ep.getGroupDictionaryBusinessName()));
if (StringUtils.isNotEmpty(ep.getFormula())) { if (StringUtils.isNotEmpty(ep.getFormula())) {
BusinessQCManagementParameterDataReqVO parameterDataSearch = new BusinessQCManagementParameterDataReqVO(); BusinessQCManagementParameterDataReqVO parameterDataSearch = new BusinessQCManagementParameterDataReqVO();
@@ -561,7 +561,7 @@ public class SampleAnalysisServiceImpl implements SampleAnalysisService {
fieldIndex = "p" + p.getDicId(); fieldIndex = "p" + p.getDicId();
title = p.getShowName() + (StringUtils.isBlank(p.getUnit()) ? "" : "(" + p.getUnit() + ")"); title = p.getShowName() + (StringUtils.isBlank(p.getUnit()) ? "" : "(" + p.getUnit() + ")");
isEdit = StringUtils.isBlank(p.getFormula()); isEdit = StringUtils.isBlank(p.getFormula());
cloumns.add(new BatchSampleAnalysisColumnRespVO(fieldIndex, fieldIndex + ".value", title, "", "120px", p.getDataType(), p.getDecimalPosition(), null, p.getFormula(), p.getParamNo(), isEdit, p.getUnit(), p.getFillingWay(), p.getGroupDictionaryBusinessId(), p.getGroupDictionaryBusinessKey(), p.getGroupDictionaryBusinessName())); cloumns.add(new BatchSampleAnalysisColumnRespVO(fieldIndex, fieldIndex + ".value", title, "", "120px", p.getDataType(), p.getDecimalPosition(), null, p.getFormula(), p.getParamNo(), isEdit, p.getUnit(), "parameter", p.getFillingWay(), p.getGroupDictionaryBusinessId(), p.getGroupDictionaryBusinessKey(), p.getGroupDictionaryBusinessName()));
} }
} }
} }

View File

@@ -32,7 +32,7 @@ import static com.zt.plat.framework.apilog.core.enums.OperateTypeEnum.*;
@Tag(name = "管理后台 - 荧光数据采集特殊检测项目转换率配置") @Tag(name = "管理后台 - 荧光数据采集特殊检测项目转换率配置")
@RestController @RestController
@RequestMapping("/qms/config-XRF-conversion-rate") @RequestMapping("/qms/config-xrf-conversion-rate")
@Validated @Validated
public class ConfigXRFConversionRateController implements BusinessControllerMarker { public class ConfigXRFConversionRateController implements BusinessControllerMarker {

View File

@@ -32,7 +32,7 @@ import static com.zt.plat.framework.apilog.core.enums.OperateTypeEnum.*;
@Tag(name = "管理后台 - 荧光分析线") @Tag(name = "管理后台 - 荧光分析线")
@RestController @RestController
@RequestMapping("/qms/config-XRF-line") @RequestMapping("/qms/config-xrf-line")
@Validated @Validated
public class ConfigXRFLineController implements BusinessControllerMarker { public class ConfigXRFLineController implements BusinessControllerMarker {

View File

@@ -32,7 +32,7 @@ import static com.zt.plat.framework.apilog.core.enums.OperateTypeEnum.*;
@Tag(name = "管理后台 - 荧光采集检测项目配置") @Tag(name = "管理后台 - 荧光采集检测项目配置")
@RestController @RestController
@RequestMapping("/qms/config-XRF-project") @RequestMapping("/qms/config-xrf-project")
@Validated @Validated
public class ConfigXRFProjectController implements BusinessControllerMarker { public class ConfigXRFProjectController implements BusinessControllerMarker {

View File

@@ -14,7 +14,7 @@ import static com.zt.plat.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH
public class ConfigXRFConversionRatePageReqVO extends PageParam { public class ConfigXRFConversionRatePageReqVO extends PageParam {
@Schema(description = "设备编号") @Schema(description = "设备编号")
private Long deviceNo; private String deviceNo;
@Schema(description = "荧光线名称", example = "张三") @Schema(description = "荧光线名称", example = "张三")
private String lineName; private String lineName;

View File

@@ -18,7 +18,7 @@ public class ConfigXRFConversionRateRespVO {
@Schema(description = "设备编号", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "设备编号", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("设备编号") @ExcelProperty("设备编号")
private Long deviceNo; private String deviceNo;
@Schema(description = "荧光线名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三") @Schema(description = "荧光线名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
@ExcelProperty("荧光线名称") @ExcelProperty("荧光线名称")

View File

@@ -14,7 +14,7 @@ public class ConfigXRFConversionRateSaveReqVO {
@Schema(description = "设备编号", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "设备编号", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "设备编号不能为空") @NotNull(message = "设备编号不能为空")
private Long deviceNo; private String deviceNo;
@Schema(description = "荧光线名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三") @Schema(description = "荧光线名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
@NotEmpty(message = "荧光线名称不能为空") @NotEmpty(message = "荧光线名称不能为空")

View File

@@ -14,7 +14,7 @@ import static com.zt.plat.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH
public class ConfigXRFLinePageReqVO extends PageParam { public class ConfigXRFLinePageReqVO extends PageParam {
@Schema(description = "设备编号") @Schema(description = "设备编号")
private Long deviceNo; private String deviceNo;
@Schema(description = "荧光线名称", example = "芋艿") @Schema(description = "荧光线名称", example = "芋艿")
private String lineName; private String lineName;

View File

@@ -18,7 +18,7 @@ public class ConfigXRFLineRespVO {
@Schema(description = "设备编号", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "设备编号", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("设备编号") @ExcelProperty("设备编号")
private Long deviceNo; private String deviceNo;
@Schema(description = "荧光线名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿") @Schema(description = "荧光线名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿")
@ExcelProperty("荧光线名称") @ExcelProperty("荧光线名称")

View File

@@ -16,7 +16,7 @@ public class ConfigXRFLineSaveReqVO {
@Schema(description = "设备编号", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "设备编号", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "设备编号不能为空") @NotNull(message = "设备编号不能为空")
private Long deviceNo; private String deviceNo;
@Schema(description = "荧光线名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿") @Schema(description = "荧光线名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿")
@NotEmpty(message = "荧光线名称不能为空") @NotEmpty(message = "荧光线名称不能为空")

View File

@@ -14,7 +14,7 @@ import static com.zt.plat.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH
public class ConfigXRFProjectPageReqVO extends PageParam { public class ConfigXRFProjectPageReqVO extends PageParam {
@Schema(description = "设备编号") @Schema(description = "设备编号")
private Long deviceNo; private String deviceNo;
@Schema(description = "检测项目ID,字典表【T_DIC_PRJ】", example = "12325") @Schema(description = "检测项目ID,字典表【T_DIC_PRJ】", example = "12325")
private Long dictionaryProjectId; private Long dictionaryProjectId;
@@ -37,6 +37,9 @@ public class ConfigXRFProjectPageReqVO extends PageParam {
@Schema(description = "转换率(乘数)") @Schema(description = "转换率(乘数)")
private Integer conversionRate; private Integer conversionRate;
@Schema(description = "上报列字段")
private String saveColumn;
@Schema(description = "排序号") @Schema(description = "排序号")
private Integer sortNo; private Integer sortNo;

View File

@@ -18,7 +18,7 @@ public class ConfigXRFProjectRespVO {
@Schema(description = "设备编号", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "设备编号", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("设备编号") @ExcelProperty("设备编号")
private Long deviceNo; private String deviceNo;
@Schema(description = "检测项目ID,字典表【T_DIC_PRJ】", requiredMode = Schema.RequiredMode.REQUIRED, example = "12325") @Schema(description = "检测项目ID,字典表【T_DIC_PRJ】", requiredMode = Schema.RequiredMode.REQUIRED, example = "12325")
@ExcelProperty("检测项目ID,字典表【T_DIC_PRJ】") @ExcelProperty("检测项目ID,字典表【T_DIC_PRJ】")
@@ -48,6 +48,9 @@ public class ConfigXRFProjectRespVO {
@ExcelProperty("转换率(乘数)") @ExcelProperty("转换率(乘数)")
private Integer conversionRate; private Integer conversionRate;
@Schema(description = "上报列字段")
private String saveColumn;
@Schema(description = "排序号") @Schema(description = "排序号")
@ExcelProperty("排序号") @ExcelProperty("排序号")
private Integer sortNo; private Integer sortNo;

View File

@@ -14,7 +14,7 @@ public class ConfigXRFProjectSaveReqVO {
@Schema(description = "设备编号", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "设备编号", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "设备编号不能为空") @NotNull(message = "设备编号不能为空")
private Long deviceNo; private String deviceNo;
@Schema(description = "检测项目ID,字典表【T_DIC_PRJ】", requiredMode = Schema.RequiredMode.REQUIRED, example = "12325") @Schema(description = "检测项目ID,字典表【T_DIC_PRJ】", requiredMode = Schema.RequiredMode.REQUIRED, example = "12325")
@NotNull(message = "检测项目ID,字典表【T_DIC_PRJ】不能为空") @NotNull(message = "检测项目ID,字典表【T_DIC_PRJ】不能为空")
@@ -38,6 +38,9 @@ public class ConfigXRFProjectSaveReqVO {
@Schema(description = "转换率(乘数)") @Schema(description = "转换率(乘数)")
private Integer conversionRate; private Integer conversionRate;
@Schema(description = "上报列字段")
private String saveColumn;
@Schema(description = "排序号") @Schema(description = "排序号")
private Integer sortNo; private Integer sortNo;

View File

@@ -35,7 +35,7 @@ public class ConfigXRFConversionRateDO extends BusinessBaseDO {
* 设备编号 * 设备编号
*/ */
@TableField("DEV_NO") @TableField("DEV_NO")
private Long deviceNo; private String deviceNo;
/** /**
* 荧光线名称 * 荧光线名称
*/ */

View File

@@ -37,7 +37,7 @@ public class ConfigXRFLineDO extends BusinessBaseDO {
* 设备编号 * 设备编号
*/ */
@TableField("DEV_NO") @TableField("DEV_NO")
private Long deviceNo; private String deviceNo;
/** /**
* 荧光线名称 * 荧光线名称
*/ */

View File

@@ -35,7 +35,7 @@ public class ConfigXRFProjectDO extends BusinessBaseDO {
* 设备编号 * 设备编号
*/ */
@TableField("DEV_NO") @TableField("DEV_NO")
private Long deviceNo; private String deviceNo;
/** /**
* 检测项目ID,字典表【T_DIC_PRJ】 * 检测项目ID,字典表【T_DIC_PRJ】
*/ */
@@ -72,6 +72,11 @@ public class ConfigXRFProjectDO extends BusinessBaseDO {
@TableField("CNV_RTE") @TableField("CNV_RTE")
private Integer conversionRate; private Integer conversionRate;
/** /**
* 上报列字段
*/
@TableField("SVE_COLN")
private String saveColumn;
/**
* 排序号 * 排序号
*/ */
@TableField("SRT_NO") @TableField("SRT_NO")

View File

@@ -1,7 +1,5 @@
package com.zt.plat.module.qms.business.config.dal.mapper; package com.zt.plat.module.qms.business.config.dal.mapper;
import java.util.*;
import com.zt.plat.framework.common.pojo.PageResult; import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX; import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.module.qms.business.config.controller.vo.*; import com.zt.plat.module.qms.business.config.controller.vo.*;
@@ -29,4 +27,11 @@ public interface ConfigXRFConversionRateMapper extends BaseMapperX<ConfigXRFConv
.orderByDesc(ConfigXRFConversionRateDO::getId)); .orderByDesc(ConfigXRFConversionRateDO::getId));
} }
default ConfigXRFConversionRateDO selectBy(String deviceNo, String lineName, String projectName) {
return selectOne(new LambdaQueryWrapperX<ConfigXRFConversionRateDO>()
.eq(ConfigXRFConversionRateDO::getDeviceNo, deviceNo)
.eq(ConfigXRFConversionRateDO::getLineName, lineName)
.eq(ConfigXRFConversionRateDO::getXRFProjectName, projectName));
}
} }

View File

@@ -6,6 +6,7 @@ import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX; import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.module.qms.business.config.controller.vo.*; import com.zt.plat.module.qms.business.config.controller.vo.*;
import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigXRFLineDO; import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigXRFLineDO;
import com.zt.plat.module.qms.enums.QmsCommonConstant;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX; import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
@@ -32,4 +33,17 @@ public interface ConfigXRFLineMapper extends BaseMapperX<ConfigXRFLineDO> {
.orderByDesc(ConfigXRFLineDO::getId)); .orderByDesc(ConfigXRFLineDO::getId));
} }
default List<ConfigXRFLineDO> selectByDeviceNo(String deviceNo) {
return selectList(new LambdaQueryWrapperX<ConfigXRFLineDO>()
.eq(ConfigXRFLineDO::getDeviceNo, deviceNo)
.eq(ConfigXRFLineDO::getIsUse, QmsCommonConstant.YES));
}
default ConfigXRFLineDO selectByDeviceNoAndLineName(String deviceNo, String lineName) {
return selectOne(new LambdaQueryWrapperX<ConfigXRFLineDO>()
.eq(ConfigXRFLineDO::getDeviceNo, deviceNo)
.eq(ConfigXRFLineDO::getLineName, lineName)
.eq(ConfigXRFLineDO::getIsUse, QmsCommonConstant.YES));
}
} }

View File

@@ -34,4 +34,9 @@ public interface ConfigXRFProjectMapper extends BaseMapperX<ConfigXRFProjectDO>
.orderByDesc(ConfigXRFProjectDO::getId)); .orderByDesc(ConfigXRFProjectDO::getId));
} }
default List<ConfigXRFProjectDO> selectByDeviceNo(String deviceNo) {
return selectList(new LambdaQueryWrapperX<ConfigXRFProjectDO>()
.eq(ConfigXRFProjectDO::getDeviceNo, deviceNo));
}
} }

View File

@@ -0,0 +1,42 @@
package com.zt.plat.module.qms.thirdpartyapi.controller.admin;
import java.util.List;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.zt.plat.framework.common.pojo.CommonResult;
import com.zt.plat.module.qms.business.config.controller.vo.ConfigXRFLineRespVO;
import com.zt.plat.module.qms.thirdpartyapi.controller.vo.*;
import com.zt.plat.module.qms.thirdpartyapi.service.XRFDataService;
import cn.hutool.core.collection.CollUtil;
import jakarta.annotation.Resource;
@RestController
@RequestMapping("/qms/thirdpartyapi/xrf-data")
public class XRFDataController {
@Resource
private XRFDataService xrfDataService;
@GetMapping("/xrf-line-list")
public CommonResult<?> getXrfLineList(@RequestParam("deviceNo") String deviceNo) {
List<ConfigXRFLineRespVO> list = xrfDataService.getXrfLineList(deviceNo);
return CommonResult.success(list);
}
@PostMapping("/submit-xrf-data")
public CommonResult<?> submitXrfData(@RequestBody List<XRFDeviceSampleReqVO> reqList) {
if (CollUtil.isEmpty(reqList)) {
return CommonResult.error(1_032_001_000, "请求参数不允许为空");
}
int count = xrfDataService.submitXrfData(reqList);
return CommonResult.success(count);
}
}

View File

@@ -0,0 +1,36 @@
package com.zt.plat.module.qms.thirdpartyapi.controller.vo;
import java.io.Serializable;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
public class XRFDeviceSampleProjectReqVO implements Serializable {
private static final long serialVersionUID = 6853465669006150205L;
/**
* 检测项目名称
*/
@Schema(description = "检测项目名称")
private String xRFProjectName;
/**
* 检测项目单位
*/
@Schema(description = "检测项目单位")
private String xRFProjectUnit;
/**
* 检测项目值
*/
@Schema(description = "检测项目值")
private String xRFProjectValue;
/**
* 小数位数
*/
@Schema(description = "小数位数")
private Integer valueDecimals;
}

View File

@@ -0,0 +1,68 @@
package com.zt.plat.module.qms.thirdpartyapi.controller.vo;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;
import org.springframework.format.annotation.DateTimeFormat;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
public class XRFDeviceSampleReqVO implements Serializable {
private static final long serialVersionUID = 3173676626377747618L;
/**
* 设备编号
*/
@Schema(description = "设备编号")
private String deviceNo;
/**
* 分析线
*/
@Schema(description = "分析线")
private String lineName;
/**
* 样品id
*/
@Schema(description = "样品id")
private String sampleId;
/**
* 样品编号
*/
@Schema(description = "样品编号")
private String sampleCode;
/**
* 样品时间
*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Schema(description = "样品时间")
private LocalDateTime sampleTime;
/**
* 分析人
*/
@Schema(description = "分析人")
private String assayOper;
/**
* 分析项目
*/
@Schema(description = "分析项目")
private List<XRFDeviceSampleProjectReqVO> sampleProjects;
/**
* 是否为检查上传
*/
@Schema(description = "是否为检查上传")
private Boolean isCheck;
}

View File

@@ -0,0 +1,16 @@
package com.zt.plat.module.qms.thirdpartyapi.service;
import java.util.List;
import com.zt.plat.module.qms.business.config.controller.vo.ConfigXRFLineRespVO;
import com.zt.plat.module.qms.thirdpartyapi.controller.vo.XRFDeviceSampleReqVO;
public interface XRFDataService {
List<ConfigXRFLineRespVO> getXrfLineList(String deviceNo);
int submitXrfData(List<XRFDeviceSampleReqVO> reqList);
}

View File

@@ -0,0 +1,237 @@
package com.zt.plat.module.qms.thirdpartyapi.service;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.alibaba.fastjson2.JSON;
import com.zt.plat.framework.common.util.object.BeanUtils;
import com.zt.plat.module.qms.business.bus.controller.vo.*;
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessAssayProjectDataDO;
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessAssayTaskDataDO;
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessXRFDataDO;
import com.zt.plat.module.qms.business.bus.dal.mapper.BusinessAssayProjectDataMapper;
import com.zt.plat.module.qms.business.bus.dal.mapper.BusinessAssayTaskDataMapper;
import com.zt.plat.module.qms.business.bus.dal.mapper.BusinessXRFDataMapper;
import com.zt.plat.module.qms.business.config.controller.vo.*;
import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigXRFConversionRateDO;
import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigXRFLineDO;
import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigXRFProjectDO;
import com.zt.plat.module.qms.business.config.dal.mapper.ConfigAssayMethodProjectMapper;
import com.zt.plat.module.qms.business.config.dal.mapper.ConfigXRFConversionRateMapper;
import com.zt.plat.module.qms.business.config.dal.mapper.ConfigXRFLineMapper;
import com.zt.plat.module.qms.business.config.dal.mapper.ConfigXRFProjectMapper;
import com.zt.plat.module.qms.enums.QmsCommonConstant;
import com.zt.plat.module.qms.thirdpartyapi.controller.vo.*;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
@Slf4j
@Service
public class XRFDataServiceImpl implements XRFDataService {
@Resource
private ConfigXRFLineMapper configXRFLineMapper;
@Resource
private ConfigXRFProjectMapper configXRFProjectMapper;
@Resource
private ConfigXRFConversionRateMapper configXRFConversionRateMapper;
@Resource
private ConfigAssayMethodProjectMapper configAssayMethodProjectMapper;
@Resource
private BusinessXRFDataMapper businessXRFDataMapper;
@Resource
private BusinessAssayTaskDataMapper businessAssayTaskDataMapper;
@Resource
private BusinessAssayProjectDataMapper businessAssayProjectDataMapper;
@Override
public List<ConfigXRFLineRespVO> getXrfLineList(String deviceNo) {
List<ConfigXRFLineDO> list = configXRFLineMapper.selectByDeviceNo(deviceNo);
return BeanUtils.toBean(list, ConfigXRFLineRespVO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public int submitXrfData(List<XRFDeviceSampleReqVO> reqList) {
Map<String, List<XRFDeviceSampleReqVO>> reqLineMap = reqList.stream().collect(Collectors.groupingBy(XRFDeviceSampleReqVO::getLineName));
for (Map.Entry<String, List<XRFDeviceSampleReqVO>> entry : reqLineMap.entrySet()) {
String lineName = entry.getKey();
List<XRFDeviceSampleReqVO> xrfDeviceSampleList = entry.getValue();
XRFDeviceSampleReqVO xrfDeviceSampleFirst = xrfDeviceSampleList.get(0);
//获取最大时间
LocalDateTime maxSampleTime = xrfDeviceSampleList.stream().max(Comparator.comparing(XRFDeviceSampleReqVO::getSampleTime)).map(XRFDeviceSampleReqVO::getSampleTime).get();
//获取荧光样品id列表
List<String> sampleIdList = xrfDeviceSampleList.stream().map(XRFDeviceSampleReqVO::getSampleId).collect(Collectors.toList());
//查询数据库是否已保存了荧光数据
BusinessXRFDataReqVO existXRFDataSearch = new BusinessXRFDataReqVO();
existXRFDataSearch.setDeviceNo(xrfDeviceSampleFirst.getDeviceNo());
existXRFDataSearch.setLineName(lineName);
existXRFDataSearch.setXRFSampleIdList(sampleIdList);
List<BusinessXRFDataDO> existBusYgDataList = businessXRFDataMapper.selectList(existXRFDataSearch);
//已存在数据库中的样品id
List<String> existSampleIdList = new ArrayList<>();
for (BusinessXRFDataDO qmsBusYgData : existBusYgDataList) {
existSampleIdList.add(qmsBusYgData.getXRFSampleId());
}
//根据设备编号查询荧光元素配置
List<ConfigXRFProjectDO> conYgElementList = configXRFProjectMapper.selectByDeviceNo(xrfDeviceSampleFirst.getDeviceNo());
List<BusinessAssayTaskDataDO> businessAssayTaskDataDOList = new ArrayList<>();
List<BusinessAssayProjectDataDO> busElementValueList = new ArrayList<>();
List<BusinessXRFDataDO> busYgDataList = new ArrayList<>();
BusinessXRFDataDO busYgData = null;
for (XRFDeviceSampleReqVO ygDeviceSample : xrfDeviceSampleList) {
if (existSampleIdList.contains(ygDeviceSample.getSampleId())) {
continue;
}
//分析元素
List<XRFDeviceSampleProjectReqVO> sampleElements = ygDeviceSample.getSampleProjects();
if (sampleElements == null) {
log.info("分析元素为空!", JSON.toJSONString(ygDeviceSample));
continue;
}
busYgData = new BusinessXRFDataDO();
busYgData.setDeviceNo(ygDeviceSample.getDeviceNo());
busYgData.setLineName(ygDeviceSample.getLineName());
busYgData.setXRFSampleId(ygDeviceSample.getSampleId());
busYgData.setSampleCode(ygDeviceSample.getSampleCode());
busYgData.setSampleTime(ygDeviceSample.getSampleTime());
busYgData.setAssayOperator(ygDeviceSample.getAssayOper());
busYgData.setIsCheckCreate(ygDeviceSample.getIsCheck() ? 1 : 0);
//处理匹配
List<BusinessAssayProjectDataExtendRespVO> tempBusElementValueList = new ArrayList<>();
BusinessAssayTaskDataExtendRespVO businessAssayTaskData = businessAssayTaskDataMapper.selectBySampleCode(ygDeviceSample.getSampleCode());
if (businessAssayTaskData != null) {
List<BusinessAssayProjectDataExtendRespVO> busElementValues = businessAssayProjectDataMapper.selectByBusinessAssayTaskDataId(businessAssayTaskData.getId());
tempBusElementValueList.addAll(busElementValues);
}
//分析元素
for (XRFDeviceSampleProjectReqVO ygDeviceSampleElement : sampleElements) {
//如果设备上来的元素值为空,则跳过继续
if (ygDeviceSampleElement.getXRFProjectValue() == null) {
continue;
}
//查询是否有特殊转换率
// QmsConYgConverRate conYgConverRate = conYgConverRateService.getOne(Wrappers.<QmsConYgConverRate>query().lambda().eq(QmsConYgConverRate::getDeviceNo, ygDeviceSample.getDeviceNo())
// .eq(QmsConYgConverRate::getLineName, ygDeviceSample.getLineName()).eq(QmsConYgConverRate::getElementName, ygDeviceSampleElement.getElementName()));
ConfigXRFConversionRateDO conYgConverRate = configXRFConversionRateMapper.selectBy(ygDeviceSample.getDeviceNo(), ygDeviceSample.getLineName(), ygDeviceSampleElement.getXRFProjectName());
ConfigXRFProjectDO conYgElement = null;
if(conYgConverRate != null && conYgConverRate.getConversionRate() != null) {
conYgElement = conYgElementList.stream().filter(f -> f.getXRFProjectName().equals(ygDeviceSampleElement.getXRFProjectName()) && f.getConversionRate().equals(conYgConverRate.getConversionRate())).findFirst().orElse(null);
} else {
conYgElement = conYgElementList.stream().filter(f -> f.getXRFProjectName().equals(ygDeviceSampleElement.getXRFProjectName()) && (StringUtils.isBlank(f.getXRFProjectUnit()) || StringUtils.isBlank(ygDeviceSampleElement.getXRFProjectUnit()) || f.getXRFProjectUnit().equals(ygDeviceSampleElement.getXRFProjectUnit()))).findFirst().orElse(null);
}
if(conYgElement != null) {
//数据转换
BigDecimal elementValue = BigDecimal.ZERO;
Integer conYgElementDataType = 0;
if(conYgConverRate != null && conYgConverRate.getConversionRate() != null) {
BigDecimal convertRate = new BigDecimal(conYgConverRate.getConversionRate().toString());
elementValue = new BigDecimal(ygDeviceSampleElement.getXRFProjectValue()).multiply(convertRate);
} else {
BigDecimal convertRate = new BigDecimal(conYgElement.getConversionRate().toString());
elementValue = new BigDecimal(ygDeviceSampleElement.getXRFProjectValue()).multiply(convertRate);
}
if(elementValue.compareTo(BigDecimal.ZERO) < 0) {
elementValue = BigDecimal.ZERO;
}
if(conYgElement.getDataType() != null && "decimal".equals(conYgElement.getDataType())) {
conYgElementDataType = conYgElement.getDecimalPosition();
}
Long elementId = conYgElement.getDictionaryProjectId();
BusinessAssayProjectDataExtendRespVO busElementValue = tempBusElementValueList.stream().filter(f -> f.getDictionaryProjectId().equals(elementId) && f.getIsEnabled().equals(1)).findFirst().orElse(null);
if (busElementValue != null) {
//化验数据小数精度四舍六入五单双
if("decimal".equals(busElementValue.getDataType())) {
busElementValue.setValue(elementValue.setScale(busElementValue.getDecimalPosition(), RoundingMode.HALF_EVEN).toPlainString());
} else {
busElementValue.setValue(elementValue.setScale(conYgElementDataType, RoundingMode.HALF_EVEN).toPlainString());
}
busElementValue.setRemark(conYgElement.getShowName() + ": " + busElementValue.getValue());
busElementValueList.add(BeanUtils.toBean(busElementValue, BusinessAssayProjectDataDO.class));
}
// if(conYgElementDataType != null && conYgElementDataType.intValue() > -1) {
// BeanUtil.setFieldValue(busYgData, conYgElement.getSaveColumn(), elementValue.setScale(conYgElementDataType, BigDecimal.ROUND_HALF_EVEN).toPlainString());//数据格式化-四舍六入五单双
// } else {
// BeanUtil.setFieldValue(busYgData, conYgElement.getSaveColumn(), elementValue);
// }
}
}
//循环元素修改流程节点
for (BusinessAssayProjectDataExtendRespVO busElementValue : tempBusElementValueList) {
boolean match = busElementValueList.stream().anyMatch(m -> m.getId().equals(busElementValue.getId()));
if (!match) {//已经添加过的,不再添加
busElementValueList.add(BeanUtils.toBean(busElementValue, BusinessAssayProjectDataDO.class));
}
}
if (businessAssayTaskData != null) {
busYgData.setIsMatched(QmsCommonConstant.YES);
busYgData.setBusinessBaseSampleId(businessAssayTaskData.getBusinessBaseSampleId());
busYgData.setBusinessSubParentSampleId(businessAssayTaskData.getBusinessSubParentSampleId());
busYgData.setBusinessSubSampleId(businessAssayTaskData.getBusinessSubSampleId());
busYgData.setBusinessAssayTaskDataId(businessAssayTaskData.getId());
businessAssayTaskDataDOList.add(BeanUtils.toBean(businessAssayTaskData, BusinessAssayTaskDataDO.class));
}
busYgDataList.add(busYgData);
}
//查询荧光分析线配置
ConfigXRFLineDO conYgLine = configXRFLineMapper.selectByDeviceNoAndLineName(xrfDeviceSampleFirst.getDeviceNo(), lineName);
if (xrfDeviceSampleFirst.getIsCheck()) {
conYgLine.setLastCheckDataTime(maxSampleTime);
} else {
conYgLine.setLastSynchronousDataTime(maxSampleTime);
}
//更新配置时间
configXRFLineMapper.updateById(conYgLine);
if (busYgDataList.size() > 0) {
//保存荧光数据
businessXRFDataMapper.insertBatch(busYgDataList);
//更新分样子样
// if(businessAssayTaskDataDOs.size() > 0) {
// busSubCsampleService.updateBatchById(businessAssayTaskDataDOs);
// }
//更新分析结果
if (busElementValueList.size() > 0) {
businessAssayProjectDataMapper.updateBatch(busElementValueList);
}
}
}
return reqList.size();
}
}