Browse Source

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

# Conflicts:
#	mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java
zouxuan 5 years ago
parent
commit
4db4820fa3

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

@@ -413,4 +413,6 @@ public interface ClassGroupDao extends BaseDAO<Integer, ClassGroup> {
      * @return
      */
     List<HighClassGroupDto> findClassGroupByMusicGroupIdAndSubjectId(@Param("musicGroupId") String musicGroupId, @Param("subjectId") Integer subjectId);
+
+    int batchUpdateClassGroupCourseTimes(@Param("classGroupCourseTimes") Map<Integer,Integer> classGroupCourseTimes);
 }

+ 9 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleDao.java

@@ -544,4 +544,13 @@ public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
      * @return
      */
     CourseSchedule findOneCourseScheduleByClassGroupId(@Param("classGroupId") Integer classGroupId);
+
+    /**
+     * @describe 统计指定班级的课程数量
+     * @author Joburgess
+     * @date 2019/11/12
+     * @param classGroupIds: 班级编号列表
+     * @return java.util.List<java.util.Map<java.lang.Integer,java.lang.Integer>>
+     */
+    List<Map<Integer,Integer>> countClassGroupCourseTimes(@Param("classGroupIds") List<Integer> classGroupIds);
 }

+ 5 - 6
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/OrganizationDao.java

@@ -1,11 +1,10 @@
 package com.ym.mec.biz.dal.dao;
 
-import java.util.List;
-
-import org.apache.ibatis.annotations.Param;
-
 import com.ym.mec.biz.dal.entity.Organization;
 import com.ym.mec.common.dal.BaseDAO;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 public interface OrganizationDao extends BaseDAO<Integer, Organization> {
 
@@ -28,5 +27,5 @@ public interface OrganizationDao extends BaseDAO<Integer, Organization> {
      * @param userId
      * @return
      */
-    List<Organization> queryEmployeeOrgan(Integer userId);
-}
+    List<Organization> queryEmployeeOrgan(@Param("userId") Integer userId);
+}

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

@@ -331,6 +331,8 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
                     break;
                 }
             }
+            //检测新排课冲突
+            courseScheduleService.checkNewCourseSchedules(courseScheduleList,false);
             courseScheduleDao.batchAddCourseSchedules(courseScheduleList);
             List<ImGroupMember> groupMembers = musicGroupService.queryMusicGroupTeachers(highClassGroup.getMusicGroupId());
             groupMembers.add(new ImGroupMember(classGroupTeacherMapper.getUserId().toString()));
@@ -1633,7 +1635,8 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 
     @Override
     public int batchUpdateClassCourseTimes(List<Integer> classGroupIds) {
-
-        return 0;
+        List<Map<Integer, Integer>> classGroupCourseTimesMaps = courseScheduleDao.countClassGroupCourseTimes(classGroupIds);
+        Map<Integer, Integer> classGroupCourseTimesMap = MapUtil.convertMybatisMap(classGroupCourseTimesMaps);
+        return classGroupDao.batchUpdateClassGroupCourseTimes(classGroupCourseTimesMap);
     }
 }

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

@@ -136,7 +136,10 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 	public void createCourseSchedules(List<CourseSchedule> courseSchedules) {
 		//添加课程计划
 		batchAddCourseSchedule(courseSchedules);
-		//创建学生单节课的缴费记录,乐团课的缴费为0
+		//更新课次
+        List<Integer> classGroupIds = courseSchedules.stream().map(CourseSchedule::getClassGroupId).collect(Collectors.toList());
+        classGroupService.batchUpdateClassCourseTimes(classGroupIds);
+        //创建学生单节课的缴费记录,乐团课的缴费为0
 		courseScheduleStudentPaymentService.createCourseScheduleStudentPaymentByCourseSchedules(courseSchedules);
 	}
 

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

@@ -197,6 +197,7 @@ public class DemoGroupServiceImpl extends BaseServiceImpl<Long, DemoGroup>  impl
 		classGroup.setName(demoGroup.getName());
 		classGroup.setType(ClassGroupTypeEnum.DEMO);
 		classGroup.setDelFlag(YesOrNoEnum.NO);
+		classGroup.setTotalClassTimes(1);
 		classGroupDao.insert(classGroup);
 
 		//创建试听课班级映射

+ 19 - 48
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java

@@ -1,56 +1,16 @@
 package com.ym.mec.biz.service.impl;
 
-import java.io.IOException;
-import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.stream.Collectors;
-
-import com.ym.mec.auth.api.entity.SysUserRole;
-import com.ym.mec.biz.dal.dao.*;
-import com.ym.mec.biz.dal.entity.*;
-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.Propagation;
-import org.springframework.transaction.annotation.Transactional;
-
 import com.alibaba.fastjson.JSONObject;
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
-import com.ym.mec.biz.dal.dto.BasicUserDto;
-import com.ym.mec.biz.dal.dto.CourseScheduleTeachersDto;
-import com.ym.mec.biz.dal.dto.MusicCardDto;
-import com.ym.mec.biz.dal.dto.SubFeeSettingDto;
-import com.ym.mec.biz.dal.dto.SubjectRegisterDto;
-import com.ym.mec.biz.dal.dto.UpdateExpectedNumDto;
+import com.ym.mec.auth.api.entity.SysUserRole;
+import com.ym.mec.biz.dal.dao.*;
+import com.ym.mec.biz.dal.dto.*;
+import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.dal.entity.MusicGroupStudentFee.PaymentStatus;
-import com.ym.mec.biz.dal.enums.ClassGroupStudentStatusEnum;
-import com.ym.mec.biz.dal.enums.ClassGroupTypeEnum;
-import com.ym.mec.biz.dal.enums.DealStatusEnum;
-import com.ym.mec.biz.dal.enums.MessageTypeEnum;
-import com.ym.mec.biz.dal.enums.MusicGroupStatusEnum;
-import com.ym.mec.biz.dal.enums.OrderDetailTypeEnum;
-import com.ym.mec.biz.dal.enums.OrderTypeEnum;
-import com.ym.mec.biz.dal.enums.PaymentStatusEnum;
-import com.ym.mec.biz.dal.enums.PlatformCashAccountDetailTypeEnum;
+import com.ym.mec.biz.dal.enums.*;
 import com.ym.mec.biz.dal.page.MusicGroupQueryInfo;
-import com.ym.mec.biz.service.MusicGroupPaymentCalenderService;
-import com.ym.mec.biz.service.MusicGroupService;
-import com.ym.mec.biz.service.PayService;
-import com.ym.mec.biz.service.StudentPaymentOrderDetailService;
-import com.ym.mec.biz.service.StudentPaymentOrderService;
-import com.ym.mec.biz.service.SysConfigService;
-import com.ym.mec.biz.service.SysMessageService;
-import com.ym.mec.biz.service.SysUserCashAccountDetailService;
-import com.ym.mec.biz.service.SysUserCashAccountService;
+import com.ym.mec.biz.service.*;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.entity.ImGroupMember;
 import com.ym.mec.common.exception.BizException;
@@ -60,6 +20,17 @@ import com.ym.mec.common.service.impl.BaseServiceImpl;
 import com.ym.mec.thirdparty.message.MessageSenderPluginContext.MessageSender;
 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.Propagation;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.io.IOException;
+import java.math.BigDecimal;
+import java.util.*;
+import java.util.stream.Collectors;
 
 @Service
 public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> implements MusicGroupService {
@@ -862,7 +833,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         Set<String> musicGroupIds = musicGroupList.stream().map(e -> e.getId()).collect(Collectors.toSet());
         // 统计乐团在读人数
         List<Map<String, Long>> payNums = musicGroupDao.countPayNum(StringUtils.join(musicGroupIds,","));
-        Map<String, Long> payNumMap = MapUtil.convertMybatisMap(payNums);
+        Map<String, String> payNumMap = MapUtil.convertMybatisMap(payNums);
 
         // 获取收费类型编号列表
         Set<Integer> chargeTypeIds = musicGroupList.stream().map(e -> e.getChargeTypeId()).collect(Collectors.toSet());
@@ -880,7 +851,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
             e.setCooperationOrganName(organNames.get(e.getCooperationOrganId()));
             e.setEducationalTeacherName(educationalTeacherNameMap.get(e.getEducationalTeacherId()));
             e.setTeamTeacherName(teamTeacherNameMap.get(e.getTeamTeacherId()));
-            e.setPayNum(payNumMap.get(e.getId()) == null ? 0 : payNumMap.get(e.getId()).intValue());
+            e.setPayNum(payNumMap.get(e.getId()) == null ? 0 : Integer.parseInt(payNumMap.get(e.getId())));
             e.setChargeTypeName(chargeTypeNameMap.get(e.getChargeTypeId()));
         });
         return musicGroupPageInfo;

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

@@ -59,15 +59,15 @@ public class SubjectServiceImpl extends BaseServiceImpl<Integer, Subject>  imple
     @Override
     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<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());
+//        });
         return subApplyDetail;
     }
 

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

@@ -645,6 +645,11 @@
         #{item}
         </foreach>
     </update>
+    <update id="batchUpdateClassGroupCourseTimes" parameterType="map">
+      <foreach collection="classGroupCourseTimes.entrySet()" index="key" item="value" open="" close="" separator=";">
+          UPDATE class_group SET total_class_times_=#{value} WHERE id_=#{key}
+      </foreach>
+    </update>
 
     <select id="findClassGroupByMusicGroupIdAndType" resultMap="ClassGroup">
         SELECT * FROM class_group  WHERE music_group_id_=#{musicGroupId}

+ 17 - 0
mec-biz/src/main/resources/config/mybatis/CourseScheduleMapper.xml

@@ -1267,4 +1267,21 @@
     <select id="findOneCourseScheduleByClassGroupId" resultMap="CourseSchedule">
         SELECT * FROM course_schedule WHERE class_group_id_=#{classGroupId} LIMIT 1
     </select>
+    <select id="countClassGroupCourseTimes" resultType="map">
+        SELECT
+            class_group_id_ AS 'key',
+            COUNT(id_) AS 'value'
+        FROM
+            course_schedule
+        <where>
+            <if test="classGroupIds!=null">
+                class_group_id_ IN
+                <foreach collection="classGroupIds" item="classGroupId" open="(" close=")" separator=",">
+                    #{classGroupId}
+                </foreach>
+            </if>
+        </where>
+
+        GROUP BY class_group_id_
+    </select>
 </mapper>

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

@@ -109,7 +109,7 @@
         <where>
             o.del_flag_ = 0
             <if test="userId != null">
-                AND FIND_IN_SET(o.id_,(SELECT organ_id_list_ FROM employee e WHERE e.user_id_ = #{userId}))
+                AND FIND_IN_SET(o.id_,(SELECT GROUP_CONCAT(organ_id_list_) FROM employee e WHERE e.user_id_ = #{userId}))
             </if>
         </where>
     </select>

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

@@ -110,7 +110,7 @@
         <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.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

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

@@ -116,7 +116,7 @@
 
 	<sql id="queryCondition">
 		<where>
-			del_flag_=0
+			vga.del_flag_=0
 			AND organ_id_=#{organId}
 		</where>
 	</sql>
@@ -136,7 +136,7 @@
 	
 	<!-- 查询当前表的总记录数 -->
 	<select id="queryCount" resultType="int">
-		SELECT COUNT(*) FROM vip_group_activity
+		SELECT COUNT(*) FROM vip_group_activity vga
 		<include refid="queryCondition"/>
 	</select>
     <select id="findByCategory" resultMap="VipGroupActivity">
@@ -150,6 +150,6 @@
 			AND del_flag_=0
 	</select>
     <select id="queryNamesById" resultType="java.util.Map">
-		SELECT vga.id_ `key`,vga.name_ `value` FROM vip_group_activity vga WHERE FIND_IN_SET(vga.id_,#{activityIds}) AND del_flag_=0
+		SELECT vga.id_ `key`,vga.name_ `value` FROM vip_group_activity vga WHERE FIND_IN_SET(vga.id_,#{activityIds}) AND vga.del_flag_=0
 	</select>
 </mapper>

+ 1 - 1
mec-client-api/src/main/java/com/ym/mec/task/TaskRemoteService.java

@@ -19,7 +19,7 @@ public interface TaskRemoteService {
 
 	@GetMapping(value = "task/updateCourseScheduleToOverStatus")
 	// 更新课程状态至已结束
-	boolean updateCourseScheduleToOverStatus();
+	void updateCourseScheduleToOverStatus();
 
 	@GetMapping("task/pushNoSignOutMessage")
 	// 推送未签退消息提醒

+ 1 - 2
mec-client-api/src/main/java/com/ym/mec/task/fallback/TaskRemoteServiceFallback.java

@@ -22,9 +22,8 @@ public class TaskRemoteServiceFallback implements TaskRemoteService {
 	}
 
 	@Override
-	public boolean updateCourseScheduleToOverStatus() {
+	public void updateCourseScheduleToOverStatus() {
 		logger.info("更新课程状态至已结束服务调用失败");
-		return false;
 	}
 
 	@Override

+ 6 - 7
mec-common/common-core/src/main/java/com/ym/mec/common/service/impl/RedisIdGeneratorService.java

@@ -1,9 +1,8 @@
 package com.ym.mec.common.service.impl;
 
-import java.util.Calendar;
-import java.util.Date;
-import java.util.concurrent.TimeUnit;
-
+import com.google.common.base.Strings;
+import com.ym.mec.common.redis.service.RedisCache;
+import com.ym.mec.common.service.IdGeneratorService;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -13,9 +12,9 @@ import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.data.redis.core.ValueOperations;
 import org.springframework.stereotype.Service;
 
-import com.google.common.base.Strings;
-import com.ym.mec.common.redis.service.RedisCache;
-import com.ym.mec.common.service.IdGeneratorService;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.concurrent.TimeUnit;
 
 @Service
 public class RedisIdGeneratorService implements IdGeneratorService {

+ 1 - 1
mec-web/src/main/resources/application.yml

@@ -30,7 +30,7 @@ spring:
     
   datasource:
     name: test
-    url: jdbc:mysql://47.99.212.176:3306/mec_dev?useUnicode=true&characterEncoding=UTF8&serverTimezone=Asia/Shanghai
+    url: jdbc:mysql://47.99.212.176:3306/mec_dev?useUnicode=true&characterEncoding=UTF8&serverTimezone=Asia/Shanghai&allowMultiQueries=true
     username: mec_dev
     password: mec_dev
     # 使用druid数据源