Merge branch 'develop_migration' into 'develop_master'

Develop migration

See merge request LiuChao/foton-slrs-system-rest!470
This commit is contained in:
super_liu
2022-05-01 00:06:02 +08:00
3 changed files with 235 additions and 229 deletions
@@ -131,7 +131,12 @@ public class SendBussMQService {
}
saveMap.put("standYear",infoEO.getStandYear());
saveMap.put("stand_year",infoEO.getStandYear());
saveMap.put("standNumber",infoEO.getStandNumber());
if(jsonobject.get("standNumber") != null){
saveMap.put("standNumber",jsonobject.get("standNumber"));
}else {
saveMap.put("standNumber","");
}
saveMap.put("stand_code",infoEO.getStandCode());
saveMap = dealNumberMsg(saveMap,infoEO,infoEO.getStandSort());
saveMap.put("nameshow",infoEO.getStandName());
@@ -15,8 +15,8 @@ import java.util.List;
@Data
public class SearchCenter {
@ApiModelProperty(value = "分页查询总数 可不填 自动带入总数")
private Integer countStand;
// @ApiModelProperty(value = "分页查询总数 可不填 自动带入总数")
// private Integer countStand;
@NotNull
@ApiModelProperty(value = "执行参数 ALL 存在更新 不存在新增 ,UPD 只 更新存在 es 里的标准 ,ADD 只新增不存在 es 的标准, DEL 只删除不存在标准库的数据(删除只能用DEL 减少自动错删)")
@@ -70,11 +70,7 @@ public class ResetSearchCenterService {
public ResponseMessage resetALLSearchCenter(SearchCenter searchCenter) throws Exception{
Boolean getFulltextserchIndex = elasticsearchService.isIndexExist("fulltextserch");
SearchCenter standSearch = new SearchCenter();
QueryWrapper qw = new QueryWrapper();
qw.eq("VALID_FLAG","0");
int count = iSarStandardsInfoService.count(qw);
standSearch.setExecType(searchCenter.getExecType());
standSearch.setCountStand(count);
if(searchCenter.getIdList() != null && !searchCenter.getIdList().isEmpty()){
standSearch.setIdList(searchCenter.getIdList());
}
@@ -86,11 +82,7 @@ public class ResetSearchCenterService {
}
SearchCenter lawsSearch = new SearchCenter();
QueryWrapper qw2 = new QueryWrapper();
qw2.eq("VALID_FLAG","0");
int count2 = iSarLawsStandInfoService.count(qw2);
lawsSearch.setExecType(searchCenter.getExecType());
lawsSearch.setCountStand(count2);
if(searchCenter.getIdList() != null && !searchCenter.getIdList().isEmpty()){
lawsSearch.setIdList(searchCenter.getIdList());
}
@@ -101,11 +93,7 @@ public class ResetSearchCenterService {
}
SearchCenter bussSearch = new SearchCenter();
QueryWrapper qw3 = new QueryWrapper();
qw3.eq("VALID_FLAG","0");
int count3 = iSarBussionessStandService.count(qw3);
bussSearch.setExecType(searchCenter.getExecType());
bussSearch.setCountStand(count3);
if(searchCenter.getIdList() != null && !searchCenter.getIdList().isEmpty()){
bussSearch.setIdList(searchCenter.getIdList());
}
@@ -125,11 +113,7 @@ public class ResetSearchCenterService {
public ResponseMessage syncResetALLSearchCenter(SearchCenter searchCenter) throws Exception{
Boolean getFulltextserchIndex = elasticsearchService.isIndexExist("fulltextserch");
SearchCenter standSearch = new SearchCenter();
QueryWrapper qw = new QueryWrapper();
qw.eq("VALID_FLAG","0");
int count = iSarStandardsInfoService.count(qw);
standSearch.setExecType(searchCenter.getExecType());
standSearch.setCountStand(count);
SarStandardsInfoEOPage page = new SarStandardsInfoEOPage();
page.setSyncParam("sync");
ResponseMessage stand = resetStandSearchCenter(page,standSearch);
@@ -139,11 +123,7 @@ public class ResetSearchCenterService {
}
SearchCenter lawsSearch = new SearchCenter();
QueryWrapper qw2 = new QueryWrapper();
qw2.eq("VALID_FLAG","0");
int count2 = iSarLawsStandInfoService.count(qw2);
lawsSearch.setExecType(searchCenter.getExecType());
lawsSearch.setCountStand(count2);
SarLawsStandInfoPage lawsPage = new SarLawsStandInfoPage();
page.setSyncParam("sync");
ResponseMessage laws = resetLawsSearchCenter(lawsPage,lawsSearch);
@@ -152,11 +132,7 @@ public class ResetSearchCenterService {
}
SearchCenter bussSearch = new SearchCenter();
QueryWrapper qw3 = new QueryWrapper();
qw3.eq("VALID_FLAG","0");
int count3 = iSarBussionessStandService.count(qw3);
bussSearch.setExecType(searchCenter.getExecType());
bussSearch.setCountStand(count3);
SarBussionessStandEOPage bussPage = new SarBussionessStandEOPage();
page.setSyncParam("sync");
ResponseMessage buss = resetBussStandSearchCenter(bussPage,bussSearch);
@@ -193,85 +169,92 @@ public class ResetSearchCenterService {
String[] result = searchCenter.getIdList().toArray(new String[0]);
page.setIdlist(result);
}
QueryWrapper qw = new QueryWrapper();
qw.eq("VALID_FLAG","0");
int count = iSarStandardsInfoService.count(qw);
if(count > 0){
page.setPageSize(count);
page.setMenuId("nomenu");
page.setStandType("ALL");
List<SarStandardsInfo> rowsStand = iSarStandardsInfoService.getSarStandardsInfoPage(page);
List<SarStandardsInfo> insList = new ArrayList<>();
List<SarStandardsInfo> updList = new ArrayList<>();
List<String> delList = new ArrayList<>();
List<String> standIdList = rowsStand.stream().map(SarStandardsInfo::getId).collect(Collectors.toList());
if(!esIdList.isEmpty()){
page.setPageSize(searchCenter.getCountStand());
page.setMenuId("nomenu");
page.setStandType("ALL");
List<SarStandardsInfo> rowsStand = iSarStandardsInfoService.getSarStandardsInfoPage(page);
List<SarStandardsInfo> insList = new ArrayList<>();
List<SarStandardsInfo> updList = new ArrayList<>();
List<String> delList = new ArrayList<>();
List<String> standIdList = rowsStand.stream().map(SarStandardsInfo::getId).collect(Collectors.toList());
if(!esIdList.isEmpty()){
// 差集 (list1 - list2) 新增
List<SarStandardsInfo> distinctByUniqueList = rowsStand.stream()
.filter(item -> !new ArrayList<>(esIdList)
.contains(item.getId()))
.collect(Collectors.toList());
if(searchCenter.getIdList() != null && !searchCenter.getIdList().isEmpty() && !distinctByUniqueList.isEmpty()){
List<SarStandardsInfo> collect = distinctByUniqueList.stream()
.filter(item -> searchCenter.getIdList().contains(item.getId())).collect(Collectors.toList());
insList.addAll(collect);
}else{
insList.addAll(distinctByUniqueList);
}
// (list1 - list2) 新增
List<SarStandardsInfo> distinctByUniqueList = rowsStand.stream()
.filter(item -> !new ArrayList<>(esIdList)
.contains(item.getId()))
.collect(Collectors.toList());
if(searchCenter.getIdList() != null && !searchCenter.getIdList().isEmpty() && !distinctByUniqueList.isEmpty()){
List<SarStandardsInfo> collect = distinctByUniqueList.stream()
.filter(item -> searchCenter.getIdList().contains(item.getId())).collect(Collectors.toList());
insList.addAll(collect);
}else{
insList.addAll(distinctByUniqueList);
// 更新
List<SarStandardsInfo> intersection = rowsStand.stream()
.filter(item -> new ArrayList<>(esIdList)
.contains(item.getId()))
.collect(Collectors.toList());
if(searchCenter.getIdList() != null && !searchCenter.getIdList().isEmpty() && !intersection.isEmpty()){
List<SarStandardsInfo> collect = intersection.stream()
.filter(item -> searchCenter.getIdList().contains(item.getId())).collect(Collectors.toList());
updList.addAll(collect);
}else{
updList.addAll(intersection);
}
// 差集 (list2 - list1) 删除
List<String> delDataList = esIdList.stream().filter(num -> !standIdList.contains(num))
.collect(Collectors.toList());
// 可以更新IDLIST 删除 ES
if(searchCenter.getIdList() != null && !searchCenter.getIdList().isEmpty() && "DEL".equals(searchCenter.getExecType().toUpperCase())){
delList.addAll(searchCenter.getIdList());
}else{
delList.addAll(delDataList);
}
}else {
// 新增
insList.addAll(rowsStand);
}
// 交集 更新
List<SarStandardsInfo> intersection = rowsStand.stream()
.filter(item -> new ArrayList<>(esIdList)
.contains(item.getId()))
.collect(Collectors.toList());
if(searchCenter.getIdList() != null && !searchCenter.getIdList().isEmpty() && !intersection.isEmpty()){
List<SarStandardsInfo> collect = intersection.stream()
.filter(item -> searchCenter.getIdList().contains(item.getId())).collect(Collectors.toList());
updList.addAll(collect);
}else{
updList.addAll(intersection);
if(!updList.isEmpty() && ("ALL".equals(searchCenter.getExecType().toUpperCase()) || "UPD".equals(searchCenter.getExecType().toUpperCase()))){
for(SarStandardsInfo sarStandardsInfoEO : updList){
countUpdateSuccess++;
if (sarStandardsInfoEO.getAttrInfoMap() != null) {
sarStandardsInfoEO.setSarStandAttrEOStr(JSONObject.toJSONString(sarStandardsInfoEO.getAttrInfoMap()));
}
createStandMQService.sendStandMQ(sarStandardsInfoEO,"update");
}
}
// 差集 (list2 - list1) 删除
List<String> delDataList = esIdList.stream().filter(num -> !standIdList.contains(num))
.collect(Collectors.toList());
// 可以更新IDLIST 删除 ES
if(searchCenter.getIdList() != null && !searchCenter.getIdList().isEmpty() && "DEL".equals(searchCenter.getExecType().toUpperCase())){
delList.addAll(searchCenter.getIdList());
}else{
delList.addAll(delDataList);
if(!insList.isEmpty() && ("ALL".equals(searchCenter.getExecType().toUpperCase()) || "ADD".equals(searchCenter.getExecType().toUpperCase()))){
for(SarStandardsInfo sarStandardsInfoEO : insList){
countAddSuccess++;
if (sarStandardsInfoEO.getAttrInfoMap() != null) {
sarStandardsInfoEO.setSarStandAttrEOStr(JSONObject.toJSONString(sarStandardsInfoEO.getAttrInfoMap()));
}
createStandMQService.sendStandMQ(sarStandardsInfoEO,"add");
}
}
if(!delList.isEmpty() && ("DEL".equals(searchCenter.getExecType().toUpperCase()))){
elasticsearchService.deleteBatchId(delList,"stand");
elasticsearchService.deleteBatchId(delList,"fulltextserch");
logger.info("重置国内外标准:删除-共"+delList.size()+"条数据");
}
logger.info("重置国内外标准:新增-"+ countAddSuccess + "条 更新-"+countUpdateSuccess+"条(国内外标准共:"+0+"条)删除-共"+delList.size()+"条数据");
return Result.success("重置国内外标准:新增-"+ countAddSuccess + "条 更新-"+countUpdateSuccess+"条(国内外标准共:"+0+"条)删除-共"+delList.size()+"条数据");
}else {
// 新增
insList.addAll(rowsStand);
return Result.error("未查询到标准数据");
}
if(!updList.isEmpty() && ("ALL".equals(searchCenter.getExecType().toUpperCase()) || "UPD".equals(searchCenter.getExecType().toUpperCase()))){
for(SarStandardsInfo sarStandardsInfoEO : updList){
countUpdateSuccess++;
if (sarStandardsInfoEO.getAttrInfoMap() != null) {
sarStandardsInfoEO.setSarStandAttrEOStr(JSONObject.toJSONString(sarStandardsInfoEO.getAttrInfoMap()));
}
createStandMQService.sendStandMQ(sarStandardsInfoEO,"update");
}
}
if(!insList.isEmpty() && ("ALL".equals(searchCenter.getExecType().toUpperCase()) || "ADD".equals(searchCenter.getExecType().toUpperCase()))){
for(SarStandardsInfo sarStandardsInfoEO : insList){
countAddSuccess++;
if (sarStandardsInfoEO.getAttrInfoMap() != null) {
sarStandardsInfoEO.setSarStandAttrEOStr(JSONObject.toJSONString(sarStandardsInfoEO.getAttrInfoMap()));
}
createStandMQService.sendStandMQ(sarStandardsInfoEO,"add");
}
}
if(!delList.isEmpty() && ("DEL".equals(searchCenter.getExecType().toUpperCase()))){
elasticsearchService.deleteBatchId(delList,"stand");
elasticsearchService.deleteBatchId(delList,"fulltextserch");
logger.info("重置国内外标准:删除-共"+delList.size()+"条数据");
}
logger.info("重置国内外标准:新增-"+ countAddSuccess + "条 更新-"+countUpdateSuccess+"条(国内外标准共:"+0+"条)删除-共"+delList.size()+"条数据");
return Result.success("重置国内外标准:新增-"+ countAddSuccess + "条 更新-"+countUpdateSuccess+"条(国内外标准共:"+0+"条)删除-共"+delList.size()+"条数据");
}
@Async
@@ -294,83 +277,91 @@ public class ResetSearchCenterService {
int countUpdateSuccess = 0;
int countAddSuccess = 0;
sarLawsInfoEOPage.setPageSize(searchCenter.getCountStand());
List<SarLawsStandInfo> rowsStand = iSarLawsStandInfoService.getSarStandardsInfoPage(sarLawsInfoEOPage);
List<SarLawsStandInfo> insList = new ArrayList<>();
List<SarLawsStandInfo> updList = new ArrayList<>();
List<String> delList = new ArrayList<>();
List<String> standIdList = rowsStand.stream().map(SarLawsStandInfo::getId).collect(Collectors.toList());
QueryWrapper qw2 = new QueryWrapper();
qw2.eq("VALID_FLAG","0");
int count2 = iSarLawsStandInfoService.count(qw2);
if(count2 > 0){
sarLawsInfoEOPage.setPageSize(count2);
List<SarLawsStandInfo> rowsStand = iSarLawsStandInfoService.getSarStandardsInfoPage(sarLawsInfoEOPage);
List<SarLawsStandInfo> insList = new ArrayList<>();
List<SarLawsStandInfo> updList = new ArrayList<>();
List<String> delList = new ArrayList<>();
List<String> standIdList = rowsStand.stream().map(SarLawsStandInfo::getId).collect(Collectors.toList());
if(!esIdList.isEmpty()){
if(!esIdList.isEmpty()){
// 差集 (list1 - list2) 新增
List<SarLawsStandInfo> distinctByUniqueList = rowsStand.stream()
.filter(item -> !new ArrayList<>(esIdList)
.contains(item.getId()))
.collect(Collectors.toList());
if(searchCenter.getIdList() != null && !searchCenter.getIdList().isEmpty() && !distinctByUniqueList.isEmpty()){
List<SarLawsStandInfo> collect = distinctByUniqueList.stream()
.filter(item -> searchCenter.getIdList().contains(item.getId())).collect(Collectors.toList());
insList.addAll(collect);
}else{
insList.addAll(distinctByUniqueList);
}
// 交集 更新
List<SarLawsStandInfo> intersection = rowsStand.stream()
.filter(item -> new ArrayList<>(esIdList)
.contains(item.getId()))
.collect(Collectors.toList());
if(searchCenter.getIdList() != null && !searchCenter.getIdList().isEmpty() && !intersection.isEmpty()){
List<SarLawsStandInfo> collect = intersection.stream()
.filter(item -> searchCenter.getIdList().contains(item.getId())).collect(Collectors.toList());
updList.addAll(collect);
}else{
updList.addAll(intersection);
// 差集 (list1 - list2) 新增
List<SarLawsStandInfo> distinctByUniqueList = rowsStand.stream()
.filter(item -> !new ArrayList<>(esIdList)
.contains(item.getId()))
.collect(Collectors.toList());
if(searchCenter.getIdList() != null && !searchCenter.getIdList().isEmpty() && !distinctByUniqueList.isEmpty()){
List<SarLawsStandInfo> collect = distinctByUniqueList.stream()
.filter(item -> searchCenter.getIdList().contains(item.getId())).collect(Collectors.toList());
insList.addAll(collect);
}else{
insList.addAll(distinctByUniqueList);
}
// 交集 更新
List<SarLawsStandInfo> intersection = rowsStand.stream()
.filter(item -> new ArrayList<>(esIdList)
.contains(item.getId()))
.collect(Collectors.toList());
if(searchCenter.getIdList() != null && !searchCenter.getIdList().isEmpty() && !intersection.isEmpty()){
List<SarLawsStandInfo> collect = intersection.stream()
.filter(item -> searchCenter.getIdList().contains(item.getId())).collect(Collectors.toList());
updList.addAll(collect);
}else{
updList.addAll(intersection);
}
// 差集 (list2 - list1) 删除
List<String> delDataList = esIdList.stream().filter(num -> !standIdList.contains(num))
.collect(Collectors.toList());
// 可以更新IDLIST 删除 ES
if(searchCenter.getIdList() != null && !searchCenter.getIdList().isEmpty() && "DEL".equals(searchCenter.getExecType().toUpperCase())){
delList.addAll(searchCenter.getIdList());
}else{
delList.addAll(delDataList);
}
}else {
// 新增
insList.addAll(rowsStand);
}
// 差集 (list2 - list1) 删除
List<String> delDataList = esIdList.stream().filter(num -> !standIdList.contains(num))
.collect(Collectors.toList());
// 可以更新IDLIST 删除 ES
if(searchCenter.getIdList() != null && !searchCenter.getIdList().isEmpty() && "DEL".equals(searchCenter.getExecType().toUpperCase())){
delList.addAll(searchCenter.getIdList());
}else{
delList.addAll(delDataList);
if(!updList.isEmpty() && ("ALL".equals(searchCenter.getExecType().toUpperCase()) || "UPD".equals(searchCenter.getExecType().toUpperCase()))){
for(SarLawsStandInfo sarLawsInfoEO : updList){
countUpdateSuccess++;
if (sarLawsInfoEO.getAttrInfoMap() != null) {
sarLawsInfoEO.setSarStandAttrEOStr(JSONObject.toJSONString(sarLawsInfoEO.getAttrInfoMap()));
}
createStandMQService.sendLawsMQ(sarLawsInfoEO,"update");
}
}
if(!insList.isEmpty() && ("ALL".equals(searchCenter.getExecType().toUpperCase()) || "ADD".equals(searchCenter.getExecType().toUpperCase()))){
for(SarLawsStandInfo sarLawsInfoEO : insList){
countAddSuccess++;
if (sarLawsInfoEO.getAttrInfoMap() != null) {
sarLawsInfoEO.setSarStandAttrEOStr(JSONObject.toJSONString(sarLawsInfoEO.getAttrInfoMap()));
}
createStandMQService.sendLawsMQ(sarLawsInfoEO,"add");
}
}
if(!delList.isEmpty() && ("DEL".equals(searchCenter.getExecType().toUpperCase()))){
elasticsearchService.deleteBatchId(delList,"laws");
elasticsearchService.deleteBatchId(delList,"fulltextserch");
logger.info("重置国内外政策:删除-共"+delList.size()+"条数据");
}
logger.info("重置国内外政策:新增-"+ countAddSuccess + "条 更新-"+countUpdateSuccess+"条(国内外政策共:"+rowsStand.size()+"条)数据");
return Result.success("");
}else {
// 新增
insList.addAll(rowsStand);
return Result.error("未查询到国内外政策数据");
}
if(!updList.isEmpty() && ("ALL".equals(searchCenter.getExecType().toUpperCase()) || "UPD".equals(searchCenter.getExecType().toUpperCase()))){
for(SarLawsStandInfo sarLawsInfoEO : updList){
countUpdateSuccess++;
if (sarLawsInfoEO.getAttrInfoMap() != null) {
sarLawsInfoEO.setSarStandAttrEOStr(JSONObject.toJSONString(sarLawsInfoEO.getAttrInfoMap()));
}
createStandMQService.sendLawsMQ(sarLawsInfoEO,"update");
}
}
if(!insList.isEmpty() && ("ALL".equals(searchCenter.getExecType().toUpperCase()) || "ADD".equals(searchCenter.getExecType().toUpperCase()))){
for(SarLawsStandInfo sarLawsInfoEO : insList){
countAddSuccess++;
if (sarLawsInfoEO.getAttrInfoMap() != null) {
sarLawsInfoEO.setSarStandAttrEOStr(JSONObject.toJSONString(sarLawsInfoEO.getAttrInfoMap()));
}
createStandMQService.sendLawsMQ(sarLawsInfoEO,"add");
}
}
if(!delList.isEmpty() && ("DEL".equals(searchCenter.getExecType().toUpperCase()))){
elasticsearchService.deleteBatchId(delList,"laws");
elasticsearchService.deleteBatchId(delList,"fulltextserch");
logger.info("重置国内外政策:删除-共"+delList.size()+"条数据");
}
logger.info("重置国内外政策:新增-"+ countAddSuccess + "条 更新-"+countUpdateSuccess+"条(国内外政策共:"+rowsStand.size()+"条)数据");
return Result.success("");
}
private void idListFunc(SarLawsStandInfoPage sarLawsInfoEOPage, SearchCenter searchCenter) {
@@ -404,83 +395,93 @@ public class ResetSearchCenterService {
int countUpdateSuccess = 0;
int countAddSuccess = 0;
sarBussionessStandEOPage.setMenuId("0");
sarBussionessStandEOPage.setPageSize(searchCenter.getCountStand());
List<SarBussionessStand> rowsStand = iSarBussionessStandService.getSarBussionStandPage(sarBussionessStandEOPage);
List<SarBussionessStand> insList = new ArrayList<>();
List<SarBussionessStand> updList = new ArrayList<>();
List<String> delList = new ArrayList<>();
List<String> standIdList = rowsStand.stream().map(SarBussionessStand::getId).collect(Collectors.toList());
QueryWrapper qw3 = new QueryWrapper();
qw3.eq("VALID_FLAG","0");
int count3 = iSarBussionessStandService.count(qw3);
if(!esIdList.isEmpty()){
if(count3 > 0){
sarBussionessStandEOPage.setPageSize(count3);
// 差集 (list1 - list2) 新增
List<SarBussionessStand> distinctByUniqueList = rowsStand.stream()
.filter(item -> !new ArrayList<>(esIdList)
.contains(item.getId()))
.collect(Collectors.toList());
if(searchCenter.getIdList() != null && !searchCenter.getIdList().isEmpty() && !distinctByUniqueList.isEmpty()){
List<SarBussionessStand> collect = distinctByUniqueList.stream()
.filter(item -> searchCenter.getIdList().contains(item.getId())).collect(Collectors.toList());
insList.addAll(collect);
}else{
insList.addAll(distinctByUniqueList);
List<SarBussionessStand> rowsStand = iSarBussionessStandService.getSarBussionStandPage(sarBussionessStandEOPage);
List<SarBussionessStand> insList = new ArrayList<>();
List<SarBussionessStand> updList = new ArrayList<>();
List<String> delList = new ArrayList<>();
List<String> standIdList = rowsStand.stream().map(SarBussionessStand::getId).collect(Collectors.toList());
if(!esIdList.isEmpty()){
// 差集 (list1 - list2) 新增
List<SarBussionessStand> distinctByUniqueList = rowsStand.stream()
.filter(item -> !new ArrayList<>(esIdList)
.contains(item.getId()))
.collect(Collectors.toList());
if(searchCenter.getIdList() != null && !searchCenter.getIdList().isEmpty() && !distinctByUniqueList.isEmpty()){
List<SarBussionessStand> collect = distinctByUniqueList.stream()
.filter(item -> searchCenter.getIdList().contains(item.getId())).collect(Collectors.toList());
insList.addAll(collect);
}else{
insList.addAll(distinctByUniqueList);
}
// 交集 更新
List<SarBussionessStand> intersection = rowsStand.stream()
.filter(item -> new ArrayList<>(esIdList)
.contains(item.getId()))
.collect(Collectors.toList());
if(searchCenter.getIdList() != null && !searchCenter.getIdList().isEmpty() && !intersection.isEmpty()){
List<SarBussionessStand> collect = intersection.stream()
.filter(item -> searchCenter.getIdList().contains(item.getId())).collect(Collectors.toList());
updList.addAll(collect);
}else{
updList.addAll(intersection);
}
// 差集 (list2 - list1) 删除
List<String> delDataList = esIdList.stream().filter(num -> !standIdList.contains(num))
.collect(Collectors.toList());
// 可以更新IDLIST 删除 ES
if(searchCenter.getIdList() != null && !searchCenter.getIdList().isEmpty() && "DEL".equals(searchCenter.getExecType().toUpperCase())){
delList.addAll(searchCenter.getIdList());
}else{
delList.addAll(delDataList);
}
}else {
// 新增
insList.addAll(rowsStand);
}
// 交集 更新
List<SarBussionessStand> intersection = rowsStand.stream()
.filter(item -> new ArrayList<>(esIdList)
.contains(item.getId()))
.collect(Collectors.toList());
if(searchCenter.getIdList() != null && !searchCenter.getIdList().isEmpty() && !intersection.isEmpty()){
List<SarBussionessStand> collect = intersection.stream()
.filter(item -> searchCenter.getIdList().contains(item.getId())).collect(Collectors.toList());
updList.addAll(collect);
}else{
updList.addAll(intersection);
if(!updList.isEmpty() && ("ALL".equals(searchCenter.getExecType().toUpperCase()) || "UPD".equals(searchCenter.getExecType().toUpperCase()))){
for(SarBussionessStand sarBussionessStandEO : updList){
countUpdateSuccess++;
if (sarBussionessStandEO.getAttrInfoMap() != null) {
sarBussionessStandEO.setSarStandAttrEOStr(JSONObject.toJSONString(sarBussionessStandEO.getAttrInfoMap()));
}
createStandMQService.sendBussStandMQ(sarBussionessStandEO,"update");
}
}
// 差集 (list2 - list1) 删除
List<String> delDataList = esIdList.stream().filter(num -> !standIdList.contains(num))
.collect(Collectors.toList());
// 可以更新IDLIST 删除 ES
if(searchCenter.getIdList() != null && !searchCenter.getIdList().isEmpty() && "DEL".equals(searchCenter.getExecType().toUpperCase())){
delList.addAll(searchCenter.getIdList());
}else{
delList.addAll(delDataList);
if(!insList.isEmpty() && ("ALL".equals(searchCenter.getExecType().toUpperCase()) || "ADD".equals(searchCenter.getExecType().toUpperCase()))){
for(SarBussionessStand sarBussionessStandEO : insList){
countAddSuccess++;
if (sarBussionessStandEO.getAttrInfoMap() != null) {
sarBussionessStandEO.setSarStandAttrEOStr(JSONObject.toJSONString(sarBussionessStandEO.getAttrInfoMap()));
}
createStandMQService.sendBussStandMQ(sarBussionessStandEO,"add");
}
}
if(!delList.isEmpty() && ("DEL".equals(searchCenter.getExecType().toUpperCase()))){
elasticsearchService.deleteBatchId(delList,"bussstand");
elasticsearchService.deleteBatchId(delList,"fulltextserch");
logger.info("重置企标:删除-共"+delList.size()+"条数据");
}
logger.info("重置企标:新增-"+ countAddSuccess + "条 更新-"+countUpdateSuccess+"条(企标共:"+rowsStand.size()+"条)数据");
return Result.success("");
}else {
// 新增
insList.addAll(rowsStand);
return Result.error("未查询到企标数据");
}
if(!updList.isEmpty() && ("ALL".equals(searchCenter.getExecType().toUpperCase()) || "UPD".equals(searchCenter.getExecType().toUpperCase()))){
for(SarBussionessStand sarBussionessStandEO : updList){
countUpdateSuccess++;
if (sarBussionessStandEO.getAttrInfoMap() != null) {
sarBussionessStandEO.setSarStandAttrEOStr(JSONObject.toJSONString(sarBussionessStandEO.getAttrInfoMap()));
}
createStandMQService.sendBussStandMQ(sarBussionessStandEO,"update");
}
}
if(!insList.isEmpty() && ("ALL".equals(searchCenter.getExecType().toUpperCase()) || "ADD".equals(searchCenter.getExecType().toUpperCase()))){
for(SarBussionessStand sarBussionessStandEO : insList){
countAddSuccess++;
if (sarBussionessStandEO.getAttrInfoMap() != null) {
sarBussionessStandEO.setSarStandAttrEOStr(JSONObject.toJSONString(sarBussionessStandEO.getAttrInfoMap()));
}
createStandMQService.sendBussStandMQ(sarBussionessStandEO,"add");
}
}
if(!delList.isEmpty() && ("DEL".equals(searchCenter.getExecType().toUpperCase()))){
elasticsearchService.deleteBatchId(delList,"bussstand");
elasticsearchService.deleteBatchId(delList,"fulltextserch");
logger.info("重置企标:删除-共"+delList.size()+"条数据");
}
logger.info("重置企标:新增-"+ countAddSuccess + "条 更新-"+countUpdateSuccess+"条(企标共:"+rowsStand.size()+"条)数据");
return Result.success("");
}
/**