Procházet zdrojové kódy

Merge branch 'online1' into edu_financial

river před 4 roky
rodič
revize
f891cdd713

+ 1 - 1
mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/config/WebMvcConfig.java

@@ -32,7 +32,7 @@ public class WebMvcConfig implements WebMvcConfigurer {
 	
 	@Override
 	public void addInterceptors(InterceptorRegistry registry) {
-		registry.addInterceptor(operationLogInterceptor).addPathPatterns("/**").excludePathPatterns("/login");
+		registry.addInterceptor(operationLogInterceptor).addPathPatterns("/userDevice/unbind").excludePathPatterns("/*");
 	}
 	
 	@Bean

+ 24 - 1
mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/core/service/CustomTokenServices.java

@@ -4,6 +4,7 @@ import java.util.Date;
 import java.util.Set;
 import java.util.UUID;
 
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.InitializingBean;
 import org.springframework.security.authentication.AuthenticationManager;
 import org.springframework.security.core.Authentication;
@@ -206,7 +207,29 @@ public class CustomTokenServices implements AuthorizationServerTokenServices, Re
 	}
 
 	public OAuth2AccessToken readAccessToken(String accessToken) {
-		return tokenStore.readAccessToken(accessToken);
+		OAuth2AccessToken token = tokenStore.readAccessToken(accessToken);
+		if (token == null) {
+			throw new InvalidTokenException("Token was not recognised");
+		}
+
+		if (token.isExpired()) {
+			throw new InvalidTokenException("Token has expired");
+		}
+
+		DefaultOAuth2AccessToken oAuth2AccessToken = (DefaultOAuth2AccessToken) token;
+
+		OAuth2Authentication authentication = tokenStore.readAuthentication(accessToken);
+
+		if (StringUtils.equalsIgnoreCase("system", authentication.getOAuth2Request().getClientId())) {
+			int validitySeconds = getAccessTokenValiditySeconds(authentication.getOAuth2Request());
+			if (validitySeconds > 0) {
+				oAuth2AccessToken.setExpiration(new Date(System.currentTimeMillis() + (validitySeconds * 1000L)));
+				
+				tokenStore.storeAccessToken(oAuth2AccessToken, authentication);
+			}
+		}
+
+		return oAuth2AccessToken;
 	}
 
 	public OAuth2Authentication loadAuthentication(String accessTokenValue) throws AuthenticationException,

+ 2 - 2
mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/web/controller/UserDeviceController.java

@@ -32,9 +32,9 @@ public class UserDeviceController extends BaseController {
 		return succeed(sysUserDeviceService.queryPage(queryInfo));
 	}
 
-	@ApiOperation(value = "分页查询用户信息")
+	@ApiOperation(value = "设备号解除绑定")
 	@PostMapping(value = "/unbind")
-	@AuditLogAnnotation(operateName = "帮助中心内容删除",interfaceURL = "helpCenterContent/delete")
+	@AuditLogAnnotation(operateName = "设备号解除绑定",interfaceURL = "userDevice/unbind")
 	public Object unbind(Integer id) {
 		return succeed(sysUserDeviceService.delete(id));
 	}

+ 4 - 4
mec-auth/mec-auth-server/src/main/resources/config/mybatis/SysUserDeviceMapper.xml

@@ -74,10 +74,10 @@
 				and device_num_ = #{deviceNum}
 			</if>
 			<if test="bindStartTime != null">
-				and bind_time_ &gt;= #{bindStartTime}
+				and date(bind_time_) &gt;= #{bindStartTime}
 			</if>
 			<if test="bindEndTime != null">
-				and bind_time_ &lt;= #{bindEndTime}
+				and date(bind_time_) &lt;= #{bindEndTime}
 			</if>
 		</where>
 		ORDER BY id_
@@ -95,10 +95,10 @@
 				and device_num_ = #{deviceNum}
 			</if>
 			<if test="bindStartTime != null">
-				and bind_time_ &gt;= #{bindStartTime}
+				and date(bind_time_) &gt;= #{bindStartTime}
 			</if>
 			<if test="bindEndTime != null">
-				and bind_time_ &lt;= #{bindEndTime}
+				and date(bind_time_) &lt;= #{bindEndTime}
 			</if>
 		</where>
 	</select>

+ 2 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ContractServiceImpl.java

@@ -26,6 +26,7 @@ import org.springframework.context.annotation.Lazy;
 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 org.springframework.util.CollectionUtils;
 
@@ -973,7 +974,7 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
 	}
 
 	@Override
-	@Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
+	@Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED, propagation = Propagation.REQUIRES_NEW)
 	public boolean transferProduceContract(Integer userId,String musicGroupId) {
 		SysUser user = studentDao.lockUserReturnInfo(userId);
 

+ 15 - 23
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderServiceImpl.java

@@ -123,6 +123,9 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 	private StudentRegistrationDao studentRegistrationDao;
 	@Autowired
 	private GroupEventSource groupEventSource;
+	
+	@Autowired
+	private StudentPaymentOrderDao studentPaymentOrderDao;
 
 	@Override
 	public BaseDAO<Long, MusicGroupPaymentCalender> getDAO() {
@@ -1350,33 +1353,22 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 		if (calender == null) {
 			throw new BizException("缴费信息不存在");
 		}
-		if (calender.getStatus() != PaymentCalenderStatusEnum.AUDITING && calender.getStatus() != PaymentCalenderStatusEnum.NO
-				&& calender.getStatus() != PaymentCalenderStatusEnum.REJECT) {
-			throw new BizException("删除失败,只有[审核中]、[拒绝]或[未开启缴费]状态才能删除");
-		}
-		MusicGroupStudentClassAdjust byBatchNo = musicGroupStudentClassAdjustDao.findByBatchNo(calender.getBatchNo());
-		if(byBatchNo != null){
-			throw new BizException("删除失败,班级调整的缴费项目不允许删除");
+		
+		//缴费项目中没有学生即可删除缴费项目
+		List<MusicGroupPaymentCalenderDetail> musicGroupPaymentCalenderDetailList = musicGroupPaymentCalenderDetailDao.queryByCalenderId(id, null);
+		if (musicGroupPaymentCalenderDetailList != null && musicGroupPaymentCalenderDetailList.size() > 0) {
+			throw new BizException("缴费项目中已存在学员,不能删除");
 		}
 
-		List<MusicGroupPaymentCalenderDetail> musicGroupPaymentCalenderDetailList = musicGroupPaymentCalenderDetailDao.queryByCalenderId(id,null);
-		if (musicGroupPaymentCalenderDetailList != null && musicGroupPaymentCalenderDetailList.size() > 0) {
-			List<MusicGroupPaymentCalenderDetail> paidList = musicGroupPaymentCalenderDetailList.stream()
-					.filter(MusicGroupPaymentCalenderDetail -> MusicGroupPaymentCalenderDetail.getPaymentStatus() != PaymentStatus.NON_PAYMENT)
-					.collect(Collectors.toList());
-			if (paidList.size() > 0) {
-				throw new BizException("存在已缴费的学生不能删除");
-			}
-			
-			List<Long> calenderDetailIdList = musicGroupPaymentCalenderDetailList.stream().map(cd -> cd.getId()).collect(Collectors.toList());
-			//是否已排课
-			List<MusicGroupPaymentStudentCourseDetail> musicGroupPaymentStudentCourseDetailList = musicGroupPaymentStudentCourseDetailDao.queryByMusicGroupPaymentStudentCourseDetailId(calenderDetailIdList);
-			long count = musicGroupPaymentStudentCourseDetailList.stream().filter(e -> e.getUsedCourseMinutes() > 0).count();
-			if(count > 0){
-				throw new BizException("存在已排课的学员");
+		if (calender.getPaymentType() == PaymentType.MUSIC_APPLY) {
+			// 是否存在缴费中的
+			List<StudentPaymentOrder> studentPaymentOrderList = studentPaymentOrderDao.queryByDealStatus(calender.getMusicGroupId(), OrderTypeEnum.APPLY,
+					DealStatusEnum.ING);
+			if (studentPaymentOrderList != null && studentPaymentOrderList.size() > 0) {
+				throw new BizException("存在缴费中的学生,不能删除");
 			}
 		}
-
+		
 		musicGroupPaymentCalenderDao.delete(id);
 		musicGroupPaymentCalenderDetailDao.deleteByCalenderId(id);
 		musicGroupPaymentStudentCourseDetailDao.deleteByMusicGroupPaymentCalenderId(id);

+ 14 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java

@@ -1089,8 +1089,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                 studentRegistration.setTemporaryCourseFee(new BigDecimal(0));
             }
             studentRegistration.setPaymentStatus(YES);
-            studentRegistration.setMusicGroupStatus(StudentMusicGroupStatusEnum.NORMAL);
-
+            
             if (studentPaymentOrder.getClassGroupId() == null || !studentPaymentOrder.getClassGroupId().equals(206)) {
                 studentRegistration.setPayingStatus(0);
             }
@@ -1105,6 +1104,18 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                     .filter(o -> !o.getType().getCode().equals("CLOUD_TEACHER_PLUS"))
                     .map(o -> o.getPrice().subtract(o.getRemitFee() == null ? BigDecimal.ZERO : o.getRemitFee()))
                     .reduce(BigDecimal.ZERO, BigDecimal::add);
+            
+            //已购买内容
+            List<OrderDetailTypeEnum> orderTypeList = allDetails.stream().map(t -> t.getType()).collect(Collectors.toList());
+            
+			if (musicGroup.getCourseViewType() == CourseViewTypeEnum.CLOUD_TEACHER || musicGroup.getCourseViewType() == CourseViewTypeEnum.CLOUD_TEACHER_PLUS) {
+				if (studentRegistration.getNoneNeedCloudTeacher() == 1 || orderTypeList.contains(OrderDetailTypeEnum.CLOUD_TEACHER)
+						|| orderTypeList.contains(OrderDetailTypeEnum.CLOUD_TEACHER_PLUS)) {
+					studentRegistration.setMusicGroupStatus(StudentMusicGroupStatusEnum.NORMAL);
+				}
+			} else {
+				studentRegistration.setMusicGroupStatus(StudentMusicGroupStatusEnum.NORMAL);
+			}
 
             //累加充值金额
             studentRegistration.setSurplusCourseFee(studentRegistration.getSurplusCourseFee().add(courseFee));
@@ -1916,6 +1927,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
             throw new BizException("该学生状态已更新,请刷新查看");
         }
         studentRegistration.setPayingStatus(0);
+        studentRegistration.setMusicGroupStatus(StudentMusicGroupStatusEnum.NORMAL);
         studentRegistrationDao.update(studentRegistration);
         StudentPaymentOrder order = studentPaymentOrderService.findMusicGroupApplyOrderByStatus(studentRegistration.getUserId(), studentRegistration.getMusicGroupId(), DealStatusEnum.SUCCESS);
         order.setPaymentAccountNo("200");

+ 28 - 28
mec-biz/src/main/java/com/ym/mec/biz/service/impl/VipGroupServiceImpl.java

@@ -653,20 +653,6 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 		className.append(StringUtils.join(studentNames, ","));
 		vipGroupApplyBaseInfoDto.setName(className.toString());
 
-
-		if(!ActivityCourseType.FREE_VIP.equals(vipGroup.getVipGroupApplyBaseInfo().getActivityCourseType())){
-			//计算课程相关费用信息
-			Map<String, BigDecimal> costInfo = countVipGroupPredictFee(vipGroupApplyBaseInfoDto,
-					vipGroupApplyBaseInfoDto.getUserId(), null);
-			vipGroupApplyBaseInfoDto.setOnlineTeacherSalary(costInfo.get("onlineTeacherSalary"));
-			vipGroupApplyBaseInfoDto.setOfflineTeacherSalary(costInfo.get("offlineTeacherSalary"));
-			vipGroupApplyBaseInfoDto.setTotalPrice(costInfo.get("totalPrice"));
-		}else{
-			vipGroupApplyBaseInfoDto.setOnlineTeacherSalary(BigDecimal.ZERO);
-			vipGroupApplyBaseInfoDto.setOfflineTeacherSalary(BigDecimal.ZERO);
-			vipGroupApplyBaseInfoDto.setTotalPrice(BigDecimal.ZERO);
-		}
-
 		vipGroupApplyBaseInfoDto.setAuditStatus(AuditStatusEnum.PASS);
 		vipGroupApplyBaseInfoDto.setStatus(VipGroupStatusEnum.PROGRESS);
 
@@ -710,6 +696,34 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 		classGroup.setUpdateTime(now);
 		classGroupDao.insert(classGroup);
 
+		//班级学员关联记录
+		List<ClassGroupStudentMapper> classGroupStudentMapperList = new ArrayList<>();
+		for (Integer studentId : studentIdList) {
+			ClassGroupStudentMapper classGroupStudentMapper = new ClassGroupStudentMapper();
+			classGroupStudentMapper.setMusicGroupId(vipGroupApplyBaseInfoDto.getId().toString());
+			classGroupStudentMapper.setClassGroupId(classGroup.getId());
+			classGroupStudentMapper.setUserId(studentId);
+			classGroupStudentMapper.setCreateTime(now);
+			classGroupStudentMapper.setStatus(ClassGroupStudentStatusEnum.NORMAL);
+			classGroupStudentMapper.setGroupType(GroupType.VIP);
+			classGroupStudentMapperList.add(classGroupStudentMapper);
+		}
+		classGroupStudentMapperDao.classGroupStudentsInsert(classGroupStudentMapperList);
+
+		if(!ActivityCourseType.FREE_VIP.equals(vipGroup.getVipGroupApplyBaseInfo().getActivityCourseType())){
+			//计算课程相关费用信息
+			Map<String, BigDecimal> costInfo = countVipGroupPredictFee(vipGroupApplyBaseInfoDto,
+					vipGroupApplyBaseInfoDto.getUserId(), null);
+			vipGroupApplyBaseInfoDto.setOnlineTeacherSalary(costInfo.get("onlineTeacherSalary"));
+			vipGroupApplyBaseInfoDto.setOfflineTeacherSalary(costInfo.get("offlineTeacherSalary"));
+			vipGroupApplyBaseInfoDto.setTotalPrice(costInfo.get("totalPrice"));
+		}else{
+			vipGroupApplyBaseInfoDto.setOnlineTeacherSalary(BigDecimal.ZERO);
+			vipGroupApplyBaseInfoDto.setOfflineTeacherSalary(BigDecimal.ZERO);
+			vipGroupApplyBaseInfoDto.setTotalPrice(BigDecimal.ZERO);
+		}
+		vipGroupDao.update(vipGroupApplyBaseInfoDto);
+
 		//创建班级老师关联记录
 		ClassGroupTeacherMapper classGroupTeacherMapper=new ClassGroupTeacherMapper();
 		classGroupTeacherMapper.setMusicGroupId(vipGroupApplyBaseInfoDto.getId().toString());
@@ -734,20 +748,6 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 		classGroupTeacherSalary.setUpdateTime(now);
 		classGroupTeacherSalaryDao.insert(classGroupTeacherSalary);
 
-		//班级学员关联记录
-		List<ClassGroupStudentMapper> classGroupStudentMapperList = new ArrayList<>();
-		for (Integer studentId : studentIdList) {
-			ClassGroupStudentMapper classGroupStudentMapper = new ClassGroupStudentMapper();
-			classGroupStudentMapper.setMusicGroupId(vipGroupApplyBaseInfoDto.getId().toString());
-			classGroupStudentMapper.setClassGroupId(classGroup.getId());
-			classGroupStudentMapper.setUserId(studentId);
-			classGroupStudentMapper.setCreateTime(now);
-			classGroupStudentMapper.setStatus(ClassGroupStudentStatusEnum.NORMAL);
-			classGroupStudentMapper.setGroupType(GroupType.VIP);
-			classGroupStudentMapperList.add(classGroupStudentMapper);
-		}
-		classGroupStudentMapperDao.classGroupStudentsInsert(classGroupStudentMapperList);
-
 		//课程信息调整
 		vipGroup.getCourseSchedules().forEach(courseSchedule -> {
 			courseSchedule.setGroupType(GroupType.VIP);

+ 1 - 1
mec-biz/src/main/resources/config/mybatis/StudentManageDao.xml

@@ -646,7 +646,7 @@
         LEFT JOIN class_group cg ON cgsm.class_group_id_ = cg.id_
         LEFT JOIN vip_group vg ON cg.music_group_id_ = vg.id_
         LEFT JOIN vip_group_activity vgc ON vgc.id_ = vg.vip_group_activity_id_
-        WHERE cg.group_type_ = 'VIP' AND cgsm.user_id_ = #{studentId} AND vg.group_status_ != 3
+        WHERE cg.group_type_ = 'VIP' AND cgsm.user_id_ = #{studentId} AND vg.group_status_ NOT IN (3,7)
         <if test="vipGroupName != null">
             AND vg.name_ LIKE CONCAT('%',#{vipGroupName},'%')
         </if>

+ 61 - 2
mec-teacher/src/main/java/com/ym/mec/teacher/controller/TeacherVipGroupController.java

@@ -4,11 +4,11 @@ import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.dao.TeacherDao;
 import com.ym.mec.biz.dal.dao.VipGroupCategoryDao;
+import com.ym.mec.biz.dal.dao.VipGroupDefaultClassesUnitPriceDao;
 import com.ym.mec.biz.dal.dto.StudentVipDouble11Dto;
 import com.ym.mec.biz.dal.dto.VipGroupApplyDto;
 import com.ym.mec.biz.dal.dto.VipGroupCostCountParamsDto;
-import com.ym.mec.biz.dal.entity.Teacher;
-import com.ym.mec.biz.dal.entity.VipGroupCategory;
+import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.dal.page.StudentManageQueryInfo;
 import com.ym.mec.biz.service.StudentManageService;
 import com.ym.mec.biz.service.VipGroupService;
@@ -48,6 +48,8 @@ public class TeacherVipGroupController extends BaseController {
 	private StudentManageService studentManageService;
 	@Autowired
 	private VipGroupCategoryDao vipGroupCategoryDao;
+	@Autowired
+	private VipGroupDefaultClassesUnitPriceDao vipGroupDefaultClassesUnitPriceDao;
 
 	@ApiOperation("vip课申请")
 	@PostMapping("/vipGroupApply")
@@ -177,4 +179,61 @@ public class TeacherVipGroupController extends BaseController {
 		return succeed(studentManageService.queryDouble11Students(queryInfo));
 	}
 
+	@ApiOperation(value = "获取六一活动学生列表")
+	@GetMapping("queryChildrenDayStudentList")
+	public Object queryStudentList(StudentManageQueryInfo queryInfo){
+		SysUser sysUser = sysUserFeignService.queryUserInfo();
+		if (sysUser == null) {
+			return failed("用户信息获取失败");
+		}
+		Teacher teacher = teacherDao.get(sysUser.getId());
+		if(Objects.isNull(teacher)){
+			return failed("教师信息不存在");
+		}
+		if(Objects.nonNull(teacher.getTeacherOrganId())){
+			queryInfo.setOrganId(teacher.getTeacherOrganId().toString());
+		}
+		if(StringUtils.isNotBlank(teacher.getFlowOrganRange())){
+			queryInfo.setOrganId(queryInfo.getOrganId()+","+teacher.getFlowOrganRange());
+		}
+		if(StringUtils.isBlank(queryInfo.getOrganId())){
+			return succeed(Collections.EMPTY_LIST);
+		}
+
+		queryInfo.setIsExport(false);
+		return succeed(studentManageService.findStudentsByOrganId(queryInfo));
+	}
+
+	@ApiOperation(value = "创建六一活动vip课")
+	@PostMapping("/createActivityVipGroup")
+	public Object createActivityVipGroup(@RequestBody VipGroupApplyDto vipGroupApplyDto){
+		SysUser sysUser = sysUserFeignService.queryUserInfo();
+		if (sysUser == null) {
+			return failed("用户信息获取失败");
+		}
+		vipGroupApplyDto.getVipGroupApplyBaseInfo().setUserId(sysUser.getId());
+		Integer userId = vipGroupApplyDto.getVipGroupApplyBaseInfo().getUserId();
+		Teacher teacher = teacherDao.get(userId);
+		if(Objects.isNull(teacher)){
+			return failed("请指定指导老师!");
+		}
+		Integer firstStudentId = vipGroupApplyDto.getVipGroupApplyBaseInfo().getFirstStudentId();
+		SysUser student = teacherDao.getUser(firstStudentId);
+		if(Objects.isNull(student)||Objects.isNull(student.getOrganId())){
+			return failed("学员信息异常");
+		}
+		vipGroupApplyDto.getVipGroupApplyBaseInfo().setOrganId(student.getOrganId());
+		for (CourseSchedule courseSchedule : vipGroupApplyDto.getCourseSchedules()) {
+			courseSchedule.setEndClassTime(DateUtil.addMinutes(courseSchedule.getStartClassTime(), vipGroupApplyDto.getVipGroupApplyBaseInfo().getSingleClassMinutes()));
+		}
+		VipGroupDefaultClassesUnitPrice vipGroupDefaultClassesUnitPrice = vipGroupDefaultClassesUnitPriceDao.getByVipGroupCategory(vipGroupApplyDto.getVipGroupApplyBaseInfo().getVipGroupCategoryId(), vipGroupApplyDto.getVipGroupApplyBaseInfo().getOrganId());
+		if(Objects.nonNull(vipGroupDefaultClassesUnitPrice)){
+			vipGroupApplyDto.getVipGroupApplyBaseInfo().setOnlineClassesUnitPrice(vipGroupDefaultClassesUnitPrice.getOnlineClassesUnitPrice());
+			vipGroupApplyDto.getVipGroupApplyBaseInfo().setOfflineClassesUnitPrice(vipGroupDefaultClassesUnitPrice.getOfflineClassesUnitPrice());
+		}
+
+		vipGroupApplyDto.getVipGroupApplyBaseInfo().setEducationalTeacherId(sysUser.getId());
+		return vipGroupService.createActivityVipGroup(vipGroupApplyDto);
+	}
+
 }

+ 49 - 0
mec-teacher/src/main/java/com/ym/mec/teacher/controller/VipGroupActivityController.java

@@ -16,6 +16,7 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.util.CollectionUtils;
 import org.springframework.web.bind.annotation.*;
 
@@ -122,4 +123,52 @@ public class VipGroupActivityController extends BaseController {
         }
     }
 
+    @ApiOperation(value = "获取六一活动方案")
+    @GetMapping("/getChildrenDayActivitys")
+    public Object findByVipGroupCategory(Long categoryId, String studentIds){
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if(sysUser == null){
+            return failed("用户信息获取失败");
+        }
+        if(StringUtils.isBlank(studentIds)){
+            return failed("请选择学员");
+        }
+
+        SysConfig activityIdConfig = sysConfigService.findByParamName(SysConfigService.CHILDREN_DAY_VIP_ACTIVITY_IDS);
+        if(Objects.isNull(activityIdConfig)||StringUtils.isBlank(activityIdConfig.getParanValue())){
+            return succeed();
+        }
+
+        Set<Integer> activityIds = Arrays.stream(activityIdConfig.getParanValue().split(",")).map(id->Integer.valueOf(id)).collect(Collectors.toSet());
+
+        List<Integer> userIds = Arrays.stream(studentIds.split(",")).map(id -> Integer.valueOf(id)).collect(Collectors.toList());
+        List<Student> students = studentDao.findByStudentIds(userIds);
+        if(CollectionUtils.isEmpty(students)||students.size()!=userIds.size()){
+            return failed("学员信息不存在");
+        }
+        long newStudentNum = students.stream().filter(s -> s.getIsNewUser()).count();
+
+        Integer applyToStudentType = -1;
+        if(newStudentNum==0){
+            applyToStudentType = 0;
+        }else if(newStudentNum==userIds.size()){
+            applyToStudentType = 1;
+        }
+
+        SysUser student = teacherDao.getUser(userIds.get(0));
+        if(Objects.isNull(student)){
+            return failed("学员信息不存在");
+        }
+        String organIds = student.getOrganId().toString();
+        List<VipGroupActivity> vipGroupActivities = vipGroupActivityService.findByVipGroupCategory(categoryId, organIds, sysUser.getId(), applyToStudentType, null);
+        Iterator<VipGroupActivity> iterator = vipGroupActivities.iterator();
+        while (iterator.hasNext()){
+            VipGroupActivity vipGroupActivity = iterator.next();
+            if(!activityIds.contains(vipGroupActivity.getId())){
+                iterator.remove();
+            }
+        }
+        return succeed(vipGroupActivities);
+    }
+
 }

+ 2 - 2
mec-teacher/src/main/java/com/ym/mec/teacher/controller/VipGroupCategoryController.java

@@ -45,7 +45,7 @@ public class VipGroupCategoryController extends BaseController {
 
 	@ApiOperation("全查询")
 	@GetMapping(value = "/queryAll")
-	public Object queryAll(Integer organId) {
+	public Object queryAll(Integer organId, Integer includeMusicTheory) {
 		SysUser user = sysUserFeignService.queryUserInfo();
 		if (Objects.isNull(user)) {
 			return failed(HttpStatus.FORBIDDEN, "请登录");
@@ -62,7 +62,7 @@ public class VipGroupCategoryController extends BaseController {
 				return failed("教师信息不存在");
 			}
 			List<VipGroupCategory> result = vipGroupCategoryService.findAllByOrgan(teacher.getTeacherOrganId().toString());
-			if(!CollectionUtils.isEmpty(result)){
+			if(!CollectionUtils.isEmpty(result)&&(Objects.isNull(includeMusicTheory)||includeMusicTheory<=0)){
 				result = result.stream().filter(c->!c.getMusicTheory()).collect(Collectors.toList());
 			}
 			return succeed(result);

+ 13 - 0
mec-web/src/main/java/com/ym/mec/web/controller/education/EduVipGroupManageController.java

@@ -3,9 +3,11 @@ package com.ym.mec.web.controller.education;
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.dao.TeacherDao;
+import com.ym.mec.biz.dal.dao.VipGroupDefaultClassesUnitPriceDao;
 import com.ym.mec.biz.dal.dto.VipGroupApplyDto;
 import com.ym.mec.biz.dal.entity.CourseSchedule;
 import com.ym.mec.biz.dal.entity.Teacher;
+import com.ym.mec.biz.dal.entity.VipGroupDefaultClassesUnitPrice;
 import com.ym.mec.biz.service.VipGroupService;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.entity.HttpResponseResult;
@@ -35,6 +37,8 @@ public class EduVipGroupManageController extends BaseController {
     private SysUserFeignService sysUserFeignService;
     @Autowired
     private TeacherDao teacherDao;
+    @Autowired
+    private VipGroupDefaultClassesUnitPriceDao vipGroupDefaultClassesUnitPriceDao;
 
     @ApiOperation(value = "创建六一活动vip课")
     @PostMapping("/createActivityVipGroup")
@@ -59,6 +63,15 @@ public class EduVipGroupManageController extends BaseController {
         for (CourseSchedule courseSchedule : vipGroupApplyDto.getCourseSchedules()) {
             courseSchedule.setEndClassTime(DateUtil.addMinutes(courseSchedule.getStartClassTime(), vipGroupApplyDto.getVipGroupApplyBaseInfo().getSingleClassMinutes()));
         }
+
+        if(Objects.nonNull(vipGroupApplyDto.getVipGroupApplyBaseInfo().getVipGroupCategoryId())){
+            VipGroupDefaultClassesUnitPrice vipGroupDefaultClassesUnitPrice = vipGroupDefaultClassesUnitPriceDao.getByVipGroupCategory(vipGroupApplyDto.getVipGroupApplyBaseInfo().getVipGroupCategoryId(), vipGroupApplyDto.getVipGroupApplyBaseInfo().getOrganId());
+            if(Objects.nonNull(vipGroupDefaultClassesUnitPrice)){
+                vipGroupApplyDto.getVipGroupApplyBaseInfo().setOnlineClassesUnitPrice(vipGroupDefaultClassesUnitPrice.getOnlineClassesUnitPrice());
+                vipGroupApplyDto.getVipGroupApplyBaseInfo().setOfflineClassesUnitPrice(vipGroupDefaultClassesUnitPrice.getOfflineClassesUnitPrice());
+            }
+        }
+
         vipGroupApplyDto.getVipGroupApplyBaseInfo().setEducationalTeacherId(sysUser.getId());
         return vipGroupService.createActivityVipGroup(vipGroupApplyDto);
     }