Browse Source

1.同步品牌数据

纪新园 23 hours ago
parent
commit
fe95ffe6ec

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

@@ -0,0 +1,39 @@
+package com.gubersail.dealer.admin.api.fegin;
+
+import com.gubersail.dealer.admin.api.goods.entity.PjBrandDesc;
+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 java.util.List;
+
+/**
+ * @author Rain
+ */
+@FeignClient(value = "gubersail-admin")
+public interface IGoodsBrandClient {
+
+	String API_PREFIX = "/gubersail-admin";
+
+	String GET_DEALER_BRAND_LIST = API_PREFIX + "/getDealerBrandList";
+
+	String ADD_BRAND_LIST = API_PREFIX + "/addBrandList";
+
+	/**
+	 * 获取经销商品牌列表
+	 *
+	 * @return 结果
+	 */
+	@PostMapping(ADD_BRAND_LIST)
+	R addBrandList(List<PjBrandDesc> brandDescList);
+
+	/**
+	 * 获取经销商品牌列表
+	 *
+	 * @return 结果
+	 */
+	@GetMapping(GET_DEALER_BRAND_LIST)
+	List<PjBrandDesc> getBrandList(PjBrandDesc pjBrandDesc);
+
+}

+ 6 - 0
blade-service/blade-user/pom.xml

@@ -38,6 +38,12 @@
             <artifactId>blade-system-api</artifactId>
             <version>2.8.2.RELEASE</version>
         </dependency>
+        <dependency>
+            <groupId>com.gubersail</groupId>
+            <artifactId>gubersail-dealer-admin-api</artifactId>
+            <version>2.8.2.RELEASE</version>
+            <scope>compile</scope>
+        </dependency>
     </dependencies>
 
     <build>

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

@@ -4,6 +4,7 @@ package org.springblade.system.user.feign;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.gubersail.dealer.admin.api.fegin.IGoodsBrandClient;
 import lombok.AllArgsConstructor;
 import org.apache.ibatis.datasource.DataSourceException;
 import org.springblade.common.config.MD5Util;
@@ -54,6 +55,8 @@ public class UserClient implements IUserClient {
 
 	private final IUserDeptService userDeptService;
 
+	private final IGoodsBrandClient goodsBrandClient;
+
 	@Override
 	@GetMapping(LIST_USER_BY_ROLE_ID)
 	public R<List<User>> listUserByRoleId(String roleId, String tenantId, String salesCompanyId) {

+ 44 - 0
blade-service/gubersail-dealer-admin/src/main/java/com/gubersail/admin/fegin/GoodsBrandClient.java

@@ -0,0 +1,44 @@
+package com.gubersail.admin.fegin;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.gubersail.admin.goods.mapper.BrandDescMapper;
+import com.gubersail.dealer.admin.api.fegin.IGoodsBrandClient;
+import com.gubersail.dealer.admin.api.goods.entity.PjBrandDesc;
+import lombok.AllArgsConstructor;
+import org.springblade.core.tenant.annotation.NonDS;
+import org.springblade.core.tool.api.R;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * @author Rain
+ */
+@NonDS
+@RestController
+@AllArgsConstructor
+public class GoodsBrandClient implements IGoodsBrandClient {
+
+
+	private final BrandDescMapper brandDescMapper;
+
+	@Override
+	public R addBrandList(List<PjBrandDesc> brandDescList) {
+		for (PjBrandDesc item : brandDescList) {
+			brandDescMapper.insert(item);
+		}
+		return R.success("");
+	}
+
+	@Override
+	public List<PjBrandDesc> getBrandList(PjBrandDesc pjBrandDesc) {
+		return brandDescMapper.selectList(new LambdaQueryWrapper<PjBrandDesc>()
+			.eq(PjBrandDesc::getTenantId, pjBrandDesc.getTenantId())
+			.eq(PjBrandDesc::getType, "PP")
+			.eq(PjBrandDesc::getEnableOrNot, 1)
+			.eq(PjBrandDesc::getIsDeleted, 0)
+			.eq(PjBrandDesc::getCname, pjBrandDesc.getCname())
+			.eq(PjBrandDesc::getCreateDept, pjBrandDesc.getCreateDept()));
+	}
+
+}