微信的站内信通知
This commit is contained in:
parent
b67085eeb8
commit
b774d9f93f
|
|
@ -5,9 +5,13 @@ 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.entity.NuWxNoticeEntity;
|
||||
import com.nu.entity.WxNoticeEntity;
|
||||
import com.nu.enums.WxClientType;
|
||||
import com.nu.modules.errorrecordlog.IErrorRecordLogApi;
|
||||
import com.nu.modules.orgapplyinfo.entity.OrgApplyInfo;
|
||||
import com.nu.modules.orgapplyinfo.service.IOrgApplyInfoService;
|
||||
import com.nu.modules.wxnotice.IWxNoticeApi;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.jeecg.common.constant.enums.DySmsEnum;
|
||||
|
|
@ -35,6 +39,8 @@ public class WorkOrderMQListener {
|
|||
private ISysBaseAPI sysBaseAPI;
|
||||
@Autowired
|
||||
private IErrorRecordLogApi errorRecordLogApi;
|
||||
@Autowired
|
||||
private IWxNoticeApi wxNoticeApi;
|
||||
|
||||
/**
|
||||
* 工单回执
|
||||
|
|
@ -138,6 +144,8 @@ public class WorkOrderMQListener {
|
|||
sysDepartEntity.setMediaUrl(workOrderMQDto.getMediaUrl());//媒体资源路径
|
||||
sysBaseAPI.updateById(sysDepartEntity);
|
||||
|
||||
|
||||
try {
|
||||
//新增账号
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("userName", workOrderMQDto.getAccountNo());
|
||||
|
|
@ -149,62 +157,86 @@ public class WorkOrderMQListener {
|
|||
map.put("tel", workOrderMQDto.getOrgTel());
|
||||
map.put("orgInfo", workOrderMQDto.getOrgInfo());
|
||||
sysBaseAPI.initialization(map);
|
||||
}catch (Exception e){
|
||||
log.error("初始化账号失败:{}", e.getMessage());
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("code", "SMS_503750025");
|
||||
// jsonObject.put("name", workOrderMQDto.getFrontPath());
|
||||
// jsonObject.put("username", workOrderMQDto.getAccountNo());
|
||||
// jsonObject.put("password", workOrderMQDto.getPasswordText());
|
||||
Map<String, Object> smsResult = DySmsHelper.sendSmsReturnMsg(workOrderMQDto.getOrgTel(), 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) {
|
||||
//运维级别错误,需要人工处理
|
||||
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();
|
||||
SysDepartEntity sysDepartInfo = sysBaseAPI.selectDepartById(workOrderMQDto.getOrgId());
|
||||
//发送小程序、微信通知
|
||||
NuWxNoticeEntity nuWxNotice = new NuWxNoticeEntity();
|
||||
nuWxNotice.setOpenId(sysDepartInfo.getOpenId());
|
||||
nuWxNotice.setIzRead("N");
|
||||
nuWxNotice.setOrgCode(null);
|
||||
nuWxNotice.setTitle("平台搭建完成");
|
||||
nuWxNotice.setContent("访问网址:"+workOrderMQDto.getUrl()+"。账号:"+workOrderMQDto.getAccountNo()+"。密码:"+workOrderMQDto.getPasswordText()+"。请机构负责人登录业务平台,进入【区域管理 - 区域信息-区域规划】完成区域创建与区域规划。");
|
||||
nuWxNotice.setType("org_apply_audit_list");
|
||||
nuWxNotice.setClientType(WxClientType.INSTITUTION.getCode());
|
||||
wxNoticeApi.addNotice(nuWxNotice);
|
||||
|
||||
WxNoticeEntity wxNotice = new WxNoticeEntity();
|
||||
wxNotice.setPageRoute("pages/index/index");
|
||||
wxNotice.setThing2("机构加盟审核");
|
||||
wxNotice.setPhrase1("平台搭建完成");
|
||||
wxNotice.setLogMainInfo("平台搭建完成");
|
||||
wxNoticeApi.sendWechartMessage_SHENHE(wxNotice, nuWxNotice);
|
||||
}catch (Exception e){
|
||||
log.error("发送小程序、微信通知失败:{}", e.getMessage());
|
||||
}
|
||||
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// try {
|
||||
// JSONObject jsonObject = new JSONObject();
|
||||
// jsonObject.put("code", "SMS_503750025");
|
||||
// Map<String, Object> smsResult = DySmsHelper.sendSmsReturnMsg(workOrderMQDto.getOrgTel(), 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) {
|
||||
// //运维级别错误,需要人工处理
|
||||
// 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();
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue