Browse Source

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

zouxuan 4 years ago
parent
commit
10dc0875e4

+ 4 - 9
mec-biz/src/main/java/com/ym/mec/biz/dal/enums/MusicGroupStatusEnum.java

@@ -3,23 +3,18 @@ package com.ym.mec.biz.dal.enums;
 import com.ym.mec.common.enums.BaseEnum;
 
 public enum MusicGroupStatusEnum implements BaseEnum<String, MusicGroupStatusEnum> {
-	DRAFT("DRAFT", "草稿"), FEE_AUDIT("FEE_AUDIT","费用审核中"), AUDIT("AUDIT", "审核中"),
-	AUDIT_FAILED("AUDIT_FAILED", "审核失败"), APPLY("APPLY", "报名中"),
-	PAY("PAY", "缴费中"), PREPARE("PREPARE", "筹备中"),
-	PROGRESS("PROGRESS", "进行中"), CANCELED("CANCELED", "取消"), PAUSE("PAUSE", "暂停"),
-	CLOSE("CLOSE", "关闭");
+	DRAFT("草稿"), AUDIT("审核中"), AUDIT_FAILED("审核失败"), PRE_APPLY("预报名"), FEE_AUDIT("费用审核中"), APPLY("报名中"), PAY("缴费中"), PREPARE("筹备中"), PROGRESS(
+			"进行中"), CANCELED("取消"), PAUSE("暂停"), CLOSE("关闭");
 
-	private String code;
 	private String msg;
 
-	MusicGroupStatusEnum(String code, String msg) {
-		this.code = code;
+	MusicGroupStatusEnum(String msg) {
 		this.msg = msg;
 	}
 
 	@Override
 	public String getCode() {
-		return this.code;
+		return this.name();
 	}
 
 	public String getMsg() {

+ 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);
 
     /**
      * 获取主班课程类型剩余价值

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

@@ -3583,7 +3583,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 +3595,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 +3718,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);

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

@@ -147,6 +147,11 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 		if (musicGroup == null) {
 			throw new BizException("乐团查询失败,请检查参数");
 		}
+		
+		if (musicGroup.getStatus() != MusicGroupStatusEnum.PROGRESS && musicGroup.getStatus() != MusicGroupStatusEnum.PRE_APPLY) {
+			throw new BizException("创建失败:乐团当前状态不能创建缴费");
+		}
+		
 		SysUser sysUser = sysUserFeignService.queryUserInfo();
 		if (sysUser == null) {
 			throw new BizException("请登录");
@@ -397,17 +402,14 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 
 		// 如果是报名,需要修改乐团状态
 		if (paymentType == MUSIC_APPLY) {
-			if (musicGroup.getStatus() != MusicGroupStatusEnum.DRAFT) {
-				throw new BizException("创建失败:缴费项目类型不匹配");
-			}
 			if (status != AUDITING) {
-				musicGroup.setStatus(MusicGroupStatusEnum.AUDIT);
+				musicGroup.setStatus(MusicGroupStatusEnum.APPLY);
 				// 记录操作日志
-				musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroupId, "报名缴费项目创建成功(草稿 -> 基础信息审核中)", sysUser.getId(), ""));
+				musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroupId, "报名缴费项目创建成功(预报名 -> 报名中)", sysUser.getId(), ""));
 			} else {
 				musicGroup.setStatus(MusicGroupStatusEnum.FEE_AUDIT);
 				// 记录操作日志
-				musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroupId, "报名缴费项目创建成功(草稿 -> 费用审核中)", sysUser.getId(), ""));
+				musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroupId, "报名缴费项目创建成功(预报名 -> 费用审核中)", sysUser.getId(), ""));
 			}
 			musicGroup.setUpdateTime(date);
 			musicGroupDao.update(musicGroup);
@@ -554,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){
@@ -717,17 +718,14 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 
 		// 如果是报名,需要修改乐团状态
 		if (paymentType == MUSIC_APPLY) {
-			if (musicGroup.getStatus() != MusicGroupStatusEnum.DRAFT) {
-				throw new BizException("创建失败:缴费项目类型不匹配");
-			}
 			if (status != AUDITING) {
-				musicGroup.setStatus(MusicGroupStatusEnum.AUDIT);
+				musicGroup.setStatus(MusicGroupStatusEnum.APPLY);
 				// 记录操作日志
-				musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroupId, "报名缴费项目创建成功(草稿 -> 基础信息审核中)", sysUser.getId(), ""));
+				musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroupId, "报名缴费项目创建成功(预报名 -> 报名中)", sysUser.getId(), ""));
 			} else {
 				musicGroup.setStatus(MusicGroupStatusEnum.FEE_AUDIT);
 				// 记录操作日志
-				musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroupId, "报名缴费项目创建成功(草稿 -> 费用审核中)", sysUser.getId(), ""));
+				musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroupId, "报名缴费项目创建成功(预报名 -> 费用审核中)", sysUser.getId(), ""));
 			}
 			musicGroup.setUpdateTime(date);
 			musicGroupDao.update(musicGroup);

+ 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);