Commit 39ae66e1 by 陶光胜

Merge branch 'developer' of…

Merge branch 'developer' of http://115.159.76.241/base_platform_enterprise/gic-platform-enterprise into developer
parents 9a26611c 8f31b0c1
......@@ -7,30 +7,39 @@ package com.gic.enterprise.constant.applet;
* @date 2019/11/25 2:43 PM

*/
public enum AppletPageComponentEnum {
RICH_TEXT("A1", "富文本"),
IMAGE("A2", "图文广告"),
MAGIC("A3", "魔方"),
IMAGE_TEXT("A4", "图文导航"),
TEXT("A5", "文本"),
CROSS_BAR("A6", "横栏"),
GUIDE_LINE("A7", "辅助线"),
GUIDE_BLANK("A8", "辅助空白"),
TEXT_TITLE("A9", "文本标题"),
DATA_ASSET("A10", "数据资产"),
MEMBER_PRIVILEGE("B1", "会员特权"),
MEMBER_CARD("B2", "会员卡"),
INTEGRAL_SIGN("B3", "积分签到"),
GOODS_SHELF("B4", "商品货架"),
MALL_SEARCH("B5", "搜索"),
MALL_GOODS("B6", "商品"),
MALL_CLASSIFY("B8", "分类");
RICH_TEXT("A1", "富文本", 0),
IMAGE("A2", "图文广告", 0),
MAGIC("A3", "魔方", 0),
IMAGE_TEXT("A4", "图文导航", 0),
TEXT("A5", "文本", 0),
CROSS_BAR("A6", "横栏", 0),
GUIDE_LINE("A7", "辅助线", 0),
GUIDE_BLANK("A8", "辅助空白", 0),
TEXT_TITLE("A9", "文本标题", 0),
DATA_ASSET("A10", "数据资产", 0),
MEMBER_PRIVILEGE("B1", "会员特权", 0),
MEMBER_CARD("B2", "会员卡", 2),
INTEGRAL_SIGN("B3", "积分签到", 0),
GOODS_SHELF("B4", "商品货架", 0),
MALL_SEARCH("B5", "搜索", 0),
MALL_GOODS("B6", "商品", 0),
COUPON("B7", "卡券", 0),
MALL_CLASSIFY("B8", "分类", 0),
INTEGRAL_SERVICE("C1", "积分服务", 4),
MEMBER_ACHIEVEMENT("C2", "会员成就", 5),
MEMBER_TASK("C3", "会员任务", 6);
private String code;
private String message;
/**
* 有些组件是页面专有组件,必有
*/
private int pageType;
private AppletPageComponentEnum(String code, String message) {
private AppletPageComponentEnum(String code, String message, int pageType) {
this.code = code;
this.message = message;
this.pageType = pageType;
}
public String getCode() {
......@@ -49,6 +58,14 @@ public enum AppletPageComponentEnum {
this.message = message;
}
public int getPageType() {
return pageType;
}
public void setPageType(int pageType) {
this.pageType = pageType;
}
public static boolean isSaveToComponentTable(String code) {
for (AppletPageComponentEnum componentEnum : values()) {
if (componentEnum.getCode().equals(code)) {
......@@ -57,4 +74,16 @@ public enum AppletPageComponentEnum {
}
return false;
}
public static AppletPageComponentEnum mustComponent(Integer pageType) {
if (pageType == null) {
return null;
}
for (AppletPageComponentEnum componentEnum : values()) {
if (componentEnum.getPageType() != 0 && pageType.intValue() == componentEnum.getPageType()) {
return componentEnum;
}
}
return null;
}
}
......@@ -181,14 +181,15 @@ public class AppletCustomPageApiServiceImpl implements AppletCustomPageApiServic
}
}
//如果是会员中心,必须有会员卡组件
if (AppletPageTypeEnum.MEMBER_CENTER.getCode() == pageType.intValue()) {
if (!componentMap.containsKey(AppletPageComponentEnum.MEMBER_CARD.getCode())) {
//如果是会员中心等页面,必须有对应的组件
AppletPageComponentEnum mustComponent = AppletPageComponentEnum.mustComponent(pageType);
if (mustComponent != null) {
//说明该页面有必须的组件,需要验证组件是否存在
if (!componentMap.containsKey(mustComponent.getCode())) {
//回滚
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(),
AppletPageTypeEnum.MEMBER_CENTER.getMessage() + "必须有"
+ AppletPageComponentEnum.MEMBER_CARD.getMessage() + "组件");
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "必须有"
+ mustComponent.getMessage() + "组件");
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment