|  | @@ -2135,7 +2135,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
 | 
											
												
													
														|  |      @Override
 |  |      @Override
 | 
											
												
													
														|  |      public PracticeGroup findUserLatestPracticeGroup(Integer userId, Long groupId) {
 |  |      public PracticeGroup findUserLatestPracticeGroup(Integer userId, Long groupId) {
 | 
											
												
													
														|  |          if(Objects.isNull(groupId)){
 |  |          if(Objects.isNull(groupId)){
 | 
											
												
													
														|  | -            throw new BizException("请选择续费的课程");
 |  | 
 | 
											
												
													
														|  | 
 |  | +            throw new BizException("请选择需要续费的课程");
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  |          Date now=new Date();
 |  |          Date now=new Date();
 | 
											
												
													
														|  |          PracticeGroupDto userPracticeGroup = practiceGroupDao.findUserPracticeGroup2(userId, groupId);
 |  |          PracticeGroupDto userPracticeGroup = practiceGroupDao.findUserPracticeGroup2(userId, groupId);
 | 
											
										
											
												
													
														|  | @@ -2143,7 +2143,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
 | 
											
												
													
														|  |              throw new BizException("需要续费的课程组不存在");
 |  |              throw new BizException("需要续费的课程组不存在");
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  |          if(userPracticeGroup.getCoursesExpireDate().before(now)){
 |  |          if(userPracticeGroup.getCoursesExpireDate().before(now)){
 | 
											
												
													
														|  | -            throw new BizException("此课程组已超过可续费期限");
 |  | 
 | 
											
												
													
														|  | 
 |  | +            throw new BizException("当前课程组已经无法续费,请选择购买");
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  |          return userPracticeGroup;
 |  |          return userPracticeGroup;
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
										
											
												
													
														|  | @@ -2642,12 +2642,12 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
 | 
											
												
													
														|  |          LocalDate courseStartDay=LocalDate.now();
 |  |          LocalDate courseStartDay=LocalDate.now();
 | 
											
												
													
														|  |          if(practiceGroupBuyParams.isRenew()){
 |  |          if(practiceGroupBuyParams.isRenew()){
 | 
											
												
													
														|  |              if(Objects.isNull(practiceGroupBuyParams.getGroupId())){
 |  |              if(Objects.isNull(practiceGroupBuyParams.getGroupId())){
 | 
											
												
													
														|  | -                return BaseController.failed(HttpStatus.EXPECTATION_FAILED, "请选择续费的课程");
 |  | 
 | 
											
												
													
														|  | 
 |  | +                return BaseController.failed(HttpStatus.EXPECTATION_FAILED, "请选择需要续费的课程");
 | 
											
												
													
														|  |              }
 |  |              }
 | 
											
												
													
														|  |              PracticeGroup userLatestPracticeGroup = practiceGroupDao.findUserPracticeGroup(practiceGroupBuyParams.getStudentId(),practiceGroupBuyParams.getGroupId());
 |  |              PracticeGroup userLatestPracticeGroup = practiceGroupDao.findUserPracticeGroup(practiceGroupBuyParams.getStudentId(),practiceGroupBuyParams.getGroupId());
 | 
											
												
													
														|  |              if(Objects.nonNull(userLatestPracticeGroup)){
 |  |              if(Objects.nonNull(userLatestPracticeGroup)){
 | 
											
												
													
														|  |                  if(userLatestPracticeGroup.getCoursesExpireDate().before(now)){
 |  |                  if(userLatestPracticeGroup.getCoursesExpireDate().before(now)){
 | 
											
												
													
														|  | -                    throw new BizException("此课程组已超过可续费期限");
 |  | 
 | 
											
												
													
														|  | 
 |  | +                    throw new BizException("当前课程组已经无法续费,请选择购买");
 | 
											
												
													
														|  |                  }
 |  |                  }
 | 
											
												
													
														|  |                  LocalDate lastExpiredDay=LocalDateTime.ofInstant(userLatestPracticeGroup.getCoursesExpireDate().toInstant(),DateUtil.zoneId).toLocalDate();
 |  |                  LocalDate lastExpiredDay=LocalDateTime.ofInstant(userLatestPracticeGroup.getCoursesExpireDate().toInstant(),DateUtil.zoneId).toLocalDate();
 | 
											
												
													
														|  |                  if(Objects.nonNull(lastExpiredDay)&&lastExpiredDay.compareTo(courseStartDay)>=0){
 |  |                  if(Objects.nonNull(lastExpiredDay)&&lastExpiredDay.compareTo(courseStartDay)>=0){
 | 
											
										
											
												
													
														|  | @@ -2938,7 +2938,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |              return BaseController.succeed(payMap);
 |  |              return BaseController.succeed(payMap);
 | 
											
												
													
														|  |          } catch (Exception e) {
 |  |          } catch (Exception e) {
 | 
											
												
													
														|  | -            throw new BizException("调用支付接口出错", e);
 |  | 
 | 
											
												
													
														|  | 
 |  | +            throw new BizException("订单提交超时,请尝试重新提交购买");
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
										
											
												
													
														|  | @@ -3045,12 +3045,12 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
 | 
											
												
													
														|  |              LOGGER.error("小课[{}]购买协议错误:{}",order.getMusicGroupId(),e.getMessage(),e.getMessage());
 |  |              LOGGER.error("小课[{}]购买协议错误:{}",order.getMusicGroupId(),e.getMessage(),e.getMessage());
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -//        List<ImGroupMember> imGroupMemberList = new ArrayList<>();
 |  | 
 | 
											
												
													
														|  | -//        imGroupMemberList.add(new ImGroupMember(practiceGroup.getUserId().toString()));
 |  | 
 | 
											
												
													
														|  | -//        imGroupMemberList.add(new ImGroupMember(practiceGroup.getStudentId().toString()));
 |  | 
 | 
											
												
													
														|  | -//        ImGroupMember[] imGroupMembers = imGroupMemberList.toArray(new ImGroupMember[imGroupMemberList.size()]);
 |  | 
 | 
											
												
													
														|  | -//        // 创建群组
 |  | 
 | 
											
												
													
														|  | -//        imFeignService.groupCreate(new ImGroupModel(classGroup.getId().toString(), imGroupMembers, classGroup.getName()));
 |  | 
 | 
											
												
													
														|  | 
 |  | +        List<ImGroupMember> imGroupMemberList = new ArrayList<>();
 | 
											
												
													
														|  | 
 |  | +        imGroupMemberList.add(new ImGroupMember(practiceGroup.getUserId().toString()));
 | 
											
												
													
														|  | 
 |  | +        imGroupMemberList.add(new ImGroupMember(practiceGroup.getStudentId().toString()));
 | 
											
												
													
														|  | 
 |  | +        ImGroupMember[] imGroupMembers = imGroupMemberList.toArray(new ImGroupMember[imGroupMemberList.size()]);
 | 
											
												
													
														|  | 
 |  | +        // 创建群组
 | 
											
												
													
														|  | 
 |  | +        imFeignService.groupCreate(new ImGroupModel(classGroup.getId().toString(), imGroupMembers, classGroup.getName()));
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      @Override
 |  |      @Override
 | 
											
										
											
												
													
														|  | @@ -3127,7 +3127,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
 | 
											
												
													
														|  |          Map<DealStatusEnum, List<StudentPaymentOrder>> statusOrderMap = userGroupOrders.stream().collect(Collectors.groupingBy(StudentPaymentOrder::getStatus));
 |  |          Map<DealStatusEnum, List<StudentPaymentOrder>> statusOrderMap = userGroupOrders.stream().collect(Collectors.groupingBy(StudentPaymentOrder::getStatus));
 | 
											
												
													
														|  |          List<StudentPaymentOrder> successOrders=statusOrderMap.get(DealStatusEnum.SUCCESS);
 |  |          List<StudentPaymentOrder> successOrders=statusOrderMap.get(DealStatusEnum.SUCCESS);
 | 
											
												
													
														|  |          if(!CollectionUtils.isEmpty(successOrders)&&successOrders.size()>0){
 |  |          if(!CollectionUtils.isEmpty(successOrders)&&successOrders.size()>0){
 | 
											
												
													
														|  | -            throw new BizException("此课程组存在支付成功的订单");
 |  | 
 | 
											
												
													
														|  | 
 |  | +            throw new BizException("该订单已经支付成功,请勿重复购买");
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |          StudentPaymentOrder latestOrder=userGroupOrders.stream().max(Comparator.comparing(StudentPaymentOrder::getCreateTime)).get();
 |  |          StudentPaymentOrder latestOrder=userGroupOrders.stream().max(Comparator.comparing(StudentPaymentOrder::getCreateTime)).get();
 | 
											
										
											
												
													
														|  | @@ -3137,7 +3137,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |          List<StudentPaymentOrder> ingOrders = statusOrderMap.get(DealStatusEnum.ING);
 |  |          List<StudentPaymentOrder> ingOrders = statusOrderMap.get(DealStatusEnum.ING);
 | 
											
												
													
														|  |          if(CollectionUtils.isEmpty(ingOrders)||ingOrders.size()<=0){
 |  |          if(CollectionUtils.isEmpty(ingOrders)||ingOrders.size()<=0){
 | 
											
												
													
														|  | -            throw new BizException("此课程组不存在进行中的订单");
 |  | 
 | 
											
												
													
														|  | 
 |  | +            throw new BizException("改订单支付失败,请重新购买");
 | 
											
												
													
														|  |          }else{
 |  |          }else{
 | 
											
												
													
														|  |              for (StudentPaymentOrder ingOrder : ingOrders) {
 |  |              for (StudentPaymentOrder ingOrder : ingOrders) {
 | 
											
												
													
														|  |                  ingOrder.setStatus(DealStatusEnum.CLOSE);
 |  |                  ingOrder.setStatus(DealStatusEnum.CLOSE);
 | 
											
										
											
												
													
														|  | @@ -3179,7 +3179,20 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |              return BaseController.succeed(payMap);
 |  |              return BaseController.succeed(payMap);
 | 
											
												
													
														|  |          } catch (Exception e) {
 |  |          } catch (Exception e) {
 | 
											
												
													
														|  | -            throw new BizException("调用支付接口出错", e);
 |  | 
 | 
											
												
													
														|  | 
 |  | +            throw new BizException("订单提交超时,请尝试重新提交购买");
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    @Override
 | 
											
												
													
														|  | 
 |  | +    public void updateHistoryPracticeGroupStatus() {
 | 
											
												
													
														|  | 
 |  | +        List<PracticeGroup> historyPracticeGroups = practiceGroupDao.findHistoryPracticeGroups();
 | 
											
												
													
														|  | 
 |  | +        List<PracticeGroup> needUpdateGroups = new ArrayList<>();
 | 
											
												
													
														|  | 
 |  | +        for (PracticeGroup historyPracticeGroup : historyPracticeGroups) {
 | 
											
												
													
														|  | 
 |  | +            if(historyPracticeGroup.getGroupStatus().equals(GroupStatusEnum.NORMAL)){
 | 
											
												
													
														|  | 
 |  | +                historyPracticeGroup.setGroupStatus(GroupStatusEnum.FINISH);
 | 
											
												
													
														|  | 
 |  | +                needUpdateGroups.add(historyPracticeGroup);
 | 
											
												
													
														|  | 
 |  | +            }
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  | 
 |  | +        practiceGroupDao.batchUpdate(needUpdateGroups);
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |  }
 |  |  }
 |