Parcourir la source

基因定制流程 CURD

陈长荣 il y a 3 mois
Parent
commit
20d9ea13b5
33 fichiers modifiés avec 1089 ajouts et 89 suppressions
  1. 6 0
      jfcloud-gene-biz/pom.xml
  2. 3 1
      jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/GeneApplication.java
  3. 237 0
      jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/cache/UserIdNameCache.java
  4. 37 0
      jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/constants/GeneStatusEnum.java
  5. 31 0
      jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/constants/GeneTargetEnum.java
  6. 1 1
      jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/dict/service/impl/DictServiceImpl.java
  7. 24 1
      jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/file/controller/FileController.java
  8. 10 0
      jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/file/service/FileInfoService.java
  9. 14 0
      jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/file/service/impl/FileInfoServiceImpl.java
  10. 67 0
      jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/flow/controller/FlowController.java
  11. 71 0
      jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/flow/dto/FlowDetailDto.java
  12. 53 0
      jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/flow/dto/FlowPageDto.java
  13. 37 0
      jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/flow/entity/FlowAudit.java
  14. 81 0
      jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/flow/entity/FlowInfo.java
  15. 10 0
      jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/flow/mapper/FlowAuditMapper.java
  16. 10 0
      jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/flow/mapper/FlowInfoMapper.java
  17. 7 0
      jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/flow/service/FlowAuditService.java
  18. 40 0
      jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/flow/service/FlowInfoService.java
  19. 13 0
      jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/flow/service/impl/FlowAuditServiceImpl.java
  20. 141 0
      jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/flow/service/impl/FlowInfoServiceImpl.java
  21. 64 0
      jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/flow/vo/FlowDetailVo.java
  22. 53 0
      jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/flow/vo/FlowPageVo.java
  23. 0 41
      jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/form/controller/CustomController.java
  24. 0 41
      jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/form/controller/PurificationController.java
  25. 1 0
      jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/form/dto/StrainPurificationInfoDto.java
  26. 2 2
      jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/form/mapper/StrainCustomInfoMapper.java
  27. 2 2
      jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/form/mapper/StrainPurificationInfoMapper.java
  28. 9 0
      jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/form/service/StrainCustomInfoService.java
  29. 8 0
      jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/form/service/StrainPurificationInfoService.java
  30. 22 0
      jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/form/service/impl/StrainCustomInfoServiceImpl.java
  31. 29 0
      jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/form/service/impl/StrainPurificationInfoServiceImpl.java
  32. 3 0
      jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/form/vo/StrainCustomVo.java
  33. 3 0
      jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/form/vo/StrainPurificationInfoVo.java

+ 6 - 0
jfcloud-gene-biz/pom.xml

@@ -43,6 +43,12 @@
       <version>4.1.0</version>
     </dependency>
 
+    <dependency>
+      <groupId>com.github.jfcloud</groupId>
+      <artifactId>jfcloud-ac-common</artifactId>
+      <version>K7.0.0</version>
+    </dependency>
+
   </dependencies>
 
 </project>

+ 3 - 1
jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/GeneApplication.java

@@ -9,17 +9,19 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
 import org.springframework.context.annotation.ComponentScan;
 import org.springframework.context.annotation.ComponentScans;
+import org.springframework.scheduling.annotation.EnableScheduling;
 import org.springframework.transaction.annotation.EnableTransactionManagement;
 
 @EnableOpenApi
 @EnableJfcloudFeignClients
 @EnableJfcloudResourceServer
 @EnableDiscoveryClient
+@EnableScheduling
 @SpringBootApplication
 @EnableTransactionManagement
 @MapperScan({"com.github.jfcloud.gene.*.mapper"})
 @ComponentScans(value = {
-        @ComponentScan(value = "com.github.jfcloud.common.*")})
+        @ComponentScan(value = "com.github.jfcloud.common.aspect")})
 public class GeneApplication {
 
     public static void main(String[] args) {

+ 237 - 0
jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/cache/UserIdNameCache.java

@@ -0,0 +1,237 @@
+package com.github.jfcloud.gene.cache;
+
+import cn.hutool.core.util.StrUtil;
+import com.github.jfcloud.admin.api.sys.dto.UserDTO;
+import com.github.jfcloud.admin.api.sys.dto.UserInfo;
+import com.github.jfcloud.admin.api.sys.entity.SysUser;
+import com.github.jfcloud.admin.api.sys.feign.RemoteUserService;
+import com.github.jfcloud.admin.api.sys.vo.UserVO;
+import com.github.jfcloud.common.core.util.R;
+import feign.FeignException;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Nullable;
+import java.util.*;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * 用户名id和昵称缓存,提高查询效率
+ */
+@Slf4j
+@Component
+public class UserIdNameCache {
+
+    /**
+     * 用户id和用户信息映射,没有签名图片
+     */
+    private final Map<Long, SysUser> idMap = new ConcurrentHashMap<>();
+
+    /**
+     * 用户昵称和用户id映射
+     */
+    private final Map<String, Long> nicknameMap = new ConcurrentHashMap<>();
+
+    /**
+     * 用户名和用户id映射
+     */
+    private final Map<String, Long> usernameMap = new ConcurrentHashMap<>();
+
+    /**
+     * 不存在的用户id
+     */
+    private final Set<Long> nonExistingUsers = new HashSet<>();
+
+    @Autowired
+    private RemoteUserService remoteUserService;
+
+    /**
+     * 每日5点整清空缓存
+     */
+    @Scheduled(cron = "0 0 5 * * ?")
+    public void clearCache() {
+        log.info("清空用户缓存");
+        idMap.clear();
+        nicknameMap.clear();
+        usernameMap.clear();
+        nonExistingUsers.clear();
+    }
+
+    /**
+     * 获取用户列表缓存
+     * 接口调用需要用token,无法在定时任务中调用
+     */
+    public void initCache() {
+        log.info("刷新用户缓存");
+        List<UserDTO> userList = remoteUserService.getUserList();
+        userList.forEach(e -> {
+            idMap.put(e.getUserId(), e);
+            if (StrUtil.isNotBlank(e.getUsername())) {
+                usernameMap.put(e.getUsername(), e.getUserId());
+            }
+            if (StrUtil.isNotBlank(e.getNickname())) {
+                nicknameMap.put(e.getNickname(), e.getUserId());
+            }
+        });
+    }
+
+    /**
+     * 根据用户id获取用户信息
+     *
+     * @param userId 用户id
+     * @return 用户信息
+     */
+    @Nullable
+    public SysUser getUserById(Long userId) {
+        if (userId == null) {
+            return null;
+        }
+        if (idMap.isEmpty()) {
+            initCache();
+        }
+        if (nonExistingUsers.contains(userId)) {
+            return null;
+        }
+
+        if (idMap.containsKey(userId)) {
+            return idMap.get(userId);
+        }
+
+        try {
+            R<UserInfo> result = remoteUserService.getUserById(userId);
+            if (result.isOk() && Objects.nonNull(result.getData())) {
+                SysUser sysUser = result.getData().getSysUser();
+                idMap.put(userId, sysUser);
+                if (StrUtil.isNotBlank(sysUser.getNickname())) {
+                    nicknameMap.put(sysUser.getNickname(), userId);
+                }
+                if (StrUtil.isNotBlank(sysUser.getUsername())) {
+                    usernameMap.put(sysUser.getUsername(), userId);
+                }
+                return sysUser;
+            }
+        } catch (FeignException e) {
+            log.error("查询用户信息失败,userId={},msg={}", userId, e.getMessage());
+            nonExistingUsers.add(userId);
+        }
+        return null;
+    }
+
+    /**
+     * 根据用户昵称获取用户id
+     *
+     * @param nickname 用户昵称
+     * @return 用户id
+     */
+    @Nullable
+    public Long getUserIdByNickname(String nickname) {
+        if (StrUtil.isBlank(nickname)) {
+            return null;
+        }
+        if (idMap.isEmpty()) {
+            initCache();
+        }
+        return nicknameMap.get(nickname);
+    }
+
+    /**
+     * 根据用户名获取用户id
+     *
+     * @param username 用户名
+     * @return 用户id
+     */
+    @Nullable
+    public Long getUserIdByUsername(String username) {
+        if (StrUtil.isBlank(username)) {
+            return null;
+        }
+        if (idMap.isEmpty()) {
+            initCache();
+        }
+        return usernameMap.get(username);
+    }
+
+    /**
+     * 根据用户id获取用户昵称
+     *
+     * @param userId 用户id
+     * @return 昵称,如果不存在,返回空字符串
+     */
+    public String getNicknameByUserId(Long userId) {
+        return getNicknameByUserId(userId, "");
+    }
+
+    public String getNicknameByUserId(Long userId, String defaultValue) {
+        SysUser sysUser = getUserById(userId);
+        String result = sysUser == null ? "" : sysUser.getNickname();
+        return StrUtil.isBlank(result) ? defaultValue : result;
+    }
+
+    /**
+     * 根据用户名获取用户昵称
+     *
+     * @param username 用户名
+     * @return 用户昵称,不存在返回空字符串
+     */
+    public String username2Nickname(String username) {
+        Long userId = getUserIdByUsername(username);
+        return userId == null ? "" : getNicknameByUserId(userId);
+    }
+
+    /**
+     * 根据用户id获取用户信息,包含签名图片和文字
+     */
+    @Nullable
+    private UserVO getUserInfoByUserId(Long userId) {
+        if (userId == null) {
+            return null;
+        }
+        //检查用户id是否存在
+        SysUser sysUser = getUserById(userId);
+        if (sysUser == null) {
+            return null;
+        }
+
+        try {
+            return remoteUserService.getById(userId);
+        } catch (FeignException e) {
+            log.error("查询用户信息失败,userId={},msg={}", userId, e.getMessage());
+        }
+        return null;
+    }
+
+    /**
+     * 根据用户id获取电子签名图片路径
+     */
+    public String getSignPic(@Nullable Long userId) {
+        log.info("获取用户 [userId={}] 电子签名图片路径", userId);
+        return Optional.ofNullable(getUserInfoByUserId(userId))
+                .map(UserVO::getEleSignaturePic)
+                .orElse("");
+    }
+
+    /**
+     * 根据用户id获取电子签名图片base64
+     */
+    public String getSignBase64(@Nullable Long userId) {
+        return getSignBase64(userId, false);
+    }
+
+    /**
+     * 根据用户id获取电子签名图片base64
+     *
+     * @param userId           用户id
+     * @param withBase64Header 是否包含base64头 data:image/png;base64,
+     */
+    public String getSignBase64(@Nullable Long userId, boolean withBase64Header) {
+        log.info("获取用户 [userId={}] 电子签名base64", userId);
+        return Optional.ofNullable(getUserInfoByUserId(userId))
+                .map(u -> {
+                    String eleSignature = StrUtil.nullToEmpty(u.getEleSignature());
+                    return withBase64Header ? eleSignature : eleSignature.substring(Math.max(0, eleSignature.indexOf(',')));
+                })
+                .orElse("");
+    }
+}

+ 37 - 0
jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/constants/GeneStatusEnum.java

@@ -0,0 +1,37 @@
+package com.github.jfcloud.gene.constants;
+
+/**
+ * 基因定制流程状态
+ */
+public enum GeneStatusEnum {
+    DRAFT("0", "待提交"),
+    GENE_EDITING("20", "基因编辑部门负责人审核"),
+    PROJECT_LEADER("40", "项目负责人审核"),
+    PROJECT_MANAGEMENT("60", "项目管理部审核"),
+    COMPLETED("100", "已完成");
+
+    private final String status;
+    private final String description;
+
+    GeneStatusEnum(String status, String description) {
+        this.status = status;
+        this.description = description;
+    }
+
+    public static String getLabelByStatus(String status) {
+        for (GeneStatusEnum e : values()) {
+            if (e.getStatus().equals(status)) {
+                return e.getDescription();
+            }
+        }
+        return "";
+    }
+
+    public String getStatus() {
+        return status;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+}

+ 31 - 0
jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/constants/GeneTargetEnum.java

@@ -0,0 +1,31 @@
+package com.github.jfcloud.gene.constants;
+
+/**
+ * 基因定制流程
+ */
+public enum GeneTargetEnum {
+    /**
+     * 品系定制
+     */
+    CUSTOM("custom"),
+
+    /**
+     * 品系净化扩繁
+     */
+    PURIFICATION("purification");
+
+    private final String code;
+
+    GeneTargetEnum(String code) {
+        this.code = code;
+    }
+
+    public String getCode() {
+        return code;
+    }
+
+    @Override
+    public String toString() {
+        return code;
+    }
+}

+ 1 - 1
jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/dict/service/impl/DictServiceImpl.java

@@ -22,7 +22,7 @@ public class DictServiceImpl extends ServiceImpl<DictMapper, DictCommon> impleme
         List<DictCommon> dictCommons = list(new LambdaQueryWrapper<>(DictCommon.class)
                 .eq(DictCommon::getDictGroup, group)
                 .eq(DictCommon::getDeleted, WhetherEnum.NO.getCode())
-                .orderByAsc(DictCommon::getDictSort));
+                .orderByAsc(DictCommon::getDictSort, DictCommon::getId));
         return BeanUtil.copyToList(dictCommons, DictVo.class);
     }
 }

+ 24 - 1
jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/file/controller/FileController.java

@@ -1,9 +1,14 @@
 package com.github.jfcloud.gene.file.controller;
 
+import cn.hutool.core.io.file.FileNameUtil;
+import cn.hutool.core.util.IdUtil;
+import cn.hutool.core.util.StrUtil;
 import com.github.jfcloud.common.core.util.R;
+import com.github.jfcloud.common.file.core.FileTemplate;
 import com.github.jfcloud.gene.file.vo.FileVo;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -11,15 +16,33 @@ import org.springframework.web.bind.annotation.RequestPart;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.multipart.MultipartFile;
 
+import java.io.InputStream;
+
 @Slf4j
 @Tag(name = "文件")
 @RestController
 @RequestMapping("/file")
+@RequiredArgsConstructor
 public class FileController {
 
+    private static final String BUCKET_NAME = "jfcloud";
+    private final FileTemplate fileTemplate;
+
     @Operation(summary = "上传文件")
     @PostMapping(value = "/upload")
     public R<FileVo> upload(@RequestPart("file") MultipartFile file) {
-        return R.ok();
+        try (InputStream in = file.getInputStream()) {
+            String fileName = IdUtil.simpleUUID() + StrUtil.DOT + FileNameUtil.getSuffix(file.getOriginalFilename());
+            fileTemplate.putObject(BUCKET_NAME, fileName, in);
+
+            FileVo vo = new FileVo();
+            vo.setName(file.getOriginalFilename());
+            vo.setUrl(String.format("/admin/sys-file/%s/%s", BUCKET_NAME, fileName));
+            return R.ok(vo);
+
+        } catch (Exception e) {
+            log.error("上传失败", e);
+        }
+        return R.failed();
     }
 }

+ 10 - 0
jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/file/service/FileInfoService.java

@@ -2,6 +2,16 @@ package com.github.jfcloud.gene.file.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.github.jfcloud.gene.file.entity.FileInfo;
+import com.github.jfcloud.gene.file.vo.FileVo;
+
+import java.util.List;
 
 public interface FileInfoService extends IService<FileInfo> {
+
+    /**
+     * 根据关联id查询文件信息
+     * @param relateId
+     * @return
+     */
+    List<FileVo> listByRelateId(Long relateId);
 }

+ 14 - 0
jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/file/service/impl/FileInfoServiceImpl.java

@@ -1,14 +1,28 @@
 package com.github.jfcloud.gene.file.service.impl;
 
+import cn.hutool.core.bean.BeanUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.github.jfcloud.gene.common.constant.WhetherEnum;
 import com.github.jfcloud.gene.file.entity.FileInfo;
 import com.github.jfcloud.gene.file.mapper.FileInfoMapper;
 import com.github.jfcloud.gene.file.service.FileInfoService;
+import com.github.jfcloud.gene.file.vo.FileVo;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 @Slf4j
 @Service
 public class FileInfoServiceImpl extends ServiceImpl<FileInfoMapper, FileInfo> implements FileInfoService {
 
+    @Override
+    public List<FileVo> listByRelateId(Long relateId) {
+        List<FileInfo> list = list(new LambdaQueryWrapper<>(FileInfo.class)
+                .eq(FileInfo::getRelateId, relateId)
+                .eq(FileInfo::getDeleted, WhetherEnum.NO.getCode())
+                .orderByAsc(FileInfo::getId));
+        return BeanUtil.copyToList(list, FileVo.class);
+    }
 }

+ 67 - 0
jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/flow/controller/FlowController.java

@@ -0,0 +1,67 @@
+package com.github.jfcloud.gene.flow.controller;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.github.jfcloud.common.annotation.WebApiLog;
+import com.github.jfcloud.common.core.util.R;
+import com.github.jfcloud.gene.constants.GeneStatusEnum;
+import com.github.jfcloud.gene.flow.dto.FlowDetailDto;
+import com.github.jfcloud.gene.flow.dto.FlowPageDto;
+import com.github.jfcloud.gene.flow.service.impl.FlowInfoServiceImpl;
+import com.github.jfcloud.gene.flow.vo.FlowDetailVo;
+import com.github.jfcloud.gene.flow.vo.FlowPageVo;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import javafx.util.Pair;
+import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
+import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+@Tag(name = "基因定制流程")
+@RestController
+@RequestMapping("/flow")
+@RequiredArgsConstructor
+public class FlowController {
+
+    private final FlowInfoServiceImpl flowInfoService;
+
+    @Operation(summary = "列表查询")
+    @GetMapping("/page")
+    public R<Page<FlowPageDto>> page(FlowPageVo vo) {
+        return R.ok(flowInfoService.getPage(vo));
+    }
+
+    @Operation(summary = "详情")
+    @GetMapping("/{id}")
+    public R<FlowDetailDto> detail(@PathVariable Long id) {
+        return R.ok(flowInfoService.getDetail(id));
+    }
+
+    @Operation(summary = "状态列表")
+    @GetMapping("/statusList")
+    public R<List<Pair<String, String>>> statusList() {
+        List<Pair<String, String>> pairs = Stream.of(GeneStatusEnum.values())
+                .map(x -> new Pair<>(x.getStatus(), x.getDescription()))
+                .collect(Collectors.toList());
+        return R.ok(pairs);
+    }
+
+    @WebApiLog
+    @Operation(summary = "新增")
+    @PostMapping
+    public R save(@Valid @RequestBody FlowDetailVo vo) {
+        flowInfoService.saveFlow(vo);
+        return R.ok();
+    }
+
+    @WebApiLog
+    @Operation(summary = "编辑")
+    @PutMapping("/{id}")
+    public R update(@PathVariable Long id, @Valid @RequestBody FlowDetailVo vo) {
+        flowInfoService.updateFlow(id, vo);
+        return R.ok();
+    }
+}

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

@@ -0,0 +1,71 @@
+package com.github.jfcloud.gene.flow.dto;
+
+import com.github.jfcloud.gene.form.dto.StrainCustomDto;
+import com.github.jfcloud.gene.form.dto.StrainPurificationInfoDto;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+@Data
+public class FlowDetailDto {
+
+    @Schema(description = "项目id")
+    private Long id;
+
+    /**
+     * 项目名称
+     */
+    @Schema(description = "项目名称")
+    private String projectName;
+
+    /**
+     * 合同编号
+     */
+    @Schema(description = "合同编号")
+    private String contractNo;
+
+    /**
+     * 项目负责人Id
+     */
+    @Schema(description = "项目负责人Id")
+    private Long projectLeaderId;
+
+    /**
+     * 项目负责人名称
+     */
+    @Schema(description = "项目负责人名称")
+    private String projectLeaderName;
+
+    /**
+     * 项目负责人电话
+     */
+    @Schema(description = "项目负责人电话")
+    private String projectLeaderPhone;
+
+    /**
+     * 项目负责人邮箱
+     */
+    @Schema(description = "项目负责人邮箱")
+    private String projectLeaderEmail;
+
+    /**
+     * 机构名称
+     */
+    @Schema(description = "机构名称")
+    private String institutionName;
+
+    /**
+     * 状态
+     */
+    @Schema(description = "状态值")
+    private String status;
+
+    @Schema(description = "状态")
+    private String statusLabel;
+
+    @Schema(description = "品系定制")
+    private StrainCustomDto custom;
+
+    @Schema(description = "品系净化扩繁")
+    private StrainPurificationInfoDto purification;
+
+}

+ 53 - 0
jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/flow/dto/FlowPageDto.java

@@ -0,0 +1,53 @@
+package com.github.jfcloud.gene.flow.dto;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+@Data
+public class FlowPageDto {
+
+    @Schema(description = "项目id")
+    private Long id;
+
+    /**
+     * 项目名称
+     */
+    @Schema(description = "项目名称")
+    private String projectName;
+
+    /**
+     * 合同编号
+     */
+    @Schema(description = "合同编号")
+    private String contractNo;
+
+    /**
+     * 项目负责人Id
+     */
+    @Schema(description = "项目负责人Id")
+    private Long projectLeaderId;
+
+    @Schema(description = "项目负责人")
+    private Long projectLeaderName;
+
+    /**
+     * 状态
+     */
+    @Schema(description = "状态")
+    private String status;
+
+    /**
+     * 批准编号
+     */
+    @Schema(description = "批准编号")
+    private String approvalNo;
+
+    /**
+     * 申请人
+     */
+    @Schema(description = "申请人id")
+    private String createBy;
+
+    @Schema(description = "申请人")
+    private String createByName;
+}

+ 37 - 0
jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/flow/entity/FlowAudit.java

@@ -0,0 +1,37 @@
+package com.github.jfcloud.gene.flow.entity;
+
+import com.github.jfcloud.gene.common.entity.BaseEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.io.Serializable;
+
+/**
+ * 流程审核信息
+ * flow_audit
+ */
+@EqualsAndHashCode(callSuper = true)
+@Data
+public class FlowAudit extends BaseEntity implements Serializable {
+    private static final long serialVersionUID = 1L;
+    /**
+     * 主键
+     */
+    private Long id;
+    /**
+     * 流程主键
+     */
+    private Long flowId;
+    /**
+     * 流程状态
+     */
+    private String flowStatus;
+    /**
+     * 审核状态
+     */
+    private String auditResult;
+    /**
+     * 备注
+     */
+    private String remarks;
+}

+ 81 - 0
jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/flow/entity/FlowInfo.java

@@ -0,0 +1,81 @@
+package com.github.jfcloud.gene.flow.entity;
+
+import com.github.jfcloud.gene.common.entity.BaseEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.io.Serializable;
+
+/**
+ * 流程信息
+ * flow_info
+ */
+@EqualsAndHashCode(callSuper = true)
+@Data
+public class FlowInfo extends BaseEntity implements Serializable {
+    private static final long serialVersionUID = 1L;
+    /**
+     * 主键
+     */
+    private Long id;
+    /**
+     * 项目名称
+     */
+    private String projectName;
+    /**
+     * 品系定制custom,品系净化扩繁purification
+     */
+    private String target;
+    /**
+     * 状态
+     */
+    private String status;
+    /**
+     * 合同编号
+     */
+    private String contractNo;
+    /**
+     * 项目负责人Id
+     */
+    private Long projectLeaderId;
+    /**
+     * 项目负责人名称
+     */
+    private String projectLeaderName;
+    /**
+     * 项目负责人电话
+     */
+    private String projectLeaderPhone;
+    /**
+     * 项目负责人邮箱
+     */
+    private String projectLeaderEmail;
+    /**
+     * 机构名称
+     */
+    private String institutionName;
+    /**
+     * 批准编号
+     */
+    private String approvalNo;
+    /**
+     * 修订号
+     */
+    private String revisionNo;
+    /**
+     * 收件日期
+     */
+    private String receiptDate;
+    /**
+     * 批准日期
+     */
+    private String approvalDate;
+    /**
+     * 动物入组
+     */
+    private String animalEnrollment;
+    /**
+     * 终末取材
+     */
+    private String finalSampling;
+}

+ 10 - 0
jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/flow/mapper/FlowAuditMapper.java

@@ -0,0 +1,10 @@
+package com.github.jfcloud.gene.flow.mapper;
+
+import com.github.jfcloud.common.data.datascope.JfcloudBaseMapper;
+import com.github.jfcloud.gene.flow.entity.FlowAudit;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface FlowAuditMapper extends JfcloudBaseMapper<FlowAudit> {
+
+}

+ 10 - 0
jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/flow/mapper/FlowInfoMapper.java

@@ -0,0 +1,10 @@
+package com.github.jfcloud.gene.flow.mapper;
+
+import com.github.jfcloud.common.data.datascope.JfcloudBaseMapper;
+import com.github.jfcloud.gene.flow.entity.FlowInfo;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface FlowInfoMapper extends JfcloudBaseMapper<FlowInfo> {
+
+}

+ 7 - 0
jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/flow/service/FlowAuditService.java

@@ -0,0 +1,7 @@
+package com.github.jfcloud.gene.flow.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.github.jfcloud.gene.flow.entity.FlowAudit;
+
+public interface FlowAuditService extends IService<FlowAudit> {
+}

+ 40 - 0
jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/flow/service/FlowInfoService.java

@@ -0,0 +1,40 @@
+package com.github.jfcloud.gene.flow.service;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.github.jfcloud.gene.flow.dto.FlowDetailDto;
+import com.github.jfcloud.gene.flow.dto.FlowPageDto;
+import com.github.jfcloud.gene.flow.entity.FlowInfo;
+import com.github.jfcloud.gene.flow.vo.FlowDetailVo;
+import com.github.jfcloud.gene.flow.vo.FlowPageVo;
+
+public interface FlowInfoService extends IService<FlowInfo> {
+
+    /**
+     * 分页查询
+     * @param vo
+     * @return
+     */
+    Page<FlowPageDto> getPage(FlowPageVo vo);
+
+
+    /**
+     * 详情
+     * @param id
+     * @return
+     */
+    FlowDetailDto getDetail(Long id);
+
+    /**
+     * 新增
+     * @param vo
+     */
+    void saveFlow(FlowDetailVo vo);
+
+    /**
+     * 编辑
+     * @param id
+     * @param vo
+     */
+    void updateFlow(Long id, FlowDetailVo vo);
+}

+ 13 - 0
jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/flow/service/impl/FlowAuditServiceImpl.java

@@ -0,0 +1,13 @@
+package com.github.jfcloud.gene.flow.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.github.jfcloud.gene.flow.entity.FlowAudit;
+import com.github.jfcloud.gene.flow.mapper.FlowAuditMapper;
+import com.github.jfcloud.gene.flow.service.FlowAuditService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+
+@Slf4j
+@Service
+public class FlowAuditServiceImpl extends ServiceImpl<FlowAuditMapper, FlowAudit> implements FlowAuditService {
+}

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

@@ -0,0 +1,141 @@
+package com.github.jfcloud.gene.flow.service.impl;
+
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.lang.Assert;
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+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.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.FlowInfo;
+import com.github.jfcloud.gene.flow.mapper.FlowInfoMapper;
+import com.github.jfcloud.gene.flow.service.FlowInfoService;
+import com.github.jfcloud.gene.flow.vo.FlowDetailVo;
+import com.github.jfcloud.gene.flow.vo.FlowPageVo;
+import com.github.jfcloud.gene.form.entity.StrainCustomInfo;
+import com.github.jfcloud.gene.form.entity.StrainPurificationInfo;
+import com.github.jfcloud.gene.form.service.StrainCustomInfoService;
+import com.github.jfcloud.gene.form.service.StrainPurificationInfoService;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.Objects;
+
+@Slf4j
+@Service
+@RequiredArgsConstructor
+public class FlowInfoServiceImpl extends ServiceImpl<FlowInfoMapper, FlowInfo> implements FlowInfoService {
+
+    private final UserIdNameCache userIdNameCache;
+    private final StrainCustomInfoService customInfoService;
+    private final StrainPurificationInfoService purificationInfoService;
+
+    @Override
+    public Page<FlowPageDto> getPage(FlowPageVo vo) {
+        Page<FlowInfo> pageQuery = new Page<>(vo.getCurrent(), vo.getSize());
+        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())
+                .eq(FlowInfo::getDeleted, WhetherEnum.NO.getCode())
+                .orderByDesc(FlowInfo::getCreateTime);
+        Page<FlowInfo> page = baseMapper.selectPageByScope(pageQuery, lqw, DataScope.of());
+        if (page.getTotal() < 1) {
+            return new Page<>();
+        }
+
+        List<FlowPageDto> records = BeanUtil.copyToList(page.getRecords(), FlowPageDto.class);
+        //补充申请人姓名
+        records.forEach(item -> item.setCreateByName(userIdNameCache.getNicknameByUserId(Long.parseLong(item.getCreateBy()))));
+
+        Page<FlowPageDto> pageDto = new Page<>(page.getCurrent(), page.getSize(), page.getTotal());
+        return pageDto.setRecords(records);
+    }
+
+    @Override
+    public FlowDetailDto getDetail(Long id) {
+        FlowInfo flowInfo = getById(id);
+        Assert.notNull(flowInfo, "基因定制流程不存在");
+
+        FlowDetailDto detail = BeanUtil.copyProperties(flowInfo, FlowDetailDto.class);
+        detail.setStatusLabel(GeneStatusEnum.getLabelByStatus(detail.getStatus()));
+        detail.setCustom(customInfoService.getByFlowId(id));
+        detail.setPurification(purificationInfoService.getByFlowId(id));
+        return detail;
+    }
+
+    @Override
+    public void saveFlow(FlowDetailVo vo) {
+        log.info("保存流程 项目名称:{}", vo.getProjectName());
+        FlowInfo flowInfo = BeanUtil.copyProperties(vo, FlowInfo.class);
+        flowInfo.setId(CustomIdGenerator.nextId());
+
+        if (vo.getCustom() != null) {
+            if (vo.getPurification() != null) {
+                flowInfo.setTarget(GeneTargetEnum.CUSTOM + "," + GeneTargetEnum.PURIFICATION);
+
+                vo.getPurification().setFlowId(flowInfo.getId());
+                purificationInfoService.saveForm(vo.getPurification());
+            } else {
+                flowInfo.setTarget(GeneTargetEnum.CUSTOM.getCode());
+            }
+
+            vo.getCustom().setFlowId(flowInfo.getId());
+            customInfoService.saveForm(vo.getCustom());
+
+        } else if (vo.getPurification() != null) {
+            flowInfo.setTarget(GeneTargetEnum.PURIFICATION.getCode());
+
+            vo.getPurification().setFlowId(flowInfo.getId());
+            purificationInfoService.saveForm(vo.getPurification());
+        }
+        flowInfo.setStatus(GeneStatusEnum.DRAFT.getStatus());
+        flowInfo.insert();
+    }
+
+    @Override
+    public void updateFlow(Long id, FlowDetailVo vo) {
+        log.info("编辑流程 项目名称:{}", vo.getProjectName());
+
+        FlowInfo flowInfo = getById(id);
+        Assert.notNull(flowInfo, "基因定制流程不存在");
+        BeanUtil.copyProperties(vo, flowInfo);
+
+
+        StringBuilder target = new StringBuilder();
+        if (vo.getCustom() == null) {
+            customInfoService.remove(new LambdaQueryWrapper<>(StrainCustomInfo.class).eq(StrainCustomInfo::getFlowId, id));
+        } else {
+            vo.getCustom().setFlowId(id);
+            customInfoService.updateForm(id, vo.getCustom());
+            target.append(GeneTargetEnum.CUSTOM);
+        }
+
+        if (vo.getPurification() == null) {
+            purificationInfoService.remove(new LambdaQueryWrapper<>(StrainPurificationInfo.class).eq(StrainPurificationInfo::getFlowId, id));
+        } else {
+            vo.getPurification().setFlowId(id);
+            purificationInfoService.updateForm(id, vo.getPurification());
+
+            if (target.length() > 0) {
+                target.append(",");
+            }
+            target.append(GeneTargetEnum.PURIFICATION);
+        }
+
+        flowInfo.setTarget(target.toString());
+        flowInfo.updateById();
+    }
+}

+ 64 - 0
jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/flow/vo/FlowDetailVo.java

@@ -0,0 +1,64 @@
+package com.github.jfcloud.gene.flow.vo;
+
+import com.github.jfcloud.gene.form.vo.StrainCustomVo;
+import com.github.jfcloud.gene.form.vo.StrainPurificationInfoVo;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import javax.validation.constraints.NotEmpty;
+import javax.validation.constraints.NotNull;
+
+@Data
+public class FlowDetailVo {
+
+    /**
+     * 项目名称
+     */
+    @Schema(description = "项目名称")
+    @NotEmpty(message = "项目名称不能为空")
+    private String projectName;
+
+    /**
+     * 合同编号
+     */
+    @Schema(description = "合同编号")
+    private String contractNo;
+
+    /**
+     * 项目负责人Id
+     */
+    @Schema(description = "项目负责人Id")
+    @NotNull(message = "项目负责人Id不能为空")
+    private Long projectLeaderId;
+
+    /**
+     * 项目负责人名称
+     */
+    @Schema(description = "项目负责人名称")
+    private String projectLeaderName;
+
+    /**
+     * 项目负责人电话
+     */
+    @Schema(description = "项目负责人电话")
+    private String projectLeaderPhone;
+
+    /**
+     * 项目负责人邮箱
+     */
+    @Schema(description = "项目负责人邮箱")
+    private String projectLeaderEmail;
+
+    /**
+     * 机构名称
+     */
+    @Schema(description = "机构名称")
+    private String institutionName;
+
+    @Schema(description = "品系定制")
+    private StrainCustomVo custom;
+
+    @Schema(description = "品系净化扩繁")
+    private StrainPurificationInfoVo purification;
+
+}

+ 53 - 0
jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/flow/vo/FlowPageVo.java

@@ -0,0 +1,53 @@
+package com.github.jfcloud.gene.flow.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+@Data
+public class FlowPageVo {
+
+    @Schema(description = "每页大小")
+    protected long size = 10;
+
+    /**
+     * 当前页
+     */
+    @Schema(description = "当前页")
+    protected long current = 1;
+
+    /**
+     * 项目名称
+     */
+    @Schema(description = "项目名称")
+    private String projectName;
+
+    /**
+     * 合同编号
+     */
+    @Schema(description = "合同编号")
+    private String contractNo;
+
+    /**
+     * 项目负责人Id
+     */
+    @Schema(description = "项目负责人Id")
+    private Long projectLeaderId;
+
+    /**
+     * 状态
+     */
+    @Schema(description = "状态")
+    private String status;
+
+    /**
+     * 批准编号
+     */
+    @Schema(description = "批准编号")
+    private String approvalNo;
+
+    /**
+     * 申请人
+     */
+    @Schema(description = "申请人")
+    private String createBy;
+}

+ 0 - 41
jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/form/controller/CustomController.java

@@ -1,41 +0,0 @@
-package com.github.jfcloud.gene.form.controller;
-
-import com.github.jfcloud.common.core.util.R;
-import com.github.jfcloud.gene.form.dto.StrainCustomDto;
-import com.github.jfcloud.gene.form.service.StrainCustomInfoService;
-import com.github.jfcloud.gene.form.vo.StrainCustomVo;
-import io.swagger.v3.oas.annotations.Operation;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import lombok.RequiredArgsConstructor;
-import org.springframework.web.bind.annotation.*;
-
-import javax.validation.Valid;
-
-@Tag(name = "品系定制表单")
-@RestController
-@RequestMapping("/custom")
-@RequiredArgsConstructor
-public class CustomController {
-
-    private final StrainCustomInfoService strainCustomInfoService;
-
-    @Operation(summary = "详情")
-    @GetMapping("/{id}")
-    public R<StrainCustomDto> info(@PathVariable Long id) {
-        return R.ok();
-    }
-
-    @Operation(summary = "新增")
-    @PostMapping
-    public R save(@Valid @RequestBody StrainCustomVo vo) {
-        strainCustomInfoService.saveForm(vo);
-        return R.ok();
-    }
-
-    @Operation(summary = "编辑")
-    @PutMapping("/{id}")
-    public R update(@PathVariable Long id, @Valid @RequestBody StrainCustomVo vo) {
-        strainCustomInfoService.updateForm(id, vo);
-        return R.ok();
-    }
-}

+ 0 - 41
jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/form/controller/PurificationController.java

@@ -1,41 +0,0 @@
-package com.github.jfcloud.gene.form.controller;
-
-import com.github.jfcloud.common.core.util.R;
-import com.github.jfcloud.gene.form.dto.StrainPurificationInfoDto;
-import com.github.jfcloud.gene.form.service.StrainPurificationInfoService;
-import com.github.jfcloud.gene.form.vo.StrainPurificationInfoVo;
-import io.swagger.v3.oas.annotations.Operation;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import lombok.RequiredArgsConstructor;
-import org.springframework.web.bind.annotation.*;
-
-import javax.validation.Valid;
-
-@Tag(name = "品系净化扩繁表单")
-@RestController
-@RequestMapping("/purification")
-@RequiredArgsConstructor
-public class PurificationController {
-
-    private final StrainPurificationInfoService purificationInfoService;
-
-    @Operation(summary = "详情")
-    @GetMapping("/{id}")
-    public R<StrainPurificationInfoDto> info(@PathVariable Long id) {
-        return R.ok();
-    }
-
-    @Operation(summary = "新增")
-    @PostMapping
-    public R save(@Valid @RequestBody StrainPurificationInfoVo vo) {
-        purificationInfoService.saveForm(vo);
-        return R.ok();
-    }
-
-    @Operation(summary = "编辑")
-    @PutMapping("/{id}")
-    public R update(@PathVariable Long id, @Valid @RequestBody StrainPurificationInfoVo vo) {
-        purificationInfoService.updateForm(id, vo);
-        return R.ok();
-    }
-}

+ 1 - 0
jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/form/dto/StrainPurificationInfoDto.java

@@ -13,6 +13,7 @@ import java.util.List;
 
 @EqualsAndHashCode(callSuper = true)
 @Data
+@Schema(description = "品系净化扩繁响应")
 public class StrainPurificationInfoDto extends StrainPurificationInfo {
 
     @Schema(description = "检测附件")

+ 2 - 2
jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/form/mapper/StrainCustomInfoMapper.java

@@ -1,10 +1,10 @@
 package com.github.jfcloud.gene.form.mapper;
 
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.github.jfcloud.common.data.datascope.JfcloudBaseMapper;
 import com.github.jfcloud.gene.form.entity.StrainCustomInfo;
 import org.apache.ibatis.annotations.Mapper;
 
 @Mapper
-public interface StrainCustomInfoMapper extends BaseMapper<StrainCustomInfo> {
+public interface StrainCustomInfoMapper extends JfcloudBaseMapper<StrainCustomInfo> {
 
 }

+ 2 - 2
jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/form/mapper/StrainPurificationInfoMapper.java

@@ -1,10 +1,10 @@
 package com.github.jfcloud.gene.form.mapper;
 
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.github.jfcloud.common.data.datascope.JfcloudBaseMapper;
 import com.github.jfcloud.gene.form.entity.StrainPurificationInfo;
 import org.apache.ibatis.annotations.Mapper;
 
 @Mapper
-public interface StrainPurificationInfoMapper extends BaseMapper<StrainPurificationInfo> {
+public interface StrainPurificationInfoMapper extends JfcloudBaseMapper<StrainPurificationInfo> {
 
 }

+ 9 - 0
jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/form/service/StrainCustomInfoService.java

@@ -1,6 +1,7 @@
 package com.github.jfcloud.gene.form.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.github.jfcloud.gene.form.dto.StrainCustomDto;
 import com.github.jfcloud.gene.form.entity.StrainCustomInfo;
 import com.github.jfcloud.gene.form.vo.StrainCustomVo;
 
@@ -9,6 +10,7 @@ public interface StrainCustomInfoService extends IService<StrainCustomInfo> {
     /**
      * 保存基因定制表单
      *
+     * @param flowId
      * @param vo
      */
     void saveForm(StrainCustomVo vo);
@@ -20,4 +22,11 @@ public interface StrainCustomInfoService extends IService<StrainCustomInfo> {
      * @param vo
      */
     void updateForm(Long id, StrainCustomVo vo);
+
+    /**
+     * 根据流程id查询基因定制表单
+     * @param flowId
+     * @return
+     */
+    StrainCustomDto getByFlowId(Long flowId);
 }

+ 8 - 0
jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/form/service/StrainPurificationInfoService.java

@@ -1,6 +1,7 @@
 package com.github.jfcloud.gene.form.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.github.jfcloud.gene.form.dto.StrainPurificationInfoDto;
 import com.github.jfcloud.gene.form.entity.StrainPurificationInfo;
 import com.github.jfcloud.gene.form.vo.StrainPurificationInfoVo;
 
@@ -20,4 +21,11 @@ public interface StrainPurificationInfoService extends IService<StrainPurificati
      * @param vo
      */
     void updateForm(Long id, StrainPurificationInfoVo vo);
+
+    /**
+     * 根据流程id查询净化扩繁表单
+     * @param id
+     * @return
+     */
+    StrainPurificationInfoDto getByFlowId(Long id);
 }

+ 22 - 0
jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/form/service/impl/StrainCustomInfoServiceImpl.java

@@ -4,12 +4,15 @@ import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.lang.Assert;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.github.jfcloud.gene.common.constant.WhetherEnum;
 import com.github.jfcloud.gene.common.util.CustomIdGenerator;
+import com.github.jfcloud.gene.form.dto.StrainCustomDto;
 import com.github.jfcloud.gene.form.entity.StrainCustomDetail;
 import com.github.jfcloud.gene.form.entity.StrainCustomInfo;
 import com.github.jfcloud.gene.form.mapper.StrainCustomInfoMapper;
 import com.github.jfcloud.gene.form.service.StrainCustomDetailService;
 import com.github.jfcloud.gene.form.service.StrainCustomInfoService;
+import com.github.jfcloud.gene.form.vo.StrainCustomDetailVo;
 import com.github.jfcloud.gene.form.vo.StrainCustomVo;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
@@ -67,4 +70,23 @@ public class StrainCustomInfoServiceImpl extends ServiceImpl<StrainCustomInfoMap
             strainCustomDetailService.saveBatch(detailList);
         }
     }
+
+    @Override
+    public StrainCustomDto getByFlowId(Long flowId) {
+        StrainCustomInfo info = getOne(new LambdaQueryWrapper<StrainCustomInfo>()
+                .eq(StrainCustomInfo::getFlowId, flowId)
+                .eq(StrainCustomInfo::getDeleted, WhetherEnum.NO.getCode()));
+        if (info == null) {
+            return null;
+        }
+
+        StrainCustomDto dto = BeanUtil.copyProperties(info, StrainCustomDto.class);
+        List<StrainCustomDetail> detailList = strainCustomDetailService.list(new LambdaQueryWrapper<StrainCustomDetail>()
+                .eq(StrainCustomDetail::getStrainCustomBasicId, info.getId())
+                .eq(StrainCustomDetail::getDeleted, WhetherEnum.NO.getCode())
+                .orderByAsc(StrainCustomDetail::getId));
+        dto.setDetailList(BeanUtil.copyToList(detailList, StrainCustomDetailVo.class));
+        return dto;
+
+    }
 }

+ 29 - 0
jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/form/service/impl/StrainPurificationInfoServiceImpl.java

@@ -4,9 +4,11 @@ import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.lang.Assert;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.github.jfcloud.gene.common.constant.WhetherEnum;
 import com.github.jfcloud.gene.common.util.CustomIdGenerator;
 import com.github.jfcloud.gene.file.entity.FileInfo;
 import com.github.jfcloud.gene.file.service.FileInfoService;
+import com.github.jfcloud.gene.form.dto.StrainPurificationInfoDto;
 import com.github.jfcloud.gene.form.entity.AnimalDemand;
 import com.github.jfcloud.gene.form.entity.CageDemand;
 import com.github.jfcloud.gene.form.entity.StrainPurificationInfo;
@@ -14,6 +16,8 @@ import com.github.jfcloud.gene.form.mapper.StrainPurificationInfoMapper;
 import com.github.jfcloud.gene.form.service.AnimalDemandService;
 import com.github.jfcloud.gene.form.service.CageDemandService;
 import com.github.jfcloud.gene.form.service.StrainPurificationInfoService;
+import com.github.jfcloud.gene.form.vo.AnimalDemandVo;
+import com.github.jfcloud.gene.form.vo.CageDemandVo;
 import com.github.jfcloud.gene.form.vo.StrainPurificationInfoVo;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
@@ -97,4 +101,29 @@ public class StrainPurificationInfoServiceImpl extends ServiceImpl<StrainPurific
 
         saveDetailList(id, vo);
     }
+
+    @Override
+    public StrainPurificationInfoDto getByFlowId(Long id) {
+        StrainPurificationInfo info = getOne(new LambdaQueryWrapper<StrainPurificationInfo>()
+                .eq(StrainPurificationInfo::getFlowId, id)
+                .eq(StrainPurificationInfo::getDeleted, WhetherEnum.NO.getCode()));
+        if (info == null) {
+            return null;
+        }
+
+        StrainPurificationInfoDto dto = BeanUtil.copyProperties(info, StrainPurificationInfoDto.class);
+        //动物需求
+        List<AnimalDemand> animalDemandList = animalDemandService.list(new LambdaQueryWrapper<AnimalDemand>()
+                .eq(AnimalDemand::getPurificationId, info.getId())
+                .eq(AnimalDemand::getDeleted, WhetherEnum.NO.getCode()));
+        dto.setAnimalDemands(BeanUtil.copyToList(animalDemandList, AnimalDemandVo.class));
+        //笼位需求
+        List<CageDemand> cageDemands = cageDemandService.list(new LambdaQueryWrapper<CageDemand>()
+                .eq(CageDemand::getPurificationId, info.getId())
+                .eq(CageDemand::getDeleted, WhetherEnum.NO.getCode()));
+        dto.setCageDemands(BeanUtil.copyToList(cageDemands, CageDemandVo.class));
+        //附件
+        dto.setTestingFiles(fileInfoService.listByRelateId(info.getId()));
+        return dto;
+    }
 }

+ 3 - 0
jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/form/vo/StrainCustomVo.java

@@ -11,6 +11,9 @@ import java.util.List;
 @Schema(description = "品系定制")
 public class StrainCustomVo {
 
+    @Schema(hidden = true)
+    private Long flowId;
+
     @Schema(description = "动物品系定制", example = "基因工程动物,打靶载体,基因工程细胞")
     private String animalStrainCustom;
 

+ 3 - 0
jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/form/vo/StrainPurificationInfoVo.java

@@ -11,6 +11,9 @@ import java.util.List;
 @Schema(description = "品系净化扩繁信息实体类")
 public class StrainPurificationInfoVo {
 
+    @Schema(hidden = true)
+    private Long flowId;
+
     /**
      * 品系名称
      */