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