zouxuan 2 years ago
parent
commit
37554e3fd5

+ 4 - 39
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/VipGroupPayInfoDto.java

@@ -1,11 +1,14 @@
 package com.ym.mec.biz.dal.dto;
 package com.ym.mec.biz.dal.dto;
 
 
+import lombok.Data;
+
 import java.math.BigDecimal;
 import java.math.BigDecimal;
 
 
 /**
 /**
  * @Author Joburgess
  * @Author Joburgess
  * @Date 2019/11/29
  * @Date 2019/11/29
  */
  */
+@Data
 public class VipGroupPayInfoDto {
 public class VipGroupPayInfoDto {
 
 
     private Integer vipGroupId;
     private Integer vipGroupId;
@@ -18,43 +21,5 @@ public class VipGroupPayInfoDto {
 
 
     private Integer tenantId;
     private Integer tenantId;
 
 
-    public Integer getTenantId() {
-        return tenantId;
-    }
-
-    public void setTenantId(Integer tenantId) {
-        this.tenantId = tenantId;
-    }
-
-    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;
-    }
+    private Boolean alertSubjectFlag = false;
 }
 }

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

@@ -139,7 +139,7 @@ public class PayServiceImpl implements PayService {
         
         
         //如果当前是买的小课/网管课
         //如果当前是买的小课/网管课
 		if (studentPaymentOrder != null && (studentPaymentOrder.getType() == OrderTypeEnum.SMALL_CLASS_TO_BUY || studentPaymentOrder.getType() == OrderTypeEnum.PRACTICE_GROUP_BUY
 		if (studentPaymentOrder != null && (studentPaymentOrder.getType() == OrderTypeEnum.SMALL_CLASS_TO_BUY || studentPaymentOrder.getType() == OrderTypeEnum.PRACTICE_GROUP_BUY
-				|| studentPaymentOrder.getType() == OrderTypeEnum.PRACTICE_GROUP_RENEW)) {
+				|| studentPaymentOrder.getType() == OrderTypeEnum.PRACTICE_GROUP_RENEW || studentPaymentOrder.getType() == OrderTypeEnum.LIVE_GROUP_BUY)) {
 			
 			
 			//忽略的分部
 			//忽略的分部
 			List<Integer> ignoreOrganList = Arrays.asList(4);
 			List<Integer> ignoreOrganList = Arrays.asList(4);

+ 23 - 17
mec-biz/src/main/java/com/ym/mec/biz/service/impl/VipGroupServiceImpl.java

@@ -456,8 +456,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
         // 学生购买价格,老师课薪设置校验
         // 学生购买价格,老师课薪设置校验
         VipGroupApplyBaseInfoDto vipGroupApplyBaseInfoDto = vipGroup.getVipGroupApplyBaseInfo();
         VipGroupApplyBaseInfoDto vipGroupApplyBaseInfoDto = vipGroup.getVipGroupApplyBaseInfo();
 
 
-        if (Objects.isNull(vipGroupApplyBaseInfoDto.getOfflineClassesUnitPrice())
-                && Objects.isNull(vipGroupApplyBaseInfoDto.getOnlineClassesUnitPrice())) {
+        if (Objects.isNull(vipGroupApplyBaseInfoDto.getOfflineClassesUnitPrice()) && Objects.isNull(vipGroupApplyBaseInfoDto.getOnlineClassesUnitPrice())) {
             throw new BizException("请设置课程单价");
             throw new BizException("请设置课程单价");
         }
         }
 
 
@@ -508,25 +507,20 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 
 
         // VIP课参数校验
         // VIP课参数校验
         if (CourseSchedule.CourseScheduleType.VIP.getCode().equals(groupType)) {
         if (CourseSchedule.CourseScheduleType.VIP.getCode().equals(groupType)) {
-
             // 校验VIP课参数
             // 校验VIP课参数
             vipGroupRequestParamValid(vipGroup, vipGroupApplyBaseInfoDto, totalClassTimes, firstCourseSchedule, latestCourseSchedule);
             vipGroupRequestParamValid(vipGroup, vipGroupApplyBaseInfoDto, totalClassTimes, firstCourseSchedule, latestCourseSchedule);
-
         }
         }
 
 
         // LIVE课参数校验
         // LIVE课参数校验
         if (CourseSchedule.CourseScheduleType.LIVE.getCode().equals(groupType)) {
         if (CourseSchedule.CourseScheduleType.LIVE.getCode().equals(groupType)) {
-
             ImLiveBroadcastRoomDto liveRoom = vipGroup.getLiveBroadcastRoom();
             ImLiveBroadcastRoomDto liveRoom = vipGroup.getLiveBroadcastRoom();
             if (Objects.isNull(liveRoom) || Objects.isNull(liveRoom.getRoomConfig())) {
             if (Objects.isNull(liveRoom) || Objects.isNull(liveRoom.getRoomConfig())) {
                 throw new BizException("直播间参数错误");
                 throw new BizException("直播间参数错误");
             }
             }
-
             if (StringUtils.isAnyBlank(liveRoom.getRoomTitle(), liveRoom.getLiveRemark(), liveRoom.getOs())
             if (StringUtils.isAnyBlank(liveRoom.getRoomTitle(), liveRoom.getLiveRemark(), liveRoom.getOs())
                     || Objects.isNull(liveRoom.getUseScene())) {
                     || Objects.isNull(liveRoom.getUseScene())) {
                 throw new BizException("直播间参数错误");
                 throw new BizException("直播间参数错误");
             }
             }
-
             // 直播间默认方案
             // 直播间默认方案
             String liveClient = sysConfigDao.findConfigValue("live_client");
             String liveClient = sysConfigDao.findConfigValue("live_client");
             liveRoom.setServiceProvider(liveClient);
             liveRoom.setServiceProvider(liveClient);
@@ -566,19 +560,15 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
             costInfo = countVipGroupPredictFee1(vipGroupApplyBaseInfoDto, vipGroupApplyBaseInfoDto.getUserId(), null);
             costInfo = countVipGroupPredictFee1(vipGroupApplyBaseInfoDto, vipGroupApplyBaseInfoDto.getUserId(), null);
         }
         }
         if (CourseSchedule.CourseScheduleType.LIVE.getCode().equals(groupType)) {
         if (CourseSchedule.CourseScheduleType.LIVE.getCode().equals(groupType)) {
-            costInfo.put("totalPrice",
-                    vipGroupApplyBaseInfoDto.getOnlineClassesUnitPrice().multiply(new BigDecimal(vipGroupApplyBaseInfoDto.getOnlineClassesNum())));
+            costInfo.put("totalPrice",vipGroupApplyBaseInfoDto.getOnlineClassesUnitPrice().multiply(new BigDecimal(vipGroupApplyBaseInfoDto.getOnlineClassesNum())));
+            costInfo.put("originalTotalPrice",vipGroupApplyBaseInfoDto.getOfflineClassesUnitPrice().multiply(new BigDecimal(vipGroupApplyBaseInfoDto.getOnlineClassesNum())));
         }
         }
 
 
         vipGroupApplyBaseInfoDto.setAuditStatus(AuditStatusEnum.PASS);
         vipGroupApplyBaseInfoDto.setAuditStatus(AuditStatusEnum.PASS);
-
         vipGroupApplyBaseInfoDto.setStatus(VipGroupStatusEnum.APPLYING);
         vipGroupApplyBaseInfoDto.setStatus(VipGroupStatusEnum.APPLYING);
-        //如果默认课酬与实际课酬不匹配则需要审批
-//		if(costInfo.get("offlineTeacherSalary").compareTo(vipGroupApplyBaseInfoDto.getOfflineTeacherSalary()) < 0){
-//			vipGroupApplyBaseInfoDto.setAuditStatus(AuditStatusEnum.ING);
-//		}
 
 
          vipGroupApplyBaseInfoDto.setTotalPrice(costInfo.getOrDefault("totalPrice", ZERO));
          vipGroupApplyBaseInfoDto.setTotalPrice(costInfo.getOrDefault("totalPrice", ZERO));
+         vipGroupApplyBaseInfoDto.setTotalPrice(costInfo.getOrDefault("originalTotalPrice", ZERO));
         if (CollectionUtils.isEmpty(vscps)) {
         if (CollectionUtils.isEmpty(vscps)) {
             vscps = new ArrayList<>();
             vscps = new ArrayList<>();
             for (Integer canBuyStudentId : canBuyStudentIds) {
             for (Integer canBuyStudentId : canBuyStudentIds) {
@@ -2228,6 +2218,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
         VipGroupSalarySettlementTypeDto giveVipOfflineSalarySettlement = null;
         VipGroupSalarySettlementTypeDto giveVipOfflineSalarySettlement = null;
         BigDecimal discount = new BigDecimal(100);
         BigDecimal discount = new BigDecimal(100);
         BigDecimal totalPrice = null;
         BigDecimal totalPrice = null;
+        BigDecimal originalTotalPrice = null;
         if (vipGroup.getVipGroupActivityId() != null) {
         if (vipGroup.getVipGroupActivityId() != null) {
             VipGroupActivity vipGroupActivity = vipGroupActivityDao.get(vipGroup.getVipGroupActivityId());
             VipGroupActivity vipGroupActivity = vipGroupActivityDao.get(vipGroup.getVipGroupActivityId());
             discount = vipGroupActivity.getDiscount();
             discount = vipGroupActivity.getDiscount();
@@ -2239,7 +2230,9 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
             giveVipOfflineSalarySettlement = vipGroupSalarySettlementDto.getGiveVipOfflineSalarySettlement();
             giveVipOfflineSalarySettlement = vipGroupSalarySettlementDto.getGiveVipOfflineSalarySettlement();
             if(vipGroupActivity.getFixedCourseNumFlag()){
             if(vipGroupActivity.getFixedCourseNumFlag()){
                 totalPrice = vipGroupActivity.getMarketPrice();
                 totalPrice = vipGroupActivity.getMarketPrice();
+                originalTotalPrice = vipGroupActivity.getOriginalPrice();
                 vipGroup.setTotalPrice(totalPrice);
                 vipGroup.setTotalPrice(totalPrice);
+                vipGroup.setOriginalTotalPrice(originalTotalPrice);
             }
             }
             //是否是赠送课程
             //是否是赠送课程
             ActivityUserMapper activityUserMapper = activityUserMapperService.findVipUserMapper(vipGroup.getId(), "VIP", null);
             ActivityUserMapper activityUserMapper = activityUserMapperService.findVipUserMapper(vipGroup.getId(), "VIP", null);
@@ -2268,11 +2261,14 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 
 
             //课程购买费用计算
             //课程购买费用计算
             totalPrice = onlineVipGroupCharge.add(offlineVipGroupCharge);
             totalPrice = onlineVipGroupCharge.add(offlineVipGroupCharge);
+            originalTotalPrice = totalPrice;
             totalPrice = totalPrice.multiply(discount).divide(new BigDecimal(100), CommonConstants.DECIMAL_PLACE, BigDecimal.ROUND_DOWN);
             totalPrice = totalPrice.multiply(discount).divide(new BigDecimal(100), CommonConstants.DECIMAL_PLACE, BigDecimal.ROUND_DOWN);
 
 
             vipGroup.setTotalPrice(totalPrice.setScale(0, BigDecimal.ROUND_CEILING));
             vipGroup.setTotalPrice(totalPrice.setScale(0, BigDecimal.ROUND_CEILING));
+            vipGroup.setOriginalTotalPrice(originalTotalPrice);
         }
         }
         results.put("totalPrice", vipGroup.getTotalPrice());
         results.put("totalPrice", vipGroup.getTotalPrice());
+        results.put("originalTotalPrice", vipGroup.getOriginalTotalPrice());
 
 
         int normalStudentNum = classGroupStudentMapperDao.countGroupNormalStudentNum(VIP, vipGroup.getId().toString());
         int normalStudentNum = classGroupStudentMapperDao.countGroupNormalStudentNum(VIP, vipGroup.getId().toString());
 
 
@@ -2856,8 +2852,6 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
                     String organIdsString = StringUtils.join(hashSet, ",");
                     String organIdsString = StringUtils.join(hashSet, ",");
                     vipGroup.setOrganIdList(organIdsString);
                     vipGroup.setOrganIdList(organIdsString);
                     vipGroupDao.update(vipGroup);
                     vipGroupDao.update(vipGroup);
-                }else {
-                    vipGroupDao.updateStudentIdList(vipGroup.getId(),userId);
                 }
                 }
                 SysUserCashAccount sysUserCashAccount = sysUserCashAccountService.get(userId);
                 SysUserCashAccount sysUserCashAccount = sysUserCashAccountService.get(userId);
                 //插入缴费明细
                 //插入缴费明细
@@ -4690,6 +4684,18 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
             throw new BizException("未找到此课程");
             throw new BizException("未找到此课程");
         }
         }
         VipGroupPayInfoDto vipGroupPayInfo = new VipGroupPayInfoDto();
         VipGroupPayInfoDto vipGroupPayInfo = new VipGroupPayInfoDto();
+        if("LIVE".equals(vipGroup.getGroupType())){
+            ImLiveBroadcastRoomDto roomDto = JSON.parseObject(vipGroup.getLiveConfigJson(), ImLiveBroadcastRoomDto.class);
+            String subjectId = roomDto.getSubjectId();
+            Subject subject = subjectDao.get(Integer.parseInt(subjectId));
+            //乐理不提醒
+            if(!subject.getParentSubjectId().equals(30)){
+                Student student = studentDao.get(userId);
+                if(!student.getSubjectIdList().equals(subjectId)){
+                    vipGroupPayInfo.setAlertSubjectFlag(true);
+                }
+            }
+        }
         vipGroupPayInfo.setTenantId(vipGroup.getTenantId());
         vipGroupPayInfo.setTenantId(vipGroup.getTenantId());
         vipGroupPayInfo.setVipGroupId(vipGroup.getId().intValue());
         vipGroupPayInfo.setVipGroupId(vipGroup.getId().intValue());
         vipGroupPayInfo.setViipGroupName(vipGroup.getName());
         vipGroupPayInfo.setViipGroupName(vipGroup.getName());
@@ -4730,7 +4736,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
         queryInfo.setExpireFlag(true);
         queryInfo.setExpireFlag(true);
         Map<String, Object> params = new HashMap<String, Object>();
         Map<String, Object> params = new HashMap<String, Object>();
         MapUtil.populateMap(params, queryInfo);
         MapUtil.populateMap(params, queryInfo);
-        // VIP小课、直播课
+        // VIP小课
         List<StudentVipGroupShowListDto> vipGroups = vipGroupDao.findVipGroups(params);
         List<StudentVipGroupShowListDto> vipGroups = vipGroupDao.findVipGroups(params);
         // 直播课
         // 直播课
         vipGroups.addAll(vipGroupDao.findLiveGroups(params));
         vipGroups.addAll(vipGroupDao.findLiveGroups(params));

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

@@ -820,10 +820,10 @@
         LEFT JOIN teacher t ON pg.user_id_ = t.id_
         LEFT JOIN teacher t ON pg.user_id_ = t.id_
         LEFT JOIN sys_user su ON pg.user_id_ = su.id_
         LEFT JOIN sys_user su ON pg.user_id_ = su.id_
         WHERE pg.audit_status_ = 'PASS' AND pg.group_status_ = 'APPLYING' AND pg.courses_expire_date_ >= DATE_FORMAT(NOW(),'%Y%m%d')
         WHERE pg.audit_status_ = 'PASS' AND pg.group_status_ = 'APPLYING' AND pg.courses_expire_date_ >= DATE_FORMAT(NOW(),'%Y%m%d')
-        AND pg.registration_start_time_ &lt;= NOW()
-        AND pg.courses_start_date_ > NOW()
-        AND (select count(1) as num from student_payment_order where pg.id_ = music_group_id_ AND user_id_ = #{userId}
-        AND status_='SUCCESS') = 0 AND pg.student_id_ = #{userId}
+        AND pg.registration_start_time_ &lt;= NOW() AND pg.courses_start_date_ > NOW()
+        AND (select count(1) from class_group_student_mapper where status_ != 'QUIT'
+        and music_group_id_ = pg.id_ and group_type_ = 'PRACTICE' and user_id_ = #{userId}) = 0
+        AND pg.student_id_ = #{userId}
         <if test="subjectId != null">
         <if test="subjectId != null">
             AND pg.subject_id_ = #{subjectId}
             AND pg.subject_id_ = #{subjectId}
         </if>
         </if>

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

@@ -194,7 +194,7 @@
             <if test="teacherId!=null">
             <if test="teacherId!=null">
                 AND vg.user_id_=#{teacherId}
                 AND vg.user_id_=#{teacherId}
             </if>
             </if>
-            <if test="status != null">
+            <if test="status != null and status != ''">
                 AND vg.group_status_ = #{status}
                 AND vg.group_status_ = #{status}
             </if>
             </if>
             <if test="activityId!=null">
             <if test="activityId!=null">
@@ -366,12 +366,12 @@
     <sql id="studentVipGroupQueryCondition">
     <sql id="studentVipGroupQueryCondition">
         <where>
         <where>
             vg.audit_status_='PASS'
             vg.audit_status_='PASS'
-            AND vg.group_status_ = 1
+            AND vg.group_status_ = 1 AND vg.group_type_ = 'VIP'
             AND vg.courses_expire_date_ &gt;= DATE_FORMAT(NOW(),'%Y%m%d')
             AND vg.courses_expire_date_ &gt;= DATE_FORMAT(NOW(),'%Y%m%d')
             AND vg.registration_start_time_ &lt;= NOW()
             AND vg.registration_start_time_ &lt;= NOW()
             AND vg.courses_start_date &gt; NOW()
             AND vg.courses_start_date &gt; NOW()
-            AND (select count(1) as num from student_payment_order where vg.id_ = music_group_id_ AND user_id_=#{userId}
-            AND status_='SUCCESS') = 0
+            AND (select count(1) from class_group_student_mapper where status_ != 'QUIT'
+            and music_group_id_ = vg.id_ and group_type_ = vg.group_type_ and user_id_ = #{userId}) = 0
             AND IF(vg.student_id_list_ IS NULL, vg.organ_id_ = #{organId}, FIND_IN_SET(#{userId},
             AND IF(vg.student_id_list_ IS NULL, vg.organ_id_ = #{organId}, FIND_IN_SET(#{userId},
             vg.student_id_list_))
             vg.student_id_list_))
             <if test="expireFlag != null and expireFlag == true">
             <if test="expireFlag != null and expireFlag == true">
@@ -404,12 +404,12 @@
     <sql id="studentLiveGroupQueryCondition">
     <sql id="studentLiveGroupQueryCondition">
         <where>
         <where>
             vg.audit_status_='PASS'
             vg.audit_status_='PASS'
-            AND vg.group_status_ = 1
+            AND vg.group_status_ = 1 AND vg.group_type_ = 'VIP'
             AND vg.courses_expire_date_ &gt;= DATE_FORMAT(NOW(),'%Y%m%d')
             AND vg.courses_expire_date_ &gt;= DATE_FORMAT(NOW(),'%Y%m%d')
             AND vg.registration_start_time_ &lt;= NOW()
             AND vg.registration_start_time_ &lt;= NOW()
             AND vg.courses_start_date &gt; NOW()
             AND vg.courses_start_date &gt; NOW()
-            AND (select count(1) as num from student_payment_order where vg.id_ = music_group_id_ AND user_id_ = #{userId} AND type_ = 'LIVE_GROUP_BUY'
-            AND status_='SUCCESS') = 0
+            AND (select count(1) from class_group_student_mapper where status_ != 'QUIT'
+                and music_group_id_ = vg.id_ and group_type_ = vg.group_type_ and user_id_ = #{userId}) = 0
             <if test="expireFlag != null and expireFlag == true">
             <if test="expireFlag != null and expireFlag == true">
                 AND vg.payment_expire_date_ >= NOW()
                 AND vg.payment_expire_date_ >= NOW()
             </if>
             </if>

+ 0 - 4
mec-web/src/main/java/com/ym/mec/web/controller/VipGroupManageController.java

@@ -146,15 +146,12 @@ public class VipGroupManageController extends BaseController {
         if(Objects.isNull(teacher)){
         if(Objects.isNull(teacher)){
             return failed("请指定指导老师!");
             return failed("请指定指导老师!");
         }
         }
-
         // 设置默认参数VIP
         // 设置默认参数VIP
         if (StringUtils.isBlank(vipGroupApplyDto.getVipGroupApplyBaseInfo().getGroupType())) {
         if (StringUtils.isBlank(vipGroupApplyDto.getVipGroupApplyBaseInfo().getGroupType())) {
             vipGroupApplyDto.getVipGroupApplyBaseInfo().setGroupType(CourseSchedule.CourseScheduleType.VIP.getCode());
             vipGroupApplyDto.getVipGroupApplyBaseInfo().setGroupType(CourseSchedule.CourseScheduleType.VIP.getCode());
         }
         }
-
         // VIP课参数校验
         // VIP课参数校验
         if (CourseSchedule.CourseScheduleType.VIP.getCode().equals(vipGroupApplyDto.getVipGroupApplyBaseInfo().getGroupType())) {
         if (CourseSchedule.CourseScheduleType.VIP.getCode().equals(vipGroupApplyDto.getVipGroupApplyBaseInfo().getGroupType())) {
-
             if(Objects.isNull(vipGroupApplyDto.getVipGroupApplyBaseInfo().getOrganId())){
             if(Objects.isNull(vipGroupApplyDto.getVipGroupApplyBaseInfo().getOrganId())){
                 Integer firstStudentId = vipGroupApplyDto.getVipGroupApplyBaseInfo().getFirstStudentId();
                 Integer firstStudentId = vipGroupApplyDto.getVipGroupApplyBaseInfo().getFirstStudentId();
                 SysUser student = teacherDao.getUser(firstStudentId);
                 SysUser student = teacherDao.getUser(firstStudentId);
@@ -164,7 +161,6 @@ public class VipGroupManageController extends BaseController {
                 vipGroupApplyDto.getVipGroupApplyBaseInfo().setOrganId(student.getOrganId());
                 vipGroupApplyDto.getVipGroupApplyBaseInfo().setOrganId(student.getOrganId());
             }
             }
         }
         }
-
         return vipGroupService.createVipGroup(vipGroupApplyDto);
         return vipGroupService.createVipGroup(vipGroupApplyDto);
     }
     }