修改pc装修数据返回

This commit is contained in:
pan.wl.2 2024-11-06 22:45:19 +08:00
parent 8a467f30b6
commit c1af6f7711
3 changed files with 30 additions and 23 deletions

View File

@ -32,8 +32,9 @@ public class ChannelOaMenuController {
return AjaxResult.success();
}
@PostMapping("/publish")
@ApiOperation(value="保存并发布菜单")
@ApiOperation(value="saveAndPublish")
public AjaxResult<Object> publish(@RequestBody List<Object> params) {
iChannelOaMenusService.save(params, true);
return AjaxResult.success();

View File

@ -4,6 +4,7 @@ import com.mdd.admin.service.IChannelH5ConfigService;
import com.mdd.admin.validate.channel.ChannelH5Validate;
import com.mdd.admin.vo.channel.ChannelH5Vo;
import com.mdd.common.util.ConfigUtils;
import com.mdd.common.util.StringUtils;
import com.mdd.common.util.YmlUtils;
import org.springframework.stereotype.Service;
@ -27,7 +28,12 @@ public class ChannelH5ConfigServiceImpl implements IChannelH5ConfigService {
ChannelH5Vo vo = new ChannelH5Vo();
vo.setStatus(Integer.parseInt(config.getOrDefault("status", "1")));
vo.setPageStatus(Integer.parseInt(config.getOrDefault("page_status", "1")));
vo.setUrl(config.getOrDefault("url", YmlUtils.get("like.front-url")));
String url = YmlUtils.get("like.front-url");
url = StringUtils.isNotEmpty(url) && url.endsWith("/") ? url + "/moblie" : url + "moblie";
vo.setUrl(config.getOrDefault("url", url));
vo.setPageUrl(config.getOrDefault("page_url", ""));
return vo;
}

View File

@ -58,47 +58,47 @@ public class ChannelOaMenusServiceImpl implements IChannelOaMenusService {
Assert.notNull(item.get("name"), "一级菜单名称不能为空");
WxMenuButton wxMenuButton = new WxMenuButton();
wxMenuButton.setName(item.get("name"));
if (Integer.parseInt(item.get("menuType")) == 1) {
Assert.notNull(item.get("visitType"), "一级菜单visitType数缺失");
if (item.get("visitType").equals("miniprogram")) {
Assert.notNull(item.get("appId"), "一级菜单appId参数缺失");
if (String.valueOf(item.get("has_menu")).equals("false")) {
Assert.notNull(item.get("type"), "一级菜单type数缺失");
if (item.get("type").equals("miniprogram")) {
Assert.notNull(item.get("appid"), "一级菜单appId参数缺失");
Assert.notNull(item.get("url"), "一级菜单url数缺失");
Assert.notNull(item.get("pagePath"), "一级菜单pagePath数缺失");
wxMenuButton.setType(item.get("visitType"));
wxMenuButton.setAppId(item.get("appId"));
Assert.notNull(item.get("pagepath"), "一级菜单pagePath数缺失");
wxMenuButton.setType(item.get("type"));
wxMenuButton.setAppId(item.get("appid"));
wxMenuButton.setUrl(item.get("url"));
wxMenuButton.setPagePath(item.get("pagePath"));
wxMenuButton.setPagePath(item.get("pagepath"));
} else {
Assert.notNull(item.get("url"), "一级菜单url数缺失");
wxMenuButton.setType(item.get("visitType"));
wxMenuButton.setType(item.get("type"));
wxMenuButton.setUrl(item.get("url"));
wxMenuButton.setAppId(item.getOrDefault("appId", ""));
wxMenuButton.setAppId(item.getOrDefault("appid", ""));
}
menuButtons.add(wxMenuButton);
}
// 子级菜单
if (Integer.parseInt(item.get("menuType")) == 2) {
Assert.notNull(item.get("subButtons"), "子级菜单不能为空");
List<Map<String, String>> subButtons = ListUtils.stringToListAsMapStr(item.get("subButtons"));
if (String.valueOf(item.get("has_menu")).equals("true")) {
Assert.notNull(item.get("sub_button"), "子级菜单不能为空");
List<Map<String, String>> subButtons = ListUtils.stringToListAsMapStr(item.get("sub_button"));
if (subButtons.size() > 5) {
throw new OperateException("子级菜单超出限制(最多5个)");
}
for (Map<String, String> subItem : subButtons) {
WxMenuButton subMenuButton = new WxMenuButton();
Assert.notNull(subItem.get("visitType"), "子级菜单visitType参数缺失!");
if (subItem.get("visitType").equals("miniprogram")) {
Assert.notNull(subItem.get("appId"), "子级菜单appId参数缺失!");
Assert.notNull(subItem.get("type"), "子级菜单type参数缺失!");
if (subItem.get("type").equals("miniprogram")) {
Assert.notNull(subItem.get("appid"), "子级菜单appId参数缺失!");
Assert.notNull(subItem.get("url"), "子级菜单url数缺失!");
Assert.notNull(subItem.get("pagePath"), "子级菜单pagePath数缺失!");
wxMenuButton.setType(subItem.get("visitType"));
wxMenuButton.setAppId(subItem.get("appId"));
Assert.notNull(subItem.get("pagepath"), "子级菜单pagePath数缺失!");
wxMenuButton.setType(subItem.get("type"));
wxMenuButton.setAppId(subItem.get("appid"));
wxMenuButton.setUrl(subItem.get("url"));
wxMenuButton.setPagePath(subItem.get("pagePath"));
wxMenuButton.setPagePath(subItem.get("pagepath"));
} else {
Assert.notNull(subItem.get("url"), "子级菜单url数缺失");
wxMenuButton.setType(subItem.get("visitType"));
wxMenuButton.setType(subItem.get("type"));
wxMenuButton.setUrl(subItem.get("url"));
}
menuButtons.add(subMenuButton);