|
|
|
@@ -8,12 +8,16 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
|
import com.google.common.base.CaseFormat;
|
|
|
|
|
import com.jero.common.api.CommonAPI;
|
|
|
|
|
import com.jero.common.api.vo.ResultCommon;
|
|
|
|
|
import com.jero.common.es.JeroElasticsearchTemplate;
|
|
|
|
|
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.system.vo.SysDictItemCore;
|
|
|
|
|
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;
|
|
|
|
|
import com.jero.modules.laws.home.common.LawsHomeSearchCommon;
|
|
|
|
@@ -24,6 +28,7 @@ import com.jero.modules.laws.home.enums.HomeSearchEnum;
|
|
|
|
|
import com.jero.modules.laws.home.mapper.LawsHomeSearchMapper;
|
|
|
|
|
import com.jero.modules.laws.home.service.ILawsHomeNormalSearchHistoryService;
|
|
|
|
|
import com.jero.modules.laws.home.service.ILawsHomeSearchService;
|
|
|
|
|
import com.jero.modules.laws.home.vo.LawsHomeNormalSearchCountVO;
|
|
|
|
|
import com.jero.modules.laws.home.vo.LawsHomeNormalSearchStatisticsObjVO;
|
|
|
|
|
import com.jero.modules.laws.home.vo.LawsHomeNormalSearchStatisticsVO;
|
|
|
|
|
import com.jero.modules.laws.home.vo.LawsHomeNormalSearchVO;
|
|
|
|
@@ -37,10 +42,10 @@ import com.jero.modules.laws.standard.service.ILawsNewsFeedService;
|
|
|
|
|
import com.jero.modules.laws.standard.service.ILawsOverseasStandardService;
|
|
|
|
|
import com.jero.modules.oss.entity.OSSFile;
|
|
|
|
|
import com.jero.modules.oss.service.IOSSFileService;
|
|
|
|
|
import com.jero.modules.system.entity.SysDepart;
|
|
|
|
|
import com.jero.modules.system.entity.SysUser;
|
|
|
|
|
import com.jero.modules.system.service.ISysDepartService;
|
|
|
|
|
import com.jero.modules.system.service.ISysUserService;
|
|
|
|
|
import com.jero.modules.tag.entity.LawsTag;
|
|
|
|
|
import com.jero.modules.tag.service.ILawsTagService;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
|
|
@@ -88,11 +93,15 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
|
|
|
|
|
private IOSSFileService oSSFileService;
|
|
|
|
|
@Resource
|
|
|
|
|
private JeroElasticsearchTemplate jeroElasticsearchTemplate;
|
|
|
|
|
@Resource
|
|
|
|
|
private CommonAPI commonAPI;
|
|
|
|
|
@Resource
|
|
|
|
|
private ILawsTagService lawsTagService;
|
|
|
|
|
|
|
|
|
|
@Value(value = "${jero.path.upload}")
|
|
|
|
|
private String uploadpath;
|
|
|
|
|
|
|
|
|
|
public static final String SEARCH_FLAG = "魑";//标识(es数据带此标识的代表全文和段落的数据,不带此标识的代表列表数据)
|
|
|
|
|
// 标识(es数据带此标识的代表全文和段落的数据,不带此标识的代表列表数据)
|
|
|
|
|
public static final String SEARCH_FLAG = "魑";
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional(rollbackFor = JeroBootException.class)
|
|
|
|
@@ -100,7 +109,7 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
|
|
|
|
|
Integer pageNo,Integer pageSize) {
|
|
|
|
|
String searchContent = lawsHomeNormalSearchDTO.getSearchContent();
|
|
|
|
|
if(StringUtils.isBlank(searchContent)){
|
|
|
|
|
throw new JeroBootException("请输入检索内容");
|
|
|
|
|
throw new JeroBootException(ResultCommon.PLEASE_SEARCH_TO_IMPORT);
|
|
|
|
|
}
|
|
|
|
|
// 添加检索历史
|
|
|
|
|
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
|
@@ -122,13 +131,13 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
|
|
|
|
|
queryWrapper.and(p -> p.gt("instr(standard_number,'" + lawsHomeNormalSearchDTO.getSearchContent() + "')", 0).or()
|
|
|
|
|
.gt("instr(standard_name,'" + lawsHomeNormalSearchDTO.getSearchContent() + "')", 0));
|
|
|
|
|
queryWrapper.eq(!StringUtils.isEmpty(lawsHomeNormalSearchDTO.getResourceType()),"resource_type",lawsHomeNormalSearchDTO.getResourceType());
|
|
|
|
|
queryWrapper.eq(!StringUtils.isEmpty(lawsHomeNormalSearchDTO.getStandardClass()),"standard_class",lawsHomeNormalSearchDTO.getStandardClass());
|
|
|
|
|
queryWrapper.eq(!StringUtils.isEmpty(lawsHomeNormalSearchDTO.getDynamicType()),"dynamic_type",lawsHomeNormalSearchDTO.getDynamicType());
|
|
|
|
|
queryWrapper.eq(!StringUtils.isEmpty(lawsHomeNormalSearchDTO.getApplicableVehicle()),"applicable_vehicle",lawsHomeNormalSearchDTO.getApplicableVehicle());
|
|
|
|
|
queryWrapper.eq(!StringUtils.isEmpty(lawsHomeNormalSearchDTO.getStandardProperty()),"standard_property",lawsHomeNormalSearchDTO.getStandardProperty());
|
|
|
|
|
queryWrapper.eq(!StringUtils.isEmpty(lawsHomeNormalSearchDTO.getStandardState()),"standard_state",lawsHomeNormalSearchDTO.getStandardState());
|
|
|
|
|
queryWrapper.eq(!StringUtils.isEmpty(lawsHomeNormalSearchDTO.getStandardCode()),"standard_code",lawsHomeNormalSearchDTO.getStandardCode());
|
|
|
|
|
queryWrapper.eq(!StringUtils.isEmpty(lawsHomeNormalSearchDTO.getGradeClassification()),"grade_classification",lawsHomeNormalSearchDTO.getGradeClassification());
|
|
|
|
|
queryWrapper.gt(!StringUtils.isEmpty(lawsHomeNormalSearchDTO.getStandardClass()),"instr(concat(',',standard_class,','),concat(',','" + lawsHomeNormalSearchDTO.getStandardClass() + "',','))",0);
|
|
|
|
|
queryWrapper.gt(!StringUtils.isEmpty(lawsHomeNormalSearchDTO.getDynamicType()),"instr(concat(',',dynamic_type,','),concat(',','" + lawsHomeNormalSearchDTO.getDynamicType() + "',','))",0);
|
|
|
|
|
queryWrapper.gt(!StringUtils.isEmpty(lawsHomeNormalSearchDTO.getApplicableVehicle()),"instr(concat(',',applicable_vehicle,','),concat(',','" + lawsHomeNormalSearchDTO.getApplicableVehicle() + "',','))",0);
|
|
|
|
|
queryWrapper.gt(!StringUtils.isEmpty(lawsHomeNormalSearchDTO.getStandardProperty()),"instr(concat(',',standard_property,','),concat(',','" + lawsHomeNormalSearchDTO.getStandardProperty() + "',','))",0);
|
|
|
|
|
queryWrapper.gt(!StringUtils.isEmpty(lawsHomeNormalSearchDTO.getStandardState()),"instr(concat(',',standard_state,','),concat(',','" + lawsHomeNormalSearchDTO.getStandardState() + "',','))",0);
|
|
|
|
|
queryWrapper.gt(!StringUtils.isEmpty(lawsHomeNormalSearchDTO.getStandardCode()),"instr(concat(',',standard_code,','),concat(',','" + lawsHomeNormalSearchDTO.getStandardCode() + "',','))",0);
|
|
|
|
|
queryWrapper.gt(!StringUtils.isEmpty(lawsHomeNormalSearchDTO.getGradeClassification()),"instr(concat(',',grade_classification,','),concat(',','" + lawsHomeNormalSearchDTO.getGradeClassification() + "',','))",0);
|
|
|
|
|
queryWrapper.orderByAsc("resource_type");
|
|
|
|
|
queryWrapper.orderByDesc("standard_type");
|
|
|
|
|
// todo 排序号
|
|
|
|
@@ -177,9 +186,8 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
|
|
|
|
|
List<LawsEnterpriseStandard> finalListLawsEnterpriseStandard = listLawsEnterpriseStandard;
|
|
|
|
|
List<LawsNewsFeed> finalListLawsNewsFeed = listLawsNewsFeed;
|
|
|
|
|
|
|
|
|
|
Map<String,String> mapSysUser = sysUserService.list().stream().collect(Collectors.toMap(SysUser::getId,SysUser::getRealname));
|
|
|
|
|
Map<String,String> mapSysDepart = sysDepartService.list().stream().collect(Collectors.toMap(SysDepart::getId,SysDepart::getDepartName));
|
|
|
|
|
|
|
|
|
|
List<SysDictItemCore> listDict = commonAPI.getDictItemAll();
|
|
|
|
|
String yyyyMMdd = "yyyy-MM-dd";
|
|
|
|
|
list.parallelStream().forEach(p->{
|
|
|
|
|
switch (p.getResourceType()){
|
|
|
|
|
case LawsHomeSearchCommon.LAWS_DOMESTIC_STANDARD:
|
|
|
|
@@ -190,37 +198,8 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
|
|
|
|
|
p.setTitle(obj.getStandardNumber().replace(searchContent,searchContentSpan) + " " + obj.getStandardName().replace(searchContent,searchContentSpan));
|
|
|
|
|
p.setReleaseDate(obj.getReleaseDate());
|
|
|
|
|
// 生成正文
|
|
|
|
|
StringBuilder content = new StringBuilder();
|
|
|
|
|
content.append("标准性质:").append(sysBaseAPI.translateDict("standard_property",obj.getStandardProperty())).append(" ");
|
|
|
|
|
content.append("标准类别:").append(sysBaseAPI.translateDict("standard_type",obj.getStandardClass())).append(" ");
|
|
|
|
|
content.append("年代号:").append(obj.getYearNumber()).append(" ");
|
|
|
|
|
content.append("标准编号:").append(obj.getStandardNumber()).append(" ");
|
|
|
|
|
content.append("标准名称:").append(obj.getStandardName()).append(" ");
|
|
|
|
|
content.append("标准英文名称:").append(obj.getStandardEnglishName()).append(" ");
|
|
|
|
|
content.append("标准体系:").append(obj.getStandardSystem()).append(" ");
|
|
|
|
|
content.append("发布日期:").append(obj.getReleaseDate()).append(" ");
|
|
|
|
|
content.append("实施日期:").append(obj.getImplementationDate()).append(" ");
|
|
|
|
|
content.append("在产车实施日期:").append(obj.getOnTheProductionDate()).append(" ");
|
|
|
|
|
content.append("新车型实施日期:").append(obj.getNewModelImplementationDate()).append(" ");
|
|
|
|
|
content.append("废止日期:").append(obj.getAnnulmentDate()).append(" ");
|
|
|
|
|
content.append("标准状态:").append(obj.getStandardState()).append(" ");
|
|
|
|
|
content.append("归口管理部门:").append(obj.getCentralizedManagementDepartments()).append(" ");
|
|
|
|
|
content.append("分标委:").append(sysBaseAPI.translateDict("bidding_committee",obj.getBiddingCommittee())).append(" ");
|
|
|
|
|
content.append("责任部门:").append(mapSysDepart.get(obj.getResponsibleDepartment())).append(" ");
|
|
|
|
|
content.append("责任部门负责人:").append(mapSysUser.get(obj.getResponsibleDepartmentUser())).append(" ");
|
|
|
|
|
content.append("企业参与情况:").append(sysBaseAPI.translateDict("enterprise_participation",obj.getEnterpriseParticipation())).append(" ");
|
|
|
|
|
content.append("零部件名称:").append(obj.getPartName()).append(" ");
|
|
|
|
|
content.append("适用认证:").append(sysBaseAPI.translateDict("applicable_certification",obj.getApplicableCertification())).append(" ");
|
|
|
|
|
content.append("适用车型:").append(sysBaseAPI.translateDict("APPLICATIONS_DOMESTIC",obj.getApplicableVehicle())).append(" ");
|
|
|
|
|
content.append("动力类型:").append(sysBaseAPI.translateDict("POWER_TYPE_DOMESTIC",obj.getDynamicType()));
|
|
|
|
|
content.append("代替标准号:").append(obj.getSubstituteStandardNumber()).append(" ");
|
|
|
|
|
content.append("被代替标准号:").append(obj.getReplacedByStandardNumber()).append(" ");
|
|
|
|
|
content.append("引用标准:").append(obj.getReferenceStandard()).append(" ");
|
|
|
|
|
content.append("被引用标准:").append(obj.getReferencedStandard()).append(" ");
|
|
|
|
|
content.append("采标程度:").append(sysBaseAPI.translateDict("degree_bid_acquisition",obj.getDegreeOfBidAcquisition())).append(" ");
|
|
|
|
|
content.append("采用国际标准号:").append(obj.getAdoptTheInternationalStandardNumber()).append(" ");
|
|
|
|
|
content.append("关联国外标准:").append(obj.getAssociatedForeignStandards()).append(" ");
|
|
|
|
|
p.setContent(content.toString());
|
|
|
|
|
JSONObject json = JSON.parseObject(JSON.toJSONStringWithDateFormat(obj,yyyyMMdd));
|
|
|
|
|
addContent(listDict, p, json, "laws_domestic_standard");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
@@ -232,29 +211,8 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
|
|
|
|
|
p.setTitle(obj.getStandardNumber().replace(searchContent,searchContentSpan) + " " + obj.getStandardName().replace(searchContent,searchContentSpan));
|
|
|
|
|
p.setReleaseDate(obj.getReleaseDate());
|
|
|
|
|
// 生成正文
|
|
|
|
|
StringBuilder content = new StringBuilder();
|
|
|
|
|
content.append("国家/地区:").append(sysBaseAPI.translateDict("country_or_region",obj.getCountryOrRegion())).append(" ");
|
|
|
|
|
content.append("标准类别:").append(sysBaseAPI.translateDict("standard_type_overseas",obj.getStandardClass())).append(" ");
|
|
|
|
|
content.append("年代号:").append(obj.getYearNumber()).append(" ");
|
|
|
|
|
content.append("标准编号:").append(obj.getStandardNumber()).append(" ");
|
|
|
|
|
content.append("标准名称:").append(obj.getStandardName()).append(" ");
|
|
|
|
|
content.append("标准英文名称:").append(obj.getStandardEnglishName()).append(" ");
|
|
|
|
|
content.append("标准体系:").append(sysBaseAPI.translateDict("standard_system",obj.getStandardSystem())).append(" ");
|
|
|
|
|
content.append("发布日期:").append(obj.getReleaseDate()).append(" ");
|
|
|
|
|
content.append("实施日期:").append(obj.getImplementationDate()).append(" ");
|
|
|
|
|
content.append("在产车实施日期:").append(obj.getOnTheProductionDate()).append(" ");
|
|
|
|
|
content.append("新车型实施日期:").append(obj.getNewModelImplementationDate()).append(" ");
|
|
|
|
|
content.append("废止日期:").append(obj.getAnnulmentDate()).append(" ");
|
|
|
|
|
content.append("标准状态:").append(sysBaseAPI.translateDict("standard_system",obj.getStandardState())).append(" ");
|
|
|
|
|
content.append("责任部门:").append(mapSysDepart.get(obj.getResponsibleDepartment())).append(" ");
|
|
|
|
|
content.append("责任部门负责人:").append(mapSysUser.get(obj.getResponsibleDepartmentUser())).append(" ");
|
|
|
|
|
content.append("零部件名称:").append(obj.getPartName()).append(" ");
|
|
|
|
|
content.append("适用车型:").append(sysBaseAPI.translateDict("APPLICATIONS_OVERSEAS",obj.getApplicableVehicle())).append(" ");
|
|
|
|
|
content.append("代替标准号:").append(obj.getSubstituteStandardNumber()).append(" ");
|
|
|
|
|
content.append("被代替标准号:").append(obj.getReplacedByStandardNumber()).append(" ");
|
|
|
|
|
content.append("引用标准:").append(obj.getReferenceStandard()).append(" ");
|
|
|
|
|
content.append("被引用标准:").append(obj.getReferencedStandard()).append(" ");
|
|
|
|
|
p.setContent(content.toString());
|
|
|
|
|
JSONObject json = JSON.parseObject(JSON.toJSONStringWithDateFormat(obj,yyyyMMdd));
|
|
|
|
|
addContent(listDict, p, json, "laws_overseas_standard");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
@@ -266,39 +224,8 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
|
|
|
|
|
p.setTitle(obj.getStandardNumber().replace(searchContent,searchContentSpan) + " " + obj.getStandardName().replace(searchContent,searchContentSpan));
|
|
|
|
|
p.setReleaseDate(obj.getReleaseDate());
|
|
|
|
|
// 生成正文
|
|
|
|
|
StringBuilder content = new StringBuilder();
|
|
|
|
|
content.append("企标编号:").append(obj.getStandardNumber()).append(" ");
|
|
|
|
|
content.append("企标名称:").append(obj.getStandardName()).append(" ");
|
|
|
|
|
content.append("企业标准代号:").append(obj.getStandardCode()).append(" ");
|
|
|
|
|
content.append("企业名称代号:").append(obj.getNameCode()).append(" ");
|
|
|
|
|
content.append("标准类别代号:").append(obj.getCategoryCode()).append(" ");
|
|
|
|
|
content.append("标准英文名称:").append(obj.getStandardEnglishName()).append(" ");
|
|
|
|
|
content.append("年代号:").append(obj.getYearNumber()).append(" ");
|
|
|
|
|
content.append("标准体系:").append(sysBaseAPI.translateDict("standard_system",obj.getStandardSystem())).append(" ");
|
|
|
|
|
content.append("标准英文名称:").append(obj.getStandardEnglishName()).append(" ");
|
|
|
|
|
content.append("标准等级分类:").append(obj.getGradeClassification()).append(" ");
|
|
|
|
|
content.append("授权部门:").append(mapSysDepart.get(obj.getAuthDept())).append(" ");
|
|
|
|
|
content.append("发布日期:").append(obj.getReleaseDate()).append(" ");
|
|
|
|
|
content.append("实施日期:").append(obj.getImplementationDate()).append(" ");
|
|
|
|
|
content.append("编制说明:").append(obj.getCompIllustration()).append(" ");
|
|
|
|
|
content.append("是否试行:").append(sysBaseAPI.translateDict("is_trial",obj.getTryFlag())).append(" ");
|
|
|
|
|
content.append("试行周期:").append(obj.getTrialPeriod()).append(" ");
|
|
|
|
|
content.append("标准状态:").append(sysBaseAPI.translateDict("standard_state",obj.getStandardState())).append(" ");
|
|
|
|
|
content.append("主起草人:").append(mapSysUser.get(obj.getMainDraftingUser())).append(" ");
|
|
|
|
|
content.append("主起草单位:").append(obj.getMainDraftingUnit()).append(" ");
|
|
|
|
|
content.append("主起草部门负责人:").append(obj.getMainDraftingUnitResponsiblePerson()).append(" ");
|
|
|
|
|
content.append("配合单位:").append(mapSysDepart.get(obj.getCooperationUnit())).append(" ");
|
|
|
|
|
content.append("标准推进人:").append(mapSysUser.get(obj.getStandardPromoter())).append(" ");
|
|
|
|
|
content.append("零部件名称:").append(obj.getPartName()).append(" ");
|
|
|
|
|
content.append("标准适用范围:").append(obj.getStandardScope()).append(" ");
|
|
|
|
|
content.append("代替标准号:").append(obj.getSubstituteStandardNumber()).append(" ");
|
|
|
|
|
content.append("被代替标准号:").append(obj.getReplacedByStandardNumber()).append(" ");
|
|
|
|
|
content.append("引用标准:").append(obj.getReferenceStandard()).append(" ");
|
|
|
|
|
content.append("被引用标准:").append(obj.getReferencedStandard()).append(" ");
|
|
|
|
|
content.append("关联文件:").append(obj.getAssociatedFile()).append(" ");
|
|
|
|
|
content.append("采标程度:").append(sysBaseAPI.translateDict("degree_bid_acquisition",obj.getAcquisitionDegree())).append(" ");
|
|
|
|
|
content.append("采用国际标准号:").append(obj.getInternationalStandardNum());
|
|
|
|
|
p.setContent(content.toString());
|
|
|
|
|
JSONObject json = JSON.parseObject(JSON.toJSONStringWithDateFormat(obj,yyyyMMdd));
|
|
|
|
|
addContent(listDict, p, json, "laws_enterprise_standard");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
@@ -319,11 +246,78 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
|
|
|
|
|
pageList.setRecords(list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private String isNull(String str){
|
|
|
|
|
if(StringUtils.isBlank(str)){
|
|
|
|
|
str = "--";
|
|
|
|
|
private void addContent(List<SysDictItemCore> listDict, LawsHomeNormalSearchVO p, JSONObject json, String lawsDomesticStandard) {
|
|
|
|
|
LambdaQueryWrapper<LawsTag> query = new LambdaQueryWrapper<>();
|
|
|
|
|
query.eq(LawsTag::getTableName, lawsDomesticStandard);
|
|
|
|
|
query.isNotNull(LawsTag::getHomeSearchContextOrder);
|
|
|
|
|
query.orderByAsc(LawsTag::getHomeSearchContextOrder);
|
|
|
|
|
List<LawsTag> listLawsTag = lawsTagService.list(query);
|
|
|
|
|
if (!CollectionUtils.isEmpty(listLawsTag)) {
|
|
|
|
|
StringBuilder str = new StringBuilder();
|
|
|
|
|
for (LawsTag lawsTag : listLawsTag) {
|
|
|
|
|
String code = lawsTag.getDictField();
|
|
|
|
|
String text = lawsTag.getDictText();
|
|
|
|
|
String table = lawsTag.getDictTable();
|
|
|
|
|
String fileName = lawsTag.getDbFieldName();
|
|
|
|
|
String fileTxt = lawsTag.getDbFieldTxt();
|
|
|
|
|
if (StringUtils.isBlank(fileName) || StringUtils.isBlank(fileTxt)) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
fileName = CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, fileName);
|
|
|
|
|
String key = Objects.isNull(json.get(fileName)) ? "" : String.valueOf(json.get(fileName));
|
|
|
|
|
String textValue = "";
|
|
|
|
|
if (!StringUtils.isBlank(code) && !StringUtils.isBlank(key)) {
|
|
|
|
|
textValue = translateDictValue(code, text, table, key, listDict);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isBlank(textValue)) {
|
|
|
|
|
textValue = "--";
|
|
|
|
|
}
|
|
|
|
|
str.append(fileTxt).append(":").append(textValue).append(" ");
|
|
|
|
|
}
|
|
|
|
|
p.setContent(str.toString());
|
|
|
|
|
}
|
|
|
|
|
return str;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 翻译字典文本
|
|
|
|
|
* @param code 编码
|
|
|
|
|
* @param text 值
|
|
|
|
|
* @param table 表名
|
|
|
|
|
* @param key 键
|
|
|
|
|
* @param listDict 字典集合
|
|
|
|
|
*/
|
|
|
|
|
private String translateDictValue(String code, String text, String table, String key, List<SysDictItemCore> listDict) {
|
|
|
|
|
if(oConvertUtils.isEmpty(key)) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
StringBuilder textValue = new StringBuilder();
|
|
|
|
|
String[] keys = key.split(",");
|
|
|
|
|
for (String k : keys) {
|
|
|
|
|
String tmpValue = null;
|
|
|
|
|
if (k.trim().length() == 0) {
|
|
|
|
|
continue; //跳过循环
|
|
|
|
|
}
|
|
|
|
|
if (!org.springframework.util.StringUtils.isEmpty(table)){
|
|
|
|
|
tmpValue = commonAPI.queryTableDictTextByKey(table,text,code,k.trim());
|
|
|
|
|
}else {
|
|
|
|
|
List<SysDictItemCore> listNew = listDict.stream().filter(o-> Objects.equals(o.getDictCode(),code) && Objects.equals(o.getItemValue(),k.trim())).collect(Collectors.toList());
|
|
|
|
|
if(!org.springframework.util.CollectionUtils.isEmpty(listNew)){
|
|
|
|
|
tmpValue = listNew.get(0).getItemText();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (tmpValue != null) {
|
|
|
|
|
if (!"".equals(textValue.toString())) {
|
|
|
|
|
textValue.append(",");
|
|
|
|
|
}
|
|
|
|
|
textValue.append(tmpValue);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(StringUtils.isBlank(textValue)){
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
return textValue.toString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private String getDict(String str,String code){
|
|
|
|
@@ -337,224 +331,125 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
|
|
|
|
|
public LawsHomeNormalSearchStatisticsVO getNormalSearchTitleCount(LawsHomeNormalSearchDTO lawsHomeNormalSearchDTO) {
|
|
|
|
|
String searchContent = lawsHomeNormalSearchDTO.getSearchContent();
|
|
|
|
|
if(StringUtils.isBlank(searchContent)){
|
|
|
|
|
throw new JeroBootException("请输入检索内容");
|
|
|
|
|
throw new JeroBootException(ResultCommon.PLEASE_SEARCH_TO_IMPORT);
|
|
|
|
|
}
|
|
|
|
|
QueryWrapper<LawsHomeNormalSearchDTO> queryWrapper = getQueryWrapperNormal(lawsHomeNormalSearchDTO);
|
|
|
|
|
List<LawsHomeNormalSearchVO> list = lawsHomeSearchMapper.getPage(queryWrapper);
|
|
|
|
|
QueryWrapper<LawsHomeNormalSearchDTO> queryWrapper = new QueryWrapper<>();
|
|
|
|
|
queryWrapper.and(p -> p.gt("instr(standard_number,'" + lawsHomeNormalSearchDTO.getSearchContent() + "')", 0).or()
|
|
|
|
|
.gt("instr(standard_name,'" + lawsHomeNormalSearchDTO.getSearchContent() + "')", 0));
|
|
|
|
|
queryWrapper.eq("del_flag",0);
|
|
|
|
|
queryWrapper.gt(!StringUtils.isEmpty(lawsHomeNormalSearchDTO.getStandardClass()),"instr(concat(',',standard_class,','),concat(',','" + lawsHomeNormalSearchDTO.getStandardClass() + "',','))",0);
|
|
|
|
|
queryWrapper.gt(!StringUtils.isEmpty(lawsHomeNormalSearchDTO.getDynamicType()),"instr(concat(',',dynamic_type,','),concat(',','" + lawsHomeNormalSearchDTO.getDynamicType() + "',','))",0);
|
|
|
|
|
queryWrapper.gt(!StringUtils.isEmpty(lawsHomeNormalSearchDTO.getApplicableVehicle()),"instr(concat(',',applicable_vehicle,','),concat(',','" + lawsHomeNormalSearchDTO.getApplicableVehicle() + "',','))",0);
|
|
|
|
|
queryWrapper.gt(!StringUtils.isEmpty(lawsHomeNormalSearchDTO.getStandardProperty()),"instr(concat(',',standard_property,','),concat(',','" + lawsHomeNormalSearchDTO.getStandardProperty() + "',','))",0);
|
|
|
|
|
queryWrapper.gt(!StringUtils.isEmpty(lawsHomeNormalSearchDTO.getStandardState()),"instr(concat(',',standard_state,','),concat(',','" + lawsHomeNormalSearchDTO.getStandardState() + "',','))",0);
|
|
|
|
|
queryWrapper.gt(!StringUtils.isEmpty(lawsHomeNormalSearchDTO.getStandardCode()),"instr(concat(',',standard_code,','),concat(',','" + lawsHomeNormalSearchDTO.getStandardCode() + "',','))",0);
|
|
|
|
|
queryWrapper.gt(!StringUtils.isEmpty(lawsHomeNormalSearchDTO.getGradeClassification()),"instr(concat(',',grade_classification,','),concat(',','" + lawsHomeNormalSearchDTO.getGradeClassification() + "',','))",0);
|
|
|
|
|
LawsHomeNormalSearchStatisticsVO obj = new LawsHomeNormalSearchStatisticsVO();
|
|
|
|
|
switch (lawsHomeNormalSearchDTO.getResourceType()){
|
|
|
|
|
case LawsHomeSearchCommon.LAWS_DOMESTIC_STANDARD:
|
|
|
|
|
count1(list,obj);
|
|
|
|
|
count1(queryWrapper,obj);
|
|
|
|
|
break;
|
|
|
|
|
case LawsHomeSearchCommon.LAWS_OVERSEAS_STANDARD:
|
|
|
|
|
count2(list,obj);
|
|
|
|
|
count2(queryWrapper,obj);
|
|
|
|
|
break;
|
|
|
|
|
case LawsHomeSearchCommon.LAWS_ENTERPRISE_STANDARD:
|
|
|
|
|
count3(list,obj);
|
|
|
|
|
count3(queryWrapper,obj);
|
|
|
|
|
break;
|
|
|
|
|
default:break;
|
|
|
|
|
}
|
|
|
|
|
return obj;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void count3(List<LawsHomeNormalSearchVO> list,LawsHomeNormalSearchStatisticsVO obj) {
|
|
|
|
|
List<LawsHomeNormalSearchStatisticsObjVO> listDict = new ArrayList<>();
|
|
|
|
|
private void count3(QueryWrapper<LawsHomeNormalSearchDTO> queryWrapper,LawsHomeNormalSearchStatisticsVO obj) {
|
|
|
|
|
List<LawsHomeNormalSearchCountVO> list = lawsHomeSearchMapper.getCount2(queryWrapper);
|
|
|
|
|
// 企业标准代号
|
|
|
|
|
List<DictModel> listStandardCode = sysBaseAPI.getDictItems("enterprise_standard_code");
|
|
|
|
|
for (DictModel dict : listStandardCode) {
|
|
|
|
|
LawsHomeNormalSearchStatisticsObjVO objVO = new LawsHomeNormalSearchStatisticsObjVO();
|
|
|
|
|
objVO.setItemText(dict.getText());
|
|
|
|
|
objVO.setItemValue(dict.getValue());
|
|
|
|
|
if(CollectionUtils.isEmpty(list)){
|
|
|
|
|
objVO.setStatisticsCount("0");
|
|
|
|
|
}else{
|
|
|
|
|
long l = list.stream().filter(o->Objects.equals(o.getStandardCode(),dict.getValue())).count();
|
|
|
|
|
objVO.setStatisticsCount(String.valueOf(l));
|
|
|
|
|
}
|
|
|
|
|
listDict.add(objVO);
|
|
|
|
|
List<LawsHomeNormalSearchStatisticsObjVO> list1 = addLawsHomeNormalSearchStatistics(list, obj, "enterprise_standard_code", "standard_code");
|
|
|
|
|
if(!CollectionUtils.isEmpty(list1)){
|
|
|
|
|
obj.setStandardCode(list1);
|
|
|
|
|
}
|
|
|
|
|
obj.setStandardClass(listDict);
|
|
|
|
|
listDict = new ArrayList<>();
|
|
|
|
|
// 标准状态
|
|
|
|
|
List<DictModel> listEnterpriseStandardState = sysBaseAPI.getDictItems("enterprise_standard_state");
|
|
|
|
|
for (DictModel dict : listEnterpriseStandardState) {
|
|
|
|
|
LawsHomeNormalSearchStatisticsObjVO objVO = new LawsHomeNormalSearchStatisticsObjVO();
|
|
|
|
|
objVO.setItemText(dict.getText());
|
|
|
|
|
objVO.setItemValue(dict.getValue());
|
|
|
|
|
if(CollectionUtils.isEmpty(list)){
|
|
|
|
|
objVO.setStatisticsCount("0");
|
|
|
|
|
}else{
|
|
|
|
|
long l = list.stream().filter(o->Objects.equals(o.getEnterpriseStandardState(),dict.getValue())).count();
|
|
|
|
|
objVO.setStatisticsCount(String.valueOf(l));
|
|
|
|
|
}
|
|
|
|
|
listDict.add(objVO);
|
|
|
|
|
List<LawsHomeNormalSearchStatisticsObjVO> list2 = addLawsHomeNormalSearchStatistics(list, obj, "enterprise_standard_state", "standard_state");
|
|
|
|
|
if(!CollectionUtils.isEmpty(list2)){
|
|
|
|
|
obj.setEnterpriseStandardState(list2);
|
|
|
|
|
}
|
|
|
|
|
obj.setStandardClass(listDict);
|
|
|
|
|
listDict = new ArrayList<>();
|
|
|
|
|
// 标准等级分类
|
|
|
|
|
List<DictModel> listGradeClassification = sysBaseAPI.getDictItems("standard_grade_classify");
|
|
|
|
|
for (DictModel dict : listGradeClassification) {
|
|
|
|
|
LawsHomeNormalSearchStatisticsObjVO objVO = new LawsHomeNormalSearchStatisticsObjVO();
|
|
|
|
|
objVO.setItemText(dict.getText());
|
|
|
|
|
objVO.setItemValue(dict.getValue());
|
|
|
|
|
if(CollectionUtils.isEmpty(list)){
|
|
|
|
|
objVO.setStatisticsCount("0");
|
|
|
|
|
}else{
|
|
|
|
|
long l = list.stream().filter(o->Objects.equals(o.getGradeClassification(),dict.getValue())).count();
|
|
|
|
|
objVO.setStatisticsCount(String.valueOf(l));
|
|
|
|
|
}
|
|
|
|
|
listDict.add(objVO);
|
|
|
|
|
List<LawsHomeNormalSearchStatisticsObjVO> list3 = addLawsHomeNormalSearchStatistics(list, obj, "standard_grade_classify", "grade_classification");
|
|
|
|
|
if(!CollectionUtils.isEmpty(list3)){
|
|
|
|
|
obj.setGradeClassification(list3);
|
|
|
|
|
}
|
|
|
|
|
obj.setStandardClass(listDict);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void count2(List<LawsHomeNormalSearchVO> list,LawsHomeNormalSearchStatisticsVO obj) {
|
|
|
|
|
List<LawsHomeNormalSearchStatisticsObjVO> listDict = new ArrayList<>();
|
|
|
|
|
private void count2(QueryWrapper<LawsHomeNormalSearchDTO> queryWrapper,LawsHomeNormalSearchStatisticsVO obj) {
|
|
|
|
|
List<LawsHomeNormalSearchCountVO> list = lawsHomeSearchMapper.getCount2(queryWrapper);
|
|
|
|
|
// 标准类别
|
|
|
|
|
List<DictModel> listStandardClass = sysBaseAPI.getDictItems("standard_type_overseas");
|
|
|
|
|
addStandardClass(list, obj, listDict, listStandardClass);
|
|
|
|
|
listDict = new ArrayList<>();
|
|
|
|
|
List<LawsHomeNormalSearchStatisticsObjVO> list1 = addLawsHomeNormalSearchStatistics(list, obj, "standard_type_overseas", "standard_class");
|
|
|
|
|
if(!CollectionUtils.isEmpty(list1)){
|
|
|
|
|
obj.setStandardClass(list1);
|
|
|
|
|
}
|
|
|
|
|
// 适用车辆类型
|
|
|
|
|
List<DictModel> listApplicableVehicle = sysBaseAPI.getDictItems("APPLICATIONS_OVERSEAS");
|
|
|
|
|
for (DictModel dict : listApplicableVehicle) {
|
|
|
|
|
LawsHomeNormalSearchStatisticsObjVO objVO = new LawsHomeNormalSearchStatisticsObjVO();
|
|
|
|
|
objVO.setItemText(dict.getText());
|
|
|
|
|
objVO.setItemValue(dict.getValue());
|
|
|
|
|
if(CollectionUtils.isEmpty(list)){
|
|
|
|
|
objVO.setStatisticsCount("0");
|
|
|
|
|
}else{
|
|
|
|
|
long l = list.stream().filter(o->!StringUtils.isBlank(o.getApplicableVehicle()) && Arrays.asList(o.getApplicableVehicle().split(",")).contains(dict.getValue())).count();
|
|
|
|
|
objVO.setStatisticsCount(String.valueOf(l));
|
|
|
|
|
}
|
|
|
|
|
listDict.add(objVO);
|
|
|
|
|
List<LawsHomeNormalSearchStatisticsObjVO> list2 = addLawsHomeNormalSearchStatistics(list, obj, "APPLICATIONS_OVERSEAS", "applicable_vehicle");
|
|
|
|
|
if(!CollectionUtils.isEmpty(list2)){
|
|
|
|
|
obj.setApplicableVehicle(list2);
|
|
|
|
|
}
|
|
|
|
|
obj.setStandardClass(listDict);
|
|
|
|
|
listDict = new ArrayList<>();
|
|
|
|
|
// 状态
|
|
|
|
|
List<DictModel> listStandardState = sysBaseAPI.getDictItems("standard_state");
|
|
|
|
|
for (DictModel dict : listStandardState) {
|
|
|
|
|
LawsHomeNormalSearchStatisticsObjVO objVO = new LawsHomeNormalSearchStatisticsObjVO();
|
|
|
|
|
objVO.setItemText(dict.getText());
|
|
|
|
|
objVO.setItemValue(dict.getValue());
|
|
|
|
|
if(CollectionUtils.isEmpty(list)){
|
|
|
|
|
objVO.setStatisticsCount("0");
|
|
|
|
|
}else{
|
|
|
|
|
long l = list.stream().filter(o->Objects.equals(o.getStandardState(),dict.getValue())).count();
|
|
|
|
|
objVO.setStatisticsCount(String.valueOf(l));
|
|
|
|
|
}
|
|
|
|
|
listDict.add(objVO);
|
|
|
|
|
List<LawsHomeNormalSearchStatisticsObjVO> list3 = addLawsHomeNormalSearchStatistics(list, obj, "standard_state", "standard_state");
|
|
|
|
|
if(!CollectionUtils.isEmpty(list3)){
|
|
|
|
|
obj.setStandardState(list3);
|
|
|
|
|
}
|
|
|
|
|
obj.setStandardClass(listDict);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void count1(List<LawsHomeNormalSearchVO> list,LawsHomeNormalSearchStatisticsVO obj) {
|
|
|
|
|
List<LawsHomeNormalSearchStatisticsObjVO> listDict = new ArrayList<>();
|
|
|
|
|
private void count1(QueryWrapper<LawsHomeNormalSearchDTO> queryWrapper,LawsHomeNormalSearchStatisticsVO obj) {
|
|
|
|
|
List<LawsHomeNormalSearchCountVO> list = lawsHomeSearchMapper.getCount1(queryWrapper);
|
|
|
|
|
// 标准类别
|
|
|
|
|
List<DictModel> listStandardClass = sysBaseAPI.getDictItems("standard_type");
|
|
|
|
|
addStandardClass(list, obj, listDict, listStandardClass);
|
|
|
|
|
listDict = new ArrayList<>();
|
|
|
|
|
List<LawsHomeNormalSearchStatisticsObjVO> list1 = addLawsHomeNormalSearchStatistics(list, obj, "standard_type", "standard_class");
|
|
|
|
|
if(!CollectionUtils.isEmpty(list1)){
|
|
|
|
|
obj.setStandardClass(list1);
|
|
|
|
|
}
|
|
|
|
|
// 动力类型
|
|
|
|
|
List<DictModel> listDynamicType = sysBaseAPI.getDictItems("POWER_TYPE_DOMESTIC");
|
|
|
|
|
addDynamicType(list, obj, listDict, listDynamicType);
|
|
|
|
|
listDict = new ArrayList<>();
|
|
|
|
|
List<LawsHomeNormalSearchStatisticsObjVO> list2 = addLawsHomeNormalSearchStatistics(list, obj, "dynamic_type", "dynamic_type");
|
|
|
|
|
if(!CollectionUtils.isEmpty(list2)){
|
|
|
|
|
obj.setDynamicType(list2);
|
|
|
|
|
}
|
|
|
|
|
// 适用车辆类型
|
|
|
|
|
addApplicableVehicle(list, obj, listDict);
|
|
|
|
|
listDict = new ArrayList<>();
|
|
|
|
|
List<LawsHomeNormalSearchStatisticsObjVO> list3 = addLawsHomeNormalSearchStatistics(list, obj, "APPLICATIONS_DOMESTIC", "applicable_vehicle");
|
|
|
|
|
if(!CollectionUtils.isEmpty(list3)){
|
|
|
|
|
obj.setApplicableVehicle(list3);
|
|
|
|
|
}
|
|
|
|
|
// 标准类型
|
|
|
|
|
addStandardProperty(list, obj, listDict);
|
|
|
|
|
listDict = new ArrayList<>();
|
|
|
|
|
List<LawsHomeNormalSearchStatisticsObjVO> list4 = addLawsHomeNormalSearchStatistics(list, obj, "standard_property", "standard_property");
|
|
|
|
|
if(!CollectionUtils.isEmpty(list4)){
|
|
|
|
|
obj.setStandardProperty(list4);
|
|
|
|
|
}
|
|
|
|
|
// 状态
|
|
|
|
|
addStandardState(list, obj, listDict);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void addStandardState(List<LawsHomeNormalSearchVO> list, LawsHomeNormalSearchStatisticsVO obj, List<LawsHomeNormalSearchStatisticsObjVO> listDict) {
|
|
|
|
|
List<DictModel> listStandardState = sysBaseAPI.getDictItems("standard_state");
|
|
|
|
|
for (DictModel dict : listStandardState) {
|
|
|
|
|
LawsHomeNormalSearchStatisticsObjVO objVO = new LawsHomeNormalSearchStatisticsObjVO();
|
|
|
|
|
objVO.setItemText(dict.getText());
|
|
|
|
|
objVO.setItemValue(dict.getValue());
|
|
|
|
|
if(CollectionUtils.isEmpty(list)){
|
|
|
|
|
objVO.setStatisticsCount("0");
|
|
|
|
|
}else{
|
|
|
|
|
long l = list.stream().filter(o-> Objects.equals(o.getStandardState(),dict.getValue())).count();
|
|
|
|
|
objVO.setStatisticsCount(String.valueOf(l));
|
|
|
|
|
}
|
|
|
|
|
listDict.add(objVO);
|
|
|
|
|
List<LawsHomeNormalSearchStatisticsObjVO> list5 = addLawsHomeNormalSearchStatistics(list, obj, "standard_state", "standard_state");
|
|
|
|
|
if(!CollectionUtils.isEmpty(list5)){
|
|
|
|
|
obj.setStandardState(list5);
|
|
|
|
|
}
|
|
|
|
|
obj.setStandardState(listDict);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void addStandardProperty(List<LawsHomeNormalSearchVO> list, LawsHomeNormalSearchStatisticsVO obj, List<LawsHomeNormalSearchStatisticsObjVO> listDict) {
|
|
|
|
|
List<DictModel> listStandardProperty = sysBaseAPI.getDictItems("standard_property");
|
|
|
|
|
for (DictModel dict : listStandardProperty) {
|
|
|
|
|
LawsHomeNormalSearchStatisticsObjVO objVO = new LawsHomeNormalSearchStatisticsObjVO();
|
|
|
|
|
objVO.setItemText(dict.getText());
|
|
|
|
|
objVO.setItemValue(dict.getValue());
|
|
|
|
|
if(CollectionUtils.isEmpty(list)){
|
|
|
|
|
objVO.setStatisticsCount("0");
|
|
|
|
|
}else{
|
|
|
|
|
long l = list.stream().filter(o-> Objects.equals(o.getStandardProperty(),dict.getValue())).count();
|
|
|
|
|
objVO.setStatisticsCount(String.valueOf(l));
|
|
|
|
|
}
|
|
|
|
|
listDict.add(objVO);
|
|
|
|
|
}
|
|
|
|
|
obj.setStandardProperty(listDict);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void addDynamicType(List<LawsHomeNormalSearchVO> list, LawsHomeNormalSearchStatisticsVO obj, List<LawsHomeNormalSearchStatisticsObjVO> listDict, List<DictModel> listDynamicType) {
|
|
|
|
|
for (DictModel dict : listDynamicType) {
|
|
|
|
|
LawsHomeNormalSearchStatisticsObjVO objVO = new LawsHomeNormalSearchStatisticsObjVO();
|
|
|
|
|
objVO.setItemText(dict.getText());
|
|
|
|
|
objVO.setItemValue(dict.getValue());
|
|
|
|
|
if(CollectionUtils.isEmpty(list)){
|
|
|
|
|
objVO.setStatisticsCount("0");
|
|
|
|
|
}else{
|
|
|
|
|
long l = list.stream().filter(o->!StringUtils.isBlank(o.getDynamicType()) && Arrays.asList(o.getDynamicType().split(",")).contains(dict.getValue())).count();
|
|
|
|
|
objVO.setStatisticsCount(String.valueOf(l));
|
|
|
|
|
}
|
|
|
|
|
listDict.add(objVO);
|
|
|
|
|
}
|
|
|
|
|
obj.setDynamicType(listDict);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void addApplicableVehicle(List<LawsHomeNormalSearchVO> list, LawsHomeNormalSearchStatisticsVO obj, List<LawsHomeNormalSearchStatisticsObjVO> listDict) {
|
|
|
|
|
List<DictModel> listApplicableVehicle = sysBaseAPI.getDictItems("APPLICATIONS_DOMESTIC");
|
|
|
|
|
for (DictModel dict : listApplicableVehicle) {
|
|
|
|
|
LawsHomeNormalSearchStatisticsObjVO objVO = new LawsHomeNormalSearchStatisticsObjVO();
|
|
|
|
|
objVO.setItemText(dict.getText());
|
|
|
|
|
objVO.setItemValue(dict.getValue());
|
|
|
|
|
if(CollectionUtils.isEmpty(list)){
|
|
|
|
|
objVO.setStatisticsCount("0");
|
|
|
|
|
}else{
|
|
|
|
|
long l = list.stream().filter(o->!StringUtils.isBlank(o.getApplicableVehicle()) && Arrays.asList(o.getApplicableVehicle().split(",")).contains(dict.getValue())).count();
|
|
|
|
|
objVO.setStatisticsCount(String.valueOf(l));
|
|
|
|
|
}
|
|
|
|
|
listDict.add(objVO);
|
|
|
|
|
}
|
|
|
|
|
obj.setApplicableVehicle(listDict);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void addStandardClass(List<LawsHomeNormalSearchVO> list, LawsHomeNormalSearchStatisticsVO obj, List<LawsHomeNormalSearchStatisticsObjVO> listDict, List<DictModel> listStandardClass) {
|
|
|
|
|
private List<LawsHomeNormalSearchStatisticsObjVO> addLawsHomeNormalSearchStatistics(List<LawsHomeNormalSearchCountVO> list, LawsHomeNormalSearchStatisticsVO obj, String dictVal, String data) {
|
|
|
|
|
List<DictModel> listStandardClass = sysBaseAPI.getDictItems(dictVal);
|
|
|
|
|
List<LawsHomeNormalSearchStatisticsObjVO> listDict = new ArrayList<>();
|
|
|
|
|
for (DictModel dict : listStandardClass) {
|
|
|
|
|
LawsHomeNormalSearchStatisticsObjVO objVO = new LawsHomeNormalSearchStatisticsObjVO();
|
|
|
|
|
objVO.setItemText(dict.getText());
|
|
|
|
|
objVO.setItemValue(dict.getValue());
|
|
|
|
|
if (CollectionUtils.isEmpty(list)) {
|
|
|
|
|
Optional<LawsHomeNormalSearchCountVO> op = list.stream().filter(o -> !StringUtils.isBlank(o.getDict()) && Arrays.asList(o.getDict().split(",")).contains(dict.getValue()) && Objects.equals(o.getFieldName(),data)).findFirst();
|
|
|
|
|
if(op.isPresent()){
|
|
|
|
|
objVO.setStatisticsCount(op.get().getCount());
|
|
|
|
|
}else{
|
|
|
|
|
objVO.setStatisticsCount("0");
|
|
|
|
|
} else {
|
|
|
|
|
long l = list.stream().filter(o -> Objects.equals(o.getStandardClass(), dict.getValue())).count();
|
|
|
|
|
objVO.setStatisticsCount(String.valueOf(l));
|
|
|
|
|
}
|
|
|
|
|
listDict.add(objVO);
|
|
|
|
|
}
|
|
|
|
|
obj.setStandardClass(listDict);
|
|
|
|
|
return listDict;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public IPage<LawsHomeNormalSearchVO> getNormalSearchAllPage(LawsHomeNormalSearchDTO homeNormalSearchDTO,Integer pageNo,Integer pageSize) {
|
|
|
|
|
String searchContent = homeNormalSearchDTO.getSearchContent();
|
|
|
|
|
if(StringUtils.isBlank(searchContent)){
|
|
|
|
|
throw new JeroBootException("请输入检索内容");
|
|
|
|
|
throw new JeroBootException(ResultCommon.PLEASE_SEARCH_TO_IMPORT);
|
|
|
|
|
}
|
|
|
|
|
// 添加检索历史
|
|
|
|
|
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
|
@@ -671,11 +566,11 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
|
|
|
|
|
for (Map.Entry<String, Object> entry : mapHighlight.entrySet()) {
|
|
|
|
|
String key = entry.getKey();
|
|
|
|
|
List<String> value = (List<String>) entry.getValue();
|
|
|
|
|
String fieldConyent= "";
|
|
|
|
|
StringBuilder fieldConyent= new StringBuilder();
|
|
|
|
|
for (String s : value) {
|
|
|
|
|
fieldConyent += s;
|
|
|
|
|
fieldConyent.append(s);
|
|
|
|
|
}
|
|
|
|
|
mapSource.put(key,fieldConyent);
|
|
|
|
|
mapSource.put(key, fieldConyent.toString());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
String createTime = "";
|
|
|
|
@@ -686,7 +581,7 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
|
|
|
|
|
mapList.add(mapSource);
|
|
|
|
|
}
|
|
|
|
|
//处理分页
|
|
|
|
|
IPage page = new Page(pageNo, pageSize);
|
|
|
|
|
IPage page = new Page<>(pageNo, pageSize);
|
|
|
|
|
String total = JSON.parseObject(JSON.toJSONString(JSON.parseObject(JSON.toJSONString(search.get("hits"))).get("total"))).get("value").toString();
|
|
|
|
|
//首次搜索的结果
|
|
|
|
|
page.setTotal(Long.parseLong(total));
|
|
|
|
@@ -702,8 +597,10 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
|
|
|
|
|
list1.add("</span>");
|
|
|
|
|
mapTemp.put("pre_tags", list);
|
|
|
|
|
mapTemp.put("post_tags", list1);
|
|
|
|
|
mapTemp.put("fragment_size", 500);//高亮字段内容长度,去除html样式标签,统计字数,设置为200
|
|
|
|
|
mapTemp.put("number_of_fragments", 1);//高亮内容默认分为5段, 此处设置为一段
|
|
|
|
|
//高亮字段内容长度,去除html样式标签,统计字数,设置为200
|
|
|
|
|
mapTemp.put("fragment_size", 500);
|
|
|
|
|
//高亮内容默认分为5段, 此处设置为一段
|
|
|
|
|
mapTemp.put("number_of_fragments", 1);
|
|
|
|
|
mapTemp.put("type", "plain");
|
|
|
|
|
mapHighlight.put(key, mapTemp);
|
|
|
|
|
}
|
|
|
|
@@ -763,30 +660,28 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void updateEsData(String resourceType, String ids, String opType) {
|
|
|
|
|
if(StringUtils.isBlank(resourceType)){
|
|
|
|
|
throw new JeroBootException("资源类型不能为空");
|
|
|
|
|
}
|
|
|
|
|
if(StringUtils.isBlank(resourceType)){
|
|
|
|
|
throw new JeroBootException("资源ID不能为空");
|
|
|
|
|
}
|
|
|
|
|
if(StringUtils.isBlank(resourceType)){
|
|
|
|
|
throw new JeroBootException("操作类型不能为空");
|
|
|
|
|
if(StringUtils.isBlank(resourceType) || StringUtils.isBlank(resourceType) || StringUtils.isBlank(resourceType)){
|
|
|
|
|
throw new JeroBootException(ResultCommon.PARAMETER_NOT_RECOGNIZED);
|
|
|
|
|
}
|
|
|
|
|
log.info("================ES更新数据开始=================");
|
|
|
|
|
switch (resourceType){
|
|
|
|
|
case LawsHomeSearchCommon.LAWS_DOMESTIC_STANDARD:
|
|
|
|
|
updateLawsDomesticStandardToEs(resourceType,ids,opType);
|
|
|
|
|
break;
|
|
|
|
|
case LawsHomeSearchCommon.LAWS_OVERSEAS_STANDARD:
|
|
|
|
|
updateLawsOverseasStandardToEs(resourceType,ids,opType);
|
|
|
|
|
break;
|
|
|
|
|
case LawsHomeSearchCommon.LAWS_ENTERPRISE_STANDARD:
|
|
|
|
|
updateLawsEnterpriseStandardToEs(resourceType,ids,opType);
|
|
|
|
|
break;
|
|
|
|
|
case LawsHomeSearchCommon.LAWS_NEWS_FEED:
|
|
|
|
|
updateLawsNewsFeedToEs(resourceType,ids,opType);
|
|
|
|
|
break;
|
|
|
|
|
default:break;
|
|
|
|
|
try{
|
|
|
|
|
switch (resourceType){
|
|
|
|
|
case LawsHomeSearchCommon.LAWS_DOMESTIC_STANDARD:
|
|
|
|
|
updateLawsDomesticStandardToEs(resourceType,ids,opType);
|
|
|
|
|
break;
|
|
|
|
|
case LawsHomeSearchCommon.LAWS_OVERSEAS_STANDARD:
|
|
|
|
|
updateLawsOverseasStandardToEs(resourceType,ids,opType);
|
|
|
|
|
break;
|
|
|
|
|
case LawsHomeSearchCommon.LAWS_ENTERPRISE_STANDARD:
|
|
|
|
|
updateLawsEnterpriseStandardToEs(resourceType,ids,opType);
|
|
|
|
|
break;
|
|
|
|
|
case LawsHomeSearchCommon.LAWS_NEWS_FEED:
|
|
|
|
|
updateLawsNewsFeedToEs(resourceType,ids,opType);
|
|
|
|
|
break;
|
|
|
|
|
default:break;
|
|
|
|
|
}
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
log.error("ES同步异常",e.getMessage());
|
|
|
|
|
}
|
|
|
|
|
log.info("================ES更新数据结束=================");
|
|
|
|
|
}
|
|
|
|
@@ -849,16 +744,21 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
|
|
|
|
|
List<OSSFile> list = oSSFileService.list(ossFile);
|
|
|
|
|
List<OSSFile> listFile = new ArrayList<>();
|
|
|
|
|
if(!CollectionUtils.isEmpty(list)){
|
|
|
|
|
List<OSSFile> op = list.stream().filter(o-> Objects.equals(o.getStandardFileType(),"publish_of_original")).collect(Collectors.toList());
|
|
|
|
|
// 有发布稿
|
|
|
|
|
if(!CollectionUtils.isEmpty(op)){
|
|
|
|
|
listFile.addAll(op);
|
|
|
|
|
}else{
|
|
|
|
|
getOp(list, listFile, "modification_list");
|
|
|
|
|
getOp(list, listFile, "draft_for_review");
|
|
|
|
|
getOp(list, listFile, "draft_for_approval");
|
|
|
|
|
getOp(list, listFile, "draft_for_comment");
|
|
|
|
|
getOp(list, listFile, "draft");
|
|
|
|
|
LambdaQueryWrapper<LawsTag> query = new LambdaQueryWrapper<>();
|
|
|
|
|
query.eq(LawsTag::getTableName,"laws_domestic_standard");
|
|
|
|
|
query.isNotNull(LawsTag::getHomeSearchFileOrder);
|
|
|
|
|
query.orderByAsc(LawsTag::getHomeSearchFileOrder);
|
|
|
|
|
List<LawsTag> listLawsTag = lawsTagService.list(query);
|
|
|
|
|
if(!CollectionUtils.isEmpty(listLawsTag)){
|
|
|
|
|
List<OSSFile> op = list.stream().filter(o-> Objects.equals(o.getStandardFileType(),listLawsTag.get(0).getDbFieldName())).collect(Collectors.toList());
|
|
|
|
|
// 有发布稿
|
|
|
|
|
if(!CollectionUtils.isEmpty(op)){
|
|
|
|
|
listFile.addAll(op);
|
|
|
|
|
}else{
|
|
|
|
|
for (int i = 1; i < listLawsTag.size(); i++) {
|
|
|
|
|
getOp(list, listFile, listLawsTag.get(i).getDbFieldName());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return listFile;
|
|
|
|
@@ -926,22 +826,27 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
|
|
|
|
|
List<OSSFile> list = oSSFileService.list(ossFile);
|
|
|
|
|
List<OSSFile> listFile = new ArrayList<>();
|
|
|
|
|
if(!CollectionUtils.isEmpty(list)){
|
|
|
|
|
List<OSSFile> op = list.stream().filter(o-> Objects.equals(o.getStandardFileType(),"publish_of_original")).collect(Collectors.toList());
|
|
|
|
|
List<OSSFile> opTr = list.stream().filter(o-> Objects.equals(o.getStandardFileType(),"publish_of_translation")).collect(Collectors.toList());
|
|
|
|
|
// 有发布稿
|
|
|
|
|
if(!CollectionUtils.isEmpty(op) || !CollectionUtils.isEmpty(opTr)){
|
|
|
|
|
if(!CollectionUtils.isEmpty(op)){
|
|
|
|
|
listFile.addAll(op);
|
|
|
|
|
LambdaQueryWrapper<LawsTag> query = new LambdaQueryWrapper<>();
|
|
|
|
|
query.eq(LawsTag::getTableName,"laws_overseas_standard");
|
|
|
|
|
query.isNotNull(LawsTag::getHomeSearchFileOrder);
|
|
|
|
|
query.orderByAsc(LawsTag::getHomeSearchFileOrder);
|
|
|
|
|
List<LawsTag> listLawsTag = lawsTagService.list(query);
|
|
|
|
|
if(!CollectionUtils.isEmpty(listLawsTag)){
|
|
|
|
|
List<OSSFile> op = list.stream().filter(o-> Objects.equals(o.getStandardFileType(),listLawsTag.get(0).getDbFieldName())).collect(Collectors.toList());
|
|
|
|
|
List<OSSFile> opTr = list.stream().filter(o-> Objects.equals(o.getStandardFileType(),listLawsTag.get(1).getDbFieldName())).collect(Collectors.toList());
|
|
|
|
|
// 有发布稿
|
|
|
|
|
if(!CollectionUtils.isEmpty(op) || !CollectionUtils.isEmpty(opTr)){
|
|
|
|
|
if(!CollectionUtils.isEmpty(op)){
|
|
|
|
|
listFile.addAll(op);
|
|
|
|
|
}
|
|
|
|
|
if(!CollectionUtils.isEmpty(opTr)){
|
|
|
|
|
listFile.addAll(opTr);
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
for (int i = 2; i < listLawsTag.size(); i++) {
|
|
|
|
|
getOp(list, listFile, listLawsTag.get(i).getDbFieldName());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(!CollectionUtils.isEmpty(opTr)){
|
|
|
|
|
listFile.addAll(opTr);
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
getOp(list, listFile, "modification_list");
|
|
|
|
|
getOp(list, listFile, "draft_for_review");
|
|
|
|
|
getOp(list, listFile, "draft_for_approval");
|
|
|
|
|
getOp(list, listFile, "draft_for_comment");
|
|
|
|
|
getOp(list, listFile, "draft");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return listFile;
|
|
|
|
@@ -998,15 +903,21 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
|
|
|
|
|
List<OSSFile> list = oSSFileService.list(ossFile);
|
|
|
|
|
List<OSSFile> listFile = new ArrayList<>();
|
|
|
|
|
if(!CollectionUtils.isEmpty(list)){
|
|
|
|
|
List<OSSFile> op = list.stream().filter(o-> Objects.equals(o.getStandardFileType(),"publish_of_original")).collect(Collectors.toList());
|
|
|
|
|
// 有发布稿
|
|
|
|
|
if(!CollectionUtils.isEmpty(op)){
|
|
|
|
|
listFile.addAll(op);
|
|
|
|
|
}else{
|
|
|
|
|
getOp(list, listFile, "modification_list");
|
|
|
|
|
getOp(list, listFile, "draft_for_review");
|
|
|
|
|
getOp(list, listFile, "draft_for_comment");
|
|
|
|
|
getOp(list, listFile, "draft");
|
|
|
|
|
LambdaQueryWrapper<LawsTag> query = new LambdaQueryWrapper<>();
|
|
|
|
|
query.eq(LawsTag::getTableName,"laws_enterprise_standard");
|
|
|
|
|
query.isNotNull(LawsTag::getHomeSearchFileOrder);
|
|
|
|
|
query.orderByAsc(LawsTag::getHomeSearchFileOrder);
|
|
|
|
|
List<LawsTag> listLawsTag = lawsTagService.list(query);
|
|
|
|
|
if(!CollectionUtils.isEmpty(listLawsTag)){
|
|
|
|
|
List<OSSFile> op = list.stream().filter(o-> Objects.equals(o.getStandardFileType(),listLawsTag.get(0).getDbFieldName())).collect(Collectors.toList());
|
|
|
|
|
// 有发布稿
|
|
|
|
|
if(!CollectionUtils.isEmpty(op)){
|
|
|
|
|
listFile.addAll(op);
|
|
|
|
|
}else{
|
|
|
|
|
for (int i = 1; i < listLawsTag.size(); i++) {
|
|
|
|
|
getOp(list, listFile, listLawsTag.get(i).getDbFieldName());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return listFile;
|
|
|
|
@@ -1106,7 +1017,7 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
|
|
|
|
|
map.put("standard_property", obj.getStandardProperty());
|
|
|
|
|
map.put("standard_state", obj.getStandardState());
|
|
|
|
|
map.put("standard_code",obj.getStandardCode());
|
|
|
|
|
map.put("enterpriseStandardState",obj.getEnterpriseStandardState());
|
|
|
|
|
map.put("enterprise_standard_state",obj.getEnterpriseStandardState());
|
|
|
|
|
map.put("grade_classification",obj.getGradeClassification());
|
|
|
|
|
map.put("standard_type",obj.getStandardType());
|
|
|
|
|
map.put("create_time",new Date());
|
|
|
|
|