|
|
@@ -1,35 +1,14 @@
|
|
|
package com.uas.platform.b2b.controller;
|
|
|
|
|
|
-import java.text.SimpleDateFormat;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.HashSet;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Set;
|
|
|
-
|
|
|
-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.stereotype.Controller;
|
|
|
-import org.springframework.ui.ModelMap;
|
|
|
-import org.springframework.util.CollectionUtils;
|
|
|
-import org.springframework.web.bind.annotation.*;
|
|
|
-import org.springframework.web.servlet.ModelAndView;
|
|
|
-
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
-import com.uas.platform.b2b.model.ErpProdIODetail;
|
|
|
-import com.uas.platform.b2b.model.PurchaseApCheck;
|
|
|
-import com.uas.platform.b2b.model.PurchaseApCheckItem;
|
|
|
-import com.uas.platform.b2b.model.Role;
|
|
|
-import com.uas.platform.b2b.model.SearchFilter;
|
|
|
-import com.uas.platform.b2b.model.Vendor;
|
|
|
+import com.uas.platform.b2b.model.*;
|
|
|
import com.uas.platform.b2b.search.SearchService;
|
|
|
import com.uas.platform.b2b.service.ErpProdIODetailService;
|
|
|
import com.uas.platform.b2b.service.PurchaseApCheckService;
|
|
|
import com.uas.platform.b2b.service.UserService;
|
|
|
import com.uas.platform.b2b.service.VendorService;
|
|
|
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.exception.IllegalOperatorException;
|
|
|
@@ -37,6 +16,9 @@ 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.persistence.criteria.CriterionExpression;
|
|
|
+import com.uas.platform.core.persistence.criteria.LogicalExpression;
|
|
|
+import com.uas.platform.core.persistence.criteria.SimpleExpression;
|
|
|
import com.uas.platform.core.util.serializer.FlexJsonUtils;
|
|
|
import com.uas.platform.core.web.bind.RequestState;
|
|
|
import com.uas.search.b2b.model.MultiValue;
|
|
|
@@ -44,6 +26,18 @@ import com.uas.search.b2b.model.SPage;
|
|
|
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.http.HttpStatus;
|
|
|
+import org.springframework.http.ResponseEntity;
|
|
|
+import org.springframework.stereotype.Controller;
|
|
|
+import org.springframework.ui.ModelMap;
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
+import org.springframework.util.StringUtils;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+import org.springframework.web.servlet.ModelAndView;
|
|
|
+
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.util.*;
|
|
|
|
|
|
/**
|
|
|
*
|
|
|
@@ -296,28 +290,21 @@ public class SaleApCheckController {
|
|
|
@ResponseBody
|
|
|
public SPage<PurchaseApCheck> getPurchaseApChecks(PageParams params, String searchFilter) {
|
|
|
logger.log("应收对账单", "作为买家,获取全部应收对账单");
|
|
|
- JSONObject jsonObject = JSONObject.parseObject(searchFilter);
|
|
|
- String keyword = jsonObject.getString("keyword");
|
|
|
- com.uas.search.b2b.model.PageParams pageParams = searchService.convertPageParams(params, searchFilter);
|
|
|
- // 当前登录企业作为买家
|
|
|
- pageParams.getFilters().put("pa_enuu", SystemSession.getUser().getEnterprise().getUu());
|
|
|
- // TODO 其他过滤条件
|
|
|
- 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("pa_custuu", new MultiValue(list, true));
|
|
|
- }
|
|
|
- // 排序条件
|
|
|
- List<Sort> sortList = new ArrayList<>();
|
|
|
- sortList.add(new Sort("pa_id", false, Type.LONG, new Long(1)));
|
|
|
- pageParams.getFilters().put(SearchConstants.SORT_KEY, sortList);
|
|
|
- return searchService.searchPurchaseApCheckIds(keyword, pageParams);
|
|
|
+ SearchFilter filter = JSONObject.parseObject(searchFilter, SearchFilter.class);
|
|
|
+ if (StringUtils.isEmpty(filter.getKeyword())) {
|
|
|
+ PageInfo pageInfo = new PageInfo(params);
|
|
|
+ pageInfo.filter("enUu", SystemSession.getUser().getEnterprise().getUu());
|
|
|
+ SearchFilter distribute = userService.distribute();
|
|
|
+ if (distribute != null && distribute.getDistribute() == null) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ if (distribute != null && !CollectionUtils.isEmpty(distribute.getDistribute())) {
|
|
|
+ filter.setDistribute(distribute.getDistribute());
|
|
|
+ }
|
|
|
+ return SPageUtils.covertSPage(purchaseApCheckService.findAllByPageInfo(pageInfo, null, filter));
|
|
|
+ }
|
|
|
+ com.uas.search.b2b.model.PageParams pageParams = distribute(params, searchFilter);
|
|
|
+ return searchService.searchPurchaseApCheckIds(filter.getKeyword(), pageParams);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -327,63 +314,49 @@ public class SaleApCheckController {
|
|
|
@ResponseBody
|
|
|
public SPage<PurchaseApCheck> getTodoApChecks(PageParams params, String searchFilter) {
|
|
|
logger.log("应收对账单", "获取未对账应收对账单");
|
|
|
- JSONObject jsonObject = JSONObject.parseObject(searchFilter);
|
|
|
- String keyword = jsonObject.getString("keyword");
|
|
|
- com.uas.search.b2b.model.PageParams pageParams = searchService.convertPageParams(params, searchFilter);
|
|
|
- // 当前登录企业作为买家
|
|
|
- pageParams.getFilters().put("pa_enuu", SystemSession.getUser().getEnterprise().getUu());
|
|
|
- // TODO 其他过滤条件
|
|
|
- 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("pa_custuu", new MultiValue(list, true));
|
|
|
- }
|
|
|
- pageParams.getFilters().put("pa_checkstatus", "未对账");
|
|
|
- // 排序条件
|
|
|
- List<Sort> sortList = new ArrayList<>();
|
|
|
- // 如果日期为空,设置的默认时间2000/1/1 1:1:1
|
|
|
- sortList.add(new Sort("pa_recorddate", false, Type.LONG, new Long(946659661)));
|
|
|
- sortList.add(new Sort("pa_id", false, Type.LONG, new Long(1)));
|
|
|
- pageParams.getFilters().put(SearchConstants.SORT_KEY, sortList);
|
|
|
- return searchService.searchPurchaseApCheckIds(keyword, pageParams);
|
|
|
+ SearchFilter filter = JSONObject.parseObject(searchFilter, SearchFilter.class);
|
|
|
+ if (StringUtils.isEmpty(filter.getKeyword())) {
|
|
|
+ PageInfo pageInfo = new PageInfo(params);
|
|
|
+ pageInfo.filter("enUu", SystemSession.getUser().getEnterprise().getUu());
|
|
|
+ pageInfo.filter("checkStatus", "未对账");
|
|
|
+ SearchFilter distribute = userService.distribute();
|
|
|
+ if (distribute != null && distribute.getDistribute() == null) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ if (distribute != null && !CollectionUtils.isEmpty(distribute.getDistribute())) {
|
|
|
+ filter.setDistribute(distribute.getDistribute());
|
|
|
+ }
|
|
|
+ return SPageUtils.covertSPage(purchaseApCheckService.findAllByPageInfo(pageInfo, null, filter));
|
|
|
+ }
|
|
|
+ com.uas.search.b2b.model.PageParams pageParams = distribute(params, searchFilter);
|
|
|
+ pageParams.getFilters().put("pa_checkstatus", "未对账");
|
|
|
+ return searchService.searchPurchaseApCheckIds(filter.getKeyword(), pageParams);
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
+ /**
|
|
|
* 作为卖家,获取应收对账单(已确认)
|
|
|
*/
|
|
|
@RequestMapping(value = "/info/search", params = RequestState.DONE, method = RequestMethod.GET)
|
|
|
@ResponseBody
|
|
|
public SPage<PurchaseApCheck> getDoneApChecks(PageParams params, String searchFilter) {
|
|
|
logger.log("应收对账单", "获取已确认应收对账单");
|
|
|
- JSONObject jsonObject = JSONObject.parseObject(searchFilter);
|
|
|
- String keyword = jsonObject.getString("keyword");
|
|
|
- com.uas.search.b2b.model.PageParams pageParams = searchService.convertPageParams(params, searchFilter);
|
|
|
- // 当前登录企业作为买家
|
|
|
- pageParams.getFilters().put("pa_enuu", SystemSession.getUser().getEnterprise().getUu());
|
|
|
- // TODO 其他过滤条件
|
|
|
- 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("pa_custuu", new MultiValue(list, true));
|
|
|
- }
|
|
|
+ SearchFilter filter = JSONObject.parseObject(searchFilter, SearchFilter.class);
|
|
|
+ if (StringUtils.isEmpty(filter.getKeyword())) {
|
|
|
+ PageInfo pageInfo = new PageInfo(params);
|
|
|
+ pageInfo.filter("enUu", SystemSession.getUser().getEnterprise().getUu());
|
|
|
+ pageInfo.filter("checkStatus", "已确认");
|
|
|
+ SearchFilter distribute = userService.distribute();
|
|
|
+ if (distribute != null && distribute.getDistribute() == null) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ if (distribute != null && !CollectionUtils.isEmpty(distribute.getDistribute())) {
|
|
|
+ filter.setDistribute(distribute.getDistribute());
|
|
|
+ }
|
|
|
+ return SPageUtils.covertSPage(purchaseApCheckService.findAllByPageInfo(pageInfo, null, filter));
|
|
|
+ }
|
|
|
+ com.uas.search.b2b.model.PageParams pageParams = distribute(params, searchFilter);
|
|
|
pageParams.getFilters().put("pa_checkstatus", "已确认");
|
|
|
- // 排序条件
|
|
|
- List<Sort> sortList = new ArrayList<>();
|
|
|
- sortList.add(new Sort("pa_id", false, Type.LONG, new Long(1)));
|
|
|
- pageParams.getFilters().put(SearchConstants.SORT_KEY, sortList);
|
|
|
- return searchService.searchPurchaseApCheckIds(keyword, pageParams);
|
|
|
+ return searchService.searchPurchaseApCheckIds(filter.getKeyword(), pageParams);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -393,34 +366,64 @@ public class SaleApCheckController {
|
|
|
@ResponseBody
|
|
|
public SPage<PurchaseApCheck> getEndApChecks(PageParams params, String searchFilter) {
|
|
|
logger.log("应收对账单", "获取不同意,已作废应收对账单");
|
|
|
- JSONObject jsonObject = JSONObject.parseObject(searchFilter);
|
|
|
- String keyword = jsonObject.getString("keyword");
|
|
|
- com.uas.search.b2b.model.PageParams pageParams = searchService.convertPageParams(params, searchFilter);
|
|
|
- // 当前登录企业作为买家
|
|
|
- pageParams.getFilters().put("pa_enuu", SystemSession.getUser().getEnterprise().getUu());
|
|
|
- // TODO 其他过滤条件
|
|
|
- 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("pa_custuu", new MultiValue(list, true));
|
|
|
- }
|
|
|
+ SearchFilter filter = JSONObject.parseObject(searchFilter, SearchFilter.class);
|
|
|
+ if (StringUtils.isEmpty(filter.getKeyword())) {
|
|
|
+ PageInfo pageInfo = new PageInfo(params);
|
|
|
+ pageInfo.filter("enUu", SystemSession.getUser().getEnterprise().getUu());
|
|
|
+ SearchFilter distribute = userService.distribute();
|
|
|
+ if (distribute != null && distribute.getDistribute() == null) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ if (distribute != null && !CollectionUtils.isEmpty(distribute.getDistribute())) {
|
|
|
+ filter.setDistribute(distribute.getDistribute());
|
|
|
+ }
|
|
|
+ SimpleExpression disAgreed = new SimpleExpression("checkStatus", "不同意", CriterionExpression.Operator.EQ, true);
|
|
|
+ SimpleExpression invalid = new SimpleExpression("checkStatus", "已作废", CriterionExpression.Operator.EQ, true);
|
|
|
+ SimpleExpression[] expressions = new SimpleExpression[]{disAgreed, invalid};
|
|
|
+ LogicalExpression logical = new LogicalExpression(expressions, CriterionExpression.Operator.OR);
|
|
|
+ pageInfo.orExpression(logical);
|
|
|
+ return SPageUtils.covertSPage(purchaseApCheckService.findAllByPageInfo(pageInfo, null, filter));
|
|
|
+ }
|
|
|
+ com.uas.search.b2b.model.PageParams pageParams = distribute(params, searchFilter);
|
|
|
List<Object> list = new ArrayList<>();
|
|
|
list.add("不同意");
|
|
|
list.add("已作废");
|
|
|
pageParams.getFilters().put("pa_checkstatus", new MultiValue(list, true));
|
|
|
- // 排序条件
|
|
|
- List<Sort> sortList = new ArrayList<>();
|
|
|
- sortList.add(new Sort("pa_id", false, Type.LONG, new Long(1)));
|
|
|
- pageParams.getFilters().put(SearchConstants.SORT_KEY, sortList);
|
|
|
- return searchService.searchPurchaseApCheckIds(keyword, pageParams);
|
|
|
+ return searchService.searchPurchaseApCheckIds(filter.getKeyword(), pageParams);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 设置客户分配条件等
|
|
|
+ *
|
|
|
+ * @param params 分页参数
|
|
|
+ * @param filter 过滤条件
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private com.uas.search.b2b.model.PageParams distribute(PageParams params, String filter) {
|
|
|
+ com.uas.search.b2b.model.PageParams pageParams = searchService.convertPageParams(params, filter);
|
|
|
+ // 当前登录企业作为买家
|
|
|
+ pageParams.getFilters().put("pa_enuu", SystemSession.getUser().getEnterprise().getUu());
|
|
|
+ SearchFilter distribute = userService.distribute();
|
|
|
+ if (distribute != null && distribute.getDistribute() == null) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ if (distribute != null && !CollectionUtils.isEmpty(distribute.getDistribute())) {
|
|
|
+ List<Object> list = new ArrayList<>();
|
|
|
+ for (Object object : distribute.getDistribute()) {
|
|
|
+ list.add(object);
|
|
|
+ }
|
|
|
+ pageParams.getFilters().put("pa_custuu", new MultiValue(list, true));
|
|
|
+ }
|
|
|
+ // 排序条件
|
|
|
+ List<Sort> sortList = new ArrayList<>();
|
|
|
+ // 如果日期为空,设置的默认时间2000/1/1 1:1:1
|
|
|
+ sortList.add(new Sort("pa_recorddate", false, Type.LONG, new Long(946659661)));
|
|
|
+ sortList.add(new Sort("pa_id", false, Type.LONG, new Long(1)));
|
|
|
+ pageParams.getFilters().put(SearchConstants.SORT_KEY, sortList);
|
|
|
+ return pageParams;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 导出 - 全部
|
|
|
*
|