Selaa lähdekoodia

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

yonge 5 vuotta sitten
vanhempi
commit
675b9797fa

+ 1 - 1
mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/core/handler/BaseAuthenticationSuccessEventHandler.java

@@ -77,7 +77,7 @@ public class BaseAuthenticationSuccessEventHandler extends SavedRequestAwareAuth
 			sysUser = sysUserService.queryByPhone(username.split(":")[1]);
 		}
 		if(StringUtils.isEmpty(sysUser.getImToken())){
-			ImResult register = imFeignService.register(new ImUserModel(sysUser.getId().toString(), sysUser.getUsername(), "https://daya-online.oss-cn-beijing.aliyuncs.com/201910/RgLS0KQ.jpeg"));
+			ImResult register = imFeignService.register(new ImUserModel(sysUser.getId().toString(), sysUser.getUsername(), null));
 			sysUser.setImToken(register.getToken());
 			sysUser.setUpdateTime(new Date());
 			sysUserService.update(sysUser);

+ 18 - 8
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/ClassGroupStudentMapperDao.java

@@ -4,6 +4,7 @@ import java.util.Date;
 import java.util.List;
 import java.util.Map;
 
+import com.ym.mec.biz.dal.entity.ClassGroup;
 import org.apache.ibatis.annotations.Param;
 
 import com.ym.mec.biz.dal.dto.StudentAttendanceViewDto;
@@ -101,7 +102,7 @@ public interface ClassGroupStudentMapperDao extends BaseDAO<Long, ClassGroupStud
      * @param classGroupId
      * @return
      */
-    ClassGroupStudentMapper findClassStudentMapperByUserIdAndClassGroupId(@Param("userId") Integer userId, @Param("classGroupId") Integer classGroupId,@Param("status") String status);
+    ClassGroupStudentMapper findClassStudentMapperByUserIdAndClassGroupId(@Param("userId") Integer userId, @Param("classGroupId") Integer classGroupId, @Param("status") String status);
 
     /**
      * @param classGroupIds: 班级编号列表
@@ -172,33 +173,42 @@ public interface ClassGroupStudentMapperDao extends BaseDAO<Long, ClassGroupStud
     Integer countClassGroupStudentNum(@Param("classGroupId") Integer classGroupId);
 
     /**
+     * @param classGroupId: 班级编号
+     * @param userIds:      学生编号
+     * @return java.lang.Integer
      * @describe 统计指定班级的重复人数
      * @author Joburgess
      * @date 2019/11/22
-     * @param classGroupId: 班级编号
-     * @param userIds: 学生编号
-     * @return java.lang.Integer
      */
     Integer countClassGroupExitStudentNum(@Param("classGroupId") Integer classGroupId,
                                           @Param("userIds") List<Integer> userIds);
 
     /**
+     * @param userId:    用户编号
+     * @param groupType: 乐团编号
+     * @return java.lang.Integer
      * @describe 统计用户对应加入乐团/小课/试听课的数量
      * @author Joburgess
      * @date 2019/11/29
-     * @param userId: 用户编号
-     * @param groupType: 乐团编号
-     * @return java.lang.Integer
      */
     Integer countUserGroups(@Param("userId") Integer userId,
                             @Param("groupType") String groupType);
 
     /**
      * 查询学生所在的班级编号
+     *
      * @param musicGroupId
      * @param userId
      * @param groupTpye
      * @return
      */
-	List<Integer> queryClassGroupIdList(@Param("musicGroupId") String musicGroupId, @Param("userId") Integer userId, @Param("groupType") GroupType groupType);
+    List<Integer> queryClassGroupIdList(@Param("musicGroupId") String musicGroupId, @Param("userId") Integer userId, @Param("groupType") GroupType groupType);
+
+    /**
+     * 查询乐团某种类型班级的学生
+     * @param musicGroupId
+     * @param classGroupType
+     * @return
+     */
+    List<ClassGroupStudentMapper> findMusicGroupClassGroupByType(@Param("musicGroupId") String musicGroupId, @Param("classGroupType") ClassGroupTypeEnum classGroupType);
 }

+ 10 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/StudentRegistrationService.java

@@ -9,6 +9,7 @@ import java.util.Set;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.dto.*;
 import com.ym.mec.biz.dal.entity.*;
+import com.ym.mec.biz.dal.enums.ClassGroupTypeEnum;
 import com.ym.mec.biz.dal.page.StudentRegistrationQueryInfo;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.BaseService;
@@ -228,4 +229,13 @@ public interface StudentRegistrationService extends BaseService<Long, StudentReg
 	 * @return
 	 */
 	StudentRegistration queryUserByPhone(String mobile);
+
+	/**
+	 * 获取没有某种班级类型的学生
+	 * @param musicGroupId
+	 * @param type
+	 * @param subjectId
+	 * @return
+	 */
+	List<StudentRegistration> findMusicGroupStuNoClassType(String musicGroupId, ClassGroupTypeEnum type, Integer subjectId);
 }

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

@@ -11,7 +11,6 @@ public interface TeacherLeaveRecordService extends BaseService<Long, TeacherLeav
 
 	/**
 	 * 请假
-	 * @param userId
 	 * @param teacherLeaveRecord
 	 * @return
 	 */

+ 27 - 6
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java

@@ -472,7 +472,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
             studentRegistration.setMusicGroupStatus(ClassGroupStudentStatusEnum.NORMAL);
             studentRegistration.setTemporaryCourseFee(studentAddDto.getTemporaryCourseFee());
             //学生报名表
-            studentRegistrationDao.insertBasic(studentRegistration);
+
             MusicGroup musicGroup = musicGroupDao.get(musicGroupId);
             Set<Integer> roleIds = new HashSet<>(1);
             roleIds.add(SysUserRole.OPERATION_EXECUTIVE);
@@ -531,20 +531,27 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                 studentPaymentOrder.setStatus(DealStatusEnum.WAIT_PAY);
                 studentPaymentOrder.setMusicGroupId(musicGroupId);
                 studentPaymentOrder.setClassGroupId(classGroupId);
-                studentPaymentOrderService.insert(studentPaymentOrder);
+
                 //生成订单明细
                 List<StudentPaymentOrderDetail> studentPaymentOrderDetails = studentAddDto.getStudentPaymentOrderDetails();
                 if (studentPaymentOrderDetails == null) {
                     studentPaymentOrderDetails = new ArrayList<>();
                 }
-                studentPaymentOrderDetails.forEach(e -> {
-                    e.setPaymentOrderId(studentPaymentOrder.getId());
-                });
                 StudentPaymentOrderDetail studentPaymentOrderDetail = new StudentPaymentOrderDetail();
-                studentPaymentOrderDetail.setPaymentOrderId(studentPaymentOrder.getId());
                 studentPaymentOrderDetail.setPrice(studentAddDto.getTemporaryCourseFee());
                 studentPaymentOrderDetail.setType(OrderDetailTypeEnum.COURSE);
                 studentPaymentOrderDetails.add(studentPaymentOrderDetail);
+                //汇总金额
+                BigDecimal reduce = studentPaymentOrderDetails.stream().map(e -> e.getPrice()).reduce(BigDecimal.ZERO, BigDecimal::add);
+                if(reduce == BigDecimal.ZERO){
+                    studentPaymentOrder.setStatus(DealStatusEnum.SUCCESS);
+                    studentRegistration.setPaymentStatus(PaymentStatusEnum.YES);
+                }
+                studentRegistrationDao.insertBasic(studentRegistration);
+                studentPaymentOrderService.insert(studentPaymentOrder);
+                studentPaymentOrderDetails.forEach(e -> {
+                    e.setPaymentOrderId(studentPaymentOrder.getId());
+                });
                 studentPaymentOrderDetailService.batchAdd(studentPaymentOrderDetails);
             }
             studentRegistrationDao.updateCurrentClass(studentRegistration);
@@ -774,4 +781,18 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
     public StudentRegistration queryUserByPhone(String mobile) {
         return studentRegistrationDao.queryUserByPhone(mobile);
     }
+
+    @Override
+    public List<StudentRegistration> findMusicGroupStuNoClassType(String musicGroupId, ClassGroupTypeEnum type, Integer subjectId) {
+        List<StudentRegistration> students = studentRegistrationDao.findMusicGroupStudent(musicGroupId, subjectId);
+        List<ClassGroupStudentMapper> classGroupStudentMappers = classGroupStudentMapperDao.findMusicGroupClassGroupByType(musicGroupId, type);
+        for (StudentRegistration student : students) {
+            for (ClassGroupStudentMapper classGroupStudentMapper : classGroupStudentMappers) {
+                if(classGroupStudentMapper.getUserId().equals(student.getUserId())){
+                    students.remove(student);
+                }
+            }
+        }
+        return null;
+    }
 }

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

@@ -70,14 +70,14 @@ public class TeacherServiceImpl extends BaseServiceImpl<Integer, Teacher>  imple
 	public int add(Teacher teacher) throws Exception {
 		SysUser user = sysUserFeignService.queryUserByMobile(teacher.getPhone());
 		if(user != null && user.getId() != null){
-			if(!user.getUserType().equals(SysUserType.SYSTEM)){
+			if(user.getUserType() == SysUserType.TEACHER){
 				throw new BizException("此手机号已被占用");
 			}
 			Integer id = user.getId();
 			Teacher teacher1 = teacherDao.get(id);
 			if(teacher1 == null || teacher1.getId() == null){
-				user.setUserType(SysUserType.TEACHER);
 				teacher.setId(id);
+				teacher.setDelFlag(YesOrNoEnum.NO);
 				teacherDao.updateUser(user);
 				teacherDao.insert(teacher);
 			}else {
@@ -111,9 +111,6 @@ public class TeacherServiceImpl extends BaseServiceImpl<Integer, Teacher>  imple
 		teacher.setUpdateTime(new Date());
 		teacherDao.update(teacher);
 		teacherDao.updateUser(teacher);
-		if(StringUtils.isEmpty(teacher.getAvatar())){
-			teacher.setAvatar("https://daya-online.oss-cn-beijing.aliyuncs.com/201910/RgHwgKc.jpg");
-		}
 		imFeignService.update(new ImUserModel(teacher.getId().toString(),teacher.getUsername(),teacher.getAvatar()));
 	}
 

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

@@ -240,4 +240,10 @@
     <select id="queryClassGroupIdList" resultType="int" parameterType="map">
       SELECT distinct class_group_id_ FROM class_group_student_mapper WHERE user_id_=#{userId} AND group_type_=#{groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler} AND music_group_id_ = #{musicGroupId}
     </select>
+
+    <select id="findMusicGroupClassGroupByType" resultMap="ClassGroupStudentMapper">
+        SELECT  cgsm.* FROM  class_group_student_mapper cgsm
+        LEFT JOIN class_group cg on cgsm.class_group_id_ = cg.id_
+        WHERE cgsm.music_group_id_ = #{musicGroupId} AND cg.group_type_ ='MUSIC' AND cg.type_=#{classGroupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler} AND cg.del_flag_='0' AND cgsm.status_='NORMAL'
+    </select>
 </mapper>

+ 8 - 2
mec-biz/src/main/resources/config/mybatis/StudentPaymentOrderMapper.xml

@@ -75,8 +75,14 @@
     <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.StudentPaymentOrder" useGeneratedKeys="true"
             keyColumn="id" keyProperty="id">
         INSERT INTO student_payment_order
-        (id_,group_type_,user_id_,type_,expect_amount_,actual_amount_,balance_payment_amount_,trans_no_,status_,memo_,create_time_,update_time_,payment_channel_,payment_business_channel_,payment_account_no_,order_no_,music_group_id_,class_group_id_)
-        VALUES(#{id},#{groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{userId},#{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{expectAmount},#{actualAmount},#{balancePaymentAmount},#{transNo},#{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{memo},now(),now(),#{paymentChannel},#{paymentBusinessChannel},#{paymentAccountNo},#{orderNo},#{musicGroupId},#{classGroupId})
+        (id_,group_type_,user_id_,type_,expect_amount_,actual_amount_,balance_payment_amount_,trans_no_,
+        status_,memo_,create_time_,update_time_,payment_channel_,payment_business_channel_,
+        payment_account_no_,order_no_,music_group_id_,class_group_id_)
+        VALUES(#{id},#{groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
+        #{userId},#{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
+        #{expectAmount},#{actualAmount},#{balancePaymentAmount},#{transNo},
+        #{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{memo},now(),now(),
+        #{paymentChannel},#{paymentBusinessChannel},#{paymentAccountNo},#{orderNo},#{musicGroupId},#{classGroupId})
     </insert>
 
     <!-- 根据主键查询一条记录 -->

+ 21 - 21
mec-biz/src/main/resources/config/mybatis/TeacherMapper.xml

@@ -206,10 +206,9 @@
     <!-- 分页查询 -->
     <select id="queryPage" resultMap="Teacher" parameterType="map">
         SELECT t.id_,su.real_name_,su.lock_flag_,t.subject_id_,su.phone_,su.organ_id_,
-        t.job_nature_,t.is_probation_period_,GROUP_CONCAT(s.name_) subject_name_
+        t.job_nature_,t.is_probation_period_,GROUP_CONCAT(s.name_) subject_name_,su.del_flag_
         FROM teacher t LEFT JOIN sys_user su ON t.id_ = su.id_
         LEFT JOIN `subject` s ON FIND_IN_SET(s.id_,t.subject_id_)
-        WHERE su.user_type_ = 'TEACHER' AND su.del_flag_ = 0
         <include refid="queryPageMap"/>
         GROUP BY t.id_
         ORDER BY t.update_time_ DESC
@@ -219,29 +218,30 @@
     <select id="queryCount" resultType="int">
         SELECT COUNT(DISTINCT t.id_)
         FROM teacher t LEFT JOIN sys_user su ON t.id_ = su.id_
-        WHERE su.user_type_ LIKE '%TEACHER%' AND su.del_flag_ = 0
         <include refid="queryPageMap"/>
     </select>
 
     <sql id="queryPageMap">
-        <if test="lockFlag != null">
-            AND su.lock_flag_ = #{lockFlag}
-        </if>
-        <if test="subjectId != null">
-            AND FIND_IN_SET(#{subjectId},t.subject_id_)
-        </if>
-        <if test="organId != null">
-            AND FIND_IN_SET(su.organ_id_,#{organId})
-        </if>
-        <if test="search != null">
-            AND (su.real_name_ LIKE CONCAT('%',#{search},'%') OR su.phone_ LIKE CONCAT('%',#{search},'%'))
-        </if>
-        <if test="jobNature != null">
-            AND t.job_nature_ = #{jobNature}
-        </if>
-        <if test="isProbationPeriod != null">
-            AND t.is_probation_period_ = #{isProbationPeriod}
-        </if>
+        <where>
+            <if test="lockFlag != null">
+                AND su.lock_flag_ = #{lockFlag}
+            </if>
+            <if test="subjectId != null">
+                AND FIND_IN_SET(#{subjectId},t.subject_id_)
+            </if>
+            <if test="organId != null">
+                AND FIND_IN_SET(su.organ_id_,#{organId})
+            </if>
+            <if test="search != null">
+                AND (su.real_name_ LIKE CONCAT('%',#{search},'%') OR su.phone_ LIKE CONCAT('%',#{search},'%'))
+            </if>
+            <if test="jobNature != null">
+                AND t.job_nature_ = #{jobNature}
+            </if>
+            <if test="isProbationPeriod != null">
+                AND t.is_probation_period_ = #{isProbationPeriod}
+            </if>
+        </where>
     </sql>
 
     <!-- 根据证件号查询老师 -->

+ 11 - 0
mec-web/src/main/java/com/ym/mec/web/controller/StudentRegistrationController.java

@@ -1,5 +1,6 @@
 package com.ym.mec.web.controller;
 
+import com.ym.mec.biz.dal.enums.ClassGroupTypeEnum;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
@@ -123,4 +124,14 @@ public class StudentRegistrationController extends BaseController {
         return succeed(studentRegistrationService.openPayment(ids));
     }
 
+    @ApiOperation(value = "获取乐团(声部)的(没有某种班级类型)学生")
+    @GetMapping("/getMusicGroupStuNoClassType")
+    @PreAuthorize("@pcs.hasPermissions('studentRegistration/getMusicGroupStuNoClassType')")
+    @ApiImplicitParams({@ApiImplicitParam(name = "musicGroupId", value = "乐团编号", required = true, dataType = "String"),
+            @ApiImplicitParam(name = "type", value = "类型(MIX,HIGH)", required = true, dataType = "ClassGroupTypeEnum"),
+            @ApiImplicitParam(name = "actualSubjectId", value = "科目(声部)id,", required = false, dataType = "int")})
+    public HttpResponseResult getMusicGroupStuNoClassType(String musicGroupId, ClassGroupTypeEnum type, Integer actualSubjectId) {
+        return succeed(studentRegistrationService.findMusicGroupStuNoClassType(musicGroupId, type,actualSubjectId));
+    }
+
 }