修改了日志输出界面
This commit is contained in:
parent
a1ad89c136
commit
15e461957c
@ -159,6 +159,18 @@
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
<version>1.6.2</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
<version>1.6.2</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
@ -1,5 +0,0 @@
|
||||
package cn.iocoder.yudao.framework.common.util.elasticsearch;
|
||||
|
||||
public interface BaseSaveVo {
|
||||
Long getId();
|
||||
}
|
@ -92,7 +92,7 @@ public class EsearchUtils {
|
||||
}
|
||||
return delete.status().toString();
|
||||
}
|
||||
public static <T1 extends BaseSearchVo,T2 extends BaseSaveVo> List<String> selectForEs(T1 kmsSearchDto,T2 KmsMainVo, String indexName ) {
|
||||
public static <T> List<T> selectForEs(KmsSearchDto kmsSearchDto,T KmsMainVo, String indexName ,Class<T> clazz) {
|
||||
// 1.创建并设置SearchSourceBuilder对象
|
||||
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
|
||||
// 2.创建BoolQueryBuilder对象
|
||||
@ -122,23 +122,22 @@ public class EsearchUtils {
|
||||
SearchRequest searchRequest = new SearchRequest(indexName);
|
||||
searchRequest.source(searchSourceBuilder);
|
||||
|
||||
List<String> rsList = Lists.newArrayList();
|
||||
//返回信息
|
||||
// List<KmsMainVo> rsList = Lists.newArrayList();
|
||||
// try {
|
||||
// SearchResponse response = esClient.search(searchRequest, RequestOptions.DEFAULT);
|
||||
// //解析搜索结果
|
||||
// for (SearchHit sh : response.getHits()) {
|
||||
// Map<String, Object> sourceAsMap = sh.getSourceAsMap();
|
||||
// /*for (Map.Entry<String, Object> stringObjectEntry : sourceAsMap.entrySet()) {
|
||||
// System.out.println(sourceAsMap.get(stringObjectEntry.getKey()));
|
||||
// }*/
|
||||
// KmsMainVo main = JSON.parseObject(JSON.toJSONString(sourceAsMap), KmsMainVo.class);
|
||||
// rsList.add(main);
|
||||
// }
|
||||
// } catch (IOException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
List<T> rsList = Lists.newArrayList();
|
||||
try {
|
||||
SearchResponse response = esClient.search(searchRequest, RequestOptions.DEFAULT);
|
||||
//解析搜索结果
|
||||
for (SearchHit sh : response.getHits()) {
|
||||
Map<String, Object> sourceAsMap = sh.getSourceAsMap();
|
||||
/*for (Map.Entry<String, Object> stringObjectEntry : sourceAsMap.entrySet()) {
|
||||
System.out.println(sourceAsMap.get(stringObjectEntry.getKey()));
|
||||
}*/
|
||||
T main = JSON.parseObject(JSON.toJSONString(sourceAsMap), clazz);
|
||||
rsList.add(main);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return rsList;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,76 @@
|
||||
package cn.iocoder.yudao.framework.common.util.elasticsearch;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class KmsSearchDto {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 查询key
|
||||
*/
|
||||
@ApiModelProperty("查询key")
|
||||
private String searchKey;
|
||||
|
||||
/**
|
||||
* 查询值
|
||||
*/
|
||||
@ApiModelProperty("查询值")
|
||||
private String searchValue;
|
||||
|
||||
/**
|
||||
* 查询每页显示
|
||||
*/
|
||||
@ApiModelProperty("查询每页显示")
|
||||
private Integer pageSize;
|
||||
|
||||
/**
|
||||
* 排序选项
|
||||
*/
|
||||
@ApiModelProperty("排序选项")
|
||||
private String sortBy;
|
||||
|
||||
/**
|
||||
* 排序方式
|
||||
*/
|
||||
@ApiModelProperty("排序方式")
|
||||
private String sortType;
|
||||
|
||||
/**
|
||||
* 查询方式
|
||||
*/
|
||||
@ApiModelProperty("查询方式")
|
||||
private String searchBy;
|
||||
|
||||
// @Override
|
||||
// public String getSearchBy() {
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public Integer getPageSize() {
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String getSortBy() {
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String getSortType() {
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String getSearchKey() {
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String getSearchValue() {
|
||||
// return null;
|
||||
// }
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
package cn.iocoder.yudao.module.bpm.controller.admin.knows;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.iocoder.yudao.framework.common.util.elasticsearch.KmsSearchDto;
|
||||
import cn.iocoder.yudao.module.bpm.convert.knows.KnowledgeConvert;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.knows.KnowtypeDO;
|
||||
import cn.iocoder.yudao.module.bpm.service.knows.KnowtypeService;
|
||||
@ -34,6 +35,7 @@ import cn.iocoder.yudao.module.bpm.controller.admin.knows.vo.*;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.knows.KnowledgeDO;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.knows.CommentDO;
|
||||
import cn.iocoder.yudao.module.bpm.service.knows.KnowledgeService;
|
||||
import cn.iocoder.yudao.framework.common.util.elasticsearch.KmsSearchDto;
|
||||
@Tag(name = "管理后台 - 知识发布")
|
||||
@RestController
|
||||
@RequestMapping("/bpm/knowledge")
|
||||
@ -104,6 +106,14 @@ public class KnowledgeController {
|
||||
// 转换并返回结果
|
||||
return success(new PageResult<>(KnowledgeConvert.INSTANCE.convertList(pageResult.getList(), deptMap, knowTypeMap), pageResult.getTotal()));
|
||||
}
|
||||
|
||||
@GetMapping("/listForEs")
|
||||
@Operation(summary = "获得查询分页")
|
||||
public CommonResult<List<KnowledgeRespVO>> getKnowsList(@Valid KmsSearchDto kmsSearchDto) {
|
||||
//PageResult<KnowledgeDO> pageResult = knowledgeService.getKnowledgePage(pageReqVO);
|
||||
List<KnowledgeDO> list = knowledgeService.getKnowsList(kmsSearchDto);
|
||||
return success(BeanUtils.toBean(list, KnowledgeRespVO.class));
|
||||
}
|
||||
@GetMapping("/page-user")
|
||||
@Operation(summary = "获得知识发布分页")
|
||||
@PreAuthorize("@ss.hasPermission('bpm:knowledge:query')")
|
||||
|
@ -1,19 +1,12 @@
|
||||
package cn.iocoder.yudao.module.bpm.controller.admin.knows.vo;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.knows.CommentDO;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import cn.iocoder.yudao.framework.common.util.elasticsearch.BaseSaveVo;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
import com.fasterxml.jackson.databind.JsonDeserializer;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import java.io.IOException;
|
||||
|
||||
@Schema(description = "管理后台 - 知识发布新增/修改 Request VO")
|
||||
@Data
|
||||
public class KnowledgeSaveReqVO {
|
||||
|
@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.bpm.service.knows;
|
||||
|
||||
import java.util.*;
|
||||
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
|
||||
import cn.iocoder.yudao.framework.common.util.elasticsearch.KmsSearchDto;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.knows.vo.*;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.BpmOALeavePageReqVO;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.knows.KnowledgeDO;
|
||||
@ -60,6 +61,8 @@ public interface KnowledgeService {
|
||||
PageResult<KnowledgeDO> getKnowledgePage(KnowledgePageReqVO pageReqVO);
|
||||
PageResult<KnowledgeDO> getKnowledgePage(Long userId, KnowledgePageReqVO pageReqVO);
|
||||
|
||||
List<KnowledgeDO> getKnowsList(KmsSearchDto kmsSearchDto);
|
||||
|
||||
// ==================== 子表(评论) ====================
|
||||
|
||||
/**
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.iocoder.yudao.module.bpm.service.knows;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.iocoder.yudao.framework.common.util.elasticsearch.KmsSearchDto;
|
||||
import cn.iocoder.yudao.module.bpm.api.task.BpmProcessInstanceApi;
|
||||
import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO;
|
||||
import cn.iocoder.yudao.module.bpm.enums.task.BpmTaskStatusEnum;
|
||||
@ -121,6 +122,11 @@ public class KnowledgeServiceImpl implements KnowledgeService {
|
||||
return knowledgeMapper.selectPage(userId, pageReqVO);
|
||||
}
|
||||
|
||||
public List<KnowledgeDO> getKnowsList(KmsSearchDto kmsSearchDto) {
|
||||
// return knowledgeMapper.selectPage(userId, pageReqVO);
|
||||
KnowledgeDO knowledgeDo = new KnowledgeDO();
|
||||
return EsearchUtils.selectForEs(kmsSearchDto,knowledgeDo,indexName,KnowledgeDO.class);
|
||||
}
|
||||
// ==================== 子表(评论) ====================
|
||||
|
||||
@Override
|
||||
@ -167,19 +173,4 @@ public class KnowledgeServiceImpl implements KnowledgeService {
|
||||
knowledgeMapper.updateById(new KnowledgeDO().setId(id).setFlowStatus(status));
|
||||
}
|
||||
|
||||
// private void saveIndex(KnowledgeSaveReqVO createReqVO) throws IOException {
|
||||
// String indexStatus = null;
|
||||
// Long kId = createReqVO.getId();
|
||||
// String knowStr = JSON.toJSONString(createReqVO);
|
||||
// JSONObject knowObj = JSONObject.parseObject(knowStr);
|
||||
// knowObj.put("id", String.valueOf(kId));
|
||||
// IndexRequest esRequest = new IndexRequest("knows_index");
|
||||
// esRequest.id(String.valueOf(kId));
|
||||
// esRequest.source(knowObj.toJSONString(), XContentType.JSON);
|
||||
// System.out.println("========保存数据:" + knowObj.toJSONString());
|
||||
// esRequest.setRefreshPolicy(WriteRequest.RefreshPolicy.WAIT_UNTIL);
|
||||
// IndexResponse indexResult = esClient.index(esRequest, RequestOptions.DEFAULT);
|
||||
// indexStatus = indexResult.status().toString();
|
||||
// System.out.println("========保存结果:" + indexResult);
|
||||
// }
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user