|
@@ -8,15 +8,19 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.github.jfcloud.common.data.datascope.DataScope;
|
|
|
import com.github.jfcloud.gene.cache.UserIdNameCache;
|
|
|
+import com.github.jfcloud.gene.common.constant.StrConstant;
|
|
|
import com.github.jfcloud.gene.common.constant.WhetherEnum;
|
|
|
import com.github.jfcloud.gene.common.util.CustomIdGenerator;
|
|
|
import com.github.jfcloud.gene.constants.GeneStatusEnum;
|
|
|
import com.github.jfcloud.gene.constants.GeneTargetEnum;
|
|
|
import com.github.jfcloud.gene.flow.dto.FlowDetailDto;
|
|
|
import com.github.jfcloud.gene.flow.dto.FlowPageDto;
|
|
|
+import com.github.jfcloud.gene.flow.entity.FlowAudit;
|
|
|
import com.github.jfcloud.gene.flow.entity.FlowInfo;
|
|
|
import com.github.jfcloud.gene.flow.mapper.FlowInfoMapper;
|
|
|
import com.github.jfcloud.gene.flow.service.FlowInfoService;
|
|
|
+import com.github.jfcloud.gene.flow.service.NotifyService;
|
|
|
+import com.github.jfcloud.gene.flow.vo.FlowAuditVo;
|
|
|
import com.github.jfcloud.gene.flow.vo.FlowDetailVo;
|
|
|
import com.github.jfcloud.gene.flow.vo.FlowPageVo;
|
|
|
import com.github.jfcloud.gene.form.entity.StrainCustomInfo;
|
|
@@ -38,17 +42,24 @@ public class FlowInfoServiceImpl extends ServiceImpl<FlowInfoMapper, FlowInfo> i
|
|
|
private final UserIdNameCache userIdNameCache;
|
|
|
private final StrainCustomInfoService customInfoService;
|
|
|
private final StrainPurificationInfoService purificationInfoService;
|
|
|
+ private final NotifyService notifyService;
|
|
|
|
|
|
@Override
|
|
|
public Page<FlowPageDto> getPage(FlowPageVo vo) {
|
|
|
Page<FlowInfo> pageQuery = new Page<>(vo.getCurrent(), vo.getSize());
|
|
|
+
|
|
|
+ //如果查询待提交,将驳回状态的一并查出
|
|
|
+ if (vo.getStatusList().contains(GeneStatusEnum.DRAFT.getStatus())) {
|
|
|
+ vo.getStatusList().add(GeneStatusEnum.REJECTED.getStatus());
|
|
|
+ }
|
|
|
+
|
|
|
LambdaQueryWrapper<FlowInfo> lqw = new LambdaQueryWrapper<>(FlowInfo.class)
|
|
|
.like(StrUtil.isNotBlank(vo.getProjectName()), FlowInfo::getProjectName, vo.getProjectName())
|
|
|
.like(StrUtil.isNotBlank(vo.getContractNo()), FlowInfo::getContractNo, vo.getContractNo())
|
|
|
.like(StrUtil.isNotBlank(vo.getApprovalNo()), FlowInfo::getApprovalNo, vo.getApprovalNo())
|
|
|
.eq(Objects.nonNull(vo.getProjectLeaderId()), FlowInfo::getProjectLeaderId, vo.getProjectLeaderId())
|
|
|
.eq(Objects.nonNull(vo.getCreateBy()), FlowInfo::getCreateBy, vo.getCreateBy())
|
|
|
- .eq(StrUtil.isNotBlank(vo.getStatus()), FlowInfo::getStatus, vo.getStatus())
|
|
|
+ .in(!vo.getStatusList().isEmpty(), FlowInfo::getStatus, vo.getStatusList())
|
|
|
.eq(FlowInfo::getDeleted, WhetherEnum.NO.getCode())
|
|
|
.orderByDesc(FlowInfo::getCreateTime);
|
|
|
Page<FlowInfo> page = baseMapper.selectPageByScope(pageQuery, lqw, DataScope.of());
|
|
@@ -70,7 +81,7 @@ public class FlowInfoServiceImpl extends ServiceImpl<FlowInfoMapper, FlowInfo> i
|
|
|
Assert.notNull(flowInfo, "基因定制流程不存在");
|
|
|
|
|
|
FlowDetailDto detail = BeanUtil.copyProperties(flowInfo, FlowDetailDto.class);
|
|
|
- detail.setStatusLabel(GeneStatusEnum.getLabelByStatus(detail.getStatus()));
|
|
|
+ detail.setStatusLabel(Objects.requireNonNull(GeneStatusEnum.getByStatus(detail.getStatus())).getDescription());
|
|
|
detail.setCustom(customInfoService.getByFlowId(id));
|
|
|
detail.setPurification(purificationInfoService.getByFlowId(id));
|
|
|
return detail;
|
|
@@ -138,4 +149,88 @@ public class FlowInfoServiceImpl extends ServiceImpl<FlowInfoMapper, FlowInfo> i
|
|
|
flowInfo.setTarget(target.toString());
|
|
|
flowInfo.updateById();
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void submitFlow(Long id) {
|
|
|
+ FlowInfo flowInfo = getById(id);
|
|
|
+ Assert.notNull(flowInfo, "基因定制流程不存在");
|
|
|
+ Assert.isTrue(GeneStatusEnum.SUBMIT_STATUS.contains(flowInfo.getStatus()), "流程状态错误");
|
|
|
+
|
|
|
+ new FlowInfo()
|
|
|
+ .setId(id)
|
|
|
+ .setStatus(GeneStatusEnum.GENE_EDITING.getStatus())
|
|
|
+ .updateById();
|
|
|
+
|
|
|
+ notifyService.notify(id);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void audit(Long id, FlowAuditVo vo) {
|
|
|
+ FlowInfo flowInfo = getById(id);
|
|
|
+ Assert.notNull(flowInfo, "基因定制流程不存在");
|
|
|
+ Assert.isFalse(GeneStatusEnum.SUBMIT_STATUS.contains(flowInfo.getStatus()), "流程状态错误");
|
|
|
+
|
|
|
+ //审核不通过
|
|
|
+ if (StrConstant.NO.equals(vo.getAuditResult())) {
|
|
|
+ log.info("流程项目 ({}) 审核不通过", flowInfo.getProjectName());
|
|
|
+
|
|
|
+ new FlowAudit()
|
|
|
+ .setFlowId(id)
|
|
|
+ .setFlowStatus(flowInfo.getStatus())
|
|
|
+ .setAuditResult(vo.getAuditResult())
|
|
|
+ .setRemarks(vo.getRemarks())
|
|
|
+ .insert();
|
|
|
+
|
|
|
+ new FlowInfo()
|
|
|
+ .setId(id)
|
|
|
+ .setStatus(GeneStatusEnum.REJECTED.getStatus())
|
|
|
+ .updateById();
|
|
|
+
|
|
|
+ notifyService.notify(id);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ Assert.isTrue(StrConstant.YES.equals(vo.getAuditResult()), "审核结果错误");
|
|
|
+
|
|
|
+ //审核通过
|
|
|
+ log.info("流程项目 ({}) 审核通过", flowInfo.getProjectName());
|
|
|
+
|
|
|
+ String nextStatus = "";
|
|
|
+ GeneStatusEnum statusEnum = Objects.requireNonNull(GeneStatusEnum.getByStatus(flowInfo.getStatus()));
|
|
|
+ switch (statusEnum) {
|
|
|
+ case GENE_EDITING:
|
|
|
+ nextStatus = GeneStatusEnum.PROJECT_LEADER.getStatus();
|
|
|
+ break;
|
|
|
+ case PROJECT_LEADER:
|
|
|
+ nextStatus = GeneStatusEnum.PROJECT_MANAGEMENT.getStatus();
|
|
|
+ break;
|
|
|
+ case PROJECT_MANAGEMENT:
|
|
|
+ nextStatus = GeneStatusEnum.COMPLETED.getStatus();
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ log.info("流程项目 ({}) 状态为{}", flowInfo.getProjectName(), statusEnum.getDescription());
|
|
|
+ throw new IllegalArgumentException("流程状态错误");
|
|
|
+ }
|
|
|
+
|
|
|
+ new FlowAudit()
|
|
|
+ .setFlowId(id)
|
|
|
+ .setFlowStatus(flowInfo.getStatus())
|
|
|
+ .setAuditResult(vo.getAuditResult())
|
|
|
+ .setRemarks(vo.getRemarks())
|
|
|
+ .insert();
|
|
|
+
|
|
|
+ flowInfo = new FlowInfo();
|
|
|
+ //更新项目批准编号、修订号等
|
|
|
+ BeanUtil.copyProperties(vo, flowInfo);
|
|
|
+ flowInfo.setId(id)
|
|
|
+ .setStatus(nextStatus)
|
|
|
+ .updateById();
|
|
|
+
|
|
|
+ notifyService.notify(id);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void execute(Long id) {
|
|
|
+
|
|
|
+ }
|
|
|
}
|