فهرست منبع

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

yonge 5 سال پیش
والد
کامیت
32b3ab1477

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

@@ -99,7 +99,7 @@ public interface ClassGroupStudentMapperDao extends BaseDAO<Long, ClassGroupStud
      * @param classGroupId
      * @param classGroupId
      * @return
      * @return
      */
      */
-    ClassGroupStudentMapper findClassStudentMapperByUserIdAndClassGroupId(@Param("userId") Integer userId, @Param("classGroupId") Integer classGroupId);
+    ClassGroupStudentMapper findClassStudentMapperByUserIdAndClassGroupId(@Param("userId") Integer userId, @Param("classGroupId") Integer classGroupId,@Param("status") String status);
 
 
     /**
     /**
      * @param classGroupIds: 班级编号列表
      * @param classGroupIds: 班级编号列表

+ 50 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/VipGroupPayInfoDto.java

@@ -0,0 +1,50 @@
+package com.ym.mec.biz.dal.dto;
+
+import java.math.BigDecimal;
+
+/**
+ * @Author Joburgess
+ * @Date 2019/11/29
+ */
+public class VipGroupPayInfoDto {
+
+    private Integer vipGroupId;
+
+    private String viipGroupName;
+
+    private BigDecimal price;
+
+    private BigDecimal balance;
+
+    public Integer getVipGroupId() {
+        return vipGroupId;
+    }
+
+    public void setVipGroupId(Integer vipGroupId) {
+        this.vipGroupId = vipGroupId;
+    }
+
+    public String getViipGroupName() {
+        return viipGroupName;
+    }
+
+    public void setViipGroupName(String viipGroupName) {
+        this.viipGroupName = viipGroupName;
+    }
+
+    public BigDecimal getPrice() {
+        return price;
+    }
+
+    public void setPrice(BigDecimal price) {
+        this.price = price;
+    }
+
+    public BigDecimal getBalance() {
+        return balance;
+    }
+
+    public void setBalance(BigDecimal balance) {
+        this.balance = balance;
+    }
+}

+ 5 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/DemoGroupService.java

@@ -50,9 +50,11 @@ public interface DemoGroupService extends BaseService<Long, DemoGroup> {
     PageInfo findTeacherDemoGroups(TeacherManageDemoGroupQueryInfo queryInfo);
     PageInfo findTeacherDemoGroups(TeacherManageDemoGroupQueryInfo queryInfo);
 
 
     /**
     /**
-     * @Author: Joburgess
-     * @Date: 2019/9/27
-     *
+     * @describe
+     * @author Joburgess
+     * @date 2019/11/29
+     * @param teacherID: 教师编号
+     * @return java.util.List<com.ym.mec.biz.dal.dto.EducationDemoGroupListDto>
      */
      */
     List<EducationDemoGroupListDto> findDemoGroupStartClassTimesWithWeekByTeacherId(Long teacherID);
     List<EducationDemoGroupListDto> findDemoGroupStartClassTimesWithWeekByTeacherId(Long teacherID);
 
 

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

@@ -310,4 +310,14 @@ public interface VipGroupService extends BaseService<Long, VipGroup> {
 	 * 更新vipgroup至完成状态
 	 * 更新vipgroup至完成状态
 	 */
 	 */
 	void updateVipGroupStatusToFinished();
 	void updateVipGroupStatusToFinished();
+
+	/**
+	 * @describe 获取vip课购买信息
+	 * @author Joburgess
+	 * @date 2019/11/29
+	 * @param vipGroupId: vip课编号
+	 * @param userId: 用户编号
+	 * @return void
+	 */
+    VipGroupPayInfoDto getVipGroupPayInfo(Integer vipGroupId,Integer userId);
 }
 }

+ 20 - 15
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupStudentMapperServiceImpl.java

@@ -48,7 +48,7 @@ public class ClassGroupStudentMapperServiceImpl extends BaseServiceImpl<Long, Cl
 
 
     @Override
     @Override
     public ClassGroupStudentMapper findClassStudentMapperByUserIdAndClassGroupId(Integer userId, Integer classGroupId) {
     public ClassGroupStudentMapper findClassStudentMapperByUserIdAndClassGroupId(Integer userId, Integer classGroupId) {
-        return classGroupStudentMapperDao.findClassStudentMapperByUserIdAndClassGroupId(userId, classGroupId);
+        return classGroupStudentMapperDao.findClassStudentMapperByUserIdAndClassGroupId(userId, classGroupId,"NORMAL");
     }
     }
 
 
     @Override
     @Override
@@ -152,23 +152,28 @@ public class ClassGroupStudentMapperServiceImpl extends BaseServiceImpl<Long, Cl
 
 
         Iterator<String> iterator = userIdStrSet.iterator();
         Iterator<String> iterator = userIdStrSet.iterator();
         while (iterator.hasNext()) {
         while (iterator.hasNext()) {
-        	String userIdStr = iterator.next();
-            List<ClassGroupStudentMapper> highClassGroupHasUser = classGroupStudentMapperDao.findHighClassGroupHasUser(classGroup.getMusicGroupId(), Integer.parseInt(userIdStr), classGroup.getType());
+        	Integer userId = Integer.parseInt(iterator.next());
+            List<ClassGroupStudentMapper> highClassGroupHasUser = classGroupStudentMapperDao.findHighClassGroupHasUser(classGroup.getMusicGroupId(), userId, classGroup.getType());
             if (highClassGroupHasUser != null && highClassGroupHasUser.size() > 0) {
             if (highClassGroupHasUser != null && highClassGroupHasUser.size() > 0) {
             	iterator.remove();
             	iterator.remove();
                 continue;
                 continue;
             }
             }
-
-            ClassGroupStudentMapper classGroupStudentMapper = new ClassGroupStudentMapper();
-            classGroupStudentMapper.setMusicGroupId(classGroup.getMusicGroupId());
-            classGroupStudentMapper.setClassGroupId(classGroupId);
-            classGroupStudentMapper.setUserId(Integer.parseInt(userIdStr));
-            classGroupStudentMapper.setCreateTime(nowDate);
-            classGroupStudentMapper.setStatus(ClassGroupStudentStatusEnum.NORMAL);
-            classGroupStudentMapper.setGroupType(GroupType.MUSIC);
-            classGroupStudentMappers.add(classGroupStudentMapper);
+            //校验是否存在历史记录
+            ClassGroupStudentMapper classGroupStudentMapper = classGroupStudentMapperDao.findClassStudentMapperByUserIdAndClassGroupId(userId, classGroupId, null);
+            if(classGroupStudentMapper != null){
+                classGroupStudentMapper.setStatus(ClassGroupStudentStatusEnum.NORMAL);
+            }else {
+                classGroupStudentMapper = new ClassGroupStudentMapper();
+                classGroupStudentMapper.setMusicGroupId(classGroup.getMusicGroupId());
+                classGroupStudentMapper.setClassGroupId(classGroupId);
+                classGroupStudentMapper.setUserId(userId);
+                classGroupStudentMapper.setCreateTime(nowDate);
+                classGroupStudentMapper.setStatus(ClassGroupStudentStatusEnum.NORMAL);
+                classGroupStudentMapper.setGroupType(GroupType.MUSIC);
+                classGroupStudentMappers.add(classGroupStudentMapper);
+            }
             if (classGroup.getType().equals(ClassGroupTypeEnum.NORMAL)) {
             if (classGroup.getType().equals(ClassGroupTypeEnum.NORMAL)) {
-                StudentRegistration studentRegistration = studentRegistrationService.queryByUserIdAndMusicGroupId(Integer.parseInt(userIdStr), classGroup.getMusicGroupId());
+                StudentRegistration studentRegistration = studentRegistrationService.queryByUserIdAndMusicGroupId(userId, classGroup.getMusicGroupId());
                 studentRegistration.setClassGroupId(classGroupId);
                 studentRegistration.setClassGroupId(classGroupId);
                 studentRegistrationService.update(studentRegistration);
                 studentRegistrationService.update(studentRegistration);
             }
             }
@@ -177,13 +182,13 @@ public class ClassGroupStudentMapperServiceImpl extends BaseServiceImpl<Long, Cl
                 classGroupStudentMapper = new ClassGroupStudentMapper();
                 classGroupStudentMapper = new ClassGroupStudentMapper();
                 classGroupStudentMapper.setMusicGroupId(classGroup.getMusicGroupId());
                 classGroupStudentMapper.setMusicGroupId(classGroup.getMusicGroupId());
                 classGroupStudentMapper.setClassGroupId(classGroupRelation.getClassGroupId());
                 classGroupStudentMapper.setClassGroupId(classGroupRelation.getClassGroupId());
-                classGroupStudentMapper.setUserId(Integer.parseInt(userIdStr));
+                classGroupStudentMapper.setUserId(userId);
                 classGroupStudentMapper.setCreateTime(nowDate);
                 classGroupStudentMapper.setCreateTime(nowDate);
                 classGroupStudentMapper.setStatus(ClassGroupStudentStatusEnum.NORMAL);
                 classGroupStudentMapper.setStatus(ClassGroupStudentStatusEnum.NORMAL);
                 classGroupStudentMapper.setGroupType(GroupType.MUSIC);
                 classGroupStudentMapper.setGroupType(GroupType.MUSIC);
                 classGroupStudentMappers.add(classGroupStudentMapper);
                 classGroupStudentMappers.add(classGroupStudentMapper);
             }
             }
-            imGroupMemberList.add(new ImGroupMember(userIdStr));
+            imGroupMemberList.add(new ImGroupMember(userId.toString()));
         }
         }
 		if (classGroupStudentMappers.size() > 0) {
 		if (classGroupStudentMappers.size() > 0) {
 			classGroupStudentMapperDao.classGroupStudentsInsert(classGroupStudentMappers);
 			classGroupStudentMapperDao.classGroupStudentsInsert(classGroupStudentMappers);

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

@@ -530,18 +530,24 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                 studentPaymentOrderService.insert(studentPaymentOrder);
                 studentPaymentOrderService.insert(studentPaymentOrder);
                 //生成订单明细
                 //生成订单明细
                 List<StudentPaymentOrderDetail> studentPaymentOrderDetails = studentAddDto.getStudentPaymentOrderDetails();
                 List<StudentPaymentOrderDetail> studentPaymentOrderDetails = studentAddDto.getStudentPaymentOrderDetails();
-                if (studentPaymentOrderDetails != null && studentPaymentOrderDetails.size() > 0) {
-                    studentPaymentOrderDetails.forEach(e -> {
-                        e.setPaymentOrderId(studentPaymentOrder.getId());
-                    });
-                    studentPaymentOrderDetailService.batchAdd(studentPaymentOrderDetails);
+                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);
+                studentPaymentOrderDetailService.batchAdd(studentPaymentOrderDetails);
             }
             }
             studentRegistrationDao.updateCurrentClass(studentRegistration);
             studentRegistrationDao.updateCurrentClass(studentRegistration);
             Map<Integer,String> receivers = new HashMap<>(1);
             Map<Integer,String> receivers = new HashMap<>(1);
             receivers.put(studentRegistration.getUserId(),studentRegistration.getParentsPhone());
             receivers.put(studentRegistration.getUserId(),studentRegistration.getParentsPhone());
             sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.YIMEI,MessageTypeEnum.SMS_MUSIC_GROUP_ADD_STUDENT,
             sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.YIMEI,MessageTypeEnum.SMS_MUSIC_GROUP_ADD_STUDENT,
-                    receivers,null,0,null,studentRegistration.getParentsName(),musicGroup.getName());
+                    receivers,null,0,null,studentRegistration.getParentsName(),studentRegistration.getName(),musicGroup.getName());
             return userId;
             return userId;
         }
         }
     }
     }

+ 21 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/VipGroupServiceImpl.java

@@ -1657,4 +1657,25 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 	public void updateVipGroupStatusToFinished() {
 	public void updateVipGroupStatusToFinished() {
 		
 		
 	}
 	}
+
+	@Override
+	public VipGroupPayInfoDto getVipGroupPayInfo(Integer vipGroupId, Integer userId) {
+		if(Objects.isNull(vipGroupId)){
+			throw new BizException("请指定需要购买的小课");
+		}
+		VipGroup vipGroup=vipGroupDao.get(vipGroupId.longValue());
+		if(Objects.isNull(vipGroup)){
+			throw new BizException("未找到此课程");
+		}
+		VipGroupPayInfoDto vipGroupPayInfo=new VipGroupPayInfoDto();
+		vipGroupPayInfo.setVipGroupId(vipGroup.getId().intValue());
+		vipGroupPayInfo.setViipGroupName(vipGroup.getName());
+		vipGroupPayInfo.setPrice(vipGroup.getTotalPrice());
+		SysUserCashAccount sysUserCashAccount = sysUserCashAccountService.get(userId);
+		if(Objects.isNull(sysUserCashAccount)){
+			throw new BizException("当前用户没有现金账户");
+		}
+		vipGroupPayInfo.setBalance(sysUserCashAccount.getBalance());
+		return  vipGroupPayInfo;
+	}
 }
 }

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

@@ -353,7 +353,8 @@
     </select>
     </select>
     <select id="findNoClassSubjects" resultMap="ClassGroup">
     <select id="findNoClassSubjects" resultMap="ClassGroup">
         SELECT cg.* FROM class_group cg LEFT JOIN class_group_relation cgr ON cgr.sub_class_group_id_=cg.id_
         SELECT cg.* FROM class_group cg LEFT JOIN class_group_relation cgr ON cgr.sub_class_group_id_=cg.id_
-        WHERE cg.music_group_id_=#{musicGroupId} AND cg.type_ = 'NORMAL' AND cg.group_type_='MUSIC' AND cg.del_flag_ = '0' AND cgr.id_ IS NULL
+        WHERE cg.music_group_id_=#{musicGroupId} AND cg.type_ = 'NORMAL'
+        AND cg.group_type_='MUSIC' AND cg.del_flag_ = '0'
     </select>
     </select>
 
 
     <select id="countTeacherNum" resultType="java.lang.Integer">
     <select id="countTeacherNum" resultType="java.lang.Integer">

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

@@ -150,7 +150,11 @@
 
 
     <select id="findClassStudentMapperByUserIdAndClassGroupId" resultMap="ClassGroupStudentMapper">
     <select id="findClassStudentMapperByUserIdAndClassGroupId" resultMap="ClassGroupStudentMapper">
         SELECT * FROM class_group_student_mapper
         SELECT * FROM class_group_student_mapper
-        WHERE user_id_=#{userId} AND class_group_id_=#{classGroupId} AND status_ = 'NORMAL'
+        WHERE user_id_=#{userId} AND class_group_id_=#{classGroupId}
+        <if test="status != null">
+            AND status_ = #{status}
+        </if>
+        LIMIT 1
     </select>
     </select>
     <select id="findByClassGroups" resultMap="ClassGroupStudentMapper">
     <select id="findByClassGroups" resultMap="ClassGroupStudentMapper">
         SELECT * FROM class_group_student_mapper WHERE class_group_id_ IN
         SELECT * FROM class_group_student_mapper WHERE class_group_id_ IN

+ 10 - 0
mec-student/src/main/java/com/ym/mec/student/controller/StudentVipGroupController.java

@@ -88,4 +88,14 @@ public class StudentVipGroupController extends BaseController {
 		return succeed();
 		return succeed();
 	}
 	}
 
 
+    @ApiOperation(value = "获取vip购买信息")
+    @PostMapping("/getVipGroupPayInfo")
+	public Object getVipGroupPayInfo(Integer vipGroupId){
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (null == sysUser) {
+            return failed(HttpStatus.FORBIDDEN, "请登录");
+        }
+        return succeed(vipGroupService.getVipGroupPayInfo(vipGroupId,sysUser.getId()));
+    }
+
 }
 }