Commit 87f17677 authored by tianyiming's avatar tianyiming

一码通使用es

parent a47bd1a0
......@@ -31,4 +31,6 @@ public interface CategoryOtherInfoMapper extends BaseMapper<CategoryOtherInfo> {
Map<String, Object> selectDataById(String id);
CategoryOtherInfo queryInitCode(@Param("initCode") @NonNull String initCode);
void updateEsStatus(String id);
}
......@@ -47,7 +47,7 @@ public interface EquipmentCategoryMapper extends BaseMapper<EquipmentCategory> {
String getUnitCodeByRecord(String record);
List<UseUnitCreditCodeCategoryDto> useUnitCreditCodeCategoryCount();
List<UseUnitCreditCodeCategoryDto> useUnitCreditCodeCategoryCount(@Param("unitCodes") List<String> unitCodes, @Param("orgBranchCodes") List<String> orgBranchCodes);
List<EquipExportVo> getEquipExportData(@Param("dto") EquipExportDto dto);
......
......@@ -50,6 +50,7 @@
</select>
<select id="selectDataById" resultType="java.util.Map">
SELECT SEQUENCE_NBR,
REC_DATE,
ORG_BRANCH_NAME,
ORG_BRANCH_CODE,
USE_UNIT_NAME,
......@@ -61,7 +62,7 @@
CODE96333,
EQU_CODE,
SUPERVISORY_CODE,
USE_PLACE ,
USE_PLACE,
ADDRESS,
EQU_STATE,
STATUS
......@@ -92,4 +93,10 @@
SET "EDIT_STATUS" = #{editStatus}
WHERE "SUPERVISORY_CODE" = #{supervisorCode}
</update>
<update id="updateEsStatus">
UPDATE idx_biz_jg_use_info
SET "IS_NOT_ES" = '1'
WHERE "RECORD" = #{id}
</update>
</mapper>
......@@ -306,21 +306,33 @@
<select id="useUnitCreditCodeCategoryCount" resultType="com.yeejoin.amos.boot.module.ymt.api.dto.UseUnitCreditCodeCategoryDto">
SELECT
ibjsi."ORG_BRANCH_CODE",
ibjui."USE_UNIT_CREDIT_CODE",
ibjoi."CLAIM_STATUS",
ibjri."EQU_LIST",
COUNT ( * ) as TOTAL
ibjsi."ORG_BRANCH_CODE",
ibjui."USE_UNIT_CREDIT_CODE",
ibjoi."CLAIM_STATUS",
ibjri."EQU_LIST",
COUNT ( * ) as TOTAL
FROM
idx_biz_jg_use_info ibjui
LEFT JOIN idx_biz_jg_register_info ibjri ON ibjui.RECORD = ibjri.RECORD
LEFT JOIN idx_biz_jg_other_info ibjoi ON ibjui.RECORD = ibjoi.RECORD
LEFT JOIN idx_biz_jg_supervision_info ibjsi ON ibjsi."RECORD" = ibjui."RECORD"
idx_biz_jg_use_info ibjui
LEFT JOIN idx_biz_jg_register_info ibjri ON ibjui.RECORD = ibjri.RECORD
LEFT JOIN idx_biz_jg_other_info ibjoi ON ibjui.RECORD = ibjoi.RECORD
LEFT JOIN idx_biz_jg_supervision_info ibjsi ON ibjsi."RECORD" = ibjui."RECORD"
where
ibjoi."CLAIM_STATUS" <![CDATA[ <> ]]> ''
and ibjui."USE_UNIT_CREDIT_CODE" <![CDATA[ <> ]]> ''
and ibjri."EQU_LIST" <![CDATA[ <> ]]> ''
GROUP BY ibjui."USE_UNIT_CREDIT_CODE",ibjsi."ORG_BRANCH_CODE", ibjoi."CLAIM_STATUS",ibjri."EQU_LIST"
ibjoi."CLAIM_STATUS" <![CDATA[ <> ]]> ''
and ibjui."USE_UNIT_CREDIT_CODE" <![CDATA[ <> ]]> ''
and ibjri."EQU_LIST" <![CDATA[ <> ]]> ''
<if test="unitCodes !=null and unitCodes.size>0">
and ibjui.USE_UNIT_CREDIT_CODE in
<foreach collection="unitCodes" separator="," item="unitCode" open="(" close=")">
#{unitCode}
</foreach>
</if>
<if test="orgBranchCodes !=null and orgBranchCodes.size>0">
and ibjsi.ORG_BRANCH_CODE in
<foreach collection="orgBranchCodes" separator="," item="orgBranchCode" open="(" close=")">
#{orgBranchCode}
</foreach>
</if>
GROUP BY ibjui."USE_UNIT_CREDIT_CODE",ibjsi."ORG_BRANCH_CODE", ibjoi."CLAIM_STATUS",ibjri."EQU_LIST"
</select>
<select id="getEquipExportData" resultType="com.yeejoin.amos.boot.module.ymt.api.vo.EquipExportVo">
select ORG_BRANCH_NAME as orgBranchName,
......
......@@ -368,9 +368,9 @@ public class EquipmentCategoryController extends BaseController {
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@GetMapping(value = "/test")
@ApiOperation(httpMethod = "GET", value = "test", notes = "test")
public ResponseModel<String> test() {
@GetMapping(value = "saveEquipmentCategoryToEs")
@ApiOperation(httpMethod = "GET", value = "一码通数据初始化至es", notes = "一码通数据初始化至es")
public ResponseModel<String> saveEquipmentCategoryToEs() {
equipmentCategoryServiceImpl.saveEs();
return ResponseHelper.buildResponse("success");
}
......
......@@ -291,7 +291,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
elevatorCode = EquipmentCategoryEnum.BF.getCode().equals(equInfoDto.getEquState()) ? null : codeMap.get("code96333");
List<CategoryOtherInfo> categoryOtherInfo = categoryOtherInfoMapper.selectList(new QueryWrapper<CategoryOtherInfo>().eq("SUPERVISORY_CODE", supervisorCode));
if (categoryOtherInfo.size() > 0) {
supervisoryCodeInfoMapper.update(supervisoryCodeInfo,new QueryWrapper<SupervisoryCodeInfo>().eq("supervisory_code",supervisoryCodeInfo.getSupervisoryCode()));
supervisoryCodeInfoMapper.update(supervisoryCodeInfo, new QueryWrapper<SupervisoryCodeInfo>().eq("supervisory_code", supervisoryCodeInfo.getSupervisoryCode()));
} else {
supervisoryCodeInfo.setStatus(equState);
supervisoryCodeInfoMapper.insert(supervisoryCodeInfo);
......@@ -313,7 +313,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
@Override
public List<LinkedHashMap> creatTree() {
FeignClientResult tree = privilegeFeginService.tree(RequestContext.getToken(),RequestContext.getAppKey(),RequestContext.getProduct());
FeignClientResult tree = privilegeFeginService.tree(RequestContext.getToken(), RequestContext.getAppKey(), RequestContext.getProduct());
List<LinkedHashMap> result = (List<LinkedHashMap>) tree.getResult();
List<LinkedHashMap> treeData = deleteRegulatorTreeData(result);
List<LinkedHashMap> supervisionTree = treeData.stream().filter(e -> code.equals(e.get("orgCode"))).collect(Collectors.toList());
......@@ -455,8 +455,8 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
/**
* 具体生成监管码和电梯96333识别码逻辑
*/
@Transactional(rollbackFor = Exception.class,propagation = Propagation.REQUIRES_NEW)
public synchronized Map<String, String> creatCode(String city, String county, String equipCategory, String code96333,String supervisionCode) {
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW)
public synchronized Map<String, String> creatCode(String city, String county, String equipCategory, String code96333, String supervisionCode) {
Map<String, String> resultMap = new HashMap<>();
StringBuilder supervisorCode = new StringBuilder();
StringBuilder elevatorCode = new StringBuilder();
......@@ -465,25 +465,25 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
//判断是否需要生成96333电梯码
if (equipCategory.startsWith("3") && !XIAN.equals(city)) {
//判断数据是否携带96333电梯码,携带则使用,不携带则生成
if("null".equals(code96333)){
if ("null".equals(code96333)) {
Map<String, Object> elevatorMap = equipmentCategoryMapper.getAdministrativeDivision(EquipmentCategoryEnum.XZQHDT.getCode(), county);
prefix = ObjectUtils.isEmpty(elevatorMap) ? equipmentCategoryMapper.getAdministrativeDivision(EquipmentCategoryEnum.XZQHDT.getCode(), city).get("code").toString() : elevatorMap.get("code").toString();
//查询未使用的电梯码
categoryOtherInfo = categoryOtherInfoMapper.selectElevatorCode(prefix, EquipmentCategoryEnum.WSY.getCode());
//如果存在未使用的电梯码则启用未使用的否则创建
String elevator = ObjectUtils.isEmpty(categoryOtherInfo) ? createElevatorCode(prefix) : categoryOtherInfo.getCode();
if(!ObjectUtils.isEmpty(categoryOtherInfo)){
supervisoryCodeInfoMapper.delete(new QueryWrapper<SupervisoryCodeInfo>().eq("code96333",categoryOtherInfo.getCode()));
if (!ObjectUtils.isEmpty(categoryOtherInfo)) {
supervisoryCodeInfoMapper.delete(new QueryWrapper<SupervisoryCodeInfo>().eq("code96333", categoryOtherInfo.getCode()));
}
elevatorCode.append(elevator);
resultMap.put("creatStatus",CREATE);
resultMap.put("creatStatus", CREATE);
} else {
elevatorCode.append(code96333);
resultMap.put("creatStatus",NOT_CREATE);
resultMap.put("creatStatus", NOT_CREATE);
}
}
//判断原数据是否存在监管码,存在则用原监管码即可,不存在则生成
if("null".equals(supervisionCode)){
if ("null".equals(supervisionCode)) {
String supervisor = createSupervisorCode(city, county, equipCategory);
supervisorCode.append(supervisor);
} else {
......@@ -502,12 +502,12 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
supervisoryCodeInfo.setCreateStatus(resultMap.get("creatStatus"));
supervisoryCodeInfo.setSupervisoryCode(String.valueOf(supervisorCode));
supervisoryCodeInfo.setStatus(equState);
if(ObjectUtils.isEmpty(selectOne)){
if (ObjectUtils.isEmpty(selectOne)) {
supervisoryCodeInfoMapper.insert(supervisoryCodeInfo);
} else {
selectOne.setCode96333(String.valueOf(elevatorCode));
supervisoryCodeInfoMapper.update(selectOne,
new QueryWrapper<SupervisoryCodeInfo>().eq("supervisory_code",selectOne.getSupervisoryCode()));
new QueryWrapper<SupervisoryCodeInfo>().eq("supervisory_code", selectOne.getSupervisoryCode()));
}
resultMap.put("superviseCode", ObjectUtils.isEmpty(supervisorCode) ? null : supervisorCode.toString());
resultMap.put("code96333", ObjectUtils.isEmpty(elevatorCode) ? null : elevatorCode.toString());
......@@ -556,7 +556,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
/**
* 生成96333电梯识别码
*
* @param prefix 电梯码前缀
* @param prefix 电梯码前缀
* @return 96333电梯识别码
*/
public String createElevatorCode(String prefix) {
......@@ -772,7 +772,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
return list;
}
public List<EquipExportVo> getEquipExportData(EquipExportDto dto){
public List<EquipExportVo> getEquipExportData(EquipExportDto dto) {
ArrayList<EquipExportVo> list = new ArrayList<>();
List<JSONObject> objectList = getCompanyType();
if (!ValidationUtil.isEmpty(dto.getEQU_STATE())) {
......@@ -791,7 +791,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
dto.setORG_BRANCH_CODE(orgCode);
}
List<EquipExportVo> equipExportData = equipmentCategoryMapper.getEquipExportData(dto);
if (!ObjectUtils.isEmpty(equipExportData) ) {
if (!ObjectUtils.isEmpty(equipExportData)) {
list.addAll(equipExportData);
}
}
......@@ -844,30 +844,28 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
@Override
public void checkEsData(String id) {
Map<String, Object> map = categoryOtherInfoMapper.selectDataById(id);
UseInfo useInfo = new UseInfo();
useInfo.setIsNotEs(1);
useInfoMapper.update(useInfo, new QueryWrapper<UseInfo>().eq("RECORD", id));
categoryOtherInfoMapper.updateEsStatus(id);
ESEquipmentCategoryDto dto = JSON.parseObject(toJSONString(map), ESEquipmentCategoryDto.class);
Optional<ESEquipmentCategoryDto> data = esEquipmentCategory.findById(id);
if (!ObjectUtils.isEmpty(data)) {
esEquipmentCategory.deleteById(id);
}
if (!ObjectUtils.isEmpty(dto)) {
dto.setREC_DATE(System.currentTimeMillis());
long time = Timestamp.valueOf(map.get("REC_DATE").toString().substring(0, 19)).getTime();
dto.setREC_DATE(time);
esEquipmentCategory.save(dto);
}
}
@Override
@Async
public void createEquipmentCategoryData() {
if(log.isInfoEnabled()){
if (log.isInfoEnabled()) {
log.info("初始化一码通总览数据开始");
}
equipmentCategoryDataService.remove(new QueryWrapper<>());
getCategoryData(null,null);
getCategoryData(null, null);
}
private List<EquipmentCategoryData> getCategoryData(List<String> unitCodes, List<String> orgBranchCodes) {
......@@ -875,21 +873,21 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
stopWatch.start();
List<EquipmentCategoryData> list = new ArrayList<>();
// 查询所有单位
List<Map<String, Object>> allUnitList = equipmentCategoryMapper.getAllUnit(unitCodes,orgBranchCodes);
List<Map<String, Object>> allUnitList = equipmentCategoryMapper.getAllUnit(unitCodes, orgBranchCodes);
// 统计查询不同单位、不同装备定义、不同状态下的设备数量
List<UseUnitCreditCodeCategoryDto> equipCountList = equipmentCategoryMapper.useUnitCreditCodeCategoryCount();
List<UseUnitCreditCodeCategoryDto> equipCountList = equipmentCategoryMapper.useUnitCreditCodeCategoryCount(unitCodes, orgBranchCodes);
// 查询8大类设备定义
List<EquipmentCategory> equipmentCategories = getEquipmentCategories();
// 组织EquipmentCategoryData表数据
for (Map<String, Object> map : allUnitList) {
EquipmentCategoryData equipmentCategoryData = new EquipmentCategoryData();
if(ObjectUtils.isEmpty(map.get("supervise_org_code")) || ObjectUtils.isEmpty(map.get(USE_CODE))){
if (ObjectUtils.isEmpty(map.get("supervise_org_code")) || ObjectUtils.isEmpty(map.get(USE_CODE))) {
continue;
}
equipmentCategoryData.setOrgBranchCode(map.get("supervise_org_code").toString());
equipmentCategoryData.setUnitCode(map.get(USE_CODE).toString());
// 指定单位的设备统计信息
List<UseUnitCreditCodeCategoryDto> unitEquipCountList = equipCountList.stream().filter(r->map.get(USE_CODE).toString().equals(r.getUseUnitCreditCode())).collect(Collectors.toList());
List<UseUnitCreditCodeCategoryDto> unitEquipCountList = equipCountList.stream().filter(r -> map.get(USE_CODE).toString().equals(r.getUseUnitCreditCode())).collect(Collectors.toList());
if (!ObjectUtils.isEmpty(unitEquipCountList)) {
unitEquipCountList = unitEquipCountList.stream().filter(r -> map.get(ORG_BRANCH_CODE).toString().equals(r.getOrgBranchCode())).collect(Collectors.toList());
for (EquipmentCategory category : equipmentCategories) {
......@@ -903,13 +901,13 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
list.add(equipmentCategoryData);
}
}
if(!ObjectUtils.isEmpty(unitCodes)){
equipmentCategoryDataMapper.delete(new QueryWrapper<EquipmentCategoryData>().in("unit_code",unitCodes));
if (!ObjectUtils.isEmpty(unitCodes)) {
equipmentCategoryDataMapper.delete(new QueryWrapper<EquipmentCategoryData>().in("unit_code", unitCodes));
}
equipmentCategoryDataService.saveOrUpdateBatch(list);
stopWatch.stop();
if(log.isInfoEnabled()){
log.info("总览数据刷新结束,耗时:{} 秒",stopWatch.getTotalTimeSeconds());
if (log.isInfoEnabled()) {
log.info("总览数据刷新结束,耗时:{} 秒", stopWatch.getTotalTimeSeconds());
}
return list;
}
......@@ -948,19 +946,19 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
private List<EquipmentCategory> getEquipmentCategories() {
LambdaQueryWrapper<EquipmentCategory> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.likeLeft(EquipmentCategory::getCode,"000");
lambdaQueryWrapper.ne(EquipmentCategory::getCode,"7000");
lambdaQueryWrapper.ne(EquipmentCategory::getCode,"F000");
lambdaQueryWrapper.likeLeft(EquipmentCategory::getCode, "000");
lambdaQueryWrapper.ne(EquipmentCategory::getCode, "7000");
lambdaQueryWrapper.ne(EquipmentCategory::getCode, "F000");
return equipmentCategoryMapper.selectList(lambdaQueryWrapper);
}
private List<EquipmentCategoryData> updateEquipmentCategoryData(String unitCode,String orgBranchCode) {
private List<EquipmentCategoryData> updateEquipmentCategoryData(String unitCode, String orgBranchCode) {
List<String> unitCodeList = new ArrayList<>();
unitCodeList.add(unitCode);
List<String> orgBranchCodeList = new ArrayList<>();
orgBranchCodeList.add(orgBranchCode);
List<EquipmentCategoryData> equipmentCategoryData = getCategoryData(unitCodeList,null);
List<EquipmentCategoryData> equipmentCategoryData = getCategoryData(unitCodeList, orgBranchCodeList);
return equipmentCategoryData;
}
......@@ -971,7 +969,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
List<String> records = new ArrayList<>();
List<ESEquipmentCategoryDto> list = new ArrayList<>();
if(recordList.toString().contains("[")){
if (recordList.toString().contains("[")) {
for (String record : (List<String>) recordList) {
records.add(record);
ESEquipmentCategoryDto esEquipmentCategoryDto = new ESEquipmentCategoryDto();
......@@ -994,15 +992,15 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
orgBranchCodeList.add(String.valueOf(objectMap.get("orgBranchCode")));
}
if(!ObjectUtils.isEmpty(superviseCodeList)){
if (!ObjectUtils.isEmpty(superviseCodeList)) {
supervisoryCodeInfoMapper.updateStatus(superviseCodeList);
}
//删除涉及的19张表的数据
superviseInfoMapper.deleteDataAll(records);
// 根据统一信用代码更新总览表
if(!ObjectUtils.isEmpty(unitCodeList)){
getCategoryData(unitCodeList,orgBranchCodeList);
if (!ObjectUtils.isEmpty(unitCodeList)) {
getCategoryData(unitCodeList, orgBranchCodeList);
}
//删除es中的数据
esEquipmentCategory.deleteAll(list);
......@@ -1065,11 +1063,11 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
responseModel = idxFeignService.batchUpdate(null, null, map);
}
stopWatch.stop();
if(log.isInfoEnabled()){
log.info("通用提交耗时:{} 秒",stopWatch.getTotalTimeSeconds());
if (log.isInfoEnabled()) {
log.info("通用提交耗时:{} 秒", stopWatch.getTotalTimeSeconds());
}
} catch (Exception e) {
log.error(e.getMessage(),e);
log.error(e.getMessage(), e);
supervisoryCodeInfo.setStatus(EquipmentCategoryEnum.BF.getCode());
ResponseModel<Object> response = new ResponseModel<>();
response.setDevMessage(e.getMessage());
......@@ -1080,8 +1078,12 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
} finally {
log.info("已生成对应监管码" + supervisionMap.get("SUPERVISORY_CODE"));
log.info("已生成对应96333电梯识别码" + supervisionMap.get("CODE96333"));
updateEquipmentCategoryData(unitCode,orgBranchCode);
supervisoryCodeInfoMapper.update(supervisoryCodeInfo,new QueryWrapper<SupervisoryCodeInfo>().eq("supervisory_code",supervisionMap.get("SUPERVISORY_CODE")));
if (!ObjectUtils.isEmpty(responseModel) && "200".equals(String.valueOf(responseModel.getStatus()))) {
log.info("responseModel.getResult().toString()->>>>>>>>>>>>>>",responseModel.getResult().toString());
checkEsData(responseModel.getResult().toString());
}
updateEquipmentCategoryData(unitCode, orgBranchCode);
supervisoryCodeInfoMapper.update(supervisoryCodeInfo, new QueryWrapper<SupervisoryCodeInfo>().eq("supervisory_code", supervisionMap.get("SUPERVISORY_CODE")));
}
return responseModel;
}
......@@ -1113,6 +1115,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
Long count = bizJdbcTemplate.queryForObject(countSql, Long.class);
return count;
}
/**
* es数据同步
*
......@@ -1136,11 +1139,6 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
Page<Map<String, Object>> page = getAll(map);
total = total + page.getTotal();
saveBatchEquipment2Es(page.getRecords());
// for (Map<String, Object> record : page.getRecords()) {
// if (ValidationUtil.isEmpty(record.get("IS_NOT_ES"))) {
// saveESEquipmentCategory(record);
// }
// }
}
long end = System.currentTimeMillis();
log.info("本次一码通同步设备数据:【" + total + "】条,耗时:" + (end - start) + " 毫秒");
......@@ -1184,26 +1182,6 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
System.out.println("批量更新1000条业务数据耗时:" + cost1);
}
/**
* es保存设备数据
*/
public ESEquipmentCategoryDto saveESEquipmentCategory(Map<String, Object> map) {
//处理时间问题
String recDate1 = map.get("REC_DATE").toString().substring(0,19);
long time = Timestamp.valueOf(recDate1).getTime();
map.put("REC_DATE",time);
ESEquipmentCategoryDto dto = JSONObject.parseObject(toJSONString(map), ESEquipmentCategoryDto.class);
ESEquipmentCategoryDto save = esEquipmentCategory.save(dto);
if (!ObjectUtils.isEmpty(save)) {
//同步到es后修改
UseInfo useInfo = new UseInfo();
useInfo.setIsNotEs(1);
useInfoMapper.update(useInfo, new QueryWrapper<UseInfo>().eq("RECORD",
map.get("SEQUENCE_NBR").toString()));
}
return save;
}
public Page<JSONObject> queryByKeys(JSONObject map) {
//根据当前登录人查询
if (!ValidationUtil.isEmpty(map.get(EQUSTATE))) {
......@@ -1246,12 +1224,12 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
//SEQUENCE_NBR
if (!ObjectUtils.isEmpty(map.getString("SEQUENCE_NBR"))) {
BoolQueryBuilder meBuilder = QueryBuilders.boolQuery();
meBuilder.must(QueryBuilders.matchPhraseQuery("SEQUENCE_NBR", "*"+map.getString("SEQUENCE_NBR")+"*"));
meBuilder.must(QueryBuilders.matchPhraseQuery("SEQUENCE_NBR", "*" + map.getString("SEQUENCE_NBR") + "*"));
boolMust.must(meBuilder);
}
if (!ObjectUtils.isEmpty(map.getString("ORG_BRANCH_NAME"))) {
BoolQueryBuilder query = QueryBuilders.boolQuery();
query.must(QueryBuilders.matchPhraseQuery("ORG_BRANCH_NAME", "*"+map.getString("ORG_BRANCH_NAME")+"*" ));
query.must(QueryBuilders.matchPhraseQuery("ORG_BRANCH_NAME", "*" + map.getString("ORG_BRANCH_NAME") + "*"));
boolMust.must(query);
}
if (!ObjectUtils.isEmpty(map.getString("ORG_BRANCH_CODE"))) {
......@@ -1261,12 +1239,12 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
}
if (!ObjectUtils.isEmpty(map.getString("USE_UNIT_NAME"))) {
BoolQueryBuilder query = QueryBuilders.boolQuery();
query.must(QueryBuilders.matchPhraseQuery("USE_UNIT_NAME", "*"+map.getString("USE_UNIT_NAME")+"*"));
query.must(QueryBuilders.matchPhraseQuery("USE_UNIT_NAME", "*" + map.getString("USE_UNIT_NAME") + "*"));
boolMust.must(query);
}
if (!ObjectUtils.isEmpty(map.getString("USE_UNIT_CREDIT_CODE"))) {
BoolQueryBuilder meBuilder = QueryBuilders.boolQuery();
meBuilder.must(QueryBuilders.matchPhraseQuery("USE_UNIT_CREDIT_CODE", "*"+map.getString("USE_UNIT_CREDIT_CODE")+"*"));
meBuilder.must(QueryBuilders.matchPhraseQuery("USE_UNIT_CREDIT_CODE", "*" + map.getString("USE_UNIT_CREDIT_CODE") + "*"));
boolMust.must(meBuilder);
}
if (!ObjectUtils.isEmpty(map.getString("EQU_LIST_CODE"))) {
......@@ -1276,23 +1254,23 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
}
if (!ObjectUtils.isEmpty(map.getString("EQU_LIST"))) {
BoolQueryBuilder meBuilder = QueryBuilders.boolQuery();
meBuilder.must(QueryBuilders.matchPhraseQuery("EQU_LIST", "*"+map.getString("EQU_LIST")+"*"));
meBuilder.must(QueryBuilders.matchPhraseQuery("EQU_LIST", "*" + map.getString("EQU_LIST") + "*"));
boolMust.must(meBuilder);
}
if (!ObjectUtils.isEmpty(map.getString("EQU_CATEGORY"))) {
BoolQueryBuilder meBuilder = QueryBuilders.boolQuery();
meBuilder.must(QueryBuilders.matchPhraseQuery("EQU_CATEGORY", "*"+map.getString("EQU_CATEGORY")+"*"));
meBuilder.must(QueryBuilders.matchPhraseQuery("EQU_CATEGORY", "*" + map.getString("EQU_CATEGORY") + "*"));
boolMust.must(meBuilder);
}
if (!ObjectUtils.isEmpty(map.getString("USE_ORG_CODE"))) {
BoolQueryBuilder meBuilder = QueryBuilders.boolQuery();
meBuilder.must(QueryBuilders.wildcardQuery("USE_ORG_CODE", "*"+map.getString("USE_ORG_CODE").toLowerCase()+"*"));
meBuilder.must(QueryBuilders.wildcardQuery("USE_ORG_CODE", "*" + map.getString("USE_ORG_CODE").toLowerCase() + "*"));
boolMust.must(meBuilder);
}
if (!ObjectUtils.isEmpty(map.getString("CODE96333"))) {
BoolQueryBuilder meBuilder = QueryBuilders.boolQuery();
meBuilder.must(QueryBuilders.wildcardQuery("CODE96333", "*"+map.getString("CODE96333").toLowerCase()+"*"));
meBuilder.must(QueryBuilders.wildcardQuery("CODE96333", "*" + map.getString("CODE96333").toLowerCase() + "*"));
boolMust.must(meBuilder);
}
if (!ObjectUtils.isEmpty(map.getString("EQU_CODE"))) {
......@@ -1303,7 +1281,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
if (!ObjectUtils.isEmpty(map.getString("SUPERVISORY_CODE"))) {
BoolQueryBuilder meBuilder = QueryBuilders.boolQuery();
meBuilder.must(QueryBuilders.wildcardQuery("SUPERVISORY_CODE", "*"+map.getString("SUPERVISORY_CODE").toLowerCase()+"*"));
meBuilder.must(QueryBuilders.wildcardQuery("SUPERVISORY_CODE", "*" + map.getString("SUPERVISORY_CODE").toLowerCase() + "*"));
boolMust.must(meBuilder);
}
if (!ObjectUtils.isEmpty(map.getString("USE_PLACE"))) {
......@@ -1316,14 +1294,14 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
query.must(QueryBuilders.matchPhraseQuery("ADDRESS", "*" + map.getString("ADDRESS") + "*"));
boolMust.must(query);
}
if (!ObjectUtils.isEmpty(map.getString("EQU_STATE")) ) {
if (!ObjectUtils.isEmpty(map.getString("EQU_STATE"))) {
BoolQueryBuilder meBuilder = QueryBuilders.boolQuery();
meBuilder.must(QueryBuilders.matchQuery("EQU_STATE", map.getLong("EQU_STATE")));
boolMust.must(meBuilder);
}
if (!ObjectUtils.isEmpty(map.getString("STATUS"))) {
BoolQueryBuilder meBuilder = QueryBuilders.boolQuery();
meBuilder.must(QueryBuilders.matchPhraseQuery("STATUS", "*"+map.getString("STATUS")+"*"));
meBuilder.must(QueryBuilders.matchPhraseQuery("STATUS", "*" + map.getString("STATUS") + "*"));
boolMust.must(meBuilder);
}
builder.query(boolMust);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment