|
|
@@ -5,7 +5,6 @@ import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.data.domain.Sort.Direction;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
@@ -14,6 +13,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
import org.springframework.web.servlet.ModelAndView;
|
|
|
|
|
|
import com.alibaba.dubbo.common.utils.CollectionUtils;
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.uas.platform.b2b.model.PurchaseApBill;
|
|
|
import com.uas.platform.b2b.model.SearchFilter;
|
|
|
@@ -24,7 +24,6 @@ import com.uas.platform.b2b.support.JxlsExcelView;
|
|
|
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.PageInfo;
|
|
|
import com.uas.platform.core.model.PageParams;
|
|
|
import com.uas.search.b2b.model.MultiValue;
|
|
|
import com.uas.search.b2b.model.SPage;
|
|
|
@@ -108,14 +107,34 @@ public class SaleApBillController {
|
|
|
*/
|
|
|
@RequestMapping(value = "/xls", method = RequestMethod.GET)
|
|
|
public ModelAndView export(String keyword, Long fromDate, Long endDate) {
|
|
|
- PageInfo pageInfo = new PageInfo(1, JxlsExcelView.MAX_SIZE, 0);
|
|
|
- pageInfo.sorting("date", Direction.DESC);
|
|
|
- pageInfo.filter("vendUU", SystemSession.getUser().getEnterprise().getUu());
|
|
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy年MM月dd日");
|
|
|
ModelAndView modelAndView = new ModelAndView();
|
|
|
modelAndView.addObject("dateFormat", dateFormat);
|
|
|
- modelAndView.addObject("data",
|
|
|
- purchaseApBillService.findAllByPageInfo(pageInfo, keyword, fromDate, endDate, null).getContent());
|
|
|
+ SearchFilter searchFilter = new SearchFilter();
|
|
|
+ searchFilter.setEndDate(endDate);
|
|
|
+ searchFilter.setFromDate(fromDate);
|
|
|
+ PageParams params = new PageParams();
|
|
|
+ com.uas.search.b2b.model.PageParams pageParams = searchService.convertPageParams(params,
|
|
|
+ JSON.toJSONString(searchFilter));
|
|
|
+ // 当前登录企业作为供应商
|
|
|
+ pageParams.getFilters().put("pad_venduu", 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("pad_enuu", new MultiValue(list, true));
|
|
|
+ }
|
|
|
+ // 排序条件
|
|
|
+ List<Sort> sortList = new ArrayList<>();
|
|
|
+ sortList.add(new Sort("pab_id", false, Type.LONG, new Long(1)));
|
|
|
+ pageParams.getFilters().put(SearchConstants.SORT_KEY, sortList);
|
|
|
+ modelAndView.addObject("data", searchService.searchPurchaseApBillIds(keyword, pageParams).getContent());
|
|
|
modelAndView.setView(new JxlsExcelView("classpath:jxls-tpl/fa/faApBill", "客户应付发票列表"));
|
|
|
logger.log("客户应付发票", "导出Excel列表", "导出全部Excel列表");
|
|
|
return modelAndView;
|