瀏覽代碼

feat:乐团改造

Joburgess 4 年之前
父節點
當前提交
69005f0866

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

@@ -428,4 +428,14 @@ public interface CourseScheduleStudentPaymentDao extends BaseDAO<Long, CourseSch
      * @return
      */
     List<CourseScheduleStudentPayment> queryByIdsAndStudentId(@Param("studentPaymentIds") List<Long> studentPaymentIds, @Param("studentId") Integer studentId, @Param("courseType") String courseType);
+
+    /**
+     * @describe 统计课程组已经开始的课程的应缴费用
+     * @author qnc99
+     * @date 2020/12/8 0008
+     * @param groupId:
+     * @param groupType:
+     * @return java.math.BigDecimal
+     */
+    BigDecimal countFinishCoursePriceWithMusicGroup(@Param("groupId") String groupId, @Param("groupType") GroupType groupType);
 }

+ 18 - 12
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java

@@ -6,15 +6,7 @@ import static com.ym.mec.biz.dal.enums.DealStatusEnum.SUCCESS;
 import java.io.IOException;
 import java.math.BigDecimal;
 import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Arrays;
-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.*;
 import java.util.stream.Collectors;
 
 import org.apache.commons.lang3.StringUtils;
@@ -1613,8 +1605,15 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
             
             //操作人
             SysUser operator = sysUserFeignService.queryUserInfo();
+
+            BigDecimal price = courseScheduleStudentPaymentDao.countFinishCoursePriceWithMusicGroup(musicGroupId, GroupType.MUSIC);
+            BigDecimal amount = studentRegistration.getSurplusCourseFee();
+            if(Objects.isNull(price)){
+                price = new BigDecimal(0);
+            }
+            amount = amount.subtract(price);
             
-            studentRegistrationService.updateUserSurplusCourseFee(userId, musicGroupId, studentRegistration.getSurplusCourseFee().negate(), reason, operator.getId());
+            studentRegistrationService.updateUserSurplusCourseFee(userId, musicGroupId, amount.negate(), reason, operator.getId());
             
             
             //更新服务指标、运营指标
@@ -1756,8 +1755,15 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         
         //操作人
         SysUser operator = sysUserFeignService.queryUserInfo();
-        
-        studentRegistrationService.updateUserSurplusCourseFee(userId, musicGroupId, studentRegistration.getSurplusCourseFee().negate(), reason, operator.getId());
+
+        BigDecimal price = courseScheduleStudentPaymentDao.countFinishCoursePriceWithMusicGroup(musicGroupId, GroupType.MUSIC);
+        BigDecimal amount = studentRegistration.getSurplusCourseFee();
+        if(Objects.isNull(price)){
+            price = new BigDecimal(0);
+        }
+        amount = amount.subtract(price);
+
+        studentRegistrationService.updateUserSurplusCourseFee(userId, musicGroupId, amount.negate(), reason, operator.getId());
         
         //更新服务指标、运营指标
         int remainCourseNum = courseScheduleStudentPaymentDao.countStudentNotStartCourseNumWithCourseType(userId, null);

+ 0 - 4
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java

@@ -1428,10 +1428,6 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
             throw new BizException("学员注册信息不存在");
         }
 
-        if(StudentMusicGroupStatusEnum.QUIT.equals(studentRegistration.getMusicGroupStatus())){
-            return BigDecimal.ZERO;
-        }
-
         if(BigDecimal.ZERO.compareTo(amount)>0&&amount.abs().compareTo(studentRegistration.getSurplusCourseFee())>0){
             amount = studentRegistration.getSurplusCourseFee().negate();
         }

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

@@ -669,4 +669,9 @@
 		</foreach>
 		AND cssp.user_id_ = #{studentId} AND cs.type_ = #{courseType}
 	</select>
+
+	<select id="countFinishCoursePriceWithMusicGroup" resultType="java.math.BigDecimal">
+		SELECT SUM(expect_price_)-SUM(actual_price_) FROM course_schedule_student_payment
+		WHERE music_group_id_=#{groupId} AND group_type_=#{groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
+	</select>
 </mapper>