Ver Fonte

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

zouxuan há 5 anos atrás
pai
commit
4edea3c47b

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

@@ -38,6 +38,15 @@ public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
     int batchAddCourseSchedules(List<CourseSchedule> courseSchedules);
 
     /**
+     * @describe 批量删除课程计划
+     * @author Joburgess
+     * @date 2019/10/31
+     * @param courseScheduleIds: 课程编号列表
+     * @return int
+     */
+    int batchDeleteCourseSchedules(@Param("courseScheduleIds") List<Long> courseScheduleIds);
+
+    /**
      * @describe 统计教师再指定时间区段内存在冲突的课程数量
      * @author Joburgess
      * @date 2019/10/28

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

@@ -38,6 +38,15 @@ public interface CourseScheduleStudentPaymentDao extends BaseDAO<Long, CourseSch
     int deleteStudentCourseSchedule(@Param("userId") Integer userId, @Param("courseScheduleList") List<CourseSchedule> courseScheduleList);
 
     /**
+     * @describe 批量删除课程对应的学生缴费记录
+     * @author Joburgess
+     * @date 2019/10/31
+     * @param courseScheduleIds: 课程编号列表
+     * @return int
+     */
+    int deleteByCourseSchedule(@Param("courseScheduleIds") List<Long> courseScheduleIds);
+
+    /**
      * @describe 获取指定班级中的学生
      * @author Joburgess
      * @date 2019/10/28

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

@@ -22,6 +22,15 @@ public interface CourseScheduleTeacherSalaryDao extends BaseDAO<Long, CourseSche
     int batchInsert(List<CourseScheduleTeacherSalary> courseScheduleTeacherSalaries);
 
     /**
+     * @describe 根据课程编号批量删除教师课酬记录
+     * @author Joburgess
+     * @date 2019/10/31
+     * @param courseScheduleIds: 课程编号列表
+     * @return int
+     */
+    int batchDeleteByCourseScheduleIds(@Param("courseScheduleIds") List<Long> courseScheduleIds);
+
+    /**
      * @Author: Joburgess
      * @Date: 2019/10/11
      * @params [params]

+ 9 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/CourseScheduleService.java

@@ -27,6 +27,15 @@ public interface CourseScheduleService extends BaseService<Long, CourseSchedule>
     TeacherAttendanceDto getCurrentCourseDetail(Long courseID);
 
     /**
+     * @describe 根据课程编号删除课程计划及对应的学生缴费、教师课酬记录
+     * @author Joburgess
+     * @date 2019/10/31
+     * @param courseScheduleIds:
+     * @return int
+     */
+    void deleteCourseSchedules(List<Long> courseScheduleIds);
+
+    /**
      * @Author: Joburgess
      * @Date: 2019/10/16
      * @params [teacherAttendanceDto, userId]

+ 7 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupStudentMapperServiceImpl.java

@@ -3,6 +3,7 @@ package com.ym.mec.biz.service.impl;
 import com.ym.mec.biz.dal.dao.ClassGroupStudentMapperDao;
 import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.dal.enums.ClassGroupStudentStatusEnum;
+import com.ym.mec.biz.dal.enums.ClassGroupTypeEnum;
 import com.ym.mec.biz.service.*;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.entity.ImGroupMember;
@@ -56,7 +57,7 @@ public class ClassGroupStudentMapperServiceImpl extends BaseServiceImpl<Long, Cl
         classStudentMapper.setStatus(ClassGroupStudentStatusEnum.QUIT);
         update(classStudentMapper);
         StudentRegistration student = studentRegistrationService.findStudentByClassGroupIdAndUserId(userId, classGroupId);
-        if(student != null) {
+        if (student != null) {
             student.setClassGroupId(0);
             studentRegistrationService.update(student);
         }
@@ -141,6 +142,10 @@ public class ClassGroupStudentMapperServiceImpl extends BaseServiceImpl<Long, Cl
             classGroupStudentMapper.setCreateTime(nowDate);
             classGroupStudentMapper.setStatus(ClassGroupStudentStatusEnum.NORMAL);
             classGroupStudentMappers.add(classGroupStudentMapper);
+            if (classGroup.getType().equals(ClassGroupTypeEnum.NORMAL)) {
+                StudentRegistration studentRegistration = studentRegistrationService.get(Long.parseLong(userIdStr));
+                studentRegistrationService.update(studentRegistration);
+            }
         }
         classGroupStudentMapperDao.classGroupStudentsInsert(classGroupStudentMappers);
 
@@ -152,7 +157,7 @@ public class ClassGroupStudentMapperServiceImpl extends BaseServiceImpl<Long, Cl
 
         //4、班级在合奏班、添加合奏课程
         ClassGroupRelation classGroupRelation = classGroupRelationService.findClassGroupRelation(classGroupId);
-        if(classGroupRelation != null){
+        if (classGroupRelation != null) {
             //合奏班增加人数
             classGroupService.updateClassStudentNum(classGroupRelation.getClassGroupId().longValue(), userIdStrSet.size());
             List<CourseSchedule> mixCourseScheduleList = courseScheduleService.findNoStartCoursesByClassGroupId(classGroupRelation.getClassGroupId());

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

@@ -59,6 +59,8 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 	@Autowired
 	private CourseScheduleStudentPaymentService courseScheduleStudentPaymentService;
 	@Autowired
+	private CourseScheduleStudentPaymentDao courseScheduleStudentPaymentDao;
+	@Autowired
 	private ClassGroupService classGroupService;
 	@Autowired
 	private ClassGroupDao classGroupDao;
@@ -91,6 +93,14 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 	}
 
 	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public void deleteCourseSchedules(List<Long> courseScheduleIds) {
+		courseScheduleDao.batchDeleteCourseSchedules(courseScheduleIds);
+		courseScheduleTeacherSalaryDao.batchDeleteByCourseScheduleIds(courseScheduleIds);
+		courseScheduleStudentPaymentDao.deleteByCourseSchedule(courseScheduleIds);
+	}
+
+	@Override
 	public YesOrNoEnum enableOnlyNormalAttendance(TeacherAttendanceDto teacherAttendanceDto,Long userId){
 		Date endTime=teacherAttendanceDto.getStartClassTime();
 		Date startTime=DateUtil.addHours(endTime,-1);
@@ -135,7 +145,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 		if(Objects.isNull(musicGroupID)){
 			throw new BizException("请指定乐团!");
 		}
-		checkCourseSchedule(courseSchedules);
+		checkNewCourseSchedules(courseSchedules);
         courseScheduleDao.deleteCourseSchedulesByMusicGroupID(musicGroupID);
         courseScheduleDao.batchAddCourseSchedules(courseSchedules);
 	}

+ 34 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/VipGroupServiceImpl.java

@@ -276,6 +276,38 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 			return;
 		}
 
+		//只需要调整课程信息的课程列表
+		List<CourseSchedule> updateCourseSchedules = courseSchedules
+				.stream()
+				.filter(courseSchedule -> Objects.nonNull(courseSchedule.getId()))
+				.collect(Collectors.toList());
+		List<Long> updateCourseScheduleIds = updateCourseSchedules.stream().map(CourseSchedule::getId).collect(Collectors.toList());
+
+		//新增的课程列表
+		List<CourseSchedule> newCourseSchedules = courseSchedules
+				.stream()
+				.filter(courseSchedule -> Objects.nonNull(courseSchedule.getId()))
+				.collect(Collectors.toList());
+
+		//指定VIP课原有的课程列表
+		List<CourseSchedule> vipGroupCourseSchedules = courseScheduleDao.findVipGroupCourseSchedules(vipGroupUpdateInfo.getId());
+
+		if(!CollectionUtils.isEmpty(updateCourseSchedules)){
+			//需要删除的课程编号列表
+			List<Long> deleteCourseScheduleIds = vipGroupCourseSchedules.stream()
+					.filter(courseSchedule -> updateCourseScheduleIds.contains(courseSchedule.getId()))
+					.map(CourseSchedule::getId)
+					.collect(Collectors.toList());
+			//删除对应的课程及相关信息
+			courseScheduleService.deleteCourseSchedules(deleteCourseScheduleIds);
+
+		}
+
+		//检测课程信息是否存在冲突
+		courseScheduleService.checkNewCourseSchedules(courseSchedules);
+
+
+
 	}
 
 	@Override
@@ -719,8 +751,8 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 		Map payMap = payService.getPayMap(
 				vipGroup.getTotalPrice(),
 				orderNo,
-				"http://103.46.128.45:11805/api-student/studentOrder/notify",
-				"http://103.46.128.45:41818/paymentresult",
+				"https://dyme.utools.club/api-student/studentOrder/notify",
+				"https://dyme.utools.club/paymentresult",
 				"vip课购买",
 				vipGroup.getName());
 

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

@@ -167,6 +167,13 @@
         WHERE cg.music_group_id_=#{musicGroupID}
     </delete>
 
+    <delete id="batchDeleteCourseSchedules">
+        DELETE FROM course_schedule WHERE id_ IN
+        <foreach collection="courseScheduleIds" item="courseScheduleId" open="(" close=")" separator=",">
+            #{courseScheduleId}
+        </foreach>
+    </delete>
+
     <!-- 分页查询 -->
     <select id="queryPage" resultMap="CourseSchedule" parameterType="map">
         SELECT * FROM course_schedule ORDER BY id_

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

@@ -139,4 +139,10 @@
 			#{courseSchedule.id}
 		</foreach>
 	</delete>
+    <delete id="deleteByCourseSchedule">
+		DELETE FROM course_schedule_student_payment WHERE course_schedule_id_ IN
+		<foreach collection="courseScheduleIds" item="courseScheduleId" index="index" open="(" close=")" separator=",">
+			#{courseScheduleId}
+		</foreach>
+	</delete>
 </mapper>

+ 9 - 2
mec-biz/src/main/resources/config/mybatis/CourseScheduleTeacherSalaryMapper.xml

@@ -92,8 +92,15 @@
 	<delete id="delete" >
 		DELETE FROM course_schedule_teacher_salary WHERE id_ = #{id} 
 	</delete>
-	
-	<!-- 分页查询 -->
+
+    <delete id="batchDeleteByCourseScheduleIds">
+		DELETE FROM course_schedule_teacher_salary WHERE id_ IN
+		<foreach collection="courseScheduleIds" item="courseScheduleId" open="(" close=")" separator=",">
+			#{courseScheduleId}
+		</foreach>
+	</delete>
+
+    <!-- 分页查询 -->
 	<select id="queryPage" resultMap="CourseScheduleTeacherSalary" parameterType="map">
 		SELECT * FROM course_schedule_teacher_salary ORDER BY id_ <include refid="global.limit"/>
 	</select>

+ 23 - 40
mec-student/src/main/java/com/ym/mec/student/controller/MusicGroupController.java

@@ -1,54 +1,31 @@
 package com.ym.mec.student.controller;
 
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiImplicitParam;
-import io.swagger.annotations.ApiImplicitParams;
-import io.swagger.annotations.ApiOperation;
-
-import java.math.BigDecimal;
-import java.util.List;
-import java.util.Map;
-
-import javax.annotation.Resource;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpStatus;
-import org.springframework.ui.ModelMap;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.dao.MusicGroupStudentFeeDao;
 import com.ym.mec.biz.dal.dto.RegisterPayDto;
-import com.ym.mec.biz.dal.entity.Goods;
-import com.ym.mec.biz.dal.entity.MusicGroup;
-import com.ym.mec.biz.dal.entity.MusicGroupStudentFee;
+import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.dal.entity.MusicGroupStudentFee.PaymentStatus;
-import com.ym.mec.biz.dal.entity.MusicGroupSubjectGoodsGroup;
-import com.ym.mec.biz.dal.entity.MusicGroupSubjectPlan;
-import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
-import com.ym.mec.biz.dal.entity.StudentRegistration;
-import com.ym.mec.biz.dal.enums.DealStatusEnum;
-import com.ym.mec.biz.dal.enums.GoodsType;
-import com.ym.mec.biz.dal.enums.KitGroupPurchaseTypeEnum;
-import com.ym.mec.biz.dal.enums.MusicGroupStatusEnum;
-import com.ym.mec.biz.dal.enums.PaymentStatusEnum;
-import com.ym.mec.biz.service.GoodsService;
-import com.ym.mec.biz.service.MusicGroupService;
-import com.ym.mec.biz.service.MusicGroupSubjectGoodsGroupService;
-import com.ym.mec.biz.service.MusicGroupSubjectPlanService;
-import com.ym.mec.biz.service.PayService;
-import com.ym.mec.biz.service.StudentPaymentOrderService;
-import com.ym.mec.biz.service.StudentRegistrationService;
+import com.ym.mec.biz.dal.enums.*;
+import com.ym.mec.biz.service.*;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.service.IdGeneratorService;
 import com.ym.mec.util.string.IdWorker;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+import org.springframework.ui.ModelMap;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.math.BigDecimal;
+import java.util.List;
+import java.util.Map;
 
 @RequestMapping("musicGroup")
 @Api(tags = "乐团服务")
@@ -260,7 +237,13 @@ public class MusicGroupController extends BaseController {
 
         String orderNo = idGeneratorService.generatorId("payment")+"";
 
-        Map payMap = payService.getPayMap(orderAmount, orderNo, "https://pay.dayaedu.com/api/yqpay/notify", "http://dev.dayaedu.com", "测试订单", "测试订单");
+        Map payMap = payService.getPayMap(
+                orderAmount,
+                orderNo,
+                "http://mstudev.dayaedu.com/api-student/studentOrder/notify",
+                "http://mstudev.dayaedu.com/#/paymentResult",
+                "乐团报名订单",
+                "乐团报名订单");
 
         studentRegistrationService.addOrder(studentRegistration, amount, orderNo, (String) payMap.get("type"), courseFee, goodsGroups, goodsList, otherGoodsList);
 

+ 2 - 8
mec-student/src/main/java/com/ym/mec/student/controller/StudentOrderController.java

@@ -1,6 +1,5 @@
 package com.ym.mec.student.controller;
 
-import com.alibaba.fastjson.JSON;
 import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
 import com.ym.mec.biz.dal.enums.DealStatusEnum;
 import com.ym.mec.biz.dal.enums.OrderTypeEnum;
@@ -9,8 +8,6 @@ import com.ym.mec.biz.service.StudentPaymentOrderService;
 import com.ym.mec.biz.service.StudentRegistrationService;
 import com.ym.mec.biz.service.VipGroupService;
 import com.ym.mec.thirdparty.union.NotifyMsg;
-import com.ym.mec.thirdparty.yqpay.Msg;
-import com.ym.mec.thirdparty.yqpay.YqPayUtil;
 import io.swagger.annotations.Api;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -20,10 +17,6 @@ import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.Map;
-
 @RequestMapping("studentOrder")
 @Api(tags = "订单回调")
 @RestController
@@ -61,11 +54,12 @@ public class StudentOrderController {
             return "SUCCESS";
         }
 
-        StudentPaymentOrder order = studentPaymentOrderService.findOrderByOrderNo(notifyMsg.getMerOrderId());
+        StudentPaymentOrder order = studentPaymentOrderService.findOrderByOrderNo(notifyMsg.getMerOrderId().substring(4));
         if (order != null && !order.getStatus().equals(DealStatusEnum.ING)) { //订单状态不是在支付中
             return "SUCCESS";
         }
         DealStatusEnum status = notifyMsg.getStatus().equals("TRADE_SUCCESS") ? DealStatusEnum.SUCCESS : DealStatusEnum.FAilED;
+
         order.setStatus(status);
         order.setTransNo(notifyMsg.getSeqId());
         order.setPaymentBusinessChannel(notifyMsg.getTargetSys());