|
@@ -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();
|
|
|
|