mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-11 03:46:50 +08:00
Merge remote-tracking branch 'origin/master'
# Conflicts: # servers/boe-server-all/src/main/java/com/xboe/module/boecase/service/ICasesService.java # servers/boe-server-all/src/main/java/com/xboe/module/boecase/service/impl/CasesServiceImpl.java
This commit is contained in:
@@ -0,0 +1,86 @@
|
||||
package com.xboe.api;
|
||||
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import cn.hutool.core.lang.Opt;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.xboe.api.vo.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.ForkJoinPool;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class ThirdApi {
|
||||
|
||||
public static final ForkJoinPool REQUEST_TASK = new ForkJoinPool(100);
|
||||
|
||||
@Value("${orgTree.orgChildTreeList}")
|
||||
private String orgChildTreeListUrl;
|
||||
|
||||
|
||||
@Value("${audience.usersByAudienceList}")
|
||||
private String usersByAudienceList;
|
||||
|
||||
@Value("${userBasic.searchUserList}")
|
||||
private String searchUserListUrl;
|
||||
|
||||
|
||||
public List<UserInfoList> getAllUserList(UserListParam userListParam, String token) {
|
||||
log.info("获取用户");
|
||||
String resp = Optional.ofNullable(HttpRequest.post(searchUserListUrl).body(JSONUtil.toJsonStr(userListParam)).header("token", token).execute().body()).orElseThrow(() -> new RuntimeException("token校验失败"));
|
||||
System.out.println(resp);
|
||||
return Opt.ofBlankAble(resp).map(t -> JSONUtil.toBean(resp, UserInfoListRootBean.class).success())
|
||||
.map(UserInfoListRootBean::getResult)
|
||||
.map(result -> Opt.ofEmptyAble(result.getUserInfoList()).peek(t -> nextPage(userListParam, token, t, result)).orElse(ListUtil.toList()))
|
||||
.orElse(ListUtil.toList());
|
||||
}
|
||||
|
||||
private void getAllUserList(UserListParam userListParam, String token, List<UserInfoList> userInfoLists) {
|
||||
log.info("获取用户2");
|
||||
String resp = Optional.ofNullable(HttpRequest.post(searchUserListUrl).body(JSONUtil.toJsonStr(userListParam)).header("token", token).execute().body()).orElseThrow(() -> new RuntimeException("token校验失败"));
|
||||
System.out.println(resp);
|
||||
Opt.ofBlankAble(resp).map(t -> JSONUtil.toBean(t, UserInfoListRootBean.class).success()).map(UserInfoListRootBean::getResult).map(UserInfoListRootBean.ResultData::getUserInfoList).stream().flatMap(Collection::stream).forEach(userInfoLists::add);
|
||||
}
|
||||
|
||||
|
||||
private void nextPage(UserListParam userListParam, String token, List<UserInfoList> userInfoLists, UserInfoListRootBean.ResultData t) {
|
||||
System.out.println("获取用户--" + userListParam.getPage());
|
||||
if (t.getTotalPage() > userListParam.getPage()) {
|
||||
REQUEST_TASK.submit(() -> IntStream.range(userListParam.getPage(), t.getTotalPage()).parallel().forEach(i -> getAllUserList(userListParam.withPage(i + 1), token, userInfoLists))).join();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public List<OrgRootBean.ResultData> getOrgChildTree(String id, String token) {
|
||||
log.info("getOrgChildTree");
|
||||
String resp = Optional.ofNullable(HttpRequest.post(orgChildTreeListUrl).header("token", token).body(JSONUtil.toJsonStr(TreeSearchVo.builder().orgId(id).build())).execute().body()).orElseThrow(() -> new RuntimeException("token校验失败"));
|
||||
return Opt.ofNullable(JSONUtil.toBean(resp, OrgRootBean.class).success()).map(OrgRootBean::getResult).orElse(ListUtil.empty());
|
||||
}
|
||||
|
||||
public List<AuditList> getAllAudienceList(AuditListParam userListParam, String token) {
|
||||
String resp = Optional.ofNullable(HttpRequest.post(usersByAudienceList).body(JSONUtil.toJsonStr(userListParam)).header("token", token).execute().body()).orElseThrow(() -> new RuntimeException("token校验失败"));
|
||||
return Opt.ofBlankAble(resp).map(t -> JSONUtil.toBean(resp, AuditRootBean.class).success())
|
||||
.map(AuditRootBean::getResult)
|
||||
.map(result -> Opt.ofEmptyAble(result.getList()).peek(t -> nextPage(userListParam, t, result, token)).orElse(ListUtil.toList()))
|
||||
.orElse(ListUtil.toList());
|
||||
}
|
||||
|
||||
private void nextPage(AuditListParam userListParam, List<AuditList> t, Result result, String token) {
|
||||
if (result.getTotalPage() > userListParam.getPage()) {
|
||||
REQUEST_TASK.submit(() -> IntStream.range(userListParam.getPage(), result.getTotalPage()).parallel().forEach(i -> getAllAudienceList(userListParam.withPage(i + 1), t, token))).join();
|
||||
}
|
||||
}
|
||||
|
||||
private void getAllAudienceList(AuditListParam userListParam, List<AuditList> list, String token) {
|
||||
String resp = Optional.ofNullable(HttpRequest.post(usersByAudienceList).body(JSONUtil.toJsonStr(userListParam)).header("token", token).execute().body()).orElseThrow(() -> new RuntimeException("token校验失败"));
|
||||
Opt.ofBlankAble(resp).map(t -> JSONUtil.toBean(t, AuditRootBean.class).success()).map(AuditRootBean::getResult).map(Result::getList).stream().flatMap(Collection::stream).forEach(list::add);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.xboe.api.vo; /**
|
||||
* Copyright 2022 bejson.com
|
||||
*/
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* Auto-generated: 2022-12-10 14:3:18
|
||||
*
|
||||
* @author bejson.com (i@bejson.com)
|
||||
* @website http://www.bejson.com/java2pojo/
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class AuditList {
|
||||
private long audienceId;
|
||||
private long userId;
|
||||
private long id;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.xboe.api.vo;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@With
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class AuditListParam implements Cloneable {
|
||||
private String audienceId;
|
||||
private Integer page;
|
||||
private Integer pageSize;
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.xboe.api.vo; /**
|
||||
* Copyright 2022 bejson.com
|
||||
*/
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Auto-generated: 2022-12-10 14:3:18
|
||||
*
|
||||
* @author bejson.com (i@bejson.com)
|
||||
* @website http://www.bejson.com/java2pojo/
|
||||
*/
|
||||
@Data
|
||||
@Slf4j
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class AuditRootBean {
|
||||
|
||||
private String error;
|
||||
private String message;
|
||||
private String permissions;
|
||||
private Result result;
|
||||
private int status;
|
||||
private Date timestamp;
|
||||
|
||||
public AuditRootBean success() {
|
||||
if (this.status != 200) {
|
||||
log.error("获取受众列表失败----{}", JSONUtil.toJsonPrettyStr(this));
|
||||
return null;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.xboe.api.vo;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Slf4j
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class OrgRootBean {
|
||||
|
||||
private String error;
|
||||
private String message;
|
||||
private String permissions;
|
||||
private List<ResultData> result;
|
||||
private int status;
|
||||
private Date timestamp;
|
||||
|
||||
public OrgRootBean success() {
|
||||
if (this.status != 200) {
|
||||
log.error("获取组织列表失败----{}", JSONUtil.toJsonPrettyStr(this));
|
||||
return null;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class ResultData {
|
||||
|
||||
private String id;
|
||||
private String parentId;
|
||||
private String oldKid;
|
||||
private String oldParentId;
|
||||
private String name;
|
||||
private String code;
|
||||
private String namePath;
|
||||
private int level;
|
||||
private int status;
|
||||
private String description;
|
||||
private boolean isMakeOrg;
|
||||
private boolean isServiceSite;
|
||||
private String managerId;
|
||||
private String hrbpId;
|
||||
private Date createTime;
|
||||
private String createBy;
|
||||
private String oldOrgId;
|
||||
private String oldOrgParentId;
|
||||
private String companyId;
|
||||
private String sassId;
|
||||
private String orgRepository;
|
||||
private String orgFactory;
|
||||
private String directChildList;
|
||||
private List<Result> treeChildList;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.xboe.api.vo; /**
|
||||
* Copyright 2022 bejson.com
|
||||
*/
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Auto-generated: 2022-12-10 14:3:18
|
||||
*
|
||||
* @author bejson.com (i@bejson.com)
|
||||
* @website http://www.bejson.com/java2pojo/
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class Result {
|
||||
|
||||
private int totalElement;
|
||||
private int totalPage;
|
||||
private List<AuditList> list;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.xboe.api.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class TreeSearchVo {
|
||||
private String keyword;
|
||||
private String orgId;
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.xboe.api.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class UserInfoList {
|
||||
|
||||
private long id;
|
||||
private String bandCode;
|
||||
private String bandDesc;
|
||||
private Boolean deleted;
|
||||
private Long departId;
|
||||
private String description;
|
||||
private String domainId;
|
||||
private String departName;
|
||||
private String duty;
|
||||
private int employeeStatus;
|
||||
private String companyId;
|
||||
private String orgName;
|
||||
private Integer gender;
|
||||
private String jobName;
|
||||
private String kid;
|
||||
private int learningDuration;
|
||||
private String mobile;
|
||||
private String realName;
|
||||
private String oldDepartId;
|
||||
private String orgNamePath;
|
||||
private String orgTreeType;
|
||||
private String payrollPlaceId;
|
||||
private String payrollPlaceName;
|
||||
private long personId;
|
||||
private String positionMgrLevel;
|
||||
private String rank;
|
||||
private long sassId;
|
||||
private int status;
|
||||
private String telephoneNo;
|
||||
private String userNo;
|
||||
private String email;
|
||||
private String avatar;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.xboe.api.vo;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Slf4j
|
||||
public class UserInfoListRootBean {
|
||||
|
||||
private String error;
|
||||
private String message;
|
||||
private String permissions;
|
||||
private ResultData result;
|
||||
private int status;
|
||||
private Date timestamp;
|
||||
|
||||
public UserInfoListRootBean success() {
|
||||
if (this.status != 200) {
|
||||
log.error("获取学员列表失败----{}", JSONUtil.toJsonPrettyStr(this));
|
||||
return null;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class ResultData {
|
||||
|
||||
private int totalElement;
|
||||
private int totalPage;
|
||||
private List<UserInfoList> userInfoList;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.xboe.api.vo;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@With
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class UserListParam {
|
||||
private String id;
|
||||
private String departId;
|
||||
private String userNo;
|
||||
private String realName;
|
||||
@Builder.Default
|
||||
private int page = 1;
|
||||
@Builder.Default
|
||||
private int pageSize = 10;
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.xboe.module.boecase.api;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import com.xboe.common.PageList;
|
||||
import com.xboe.common.Pagination;
|
||||
import com.xboe.common.utils.StringUtil;
|
||||
@@ -217,6 +218,35 @@ public class CasesApi extends ApiBaseController {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导出案例标题数据
|
||||
* */
|
||||
@PostMapping("/exportCaseTitle")
|
||||
public void exportCaseTitle(CaseVo caseVo,HttpServletResponse response){
|
||||
OutputStream outputStream;
|
||||
try {
|
||||
outputStream = response.getOutputStream();
|
||||
LinkedHashMap<String,String> map = new LinkedHashMap<>();
|
||||
map.put("标题","title");
|
||||
List<Cases> list = casesService.managerCaseTitleList(caseVo);
|
||||
List<CaseExportVo> exportVos = new ArrayList<>();
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
for (Cases c:list){
|
||||
CaseExportVo caseExportVo = new CaseExportVo();
|
||||
caseExportVo.setTitle(c.getTitle());
|
||||
exportVos.add(caseExportVo);
|
||||
}
|
||||
|
||||
response.setContentType("application/octet-stream");
|
||||
String current = LocalDateTimeUtil.format(now,"yyyyMMddHHmmss");
|
||||
response.setHeader("Content-disposition", "attachment;filename=cases-title-"+current+".xls");
|
||||
ExportsExcelSenderUtil.export(map,exportVos, outputStream,"yyyy-MM-dd HH:mm:ss");
|
||||
}catch (Exception e){
|
||||
log.error("导出失败",e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出我的案例
|
||||
* */
|
||||
|
||||
@@ -32,6 +32,7 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.OutputStream;
|
||||
import java.util.ArrayList;
|
||||
@@ -171,6 +172,11 @@ public class CasesRecommendApi extends ApiBaseController {
|
||||
|
||||
}
|
||||
|
||||
@GetMapping("/startRead")
|
||||
public JsonResponse<Boolean> startRead(String caseRecommendId) {
|
||||
return success(iCasesRecommendPushRecordService.startRead(caseRecommendId));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 发起推送
|
||||
@@ -179,7 +185,7 @@ public class CasesRecommendApi extends ApiBaseController {
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/launch")
|
||||
public JsonResponse<Boolean> excelImport(@RequestBody CasesRecommendLaunchVo casesRecommendLaunch) {
|
||||
public JsonResponse<Boolean> launch(@RequestBody CasesRecommendLaunchVo casesRecommendLaunch, HttpServletRequest request) {
|
||||
if (!CasesRecommendLaunchTypeEnum.COMMON.getLaunchType().equals(casesRecommendLaunch.getLaunchType()) && !CasesRecommendLaunchTypeEnum.IMPORT.getLaunchType().equals(casesRecommendLaunch.getLaunchType())) {
|
||||
throw new RuntimeException("参数错误");
|
||||
}
|
||||
@@ -188,10 +194,12 @@ public class CasesRecommendApi extends ApiBaseController {
|
||||
} else if (CasesRecommendLaunchTypeEnum.IMPORT.getLaunchType().equals(casesRecommendLaunch.getLaunchType()) && StrUtil.isEmpty(casesRecommendLaunch.getImportId())) {
|
||||
throw new RuntimeException("导入id不能为空");
|
||||
}
|
||||
if (CollectionUtil.isEmpty(casesRecommendLaunch.getPushUserIdList())) {
|
||||
throw new RuntimeException("参数错误");
|
||||
String token = request.getHeader("Xboe-Access-Token");
|
||||
if (StringUtils.isEmpty(token)) {
|
||||
token = request.getHeader("token");
|
||||
}
|
||||
return success(iCasesRecommendPushRecordService.launchPush(casesRecommendLaunch, getCurrent()));
|
||||
|
||||
return success(iCasesRecommendPushRecordService.launchPush(casesRecommendLaunch, getCurrent(), token));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -18,43 +18,37 @@ import org.springframework.stereotype.Repository;
|
||||
@Repository
|
||||
public interface CasesRecordDao extends JpaRepository<Cases, String>, JpaSpecificationExecutor<Cases> {
|
||||
|
||||
@Query(nativeQuery = true, value = "select b.id,b.sys_create_aid,b.sys_create_by,b.sys_create_time,b.deleted,b.sys_update_by,b.sys_update_time,b.sys_version," +
|
||||
"b.excellent_time,b.excellent,b.case_value,b.readers,b.keyword5,b.keyword4,b.keyword3,b.keyword2,b.keyword1,b.case_theme_description,b.case_theme" +
|
||||
",b.case_type2,b.case_type1,b.case_type,b.case_owner_org,b.case_specialty_sequence,b.case_other_contributor,b.case_owner_phone,b.case_owner_department" +
|
||||
",b.case_owner,b.case_flow,b.case_scope,b.is_leadership_plan,b.case_channel,b.email,b.contact_number,b.department,b.drafter,b.end_time,b.drafting_time," +
|
||||
"b.confidentiality_level,b.approval_number,b.major_type,b.org_domain_parent3,b.org_domain_parent2,b.org_domain_parent,b.org_domain,b.summary,b.cites,b.recommends," +
|
||||
"b.favorites,b.shares,b.praises,b.comments,b.views,b.status,b.top_time,b.is_top,b.recommend_time,b.bre_commend,b.cover_url,b.author_name,b.author_id,b.file_name" +
|
||||
",b.file_path,b.content,b.company_id,b.title" +
|
||||
" from boe_cases_recommend_push_record a LEFT JOIN boe_cases b on a.case_id = b.id and b.deleted=0 " +
|
||||
" where a.deleted=0 and a.push_user_id= :#{#condition.userId}" +
|
||||
" and if(:#{#condition.keyWord} is not null,b.title like CONCAT('%',:#{#condition.keyWord},'%')" +
|
||||
@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" +
|
||||
" where b.deleted=0 and a.push_status = 3 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},'%')" +
|
||||
" or b.keyword1 like CONCAT('%',:#{#condition.keyWord},'%')" +
|
||||
" or b.keyword2 like CONCAT('%',:#{#condition.keyWord},'%')" +
|
||||
" or b.keyword3 like CONCAT('%',:#{#condition.keyWord},'%')" +
|
||||
" or b.keyword4 like CONCAT('%',:#{#condition.keyWord},'%')" +
|
||||
" or b.keyword5 like CONCAT('%',:#{#condition.keyWord},'%'),1=1)" +
|
||||
" and if(coalesce(:#{#condition.years},null) is null OR YEAR(b.sys_create_time) in (:#{#condition.years}))" +
|
||||
" and if(:#{#condition.majorType} !='' ,b.major_type = :#{#condition.majorType},1=1) " +
|
||||
" and if(:#{#condition.yearsEmpty},1=1, YEAR(b.sys_create_time) in (:#{#condition.years}))" +
|
||||
" and if(IFNULL(:#{#condition.majorType},'') !='',b.major_type = :#{#condition.majorType},1=1) " +
|
||||
" and if(:#{#condition.org1Empty}, 1=1, b.org_domain_parent in (:#{#condition.org1}))" +
|
||||
" and if(:#{#condition.org2Empty}, 1=1, b.org_domain_parent2 in (:#{#condition.org2}))" +
|
||||
" and if(:#{#condition.org3Empty}, 1=1, b.org_domain_parent3 in (:#{#condition.org3}))" +
|
||||
" group by b.id order by a.sys_create_time DESC",
|
||||
countQuery = "select count(*)" +
|
||||
" from boe_cases_recommend_push_record a LEFT JOIN boe_cases b on a.case_id = b.id and b.deleted=0 " +
|
||||
" where a.deleted=0 and a.push_user_id= :#{#condition.userId}" +
|
||||
" and if(:#{#condition.keyWord} is not null,b.title like CONCAT('%',:#{#condition.keyWord},'%')" +
|
||||
" 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 " +
|
||||
" where b.deleted=0 and a.push_status = 3 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},'%')" +
|
||||
" or b.keyword1 like CONCAT('%',:#{#condition.keyWord},'%')" +
|
||||
" or b.keyword2 like CONCAT('%',:#{#condition.keyWord},'%')" +
|
||||
" or b.keyword3 like CONCAT('%',:#{#condition.keyWord},'%')" +
|
||||
" or b.keyword4 like CONCAT('%',:#{#condition.keyWord},'%')" +
|
||||
" or b.keyword5 like CONCAT('%',:#{#condition.keyWord},'%'),1=1)" +
|
||||
" and :#{#condition.yearsEmpty} = false OR YEAR(b.sys_create_time) in (:#{#condition.years})" +
|
||||
" and if(:#{#condition.majorType} !='' ,b.major_type = :#{#condition.majorType},1=1) " +
|
||||
" and if(:#{#condition.yearsEmpty},1=1, YEAR(b.sys_create_time) in (:#{#condition.years}))" +
|
||||
" and if(IFNULL(:#{#condition.majorType},'') !='' ,b.major_type = :#{#condition.majorType},1=1) " +
|
||||
" and if(:#{#condition.org1Empty}, 1=1, b.org_domain_parent in (:#{#condition.org1}))" +
|
||||
" and if(:#{#condition.org2Empty}, 1=1, b.org_domain_parent2 in (:#{#condition.org2}))" +
|
||||
" and if(:#{#condition.org3Empty}, 1=1, b.org_domain_parent3 in (:#{#condition.org3}))" +
|
||||
" group by b.id")
|
||||
" 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);
|
||||
}
|
||||
|
||||
@@ -267,6 +267,32 @@ public class Cases extends BaseEntity {
|
||||
@Transient
|
||||
private String recommendOrgName;
|
||||
|
||||
@Transient
|
||||
private Long recommendId;
|
||||
|
||||
public Long getRecommendId() {
|
||||
return recommendId;
|
||||
}
|
||||
|
||||
public void setRecommendId(Long recommendId) {
|
||||
this.recommendId = recommendId;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public Cases() {
|
||||
|
||||
@@ -335,4 +361,8 @@ public class Cases extends BaseEntity {
|
||||
this.favorites=favorites;
|
||||
super.setDeleted(deleted);
|
||||
}
|
||||
|
||||
public Cases(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.xboe.module.boecase.service;
|
||||
|
||||
import com.xboe.core.CurrentUser;
|
||||
import com.xboe.module.boecase.entity.CasesRecommend;
|
||||
import com.xboe.module.boecase.entity.CasesRecommendPushRecord;
|
||||
import com.xboe.module.boecase.vo.CasesRecommendLaunchVo;
|
||||
|
||||
@@ -15,10 +16,11 @@ public interface ICasesRecommendPushRecordService {
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
boolean launchPush(CasesRecommendLaunchVo casesRecommendLaunch, CurrentUser currentUser);
|
||||
boolean launchPush(CasesRecommendLaunchVo casesRecommendLaunch, CurrentUser currentUser, String token);
|
||||
|
||||
/**
|
||||
* 根据案例推荐ID查询案例推送列表信息
|
||||
*
|
||||
* @param recommendId
|
||||
* @return
|
||||
*/
|
||||
@@ -26,8 +28,17 @@ public interface ICasesRecommendPushRecordService {
|
||||
|
||||
/**
|
||||
* 重新推送或撤回
|
||||
* @param isWithdraw 是否撤回
|
||||
* @param casesRecommendId 案例推荐ID
|
||||
*
|
||||
* @param isWithdraw 是否撤回
|
||||
* @param casesRecommend 案例推荐
|
||||
*/
|
||||
void rePushOrWithdraw(boolean isWithdraw, String casesRecommendId);
|
||||
void rePushOrWithdraw(boolean isWithdraw, CasesRecommend casesRecommend);
|
||||
|
||||
/**
|
||||
* 开始读
|
||||
*
|
||||
* @param caseRecommendId
|
||||
* @return
|
||||
*/
|
||||
boolean startRead(String caseRecommendId);
|
||||
}
|
||||
|
||||
@@ -24,6 +24,8 @@ public interface ICasesService{
|
||||
|
||||
List<Cases> exportCase(CaseVo caseVo);
|
||||
|
||||
List<Cases> managerCaseTitleList(CaseVo caseVo);
|
||||
|
||||
/**
|
||||
* 案例分页
|
||||
* */
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
package com.xboe.module.boecase.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.xboe.api.ThirdApi;
|
||||
import com.xboe.api.vo.*;
|
||||
import com.xboe.core.CurrentUser;
|
||||
import com.xboe.core.event.IEventDataSender;
|
||||
import com.xboe.core.orm.FieldFilters;
|
||||
@@ -18,11 +21,13 @@ import com.xboe.module.boecase.entity.CasesRecommendLaunchImportData;
|
||||
import com.xboe.module.boecase.entity.CasesRecommendPushRecord;
|
||||
import com.xboe.module.boecase.service.ICasesRecommendPushRecordService;
|
||||
import com.xboe.module.boecase.vo.CasesRecommendLaunchVo;
|
||||
import com.xboe.system.user.dao.MessageDao;
|
||||
import com.xboe.system.user.dao.UserDao;
|
||||
import com.xboe.system.user.entity.Message;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@@ -58,25 +63,23 @@ public class CasesRecommendPushRecordServiceImpl implements ICasesRecommendPushR
|
||||
@Resource
|
||||
private CasesRecommendPushRecordDao casesRecommendPushRecordDao;
|
||||
|
||||
@Resource
|
||||
private MessageDao messageDao;
|
||||
|
||||
|
||||
@Autowired(required = false)
|
||||
private IEventDataSender eventDataSender;
|
||||
|
||||
@Resource
|
||||
private ThirdApi thirdApi;
|
||||
|
||||
@Value("${xboe.old.base.url}")
|
||||
private String domain;
|
||||
|
||||
@Override
|
||||
public boolean launchPush(CasesRecommendLaunchVo casesRecommendLaunch, CurrentUser currentUser) {
|
||||
public boolean launchPush(CasesRecommendLaunchVo casesRecommendLaunch, CurrentUser currentUser, String token) {
|
||||
|
||||
|
||||
CasesRecommend casesRecommend = new CasesRecommend();
|
||||
casesRecommend.setRecommendId(currentUser.getAccountId());
|
||||
casesRecommend.setRecommendBy(currentUser.getName());
|
||||
casesRecommend.setRecommendTime(LocalDateTime.now());
|
||||
casesRecommend.setCaseCount(casesRecommendLaunch.getCasesIdList().size());
|
||||
casesRecommend.setUserCount(casesRecommendLaunch.getPushUserIdList().size());
|
||||
casesRecommend.setRecommendOrgName(casesRecommendLaunch.getRecommendOrgName());
|
||||
casesRecommend.setPushProgress(CasesPushStatusEnum.WAIT_PUSH.getStatus());
|
||||
casesRecommendDao.save(casesRecommend);
|
||||
log.info("案例推送对象 {}", JSONUtil.toJsonStr(casesRecommend));
|
||||
|
||||
List<String> caseIds = new ArrayList<>();
|
||||
if (casesRecommendLaunch.getLaunchType() == 1) {
|
||||
caseIds.addAll(casesRecommendLaunch.getCasesIdList());
|
||||
@@ -85,12 +88,57 @@ public class CasesRecommendPushRecordServiceImpl implements ICasesRecommendPushR
|
||||
List<String> caseIdList = importDataList.stream().filter(casesRecommendLaunchImportData -> casesRecommendLaunchImportData.getStatus() == 1).map(CasesRecommendLaunchImportData::getCaseId).collect(Collectors.toList());
|
||||
caseIds.addAll(caseIdList);
|
||||
}
|
||||
List<String> userIds = new ArrayList<>();
|
||||
if (CollectionUtil.isNotEmpty(casesRecommendLaunch.getPushUserIdList())) {
|
||||
userIds.addAll(casesRecommendLaunch.getPushUserIdList());
|
||||
}
|
||||
// 组织
|
||||
if (CollectionUtil.isNotEmpty(casesRecommendLaunch.getDeptIds())) {
|
||||
for (String orgId : casesRecommendLaunch.getDeptIds()) {
|
||||
List<OrgRootBean.ResultData> orgChildTree = thirdApi.getOrgChildTree(orgId, token);
|
||||
if (CollectionUtil.isNotEmpty(orgChildTree)) {
|
||||
for (OrgRootBean.ResultData result : orgChildTree) {
|
||||
UserListParam build = UserListParam.builder().departId(result.getId()).pageSize(100).build();
|
||||
List<UserInfoList> allUserList = thirdApi.getAllUserList(build, token);
|
||||
if (CollectionUtil.isNotEmpty(allUserList)) {
|
||||
for (UserInfoList userInfo : allUserList) {
|
||||
userIds.add(String.valueOf(userInfo.getId()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 受众关联
|
||||
if (CollectionUtil.isNotEmpty(casesRecommendLaunch.getGroupIds())) {
|
||||
for (String groupId : casesRecommendLaunch.getGroupIds()) {
|
||||
List<AuditList> allAudienceList = thirdApi.getAllAudienceList(AuditListParam.builder().audienceId(groupId).pageSize(100).page(1).build(), token);
|
||||
if (CollectionUtil.isNotEmpty(allAudienceList)) {
|
||||
allAudienceList.forEach(auditList -> userIds.add(String.valueOf(auditList.getUserId())));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (CollectionUtil.isEmpty(userIds)) {
|
||||
throw new RuntimeException("推荐人不能为空");
|
||||
}
|
||||
|
||||
CasesRecommend casesRecommend = new CasesRecommend();
|
||||
casesRecommend.setRecommendId(currentUser.getAccountId());
|
||||
casesRecommend.setRecommendBy(currentUser.getName());
|
||||
casesRecommend.setRecommendTime(LocalDateTime.now());
|
||||
casesRecommend.setCaseCount(caseIds.size());
|
||||
casesRecommend.setUserCount(userIds.size());
|
||||
casesRecommend.setRecommendOrgName(casesRecommendLaunch.getRecommendOrgName());
|
||||
casesRecommend.setPushProgress(CasesPushStatusEnum.WAIT_PUSH.getStatus());
|
||||
casesRecommendDao.save(casesRecommend);
|
||||
log.info("案例推送对象 {}", JSONUtil.toJsonStr(casesRecommend));
|
||||
|
||||
|
||||
for (String caseId : caseIds) {
|
||||
Cases cases = casesDao.get(caseId);
|
||||
List<CasesRecommendPushRecord> pushRecords = new ArrayList<>();
|
||||
Map<String, Object> userMap = userDao.findMap("id", "name", FieldFilters.in("id", casesRecommendLaunch.getPushUserIdList()));
|
||||
|
||||
for (String userId : casesRecommendLaunch.getPushUserIdList()) {
|
||||
Map<String, Object> userMap = userDao.findMap("id", "name", FieldFilters.in("id", userIds));
|
||||
for (String userId : userIds) {
|
||||
CasesRecommendPushRecord casesRecommendPushRecord = new CasesRecommendPushRecord();
|
||||
casesRecommendPushRecord.setRecommendId(casesRecommend.getId());
|
||||
casesRecommendPushRecord.setCaseId(caseId);
|
||||
@@ -129,7 +177,9 @@ public class CasesRecommendPushRecordServiceImpl implements ICasesRecommendPushR
|
||||
private void sendCasesRecommend(CasesRecommend casesRecommend) {
|
||||
List<Integer> pushStatusList = new ArrayList<>();
|
||||
pushStatusList.add(CasesPushStatusEnum.WAIT_PUSH.getStatus());
|
||||
List<CasesRecommendPushRecord> casesRecommendPushRecords = casesRecommendPushRecordDao.getGenericDao().findList(CasesRecommendPushRecord.class, FieldFilters.in("pushStatus", pushStatusList));
|
||||
pushStatusList.add(CasesPushStatusEnum.PUSH_REVOKE.getStatus());
|
||||
List<CasesRecommendPushRecord> casesRecommendPushRecords = casesRecommendPushRecordDao.getGenericDao()
|
||||
.findList(CasesRecommendPushRecord.class, FieldFilters.in("pushStatus", pushStatusList), FieldFilters.eqField("recommendId", casesRecommend.getId()));
|
||||
if (CollectionUtils.isEmpty(casesRecommendPushRecords)) {
|
||||
//修改为推送完成 --- 无数据 无需推送
|
||||
updateProcessStatus(casesRecommend.getId(), CasesPushStatusEnum.PUSH_SUCCESS.getStatus());
|
||||
@@ -143,9 +193,27 @@ public class CasesRecommendPushRecordServiceImpl implements ICasesRecommendPushR
|
||||
Integer pushStatus;
|
||||
try {
|
||||
|
||||
eventDataSender.send("案例推荐", "recommendCases", "案例推荐【" + casesRecommendPushRecord.getCaseTitle() + "】",
|
||||
casesRecommendPushRecord.getCaseId(), "99", casesRecommendPushRecord.getCaseTitle(),
|
||||
casesRecommendPushRecord.getSysCreateAid(), casesRecommendPushRecord.getSysCreateBy(), "");
|
||||
Message message = new Message();
|
||||
message.setMsgType(1);
|
||||
message.setAcceptId(casesRecommendPushRecord.getPushUserId());
|
||||
message.setAcceptName(casesRecommendPushRecord.getPushUserName());
|
||||
message.setContent("案例推荐《" + casesRecommendPushRecord.getCaseTitle() + "》");
|
||||
message.setIsRead(false);
|
||||
message.setMsgTime(LocalDateTime.now());
|
||||
message.setRefId(casesRecommendPushRecord.getId());
|
||||
message.setRefType("99");
|
||||
message.setSendName(casesRecommendPushRecord.getSysCreateBy());
|
||||
message.setSendType(1);
|
||||
message.setTitle("案例推荐");
|
||||
message.setSendAid(casesRecommendPushRecord.getSysCreateAid());
|
||||
message.setSource(1);
|
||||
message.setPageUrl(domain + "/pc/case/detail?id=" + casesRecommendPushRecord.getCaseId());
|
||||
message.setPageParams(casesRecommendPushRecord.getCaseId());
|
||||
message.setPageType(3);
|
||||
messageDao.save(message);
|
||||
// eventDataSender.send("案例推荐", "recommendCases", "案例推荐【" + casesRecommendPushRecord.getCaseTitle() + "】",
|
||||
// casesRecommendPushRecord.getCaseId(), "99", casesRecommendPushRecord.getCaseTitle(),
|
||||
// casesRecommendPushRecord.getSysCreateAid(), casesRecommendPushRecord.getSysCreateBy(), "");
|
||||
|
||||
pushStatus = CasesPushStatusEnum.PUSH_SUCCESS.getStatus();
|
||||
} catch (Exception e) {
|
||||
@@ -167,22 +235,34 @@ public class CasesRecommendPushRecordServiceImpl implements ICasesRecommendPushR
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rePushOrWithdraw(boolean isWithdraw, String casesRecommendId) {
|
||||
if (StringUtils.isEmpty(casesRecommendId)) {
|
||||
public void rePushOrWithdraw(boolean isWithdraw, CasesRecommend casesRecommend) {
|
||||
if (ObjectUtil.isEmpty(casesRecommend)) {
|
||||
throw new RuntimeException("缺少必要参数");
|
||||
}
|
||||
List<CasesRecommendPushRecord> recordList = findAllByRecommendId(casesRecommendId);
|
||||
if (isWithdraw) {
|
||||
List<CasesRecommendPushRecord> recordList = findAllByRecommendId(casesRecommend.getId());
|
||||
recordList.stream().forEach(record ->
|
||||
record.setPushStatus(CasesPushStatusEnum.PUSH_REVOKE.getStatus())
|
||||
);
|
||||
if (CollectionUtil.isNotEmpty(recordList)) {
|
||||
casesRecommendPushRecordDao.saveList(recordList);
|
||||
}
|
||||
} else {
|
||||
recordList.stream().filter(it -> CasesPushStatusEnum.PUSH_SUCCESS.getStatus() != it.getPushStatus()).forEach(record ->
|
||||
record.setPushStatus(CasesPushStatusEnum.WAIT_PUSH.getStatus())
|
||||
);
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(recordList)) {
|
||||
casesRecommendPushRecordDao.saveList(recordList);
|
||||
try {
|
||||
//发送推送案例消息
|
||||
sendCasesRecommend(casesRecommend);
|
||||
} catch (Exception e) {
|
||||
log.error("推送失败", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean startRead(String caseRecommendId) {
|
||||
return casesRecommendPushRecordDao.update(UpdateBuilder.from(CasesRecommendPushRecord.class)
|
||||
.addUpdateField("readFlag", 1)
|
||||
.addUpdateField("readStartTime", new Date())
|
||||
.addFilter(FieldFilters.eq("id", caseRecommendId))
|
||||
.builder()) > 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,14 +66,13 @@ public class CasesRecommendServiceImpl implements ICasesRecommendService {
|
||||
|| CasesPushStatusEnum.PUSH_ING.getStatus().equals(db.getPushProgress())
|
||||
){
|
||||
// 当为推送成功时为
|
||||
iCasesRecommendPushRecordService.rePushOrWithdraw(true, casesRecommendPushVo.getCasesRecommendId());
|
||||
iCasesRecommendPushRecordService.rePushOrWithdraw(true, db);
|
||||
db.setPushProgress(CasesPushStatusEnum.PUSH_REVOKE.getStatus());
|
||||
casesRecommendDao.update(db);
|
||||
}else if (CasesPushStatusEnum.PUSH_FAIL.getStatus().equals(db.getPushProgress())
|
||||
|| CasesPushStatusEnum.PUSH_REVOKE.getStatus().equals(db.getPushProgress())){
|
||||
// 推送失败或者已撤回时
|
||||
iCasesRecommendPushRecordService.rePushOrWithdraw(false, casesRecommendPushVo.getCasesRecommendId());
|
||||
db.setPushProgress(CasesPushStatusEnum.WAIT_PUSH.getStatus());
|
||||
iCasesRecommendPushRecordService.rePushOrWithdraw(false, db);
|
||||
}
|
||||
casesRecommendDao.update(db);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -503,6 +503,42 @@ public class CasesServiceImpl implements ICasesService {
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Cases> managerCaseTitleList(CaseVo caseVo) {
|
||||
QueryBuilder query = QueryBuilder.from(Cases.class);
|
||||
query.addFilter(FieldFilters.eq("deleted", false));
|
||||
if (StringUtils.isNotBlank(caseVo.getKeyWord())) {
|
||||
query.addFilter(FieldFilters.like("title", LikeMatchMode.ANYWHERE, caseVo.getKeyWord()));
|
||||
}
|
||||
if (StringUtils.isNotBlank(caseVo.getOrgDomain())) {
|
||||
query.addFilter(FieldFilters.eq("orgDomainParent", caseVo.getOrgDomain()));
|
||||
}
|
||||
if (caseVo.getExcellent() != null) {
|
||||
query.addFilter(FieldFilters.eq("excellent", caseVo.getExcellent()));
|
||||
}
|
||||
if (caseVo.getIsTop() != null) {
|
||||
query.addFilter(FieldFilters.eq("isTop", caseVo.getIsTop()));
|
||||
}
|
||||
if (StringUtils.isNotBlank(caseVo.getAuthorName())) {
|
||||
query.addFilter(FieldFilters.like("authorName", LikeMatchMode.ANYWHERE, caseVo.getAuthorName()));
|
||||
}
|
||||
|
||||
OrderCondition order = null;
|
||||
if (StringUtils.isNotBlank(caseVo.getOrderField())) {
|
||||
if (caseVo.getOrderAsc() == null || caseVo.getOrderAsc()) {
|
||||
order = OrderCondition.asc(caseVo.getOrderField());
|
||||
} else {
|
||||
order = OrderCondition.desc(caseVo.getOrderField());
|
||||
}
|
||||
} else {
|
||||
order = OrderCondition.desc("sysCreateTime");
|
||||
}
|
||||
query.addOrder(order);
|
||||
query.addField("new Cases(title)");
|
||||
List<Cases> result = casesDao.findList(query.builder());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageList<CasesFiledVo> queryList(int pageIndex, int pageSize, CaseVo caseVo) {
|
||||
PageList<CasesFiledVo> pageList = new PageList<>();
|
||||
@@ -958,8 +994,9 @@ public class CasesServiceImpl implements ICasesService {
|
||||
String accountId = current.getAccountId();
|
||||
List<Cases> result = new ArrayList<>();
|
||||
try {
|
||||
String hql = "select a.caseId FROM CasesRecommendPushRecord a left join Cases b ON a.caseId = b.id WHERE a.pushUserId=?1 and b.deleted = false group by a.caseId ORDER By a.pushTime DESC";
|
||||
String hql = "select a.caseId FROM CasesRecommendPushRecord a left join Cases b ON a.caseId = b.id WHERE a.pushUserId=?1 and a.pushStatus=3 and b.deleted = false group by a.caseId ORDER By a.pushTime DESC";
|
||||
List<String> listFields = casesRecommendDao.findListFields(hql, CASE_LEN, ListUtil.toList(accountId));
|
||||
// List<String> listFields = new ArrayList<>();
|
||||
List<String> caseIds = new ArrayList<>();
|
||||
if (CollUtil.isNotEmpty(listFields)) {
|
||||
for (String objs : listFields) {
|
||||
|
||||
@@ -33,6 +33,17 @@ public class CasesRecommendLaunchVo {
|
||||
*/
|
||||
private List<String> pushUserIdList;
|
||||
|
||||
|
||||
/**
|
||||
* 组织列表
|
||||
*/
|
||||
private List<String> deptIds;
|
||||
|
||||
/**
|
||||
* 受众列表
|
||||
*/
|
||||
private List<String> groupIds;
|
||||
|
||||
/**
|
||||
* 推荐机构
|
||||
*/
|
||||
|
||||
@@ -2,15 +2,10 @@ spring.profiles.active=@profileActive@
|
||||
spring.application.name=boe-server-all
|
||||
server.port=9090
|
||||
server.servlet.session.timeout=30m
|
||||
|
||||
server.servlet.encoding.charset=UTF-8
|
||||
server.servlet.encoding.enabled=true
|
||||
server.servlet.encoding.force=true
|
||||
|
||||
server.tomcat.uri-encoding=UTF-8
|
||||
|
||||
|
||||
|
||||
ok.http.connect-timeout=30
|
||||
ok.http.read-timeout=30
|
||||
ok.http.write-timeout=30
|
||||
@@ -18,31 +13,24 @@ ok.http.write-timeout=30
|
||||
ok.http.max-idle-connections=200
|
||||
# 连接空闲时间最多为 300 秒
|
||||
ok.http.keep-alive-duration=300
|
||||
|
||||
#spring.jackson.locale=
|
||||
#spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
|
||||
# spring.jackson.default-property-inclusion=NON_NULL
|
||||
spring.jackson.time-zone=GMT+8
|
||||
|
||||
spring.servlet.multipart.max-file-size=1024MB
|
||||
spring.servlet.multipart.max-request-size=1024MB
|
||||
|
||||
## 静态文件目录,默认是在static下面,以后独立到nginx下面配置
|
||||
spring.mvc.static-path-pattern=/cdn/**
|
||||
|
||||
|
||||
spring.redis.lettuce.pool.max-active=8
|
||||
spring.redis.lettuce.pool.min-idle=0
|
||||
spring.redis.lettuce.pool.max-idle=30
|
||||
spring.redis.lettuce.pool.max-wait=10000ms
|
||||
spring.redis.lettuce.shutdown-timeout=100ms
|
||||
|
||||
# 上传的临时目录,部署到服务器必须指定
|
||||
# spring.servlet.multipart.location=
|
||||
|
||||
# jpa config
|
||||
spring.jpa.database = MYSQL
|
||||
spring.jpa.show-sql = false
|
||||
spring.jpa.database=MYSQL
|
||||
spring.jpa.show-sql=false
|
||||
# spring.jpa.properties.hibernate.cache.use_second_level_cache=true
|
||||
# spring.jpa.properties.hibernate.cache.region.factory_class=org.hibernate.cache.ehcache.EhCacheRegionFactory
|
||||
spring.jpa.properties.hibernate.naming_strategy=org.hibernate.cfg.EJB3NamingStrategy
|
||||
@@ -52,12 +40,14 @@ spring.jpa.database-platform=org.hibernate.dialect.MySQL5InnoDBDialect
|
||||
# spring.jpa.properties.hibernate.allow_update_outside_transaction=true
|
||||
# spring.jpa.properties.hibernate.current_session_context_class=org.springframework.orm.hibernate5.SpringSessionContext
|
||||
spring.jpa.properties.hibernate.current_session_context_class=org.springframework.orm.hibernate5.SpringSessionContext
|
||||
|
||||
|
||||
# 设置logback.xml位置
|
||||
logging.config=classpath:log/logback-@profileActive@.xml
|
||||
|
||||
# 用于分布式id生成不重复的处理 配置,0-31 的数值
|
||||
# config.id.generator.server.num=1
|
||||
# config.id.generator.datacenter.num=1
|
||||
|
||||
boe.domain=https://pretest.zcwytd.com
|
||||
orgTree.orgTreeList=${boe.domain}/userbasic/org/list
|
||||
# ????id????????????
|
||||
orgTree.orgChildTreeList=${boe.domain}/userbasic/org/childOrgs
|
||||
userBasic.searchUserList=${boe.domain}/userbasic/user/list
|
||||
audience.usersByAudienceList=${boe.domain}/userbasic/audience/memberList
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<!--应用名称-->
|
||||
<property name="APP_NAME" value="boe-server-all"/>
|
||||
<!--日志文件保存路径-->
|
||||
<property name="LOG_FILE_PATH" value="/app/logs/"/>
|
||||
<property name="LOG_FILE_PATH" value="./logs/"/>
|
||||
<contextName>${APP_NAME}</contextName>
|
||||
<!--每天记录日志到文件appender-->
|
||||
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
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;
|
||||
@@ -7,6 +10,7 @@ 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.*;
|
||||
@@ -18,4 +22,15 @@ class CasesRecordDaoTest {
|
||||
@Autowired
|
||||
private CasesRecordDao casesRecordDao;
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
||||
@@ -41,7 +41,7 @@ class CasesServiceImplTest {
|
||||
|
||||
@Test
|
||||
void queryRecommendPageCasesV2() throws JsonProcessingException {
|
||||
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]}";
|
||||
String jsonStr = "{\"pageIndex\":1,\"pageSize\":5,\"majorType\":\"\",\"orderAsc\":false,\"excellent\":false,\"orgDomainDtos\":[],\"caseType\":\"\",\"authorName\":\"\",\"notInIds\":[],\"type\":\"recommend\",\"userId\":\"\",\"parent\":\"\",\"children\":[],\"name\":\"\",\"years\":[2023]}\n";
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES,false);
|
||||
CasePageVo pageVo = mapper.readValue(jsonStr, CasePageVo.class);
|
||||
|
||||
Reference in New Issue
Block a user