Forráskód Böngészése

Merge remote-tracking branch 'origin/master'

Joburgess 4 éve
szülő
commit
8c30befc5d

+ 40 - 4
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupPaymentCalenderDao.java

@@ -1,12 +1,17 @@
 package com.ym.mec.biz.dal.dao;
 
-import java.util.*;
+import java.util.Collection;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
 
-import com.ym.mec.biz.dal.dto.CalenderPushDto;
-import com.ym.mec.biz.dal.dto.MusicGroupPaymentCalenderAuditDto;
 import org.apache.ibatis.annotations.Param;
 
+import com.ym.mec.biz.dal.dto.CalenderPushDto;
+import com.ym.mec.biz.dal.dto.MusicGroupPaymentCalenderAuditDto;
 import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender;
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PayUserType;
 import com.ym.mec.biz.dal.enums.PaymentStatusEnum;
 import com.ym.mec.common.dal.BaseDAO;
 
@@ -83,6 +88,7 @@ public interface MusicGroupPaymentCalenderDao extends BaseDAO<Long, MusicGroupPa
 
     /**
      * @param musicGroupId:
+     * @param payUserType:
      * @param paymentValidStartDate:
      * @param paymentValidEndDate:
      * @return int
@@ -92,7 +98,7 @@ public interface MusicGroupPaymentCalenderDao extends BaseDAO<Long, MusicGroupPa
      * @date 2020/9/21
      * @time 10:46
      */
-    int queryIntersectionByValidDate(@Param("musicGroupId") String musicGroupId,
+    int queryIntersectionByValidDate(@Param("musicGroupId") String musicGroupId, @Param("payUserType") PayUserType payUserType,
                                      @Param("paymentValidStartDate") Date paymentValidStartDate,
                                      @Param("paymentValidEndDate") Date paymentValidEndDate,
                                      @Param("calenderId") Long calenderId);
@@ -201,4 +207,34 @@ public interface MusicGroupPaymentCalenderDao extends BaseDAO<Long, MusicGroupPa
      * @return
      */
     MusicGroupPaymentCalender findByMusicGroupRegCalender(@Param("musicGroupId") String musicGroupId);
+
+    /**
+     * @param calenderId:
+     * @return java.lang.String
+     * @describe 获取收费标准名称
+     * @apiNote 时光荏苒,认真工作的时间总是过得很快,而我、享受这一刻!
+     * @author zouxuan
+     * @date 2020/11/4
+     * @time 10:11
+     */
+    String getCalenderSettingsName(Long calenderId);
+
+    /**
+     * @param musicGroupId:
+     * @param calenderId:
+     * @return int
+     * @describe 统计乐团还在审核中或者审核被拒的缴费
+     * @apiNote 时光荏苒,认真工作的时间总是过得很快,而我、享受这一刻!
+     * @author zouxuan
+     * @date 2020/11/4
+     * @time 10:37
+     */
+    int countAuditReject(@Param("musicGroupId") String musicGroupId, @Param("calenderId") Long calenderId);
+
+    /**
+     * 获取乐团报名的缴费日历
+     * @param musicGroupId
+     * @return
+     */
+    MusicGroupPaymentCalender getMusicGroupRegCalender(@Param("musicGroupId") String musicGroupId);
 }

+ 8 - 10
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/MusicGroupSubjectGoodsAndInfoDto.java

@@ -1,9 +1,6 @@
 package com.ym.mec.biz.dal.dto;
 
-import com.ym.mec.biz.dal.entity.Goods;
-import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderCourseSettings;
-import com.ym.mec.biz.dal.entity.MusicGroupSubjectGoodsGroup;
-import com.ym.mec.biz.dal.entity.MusicGroupSubjectPlan;
+import com.ym.mec.biz.dal.entity.*;
 import io.swagger.annotations.ApiModelProperty;
 
 import java.util.List;
@@ -29,8 +26,9 @@ public class MusicGroupSubjectGoodsAndInfoDto {
     //其他商品(教材、琴谱)
     private List<Goods> otherGoods;
 
-    @ApiModelProperty(value = "课程组成形态",required = false)
-    private List<MusicGroupPaymentCalenderCourseSettings> courseSettings;
+    @ApiModelProperty(value = "乐团报名缴费日历",required = false)
+    private MusicGroupPaymentCalender musicGroupPaymentCalender;
+
 
     public Map getCourseScheduleInfo() {
         return CourseScheduleInfo;
@@ -72,11 +70,11 @@ public class MusicGroupSubjectGoodsAndInfoDto {
         this.studentGoods = studentGoods;
     }
 
-    public List<MusicGroupPaymentCalenderCourseSettings> getCourseSettings() {
-        return courseSettings;
+    public MusicGroupPaymentCalender getMusicGroupPaymentCalender() {
+        return musicGroupPaymentCalender;
     }
 
-    public void setCourseSettings(List<MusicGroupPaymentCalenderCourseSettings> courseSettings) {
-        this.courseSettings = courseSettings;
+    public void setMusicGroupPaymentCalender(MusicGroupPaymentCalender musicGroupPaymentCalender) {
+        this.musicGroupPaymentCalender = musicGroupPaymentCalender;
     }
 }

+ 47 - 33
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderServiceImpl.java

@@ -27,7 +27,6 @@ import com.ym.mec.common.service.impl.BaseServiceImpl;
 import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
 import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.date.DateUtil;
-
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -118,7 +117,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 		if (musicGroupPaymentCalender.getDeadlinePaymentDate() == null && musicGroupPaymentCalender.getPayUserType() == PayUserType.STUDENT) {
 			musicGroupPaymentCalender.setDeadlinePaymentDate(DateUtil.addDays(musicGroupPaymentCalender.getStartPaymentDate(), 3));
 		}
-		int count = musicGroupPaymentCalenderDao.queryIntersectionByValidDate(musicGroupId, musicGroupPaymentCalender.getPaymentValidStartDate(),
+		int count = musicGroupPaymentCalenderDao.queryIntersectionByValidDate(musicGroupId, musicGroupPaymentCalender.getPayUserType(), musicGroupPaymentCalender.getPaymentValidStartDate(),
 				musicGroupPaymentCalender.getPaymentValidEndDate(), null);
 		if (count > 0) {
 			throw new BizException("缴费有效期存在冲突,请修改缴费有效期");
@@ -182,14 +181,17 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 
 			// 如果是报名,需要修改乐团状态
 			if (musicGroupPaymentCalender.getPaymentType() == MUSIC_APPLY) {
-				if (musicGroup.getStatus() != MusicGroupStatusEnum.DRAFT) {
-					throw new BizException("创建失败:缴费项目类型不匹配");
+				int countAuditReject = musicGroupPaymentCalenderDao.countAuditReject(musicGroupPaymentCalender.getMusicGroupId(),null);
+				if(countAuditReject == 0){
+					if (musicGroup.getStatus() != MusicGroupStatusEnum.DRAFT) {
+						throw new BizException("创建失败:缴费项目类型不匹配");
+					}
+					musicGroup.setStatus(MusicGroupStatusEnum.AUDIT);
+					musicGroup.setUpdateTime(date);
+					// 记录操作日志
+					musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroupId, "报名缴费项目创建成功(草稿 -> 审核中)", sysUser.getId(), ""));
+					musicGroupDao.update(musicGroup);
 				}
-				musicGroup.setStatus(MusicGroupStatusEnum.AUDIT);
-				musicGroup.setUpdateTime(date);
-				// 记录操作日志
-				musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroupId, "报名缴费项目创建成功(草稿 -> 审核中)", sysUser.getId(), ""));
-				musicGroupDao.update(musicGroup);
 			}
 		}
 
@@ -222,8 +224,13 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 		calender.setActualNum(actualNumMap.get(id) == null ? 0 : actualNumMap.get(id).intValue());
 		calender.setExpectNum(expectNumMap.get(id) == null ? 0 : expectNumMap.get(id).intValue());
 		BigDecimal sumActualAmount = musicGroupPaymentCalenderDetailDao.sumActualAmount(id);
+		//收费标准名称
+		String name = musicGroupPaymentCalenderDao.getCalenderSettingsName(id);
+		List<MusicGroupPaymentCalenderCourseSettings> musicGroupPaymentCalenderCourseSettings = musicGroupPaymentCalenderCourseSettingsDao.queryCalenderCourseSettings(id);
 		Map<String, Object> result = new HashMap<>(2);
+		result.put("musicGroupPaymentCalenderCourseSettings", musicGroupPaymentCalenderCourseSettings);
 		result.put("calender", calender);
+		result.put("calenderSettingsName", name);
 		result.put("sumActualAmount", sumActualAmount);
 		return result;
 	}
@@ -259,7 +266,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 		if (musicGroupPaymentCalender.getDeadlinePaymentDate() == null && musicGroupPaymentCalender.getPayUserType() == PayUserType.STUDENT) {
 			musicGroupPaymentCalender.setDeadlinePaymentDate(DateUtil.addDays(musicGroupPaymentCalender.getStartPaymentDate(), 3));
 		}
-		int count = musicGroupPaymentCalenderDao.queryIntersectionByValidDate(musicGroupId, musicGroupPaymentCalender.getPaymentValidStartDate(),
+		int count = musicGroupPaymentCalenderDao.queryIntersectionByValidDate(musicGroupId, musicGroupPaymentCalender.getPayUserType(), musicGroupPaymentCalender.getPaymentValidStartDate(),
 				musicGroupPaymentCalender.getPaymentValidEndDate(), null);
 		if (count > 0) {
 			throw new BizException("缴费有效期存在冲突,请修改缴费有效期");
@@ -323,15 +330,19 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 			}
 
 			// 如果是报名,需要修改乐团状态
+
 			if (musicGroupPaymentCalender.getPaymentType() == MUSIC_APPLY) {
-				if (musicGroup.getStatus() != MusicGroupStatusEnum.DRAFT) {
-					throw new BizException("创建失败:缴费项目类型不匹配");
+				int countAuditReject = musicGroupPaymentCalenderDao.countAuditReject(musicGroupPaymentCalender.getMusicGroupId(),musicGroupPaymentCalender.getId());
+				if(countAuditReject == 0){
+					if (musicGroup.getStatus() != MusicGroupStatusEnum.DRAFT) {
+						throw new BizException("创建失败:缴费项目类型不匹配");
+					}
+					musicGroup.setStatus(MusicGroupStatusEnum.AUDIT);
+					musicGroup.setUpdateTime(date);
+					// 记录操作日志
+					musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroupId, "报名缴费项目创建成功(草稿 -> 审核中)", sysUser.getId(), ""));
+					musicGroupDao.update(musicGroup);
 				}
-				musicGroup.setStatus(MusicGroupStatusEnum.AUDIT);
-				musicGroup.setUpdateTime(date);
-				// 记录操作日志
-				musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroupId, "报名缴费项目创建成功(草稿 -> 审核中)", sysUser.getId(), ""));
-				musicGroupDao.update(musicGroup);
 			}
 		}
 		
@@ -453,23 +464,26 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 		} else {
 			musicGroupPaymentCalender.setStatus(PaymentCalenderStatusEnum.NO);
 		}
-		//如果是报名,需要修改乐团状态
-		if (musicGroupPaymentCalender.getPaymentType() == MUSIC_APPLY) {
-			MusicGroup musicGroup = musicGroupDao.get(musicGroupPaymentCalender.getMusicGroupId());
-			musicGroup.setStatus(MusicGroupStatusEnum.AUDIT);
-			musicGroup.setUpdateTime(date);
-			musicGroupDao.update(musicGroup);
-			SysUser sysUser = sysUserFeignService.queryUserInfo();
-			if(sysUser == null || sysUser.getId() == null){
-				throw new BizException("请重新登录");
-			}
-			//记录操作日志
-			musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroup.getId(), "报名缴费项目通过(草稿 -> 审核中)", sysUser.getId(), ""));
-
-		}
 		musicGroupPaymentCalender.setAuditMemo(auditMemo);
 		musicGroupPaymentCalender.setUpdateTime(date);
 		musicGroupPaymentCalenderDao.update(musicGroupPaymentCalender);
+		//如果是报名,并且所有的报名都审核通过,需要修改乐团状态
+
+		if (musicGroupPaymentCalender.getPaymentType() == MUSIC_APPLY) {
+			int count = musicGroupPaymentCalenderDao.countAuditReject(musicGroupPaymentCalender.getMusicGroupId(),calenderId);
+			if(count == 0){
+				MusicGroup musicGroup = musicGroupDao.get(musicGroupPaymentCalender.getMusicGroupId());
+				musicGroup.setStatus(MusicGroupStatusEnum.AUDIT);
+				musicGroup.setUpdateTime(date);
+				musicGroupDao.update(musicGroup);
+				SysUser sysUser = sysUserFeignService.queryUserInfo();
+				if(sysUser == null || sysUser.getId() == null){
+					throw new BizException("请重新登录");
+				}
+				//记录操作日志
+				musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroup.getId(), "报名缴费项目通过(草稿 -> 审核中)", sysUser.getId(), ""));
+			}
+		}
 	}
 
 	@Override
@@ -477,7 +491,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 	public void auditRefuse(Long calenderId,String auditMemo) {
 		MusicGroupPaymentCalender musicGroupPaymentCalender = musicGroupPaymentCalenderDao.get(calenderId);
 		Date date = new Date();
-		musicGroupPaymentCalender.setStatus(PaymentCalenderStatusEnum.AUDITING);
+		musicGroupPaymentCalender.setStatus(PaymentCalenderStatusEnum.REJECT);
 		musicGroupPaymentCalender.setUpdateTime(date);
 		musicGroupPaymentCalender.setAuditMemo(auditMemo);
 		musicGroupPaymentCalenderDao.update(musicGroupPaymentCalender);
@@ -653,7 +667,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 		if (count > 0) {
 			throw new BizException("缴费时间存在冲突,请修改缴费开始日期");
 		}
-		count = musicGroupPaymentCalenderDao.queryIntersectionByValidDate(calender.getMusicGroupId(), paymentCalender.getPaymentValidStartDate(),
+		count = musicGroupPaymentCalenderDao.queryIntersectionByValidDate(calender.getMusicGroupId(), paymentCalender.getPayUserType(), paymentCalender.getPaymentValidStartDate(),
 				paymentCalender.getPaymentValidEndDate(), paymentCalender.getId());
 		if (count > 0) {
 			throw new BizException("缴费有效期存在冲突,请修改缴费有效期");

+ 8 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupSubjectPlanServiceImpl.java

@@ -57,6 +57,8 @@ public class MusicGroupSubjectPlanServiceImpl extends BaseServiceImpl<Integer, M
     private ChargeTypeSubjectMapperDao chargeTypeSubjectMapperDao;
     @Autowired
     private MusicGroupPaymentCalenderCourseSettingsDao musicGroupPaymentCalenderCourseSettingsDao;
+    @Autowired
+    private MusicGroupPaymentCalenderDao musicGroupPaymentCalenderDao;
 
     @Override
     public BaseDAO<Integer, MusicGroupSubjectPlan> getDAO() {
@@ -93,8 +95,11 @@ public class MusicGroupSubjectPlanServiceImpl extends BaseServiceImpl<Integer, M
         Map<String, Object> courseForm = JSON.parseObject(musicGroup.getCourseForm(), Map.class);
 
         //新的课程形态10.27
-        List<MusicGroupPaymentCalenderCourseSettings> courseSettings = musicGroupPaymentCalenderCourseSettingsDao.getMusicGroupRegCalenderCourseSettings(musicGroupId);
-
+        MusicGroupPaymentCalender musicGroupRegCalender = musicGroupPaymentCalenderDao.getMusicGroupRegCalender(musicGroupId);
+        if (musicGroupRegCalender != null) {
+            List<MusicGroupPaymentCalenderCourseSettings> courseSettings = musicGroupPaymentCalenderCourseSettingsDao.getMusicGroupRegCalenderCourseSettings(musicGroupId);
+            musicGroupRegCalender.setMusicGroupPaymentCalenderCourseSettingsList(courseSettings);
+        }
 
         //乐团计划及收费信息
         MusicGroupSubjectPlan musicOneSubjectClassPlan = this.getMusicOneSubjectClassPlan(musicGroupId, subjectId);
@@ -117,7 +122,7 @@ public class MusicGroupSubjectPlanServiceImpl extends BaseServiceImpl<Integer, M
         MusicGroupSubjectGoodsAndInfoDto musicGroupSubjectGoodsAndInfo = new MusicGroupSubjectGoodsAndInfoDto();
         musicGroupSubjectGoodsAndInfo.setMusicGroupSubjectPlan(musicOneSubjectClassPlan);
         musicGroupSubjectGoodsAndInfo.setCourseScheduleInfo(courseForm);
-        musicGroupSubjectGoodsAndInfo.setCourseSettings(courseSettings);
+        musicGroupSubjectGoodsAndInfo.setMusicGroupPaymentCalender(musicGroupRegCalender);
         musicGroupSubjectGoodsAndInfo.setMusicGroupSubjectGoodsGroupList(goodsGroups);
         musicGroupSubjectGoodsAndInfo.setOtherGoods(otherGoods);
         return musicGroupSubjectGoodsAndInfo;

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

@@ -121,6 +121,7 @@
 		WHERE mgpc.music_group_id_ = #{musicGroupId}
 		AND mgpc.payment_type_ = 'MUSIC_APPLY'
 		AND mgpc.pay_user_type_='STUDENT'
+		AND mgpc.status_='OPEN'
 	</select>
 
     <select id="getCalenderCourseSettings" resultMap="MusicGroupPaymentCalenderCourseSettings">

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

@@ -277,6 +277,9 @@
         WHERE music_group_id_ = #{musicGroupId}
         AND (payment_valid_end_date_ IS NULL OR payment_valid_start_date_ BETWEEN #{paymentValidStartDate} AND #{paymentValidEndDate}
         OR payment_valid_end_date_ BETWEEN #{paymentValidStartDate} AND #{paymentValidEndDate}) AND payment_valid_start_date_ IS NOT NULL
+        <if test="payUserType != null">
+        	and pay_user_type_ = #{payUserType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
+        </if>
         <if test="calenderId != null">
             AND mgpc.id_ != #{calenderId}
         </if>
@@ -382,11 +385,11 @@
     </resultMap>
     <sql id="MusicGroupPaymentCalenderAuditDtoSql">
         <where>
-            <if test="paymentType != null and paymentType != ''">
+            <if test="paymentType != null">
                 AND mgpc.payment_type_ = #{paymentType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
             </if>
-            <if test="paymentCalenderStatus != null and paymentCalenderStatus != ''">
-                AND mgpc.status_ = #{paymentCalenderStatus,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
+            <if test="status != null">
+                AND mgpc.status_ = #{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
             </if>
             <if test="organId != null and organId != ''">
                 AND FIND_IN_SET(mg.organ_id_,#{organId})
@@ -440,4 +443,23 @@
     <select id="findByMusicGroupRegCalender" resultMap="MusicGroupPaymentCalender">
         SELECT * FROM music_group_payment_calender WHERE music_group_id_=#{musicGroupId} AND payment_type_='MUSIC_APPLY'
     </select>
+    <select id="getCalenderSettingsName" resultType="java.lang.String">
+        SELECT name_ FROM music_group_payment_calender_course_settings
+        WHERE music_group_payment_calender_id_ = #{calenderId} LIMIT 1
+    </select>
+    <select id="countAuditReject" resultType="java.lang.Integer">
+        SELECT COUNT(0) FROM music_group_payment_calender
+        WHERE music_group_id_ = #{musicGroupId} AND payment_type_='MUSIC_APPLY' AND status_ IN ('REJECT','AUDITING')
+        <if test="calenderId != null">
+            AND id_ != #{calenderId}
+        </if>
+    </select>
+
+    <select id="getMusicGroupRegCalender" resultMap="MusicGroupPaymentCalender">
+        SELECT * FROM music_group_payment_calender
+        WHERE music_group_id_ = #{musicGroupId}
+        AND payment_type_ = 'MUSIC_APPLY'
+        AND pay_user_type_='STUDENT'
+        AND status_='OPEN'
+    </select>
 </mapper>