|
|
@@ -4,17 +4,23 @@ 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;
|
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
+import org.springframework.web.servlet.ModelAndView;
|
|
|
|
|
|
import com.uas.platform.b2b.model.Product;
|
|
|
import com.uas.platform.b2b.search.SearchService;
|
|
|
import com.uas.platform.b2b.service.ProductService;
|
|
|
+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.Constant;
|
|
|
+import com.uas.platform.core.model.PageInfo;
|
|
|
import com.uas.platform.core.model.PageParams;
|
|
|
import com.uas.search.b2b.model.SPage;
|
|
|
import com.uas.search.b2b.model.Sort;
|
|
|
@@ -31,6 +37,8 @@ import com.uas.search.b2b.util.SearchConstants;
|
|
|
@RequestMapping("/product")
|
|
|
public class ProductController {
|
|
|
|
|
|
+ private final static UsageBufferedLogger logger = BufferedLoggerManager.getLogger(UsageBufferedLogger.class);
|
|
|
+
|
|
|
@Autowired
|
|
|
private SearchService searchService;
|
|
|
|
|
|
@@ -93,4 +101,22 @@ public class ProductController {
|
|
|
private void lockProduct(@PathVariable Long id) {
|
|
|
productService.lock(id);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 导出Excel
|
|
|
+ *
|
|
|
+ * @param params
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/xls", method = RequestMethod.GET)
|
|
|
+ public ModelAndView export(String keyword) {
|
|
|
+ PageInfo pageInfo = new PageInfo(1, JxlsExcelView.MAX_SIZE, 0);
|
|
|
+ pageInfo.sorting("id", Direction.DESC);
|
|
|
+ pageInfo.filter("enUU", SystemSession.getUser().getEnterprise().getUu());
|
|
|
+ ModelAndView modelAndView = new ModelAndView();
|
|
|
+ modelAndView.addObject("data", productService.findAllByPageInfo(pageInfo, keyword).getContent());
|
|
|
+ modelAndView.setView(new JxlsExcelView("classpath:jxls-tpl/baseInfo/baseInfo", "物料资料表"));
|
|
|
+ logger.log("物料资料", "导出Excel列表", "导出全部Excel列表");
|
|
|
+ return modelAndView;
|
|
|
+ }
|
|
|
}
|