Commit 4e80c448 authored by 侯彦文's avatar 侯彦文

新建进度计划

parent 1904e042
......@@ -207,7 +207,7 @@ public class ExtIEDPlanServiceImpl<V extends ExtIEDPlanVO> implements ExtIEDPlan
DxDocumentVO dxDocumentVOForDB = extDxDocumentServiceFeign.saveRecursion(dxDocumentVO);
//保存文档与IED计划的关系
ExtIEDPlanDocLinkVO extIEDPlanDocLinkVO = new ExtIEDPlanDocLinkVO();
extIEDPlanDocLinkVO.setTargetId(dxDocumentVOForDB.getId());
extIEDPlanDocLinkVO.setTargetId(dxDocumentVOForDB.getVersionId());
extIEDPlanDocLinkVO.setSourceId(extIEDPlanVO.getId());
extIEDPlanDocLinkVO.setOperator(OperatorType.ADD);
extIEDPlanDocLinkService.saveRecursion(extIEDPlanDocLinkVO);
......
......@@ -13,8 +13,10 @@ import com.yonde.dcs.plan.common.utils.ExcelUtils;
import com.yonde.dcs.plan.common.utils.FileUtils;
import com.yonde.dcs.plan.common.utils.ResourceHelper;
import com.yonde.dcs.plan.common.vo.*;
import com.yonde.dcs.plan.core.repository.ExtPlanRepository;
import com.yonde.dcs.plan.core.service.ExtDistributeRecordService;
import com.yonde.dcs.plan.core.service.ExtPlanDocLinkService;
import com.yonde.dcs.plan.core.service.ExtPlanService;
import com.yonde.dcs.plan.entity.po.ExtPlan;
import com.yonde.dex.basedata.data.search.SearchItem;
import com.yonde.dex.basedata.data.search.SearchItems;
import com.yonde.dex.basedata.data.search.SearchQueryCondition;
......@@ -34,46 +36,38 @@ import com.yonde.dex.user.feign.DxOrganizationFeign;
import com.yonde.dex.user.feign.DxUserInfoFeign;
import com.yonde.dex.version.plugin.core.deleteType.IterationDeleteVO;
import dm.jdbc.util.StringUtil;
import lombok.val;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.usermodel.CellStyle;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import io.swagger.annotations.ApiOperation;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.net.URLEncoder;
import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Autowired;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import com.yonde.dcs.plan.core.service.ExtPlanService;
import com.yonde.dcs.plan.core.repository.ExtPlanRepository;
import com.yonde.dcs.plan.entity.po.ExtPlan;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.net.URLEncoder;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
/**
* @description: ExtPlan-ServiceImpl
* @author: dexadmin
* @version: V
* @date: 2024-7-26 9:34:06
**/
* @description: ExtPlan-ServiceImpl
* @author: dexadmin
* @version: V
* @date: 2024-7-26 9:34:06
**/
@Slf4j
@Service(ExtPlanServiceImpl.BEAN_NAME)
public class ExtPlanServiceImpl<V extends ExtPlanVO> implements ExtPlanService<V>{
public class ExtPlanServiceImpl<V extends ExtPlanVO> implements ExtPlanService<V> {
public static final String BEAN_NAME = "extPlanServiceImpl";
......@@ -196,7 +190,6 @@ public class ExtPlanServiceImpl<V extends ExtPlanVO> implements ExtPlanService<V
case "新增":
//先校验
stringBuffer = this.checkPlan(excelVO, i, stringBuffer, projectId);
//校验交付文件类的编号是否重复
stringBuffer = this.checkFileNumber(excelVO, i, stringBuffer);
addPlans.add(excelVO);
break;
......@@ -208,7 +201,9 @@ public class ExtPlanServiceImpl<V extends ExtPlanVO> implements ExtPlanService<V
updatePlans.add(excelVO);
break;
case "删除":
stringBuffer = this.checkPlanNumber(excelVO, i, stringBuffer);
if (StringUtils.isEmpty(excelVO.getNumber())) {
stringBuffer.append(String.format("第%s行,计划编号为空", i + 1) + "</br>");
}
removePlans.add(excelVO);
break;
default:
......@@ -248,8 +243,6 @@ public class ExtPlanServiceImpl<V extends ExtPlanVO> implements ExtPlanService<V
if (ObjectUtils.isEmpty(extPlanVOByNumber)) {
ExtPlanVO extPlanVO = this.copyPlan(x, OperatorType.ADD);
//工期=完成时间-开始时间
// int dayDiffer = DateUtils.getDayDiffer(extPlanVO.getStartTime(), extPlanVO.getCompleteTime());
// extPlanVO.setConstructPeriod(String.valueOf(dayDiffer) + "天");
extPlanVO.setState(Constants.PLAN_STATE_UNOPENED);
extPlanVO.setDxContextId(projectId);
this.saveRecursion((V) extPlanVO);
......@@ -257,27 +250,26 @@ public class ExtPlanServiceImpl<V extends ExtPlanVO> implements ExtPlanService<V
});
}
/**
* 设置计划值
*/
private void settingPlan(ExcelReader reader) {
reader.addHeaderAlias("操作", "operate");
reader.addHeaderAlias("计划编号", "number");
reader.addHeaderAlias("计划级别", "planLevel");
reader.addHeaderAlias("计划编号", "number");
reader.addHeaderAlias("父级计划编号", "superPlanCode");
reader.addHeaderAlias("计划名称", "name");
reader.addHeaderAlias("阶段状态", "phaseState");
reader.addHeaderAlias("业务计划类型", "businessPlanType");
reader.addHeaderAlias("阶段状态", "phaseState");
reader.addHeaderAlias("反馈类型", "feedbackType");
reader.addHeaderAlias("是否产生计划任务", "hasPlanTasks");
/*reader.addHeaderAlias("是否产生计划任务", "hasPlanTasks");*/
reader.addHeaderAlias("合同编号", "contractNo");
reader.addHeaderAlias("计划执行人", "planExecutor");
reader.addHeaderAlias("父级计划编号", "superPlanCode");
reader.addHeaderAlias("工期", "constructPeriod");
reader.addHeaderAlias("开始时间", "startTime");
reader.addHeaderAlias("完成时间", "completeTime");
//文件分类
reader.addHeaderAlias("文件分类", "fileType");
/* reader.addHeaderAlias("文件分类", "fileType");
reader.addHeaderAlias("文件名称", "fileName");
reader.addHeaderAlias("文件编号", "fileNumber");
reader.addHeaderAlias("文件代号", "fileCode");
......@@ -285,7 +277,7 @@ public class ExtPlanServiceImpl<V extends ExtPlanVO> implements ExtPlanService<V
reader.addHeaderAlias("管理信息系统编码", "systemCode");
reader.addHeaderAlias("审核者", "review");
reader.addHeaderAlias("批准者", "approver");
reader.addHeaderAlias("审定者", "verifier");
reader.addHeaderAlias("审定者", "verifier");*/
reader.addHeaderAlias("密级", "secretCode");
}
......@@ -296,7 +288,9 @@ public class ExtPlanServiceImpl<V extends ExtPlanVO> implements ExtPlanService<V
*/
private StringBuffer checkPlan(PlanExcelVO excelVO, int i, StringBuffer buffer, long projectId) {
//校验
this.checkPlanNumber(excelVO, i, buffer);
if (StringUtils.isEmpty(excelVO.getNumber())) {
buffer.append(String.format("第%s行的计划编号为空", i + 1) + "</br>");
}
if (StringUtils.isEmpty(excelVO.getName())) {
buffer.append(String.format("第%s行的计划名称为空", i + 1) + "</br>");
}
......@@ -306,29 +300,6 @@ public class ExtPlanServiceImpl<V extends ExtPlanVO> implements ExtPlanService<V
if (StringUtils.isEmpty(excelVO.getCompleteTime())) {
buffer.append(String.format("第%s行,请填写正确的计划完成时间的日期格式", i + 1) + "</br>");
}
// if (StringUtils.isEmpty(excelVO.getConstructPeriod())) {
// buffer.append(String.format("第%s行的计划计划工期为空", i + 1) + "</br>");
// }
if ("交付文件类".equals(excelVO.getFeedbackType())) {
//交付文件类属于技术文件,校验阶段属性不能为空
String fileType = excelVO.getFileType();
if (!StringUtils.isEmpty(fileType)) {
String[] split = fileType.split("/");
String s = split[0];
if ("技术文件".equals(s) && StringUtils.isEmpty(excelVO.getPhaseState())) {
buffer.append(String.format("第%s行的计划交付文件类的阶段为空", i + 1) + "</br>");
}
} else {
buffer.append(String.format("第%s行的文件分类为空", i + 1) + "</br>");
}
//判断字典值
String projectCode = excelVO.getProjectCode();
String dictKey = this.searchDictDataByDictCode(Constants.PROJECT_CODE, projectCode);
if (StringUtils.isEmpty(dictKey)) {
buffer.append(String.format("第%s行的交付文件类的项目代号不存在!", i + 1) + "</br>");
}
}
// 密级校验
String secretCode = excelVO.getSecretCode();
String secretCodeKey = this.searchDictDataByDictCode(Constants.SECRET_CODE, secretCode);
......@@ -339,18 +310,6 @@ public class ExtPlanServiceImpl<V extends ExtPlanVO> implements ExtPlanService<V
}
/**
* 校验计划编号
*
* @param excelVO
*/
private StringBuffer checkPlanNumber(PlanExcelVO excelVO, int i, StringBuffer buffer) {
if (StringUtils.isEmpty(excelVO.getNumber())) {
buffer.append(String.format("第%s行的计划编号为空", i + 1) + "</br>");
}
return buffer;
}
/**
* 查询字典
*
......@@ -437,13 +396,12 @@ public class ExtPlanServiceImpl<V extends ExtPlanVO> implements ExtPlanService<V
* @return
*/
private StringBuffer checkFileNumber(PlanExcelVO excelVO, int i, StringBuffer stringBuffer) {
if ("交付文件类".equals(excelVO.getFeedbackType())) {
//fileNumber可能会已存在,校验编号重复问题
DxDocumentVO searchDocByNumber = this.searchDocByNumber(excelVO.getFileNumber());
if (!ObjectUtils.isEmpty(searchDocByNumber)) {
stringBuffer.append(String.format("文档的文件编号%s已存在,请检查计划文件编号!", excelVO.getFileNumber()));
}
//fileNumber可能会已存在,校验编号重复问题
DxDocumentVO searchDocByNumber = this.searchDocByNumber(excelVO.getFileNumber());
if (!ObjectUtils.isEmpty(searchDocByNumber)) {
stringBuffer.append(String.format("文档的文件编号%s已存在,请检查计划文件编号!", excelVO.getFileNumber()));
}
return stringBuffer;
}
......@@ -480,68 +438,66 @@ public class ExtPlanServiceImpl<V extends ExtPlanVO> implements ExtPlanService<V
switch (extPlanVO.getState()) {
//未完成
case Constants.UNFINISHED:
if ("交付文件类".equals(extPlanVO.getFeedbackType()) && !CollectionUtils.isEmpty(extPlanVO.getExtPlanDocLinks())) {
for (ExtPlanDocLinkVO planDocLink : extPlanVO.getExtPlanDocLinks()) {
if (!ObjectUtils.isEmpty(planDocLink.getTarget())) {
if (!extPlanVO.getNumber().equals(excelVO.getNumber())) {
stringBuffer.append(String.format("第%s行的计划编号不允许修改", i + 1) + "</br>");
}
if (!extPlanVO.getName().equals(excelVO.getName())) {
stringBuffer.append(String.format("第%s行的计划名称不允许修改", i + 1) + "</br>");
for (ExtPlanDocLinkVO planDocLink : extPlanVO.getExtPlanDocLinks()) {
if (!ObjectUtils.isEmpty(planDocLink.getTarget())) {
if (!extPlanVO.getNumber().equals(excelVO.getNumber())) {
stringBuffer.append(String.format("第%s行的计划编号不允许修改", i + 1) + "</br>");
}
if (!extPlanVO.getName().equals(excelVO.getName())) {
stringBuffer.append(String.format("第%s行的计划名称不允许修改", i + 1) + "</br>");
}
int compare = extPlanVO.getStartTime().compareTo(excelVO.getStartTime());
if (compare != 0) {
stringBuffer.append(String.format("第%s行的计划开始时间不允许修改", i + 1) + "</br>");
}
if (!extPlanVO.getFeedbackType().equals(excelVO.getFeedbackType())) {
stringBuffer.append(String.format("第%s行的计划反馈类型不允许修改", i + 1) + "</br>");
}
if (!extPlanVO.getPlanExecutor().equals(excelVO.getPlanExecutor())) {
stringBuffer.append(String.format("第%s行的计划执行人不允许修改", i + 1) + "</br>");
}
if (!StringUtil.equals(extPlanVO.getFileType(), excelVO.getFileType())) {
stringBuffer.append(String.format("第%s行的计划交付文件类型不允许修改", i + 1) + "</br>");
}
if (!StringUtil.equals(extPlanVO.getFileName(), excelVO.getFileName())) {
stringBuffer.append(String.format("第%s行的计划交付文件名称不允许修改", i + 1) + "</br>");
}
if (!StringUtil.equals(extPlanVO.getFileNumber(), excelVO.getFileNumber())) {
stringBuffer.append(String.format("第%s行的计划交付文件编号不允许修改", i + 1) + "</br>");
}
if (!StringUtil.equals(extPlanVO.getPhaseState(), excelVO.getPhaseState())) {
stringBuffer.append(String.format("第%s行的计划阶段状态不允许修改", i + 1) + "</br>");
}
DxDocumentVO doc = planDocLink.getTarget();
if (Constants.REVIEWING.equals(doc.getState())) {
if (!StringUtil.equals(extPlanVO.getBusinessPlanType(), excelVO.getBusinessPlanType())) {
stringBuffer.append(String.format("第%s行的计划业务计划类型不允许修改", i + 1) + "</br>");
}
int compare = extPlanVO.getStartTime().compareTo(excelVO.getStartTime());
if (compare != 0) {
stringBuffer.append(String.format("第%s行的计划开始时间不允许修改", i + 1) + "</br>");
if (!StringUtil.equals(extPlanVO.getContractNo(), excelVO.getContractNo())) {
stringBuffer.append(String.format("第%s行的计划合同编号不允许修改", i + 1) + "</br>");
}
if (!extPlanVO.getFeedbackType().equals(excelVO.getFeedbackType())) {
stringBuffer.append(String.format("第%s行的计划反馈类型不允许修改", i + 1) + "</br>");
if (!StringUtil.equals(extPlanVO.getSuperPlanCode(), excelVO.getSuperPlanCode())) {
stringBuffer.append(String.format("第%s行的计划父级计划编号不允许修改", i + 1) + "</br>");
}
if (!extPlanVO.getPlanExecutor().equals(excelVO.getPlanExecutor())) {
stringBuffer.append(String.format("第%s行的计划执行人不允许修改", i + 1) + "</br>");
if (!StringUtil.equals(extPlanVO.getFileCode(), excelVO.getFileCode())) {
stringBuffer.append(String.format("第%s行的计划文件代号不允许修改", i + 1) + "</br>");
}
if (!StringUtil.equals(extPlanVO.getFileType(), excelVO.getFileType())) {
stringBuffer.append(String.format("第%s行的计划交付文件类型不允许修改", i + 1) + "</br>");
if (!StringUtil.equals(extPlanVO.getProjectCode(), excelVO.getProjectCode())) {
stringBuffer.append(String.format("第%s行的计划项目代号不允许修改", i + 1) + "</br>");
}
if (!StringUtil.equals(extPlanVO.getFileName(), excelVO.getFileName())) {
stringBuffer.append(String.format("第%s行的计划交付文件名称不允许修改", i + 1) + "</br>");
if (!StringUtil.equals(extPlanVO.getSystemCode(), excelVO.getSystemCode())) {
stringBuffer.append(String.format("第%s行的计划管理信息系统编码不允许修改", i + 1) + "</br>");
}
if (!StringUtil.equals(extPlanVO.getFileNumber(), excelVO.getFileNumber())) {
stringBuffer.append(String.format("第%s行的计划交付文件编号不允许修改", i + 1) + "</br>");
if (!StringUtil.equals(extPlanVO.getReview(), excelVO.getReview())) {
stringBuffer.append(String.format("第%s行的计划审核者不允许修改", i + 1) + "</br>");
}
if (!StringUtil.equals(extPlanVO.getPhaseState(), excelVO.getPhaseState())) {
stringBuffer.append(String.format("第%s行的计划阶段状态不允许修改", i + 1) + "</br>");
if (!StringUtil.equals(extPlanVO.getApprover(), excelVO.getApprover())) {
stringBuffer.append(String.format("第%s行的计划批准者不允许修改", i + 1) + "</br>");
}
DxDocumentVO doc = planDocLink.getTarget();
if (Constants.REVIEWING.equals(doc.getState())) {
if (!StringUtil.equals(extPlanVO.getBusinessPlanType(), excelVO.getBusinessPlanType())) {
stringBuffer.append(String.format("第%s行的计划业务计划类型不允许修改", i + 1) + "</br>");
}
if (!StringUtil.equals(extPlanVO.getContractNo(), excelVO.getContractNo())) {
stringBuffer.append(String.format("第%s行的计划合同编号不允许修改", i + 1) + "</br>");
}
if (!StringUtil.equals(extPlanVO.getSuperPlanCode(), excelVO.getSuperPlanCode())) {
stringBuffer.append(String.format("第%s行的计划父级计划编号不允许修改", i + 1) + "</br>");
}
if (!StringUtil.equals(extPlanVO.getFileCode(), excelVO.getFileCode())) {
stringBuffer.append(String.format("第%s行的计划文件代号不允许修改", i + 1) + "</br>");
}
if (!StringUtil.equals(extPlanVO.getProjectCode(), excelVO.getProjectCode())) {
stringBuffer.append(String.format("第%s行的计划项目代号不允许修改", i + 1) + "</br>");
}
if (!StringUtil.equals(extPlanVO.getSystemCode(), excelVO.getSystemCode())) {
stringBuffer.append(String.format("第%s行的计划管理信息系统编码不允许修改", i + 1) + "</br>");
}
if (!StringUtil.equals(extPlanVO.getReview(), excelVO.getReview())) {
stringBuffer.append(String.format("第%s行的计划审核者不允许修改", i + 1) + "</br>");
}
if (!StringUtil.equals(extPlanVO.getApprover(), excelVO.getApprover())) {
stringBuffer.append(String.format("第%s行的计划批准者不允许修改", i + 1) + "</br>");
}
if (!StringUtil.equals(extPlanVO.getVerifier(), excelVO.getVerifier())) {
stringBuffer.append(String.format("第%s行的计划审定者不允许修改", i + 1) + "</br>");
}
if (!StringUtil.equals(extPlanVO.getVerifier(), excelVO.getVerifier())) {
stringBuffer.append(String.format("第%s行的计划审定者不允许修改", i + 1) + "</br>");
}
}
}
......@@ -599,14 +555,11 @@ public class ExtPlanServiceImpl<V extends ExtPlanVO> implements ExtPlanService<V
// 反馈类型
String feedbackType = extPlanVO.getFeedbackType();
switch (feedbackType) {
case "交付文件类":
extPlanVO.setSubTypeName("DeliveryFileClass");
break;
case "计划反馈类":
extPlanVO.setSubTypeName("PlanFeedback");
extPlanVO.setSubTypeName("ExtPlanFeedback");
break;
case "无反馈类":
extPlanVO.setSubTypeName("NoFeedback");
extPlanVO.setSubTypeName("ExtNoFeedback");
break;
default:
extPlanVO.setSubTypeName("ExtPlan");
......@@ -654,6 +607,7 @@ public class ExtPlanServiceImpl<V extends ExtPlanVO> implements ExtPlanService<V
}
return DxPageUtils.getFirst(recursion);
}
/**
* 校验计划答复状态
*
......@@ -891,7 +845,8 @@ public class ExtPlanServiceImpl<V extends ExtPlanVO> implements ExtPlanService<V
}
@Autowired
DxOrganizationFeign organizationFeign;
DxOrganizationFeign organizationFeign;
/**
* 生成计划分发记录对象方法
*
......@@ -914,7 +869,7 @@ public class ExtPlanServiceImpl<V extends ExtPlanVO> implements ExtPlanService<V
//todo wq:获取用户方式修改未深度查询方式,原2.0:this.searchUserId(extPlanVO.getPlanExecutor())
DxUserInfoVO dxUserInfoVO = getUserInfoByAccount(extPlanVO.getPlanExecutor());
// Long userId = this.searchUserId(extPlanVO.getPlanExecutor());
Long userId = dxUserInfoVO == null ? null:dxUserInfoVO.getUserId();
Long userId = dxUserInfoVO == null ? null : dxUserInfoVO.getUserId();
//接收者(计划执行人)
recordVO.setHandleId(userId);
//接收时间
......@@ -958,6 +913,7 @@ public class ExtPlanServiceImpl<V extends ExtPlanVO> implements ExtPlanService<V
/**
* 根据用户账户查询用户
*
* @param userAccount
* @return
*/
......
......@@ -63,6 +63,7 @@ public class ExtPuchasePlanAttributeServiceImpl<V extends ExtPuchasePlanAttribut
private FileManagerFeignService fileManagerFeignService;
@Autowired
private SystemFileFeignService systemFileFeignService;
@Qualifier("com.yonde.dcs.feign.expand.ExtDxDocumentServiceFeign")
@Autowired
private ExtDxDocumentServiceFeign docCenterFeignService;
......
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