|
@@ -1,21 +1,18 @@
|
|
|
package com.ym.mec.student.controller;
|
|
|
|
|
|
-import com.ym.mec.biz.dal.dao.StudentPaymentOrderDao;
|
|
|
+import com.ym.mec.auth.api.client.SysUserFeignService;
|
|
|
+import com.ym.mec.auth.api.entity.SysUser;
|
|
|
import com.ym.mec.biz.dal.dao.SysConfigDao;
|
|
|
-import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
|
|
|
-import com.ym.mec.biz.dal.enums.DealStatusEnum;
|
|
|
-import com.ym.mec.biz.dal.enums.PayStatus;
|
|
|
-import com.ym.mec.biz.dal.enums.PlatformCashAccountDetailTypeEnum;
|
|
|
+import com.ym.mec.biz.dal.entity.MemberRankSetting;
|
|
|
+import com.ym.mec.biz.dal.enums.PeriodEnum;
|
|
|
+import com.ym.mec.biz.dal.page.CloudTeacherOrderQueryInfo;
|
|
|
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.util.date.DateUtil;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
-
|
|
|
-import java.math.BigDecimal;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.List;
|
|
|
-
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.http.HttpStatus;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
@@ -23,12 +20,9 @@ import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
-import com.ym.mec.auth.api.client.SysUserFeignService;
|
|
|
-import com.ym.mec.auth.api.entity.SysUser;
|
|
|
-import com.ym.mec.biz.dal.entity.MemberRankSetting;
|
|
|
-import com.ym.mec.biz.dal.enums.PeriodEnum;
|
|
|
-import com.ym.mec.biz.dal.page.CloudTeacherOrderQueryInfo;
|
|
|
-import com.ym.mec.common.controller.BaseController;
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
|
|
|
@RequestMapping("memberRank")
|
|
|
@Api(tags = "会员收费设置服务")
|
|
@@ -51,12 +45,6 @@ public class MemberRankController extends BaseController {
|
|
|
private SysUserFeignService sysUserFeignService;
|
|
|
|
|
|
@Autowired
|
|
|
- private StudentPaymentOrderService studentPaymentOrderService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private SysUserCashAccountService sysUserCashAccountService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
private SysConfigDao sysConfigDao;
|
|
|
|
|
|
@ApiOperation(value = "获取所有的收费标准")
|
|
@@ -88,7 +76,7 @@ public class MemberRankController extends BaseController {
|
|
|
|
|
|
@ApiOperation(value = "2021-09活动购买会员")
|
|
|
@PostMapping("/activeBuy")
|
|
|
- public Object ActiveBuy(Integer memberRankId, Integer buyNum, BigDecimal amount, boolean isUseBalance,boolean repay) throws Exception {
|
|
|
+ public HttpResponseResult ActiveBuy(Integer memberRankId, Integer buyNum, BigDecimal amount, boolean isUseBalance, boolean repay) throws Exception {
|
|
|
Date nowTime = new Date();
|
|
|
String startTimeStr = sysConfigDao.findConfigValue("cloud_teacher_active_start_time");
|
|
|
Date startTime = DateUtil.stringToDate(startTimeStr);
|
|
@@ -107,28 +95,14 @@ public class MemberRankController extends BaseController {
|
|
|
//买2赠1、买3赠2
|
|
|
int giveNum = buyNum == 2?1:buyNum == 3?2:0;
|
|
|
String remark = buyNum == 2?"2赠1":buyNum == 3?"3赠2":buyNum == 1?"单月":"其他";
|
|
|
- //判断用户是否已存在订单
|
|
|
- StudentPaymentOrder applyOrder = studentPaymentOrderService.findByUserAndActive(sysUser.getId(),202109,remark,"ING");
|
|
|
- if (applyOrder != null) {
|
|
|
- // 查询订单状态
|
|
|
- PayStatus payStatus = studentPaymentOrderService.queryPayStatus(applyOrder.getPaymentChannel(), applyOrder.getOrderNo(), applyOrder.getTransNo());
|
|
|
- if(payStatus == PayStatus.SUCCESSED){
|
|
|
- throw new BizException("订单已支付成功,请勿重复支付");
|
|
|
- }else if(payStatus == PayStatus.PAYING){
|
|
|
- throw new BizException("订单还在交易中,请稍后重试");
|
|
|
- }
|
|
|
- if(!repay){
|
|
|
- return failed(HttpStatus.CONTINUE, "您有待支付的订单");
|
|
|
- }
|
|
|
- }
|
|
|
- return succeed(memberRankSettingService.ActiveBuy(sysUser.getId(),
|
|
|
+ return memberRankSettingService.ActiveBuy(sysUser.getId(),
|
|
|
memberRankId,
|
|
|
PeriodEnum.MONTH,
|
|
|
amount,
|
|
|
isUseBalance,
|
|
|
buyNum,
|
|
|
giveNum,
|
|
|
- 202109,remark,repay));
|
|
|
+ 202109,remark,repay);
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "查询订单列表")
|