|
|
@@ -4,18 +4,28 @@ import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.uas.platform.b2b.core.util.ContextUtils;
|
|
|
import com.uas.platform.b2b.model.*;
|
|
|
+import com.uas.platform.b2b.ps.InquiryUtils;
|
|
|
+import com.uas.platform.b2b.service.CustomerService;
|
|
|
import com.uas.platform.b2b.service.DefaultValueService;
|
|
|
import com.uas.platform.b2b.service.EnquiryService;
|
|
|
+import com.uas.platform.b2b.support.JxlsExcelView;
|
|
|
import com.uas.platform.b2b.support.SysConf;
|
|
|
+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.ps.core.util.StringUtils;
|
|
|
import com.uas.search.b2b.model.SPage;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.ui.ModelMap;
|
|
|
-import org.springframework.web.bind.annotation.*;
|
|
|
+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.RestController;
|
|
|
+import org.springframework.web.servlet.ModelAndView;
|
|
|
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
|
@@ -35,6 +45,9 @@ public class PubInquiryListController {
|
|
|
@Autowired
|
|
|
private DefaultValueService defaultValueService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private CustomerService customerService;
|
|
|
+
|
|
|
/**
|
|
|
* 获取所有企业发布的公共询价列表信息
|
|
|
*
|
|
|
@@ -127,4 +140,46 @@ public class PubInquiryListController {
|
|
|
String key = "currency";
|
|
|
return defaultValueService.findByKindAndKey(kind, key);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 导出公共询价信息
|
|
|
+ *
|
|
|
+ * @param keyword 关键字
|
|
|
+ * @param fromDate 开始日期
|
|
|
+ * @param endDate 截止日期
|
|
|
+ * @param state 状态
|
|
|
+ * @return
|
|
|
+ * @throws Exception
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/xls", method = RequestMethod.GET)
|
|
|
+ public ModelAndView exportInquiries(String keyword, Long fromDate, Long endDate, String state) throws Exception {
|
|
|
+ PageInfo pageInfo = new PageInfo(1, JxlsExcelView.MAX_SIZE, 0);
|
|
|
+ SearchFilter filter = new SearchFilter();
|
|
|
+ filter.setEnUU(SystemSession.getUser().getEnterprise().getUu());
|
|
|
+ filter.setFromDate(fromDate);
|
|
|
+ filter.setEndDate(endDate);
|
|
|
+ filter.setKeyword(keyword);
|
|
|
+ filter.setUserUU(SystemSession.getUser().getUserUU());
|
|
|
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy年MM月dd日");
|
|
|
+ ModelAndView modelAndView = new ModelAndView();
|
|
|
+ modelAndView.addObject("dateFormat", dateFormat);
|
|
|
+ if (StringUtils.isEmpty(state) || state.equals("all")) {
|
|
|
+ modelAndView.addObject("state", "全部");
|
|
|
+ modelAndView.addObject("data", enquiryService.fingByPageInfo(pageInfo, filter).getContent());
|
|
|
+ modelAndView.setView(new JxlsExcelView("classpath:jxls-tpl/public/publicInquiry", "公共询价单列表"));
|
|
|
+ logger.log("公共询价单", "导出Excel列表", "导出公共询价列表(全部)");
|
|
|
+ } else if (state.equals("customer")) {// 导出客户询价列表
|
|
|
+ modelAndView.addObject("state", "我的客户询价");
|
|
|
+ filter.setDistribute(customerService.getCustomerDistribute());
|
|
|
+ modelAndView.addObject("data", enquiryService.fingByPageInfo(pageInfo, filter).getContent());
|
|
|
+ modelAndView.setView(new JxlsExcelView("classpath:jxls-tpl/public/publicInquiry", "客户公共询价列表"));
|
|
|
+ logger.log("公共询价单", "导出Excel列表", "导出我的客户询价列表");
|
|
|
+ } else if (state.equals("remind")){
|
|
|
+ modelAndView.addObject("state", "推荐报价列表");
|
|
|
+ modelAndView.addObject("data", InquiryUtils.getRemind(pageInfo, filter, SystemSession.getUser().getUserUU(), SystemSession.getUser().getEnterprise().getUu()).getContent());
|
|
|
+ modelAndView.setView(new JxlsExcelView("classpath:jxls-tpl/public/inquiryRemind", "推荐报价列表"));
|
|
|
+ logger.log("公共询价单", "导出Excel列表", "导出推荐报价列表");
|
|
|
+ }
|
|
|
+ return modelAndView;
|
|
|
+ }
|
|
|
}
|