zouxuan 3 年之前
父節點
當前提交
fd1ecc8708

+ 19 - 12
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderServiceImpl.java

@@ -467,9 +467,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 					musicGroupPaymentCalenderDetailService.batchAdd(musicGroupPaymentCalender.getId(),list2,musicGroup,false);
 				}
 				//将0元未缴费学员缴费状态更新为已缴费
-				int j = musicGroupPaymentCalenderDetailDao.updateNoPaymentAndZeroPaymentStatus(musicGroupPaymentCalender.getId());
-				musicGroupPaymentCalender.setActualNum((musicGroupPaymentCalender.getActualNum()==null?0:musicGroupPaymentCalender.getActualNum()) + j);
-				musicGroupPaymentCalenderDao.update(musicGroupPaymentCalender);
+				this.updateNoPaymentAndZeroPaymentStatus(musicGroupPaymentCalender,true);
 			}
 		}
 
@@ -1044,9 +1042,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 					musicGroupPaymentCalenderDetailService.batchAdd(musicGroupPaymentCalender,musicGroupPaymentCalenderDto.getMusicGroupPaymentCalenderStudentDetails());
 				}
 				//将0元未缴费学员缴费状态更新为已缴费
-				int j = musicGroupPaymentCalenderDetailDao.updateNoPaymentAndZeroPaymentStatus(musicGroupPaymentCalender.getId());
-				musicGroupPaymentCalender.setActualNum((musicGroupPaymentCalender.getActualNum()==null?0:musicGroupPaymentCalender.getActualNum()) + j);
-				musicGroupPaymentCalenderDao.update(musicGroupPaymentCalender);
+				this.updateNoPaymentAndZeroPaymentStatus(musicGroupPaymentCalender,true);
 			}
 
 			//课程费用列表
@@ -1109,6 +1105,20 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 		return batchNo;
 	}
 
+	//将0元未缴费学员缴费状态更新为已缴费
+	@Transactional(rollbackFor = Exception.class)
+	public void updateNoPaymentAndZeroPaymentStatus(MusicGroupPaymentCalender musicGroupPaymentCalender,Boolean updateFlag){
+		if(musicGroupPaymentCalender.getCurrentTotalAmount().compareTo(BigDecimal.ZERO) == 0){
+			int j = musicGroupPaymentCalenderDetailDao.updateNoPaymentAndZeroPaymentStatus(musicGroupPaymentCalender.getId());
+			if(j > 0){
+				musicGroupPaymentCalender.setActualNum((musicGroupPaymentCalender.getActualNum()==null?0:musicGroupPaymentCalender.getActualNum()) + j);
+				if(updateFlag){
+					musicGroupPaymentCalenderDao.update(musicGroupPaymentCalender);
+				}
+			}
+		}
+	}
+
 	@Override
 	public boolean makesureSchoolePaid(Long id, String memo) {
 		MusicGroupPaymentCalender musicGroupPaymentCalender = musicGroupPaymentCalenderDao.get(id);
@@ -1536,8 +1546,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 			}
 			for (MusicGroupPaymentCalender musicGroupPaymentCalender : musicGroupPaymentCalenders) {
 				//将0元未缴费学员缴费状态更新为已缴费
-				int j = musicGroupPaymentCalenderDetailDao.updateNoPaymentAndZeroPaymentStatus(musicGroupPaymentCalender.getId());
-				musicGroupPaymentCalender.setActualNum((musicGroupPaymentCalender.getActualNum()==null?0:musicGroupPaymentCalender.getActualNum()) + j);
+				this.updateNoPaymentAndZeroPaymentStatus(musicGroupPaymentCalender,false);
 			}
 			musicGroupPaymentCalenderDao.batchUpdate(musicGroupPaymentCalenders);
 			if (calender.getPaymentType() == ADD_STUDENT){
@@ -1724,8 +1733,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 				mgpc.setUpdateTime(date);
 				mgpc.setStatus(PaymentCalenderStatusEnum.OVER);
 				//将0元未缴费学员缴费状态更新为已缴费
-				int i = musicGroupPaymentCalenderDetailDao.updateNoPaymentAndZeroPaymentStatus(mgpc.getId());
-				mgpc.setActualNum((mgpc.getActualNum()==null?0:mgpc.getActualNum()) + i);
+				this.updateNoPaymentAndZeroPaymentStatus(mgpc,false);
 				updateMusicGroupPaymentCalenderList.add(mgpc);
 				//如果是进行中加学员,将报名表状态改为NORMAL
 				if(mgpc.getPaymentType() == MusicGroupPaymentCalender.PaymentType.ADD_STUDENT){
@@ -1744,8 +1752,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 				mgpc.setUpdateTime(date);
 				mgpc.setStatus(PaymentCalenderStatusEnum.OPEN);
 				//将0元未缴费学员缴费状态更新为已缴费
-				int i = musicGroupPaymentCalenderDetailDao.updateNoPaymentAndZeroPaymentStatus(mgpc.getId());
-				mgpc.setActualNum((mgpc.getActualNum()==null?0:mgpc.getActualNum()) + i);
+				this.updateNoPaymentAndZeroPaymentStatus(mgpc,false);
 				updateMusicGroupPaymentCalenderList.add(mgpc);
 				if(mgpc.getPayUserType() == STUDENT){
 					//推送待续费通知

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

@@ -567,8 +567,8 @@
 
 	<update id="updateNoPaymentAndZeroPaymentStatus">
 		UPDATE music_group_payment_calender_detail mgpcd
-		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_ + mgpcd.expect_member_amount_) = 0
+		SET mgpcd.payment_status_ = 'PAID_COMPLETED',mgpcd.update_time_ = NOW()
+		WHERE mgpcd.music_group_payment_calender_id_ = #{calenderId}
 		AND mgpcd.payment_status_ = 'NON_PAYMENT'
 	</update>
 </mapper>

+ 0 - 5
mec-web/src/main/java/com/ym/mec/web/controller/MusicGroupPaymentCalenderController.java

@@ -1,12 +1,9 @@
 package com.ym.mec.web.controller;
 
 import com.ym.mec.auth.api.client.SysUserFeignService;
-import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.dao.ClassGroupStudentMapperDao;
-import com.ym.mec.biz.dal.dao.EmployeeDao;
 import com.ym.mec.biz.dal.dto.MusicGroupPaymentBaseCalender;
 import com.ym.mec.biz.dal.dto.MusicGroupPaymentCalenderDto;
-import com.ym.mec.biz.dal.entity.Employee;
 import com.ym.mec.biz.dal.entity.StudentRegistration;
 import com.ym.mec.biz.dal.enums.ClassGroupStudentStatusEnum;
 import com.ym.mec.biz.dal.page.MusicGroupPaymentCalenderQueryInfo;
@@ -38,8 +35,6 @@ public class MusicGroupPaymentCalenderController extends BaseController {
     private MusicGroupPaymentCalenderService musicGroupPaymentCalenderService;
     @Autowired
     private MusicGroupPaymentCalenderCourseSettingsService musicGroupPaymentCalenderCourseSettingsService;
-	@Autowired
-    private SysUserFeignService sysUserFeignService;
     @Autowired
     private OrganizationService organizationService;
     @Autowired