袁野 3 months ago
parent 7743827cf6
commit e78b9dcc76
  1. 53
      bweb/src/main/java/com/bweb/controller/SecMenuController.java
  2. 18
      cweb/src/main/java/com/cweb/controller/qianZhu/StarbucksController.java
  3. 5
      order/src/main/java/com/order/controller/business/BsOrderStarbucksController.java
  4. 75
      service/src/main/java/com/hfkj/common/utils/StarbucksUtil.java
  5. 2
      service/src/main/java/com/hfkj/service/cms/impl/CmsContentServiceImpl.java
  6. 8
      service/src/main/java/com/hfkj/service/order/OrderCreateService.java
  7. 12
      service/src/main/resources/dev/commonConfig.properties

@ -1,17 +1,12 @@
package com.bweb.controller; package com.bweb.controller;
import com.alibaba.fastjson.JSONObject; 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.ErrorCode;
import com.hfkj.common.exception.ErrorHelp; import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode; 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.common.utils.ResponseMsgUtil;
import com.hfkj.entity.SecMenu; import com.hfkj.entity.SecMenu;
import com.hfkj.entity.SecRoleMenuRel; import com.hfkj.entity.SecRoleMenuRel;
import com.hfkj.model.MenuTreeModel;
import com.hfkj.model.ResponseData; import com.hfkj.model.ResponseData;
import com.hfkj.service.SecMenuService; import com.hfkj.service.SecMenuService;
import com.hfkj.service.SecRoleMenuRelService; import com.hfkj.service.SecRoleMenuRelService;
@ -26,7 +21,6 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.*; import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@ -174,39 +168,10 @@ public class SecMenuController {
try { try {
// 查询角色菜单权限 // 查询角色菜单权限
Map<Long, SecMenu> roleMenu = secMenuService.queryRoleMenu(roleId, SecMenuTypeEnum.type1).stream() List<SecRoleMenuRel> roleMenuList = secRoleMenuRelService.getRelListByRole(roleId);
.collect(Collectors.toMap(SecMenu::getId, Function.identity()));
// 系统菜单叶节点 return ResponseMsgUtil.success(roleMenuList.stream().map(SecRoleMenuRel::getMenuId).collect(Collectors.toList())
List<String> menuLeafList = new ArrayList<>(); .stream().map(Object::toString).collect(Collectors.toList()));
// 角色菜单叶节点
List<String> roleLeafList = new ArrayList<>();
// 获取全部菜单
List<SecMenu> menuList = secMenuService.getAllList();
// 获取最顶层菜单
List<SecMenu> 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);
} catch (Exception e) { } catch (Exception e) {
log.error("error!",e); log.error("error!",e);
@ -247,11 +212,11 @@ public class SecMenuController {
for (SecMenu topLevelMenu : topLevelMenuList) { for (SecMenu topLevelMenu : topLevelMenuList) {
if (topLevelMenu.getMenuType().equals(SecMenuTypeEnum.type1.getCode())) { if (topLevelMenu.getMenuType().equals(SecMenuTypeEnum.type1.getCode())) {
map = new LinkedHashMap<>(); map = new HashMap<>();
map.put("key", ""+topLevelMenu.getId()); map.put("key", ""+topLevelMenu.getId());
map.put("title", topLevelMenu.getMenuName()); map.put("title", topLevelMenu.getMenuName());
// 获取下级菜单 // 获取下级菜单
map.put("children", recursionMenu(menuList, topLevelMenu.getId(), new ArrayList<>())); map.put("children", recursionMenu(menuList, topLevelMenu.getId()));
mapList.add(map); mapList.add(map);
} }
} }
@ -270,7 +235,7 @@ public class SecMenuController {
* @param parentMenuId 父级菜单id * @param parentMenuId 父级菜单id
* @return * @return
*/ */
public List<Map<String,Object>> recursionMenu(List<SecMenu> dataSource, Long parentMenuId, List<String> leaf) { public List<Map<String,Object>> recursionMenu(List<SecMenu> dataSource, Long parentMenuId) {
List<Map<String,Object>> mapList = new ArrayList<>(); List<Map<String,Object>> mapList = new ArrayList<>();
Map<String,Object> map; Map<String,Object> map;
@ -280,13 +245,12 @@ public class SecMenuController {
.collect(Collectors.toList()); .collect(Collectors.toList());
for (SecMenu menu : collect) { for (SecMenu menu : collect) {
if (menu.getMenuType().equals(SecMenuTypeEnum.type1.getCode())) { if (menu.getMenuType().equals(SecMenuTypeEnum.type1.getCode())) {
map = new LinkedHashMap<>(); map = new HashMap<>();
map.put("key", ""+menu.getId()); map.put("key", ""+menu.getId());
map.put("title", menu.getMenuName()); map.put("title", menu.getMenuName());
// 获取下级菜单 // 获取下级菜单
List<Map<String, Object>> recursioned = recursionMenu(dataSource, menu.getId(), leaf); List<Map<String, Object>> recursioned = recursionMenu(dataSource, menu.getId());
if (recursioned.isEmpty()) { if (recursioned.isEmpty()) {
leaf.add(""+menu.getId());
map.put("isLeaf", true); map.put("isLeaf", true);
} else { } else {
map.put("children", recursioned); map.put("children", recursioned);
@ -297,5 +261,4 @@ public class SecMenuController {
return mapList; return mapList;
} }
} }

@ -26,10 +26,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -84,7 +81,7 @@ public class StarbucksController {
// 查询产品 // 查询产品
Map<String , Object> map = new HashMap<>(); Map<String , Object> map = new HashMap<>();
map.put("pageIndex", 1); map.put("pageIndex", 1);
map.put("pageSize", 100000); map.put("pageSize", 200);
JSONObject object = StarbucksService.starbucksProducts(map); JSONObject object = StarbucksService.starbucksProducts(map);
if (object.getJSONObject("data") != null) { if (object.getJSONObject("data") != null) {
JSONArray jsonArray = object.getJSONObject("data").getJSONArray("items"); JSONArray jsonArray = object.getJSONObject("data").getJSONArray("items");
@ -96,29 +93,40 @@ public class StarbucksController {
// 中杯售卖价 // 中杯售卖价
BigDecimal tallPrice = StarbucksUtil.calculatePrice(productConfig.getDiscount() , item.getBigDecimal("salesTallPrice")); BigDecimal tallPrice = StarbucksUtil.calculatePrice(productConfig.getDiscount() , item.getBigDecimal("salesTallPrice"));
List<BigDecimal> priceList = new ArrayList<>();
// 判断如果卖家 大于 原价 展示原价 // 判断如果卖家 大于 原价 展示原价
if (tallPrice.compareTo(item.getBigDecimal("marketTallPrice")) > 0) { if (tallPrice.compareTo(item.getBigDecimal("marketTallPrice")) > 0) {
item.put("tallPrice" , item.getBigDecimal("marketTallPrice")); item.put("tallPrice" , item.getBigDecimal("marketTallPrice"));
priceList.add(item.getBigDecimal("marketTallPrice"));
} else { } else {
item.put("tallPrice" , tallPrice); item.put("tallPrice" , tallPrice);
priceList.add(tallPrice);
} }
// 大杯销售价 // 大杯销售价
BigDecimal grandePrice = StarbucksUtil.calculatePrice(productConfig.getDiscount() , item.getBigDecimal("salesGrandePrice")); BigDecimal grandePrice = StarbucksUtil.calculatePrice(productConfig.getDiscount() , item.getBigDecimal("salesGrandePrice"));
if (grandePrice.compareTo(item.getBigDecimal("marketGrandePrice")) > 0) { if (grandePrice.compareTo(item.getBigDecimal("marketGrandePrice")) > 0) {
item.put("grandePrice" , item.getBigDecimal("marketGrandePrice")); item.put("grandePrice" , item.getBigDecimal("marketGrandePrice"));
priceList.add(item.getBigDecimal("marketGrandePrice"));
} else { } else {
item.put("grandePrice" , grandePrice); item.put("grandePrice" , grandePrice);
priceList.add(grandePrice);
} }
// 超大杯销售价 // 超大杯销售价
BigDecimal ventiPrice = StarbucksUtil.calculatePrice(productConfig.getDiscount() , item.getBigDecimal("salesVentiPrice")); BigDecimal ventiPrice = StarbucksUtil.calculatePrice(productConfig.getDiscount() , item.getBigDecimal("salesVentiPrice"));
if (ventiPrice.compareTo(item.getBigDecimal("marketVentiPrice")) > 0) { if (ventiPrice.compareTo(item.getBigDecimal("marketVentiPrice")) > 0) {
item.put("ventiPrice" , item.getBigDecimal("marketVentiPrice")); item.put("ventiPrice" , item.getBigDecimal("marketVentiPrice"));
priceList.add(item.getBigDecimal("marketVentiPrice"));
} else { } else {
item.put("ventiPrice" , ventiPrice); item.put("ventiPrice" , ventiPrice);
priceList.add(ventiPrice);
} }
Collections.sort(priceList);
item.put("tallPrice" ,priceList.get(0));
List<JSONObject> dataList = new ArrayList<>(); List<JSONObject> dataList = new ArrayList<>();
JSONObject jsonObject ; JSONObject jsonObject ;

@ -1,18 +1,15 @@
package com.order.controller.business; package com.order.controller.business;
import com.github.pagehelper.PageInfo; 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.PageUtil;
import com.hfkj.common.utils.ResponseMsgUtil; import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.entity.BsOrderChild; import com.hfkj.entity.BsOrderChild;
import com.hfkj.entity.BsOrderStarbucks; import com.hfkj.entity.BsOrderStarbucks;
import com.hfkj.model.ResponseData; import com.hfkj.model.ResponseData;
import com.hfkj.model.SecUserSessionObject;
import com.hfkj.model.order.OrderStarbucksModel; import com.hfkj.model.order.OrderStarbucksModel;
import com.hfkj.service.goods.BsOrderStarbucksService; import com.hfkj.service.goods.BsOrderStarbucksService;
import com.hfkj.service.order.BsOrderChildService; import com.hfkj.service.order.BsOrderChildService;
import com.hfkj.sysenum.SecUserObjectTypeEnum;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger; import org.slf4j.Logger;

@ -36,36 +36,61 @@ public class StarbucksUtil {
for (String cup : cpuS) { for (String cup : cpuS) {
JSONObject obj = new JSONObject(); JSONObject obj = new JSONObject();
switch (cup) { if (cup.equals("中杯") && tallPrice.compareTo(new BigDecimal(1000)) < 0) {
case "中杯": obj.put("cpu" , "中杯");
obj.put("cpu", "中杯"); obj.put("notSelect" , tall);
obj.put("notSelect", tall); obj.put("select" , tallSelect);
obj.put("select", tallSelect); obj.put("volume" , "355ml");
obj.put("volume", "355ml");
obj.put("price", tallPrice); obj.put("price", tallPrice);
break; } else if (cup.equals("大杯") && grandePrice.compareTo(new BigDecimal(1000)) < 0) {
case "大杯": obj.put("cpu" , "大杯");
obj.put("cpu", "大杯"); obj.put("notSelect" , grande);
obj.put("notSelect", grande); obj.put("select" , grandeSelect);
obj.put("select", grandeSelect); obj.put("volume" , "473ml");
obj.put("volume", "473ml");
obj.put("price", grandePrice); obj.put("price", grandePrice);
break; } else if (cup.equals("超大杯") && ventiPrice.compareTo(new BigDecimal(1000)) < 0) {
case "超大杯": obj.put("cpu" , "超大杯");
obj.put("cpu", "超大杯"); obj.put("notSelect" , venti);
obj.put("notSelect", venti); obj.put("select" , ventiSelect);
obj.put("select", ventiSelect); obj.put("volume" , "592ml");
obj.put("volume", "592ml");
obj.put("price", ventiPrice); obj.put("price", ventiPrice);
break; } else {
default: obj.put("cpu" , "特殊杯");
obj.put("cpu", "特殊杯"); obj.put("notSelect" , venti);
obj.put("notSelect", venti); obj.put("select" , ventiSelect);
obj.put("select", ventiSelect); obj.put("volume" , "∞ml");
obj.put("volume", "∞ml");
obj.put("price", ventiPrice); obj.put("price", ventiPrice);
break;
} }
// 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); list.add(obj);
} }

@ -63,7 +63,7 @@ public class CmsContentServiceImpl implements CmsContentService {
if (StringUtils.isNotBlank(MapUtils.getString(map, "platformCode"))) { if (StringUtils.isNotBlank(MapUtils.getString(map, "platformCode"))) {
criteria.andPlatformCodeEqualTo(MapUtils.getString(map, "platformCode")); criteria.andPlatformCodeEqualTo(MapUtils.getString(map, "platformCode"));
} }
example.setOrderByClause("create_time desc");
return cmsContentMapper.selectByExample(example); return cmsContentMapper.selectByExample(example);
} }
} }

@ -361,7 +361,7 @@ public class OrderCreateService {
// 查询星巴克产品 // 查询星巴克产品
Map<String , Object> map = new HashMap<>(); Map<String , Object> map = new HashMap<>();
map.put("pageIndex", 1); map.put("pageIndex", 1);
map.put("pageSize", 100000); map.put("pageSize", 200);
JSONObject jsonObject = StarbucksService.starbucksProducts(map); JSONObject jsonObject = StarbucksService.starbucksProducts(map);
if (jsonObject.getJSONObject("data") == null) { if (jsonObject.getJSONObject("data") == null) {
throw ErrorHelp.genException(SysCode.System , ErrorCode.REQ_PARAMS_ERROR ); throw ErrorHelp.genException(SysCode.System , ErrorCode.REQ_PARAMS_ERROR );
@ -445,16 +445,16 @@ public class OrderCreateService {
orderChild.setMerId(productConfig.getMerId()); orderChild.setMerId(productConfig.getMerId());
orderChild.setProductName("星巴克"); orderChild.setProductName("星巴克");
orderChild.setProductCount(1); orderChild.setProductCount(1);
orderChild.setProductSpecName(String.valueOf(productSpecName.toString())); orderChild.setProductSpecName(productSpecName.toString());
// 星巴克创建订单 // 星巴克创建订单
// 获取token // 获取token
Map<String , Object> mapToken = new HashMap<>(); Map<String , Object> mapToken = new HashMap<>();
mapToken.put("platformUniqueId" , order.getOrderNo()); mapToken.put("platformUniqueId" , order.getOrderNo());
mapToken.put("nickname" , order.getUserName()); mapToken.put("nickname" , order.getUserName());
mapToken.put("mobile" , order.getUserPhone()); mapToken.put("mobile" , object.getString("phone"));
StarbucksService.getTokenV2(mapToken); StarbucksService.getTokenV2(mapToken);
// 查询产品 // 预下单
Map<String , Object> mapOrder = new HashMap<>(); Map<String , Object> mapOrder = new HashMap<>();
mapOrder.put("storeCode", object.getString("storeCode")); mapOrder.put("storeCode", object.getString("storeCode"));
mapOrder.put("customerMobile", object.getString("phone")); mapOrder.put("customerMobile", object.getString("phone"));

@ -58,12 +58,12 @@ huiftShopCode=50041b27-f985-dcb0-1cc0-f106b09bf1fe
huiftSignSecret=DB4D8069A9AC6DDF9D75667EE5CF182A huiftSignSecret=DB4D8069A9AC6DDF9D75667EE5CF182A
#QIANZHU #QIANZHU
qianZhuUrl=https://live-test.qianzhu8.com qianZhuUrl=https://live.qianzhu8.com
qianzhuH5url=https://nf-test.qianzhu8.com/gateway qianzhuH5url=https://nf.qianzhu8.com/gateway
qinzhuUrlToken=https://live-test.qianzhu8.com/gateway qinzhuUrlToken=https://live.qianzhu8.com/gateway
qianZhuPlatformId=10376 qianZhuPlatformId=10710
qianZhuSecret=ktxb49sh2jfhgn8g qianZhuSecret=pgmh5j1cbq2brm08
qianZhuCinemaNotify=https://phgcs.dctpay.com/order/cinemaNotify/notify qianZhuCinemaNotify=https://phg.dctpay.com/order/cinemaNotify/notify
#CT #CT
ctNotifyUrl = 1 ctNotifyUrl = 1

Loading…
Cancel
Save