REQ-3045: IM按钮
This commit is contained in:
parent
d1b6e3d4ac
commit
c9b44c0570
@ -1,13 +1,13 @@
|
||||
package cn.axzo.msg.center.inside.notices.service.impl.v3.msg;
|
||||
|
||||
import cn.axzo.maokai.api.util.Ref;
|
||||
import cn.axzo.msg.center.domain.entity.MessageRecordV3;
|
||||
import cn.axzo.msg.center.message.domain.dto.TemplateModelV3;
|
||||
import cn.axzo.msg.center.message.domain.vo.CardButtonV3;
|
||||
import cn.axzo.msg.center.message.domain.vo.GeneralMessagePushVO;
|
||||
import cn.axzo.msg.center.message.domain.vo.GeneralMessagePushVO.CardButton;
|
||||
import cn.axzo.msg.center.message.domain.vo.GeneralMessagePushVO.CardExtensionItem;
|
||||
import cn.axzo.msg.center.message.domain.vo.GeneralMessagePushVO.Subtitle;
|
||||
import cn.axzo.msg.center.message.domain.vo.ParsedCardUrlForCms;
|
||||
import cn.axzo.msg.center.message.domain.vo.ParsedUrlForCms;
|
||||
import cn.axzo.msg.center.message.service.impl.v3.AppLink;
|
||||
import cn.axzo.msg.center.message.service.impl.v3.ModelV3ExtPopulator;
|
||||
import cn.axzo.msg.center.message.service.impl.v3.ModelV3Parser;
|
||||
@ -79,7 +79,7 @@ public class MessageTemplateParserV3 {
|
||||
cardDetailButton.setActionPaths(getNativeAppLinks(urlConfig));
|
||||
im.setCardDetailButton(cardDetailButton);
|
||||
|
||||
parseCardUrlForCms(im, urlConfig);
|
||||
im.setCardUrlForCms(parseUrlForCms(urlConfig));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -102,6 +102,11 @@ public class MessageTemplateParserV3 {
|
||||
|
||||
@Override
|
||||
public void visitButton(ParsedButtonV3 button) {
|
||||
parseButtonV2(button);
|
||||
parseButtonV3(button);
|
||||
}
|
||||
|
||||
private void parseButtonV2(ParsedButtonV3 button) {
|
||||
List<ButtonStyleEnum> styles = button.parseStyle();
|
||||
if (!styles.contains(ButtonStyleEnum.OVER_CARD))
|
||||
return;
|
||||
@ -123,30 +128,40 @@ public class MessageTemplateParserV3 {
|
||||
}
|
||||
}
|
||||
|
||||
private void parseButtonV3(ParsedButtonV3 button) {
|
||||
CardButtonV3 imButton = new CardButtonV3();
|
||||
imButton.setTitle(button.getName());
|
||||
imButton.setAction(button.getCategory().name());
|
||||
imButton.setIsHighlight(button.parseStyle().contains(ButtonStyleEnum.HIGH_LIGHT));
|
||||
imButton.setIsOverCard(button.parseStyle().contains(ButtonStyleEnum.OVER_CARD));
|
||||
imButton.setUrlInfo(parseUrlForCms(button.getUrlConfig()));
|
||||
if (im.getCardButtonsV3() == null)
|
||||
im.setCardButtonsV3(new ArrayList<>());
|
||||
im.getCardButtonsV3().add(imButton);
|
||||
}
|
||||
|
||||
});
|
||||
return im;
|
||||
}
|
||||
|
||||
private static void parseCardUrlForCms(GeneralMessagePushVO im, UrlConfig urlConfig) {
|
||||
Ref<Boolean> hasManagerAppUrl = Ref.create(false);
|
||||
private static ParsedUrlForCms parseUrlForCms(UrlConfig urlConfig) {
|
||||
ParsedUrlForCms urlForCms = new ParsedUrlForCms();
|
||||
urlForCms.setUrl(urlForCms.getUrl());
|
||||
UrlConfigWalker.walkDown(urlConfig, new UrlConfigVisitor() {
|
||||
|
||||
@Override
|
||||
public void visitPcCms(WebUrl pcCms) {
|
||||
ParsedCardUrlForCms cardUrlForCms = new ParsedCardUrlForCms();
|
||||
im.setCardUrlForCms(cardUrlForCms);
|
||||
cardUrlForCms.setUrl(pcCms.getUrl());
|
||||
cardUrlForCms.setOpenStrategy(pcCms.getOpenStrategy());
|
||||
urlForCms.setUrl(pcCms.getUrl());
|
||||
urlForCms.setOpenStrategy(pcCms.getOpenStrategy());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitAppManager(MobileUrlConfig appManager) {
|
||||
hasManagerAppUrl.set(appManager.hasUrl());
|
||||
urlForCms.setHasManagerAppUrl(appManager.hasUrl());
|
||||
}
|
||||
|
||||
});
|
||||
if (hasManagerAppUrl.get() && im.getCardUrlForCms() != null)
|
||||
im.getCardUrlForCms().setHasManagerAppUrl(true);
|
||||
return urlForCms;
|
||||
}
|
||||
|
||||
private List<AppLink> getNativeAppLinks(UrlConfig urlConfig) {
|
||||
|
||||
@ -0,0 +1,32 @@
|
||||
package cn.axzo.msg.center.message.domain.vo;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* @author yanglin
|
||||
*/
|
||||
@Setter
|
||||
@Getter
|
||||
public class CardButtonV3 {
|
||||
/**
|
||||
* url
|
||||
*/
|
||||
private ParsedUrlForCms urlInfo;
|
||||
/**
|
||||
* 按钮标题
|
||||
*/
|
||||
private String title;
|
||||
/**
|
||||
* 按钮操作类型: JUMP - 页面跳转, ACTION - 接口调用
|
||||
*/
|
||||
private String action;
|
||||
/**
|
||||
* 按钮样式 - 是否高亮
|
||||
*/
|
||||
private Boolean isHighlight;
|
||||
/**
|
||||
* 按钮样式 - 是否按钮显示在卡片
|
||||
*/
|
||||
private Boolean isOverCard;
|
||||
}
|
||||
@ -75,6 +75,10 @@ public class GeneralMessagePushVO implements Serializable {
|
||||
* 按钮操作区域
|
||||
*/
|
||||
private List<CardButton> cardButtons;
|
||||
/**
|
||||
* 按钮操作区域 (cms)
|
||||
*/
|
||||
private List<CardButtonV3> cardButtonsV3;
|
||||
/**
|
||||
* 业务编码
|
||||
*/
|
||||
@ -87,7 +91,7 @@ public class GeneralMessagePushVO implements Serializable {
|
||||
/**
|
||||
* 专门给cms的路由信息
|
||||
*/
|
||||
private ParsedCardUrlForCms cardUrlForCms;
|
||||
private ParsedUrlForCms cardUrlForCms;
|
||||
|
||||
public static GeneralMessagePushVO from(GeneralMessageRecord record, String templateIcon, String orgIcon,
|
||||
MessageTemplateRouterDTO msgTemplateRouter,
|
||||
|
||||
@ -9,7 +9,7 @@ import lombok.Setter;
|
||||
*/
|
||||
@Setter
|
||||
@Getter
|
||||
public class ParsedCardUrlForCms {
|
||||
public class ParsedUrlForCms {
|
||||
|
||||
private String url;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user