| | |
| | | import cc.mrbird.febs.mall.entity.*; |
| | | import cc.mrbird.febs.mall.mapper.*; |
| | | import cc.mrbird.febs.mall.service.*; |
| | | import cc.mrbird.febs.mall.vo.ApiShopApplyVo; |
| | | import cc.mrbird.febs.mall.vo.OrderDetailVo; |
| | | import cc.mrbird.febs.mall.vo.OrderListVo; |
| | | import cc.mrbird.febs.mall.vo.OrderRefundVo; |
| | |
| | | |
| | | private final MallMemberBankSignMapper mallMemberBankSignMapper; |
| | | private final MallMemberBankMapper mallMemberBankMapper; |
| | | private final MallShopApplyMapper mallShopApplyMapper; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | |
| | | |
| | | if (CollUtil.isEmpty(addOrderDto.getItems())) { |
| | | throw new FebsException("参数错误"); |
| | | } |
| | | |
| | | int deliverType = ObjectUtil.isEmpty(addOrderDto.getDeliverType()) ? 1 : addOrderDto.getDeliverType(); |
| | | if(2 == deliverType){ |
| | | if(ObjectUtil.isEmpty(addOrderDto.getShopId())){ |
| | | throw new FebsException("请选择门店"); |
| | | } |
| | | Long shopId = addOrderDto.getShopId(); |
| | | MallShopApply mallShopApply = mallShopApplyMapper.selectById(shopId); |
| | | if(ObjectUtil.isEmpty(mallShopApply)){ |
| | | throw new FebsException("请选择门店"); |
| | | } |
| | | if(MallShopApply.APPLY_AGREE != mallShopApply.getStatus()){ |
| | | throw new FebsException("请选择门店"); |
| | | } |
| | | orderInfo.setShopId(shopId); |
| | | } |
| | | |
| | | this.baseMapper.insert(orderInfo); |
| | |
| | | } |
| | | |
| | | orderInfo.setAmount(total); |
| | | orderInfo.setCarriage(carriage); |
| | | if(2 == deliverType){ |
| | | orderInfo.setDeliverType(2); |
| | | orderInfo.setCarriage(BigDecimal.ZERO); |
| | | }else{ |
| | | orderInfo.setDeliverType(1); |
| | | orderInfo.setCarriage(carriage); |
| | | } |
| | | this.baseMapper.updateById(orderInfo); |
| | | |
| | | agentProducer.sendOrderCancelDelayMsg(orderInfo.getId(), 15 * 60 * 1000L); |
| | |
| | | String rcResult = ""; |
| | | switch (payOrderDto.getType()) { |
| | | case "1": |
| | | UnipayDto unipayDtoWx = new UnipayDto(); |
| | | // unipayDto.setAmount(new BigDecimal("0.01")); |
| | | unipayDtoWx.setAmount(orderInfo.getAmount()); |
| | | unipayDtoWx.setFrpCode("WEIXIN_APP3"); |
| | | unipayDtoWx.setTradeMerchantNo("777180800385820"); |
| | | unipayDtoWx.setOrderNo(orderInfo.getOrderNo()); |
| | | List<MallOrderItem> itemsWx = orderInfo.getItems(); |
| | | if(CollUtil.isEmpty(itemsWx)){ |
| | | unipayDtoWx.setProductName("商品"); |
| | | }else{ |
| | | unipayDtoWx.setProductName(itemsWx.get(0).getGoodsName()); |
| | | } |
| | | String unipayStrWx = unipayService.unipay(unipayDtoWx); |
| | | if("fail" == unipayStrWx){ |
| | | throw new FebsException("支付失败"); |
| | | }else{ |
| | | // JSONUtil.parseObj(unipayStr); |
| | | JSONObject jsonObject = JSONUtil.parseObj(unipayStrWx); |
| | | payResultStr = (String) jsonObject.get("r7_TrxNo"); |
| | | rcResult = (String) jsonObject.get("rc_Result"); |
| | | } |
| | | orderInfo.setPayOrderNo(payResultStr); |
| | | // orderInfo.setPayOrderNo(payOrderDto.getPayOrderNo()); |
| | | // orderInfo.setPayImage(payOrderDto.getPayImage()); |
| | | orderInfo.setPayMethod("微信支付"); |
| | | agentProducer.sendOrderReturn(orderInfo.getId()); |
| | | break; |
| | | case "2": |
| | | // if (StrUtil.isNotBlank(orderInfo.getPayOrderNo())) { |
| | |
| | | // unipayDto.setAmount(new BigDecimal("0.01")); |
| | | unipayDto.setAmount(orderInfo.getAmount()); |
| | | unipayDto.setFrpCode("ALIPAY_H5"); |
| | | unipayDto.setTradeMerchantNo("777180800385820"); |
| | | unipayDto.setTradeMerchantNo("777184100385821"); |
| | | unipayDto.setOrderNo(orderInfo.getOrderNo()); |
| | | List<MallOrderItem> items = orderInfo.getItems(); |
| | | if(CollUtil.isEmpty(items)){ |
| | |
| | | long remainTime = DateUtil.between(new Date(), endTime, DateUnit.SECOND, false); |
| | | orderDetailVo.setRemainTime(remainTime); |
| | | } |
| | | Integer deliverType = (ObjectUtil.isEmpty(orderInfo.getDeliverType()) ? new Integer(0):orderInfo.getDeliverType()); |
| | | if(2 == deliverType){ |
| | | MallShopApply mallShopApply = mallShopApplyMapper.selectById(orderInfo.getShopId()); |
| | | if(ObjectUtil.isNotEmpty(mallShopApply)){ |
| | | ApiShopApplyVo apiShopApplyVo = new ApiShopApplyVo(); |
| | | apiShopApplyVo.setName(mallShopApply.getName()); |
| | | apiShopApplyVo.setPhone(mallShopApply.getPhone()); |
| | | apiShopApplyVo.setSaleArea(mallShopApply.getSaleArea()); |
| | | apiShopApplyVo.setLatitude(mallShopApply.getLatitude()); |
| | | apiShopApplyVo.setLongitude(mallShopApply.getLongitude()); |
| | | apiShopApplyVo.setShopName(mallShopApply.getShopName()); |
| | | apiShopApplyVo.setAddress(mallShopApply.getAddress()); |
| | | orderDetailVo.setApiShopApplyVo(apiShopApplyVo); |
| | | } |
| | | } |
| | | return orderDetailVo; |
| | | } |
| | | |