Commit 7cab4dad by guojuxing

业务逻辑错误提示信息调整

parent 80c1521c
......@@ -403,7 +403,7 @@ public class AppletCustomPageApiServiceImpl implements AppletCustomPageApiServic
if (!AppletPageTypeEnum.needCrowdWidget(record.getPageType())) {
throw new CommonException(ErrorCode.PARAMETER_ERROR.getCode(), "页面种类错误,该页面没有序号");
}
validDefaultPage(record.getEnterpriseId());
validDefaultPage(record.getEnterpriseId(), null);
boolean serialNumberLimit = serialNumber > 999;
if (serialNumberLimit) {
throw new CommonException(ErrorCode.PARAMETER_ERROR.getCode(), "序号不能超过999");
......@@ -443,7 +443,7 @@ public class AppletCustomPageApiServiceImpl implements AppletCustomPageApiServic
if (record.getStatus().intValue() == 1) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "已是发布状态");
}
validDefaultPage(record.getEnterpriseId());
validDefaultPage(record.getEnterpriseId(), "默认数据不能操作状态");
if (AppletPageTypeEnum.isOnlyOneCode(record.getPageType())) {
//把其他的数据状态改为关闭
appletCustomPageService.disableFetch(record.getEnterpriseId(), record.getAppType(), record.getAppId(),
......@@ -459,7 +459,7 @@ public class AppletCustomPageApiServiceImpl implements AppletCustomPageApiServic
if (record.getStatus().intValue() != 1) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "已是关闭状态");
}
validDefaultPage(record.getEnterpriseId());
validDefaultPage(record.getEnterpriseId(), "默认数据不能关闭");
//没有必须要有开启记录的数据,不作处理
appletCustomPageService.updateStatus(pageId, 2);
return ServiceResponse.success(record.getTitle());
......@@ -468,7 +468,7 @@ public class AppletCustomPageApiServiceImpl implements AppletCustomPageApiServic
@Override
public ServiceResponse<String> delete(Integer pageId) {
TabAppletCustomPage record = exist(pageId);
validDefaultPage(record.getEnterpriseId());
validDefaultPage(record.getEnterpriseId(), "默认数据不能删除");
if (record.getStatus().intValue() == 1) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "发布状态不能删除");
}
......@@ -489,7 +489,7 @@ public class AppletCustomPageApiServiceImpl implements AppletCustomPageApiServic
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "页面id错误,数据格式非法");
}
TabAppletCustomPage record = exist(Integer.parseInt(pageId));
validDefaultPage(record.getEnterpriseId());
validDefaultPage(record.getEnterpriseId(), "默认数据不能删除");
if (record.getStatus().intValue() == 1) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "发布状态不能删除");
}
......@@ -611,9 +611,12 @@ public class AppletCustomPageApiServiceImpl implements AppletCustomPageApiServic
return record;
}
public void validDefaultPage(Integer enterpriseId) {
public void validDefaultPage(Integer enterpriseId, String errorMessage) {
if (StringUtils.isBlank(errorMessage)) {
errorMessage = "默认数据不能操作";
}
if (enterpriseId == -1) {
throw new CommonException(ErrorCode.PARAMETER_ERROR.getCode(), "默认数据不能操作");
throw new CommonException(ErrorCode.PARAMETER_ERROR.getCode(), errorMessage);
}
}
......
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