浏览代码

feat:
1、网管课活动只针对石家庄开放
2、石家庄用户始终是新用户

Joburgess 4 年之前
父节点
当前提交
b9aebc636d

+ 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:

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

@@ -192,10 +192,7 @@ public class EduPracticeGroupServiceImpl implements EduPracticeGroupService{
 
         Date now=new Date();
 
-        int studentExitChargePractices = practiceGroupDao.checkStudentExitChargePractice(practiceGroupBuyParams.getStudentId());
-        if(sysUser.getOrganId()==14){
-            studentExitChargePractices = 0;
-        }
+        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);
@@ -289,7 +286,7 @@ public class EduPracticeGroupServiceImpl implements EduPracticeGroupService{
         }
         BigDecimal oneMonthPrice;
         BigDecimal oneMonthOriginalPrice=practiceGroupBuyParams.getDrillTimesOnWeek()==1?practiceGroupSellPrice.getOnceOriginalPrice():practiceGroupSellPrice.getTwiceOriginalPrice();
-        if(practiceBuyActivityExpireDate.after(now)&&Objects.nonNull(sysUser.getOrganId())&&sysUser.getOrganId()==14){
+        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();
@@ -301,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 - 7
mec-biz/src/main/java/com/ym/mec/biz/service/impl/PracticeGroupServiceImpl.java

@@ -2786,10 +2786,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
 
         Date now = new Date();
 
-        int studentExitChargePractices = practiceGroupDao.checkStudentExitChargePractice(practiceGroupBuyParams.getStudentId());
-        if(sysUser.getOrganId()==14){
-            studentExitChargePractices = 0;
-        }
+        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);
@@ -2897,7 +2894,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
             throw new BizException("所在城市暂不参与此活动");
         }
         BigDecimal oneMonthPrice;
-        if (practiceBuyActivityExpireDate.after(now)&&Objects.nonNull(sysUser.getOrganId())&&sysUser.getOrganId()==14) {
+        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();
@@ -2908,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));
         }
 
@@ -3733,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">

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

@@ -198,14 +198,10 @@ 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());
-        if(sysUser.getOrganId()==14){
-            result.put("isNewStudent", 0);
-        }else{
-            result.put("isNewStudent", studentExitChargePractices<=0?0:1);
-        }
+        result.put("isNewStudent", studentExitChargePractices<=0?0:1);
         return succeed(result);
     }
 

+ 4 - 7
mec-web/src/main/java/com/ym/mec/web/controller/education/EduPracticeGroupController.java

@@ -165,14 +165,11 @@ 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", sysUser.getOrganId());
-        if(sysUser.getOrganId()==14){
-            result.put("isNewStudent", 0);
-        }else{
-            result.put("isNewStudent", studentExitChargePractices<=0?0:1);
-        }
+        result.put("organId", student.getOrganId());
+        result.put("isNewStudent", studentExitChargePractices<=0?0:1);
         return succeed(result);
     }