瀏覽代碼

update 修改续费回调逻辑

周箭河 5 年之前
父節點
當前提交
0ed6720b39

+ 12 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java

@@ -1596,7 +1596,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
                 studentPaymentOrder.setStatus(DealStatusEnum.SUCCESS);
                 studentPaymentOrder.setUpdateTime(date);
                 studentPaymentOrder.setOrganId(musicGroup.getOrganId());
-                studentPaymentOrder.setRoutingOrganId(42);
+                studentPaymentOrder.setRoutingOrganId(musicGroup.getOrganId());
                 studentPaymentOrderService.update(studentPaymentOrder);
 
                 sysUserCashAccountService.updateBalance(userId, amount.negate(), PlatformCashAccountDetailTypeEnum.PAY_FEE, "乐团续费");
@@ -1608,6 +1608,17 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
                 musicGroupStudentFee.setTemporaryCourseFee(new BigDecimal(0));
 //                musicGroupStudentFee.setNextPaymentDate(musicGroupPaymentCalenderService.getNextPaymentDate(musicGroupId, musicGroupStudentFee.getNextPaymentDate(), musicGroupStudentFee));
                 musicGroupStudentFeeDao.update(musicGroupStudentFee);
+                //更新学生的缴费记录状态
+                MusicGroupPaymentCalenderDetail userLastCalenderDetail = musicGroupPaymentCalenderDetailDao.getUserLastCalenderDetail(musicGroupId, userId);
+                if(userLastCalenderDetail == null){
+                    throw new BizException("学生没有续费中的记录");
+                }
+                //更新学生的缴费记录状态
+                userLastCalenderDetail.setPaymentStatus(PaymentStatus.PAID_COMPLETED);
+                userLastCalenderDetail.setActualAmount(userLastCalenderDetail.getExpectAmount());
+                userLastCalenderDetail.setPayTime(date);
+                userLastCalenderDetail.setUpdateTime(date);
+                musicGroupPaymentCalenderDetailDao.update(userLastCalenderDetail);
                 return null;
             } else {
                 if (userCashAccount.getBalance().doubleValue() > 0) {

+ 2 - 1
mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentCalenderDetailMapper.xml

@@ -214,7 +214,8 @@
 	<select id="getUserLastCalenderDetail" resultMap="MusicGroupPaymentCalenderDetail">
 		SELECT * FROM music_group_payment_calender_detail mgpcd
 		LEFT JOIN music_group_payment_calender mgpc ON mgpcd.music_group_payment_calender_id_ = mgpc.id_
-		WHERE mgpc.music_group_id_=#{musicGroupId} AND mgpcd.user_id_=#{userId} AND mgpcd.payment_status_ = 'PROCESSING'
+		WHERE mgpc.music_group_id_=#{musicGroupId} AND mgpcd.user_id_=#{userId} AND mgpcd.payment_status_ = 'NON_PAYMENT'
+		AND mgpc.payment_status_ = '1' OR mgpcd.open_=1
 		ORDER BY mgpc.start_payment_date_ DESC LIMIT 1
 	</select>
 	<select id="queryCanOpenList" resultMap="MusicGroupPaymentCalenderDetail">

+ 12 - 1
mec-student/src/main/java/com/ym/mec/student/controller/MusicGroupController.java

@@ -2,6 +2,7 @@ package com.ym.mec.student.controller;
 
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
+import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderDetailDao;
 import com.ym.mec.biz.dal.dao.MusicGroupStudentFeeDao;
 import com.ym.mec.biz.dal.dto.RegisterPayDto;
 import com.ym.mec.biz.dal.entity.*;
@@ -50,6 +51,8 @@ public class MusicGroupController extends BaseController {
     private MusicGroupStudentFeeDao musicGroupStudentFeeDao;
     @Autowired
     private StudentPaymentOrderDetailService studentPaymentOrderDetailService;
+    @Autowired
+    private MusicGroupPaymentCalenderDetailDao musicGroupPaymentCalenderDetailDao;
 
     @ApiOperation("获取学生所在乐团列表")
     @GetMapping(value = "/queryUserMusicGroups")
@@ -153,6 +156,10 @@ public class MusicGroupController extends BaseController {
         if (musicGroupStudentFee.getPaymentStatus() != PaymentStatus.NON_PAYMENT) {
             throw new BizException("已缴费");
         }
+        MusicGroupPaymentCalenderDetail userLastCalenderDetail = musicGroupPaymentCalenderDetailDao.getUserLastCalenderDetail(musicGroupId, userId);
+        if(userLastCalenderDetail == null){
+            throw new BizException("当前续费时间已截止,请联系指导老师");
+        }
 
         BigDecimal amount = musicGroupStudentFee.getTemporaryCourseFee();
         if (amount == null || amount.doubleValue() == 0) {
@@ -194,7 +201,11 @@ public class MusicGroupController extends BaseController {
 				return failed(HttpStatus.CONTINUE, "您有待支付的订单");
 			}
 		}
-		return succeed(musicGroupService.renew(musicGroupId, userId, isUseBalancePayment));
+        MusicGroupPaymentCalenderDetail userLastCalenderDetail = musicGroupPaymentCalenderDetailDao.getUserLastCalenderDetail(musicGroupId, userId);
+        if(userLastCalenderDetail == null){
+            throw new BizException("当前续费时间已截止,请联系指导老师");
+        }
+        return succeed(musicGroupService.renew(musicGroupId, userId, isUseBalancePayment));
 	}
 
     @ApiOperation(value = "退团")