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

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

yonge 4 éve
szülő
commit
e41342558e

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

@@ -400,7 +400,8 @@ public interface CourseScheduleStudentPaymentDao extends BaseDAO<Long, CourseSch
      * @date 2020/12/2 0002
      * @return java.util.List<com.ym.mec.biz.dal.entity.CourseScheduleStudentPaymentDto>
      */
-    List<CourseScheduleStudentPaymentDto> findNeedUpdateActualPriceStudentCourses(@Param("courseIds") List<Long> courseIds);
+    List<CourseScheduleStudentPaymentDto> findNeedUpdateActualPriceStudentCourses(@Param("groupIds") List<String> groupIds,
+                                                                                  @Param("groupType") GroupType groupType);
 
     /**
      * 根据课程编号和,学员编号获取列表信息

+ 10 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/MusicGroupPaymentCalenderDto.java

@@ -202,10 +202,20 @@ public class MusicGroupPaymentCalenderDto {
 
 		private Date deadlinePaymentDate;
 
+		private BigDecimal paymentAmount;
+
 		private Date paymentValidStartDate;
 
 		private Date paymentValidEndDate;
 
+		public BigDecimal getPaymentAmount() {
+			return paymentAmount;
+		}
+
+		public void setPaymentAmount(BigDecimal paymentAmount) {
+			this.paymentAmount = paymentAmount;
+		}
+
 		public java.util.Date getStartPaymentDate() {
 			return startPaymentDate;
 		}

+ 12 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/ClassGroup.java

@@ -51,6 +51,10 @@ public class ClassGroup {
 	@ApiModelProperty(value = "乐团名称", required = true)
 	private String musicGroupName;
 
+	/** 分部 */
+	@ApiModelProperty(value = "分部", required = true)
+	private String organName;
+
 	/** 子班级名称列表 */
 	@ApiModelProperty(value = "子班班级名称")
 	private String classNames;
@@ -96,6 +100,14 @@ public class ClassGroup {
 	
 	private List<CourseSchedule> courseScheduleList = new ArrayList<CourseSchedule>();
 
+	public String getOrganName() {
+		return organName;
+	}
+
+	public void setOrganName(String organName) {
+		this.organName = organName;
+	}
+
 	public String getViewGroupName() {
 		return viewGroupName;
 	}

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/event/listener/CourseEventListener.java

@@ -56,7 +56,7 @@ public class CourseEventListener {
         logger.info("课程状态变更(执行开始):{}", courseStatusChangeEvent.getCourseIds());
 
         try{
-            courseScheduleStudentPaymentService.updateCourseActualPrice(new ArrayList<>(courseStatusChangeEvent.getCourseIds()));
+            courseScheduleStudentPaymentService.updateCourseActualPrice(null, null);
         } finally {
             redisCache.delete(KEY);
         }

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

@@ -512,7 +512,7 @@ public interface ClassGroupService extends BaseService<Integer, ClassGroup> {
      * @param studentIds
      * @return
      */
-    List<MusicGroupPaymentCalenderStudentDetail> queryStudentPaymentCalenders(Integer masterClassGroupId,List<Map<Integer, String>> classGroupStudents,List<Integer> studentIds);
+    List<MusicGroupPaymentCalenderStudentDetail> queryStudentPaymentCalenders(Integer masterClassGroupId,String classGroupStudents,List<Integer> studentIds);
 
     /**
      * 获取主班课程类型剩余价值

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

@@ -125,6 +125,6 @@ public interface CourseScheduleStudentPaymentService extends BaseService<Long, C
 	 * @date 2020/12/2 0002
 	 * @return void
 	 */
-	void updateCourseActualPrice(List<Long> courseIds);
+	void updateCourseActualPrice(List<String> groupIds, GroupType groupType);
 
 }

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

@@ -344,4 +344,12 @@ public interface StudentRegistrationService extends BaseService<Long, StudentReg
      */
     Boolean batchDelRegs(String musicGroupId,List<Integer> userIds);
 
+
+    /**
+     * 获取乐团学员剩余课程金额
+     * @param musicGroupId
+     * @return
+     */
+    List<StudentRegistration> getMusicGroupStuReBack(String musicGroupId);
+
 }

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

@@ -72,7 +72,6 @@ import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.page.QueryInfo;
 import com.ym.mec.common.redis.service.RedisCache;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
-import com.ym.mec.im.ImFeignService;
 import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.date.DateConvertor;
 import com.ym.mec.util.date.DateUtil;
@@ -140,7 +139,6 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
     private CourseScheduleStudentPaymentService courseScheduleStudentPaymentService;
     @Autowired
     private StudentApplyRefundsDao studentApplyRefundsDao;
-
     @Autowired
     private RedisCache<String, Object> redisCache;
     @Autowired
@@ -2936,6 +2934,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 
             Map<Integer, Long> totalNumMap = MapUtil.convertIntegerMap(courseScheduleDao.countTotalNumByClassGroupId(classGroupSet, null));
             Map<Integer, Long> currentNumMap = MapUtil.convertIntegerMap(courseScheduleDao.countExpendNumByClassGroupId(classGroupSet));
+
             for (ClassGroupTeachersDto classGroup : dataList) {
                 List<ClassGroupTeacherMapper> classGroupTeacherMappers = new ArrayList<>();
                 for (ClassGroupTeacherMapper classGroupTeacher : classGroupTeachers) {
@@ -3583,7 +3582,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 
     @Override
     @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
-    public List<MusicGroupPaymentCalenderStudentDetail> queryStudentPaymentCalenders(Integer masterClassGroupId,List<Map<Integer, String>> classGroupStudents,List<Integer> studentIds) {
+    public List<MusicGroupPaymentCalenderStudentDetail> queryStudentPaymentCalenders(Integer masterClassGroupId,String classGroupStudentMap,List<Integer> studentIds) {
         //获取主班剩余课程时长
         Map<String, BigDecimal> masterMap = MapUtil.convertIntegerMap(courseScheduleDao.querySubCourseTimeMap(masterClassGroupId));
         if(masterMap.size() <= 0){
@@ -3595,13 +3594,14 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 
         Map<Integer, Integer> studentCLassMap = new HashMap<>();
         List<Map<Integer, BigDecimal>> surplusCourseFeeMapList = new ArrayList<>();
-        for (Map<Integer, String> classGroupStudent : classGroupStudents) {
-            for (Integer integer : classGroupStudent.keySet()) {
+        List<Map<String,String>> classGroupStudents = (List<Map<String,String>>)JSON.parse(classGroupStudentMap);
+        for (Map<String, String> classGroupStudent : classGroupStudents) {
+            for (String integer : classGroupStudent.keySet()) {
                 //获取学员剩余课程费用
-                surplusCourseFeeMapList.addAll(studentRegistrationDao.querySurplusCourseFeeByClassGroupId(integer,classGroupStudent.get(integer)));
+                surplusCourseFeeMapList.addAll(studentRegistrationDao.querySurplusCourseFeeByClassGroupId(Integer.parseInt(integer),classGroupStudent.get(integer)));
                 String[] s = classGroupStudent.get(integer).split(",");
                 for (String s1 : s) {
-                    studentCLassMap.put(Integer.parseInt(s1),integer);
+                    studentCLassMap.put(Integer.parseInt(s1),Integer.parseInt(integer));
                 }
             }
         }
@@ -3717,7 +3717,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         List<Map<Integer, String>> classGroupStudents = mergeClassSplitClassAffirmDto.getClassGroupStudents();
         //获取默认的学员缴费详情
         List<MusicGroupPaymentCalenderStudentDetail> musicGroupPaymentCalenderStudentDetails = queryStudentPaymentCalenders(masterClassGroupId,
-                classGroupStudents,
+                JSON.toJSONString(mergeClassSplitClassAffirmDto.getClassGroupStudents()),
                 studentIds);
         //创建缴费项目
         MusicGroup musicGroup = musicGroupDao.findByClassGroupId(masterClassGroupId);

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

@@ -691,8 +691,9 @@ public class CourseScheduleStudentPaymentServiceImpl extends BaseServiceImpl<Lon
 
 	@Override
 	@Transactional(rollbackFor = Exception.class)
-	public void updateCourseActualPrice(List<Long> courseIds) {
-		List<CourseScheduleStudentPaymentDto> courseScheduleStudentPayments = courseScheduleStudentPaymentDao.findNeedUpdateActualPriceStudentCourses(courseIds);
+	public void updateCourseActualPrice(List<String> groupIds, GroupType groupType) {
+		studentDao.lockUser(1);
+		List<CourseScheduleStudentPaymentDto> courseScheduleStudentPayments = courseScheduleStudentPaymentDao.findNeedUpdateActualPriceStudentCourses(groupIds, groupType);
 		if(CollectionUtils.isEmpty(courseScheduleStudentPayments)){
 			return;
 		}

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

@@ -556,10 +556,9 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 			}else if(paymentType == SPAN_GROUP_CLASS_ADJUST){
 				MusicGroupStudentClassAdjust adjust = musicGroupStudentClassAdjustDao.findByBatchNo(batchNo);
 				//获取默认的学员缴费详情
-				List<Map<Integer,String>> classGroupStudents = (List<Map<Integer,String>>)JSON.parse(adjust.getClassGroupStudents());
 				List<Integer> studentIds = JSON.parseArray(adjust.getStudentIds(), Integer.class);
 				List<MusicGroupPaymentCalenderStudentDetail> musicGroupPaymentCalenderStudentDetails = classGroupService.queryStudentPaymentCalenders(adjust.getMasterClassGroupId(),
-						classGroupStudents,studentIds);
+						adjust.getClassGroupStudents(),studentIds);
 				List<MusicGroupPaymentCalenderStudentDetail> calenderStudentDetails = musicGroupPaymentCalenderDto.getMusicGroupPaymentCalenderStudentDetails();
 				boolean containsAll = musicGroupPaymentCalenderStudentDetails.containsAll(calenderStudentDetails);
 				if(!containsAll){
@@ -601,6 +600,9 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 					musicGroupPaymentCalenderCourseSettingsList.size());
 
 			BigDecimal totalPaymentAmount = new BigDecimal(0);
+			if(musicGroupPaymentCalenderDto.getPaymentType() == SPAN_GROUP_CLASS_ADJUST){
+				totalPaymentAmount = musicGroupPaymentDateRange.getPaymentAmount();
+			}
 			for (MusicGroupPaymentCalenderCourseSettings pccs : musicGroupPaymentCalenderCourseSettingsList) {
 
 				MusicGroupPaymentCalenderCourseSettings tempPccs = new MusicGroupPaymentCalenderCourseSettings();

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

@@ -1659,6 +1659,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         if (musicGroup == null) {
             throw new BizException("乐团不存在");
         }
+        courseScheduleStudentPaymentService.updateCourseActualPrice(Arrays.asList(musicGroupId), GroupType.MUSIC);
 
         if (musicGroup.getStatus() == MusicGroupStatusEnum.CANCELED || musicGroup.getStatus() == MusicGroupStatusEnum.PAUSE) {
             throw new BizException("申请失败,乐团状态[已取消]或[已暂停]");
@@ -1817,7 +1818,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         if (musicGroup == null) {
             throw new BizException("乐团不存在");
         }
-
+        courseScheduleStudentPaymentService.updateCourseActualPrice(Arrays.asList(musicGroupId), GroupType.MUSIC);
         if (musicGroup.getStatus() == MusicGroupStatusEnum.CANCELED || musicGroup.getStatus() == MusicGroupStatusEnum.PAUSE) {
             throw new BizException("退团失败,乐团状态[已取消]或[已暂停]");
         }
@@ -2755,6 +2756,8 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
             throw new BizException("乐团当前状态是{},不能关闭", musicGroup.getStatus().getMsg());
         }
 
+        courseScheduleStudentPaymentService.updateCourseActualPrice(Arrays.asList(musicGroup.getId()), GroupType.MUSIC);
+
         //有进行中的课不能关闭乐团
         Integer underwayCourseNum = courseScheduleDao.getUnderwayCourseNum(musicGroup.getId(), GroupType.MUSIC, CourseStatusEnum.UNDERWAY);
         if(underwayCourseNum >0){

+ 6 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java

@@ -1586,4 +1586,10 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
         }
         return true;
     }
+
+    @Override
+    public List<StudentRegistration> getMusicGroupStuReBack(String musicGroupId) {
+        courseScheduleStudentPaymentService.updateCourseActualPrice(Arrays.asList(musicGroupId), GroupType.MUSIC);
+        return this.findMusicGroupStudent(musicGroupId,null);
+    }
 }

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

@@ -283,6 +283,7 @@
         <result column="id_" property="id"/>
         <result column="music_group_id_" property="musicGroupId"/>
         <result column="music_group_name_" property="musicGroupName"/>
+        <result column="organName" property="organName"/>
         <result column="subject_id_list_" property="subjectIdList"/>
         <result column="memo_" property="memo"/>
         <result column="name_" property="name"/>
@@ -1423,8 +1424,9 @@
         <include refid="queryClassGroupPageSql"/>
     </select>
     <select id="queryClassGroupPage" resultMap="ClassGroupTeachers">
-        SELECT cg.*,mg.name_ music_group_name_ FROM class_group cg
+        SELECT cg.*,mg.name_ music_group_name_,o.name_ organName FROM class_group cg
         LEFT JOIN music_group mg ON mg.id_ = cg.music_group_id_
+        LEFT JOIN organization o ON o.id_ = mg.organ_id_
         <include refid="queryClassGroupPageSql"/>
         ORDER BY cg.id_ DESC
         <include refid="global.limit"/>

+ 5 - 4
mec-biz/src/main/resources/config/mybatis/CourseScheduleStudentPaymentMapper.xml

@@ -634,10 +634,11 @@
 			AND cs.id_ IS NOT NULL
 			AND ((cs.status_ = 'OVER' AND (cssp.actual_price_ IS NULL OR cssp.actual_price_ &lt; cssp.expect_price_))
 			OR ( cs.status_ = 'NOT_START' AND cssp.actual_price_ IS NOT NULL AND cssp.actual_price_ &gt; 0))
-			<if test="courseIds!=null and courseIds.size()>0">
-				AND cs.id_ IN
-				<foreach collection="courseIds" item="courseId" open="(" close=")" separator=",">
-					#{courseId}
+			<if test="groupIds!=null and groupIds.size()>0">
+				AND cs.group_type_ = #{groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
+				AND cs.music_group_id_ IN
+				<foreach collection="groupIds" item="groupId" open="(" close=")" separator=",">
+					#{groupId}
 				</foreach>
 			</if>
 	</select>

+ 2 - 1
mec-web/src/main/java/com/ym/mec/web/controller/ClassGroupController.java

@@ -1,5 +1,6 @@
 package com.ym.mec.web.controller;
 
+import com.alibaba.fastjson.JSON;
 import com.ym.mec.biz.dal.dao.EmployeeDao;
 import com.ym.mec.biz.dal.dto.*;
 import com.ym.mec.biz.dal.entity.Employee;
@@ -383,7 +384,7 @@ public class ClassGroupController extends BaseController {
     @PreAuthorize("@pcs.hasPermissions('classGroup/queryStudentPaymentCalenders')")
     public HttpResponseResult queryStudentPaymentCalenders(@RequestBody MergeClassSplitClassAffirmDto mergeClassSplitClassAffirmDto) {
         Map<Integer, List<MusicGroupPaymentCalenderStudentDetail>> collect = classGroupService.queryStudentPaymentCalenders(mergeClassSplitClassAffirmDto.getMasterClassGroupId(),
-                mergeClassSplitClassAffirmDto.getClassGroupStudents(),
+                JSON.toJSONString(mergeClassSplitClassAffirmDto.getClassGroupStudents()),
                 mergeClassSplitClassAffirmDto.getStudentIds())
                 .stream().collect(Collectors.groupingBy(e -> e.getClassGroupId()));
         return succeed(collect);

+ 11 - 2
mec-web/src/main/java/com/ym/mec/web/controller/StudentRegistrationController.java

@@ -186,7 +186,7 @@ public class StudentRegistrationController extends BaseController {
     @PreAuthorize("@pcs.hasPermissions('studentRegistration/del')")
     public HttpResponseResult<Boolean> del(Long id) {
         StudentRegistration studentRegistration = studentRegistrationService.get(id);
-        if(studentRegistration == null){
+        if (studentRegistration == null) {
             return failed("删除的报名信息不存在");
         }
         return succeed(studentRegistrationService.delReg(id));
@@ -197,7 +197,16 @@ public class StudentRegistrationController extends BaseController {
     @PostMapping("/batchDel")
     @PreAuthorize("@pcs.hasPermissions('studentRegistration/batchDel')")
     public HttpResponseResult<Boolean> batchDel(@RequestBody DelRegisterDto delRegisterDto) {
-        return succeed(studentRegistrationService.batchDelRegs(delRegisterDto.getMusicGroupId(),delRegisterDto.getUserIds()));
+        return succeed(studentRegistrationService.batchDelRegs(delRegisterDto.getMusicGroupId(), delRegisterDto.getUserIds()));
+    }
+
+
+    @ApiOperation(value = "获取乐团学生的退费信息")
+    @GetMapping("/getMusicGroupStuReBack")
+    @PreAuthorize("@pcs.hasPermissions('studentRegistration/getMusicGroupStuReBack')")
+    @ApiImplicitParams({@ApiImplicitParam(name = "musicGroupId", value = "乐团编号", required = true, dataType = "String")})
+    public HttpResponseResult getMusicGroupStuReBack(String musicGroupId) {
+        return succeed(studentRegistrationService.getMusicGroupStuReBack(musicGroupId));
     }
 
 }