| @@ -140,7 +140,8 @@ public class WxOrderController extends BaseController { | |||
| } | |||
| return wxOrderService.composeSaveOrder(false,EnumComposeOrder.ONE_NUMBER_ORDER_BATCH,orderSaveDto,memberId,getPayWay(),getTenantInfo(),this.getPayVersion()); | |||
| } | |||
| @TenantIgnore | |||
| @ApiOperation(value = "单个券单个订单,卡(分账导致无法批量下单)、拼团,砍价用", notes = "{\"couponChannelId\":\"String\",\"couponId\":\"String\",\"press\":\"String\",\"orderGroupId\":\"String\",\"formId\":\"String\"}") | |||
| @PostMapping("save") | |||
| public ResultData saveOrder(@RequestBody OrderSaveDto orderSaveDto) { | |||
| @@ -290,5 +290,14 @@ public interface WxCouponService { | |||
| void setParentCouponMallMerchants(TenantEntity mallTenantEntity,WxCoupon wxCoupon) throws Exception; | |||
| Map<Long,Boolean> couponMerchantAutoShare(TenantEntity tenantEntity,WxCoupon wxCoupon) throws Exception; | |||
| Map<Long,Boolean> couponMerchantAutoShare(TenantEntity tenantEntity,WxCoupon wxCoupon) throws Exception; | |||
| /** | |||
| * 判断门店商户是否可用 | |||
| * @param couponId | |||
| * @param couponType | |||
| * @param couponTenantEntity | |||
| * @return | |||
| */ | |||
| boolean isCouponMerchantValid(Long couponId,Integer couponType,TenantEntity couponTenantEntity); | |||
| } | |||
| @@ -596,44 +596,6 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { | |||
| } | |||
| return retList; | |||
| } | |||
| private boolean isCouponMerchantValid(Long couponId,Integer couponType,TenantEntity couponTenantEntity) { | |||
| if (EnumCouponType.isParentCoupon(couponType)) { | |||
| WxCouponMall couponMall = new WxCouponMall(); | |||
| couponMall.updateTenantInfo(couponTenantEntity); | |||
| couponMall.setProductId(couponId); | |||
| couponMall.setStatus(EnumCouponMallStatus.FINISED.getCode()) ; | |||
| List<WxCouponMall> couponMallList = wxCouponMallMapper.findList(couponMall); | |||
| if (null == couponMallList ) { | |||
| return false; | |||
| } | |||
| for (int i = 0 ; i < couponMallList.size(); i++) { | |||
| WxCouponMall wcm = couponMallList.get(i); | |||
| TenantEntity mallTenantEntity = new TenantEntity(); | |||
| mallTenantEntity.setTenantId(wcm.getMallTenantId()); | |||
| mallTenantEntity.setParentTenantId(couponTenantEntity.getTenantId()); | |||
| List<WxMerchantVo> merchantVoList = wxMerchantService.findMerchantListByProduct(mallTenantEntity,couponId,false); | |||
| if (null != merchantVoList && merchantVoList.size() > 0 ) { | |||
| if (merchantVoList.stream().anyMatch((cm->cm.getMerchantStatus().equals(EnumMerchantStatus.VALID.getCode())))){ | |||
| return true; | |||
| } | |||
| } | |||
| } | |||
| return false; | |||
| }else { | |||
| List<WxMerchantVo> merchantVoList = wxMerchantService.findMerchantListByProduct(couponTenantEntity,couponId,false); | |||
| if (null == merchantVoList || merchantVoList.size() <=0 ) { | |||
| return false; | |||
| } | |||
| if (merchantVoList.stream().anyMatch((cm->cm.getMerchantStatus().equals(EnumMerchantStatus.VALID.getCode())))){ | |||
| return true; | |||
| } | |||
| } | |||
| return false; | |||
| } | |||
| @Override | |||
| public WxCouponChannelAddVo addCouponChannel(Long couponid,Integer channelId, TenantEntity tenantEntity,Date showBeginTime,Date beginTime,Date endTime,Integer channelPrice,Integer channelStock){ | |||
| @@ -684,7 +646,7 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { | |||
| } | |||
| if(!EnumCouponType.COUPON_GIFT.getCode().equals(wxCoupon.getType()) | |||
| && !isCouponMerchantValid(wxCoupon.getId(),wxCoupon.getType(),wxCoupon)) { | |||
| && !wxCouponService.isCouponMerchantValid(wxCoupon.getId(),wxCoupon.getType(),wxCoupon)) { | |||
| logger.debug(wxCoupon.getId()+couponid+ErrorCode.MERCHANT_INFO_NOT_FOUND.getMessage()); | |||
| vo.toCouponChannnelVo(wxCoupon,channelId); | |||
| vo.setErrorMsg(ErrorCode.MERCHANT_INFO_NOT_FOUND.getMessage()); | |||
| @@ -1684,6 +1684,43 @@ public class WxCouponServiceImpl implements WxCouponService { | |||
| } | |||
| } | |||
| } | |||
| @Override | |||
| public boolean isCouponMerchantValid(Long couponId, Integer couponType, TenantEntity couponTenantEntity) { | |||
| if (EnumCouponType.isParentCoupon(couponType)) { | |||
| WxCouponMall couponMall = new WxCouponMall(); | |||
| couponMall.updateTenantInfo(couponTenantEntity); | |||
| couponMall.setProductId(couponId); | |||
| couponMall.setStatus(EnumCouponMallStatus.FINISED.getCode()) ; | |||
| List<WxCouponMall> couponMallList = wxCouponMallMapper.findList(couponMall); | |||
| if (null == couponMallList ) { | |||
| return false; | |||
| } | |||
| for (int i = 0 ; i < couponMallList.size(); i++) { | |||
| WxCouponMall wcm = couponMallList.get(i); | |||
| TenantEntity mallTenantEntity = new TenantEntity(); | |||
| mallTenantEntity.setTenantId(wcm.getMallTenantId()); | |||
| mallTenantEntity.setParentTenantId(couponTenantEntity.getTenantId()); | |||
| List<WxMerchantVo> merchantVoList = wxMerchantService.findMerchantListByProduct(mallTenantEntity,couponId,false); | |||
| if (null != merchantVoList && merchantVoList.size() > 0 ) { | |||
| if (merchantVoList.stream().anyMatch((cm->cm.getMerchantStatus().equals(EnumMerchantStatus.VALID.getCode())))){ | |||
| return true; | |||
| } | |||
| } | |||
| } | |||
| return false; | |||
| }else { | |||
| List<WxMerchantVo> merchantVoList = wxMerchantService.findMerchantListByProduct(couponTenantEntity,couponId,false); | |||
| if (null == merchantVoList || merchantVoList.size() <=0 ) { | |||
| return false; | |||
| } | |||
| if (merchantVoList.stream().anyMatch((cm->cm.getMerchantStatus().equals(EnumMerchantStatus.VALID.getCode())))){ | |||
| return true; | |||
| } | |||
| } | |||
| return false; | |||
| } | |||
| } | |||
| @@ -3235,8 +3235,8 @@ public class WxOrderServiceImpl implements WxOrderService { | |||
| throw new MallinkException(ErrorCode.COUPON_IS_EMPTY.getCode(),premsg+"不存在"); | |||
| } | |||
| if (EnumCouponType.mustHasMerchant(coupon.getType())) { | |||
| // 检查券商户信息 | |||
| if (!isCouponMerchantValid(coupon.getId(),coupon)) { | |||
| // 检查券商户信息isCouponMerchantValid | |||
| if (!wxCouponService.isCouponMerchantValid(coupon.getId(),coupon.getType(),coupon)) { | |||
| throw new MallinkException(ErrorCode.MERCHANT_INFO_NOT_FOUND.getCode(),premsg+"商户信息没找到"); | |||
| } | |||
| } | |||