|
@@ -1,5 +1,6 @@
|
|
package com.qmth.sop.business.service.impl;
|
|
package com.qmth.sop.business.service.impl;
|
|
|
|
|
|
|
|
+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.qmth.sop.business.activiti.service.ActivitiService;
|
|
import com.qmth.sop.business.activiti.service.ActivitiService;
|
|
@@ -12,11 +13,10 @@ import com.qmth.sop.business.mapper.TBProjectExchangeMapper;
|
|
import com.qmth.sop.business.service.TBProjectExchangeService;
|
|
import com.qmth.sop.business.service.TBProjectExchangeService;
|
|
import com.qmth.sop.business.service.TFCustomFlowEntityService;
|
|
import com.qmth.sop.business.service.TFCustomFlowEntityService;
|
|
import com.qmth.sop.common.contant.SystemConstant;
|
|
import com.qmth.sop.common.contant.SystemConstant;
|
|
-import com.qmth.sop.common.enums.DelayWarnTypeEnum;
|
|
|
|
-import com.qmth.sop.common.enums.FlowApprovePassEnum;
|
|
|
|
-import com.qmth.sop.common.enums.ProductTypeEnum;
|
|
|
|
-import com.qmth.sop.common.enums.ProjectExchangeFlowStatusEnum;
|
|
|
|
|
|
+import com.qmth.sop.common.enums.*;
|
|
import com.qmth.sop.common.util.ServletUtil;
|
|
import com.qmth.sop.common.util.ServletUtil;
|
|
|
|
+import org.activiti.engine.TaskService;
|
|
|
|
+import org.activiti.engine.task.Task;
|
|
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;
|
|
@@ -25,6 +25,7 @@ import javax.annotation.Resource;
|
|
import java.util.Arrays;
|
|
import java.util.Arrays;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
import java.util.Objects;
|
|
import java.util.Objects;
|
|
|
|
+import java.util.Optional;
|
|
|
|
|
|
/**
|
|
/**
|
|
* <p>
|
|
* <p>
|
|
@@ -43,6 +44,9 @@ public class TBProjectExchangeServiceImpl extends ServiceImpl<TBProjectExchangeM
|
|
@Resource
|
|
@Resource
|
|
TFCustomFlowEntityService tfCustomFlowEntityService;
|
|
TFCustomFlowEntityService tfCustomFlowEntityService;
|
|
|
|
|
|
|
|
+ @Resource
|
|
|
|
+ TaskService taskService;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 新增项目变更计划申请
|
|
* 新增项目变更计划申请
|
|
*
|
|
*
|
|
@@ -83,4 +87,49 @@ public class TBProjectExchangeServiceImpl extends ServiceImpl<TBProjectExchangeM
|
|
createUserId = Objects.isNull(createUserId) ? sysUser.getId() : createUserId;
|
|
createUserId = Objects.isNull(createUserId) ? sysUser.getId() : createUserId;
|
|
return this.baseMapper.list(iPage, serviceId, createUserId, Objects.nonNull(type) ? type.name() : null, Objects.nonNull(customType) ? customType.name() : null, Objects.nonNull(flowStatus) ? flowStatus.name() : null, customName, exchangeNo, startTime, endTime);
|
|
return this.baseMapper.list(iPage, serviceId, createUserId, Objects.nonNull(type) ? type.name() : null, Objects.nonNull(customType) ? customType.name() : null, Objects.nonNull(flowStatus) ? flowStatus.name() : null, customName, exchangeNo, startTime, endTime);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 项目计划变更审核接口
|
|
|
|
+ *
|
|
|
|
+ * @param taskId
|
|
|
|
+ * @param flowApprove
|
|
|
|
+ * @param projectExchangeApprove
|
|
|
|
+ * @param remark
|
|
|
|
+ * @param userId
|
|
|
|
+ * @return
|
|
|
|
+ * @throws InterruptedException
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ @Transactional
|
|
|
|
+ public Boolean flowApprove(Long taskId, FlowApprovePassEnum flowApprove, ProjectExchangeApproveEnum projectExchangeApprove, String remark, Long userId) throws InterruptedException {
|
|
|
|
+ SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
|
+ userId = Objects.nonNull(sysUser) ? sysUser.getId() : userId;
|
|
|
|
+ Task task = taskService.createTaskQuery().taskId(String.valueOf(taskId)).singleResult();
|
|
|
|
+ Optional.ofNullable(task).orElseThrow(() -> ExceptionResultEnum.FLOW_TASK_NO_DATA.exception());
|
|
|
|
+
|
|
|
|
+ TFCustomFlowEntity tfCustomFlowEntity = tfCustomFlowEntityService.getOne(new QueryWrapper<TFCustomFlowEntity>().lambda().eq(TFCustomFlowEntity::getFlowId, Long.parseLong(task.getProcessInstanceId())));
|
|
|
|
+ activitiService.taskApprove(new FlowApproveParam(taskId, flowApprove, Arrays.asList(String.valueOf(userId)), tfCustomFlowEntity.getCrmNo(), projectExchangeApprove.getTitle() + ";" + remark));
|
|
|
|
+
|
|
|
|
+ TBProjectExchange tbProjectExchange = this.getOne(new QueryWrapper<TBProjectExchange>().lambda().eq(TBProjectExchange::getExchangeNo, tfCustomFlowEntity.getCode()));
|
|
|
|
+ Optional.ofNullable(tbProjectExchange).orElseThrow(() -> ExceptionResultEnum.PROJECT_EXCHANGE_NO_DATA.exception());
|
|
|
|
+
|
|
|
|
+ tbProjectExchange.setResult(projectExchangeApprove);
|
|
|
|
+ tbProjectExchange.setRemark(remark);
|
|
|
|
+ return this.updateById(tbProjectExchange);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 项目计划变更详情接口
|
|
|
|
+ *
|
|
|
|
+ * @param id
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ public Object view(Long id) {
|
|
|
|
+ TBProjectExchange tbProjectExchange = this.getById(id);
|
|
|
|
+ Optional.ofNullable(tbProjectExchange).orElseThrow(() -> ExceptionResultEnum.PROJECT_EXCHANGE_NO_DATA.exception());
|
|
|
|
+
|
|
|
|
+ //TODO 需要根据crm单号取crm相关信息
|
|
|
|
+ return tbProjectExchange;
|
|
|
|
+ }
|
|
}
|
|
}
|