Browse Source

用户品牌同步问题优化

liyuan 1 month ago
parent
commit
0e0c467824

+ 4 - 2
blade-service-api/gubersail-dealer-admin-api/src/main/java/com/gubersail/dealer/admin/api/fegin/IGoodsBrandClient.java

@@ -5,6 +5,7 @@ import org.springblade.core.tool.api.R;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
 
 import java.util.List;
 
@@ -21,12 +22,13 @@ public interface IGoodsBrandClient {
 	String ADD_BRAND_LIST = API_PREFIX + "/addBrandList";
 
 	/**
-	 * 获取经销商品牌列表
+	 * 添加品牌列表
 	 *
+	 * @param brandDescList 品牌数据
 	 * @return 结果
 	 */
 	@PostMapping(ADD_BRAND_LIST)
-	R addBrandList(List<PjBrandDesc> brandDescList);
+	R addBrandList(@RequestBody List<PjBrandDesc> brandDescList);
 
 	/**
 	 * 获取经销商品牌列表

+ 5 - 3
blade-service/blade-user/src/main/java/org/springblade/system/user/feign/UserClient.java

@@ -503,9 +503,11 @@ public class UserClient implements IUserClient {
 					brandDescList.add(brandDesc);
 				}
 			}
-			R res = goodsBrandClient.addBrandList(brandDescList);
-			if (!res.isSuccess()) {
-				throw new RuntimeException("同步品牌失败");
+			if (!CollectionUtils.isEmpty(brandDescList)) {
+				R res = goodsBrandClient.addBrandList(brandDescList);
+				if (!res.isSuccess()) {
+					throw new RuntimeException("同步品牌失败");
+				}
 			}
 		}
 		return R.success("成功");