소스 검색

增加乐器采购清单确认接口

周箭河 5 년 전
부모
커밋
b023517da8

+ 11 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupStudentMapperServiceImpl.java

@@ -67,7 +67,9 @@ public class ClassGroupStudentMapperServiceImpl extends BaseServiceImpl<Long, Cl
 
         //3、删除学生对应班级的课程
         List<CourseSchedule> courseScheduleList = courseScheduleService.findNoStartCoursesByClassGroupId(classGroupId);
-        courseScheduleStudentPaymentService.deleteStudentCourseSchedule(userId, courseScheduleList);
+        if(courseScheduleList.size() > 0 ) {
+            courseScheduleStudentPaymentService.deleteStudentCourseSchedule(userId, courseScheduleList);
+        }
 
         //4、学生退出班级群组
         ClassGroup classGroup = classGroupService.get(classGroupId);
@@ -117,6 +119,9 @@ public class ClassGroupStudentMapperServiceImpl extends BaseServiceImpl<Long, Cl
             courseScheduleStudentPayment.setUpdateTime(date);
             courseScheduleStudentPayments.add(courseScheduleStudentPayment);
         }
+        if(courseScheduleStudentPayments.size() ==0){
+            return true;
+        }
 
         courseScheduleStudentPaymentService.batchInsert(courseScheduleStudentPayments);
         return true;
@@ -143,7 +148,7 @@ public class ClassGroupStudentMapperServiceImpl extends BaseServiceImpl<Long, Cl
             classGroupStudentMapper.setStatus(ClassGroupStudentStatusEnum.NORMAL);
             classGroupStudentMappers.add(classGroupStudentMapper);
             if (classGroup.getType().equals(ClassGroupTypeEnum.NORMAL)) {
-                StudentRegistration studentRegistration = studentRegistrationService.queryByUserIdAndMusicGroupId(Integer.parseInt(userIdStr),classGroup.getMusicGroupId());
+                StudentRegistration studentRegistration = studentRegistrationService.queryByUserIdAndMusicGroupId(Integer.parseInt(userIdStr), classGroup.getMusicGroupId());
                 studentRegistration.setClassGroupId(classGroupId);
                 studentRegistrationService.update(studentRegistration);
             }
@@ -181,6 +186,10 @@ public class ClassGroupStudentMapperServiceImpl extends BaseServiceImpl<Long, Cl
             }
         }
 
+        if (courseScheduleStudentPayments.size() == 0) {
+            return true;
+        }
+
         courseScheduleStudentPaymentService.batchInsert(courseScheduleStudentPayments);
         return true;
     }

+ 2 - 4
mec-student/src/main/java/com/ym/mec/student/controller/MusicGroupController.java

@@ -315,8 +315,7 @@ public class MusicGroupController extends BaseController {
             return failed("商品价格不符");
         }
 
-        IdWorker idWorker = new IdWorker(0, 0);
-        String orderNo = idWorker.nextId();
+        String orderNo = idGeneratorService.generatorId("payment")+"";
 
         Map payMap = payService.getPayMap(orderAmount, orderNo, "http://47.99.212.176:8000/studentOrder/notify", "http://dev.dayaedu.com", "测试订单", "测试订单");
 
@@ -334,8 +333,7 @@ public class MusicGroupController extends BaseController {
 //
 //        System.out.println(query);
 //
-        IdWorker idWorker = new IdWorker(0, 0);
-        String orderNo = "1017" + idWorker.nextId();
+        String orderNo = idGeneratorService.generatorId("payment")+"";
         BigDecimal amount = new BigDecimal("0.01");
         Map map = payService.getPayMap(amount, orderNo, "http://47.99.212.176:8000/studentOrder/notify", "https://baodiu.com", "测试订单", "测试订单");
        return succeed(map);

+ 23 - 7
mec-student/src/main/java/com/ym/mec/student/controller/StudentOrderController.java

@@ -1,5 +1,7 @@
 package com.ym.mec.student.controller;
 
+import com.huifu.adapay.model.payment.PayChannelEnum;
+import com.huifu.adapay.model.payment.Payment;
 import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
 import com.ym.mec.biz.dal.enums.DealStatusEnum;
 import com.ym.mec.biz.dal.enums.OrderTypeEnum;
@@ -8,6 +10,7 @@ import com.ym.mec.biz.service.StudentPaymentOrderService;
 import com.ym.mec.biz.service.StudentRegistrationService;
 import com.ym.mec.biz.service.VipGroupService;
 import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.thirdparty.adapay.Pay;
 import com.ym.mec.thirdparty.union.NotifyMsg;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -17,6 +20,7 @@ import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import java.math.BigDecimal;
 import java.util.Objects;
 
 @RequestMapping("studentOrder")
@@ -30,7 +34,7 @@ public class StudentOrderController extends BaseController {
     private StudentRegistrationService studentRegistrationService;
     @Autowired
     private VipGroupService vipGroupService;
-    
+
     @Autowired
     private MusicGroupService musicGroupService;
 
@@ -68,10 +72,10 @@ public class StudentOrderController extends BaseController {
         order.setPayTime(notifyMsg.getPayTime());
         if (order.getType().equals(OrderTypeEnum.APPLY)) { //报名订单
             studentRegistrationService.updateApplyOrder(order);
-        }else if (order.getType().equals(OrderTypeEnum.SMALL_CLASS_TO_BUY)){
+        } else if (order.getType().equals(OrderTypeEnum.SMALL_CLASS_TO_BUY)) {
             vipGroupService.orderCallback(order);
-        }else if(order.getType().equals(OrderTypeEnum.RENEW)){
-        	musicGroupService.renewForCallback(order);
+        } else if (order.getType().equals(OrderTypeEnum.RENEW)) {
+            musicGroupService.renewForCallback(order);
         }
 
         return "SUCCESS";
@@ -80,16 +84,28 @@ public class StudentOrderController extends BaseController {
 
     @ApiOperation(value = "查询订单状态")
     @GetMapping("/checkOrderStatus")
-    public Object checkOrderStatus(String orderNo){
-        if(StringUtils.isBlank(orderNo)){
+    public Object checkOrderStatus(String orderNo) {
+        if (StringUtils.isBlank(orderNo)) {
             return failed("请指定订单");
         }
         StudentPaymentOrder orderByOrderNo = studentPaymentOrderService.findOrderByOrderNo(orderNo);
-        if(Objects.isNull(orderByOrderNo)){
+        if (Objects.isNull(orderByOrderNo)) {
             return failed("未找到指定订单");
         }
         return succeed(orderByOrderNo.getStatus());
     }
 
+    @ApiOperation(value = "台牌支付")
+    @GetMapping("/executePayment")
+    public Object executePayment() throws Exception {
+        String orderNo = "jsdk_payment_" + System.currentTimeMillis();
+        String payChannel = PayChannelEnum.ALIPAY_QR.getCode();
+        BigDecimal amount = new BigDecimal("0.01");
+        String orderSubject = "测试大雅订单";
+        String orderBody = "测试大雅订单";
+        Payment payment = Pay.executePayment(amount, orderNo, payChannel, orderSubject, orderBody);
+        return succeed(payment);
+    }
+
 
 }