소스 검색

Merge remote-tracking branch 'origin/master'

Joburgess 4 년 전
부모
커밋
0bf3c79d67

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

@@ -115,12 +115,12 @@ public interface MusicGroupPaymentCalenderDetailDao extends BaseDAO<Long, MusicG
 	void batchDel(String musicGroupPaymentCalenderIds);
 
 	/**
-	 * 删除未缴费的明细
+	 * 查询学生在指定乐团中未交费的记录
 	 *
 	 * @param userId
 	 * @param musicGroupId
 	 */
-	void deleteByUserIdAndMusicGroupId(@Param("userId") Integer userId, @Param("musicGroupId") String musicGroupId);
+	List<MusicGroupPaymentCalenderDetail> queryNotPaymentStudentByUserIdAndMusicGroupId(@Param("userId") Integer userId, @Param("musicGroupId") String musicGroupId);
 
 	/**
 	 * 根据缴费记录删除缴费详情

+ 52 - 7
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderServiceImpl.java

@@ -4,7 +4,11 @@ import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PayUserType.SC
 import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PayUserType.STUDENT;
 import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentCalenderStatusEnum.AUDITING;
 import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentCalenderStatusEnum.REJECT;
-import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentType.*;
+import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentType.ADD_COURSE;
+import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentType.ADD_STUDENT;
+import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentType.MUSIC_APPLY;
+import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentType.MUSIC_RENEW;
+import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentType.SPAN_GROUP_CLASS_ADJUST;
 
 import java.math.BigDecimal;
 import java.util.ArrayList;
@@ -20,10 +24,6 @@ import java.util.Map.Entry;
 import java.util.Set;
 import java.util.stream.Collectors;
 
-import com.ym.mec.biz.dal.dao.*;
-import com.ym.mec.biz.dal.dto.*;
-import com.ym.mec.biz.dal.entity.*;
-import com.ym.mec.util.collection.ListUtil;
 import org.apache.commons.beanutils.BeanUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -35,12 +35,50 @@ import com.alibaba.fastjson.JSON;
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.auth.api.entity.SysUserRole;
+import com.ym.mec.biz.dal.dao.ClassGroupDao;
+import com.ym.mec.biz.dal.dao.ClassGroupStudentMapperDao;
+import com.ym.mec.biz.dal.dao.CourseScheduleDao;
+import com.ym.mec.biz.dal.dao.CourseScheduleTeacherSalaryDao;
+import com.ym.mec.biz.dal.dao.MusicGroupBuildLogDao;
+import com.ym.mec.biz.dal.dao.MusicGroupDao;
+import com.ym.mec.biz.dal.dao.MusicGroupOrganizationCourseSettingsDao;
+import com.ym.mec.biz.dal.dao.MusicGroupOrganizationCourseSettingsDetailDao;
+import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderCourseSettingsDao;
+import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderDao;
+import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderDetailDao;
+import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderStudentDetailDao;
+import com.ym.mec.biz.dal.dao.MusicGroupPaymentStudentCourseDetailDao;
+import com.ym.mec.biz.dal.dao.MusicGroupStudentClassAdjustDao;
+import com.ym.mec.biz.dal.dao.MusicGroupStudentFeeDao;
+import com.ym.mec.biz.dal.dao.OrganizationCourseUnitPriceSettingsDao;
+import com.ym.mec.biz.dal.dao.OrganizationDao;
+import com.ym.mec.biz.dal.dao.SysConfigDao;
+import com.ym.mec.biz.dal.dao.TeacherAttendanceDao;
+import com.ym.mec.biz.dal.dto.CalenderPushDto;
+import com.ym.mec.biz.dal.dto.ClassGroup4MixDto;
+import com.ym.mec.biz.dal.dto.MusicGroupPaymentCalenderAuditDetailDto;
+import com.ym.mec.biz.dal.dto.MusicGroupPaymentCalenderAuditDto;
+import com.ym.mec.biz.dal.dto.MusicGroupPaymentCalenderDto;
 import com.ym.mec.biz.dal.dto.MusicGroupPaymentCalenderDto.MusicGroupPaymentDateRange;
+import com.ym.mec.biz.dal.entity.ClassGroup;
 import com.ym.mec.biz.dal.entity.CourseSchedule.CourseScheduleType;
+import com.ym.mec.biz.dal.entity.MusicGroup;
+import com.ym.mec.biz.dal.entity.MusicGroupBuildLog;
+import com.ym.mec.biz.dal.entity.MusicGroupOrganizationCourseSettings;
+import com.ym.mec.biz.dal.entity.MusicGroupOrganizationCourseSettingsDetail;
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender;
 import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PayUserType;
 import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentCalenderStatusEnum;
 import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentType;
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderCourseSettings;
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderDetail;
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderStudentDetail;
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentStudentCourseDetail;
+import com.ym.mec.biz.dal.entity.MusicGroupStudentClassAdjust;
+import com.ym.mec.biz.dal.entity.MusicGroupStudentFee;
 import com.ym.mec.biz.dal.entity.MusicGroupStudentFee.PaymentStatus;
+import com.ym.mec.biz.dal.entity.Organization;
+import com.ym.mec.biz.dal.entity.OrganizationCourseUnitPriceSettings;
 import com.ym.mec.biz.dal.enums.MessageTypeEnum;
 import com.ym.mec.biz.dal.enums.MusicGroupStatusEnum;
 import com.ym.mec.biz.dal.page.MusicGroupPaymentCalenderQueryInfo;
@@ -139,8 +177,15 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 
 		List<MusicGroupPaymentDateRange> musicGroupPaymentDateRangeList = musicGroupPaymentCalenderDto.getMusicGroupPaymentDateRangeList();
 
-		if ((paymentType == PaymentType.ADD_COURSE) && musicGroupPaymentDateRangeList.size() > 1) {
-			throw new BizException("[临时加课]不支持多周期缴费");
+		if ((paymentType == PaymentType.ADD_COURSE)) {
+			if(musicGroupPaymentDateRangeList.size() > 1){
+				throw new BizException("[临时加课]不支持多周期缴费");
+			}
+			Integer userId = Integer.parseInt(musicGroupPaymentCalenderDto.getStudentIds());
+			List<Long> idList = musicGroupPaymentCalenderDao.findStudentNoPaymentCalender(userId, musicGroupId);
+			if(idList != null && idList.size() > 0){
+				throw new BizException("创建缴费失败:已存在缴费项目");
+			}
 		}
 
 		MusicGroup musicGroup = musicGroupDao.getLocked(musicGroupId);

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

@@ -21,7 +21,9 @@ import java.util.stream.Collectors;
 
 import com.ym.mec.biz.dal.dao.*;
 import com.ym.mec.biz.dal.entity.*;
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentType;
 import com.ym.mec.biz.dal.enums.*;
+
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -1663,15 +1665,32 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
                 studentDao.update(student);
             }
 
-
+            //删除进行中加学生,且在审批中或拒绝的缴费
+            List<Long> paymentCalenderIdList = musicGroupPaymentCalenderDao.findStudentNoPaymentCalender(userId, musicGroupId);
+            if(paymentCalenderIdList != null && paymentCalenderIdList.size() > 0){
+            	musicGroupPaymentCalenderDao.delByIds(paymentCalenderIdList);
+            }
+            
+            //查询未交费的项目
+            List<MusicGroupPaymentCalenderDetail> musicGroupPaymentCalenderDetailList = musicGroupPaymentCalenderDetailDao.queryNotPaymentStudentByUserIdAndMusicGroupId(userId, musicGroupId);
+            
+			for (MusicGroupPaymentCalenderDetail mgpcd : musicGroupPaymentCalenderDetailList) {
+				MusicGroupPaymentCalender mgpc = musicGroupPaymentCalenderDao.get(mgpcd.getMusicGroupPaymentCalenderId());
+				if (mgpc != null) {
+					if (mgpc.getPaymentType() == PaymentType.ADD_STUDENT) {
+						musicGroupPaymentCalenderDao.delete(mgpc.getId());
+					} else {
+						// 缴费项目预计人数减一
+						mgpc.setExpectNum(mgpc.getExpectNum() - 1);
+						mgpc.setUpdateTime(date);
+						musicGroupPaymentCalenderDao.update(mgpc);
+					}
+				}
+				musicGroupPaymentCalenderDetailDao.delete(mgpcd.getId());
+			}
             //删除用户购买的课程记录
             musicGroupPaymentStudentCourseDetailDao.deleteByUserIdAndMusicGroupId(userId, musicGroupId);
 
-            //缴费项目预计人数减一
-            musicGroupPaymentCalenderDao.cutCalenderExpectNum(userId, musicGroupId);
-            //删除缴费项目详情
-            musicGroupPaymentCalenderDetailDao.deleteByUserIdAndMusicGroupId(userId, musicGroupId);
-
             //操作人
             SysUser operator = sysUserFeignService.queryUserInfo();
 
@@ -1828,14 +1847,32 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
             studentDao.update(student);
         }
 
-
+        //删除进行中加学生,且在审批中或拒绝的缴费
+        List<Long> paymentCalenderIdList = musicGroupPaymentCalenderDao.findStudentNoPaymentCalender(userId, musicGroupId);
+        if(paymentCalenderIdList != null && paymentCalenderIdList.size() > 0){
+        	musicGroupPaymentCalenderDao.delByIds(paymentCalenderIdList);
+        }
+        
+        //查询未交费的项目
+        List<MusicGroupPaymentCalenderDetail> musicGroupPaymentCalenderDetailList = musicGroupPaymentCalenderDetailDao.queryNotPaymentStudentByUserIdAndMusicGroupId(userId, musicGroupId);
+        
+		for (MusicGroupPaymentCalenderDetail mgpcd : musicGroupPaymentCalenderDetailList) {
+			MusicGroupPaymentCalender mgpc = musicGroupPaymentCalenderDao.get(mgpcd.getMusicGroupPaymentCalenderId());
+			if (mgpc != null) {
+				if (mgpc.getPaymentType() == PaymentType.ADD_STUDENT) {
+					musicGroupPaymentCalenderDao.delete(mgpc.getId());
+				} else {
+					// 缴费项目预计人数减一
+					mgpc.setExpectNum(mgpc.getExpectNum() - 1);
+					mgpc.setUpdateTime(date);
+					musicGroupPaymentCalenderDao.update(mgpc);
+				}
+			}
+			musicGroupPaymentCalenderDetailDao.delete(mgpcd.getId());
+		}
         //删除用户购买的课程记录
         musicGroupPaymentStudentCourseDetailDao.deleteByUserIdAndMusicGroupId(userId, musicGroupId);
-
-        //缴费项目预计人数减一
-        musicGroupPaymentCalenderDao.cutCalenderExpectNum(userId, musicGroupId);
-        //删除缴费项目详情
-        musicGroupPaymentCalenderDetailDao.deleteByUserIdAndMusicGroupId(userId, musicGroupId);
+        
 
         //操作人
         SysUser operator = sysUserFeignService.queryUserInfo();

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

@@ -190,15 +190,16 @@
 	<delete id="batchDel">
 		DELETE FROM music_group_payment_calender_detail WHERE FIND_IN_SET(id_,#{musicGroupPaymentCalenderIdDetails})
 	</delete>
-	<delete id="deleteByUserIdAndMusicGroupId">
-		DELETE FROM music_group_payment_calender_detail
-		WHERE music_group_payment_calender_id_ IN (SELECT mgpc.id_ FROM music_group_payment_calender mgpc
-		WHERE mgpc.music_group_id_ = #{musicGroupId})
-		AND user_id_ = #{userId} AND payment_status_ = 'NON_PAYMENT'
-	</delete>
     <delete id="deleteByCalenderId">
 		DELETE FROM music_group_payment_calender_detail WHERE music_group_payment_calender_id_ = #{id}
 	</delete>
+	
+	<select id="queryNotPaymentStudentByUserIdAndMusicGroupId" resultMap="MusicGroupPaymentCalenderDetail" parameterType="map">
+		select * FROM music_group_payment_calender_detail
+		WHERE music_group_payment_calender_id_ IN (SELECT mgpc.id_ FROM music_group_payment_calender mgpc
+		WHERE mgpc.music_group_id_ = #{musicGroupId})
+		AND user_id_ = #{userId} AND payment_status_ = 'NON_PAYMENT'
+	</select>
 
 	<!-- 分页查询 -->
 	<select id="queryPage" resultMap="MusicGroupPaymentCalenderDetail" parameterType="map">

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

@@ -220,7 +220,7 @@
     <select id="findStudentNoPaymentCalender" resultType="java.lang.Long">
         SELECT DISTINCT mgpc.id_ FROM music_group_payment_calender mgpc
         WHERE mgpc.student_ids_ = #{userId} AND mgpc.payment_type_ = 'ADD_STUDENT'
-        AND mgpc.music_group_id_ = #{musicGroupId} AND status_ = 'AUDITING'
+        AND mgpc.music_group_id_ = #{musicGroupId} AND status_ in ('AUDITING','REJECT')
     </select>
 
     <!-- 根据主键删除一条记录 -->