Browse Source

流程详情查询结果调整

陈长荣 5 months ago
parent
commit
e65a9b7c71

+ 3 - 0
jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/flow/dto/FlowDetailDto.java

@@ -59,6 +59,9 @@ public class FlowDetailDto {
     @Schema(description = "状态值")
     private String status;
 
+    @Schema(description = "状态值")
+    private String target;
+
     @Schema(description = "状态")
     private String statusLabel;
 

+ 11 - 1
jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/flow/dto/FlowPageDto.java

@@ -1,8 +1,11 @@
 package com.github.jfcloud.gene.flow.dto;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.Data;
 
+import java.util.Date;
+
 @Data
 public class FlowPageDto {
 
@@ -33,9 +36,12 @@ public class FlowPageDto {
     /**
      * 状态
      */
-    @Schema(description = "状态")
+    @Schema(description = "状态")
     private String status;
 
+    @Schema(description = "状态")
+    private String statusLabel;
+
     /**
      * 批准编号
      */
@@ -48,6 +54,10 @@ public class FlowPageDto {
     @Schema(description = "申请人id")
     private String createBy;
 
+    @Schema(description = "申请日期")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date createTime;
+
     @Schema(description = "申请人")
     private String createByName;
 

+ 17 - 4
jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/flow/service/impl/FlowInfoServiceImpl.java

@@ -35,6 +35,8 @@ 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.dto.StrainCustomDto;
+import com.github.jfcloud.gene.form.dto.StrainPurificationInfoDto;
 import com.github.jfcloud.gene.form.entity.StrainCustomInfo;
 import com.github.jfcloud.gene.form.entity.StrainPurificationInfo;
 import com.github.jfcloud.gene.form.service.StrainCustomInfoService;
@@ -55,6 +57,7 @@ import java.io.ByteArrayOutputStream;
 import java.io.InputStream;
 import java.util.List;
 import java.util.Objects;
+import java.util.Optional;
 
 @Slf4j
 @Service
@@ -99,6 +102,7 @@ public class FlowInfoServiceImpl extends ServiceImpl<FlowInfoMapper, FlowInfo> i
             item.setCreateByName(userIdNameCache.getNicknameByUserId(Long.parseLong(item.getCreateBy())));
             //查询下载链接
             item.setFileUrl(fileVersionService.getLatestFileUrl(item.getId()));
+            item.setStatusLabel(Objects.requireNonNull(GeneStatusEnum.getByStatus(item.getStatus())).getDescription());
         });
 
         Page<FlowPageDto> pageDto = new Page<>(page.getCurrent(), page.getSize(), page.getTotal());
@@ -114,8 +118,11 @@ public class FlowInfoServiceImpl extends ServiceImpl<FlowInfoMapper, FlowInfo> i
         detail.setGeneEditPlName(userIdNameCache.getNicknameByUserId(flowInfo.getGeneEditPlId()));
         detail.setProjectManageName(userIdNameCache.getNicknameByUserId(flowInfo.getProjectManageId()));
         detail.setStatusLabel(Objects.requireNonNull(GeneStatusEnum.getByStatus(detail.getStatus())).getDescription());
-        detail.setCustom(customInfoService.getByFlowId(id));
-        detail.setPurification(purificationInfoService.getByFlowId(id));
+
+        StrainCustomDto customDto = customInfoService.getByFlowId(id);
+        detail.setCustom(Optional.ofNullable(customDto).orElse(new StrainCustomDto()));
+        StrainPurificationInfoDto purificationInfoDto = purificationInfoService.getByFlowId(id);
+        detail.setPurification(Optional.ofNullable(purificationInfoDto).orElse(new StrainPurificationInfoDto()));
 
         //查询下载链接
         detail.setFileUrl(fileVersionService.getLatestFileUrl(id));
@@ -130,15 +137,21 @@ public class FlowInfoServiceImpl extends ServiceImpl<FlowInfoMapper, FlowInfo> i
         FlowInfo flowInfo = BeanUtil.copyProperties(vo, FlowInfo.class);
         flowInfo.setId(CustomIdGenerator.nextId());
 
-        if (vo.getCustom() != null) {
+        boolean targetCheck = false;
+        if (vo.getTarget().contains(GeneTargetEnum.CUSTOM.getCode())) {
+            targetCheck = true;
             vo.getCustom().setFlowId(flowInfo.getId());
             customInfoService.saveForm(vo.getCustom());
         }
 
-        if (vo.getPurification() != null) {
+        if (vo.getTarget().contains(GeneTargetEnum.PURIFICATION.getCode())) {
+            targetCheck = true;
             vo.getPurification().setFlowId(flowInfo.getId());
             purificationInfoService.saveForm(vo.getPurification());
         }
+
+        Assert.isTrue(targetCheck, "target只能为custom purification");
+
         flowInfo.setStatus(GeneStatusEnum.DRAFT.getStatus());
         flowInfo.insert();