| 
					
				 | 
			
			
				@@ -1,9 +1,10 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 package com.ym.mec.biz.service.impl; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.alibaba.fastjson.JSONArray; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 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.dto.CloudTeacherOrderDto; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.ym.mec.biz.dal.dto.Cloud2022ActivityDto; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ym.mec.biz.dal.dto.MemberPayParamDto; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ym.mec.biz.dal.entity.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ym.mec.biz.dal.enums.*; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -28,7 +29,6 @@ import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.http.HttpStatus; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.stereotype.Service; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.transaction.annotation.Isolation; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import org.springframework.transaction.annotation.Propagation; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.transaction.annotation.Transactional; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.math.BigDecimal; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -82,6 +82,8 @@ public class MemberRankSettingServiceImpl extends BaseServiceImpl<Integer, Membe 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private ActivityUserMapperDao activityUserMapperDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private MemberFeeSettingService memberFeeSettingService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private TeacherDao teacherDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private final Logger logger = LoggerFactory.getLogger(this.getClass()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -163,8 +165,7 @@ public class MemberRankSettingServiceImpl extends BaseServiceImpl<Integer, Membe 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (student == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             throw new BizException("非法访问"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        SysUser user = sysUserFeignService.queryUserById(userId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        SysUser user = teacherDao.getUser(userId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Integer organId = user.getOrganId(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (organId == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             throw new BizException("学生没有分部编号"); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -174,9 +175,12 @@ public class MemberRankSettingServiceImpl extends BaseServiceImpl<Integer, Membe 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         String[] checkCoupon = CouponDetailTypeEnum.getAllowType(MEMBER); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //校验优惠券 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         StudentPaymentOrder studentPaymentOrder = sysCouponCodeService.use(memberPayParamDto.getCouponIdList(), actualAmount, true, checkCoupon); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        studentPaymentOrder.setUserId(userId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        studentPaymentOrder.setOrganId(organId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         studentPaymentOrder.setMusicGroupId(paymentId.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         studentPaymentOrder.setMemo(cloudCoachPaymentProgram.getRemark()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        Map<String, Object> result = getMap(memberPayParamDto.getAmount(), memberPayParamDto.getUseBalancePayment(), userId, organId, studentPaymentOrder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        studentPaymentOrder.setGroupType(GroupType.MEMBER); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Map<String, Object> result = getMap(memberPayParamDto.getAmount(), memberPayParamDto.getUseBalancePayment(),studentPaymentOrder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return BaseController.succeed(result); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -201,8 +205,11 @@ public class MemberRankSettingServiceImpl extends BaseServiceImpl<Integer, Membe 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         String[] checkCoupon = CouponDetailTypeEnum.getAllowType(MEMBER); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //校验优惠券 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         StudentPaymentOrder studentPaymentOrder = sysCouponCodeService.use(memberPayParamDto.getCouponIdList(), actualAmount, true, checkCoupon); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        studentPaymentOrder.setUserId(sysUser.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        studentPaymentOrder.setOrganId(sysUser.getOrganId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         studentPaymentOrder.setMemo("学员团练宝购买"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        Map<String, Object> result = getMap(memberPayParamDto.getAmount(), memberPayParamDto.getUseBalancePayment(), sysUser.getId(), sysUser.getOrganId(), studentPaymentOrder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        studentPaymentOrder.setGroupType(GroupType.MEMBER); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Map<String, Object> result = getMap(memberPayParamDto.getAmount(), memberPayParamDto.getUseBalancePayment(),studentPaymentOrder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //生产团练宝订单 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         CloudTeacherOrder cloudTeacherOrder = new CloudTeacherOrder(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         cloudTeacherOrder.setOrderId(studentPaymentOrder.getId()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -217,6 +224,46 @@ public class MemberRankSettingServiceImpl extends BaseServiceImpl<Integer, Membe 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return BaseController.succeed(result); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Transactional(rollbackFor = Exception.class,isolation = Isolation.READ_COMMITTED) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public HttpResponseResult activeBuy(MemberPayParamDto memberPayParamDto) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        SysUser sysUser = Optional.of(sysUserFeignService.queryUserInfo()).orElseThrow(()-> new BizException("请登录")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String activeConfig = sysConfigDao.findConfigValue("cloud_teacher_active_config"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<Cloud2022ActivityDto> cloud2022ActivityDtos = JSONArray.parseArray(activeConfig, Cloud2022ActivityDto.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Cloud2022ActivityDto activityDto = cloud2022ActivityDtos.stream().filter(e -> e.getOrganId().contains(sysUser.getOrganId().toString())).findFirst().get(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(Objects.isNull(activityDto)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            throw new BizException("当前分部暂未开通活动"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //是否还有购买资格 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Integer activityId = Integer.parseInt(activityDto.getActivityId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        VipGroupActivity vipGroupActivity = Optional.of(vipGroupActivityDao.get(activityId)).orElseThrow(()-> new BizException("活动不存在")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(vipGroupActivity.getStudentMaxUsedTimes() != -1){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //获取活动购买次数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            int activityBuyNum = activityUserMapperDao.countActivityBuyNum(vipGroupActivity.getId(),sysUser.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if(activityBuyNum >= vipGroupActivity.getStudentMaxUsedTimes()){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                throw new BizException("您已达到购买次数上限"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //判断用户是否已存在订单 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<StudentPaymentOrder> memberIngOrders = studentPaymentOrderService.queryByCondition(GroupType.ACTIVITY,null,sysUser.getId(), DealStatusEnum.ING,OrderTypeEnum.MEMBER); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (CollectionUtils.isNotEmpty(memberIngOrders)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            HttpResponseResult result = studentPaymentOrderService.checkRepeatPay(memberIngOrders.get(0), memberPayParamDto.getRepeatPay()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (result.getCode() != 200) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //优惠券使用范围 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String[] checkCoupon = CouponDetailTypeEnum.getAllowType(MEMBER); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //校验优惠券 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        StudentPaymentOrder studentPaymentOrder = sysCouponCodeService.use(memberPayParamDto.getCouponIdList(), vipGroupActivity.getMarketPrice(), true, checkCoupon); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        studentPaymentOrder.setUserId(sysUser.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        studentPaymentOrder.setOrganId(sysUser.getOrganId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        studentPaymentOrder.setMemo("小小训练营活动购买"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        studentPaymentOrder.setGroupType(GroupType.ACTIVITY); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Map<String, Object> result = getMap(memberPayParamDto.getAmount(), memberPayParamDto.getUseBalancePayment(),studentPaymentOrder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return BaseController.succeed(result); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public static final String BUY_2_QQHE_LOCK = "BUY_2_QQHE_LOCK:"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Override 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -286,7 +333,10 @@ public class MemberRankSettingServiceImpl extends BaseServiceImpl<Integer, Membe 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         cache.set(cacheMap, 40, TimeUnit.MINUTES); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //创建订单 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         studentPaymentOrder.setOrderNo(orderNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        Map<String, Object> result = getMap(dto.getAmount(), dto.getUseBalancePayment(), sysUser.getId(), sysUser.getOrganId(), studentPaymentOrder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        studentPaymentOrder.setUserId(sysUser.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        studentPaymentOrder.setOrganId(sysUser.getOrganId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        studentPaymentOrder.setGroupType(GroupType.MEMBER); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Map<String, Object> result = getMap(dto.getAmount(), dto.getUseBalancePayment(),studentPaymentOrder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return BaseController.succeed(result); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -377,23 +427,19 @@ public class MemberRankSettingServiceImpl extends BaseServiceImpl<Integer, Membe 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     //写入支付数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    private Map<String, Object> getMap(BigDecimal amount, Boolean UseBalance, Integer userId, Integer organId, StudentPaymentOrder studentPaymentOrder) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private Map<String, Object> getMap(BigDecimal amount, Boolean UseBalance,StudentPaymentOrder studentPaymentOrder) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Date date = new Date(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         BigDecimal actualAmount = studentPaymentOrder.getActualAmount(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        studentPaymentOrder.setUserId(userId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        studentPaymentOrder.setOrganId(organId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        studentPaymentOrder.setRoutingOrganId(organId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        studentPaymentOrder.setRoutingOrganId(studentPaymentOrder.getOrganId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         studentPaymentOrder.setCreateTime(date); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         studentPaymentOrder.setUpdateTime(date); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         studentPaymentOrder.setBalancePaymentAmount(BigDecimal.ZERO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         studentPaymentOrder.setStatus(DealStatusEnum.ING); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         studentPaymentOrder.setVersion(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         studentPaymentOrder.setType(OrderTypeEnum.MEMBER); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        studentPaymentOrder.setGroupType(GroupType.MEMBER); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         studentPaymentOrder.setRemitFee(BigDecimal.ZERO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         studentPaymentOrder.setCourseRemitFee(BigDecimal.ZERO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         studentPaymentOrder.setPaymentChannel("BALANCE"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        studentPaymentOrder.setMemo(OrderTypeEnum.MEMBER.getMsg()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 判断金额是否正确 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (actualAmount.compareTo(amount) != 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             throw new BizException("非法请求"); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -437,7 +483,7 @@ public class MemberRankSettingServiceImpl extends BaseServiceImpl<Integer, Membe 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public boolean orderCallback(StudentPaymentOrder studentPaymentOrder) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //查询原定的是否已处理 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         StudentPaymentOrder orignStudentPaymentOrder = studentPaymentOrderService.lockOrder(studentPaymentOrder.getId()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -448,15 +494,6 @@ public class MemberRankSettingServiceImpl extends BaseServiceImpl<Integer, Membe 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Integer userId = studentPaymentOrder.getUserId(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        Student student = studentService.get(userId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (student == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            throw new BizException("学员信息不存在"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        SysUser sysUser = sysUserFeignService.queryUserById(userId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (sysUser == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            throw new BizException("学员信息不存在"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Date nowDate = new Date(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 更新订单信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         studentPaymentOrder.setUpdateTime(nowDate); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -467,6 +504,7 @@ public class MemberRankSettingServiceImpl extends BaseServiceImpl<Integer, Membe 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             studentPaymentOrderService.returnBalanceAndCoupon(studentPaymentOrder, "购买会员支付失败"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        SysUser sysUser = teacherDao.getUser(userId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 支付成功 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (studentPaymentOrder.getStatus() == DealStatusEnum.SUCCESS) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -479,11 +517,11 @@ public class MemberRankSettingServiceImpl extends BaseServiceImpl<Integer, Membe 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 cloudTeacherOrder.setLevel(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 cloudTeacherOrder.setStatus(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 cloudTeacherOrder.setType(activity.getPeriodEnum()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if(activity.getGiveCouponNum() == 1 && activity.getPeriodEnum() == PeriodEnum.MONTH){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    cloudTeacherOrder.setTime(studentPaymentOrder.getActivityBuyNum() * 2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                if(activity.getGiveCouponNum() == 1 && activity.getPeriodEnum() == PeriodEnum.MONTH){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                    cloudTeacherOrder.setTime(studentPaymentOrder.getActivityBuyNum() * 2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     cloudTeacherOrder.setTime(studentPaymentOrder.getActivityBuyNum()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 cloudTeacherOrder.setStudentId(studentPaymentOrder.getUserId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 cloudTeacherOrder.setOrganId(studentPaymentOrder.getOrganId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 cloudTeacherOrder.setAmount(studentPaymentOrder.getExpectAmount()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -493,16 +531,16 @@ public class MemberRankSettingServiceImpl extends BaseServiceImpl<Integer, Membe 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 activityUserMapper.setUserId(studentPaymentOrder.getUserId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 activityUserMapper.setActivityId(activity.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 activityUserMapper.setActualPrice(studentPaymentOrder.getExpectAmount()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                activityUserMapper.setGiveCouponId(activity.getGiveCouponId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                activityUserMapper.setGivePracticeFlag(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 activityUserMapper.setReturnFee(false); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 activityUserMapperDao.insert(activityUserMapper); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 //赠送优惠券 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                Integer giveCouponId = activity.getGiveCouponId(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                Integer giveCouponNum = activity.getGiveCouponNum(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if(Objects.nonNull(giveCouponId) && Objects.nonNull(giveCouponNum)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    sysCouponCodeService.exchangeCoupon(userId,giveCouponId, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            studentPaymentOrder.getId(),giveCouponNum,2,null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                Integer giveCouponId = activity.getGiveCouponId(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                Integer giveCouponNum = activity.getGiveCouponNum(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                if(Objects.nonNull(giveCouponId) && Objects.nonNull(giveCouponNum)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                    sysCouponCodeService.exchangeCoupon(userId,giveCouponId, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                            studentPaymentOrder.getId(),giveCouponNum,2,null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 //齐齐哈尔购买成功默认激活 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 // 活动时间: 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -519,6 +557,7 @@ public class MemberRankSettingServiceImpl extends BaseServiceImpl<Integer, Membe 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 //分部编号59 并且下单时间大于等于activityDateStr  todo 并且redis能查询到的就算齐齐哈尔活动购买的 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if (sysUser.getOrganId() == 59 && studentPaymentOrder.getCreateTime().after(activityDate) && cache.isExists()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     //齐齐哈尔会员活动 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    Student student = studentService.get(userId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     qqheMemberActivity(studentPaymentOrder, student, sysUser, cache); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     //删除标记 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     cache.delete(); 
			 |