ソースを参照

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

zouxuan 4 年 前
コミット
1501ff843f

+ 22 - 9
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);
@@ -203,25 +209,32 @@ public interface MusicGroupPaymentCalenderDao extends BaseDAO<Long, MusicGroupPa
     MusicGroupPaymentCalender findByMusicGroupRegCalender(@Param("musicGroupId") String musicGroupId);
 
     /**
+     * @param calenderId:
+     * @return java.lang.String
      * @describe 获取收费标准名称
      * @apiNote 时光荏苒,认真工作的时间总是过得很快,而我、享受这一刻!
      * @author zouxuan
      * @date 2020/11/4
      * @time 10:11
-     * @param calenderId:
-     * @return java.lang.String
      */
     String getCalenderSettingsName(Long calenderId);
 
     /**
+     * @param musicGroupId:
+     * @param calenderId:
+     * @return int
      * @describe 统计乐团还在审核中或者审核被拒的缴费
      * @apiNote 时光荏苒,认真工作的时间总是过得很快,而我、享受这一刻!
      * @author zouxuan
      * @date 2020/11/4
      * @time 10:37
-     * @param musicGroupId:
-     * @param calenderId:
-     * @return int
      */
     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;
     }
 }

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

@@ -117,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("缴费有效期存在冲突,请修改缴费有效期");
@@ -266,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("缴费有效期存在冲突,请修改缴费有效期");
@@ -667,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">

+ 11 - 0
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>
@@ -451,4 +454,12 @@
             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>

+ 21 - 4
mec-web/src/main/java/com/ym/mec/web/controller/MusicGroupPaymentCalenderController.java

@@ -2,16 +2,20 @@ 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.entity.Employee;
 import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender;
 import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderCourseSettings;
+import com.ym.mec.biz.dal.entity.StudentRegistration;
+import com.ym.mec.biz.dal.enums.ClassGroupStudentStatusEnum;
 import com.ym.mec.biz.dal.page.MusicGroupPaymentCalenderQueryInfo;
 import com.ym.mec.biz.service.MusicGroupPaymentCalenderCourseSettingsService;
 import com.ym.mec.biz.service.MusicGroupPaymentCalenderService;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.entity.HttpResponseResult;
 
+import com.ym.mec.common.exception.BizException;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 
@@ -20,10 +24,13 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.MediaType;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.ui.ModelMap;
+import org.springframework.util.CollectionUtils;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
+import java.util.Objects;
 import java.util.stream.Collectors;
 
 @RequestMapping("musicGroupPaymentCalender")
@@ -39,6 +46,8 @@ public class MusicGroupPaymentCalenderController extends BaseController {
     private SysUserFeignService sysUserFeignService;
     @Autowired
     private EmployeeDao employeeDao;
+    @Autowired
+    private ClassGroupStudentMapperDao classGroupStudentMapperDao;
 
     @ApiOperation(value = "分页查询乐团缴费日历列表")
     @GetMapping(value = "/queryPage", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@@ -132,10 +141,18 @@ public class MusicGroupPaymentCalenderController extends BaseController {
     @ApiOperation(value = "获取指定学员在指定乐团下本次课排课时长")
     @GetMapping("/getMusicCourseSettingsWithStudents")
     @PreAuthorize("@pcs.hasPermissions('musicGroupPaymentCalender/getMusicCourseSettingsWithStudents')")
-    public HttpResponseResult<List<MusicGroupPaymentCalenderCourseSettings>> getMusicCourseSettingsWithStudents(String musicGroupId, String studentIds){
-        if(StringUtils.isBlank(studentIds)){
-            return failed("请指定学员编号");
+    public HttpResponseResult<List<MusicGroupPaymentCalenderCourseSettings>> getMusicCourseSettingsWithStudents(String musicGroupId, String studentIds, Long classGroupId){
+        List<Integer> studentIdList = new ArrayList<>();
+        if(StringUtils.isNotBlank(studentIds)){
+            studentIdList = Arrays.stream(studentIds.split(",")).map(id -> Integer.valueOf(id)).collect(Collectors.toList());
+        }
+        if(Objects.nonNull(classGroupId)){
+            List<StudentRegistration> studentList = classGroupStudentMapperDao.findClassStudentList(classGroupId.intValue(), ClassGroupStudentStatusEnum.NORMAL);
+            studentIdList = studentList.stream().map(StudentRegistration::getUserId).collect(Collectors.toList());
+        }
+        if(CollectionUtils.isEmpty(studentIdList)){
+            throw new BizException("未指定学员");
         }
-        return succeed(musicGroupPaymentCalenderCourseSettingsService.getMusicCourseSettingsWithStudents(musicGroupId,Arrays.stream(studentIds.split(",")).map(id -> Integer.valueOf(id)).collect(Collectors.toList())));
+        return succeed(musicGroupPaymentCalenderCourseSettingsService.getMusicCourseSettingsWithStudents(musicGroupId,studentIdList));
     }
 }