|
@@ -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);
|
|
|
+ }
|
|
|
+
|
|
|
}
|