mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-07 01:46:47 +08:00
更新查询
This commit is contained in:
@@ -65,13 +65,13 @@ public class CourseFullText {
|
||||
private Long topTime;
|
||||
|
||||
/**系统的一级*/
|
||||
private String sysType1;
|
||||
private String sysType1;
|
||||
|
||||
/**系统的二级*/
|
||||
private String sysType2;
|
||||
/**系统的二级*/
|
||||
private String sysType2;
|
||||
|
||||
/**系统的三级*/
|
||||
private String sysType3;
|
||||
/**系统的三级*/
|
||||
private String sysType3;
|
||||
|
||||
/**课程的标签*/
|
||||
private String tags;
|
||||
@@ -111,14 +111,14 @@ public class CourseFullText {
|
||||
private Integer device;
|
||||
|
||||
/**
|
||||
* 是否公开课,0表非公开课,1表公开课
|
||||
*/
|
||||
private Integer openCourse;
|
||||
* 是否公开课,0表非公开课,1表公开课
|
||||
*/
|
||||
private Integer openCourse;
|
||||
|
||||
/**
|
||||
* 是否公开0表非公开报名,1表公开报名-字段需新增,按管理端需求增加
|
||||
*/
|
||||
private Integer openEnroll;
|
||||
/**
|
||||
* 是否公开0表非公开报名,1表公开报名-字段需新增,按管理端需求增加
|
||||
*/
|
||||
private Integer openEnroll;
|
||||
|
||||
|
||||
/**
|
||||
@@ -141,4 +141,14 @@ public class CourseFullText {
|
||||
* 受众
|
||||
*/
|
||||
private String audience;
|
||||
|
||||
/**
|
||||
* 剔除的面授课id
|
||||
*/
|
||||
private String[] offCourseId;
|
||||
|
||||
/**
|
||||
* 在线课id
|
||||
*/
|
||||
private String[] courseId;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -46,13 +46,16 @@ public class ThirdApi {
|
||||
@Value("${infrasApi.dict}")
|
||||
private String infarasApiUrl;
|
||||
|
||||
@Value("${manageApi.stu.offcourse}")
|
||||
private String manageApiStu;
|
||||
|
||||
@Value("${audience.getOrgUsers}")
|
||||
private String searchOrgUsersUrl;
|
||||
|
||||
//获取例外人员的id
|
||||
public List<String> getUserId(){
|
||||
log.info("正在获取例外人员工号");
|
||||
// String s ="{\"show\":false,\"version\":\"1.1.0\",\"code\":200,\"msg\":\"请求成功!\",\"data\":{\"records\":[{\"id\":129,\"deleted\":null,\"createTime\":\"2023-10-16T10:03:25\",\"createId\":0,\"createName\":\"管理员\",\"updateTime\":\"2023-10-16T10:03:25\",\"updateId\":0,\"updateName\":\"管理员\",\"name\":\"李玉冰\",\"pid\":128,\"code\":\"00004409\",\"description\":null,\"value\":\"00004409\",\"img\":null,\"type\":1,\"level\":0,\"status\":0,\"sort\":0,\"children\":[]}],\"total\":0,\"size\":10,\"current\":1,\"orders\":[],\"id\":null,\"pid\":128,\"type\":1,\"status\":null,\"code\":null,\"name\":null,\"searchCount\":true,\"pages\":0},\"success\":true}";
|
||||
String s = Optional.ofNullable(HttpRequest.get(infarasApiUrl).execute() //"current",1,"type",1,"pid",128)
|
||||
String s = Optional.ofNullable(HttpRequest.get(infarasApiUrl).execute()
|
||||
.body()).orElseThrow(() -> new RuntimeException("token校验失败"));
|
||||
List<DictDto> dictDtos = Opt.ofBlankAble(s).map(t -> JSONUtil.toBean(t, DictResult.class)).map(DictResult::getData).orElseThrow();
|
||||
List<String>userNo=new ArrayList<>();
|
||||
@@ -61,9 +64,13 @@ public class ThirdApi {
|
||||
}
|
||||
return userDao.getListByUserNos(userNo).stream().map(User::getId).collect(Collectors.toList());
|
||||
}
|
||||
@Value("${audience.getOrgUsers}")
|
||||
private String searchOrgUsersUrl;
|
||||
|
||||
//获取面授课id
|
||||
public List<String>getOffCourseId(String userId,String token){
|
||||
log.info("正在获取面授课id");
|
||||
String s = Optional.ofNullable(HttpRequest.get(manageApiStu+"?userId="+userId).header("token", token).execute()
|
||||
.body()).orElseThrow(() -> new RuntimeException("token校验失败"));
|
||||
return Opt.ofBlankAble(s).map(t -> JSONUtil.toBean(t, StringResult.class)).map(StringResult::getData).orElseThrow();
|
||||
}
|
||||
|
||||
public List<UserInfoListVo> getAllUserList(UserListParam userListParam, String token) {
|
||||
log.info("获取用户:url:{}", searchOrgUsersUrl);
|
||||
@@ -91,11 +98,7 @@ public class ThirdApi {
|
||||
|
||||
|
||||
private void nextPage(UserListParam userListParam, String token, List<UserInfoListVo> userInfoLists, UserInfoListRootBean.ResultData t) {
|
||||
log.info("nextPage 1 获取用户:" + userListParam + ",TotalPage=" + t.getTotalPage());
|
||||
if (t.getTotalPage() == 0){
|
||||
t.setTotalPage((int)Math.ceil(Double.parseDouble(String.valueOf(t.getTotal()))/Double.parseDouble(String.valueOf(userListParam.getPageSize()))));
|
||||
}
|
||||
log.info("nextPage 2 获取用户:" + userListParam + ",TotalPage=" + t.getTotalPage());
|
||||
log.info("nextPage 获取用户--" + userListParam.getPageNo());
|
||||
if (t.getTotalPage() > userListParam.getPageNo()) {
|
||||
REQUEST_TASK.submit(() -> IntStream.range(userListParam.getPageNo(), t.getTotalPage()).parallel().forEach(i -> getAllUserList(userListParam.withPageNo(i + 1), token, userInfoLists))).join();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.xboe.api.vo;
|
||||
|
||||
import com.xboe.module.dict.entity.DictDto;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
@Data
|
||||
public class StringResult {
|
||||
private Boolean show;
|
||||
private String version;
|
||||
private String code;
|
||||
private String msg;
|
||||
private List<String> data;
|
||||
private String success;
|
||||
}
|
||||
@@ -6,14 +6,8 @@ import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.xboe.api.ThirdApi;
|
||||
import com.xboe.common.utils.StringUtil;
|
||||
import com.xboe.module.boecase.dao.CasesRecordDao;
|
||||
import com.xboe.old.dto.OrganizationDto;
|
||||
import com.xboe.system.organization.api.OrganizationApi;
|
||||
import com.xboe.system.organization.entity.Organization;
|
||||
import com.xboe.school.study.service.IStudyCourseService;
|
||||
import com.xboe.system.organization.service.IOrganizationService;
|
||||
import com.xboe.system.organization.service.impl.OrganizationServiceImpl;
|
||||
import com.xboe.system.user.dao.UserDao;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -40,6 +34,7 @@ import com.xboe.module.course.service.ICourseTeacherService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@@ -60,6 +55,9 @@ public class CourseFullTextApi extends ApiBaseController{
|
||||
@Resource
|
||||
IOrganizationService organizationService;
|
||||
|
||||
@Resource
|
||||
IStudyCourseService IStudyCourseService;
|
||||
|
||||
@Autowired
|
||||
ThirdApi thirdApi;
|
||||
|
||||
@@ -211,10 +209,22 @@ public class CourseFullTextApi extends ApiBaseController{
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/search")
|
||||
public JsonResponse<PageList<CourseFullText>> search(Pagination pager,CourseQueryDto dto,Integer minDuration,Integer maxDuration){
|
||||
//获取例外人员id
|
||||
public JsonResponse<PageList<CourseFullText>> search(Pagination pager, CourseQueryDto dto, Integer minDuration, Integer maxDuration, HttpServletRequest request){
|
||||
//获取例外人员id
|
||||
List<String> userId = thirdApi.getUserId();
|
||||
String userIds = String.join(",", userId);
|
||||
// String userIds="132,123";
|
||||
//获取没报名课程的id
|
||||
String token = request.getHeader("Xboe-Access-Token");
|
||||
if (StringUtils.isEmpty(token)) {
|
||||
token = request.getHeader("token");
|
||||
}
|
||||
List<String> offCourseId = thirdApi.getOffCourseId(dto.getUserId(),token);
|
||||
String offCourseIds = String.join(",", offCourseId);
|
||||
// String offCourseIds="123.311";
|
||||
//根据userId查询报名的课程
|
||||
List<String>courseId=IStudyCourseService.getCourseId(dto.getUserId());
|
||||
String courseIds = String.join(",", courseId);
|
||||
//只是查询已发布的
|
||||
dto.setPublish(true);
|
||||
if(this.fullTextSearch==null) {
|
||||
@@ -241,6 +251,12 @@ public class CourseFullTextApi extends ApiBaseController{
|
||||
if(StringUtils.isNotBlank(userIds)) {
|
||||
paras.setSysCreateAids(userIds.split(","));
|
||||
}
|
||||
if(StringUtils.isNotBlank(offCourseIds)) {
|
||||
paras.setOffCourseId(offCourseIds.split(","));
|
||||
}
|
||||
if(StringUtils.isNotBlank(courseIds)) {
|
||||
paras.setCourseId(courseIds.split(","));
|
||||
}
|
||||
|
||||
paras.setOpenCourse(dto.getOpenCourse());
|
||||
if(StringUtils.isNotBlank(dto.getOrderField())) {
|
||||
|
||||
@@ -8,12 +8,12 @@ import lombok.Data;
|
||||
@Data
|
||||
public class CourseQueryDto {
|
||||
|
||||
/**
|
||||
* 分隔符
|
||||
*/
|
||||
public static final String SEPARATE="-";
|
||||
/**
|
||||
* 分隔符
|
||||
*/
|
||||
public static final String SEPARATE="-";
|
||||
|
||||
/**资源归属一级*/
|
||||
/**资源归属一级*/
|
||||
private String resOwner1;
|
||||
|
||||
/**资源归属二级*/
|
||||
@@ -31,11 +31,6 @@ public class CourseQueryDto {
|
||||
/**是否发布,无就是全部*/
|
||||
private Boolean publish;
|
||||
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
private Boolean enabled;
|
||||
|
||||
/**创建人*/
|
||||
private String createUser;
|
||||
|
||||
@@ -124,4 +119,9 @@ public class CourseQueryDto {
|
||||
* 创建人id
|
||||
*/
|
||||
private String sysCreateAids;
|
||||
|
||||
/**
|
||||
* 登录人id
|
||||
*/
|
||||
private String userId;
|
||||
}
|
||||
|
||||
@@ -104,4 +104,5 @@ public interface IStudyCourseService {
|
||||
|
||||
List<CourseStudyItem> findByCourseAndUsers(String courseId,List<String> aids) throws Exception;
|
||||
|
||||
List<String> getCourseId(String userId);
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package com.xboe.school.study.service.impl;
|
||||
|
||||
import java.time.LocalDate;
|
||||
@@ -6,6 +5,7 @@ import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.transaction.Transactional;
|
||||
|
||||
@@ -707,6 +707,11 @@ public class StudyCourseServiceImpl implements IStudyCourseService{
|
||||
return rslist;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getCourseId(String userId) {
|
||||
return studyCourseDao.findList(FieldFilters.eq("aid", userId)).stream().map(StudyCourse::getCourseId).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<StudyCourse> findByIds(List<String> ids) {
|
||||
return studyCourseDao.findList(FieldFilters.in("id", ids));
|
||||
|
||||
Reference in New Issue
Block a user