|
@@ -0,0 +1,574 @@
|
|
|
|
|
+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.PublicInquiryItem;
|
|
|
|
|
+import com.uas.platform.b2b.model.PublicInquiryItemInfo;
|
|
|
|
|
+import com.uas.platform.b2b.model.SearchFilter;
|
|
|
|
|
+import com.uas.platform.b2b.search.SearchService;
|
|
|
|
|
+import com.uas.platform.b2b.service.PubInquiryService;
|
|
|
|
|
+import com.uas.platform.b2b.service.UserService;
|
|
|
|
|
+import com.uas.platform.b2b.support.SystemSession;
|
|
|
|
|
+import com.uas.platform.b2b.support.TokenService;
|
|
|
|
|
+import com.uas.platform.b2b.support.UsageBufferedLogger;
|
|
|
|
|
+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;
|
|
|
|
|
+import com.uas.platform.core.web.bind.RequestState;
|
|
|
|
|
+import com.uas.search.b2b.model.MultiValue;
|
|
|
|
|
+import com.uas.search.b2b.model.SPage;
|
|
|
|
|
+import com.uas.search.b2b.model.Sort;
|
|
|
|
|
+import com.uas.search.b2b.util.SearchConstants;
|
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
+import org.springframework.http.HttpStatus;
|
|
|
|
|
+import org.springframework.http.ResponseEntity;
|
|
|
|
|
+import org.springframework.ui.ModelMap;
|
|
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
+
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
|
|
+import java.util.HashMap;
|
|
|
|
|
+import java.util.List;
|
|
|
|
|
+
|
|
|
|
|
+/**
|
|
|
|
|
+ * 公共询价(针对供应商)
|
|
|
|
|
+ *
|
|
|
|
|
+ * Created by hejq on 2018-01-06.
|
|
|
|
|
+ */
|
|
|
|
|
+@RequestMapping("/sale/pubInquiry")
|
|
|
|
|
+@RestController
|
|
|
|
|
+public class PubInquiryController {
|
|
|
|
|
+
|
|
|
|
|
+ private final static UsageBufferedLogger logger = BufferedLoggerManager.getLogger(UsageBufferedLogger.class);
|
|
|
|
|
+
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private PubInquiryService pubInquiryService;
|
|
|
|
|
+
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private UserService userService;
|
|
|
|
|
+
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private SearchService searchService;
|
|
|
|
|
+
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private TokenService tokenService;
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 转成客户询价单
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param id 公共询价明细id
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ @RequestMapping(value = "/turntoInquiry/{id}", method = RequestMethod.POST)
|
|
|
|
|
+ private ModelMap transtoInquiry(@PathVariable Long id) {
|
|
|
|
|
+ logger.log("公共询价单", "将公共询价单(" + id + ")转成询价报价单");
|
|
|
|
|
+ return pubInquiryService.transtoInquiry(id);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 作为卖家,收到的采购询价(全部)不搜索
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param params 分页参数
|
|
|
|
|
+ * @param searchFilter 过滤条件
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ @RequestMapping(value = "/info/nosearch", method = RequestMethod.GET)
|
|
|
|
|
+ public SPage<PublicInquiryItemInfo> getPurchaseInquiries(PageParams params, String searchFilter) {
|
|
|
|
|
+ logger.log("公共询价单", "查看已转询价报价单的客户公共询价单列表(全部)");
|
|
|
|
|
+ PageInfo pageInfo = new PageInfo(params);
|
|
|
|
|
+ pageInfo.filter("vendUU", 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 pubInquiryService.findByPageInfo(pageInfo, null, filter);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 作为卖家,收到的采购询价(待报价)
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param params 分页参数
|
|
|
|
|
+ * @param searchFilter 过滤条件
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ @RequestMapping(value = "/info/nosearch", params = RequestState.TODO, method = RequestMethod.GET)
|
|
|
|
|
+ public SPage<PublicInquiryItemInfo> getPurchaseInquiriesTodo(PageParams params, String searchFilter) {
|
|
|
|
|
+ logger.log("公共询价单", "查看已转询价报价单的客户公共询价单列表(待报价)");
|
|
|
|
|
+ PageInfo pageInfo = new PageInfo(params);
|
|
|
|
|
+ pageInfo.filter("status", Status.NOT_REPLY.value());
|
|
|
|
|
+ pageInfo.filter("overdue", Constant.NO);
|
|
|
|
|
+ pageInfo.filter("invalid", Constant.NO);
|
|
|
|
|
+ pageInfo.filter("vendUU", 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 pubInquiryService.findByPageInfo(pageInfo, null, filter);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 作为卖家,收到的采购询价(已过期)
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param params 分页参数
|
|
|
|
|
+ * @param searchFilter 过滤条件
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ @RequestMapping(value = "/info/nosearch", params = RequestState.END, method = RequestMethod.GET)
|
|
|
|
|
+ public SPage<PublicInquiryItemInfo> getPurchaseInquiriesEnd(PageParams params, String searchFilter) {
|
|
|
|
|
+ logger.log("公共询价单", "查看已转询价报价单的客户公共询价单列表(已过期)");
|
|
|
|
|
+ PageInfo pageInfo = new PageInfo(params);
|
|
|
|
|
+ pageInfo.filter("overdue", Constant.YES);
|
|
|
|
|
+ pageInfo.filter("invalid", Constant.NO);
|
|
|
|
|
+ pageInfo.filter("vendUU", 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 pubInquiryService.findByPageInfo(pageInfo, null, filter);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 作为卖家,收到的采购询价(已报价)
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param params 分页参数
|
|
|
|
|
+ * @param searchFilter 过滤条件
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ @RequestMapping(value = "/info/nosearch", params = RequestState.DONE, method = RequestMethod.GET)
|
|
|
|
|
+ public SPage<PublicInquiryItemInfo> getPurchaseInquiriesDone(PageParams params, String searchFilter) {
|
|
|
|
|
+ logger.log("公共询价单", "查看已转询价报价单的客户公共询价单列表(已报价)");
|
|
|
|
|
+ PageInfo pageInfo = new PageInfo(params);
|
|
|
|
|
+ pageInfo.filter("overdue", Constant.NO);
|
|
|
|
|
+ pageInfo.filter("status", Status.REPLIED.value());
|
|
|
|
|
+ pageInfo.filter("invalid", Constant.NO);
|
|
|
|
|
+ pageInfo.filter("vendUU", SystemSession.getUser().getEnterprise().getUu());
|
|
|
|
|
+ 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 pubInquiryService.findByPageInfo(pageInfo, null, filter);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 作为卖家,收到的采购询价(已失效)
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param params 分页参数
|
|
|
|
|
+ * @param searchFilter 过滤条件
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ @RequestMapping(value = "/info/nosearch", params = RequestState.INVALID, method = RequestMethod.GET)
|
|
|
|
|
+ public SPage<PublicInquiryItemInfo> getPurchaseInquiriesInvalid(PageParams params, String searchFilter) {
|
|
|
|
|
+ logger.log("公共询价单", "查看已转询价报价单的客户公共询价单列表(已失效)");
|
|
|
|
|
+ PageInfo pageInfo = new PageInfo(params);
|
|
|
|
|
+ pageInfo.filter("overdue", Constant.YES);
|
|
|
|
|
+ pageInfo.filter("vendUU", SystemSession.getUser().getEnterprise().getUu());
|
|
|
|
|
+ pageInfo.filter("invalid", Constant.YES);
|
|
|
|
|
+ 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 pubInquiryService.findByPageInfo(pageInfo, null, filter);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 作为卖家,收到的采购询价(未采纳)
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param params 分页参数
|
|
|
|
|
+ * @param searchFilter 过滤条件
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ @RequestMapping(value = "/info/nosearch", params = RequestState.REFUSED, method = RequestMethod.GET)
|
|
|
|
|
+ public SPage<PublicInquiryItemInfo> getPurchaseInquiriesRefused(PageParams params, String searchFilter) {
|
|
|
|
|
+ logger.log("公共询价单", "查看已转询价报价单的客户公共询价单列表(未采纳)");
|
|
|
|
|
+ PageInfo pageInfo = new PageInfo(params);
|
|
|
|
|
+ pageInfo.filter("agreed", Constant.NO);
|
|
|
|
|
+ pageInfo.filter("status", Status.REPLIED.value());
|
|
|
|
|
+ pageInfo.filter("invalid", Constant.NO);
|
|
|
|
|
+ pageInfo.filter("vendUU", 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 pubInquiryService.findByPageInfo(pageInfo, null, filter);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 作为卖家,收到的采购询价(已采纳)
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param params 分页参数
|
|
|
|
|
+ * @param searchFilter 过滤条件
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ @RequestMapping(value = "/info/nosearch", params = RequestState.AGREED, method = RequestMethod.GET)
|
|
|
|
|
+ public SPage<PublicInquiryItemInfo> getPurchaseInquiriesAgreed(PageParams params, String searchFilter) {
|
|
|
|
|
+ logger.log("公共询价单", "查看已转询价报价单的客户公共询价单列表(已采纳)");
|
|
|
|
|
+ PageInfo pageInfo = new PageInfo(params);
|
|
|
|
|
+ pageInfo.filter("vendUU", 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 pubInquiryService.findByPageInfo(pageInfo, null, filter);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 作为卖家,收到的采购询价(全部)- 搜索
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param params 分页参数
|
|
|
|
|
+ * @param searchFilter 过滤条件
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ @RequestMapping(value = "/info/search", method = RequestMethod.GET)
|
|
|
|
|
+ public SPage<PublicInquiryItemInfo> getReceivedPurchaseInquiries(PageParams params, String searchFilter) {
|
|
|
|
|
+ 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_venduu", SystemSession.getUser().getEnterprise().getUu());
|
|
|
|
|
+ SearchFilter filter = userService.distribute();
|
|
|
|
|
+ if (filter != null && filter.getDistribute() == null) {
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (filter != null && !CollectionUtils.isEmpty(filter.getDistribute())) {
|
|
|
|
|
+ List<Object> list = new ArrayList<>();
|
|
|
|
|
+ for (Object object : filter.getDistribute()) {
|
|
|
|
|
+ list.add(object);
|
|
|
|
|
+ }
|
|
|
|
|
+ pageParams.getFilters().put("id_inid", new MultiValue(list, true));
|
|
|
|
|
+ }
|
|
|
|
|
+ List<Sort> sortList = new ArrayList<>();
|
|
|
|
|
+ sortList.add(new Sort("id_id", false, Sort.Type.LONG, new Long(1)));
|
|
|
|
|
+ pageParams.getFilters().put(SearchConstants.SORT_KEY, sortList);
|
|
|
|
|
+ return searchService.searchPublicInquiryItemInfoIds(keyword, pageParams);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 作为卖家,收到的采购询价(待报价)- 搜索
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param params 分页参数
|
|
|
|
|
+ * @param searchFilter 过滤条件
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ @RequestMapping(value = "/info/search", params = RequestState.TODO, method = RequestMethod.GET)
|
|
|
|
|
+ public SPage<PublicInquiryItemInfo> getTodoInquiries(PageParams params, String searchFilter) {
|
|
|
|
|
+ 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_venduu", SystemSession.getUser().getEnterprise().getUu());
|
|
|
|
|
+ SearchFilter filter = userService.distribute();
|
|
|
|
|
+ if (filter != null && filter.getDistribute() == null) {
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (filter != null && !CollectionUtils.isEmpty(filter.getDistribute())) {
|
|
|
|
|
+ List<Object> list = new ArrayList<>();
|
|
|
|
|
+ for (Object object : filter.getDistribute()) {
|
|
|
|
|
+ list.add(object);
|
|
|
|
|
+ }
|
|
|
|
|
+ pageParams.getFilters().put("id_inid", new MultiValue(list, true));
|
|
|
|
|
+ }
|
|
|
|
|
+ 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, Sort.Type.LONG, new Long(1)));
|
|
|
|
|
+ pageParams.getFilters().put(SearchConstants.SORT_KEY, sortList);
|
|
|
|
|
+ return searchService.searchPublicInquiryItemInfoIds(keyword, pageParams);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 作为卖家,收到的采购询价(已过期)- 搜索
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param params 分页参数
|
|
|
|
|
+ * @param searchFilter 过滤条件
|
|
|
|
|
+ */
|
|
|
|
|
+ @RequestMapping(value = "/info/search", params = RequestState.END, method = RequestMethod.GET)
|
|
|
|
|
+ public SPage<PublicInquiryItemInfo> getEndInquiries(PageParams params, String searchFilter) {
|
|
|
|
|
+ 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_venduu", SystemSession.getUser().getEnterprise().getUu());
|
|
|
|
|
+ SearchFilter filter = userService.distribute();
|
|
|
|
|
+ if (filter != null && filter.getDistribute() == null) {
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (filter != null && !CollectionUtils.isEmpty(filter.getDistribute())) {
|
|
|
|
|
+ List<Object> list = new ArrayList<>();
|
|
|
|
|
+ for (Object object : filter.getDistribute()) {
|
|
|
|
|
+ list.add(object);
|
|
|
|
|
+ }
|
|
|
|
|
+ pageParams.getFilters().put("id_inid", new MultiValue(list, true));
|
|
|
|
|
+ }
|
|
|
|
|
+ pageParams.getFilters().put("id_status", Status.NOT_REPLY.value());
|
|
|
|
|
+ pageParams.getFilters().put("id_overdue", Constant.YES);
|
|
|
|
|
+ HashMap<String, Object> map = new HashMap<>();
|
|
|
|
|
+ map.put("id_invalid", Constant.NO);
|
|
|
|
|
+ pageParams.setNotEqualFilters(map);
|
|
|
|
|
+ List<Sort> sortList = new ArrayList<>();
|
|
|
|
|
+ sortList.add(new Sort("id_id", false, Sort.Type.LONG, new Long(1)));
|
|
|
|
|
+ pageParams.getFilters().put(SearchConstants.SORT_KEY, sortList);
|
|
|
|
|
+ return searchService.searchPublicInquiryItemInfoIds(keyword, pageParams);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 作为卖家,收到的采购询价(已报价)- 搜索
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param params 分页参数
|
|
|
|
|
+ * @param searchFilter 过滤条件
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ @RequestMapping(value = "/info/search", params = RequestState.DONE, method = RequestMethod.GET)
|
|
|
|
|
+ public SPage<PublicInquiryItemInfo> getDoneInquiries(PageParams params, String searchFilter) {
|
|
|
|
|
+ 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_venduu", SystemSession.getUser().getEnterprise().getUu());
|
|
|
|
|
+ SearchFilter filter = userService.distribute();
|
|
|
|
|
+ if (filter != null && filter.getDistribute() == null) {
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (filter != null && !CollectionUtils.isEmpty(filter.getDistribute())) {
|
|
|
|
|
+ List<Object> list = new ArrayList<>();
|
|
|
|
|
+ for (Object object : filter.getDistribute()) {
|
|
|
|
|
+ list.add(object);
|
|
|
|
|
+ }
|
|
|
|
|
+ pageParams.getFilters().put("id_inid", new MultiValue(list, true));
|
|
|
|
|
+ }
|
|
|
|
|
+ pageParams.getFilters().put("id_status", Status.REPLIED.value());
|
|
|
|
|
+ HashMap<String, Object> map = new HashMap<>();
|
|
|
|
|
+ map.put("id_invalid", Constant.YES);
|
|
|
|
|
+ pageParams.setNotEqualFilters(map);
|
|
|
|
|
+ List<Sort> sortList = new ArrayList<>();
|
|
|
|
|
+ sortList.add(new Sort("id_id", false, Sort.Type.LONG, new Long(1)));
|
|
|
|
|
+ pageParams.getFilters().put(SearchConstants.SORT_KEY, sortList);
|
|
|
|
|
+ return searchService.searchPublicInquiryItemInfoIds(keyword, pageParams);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 作为卖家,收到的采购询价(已失效)- 搜索
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param params 分页参数
|
|
|
|
|
+ * @param searchFilter 过滤条件
|
|
|
|
|
+ */
|
|
|
|
|
+ @RequestMapping(value = "/info/search", params = RequestState.INVALID, method = RequestMethod.GET)
|
|
|
|
|
+ public SPage<PublicInquiryItemInfo> getInvalidInquiries(PageParams params, String searchFilter) {
|
|
|
|
|
+ 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_venduu", SystemSession.getUser().getEnterprise().getUu());
|
|
|
|
|
+ SearchFilter filter = userService.distribute();
|
|
|
|
|
+ if (filter != null && filter.getDistribute() == null) {
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (filter != null && !CollectionUtils.isEmpty(filter.getDistribute())) {
|
|
|
|
|
+ List<Object> list = new ArrayList<>();
|
|
|
|
|
+ list.addAll(filter.getDistribute());
|
|
|
|
|
+ pageParams.getFilters().put("id_inid", new MultiValue(list, true));
|
|
|
|
|
+ }
|
|
|
|
|
+ List<Sort> sortList = new ArrayList<>();
|
|
|
|
|
+ sortList.add(new Sort("id_id", false, Sort.Type.LONG, 1L));
|
|
|
|
|
+ pageParams.getFilters().put(SearchConstants.SORT_KEY, sortList);
|
|
|
|
|
+ pageParams.getFilters().put("id_overdue", Constant.YES); // 已失效
|
|
|
|
|
+ return searchService.searchPublicInquiryItemInfoIds(keyword, pageParams);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 作为卖家,收到的采购询价(已采纳)- 搜索
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param params 分页参数
|
|
|
|
|
+ * @param searchFilter 过滤条件
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ @RequestMapping(value = "/info/search", params = RequestState.AGREED, method = RequestMethod.GET)
|
|
|
|
|
+ public SPage<PublicInquiryItemInfo> getAgreedInquiries(PageParams params, String searchFilter) {
|
|
|
|
|
+ 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_venduu", SystemSession.getUser().getEnterprise().getUu());
|
|
|
|
|
+ SearchFilter filter = userService.distribute();
|
|
|
|
|
+ if (filter != null && filter.getDistribute() == null) {
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (filter != null && !CollectionUtils.isEmpty(filter.getDistribute())) {
|
|
|
|
|
+ List<Object> list = new ArrayList<>();
|
|
|
|
|
+ for (Object object : filter.getDistribute()) {
|
|
|
|
|
+ list.add(object);
|
|
|
|
|
+ }
|
|
|
|
|
+ pageParams.getFilters().put("id_inid", new MultiValue(list, true));
|
|
|
|
|
+ }
|
|
|
|
|
+ pageParams.getFilters().put("id_agreed", Constant.YES);
|
|
|
|
|
+ pageParams.getFilters().put("id_status", Status.REPLIED.value());
|
|
|
|
|
+ HashMap<String, Object> map = new HashMap<>();
|
|
|
|
|
+ map.put("id_invalid", Constant.YES);
|
|
|
|
|
+ pageParams.setNotEqualFilters(map);
|
|
|
|
|
+ List<Sort> sortList = new ArrayList<>();
|
|
|
|
|
+ sortList.add(new Sort("id_id", false, Sort.Type.LONG, new Long(1)));
|
|
|
|
|
+ pageParams.getFilters().put(SearchConstants.SORT_KEY, sortList);
|
|
|
|
|
+ return searchService.searchPublicInquiryItemInfoIds(keyword, pageParams);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 作为卖家,收到的采购询价(未采纳)- 搜索
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param params 分页参数
|
|
|
|
|
+ * @param searchFilter 过滤条件
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ @RequestMapping(value = "/info/search", params = RequestState.REFUSED, method = RequestMethod.GET)
|
|
|
|
|
+ public SPage<PublicInquiryItemInfo> getRefusedInquiries(PageParams params, String searchFilter) {
|
|
|
|
|
+ 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_venduu", SystemSession.getUser().getEnterprise().getUu());
|
|
|
|
|
+ SearchFilter filter = userService.distribute();
|
|
|
|
|
+ if (filter != null && filter.getDistribute() == null) {
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (filter != null && !CollectionUtils.isEmpty(filter.getDistribute())) {
|
|
|
|
|
+ List<Object> list = new ArrayList<>();
|
|
|
|
|
+ for (Object object : filter.getDistribute()) {
|
|
|
|
|
+ list.add(object);
|
|
|
|
|
+ }
|
|
|
|
|
+ pageParams.getFilters().put("id_inid", new MultiValue(list, true));
|
|
|
|
|
+ }
|
|
|
|
|
+ pageParams.getFilters().put("id_agreed", Constant.NO);
|
|
|
|
|
+ pageParams.getFilters().put("id_status", Status.REPLIED.value());
|
|
|
|
|
+ List<Sort> sortList = new ArrayList<>();
|
|
|
|
|
+ sortList.add(new Sort("id_id", false, Sort.Type.LONG, new Long(1)));
|
|
|
|
|
+ pageParams.getFilters().put(SearchConstants.SORT_KEY, sortList);
|
|
|
|
|
+ return searchService.searchPublicInquiryItemInfoIds(keyword, pageParams);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 作为卖家,根据询价单ID查找询价单(含明细)
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param id 主表id
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ @RequestMapping(value = "/{id}/info", method = RequestMethod.GET)
|
|
|
|
|
+ public List<PublicInquiryItemInfo> getReceivedPurchaseOrderItemById(@PathVariable("id") Long id) {
|
|
|
|
|
+ logger.log("公共询价单", "查看详情", "查看[" + id + "]的详情");
|
|
|
|
|
+ return pubInquiryService.findById(id);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 作为卖家,查看同产品的报价历史
|
|
|
|
|
+ *
|
|
|
|
|
+ */
|
|
|
|
|
+ @RequestMapping(value = "/items/{itemId}/history", method = RequestMethod.GET)
|
|
|
|
|
+ public List<PublicInquiryItemInfo> getInquiryHistoryById(@PathVariable("itemId") Long itemId) {
|
|
|
|
|
+ logger.log("公共询价单", "查看历史报价信息", "查看[" + itemId+ "]的历史报价");
|
|
|
|
|
+ return pubInquiryService.findHistoryByItemId(itemId);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 作为卖家,给公共询价单报价
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param json 前台数据
|
|
|
|
|
+ * @param inquiryItemId 询价明细id
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ @RequestMapping(value = "/items/{inquiryItemId}/reply", method = RequestMethod.POST)
|
|
|
|
|
+ public ResponseEntity<String> replyInquiryItem(@RequestBody String json, @PathVariable("inquiryItemId") Long inquiryItemId, String token) {
|
|
|
|
|
+ PublicInquiryItem item = FlexJsonUtils.fromJson(json, PublicInquiryItem.class);
|
|
|
|
|
+ boolean flag = tokenService.enabled(token);
|
|
|
|
|
+ if (flag) {
|
|
|
|
|
+ item = pubInquiryService.reply(item);
|
|
|
|
|
+ tokenService.delete(token);
|
|
|
|
|
+ logger.log("公共询价单", "给单个客户公共询价明细填写价格并确认报价", item.replyDescription(), item.getInquiry().getCode(), inquiryItemId);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ throw new IllegalOperatorException("页面信息已过期,请刷新重试");
|
|
|
|
|
+ }
|
|
|
|
|
+ return new ResponseEntity<String>(HttpStatus.OK);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 作为卖家,保存更新公共询价单
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param json 前台数据
|
|
|
|
|
+ * @param inquiryItemId 询价明细id
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ @RequestMapping(value = "/items/{inquiryItemId}/save", method = RequestMethod.POST)
|
|
|
|
|
+ public ResponseEntity<String> saveInquiryItem(@RequestBody String json,
|
|
|
|
|
+ @PathVariable("inquiryItemId") Long inquiryItemId, String token) {
|
|
|
|
|
+ PublicInquiryItem item = FlexJsonUtils.fromJson(json, PublicInquiryItem.class);
|
|
|
|
|
+ boolean flag = tokenService.enabled(token);
|
|
|
|
|
+ if (flag) {
|
|
|
|
|
+ item = pubInquiryService.save(item);
|
|
|
|
|
+ tokenService.delete(token);
|
|
|
|
|
+ logger.log("公共询价单", "给单个客户公共询价明细填写价格", item.replyDescription(), item.getInquiry().getCode(), inquiryItemId);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ throw new IllegalOperatorException("页面信息已过期,请刷新重试");
|
|
|
|
|
+ }
|
|
|
|
|
+ return new ResponseEntity<String>(HttpStatus.OK);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 公共询价报价上传附件
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param item 公共询价明细信息
|
|
|
|
|
+ * @param uploadItem 附件信息
|
|
|
|
|
+ * @param method 操作方法
|
|
|
|
|
+ * @return
|
|
|
|
|
+ * @throws Exception
|
|
|
|
|
+ */
|
|
|
|
|
+ @RequestMapping(value = "/addAttach", method = RequestMethod.POST)
|
|
|
|
|
+ public ModelMap addItemAttaches(String item, String method, FileUpload uploadItem) throws Exception {
|
|
|
|
|
+ PublicInquiryItem inquiryItem = FlexJsonUtils.fromJson(item, PublicInquiryItem.class);
|
|
|
|
|
+ if (method.equals("save")) {
|
|
|
|
|
+ logger.log("公共询价", "给单个客户公共询价明细填写价格,上传附件信息", inquiryItem.replyDescription(), inquiryItem.getInquiry().getCode(), inquiryItem.getId());
|
|
|
|
|
+ } else if (method.equals("reply")) {
|
|
|
|
|
+ logger.log("公共询价", "给单个客户公共询价明细填写价格、上传附件信息并报价", inquiryItem.replyDescription(), inquiryItem.getInquiry().getCode(), inquiryItem.getId());
|
|
|
|
|
+ }
|
|
|
|
|
+ return pubInquiryService.addAttaches(inquiryItem, method, uploadItem);
|
|
|
|
|
+ }
|
|
|
|
|
+}
|