diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java index 03b6b65..36872d0 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java @@ -1,17 +1,5 @@ package com.ruoyi.web.controller.system; -import java.util.List; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.core.controller.BaseController; @@ -20,6 +8,12 @@ import com.ruoyi.common.core.domain.entity.SysMenu; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.system.service.ISysMenuService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.List; /** * 菜单信息 @@ -139,4 +133,13 @@ public class SysMenuController extends BaseController } return toAjax(menuService.deleteMenuById(menuId)); } + /** + * 根据用户查询菜单权限字符 + */ + @GetMapping("/getMenuPermsByUser") + public AjaxResult getMenuPermsByUser() + { + + return menuService.getMenuPermsByUser(); + } } \ No newline at end of file diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/miniprogress/WeChatUserController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/miniprogress/WeChatUserController.java index e48765c..26c587d 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/miniprogress/WeChatUserController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/miniprogress/WeChatUserController.java @@ -44,6 +44,17 @@ public class WeChatUserController extends BaseController { } return weChatUserService.sendCode(userVO); } + /** + * 获取邮箱验证码 + * @param email + * @return + */ + @Anonymous + @GetMapping("/sendEmailCode") + public AjaxResult sendEmailCode( @RequestParam("email") String email) + { + return weChatUserService.sendEmailCode(email); + } @Anonymous @GetMapping("/roles") public AjaxResult roles() diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/mscase/MsCaseApplicationController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/mscase/MsCaseApplicationController.java index 4af3ce4..6f18f6a 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/mscase/MsCaseApplicationController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/mscase/MsCaseApplicationController.java @@ -10,7 +10,6 @@ import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.exception.EsignDemoException; import com.ruoyi.common.utils.IdCardUtils; -import com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SmsSendRecord; import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseApplication; import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach; import com.ruoyi.wisdomarbitrate.domain.vo.mscase.*; @@ -73,11 +72,10 @@ public class MsCaseApplicationController extends BaseController { /** * 新增案件 */ - // todo 重复提交校验 @PostMapping("/insert") public AjaxResult insert(@RequestBody MsCaseApplicationVO caseApplication ) { - if( caseApplication.getAffiliate()==null|| caseApplication.getOrganizeFlag()==null){ + if( caseApplication.getAffiliate()==null){ error("参数校验失败"); } AjaxResult ajaxResult = AjaxResult.success(); @@ -390,17 +388,7 @@ public class MsCaseApplicationController extends BaseController { return success(videoService.reserveConferenceList(caseId)); } - /** - * 查询短信发送记录 - * @param smsSendRecord - * @return - */ - @PostMapping("/smsRecord") - public TableDataInfo getSmsSendRecord(@RequestBody SmsSendRecord smsSendRecord){ - startPage(); - List list = caseApplicationService.getSmsSendRecord(smsSendRecord); - return getDataTable(list); - } + /** * 保存onlyOffice在线编辑的文件 * @param diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/mscase/MsVideoConferenceController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/mscase/MsVideoConferenceController.java index c285136..7d47ad6 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/mscase/MsVideoConferenceController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/mscase/MsVideoConferenceController.java @@ -125,6 +125,8 @@ public class MsVideoConferenceController extends BaseController { .useId(SecurityUtils.getUserId()) .useAccount(SecurityUtils.getUsername()) .build(); + // 先删除之前的附件 + msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(caseId,annexType); msCaseAttachMapper.save(caseAttach); return caseAttach.getAnnexId(); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/sendrecord/ShortMessageController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/sendrecord/ShortMessageController.java index 517fc0a..0a27e25 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/sendrecord/ShortMessageController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/sendrecord/ShortMessageController.java @@ -1,35 +1,74 @@ package com.ruoyi.web.controller.wisdomarbitrate.sendrecord; +import cn.hutool.core.collection.CollectionUtil; import com.ruoyi.common.annotation.Anonymous; +import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.system.domain.entity.sms.MsSmsSendRecordParam; +import com.ruoyi.system.domain.entity.sms.MsSmsTemplateParam; +import com.ruoyi.system.mapper.sms.MsSmsSendHistoryRecordParamMapper; +import com.ruoyi.system.mapper.sms.MsSmsSendRecordParamMapper; import com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SmsSendRecord; import com.ruoyi.wisdomarbitrate.domain.vo.shortmessage.ReSendMessageVO; import com.ruoyi.wisdomarbitrate.mapper.sendrecord.SmsRecordMapper; import com.ruoyi.wisdomarbitrate.service.shortmessage.ShortMessageService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import tk.mybatis.mapper.entity.Example; +import java.util.ArrayList; import java.util.Date; +import java.util.List; @RestController @RequestMapping("/shortMessage") -public class ShortMessageController { +public class ShortMessageController extends BaseController { @Autowired private SmsRecordMapper smsRecordMapper; @Autowired private ShortMessageService shortMessageService; + @Autowired + MsSmsSendRecordParamMapper recordParamMapper; + @Autowired + MsSmsSendHistoryRecordParamMapper historyRecordParamMapper; + /** + * 查询短信发送记录 + * @param smsSendRecord + * @return + */ + @GetMapping("/recordList") + public TableDataInfo smsSendRecordList( SmsSendRecord smsSendRecord){ + startPage(); + List list = shortMessageService.smsSendRecordList(smsSendRecord); + return getDataTable(list); + } @Anonymous @PostMapping("/updateSendContent") public AjaxResult update(@RequestBody SmsSendRecord smsSendRecord) { - if (smsSendRecord != null && smsSendRecord.getId() != null) { - SmsSendRecord oldSendRecord = smsRecordMapper.selectById(smsSendRecord.getId()); - smsSendRecord.setUpdateTime(new Date()); - smsRecordMapper.updateSendContent(smsSendRecord); - shortMessageService.insertShortMessageHistoryRecord(oldSendRecord); - return AjaxResult.success(); + if(smsSendRecord == null|| smsSendRecord.getId() == null || CollectionUtil.isEmpty(smsSendRecord.getTemplateParams())){ + return AjaxResult.error("参数校验失败"); } - return AjaxResult.error("更新失败"); + // 查询当前版本记录 + SmsSendRecord oldSendRecord = smsRecordMapper.selectById(smsSendRecord.getId()); + smsSendRecord.setUpdateTime(new Date()); + // 更新短信内容,先删除短信记录参数表 + Example recordParamExam = new Example(MsSmsSendRecordParam.class); + recordParamExam.createCriteria().andEqualTo("smsRecordId", smsSendRecord.getId()); + recordParamMapper.deleteByExample(recordParamExam); + // 新增短信记录参数表 + List recordParams = new ArrayList<>(); + for (MsSmsTemplateParam templateParam : smsSendRecord.getTemplateParams()) { + MsSmsSendRecordParam recordParam = new MsSmsSendRecordParam(); + recordParam.setSmsRecordId(smsSendRecord.getId()); + recordParam.setParamValue(templateParam.getParamValue()); + recordParams.add(recordParam); + } + recordParamMapper.batchInsert(recordParams); + shortMessageService.insertShortMessageHistoryRecord(oldSendRecord,recordParams); + return AjaxResult.success(); + } /** diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/sms/SMSTemplateController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/sms/SMSTemplateController.java new file mode 100644 index 0000000..23e024b --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/sms/SMSTemplateController.java @@ -0,0 +1,55 @@ +package com.ruoyi.web.controller.wisdomarbitrate.sms; + +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.system.domain.entity.sms.MsSmsTemplate; +import com.ruoyi.wisdomarbitrate.service.sms.SMSTemplateService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * 短信模板控制器 + */ +@RestController +@RequestMapping("/smsTemplate") +public class SMSTemplateController extends BaseController { + @Autowired + private SMSTemplateService templateService; + + /** + * 查询 + * @param + * @return + */ + @GetMapping("/page") + public TableDataInfo page( ){ + startPage(); + List list = templateService.page(); + return getDataTable(list); + } + /** + * 新增或者修改 + * @param + * @return + */ + @PostMapping("/insert") + public AjaxResult insert(@RequestBody MsSmsTemplate template){ + return templateService.insert(template); + } + /** + * 删除 + * @param + * @return + */ + @PostMapping("/delete") + public AjaxResult delete(@RequestBody MsSmsTemplate template){ + if(template.getId()==null){ + return AjaxResult.warn("id不能为空"); + } + return templateService.delete(template.getId()); + } + +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/CacheConstants.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/CacheConstants.java index 46a496e..bc07b72 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/constant/CacheConstants.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/constant/CacheConstants.java @@ -47,6 +47,7 @@ public class CacheConstants */ public static final String PWD_ERR_CNT_KEY = "pwd_err_cnt:"; public static final String WE_CHAT_SMS_VERIFY_CODE_KEY="we_chat_sms_verify_code:"; + public static final String EMAIL_VERIFY_CODE_KEY="email_verify_code:"; /** * 案件 redis key */ diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/UserConstants.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/UserConstants.java index 96b149c..550d5b9 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/constant/UserConstants.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/constant/UserConstants.java @@ -68,7 +68,7 @@ public class UserConstants * 用户名长度限制 */ public static final int USERNAME_MIN_LENGTH = 2; - public static final int USERNAME_MAX_LENGTH = 20; + public static final int USERNAME_MAX_LENGTH = 50; /** * 密码长度限制 diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/EmailOutUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/EmailOutUtil.java index 1769609..0527e2f 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/EmailOutUtil.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/EmailOutUtil.java @@ -47,12 +47,12 @@ public class EmailOutUtil { // private static String fromOut; @Value("${spring.mail.host}") private String hostOut; -// @Value("${spring.mail.username}") -// private String usernameOut; - private String usernameOut="wq18792927508@163.com"; -// @Value("${spring.mail.password}") -// private String passwordOut; - private String passwordOut= "WDFHKSEMCKVRELEA"; + @Value("${spring.mail.username}") + private String usernameOut; + + @Value("${spring.mail.password}") + private String passwordOut; + @Value("${spring.mail.port}") private Integer portOut; @@ -77,7 +77,7 @@ public class EmailOutUtil { public Boolean sendMessage(String to, String subject, String content, String from, JavaMailSender mailSender) { try { if(mailSender==null){ - rebuildMailSender(); + mailSender= rebuildMailSender(); } // 创建一个邮件对象 SimpleMailMessage msg = new SimpleMailMessage(); @@ -97,7 +97,6 @@ public class EmailOutUtil { return false; } return true; - ////System.out.println("发送成功:" + from + ":to:" + to); } /** diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/SmsUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/SmsUtils.java deleted file mode 100644 index c89b03b..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/SmsUtils.java +++ /dev/null @@ -1,115 +0,0 @@ -package com.ruoyi.common.utils; - -import cn.hutool.json.JSONObject; -import com.ruoyi.common.enums.SMSStatusEnum; -import com.tencentcloudapi.common.Credential; -import com.tencentcloudapi.common.exception.TencentCloudSDKException; -import com.tencentcloudapi.sms.v20210111.SmsClient; -import com.tencentcloudapi.sms.v20210111.models.SendSmsResponse; -import com.tencentcloudapi.sms.v20210111.models.SendStatus; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import lombok.var; - -import java.util.Objects; - -@Slf4j -public class SmsUtils { - //应用id - private static final String SDK_APP_ID = "1400854852"; - //API的SecretId - private static final String SECRET_ID = "AKIDeEf2A8uX1HSainvvnXAc3X9ZlhtyvkMp"; - //API的SecretKey - private static final String SECRET_KEY = "QjphKo8zkHZigT8j9PVtFPJyfIvO3d6V"; - //签名内容 - private static final String SIGN_NAME = "乙巢智慧仲裁网"; - - public static JSONObject sendSms(SendSmsRequest request) { - JSONObject jsonObject = new JSONObject(); - Credential cred = new Credential(SECRET_ID, SECRET_KEY ); - - SmsClient client = new SmsClient(cred, "ap-guangzhou"); - - final var req = new com.tencentcloudapi.sms.v20210111.models.SendSmsRequest(); - req.setPhoneNumberSet(new String[]{"+86" + request.getPhone()}); - req.setSmsSdkAppId(SDK_APP_ID ); - req.setSignName(SIGN_NAME); - req.setTemplateId(request.getTemplateId()); - req.setTemplateParamSet(request.getTemplateParamSet()); - SendSmsResponse res = null; - try { - res = client.SendSms(req); - } catch (TencentCloudSDKException e) { - log.error("发送短信出错:", e); - jsonObject.set("status", SMSStatusEnum.FAIL.getCode()); - return jsonObject; - } - SendStatus sendStatus = res.getSendStatusSet()[0]; - log.info("发送短信结果:Code={}, Message={}", sendStatus.getCode(), sendStatus.getMessage()); - - if (Objects.nonNull(res.getSendStatusSet()) && res.getSendStatusSet().length > 0 && "Ok".equals(res.getSendStatusSet()[0].getCode())){ - jsonObject.set("status", SMSStatusEnum.SENDING.getCode()); - }else { - jsonObject.set("status", SMSStatusEnum.FAIL.getCode()); - } - jsonObject.set("sid", sendStatus.getSerialNo()); - return jsonObject; - } - public static JSONObject sendSms(Long caseId,String templateId,String phone,String[] templateParamSet) { - JSONObject jsonObject = new JSONObject(); - SendSmsRequest request = new SendSmsRequest(phone,templateId,templateParamSet,caseId); - Credential cred = new Credential(SECRET_ID, SECRET_KEY ); - - SmsClient client = new SmsClient(cred, "ap-guangzhou"); - - final var req = new com.tencentcloudapi.sms.v20210111.models.SendSmsRequest(); - req.setPhoneNumberSet(new String[]{"+86" + request.getPhone()}); - req.setSmsSdkAppId(SDK_APP_ID ); - req.setSignName(SIGN_NAME); - req.setTemplateId(request.getTemplateId()); - req.setTemplateParamSet(request.getTemplateParamSet()); - SendSmsResponse res = null; - try { - res = client.SendSms(req); - } catch (TencentCloudSDKException e) { - jsonObject.set("status", SMSStatusEnum.FAIL.getCode()); - return jsonObject; - } - SendStatus sendStatus = res.getSendStatusSet()[0]; - log.info("发送短信结果:Code={}, Message={}", sendStatus.getCode(), sendStatus.getMessage()); - // todo 短信发送时,需要将SerialNo存到数据库,在短信回调时去更新短信发送状态,以及失败原因写到数据库,发送时状态统一为发送中 - if (Objects.nonNull(res.getSendStatusSet()) && res.getSendStatusSet().length > 0 && "Ok".equals(res.getSendStatusSet()[0].getCode())){ - jsonObject.set("status", SMSStatusEnum.SENDING.getCode()); - }else { - jsonObject.set("status", SMSStatusEnum.FAIL.getCode()); - } - jsonObject.set("sid", sendStatus.getSerialNo()); - return jsonObject; - } - /** - * 参数对象 - */ - @Data - @NoArgsConstructor - @AllArgsConstructor - public static class SendSmsRequest { - /** - * 电话 - */ - private String phone; - - /** - * 模板 ID: 必须填写已审核通过的模板 ID - */ - private String templateId; - - /** - * 模板参数: 模板参数的个数需要与 TemplateId 对应模板的变量个数保持一致,若无模板参数,则设置为空 - */ - private String[] templateParamSet; - private Long caseId; - - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/WordUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/WordUtil.java index 236fee7..e4c75e4 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/WordUtil.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/WordUtil.java @@ -1,26 +1,19 @@ package com.ruoyi.common.utils; -import cn.hutool.core.io.resource.ClassPathResource; import com.deepoove.poi.XWPFTemplate; import com.deepoove.poi.config.Configure; import com.deepoove.poi.data.*; import com.deepoove.poi.data.style.ParagraphStyle; import com.deepoove.poi.data.style.Style; -import com.deepoove.poi.policy.PictureRenderPolicy; import com.deepoove.poi.util.PoitlIOUtils; -import org.apache.commons.io.FileUtils; -import org.apache.poi.ss.usermodel.Cell; -import org.apache.poi.ss.usermodel.CellType; -import org.apache.poi.ss.usermodel.Row; -import org.apache.poi.ss.usermodel.Sheet; -import org.apache.poi.wp.usermodel.Paragraph; import org.apache.poi.xwpf.usermodel.*; -import javax.print.Doc; -import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import java.io.*; +import java.io.BufferedOutputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -205,6 +198,24 @@ public class WordUtil { } } + /** + * 替换标签内容 + * @param map + * @param templatePath 模板路径 + * @param outputPath 文件输出路径 + */ + public static void render(Map map,String templatePath,String outputPath){ + XWPFTemplate template = XWPFTemplate.compile(templatePath).render(map); + try { + FileOutputStream out = new FileOutputStream(outputPath); + template.write(out); + out.flush(); + out.close(); + template.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/entity/log/MsRequestLog.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/entity/log/MsRequestLog.java index dfc47dc..08539c9 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/entity/log/MsRequestLog.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/entity/log/MsRequestLog.java @@ -1,3 +1,4 @@ + package com.ruoyi.system.domain.entity.log; import lombok.Getter; diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/entity/shortmessage/MsSmsSendHistoryRecord.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/entity/shortmessage/MsSmsSendHistoryRecord.java index b6ad8af..32eabf2 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/entity/shortmessage/MsSmsSendHistoryRecord.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/entity/shortmessage/MsSmsSendHistoryRecord.java @@ -1,9 +1,15 @@ package com.ruoyi.system.domain.entity.shortmessage; -import java.util.Date; -import javax.persistence.*; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; -import lombok.*; +import javax.persistence.Column; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Table; +import java.util.Date; @Data @AllArgsConstructor @@ -20,6 +26,11 @@ public class MsSmsSendHistoryRecord { */ @Column(name = "case_appli_id") private Long caseAppliId; + /** + * 短信模板表主键id + */ + @Column(name = "ms_sms_template_id") + private Long msSmsTemplateId; /** * 案件编号 @@ -44,11 +55,6 @@ public class MsSmsSendHistoryRecord { @Column(name = "send_status") private Long sendStatus; - /** - * 发送内容 - */ - @Column(name = "send_content") - private String sendContent; /** * 创建时间 diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/entity/sms/MsSmsSendHistoryRecordParam.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/entity/sms/MsSmsSendHistoryRecordParam.java new file mode 100644 index 0000000..b0d09cb --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/entity/sms/MsSmsSendHistoryRecordParam.java @@ -0,0 +1,28 @@ +package com.ruoyi.system.domain.entity.sms; + +import javax.persistence.*; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@Getter +@Setter +@ToString +@Table(name = "ms_sms_send_history_record_param") +public class MsSmsSendHistoryRecordParam { + @Id + @GeneratedValue(generator = "JDBC") + private Long id; + + /** + * 短信历史记录表id + */ + @Column(name = "sms_record_history_id") + private Long smsRecordHistoryId; + + /** + * 参数值 + */ + @Column(name = "param_value") + private String paramValue; +} \ No newline at end of file diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/entity/sms/MsSmsSendRecordParam.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/entity/sms/MsSmsSendRecordParam.java new file mode 100644 index 0000000..440a239 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/entity/sms/MsSmsSendRecordParam.java @@ -0,0 +1,33 @@ +package com.ruoyi.system.domain.entity.sms; + +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +import javax.persistence.Column; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Table; + +@Getter +@Setter +@ToString +@Table(name = "ms_sms_send_record_param") +public class MsSmsSendRecordParam { + @Id + @GeneratedValue(generator = "JDBC") + private Integer id; + + /** + * 短信记录表id + */ + @Column(name = "sms_record_id") + private Long smsRecordId; + + + /** + * 参数值 + */ + @Column(name = "param_value") + private String paramValue; +} \ No newline at end of file diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/entity/sms/MsSmsTemplate.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/entity/sms/MsSmsTemplate.java new file mode 100644 index 0000000..54f6900 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/entity/sms/MsSmsTemplate.java @@ -0,0 +1,38 @@ +package com.ruoyi.system.domain.entity.sms; + +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +import javax.persistence.*; +import java.util.List; + +@Getter +@Setter +@ToString +@Table(name = "ms_sms_template") +public class MsSmsTemplate { + @Id + @GeneratedValue(generator = "JDBC") + private Long id; + + /** + * 腾讯云模板id + */ + @Column(name = "template_id") + private String templateId; + + /** + * 模板名称 + */ + private String name; + /** + * 模板内容 + */ + private String content; + /** + * 模板参数 + */ + @Transient + private List templateParams; +} \ No newline at end of file diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/entity/sms/MsSmsTemplateParam.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/entity/sms/MsSmsTemplateParam.java new file mode 100644 index 0000000..0150b33 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/entity/sms/MsSmsTemplateParam.java @@ -0,0 +1,38 @@ +package com.ruoyi.system.domain.entity.sms; + +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +import javax.persistence.*; + +@Getter +@Setter +@ToString +@Table(name = "ms_sms_template_param") +public class MsSmsTemplateParam { + @Id + @GeneratedValue(generator = "JDBC") + private Long id; + + /** + * ms_sms_template表id + */ + @Column(name = "sms_template_id") + private Long smsTemplateId; + + /** + * 参数 + */ + private String param; + /** + * 参数名 + */ + @Column(name = "param_name") + private String paramName; + /** + * 参数值 + */ + @Transient + private String paramValue; +} \ No newline at end of file diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/sms/MsSmsSendHistoryRecordParamMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/sms/MsSmsSendHistoryRecordParamMapper.java new file mode 100644 index 0000000..7dbe5bf --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/sms/MsSmsSendHistoryRecordParamMapper.java @@ -0,0 +1,22 @@ +package com.ruoyi.system.mapper.sms; + +import com.ruoyi.system.domain.entity.sms.MsSmsSendHistoryRecordParam; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; +import tk.mybatis.mapper.common.Mapper; + +import java.util.List; + +public interface MsSmsSendHistoryRecordParamMapper extends Mapper { + /** + * 批量新增 + * @param historyRecordParams + */ + @Select("") + void batchInsert(@Param("list") List historyRecordParams); +} \ No newline at end of file diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/sms/MsSmsSendRecordParamMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/sms/MsSmsSendRecordParamMapper.java new file mode 100644 index 0000000..01a92db --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/sms/MsSmsSendRecordParamMapper.java @@ -0,0 +1,22 @@ +package com.ruoyi.system.mapper.sms; + +import com.ruoyi.system.domain.entity.sms.MsSmsSendRecordParam; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; +import tk.mybatis.mapper.common.Mapper; + +import java.util.List; + +public interface MsSmsSendRecordParamMapper extends Mapper { + /** + * 批量插入 + * @param list + */ + @Select("") + void batchInsert(@Param("list") List list); +} \ No newline at end of file diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/sms/MsSmsTemplateMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/sms/MsSmsTemplateMapper.java new file mode 100644 index 0000000..b1396f8 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/sms/MsSmsTemplateMapper.java @@ -0,0 +1,7 @@ +package com.ruoyi.system.mapper.sms; + +import com.ruoyi.system.domain.entity.sms.MsSmsTemplate; +import tk.mybatis.mapper.common.Mapper; + +public interface MsSmsTemplateMapper extends Mapper { +} \ No newline at end of file diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/sms/MsSmsTemplateParamMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/sms/MsSmsTemplateParamMapper.java new file mode 100644 index 0000000..cb826b3 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/sms/MsSmsTemplateParamMapper.java @@ -0,0 +1,18 @@ +package com.ruoyi.system.mapper.sms; + +import com.ruoyi.system.domain.entity.sms.MsSmsTemplateParam; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; +import tk.mybatis.mapper.common.Mapper; + +import java.util.List; + +public interface MsSmsTemplateParamMapper extends Mapper { + @Select("") + void batchInsert(@Param("list") List templateParams); +} \ No newline at end of file diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysMenuService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysMenuService.java index 59f268a..a33de8d 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysMenuService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysMenuService.java @@ -1,5 +1,6 @@ package com.ruoyi.system.service; +import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.TreeSelect; import com.ruoyi.common.core.domain.entity.SysMenu; import com.ruoyi.system.domain.vo.RouterVo; @@ -149,4 +150,10 @@ public interface ISysMenuService */ Set selectAdminMenu(); + + /** + * 根据用户查询菜单权限字符 + * @return + */ + AjaxResult getMenuPermsByUser(); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java index ccc6b16..a55c6b7 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java @@ -1,5 +1,6 @@ package com.ruoyi.system.service.impl; +import cn.hutool.core.collection.CollectionUtil; import com.ruoyi.common.annotation.DataScope; import com.ruoyi.common.constant.CacheConstants; import com.ruoyi.common.constant.UserConstants; @@ -16,6 +17,7 @@ import com.ruoyi.common.utils.spring.SpringUtils; import com.ruoyi.system.mapper.SysDeptMapper; import com.ruoyi.system.mapper.SysRoleMapper; import com.ruoyi.system.service.ISysDeptService; +import com.ruoyi.wisdomarbitrate.mapper.mscase.MsCaseApplicationMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -39,6 +41,8 @@ public class SysDeptServiceImpl implements ISysDeptService private SysRoleMapper roleMapper; @Autowired private RedisCache redisCache; + @Autowired + MsCaseApplicationMapper caseApplicationMapper; /** * 查询部门管理数据 @@ -302,6 +306,11 @@ public class SysDeptServiceImpl implements ISysDeptService @Override public int deleteDeptById(Long deptId) { + // 查询部门是否与案件有关 + List caseList = caseApplicationMapper.selectCaseByDeptId(deptId); + if(CollectionUtil.isNotEmpty(caseList)){ + throw new ServiceException("该部门有关联案件,不允许删除"); + } SysDept sysDept = deptMapper.selectDeptById(deptId); if(sysDept!=null) { // 删除缓存 diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java index b359cb6..8fbf984 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java @@ -3,6 +3,7 @@ package com.ruoyi.system.service.impl; import cn.hutool.core.collection.CollectionUtil; import com.ruoyi.common.constant.Constants; import com.ruoyi.common.constant.UserConstants; +import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.TreeSelect; import com.ruoyi.common.core.domain.entity.SysMenu; import com.ruoyi.common.core.domain.entity.SysRole; @@ -139,6 +140,14 @@ public class SysMenuServiceImpl implements ISysMenuService return permsSet; } + @Override + public AjaxResult getMenuPermsByUser() { + AjaxResult result = AjaxResult.success(); + List perms = menuMapper.selectMenuPermsByUserId(SecurityUtils.getUserId()); + result.put("perms",perms); + return result; + } + /** * 根据用户ID查询菜单 * diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java index cb14f99..c4a523c 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java @@ -21,6 +21,7 @@ import com.ruoyi.system.domain.SysUserRole; import com.ruoyi.system.mapper.*; import com.ruoyi.system.service.ISysConfigService; import com.ruoyi.system.service.ISysUserService; +import com.ruoyi.wisdomarbitrate.mapper.mscase.MsCaseApplicationMapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -30,6 +31,7 @@ import org.springframework.util.CollectionUtils; import javax.validation.Validator; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; @@ -70,6 +72,8 @@ public class SysUserServiceImpl implements ISysUserService { protected Validator validator; @Autowired private RedisCache redisCache; + @Autowired + MsCaseApplicationMapper msCaseApplicationMapper; /** * 根据条件分页查询用户列表 @@ -460,9 +464,16 @@ public class SysUserServiceImpl implements ISysUserService { @Transactional public int deleteUserById(Long userId) { // 删除用户与角色关联 - userRoleMapper.deleteUserRoleByUserId(userId); + // userRoleMapper.deleteUserRoleByUserId(userId); // 删除用户与岗位表 - userPostMapper.deleteUserPostByUserId(userId); + // userPostMapper.deleteUserPostByUserId(userId); + // 与案件有关的人员不能删除 + List userIds = new ArrayList<>(); + userIds.add(userId); + List caseIds= msCaseApplicationMapper.countCasePerson(userIds); + if(CollectionUtil.isNotEmpty(caseIds)){ + throw new ServiceException("该人员已参与案件,不能删除"); + } int i = userMapper.deleteUserById(userId); // 删除缓存 redisCache.deleteObject(CacheConstants.USER_KEY+userId); @@ -478,6 +489,14 @@ public class SysUserServiceImpl implements ISysUserService { @Override @Transactional public int deleteUserByIds(Long[] userIds) { + // 校验是否与案件关联 + if(userIds==null || userIds.length==0){ + throw new ServiceException("请选择删除的用户"); + } + List caseIds= msCaseApplicationMapper.countCasePerson(new ArrayList<>(Arrays.asList(userIds))); + if(CollectionUtil.isNotEmpty(caseIds)){ + throw new ServiceException("删除人员中存在与案件关联的人员,不能删除"); + } for (Long userId : userIds) { checkUserAllowed(new SysUser(userId)); checkUserDataScope(userId); diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/dto/miniprogress/IdentityAuthentication.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/dto/miniprogress/IdentityAuthentication.java index 7eca08b..ea46bdf 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/dto/miniprogress/IdentityAuthentication.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/dto/miniprogress/IdentityAuthentication.java @@ -31,6 +31,10 @@ public class IdentityAuthentication extends BaseEntity { * 短信验证码 */ private String VerifyCode; + /** + * email验证码 + */ + private String emailVerifyCode; private String passWord; private String phone; /** @@ -47,6 +51,14 @@ public class IdentityAuthentication extends BaseEntity { /** 认证状态 */ private Integer certificationStatus; + public String getEmailVerifyCode() { + return emailVerifyCode; + } + + public void setEmailVerifyCode(String emailVerifyCode) { + this.emailVerifyCode = emailVerifyCode; + } + public Integer getCertificationStatus() { return certificationStatus; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/dto/sendrecord/SmsSendRecord.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/dto/sendrecord/SmsSendRecord.java index 779f0fb..bc1a25e 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/dto/sendrecord/SmsSendRecord.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/dto/sendrecord/SmsSendRecord.java @@ -2,11 +2,13 @@ package com.ruoyi.wisdomarbitrate.domain.dto.sendrecord; import com.fasterxml.jackson.annotation.JsonFormat; import com.ruoyi.common.core.domain.BaseEntity; +import com.ruoyi.system.domain.entity.sms.MsSmsTemplateParam; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import java.util.Date; +import java.util.List; @Data @AllArgsConstructor @@ -16,6 +18,10 @@ public class SmsSendRecord extends BaseEntity { * ID */ private Long id; + /** + * 短信模板主键id + */ + private Long msSmsTemplateId; /** * 案件申请id */ @@ -33,10 +39,6 @@ public class SmsSendRecord extends BaseEntity { */ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date sendTime; - /** - * 发送内容 - */ - private String sendContent; /** * 发送状态 @@ -50,6 +52,19 @@ public class SmsSendRecord extends BaseEntity { * 失败原因 */ private String reason; + /** + * 短信内容 + */ + private String sendContent; + /** + * 腾讯云模板id + */ + private String templateId; + /** + * 模板内容 + */ + private String templateContent; + private List templateParams; public SmsSendRecord(Long caseId, String caseNum, String phone, Date sendTime, String sendContent,String sid) { this.caseId = caseId; diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/entity/mscase/MsCaseAffiliate.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/entity/mscase/MsCaseAffiliate.java index efdce9e..5115f88 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/entity/mscase/MsCaseAffiliate.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/entity/mscase/MsCaseAffiliate.java @@ -43,6 +43,11 @@ public class MsCaseAffiliate{ */ @Transient private String code; + /** + * 用户名 + */ + @Transient + private String userName; /** * 法定代表人 @@ -64,6 +69,11 @@ public class MsCaseAffiliate{ */ @Column(name = "operator_flag") private Integer operatorFlag=1; + /** + * 是否机构申请,0-自然人,1-申请机构,默认0 + */ + @Column(name = "organize_flag") + private Integer organizeFlag=0; /** * 电话 */ @@ -131,5 +141,10 @@ public class MsCaseAffiliate{ */ @Transient private String applicantOrgName; + /** + * 角色id + */ + @Transient + private Long roleId; } \ No newline at end of file diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/entity/mscase/MsCaseApplication.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/entity/mscase/MsCaseApplication.java index 853ba65..86d6b1a 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/entity/mscase/MsCaseApplication.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/entity/mscase/MsCaseApplication.java @@ -205,11 +205,7 @@ public class MsCaseApplication { */ @Column(name = "is_reconci") private Integer isReconci; - /** - * 是否机构申请,0-自然人,1-申请机构,默认0 - */ - @Column(name = "organize_flag") - private Integer organizeFlag; + /** * 案件来源,YC-乙巢,空字符串-北明 */ @@ -225,5 +221,7 @@ public class MsCaseApplication { */ @Transient private String rejectReason; + @Transient + private Integer organizeFlag=0; } \ No newline at end of file diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/shortmessage/ReSendMessageVO.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/shortmessage/ReSendMessageVO.java index faec975..320072e 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/shortmessage/ReSendMessageVO.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/shortmessage/ReSendMessageVO.java @@ -1,5 +1,6 @@ package com.ruoyi.wisdomarbitrate.domain.vo.shortmessage; +import com.ruoyi.system.domain.entity.sms.MsSmsTemplateParam; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -20,9 +21,13 @@ public class ReSendMessageVO { * 手机号 */ private String phone; + /** + * 短信id + */ + private Long id; /** * 短信模版参数值 */ - private List paramValues; + private List templateParams; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/mscase/MsCaseApplicationMapper.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/mscase/MsCaseApplicationMapper.java index 6780ee2..35d9780 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/mscase/MsCaseApplicationMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/mscase/MsCaseApplicationMapper.java @@ -52,4 +52,18 @@ public interface MsCaseApplicationMapper extends Mapper { Long selectMaxRoomId(); List todoCount(@Param("req")MsCaseApplicationReq req, @Param("caseFlowIds") List caseFlowIds, @Param("roleIds") List roleIds); + + /** + * 根据用户id查询是否和案件有关 + * @param userIds + * @return + */ + List countCasePerson(@Param("userIds") List userIds); + + /** + * 查询部门是否与案件有关 + * @param deptId + * @return + */ + List selectCaseByDeptId(@Param("deptId") Long deptId); } \ No newline at end of file diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/sendrecord/SmsRecordMapper.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/sendrecord/SmsRecordMapper.java index 4ad6fe3..638baff 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/sendrecord/SmsRecordMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/sendrecord/SmsRecordMapper.java @@ -22,14 +22,10 @@ public interface SmsRecordMapper { SmsSendRecord selectBySId(@Param("sid") String sid); void updateStatus (SmsSendRecord smsSendRecord); - /** - * 更新短信发送内容 - * @param smsSendRecord - * @return - */ - int updateSendContent(SmsSendRecord smsSendRecord); /** * 通过id查询短信发送记录 */ SmsSendRecord selectById(@Param("id") Long id); + + void update(SmsSendRecord smsSendRecord); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/miniprogress/WeChatUserService.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/miniprogress/WeChatUserService.java index 6d01cdc..e3ad11d 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/miniprogress/WeChatUserService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/miniprogress/WeChatUserService.java @@ -14,4 +14,12 @@ public interface WeChatUserService { AjaxResult registerUser(IdentityAuthentication ientityAuthentication); + + /** + * 获取邮箱验证码 + * @param email + * @return + */ + + AjaxResult sendEmailCode(String email); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/miniprogress/impl/WeChatUserServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/miniprogress/impl/WeChatUserServiceImpl.java index 908444a..c300935 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/miniprogress/impl/WeChatUserServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/miniprogress/impl/WeChatUserServiceImpl.java @@ -9,8 +9,8 @@ import com.ruoyi.common.core.domain.entity.SysRole; import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.enums.SMSStatusEnum; +import com.ruoyi.common.utils.EmailOutUtil; import com.ruoyi.common.utils.SecurityUtils; -import com.ruoyi.common.utils.SmsUtils; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.spring.SpringUtils; import com.ruoyi.system.mapper.SysRoleMapper; @@ -20,6 +20,7 @@ import com.ruoyi.wisdomarbitrate.domain.dto.miniprogress.IdentityAuthentication; import com.ruoyi.wisdomarbitrate.domain.vo.miniprogress.WeChatUserVO; import com.ruoyi.wisdomarbitrate.mapper.miniprogress.IdentityAuthenticationMapper; import com.ruoyi.wisdomarbitrate.service.miniprogress.WeChatUserService; +import com.ruoyi.wisdomarbitrate.utils.SmsUtils; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -47,6 +48,8 @@ public class WeChatUserServiceImpl implements WeChatUserService { private IdentityAuthenticationMapper identityAuthenticationMapper; @Autowired private RedisCache redisCache; + @Autowired + private EmailOutUtil emailOutUtil; @Override public AjaxResult sendCode(WeChatUserVO userVO) { @@ -64,12 +67,31 @@ public class WeChatUserServiceImpl implements WeChatUserService { request.setTemplateParamSet(new String[]{ code}); JSONObject resultObj = SmsUtils.sendSms(request); if(resultObj.get("status")!=null && !resultObj.get("status").equals(SMSStatusEnum.FAIL.getCode())){ - setCodeCache(userVO.getPhone(),code); + setCodeCache(CacheConstants.WE_CHAT_SMS_VERIFY_CODE_KEY + userVO.getPhone(),code); return AjaxResult.success("短信发送成功"); }else { return AjaxResult.warn("短信发送失败"); } } + @Override + public AjaxResult sendEmailCode(String email) { + Random random = new Random(); + String code = ""; + for (int i = 0; i < 6; i++) { + + code += random.nextInt(10); + } + + try { + emailOutUtil.sendMessage(email, "调解系统邮箱验证", "尊敬的用户,您好,您的邮箱验证码为:"+code+",有效期为5分钟。", null, null); + } catch (Exception e) { + return AjaxResult.warn("邮件发送失败"); + } + + // 1954926 普通短信 短信验证码 验证码:,为了保证您的账户安全,请勿想他人泄露验证码信息。如非本人操作,请忽略本短信。 + setCodeCache(CacheConstants.EMAIL_VERIFY_CODE_KEY +email,code); + return AjaxResult.success("邮件发送成功"); + } /** * 设置验证码缓存 * @@ -78,7 +100,7 @@ public class WeChatUserServiceImpl implements WeChatUserService { */ public static void setCodeCache(String key, String code) { - SpringUtils.getBean(RedisCache.class).setCacheObject(getVerifyCodeCacheKey(key), code, 5,TimeUnit.MINUTES); + SpringUtils.getBean(RedisCache.class).setCacheObject( key, code, 5,TimeUnit.MINUTES); } @@ -90,7 +112,7 @@ public class WeChatUserServiceImpl implements WeChatUserService { */ public static String getCodeCache(String key) { - String codeCache = SpringUtils.getBean(RedisCache.class).getCacheObject(getVerifyCodeCacheKey(key)); + String codeCache = SpringUtils.getBean(RedisCache.class).getCacheObject( key); if (StringUtils.isNotNull(codeCache)) { return codeCache; @@ -98,19 +120,23 @@ public class WeChatUserServiceImpl implements WeChatUserService { return null; } - private static String getVerifyCodeCacheKey(String key) { - return CacheConstants.WE_CHAT_SMS_VERIFY_CODE_KEY + key; - } @Transactional @Override public AjaxResult registerUser(IdentityAuthentication ientityAuthentication) { - String codeCache = getCodeCache(ientityAuthentication.getPhone()); + String codeCache = getCodeCache(CacheConstants.WE_CHAT_SMS_VERIFY_CODE_KEY + ientityAuthentication.getPhone()); // 校验短信验证码 if(StrUtil.isEmpty(codeCache)){ return AjaxResult.warn("验证码校验失败"); }else if(!codeCache.equals(ientityAuthentication.getVerifyCode())){ return AjaxResult.warn("验证码校验失败"); } + // 校验邮箱验证码 + String emailCodeCache = getCodeCache(CacheConstants.EMAIL_VERIFY_CODE_KEY +ientityAuthentication.getEmail()); + if(StrUtil.isEmpty(emailCodeCache)){ + return AjaxResult.warn("验证码校验失败"); + }else if(!emailCodeCache.equals(ientityAuthentication.getEmailVerifyCode())){ + return AjaxResult.warn("验证码校验失败"); + } // 根据用户名或者邮箱或者手机号查询系统用户表中是否存在该用户 SysUser sysUserName=sysUserMapper.checkUserNameUnique(ientityAuthentication.getUserName()); if(sysUserName!=null){ @@ -183,4 +209,6 @@ public class WeChatUserServiceImpl implements WeChatUserService { return AjaxResult.success("注册成功"); } + + } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/MsCaseApplicationService.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/MsCaseApplicationService.java index 338faf2..051e931 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/MsCaseApplicationService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/MsCaseApplicationService.java @@ -4,13 +4,11 @@ import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.entity.SMSNotice; -import com.ruoyi.common.core.domain.entity.SMSNoticeDO; import com.ruoyi.common.core.domain.entity.SysDictData; import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.enums.PushCaseStatusEnum; import com.ruoyi.common.exception.EsignDemoException; import com.ruoyi.system.domain.entity.flow.MsCaseFlow; -import com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SmsSendRecord; import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAffiliate; import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseApplication; import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach; @@ -81,11 +79,7 @@ public interface MsCaseApplicationService { */ AjaxResult batchInsert(MsCaseBatchInsertVO vo); - /** - * 新增申请机构代理人 - * @param affiliate - */ - void insertAgentUser(MsCaseAffiliate affiliate); + /** * 修改案件 @@ -115,6 +109,12 @@ public interface MsCaseApplicationService { * @return */ AjaxResult generateApplication(MsCaseApplicationReq req); + /** + * 生成调解申请书 + * @param req + * @return + */ + AjaxResult generateApplication1(MsCaseApplicationReq req); /** * 根据批次号和流程id查找未锁定的案件 @@ -233,6 +233,7 @@ public interface MsCaseApplicationService { * @param dictDataList 内置字段 */ void createMediateApplication(MsCaseApplication application, List affiliates, String templatePath, List bookmarkList, List dictDataList, Integer templateType) ; + void createMediateApplication1(MsCaseApplication application, List affiliates, String templatePath, List bookmarkList, List dictDataList, Integer templateType) ; /** * 调解书上传到onlyoffice服务器 * @param annexPath @@ -275,12 +276,7 @@ public interface MsCaseApplicationService { * 根据登录人返回用户信息 */ SysUser getUserInfo(); - /** - * 查询短信发送记录 - * @param smsSendRecord - * @return - */ - List getSmsSendRecord(SmsSendRecord smsSendRecord); + /** * 保存onlyOffice在线编辑的文件 * @param @@ -288,14 +284,7 @@ public interface MsCaseApplicationService { */ AjaxResult saveOnlyOfficeFile(MsCaseAttach caseAttach); - /** - * 发送短信 - * @param smsFlag 短信是否发送成功 - * @param application 案件基本信息 - * @param affiliate 案件人员 - * @param sendContent 发送内容 - */ - public void sendSMS(cn.hutool.json.JSONObject jsonObject ,MsCaseApplication application, MsCaseAffiliate affiliate, String sendContent); + /** * 发送邮件 * @param application 案件基本信息 @@ -310,14 +299,7 @@ public interface MsCaseApplicationService { * @param affiliates */ public void sendHearDateSms(MsCaseApplication application, List affiliates); - /** - * 发送短信 - * @param application - * @param affiliate - * @param notice - */ - public void sendNotice(MsCaseApplication application, MsCaseAffiliate affiliate, - SMSNoticeDO notice); + /** * 申请操作人/被申操作人发送通知 * @param application diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/MsCasePaymentService.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/MsCasePaymentService.java index faf1ca3..328c235 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/MsCasePaymentService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/MsCasePaymentService.java @@ -65,10 +65,5 @@ public interface MsCasePaymentService { public void confirmPayment(MsCaseFlow currentFlow,MsCaseFlow nextFlow, MsCaseApplication application, CaseConfirmPayDTO dto); - /** - * 发送受理短信 - * @param dto - * @param caseAppllication - */ - public void sendAcceptSms(CaseConfirmPayDTO dto, MsCaseApplication caseAppllication,String userName,String phone ); + } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java index 8af6a6e..ff0647b 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java @@ -27,20 +27,22 @@ import com.ruoyi.common.utils.file.FileUploadUtils; import com.ruoyi.common.utils.file.SaaSAPIFileUtils; import com.ruoyi.system.domain.entity.flow.MsCaseFlow; import com.ruoyi.system.domain.entity.flow.MsCaseFlowRoleRelated; +import com.ruoyi.system.domain.entity.shortmessage.MsSendMailHistoryRecord; import com.ruoyi.system.mapper.*; import com.ruoyi.system.mapper.flow.MsCaseFlowMapper; import com.ruoyi.system.mapper.flow.MsCaseFlowRoleRelatedMapper; +import com.ruoyi.system.mapper.shortmessage.MsSendMailHistoryRecordMapper; import com.ruoyi.system.service.impl.BeiMingInterfaceService; import com.ruoyi.wisdomarbitrate.domain.dto.dept.DeptIdentify; import com.ruoyi.wisdomarbitrate.domain.dto.dept.SealManage; import com.ruoyi.wisdomarbitrate.domain.dto.mscase.SealSignRecord; import com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SendMailRecord; -import com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SmsSendRecord; import com.ruoyi.wisdomarbitrate.domain.dto.template.FatchRule; import com.ruoyi.wisdomarbitrate.domain.dto.template.TemplateManage; import com.ruoyi.wisdomarbitrate.domain.entity.dept.MsSealSignRecord; import com.ruoyi.wisdomarbitrate.domain.entity.mscase.*; import com.ruoyi.wisdomarbitrate.domain.vo.mscase.*; +import com.ruoyi.wisdomarbitrate.domain.vo.shortmessage.MeetingInfoVO; import com.ruoyi.wisdomarbitrate.mapper.dept.DeptIdentifyMapper; import com.ruoyi.wisdomarbitrate.mapper.dept.MsSealSignRecordMapper; import com.ruoyi.wisdomarbitrate.mapper.dept.SealManageMapper; @@ -50,6 +52,7 @@ import com.ruoyi.wisdomarbitrate.mapper.sendrecord.SmsRecordMapper; import com.ruoyi.wisdomarbitrate.mapper.template.FatchRuleMapper; import com.ruoyi.wisdomarbitrate.mapper.template.TemplateManageMapper; import com.ruoyi.wisdomarbitrate.service.mscase.MsCaseApplicationService; +import com.ruoyi.wisdomarbitrate.service.shortmessage.ShortMessageService; import com.ruoyi.wisdomarbitrate.utils.*; import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.poi.xwpf.usermodel.XWPFDocument; @@ -123,6 +126,8 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { @Autowired MsColumnValueLogMapper columnValueLogMapper; @Autowired + private MsSendMailHistoryRecordMapper sendMailHistoryRecordMapper; + @Autowired MsCaseFlowMapper caseFlowMapper; @Autowired MsCaseFlowRoleRelatedMapper caseFlowRoleRelatedMapper; @@ -162,15 +167,21 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { private RedisCache redisCache; @Autowired private EmailOutUtil emailOutUtil; + @Value("${spring.mail.username}") + private String emailFrom; @Autowired private SendMailRecordMapper sendMailRecordMapper; @Autowired BeiMingInterfaceService beiMingInterfaceService; + @Autowired + ShortMessageService shortMessageService; @Value("${beimingprivatekey}") public String privateKey; // 案件基本字段 public static final List CASE_BASE_COLUMN = Arrays.asList("caseSubjectAmount", "arbitratClaims", "facts", "requestRule"); public static final SimpleDateFormat yyyymmddFormat = new SimpleDateFormat("yyyy-MM-dd"); + // 日期格式化年月日 + public static final SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日"); /** * 案件列表查询 @@ -310,7 +321,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { } } - if(vo.getOrganizeFlag()==null || vo.getOrganizeFlag()!=1) { + if(affiliate.getOrganizeFlag()==null || affiliate.getOrganizeFlag()!=1) { if (StrUtil.isNotEmpty(affiliate.getRoleName()) && affiliate.getRoleName().equals("申请人") && affiliate.getRoleType() != null && affiliate.getRoleType() == 1&&StrUtil.isNotEmpty(affiliate.getName()) && !applicantName.toString().contains(affiliate.getName()+Constants.CN_SPLIT_COMMA)) { @@ -323,7 +334,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { applicantName.append(affiliate.getApplicantOrgName()).append(Constants.CN_SPLIT_COMMA); } } - if(vo.getOrganizeFlag()==null || vo.getOrganizeFlag()!=1) { + if(affiliate.getOrganizeFlag()==null || affiliate.getOrganizeFlag()!=1) { if (StrUtil.isNotEmpty(affiliate.getRoleName()) && affiliate.getRoleName().equals("被申请人") && affiliate.getRoleType() != null && affiliate.getRoleType() == 3&&StrUtil.isNotEmpty(affiliate.getName()) && !respondentName.toString().contains(affiliate.getName()+Constants.CN_SPLIT_COMMA)) { @@ -562,7 +573,6 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { } }); } - // todo vo.setAffiliate(affiliateVO); // 查询附件 List caseAttachList = msCaseAttachMapper.queryAnnexPathByCaseId(id); @@ -572,7 +582,6 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { vo.setColumnValueList(columnValueVOS); // 查询拒绝原因 vo.setReason(auditMapper.selectByCaseId(id,caseApplication.getCaseFlowId())); - // todo 在日志表查詢结束时间返回 vo.setEndTime(caseLogRecordMapper.selectEndTimeByCaseId(caseApplication.getId(),"结束")); return vo; } @@ -622,13 +631,9 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { if (caseApplication.getId() == null) { caseApplication.setId(IdWorkerUtil.getId()); } - if(caseApplication.getOrganizeFlag()==null){ - caseApplication.setOrganizeFlag(0); - } caseApplication.setCaseStatusName(caseFlow.getCaseStatusName()); caseApplication.setCaseFlowId(caseFlow.getId()); caseApplication.setCreateTime(new Date()); - // todo 暂时写死,费用300元 caseApplication.setCaseSubjectAmount(new BigDecimal("30000")); setFeePayableMethod(caseApplication); // 设置批号 @@ -676,16 +681,9 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { req.setBatchNumber(caseApplication.getBatchNumber()); } // 生成调解申请书 - if(caseApplication.getOrganizeFlag()==0){ - // 自然人 - req.setTemplateType(TemplateTypeEnum.PERSON_MEDIATION_APPLICATION.getCode()); - }else { - // 机构 - req.setTemplateType(TemplateTypeEnum.MEDIATION_APPLICATION.getCode()); - } + req.setTemplateType(TemplateTypeEnum.PERSON_MEDIATION_APPLICATION.getCode()); req.setTemplateId(String.valueOf(caseApplication.getTemplateId())); - // todo 部署放开 - caseApplicationService.generateApplication(req); + caseApplicationService.generateApplication1(req); // 保存案件附件 if (CollectionUtil.isNotEmpty(caseAttachList)) { for (MsCaseAttach caseAttach : caseAttachList) { @@ -720,8 +718,11 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { */ @Transactional public void setCaseAfflicate(MsCaseApplicationVO caseApplication, MsCaseAffiliate affiliate,int groupOrder) { - boolean b = caseApplication.getOrganizeFlag() != 1 && (affiliate.getRoleType() == 1||affiliate.getRoleType() == 3) && StrUtil.isEmpty(affiliate.getEmail()); - if(affiliate==null ||b|| StrUtil.isEmpty(affiliate.getName())){ + if(affiliate==null){ + return; + } + boolean b = affiliate.getOrganizeFlag() != 1 && (affiliate.getRoleType() == 1||affiliate.getRoleType() == 3) && StrUtil.isEmpty(affiliate.getEmail()); + if(b|| StrUtil.isEmpty(affiliate.getName())){ return; } affiliate.setGroupOrder(groupOrder); @@ -775,7 +776,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { break; } // 如果是申请人,则和用户表关联 - if (caseApplication.getOrganizeFlag() == 0) { + if (affiliate.getOrganizeFlag() == 0) { caseApplicationService.insertAfficateUser(affiliate, roleIdList); } else { // 申请机构 @@ -786,7 +787,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { SysDept dept = sysDeptMapper.selectDeptByName(affiliate.getName()); if (dept==null) { // 不存在该部门,新增 - dept = new SysDept(); + dept = new SysDept(); dept.setParentId(0L); dept.setDeptName(affiliate.getName()); dept.setAncestors("0"); @@ -835,15 +836,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { if(StrUtil.isEmpty(affiliate.getEmail())){ return; } - // Object userEmailCache = redisCache.getCacheObject(CacheConstants.USER_EMAIL_KEY + affiliate.getEmail()); - SysUser user=null; - // if(ObjectUtil.isEmpty(userEmailCache)){ - user = sysUserMapper.selectUserByEmail(affiliate.getEmail()); - // }else { - // user=(SysUser)userEmailCache; - // } - - + SysUser user = sysUserMapper.selectUserByEmail(affiliate.getEmail()); // 判断该用户是否存在 if(user==null){ // 不存在,则新增 @@ -862,10 +855,8 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { user.setNationality(affiliate.getNationality()); userMapper.insertUser(user); affiliate.setUserId(user.getUserId()); - // 更新缓存 // redis缓存 redisCache.setCacheObject(CacheConstants.USER_KEY+user.getUserId(),user); - // redisCache.setCacheObject(CacheConstants.USER_EMAIL_KEY + affiliate.getEmail(),user); // 查询该角色是否存在申请人角色 List roleIds = userRoleMapper.selectRoleIdsByUserId(user.getUserId()); for (Long roleId : roleIdList) { @@ -874,8 +865,6 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { } } - // todo 发短信,有电话给电话发,没有电话给邮箱发 - }else { // 存在的话将案件人员信息同步到用户表,更新用户表 user.setHome(affiliate.getHome()); @@ -892,7 +881,6 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { affiliate.setUserId(user.getUserId()); // redis缓存 redisCache.setCacheObject(CacheConstants.USER_KEY+user.getUserId(),user); - // redisCache.setCacheObject(CacheConstants.USER_EMAIL_KEY + affiliate.getEmail(),user); // 查询该角色是否存在申请人角色 List roleIds = userRoleMapper.selectRoleIdsByUserId(user.getUserId()); for (Long roleId : roleIdList) { @@ -1010,9 +998,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { if (msCaseAffiliateVO==null) { return AjaxResult.error("案件相关人员未填写"); } - if(caseApplication.getOrganizeFlag()==null){ - caseApplication.setOrganizeFlag(0); - } + // 计算仲裁费用 caseApplication.setCaseSubjectAmount(new BigDecimal("30000")); setFeePayableMethod(caseApplication); @@ -1068,15 +1054,10 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { MsCaseApplicationReq req = new MsCaseApplicationReq(); req.setCaseFlowId(caseFlow.getId()); req.setId(caseApplication.getId()); - if(caseApplication.getOrganizeFlag()==0){ // 自然人 - req.setTemplateType(TemplateTypeEnum.PERSON_MEDIATION_APPLICATION.getCode()); - }else { - // 机构 - req.setTemplateType(TemplateTypeEnum.MEDIATION_APPLICATION.getCode()); - } + req.setTemplateType(TemplateTypeEnum.PERSON_MEDIATION_APPLICATION.getCode()); req.setTemplateId(String.valueOf(selectByPrimaryKey.getTemplateId())); - caseApplicationService.generateApplication(req); + caseApplicationService.generateApplication1(req); // 新增日志 CaseLogUtils.insertCaseLog(caseApplication.getId(), 0, "修改案件",null); @@ -1366,7 +1347,6 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { affiliateVO.setRes(resList); BeanUtil.copyProperties(caseApplication, caseApplicationVO); affiliateVOS.add(affiliateVO); - //todo caseApplicationVO.setAffiliate(affiliateVO); caseApplicationVO.setOrganizeFlag(1); } @@ -1483,6 +1463,86 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { return AjaxResult.success(); } + /** + * 生成调解申请书 + * @param req + * @return + */ + @Transactional + @Override + public AjaxResult generateApplication1(MsCaseApplicationReq req) { + // 根据模板id查询申请书 + if(req.getTemplateId()==null || req.getTemplateType()==null){ + return AjaxResult.error("模板id不能为空"); + } + TemplateManage templateManage=templateManageMapper.selectByIdAndType(Long.valueOf(req.getTemplateId()),req.getTemplateType()); + if(templateManage==null||StrUtil.isEmpty(templateManage.getTemOrigPath())){ + throw new ServiceException("未找到模板"); + } + String templatePath = "/home/ruoyi" + templateManage.getTemOrigPath(); + templatePath=templatePath.replace("/profile","/uploadPath"); + try { + File file = new File(templatePath); + } catch (Exception e) { + throw new ServiceException("未找到模板"); + } +// // 获取模板中的占位符key + List bookmarkList = getBookmarkByDocx(templatePath); + if (CollectionUtil.isEmpty(bookmarkList)) { + throw new ServiceException("请检查模板是否配置正确,未获取到占位符"); + } + // 在系统表中查询案件内置字段 + SysDictData sysDictData = new SysDictData(); + sysDictData.setDictType("case_built_type"); + List dictDataList = dictDataMapper.selectDictDataList(sysDictData); + if(CollectionUtil.isEmpty(dictDataList)){ + throw new ServiceException("未找到系统内置字段"); + } + // 如果批号不为空,则为批量操作,根据批号查询未锁定的案件 + if(StrUtil.isNotEmpty(req.getBatchNumber())){ + List caseApplicationList=listByBatchNumber(req.getBatchNumber(),req.getCaseFlowId()); + if(CollectionUtil.isEmpty(caseApplicationList)){ + throw new ServiceException("该批次号下未找到案件"); + } + // 案件ids + List caseIds = caseApplicationList.stream().map(MsCaseApplication::getId).collect(Collectors.toList()); + // 根据ids查询案件关联人员 + Example afflicateExample = new Example(MsCaseAffiliate.class); + afflicateExample.createCriteria().andIn("caseAppliId", caseIds); + List affiliateList = msCaseAffiliateMapper.selectByExample(afflicateExample); + if(CollectionUtil.isEmpty(affiliateList)){ + throw new ServiceException("该批次号下未找到案件关联人员"); + } + + Map affiliateMap = affiliateList.stream().collect(Collectors.toMap(MsCaseAffiliate::getCaseAppliId, Function.identity())); + + // 循环生成调解申请书 + for (MsCaseApplication application : caseApplicationList) { + // todo 批量的未改案件相关人员,结构已发生变化 +// MsCaseAffiliate affiliate = affiliateMap.get(application.getId()); +// if(affiliate==null){ +// continue; +// } + // caseApplicationService.createMediateApplication(application, affiliate, templatePath, bookmarkList,dictDataList,req.getTemplateType()); + + } + }else { + // 单独生成调解申请书 + // 根据案件id查询案件信息 + MsCaseApplication application = msCaseApplicationMapper.selectByPrimaryKey(req.getId()); + // 查询案件关联人员 + List msCaseAffiliates = selectAffliatesByCaseId(req.getId()); + if (application == null || msCaseAffiliates == null) { + throw new ServiceException("该案件不存在"); + } + + caseApplicationService.createMediateApplication1(application, msCaseAffiliates, templatePath, bookmarkList,dictDataList,req.getTemplateType()); + } + + + return AjaxResult.success(); + } + /** * 根据批次号查询该流程未锁定案件 @@ -1555,14 +1615,12 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { e.printStackTrace(); return AjaxResult.error("上传失败"); } - // todo 对接北明,调用上传附件接口 + // 对接北明,调用上传附件接口 MsCaseApplication caseApplication = msCaseApplicationMapper.selectByPrimaryKey(id); if(caseApplication==null){ return AjaxResult.error("案件不存在"); } if(StrUtil.isEmpty(caseApplication.getCaseSource()) && CollectionUtil.isNotEmpty(successList)) { - // todo - for (MsCaseAttach caseAttach : successList) { if(StrUtil.isEmpty(caseAttach.getAnnexPath())){ continue; @@ -1589,31 +1647,6 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { @Override public AjaxResult accept(MsCaseApplicationVO req) { if (StrUtil.isNotEmpty(req.getBatchNumber())) { - // todo,结构发生变化,暂时不改批量操作,根据批号查询未锁定的案件 -// List applicationList = listByBatchNumber(req.getBatchNumber(), req.getCaseFlowId()); -// if (CollectionUtil.isEmpty(applicationList)) { -// return AjaxResult.error("该批次号下未找到案件"); -// } -// // 查询案件关联人员 -// Example example = new Example(MsCaseAffiliate.class); -// example.createCriteria().andIn("caseAppliId", applicationList.stream().map(MsCaseApplication::getId).collect(Collectors.toList())); -// List affiliateList = msCaseAffiliateMapper.selectByExample(example); -// if (CollectionUtil.isEmpty(affiliateList)) { -// return AjaxResult.error("该批次号下未找到案件"); -// } -// Map affiliateMap = affiliateList.stream().collect(Collectors.toMap(MsCaseAffiliate::getCaseAppliId, Function.identity())); -// for (MsCaseApplication application : applicationList) { -// // 不受理 -// if(req.getAgreeFlag().equals(YesOrNoEnum.NO.getCode())){ -// if(StrUtil.isEmpty(req.getRejectReason())){ -// throw new ServiceException("请填写拒绝原因"); -// } -// caseApplicationService.notAccept(String.valueOf(req.getId()),req.getRejectReason()); -// }else { -// caseApplicationService.accept(application,req,affiliateMap); -// } -// -// } } else { // 不受理 @@ -1658,7 +1691,6 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { // 给被申请人发送短信 if (affiliateMap.containsKey(application.getId())) { List affiliates = affiliateMap.get(application.getId()); - // todo 被申请人发送短信 // 被申受理分配通知 SMSNoticeDO resNotice = new SMSNoticeDO("待缴费通知", "尊敬的用户,您的" + application.getCaseNum() + "的案件已成功提交,请登录调解系统进行缴费处理。请知晓,如非本人操作,请忽略本短信。", @@ -1681,44 +1713,48 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { @Override @Transactional public void isAcceptNotice(MsCaseApplication application, List affiliates, Boolean applicantFlag) { - + // 根据案件id查询案件 + MsCaseApplication selectApplication = msCaseApplicationMapper.selectByPrimaryKey(application.getId()); + if(selectApplication==null){ + return; + } + List appPhones=new ArrayList<>(); + List resPhones=new ArrayList<>(); + List appEmails=new ArrayList<>(); + List resEmails=new ArrayList<>(); for (MsCaseAffiliate affiliate : affiliates) { if(applicantFlag==null || applicantFlag) { - if (affiliate.getOperatorFlag() == 1 && (affiliate.getRoleType().equals(3) || affiliate.getRoleType().equals(4))) { + if ( affiliate.getOperatorFlag() == 1 && (affiliate.getRoleType().equals(3) || affiliate.getRoleType().equals(4))) { + resPhones.add(affiliate.getPhone()); String sendContent = "尊敬的用户,您的" + application.getCaseNum() + "的案件已成功提交,请登录调解系统进行缴费处理。请知晓,如非本人操作,请忽略本短信"; String subject = "待缴费通知"; // 电话号不为空,发送短信,否则发邮箱 - if (StrUtil.isNotEmpty(affiliate.getPhone())) { - // 发送短信 + if (StrUtil.isNotEmpty(affiliate.getPhone()) && !resPhones.contains(affiliate.getPhone())) { // 给被申请人发送案件受理短信 2074247 待缴费通知 尊敬的用户,您编号为{1}的案件已成功提交,请登录调解系统进行缴费处理。请知晓,如非本人操作,请忽略本短信 - // todo 短信 - // cn.hutool.json.JSONObject jsonObject = SmsUtils.sendSms(application.getId(), "2074247", affiliate.getPhone(), new String[]{application.getCaseNum()}); - cn.hutool.json.JSONObject jsonObject = new cn.hutool.json.JSONObject(); - sendSMS(jsonObject,application, affiliate, sendContent); - - } else { + SmsUtils.sendSms(selectApplication, "2074247", affiliate.getPhone(), new String[]{selectApplication.getCaseNum()}); + } else if(StrUtil.isNotEmpty(affiliate.getEmail()) && !resEmails.contains(affiliate.getEmail())){ + resEmails.add(affiliate.getEmail()); // 发送邮件 sendEmail(application, affiliate, subject, sendContent); - } } } if(applicantFlag==null || !applicantFlag) { - if (affiliate.getOperatorFlag() == 1 && (affiliate.getRoleType().equals(1) || affiliate.getRoleType().equals(2))) { + if ( affiliate.getOperatorFlag() == 1 && (affiliate.getRoleType().equals(1) || affiliate.getRoleType().equals(2))) { + // 拒绝原因 String rejectReason = application.getRejectReason() == null ? "" : application.getRejectReason(); String subject = "案件不受理通知"; String sendContent = "尊敬的用户,您编号为" + application.getCaseNum() + "的案件由于"+rejectReason+"所以不予受理,请知晓,如非本人操作,请忽略本短信。"; // 电话号不为空,发送短信,否则发邮箱 - if (StrUtil.isNotEmpty(affiliate.getPhone())) { - // todo 短信 -// cn.hutool.json.JSONObject jsonObject = SmsUtils.sendSms(application.getId(), "2065809", affiliate.getPhone(), -// new String[]{application.getCaseNum(), rejectReason}); - cn.hutool.json.JSONObject jsonObject = new cn.hutool.json.JSONObject(); - // 发送短信 - sendSMS(jsonObject,application, affiliate, sendContent); + if (StrUtil.isNotEmpty(affiliate.getPhone()) && !appPhones.contains(affiliate.getPhone())) { + appPhones.add(affiliate.getPhone()); + // 申请人发送案件不受理短信 + SmsUtils.sendSms(selectApplication, "2065809", affiliate.getPhone(), + new String[]{selectApplication.getCaseNum(), rejectReason}); - } else { + } else if(StrUtil.isNotEmpty(affiliate.getEmail()) && !appEmails.contains(affiliate.getEmail())){ + appEmails.add(affiliate.getEmail()); // 发送邮件 sendEmail(application, affiliate, subject, sendContent); @@ -1747,33 +1783,23 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { sendMailRecord.setMailName(subject); sendMailRecord.setSendTime(new Date()); sendMailRecord.setCreateBy(SecurityUtils.getUsername()); + sendMailRecord.setCreateTime(new Date()); + sendMailRecord.setMailSubject(subject); + sendMailRecord.setMailFromAddress(emailFrom); if (emailFlag) { sendMailRecord.setSendStatus(1); } else { sendMailRecord.setSendStatus(0); } sendMailRecordMapper.saveSendMailRecord(sendMailRecord); + // 新增历史记录 + MsSendMailHistoryRecord msSendMailHistoryRecord = new MsSendMailHistoryRecord(); + BeanUtils.copyProperties(sendMailRecord, msSendMailHistoryRecord); + msSendMailHistoryRecord.setParentId(sendMailRecord.getId()); + msSendMailHistoryRecord.setId(null); + sendMailHistoryRecordMapper.insertSelective(msSendMailHistoryRecord); } - /** - * 发送短信 - * @param smsFlag 短信是否发送成功 - * @param application 案件基本信息 - * @param affiliate 案件人员 - * @param sendContent 发送内容 - */ - @Override - @Transactional - public void sendSMS(cn.hutool.json.JSONObject jsonObject ,MsCaseApplication application, MsCaseAffiliate affiliate, String sendContent) { - SmsSendRecord smsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), affiliate.getPhone(), new Date(), sendContent,jsonObject.get("sid")!=null?jsonObject.get("sid").toString():null); - if (jsonObject.get("status")!=null && !jsonObject.get("status").equals(SMSStatusEnum.FAIL.getCode())) { - // 发送成功 - smsSendRecord.setSendStatus(SMSStatusEnum.SENDING.getCode()); - } else { - smsSendRecord.setSendStatus(SMSStatusEnum.FAIL.getCode()); - } - smsRecordMapper.saveSmsSendRecord(smsSendRecord); - } /** * 案件提交 @@ -1784,7 +1810,6 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { @Transactional public AjaxResult submit(MsCaseApplication req) { if(StrUtil.isNotEmpty(req.getBatchNumber())){ - // todo 暂时不改,批量提交 List list = listByBatchNumber(req.getBatchNumber(), req.getCaseFlowId()); if(CollectionUtil.isEmpty(list)){ return AjaxResult.error("该批次号下未找到案件"); @@ -1816,7 +1841,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { return AjaxResult.error("被申请人操作人手机号不存在,请修改案件信息"); } MsCaseFlow caseFlow = caseApplicationService.nextFlow(req.getId(), req.getCaseFlowId(), YesOrNoEnum.NO.getCode()); - // TODO 案件来源如果是空,则为北明案件,提交完向北明推送案件状态 + // 提交完向北明推送案件状态 caseApplicationService.pushStatusToBM(caseApplication, PushCaseStatusEnum.MEDIATE); } return AjaxResult.success("提交成功"); @@ -1929,47 +1954,6 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { Example example = new Example(MsCaseMediator.class); Example.Criteria criteria = example.createCriteria(); LoginUser loginUser = SecurityUtils.getLoginUser(); - -// if (loginUser.getUser() != null ) { -// // 查询角色 -// List roles = roleMapper.selectRolesByUserName(loginUser.getUser().getUserName()); -// if (CollectionUtil.isNotEmpty(roles)) { -// for (SysRole role : roles) { -// if (role.getRoleName().contains("被申请人")) { -// criteria.andEqualTo("type", YesOrNoEnum.YES.getCode()); -// break; -// } else if (role.getRoleName().contains("申请人")) { -// criteria.andEqualTo("type", YesOrNoEnum.NO.getCode()); -// break; -// } else if (role.getRoleName().contains("委托代理人")) { -// -// List operatorList = affiliates.stream().filter(affiliate -> -// affiliate.getOperatorFlag() != null && affiliate.getOperatorFlag() == 1 && affiliate.getRoleType() != null).collect(Collectors.toList()); -// if (CollectionUtil.isNotEmpty(operatorList)) { -// Map> map = operatorList.stream().collect(Collectors.groupingBy(MsCaseAffiliate::getUserId)); -// if (map.containsKey(loginUser.getUserId())) { -// List msCaseAffiliates = map.get(loginUser.getUserId()); -// for (MsCaseAffiliate affiliate : msCaseAffiliates) { -// // 申请人 -// if (affiliate.getRoleType() == 1 || affiliate.getRoleType() == 2) { -// criteria.andEqualTo("type", YesOrNoEnum.NO.getCode()); -// break; -// } else if (affiliate.getRoleType() == 3 || affiliate.getRoleType() == 4) { -// criteria.andEqualTo("type", YesOrNoEnum.YES.getCode()); -// break; -// } -// } -// } -// } -// } -// } -// } -// -// criteria.andEqualTo("caseAppliId", caseAppliId); -// // 已选择的调解员 -// List selectedMediators = msCaseMediatorMapper.selectByExample(example); -// selectedMediatorIds = selectedMediators.stream().map(MsCaseMediator::getMediatorId).collect(Collectors.toList()); -// } for (MsCaseAffiliate affiliate : affiliates) { if(affiliate.getUserId()!=null && affiliate.getUserId().equals(loginUser.getUser().getUserId())){ if( affiliate.getRoleType()==null){ @@ -2051,38 +2035,6 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { } } } - -// if(CollectionUtil.isNotEmpty(roles)){ -// for (SysRole role : roles) { -// if(role.getRoleName().contains("被申请人")){ -// miniProgressFlag=YesOrNoEnum.YES.getCode(); -// } else if (role.getRoleName().contains("申请人")) { -// miniProgressFlag= YesOrNoEnum.NO.getCode(); -// break; -// }else if(role.getRoleName().contains("委托代理人")){ -// -// List operatorList = affiliates.stream().filter(affiliate -> -// affiliate.getOperatorFlag() != null && affiliate.getOperatorFlag() == 1 && affiliate.getRoleType() != null ).collect(Collectors.toList()); -// if(CollectionUtil.isNotEmpty(operatorList)){ -// Map> map = operatorList.stream().collect(Collectors.groupingBy(MsCaseAffiliate::getUserId)); -// if(map.containsKey(user.getUserId())){ -// List msCaseAffiliates = map.get(user.getUserId()); -// for (MsCaseAffiliate affiliate : msCaseAffiliates) { -// // 申请人 -// if(affiliate.getRoleType()==1||affiliate.getRoleType()==2){ -// miniProgressFlag= YesOrNoEnum.NO.getCode(); -// break; -// } -// else if(affiliate.getRoleType()==3||affiliate.getRoleType()==4){ -// miniProgressFlag= YesOrNoEnum.YES.getCode(); -// break; -// } -// } -// } -// } -// } -// } -// } vo.setMiniProgressFlag(miniProgressFlag); // 先删除已选择的调解员,在新增 Example mediatorExample = new Example(MsCaseMediator.class); @@ -2255,37 +2207,41 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { // 发送开庭短信 if(CollectionUtil.isNotEmpty(vo.getHerDates())) { List affiliates = selectAffliatesByCaseId(application.getId()); - // todo 申请人电话 caseApplication.setHearDate(application.getHearDate()); // 申请人发送开庭日期短信 sendHearDateSms(caseApplication, affiliates); // 调解员发送短信,根据调解员id查询用户 if (caseApplication.getMediatorId() != null) { + // 线下调解 2077966 尊敬的用户,您的{1}案件,线下调解日期已确定为{2},请知晓,如非本人操作,请忽略本短信。 SysUser sysUser = sysUserMapper.selectUserById(caseApplication.getMediatorId()); - String content="尊敬的用户,您的" + caseApplication.getCaseNum() + "的案件,线上调解日期已确定为"+application.getHearDate()+",请知晓,如非本人操作,请忽略本短信。"; - String templateId = "2075447"; + String content="尊敬的用户,您的" + caseApplication.getCaseNum() + "的案件,线下调解日期已确定为"+application.getHearDate()+",请知晓,如非本人操作,请忽略本短信。"; + String templateId="2077966"; String subject="开庭日期通知"; MsCaseAffiliate meditorAffliate = new MsCaseAffiliate(); meditorAffliate.setPhone(sysUser.getPhonenumber()); meditorAffliate.setEmail(sysUser.getEmail()); - // 线下调解 - if(StrUtil.isEmpty(application.getMediationMethod()) || !application.getMediationMethod().equals("1")){ - // 申请人/被申通知, 线下调解 2077966 尊敬的用户,您的{1}案件,线下调解日期已确定为{2},请知晓,如非本人操作,请忽略本短信。 - content="尊敬的用户,您的" + caseApplication.getCaseNum() + "的案件,线下调解日期已确定为"+application.getHearDate()+",请知晓,如非本人操作,请忽略本短信。"; - templateId="2077966"; + String roomUuid=null; + // 线上调解 + if(StrUtil.isNotEmpty(application.getMediationMethod()) && application.getMediationMethod().equals("1")){ + // 获取短信链接uuid + MeetingInfoVO meetingInfoVO= MeetingInfoVO.builder().userId(sysUser.getUserId()).userName(sysUser.getUserName()).caseId(application.getId()).roomId(application.getRoomId()).build(); + roomUuid = shortMessageService.buildMeetingInfoRecord(meetingInfoVO); + // 短信模板:2130103 线上调解时间和会议通知 尊敬的用户,您的{2}线上开庭时间为{3},会议链接https://txroom.xayunmei.com/#/home?{4},请点击链接参加会议,如非本人操作,请忽略本短信. + + content="尊敬的用户,您的" + caseApplication.getCaseNum() + "线上开庭时间为"+application.getHearDate()+"会议链接https://txroom.xayunmei.com/#/home?"+roomUuid+",请点击链接参加会议,如非本人操作,请忽略本短信."; + templateId = "2130103"; } // 电话号不为空,发送短信,否则发邮箱 if (StrUtil.isNotEmpty(sysUser.getPhonenumber())) { - //TODO 发送调解时视频会议链接地址,模板id为2125909 - //短信模板:尊敬的{1}用户,您的{2}会议链接https://txroom.xayunmei.com/#/home?{3},请点击链接参加会议,如非本人操作,请忽略本短信 + if(roomUuid==null) { + SmsUtils.sendSms(caseApplication, templateId, sysUser.getPhonenumber(), + new String[]{caseApplication.getCaseNum(), application.getHearDate()}); + }else { + SmsUtils.sendSms(caseApplication, templateId, sysUser.getPhonenumber(), + new String[]{caseApplication.getCaseNum(), application.getHearDate(),roomUuid}); + } - // todo 短信 -// cn.hutool.json.JSONObject jsonObject = SmsUtils.sendSms(application.getId(), templateId, sysUser.getPhonenumber(), -// new String[]{caseApplication.getCaseNum(), application.getHearDate()}); - cn.hutool.json.JSONObject jsonObject = new cn.hutool.json.JSONObject(); - // 发送短信 - caseApplicationService.sendSMS(jsonObject, caseApplication, meditorAffliate, content); } else { // 发送邮件 @@ -2309,15 +2265,55 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { public void sendHearDateSms(MsCaseApplication application, List affiliates) { if(StrUtil.isNotEmpty(application.getMediationMethod()) && application.getMediationMethod().equals("1")){ - // 申请人/被申通知, 线上调解 2075447 尊敬的用户,您的{1}案件,线上调解日期已确定为{2},请知晓,如非本人操作,请忽略本短信。 - SMSNoticeDO noticeDO = new SMSNoticeDO("开庭日期通知", - "尊敬的用户,您的" + application.getCaseNum() + "的案件,线上调解日期已确定为"+application.getHearDate()+",请知晓,如非本人操作,请忽略本短信。", - "2075447", - new String[]{application.getCaseNum(),application.getHearDate()} - ); - SMSNotice notice = new SMSNotice(noticeDO,noticeDO); - caseApplicationService.sendNotice(application,affiliates,null,notice); + List appPhones=new ArrayList<>(); + List resPhones=new ArrayList<>(); + List appEmails=new ArrayList<>(); + List resEmails=new ArrayList<>(); + + for (MsCaseAffiliate affiliate : affiliates) { + + // 申请人 + if (affiliate.getOperatorFlag() == 1 && (affiliate.getRoleType().equals(1) || affiliate.getRoleType().equals(2))) { + // 获取短信链接uuid + MeetingInfoVO meetingInfoVO= MeetingInfoVO.builder().userId(affiliate.getUserId()).userName(affiliate.getUserName()).caseId(application.getId()).roomId(application.getRoomId()).build(); + String roomUuid = shortMessageService.buildMeetingInfoRecord(meetingInfoVO); + // 申请人/被申通知, 线上调解 2075447 尊敬的用户,您的{1}案件,线上调解日期已确定为{2},请知晓,如非本人操作,请忽略本短信。 + String content="尊敬的用户,您的" + application.getCaseNum() + "线上开庭时间为"+application.getHearDate()+"会议链接https://txroom.xayunmei.com/#/home?"+roomUuid+",请点击链接参加会议,如非本人操作,请忽略本短信."; + if (StrUtil.isNotEmpty(affiliate.getPhone())&&!appPhones.contains(affiliate.getPhone())) { + appPhones.add(affiliate.getPhone()); + SmsUtils.sendSms(application,"2130103", affiliate.getPhone(), + new String[]{application.getCaseNum(),application.getHearDate(),roomUuid}); + + } else if(StrUtil.isNotEmpty(affiliate.getEmail())&&!appEmails.contains(affiliate.getEmail())) { + appEmails.add(affiliate.getEmail()); + // 发送邮件 + caseApplicationService.sendEmail(application, affiliate, "开庭日期通知", content); + + } + continue; + } + // 被申请人 + if (affiliate.getOperatorFlag() == 1 && (affiliate.getRoleType().equals(3) || affiliate.getRoleType().equals(4))) { + // 获取短信链接uuid + MeetingInfoVO meetingInfoVO= MeetingInfoVO.builder().userId(affiliate.getUserId()).userName(affiliate.getUserName()).caseId(application.getId()).roomId(application.getRoomId()).build(); + String roomUuid = shortMessageService.buildMeetingInfoRecord(meetingInfoVO); + // 申请人/被申通知, 线上调解 2075447 尊敬的用户,您的{1}案件,线上调解日期已确定为{2},请知晓,如非本人操作,请忽略本短信。 + String content="尊敬的用户,您的" + application.getCaseNum() + "线上开庭时间为"+application.getHearDate()+"会议链接https://txroom.xayunmei.com/#/home?"+roomUuid+",请点击链接参加会议,如非本人操作,请忽略本短信."; + if (StrUtil.isNotEmpty(affiliate.getPhone())&& !resPhones.contains(affiliate.getPhone())) { + resPhones.add(affiliate.getPhone()); + SmsUtils.sendSms(application,"2130103", affiliate.getPhone(), + new String[]{application.getCaseNum(),application.getHearDate(),roomUuid}); + + } else if(StrUtil.isNotEmpty(affiliate.getEmail())&&!resEmails.contains(affiliate.getEmail())){ + resEmails.add(affiliate.getEmail()); + // 发送邮件 + caseApplicationService.sendEmail(application, affiliate, "开庭日期通知", content); + + } + + } + } }else { // 申请人/被申通知, 线下调解 2077966 尊敬的用户,您的{1}案件,线下调解日期已确定为{2},请知晓,如非本人操作,请忽略本短信。 SMSNoticeDO noticeDO = new SMSNoticeDO("开庭日期通知", @@ -2340,13 +2336,27 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { @Transactional public void sendNotice(MsCaseApplication application, List affiliates, Boolean applicantFlag, SMSNotice notice) { + List appPhones=new ArrayList<>(); + List resPhones=new ArrayList<>(); + List appEmails=new ArrayList<>(); + List resEmails=new ArrayList<>(); for (MsCaseAffiliate affiliate : affiliates) { if (applicantFlag == null || applicantFlag) { // 申请人 if (affiliate.getOperatorFlag() == 1 && (affiliate.getRoleType().equals(1) || affiliate.getRoleType().equals(2))) { SMSNoticeDO applicantNotice = notice.getApplicantNotice(); - caseApplicationService.sendNotice(application, affiliate, applicantNotice); + if (StrUtil.isNotEmpty(affiliate.getPhone())&&!appPhones.contains(affiliate.getPhone())) { + appPhones.add(affiliate.getPhone()); + SmsUtils.sendSms(application, applicantNotice.getTemplateId(), affiliate.getPhone(), + applicantNotice.getTemplateParamSet()); + + } else if(StrUtil.isNotEmpty(affiliate.getEmail())&&!appEmails.contains(affiliate.getEmail())) { + appEmails.add(affiliate.getEmail()); + // 发送邮件 + caseApplicationService.sendEmail(application, affiliate, applicantNotice.getSubject(), applicantNotice.getContent()); + + } continue; } } @@ -2354,41 +2364,24 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { // 被申请人 if (affiliate.getOperatorFlag() == 1 && (affiliate.getRoleType().equals(3) || affiliate.getRoleType().equals(4))) { SMSNoticeDO resNotice = notice.getResNotice(); - caseApplicationService.sendNotice(application, affiliate, resNotice); + if (StrUtil.isNotEmpty(affiliate.getPhone())&& !resPhones.contains(affiliate.getPhone())) { + resPhones.add(affiliate.getPhone()); + SmsUtils.sendSms(application, resNotice.getTemplateId(), affiliate.getPhone(), + resNotice.getTemplateParamSet()); + + } else if(StrUtil.isNotEmpty(affiliate.getEmail())&&!resEmails.contains(affiliate.getEmail())){ + resEmails.add(affiliate.getEmail()); + // 发送邮件 + caseApplicationService.sendEmail(application, affiliate, resNotice.getSubject(), resNotice.getContent()); + + } } } } } - /** - * 发送短信 - * @param application - * @param affiliate - * @param notice - */ - @Override - @Transactional - public void sendNotice(MsCaseApplication application, MsCaseAffiliate affiliate, - SMSNoticeDO notice) { - if (notice != null) { - // 电话号不为空,发送短信,否则发邮箱 - if (StrUtil.isNotEmpty(affiliate.getPhone())) { - // todo 短信 -// cn.hutool.json.JSONObject jsonObject = SmsUtils.sendSms(application.getId(), notice.getTemplateId(), affiliate.getPhone(), -// notice.getTemplateParamSet()); - cn.hutool.json.JSONObject jsonObject = new cn.hutool.json.JSONObject(); - // 发送短信 - caseApplicationService.sendSMS(jsonObject, application, affiliate, notice.getContent()); - - } else { - // 发送邮件 - caseApplicationService.sendEmail(application, affiliate, notice.getSubject(), notice.getContent()); - - } - } - } @@ -2430,9 +2423,8 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { caseApplication.setCaseStatusName("结束"); msCaseApplicationMapper.updateByPrimaryKeySelective(caseApplication); CaseLogUtils.insertCaseLog(application.getId(), 4, "受理分配", null); - // todo 为结束时,记录结束节点 CaseLogUtils.insertCaseLog(application.getId(), 17, "结束", null); - // todo 结束对接北明,为调解失败状态 + // 结束对接北明,为调解失败状态 if(StrUtil.isEmpty(application.getCaseSource())) { caseApplicationService.pushStatusToBM(application, PushCaseStatusEnum.FAIL); } @@ -2449,10 +2441,6 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { } return sysUser; } - @Override - public List getSmsSendRecord(SmsSendRecord smsSendRecord) { - return smsRecordMapper.getSmsSendRecord(smsSendRecord); - } /** * 保存onlyOffice在线编辑的文件 * @param @@ -2557,10 +2545,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { if (caseAttachList != null && caseAttachList.size() > 0) { for (MsCaseAttach caseAttach : caseAttachList) { if (caseAttach.getAnnexType() == AnnexTypeEnum.MEDIATE_BOOK.getCode()) { - // String prefix = "/profile"; - // int startIndex = prefix.length(); String annexPath = caseAttach.getAnnexPath(); - // String path = "/home/ruoyi/uploadPath/" + annexPath.substring(startIndex+1); if (annexPath.contains("/profile/upload")) { annexPath = annexPath.replace("/profile/upload", "/home/ruoyi/uploadPath/upload"); } @@ -2604,7 +2589,6 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { sealSignRecord.setPensonAccountMedi(sysUser.getPhonenumber()); sealSignRecord.setPensonNameMedi(sysUser.getNickName()); } - // todo // 设置申请人签名账户 sealSignRecord.setPensonAccount(applicantAffiliateOpt.get().getPhone()); sealSignRecord.setPensonName(applicantAffiliateOpt.get().getName()); @@ -2749,11 +2733,8 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { msSealSignRecord.setOrgnNamePsnAcc(sealSignRecord.getOrgnizeNamePsnAccount()); msSealSignRecord.setOrgnNamePsnName(sealSignRecord.getOrgnizeNamepsnName()); sealSignRecordMapper.insert(msSealSignRecord); - - SealSignRecord sealSignRecordapply = new SealSignRecord(); sealSignRecordapply.setSignFlowid(signFlowId); - // todo // 设置申请人账户 sealSignRecordapply.setPensonAccount(applicantAffiliateOpt.get().getPhone()); EsignHttpResponse signUrl = SignAward.signUrlMediation(sealSignRecordapply); @@ -2762,26 +2743,9 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { String urlapply = signUrlData.get("shortUrl").getAsString(); String urlapplynew = urlapply.substring(urlapply.lastIndexOf("/") + 1); - //发送签名链接短信,尊敬的{1}用户,您的{2}调解案件,签名链接{3},请点击链接签名,如非本人操作,请忽略本短信 - SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest(); - request.setTemplateId("2116857"); - - // 申请人发送短信 - request.setPhone(applicantAffiliateOpt.get().getPhone()); - request.setTemplateParamSet(new String[]{applicantAffiliateOpt.get().getName(), application.getCaseNum(), urlapplynew}); - // todo 发送短信先注释掉 -// cn.hutool.json.JSONObject resultObj = SmsUtils.sendSms(request); - // todo - cn.hutool.json.JSONObject resultObj = new cn.hutool.json.JSONObject(); - SmsSendRecord smsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), - applicantAffiliateOpt.get().getPhone(), new Date(), "尊敬的" + applicantAffiliateOpt.get().getName() + "用户,您的" + application.getCaseNum() + "调解案件,签名链接https://smlt.esign.cn/" + urlapplynew + ",请点击链接签名,如非本人操作,请忽略本短信", resultObj.get("sid") != null ? resultObj.get("sid").toString() : null); - // 新增短信记录 - if (resultObj.get("status") != null && !resultObj.get("status").equals(SMSStatusEnum.FAIL.getCode())) { - smsSendRecord.setSendStatus(SMSStatusEnum.SENDING.getCode()); - } else { - smsSendRecord.setSendStatus(SMSStatusEnum.FAIL.getCode()); - } - smsRecordMapper.saveSmsSendRecord(smsSendRecord); + //申请人发送签名链接短信,尊敬的{1}用户,您的{2}调解案件,签名链接{3},请点击链接签名,如非本人操作,请忽略本短信 + SmsUtils.sendSms(application,"2116857",applicantAffiliateOpt.get().getPhone(), + new String[]{applicantAffiliateOpt.get().getName(), application.getCaseNum(), urlapplynew}); SealSignRecord sealSignRecordRespon = new SealSignRecord(); sealSignRecordRespon.setSignFlowid(signFlowId); @@ -2792,23 +2756,8 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { JsonObject signUrlDataRespon = signUrlJsonObjectRespon.getAsJsonObject("data"); String urlRespon = signUrlDataRespon.get("shortUrl").getAsString(); String urlResponnew = urlRespon.substring(urlRespon.lastIndexOf("/") + 1); - - SmsUtils.SendSmsRequest request1 = new SmsUtils.SendSmsRequest(); - request1.setTemplateId("2116857"); - request1.setPhone(resAffiliateOpt.get().getPhone()); - request1.setTemplateParamSet(new String[]{resAffiliateOpt.get().getName(), application.getCaseNum(), urlResponnew}); - // todo 短信记录 - // cn.hutool.json.JSONObject resultObjRes = SmsUtils.sendSms(request1); - cn.hutool.json.JSONObject resultObjRes = new cn.hutool.json.JSONObject(); - - SmsSendRecord resSmsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), resAffiliateOpt.get().getPhone(), new Date(), "尊敬的" + resAffiliateOpt.get().getName() + "用户,您的" + application.getCaseNum() + "调解案件,签名链接https://smlt.esign.cn/" + urlResponnew + ",请点击链接签名,如非本人操作,请忽略本短信", resultObjRes.get("sid") != null ? resultObjRes.get("sid").toString() : null); - // 新增短信记录 - if (resultObjRes.get("status") != null && !resultObjRes.get("status").equals(SMSStatusEnum.FAIL.getCode())) { - resSmsSendRecord.setSendStatus(SMSStatusEnum.SENDING.getCode()); - } else { - resSmsSendRecord.setSendStatus(SMSStatusEnum.FAIL.getCode()); - } - smsRecordMapper.saveSmsSendRecord(resSmsSendRecord); + // 被申短信 + SmsUtils.sendSms(application,"2116857",resAffiliateOpt.get().getPhone(),new String[]{resAffiliateOpt.get().getName(), application.getCaseNum(), urlResponnew}); // 调解员账户 SealSignRecord sealSignRecordMedi = new SealSignRecord(); sealSignRecordMedi.setSignFlowid(signFlowId); @@ -2818,23 +2767,8 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { JsonObject signUrlDataResponMedi = signUrlJsonObjectResponMedi.getAsJsonObject("data"); String urlResponMedi = signUrlDataResponMedi.get("shortUrl").getAsString(); String urlResponnewMedi = urlResponMedi.substring(urlResponMedi.lastIndexOf("/") + 1); - - SmsUtils.SendSmsRequest requestMedi = new SmsUtils.SendSmsRequest(); - requestMedi.setTemplateId("2116857"); - requestMedi.setPhone(sealSignRecord.getPensonAccountMedi()); - requestMedi.setTemplateParamSet(new String[]{sealSignRecord.getPensonNameMedi(), application.getCaseNum(), urlResponnewMedi}); - // todo 短信注释 -// cn.hutool.json.JSONObject mediaResultObj = SmsUtils.sendSms(requestMedi); - cn.hutool.json.JSONObject mediaResultObj = new cn.hutool.json.JSONObject(); - - SmsSendRecord smsSendRecord1 = new SmsSendRecord(application.getId(), application.getCaseNum(), sealSignRecord.getPensonAccountMedi(), new Date(), "尊敬的" + sealSignRecord.getPensonNameMedi() + "用户,您的" + application.getCaseNum() + "调解案件,签名链接https://smlt.esign.cn/" + urlResponnewMedi + ",请点击链接签名,如非本人操作,请忽略本短信", mediaResultObj.get("sid") != null ? mediaResultObj.get("sid").toString() : null); - // 新增短信记录 - if (mediaResultObj.get("status") != null && !mediaResultObj.get("status").equals(SMSStatusEnum.FAIL.getCode())) { - smsSendRecord1.setSendStatus(SMSStatusEnum.SENDING.getCode()); - } else { - smsSendRecord1.setSendStatus(SMSStatusEnum.FAIL.getCode()); - } - smsRecordMapper.saveSmsSendRecord(smsSendRecord1); + // 调解员短信 + SmsUtils.sendSms(application,"2116857",sealSignRecord.getPensonAccountMedi(),new String[]{sealSignRecord.getPensonNameMedi(), application.getCaseNum(), urlResponnewMedi}); } else { throw new ServiceException(jsonObject3.getString("message")); @@ -2877,40 +2811,10 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { return AjaxResult.success(); } else if (mediaResult == 2) { - //未达成调解 - //todo 发送终止调解短信,尊敬的{1}用户,您的{2}调解案件已终止调解,如非本人操作,请忽略本短信 - // 申请人短信 - SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest(); - request.setTemplateId("2066725"); - request.setPhone(applicantAffiliateOpt.get().getPhone()); - request.setTemplateParamSet(new String[]{applicantAffiliateOpt.get().getName(), application.getCaseNum()}); - // todo 短信 -// cn.hutool.json.JSONObject jsonObject = SmsUtils.sendSms(request); - cn.hutool.json.JSONObject jsonObject = new cn.hutool.json.JSONObject(); - // 新增短信记录 - SmsSendRecord appSmsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), applicantAffiliateOpt.get().getPhone(), new Date(), "尊敬的" + applicantAffiliateOpt.get().getName() + "用户,您的" + application.getCaseNum() + "调解案件已终止调解,如非本人操作,请忽略本短信", jsonObject.get("sid") != null ? jsonObject.get("sid").toString() : null); - if (jsonObject.get("status") != null && !jsonObject.get("status").equals(SMSStatusEnum.FAIL.getCode())) { - appSmsSendRecord.setSendStatus(SMSStatusEnum.SENDING.getCode()); - } else { - appSmsSendRecord.setSendStatus(SMSStatusEnum.FAIL.getCode()); - } - smsRecordMapper.saveSmsSendRecord(appSmsSendRecord); + //未达成调解,申请人短信 发送终止调解短信,尊敬的{1}用户,您的{2}调解案件已终止调解,如非本人操作,请忽略本短信 + SmsUtils.sendSms(application,"2066725",applicantAffiliateOpt.get().getPhone(),new String[]{applicantAffiliateOpt.get().getName(), application.getCaseNum()}); // 被申请人短信 - SmsUtils.SendSmsRequest request1 = new SmsUtils.SendSmsRequest(); - request1.setTemplateId("2066725"); - request1.setPhone(resAffiliateOpt.get().getPhone()); - request1.setTemplateParamSet(new String[]{resAffiliateOpt.get().getName(), application.getCaseNum()}); -// todo 短信注释 -// cn.hutool.json.JSONObject resJsonObject = SmsUtils.sendSms(request1); - cn.hutool.json.JSONObject resJsonObject = new cn.hutool.json.JSONObject(); - // 新增短信记录 - SmsSendRecord resSmsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), resAffiliateOpt.get().getPhone(), new Date(), "尊敬的" + resAffiliateOpt.get().getName() + "用户,您的" + application.getCaseNum() + "调解案件已终止调解,如非本人操作,请忽略本短信", resJsonObject.get("sid") != null ? resJsonObject.get("sid").toString() : null); - if (resJsonObject.get("status") != null && !resJsonObject.get("status").equals(SMSStatusEnum.FAIL.getCode())) { - resSmsSendRecord.setSendStatus(SMSStatusEnum.SENDING.getCode()); - } else { - resSmsSendRecord.setSendStatus(SMSStatusEnum.FAIL.getCode()); - } - smsRecordMapper.saveSmsSendRecord(resSmsSendRecord); + SmsUtils.sendSms(application,"2066725",resAffiliateOpt.get().getPhone(),new String[]{resAffiliateOpt.get().getName(), application.getCaseNum()}); // 修改案件状态为结束 Example flowExample = new Example(MsCaseFlow.class); flowExample.createCriteria().andEqualTo("caseStatusName", "结束"); @@ -2918,7 +2822,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { if (caseFlow != null) { // 新增日志 CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), ""); - // todo 新增结束日志 + // 新增结束日志 CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), null); application.setCaseFlowId(caseFlow.getId()); application.setCaseStatusName(caseFlow.getCaseStatusName()); @@ -2927,8 +2831,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { } return AjaxResult.success(); } else if (mediaResult == 3) { - //未达成调解但不再争议 - // 修改案件状态为结束 + //未达成调解但不再争议,修改案件状态为结束 Example flowExample = new Example(MsCaseFlow.class); flowExample.createCriteria().andEqualTo("caseStatusName", "结束"); MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample); @@ -2939,7 +2842,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { msCaseApplicationMapper.updateByPrimaryKey(application); // 新增日志 CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), ""); - // todo 新增结束日志 + // 新增结束日志 CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), null); } return AjaxResult.success(); @@ -2973,7 +2876,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { if (caseFlow != null) { // 新增日志 CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), ""); - // todo 新增结束日志 + // 新增结束日志 CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), null); application.setCaseFlowId(caseFlow.getId()); application.setCaseStatusName(caseFlow.getCaseStatusName()); @@ -2988,10 +2891,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { if (caseAttachList != null && caseAttachList.size() > 0) { for (MsCaseAttach caseAttach : caseAttachList) { if (caseAttach.getAnnexType() == AnnexTypeEnum.MEDIATE_BOOK.getCode()) { - // String prefix = "/profile"; - // int startIndex = prefix.length(); String annexPath = caseAttach.getAnnexPath(); -// String path = "/home/ruoyi/uploadPath/" + annexPath.substring(startIndex+1); if (annexPath.contains("/profile/upload")) { annexPath = annexPath.replace("/profile/upload", "/home/ruoyi/uploadPath/upload"); } @@ -3035,7 +2935,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { sealSignRecord.setPensonAccountMedi(sysUser.getPhonenumber()); sealSignRecord.setPensonNameMedi(sysUser.getNickName()); } - // todo 申请人账户 + // 申请人账户 sealSignRecord.setPensonAccount(applicantAffiliateOpt.get().getPhone()); sealSignRecord.setPensonName(applicantAffiliateOpt.get().getName()); // 被申账户 @@ -3107,23 +3007,8 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { String urlapply = signUrlData.get("shortUrl").getAsString(); String urlapplynew = urlapply.substring(urlapply.lastIndexOf("/") + 1); - //发送签名链接短信,尊敬的{1}用户,您的{2}调解案件,签名链接{3},请点击链接签名,如非本人操作,请忽略本短信 - // 申请人短信 - SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest(); - request.setTemplateId("2047719"); - request.setPhone(applicantAffiliateOpt.get().getPhone()); - request.setTemplateParamSet(new String[]{applicantAffiliateOpt.get().getName(), application.getCaseNum(), urlapplynew}); - // todo 短信 -// cn.hutool.json.JSONObject smsObj = SmsUtils.sendSms(request); - cn.hutool.json.JSONObject smsObj = new cn.hutool.json.JSONObject(); - SmsSendRecord smsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), applicantAffiliateOpt.get().getPhone(), new Date(), "尊敬的" + applicantAffiliateOpt.get().getName() + "用户,您的" + application.getCaseNum() + "调解案件,签名链接https://smlt.esign.cn/" + urlapplynew + ",请点击链接签名,如非本人操作,请忽略本短信", smsObj.get("sid") != null ? smsObj.get("sid").toString() : null); - // 新增短信记录 - if (smsObj.get("status") != null && !smsObj.get("status").equals(SMSStatusEnum.FAIL.getCode())) { - smsSendRecord.setSendStatus(SMSStatusEnum.SENDING.getCode()); - } else { - smsSendRecord.setSendStatus(SMSStatusEnum.FAIL.getCode()); - } - smsRecordMapper.saveSmsSendRecord(smsSendRecord); + //申请人短信 发送签名链接短信,尊敬的{1}用户,您的{2}调解案件,签名链接{3},请点击链接签名,如非本人操作,请忽略本短信 + SmsUtils.sendSms(application, "2047719",applicantAffiliateOpt.get().getPhone(), new String[]{applicantAffiliateOpt.get().getName(), application.getCaseNum(), urlapplynew}); // 被申签名记录 SealSignRecord sealSignRecordRespon = new SealSignRecord(); sealSignRecordRespon.setSignFlowid(signFlowId); @@ -3133,23 +3018,8 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { JsonObject signUrlDataRespon = signUrlJsonObjectRespon.getAsJsonObject("data"); String urlRespon = signUrlDataRespon.get("shortUrl").getAsString(); String urlResponnew = urlRespon.substring(urlRespon.lastIndexOf("/") + 1); - - SmsUtils.SendSmsRequest request1 = new SmsUtils.SendSmsRequest(); - request1.setTemplateId("2047719"); - request1.setPhone(resAffiliateOpt.get().getPhone()); - request1.setTemplateParamSet(new String[]{resAffiliateOpt.get().getName(), application.getCaseNum(), urlResponnew}); - // todo 短信 -// cn.hutool.json.JSONObject resObj = SmsUtils.sendSms(request1); - cn.hutool.json.JSONObject resObj = new cn.hutool.json.JSONObject(); - - SmsSendRecord resSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), resAffiliateOpt.get().getPhone(), new Date(), "尊敬的" + resAffiliateOpt.get().getName() + "用户,您的" + application.getCaseNum() + "调解案件,签名链接https://smlt.esign.cn/" + urlResponnew + ",请点击链接签名,如非本人操作,请忽略本短信", resObj.get("sid") != null ? resObj.get("sid").toString() : null); - // 新增短信记录 - if (resObj.get("status") != null && !resObj.get("status").equals(SMSStatusEnum.FAIL.getCode())) { - resSendRecord.setSendStatus(SMSStatusEnum.SENDING.getCode()); - } else { - resSendRecord.setSendStatus(SMSStatusEnum.FAIL.getCode()); - } - smsRecordMapper.saveSmsSendRecord(resSendRecord); + // 被申 短信 + SmsUtils.sendSms(application, "2047719",resAffiliateOpt.get().getPhone(), new String[]{resAffiliateOpt.get().getName(), application.getCaseNum(), urlResponnew}); } else { throw new ServiceException(jsonObject3.getString("message")); @@ -3194,7 +3064,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { if (StrUtil.isEmpty(application.getCaseSource())) { List existAttach = msCaseAttachMapper.listCaseAttachByCaseIdAndType(req.getId(), AnnexTypeEnum.MEDIATE_BOOK.getCode()); if (CollectionUtil.isNotEmpty(existAttach)) { - // todo 对接北明,同步案件状态,删除 + // 对接北明,同步案件状态,删除 for (MsCaseAttach msCaseAttach : existAttach) { if (StrUtil.isEmpty(msCaseAttach.getOtherSysFileId()) || StrUtil.isEmpty(msCaseAttach.getAnnexPath())) { continue; @@ -3208,7 +3078,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { attach.setCaseAppliId(req.getId()); msCaseAttachMapper.updateCaseAttach(attach); } - // todo 对接北明,调用上传附件接口 + // 对接北明,调用上传附件接口 List msCaseAttaches = msCaseAttachMapper.listCaseAttachByCaseIdAndType(req.getId(), AnnexTypeEnum.MEDIATE_BOOK.getCode()); if (StrUtil.isEmpty(application.getCaseSource()) && CollectionUtil.isNotEmpty(msCaseAttaches)) { for (MsCaseAttach msCaseAttach : msCaseAttaches) { @@ -3265,7 +3135,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), ""); if (mediaResult == 2 || mediaResult == 3 || mediaResult == 4) { CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), null); - // todo 结束对接北明,为调解失败状态 + // 结束对接北明,为调解失败状态 caseApplicationService.pushStatusToBM(application, PushCaseStatusEnum.FAIL); } } @@ -3305,7 +3175,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { req.setTemplateType(TemplateTypeEnum.MEDIATION_AGREEMENT.getCode()); } - AjaxResult result = caseApplicationService.generateApplication(req); + AjaxResult result = caseApplicationService.generateApplication1(req); // 修改案件结果 application.setMediaResult(req.getMediaResult()); msCaseApplicationMapper.updateByPrimaryKeySelective(application); @@ -3511,6 +3381,279 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { msCaseAttachMapper.save(caseAttach); } + } + @Transactional + public void createMediateApplication1(MsCaseApplication application, List affiliates, String templatePath, List bookmarkList, List dictDataList,Integer templateType) { + // 申请书需要的字段和内容,valueMap<占位符,替换的值> + Map valueMap = new HashMap<>(); + for (SysDictData dictData : dictDataList) { + if (CASE_BASE_COLUMN.contains(dictData.getDictValue())) { + valueMap.put(dictData.getDictLabel(), ObjectFieldUtils.getValue(application, dictData.getDictValue())); + } + } + // 按组分类 + Map> affliateMap = affiliates.stream().collect(Collectors.groupingBy(MsCaseAffiliate::getGroupOrder, Collectors.toList())); + // 申请人 + List applicantList = new ArrayList<>(); + // 被申 + List resList = new ArrayList<>(); + // 多个申请人拼接 + StringBuilder applicantName = new StringBuilder(); + affliateMap.forEach((k,v)->{ + MsCaseAffiliateBase affiliateBase = null; + MsCaseAffiliateBase resBase = null; + + for (MsCaseAffiliate affiliate : v) { + + switch (affiliate.getRoleType()){ + case 1: + if(affiliateBase==null){ + affiliateBase = new MsCaseAffiliateBase(); + } + affiliateBase.setApplicant(affiliate); + applicantName.append(affiliate.getName()).append(Constants.CN_SPLIT_COMMA); + break; + case 2: + if(affiliateBase==null){ + affiliateBase = new MsCaseAffiliateBase(); + } + affiliateBase.setApplicantAgent(affiliate); + break; + case 3: + if(resBase==null){ + resBase = new MsCaseAffiliateBase(); + } + resBase.setRes(affiliate); + break; + case 4: + if(resBase==null){ + resBase = new MsCaseAffiliateBase(); + } + resBase.setResAgent(affiliate); + break; + default: + + break; + } + + } + if(affiliateBase!=null){ + applicantList.add(affiliateBase); + } + if(resBase!=null){ + resList.add(resBase); + } + }); + // 设置基本字段 + String[] personBase={"申请人","被申请人"}; + for (String person : personBase) { + StringBuilder value = valueMap.get(person)==null?new StringBuilder():new StringBuilder(valueMap.get(person)); + if(person.equals("申请人")) { + for (MsCaseAffiliateBase affiliateBase : applicantList) { + MsCaseAffiliate applicant = affiliateBase.getApplicant(); + MsCaseAffiliate applicantAgent = affiliateBase.getApplicantAgent(); + if (applicant != null) { + // 申请人 + if(applicant.getOrganizeFlag()==0){ + + value.append("申请人:").append(applicant.getName()).append("\n"); + // 自然人 + if(StrUtil.isNotEmpty(applicant.getIdCard())){ + value.append("证件号码:").append(applicant.getIdCard()).append("\n"); + } + if(StrUtil.isNotEmpty(applicant.getPhone())){ + value.append("申请人电话:").append(applicant.getPhone()).append("\n"); + } + if(StrUtil.isNotEmpty(applicant.getEmail())){ + value.append("申请人邮箱:").append(applicant.getEmail()).append("\n"); + } + + }else { + // 机构 + value.append("申请人:").append(applicant.getApplicantOrgName()).append("\n"); + if (StrUtil.isNotEmpty(applicant.getCode())) { + value.append("统一社会信用代码:").append(applicant.getCode()).append("\n"); + } + if (StrUtil.isNotEmpty(applicant.getCompLegalPerson())) { + value.append("法定代表人:").append(applicant.getCompLegalPerson()).append("\n"); + } + + } + if (StrUtil.isNotEmpty(applicant.getHome())) { + value.append("申请人住所:").append(applicant.getHome()).append("\n"); + } + if (StrUtil.isNotEmpty(applicant.getAddress())) { + value.append("申请人联系地址:").append(applicant.getAddress()).append("\n"); + } + + } + if (applicantAgent != null ) { + // 代理人 + value.append("委托代理人:").append(applicantAgent.getName()).append("\n"); + if (StrUtil.isNotEmpty(applicantAgent.getPhone())) { + value.append("联系电话:").append(applicantAgent.getPhone()).append("\n"); + } + if (StrUtil.isNotEmpty(applicantAgent.getEmail())) { + value.append("邮箱:").append(applicantAgent.getEmail()).append("\n"); + } + } + } + valueMap.put(person,value.toString()); + }else { + // 被申请人 + for (MsCaseAffiliateBase affiliateBase : resList) { + MsCaseAffiliate res = affiliateBase.getRes(); + MsCaseAffiliate resAgent = affiliateBase.getResAgent(); + if (res != null ) { + // 被申请人 + if(res.getOrganizeFlag()==0){ + value.append("被申请人:").append(res.getName()).append("\n"); + // 自然人 + if(StrUtil.isNotEmpty(res.getIdCard())){ + value.append("证件号码:").append(res.getIdCard()).append("\n"); + } + if(StrUtil.isNotEmpty(res.getPhone())){ + value.append("被申请人电话:").append(res.getPhone()).append("\n"); + } + if(StrUtil.isNotEmpty(res.getEmail())){ + value.append("被申请人邮箱:").append(res.getEmail()).append("\n"); + } + + if(res.getBirth()!=null){ + value.append("被申请人出生年月:").append(sdf.format(res.getBirth())).append("\n"); + } + if(StrUtil.isNotEmpty(res.getSex())){ + value.append("被申请人性别:").append(res.getSex().equals("0")?"男":"女").append("\n"); + } + }else { + // 机构 + value.append("被申请人:").append(res.getApplicantOrgName()).append("\n"); + if (StrUtil.isNotEmpty(res.getCode())) { + value.append("统一社会信用代码:").append(res.getCode()).append("\n"); + } + if (StrUtil.isNotEmpty(res.getCompLegalPerson())) { + value.append("法定代表人:").append(res.getCompLegalPerson()).append("\n"); + } + + } + if(StrUtil.isNotEmpty(res.getHome())){ + value.append("被申请人住所:").append(res.getHome()).append("\n"); + } + if(StrUtil.isNotEmpty(res.getAddress())){ + value.append("被申请人联系地址:").append(res.getAddress()).append("\n"); + } + + } + if (resAgent != null && resAgent.getRoleType()!=null) { + // 代理人 + value.append("委托代理人:").append(resAgent.getName()).append("\n"); + if (StrUtil.isNotEmpty(resAgent.getPhone())) { + value.append("联系电话:").append(resAgent.getPhone()).append("\n"); + } + if (StrUtil.isNotEmpty(resAgent.getEmail())) { + value.append("邮箱:").append(resAgent.getEmail()).append("\n"); + } + } + } + valueMap.put(person,value.toString()); + } + + } + + valueMap.put("申请人签字",removeLastComma(applicantName.toString(),Constants.CN_SPLIT_COMMA)); + + // 书签对应值 + Map bookmarkValueMap = new HashMap<>(); + // 读取调节申请书,找到占位符,替换值 + // 遍历书签,给书签赋值 + replaceBookmark(bookmarkList, bookmarkValueMap, valueMap); + // 申请书生成时间 + LocalDate now = LocalDate.now(); + int year = now.getYear(); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy年MM月dd日"); + // 格式化当前日期 + String formattedDate = now.format(formatter); + bookmarkValueMap.put("日期", formattedDate); + + String month = String.format("%02d", now.getMonthValue()); + String day = String.format("%02d", now.getDayOfMonth()); + String saveFolderPath = RuoYiConfig.getUploadPath()+"/"+ year + "/" + month + "/" + day; + Integer annexType = null; + if(templateType==null + || templateType.equals(TemplateTypeEnum.MEDIATION_APPLICATION.getCode()) + || templateType.equals(TemplateTypeEnum.PERSON_MEDIATION_APPLICATION.getCode()) ){ + // 调解申请书 + annexType = AnnexTypeEnum.MEDIATION_APPLICATION.getCode(); + }else if(templateType.equals(TemplateTypeEnum.MEDIATION_AGREEMENT.getCode()) + || templateType.equals(TemplateTypeEnum.MEDIATE_BOOK.getCode()) ){ + // 调解书和解协议 + annexType = AnnexTypeEnum.MEDIATE_BOOK.getCode(); + } + + String orgFileName = "调解申请书"; + if (annexType != null && annexType.equals(AnnexTypeEnum.MEDIATE_BOOK.getCode())) { + orgFileName = "调解书"; + } + String fileName = UUID.randomUUID().toString().replace("-", "")+orgFileName + ".docx"; + String resultFilePath = saveFolderPath + "/" + fileName; + // 将word中的标签替换掉,生成新的word + wordChangeText(templatePath, bookmarkValueMap,saveFolderPath,resultFilePath); + + MsCaseAttach caseAttach = null; + String annexPath=resultFilePath.replace(RuoYiConfig.getProfile(),Constants.RESOURCE_PREFIX); + // 如果是调解书或者调解协议上传到onlyoffice服务器 + if(annexType != null && annexType.equals(AnnexTypeEnum.MEDIATE_BOOK.getCode())){ + JSONArray jsonArray = caseApplicationService.uploadOnlyOffice(annexPath,application.getId()); + if(jsonArray!=null && jsonArray.size() > 0){ + for (Object obj : jsonArray) { + JSONObject jsonObject = (JSONObject) obj; + caseAttach= MsCaseAttach.builder() + .caseAppliId(application.getId()) + .annexName(jsonObject.getString("fileName")) + .annexPath(jsonObject.getString("filePath")) + .annexType(annexType) + .onlyOfficeFileId(jsonObject.getString("fileId")) + .build(); + + } + //保存到附件表里,先删除之前的在保存 + msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(caseAttach.getCaseAppliId(), annexType); + msCaseAttachMapper.save(caseAttach); + } + + }else { + caseAttach = MsCaseAttach.builder() + .caseAppliId(application.getId()) + .annexName(orgFileName+".docx") + .annexPath(resultFilePath.replace(RuoYiConfig.getProfile(),Constants.RESOURCE_PREFIX)) + .annexType(annexType) + .build(); + // 查找已经存在的附件 + List existAttach = msCaseAttachMapper.listCaseAttachByCaseIdAndType(application.getId(), annexType); + if(CollectionUtil.isNotEmpty(existAttach)){ + // 对接北明,同步案件状态,删除 + for (MsCaseAttach msCaseAttach : existAttach) { + if(StrUtil.isEmpty(msCaseAttach.getOtherSysFileId())||StrUtil.isEmpty(msCaseAttach.getAnnexPath())){ + continue; + } + beiMingInterfaceService.deleteAttachmentInfo(application.getCaseNum(), msCaseAttach.getOtherSysFileId(), FileUtil.getName(msCaseAttach.getAnnexPath())); + } + } + msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(caseAttach.getCaseAppliId(), annexType); + if(StrUtil.isEmpty(application.getCaseSource())) { + // 北明推送 + String path = "/home/ruoyi" + caseAttach.getAnnexPath(); + File file = new File(path.replace("/profile", "/uploadPath")); + MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, application.getCaseNum(), AttachmentOperateTypeEnum.ADD, DocumentTypeEnum.EVEDENT_APPLY_BOOK); + + // 更新附件表 + if (caseFileInfo != null && StrUtil.isNotEmpty(caseFileInfo.getFileId())) { + caseAttach.setOtherSysFileId(caseFileInfo.getFileId()); + } + } + msCaseAttachMapper.save(caseAttach); + } + } /** @@ -3759,106 +3902,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { } } - /** - * 新增申请机构代理人 - * - * @param affiliate - */ - @Transactional - public void insertAgentUser(MsCaseAffiliate affiliate) { -// // 查询申请人角色id -// Long roleId = roleMapper.selectRoleIdByName("申请人"); -// // 根据代理人邮箱去用户表查询,有修改,么有新增 -// SysUser agentUser = userMapper.selectUserByEmail(affiliate.getEmail()); -// // 代理人为空,新增代理人 -// if (agentUser == null) { -// agentUser = new SysUser(); -// agentUser.setUserName(affiliate.getEmail()); -// agentUser.setNickName(affiliate.getName()); -// agentUser.setPhonenumber(affiliate.getPhone()); -// agentUser.setPassword(SecurityUtils.encryptPassword("abc123456")); -// agentUser.setNationality(affiliate.getNationality()); -// agentUser.setIdType(affiliate.getIdType()); -// agentUser.setIdCard(affiliate.getIdCard()); -// agentUser.setSex(affiliate.getSex()); -// agentUser.setHome(affiliate.getHome()); -// agentUser.setAddress(affiliate.getAddress()); -// // agentUser.setDeptId(Long.valueOf(affiliate.getApplicationId())); -// userMapper.insertUser(agentUser); -// userRoleMapper.insertUserRole(agentUser.getUserId(), roleId); -// // 新增部门用户关联表 -// SysUserDept sysUserDept = new SysUserDept(); -// sysUserDept.setUserId(agentUser.getUserId()); -// sysUserDept.setDeptId(Long.valueOf(affiliate.getApplicantDeptId())); -// userDeptMapper.insert(sysUserDept); -// // todo 发送短信 2064355 调解系统自动创建用户短信通知 尊敬的用户,您的案件已经创建,请使用账号为{1},密码为{2}登录调解系统,请知晓,如非本人操作,请忽略本短信。 -// // Boolean smsFlag = SmsUtils.sendSms(affiliate.getCaseAppliId(), "2064355", affiliate.getContactTelphoneAgent(), new String[]{affiliate.getContactTelphoneAgent(), "abc123456"}); -// } else { -// // 查询所有部门 -// List sysDepts = sysDeptMapper.selectDeptList(new SysDept()); -// Map> deptMap=new HashMap<>(); -// if(CollectionUtil.isNotEmpty(sysDepts)){ -// deptMap = sysDepts.stream().collect(Collectors.groupingBy(SysDept::getDeptName)); -// } -// -// if(!deptMap.containsKey(affiliate.getName())){ -// // 如果不存在则新增 -// SysDept dept = new SysDept(); -// dept.setParentId(0L); -// dept.setDeptName(affiliate.getName()); -// dept.setAncestors("0"); -// dept.setOrderNum(1); -// dept.setStatus("0"); -// dept.setDelFlag("0"); -// dept.setCreateBy(getUsername()); -// dept.setUpdateBy(getUsername()); -// sysDeptMapper.insertDept(dept); -// List depts = new ArrayList<>(); -// depts.add(dept); -// deptMap.put(dept.getDeptName(), depts); -// affiliate.setApplicantDeptId(dept.getDeptId()); -// }else { -// // 将组织机构id设为申请人名称 -// affiliate.setApplicantDeptId(deptMap.get(affiliate.getName()).get(0).getDeptId()); -// -// } -// // 根据userId查询部门 -// List userDeptList = userDeptMapper.selectUserDeptById(agentUser.getUserId()); -// if(CollectionUtil.isEmpty(userDeptList)){ -// // 未关联部门,关联部门,新增部门用户关联表 -// SysUserDept sysUserDept = new SysUserDept(); -// sysUserDept.setUserId(agentUser.getUserId()); -// sysUserDept.setDeptId(affiliate.getApplicantDeptId()); -// userDeptMapper.insert(sysUserDept); -// }else { -// List deptIdList = userDeptList.stream().map(SysUserDept::getDeptId).collect(Collectors.toList()); -// if(!deptIdList.contains(affiliate.getApplicantDeptId())){ -// // 未关联该部门,关联部门,新增部门用户关联表 -// SysUserDept sysUserDept = new SysUserDept(); -// sysUserDept.setUserId(agentUser.getUserId()); -// sysUserDept.setDeptId(Long.valueOf(affiliate.getApplicationId())); -// userDeptMapper.insert(sysUserDept); -// // 同步用户表和案件关联人表的手机号和名称 -// affiliate.setContactTelphoneAgent(StrUtil.isNotEmpty(agentUser.getPhonenumber()) ? agentUser.getPhonenumber() : affiliate.getContactTelphoneAgent()); -// affiliate.setNameAgent(agentUser.getNickName()); -// affiliate.setAgentEmail(StrUtil.isNotEmpty(agentUser.getEmail()) ? agentUser.getEmail() : affiliate.getAgentEmail()); -// List longList = new ArrayList<>(); -// // 新增角色为申请人 -// if (CollectionUtil.isNotEmpty(agentUser.getRoles())) { -// longList = agentUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList()); -// if (!longList.contains(roleId)) { -// // 删除之前关联的角色 -// userRoleMapper.deleteUserRoleByUserId(agentUser.getUserId()); -// userRoleMapper.insertUserRole(agentUser.getUserId(), roleId); -// } -// } else { -// userRoleMapper.insertUserRole(agentUser.getUserId(), roleId); -// } -// -// } -// } -// } - } + /** @@ -3869,8 +3913,6 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { * @return */ private String getCaseNum() { - // todo 查询编码规则 - // 自动编码格式 zc+yyyyMMdd+001 String currentDay = DateUtils.dateTime(); String caseNum = "zc" + currentDay; diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCasePaymentServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCasePaymentServiceImpl.java index 018dac9..4574587 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCasePaymentServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCasePaymentServiceImpl.java @@ -11,7 +11,6 @@ import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.enums.AnnexTypeEnum; import com.ruoyi.common.enums.PaymentStatusEnum; -import com.ruoyi.common.enums.SMSStatusEnum; import com.ruoyi.common.enums.YesOrNoEnum; import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.utils.SecurityUtils; @@ -20,9 +19,10 @@ import com.ruoyi.dto.PayRequest; import com.ruoyi.dto.PayResponse; import com.ruoyi.system.domain.entity.flow.MsCaseFlow; import com.ruoyi.system.mapper.flow.MsCaseFlowMapper; +import com.ruoyi.system.mapper.sms.MsSmsSendRecordParamMapper; +import com.ruoyi.system.mapper.sms.MsSmsTemplateMapper; import com.ruoyi.wisdomarbitrate.domain.dto.mscase.CaseConfirmPayDTO; import com.ruoyi.wisdomarbitrate.domain.dto.mscase.CasePayDTO; -import com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SmsSendRecord; import com.ruoyi.wisdomarbitrate.domain.entity.mscase.*; import com.ruoyi.wisdomarbitrate.domain.vo.mscase.PaymentDetailVO; import com.ruoyi.wisdomarbitrate.mapper.mscase.*; @@ -30,6 +30,7 @@ import com.ruoyi.wisdomarbitrate.mapper.sendrecord.SmsRecordMapper; import com.ruoyi.wisdomarbitrate.service.mscase.MsCaseApplicationService; import com.ruoyi.wisdomarbitrate.service.mscase.MsCasePaymentService; import com.ruoyi.wisdomarbitrate.utils.CaseLogUtils; +import com.ruoyi.wisdomarbitrate.utils.SmsUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -67,6 +68,10 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService { private RedisCache redisCache; @Autowired private MsCaseAuditMapper auditMapper; + @Autowired + MsSmsTemplateMapper templateMapper; + @Autowired + MsSmsSendRecordParamMapper recordParamMapper; @Override @@ -228,7 +233,6 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService { } JSONObject jsonObject = new JSONObject(); jsonObject.set("totalFee", totalFee); - // jsonObject.set("applicationOrganName", affiliate.getApplicationName()); return AjaxResult.success(jsonObject); } @@ -342,7 +346,6 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService { caseApplicationMapper.updateByPrimaryKeySelective(application); if (dto.getApplicantConfirm() && dto.getYesOrNo().equals(YesOrNoEnum.YES.getCode())) { // 申请人确认缴费后将该案件存放到redis,5日之内如果案件状态还是待受理状态,则发送不受理通知书并自动结束 -// redisCache.setCacheObject(CacheConstants.CASE_KEY+application.getId(), application, Constants.CASE_ACCEPT_EXPIRATION, TimeUnit.DAYS); SpringUtils.getBean(RedisCache.class).setCacheObject(getVerifyCodeCacheKey(String.valueOf(application.getId())), application, Constants.CASE_ACCEPT_EXPIRATION, TimeUnit.DAYS); } @@ -377,68 +380,50 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService { throw new ServiceException("未找到案件操作人员"); } if(dto.getApplicantConfirm()) { + List appPhones=new ArrayList<>(); + // 申请人确认缴费 for (MsCaseAffiliate affiliate : operatorList) { // 发送缴费通知 if (affiliate.getRoleType() == null) { continue; } - if (affiliate.getRoleType().equals(1) || affiliate.getRoleType().equals(2)) { - JSONObject jsonObject = new JSONObject(); - SmsSendRecord smsSendRecord = null; + if (!appPhones.contains(affiliate.getPhone())&&(affiliate.getRoleType().equals(1) || affiliate.getRoleType().equals(2))) { + appPhones.add(affiliate.getPhone()); if (dto.getYesOrNo().equals(YesOrNoEnum.YES.getCode())) { + // 缴费通过 - // todo 短信 -// jsonObject = SmsUtils.sendSms(affiliate.getCaseAppliId(), "2051914", affiliate.getPhone(), new String[]{affiliate.getName()}); - smsSendRecord = new SmsSendRecord(caseAppllication.getId(), caseAppllication.getCaseNum(), affiliate.getPhone(), new Date(), "尊敬的" + affiliate.getName() + ",您的调解申请费用已缴费成功。",jsonObject.get("sid")!=null?jsonObject.get("sid").toString():null); + SmsUtils.sendSms(caseAppllication, "2051914", affiliate.getPhone(), new String[]{affiliate.getName()}); } else { - // todo 短信 -// jsonObject = SmsUtils.sendSms(affiliate.getCaseAppliId(), "2074402", affiliate.getPhone(), new String[]{affiliate.getName(), caseAppllication.getCaseNum(), dto.getReason()}); // 2074402 调解系统确认缴费不通过通知 尊敬的{1}用户,您的{2}案件,确认缴费未通过,理由为{3},请知晓,如非本人操作,请忽略本短信 - smsSendRecord = new SmsSendRecord(caseAppllication.getId(), caseAppllication.getCaseNum(), affiliate.getPhone(), new Date(), "尊敬的" + affiliate.getName() + "用户,您的" + caseAppllication.getCaseNum() + "案件,确认缴费未通过,理由为" + dto.getReason() + ",请知晓,如非本人操作,请忽略本短信",jsonObject.get("sid")!=null?jsonObject.get("sid").toString():null); + SmsUtils.sendSms(caseAppllication, "2074402", affiliate.getPhone(), new String[]{affiliate.getName(), caseAppllication.getCaseNum(), dto.getReason()}); } - // 新增短信记录 - if (jsonObject.get("ststus")!=null && !jsonObject.get("ststus").equals(SMSStatusEnum.FAIL)) { - smsSendRecord.setSendStatus(SMSStatusEnum.SENDING.getCode()); - } else { - smsSendRecord.setSendStatus(SMSStatusEnum.FAIL.getCode()); - } - smsRecordMapper.saveSmsSendRecord(smsSendRecord); } } }else { + List resPhones=new ArrayList<>(); + List resAcceptPhones=new ArrayList<>(); // 被申请人确认缴费 for (MsCaseAffiliate affiliate : operatorList) { // 发送缴费通知 if (affiliate.getRoleType() == null) { continue; } - if (affiliate.getRoleType().equals(3) || affiliate.getRoleType().equals(4)) { - JSONObject jsonObject = new JSONObject(); - SmsSendRecord smsSendRecord = null; + if (!resPhones.contains(affiliate.getPhone())&&(affiliate.getRoleType().equals(3) || affiliate.getRoleType().equals(4)) ) { + resPhones.add(affiliate.getPhone()); if (dto.getYesOrNo().equals(YesOrNoEnum.YES.getCode())) { - // todo 短信 // 缴费通过 -// jsonObject = SmsUtils.sendSms(affiliate.getCaseAppliId(), "2051914", affiliate.getPhone(), new String[]{affiliate.getName()}); - smsSendRecord = new SmsSendRecord(caseAppllication.getId(), caseAppllication.getCaseNum(), affiliate.getPhone(), new Date(), "尊敬的" + affiliate.getName() + ",您的调解申请费用已缴费成功。",jsonObject.get("sid")!=null?jsonObject.get("sid").toString():null); + SmsUtils.sendSms(caseAppllication, "2051914", affiliate.getPhone(), new String[]{affiliate.getName()}); } else { - // todo 短信 -// jsonObject = SmsUtils.sendSms(affiliate.getCaseAppliId(), "2074402", affiliate.getPhone(), new String[]{affiliate.getName(), caseAppllication.getCaseNum(), dto.getReason()}); // 2074402 调解系统确认缴费不通过通知 尊敬的{1}用户,您的{2}案件,确认缴费未通过,理由为{3},请知晓,如非本人操作,请忽略本短信 - smsSendRecord = new SmsSendRecord(caseAppllication.getId(), caseAppllication.getCaseNum(), affiliate.getPhone(), new Date(), "尊敬的" + affiliate.getName() + "用户,您的" + caseAppllication.getCaseNum() + "案件,确认缴费未通过,理由为" + dto.getReason() + ",请知晓,如非本人操作,请忽略本短信",jsonObject.get("sid")!=null?jsonObject.get("sid").toString():null); + SmsUtils.sendSms(caseAppllication, "2074402", affiliate.getPhone(), new String[]{affiliate.getName(), caseAppllication.getCaseNum(), dto.getReason()}); } - // 新增短信记录 - if (jsonObject.get("status")!=null && !jsonObject.get("status").equals(SMSStatusEnum.FAIL)) { - smsSendRecord.setSendStatus(SMSStatusEnum.SENDING.getCode()); - } else { - smsSendRecord.setSendStatus(SMSStatusEnum.FAIL.getCode()); - } - smsRecordMapper.saveSmsSendRecord(smsSendRecord); } // 被申请人确认缴费,发送受理通知 - if( dto.getYesOrNo().equals(YesOrNoEnum.YES.getCode())) { - // 申请人发送受理短信 - casePaymentService.sendAcceptSms(dto, caseAppllication, affiliate.getName(), affiliate.getPhone()); + if( dto.getYesOrNo().equals(YesOrNoEnum.YES.getCode()) && !resAcceptPhones.contains(affiliate.getPhone())) { + resAcceptPhones.add(affiliate.getPhone()); + // 申请人被申请人发送受理通知书 2073601 尊敬的{1}用户,您的{2}案件,已成功受理,请知晓,如非本人操作,请忽略本短信。 + SmsUtils.sendSms(caseAppllication, "2073601", affiliate.getPhone(), new String[]{affiliate.getName(), caseAppllication.getCaseNum()}); } } @@ -465,28 +450,7 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService { - /** - * 发送受理短信 - * @param dto - * @param caseAppllication - */ - @Transactional - public void sendAcceptSms(CaseConfirmPayDTO dto, MsCaseApplication caseAppllication,String userName,String phone ) { - // 申请人被申请人发送受理通知书 2073601 尊敬的{1}用户,您的{2}案件,已成功受理,请知晓,如非本人操作,请忽略本短信。 - // todo 短信 -// JSONObject jsonObject = SmsUtils.sendSms(caseAppllication.getId(), "2073601", phone, new String[]{userName, caseAppllication.getCaseNum()}); - JSONObject jsonObject = new JSONObject(); - SmsSendRecord smsSendRecord = new SmsSendRecord(caseAppllication.getId(), caseAppllication.getCaseNum(), phone, new Date(), "尊敬的" + userName + "用户,您的" + caseAppllication.getCaseNum() + "案件,已成功受理,请知晓,如非本人操作,请忽略本短信。",jsonObject.get("sid")!=null?jsonObject.get("sid").toString():null); - // 新增短信记录 - if (jsonObject.get("status")!=null && !jsonObject.get("status").equals(SMSStatusEnum.FAIL)) { - smsSendRecord.setSendStatus(SMSStatusEnum.SENDING.getCode()); - } else { - smsSendRecord.setSendStatus(SMSStatusEnum.FAIL.getCode()); - } - smsRecordMapper.saveSmsSendRecord(smsSendRecord); - - } /** * 确认缴费 @@ -500,8 +464,6 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService { application.setPayType(dto.getPayType()); // 修改缴费附件 if (CollectionUtil.isNotEmpty(dto.getPayOrderList())) { - - for (MsCaseAttach caseAttach : dto.getPayOrderList()) { // 先删除之前的缴费 if(currentFlow.getButtonAuthFlag().equals("caseManagement:list:pay")){ diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsSignSealServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsSignSealServiceImpl.java index ef9eb6a..68e55aa 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsSignSealServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsSignSealServiceImpl.java @@ -23,10 +23,11 @@ import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.file.SaaSAPIFileUtils; import com.ruoyi.system.domain.entity.flow.MsCaseFlow; +import com.ruoyi.system.domain.entity.shortmessage.MsSendMailHistoryRecord; import com.ruoyi.system.domain.vo.flow.MsCaseFlowVO; -import com.ruoyi.system.mapper.SysRoleMapper; import com.ruoyi.system.mapper.SysUserMapper; import com.ruoyi.system.mapper.flow.MsCaseFlowMapper; +import com.ruoyi.system.mapper.shortmessage.MsSendMailHistoryRecordMapper; import com.ruoyi.system.service.impl.BeiMingInterfaceService; import com.ruoyi.wisdomarbitrate.domain.dto.dept.DeptIdentify; import com.ruoyi.wisdomarbitrate.domain.dto.dept.SealManage; @@ -54,6 +55,7 @@ import com.ruoyi.wisdomarbitrate.service.mscase.MsCaseApplicationService; import com.ruoyi.wisdomarbitrate.service.mscase.MsSignSealService; import com.ruoyi.wisdomarbitrate.utils.CaseLogUtils; import com.ruoyi.wisdomarbitrate.utils.SignAward; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; @@ -108,8 +110,8 @@ public class MsSignSealServiceImpl implements MsSignSealService { @Autowired private SendMailRecordMapper sendMailRecordMapper; - @Autowired - private SysRoleMapper roleMapper; + @Value("${spring.mail.username}") + private String emailFrom; // 北明配置 @Value("${BMConfig.userName}") private String BMUserName; @@ -119,6 +121,8 @@ public class MsSignSealServiceImpl implements MsSignSealService { private String BMSyncSource; @Autowired BeiMingInterfaceService beiMingInterfaceService; + @Autowired + private MsSendMailHistoryRecordMapper sendMailHistoryRecordMapper; @@ -346,7 +350,6 @@ public class MsSignSealServiceImpl implements MsSignSealService { String annexPath = caseAttach.getAnnexPath(); String path = "/home/ruoyi/uploadPath/" + annexPath.substring(startIndex+1); File file = new File(path); - // todo 部署放开 if (!file.exists()) { Gson gson = new Gson(); MsSealSignRecord sealSignRecord = new MsSealSignRecord(); @@ -433,30 +436,8 @@ public class MsSignSealServiceImpl implements MsSignSealService { } boolean appEmailFlag = sendCaseEmail(caseApplication1, affiliate.getEmail(), caseAttachList); - SendMailRecord sendMailRecord = new SendMailRecord(); - sendMailRecord.setCaseId(id); - sendMailRecord.setMailAddress(affiliate.getEmail()); - sendMailRecord.setMailContent("您好,审核后的调解书在附件中请查阅"); - sendMailRecord.setMailName("签署后的调解书"); - sendMailRecord.setSendTime(new Date()); - sendMailRecord.setCreateBy(SecurityUtils.getUsername()); - if (appEmailFlag) { - sendMailRecord.setSendStatus(1); - } else { - sendMailRecord.setSendStatus(0); - } - sendMailRecordMapper.saveSendMailRecord(sendMailRecord); - } -// if(!appEmailFlag&&!resEmailFlag){ -// throw new ServiceException("调解书发送失败"); -// } -// if(!appEmailFlag){ -// throw new ServiceException("申请人调解书发送失败"); -// } -// if(!resEmailFlag){ -// throw new ServiceException("被申请人调解书发送失败"); -// } + } CaseLogUtils.insertCaseLog(caseApplication1.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(),""); @@ -473,31 +454,14 @@ public class MsSignSealServiceImpl implements MsSignSealService { @Transactional public AjaxResult msCaseSign(MsSignSealDTO dto) { Long caseId = dto.getCaseId(); - MsCaseAffiliate caseAffiliate = msCaseAffiliateMapper.selectByPrimaryKey(caseId); + // MsCaseAffiliate caseAffiliate = msCaseAffiliateMapper.selectByPrimaryKey(caseId); MsCaseApplication caseApplicationselect = msCaseApplicationMapper.selectByPrimaryKey(caseId); // 查询当前节点 MsCaseFlow currentFlow = caseFlowMapper.selectByPrimaryKey(caseApplicationselect.getCaseFlowId()); if (currentFlow == null) { return AjaxResult.error("当前流程不存在"); } -// if (dto.getIsSignApply() != null && dto.getIsSignApply().intValue() == 1) { -// caseAffiliate.setIsSignApply(1); -// msCaseAffiliateMapper.updateByPrimaryKeySelective(caseAffiliate); -// if (caseAffiliate.getIsSignRespon() != null && caseAffiliate.getIsSignRespon().intValue() == 1) { -// // 根据流程id查找下一个流程节点 -// MsCaseFlow nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId()); -// caseApplicationselect.setCaseFlowId(nextFlow.getId()); -// caseApplicationselect.setCaseStatusName(nextFlow.getCaseStatusName()); -// caseApplicationMapper.updateByPrimaryKeySelective(caseApplicationselect); -// CaseLogUtils.insertCaseLog(caseApplicationselect.getId(), nextFlow.getNodeId(), nextFlow.getCaseStatusName(),"签收"); -// } -// } - if (dto.getIsSignApply() != null && dto.getIsSignApply().intValue() == 1) { - // todo 签收不要该字段 - // caseAffiliate.setIsSignApply(1); - // todo 签收不要该字段 - // msCaseAffiliateMapper.updateByPrimaryKeySelective(caseAffiliate); - + if (dto.getIsSignApply() != null && dto.getIsSignApply().equals(1) ) { // 根据流程id查找下一个流程节点 MsCaseFlow nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId()); caseApplicationselect.setCaseFlowId(nextFlow.getId()); @@ -505,24 +469,8 @@ public class MsSignSealServiceImpl implements MsSignSealService { caseApplicationMapper.updateByPrimaryKeySelective(caseApplicationselect); CaseLogUtils.insertCaseLog(caseApplicationselect.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(),null); } -// if (dto.getIsSignRespon() != null && dto.getIsSignRespon().intValue() == 1) { -// caseAffiliate.setIsSignRespon(1); -// msCaseAffiliateMapper.updateByPrimaryKeySelective(caseAffiliate); -// if (caseAffiliate.getIsSignApply() != null && caseAffiliate.getIsSignApply().intValue() == 1) { -// // 根据流程id查找下一个流程节点 -// MsCaseFlow nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId()); -// caseApplicationselect.setCaseFlowId(nextFlow.getId()); -// caseApplicationselect.setCaseStatusName(nextFlow.getCaseStatusName()); -// caseApplicationMapper.updateByPrimaryKeySelective(caseApplicationselect); -// CaseLogUtils.insertCaseLog(caseApplicationselect.getId(), nextFlow.getNodeId(), nextFlow.getCaseStatusName(),"签收"); -// } -// } - if (dto.getIsSignRespon() != null && dto.getIsSignRespon().intValue() == 1) { - // todo 签收不要该字段 -// caseAffiliate.setIsSignRespon(1); - // todo 签收不要该字段 -// msCaseAffiliateMapper.updateByPrimaryKeySelective(caseAffiliate); + if (dto.getIsSignRespon() != null && dto.getIsSignRespon().equals(1)) { // 根据流程id查找下一个流程节点 MsCaseFlow nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId()); @@ -531,7 +479,7 @@ public class MsSignSealServiceImpl implements MsSignSealService { caseApplicationMapper.updateByPrimaryKeySelective(caseApplicationselect); CaseLogUtils.insertCaseLog(caseApplicationselect.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(),null); CaseLogUtils.insertCaseLog(caseApplicationselect.getId(), 17, "结束", null); - // todo 被申请人签收结束对接北明,为调解成功状态 + // 被申请人签收结束对接北明,为调解成功状态 if(StrUtil.isEmpty(caseApplicationselect.getCaseSource())) { applicationService.pushStatusToBM(caseApplicationselect, PushCaseStatusEnum.SUCCESS); } @@ -543,9 +491,7 @@ public class MsSignSealServiceImpl implements MsSignSealService { @Override public AjaxResult msCaseSignUrlApplyPC(MsSignSealDTO dto) throws EsignDemoException { - // todo Long caseId = dto.getCaseId(); - //MsCaseAffiliate caseAffiliate = msCaseAffiliateMapper.selectByPrimaryKey(caseId); List affiliates = applicationService.selectAffliatesByCaseId(caseId); if(CollectionUtil.isEmpty(affiliates)){ return AjaxResult.error("未找到案件相关人员"); @@ -612,7 +558,7 @@ public class MsSignSealServiceImpl implements MsSignSealService { } if(resOpt.get().getUserId()!=null && resOpt.get().getUserId().equals(userId)){ - + // 被申 SealSignRecord sealSignRecordres = new SealSignRecord(); MsSealSignRecord mssealSignRecord = new MsSealSignRecord(); mssealSignRecord.setCaseAppliId(caseId); @@ -636,6 +582,7 @@ public class MsSignSealServiceImpl implements MsSignSealService { } } if(mediatorCount>0){ + // 调解员 SealSignRecord sealSignRecordres = new SealSignRecord(); MsSealSignRecord mssealSignRecord = new MsSealSignRecord(); mssealSignRecord.setCaseAppliId(caseId); @@ -710,7 +657,7 @@ public class MsSignSealServiceImpl implements MsSignSealService { Integer caseNode = currentFlow.getNodeId(); String caseStatusName = currentFlow.getCaseStatusName(); if("SIGN_MISSON_COMPLETE".equals(action) && signResult==2){ - if(mediaResult.intValue()==1){ + if(mediaResult.equals(1)){ //调解 if(StringUtils.isNotEmpty(accountMobile)&&accountMobile.equals(pensonAccountApply)){ //申请人签名 @@ -723,16 +670,16 @@ public class MsSignSealServiceImpl implements MsSignSealService { operLog.setCaseNode(caseNode); operLog.setCreateTime(dateOperate); caseLogRecordMapper.insert(operLog); - if(signStatusResponse!=null&&signStatusResponse.intValue()==1&& - signStatusMediator!=null&&signStatusMediator.intValue()==1){ + if(signStatusResponse!=null&&signStatusResponse.equals(1)&& + signStatusMediator!=null&&signStatusMediator.equals(1)){ // 根据流程id查找下一个流程节点 MsCaseFlow nextFlow=null; if(caseApplicationselect.getSealFlag()!=null&&caseApplicationselect.getSealFlag()==1) { // 需要用印 - nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId().intValue()); + nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId()); }else { // 不需要用印 - nextFlow = caseFlowMapper.nextFlow1(caseApplicationselect.getCaseFlowId().intValue()); + nextFlow = caseFlowMapper.nextFlow1(caseApplicationselect.getCaseFlowId()); } MsCaseApplication application = new MsCaseApplication(); application.setId(caseApplicationselect.getId()); @@ -764,17 +711,17 @@ public class MsSignSealServiceImpl implements MsSignSealService { operLog.setCaseNode(caseNode); operLog.setCreateTime(dateOperate); caseLogRecordMapper.insert(operLog); - if(signStatusApply!=null&&signStatusApply.intValue()==1&& - signStatusMediator!=null&&signStatusMediator.intValue()==1){ + if(signStatusApply!=null&&signStatusApply.equals(1)&& + signStatusMediator!=null&&signStatusMediator.equals(1)){ // 根据流程id查找下一个流程节点 // 根据流程id查找下一个流程节点 MsCaseFlow nextFlow=null; if(caseApplicationselect.getSealFlag()!=null&&caseApplicationselect.getSealFlag()==1) { // 需要用印 - nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId().intValue()); + nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId()); }else { // 不需要用印 - nextFlow = caseFlowMapper.nextFlow1(caseApplicationselect.getCaseFlowId().intValue()); + nextFlow = caseFlowMapper.nextFlow1(caseApplicationselect.getCaseFlowId()); } MsCaseApplication application = new MsCaseApplication(); application.setId(caseApplicationselect.getId()); @@ -806,17 +753,17 @@ public class MsSignSealServiceImpl implements MsSignSealService { operLog.setCaseNode(caseNode); operLog.setCreateTime(dateOperate); caseLogRecordMapper.insert(operLog); - if(signStatusApply!=null&&signStatusApply.intValue()==1&& - signStatusResponse!=null&&signStatusResponse.intValue()==1){ + if(signStatusApply!=null&&signStatusApply.equals(1)&& + signStatusResponse!=null&&signStatusResponse.equals(1)){ // 根据流程id查找下一个流程节点 // 根据流程id查找下一个流程节点 MsCaseFlow nextFlow=null; if(caseApplicationselect.getSealFlag()!=null&&caseApplicationselect.getSealFlag()==1) { // 需要用印 - nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId().intValue()); + nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId()); }else { // 不需要用印 - nextFlow = caseFlowMapper.nextFlow1(caseApplicationselect.getCaseFlowId().intValue()); + nextFlow = caseFlowMapper.nextFlow1(caseApplicationselect.getCaseFlowId()); } MsCaseApplication application = new MsCaseApplication(); application.setId(caseApplicationselect.getId()); @@ -847,7 +794,7 @@ public class MsSignSealServiceImpl implements MsSignSealService { caseLogRecordMapper.insert(operLog); // 根据流程id查找下一个流程节点 - MsCaseFlow nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId().intValue()); + MsCaseFlow nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId()); MsCaseApplication application = new MsCaseApplication(); application.setId(caseApplicationselect.getId()); application.setCaseFlowId(nextFlow.getId()); @@ -859,7 +806,7 @@ public class MsSignSealServiceImpl implements MsSignSealService { } - }else if(mediaResult.intValue()==5){ + }else if(mediaResult.equals(5)){ //和解 if(StringUtils.isNotEmpty(accountMobile)&&accountMobile.equals(pensonAccountApply)){ //申请人签名 @@ -872,8 +819,8 @@ public class MsSignSealServiceImpl implements MsSignSealService { operLog.setCaseNode(caseNode); operLog.setCreateTime(dateOperate); caseLogRecordMapper.insert(operLog); - if(signStatusResponse!=null&&signStatusResponse.intValue()==1){ - MsCaseFlow nextFlow = caseFlowMapper.nextFlow1(caseApplicationselect.getCaseFlowId().intValue()); + if(signStatusResponse!=null&&signStatusResponse.equals(1)){ + MsCaseFlow nextFlow = caseFlowMapper.nextFlow1(caseApplicationselect.getCaseFlowId()); MsCaseApplication application = new MsCaseApplication(); application.setId(caseApplicationselect.getId()); application.setCaseFlowId(nextFlow.getId()); @@ -898,8 +845,6 @@ public class MsSignSealServiceImpl implements MsSignSealService { String day = String.format("%02d", now.getDayOfMonth()); String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day; String fileName = UUID.randomUUID().toString().replace("-", "") + ".pdf"; -// String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName; -// String savePath = "/home/ruoyi/uploadPath/upload/"; String saveName = fileName; String savePath = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName; @@ -921,7 +866,7 @@ public class MsSignSealServiceImpl implements MsSignSealService { if(StrUtil.isEmpty(caseApplicationselect.getCaseSource())){ List existAttach = msCaseAttachMapper.listCaseAttachByCaseIdAndType(caseAppliId, AnnexTypeEnum.MEDIATE_BOOK.getCode()); if(CollectionUtil.isNotEmpty(existAttach)){ - // todo 对接北明,同步案件状态,删除 + // 对接北明,同步案件状态,删除 for (MsCaseAttach msCaseAttach : existAttach) { if(StrUtil.isEmpty(msCaseAttach.getOtherSysFileId())||StrUtil.isEmpty(msCaseAttach.getAnnexPath())){ continue; @@ -937,7 +882,7 @@ public class MsSignSealServiceImpl implements MsSignSealService { caseAttach.setAnnexPath(savePath); caseAttach.setAnnexName(saveName); caseAttachMapper.save(caseAttach); - // todo 对接北明,调用上传附件接口 + // 对接北明,调用上传附件接口 if(StrUtil.isEmpty(caseApplicationselect.getCaseSource()) ) { String templatePath = "/home/ruoyi" + savePath; File file = new File(templatePath.replace("/profile", "/uploadPath")); @@ -964,8 +909,8 @@ public class MsSignSealServiceImpl implements MsSignSealService { operLog.setCaseNode(caseNode); operLog.setCreateTime(dateOperate); caseLogRecordMapper.insert(operLog); - if(signStatusApply!=null&&signStatusApply.intValue()==1){ - MsCaseFlow nextFlow = caseFlowMapper.nextFlow1(caseApplicationselect.getCaseFlowId().intValue()); + if(signStatusApply!=null&&signStatusApply.equals(1)){ + MsCaseFlow nextFlow = caseFlowMapper.nextFlow1(caseApplicationselect.getCaseFlowId()); MsCaseApplication application = new MsCaseApplication(); application.setId(caseApplicationselect.getId()); application.setCaseFlowId(nextFlow.getId()); @@ -990,8 +935,6 @@ public class MsSignSealServiceImpl implements MsSignSealService { String day = String.format("%02d", now.getDayOfMonth()); String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day; String fileName = UUID.randomUUID().toString().replace("-", "") + ".pdf"; -// String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName; -// String savePath = "/home/ruoyi/uploadPath/upload/"; String saveName = fileName; String savePath = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName; @@ -1013,7 +956,7 @@ public class MsSignSealServiceImpl implements MsSignSealService { if(StrUtil.isEmpty(caseApplicationselect.getCaseSource())){ List existAttach = msCaseAttachMapper.listCaseAttachByCaseIdAndType(caseAppliId, AnnexTypeEnum.MEDIATE_BOOK.getCode()); if(CollectionUtil.isNotEmpty(existAttach)){ - // todo 对接北明,同步案件状态,删除 + // 对接北明,同步案件状态,删除 for (MsCaseAttach msCaseAttach : existAttach) { if(StrUtil.isEmpty(msCaseAttach.getOtherSysFileId())||StrUtil.isEmpty(msCaseAttach.getAnnexPath())){ continue; @@ -1029,7 +972,7 @@ public class MsSignSealServiceImpl implements MsSignSealService { caseAttach.setAnnexPath(savePath); caseAttach.setAnnexName(saveName); - // todo 对接北明,调用上传附件接口 + // 对接北明,调用上传附件接口 if(StrUtil.isEmpty(caseApplicationselect.getCaseSource()) ) { String templatePath = "/home/ruoyi" + savePath; @@ -1069,8 +1012,6 @@ public class MsSignSealServiceImpl implements MsSignSealService { String day = String.format("%02d", now.getDayOfMonth()); String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day; String fileName = UUID.randomUUID().toString().replace("-", "") + ".pdf"; -// String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName; -// String savePath = "/home/ruoyi/uploadPath/upload/"; String saveName = fileName; String savePath = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName; @@ -1092,7 +1033,7 @@ public class MsSignSealServiceImpl implements MsSignSealService { if(StrUtil.isEmpty(caseApplicationselect.getCaseSource())){ List existAttach = msCaseAttachMapper.listCaseAttachByCaseIdAndType(caseAppliId, AnnexTypeEnum.MEDIATE_BOOK.getCode()); if(CollectionUtil.isNotEmpty(existAttach)){ - // todo 对接北明,同步案件状态,删除 + // 对接北明,同步案件状态,删除 for (MsCaseAttach msCaseAttach : existAttach) { if(StrUtil.isEmpty(msCaseAttach.getOtherSysFileId())||StrUtil.isEmpty(msCaseAttach.getAnnexPath())){ continue; @@ -1108,7 +1049,7 @@ public class MsSignSealServiceImpl implements MsSignSealService { caseAttach.setAnnexPath(savePath); caseAttach.setAnnexName(saveName); caseAttachMapper.save(caseAttach); - // todo 对接北明,调用上传附件接口 + // 对接北明,调用上传附件接口 if(StrUtil.isEmpty(caseApplicationselect.getCaseSource()) ) { String templatePath = "/home/ruoyi" + savePath; File file = new File(templatePath.replace("/profile", "/uploadPath")); @@ -1209,40 +1150,62 @@ public class MsSignSealServiceImpl implements MsSignSealService { /** * 通过邮件发送裁决书文件 * - * @param caseApplication1 + * @param caseApplication */ - private boolean sendCaseEmail(MsCaseApplication caseApplication1, String email, List caseAttachList) { + private boolean sendCaseEmail(MsCaseApplication caseApplication, String email, List caseAttachList) { List fileList = new ArrayList<>(); File file = null; + Long fileId = null; if (caseAttachList != null && caseAttachList.size() > 0) { for (MsCaseAttach caseAttach : caseAttachList) { if (caseAttach.getAnnexType() == AnnexTypeEnum.MEDIATE_BOOK.getCode()) { -// String annexName = caseAttach.getAnnexName(); -// String prefix = "/profile/upload/"; -// int startIndex = prefix.length(); -// String path = caseAttach.getAnnexPath() + annexName.substring(startIndex); String prefix = "/profile"; int startIndex = prefix.length(); String annexPath = caseAttach.getAnnexPath(); String path = "/home/ruoyi/uploadPath/" + annexPath.substring(startIndex+1); - // todo 部署放开 file = new File(path); fileList.add(file); + fileId=caseAttach.getAnnexId(); System.out.println("文件长度==================:" + file.length()); } } } + SendMailRecord sendMailRecord = new SendMailRecord(); + sendMailRecord.setCaseId(caseApplication.getId()); + sendMailRecord.setMailAddress(email); + sendMailRecord.setMailContent("您好,审核后的调解书在附件中请查阅"); + sendMailRecord.setMailName("签署后的调解书"); + sendMailRecord.setSendTime(new Date()); + sendMailRecord.setMailSubject("签署后的调解书"); + sendMailRecord.setFileIds(fileId!=null?fileId.toString():null); + sendMailRecord.setCreateBy(SecurityUtils.getUsername()); + sendMailRecord.setCreateTime(new Date()); + sendMailRecord.setMailFromAddress(emailFrom); if (file != null && file.exists()) { try { Boolean aBoolean = emailOutUtil.sendEmil(email, "您好,审核后的调解书在附件中请查阅", "签署后的调解书", fileList, null); if (aBoolean) { + sendMailRecord.setSendStatus(1); + sendMailRecordMapper.saveSendMailRecord(sendMailRecord); + MsSendMailHistoryRecord msSendMailHistoryRecord = new MsSendMailHistoryRecord(); + BeanUtils.copyProperties(sendMailRecord, msSendMailHistoryRecord); + msSendMailHistoryRecord.setParentId(sendMailRecord.getId()); + msSendMailHistoryRecord.setId(null); + sendMailHistoryRecordMapper.insertSelective(msSendMailHistoryRecord); return Boolean.TRUE; } } catch (Exception e) { System.out.println("邮件发送失败++++++++++++++++++++++++++++++++"); System.out.println(e.toString()); + sendMailRecord.setSendStatus(0); + MsSendMailHistoryRecord msSendMailHistoryRecord = new MsSendMailHistoryRecord(); + BeanUtils.copyProperties(sendMailRecord, msSendMailHistoryRecord); + msSendMailHistoryRecord.setParentId(sendMailRecord.getId()); + msSendMailHistoryRecord.setId(null); + sendMailHistoryRecordMapper.insertSelective(msSendMailHistoryRecord); + sendMailRecordMapper.saveSendMailRecord(sendMailRecord); return Boolean.FALSE; } } @@ -1250,211 +1213,6 @@ public class MsSignSealServiceImpl implements MsSignSealService { } - private MsCaseLogRecordVO getNextCaseLogRecord(String nodeName) { - MsCaseLogRecordVO caseLogRecord = new MsCaseLogRecordVO(); - switch (nodeName) { - case "提交案件": - caseLogRecord.setCaseNodeName("提交案件"); - caseLogRecord.setContent("申请人将进行提交案件"); - break; - case "缴费": - caseLogRecord.setCaseNodeName("缴费"); - caseLogRecord.setContent("申请人将进行缴费"); - break; - case "确认缴费": - caseLogRecord.setCaseNodeName("确认缴费"); - caseLogRecord.setContent("财务将进行确认缴费"); - break; - case "受理分配": - caseLogRecord.setCaseNodeName("受理分配"); - caseLogRecord.setContent("法律顾问将进行受理分配"); - break; - case "选择调解员": - caseLogRecord.setCaseNodeName("选择调解员"); - caseLogRecord.setContent("申请人将进行选择调解员"); - break; - case "核实调解员": - caseLogRecord.setCaseNodeName("核实调解员"); - caseLogRecord.setContent("法律顾问将进行核实调解员"); - break; - case "确认调解员": - caseLogRecord.setCaseNodeName("确认调解员"); - caseLogRecord.setContent("部门长将进行确认调解员"); - break; - case "确定调解时间": - caseLogRecord.setCaseNodeName("确定调解时间"); - caseLogRecord.setContent("法律顾问将进行确定调解时间"); - break; - case "调解": - caseLogRecord.setCaseNodeName("调解"); - caseLogRecord.setContent("法律顾问将进行调解"); - break; - case "确认调解书": - caseLogRecord.setCaseNodeName("确认调解书"); - caseLogRecord.setContent("法律顾问将进行确认调解书"); - break; - case "签名": - caseLogRecord.setCaseNodeName("签名"); - caseLogRecord.setContent("申请人、被申请人将进行签名"); - break; - case "用印申请": - caseLogRecord.setCaseNodeName("用印申请"); - caseLogRecord.setContent("法律顾问将进行用印申请"); - break; - case "用印": - caseLogRecord.setCaseNodeName("用印"); - caseLogRecord.setContent("部门长将进行用印"); - break; - case "归档": - caseLogRecord.setCaseNodeName("归档"); - caseLogRecord.setContent("法律顾问将进行提交归档"); - break; - case "签收": - caseLogRecord.setCaseNodeName("签收"); - caseLogRecord.setContent("申请人、被申请人将进行签收"); - break; - case "申请人签收": - caseLogRecord.setCaseNodeName("申请人签收"); - caseLogRecord.setContent("申请人将进行签收"); - break; - case "被申请人签收": - caseLogRecord.setCaseNodeName("被申请人签收"); - caseLogRecord.setContent("被申请人将进行签收"); - break; - case "结束": - caseLogRecord.setCaseNodeName("结束"); - caseLogRecord.setContent("结束"); - break; - default: - caseLogRecord.setNextRoleName("没有下一节点角色"); - - } - return caseLogRecord; - } - - private CaseLogRecord getNextRole(String nodeName) { - CaseLogRecord caseLogRecord = new CaseLogRecord(); - switch (nodeName) { - case "提交案件": - caseLogRecord.setNextRoleName("下一节点角色:申请人"); - break; - case "缴费": - caseLogRecord.setNextRoleName("下一节点角色:申请人"); - break; - case "确认缴费": - caseLogRecord.setNextRoleName("下一节点角色:财务"); - break; - case "受理分配": - caseLogRecord.setNextRoleName("下一节点角色:法律顾问"); - break; - case "选择调解员": - caseLogRecord.setNextRoleName("下一节点角色:申请人、被申请人"); - break; - case "核实调解员": - caseLogRecord.setNextRoleName("下一节点角色:法律顾问"); - break; - case "确认调解员": - caseLogRecord.setNextRoleName("下一节点角色:部门长"); - break; - case "确定调解时间": - caseLogRecord.setNextRoleName("下一节点角色:法律顾问"); - break; - case "调解": - caseLogRecord.setNextRoleName("下一节点角色:法律顾问"); - break; - case "确认调解书": - caseLogRecord.setNextRoleName("下一节点角色:申请人、被申请人"); - break; - case "签名": - caseLogRecord.setNextRoleName("下一节点角色:申请人、被申请人"); - break; - case "用印申请": - caseLogRecord.setNextRoleName("下一节点角色:法律顾问"); - break; - case "用印": - caseLogRecord.setNextRoleName("下一节点角色:部门长"); - break; - case "归档": - caseLogRecord.setNextRoleName("下一节点角色:法律顾问"); - break; - case "签收": - caseLogRecord.setNextRoleName("下一节点角色:申请人、被申请人"); - break; - default: - caseLogRecord.setNextRoleName("没有下一节点角色"); - - } - return caseLogRecord; - } - - private CaseLogRecord getInCasenode(String nodeName) { - CaseLogRecord caseLogRecord = new CaseLogRecord(); - switch (nodeName) { - case "提交案件": - caseLogRecord.setCaseNodeName("提交案件"); - caseLogRecord.setContent("申请人正在进行提交案件"); - break; - case "缴费": - caseLogRecord.setCaseNodeName("缴费"); - caseLogRecord.setContent("申请人正在进行缴费"); - break; - case "确认缴费": - caseLogRecord.setCaseNodeName("确认缴费"); - caseLogRecord.setContent("财务正在进行缴费确认"); - break; - case "受理分配": - caseLogRecord.setCaseNodeName("受理分配"); - caseLogRecord.setContent("法律顾问将进行受理分配"); - break; - case "选择调解员": - caseLogRecord.setCaseNodeName("选择调解员"); - caseLogRecord.setContent("申请人正在进行选择调解员"); - break; - case "核实调解员": - caseLogRecord.setCaseNodeName("核实调解员"); - caseLogRecord.setContent("法律顾问正在进行核实调解员"); - break; - case "确认调解员": - caseLogRecord.setCaseNodeName("确认调解员"); - caseLogRecord.setContent("部门长正在进行确认调解员"); - break; - case "调解": - caseLogRecord.setCaseNodeName("调解"); - caseLogRecord.setContent("法律顾问正在进行调解"); - break; - case "确认调解书": - caseLogRecord.setCaseNodeName("确认调解书"); - caseLogRecord.setContent("法律顾问正在进行确认调解书"); - break; - case "签名": - caseLogRecord.setCaseNodeName("签名"); - caseLogRecord.setContent("申请人、被申请人正在进行签名"); - break; - case "用印申请": - caseLogRecord.setCaseNodeName("用印申请"); - caseLogRecord.setContent("法律顾问正在进行确认用印申请"); - break; - case "用印": - caseLogRecord.setCaseNodeName("用印"); - caseLogRecord.setContent("部门长正在进行用印"); - break; - case "归档": - caseLogRecord.setCaseNodeName("归档"); - caseLogRecord.setContent("法律顾问正在进行归档"); - break; - case "签收": - caseLogRecord.setCaseNodeName("签收"); - caseLogRecord.setContent("申请人、被申请人正在进行签收"); - break; - default: - caseLogRecord.setCaseNodeName("无案件状态"); - caseLogRecord.setContent("无操作内容"); - - } - return caseLogRecord; - - } - diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/VideoConferenceServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/VideoConferenceServiceImpl.java index ab44919..88eda66 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/VideoConferenceServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/VideoConferenceServiceImpl.java @@ -215,15 +215,6 @@ public class VideoConferenceServiceImpl implements VideoConferenceService { String reportStatus = jsonObject.getStr("report_status"); String description = jsonObject.getStr("description"); System.out.println(description); - // 查询sid对应的短信,更新短信状态 - // SmsSendRecord smsSendRecord= smsRecordMapper.selectBySId(jsonObject.getStr("sid")); - // if(smsSendRecord!=null){ - // if(jsonObject.get("report_status")!=null && jsonObject.getStr("report_status").equals("SUCCESS")){ - // smsSendRecord.setSendStatus(SMSStatusEnum.SUCCESS.getCode()); - // }else { - // smsSendRecord.setSendStatus(SMSStatusEnum.FAIL.getCode()); - // } - // } } } } @@ -537,7 +528,7 @@ public class VideoConferenceServiceImpl implements VideoConferenceService { if(StrUtil.isEmpty(caseApplication.getCaseSource())){ List existAttach = caseAttachMapper.listCaseAttachByCaseIdAndType(reservedConferenceVO.getCaseId(), AnnexTypeEnum.MEDIATE.getCode()); if(CollectionUtil.isNotEmpty(existAttach)){ - // todo 对接北明,同步案件状态,删除 + // 对接北明,同步案件状态,删除 for (MsCaseAttach msCaseAttach : existAttach) { if(StrUtil.isEmpty(msCaseAttach.getOtherSysFileId())||StrUtil.isEmpty(msCaseAttach.getAnnexPath())){ continue; @@ -552,7 +543,7 @@ public class VideoConferenceServiceImpl implements VideoConferenceService { .annexPath(fileName) .annexType(AnnexTypeEnum.MEDIATE.getCode()) .build(); - // todo 对接北明,调用上传附件接口 + // 对接北明,调用上传附件接口 if(StrUtil.isEmpty(caseApplication.getCaseSource()) ) { String templatePath = "/home/ruoyi" + caseAttach.getAnnexPath(); @@ -604,7 +595,7 @@ public class VideoConferenceServiceImpl implements VideoConferenceService { .annexPath(annexName) .annexType(AnnexTypeEnum.MEETING_VIDEO.getCode()) .build(); - // todo 对接北明,调用上传附件接口 + // 对接北明,调用上传附件接口 if(StrUtil.isEmpty(caseApplication.getCaseSource()) ) { String templatePath = "/home/ruoyi" + caseAttach.getAnnexPath(); diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/shortmessage/ShortMessageService.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/shortmessage/ShortMessageService.java index 1daf865..c0d60c7 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/shortmessage/ShortMessageService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/shortmessage/ShortMessageService.java @@ -1,15 +1,20 @@ package com.ruoyi.wisdomarbitrate.service.shortmessage; import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.system.domain.entity.sms.MsSmsSendRecordParam; import com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SmsSendRecord; import com.ruoyi.wisdomarbitrate.domain.vo.shortmessage.MeetingInfoVO; import com.ruoyi.wisdomarbitrate.domain.vo.shortmessage.ReSendMessageVO; +import java.util.List; + public interface ShortMessageService { + public List smsSendRecordList(SmsSendRecord smsSendRecord); + /** * 新增发送历史记录 */ - void insertShortMessageHistoryRecord(SmsSendRecord smsSendRecord); + void insertShortMessageHistoryRecord(SmsSendRecord smsSendRecord,List recordParams); /** * 重新发送短信 diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/shortmessage/impl/ShortMessageServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/shortmessage/impl/ShortMessageServiceImpl.java index 5da6425..b1414b8 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/shortmessage/impl/ShortMessageServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/shortmessage/impl/ShortMessageServiceImpl.java @@ -1,29 +1,40 @@ package com.ruoyi.wisdomarbitrate.service.shortmessage.impl; +import cn.hutool.core.collection.CollectionUtil; import cn.hutool.json.JSONObject; import com.ruoyi.common.constant.Constants; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.enums.SMSStatusEnum; -import com.ruoyi.common.utils.SmsUtils; import com.ruoyi.system.domain.entity.shortmessage.MeetingInfo; import com.ruoyi.system.domain.entity.shortmessage.MsSmsSendHistoryRecord; +import com.ruoyi.system.domain.entity.sms.MsSmsSendHistoryRecordParam; +import com.ruoyi.system.domain.entity.sms.MsSmsSendRecordParam; +import com.ruoyi.system.domain.entity.sms.MsSmsTemplate; +import com.ruoyi.system.domain.entity.sms.MsSmsTemplateParam; import com.ruoyi.system.mapper.shortmessage.MeetingInfoMapper; import com.ruoyi.system.mapper.shortmessage.MsSmsSendHistoryRecordMapper; +import com.ruoyi.system.mapper.sms.MsSmsSendHistoryRecordParamMapper; +import com.ruoyi.system.mapper.sms.MsSmsSendRecordParamMapper; +import com.ruoyi.system.mapper.sms.MsSmsTemplateMapper; +import com.ruoyi.system.mapper.sms.MsSmsTemplateParamMapper; import com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SmsSendRecord; import com.ruoyi.wisdomarbitrate.domain.vo.shortmessage.MeetingInfoVO; import com.ruoyi.wisdomarbitrate.domain.vo.shortmessage.ReSendMessageVO; +import com.ruoyi.wisdomarbitrate.mapper.sendrecord.SmsRecordMapper; import com.ruoyi.wisdomarbitrate.service.shortmessage.ShortMessageService; +import com.ruoyi.wisdomarbitrate.utils.SmsUtils; import io.jsonwebtoken.Jwts; import io.jsonwebtoken.SignatureAlgorithm; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import tk.mybatis.mapper.entity.Example; -import java.util.Date; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; +import java.text.MessageFormat; +import java.util.*; +import java.util.stream.Collectors; @Service public class ShortMessageServiceImpl implements ShortMessageService { @@ -31,20 +42,133 @@ public class ShortMessageServiceImpl implements ShortMessageService { MsSmsSendHistoryRecordMapper msSmsSendHistoryRecordMapper; @Autowired MeetingInfoMapper meetingInfoMapper; + @Autowired + SmsRecordMapper smsRecordMapper; + @Autowired + MsSmsTemplateMapper templateMapper; + @Autowired + MsSmsTemplateParamMapper templateParamMapper; + @Autowired + MsSmsSendRecordParamMapper recordParamMapper; + @Autowired + MsSmsSendHistoryRecordParamMapper historyRecordParamMapper; + @Override + public List smsSendRecordList(SmsSendRecord smsSendRecord) { + List records = smsRecordMapper.getSmsSendRecord(smsSendRecord); + if(CollectionUtil.isEmpty(records)){ + return null; + } + List templateIds = records.stream().map(SmsSendRecord::getMsSmsTemplateId).collect(Collectors.toList()); + if(CollectionUtil.isEmpty(templateIds)){ + return records; + } + List ids = records.stream().map(SmsSendRecord::getId).collect(Collectors.toList()); + // 查询记录表参数值 + Example recordParamExam = new Example(MsSmsSendRecordParam.class); + recordParamExam.createCriteria().andIn("smsRecordId", ids); + List recordParams = recordParamMapper.selectByExample(recordParamExam); + if(CollectionUtil.isEmpty(recordParams)){ + return records; + } + // 根据模板id查询模板参数 + Example templateParamExam = new Example(MsSmsTemplateParam.class); + templateParamExam.createCriteria().andIn("smsTemplateId", templateIds); + List templateParams = templateParamMapper.selectByExample(templateParamExam); + if(CollectionUtil.isEmpty(templateParams)){ + return records; + } + // 根据模板id对模板参数分组 + Map> templateParamMap = templateParams.stream().collect(Collectors.groupingBy(MsSmsTemplateParam::getSmsTemplateId)); + + // 根据记录id分组 + Map> recordParamContentMap = new HashMap<>(); + for (MsSmsSendRecordParam recordParam : recordParams) { + List list = recordParamContentMap.get(recordParam.getSmsRecordId()); + if(CollectionUtil.isEmpty(list)){ + list=new ArrayList<>(); + } + list.add(recordParam.getParamValue()); + recordParamContentMap.put(recordParam.getSmsRecordId(),list); + } + // 根据模板id查询模板 + Example templateExam = new Example(MsSmsTemplate.class); + templateExam.createCriteria().andIn("id", templateIds); + List templates = templateMapper.selectByExample(templateExam); + if(CollectionUtil.isEmpty(templates)){ + return records; + } + // 根据主键id获取模板内容 + Map templateMap = templates.stream().collect(Collectors.toMap(MsSmsTemplate::getId, MsSmsTemplate::getContent, (k1, k2) -> k2)); + Map templateIdMap = templates.stream().collect(Collectors.toMap(MsSmsTemplate::getId, MsSmsTemplate::getTemplateId, (k1, k2) -> k2)); + // 组装模板内容 + for (SmsSendRecord record : records) { + if(record.getMsSmsTemplateId()==null){ + continue; + } + if(!templateMap.containsKey(record.getMsSmsTemplateId())){ + continue; + } + + if(!recordParamContentMap.containsKey(record.getId())){ + continue; + } + if(templateIdMap.containsKey(record.getMsSmsTemplateId())){ + record.setTemplateId(templateIdMap.get(record.getMsSmsTemplateId())); + } + String templateContent = templateMap.get(record.getMsSmsTemplateId()); + record.setTemplateContent(templateContent); + List recordParamList = recordParamContentMap.get(record.getId()); + if(recordParamContentMap.containsKey(record.getId()) && templateParamMap.containsKey(record.getMsSmsTemplateId())){ + List templateParamList = templateParamMap.get(record.getMsSmsTemplateId()); + for (int i = 0; i < templateParamList.size(); i++) { + MsSmsTemplateParam templateParam = templateParamList.get(i); + templateParam.setParamValue(recordParamContentMap.get(record.getId()).get(i)); + } + record.setTemplateParams(templateParamList); + + } + // 按顺序替换占位符 + if(CollectionUtil.isNotEmpty(recordParamList)){ + recordParamList.add(0,"0"); + + // 将List转换为String[]数组 + String[] paramArray = recordParamList.toArray(new String[recordParamList.size()]); + String formattedMessage = MessageFormat.format(templateContent, paramArray); + record.setSendContent(formattedMessage); + } + + + } + + return records; + } /** * 新增发送历史记录 * * @param smsSendRecord */ + @Transactional @Override - public void insertShortMessageHistoryRecord(SmsSendRecord smsSendRecord) { - if (smsSendRecord != null) { - MsSmsSendHistoryRecord historyRecord = new MsSmsSendHistoryRecord(); - BeanUtils.copyProperties(smsSendRecord, historyRecord); + public void insertShortMessageHistoryRecord(SmsSendRecord smsSendRecord,List recordParams) { + if(smsSendRecord!=null){ + MsSmsSendHistoryRecord historyRecord=new MsSmsSendHistoryRecord(); + BeanUtils.copyProperties(smsSendRecord,historyRecord); historyRecord.setId(null); historyRecord.setParentId(smsSendRecord.getId()); - msSmsSendHistoryRecordMapper.insert(historyRecord); + int i = msSmsSendHistoryRecordMapper.insert(historyRecord); + if(i>0 && CollectionUtil.isNotEmpty(recordParams)){ + // 新增参数表 + List historyRecordParams = new ArrayList<>(); + for (MsSmsSendRecordParam templateParam : recordParams) { + MsSmsSendHistoryRecordParam recordParam = new MsSmsSendHistoryRecordParam(); + BeanUtils.copyProperties(templateParam,recordParam); + recordParam.setId(null); + recordParam.setSmsRecordHistoryId(historyRecord.getId()); + historyRecordParams.add(recordParam); + } + historyRecordParamMapper.batchInsert(historyRecordParams); + } } } @@ -55,19 +179,36 @@ public class ShortMessageServiceImpl implements ShortMessageService { */ @Override public AjaxResult reSendShortMessage(ReSendMessageVO reSendMessageVO) { - if (reSendMessageVO != null && reSendMessageVO.getTemplateId() != null && reSendMessageVO.getPhone() != null && reSendMessageVO.getParamValues() != null && reSendMessageVO.getParamValues().size() > 0) { + if (reSendMessageVO != null && reSendMessageVO.getTemplateId() != null && reSendMessageVO.getPhone() != null && reSendMessageVO.getTemplateParams() != null && reSendMessageVO.getTemplateParams().size() > 0 && reSendMessageVO.getId() != null) { + // 根据id查询短信记录 + SmsSendRecord smsSendRecord = smsRecordMapper.selectById(reSendMessageVO.getId()); + if(smsSendRecord == null){ + return AjaxResult.warn("短信记录不存在"); + } + SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest(); request.setTemplateId(reSendMessageVO.getTemplateId()); request.setPhone(reSendMessageVO.getPhone()); - String[] messageContent = reSendMessageVO.getParamValues().toArray(new String[0]); - System.out.println(reSendMessageVO.getTemplateId()); - System.out.println(reSendMessageVO.getPhone()); - System.out.println(messageContent); + List paramsList = reSendMessageVO.getTemplateParams().stream().map(MsSmsTemplateParam::getParamValue).collect(Collectors.toList()); + String[] messageContent = paramsList.toArray(new String[0]); request.setTemplateParamSet(messageContent); JSONObject resultObj = SmsUtils.sendSms(request); + smsSendRecord.setSendTime(new Date()); + // 修改sid和状态 if (resultObj.get("status") != null && !resultObj.get("status").equals(SMSStatusEnum.FAIL.getCode())) { + smsSendRecord.setSendStatus(SMSStatusEnum.SENDING.getCode()); + smsSendRecord.setSid(resultObj.get("sid")==null?null:resultObj.get("sid").toString()); + smsSendRecord.setReason(null); + // 修改 + smsRecordMapper.update(smsSendRecord); + return AjaxResult.success("重新发送成功"); } else { + smsSendRecord.setSid(resultObj.get("sid")==null?null:resultObj.get("sid").toString()); + smsSendRecord.setSendStatus(SMSStatusEnum.FAIL.getCode()); + smsSendRecord.setSid(resultObj.get("reason")==null?null:resultObj.get("reason").toString()); + // 修改 + smsRecordMapper.update(smsSendRecord); return AjaxResult.warn("重新发送失败"); } } else { diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/sms/SMSTemplateService.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/sms/SMSTemplateService.java new file mode 100644 index 0000000..7aafddc --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/sms/SMSTemplateService.java @@ -0,0 +1,21 @@ +package com.ruoyi.wisdomarbitrate.service.sms; + +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.system.domain.entity.sms.MsSmsTemplate; + +import java.util.List; + +/** + * @Classname SMSTemplateService + * @Description TODO + * @Version 1.0.0 + * @Date 2024/4/16 11:39 + * @Created wangqiong + */ +public interface SMSTemplateService { + List page(); + + AjaxResult insert(MsSmsTemplate template); + + AjaxResult delete(Long id); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/sms/impl/SMSTemplateServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/sms/impl/SMSTemplateServiceImpl.java new file mode 100644 index 0000000..18cb7d5 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/sms/impl/SMSTemplateServiceImpl.java @@ -0,0 +1,96 @@ +package com.ruoyi.wisdomarbitrate.service.sms.impl; + +import cn.hutool.core.collection.CollectionUtil; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.system.domain.entity.sms.MsSmsTemplate; +import com.ruoyi.system.domain.entity.sms.MsSmsTemplateParam; +import com.ruoyi.system.mapper.sms.MsSmsTemplateMapper; +import com.ruoyi.system.mapper.sms.MsSmsTemplateParamMapper; +import com.ruoyi.wisdomarbitrate.service.sms.SMSTemplateService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import tk.mybatis.mapper.entity.Example; + +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * @Classname SMSTemplateServiceImpl + * @Description TODO + * @Version 1.0.0 + * @Date 2024/4/16 11:40 + * @Created wangqiong + */ +@Service +public class SMSTemplateServiceImpl implements SMSTemplateService { + @Autowired + private MsSmsTemplateMapper templateMapper; + @Autowired + private MsSmsTemplateParamMapper templateParamMapper; + + @Override + public List page() { + // 分页查询模板 + Example templateExam = new Example(MsSmsTemplate.class); + List templates = templateMapper.selectByExample(templateExam); + if(CollectionUtil.isEmpty(templates)){ + return null; + } + + List templateIds = templates.stream().map(MsSmsTemplate::getId).collect(Collectors.toList()); + // 查询参数 + Example templateParamExam = new Example(MsSmsTemplateParam.class); + templateParamExam.createCriteria().andIn("smsTemplateId", templateIds); + List templateParams = templateParamMapper.selectByExample(templateParamExam); + // 根据模板id对模板参数分组 + Map> templateParamMap = templateParams.stream().collect(Collectors.groupingBy(MsSmsTemplateParam::getSmsTemplateId)); + for (MsSmsTemplate template : templates) { + if(templateParamMap.containsKey(template.getId())){ + template.setTemplateParams(templateParamMap.get(template.getId())); + } + } + return templates; + } + + /** + * 新增或者修改 + * @param template + * @return + */ + @Override + public AjaxResult insert(MsSmsTemplate template) { + if(template.getId() == null){ + templateMapper.insert(template); + + }else{ + templateMapper.updateByPrimaryKey(template); + for (MsSmsTemplateParam templateParam : template.getTemplateParams()) { + templateParam.setSmsTemplateId(template.getId()); + } + // todo 先删除 + Example paramExam = new Example(MsSmsTemplateParam.class); + paramExam.createCriteria().andEqualTo("smsTemplateId", template.getId()); + templateParamMapper.deleteByExample(paramExam); + } + // 新增参数表 + if(CollectionUtil.isNotEmpty(template.getTemplateParams())){ + for (MsSmsTemplateParam templateParam : template.getTemplateParams()) { + templateParam.setSmsTemplateId(template.getId()); + } + templateParamMapper.batchInsert(template.getTemplateParams()); + } + return AjaxResult.success(); + } + + @Override + public AjaxResult delete(Long id) { + // 删除 + templateMapper.deleteByPrimaryKey(id); + // 删除参数表 + Example paramExam = new Example(MsSmsTemplateParam.class); + paramExam.createCriteria().andEqualTo("smsTemplateId", id); + templateParamMapper.deleteByExample(paramExam); + return AjaxResult.success(); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/SmsUtils.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/SmsUtils.java new file mode 100644 index 0000000..97dfd51 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/SmsUtils.java @@ -0,0 +1,192 @@ +package com.ruoyi.wisdomarbitrate.utils; + +import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.extra.spring.SpringUtil; +import cn.hutool.json.JSONObject; +import com.ruoyi.common.enums.SMSStatusEnum; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.ThreadUtil; +import com.ruoyi.system.domain.entity.sms.MsSmsSendRecordParam; +import com.ruoyi.system.domain.entity.sms.MsSmsTemplate; +import com.ruoyi.system.mapper.SysRoleMapper; +import com.ruoyi.system.mapper.SysUserMapper; +import com.ruoyi.system.mapper.flow.MsCaseFlowRoleSmsRelatedMapper; +import com.ruoyi.system.mapper.sms.MsSmsSendRecordParamMapper; +import com.ruoyi.system.mapper.sms.MsSmsTemplateMapper; +import com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SmsSendRecord; +import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseApplication; +import com.ruoyi.wisdomarbitrate.mapper.sendrecord.SmsRecordMapper; +import com.ruoyi.wisdomarbitrate.service.shortmessage.ShortMessageService; +import com.tencentcloudapi.common.Credential; +import com.tencentcloudapi.common.exception.TencentCloudSDKException; +import com.tencentcloudapi.sms.v20210111.SmsClient; +import com.tencentcloudapi.sms.v20210111.models.SendSmsResponse; +import com.tencentcloudapi.sms.v20210111.models.SendStatus; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import lombok.var; +import tk.mybatis.mapper.entity.Example; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Objects; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutorService; + +@Slf4j +public class SmsUtils { + //应用id + private static final String SDK_APP_ID = "1400854852"; + //API的SecretId + private static final String SECRET_ID = "AKIDeEf2A8uX1HSainvvnXAc3X9ZlhtyvkMp"; + //API的SecretKey + private static final String SECRET_KEY = "QjphKo8zkHZigT8j9PVtFPJyfIvO3d6V"; + //签名内容 + private static final String SIGN_NAME = "乙巢智慧仲裁网"; + private static SmsRecordMapper recordMapper = SpringUtil.getBean(SmsRecordMapper.class); + private static MsSmsSendRecordParamMapper recordParamMapper = SpringUtil.getBean(MsSmsSendRecordParamMapper.class); + private static MsSmsTemplateMapper templateMapper = SpringUtil.getBean(MsSmsTemplateMapper.class); + private static SysUserMapper sysUserMapper = SpringUtil.getBean(SysUserMapper.class); + private static MsCaseFlowRoleSmsRelatedMapper flowRoleRelatedMapper = SpringUtil.getBean(MsCaseFlowRoleSmsRelatedMapper.class); + private static SysRoleMapper roleMapper = SpringUtil.getBean(SysRoleMapper.class); + private static ShortMessageService shortMessageService = SpringUtil.getBean(ShortMessageService.class); + + public static JSONObject sendSms(SendSmsRequest request) { + JSONObject jsonObject = new JSONObject(); + Credential cred = new Credential(SECRET_ID, SECRET_KEY); + + SmsClient client = new SmsClient(cred, "ap-guangzhou"); + + final var req = new com.tencentcloudapi.sms.v20210111.models.SendSmsRequest(); + req.setPhoneNumberSet(new String[]{"+86" + request.getPhone()}); + req.setSmsSdkAppId(SDK_APP_ID); + req.setSignName(SIGN_NAME); + req.setTemplateId(request.getTemplateId()); + req.setTemplateParamSet(request.getTemplateParamSet()); + SendSmsResponse res = null; + try { + res = client.SendSms(req); + } catch (TencentCloudSDKException e) { + log.error("发送短信出错:", e); + jsonObject.set("status", SMSStatusEnum.FAIL.getCode()); + jsonObject.set("reason",e.getMessage()); + return jsonObject; + } + SendStatus sendStatus = res.getSendStatusSet()[0]; + log.info("发送短信结果:Code={}, Message={}", sendStatus.getCode(), sendStatus.getMessage()); + + if (Objects.nonNull(res.getSendStatusSet()) && res.getSendStatusSet().length > 0 && "Ok".equals(res.getSendStatusSet()[0].getCode())) { + jsonObject.set("status", SMSStatusEnum.SENDING.getCode()); + } else { + jsonObject.set("status", SMSStatusEnum.FAIL.getCode()); + } + jsonObject.set("sid", sendStatus.getSerialNo()); + return jsonObject; + } + + public static void sendSms(MsCaseApplication application, String templateId, String phone, String[] templateParamSet) { + if(application==null||StrUtil.isEmpty(templateId)||StrUtil.isEmpty(phone)||templateParamSet==null||templateParamSet.length==0){ + return; + } + Example templateExam = new Example(MsSmsTemplate.class); + templateExam.createCriteria().andEqualTo("templateId", templateId); + List templates = templateMapper.selectByExample(templateExam); + if (CollectionUtil.isEmpty(templates)) { + return ; + } + MsSmsTemplate template = templates.get(0); + SendSmsRequest request = new SendSmsRequest(phone, templateId, templateParamSet, application.getId()); + Credential cred = new Credential(SECRET_ID, SECRET_KEY); + + SmsClient client = new SmsClient(cred, "ap-guangzhou"); + + final var req = new com.tencentcloudapi.sms.v20210111.models.SendSmsRequest(); + req.setPhoneNumberSet(new String[]{"+86" + request.getPhone()}); + req.setSmsSdkAppId(SDK_APP_ID); + req.setSignName(SIGN_NAME); + req.setTemplateId(request.getTemplateId()); + req.setTemplateParamSet(request.getTemplateParamSet()); + sendSms(client,template,application,phone, templateParamSet,req); + } + + + private static void sendSms(SmsClient client,MsSmsTemplate template, MsCaseApplication application, String phone, String[] templateParamSet, com.tencentcloudapi.sms.v20210111.models.SendSmsRequest req) { + SmsSendRecord smsSendRecord=new SmsSendRecord(); + smsSendRecord.setMsSmsTemplateId(template.getId()); + smsSendRecord.setCaseId(application.getId()); + smsSendRecord.setCaseNum(application.getCaseNum()); + smsSendRecord.setSendTime(new Date()); + smsSendRecord.setPhone(phone); + smsSendRecord.setCreateTime(new Date()); + smsSendRecord.setCreateBy(SecurityUtils.getUsername()); + // SendSmsRequest request = new SendSmsRequest(phone, template.getTemplateId(), templateParamSet, application.getId()); + req.setPhoneNumberSet(new String[]{"+86" + phone}); + req.setTemplateId(template.getTemplateId()); + req.setTemplateParamSet(templateParamSet); + try { + SendSmsResponse res=client.SendSms(req); + SendStatus sendStatus = res.getSendStatusSet()[0]; + if (Objects.nonNull(res.getSendStatusSet()) && res.getSendStatusSet().length > 0 && "Ok".equals(res.getSendStatusSet()[0].getCode())) { + smsSendRecord.setSendStatus( SMSStatusEnum.SENDING.getCode()); + } else { + smsSendRecord.setSendStatus(SMSStatusEnum.FAIL.getCode()); + smsSendRecord.setReason(sendStatus.getMessage()); + } + smsSendRecord.setSid(sendStatus.getSerialNo()); + } catch (TencentCloudSDKException e) { + smsSendRecord.setSendStatus(SMSStatusEnum.FAIL.getCode()); + smsSendRecord.setReason(e.getMessage()); + } + int i = recordMapper.saveSmsSendRecord(smsSendRecord); + if(i>0){ + List recordParams=new ArrayList<>(); + for (String paramValue : templateParamSet) { + // 新增参数 + MsSmsSendRecordParam recordParam = new MsSmsSendRecordParam(); + recordParam.setSmsRecordId(smsSendRecord.getId()); + recordParam.setParamValue(paramValue); + recordParams.add(recordParam); + } + ExecutorService executor = ThreadUtil.createThreadPool(); + CompletableFuture.runAsync(() -> { + recordParamMapper.batchInsert(recordParams); + + }, executor); + // 新增历史记录表 + CompletableFuture.runAsync(() -> { + shortMessageService.insertShortMessageHistoryRecord(smsSendRecord,recordParams); + + }, executor); + + } + } + + /** + * 参数对象 + */ + @Data + @NoArgsConstructor + @AllArgsConstructor + public static class SendSmsRequest { + /** + * 电话 + */ + private String phone; + + /** + * 模板 ID: 必须填写已审核通过的模板 ID + */ + private String templateId; + + /** + * 模板参数: 模板参数的个数需要与 TemplateId 对应模板的变量个数保持一致,若无模板参数,则设置为空 + */ + private String[] templateParamSet; + private Long caseId; + + } +} diff --git a/ruoyi-system/src/main/resources/com/ruoyi/system/mapper/log/MsRequestLogMapper.xml b/ruoyi-system/src/main/resources/com/ruoyi/system/mapper/log/MsRequestLogMapper.xml index fe390de..ab7b82f 100644 --- a/ruoyi-system/src/main/resources/com/ruoyi/system/mapper/log/MsRequestLogMapper.xml +++ b/ruoyi-system/src/main/resources/com/ruoyi/system/mapper/log/MsRequestLogMapper.xml @@ -6,10 +6,11 @@ WARNING - @mbg.generated --> - + + \ No newline at end of file diff --git a/ruoyi-system/src/main/resources/com/ruoyi/system/mapper/sms/MsSmsSendHistoryRecordParamMapper.xml b/ruoyi-system/src/main/resources/com/ruoyi/system/mapper/sms/MsSmsSendHistoryRecordParamMapper.xml new file mode 100644 index 0000000..22fbc51 --- /dev/null +++ b/ruoyi-system/src/main/resources/com/ruoyi/system/mapper/sms/MsSmsSendHistoryRecordParamMapper.xml @@ -0,0 +1,12 @@ + + + + + + + + + + \ No newline at end of file diff --git a/ruoyi-system/src/main/resources/com/ruoyi/system/mapper/sms/MsSmsSendRecordParamMapper.xml b/ruoyi-system/src/main/resources/com/ruoyi/system/mapper/sms/MsSmsSendRecordParamMapper.xml new file mode 100644 index 0000000..17649f5 --- /dev/null +++ b/ruoyi-system/src/main/resources/com/ruoyi/system/mapper/sms/MsSmsSendRecordParamMapper.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/ruoyi-system/src/main/resources/com/ruoyi/system/mapper/sms/MsSmsTemplateMapper.xml b/ruoyi-system/src/main/resources/com/ruoyi/system/mapper/sms/MsSmsTemplateMapper.xml new file mode 100644 index 0000000..5d8893a --- /dev/null +++ b/ruoyi-system/src/main/resources/com/ruoyi/system/mapper/sms/MsSmsTemplateMapper.xml @@ -0,0 +1,12 @@ + + + + + + + + + + \ No newline at end of file diff --git a/ruoyi-system/src/main/resources/com/ruoyi/system/mapper/sms/MsSmsTemplateParamMapper.xml b/ruoyi-system/src/main/resources/com/ruoyi/system/mapper/sms/MsSmsTemplateParamMapper.xml new file mode 100644 index 0000000..05c56c8 --- /dev/null +++ b/ruoyi-system/src/main/resources/com/ruoyi/system/mapper/sms/MsSmsTemplateParamMapper.xml @@ -0,0 +1,12 @@ + + + + + + + + + + \ No newline at end of file diff --git a/ruoyi-system/src/main/resources/mapper/system/SysMenuMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysMenuMapper.xml index 635e6c9..5c51f22 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysMenuMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysMenuMapper.xml @@ -108,7 +108,7 @@ left join ms_sys_role_menu rm on m.menu_id = rm.menu_id left join ms_sys_user_role ur on rm.role_id = ur.role_id left join ms_sys_role r on r.role_id = ur.role_id - where m.status = '0' and r.status = '0' and ur.user_id = #{userId} + where m.status = '0' and r.status = '0' and ur.user_id = #{userId} and m.perms is not null and m.perms!='' select t.* from( SELECT - c.id,c.organize_flag organizeFlag,c.case_source caseSource,c.media_result mediaResult,c.room_id roomId,0 AS pendingStatus, + c.id,c.case_source caseSource,c.media_result mediaResult,c.room_id roomId,0 AS pendingStatus, c.case_flow_id caseFlowId,c.batch_number batchNumber,c.case_num caseNum, u1.nick_name mediatorName,c.hear_date hearDate,c.case_status_name caseStatusName,c.create_time createTime, c.mediation_method mediationMethod, @@ -120,7 +120,7 @@ c.id union SELECT - c.id,c.organize_flag organizeFlag,c.case_source caseSource,c.media_result mediaResult,c.room_id roomId,1 AS pendingStatus, + c.id,c.case_source caseSource,c.media_result mediaResult,c.room_id roomId,1 AS pendingStatus, c.case_flow_id caseFlowId,c.batch_number batchNumber,c.case_num caseNum, u1.nick_name mediatorName,c.hear_date hearDate,c.case_status_name caseStatusName,c.create_time createTime, c.mediation_method mediationMethod, @@ -159,4 +159,28 @@ ) t ORDER BY t.createTime desc,t.caseNum desc + + \ No newline at end of file diff --git a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/sendrecord/SmsRecordMapper.xml b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/sendrecord/SmsRecordMapper.xml index a7a3c0e..ec7c6c7 100644 --- a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/sendrecord/SmsRecordMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/sendrecord/SmsRecordMapper.xml @@ -5,28 +5,27 @@ - - - - - - - - - - - - + + + + + + + + + + + + - + insert into ms_sms_send_record( case_appli_id, case_num, phone, send_time, - send_content, + ms_sms_template_id, create_by, send_status, sid, @@ -37,7 +36,7 @@ #{caseNum}, #{phone}, #{sendTime}, - #{sendContent}, + #{msSmsTemplateId}, #{createBy}, #{sendStatus}, #{sid}, @@ -48,27 +47,27 @@ insert into ms_sms_send_record( - case_appli_id, - case_num, - phone, - send_time, - send_content, - create_by, - send_status, + case_appli_id, + case_num, + phone, + send_time, + ms_sms_template_id, + create_by, + send_status, create_time, sid,reason )values - ( - #{item.caseId}, - #{item.caseNum}, - #{item.phone}, - #{item.sendTime}, - #{item.sendContent}, - #{item.createBy}, - #{item.sendStatus}, - sysdate(),#{sid},#{reason} - ) + ( + #{item.caseId}, + #{item.caseNum}, + #{item.phone}, + #{item.sendTime}, + #{item.msSmsTemplateId}, + #{item.createBy}, + #{item.sendStatus}, + sysdate(),#{sid},#{reason} + ) @@ -97,10 +96,20 @@ reason=#{reason} where sid = #{sid} - + update ms_sms_send_record - set send_content= #{sendContent}, - update_time=#{updateTime} + + case_appli_id = #{caseId}, + case_num = #{caseNum}, + phone = #{phone}, + + send_time = #{sendTime}, + ms_sms_template_id = #{msSmsTemplateId}, + + send_status = #{sendStatus}, + sid = #{sid}, + reason = #{reason} + where id = #{id}