wangliang 7 bulan lalu
induk
melakukan
d8bbd03530

+ 5 - 1
sop-business/src/main/java/com/qmth/sop/business/activiti/listener/ProcessEventListener.java

@@ -474,7 +474,11 @@ public class ProcessEventListener implements ActivitiEventListener, Serializable
             sysMessageService.saveSysMessage(Arrays.asList(sysMessage));
 
             //发送短信
-            smsSendUtil.sendSms(flowTaskMsgResult.getMobileNumber(), configKey, templateParam);
+            try {
+                smsSendUtil.sendSms(flowTaskMsgResult.getMobileNumber(), configKey, templateParam);
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
         }
     }
 }

+ 17 - 13
sop-business/src/main/java/com/qmth/sop/business/activiti/service/impl/ActivitiServiceImpl.java

@@ -1421,20 +1421,24 @@ public class ActivitiServiceImpl implements ActivitiService {
     @Override
     public void sendSopFlowDoneSms(TFCustomTypeEnum type, TFCustomFlowEntity tfCustomFlowEntity, String taskName,
             Long userId) {
-        FlowTaskSmsResult flowTaskSmsResult = tfCustomFlowEntityService.getFlowTaskRemindSmsInfo(
-                tfCustomFlowEntity.getId(), userId);
-        if (Objects.isNull(flowTaskSmsResult)) {
-            flowTaskSmsResult = tfCustomFlowEntityService.getFlowTaskRemindSmsInfo(tfCustomFlowEntity.getCrmNo(),
-                    userId);
+        try {
+            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());
+
+            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() + "【" + taskName + "】");
+            smsSendUtil.sendSms(flowTaskSmsResult.getMobileNumber(), SystemConstant.SMS_SOP_DONE_CODE, templateParam);
+        } catch (Exception e) {
+            e.printStackTrace();
         }
-        Optional.ofNullable(flowTaskSmsResult).orElseThrow(() -> ExceptionResultEnum.USER_NO_EXISTS.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() + "【" + taskName + "】");
-        smsSendUtil.sendSms(flowTaskSmsResult.getMobileNumber(), SystemConstant.SMS_SOP_DONE_CODE, templateParam);
     }
 
     /**

+ 5 - 1
sop-business/src/main/java/com/qmth/sop/business/service/impl/TBCrmServiceImpl.java

@@ -854,7 +854,11 @@ public class TBCrmServiceImpl extends ServiceImpl<TBCrmMapper, TBCrm> implements
                     sysMessageService.saveSysMessage(Collections.singletonList(sysMessage));
 
                     //发送短信
-                    smsSendUtil.sendSms(mobileNumber, configKey, templateParam);
+                    try{
+                        smsSendUtil.sendSms(mobileNumber, configKey, templateParam);
+                    }catch(Exception e){
+                        e.printStackTrace();
+                    }
                 }
             }
             map.put(SystemConstant.SUCCESS, successCount);

+ 29 - 15
sop-business/src/main/java/com/qmth/sop/business/service/impl/TBViolationServiceImpl.java

@@ -67,10 +67,14 @@ public class TBViolationServiceImpl extends ServiceImpl<TBViolationMapper, TBVio
      * @return
      */
     @Override
-    public IPage<TBViolationResult> query(IPage<Map> iPage, Long serviceId, ViolationTypeEnum type, ViolationStatusEnum status, Long userId, String custom, String sopNo, Long createId, Long startTime, Long endTime) {
+    public IPage<TBViolationResult> query(IPage<Map> iPage, Long serviceId, ViolationTypeEnum type,
+            ViolationStatusEnum status, Long userId, String custom, String sopNo, Long createId, Long startTime,
+            Long endTime) {
         SysUser requestUser = (SysUser) ServletUtil.getRequestUser();
         DataPermissionDto dpr = sysUserService.buildUserDataPermission(requestUser.getId());
-        return this.baseMapper.query(iPage, serviceId, Objects.nonNull(type) ? type.name() : null, Objects.nonNull(status) ? status.name() : null, userId, custom, sopNo, createId, startTime, endTime, dpr);
+        return this.baseMapper.query(iPage, serviceId, Objects.nonNull(type) ? type.name() : null,
+                Objects.nonNull(status) ? status.name() : null, userId, custom, sopNo, createId, startTime, endTime,
+                dpr);
     }
 
     /**
@@ -84,17 +88,18 @@ public class TBViolationServiceImpl extends ServiceImpl<TBViolationMapper, TBVio
         try {
             SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
             if (Objects.isNull(tBViolation.getId())) {// 新增
-                tBViolation.setCode(DelayWarnSeqTypeEnum.VIOLATION_WARN.getMark() + sequenceService.createCode(DelayWarnSeqTypeEnum.VIOLATION_WARN.getCode()));
+                tBViolation.setCode(DelayWarnSeqTypeEnum.VIOLATION_WARN.getMark() + sequenceService.createCode(
+                        DelayWarnSeqTypeEnum.VIOLATION_WARN.getCode()));
                 tBViolation.insertInfo(sysUser.getId());
                 saveOrUpdate(tBViolation);
                 TBViolationResult tbViolationResult = getByCode(tBViolation.getCode());
 
-//                String content = MessageEnum.NOTICE_OF_VIOLATION_REMIND.getTemplate();
-//                content = content.replaceAll("\\$\\{userName\\}", tbViolationResult.getUserName());
-//                content = content.replaceAll("\\$\\{serviceName\\}", tbViolationResult.getService());
-//                content = content.replaceAll("\\$\\{customName\\}", tbViolationResult.getCustom());
-//                content = content.replaceAll("\\$\\{createUserName\\}", tbViolationResult.getCreateName());
-//                content = content.replaceAll("\\$\\{violationType\\}", tbViolationResult.getType().getTitle());
+                //                String content = MessageEnum.NOTICE_OF_VIOLATION_REMIND.getTemplate();
+                //                content = content.replaceAll("\\$\\{userName\\}", tbViolationResult.getUserName());
+                //                content = content.replaceAll("\\$\\{serviceName\\}", tbViolationResult.getService());
+                //                content = content.replaceAll("\\$\\{customName\\}", tbViolationResult.getCustom());
+                //                content = content.replaceAll("\\$\\{createUserName\\}", tbViolationResult.getCreateName());
+                //                content = content.replaceAll("\\$\\{violationType\\}", tbViolationResult.getType().getTitle());
 
                 String configKey = SystemConstant.SMS_VIOLATION_REMIND_CODE;
                 Map<String, Object> templateParam = new HashMap<>();
@@ -105,10 +110,15 @@ public class TBViolationServiceImpl extends ServiceImpl<TBViolationMapper, TBVio
                 templateParam.put("violationType", tbViolationResult.getType().getTitle());
 
                 SysMessage sysMessage = new SysMessage(tBViolation.getCrmNo(), tBViolation.getCode(),
-                        MessageTypeEnum.VIOLATION, tBViolation.getType().name(), tBViolation.getServiceId(), tBViolation.getUserId(), tBViolation.getContent(),sysUser.getId());
+                        MessageTypeEnum.VIOLATION, tBViolation.getType().name(), tBViolation.getServiceId(),
+                        tBViolation.getUserId(), tBViolation.getContent(), sysUser.getId());
                 sysMessageService.saveSysMessage(Collections.singletonList(sysMessage));
                 //发送短信
-                smsSendUtil.sendSms(tbViolationResult.getMobileNumber(), configKey, templateParam);
+                try {
+                    smsSendUtil.sendSms(tbViolationResult.getMobileNumber(), configKey, templateParam);
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
             } else { // 修改
                 tBViolation.updateInfo(sysUser.getId());
                 saveOrUpdate(tBViolation);
@@ -117,8 +127,10 @@ public class TBViolationServiceImpl extends ServiceImpl<TBViolationMapper, TBVio
         } catch (Exception e) {
             if (e instanceof DuplicateKeyException) {
                 String errorColumn = e.getCause().toString();
-                String columnStr = errorColumn.substring(errorColumn.lastIndexOf("key") + 3, errorColumn.length()).replaceAll("'", "");
-                throw ExceptionResultEnum.SQL_ERROR.exception("[" + FieldUniqueEnum.convertToTitle(columnStr) + "]数据不允许重复插入");
+                String columnStr = errorColumn.substring(errorColumn.lastIndexOf("key") + 3, errorColumn.length())
+                        .replaceAll("'", "");
+                throw ExceptionResultEnum.SQL_ERROR.exception(
+                        "[" + FieldUniqueEnum.convertToTitle(columnStr) + "]数据不允许重复插入");
             } else if (e instanceof ApiException) {
                 ResultUtil.error((ApiException) e, ((ApiException) e).getCode(), e.getMessage());
             } else {
@@ -140,11 +152,13 @@ public class TBViolationServiceImpl extends ServiceImpl<TBViolationMapper, TBVio
         return this.removeById(id);
     }
 
-
     @Override
     public TBViolationResult getByCode(String code) {
         TBViolationResult tbViolationResult = this.baseMapper.getByCode(code);
-        List<TBViolationDetail> TBViolationDetails = tbViolationDetailService.list(new QueryWrapper<TBViolationDetail>().lambda().eq(TBViolationDetail::getViolationId, tbViolationResult.getId()).orderByDesc(TBViolationDetail::getCreateTime));
+        List<TBViolationDetail> TBViolationDetails = tbViolationDetailService.list(
+                new QueryWrapper<TBViolationDetail>().lambda()
+                        .eq(TBViolationDetail::getViolationId, tbViolationResult.getId())
+                        .orderByDesc(TBViolationDetail::getCreateTime));
         tbViolationResult.setTbViolationDetails(TBViolationDetails);
         return tbViolationResult;
     }

+ 11 - 2
sop-task/src/main/java/com/qmth/sop/task/job/RemindTaskJob.java

@@ -116,7 +116,11 @@ public class RemindTaskJob extends QuartzJobBean {
                                 sysMessageService.saveSysMessage(Arrays.asList(sysMessage));
 
                                 //发送短信
-                                smsSendUtil.sendSms(flowTaskSmsResult.getMobileNumber(), configKey, templateParam);
+                                try {
+                                    smsSendUtil.sendSms(flowTaskSmsResult.getMobileNumber(), configKey, templateParam);
+                                } catch (Exception e) {
+                                    e.printStackTrace();
+                                }
                             }
                         }
                     } else if (tsJobRemind.getType() == JobQuartzTypeEnum.NOTICE) {//公告发送短信
@@ -128,7 +132,12 @@ public class RemindTaskJob extends QuartzJobBean {
                                 Map<String, Object> templateParam = new HashMap<>();
                                 templateParam.put("userName", s.getRealName());
                                 templateParam.put("title", tsJobRemind.getObjName());
-                                smsSendUtil.sendSms(s.getMobileNumber(), SystemConstant.SMS_NOTICE_CODE, templateParam);
+                                try {
+                                    smsSendUtil.sendSms(s.getMobileNumber(), SystemConstant.SMS_NOTICE_CODE,
+                                            templateParam);
+                                } catch (Exception e) {
+                                    e.printStackTrace();
+                                }
                             }
                         }
                     }