Commit 2ed66a91 authored by 侯彦文's avatar 侯彦文

新建进度计划

parent 14fdf92f
package com.yonde.dcs.plan.core.controller;
import com.yonde.dcs.document.common.entity.vo.DxDocumentVO;
import com.yonde.dcs.plan.common.vo.ExtSupplierManageVO;
import org.springframework.stereotype.Controller;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
......@@ -58,6 +59,13 @@ public class ExtPlanController<V extends ExtPlanVO, S extends ExtPlanService<V>>
return apiResult;
}
@ApiOperation("流程启动")
@PostMapping(value = "/startWorkflow")
public ApiResult insertPlan(@RequestParam("id") Long id) throws IOException {
return ApiResult.ok(extPlanService.startWorkflow(id),"启动计划成功");
}
/**
* 修改计划状态
*
......
......@@ -2,6 +2,7 @@ package com.yonde.dcs.plan.core.service;
import com.yonde.dcs.document.common.entity.vo.DxDocumentVO;
import com.yonde.dcs.plan.common.vo.ExtPlanVO;
import com.yonde.dcs.plan.common.vo.ExtSupplierManageVO;
import com.yonde.dcs.plan.core.service.shadow.ExtPlanServiceShadow;
import com.yonde.dex.basedata.entity.api.ApiResult;
import com.yonde.dex.user.common.vo.DxOrganizationVO;
......@@ -44,6 +45,8 @@ public interface ExtPlanService<V extends ExtPlanVO> extends ExtPlanServiceShado
ApiResult insertPlan(MultipartFile uploadFile, Long projectId);
ExtPlanVO startWorkflow(Long id);
/**
* 计划驱动编制任务
*
......
......@@ -36,6 +36,7 @@ import com.yonde.dex.user.common.vo.DxUserInfoVO;
import com.yonde.dex.user.feign.DxOrganizationFeign;
import com.yonde.dex.user.feign.DxUserInfoFeign;
import com.yonde.dex.version.plugin.core.deleteType.IterationDeleteVO;
import com.yonde.dex.wfc.feign.api.WfcProcessFeign;
import dm.jdbc.util.StringUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.usermodel.CellStyle;
......@@ -60,6 +61,7 @@ import java.net.URLEncoder;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.Properties;
/**
......@@ -100,6 +102,9 @@ public class ExtPlanServiceImpl<V extends ExtPlanVO> implements ExtPlanService<V
@Autowired
private DxUserInfoFeign<DxUserInfoVO> dxUserInfoFeign;
@Autowired
private WfcProcessFeign wfcProcessFeign;
/**
* 通过userId获取组织名
*
......@@ -174,6 +179,19 @@ public class ExtPlanServiceImpl<V extends ExtPlanVO> implements ExtPlanService<V
return apiResult;
}
@Override
public ExtPlanVO startWorkflow(Long id) {
ExtPlanVO extPlanVO = this.get(id);
if (extPlanVO == null) {
throw new DxBusinessException("500", "获取不到对象");
}
if (!extPlanVO.getState().equals("unopened")) {
throw new DxBusinessException("500", "该对象不是编制状态");
}
wfcProcessFeign.startProcessByKey("ExtPlanWF", extPlanVO);
return this.changeStatus(extPlanVO.getId(), "unfinished", true);
}
/**
* 导入计划(系统校验计划编号、计划名称、工期、计划开始时间、计划完成时间等必填项)
*
......@@ -308,6 +326,13 @@ public class ExtPlanServiceImpl<V extends ExtPlanVO> implements ExtPlanService<V
if (StringUtils.isEmpty(secretCodeKey)) {
buffer.append(String.format("第%s行密级格式不正确!", i + 1) + "</br>");
}
if (Objects.nonNull(excelVO.getSuperPlanCode())){
//校验父级编号
ExtPlanVO extPlanVO = this.searchByNumber(excelVO.getSuperPlanCode());
if (!ObjectUtils.isEmpty(extPlanVO)){
buffer.append(String.format("第%s行,父级编号不存在", i + 1) + "</br>");
}
}
return buffer;
}
......@@ -549,6 +574,12 @@ public class ExtPlanServiceImpl<V extends ExtPlanVO> implements ExtPlanService<V
private ExtPlanVO copyPlan(PlanExcelVO planExcelVO, OperatorType operatorType) {
ExtPlanVO extPlanVO = new ExtPlanVO();
BeanUtils.copyProperties(planExcelVO, extPlanVO);
if (Objects.nonNull(planExcelVO.getSuperPlanCode())) {
ExtPlanVO extPlanVO1 = this.searchByNumber(planExcelVO.getSuperPlanCode());
if (!ObjectUtils.isEmpty(extPlanVO1)) {
extPlanVO.setParentId(extPlanVO1.getId());
}
}
extPlanVO.setName(planExcelVO.getName());
extPlanVO.setNumber(planExcelVO.getNumber());
extPlanVO.setOperator(operatorType);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment