Browse Source

sop编辑和保存修改

wangliang 1 năm trước cách đây
mục cha
commit
0bba337756

+ 15 - 8
sop-business/src/main/java/com/qmth/sop/business/service/impl/TBDingApplyServiceImpl.java

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.qmth.sop.business.activiti.service.ActivitiService;
 import com.qmth.sop.business.bean.params.FlowApproveParam;
+import com.qmth.sop.business.bean.result.CrmProjectResult;
 import com.qmth.sop.business.bean.result.DingApplyDoneResult;
 import com.qmth.sop.business.bean.result.DingApplyUnDoneResult;
 import com.qmth.sop.business.entity.SysUser;
@@ -12,10 +13,7 @@ import com.qmth.sop.business.entity.TBDing;
 import com.qmth.sop.business.entity.TBDingApply;
 import com.qmth.sop.business.entity.TFCustomFlowEntity;
 import com.qmth.sop.business.mapper.TBDingApplyMapper;
-import com.qmth.sop.business.service.BasicAttachmentService;
-import com.qmth.sop.business.service.TBDingApplyService;
-import com.qmth.sop.business.service.TBDingService;
-import com.qmth.sop.business.service.TFCustomFlowEntityService;
+import com.qmth.sop.business.service.*;
 import com.qmth.sop.common.contant.SpringContextHolder;
 import com.qmth.sop.common.contant.SystemConstant;
 import com.qmth.sop.common.enums.DingExceptionApproveEnum;
@@ -61,6 +59,9 @@ public class TBDingApplyServiceImpl extends ServiceImpl<TBDingApplyMapper, TBDin
     @Resource
     TBDingApplyService tbDingApplyService;
 
+    @Resource
+    TBCrmService tbCrmService;
+
     /**
      * 新增考勤异常补卡申请
      *
@@ -75,9 +76,12 @@ public class TBDingApplyServiceImpl extends ServiceImpl<TBDingApplyMapper, TBDin
         TBDing tbDing = tbDingService.getById(tbDingApply.getDingId());
         Optional.ofNullable(tbDing).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("考勤记录为空"));
 
-        //TODO 这里根据sopNo获取服务单元甲方大区经理角色
+        CrmProjectResult crmProjectResult = tbCrmService.findCrmProjectBySopNoOrCrmNo(tbDing.getSopNo(), tbDing.getCrmNo());
+        Optional.ofNullable(crmProjectResult).orElseThrow(() -> ExceptionResultEnum.CRM_NO_NO_DATA.exception());
+        Optional.ofNullable(crmProjectResult.getRegionManagerId()).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("crm大区经理数据为空"));
+
         List<String> approveUserIds = new ArrayList<>();
-        approveUserIds.add("431777963202052096");
+        approveUserIds.add(crmProjectResult.getRegionManagerId().toString());
         FlowApproveParam flowApproveParam = new FlowApproveParam(tbDingApply.getFlowDeploymentId(), FlowApprovePassEnum.START, approveUserIds, tbDing.getCrmNo());
         flowApproveParam.setApproveRemark(FlowApprovePassEnum.START.getTitle());
         Map<String, Object> map = activitiService.taskApprove(flowApproveParam);
@@ -255,9 +259,12 @@ public class TBDingApplyServiceImpl extends ServiceImpl<TBDingApplyMapper, TBDin
         TBDingApply tbDingApply = this.getOne(new QueryWrapper<TBDingApply>().lambda().eq(TBDingApply::getDingExceptionNo, tfCustomFlowEntity.getCode()));
         Optional.ofNullable(tbDingApply).orElseThrow(() -> ExceptionResultEnum.DING_APPLY_NO_DATA.exception());
 
-        //TODO 这里根据sopNo获取服务单元乙方区域协调人角色
+        CrmProjectResult crmProjectResult = tbCrmService.findCrmProjectBySopNoOrCrmNo(tfCustomFlowEntity.getCode(), tfCustomFlowEntity.getCrmNo());
+        Optional.ofNullable(crmProjectResult).orElseThrow(() -> ExceptionResultEnum.CRM_NO_NO_DATA.exception());
+        Optional.ofNullable(crmProjectResult.getRegionCoordinatorId()).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("crm大区经理数据为空"));
+
         List<String> approveUserIds = new ArrayList<>();
-        approveUserIds.add("431778210271723520");
+        approveUserIds.add(crmProjectResult.getRegionCoordinatorId().toString());
         activitiService.taskApprove(new FlowApproveParam(taskId, FlowApprovePassEnum.PASS, approveUserIds, tfCustomFlowEntity.getCrmNo(), dingExceptionApprove.getTitle()));
 
         TBDingApplyService tbDingApplyService = SpringContextHolder.getBean(TBDingApplyService.class);