样品收样处理
This commit is contained in:
@@ -164,8 +164,8 @@ public class BusinessSubSampleController implements BusinessControllerMarker {
|
|||||||
@GetMapping("/getBySampleCodeAndFlowKey")
|
@GetMapping("/getBySampleCodeAndFlowKey")
|
||||||
@Operation(summary = "根据样品编号及样品流程节点key获取样品信息")
|
@Operation(summary = "根据样品编号及样品流程节点key获取样品信息")
|
||||||
public CommonResult<?> getBySampleCodeAndFlowKey(@Valid BusinessSubSampleReqVO reqVO) {
|
public CommonResult<?> getBySampleCodeAndFlowKey(@Valid BusinessSubSampleReqVO reqVO) {
|
||||||
BusinessSubSampleExtendRespVO result = businessSubSampleService.getBySampleCodeAndFlowKey(reqVO);
|
List<BusinessSubSampleExtendRespVO> resultList = businessSubSampleService.getBySampleCodeAndFlowKey(reqVO);
|
||||||
return success(result);
|
return success(resultList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/export-excel")
|
@GetMapping("/export-excel")
|
||||||
|
|||||||
@@ -222,8 +222,8 @@ public interface BusinessSubSampleMapper extends BaseMapperX<BusinessSubSampleDO
|
|||||||
.orderByDesc(BusinessSubSampleDO::getId));
|
.orderByDesc(BusinessSubSampleDO::getId));
|
||||||
}
|
}
|
||||||
|
|
||||||
default BusinessSubSampleExtendRespVO getBySampleCode(BusinessSubSampleReqVO reqVO) {
|
default List<BusinessSubSampleExtendRespVO> getBySampleCode(BusinessSubSampleReqVO reqVO) {
|
||||||
return selectJoinOne(BusinessSubSampleExtendRespVO.class, new MPJLambdaWrapperX<BusinessSubSampleDO>()
|
return selectJoinList(BusinessSubSampleExtendRespVO.class, new MPJLambdaWrapperX<BusinessSubSampleDO>()
|
||||||
.leftJoin(DictionaryBusinessDO.class, DictionaryBusinessDO::getId, BusinessSubSampleDO::getDictionaryBusinessId)
|
.leftJoin(DictionaryBusinessDO.class, DictionaryBusinessDO::getId, BusinessSubSampleDO::getDictionaryBusinessId)
|
||||||
.leftJoin(ConfigSubSampleDO.class, ConfigSubSampleDO::getId, BusinessSubSampleDO::getConfigSubSampleId)
|
.leftJoin(ConfigSubSampleDO.class, ConfigSubSampleDO::getId, BusinessSubSampleDO::getConfigSubSampleId)
|
||||||
.selectAll(BusinessSubSampleDO.class)
|
.selectAll(BusinessSubSampleDO.class)
|
||||||
@@ -236,8 +236,8 @@ public interface BusinessSubSampleMapper extends BaseMapperX<BusinessSubSampleDO
|
|||||||
.orderByDesc(BusinessSubSampleDO::getId));
|
.orderByDesc(BusinessSubSampleDO::getId));
|
||||||
}
|
}
|
||||||
|
|
||||||
default BusinessSubSampleExtendRespVO getBySampleCodeAndFlowKey(BusinessSubSampleReqVO reqVO) {
|
default List<BusinessSubSampleExtendRespVO> getBySampleCodeAndFlowKey(BusinessSubSampleReqVO reqVO) {
|
||||||
return selectJoinOne(BusinessSubSampleExtendRespVO.class, new MPJLambdaWrapperX<BusinessSubSampleDO>()
|
return selectJoinList(BusinessSubSampleExtendRespVO.class, new MPJLambdaWrapperX<BusinessSubSampleDO>()
|
||||||
.leftJoin(DictionaryBusinessDO.class, DictionaryBusinessDO::getId, BusinessSubSampleDO::getDictionaryBusinessId)
|
.leftJoin(DictionaryBusinessDO.class, DictionaryBusinessDO::getId, BusinessSubSampleDO::getDictionaryBusinessId)
|
||||||
.leftJoin(ConfigSubSampleDO.class, ConfigSubSampleDO::getId, BusinessSubSampleDO::getConfigSubSampleId)
|
.leftJoin(ConfigSubSampleDO.class, ConfigSubSampleDO::getId, BusinessSubSampleDO::getConfigSubSampleId)
|
||||||
.selectAll(BusinessSubSampleDO.class)
|
.selectAll(BusinessSubSampleDO.class)
|
||||||
|
|||||||
@@ -213,6 +213,13 @@ public class SampleEntrustGenSampleDataCmp extends NodeComponent {
|
|||||||
LocalDateTime currentDateTime = sampleEntrustContext.getCurrentDateTime();
|
LocalDateTime currentDateTime = sampleEntrustContext.getCurrentDateTime();
|
||||||
//样品委托登记
|
//样品委托登记
|
||||||
BusinessSampleEntrustRegistrationDO sampleEntrustRegistration = sampleEntrustContext.getSampleEntrustRegistration();
|
BusinessSampleEntrustRegistrationDO sampleEntrustRegistration = sampleEntrustContext.getSampleEntrustRegistration();
|
||||||
|
//扩展信息
|
||||||
|
String sampleEntrustRegistrationExtInfo = sampleEntrustRegistration.getExternalInfomation();
|
||||||
|
JSONObject sampleEntrustRegistrationJsonObject = null;
|
||||||
|
if (StringUtils.isNotBlank(sampleEntrustRegistrationExtInfo)) {
|
||||||
|
sampleEntrustRegistrationJsonObject = JSON.parseObject(sampleEntrustRegistrationExtInfo);
|
||||||
|
}
|
||||||
|
|
||||||
//样品委托登记明细
|
//样品委托登记明细
|
||||||
List<BusinessSampleEntrustDetailDO> sampleEntrustDetailList = sampleEntrustContext.getSampleEntrustDetailList();
|
List<BusinessSampleEntrustDetailDO> sampleEntrustDetailList = sampleEntrustContext.getSampleEntrustDetailList();
|
||||||
//样品检测项目
|
//样品检测项目
|
||||||
@@ -427,6 +434,7 @@ public class SampleEntrustGenSampleDataCmp extends NodeComponent {
|
|||||||
businessSubSampleDO.setSampleFlowNodeKey(sampleFlowNodeSub.getNodeKey());
|
businessSubSampleDO.setSampleFlowNodeKey(sampleFlowNodeSub.getNodeKey());
|
||||||
businessSubSampleDO.setSampleFlowNodeTime(currentDateTime);
|
businessSubSampleDO.setSampleFlowNodeTime(currentDateTime);
|
||||||
businessSubSampleDO.setNextSampleFlowNode(sampleFlowNodeSub.getNextFlowNodeName());
|
businessSubSampleDO.setNextSampleFlowNode(sampleFlowNodeSub.getNextFlowNodeName());
|
||||||
|
businessSubSampleDO.setRemark(sampleEntrustRegistrationJsonObject.getString("sampleCategory"));//子样备注设置样品类型
|
||||||
|
|
||||||
businessSubSampleDOList.add(businessSubSampleDO);
|
businessSubSampleDOList.add(businessSubSampleDO);
|
||||||
|
|
||||||
@@ -492,7 +500,7 @@ public class SampleEntrustGenSampleDataCmp extends NodeComponent {
|
|||||||
|
|
||||||
//如果是商检样分析,且为第一个商检分析样,并且包含要检测的项目,
|
//如果是商检样分析,且为第一个商检分析样,并且包含要检测的项目,
|
||||||
if (QmsCommonConstant.ENTRUST_INSPECTION_ANALYSIS_SAMPLE.equals(baseSampleDO.getDictionaryBusinessKey()) && isAssayConditionProjectList && sjfxyOne == 0) {
|
if (QmsCommonConstant.ENTRUST_INSPECTION_ANALYSIS_SAMPLE.equals(baseSampleDO.getDictionaryBusinessKey()) && isAssayConditionProjectList && sjfxyOne == 0) {
|
||||||
addAssayTask(currentDateTime, configSubSampleMethodList, configAssayMethodProjectList,
|
addAssayTask(currentDateTime, sampleEntrustRegistrationJsonObject, configSubSampleMethodList, configAssayMethodProjectList,
|
||||||
configAssayMethodProjectParameterList, dictionaryProjectList,
|
configAssayMethodProjectParameterList, dictionaryProjectList,
|
||||||
businessSubParentSampleAssessmentDOList, businessSubSampleAnalysisGroupDOList,
|
businessSubParentSampleAssessmentDOList, businessSubSampleAnalysisGroupDOList,
|
||||||
businessSubSampleAssessmentDOList, businessAssayTaskDataDOList,
|
businessSubSampleAssessmentDOList, businessAssayTaskDataDOList,
|
||||||
@@ -500,7 +508,7 @@ public class SampleEntrustGenSampleDataCmp extends NodeComponent {
|
|||||||
configSampleFlowSub, sampleFlowNodeSub, businessSubSampleDO, methodId,
|
configSampleFlowSub, sampleFlowNodeSub, businessSubSampleDO, methodId,
|
||||||
projectIdList, configAssayMethodParameterList, businessAssayTaskParameterDataDOList);
|
projectIdList, configAssayMethodParameterList, businessAssayTaskParameterDataDOList);
|
||||||
} else if (QmsCommonConstant.ENTRUST_COMPREHENSIVE_INSPECTION_SAMPLE.equals(baseSampleDO.getDictionaryBusinessKey()) && isAssayConditionProjectList) {//如果是商检综合样,并且包含需检查的项目
|
} else if (QmsCommonConstant.ENTRUST_COMPREHENSIVE_INSPECTION_SAMPLE.equals(baseSampleDO.getDictionaryBusinessKey()) && isAssayConditionProjectList) {//如果是商检综合样,并且包含需检查的项目
|
||||||
addAssayTask(currentDateTime, configSubSampleMethodList, configAssayMethodProjectList,
|
addAssayTask(currentDateTime, sampleEntrustRegistrationJsonObject, configSubSampleMethodList, configAssayMethodProjectList,
|
||||||
configAssayMethodProjectParameterList, dictionaryProjectList,
|
configAssayMethodProjectParameterList, dictionaryProjectList,
|
||||||
businessSubParentSampleAssessmentDOList, businessSubSampleAnalysisGroupDOList,
|
businessSubParentSampleAssessmentDOList, businessSubSampleAnalysisGroupDOList,
|
||||||
businessSubSampleAssessmentDOList, businessAssayTaskDataDOList,
|
businessSubSampleAssessmentDOList, businessAssayTaskDataDOList,
|
||||||
@@ -509,7 +517,7 @@ public class SampleEntrustGenSampleDataCmp extends NodeComponent {
|
|||||||
projectIdList, configAssayMethodParameterList, businessAssayTaskParameterDataDOList);
|
projectIdList, configAssayMethodParameterList, businessAssayTaskParameterDataDOList);
|
||||||
|
|
||||||
} else if (QmsCommonConstant.ENTRUST_COMMISSION_INSPECTION_SAMPLE.equals(baseSampleDO.getDictionaryBusinessKey()) && isAssayConditionProjectList && !isForecastS ) {//如果是委检样,包含检测项目,未预报S值
|
} else if (QmsCommonConstant.ENTRUST_COMMISSION_INSPECTION_SAMPLE.equals(baseSampleDO.getDictionaryBusinessKey()) && isAssayConditionProjectList && !isForecastS ) {//如果是委检样,包含检测项目,未预报S值
|
||||||
addAssayTask(currentDateTime, configSubSampleMethodList, configAssayMethodProjectList,
|
addAssayTask(currentDateTime, sampleEntrustRegistrationJsonObject, configSubSampleMethodList, configAssayMethodProjectList,
|
||||||
configAssayMethodProjectParameterList, dictionaryProjectList,
|
configAssayMethodProjectParameterList, dictionaryProjectList,
|
||||||
businessSubParentSampleAssessmentDOList, businessSubSampleAnalysisGroupDOList,
|
businessSubParentSampleAssessmentDOList, businessSubSampleAnalysisGroupDOList,
|
||||||
businessSubSampleAssessmentDOList, businessAssayTaskDataDOList,
|
businessSubSampleAssessmentDOList, businessAssayTaskDataDOList,
|
||||||
@@ -615,6 +623,10 @@ public class SampleEntrustGenSampleDataCmp extends NodeComponent {
|
|||||||
businessAssayTaskParameterDataDO.setValue(configAssayMethodParameterDO.getDefaultValue());
|
businessAssayTaskParameterDataDO.setValue(configAssayMethodParameterDO.getDefaultValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (StringUtils.isNotBlank(sampleEntrustRegistrationJsonObject.getString("sampleCategory")) && "remark".equals(configAssayMethodParameterDO.getKey())) {
|
||||||
|
businessAssayTaskParameterDataDO.setValue(sampleEntrustRegistrationJsonObject.getString("sampleCategory"));//任务参数备注赋值样品类型
|
||||||
|
}
|
||||||
|
|
||||||
//来样品位赋值
|
//来样品位赋值
|
||||||
if (getParamList != null) {
|
if (getParamList != null) {
|
||||||
List<String> targetAttributeList = getParamList.stream().filter(f -> StringUtils.isNotBlank(f.getTarget().getAttribute()) && f.getTarget().getAttribute().contains(configAssayMethodParameterDO.getKey())).map(m -> m.getTarget().getAttribute()).collect(Collectors.toList());
|
List<String> targetAttributeList = getParamList.stream().filter(f -> StringUtils.isNotBlank(f.getTarget().getAttribute()) && f.getTarget().getAttribute().contains(configAssayMethodParameterDO.getKey())).map(m -> m.getTarget().getAttribute()).collect(Collectors.toList());
|
||||||
@@ -688,6 +700,10 @@ public class SampleEntrustGenSampleDataCmp extends NodeComponent {
|
|||||||
businessAssayParameterDataDO.setValue(configAssayMethodProjectParameterDO.getDefaultValue());
|
businessAssayParameterDataDO.setValue(configAssayMethodProjectParameterDO.getDefaultValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (StringUtils.isNotBlank(sampleEntrustRegistrationJsonObject.getString("sampleCategory")) && "remark".equals(configAssayMethodProjectParameterDO.getKey())) {
|
||||||
|
businessAssayParameterDataDO.setValue(sampleEntrustRegistrationJsonObject.getString("sampleCategory"));//任务参数备注赋值样品类型
|
||||||
|
}
|
||||||
|
|
||||||
//来样品位赋值
|
//来样品位赋值
|
||||||
if (getParamList != null) {
|
if (getParamList != null) {
|
||||||
List<String> targetParameterList = getParamList.stream().filter(f -> StringUtils.isNotBlank(f.getTarget().getProject()) && f.getTarget().getProject().contains(configAssayMethodProjectDO.getSimpleName())).map(m -> m.getTarget().getParameter()).collect(Collectors.toList());
|
List<String> targetParameterList = getParamList.stream().filter(f -> StringUtils.isNotBlank(f.getTarget().getProject()) && f.getTarget().getProject().contains(configAssayMethodProjectDO.getSimpleName())).map(m -> m.getTarget().getParameter()).collect(Collectors.toList());
|
||||||
@@ -922,7 +938,7 @@ public class SampleEntrustGenSampleDataCmp extends NodeComponent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addAssayTask(LocalDateTime currentDateTime, List<ConfigSubSampleMethodExtendRespVO> configSubSampleMethodList,
|
private void addAssayTask(LocalDateTime currentDateTime, JSONObject sampleEntrustRegistrationJsonObject, List<ConfigSubSampleMethodExtendRespVO> configSubSampleMethodList,
|
||||||
List<ConfigAssayMethodProjectExtendRespVO> configAssayMethodProjectList,
|
List<ConfigAssayMethodProjectExtendRespVO> configAssayMethodProjectList,
|
||||||
List<ConfigAssayMethodProjectParameterDO> configAssayMethodProjectParameterList,
|
List<ConfigAssayMethodProjectParameterDO> configAssayMethodProjectParameterList,
|
||||||
List<DictionaryProjectDO> dictionaryProjectList,
|
List<DictionaryProjectDO> dictionaryProjectList,
|
||||||
@@ -1042,6 +1058,9 @@ public class SampleEntrustGenSampleDataCmp extends NodeComponent {
|
|||||||
if (StringUtils.isNotBlank(configAssayMethodParameterDO.getDefaultValue())) {
|
if (StringUtils.isNotBlank(configAssayMethodParameterDO.getDefaultValue())) {
|
||||||
businessAssayTaskParameterDataDO.setValue(configAssayMethodParameterDO.getDefaultValue());
|
businessAssayTaskParameterDataDO.setValue(configAssayMethodParameterDO.getDefaultValue());
|
||||||
}
|
}
|
||||||
|
if (StringUtils.isNotBlank(sampleEntrustRegistrationJsonObject.getString("sampleCategory")) && "remark".equals(configAssayMethodParameterDO.getKey())) {
|
||||||
|
businessAssayTaskParameterDataDO.setValue(sampleEntrustRegistrationJsonObject.getString("sampleCategory"));//任务参数备注赋值样品类型
|
||||||
|
}
|
||||||
|
|
||||||
businessAssayTaskParameterDataDOList.add(businessAssayTaskParameterDataDO);
|
businessAssayTaskParameterDataDOList.add(businessAssayTaskParameterDataDO);
|
||||||
}
|
}
|
||||||
@@ -1100,6 +1119,9 @@ public class SampleEntrustGenSampleDataCmp extends NodeComponent {
|
|||||||
businessAssayParameterDataDO.setValue(configAssayMethodProjectParameterDO.getDefaultValue());
|
businessAssayParameterDataDO.setValue(configAssayMethodProjectParameterDO.getDefaultValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (StringUtils.isNotBlank(sampleEntrustRegistrationJsonObject.getString("sampleCategory")) && "remark".equals(configAssayMethodProjectParameterDO.getKey())) {
|
||||||
|
businessAssayParameterDataDO.setValue(sampleEntrustRegistrationJsonObject.getString("sampleCategory"));//任务参数备注赋值样品类型
|
||||||
|
}
|
||||||
|
|
||||||
businessAssayParameterDataDOList.add(businessAssayParameterDataDO);
|
businessAssayParameterDataDOList.add(businessAssayParameterDataDO);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ public interface BusinessSubSampleService {
|
|||||||
* @param reqVO
|
* @param reqVO
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
BusinessSubSampleExtendRespVO getBySampleCodeAndFlowKey(@Valid BusinessSubSampleReqVO reqVO);
|
List<BusinessSubSampleExtendRespVO> getBySampleCodeAndFlowKey(@Valid BusinessSubSampleReqVO reqVO);
|
||||||
|
|
||||||
//样品归库
|
//样品归库
|
||||||
BusinessSubSampleRespVO execReturnToStock(@Valid BusinessSubSampleSaveReqVO reqVo);
|
BusinessSubSampleRespVO execReturnToStock(@Valid BusinessSubSampleSaveReqVO reqVo);
|
||||||
|
|||||||
@@ -234,23 +234,28 @@ public class BusinessSubSampleServiceImpl implements BusinessSubSampleService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BusinessSubSampleExtendRespVO getBySampleCodeAndFlowKey(@Valid BusinessSubSampleReqVO reqVO) {
|
public List<BusinessSubSampleExtendRespVO> getBySampleCodeAndFlowKey(@Valid BusinessSubSampleReqVO reqVO) {
|
||||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||||
BusinessSubSampleExtendRespVO subSample = null;
|
|
||||||
|
List<BusinessSubSampleExtendRespVO> subSampleList = new ArrayList<>();
|
||||||
if (QmsCommonConstant.FLOW_NODE_TEAM_RECEIVE.equals(reqVO.getSampleFlowNodeKey())) {
|
if (QmsCommonConstant.FLOW_NODE_TEAM_RECEIVE.equals(reqVO.getSampleFlowNodeKey())) {
|
||||||
subSample = businessSubSampleMapper.getBySampleCode(reqVO);
|
// List<BusinessSubSampleExtendRespVO> sampleList = businessSubSampleMapper.getBySampleCode(reqVO);
|
||||||
if (subSample == null) {
|
List<BusinessSubSampleExtendRespVO> sampleList = businessSubSampleMapper.getBySampleCodeAndFlowKey(reqVO);
|
||||||
return subSample;
|
if (sampleList == null || sampleList.size() <= 0) {
|
||||||
|
return subSampleList;
|
||||||
|
}
|
||||||
|
for (BusinessSubSampleExtendRespVO sample : sampleList) {
|
||||||
|
List<BusinessSubSampleAnalysisGroupDO> businessSubSampleAnalysisGroupList = businessSubSampleAnalysisGroupMapper.selectByBusinessSubSampleId(sample.getId());
|
||||||
|
BusinessSubSampleAnalysisGroupDO receiveSample = businessSubSampleAnalysisGroupList.stream().filter(f -> "待收样".equals(f.getSampleStatus()) && f.getAssayDepartmentId().equals(loginUser.getVisitDeptId())).findFirst().orElse(null);
|
||||||
|
if (receiveSample != null) {
|
||||||
|
subSampleList.add(sample);
|
||||||
|
// throw new ServiceException(1_032_100_000, "当前样品不在" + loginUser.getVisitDeptName() + ",不允许收样!");
|
||||||
}
|
}
|
||||||
List<BusinessSubSampleAnalysisGroupDO> businessSubSampleAnalysisGroupList = businessSubSampleAnalysisGroupMapper.selectByBusinessSubSampleId(subSample.getId());
|
|
||||||
BusinessSubSampleAnalysisGroupDO receiveSample = businessSubSampleAnalysisGroupList.stream().filter(f -> f.getAssayDepartmentId().equals(loginUser.getVisitDeptId())).findFirst().orElse(null);
|
|
||||||
if (receiveSample == null) {
|
|
||||||
throw new ServiceException(1_032_100_000, "当前样品不在" + loginUser.getVisitDeptName() + ",不允许收样!");
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
subSample = businessSubSampleMapper.getBySampleCodeAndFlowKey(reqVO);
|
subSampleList = businessSubSampleMapper.getBySampleCodeAndFlowKey(reqVO);
|
||||||
}
|
}
|
||||||
return subSample;
|
return subSampleList;
|
||||||
}
|
}
|
||||||
|
|
||||||
//样品归库
|
//样品归库
|
||||||
|
|||||||
Reference in New Issue
Block a user