Procházet zdrojové kódy

musicGroup/getSubjectGoodsAndInfo 增加新的课程组成形态

周箭河 před 4 roky
rodič
revize
251ae2c303

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

@@ -312,6 +312,7 @@ public interface StudentPaymentOrderDao extends BaseDAO<Long, StudentPaymentOrde
 
     /**
      * 搜索用户
+     *
      * @param search
      * @return
      */
@@ -324,4 +325,13 @@ public interface StudentPaymentOrderDao extends BaseDAO<Long, StudentPaymentOrde
      */
     List<OrderStatisDto> doubleEleven2020Statis(@Param("organs") List<Organization> organs);
 
+    /**
+     * 获取用户某种类型订单成功的数量
+     *
+     * @param userId
+     * @param type
+     * @return
+     */
+    int getUserOrderNumByType(@Param("userId") Integer userId, @Param("orderType") OrderTypeEnum orderType);
+
 }

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

@@ -4,10 +4,7 @@ import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.dao.*;
 import com.ym.mec.biz.dal.entity.*;
-import com.ym.mec.biz.dal.enums.DealStatusEnum;
-import com.ym.mec.biz.dal.enums.MessageTypeEnum;
-import com.ym.mec.biz.dal.enums.PlatformCashAccountDetailTypeEnum;
-import com.ym.mec.biz.dal.enums.SporadicChargeTypeEnum;
+import com.ym.mec.biz.dal.enums.*;
 import com.ym.mec.biz.dal.page.SporadicChargeInfoQueryInfo;
 import com.ym.mec.biz.service.*;
 import com.ym.mec.common.dal.BaseDAO;
@@ -53,6 +50,8 @@ public class SporadicChargeInfoImpl extends BaseServiceImpl<Integer, SporadicCha
     private DegreeRegistrationService degreeRegistrationService;
     @Autowired
     private ContractService contractService;
+    @Autowired
+    private LuckDrawCountService luckDrawCountService;
 
     private final Logger logger = LoggerFactory.getLogger(this.getClass());
 
@@ -85,6 +84,13 @@ public class SporadicChargeInfoImpl extends BaseServiceImpl<Integer, SporadicCha
 
             //福袋活动,增加课程余额
             if (info.getChargeType().getCode() == 6 || info.getChargeType().getCode() == 12) {
+                //第二单起每买一单增加一次抽奖机会
+                int num = studentPaymentOrderDao.getUserOrderNumByType(userId, OrderTypeEnum.DOUBLE_ELEVEN2020);
+                if (num > 1) {
+                    if (!luckDrawCountService.updateTimes(userId.longValue(), 1)) {
+                        throw new BizException("给用户增加抽奖次数失败");
+                    }
+                }
                 sysUserCashAccountService.appendCourseBalance(userId, studentPaymentOrder.getActualAmount(), PlatformCashAccountDetailTypeEnum.SPORADIC, "双11活动");
             } else if (info.getChargeType().getCode() == 9) { //零星收费账户充值
                 sysUserCashAccountService.updateBalance(userId, studentPaymentOrder.getActualAmount(), PlatformCashAccountDetailTypeEnum.RECHARGE, "零星收费账户充值", studentPaymentOrder.getTransNo());

+ 8 - 0
mec-biz/src/main/resources/config/mybatis/StudentPaymentOrderMapper.xml

@@ -736,4 +736,12 @@
         </foreach>
         GROUP BY spo.organ_id_
     </select>
+
+    <select id="getUserOrderNumByType" resultType="int">
+        SELECT COUNT(*)
+        FROM student_payment_order
+        WHERE user_id_ = #{userId}
+          AND status_ = 'SUCCESS'
+          AND type_ = #{orderType}
+    </select>
 </mapper>