mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-07 01:46:47 +08:00
@@ -126,4 +126,19 @@ public class CourseFullText {
|
||||
*/
|
||||
private List<String> keywordsList;
|
||||
|
||||
|
||||
/**
|
||||
* 课程创建人id
|
||||
*/
|
||||
private String sysCreateAid;
|
||||
|
||||
/**
|
||||
* 课程创建人id
|
||||
*/
|
||||
private String[] sysCreateAids;
|
||||
|
||||
/**
|
||||
* 受众
|
||||
*/
|
||||
private String audience;
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ public interface ICourseFullTextSearch {
|
||||
* 默认索引名称
|
||||
*/
|
||||
public static final String DEFAULT_INDEX_NAME="new_resource_list";
|
||||
|
||||
// public static final String DEFAULT_INDEX_NAME="my_resource_list";
|
||||
/**
|
||||
* 发布课程
|
||||
* @param indexName
|
||||
|
||||
@@ -354,29 +354,38 @@ public class CourseElasticsearchImpl implements ICourseFullTextSearch{
|
||||
}
|
||||
|
||||
|
||||
/* 2023-08-08 不管是否是此课程受众 ,都可以搜索到 但点进课程详情提示无权限
|
||||
/* 2023-08-08 不管是否是此课程受众 ,都可以搜索到 但点进课程详情提示无权限*/
|
||||
//加上Source判断,是为了应对后台查询,后台查询时,不需要权限,但是需要指定数据来源
|
||||
if(params.getSource()==null || params.getSource()==0 ) {
|
||||
/* 20231030 暂时不上线,
|
||||
if(params.getSource()==null || params.getSource()==0 ) {
|
||||
//受众权限条件,必须是有受众的课程并且受众条件不为空
|
||||
if(params.getAudiences()!=null && params.getAudiences().length>0) {
|
||||
//if(StringUtils.isNotBlank(params.getAudience())) {
|
||||
BoolQueryBuilder audience= QueryBuilders.boolQuery();
|
||||
audience.should(QueryBuilders.termQuery("isSetAudience",0));
|
||||
|
||||
|
||||
BoolQueryBuilder has= QueryBuilders.boolQuery();
|
||||
//String[] ids=params.getAudience().split(",");
|
||||
has.must(QueryBuilders.termQuery("isSetAudience",1));
|
||||
//has.must(QueryBuilders.termsQuery("audience", ids));
|
||||
has.must(QueryBuilders.termsQuery("audiences", params.getAudiences()));
|
||||
//查询出例外人员创建的课程
|
||||
if(params.getSysCreateAids()!=null && params.getSysCreateAids().length>0) {
|
||||
BoolQueryBuilder exception =QueryBuilders.boolQuery();
|
||||
exception.must(QueryBuilders.termsQuery("sysCreateAid",params.getSysCreateAids()));
|
||||
audience.should(exception);
|
||||
}
|
||||
audience.should(has);
|
||||
|
||||
audience.minimumShouldMatch(1);
|
||||
|
||||
boolQuery.filter(audience);
|
||||
//log.error("audience="+audience.toString());
|
||||
}else {
|
||||
//如果当前用户无受众,只能查询未设置受众的课程
|
||||
boolQuery.must(QueryBuilders.termQuery("isSetAudience",0));
|
||||
boolQuery.should(QueryBuilders.termQuery("isSetAudience",0));
|
||||
if(params.getSysCreateAids()!=null && params.getSysCreateAids().length>0) {
|
||||
boolQuery.should(QueryBuilders.termsQuery("sysCreateAid",params.getSysCreateAids()));
|
||||
}
|
||||
boolQuery.minimumShouldMatch(1);
|
||||
}
|
||||
}*/
|
||||
|
||||
@@ -612,6 +621,9 @@ public class CourseElasticsearchImpl implements ICourseFullTextSearch{
|
||||
sourceBuilder.query(boolQuery);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//排序
|
||||
if(StringUtils.isBlank(paras.getKeywords()) && paras.getOrderType()!=3) {
|
||||
sourceBuilder.sort("isTop",SortOrder.DESC);
|
||||
|
||||
@@ -5,14 +5,20 @@ import cn.hutool.core.lang.Opt;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.xboe.api.vo.*;
|
||||
import com.xboe.module.dict.entity.DictDto;
|
||||
import com.xboe.system.user.dao.UserDao;
|
||||
import com.xboe.system.user.entity.User;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.ForkJoinPool;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
@Service
|
||||
@@ -34,6 +40,27 @@ public class ThirdApi {
|
||||
@Value("${statApi.userdynamicList}")
|
||||
private String userdynamicListUrl;
|
||||
|
||||
@Autowired
|
||||
UserDao userDao;
|
||||
|
||||
@Value("${infrasApi.dict}")
|
||||
private String infarasApiUrl;
|
||||
|
||||
|
||||
|
||||
//获取例外人员的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)
|
||||
.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<>();
|
||||
for (DictDto dictDto : dictDtos) {
|
||||
userNo.add(dictDto.getValue());
|
||||
}
|
||||
return userDao.getListByUserNos(userNo).stream().map(User::getId).collect(Collectors.toList());
|
||||
}
|
||||
@Value("${audience.getOrgUsers}")
|
||||
private String searchOrgUsersUrl;
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.xboe.api.vo;
|
||||
|
||||
import com.xboe.module.dict.entity.DictDto;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class DictResult {
|
||||
private Boolean show;
|
||||
private String version;
|
||||
private String code;
|
||||
private String msg;
|
||||
private List<DictDto> data;
|
||||
private String success;
|
||||
}
|
||||
@@ -11,12 +11,14 @@ import com.xboe.core.orm.FieldFilters;
|
||||
import com.xboe.module.boecase.dao.CasesMajorTypeDao;
|
||||
import com.xboe.module.boecase.dto.*;
|
||||
import com.xboe.module.boecase.entity.CasesMajorType;
|
||||
import com.xboe.module.boecase.service.ICasesRecommendPushRecordService;
|
||||
import com.xboe.module.boecase.vo.CaseExportVo;
|
||||
import com.xboe.module.dict.entity.DictItem;
|
||||
import com.xboe.module.excel.ExportsExcelSenderUtil;
|
||||
|
||||
import com.xboe.system.user.dao.UserDao;
|
||||
import com.xboe.system.user.entity.User;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
@@ -63,6 +65,9 @@ public class CasesApi extends ApiBaseController {
|
||||
@Resource
|
||||
private UserDao userDao;
|
||||
|
||||
@Autowired
|
||||
private ICasesRecommendPushRecordService casesRecommendPushRecordService;
|
||||
|
||||
/**
|
||||
* 用于后台管理
|
||||
* @param pager
|
||||
@@ -523,14 +528,22 @@ public class CasesApi extends ApiBaseController {
|
||||
if(StringUtil.isBlank(cases.getAuthorId())){
|
||||
return badRequest("请选择作者");
|
||||
}
|
||||
// if(StringUtils.isBlank(cases.getType())){
|
||||
// return badRequest("type参数不能为空");
|
||||
// }
|
||||
if(cases.getExcellent()==null){
|
||||
cases.setExcellent(false);
|
||||
}
|
||||
if(StringUtils.isBlank(cases.getConfidentialityLevel())) {
|
||||
cases.setConfidentialityLevel("内部");
|
||||
}
|
||||
|
||||
try {
|
||||
casesService.update(cases);
|
||||
// 修改案例表 可能用不到
|
||||
if(StringUtils.isNotBlank(cases.getType()) && cases.getType().equals("recommend")){
|
||||
casesRecommendPushRecordService.update(cases);
|
||||
}
|
||||
return success(true);
|
||||
} catch (Exception e) {
|
||||
log.error("更新案例错误",e);
|
||||
|
||||
@@ -21,9 +21,8 @@ import java.util.List;
|
||||
*/
|
||||
@Repository
|
||||
public interface CasesRecordDao extends JpaRepository<Cases, String>, JpaSpecificationExecutor<Cases> {
|
||||
|
||||
@Query(nativeQuery = true, value = "select c.* from ( select b.*" +
|
||||
" from boe_cases_recommend_push_record a INNER JOIN boe_cases b on a.case_id = b.id" +
|
||||
" from boe_cases_recommend_push_record a left JOIN boe_cases b on a.case_id = b.id" +
|
||||
" where b.deleted=0 and a.push_status = 3 and a.deleted=0 and a.push_user_id= :#{#condition.userId}" +
|
||||
" and if(IFNULL(:#{#condition.keyWord},'')!='',b.title like CONCAT('%',:#{#condition.keyWord},'%')" +
|
||||
" or b.author_name like CONCAT('%',:#{#condition.keyWord},'%')" +
|
||||
@@ -40,9 +39,12 @@ public interface CasesRecordDao extends JpaRepository<Cases, String>, JpaSpecifi
|
||||
" or if(:#{#condition.org2Empty}, 1=2, b.org_domain_parent2 in (:#{#condition.org2}))" +
|
||||
" or if(:#{#condition.org3Empty}, 1=2, b.org_domain_parent3 in (:#{#condition.org3}))" +
|
||||
")" +
|
||||
" and if(:#{#condition.isSysType1Empty} , 1=1, b.sys_type1 = :#{#condition.sysType1} )"+
|
||||
" and if(:#{#condition.isSysType2Empty} , 1=1, b.sys_type2 = :#{#condition.sysType2} )"+
|
||||
" and if(:#{#condition.isSysType3Empty} , 1=1, b.sys_type3 = :#{#condition.sysType3} )"+
|
||||
" order by a.sys_create_time DESC, a.read_flag ASC) as c group by c.id",
|
||||
countQuery = "select count(*) FROM (select c.* from ( select b.*" +
|
||||
" from boe_cases_recommend_push_record a INNER JOIN boe_cases b on a.case_id = b.id " +
|
||||
" from boe_cases_recommend_push_record a left JOIN boe_cases b on a.case_id = b.id " +
|
||||
" where b.deleted=0 and a.push_status = 3 and a.deleted=0 and a.push_user_id= :#{#condition.userId}" +
|
||||
" and if(IFNULL(:#{#condition.keyWord},'')!='',b.title like CONCAT('%',:#{#condition.keyWord},'%')" +
|
||||
" or b.author_name like CONCAT('%',:#{#condition.keyWord},'%')" +
|
||||
@@ -59,6 +61,9 @@ public interface CasesRecordDao extends JpaRepository<Cases, String>, JpaSpecifi
|
||||
" or if(:#{#condition.org2Empty}, 1=1, b.org_domain_parent2 in (:#{#condition.org2}))" +
|
||||
" or if(:#{#condition.org3Empty}, 1=1, b.org_domain_parent3 in (:#{#condition.org3}))" +
|
||||
")" +
|
||||
" and if(:#{#condition.isSysType1Empty} , 1=1, b.sys_type1 = :#{#condition.sysType1} )"+
|
||||
" and if(:#{#condition.isSysType2Empty} , 1=1, b.sys_type2 = :#{#condition.sysType2} )"+
|
||||
" and if(:#{#condition.isSysType3Empty} , 1=1, b.sys_type3 = :#{#condition.sysType3} )"+
|
||||
" order by a.sys_create_time DESC, a.read_flag ASC ) as c group by c.id) as d")
|
||||
Page<Cases> queryList(Pageable pageable, @Param("condition") CasePageVo casePage);
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.xboe.module.boecase.dto;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
@@ -78,6 +79,10 @@ public class CasePageVo extends PageDto {
|
||||
private List<String> org2;
|
||||
private List<String> org3;
|
||||
|
||||
private String sysType1;
|
||||
private String sysType2;
|
||||
private String sysType3;
|
||||
|
||||
public boolean isYearsEmpty() {
|
||||
return CollUtil.isEmpty(this.years);
|
||||
}
|
||||
@@ -98,4 +103,10 @@ public class CasePageVo extends PageDto {
|
||||
return this.isOrg1Empty() && this.isOrg2Empty() && this.isOrg3Empty();
|
||||
}
|
||||
|
||||
public boolean isSysType1Empty(){ return StrUtil.isEmpty(this.sysType1); }
|
||||
|
||||
public boolean isSysType2Empty(){ return StrUtil.isEmpty(this.sysType2); }
|
||||
|
||||
public boolean isSysType3Empty(){ return StrUtil.isEmpty(this.sysType3); }
|
||||
|
||||
}
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
package com.xboe.module.boecase.entity;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
import javax.persistence.*;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.xboe.core.SysConstant;
|
||||
import com.xboe.core.orm.BaseEntity;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Transient;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 案例表
|
||||
* */
|
||||
@@ -102,7 +103,11 @@ public class Cases extends BaseEntity {
|
||||
@Column(name = "favorites", nullable = false)
|
||||
private Integer favorites;
|
||||
|
||||
@Column(name = "recommends", nullable = false)
|
||||
private Long recommends;
|
||||
|
||||
// 推荐量
|
||||
@Column(name = "recommends1", nullable = false)
|
||||
private Long recommends1;
|
||||
|
||||
// 引用量
|
||||
@@ -243,6 +248,16 @@ public class Cases extends BaseEntity {
|
||||
@Column(name = "case_value")
|
||||
private String caseValue;
|
||||
|
||||
// 种类字段1
|
||||
// 暂不上线
|
||||
// @Column(name = "sys_type1")
|
||||
// private String sysType1;
|
||||
//种类字段2
|
||||
// @Column(name = "sys_type2")
|
||||
// private String sysType2;
|
||||
//种类字段3
|
||||
// @Column(name = "sys_type3")
|
||||
// private String sysType3;
|
||||
|
||||
/**
|
||||
* 最佳案例标识
|
||||
@@ -257,6 +272,18 @@ public class Cases extends BaseEntity {
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime excellentTime;
|
||||
|
||||
/**
|
||||
* type 种类
|
||||
* 区分 案例/推荐案例
|
||||
*/
|
||||
@Transient
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
|
||||
|
||||
@Transient
|
||||
private List<String> majorIds;
|
||||
|
||||
@@ -296,6 +323,8 @@ public class Cases extends BaseEntity {
|
||||
public Long getRecommends1() {
|
||||
return recommends1;
|
||||
}
|
||||
|
||||
|
||||
@Transient
|
||||
public void setRecommends1(Long recommends1) {
|
||||
this.recommends1 = recommends1;
|
||||
|
||||
@@ -79,6 +79,26 @@ public class CasesRecommendPushRecord extends BaseEntity {
|
||||
@Column(name = "read_start_time")
|
||||
private Date readStartTime;
|
||||
|
||||
// /**
|
||||
// * sysType1
|
||||
// */
|
||||
// @Column(name = "sys_type1")
|
||||
// private String sysType1;
|
||||
//
|
||||
// /**
|
||||
// * sysType2
|
||||
// */
|
||||
// @Column(name = "sys_type2")
|
||||
// private String sysType2;
|
||||
//
|
||||
// /**
|
||||
// * sysType3
|
||||
// */
|
||||
// @Column(name = "sys_type3")
|
||||
// private String sysType3;
|
||||
|
||||
|
||||
|
||||
// /**
|
||||
// * 最后查看时间
|
||||
// */
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.xboe.module.boecase.service;
|
||||
|
||||
import com.xboe.core.CurrentUser;
|
||||
import com.xboe.module.boecase.entity.Cases;
|
||||
import com.xboe.module.boecase.entity.CasesRecommend;
|
||||
import com.xboe.module.boecase.entity.CasesRecommendPushRecord;
|
||||
import com.xboe.module.boecase.vo.CasesRecommendLaunchVo;
|
||||
@@ -45,10 +46,17 @@ public interface ICasesRecommendPushRecordService {
|
||||
*/
|
||||
boolean startRead(String caseRecommendId);
|
||||
|
||||
boolean update(Cases cases);
|
||||
|
||||
// /**
|
||||
// * 结束读
|
||||
// * @param caseRecommendId
|
||||
// * @return
|
||||
// */
|
||||
// boolean endRead(String caseRecommendId);
|
||||
|
||||
/**
|
||||
* 推荐案例修改
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ import com.xboe.module.boecase.service.ICasesRecommendPushRecordService;
|
||||
import com.xboe.module.boecase.vo.CasesRecommendLaunchVo;
|
||||
import com.xboe.system.user.dao.UserDao;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -225,6 +226,29 @@ public class CasesRecommendPushRecordServiceImpl implements ICasesRecommendPushR
|
||||
.builder()) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean update(Cases cases) {
|
||||
// String sysType1 = "";
|
||||
// String sysType2 = "";
|
||||
// String sysType3 = "";
|
||||
// if(StringUtils.isNotEmpty(cases.getSysType1())){
|
||||
// sysType1 = cases.getSysType1();
|
||||
// }
|
||||
// if(StringUtils.isNotEmpty(cases.getSysType2())){
|
||||
// sysType2 = cases.getSysType2();
|
||||
// }
|
||||
// if(StringUtils.isNotEmpty(cases.getSysType3())){
|
||||
// sysType3 = cases.getSysType3();
|
||||
// }
|
||||
|
||||
// .addUpdateField("sys_type1",sysType1)
|
||||
// .addUpdateField("sys_type2",sysType2)
|
||||
// .addUpdateField("sys_type3",sysType3)
|
||||
return casesRecommendPushRecordDao.update(UpdateBuilder.from(CasesRecommendPushRecord.class)
|
||||
.addFilter(FieldFilters.eq("id",cases.getId())).builder()
|
||||
) > 0;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public boolean endRead(String caseRecommendId) {
|
||||
// CasesRecommendPushRecord casesRecommendPushRecord = casesRecommendPushRecordDao.get(caseRecommendId);
|
||||
|
||||
@@ -276,6 +276,17 @@ public class CasesServiceImpl implements ICasesService {
|
||||
if (StringUtils.isNotBlank(caseVo.getCaseType())) {
|
||||
filters.add(FieldFilters.eq("caseType", caseVo.getCaseType()));
|
||||
}
|
||||
// 新增sysTepe1,sysTepe2,sysTepe3 字段
|
||||
if(StringUtils.isNotBlank(caseVo.getSysType1())){
|
||||
filters.add(FieldFilters.eq("sys_type1", caseVo.getSysType1()));
|
||||
}
|
||||
if(StringUtils.isNotBlank(caseVo.getSysType2())){
|
||||
filters.add(FieldFilters.eq("sys_type2", caseVo.getSysType2()));
|
||||
}
|
||||
if(StringUtils.isNotBlank(caseVo.getSysType3())){
|
||||
filters.add(FieldFilters.eq("sys_type3", caseVo.getSysType3()));
|
||||
}
|
||||
|
||||
if (caseVo.getIsTop() != null && caseVo.getIsTop()) {
|
||||
query.addOrder(OrderCondition.desc("isTop"));
|
||||
query.addOrder(OrderCondition.desc("topTime"));
|
||||
@@ -847,8 +858,8 @@ public class CasesServiceImpl implements ICasesService {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void save(Cases cases) {
|
||||
|
||||
cases.setId(IDGenerator.generate());
|
||||
cases.setIsTop(false);
|
||||
cases.setComments(0);
|
||||
@@ -857,6 +868,7 @@ public class CasesServiceImpl implements ICasesService {
|
||||
cases.setShares(0);
|
||||
cases.setFavorites(0);
|
||||
cases.setCites(0);
|
||||
cases.setRecommends(0L);
|
||||
cases.setRecommends1(0L);
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
List<String> majorIds = cases.getMajorIds();
|
||||
@@ -875,6 +887,7 @@ public class CasesServiceImpl implements ICasesService {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void update(Cases cases) {
|
||||
List<String> majorIds = cases.getMajorIds();
|
||||
List<CasesMajorType> caseId = casesMajorTypeDao.findList(FieldFilters.eq("caseId", cases.getId()));
|
||||
|
||||
@@ -3,7 +3,17 @@ package com.xboe.module.course.api;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
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.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;
|
||||
@@ -29,6 +39,8 @@ import com.xboe.module.course.service.ICourseTeacherService;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping(value="/xboe/m/course/fulltext")
|
||||
@@ -45,6 +57,11 @@ public class CourseFullTextApi extends ApiBaseController{
|
||||
|
||||
@Autowired(required = false)
|
||||
ICourseFullTextSearch fullTextSearch;
|
||||
@Resource
|
||||
IOrganizationService organizationService;
|
||||
|
||||
@Autowired
|
||||
ThirdApi thirdApi;
|
||||
|
||||
/**
|
||||
* 课程的初始化
|
||||
@@ -67,6 +84,8 @@ public class CourseFullTextApi extends ApiBaseController{
|
||||
for(Course c:clist) {
|
||||
CourseFullText cft=CourseToCourseFullText.convert(c);
|
||||
try {
|
||||
//添加创建人Id
|
||||
cft.setSysCreateAid(c.getSysCreateAid());
|
||||
//计算课程时长
|
||||
int duration=ccourseService.sumDurationByCourseId(c.getId());
|
||||
cft.setDuration(duration);
|
||||
@@ -193,7 +212,9 @@ public class CourseFullTextApi extends ApiBaseController{
|
||||
*/
|
||||
@PostMapping("/search")
|
||||
public JsonResponse<PageList<CourseFullText>> search(Pagination pager,CourseQueryDto dto,Integer minDuration,Integer maxDuration){
|
||||
|
||||
//获取例外人员id
|
||||
List<String> userId = thirdApi.getUserId();
|
||||
String userIds = String.join(",", userId);
|
||||
//只是查询已发布的
|
||||
dto.setPublish(true);
|
||||
if(this.fullTextSearch==null) {
|
||||
@@ -214,10 +235,12 @@ public class CourseFullTextApi extends ApiBaseController{
|
||||
paras.setTypes(dto.getTypes());//多个分类的情况
|
||||
//用户的companyId
|
||||
paras.setCompanyId(dto.getCompanyId());
|
||||
//paras.setAudience(dto.getAudiences());
|
||||
if(StringUtils.isNotBlank(dto.getAudiences())) {
|
||||
paras.setAudiences(dto.getAudiences().split(","));
|
||||
}
|
||||
if(StringUtils.isNotBlank(userIds)) {
|
||||
paras.setSysCreateAids(userIds.split(","));
|
||||
}
|
||||
|
||||
paras.setOpenCourse(dto.getOpenCourse());
|
||||
if(StringUtils.isNotBlank(dto.getOrderField())) {
|
||||
|
||||
@@ -305,7 +305,7 @@ public class CoursePortalApi extends ApiBaseController{
|
||||
}
|
||||
|
||||
rs.put("isCrowd",pass);
|
||||
rs.put("contents",cclist);
|
||||
rs.put("contents", cclist);
|
||||
rs.put("sections",sectionlist);
|
||||
rs.put("teachers",teachers);
|
||||
//查询课程
|
||||
|
||||
@@ -119,4 +119,9 @@ public class CourseQueryDto {
|
||||
|
||||
private String refId;
|
||||
private String refType;
|
||||
|
||||
/**
|
||||
* 创建人id
|
||||
*/
|
||||
private String sysCreateAids;
|
||||
}
|
||||
|
||||
@@ -96,8 +96,9 @@ public class PublishCourseUtil {
|
||||
}else {
|
||||
cft.setIsSetAudience(0);//无受众
|
||||
}
|
||||
|
||||
//String fullTextId="";//全文检索返回的id,用于移除时处理
|
||||
// 添加课程创建人Id
|
||||
cft.setSysCreateAid(c.getSysCreateAid());
|
||||
String fullTextId="";//全文检索返回的id,用于移除时处理
|
||||
String newFullId=fullTextSearch.republish(ICourseFullTextSearch.DEFAULT_INDEX_NAME, cft, c.getFullTextId());
|
||||
if(StringUtils.isNotBlank(c.getFullTextId())) {
|
||||
if(StringUtils.isNotBlank(newFullId) && !c.getFullTextId().equals(newFullId)) {
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.xboe.module.dict.entity;
|
||||
|
||||
|
||||
import com.xboe.core.SysConstant;
|
||||
import com.xboe.core.orm.IdEntity;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Table;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Entity
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
@Table(name = "dict")
|
||||
public class DictDto extends IdEntity {
|
||||
|
||||
private Long pid;
|
||||
private String value;
|
||||
|
||||
}
|
||||
@@ -68,6 +68,8 @@ public class TypeApi extends ApiBaseController {
|
||||
if (StringUtil.equals(item.getParentId(), BaseConstant.TREEDATA_ROOT_PARENT_ID)) {
|
||||
TypeVo vo = new TypeVo();
|
||||
BeanUtils.copyProperties(item, vo);
|
||||
vo.setCode(item.getId());
|
||||
vo.setValue(item.getId());
|
||||
ResDataManager rdm = resDataManagerMap.get(vo.getId());
|
||||
if (rdm != null) {
|
||||
User user = userService.get(rdm.getAid());
|
||||
@@ -98,6 +100,8 @@ public class TypeApi extends ApiBaseController {
|
||||
TypeVo vo = new TypeVo();
|
||||
BeanUtils.copyProperties(item, vo);
|
||||
vo.setParentName(typeVo.getName());
|
||||
vo.setCode(item.getId());
|
||||
vo.setValue(item.getId());
|
||||
ResDataManager rdm = resDataManagerMap.get(vo.getId());
|
||||
if (rdm != null) {
|
||||
User user = userService.get(rdm.getAid());
|
||||
|
||||
@@ -31,4 +31,7 @@ public class TypeVo extends Type {
|
||||
* 资源数据管理人员
|
||||
*/
|
||||
private ResDataManager resDataManager;
|
||||
|
||||
private String code;
|
||||
private String value;
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import java.util.Map;
|
||||
|
||||
import javax.transaction.Transactional;
|
||||
|
||||
import com.xboe.school.study.entity.StudyCourse;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -213,6 +214,7 @@ public class StudyServiceImpl implements IStudyService{
|
||||
|
||||
}
|
||||
|
||||
// 更新 前端传输已学习时长
|
||||
@Override
|
||||
@Transactional
|
||||
public void updateLastTime(String studyContentId, int lastStudyTime,String aid) {
|
||||
|
||||
@@ -7,6 +7,7 @@ import java.util.Map;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import cn.hutool.core.util.DesensitizedUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -176,7 +177,10 @@ public class UserApi extends ApiBaseController {
|
||||
User u = service.get(account.getId());
|
||||
user = new UserVo();
|
||||
BeanUtils.copyProperties(u, user);
|
||||
user.setMobileNo(DesensitizedUtil.mobilePhone(user.getMobileNo()));
|
||||
user.setIdNumber("");//去掉返回的用户身份证号信息
|
||||
account.setEmail(DesensitizedUtil.email(account.getEmail()));
|
||||
account.setMobile(DesensitizedUtil.mobilePhone(account.getMobile()));
|
||||
user.setAccount(account);
|
||||
user.setSign(u.getSign());
|
||||
user.setDynamic(u.getDynamic());
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
spring.profiles.active= @profileActive@
|
||||
|
||||
spring.profiles.active=@profileActive@
|
||||
spring.application.name=boe-server-all
|
||||
server.port=9090
|
||||
server.servlet.session.timeout=30m
|
||||
@@ -66,4 +65,6 @@ audience.usersByAudienceList=${boe.domain}/userbasic/audience/memberList
|
||||
#获取用户学习课程数据
|
||||
statApi.userdynamicList=${boe.domain}/statApi/xboe/m/stat/userdynamic/list
|
||||
#用户中心根据组织id查询用户信息接口(递归子组织)
|
||||
audience.getOrgUsers=${boe.domain}/userbasic/user/getOrgUsers
|
||||
audience.getOrgUsers=${boe.domain}/userbasic/user/getOrgUsers
|
||||
#获取工号
|
||||
infrasApi.dict=${boe.domain}/infrasApi/dict/getCourseException
|
||||
@@ -1,36 +1,66 @@
|
||||
package com.xboe.module.boecase.dao;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.xboe.module.boecase.dto.CasePageVo;
|
||||
import com.xboe.module.boecase.entity.Cases;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import com.xboe.module.boecase.service.ICasesService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
@SpringBootTest
|
||||
@ActiveProfiles("dev")
|
||||
class CasesRecordDaoTest {
|
||||
|
||||
@Autowired
|
||||
private CasesRecordDao casesRecordDao;
|
||||
private ICasesService casesService;
|
||||
|
||||
// @Autowired
|
||||
// private CasesApi casesApi;
|
||||
|
||||
|
||||
// @Test
|
||||
void queryList() throws JsonProcessingException {
|
||||
PageRequest of = PageRequest.of(0, 10);
|
||||
String jsonStr = "{\"pageIndex\":1,\"pageSize\":10,\"orderField\":\"excellent\",\"majorType\":\"\",\"orgDomainDtos\":[],\"orderAsc\":false,\"excellent\":true,\"breCommend\":true,\"caseType\":\"\",\"authorName\":\"\",\"notInIds\":[],\"type\":\"recommend\",\"userId\":\"\",\"parent\":\"\",\"children\":[],\"name\":\"\",\"years\":[2023,2022,2020,2021]}";
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES,false);
|
||||
CasePageVo pageVo = mapper.readValue(jsonStr, CasePageVo.class);
|
||||
pageVo.setUserId("965341999643234304");
|
||||
Page<Cases> cases = casesRecordDao.queryList(of, pageVo);
|
||||
System.out.println(cases);
|
||||
}
|
||||
// void queryList() throws JsonProcessingException {
|
||||
// PageRequest of = PageRequest.of(0, 10);
|
||||
// String jsonStr = "{\"pageIndex\":1,\"pageSize\":10,\"orderField\":\"excellent\",\"majorType\":\"\",\"orgDomainDtos\":[],\"orderAsc\":false,\"excellent\":true,\"breCommend\":true,\"caseType\":\"\",\"authorName\":\"\",\"notInIds\":[],\"type\":\"recommend\",\"userId\":\"\",\"parent\":\"\",\"children\":[],\"name\":\"\",\"years\":[2023,2022,2020,2021]}";
|
||||
// ObjectMapper mapper = new ObjectMapper();
|
||||
// mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES,false);
|
||||
// CasePageVo pageVo = mapper.readValue(jsonStr, CasePageVo.class);
|
||||
// pageVo.setUserId("965341999643234304");
|
||||
// Page<Cases> cases = casesRecordDao.queryList(of, pageVo);
|
||||
// System.out.println(cases);
|
||||
// }
|
||||
|
||||
// @Test
|
||||
// void queryListV2() throws JsonProcessingException {
|
||||
// PageRequest of = PageRequest.of(0, 10);
|
||||
//// String jsonStr = "{\"pageIndex\":1,\"pageSize\":10,\"orderField\":\"excellent\",\"majorType\":\"\",\"orgDomainDtos\":[],\"orderAsc\":false,\"excellent\":true,\"breCommend\":true,\"caseType\":\"\",\"authorName\":\"\",\"notInIds\":[],\"type\":\"recommend\",\"userId\":\"\",\"parent\":\"\",\"children\":[],\"name\":\"\",\"years\":[2023,2022,2020,2021]}";
|
||||
//// ObjectMapper mapper = new ObjectMapper();
|
||||
//// mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES,false);
|
||||
//// CasePageVo pageVo = mapper.readValue(jsonStr, CasePageVo.class);
|
||||
// CasePageVo pageVo = new CasePageVo();
|
||||
// pageVo.setPageIndex(1);
|
||||
// pageVo.setPageSize(5);
|
||||
// pageVo.setUserId("965342027497607168");
|
||||
// pageVo.setSysType1("1");
|
||||
//// PageList<Cases> casesPageList = casesService.queryRecommendPageCasesV2(pageVo);
|
||||
//// PageList<Cases> casesPageList = casesService.queryPageCasesV2(pageVo);
|
||||
//// JsonResponse<PageList<Cases>> casesPageList = casesApi.queryCaseBreV2(pageVo);
|
||||
//// System.out.println(casesPageList);
|
||||
// }
|
||||
|
||||
// @Test
|
||||
// public void saveTest(){
|
||||
// Cases cases = new Cases();
|
||||
// cases.setTitle("测试案例分类");
|
||||
// cases.setAuthorName("李玉冰");
|
||||
// cases.setAuthorId("965342027497607168");
|
||||
// cases.setOrgDomainParent("b1c1");
|
||||
// cases.setOrgDomainParent2("a2b2");
|
||||
// cases.setOrgDomainParent3("b1c");
|
||||
// cases.setSysType1("966458733088919552");
|
||||
// cases.setSysType2("966459079181914112");
|
||||
// cases.setSysType3("1060578229055287296");
|
||||
// ArrayList<String> objects = new ArrayList<>();
|
||||
// objects.add("27737267694995164");
|
||||
// cases.setMajorIds(objects);
|
||||
// casesService.save(cases);
|
||||
// }
|
||||
}
|
||||
Reference in New Issue
Block a user