ソースを参照

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

zouxuan 5 年 前
コミット
26bb0d605d

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

@@ -26,6 +26,7 @@ import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.date.DateConvertor;
 import com.ym.mec.util.date.DateUtil;
 
+import net.bytebuddy.implementation.bytecode.Throw;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -634,7 +635,19 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
             musicGroupDao.update(musicGroup);
         }
 
+        List<Integer> classGroupIds = classGroupAndTeachers.stream().map(ClassGroupTeachersDto::getId).collect(Collectors.toList());
+
+        List<Map<Integer, Integer>> classGroupStudentNumMaps = classGroupStudentMapperDao.countClassGroupsStudentNum(classGroupIds, null);
+        Map<Integer, Long> classGroupStudentNumMap = MapUtil.convertIntegerMap(classGroupStudentNumMaps);
+
+        String waringStr = "";
         for (ClassGroupTeachersDto classGroupAndTeacher : classGroupAndTeachers) {
+            Long studentNum = classGroupStudentNumMap.get(classGroupAndTeacher.getId());
+            studentNum = Objects.isNull(studentNum) ? 0 : studentNum;
+            if(classGroupAndTeacher.getType().equals(ClassGroupTypeEnum.HIGH_ONLINE) && studentNum < 3 || studentNum >5){
+                String numWaring = studentNum < 3 ? "人数不能小于3\r\n" : "人数不能大于5\r\n";
+                waringStr += classGroupAndTeacher.getName()+numWaring;
+            }
             //班级的教师列表
             List<ClassGroupTeacherMapper> classGroupTeacherMapperList = classGroupAndTeacher.getClassGroupTeacherMapperList();
             for (ClassGroupTeacherMapper classGroupTeacherMapper : classGroupTeacherMapperList) {
@@ -660,7 +673,6 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 
                 for (TeacherDefaultMusicGroupSalary teacherDefaultMusicGroupSalary : teacherSalaryByUserIdAndType) {
                     if(teacherDefaultMusicGroupSalary.getCourseScheduleType().equals(CourseSchedule.CourseScheduleType.HIGH_ONLINE) && teacherDefaultMusicGroupSalary.getSalaryRuleJson() != null){
-                        Integer studentNum = classGroupStudentMapperDao.countClassGroupNormalStudentNum(classGroupTeacherMapper.getClassGroupId());
                         BigDecimal salary = JSON.parseObject(teacherDefaultMusicGroupSalary.getSalaryRuleJson()).getBigDecimal(studentNum.toString());
                         teacherDefaultMusicGroupSalary.setMainTeacher30MinSalary(salary);
                         teacherDefaultMusicGroupSalary.setMainTeacher90MinSalary(salary);
@@ -670,6 +682,9 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
             }
 
         }
+        if(!waringStr.isEmpty()){
+            throw new BizException(waringStr);
+        }
         return classGroupAndTeachers;
     }
 

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

@@ -367,6 +367,9 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
         }
         //更新维修单信息
         StudentRepair repairInfo = getRepairInfo(Integer.parseInt(studentPaymentOrder.getMusicGroupId()));
+        if(repairInfo == null){
+            throw new BizException("维修单不存在");
+        }
 
         Integer userId = studentPaymentOrder.getUserId();
 

+ 1 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SysUserCashAccountServiceImpl.java

@@ -97,6 +97,7 @@ public class SysUserCashAccountServiceImpl extends BaseServiceImpl<Integer, SysU
         detail.setBalance(cashAccount.getBalance().add(decimal));
         detail.setComment(memo + "-" + sysUserFeignService.queryUserInfo().getId());
         detail.setCreateTime(date);
+        detail.setDescription(memo);
         detail.setStatus(DealStatusEnum.SUCCESS);
         detail.setType(type);
         detail.setUpdateTime(date);

+ 10 - 14
mec-web/src/main/java/com/ym/mec/web/controller/SysUserCashAccountDetailController.java

@@ -1,15 +1,10 @@
 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.SysConfigDao;
-import com.ym.mec.biz.dal.dto.CashAccountDetail;
-import com.ym.mec.biz.dal.entity.SysUserCashAccountDetail;
-import com.ym.mec.biz.service.SysUserCashAccountDetailService;
-import com.ym.mec.common.controller.BaseController;
-import com.ym.mec.common.page.PageInfo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+
+import java.math.BigDecimal;
+
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -17,7 +12,13 @@ import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
-import java.math.BigDecimal;
+import com.ym.mec.auth.api.client.SysUserFeignService;
+import com.ym.mec.biz.dal.dao.SysConfigDao;
+import com.ym.mec.biz.dal.dto.CashAccountDetail;
+import com.ym.mec.biz.dal.entity.SysUserCashAccountDetail;
+import com.ym.mec.biz.service.SysUserCashAccountDetailService;
+import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.common.page.PageInfo;
 
 @RequestMapping("userCashAccountDetail")
 @Api(tags = "用户交易明细服务")
@@ -42,11 +43,6 @@ public class SysUserCashAccountDetailController extends BaseController {
     @GetMapping("/queryPage")
     @PreAuthorize("@pcs.hasPermissions('userCashAccountDetail/queryPage')")
     public Object queryPage(CashAccountDetail queryInfo) {
-        SysUser user = sysUserFeignService.queryUserInfo();
-        if (user == null || user.getId() != null) {
-            return failed("请重新登录");
-        }
-        queryInfo.setUserId(user.getId());
         PageInfo<SysUserCashAccountDetail> sysUserCashAccountDetailPageInfo = sysUserCashAccountDetailService.queryPage(queryInfo);
 
         int openHideMode = Integer.parseInt(sysConfigDao.findConfigValue("open_hide_mode"));