parent
3b5785476e
commit
6821005afb
|
|
@ -0,0 +1,7 @@
|
|||
package com.nu.modules.errorrecordlog;
|
||||
|
||||
import com.nu.entity.ErrorRecordLogEntity;
|
||||
|
||||
public interface IErrorRecordLogApi {
|
||||
String saveData(ErrorRecordLogEntity entity);
|
||||
}
|
||||
|
|
@ -0,0 +1,164 @@
|
|||
package com.nu.modules.errorrecordlog.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.Date;
|
||||
import java.math.BigDecimal;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import org.jeecg.common.constant.ProvinceCityArea;
|
||||
import org.jeecg.common.util.SpringContextUtils;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @Description: nu_error_record_log
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-03-10
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("nu_error_record_log")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="nu_error_record_log对象", description="nu_error_record_log")
|
||||
public class ErrorRecordLog implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键ID*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "ID")
|
||||
private String id;
|
||||
/**功能模块(如:用户管理、订单导入)*/
|
||||
@Excel(name = "功能模块(如:用户管理、订单导入)", width = 15)
|
||||
@ApiModelProperty(value = "功能模块(如:用户管理、订单导入)")
|
||||
private String functionModule;
|
||||
/**具体环节(如:新增用户、Excel解析)*/
|
||||
@Excel(name = "具体环节(如:新增用户、Excel解析)", width = 15)
|
||||
@ApiModelProperty(value = "具体环节(如:新增用户、Excel解析)")
|
||||
private String functionAction;
|
||||
/**方法路径*/
|
||||
@Excel(name = "方法路径", width = 15)
|
||||
@ApiModelProperty(value = "方法路径")
|
||||
private String functionPath;
|
||||
/**错误简介*/
|
||||
@Excel(name = "错误简介", width = 15)
|
||||
@ApiModelProperty(value = "错误简介")
|
||||
private String errorBrief;
|
||||
/**错误详细信息(堆栈或完整描述)*/
|
||||
@Excel(name = "错误详细信息(堆栈或完整描述)", width = 15)
|
||||
@ApiModelProperty(value = "错误详细信息(堆栈或完整描述)")
|
||||
private String errorDetail;
|
||||
/**业务数据ID(如订单ID、用户ID)*/
|
||||
@Excel(name = "业务数据ID(如订单ID、用户ID)", width = 15)
|
||||
@ApiModelProperty(value = "业务数据ID(如订单ID、用户ID)")
|
||||
private String businessId;
|
||||
/**业务数据快照(出错时的数据内容)*/
|
||||
@Excel(name = "业务数据快照(出错时的数据内容)", width = 15)
|
||||
@ApiModelProperty(value = "业务数据快照(出错时的数据内容)")
|
||||
private String businessData;
|
||||
/**错误类型(系统异常/业务异常/参数校验)*/
|
||||
@Excel(name = "错误类型(系统异常/业务异常/参数校验)", width = 15)
|
||||
@ApiModelProperty(value = "错误类型(系统异常/业务异常/参数校验)")
|
||||
private String errorType;
|
||||
/**错误码*/
|
||||
@Excel(name = "错误码", width = 15)
|
||||
@ApiModelProperty(value = "错误码")
|
||||
private String errorCode;
|
||||
/**错误级别:1-提示,2-警告,3-严重,4-致命*/
|
||||
@Excel(name = "错误级别:1-提示,2-警告,3-严重,4-致命", width = 15)
|
||||
@ApiModelProperty(value = "错误级别:1-提示,2-警告,3-严重,4-致命")
|
||||
private Integer errorLevel;
|
||||
/**已重试次数*/
|
||||
@Excel(name = "已重试次数", width = 15)
|
||||
@ApiModelProperty(value = "已重试次数")
|
||||
private Integer retryCount;
|
||||
/**最大重试次数*/
|
||||
@Excel(name = "最大重试次数", width = 15)
|
||||
@ApiModelProperty(value = "最大重试次数")
|
||||
private Integer maxRetryCount;
|
||||
/**处理状态:0-待处理,1-处理中,2-已解决,3-无需处理,4-重试失败*/
|
||||
@Excel(name = "处理状态:0-待处理,1-处理中,2-已解决,3-无需处理,4-重试失败", width = 15)
|
||||
@ApiModelProperty(value = "处理状态:0-待处理,1-处理中,2-已解决,3-无需处理,4-重试失败")
|
||||
private Integer handleStatus;
|
||||
/**处理结果/备注*/
|
||||
@Excel(name = "处理结果/备注", width = 15)
|
||||
@ApiModelProperty(value = "处理结果/备注")
|
||||
private String handleResult;
|
||||
/**处理人*/
|
||||
@Excel(name = "处理人", width = 15)
|
||||
@ApiModelProperty(value = "处理人")
|
||||
private String handler;
|
||||
/**处理时间*/
|
||||
@Excel(name = "处理时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "处理时间")
|
||||
private Date handleTime;
|
||||
/**请求URL*/
|
||||
@Excel(name = "请求URL", width = 15)
|
||||
@ApiModelProperty(value = "请求URL")
|
||||
private String requestUrl;
|
||||
/**请求方法*/
|
||||
@Excel(name = "请求方法", width = 15)
|
||||
@ApiModelProperty(value = "请求方法")
|
||||
private String requestMethod;
|
||||
/**请求参数*/
|
||||
@Excel(name = "请求参数", width = 15)
|
||||
@ApiModelProperty(value = "请求参数")
|
||||
private String requestParams;
|
||||
/**客户端IP*/
|
||||
@Excel(name = "客户端IP", width = 15)
|
||||
@ApiModelProperty(value = "客户端IP")
|
||||
private String ipAddress;
|
||||
/**用户代理*/
|
||||
@Excel(name = "用户代理", width = 15)
|
||||
@ApiModelProperty(value = "用户代理")
|
||||
private String userAgent;
|
||||
/**环境:dev/test/prod*/
|
||||
@Excel(name = "环境:dev/test/prod", width = 15)
|
||||
@ApiModelProperty(value = "环境:dev/test/prod")
|
||||
private String env;
|
||||
/**应用版本*/
|
||||
@Excel(name = "应用版本", width = 15)
|
||||
@ApiModelProperty(value = "应用版本")
|
||||
private String version;
|
||||
/**机构名称*/
|
||||
@Excel(name = "机构名称", width = 15)
|
||||
@ApiModelProperty(value = "机构名称")
|
||||
private String orgName;
|
||||
/**机构编码*/
|
||||
@Excel(name = "机构编码", width = 15)
|
||||
@ApiModelProperty(value = "机构编码")
|
||||
private String orgCode;
|
||||
/**创建人(操作人)*/
|
||||
@ApiModelProperty(value = "创建人(操作人)")
|
||||
private String createBy;
|
||||
/**创建时间(错误发生时间)*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "创建时间(错误发生时间)")
|
||||
private Date createTime;
|
||||
/**更新人*/
|
||||
@ApiModelProperty(value = "更新人")
|
||||
private String updateBy;
|
||||
/**更新时间*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private Date updateTime;
|
||||
/**删除标识(0-正常,1-已删除)*/
|
||||
@Excel(name = "删除标识(0-正常,1-已删除)", width = 15)
|
||||
@ApiModelProperty(value = "删除标识(0-正常,1-已删除)")
|
||||
@TableLogic
|
||||
private Integer delFlag;
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
package com.nu.modules.errorrecordlog.mapper;
|
||||
|
||||
import com.nu.modules.errorrecordlog.entity.ErrorRecordLog;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @Description: nu_error_record_log
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-03-10
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface ErrorRecordLogMapper extends BaseMapper<ErrorRecordLog> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<?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.nu.modules.errorrecordlog.mapper.ErrorRecordLogMapper">
|
||||
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
package com.nu.modules.errorrecordlog.service;
|
||||
|
||||
import com.nu.modules.errorrecordlog.entity.ErrorRecordLog;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @Description: nu_error_record_log
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-03-10
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IErrorRecordLogService extends IService<ErrorRecordLog> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
package com.nu.modules.errorrecordlog.service.impl;
|
||||
|
||||
import com.nu.entity.ErrorRecordLogEntity;
|
||||
import com.nu.modules.errorrecordlog.IErrorRecordLogApi;
|
||||
import com.nu.modules.errorrecordlog.entity.ErrorRecordLog;
|
||||
import com.nu.modules.errorrecordlog.mapper.ErrorRecordLogMapper;
|
||||
import com.nu.modules.errorrecordlog.service.IErrorRecordLogService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
/**
|
||||
* @Description: nu_error_record_log
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-03-10
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class ErrorRecordLogServiceImpl extends ServiceImpl<ErrorRecordLogMapper, ErrorRecordLog> implements IErrorRecordLogService, IErrorRecordLogApi {
|
||||
|
||||
@Override
|
||||
public String saveData(ErrorRecordLogEntity entity) {
|
||||
ErrorRecordLog saveData = new ErrorRecordLog();
|
||||
BeanUtils.copyProperties(entity,saveData);
|
||||
baseMapper.insert(saveData);
|
||||
return saveData.getId();
|
||||
}
|
||||
}
|
||||
|
|
@ -2,7 +2,10 @@ package com.nu.mq.workorder.listener;
|
|||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.aliyuncs.exceptions.ClientException;
|
||||
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
|
||||
import com.nu.dto.WorkOrderMQDto;
|
||||
import com.nu.entity.ErrorRecordLogEntity;
|
||||
import com.nu.modules.errorrecordlog.IErrorRecordLogApi;
|
||||
import com.nu.modules.orgapplyinfo.entity.OrgApplyInfo;
|
||||
import com.nu.modules.orgapplyinfo.service.IOrgApplyInfoService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
|
@ -30,6 +33,8 @@ public class WorkOrderMQListener {
|
|||
private IOrgApplyInfoService orgApplyInfoService;
|
||||
@Autowired
|
||||
private ISysBaseAPI sysBaseAPI;
|
||||
@Autowired
|
||||
private IErrorRecordLogApi errorRecordLogApi;
|
||||
|
||||
/**
|
||||
* 工单回执
|
||||
|
|
@ -136,13 +141,58 @@ public class WorkOrderMQListener {
|
|||
|
||||
try {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("code","SMS_319245237");
|
||||
jsonObject.put("name",workOrderMQDto.getFrontPath());
|
||||
jsonObject.put("username",workOrderMQDto.getAccountNo());
|
||||
jsonObject.put("password",workOrderMQDto.getPasswordText());
|
||||
DySmsHelper.sendSms(workOrderMQDto.getAccountNo(),jsonObject, DySmsEnum.JIGOURUZHU_DAJIANWANCHENG);
|
||||
jsonObject.put("code", "SMS_319245237");
|
||||
// jsonObject.put("name", workOrderMQDto.getFrontPath());
|
||||
jsonObject.put("name", "/biz101");
|
||||
jsonObject.put("username", workOrderMQDto.getAccountNo());
|
||||
jsonObject.put("password", workOrderMQDto.getPasswordText());
|
||||
Map<String, Object> smsResult = DySmsHelper.sendSmsReturnMsg(workOrderMQDto.getAccountNo(), jsonObject, DySmsEnum.JIGOURUZHU_DAJIANWANCHENG);
|
||||
if (!"success".equals(smsResult.get("code"))) {
|
||||
//运维级别错误,需要人工处理
|
||||
try {
|
||||
DynamicDataSourceContextHolder.push("devops");
|
||||
ErrorRecordLogEntity errorRecordLogEntity = new ErrorRecordLogEntity();
|
||||
errorRecordLogEntity.setFunctionModule("机构加盟-平台搭建-反馈");//功能
|
||||
errorRecordLogEntity.setFunctionAction("给机构负责人发短信");//错误对应环节
|
||||
errorRecordLogEntity.setFunctionPath("WorkOrderMQListener.handFk");//错误发生的类.方法 数据库类型text 可以记录多个方法(最好有个箭头代表方法执行顺序)
|
||||
errorRecordLogEntity.setErrorBrief("机构加盟平台搭建完成给机构负责人发短信失败");//错误简介-显示在列表页
|
||||
errorRecordLogEntity.setErrorDetail((String) smsResult.get("msg"));//错误详情
|
||||
errorRecordLogEntity.setBusinessId("工单ID:" + workOrderMQDto.getId() + ";sys_depart的ID:" + workOrderMQDto.getOrgId());//业务数据ID
|
||||
errorRecordLogEntity.setBusinessData(JSONObject.toJSONString(workOrderMQDto));//入参
|
||||
errorRecordLogEntity.setErrorType("系统异常");//错误类型
|
||||
errorRecordLogEntity.setErrorCode(null);//错误码-暂时用不上
|
||||
errorRecordLogEntity.setErrorLevel(3);//错误级别 1-提示,2-警告,3-严重,4-致命
|
||||
errorRecordLogEntity.setRequestParams(JSONObject.toJSONString(workOrderMQDto));//请求参数
|
||||
errorRecordLogEntity.setOrgName("管理平台");//错误发生平台名称
|
||||
errorRecordLogEntity.setOrgCode("ope");//错误发生平台编码/数据库多数据源名
|
||||
errorRecordLogApi.saveData(errorRecordLogEntity);
|
||||
} finally {
|
||||
DynamicDataSourceContextHolder.clear();
|
||||
}
|
||||
}
|
||||
} catch (ClientException e) {
|
||||
//todo 需要做处理
|
||||
//运维级别错误,需要人工处理
|
||||
try {
|
||||
DynamicDataSourceContextHolder.push("devops");
|
||||
ErrorRecordLogEntity errorRecordLogEntity = new ErrorRecordLogEntity();
|
||||
errorRecordLogEntity.setFunctionModule("机构加盟-平台搭建-反馈");//功能
|
||||
errorRecordLogEntity.setFunctionAction("给机构负责人发短信");//错误对应环节
|
||||
errorRecordLogEntity.setFunctionPath("WorkOrderMQListener.handFk");//错误发生的类.方法 数据库类型text 可以记录多个方法(最好有个箭头代表方法执行顺序)
|
||||
errorRecordLogEntity.setErrorBrief("机构加盟平台搭建完成给机构负责人发短信失败");//错误简介-显示在列表页
|
||||
errorRecordLogEntity.setErrorDetail(e.getMessage());//错误详情
|
||||
errorRecordLogEntity.setBusinessId("工单ID:" + workOrderMQDto.getId() + ";sys_depart的ID:" + workOrderMQDto.getOrgId());//业务数据ID
|
||||
errorRecordLogEntity.setBusinessData(JSONObject.toJSONString(workOrderMQDto));//入参
|
||||
errorRecordLogEntity.setErrorType("系统异常");//错误类型
|
||||
errorRecordLogEntity.setErrorCode(null);//错误码-暂时用不上
|
||||
errorRecordLogEntity.setErrorLevel(3);//错误级别 1-提示,2-警告,3-严重,4-致命
|
||||
errorRecordLogEntity.setRequestParams(JSONObject.toJSONString(workOrderMQDto));//请求参数
|
||||
errorRecordLogEntity.setOrgName("管理平台");//错误发生平台名称
|
||||
errorRecordLogEntity.setOrgCode("ope");//错误发生平台编码/数据库多数据源名
|
||||
errorRecordLogApi.saveData(errorRecordLogEntity);
|
||||
} finally {
|
||||
DynamicDataSourceContextHolder.clear();
|
||||
}
|
||||
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse;
|
|||
import com.aliyuncs.exceptions.ClientException;
|
||||
import com.aliyuncs.profile.DefaultProfile;
|
||||
import com.aliyuncs.profile.IClientProfile;
|
||||
import com.google.common.collect.Maps;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.jeecg.common.constant.enums.DySmsEnum;
|
||||
import org.jeecg.config.JeecgSmsTemplateConfig;
|
||||
|
|
@ -31,7 +32,7 @@ import java.util.Map;
|
|||
* @author: jeecg-boot
|
||||
*/
|
||||
public class DySmsHelper {
|
||||
|
||||
|
||||
private final static Logger logger=LoggerFactory.getLogger(DySmsHelper.class);
|
||||
|
||||
/**产品名称:云通信短信API产品,开发者无需替换*/
|
||||
|
|
@ -58,8 +59,8 @@ public class DySmsHelper {
|
|||
public static String getAccessKeySecret() {
|
||||
return accessKeySecret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static boolean sendSms(String phone, JSONObject templateParamJson, DySmsEnum dySmsEnum) throws ClientException {
|
||||
//可自助调整超时时间
|
||||
System.setProperty("sun.net.client.defaultConnectTimeout", "10000");
|
||||
|
|
@ -72,12 +73,12 @@ public class DySmsHelper {
|
|||
setAccessKeyId(staticConfig.getAccessKeyId());
|
||||
setAccessKeySecret(staticConfig.getAccessKeySecret());
|
||||
//update-end-author:taoyan date:20200811 for:配置类数据获取
|
||||
|
||||
|
||||
//初始化acsClient,暂不支持region化
|
||||
IClientProfile profile = DefaultProfile.getProfile("cn-hangzhou", accessKeyId, accessKeySecret);
|
||||
DefaultProfile.addEndpoint("cn-hangzhou", "cn-hangzhou", PRODUCT, DOMAIN);
|
||||
IAcsClient acsClient = new DefaultAcsClient(profile);
|
||||
|
||||
|
||||
//验证json参数
|
||||
validateParam(templateParamJson,dySmsEnum);
|
||||
|
||||
|
|
@ -87,7 +88,7 @@ public class DySmsHelper {
|
|||
if(baseConfig != null && CollectionUtil.isNotEmpty(baseConfig.getTemplateCode())){
|
||||
Map<String, String> smsTemplate = baseConfig.getTemplateCode();
|
||||
if(smsTemplate.containsKey(templateCode) && StringUtils.isNotEmpty(smsTemplate.get(templateCode))){
|
||||
templateCode = smsTemplate.get(templateCode);
|
||||
templateCode = smsTemplate.get(templateCode);
|
||||
logger.info("yml中读取短信code{}",templateCode);
|
||||
}
|
||||
}
|
||||
|
|
@ -98,7 +99,7 @@ public class DySmsHelper {
|
|||
signName = baseConfig.getSignature();
|
||||
}
|
||||
//update-end---author:wangshuai---date:2024-11-05---for:【QQYUN-9422】短信模板管理,阿里云---
|
||||
|
||||
|
||||
//组装请求对象-具体描述见控制台-文档部分内容
|
||||
SendSmsRequest request = new SendSmsRequest();
|
||||
//必填:待发送手机号
|
||||
|
|
@ -109,7 +110,7 @@ public class DySmsHelper {
|
|||
request.setTemplateCode(templateCode);
|
||||
//可选:模板中的变量替换JSON串,如模板内容为"亲爱的${name},您的验证码为${code}"时,此处的值为
|
||||
request.setTemplateParam(templateParamJson.toJSONString());
|
||||
|
||||
|
||||
//选填-上行短信扩展码(无特殊需求用户请忽略此字段)
|
||||
//request.setSmsUpExtendCode("90997");
|
||||
|
||||
|
|
@ -128,9 +129,87 @@ public class DySmsHelper {
|
|||
result = true;
|
||||
}
|
||||
return result;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static Map<String, Object> sendSmsReturnMsg(String phone, JSONObject templateParamJson, DySmsEnum dySmsEnum) throws ClientException {
|
||||
Map<String, Object> result = Maps.newHashMap();
|
||||
result.put("code","error");
|
||||
result.put("msg",null);
|
||||
|
||||
//可自助调整超时时间
|
||||
System.setProperty("sun.net.client.defaultConnectTimeout", "10000");
|
||||
System.setProperty("sun.net.client.defaultReadTimeout", "10000");
|
||||
|
||||
//update-begin-author:taoyan date:20200811 for:配置类数据获取
|
||||
StaticConfig staticConfig = SpringContextUtils.getBean(StaticConfig.class);
|
||||
//logger.info("阿里大鱼短信秘钥 accessKeyId:" + staticConfig.getAccessKeyId());
|
||||
//logger.info("阿里大鱼短信秘钥 accessKeySecret:"+ staticConfig.getAccessKeySecret());
|
||||
setAccessKeyId(staticConfig.getAccessKeyId());
|
||||
setAccessKeySecret(staticConfig.getAccessKeySecret());
|
||||
//update-end-author:taoyan date:20200811 for:配置类数据获取
|
||||
|
||||
//初始化acsClient,暂不支持region化
|
||||
IClientProfile profile = DefaultProfile.getProfile("cn-hangzhou", accessKeyId, accessKeySecret);
|
||||
DefaultProfile.addEndpoint("cn-hangzhou", "cn-hangzhou", PRODUCT, DOMAIN);
|
||||
IAcsClient acsClient = new DefaultAcsClient(profile);
|
||||
|
||||
//验证json参数
|
||||
validateParam(templateParamJson, dySmsEnum);
|
||||
|
||||
//update-begin---author:wangshuai---date:2024-11-05---for:【QQYUN-9422】短信模板管理,阿里云---
|
||||
String templateCode = dySmsEnum.getTemplateCode();
|
||||
JeecgSmsTemplateConfig baseConfig = SpringContextUtils.getBean(JeecgSmsTemplateConfig.class);
|
||||
if (baseConfig != null && CollectionUtil.isNotEmpty(baseConfig.getTemplateCode())) {
|
||||
Map<String, String> smsTemplate = baseConfig.getTemplateCode();
|
||||
if (smsTemplate.containsKey(templateCode) && StringUtils.isNotEmpty(smsTemplate.get(templateCode))) {
|
||||
templateCode = smsTemplate.get(templateCode);
|
||||
logger.info("yml中读取短信code{}", templateCode);
|
||||
}
|
||||
}
|
||||
//签名名称
|
||||
String signName = dySmsEnum.getSignName();
|
||||
if (baseConfig != null && StringUtils.isNotEmpty(baseConfig.getSignature())) {
|
||||
logger.info("yml中读取签名名称{}", baseConfig.getSignature());
|
||||
signName = baseConfig.getSignature();
|
||||
}
|
||||
//update-end---author:wangshuai---date:2024-11-05---for:【QQYUN-9422】短信模板管理,阿里云---
|
||||
|
||||
//组装请求对象-具体描述见控制台-文档部分内容
|
||||
SendSmsRequest request = new SendSmsRequest();
|
||||
//必填:待发送手机号
|
||||
request.setPhoneNumbers(phone);
|
||||
//必填:短信签名-可在短信控制台中找到
|
||||
request.setSignName(signName);
|
||||
//必填:短信模板-可在短信控制台中找到
|
||||
request.setTemplateCode(templateCode);
|
||||
//可选:模板中的变量替换JSON串,如模板内容为"亲爱的${name},您的验证码为${code}"时,此处的值为
|
||||
request.setTemplateParam(templateParamJson.toJSONString());
|
||||
|
||||
//选填-上行短信扩展码(无特殊需求用户请忽略此字段)
|
||||
//request.setSmsUpExtendCode("90997");
|
||||
|
||||
//可选:outId为提供给业务方扩展字段,最终在短信回执消息中将此值带回给调用者
|
||||
//request.setOutId("yourOutId");
|
||||
|
||||
|
||||
logger.info("{phone:" + phone + ",signName:" + signName + ",templateCode:" + templateCode + ",templateParamJson:" + templateParamJson.toJSONString() + "}");
|
||||
//hint 此处可能会抛出异常,注意catch
|
||||
SendSmsResponse sendSmsResponse = acsClient.getAcsResponse(request);
|
||||
logger.info("短信接口返回的数据----------------");
|
||||
logger.info("{Code:" + sendSmsResponse.getCode() + ",Message:" + sendSmsResponse.getMessage() + ",RequestId:" + sendSmsResponse.getRequestId() + ",BizId:" + sendSmsResponse.getBizId() + "}");
|
||||
String ok = "OK";
|
||||
if (ok.equals(sendSmsResponse.getCode())) {
|
||||
result.put("code","success");
|
||||
result.put("msg",null);
|
||||
return result;
|
||||
}
|
||||
result.put("code","error");
|
||||
result.put("msg","{Code:" + sendSmsResponse.getCode() + ",Message:" + sendSmsResponse.getMessage() + ",RequestId:" + sendSmsResponse.getRequestId() + ",BizId:" + sendSmsResponse.getBizId() + "}");
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
private static void validateParam(JSONObject templateParamJson,DySmsEnum dySmsEnum) {
|
||||
String keys = dySmsEnum.getKeys();
|
||||
String [] keyArr = keys.split(",");
|
||||
|
|
@ -140,7 +219,7 @@ public class DySmsHelper {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// public static void main(String[] args) throws ClientException, InterruptedException {
|
||||
// JSONObject obj = new JSONObject();
|
||||
|
|
|
|||
|
|
@ -0,0 +1,91 @@
|
|||
package com.nu.dto;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Description: nu_error_record_log
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-03-10
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
public class ErrorRecordLogMQDto implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键ID*/
|
||||
private String id;
|
||||
/**功能模块(如:用户管理、订单导入)*/
|
||||
private String functionModule;
|
||||
/**具体环节(如:新增用户、Excel解析)*/
|
||||
private String functionAction;
|
||||
/**方法路径*/
|
||||
private String functionPath;
|
||||
/**错误简介*/
|
||||
private String errorBrief;
|
||||
/**错误详细信息(堆栈或完整描述)*/
|
||||
private String errorDetail;
|
||||
/**业务数据ID(如订单ID、用户ID)*/
|
||||
private String businessId;
|
||||
/**业务数据快照(出错时的数据内容)*/
|
||||
private String businessData;
|
||||
/**错误类型(系统异常/业务异常/参数校验)*/
|
||||
private String errorType;
|
||||
/**错误码*/
|
||||
private String errorCode;
|
||||
/**错误级别:1-提示,2-警告,3-严重,4-致命*/
|
||||
private Integer errorLevel;
|
||||
/**已重试次数*/
|
||||
private Integer retryCount;
|
||||
/**最大重试次数*/
|
||||
private Integer maxRetryCount;
|
||||
/**处理状态:0-待处理,1-处理中,2-已解决,3-无需处理,4-重试失败*/
|
||||
private Integer handleStatus;
|
||||
/**处理结果/备注*/
|
||||
private String handleResult;
|
||||
/**处理人*/
|
||||
private String handler;
|
||||
/**处理时间*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date handleTime;
|
||||
/**请求URL*/
|
||||
private String requestUrl;
|
||||
/**请求方法*/
|
||||
private String requestMethod;
|
||||
/**请求参数*/
|
||||
private String requestParams;
|
||||
/**客户端IP*/
|
||||
private String ipAddress;
|
||||
/**用户代理*/
|
||||
private String userAgent;
|
||||
/**环境:dev/test/prod*/
|
||||
private String env;
|
||||
/**应用版本*/
|
||||
private String version;
|
||||
/**机构名称*/
|
||||
private String orgName;
|
||||
/**机构编码*/
|
||||
private String orgCode;
|
||||
/**创建人(操作人)*/
|
||||
private String createBy;
|
||||
/**创建时间(错误发生时间)*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
/**更新人*/
|
||||
private String updateBy;
|
||||
/**更新时间*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
/**删除标识(0-正常,1-已删除)*/
|
||||
private Integer delFlag;
|
||||
}
|
||||
|
|
@ -0,0 +1,92 @@
|
|||
package com.nu.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Description: nu_error_record_log
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-03-10
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
public class ErrorRecordLogEntity implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键ID*/
|
||||
private String id;
|
||||
/**功能模块(如:用户管理、订单导入)*/
|
||||
private String functionModule;
|
||||
/**具体环节(如:新增用户、Excel解析)*/
|
||||
private String functionAction;
|
||||
/**方法路径*/
|
||||
private String functionPath;
|
||||
/**错误简介*/
|
||||
private String errorBrief;
|
||||
/**错误详细信息(堆栈或完整描述)*/
|
||||
private String errorDetail;
|
||||
/**业务数据ID(如订单ID、用户ID)*/
|
||||
private String businessId;
|
||||
/**业务数据快照(出错时的数据内容)*/
|
||||
private String businessData;
|
||||
/**错误类型(系统异常/业务异常/参数校验)*/
|
||||
private String errorType;
|
||||
/**错误码*/
|
||||
private String errorCode;
|
||||
/**错误级别:1-提示,2-警告,3-严重,4-致命*/
|
||||
private Integer errorLevel;
|
||||
/**已重试次数*/
|
||||
private Integer retryCount;
|
||||
/**最大重试次数*/
|
||||
private Integer maxRetryCount;
|
||||
/**处理状态:0-待处理,1-处理中,2-已解决,3-无需处理,4-重试失败*/
|
||||
private Integer handleStatus;
|
||||
/**处理结果/备注*/
|
||||
private String handleResult;
|
||||
/**处理人*/
|
||||
private String handler;
|
||||
/**处理时间*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date handleTime;
|
||||
/**请求URL*/
|
||||
private String requestUrl;
|
||||
/**请求方法*/
|
||||
private String requestMethod;
|
||||
/**请求参数*/
|
||||
private String requestParams;
|
||||
/**客户端IP*/
|
||||
private String ipAddress;
|
||||
/**用户代理*/
|
||||
private String userAgent;
|
||||
/**环境:dev/test/prod*/
|
||||
private String env;
|
||||
/**应用版本*/
|
||||
private String version;
|
||||
/**机构名称*/
|
||||
private String orgName;
|
||||
/**机构编码*/
|
||||
private String orgCode;
|
||||
/**创建人(操作人)*/
|
||||
private String createBy;
|
||||
/**创建时间(错误发生时间)*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
/**更新人*/
|
||||
private String updateBy;
|
||||
/**更新时间*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
/**删除标识(0-正常,1-已删除)*/
|
||||
private Integer delFlag;
|
||||
}
|
||||
Loading…
Reference in New Issue