Commit 83754147 by guojuxing

小程序装修页面调整

parent c1f39714
......@@ -59,10 +59,7 @@ public class AppletCustomPageApiServiceImpl implements AppletCustomPageApiServic
@Override
public ServiceResponse<Integer> saveOrUpdate(String param, Integer pageId, Integer enterpriseId, Integer saveType,
Integer appType, String appId) {
ServiceResponse valiParams = this.validParams(enterpriseId, saveType, appType, appId, param);
if(!valiParams.isSuccess()){
return valiParams;
}
validParams(enterpriseId, saveType, appType, appId, param);
JSONObject jsonObject = JSONObject.parseObject(param);
String title = jsonObject.getString("title");
......@@ -87,9 +84,9 @@ public class AppletCustomPageApiServiceImpl implements AppletCustomPageApiServic
} else {
if (enterpriseId == -1) {
//默认数据配置
TabAppletCustomPage defaultPage = getDefaultPage(pageType);
if (defaultPage != null) {
pageId = defaultPage.getPageId();
getById = getDefaultPage(pageType);
if (getById != null) {
pageId = getById.getPageId();
isAddOperation = false;
}
}
......@@ -124,20 +121,11 @@ public class AppletCustomPageApiServiceImpl implements AppletCustomPageApiServic
record.setSerialNumber(0);
}
}
record.setEnterpriseId(enterpriseId);
record.setStatus(saveType);
record.setAppType(appType);
record.setAppId(appId);
record.setTitle(title);
record.setEnterpriseId(enterpriseId);record.setStatus(saveType);record.setAppType(appType);record.setAppId(appId);record.setTitle(title);
// 0代表不限,1代表开卡会员,2代表认证会员
record.setEntryCondition(entryCondition);
record.setSetting(jsonObject.getString("setting"));
record.setPageType(pageType);
record.setBackgroundColor(backgroundColor);
record.setAppletTitle(appletTitle);
record.setBackgroundType(backgroundType);
record.setBackgroundImage(backgroundImage);
record.setQuickGuideSwitch(quickGuideSwitch);
record.setEntryCondition(entryCondition);record.setSetting(jsonObject.getString("setting"));
record.setPageType(pageType);record.setBackgroundColor(backgroundColor);record.setAppletTitle(appletTitle);record.setBackgroundType(backgroundType);
record.setBackgroundImage(backgroundImage);record.setQuickGuideSwitch(quickGuideSwitch);
//页面数量(包括启用和未启用)
int count = appletCustomPageService.count(enterpriseId, appType, appId, pageType);
......@@ -227,54 +215,53 @@ public class AppletCustomPageApiServiceImpl implements AppletCustomPageApiServic
}
}
private ServiceResponse validParams(Integer enterpriseId, Integer saveType, Integer appType, String appId, String param){
private void validParams(Integer enterpriseId, Integer saveType, Integer appType, String appId, String param){
//参数校验
if (enterpriseId == null) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "商户ID不能为空");
throw new CommonException(ErrorCode.PARAMETER_ERROR.getCode(), "商户ID不能为空");
}
//1:保存并发布 2:保存
boolean isRightStatus = saveType == null || (saveType.intValue() != 1 && saveType.intValue() != 2);
if (isRightStatus) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "页面状态值错误");
throw new CommonException(ErrorCode.PARAMETER_ERROR.getCode(), "页面状态值错误");
}
//1:小程序 2:服务号
boolean isRightAppType = appType == null || (appType.intValue() != 1 && appType.intValue() != 2);
if (isRightAppType) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "app类型值错误");
throw new CommonException(ErrorCode.PARAMETER_ERROR.getCode(), "app类型值错误");
}
if (StringUtils.isBlank(appId)) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "appKey/appId不能为空");
throw new CommonException(ErrorCode.PARAMETER_ERROR.getCode(), "appKey/appId不能为空");
}
JSONObject jsonObject = JSONObject.parseObject(param);
if (!jsonObject.containsKey(TITLE)) {
LOGGER.warn("title不存在");
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "页面名称错误");
throw new CommonException(ErrorCode.PARAMETER_ERROR.getCode(), "页面名称错误");
}
String title = jsonObject.getString("title");
if (StringUtils.isBlank(title)) {
LOGGER.warn("title不存在");
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "页面名称错误");
throw new CommonException(ErrorCode.PARAMETER_ERROR.getCode(), "页面名称错误");
}
if (!jsonObject.containsKey(ENTRYCONDITION)) {
LOGGER.warn("entryCondition不存在");
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "页面进入条件错误");
throw new CommonException(ErrorCode.PARAMETER_ERROR.getCode(), "页面进入条件错误");
}
//0代表不限,1代表开卡会员,2代表认证会员
Integer entryCondition = jsonObject.getInteger("entryCondition");
if (!EntryConditionEnum.isRightCode(entryCondition)) {
LOGGER.warn("entryCondition值错误");
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "页面进入条件错误");
throw new CommonException(ErrorCode.PARAMETER_ERROR.getCode(), "页面进入条件错误");
}
if (!jsonObject.containsKey(PAGETYPE)) {
LOGGER.warn("pageType不存在");
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "页面类型错误");
throw new CommonException(ErrorCode.PARAMETER_ERROR.getCode(), "页面类型错误");
}
Integer pageType = jsonObject.getInteger("pageType");
if (!AppletPageTypeEnum.isRightCode(pageType)) {
LOGGER.warn("pageType值错误");
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "页面类型错误");
throw new CommonException(ErrorCode.PARAMETER_ERROR.getCode(), "页面类型错误");
}
return ServiceResponse.success();
}
private ServiceResponse<Integer> componentParse(JSONObject jsonObject, Integer enterpriseId, Integer pageId, List<TabAppletPageComponent> componentList, Map<String, Object> componentMap){
......
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