Merge branch 'bgy' of SH-Arbitrate/Mediation-Backend into dev
This commit was merged in pull request #137.
This commit is contained in:
+15
-5
@@ -4,12 +4,9 @@ import com.ruoyi.common.annotation.Anonymous;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SmsSendRecord;
|
||||
import com.ruoyi.wisdomarbitrate.mapper.sendrecord.SmsRecordMapper;
|
||||
import com.ruoyi.wisdomarbitrate.service.sendrecord.ShortMessageService;
|
||||
import com.ruoyi.wisdomarbitrate.service.shortmessage.ShortMessageService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@@ -46,4 +43,17 @@ public class ShortMessageController {
|
||||
}
|
||||
return AjaxResult.error("发送失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询UID好的密钥
|
||||
*/
|
||||
@Anonymous
|
||||
@GetMapping("/getMeetingInfo")
|
||||
public Object getEncryptInfoByUid(@RequestParam(name = "authId", required = true) String authId) {
|
||||
if (authId != null) {
|
||||
Object result = shortMessageService.getMeetingInfo(authId);
|
||||
return result;
|
||||
}
|
||||
return AjaxResult.error("查询失败");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -217,4 +217,4 @@ BMConfig:
|
||||
# max-tasks-per-process: 100
|
||||
beimingapihost: https://zj.odrcloud.cn
|
||||
beimingapiprefix: /onestop/sync
|
||||
beimingprivatekey: d7724e72c4be93196a35203e8379ded5
|
||||
beimingprivatekey: d7724e72c4be93196a35203e8379ded5
|
||||
|
||||
@@ -4,11 +4,10 @@ import io.jsonwebtoken.Claims;
|
||||
|
||||
/**
|
||||
* 通用常量信息
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class Constants
|
||||
{
|
||||
public class Constants {
|
||||
/**
|
||||
* UTF-8 字符集
|
||||
*/
|
||||
@@ -71,7 +70,7 @@ public class Constants
|
||||
* 登录失败
|
||||
*/
|
||||
public static final String LOGIN_FAIL = "Error";
|
||||
|
||||
|
||||
/**
|
||||
* 验证码有效期(分钟)
|
||||
*/
|
||||
@@ -95,6 +94,10 @@ public class Constants
|
||||
* 令牌前缀
|
||||
*/
|
||||
public static final String LOGIN_USER_KEY = "login_user_key";
|
||||
/**
|
||||
* 会议主键Id
|
||||
*/
|
||||
public static final String MEETING_KEY = "meeting_key";
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
@@ -142,23 +145,22 @@ public class Constants
|
||||
public static final String LOOKUP_LDAPS = "ldaps:";
|
||||
public static final String DEFAULT_PASSWORD = "123456";
|
||||
// 英文逗号分隔符
|
||||
public static final String SPLIT_COMMA =",";
|
||||
public static final String SPLIT_COMMA = ",";
|
||||
// 中文逗号分隔符
|
||||
public static final String CN_SPLIT_COMMA =",";
|
||||
public static final String CN_SPLIT_COMMA = ",";
|
||||
|
||||
/**
|
||||
* 自动识别json对象白名单配置(仅允许解析的包名,范围越小越安全)
|
||||
*/
|
||||
public static final String[] JSON_WHITELIST_STR = { "org.springframework", "com.ruoyi" };
|
||||
public static final String[] JSON_WHITELIST_STR = {"org.springframework", "com.ruoyi"};
|
||||
|
||||
/**
|
||||
* 定时任务白名单配置(仅允许访问的包名,如其他需要可以自行添加)
|
||||
*/
|
||||
public static final String[] JOB_WHITELIST_STR = { "com.ruoyi" };
|
||||
public static final String[] JOB_WHITELIST_STR = {"com.ruoyi"};
|
||||
|
||||
/**
|
||||
* 定时任务违规的字符
|
||||
*/
|
||||
public static final String[] JOB_ERROR_STR = { "java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml",
|
||||
"org.springframework", "org.apache", "com.ruoyi.common.utils.file", "com.ruoyi.common.config" };
|
||||
public static final String[] JOB_ERROR_STR = {"java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml", "org.springframework", "org.apache", "com.ruoyi.common.utils.file", "com.ruoyi.common.config"};
|
||||
}
|
||||
|
||||
@@ -112,10 +112,17 @@ public class EncryptUtils {
|
||||
public static void main(String[] args) {
|
||||
String privateKey = "936df5fd9aba3b86adc3c1a1c52dcde1";
|
||||
ObjectNode param = new ObjectMapper().createObjectNode();
|
||||
param.put("name", "姓名");
|
||||
param.put("userName", "张三");
|
||||
param.put("caseNo", "ZC1234125");
|
||||
param.put("userId", "124124");
|
||||
param.put("roomId", "124125");
|
||||
param.put("systemType", "tiaojiexitong");
|
||||
String encryptString = sm4Encrypt(param.toString(), privateKey);
|
||||
System.out.println("加密后的字符串:" + encryptString);
|
||||
String uid = UUID.randomUUID().toString().replace("-", "");
|
||||
System.out.println("uid:" + uid);
|
||||
System.out.println("解密后的字符串:" + sm4Decrypt(encryptString, privateKey));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
package com.ruoyi.system.domain.entity.shortmessage;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Table(name = "meeting_info")
|
||||
public class MeetingInfo {
|
||||
/**
|
||||
* 主键Id
|
||||
*/
|
||||
@Id
|
||||
private String uid;
|
||||
|
||||
/**
|
||||
* 案件Id
|
||||
*/
|
||||
@Column(name = "case_id")
|
||||
private Long caseId;
|
||||
|
||||
/**
|
||||
* 用户Id
|
||||
*/
|
||||
@Column(name = "user_id")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 用户名称
|
||||
*/
|
||||
@Column(name = "user_name")
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 房间Id
|
||||
*/
|
||||
@Column(name = "room_id")
|
||||
private String roomId;
|
||||
|
||||
/**
|
||||
* 系统类型
|
||||
*/
|
||||
@Column(name = "system_type")
|
||||
private String systemType;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Column(name = "create_time")
|
||||
private Date createTime;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.ruoyi.system.mapper.shortmessage;
|
||||
|
||||
import com.ruoyi.system.domain.entity.shortmessage.MeetingInfo;
|
||||
import tk.mybatis.mapper.common.Mapper;
|
||||
|
||||
public interface MeetingInfoMapper extends Mapper<MeetingInfo> {
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
package com.ruoyi.wisdomarbitrate.domain.vo.shortmessage;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class MeetingInfoVO {
|
||||
/**
|
||||
* 案件Id
|
||||
*/
|
||||
private Long caseId;
|
||||
|
||||
/**
|
||||
* 用户Id
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 用户名称
|
||||
*/
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 房间Id
|
||||
*/
|
||||
private String roomId;
|
||||
|
||||
/**
|
||||
* 系统类型
|
||||
*/
|
||||
private String systemType;
|
||||
/**
|
||||
* 登录认证令牌
|
||||
*/
|
||||
private String token;
|
||||
}
|
||||
+3
@@ -2277,6 +2277,9 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
||||
}
|
||||
// 电话号不为空,发送短信,否则发邮箱
|
||||
if (StrUtil.isNotEmpty(sysUser.getPhonenumber())) {
|
||||
//TODO 发送调解时视频会议链接地址,模板id为2125909
|
||||
//短信模板:尊敬的{1}用户,您的{2}会议链接https://txroom.xayunmei.com/#/home?{3},请点击链接参加会议,如非本人操作,请忽略本短信
|
||||
|
||||
// todo 短信
|
||||
// cn.hutool.json.JSONObject jsonObject = SmsUtils.sendSms(application.getId(), templateId, sysUser.getPhonenumber(),
|
||||
// new String[]{caseApplication.getCaseNum(), application.getHearDate()});
|
||||
|
||||
-19
@@ -1,19 +0,0 @@
|
||||
package com.ruoyi.wisdomarbitrate.service.sendrecord;
|
||||
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.system.domain.entity.shortmessage.MsSmsSendHistoryRecord;
|
||||
import com.ruoyi.system.mapper.shortmessage.MsSmsSendHistoryRecordMapper;
|
||||
import com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SmsSendRecord;
|
||||
|
||||
public interface ShortMessageService {
|
||||
/**
|
||||
* 新增发送历史记录
|
||||
*/
|
||||
void insertShortMessageHistoryRecord(SmsSendRecord smsSendRecord);
|
||||
|
||||
/**
|
||||
* 重新发送短信
|
||||
* @param smsSendRecord
|
||||
*/
|
||||
AjaxResult reSendShortMessage(SmsSendRecord smsSendRecord);
|
||||
}
|
||||
-54
@@ -1,54 +0,0 @@
|
||||
package com.ruoyi.wisdomarbitrate.service.sendrecord.impl;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.SMSStatusEnum;
|
||||
import com.ruoyi.common.utils.SmsUtils;
|
||||
import com.ruoyi.system.domain.entity.shortmessage.MsSmsSendHistoryRecord;
|
||||
import com.ruoyi.system.mapper.shortmessage.MsSmsSendHistoryRecordMapper;
|
||||
import com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SmsSendRecord;
|
||||
import com.ruoyi.wisdomarbitrate.service.sendrecord.ShortMessageService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class ShortMessageServiceImpl implements ShortMessageService {
|
||||
@Autowired
|
||||
MsSmsSendHistoryRecordMapper msSmsSendHistoryRecordMapper;
|
||||
/**
|
||||
* 新增发送历史记录
|
||||
*
|
||||
* @param smsSendRecord
|
||||
*/
|
||||
@Override
|
||||
public void insertShortMessageHistoryRecord(SmsSendRecord smsSendRecord) {
|
||||
if(smsSendRecord!=null){
|
||||
MsSmsSendHistoryRecord historyRecord=new MsSmsSendHistoryRecord();
|
||||
BeanUtils.copyProperties(smsSendRecord,historyRecord);
|
||||
historyRecord.setId(null);
|
||||
historyRecord.setParentId(smsSendRecord.getId());
|
||||
msSmsSendHistoryRecordMapper.insert(historyRecord);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 重新发送短信
|
||||
*
|
||||
* @param smsSendRecord
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult reSendShortMessage(SmsSendRecord smsSendRecord) {
|
||||
SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest();
|
||||
//TODO 模版id待替换
|
||||
request.setTemplateId("1955047");
|
||||
request.setPhone(smsSendRecord.getPhone());
|
||||
request.setTemplateParamSet(new String[]{ smsSendRecord.getSendContent()});
|
||||
JSONObject resultObj = SmsUtils.sendSms(request);
|
||||
if(resultObj.get("status")!=null && !resultObj.get("status").equals(SMSStatusEnum.FAIL.getCode())){
|
||||
return AjaxResult.success("短信发送成功");
|
||||
}else {
|
||||
return AjaxResult.warn("短信发送失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
package com.ruoyi.wisdomarbitrate.service.shortmessage;
|
||||
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SmsSendRecord;
|
||||
import com.ruoyi.wisdomarbitrate.domain.vo.shortmessage.MeetingInfoVO;
|
||||
|
||||
public interface ShortMessageService {
|
||||
/**
|
||||
* 新增发送历史记录
|
||||
*/
|
||||
void insertShortMessageHistoryRecord(SmsSendRecord smsSendRecord);
|
||||
|
||||
/**
|
||||
* 重新发送短信
|
||||
*
|
||||
* @param smsSendRecord
|
||||
*/
|
||||
AjaxResult reSendShortMessage(SmsSendRecord smsSendRecord);
|
||||
|
||||
/**
|
||||
* 根据信息生成加密信息记录
|
||||
*
|
||||
* @param meetingInfoVO
|
||||
* @return
|
||||
*/
|
||||
String buildMeetingInfoRecord(MeetingInfoVO meetingInfoVO);
|
||||
|
||||
/**
|
||||
* 通过UID查询加密信息并解密成明文对象
|
||||
*/
|
||||
Object getMeetingInfo(String uid);
|
||||
}
|
||||
+117
@@ -0,0 +1,117 @@
|
||||
package com.ruoyi.wisdomarbitrate.service.shortmessage.impl;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.SMSStatusEnum;
|
||||
import com.ruoyi.common.utils.SmsUtils;
|
||||
import com.ruoyi.system.domain.entity.shortmessage.MeetingInfo;
|
||||
import com.ruoyi.system.domain.entity.shortmessage.MsSmsSendHistoryRecord;
|
||||
import com.ruoyi.system.mapper.shortmessage.MeetingInfoMapper;
|
||||
import com.ruoyi.system.mapper.shortmessage.MsSmsSendHistoryRecordMapper;
|
||||
import com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SmsSendRecord;
|
||||
import com.ruoyi.wisdomarbitrate.domain.vo.shortmessage.MeetingInfoVO;
|
||||
import com.ruoyi.wisdomarbitrate.service.shortmessage.ShortMessageService;
|
||||
import io.jsonwebtoken.Jwts;
|
||||
import io.jsonwebtoken.SignatureAlgorithm;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
@Service
|
||||
public class ShortMessageServiceImpl implements ShortMessageService {
|
||||
@Autowired
|
||||
MsSmsSendHistoryRecordMapper msSmsSendHistoryRecordMapper;
|
||||
@Autowired
|
||||
MeetingInfoMapper meetingInfoMapper;
|
||||
|
||||
/**
|
||||
* 新增发送历史记录
|
||||
*
|
||||
* @param smsSendRecord
|
||||
*/
|
||||
@Override
|
||||
public void insertShortMessageHistoryRecord(SmsSendRecord smsSendRecord) {
|
||||
if (smsSendRecord != null) {
|
||||
MsSmsSendHistoryRecord historyRecord = new MsSmsSendHistoryRecord();
|
||||
BeanUtils.copyProperties(smsSendRecord, historyRecord);
|
||||
historyRecord.setId(null);
|
||||
historyRecord.setParentId(smsSendRecord.getId());
|
||||
msSmsSendHistoryRecordMapper.insert(historyRecord);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 重新发送短信
|
||||
*
|
||||
* @param smsSendRecord
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult reSendShortMessage(SmsSendRecord smsSendRecord) {
|
||||
SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest();
|
||||
//TODO 模版id待替换
|
||||
request.setTemplateId("1955047");
|
||||
request.setPhone(smsSendRecord.getPhone());
|
||||
request.setTemplateParamSet(new String[]{smsSendRecord.getSendContent()});
|
||||
JSONObject resultObj = SmsUtils.sendSms(request);
|
||||
if (resultObj.get("status") != null && !resultObj.get("status").equals(SMSStatusEnum.FAIL.getCode())) {
|
||||
return AjaxResult.success("短信发送成功");
|
||||
} else {
|
||||
return AjaxResult.warn("短信发送失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据信息生成加密信息记录
|
||||
*
|
||||
* @param meetingInfoVO
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String buildMeetingInfoRecord(MeetingInfoVO meetingInfoVO) {
|
||||
String uid = UUID.randomUUID().toString().replace("-", "");
|
||||
MeetingInfo meetingInfo = MeetingInfo.builder().userId(meetingInfoVO.getUserId()).userName(meetingInfoVO.getUserName()).caseId(meetingInfoVO.getCaseId()).roomId(meetingInfoVO.getRoomId()).systemType(meetingInfoVO.getSystemType()).createTime(new Date()).uid(uid).build();
|
||||
meetingInfo.setUid(uid);
|
||||
meetingInfoMapper.insertSelective(meetingInfo);
|
||||
return uid;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过UID查询加密信息并解密成明文对象
|
||||
*
|
||||
* @param uid
|
||||
*/
|
||||
@Override
|
||||
public Object getMeetingInfo(String uid) {
|
||||
MeetingInfoVO result = new MeetingInfoVO();
|
||||
MeetingInfo meetingInfo = meetingInfoMapper.selectByPrimaryKey(uid);
|
||||
if (meetingInfo != null) {
|
||||
BeanUtils.copyProperties(meetingInfo, result);
|
||||
if (result != null) {
|
||||
Map<String, Object> claims = new HashMap<>();
|
||||
claims.put("userName", meetingInfo.getUserName());
|
||||
claims.put("userId", meetingInfo.getUserId());
|
||||
claims.put(Constants.MEETING_KEY, uid);
|
||||
String createToken = createToken(claims);
|
||||
result.setToken(createToken);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// 令牌秘钥
|
||||
@Value("${token.secret}")
|
||||
private String secret;
|
||||
|
||||
private String createToken(Map<String, Object> claims) {
|
||||
String token = Jwts.builder().setClaims(claims).signWith(SignatureAlgorithm.HS512, secret).compact();
|
||||
return token;
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
<?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.shortmessage.MeetingInfoMapper">
|
||||
<resultMap id="BaseResultMap" type="com.ruoyi.system.domain.entity.shortmessage.MeetingInfo">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
-->
|
||||
<id column="uid" jdbcType="VARCHAR" property="uid" />
|
||||
<result column="case_id" jdbcType="BIGINT" property="caseId" />
|
||||
<result column="user_id" jdbcType="BIGINT" property="userId" />
|
||||
<result column="user_name" jdbcType="VARCHAR" property="userName" />
|
||||
<result column="room_id" jdbcType="VARCHAR" property="roomId" />
|
||||
<result column="system_type" jdbcType="VARCHAR" property="systemType" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
</resultMap>
|
||||
</mapper>
|
||||
@@ -7,6 +7,6 @@ targetprojectpath=D:/WorkCode/TJ/Mediation-Backend/ruoyi-system
|
||||
#模块名称
|
||||
moduleName=shortmessage
|
||||
#表名
|
||||
tableName=ms_sms_send_history_record
|
||||
tableName=encryptend_info
|
||||
#主键
|
||||
premaryId=id
|
||||
|
||||
Reference in New Issue
Block a user