diff --git a/bweb/src/main/java/com/bweb/controller/SecMenuController.java b/bweb/src/main/java/com/bweb/controller/SecMenuController.java index bec13a5..9f68e21 100644 --- a/bweb/src/main/java/com/bweb/controller/SecMenuController.java +++ b/bweb/src/main/java/com/bweb/controller/SecMenuController.java @@ -1,17 +1,12 @@ package com.bweb.controller; import com.alibaba.fastjson.JSONObject; -import com.github.pagehelper.PageHelper; -import com.github.pagehelper.PageInfo; import com.hfkj.common.exception.ErrorCode; import com.hfkj.common.exception.ErrorHelp; import com.hfkj.common.exception.SysCode; -import com.hfkj.common.utils.HttpUtils; -import com.hfkj.common.utils.HttpsUtils; import com.hfkj.common.utils.ResponseMsgUtil; import com.hfkj.entity.SecMenu; import com.hfkj.entity.SecRoleMenuRel; -import com.hfkj.model.MenuTreeModel; import com.hfkj.model.ResponseData; import com.hfkj.service.SecMenuService; import com.hfkj.service.SecRoleMenuRelService; @@ -26,7 +21,6 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.util.*; -import java.util.function.Function; import java.util.stream.Collectors; /** @@ -174,39 +168,10 @@ public class SecMenuController { try { // 查询角色菜单权限 - Map roleMenu = secMenuService.queryRoleMenu(roleId, SecMenuTypeEnum.type1).stream() - .collect(Collectors.toMap(SecMenu::getId, Function.identity())); + List roleMenuList = secRoleMenuRelService.getRelListByRole(roleId); - // 系统菜单叶节点 - List menuLeafList = new ArrayList<>(); - - // 角色菜单叶节点 - List roleLeafList = new ArrayList<>(); - - // 获取全部菜单 - List menuList = secMenuService.getAllList(); - - // 获取最顶层菜单 - List topLevelMenuList = menuList.stream() - .filter(o -> o.getMenuPSid() == null) - .sorted(Comparator.comparing(SecMenu::getMenuSort)) - .collect(Collectors.toList()); - // 递归获取系统菜单叶子节点 - for (SecMenu topLevelMenu : topLevelMenuList) { - if (topLevelMenu.getMenuType().equals(SecMenuTypeEnum.type1.getCode())) { - recursionMenu(menuList, topLevelMenu.getId(), menuLeafList); - } - } - - // 筛选角色菜单叶节点 - for (String leaf : menuLeafList) { - SecMenu menu = roleMenu.get(Long.parseLong(leaf)); - if (menu != null) { - roleLeafList.add(""+menu.getId()); - } - } - - return ResponseMsgUtil.success(roleLeafList); + return ResponseMsgUtil.success(roleMenuList.stream().map(SecRoleMenuRel::getMenuId).collect(Collectors.toList()) + .stream().map(Object::toString).collect(Collectors.toList())); } catch (Exception e) { log.error("error!",e); @@ -247,11 +212,11 @@ public class SecMenuController { for (SecMenu topLevelMenu : topLevelMenuList) { if (topLevelMenu.getMenuType().equals(SecMenuTypeEnum.type1.getCode())) { - map = new LinkedHashMap<>(); + map = new HashMap<>(); map.put("key", ""+topLevelMenu.getId()); map.put("title", topLevelMenu.getMenuName()); // 获取下级菜单 - map.put("children", recursionMenu(menuList, topLevelMenu.getId(), new ArrayList<>())); + map.put("children", recursionMenu(menuList, topLevelMenu.getId())); mapList.add(map); } } @@ -270,7 +235,7 @@ public class SecMenuController { * @param parentMenuId 父级菜单id * @return */ - public List> recursionMenu(List dataSource, Long parentMenuId, List leaf) { + public List> recursionMenu(List dataSource, Long parentMenuId) { List> mapList = new ArrayList<>(); Map map; @@ -280,13 +245,12 @@ public class SecMenuController { .collect(Collectors.toList()); for (SecMenu menu : collect) { if (menu.getMenuType().equals(SecMenuTypeEnum.type1.getCode())) { - map = new LinkedHashMap<>(); + map = new HashMap<>(); map.put("key", ""+menu.getId()); map.put("title", menu.getMenuName()); // 获取下级菜单 - List> recursioned = recursionMenu(dataSource, menu.getId(), leaf); + List> recursioned = recursionMenu(dataSource, menu.getId()); if (recursioned.isEmpty()) { - leaf.add(""+menu.getId()); map.put("isLeaf", true); } else { map.put("children", recursioned); @@ -297,5 +261,4 @@ public class SecMenuController { return mapList; } - } diff --git a/cweb/src/main/java/com/cweb/controller/qianZhu/StarbucksController.java b/cweb/src/main/java/com/cweb/controller/qianZhu/StarbucksController.java index d781a1b..715571a 100644 --- a/cweb/src/main/java/com/cweb/controller/qianZhu/StarbucksController.java +++ b/cweb/src/main/java/com/cweb/controller/qianZhu/StarbucksController.java @@ -26,10 +26,7 @@ import org.springframework.web.bind.annotation.ResponseBody; import javax.annotation.Resource; import java.math.BigDecimal; import java.math.RoundingMode; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.concurrent.atomic.AtomicReference; import java.util.stream.Collectors; @@ -84,7 +81,7 @@ public class StarbucksController { // 查询产品 Map map = new HashMap<>(); map.put("pageIndex", 1); - map.put("pageSize", 100000); + map.put("pageSize", 200); JSONObject object = StarbucksService.starbucksProducts(map); if (object.getJSONObject("data") != null) { JSONArray jsonArray = object.getJSONObject("data").getJSONArray("items"); @@ -96,29 +93,40 @@ public class StarbucksController { // 中杯售卖价 BigDecimal tallPrice = StarbucksUtil.calculatePrice(productConfig.getDiscount() , item.getBigDecimal("salesTallPrice")); + List priceList = new ArrayList<>(); // 判断如果卖家 大于 原价 展示原价 if (tallPrice.compareTo(item.getBigDecimal("marketTallPrice")) > 0) { item.put("tallPrice" , item.getBigDecimal("marketTallPrice")); + priceList.add(item.getBigDecimal("marketTallPrice")); } else { item.put("tallPrice" , tallPrice); + priceList.add(tallPrice); } // 大杯销售价 BigDecimal grandePrice = StarbucksUtil.calculatePrice(productConfig.getDiscount() , item.getBigDecimal("salesGrandePrice")); if (grandePrice.compareTo(item.getBigDecimal("marketGrandePrice")) > 0) { item.put("grandePrice" , item.getBigDecimal("marketGrandePrice")); + priceList.add(item.getBigDecimal("marketGrandePrice")); } else { item.put("grandePrice" , grandePrice); + priceList.add(grandePrice); } // 超大杯销售价 BigDecimal ventiPrice = StarbucksUtil.calculatePrice(productConfig.getDiscount() , item.getBigDecimal("salesVentiPrice")); if (ventiPrice.compareTo(item.getBigDecimal("marketVentiPrice")) > 0) { item.put("ventiPrice" , item.getBigDecimal("marketVentiPrice")); + priceList.add(item.getBigDecimal("marketVentiPrice")); } else { item.put("ventiPrice" , ventiPrice); + priceList.add(ventiPrice); } + Collections.sort(priceList); + item.put("tallPrice" ,priceList.get(0)); + + List dataList = new ArrayList<>(); JSONObject jsonObject ; diff --git a/order/src/main/java/com/order/controller/business/BsOrderStarbucksController.java b/order/src/main/java/com/order/controller/business/BsOrderStarbucksController.java index 51cadf0..f33bbe9 100644 --- a/order/src/main/java/com/order/controller/business/BsOrderStarbucksController.java +++ b/order/src/main/java/com/order/controller/business/BsOrderStarbucksController.java @@ -1,18 +1,15 @@ package com.order.controller.business; import com.github.pagehelper.PageInfo; -import com.hfkj.common.security.SessionObject; -import com.hfkj.common.security.UserCenter; + import com.hfkj.common.utils.PageUtil; import com.hfkj.common.utils.ResponseMsgUtil; import com.hfkj.entity.BsOrderChild; import com.hfkj.entity.BsOrderStarbucks; import com.hfkj.model.ResponseData; -import com.hfkj.model.SecUserSessionObject; import com.hfkj.model.order.OrderStarbucksModel; import com.hfkj.service.goods.BsOrderStarbucksService; import com.hfkj.service.order.BsOrderChildService; -import com.hfkj.sysenum.SecUserObjectTypeEnum; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.slf4j.Logger; diff --git a/service/src/main/java/com/hfkj/common/utils/StarbucksUtil.java b/service/src/main/java/com/hfkj/common/utils/StarbucksUtil.java index 6d6c774..fb55d72 100644 --- a/service/src/main/java/com/hfkj/common/utils/StarbucksUtil.java +++ b/service/src/main/java/com/hfkj/common/utils/StarbucksUtil.java @@ -36,36 +36,61 @@ public class StarbucksUtil { for (String cup : cpuS) { JSONObject obj = new JSONObject(); - switch (cup) { - case "中杯": - obj.put("cpu", "中杯"); - obj.put("notSelect", tall); - obj.put("select", tallSelect); - obj.put("volume", "355ml"); - obj.put("price", tallPrice); - break; - case "大杯": - obj.put("cpu", "大杯"); - obj.put("notSelect", grande); - obj.put("select", grandeSelect); - obj.put("volume", "473ml"); - obj.put("price", grandePrice); - break; - case "超大杯": - obj.put("cpu", "超大杯"); - obj.put("notSelect", venti); - obj.put("select", ventiSelect); - obj.put("volume", "592ml"); - obj.put("price", ventiPrice); - break; - default: - obj.put("cpu", "特殊杯"); - obj.put("notSelect", venti); - obj.put("select", ventiSelect); - obj.put("volume", "∞ml"); - obj.put("price", ventiPrice); - break; + if (cup.equals("中杯") && tallPrice.compareTo(new BigDecimal(1000)) < 0) { + obj.put("cpu" , "中杯"); + obj.put("notSelect" , tall); + obj.put("select" , tallSelect); + obj.put("volume" , "355ml"); + obj.put("price", tallPrice); + } else if (cup.equals("大杯") && grandePrice.compareTo(new BigDecimal(1000)) < 0) { + obj.put("cpu" , "大杯"); + obj.put("notSelect" , grande); + obj.put("select" , grandeSelect); + obj.put("volume" , "473ml"); + obj.put("price", grandePrice); + } else if (cup.equals("超大杯") && ventiPrice.compareTo(new BigDecimal(1000)) < 0) { + obj.put("cpu" , "超大杯"); + obj.put("notSelect" , venti); + obj.put("select" , ventiSelect); + obj.put("volume" , "592ml"); + obj.put("price", ventiPrice); + } else { + obj.put("cpu" , "特殊杯"); + obj.put("notSelect" , venti); + obj.put("select" , ventiSelect); + obj.put("volume" , "∞ml"); + obj.put("price", ventiPrice); } +// switch (cup) { +// case "中杯": +// obj.put("cpu", "中杯"); +// obj.put("notSelect", tall); +// obj.put("select", tallSelect); +// obj.put("volume", "355ml"); +// obj.put("price", tallPrice); +// break; +// case "大杯": +// obj.put("cpu", "大杯"); +// obj.put("notSelect", grande); +// obj.put("select", grandeSelect); +// obj.put("volume", "473ml"); +// obj.put("price", grandePrice); +// break; +// case "超大杯": +// obj.put("cpu", "超大杯"); +// obj.put("notSelect", venti); +// obj.put("select", ventiSelect); +// obj.put("volume", "592ml"); +// obj.put("price", ventiPrice); +// break; +// default: +// obj.put("cpu", "特殊杯"); +// obj.put("notSelect", venti); +// obj.put("select", ventiSelect); +// obj.put("volume", "∞ml"); +// obj.put("price", ventiPrice); +// break; +// } list.add(obj); } diff --git a/service/src/main/java/com/hfkj/service/cms/impl/CmsContentServiceImpl.java b/service/src/main/java/com/hfkj/service/cms/impl/CmsContentServiceImpl.java index d28f9d8..17bf8b2 100644 --- a/service/src/main/java/com/hfkj/service/cms/impl/CmsContentServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/cms/impl/CmsContentServiceImpl.java @@ -63,7 +63,7 @@ public class CmsContentServiceImpl implements CmsContentService { if (StringUtils.isNotBlank(MapUtils.getString(map, "platformCode"))) { criteria.andPlatformCodeEqualTo(MapUtils.getString(map, "platformCode")); } - + example.setOrderByClause("create_time desc"); return cmsContentMapper.selectByExample(example); } } diff --git a/service/src/main/java/com/hfkj/service/order/OrderCreateService.java b/service/src/main/java/com/hfkj/service/order/OrderCreateService.java index ea20595..90e3703 100644 --- a/service/src/main/java/com/hfkj/service/order/OrderCreateService.java +++ b/service/src/main/java/com/hfkj/service/order/OrderCreateService.java @@ -361,7 +361,7 @@ public class OrderCreateService { // 查询星巴克产品 Map map = new HashMap<>(); map.put("pageIndex", 1); - map.put("pageSize", 100000); + map.put("pageSize", 200); JSONObject jsonObject = StarbucksService.starbucksProducts(map); if (jsonObject.getJSONObject("data") == null) { throw ErrorHelp.genException(SysCode.System , ErrorCode.REQ_PARAMS_ERROR ); @@ -445,16 +445,16 @@ public class OrderCreateService { orderChild.setMerId(productConfig.getMerId()); orderChild.setProductName("星巴克"); orderChild.setProductCount(1); - orderChild.setProductSpecName(String.valueOf(productSpecName.toString())); + orderChild.setProductSpecName(productSpecName.toString()); // 星巴克创建订单 // 获取token Map mapToken = new HashMap<>(); mapToken.put("platformUniqueId" , order.getOrderNo()); mapToken.put("nickname" , order.getUserName()); - mapToken.put("mobile" , order.getUserPhone()); + mapToken.put("mobile" , object.getString("phone")); StarbucksService.getTokenV2(mapToken); - // 查询产品 + // 预下单 Map mapOrder = new HashMap<>(); mapOrder.put("storeCode", object.getString("storeCode")); mapOrder.put("customerMobile", object.getString("phone")); diff --git a/service/src/main/resources/dev/commonConfig.properties b/service/src/main/resources/dev/commonConfig.properties index 39d0775..68885ed 100644 --- a/service/src/main/resources/dev/commonConfig.properties +++ b/service/src/main/resources/dev/commonConfig.properties @@ -58,12 +58,12 @@ huiftShopCode=50041b27-f985-dcb0-1cc0-f106b09bf1fe huiftSignSecret=DB4D8069A9AC6DDF9D75667EE5CF182A #QIANZHU -qianZhuUrl=https://live-test.qianzhu8.com -qianzhuH5url=https://nf-test.qianzhu8.com/gateway -qinzhuUrlToken=https://live-test.qianzhu8.com/gateway -qianZhuPlatformId=10376 -qianZhuSecret=ktxb49sh2jfhgn8g -qianZhuCinemaNotify=https://phgcs.dctpay.com/order/cinemaNotify/notify +qianZhuUrl=https://live.qianzhu8.com +qianzhuH5url=https://nf.qianzhu8.com/gateway +qinzhuUrlToken=https://live.qianzhu8.com/gateway +qianZhuPlatformId=10710 +qianZhuSecret=pgmh5j1cbq2brm08 +qianZhuCinemaNotify=https://phg.dctpay.com/order/cinemaNotify/notify #CT ctNotifyUrl = 1