fix:79065

This commit is contained in:
梁琦涛
2023-12-06 18:26:43 +08:00
parent b84c2282a4
commit 46328dbc39
5 changed files with 25 additions and 13 deletions
@@ -166,11 +166,22 @@ public class LawsCommonServiceImpl implements ILawsCommonService {
// 查询全部字段列表
List<LawsTag> fieldList = lawsCommonMapper.getFieldList(tableName);
// 筛选出查询列表显示的字段(不传id查列表)
List<LawsTag> fieldListSelect = fieldList.stream().filter(lawsTag -> YesOrNoEnum.YES.getValue()
.equals(lawsTag.getIsShowList().toString())).collect(Collectors.toList());
List<LawsTag> fieldListSelect;
// 筛选出用于查询的字段
List<LawsTag> fieldListCondition = fieldList.stream().filter(lawsTag -> YesOrNoEnum.YES.getValue()
.equals(lawsTag.getIsQuery().toString())).collect(Collectors.toList());
List<LawsTag> fieldListCondition;
// 首页高级检索使用
if(parameterMap.containsKey("home_search_key")){
fieldListSelect = fieldList;
fieldListCondition = fieldList;
}else{
// 筛选出查询列表显示的字段(不传id查列表)
fieldListSelect = fieldList.stream().filter(lawsTag -> YesOrNoEnum.YES.getValue()
.equals(lawsTag.getIsShowList().toString())).collect(Collectors.toList());
// 筛选出用于查询的字段
fieldListCondition = fieldList.stream().filter(lawsTag -> YesOrNoEnum.YES.getValue()
.equals(lawsTag.getIsQuery().toString())).collect(Collectors.toList());
}
// 加一个create_by字段
LawsTag createByTag = new LawsTag();
createByTag.setDbFieldName(FieldCommon.CREATE_BY);
@@ -15,7 +15,6 @@ import com.jero.common.exception.JeroBootException;
import com.jero.common.system.api.ISysBaseAPI;
import com.jero.common.system.vo.DictModel;
import com.jero.common.system.vo.LoginUser;
import com.jero.common.util.DateUtils;
import com.jero.common.util.oConvertUtils;
import com.jero.modules.document.utils.ReadPdfUtil;
import com.jero.modules.document.utils.ReadWordUtil;
@@ -700,9 +699,13 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
list.forEach(p->{
Map<String, Object> map = getStringObjectMap(p);
String releaseDate = "releaseDate";
if(map.containsKey(releaseDate)){
if(map.containsKey(releaseDate) && !Objects.isNull(map.get(releaseDate))){
map.put(releaseDate,new SimpleDateFormat(YYYY_MM_DD).format(Long.parseLong(map.get(releaseDate).toString())));
}
String createTime = "createTime";
if(map.containsKey(createTime) && !Objects.isNull(map.get(createTime))){
map.put(createTime,new SimpleDateFormat(YYYY_MM_DD).format(Long.parseLong(map.get(createTime).toString())));
}
listNew.add(map);
});
page.setRecords(listNew);
@@ -756,11 +759,6 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
mapSource.put(key, fieldConyent.toString());
}
}
String createTime = "";
if(ObjectUtils.isNotEmpty(mapSource.get(CREATE_TIME))){
createTime = DateUtils.formatTime((Long) mapSource.get(CREATE_TIME));
}
mapSource.put(CREATE_TIME,createTime);
mapList.add(mapSource);
}
//处理分页
@@ -1346,14 +1344,14 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
map.put(STANDARD_CODE,obj.getStandardCode());
map.put(ENTERPRISE_STANDARD_STATE,obj.getEnterpriseStandardState());
map.put(GRADE_CLASSIFICATION,obj.getGradeClassification());
map.put("release_date",obj.getReleaseDate());
map.put("release_date",Objects.isNull(obj.getReleaseDate()) ? "" : new SimpleDateFormat(YYYY_MM_DD).format(obj.getReleaseDate()));
map.put("create_time_c",new Date());
//添加es
JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(map));
try {
jeroElasticsearchTemplate.saveOrUpdate(HomeSearchEnum.INDEX_NAME_DOCUMENT_ZQ.getValue(), HomeSearchEnum.TYPE_NAME_DOCUMENT_ZQ.getValue(), idTemp, jsonObject);
} catch (Exception e) {
log.error("文档库添加es失败");
log.error("文档库添加es失败",e);
}
}
}
@@ -67,6 +67,7 @@ public class LawsDomesticController {
@ApiOperationSupport(order = 1)
public Result<IPage<Map<String,Object>>> getCommonPageNoPermissions(@RequestBody @ApiParam("标签管理") Map<String,Object> parameterMap) {
parameterMap.put(FieldCommon.MODULE, MODULE_VALUE);
parameterMap.put("home_search_key","1");
return Result.OK(lawsCommonService.getCommonPage(parameterMap));
}
@@ -85,6 +85,7 @@ public class LawsEnterpriseController {
@ApiOperationSupport(order = 1)
public Result<IPage<Map<String,Object>>> getCommonPageNoPermissions(@RequestBody @ApiParam("标签管理") Map<String,Object> parameterMap) {
parameterMap.put(FieldCommon.MODULE, MODULE_VALUE);
parameterMap.put("home_search_key","1");
return Result.OK(lawsCommonService.getCommonPage(parameterMap));
}
@@ -67,6 +67,7 @@ public class LawsOverseasController {
@ApiOperationSupport(order = 1)
public Result<IPage<Map<String,Object>>> getCommonPageNoPermissions(@RequestBody @ApiParam("标签管理") Map<String,Object> parameterMap) {
parameterMap.put(FieldCommon.MODULE, MODULE_VALUE);
parameterMap.put("home_search_key","1");
return Result.OK(lawsCommonService.getCommonPage(parameterMap));
}