mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-09 02:46:50 +08:00
课程受众权限
This commit is contained in:
@@ -261,44 +261,18 @@ public class CoursePortalApi extends ApiBaseController{
|
||||
preview=true;
|
||||
}
|
||||
|
||||
// StudyCourse sc = new StudyCourse();
|
||||
// sc.setCourseId(course.getId());
|
||||
// sc.setAid(aid);
|
||||
log.debug("=--------- 开始查询是否学习过此课程 ---------------------------------course.getId()= "+ course.getId() + ",aid = " + aid );
|
||||
// PageList<StudyCourse> rs1= studyCourseService.findPage(1,10, sc, OrderCondition.desc("id"),null);
|
||||
StudyCourse studyCourse = studyCourseService.findByCourseIdAndAid(course.getId(), aid);
|
||||
log.debug("=--------- 开始查询是否学习过此课程 ---------------------------------course.getId()= "+ course.getId() + ",aid = " + aid +",studyCourse = " + studyCourse);
|
||||
boolean pass = false;
|
||||
if(!preview) {
|
||||
log.debug("=--------- 开始查询受众信息 ---------------------------------aid = " + aid);
|
||||
String token = request.getHeader("XBOE-Access-Token");
|
||||
log.debug("=--------- 获取token token = " + token);
|
||||
if (!courseCrowdList.isEmpty()) {
|
||||
for (CourseCrowd c : courseCrowdList) {
|
||||
//同一个受众,同一个只会有一条记录,所以这里就直接查询了
|
||||
// List<UserGroupItem> hasItem = userGroupService.findByGroupIdAndAid(c.getGroupId(),aid);
|
||||
|
||||
log.debug("=--------- 开始调研用户中心受众接口 groupId = " + c.getGroupId());
|
||||
List<AuditList> allAudienceList = thirdApi.getAllAudienceList(AuditListParam.builder().audienceId(c.getGroupId()).pageSize(1000).pageNo(1).build(), token);
|
||||
List<Long> userIdList = allAudienceList.stream().map(AuditList::getUserId).collect(Collectors.toList());
|
||||
log.debug("=--------- allAudienceList: " +allAudienceList);
|
||||
/*
|
||||
List<UserDynamic> userDynamicList = thirdApi.getAllUserdynamicList(UserdynamicParam.builder().aid(Long.parseLong(aid)).pageSize(1000).pageIndex(1).build(), token);
|
||||
log.error("=--------- 开始查询课程信息信息 ---------------------------------userDynamicList = " + userDynamicList);
|
||||
List<Long> dynamicList = userDynamicList.stream().map(UserDynamic::getContentId).map(Long::parseLong).collect(Collectors.toList());
|
||||
log.error(id + "=--------- 开始查询课程信息信息 ---------------------------------dynamicList = " + dynamicList);*/
|
||||
|
||||
|
||||
if (userIdList.contains(Long.parseLong(aid)) || !Objects.isNull(studyCourse)) {
|
||||
List<UserGroupItem> hasItem = userGroupService.findByGroupIdAndAid(c.getGroupId(),aid);
|
||||
if (hasItem != null && !hasItem.isEmpty() || !Objects.isNull(studyCourse)) {
|
||||
pass = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// if (!pass) {
|
||||
// //return badRequest("您无学习此课程的权限,请与管理员联系");
|
||||
// return wrap(JsonResponseStatus.NO_CONTENT, "您无学习此课程的权限,请与管理员联系",rs);
|
||||
// }
|
||||
|
||||
}else {
|
||||
pass = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user