Merge remote-tracking branch 'origin/test' into test

This commit is contained in:
FCL
2026-02-04 18:21:51 +08:00
31 changed files with 1170 additions and 181 deletions

View File

@@ -71,6 +71,7 @@ public class SampleAnalysisController implements BusinessControllerMarker {
return success("成功");
}
//提交分析
@PostMapping("/submitSampleAnalysisByTaskId")
public CommonResult<?> submitSampleAnalysisByTaskId(Long businessAssayTaskId) {
sampleAnalysisService.submitSampleAnalysisByTaskId(businessAssayTaskId);

View File

@@ -17,6 +17,8 @@ public class AssayMethodProjectRespVO {
private String dictionaryProjectShowName;
private String assayType;
private Long configAssayMethodId;
private String configAssayMethodName;

View File

@@ -47,6 +47,9 @@ public class BusinessAssayTaskAnalysisSampleAndQcProjectRespVO {
@Schema(description = "是否配料,1-是0-否")
private Integer isIngredients;
@Schema(description = "配料方式,初始状态-initial、自动配料-automatic、人工配料-manual")
private String ingredientsWay;
@Schema(description = "配料状态,初始状态-initial、等待配料-in_progress、可提交-allow_submit", example = "2")
private String ingredientsStatus;

View File

@@ -44,4 +44,7 @@ public class BusinessAssayTaskDataExtendRespVO extends BusinessAssayTaskDataResp
private Integer asmtIsRecheck;
private String asmtReportedStatus;
@Schema(description = "配料信息")
private String ingredientInfo;
}

View File

@@ -374,9 +374,11 @@ public interface BusinessAssayTaskDataMapper extends BaseMapperX<BusinessAssayTa
*/
default List<BusinessAssayTaskDataExtendRespVO> selectExtendByBusinessAssayTaskId(Long businessAssayTaskId) {
return selectJoinList(BusinessAssayTaskDataExtendRespVO.class, new MPJLambdaWrapperX<BusinessAssayTaskDataDO>()
.leftJoin(BusinessSubSampleDO.class, BusinessSubSampleDO::getId, BusinessAssayTaskDataDO::getBusinessSubSampleId)
.leftJoin(BusinessBaseSampleDO.class, BusinessBaseSampleDO::getId, BusinessAssayTaskDataDO::getBusinessBaseSampleId)
.selectAll(BusinessAssayTaskDataDO.class)
.selectAs(BusinessBaseSampleDO::getConfigBaseSampleId, BusinessAssayTaskDataExtendRespVO::getConfigBaseSampleId)
.selectAs(BusinessSubSampleDO::getConfigSubSampleId, BusinessAssayTaskDataExtendRespVO::getConfigSubSampleId)
.eq(BusinessAssayTaskDataDO::getBusinessAssayTaskId, businessAssayTaskId));
}
@@ -390,6 +392,18 @@ public interface BusinessAssayTaskDataMapper extends BaseMapperX<BusinessAssayTa
.eq(BusinessAssayTaskDataDO::getBusinessSubSampleId, businessSubSampleId));
}
/**
* 根据子样及分析方法Key查询分析任务
* @param businessSubSampleId 子样id
* @param methodKey 分析方法key
* @return
*/
default List<BusinessAssayTaskDataDO> selectByBusinessSubSampleIdAndMethodKey(Long businessSubSampleId, String methodKey) {
String inSql = "SELECT tcam.ID FROM T_CFG_ASY_MTHD tcam WHERE tcam.DELETED = 0 AND tcam.DIC_BSN_KY = '" + methodKey + "'";
return selectList(new LambdaQueryWrapperX<BusinessAssayTaskDataDO>()
.eq(BusinessAssayTaskDataDO::getBusinessSubSampleId, businessSubSampleId)
.inSql(BusinessAssayTaskDataDO::getConfigAssayMethodId, inSql));
}
/**
* 根据子样及分析部门查询分析任务

View File

@@ -1,17 +1,30 @@
package com.zt.plat.module.qms.business.bus.service;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import com.zt.plat.module.qms.business.bus.controller.vo.*;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import java.util.*;
import java.util.stream.Collectors;
import com.zt.plat.module.qms.business.bus.controller.vo.*;
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessAssayTaskDataDO;
import com.zt.plat.module.qms.business.bus.dal.mapper.BusinessAssayParameterDataMapper;
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.config.controller.vo.ConfigSubSampleMethodConfInfo;
import com.zt.plat.module.qms.business.config.controller.vo.ConfigSubSampleMethodConfItem;
import com.zt.plat.module.qms.business.config.controller.vo.ConfigSubSampleMethodConfPoint;
import com.zt.plat.module.qms.business.config.controller.vo.ConfigSubSampleMethodExtendRespVO;
import com.zt.plat.module.qms.business.config.dal.mapper.ConfigSubSampleMethodMapper;
import com.zt.plat.framework.common.pojo.PageResult;
import com.alibaba.fastjson2.JSON;
import com.zt.plat.framework.common.pojo.PageParam;
import com.zt.plat.framework.common.util.object.BeanUtils;
import com.zt.plat.framework.security.core.LoginUser;
@@ -34,6 +47,15 @@ public class BusinessAssayTaskDataServiceImpl implements BusinessAssayTaskDataSe
@Resource
private BusinessAssayTaskDataMapper businessAssayTaskDataMapper;
@Resource
private BusinessAssayProjectDataMapper businessAssayProjectDataMapper;
@Resource
private BusinessAssayParameterDataMapper businessAssayParameterDataMapper;
@Resource
private ConfigSubSampleMethodMapper configSubSampleMethodMapper;
@Override
public BusinessAssayTaskDataRespVO createBusinessAssayTaskData(BusinessAssayTaskDataSaveReqVO createReqVO) {
@@ -100,12 +122,86 @@ public class BusinessAssayTaskDataServiceImpl implements BusinessAssayTaskDataSe
@Override
public List<BusinessAssayTaskDataExtendRespVO> getBusinessAssayTaskDataList(BusinessAssayTaskDataReqVO reqVO) {
return businessAssayTaskDataMapper.selectList(reqVO);
List<BusinessAssayTaskDataExtendRespVO> list = businessAssayTaskDataMapper.selectList(reqVO);
List<Long> configSubSampleIdList = list.stream().map(m -> m.getConfigSubSampleId()).collect(Collectors.toList());
List<ConfigSubSampleMethodExtendRespVO> configSubSampleMethodList = configSubSampleMethodMapper.selectByConfigSubSampleIdsAndConfigAssayMethodId(configSubSampleIdList, reqVO.getConfigAssayMethodId());
List<Long> businessAssayTaskDataIdList = list.stream().map(m -> m.getId()).collect(Collectors.toList());
//查询检测项目
List<BusinessAssayProjectDataExtendRespVO> businessAssayProjectDataList = businessAssayProjectDataMapper.selectByBusinessAssayTaskDataIds(businessAssayTaskDataIdList);
List<Long> businessAssayProjectDataIdList = businessAssayProjectDataList.stream().map(m -> m.getId()).collect(Collectors.toList());
//查询检测项目参数
List<BusinessAssayParameterDataExtendRespVO> businessAssayParameterDataList = businessAssayParameterDataMapper.selectExtendByBusinessAssayProjectDataIds(businessAssayProjectDataIdList);
for (BusinessAssayTaskDataExtendRespVO businessAssayTaskData : list) {
ConfigSubSampleMethodExtendRespVO configSubSampleMethod = configSubSampleMethodList.stream().filter(f -> f.getConfigSubSampleId().equals(businessAssayTaskData.getConfigSubSampleId()) && f.getConfigAssayMethodId().equals(businessAssayTaskData.getConfigAssayMethodId())).findFirst().orElse(null);
String configInfomation = configSubSampleMethod.getConfigInfomation();
if (StringUtils.isNotBlank(configInfomation)) {
ConfigSubSampleMethodConfInfo configSubSampleMethodConfInfo = JSON.parseObject(configInfomation, ConfigSubSampleMethodConfInfo.class);
List<ConfigSubSampleMethodConfItem> getParamList = configSubSampleMethodConfInfo.getGetParam();
StringBuilder ingredientInfoBuilder = new StringBuilder();
for (ConfigSubSampleMethodConfItem configSubSampleMethodConfItem : getParamList) {
ConfigSubSampleMethodConfPoint target = configSubSampleMethodConfItem.getTarget();
List<String> projectList = Arrays.asList(target.getProject().split(","));//来源可以有多个
for (String project : projectList) {
String parameter = target.getParameter();
BusinessAssayProjectDataExtendRespVO currentBusinessAssayProjectData = businessAssayProjectDataList.stream().filter(f -> f.getBusinessAssayTaskDataId().equals(businessAssayTaskData.getId()) && f.getSimpleName().equals(project)).findFirst().orElse(null);
BusinessAssayParameterDataExtendRespVO currentBusinessAssayParameterData = businessAssayParameterDataList.stream().filter(f -> f.getBusinessAssayProjectDataId().equals(currentBusinessAssayProjectData.getId()) && f.getParameterKey().equals(parameter)).findFirst().orElse(null);
if (currentBusinessAssayParameterData != null && StringUtils.isNotBlank(currentBusinessAssayParameterData.getValue())) {
ingredientInfoBuilder.append(currentBusinessAssayParameterData.getParameterName()).append("").append(currentBusinessAssayParameterData.getValue()).append("");
break;
}
}
}
if (ingredientInfoBuilder.length() > 0) {
ingredientInfoBuilder.delete(ingredientInfoBuilder.length() - 1, ingredientInfoBuilder.length());
}
businessAssayTaskData.setIngredientInfo(ingredientInfoBuilder.toString());
}
}
return list;
}
@Override
public PageResult<BusinessAssayTaskDataExtendRespVO> getBusinessAssayTaskDataPage(BusinessAssayTaskDataPageReqVO pageReqVO) {
return businessAssayTaskDataMapper.selectPage(pageReqVO);
PageResult<BusinessAssayTaskDataExtendRespVO> page = businessAssayTaskDataMapper.selectPage(pageReqVO);
List<BusinessAssayTaskDataExtendRespVO> list = page.getList();
List<Long> configSubSampleIdList = list.stream().map(m -> m.getConfigSubSampleId()).collect(Collectors.toList());
List<ConfigSubSampleMethodExtendRespVO> configSubSampleMethodList = configSubSampleMethodMapper.selectByConfigSubSampleIdsAndConfigAssayMethodId(configSubSampleIdList, pageReqVO.getConfigAssayMethodId());
List<Long> businessAssayTaskDataIdList = list.stream().map(m -> m.getId()).collect(Collectors.toList());
//查询检测项目
List<BusinessAssayProjectDataExtendRespVO> businessAssayProjectDataList = businessAssayProjectDataMapper.selectByBusinessAssayTaskDataIds(businessAssayTaskDataIdList);
List<Long> businessAssayProjectDataIdList = businessAssayProjectDataList.stream().map(m -> m.getId()).collect(Collectors.toList());
//查询检测项目参数
List<BusinessAssayParameterDataExtendRespVO> businessAssayParameterDataList = businessAssayParameterDataMapper.selectExtendByBusinessAssayProjectDataIds(businessAssayProjectDataIdList);
for (BusinessAssayTaskDataExtendRespVO businessAssayTaskData : list) {
ConfigSubSampleMethodExtendRespVO configSubSampleMethod = configSubSampleMethodList.stream().filter(f -> f.getConfigSubSampleId().equals(businessAssayTaskData.getConfigSubSampleId()) && f.getConfigAssayMethodId().equals(businessAssayTaskData.getConfigAssayMethodId())).findFirst().orElse(null);
String configInfomation = configSubSampleMethod.getConfigInfomation();
if (StringUtils.isNotBlank(configInfomation)) {
ConfigSubSampleMethodConfInfo configSubSampleMethodConfInfo = JSON.parseObject(configInfomation, ConfigSubSampleMethodConfInfo.class);
List<ConfigSubSampleMethodConfItem> getParamList = configSubSampleMethodConfInfo.getGetParam();
StringBuilder ingredientInfoBuilder = new StringBuilder();
for (ConfigSubSampleMethodConfItem configSubSampleMethodConfItem : getParamList) {
ConfigSubSampleMethodConfPoint target = configSubSampleMethodConfItem.getTarget();
List<String> projectList = Arrays.asList(target.getProject().split(","));//来源可以有多个
for (String project : projectList) {
String parameter = target.getParameter();
BusinessAssayProjectDataExtendRespVO currentBusinessAssayProjectData = businessAssayProjectDataList.stream().filter(f -> f.getBusinessAssayTaskDataId().equals(businessAssayTaskData.getId()) && f.getSimpleName().equals(project)).findFirst().orElse(null);
BusinessAssayParameterDataExtendRespVO currentBusinessAssayParameterData = businessAssayParameterDataList.stream().filter(f -> f.getBusinessAssayProjectDataId().equals(currentBusinessAssayProjectData.getId()) && f.getParameterKey().equals(parameter)).findFirst().orElse(null);
if (currentBusinessAssayParameterData != null && StringUtils.isNotBlank(currentBusinessAssayParameterData.getValue())) {
ingredientInfoBuilder.append(currentBusinessAssayParameterData.getParameterName()).append("").append(currentBusinessAssayParameterData.getValue()).append("");
break;
}
}
}
if (ingredientInfoBuilder.length() > 0) {
ingredientInfoBuilder.delete(ingredientInfoBuilder.length() - 1, ingredientInfoBuilder.length());
}
businessAssayTaskData.setIngredientInfo(ingredientInfoBuilder.toString());
}
}
return page;
}
}

View File

@@ -21,7 +21,6 @@ import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.zt.plat.framework.common.exception.ServiceException;
import com.zt.plat.framework.common.util.date.DateUtils;
import com.zt.plat.framework.common.util.object.BeanUtils;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.framework.security.core.LoginUser;
@@ -85,7 +84,6 @@ import com.zt.plat.module.qms.business.config.dal.dataobject.BaseSampleDO;
import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigAssayMethodDO;
import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigAssayMethodProjectCoefficientDO;
import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigAssayMethodProjectRangeDO;
import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigSubSampleMethodDO;
import com.zt.plat.module.qms.business.config.dal.mapper.BaseSampleMapper;
import com.zt.plat.module.qms.business.config.dal.mapper.ConfigAssayMethodMapper;
import com.zt.plat.module.qms.business.config.dal.mapper.ConfigAssayMethodProjectCoefficientMapper;
@@ -98,9 +96,7 @@ import com.zt.plat.module.qms.common.dic.controller.vo.DictionaryBusinessExtendR
import com.zt.plat.module.qms.common.dic.dal.mapper.DictionaryBusinessMapper;
import com.zt.plat.module.qms.enums.QmsCommonConstant;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import jakarta.annotation.Resource;
@@ -529,6 +525,7 @@ public class SampleAnalysisServiceImpl implements SampleAnalysisService {
businessAssayTaskAnalysisSampleAndQcProjectRespVO.setDataCollectionId(businessAssayTaskDO.getFormDataCollectionId());
businessAssayTaskAnalysisSampleAndQcProjectRespVO.setFormValue(businessAssayTaskDO.getFormValue());
businessAssayTaskAnalysisSampleAndQcProjectRespVO.setIsIngredients(businessAssayTaskDO.getIsIngredients());
businessAssayTaskAnalysisSampleAndQcProjectRespVO.setIngredientsWay(businessAssayTaskDO.getIngredientsWay());
businessAssayTaskAnalysisSampleAndQcProjectRespVO.setIngredientsStatus(businessAssayTaskDO.getIngredientsStatus());
ConfigAssayMethodDO configAssayMethodDO = configAssayMethodMapper.selectById(businessAssayTaskDO.getConfigAssayMethodId());
@@ -661,85 +658,87 @@ public class SampleAnalysisServiceImpl implements SampleAnalysisService {
Long configMethodId = source.getMethodId();
String sourceProject = source.getProject();
//String sourceParameter = source.getParameter();
ConfigSubSampleMethodConfPoint target = configSubSampleMethodConfItem.getTarget();//目标
String targetProject = target.getProject();
String targetParameter = target.getParameter();
BusinessAssayParameterDataDO businessAssayParameterDataDO = businessAssayParameterDataMapper.selectByBusinessAssayTaskDataIdAndProjectSimpleNameAndParameterKey(businessAssayTaskDataDO.getId(), targetProject, targetParameter);
if (businessAssayParameterDataDO == null) {
throw new ServiceException(1_032_100_000, "子样检测方法映射配置错误");
}
if (StringUtils.isBlank(businessAssayParameterDataDO.getValue())) {
//1 查询委托明细
BusinessSampleEntrustDetailDO businessSampleEntrustDetailDO = businessSampleEntrustDetailMapper.selectByBusinessBaseSampleId(businessAssayTaskDataDO.getBusinessBaseSampleId());
//2 查询样品大类
BaseSampleDO baseSampleDO = baseSampleMapper.selectById(businessSampleEntrustDetailDO.getBaseSampleId());
//3 判断样品大类类型
if (QmsCommonConstant.ENTRUST_INSPECTION_ANALYSIS_SAMPLE.equals(baseSampleDO.getDictionaryBusinessKey())) {//如果是商检分析样
//查询当前批次的第一个商检分析样
BusinessSampleEntrustDetailDO currBatchFirstBusinessSampleEntrustDetailDO = businessSampleEntrustDetailMapper.selectCurrBatchFirstByBusinessBaseSampleIdAndBaseSampleDictionaryBusinessKey(businessAssayTaskDataDO.getBusinessBaseSampleId(), QmsCommonConstant.ENTRUST_INSPECTION_ANALYSIS_SAMPLE);
List<BusinessSubParentSampleDO> currBusinessSubParentSampleDOList = businessSubParentSampleMapper.selectByBusinessBaseSampleId(currBatchFirstBusinessSampleEntrustDetailDO.getBusinessBaseSampleId());
List<Long> currBusinessSubParentSampleIdList = currBusinessSubParentSampleDOList.stream().map(m -> m.getId()).collect(Collectors.toList());
List<BusinessSubParentSampleAssessmentProjectExtendRespVO> businessSubParentSampleAssessmentProjectList = businessSubParentSampleAssessmentProjectMapper.selectByBusinessSubParentSampleIdsAndConfigAssayMethodId(currBusinessSubParentSampleIdList, configMethodId);
BusinessSubParentSampleAssessmentProjectExtendRespVO businessSubParentSampleAssessmentProject = businessSubParentSampleAssessmentProjectList.stream().filter(f -> f.getSimpleName().equals(sourceProject)).findFirst().orElse(null);
if (businessSubParentSampleAssessmentProject != null && StringUtils.isNotBlank(businessSubParentSampleAssessmentProject.getAssessmentValue())) {
businessAssayParameterDataDO.setValue(businessSubParentSampleAssessmentProject.getAssessmentValue());
}
} else if (QmsCommonConstant.ENTRUST_COMPREHENSIVE_INSPECTION_SAMPLE.equals(baseSampleDO.getDictionaryBusinessKey())) {//如果是商检综合样
//查询当前样品的其他分析方法的结果
List<Long> businessSubParentSampleIdList = Arrays.asList(businessAssayTaskDataDO.getBusinessSubParentSampleId());
List<BusinessSubParentSampleAssessmentProjectExtendRespVO> businessSubParentSampleAssessmentProjectList = businessSubParentSampleAssessmentProjectMapper.selectByBusinessSubParentSampleIdsAndConfigAssayMethodId(businessSubParentSampleIdList, configMethodId);
BusinessSubParentSampleAssessmentProjectExtendRespVO businessSubParentSampleAssessmentProject = businessSubParentSampleAssessmentProjectList.stream().filter(f -> f.getSimpleName().equals(sourceProject)).findFirst().orElse(null);
if (businessSubParentSampleAssessmentProject != null && StringUtils.isNotBlank(businessSubParentSampleAssessmentProject.getAssessmentValue())) {
businessAssayParameterDataDO.setValue(businessSubParentSampleAssessmentProject.getAssessmentValue());
}
} else if (QmsCommonConstant.ENTRUST_COMMISSION_INSPECTION_SAMPLE.equals(baseSampleDO.getDictionaryBusinessKey())) {//如果是委检样
//查询来样品位
Boolean isForecastS = false;
String forecastValue = null;
String forecastResult = businessSampleEntrustDetailDO.getForecastResult();
if (StringUtils.isNotBlank(forecastResult)) {
JSONArray array = JSON.parseArray(forecastResult);
for (int i = 0; i < array.size(); i++) {
JSONObject item = array.getJSONObject(i);
if ("S".equals(item.getString("simpleName"))) {
isForecastS = true;
break;
}
List<String> projectList = Arrays.asList(target.getProject().split(","));//目标可以有多个
for (String targetProject : projectList) {
String targetParameter = target.getParameter();
BusinessAssayParameterDataDO businessAssayParameterDataDO = businessAssayParameterDataMapper.selectByBusinessAssayTaskDataIdAndProjectSimpleNameAndParameterKey(businessAssayTaskDataDO.getId(), targetProject, targetParameter);
if (businessAssayParameterDataDO == null) {
throw new ServiceException(1_032_100_000, "子样检测方法映射配置错误");
}
if (StringUtils.isBlank(businessAssayParameterDataDO.getValue())) {
//1 查询委托明细
BusinessSampleEntrustDetailDO businessSampleEntrustDetailDO = businessSampleEntrustDetailMapper.selectByBusinessBaseSampleId(businessAssayTaskDataDO.getBusinessBaseSampleId());
//2 查询样品大类
BaseSampleDO baseSampleDO = baseSampleMapper.selectById(businessSampleEntrustDetailDO.getBaseSampleId());
//3 判断样品大类类型
if (QmsCommonConstant.ENTRUST_INSPECTION_ANALYSIS_SAMPLE.equals(baseSampleDO.getDictionaryBusinessKey())) {//如果是商检分析样
//查询当前批次的第一个商检分析样
BusinessSampleEntrustDetailDO currBatchFirstBusinessSampleEntrustDetailDO = businessSampleEntrustDetailMapper.selectCurrBatchFirstByBusinessBaseSampleIdAndBaseSampleDictionaryBusinessKey(businessAssayTaskDataDO.getBusinessBaseSampleId(), QmsCommonConstant.ENTRUST_INSPECTION_ANALYSIS_SAMPLE);
List<BusinessSubParentSampleDO> currBusinessSubParentSampleDOList = businessSubParentSampleMapper.selectByBusinessBaseSampleId(currBatchFirstBusinessSampleEntrustDetailDO.getBusinessBaseSampleId());
List<Long> currBusinessSubParentSampleIdList = currBusinessSubParentSampleDOList.stream().map(m -> m.getId()).collect(Collectors.toList());
List<BusinessSubParentSampleAssessmentProjectExtendRespVO> businessSubParentSampleAssessmentProjectList = businessSubParentSampleAssessmentProjectMapper.selectByBusinessSubParentSampleIdsAndConfigAssayMethodId(currBusinessSubParentSampleIdList, configMethodId);
BusinessSubParentSampleAssessmentProjectExtendRespVO businessSubParentSampleAssessmentProject = businessSubParentSampleAssessmentProjectList.stream().filter(f -> f.getSimpleName().equals(sourceProject)).findFirst().orElse(null);
if (businessSubParentSampleAssessmentProject != null && StringUtils.isNotBlank(businessSubParentSampleAssessmentProject.getAssessmentValue())) {
businessAssayParameterDataDO.setValue(businessSubParentSampleAssessmentProject.getAssessmentValue());
}
for (int i = 0; i < array.size(); i++) {
JSONObject item = array.getJSONObject(i);
if (sourceProject.equals(item.getString("simpleName"))) {
forecastValue = item.getString("value");
break;
}
}
}
if (isForecastS) {//来样品位存在S值 则取预报的值
businessAssayParameterDataDO.setValue(forecastValue);
} else {
//查询当前样品的其他方法的结果
} else if (QmsCommonConstant.ENTRUST_COMPREHENSIVE_INSPECTION_SAMPLE.equals(baseSampleDO.getDictionaryBusinessKey())) {//如果是商检综合样
//查询当前样品的其他分析方法的结果
List<Long> businessSubParentSampleIdList = Arrays.asList(businessAssayTaskDataDO.getBusinessSubParentSampleId());
List<BusinessSubParentSampleAssessmentProjectExtendRespVO> businessSubParentSampleAssessmentProjectList = businessSubParentSampleAssessmentProjectMapper.selectByBusinessSubParentSampleIdsAndConfigAssayMethodId(businessSubParentSampleIdList, configMethodId);
BusinessSubParentSampleAssessmentProjectExtendRespVO businessSubParentSampleAssessmentProject = businessSubParentSampleAssessmentProjectList.stream().filter(f -> f.getSimpleName().equals(sourceProject)).findFirst().orElse(null);
if (businessSubParentSampleAssessmentProject != null && StringUtils.isNotBlank(businessSubParentSampleAssessmentProject.getAssessmentValue())) {
businessAssayParameterDataDO.setValue(businessSubParentSampleAssessmentProject.getAssessmentValue());
}
} else if (QmsCommonConstant.ENTRUST_COMMISSION_INSPECTION_SAMPLE.equals(baseSampleDO.getDictionaryBusinessKey())) {//如果是委检样
//查询来样品位
Boolean isForecastS = false;
String forecastValue = null;
String forecastResult = businessSampleEntrustDetailDO.getForecastResult();
if (StringUtils.isNotBlank(forecastResult)) {
JSONArray array = JSON.parseArray(forecastResult);
for (int i = 0; i < array.size(); i++) {
JSONObject item = array.getJSONObject(i);
if ("S".equals(item.getString("simpleName"))) {
isForecastS = true;
break;
}
}
for (int i = 0; i < array.size(); i++) {
JSONObject item = array.getJSONObject(i);
if (sourceProject.equals(item.getString("simpleName"))) {
forecastValue = item.getString("value");
break;
}
}
}
if (isForecastS) {//来样品位存在S值 则取预报的值
businessAssayParameterDataDO.setValue(forecastValue);
} else {
//查询当前样品的其他方法的结果
List<Long> businessSubParentSampleIdList = Arrays.asList(businessAssayTaskDataDO.getBusinessSubParentSampleId());
List<BusinessSubParentSampleAssessmentProjectExtendRespVO> businessSubParentSampleAssessmentProjectList = businessSubParentSampleAssessmentProjectMapper.selectByBusinessSubParentSampleIdsAndConfigAssayMethodId(businessSubParentSampleIdList, configMethodId);
BusinessSubParentSampleAssessmentProjectExtendRespVO businessSubParentSampleAssessmentProject = businessSubParentSampleAssessmentProjectList.stream().filter(f -> f.getSimpleName().equals(sourceProject)).findFirst().orElse(null);
if (businessSubParentSampleAssessmentProject != null && StringUtils.isNotBlank(businessSubParentSampleAssessmentProject.getAssessmentValue())) {
businessAssayParameterDataDO.setValue(businessSubParentSampleAssessmentProject.getAssessmentValue());
}
}
}
}
//处理已查询的数据
BusinessAssayProjectAndParameterRespVO businessAssayProjectAndParameterRespVO = businessAssayParameterDataList.stream().filter(f -> f.getBizId().equals(businessAssayParameterDataDO.getBusinessAssayProjectDataId()) && f.getDicId().equals(businessAssayParameterDataDO.getConfigAssayMethodProjectParameterId()) ).findFirst().orElse(null);
if (businessAssayProjectAndParameterRespVO != null) {
businessAssayProjectAndParameterRespVO.setValue(businessAssayParameterDataDO.getValue());
}
//处理已查询的数据
BusinessAssayProjectAndParameterRespVO businessAssayProjectAndParameterRespVO = businessAssayParameterDataList.stream().filter(f -> f.getBizId().equals(businessAssayParameterDataDO.getBusinessAssayProjectDataId()) && f.getDicId().equals(businessAssayParameterDataDO.getConfigAssayMethodProjectParameterId()) ).findFirst().orElse(null);
if (businessAssayProjectAndParameterRespVO != null) {
businessAssayProjectAndParameterRespVO.setValue(businessAssayParameterDataDO.getValue());
}
//更新
businessAssayParameterDataMapper.updateById(businessAssayParameterDataDO);
//更新
businessAssayParameterDataMapper.updateById(businessAssayParameterDataDO);
}
}
}
}
@@ -1274,8 +1273,56 @@ public class SampleAnalysisServiceImpl implements SampleAnalysisService {
businessAssayTaskDO.setFinishStatus(QmsCommonConstant.IN_PROGRESS);
businessAssayTaskDO.setFlowStatus(QmsCommonConstant.IN_PROGRESS);
//设置参数值
List<BusinessAssayParameterDataDO> updateBusinessAssayParameterDataList = new ArrayList<>();
List<BusinessAssayTaskDataExtendRespVO> businessAssayTaskDataExtendList = businessAssayTaskDataMapper.selectExtendByBusinessAssayTaskId(businessAssayTaskId);
//查询检测项目
List<Long> businessAssayTaskDataIdList = businessAssayTaskDataExtendList.stream().map(m -> m.getId()).collect(Collectors.toList());
List<BusinessAssayProjectDataExtendRespVO> businessAssayProjectDataExtendList = businessAssayProjectDataMapper.selectByBusinessAssayTaskDataIds(businessAssayTaskDataIdList);
//子样配置id列表
List<Long> configSubSampleIdList = businessAssayTaskDataExtendList.stream().map(m -> m.getConfigSubSampleId()).distinct().collect(Collectors.toList());
//子样方法配置列表
List<ConfigSubSampleMethodExtendRespVO> configSubSampleMethodDOList = configSubSampleMethodMapper.selectByConfigSubSampleIdsAndConfigAssayMethodId(configSubSampleIdList, businessAssayTaskDO.getConfigAssayMethodId());
//循环任务,赋值
for (BusinessAssayTaskDataExtendRespVO businessAssayTaskData : businessAssayTaskDataExtendList) {
ConfigSubSampleMethodExtendRespVO configSubSampleMethod = configSubSampleMethodDOList.stream().filter(f -> f.getConfigBaseSampleId().equals(businessAssayTaskData.getConfigSubSampleId()) && f.getConfigAssayMethodId().equals(businessAssayTaskData.getConfigAssayMethodId())).findFirst().orElse(null);
String configInfomation = configSubSampleMethod.getConfigInfomation();
if (StringUtils.isNotBlank(configInfomation)) {
ConfigSubSampleMethodConfInfo configSubSampleMethodConfInfo = JSON.parseObject(configInfomation, ConfigSubSampleMethodConfInfo.class);
List<ConfigSubSampleMethodConfItem> setParamList = configSubSampleMethodConfInfo.getSetParam();
String methodKey = setParamList.stream().map(m -> m.getTarget().getMethodKey()).distinct().findFirst().orElse(null);
List<BusinessAssayTaskDataDO> targetBusinessAssayTaskDataList = businessAssayTaskDataMapper.selectByBusinessSubSampleIdAndMethodKey(businessAssayTaskData.getBusinessSubSampleId(), methodKey);
List<Long> targetBusinessAssayTaskDataIdList = targetBusinessAssayTaskDataList.stream().map(m -> m.getId()).collect(Collectors.toList());
List<BusinessAssayProjectDataExtendRespVO> targetBusinessAssayProjectDataExtendList = businessAssayProjectDataMapper.selectByBusinessAssayTaskDataIds(targetBusinessAssayTaskDataIdList);
for (ConfigSubSampleMethodConfItem configSubSampleMethodConfItem : setParamList) {
ConfigSubSampleMethodConfPoint source = configSubSampleMethodConfItem.getSource();
String project = source.getProject();
BusinessAssayProjectDataExtendRespVO currentBusinessAssayProjectData = businessAssayProjectDataExtendList.stream().filter(f -> f.getBusinessAssayTaskDataId().equals(businessAssayTaskData.getId()) && f.getSimpleName().equals(project)).findFirst().orElse(null);
ConfigSubSampleMethodConfPoint target = configSubSampleMethodConfItem.getTarget();
for (BusinessAssayTaskDataDO targetBusinessAssayTaskData : targetBusinessAssayTaskDataList) {
List<String> targetProjectList = Arrays.asList(target.getProject().split(","));
String targetParameter = target.getParameter();
for (String targetProject : targetProjectList) {
BusinessAssayProjectDataExtendRespVO targetBusinessAssayProjectData = targetBusinessAssayProjectDataExtendList.stream().filter(f -> f.getBusinessAssayTaskDataId().equals(targetBusinessAssayTaskData.getId()) && f.getSimpleName().equals(targetProject)).findFirst().orElse(null);
BusinessAssayParameterDataDO businessAssayParameterDataDO = businessAssayParameterDataMapper.selectByBusinessAssayTaskDataIdAndProjectSimpleNameAndParameterKey(targetBusinessAssayProjectData.getId(), targetProject, targetParameter);
if (businessAssayParameterDataDO != null) {
businessAssayParameterDataDO.setValue(currentBusinessAssayProjectData.getValue());
updateBusinessAssayParameterDataList.add(businessAssayParameterDataDO);
}
}
}
}
}
}
//补正系数列表
List<ConfigAssayMethodProjectCoefficientDO> configAssayMethodProjectCoefficientList = new ArrayList<>();
if (businessAssayTaskDO.getIsIngredients().equals(QmsCommonConstant.YES) && QmsCommonConstant.MANUAL.equals(businessAssayTaskDO.getIngredientsWay())) {//如果是需要配料,并且是人工配料的
@@ -1283,8 +1330,6 @@ public class SampleAnalysisServiceImpl implements SampleAnalysisService {
configAssayMethodProjectCoefficientList = configAssayMethodProjectCoefficientMapper.selectByConfigBaseSampleIds(configBaseSampleIdList);
}
List<Long> businessAssayTaskDataIdList = businessAssayTaskDataExtendList.stream().map(m -> m.getId()).collect(Collectors.toList());
List<BusinessAssayProjectDataExtendRespVO> businessAssayProjectDataExtendList = businessAssayProjectDataMapper.selectByBusinessAssayTaskDataIds(businessAssayTaskDataIdList);
for (BusinessAssayProjectDataExtendRespVO businessAssayProjectDataExtend : businessAssayProjectDataExtendList) {
if (businessAssayTaskDO.getIsIngredients().equals(QmsCommonConstant.YES) && QmsCommonConstant.MANUAL.equals(businessAssayTaskDO.getIngredientsWay())) {
ConfigAssayMethodProjectCoefficientDO configAssayMethodProjectCoefficientDO = configAssayMethodProjectCoefficientList.stream().filter(f ->
@@ -1312,6 +1357,10 @@ public class SampleAnalysisServiceImpl implements SampleAnalysisService {
businessAssayProjectDataMapper.updateBatch(businessAssayProjectDataList);
}
if (updateBusinessAssayParameterDataList.size() > 0) {
businessAssayParameterDataMapper.updateBatch(updateBusinessAssayParameterDataList);
}
businessAssayTaskMapper.updateById(businessAssayTaskDO);
}
@@ -1460,12 +1509,15 @@ public class SampleAnalysisServiceImpl implements SampleAnalysisService {
for (ConfigSubSampleMethodConfItem configSubSampleMethodConfItem : downIngredients) {
if (configSubSampleMethodConfItem.getRequired()) {
ConfigSubSampleMethodConfPoint source = configSubSampleMethodConfItem.getSource();
String project = source.getProject();
String parameter = source.getParameter();
BusinessAssayProjectDataExtendRespVO currentBusinessAssayProjectData = businessAssayProjectDataList.stream().filter(f -> f.getBusinessAssayTaskDataId().equals(businessAssayTaskDataDO.getId()) && f.getSimpleName().equals(project)).findFirst().orElse(null);
BusinessAssayParameterDataExtendRespVO currentBusinessAssayParameterData = businessAssayParameterDataList.stream().filter(f -> f.getBusinessAssayProjectDataId().equals(currentBusinessAssayProjectData.getId()) && f.getParameterKey().equals(parameter)).findFirst().orElse(null);
if (StringUtils.isBlank(currentBusinessAssayParameterData.getValue())) {
throw new ServiceException(1_032_050_000, "当前分析任务,存在下发配料必填为空情况。请检查后再下发!");
List<String> projectList = Arrays.asList(source.getProject().split(","));//来源可以有多个
for (String project : projectList) {
String parameter = source.getParameter();
BusinessAssayProjectDataExtendRespVO currentBusinessAssayProjectData = businessAssayProjectDataList.stream().filter(f -> f.getBusinessAssayTaskDataId().equals(businessAssayTaskDataDO.getId()) && f.getSimpleName().equals(project)).findFirst().orElse(null);
BusinessAssayParameterDataExtendRespVO currentBusinessAssayParameterData = businessAssayParameterDataList.stream().filter(f -> f.getBusinessAssayProjectDataId().equals(currentBusinessAssayProjectData.getId()) && f.getParameterKey().equals(parameter)).findFirst().orElse(null);
if (StringUtils.isBlank(currentBusinessAssayParameterData.getValue())) {
throw new ServiceException(1_032_050_000, "当前分析任务,存在下发配料必填为空情况。请检查后再下发!");
}
}
}
}
@@ -1482,7 +1534,7 @@ public class SampleAnalysisServiceImpl implements SampleAnalysisService {
public void manualIngredients(Long businessAssayTaskId) {
BusinessAssayTaskDO businessAssayTaskDO = businessAssayTaskMapper.selectById(businessAssayTaskId);
businessAssayTaskDO.setIngredientsWay(QmsCommonConstant.MANUAL);//人工配料
businessAssayTaskDO.setIngredientsStatus(QmsCommonConstant.IN_PROGRESS);//表示为允许提交
businessAssayTaskDO.setIngredientsStatus(QmsCommonConstant.ALLOW_SUBMIT);//表示为允许提交
businessAssayTaskMapper.updateById(businessAssayTaskDO);
}

View File

@@ -3,6 +3,9 @@ package com.zt.plat.module.qms.business.bus.service;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
import org.apache.commons.lang3.StringUtils;
@@ -237,6 +240,9 @@ public class SampleTaskAssignServiceImpl implements SampleTaskAssignService {
//查询子样分析方法及检测项目
// List<ConfigAssayMethodProjectExtendRespVO> configAssayMethodProjectList = configAssayMethodProjectMapper.selectByConfigSubSampleIdsAndAssayDepartmentId(configSubSampleIdList, visitDeptId);
//根据样品大类,查询所有子样方法
List<ConfigSubSampleMethodExtendRespVO> configSubSampleMethodList = configSubSampleMethodMapper.selectByBaseSampleId(baseSampleId);
//查询分析方法检测项目
List<AssayMethodProjectRespVO> list = businessAssayProjectDataMapper.selectAssayMethodProjectByBusinessSubSampleIdListAndConfigAssayMethodId(businessSubSampleIdList, configAssayMethodId);
@@ -246,9 +252,15 @@ public class SampleTaskAssignServiceImpl implements SampleTaskAssignService {
for (AssayMethodProjectRespVO assayMethodProject : list) {
List<ConfigAssayMethodProjectExtendRespVO> methodList = materialAssayStandardMethodList.stream().filter(f -> assayMethodProject.getDictionaryProjectId().equals(f.getDictionaryProjectId())).map(m -> {
ConfigSubSampleMethodExtendRespVO configSubSampleMethodExtend = configSubSampleMethodList.stream().filter(f -> m.getConfigAssayMethodId().equals(f.getConfigAssayMethodId())).findFirst().orElse(null);
String assayType = configSubSampleMethodExtend.getTaskCount() > 1 ? QmsCommonConstant.ASSAY_TYPE_SINGLE_PARALLEL : QmsCommonConstant.ASSAY_TYPE_SINGLE_CUP;
if (m.getIsDualCup().equals(1)) {
assayType = QmsCommonConstant.ASSAY_TYPE_DOUBLE_CUP;
}
ConfigAssayMethodProjectExtendRespVO configAssayMethod = new ConfigAssayMethodProjectExtendRespVO();
configAssayMethod.setConfigAssayMethodId(m.getConfigAssayMethodId());
configAssayMethod.setConfigAssayMethodName(m.getConfigAssayMethodName());
configAssayMethod.setAssayType(assayType);
configAssayMethod.setConfigAssayMethodNameAndCategory(m.getConfigAssayMethodNameAndCategory());
return configAssayMethod;
}).collect(Collectors.toList());
@@ -258,6 +270,499 @@ public class SampleTaskAssignServiceImpl implements SampleTaskAssignService {
}
@Override
@Transactional(rollbackFor = Exception.class)
public void changeMethod(ChangeAssayMethodReqVO req) {
List<Long> businessSubSampleIdList = req.getBusinessSubSampleIdList();
Long configAssayMethodId = req.getConfigAssayMethodId();
List<AssayMethodProjectRespVO> changeConfigAssayMethodProjectList = req.getChangeConfigAssayMethodProjectList();
// 先按 configAssayMethodId 分组
Map<Long, List<AssayMethodProjectRespVO>> groupedByConfigId = changeConfigAssayMethodProjectList.stream()
.collect(Collectors.groupingBy(AssayMethodProjectRespVO::getConfigAssayMethodId));
// 遍历每个分组,检查 assayType 是否唯一
for (Map.Entry<Long, List<AssayMethodProjectRespVO>> entry : groupedByConfigId.entrySet()) {
List<AssayMethodProjectRespVO> group = entry.getValue();
// 获取该组所有非空的 assayType去重
Set<String> assayTypes = group.stream()
.map(AssayMethodProjectRespVO::getAssayType)
.filter(Objects::nonNull)
.collect(Collectors.toSet());
if (assayTypes.size() > 1) {
// 取第一个元素的 configAssayMethodNameAndCategory 作为代表(假设同 configId 下名称一致)
String methodName = group.get(0).getConfigAssayMethodNameAndCategory();
if (methodName == null || methodName.trim().isEmpty()) {
methodName = "(未命名)";
}
throw new ServiceException(1_032_050_000,
String.format("检测方法“%s”存在多种分析类型%s请确保同一检测方法仅对应一种分析类型。",
methodName,
assayTypes.stream().sorted().collect(Collectors.joining(", "))
)
);
}
}
List<Long> changeConfigAssayMethodIdList = changeConfigAssayMethodProjectList.stream().map(m -> m.getConfigAssayMethodId()).distinct().collect(Collectors.toList());
LocalDateTime currentDateTime = LocalDateTime.now();
//需要更新的报表数据
List<BusinessAssayReportDataDO> updateBusinessAssayReportDataDOList = new ArrayList<>();
//需要更新的分析任务
List<BusinessAssayTaskDataDO> updateBusinessAssayTaskDataDOList = new ArrayList<>();
//需要更新的分析任务检测项目
List<BusinessAssayProjectDataDO> updateBusinessAssayProjectDataDOList = new ArrayList<>();
//需要更新的分析任务检测项目参数
List<BusinessAssayParameterDataDO> updateBusinessAssayParameterDataDOList = new ArrayList<>();
//需要更新的子样判定
List<BusinessSubSampleAssessmentDO> updateBusinessSubSampleAssessmentDOList = new ArrayList<>();
//需要更新的分样判定
List<BusinessSubParentSampleAssessmentDO> updateBusinessSubParentSampleAssessmentDOList = new ArrayList<>();
//需要新建的分析任务
List<BusinessAssayTaskDataDO> saveBusinessAssayTaskDataDOList = new ArrayList<>();
//需要新建的分析任务检测项目
List<BusinessAssayProjectDataDO> saveBusinessAssayProjectDataDOList = new ArrayList<>();
//需要新建的分析任务检测项目参数
List<BusinessAssayParameterDataDO> saveBusinessAssayParameterDataDOList = new ArrayList<>();
//需要新建的子样判定
List<BusinessSubSampleAssessmentDO> saveBusinessSubSampleAssessmentDOList = new ArrayList<>();
//需要新建的分样判定
List<BusinessSubParentSampleAssessmentDO> saveBusinessSubParentSampleAssessmentDOList = new ArrayList<>();
//需要删除的分析任务
List<Long> removeAssayTaskDataIdList = new ArrayList<>();
//需要删除的分析任务检测项目
List<Long> removeAssayProjectIdList = new ArrayList<>();
//需要删除的分析任务检测项目参数
List<Long> removeAssayParameterIdList = new ArrayList<>();
//需要删除的子样判定
List<Long> removeSubSampleAssessmentIdList = new ArrayList<>();
//需要删除的分样判定
List<Long> removeSubParentSampleAssessmentIdList = new ArrayList<>();
//查询子样
List<BusinessSubSampleDO> businessSubSampleDOList = businessSubSampleMapper.selectByIds(businessSubSampleIdList);
List<Long> businessBaseSampleIdList = businessSubSampleDOList.stream().map(m -> m.getBusinessBaseSampleId()).distinct().collect(Collectors.toList());
List<Long> businessSubParentSampleIdList = businessSubSampleDOList.stream().map(m -> m.getBusinessSubParentSampleId()).distinct().collect(Collectors.toList());
List<Long> configSubSampleIdList = businessSubSampleDOList.stream().map(m -> m.getConfigSubSampleId()).distinct().collect(Collectors.toList());
//查询检测任务 (通过分样id可以查询双杯样的)
List<BusinessAssayTaskDataDO> businessAssayTaskDataDOList = businessAssayTaskDataMapper.selectByBusinessSubParentSampleIdsAndConfigAssayMethodId(businessSubParentSampleIdList, configAssayMethodId);
boolean disabled = businessAssayTaskDataDOList.stream().anyMatch(m -> m.getIsAssignTasked().equals(QmsCommonConstant.YES));
if (disabled) {
throw new ServiceException(1_032_001_000, "当前样品存在已分配任务,不允许修改分析方法");
}
List<Long> businessAssayTaskDataIdList = businessAssayTaskDataDOList.stream().map(m -> m.getId()).collect(Collectors.toList());
//查询检测任务的检测项目
List<BusinessAssayProjectDataExtendRespVO> businessAssayProjectDataList = businessAssayProjectDataMapper.selectByBusinessAssayTaskDataIds(businessAssayTaskDataIdList);
List<Long> businessAssayProjectDataIdList = businessAssayProjectDataList.stream().map(m -> m.getId()).collect(Collectors.toList());
//查询检测任务的检测项目的参数
List<BusinessAssayParameterDataDO> businessAssayParameterDataDOList = businessAssayParameterDataMapper.selectByBusinessAssayProjectDataIds(businessAssayProjectDataIdList);
//查询子样判定 (通过分样id可以查询双杯样的)
List<BusinessSubSampleAssessmentDO> businessSubSampleAssessmentDOList = businessSubSampleAssessmentMapper.selectByBusinessSubParentSampleIdsAndConfigAssayMethodId(businessSubParentSampleIdList, configAssayMethodId);
//查询分样判定
List<BusinessSubParentSampleAssessmentExtendRespVO> businessSubParentSampleAssessmentList = businessSubParentSampleAssessmentMapper.selectByBusinessSubParentSampleIdsAndConfigAssayMethodId(businessSubParentSampleIdList, configAssayMethodId);
//查询要变更的分析方法配置
List<ConfigAssayMethodDO> configAssayMethodDOList = configAssayMethodMapper.selectByIds(changeConfigAssayMethodIdList);
//分析方法检测项目配置
List<ConfigAssayMethodProjectExtendRespVO> configAssayMethodProjectList = configAssayMethodProjectMapper.selectByConfigAssayMethodIds(changeConfigAssayMethodIdList);
//分析方法检测项目参数配置
List<ConfigAssayMethodProjectParameterDO> configAssayMethodProjectParameterList = configAssayMethodProjectParameterMapper.selectByConfigAssayMethodIds(changeConfigAssayMethodIdList);
//查询要变更的子样及分析方法配置
List<ConfigSubSampleMethodExtendRespVO> configSubSampleMethodList = configSubSampleMethodMapper.selectByConfigSubSampleIdsAndConfigAssayMethodIds(configSubSampleIdList, changeConfigAssayMethodIdList);
//循环分样判定
for (BusinessSubParentSampleAssessmentExtendRespVO businessSubParentSampleAssessment : businessSubParentSampleAssessmentList) {
//循环变更的分析方法
for (Long changeConfigAssayMethodId : changeConfigAssayMethodIdList) {
//如果当前分析方法不等于要变更的方法
if (!businessSubParentSampleAssessment.getConfigAssayMethodId().equals(changeConfigAssayMethodId)) {
//查询是否已有要变更的方法的分样判定
BusinessSubParentSampleAssessmentDO businessSubParentSampleAssessmentDO = businessSubParentSampleAssessmentMapper.selectByBusinessSubParentSampleIdAndConfigAssayMethodIdAndRetestCount(businessSubParentSampleAssessment.getBusinessSubParentSampleId(), changeConfigAssayMethodId, businessSubParentSampleAssessment.getRetestCount());
if (businessSubParentSampleAssessmentDO == null) {//不存在
//根据变更方法过滤出检测项目
List<Long> projectIdList = changeConfigAssayMethodProjectList.stream().filter(f -> f.getConfigAssayMethodId().equals(changeConfigAssayMethodId)).map(m -> m.getDictionaryProjectId()).distinct().collect(Collectors.toList());
//分析类型
String changeAssayType = changeConfigAssayMethodProjectList.stream().filter(f -> f.getConfigAssayMethodId().equals(changeConfigAssayMethodId)).map(m -> m.getAssayType()).distinct().findFirst().orElse(null);
//查询分析方法
ConfigAssayMethodDO configAssayMethodDO = configAssayMethodDOList.stream().filter(f -> f.getId().equals(changeConfigAssayMethodId)).findFirst().orElse(null);
//查询子样分析方法
ConfigSubSampleMethodExtendRespVO configSubSampleMethod = configSubSampleMethodList.stream().filter(f -> f.getConfigSubSampleParentId().equals(businessSubParentSampleAssessment.getConfigSubSampleParentId()) && f.getConfigAssayMethodId().equals(changeConfigAssayMethodId)).findFirst().orElse(null);
switch (changeAssayType) {//根据前端传入的分析类型,修改子样分析方法中的分析任务数
case QmsCommonConstant.ASSAY_TYPE_SINGLE_PARALLEL: {
configSubSampleMethod.setTaskCount(2);//平行
}
default:
configSubSampleMethod.setTaskCount(1);//单杯
}
//根据任务数判断是平行还是
String assayType = configSubSampleMethod.getTaskCount() > 1 ? QmsCommonConstant.ASSAY_TYPE_SINGLE_PARALLEL : QmsCommonConstant.ASSAY_TYPE_SINGLE_CUP;
businessSubParentSampleAssessmentDO = new BusinessSubParentSampleAssessmentDO();
businessSubParentSampleAssessmentDO.setId(IdWorker.getId());
businessSubParentSampleAssessmentDO.setBusinessSubParentSampleId(businessSubParentSampleAssessment.getBusinessSubParentSampleId());
businessSubParentSampleAssessmentDO.setConfigAssayMethodId(changeConfigAssayMethodId);
businessSubParentSampleAssessmentDO.setAssayType(assayType);
businessSubParentSampleAssessmentDO.setTaskType("常规");
saveBusinessSubParentSampleAssessmentDOList.add(businessSubParentSampleAssessmentDO);
BusinessSubSampleDO businessSubSampleDO = null;
if (!QmsCommonConstant.ASSAY_TYPE_DOUBLE_CUP.equals(businessSubParentSampleAssessment.getAssayType())) {//如果不为双杯样
businessSubSampleDO = businessSubSampleDOList.stream().filter(f -> f.getBusinessSubParentSampleId().equals(businessSubParentSampleAssessment.getBusinessSubParentSampleId())).findFirst().orElse(null);
}
//子样判定数据
BusinessSubSampleAssessmentDO businessSubSampleAssessmentDO = new BusinessSubSampleAssessmentDO();
businessSubSampleAssessmentDO.setId(IdWorker.getId());
businessSubSampleAssessmentDO.setBusinessBaseSampleId(businessSubParentSampleAssessment.getBusinessBaseSampleId());
businessSubSampleAssessmentDO.setBusinessSubParentSampleId(businessSubParentSampleAssessment.getBusinessSubParentSampleId());
businessSubSampleAssessmentDO.setBusinessSubParentSampleAssessmentId(businessSubParentSampleAssessmentDO.getId());
if (businessSubSampleDO != null) {
businessSubSampleAssessmentDO.setBusinessSubSampleId(businessSubSampleDO.getId());
}
businessSubSampleAssessmentDO.setConfigAssayMethodId(changeConfigAssayMethodId);
businessSubSampleAssessmentDO.setAssayType(assayType);
businessSubSampleAssessmentDO.setTaskType("常规");
saveBusinessSubSampleAssessmentDOList.add(businessSubSampleAssessmentDO);
//查询旧的检测项目
List<Long> oldBusinessAssayProjectDataIdList = businessAssayProjectDataList.stream().filter(f -> projectIdList.contains(f.getDictionaryProjectId()) && f.getBusinessSubParentSampleId().equals(businessSubParentSampleAssessment.getBusinessSubParentSampleId())).map(m -> m.getId()).collect(Collectors.toList());
//添加到删除列表
removeAssayProjectIdList.addAll(oldBusinessAssayProjectDataIdList);
List<Long> oldBusinessAssayParameterDataIdList = businessAssayParameterDataDOList.stream().filter(f -> oldBusinessAssayProjectDataIdList.contains(f.getBusinessAssayProjectDataId())).map(m -> m.getId()).collect(Collectors.toList());
removeAssayParameterIdList.addAll(oldBusinessAssayParameterDataIdList);
if (projectIdList.size() == changeConfigAssayMethodProjectList.size()) {
//查询旧的检测任务
List<Long> oldBusinessAssayTaskDataIdList = businessAssayTaskDataDOList.stream().filter(f -> f.getConfigAssayMethodId().equals(configAssayMethodId) && f.getBusinessSubParentSampleId().equals(businessSubParentSampleAssessment.getBusinessSubParentSampleId())).map(m -> m.getId()).collect(Collectors.toList());
//添加到删除列表
removeAssayTaskDataIdList.addAll(oldBusinessAssayTaskDataIdList);
//查询旧的子样判定
List<Long> oldBusinessSubSampleAssesmentIdList = businessSubSampleAssessmentDOList.stream().filter(f -> f.getConfigAssayMethodId().equals(configAssayMethodId) && f.getBusinessSubParentSampleId().equals(businessSubParentSampleAssessment.getBusinessSubParentSampleId())).map(m -> m.getId()).collect(Collectors.toList());
//添加到删除列表
removeSubSampleAssessmentIdList.addAll(oldBusinessSubSampleAssesmentIdList);
//添加到删除列表
removeSubParentSampleAssessmentIdList.add(businessSubParentSampleAssessment.getId());
} else {
List<String> projectShowNameList = changeConfigAssayMethodProjectList.stream().filter(f -> f.getConfigAssayMethodId().equals(configAssayMethodId)).map(m -> m.getDictionaryProjectShowName()).distinct().collect(Collectors.toList());
//查询旧的检测任务
List<BusinessAssayTaskDataDO> oldBusinessAssayTaskDataList = businessAssayTaskDataDOList.stream().filter(f -> f.getConfigAssayMethodId().equals(configAssayMethodId) && f.getBusinessSubParentSampleId().equals(businessSubParentSampleAssessment.getBusinessSubParentSampleId())).collect(Collectors.toList());
for (BusinessAssayTaskDataDO oldBusinessAssayTaskData : oldBusinessAssayTaskDataList) {
boolean isAdd = updateBusinessAssayTaskDataDOList.stream().anyMatch(m -> m.getId().equals(oldBusinessAssayTaskData.getId()));
if (!isAdd) {//如果未添加过更新,则修改检测项目并添加更新
oldBusinessAssayTaskData.setAssayProject(CollUtil.join(projectShowNameList, ","));
updateBusinessAssayTaskDataDOList.add(oldBusinessAssayTaskData);
}
}
}
BusinessAssayTaskDataDO oldBusinessAssayTaskDataDO = businessAssayTaskDataDOList.stream().filter(f -> f.getBusinessSubParentSampleId().equals(businessSubParentSampleAssessment.getBusinessSubParentSampleId())).findFirst().orElse(null);
//根据检测方法循环
BusinessAssayTaskDataDO businessAssayTaskDataDO = null;
//根据任务数循环
for (int i = 0; i < configSubSampleMethod.getTaskCount(); i++) {
//子样检测任务
businessAssayTaskDataDO = new BusinessAssayTaskDataDO();
businessAssayTaskDataDO.setId(IdWorker.getId());
businessAssayTaskDataDO.setBusinessBaseSampleId(businessSubSampleDO.getBusinessBaseSampleId());
businessAssayTaskDataDO.setBusinessSubParentSampleId(businessSubSampleDO.getBusinessSubParentSampleId());
businessAssayTaskDataDO.setBusinessSubSampleId(businessSubSampleDO.getId());
businessAssayTaskDataDO.setBusinessSubSampleAssessmentId(businessSubSampleAssessmentDO.getId());//子样判定id
businessAssayTaskDataDO.setConfigAssayMethodId(changeConfigAssayMethodId);
businessAssayTaskDataDO.setAssayType(assayType);
businessAssayTaskDataDO.setTaskType("常规");
businessAssayTaskDataDO.setConfigSampleFlowId(oldBusinessAssayTaskDataDO.getConfigSampleFlowId());
businessAssayTaskDataDO.setSampleFlowNodeKey(oldBusinessAssayTaskDataDO.getSampleFlowNodeKey());
businessAssayTaskDataDO.setSampleFlowNodeTime(currentDateTime);
businessAssayTaskDataDO.setAssayDepartmentId(configAssayMethodDO.getAssayDepartmentId());
businessAssayTaskDataDO.setAssayDepartmentName(configAssayMethodDO.getAssayDepartmentName());
List<ConfigAssayMethodProjectExtendRespVO> configAssayMethodProjectDOList = configAssayMethodProjectList.stream().filter(f -> f.getConfigAssayMethodId().equals(changeConfigAssayMethodId)).collect(Collectors.toList());
StringBuilder assayProjectBuilder = new StringBuilder();
for (ConfigAssayMethodProjectExtendRespVO configAssayMethodProjectDO : configAssayMethodProjectDOList) {
//如果当前分析方法的项目不在当前检测项目中,则跳出循环继续
if (!projectIdList.contains(configAssayMethodProjectDO.getDictionaryProjectId())) {
continue;
}
assayProjectBuilder.append(configAssayMethodProjectDO.getShowName()).append(",");
//检测项目
BusinessAssayProjectDataDO businessAssayProjectDataDO = new BusinessAssayProjectDataDO();
businessAssayProjectDataDO.setId(IdWorker.getId());
businessAssayProjectDataDO.setBusinessAssayTaskDataId(businessAssayTaskDataDO.getId());
businessAssayProjectDataDO.setConfigAssayMethodProjectId(configAssayMethodProjectDO.getId());
businessAssayProjectDataDO.setDictionaryProjectId(configAssayMethodProjectDO.getDictionaryProjectId());
businessAssayProjectDataDO.setDataType(configAssayMethodProjectDO.getDataType());
businessAssayProjectDataDO.setDecimalPosition(configAssayMethodProjectDO.getDecimalPosition());
businessAssayProjectDataDO.setUsage(QmsCommonConstant.ASSAY_PROJECT_USAGE_REPORT);
businessAssayProjectDataDO.setMinimumLimitValue(configAssayMethodProjectDO.getMinimumLimitValue());
businessAssayProjectDataDO.setIsEnabled(QmsCommonConstant.YES);
businessAssayProjectDataDO.setIsNotAssessment(QmsCommonConstant.NO);
saveBusinessAssayProjectDataDOList.add(businessAssayProjectDataDO);
List<ConfigAssayMethodProjectParameterDO> configAssayMethodProjectParameterDOList = configAssayMethodProjectParameterList.stream().filter(f -> f.getConfigAssayMethodProjectId().equals(configAssayMethodProjectDO.getId())).collect(Collectors.toList());
for (ConfigAssayMethodProjectParameterDO configAssayMethodProjectParameterDO : configAssayMethodProjectParameterDOList) {
BusinessAssayParameterDataDO businessAssayParameterDataDO = new BusinessAssayParameterDataDO();
businessAssayParameterDataDO.setId(IdWorker.getId());
businessAssayParameterDataDO.setConfigAssayMethodProjectParameterId(configAssayMethodProjectParameterDO.getId());
businessAssayParameterDataDO.setBusinessAssayProjectDataId(businessAssayProjectDataDO.getId());
businessAssayParameterDataDO.setDictionaryParameterId(configAssayMethodProjectParameterDO.getDictionaryParameterId());
businessAssayParameterDataDO.setDataType(configAssayMethodProjectParameterDO.getDataType());
businessAssayParameterDataDO.setDecimalPosition(configAssayMethodProjectParameterDO.getDecimalPosition());
saveBusinessAssayParameterDataDOList.add(businessAssayParameterDataDO);
}
}
if (assayProjectBuilder.length() > 1) {
assayProjectBuilder.delete(assayProjectBuilder.length() - 1 , assayProjectBuilder.length());
}
businessAssayTaskDataDO.setAssayProject(assayProjectBuilder.toString());
saveBusinessAssayTaskDataDOList.add(businessAssayTaskDataDO);
}
} else {//已存在
//分析类型
String changeAssayType = changeConfigAssayMethodProjectList.stream().filter(f -> f.getConfigAssayMethodId().equals(changeConfigAssayMethodId)).map(m -> m.getAssayType()).distinct().findFirst().orElse(null);
if (!businessSubParentSampleAssessmentDO.getAssayType().equals(changeAssayType)) {
String configAssayMethodNameAndCategory = changeConfigAssayMethodProjectList.stream().filter(f -> f.getConfigAssayMethodId().equals(changeConfigAssayMethodId)).map(m -> m.getConfigAssayMethodNameAndCategory()).distinct().findFirst().orElse(null);
throw new ServiceException(1_032_001_000, "检测方法“"+configAssayMethodNameAndCategory+"”,存在与当前分析类型不同的分析任务!");
}
//根据变更方法过滤出检测项目
List<Long> projectIdList = changeConfigAssayMethodProjectList.stream().filter(f -> f.getConfigAssayMethodId().equals(changeConfigAssayMethodId)).map(m -> m.getDictionaryProjectId()).distinct().collect(Collectors.toList());
//查询分析方法
//ConfigAssayMethodDO configAssayMethodDO = configAssayMethodDOList.stream().filter(f -> f.getId().equals(changeConfigAssayMethodId)).findFirst().orElse(null);
//查询子样分析方法
//ConfigSubSampleMethodExtendRespVO configSubSampleMethod = configSubSampleMethodList.stream().filter(f -> f.getConfigSubSampleParentId().equals(businessSubParentSampleAssessment.getConfigSubSampleParentId()) && f.getConfigAssayMethodId().equals(changeConfigAssayMethodId)).findFirst().orElse(null);
//根据任务数判断是平行还是
//String assayType = configSubSampleMethod.getTaskCount() > 1 ? QmsCommonConstant.ASSAY_TYPE_SINGLE_PARALLEL : QmsCommonConstant.ASSAY_TYPE_SINGLE_CUP;
//查询子样判定
//BusinessSubSampleAssessmentDO businessSubSampleAssessmentDO = businessSubSampleAssessmentMapper.selectByBusinessSubParentSampleIdAndConfigAssayMethodId(businessSubParentSampleAssessmentDO.getBusinessSubParentSampleId(), changeConfigAssayMethodId);
//查询旧的检测项目
List<Long> oldBusinessAssayProjectDataIdList = businessAssayProjectDataList.stream().filter(f -> projectIdList.contains(f.getDictionaryProjectId()) && f.getBusinessSubParentSampleId().equals(businessSubParentSampleAssessment.getBusinessSubParentSampleId())).map(m -> m.getId()).collect(Collectors.toList());
//添加到删除列表
removeAssayProjectIdList.addAll(oldBusinessAssayProjectDataIdList);
List<Long> oldBusinessAssayParameterDataIdList = businessAssayParameterDataDOList.stream().filter(f -> oldBusinessAssayProjectDataIdList.contains(f.getBusinessAssayProjectDataId())).map(m -> m.getId()).collect(Collectors.toList());
removeAssayParameterIdList.addAll(oldBusinessAssayParameterDataIdList);
if (projectIdList.size() == changeConfigAssayMethodProjectList.size()) {
//查询旧的检测任务
List<Long> oldBusinessAssayTaskDataIdList = businessAssayTaskDataDOList.stream().filter(f -> f.getConfigAssayMethodId().equals(configAssayMethodId) && f.getBusinessSubParentSampleId().equals(businessSubParentSampleAssessment.getBusinessSubParentSampleId())).map(m -> m.getId()).collect(Collectors.toList());
//添加到删除列表
removeAssayTaskDataIdList.addAll(oldBusinessAssayTaskDataIdList);
//查询旧的子样判定
List<Long> oldBusinessSubSampleAssesmentIdList = businessSubSampleAssessmentDOList.stream().filter(f -> f.getConfigAssayMethodId().equals(configAssayMethodId) && f.getBusinessSubParentSampleId().equals(businessSubParentSampleAssessment.getBusinessSubParentSampleId())).map(m -> m.getId()).collect(Collectors.toList());
//添加到删除列表
removeSubSampleAssessmentIdList.addAll(oldBusinessSubSampleAssesmentIdList);
//添加到删除列表
removeSubParentSampleAssessmentIdList.add(businessSubParentSampleAssessment.getId());
} else {
List<String> projectShowNameList = changeConfigAssayMethodProjectList.stream().filter(f -> f.getConfigAssayMethodId().equals(configAssayMethodId)).map(m -> m.getDictionaryProjectShowName()).distinct().collect(Collectors.toList());
//查询旧的检测任务
List<BusinessAssayTaskDataDO> oldBusinessAssayTaskDataList = businessAssayTaskDataDOList.stream().filter(f -> f.getConfigAssayMethodId().equals(configAssayMethodId) && f.getBusinessSubParentSampleId().equals(businessSubParentSampleAssessment.getBusinessSubParentSampleId())).collect(Collectors.toList());
for (BusinessAssayTaskDataDO oldBusinessAssayTaskData : oldBusinessAssayTaskDataList) {
boolean isAdd = updateBusinessAssayTaskDataDOList.stream().anyMatch(m -> m.getId().equals(oldBusinessAssayTaskData.getId()));
if (!isAdd) {//如果未添加过更新,则修改检测项目并添加更新
oldBusinessAssayTaskData.setAssayProject(CollUtil.join(projectShowNameList, ","));
updateBusinessAssayTaskDataDOList.add(oldBusinessAssayTaskData);
}
}
}
//查询当前存在的分析任务
List<BusinessAssayTaskDataDO> currBusinessAssayTaskDataDOList = businessAssayTaskDataMapper.selectByBusinessSubParentSampleIdAndConfigAssayMethodId(businessSubParentSampleAssessmentDO.getBusinessSubParentSampleId(), changeConfigAssayMethodId);
//当前存在的分析任务循环
for (BusinessAssayTaskDataDO businessAssayTaskDataDO : currBusinessAssayTaskDataDOList) {
List<ConfigAssayMethodProjectExtendRespVO> configAssayMethodProjectDOList = configAssayMethodProjectList.stream().filter(f -> f.getConfigAssayMethodId().equals(changeConfigAssayMethodId)).collect(Collectors.toList());
StringBuilder assayProjectBuilder = new StringBuilder(businessAssayTaskDataDO.getAssayProject());
assayProjectBuilder.append(",");
for (ConfigAssayMethodProjectExtendRespVO configAssayMethodProjectDO : configAssayMethodProjectDOList) {
//如果当前分析方法的项目不在当前检测项目中,则跳出循环继续
if (!projectIdList.contains(configAssayMethodProjectDO.getDictionaryProjectId())) {
continue;
}
assayProjectBuilder.append(configAssayMethodProjectDO.getShowName()).append(",");
//检测项目
BusinessAssayProjectDataDO businessAssayProjectDataDO = new BusinessAssayProjectDataDO();
businessAssayProjectDataDO.setId(IdWorker.getId());
businessAssayProjectDataDO.setBusinessAssayTaskDataId(businessAssayTaskDataDO.getId());
businessAssayProjectDataDO.setConfigAssayMethodProjectId(configAssayMethodProjectDO.getId());
businessAssayProjectDataDO.setDictionaryProjectId(configAssayMethodProjectDO.getDictionaryProjectId());
businessAssayProjectDataDO.setDataType(configAssayMethodProjectDO.getDataType());
businessAssayProjectDataDO.setDecimalPosition(configAssayMethodProjectDO.getDecimalPosition());
businessAssayProjectDataDO.setUsage(QmsCommonConstant.ASSAY_PROJECT_USAGE_REPORT);
businessAssayProjectDataDO.setMinimumLimitValue(configAssayMethodProjectDO.getMinimumLimitValue());
businessAssayProjectDataDO.setIsEnabled(QmsCommonConstant.YES);
businessAssayProjectDataDO.setIsNotAssessment(QmsCommonConstant.NO);
saveBusinessAssayProjectDataDOList.add(businessAssayProjectDataDO);
List<ConfigAssayMethodProjectParameterDO> configAssayMethodProjectParameterDOList = configAssayMethodProjectParameterList.stream().filter(f -> f.getConfigAssayMethodProjectId().equals(configAssayMethodProjectDO.getId())).collect(Collectors.toList());
for (ConfigAssayMethodProjectParameterDO configAssayMethodProjectParameterDO : configAssayMethodProjectParameterDOList) {
BusinessAssayParameterDataDO businessAssayParameterDataDO = new BusinessAssayParameterDataDO();
businessAssayParameterDataDO.setId(IdWorker.getId());
businessAssayParameterDataDO.setConfigAssayMethodProjectParameterId(configAssayMethodProjectParameterDO.getId());
businessAssayParameterDataDO.setBusinessAssayProjectDataId(businessAssayProjectDataDO.getId());
businessAssayParameterDataDO.setDictionaryParameterId(configAssayMethodProjectParameterDO.getDictionaryParameterId());
businessAssayParameterDataDO.setDataType(configAssayMethodProjectParameterDO.getDataType());
businessAssayParameterDataDO.setDecimalPosition(configAssayMethodProjectParameterDO.getDecimalPosition());
saveBusinessAssayParameterDataDOList.add(businessAssayParameterDataDO);
}
}
if (assayProjectBuilder.length() > 1) {
assayProjectBuilder.delete(assayProjectBuilder.length() - 1 , assayProjectBuilder.length());
}
businessAssayTaskDataDO.setAssayProject(assayProjectBuilder.toString());
updateBusinessAssayTaskDataDOList.add(businessAssayTaskDataDO);
}
}
}
}
}
//查询报表数据
List<BusinessAssayReportDataDO> businessAssayReportDataDOList = businessAssayReportDataMapper.selectBytBusinessBaseSampleIds(businessBaseSampleIdList);
for (BusinessAssayReportDataDO businessAssayReportDataDO : businessAssayReportDataDOList) {
String dataSource = businessAssayReportDataDO.getDataSource();
if (dataSource.contains(req.getConfigAssayMethodId().toString())) {//判定是否存在
List<Long> dataSourceList = new ArrayList<>();
String[] dataSourceSplit = dataSource.split(",");
for (int i = 0; i < dataSourceSplit.length; i++) {
dataSourceList.add(Long.parseLong(dataSourceSplit[i]));
}
//移除当前的
dataSourceList.remove(req.getConfigAssayMethodId());
//添加新的
dataSourceList.addAll(changeConfigAssayMethodIdList);
//重新赋值
businessAssayReportDataDO.setDataSource(CollUtil.join(dataSourceList, ","));
//添加到更新列表
updateBusinessAssayReportDataDOList.add(businessAssayReportDataDO);
}
}
//======================== 删除 =====================================================================
if (removeAssayTaskDataIdList.size() > 0) {
businessAssayTaskDataMapper.deleteByIds(removeAssayTaskDataIdList);
}
if (removeAssayProjectIdList.size() > 0) {
businessAssayProjectDataMapper.deleteByIds(removeAssayProjectIdList);
}
if (removeAssayParameterIdList.size() > 0) {
businessAssayParameterDataMapper.deleteByIds(removeAssayParameterIdList);
}
if (removeSubSampleAssessmentIdList.size() > 0) {
businessSubSampleAssessmentMapper.deleteByIds(removeSubSampleAssessmentIdList);
}
if (removeSubParentSampleAssessmentIdList.size() > 0) {
businessSubParentSampleAssessmentMapper.deleteByIds(removeSubParentSampleAssessmentIdList);
}
//======================== 修改 =====================================================================
if (updateBusinessAssayReportDataDOList.size() > 0) {
businessAssayReportDataMapper.updateBatch(updateBusinessAssayReportDataDOList);
}
if (updateBusinessAssayTaskDataDOList.size() > 0) {
businessAssayTaskDataMapper.updateBatch(updateBusinessAssayTaskDataDOList);
}
if (updateBusinessAssayProjectDataDOList.size() > 0) {
businessAssayProjectDataMapper.updateBatch(updateBusinessAssayProjectDataDOList);
}
if (updateBusinessAssayParameterDataDOList.size() > 0) {
businessAssayParameterDataMapper.updateBatch(updateBusinessAssayParameterDataDOList);
}
if (updateBusinessSubSampleAssessmentDOList.size() > 0) {
businessSubSampleAssessmentMapper.updateBatch(updateBusinessSubSampleAssessmentDOList);
}
if (updateBusinessSubParentSampleAssessmentDOList.size() > 0) {
businessSubParentSampleAssessmentMapper.updateBatch(updateBusinessSubParentSampleAssessmentDOList);
}
//======================== 新建 =====================================================================
if (saveBusinessAssayTaskDataDOList.size() > 0) {
businessAssayTaskDataMapper.insertBatch(saveBusinessAssayTaskDataDOList);
}
if (saveBusinessAssayProjectDataDOList.size() > 0) {
businessAssayProjectDataMapper.insertBatch(saveBusinessAssayProjectDataDOList);
}
if (saveBusinessAssayParameterDataDOList.size() > 0) {
businessAssayParameterDataMapper.insertBatch(saveBusinessAssayParameterDataDOList);
}
if (saveBusinessSubSampleAssessmentDOList.size() > 0) {
businessSubSampleAssessmentMapper.insertBatch(saveBusinessSubSampleAssessmentDOList);
}
if (saveBusinessSubParentSampleAssessmentDOList.size() > 0) {
businessSubParentSampleAssessmentMapper.insertBatch(saveBusinessSubParentSampleAssessmentDOList);
}
}
/**
@Override
@Transactional(rollbackFor = Exception.class)
public void changeMethod(ChangeAssayMethodReqVO req) {
@@ -699,7 +1204,8 @@ public class SampleTaskAssignServiceImpl implements SampleTaskAssignService {
}
**/
@Override
@Transactional(rollbackFor = Exception.class)
public LiteflowResponse methodAssign(SampleTaskAssignMethodParam param) {

View File

@@ -20,4 +20,7 @@ public class ConfigAssayMethodProjectExtendRespVO extends ConfigAssayMethodProje
@Schema(description = "显示名称")
private String showName;
@Schema(description = "分析类型 单杯-single_cup、双杯-double_cup、平行-single_parallel")
private String assayType;
}

View File

@@ -10,6 +10,9 @@ public class ConfigSubSampleMethodConfInfo {
/** 添加分析任务 **/
private ConfigSubSampleMethodConfAdd addAssayTask;
/** 分析方法参数设置值配置 **/
private List<ConfigSubSampleMethodConfItem> setParam;
/** 分析方法参数取值配置 **/
private List<ConfigSubSampleMethodConfItem> getParam;

View File

@@ -8,7 +8,10 @@ public class ConfigSubSampleMethodConfPoint {
/** 分析方法id **/
private Long methodId;
/** 检测项目 **/
/** 分析方法Key **/
private String methodKey;
/** 检测项目,多个以“,”号分割 **/
private String project;
/** 参数 **/

View File

@@ -97,5 +97,18 @@ public interface ConfigSubSampleMethodMapper extends BaseMapperX<ConfigSubSample
.selectAs(ConfigSubSampleParentMethodDO::getIsDefaultUse, ConfigSubSampleMethodExtendRespVO::getIsDefaultUse)
.in(ConfigSubSampleMethodDO::getConfigSubSampleId, configSubSampleIds));
}
default List<ConfigSubSampleMethodExtendRespVO> selectByBaseSampleId(Long baseSampleId) {
return selectJoinList(ConfigSubSampleMethodExtendRespVO.class, new MPJLambdaWrapperX<ConfigSubSampleMethodDO>()
.leftJoin(ConfigSubSampleParentMethodDO.class, ConfigSubSampleParentMethodDO::getId, ConfigSubSampleMethodDO::getConfigSubSampleParentMethodId)
.leftJoin(ConfigSubSampleDO.class, ConfigSubSampleDO::getId, ConfigSubSampleMethodDO::getConfigSubSampleId)
.selectAll(ConfigSubSampleMethodDO.class)
.selectAs(ConfigSubSampleParentMethodDO::getConfigAssayMethodId, ConfigSubSampleMethodExtendRespVO::getConfigAssayMethodId)
.selectAs(ConfigSubSampleParentMethodDO::getIsDefaultUse, ConfigSubSampleMethodExtendRespVO::getIsDefaultUse)
.selectAs(ConfigSubSampleDO::getConfigSubSampleParentId, ConfigSubSampleMethodExtendRespVO::getConfigSubSampleParentId)
.selectAs(ConfigSubSampleDO::getConfigBaseSampleId, ConfigSubSampleMethodExtendRespVO::getConfigBaseSampleId)
.selectAs(ConfigSubSampleDO::getBaseSampleId, ConfigSubSampleMethodExtendRespVO::getBaseSampleId)
.eq(ConfigSubSampleDO::getBaseSampleId, baseSampleId));
}
}

View File

@@ -93,15 +93,12 @@ public class MaterialBatchController implements BusinessControllerMarker {
@Operation(summary = "获得物料批次分页")
// @PreAuthorize("@ss.hasPermission('qms:material-batch:query')")
public CommonResult<PageResult<MaterialBatchRespVO>> getMaterialBatchPage(@Valid MaterialBatchPageReqVO pageReqVO) {
PageResult<MaterialBatchRespVO> pageResult = materialBatchService.getMaterialBatchPageWithPdtInfo(pageReqVO);
// return success(BeanUtils.toBean(pageResult, MaterialBatchRespVO.class));
return success(pageResult);
}
@GetMapping("/gong-page")
@Operation(summary = "获得批次工段分页")
public CommonResult<PageResult<MaterialBatchRespVO>> getMaterialBatchGongPage(@Valid MaterialBatchPageReqVO pageReqVO) {
PageResult<MaterialBatchRespVO> pageResult = materialBatchService.getMaterialBatchGongPageWithPdtInfo(pageReqVO);
PageResult<MaterialBatchRespVO> pageResult;
if (!pageReqVO.getOnlyGong()) {
pageResult = materialBatchService.getMaterialBatchPageWithPdtInfo(pageReqVO);
} else {
pageResult = materialBatchService.getMaterialBatchGongPageWithPdtInfo(pageReqVO);
}
return success(pageResult);
}

View File

@@ -52,16 +52,18 @@ public class MaterialLifecycleController extends AbstractFileUploadController im
@Resource
private MaterialLifecycleService materialLifecycleService;
// QMS_RESOURCE_MATERIAL_COMMON
@PostMapping("/create")
@Operation(summary = "新建物料流程")
// @PreAuthorize("@ss.hasPermission('t:material-lifecycle:create')")
// @PreAuthorize("@ss.hasPermission('qms:material-lifecycle:create')")
public CommonResult<MaterialLifecycleRespVO> createMaterialLifecycle(@Validated(AddGroup.class) @RequestBody MaterialLifecycleSaveReqVO createReqVO) {
return success(materialLifecycleService.createMaterialLifecycle(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新物料流程")
// @PreAuthorize("@ss.hasPermission('t:material-lifecycle:update')")
// @PreAuthorize("@ss.hasPermission('qms:material-lifecycle:update')")
public CommonResult<Boolean> updateMaterialLifecycle(@Validated(UpdateGroup.class) @RequestBody MaterialLifecycleSaveReqVO updateReqVO) {
materialLifecycleService.updateMaterialLifecycle(updateReqVO);
return success(true);
@@ -70,7 +72,7 @@ public class MaterialLifecycleController extends AbstractFileUploadController im
@DeleteMapping("/delete")
@Operation(summary = "删除物料流程")
@Parameter(name = "id", description = "编号", required = true)
// @PreAuthorize("@ss.hasPermission('t:material-lifecycle:delete')")
// @PreAuthorize("@ss.hasPermission('qms:material-lifecycle:delete')")
public CommonResult<Boolean> deleteMaterialLifecycle(@RequestParam("id") Long id) {
materialLifecycleService.deleteMaterialLifecycle(id);
return success(true);
@@ -86,25 +88,33 @@ public class MaterialLifecycleController extends AbstractFileUploadController im
}
@GetMapping("/get")
@Operation(summary = "获得物料通用流程")
@Operation(summary = "获得物料流程")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
// @PreAuthorize("@ss.hasPermission('t:material-lifecycle:query')")
// @PreAuthorize("@ss.hasPermission('qms:material-lifecycle:query')")
public CommonResult<MaterialLifecycleRespVO> getMaterialLifecycle(@RequestParam("id") Long id) {
MaterialLifecycleDO materialLifecycle = materialLifecycleService.getMaterialLifecycle(id);
return success(BeanUtils.toBean(materialLifecycle, MaterialLifecycleRespVO.class));
MaterialLifecycleRespVO lifecycleRespVO = materialLifecycleService.getMaterialLifecycle(id);
return success(lifecycleRespVO);
}
@GetMapping("/page")
@Operation(summary = "获得物料通用流程,物料验收、退换货分页")
@PreAuthorize("@ss.hasPermission('t:material-lifecycle:query')")
@Operation(summary = "获得物料流程分页")
// @PreAuthorize("@ss.hasPermission('qms:material-lifecycle:query')")
public CommonResult<PageResult<MaterialLifecycleRespVO>> getMaterialLifecyclePage(@Valid MaterialLifecyclePageReqVO pageReqVO) {
PageResult<MaterialLifecycleDO> pageResult = materialLifecycleService.getMaterialLifecyclePage(pageReqVO);
return success(BeanUtils.toBean(pageResult, MaterialLifecycleRespVO.class));
}
@PutMapping("/submit")
@Operation(summary = "提交(验收等流程)")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
public CommonResult<Boolean> submitLifecycle(@RequestParam("id") Long id) {
return success(materialLifecycleService.submitLifecycle(id));
}
@GetMapping("/export-excel")
@Operation(summary = "导出物料通用流程,物料验收、退换货 Excel")
@PreAuthorize("@ss.hasPermission('t:material-lifecycle:export')")
@PreAuthorize("@ss.hasPermission('qms:material-lifecycle:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportMaterialLifecycleExcel(@Valid MaterialLifecyclePageReqVO pageReqVO,
HttpServletResponse response) throws IOException {

View File

@@ -22,6 +22,9 @@ public class MaterialBatchPageReqVO extends PageParam {
@Schema(description = "是否需要组装 children")
private Boolean children = false;
@Schema(description = "是否只需要工段")
private Boolean onlyGong = false;
@Schema(description = "批次编号")
private String batchNo;

View File

@@ -5,6 +5,7 @@ import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - 物料通用流程明细 Response VO")
@@ -53,6 +54,10 @@ public class MaterialLifecycleDetailRespVO {
@ExcelProperty("批次工段-部门名称")
private String assignDepartmentName;
@Schema(description = "是否检化验,1-是0-否")
@ExcelProperty("是否检化验,1-是0-否")
private Integer assayFlag;
@Schema(description = "物料实例id", example = "968")
@ExcelProperty("物料实例id")
private Long infomationId;

View File

@@ -22,6 +22,9 @@ public class MaterialLifecycleDetailSaveReqVO {
@Schema(description = "批次工段id", example = "21334")
private Long batchGongduanId;
@Schema(description = "是否检化验,1-是0-否")
private Integer assayFlag;
@Schema(description = "物料实例id", example = "968")
private Long infomationId;

View File

@@ -44,7 +44,7 @@ public class MaterialLifecyclePageReqVO extends PageParam {
@Schema(description = "流程实例id", example = "12151")
private String flowInstanceId;
@Schema(description = "提交状态,提交状态,0-未提交1-已提交", example = "1")
@Schema(description = "提交状态,0-未提交1-已提交", example = "1")
private Integer submitStatus;
@Schema(description = "流程审批状态", example = "1")

View File

@@ -2,6 +2,7 @@ package com.zt.plat.module.qms.resource.material.controller.vo;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.zt.plat.module.qms.core.aspect.annotation.Dict;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@@ -63,6 +64,7 @@ public class MaterialLifecycleRespVO {
@Schema(description = "流程审批状态", example = "1")
@ExcelProperty("流程审批状态")
@Dict(dicCode = "flow_status")
private String flowStatus;
@Schema(description = "所属部门")

View File

@@ -23,29 +23,25 @@ public class MaterialLifecycleSaveReqVO {
private String title;
@Schema(description = "业务类型,【字典】【jy_material_lifecycle_bsn_type】验收、退换货、配置申请", example = "2")
@NotNull(groups = AddGroup.class, message = "业务类型不能为空")
private String businessType;
@Schema(description = "业务类型编码")
private String businessTypeCode;
@Schema(description = "申请人")
@NotNull(groups = AddGroup.class, message = "申请人不能为空")
private String applyUser;
@Schema(description = "申请人id", example = "4976")
@NotNull(groups = AddGroup.class, message = "申请人id 不能为空")
private Long applyUserId;
@Schema(description = "申请部门")
@NotNull(groups = AddGroup.class, message = "申请部门不能为空")
private String applyDepartment;
@Schema(description = "申请部门id", example = "19765")
@NotNull(groups = AddGroup.class, message = "申请部门id 不能为空")
private Long applyDepartmentId;
@Schema(description = "申请时间")
@NotNull(groups = AddGroup.class, message = "申请时间不能为空")
private LocalDateTime applyTime;
@Schema(description = "表单数据,表单数据")
@@ -67,6 +63,6 @@ public class MaterialLifecycleSaveReqVO {
private String remark;
@Schema(description = "工段列表")
private List<Long> gongIds;
private List<MaterialLifecycleDetailSaveReqVO> detailList;
}

View File

@@ -48,6 +48,11 @@ public class MaterialLifecycleDetailDO extends BusinessBaseDO {
*/
@TableField("BAT_GONG_ID")
private Long batchGongduanId;
/**
* 是否检化验,1-是0-否
*/
@TableField("ASY_FLG")
private Integer assayFlag;
/**
* 物料实例id
*/

View File

@@ -1,12 +1,13 @@
package com.zt.plat.module.qms.resource.material.dal.mapper;
import cn.hutool.core.collection.CollUtil;
import com.github.yulichang.base.MPJBaseMapper;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.framework.mybatis.core.query.MPJLambdaWrapperX;
import com.zt.plat.framework.security.core.LoginUser;
import com.zt.plat.framework.security.core.util.SecurityFrameworkUtils;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialBatchPageReqVO;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialBatchRespVO;
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialBatchDO;
@@ -42,18 +43,54 @@ public interface MaterialBatchMapper extends BaseMapperX<MaterialBatchDO> {
.orderByDesc(MaterialBatchDO::getId));
}
// onlyGong 是否只查询工段
default PageResult<MaterialBatchRespVO> selectPage(MaterialBatchPageReqVO reqVO, List<Long> pdtIds, Boolean onlyGong) {
default PageResult<MaterialBatchRespVO> selectPageWithPdtInfo(MaterialBatchPageReqVO reqVO, List<Long> pdtIds) {
MPJLambdaWrapper<MaterialBatchDO> wrapper = new MPJLambdaWrapperX<MaterialBatchDO>()
.selectAll(MaterialBatchDO.class)
.selectAs(MaterialProductDO::getName, MaterialBatchRespVO::getProductName)
.selectAs(MaterialProductDO::getCode, MaterialBatchRespVO::getProductCode)
.selectAs(MaterialProductDO::getModelNo, MaterialBatchRespVO::getProductModelNo)
.leftJoin(MaterialProductDO.class, MaterialProductDO::getId, MaterialBatchDO::getProductId)
// 只查询批次
.eq(MaterialBatchDO::getParentId, 0)
.in(CollUtil.isNotEmpty(pdtIds), MaterialBatchDO::getProductId, pdtIds)
.eq(CollUtil.isEmpty(pdtIds) && reqVO.getProductId() != null, MaterialBatchDO::getProductId, reqVO.getProductId())
.likeIfExists(MaterialBatchDO::getBatchNo, reqVO.getBatchNo())
.likeIfExists(MaterialBatchDO::getLocation, reqVO.getLocation())
.likeIfExists(MaterialBatchDO::getSupplierId, reqVO.getSupplierId())
// .betweenIfPresent(MaterialBatchDO::getManufacturerDate, reqVO.getManufacturerDate())
// .betweenIfPresent(MaterialBatchDO::getDueDate, reqVO.getDueDate())
.eqIfExists(MaterialBatchDO::getAssignDepartmentId, reqVO.getAssignDepartmentId())
.likeIfExists(MaterialBatchDO::getAssignDepartmentName, reqVO.getAssignDepartmentName())
.eqIfExists(MaterialBatchDO::getAcceptanceStatus, reqVO.getAcceptanceStatus())
.eqIfExists(MaterialBatchDO::getAssayFlag, reqVO.getAssayFlag())
.eqIfExists(MaterialBatchDO::getAssayStatus, reqVO.getAssayStatus())
.eqIfExists(MaterialBatchDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
.eqIfExists(MaterialBatchDO::getRemark, reqVO.getRemark())
// .betweenIfPresent(MaterialBatchDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(MaterialBatchDO::getId);
return selectJoinPage(reqVO, MaterialBatchRespVO.class, wrapper);
}
default PageResult<MaterialBatchRespVO> selectGongPage(MaterialBatchPageReqVO reqVO, List<Long> pdtIds) {
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
Long visitDeptId = null;
if (loginUser != null) {
visitDeptId = loginUser.getVisitDeptId();
}
MPJLambdaWrapper<MaterialBatchDO> wrapper = new MPJLambdaWrapperX<MaterialBatchDO>()
.selectAll(MaterialBatchDO.class)
.selectAs(MaterialProductDO::getName, MaterialBatchRespVO::getProductName)
.selectAs(MaterialProductDO::getCode, MaterialBatchRespVO::getProductCode)
.selectAs(MaterialProductDO::getModelNo, MaterialBatchRespVO::getProductModelNo)
.leftJoin(MaterialProductDO.class, MaterialProductDO::getId, MaterialBatchDO::getProductId)
// 只查询批次,不查询工段
.eq(onlyGong != null && !onlyGong, MaterialBatchDO::getParentId, 0)
// 只查询工段
.ne(onlyGong != null && onlyGong, MaterialBatchDO::getParentId, 0)
.ne(MaterialBatchDO::getParentId, 0)
.eq(MaterialBatchDO::getSubmitStatus, 1)
.notExists("SELECT 1 FROM t_mtrl_lfc_dtl ld WHERE ld.BAT_GONG_ID = t.id AND ld.DELETED = 0")
// .eq(onlyGong != null && visitDeptId != null && onlyGong, MaterialBatchDO::getAssignDepartmentId, visitDeptId)
.in(CollUtil.isNotEmpty(pdtIds), MaterialBatchDO::getProductId, pdtIds)
.eq(CollUtil.isEmpty(pdtIds) && reqVO.getProductId() != null, MaterialBatchDO::getProductId, reqVO.getProductId())
.likeIfExists(MaterialBatchDO::getBatchNo, reqVO.getBatchNo())

View File

@@ -1,12 +1,19 @@
package com.zt.plat.module.qms.resource.material.dal.mapper;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.framework.mybatis.core.query.MPJLambdaWrapperX;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLifecycleDetailPageReqVO;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLifecycleDetailRespVO;
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialBatchDO;
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialLifecycleDetailDO;
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialProductDO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 物料通用流程明细 Mapper
*
@@ -32,4 +39,19 @@ public interface MaterialLifecycleDetailMapper extends BaseMapperX<MaterialLifec
.orderByDesc(MaterialLifecycleDetailDO::getId));
}
default List<MaterialLifecycleDetailRespVO> selectListWithPdtBatInfo(Long id){
MPJLambdaWrapper<MaterialLifecycleDetailDO> wrapper = new MPJLambdaWrapper<MaterialLifecycleDetailDO>()
.selectAll(MaterialLifecycleDetailDO.class)
.selectAs(MaterialProductDO::getName, MaterialLifecycleDetailRespVO::getProductName)
.selectAs(MaterialProductDO::getCode, MaterialLifecycleDetailRespVO::getProductCode)
.selectAs(MaterialProductDO::getModelNo, MaterialLifecycleDetailRespVO::getProductModelNo)
.selectAs("batch.BAT_NO", MaterialLifecycleDetailRespVO::getBatchNo)
.selectAs("gongduan.INB_QTY", MaterialLifecycleDetailRespVO::getInfluenceCount)
.leftJoin(MaterialProductDO.class, MaterialProductDO::getId, MaterialLifecycleDetailDO::getProductId)
.leftJoin(MaterialBatchDO.class, "batch", MaterialBatchDO::getId, MaterialLifecycleDetailDO::getBatchId)
.leftJoin(MaterialBatchDO.class, "gongduan", MaterialBatchDO::getId, MaterialLifecycleDetailDO::getBatchGongduanId)
.eq(MaterialLifecycleDetailDO::getLifecycleId, id);
return selectJoinList(MaterialLifecycleDetailRespVO.class, wrapper);
}
}

View File

@@ -17,15 +17,15 @@ public interface MaterialLifecycleMapper extends BaseMapperX<MaterialLifecycleDO
default PageResult<MaterialLifecycleDO> selectPage(MaterialLifecyclePageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<MaterialLifecycleDO>()
.eqIfPresent(MaterialLifecycleDO::getTitle, reqVO.getTitle())
.likeIfPresent(MaterialLifecycleDO::getTitle, reqVO.getTitle())
.eqIfPresent(MaterialLifecycleDO::getBusinessType, reqVO.getBusinessType())
.eqIfPresent(MaterialLifecycleDO::getBusinessTypeCode, reqVO.getBusinessTypeCode())
.eqIfPresent(MaterialLifecycleDO::getApplyUser, reqVO.getApplyUser())
.likeIfPresent(MaterialLifecycleDO::getApplyUser, reqVO.getApplyUser())
.eqIfPresent(MaterialLifecycleDO::getApplyUserId, reqVO.getApplyUserId())
.eqIfPresent(MaterialLifecycleDO::getApplyDepartment, reqVO.getApplyDepartment())
.likeIfPresent(MaterialLifecycleDO::getApplyDepartment, reqVO.getApplyDepartment())
.eqIfPresent(MaterialLifecycleDO::getApplyDepartmentId, reqVO.getApplyDepartmentId())
.betweenIfPresent(MaterialLifecycleDO::getApplyTime, reqVO.getApplyTime())
.eqIfPresent(MaterialLifecycleDO::getFormData, reqVO.getFormData())
.likeIfPresent(MaterialLifecycleDO::getFormData, reqVO.getFormData())
.eqIfPresent(MaterialLifecycleDO::getFlowInstanceId, reqVO.getFlowInstanceId())
.eqIfPresent(MaterialLifecycleDO::getSubmitStatus, reqVO.getSubmitStatus())
.eqIfPresent(MaterialLifecycleDO::getFlowStatus, reqVO.getFlowStatus())

View File

@@ -1,20 +1,15 @@
package com.zt.plat.module.qms.resource.material.service;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.zt.plat.framework.common.exception.ErrorCode;
import com.zt.plat.framework.common.exception.ServiceException;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.common.util.object.BeanUtils;
import com.zt.plat.module.qms.core.code.SequenceUtil;
import com.zt.plat.module.qms.enums.ErrorCodeConstants;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialBatchPageReqVO;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialBatchRespVO;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialBatchSaveReqVO;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialProductRespVO;
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialBatchDO;
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialInfomationDO;
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialProductDO;
import com.zt.plat.module.qms.resource.material.dal.mapper.MaterialBatchMapper;
import jakarta.annotation.Resource;
@@ -24,8 +19,6 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
@@ -71,12 +64,10 @@ public class MaterialBatchServiceImpl implements MaterialBatchService {
public void updateMaterialBatch(MaterialBatchSaveReqVO updateReqVO) {
// 校验存在
Long reqId = updateReqVO.getId();
validateMaterialBatchExists(reqId);
// 已经拆分工段的不可编辑
List<MaterialBatchDO> asnDOs = materialBatchMapper.selectList(Wrappers.lambdaQuery(MaterialBatchDO.class)
.eq(MaterialBatchDO::getParentId, reqId));
if (CollUtil.isNotEmpty(asnDOs)) throw exception(MATERIAL_BATCH_ASSIGN_END);
MaterialBatchDO batchDO = materialBatchMapper.selectById(reqId);
if (batchDO == null) throw exception(MATERIAL_BATCH_NOT_EXISTS);
// 已经提交的不可修改
if (batchDO.getSubmitStatus() == 1) throw new ServiceException(1_032_160_000, "批次已经提交,不可修改");
// 更新
MaterialBatchDO updateObj = BeanUtils.toBean(updateReqVO, MaterialBatchDO.class);
@@ -137,9 +128,20 @@ public class MaterialBatchServiceImpl implements MaterialBatchService {
@Override
public PageResult<MaterialBatchRespVO> getMaterialBatchPageWithPdtInfo(MaterialBatchPageReqVO pageReqVO) {
// 先分页查询批次
PageResult<MaterialBatchRespVO> pageResult = getMaterialBatchRespVOPageWithPdtInfo(pageReqVO, false);
// 再获取工段
Long pdtId = pageReqVO.getProductId();
PageResult<MaterialBatchRespVO> pageResult;
if (pdtId == null) {
pageResult = materialBatchMapper.selectPageWithPdtInfo(pageReqVO, List.of());
} else {
List<MaterialProductDO> mtrlDos = materialProductService.getMaterialProductsByLikeIdPath(pdtId);
if (CollUtil.isEmpty(mtrlDos)) {
pageResult = materialBatchMapper.selectPageWithPdtInfo(pageReqVO, List.of());
} else {
List<Long> pdtIds = mtrlDos.stream().map(MaterialProductDO::getId).toList();
pageResult = materialBatchMapper.selectPageWithPdtInfo(pageReqVO, pdtIds);
}
}
// 如果获取是批次分页再根据批次ids获取工段
List<MaterialBatchRespVO> batches = pageResult.getList();
if (CollUtil.isNotEmpty(batches)) {
List<Long> batIds = batches.stream().map(MaterialBatchRespVO::getId).toList();
@@ -178,7 +180,7 @@ public class MaterialBatchServiceImpl implements MaterialBatchService {
// 2. 拆分后的数量要相等
MaterialBatchDO mtrlBat = materialBatchMapper.selectById(batId);
if (mtrlBat == null) throw exception(MATERIAL_BATCH_NOT_EXISTS);
if (mtrlBat.getSubmitStatus() == 1) throw new ServiceException(1_032_160_000, "批次已经提交,不可修改");
BigDecimal total = BigDecimal.valueOf(0);
for (MaterialBatchSaveReqVO batAsn : createReqVOs) {
total = total.add(batAsn.getInboundQuantity());
@@ -189,7 +191,6 @@ public class MaterialBatchServiceImpl implements MaterialBatchService {
boolean exists = materialBatchMapper.exists(Wrappers.lambdaQuery(MaterialBatchDO.class)
.eq(MaterialBatchDO::getParentId, batId));
if (exists) {
if (mtrlBat.getSubmitStatus() == 1) throw new ServiceException(1_032_160_000, "批次已经提交,禁止修改");
// 删除之前的拆分数据
materialBatchMapper.delete(Wrappers.lambdaQuery(MaterialBatchDO.class)
.eq(MaterialBatchDO::getParentId, batId));
@@ -235,6 +236,7 @@ public class MaterialBatchServiceImpl implements MaterialBatchService {
.ne(MaterialBatchDO::getParentId, 0));
}
@Transactional
@Override
public Boolean submitMaterialBatch(Long id) {
MaterialBatchDO batchDO = materialBatchMapper.selectById(id);
@@ -245,6 +247,10 @@ public class MaterialBatchServiceImpl implements MaterialBatchService {
if (!exists) throw new ServiceException(1_032_160_000, "批次还未拆分,不可提交");
batchDO.setSubmitStatus(1);
materialBatchMapper.updateById(batchDO);
// 提交工段
MaterialBatchDO updateBatch = new MaterialBatchDO().setSubmitStatus(1);
materialBatchMapper.update(updateBatch, Wrappers.lambdaQuery(MaterialBatchDO.class)
.eq(MaterialBatchDO::getParentId, id));
return true;
}
@@ -259,22 +265,18 @@ public class MaterialBatchServiceImpl implements MaterialBatchService {
@Override
public PageResult<MaterialBatchRespVO> getMaterialBatchGongPageWithPdtInfo(MaterialBatchPageReqVO pageReqVO) {
return getMaterialBatchRespVOPageWithPdtInfo(pageReqVO, true);
}
private PageResult<MaterialBatchRespVO> getMaterialBatchRespVOPageWithPdtInfo(MaterialBatchPageReqVO pageReqVO, boolean onlyGong) {
// 需要排除已经被选择的工段
Long pdtId = pageReqVO.getProductId();
PageResult<MaterialBatchRespVO> pageResult;
if (pdtId == null) {
pageResult = materialBatchMapper.selectPage(pageReqVO, List.of(), onlyGong);
pageResult = materialBatchMapper.selectGongPage(pageReqVO, List.of());
} else {
List<MaterialProductDO> mtrlDos = materialProductService.getMaterialProductsByLikeIdPath(pdtId);
if (CollUtil.isEmpty(mtrlDos)) {
pageResult = materialBatchMapper.selectPage(pageReqVO, List.of(), onlyGong);
pageResult = materialBatchMapper.selectGongPage(pageReqVO, List.of());
} else {
List<Long> pdtIds = mtrlDos.stream().map(MaterialProductDO::getId).toList();
pageResult = materialBatchMapper.selectPage(pageReqVO, pdtIds, onlyGong);
pageResult = materialBatchMapper.selectGongPage(pageReqVO, pdtIds);
}
}
return pageResult;

View File

@@ -81,4 +81,12 @@ public interface MaterialLifecycleDetailService {
* @param ids 流程ids
*/
void deleteLifecycleDetailListByLfcIds(List<Long> ids);
/**
* 根据流程id 获取流程明细数据
*
* @param id 流程id
* @return 明细列表
*/
List<MaterialLifecycleDetailRespVO> getMaterialLifecycleDetailListByLfcId(Long id);
}

View File

@@ -106,4 +106,10 @@ public class MaterialLifecycleDetailServiceImpl implements MaterialLifecycleDeta
.in(MaterialLifecycleDetailDO::getLifecycleId, ids));
}
@Override
public List<MaterialLifecycleDetailRespVO> getMaterialLifecycleDetailListByLfcId(Long id) {
return materialLifecycleDetailMapper.selectListWithPdtBatInfo(id);
}
}

View File

@@ -51,7 +51,7 @@ public interface MaterialLifecycleService {
* @param id 编号
* @return 物料通用流程,物料验收、退换货
*/
MaterialLifecycleDO getMaterialLifecycle(Long id);
MaterialLifecycleRespVO getMaterialLifecycle(Long id);
/**
* 获得物料通用流程,物料验收、退换货分页
@@ -61,4 +61,11 @@ public interface MaterialLifecycleService {
*/
PageResult<MaterialLifecycleDO> getMaterialLifecyclePage(MaterialLifecyclePageReqVO pageReqVO);
/**
* 提交(验收等流程)
*
* @param id 编号
* @return 是否成功
*/
Boolean submitLifecycle(Long id);
}

View File

@@ -1,40 +1,59 @@
package com.zt.plat.module.qms.resource.material.service;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSONObject;
import com.zt.plat.framework.common.exception.ServiceException;
import com.zt.plat.framework.common.pojo.CommonResult;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.common.util.object.BeanUtils;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLifecyclePageReqVO;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLifecycleRespVO;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLifecycleSaveReqVO;
import com.zt.plat.framework.security.core.LoginUser;
import com.zt.plat.framework.security.core.util.SecurityFrameworkUtils;
import com.zt.plat.module.bpm.api.task.BpmProcessInstanceApi;
import com.zt.plat.module.bpm.api.task.BpmTaskApi;
import com.zt.plat.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO;
import com.zt.plat.module.bpm.api.task.dto.BpmTaskApproveReqDTO;
import com.zt.plat.module.bpm.api.task.dto.BpmTaskRespDTO;
import com.zt.plat.module.qms.api.task.BMPCallbackInterface;
import com.zt.plat.module.qms.api.task.dto.QmsBpmDTO;
import com.zt.plat.module.qms.enums.QmsCommonConstant;
import com.zt.plat.module.qms.resource.material.controller.vo.*;
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialBatchDO;
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialLifecycleDO;
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialLifecycleDetailDO;
import com.zt.plat.module.qms.resource.material.dal.mapper.MaterialLifecycleMapper;
import jakarta.annotation.Resource;
import org.jspecify.annotations.NonNull;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception0;
import static com.zt.plat.module.qms.enums.ErrorCodeConstants.ERROR_CODE_MODULE_COMMON;
import static com.zt.plat.module.qms.enums.ErrorCodeConstants.MATERIAL_LIFECYCLE_NOT_EXISTS;
import static com.zt.plat.module.qms.enums.QmsBpmConstant.BPM_CALLBACK_BEAN_NAME;
/**
* 物料通用流程,物料验收、退换货 Service 实现类
*
* @author 后台管理
*/
@Service
@Slf4j
@Service("materialLifecycleService")
@Validated
public class MaterialLifecycleServiceImpl implements MaterialLifecycleService {
public class MaterialLifecycleServiceImpl implements MaterialLifecycleService , BMPCallbackInterface {
@Resource
private MaterialLifecycleMapper materialLifecycleMapper;
@@ -45,20 +64,40 @@ public class MaterialLifecycleServiceImpl implements MaterialLifecycleService {
@Autowired
private MaterialLifecycleDetailService materialLifecycleDetailService;
@Autowired
private BpmTaskApi bpmTaskApi;
@Autowired
private BpmProcessInstanceApi bpmProcessInstanceApi;
@Transactional
@Override
public MaterialLifecycleRespVO createMaterialLifecycle(MaterialLifecycleSaveReqVO createReqVO) {
// 插入
MaterialLifecycleDO mtrlLfc = BeanUtils.toBean(createReqVO, MaterialLifecycleDO.class);
mtrlLfc.setSubmitStatus(0);
String loginUserNickname = SecurityFrameworkUtils.getLoginUserNickname();
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
if (loginUser == null) throw new ServiceException(1_032_160_000, "登录用户不存在");
mtrlLfc.setApplyUser(loginUserNickname)
.setApplyUserId(loginUser.getId())
.setApplyDepartment(loginUser.getVisitDeptName())
.setApplyDepartmentId(loginUser.getVisitDeptId());
mtrlLfc.setFlowStatus(QmsCommonConstant.NOT_START);
materialLifecycleMapper.insert(mtrlLfc);
List<Long> gongIds = createReqVO.getGongIds();
if (CollUtil.isEmpty(gongIds))
List<MaterialLifecycleDetailSaveReqVO> detailList = createReqVO.getDetailList();
if (CollUtil.isEmpty(detailList))
return BeanUtils.toBean(mtrlLfc, MaterialLifecycleRespVO.class);
// 保存工段明细
List<Long> gongIds = detailList.stream().map(MaterialLifecycleDetailSaveReqVO::getBatchGongduanId).toList();
Map<Long, Integer> gongAssayMap = detailList.stream().collect(Collectors.toMap(
MaterialLifecycleDetailSaveReqVO::getBatchGongduanId, MaterialLifecycleDetailSaveReqVO::getAssayFlag));
List<MaterialBatchDO> gongs = materialBatchService.getGongduanListByGongIds(gongIds);
if (CollUtil.isEmpty(gongs) || gongs.size() != gongIds.size())
throw new ServiceException(1_032_160_000, "工段不存在或与传入的工段数量不匹配");
for (MaterialBatchDO gong : gongs) {
gong.setAssayFlag(gongAssayMap.get(gong.getId()));
}
List<MaterialLifecycleDetailDO> detailDOS = getLifecycleDetailDOsByGongs(gongs, gongIds, mtrlLfc);
materialLifecycleDetailService.saveBatch(detailDOS);
return BeanUtils.toBean(mtrlLfc, MaterialLifecycleRespVO.class);
@@ -76,6 +115,7 @@ public class MaterialLifecycleServiceImpl implements MaterialLifecycleService {
detailDO.setLifecycleId(mtrlLfc.getId())
.setProductId(gong.getProductId()).setBatchId(gong.getParentId())
.setBatchGongduanId(gong.getId())
.setAssayFlag(gong.getAssayFlag())
.setTreatmentStatus(0);
return detailDO;
}).toList();
@@ -88,21 +128,28 @@ public class MaterialLifecycleServiceImpl implements MaterialLifecycleService {
MaterialLifecycleDO lifecycleDO = materialLifecycleMapper.selectById(reqId);
if (lifecycleDO == null) throw exception(MATERIAL_LIFECYCLE_NOT_EXISTS);
if (lifecycleDO.getSubmitStatus() == 1) throw new ServiceException(1_032_160_000, "流程已提交,不可修改");
List<Long> gongIds = updateReqVO.getGongIds();
List<MaterialLifecycleDetailSaveReqVO> detailList = updateReqVO.getDetailList();
// 更新
MaterialLifecycleDO mtrlLfc = BeanUtils.toBean(updateReqVO, MaterialLifecycleDO.class);
if (CollUtil.isEmpty(gongIds)) {
if (CollUtil.isEmpty(detailList)) {
materialLifecycleMapper.updateById(mtrlLfc);
return;
}
// 删除原来的明细
materialLifecycleDetailService.deleteLifecycleDetailListByLfcId(reqId);
List<Long> gongIds = detailList.stream().map(MaterialLifecycleDetailSaveReqVO::getBatchGongduanId).toList();
Map<Long, Integer> gongAssayMap = detailList.stream().collect(Collectors.toMap(
MaterialLifecycleDetailSaveReqVO::getBatchGongduanId, MaterialLifecycleDetailSaveReqVO::getAssayFlag));
List<MaterialBatchDO> gongs = materialBatchService.getGongduanListByGongIds(gongIds);
if (CollUtil.isEmpty(gongs) || gongs.size() != gongIds.size())
throw new ServiceException(1_032_160_000, "工段不存在或与传入的工段数量不匹配");
for (MaterialBatchDO gong : gongs) {
gong.setAssayFlag(gongAssayMap.get(gong.getId()));
}
// 保存新的明细
List<MaterialLifecycleDetailDO> detailDOS = getLifecycleDetailDOsByGongs(gongs, gongIds, mtrlLfc);
materialLifecycleDetailService.saveBatch(detailDOS);
materialLifecycleMapper.updateById(mtrlLfc);
}
@Transactional
@@ -150,13 +197,146 @@ public class MaterialLifecycleServiceImpl implements MaterialLifecycleService {
}
@Override
public MaterialLifecycleDO getMaterialLifecycle(Long id) {
return materialLifecycleMapper.selectById(id);
public MaterialLifecycleRespVO getMaterialLifecycle(Long id) {
MaterialLifecycleDO lifecycleDO = materialLifecycleMapper.selectById(id);
if (lifecycleDO == null) return null;
MaterialLifecycleRespVO respVO = BeanUtils.toBean(lifecycleDO, MaterialLifecycleRespVO.class);
// 获取明细
List<MaterialLifecycleDetailRespVO> detailRespVOS = materialLifecycleDetailService.getMaterialLifecycleDetailListByLfcId(id);
respVO.setDetailList(detailRespVOS);
return respVO;
}
@Override
public PageResult<MaterialLifecycleDO> getMaterialLifecyclePage(MaterialLifecyclePageReqVO pageReqVO) {
return materialLifecycleMapper.selectPage(pageReqVO);
PageResult<MaterialLifecycleDO> pageResult = materialLifecycleMapper.selectPage(pageReqVO);
List<MaterialLifecycleDO> list = pageResult.getList();
if (CollUtil.isEmpty(list)) return pageResult;
list.forEach(mtrlLfc -> {
String formData = mtrlLfc.getFormData();
if (formData != null) {
String title = (String) JSONUtil.parseObj(formData).get("title");
mtrlLfc.setTitle(title);
}
});
pageResult.setList(list);
return pageResult;
}
@Override
public Boolean submitLifecycle(Long id) {
MaterialLifecycleDO lifecycleDO = materialLifecycleMapper.selectById(id);
if (lifecycleDO == null) throw exception(MATERIAL_LIFECYCLE_NOT_EXISTS);
Integer submitStatus = lifecycleDO.getSubmitStatus();
if (submitStatus == 1) throw new ServiceException(1_032_160_000, "申请已经提交过");
lifecycleDO.setApplyTime(LocalDateTime.now());
// 发起流程
this.createProcessInstance(lifecycleDO);
lifecycleDO.setSubmitStatus(1);
materialLifecycleMapper.updateById(lifecycleDO);
return true;
}
private void createProcessInstance(MaterialLifecycleDO lifecycleDO) {
String flowInstanceId = lifecycleDO.getFlowInstanceId();
// 流程已经发起过
if (StrUtil.isNotEmpty(flowInstanceId)) {
CommonResult<List<BpmTaskRespDTO>> taskRet = bpmTaskApi.getTaskListByProcessInstanceId(flowInstanceId);
List<BpmTaskRespDTO> taskList = taskRet.getData();
if(CollUtil.isEmpty(taskList))
throw exception0(ERROR_CODE_MODULE_COMMON, "流程任务查询失败,请联系管理员处理");
String taskId = taskList.get(taskList.size() - 1).getId();
//驳回后重新提交
BpmTaskApproveReqDTO reqVO = new BpmTaskApproveReqDTO();
reqVO.setId(taskId);
CommonResult<Boolean> result = bpmProcessInstanceApi.approveTask(reqVO);
if(!result.isSuccess()){
throw exception0(ERROR_CODE_MODULE_COMMON, result.getMsg());
}
lifecycleDO.setFlowStatus(QmsCommonConstant.IN_PROGRESS);
return;
}
// 发起流程
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
if (loginUser == null) return;
String loginUserNickname = SecurityFrameworkUtils.getLoginUserNickname();
Long loginUserId = loginUser.getId();
Map<String, Object> variables = new HashMap<>();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
variables.put("mainId", lifecycleDO.getId());
variables.put("applyUser", loginUserNickname);
variables.put("applyUserId", loginUserId);
variables.put("applyDepartment", loginUser.getVisitDeptName());
variables.put("applyDepartmentId", loginUser.getVisitDeptId());
variables.put("applyTime", sdf.format(new Date()));
variables.put(BPM_CALLBACK_BEAN_NAME, "materialLifecycleService");
BpmProcessInstanceCreateReqDTO reqDTO = new BpmProcessInstanceCreateReqDTO();
reqDTO.setBusinessKey(String.valueOf(lifecycleDO.getId()))
.setVariables(variables);
// switch (lifecycleDO.getBusinessType()) {
// case "验收":
// reqDTO.setProcessDefinitionKey("MATERIAL_ACCEPTANCE_FLOW_KEY");
// break;
// case "退换货":
// reqDTO.setProcessDefinitionKey("MATERIAL_RETURN_EXCHANGE_FLOW_KEY");
// break;
// case "配置申请":
// reqDTO.setProcessDefinitionKey("MATERIAL_CONFIG_APPLY_FLOW_KEY");
// break;
// }
reqDTO.setProcessDefinitionKey("QMS_RESOURCE_MATERIAL_COMMON");
CommonResult<String> result = bpmProcessInstanceApi.createProcessInstance(loginUserId, reqDTO);
if(!result.isSuccess()){
throw exception0(ERROR_CODE_MODULE_COMMON, result.getMsg());
}
lifecycleDO.setFlowInstanceId(result.getData());
lifecycleDO.setFlowStatus(QmsCommonConstant.IN_PROGRESS);
lifecycleDO.setApplyUser(loginUserNickname)
.setApplyUserId(loginUserId)
.setApplyDepartment(loginUser.getVisitDeptName())
.setApplyDepartmentId(loginUser.getVisitDeptId());
}
/**
* 流程回调处理
*
*/
@Override
public CommonResult<JSONObject> callback(QmsBpmDTO reqDTO) {
log.info("物料流程回调信息:{}", reqDTO.toString());
/*
QmsBpmDTO(
processInstanceId=042585c1-00e3-11f1-9df0-005056c00001,
businessKey=2018618104343769090,
variables={
"_FLOWABLE_SKIP_EXPRESSION_ENABLED":true,
"processInstanceId":"042585c1-00e3-11f1-9df0-005056c00001",
"nrOfActiveInstances":1,
"bpmFieldExtensions":[],
"PROCESS_STATUS":1,
"currentActivityInsId":"043c904a-00e3-11f1-9df0-005056c00001",
"bpmCallbackBean":"materialLifecycleService",
"applyDepartment":"检验检测管理中心",
"Activity_0tp833v_assignees":["2008359763063820290"],
"loopCounter":0,
"applyUserId":"2008359763063820290",
"nrOfInstances":1,
"PROCESS_START_USER_ID":"2008359763063820290",
"applyUser":"云铜检验管理员",
"Activity_0tp833v_assignee":"2008359763063820290",
"applyDepartmentId":170,
"applyTime":"2026-02-03 17:30:44",
"mainId":"2018618104343769090",
"bpmCallbackActivityId":"Activity_0tp833v",
"nrOfCompletedInstances":1
},
state=)
*/
// 变更流程状态
return null;
}
}

View File

@@ -154,13 +154,18 @@ public class AutoIngredientsServiceImpl implements AutoIngredientsService {
for (ConfigSubSampleMethodConfItem configSubSampleMethodConfItem : downIngredients) {
if (configSubSampleMethodConfItem.getRequired()) {
ConfigSubSampleMethodConfPoint source = configSubSampleMethodConfItem.getSource();
String project = source.getProject();
String parameter = source.getParameter();
BusinessAssayProjectDataExtendRespVO currentBusinessAssayProjectData = currentBusinessAssayProjectDataList.stream().filter(f -> f.getSimpleName().equals(project)).findFirst().orElse(null);
BusinessAssayParameterDataExtendRespVO currentBusinessAssayParameterData = businessAssayParameterDataList.stream().filter(f -> f.getBusinessAssayProjectDataId().equals(currentBusinessAssayProjectData.getId()) && f.getParameterKey().equals(parameter)).findFirst().orElse(null);
ConfigSubSampleMethodConfPoint target = configSubSampleMethodConfItem.getTarget();
String field = target.getField();
BeanUtil.setFieldValue(autoIngredientsTaskDetailRespVO, field, currentBusinessAssayParameterData.getValue());
List<String> projectList = Arrays.asList(source.getProject().split(","));//来源可以有多个
for (String project : projectList) {
String parameter = source.getParameter();
BusinessAssayProjectDataExtendRespVO currentBusinessAssayProjectData = currentBusinessAssayProjectDataList.stream().filter(f -> f.getSimpleName().equals(project)).findFirst().orElse(null);
BusinessAssayParameterDataExtendRespVO currentBusinessAssayParameterData = businessAssayParameterDataList.stream().filter(f -> f.getBusinessAssayProjectDataId().equals(currentBusinessAssayProjectData.getId()) && f.getParameterKey().equals(parameter)).findFirst().orElse(null);
if (StringUtils.isNotBlank(currentBusinessAssayParameterData.getValue())) {
ConfigSubSampleMethodConfPoint target = configSubSampleMethodConfItem.getTarget();
String field = target.getField();
BeanUtil.setFieldValue(autoIngredientsTaskDetailRespVO, field, currentBusinessAssayParameterData.getValue());
break;
}
}
}
}
}
@@ -239,19 +244,19 @@ public class AutoIngredientsServiceImpl implements AutoIngredientsService {
// System.out.println("fieldValue:" + fieldValue);
ConfigSubSampleMethodConfPoint target = configSubSampleMethodConfItem.getTarget();
String project = target.getProject();
BusinessAssayProjectDataExtendRespVO currentBusinessAssayProjectData = businessAssayProjectDataList.stream().filter(f -> f.getBusinessAssayTaskDataId().equals(autoIngredientsTaskDetailAssayResultReqVO.getId()) && f.getSimpleName().equals(project)).findFirst().orElse(null);
String parameter = target.getParameter();
if (StringUtils.isBlank(parameter)) {
currentBusinessAssayProjectData.setValue(fieldValue.toString());
updateBusinessAssayProjectDataDOList.add(BeanUtils.toBean(currentBusinessAssayProjectData, BusinessAssayProjectDataDO.class));
} else {
BusinessAssayParameterDataExtendRespVO currentBusinessAssayParameterData = businessAssayParameterDataList.stream().filter(f -> f.getBusinessAssayProjectDataId().equals(currentBusinessAssayProjectData.getId()) && f.getParameterKey().equals(parameter)).findFirst().orElse(null);
currentBusinessAssayParameterData.setValue(fieldValue.toString());
updateBusinessAssayParameterDataDOList.add(BeanUtils.toBean(currentBusinessAssayParameterData, BusinessAssayParameterDataDO.class));
List<String> projectList = Arrays.asList(target.getProject().split(","));//目标可以有多个
for (String project : projectList) {
BusinessAssayProjectDataExtendRespVO currentBusinessAssayProjectData = businessAssayProjectDataList.stream().filter(f -> f.getBusinessAssayTaskDataId().equals(autoIngredientsTaskDetailAssayResultReqVO.getId()) && f.getSimpleName().equals(project)).findFirst().orElse(null);
String parameter = target.getParameter();
if (StringUtils.isBlank(parameter)) {
currentBusinessAssayProjectData.setValue(fieldValue.toString());
updateBusinessAssayProjectDataDOList.add(BeanUtils.toBean(currentBusinessAssayProjectData, BusinessAssayProjectDataDO.class));
} else {
BusinessAssayParameterDataExtendRespVO currentBusinessAssayParameterData = businessAssayParameterDataList.stream().filter(f -> f.getBusinessAssayProjectDataId().equals(currentBusinessAssayProjectData.getId()) && f.getParameterKey().equals(parameter)).findFirst().orElse(null);
currentBusinessAssayParameterData.setValue(fieldValue.toString());
updateBusinessAssayParameterDataDOList.add(BeanUtils.toBean(currentBusinessAssayParameterData, BusinessAssayParameterDataDO.class));
}
}
}
}
}

View File

@@ -15,6 +15,7 @@
tdp.NAME AS dictionaryProjectName,
tdp.SMPL_NAME AS dictionaryProjectSimpleName,
tdp.SHW_NAME AS dictionaryProjectShowName,
tbatd.ASY_TP AS assayType,
tbatd.CFG_ASY_MTHD_ID AS configAssayMethodId,
tcam.NAME AS configAssayMethodName,
tcam.MTHD_NAME_CTGR AS configAssayMethodNameAndCategory,
@@ -44,6 +45,7 @@
tdp.NAME,
tdp.SMPL_NAME,
tdp.SHW_NAME,
tbatd.ASY_TP,
tbatd.CFG_ASY_MTHD_ID,
tcam.NAME,
tcam.MTHD_NAME_CTGR,