bug: 搜索中心字段排序问题
This commit is contained in:
@@ -1,12 +1,17 @@
|
|||||||
package com.adc.da.mq;
|
package com.adc.da.mq;
|
||||||
|
|
||||||
import com.adc.da.slrs.otSvpps.service.IOtSvppsService;
|
import com.adc.da.slrs.otSvpps.service.IOtSvppsService;
|
||||||
|
import com.adc.da.slrs.sarBussStandMenu.entity.SarBussStandMenu;
|
||||||
|
import com.adc.da.slrs.sarBussStandMenu.service.ISarBussStandMenuService;
|
||||||
import com.adc.da.slrs.sarBussionessStand.entity.SarBussionessStand;
|
import com.adc.da.slrs.sarBussionessStand.entity.SarBussionessStand;
|
||||||
|
import com.adc.da.slrs.sarResource.entity.TsResource;
|
||||||
|
import com.adc.da.slrs.sarResource.service.ITsResourceService;
|
||||||
import com.adc.da.slrs.sarStandardsInfo.service.ISarStandardsInfoService;
|
import com.adc.da.slrs.sarStandardsInfo.service.ISarStandardsInfoService;
|
||||||
import com.adc.da.slrs.sysInfo.service.SysInfoEOService;
|
import com.adc.da.slrs.sysInfo.service.SysInfoEOService;
|
||||||
import com.adc.da.sys.dao.DicTypeEODao;
|
import com.adc.da.sys.dao.DicTypeEODao;
|
||||||
import com.adc.da.sys.entity.DicTypeEO;
|
import com.adc.da.sys.entity.DicTypeEO;
|
||||||
import com.adc.da.utils.util.InitStandAttrUtil;
|
import com.adc.da.utils.util.InitStandAttrUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.rabbitmq.client.Channel;
|
import com.rabbitmq.client.Channel;
|
||||||
import net.sf.json.JSONObject;
|
import net.sf.json.JSONObject;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
@@ -22,6 +27,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.messaging.Message;
|
import org.springframework.messaging.Message;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@@ -33,6 +39,12 @@ public class SendBussMQService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ISarStandardsInfoService sarStandardsInfoService;
|
private ISarStandardsInfoService sarStandardsInfoService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ISarBussStandMenuService sarBussMenusService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ITsResourceService tsResourceService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysInfoEOService sysInfoEOService;
|
private SysInfoEOService sysInfoEOService;
|
||||||
|
|
||||||
@@ -117,7 +129,13 @@ public class SendBussMQService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (put_time_data != null) {
|
if (put_time_data != null) {
|
||||||
saveMap.put("put_time_data",put_time_data.getTime());
|
// ES对比按照字符串比较,因此9位时间戳前加0
|
||||||
|
String putTimeStr = String.valueOf(infoEO.getPutTime());
|
||||||
|
if (putTimeStr.length() > 9) {
|
||||||
|
saveMap.put("put_time_data",putTimeStr);
|
||||||
|
} else {
|
||||||
|
saveMap.put("put_time_data","0" + putTimeStr);
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
saveMap.put("put_time_data",-1000000000000000000L);
|
saveMap.put("put_time_data",-1000000000000000000L);
|
||||||
}
|
}
|
||||||
@@ -140,8 +158,10 @@ public class SendBussMQService {
|
|||||||
saveMap.put("id",infoEO.getId());
|
saveMap.put("id",infoEO.getId());
|
||||||
saveMap.put("standSortOrder",esStateOrder(String.valueOf(infoEO.getStandSort()),dicMap));
|
saveMap.put("standSortOrder",esStateOrder(String.valueOf(infoEO.getStandSort()),dicMap));
|
||||||
|
|
||||||
saveMap.put("standSort",infoEO.getStandSort());
|
// saveMap.put("standSort",infoEO.getStandSort());
|
||||||
saveMap.put("stand_sort",infoEO.getStandSort());
|
// saveMap.put("stand_sort",infoEO.getStandSort());
|
||||||
|
saveMap.put("standSort",convertStandSort(infoEO.getId()));
|
||||||
|
saveMap.put("stand_sort",convertStandSort(infoEO.getId()));
|
||||||
if(StringUtils.isNotEmpty(infoEO.getStandSort())){
|
if(StringUtils.isNotEmpty(infoEO.getStandSort())){
|
||||||
String codeName = sysInfoEOService.getDicNamesByCodes(infoEO.getStandSort(),"JKSADFH564S");
|
String codeName = sysInfoEOService.getDicNamesByCodes(infoEO.getStandSort(),"JKSADFH564S");
|
||||||
saveMap.put("standSortShow",codeName);
|
saveMap.put("standSortShow",codeName);
|
||||||
@@ -314,4 +334,38 @@ public class SendBussMQService {
|
|||||||
return saveMap;
|
return saveMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String convertStandSort(String standId) {
|
||||||
|
QueryWrapper<SarBussStandMenu> wrapper = new QueryWrapper<>();
|
||||||
|
wrapper.eq("BUSS_STAND_ID", standId);
|
||||||
|
wrapper.gt("length(MENU_ID)", 0);
|
||||||
|
wrapper.select("MENU_ID");
|
||||||
|
List<SarBussStandMenu> sarStandMenuList = sarBussMenusService.list(wrapper);
|
||||||
|
if (sarStandMenuList.isEmpty()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
List<String> standMenuIdSet = sarStandMenuList.stream().map(SarBussStandMenu::getMenuId).collect(Collectors.toList());
|
||||||
|
List<String> standMenuList = new ArrayList<>();
|
||||||
|
for (String menuId : standMenuIdSet) {
|
||||||
|
List<String> result = new ArrayList<>();
|
||||||
|
recursivelyFetchParentNodes(menuId, result);
|
||||||
|
standMenuList.add(String.join("/", result));
|
||||||
|
}
|
||||||
|
return String.join(",", standMenuList);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void recursivelyFetchParentNodes(String currentId, List<String> result) {
|
||||||
|
TsResource menu = null;
|
||||||
|
try {
|
||||||
|
menu = tsResourceService.getById(currentId);
|
||||||
|
if (menu != null) {
|
||||||
|
result.add(0,menu.getMenuName());
|
||||||
|
if (StringUtils.isNotEmpty(menu.getParentId())) {
|
||||||
|
recursivelyFetchParentNodes(menu.getParentId(), result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
package com.adc.da.mq;
|
package com.adc.da.mq;
|
||||||
|
|
||||||
import com.adc.da.slrs.otSvpps.service.IOtSvppsService;
|
import com.adc.da.slrs.otSvpps.service.IOtSvppsService;
|
||||||
|
import com.adc.da.slrs.sarResource.entity.TsResource;
|
||||||
|
import com.adc.da.slrs.sarResource.service.ITsResourceService;
|
||||||
|
import com.adc.da.slrs.sarStandMenu.entity.SarStandMenu;
|
||||||
|
import com.adc.da.slrs.sarStandMenu.service.ISarStandMenuService;
|
||||||
import com.adc.da.slrs.sarStandardsInfo.entity.SarStandardsInfo;
|
import com.adc.da.slrs.sarStandardsInfo.entity.SarStandardsInfo;
|
||||||
import com.adc.da.slrs.sarStandardsInfo.service.ISarStandardsInfoService;
|
import com.adc.da.slrs.sarStandardsInfo.service.ISarStandardsInfoService;
|
||||||
import com.adc.da.slrs.sysInfo.service.SysInfoEOService;
|
import com.adc.da.slrs.sysInfo.service.SysInfoEOService;
|
||||||
@@ -8,6 +12,7 @@ import com.adc.da.sys.dao.DicTypeEODao;
|
|||||||
import com.adc.da.sys.entity.DicTypeEO;
|
import com.adc.da.sys.entity.DicTypeEO;
|
||||||
import com.adc.da.utils.util.InitStandAttrUtil;
|
import com.adc.da.utils.util.InitStandAttrUtil;
|
||||||
import com.adc.da.utils.util.Utils;
|
import com.adc.da.utils.util.Utils;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.rabbitmq.client.Channel;
|
import com.rabbitmq.client.Channel;
|
||||||
import net.sf.json.JSONObject;
|
import net.sf.json.JSONObject;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
@@ -23,6 +28,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.messaging.Message;
|
import org.springframework.messaging.Message;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@@ -34,6 +40,12 @@ public class SendStandMQService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ISarStandardsInfoService sarStandardsInfoService;
|
private ISarStandardsInfoService sarStandardsInfoService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ISarStandMenuService sarStandMenuService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ITsResourceService tsResourceService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysInfoEOService sysInfoEOService;
|
private SysInfoEOService sysInfoEOService;
|
||||||
|
|
||||||
@@ -120,8 +132,10 @@ public class SendStandMQService {
|
|||||||
saveMap.put("countryShow",codeName);
|
saveMap.put("countryShow",codeName);
|
||||||
}
|
}
|
||||||
saveMap.put("standSortOrder",esStateOrder(String.valueOf(infoEO.getStandSort()),dicMap));
|
saveMap.put("standSortOrder",esStateOrder(String.valueOf(infoEO.getStandSort()),dicMap));
|
||||||
saveMap.put("standSort",infoEO.getStandSort());
|
// saveMap.put("standSort",infoEO.getStandSort());
|
||||||
saveMap.put("stand_sort",infoEO.getStandSort());
|
// saveMap.put("stand_sort",infoEO.getStandSort());
|
||||||
|
saveMap.put("standSort",convertStandSort(infoEO.getId()));
|
||||||
|
saveMap.put("stand_sort",convertStandSort(infoEO.getId()));
|
||||||
if (StringUtils.isNotEmpty(infoEO.getStandSort())) {
|
if (StringUtils.isNotEmpty(infoEO.getStandSort())) {
|
||||||
String codeName = sysInfoEOService.getDicNamesByCodes(infoEO.getStandSort(),"JKSADFH564S");
|
String codeName = sysInfoEOService.getDicNamesByCodes(infoEO.getStandSort(),"JKSADFH564S");
|
||||||
saveMap.put("standSortShow",codeName);
|
saveMap.put("standSortShow",codeName);
|
||||||
@@ -301,12 +315,30 @@ public class SendStandMQService {
|
|||||||
if (!valArr.isEmpty()) {
|
if (!valArr.isEmpty()) {
|
||||||
value = dicTypeEODao.getDicNamesByCodes(valArr, "");
|
value = dicTypeEODao.getDicNamesByCodes(valArr, "");
|
||||||
}
|
}
|
||||||
|
if ("SSRQ".equals(name)) {
|
||||||
|
if (entry.getValue() != null && StringUtils.isNotBlank(entry.getValue().toString())) {
|
||||||
|
try {
|
||||||
|
Date parse = sdf.parse(entry.getValue().toString());
|
||||||
|
value = String.valueOf(parse.getTime() / 1000);
|
||||||
|
// ES中的排序问题,时间戳需要补0
|
||||||
|
if (value.length() <= 9) {
|
||||||
|
value = "0" + value;
|
||||||
|
}
|
||||||
|
} catch (ParseException e) {
|
||||||
|
value = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
saveMap.put(name + "Name",value);
|
saveMap.put(name + "Name",value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (saveMap.get("SSRQName") != null) {
|
||||||
|
|
||||||
|
saveMap.put("SSRQName", saveMap.get("SSRQName").toString().replace(" ", ""));
|
||||||
|
}
|
||||||
if("add".equals(addOrUpdate)){
|
if("add".equals(addOrUpdate)){
|
||||||
sarStandardsInfoService.insertIntoIndexForMap(saveMap);
|
sarStandardsInfoService.insertIntoIndexForMap(saveMap);
|
||||||
} else {
|
} else {
|
||||||
@@ -379,5 +411,36 @@ public class SendStandMQService {
|
|||||||
return saveMap;
|
return saveMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String convertStandSort(String standId) {
|
||||||
|
LambdaQueryWrapper<SarStandMenu> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.eq(SarStandMenu::getStandId,standId);
|
||||||
|
wrapper.select(SarStandMenu::getMenuId);
|
||||||
|
List<SarStandMenu> sarStandMenuList = sarStandMenuService.list(wrapper);
|
||||||
|
if (sarStandMenuList.isEmpty()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
List<String> standMenuIdSet = sarStandMenuList.stream().map(SarStandMenu::getMenuId).collect(Collectors.toList());
|
||||||
|
List<String> standMenuList = new ArrayList<>();
|
||||||
|
for (String menuId : standMenuIdSet) {
|
||||||
|
List<String> result = new ArrayList<>();
|
||||||
|
recursivelyFetchParentNodes(menuId, result);
|
||||||
|
standMenuList.add(String.join("/", result));
|
||||||
|
}
|
||||||
|
return String.join(",", standMenuList);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void recursivelyFetchParentNodes(String currentId, List<String> result) {
|
||||||
|
TsResource menu = null;
|
||||||
|
try {
|
||||||
|
menu = tsResourceService.getById(currentId);
|
||||||
|
if (menu != null) {
|
||||||
|
result.add(0,menu.getMenuName());
|
||||||
|
if (StringUtils.isNotEmpty(menu.getParentId())) {
|
||||||
|
recursivelyFetchParentNodes(menu.getParentId(), result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user