| 
					
				 | 
			
			
				@@ -15,6 +15,7 @@ import com.ym.mec.common.service.impl.BaseServiceImpl; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ym.mec.thirdparty.message.MessageSenderPluginContext; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ym.mec.util.collection.MapUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ym.mec.util.date.DateUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.ym.mec.util.http.HttpUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.slf4j.Logger; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.slf4j.LoggerFactory; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -172,10 +173,6 @@ public class ChildrenDayReserveServiceImpl extends BaseServiceImpl<Integer, Chil 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public Map pay(DegreePayDto degreePayDto) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         studentDao.lockUser(degreePayDto.getUserId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (degreePayDto.getTheoryLevel() != null && !degreePayDto.getTheoryCourse()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            throw new BizException("参加乐理考试,请选乐理考级专项训练课"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //检查进行中的订单 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<ChildrenDayDegreeDetail> details = childrenDayDegreeDetailService.getByUserIdAndStatus(degreePayDto.getUserId(), 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -190,9 +187,18 @@ public class ChildrenDayReserveServiceImpl extends BaseServiceImpl<Integer, Chil 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //获取课程的价格 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        OrganizationDegreeCourseFee courseFee = organizationDegreeCourseFeeDao.getByOrganId(degreePayDto.getOrganId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //检查已经购买的课程(不能重复) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         details = childrenDayDegreeDetailService.getByUserIdAndStatus(degreePayDto.getUserId(), 2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Set<Integer> detailTypes = details.stream().map(ChildrenDayDegreeDetail::getType).collect(Collectors.toSet()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (degreePayDto.getTheoryLevel() != null && degreePayDto.getTheoryLevel() > 0 && 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                courseFee != null && !degreePayDto.getTheoryCourse() && !detailTypes.contains(5)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            throw new BizException("参加乐理考试,请选乐理考级专项训练课"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (degreePayDto.getVip1v1() && detailTypes.contains(3)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             throw new BizException("您已购买过VIP 1V1课程,请勿重复选择"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -214,12 +220,16 @@ public class ChildrenDayReserveServiceImpl extends BaseServiceImpl<Integer, Chil 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (hasList.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 throw new BizException("您已报考同声部同等级,请勿重复报考"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (degreePayDto.getNeedVipCourse() && !detailTypes.contains(3) && !detailTypes.contains(4)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                throw new BizException("请选择VIP课程"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //检查乐理考级等级是否重复 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (degreePayDto.getTheoryLevel() != null && degreePayDto.getTheoryLevel() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             List<ChildrenDayDegreeDetail> hasList = details.stream().filter(e -> e.getType().equals(2)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    .filter(e -> e.getLevel().equals(degreePayDto.getMusicGradeLevel())).collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .filter(e -> e.getLevel().equals(degreePayDto.getTheoryLevel())).collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (hasList.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 throw new BizException("您已报考同等级乐理,请勿重复报考"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -232,13 +242,6 @@ public class ChildrenDayReserveServiceImpl extends BaseServiceImpl<Integer, Chil 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         degreePayDto.setReserveId(userReserve.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        //获取课程的价格 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        OrganizationDegreeCourseFee courseFee = organizationDegreeCourseFeeDao.getByOrganId(degreePayDto.getOrganId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (courseFee == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            throw new BizException("刚前分部不参与,谢谢关注"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<DegreeLevelFee> degreeLevelFees = degreeLevelFeeDao.getAll(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //订单总金额 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -437,4 +440,27 @@ public class ChildrenDayReserveServiceImpl extends BaseServiceImpl<Integer, Chil 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public List<ChildrenStatisticsDetailDto> exportStatisticsDetail(ChildrenReserveQueryInfo queryInfo) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return childrenDayReserveDao.exportStatisticsDetail(queryInfo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public Boolean sendMsg(List<ChildrenDayMsgDto> msgDtos) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<ChildrenStatisticsDetailDto> reserves = childrenDayReserveDao.getSendMsgList(msgDtos); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Map<Integer, String> userMap = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Map<Integer, String> userPhoneMap = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        for (ChildrenStatisticsDetailDto reserve : reserves) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            userMap.put(reserve.getUserId(), reserve.getUserId().toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            userPhoneMap.put(reserve.getUserId(), reserve.getPhone()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String baseApiUrl = sysConfigDao.findConfigValue("base_api_url"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String pushUrl = baseApiUrl + "/#/childrenPayment"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.CHILDREN_DAY_NOTICE_PUSH, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                userMap, null, 0, "5?" + pushUrl, "STUDENT"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.AWSMS, MessageTypeEnum.CHILDREN_DAY_NOTICE_MSG, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                userPhoneMap, null, 0, null, null, pushUrl); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 |