From fba9e3334d3c2cc7f6dd39ea45c9f0fd4bc751a9 Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Tue, 11 Oct 2022 16:20:31 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bweb/controller/HighOrderController.java | 33 ++++++++++++++++--- .../java/com/hai/dao/HighOrderMapperExt.java | 1 + .../com/hai/service/HighCouponService.java | 7 ++++ .../service/impl/HighCouponServiceImpl.java | 18 +++++++++- 4 files changed, 54 insertions(+), 5 deletions(-) diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighOrderController.java b/hai-bweb/src/main/java/com/bweb/controller/HighOrderController.java index ff65f7b2..3fdc934b 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighOrderController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighOrderController.java @@ -21,11 +21,9 @@ import com.hai.entity.HighOrder; import com.hai.entity.HighTyAgent; import com.hai.entity.HighTySalesman; import com.hai.entity.OutRechargeOrder; +import com.hai.enum_type.UserObjectTypeEnum; import com.hai.model.*; -import com.hai.service.HighCouponCodeService; -import com.hai.service.HighOrderService; -import com.hai.service.HighTyAgentService; -import com.hai.service.HighTySalesmanService; +import com.hai.service.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.commons.collections4.MapUtils; @@ -59,6 +57,9 @@ public class HighOrderController { @Resource private HighOrderService highOrderService; + @Resource + private HighCouponService couponService; + @Resource private HighCouponCodeService highCouponCodeService; @@ -133,7 +134,20 @@ public class HighOrderController { HttpServletRequest request) { try { + UserInfoModel userInfoModel = userCenter.getSessionModel(UserInfoModel.class); + if (userInfoModel == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, ""); + } + Map map = new HashMap<>(); + if (userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type0.getType())) { + + } else if (userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type1.getType())) { + map.put("goodsId", couponService.getCouponIdsByCompanyId(userInfoModel.getBsCompany().getId())); + } else { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, ""); + } + map.put("orderNo", orderNo); map.put("memPhone", memPhone); map.put("couponName", couponName); @@ -172,7 +186,18 @@ public class HighOrderController { HttpServletRequest request) { try { + UserInfoModel userInfoModel = userCenter.getSessionModel(UserInfoModel.class); + if (userInfoModel == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, ""); + } Map map = new HashMap<>(); + if (userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type0.getType())) { + + } else if (userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type1.getType())) { + map.put("goodsId", couponService.getCouponIdsByCompanyId(userInfoModel.getBsCompany().getId())); + } else { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, ""); + } map.put("orderNo", orderNo); map.put("memPhone", memPhone); map.put("couponName", couponName); diff --git a/hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java b/hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java index a84dbefe..55812db2 100644 --- a/hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java +++ b/hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java @@ -1320,6 +1320,7 @@ public interface HighOrderMapperExt { " from high_child_order a" + " LEFT JOIN high_order b on b.id = a.order_id" + " where a.goods_type = 1" + + " and a.goods_id in (${param.goodsId}) " + " and b.order_no like concat('%', #{param.orderNo}, '%') " + " and b.mem_phone like concat('%', #{param.memPhone}, '%') " + " and a.goods_name like concat('%', #{param.couponName}, '%') " + diff --git a/hai-service/src/main/java/com/hai/service/HighCouponService.java b/hai-service/src/main/java/com/hai/service/HighCouponService.java index 30e00092..eb600d39 100644 --- a/hai-service/src/main/java/com/hai/service/HighCouponService.java +++ b/hai-service/src/main/java/com/hai/service/HighCouponService.java @@ -129,6 +129,13 @@ public interface HighCouponService { **/ Long getCouponByCouponName(Long companyId,String couponName); + /** + * 拼接卡券id + * @param companyId + * @return + */ + String getCouponIdsByCompanyId(Long companyId); + /** * @Author 胡锐 * @Description 根据商户 查询处于已上架的卡卷 diff --git a/hai-service/src/main/java/com/hai/service/impl/HighCouponServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighCouponServiceImpl.java index 86801db0..615799ca 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighCouponServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighCouponServiceImpl.java @@ -437,7 +437,7 @@ public class HighCouponServiceImpl implements HighCouponService { criteria.andCouponSourceNotEqualTo(MapUtils.getInteger(map, "notCouponSource")); } - example.setOrderByClause("create_time"); + example.setOrderByClause("create_time desc"); List coupons = highCouponMapper.selectByExample(example); if (coupons != null && coupons.size() > 0) { for (HighCoupon highCoupon : coupons) { @@ -509,6 +509,22 @@ public class HighCouponServiceImpl implements HighCouponService { return highCouponMapper.countByExample(example); } + @Override + public String getCouponIdsByCompanyId(Long companyId) { + HighCouponExample example = new HighCouponExample(); + example.createCriteria().andCompanyIdEqualTo(companyId); + List list = highCouponMapper.selectByExample(example); + String str = null; + for (HighCoupon coupon : list) { + if (StringUtils.isBlank(str)) { + str = coupon.getId().toString(); + } else { + str += ","+coupon.getId(); + } + } + return str; + } + @Override public List getCouponListByMerchant(Long merchantId) { HighCouponExample example = new HighCouponExample();