|
|
@@ -2,12 +2,11 @@ package com.uas.platform.b2b.controller;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
-import com.uas.platform.b2b.model.FileUpload;
|
|
|
-import com.uas.platform.b2b.model.PurcInquiry;
|
|
|
-import com.uas.platform.b2b.model.PurcInquiryItemInfo;
|
|
|
-import com.uas.platform.b2b.model.PurchaseInquiryItem;
|
|
|
+import com.uas.platform.b2b.model.*;
|
|
|
import com.uas.platform.b2b.search.SearchService;
|
|
|
import com.uas.platform.b2b.service.PurcInquiryService;
|
|
|
+import com.uas.platform.b2b.service.PurchaseInquiryService;
|
|
|
+import com.uas.platform.b2b.service.UserService;
|
|
|
import com.uas.platform.b2b.support.JxlsExcelView;
|
|
|
import com.uas.platform.b2b.support.SystemSession;
|
|
|
import com.uas.platform.b2b.support.UsageBufferedLogger;
|
|
|
@@ -17,6 +16,7 @@ import com.uas.platform.b2b.temporary.model.VendorAndContact;
|
|
|
import com.uas.platform.core.exception.IllegalOperatorException;
|
|
|
import com.uas.platform.core.logging.BufferedLoggerManager;
|
|
|
import com.uas.platform.core.model.Constant;
|
|
|
+import com.uas.platform.core.model.PageInfo;
|
|
|
import com.uas.platform.core.model.PageParams;
|
|
|
import com.uas.platform.core.model.Status;
|
|
|
import com.uas.platform.core.util.serializer.FlexJsonUtils;
|
|
|
@@ -31,6 +31,8 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.domain.Page;
|
|
|
import org.springframework.ui.ModelMap;
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
+import org.springframework.util.StringUtils;
|
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
@@ -62,6 +64,12 @@ public class PurcInquiryController {
|
|
|
@Autowired
|
|
|
private SearchService searchService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private UserService userService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private PurchaseInquiryService purchaseInquiryService;
|
|
|
+
|
|
|
/**
|
|
|
* 保存(或修改)
|
|
|
*
|
|
|
@@ -187,13 +195,27 @@ public class PurcInquiryController {
|
|
|
logger.log("采购询价单", "查看发出的采购询价单列表(全部)");
|
|
|
JSONObject jsonObject = JSON.parseObject(searchFilter);
|
|
|
String keyword = jsonObject.getString("keyword");
|
|
|
- com.uas.search.b2b.model.PageParams pageParams = searchService.convertPageParams(params, searchFilter);
|
|
|
- // 当前登录企业作为供应商
|
|
|
- pageParams.getFilters().put("id_inid", SystemSession.getUser().getEnterprise().getUu());
|
|
|
- List<Sort> sortList = new ArrayList<>();
|
|
|
- sortList.add(new Sort("id_id", false, Type.LONG, new Long(1)));
|
|
|
- pageParams.getFilters().put(SearchConstants.SORT_KEY, sortList);
|
|
|
- return searchService.searchPurchaseInquiryItemIds(keyword, pageParams);
|
|
|
+ if (StringUtils.isEmpty(keyword)) {
|
|
|
+ PageInfo pageInfo = new PageInfo(params);
|
|
|
+ pageInfo.filter("inquiry.enUU", SystemSession.getUser().getEnterprise().getUu());
|
|
|
+ SearchFilter filter = JSONObject.parseObject(searchFilter, SearchFilter.class);
|
|
|
+ SearchFilter distribute = userService.distribute();
|
|
|
+ if (distribute != null && distribute.getDistribute() == null) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ if (distribute != null && !CollectionUtils.isEmpty(distribute.getDistribute())) {
|
|
|
+ filter.setDistribute(distribute.getDistribute());
|
|
|
+ }
|
|
|
+ return purchaseInquiryService.findByPageInfo(pageInfo, null, filter);
|
|
|
+ } else {
|
|
|
+ com.uas.search.b2b.model.PageParams pageParams = searchService.convertPageParams(params, searchFilter);
|
|
|
+ // 当前登录企业作为供应商
|
|
|
+ pageParams.getFilters().put("id_inid", SystemSession.getUser().getEnterprise().getUu());
|
|
|
+ List<Sort> sortList = new ArrayList<>();
|
|
|
+ sortList.add(new Sort("id_id", false, Type.LONG, new Long(1)));
|
|
|
+ pageParams.getFilters().put(SearchConstants.SORT_KEY, sortList);
|
|
|
+ return searchService.searchPurchaseInquiryItemIds(keyword, pageParams);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -206,15 +228,29 @@ public class PurcInquiryController {
|
|
|
logger.log("客户询价单", "查看收到的客户询价单列表(待回复)");
|
|
|
JSONObject jsonObject = JSON.parseObject(searchFilter);
|
|
|
String keyword = jsonObject.getString("keyword");
|
|
|
- com.uas.search.b2b.model.PageParams pageParams = searchService.convertPageParams(params, searchFilter);
|
|
|
- // 当前登录企业作为供应商
|
|
|
- pageParams.getFilters().put("id_inid", SystemSession.getUser().getEnterprise().getUu());
|
|
|
- pageParams.getFilters().put("id_status", Status.NOT_REPLY.value());
|
|
|
- pageParams.getFilters().put("id_overdue", Constant.NO);
|
|
|
- List<Sort> sortList = new ArrayList<>();
|
|
|
- sortList.add(new Sort("id_id", false, Type.LONG, new Long(1)));
|
|
|
- pageParams.getFilters().put(SearchConstants.SORT_KEY, sortList);
|
|
|
- return searchService.searchPurchaseInquiryItemIds(keyword, pageParams);
|
|
|
+ if (StringUtils.isEmpty(keyword)) {
|
|
|
+ PageInfo pageInfo = new PageInfo(params);
|
|
|
+ pageInfo.filter("inquiry.enUU", SystemSession.getUser().getEnterprise().getUu());
|
|
|
+ SearchFilter filter = JSONObject.parseObject(searchFilter, SearchFilter.class);
|
|
|
+ SearchFilter distribute = userService.distribute();
|
|
|
+ if (distribute != null && distribute.getDistribute() == null) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ if (distribute != null && !CollectionUtils.isEmpty(distribute.getDistribute())) {
|
|
|
+ filter.setDistribute(distribute.getDistribute());
|
|
|
+ }
|
|
|
+ return purchaseInquiryService.findTodoByPageInfo(pageInfo, null, filter);
|
|
|
+ } else {
|
|
|
+ com.uas.search.b2b.model.PageParams pageParams = searchService.convertPageParams(params, searchFilter);
|
|
|
+ // 当前登录企业作为供应商
|
|
|
+ pageParams.getFilters().put("id_inid", SystemSession.getUser().getEnterprise().getUu());
|
|
|
+ pageParams.getFilters().put("id_status", Status.NOT_REPLY.value());
|
|
|
+ pageParams.getFilters().put("id_overdue", Constant.NO);
|
|
|
+ List<Sort> sortList = new ArrayList<>();
|
|
|
+ sortList.add(new Sort("id_id", false, Type.LONG, new Long(1)));
|
|
|
+ pageParams.getFilters().put(SearchConstants.SORT_KEY, sortList);
|
|
|
+ return searchService.searchPurchaseInquiryItemIds(keyword, pageParams);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -227,14 +263,28 @@ public class PurcInquiryController {
|
|
|
logger.log("客户询价单", "查看收到的客户询价单列表(已失效)");
|
|
|
JSONObject jsonObject = JSON.parseObject(searchFilter);
|
|
|
String keyword = jsonObject.getString("keyword");
|
|
|
- com.uas.search.b2b.model.PageParams pageParams = searchService.convertPageParams(params, searchFilter);
|
|
|
- // 当前登录企业作为供应商
|
|
|
- pageParams.getFilters().put("id_inid", SystemSession.getUser().getEnterprise().getUu());
|
|
|
- pageParams.getFilters().put("id_overdue", Constant.YES); // 已失效
|
|
|
- List<Sort> sortList = new ArrayList<>();
|
|
|
- sortList.add(new Sort("id_id", false, Type.LONG, new Long(1)));
|
|
|
- pageParams.getFilters().put(SearchConstants.SORT_KEY, sortList);
|
|
|
- return searchService.searchPurchaseInquiryItemIds(keyword, pageParams);
|
|
|
+ if (StringUtils.isEmpty(keyword)) {
|
|
|
+ PageInfo pageInfo = new PageInfo(params);
|
|
|
+ pageInfo.filter("inquiry.enUU", SystemSession.getUser().getEnterprise().getUu());
|
|
|
+ SearchFilter filter = JSONObject.parseObject(searchFilter, SearchFilter.class);
|
|
|
+ SearchFilter distribute = userService.distribute();
|
|
|
+ if (distribute != null && distribute.getDistribute() == null) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ if (distribute != null && !CollectionUtils.isEmpty(distribute.getDistribute())) {
|
|
|
+ filter.setDistribute(distribute.getDistribute());
|
|
|
+ }
|
|
|
+ return purchaseInquiryService.findInvalidByPageInfo(pageInfo, null, filter);
|
|
|
+ } else {
|
|
|
+ com.uas.search.b2b.model.PageParams pageParams = searchService.convertPageParams(params, searchFilter);
|
|
|
+ // 当前登录企业作为供应商
|
|
|
+ pageParams.getFilters().put("id_inid", SystemSession.getUser().getEnterprise().getUu());
|
|
|
+ pageParams.getFilters().put("id_overdue", Constant.YES); // 已失效
|
|
|
+ List<Sort> sortList = new ArrayList<>();
|
|
|
+ sortList.add(new Sort("id_id", false, Type.LONG, new Long(1)));
|
|
|
+ pageParams.getFilters().put(SearchConstants.SORT_KEY, sortList);
|
|
|
+ return searchService.searchPurchaseInquiryItemIds(keyword, pageParams);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -247,15 +297,32 @@ public class PurcInquiryController {
|
|
|
logger.log("客户询价单", "查看收到的客户询价单列表(已回复)");
|
|
|
JSONObject jsonObject = JSON.parseObject(searchFilter);
|
|
|
String keyword = jsonObject.getString("keyword");
|
|
|
- com.uas.search.b2b.model.PageParams pageParams = searchService.convertPageParams(params, searchFilter);
|
|
|
- // 当前登录企业作为供应商
|
|
|
- pageParams.getFilters().put("id_inid", SystemSession.getUser().getEnterprise().getUu());
|
|
|
- pageParams.getFilters().put("id_status", Status.REPLIED.value());
|
|
|
- pageParams.getFilters().put("id_decidestatus", Status.REPLIED.value());
|
|
|
- List<Sort> sortList = new ArrayList<>();
|
|
|
- sortList.add(new Sort("id_id", false, Type.LONG, new Long(1)));
|
|
|
- pageParams.getFilters().put(SearchConstants.SORT_KEY, sortList);
|
|
|
- return searchService.searchPurchaseInquiryItemIds(keyword, pageParams);
|
|
|
+ if (StringUtils.isEmpty(keyword)) {
|
|
|
+ PageInfo pageInfo = new PageInfo(params);
|
|
|
+ pageInfo.filter("inquiry.enUU", SystemSession.getUser().getEnterprise().getUu());
|
|
|
+ pageInfo.filter("status", Status.REPLIED.value());
|
|
|
+ pageInfo.filter("invalid", Constant.NO);
|
|
|
+ pageInfo.filter("decideStatus", Status.UNAUDIT.value());
|
|
|
+ SearchFilter filter = JSONObject.parseObject(searchFilter, SearchFilter.class);
|
|
|
+ SearchFilter distribute = userService.distribute();
|
|
|
+ if (distribute != null && distribute.getDistribute() == null) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ if (distribute != null && !CollectionUtils.isEmpty(distribute.getDistribute())) {
|
|
|
+ filter.setDistribute(distribute.getDistribute());
|
|
|
+ }
|
|
|
+ return purchaseInquiryService.findByPageInfo(pageInfo, null, filter);
|
|
|
+ } else {
|
|
|
+ com.uas.search.b2b.model.PageParams pageParams = searchService.convertPageParams(params, searchFilter);
|
|
|
+ // 当前登录企业作为供应商
|
|
|
+ pageParams.getFilters().put("id_inid", SystemSession.getUser().getEnterprise().getUu());
|
|
|
+ pageParams.getFilters().put("id_status", Status.REPLIED.value());
|
|
|
+ pageParams.getFilters().put("id_decidestatus", Status.REPLIED.value());
|
|
|
+ List<Sort> sortList = new ArrayList<>();
|
|
|
+ sortList.add(new Sort("id_id", false, Type.LONG, new Long(1)));
|
|
|
+ pageParams.getFilters().put(SearchConstants.SORT_KEY, sortList);
|
|
|
+ return searchService.searchPurchaseInquiryItemIds(keyword, pageParams);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -268,14 +335,31 @@ public class PurcInquiryController {
|
|
|
logger.log("客户询价单", "查看收到的客户询价单列表(已采纳)");
|
|
|
JSONObject jsonObject = JSON.parseObject(searchFilter);
|
|
|
String keyword = jsonObject.getString("keyword");
|
|
|
- com.uas.search.b2b.model.PageParams pageParams = searchService.convertPageParams(params, searchFilter);
|
|
|
- // 当前登录企业作为供应商
|
|
|
- pageParams.getFilters().put("id_inid", SystemSession.getUser().getEnterprise().getUu());
|
|
|
- pageParams.getFilters().put("id_agreed", Constant.YES);
|
|
|
- List<Sort> sortList = new ArrayList<>();
|
|
|
- sortList.add(new Sort("id_id", false, Type.LONG, new Long(1)));
|
|
|
- pageParams.getFilters().put(SearchConstants.SORT_KEY, sortList);
|
|
|
- return searchService.searchPurchaseInquiryItemIds(keyword, pageParams);
|
|
|
+ if (StringUtils.isEmpty(keyword)) {
|
|
|
+ PageInfo pageInfo = new PageInfo(params);
|
|
|
+ pageInfo.filter("inquiry.enUU", SystemSession.getUser().getEnterprise().getUu());
|
|
|
+ pageInfo.filter("agreed", Constant.YES);
|
|
|
+ pageInfo.filter("status", Status.REPLIED.value());
|
|
|
+ pageInfo.filter("invalid", Constant.NO);
|
|
|
+ SearchFilter filter = JSONObject.parseObject(searchFilter, SearchFilter.class);
|
|
|
+ SearchFilter distribute = userService.distribute();
|
|
|
+ if (distribute != null && distribute.getDistribute() == null) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ if (distribute != null && !CollectionUtils.isEmpty(distribute.getDistribute())) {
|
|
|
+ filter.setDistribute(distribute.getDistribute());
|
|
|
+ }
|
|
|
+ return purchaseInquiryService.findByPageInfo(pageInfo, null, filter);
|
|
|
+ } else {
|
|
|
+ com.uas.search.b2b.model.PageParams pageParams = searchService.convertPageParams(params, searchFilter);
|
|
|
+ // 当前登录企业作为供应商
|
|
|
+ pageParams.getFilters().put("id_inid", SystemSession.getUser().getEnterprise().getUu());
|
|
|
+ pageParams.getFilters().put("id_agreed", Constant.YES);
|
|
|
+ List<Sort> sortList = new ArrayList<>();
|
|
|
+ sortList.add(new Sort("id_id", false, Type.LONG, new Long(1)));
|
|
|
+ pageParams.getFilters().put(SearchConstants.SORT_KEY, sortList);
|
|
|
+ return searchService.searchPurchaseInquiryItemIds(keyword, pageParams);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -288,14 +372,31 @@ public class PurcInquiryController {
|
|
|
logger.log("客户询价单", "查看收到的客户询价单列表(未采纳)");
|
|
|
JSONObject jsonObject = JSON.parseObject(searchFilter);
|
|
|
String keyword = jsonObject.getString("keyword");
|
|
|
- com.uas.search.b2b.model.PageParams pageParams = searchService.convertPageParams(params, searchFilter);
|
|
|
- // 当前登录企业作为供应商
|
|
|
- pageParams.getFilters().put("id_inid", SystemSession.getUser().getEnterprise().getUu());
|
|
|
- pageParams.getFilters().put("id_agreed", Constant.NO);
|
|
|
- List<Sort> sortList = new ArrayList<>();
|
|
|
- sortList.add(new Sort("id_id", false, Type.LONG, new Long(1)));
|
|
|
- pageParams.getFilters().put(SearchConstants.SORT_KEY, sortList);
|
|
|
- return searchService.searchPurchaseInquiryItemIds(keyword, pageParams);
|
|
|
+ if (StringUtils.isEmpty(keyword)) {
|
|
|
+ PageInfo pageInfo = new PageInfo(params);
|
|
|
+ pageInfo.filter("inquiry.enUU", SystemSession.getUser().getEnterprise().getUu());
|
|
|
+ pageInfo.filter("agreed", Constant.NO);
|
|
|
+ pageInfo.filter("status", Status.REPLIED.value());
|
|
|
+ pageInfo.filter("invalid", Constant.NO);
|
|
|
+ SearchFilter filter = JSONObject.parseObject(searchFilter, SearchFilter.class);
|
|
|
+ SearchFilter distribute = userService.distribute();
|
|
|
+ if (distribute != null && distribute.getDistribute() == null) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ if (distribute != null && !CollectionUtils.isEmpty(distribute.getDistribute())) {
|
|
|
+ filter.setDistribute(distribute.getDistribute());
|
|
|
+ }
|
|
|
+ return purchaseInquiryService.findByPageInfo(pageInfo, null, filter);
|
|
|
+ } else {
|
|
|
+ com.uas.search.b2b.model.PageParams pageParams = searchService.convertPageParams(params, searchFilter);
|
|
|
+ // 当前登录企业作为供应商
|
|
|
+ pageParams.getFilters().put("id_inid", SystemSession.getUser().getEnterprise().getUu());
|
|
|
+ pageParams.getFilters().put("id_agreed", Constant.NO);
|
|
|
+ List<Sort> sortList = new ArrayList<>();
|
|
|
+ sortList.add(new Sort("id_id", false, Type.LONG, new Long(1)));
|
|
|
+ pageParams.getFilters().put(SearchConstants.SORT_KEY, sortList);
|
|
|
+ return searchService.searchPurchaseInquiryItemIds(keyword, pageParams);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|