Просмотр исходного кода

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

zouxuan 4 лет назад
Родитель
Сommit
c9e88f6bf3

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

@@ -106,7 +106,8 @@ public interface PracticeGroupDao extends com.ym.mec.common.dal.BaseDAO<Long, Pr
      * @author Joburgess
      * @date 2020/4/24
      */
-    int checkStudentExitChargePractice(@Param("studentId") Integer studentId);
+    int checkStudentExitChargePractice(@Param("studentId") Integer studentId,
+                                       @Param("startTime") String startTime);
 
     /**
      * @param userId:

+ 2 - 2
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/IndexBaseDto.java

@@ -74,8 +74,8 @@ public class IndexBaseDto {
     public void setIndexMonthData(List<IndexBaseMonthData> indexMonthData, Date currentMonth) {
         this.indexMonthData = indexMonthData;
         if(!CollectionUtils.isEmpty(indexMonthData)){
-            if(dataType.getCollect()){
-                BigDecimal total = indexMonthData.stream().map(IndexBaseMonthData::getTotalNum).reduce(BigDecimal.ZERO, BigDecimal::add);
+            BigDecimal total = indexMonthData.stream().map(IndexBaseMonthData::getTotalNum).reduce(BigDecimal.ZERO, BigDecimal::add);
+            if(IndexDataType.ACTIVATION_RATE.equals(dataType)){
                 if(total.compareTo(BigDecimal.ZERO)==0){
                     this.percent = BigDecimal.ZERO;
                 }else{

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupPaymentCalenderStudentDetail.java

@@ -24,7 +24,7 @@ public class MusicGroupPaymentCalenderStudentDetail {
 	private java.math.BigDecimal courseOriginalPrice;
 	
 	/** 现价 */
-	private java.math.BigDecimal courseCurrentPrice;
+	private java.math.BigDecimal courseCurrentPrice = BigDecimal.ZERO;
 
 	/** 可扣减的课程余额 */
 	private java.math.BigDecimal subCourseAmount;

+ 1 - 59
mec-biz/src/main/java/com/ym/mec/biz/event/listener/GroupEventListener.java

@@ -38,65 +38,7 @@ public class GroupEventListener {
     @Async
     @EventListener
     public void musicGroupStudentChangeMonitor(MusicGroupStudentChangeEvent musicGroupStatusChangeEvent){
-        if(Objects.isNull(musicGroupStatusChangeEvent.getMusicGroupId())||Objects.isNull(musicGroupStatusChangeEvent.getStudentMusicGroupStatus())){
-            return;
-        }
-        MusicGroup musicGroup = musicGroupDao.get(musicGroupStatusChangeEvent.getMusicGroupId());
-        if(Objects.isNull(musicGroup)){
-            return;
-        }
-        List<Integer> studentIds = musicGroupStatusChangeEvent.getStudentIds();
-        if(CollectionUtils.isEmpty(studentIds)) {
-            List<StudentRegistration> studentRegistrations = studentRegistrationDao.queryStudentByMusicGroupId(musicGroupStatusChangeEvent.getMusicGroupId());
-            studentIds = studentRegistrations.stream().map(StudentRegistration::getUserId).collect(Collectors.toList());
-        }
-        if(CollectionUtils.isEmpty(studentIds)){
-            return;
-        }
-        List<StudentRegistration> studentNormalRegistration = studentRegistrationDao.getStudentNormalRegistration(new HashSet<>(studentIds));
-        Map<Integer, Set<String>> userGroupIdMap = studentNormalRegistration.stream().collect(Collectors.groupingBy(StudentRegistration::getUserId, Collectors.mapping(StudentRegistration::getMusicGroupId, Collectors.toSet())));
-        int updateNum = 0;
-        for (Integer studentId : studentIds) {
-            if(userGroupIdMap.containsKey(studentId)&&userGroupIdMap.get(studentId).size()>1){
-                continue;
-            }
-            if(userGroupIdMap.containsKey(studentId)&&!userGroupIdMap.get(studentId).contains(musicGroupStatusChangeEvent.getMusicGroupId())){
-                continue;
-            }
-            updateNum+=1;
-        }
-        LocalDate nowDate = LocalDate.now();
-        String dayStr = nowDate.plusDays(-1).toString();
-        IndexBaseMonthData indexBaseMonthData = null;
-        switch (musicGroupStatusChangeEvent.getStudentMusicGroupStatus()){
-            case NORMAL:
-                indexBaseMonthData = indexBaseMonthDataDao.getOrganDataWithDayAndDataType(musicGroup.getOrganId(), dayStr, IndexDataType.NEWLY_STUDENT_NUM);
-                break;
-            case QUIT:
-                indexBaseMonthData = indexBaseMonthDataDao.getOrganDataWithDayAndDataType(musicGroup.getOrganId(), dayStr, IndexDataType.QUIT_MUSIC_GROUP_STUDENT_NUM);
-                break;
-            default:
-                return;
-        }
-        if(Objects.isNull(indexBaseMonthData)){
-            indexBaseMonthData = new IndexBaseMonthData();
-            Date date = DateUtil.stringToDate(dayStr, "yyyy-MM-dd");
-            BigDecimal zero = new BigDecimal(0);
-            indexBaseMonthData.setMonth(date);
-            indexBaseMonthData.setOrganId(musicGroup.getOrganId());
-            indexBaseMonthData.setDataType(StudentMusicGroupStatusEnum.NORMAL.equals(musicGroupStatusChangeEvent.getStudentMusicGroupStatus())?IndexDataType.NEWLY_STUDENT_NUM:IndexDataType.QUIT_MUSIC_GROUP_STUDENT_NUM);
-            indexBaseMonthData.setTotalNum(zero);
-            indexBaseMonthData.setActivateNum(zero);
-            indexBaseMonthData.setPercent(zero);
-        }
-        indexBaseMonthData.setTotalNum(indexBaseMonthData.getTotalNum().add(new BigDecimal(updateNum)));
-        indexBaseMonthData.setActivateNum(indexBaseMonthData.getActivateNum().add(new BigDecimal(updateNum)));
-        indexBaseMonthData.setPercent(indexBaseMonthData.getPercent().add(new BigDecimal(updateNum)));
-        if(Objects.isNull(indexBaseMonthData.getId())){
-            indexBaseMonthDataDao.insert(indexBaseMonthData);
-        }else{
-            indexBaseMonthDataDao.update(indexBaseMonthData);
-        }
+
     }
 
 }

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

@@ -4953,15 +4953,15 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
     		throw new BizException("非进行中课程组不可编辑");
 		}
 		if(courseStartDate.after(coursesExpireDate)){
-			throw new BizException("课程组有效结束时间不能早于课程组有效开始时间");
+			throw new BizException("课程组有效结束时间不能早于课程组有效开始时间");
 		}
 		Date minCourseTime = courseScheduleDao.getMinCourseTime(PRACTICE, practiceGroupId);
 		if(Objects.nonNull(minCourseTime)&&courseStartDate.compareTo(minCourseTime)>0){
-			throw new BizException("课程组有效开始时间不得晚于第一节课开始时间");
+			throw new BizException("课程组有效开始时间不得晚于第一节课开始时间");
 		}
 		Date maxCourseTime = courseScheduleDao.getMaxCourseTime(PRACTICE, practiceGroupId);
-		if(Objects.nonNull(maxCourseTime)&&coursesExpireDate.compareTo(maxCourseTime)<0){
-			throw new BizException("课程组有效结束时间不得早于最后一节课结束时间");
+		if(Objects.nonNull(maxCourseTime)&&!DateUtil.isSameDay(maxCourseTime, coursesExpireDate)&&coursesExpireDate.compareTo(maxCourseTime)<0){
+			throw new BizException("课程组有效结束时间不得早于最后一节课结束时间");
 		}
 //		if(Objects.nonNull(practiceGroup.getBuyMonths())){
 //			LocalDate courseStartDay = LocalDateTime.ofInstant(practiceGroup.getCoursesStartDate().toInstant(), DateUtil.zoneId).toLocalDate();

+ 3 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/impl/EduPracticeGroupServiceImpl.java

@@ -192,7 +192,7 @@ public class EduPracticeGroupServiceImpl implements EduPracticeGroupService{
 
         Date now=new Date();
 
-        int studentExitChargePractices = practiceGroupDao.checkStudentExitChargePractice(practiceGroupBuyParams.getStudentId());
+        int studentExitChargePractices = practiceGroupDao.checkStudentExitChargePractice(practiceGroupBuyParams.getStudentId(), "2021-03-10 00:00:00");
 
         LocalDate courseStartDay=LocalDate.now();
         LocalDate tempCourseLocalDate=LocalDate.parse("2020-03-01", DateUtil.dateFormatter);
@@ -286,7 +286,7 @@ public class EduPracticeGroupServiceImpl implements EduPracticeGroupService{
         }
         BigDecimal oneMonthPrice;
         BigDecimal oneMonthOriginalPrice=practiceGroupBuyParams.getDrillTimesOnWeek()==1?practiceGroupSellPrice.getOnceOriginalPrice():practiceGroupSellPrice.getTwiceOriginalPrice();
-        if(practiceBuyActivityExpireDate.after(now)){
+        if(practiceBuyActivityExpireDate.after(now)&&Objects.nonNull(sysUser.getOrganId())&&sysUser.getOrganId()==14&&studentExitChargePractices<=0){
             oneMonthPrice=practiceGroupBuyParams.getDrillTimesOnWeek()==1?practiceGroupSellPrice.getOnceActivityPrice():practiceGroupSellPrice.getTwiceActivityPrice();
             if(!now.before(practicePromotionActivityStartDate)&&practiceGroupBuyParams.getBuyMonths()>=3&&studentExitChargePractices>0){
                 oneMonthPrice=practiceGroupBuyParams.getDrillTimesOnWeek()==1?practiceGroupSellPrice.getOnceQuartActivityPrice():practiceGroupSellPrice.getTwiceQuartActivityPrice();
@@ -298,7 +298,7 @@ public class EduPracticeGroupServiceImpl implements EduPracticeGroupService{
         }
         BigDecimal originalAmount = oneMonthOriginalPrice.multiply(new BigDecimal(practiceGroupBuyParams.getBuyMonths()));
         BigDecimal amount= oneMonthPrice.multiply(new BigDecimal(practiceGroupBuyParams.getBuyMonths()));
-        if(!now.before(practicePromotionActivityStartDate)&&now.before(practiceBuyActivityExpireDate)&&studentExitChargePractices<=0){
+        if(!now.before(practicePromotionActivityStartDate)&&now.before(practiceBuyActivityExpireDate)&&Objects.nonNull(sysUser.getOrganId())&&sysUser.getOrganId()==14&&studentExitChargePractices<=0){
             amount= oneMonthPrice.multiply(new BigDecimal(1));
         }
 

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

@@ -2786,7 +2786,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
 
         Date now = new Date();
 
-        int studentExitChargePractices = practiceGroupDao.checkStudentExitChargePractice(practiceGroupBuyParams.getStudentId());
+        int studentExitChargePractices = practiceGroupDao.checkStudentExitChargePractice(practiceGroupBuyParams.getStudentId(),"2021-03-10 00:00:00");
 
         LocalDate courseStartDay = LocalDate.now();
         LocalDate tempCourseLocalDate = LocalDate.parse("2020-03-01", DateUtil.dateFormatter);
@@ -2894,7 +2894,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
             throw new BizException("所在城市暂不参与此活动");
         }
         BigDecimal oneMonthPrice;
-        if (practiceBuyActivityExpireDate.after(now)) {
+        if (practiceBuyActivityExpireDate.after(now)&&Objects.nonNull(sysUser.getOrganId())&&sysUser.getOrganId()==14&& studentExitChargePractices <= 0) {
             oneMonthPrice = practiceGroupBuyParams.getDrillTimesOnWeek() == 1 ? practiceGroupSellPrice.getOnceActivityPrice() : practiceGroupSellPrice.getTwiceActivityPrice();
             if (!now.before(practicePromotionActivityStartDate) && practiceGroupBuyParams.getBuyMonths() >= 3 && studentExitChargePractices > 0) {
                 oneMonthPrice = practiceGroupBuyParams.getDrillTimesOnWeek() == 1 ? practiceGroupSellPrice.getOnceQuartActivityPrice() : practiceGroupSellPrice.getTwiceQuartActivityPrice();
@@ -2905,7 +2905,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
             oneMonthPrice = practiceGroupBuyParams.getDrillTimesOnWeek() == 1 ? practiceGroupSellPrice.getOnceOriginalPrice() : practiceGroupSellPrice.getTwiceOriginalPrice();
         }
         BigDecimal amount = oneMonthPrice.multiply(new BigDecimal(practiceGroupBuyParams.getBuyMonths()));
-        if (!now.before(practicePromotionActivityStartDate) && now.before(practiceBuyActivityExpireDate) && studentExitChargePractices <= 0) {
+        if (!now.before(practicePromotionActivityStartDate) && now.before(practiceBuyActivityExpireDate) && Objects.nonNull(sysUser.getOrganId())&&sysUser.getOrganId()==14 && studentExitChargePractices <= 0) {
             amount = oneMonthPrice.multiply(new BigDecimal(1));
         }
 
@@ -3730,7 +3730,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
 
     @Override
     public boolean isPurchasedPracticeCourse(Integer userId) {
-        int count = practiceGroupDao.checkStudentExitChargePractice(userId);
+        int count = practiceGroupDao.checkStudentExitChargePractice(userId, null);
         if (count > 0) {
             return true;
         }

+ 3 - 0
mec-biz/src/main/resources/config/mybatis/PracticeGroupMapper.xml

@@ -672,6 +672,9 @@
 
     <select id="checkStudentExitChargePractice" resultType="int">
         SELECT COUNT(id_) FROM practice_group WHERE type_='CHARGE' AND student_id_=#{studentId} AND group_status_ IN ('NORMAL', 'FINISH')
+        <if test="startTime!=null and startTime!=''">
+            AND create_time_>#{startTime}
+        </if>
     </select>
 
     <select id="countStudentIngTrialPractices" resultType="int">

+ 0 - 2
mec-common/audit-log/src/main/java/com/yonge/log/interceptor/AuditLogInterceptor.java

@@ -14,8 +14,6 @@ import org.apache.commons.io.IOUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
-import org.springframework.web.context.WebApplicationContext;
-import org.springframework.web.context.support.WebApplicationContextUtils;
 import org.springframework.web.method.HandlerMethod;
 import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
 

+ 2 - 1
mec-student/src/main/java/com/ym/mec/student/controller/PracticeGroupController.java

@@ -198,8 +198,9 @@ public class PracticeGroupController extends BaseController {
         if (sysUser == null) {
             return failed(HttpStatus.FORBIDDEN, "请登录");
         }
-        int studentExitChargePractices = practiceGroupDao.checkStudentExitChargePractice(sysUser.getId());
+        int studentExitChargePractices = practiceGroupDao.checkStudentExitChargePractice(sysUser.getId(),"2021-03-10 00:00:00");
         Map<String, Integer> result=new HashMap<>();
+        result.put("organId", sysUser.getOrganId());
         result.put("isNewStudent", studentExitChargePractices<=0?0:1);
         return succeed(result);
     }

+ 3 - 1
mec-web/src/main/java/com/ym/mec/web/controller/education/EduPracticeGroupController.java

@@ -165,8 +165,10 @@ public class EduPracticeGroupController extends BaseController {
         if(Objects.isNull(studentId)){
             throw new BizException("请指定学生");
         }
-        int studentExitChargePractices = practiceGroupDao.checkStudentExitChargePractice(studentId);
+        SysUser student = sysUserFeignService.queryUserById(studentId);
+        int studentExitChargePractices = practiceGroupDao.checkStudentExitChargePractice(studentId, "2021-03-10 00:00:00");
         Map<String, Integer> result=new HashMap<>();
+        result.put("organId", student.getOrganId());
         result.put("isNewStudent", studentExitChargePractices<=0?0:1);
         return succeed(result);
     }