功能优化

This commit is contained in:
18792927508
2024-04-18 09:32:37 +08:00
parent e5c8ebfb31
commit 6da9516d82
55 changed files with 1790 additions and 1177 deletions
@@ -1,17 +1,5 @@
package com.ruoyi.web.controller.system; 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.annotation.Log;
import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.controller.BaseController; 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.enums.BusinessType;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.service.ISysMenuService; 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)); return toAjax(menuService.deleteMenuById(menuId));
} }
/**
* 根据用户查询菜单权限字符
*/
@GetMapping("/getMenuPermsByUser")
public AjaxResult getMenuPermsByUser()
{
return menuService.getMenuPermsByUser();
}
} }
@@ -44,6 +44,17 @@ public class WeChatUserController extends BaseController {
} }
return weChatUserService.sendCode(userVO); return weChatUserService.sendCode(userVO);
} }
/**
* 获取邮箱验证码
* @param email
* @return
*/
@Anonymous
@GetMapping("/sendEmailCode")
public AjaxResult sendEmailCode( @RequestParam("email") String email)
{
return weChatUserService.sendEmailCode(email);
}
@Anonymous @Anonymous
@GetMapping("/roles") @GetMapping("/roles")
public AjaxResult roles() public AjaxResult roles()
@@ -10,7 +10,6 @@ import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.exception.EsignDemoException; import com.ruoyi.common.exception.EsignDemoException;
import com.ruoyi.common.utils.IdCardUtils; 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.MsCaseApplication;
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach; import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach;
import com.ruoyi.wisdomarbitrate.domain.vo.mscase.*; import com.ruoyi.wisdomarbitrate.domain.vo.mscase.*;
@@ -73,11 +72,10 @@ public class MsCaseApplicationController extends BaseController {
/** /**
* 新增案件 * 新增案件
*/ */
// todo 重复提交校验
@PostMapping("/insert") @PostMapping("/insert")
public AjaxResult insert(@RequestBody MsCaseApplicationVO caseApplication ) public AjaxResult insert(@RequestBody MsCaseApplicationVO caseApplication )
{ {
if( caseApplication.getAffiliate()==null|| caseApplication.getOrganizeFlag()==null){ if( caseApplication.getAffiliate()==null){
error("参数校验失败"); error("参数校验失败");
} }
AjaxResult ajaxResult = AjaxResult.success(); AjaxResult ajaxResult = AjaxResult.success();
@@ -390,17 +388,7 @@ public class MsCaseApplicationController extends BaseController {
return success(videoService.reserveConferenceList(caseId)); return success(videoService.reserveConferenceList(caseId));
} }
/**
* 查询短信发送记录
* @param smsSendRecord
* @return
*/
@PostMapping("/smsRecord")
public TableDataInfo getSmsSendRecord(@RequestBody SmsSendRecord smsSendRecord){
startPage();
List<SmsSendRecord> list = caseApplicationService.getSmsSendRecord(smsSendRecord);
return getDataTable(list);
}
/** /**
* 保存onlyOffice在线编辑的文件 * 保存onlyOffice在线编辑的文件
* @param * @param
@@ -125,6 +125,8 @@ public class MsVideoConferenceController extends BaseController {
.useId(SecurityUtils.getUserId()) .useId(SecurityUtils.getUserId())
.useAccount(SecurityUtils.getUsername()) .useAccount(SecurityUtils.getUsername())
.build(); .build();
// 先删除之前的附件
msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(caseId,annexType);
msCaseAttachMapper.save(caseAttach); msCaseAttachMapper.save(caseAttach);
return caseAttach.getAnnexId(); return caseAttach.getAnnexId();
} }
@@ -1,35 +1,74 @@
package com.ruoyi.web.controller.wisdomarbitrate.sendrecord; package com.ruoyi.web.controller.wisdomarbitrate.sendrecord;
import cn.hutool.core.collection.CollectionUtil;
import com.ruoyi.common.annotation.Anonymous; 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.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.dto.sendrecord.SmsSendRecord;
import com.ruoyi.wisdomarbitrate.domain.vo.shortmessage.ReSendMessageVO; import com.ruoyi.wisdomarbitrate.domain.vo.shortmessage.ReSendMessageVO;
import com.ruoyi.wisdomarbitrate.mapper.sendrecord.SmsRecordMapper; import com.ruoyi.wisdomarbitrate.mapper.sendrecord.SmsRecordMapper;
import com.ruoyi.wisdomarbitrate.service.shortmessage.ShortMessageService; import com.ruoyi.wisdomarbitrate.service.shortmessage.ShortMessageService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import tk.mybatis.mapper.entity.Example;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List;
@RestController @RestController
@RequestMapping("/shortMessage") @RequestMapping("/shortMessage")
public class ShortMessageController { public class ShortMessageController extends BaseController {
@Autowired @Autowired
private SmsRecordMapper smsRecordMapper; private SmsRecordMapper smsRecordMapper;
@Autowired @Autowired
private ShortMessageService shortMessageService; private ShortMessageService shortMessageService;
@Autowired
MsSmsSendRecordParamMapper recordParamMapper;
@Autowired
MsSmsSendHistoryRecordParamMapper historyRecordParamMapper;
/**
* 查询短信发送记录
* @param smsSendRecord
* @return
*/
@GetMapping("/recordList")
public TableDataInfo smsSendRecordList( SmsSendRecord smsSendRecord){
startPage();
List<SmsSendRecord> list = shortMessageService.smsSendRecordList(smsSendRecord);
return getDataTable(list);
}
@Anonymous @Anonymous
@PostMapping("/updateSendContent") @PostMapping("/updateSendContent")
public AjaxResult update(@RequestBody SmsSendRecord smsSendRecord) { public AjaxResult update(@RequestBody SmsSendRecord smsSendRecord) {
if (smsSendRecord != null && smsSendRecord.getId() != null) { if(smsSendRecord == null|| smsSendRecord.getId() == null || CollectionUtil.isEmpty(smsSendRecord.getTemplateParams())){
return AjaxResult.error("参数校验失败");
}
// 查询当前版本记录
SmsSendRecord oldSendRecord = smsRecordMapper.selectById(smsSendRecord.getId()); SmsSendRecord oldSendRecord = smsRecordMapper.selectById(smsSendRecord.getId());
smsSendRecord.setUpdateTime(new Date()); smsSendRecord.setUpdateTime(new Date());
smsRecordMapper.updateSendContent(smsSendRecord); // 更新短信内容,先删除短信记录参数表
shortMessageService.insertShortMessageHistoryRecord(oldSendRecord); Example recordParamExam = new Example(MsSmsSendRecordParam.class);
return AjaxResult.success(); recordParamExam.createCriteria().andEqualTo("smsRecordId", smsSendRecord.getId());
recordParamMapper.deleteByExample(recordParamExam);
// 新增短信记录参数表
List<MsSmsSendRecordParam> recordParams = new ArrayList<>();
for (MsSmsTemplateParam templateParam : smsSendRecord.getTemplateParams()) {
MsSmsSendRecordParam recordParam = new MsSmsSendRecordParam();
recordParam.setSmsRecordId(smsSendRecord.getId());
recordParam.setParamValue(templateParam.getParamValue());
recordParams.add(recordParam);
} }
return AjaxResult.error("更新失败"); recordParamMapper.batchInsert(recordParams);
shortMessageService.insertShortMessageHistoryRecord(oldSendRecord,recordParams);
return AjaxResult.success();
} }
/** /**
@@ -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<MsSmsTemplate> 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());
}
}
@@ -47,6 +47,7 @@ public class CacheConstants
*/ */
public static final String PWD_ERR_CNT_KEY = "pwd_err_cnt:"; 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 WE_CHAT_SMS_VERIFY_CODE_KEY="we_chat_sms_verify_code:";
public static final String EMAIL_VERIFY_CODE_KEY="email_verify_code:";
/** /**
* 案件 redis key * 案件 redis key
*/ */
@@ -68,7 +68,7 @@ public class UserConstants
* 用户名长度限制 * 用户名长度限制
*/ */
public static final int USERNAME_MIN_LENGTH = 2; public static final int USERNAME_MIN_LENGTH = 2;
public static final int USERNAME_MAX_LENGTH = 20; public static final int USERNAME_MAX_LENGTH = 50;
/** /**
* 密码长度限制 * 密码长度限制
@@ -47,12 +47,12 @@ public class EmailOutUtil {
// private static String fromOut; // private static String fromOut;
@Value("${spring.mail.host}") @Value("${spring.mail.host}")
private String hostOut; private String hostOut;
// @Value("${spring.mail.username}") @Value("${spring.mail.username}")
// private String usernameOut; private String usernameOut;
private String usernameOut="wq18792927508@163.com";
// @Value("${spring.mail.password}") @Value("${spring.mail.password}")
// private String passwordOut; private String passwordOut;
private String passwordOut= "WDFHKSEMCKVRELEA";
@Value("${spring.mail.port}") @Value("${spring.mail.port}")
private Integer portOut; private Integer portOut;
@@ -77,7 +77,7 @@ public class EmailOutUtil {
public Boolean sendMessage(String to, String subject, String content, String from, JavaMailSender mailSender) { public Boolean sendMessage(String to, String subject, String content, String from, JavaMailSender mailSender) {
try { try {
if(mailSender==null){ if(mailSender==null){
rebuildMailSender(); mailSender= rebuildMailSender();
} }
// 创建一个邮件对象 // 创建一个邮件对象
SimpleMailMessage msg = new SimpleMailMessage(); SimpleMailMessage msg = new SimpleMailMessage();
@@ -97,7 +97,6 @@ public class EmailOutUtil {
return false; return false;
} }
return true; return true;
////System.out.println("发送成功:" + from + ":to:" + to);
} }
/** /**
@@ -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;
}
}
@@ -1,26 +1,19 @@
package com.ruoyi.common.utils; package com.ruoyi.common.utils;
import cn.hutool.core.io.resource.ClassPathResource;
import com.deepoove.poi.XWPFTemplate; import com.deepoove.poi.XWPFTemplate;
import com.deepoove.poi.config.Configure; import com.deepoove.poi.config.Configure;
import com.deepoove.poi.data.*; import com.deepoove.poi.data.*;
import com.deepoove.poi.data.style.ParagraphStyle; import com.deepoove.poi.data.style.ParagraphStyle;
import com.deepoove.poi.data.style.Style; import com.deepoove.poi.data.style.Style;
import com.deepoove.poi.policy.PictureRenderPolicy;
import com.deepoove.poi.util.PoitlIOUtils; 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 org.apache.poi.xwpf.usermodel.*;
import javax.print.Doc;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; 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.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@@ -205,6 +198,24 @@ public class WordUtil {
} }
} }
/**
* 替换标签内容
* @param map
* @param templatePath 模板路径
* @param outputPath 文件输出路径
*/
public static void render(Map<String, Object> 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();
}
}
} }
@@ -1,3 +1,4 @@
package com.ruoyi.system.domain.entity.log; package com.ruoyi.system.domain.entity.log;
import lombok.Getter; import lombok.Getter;
@@ -1,9 +1,15 @@
package com.ruoyi.system.domain.entity.shortmessage; package com.ruoyi.system.domain.entity.shortmessage;
import java.util.Date; import lombok.AllArgsConstructor;
import javax.persistence.*; 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 @Data
@AllArgsConstructor @AllArgsConstructor
@@ -20,6 +26,11 @@ public class MsSmsSendHistoryRecord {
*/ */
@Column(name = "case_appli_id") @Column(name = "case_appli_id")
private Long caseAppliId; private Long caseAppliId;
/**
* 短信模板表主键id
*/
@Column(name = "ms_sms_template_id")
private Long msSmsTemplateId;
/** /**
* 案件编号 * 案件编号
@@ -44,11 +55,6 @@ public class MsSmsSendHistoryRecord {
@Column(name = "send_status") @Column(name = "send_status")
private Long sendStatus; private Long sendStatus;
/**
* 发送内容
*/
@Column(name = "send_content")
private String sendContent;
/** /**
* 创建时间 * 创建时间
@@ -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;
}
@@ -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;
}
@@ -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<MsSmsTemplateParam> templateParams;
}
@@ -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;
}
@@ -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<MsSmsSendHistoryRecordParam> {
/**
* 批量新增
* @param historyRecordParams
*/
@Select("<script> INSERT INTO ms_sms_send_history_record_param (sms_record_history_id, param_value)\n" +
" VALUES\n" +
" <foreach item=\"item\" index=\"index\" collection=\"list\" separator=\",\">\n" +
" (#{item.smsRecordHistoryId}, #{item.paramValue})\n" +
" </foreach> " +
"</script>")
void batchInsert(@Param("list") List<MsSmsSendHistoryRecordParam> historyRecordParams);
}
@@ -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<MsSmsSendRecordParam> {
/**
* 批量插入
* @param list
*/
@Select("<script> INSERT INTO ms_sms_send_record_param (sms_record_id, param_value)\n" +
" VALUES\n" +
" <foreach item=\"item\" index=\"index\" collection=\"list\" separator=\",\">\n" +
" (#{item.smsRecordId}, #{item.paramValue})\n" +
" </foreach> " +
"</script>")
void batchInsert(@Param("list") List<MsSmsSendRecordParam> list);
}
@@ -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<MsSmsTemplate> {
}
@@ -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<MsSmsTemplateParam> {
@Select("<script> INSERT INTO ms_sms_template_param (sms_template_id, param,param_name)\n" +
" VALUES\n" +
" <foreach item=\"item\" index=\"index\" collection=\"list\" separator=\",\">\n" +
" (#{item.smsTemplateId}, #{item.param}, #{item.paramName})\n" +
" </foreach> " +
"</script>")
void batchInsert(@Param("list") List<MsSmsTemplateParam> templateParams);
}
@@ -1,5 +1,6 @@
package com.ruoyi.system.service; 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.TreeSelect;
import com.ruoyi.common.core.domain.entity.SysMenu; import com.ruoyi.common.core.domain.entity.SysMenu;
import com.ruoyi.system.domain.vo.RouterVo; import com.ruoyi.system.domain.vo.RouterVo;
@@ -149,4 +150,10 @@ public interface ISysMenuService
*/ */
Set<String> selectAdminMenu(); Set<String> selectAdminMenu();
/**
* 根据用户查询菜单权限字符
* @return
*/
AjaxResult getMenuPermsByUser();
} }
@@ -1,5 +1,6 @@
package com.ruoyi.system.service.impl; package com.ruoyi.system.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.ruoyi.common.annotation.DataScope; import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.constant.CacheConstants; import com.ruoyi.common.constant.CacheConstants;
import com.ruoyi.common.constant.UserConstants; 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.SysDeptMapper;
import com.ruoyi.system.mapper.SysRoleMapper; import com.ruoyi.system.mapper.SysRoleMapper;
import com.ruoyi.system.service.ISysDeptService; import com.ruoyi.system.service.ISysDeptService;
import com.ruoyi.wisdomarbitrate.mapper.mscase.MsCaseApplicationMapper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -39,6 +41,8 @@ public class SysDeptServiceImpl implements ISysDeptService
private SysRoleMapper roleMapper; private SysRoleMapper roleMapper;
@Autowired @Autowired
private RedisCache redisCache; private RedisCache redisCache;
@Autowired
MsCaseApplicationMapper caseApplicationMapper;
/** /**
* 查询部门管理数据 * 查询部门管理数据
@@ -302,6 +306,11 @@ public class SysDeptServiceImpl implements ISysDeptService
@Override @Override
public int deleteDeptById(Long deptId) public int deleteDeptById(Long deptId)
{ {
// 查询部门是否与案件有关
List<Long> caseList = caseApplicationMapper.selectCaseByDeptId(deptId);
if(CollectionUtil.isNotEmpty(caseList)){
throw new ServiceException("该部门有关联案件,不允许删除");
}
SysDept sysDept = deptMapper.selectDeptById(deptId); SysDept sysDept = deptMapper.selectDeptById(deptId);
if(sysDept!=null) { if(sysDept!=null) {
// 删除缓存 // 删除缓存
@@ -3,6 +3,7 @@ package com.ruoyi.system.service.impl;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import com.ruoyi.common.constant.Constants; import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.constant.UserConstants; 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.TreeSelect;
import com.ruoyi.common.core.domain.entity.SysMenu; import com.ruoyi.common.core.domain.entity.SysMenu;
import com.ruoyi.common.core.domain.entity.SysRole; import com.ruoyi.common.core.domain.entity.SysRole;
@@ -139,6 +140,14 @@ public class SysMenuServiceImpl implements ISysMenuService
return permsSet; return permsSet;
} }
@Override
public AjaxResult getMenuPermsByUser() {
AjaxResult result = AjaxResult.success();
List<String> perms = menuMapper.selectMenuPermsByUserId(SecurityUtils.getUserId());
result.put("perms",perms);
return result;
}
/** /**
* 根据用户ID查询菜单 * 根据用户ID查询菜单
* *
@@ -21,6 +21,7 @@ import com.ruoyi.system.domain.SysUserRole;
import com.ruoyi.system.mapper.*; import com.ruoyi.system.mapper.*;
import com.ruoyi.system.service.ISysConfigService; import com.ruoyi.system.service.ISysConfigService;
import com.ruoyi.system.service.ISysUserService; import com.ruoyi.system.service.ISysUserService;
import com.ruoyi.wisdomarbitrate.mapper.mscase.MsCaseApplicationMapper;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@@ -30,6 +31,7 @@ import org.springframework.util.CollectionUtils;
import javax.validation.Validator; import javax.validation.Validator;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@@ -70,6 +72,8 @@ public class SysUserServiceImpl implements ISysUserService {
protected Validator validator; protected Validator validator;
@Autowired @Autowired
private RedisCache redisCache; private RedisCache redisCache;
@Autowired
MsCaseApplicationMapper msCaseApplicationMapper;
/** /**
* 根据条件分页查询用户列表 * 根据条件分页查询用户列表
@@ -460,9 +464,16 @@ public class SysUserServiceImpl implements ISysUserService {
@Transactional @Transactional
public int deleteUserById(Long userId) { public int deleteUserById(Long userId) {
// 删除用户与角色关联 // 删除用户与角色关联
userRoleMapper.deleteUserRoleByUserId(userId); // userRoleMapper.deleteUserRoleByUserId(userId);
// 删除用户与岗位表 // 删除用户与岗位表
userPostMapper.deleteUserPostByUserId(userId); // userPostMapper.deleteUserPostByUserId(userId);
// 与案件有关的人员不能删除
List<Long> userIds = new ArrayList<>();
userIds.add(userId);
List<Long> caseIds= msCaseApplicationMapper.countCasePerson(userIds);
if(CollectionUtil.isNotEmpty(caseIds)){
throw new ServiceException("该人员已参与案件,不能删除");
}
int i = userMapper.deleteUserById(userId); int i = userMapper.deleteUserById(userId);
// 删除缓存 // 删除缓存
redisCache.deleteObject(CacheConstants.USER_KEY+userId); redisCache.deleteObject(CacheConstants.USER_KEY+userId);
@@ -478,6 +489,14 @@ public class SysUserServiceImpl implements ISysUserService {
@Override @Override
@Transactional @Transactional
public int deleteUserByIds(Long[] userIds) { public int deleteUserByIds(Long[] userIds) {
// 校验是否与案件关联
if(userIds==null || userIds.length==0){
throw new ServiceException("请选择删除的用户");
}
List<Long> caseIds= msCaseApplicationMapper.countCasePerson(new ArrayList<>(Arrays.asList(userIds)));
if(CollectionUtil.isNotEmpty(caseIds)){
throw new ServiceException("删除人员中存在与案件关联的人员,不能删除");
}
for (Long userId : userIds) { for (Long userId : userIds) {
checkUserAllowed(new SysUser(userId)); checkUserAllowed(new SysUser(userId));
checkUserDataScope(userId); checkUserDataScope(userId);
@@ -31,6 +31,10 @@ public class IdentityAuthentication extends BaseEntity {
* 短信验证码 * 短信验证码
*/ */
private String VerifyCode; private String VerifyCode;
/**
* email验证码
*/
private String emailVerifyCode;
private String passWord; private String passWord;
private String phone; private String phone;
/** /**
@@ -47,6 +51,14 @@ public class IdentityAuthentication extends BaseEntity {
/** 认证状态 */ /** 认证状态 */
private Integer certificationStatus; private Integer certificationStatus;
public String getEmailVerifyCode() {
return emailVerifyCode;
}
public void setEmailVerifyCode(String emailVerifyCode) {
this.emailVerifyCode = emailVerifyCode;
}
public Integer getCertificationStatus() { public Integer getCertificationStatus() {
return certificationStatus; return certificationStatus;
} }
@@ -2,11 +2,13 @@ package com.ruoyi.wisdomarbitrate.domain.dto.sendrecord;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.core.domain.BaseEntity; import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.system.domain.entity.sms.MsSmsTemplateParam;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import java.util.Date; import java.util.Date;
import java.util.List;
@Data @Data
@AllArgsConstructor @AllArgsConstructor
@@ -16,6 +18,10 @@ public class SmsSendRecord extends BaseEntity {
* ID * ID
*/ */
private Long id; private Long id;
/**
* 短信模板主键id
*/
private Long msSmsTemplateId;
/** /**
* 案件申请id * 案件申请id
*/ */
@@ -33,10 +39,6 @@ public class SmsSendRecord extends BaseEntity {
*/ */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date sendTime; private Date sendTime;
/**
* 发送内容
*/
private String sendContent;
/** /**
* 发送状态 * 发送状态
@@ -50,6 +52,19 @@ public class SmsSendRecord extends BaseEntity {
* 失败原因 * 失败原因
*/ */
private String reason; private String reason;
/**
* 短信内容
*/
private String sendContent;
/**
* 腾讯云模板id
*/
private String templateId;
/**
* 模板内容
*/
private String templateContent;
private List<MsSmsTemplateParam> templateParams;
public SmsSendRecord(Long caseId, String caseNum, String phone, Date sendTime, String sendContent,String sid) { public SmsSendRecord(Long caseId, String caseNum, String phone, Date sendTime, String sendContent,String sid) {
this.caseId = caseId; this.caseId = caseId;
@@ -43,6 +43,11 @@ public class MsCaseAffiliate{
*/ */
@Transient @Transient
private String code; private String code;
/**
* 用户名
*/
@Transient
private String userName;
/** /**
* 法定代表人 * 法定代表人
@@ -64,6 +69,11 @@ public class MsCaseAffiliate{
*/ */
@Column(name = "operator_flag") @Column(name = "operator_flag")
private Integer operatorFlag=1; private Integer operatorFlag=1;
/**
* 是否机构申请,0-自然人,1-申请机构,默认0
*/
@Column(name = "organize_flag")
private Integer organizeFlag=0;
/** /**
* 电话 * 电话
*/ */
@@ -131,5 +141,10 @@ public class MsCaseAffiliate{
*/ */
@Transient @Transient
private String applicantOrgName; private String applicantOrgName;
/**
* 角色id
*/
@Transient
private Long roleId;
} }
@@ -205,11 +205,7 @@ public class MsCaseApplication {
*/ */
@Column(name = "is_reconci") @Column(name = "is_reconci")
private Integer isReconci; private Integer isReconci;
/**
* 是否机构申请,0-自然人,1-申请机构,默认0
*/
@Column(name = "organize_flag")
private Integer organizeFlag;
/** /**
* 案件来源,YC-乙巢,空字符串-北明 * 案件来源,YC-乙巢,空字符串-北明
*/ */
@@ -225,5 +221,7 @@ public class MsCaseApplication {
*/ */
@Transient @Transient
private String rejectReason; private String rejectReason;
@Transient
private Integer organizeFlag=0;
} }
@@ -1,5 +1,6 @@
package com.ruoyi.wisdomarbitrate.domain.vo.shortmessage; package com.ruoyi.wisdomarbitrate.domain.vo.shortmessage;
import com.ruoyi.system.domain.entity.sms.MsSmsTemplateParam;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
@@ -20,9 +21,13 @@ public class ReSendMessageVO {
* 手机号 * 手机号
*/ */
private String phone; private String phone;
/**
* 短信id
*/
private Long id;
/** /**
* 短信模版参数值 * 短信模版参数值
*/ */
private List<String> paramValues; private List<MsSmsTemplateParam> templateParams;
} }
@@ -52,4 +52,18 @@ public interface MsCaseApplicationMapper extends Mapper<MsCaseApplication> {
Long selectMaxRoomId(); Long selectMaxRoomId();
List<CaseToDoCount> todoCount(@Param("req")MsCaseApplicationReq req, @Param("caseFlowIds") List<Integer> caseFlowIds, @Param("roleIds") List<Long> roleIds); List<CaseToDoCount> todoCount(@Param("req")MsCaseApplicationReq req, @Param("caseFlowIds") List<Integer> caseFlowIds, @Param("roleIds") List<Long> roleIds);
/**
* 根据用户id查询是否和案件有关
* @param userIds
* @return
*/
List<Long> countCasePerson(@Param("userIds") List<Long> userIds);
/**
* 查询部门是否与案件有关
* @param deptId
* @return
*/
List<Long> selectCaseByDeptId(@Param("deptId") Long deptId);
} }
@@ -22,14 +22,10 @@ public interface SmsRecordMapper {
SmsSendRecord selectBySId(@Param("sid") String sid); SmsSendRecord selectBySId(@Param("sid") String sid);
void updateStatus (SmsSendRecord smsSendRecord); void updateStatus (SmsSendRecord smsSendRecord);
/**
* 更新短信发送内容
* @param smsSendRecord
* @return
*/
int updateSendContent(SmsSendRecord smsSendRecord);
/** /**
* 通过id查询短信发送记录 * 通过id查询短信发送记录
*/ */
SmsSendRecord selectById(@Param("id") Long id); SmsSendRecord selectById(@Param("id") Long id);
void update(SmsSendRecord smsSendRecord);
} }
@@ -14,4 +14,12 @@ public interface WeChatUserService {
AjaxResult registerUser(IdentityAuthentication ientityAuthentication); AjaxResult registerUser(IdentityAuthentication ientityAuthentication);
/**
* 获取邮箱验证码
* @param email
* @return
*/
AjaxResult sendEmailCode(String email);
} }
@@ -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.domain.entity.SysUser;
import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.enums.SMSStatusEnum; import com.ruoyi.common.enums.SMSStatusEnum;
import com.ruoyi.common.utils.EmailOutUtil;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.SmsUtils;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.spring.SpringUtils; import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.system.mapper.SysRoleMapper; 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.domain.vo.miniprogress.WeChatUserVO;
import com.ruoyi.wisdomarbitrate.mapper.miniprogress.IdentityAuthenticationMapper; import com.ruoyi.wisdomarbitrate.mapper.miniprogress.IdentityAuthenticationMapper;
import com.ruoyi.wisdomarbitrate.service.miniprogress.WeChatUserService; import com.ruoyi.wisdomarbitrate.service.miniprogress.WeChatUserService;
import com.ruoyi.wisdomarbitrate.utils.SmsUtils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -47,6 +48,8 @@ public class WeChatUserServiceImpl implements WeChatUserService {
private IdentityAuthenticationMapper identityAuthenticationMapper; private IdentityAuthenticationMapper identityAuthenticationMapper;
@Autowired @Autowired
private RedisCache redisCache; private RedisCache redisCache;
@Autowired
private EmailOutUtil emailOutUtil;
@Override @Override
public AjaxResult sendCode(WeChatUserVO userVO) { public AjaxResult sendCode(WeChatUserVO userVO) {
@@ -64,12 +67,31 @@ public class WeChatUserServiceImpl implements WeChatUserService {
request.setTemplateParamSet(new String[]{ code}); request.setTemplateParamSet(new String[]{ code});
JSONObject resultObj = SmsUtils.sendSms(request); JSONObject resultObj = SmsUtils.sendSms(request);
if(resultObj.get("status")!=null && !resultObj.get("status").equals(SMSStatusEnum.FAIL.getCode())){ 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("短信发送成功"); return AjaxResult.success("短信发送成功");
}else { }else {
return AjaxResult.warn("短信发送失败"); 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) 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) 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)) if (StringUtils.isNotNull(codeCache))
{ {
return codeCache; return codeCache;
@@ -98,19 +120,23 @@ public class WeChatUserServiceImpl implements WeChatUserService {
return null; return null;
} }
private static String getVerifyCodeCacheKey(String key) {
return CacheConstants.WE_CHAT_SMS_VERIFY_CODE_KEY + key;
}
@Transactional @Transactional
@Override @Override
public AjaxResult registerUser(IdentityAuthentication ientityAuthentication) { 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)){ if(StrUtil.isEmpty(codeCache)){
return AjaxResult.warn("验证码校验失败"); return AjaxResult.warn("验证码校验失败");
}else if(!codeCache.equals(ientityAuthentication.getVerifyCode())){ }else if(!codeCache.equals(ientityAuthentication.getVerifyCode())){
return AjaxResult.warn("验证码校验失败"); 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()); SysUser sysUserName=sysUserMapper.checkUserNameUnique(ientityAuthentication.getUserName());
if(sysUserName!=null){ if(sysUserName!=null){
@@ -183,4 +209,6 @@ public class WeChatUserServiceImpl implements WeChatUserService {
return AjaxResult.success("注册成功"); return AjaxResult.success("注册成功");
} }
} }
@@ -4,13 +4,11 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SMSNotice; 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.SysDictData;
import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.enums.PushCaseStatusEnum; import com.ruoyi.common.enums.PushCaseStatusEnum;
import com.ruoyi.common.exception.EsignDemoException; import com.ruoyi.common.exception.EsignDemoException;
import com.ruoyi.system.domain.entity.flow.MsCaseFlow; 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.MsCaseAffiliate;
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseApplication; import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseApplication;
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach; import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach;
@@ -81,11 +79,7 @@ public interface MsCaseApplicationService {
*/ */
AjaxResult batchInsert(MsCaseBatchInsertVO vo); AjaxResult batchInsert(MsCaseBatchInsertVO vo);
/**
* 新增申请机构代理人
* @param affiliate
*/
void insertAgentUser(MsCaseAffiliate affiliate);
/** /**
* 修改案件 * 修改案件
@@ -115,6 +109,12 @@ public interface MsCaseApplicationService {
* @return * @return
*/ */
AjaxResult generateApplication(MsCaseApplicationReq req); AjaxResult generateApplication(MsCaseApplicationReq req);
/**
* 生成调解申请书
* @param req
* @return
*/
AjaxResult generateApplication1(MsCaseApplicationReq req);
/** /**
* 根据批次号和流程id查找未锁定的案件 * 根据批次号和流程id查找未锁定的案件
@@ -233,6 +233,7 @@ public interface MsCaseApplicationService {
* @param dictDataList 内置字段 * @param dictDataList 内置字段
*/ */
void createMediateApplication(MsCaseApplication application, List<MsCaseAffiliate> affiliates, String templatePath, List<String> bookmarkList, List<SysDictData> dictDataList, Integer templateType) ; void createMediateApplication(MsCaseApplication application, List<MsCaseAffiliate> affiliates, String templatePath, List<String> bookmarkList, List<SysDictData> dictDataList, Integer templateType) ;
void createMediateApplication1(MsCaseApplication application, List<MsCaseAffiliate> affiliates, String templatePath, List<String> bookmarkList, List<SysDictData> dictDataList, Integer templateType) ;
/** /**
* 调解书上传到onlyoffice服务器 * 调解书上传到onlyoffice服务器
* @param annexPath * @param annexPath
@@ -275,12 +276,7 @@ public interface MsCaseApplicationService {
* 根据登录人返回用户信息 * 根据登录人返回用户信息
*/ */
SysUser getUserInfo(); SysUser getUserInfo();
/**
* 查询短信发送记录
* @param smsSendRecord
* @return
*/
List<SmsSendRecord> getSmsSendRecord(SmsSendRecord smsSendRecord);
/** /**
* 保存onlyOffice在线编辑的文件 * 保存onlyOffice在线编辑的文件
* @param * @param
@@ -288,14 +284,7 @@ public interface MsCaseApplicationService {
*/ */
AjaxResult saveOnlyOfficeFile(MsCaseAttach caseAttach); 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 案件基本信息 * @param application 案件基本信息
@@ -310,14 +299,7 @@ public interface MsCaseApplicationService {
* @param affiliates * @param affiliates
*/ */
public void sendHearDateSms(MsCaseApplication application, List<MsCaseAffiliate> affiliates); public void sendHearDateSms(MsCaseApplication application, List<MsCaseAffiliate> affiliates);
/**
* 发送短信
* @param application
* @param affiliate
* @param notice
*/
public void sendNotice(MsCaseApplication application, MsCaseAffiliate affiliate,
SMSNoticeDO notice);
/** /**
* 申请操作人/被申操作人发送通知 * 申请操作人/被申操作人发送通知
* @param application * @param application
@@ -65,10 +65,5 @@ public interface MsCasePaymentService {
public void confirmPayment(MsCaseFlow currentFlow,MsCaseFlow nextFlow, MsCaseApplication application, CaseConfirmPayDTO dto); 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 );
} }
@@ -11,7 +11,6 @@ import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.enums.AnnexTypeEnum; import com.ruoyi.common.enums.AnnexTypeEnum;
import com.ruoyi.common.enums.PaymentStatusEnum; import com.ruoyi.common.enums.PaymentStatusEnum;
import com.ruoyi.common.enums.SMSStatusEnum;
import com.ruoyi.common.enums.YesOrNoEnum; import com.ruoyi.common.enums.YesOrNoEnum;
import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.SecurityUtils;
@@ -20,9 +19,10 @@ import com.ruoyi.dto.PayRequest;
import com.ruoyi.dto.PayResponse; import com.ruoyi.dto.PayResponse;
import com.ruoyi.system.domain.entity.flow.MsCaseFlow; import com.ruoyi.system.domain.entity.flow.MsCaseFlow;
import com.ruoyi.system.mapper.flow.MsCaseFlowMapper; 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.CaseConfirmPayDTO;
import com.ruoyi.wisdomarbitrate.domain.dto.mscase.CasePayDTO; 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.entity.mscase.*;
import com.ruoyi.wisdomarbitrate.domain.vo.mscase.PaymentDetailVO; import com.ruoyi.wisdomarbitrate.domain.vo.mscase.PaymentDetailVO;
import com.ruoyi.wisdomarbitrate.mapper.mscase.*; 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.MsCaseApplicationService;
import com.ruoyi.wisdomarbitrate.service.mscase.MsCasePaymentService; import com.ruoyi.wisdomarbitrate.service.mscase.MsCasePaymentService;
import com.ruoyi.wisdomarbitrate.utils.CaseLogUtils; import com.ruoyi.wisdomarbitrate.utils.CaseLogUtils;
import com.ruoyi.wisdomarbitrate.utils.SmsUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@@ -67,6 +68,10 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService {
private RedisCache redisCache; private RedisCache redisCache;
@Autowired @Autowired
private MsCaseAuditMapper auditMapper; private MsCaseAuditMapper auditMapper;
@Autowired
MsSmsTemplateMapper templateMapper;
@Autowired
MsSmsSendRecordParamMapper recordParamMapper;
@Override @Override
@@ -228,7 +233,6 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService {
} }
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.set("totalFee", totalFee); jsonObject.set("totalFee", totalFee);
// jsonObject.set("applicationOrganName", affiliate.getApplicationName());
return AjaxResult.success(jsonObject); return AjaxResult.success(jsonObject);
} }
@@ -342,7 +346,6 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService {
caseApplicationMapper.updateByPrimaryKeySelective(application); caseApplicationMapper.updateByPrimaryKeySelective(application);
if (dto.getApplicantConfirm() && dto.getYesOrNo().equals(YesOrNoEnum.YES.getCode())) { if (dto.getApplicantConfirm() && dto.getYesOrNo().equals(YesOrNoEnum.YES.getCode())) {
// 申请人确认缴费后将该案件存放到redis,5日之内如果案件状态还是待受理状态,则发送不受理通知书并自动结束 // 申请人确认缴费后将该案件存放到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); 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("未找到案件操作人员"); throw new ServiceException("未找到案件操作人员");
} }
if(dto.getApplicantConfirm()) { if(dto.getApplicantConfirm()) {
List<String> appPhones=new ArrayList<>();
// 申请人确认缴费 // 申请人确认缴费
for (MsCaseAffiliate affiliate : operatorList) { for (MsCaseAffiliate affiliate : operatorList) {
// 发送缴费通知 // 发送缴费通知
if (affiliate.getRoleType() == null) { if (affiliate.getRoleType() == null) {
continue; continue;
} }
if (affiliate.getRoleType().equals(1) || affiliate.getRoleType().equals(2)) { if (!appPhones.contains(affiliate.getPhone())&&(affiliate.getRoleType().equals(1) || affiliate.getRoleType().equals(2))) {
JSONObject jsonObject = new JSONObject(); appPhones.add(affiliate.getPhone());
SmsSendRecord smsSendRecord = null;
if (dto.getYesOrNo().equals(YesOrNoEnum.YES.getCode())) { if (dto.getYesOrNo().equals(YesOrNoEnum.YES.getCode())) {
// 缴费通过 // 缴费通过
// todo 短信 SmsUtils.sendSms(caseAppllication, "2051914", affiliate.getPhone(), new String[]{affiliate.getName()});
// 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);
} else { } else {
// todo 短信
// jsonObject = SmsUtils.sendSms(affiliate.getCaseAppliId(), "2074402", affiliate.getPhone(), new String[]{affiliate.getName(), caseAppllication.getCaseNum(), dto.getReason()});
// 2074402 调解系统确认缴费不通过通知 尊敬的{1}用户,您的{2}案件,确认缴费未通过,理由为{3},请知晓,如非本人操作,请忽略本短信 // 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 { }else {
List<String> resPhones=new ArrayList<>();
List<String> resAcceptPhones=new ArrayList<>();
// 被申请人确认缴费 // 被申请人确认缴费
for (MsCaseAffiliate affiliate : operatorList) { for (MsCaseAffiliate affiliate : operatorList) {
// 发送缴费通知 // 发送缴费通知
if (affiliate.getRoleType() == null) { if (affiliate.getRoleType() == null) {
continue; continue;
} }
if (affiliate.getRoleType().equals(3) || affiliate.getRoleType().equals(4)) { if (!resPhones.contains(affiliate.getPhone())&&(affiliate.getRoleType().equals(3) || affiliate.getRoleType().equals(4)) ) {
JSONObject jsonObject = new JSONObject(); resPhones.add(affiliate.getPhone());
SmsSendRecord smsSendRecord = null;
if (dto.getYesOrNo().equals(YesOrNoEnum.YES.getCode())) { if (dto.getYesOrNo().equals(YesOrNoEnum.YES.getCode())) {
// todo 短信
// 缴费通过 // 缴费通过
// jsonObject = SmsUtils.sendSms(affiliate.getCaseAppliId(), "2051914", affiliate.getPhone(), new String[]{affiliate.getName()}); SmsUtils.sendSms(caseAppllication, "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);
} else { } else {
// todo 短信
// jsonObject = SmsUtils.sendSms(affiliate.getCaseAppliId(), "2074402", affiliate.getPhone(), new String[]{affiliate.getName(), caseAppllication.getCaseNum(), dto.getReason()});
// 2074402 调解系统确认缴费不通过通知 尊敬的{1}用户,您的{2}案件,确认缴费未通过,理由为{3},请知晓,如非本人操作,请忽略本短信 // 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())) { if( dto.getYesOrNo().equals(YesOrNoEnum.YES.getCode()) && !resAcceptPhones.contains(affiliate.getPhone())) {
// 申请人发送受理短信 resAcceptPhones.add(affiliate.getPhone());
casePaymentService.sendAcceptSms(dto, caseAppllication, affiliate.getName(), 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()); application.setPayType(dto.getPayType());
// 修改缴费附件 // 修改缴费附件
if (CollectionUtil.isNotEmpty(dto.getPayOrderList())) { if (CollectionUtil.isNotEmpty(dto.getPayOrderList())) {
for (MsCaseAttach caseAttach : dto.getPayOrderList()) { for (MsCaseAttach caseAttach : dto.getPayOrderList()) {
// 先删除之前的缴费 // 先删除之前的缴费
if(currentFlow.getButtonAuthFlag().equals("caseManagement:list:pay")){ if(currentFlow.getButtonAuthFlag().equals("caseManagement:list:pay")){
@@ -23,10 +23,11 @@ import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.file.SaaSAPIFileUtils; import com.ruoyi.common.utils.file.SaaSAPIFileUtils;
import com.ruoyi.system.domain.entity.flow.MsCaseFlow; 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.domain.vo.flow.MsCaseFlowVO;
import com.ruoyi.system.mapper.SysRoleMapper;
import com.ruoyi.system.mapper.SysUserMapper; import com.ruoyi.system.mapper.SysUserMapper;
import com.ruoyi.system.mapper.flow.MsCaseFlowMapper; import com.ruoyi.system.mapper.flow.MsCaseFlowMapper;
import com.ruoyi.system.mapper.shortmessage.MsSendMailHistoryRecordMapper;
import com.ruoyi.system.service.impl.BeiMingInterfaceService; import com.ruoyi.system.service.impl.BeiMingInterfaceService;
import com.ruoyi.wisdomarbitrate.domain.dto.dept.DeptIdentify; import com.ruoyi.wisdomarbitrate.domain.dto.dept.DeptIdentify;
import com.ruoyi.wisdomarbitrate.domain.dto.dept.SealManage; 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.service.mscase.MsSignSealService;
import com.ruoyi.wisdomarbitrate.utils.CaseLogUtils; import com.ruoyi.wisdomarbitrate.utils.CaseLogUtils;
import com.ruoyi.wisdomarbitrate.utils.SignAward; import com.ruoyi.wisdomarbitrate.utils.SignAward;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -108,8 +110,8 @@ public class MsSignSealServiceImpl implements MsSignSealService {
@Autowired @Autowired
private SendMailRecordMapper sendMailRecordMapper; private SendMailRecordMapper sendMailRecordMapper;
@Autowired @Value("${spring.mail.username}")
private SysRoleMapper roleMapper; private String emailFrom;
// 北明配置 // 北明配置
@Value("${BMConfig.userName}") @Value("${BMConfig.userName}")
private String BMUserName; private String BMUserName;
@@ -119,6 +121,8 @@ public class MsSignSealServiceImpl implements MsSignSealService {
private String BMSyncSource; private String BMSyncSource;
@Autowired @Autowired
BeiMingInterfaceService beiMingInterfaceService; BeiMingInterfaceService beiMingInterfaceService;
@Autowired
private MsSendMailHistoryRecordMapper sendMailHistoryRecordMapper;
@@ -346,7 +350,6 @@ public class MsSignSealServiceImpl implements MsSignSealService {
String annexPath = caseAttach.getAnnexPath(); String annexPath = caseAttach.getAnnexPath();
String path = "/home/ruoyi/uploadPath/" + annexPath.substring(startIndex+1); String path = "/home/ruoyi/uploadPath/" + annexPath.substring(startIndex+1);
File file = new File(path); File file = new File(path);
// todo 部署放开
if (!file.exists()) { if (!file.exists()) {
Gson gson = new Gson(); Gson gson = new Gson();
MsSealSignRecord sealSignRecord = new MsSealSignRecord(); MsSealSignRecord sealSignRecord = new MsSealSignRecord();
@@ -433,30 +436,8 @@ public class MsSignSealServiceImpl implements MsSignSealService {
} }
boolean appEmailFlag = sendCaseEmail(caseApplication1, affiliate.getEmail(), caseAttachList); 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(),""); CaseLogUtils.insertCaseLog(caseApplication1.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(),"");
@@ -473,31 +454,14 @@ public class MsSignSealServiceImpl implements MsSignSealService {
@Transactional @Transactional
public AjaxResult msCaseSign(MsSignSealDTO dto) { public AjaxResult msCaseSign(MsSignSealDTO dto) {
Long caseId = dto.getCaseId(); Long caseId = dto.getCaseId();
MsCaseAffiliate caseAffiliate = msCaseAffiliateMapper.selectByPrimaryKey(caseId); // MsCaseAffiliate caseAffiliate = msCaseAffiliateMapper.selectByPrimaryKey(caseId);
MsCaseApplication caseApplicationselect = msCaseApplicationMapper.selectByPrimaryKey(caseId); MsCaseApplication caseApplicationselect = msCaseApplicationMapper.selectByPrimaryKey(caseId);
// 查询当前节点 // 查询当前节点
MsCaseFlow currentFlow = caseFlowMapper.selectByPrimaryKey(caseApplicationselect.getCaseFlowId()); MsCaseFlow currentFlow = caseFlowMapper.selectByPrimaryKey(caseApplicationselect.getCaseFlowId());
if (currentFlow == null) { if (currentFlow == null) {
return AjaxResult.error("当前流程不存在"); return AjaxResult.error("当前流程不存在");
} }
// if (dto.getIsSignApply() != null && dto.getIsSignApply().intValue() == 1) { if (dto.getIsSignApply() != null && dto.getIsSignApply().equals(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);
// 根据流程id查找下一个流程节点 // 根据流程id查找下一个流程节点
MsCaseFlow nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId()); MsCaseFlow nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId());
caseApplicationselect.setCaseFlowId(nextFlow.getId()); caseApplicationselect.setCaseFlowId(nextFlow.getId());
@@ -505,24 +469,8 @@ public class MsSignSealServiceImpl implements MsSignSealService {
caseApplicationMapper.updateByPrimaryKeySelective(caseApplicationselect); caseApplicationMapper.updateByPrimaryKeySelective(caseApplicationselect);
CaseLogUtils.insertCaseLog(caseApplicationselect.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(),null); 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) { if (dto.getIsSignRespon() != null && dto.getIsSignRespon().equals(1)) {
// todo 签收不要该字段
// caseAffiliate.setIsSignRespon(1);
// todo 签收不要该字段
// msCaseAffiliateMapper.updateByPrimaryKeySelective(caseAffiliate);
// 根据流程id查找下一个流程节点 // 根据流程id查找下一个流程节点
MsCaseFlow nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId()); MsCaseFlow nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId());
@@ -531,7 +479,7 @@ public class MsSignSealServiceImpl implements MsSignSealService {
caseApplicationMapper.updateByPrimaryKeySelective(caseApplicationselect); caseApplicationMapper.updateByPrimaryKeySelective(caseApplicationselect);
CaseLogUtils.insertCaseLog(caseApplicationselect.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(),null); CaseLogUtils.insertCaseLog(caseApplicationselect.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(),null);
CaseLogUtils.insertCaseLog(caseApplicationselect.getId(), 17, "结束", null); CaseLogUtils.insertCaseLog(caseApplicationselect.getId(), 17, "结束", null);
// todo 被申请人签收结束对接北明,为调解成功状态 // 被申请人签收结束对接北明,为调解成功状态
if(StrUtil.isEmpty(caseApplicationselect.getCaseSource())) { if(StrUtil.isEmpty(caseApplicationselect.getCaseSource())) {
applicationService.pushStatusToBM(caseApplicationselect, PushCaseStatusEnum.SUCCESS); applicationService.pushStatusToBM(caseApplicationselect, PushCaseStatusEnum.SUCCESS);
} }
@@ -543,9 +491,7 @@ public class MsSignSealServiceImpl implements MsSignSealService {
@Override @Override
public AjaxResult msCaseSignUrlApplyPC(MsSignSealDTO dto) throws EsignDemoException { public AjaxResult msCaseSignUrlApplyPC(MsSignSealDTO dto) throws EsignDemoException {
// todo
Long caseId = dto.getCaseId(); Long caseId = dto.getCaseId();
//MsCaseAffiliate caseAffiliate = msCaseAffiliateMapper.selectByPrimaryKey(caseId);
List<MsCaseAffiliate> affiliates = applicationService.selectAffliatesByCaseId(caseId); List<MsCaseAffiliate> affiliates = applicationService.selectAffliatesByCaseId(caseId);
if(CollectionUtil.isEmpty(affiliates)){ if(CollectionUtil.isEmpty(affiliates)){
return AjaxResult.error("未找到案件相关人员"); return AjaxResult.error("未找到案件相关人员");
@@ -612,7 +558,7 @@ public class MsSignSealServiceImpl implements MsSignSealService {
} }
if(resOpt.get().getUserId()!=null && resOpt.get().getUserId().equals(userId)){ if(resOpt.get().getUserId()!=null && resOpt.get().getUserId().equals(userId)){
// 被申
SealSignRecord sealSignRecordres = new SealSignRecord(); SealSignRecord sealSignRecordres = new SealSignRecord();
MsSealSignRecord mssealSignRecord = new MsSealSignRecord(); MsSealSignRecord mssealSignRecord = new MsSealSignRecord();
mssealSignRecord.setCaseAppliId(caseId); mssealSignRecord.setCaseAppliId(caseId);
@@ -636,6 +582,7 @@ public class MsSignSealServiceImpl implements MsSignSealService {
} }
} }
if(mediatorCount>0){ if(mediatorCount>0){
// 调解员
SealSignRecord sealSignRecordres = new SealSignRecord(); SealSignRecord sealSignRecordres = new SealSignRecord();
MsSealSignRecord mssealSignRecord = new MsSealSignRecord(); MsSealSignRecord mssealSignRecord = new MsSealSignRecord();
mssealSignRecord.setCaseAppliId(caseId); mssealSignRecord.setCaseAppliId(caseId);
@@ -710,7 +657,7 @@ public class MsSignSealServiceImpl implements MsSignSealService {
Integer caseNode = currentFlow.getNodeId(); Integer caseNode = currentFlow.getNodeId();
String caseStatusName = currentFlow.getCaseStatusName(); String caseStatusName = currentFlow.getCaseStatusName();
if("SIGN_MISSON_COMPLETE".equals(action) && signResult==2){ if("SIGN_MISSON_COMPLETE".equals(action) && signResult==2){
if(mediaResult.intValue()==1){ if(mediaResult.equals(1)){
//调解 //调解
if(StringUtils.isNotEmpty(accountMobile)&&accountMobile.equals(pensonAccountApply)){ if(StringUtils.isNotEmpty(accountMobile)&&accountMobile.equals(pensonAccountApply)){
//申请人签名 //申请人签名
@@ -723,16 +670,16 @@ public class MsSignSealServiceImpl implements MsSignSealService {
operLog.setCaseNode(caseNode); operLog.setCaseNode(caseNode);
operLog.setCreateTime(dateOperate); operLog.setCreateTime(dateOperate);
caseLogRecordMapper.insert(operLog); caseLogRecordMapper.insert(operLog);
if(signStatusResponse!=null&&signStatusResponse.intValue()==1&& if(signStatusResponse!=null&&signStatusResponse.equals(1)&&
signStatusMediator!=null&&signStatusMediator.intValue()==1){ signStatusMediator!=null&&signStatusMediator.equals(1)){
// 根据流程id查找下一个流程节点 // 根据流程id查找下一个流程节点
MsCaseFlow nextFlow=null; MsCaseFlow nextFlow=null;
if(caseApplicationselect.getSealFlag()!=null&&caseApplicationselect.getSealFlag()==1) { if(caseApplicationselect.getSealFlag()!=null&&caseApplicationselect.getSealFlag()==1) {
// 需要用印 // 需要用印
nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId().intValue()); nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId());
}else { }else {
// 不需要用印 // 不需要用印
nextFlow = caseFlowMapper.nextFlow1(caseApplicationselect.getCaseFlowId().intValue()); nextFlow = caseFlowMapper.nextFlow1(caseApplicationselect.getCaseFlowId());
} }
MsCaseApplication application = new MsCaseApplication(); MsCaseApplication application = new MsCaseApplication();
application.setId(caseApplicationselect.getId()); application.setId(caseApplicationselect.getId());
@@ -764,17 +711,17 @@ public class MsSignSealServiceImpl implements MsSignSealService {
operLog.setCaseNode(caseNode); operLog.setCaseNode(caseNode);
operLog.setCreateTime(dateOperate); operLog.setCreateTime(dateOperate);
caseLogRecordMapper.insert(operLog); caseLogRecordMapper.insert(operLog);
if(signStatusApply!=null&&signStatusApply.intValue()==1&& if(signStatusApply!=null&&signStatusApply.equals(1)&&
signStatusMediator!=null&&signStatusMediator.intValue()==1){ signStatusMediator!=null&&signStatusMediator.equals(1)){
// 根据流程id查找下一个流程节点 // 根据流程id查找下一个流程节点
// 根据流程id查找下一个流程节点 // 根据流程id查找下一个流程节点
MsCaseFlow nextFlow=null; MsCaseFlow nextFlow=null;
if(caseApplicationselect.getSealFlag()!=null&&caseApplicationselect.getSealFlag()==1) { if(caseApplicationselect.getSealFlag()!=null&&caseApplicationselect.getSealFlag()==1) {
// 需要用印 // 需要用印
nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId().intValue()); nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId());
}else { }else {
// 不需要用印 // 不需要用印
nextFlow = caseFlowMapper.nextFlow1(caseApplicationselect.getCaseFlowId().intValue()); nextFlow = caseFlowMapper.nextFlow1(caseApplicationselect.getCaseFlowId());
} }
MsCaseApplication application = new MsCaseApplication(); MsCaseApplication application = new MsCaseApplication();
application.setId(caseApplicationselect.getId()); application.setId(caseApplicationselect.getId());
@@ -806,17 +753,17 @@ public class MsSignSealServiceImpl implements MsSignSealService {
operLog.setCaseNode(caseNode); operLog.setCaseNode(caseNode);
operLog.setCreateTime(dateOperate); operLog.setCreateTime(dateOperate);
caseLogRecordMapper.insert(operLog); caseLogRecordMapper.insert(operLog);
if(signStatusApply!=null&&signStatusApply.intValue()==1&& if(signStatusApply!=null&&signStatusApply.equals(1)&&
signStatusResponse!=null&&signStatusResponse.intValue()==1){ signStatusResponse!=null&&signStatusResponse.equals(1)){
// 根据流程id查找下一个流程节点 // 根据流程id查找下一个流程节点
// 根据流程id查找下一个流程节点 // 根据流程id查找下一个流程节点
MsCaseFlow nextFlow=null; MsCaseFlow nextFlow=null;
if(caseApplicationselect.getSealFlag()!=null&&caseApplicationselect.getSealFlag()==1) { if(caseApplicationselect.getSealFlag()!=null&&caseApplicationselect.getSealFlag()==1) {
// 需要用印 // 需要用印
nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId().intValue()); nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId());
}else { }else {
// 不需要用印 // 不需要用印
nextFlow = caseFlowMapper.nextFlow1(caseApplicationselect.getCaseFlowId().intValue()); nextFlow = caseFlowMapper.nextFlow1(caseApplicationselect.getCaseFlowId());
} }
MsCaseApplication application = new MsCaseApplication(); MsCaseApplication application = new MsCaseApplication();
application.setId(caseApplicationselect.getId()); application.setId(caseApplicationselect.getId());
@@ -847,7 +794,7 @@ public class MsSignSealServiceImpl implements MsSignSealService {
caseLogRecordMapper.insert(operLog); caseLogRecordMapper.insert(operLog);
// 根据流程id查找下一个流程节点 // 根据流程id查找下一个流程节点
MsCaseFlow nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId().intValue()); MsCaseFlow nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId());
MsCaseApplication application = new MsCaseApplication(); MsCaseApplication application = new MsCaseApplication();
application.setId(caseApplicationselect.getId()); application.setId(caseApplicationselect.getId());
application.setCaseFlowId(nextFlow.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)){ if(StringUtils.isNotEmpty(accountMobile)&&accountMobile.equals(pensonAccountApply)){
//申请人签名 //申请人签名
@@ -872,8 +819,8 @@ public class MsSignSealServiceImpl implements MsSignSealService {
operLog.setCaseNode(caseNode); operLog.setCaseNode(caseNode);
operLog.setCreateTime(dateOperate); operLog.setCreateTime(dateOperate);
caseLogRecordMapper.insert(operLog); caseLogRecordMapper.insert(operLog);
if(signStatusResponse!=null&&signStatusResponse.intValue()==1){ if(signStatusResponse!=null&&signStatusResponse.equals(1)){
MsCaseFlow nextFlow = caseFlowMapper.nextFlow1(caseApplicationselect.getCaseFlowId().intValue()); MsCaseFlow nextFlow = caseFlowMapper.nextFlow1(caseApplicationselect.getCaseFlowId());
MsCaseApplication application = new MsCaseApplication(); MsCaseApplication application = new MsCaseApplication();
application.setId(caseApplicationselect.getId()); application.setId(caseApplicationselect.getId());
application.setCaseFlowId(nextFlow.getId()); application.setCaseFlowId(nextFlow.getId());
@@ -898,8 +845,6 @@ public class MsSignSealServiceImpl implements MsSignSealService {
String day = String.format("%02d", now.getDayOfMonth()); String day = String.format("%02d", now.getDayOfMonth());
String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day; String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
String fileName = UUID.randomUUID().toString().replace("-", "") + ".pdf"; 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 saveName = fileName;
String savePath = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName; String savePath = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
@@ -921,7 +866,7 @@ public class MsSignSealServiceImpl implements MsSignSealService {
if(StrUtil.isEmpty(caseApplicationselect.getCaseSource())){ if(StrUtil.isEmpty(caseApplicationselect.getCaseSource())){
List<MsCaseAttach> existAttach = msCaseAttachMapper.listCaseAttachByCaseIdAndType(caseAppliId, AnnexTypeEnum.MEDIATE_BOOK.getCode()); List<MsCaseAttach> existAttach = msCaseAttachMapper.listCaseAttachByCaseIdAndType(caseAppliId, AnnexTypeEnum.MEDIATE_BOOK.getCode());
if(CollectionUtil.isNotEmpty(existAttach)){ if(CollectionUtil.isNotEmpty(existAttach)){
// todo 对接北明,同步案件状态,删除 // 对接北明,同步案件状态,删除
for (MsCaseAttach msCaseAttach : existAttach) { for (MsCaseAttach msCaseAttach : existAttach) {
if(StrUtil.isEmpty(msCaseAttach.getOtherSysFileId())||StrUtil.isEmpty(msCaseAttach.getAnnexPath())){ if(StrUtil.isEmpty(msCaseAttach.getOtherSysFileId())||StrUtil.isEmpty(msCaseAttach.getAnnexPath())){
continue; continue;
@@ -937,7 +882,7 @@ public class MsSignSealServiceImpl implements MsSignSealService {
caseAttach.setAnnexPath(savePath); caseAttach.setAnnexPath(savePath);
caseAttach.setAnnexName(saveName); caseAttach.setAnnexName(saveName);
caseAttachMapper.save(caseAttach); caseAttachMapper.save(caseAttach);
// todo 对接北明,调用上传附件接口 // 对接北明,调用上传附件接口
if(StrUtil.isEmpty(caseApplicationselect.getCaseSource()) ) { if(StrUtil.isEmpty(caseApplicationselect.getCaseSource()) ) {
String templatePath = "/home/ruoyi" + savePath; String templatePath = "/home/ruoyi" + savePath;
File file = new File(templatePath.replace("/profile", "/uploadPath")); File file = new File(templatePath.replace("/profile", "/uploadPath"));
@@ -964,8 +909,8 @@ public class MsSignSealServiceImpl implements MsSignSealService {
operLog.setCaseNode(caseNode); operLog.setCaseNode(caseNode);
operLog.setCreateTime(dateOperate); operLog.setCreateTime(dateOperate);
caseLogRecordMapper.insert(operLog); caseLogRecordMapper.insert(operLog);
if(signStatusApply!=null&&signStatusApply.intValue()==1){ if(signStatusApply!=null&&signStatusApply.equals(1)){
MsCaseFlow nextFlow = caseFlowMapper.nextFlow1(caseApplicationselect.getCaseFlowId().intValue()); MsCaseFlow nextFlow = caseFlowMapper.nextFlow1(caseApplicationselect.getCaseFlowId());
MsCaseApplication application = new MsCaseApplication(); MsCaseApplication application = new MsCaseApplication();
application.setId(caseApplicationselect.getId()); application.setId(caseApplicationselect.getId());
application.setCaseFlowId(nextFlow.getId()); application.setCaseFlowId(nextFlow.getId());
@@ -990,8 +935,6 @@ public class MsSignSealServiceImpl implements MsSignSealService {
String day = String.format("%02d", now.getDayOfMonth()); String day = String.format("%02d", now.getDayOfMonth());
String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day; String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
String fileName = UUID.randomUUID().toString().replace("-", "") + ".pdf"; 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 saveName = fileName;
String savePath = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName; String savePath = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
@@ -1013,7 +956,7 @@ public class MsSignSealServiceImpl implements MsSignSealService {
if(StrUtil.isEmpty(caseApplicationselect.getCaseSource())){ if(StrUtil.isEmpty(caseApplicationselect.getCaseSource())){
List<MsCaseAttach> existAttach = msCaseAttachMapper.listCaseAttachByCaseIdAndType(caseAppliId, AnnexTypeEnum.MEDIATE_BOOK.getCode()); List<MsCaseAttach> existAttach = msCaseAttachMapper.listCaseAttachByCaseIdAndType(caseAppliId, AnnexTypeEnum.MEDIATE_BOOK.getCode());
if(CollectionUtil.isNotEmpty(existAttach)){ if(CollectionUtil.isNotEmpty(existAttach)){
// todo 对接北明,同步案件状态,删除 // 对接北明,同步案件状态,删除
for (MsCaseAttach msCaseAttach : existAttach) { for (MsCaseAttach msCaseAttach : existAttach) {
if(StrUtil.isEmpty(msCaseAttach.getOtherSysFileId())||StrUtil.isEmpty(msCaseAttach.getAnnexPath())){ if(StrUtil.isEmpty(msCaseAttach.getOtherSysFileId())||StrUtil.isEmpty(msCaseAttach.getAnnexPath())){
continue; continue;
@@ -1029,7 +972,7 @@ public class MsSignSealServiceImpl implements MsSignSealService {
caseAttach.setAnnexPath(savePath); caseAttach.setAnnexPath(savePath);
caseAttach.setAnnexName(saveName); caseAttach.setAnnexName(saveName);
// todo 对接北明,调用上传附件接口 // 对接北明,调用上传附件接口
if(StrUtil.isEmpty(caseApplicationselect.getCaseSource()) ) { if(StrUtil.isEmpty(caseApplicationselect.getCaseSource()) ) {
String templatePath = "/home/ruoyi" + savePath; String templatePath = "/home/ruoyi" + savePath;
@@ -1069,8 +1012,6 @@ public class MsSignSealServiceImpl implements MsSignSealService {
String day = String.format("%02d", now.getDayOfMonth()); String day = String.format("%02d", now.getDayOfMonth());
String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day; String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
String fileName = UUID.randomUUID().toString().replace("-", "") + ".pdf"; 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 saveName = fileName;
String savePath = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName; String savePath = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
@@ -1092,7 +1033,7 @@ public class MsSignSealServiceImpl implements MsSignSealService {
if(StrUtil.isEmpty(caseApplicationselect.getCaseSource())){ if(StrUtil.isEmpty(caseApplicationselect.getCaseSource())){
List<MsCaseAttach> existAttach = msCaseAttachMapper.listCaseAttachByCaseIdAndType(caseAppliId, AnnexTypeEnum.MEDIATE_BOOK.getCode()); List<MsCaseAttach> existAttach = msCaseAttachMapper.listCaseAttachByCaseIdAndType(caseAppliId, AnnexTypeEnum.MEDIATE_BOOK.getCode());
if(CollectionUtil.isNotEmpty(existAttach)){ if(CollectionUtil.isNotEmpty(existAttach)){
// todo 对接北明,同步案件状态,删除 // 对接北明,同步案件状态,删除
for (MsCaseAttach msCaseAttach : existAttach) { for (MsCaseAttach msCaseAttach : existAttach) {
if(StrUtil.isEmpty(msCaseAttach.getOtherSysFileId())||StrUtil.isEmpty(msCaseAttach.getAnnexPath())){ if(StrUtil.isEmpty(msCaseAttach.getOtherSysFileId())||StrUtil.isEmpty(msCaseAttach.getAnnexPath())){
continue; continue;
@@ -1108,7 +1049,7 @@ public class MsSignSealServiceImpl implements MsSignSealService {
caseAttach.setAnnexPath(savePath); caseAttach.setAnnexPath(savePath);
caseAttach.setAnnexName(saveName); caseAttach.setAnnexName(saveName);
caseAttachMapper.save(caseAttach); caseAttachMapper.save(caseAttach);
// todo 对接北明,调用上传附件接口 // 对接北明,调用上传附件接口
if(StrUtil.isEmpty(caseApplicationselect.getCaseSource()) ) { if(StrUtil.isEmpty(caseApplicationselect.getCaseSource()) ) {
String templatePath = "/home/ruoyi" + savePath; String templatePath = "/home/ruoyi" + savePath;
File file = new File(templatePath.replace("/profile", "/uploadPath")); 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<MsCaseAttach> caseAttachList) { private boolean sendCaseEmail(MsCaseApplication caseApplication, String email, List<MsCaseAttach> caseAttachList) {
List<File> fileList = new ArrayList<>(); List<File> fileList = new ArrayList<>();
File file = null; File file = null;
Long fileId = null;
if (caseAttachList != null && caseAttachList.size() > 0) { if (caseAttachList != null && caseAttachList.size() > 0) {
for (MsCaseAttach caseAttach : caseAttachList) { for (MsCaseAttach caseAttach : caseAttachList) {
if (caseAttach.getAnnexType() == AnnexTypeEnum.MEDIATE_BOOK.getCode()) { 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"; String prefix = "/profile";
int startIndex = prefix.length(); int startIndex = prefix.length();
String annexPath = caseAttach.getAnnexPath(); String annexPath = caseAttach.getAnnexPath();
String path = "/home/ruoyi/uploadPath/" + annexPath.substring(startIndex+1); String path = "/home/ruoyi/uploadPath/" + annexPath.substring(startIndex+1);
// todo 部署放开
file = new File(path); file = new File(path);
fileList.add(file); fileList.add(file);
fileId=caseAttach.getAnnexId();
System.out.println("文件长度==================:" + file.length()); 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()) { if (file != null && file.exists()) {
try { try {
Boolean aBoolean = emailOutUtil.sendEmil(email, "您好,审核后的调解书在附件中请查阅", "签署后的调解书", fileList, null); Boolean aBoolean = emailOutUtil.sendEmil(email, "您好,审核后的调解书在附件中请查阅", "签署后的调解书", fileList, null);
if (aBoolean) { 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; return Boolean.TRUE;
} }
} catch (Exception e) { } catch (Exception e) {
System.out.println("邮件发送失败++++++++++++++++++++++++++++++++"); System.out.println("邮件发送失败++++++++++++++++++++++++++++++++");
System.out.println(e.toString()); 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; 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;
}
@@ -215,15 +215,6 @@ public class VideoConferenceServiceImpl implements VideoConferenceService {
String reportStatus = jsonObject.getStr("report_status"); String reportStatus = jsonObject.getStr("report_status");
String description = jsonObject.getStr("description"); String description = jsonObject.getStr("description");
System.out.println(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())){ if(StrUtil.isEmpty(caseApplication.getCaseSource())){
List<MsCaseAttach> existAttach = caseAttachMapper.listCaseAttachByCaseIdAndType(reservedConferenceVO.getCaseId(), AnnexTypeEnum.MEDIATE.getCode()); List<MsCaseAttach> existAttach = caseAttachMapper.listCaseAttachByCaseIdAndType(reservedConferenceVO.getCaseId(), AnnexTypeEnum.MEDIATE.getCode());
if(CollectionUtil.isNotEmpty(existAttach)){ if(CollectionUtil.isNotEmpty(existAttach)){
// todo 对接北明,同步案件状态,删除 // 对接北明,同步案件状态,删除
for (MsCaseAttach msCaseAttach : existAttach) { for (MsCaseAttach msCaseAttach : existAttach) {
if(StrUtil.isEmpty(msCaseAttach.getOtherSysFileId())||StrUtil.isEmpty(msCaseAttach.getAnnexPath())){ if(StrUtil.isEmpty(msCaseAttach.getOtherSysFileId())||StrUtil.isEmpty(msCaseAttach.getAnnexPath())){
continue; continue;
@@ -552,7 +543,7 @@ public class VideoConferenceServiceImpl implements VideoConferenceService {
.annexPath(fileName) .annexPath(fileName)
.annexType(AnnexTypeEnum.MEDIATE.getCode()) .annexType(AnnexTypeEnum.MEDIATE.getCode())
.build(); .build();
// todo 对接北明,调用上传附件接口 // 对接北明,调用上传附件接口
if(StrUtil.isEmpty(caseApplication.getCaseSource()) ) { if(StrUtil.isEmpty(caseApplication.getCaseSource()) ) {
String templatePath = "/home/ruoyi" + caseAttach.getAnnexPath(); String templatePath = "/home/ruoyi" + caseAttach.getAnnexPath();
@@ -604,7 +595,7 @@ public class VideoConferenceServiceImpl implements VideoConferenceService {
.annexPath(annexName) .annexPath(annexName)
.annexType(AnnexTypeEnum.MEETING_VIDEO.getCode()) .annexType(AnnexTypeEnum.MEETING_VIDEO.getCode())
.build(); .build();
// todo 对接北明,调用上传附件接口 // 对接北明,调用上传附件接口
if(StrUtil.isEmpty(caseApplication.getCaseSource()) ) { if(StrUtil.isEmpty(caseApplication.getCaseSource()) ) {
String templatePath = "/home/ruoyi" + caseAttach.getAnnexPath(); String templatePath = "/home/ruoyi" + caseAttach.getAnnexPath();
@@ -1,15 +1,20 @@
package com.ruoyi.wisdomarbitrate.service.shortmessage; package com.ruoyi.wisdomarbitrate.service.shortmessage;
import com.ruoyi.common.core.domain.AjaxResult; 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.dto.sendrecord.SmsSendRecord;
import com.ruoyi.wisdomarbitrate.domain.vo.shortmessage.MeetingInfoVO; import com.ruoyi.wisdomarbitrate.domain.vo.shortmessage.MeetingInfoVO;
import com.ruoyi.wisdomarbitrate.domain.vo.shortmessage.ReSendMessageVO; import com.ruoyi.wisdomarbitrate.domain.vo.shortmessage.ReSendMessageVO;
import java.util.List;
public interface ShortMessageService { public interface ShortMessageService {
public List<SmsSendRecord> smsSendRecordList(SmsSendRecord smsSendRecord);
/** /**
* 新增发送历史记录 * 新增发送历史记录
*/ */
void insertShortMessageHistoryRecord(SmsSendRecord smsSendRecord); void insertShortMessageHistoryRecord(SmsSendRecord smsSendRecord,List<MsSmsSendRecordParam> recordParams);
/** /**
* 重新发送短信 * 重新发送短信
@@ -1,29 +1,40 @@
package com.ruoyi.wisdomarbitrate.service.shortmessage.impl; package com.ruoyi.wisdomarbitrate.service.shortmessage.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.json.JSONObject; import cn.hutool.json.JSONObject;
import com.ruoyi.common.constant.Constants; import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.SMSStatusEnum; 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.MeetingInfo;
import com.ruoyi.system.domain.entity.shortmessage.MsSmsSendHistoryRecord; 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.MeetingInfoMapper;
import com.ruoyi.system.mapper.shortmessage.MsSmsSendHistoryRecordMapper; 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.dto.sendrecord.SmsSendRecord;
import com.ruoyi.wisdomarbitrate.domain.vo.shortmessage.MeetingInfoVO; import com.ruoyi.wisdomarbitrate.domain.vo.shortmessage.MeetingInfoVO;
import com.ruoyi.wisdomarbitrate.domain.vo.shortmessage.ReSendMessageVO; 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.service.shortmessage.ShortMessageService;
import com.ruoyi.wisdomarbitrate.utils.SmsUtils;
import io.jsonwebtoken.Jwts; import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm; import io.jsonwebtoken.SignatureAlgorithm;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import tk.mybatis.mapper.entity.Example;
import java.util.Date; import java.text.MessageFormat;
import java.util.HashMap; import java.util.*;
import java.util.Map; import java.util.stream.Collectors;
import java.util.UUID;
@Service @Service
public class ShortMessageServiceImpl implements ShortMessageService { public class ShortMessageServiceImpl implements ShortMessageService {
@@ -31,20 +42,133 @@ public class ShortMessageServiceImpl implements ShortMessageService {
MsSmsSendHistoryRecordMapper msSmsSendHistoryRecordMapper; MsSmsSendHistoryRecordMapper msSmsSendHistoryRecordMapper;
@Autowired @Autowired
MeetingInfoMapper meetingInfoMapper; MeetingInfoMapper meetingInfoMapper;
@Autowired
SmsRecordMapper smsRecordMapper;
@Autowired
MsSmsTemplateMapper templateMapper;
@Autowired
MsSmsTemplateParamMapper templateParamMapper;
@Autowired
MsSmsSendRecordParamMapper recordParamMapper;
@Autowired
MsSmsSendHistoryRecordParamMapper historyRecordParamMapper;
@Override
public List<SmsSendRecord> smsSendRecordList(SmsSendRecord smsSendRecord) {
List<SmsSendRecord> records = smsRecordMapper.getSmsSendRecord(smsSendRecord);
if(CollectionUtil.isEmpty(records)){
return null;
}
List<Long> templateIds = records.stream().map(SmsSendRecord::getMsSmsTemplateId).collect(Collectors.toList());
if(CollectionUtil.isEmpty(templateIds)){
return records;
}
List<Long> ids = records.stream().map(SmsSendRecord::getId).collect(Collectors.toList());
// 查询记录表参数值
Example recordParamExam = new Example(MsSmsSendRecordParam.class);
recordParamExam.createCriteria().andIn("smsRecordId", ids);
List<MsSmsSendRecordParam> recordParams = recordParamMapper.selectByExample(recordParamExam);
if(CollectionUtil.isEmpty(recordParams)){
return records;
}
// 根据模板id查询模板参数
Example templateParamExam = new Example(MsSmsTemplateParam.class);
templateParamExam.createCriteria().andIn("smsTemplateId", templateIds);
List<MsSmsTemplateParam> templateParams = templateParamMapper.selectByExample(templateParamExam);
if(CollectionUtil.isEmpty(templateParams)){
return records;
}
// 根据模板id对模板参数分组
Map<Long, List<MsSmsTemplateParam>> templateParamMap = templateParams.stream().collect(Collectors.groupingBy(MsSmsTemplateParam::getSmsTemplateId));
// 根据记录id分组
Map<Long, List<String>> recordParamContentMap = new HashMap<>();
for (MsSmsSendRecordParam recordParam : recordParams) {
List<String> 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<MsSmsTemplate> templates = templateMapper.selectByExample(templateExam);
if(CollectionUtil.isEmpty(templates)){
return records;
}
// 根据主键id获取模板内容
Map<Long, String> templateMap = templates.stream().collect(Collectors.toMap(MsSmsTemplate::getId, MsSmsTemplate::getContent, (k1, k2) -> k2));
Map<Long, String> 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<String> recordParamList = recordParamContentMap.get(record.getId());
if(recordParamContentMap.containsKey(record.getId()) && templateParamMap.containsKey(record.getMsSmsTemplateId())){
List<MsSmsTemplateParam> 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[]数组
String[] paramArray = recordParamList.toArray(new String[recordParamList.size()]);
String formattedMessage = MessageFormat.format(templateContent, paramArray);
record.setSendContent(formattedMessage);
}
}
return records;
}
/** /**
* 新增发送历史记录 * 新增发送历史记录
* *
* @param smsSendRecord * @param smsSendRecord
*/ */
@Transactional
@Override @Override
public void insertShortMessageHistoryRecord(SmsSendRecord smsSendRecord) { public void insertShortMessageHistoryRecord(SmsSendRecord smsSendRecord,List<MsSmsSendRecordParam> recordParams) {
if(smsSendRecord!=null){ if(smsSendRecord!=null){
MsSmsSendHistoryRecord historyRecord=new MsSmsSendHistoryRecord(); MsSmsSendHistoryRecord historyRecord=new MsSmsSendHistoryRecord();
BeanUtils.copyProperties(smsSendRecord,historyRecord); BeanUtils.copyProperties(smsSendRecord,historyRecord);
historyRecord.setId(null); historyRecord.setId(null);
historyRecord.setParentId(smsSendRecord.getId()); historyRecord.setParentId(smsSendRecord.getId());
msSmsSendHistoryRecordMapper.insert(historyRecord); int i = msSmsSendHistoryRecordMapper.insert(historyRecord);
if(i>0 && CollectionUtil.isNotEmpty(recordParams)){
// 新增参数表
List<MsSmsSendHistoryRecordParam> 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 @Override
public AjaxResult reSendShortMessage(ReSendMessageVO reSendMessageVO) { 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(); SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest();
request.setTemplateId(reSendMessageVO.getTemplateId()); request.setTemplateId(reSendMessageVO.getTemplateId());
request.setPhone(reSendMessageVO.getPhone()); request.setPhone(reSendMessageVO.getPhone());
String[] messageContent = reSendMessageVO.getParamValues().toArray(new String[0]); List<String> paramsList = reSendMessageVO.getTemplateParams().stream().map(MsSmsTemplateParam::getParamValue).collect(Collectors.toList());
System.out.println(reSendMessageVO.getTemplateId()); String[] messageContent = paramsList.toArray(new String[0]);
System.out.println(reSendMessageVO.getPhone());
System.out.println(messageContent);
request.setTemplateParamSet(messageContent); request.setTemplateParamSet(messageContent);
JSONObject resultObj = SmsUtils.sendSms(request); JSONObject resultObj = SmsUtils.sendSms(request);
smsSendRecord.setSendTime(new Date());
// 修改sid和状态
if (resultObj.get("status") != null && !resultObj.get("status").equals(SMSStatusEnum.FAIL.getCode())) { 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("重新发送成功"); return AjaxResult.success("重新发送成功");
} else { } 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("重新发送失败"); return AjaxResult.warn("重新发送失败");
} }
} else { } else {
@@ -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<MsSmsTemplate> page();
AjaxResult insert(MsSmsTemplate template);
AjaxResult delete(Long id);
}
@@ -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<MsSmsTemplate> page() {
// 分页查询模板
Example templateExam = new Example(MsSmsTemplate.class);
List<MsSmsTemplate> templates = templateMapper.selectByExample(templateExam);
if(CollectionUtil.isEmpty(templates)){
return null;
}
List<Long> templateIds = templates.stream().map(MsSmsTemplate::getId).collect(Collectors.toList());
// 查询参数
Example templateParamExam = new Example(MsSmsTemplateParam.class);
templateParamExam.createCriteria().andIn("smsTemplateId", templateIds);
List<MsSmsTemplateParam> templateParams = templateParamMapper.selectByExample(templateParamExam);
// 根据模板id对模板参数分组
Map<Long, List<MsSmsTemplateParam>> 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();
}
}
@@ -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<MsSmsTemplate> 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<MsSmsSendRecordParam> 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;
}
}
@@ -6,10 +6,11 @@
WARNING - @mbg.generated WARNING - @mbg.generated
--> -->
<id column="id" jdbcType="BIGINT" property="id" /> <id column="id" jdbcType="BIGINT" property="id" />
<result column="status" jdbcType="BIGINT" property="status" /> <result column="status" jdbcType="INTEGER" property="status" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="request_url" jdbcType="LONGVARCHAR" property="requestUrl" /> <result column="request_url" jdbcType="LONGVARCHAR" property="requestUrl" />
<result column="content" jdbcType="LONGVARCHAR" property="content" /> <result column="content" jdbcType="LONGVARCHAR" property="content" />
<result column="reason" jdbcType="LONGVARCHAR" property="reason" /> <result column="reason" jdbcType="LONGVARCHAR" property="reason" />
<result column="return_content" jdbcType="LONGVARCHAR" property="returnContent" />
</resultMap> </resultMap>
</mapper> </mapper>
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.sms.MsSmsSendHistoryRecordParamMapper">
<resultMap id="BaseResultMap" type="com.ruoyi.system.domain.entity.sms.MsSmsSendHistoryRecordParam">
<!--
WARNING - @mbg.generated
-->
<id column="id" jdbcType="BIGINT" property="id" />
<result column="sms_record_history_id" jdbcType="BIGINT" property="smsRecordHistoryId" />
<result column="param_value" jdbcType="LONGVARCHAR" property="paramValue" />
</resultMap>
</mapper>
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.sms.MsSmsSendRecordParamMapper">
<resultMap id="BaseResultMap" type="com.ruoyi.system.domain.entity.sms.MsSmsSendRecordParam">
<!--
WARNING - @mbg.generated
-->
<id column="id" jdbcType="INTEGER" property="id" />
<result column="sms_record_id" jdbcType="VARCHAR" property="smsRecordId" />
<result column="param" jdbcType="VARCHAR" property="param" />
<result column="param_value" jdbcType="LONGVARCHAR" property="paramValue" />
</resultMap>
</mapper>
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.sms.MsSmsTemplateMapper">
<resultMap id="BaseResultMap" type="com.ruoyi.system.domain.entity.sms.MsSmsTemplate">
<!--
WARNING - @mbg.generated
-->
<id column="id" jdbcType="INTEGER" property="id" />
<result column="template_id" jdbcType="VARCHAR" property="templateId" />
<result column="name" jdbcType="VARCHAR" property="name" />
</resultMap>
</mapper>
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.sms.MsSmsTemplateParamMapper">
<resultMap id="BaseResultMap" type="com.ruoyi.system.domain.entity.sms.MsSmsTemplateParam">
<!--
WARNING - @mbg.generated
-->
<id column="id" jdbcType="INTEGER" property="id" />
<result column="sms_template_id" jdbcType="VARCHAR" property="smsTemplateId" />
<result column="param" jdbcType="VARCHAR" property="param" />
</resultMap>
</mapper>
@@ -108,7 +108,7 @@
left join ms_sys_role_menu rm on m.menu_id = rm.menu_id 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_user_role ur on rm.role_id = ur.role_id
left join ms_sys_role r on r.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> </select>
<select id="selectMenuPermsByRoleId" parameterType="Long" resultType="String"> <select id="selectMenuPermsByRoleId" parameterType="Long" resultType="String">
@@ -26,6 +26,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateTime" column="update_time" /> <result property="updateTime" column="update_time" />
<result property="remark" column="remark" /> <result property="remark" column="remark" />
<result property="specialty" column="specialty" /> <result property="specialty" column="specialty" />
<result property="birth" column="birth" />
<result property="home" column="home" />
<result property="address" column="address" />
<!-- <collection property="dept" javaType="com.ruoyi.common.core.domain.entity.SysDept" resultMap="deptResult" />--> <!-- <collection property="dept" javaType="com.ruoyi.common.core.domain.entity.SysDept" resultMap="deptResult" />-->
<collection property="roles" javaType="java.util.List" resultMap="RoleResult" /> <collection property="roles" javaType="java.util.List" resultMap="RoleResult" />
</resultMap> </resultMap>
@@ -52,7 +55,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<sql id="selectUserVo"> <sql id="selectUserVo">
select u.user_id, u.user_name, u.nick_name,u.specialty, u.id_card,u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, select u.user_id, u.user_name, u.nick_name,u.specialty, u.id_card,u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,
r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status,u.id_card,u.id_type,u.nationality r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status,u.birth,u.id_type,u.nationality,u.home,u.address
from ms_sys_user u from ms_sys_user u
left join ms_sys_user_role ur on u.user_id = ur.user_id left join ms_sys_user_role ur on u.user_id = ur.user_id
left join ms_sys_role r on r.role_id = ur.role_id left join ms_sys_role r on r.role_id = ur.role_id
@@ -9,7 +9,7 @@
u.nickName name, u.nickName name,
u.id_type idType, u.id_type idType,
r.role_name roleName, r.role_name roleName,
GROUP_CONCAT( DISTINCT CASE WHEN c.organize_flag = 0 THEN u.nick_name ELSE d.dept_name END ) AS name, GROUP_CONCAT( DISTINCT CASE WHEN a1.organize_flag = 0 THEN u.nick_name ELSE d.dept_name END ) AS name,
(select GROUP_CONCAT( DISTINCT u1.nick_name ) FROM (select GROUP_CONCAT( DISTINCT u1.nick_name ) FROM
ms_case_affiliate a1 ms_case_affiliate a1
@@ -39,13 +39,13 @@
group by a.case_appli_id group by a.case_appli_id
</select> </select>
<select id="selectByCaseId" resultType="com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAffiliate"> <select id="selectByCaseId" resultType="com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAffiliate">
select c.id caseAppliId,a.id,a.role_type roleType,a.group_order groupOrder,a.operator_flag operatorFlag,d.code,d.comp_legal_person compLegalPerson,u.id_card idCard,u.phonenumber phone, select c.id caseAppliId,r.role_id roleId,a.id,a.role_type roleType,a.group_order groupOrder,a.operator_flag operatorFlag,d.code,d.comp_legal_person compLegalPerson,u.id_card idCard,u.phonenumber phone,
u.email, u.email,u.user_name userName,
(case when a.user_id is null then d.dept_name else u.nick_name end) name, (case when a.user_id is null then d.dept_name else u.nick_name end) name,
(case when a.user_id is null then d.home else u.home end) home, (case when a.user_id is null then d.home else u.home end) home,
(case when a.user_id is null then d.address else u.address end) address, (case when a.user_id is null then d.address else u.address end) address,
(case when a.user_id is null then d.nationality else u.nationality end) nationality, (case when a.user_id is null then d.nationality else u.nationality end) nationality,
u.sex,u.id_type idType,u.birth,a.user_id userId,c.organize_flag organizeFlag,c.case_source caseSource,d.dept_name applicantOrgName u.sex,u.id_type idType,u.birth,a.user_id userId,a.organize_flag organizeFlag,c.case_source caseSource,d.dept_name applicantOrgName
FROM FROM
ms_case_application c ms_case_application c
JOIN ms_case_affiliate a ON a.case_appli_id=#{id} and c.id = a.case_appli_id JOIN ms_case_affiliate a ON a.case_appli_id=#{id} and c.id = a.case_appli_id
@@ -54,7 +54,7 @@
LEFT JOIN ms_sys_role r ON r.role_id = ur.role_id LEFT JOIN ms_sys_role r ON r.role_id = ur.role_id
LEFT JOIN ms_sys_dept d ON d.dept_id = a.applicant_dept_id LEFT JOIN ms_sys_dept d ON d.dept_id = a.applicant_dept_id
where c.id = #{id} where c.id = #{id}
GROUP BY a.id order by a.id asc GROUP BY a.id,r.role_id order by a.id asc
</select> </select>
<select id="selectUserRoleByCaseIds" resultType="com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAffiliate"> <select id="selectUserRoleByCaseIds" resultType="com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAffiliate">
select c.id caseAppliId,a.id,a.role_type roleType,a.group_order groupOrder,a.operator_flag operatorFlag,d.code,d.comp_legal_person compLegalPerson,u.id_card idCard,u.phonenumber phone, select c.id caseAppliId,a.id,a.role_type roleType,a.group_order groupOrder,a.operator_flag operatorFlag,d.code,d.comp_legal_person compLegalPerson,u.id_card idCard,u.phonenumber phone,
@@ -63,7 +63,7 @@
(case when a.user_id is null then d.home else u.home end) home, (case when a.user_id is null then d.home else u.home end) home,
(case when a.user_id is null then d.address else u.address end) address, (case when a.user_id is null then d.address else u.address end) address,
(case when a.user_id is null then d.nationality else u.nationality end) nationality, (case when a.user_id is null then d.nationality else u.nationality end) nationality,
u.sex,u.id_type idType,u.birth,r.role_name roleName,d.dept_name applicantOrgName,a.user_id userId,a.applicant_dept_id applicantDeptId,c.organize_flag organizeFlag,c.case_source caseSource u.sex,u.id_type idType,u.birth,r.role_name roleName,d.dept_name applicantOrgName,a.user_id userId,a.applicant_dept_id applicantDeptId,a.organize_flag organizeFlag,c.case_source caseSource
FROM FROM
ms_case_application c ms_case_application c
JOIN ms_case_affiliate a ON c.id = a.case_appli_id JOIN ms_case_affiliate a ON c.id = a.case_appli_id
@@ -110,7 +110,7 @@
<select id="list" resultType="com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseApplicationVO"> <select id="list" resultType="com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseApplicationVO">
select t.* from( select t.* from(
SELECT 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, 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, u1.nick_name mediatorName,c.hear_date hearDate,c.case_status_name caseStatusName,c.create_time createTime,
c.mediation_method mediationMethod, c.mediation_method mediationMethod,
@@ -120,7 +120,7 @@
c.id c.id
union union
SELECT 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, 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, u1.nick_name mediatorName,c.hear_date hearDate,c.case_status_name caseStatusName,c.create_time createTime,
c.mediation_method mediationMethod, c.mediation_method mediationMethod,
@@ -159,4 +159,28 @@
) t ORDER BY t.createTime desc,t.caseNum desc ) t ORDER BY t.createTime desc,t.caseNum desc
</select> </select>
<select id="countCasePerson" resultType="java.lang.Long">
select c.id from ms_case_application c where c.mediator_id
in
<foreach collection="userIds" item="userId" open="(" separator="," close=")">
#{userId}
</foreach>
union ALL
select a.id from ms_case_affiliate a where a.user_id
in
<foreach collection="userIds" item="userId" open="(" separator="," close=")">
#{userId}
</foreach>
union all
SELECT id from ms_dept_identify where user_id
in
<foreach collection="userIds" item="userId" open="(" separator="," close=")">
#{userId}
</foreach>
</select>
<select id="selectCaseByDeptId" resultType="java.lang.Long">
select a.id from ms_case_affiliate a where a.applicant_dept_id=#{deptId}
union all
SELECT id from ms_dept_identify where dept_id=#{deptId}
</select>
</mapper> </mapper>
@@ -7,10 +7,10 @@
<resultMap type="com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SmsSendRecord" id="SmsSendRecordResult"> <resultMap type="com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SmsSendRecord" id="SmsSendRecordResult">
<id property="id" column="id" /> <id property="id" column="id" />
<result property="caseId" column="case_appli_id" /> <result property="caseId" column="case_appli_id" />
<result property="msSmsTemplateId" column="ms_sms_template_id" />
<result property="caseNum" column="case_num" /> <result property="caseNum" column="case_num" />
<result property="phone" column="phone" /> <result property="phone" column="phone" />
<result property="sendTime" column="send_time" /> <result property="sendTime" column="send_time" />
<result property="sendContent" column="send_content"/>
<result property="createTime" column="create_time" /> <result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" /> <result property="updateTime" column="update_time" />
<result property="createBy" column="create_by" /> <result property="createBy" column="create_by" />
@@ -18,15 +18,14 @@
<result property="sendStatus" column="send_status" /> <result property="sendStatus" column="send_status" />
<result property="sid" column="sid" /> <result property="sid" column="sid" />
</resultMap> </resultMap>
<insert id="saveSmsSendRecord" parameterType="com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SmsSendRecord" <insert id="saveSmsSendRecord" parameterType="com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SmsSendRecord" useGeneratedKeys="true" keyProperty="id">
useGeneratedKeys="true" keyProperty="id">
insert into ms_sms_send_record( insert into ms_sms_send_record(
<if test="caseId != null ">case_appli_id,</if> <if test="caseId != null ">case_appli_id,</if>
<if test="caseNum != null ">case_num,</if> <if test="caseNum != null ">case_num,</if>
<if test="phone != null and phone != ''">phone,</if> <if test="phone != null and phone != ''">phone,</if>
<if test="sendTime != null ">send_time,</if> <if test="sendTime != null ">send_time,</if>
<if test="sendContent != null ">send_content,</if> <if test="msSmsTemplateId != null ">ms_sms_template_id,</if>
<if test="createBy != null and createBy != ''">create_by,</if> <if test="createBy != null and createBy != ''">create_by,</if>
<if test="sendStatus != null ">send_status,</if> <if test="sendStatus != null ">send_status,</if>
sid, sid,
@@ -37,7 +36,7 @@
<if test="caseNum != null ">#{caseNum},</if> <if test="caseNum != null ">#{caseNum},</if>
<if test="phone != null and phone != ''">#{phone},</if> <if test="phone != null and phone != ''">#{phone},</if>
<if test="sendTime != null ">#{sendTime},</if> <if test="sendTime != null ">#{sendTime},</if>
<if test="sendContent != null ">#{sendContent},</if> <if test="msSmsTemplateId != null ">#{msSmsTemplateId},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if> <if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="sendStatus != null ">#{sendStatus},</if> <if test="sendStatus != null ">#{sendStatus},</if>
#{sid}, #{sid},
@@ -52,7 +51,7 @@
case_num, case_num,
phone, phone,
send_time, send_time,
send_content, ms_sms_template_id,
create_by, create_by,
send_status, send_status,
create_time, create_time,
@@ -64,7 +63,7 @@
#{item.caseNum}, #{item.caseNum},
#{item.phone}, #{item.phone},
#{item.sendTime}, #{item.sendTime},
#{item.sendContent}, #{item.msSmsTemplateId},
#{item.createBy}, #{item.createBy},
#{item.sendStatus}, #{item.sendStatus},
sysdate(),#{sid},#{reason} sysdate(),#{sid},#{reason}
@@ -97,10 +96,20 @@
reason=#{reason} reason=#{reason}
where sid = #{sid} where sid = #{sid}
</update> </update>
<update id="updateSendContent"> <update id="update">
update ms_sms_send_record update ms_sms_send_record
set send_content= #{sendContent}, <set>
update_time=#{updateTime} <if test="caseId != null ">case_appli_id = #{caseId},</if>
<if test="caseNum != null and caseNum != '' ">case_num = #{caseNum},</if>
<if test="phone != null and phone != ''">phone = #{phone},</if>
<if test="sendTime != null ">send_time = #{sendTime},</if>
<if test="msSmsTemplateId != null ">ms_sms_template_id = #{msSmsTemplateId},
</if>
<if test="sendStatus != null ">send_status = #{sendStatus},</if>
<if test="sid != null and sid != '' ">sid = #{sid},</if>
reason = #{reason}
</set>
where id = #{id} where id = #{id}
</update> </update>