he2802 3 years ago
parent
commit
31f0539f65

+ 4 - 0
zhongzheng-admin/src/main/java/com/zhongzheng/controller/common/CaptchaController.java

@@ -16,11 +16,15 @@ import com.github.xiaoymin.knife4j.annotations.DynamicResponseParameters;
 import com.zhongzheng.common.constant.Constants;
 import com.zhongzheng.common.core.domain.AjaxResult;
 import com.zhongzheng.common.core.redis.RedisCache;
+import com.zhongzheng.modules.order.bo.OrderAddBo;
+import com.zhongzheng.modules.order.service.IOrderGoodsService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;

+ 6 - 0
zhongzheng-admin/src/main/java/com/zhongzheng/controller/common/CommonController.java

@@ -7,12 +7,15 @@ import com.zhongzheng.common.core.domain.AjaxResult;
 import com.zhongzheng.common.utils.file.FileUploadUtils;
 import com.zhongzheng.common.utils.file.FileUtils;
 import com.zhongzheng.framework.config.ServerConfig;
+import com.zhongzheng.modules.order.bo.OrderAddBo;
+import io.swagger.annotations.ApiOperation;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.MediaType;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.multipart.MultipartFile;
 
@@ -32,6 +35,9 @@ public class CommonController
     @Autowired
     private ServerConfig serverConfig;
 
+
+
+
     /**
      * 通用下载请求
      *

+ 6 - 3
zhongzheng-api/src/main/java/com/zhongzheng/controller/cmmon/CommonController.java

@@ -19,15 +19,16 @@ import com.zhongzheng.modules.goods.bo.GoodsAttachedQueryBo;
 import com.zhongzheng.modules.goods.service.IGoodsAttachedService;
 import com.zhongzheng.modules.goods.vo.GoodsAttachedVo;
 import com.zhongzheng.modules.goods.vo.GoodsUserVo;
+import com.zhongzheng.modules.order.bo.OrderAddBo;
+import com.zhongzheng.modules.order.service.IOrderGoodsService;
+import com.zhongzheng.modules.order.service.IOrderService;
 import com.zhongzheng.modules.user.entity.ClientLoginUser;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.RequiredArgsConstructor;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import java.util.List;
 
@@ -46,6 +47,8 @@ public class CommonController extends BaseController {
     private final ICourseService iCourseService;
 
 
+
+
     /**
      * 查询课程列表
      */

+ 0 - 1
zhongzheng-api/src/main/java/com/zhongzheng/controller/order/OrderController.java

@@ -94,7 +94,6 @@ public class OrderController extends BaseController {
     public AjaxResult add(@RequestBody OrderAddBo bo) {
         ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
         bo.setUserId(loginUser.getUser().getUserId());
-        System.out.println(bo.getUserId()+"用户ID");
         return AjaxResult.success(iOrderService.placeSmallOrder(bo));
     }
 }

+ 0 - 1
zhongzheng-api/src/main/resources/application.yml

@@ -137,7 +137,6 @@ mybatis-plus:
   # 指定外部化 MyBatis Properties 配置,通过该配置可以抽离配置,实现不同环境的配置部署
   configurationProperties: null
   configuration:
-    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
     # 自动驼峰命名规则(camel case)映射
     # 如果您的数据库命名符合规则无需使用 @TableField 注解指定数据库字段名
     mapUnderscoreToCamelCase: true

+ 0 - 2
zhongzheng-common/src/main/java/com/zhongzheng/common/utils/SecurityUtils.java

@@ -38,8 +38,6 @@ public class SecurityUtils
     {
         try
         {
-            System.out.println(12890);
-            System.out.println(EnabledTenant);
             if(EnabledTenant){
                 return getLoginUser().getUsername();
             }else{

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/mapper/OrderGoodsMapper.java

@@ -3,11 +3,13 @@ package com.zhongzheng.modules.order.mapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.zhongzheng.modules.bank.bo.QuestionQueryBo;
 import com.zhongzheng.modules.bank.vo.QuestionVo;
+import com.zhongzheng.modules.order.bo.OrderAddBo;
 import com.zhongzheng.modules.order.bo.OrderGoodsQueryBo;
 import com.zhongzheng.modules.order.domain.OrderGoods;
 import com.zhongzheng.modules.order.vo.OrderGoodsVo;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * 订单商品Mapper接口
@@ -22,4 +24,5 @@ public interface OrderGoodsMapper extends BaseMapper<OrderGoods> {
     List<OrderGoodsVo> selectOrderGoods(OrderGoodsQueryBo orderGoodsQueryBo);
 
     List<OrderGoodsVo> selectOrderTwoGoods(OrderGoodsQueryBo orderGoodsQueryBo);
+
 }

+ 2 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/service/IOrderGoodsService.java

@@ -1,6 +1,7 @@
 package com.zhongzheng.modules.order.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.zhongzheng.modules.order.bo.OrderAddBo;
 import com.zhongzheng.modules.order.bo.OrderGoodsAddBo;
 import com.zhongzheng.modules.order.bo.OrderGoodsEditBo;
 import com.zhongzheng.modules.order.bo.OrderGoodsQueryBo;
@@ -9,6 +10,7 @@ import com.zhongzheng.modules.order.vo.OrderGoodsVo;
 
 import java.util.Collection;
 import java.util.List;
+import java.util.Map;
 
 /**
  * 订单商品Service接口
@@ -26,7 +28,6 @@ public interface IOrderGoodsService extends IService<OrderGoods> {
 	OrderGoodsVo selectDetail(OrderGoodsQueryBo bo);
 
 	List<OrderGoodsVo> selectList(OrderGoodsQueryBo bo);
-
 	/**
 	 * 查询列表
 	 */

+ 4 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/service/impl/OrderGoodsServiceImpl.java

@@ -15,6 +15,7 @@ import com.zhongzheng.modules.grade.service.IClassGradeGoodsService;
 import com.zhongzheng.modules.grade.service.IClassGradeService;
 import com.zhongzheng.modules.grade.service.IClassGradeUserService;
 import com.zhongzheng.modules.grade.vo.ClassGradeVo;
+import com.zhongzheng.modules.order.bo.OrderAddBo;
 import com.zhongzheng.modules.order.bo.OrderGoodsAddBo;
 import com.zhongzheng.modules.order.bo.OrderGoodsEditBo;
 import com.zhongzheng.modules.order.bo.OrderGoodsQueryBo;
@@ -24,6 +25,7 @@ import com.zhongzheng.modules.order.mapper.OrderGoodsMapper;
 import com.zhongzheng.modules.order.service.IOrderGoodsService;
 import com.zhongzheng.modules.order.service.IOrderService;
 import com.zhongzheng.modules.order.vo.OrderGoodsVo;
+import com.zhongzheng.modules.order.vo.OrderVo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -35,6 +37,7 @@ import org.springframework.transaction.annotation.Transactional;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
+import java.util.Map;
 import java.util.stream.Collectors;
 
 /**
@@ -80,6 +83,7 @@ public class OrderGoodsServiceImpl extends ServiceImpl<OrderGoodsMapper, OrderGo
         return orderGoodsMapper.selectList(bo);
     }
 
+
     @Override
     public List<OrderGoodsVo> queryList(OrderGoodsQueryBo bo) {
         LambdaQueryWrapper<OrderGoods> lqw = Wrappers.lambdaQuery();

+ 3 - 8
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/service/impl/OrderServiceImpl.java

@@ -257,6 +257,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
     @Override
     @Transactional(rollbackFor = Exception.class)
     public Map<String, String> placeSmallOrder(OrderAddBo bo) {
+
         List<OrderGoodsAddBo> goodsList = bo.getGoodsList();
         if(goodsList==null||goodsList.size()<1){
             throw new CustomException("商品列表为空");
@@ -318,14 +319,8 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
         add.setOrderFrom(Order.FROM_SMALL);
         add.setPayPrice(payPrice);
         add.setOrderPrice(totalPrice);
-        System.out.println("FR");
-        System.out.println(add);
-        Order add1 = new Order();
-        add1.setUserId(17L);
-        add1.setOrderSn("21122220575491026494");
-        add1.setCreateTime(DateUtils.getNowTime());
-        add1.setUpdateTime(DateUtils.getNowTime());
-        this.save(add1);
+        add.setCreateBy("");
+        this.save(add);
         Map<String, Object> result = new HashMap<>();
         result.put("oderId",add.getOrderId());
         result.put("orderSn",out_trade_no);

+ 38 - 3
zhongzheng-system/src/main/java/com/zhongzheng/modules/wx/service/impl/WxPayServiceImpl.java

@@ -28,6 +28,12 @@ import com.zhongzheng.modules.course.domain.Course;
 import com.zhongzheng.modules.course.service.ICourseService;
 import com.zhongzheng.modules.exam.service.IExamNoteService;
 
+import com.zhongzheng.modules.order.bo.OrderGoodsQueryBo;
+import com.zhongzheng.modules.order.domain.Order;
+import com.zhongzheng.modules.order.domain.OrderGoods;
+import com.zhongzheng.modules.order.service.IOrderGoodsService;
+import com.zhongzheng.modules.order.service.IOrderService;
+import com.zhongzheng.modules.order.vo.OrderGoodsVo;
 import com.zhongzheng.modules.polyv.bo.PolyvVideoAddBo;
 import com.zhongzheng.modules.polyv.bo.PolyvVideoEditBo;
 import com.zhongzheng.modules.polyv.bo.PolyvVideoQueryBo;
@@ -105,7 +111,8 @@ public class WxPayServiceImpl  implements IWxPayService {
     @Autowired
     private IOrderPossessUserService iOrderPossessUserService;
 
-
+    @Autowired
+    private IOrderService iOrderService;
 
     @Autowired
     private ICourseService iCourseService;
@@ -113,6 +120,9 @@ public class WxPayServiceImpl  implements IWxPayService {
     @Autowired
     private IUserService iUserService;
 
+    @Autowired
+    private IOrderGoodsService iOrderGoodsService;
+
 
     private String gzh_tokenUrl = "https://api.weixin.qq.com/cgi-bin/token";
 
@@ -218,10 +228,10 @@ public class WxPayServiceImpl  implements IWxPayService {
                     String transaction_id = notifyMap.get("transaction_id");
                     String TenantId = notifyMap.get("attach");
                     ServletUtils.getRequestAttributes().getResponse().setHeader("TenantId",TenantId);
-                    /*if(dealOrder(out_trade_no,transaction_id)){
+                    if(dealOrder(out_trade_no,transaction_id)){
                         xmlBack = "<xml><return_code><![CDATA[SUCCESS]]></return_code><return_msg><![CDATA[OK]]></return_msg></xml>";
                         return xmlBack;
-                    }*/
+                    }
                 }
             }
             else {
@@ -270,4 +280,29 @@ public class WxPayServiceImpl  implements IWxPayService {
         }
         return access_token;
     }
+
+    @Transactional(rollbackFor = Exception.class)
+    public boolean dealOrder(String out_trade_no,String transaction_id){
+        Order order = iOrderService.getOne(new LambdaQueryWrapper<Order>().eq(Order::getOrderSn, out_trade_no));
+        if(order!=null&&order.getOrderStatus()==0){
+            order.setOrderStatus(Order.PAY_FULL);
+            order.setPayTime(DateUtils.getNowTime());
+            order.setTransid(transaction_id);
+            order.setOrderGeneral(out_trade_no);
+            order.setStatus(1);
+            if(iOrderService.updateById(order)){
+                OrderGoodsQueryBo bo = new OrderGoodsQueryBo();
+                bo.setOrderSn(out_trade_no);
+                List<OrderGoods> goodsList = iOrderGoodsService.list(new LambdaQueryWrapper<OrderGoods>().eq(OrderGoods::getOrderSn, out_trade_no));
+                for (OrderGoods g : goodsList) {
+                    g.setPayStatus(OrderGoods.PAY_FULL);
+                    g.setGoodsReceived(g.getGoodsRealPrice()
+                    );
+                    iOrderGoodsService.updateById(g);
+                }
+            }
+        }
+        System.out.println(System.currentTimeMillis());
+        return true;
+    }
 }