소스 검색

手动开启缴费时变更缴费状态,只有开启了缴费的项目才能变更缴费状态

zouxuan 4 년 전
부모
커밋
5f76ff5382

+ 5 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderDetailServiceImpl.java

@@ -157,6 +157,11 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
 		Set<Integer> studentIds = calenderDetails.stream().map(e -> e.getUserId()).collect(Collectors.toSet());
 		//推送消息
 		if (calender.getPayUserType() == STUDENT && studentIds.size() > 0) {
+			//将0元未缴费学员缴费状态更新为已缴费
+			int j = musicGroupPaymentCalenderDetailDao.updateNoPaymentAndZeroPaymentStatus(calender.getId());
+			calender.setActualNum((calender.getActualNum()==null?0:calender.getActualNum()) + j);
+			musicGroupPaymentCalenderDao.update(calender);
+
 			Map<Integer, String> push = new HashMap<>();
 			for (Integer userId : studentIds) {
 				push.put(userId, userId + "");

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

@@ -512,7 +512,10 @@
 	</select>
 
     <update id="updateNoPaymentAndZeroPaymentStatus">
-		UPDATE music_group_payment_calender_detail SET payment_status_ = 'PAID_COMPLETED',actual_amount_ = 0,update_time_ = NOW()
-		WHERE music_group_payment_calender_id_ = #{calenderId} AND expect_amount_ = 0 AND payment_status_ = 'NON_PAYMENT'
+		UPDATE music_group_payment_calender_detail mgpcd
+		LEFT JOIN music_group_payment_calender mgpc ON mgpc.id_ = mgpcd.music_group_payment_calender_id_
+		SET mgpcd.payment_status_ = 'PAID_COMPLETED',mgpcd.actual_amount_ = 0,mgpcd.update_time_ = NOW()
+		WHERE mgpcd.music_group_payment_calender_id_ = #{calenderId} AND mgpcd.expect_amount_ = 0
+		AND mgpcd.payment_status_ = 'NON_PAYMENT' AND (mgpcd.open_ = 0 OR mgpc.status_ = 'OPEN')
 	</update>
 </mapper>