|
@@ -3,11 +3,13 @@ package com.github.jfcloud.gene.sample.service.impl;
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.lang.Assert;
|
|
import cn.hutool.core.lang.Assert;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
|
+import com.github.jfcloud.common.core.util.R;
|
|
|
import com.github.jfcloud.common.data.datascope.DataScope;
|
|
import com.github.jfcloud.common.data.datascope.DataScope;
|
|
|
import com.github.jfcloud.gene.cache.UserIdNameCache;
|
|
import com.github.jfcloud.gene.cache.UserIdNameCache;
|
|
|
import com.github.jfcloud.gene.common.constant.StrConstant;
|
|
import com.github.jfcloud.gene.common.constant.StrConstant;
|
|
@@ -17,8 +19,10 @@ import com.github.jfcloud.gene.common.util.UserUtil;
|
|
|
import com.github.jfcloud.gene.constants.GeneStatusEnum;
|
|
import com.github.jfcloud.gene.constants.GeneStatusEnum;
|
|
|
import com.github.jfcloud.gene.file.vo.FileVo;
|
|
import com.github.jfcloud.gene.file.vo.FileVo;
|
|
|
import com.github.jfcloud.gene.flow.entity.FlowAudit;
|
|
import com.github.jfcloud.gene.flow.entity.FlowAudit;
|
|
|
|
|
+import com.github.jfcloud.gene.flow.entity.FlowInfo;
|
|
|
import com.github.jfcloud.gene.flow.service.FlowAuditService;
|
|
import com.github.jfcloud.gene.flow.service.FlowAuditService;
|
|
|
import com.github.jfcloud.gene.flow.service.FlowFileVersionService;
|
|
import com.github.jfcloud.gene.flow.service.FlowFileVersionService;
|
|
|
|
|
+import com.github.jfcloud.gene.flow.vo.SynProjectVo;
|
|
|
import com.github.jfcloud.gene.sample.dto.SampleAuditDto;
|
|
import com.github.jfcloud.gene.sample.dto.SampleAuditDto;
|
|
|
import com.github.jfcloud.gene.sample.dto.SampleDetailDto;
|
|
import com.github.jfcloud.gene.sample.dto.SampleDetailDto;
|
|
|
import com.github.jfcloud.gene.sample.dto.SamplePageDto;
|
|
import com.github.jfcloud.gene.sample.dto.SamplePageDto;
|
|
@@ -33,6 +37,10 @@ import com.github.jfcloud.gene.sample.service.biz.SamplePathologicalServiceImpl;
|
|
|
import com.github.jfcloud.gene.sample.vo.SampleAuditVo;
|
|
import com.github.jfcloud.gene.sample.vo.SampleAuditVo;
|
|
|
import com.github.jfcloud.gene.sample.vo.SamplePageVo;
|
|
import com.github.jfcloud.gene.sample.vo.SamplePageVo;
|
|
|
import com.github.jfcloud.gene.sample.vo.SampleSubmitVo;
|
|
import com.github.jfcloud.gene.sample.vo.SampleSubmitVo;
|
|
|
|
|
+import com.github.jfcloud.project.api.dto.LacmsProjectDTO;
|
|
|
|
|
+import com.github.jfcloud.project.api.dto.ProjectFeignDTO;
|
|
|
|
|
+import com.github.jfcloud.project.api.feign.RemoteProjectService;
|
|
|
|
|
+import com.github.jfcloud.project.api.feign.SubProjectFeign;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
@@ -52,19 +60,23 @@ public class SampleInfoServiceImpl extends ServiceImpl<SampleInfoMapper, SampleI
|
|
|
private final FlowFileVersionService fileVersionService;
|
|
private final FlowFileVersionService fileVersionService;
|
|
|
private final UserIdNameCache userIdNameCache;
|
|
private final UserIdNameCache userIdNameCache;
|
|
|
private final FlowAuditService flowAuditService;
|
|
private final FlowAuditService flowAuditService;
|
|
|
|
|
+ private final RemoteProjectService remoteProjectService;
|
|
|
|
|
+ private final SubProjectFeign subProjectFeign;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 根据样本检测类型获取对应的Service
|
|
* 根据样本检测类型获取对应的Service
|
|
|
*/
|
|
*/
|
|
|
private SampleEditService getServiceByType(String type) {
|
|
private SampleEditService getServiceByType(String type) {
|
|
|
- if (SampleTypeEnum.ANIMAL.getType().equals(type)) {
|
|
|
|
|
- return sampleAnimalService;
|
|
|
|
|
- }
|
|
|
|
|
- if (SampleTypeEnum.PATHOLOGICAL.getType().equals(type)) {
|
|
|
|
|
- return samplePathologicalService;
|
|
|
|
|
- }
|
|
|
|
|
- if (SampleTypeEnum.ANIMAL_IMAGE.getType().equals(type)) {
|
|
|
|
|
- return sampleAnimalImagingService;
|
|
|
|
|
|
|
+ SampleTypeEnum typeEnum = SampleTypeEnum.resolve(type);
|
|
|
|
|
+ Assert.notNull(typeEnum, "样本检测类型参数错误 type=" + type);
|
|
|
|
|
+
|
|
|
|
|
+ switch (Objects.requireNonNull(typeEnum)) {
|
|
|
|
|
+ case PATHOLOGICAL:
|
|
|
|
|
+ return samplePathologicalService;
|
|
|
|
|
+ case ANIMAL:
|
|
|
|
|
+ return sampleAnimalService;
|
|
|
|
|
+ case ANIMAL_IMAGE:
|
|
|
|
|
+ return sampleAnimalImagingService;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
log.error("样本检测类型参数错误 type={}", type);
|
|
log.error("样本检测类型参数错误 type={}", type);
|
|
@@ -222,11 +234,11 @@ public class SampleInfoServiceImpl extends ServiceImpl<SampleInfoMapper, SampleI
|
|
|
GeneStatusEnum statusEnum = Objects.requireNonNull(GeneStatusEnum.getByStatus(sampleInfo.getStatus()));
|
|
GeneStatusEnum statusEnum = Objects.requireNonNull(GeneStatusEnum.getByStatus(sampleInfo.getStatus()));
|
|
|
switch (statusEnum) {
|
|
switch (statusEnum) {
|
|
|
case DEPART_LEADER:
|
|
case DEPART_LEADER:
|
|
|
- Assert.isTrue(UserUtil.getUserId().equals(sampleInfo.getDepartLeaderId()), "抱歉,您不能审核本条记录");
|
|
|
|
|
|
|
+// Assert.isTrue(UserUtil.getUserId().equals(sampleInfo.getDepartLeaderId()), "抱歉,您不能审核本条记录");
|
|
|
nextStatus = GeneStatusEnum.PROJECT_MANAGEMENT.getStatus();
|
|
nextStatus = GeneStatusEnum.PROJECT_MANAGEMENT.getStatus();
|
|
|
break;
|
|
break;
|
|
|
case PROJECT_MANAGEMENT:
|
|
case PROJECT_MANAGEMENT:
|
|
|
- Assert.isTrue(UserUtil.getUserId().equals(sampleInfo.getProjectManageId()), "抱歉,您不能审核本条记录");
|
|
|
|
|
|
|
+// Assert.isTrue(UserUtil.getUserId().equals(sampleInfo.getProjectManageId()), "抱歉,您不能审核本条记录");
|
|
|
nextStatus = GeneStatusEnum.COMPLETED.getStatus();
|
|
nextStatus = GeneStatusEnum.COMPLETED.getStatus();
|
|
|
break;
|
|
break;
|
|
|
default:
|
|
default:
|
|
@@ -310,6 +322,46 @@ public class SampleInfoServiceImpl extends ServiceImpl<SampleInfoMapper, SampleI
|
|
|
}
|
|
}
|
|
|
return auditDtos;
|
|
return auditDtos;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void execute(Long id, SynProjectVo vo) {
|
|
|
|
|
+ SampleInfo sampleInfo = getById(id);
|
|
|
|
|
+ Assert.notNull(sampleInfo, "样本送检流程不存在");
|
|
|
|
|
+ Assert.isTrue(GeneStatusEnum.COMPLETED.getStatus().equals(sampleInfo.getStatus()), "样本送检流程非完成状态");
|
|
|
|
|
+ Assert.isNull(sampleInfo.getKyId(), "样本送检流程已执行");
|
|
|
|
|
+
|
|
|
|
|
+ //推送数据到科研项目,并得到科研项目id
|
|
|
|
|
+ ProjectFeignDTO projectFeignDTO = new ProjectFeignDTO();
|
|
|
|
|
+ projectFeignDTO.setName(sampleInfo.getProjectName());
|
|
|
|
|
+ projectFeignDTO.setLeader(vo.getProjectLeader());
|
|
|
|
|
+ projectFeignDTO.setProjectType(vo.getApprovalType());
|
|
|
|
|
+ projectFeignDTO.setProjectCode(sampleInfo.getProjectNo());
|
|
|
|
|
+
|
|
|
|
|
+ //推送申请人nickname
|
|
|
|
|
+ String leaderNickname = userIdNameCache.getNicknameByUserId(vo.getProjectLeader());
|
|
|
|
|
+ projectFeignDTO.setLeaders(leaderNickname);
|
|
|
|
|
+
|
|
|
|
|
+ log.info("推送科研项目:flowId={}, param={}", id, JSON.toJSONString(projectFeignDTO));
|
|
|
|
|
+ R<Long> longR = remoteProjectService.initProject(projectFeignDTO);
|
|
|
|
|
+ if (!longR.isOk()) {
|
|
|
|
|
+ log.error("projectId={}推送科研失败,{}", id, longR);
|
|
|
|
|
+ }
|
|
|
|
|
+ Assert.isTrue(longR.isOk(), "操作失败,科研" + longR);
|
|
|
|
|
+ Long kyId = longR.getData();
|
|
|
|
|
+ new FlowInfo().setId(id).setKyId(kyId).updateById();
|
|
|
|
|
+
|
|
|
|
|
+ //同步动物中心,生成动物中心项目信息
|
|
|
|
|
+ LacmsProjectDTO lacmsProjectDTO = new LacmsProjectDTO();
|
|
|
|
|
+ lacmsProjectDTO.setKyId(kyId);
|
|
|
|
|
+ lacmsProjectDTO.setProjectName(sampleInfo.getProjectName());
|
|
|
|
|
+ lacmsProjectDTO.setProjectLeader(vo.getProjectLeader());
|
|
|
|
|
+ lacmsProjectDTO.setPl(leaderNickname);
|
|
|
|
|
+ lacmsProjectDTO.setEthicsCode(sampleInfo.getProjectNo());
|
|
|
|
|
+ lacmsProjectDTO.setProjectType("样本送检");
|
|
|
|
|
+ lacmsProjectDTO.setProjectNum(sampleInfo.getProjectNo());
|
|
|
|
|
+ log.info("推送动物中心:flowId={}, param={}", id, JSON.toJSONString(lacmsProjectDTO));
|
|
|
|
|
+ subProjectFeign.initProject(lacmsProjectDTO);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|