Merge branch 'feature/REQ-1465' of axzsource.com:universal/infrastructure/backend/msg-center-plat into dev
This commit is contained in:
commit
adbdf2f7dc
@ -69,6 +69,10 @@ public class PendingMessagePushParam implements Serializable {
|
||||
* 业务描述eg:流程结点描述
|
||||
*/
|
||||
private String bizDesc;
|
||||
/**
|
||||
* 业务扩展参数,JSON字符串格式
|
||||
*/
|
||||
private String bizExtParams;
|
||||
/**
|
||||
* 路由参数(json string)
|
||||
*/
|
||||
|
||||
@ -26,11 +26,13 @@ import cn.axzo.msg.center.service.enums.PendingMessageStateEnum;
|
||||
import cn.axzo.msg.center.service.enums.TerminalTypeEnum;
|
||||
import cn.axzo.msg.center.service.pending.request.PendingMessagePageRequest;
|
||||
import cn.axzo.msg.center.service.pending.response.PendingMessageResponse;
|
||||
import cn.axzo.msg.center.utils.JSONObjectUtil;
|
||||
import cn.axzo.msg.center.utils.MessageRouterUtil;
|
||||
import cn.axzo.msg.center.utils.OrderFieldParseUtil;
|
||||
import cn.axzo.msg.center.utils.UUIDUtil;
|
||||
import cn.azxo.framework.common.model.Page;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
||||
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
||||
@ -282,10 +284,7 @@ public class PendingMessageNewServiceImpl implements PendingMessageNewService {
|
||||
record.setOrgId(param.getOrgId());
|
||||
record.setOrgName(param.getOrgName());
|
||||
// 构建业务类信息
|
||||
record.setBizCode(param.getBizCode());
|
||||
record.setSubBizCode(param.getSubBizCode());
|
||||
record.setBizDesc(param.getBizDesc());
|
||||
record.setBizCategory(param.getBizCategory());
|
||||
buildBusinessInfo(record, param);
|
||||
return record;
|
||||
}
|
||||
|
||||
@ -299,17 +298,22 @@ public class PendingMessageNewServiceImpl implements PendingMessageNewService {
|
||||
}
|
||||
|
||||
private void buildTemplateInfo(PendingMessageRecord record, MessageTemplateDTO msgTemplate, String routeParam) {
|
||||
String title = msgTemplate.getTitle();
|
||||
String content = msgTemplate.getContent();
|
||||
if (StringUtils.isNotBlank(routeParam)) {
|
||||
title = PlaceholderResolver
|
||||
.getDefaultResolver().resolveByMap(title, JSON.parseObject(routeParam));
|
||||
content = PlaceholderResolver
|
||||
.getDefaultResolver().resolveByMap(content, JSON.parseObject(routeParam));
|
||||
}
|
||||
JSONObject routerParamObj = JSONObjectUtil.parseObject(routeParam);
|
||||
String title = PlaceholderResolver
|
||||
.getDefaultResolver().resolveByMap(msgTemplate.getTitle(), routerParamObj);
|
||||
String content = PlaceholderResolver
|
||||
.getDefaultResolver().resolveByMap(msgTemplate.getContent(), routerParamObj);
|
||||
record.setTitle(title);
|
||||
record.setContent(content);
|
||||
record.setTemplateCode(msgTemplate.getCode());
|
||||
record.setRouterParams(routeParam);
|
||||
record.setRouterParams(routerParamObj.toJSONString());
|
||||
}
|
||||
|
||||
private void buildBusinessInfo(PendingMessageRecord record, PendingMessagePushParam param) {
|
||||
record.setBizCode(param.getBizCode());
|
||||
record.setSubBizCode(param.getSubBizCode());
|
||||
record.setBizDesc(param.getBizDesc());
|
||||
record.setBizCategory(param.getBizCategory());
|
||||
record.setBizExtParam(JSONObjectUtil.checkAndReturn(param.getBizExtParams()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,40 @@
|
||||
package cn.axzo.msg.center.utils;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
/**
|
||||
* @author cold_blade
|
||||
* @date 2023/10/13
|
||||
* @version 1.0
|
||||
*/
|
||||
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||
public final class JSONObjectUtil {
|
||||
private static final JSONObject EMPTY_JSON_OBJ = new JSONObject();
|
||||
|
||||
/**
|
||||
* 解析JSON字符串,若字符串格式不正确,抛异常
|
||||
*
|
||||
* @param str 待解析的字符串
|
||||
* @return JSONObject
|
||||
*/
|
||||
public static JSONObject parseObject(String str) {
|
||||
if (StringUtils.isBlank(str)) {
|
||||
return EMPTY_JSON_OBJ;
|
||||
}
|
||||
return JSON.parseObject(str);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验字符串是否为有效的JSON字符串,若字符串格式不正确,抛异常
|
||||
*
|
||||
* @param str 待校验的字符串
|
||||
* @return 原字符串OR空的JSONObject
|
||||
*/
|
||||
public static String checkAndReturn(String str) {
|
||||
return parseObject(str).toJSONString();
|
||||
}
|
||||
}
|
||||
@ -68,6 +68,10 @@ public class PendingMessagePushRequest implements Serializable {
|
||||
* 业务描述eg:流程结点描述
|
||||
*/
|
||||
private String bizDesc;
|
||||
/**
|
||||
* 业务扩展参数,JSON字符串格式
|
||||
*/
|
||||
private String bizExtParams;
|
||||
/**
|
||||
* 路由参数(json string)
|
||||
*/
|
||||
|
||||
Loading…
Reference in New Issue
Block a user