|
@@ -228,12 +228,12 @@ public class SearchIndexServiceImpl implements SearchIndexService {
|
|
/**
|
|
/**
|
|
* 根据供应商Id更新
|
|
* 根据供应商Id更新
|
|
*
|
|
*
|
|
- * @param supplierId int
|
|
|
|
|
|
+ * @param shopId int
|
|
* @return json
|
|
* @return json
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
- public ResponseJson<Integer> updateSupplierIndexById(Integer supplierId) {
|
|
|
|
- SupplierDO supplier = searchMapper.searchSupplierById(supplierId);
|
|
|
|
|
|
+ public ResponseJson<Integer> updateSupplierIndexById(Integer shopId) {
|
|
|
|
+ SupplierDO supplier = searchMapper.searchSupplierById(shopId);
|
|
if(null != supplier){
|
|
if(null != supplier){
|
|
// 定义供应商文档数据
|
|
// 定义供应商文档数据
|
|
List<DocumentDTO<SupplierDO>> supplierList = new ArrayList<>();
|
|
List<DocumentDTO<SupplierDO>> supplierList = new ArrayList<>();
|
|
@@ -242,13 +242,13 @@ public class SearchIndexServiceImpl implements SearchIndexService {
|
|
// 定义主文档入口数据
|
|
// 定义主文档入口数据
|
|
List<DocumentDTO<MainDO>> mainList = new ArrayList<>();
|
|
List<DocumentDTO<MainDO>> mainList = new ArrayList<>();
|
|
// 主文档设值
|
|
// 主文档设值
|
|
- Integer mainId = searchQueryService.getIdByDocId("shop", supplierId);
|
|
|
|
|
|
+ Integer mainId = searchQueryService.getIdByDocId("shop", shopId);
|
|
if (mainId == -1) {
|
|
if (mainId == -1) {
|
|
mainId = searchQueryService.getIdByDocId("", null);
|
|
mainId = searchQueryService.getIdByDocId("", null);
|
|
mainId = mainId == -1 ? 0 : mainId+1;
|
|
mainId = mainId == -1 ? 0 : mainId+1;
|
|
}
|
|
}
|
|
// 供应商文档 type=2
|
|
// 供应商文档 type=2
|
|
- setMainDocument(2, mainList, mainId, supplierId);
|
|
|
|
|
|
+ setMainDocument(2, mainList, mainId, shopId);
|
|
try {
|
|
try {
|
|
// 将文档列表转换成Json串,并推送到阿里云
|
|
// 将文档列表转换成Json串,并推送到阿里云
|
|
pushSupplierDocument(mainList, supplierList);
|
|
pushSupplierDocument(mainList, supplierList);
|
|
@@ -259,7 +259,7 @@ public class SearchIndexServiceImpl implements SearchIndexService {
|
|
return ResponseJson.error("添加供应商文档异常", null);
|
|
return ResponseJson.error("添加供应商文档异常", null);
|
|
}
|
|
}
|
|
}else{
|
|
}else{
|
|
- return deleteSupplierIndexById(supplierId);
|
|
|
|
|
|
+ return deleteSupplierIndexById(shopId);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -373,13 +373,13 @@ public class SearchIndexServiceImpl implements SearchIndexService {
|
|
/**
|
|
/**
|
|
* 根据供应商Id删除
|
|
* 根据供应商Id删除
|
|
*
|
|
*
|
|
- * @param supplierId int
|
|
|
|
|
|
+ * @param shopId int
|
|
* @return json
|
|
* @return json
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
- public ResponseJson<Integer> deleteSupplierIndexById(Integer supplierId) {
|
|
|
|
|
|
+ public ResponseJson<Integer> deleteSupplierIndexById(Integer shopId) {
|
|
try {
|
|
try {
|
|
- deleteDocByTypeId("s_id", supplierId, "search_supplier");
|
|
|
|
|
|
+ deleteDocByTypeId("s_id", shopId, "search_supplier");
|
|
// 返回结果
|
|
// 返回结果
|
|
return ResponseJson.success(1);
|
|
return ResponseJson.success(1);
|
|
} catch (OpenSearchClientException | OpenSearchException | JSONException e) {
|
|
} catch (OpenSearchClientException | OpenSearchException | JSONException e) {
|
|
@@ -661,14 +661,14 @@ public class SearchIndexServiceImpl implements SearchIndexService {
|
|
// 供应商文档设值
|
|
// 供应商文档设值
|
|
setSupplierDocument(supplierList, supplier);
|
|
setSupplierDocument(supplierList, supplier);
|
|
// 主文档设值
|
|
// 主文档设值
|
|
- Integer supplierId = supplier.getS_id();
|
|
|
|
|
|
+ Integer shopId = supplier.getS_id();
|
|
if(initFlag){
|
|
if(initFlag){
|
|
supplierMainId = mainId+1;
|
|
supplierMainId = mainId+1;
|
|
mainId+=1;
|
|
mainId+=1;
|
|
}else{
|
|
}else{
|
|
- Integer tempId = idsMap.get(supplierId);
|
|
|
|
|
|
+ Integer tempId = idsMap.get(shopId);
|
|
if (null==tempId || tempId<=0){
|
|
if (null==tempId || tempId<=0){
|
|
- tempId = searchQueryService.getIdByDocId("shop", supplierId);
|
|
|
|
|
|
+ tempId = searchQueryService.getIdByDocId("shop", shopId);
|
|
}
|
|
}
|
|
if (null!=tempId && tempId>0) {
|
|
if (null!=tempId && tempId>0) {
|
|
supplierMainId = tempId;
|
|
supplierMainId = tempId;
|
|
@@ -678,7 +678,7 @@ public class SearchIndexServiceImpl implements SearchIndexService {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// 供应商文档 type=2
|
|
// 供应商文档 type=2
|
|
- setMainDocument(2, mainList, supplierMainId, supplierId);
|
|
|
|
|
|
+ setMainDocument(2, mainList, supplierMainId, shopId);
|
|
}
|
|
}
|
|
try {
|
|
try {
|
|
// 推送到阿里云
|
|
// 推送到阿里云
|