Browse Source

Merge branch 'master' of http://git.dayaedu.com/yonge/mec

zouxuan 5 years ago
parent
commit
240d7353b1

+ 74 - 57
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupPaymentCalenderDao.java

@@ -13,67 +13,84 @@ import com.ym.mec.common.dal.BaseDAO;
 
 public interface MusicGroupPaymentCalenderDao extends BaseDAO<Long, MusicGroupPaymentCalender> {
 
-	/**
-	 * 根据乐团编号删除乐团缴费周期
-	 * @param musicGroupId
-	 */
-	void delByGroupId(String musicGroupId);
+    /**
+     * 根据乐团编号删除乐团缴费周期
+     *
+     * @param musicGroupId
+     */
+    void delByGroupId(String musicGroupId);
 
-	/**
-	 * 根据乐团编号获取乐团缴费日历
-	 * @param musicGroupId
-	 * @return
-	 */
-	List<MusicGroupPaymentCalender> findByMusicGroupId(String musicGroupId);
+    /**
+     * 根据乐团编号获取乐团缴费日历
+     *
+     * @param musicGroupId
+     * @return
+     */
+    List<MusicGroupPaymentCalender> findByMusicGroupId(String musicGroupId);
 
-	/**
-	 * 批量新增乐团缴费周期
-	 * @param calender
-	 * @param musicGroupId
-	 */
-	void batchAdd(@Param("calender") List<Integer> calender, @Param("musicGroupId") String musicGroupId);
+    /**
+     * 批量新增乐团缴费周期
+     *
+     * @param calender
+     * @param musicGroupId
+     */
+    void batchAdd(@Param("calender") List<Integer> calender, @Param("musicGroupId") String musicGroupId);
 
-	/**
-	 * 批量修改
-	 * @param musicGroupPaymentCalenderList
-	 * @return
-	 */
-	int batchUpdate(List<MusicGroupPaymentCalender> musicGroupPaymentCalenderList);
+    /**
+     * 批量修改
+     *
+     * @param musicGroupPaymentCalenderList
+     * @return
+     */
+    int batchUpdate(List<MusicGroupPaymentCalender> musicGroupPaymentCalenderList);
 
-	/**
-	 * 查询指定状态的记录
-	 * @param status
-	 * @return
-	 */
-	List<MusicGroupPaymentCalender> queryByPaymentStatus(@Param("status") List<PaymentStatusEnum> status);
-	
-	/**
-	 * 获取缴费信息锁
-	 * @param id
-	 * @return
-	 */
-	MusicGroupPaymentCalender getForLock(@Param("id") Long id);
+    /**
+     * 查询指定状态的记录
+     *
+     * @param status
+     * @return
+     */
+    List<MusicGroupPaymentCalender> queryByPaymentStatus(@Param("status") List<PaymentStatusEnum> status);
 
-	/**
-	 * 根据指定乐团的缴费日期查询交集
-	 * @param musicGroupId 乐团编号
-	 * @param startPaymentDate 开始缴费日期
-	 * @param deadlinePaymentDate 截止缴费日期
-	 * @return
-	 */
-	int queryIntersectionByPaymentDate(@Param("musicGroupId") String musicGroupId, @Param("startPaymentDate") Date startPaymentDate,
-			@Param("deadlinePaymentDate") Date deadlinePaymentDate);
+    /**
+     * 获取缴费信息锁
+     *
+     * @param id
+     * @return
+     */
+    MusicGroupPaymentCalender getForLock(@Param("id") Long id);
 
-	/**
-	 * 统计预计缴费人数
-	 * @param collect
-	 * @return
-	 */
-	List<Map<Long, Long>> countExpectNum(@Param("collect") Set<Long> collect);
-	/**
-	 * 统计预计缴费人数
-	 * @param collect
-	 * @return
-	 */
-	List<Map<Long, Long>> countActualNum(@Param("collect") Set<Long> collect);
+    /**
+     * 根据指定乐团的缴费日期查询交集
+     *
+     * @param musicGroupId        乐团编号
+     * @param startPaymentDate    开始缴费日期
+     * @param deadlinePaymentDate 截止缴费日期
+     * @return
+     */
+    int queryIntersectionByPaymentDate(@Param("musicGroupId") String musicGroupId, @Param("startPaymentDate") Date startPaymentDate,
+                                       @Param("deadlinePaymentDate") Date deadlinePaymentDate);
+
+    /**
+     * 统计预计缴费人数
+     *
+     * @param collect
+     * @return
+     */
+    List<Map<Long, Long>> countExpectNum(@Param("collect") Set<Long> collect);
+
+    /**
+     * 统计预计缴费人数
+     *
+     * @param collect
+     * @return
+     */
+    List<Map<Long, Long>> countActualNum(@Param("collect") Set<Long> collect);
+
+    /**
+     * 乐团最后一次交费信息
+     * @param musicGroupId
+     * @return
+     */
+    MusicGroupPaymentCalender getLastStartOne(@Param("musicGroupId") String musicGroupId);
 }

+ 10 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/page/VipGroupQueryInfo.java

@@ -23,6 +23,8 @@ public class VipGroupQueryInfo extends QueryInfo {
     private Integer educationalTeacherId;
 
     private Boolean hasEducationalTeacherId;
+    
+    private Integer userId;
 
     public Boolean getHasEducationalTeacherId() {
         return hasEducationalTeacherId;
@@ -87,4 +89,12 @@ public class VipGroupQueryInfo extends QueryInfo {
     public void setOrganId(String organId) {
         this.organId = organId;
     }
+
+	public Integer getUserId() {
+		return userId;
+	}
+
+	public void setUserId(Integer userId) {
+		this.userId = userId;
+	}
 }

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ExtracurricularExercisesReplyServiceImpl.java

@@ -287,7 +287,7 @@ public class ExtracurricularExercisesReplyServiceImpl extends BaseServiceImpl<Lo
 		LocalDate nowDate = LocalDateTime.now(DateUtil.zoneId).toLocalDate();
 
 		if(nowDate.getDayOfWeek()==DayOfWeek.MONDAY){
-			int lastWeekTodayUpdateNum = studentExtracurricularExercisesSituationDao.findLastWeekTodayUpdateNum(nowDate.toString());
+			int lastWeekTodayUpdateNum = studentExtracurricularExercisesSituationDao.findLastWeekTodayUpdateNum(nowDate.plusDays(-1).toString());
 			if(lastWeekTodayUpdateNum<=0){
 				nowDate = nowDate.plusDays(-1);
 			}

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

@@ -1363,7 +1363,12 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
             List<Integer> classGroupIdList = classGroupStudentMapperDao.queryClassGroupIdList(musicGroupId, userId, GroupType.MUSIC);
             //更新学员在班级的状态
             for (Integer classGroupId : classGroupIdList) {
-                classGroupStudentMapperService.delClassGroupStudent(userId, classGroupId);
+                ClassGroup classGroup = classGroupService.get(classGroupId);
+                if(classGroup.getType().equals(ClassGroupTypeEnum.MUSIC_NETWORK)){
+                    classGroupService.delSingle(classGroupId);
+                }else {
+                    classGroupStudentMapperService.delClassGroupStudent(userId, classGroupId);
+                }
             }
 
             //删除续费周期
@@ -1459,7 +1464,12 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 
         List<Integer> classGroupIdList = classGroupStudentMapperDao.queryClassGroupIdList(musicGroupId, userId, GroupType.MUSIC);
         for (Integer classGroupId : classGroupIdList) {
-            classGroupStudentMapperService.delClassGroupStudent(userId, classGroupId);
+            ClassGroup classGroup = classGroupService.get(classGroupId);
+            if(classGroup.getType().equals(ClassGroupTypeEnum.MUSIC_NETWORK)){
+                classGroupService.delSingle(classGroupId);
+            }else {
+                classGroupStudentMapperService.delClassGroupStudent(userId, classGroupId);
+            }
         }
 
         //删除续费周期

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

@@ -193,4 +193,8 @@
         AND mgpcd.payment_status_ = 'PAID_COMPLETED'
         GROUP BY mgpcd.music_group_payment_calender_id_
     </select>
+    
+    <select id="getLastStartOne" resultMap="MusicGroupPaymentCalender">
+        SELECT * FROM music_group_payment_calender WHERE music_group_id_ = #{musicGroupId} ORDER BY start_payment_date_ DESC LIMIT 1
+    </select>
 </mapper>

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

@@ -189,6 +189,9 @@
             <if test="educationalTeacherId!=null">
                 AND vg.educational_teacher_id_=#{educationalTeacherId}
             </if>
+            <if test="userId!=null">
+                AND cssp.user_id_ = #{userId}
+            </if>
         </where>
     </sql>
 
@@ -201,17 +204,24 @@
             vip_group vg
             LEFT JOIN sys_user su ON vg.user_id_=su.id_
             LEFT JOIN vip_group_activity vga ON vg.vip_group_activity_id_=vga.id_
+            left join course_schedule_student_payment cssp on cssp.music_group_id_ = vg.id_ and cssp.group_type_ = 'VIP'
         <include refid="vipGroupQueryCondition"/>
+        group by vg.id_
         ORDER BY vg.id_ DESC
         <include refid="global.limit"/>
 	</select>
 
     <select id="countVipGroupByOrgan" resultType="int">
+    	select count(*) from
+    	(
         SELECT
-        count(*)
+        count(distinct vg.id_)
         FROM
         vip_group vg
+        left join course_schedule_student_payment cssp on cssp.music_group_id_ = vg.id_ and cssp.group_type_ = 'VIP'
         <include refid="vipGroupQueryCondition"/>
+        GROUP BY vg.id_
+        ) t
     </select>
 
     <!-- 向数据库增加一条记录 -->

+ 9 - 2
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.MusicGroupPaymentCalenderDao;
 import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderDetailDao;
 import com.ym.mec.biz.dal.dao.MusicGroupStudentFeeDao;
 import com.ym.mec.biz.dal.dto.RegisterPayDto;
@@ -53,6 +54,8 @@ public class MusicGroupController extends BaseController {
     private StudentPaymentOrderDetailService studentPaymentOrderDetailService;
     @Autowired
     private MusicGroupPaymentCalenderDetailDao musicGroupPaymentCalenderDetailDao;
+    @Autowired
+    private MusicGroupPaymentCalenderDao musicGroupPaymentCalenderDao;
 
     @ApiOperation("获取学生所在乐团列表")
     @GetMapping(value = "/queryUserMusicGroups")
@@ -158,7 +161,9 @@ public class MusicGroupController extends BaseController {
         }
         MusicGroupPaymentCalenderDetail userLastCalenderDetail = musicGroupPaymentCalenderDetailDao.getUserLastCalenderDetail(musicGroupId, userId);
         if(userLastCalenderDetail == null){
-            throw new BizException("当前续费时间已截止,请联系指导老师");
+            MusicGroupPaymentCalender lastCalender = musicGroupPaymentCalenderDao.getLastStartOne(musicGroupId);
+           String tips =  (lastCalender != null && lastCalender.getPaymentStatus().equals(PaymentStatusEnum.YES))?"当前续费时间已截止,如有问题请联系指导老师":"当前续费未开始,如有问题请联系指导老师";
+            throw new BizException(tips);
         }
 
         BigDecimal amount = userLastCalenderDetail.getExpectAmount();
@@ -200,7 +205,9 @@ public class MusicGroupController extends BaseController {
 		}
         MusicGroupPaymentCalenderDetail userLastCalenderDetail = musicGroupPaymentCalenderDetailDao.getUserLastCalenderDetail(musicGroupId, userId);
         if(userLastCalenderDetail == null){
-            throw new BizException("当前续费时间已截止,请联系指导老师");
+            MusicGroupPaymentCalender lastCalender = musicGroupPaymentCalenderDao.getLastStartOne(musicGroupId);
+            String tips =  (lastCalender != null && lastCalender.getPaymentStatus().equals(PaymentStatusEnum.YES))?"当前续费时间已截止,如有问题请联系指导老师":"当前续费未开始,如有问题请联系指导老师";
+            throw new BizException(tips);
         }
         return succeed(musicGroupService.renew(musicGroupId, userId, isUseBalancePayment));
 	}