|
@@ -13,6 +13,7 @@ import com.qmth.sop.business.entity.*;
|
|
|
import com.qmth.sop.business.exec.MySQLExec;
|
|
|
import com.qmth.sop.business.mapper.SysUserMapper;
|
|
|
import com.qmth.sop.business.service.*;
|
|
|
+import com.qmth.sop.business.util.SmsSendUtil;
|
|
|
import com.qmth.sop.common.contant.SpringContextHolder;
|
|
|
import com.qmth.sop.common.contant.SystemConstant;
|
|
|
import com.qmth.sop.common.enums.*;
|
|
@@ -126,6 +127,12 @@ public class ActivitiServiceImpl implements ActivitiService {
|
|
|
@Resource
|
|
|
TBCrmDetailService tbCrmDetailService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ SmsSendUtil smsSendUtil;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ ActivitiService activitiService;
|
|
|
+
|
|
|
/**
|
|
|
* 根据deploymentId查找processDefinitionId
|
|
|
*
|
|
@@ -263,6 +270,13 @@ public class ActivitiServiceImpl implements ActivitiService {
|
|
|
Long.parseLong(approveUserIds.get(approveUserIds.size() - 1)),
|
|
|
FlowStatusEnum.valueOf(flowApproveParam.getApprove().name()), sysUser.getId());
|
|
|
flowResult = JSONObject.parseObject(tfCustomFlow.getFlowProcessVar(), FlowResult.class);
|
|
|
+
|
|
|
+ Task task = taskService.createTaskQuery().processInstanceId(processInstance.getProcessInstanceId())
|
|
|
+ .singleResult();
|
|
|
+ Optional.ofNullable(task).orElseThrow(() -> ExceptionResultEnum.TASK_NO_DATA.exception());
|
|
|
+
|
|
|
+ activitiService.sendSopFlowDoneSms(maxTfCustomFlow.getType(), tfCustomFlowEntity, task.getName(),
|
|
|
+ Long.parseLong(approveUserIds.get(0)), Long.parseLong(task.getId()));
|
|
|
} else if (Objects.nonNull(flowApproveParam.getTaskId())) {
|
|
|
taskTemp = taskService.createTaskQuery().taskId(String.valueOf(flowApproveParam.getTaskId()))
|
|
|
.singleResult();
|
|
@@ -788,6 +802,8 @@ public class ActivitiServiceImpl implements ActivitiService {
|
|
|
sysUser.getRealName() + "(" + orgName + ")转" + exchangeUser.getRealName() + "(" + exchangeOrgName
|
|
|
+ ")审批");
|
|
|
tfFlowLogService.save(tfFlowLog);
|
|
|
+ activitiService.sendSopFlowDoneSms(tfCustomFlow.getType(), tfCustomFlowEntity, task.getName(), userId,
|
|
|
+ Long.parseLong(task.getId()));
|
|
|
} catch (Exception e) {
|
|
|
log.error(SystemConstant.LOG_ERROR, e);
|
|
|
if (e instanceof ApiException) {
|
|
@@ -1262,4 +1278,35 @@ public class ActivitiServiceImpl implements ActivitiService {
|
|
|
tfFlowLog.setApproveRemark(DingExceptionApproveEnum.NO_PASS.getTitle());
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 发送待办短信
|
|
|
+ *
|
|
|
+ * @param type
|
|
|
+ * @param tfCustomFlowEntity
|
|
|
+ * @param taskName
|
|
|
+ * @param userId
|
|
|
+ * @param taskId
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public void sendSopFlowDoneSms(TFCustomTypeEnum type, TFCustomFlowEntity tfCustomFlowEntity, String taskName,
|
|
|
+ Long userId, Long taskId) {
|
|
|
+ FlowTaskSmsResult flowTaskSmsResult = tfCustomFlowEntityService.getFlowTaskRemindSmsInfo(
|
|
|
+ tfCustomFlowEntity.getId(), userId);
|
|
|
+ if (Objects.isNull(flowTaskSmsResult)) {
|
|
|
+ flowTaskSmsResult = tfCustomFlowEntityService.getFlowTaskRemindSmsInfo(tfCustomFlowEntity.getCrmNo(),
|
|
|
+ userId);
|
|
|
+ }
|
|
|
+ Optional.ofNullable(flowTaskSmsResult).orElseThrow(() -> ExceptionResultEnum.USER_NO_EXISTS.exception());
|
|
|
+
|
|
|
+ Task task = taskService.createTaskQuery().taskId(String.valueOf(taskId)).singleResult();
|
|
|
+ Optional.ofNullable(task).orElseThrow(() -> ExceptionResultEnum.TASK_NO_DATA.exception());
|
|
|
+
|
|
|
+ Map<String, Object> templateParam = new HashMap<>();
|
|
|
+ templateParam.put("userName", flowTaskSmsResult.getRealName());
|
|
|
+ templateParam.put("serviceName", flowTaskSmsResult.getServiceName());
|
|
|
+ templateParam.put("customName", flowTaskSmsResult.getCustomName());
|
|
|
+ templateParam.put("flowName", type.getTitle() + "【" + task.getName() + "】");
|
|
|
+ smsSendUtil.sendSms(flowTaskSmsResult.getMobileNumber(), SystemConstant.SMS_SOP_DONE_CODE, templateParam);
|
|
|
+ }
|
|
|
}
|