| | |
| | | import com.jpay.weixin.api.WxPayApi; |
| | | import com.ruoyi.common.core.constant.SecurityConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.enums.AuctionOrderTypeEnum; |
| | | import com.ruoyi.common.core.enums.BondStatusEnum; |
| | | import com.ruoyi.common.core.enums.OrderFromEnum; |
| | | import com.ruoyi.common.core.enums.OrderStatusEnum; |
| | | import com.ruoyi.common.core.enums.PaymentMethodEnum; |
| | | import com.ruoyi.common.core.enums.PointStatusEnum; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.order.domain.Paylog; |
| | | import com.ruoyi.order.mapper.OrderAuctionBondMapper; |
| | |
| | | import com.ruoyi.order.mapper.PaylogMapper; |
| | | import com.ruoyi.order.service.IPaylogService; |
| | | import com.ruoyi.order.util.MD5AndKL; |
| | | import com.ruoyi.order.util.OrderUtil; |
| | | import com.ruoyi.order.util.SinataUtil; |
| | | import com.ruoyi.order.util.alipay.config.AlipayConfig; |
| | | import com.ruoyi.order.util.alipay.util.PayDemoActivity; |
| | | import com.ruoyi.order.util.tencent.common.Configure; |
| | | import com.ruoyi.order.util.tencent.common.XMLParser; |
| | | import com.ruoyi.system.api.domain.AuctionBondJl; |
| | | import com.ruoyi.system.api.domain.GoodsGroupPurchase; |
| | | import com.ruoyi.system.api.domain.GoodsGroupPurchaseInfo; |
| | | import com.ruoyi.system.api.domain.GoodsSeckill; |
| | | import com.ruoyi.system.api.domain.GoodsSku; |
| | | import com.ruoyi.system.api.domain.Member; |
| | | import com.ruoyi.system.api.domain.Order; |
| | |
| | | |
| | | |
| | | @Resource |
| | | private OrderMapper OrderMapper; |
| | | private OrderMapper orderMapper; |
| | | @Resource |
| | | private AuctionClient auctionClient; |
| | | |
| | |
| | | Double price = 0.0; |
| | | String subject; |
| | | String body; |
| | | try { |
| | | if(judgeContainsStr(orderNO)){ |
| | | if (orderNO.contains("BO")) { |
| | | LambdaQueryWrapper<OrderAuctionBond> wrapper1= Wrappers.lambdaQuery(); |
| | | wrapper1.eq(OrderAuctionBond::getOrderNo,orderNO); |
| | | wrapper1.eq(OrderAuctionBond::getDelFlag,0); |
| | | OrderAuctionBond one1 = orderAuctionBondMapper.selectOne(wrapper1); |
| | | if (one1.getBond()==null||one1.getBond().compareTo(new BigDecimal(0))==0){ |
| | | one1.setBoundStatus(BondStatusEnum.PAID); |
| | | Map<String, Object> returnMap = new HashMap<>(); |
| | | // Type 1是否需要支付 |
| | | returnMap.put("Type",1); |
| | | return R.ok(returnMap); |
| | | } |
| | | |
| | | |
| | | }else{ |
| | | LambdaQueryWrapper<Order> wrapper1= Wrappers.lambdaQuery(); |
| | | wrapper1.eq(Order::getOrderNo,orderNO); |
| | | wrapper1.eq(Order::getDelFlag,0); |
| | | Order page1 = OrderMapper.selectOne(wrapper1); |
| | | // 判断商品库存 |
| | | Long goodsSkuId = page1.getGoodsSkuId(); |
| | | OrderFromEnum orderFrom = page1.getOrderFrom(); |
| | | switch (orderFrom) { |
| | | case COMMODITY_ORDER: |
| | | GoodsSku goods = goodsSkuClient.getGoodsSkuOne(goodsSkuId, |
| | | SecurityConstants.INNER).getData(); |
| | | if (Objects.isNull(goods)) { |
| | | throw new ServiceException("该商品已下架"); |
| | | } |
| | | if (goods.getStock() <= 0) { |
| | | throw new ServiceException("该商品已售罄"); |
| | | } |
| | | if (goods.getStock() < page1.getGoodsQuantity()) { |
| | | throw new ServiceException("该商品库存不足"); |
| | | } |
| | | break; |
| | | case SNAP_ORDERS: |
| | | GoodsSeckill data = goodsSkuClient.getGoodsSeckillOne(goodsSkuId, |
| | | SecurityConstants.INNER).getData(); |
| | | if (Objects.isNull(data)) { |
| | | throw new ServiceException("该商品已下架"); |
| | | } |
| | | if (data.getSeckillStock() <= 0) { |
| | | throw new ServiceException("该商品已售罄"); |
| | | } |
| | | if (data.getSeckillStock() < page1.getGoodsQuantity()) { |
| | | throw new ServiceException("该商品库存不足"); |
| | | } |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | if (page1.getTotalAmount().compareTo(new BigDecimal(0))==0){ |
| | | Map<String, Object> returnMap = new HashMap<>(); |
| | | returnMap.put("Type",1); |
| | | return R.ok(returnMap); |
| | | } |
| | | if (page1.getPoints()!=0){ |
| | | MemberPointsDTO memberPointsDTO=new MemberPointsDTO(); |
| | | memberPointsDTO.setMemberId(page1.getMemberId()); |
| | | memberPointsDTO.setPointsType(1); |
| | | memberPointsDTO.setPointsStatus(PointStatusEnum.INCREASE); |
| | | memberPointsDTO.setPoints(page1.getPoints()); |
| | | memberClient.addMemberPoints(memberPointsDTO); |
| | | } |
| | | |
| | | updMembeOneDTO MembeOneDTO=new updMembeOneDTO(); |
| | | MembeOneDTO.setType(1); |
| | | MembeOneDTO.setMemberId(page1.getMemberId()); |
| | | MembeOneDTO.setMoney(page1.getTotalAmount()); |
| | | MembeOneDTO.setTotalPoints(page1.getPoints()); |
| | | memberClient.updMembeOne(MembeOneDTO, SecurityConstants.INNER); |
| | | if (judgeContainsStr(orderNO)) { |
| | | if (orderNO.contains("BO")) { |
| | | LambdaQueryWrapper<OrderAuctionBond> wrapper1 = Wrappers.lambdaQuery(); |
| | | wrapper1.eq(OrderAuctionBond::getOrderNo, orderNO); |
| | | wrapper1.eq(OrderAuctionBond::getDelFlag, 0); |
| | | OrderAuctionBond one1 = orderAuctionBondMapper.selectOne(wrapper1); |
| | | if (one1.getBond() == null || one1.getBond().compareTo(new BigDecimal(0)) == 0) { |
| | | one1.setBoundStatus(BondStatusEnum.PAID); |
| | | Map<String, Object> returnMap = new HashMap<>(); |
| | | // Type 1是否需要支付 |
| | | returnMap.put("Type", 1); |
| | | return R.ok(returnMap); |
| | | } |
| | | |
| | | |
| | | |
| | | if (orderNO.contains("BO")) { |
| | | LambdaQueryWrapper<OrderAuctionBond> wrapper1= Wrappers.lambdaQuery(); |
| | | wrapper1.eq(OrderAuctionBond::getOrderNo,orderNO); |
| | | wrapper1.eq(OrderAuctionBond::getDelFlag,0); |
| | | OrderAuctionBond one = orderAuctionBondMapper.selectOne(wrapper1); |
| | | price=one.getBond().doubleValue(); |
| | | body = " 订单支付"; |
| | | subject = " 订单支付"; |
| | | if (type == 1) { |
| | | // 支付宝预下单 |
| | | return this.alipay(zfbOpenid, orderNO, subject, body, price, request); |
| | | } if (type == 2){ |
| | | // 微信预下单 |
| | | return this.wxpay(2 ,orderNO, body, openId, price, request); |
| | | } else { |
| | | LambdaQueryWrapper<Order> wrapper1 = Wrappers.lambdaQuery(); |
| | | wrapper1.eq(Order::getOrderNo, orderNO); |
| | | wrapper1.eq(Order::getDelFlag, 0); |
| | | Order page1 = orderMapper.selectOne(wrapper1); |
| | | if (page1.getTotalAmount().compareTo(new BigDecimal(0)) == 0) { |
| | | Map<String, Object> returnMap = new HashMap<>(); |
| | | returnMap.put("Type", 1); |
| | | page1.setOrderStatus(OrderStatusEnum.TO_BE_SHIPPED); |
| | | page1.setPaymentMethod(paymentMethodEnum); |
| | | page1.setPayTime(LocalDateTime.now()); |
| | | orderMapper.updateById(page1); |
| | | if (page1.getOrderNo().contains("SP")) { |
| | | GoodsSku goodsSku = new GoodsSku(); |
| | | goodsSku.setId(page1.getGoodsSkuId()); |
| | | goodsSku.setSoldQuantity(page1.getGoodsQuantity()); |
| | | goodsSkuClient.updGoods(goodsSku, SecurityConstants.INNER); |
| | | } |
| | | }else{ |
| | | LambdaQueryWrapper<Order> wrapper1= Wrappers.lambdaQuery(); |
| | | wrapper1.eq(Order::getOrderNo,orderNO); |
| | | wrapper1.eq(Order::getDelFlag,0); |
| | | Order page1 = OrderMapper.selectOne(wrapper1); |
| | | price=page1.getTotalAmount().doubleValue(); |
| | | body = " 订单支付"; |
| | | subject = " 订单支付"; |
| | | Map<String, Object> map = new HashMap<String, Object>(); |
| | | if (type == 1) { |
| | | // 支付宝预下单 |
| | | return this.alipay(zfbOpenid, orderNO, subject, body, price, request); |
| | | } if (type == 2) { |
| | | // 微信预下单 |
| | | return this.wxpay(2, orderNO, body,openId, price, request); |
| | | } |
| | | |
| | | return R.ok(returnMap); |
| | | } |
| | | if (page1.getPoints() != 0) { |
| | | MemberPointsDTO memberPointsDTO = new MemberPointsDTO(); |
| | | memberPointsDTO.setMemberId(page1.getMemberId()); |
| | | memberPointsDTO.setPointsType(1); |
| | | memberPointsDTO.setPointsStatus(PointStatusEnum.INCREASE); |
| | | memberPointsDTO.setPoints(page1.getPoints()); |
| | | memberClient.addMemberPoints(memberPointsDTO); |
| | | } |
| | | |
| | | updMembeOneDTO MembeOneDTO = new updMembeOneDTO(); |
| | | MembeOneDTO.setType(1); |
| | | MembeOneDTO.setMemberId(page1.getMemberId()); |
| | | MembeOneDTO.setMoney(page1.getTotalAmount()); |
| | | MembeOneDTO.setTotalPoints(page1.getPoints()); |
| | | memberClient.updMembeOne(MembeOneDTO, SecurityConstants.INNER); |
| | | } |
| | | } catch (Exception e) { |
| | | log.info("获取异常", e); |
| | | |
| | | if (orderNO.contains("BO")) { |
| | | LambdaQueryWrapper<OrderAuctionBond> wrapper1 = Wrappers.lambdaQuery(); |
| | | wrapper1.eq(OrderAuctionBond::getOrderNo, orderNO); |
| | | wrapper1.eq(OrderAuctionBond::getDelFlag, 0); |
| | | OrderAuctionBond one = orderAuctionBondMapper.selectOne(wrapper1); |
| | | price = one.getBond().doubleValue(); |
| | | body = " 订单支付"; |
| | | subject = " 订单支付"; |
| | | if (type == 1) { |
| | | // 支付宝预下单 |
| | | return this.alipay(zfbOpenid, orderNO, subject, body, price, request); |
| | | } |
| | | if (type == 2) { |
| | | // 微信预下单 |
| | | R<Map<String, Object>> wxpayR = this.wxpay(2, orderNO, body, openId, price, |
| | | request); |
| | | Map<String, Object> wxpay = wxpayR.getData(); |
| | | if (wxpay.get( |
| | | "result_code").equals("FAIL") && wxpay.get("err_code_des") |
| | | .equals("201 商户订单号重复")) { |
| | | one.setOrderNo(OrderUtil.getOrderNoForPrefix("BO")); |
| | | orderAuctionBondMapper.updateById(one); |
| | | wxpayR = this.wxpay(2, one.getOrderNo(), body, openId, price, |
| | | request); |
| | | } |
| | | return wxpayR; |
| | | } |
| | | } else { |
| | | LambdaQueryWrapper<Order> wrapper1 = Wrappers.lambdaQuery(); |
| | | wrapper1.eq(Order::getOrderNo, orderNO); |
| | | wrapper1.eq(Order::getDelFlag, 0); |
| | | Order page1 = orderMapper.selectOne(wrapper1); |
| | | price = page1.getTotalAmount().doubleValue(); |
| | | body = " 订单支付"; |
| | | subject = " 订单支付"; |
| | | Map<String, Object> map = new HashMap<String, Object>(); |
| | | if (type == 1) { |
| | | // 支付宝预下单 |
| | | return this.alipay(zfbOpenid, orderNO, subject, body, price, request); |
| | | } |
| | | if (type == 2) { |
| | | // 微信预下单 |
| | | R<Map<String, Object>> wxpayR = this.wxpay(2, orderNO, body, openId, price, |
| | | request); |
| | | Map<String, Object> wxpay = wxpayR.getData(); |
| | | if (wxpay.get("result_code").equals("FAIL") && wxpay.get("err_code_des") |
| | | .equals("201 商户订单号重复")) { |
| | | String prefix = page1.getOrderNo().substring(0, 2); |
| | | page1.setOrderNo(OrderUtil.getOrderNoForPrefix(prefix)); |
| | | orderMapper.updateById(page1); |
| | | wxpayR = this.wxpay(2, page1.getOrderNo(), body, openId, price, |
| | | request); |
| | | } |
| | | return wxpayR; |
| | | } |
| | | } |
| | | } |
| | | return R.fail("获取异常"); |
| | | } |
| | |
| | | wrapper1.eq(OrderAuctionBond::getDelFlag,0); |
| | | OrderAuctionBond one1 = orderAuctionBondMapper.selectOne(wrapper1); |
| | | |
| | | if (one1.getOrderTimeSx().isAfter(LocalDateTime.now())){ |
| | | if (one1.getBondType().equals(AuctionOrderTypeEnum.REGULAR_ITEMS) && |
| | | one1.getOrderTimeSx().isBefore(LocalDateTime.now())) { |
| | | boolean bo = refundForAlipay(paylog1.getOutTradeNo(), paylog1.getTradeNo(), paylog1.getPayMoney()); |
| | | } |
| | | |
| | | |
| | | one1.setBoundStatus(BondStatusEnum.PAID); |
| | | orderAuctionBondMapper.updateById(one1); |
| | | |
| | | |
| | | AuctionOrderTypeEnum bondType = one1.getBondType(); |
| | | AuctionBondJl auctionBondJl = null; |
| | | if (bondType.equals(AuctionOrderTypeEnum.AUCTION_ITEMS)) { |
| | | auctionBondJl = auctionClient.getAuctionBondJLByTargetId( |
| | | one1.getAuctionSalesroomId(), one1.getMemberId(), |
| | | bondType.getCode(), SecurityConstants.INNER) |
| | | .getData(); |
| | | log.info("保证金支付回调,添加拍卖参与记录开始进行"); |
| | | if (Objects.isNull(auctionBondJl)) { |
| | | auctionBondJl = new AuctionBondJl(); |
| | | auctionBondJl.setAuctionSalesroomId( |
| | | one1.getAuctionSalesroomId()); |
| | | auctionBondJl.setIsState(0); |
| | | auctionBondJl.setBondType(bondType.getCode()); |
| | | auctionBondJl.setMemberId( |
| | | one1.getMemberId()); |
| | | } else { |
| | | auctionBondJl.setIsState(0); |
| | | } |
| | | } else { |
| | | auctionBondJl = auctionClient.getAuctionBondJLByTargetId( |
| | | one1.getAuctionGoodsId(), one1.getMemberId(), |
| | | bondType.getCode(), SecurityConstants.INNER) |
| | | .getData(); |
| | | if (Objects.isNull(auctionBondJl)) { |
| | | auctionBondJl = new AuctionBondJl(); |
| | | auctionBondJl.setAuctionGoodsId(one1.getAuctionGoodsId()); |
| | | auctionBondJl.setIsState(0); |
| | | auctionBondJl.setBondType(bondType.getCode()); |
| | | auctionBondJl.setMemberId( |
| | | one1.getMemberId()); |
| | | } else { |
| | | auctionBondJl.setIsState(0); |
| | | } |
| | | } |
| | | auctionClient.saveOrUpdateAuctionBondJl(auctionBondJl, |
| | | SecurityConstants.INNER); |
| | | log.info("保证金支付回调,添加拍卖参与记录结束"); |
| | | }else{ |
| | | LambdaQueryWrapper<Order> wrapper1= Wrappers.lambdaQuery(); |
| | | wrapper1.eq(Order::getOrderNo,paylog1.getOutTradeNo()); |
| | | wrapper1.eq(Order::getDelFlag,0); |
| | | Order page1 = OrderMapper.selectOne(wrapper1); |
| | | Order page1 = orderMapper.selectOne(wrapper1); |
| | | |
| | | page1.setOrderStatus(OrderStatusEnum.TO_BE_SHIPPED); |
| | | page1.setPaymentMethod(PaymentMethodEnum.ALIPAY); |
| | | page1.setPayTime(LocalDateTime.now()); |
| | | orderMapper.updateById(page1); |
| | | if(page1.getOrderNo().contains("SP")){ |
| | | GoodsSku goodsSku =new GoodsSku(); |
| | | goodsSku.setId(page1.getGoodsSkuId()); |
| | |
| | | } |
| | | |
| | | if(page1.getOrderNo().contains("TG")){ |
| | | log.info( |
| | | "===================================开始处理团购回调==================================="); |
| | | GoodsGroupPurchase goodsSeckiGoodsGroupPurchaseOne = goodsSkuClient.getGoodsSeckiGoodsGroupPurchaseOne(page1.getGoodsSkuId(), SecurityConstants.INNER).getData(); |
| | | GoodsGroupPurchaseInfo goodsSeckiGoodsGroupPurchaseInfo = goodsSkuClient.getGoodsSeckiGoodsGroupPurchaseInfo(page1.getGoodsSkuId(), SecurityConstants.INNER).getData(); |
| | | if (goodsSeckiGoodsGroupPurchaseInfo!=null){ |
| | | log.info("==================已有待成团团购================"); |
| | | page1.setGroupNo(goodsSeckiGoodsGroupPurchaseInfo.getMubre()); |
| | | OrderMapper.updateById(page1); |
| | | orderMapper.updateById(page1); |
| | | Integer i= goodsSeckiGoodsGroupPurchaseInfo.getPurchaseNum()+page1.getGoodsQuantity(); |
| | | goodsSeckiGoodsGroupPurchaseInfo.setPurchaseNum(i); |
| | | goodsSkuClient.updgoodsGroupPurchaseInfo(goodsSeckiGoodsGroupPurchaseInfo, SecurityConstants.INNER); |
| | | |
| | | }else{ |
| | | log.info("==================开启一个新团================"); |
| | | UUID uuid = UUID.randomUUID(); |
| | | page1.setGroupNo(uuid.toString()); |
| | | OrderMapper.updateById(page1); |
| | | orderMapper.updateById(page1); |
| | | GoodsGroupPurchaseInfo goodsGroupPurchaseInfo=new GoodsGroupPurchaseInfo(); |
| | | goodsGroupPurchaseInfo.setGroupSize(goodsSeckiGoodsGroupPurchaseOne.getGroupSize()); |
| | | goodsGroupPurchaseInfo.setCurrentNumber(1); |
| | |
| | | |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | wrapper1.eq(OrderAuctionBond::getOrderNo,paylog.getOutTradeNo()); |
| | | wrapper1.eq(OrderAuctionBond::getDelFlag,0); |
| | | OrderAuctionBond one1 = orderAuctionBondMapper.selectOne(wrapper1); |
| | | if (one1.getOrderTimeSx().isAfter(LocalDateTime.now())){ |
| | | if (one1.getBondType().equals(AuctionOrderTypeEnum.REGULAR_ITEMS) |
| | | && one1.getOrderTimeSx().isBefore(LocalDateTime.now())) { |
| | | String refundMoney = SinataUtil.doubleRetainTwo(paylog.getPayMoney() * 100d); |
| | | Integer refundFee = Integer.parseInt(refundMoney.substring(0, refundMoney.length() - 3)); |
| | | String money = SinataUtil.doubleRetainTwo(paylog.getPayMoney() * 100d); |
| | |
| | | one1.setBoundStatus(BondStatusEnum.PAID); |
| | | one1.setPaymentMethod(PaymentMethodEnum.WECHAT); |
| | | orderAuctionBondMapper.updateById(one1); |
| | | |
| | | AuctionOrderTypeEnum bondType = one1.getBondType(); |
| | | AuctionBondJl auctionBondJl = null; |
| | | if (bondType.equals(AuctionOrderTypeEnum.AUCTION_ITEMS)) { |
| | | auctionBondJl = auctionClient.getAuctionBondJLByTargetId( |
| | | one1.getAuctionSalesroomId(), one1.getMemberId(), |
| | | bondType.getCode(), SecurityConstants.INNER) |
| | | .getData(); |
| | | log.info("保证金支付回调,添加拍卖参与记录开始进行"); |
| | | if (Objects.isNull(auctionBondJl)) { |
| | | auctionBondJl = new AuctionBondJl(); |
| | | auctionBondJl.setAuctionSalesroomId( |
| | | one1.getAuctionSalesroomId()); |
| | | auctionBondJl.setIsState(0); |
| | | auctionBondJl.setBondType(bondType.getCode()); |
| | | auctionBondJl.setMemberId( |
| | | one1.getMemberId()); |
| | | } else { |
| | | auctionBondJl.setIsState(0); |
| | | } |
| | | } else { |
| | | auctionBondJl = auctionClient.getAuctionBondJLByTargetId( |
| | | one1.getAuctionGoodsId(), one1.getMemberId(), |
| | | bondType.getCode(), SecurityConstants.INNER) |
| | | .getData(); |
| | | if (Objects.isNull(auctionBondJl)) { |
| | | auctionBondJl = new AuctionBondJl(); |
| | | auctionBondJl.setAuctionGoodsId(one1.getAuctionGoodsId()); |
| | | auctionBondJl.setIsState(0); |
| | | auctionBondJl.setBondType(bondType.getCode()); |
| | | auctionBondJl.setMemberId( |
| | | one1.getMemberId()); |
| | | } else { |
| | | auctionBondJl.setIsState(0); |
| | | } |
| | | } |
| | | auctionClient.saveOrUpdateAuctionBondJl(auctionBondJl, |
| | | SecurityConstants.INNER); |
| | | log.info("保证金支付回调,添加拍卖参与记录结束"); |
| | | }else{ |
| | | LambdaQueryWrapper<Order> wrapper1= Wrappers.lambdaQuery(); |
| | | wrapper1.eq(Order::getOrderNo,paylog.getOutTradeNo()); |
| | | wrapper1.eq(Order::getDelFlag,0); |
| | | Order page1 = OrderMapper.selectOne(wrapper1); |
| | | Order page1 = orderMapper.selectOne(wrapper1); |
| | | page1.setOrderStatus(OrderStatusEnum.TO_BE_SHIPPED); |
| | | page1.setPaymentMethod(PaymentMethodEnum.WECHAT); |
| | | page1.setPayTime(LocalDateTime.now()); |
| | | |
| | | orderMapper.updateById(page1); |
| | | |
| | | if(page1.getOrderNo().contains("SP")){ |
| | | GoodsSku goodsSku =new GoodsSku(); |
| | |
| | | goodsSkuClient.updGoodsSeckill1(goodsSku, SecurityConstants.INNER); |
| | | } |
| | | if(page1.getOrderNo().contains("TG")){ |
| | | log.info( |
| | | "===================================开始处理团购回调==================================="); |
| | | GoodsGroupPurchase goodsSeckiGoodsGroupPurchaseOne = goodsSkuClient.getGoodsSeckiGoodsGroupPurchaseOne(page1.getGoodsSkuId(), SecurityConstants.INNER).getData(); |
| | | GoodsGroupPurchaseInfo goodsSeckiGoodsGroupPurchaseInfo = goodsSkuClient.getGoodsSeckiGoodsGroupPurchaseInfo(page1.getGoodsSkuId(), SecurityConstants.INNER).getData(); |
| | | if (goodsSeckiGoodsGroupPurchaseInfo!=null){ |
| | | log.info("==================已有待成团团购================"); |
| | | page1.setGroupNo(goodsSeckiGoodsGroupPurchaseInfo.getMubre()); |
| | | OrderMapper.updateById(page1); |
| | | orderMapper.updateById(page1); |
| | | Integer i= goodsSeckiGoodsGroupPurchaseInfo.getPurchaseNum()+page1.getGoodsQuantity(); |
| | | goodsSeckiGoodsGroupPurchaseInfo.setPurchaseNum(i); |
| | | goodsSkuClient.updgoodsGroupPurchaseInfo(goodsSeckiGoodsGroupPurchaseInfo, SecurityConstants.INNER); |
| | | |
| | | }else{ |
| | | log.info("==================开启一个新团================"); |
| | | UUID uuid = UUID.randomUUID(); |
| | | page1.setGroupNo(uuid.toString()); |
| | | OrderMapper.updateById(page1); |
| | | orderMapper.updateById(page1); |
| | | GoodsGroupPurchaseInfo goodsGroupPurchaseInfo=new GoodsGroupPurchaseInfo(); |
| | | goodsGroupPurchaseInfo.setGroupSize(goodsSeckiGoodsGroupPurchaseOne.getGroupSize()); |
| | | goodsGroupPurchaseInfo.setCurrentNumber(1); |
| | |
| | | |
| | | String money=SinataUtil.doubleRetainTwo(price*100d); |
| | | Integer price1 = Integer.parseInt(money.substring(0,money.length()-3)); |
| | | log.info( |
| | | "============================>WxpayController.createOrder__price1:\n" + price1); |
| | | paraMap.put("total_fee", price1.toString()); |
| | | //设置请求参数(通知地址) |
| | | paraMap.put("notify_url", Configure.wx_notify_url); |
| | |
| | | String sign = PaymentKit.createSign(paraMap, "HSCEWrfSYiwxR6sesZ6De91Xh3m447sh"); |
| | | paraMap.put("sign", sign); |
| | | //统一下单,向微信api发送数据 |
| | | log.info( |
| | | "============================>WxpayController.paraMap:\n" + paraMap); |
| | | //转成xml |
| | | String xmlResult = WxPayApi.pushOrder(false, paraMap); |
| | | Map<String, String> map = PaymentKit.xmlToMap(xmlResult); |
| | | log.info( |
| | | "============================>WxpayController.map:\n" + map); |
| | | //返回状态码 |
| | | String returnCode = map.get("return_code"); |
| | | /* Assert.isTrue("SUCCESS".equals(returnCode), getMsgByCode(returnCode));*/ |
| | |
| | | |
| | | returnMap.put("sign", signature); |
| | | returnMap.put("Type",2); |
| | | returnMap.put("result_code", map.get("result_code")); |
| | | returnMap.put("err_code_des", map.get("err_code_des")); |
| | | // 对获取预支付返回接口参数进行封装(生成支付订单接口数据) |
| | | return R.ok(returnMap); |
| | |
| | | */ |
| | | @Override |
| | | public Map<String, Object> refund(List<RefundDTO> refundDTOS) { |
| | | log.info("开始退款,入参:{}", refundDTOS); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | Set<String> orderNoList = refundDTOS.stream().map(RefundDTO::getOrderNo) |
| | | .collect(Collectors.toSet()); |
| | | if (StringUtils.isNotEmpty(orderNoList)) { |
| | | if (StringUtils.isNotEmpty(refundDTOS)) { |
| | | Set<String> orderNoList = refundDTOS.stream().map(RefundDTO::getOrderNo) |
| | | .collect(Collectors.toSet()); |
| | | Map<String, Paylog> paylogMap = this.lambdaQuery() |
| | | .in(Paylog::getOutTradeNo, orderNoList).eq(Paylog::getState, 1).list().stream() |
| | | .collect(Collectors.toMap(Paylog::getOutTradeNo, Function.identity())); |