Browse Source

Merge remote-tracking branch 'origin/master'

周箭河 4 years ago
parent
commit
e6e2c0b485

+ 0 - 8
mec-biz/src/main/java/com/ym/mec/biz/service/MusicGroupPaymentCalenderService.java

@@ -74,14 +74,6 @@ public interface MusicGroupPaymentCalenderService extends BaseService<Long, Musi
 	boolean deleteByBatchNo(String batchNo);
 
 	/**
-	 * 推送乐团缴费提醒
-	 * @param id
-	 * @param userIds
-	 * @return
-	 */
-	void paymentPush(Long id, String userIds);
-
-	/**
 	 * @describe 更新乐团学员缴费状态
 	 * @apiNote 时光荏苒,认真工作的时间总是过得很快,而我、享受这一刻!
 	 * @author zouxuan

+ 8 - 7
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderDetailServiceImpl.java

@@ -1,5 +1,6 @@
 package com.ym.mec.biz.service.impl;
 
+import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PayUserType.STUDENT;
 import static com.ym.mec.biz.dal.entity.MusicGroupStudentFee.PaymentStatus.NON_PAYMENT;
 
 import java.math.BigDecimal;
@@ -122,7 +123,7 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
 		}*/
 		musicGroupPaymentCalenderDetailDao.batchUpdate(calenderDetails);
 		//推送消息
-		if (studentIds.size() > 0) {
+		if (calender.getPayUserType() == STUDENT && studentIds.size() > 0) {
 			String musicGroupId = calenderDetails.get(0).getMusicGroupId();
 			Map<Integer, String> push = new HashMap<>();
 			for (Integer userId : studentIds) {
@@ -169,7 +170,7 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
 		musicGroupPaymentCalenderDetailDao.batchUpdate(calenderDetails);
 		Set<Integer> studentIds = calenderDetails.stream().map(e -> e.getUserId()).collect(Collectors.toSet());
 		//推送消息
-		if (studentIds.size() > 0) {
+		if (calender.getPayUserType() == STUDENT && studentIds.size() > 0) {
 			Map<Integer, String> push = new HashMap<>();
 			for (Integer userId : studentIds) {
 				push.put(userId, userId + "");
@@ -222,7 +223,7 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
 		List<MusicGroupPaymentCalenderCourseSettings> courseSettingsList = musicGroupPaymentCalenderCourseSettingsDao.getWithPaymentCalender(musicGroupPaymentCalenderId);
 		
 		BigDecimal totalPrice = new BigDecimal(0);
-		if (calender.getPayUserType() == PayUserType.STUDENT) {
+		if (calender.getPayUserType() == STUDENT) {
 			for (MusicGroupPaymentCalenderCourseSettings courseSettings : courseSettingsList) {
 				// 剔除可选课程
 				if (courseSettings.getIsStudentOptional() == false) {
@@ -302,7 +303,7 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
 		List<MusicGroupPaymentCalenderCourseSettings> courseSettingsList = musicGroupPaymentCalenderCourseSettingsDao.getWithPaymentCalender(musicGroupPaymentCalenderId);
 		
 		BigDecimal totalPrice = new BigDecimal(0);
-		if (musicGroupPaymentCalender.getPayUserType() == PayUserType.STUDENT) {
+		if (musicGroupPaymentCalender.getPayUserType() == STUDENT) {
 			for (MusicGroupPaymentCalenderCourseSettings courseSettings : courseSettingsList) {
 				// 剔除可选课程
 				if (courseSettings.getIsStudentOptional() == false) {
@@ -372,7 +373,7 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
 			musicGroupPaymentStudentCourseDetailDao.batchInsert(musicGroupPaymentStudentCourseDetailList);
 		}
 		//给学员推送缴费通知
-		if(musicGroupPaymentCalender.getStatus() == PaymentCalenderStatusEnum.OPEN){
+		if(musicGroupPaymentCalender.getPayUserType() == STUDENT && musicGroupPaymentCalender.getStatus() == PaymentCalenderStatusEnum.OPEN){
 			musicGroupPaymentCalenderService.pushWaitRenewMessage(musicGroupPaymentCalenderId,musicGroupDao.get(musicGroupPaymentCalender.getMusicGroupId()),userIdList);
 		}
 	}
@@ -410,7 +411,7 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
 			
 			BigDecimal totalPrice = new BigDecimal(0);
 			
-			if (musicGroupPaymentCalender.getPayUserType() == PayUserType.STUDENT) {
+			if (musicGroupPaymentCalender.getPayUserType() == STUDENT) {
 				for (MusicGroupPaymentCalenderCourseSettings courseSettings : courseSettingsList) {
 					// 剔除可选课程
 					if (courseSettings.getIsStudentOptional() == false) {
@@ -481,7 +482,7 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
 		}
 		//给学员推送缴费通知
 		for (MusicGroupPaymentCalender musicGroupPaymentCalender : musicGroupPaymentCalenderList) {
-			if (musicGroupPaymentCalender.getStatus() == PaymentCalenderStatusEnum.OPEN) {
+			if (musicGroupPaymentCalender.getPayUserType() == STUDENT && musicGroupPaymentCalender.getStatus() == PaymentCalenderStatusEnum.OPEN) {
 				musicGroupPaymentCalenderService.pushWaitRenewMessage(musicGroupPaymentCalenderId,
 						musicGroupDao.get(musicGroupPaymentCalender.getMusicGroupId()),userIdList);
 			}

+ 26 - 82
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderServiceImpl.java

@@ -252,7 +252,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 				if(dtoStatus != null && dtoStatus == AUDITING){
 					status = AUDITING;
 				}else {
-					// 如果是临时加课,是否审核是根据单价判断
+					// 如果是临时加课,判断是否审核
 					for (MusicGroupPaymentCalenderCourseSettings courseSettings : musicGroupPaymentCalenderCourseSettingsList) {
 						OrganizationCourseUnitPriceSettings defaultUnitPrice = organizationCourseUnitPriceSettingsDao.queryByOrganIdAndCourseTypeAndChargeType(
 								musicGroup.getOrganId(), courseSettings.getCourseType(), musicGroup.getChargeTypeId());
@@ -260,10 +260,10 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 							throw new BizException("请先设置分部课程类型单价");
 						}
 						if (courseSettings.getCourseTotalMinuties() != 0) {
-							if (courseSettings
-									.getCourseCurrentPrice()
-									.divide(new BigDecimal(courseSettings.getCourseTotalMinuties()), CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_DOWN)
-									.compareTo(defaultUnitPrice.getUnitPrice()) != 0) {
+							
+							if (defaultUnitPrice.getUnitPrice().multiply(new BigDecimal(courseSettings.getCourseTotalMinuties()))
+									.compareTo(courseSettings.getCourseCurrentPrice()) != 0) {
+
 								status = AUDITING;
 								break;
 							}
@@ -319,17 +319,17 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 						tempPccs.setCourseTotalMinuties(pccs.getCourseTotalMinuties());
 					} else {
 						tempPccs.setCourseCurrentPrice(pccs.getCourseCurrentPrice().subtract(
-								pccs.getCourseCurrentPrice().divide(new BigDecimal(times), 2, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(times - 1))
-										.setScale(2, BigDecimal.ROUND_DOWN)));
+								pccs.getCourseCurrentPrice().divide(new BigDecimal(times), 0, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(times - 1))
+										.setScale(0, BigDecimal.ROUND_DOWN)));
 						tempPccs.setCourseOriginalPrice(pccs.getCourseOriginalPrice().subtract(
-								pccs.getCourseOriginalPrice().divide(new BigDecimal(times), 2, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(times - 1))
-										.setScale(2, BigDecimal.ROUND_DOWN)));
+								pccs.getCourseOriginalPrice().divide(new BigDecimal(times), 0, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(times - 1))
+										.setScale(0, BigDecimal.ROUND_DOWN)));
 						tempPccs.setCourseTotalMinuties(pccs.getCourseTotalMinuties() - pccs.getCourseTotalMinuties() / times * (times - 1));
 					}
 				} else {
 					if (!pccs.getIsStudentOptional()) {
-						tempPccs.setCourseCurrentPrice(pccs.getCourseCurrentPrice().divide(new BigDecimal(times), 2, BigDecimal.ROUND_DOWN));
-						tempPccs.setCourseOriginalPrice(pccs.getCourseOriginalPrice().divide(new BigDecimal(times), 2, BigDecimal.ROUND_DOWN));
+						tempPccs.setCourseCurrentPrice(pccs.getCourseCurrentPrice().divide(new BigDecimal(times), 0, BigDecimal.ROUND_DOWN));
+						tempPccs.setCourseOriginalPrice(pccs.getCourseOriginalPrice().divide(new BigDecimal(times), 0, BigDecimal.ROUND_DOWN));
 						tempPccs.setCourseTotalMinuties(pccs.getCourseTotalMinuties() / times);
 					} else {
 						continue;
@@ -563,7 +563,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 					}
 				}
 			} else if (paymentType == PaymentType.ADD_COURSE || paymentType == PaymentType.ADD_STUDENT) {
-				// 如果是临时加课,是否审核是根据单价判断
+				// 如果是临时加课,判断是否审核
 				for (MusicGroupPaymentCalenderCourseSettings courseSettings : musicGroupPaymentCalenderCourseSettingsList) {
 					OrganizationCourseUnitPriceSettings defaultUnitPrice = organizationCourseUnitPriceSettingsDao.queryByOrganIdAndCourseTypeAndChargeType(
 							musicGroup.getOrganId(), courseSettings.getCourseType(), musicGroup.getChargeTypeId());
@@ -571,9 +571,9 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 						throw new BizException("请先设置分部课程类型单价");
 					}
 					if (courseSettings.getCourseTotalMinuties() != 0) {
-						if (courseSettings.getCourseCurrentPrice()
-								.divide(new BigDecimal(courseSettings.getCourseTotalMinuties()), CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_DOWN)
-								.compareTo(defaultUnitPrice.getUnitPrice()) != 0) {
+						if (defaultUnitPrice.getUnitPrice().multiply(new BigDecimal(courseSettings.getCourseTotalMinuties()))
+								.compareTo(courseSettings.getCourseCurrentPrice()) != 0) {
+
 							status = AUDITING;
 							break;
 						}
@@ -628,17 +628,17 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 						tempPccs.setCourseTotalMinuties(pccs.getCourseTotalMinuties());
 					} else {
 						tempPccs.setCourseCurrentPrice(pccs.getCourseCurrentPrice().subtract(
-								pccs.getCourseCurrentPrice().divide(new BigDecimal(times), 2, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(times - 1))
-										.setScale(2, BigDecimal.ROUND_DOWN)));
+								pccs.getCourseCurrentPrice().divide(new BigDecimal(times), 0, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(times - 1))
+										.setScale(0, BigDecimal.ROUND_DOWN)));
 						tempPccs.setCourseOriginalPrice(pccs.getCourseOriginalPrice().subtract(
-								pccs.getCourseOriginalPrice().divide(new BigDecimal(times), 2, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(times - 1))
-										.setScale(2, BigDecimal.ROUND_DOWN)));
+								pccs.getCourseOriginalPrice().divide(new BigDecimal(times), 0, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(times - 1))
+										.setScale(0, BigDecimal.ROUND_DOWN)));
 						tempPccs.setCourseTotalMinuties(pccs.getCourseTotalMinuties() - pccs.getCourseTotalMinuties() / times * (times - 1));
 					}
 				} else {
 					if (!pccs.getIsStudentOptional()) {
-						tempPccs.setCourseCurrentPrice(pccs.getCourseCurrentPrice().divide(new BigDecimal(times), 2, BigDecimal.ROUND_DOWN));
-						tempPccs.setCourseOriginalPrice(pccs.getCourseOriginalPrice().divide(new BigDecimal(times), 2, BigDecimal.ROUND_DOWN));
+						tempPccs.setCourseCurrentPrice(pccs.getCourseCurrentPrice().divide(new BigDecimal(times), 0, BigDecimal.ROUND_DOWN));
+						tempPccs.setCourseOriginalPrice(pccs.getCourseOriginalPrice().divide(new BigDecimal(times), 0, BigDecimal.ROUND_DOWN));
 						tempPccs.setCourseTotalMinuties(pccs.getCourseTotalMinuties() / times);
 					}
 				}
@@ -1158,8 +1158,10 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 				mgpc.setUpdateTime(date);
 				mgpc.setStatus(PaymentCalenderStatusEnum.OPEN);
 				updateMusicGroupPaymentCalenderList.add(mgpc);
-				//推送待续费通知
-				pushWaitRenewMessage(mgpc.getId(),musicGroup,null);
+				if(mgpc.getPayUserType() == STUDENT){
+					//推送待续费通知
+					pushWaitRenewMessage(mgpc.getId(),musicGroup,null);
+				}
 			}
 		}
 		if (updateMusicGroupPaymentCalenderList.size() > 0) {
@@ -1223,7 +1225,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 			musicGroupStudentFeeDao.updatePaymentStatus(calender.getId(), "NON_PAYMENT");
 			List<MusicGroupPaymentCalenderDetail> details = musicGroupPaymentCalenderDetailDao.queryByCalenderId(calender.getId(),null);
 			Set<Integer> studentIds = details.stream().map(e -> e.getUserId()).collect(Collectors.toSet());
-			if (studentIds.size() > 0) {
+			if (paymentCalender.getPayUserType() == STUDENT && studentIds.size() > 0) {
 				Map<Integer, String> push = new HashMap<>();
 				for (Integer userId : studentIds) {
 					push.put(userId, userId + "");
@@ -1257,9 +1259,6 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 		if (calender == null) {
 			throw new BizException("缴费信息不存在");
 		}
-		if(calender.getPaymentType() == MUSIC_APPLY){
-			throw new BizException("报名的缴费记录不能删除");
-		}
 		if (calender.getStatus() != PaymentCalenderStatusEnum.AUDITING && calender.getStatus() != PaymentCalenderStatusEnum.NO
 				&& calender.getStatus() != PaymentCalenderStatusEnum.REJECT) {
 			throw new BizException("删除失败,只有[审核中]、[拒绝]或[未开启缴费]状态才能删除");
@@ -1310,61 +1309,6 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 	}
 
 	@Override
-	public void paymentPush(Long id, String userIds) {
-		// 推送所有
-		if (StringUtils.isEmpty(userIds)) {
-			List<MusicGroupPaymentCalenderDetail> details = musicGroupPaymentCalenderDetailDao.queryCanPushList(id);
-			if (details == null || details.size() == 0) {
-				return;
-			}
-			String musicGroupId = details.get(0).getMusicGroupId();
-			Set<Integer> studentIds = details.stream().map(e -> e.getUserId()).collect(Collectors.toSet());
-			// 推送消息
-			if (studentIds.size() > 0) {
-				Map<Integer, String> push = new HashMap<>();
-				for (Integer userId : studentIds) {
-					push.put(userId, userId + "");
-				}
-				MusicGroup musicGroup = musicGroupDao.get(musicGroupId);
-				String baseUrl = sysConfigDao.findConfigValue(SysConfigService.BASE_API_URL);
-				String memo = "4?" + baseUrl + "/#/musicGroupRenew?calenderId="+id+"&id=" + musicGroupId;
-				// 发送续费通知
-				sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.STUDENT_PUSH_WAIT_RENEW_MESSAGE, push,
-						null, 0, memo, "STUDENT", musicGroup.getName());
-				//获取未缴费且不是0元的学员列表
-				Map<Integer,String> studentMaps = MapUtil.convertMybatisMap(musicGroupPaymentCalenderDetailDao.queryNoPaymentAndNotZeroStudent(id,studentIds));
-				if(studentMaps.size() > 0){
-					sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.AWSMS, MessageTypeEnum.STUDENT_PUSH_WAIT_RENEW_MESSAGE, studentMaps,
-							null, 0, memo, null, musicGroup.getName());
-				}
-			}
-		} else {
-			// 获取课推送列表
-			// 批量推送
-			MusicGroupPaymentCalender calender = musicGroupPaymentCalenderDao.get(id);
-			Set<String> studentIds = new HashSet<>(Arrays.asList(userIds.split(",")));
-			if (studentIds.size() > 0) {
-				Map<Integer, String> push = new HashMap<>();
-				for (String userId : studentIds) {
-					push.put(Integer.parseInt(userId), userId + "");
-				}
-				MusicGroup musicGroup = musicGroupDao.get(calender.getMusicGroupId());
-				String baseUrl = sysConfigDao.findConfigValue(SysConfigService.BASE_API_URL);
-				String memo = "4?" + baseUrl + "/#/musicGroupRenew?calenderId="+calender.getId()+"&id=" + calender.getMusicGroupId();
-				// 发送续费通知
-				sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.STUDENT_PUSH_WAIT_RENEW_MESSAGE, push,
-						null, 0, memo, "STUDENT", musicGroup.getName());
-				//获取未缴费且不是0元的学员列表
-				Map<Integer,String> studentMaps = MapUtil.convertMybatisMap(musicGroupPaymentCalenderDetailDao.queryNoPaymentAndNotZeroStudent(id,studentIds));
-				if(studentMaps.size() > 0){
-					sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.AWSMS, MessageTypeEnum.STUDENT_PUSH_WAIT_RENEW_MESSAGE, studentMaps,
-							null, 0, memo, null, musicGroup.getName());
-				}
-			}
-		}
-	}
-
-	@Override
 	public MusicGroupPaymentCalender findByMusicGroupRegCalender(String musicGroupId) {
 		return musicGroupPaymentCalenderDao.findByMusicGroupRegCalender(musicGroupId);
 	}

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

@@ -448,7 +448,7 @@
     </select>
 
     <select id="countClassStudent" resultType="int">
-        select count(*) from class_group_student_mapper
+        select count(*) from class_group_student_mapper cgsm
         where class_group_id_=#{classGroupId} AND cgsm.status_ != 'QUIT'
     </select>