Browse Source

订单增加接口

周箭河 5 năm trước cách đây
mục cha
commit
df29399727

+ 19 - 13
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentPaymentOrderDao.java

@@ -36,12 +36,12 @@ public interface StudentPaymentOrderDao extends BaseDAO<Long, StudentPaymentOrde
                                               @Param("status") String status);
 
     /**
-     * @describe 统计学员剩余课时的课程费用
-     * @author Joburgess
-     * @date 2019/12/3
      * @param vipGroupId:
      * @param userId:
      * @return java.math.BigDecimal
+     * @describe 统计学员剩余课时的课程费用
+     * @author Joburgess
+     * @date 2019/12/3
      */
     BigDecimal sumSurplusCourseFee(@Param("vipGroupId") String vipGroupId,
                                    @Param("userId") Integer userId);
@@ -52,14 +52,14 @@ public interface StudentPaymentOrderDao extends BaseDAO<Long, StudentPaymentOrde
      * 根据学生vip课获取非失败缴费订单
      */
     StudentPaymentOrder findNotFailedOrderByStudentVipGroup(@Param("vipGroupId") Long vipGroupId,
-                                              @Param("userId") Integer userId);
+                                                            @Param("userId") Integer userId);
 
     /**
+     * @param musicGroupId: 乐团编号/vip课编号
+     * @return java.lang.Integer
      * @describe 统计报名人数
      * @author Joburgess
      * @date 2019/11/13
-     * @param musicGroupId: 乐团编号/vip课编号
-     * @return java.lang.Integer
      */
     Integer countStudentPaymentNum(@Param("musicGroupId") String musicGroupId);
 
@@ -120,6 +120,7 @@ public interface StudentPaymentOrderDao extends BaseDAO<Long, StudentPaymentOrde
 
     /**
      * 查询支付中超时的订单
+     *
      * @param orderNoList
      * @param status
      * @param beforeTime
@@ -128,30 +129,31 @@ public interface StudentPaymentOrderDao extends BaseDAO<Long, StudentPaymentOrde
     List<StudentPaymentOrder> findOrdersOverTime(@Param("orderNoList") List<String> orderNoList, @Param("status") DealStatusEnum status, @Param("beforeTime") Date beforeTime);
 
     /**
+     * @param musicGroupId: 乐团编号
+     * @param userId:       用户编号
+     * @return int
      * @describe 根据乐团和用户编号统计剩余课时
      * @author Joburgess
      * @date 2019/12/4
-     * @param musicGroupId: 乐团编号
-     * @param userId: 用户编号
-     * @return int
      */
     int countSurplusCourseByMusicGroupAndUser(@Param("musicGroupId") String musicGroupId, @Param("userId") Integer userId);
 
     /**
-     * @describe 统计乐团或vip课的收入金额
-     * @author Joburgess
-     * @date 2019/12/4
      * @param musicGroupId: 乐团或小课金额
      * @param groupType:
      * @return java.math.BigDecimal
+     * @describe 统计乐团或vip课的收入金额
+     * @author Joburgess
+     * @date 2019/12/4
      */
     BigDecimal sumGroupIncomeFee(@Param("musicGroupId") String musicGroupId,
                                  @Param("groupType") String groupType);
 
-    List<StudentPaymentOrder> findStudentPaymentOrder(@Param("groupType") String groupType,@Param("musicGroupId") String musicGroupId);
+    List<StudentPaymentOrder> findStudentPaymentOrder(@Param("groupType") String groupType, @Param("musicGroupId") String musicGroupId);
 
     /**
      * 获取零星订单
+     *
      * @param userId
      * @param sporadicId
      * @param groupType
@@ -162,8 +164,12 @@ public interface StudentPaymentOrderDao extends BaseDAO<Long, StudentPaymentOrde
 
     /**
      * 获取订单金额map
+     *
      * @param paymentOrderNo
      * @return
      */
     List<Map<Long, BigDecimal>> queryActualAmount(@Param("paymentOrderNo") List<Long> paymentOrderNo);
+
+
+    List<StudentPaymentOrder> findFixOrder(@Param("status") DealStatusEnum status, @Param("paymentChannel") String paymentChannel);
 }

+ 6 - 0
mec-biz/src/main/resources/config/mybatis/StudentPaymentOrderMapper.xml

@@ -352,4 +352,10 @@
             #{item}
         </foreach>
     </select>
+
+    <select id="findFixOrder" resultMap="StudentPaymentOrder">
+        SELECT * FROM student_payment_order
+        WHERE status_=#{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler} AND payment_channel_ =
+        #{paymentChannel} AND com_amount_ IS NULL LIMIT 100
+    </select>
 </mapper>

+ 8 - 4
mec-student/src/main/java/com/ym/mec/student/controller/StudentOrderController.java

@@ -3,6 +3,7 @@ package com.ym.mec.student.controller;
 import com.alibaba.fastjson.JSON;
 import com.huifu.adapay.model.payment.PayChannelEnum;
 import com.huifu.adapay.model.payment.Payment;
+import com.ym.mec.biz.dal.dao.StudentPaymentOrderDao;
 import com.ym.mec.biz.dal.dto.VipBuyResultDto;
 import com.ym.mec.biz.dal.entity.Goods;
 import com.ym.mec.biz.dal.entity.MusicGroup;
@@ -52,7 +53,9 @@ public class StudentOrderController extends BaseController {
     @Autowired
     private StudentPaymentOrderDetailService studentPaymentOrderDetailService;
     @Autowired
-    YqPayFeignService yqPayFeignService;
+    private YqPayFeignService yqPayFeignService;
+    @Autowired
+    private StudentPaymentOrderDao studentPaymentOrderDao;
 
     @PostMapping("/notify")
     public Msg notify(@ModelAttribute Msg msg) throws Exception {
@@ -233,11 +236,11 @@ public class StudentOrderController extends BaseController {
     }
 
     @GetMapping("/fixOrder")
-    private void fixOrder() throws Exception {
-        List<StudentPaymentOrder> payingOrders = studentPaymentOrderService.findOrdersByStatus(DealStatusEnum.SUCCESS, "YQPAY");
+    private int fixOrder() throws Exception {
+        List<StudentPaymentOrder> payingOrders = studentPaymentOrderDao.findFixOrder(DealStatusEnum.SUCCESS, "YQPAY");
 
         if (payingOrders.size() == 0) {
-            return;
+            return 0;
         }
         String merOrderNos = payingOrders.stream().map(StudentPaymentOrder::getOrderNo).collect(Collectors.joining(","));
 
@@ -265,6 +268,7 @@ public class StudentOrderController extends BaseController {
                 fixUpdateOrder(orderNo,type);
             }
         }
+        return payingOrders.size();
     }
 
     void fixUpdateOrder(String orderNo,String type) {

+ 1 - 1
mec-web/src/main/java/com/ym/mec/web/controller/StudentPaymentOrderController.java

@@ -138,7 +138,7 @@ public class StudentPaymentOrderController extends BaseController {
         PageInfo<StudentPaymentOrder> studentPaymentOrderPageInfo = studentPaymentOrderService.queryPage(queryInfo);
 
         for (StudentPaymentOrder row : studentPaymentOrderPageInfo.getRows()) {
-            BigDecimal perAmount = row.getPerAmount() == null ? BigDecimal.ZERO : row.getComAmount();
+            BigDecimal perAmount = row.getPerAmount() == null ? BigDecimal.ZERO : row.getPerAmount();
             if(row.getPerAmount() != null) {
                 row.setExpectAmount(perAmount);
                 row.setActualAmount(perAmount);