Explorar o código

Merge remote-tracking branch 'origin/dev' into dev

hejq %!s(int64=8) %!d(string=hai) anos
pai
achega
0df4513b3e

+ 25 - 22
src/main/java/com/uas/platform/b2b/controller/BaseInfoController.java

@@ -34,7 +34,6 @@ import org.apache.poi.hssf.usermodel.HSSFWorkbook;
 import org.apache.poi.ss.usermodel.Workbook;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.domain.Sort.Direction;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
 import org.springframework.ui.ModelMap;
@@ -307,12 +306,14 @@ public class BaseInfoController {
 	 */
 	@RequestMapping(value = "/xls", method = RequestMethod.GET)
 	public ModelAndView export(String keyword) {
-		PageInfo pageInfo = new PageInfo(1, JxlsExcelView.MAX_SIZE, 0);
-		pageInfo.sorting("id", Direction.DESC);
-		pageInfo.filter("enUU", SystemSession.getUser().getEnterprise().getUu());
-		pageInfo.filter("isSale", Constant.YES);
+		com.uas.search.b2b.model.PageParams pageParams = new com.uas.search.b2b.model.PageParams(1, JxlsExcelView.MAX_SIZE, new HashMap<String, Object>());
+		pageParams.getFilters().put("pr_enuu", SystemSession.getUser().getEnterprise().getUu());
+		pageParams.getFilters().put("pr_issale", Constant.YES);
+		List<Sort> sortList = new ArrayList<>();
+		sortList.add(new Sort("pr_id", false, Type.LONG, new Long(1)));
+		pageParams.getFilters().put(SearchConstants.SORT_KEY, sortList);
 		ModelAndView modelAndView = new ModelAndView();
-		modelAndView.addObject("data", productService.findAllByPageInfo(pageInfo, keyword).getContent());
+		modelAndView.addObject("data", searchService.searchProductsCheckIds(keyword, pageParams).getContent());
 		modelAndView.setView(new JxlsExcelView("classpath:jxls-tpl/baseInfo/baseInfo", "全部物料资料表"));
 		logger.log("物料资料", "导出Excel列表", "导出全部Excel列表");
 		return modelAndView;
@@ -321,18 +322,19 @@ public class BaseInfoController {
 	/**
 	 * 导出Excel - 标准
 	 *
-	 * @param params
 	 * @return
 	 */
 	@RequestMapping(value = "/xls", params = RequestState.STANDARD, method = RequestMethod.GET)
-	public ModelAndView exportStandard(PageParams params, String keyword) {
-		PageInfo pageInfo = new PageInfo(1, JxlsExcelView.MAX_SIZE, 0);
-		pageInfo.sorting("id", Direction.DESC);
-		pageInfo.filter("enUU", SystemSession.getUser().getEnterprise().getUu());
-		pageInfo.filter("isSale", Constant.YES);
-		pageInfo.filter("standard", Constant.YES);
+	public ModelAndView exportStandard(String keyword) {
+		com.uas.search.b2b.model.PageParams pageParams = new com.uas.search.b2b.model.PageParams(1, JxlsExcelView.MAX_SIZE, new HashMap<String, Object>());
+		pageParams.getFilters().put("pr_enuu", SystemSession.getUser().getEnterprise().getUu());
+		pageParams.getFilters().put("pr_issale", Constant.YES);
+		pageParams.getFilters().put("pr_standard", Constant.YES);
+		List<Sort> sortList = new ArrayList<>();
+		sortList.add(new Sort("pr_id", false, Type.LONG, new Long(1)));
+		pageParams.getFilters().put(SearchConstants.SORT_KEY, sortList);
 		ModelAndView modelAndView = new ModelAndView();
-		modelAndView.addObject("data", productService.findAllByPageInfo(pageInfo, keyword).getContent());
+		modelAndView.addObject("data", searchService.searchProductsCheckIds(keyword, pageParams).getContent());
 		modelAndView.setView(new JxlsExcelView("classpath:jxls-tpl/baseInfo/baseInfo", "标准物料资料表"));
 		logger.log("物料资料", "导出Excel列表", "导出标准Excel列表");
 		return modelAndView;
@@ -341,18 +343,19 @@ public class BaseInfoController {
 	/**
 	 * 导出Excel - 非标准
 	 *
-	 * @param params
 	 * @return
 	 */
 	@RequestMapping(value = "/xls", params = RequestState.NONSTANDARD, method = RequestMethod.GET)
-	public ModelAndView exportNonStandard(PageParams params, String keyword) {
-		PageInfo pageInfo = new PageInfo(1, JxlsExcelView.MAX_SIZE, 0);
-		pageInfo.sorting("id", Direction.DESC);
-		pageInfo.filter("enUU", SystemSession.getUser().getEnterprise().getUu());
-		pageInfo.filter("isSale", Constant.YES);
-		pageInfo.filter("standard", Constant.NO);
+	public ModelAndView exportNonStandard(String keyword) {
+		com.uas.search.b2b.model.PageParams pageParams = new com.uas.search.b2b.model.PageParams(1, JxlsExcelView.MAX_SIZE, new HashMap<String, Object>());
+		pageParams.getFilters().put("pr_enuu", SystemSession.getUser().getEnterprise().getUu());
+		pageParams.getFilters().put("pr_issale", Constant.YES);
+		pageParams.getFilters().put("pr_standard", Constant.NO);
+		List<Sort> sortList = new ArrayList<>();
+		sortList.add(new Sort("pr_id", false, Type.LONG, new Long(1)));
+		pageParams.getFilters().put(SearchConstants.SORT_KEY, sortList);
 		ModelAndView modelAndView = new ModelAndView();
-		modelAndView.addObject("data", productService.findAllByPageInfo(pageInfo, keyword).getContent());
+		modelAndView.addObject("data", searchService.searchProductsCheckIds(keyword, pageParams).getContent());
 		modelAndView.setView(new JxlsExcelView("classpath:jxls-tpl/baseInfo/baseInfo", "非标准物料资料表"));
 		logger.log("物料资料", "导出Excel列表", "导出非标准Excel列表");
 		return modelAndView;

+ 51 - 6
src/main/java/com/uas/platform/b2b/controller/ProductController.java

@@ -21,10 +21,13 @@ import com.uas.search.b2b.model.Sort;
 import com.uas.search.b2b.model.Sort.Type;
 import com.uas.search.b2b.util.SearchConstants;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.domain.Sort.Direction;
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.ModelMap;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.servlet.ModelAndView;
 
 import java.util.ArrayList;
@@ -282,16 +285,58 @@ public class ProductController {
 	 */
 	@RequestMapping(value = "/xls", method = RequestMethod.GET)
 	public ModelAndView export(String keyword) {
-		PageInfo pageInfo = new PageInfo(1, JxlsExcelView.MAX_SIZE, 0);
-		pageInfo.sorting("id", Direction.DESC);
-		pageInfo.filter("enUU", SystemSession.getUser().getEnterprise().getUu());
+		com.uas.search.b2b.model.PageParams pageParams = new com.uas.search.b2b.model.PageParams(1, JxlsExcelView.MAX_SIZE, new HashMap<String, Object>());
+		pageParams.getFilters().put("pr_enuu", SystemSession.getUser().getEnterprise().getUu());
+		List<Sort> sortList = new ArrayList<>();
+		sortList.add(new Sort("pr_id", false, Type.LONG, new Long(1)));
+		pageParams.getFilters().put(SearchConstants.SORT_KEY, sortList);
 		ModelAndView modelAndView = new ModelAndView();
-		modelAndView.addObject("data", productService.findAllByPageInfo(pageInfo, keyword).getContent());
+		modelAndView.addObject("data", searchService.searchProductsCheckIds(keyword, pageParams).getContent());
 		modelAndView.setView(new JxlsExcelView("classpath:jxls-tpl/baseInfo/baseInfo", "物料资料表"));
 		logger.log("物料资料", "导出Excel列表", "导出全部Excel列表");
 		return modelAndView;
 	}
 
+	/**
+	 * 导出Excel - 标准
+	 *
+	 * @return
+	 */
+	@RequestMapping(value = "/xls", params = RequestState.STANDARD, method = RequestMethod.GET)
+	public ModelAndView exportStandard(String keyword) {
+		com.uas.search.b2b.model.PageParams pageParams = new com.uas.search.b2b.model.PageParams(1, JxlsExcelView.MAX_SIZE, new HashMap<String, Object>());
+		pageParams.getFilters().put("pr_enuu", SystemSession.getUser().getEnterprise().getUu());
+		pageParams.getFilters().put("pr_standard", Constant.YES);
+		List<Sort> sortList = new ArrayList<>();
+		sortList.add(new Sort("pr_id", false, Type.LONG, new Long(1)));
+		pageParams.getFilters().put(SearchConstants.SORT_KEY, sortList);
+		ModelAndView modelAndView = new ModelAndView();
+		modelAndView.addObject("data", searchService.searchProductsCheckIds(keyword, pageParams).getContent());
+		modelAndView.setView(new JxlsExcelView("classpath:jxls-tpl/baseInfo/baseInfo", "标准物料资料表"));
+		logger.log("物料资料", "导出Excel列表", "导出标准Excel列表");
+		return modelAndView;
+	}
+
+	/**
+	 * 导出Excel - 非标准
+	 *
+	 * @return
+	 */
+	@RequestMapping(value = "/xls", params = RequestState.NONSTANDARD, method = RequestMethod.GET)
+	public ModelAndView exportNonStandard(String keyword) {
+		com.uas.search.b2b.model.PageParams pageParams = new com.uas.search.b2b.model.PageParams(1, JxlsExcelView.MAX_SIZE, new HashMap<String, Object>());
+		pageParams.getFilters().put("pr_enuu", SystemSession.getUser().getEnterprise().getUu());
+		pageParams.getFilters().put("pr_standard", Constant.NO);
+		List<Sort> sortList = new ArrayList<>();
+		sortList.add(new Sort("pr_id", false, Type.LONG, new Long(1)));
+		pageParams.getFilters().put(SearchConstants.SORT_KEY, sortList);
+		ModelAndView modelAndView = new ModelAndView();
+		modelAndView.addObject("data", searchService.searchProductsCheckIds(keyword, pageParams).getContent());
+		modelAndView.setView(new JxlsExcelView("classpath:jxls-tpl/baseInfo/baseInfo", "非标准物料资料表"));
+		logger.log("物料资料", "导出Excel列表", "导出非标准Excel列表");
+		return modelAndView;
+	}
+
 	/**
 	 * 批量修改物料数据 -- 未使用
 	 * 

+ 23 - 18
src/main/java/com/uas/platform/b2b/controller/PurcProductController.java

@@ -24,7 +24,6 @@ import org.apache.poi.hssf.usermodel.HSSFWorkbook;
 import org.apache.poi.ss.usermodel.Workbook;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.domain.Sort.Direction;
 import org.springframework.ui.ModelMap;
 import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -95,12 +94,14 @@ public class PurcProductController {
 	 */
 	@RequestMapping(value = "/xls", method = RequestMethod.GET)
 	public ModelAndView export(String keyword) {
-		PageInfo pageInfo = new PageInfo(1, JxlsExcelView.MAX_SIZE, 0);
-		pageInfo.sorting("id", Direction.DESC);
-		pageInfo.filter("enUU", SystemSession.getUser().getEnterprise().getUu());
-		pageInfo.filter("isPurchase", Constant.YES);
+		com.uas.search.b2b.model.PageParams pageParams = new com.uas.search.b2b.model.PageParams(1, JxlsExcelView.MAX_SIZE, new HashMap<String, Object>());
+		pageParams.getFilters().put("pr_enuu", SystemSession.getUser().getEnterprise().getUu());
+		pageParams.getFilters().put("pr_ispurchase", Constant.YES);
+		List<Sort> sortList = new ArrayList<>();
+		sortList.add(new Sort("pr_id", false, Type.LONG, new Long(1)));
+		pageParams.getFilters().put(SearchConstants.SORT_KEY, sortList);
 		ModelAndView modelAndView = new ModelAndView();
-		modelAndView.addObject("data", productService.findAllByPageInfo(pageInfo, keyword).getContent());
+		modelAndView.addObject("data", searchService.searchProductsCheckIds(keyword, pageParams).getContent());
 		modelAndView.setView(new JxlsExcelView("classpath:jxls-tpl/baseInfo/baseInfo", "物料资料表"));
 		logger.log("物料资料", "导出Excel列表", "导出可买物料Excel列表");
 		return modelAndView;
@@ -114,13 +115,15 @@ public class PurcProductController {
 	 */
 	@RequestMapping(value = "/xls", params = RequestState.STANDARD, method = RequestMethod.GET)
 	public ModelAndView exportStandard(String keyword) {
-		PageInfo pageInfo = new PageInfo(1, JxlsExcelView.MAX_SIZE, 0);
-		pageInfo.sorting("id", Direction.DESC);
-		pageInfo.filter("enUU", SystemSession.getUser().getEnterprise().getUu());
-		pageInfo.filter("isPurchase", Constant.YES);
-		pageInfo.filter("standard", Constant.YES);
+		com.uas.search.b2b.model.PageParams pageParams = new com.uas.search.b2b.model.PageParams(1, JxlsExcelView.MAX_SIZE, new HashMap<String, Object>());
+		pageParams.getFilters().put("pr_enuu", SystemSession.getUser().getEnterprise().getUu());
+		pageParams.getFilters().put("pr_ispurchase", Constant.YES);
+		pageParams.getFilters().put("pr_standard", Constant.YES);
+		List<Sort> sortList = new ArrayList<>();
+		sortList.add(new Sort("pr_id", false, Type.LONG, new Long(1)));
+		pageParams.getFilters().put(SearchConstants.SORT_KEY, sortList);
 		ModelAndView modelAndView = new ModelAndView();
-		modelAndView.addObject("data", productService.findAllByPageInfo(pageInfo, keyword).getContent());
+		modelAndView.addObject("data", searchService.searchProductsCheckIds(keyword, pageParams).getContent());
 		modelAndView.setView(new JxlsExcelView("classpath:jxls-tpl/baseInfo/baseInfo", "物料资料表"));
 		logger.log("物料资料", "导出Excel列表", "导出可买物料Excel列表");
 		return modelAndView;
@@ -134,13 +137,15 @@ public class PurcProductController {
 	 */
 	@RequestMapping(value = "/xls", params = RequestState.NONSTANDARD, method = RequestMethod.GET)
 	public ModelAndView exportNonStandard(String keyword) {
-		PageInfo pageInfo = new PageInfo(1, JxlsExcelView.MAX_SIZE, 0);
-		pageInfo.sorting("id", Direction.DESC);
-		pageInfo.filter("enUU", SystemSession.getUser().getEnterprise().getUu());
-		pageInfo.filter("isPurchase", Constant.YES);
-		pageInfo.filter("standard", Constant.NO);
+		com.uas.search.b2b.model.PageParams pageParams = new com.uas.search.b2b.model.PageParams(1, JxlsExcelView.MAX_SIZE, new HashMap<String, Object>());
+		pageParams.getFilters().put("pr_enuu", SystemSession.getUser().getEnterprise().getUu());
+		pageParams.getFilters().put("pr_ispurchase", Constant.YES);
+		pageParams.getFilters().put("pr_standard", Constant.NO);
+		List<Sort> sortList = new ArrayList<>();
+		sortList.add(new Sort("pr_id", false, Type.LONG, new Long(1)));
+		pageParams.getFilters().put(SearchConstants.SORT_KEY, sortList);
 		ModelAndView modelAndView = new ModelAndView();
-		modelAndView.addObject("data", productService.findAllByPageInfo(pageInfo, keyword).getContent());
+		modelAndView.addObject("data", searchService.searchProductsCheckIds(keyword, pageParams).getContent());
 		modelAndView.setView(new JxlsExcelView("classpath:jxls-tpl/baseInfo/baseInfo", "物料资料表"));
 		logger.log("物料资料", "导出Excel列表", "导出可买物料Excel列表");
 		return modelAndView;

+ 36 - 3
src/main/java/com/uas/platform/b2b/controller/SnapshotController.java

@@ -2,13 +2,40 @@ package com.uas.platform.b2b.controller;
 
 import com.uas.platform.b2b.core.util.ThreadUtils;
 import com.uas.platform.b2b.model.User;
-import com.uas.platform.b2b.service.*;
+import com.uas.platform.b2b.service.AddPartnerService;
+import com.uas.platform.b2b.service.CartService;
+import com.uas.platform.b2b.service.MakeAcceptService;
+import com.uas.platform.b2b.service.MakeOrderChangeService;
+import com.uas.platform.b2b.service.MakeOrderService;
+import com.uas.platform.b2b.service.MakeReturnService;
+import com.uas.platform.b2b.service.PagingReleaseService;
+import com.uas.platform.b2b.service.PurchaseAcceptService;
+import com.uas.platform.b2b.service.PurchaseApBillService;
+import com.uas.platform.b2b.service.PurchaseApCheckService;
+import com.uas.platform.b2b.service.PurchaseBadInService;
+import com.uas.platform.b2b.service.PurchaseBadOutService;
+import com.uas.platform.b2b.service.PurchaseInquiryMouldService;
+import com.uas.platform.b2b.service.PurchaseInquiryService;
+import com.uas.platform.b2b.service.PurchaseMRBService;
+import com.uas.platform.b2b.service.PurchaseNoticeService;
+import com.uas.platform.b2b.service.PurchaseOrderChangeService;
+import com.uas.platform.b2b.service.PurchaseOrderService;
+import com.uas.platform.b2b.service.PurchaseProofingService;
+import com.uas.platform.b2b.service.PurchaseReturnService;
+import com.uas.platform.b2b.service.PurchaseTenderService;
+import com.uas.platform.b2b.service.SaleARCheckService;
+import com.uas.platform.b2b.service.SaleQuotationService;
+import com.uas.platform.b2b.service.VendorPerformanceAssessService;
+import com.uas.platform.b2b.service.VendorService;
 import com.uas.platform.b2b.support.SystemSession;
-import com.uas.platform.core.model.Status;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpStatus;
 import org.springframework.ui.ModelMap;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.ResponseStatus;
+import org.springframework.web.bind.annotation.RestController;
 
 import java.util.Hashtable;
 import java.util.List;
@@ -815,6 +842,12 @@ public class SnapshotController {
 	@ResponseBody
 	@ResponseStatus(value = HttpStatus.OK)
 	public ModelMap getMessages() {
+//		// TODO 调用公共消息服务接口
+//		try {
+//			return new ModelMap("toRead", MessageUtils.getMessageNotReadNum(SystemSession.getUser().getEnterprise().getUu(), SystemSession.getUser().getUserUU()));
+//		} catch (Exception e) {
+//			e.printStackTrace();
+//		}
 		return new ModelMap("toRead", pagingReleaseService.getToReadCount());
 	}
 

+ 13 - 0
src/main/java/com/uas/platform/b2b/dao/ProductStatusDao.java

@@ -3,12 +3,25 @@ package com.uas.platform.b2b.dao;
 import com.uas.platform.b2b.model.ProductStatus;
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.repository.query.Param;
 import org.springframework.stereotype.Repository;
 
+import javax.persistence.OrderBy;
+import java.util.List;
+
 /**
  * 物料状态
  */
 @Repository
 public interface ProductStatusDao extends JpaSpecificationExecutor<ProductStatus>, JpaRepository<ProductStatus, Long> {
 
+    /**
+     * 根据物料id查找物料禁用状态
+     * @param id 物料id
+     * @return
+     */
+    @Query("select o from ProductStatus o where o.product.id = :prId")
+    @OrderBy("id desc")
+    List<ProductStatus> findByPrId(@Param("prId") Long id);
 }

+ 6 - 7
src/main/java/com/uas/platform/b2b/erp/controller/VendorRecommendController.java

@@ -29,16 +29,15 @@ public class VendorRecommendController {
     /**
      * 获取当前企业推荐供应商
      *
-     * @param profession 企业主营业务
-     * @param enArea 企业区域
-     * @param code 物料编号
-     * @param cmpCode 物料原厂型号
-     * @param brand 物料品牌
+     * @param productMatchCondition 企业匹配条件
+     * @param enterpriseMatchCondition 物料匹配条件
+     * @param page 页面
+     * @param size 每页条数
      * @return
      */
     @RequestMapping(value = "/list", method = RequestMethod.GET)
-    public Page<VendorRecommend> getVendorRecommend (String profession, String enArea, String code, String cmpCode, String brand, int page, int size) {
-        Page<VendorRecommend> vendorRecommendPage = vendorService.getVendorRecommend(profession, enArea, code, cmpCode, brand, page, size);
+    public Page<VendorRecommend> getVendorRecommend (String productMatchCondition, String enterpriseMatchCondition, int page, int size) {
+        Page<VendorRecommend> vendorRecommendPage = vendorService.getVendorRecommend(productMatchCondition, enterpriseMatchCondition, page, size);
         logger.log("供应商推荐","获取当前企业推荐供应商:" + SystemSession.getUser().getEnterprise().getUu(), vendorRecommendPage.getNumberOfElements());
         return vendorRecommendPage;
     }

+ 0 - 2
src/main/java/com/uas/platform/b2b/model/Product.java

@@ -20,8 +20,6 @@ import java.util.Set;
 @Entity
 @Table(name = "v$products")
 @Logger
-@Cacheable
-@Cache(usage = CacheConcurrencyStrategy.READ_WRITE, region = "com.uas.platform.b2b.model.Product")
 public class Product {
 
 	@Id

+ 28 - 3
src/main/java/com/uas/platform/b2b/ps/MessageUtils.java

@@ -5,10 +5,10 @@ import com.alibaba.fastjson.TypeReference;
 import com.alibaba.fastjson.parser.Feature;
 import com.uas.account.support.Page;
 import com.uas.platform.b2b.core.util.ContextUtils;
-import com.uas.platform.b2b.support.HttpUtils;
 import com.uas.platform.b2b.support.MessageConf;
 import com.uas.platform.b2b.support.SystemSession;
 import com.uas.platform.b2b.temporary.model.MessageModel;
+import com.uas.platform.core.util.HttpUtil;
 import org.springframework.http.HttpStatus;
 import org.springframework.ui.ModelMap;
 
@@ -41,7 +41,7 @@ public class MessageUtils {
         params.put("consumerApp", "B2B");
         params.put("page", page);
         params.put("size", size);
-        HttpUtils.Response res = HttpUtils.get(MESSAGE_PUBLIC_SERVICE_URL + "/messages", params);
+        HttpUtil.Response res = HttpUtil.sendGetRequest(MESSAGE_PUBLIC_SERVICE_URL + "/messages", params);
         if (HttpStatus.OK.value() == res.getStatusCode()) {
             if (null != res.getResponseText()) {
                 System.out.println(res.getResponseText());
@@ -67,7 +67,7 @@ public class MessageUtils {
         HashMap<String, String> params = new HashMap<>();
         params.put("messageId", String.valueOf(id));
         params.put("consumerApp", "B2B");
-        HttpUtils.Response res = HttpUtils.post(MESSAGE_PUBLIC_SERVICE_URL + "/messages/read", params);
+        HttpUtil.Response res = HttpUtil.sendPostRequest(MESSAGE_PUBLIC_SERVICE_URL + "/messages/read", params);
         if (HttpStatus.OK.value() == res.getStatusCode()) {
             map.put("success", "成功设为已读");
             return map;
@@ -76,4 +76,29 @@ public class MessageUtils {
         }
     }
 
+    /**
+     * 获取当前企业当前用户未读消息数量
+     *
+     * @author dongbw
+     * @param enUU 企业UU
+     * @param userUU 用户UU
+     * @return
+     * @throws Exception
+     */
+    public static Integer getMessageNotReadNum(Long enUU, Long userUU) throws Exception {
+        HashMap<String, Object> params = new HashMap<>();
+        params.put("receiverUu", enUU);
+        params.put("receiverEnuu", userUU);
+        params.put("consumerApp", "B2B");
+        try {
+            HttpUtil.Response res = HttpUtil.sendGetRequest(MESSAGE_PUBLIC_SERVICE_URL + "/messages/notReadNum", params);
+            if (null != res.getResponseText()) {
+                return Integer.valueOf(res.getResponseText());
+            }
+        } catch (Exception e) {
+            throw new RuntimeException("获取消息失败");
+        }
+        return null;
+    }
+
 }

+ 7 - 7
src/main/java/com/uas/platform/b2b/service/VendorService.java

@@ -122,15 +122,15 @@ public interface VendorService {
     ModelMap getVendorsAndCustomers(Long enUU);
 
 	/**
-	 * 获取供应商推荐
-	 * @param profession
-	 * @param enArea
-	 * @param code
-	 * @param cmpCode
-	 * @param brand
+	 * 获取当前企业推荐供应商
+	 *
+	 * @param productMatchCondition 企业匹配条件
+	 * @param enterpriseMatchCondition 物料匹配条件
+	 * @param page 页面
+	 * @param size 每页条数
 	 * @return
 	 */
-	com.uas.account.support.Page<VendorRecommend> getVendorRecommend(String profession, String enArea, String code, String cmpCode, String brand, int page, int size);
+	com.uas.account.support.Page<VendorRecommend> getVendorRecommend(String productMatchCondition, String enterpriseMatchCondition, int page, int size);
 
 	/**
 	 * 获取推荐企业物料列表(匹配到的排前面)

+ 10 - 7
src/main/java/com/uas/platform/b2b/service/impl/BaseInfoServiceImpl.java

@@ -447,13 +447,16 @@ public class BaseInfoServiceImpl implements BaseInfoService {
 		if (null != product) {
 			ProductUtils.deleteMatchResultAndProductUser(id);
 			// 物料禁用
-			ProductStatus productStatus = new ProductStatus();
-			productStatus.setProduct(product);
-			productStatus.setB2bDisabled(Constant.YES);
-			productStatusDao.save(productStatus);
-			product.setIsPurchase(Constant.NO);
-			product.setIsSale(Constant.NO);
-			ProductUtils.updateOne(product);
+            List<ProductStatus> existedProdStatus = productStatusDao.findByPrId(id);
+            if (CollectionUtils.isEmpty(existedProdStatus)) {
+                ProductStatus productStatus = new ProductStatus();
+                productStatus.setProduct(product);
+                productStatus.setB2bDisabled(Constant.YES);
+                productStatusDao.save(productStatus);
+                product.setIsPurchase(Constant.NO);
+                product.setIsSale(Constant.NO);
+                ProductUtils.updateOne(product);
+            }
 		}
 	}
 

+ 8 - 5
src/main/java/com/uas/platform/b2b/service/impl/ProductServiceImpl.java

@@ -534,11 +534,14 @@ public class ProductServiceImpl implements ProductService {
 		List<Product> products = productDao.findByEnUUAndCode(SystemSession.getUser().getEnterprise().getUu(), code);
 		if (!CollectionUtils.isEmpty(products)) {
 			Product product = products.get(0);
-			product.setErpDate(new Date());
-			ProductStatus productStatus = new ProductStatus(product, Constant.YES);
-			productStatusDao.save(productStatus);
-			ProductUtils.updateOne(product);
-			return 1;
+			List<ProductStatus> productStatuses = productStatusDao.findByPrId(product.getId());
+			if (CollectionUtils.isEmpty(productStatuses)) {
+                product.setErpDate(new Date());
+                ProductStatus productStatus = new ProductStatus(product, Constant.YES);
+                productStatusDao.save(productStatus);
+                ProductUtils.updateOne(product);
+                return 1;
+            }
 		}
 		return 0;
 	}

+ 32 - 23
src/main/java/com/uas/platform/b2b/service/impl/VendorsServiceImpl.java

@@ -1,11 +1,23 @@
 package com.uas.platform.b2b.service.impl;
 
 import com.uas.account.util.AccountUtils;
-import com.uas.platform.b2b.dao.*;
+import com.uas.platform.b2b.dao.CommonDao;
+import com.uas.platform.b2b.dao.DistributeDao;
+import com.uas.platform.b2b.dao.EnterpriseDao;
+import com.uas.platform.b2b.dao.ProductDao;
+import com.uas.platform.b2b.dao.UserDao;
+import com.uas.platform.b2b.dao.UserOrderDao;
+import com.uas.platform.b2b.dao.VendorContactDao;
+import com.uas.platform.b2b.dao.VendorDao;
 import com.uas.platform.b2b.erp.model.B2BCustomer;
 import com.uas.platform.b2b.erp.model.B2BVendor;
 import com.uas.platform.b2b.erp.model.VendorRecommend;
-import com.uas.platform.b2b.model.*;
+import com.uas.platform.b2b.model.Distribute;
+import com.uas.platform.b2b.model.Enterprise;
+import com.uas.platform.b2b.model.Product;
+import com.uas.platform.b2b.model.User;
+import com.uas.platform.b2b.model.Vendor;
+import com.uas.platform.b2b.model.VendorContact;
 import com.uas.platform.b2b.service.VendorService;
 import com.uas.platform.b2b.support.SystemSession;
 import com.uas.platform.b2b.temporary.model.PartnershipRecord;
@@ -21,7 +33,6 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.ui.ModelMap;
 import org.springframework.util.CollectionUtils;
-import org.springframework.util.StringUtils;
 
 import javax.persistence.criteria.CriteriaBuilder;
 import javax.persistence.criteria.CriteriaQuery;
@@ -325,28 +336,30 @@ public class VendorsServiceImpl implements VendorService {
 	}
 
 	/**
-	 * 获取供应商推荐
+	 * 获取当前企业推荐供应商
 	 *
-	 * @param profession
-	 * @param enArea
-	 * @param code
-	 * @param cmpCode
-	 * @param brand
+	 * @param productMatchCondition 企业匹配条件
+	 * @param enterpriseMatchCondition 物料匹配条件
+	 * @param page 页面
+	 * @param size 每页条数
 	 * @return
 	 */
 	@Override
-	public com.uas.account.support.Page<VendorRecommend> getVendorRecommend(String profession, String enArea, String code, String cmpCode, String brand, int page, int size) {
+	public com.uas.account.support.Page<VendorRecommend> getVendorRecommend(String productMatchCondition, String enterpriseMatchCondition, int page, int size) {
 		final Long enUU = SystemSession.getUser().getEnterprise().getUu();
 		// 先查询当前企业的采购物料(待购&&不在售)的标准物料标准料号
-		String cmpCodesSql = "select distinct(pr.pr_cmpcode) from products pr left join sec$enterprises en on pr.pr_enuu = en.en_uu " +
-				" where pr.pr_ispurchase = 1 and pr.pr_issale != 1 and pr.pr_standard = 1 and pr.pr_enuu = " + enUU +
-				" and pr.pr_code like '%" + code + "%' and pr.pr_cmpcode like '%" + cmpCode + "%' and pr.pr_brand like '%" + brand +  "%'";
+		StringBuffer cmpCodesSql = new StringBuffer().append("select distinct(pr.pr_cmpcode) from products pr left join sec$enterprises en on pr.pr_enuu = en.en_uu " +
+				" where pr.pr_ispurchase = 1 and pr.pr_issale != 1 and pr.pr_standard = 1 and pr.pr_enuu = ").append(enUU);
+		if (null != productMatchCondition && !"".equals(productMatchCondition)) {
+            cmpCodesSql.append(productMatchCondition);
+        }
+
 		// 根据标准料号找出对应的供应商UU
 		String vendUUsSql = "select distinct(ve_vendenuu) from purc$vendors left join products on pr_enuu = ve_vendenuu" +
 				" where ve_myenuu = " + enUU + " and pr_issale = 1 and pr_standard = 1 and pr_cmpcode in (" + cmpCodesSql + ")";
 		// 采购物料原厂型号
 		System.out.println(cmpCodesSql);
-		final List<String> cmpCodes = commonDao.queryForList(cmpCodesSql, String.class);
+		final List<String> cmpCodes = commonDao.queryForList(cmpCodesSql.toString(), String.class);
 		// rownum 控制
 		String rownumSql = " and rownum > " + (page - 1) * size + " and rownum <= " + page * size + " group by en_uu order by count(en_uu) desc";
 		// 查找非供应商的卖当前商品的企业UU
@@ -358,13 +371,9 @@ public class VendorsServiceImpl implements VendorService {
 		vendorRecommendUuNumSql.append("select count(en_uu) from sec$enterprises left join products on en_uu = pr_enuu " +
 				" where 1=1 and pr_issale = 1 and pr_standard = 1 and pr_cmpcode in (").append(cmpCodesSql).append(") and en_uu not in (")
 				.append(vendUUsSql).append(") and en_uu <> ").append(enUU);
-		if (!StringUtils.isEmpty(enArea)) {
-			vendorRecommendUusSql.append(" and en_area like '%").append(enArea).append("%' ");
-			vendorRecommendUuNumSql.append(" and en_area like '%").append(enArea).append("%' ");
-		}
-		if (!StringUtils.isEmpty(profession)) {
-			vendorRecommendUusSql.append(" and en_profession like '%").append(profession).append("%' ");
-			vendorRecommendUuNumSql.append(" and en_profession like '%").append(profession).append("%' ");
+		if (null != enterpriseMatchCondition && !"".equals(enterpriseMatchCondition)) {
+			vendorRecommendUusSql.append(enterpriseMatchCondition);
+			vendorRecommendUuNumSql.append(enterpriseMatchCondition);
 		}
 		vendorRecommendUusSql.append(rownumSql);
 		System.out.println("SQL:" + vendorRecommendUusSql.toString());
@@ -423,7 +432,7 @@ public class VendorsServiceImpl implements VendorService {
 				" and " + productMatchCondition;
 		final List<String> cmpCodes = commonDao.queryForList(cmpCodesSql, String.class);
 		// rownum 控制
-		String rownumSql = " and rownum > " + (page - 1) * size + "and rownum <= " + page * size;
+		String rownumSql = " and rownum > " + (page - 1) * size + " and rownum <= " + page * size;
 		// 查找匹配物料的语句
 		String productsMatchSql = "select * from products where pr_enuu = " + vendUU + " and pr_cmpcode in (" + cmpCodesSql + ") and " + whereCondition;
 		// 查找所有物料的语句
@@ -431,7 +440,7 @@ public class VendorsServiceImpl implements VendorService {
 		// 物料id
 		StringBuffer idSql = new StringBuffer();
 		StringBuffer countSql = new StringBuffer();
-		idSql.append("select pr_id from (").append(productsMatchSql).append(" union ").append(allProductsSql).append(")").append(rownumSql);
+		idSql.append("select pr_id from (").append(productsMatchSql).append(" union ").append(allProductsSql).append(rownumSql).append(")");
 		countSql.append("select count(1) from (").append(productsMatchSql).append(" union ").append(allProductsSql).append(")");
 		System.out.println(idSql.toString());
 		Integer count = commonDao.queryForObject(countSql.toString(), Integer.class);

+ 15 - 0
src/main/webapp/resources/js/index/app.js

@@ -13819,11 +13819,13 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 
         //更新为标准器件
         $scope.updateone = function (id) {
+            $scope.loading = true;
             Products.updateone({id: id}, {}, function (data) {
                 if (data.success) {
                     toaster.pop('success', '提示', data.success);
                     window.location.reload();
                 }
+                $scope.loading = false;
             }, function (response) {
                 toaster.pop('error', '提示', response.data);
             });
@@ -13890,7 +13892,9 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 
         //删除
         $scope.deleteById = function (id) {
+            $scope.loading = true;
             GetProductInfo.deleteById({}, id, function (data) {
+                $scope.loading = false;
                 if (data.error) {
                     toaster.pop("error", "提示", data.error);
                 } else {
@@ -13898,12 +13902,14 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
                     window.location.href = "#/sale/prodList";
                 }
             }, function (response) {
+                $scope.loading = false;
                 toaster.pop("error", "删除失败", response.data);
             });
         };
 
         $scope.submit = function (prodInfo) {
             $scope.prodInfo.isSale = 1;
+            $scope.loading = true;
             var file = $scope.myFiles, file = file && file.length > 0 ? file[0] : null;// 可以不传附件
             $upload.upload({
                 url: 'product/baseInfo/edit/updateProdInfo',
@@ -13913,6 +13919,7 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
                     prodInfo: $scope.prodInfo
                 },
             }).success(function (data) {
+                $scope.loading = false;
                 if (data.success) {
                     toaster.pop('success', '提示', data.success);
                     $rootScope.isProductEdit = false;
@@ -13923,6 +13930,7 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
                     toaster.pop('error', '提示', data.error);
                 }
             }).error(function (data, status) {
+                $scope.loading = false;
                 $scope.loadingShow = false;
                 if (status == 403){
                     toaster.pop('error', '操作失败', data);
@@ -14102,6 +14110,7 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
         }
         //提交
         $scope.submit = function (prodInfo) {
+            $scope.loading = true;
             $scope.prodInfo.isSale = 1;
             var file = $scope.myFiles, file = file && file.length > 0 ? file[0] : null;// 可以不传附件
             $upload.upload({
@@ -14112,6 +14121,7 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
                     prodInfo: prodInfo
                 },
             }).success(function (data) {
+                $scope.loading = false;
                 if (data.success) {
                     toaster.pop('success', '提示', '产品添加成功');
                     $timeout(function () {
@@ -14130,6 +14140,7 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
                 }
 
             }).error(function (data, status) {
+                $scope.loading = false;
                 $scope.loadingShow = false;
                 if (status == 403) {
                     toaster.pop('error', '操作失败', data);
@@ -21450,6 +21461,7 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
                 toaster.pop('error', '提示', '转入失败');
             });
         }
+
     }]);
 
     // 当前企业匹配的标准物料信息
@@ -22419,6 +22431,7 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
         }
         //提交
         $scope.submit = function (prodInfo) {
+            $scope.loading = true;
             $scope.prodInfo.isPurchase = 1;
             var file = $scope.myFiles, file = file && file.length > 0 ? file[0] : null;// 可以不传附件
             $upload.upload({
@@ -22429,6 +22442,7 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
                     prodInfo: prodInfo
                 },
             }).success(function (data) {
+                $scope.loading = false;
                 if (data.success) {
                     toaster.pop('success', '提示', data.success);
                     $timeout(function () {
@@ -22447,6 +22461,7 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
                 }
 
             }).error(function (data, status, headers, config) {
+                $scope.loading = false;
                 $scope.loadingShow = false;
                 if (status == 403) {
                     toaster.pop('error', '操作失败', data);

+ 1 - 1
src/main/webapp/resources/tpl/index/approvalFlow/prodList.html

@@ -186,7 +186,7 @@
     <div class="pub-com_head">
         <span>产品库</span>
         <div class="p-right">
-            <a href="product/xls?keyword={{keywordXls}}" target="_self" class="text-simple" title="导出Excel表格">导出</a>
+            <a href="product/xls?_state={{active}}&keyword={{keywordXls}}" target="_self" class="text-simple" title="导出Excel表格">导出</a>
             <a ng-click="addtoUserByCheck()">批量转入</a>
             <!--<a ui-sref="sale.uploadByBatch" title="批量导入">批量导入</a> -->
         </div>

+ 3 - 0
src/main/webapp/resources/tpl/index/baseInfo/newProdInfo.html

@@ -53,6 +53,9 @@
 
 </style>
 <div class="wrap">
+    <div class="loading in" ng-class="{'in': loading}">
+        <i></i>
+    </div>
 	<div class="content">
 		<!--<div class="com_title">服务>销售模块<font>>产品资料</font></div>-->
 		<div class="com_head"><span>产品导入</span><span class="fr"><em>录入人:{{user.userName}}</em><time>日期:{{time}}</time></span></div>

+ 3 - 0
src/main/webapp/resources/tpl/index/baseInfo/productDetail.html

@@ -71,6 +71,9 @@
 }
 </style>
 <div class="wrap">
+    <div class="loading" ng-class="{'in': loading}">
+        <i></i>
+    </div>
 	<div class="content">
 		<div class="com_head"><span>产品导入</span><span class="fr"><em>录入人:{{user.userName}}</em><time>日期:{{time}}</time></span></div>
 		<!--产品资料新增-->

+ 3 - 0
src/main/webapp/resources/tpl/index/purc/newProdInfo.html

@@ -49,6 +49,9 @@
 }
 </style>
 <div class="wrap">
+    <div class="loading in" ng-class="{'in': loading}">
+        <i></i>
+    </div>
 	<div class="content">
 		<!--<div class="com_title">服务>销售模块<font>>产品资料</font></div>-->
 		<div class="com_head"><span>物料导入</span><span class="fr"><em>录入人:{{user.userName}}</em><time>日期:{{time}}</time></span></div>

+ 3 - 0
src/main/webapp/resources/tpl/index/purc/productDetail.html

@@ -71,6 +71,9 @@
 }
 </style>
 <div class="wrap">
+    <div class="loading" ng-class="{'in': loading}">
+        <i></i>
+    </div>
 	<div class="content">
 		<div class="com_head"><span>物料导入</span><span class="fr"><em>录入人:{{user.userName}}</em><time>日期:{{time}}</time></span></div>
 		<!--产品资料新增-->