Merge remote-tracking branch 'origin/master'

This commit is contained in:
xiaozhequ
2023-10-19 23:24:29 +08:00
17 changed files with 190 additions and 22 deletions

View File

@@ -30,6 +30,7 @@ public class ThirdApi {
@Value("${orgTree.orgChildTreeList}")
private String orgChildTreeListUrl;
@Value("${audience.usersByAudienceList}")
private String usersByAudienceList;
@@ -60,10 +61,14 @@ public class ThirdApi {
}
return userDao.getListByUserNos(userNo).stream().map(User::getId).collect(Collectors.toList());
}
@Value("${audience.getOrgUsers}")
private String searchOrgUsersUrl;
public List<UserInfoListVo> getAllUserList(UserListParam userListParam, String token) {
log.info("获取用户:url:{}|params:{}|token:{}", searchUserListUrl, JSONUtil.toJsonStr(userListParam), token);
String resp = Optional.ofNullable(HttpRequest.post(searchUserListUrl).body(JSONUtil.toJsonStr(userListParam)).header("token", token).execute().body()).orElseThrow(() -> new RuntimeException("token校验失败"));
log.info("获取用户:url:{}", searchOrgUsersUrl);
log.info("获取用户:params:{}", JSONUtil.toJsonStr(userListParam));
String resp = Optional.ofNullable(HttpRequest.post(searchOrgUsersUrl).body(JSONUtil.toJsonStr(userListParam)).header("token", token).execute().body()).orElseThrow(() -> new RuntimeException("token校验失败"));
UserInfoListRootBean userInfoListRootBean1 = JSONUtil.toBean(resp, UserInfoListRootBean.class);
log.info("userInfoListRootBean1 = " + userInfoListRootBean1);
List<UserInfoListVo> list = userInfoListRootBean1.getResult().getList();
@@ -79,14 +84,14 @@ public class ThirdApi {
private void getAllUserList(UserListParam userListParam, String token, List<UserInfoListVo> userInfoLists) {
log.info("获取用户2");
String resp = Optional.ofNullable(HttpRequest.post(searchUserListUrl).body(JSONUtil.toJsonStr(userListParam)).header("token", token).execute().body()).orElseThrow(() -> new RuntimeException("token校验失败"));
String resp = Optional.ofNullable(HttpRequest.post(searchOrgUsersUrl).body(JSONUtil.toJsonStr(userListParam)).header("token", token).execute().body()).orElseThrow(() -> new RuntimeException("token校验失败"));
log.info("获取用户返回值2 {}",resp);
Opt.ofBlankAble(resp).map(t -> JSONUtil.toBean(t, UserInfoListRootBean.class).success()).map(UserInfoListRootBean::getResult).map(UserInfoListRootBean.ResultData::getList).stream().flatMap(Collection::stream).forEach(userInfoLists::add);
}
private void nextPage(UserListParam userListParam, String token, List<UserInfoListVo> userInfoLists, UserInfoListRootBean.ResultData t) {
log.info("获取用户--" + userListParam.getPageNo());
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();
}

View File

@@ -5,8 +5,10 @@ import lombok.Data;
@Data
public class UserInfoListVo {
private long id;
private String userId;
private String workNum;
private String userName;
/*private long id;
private String bandCode;
private String bandDesc;
private Boolean deleted;
@@ -38,6 +40,6 @@ public class UserInfoListVo {
private String userNo;
private String email;
private String avatar;
private String positionList;
private String positionList;*/
}

View File

@@ -10,6 +10,7 @@ import lombok.*;
public class UserListParam {
private String id;
private String departId;
private String organizationId;
private String userNo;
private String realName;
// @Builder.Default

View File

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

View File

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

View File

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

View File

@@ -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,15 @@ 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 +271,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 +322,8 @@ public class Cases extends BaseEntity {
public Long getRecommends1() {
return recommends1;
}
@Transient
public void setRecommends1(Long recommends1) {
this.recommends1 = recommends1;

View File

@@ -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;
// /**
// * 最后查看时间
// */

View File

@@ -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);
/**
* 推荐案例修改
*/
}

View File

@@ -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;
@@ -82,15 +83,18 @@ public class CasesRecommendPushRecordServiceImpl implements ICasesRecommendPushR
}
// 组织
if (CollectionUtil.isNotEmpty(casesRecommendLaunch.getDeptIds())) {
log.info("--------开始查询组织下用户信息--------- 组织id: {}",casesRecommendLaunch.getDeptIds());
long tt = System.currentTimeMillis();
for (String orgId : casesRecommendLaunch.getDeptIds()) {
UserListParam build = UserListParam.builder().departId(orgId).pageSize(100).build();
// UserListParam build = UserListParam.builder().departId(orgId).pageSize(100).build();
UserListParam build = UserListParam.builder().organizationId(orgId).pageSize(1000).build();
List<UserInfoListVo> allUserList = thirdApi.getAllUserList(build, token);
log.info("---------组织查询到数量 {}", allUserList.size());
log.info("---------组织查询 {}", allUserList);
if (CollectionUtil.isNotEmpty(allUserList)) {
for (UserInfoListVo userInfo : allUserList) {
log.info("---------userInfo.getId() {}", userInfo.getId());
userIds.add(String.valueOf(userInfo.getId()));
log.info("---------userInfo.getId() {}", userInfo.getUserId());
userIds.add(String.valueOf(userInfo.getUserId()));
}
}
}
@@ -222,6 +226,28 @@ 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();
}
return casesRecommendPushRecordDao.update(UpdateBuilder.from(CasesRecommendPushRecord.class)
.addUpdateField("sys_type1",sysType1)
.addUpdateField("sys_type2",sysType2)
.addUpdateField("sys_type3",sysType3)
.addFilter(FieldFilters.eq("id",cases.getId())).builder()
) > 0;
}
// @Override
// public boolean endRead(String caseRecommendId) {
// CasesRecommendPushRecord casesRecommendPushRecord = casesRecommendPushRecordDao.get(caseRecommendId);

View File

@@ -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"));
@@ -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();

View File

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

View File

@@ -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());

View File

@@ -31,4 +31,7 @@ public class TypeVo extends Type {
* 资源数据管理人员
*/
private ResDataManager resDataManager;
private String code;
private String value;
}

View File

@@ -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) {

View File

@@ -78,4 +78,6 @@ xboe.elasticsearch.server.password=Boe@es123
xboe.email.url=https://u-pre.boe.com/api/b1/email/send
xboe.email.from=boeu_learning@boe.com.cn
xboe.email.user=
xboe.email.security=
xboe.email.security=
boe.domain=https://u-pre.boe.com

View File

@@ -1,5 +1,4 @@
spring.profiles.active= test
#@profileActive@
spring.profiles.active=@profileActive@
spring.application.name=boe-server-all
server.port=9090
server.servlet.session.timeout=30m