Selaa lähdekoodia

Merge remote-tracking branch 'origin/master'

Joe 5 vuotta sitten
vanhempi
commit
3c556c5db9

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupPaymentCalenderDetailDao.java

@@ -69,7 +69,7 @@ public interface MusicGroupPaymentCalenderDetailDao extends BaseDAO<Long, MusicG
 	List<MusicGroupPaymentCalenderDetail> queryCanOpenList(@Param("ids") String ids);
 
 	/**
-	 * 当前用户所在乐团
+	 * 当前用户是否有进行中的订单
 	 * @param musicGroupId
 	 * @param userId
 	 * @return

+ 10 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderDetailServiceImpl.java

@@ -1,6 +1,7 @@
 package com.ym.mec.biz.service.impl;
 
 import com.ym.mec.biz.dal.dao.MusicGroupDao;
+import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderDao;
 import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderDetailDao;
 import com.ym.mec.biz.dal.dao.MusicGroupStudentFeeDao;
 import com.ym.mec.biz.dal.dto.SimpleUserDto;
@@ -32,6 +33,8 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
 	@Autowired
 	private MusicGroupPaymentCalenderDetailDao musicGroupPaymentCalenderDetailDao;
 	@Autowired
+	private MusicGroupPaymentCalenderDao musicGroupPaymentCalenderDao;
+	@Autowired
 	private MusicGroupDao musicGroupDao;
 	@Autowired
 	private MusicGroupStudentFeeDao musicGroupStudentFeeDao;
@@ -78,15 +81,19 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
 			return;
 		}
 		Date date = new Date();
-		/*Iterator<MusicGroupPaymentCalenderDetail> iterator = calenderDetails.iterator();
+		Iterator<MusicGroupPaymentCalenderDetail> iterator = calenderDetails.iterator();
 		MusicGroupPaymentCalenderDetail next;
 		while(iterator.hasNext()){
 			next = iterator.next();
+			int count1 = musicGroupPaymentCalenderDao.queryIntersectionByPaymentDate(next.getMusicGroupId(),date,date);
 			int count = musicGroupPaymentCalenderDetailDao.queryIntersectionByPaymentDate(next.getMusicGroupId(),next.getUserId());
-			if(count > 0){
+			if(count > 0 || count1 > 0){
 				iterator.remove();
 			}
-		}*/
+		}
+		if(calenderDetails.size() == 0){
+			return;
+		}
 		String musicGroupId = calenderDetails.get(0).getMusicGroupId();
 		calenderDetails.forEach(e->{
 			e.setUpdateTime(date);

+ 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) {

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

@@ -225,7 +225,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">
@@ -239,7 +240,6 @@
 		SELECT COUNT(mgpcd.id_) 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.start_payment_date_ BETWEEN NOW() AND NOW()
-		OR mgpcd.deadline_payment_date_ BETWEEN NOW() AND NOW())
+		AND  mgpcd.open_ = 1
 	</select>
 </mapper>

+ 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 = "退团")