Commit 5a51c052 authored by 侯彦文's avatar 侯彦文

进度计划

parent 32d4db3e
...@@ -307,6 +307,11 @@ public class ExtPlanVO extends IdOnlyVO implements IdVO ,DxTreeContextVOHolder<E ...@@ -307,6 +307,11 @@ public class ExtPlanVO extends IdOnlyVO implements IdVO ,DxTreeContextVOHolder<E
*/ */
private String verifier; private String verifier;
/**
* 计划执行人ID
*/
private Long planExecutorId;
} }
...@@ -126,4 +126,8 @@ public class PlanExcelVO implements Serializable { ...@@ -126,4 +126,8 @@ public class PlanExcelVO implements Serializable {
* 密级 * 密级
*/ */
private String secretCode; private String secretCode;
/**
* 计划执行人ID
*/
private Long planExecutorId;
} }
...@@ -7,7 +7,6 @@ import cn.hutool.poi.excel.ExcelWriter; ...@@ -7,7 +7,6 @@ import cn.hutool.poi.excel.ExcelWriter;
import cn.hutool.poi.excel.StyleSet; import cn.hutool.poi.excel.StyleSet;
import com.yonde.dcs.document.common.entity.vo.DxDocumentVO; import com.yonde.dcs.document.common.entity.vo.DxDocumentVO;
import com.yonde.dcs.document.expand.entity.DxDocumentVOExpand; import com.yonde.dcs.document.expand.entity.DxDocumentVOExpand;
import com.yonde.dcs.document.feign.DocCenterFeignService;
import com.yonde.dcs.document.feign.expand.ExtDxDocumentServiceFeign; import com.yonde.dcs.document.feign.expand.ExtDxDocumentServiceFeign;
import com.yonde.dcs.plan.common.constants.Constants; import com.yonde.dcs.plan.common.constants.Constants;
import com.yonde.dcs.plan.common.utils.ExcelUtils; import com.yonde.dcs.plan.common.utils.ExcelUtils;
...@@ -42,7 +41,6 @@ import lombok.extern.slf4j.Slf4j; ...@@ -42,7 +41,6 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.usermodel.CellStyle; import org.apache.poi.ss.usermodel.CellStyle;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
...@@ -50,19 +48,14 @@ import org.springframework.util.ObjectUtils; ...@@ -50,19 +48,14 @@ import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.ServletOutputStream; import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.swing.text.Document;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.*;
import java.util.List;
import java.util.Objects;
import java.util.Properties;
/** /**
* @description: ExtPlan-ServiceImpl * @description: ExtPlan-ServiceImpl
...@@ -209,13 +202,12 @@ public class ExtPlanServiceImpl<V extends ExtPlanVO> implements ExtPlanService<V ...@@ -209,13 +202,12 @@ public class ExtPlanServiceImpl<V extends ExtPlanVO> implements ExtPlanService<V
switch (excelVO.getOperate()) { switch (excelVO.getOperate()) {
case "新增": case "新增":
//先校验 //先校验
stringBuffer = this.checkPlan(excelVO, i, stringBuffer, projectId); stringBuffer = this.checkPlan(excelVO, i, stringBuffer);
/*stringBuffer = this.checkFileNumber(excelVO, i, stringBuffer);*/
addPlans.add(excelVO); addPlans.add(excelVO);
break; break;
case "更改": case "更改":
//先校验 //先校验
stringBuffer = this.checkPlan(excelVO, i, stringBuffer, projectId); stringBuffer = this.checkPlan(excelVO, i, stringBuffer);
//校验未开启状态允许修改所有创建属性 //校验未开启状态允许修改所有创建属性
stringBuffer = this.checkUpdatePlan(excelVO, i, stringBuffer); stringBuffer = this.checkUpdatePlan(excelVO, i, stringBuffer);
updatePlans.add(excelVO); updatePlans.add(excelVO);
...@@ -257,16 +249,12 @@ public class ExtPlanServiceImpl<V extends ExtPlanVO> implements ExtPlanService<V ...@@ -257,16 +249,12 @@ public class ExtPlanServiceImpl<V extends ExtPlanVO> implements ExtPlanService<V
public void savePlans(List<PlanExcelVO> addPlans, Long projectId) { public void savePlans(List<PlanExcelVO> addPlans, Long projectId) {
//新增导入成功后,创建计划对象,状态置为:未开启 //新增导入成功后,创建计划对象,状态置为:未开启
addPlans.stream().forEach(x -> { addPlans.stream().forEach(x -> {
//过滤掉已存在的编码计划
//查询编码是否存在
ExtPlanVO extPlanVOByNumber = this.searchByNumber(x.getNumber());
if (ObjectUtils.isEmpty(extPlanVOByNumber)) {
ExtPlanVO extPlanVO = this.copyPlan(x, OperatorType.ADD); ExtPlanVO extPlanVO = this.copyPlan(x, OperatorType.ADD);
//工期=完成时间-开始时间 //工期=完成时间-开始时间
extPlanVO.setState(Constants.PLAN_STATE_UNOPENED); extPlanVO.setState(Constants.PLAN_STATE_UNOPENED);
extPlanVO.setDxContextId(projectId); extPlanVO.setDxContextId(projectId);
this.saveRecursion((V) extPlanVO); this.saveRecursion((V) extPlanVO);
}
}); });
} }
...@@ -306,7 +294,7 @@ public class ExtPlanServiceImpl<V extends ExtPlanVO> implements ExtPlanService<V ...@@ -306,7 +294,7 @@ public class ExtPlanServiceImpl<V extends ExtPlanVO> implements ExtPlanService<V
* *
* @param excelVO * @param excelVO
*/ */
private StringBuffer checkPlan(PlanExcelVO excelVO, int i, StringBuffer buffer, long projectId) { private StringBuffer checkPlan(PlanExcelVO excelVO, int i, StringBuffer buffer) {
//校验 //校验
if (StringUtils.isEmpty(excelVO.getNumber())) { if (StringUtils.isEmpty(excelVO.getNumber())) {
buffer.append(String.format("第%s行的计划编号为空", i + 1) + "</br>"); buffer.append(String.format("第%s行的计划编号为空", i + 1) + "</br>");
...@@ -317,6 +305,12 @@ public class ExtPlanServiceImpl<V extends ExtPlanVO> implements ExtPlanService<V ...@@ -317,6 +305,12 @@ public class ExtPlanServiceImpl<V extends ExtPlanVO> implements ExtPlanService<V
if (StringUtils.isEmpty(excelVO.getStartTime())) { if (StringUtils.isEmpty(excelVO.getStartTime())) {
buffer.append(String.format("第%s行,请填写正确的计划开始时间的日期格式", i + 1) + "</br>"); buffer.append(String.format("第%s行,请填写正确的计划开始时间的日期格式", i + 1) + "</br>");
} }
if (StringUtils.isEmpty(excelVO.getFeedbackType())) {
buffer.append(String.format("第%s行的反馈类型为空", i + 1) + "</br>");
}
if (StringUtils.isEmpty(excelVO.getPlanExecutor())) {
buffer.append(String.format("第%s行的计划执行人为空", i + 1) + "</br>");
}
if (StringUtils.isEmpty(excelVO.getCompleteTime())) { if (StringUtils.isEmpty(excelVO.getCompleteTime())) {
buffer.append(String.format("第%s行,请填写正确的计划完成时间的日期格式", i + 1) + "</br>"); buffer.append(String.format("第%s行,请填写正确的计划完成时间的日期格式", i + 1) + "</br>");
} }
...@@ -326,13 +320,26 @@ public class ExtPlanServiceImpl<V extends ExtPlanVO> implements ExtPlanService<V ...@@ -326,13 +320,26 @@ public class ExtPlanServiceImpl<V extends ExtPlanVO> implements ExtPlanService<V
if (StringUtils.isEmpty(secretCodeKey)) { if (StringUtils.isEmpty(secretCodeKey)) {
buffer.append(String.format("第%s行密级格式不正确!", i + 1) + "</br>"); buffer.append(String.format("第%s行密级格式不正确!", i + 1) + "</br>");
} }
if (Objects.nonNull(excelVO.getSuperPlanCode())){ if (Objects.nonNull(excelVO.getSuperPlanCode())) {
//校验父级编号 //校验父级编号
ExtPlanVO extPlanVO = this.searchByNumber(excelVO.getSuperPlanCode()); ExtPlanVO extPlanVO = this.searchByNumber(excelVO.getSuperPlanCode());
if (!ObjectUtils.isEmpty(extPlanVO)){ if (ObjectUtils.isEmpty(extPlanVO)) {
buffer.append(String.format("第%s行,父级编号不存在", i + 1) + "</br>"); buffer.append(String.format("第%s行,父级编号不存在", i + 1) + "</br>");
} }
} }
//校验编号是否已存在
ExtPlanVO extPlanVOByNumber = this.searchByNumber(excelVO.getNumber());
if (Objects.nonNull(extPlanVOByNumber)) {
buffer.append(String.format("第%s行,计划编号编号已存在", i + 1) + "</br>");
}
DxUserInfoVO userByName = dxUserInfoFeign.getUserByName(excelVO.getPlanExecutor());
if (ObjectUtils.isEmpty(userByName)){
buffer.append(String.format("第%s行,计划执行人不存在", i + 1) + "</br>");
}else {
excelVO.setPlanExecutorId(userByName.getId());
}
return buffer; return buffer;
} }
...@@ -390,7 +397,8 @@ public class ExtPlanServiceImpl<V extends ExtPlanVO> implements ExtPlanService<V ...@@ -390,7 +397,8 @@ public class ExtPlanServiceImpl<V extends ExtPlanVO> implements ExtPlanService<V
private ExtPlanVO searchByNumber(String number) { private ExtPlanVO searchByNumber(String number) {
//通过number查询id //通过number查询id
SearchQueryCondition query = SearchQueryCondition.builder() SearchQueryCondition query = SearchQueryCondition.builder()
.openProp(SearchQueryCondition.builder().name("sourcePlanDocLink").openProp(SearchQueryCondition.builder().name("target").build()).build()) .openProp(SearchQueryCondition.builder().name("sourcePlanDocLink")
.openProp(SearchQueryCondition.builder().name("target").build()).build())
.searchItems(SearchItems.builder().item( .searchItems(SearchItems.builder().item(
new SearchItem("number", SearchItem.Operator.EQ, number, null)) new SearchItem("number", SearchItem.Operator.EQ, number, null))
.item(new SearchItem("latest", SearchItem.Operator.EQ, true, null)) .item(new SearchItem("latest", SearchItem.Operator.EQ, true, null))
...@@ -414,42 +422,6 @@ public class ExtPlanServiceImpl<V extends ExtPlanVO> implements ExtPlanService<V ...@@ -414,42 +422,6 @@ public class ExtPlanServiceImpl<V extends ExtPlanVO> implements ExtPlanService<V
return planVO; return planVO;
} }
/**
* 校验交付文件类的编号是否重复
*
* @param excelVO
* @param i
* @param stringBuffer
* @return
*/
/* private StringBuffer checkFileNumber(PlanExcelVO excelVO, int i, StringBuffer stringBuffer) {
//fileNumber可能会已存在,校验编号重复问题
DxDocumentVO searchDocByNumber = this.searchDocByNumber(excelVO.getFileNumber());
if (!ObjectUtils.isEmpty(searchDocByNumber)) {
stringBuffer.append(String.format("文档的文件编号%s已存在,请检查计划文件编号!", excelVO.getFileNumber()));
}
return stringBuffer;
}*/
/**
* 通过number查询文档
*
* @param number
*/
private DxDocumentVO searchDocByNumber(String number) {
//通过number查询id
SearchQueryCondition query = SearchQueryCondition.builder()
.searchItems(SearchItems.builder().item(
new SearchItem("number", SearchItem.Operator.EQ, number, null))
.operator(SearchItems.BooleanOperator.AND).build()).build();
DxPageImpl<DxDocumentVO> recursion = extDxDocumentServiceFeign.findRecursion(query);
if (CollectionUtils.isEmpty(recursion.getContent())) {
return null;
}
return DxPageUtils.getFirst(recursion);
}
/** /**
* 校验未开启状态允许修改所有创建属性 * 校验未开启状态允许修改所有创建属性
* *
...@@ -582,6 +554,7 @@ public class ExtPlanServiceImpl<V extends ExtPlanVO> implements ExtPlanService<V ...@@ -582,6 +554,7 @@ public class ExtPlanServiceImpl<V extends ExtPlanVO> implements ExtPlanService<V
} }
extPlanVO.setName(planExcelVO.getName()); extPlanVO.setName(planExcelVO.getName());
extPlanVO.setNumber(planExcelVO.getNumber()); extPlanVO.setNumber(planExcelVO.getNumber());
extPlanVO.setPlanExecutorId(planExcelVO.getPlanExecutorId());
extPlanVO.setOperator(operatorType); extPlanVO.setOperator(operatorType);
// 密级 // 密级
String secretCodeKey = this.searchDictDataByDictCode(Constants.SECRET_CODE, planExcelVO.getSecretCode()); String secretCodeKey = this.searchDictDataByDictCode(Constants.SECRET_CODE, planExcelVO.getSecretCode());
......
...@@ -210,6 +210,11 @@ public class ExtPlan extends IdOnlyEntity implements DxContextHolder ,DxObjFileL ...@@ -210,6 +210,11 @@ public class ExtPlan extends IdOnlyEntity implements DxContextHolder ,DxObjFileL
* 审定者 * 审定者
*/ */
private String verifier; private String verifier;
/**
* 计划执行人ID
*/
private Long planExecutorId;
} }
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