前后端联调
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
package com.ruoyi.common.enums;
|
||||
|
||||
import com.ruoyi.common.interfaces.EnumsInterface;
|
||||
|
||||
/**
|
||||
* @Classname AnnexTypeEnum
|
||||
* @Description 附件类型枚举
|
||||
* @Version 1.0.0
|
||||
* @Date 2024/1/12 17:50
|
||||
* @Created wangqiong
|
||||
*/
|
||||
public enum AnnexTypeEnum implements EnumsInterface {
|
||||
APPLICATION(1, "仲裁申请书"),
|
||||
APPLICATION_EVIDENCE(2, "申请人证据"),
|
||||
MEDIATION_APPLICATION(3, "调解申请书"),
|
||||
PAYMENT_RECEIPT(4, "缴费单"),
|
||||
|
||||
;
|
||||
|
||||
private final Integer code;
|
||||
private final String text;
|
||||
|
||||
AnnexTypeEnum(Integer code, String text)
|
||||
{
|
||||
this.code = code;
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
public Integer getCode()
|
||||
{
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getText()
|
||||
{
|
||||
return text;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据code获取text
|
||||
* @param codeNo
|
||||
* @return
|
||||
*/
|
||||
public static String getTextByCode(Integer codeNo){
|
||||
for (AnnexTypeEnum value : AnnexTypeEnum.values()) {
|
||||
if (value.getCode().equals(codeNo)){
|
||||
return value.getText();
|
||||
}
|
||||
}
|
||||
return codeNo.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据text获取code
|
||||
* @param textStr
|
||||
* @return
|
||||
*/
|
||||
public static String getCodeByText(String textStr){
|
||||
for (AnnexTypeEnum value : AnnexTypeEnum.values()) {
|
||||
if (value.getText().equals(textStr)){
|
||||
return value.getText();
|
||||
}
|
||||
}
|
||||
return textStr;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.ruoyi.common.enums;
|
||||
|
||||
import com.ruoyi.common.interfaces.EnumsInterface;
|
||||
|
||||
/**
|
||||
* @Classname PaymentStatusEnum
|
||||
* @Description 支付状态枚举
|
||||
* @Version 1.0.0
|
||||
* @Date 2024/1/12 18:07
|
||||
* @Created wangqiong
|
||||
*/
|
||||
public enum PaymentStatusEnum implements EnumsInterface {
|
||||
UNPAID(0, "未支付"),
|
||||
PAID(1, "已支付"),
|
||||
|
||||
|
||||
;
|
||||
|
||||
private final Integer code;
|
||||
private final String text;
|
||||
|
||||
PaymentStatusEnum(Integer code, String text)
|
||||
{
|
||||
this.code = code;
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
public Integer getCode()
|
||||
{
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getText()
|
||||
{
|
||||
return text;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据code获取text
|
||||
* @param codeNo
|
||||
* @return
|
||||
*/
|
||||
public static String getTextByCode(Integer codeNo){
|
||||
for (PaymentStatusEnum value : PaymentStatusEnum.values()) {
|
||||
if (value.getCode().equals(codeNo)){
|
||||
return value.getText();
|
||||
}
|
||||
}
|
||||
return codeNo.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据text获取code
|
||||
* @param textStr
|
||||
* @return
|
||||
*/
|
||||
public static String getCodeByText(String textStr){
|
||||
for (PaymentStatusEnum value : PaymentStatusEnum.values()) {
|
||||
if (value.getText().equals(textStr)){
|
||||
return value.getText();
|
||||
}
|
||||
}
|
||||
return textStr;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.ruoyi.common.utils;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import org.apache.poi.xwpf.usermodel.XWPFDocument;
|
||||
import org.apache.poi.xwpf.usermodel.XWPFParagraph;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* @Classname BookMarkUtil
|
||||
* @Description 获取模板中的占位符{{xxx}}
|
||||
* @Version 1.0.0
|
||||
* @Date 2024/1/11 18:07
|
||||
* @Created wangqiong
|
||||
*/
|
||||
public class BookMarkUtil {
|
||||
/**
|
||||
* 根据裁决书模板获取所有的占位符,占位符必须是{{name}}格式
|
||||
*
|
||||
* @param path
|
||||
* @return
|
||||
*/
|
||||
public static List<String> getBookmarkByDocx(String path) {
|
||||
XWPFDocument xwpfDocument = null;
|
||||
try {
|
||||
FileInputStream fileInputStream = new FileInputStream(path);
|
||||
xwpfDocument = new XWPFDocument(fileInputStream);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (xwpfDocument == null) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
List<XWPFParagraph> paragraphs = xwpfDocument.getParagraphs();
|
||||
if (CollectionUtil.isEmpty(xwpfDocument.getParagraphs())) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
String regex = "\\{\\{.*?\\}\\}"; // 定义占位符的正则表达式
|
||||
Pattern pattern = Pattern.compile(regex);
|
||||
List<String> bookmarkList = new ArrayList<>();
|
||||
for (XWPFParagraph paragraph : paragraphs) {
|
||||
String text = paragraph.getText();
|
||||
if (StrUtil.isNotEmpty(text)) {
|
||||
Matcher matcher = pattern.matcher(text);
|
||||
|
||||
while (matcher.find()) {
|
||||
String placeholder = matcher.group();
|
||||
String keyword = placeholder.substring(2, placeholder.length() - 2);
|
||||
bookmarkList.add(keyword);
|
||||
}
|
||||
}
|
||||
}
|
||||
return bookmarkList;
|
||||
}
|
||||
}
|
||||
@@ -2,15 +2,12 @@ package com.ruoyi.common.utils;
|
||||
|
||||
import com.tencentcloudapi.common.Credential;
|
||||
import com.tencentcloudapi.common.exception.TencentCloudSDKException;
|
||||
import com.tencentcloudapi.common.profile.ClientProfile;
|
||||
import com.tencentcloudapi.common.profile.HttpProfile;
|
||||
import com.tencentcloudapi.cvm.v20170312.CvmClient;
|
||||
import com.tencentcloudapi.cvm.v20170312.models.DescribeRegionsRequest;
|
||||
import com.tencentcloudapi.cvm.v20170312.models.DescribeRegionsResponse;
|
||||
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;
|
||||
|
||||
@@ -53,10 +50,39 @@ public class SmsUtils {
|
||||
}
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
public static Boolean sendSms(Long caseId,String templateId,String phone,String[] templateParamSet) {
|
||||
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) {
|
||||
log.error("发送短信出错:", e);
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
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())){
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
/**
|
||||
* 参数对象
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class SendSmsRequest {
|
||||
/**
|
||||
* 电话
|
||||
|
||||
Reference in New Issue
Block a user