Browse Source

Merge remote-tracking branch 'origin/master'

Joburgess 5 năm trước cách đây
mục cha
commit
d632919829

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

@@ -39,7 +39,7 @@ public interface StudentRegistrationDao extends BaseDAO<Long, StudentRegistratio
      * @param musicGroupId
      * @return
      */
-    List<Map<Integer, Long>> countPayNum(@Param("musicGroupId") String musicGroupId);
+    List<Map<Integer, Integer>> countPayNum(@Param("musicGroupId") String musicGroupId);
 
     /**
      * 学生报名缴费金额详情
@@ -206,7 +206,7 @@ public interface StudentRegistrationDao extends BaseDAO<Long, StudentRegistratio
      * @param musicGroupId
      * @return
      */
-    List<Map<Long, Long>> countApplyNum(String musicGroupId);
+    List<Map<Integer, Integer>> countApplyNum(String musicGroupId);
 
     /**
      * 根据家长手机号获取用户编号

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

@@ -1,5 +1,6 @@
 package com.ym.mec.biz.service;
 
+import java.io.IOException;
 import java.math.BigDecimal;
 import java.util.List;
 import java.util.Map;
@@ -73,7 +74,7 @@ public interface StudentRegistrationService extends BaseService<Long, StudentReg
 	 * @param studentRegistration
 	 * @return
 	 */
-	StudentRegistration addStudent(StudentRegistration studentRegistration);
+	StudentRegistration addStudent(StudentRegistration studentRegistration) throws IOException;
 
 	/**
 	 * 查询学生信息

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

@@ -21,12 +21,14 @@ import com.ym.mec.im.ImFeignService;
 import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
 import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.date.DateUtil;
+import com.ym.mec.util.http.HttpUtil;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
+import java.io.IOException;
 import java.math.BigDecimal;
 import java.util.*;
 import java.util.stream.Collectors;
@@ -107,11 +109,11 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
             throw new Exception("学员信息不存在");
         }
         //当前专业报名人数减一
-//        musicGroupSubjectPlanService.addApplyStudentNum(musicGroupId,studentRegistration.getActualSubjectId(),-1);
+        musicGroupSubjectPlanService.addApplyStudentNum(musicGroupId,studentRegistration.getActualSubjectId(),-1);
         //批量调剂(未缴费学员)
-//        int i = studentRegistrationDao.batchUpdateSubject(userId, subId, musicGroupId);
+        int i = studentRegistrationDao.batchUpdateSubject(userId, subId, musicGroupId);
         //修改专业已报名人数
-//        musicGroupSubjectPlanService.addApplyStudentNum(musicGroupId,subId,1);
+        musicGroupSubjectPlanService.addApplyStudentNum(musicGroupId,subId,1);
         MusicGroup musicGroup = musicGroupDao.get(musicGroupId);
         Set<Integer> roleIds = new HashSet<>(2);
         roleIds.add(SysUserRole.SECTION_MANAGER);
@@ -160,7 +162,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public StudentRegistration addStudent(StudentRegistration studentRegistration) {
+    public StudentRegistration addStudent(StudentRegistration studentRegistration) throws IOException {
         Date date = new Date();
         Integer userId = 0;
         SysUser sysUser = studentRegistrationDao.getSysUserByPhone(studentRegistration.getParentsPhone());
@@ -208,7 +210,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
         map.put(studentRegistration.getUserId(),studentRegistration.getParentsPhone());
         sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.YIMEI,
                 MessageTypeEnum.SMS_APPLY_MESSAGE,map,null,0,"",
-                studentRegistration.getParentsName(),subject.getName(),studentApplyUrl,
+                studentRegistration.getParentsName(),subject.getName(), HttpUtil.getSortUrl(studentApplyUrl),
                 DateUtil.format(musicGroup.getApplyExpireDate(),DateUtil.DATE_FORMAT_MIN),serverPhone);
         return studentRegistration;
     }
@@ -428,6 +430,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
             } else {
                 userId = sysUser.getId();
             }
+            studentRegistration.setActualSubjectId(studentRegistration.getSubjectId());
             studentRegistration.setUserId(userId);
             studentRegistration.setPaymentStatus(PaymentStatusEnum.YES);
             studentRegistration.setMusicGroupStatus(ClassGroupStudentStatusEnum.NORMAL);

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

@@ -1,5 +1,6 @@
 package com.ym.mec.biz.service.impl;
 
+import com.alibaba.fastjson.JSONObject;
 import com.ym.mec.biz.dal.dao.StudentRegistrationDao;
 import com.ym.mec.biz.dal.dao.SubjectDao;
 import com.ym.mec.biz.dal.dao.SubjectGoodsMapperDao;
@@ -60,14 +61,14 @@ public class SubjectServiceImpl extends BaseServiceImpl<Integer, Subject>  imple
     public List<SubjectApplyDetailDto> findSubApplyDetail(String musicGroupId) {
         List<SubjectApplyDetailDto> subApplyDetail = subjectDao.findSubApplyDetail(musicGroupId);
 //        //统计当前乐团不同声部的报名人数
-//        Map<Long,Long> applyNum = MapUtil.convertMybatisMap(studentRegistrationDao.countApplyNum(musicGroupId));
-//        Map<Integer, Long> payNumMap = MapUtil.convertMybatisMap(studentRegistrationDao.countPayNum(musicGroupId));
-//        subApplyDetail.forEach(detail ->{
-//            Long num = payNumMap.get(detail.getSubjectId());
-//            detail.setPayNum(num == null?0:num.intValue());
-//            num = applyNum.get(detail.getSubjectId().longValue());
-//            detail.setApplyStudentNum(num == null?0:num.intValue());
-//        });
+        Map<Integer,Integer> applyNum = JSONObject.parseObject(JSONObject.toJSONString(MapUtil.convertIntegerMap(studentRegistrationDao.countApplyNum(musicGroupId))),HashMap.class);
+        Map<Integer, Integer> payNumMap = JSONObject.parseObject(JSONObject.toJSONString(MapUtil.convertIntegerMap(studentRegistrationDao.countPayNum(musicGroupId))),HashMap.class);
+        subApplyDetail.forEach(detail ->{
+            Integer num = payNumMap.get(detail.getSubjectId());
+            detail.setPayNum(num == null?0:num);
+            num = applyNum.get(detail.getSubjectId());
+            detail.setApplyStudentNum(num == null?0:num);
+        });
         return subApplyDetail;
     }
 

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

@@ -87,7 +87,10 @@ public class TeacherLeaveRecordServiceImpl extends BaseServiceImpl<Long, Teacher
 		Set<Integer> roleIds = new HashSet<>(1);
 		Teacher teacher = teacherDao.get(userId);
 		roleIds.add(SysUserRole.DEAN_OF_STUDIES);
-		sysMessageService.batchSeoMessage(musicGroupDao.queryUserIdByRoleId(roleIds),MessageTypeEnum.EDUCATION_PUSH_TEACHER_LEAVE_APPLY,"",teacher.getRealName());
+		Set<Integer> userIds = musicGroupDao.queryUserIdByRoleId(roleIds);
+		if (userIds != null && userIds.size() > 0) {
+			sysMessageService.batchSeoMessage(userIds, MessageTypeEnum.EDUCATION_PUSH_TEACHER_LEAVE_APPLY, "", teacher.getRealName());
+		}
 		return true;
 	}
 

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

@@ -569,6 +569,7 @@
         LEFT JOIN teacher_attendance ta ON ta.course_schedule_id_ = cs.id_
         LEFT JOIN class_group_relation cgr ON cgr.sub_class_group_id_ = cs.class_group_id_
         <include refid="queryMusicGroupCourseScheduleSql"/>
+        ORDER BY cs.class_date_ DESC,cs.start_class_time_ DESC
         <include refid="global.limit"/>
     </select>
 

+ 2 - 1
mec-biz/src/main/resources/config/mybatis/SubjectMapper.xml

@@ -110,7 +110,8 @@
         <result column="not_part_class_num_" property="notPartClassNum"/>
     </resultMap>
     <select id="findSubApplyDetail" resultMap="subApplyDetail">
-        SELECT mgsp.subject_id_,s.name_,mgsp.expected_student_num_,mgsp.apply_student_num_,mgsp.paid_student_num_ pay_num_,mgsp.id_ music_group_subject_plan_id_
+        SELECT mgsp.subject_id_,s.name_,mgsp.expected_student_num_,mgsp.apply_student_num_,
+        mgsp.paid_student_num_ pay_num_,mgsp.id_ music_group_subject_plan_id_
         FROM music_group_subject_plan mgsp
         LEFT JOIN `subject` s ON mgsp.subject_id_ = s.id_
         WHERE mgsp.music_group_id_ = #{musicGroupId} AND s.del_flag_ = 0

+ 2 - 1
mec-student/src/main/java/com/ym/mec/student/controller/MusicGroupRegisterController.java

@@ -16,6 +16,7 @@ import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import java.io.IOException;
 import java.util.Date;
 
 @RequestMapping("register")
@@ -33,7 +34,7 @@ public class MusicGroupRegisterController extends BaseController {
 
     @ApiOperation(value = "新增学生报名信息")
     @PostMapping("/add")
-    public HttpResponseResult add(@RequestBody StudentRegistration studentRegistration) {
+    public HttpResponseResult add(@RequestBody StudentRegistration studentRegistration) throws IOException {
         Date date = new Date();
         MusicGroup musicGroup = musicGroupService.get(studentRegistration.getMusicGroupId());
         if (musicGroup == null) {

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

@@ -190,7 +190,7 @@ public class ClassGroupController extends BaseController {
     @ApiImplicitParams({@ApiImplicitParam(name = "musicGroupId", value = "乐团编号", required = true, dataType = "String"),
             @ApiImplicitParam(name = "teacherId", value = "老师编号", required = true, dataType = "Integer")})
     public Object addMusicGroupTeam(Integer teacherId, String musicGroupId, Integer improventClassesNum) throws Exception {
-        if (teacherId == null || StringUtils.isEmpty(musicGroupId) || improventClassesNum == null) {
+        if (teacherId == null || StringUtils.isEmpty(musicGroupId)) {
             return failed("参数校验错误");
         }
         classGroupService.addMusicGroupTeam(teacherId, musicGroupId, improventClassesNum);