|
@@ -3,18 +3,24 @@ package com.zhongzheng.modules.order.service.impl;
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.lang.Validator;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.zhongzheng.common.exception.CustomException;
|
|
|
import com.zhongzheng.common.utils.DateUtils;
|
|
|
import com.zhongzheng.common.utils.ServletUtils;
|
|
|
+import com.zhongzheng.modules.course.domain.CourseBusiness;
|
|
|
import com.zhongzheng.modules.order.bo.*;
|
|
|
+import com.zhongzheng.modules.order.domain.Order;
|
|
|
import com.zhongzheng.modules.order.domain.OrderHandle;
|
|
|
import com.zhongzheng.modules.order.domain.OrderInput;
|
|
|
import com.zhongzheng.modules.order.mapper.OrderHandleMapper;
|
|
|
import com.zhongzheng.modules.order.service.IOrderHandleService;
|
|
|
+import com.zhongzheng.modules.order.service.IOrderPayService;
|
|
|
import com.zhongzheng.modules.order.service.IOrderService;
|
|
|
import com.zhongzheng.modules.order.vo.OrderHandleGoodsVo;
|
|
|
import com.zhongzheng.modules.order.vo.OrderHandleVo;
|
|
|
import com.zhongzheng.modules.user.service.IUserService;
|
|
|
+import com.zhongzheng.modules.user.vo.UserVo;
|
|
|
+import com.zhongzheng.modules.wx.service.IWxPayService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
@@ -23,9 +29,8 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.github.pagehelper.Page;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
-import java.util.Collection;
|
|
|
-import java.util.Collections;
|
|
|
-import java.util.List;
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
@@ -44,6 +49,12 @@ public class OrderHandleServiceImpl extends ServiceImpl<OrderHandleMapper, Order
|
|
|
@Autowired
|
|
|
private IOrderService iOrderService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IWxPayService iWxPayService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IOrderPayService iOrderPayService;
|
|
|
+
|
|
|
@Override
|
|
|
public OrderHandleVo queryById(Long id){
|
|
|
OrderHandle db = this.baseMapper.selectById(id);
|
|
@@ -145,6 +156,71 @@ public class OrderHandleServiceImpl extends ServiceImpl<OrderHandleMapper, Order
|
|
|
return handleOrderSn;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Map<String, String> resumePayOrder(OrderHandleAddBo bo) {
|
|
|
+ if (Validator.isEmpty(bo.getHandleOrderSn())) {
|
|
|
+ throw new CustomException("录单单号为空");
|
|
|
+ }
|
|
|
+ if (Validator.isEmpty(bo.getPayType())) {
|
|
|
+ throw new CustomException("支付方式缺失");
|
|
|
+ }
|
|
|
+ OrderHandle orderHandle = queryBySn(bo.getHandleOrderSn());
|
|
|
+ if (Validator.isEmpty(orderHandle)) {
|
|
|
+ throw new CustomException("录单单号不存在");
|
|
|
+ }
|
|
|
+ if (orderHandle.getPayStauts()!=0) {
|
|
|
+ throw new CustomException("非支付状态");
|
|
|
+ }
|
|
|
+ if (orderHandle.getOverTime()<DateUtils.getNowTime()) {
|
|
|
+ throw new CustomException("已超时关闭");
|
|
|
+ }
|
|
|
+ UserVo userVo = iUserService.queryById(bo.getCreateUserId());
|
|
|
+ if(bo.getPayType()==1){
|
|
|
+ Map<String, String> payResult = new HashMap<>();
|
|
|
+ if (orderHandle.getPayPrice().compareTo(BigDecimal.ZERO) != 0) {
|
|
|
+ OrderPayAddBo payAddBo = new OrderPayAddBo();
|
|
|
+ //生成支付单号
|
|
|
+ String pay_no = DateUtils.getPayOrderSn();
|
|
|
+ payAddBo.setPaySn(pay_no);
|
|
|
+ payAddBo.setOrderSn(orderHandle.getHandleOrderSn());
|
|
|
+ payAddBo.setStatus(0);
|
|
|
+ payAddBo.setPayPrice(orderHandle.getPayPrice());
|
|
|
+ payAddBo.setOrderFrom(2);
|
|
|
+ iOrderPayService.insertByAddBo(payAddBo);
|
|
|
+ String body = "中正云-订单:"+orderHandle.getHandleOrderSn();
|
|
|
+ payResult = iWxPayService.paymentPc(pay_no, userVo.getOpenId(), body, orderHandle.getPayPrice());
|
|
|
+ payResult.put("orderSn", orderHandle.getHandleOrderSn());
|
|
|
+ return payResult;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if(bo.getPayType()==2){
|
|
|
+ if(Validator.isEmpty(bo.getCompanyName())||Validator.isEmpty(bo.getCompanyTel())||Validator.isEmpty(bo.getCompanyPayImg())){
|
|
|
+ throw new CustomException("对公凭证缺失");
|
|
|
+ }
|
|
|
+ LambdaUpdateWrapper<OrderHandle> objectLambdaUpdateWrapper = Wrappers.lambdaUpdate();
|
|
|
+ objectLambdaUpdateWrapper.eq(OrderHandle::getId, orderHandle.getId());
|
|
|
+ objectLambdaUpdateWrapper.set(OrderHandle::getCompanyName, bo.getCompanyName());
|
|
|
+ objectLambdaUpdateWrapper.set(OrderHandle::getCompanyTel,bo.getCompanyTel());
|
|
|
+ objectLambdaUpdateWrapper.set(OrderHandle::getCompanyRemark,bo.getCompanyRemark());
|
|
|
+ objectLambdaUpdateWrapper.set(OrderHandle::getCompanyPayImg,bo.getCompanyPayImg());
|
|
|
+ objectLambdaUpdateWrapper.set(OrderHandle::getUpdateTime,DateUtils.getNowTime());
|
|
|
+ objectLambdaUpdateWrapper.set(OrderHandle::getPayStauts,2);
|
|
|
+ objectLambdaUpdateWrapper.set(OrderHandle::getPayType,2);
|
|
|
+ this.update(null, objectLambdaUpdateWrapper);
|
|
|
+
|
|
|
+ LambdaUpdateWrapper<Order> objectLambdaUpdateWrapper2 = Wrappers.lambdaUpdate();
|
|
|
+ objectLambdaUpdateWrapper2.eq(Order::getHandleOrderSn, orderHandle.getHandleOrderSn());
|
|
|
+ objectLambdaUpdateWrapper2.set(Order::getPayType, 7);
|
|
|
+ objectLambdaUpdateWrapper2.set(Order::getUpdateTime,DateUtils.getNowTime());
|
|
|
+ iOrderService.update(null, objectLambdaUpdateWrapper2);
|
|
|
+
|
|
|
+ Map<String, String> payResult = new HashMap<>();
|
|
|
+ return payResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public Boolean updateByEditBo(OrderHandleEditBo bo) {
|
|
|
OrderHandle update = BeanUtil.toBean(bo, OrderHandle.class);
|