|
@@ -1,22 +1,24 @@
|
|
package com.qmth.sop.business.service.impl;
|
|
package com.qmth.sop.business.service.impl;
|
|
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
+import com.google.gson.reflect.TypeToken;
|
|
import com.qmth.sop.business.activiti.service.ActivitiService;
|
|
import com.qmth.sop.business.activiti.service.ActivitiService;
|
|
import com.qmth.sop.business.bean.dto.DataPermissionDto;
|
|
import com.qmth.sop.business.bean.dto.DataPermissionDto;
|
|
import com.qmth.sop.business.bean.dto.UserDto;
|
|
import com.qmth.sop.business.bean.dto.UserDto;
|
|
import com.qmth.sop.business.bean.params.FlowApproveParam;
|
|
import com.qmth.sop.business.bean.params.FlowApproveParam;
|
|
-import com.qmth.sop.business.bean.result.CrmProjectResult;
|
|
|
|
-import com.qmth.sop.business.bean.result.ProjectExchangeResult;
|
|
|
|
-import com.qmth.sop.business.bean.result.TBProjectExchangeViewResult;
|
|
|
|
|
|
+import com.qmth.sop.business.bean.result.*;
|
|
import com.qmth.sop.business.entity.SysUser;
|
|
import com.qmth.sop.business.entity.SysUser;
|
|
import com.qmth.sop.business.entity.TBProjectExchange;
|
|
import com.qmth.sop.business.entity.TBProjectExchange;
|
|
import com.qmth.sop.business.entity.TFCustomFlowEntity;
|
|
import com.qmth.sop.business.entity.TFCustomFlowEntity;
|
|
|
|
+import com.qmth.sop.business.entity.TFFlowApprove;
|
|
import com.qmth.sop.business.mapper.TBProjectExchangeMapper;
|
|
import com.qmth.sop.business.mapper.TBProjectExchangeMapper;
|
|
import com.qmth.sop.business.service.*;
|
|
import com.qmth.sop.business.service.*;
|
|
import com.qmth.sop.common.contant.SystemConstant;
|
|
import com.qmth.sop.common.contant.SystemConstant;
|
|
import com.qmth.sop.common.enums.*;
|
|
import com.qmth.sop.common.enums.*;
|
|
|
|
+import com.qmth.sop.common.util.GsonUtil;
|
|
import com.qmth.sop.common.util.ServletUtil;
|
|
import com.qmth.sop.common.util.ServletUtil;
|
|
import org.activiti.engine.TaskService;
|
|
import org.activiti.engine.TaskService;
|
|
import org.activiti.engine.task.IdentityLink;
|
|
import org.activiti.engine.task.IdentityLink;
|
|
@@ -61,6 +63,12 @@ public class TBProjectExchangeServiceImpl extends ServiceImpl<TBProjectExchangeM
|
|
@Resource
|
|
@Resource
|
|
SysUserService sysUserService;
|
|
SysUserService sysUserService;
|
|
|
|
|
|
|
|
+ @Resource
|
|
|
|
+ TFFlowLogService tfFlowLogService;
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ TFFlowApproveService tfFlowApproveService;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 新增项目变更计划申请
|
|
* 新增项目变更计划申请
|
|
*
|
|
*
|
|
@@ -184,6 +192,28 @@ public class TBProjectExchangeServiceImpl extends ServiceImpl<TBProjectExchangeM
|
|
CrmProjectResult crmProjectResult = tbCrmService.findCrmProjectBySopNoOrCrmNo(tbProjectExchange.getSopNo(), tbProjectExchange.getCrmNo());
|
|
CrmProjectResult crmProjectResult = tbCrmService.findCrmProjectBySopNoOrCrmNo(tbProjectExchange.getSopNo(), tbProjectExchange.getCrmNo());
|
|
Optional.ofNullable(crmProjectResult).orElseThrow(() -> ExceptionResultEnum.CRM_NO_NO_DATA.exception());
|
|
Optional.ofNullable(crmProjectResult).orElseThrow(() -> ExceptionResultEnum.CRM_NO_NO_DATA.exception());
|
|
|
|
|
|
- return new TBProjectExchangeViewResult(crmProjectResult, tbProjectExchange);
|
|
|
|
|
|
+ TFCustomFlowEntity tfCustomFlowEntity = tfCustomFlowEntityService.getOne(new QueryWrapper<TFCustomFlowEntity>().lambda().eq(TFCustomFlowEntity::getCode, tbProjectExchange.getExchangeNo()));
|
|
|
|
+ Optional.ofNullable(tfCustomFlowEntity).orElseThrow(() -> ExceptionResultEnum.FLOW_ENTITY_NO_DATA.exception());
|
|
|
|
+
|
|
|
|
+ //获取当前流程节点
|
|
|
|
+ TFFlowApprove tfFlowApprove = tfFlowApproveService.getOne(new QueryWrapper<TFFlowApprove>().lambda().eq(TFFlowApprove::getFlowId, tfCustomFlowEntity.getFlowId()));
|
|
|
|
+ Optional.ofNullable(tfFlowApprove).orElseThrow(() -> ExceptionResultEnum.FLOW_APPROVE_NO_DATA.exception());
|
|
|
|
+
|
|
|
|
+ FlowResult flowResult = JSONObject.parseObject(tfCustomFlowEntity.getFlowProcessVar(), FlowResult.class);
|
|
|
|
+ LinkedHashMap<String, FlowTaskResult> setupMap = flowResult.getSetupMap();
|
|
|
|
+
|
|
|
|
+ //获取流程审批历史
|
|
|
|
+ List<TFFlowViewLogResult> flowApproveHistoryList = null;
|
|
|
|
+ Map<Integer, Integer> approveSetupMap = new HashMap<>();
|
|
|
|
+ List<TFFlowLogResult> tfFlowLogResultList = tfFlowLogService.findByObjectId(tfCustomFlowEntity.getId());
|
|
|
|
+ if (!CollectionUtils.isEmpty(tfFlowLogResultList)) {
|
|
|
|
+ flowApproveHistoryList = GsonUtil.fromJson(GsonUtil.toJson(tfFlowLogResultList), new TypeToken<List<TFFlowViewLogResult>>() {
|
|
|
|
+ }.getType());
|
|
|
|
+ for (TFFlowViewLogResult t : flowApproveHistoryList) {
|
|
|
|
+ t.setMessageType(FlowMsgTypeEnum.STANDARD);
|
|
|
|
+ approveSetupMap.put(t.getApproveSetup(), t.getApproveSetup());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return new TBProjectExchangeViewResult(crmProjectResult, tbProjectExchange, flowApproveHistoryList);
|
|
}
|
|
}
|
|
}
|
|
}
|