预警配置,预警接口,定时插件推送消息,消息模版配置,推送消息日志
This commit is contained in:
parent
07d8962046
commit
37b66cee8b
|
@ -28,7 +28,7 @@ import java.util.stream.Stream;
|
||||||
* @Author xiangerlin
|
* @Author xiangerlin
|
||||||
* @Date 2024/8/28 14:25
|
* @Date 2024/8/28 14:25
|
||||||
**/
|
**/
|
||||||
@Service
|
@Service(value = "dingTalkExtService")
|
||||||
public class DingTalkExtServiceImpl implements IDingTalkExtService {
|
public class DingTalkExtServiceImpl implements IDingTalkExtService {
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -6,9 +6,9 @@ public class SysPushMessageEntity extends BaseEntity {
|
||||||
/** 推送方式 “一次”、“定时” */
|
/** 推送方式 “一次”、“定时” */
|
||||||
private String pushMethod;
|
private String pushMethod;
|
||||||
/** 预警应用编码 */
|
/** 预警应用编码 */
|
||||||
private String warningAppCode;
|
private Long warningAppCode;
|
||||||
/** 预警接口编码 */
|
/** 预警接口编码 */
|
||||||
private String warningApiCode;
|
private Long warningApiCode;
|
||||||
/** 接收者ID列表*/
|
/** 接收者ID列表*/
|
||||||
private String recipientIdList;
|
private String recipientIdList;
|
||||||
/** 预警应用类型 */
|
/** 预警应用类型 */
|
||||||
|
@ -22,7 +22,7 @@ public class SysPushMessageEntity extends BaseEntity {
|
||||||
/** 返回信息 */
|
/** 返回信息 */
|
||||||
private String returnData;
|
private String returnData;
|
||||||
/** 接收接口编码 */
|
/** 接收接口编码 */
|
||||||
private String receiveApiCode;
|
private Long receiveApiCode;
|
||||||
/** 状态(1、待发送2、发送中3、发送成功4、发送失败) */
|
/** 状态(1、待发送2、发送中3、发送成功4、发送失败) */
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
|
@ -34,22 +34,31 @@ public class SysPushMessageEntity extends BaseEntity {
|
||||||
this.pushMethod = pushMethod;
|
this.pushMethod = pushMethod;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getWarningAppCode() {
|
|
||||||
|
public Long getWarningAppCode() {
|
||||||
return warningAppCode;
|
return warningAppCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setWarningAppCode(String warningAppCode) {
|
public void setWarningAppCode(Long warningAppCode) {
|
||||||
this.warningAppCode = warningAppCode;
|
this.warningAppCode = warningAppCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getWarningApiCode() {
|
public Long getWarningApiCode() {
|
||||||
return warningApiCode;
|
return warningApiCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setWarningApiCode(String warningApiCode) {
|
public void setWarningApiCode(Long warningApiCode) {
|
||||||
this.warningApiCode = warningApiCode;
|
this.warningApiCode = warningApiCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Long getReceiveApiCode() {
|
||||||
|
return receiveApiCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReceiveApiCode(Long receiveApiCode) {
|
||||||
|
this.receiveApiCode = receiveApiCode;
|
||||||
|
}
|
||||||
|
|
||||||
public String getRecipientIdList() {
|
public String getRecipientIdList() {
|
||||||
return recipientIdList;
|
return recipientIdList;
|
||||||
}
|
}
|
||||||
|
@ -98,14 +107,6 @@ public class SysPushMessageEntity extends BaseEntity {
|
||||||
this.returnData = returnData;
|
this.returnData = returnData;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getReceiveApiCode() {
|
|
||||||
return receiveApiCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setReceiveApiCode(String receiveApiCode) {
|
|
||||||
this.receiveApiCode = receiveApiCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getStatus() {
|
public String getStatus() {
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,14 +4,14 @@
|
||||||
|
|
||||||
<resultMap id="get-SysPushMessageEntity-result" type="com.hzya.frame.sysnew.pushMessage.entity.SysPushMessageEntity" >
|
<resultMap id="get-SysPushMessageEntity-result" type="com.hzya.frame.sysnew.pushMessage.entity.SysPushMessageEntity" >
|
||||||
<result property="pushMethod" column="push_method" jdbcType="VARCHAR"/>
|
<result property="pushMethod" column="push_method" jdbcType="VARCHAR"/>
|
||||||
<result property="warningAppCode" column="warning_app_code" jdbcType="VARCHAR"/>
|
<result property="warningAppCode" column="warning_app_code" jdbcType="INTEGER"/>
|
||||||
<result property="warningApiCode" column="warning_api_code" jdbcType="VARCHAR"/>
|
<result property="warningApiCode" column="warning_api_code" jdbcType="INTEGER"/>
|
||||||
<result property="warningAppType" column="warning_app_type" jdbcType="VARCHAR"/>
|
<result property="warningAppType" column="warning_app_type" jdbcType="VARCHAR"/>
|
||||||
<result property="recipientIdList" column="recipient_id_list" jdbcType="VARCHAR"/>
|
<result property="recipientIdList" column="recipient_id_list" jdbcType="VARCHAR"/>
|
||||||
<result property="sendAppName" column="send_app_name" jdbcType="VARCHAR"/>
|
<result property="sendAppName" column="send_app_name" jdbcType="VARCHAR"/>
|
||||||
<result property="receiveAppName" column="receive_app_name" jdbcType="VARCHAR"/>
|
<result property="receiveAppName" column="receive_app_name" jdbcType="VARCHAR"/>
|
||||||
<result property="receiveApiName" column="receive_api_name" jdbcType="VARCHAR"/>
|
<result property="receiveApiName" column="receive_api_name" jdbcType="VARCHAR"/>
|
||||||
<result property="receiveApiCode" column="receive_api_code" jdbcType="VARCHAR"/>
|
<result property="receiveApiCode" column="receive_api_code" jdbcType="INTEGER"/>
|
||||||
<result property="returnData" column="return_data" jdbcType="LONGVARCHAR"/>
|
<result property="returnData" column="return_data" jdbcType="LONGVARCHAR"/>
|
||||||
<result property="status" column="status" jdbcType="VARCHAR"/>
|
<result property="status" column="status" jdbcType="VARCHAR"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
|
@ -2,9 +2,12 @@ package com.hzya.frame.sysnew.sendMessageLog.service.impl;
|
||||||
|
|
||||||
import cn.dev33.satoken.stp.StpUtil;
|
import cn.dev33.satoken.stp.StpUtil;
|
||||||
import cn.hutool.http.HttpRequest;
|
import cn.hutool.http.HttpRequest;
|
||||||
|
import cn.hutool.json.JSONUtil;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
|
import com.hzya.frame.sysnew.application.api.dao.ISysApplicationApiDao;
|
||||||
|
import com.hzya.frame.sysnew.application.api.entity.SysApplicationApiEntity;
|
||||||
import com.hzya.frame.sysnew.application.apiPara.dao.ISysApplicationApiParaDao;
|
import com.hzya.frame.sysnew.application.apiPara.dao.ISysApplicationApiParaDao;
|
||||||
import com.hzya.frame.sysnew.application.apiPara.entity.SysApplicationApiParaEntity;
|
import com.hzya.frame.sysnew.application.apiPara.entity.SysApplicationApiParaEntity;
|
||||||
import com.hzya.frame.sysnew.messageTemplate.dao.ISysMessageTemplateDao;
|
import com.hzya.frame.sysnew.messageTemplate.dao.ISysMessageTemplateDao;
|
||||||
|
@ -49,6 +52,8 @@ public class SysSendMessageLogServiceImpl extends BaseService<SysSendMessageLogE
|
||||||
@Resource
|
@Resource
|
||||||
private ISysUserDao sysUserDao;
|
private ISysUserDao sysUserDao;
|
||||||
@Resource
|
@Resource
|
||||||
|
private ISysApplicationApiDao sysApplicationApiDao;
|
||||||
|
@Resource
|
||||||
private ISysApplicationApiParaDao sysApplicationApiParaDao;
|
private ISysApplicationApiParaDao sysApplicationApiParaDao;
|
||||||
|
|
||||||
private ISysSendMessageLogDao sysSendMessageLogDao;
|
private ISysSendMessageLogDao sysSendMessageLogDao;
|
||||||
|
@ -142,144 +147,6 @@ public class SysSendMessageLogServiceImpl extends BaseService<SysSendMessageLogE
|
||||||
return BaseResult.getSuccessMessageEntity("删除发送消息日志成功", entity);
|
return BaseResult.getSuccessMessageEntity("删除发送消息日志成功", entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
// public JsonResultEntity sendMsg(JSONObject jsonObject){
|
|
||||||
// //拼接一条测试消息数据
|
|
||||||
// jsonObject.put("log_id","e2f213567c2242eab7401edcb3949c45");
|
|
||||||
// jsonObject.put("send_app_name","数智中台");
|
|
||||||
// jsonObject.put("recieve_app_name","东进U8C");
|
|
||||||
// jsonObject.put("recieve_api_name","存货基本档案修改");
|
|
||||||
// jsonObject.put("receive_api_code","8000350046");
|
|
||||||
// jsonObject.put("return_data","{\n" +
|
|
||||||
// " \"status\": \"falied\",\n" +
|
|
||||||
// " \"errorcode\": \"-32000\",\n" +
|
|
||||||
// " \"errormsg\": \"U8C返回信息:以下档案在U8cloud系统中根据公司或者账簿信息找不到,请检查!详细信息:1、档案类型:计量档案,公司编码:0001,档案编码:个;\",\n" +
|
|
||||||
// " \"taskNumber\": \"202408220001\"\n" +
|
|
||||||
// "}");
|
|
||||||
// jsonObject.put("status","4");
|
|
||||||
// jsonObject.put("url","https://oapi.dingtalk.com/topapi/message/corpconversation/asyncsend_v2");
|
|
||||||
// jsonObject.put("appType","5DD");
|
|
||||||
//
|
|
||||||
// //1、根据测试消息状态(成功、失败),以及目标API是否启用推送,决定是否要推送消息(只推送失败的,且启用推送的)
|
|
||||||
// //2、根据目标API,找到其消息模版,并根据模版生成消息内容
|
|
||||||
// //3、根据目标API,找到其预警应用api,并推送消息
|
|
||||||
// String status = jsonObject.get("status").toString();
|
|
||||||
// String receiveApiCode = jsonObject.get("receive_api_code").toString();
|
|
||||||
// String sendAppName = jsonObject.get("send_app_name").toString();
|
|
||||||
// String receiveApiName = jsonObject.get("recieve_api_name").toString();
|
|
||||||
// String recieveAppName = jsonObject.get("recieve_app_name").toString();
|
|
||||||
// String returnData = jsonObject.get("return_data").toString();
|
|
||||||
// String url = jsonObject.get("url").toString();
|
|
||||||
// String appType = jsonObject.get("appType").toString();
|
|
||||||
// String sendMsgContent = "";
|
|
||||||
//
|
|
||||||
// SysWarningInterfaceEntity interfaceEntity = new SysWarningInterfaceEntity();
|
|
||||||
// SysWarningConfigEntity configEntity = new SysWarningConfigEntity();
|
|
||||||
// SysMessageTemplateEntity templateEntity = new SysMessageTemplateEntity();
|
|
||||||
//
|
|
||||||
// interfaceEntity.setApiCode(receiveApiCode);
|
|
||||||
//
|
|
||||||
// if(status == null){
|
|
||||||
// logger.error("日志状态为空");
|
|
||||||
// return BaseResult.getFailureMessageEntity("日志状态为空");
|
|
||||||
// }
|
|
||||||
// if ("4".equals(status)) {
|
|
||||||
// interfaceEntity = sysWarningInterfaceDao.queryOne(interfaceEntity);
|
|
||||||
// if(interfaceEntity == null){
|
|
||||||
// logger.error("未找到API接口预警信息");
|
|
||||||
// return BaseResult.getFailureMessageEntity("未找到API接口预警信息");
|
|
||||||
// }
|
|
||||||
// if(interfaceEntity.getStatus() == null || interfaceEntity.getStatus().equals("1") == false){
|
|
||||||
// logger.error("API接口未启用推送");
|
|
||||||
// return BaseResult.getFailureMessageEntity("API接口未启用推送");
|
|
||||||
// }
|
|
||||||
// //根据主表id,找到主表记录中的消息模版id
|
|
||||||
// String warningConfigId = interfaceEntity.getWarningConfigId();
|
|
||||||
// if(warningConfigId == null || "".equals(warningConfigId)){
|
|
||||||
// logger.error("未找到该接口预警配置信息的主表id");
|
|
||||||
// return BaseResult.getFailureMessageEntity("未找到该接口预警配置信息的主表id");
|
|
||||||
// }
|
|
||||||
// configEntity = sysWarningConfigDao.get(warningConfigId);
|
|
||||||
// if(configEntity == null){
|
|
||||||
// logger.error("未找到该接口预警配置信息");
|
|
||||||
// return BaseResult.getFailureMessageEntity("未找到该接口预警配置信息");
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// String messageTemplateId = configEntity.getMessageTemplateId();
|
|
||||||
// if(messageTemplateId == null || "".equals(messageTemplateId)){
|
|
||||||
// logger.error("未找到该接口预警配置信息的消息模版id");
|
|
||||||
// return BaseResult.getFailureMessageEntity("未找到该接口预警配置信息的消息模版id");
|
|
||||||
// }
|
|
||||||
// templateEntity = sysMessageTemplateDao.get(messageTemplateId);
|
|
||||||
// if(templateEntity == null){
|
|
||||||
// logger.error("未找到该接口预警配置信息的消息模版信息");
|
|
||||||
// return BaseResult.getFailureMessageEntity("未找到该接口预警配置信息的消息模版信息");
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// String messageContent = templateEntity.getMessageContents();
|
|
||||||
// if(messageContent == null || "".equals(messageContent)){
|
|
||||||
// logger.error("未找到该接口预警配置信息的消息模版内容");
|
|
||||||
// return BaseResult.getFailureMessageEntity("未找到该接口预警配置信息的消息模版内容");
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// sendMsgContent = messageContent.replace("${reciecveAppName}",recieveAppName);
|
|
||||||
// sendMsgContent = sendMsgContent.replace("${sendAppName}",sendAppName);
|
|
||||||
// sendMsgContent = sendMsgContent.replace("${receiveApiName}",receiveApiName);
|
|
||||||
// sendMsgContent = sendMsgContent.replace("${returnData}",returnData);
|
|
||||||
//
|
|
||||||
// String templateName = templateEntity.getTemplateName();
|
|
||||||
//
|
|
||||||
// switch (appType){
|
|
||||||
// case "6WX":
|
|
||||||
// //调用微信推送消息
|
|
||||||
// break;
|
|
||||||
// case "5DD":
|
|
||||||
// //消息类型:3表示钉钉
|
|
||||||
// String appkey = "dingbltm9wszcl7hoxyg";
|
|
||||||
// String appsecret = "ex3a9qwdTXWf_VKJEddAg8YE7x98kIl3Nsy_7g0NdwvK3w3nXdUhJ3XQP4lUYs2d";
|
|
||||||
//
|
|
||||||
// String type = "3";
|
|
||||||
// //发送消息时使用的微应用的AgentID
|
|
||||||
// String agent_id = "3209295620";
|
|
||||||
// //接收者的userid列表,最大用户列表长度100
|
|
||||||
// String userid_list = configEntity.getRecipientId();
|
|
||||||
//
|
|
||||||
// String bodyParams = splicingDDBody(sendMsgContent,agent_id,userid_list).toString();
|
|
||||||
//
|
|
||||||
//// String access_token = getAccessToken(appkey,appsecret);
|
|
||||||
//// String Baseurl = url + "?access_token="+ access_token;
|
|
||||||
//
|
|
||||||
// String result = HttpRequest.post("http://127.0.0.1:9999/kangarooDataCenterV3/entranceController/externalCallInterface").
|
|
||||||
// header("appId","800043").
|
|
||||||
// header("apiCode","8000430001").
|
|
||||||
// header("publicKey","ZJYA7v6DubGMm8EdBPGo+Jj9wCpUeCGJEpfBRLiInq4dvDlCe7eDIk+3zDUT+v578prj").
|
|
||||||
// header("secretKey","bsAMm6tvJs/BV1SO/9ZzjlW+OQaK0mwyv6rLvktyNy/OdltLuG2zze9bT7ttfAA9j3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=").
|
|
||||||
// body(bodyParams).
|
|
||||||
// execute().
|
|
||||||
// body();
|
|
||||||
// JSONObject resultJson = JSONObject.parseObject(result);
|
|
||||||
// String errcode = resultJson.getString("errcode");
|
|
||||||
//
|
|
||||||
// if(errcode != null && errcode.equals("0")){
|
|
||||||
// logger.info("推送消息成功,开始保存日志");
|
|
||||||
// SysSendMessageLogEntity logentity = saveLog(sendMsgContent,type,resultJson.toString(),templateName);
|
|
||||||
// logger.info("保存日志成功");
|
|
||||||
// }else{
|
|
||||||
// logger.error("推送消息失败,开始保存日志");
|
|
||||||
// SysSendMessageLogEntity logentity = saveLog(sendMsgContent,type,resultJson.toString(),templateName);
|
|
||||||
// logger.error("保存日志成功");
|
|
||||||
// }
|
|
||||||
// break;
|
|
||||||
// default:
|
|
||||||
// logger.error("未找到该应用类型");
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// }else{
|
|
||||||
// logger.error("日志状态为成功,不需要推送消息");
|
|
||||||
// return BaseResult.getFailureMessageEntity("日志状态为成功,不需要推送消息");
|
|
||||||
// }
|
|
||||||
// return BaseResult.getSuccessMessageEntity("true");
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* sendMessage方法:根据请求错误消息,组装成消息模版,推送到三方业务系统
|
* sendMessage方法:根据请求错误消息,组装成消息模版,推送到三方业务系统
|
||||||
|
@ -292,14 +159,14 @@ public class SysSendMessageLogServiceImpl extends BaseService<SysSendMessageLogE
|
||||||
@Override
|
@Override
|
||||||
public boolean sendMessage(SysPushMessageEntity entity){
|
public boolean sendMessage(SysPushMessageEntity entity){
|
||||||
String status = entity.getStatus();
|
String status = entity.getStatus();
|
||||||
String receiveApiCode = entity.getReceiveApiCode();
|
Long receiveApiCode = entity.getReceiveApiCode();
|
||||||
String sendAppName = entity.getSendAppName();
|
String sendAppName = entity.getSendAppName();
|
||||||
String receiveApiName = entity.getReceiveApiName();
|
String receiveApiName = entity.getReceiveApiName();
|
||||||
String recieveAppName = entity.getReceiveAppName();
|
String recieveAppName = entity.getReceiveAppName();
|
||||||
String returnData = entity.getReturnData();
|
String returnData = entity.getReturnData();
|
||||||
String warningAppType = entity.getWarningAppType();
|
String warningAppType = entity.getWarningAppType();
|
||||||
String warningAppCode = entity.getWarningAppCode();
|
Long warningAppCode = entity.getWarningAppCode();
|
||||||
String warningApiCode = entity.getWarningApiCode();
|
Long warningApiCode = entity.getWarningApiCode();
|
||||||
String sendMsgContent = "";
|
String sendMsgContent = "";
|
||||||
|
|
||||||
SysWarningInterfaceEntity interfaceEntity = new SysWarningInterfaceEntity();
|
SysWarningInterfaceEntity interfaceEntity = new SysWarningInterfaceEntity();
|
||||||
|
@ -387,26 +254,85 @@ public class SysSendMessageLogServiceImpl extends BaseService<SysSendMessageLogE
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
String result = HttpRequest.post("http://127.0.0.1:9999/kangarooDataCenterV3/entranceController/externalCallInterface").
|
String result = HttpRequest.post("http://127.0.0.1:9999/kangarooDataCenterV3/entranceController/externalCallInterface").
|
||||||
header("appId",warningAppCode).
|
header("appId",warningAppCode.toString()).
|
||||||
header("apiCode",warningApiCode).
|
header("apiCode",warningApiCode.toString()).
|
||||||
header("publicKey","ZJYA7v6DubGMm8EdBPGo+Jj9wCpUeCGJEpfBRLiInq4dvDlCe7eDIk+3zDUT+v578prj").
|
header("publicKey","ZJYA7v6DubGMm8EdBPGo+Jj9wCpUeCGJEpfBRLiInq4dvDlCe7eDIk+3zDUT+v578prj").
|
||||||
header("secretKey","bsAMm6tvJs/BV1SO/9ZzjlW+OQaK0mwyv6rLvktyNy/OdltLuG2zze9bT7ttfAA9j3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=").
|
header("secretKey","bsAMm6tvJs/BV1SO/9ZzjlW+OQaK0mwyv6rLvktyNy/OdltLuG2zze9bT7ttfAA9j3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=").
|
||||||
body(bodyParams).
|
body(bodyParams).
|
||||||
execute().
|
execute().
|
||||||
body();
|
body();
|
||||||
JSONObject resultJson = JSONObject.parseObject(result);
|
JSONObject resultJson = JSONObject.parseObject(result);
|
||||||
String errcode = resultJson.getJSONObject("attribute").getString("errcode");
|
String body = resultJson.getString("attribute");
|
||||||
if(errcode != null && errcode.equals("0")){
|
|
||||||
|
SysApplicationApiEntity sysApplicationApiEntity = new SysApplicationApiEntity();
|
||||||
|
sysApplicationApiEntity.setApiCode(warningApiCode);
|
||||||
|
SysApplicationApiEntity warningApiEntity = sysApplicationApiDao.queryOne(sysApplicationApiEntity);
|
||||||
|
|
||||||
|
//根据预警接口编码,以及返回数据,判断消息推送是否成功
|
||||||
|
if(warningApiEntity.getReturnSuccessField() != null && !"".equals(warningApiEntity.getReturnSuccessField())
|
||||||
|
&& warningApiEntity.getReturnSuccessValue() != null && !"".equals(warningApiEntity.getReturnSuccessValue())){
|
||||||
|
//先判断返回值是否为JSON格式
|
||||||
|
if (JSONUtil.isTypeJSON(body)){
|
||||||
|
JSONObject cheackdatas = JSONObject.parseObject(body);
|
||||||
|
JSONObject datas = JSONObject.parseObject(body);
|
||||||
|
String checkdata = cheackdatas.getString(warningApiEntity.getReturnSuccessField());
|
||||||
|
//判断返回值是否为预警接口预期的返回值(1、返回值匹配2、返回值配置的就是not null3、返回值带.)
|
||||||
|
if (checkdata != null && warningApiEntity.getReturnSuccessValue().equals(checkdata)) {
|
||||||
logger.info("推送消息成功,开始保存日志");
|
logger.info("推送消息成功,开始保存日志");
|
||||||
saveLog(sendMsgContent,type,resultJson.toString(),templateName,recipientIdList,warningAppReceiverIdList);
|
saveLog(sendMsgContent,type,resultJson.toString(),templateName,recipientIdList,warningAppReceiverIdList);
|
||||||
|
|
||||||
logger.info("保存日志成功");
|
logger.info("保存日志成功");
|
||||||
}else{
|
}else if(warningApiEntity.getReturnSuccessValue().equals("not null") && checkdata != null){
|
||||||
logger.error("推送消息失败,开始保存日志");
|
logger.info("推送消息成功,开始保存日志");
|
||||||
|
saveLog(sendMsgContent,type,resultJson.toString(),templateName,recipientIdList,warningAppReceiverIdList);
|
||||||
|
logger.info("保存日志成功");
|
||||||
|
}else {
|
||||||
|
String fieldname = warningApiEntity.getReturnSuccessField();
|
||||||
|
if(fieldname.contains(".")){
|
||||||
|
String[] fileds = fieldname.split("\\.");
|
||||||
|
boolean flags = false;
|
||||||
|
for (int i = 0; i < fileds.length; i++) {
|
||||||
|
if (JSONUtil.isTypeJSON(datas.getString(fileds[i]))) {
|
||||||
|
datas = datas.getJSONObject(fileds[i]);
|
||||||
|
if(fileds.length-2 == i ){
|
||||||
|
String a = datas.getString(fileds[i+1]);
|
||||||
|
if (a != null && warningApiEntity.getReturnSuccessValue().equals(a)) {
|
||||||
|
flags = true;
|
||||||
|
break;
|
||||||
|
}else if(warningApiEntity.getReturnSuccessValue().equals("not null") && a != null){
|
||||||
|
flags = true;
|
||||||
|
break;
|
||||||
|
}else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(flags){
|
||||||
|
logger.info("推送消息成功,开始保存日志");
|
||||||
|
saveLog(sendMsgContent,type,resultJson.toString(),templateName,recipientIdList,warningAppReceiverIdList);
|
||||||
|
logger.info("保存日志成功");
|
||||||
|
}else {
|
||||||
|
logger.error("推送消息失败,返回值错误");
|
||||||
saveLog(sendMsgContent,type,resultJson.toString(),templateName,recipientIdList,warningAppReceiverIdList);
|
saveLog(sendMsgContent,type,resultJson.toString(),templateName,recipientIdList,warningAppReceiverIdList);
|
||||||
logger.error("保存日志成功");
|
logger.error("保存日志成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}else {
|
||||||
|
logger.error("推送消息失败,返回值错误");
|
||||||
|
saveLog(sendMsgContent,type,resultJson.toString(),templateName,recipientIdList,warningAppReceiverIdList);
|
||||||
|
logger.error("保存日志成功");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
logger.error("接口调用失败,返回格式错误,不是JSON");
|
||||||
|
saveLog(sendMsgContent,type,resultJson.toString(),templateName,recipientIdList,warningAppReceiverIdList);
|
||||||
|
logger.error("保存日志成功");
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
logger.error("api返回信息字段未配置,开始保存日志");
|
||||||
|
saveLog(sendMsgContent,type,resultJson.toString(),templateName,recipientIdList,warningAppReceiverIdList);
|
||||||
|
logger.error("保存日志成功");
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
logger.error("日志状态为成功,不需要推送消息");
|
logger.error("日志状态为成功,不需要推送消息");
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -19,7 +19,7 @@ public class SysWarningConfigEntity extends BaseEntity {
|
||||||
/** 预警应用id */
|
/** 预警应用id */
|
||||||
private String warningAppId;
|
private String warningAppId;
|
||||||
/** 接收推送消息的api编码 */
|
/** 接收推送消息的api编码 */
|
||||||
private String acceptMessageApiCode;
|
private Long acceptMessageApiCode;
|
||||||
/** 备注 */
|
/** 备注 */
|
||||||
private String remark;
|
private String remark;
|
||||||
/** 是否启用(0:停用、1:启用) */
|
/** 是否启用(0:停用、1:启用) */
|
||||||
|
@ -60,11 +60,11 @@ public class SysWarningConfigEntity extends BaseEntity {
|
||||||
this.warningAppId = warningAppId;
|
this.warningAppId = warningAppId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAcceptMessageApiCode() {
|
public Long getAcceptMessageApiCode() {
|
||||||
return acceptMessageApiCode;
|
return acceptMessageApiCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAcceptMessageApiCode(String acceptMessageApiCode) {
|
public void setAcceptMessageApiCode(Long acceptMessageApiCode) {
|
||||||
this.acceptMessageApiCode = acceptMessageApiCode;
|
this.acceptMessageApiCode = acceptMessageApiCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
<result property="messageTemplateId" column="message_template_id" jdbcType="VARCHAR"/>
|
<result property="messageTemplateId" column="message_template_id" jdbcType="VARCHAR"/>
|
||||||
<result property="appId" column="app_id" jdbcType="VARCHAR"/>
|
<result property="appId" column="app_id" jdbcType="VARCHAR"/>
|
||||||
<result property="warningAppId" column="warning_app_id" jdbcType="VARCHAR"/>
|
<result property="warningAppId" column="warning_app_id" jdbcType="VARCHAR"/>
|
||||||
<result property="acceptMessageApiCode" column="accept_message_api_code" jdbcType="VARCHAR"/>
|
<result property="acceptMessageApiCode" column="accept_message_api_code" jdbcType="INTEGER"/>
|
||||||
<result property="remark" column="remark" jdbcType="VARCHAR"/>
|
<result property="remark" column="remark" jdbcType="VARCHAR"/>
|
||||||
<result property="status" column="status" jdbcType="VARCHAR"/>
|
<result property="status" column="status" jdbcType="VARCHAR"/>
|
||||||
<result property="recipientId" column="recipient_id" jdbcType="VARCHAR"/>
|
<result property="recipientId" column="recipient_id" jdbcType="VARCHAR"/>
|
||||||
|
|
|
@ -15,7 +15,7 @@ public class SysWarningInterfaceEntity extends BaseEntity {
|
||||||
/** api名称 */
|
/** api名称 */
|
||||||
private String apiName;
|
private String apiName;
|
||||||
/** api编码 */
|
/** api编码 */
|
||||||
private String apiCode;
|
private Long apiCode;
|
||||||
/** 推送方式(1:推送一次、2:定时) */
|
/** 推送方式(1:推送一次、2:定时) */
|
||||||
private String pushMethod;
|
private String pushMethod;
|
||||||
/** 状态(0:停用、1:启用) */
|
/** 状态(0:停用、1:启用) */
|
||||||
|
@ -40,11 +40,11 @@ public class SysWarningInterfaceEntity extends BaseEntity {
|
||||||
this.apiName = apiName;
|
this.apiName = apiName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getApiCode() {
|
public Long getApiCode() {
|
||||||
return apiCode;
|
return apiCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setApiCode(String apiCode) {
|
public void setApiCode(Long apiCode) {
|
||||||
this.apiCode = apiCode;
|
this.apiCode = apiCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
<result property="org_id" column="org_id" jdbcType="VARCHAR"/>
|
<result property="org_id" column="org_id" jdbcType="VARCHAR"/>
|
||||||
<result property="companyId" column="company_id" jdbcType="VARCHAR"/>
|
<result property="companyId" column="company_id" jdbcType="VARCHAR"/>
|
||||||
<result property="apiName" column="api_name" jdbcType="VARCHAR"/>
|
<result property="apiName" column="api_name" jdbcType="VARCHAR"/>
|
||||||
<result property="apiCode" column="api_code" jdbcType="VARCHAR"/>
|
<result property="apiCode" column="api_code" jdbcType="INTEGER"/>
|
||||||
<result property="pushMethod" column="push_method" jdbcType="VARCHAR"/>
|
<result property="pushMethod" column="push_method" jdbcType="VARCHAR"/>
|
||||||
<result property="status" column="status" jdbcType="VARCHAR"/>
|
<result property="status" column="status" jdbcType="VARCHAR"/>
|
||||||
<result property="warningConfigId" column="warning_config_id" jdbcType="VARCHAR"/>
|
<result property="warningConfigId" column="warning_config_id" jdbcType="VARCHAR"/>
|
||||||
|
|
Loading…
Reference in New Issue