From fd5947c45ed6fe53d871c3e10f8bde159c970537 Mon Sep 17 00:00:00 2001 From: yuanye <418471657@qq.com> Date: Thu, 8 Aug 2024 09:35:48 +0800 Subject: [PATCH] 1 --- .../discount/DiscountController.java | 16 +- .../qianZhu/StarbucksController.java | 196 ++++++++---------- .../business/BsOrderStarbucksController.java | 118 +++++++++++ .../hfkj/model/order/OrderStarbucksModel.java | 20 ++ .../hfkj/service/SecDictionaryService.java | 11 + .../impl/SecDictionaryServiceImpl.java | 9 + .../service/order/BsOrderChildService.java | 11 + .../service/order/OrderCreateService.java | 6 +- .../order/impl/BsOrderChildServiceImpl.java | 43 ++++ .../order/impl/BsOrderServiceImpl.java | 4 +- 10 files changed, 318 insertions(+), 116 deletions(-) create mode 100644 order/src/main/java/com/order/controller/business/BsOrderStarbucksController.java create mode 100644 service/src/main/java/com/hfkj/model/order/OrderStarbucksModel.java diff --git a/cweb/src/main/java/com/cweb/controller/discount/DiscountController.java b/cweb/src/main/java/com/cweb/controller/discount/DiscountController.java index 07032b3..6822885 100644 --- a/cweb/src/main/java/com/cweb/controller/discount/DiscountController.java +++ b/cweb/src/main/java/com/cweb/controller/discount/DiscountController.java @@ -113,16 +113,24 @@ public class DiscountController { listDiscount.forEach(d -> { Map mapSpecs = new HashMap<>(); mapSpecs.put("discountId", d.getDiscountId()); + mapSpecs.put("specsIds", specsIds); // 查询规格可用优惠券 List couponDiscountGoodsRel = couponDiscountService.getListGoodsRel(mapSpecs); List specsIdList = new ArrayList<>(); + List specsIdListS = new ArrayList<>(); couponDiscountGoodsRel.forEach(dg -> { specsIdList.add(dg.getSpecsId()); }); - String specsIdsStr = StringUtils.join(specsIdList, ","); - if (specsIdsStr.contains(specsIds)) { + String[] s = specsIds.split(","); + + for(String ss : s) { + specsIdListS.add(Long.parseLong(ss)); + } + Collections.sort(specsIdList); + Collections.sort(specsIdListS); + if (specsIdList.toString().equals(specsIdListS.toString())) { listFind.add(d); } }); @@ -179,7 +187,7 @@ public class DiscountController { try { // 用户session UserSessionObject userSession = userCenter.getSessionModel(UserSessionObject.class); - List dictionary = dictionaryService.getDictionary(code); + List dictionary = dictionaryService.getDictionaryByOl(code); if (!dictionary.isEmpty()) { for (SecDictionary secDictionary : dictionary) { @@ -189,7 +197,7 @@ public class DiscountController { map.put("discountId", secDictionary.getCodeValue()); List list = discountUserRelService.getList(map); - if (!list.isEmpty()) { + if (list.isEmpty()) { couponDiscountPackageService.giveDiscountPackage(Integer.valueOf(secDictionary.getCodeName()), userSession.getUser().getPhone()); } 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 434c5b0..d781a1b 100644 --- a/cweb/src/main/java/com/cweb/controller/qianZhu/StarbucksController.java +++ b/cweb/src/main/java/com/cweb/controller/qianZhu/StarbucksController.java @@ -73,126 +73,104 @@ public class StarbucksController { @RequestMapping(value="/starbucksProducts",method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询星巴克产品") - public ResponseData starbucksProducts( - @RequestParam(name = "code", required = false) String code, - @RequestParam(name = "lat", required = true) String lat, - @RequestParam(name = "lon", required = true) String lon) { + public ResponseData starbucksProducts(@RequestParam(name = "code", required = false) String code) { try { - Map params = new HashMap<>(); - - params.put("lat", lat); - params.put("lon", lon); - List list = StarbucksService.starbucksStoresList(params); + List products = new ArrayList<>(); + JSONObject product = new JSONObject(); + // 查询产品配置 + BsProductConfig productConfig = productConfigService.queryDetail(OrderChildProductTypeEnum.type4.getCode()); + // 查询产品 + Map map = new HashMap<>(); + map.put("pageIndex", 1); + map.put("pageSize", 100000); + JSONObject object = StarbucksService.starbucksProducts(map); + if (object.getJSONObject("data") != null) { + JSONArray jsonArray = object.getJSONObject("data").getJSONArray("items"); + // 判断数据不为空 + if (!jsonArray.isEmpty()) { + for(Object obj : jsonArray) { + JSONObject item = (JSONObject) obj; + if (item.getInteger("shelfStatus") == 5) { + // 中杯售卖价 + BigDecimal tallPrice = StarbucksUtil.calculatePrice(productConfig.getDiscount() , item.getBigDecimal("salesTallPrice")); + + // 判断如果卖家 大于 原价 展示原价 + if (tallPrice.compareTo(item.getBigDecimal("marketTallPrice")) > 0) { + item.put("tallPrice" , item.getBigDecimal("marketTallPrice")); + } else { + item.put("tallPrice" , tallPrice); + } - if (code != null) { - list = list.stream() - .filter(s -> s.getString("code").equals(code)) - .collect(Collectors.toList()); // 将结果收集到列表中 - } + // 大杯销售价 + BigDecimal grandePrice = StarbucksUtil.calculatePrice(productConfig.getDiscount() , item.getBigDecimal("salesGrandePrice")); + if (grandePrice.compareTo(item.getBigDecimal("marketGrandePrice")) > 0) { + item.put("grandePrice" , item.getBigDecimal("marketGrandePrice")); + } else { + item.put("grandePrice" , grandePrice); + } + // 超大杯销售价 + BigDecimal ventiPrice = StarbucksUtil.calculatePrice(productConfig.getDiscount() , item.getBigDecimal("salesVentiPrice")); + if (ventiPrice.compareTo(item.getBigDecimal("marketVentiPrice")) > 0) { + item.put("ventiPrice" , item.getBigDecimal("marketVentiPrice")); + } else { + item.put("ventiPrice" , ventiPrice); + } - List products = new ArrayList<>(); - JSONObject product = new JSONObject(); - if (!list.isEmpty()) { - JSONObject data = list.get(0); - product.put("store", data); - // 查询产品配置 - BsProductConfig productConfig = productConfigService.queryDetail(OrderChildProductTypeEnum.type4.getCode()); - - // 查询产品 - Map map = new HashMap<>(); - map.put("pageIndex", 1); - map.put("pageSize", 100000); - JSONObject object = StarbucksService.starbucksProducts(map); - if (object.getJSONObject("data") != null) { - JSONArray jsonArray = object.getJSONObject("data").getJSONArray("items"); - // 判断数据不为空 - if (!jsonArray.isEmpty()) { - for(Object obj : jsonArray) { - JSONObject item = (JSONObject) obj; - if (item.getInteger("shelfStatus") == 5) { - // 中杯售卖价 - BigDecimal tallPrice = StarbucksUtil.calculatePrice(productConfig.getDiscount() , item.getBigDecimal("salesTallPrice")); - - // 判断如果卖家 大于 原价 展示原价 - if (tallPrice.compareTo(item.getBigDecimal("marketTallPrice")) > 0) { - item.put("tallPrice" , item.getBigDecimal("marketTallPrice")); - } else { - item.put("tallPrice" , tallPrice); - } - - // 大杯销售价 - BigDecimal grandePrice = StarbucksUtil.calculatePrice(productConfig.getDiscount() , item.getBigDecimal("salesGrandePrice")); - if (grandePrice.compareTo(item.getBigDecimal("marketGrandePrice")) > 0) { - item.put("grandePrice" , item.getBigDecimal("marketGrandePrice")); - } else { - item.put("grandePrice" , grandePrice); - } - - // 超大杯销售价 - BigDecimal ventiPrice = StarbucksUtil.calculatePrice(productConfig.getDiscount() , item.getBigDecimal("salesVentiPrice")); - if (ventiPrice.compareTo(item.getBigDecimal("marketVentiPrice")) > 0) { - item.put("ventiPrice" , item.getBigDecimal("marketVentiPrice")); - } else { - item.put("ventiPrice" , ventiPrice); - } - - List dataList = new ArrayList<>(); - - JSONObject jsonObject ; - if (StringUtils.isNotBlank(item.getString("cupSize"))) { - jsonObject = new JSONObject(); - jsonObject.put("name" , "杯型"); - jsonObject.put("type" , 1); - jsonObject.put("data" , StarbucksUtil.unitLengthTransform(item.getString("cupSize") , item.getBigDecimal("tallPrice") , item.getBigDecimal("grandePrice") , item.getBigDecimal("ventiPrice"))); - dataList.add(jsonObject); - } - if (StringUtils.isNotBlank(item.getString("temperature"))) { - jsonObject = new JSONObject(); - jsonObject.put("name" , "温度"); - jsonObject.put("type" , 2); - jsonObject.put("data" , item.getString("temperature").split(",")); - dataList.add(jsonObject); - } - if (StringUtils.isNotBlank(item.getString("cream"))) { - jsonObject = new JSONObject(); - jsonObject.put("name" , "奶油"); - jsonObject.put("type" , 2); - jsonObject.put("data" , item.getString("cream").split(",")); - dataList.add(jsonObject); - } - if (StringUtils.isNotBlank(item.getString("espresso"))) { - jsonObject = new JSONObject(); - jsonObject.put("name" , "浓缩咖啡"); - jsonObject.put("type" , 2); - jsonObject.put("data" , item.getString("espresso").split(",")); - dataList.add(jsonObject); - } - if (StringUtils.isNotBlank(item.getString("milk"))) { - jsonObject = new JSONObject(); - jsonObject.put("name" , "牛奶"); - jsonObject.put("type" , 2); - jsonObject.put("data" , item.getString("milk").split(",")); - dataList.add(jsonObject); - } - if (StringUtils.isNotBlank(item.getString("milkBubble"))) { - jsonObject = new JSONObject(); - jsonObject.put("name" , "奶泡"); - jsonObject.put("type" , 2); - jsonObject.put("data" , item.getString("milkBubble").split(",")); - dataList.add(jsonObject); - } - item.put("saleData" , dataList); - - products.add(item); + List dataList = new ArrayList<>(); + JSONObject jsonObject ; + if (StringUtils.isNotBlank(item.getString("cupSize"))) { + jsonObject = new JSONObject(); + jsonObject.put("name" , "杯型"); + jsonObject.put("type" , 1); + jsonObject.put("data" , StarbucksUtil.unitLengthTransform(item.getString("cupSize") , item.getBigDecimal("tallPrice") , item.getBigDecimal("grandePrice") , item.getBigDecimal("ventiPrice"))); + dataList.add(jsonObject); + } + if (StringUtils.isNotBlank(item.getString("temperature"))) { + jsonObject = new JSONObject(); + jsonObject.put("name" , "温度"); + jsonObject.put("type" , 2); + jsonObject.put("data" , item.getString("temperature").split(",")); + dataList.add(jsonObject); + } + if (StringUtils.isNotBlank(item.getString("cream"))) { + jsonObject = new JSONObject(); + jsonObject.put("name" , "奶油"); + jsonObject.put("type" , 2); + jsonObject.put("data" , item.getString("cream").split(",")); + dataList.add(jsonObject); + } + if (StringUtils.isNotBlank(item.getString("espresso"))) { + jsonObject = new JSONObject(); + jsonObject.put("name" , "浓缩咖啡"); + jsonObject.put("type" , 2); + jsonObject.put("data" , item.getString("espresso").split(",")); + dataList.add(jsonObject); } + if (StringUtils.isNotBlank(item.getString("milk"))) { + jsonObject = new JSONObject(); + jsonObject.put("name" , "牛奶"); + jsonObject.put("type" , 2); + jsonObject.put("data" , item.getString("milk").split(",")); + dataList.add(jsonObject); + } + if (StringUtils.isNotBlank(item.getString("milkBubble"))) { + jsonObject = new JSONObject(); + jsonObject.put("name" , "奶泡"); + jsonObject.put("type" , 2); + jsonObject.put("data" , item.getString("milkBubble").split(",")); + dataList.add(jsonObject); + } + item.put("saleData" , dataList); + + products.add(item); + } } } - } Map> collect = products.stream().collect(Collectors.groupingBy(jsonObject -> jsonObject.getString("categoryName"))); diff --git a/order/src/main/java/com/order/controller/business/BsOrderStarbucksController.java b/order/src/main/java/com/order/controller/business/BsOrderStarbucksController.java new file mode 100644 index 0000000..442eef1 --- /dev/null +++ b/order/src/main/java/com/order/controller/business/BsOrderStarbucksController.java @@ -0,0 +1,118 @@ +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; +import org.slf4j.LoggerFactory; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +@Controller +@RequestMapping(value="/orderStarbucks") +@Api(value="星巴克订单管理") +public class BsOrderStarbucksController { + + private static final Logger log = LoggerFactory.getLogger(BsOrderStarbucksController.class); + + @Resource + private BsOrderChildService bsOrderChildService; + + @Resource + private BsOrderStarbucksService bsOrderStarbucksService; + + @RequestMapping(value="/getListStarbucks",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "查询列表") + public ResponseData getListStarbucks( + @RequestParam(value = "orderNo" , required = false) String orderNo, + @RequestParam(value = "childOrderNo" , required = false) String childOrderNo, + @RequestParam(value = "userPhone" , required = false) String userPhone, + @RequestParam(value = "productSpecName" , required = false) String productSpecName, + @RequestParam(value = "storeAddress" , required = false) String storeAddress, + @RequestParam(value = "storeName" , required = false) String storeName, + @RequestParam(value = "productName" , required = false) String productName, + @RequestParam(value = "payType" , required = false) Integer payType, + @RequestParam(value = "status" , required = false) Integer status, + @RequestParam(value = "createTimeS" , required = false) Long createTimeS, + @RequestParam(value = "createTimeE" , required = false) Long createTimeE, + @RequestParam(value = "pageNum" , required = true) Integer pageNum, + @RequestParam(value = "pageSize" , required = true) Integer pageSize, HttpServletRequest request) { + try { + + Map map = new HashMap<>(); + map.put("orderNo", orderNo); + map.put("childOrderNo", childOrderNo); + map.put("productType", 4); + map.put("productSpecName", productSpecName); + map.put("productName", productName); + map.put("createTimeS", createTimeS); + map.put("createTimeE", createTimeE); + map.put("status", status); + + List list = bsOrderChildService.getList(map); + List starbucksList = bsOrderStarbucksService.getList(new HashMap<>()); + + List starbucksModelList = new ArrayList<>(); + + for (BsOrderChild bsOrderChild : list) { + OrderStarbucksModel starbucksModel = new OrderStarbucksModel(); + BeanUtils.copyProperties(bsOrderChild, starbucksModel); + + List starbucks= starbucksList.stream().filter(s -> s.getOrderNo().equals(starbucksModel.getOrderNo())). + collect(Collectors.toList()); + if (!starbucks.isEmpty()) { + starbucksModel.setStoreAddress(starbucks.get(0).getStoreAddress()); + starbucksModel.setStoreName(starbucks.get(0).getStoreName()); + starbucksModel.setUserPhone(starbucks.get(0).getUserPhone()); + + starbucksModelList.add(starbucksModel); + } + + } + + if (storeAddress != null) { + starbucksModelList = starbucksModelList.stream().filter(s -> s.getStoreAddress().contains(storeAddress)) // 使用contains方法进行模糊查询 + .collect(Collectors.toList()); + } + if (storeName != null) { + starbucksModelList = starbucksModelList.stream().filter(s -> s.getStoreName().contains(storeName)) // 使用contains方法进行模糊查询 + .collect(Collectors.toList()); + } + if (userPhone != null) { + starbucksModelList = starbucksModelList.stream().filter(s -> s.getUserPhone().contains(userPhone)) // 使用contains方法进行模糊查询 + .collect(Collectors.toList()); + } + + return ResponseMsgUtil.success(PageUtil.initPageInfoObj(pageNum, starbucksModelList.size(), pageSize, new PageInfo<>(starbucksModelList))); + + } catch (Exception e) { + log.error("error!",e); + return ResponseMsgUtil.exception(e); + } + } +} diff --git a/service/src/main/java/com/hfkj/model/order/OrderStarbucksModel.java b/service/src/main/java/com/hfkj/model/order/OrderStarbucksModel.java new file mode 100644 index 0000000..56c49b0 --- /dev/null +++ b/service/src/main/java/com/hfkj/model/order/OrderStarbucksModel.java @@ -0,0 +1,20 @@ +package com.hfkj.model.order; + +import com.hfkj.entity.BsOrderChild; +import lombok.Data; + +@Data +public class OrderStarbucksModel extends BsOrderChild{ + + /** + * 门店地址 + */ + private String storeAddress; + + /** + * 门店名称 + */ + private String storeName; + + private String userPhone; +} diff --git a/service/src/main/java/com/hfkj/service/SecDictionaryService.java b/service/src/main/java/com/hfkj/service/SecDictionaryService.java index 476ce3d..7ca2ffe 100644 --- a/service/src/main/java/com/hfkj/service/SecDictionaryService.java +++ b/service/src/main/java/com/hfkj/service/SecDictionaryService.java @@ -24,6 +24,17 @@ public interface SecDictionaryService { */ List getDictionary(String codeType); + + /** + * @MethodName getDictionaryByOl + * @Description: 查询在线 + * @param codeType + * @return: java.util.List + * @Author: Sum1Dream + * @Date: 2024/8/7 上午10:36 + */ + List getDictionaryByOl(String codeType); + /** * 获取数据字典 * @param codeType diff --git a/service/src/main/java/com/hfkj/service/impl/SecDictionaryServiceImpl.java b/service/src/main/java/com/hfkj/service/impl/SecDictionaryServiceImpl.java index d015640..1108e55 100644 --- a/service/src/main/java/com/hfkj/service/impl/SecDictionaryServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/impl/SecDictionaryServiceImpl.java @@ -8,6 +8,7 @@ import com.hfkj.service.SecDictionaryService; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.util.Collections; import java.util.List; import java.util.stream.Collectors; @@ -44,6 +45,14 @@ public class SecDictionaryServiceImpl implements SecDictionaryService { return getDictionary().stream().filter(o -> o.getCodeType().equals(codeType)).collect(Collectors.toList()); } + @Override + public List getDictionaryByOl(String codeType) { + SecDictionaryExample example = new SecDictionaryExample(); + example.createCriteria().andCodeTypeEqualTo(codeType); + example.or().andCodeTypeEqualTo(codeType); + return secDictionaryMapper.selectByExample(example); + } + @Override public SecDictionary getDictionary(String codeType, String codeValue) { List list = getDictionary().stream() diff --git a/service/src/main/java/com/hfkj/service/order/BsOrderChildService.java b/service/src/main/java/com/hfkj/service/order/BsOrderChildService.java index c075951..64eb61c 100644 --- a/service/src/main/java/com/hfkj/service/order/BsOrderChildService.java +++ b/service/src/main/java/com/hfkj/service/order/BsOrderChildService.java @@ -5,6 +5,7 @@ import com.hfkj.model.order.OrderChildModel; import com.hfkj.model.order.OrderModel; import java.util.List; +import java.util.Map; /** * @className: BsOrderChildService @@ -33,6 +34,16 @@ public interface BsOrderChildService { */ List getOrderChildListByOrderNo(String orderNo); + /** + * @MethodName getList + * @Description: 查询子订单 + * @param map + * @return: java.util.List + * @Author: Sum1Dream + * @Date: 2024/8/7 下午2:55 + */ + List getList(Map map); + /** * 获取未完成的子订单数量 * @param orderNo 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 b055c46..ea20595 100644 --- a/service/src/main/java/com/hfkj/service/order/OrderCreateService.java +++ b/service/src/main/java/com/hfkj/service/order/OrderCreateService.java @@ -381,7 +381,8 @@ public class OrderCreateService { // 子订单价格 BigDecimal childPrice = new BigDecimal(0); - + // 产品规格 + StringBuilder productSpecName = new StringBuilder(); // 筛选数据 for (Object orderItem : orderItems) { JSONObject orderItemObject = (JSONObject) orderItem; @@ -438,12 +439,13 @@ public class OrderCreateService { orderStarbucksService.create(bsOrderStarbucks); childPrice = childPrice.add(bsOrderStarbucks.getPrice().multiply(orderItemObject.getBigDecimal("num"))); + productSpecName.append(starbucks.getString("name")).append("*").append(orderItemObject.getInteger("num")).append("/"); } orderChild.setMerId(productConfig.getMerId()); orderChild.setProductName("星巴克"); orderChild.setProductCount(1); - orderChild.setProductSpecName("星巴克"); + orderChild.setProductSpecName(String.valueOf(productSpecName.toString())); // 星巴克创建订单 // 获取token diff --git a/service/src/main/java/com/hfkj/service/order/impl/BsOrderChildServiceImpl.java b/service/src/main/java/com/hfkj/service/order/impl/BsOrderChildServiceImpl.java index 33e1536..84ab6bd 100644 --- a/service/src/main/java/com/hfkj/service/order/impl/BsOrderChildServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/order/impl/BsOrderChildServiceImpl.java @@ -14,6 +14,8 @@ import com.hfkj.service.goods.impl.BsOrderStarbucksServiceImpl; import com.hfkj.service.order.BsOrderChildService; import com.hfkj.sysenum.order.OrderChildProductTypeEnum; import com.hfkj.sysenum.order.OrderChildStatusEnum; +import org.apache.commons.collections4.MapUtils; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -191,6 +193,47 @@ public class BsOrderChildServiceImpl implements BsOrderChildService { return orderChildModelList; } + @Override + public List getList(Map map) { + BsOrderChildExample example = new BsOrderChildExample(); + BsOrderChildExample.Criteria criteria = example.createCriteria(); + + if (MapUtils.getLong(map, "merId") != null) { + criteria.andMerIdEqualTo(MapUtils.getLong(map, "merId")); + } + + if (StringUtils.isNotBlank(MapUtils.getString(map, "orderNo"))) { + criteria.andOrderNoEqualTo(MapUtils.getString(map, "orderNo")); + } + if (StringUtils.isNotBlank(MapUtils.getString(map, "childOrderNo"))) { + criteria.andChildOrderNoEqualTo(MapUtils.getString(map, "childOrderNo")); + } + + if (StringUtils.isNotBlank(MapUtils.getString(map, "productSpecName"))) { + criteria.andProductSpecNameLike(MapUtils.getString(map, "productSpecName")); + } + if (MapUtils.getInteger(map, "productType") != null) { + criteria.andProductTypeEqualTo(MapUtils.getInteger(map, "productType")); + } + + if (StringUtils.isNotBlank(MapUtils.getString(map, "productName"))) { + criteria.andProductNameLike("%"+MapUtils.getString(map, "productName")+"%"); + } + + if (MapUtils.getLong(map, "createTimeS") != null) { + criteria.andCreateTimeGreaterThanOrEqualTo(new Date(MapUtils.getLong(map, "createTimeS"))); + } + if (MapUtils.getLong(map, "createTimeE") != null) { + criteria.andCreateTimeLessThan(new Date(MapUtils.getLong(map, "createTimeE"))); + } + if (MapUtils.getInteger(map, "status") != null) { + criteria.andStatusEqualTo(MapUtils.getInteger(map, "status")); + } + example.setOrderByClause("create_time desc"); + + return orderChildMapper.selectByExample(example); + } + @Override public long getUndoneChildOrder(String orderNo) { BsOrderChildExample example = new BsOrderChildExample(); diff --git a/service/src/main/java/com/hfkj/service/order/impl/BsOrderServiceImpl.java b/service/src/main/java/com/hfkj/service/order/impl/BsOrderServiceImpl.java index 6a260f5..3139569 100644 --- a/service/src/main/java/com/hfkj/service/order/impl/BsOrderServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/order/impl/BsOrderServiceImpl.java @@ -340,9 +340,11 @@ public class BsOrderServiceImpl implements BsOrderService { deduction.setCouponDiscountPrice(discount.getPrice()); // 卡卷类型 1:满减 2:抵扣 3:折扣 if (1 == discount.getType()) { - if (discount.getCondition().compareTo(order.getProductTotalPrice()) < 0) { + + if (order.getProductTotalPrice().compareTo(discount.getCondition()) < 0) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未满足优惠券满减条件"); } + deduction.setCouponDiscountActualPrice(discount.getPrice()); } else if (2 == discount.getType()) { deduction.setCouponDiscountActualPrice(discount.getPrice());