Просмотр исходного кода

保留原ERP调用供应商资源库接口

dongbw 8 лет назад
Родитель
Сommit
0b3ec802f0

+ 78 - 0
src/main/java/com/uas/platform/b2b/erp/controller/ErpVendorRecommendController.java

@@ -0,0 +1,78 @@
+package com.uas.platform.b2b.erp.controller;
+
+import com.uas.account.support.Page;
+import com.uas.platform.b2b.erp.model.VendorRecommend;
+import com.uas.platform.b2b.erp.support.ErpBufferedLogger;
+import com.uas.platform.b2b.model.Product;
+import com.uas.platform.b2b.service.VendorService;
+import com.uas.platform.b2b.support.SystemSession;
+import com.uas.platform.core.logging.BufferedLoggerManager;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * 供应商推荐 -- 2018年4月8日 21:57:40  因为UAS不能立刻同时发布,所以保留原接口
+ * Created by dongbw
+ * 18/01/18 14:00.
+ */
+@RestController
+@RequestMapping("/erp/recommend")
+public class ErpVendorRecommendController {
+
+    @Autowired
+    private VendorService vendorService;
+
+    private final static ErpBufferedLogger logger = BufferedLoggerManager.getLogger(ErpBufferedLogger.class);
+
+    /**
+     * 获取当前企业推荐供应商
+     *
+     * @param productMatchCondition 物料模糊匹配条件
+     * @param enterpriseMatchCondition 企业搜索匹配条件
+     * @param page 页面
+     * @param size 每页条数
+     * @return
+     */
+    @RequestMapping(value = "/list", method = RequestMethod.GET)
+    public Page<VendorRecommend> getVendorRecommend (String productMatchCondition, String enterpriseMatchCondition, int page, int size) {
+        Long enUU = SystemSession.getUser().getEnterprise().getUu();
+        Page<VendorRecommend> vendorRecommendPage = vendorService.getVendorRecommend(enUU, productMatchCondition, enterpriseMatchCondition, page, size);
+//        logger.log("供应商推荐","获取当前企业推荐供应商:" + enUU, vendorRecommendPage.getNumberOfElements());
+        return vendorRecommendPage;
+    }
+
+    /**
+     * 根据条件获取物料型号和品牌值对(UAS品牌和型号联想词接口)
+     *
+     * @param field 需要的字段名
+     * @param condition 物料模糊匹配条件
+     * @return 物料型号和品牌值对List
+     */
+    @RequestMapping(value = "/product/associate", method = RequestMethod.GET)
+    public List<Product> getProductAssociate (String field, String condition) {
+        List<Product> products = vendorService.getProductAssociate(field, condition);
+//        logger.log("供应商推荐","根据条件获取物料型号和品牌值对", products.size());
+        return products;
+    }
+
+    /**
+     * 获取推荐企业物料列表(匹配到的排前面)
+     * @param page 页数
+     * @param size 每页条数
+     * @param vendUU 推荐供应商企业UU
+     * @param productMatchCondition 列表的物料匹配搜索条件  不带where
+     * @param whereCondition where条件(product的筛选条件拼接) 不带where
+     * @return
+     */
+    @RequestMapping(value = "/detail", method = RequestMethod.GET)
+    public Page<Product> getVendorRecommendDetail(int page, int size, Long vendUU, String productMatchCondition, String whereCondition) {
+        Long enUU = SystemSession.getUser().getEnterprise().getUu();
+        Page<Product> productPage = vendorService.getProductsByVendorRecommend(page, size, enUU, vendUU, productMatchCondition, whereCondition);
+//        logger.log("供应商推荐","获取当前企业推荐供应商:" + enUU, productPage.getNumberOfElements());
+        return productPage;
+    }
+}