|
|
@@ -1,6 +1,7 @@
|
|
|
package com.uas.platform.b2b.controller;
|
|
|
|
|
|
import com.alibaba.dubbo.common.utils.CollectionUtils;
|
|
|
+import com.alibaba.dubbo.common.utils.StringUtils;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.uas.platform.b2b.model.MakeOrder;
|
|
|
import com.uas.platform.b2b.model.MakeOrderReply;
|
|
|
@@ -9,12 +10,15 @@ import com.uas.platform.b2b.search.SearchService;
|
|
|
import com.uas.platform.b2b.service.MakeOrderService;
|
|
|
import com.uas.platform.b2b.service.UserService;
|
|
|
import com.uas.platform.b2b.support.JxlsExcelView;
|
|
|
+import com.uas.platform.b2b.support.SPageUtils;
|
|
|
import com.uas.platform.b2b.support.SystemSession;
|
|
|
import com.uas.platform.b2b.support.UsageBufferedLogger;
|
|
|
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.persistence.criteria.PredicateUtils;
|
|
|
import com.uas.platform.core.util.serializer.FlexJsonUtils;
|
|
|
import com.uas.platform.core.web.bind.RequestState;
|
|
|
import com.uas.search.b2b.model.MultiValue;
|
|
|
@@ -54,6 +58,7 @@ public class MakeOrderController {
|
|
|
|
|
|
@Autowired
|
|
|
private UserService userService;
|
|
|
+
|
|
|
private final static UsageBufferedLogger logger = BufferedLoggerManager.getLogger(UsageBufferedLogger.class);
|
|
|
|
|
|
/**
|
|
|
@@ -66,28 +71,36 @@ public class MakeOrderController {
|
|
|
@ResponseBody
|
|
|
public SPage<MakeOrder> getAllMakeOrders(PageParams params, String searchFilter) {
|
|
|
logger.log("客户采购单", "查看收到的客户采购订单列表(包括委外明细)(全部)");
|
|
|
- JSONObject jsonObject = JSONObject.parseObject(searchFilter);
|
|
|
- String keyword = jsonObject.getString("keyword");
|
|
|
+ SearchFilter filter = JSONObject.parseObject(searchFilter, SearchFilter.class);
|
|
|
com.uas.search.b2b.model.PageParams pageParams = searchService.convertPageParams(params, searchFilter);
|
|
|
// 当前登录企业作为供应商
|
|
|
pageParams.getFilters().put("ma_venduu", SystemSession.getUser().getEnterprise().getUu());
|
|
|
// TODO 其他过滤条件
|
|
|
- SearchFilter filter = userService.distribute();
|
|
|
+ SearchFilter distribute = userService.distribute();
|
|
|
if (filter != null && filter.getDistribute() == null) {
|
|
|
return null;
|
|
|
}
|
|
|
- if (filter != null && !CollectionUtils.isEmpty(filter.getDistribute())) {
|
|
|
+ if (distribute != null && !CollectionUtils.isEmpty(distribute.getDistribute())) {
|
|
|
List<Object> list = new ArrayList<>();
|
|
|
- for (Object object : filter.getDistribute()) {
|
|
|
+ for (Object object : distribute.getDistribute()) {
|
|
|
list.add(object);
|
|
|
}
|
|
|
pageParams.getFilters().put("ma_enuu", new MultiValue(list, true));
|
|
|
}
|
|
|
+ if (StringUtils.isEmpty(filter.getKeyword())) {
|
|
|
+ PageInfo pageInfo = new PageInfo(params);
|
|
|
+ pageInfo.setSort(new org.springframework.data.domain.Sort(org.springframework.data.domain.Sort.Direction.DESC, "date"));
|
|
|
+ pageInfo.filter("vendUU", SystemSession.getUser().getEnterprise().getUu());
|
|
|
+ if (null != distribute) {
|
|
|
+ pageInfo.expression(PredicateUtils.in("enUU", distribute.getDistribute(), true));
|
|
|
+ }
|
|
|
+ return SPageUtils.covertSPage(makeOrderService.findAllDetailByPageInfo(pageInfo, filter));
|
|
|
+ }
|
|
|
// 排序条件
|
|
|
List<Sort> sortList = new ArrayList<>();
|
|
|
sortList.add(new Sort("ma_id", false, Type.LONG, new Long(1)));
|
|
|
pageParams.getFilters().put(SearchConstants.SORT_KEY, sortList);
|
|
|
- return searchService.searchMakeOrderIds(keyword, pageParams);
|
|
|
+ return searchService.searchMakeOrderIds(filter.getKeyword(), pageParams);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -100,30 +113,39 @@ public class MakeOrderController {
|
|
|
@ResponseBody
|
|
|
public SPage<MakeOrder> getDoneMakeOrders(PageParams params, String searchFilter) {
|
|
|
logger.log("委外加工单", "查看收到的委外加工单列表(已回复)");
|
|
|
- JSONObject jsonObject = JSONObject.parseObject(searchFilter);
|
|
|
- String keyword = jsonObject.getString("keyword");
|
|
|
+ SearchFilter filter = JSONObject.parseObject(searchFilter, SearchFilter.class);
|
|
|
com.uas.search.b2b.model.PageParams pageParams = searchService.convertPageParams(params, searchFilter);
|
|
|
// 当前登录企业作为供应商
|
|
|
pageParams.getFilters().put("ma_venduu", SystemSession.getUser().getEnterprise().getUu());
|
|
|
// TODO 其他过滤条件
|
|
|
- SearchFilter filter = userService.distribute();
|
|
|
- if (filter != null && filter.getDistribute() == null) {
|
|
|
+ SearchFilter distribute = userService.distribute();
|
|
|
+ if (distribute != null && distribute.getDistribute() == null) {
|
|
|
return null;
|
|
|
}
|
|
|
- if (filter != null && !CollectionUtils.isEmpty(filter.getDistribute())) {
|
|
|
+ if (distribute != null && !CollectionUtils.isEmpty(distribute.getDistribute())) {
|
|
|
List<Object> list = new ArrayList<>();
|
|
|
- for (Object object : filter.getDistribute()) {
|
|
|
+ for (Object object : distribute.getDistribute()) {
|
|
|
list.add(object);
|
|
|
}
|
|
|
pageParams.getFilters().put("ma_enuu", new MultiValue(list, true));
|
|
|
}
|
|
|
+ if (StringUtils.isEmpty(filter.getKeyword())) {
|
|
|
+ PageInfo pageInfo = new PageInfo(params);
|
|
|
+ pageInfo.setSort(new org.springframework.data.domain.Sort(org.springframework.data.domain.Sort.Direction.DESC, "date"));
|
|
|
+ pageInfo.filter("status", Status.REPLIED.value());
|
|
|
+ pageInfo.filter("end", Constant.NO);
|
|
|
+ if (null != distribute) {
|
|
|
+ pageInfo.expression(PredicateUtils.in("enUU", distribute.getDistribute(), true));
|
|
|
+ }
|
|
|
+ return SPageUtils.covertSPage(makeOrderService.findAllDetailByPageInfo(pageInfo, filter));
|
|
|
+ }
|
|
|
pageParams.getFilters().put("ma_status", Status.REPLIED.value());
|
|
|
pageParams.getFilters().put("ma_end", Constant.NO);
|
|
|
// 排序条件
|
|
|
List<Sort> sortList = new ArrayList<>();
|
|
|
sortList.add(new Sort("ma_id", false, Type.LONG, new Long(1)));
|
|
|
pageParams.getFilters().put(SearchConstants.SORT_KEY, sortList);
|
|
|
- return searchService.searchMakeOrderIds(keyword, pageParams);
|
|
|
+ return searchService.searchMakeOrderIds(filter.getKeyword(), pageParams);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -136,30 +158,39 @@ public class MakeOrderController {
|
|
|
@ResponseBody
|
|
|
public SPage<MakeOrder> getToDoMakeOrders(PageParams params, String searchFilter) {
|
|
|
logger.log("委外加工单", "查看收到的委外加工单列表(未回复)");
|
|
|
- JSONObject jsonObject = JSONObject.parseObject(searchFilter);
|
|
|
- String keyword = jsonObject.getString("keyword");
|
|
|
+ SearchFilter filter = JSONObject.parseObject(searchFilter, SearchFilter.class);
|
|
|
com.uas.search.b2b.model.PageParams pageParams = searchService.convertPageParams(params, searchFilter);
|
|
|
// 当前登录企业作为供应商
|
|
|
pageParams.getFilters().put("ma_venduu", SystemSession.getUser().getEnterprise().getUu());
|
|
|
// TODO 其他过滤条件
|
|
|
- SearchFilter filter = userService.distribute();
|
|
|
- if (filter != null && filter.getDistribute() == null) {
|
|
|
+ SearchFilter distribute = userService.distribute();
|
|
|
+ if (distribute != null && distribute.getDistribute() == null) {
|
|
|
return null;
|
|
|
}
|
|
|
- if (filter != null && !CollectionUtils.isEmpty(filter.getDistribute())) {
|
|
|
+ if (distribute != null && !CollectionUtils.isEmpty(distribute.getDistribute())) {
|
|
|
List<Object> list = new ArrayList<>();
|
|
|
- for (Object object : filter.getDistribute()) {
|
|
|
+ for (Object object : distribute.getDistribute()) {
|
|
|
list.add(object);
|
|
|
}
|
|
|
pageParams.getFilters().put("ma_enuu", new MultiValue(list, true));
|
|
|
}
|
|
|
+ if (StringUtils.isEmpty(filter.getKeyword())) {
|
|
|
+ PageInfo pageInfo = new PageInfo(params);
|
|
|
+ pageInfo.setSort(new org.springframework.data.domain.Sort(org.springframework.data.domain.Sort.Direction.DESC, "date"));
|
|
|
+ pageInfo.filter("status", Status.NOT_REPLY.value());
|
|
|
+ pageInfo.filter("end", Constant.NO);
|
|
|
+ if (null != distribute) {
|
|
|
+ pageInfo.expression(PredicateUtils.in("enUU", distribute.getDistribute(), true));
|
|
|
+ }
|
|
|
+ return SPageUtils.covertSPage(makeOrderService.findAllDetailByPageInfo(pageInfo, filter));
|
|
|
+ }
|
|
|
pageParams.getFilters().put("ma_status", Status.NOT_REPLY.value());
|
|
|
pageParams.getFilters().put("ma_end", Constant.NO);
|
|
|
// 排序条件
|
|
|
List<Sort> sortList = new ArrayList<>();
|
|
|
sortList.add(new Sort("ma_id", false, Type.LONG, new Long(1)));
|
|
|
pageParams.getFilters().put(SearchConstants.SORT_KEY, sortList);
|
|
|
- return searchService.searchMakeOrderIds(keyword, pageParams);
|
|
|
+ return searchService.searchMakeOrderIds(filter.getKeyword(), pageParams);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -172,29 +203,37 @@ public class MakeOrderController {
|
|
|
@ResponseBody
|
|
|
public SPage<MakeOrder> getEndMakeOrders(PageParams params, String searchFilter) {
|
|
|
logger.log("委外加工单", "查看收到的委外加工单列表(已结案)");
|
|
|
- JSONObject jsonObject = JSONObject.parseObject(searchFilter);
|
|
|
- String keyword = jsonObject.getString("keyword");
|
|
|
+ SearchFilter filter = JSONObject.parseObject(searchFilter, SearchFilter.class);
|
|
|
com.uas.search.b2b.model.PageParams pageParams = searchService.convertPageParams(params, searchFilter);
|
|
|
// 当前登录企业作为供应商
|
|
|
pageParams.getFilters().put("ma_venduu", SystemSession.getUser().getEnterprise().getUu());
|
|
|
// TODO 其他过滤条件
|
|
|
- SearchFilter filter = userService.distribute();
|
|
|
- if (filter != null && filter.getDistribute() == null) {
|
|
|
+ SearchFilter distribute = userService.distribute();
|
|
|
+ if (distribute != null && distribute.getDistribute() == null) {
|
|
|
return null;
|
|
|
}
|
|
|
- if (filter != null && !CollectionUtils.isEmpty(filter.getDistribute())) {
|
|
|
+ if (distribute != null && !CollectionUtils.isEmpty(distribute.getDistribute())) {
|
|
|
List<Object> list = new ArrayList<>();
|
|
|
- for (Object object : filter.getDistribute()) {
|
|
|
+ for (Object object : distribute.getDistribute()) {
|
|
|
list.add(object);
|
|
|
}
|
|
|
pageParams.getFilters().put("ma_enuu", new MultiValue(list, true));
|
|
|
}
|
|
|
+ if (StringUtils.isEmpty(filter.getKeyword())) {
|
|
|
+ PageInfo pageInfo = new PageInfo(params);
|
|
|
+ pageInfo.setSort(new org.springframework.data.domain.Sort(org.springframework.data.domain.Sort.Direction.DESC, "date"));
|
|
|
+ pageInfo.filter("end", Constant.YES);
|
|
|
+ if (null != distribute) {
|
|
|
+ pageInfo.expression(PredicateUtils.in("enUU", distribute.getDistribute(), true));
|
|
|
+ }
|
|
|
+ return SPageUtils.covertSPage(makeOrderService.findAllDetailByPageInfo(pageInfo, filter));
|
|
|
+ }
|
|
|
pageParams.getFilters().put("ma_end", Constant.YES);
|
|
|
// 排序条件
|
|
|
List<Sort> sortList = new ArrayList<>();
|
|
|
sortList.add(new Sort("ma_id", false, Type.LONG, new Long(1)));
|
|
|
pageParams.getFilters().put(SearchConstants.SORT_KEY, sortList);
|
|
|
- return searchService.searchMakeOrderIds(keyword, pageParams);
|
|
|
+ return searchService.searchMakeOrderIds(filter.getKeyword(), pageParams);
|
|
|
}
|
|
|
|
|
|
/**
|