Commit 9b6e9463 authored by wangyangyang's avatar wangyangyang

基线:基线计划状态保存到动态属性中

parent 473f60f8
package com.yonde.dcs.plan.core.service.impl;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.ReflectUtil;
import cn.hutool.core.util.StrUtil;
import com.yonde.dcs.plan.common.vo.ExtIEDPlanVO;
import com.yonde.dcs.plan.common.vo.ExtPlanBaseLineLinkVO;
import com.yonde.dcs.plan.core.service.ExtPlanBaseLineLinkService;
import com.yonde.dcs.plan.core.util.SearchUtil;
......@@ -23,7 +25,9 @@ import com.yonde.dcs.plan.entity.po.ExtPlanBaseLine;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @description: ExtPlanBaseLine-ServiceImpl
......@@ -52,17 +56,26 @@ public class ExtPlanBaseLineServiceImpl<V extends ExtPlanBaseLineVO> implements
String beanName = StrUtil.lowerFirst(baseLineVO.getPlanType()) + "ServiceImpl";
IterationService iterationService = (IterationService) ApplicationContextUtil.getBean(beanName);
DxPageImpl recursion = iterationService.findRecursion(queryCondition);
ExtIEDPlanVO iedPlanVO = new ExtIEDPlanVO();
iedPlanVO.getDynamicAttrs();
if (recursion.getTotalElements() != 0) {
List<IdVO> result = recursion.getContent();
List<IdOnlyVO> result = recursion.getContent();
List<ExtPlanBaseLineLinkVO> lineLinkVOS = new ArrayList<>();
result.forEach(idVO -> {
idVO.setOperator(OperatorType.ADD);
idVO.setId(null);
ReflectUtil.setFieldValue(idVO, "dxContextId", null);
ReflectUtil.setFieldValue(idVO, "dxContextEmbeddable", null);
//TODO 新建的计划状态都是初始状态且计划不会自启流程 这里使用动态baselineState来保存计划状态
String life = StrUtil.toString(ReflectUtil.getFieldValue(idVO, "dxLifecycleManageBaseEmbeddable"));
String state = life.substring(life.lastIndexOf("=") + 1, life.lastIndexOf(")"));
Map<String, Object> dynamicAttrs = new HashMap<>();
if (MapUtil.isNotEmpty(idVO.getDynamicAttrs())) {
dynamicAttrs = idVO.getDynamicAttrs();
}
dynamicAttrs.put("baselineState", ReflectUtil.getFieldValue(idVO, state));
ExtPlanBaseLineLinkVO lineLinkVO = new ExtPlanBaseLineLinkVO();
lineLinkVO.setOperator(OperatorType.ADD);
lineLinkVO.setTarget((IdOnlyVO) idVO);
lineLinkVO.setTarget(idVO);
lineLinkVOS.add(lineLinkVO);
});
baseLineVO.setExtPlanBaseLineLinks(lineLinkVOS);
......
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