Ver código fonte

活动排课

zouxuan 3 anos atrás
pai
commit
f4b9a760e3

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

@@ -342,7 +342,7 @@ public interface PracticeGroupService extends BaseService<Long, PracticeGroup> {
      */
     void practiceGroupRenewRemind();
 
-    Map countPracticeGroupPredictFee(PracticeGroupApplyBaseInfoDto practice, Integer userId, Long courseId);
+    Map countPracticeGroupPredictFee(PracticeGroupApplyBaseInfoDto practice, Integer userId);
 
     /**
     * @description: 网管课申请

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

@@ -144,12 +144,6 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
     private StudentService studentService;
     @Autowired
     private CourseScheduleTeacherSalaryService courseScheduleTeacherSalaryService;
-    @Autowired
-    private CourseScheduleStudentPaymentService courseScheduleStudentPaymentService;
-    @Autowired
-    private ImGroupService imGroupService;
-    @Autowired
-    private ImGroupMemberService imGroupMemberService;
 
     private static Map<Integer, Map<Integer, List<Integer>>> schoolSubjectTeachersMap;
 
@@ -4571,7 +4565,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
     }
 
     @Override
-    public Map countPracticeGroupPredictFee(PracticeGroupApplyBaseInfoDto practice, Integer teacherId, Long courseId) {
+    public Map countPracticeGroupPredictFee(PracticeGroupApplyBaseInfoDto practice, Integer teacherId) {
         if(Objects.isNull(teacherId)){
             throw new BizException("请指定教师");
         }
@@ -4709,7 +4703,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
         applyBaseInfoDto.setName(className.toString());
 
         //计算课程相关费用信息
-        Map<String, BigDecimal> costInfo = countPracticeGroupPredictFee(applyBaseInfoDto,applyBaseInfoDto.getUserId(), null);
+        Map<String, BigDecimal> costInfo = countPracticeGroupPredictFee(applyBaseInfoDto,applyBaseInfoDto.getUserId());
 
         applyBaseInfoDto.setAuditStatus(AuditStatusEnum.PASS);
 
@@ -4782,6 +4776,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
         classGroupTeacherSalary.setUpdateTime(now);
         classGroupTeacherSalaryDao.insert(classGroupTeacherSalary);
 
+        List<CourseScheduleTeacherSalary> courseScheduleTeacherSalaries = new ArrayList<>();
         //课程信息调整
         courseSchedules.forEach(courseSchedule -> {
             courseSchedule.setGroupType(GroupType.PRACTICE);
@@ -4793,7 +4788,19 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
             courseSchedule.setClassGroupId(classGroup.getId());
             courseSchedule.setName(applyBaseInfoDto.getName());
             courseSchedule.setOrganId(applyBaseInfoDto.getOrganId());
+
+            //课程与老师薪水表
+            CourseScheduleTeacherSalary courseScheduleTeacherSalary = new CourseScheduleTeacherSalary();
+            courseScheduleTeacherSalary.setCourseScheduleId(courseSchedule.getId());
+            courseScheduleTeacherSalary.setGroupType(GroupType.PRACTICE);
+            courseScheduleTeacherSalary.setMusicGroupId(applyBaseInfoDto.getId().toString());
+            courseScheduleTeacherSalary.setTeacherRole(TeachTypeEnum.BISHOP);
+            courseScheduleTeacherSalary.setUserId(applyBaseInfoDto.getUserId());
+            courseScheduleTeacherSalary.setExpectSalary(applyBaseInfoDto.getOnlineTeacherSalary());
+            courseScheduleTeacherSalary.setClassGroupId(classGroup.getId());
+            courseScheduleTeacherSalaries.add(courseScheduleTeacherSalary);
         });
+        courseScheduleTeacherSalaryDao.batchInsert(courseScheduleTeacherSalaries);
         courseScheduleService.checkNewCourseSchedules(courseSchedules,false,false);
         applyBaseInfoDto.setCourseScheduleJson(JSON.toJSONString(courseSchedules));
         practiceGroupDao.update(applyBaseInfoDto);
@@ -4923,6 +4930,12 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
         if(use != 1){
             throw new BizException("网管课创建失败,请联系管理员");
         }
+        //是否消耗课程余额
+        if(activity.isPayToBalance() && !giveFlag){
+            ActivityUserMapper activityUserMapper = activityUserMappers.get(0);
+            StudentPaymentOrder order = studentPaymentOrderDao.get(activityUserMapper.getPaymentOrderId());
+            sysUserCashAccountService.appendCourseBalance(studentId,order.getExpectAmount().subtract(order.getCouponRemitFee()).negate(),PlatformCashAccountDetailTypeEnum.PAY_FEE,"活动排课消耗课程余额");
+        }
 
         //创建班级信息
         ClassGroup classGroup=new ClassGroup();
@@ -4952,7 +4965,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
         classGroupStudentMapperDao.classGroupStudentsInsert(classGroupStudentMapperList);
 
         //计算课程相关费用信息
-        Map<String, BigDecimal> costInfo = countPracticeGroupPredictFee(applyBaseInfo,applyBaseInfo.getUserId(), null);
+        Map<String, BigDecimal> costInfo = countPracticeGroupPredictFee(applyBaseInfo,applyBaseInfo.getUserId());
         if(practice.getGiveFlag()){
             applyBaseInfo.setOnlineTeacherSalary(costInfo.get("giveOnlineTeacherSalary"));
         }else {

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

@@ -1047,6 +1047,15 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 		if(use != studentIdList.size()){
 			throw new BizException("VIP课创建失败,请联系管理员");
 		}
+		//是否消耗课程余额
+		if(activity.isPayToBalance() && !giveFlag){
+			ActivityUserMapper activityUserMapper = activityUserMappers.get(0);
+			StudentPaymentOrder order = studentPaymentOrderDao.get(activityUserMapper.getPaymentOrderId());
+			for (Integer studentId : studentIdList) {
+				sysUserCashAccountService.appendCourseBalance(studentId,order.getExpectAmount().subtract(order.getCouponRemitFee()).negate(),
+						PlatformCashAccountDetailTypeEnum.PAY_FEE,"活动排课消耗课程余额");
+			}
+		}
 
 		vscps.forEach(e->e.setVipGroupId(applyBaseInfo.getId()));
 		vipGroupStudentCoursePriceDao.batchInsert(vscps);

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

@@ -37,11 +37,10 @@
     <!-- 向数据库增加一条记录 -->
     <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.ClassGroupTeacherMapper"
             useGeneratedKeys="true" keyColumn="id" keyProperty="id">
-        <!-- <selectKey resultClass="int" keyProperty="id" > SELECT SEQ_WSDEFINITION_ID.nextval
-            AS ID FROM DUAL </selectKey> -->
         INSERT INTO class_group_teacher_mapper
-        (id_,group_type_,music_group_id_,class_group_id_,teacher_role_,user_id_,salary_,create_time_,update_time_)
-        VALUES(#{id},#{groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{musicGroupId},#{classGroupId},#{teacherRole},#{userId},#{salary},#{createTime},NOW())
+        (group_type_,music_group_id_,class_group_id_,teacher_role_,user_id_,salary_,create_time_,update_time_)
+        VALUES(#{groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{musicGroupId},
+               #{classGroupId},#{teacherRole},#{userId},#{salary},NOW(),NOW())
     </insert>
 
     <!-- 根据主键查询一条记录 -->
@@ -51,9 +50,6 @@
             <if test="userId != null">
                 user_id_ = #{userId},
             </if>
-            <if test="id != null">
-                id_ = #{id},
-            </if>
             <if test="groupType != null">
                 group_type_ = #{groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
             </if>
@@ -72,9 +68,6 @@
             <if test="musicGroupId != null">
                 music_group_id_ = #{musicGroupId},
             </if>
-            <if test="createTime != null">
-                create_time_ = #{createTime},
-            </if>
         </set>
         WHERE id_ = #{id}
     </update>

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

@@ -5,18 +5,11 @@ import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.dto.ConditionDto;
 import com.ym.mec.biz.dal.dto.QueryConditionDto;
 import com.ym.mec.biz.dal.dto.VipGroupBuyParamsDto;
-import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
-import com.ym.mec.biz.dal.enums.DealStatusEnum;
-import com.ym.mec.biz.dal.enums.GroupType;
-import com.ym.mec.biz.dal.enums.OrderTypeEnum;
-import com.ym.mec.biz.dal.enums.PayStatus;
 import com.ym.mec.biz.dal.page.StudentVipGroupQueryInfo;
-import com.ym.mec.biz.service.StudentPaymentOrderService;
 import com.ym.mec.biz.service.SubjectService;
 import com.ym.mec.biz.service.VipGroupCategoryService;
 import com.ym.mec.biz.service.VipGroupService;
 import com.ym.mec.common.controller.BaseController;
-import com.ym.mec.common.exception.BizException;
 import com.yonge.log.model.AuditLogAnnotation;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -47,8 +40,6 @@ public class StudentVipGroupController extends BaseController {
     private SysUserFeignService sysUserFeignService;
     @Autowired
     private VipGroupCategoryService vipGroupCategoryService;
-    @Autowired
-    private StudentPaymentOrderService studentPaymentOrderService;
 
     @ApiOperation(value = "获取vip课列表筛选条件")
     @GetMapping(value = "/findQueryCondition")

+ 1 - 1
mec-teacher/src/main/java/com/ym/mec/teacher/controller/TeacherPracticeGroupController.java

@@ -59,7 +59,7 @@ public class TeacherPracticeGroupController extends BaseController {
 		PracticeGroupApplyBaseInfoDto practice = new PracticeGroupApplyBaseInfoDto();
 		practice.setUserId(sysUser.getId());
 		practice.setOrganId(teacher.getOrganId());
-		Map results = practiceGroupService.countPracticeGroupPredictFee(practice,practice.getUserId(), null);
+		Map results = practiceGroupService.countPracticeGroupPredictFee(practice,practice.getUserId());
 		return succeed(results);
 	}
 

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

@@ -169,7 +169,7 @@ public class PracticeGroupManageController extends BaseController {
     @PostMapping("/getPracticeGroupCostCount")
     @PreAuthorize("@pcs.hasPermissions('practiceGroupManage/getPracticeGroupCostCount')")
     public Object getPracticeGroupCostCount(@RequestBody PracticeGroupApplyBaseInfoDto practice){
-        Map results = practiceGroupService.countPracticeGroupPredictFee(practice,practice.getUserId(), null);
+        Map results = practiceGroupService.countPracticeGroupPredictFee(practice,practice.getUserId());
         return succeed(results);
     }