zouxuan пре 5 година
родитељ
комит
8304b1e0cb

+ 10 - 2
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupSubjectPlanDao.java

@@ -49,8 +49,16 @@ public interface MusicGroupSubjectPlanDao extends BaseDAO<Integer, MusicGroupSub
 
     /**
      * 修改计划招生人数
-     * @param updateExpectedNumDtos
+     * @param expectedStudentNum
+     * @param musicGroupSubjectPlanId
      * @return
      */
-    int updateExpectedStudentNum(@Param("updateExpectedNumDtos") List<UpdateExpectedNumDto> updateExpectedNumDtos);
+    int updateExpectedStudentNum(@Param("expectedStudentNum") Integer expectedStudentNum,@Param("musicGroupSubjectPlanId") Integer musicGroupSubjectPlanId);
+
+    /**
+     *
+     * @param musicGroupSubjectPlans
+     * @return
+     */
+    int batchUpdateFee(@Param("plans") List<MusicGroupSubjectPlan> musicGroupSubjectPlans);
 }

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

@@ -202,7 +202,7 @@ public interface MusicGroupService extends BaseService<String, MusicGroup> {
 	 * @param updateExpectedNumDtos
 	 * @return
 	 */
-    int updateExpectedStudentNum(List<UpdateExpectedNumDto> updateExpectedNumDtos);
+	void updateExpectedStudentNum(List<UpdateExpectedNumDto> updateExpectedNumDtos);
 
 	/**
 	 * 开启乐团(筹备中 -->  进行中)
@@ -215,4 +215,16 @@ public interface MusicGroupService extends BaseService<String, MusicGroup> {
 	 * @param musicGroupId
 	 */
 	void musicGroupAudit(String musicGroupId) throws Exception;
+
+	/**
+	 * 审核失败(审核中 -> 审核失败)
+	 * @param musicGroupId
+	 */
+	void musicGroupAuditFailed(String musicGroupId,String memo) throws Exception;
+
+	/**
+	 * 审核通过(审核中 -> 报名中)
+	 * @param musicGroupId
+	 */
+	void musicGroupAuditSuccess(String musicGroupId) throws Exception;
 }

+ 7 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/MusicGroupSubjectPlanService.java

@@ -47,4 +47,11 @@ public interface MusicGroupSubjectPlanService extends BaseService<Integer, Music
      * @param subjectId
      */
     void addApplyStudentNum(String musicGroupId, Integer subjectId,int num);
+
+    /**
+     * 批量修改声部规划费用
+     * @param musicGroupSubjectPlans
+     * @return
+     */
+    int batchUpdateFee(List<MusicGroupSubjectPlan> musicGroupSubjectPlans);
 }

+ 88 - 52
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java

@@ -189,8 +189,8 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         //乐团状态是否正确
         MusicGroup musicGroup = musicGroupDao.get(musicGroupId);
         if(musicGroup != null){
-            if(musicGroup.getStatus() != MusicGroupStatusEnum.AUDIT || musicGroup.getStatus() != MusicGroupStatusEnum.DRAFT){
-                throw new Exception("乐团状态异常");
+            if(musicGroup.getStatus() != MusicGroupStatusEnum.DRAFT || musicGroup.getStatus() != MusicGroupStatusEnum.AUDIT_FAILED){
+                throw new Exception("当前乐团状态不支持此操作");
             }
             //记录日志信息
             musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroupId,"修改乐团计划声部、乐器",sysUser.getId(), JSONObject.toJSONString(subFeeSettingDto)));
@@ -208,8 +208,10 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public int updateExpectedStudentNum(List<UpdateExpectedNumDto> updateExpectedNumDtos) {
-        return musicGroupSubjectPlanDao.updateExpectedStudentNum(updateExpectedNumDtos);
+    public void updateExpectedStudentNum(List<UpdateExpectedNumDto> updateExpectedNumDtos) {
+        updateExpectedNumDtos.forEach(e->{
+            musicGroupSubjectPlanDao.updateExpectedStudentNum(e.getExpectedStudentNum(),e.getMusicGroupSubjectPlanId());
+        });
     }
 
     @Override
@@ -242,7 +244,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
             throw new Exception("乐团信息不存在");
         }
         if(musicGroup.getStatus() != statusEnum){
-            throw new Exception("乐团状态异常");
+            throw new Exception("当前乐团状态不支持此操作");
         }
         musicGroup.setUpdateTime(date);
         return musicGroup;
@@ -262,6 +264,33 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
     }
 
     @Override
+    public void musicGroupAuditFailed(String musicGroupId,String memo) throws Exception {
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if(sysUser == null){
+            throw new Exception("用户信息获取失败");
+        }
+        MusicGroup musicGroup = saveLog(musicGroupId,MusicGroupStatusEnum.AUDIT);
+        //记录操作日志
+        musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroupId,"审核失败(审核中 -> 审核失败)",sysUser.getId(),memo));
+        musicGroup.setMemo(memo);
+        musicGroup.setStatus(MusicGroupStatusEnum.AUDIT_FAILED);
+        musicGroupDao.update(musicGroup);
+    }
+
+    @Override
+    public void musicGroupAuditSuccess(String musicGroupId) throws Exception {
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if(sysUser == null){
+            throw new Exception("用户信息获取失败");
+        }
+        MusicGroup musicGroup = saveLog(musicGroupId,MusicGroupStatusEnum.AUDIT);
+        //记录操作日志
+        musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroupId,"审核失败(审核中 -> 报名中)",sysUser.getId(),""));
+        musicGroup.setStatus(MusicGroupStatusEnum.APPLY);
+        musicGroupDao.update(musicGroup);
+    }
+
+    @Override
     public List<MusicCardDto> queryUserMusicGroups(Integer userId) {
         List<MusicCardDto> musicCardDtos = musicGroupDao.queryUserMusicGroups(userId);
         Set<String> musicGroupIds = musicCardDtos.stream().map(MusicCardDto::getMusicGroupId).collect(Collectors.toSet());
@@ -683,57 +712,64 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
     @Override
     @Transactional(rollbackFor = Exception.class)
     public void updateBaseInfo(SubFeeSettingDto subFeeSettingDto) throws Exception {
-        MusicGroup musicGroup = subFeeSettingDto.getMusicGroup();
-        String musicGroupId = musicGroup.getId();
-        MusicGroup group = musicGroupDao.get(musicGroupId);
-        if(group != null){
-            Date date = new Date();
-            List<Integer> months = subFeeSettingDto.getMonths();
-            //删除乐团相关付费周期
-            musicGroupPaymentCalenderDao.delByGroupId(musicGroupId);
-            if(months != null && months.size() > 0){
-                Integer num = musicGroupStudentFeeDao.countStudentNoPayNum(musicGroupId);
-                if(num > 0){
-                    throw new Exception("缴费周期更新失败,当前乐团有未缴费的学员");
-                }
-                //修改学员下次缴费日期
-                //获取当前月份
-                int currentMonth = Integer.parseInt(DateUtil.getMonth(date));
-                int nextMonth = currentMonth;
-                for (int i = 0;i < months.size();i++){
-                    if(i == months.size()-1 && months.get(i) <= currentMonth){
-                        nextMonth = months.get(0);
-                        break;
-                    }else if(months.get(i) > currentMonth){
-                        nextMonth = months.get(i);
-                        break;
-                    }
-                }
-                // 修改学员付费周期
-                Date nextPaymentDate = null;
-                if(nextMonth > currentMonth){
-                    nextPaymentDate = DateUtil.addMonths(date, nextMonth - currentMonth);
-                }else if(nextMonth < currentMonth) {
-                    nextPaymentDate = DateUtil.addMonths(date, 12 - currentMonth + nextMonth);
-                }else {
-                    nextPaymentDate = DateUtil.addMonths(date, 12);
-                }
-                musicGroupStudentFeeDao.updateNextPaymentDate(musicGroupId,nextPaymentDate);
-                //批量插入
-                musicGroupPaymentCalenderDao.batchAdd(months,musicGroupId);
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if(sysUser == null){
+            throw new Exception("用户信息获取失败");
+        }
+        String musicGroupId = subFeeSettingDto.getMusicGroup().getId();
+        MusicGroup musicGroup = saveLog(musicGroupId,MusicGroupStatusEnum.DRAFT);
+        if(musicGroup.getStatus() != MusicGroupStatusEnum.AUDIT_FAILED){
+            throw new Exception("当前乐团状态不支持此操作");
+        }
+
+        Date date = new Date();
+        List<Integer> months = subFeeSettingDto.getMonths();
+        //删除乐团相关付费周期
+        musicGroupPaymentCalenderDao.delByGroupId(musicGroupId);
+        if(months != null && months.size() > 0){
+            Integer num = musicGroupStudentFeeDao.countStudentNoPayNum(musicGroupId);
+            if(num > 0){
+                throw new Exception("缴费周期更新失败,当前乐团有未缴费的学员");
             }
-            musicGroupDao.update(musicGroup);
-            //修改课程里面的教学点
-            if(!group.getSchoolId().equals(musicGroup.getSchoolId())){
-                courseScheduleDao.updateByMusicGroupId(musicGroupId,musicGroup.getSchoolId());
+            //修改学员下次缴费日期
+            //获取当前月份
+            int currentMonth = Integer.parseInt(DateUtil.getMonth(date));
+            int nextMonth = currentMonth;
+            for (int i = 0;i < months.size();i++){
+                if(i == months.size()-1 && months.get(i) <= currentMonth){
+                    nextMonth = months.get(0);
+                    break;
+                }else if(months.get(i) > currentMonth){
+                    nextMonth = months.get(i);
+                    break;
+                }
             }
-            // 删除乐团付费主体列表
-            musicGroupPaymentEntitiesDao.delByGroupId(musicGroupId);
-            //批量新增
-            if(subFeeSettingDto.getMusicGroupPaymentEntities() != null && subFeeSettingDto.getMusicGroupPaymentEntities().size() > 0){
-                musicGroupPaymentEntitiesDao.batchAdd(subFeeSettingDto.getMusicGroupPaymentEntities(),musicGroupId);
+            // 修改学员付费周期
+            Date nextPaymentDate = null;
+            if(nextMonth > currentMonth){
+                nextPaymentDate = DateUtil.addMonths(date, nextMonth - currentMonth);
+            }else if(nextMonth < currentMonth) {
+                nextPaymentDate = DateUtil.addMonths(date, 12 - currentMonth + nextMonth);
+            }else {
+                nextPaymentDate = DateUtil.addMonths(date, 12);
             }
+            musicGroupStudentFeeDao.updateNextPaymentDate(musicGroupId,nextPaymentDate);
+            //批量插入
+            musicGroupPaymentCalenderDao.batchAdd(months,musicGroupId);
+        }
+        musicGroupDao.update(musicGroup);
+        //修改课程里面的教学点
+        if(!musicGroup.getSchoolId().equals(musicGroup.getSchoolId())){
+            courseScheduleDao.updateByMusicGroupId(musicGroupId,musicGroup.getSchoolId());
         }
+        // 删除乐团付费主体列表
+        musicGroupPaymentEntitiesDao.delByGroupId(musicGroupId);
+        //批量新增
+        if(subFeeSettingDto.getMusicGroupPaymentEntities() != null && subFeeSettingDto.getMusicGroupPaymentEntities().size() > 0){
+            musicGroupPaymentEntitiesDao.batchAdd(subFeeSettingDto.getMusicGroupPaymentEntities(),musicGroupId);
+        }
+        //记录操作日志
+        musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroupId,"修改乐团基本信息数据",sysUser.getId(),JSONObject.toJSONString(subFeeSettingDto)));
     }
 
     @Override

+ 5 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupSubjectPlanServiceImpl.java

@@ -120,4 +120,9 @@ public class MusicGroupSubjectPlanServiceImpl extends BaseServiceImpl<Integer, M
         musicOneSubjectClassPlan.setUpdateTime(new Date());
         musicGroupSubjectPlanDao.updateApplyStudentNum(musicOneSubjectClassPlan);
     }
+
+    @Override
+    public int batchUpdateFee(List<MusicGroupSubjectPlan> musicGroupSubjectPlans) {
+        return musicGroupSubjectPlanDao.batchUpdateFee(musicGroupSubjectPlans);
+    }
 }

+ 6 - 6
mec-biz/src/main/resources/config/mybatis/MusicGroupSubjectPlanMapper.xml

@@ -104,12 +104,12 @@
     </update>
 
     <update id="updateExpectedStudentNum">
-        <foreach collection="updateExpectedNumDtos" item="item" index="index" open="" close="" separator=";">
-            UPDATE music_group_subject_plan
-            <set>
-                expected_student_num_ = #{item.expectedStudentNum}
-            </set>
-            where id_ = #{item.musicGroupSubjectPlanId}
+        UPDATE music_group_subject_plan SET expected_student_num_ = #{expectedStudentNum},update_time_ = now() WHERE id_ = #{musicGroupSubjectPlanId}
+    </update>
+
+    <update id="batchUpdateFee">
+        <foreach collection="plans" item="item" separator=";">
+            UPDATE music_group_subject_plan SET fee_ = #{item.fee},update_time_ = now() WHERE id_ = #{item.id}
         </foreach>
     </update>
 

+ 21 - 1
mec-web/src/main/java/com/ym/mec/web/controller/MusicGroupController.java

@@ -73,7 +73,8 @@ public class MusicGroupController extends BaseController {
 		if(updateExpectedNumDtos == null || updateExpectedNumDtos.size() <= 0){
 			return failed("参数校验错误");
 		}
-		return succeed(musicGroupService.updateExpectedStudentNum(updateExpectedNumDtos));
+		musicGroupService.updateExpectedStudentNum(updateExpectedNumDtos);
+		return succeed();
 	}
 
 	@ApiOperation(value = "根据乐团编号查询乐团详情")
@@ -143,6 +144,25 @@ public class MusicGroupController extends BaseController {
 		return succeed();
 	}
 
+	@ApiOperation(value = "审核失败(审核中 -> 审核失败)")
+	@PostMapping("/auditFailed")
+	@PreAuthorize("@pcs.hasPermissions('musicGroup/auditFailed')")
+	@ApiImplicitParams({ @ApiImplicitParam(name = "musicGroupId", value = "乐团编号", required = true, dataType = "String"),
+			@ApiImplicitParam(name = "memo", value = "memo", required = true, dataType = "String") })
+	public Object auditFailed(String musicGroupId,String memo) throws Exception {
+		musicGroupService.musicGroupAuditFailed(musicGroupId,memo);
+		return succeed();
+	}
+
+	@ApiOperation(value = "审核通过(审核中 -> 报名中)")
+	@PostMapping("/auditSuccess")
+	@PreAuthorize("@pcs.hasPermissions('musicGroup/auditSuccess')")
+	@ApiImplicitParams({ @ApiImplicitParam(name = "musicGroupId", value = "乐团编号", required = true, dataType = "String")})
+	public Object auditSuccess(String musicGroupId) throws Exception {
+		musicGroupService.musicGroupAuditSuccess(musicGroupId);
+		return succeed();
+	}
+
 	@ApiOperation(value = "开启乐团(筹备中 -->  进行中)")
 	@PostMapping("/action")
 	@PreAuthorize("@pcs.hasPermissions('musicGroup/action')")

+ 17 - 0
mec-web/src/main/java/com/ym/mec/web/controller/MusicGroupSubjectPlanController.java

@@ -1,5 +1,6 @@
 package com.ym.mec.web.controller;
 
+import com.ym.mec.biz.dal.entity.MusicGroupSubjectPlan;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
@@ -14,6 +15,8 @@ import org.springframework.web.bind.annotation.RestController;
 import com.ym.mec.biz.service.MusicGroupSubjectPlanService;
 import com.ym.mec.common.controller.BaseController;
 
+import java.util.List;
+
 @RequestMapping("musicGroupSubjectPlan")
 @Api(tags = "乐团声部计划服务")
 @RestController
@@ -36,4 +39,18 @@ public class MusicGroupSubjectPlanController extends BaseController {
         return succeed(musicGroupSubjectPlanService.getMusicSubjectClassPlan(musicGroupId));
     }
 
+    @ApiOperation(value = "获取乐团声部规划列表")
+    @GetMapping("/queryPage")
+    @PreAuthorize("@pcs.hasPermissions('musicGroupSubjectPlan/getMusicSubjectClass')")
+    public Object queryPage(@ApiParam(value = "乐团编号", required = true) String musicGroupId) {
+        return succeed(musicGroupSubjectPlanService.getMusicSubjectClassPlan(musicGroupId));
+    }
+
+    @ApiOperation(value = "修改乐团声部规划费用")
+    @GetMapping("/batchUpdateFee")
+    @PreAuthorize("@pcs.hasPermissions('musicGroupSubjectPlan/batchUpdateFee')")
+    public Object batchUpdateFee(List<MusicGroupSubjectPlan> musicGroupSubjectPlans) {
+        return succeed(musicGroupSubjectPlanService.batchUpdateFee(musicGroupSubjectPlans));
+    }
+
 }