Procházet zdrojové kódy

乐队指导训练营

zouxuan před 6 měsíci
rodič
revize
1e4139556e

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

@@ -112,6 +112,8 @@ public class StudentOrderController extends BaseController {
     private TempBuyDoubleElevenUserLogDao tempBuyDoubleElevenUserLogDao;
     @Autowired
     private HfMerchantConfigService hfMerchantConfigService;
+    @Autowired
+    private TempDirectorTrainingCampDetailService tempDirectorTrainingCampDetailService;
 
     @Value("${spring.profiles.active:dev}")
     private String profiles;
@@ -351,8 +353,12 @@ public class StudentOrderController extends BaseController {
             }
         } else if (orderByOrderNo.getGroupType().equals(GroupType.SPORADIC)) {
             if (Objects.nonNull(orderByOrderNo.getMusicGroupId())) {
-                List<SporadicChargeInfo> info = sporadicChargeInfoService.findByIds(orderByOrderNo.getMusicGroupId());
-                orderDetail.put("detail", info);
+                if(orderByOrderNo.getType().equals(OrderTypeEnum.DIRECTOR_TRAINING_CAMP)){
+                    orderDetail.put("detail", tempDirectorTrainingCampDetailService.getById(orderByOrderNo.getMusicGroupId()));
+                }else {
+                    List<SporadicChargeInfo> info = sporadicChargeInfoService.findByIds(orderByOrderNo.getMusicGroupId());
+                    orderDetail.put("detail", info);
+                }
             }
             if (orderByOrderNo.getType().equals(OrderTypeEnum.DOUBLE_ELEVEN2020)) {
                 LuckDrawCount luckDrawCount = luckDrawCountService.get(orderByOrderNo.getUserId().longValue());

+ 8 - 6
mec-application/src/main/java/com/ym/mec/student/controller/TempDirectorTrainingCampController.java

@@ -3,7 +3,6 @@ package com.ym.mec.student.controller;
 import com.ym.mec.biz.dal.entity.TempDirectorTrainingCamp;
 import com.ym.mec.biz.dal.entity.TempDirectorTrainingCampDetail;
 import com.ym.mec.biz.dal.wrapper.TempDirectorTrainingCampDetailWrapper;
-import com.ym.mec.biz.service.SysUserService;
 import com.ym.mec.biz.service.TempDirectorTrainingCampDetailService;
 import com.ym.mec.biz.service.TempDirectorTrainingCampService;
 import com.ym.mec.common.controller.BaseController;
@@ -25,8 +24,6 @@ public class TempDirectorTrainingCampController extends BaseController {
     private TempDirectorTrainingCampService tempDirectorTrainingCampService;
     @Resource
     private TempDirectorTrainingCampDetailService tempDirectorTrainingCampDetailService;
-    @Resource
-    private SysUserService sysUserService;
 
     @ApiOperation(value="获取训练营详情")
     @GetMapping(value = "/getDetail")
@@ -49,9 +46,14 @@ public class TempDirectorTrainingCampController extends BaseController {
 
     @ApiOperation(value="训练营报名")
     @PostMapping(value = "/applyCamp")
-    public HttpResponseResult<Object> applyCamp(@RequestBody TempDirectorTrainingCampDetailWrapper.ApplyCamp applyCamp){
-        tempDirectorTrainingCampDetailService.applyCamp(applyCamp);
-        return succeed();
+    public HttpResponseResult<Integer> applyCamp(@RequestBody TempDirectorTrainingCampDetailWrapper.ApplyCamp applyCamp){
+        return succeed(tempDirectorTrainingCampDetailService.applyCamp(applyCamp));
+    }
+
+    @ApiOperation(value = "训练营报名支付")
+    @PostMapping("/pay")
+    public HttpResponseResult pay(@RequestBody TempDirectorTrainingCampDetailWrapper.PayDto payDto) throws Exception {
+        return tempDirectorTrainingCampDetailService.pay(payDto);
     }
 }
 

+ 9 - 3
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentPaymentOrderDao.java

@@ -24,8 +24,11 @@ public interface StudentPaymentOrderDao extends BaseDAO<Long, StudentPaymentOrde
 
     StudentPaymentOrder lockOrder(@Param("id") Long id);
 
-    List<StudentPaymentOrder> queryByCondition(@Param("groupType") GroupType groupType, @Param("musicGroupId") String musicGroupId,
-                                               @Param("userId") Integer userId, @Param("status") DealStatusEnum status, @Param("type") OrderTypeEnum type);
+    List<StudentPaymentOrder> queryByCondition(@Param("groupType") GroupType groupType,
+                                               @Param("musicGroupId") String musicGroupId,
+                                               @Param("userId") Integer userId,
+                                               @Param("status") DealStatusEnum status,
+                                               @Param("type") OrderTypeEnum type);
 
     /**
      * @Author: Joburgess
@@ -167,7 +170,10 @@ public interface StudentPaymentOrderDao extends BaseDAO<Long, StudentPaymentOrde
      * @author qnc99
      * @date 2020/12/5 0005
      */
-    List<StudentPaymentOrder> findPaymentOrderByGroupType(@Param("userId") Integer userId, @Param("sporadicId") Integer sporadicId, @Param("groupType") String groupType, @Param("status") DealStatusEnum status);
+    List<StudentPaymentOrder> findPaymentOrderByGroupType(@Param("userId") Integer userId,
+                                                          @Param("sporadicId") Integer sporadicId,
+                                                          @Param("groupType") String groupType,
+                                                          @Param("status") DealStatusEnum status);
 
     List<StudentPaymentOrder> findOrderByGroup(@Param("groupId") String groupId,
                                                @Param("groupType") GroupType groupType,

+ 1 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/PayParamBasicDto.java

@@ -8,6 +8,7 @@ import java.util.List;
 
 import com.ym.mec.common.entity.BaseEntity;
 
+
 public class PayParamBasicDto extends BaseEntity implements Serializable {
     @ApiModelProperty(value = "是否使用余额", required = false)
     private Boolean isUseBalancePayment = false;

+ 7 - 2
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/TempDirectorTrainingCampDetail.java

@@ -9,6 +9,7 @@ import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 import java.io.Serializable;
+import java.math.BigDecimal;
 import java.util.Date;
 
 @ApiModel(value = "temp_director_training_camp_detail-乐队指导训练营活动")
@@ -19,6 +20,10 @@ public class TempDirectorTrainingCampDetail implements Serializable {
     @ApiModelProperty(value = "主键")
     private Integer id;
 
+    @ApiModelProperty(value = "用户编号")
+    @TableField("user_id_")
+    private Integer userId;
+
     @ApiModelProperty(value = "训练营编号")
     @TableField("temp_director_training_camp_id_")
     private Integer tempDirectorTrainingCampId;
@@ -65,7 +70,7 @@ public class TempDirectorTrainingCampDetail implements Serializable {
 
     @TableField("payment_amount_")
     @ApiModelProperty(value = "缴费金额")
-    private String paymentAmount;
+    private BigDecimal paymentAmount;
 
     @TableField("bird_flag_")
     @ApiModelProperty(value = "是否早鸟报名")
@@ -73,7 +78,7 @@ public class TempDirectorTrainingCampDetail implements Serializable {
 
     @TableField("payment_date_")
     @ApiModelProperty(value = "缴费时间")
-    private String paymentDate;
+    private Date paymentDate;
 
     @TableField("job_")
     @ApiModelProperty(value = "职业")

+ 1 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/enums/OrderDetailTypeEnum.java

@@ -32,6 +32,7 @@ public enum OrderDetailTypeEnum implements BaseEnum<String, OrderDetailTypeEnum>
     CLOUD_TEACHER_PLUS("CLOUD_TEACHER_PLUS","云教练"),
     THEORY_COURSE("THEORY_COURSE", "小组课"),
     REPAIR("REPAIR", "乐器维修"),
+    DIRECTOR_TRAINING_CAMP("DIRECTOR_TRAINING_CAMP", "乐队指导训练营报名"),
     ORGAN_SHARE_PROFIT("ORGAN_SHARE_PROFIT", "分部分润");
 
     private String code;

+ 2 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/enums/OrderTypeEnum.java

@@ -39,7 +39,8 @@ public enum OrderTypeEnum implements BaseEnum<String, OrderTypeEnum> {
     MEMBER("MEMBER", "会员购买"),
     LIVE_BUY("LIVE_BUY", "直播购物"),
     SCHOOL_GOODS_PURCHASE("SCHOOL_GOODS_PURCHASE","学校商品采购"),
-    MALL_BUY("MALL_BUY", "商城购物");
+    MALL_BUY("MALL_BUY", "商城购物"),
+    DIRECTOR_TRAINING_CAMP("DIRECTOR_TRAINING_CAMP", "乐队指导训练营报名");
 
 
     private String code;

+ 24 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/wrapper/TempDirectorTrainingCampDetailWrapper.java

@@ -1,5 +1,6 @@
 package com.ym.mec.biz.dal.wrapper;
 
+import com.ym.mec.biz.dal.dto.PayParamBasicDto;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
@@ -12,6 +13,14 @@ public class TempDirectorTrainingCampDetailWrapper {
 
 
     @Data
+    @ApiModel("PayDto")
+    public static class PayDto extends PayParamBasicDto {
+
+        @ApiModelProperty(value = "训练营详情编号",required = false)
+        private Integer tempDirectorTrainingCampDetailId;
+    }
+
+    @Data
     @ApiModel("UserDetail")
     public static class UserDetail {
 
@@ -24,6 +33,21 @@ public class TempDirectorTrainingCampDetailWrapper {
         @ApiModelProperty(value = "训练营编号")
         private Integer tempDirectorTrainingCampId;
     }
+
+    @Data
+    @ApiModel("UserPayDetail")
+    public static class UserPayDetail {
+
+        @ApiModelProperty(value = "身份证号")
+        private String username;
+
+        @ApiModelProperty(value = "手机号")
+        private String mobile;
+
+        @ApiModelProperty(value = "训练营编号")
+        private Integer tempDirectorTrainingCampId;
+    }
+
     @Data
     @ApiModel(" applyCamp-新增/修改")
     public static class ApplyCamp {

+ 7 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/TempDirectorTrainingCampDetailService.java

@@ -2,14 +2,20 @@ package com.ym.mec.biz.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.ym.mec.biz.dal.dao.TempDirectorTrainingCampDetailDao;
+import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
 import com.ym.mec.biz.dal.entity.TempDirectorTrainingCampDetail;
 import com.ym.mec.biz.dal.wrapper.TempDirectorTrainingCampDetailWrapper;
+import com.ym.mec.common.entity.HttpResponseResult;
 
 public interface TempDirectorTrainingCampDetailService extends IService<TempDirectorTrainingCampDetail> {
 
     TempDirectorTrainingCampDetailDao getDao();
 
-    void applyCamp(TempDirectorTrainingCampDetailWrapper.ApplyCamp applyCamp);
+    Integer applyCamp(TempDirectorTrainingCampDetailWrapper.ApplyCamp applyCamp);
+
+    HttpResponseResult pay(TempDirectorTrainingCampDetailWrapper.PayDto payDto) throws Exception;
+
+    Boolean orderCallback(StudentPaymentOrder order);
 }
 
 

+ 4 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentPaymentOrderServiceImpl.java

@@ -145,6 +145,8 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
     @Resource
     private StudentPaymentOrderService studentPaymentOrderService;
     @Resource
+    private TempDirectorTrainingCampDetailService tempDirectorTrainingCampDetailService;
+    @Resource
     private MusicGroupPaymentCalenderAddressService musicGroupPaymentCalenderAddressService;
 
     private final Logger logger = LoggerFactory.getLogger(this.getClass());
@@ -644,6 +646,8 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
             } else if (order.getType().equals(OrderTypeEnum.MALL_BUY)) {
                 // 商城购买订单回调
                 studentPaymentOrderService.mallBuyOrderCallback(order);
+            }else if (order.getType().equals(OrderTypeEnum.DIRECTOR_TRAINING_CAMP)) {
+                tempDirectorTrainingCampDetailService.orderCallback(order);
             }
         }
     }

+ 233 - 12
mec-biz/src/main/java/com/ym/mec/biz/service/impl/TempDirectorTrainingCampDetailServiceImpl.java

@@ -2,24 +2,38 @@ package com.ym.mec.biz.service.impl;
 
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ym.mec.auth.api.client.SysUserFeignService;
+import com.ym.mec.auth.api.entity.SysUser;
+import com.ym.mec.auth.api.enums.YesOrNoEnum;
+import com.ym.mec.biz.dal.dao.StudentPaymentOrderDetailDao;
+import com.ym.mec.biz.dal.dao.SysConfigDao;
+import com.ym.mec.biz.dal.dao.TeacherDao;
 import com.ym.mec.biz.dal.dao.TempDirectorTrainingCampDetailDao;
-import com.ym.mec.biz.dal.entity.TempDirectorTrainingCamp;
-import com.ym.mec.biz.dal.entity.TempDirectorTrainingCampDetail;
+import com.ym.mec.biz.dal.entity.*;
+import com.ym.mec.biz.dal.enums.*;
 import com.ym.mec.biz.dal.wrapper.TempDirectorTrainingCampDetailWrapper;
-import com.ym.mec.biz.service.SmsCodeService;
-import com.ym.mec.biz.service.TempDirectorTrainingCampDetailService;
-import com.ym.mec.biz.service.TempDirectorTrainingCampService;
+import com.ym.mec.biz.service.*;
+import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.exception.BizException;
+import com.ym.mec.common.service.IdGeneratorService;
 import com.ym.mec.util.date.DateUtil;
+import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
+import org.redisson.api.RBucket;
+import org.redisson.api.RedissonClient;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.http.HttpStatus;
+import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
-import java.util.Date;
-import java.util.Objects;
+import java.math.BigDecimal;
+import java.text.MessageFormat;
+import java.util.*;
+import java.util.concurrent.TimeUnit;
 
 @Service("tempDirectorTrainingCampDetailService")
 public class TempDirectorTrainingCampDetailServiceImpl extends ServiceImpl<TempDirectorTrainingCampDetailDao, TempDirectorTrainingCampDetail> implements TempDirectorTrainingCampDetailService {
@@ -30,17 +44,31 @@ public class TempDirectorTrainingCampDetailServiceImpl extends ServiceImpl<TempD
     private SmsCodeService smsCodeService;
     @Resource
     private TempDirectorTrainingCampService tempDirectorTrainingCampService;
+    @Resource
+    private RedissonClient redissonClient;
+    @Resource
+    private StudentPaymentOrderService studentPaymentOrderService;
+    @Resource
+    private StudentPaymentOrderDetailDao studentPaymentOrderDetailDao;
+    @Resource
+    private IdGeneratorService idGeneratorService;
+    @Resource
+    private TeacherDao teacherDao;
+    @Resource
+    private SysUserFeignService sysUserFeignService;
+    @Resource
+    private SysConfigDao sysConfigDao;
+    @Resource
+    private PayService payService;
+    @Resource
+    private SysUserCashAccountService sysUserCashAccountService;
 
     @Override
     public TempDirectorTrainingCampDetailDao getDao() {
         return this.baseMapper;
     }
 
-    @Override
-    @Transactional(rollbackFor = Exception.class)
-    public void applyCamp(TempDirectorTrainingCampDetailWrapper.ApplyCamp applyCamp) {
-        Date now = new Date();
-        TempDirectorTrainingCamp trainingCamp = tempDirectorTrainingCampService.getById(applyCamp.getTempDirectorTrainingCampId());
+    private void checkTraining(Date now,TempDirectorTrainingCamp trainingCamp){
         if(Objects.isNull(trainingCamp)){
             throw new BizException("训练营信息不存在");
         }
@@ -52,15 +80,30 @@ public class TempDirectorTrainingCampDetailServiceImpl extends ServiceImpl<TempD
             String dateToString = DateUtil.dateToString(trainingCamp.getApplyStartDate(), DateUtil.DATE_FORMAT_MIN);
             throw new BizException(dateToString + "开启报名,感谢您的关注");
         }
+    }
 
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public Integer applyCamp(TempDirectorTrainingCampDetailWrapper.ApplyCamp applyCamp) {
+        Date now = new Date();
+        TempDirectorTrainingCamp trainingCamp = tempDirectorTrainingCampService.getById(applyCamp.getTempDirectorTrainingCampId());
+        this.checkTraining(now,trainingCamp);
         if(!smsCodeService.verifyValidCode(applyCamp.getMobile(), applyCamp.getAuthCode())){
             throw new BizException("验证码校验失败");
         }
+        String lockKey = applyCamp.getTempDirectorTrainingCampId() + applyCamp.getMobile() + applyCamp.getCardNo();
+        String submitLockKey = MessageFormat.format("apply_director_camp_lock:{0}", lockKey);
+        // 数据重复提交校验
+        RBucket<Object> bucket = redissonClient.getBucket(submitLockKey);
+        if (!bucket.trySet(lockKey, 5L, TimeUnit.SECONDS)) {
+            throw new BizException("请勿重复提交");
+        }
         //根据身份证号获取信息
         TempDirectorTrainingCampDetail byCardNo = this.lambdaQuery().eq(TempDirectorTrainingCampDetail::getCardNo, applyCamp.getCardNo())
                 .eq(TempDirectorTrainingCampDetail::getTempDirectorTrainingCampId, applyCamp.getTempDirectorTrainingCampId())
                 .last("LIMIT 1").one();
         if(Objects.nonNull(byCardNo) && !StringUtils.equals(byCardNo.getMobile(),applyCamp.getMobile())){
+            redissonClient.getBucket(submitLockKey).delete();
             throw new BizException("该身份证已报名");
         }
         //根据手机号获取信息
@@ -68,6 +111,8 @@ public class TempDirectorTrainingCampDetailServiceImpl extends ServiceImpl<TempD
                 .eq(TempDirectorTrainingCampDetail::getTempDirectorTrainingCampId, applyCamp.getTempDirectorTrainingCampId())
                 .last("LIMIT 1").one();
         if(Objects.nonNull(byMobile) && !StringUtils.equals(byMobile.getCardNo(),applyCamp.getCardNo())){
+            // 删除缓存锁
+            redissonClient.getBucket(submitLockKey).delete();
             throw new BizException("该手机号已报名");
         }
         TempDirectorTrainingCampDetail entity = JSONObject.parseObject(JSONObject.toJSONString(applyCamp),TempDirectorTrainingCampDetail.class);
@@ -76,7 +121,183 @@ public class TempDirectorTrainingCampDetailServiceImpl extends ServiceImpl<TempD
         }else if (Objects.nonNull(byMobile)){
             entity.setId(byMobile.getId());
         }
+        //获取老师信息
+        SysUser sysUser = sysUserFeignService.queryUserByMobile(entity.getMobile());
+        if(Objects.isNull(sysUser) || sysUser.getId() == null){
+            //注册用户信息
+            sysUser = new SysUser();
+            sysUser.setUserType("TEACHER");
+            sysUser.setUsername(applyCamp.getUsername());
+            sysUser.setPhone(applyCamp.getMobile());
+            sysUser.setOrganId(43);
+            sysUser.setTenantId(1);
+            sysUser.setIdCardNo(applyCamp.getCardNo());
+            int phoneStrLen = sysUser.getPhone().length();
+            sysUser.setPassword(new BCryptPasswordEncoder().encode("gym" + sysUser.getPhone().substring(phoneStrLen - 4, phoneStrLen)));
+            teacherDao.addSysUser(sysUser);
+            //添加用户现金账户
+            sysUserCashAccountService.insert(new SysUserCashAccount(sysUser.getId(), "CNY"));
+            //注册老师信息
+            Teacher teacher = new Teacher();
+            teacher.setId(sysUser.getId());
+            teacher.setOrganId(43);
+            teacher.setTenantId(1);
+            teacher.setDelFlag(YesOrNoEnum.NO);
+            teacherDao.insert(teacher);
+        }else {
+            if (sysUser.getUserType().contains("SCHOOL")) {
+                throw new BizException("用户已存在学校账户");
+            }
+            Teacher teacher = teacherDao.get(sysUser.getId());
+            if(Objects.isNull(teacher)){
+                //注册老师信息
+                teacher = new Teacher();
+                teacher.setId(sysUser.getId());
+                teacher.setOrganId(43);
+                teacher.setTenantId(1);
+                teacher.setDelFlag(YesOrNoEnum.NO);
+                teacherDao.insert(teacher);
+            }
+            sysUser.setUserType(sysUser.getUserType() + ",TEACHER");
+        }
         this.saveOrUpdate(entity);
+        // 删除缓存锁
+        redissonClient.getBucket(submitLockKey).delete();
+        return entity.getId();
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public HttpResponseResult pay(TempDirectorTrainingCampDetailWrapper.PayDto payDto) throws Exception {
+        Integer tempDirectorTrainingCampDetailId = payDto.getTempDirectorTrainingCampDetailId();
+        TempDirectorTrainingCampDetail campDetail = this.lambdaQuery().eq(TempDirectorTrainingCampDetail::getId, tempDirectorTrainingCampDetailId)
+                .last("LIMIT 1 FOR UPDATE").one();
+        if(Objects.isNull(campDetail)){
+            throw new BizException("报名信息不存在");
+        }
+        if(StringUtils.equals(campDetail.getPaymentStatus(),"PAID")){
+            throw new BizException("您已缴费请勿重复支付");
+        }
+        Date now = new Date();
+        TempDirectorTrainingCamp trainingCamp = tempDirectorTrainingCampService.getById(campDetail.getTempDirectorTrainingCampId());
+        this.checkTraining(now,trainingCamp);
+        List<StudentPaymentOrder> studentPaymentOrders = studentPaymentOrderService.queryByCondition(GroupType.SPORADIC,
+                tempDirectorTrainingCampDetailId.toString(),
+                campDetail.getUserId(),
+                DealStatusEnum.ING,
+                OrderTypeEnum.DIRECTOR_TRAINING_CAMP);
+        if(CollectionUtils.isNotEmpty(studentPaymentOrders)){
+            HttpResponseResult result = studentPaymentOrderService.checkRepeatPay(studentPaymentOrders.get(0), payDto.getRepeatPay());
+            if (result.getCode() != 200) {
+                return result;
+            }
+        }
+        Date nowDate = new Date();
+        String orderNo = idGeneratorService.generatorId("payment") + "";
+        //获取收费项价格
+        BigDecimal money;
+        if(trainingCamp.getBirdPrice() != null && trainingCamp.getBirdPriceEndDate() != null && trainingCamp.getBirdPriceEndDate().after(now)){
+            money = trainingCamp.getBirdPrice();
+        }else {
+            money = trainingCamp.getCurrentPrice();
+        }
+        if(money.compareTo(payDto.getAmount()) != 0){
+            throw new BizException("活动信息变更,请重新下单");
+        }
+        Integer userId = campDetail.getUserId();
+        Teacher teacher = teacherDao.get(userId);
+        String channelType = "";
+        StudentPaymentOrder studentPaymentOrder = new StudentPaymentOrder();
+        studentPaymentOrder.setUserId(userId);
+        studentPaymentOrder.setGroupType(GroupType.SPORADIC);
+        studentPaymentOrder.setOrderNo(orderNo);
+        studentPaymentOrder.setType(OrderTypeEnum.DIRECTOR_TRAINING_CAMP);
+        studentPaymentOrder.setExpectAmount(money);
+        studentPaymentOrder.setActualAmount(money);
+        studentPaymentOrder.setBalancePaymentAmount(BigDecimal.ZERO);
+        studentPaymentOrder.setStatus(DealStatusEnum.ING);
+        studentPaymentOrder.setMusicGroupId(payDto.getTempDirectorTrainingCampDetailId().toString());
+        studentPaymentOrder.setOrganId(teacher.getOrganId());
+        studentPaymentOrder.setRoutingOrganId(teacher.getOrganId());
+        studentPaymentOrder.setVersion(0);
+        studentPaymentOrderService.insert(studentPaymentOrder);
+
+        StudentPaymentOrderDetail studentPaymentOrderDetail = new StudentPaymentOrderDetail();
+        studentPaymentOrderDetail.setType(OrderDetailTypeEnum.DIRECTOR_TRAINING_CAMP);
+        studentPaymentOrderDetail.setPrice(studentPaymentOrder.getExpectAmount());
+        studentPaymentOrderDetail.setRemitFee(BigDecimal.ZERO);
+        studentPaymentOrderDetail.setPaymentOrderId(studentPaymentOrder.getId());
+        studentPaymentOrderDetail.setCreateTime(nowDate);
+        studentPaymentOrderDetail.setUpdateTime(nowDate);
+        studentPaymentOrderDetailDao.insert(studentPaymentOrderDetail);
+
+        if (money.compareTo(BigDecimal.ZERO) == 0) {
+            Map<String, String> notifyMap = new HashMap<>();
+            notifyMap.put("tradeState", "1");
+            notifyMap.put("merOrderNo", studentPaymentOrder.getOrderNo());
+            notifyMap.put("channelType", channelType);
+            notifyMap.put("orderNo", "");
+            studentPaymentOrderService.updateOrder(notifyMap);
+            return BaseController.failed(HttpStatus.CREATED, notifyMap,"恭喜您,支付成功!");
+        }
+
+        String baseApiUrl = sysConfigDao.findConfigValue(SysConfigService.BASE_API_URL);
+
+        Map payMap = payService.getPayMap(
+                money,
+                BigDecimal.ZERO,
+                orderNo,
+                baseApiUrl + "/api-student/studentOrder/paymentResult?orderNo=" + orderNo,
+                "乐队指导训练营报名",
+                "乐队指导训练营报名",
+                teacher.getOrganId(),
+                "directorTrainingCamp"
+        );
+
+        studentPaymentOrder.setOrganId(teacher.getOrganId());
+        studentPaymentOrder.setMerNos((String) payMap.get("routingMerNos"));
+        studentPaymentOrder.setPaymentChannel((String) payMap.get("type"));
+        studentPaymentOrder.setUpdateTime(nowDate);
+        studentPaymentOrderService.update(studentPaymentOrder);
+        return BaseController.succeed(payMap);
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public Boolean orderCallback(StudentPaymentOrder studentPaymentOrder) {
+        int updateCount = studentPaymentOrderService.update(studentPaymentOrder);
+        if (updateCount <= 0) {
+            throw new BizException("订单更新失败");
+        }
+        if(DealStatusEnum.SUCCESS.equals(studentPaymentOrder.getStatus())){
+            List<StudentPaymentOrderDetail> orderDetails = studentPaymentOrderDetailDao.getOrderDetail(studentPaymentOrder.getId());
+            BigDecimal additionCoursePrice = BigDecimal.ZERO;
+            if(!org.springframework.util.CollectionUtils.isEmpty(orderDetails)){
+                additionCoursePrice = orderDetails.stream().map(StudentPaymentOrderDetail::getPrice).reduce(BigDecimal.ZERO, BigDecimal::add);
+            }
+            if(additionCoursePrice.compareTo(BigDecimal.ZERO)>0){
+                sysUserCashAccountService.appendCourseBalance(studentPaymentOrder.getUserId(), additionCoursePrice, PlatformCashAccountDetailTypeEnum.RECHARGE, "2020考级报名");
+            }
+        }
+
+        if (studentPaymentOrder.getStatus() == DealStatusEnum.CLOSE || studentPaymentOrder.getStatus() == DealStatusEnum.FAILED) {
+            if (studentPaymentOrder.getBalancePaymentAmount() != null && studentPaymentOrder.getBalancePaymentAmount().compareTo(BigDecimal.ZERO) > 0) {
+                sysUserCashAccountService.updateBalance(studentPaymentOrder.getUserId(), studentPaymentOrder.getBalancePaymentAmount(), PlatformCashAccountDetailTypeEnum.REFUNDS, "支付失败-退回");
+            }
+        }
+        TempDirectorTrainingCampDetail campDetail = this.getById(studentPaymentOrder.getMusicGroupId());
+        campDetail.setPaymentAmount(studentPaymentOrder.getActualAmount());
+        campDetail.setPaymentDate(studentPaymentOrder.getPayTime());
+        switch (studentPaymentOrder.getStatus()){
+            case SUCCESS:
+                campDetail.setPaymentStatus("PAID");
+                break;
+            case FAILED:
+            case CLOSE:
+                campDetail.setPaymentStatus("NO");
+                break;
+        }
+        return true;
     }