| | |
| | | import com.mzl.flower.mapper.supplier.StationMapper; |
| | | import com.mzl.flower.mapper.system.UserWechatMapper; |
| | | import com.mzl.flower.mapper.warehouse.WarehouseLocationMapper; |
| | | import com.mzl.flower.pay.SybPayService; |
| | | import com.mzl.flower.service.BaseService; |
| | | import com.mzl.flower.service.comment.FlowerCommentService; |
| | | import com.mzl.flower.service.coupon.CouponRecordService; |
| | |
| | | |
| | | @Autowired |
| | | private UserPaymentV3Service paymentV3Service; |
| | | |
| | | @Autowired |
| | | private UserPaymentSybService paymentSybService; |
| | | |
| | | @Autowired |
| | | private SequenceNo sequenceNo; |
| | |
| | | } |
| | | }); |
| | | |
| | | /* 替换支付修改 |
| | | WxMaJscode2SessionResult session = null; |
| | | try { |
| | | session = weChatService.getWxMaSessionInfo(dto.getWxcode()); |
| | |
| | | if (StringUtils.isBlank(openId)) { |
| | | throw new ValidationException("微信登录失败"); |
| | | } |
| | | */ |
| | | |
| | | Address address = addressMapper.selectById(dto.getAddressId()); |
| | | List<TransportOrderDTO> tLs = transportService.getPreOrderTransportList(address |
| | |
| | | usePointGoods(order.getId(), goodsRecordIdList);//使用积分商品兑换券 |
| | | |
| | | order.create(userId); |
| | | // 根据当前的时间判断,如果时间大于当天的下午17:00 ,那么日期则为下一天的日期,否则为当天日期 |
| | | if(null!=order.getCreateTime()){ |
| | | LocalDateTime createDateTime = order.getCreateTime(); |
| | | LocalDate createDate = createDateTime.toLocalDate(); |
| | | LocalDateTime today1700 = createDateTime.with(LocalTime.of(17, 0)); |
| | | // 比较时间是否大于当天的 17:00 |
| | | if (createDateTime.isAfter(today1700)) { |
| | | // 如果大于 17:00,设置为下一天的日期 |
| | | createDate = createDate.plusDays(1); |
| | | } |
| | | order.setCreateDateSta(createDate); |
| | | } |
| | | // order.setCreateDate(); |
| | | order.setRemarks(dto.getRemarks()); |
| | | order.setSpecialNeeds(dto.getSpecialNeeds()); |
| | | order.setStatusBackend(Constants.ORDER_STATUS_BACKEND.PENDING.name()); |
| | |
| | | } |
| | | totalAmount = totalAmount.add(p.getPacking()).add(transportFee); |
| | | if(totalAmount.doubleValue() <= 0){//假如总价小于等于0,则支付0.01元 |
| | | totalAmount = new BigDecimal(0.01); |
| | | totalAmount = new BigDecimal("0.01"); |
| | | } |
| | | order.setTotalAmount(totalAmount); |
| | | |
| | |
| | | } |
| | | |
| | | order.setOrderNo(getOrderNo()); |
| | | //order.setPayOpenid(openId);替换支付修改 |
| | | order.setPayOpenid(openId); |
| | | orderMapper.insert(order); |
| | | |
| | | //处理积分商品兑换券 |
| | |
| | | } |
| | | } |
| | | |
| | | return paymentSybService.prepay(order); |
| | | Map map = paymentV3Service.wxPrepay(order); |
| | | map.put("_testV2OrderId", order.getId()); |
| | | return map; |
| | | } |
| | | |
| | | private void usePointGoods(String orderId, List<Long> goodsRecordIdList){ |
| | |
| | | if(orders == null || orders.size() == 0){ |
| | | return; |
| | | } |
| | | /* |
| | | for (Order o : orders) { |
| | | //set status_backend = 'RECEIVE', status = 'RECEIVE' |
| | | o.setStatusBackend("RECEIVE"); |
| | |
| | | |
| | | orderMapper.updateById(o); |
| | | } |
| | | */ |
| | | orderMapper.setPartnerOrderReceive(); |
| | | //orderMapper.setPartnerOrderReceive(); |
| | | } |
| | | |
| | | /** |
| | |
| | | o.setStatusBackend(Constants.ORDER_STATUS_BACKEND.RECEIVE.name()); |
| | | o.update(SecurityUtils.getUserId()); |
| | | |
| | | /* |
| | | //发送微信发货请求 |
| | | JSONObject jsonObject = sendWxDeliveryGood(o); |
| | | if (jsonObject != null && (int) jsonObject.get("errcode") == 0) { |
| | |
| | | o.setWxDeliveryGood(false); |
| | | o.setWxDeliveryMsg(GsonUtil.toJson(jsonObject)); |
| | | } |
| | | */ |
| | | |
| | | orderMapper.updateById(o); |
| | | } |
| | | |
| | |
| | | orderIds.add(o.getId()); |
| | | |
| | | OrderPlatformListDTO p = new OrderPlatformListDTO(); |
| | | //增加订单扎数 |
| | | Integer sumNumByOrderId = orderItemMapper.getSumNumByOrderId(o.getId()); |
| | | o.setSaleNum(sumNumByOrderId); |
| | | |
| | | BeanUtils.copyProperties(o, p); |
| | | result.add(p); |
| | | } |
| | |
| | | customerPointService.consumptionPoint(totalAmount, o.getOrderNo(), o.getCreateBy()); |
| | | } |
| | | |
| | | /* |
| | | public JSONObject sendWxDeliveryGood(Order o) { |
| | | JSONObject json = new JSONObject(); |
| | | List<OrderItem> items = orderItemMapper.selectList(new LambdaQueryWrapper<OrderItem>() |
| | |
| | | return json; |
| | | } |
| | | } |
| | | */ |
| | | |
| | | public Order confirmOrderReceive(String id) { |
| | | Order o = orderMapper.selectById(id); |
| | |
| | | |
| | | transferId = "NoNeedRefund"; |
| | | if (deductAmount.doubleValue() > 0) { |
| | | transferId = paymentSybService.refundOrderSub(o, deductAmount); |
| | | transferId = paymentV3Service.refundOrderSub(o, deductAmount); |
| | | } |
| | | o.setTransferId(transferId); |
| | | orderMapper.updateById(o); |
| | |
| | | } |
| | | |
| | | BigDecimal amount = dto.getAmount(); |
| | | transferId = paymentSybService.refundOrderSub(o, amount); |
| | | transferId = paymentV3Service.refundOrderSub(o, amount); |
| | | o.setTransferId(transferId); |
| | | o.setTransferTime(LocalDateTime.now()); |
| | | o.update(SecurityUtils.getUserId()); |
| | |
| | | public void exportOrderDetail(HttpServletResponse response, OrderQueryDTO dto) { |
| | | List<OrderListExportDTO> ls = getOrderExportListBase( dto); |
| | | String[] rowsName = new String[]{"序号","订单号", "用户账号", "收货人", "收货人电话", "收货地址", "订单金额" |
| | | , "底价", "订单状态", "下单时间", "合伙人", "库位", "特殊需求", "备注"}; |
| | | , "底价","销售扎数", "订单状态", "下单时间", "合伙人", "库位", "特殊需求", "备注"}; |
| | | List<Object[]> dataList = new ArrayList<>(); |
| | | int sn = 1; |
| | | for (OrderListExportDTO o : ls) { |
| | |
| | | objs[a++] = o.getCustomerAddress(); |
| | | objs[a++] = o.getTotalAmount(); |
| | | objs[a++] = o.getSupplierAmount(); |
| | | objs[a++] = o.getSaleNum(); |
| | | objs[a++] = o.getStatusBackendStr(); |
| | | objs[a++] = o.getCreateTime(); |
| | | objs[a++] = o.getPartnerName(); |
| | |
| | | exportOrderDetail(response, dto); |
| | | } |
| | | |
| | | public void refreshDate() { |
| | | List<Order> allOrderList= orderMapper.selectAllDateList(); |
| | | |
| | | allOrderList.forEach(order -> { |
| | | orderMapper.updatePaymentCreateDate(order); |
| | | }); |
| | | } |
| | | } |