Browse Source

公共询价首页增加导出功能

hejq 8 years ago
parent
commit
cda8e16d9a

+ 56 - 1
src/main/java/com/uas/platform/b2b/controller/PubInquiryListController.java

@@ -4,18 +4,28 @@ import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
 import com.uas.platform.b2b.core.util.ContextUtils;
 import com.uas.platform.b2b.core.util.ContextUtils;
 import com.uas.platform.b2b.model.*;
 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.DefaultValueService;
 import com.uas.platform.b2b.service.EnquiryService;
 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.SysConf;
+import com.uas.platform.b2b.support.SystemSession;
 import com.uas.platform.b2b.support.UsageBufferedLogger;
 import com.uas.platform.b2b.support.UsageBufferedLogger;
 import com.uas.platform.core.logging.BufferedLoggerManager;
 import com.uas.platform.core.logging.BufferedLoggerManager;
 import com.uas.platform.core.model.PageInfo;
 import com.uas.platform.core.model.PageInfo;
 import com.uas.platform.core.model.PageParams;
 import com.uas.platform.core.model.PageParams;
+import com.uas.ps.core.util.StringUtils;
 import com.uas.search.b2b.model.SPage;
 import com.uas.search.b2b.model.SPage;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.ui.ModelMap;
 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;
 import java.util.List;
 
 
 /**
 /**
@@ -35,6 +45,9 @@ public class PubInquiryListController {
     @Autowired
     @Autowired
     private DefaultValueService defaultValueService;
     private DefaultValueService defaultValueService;
 
 
+    @Autowired
+    private CustomerService customerService;
+
     /**
     /**
      * 获取所有企业发布的公共询价列表信息
      * 获取所有企业发布的公共询价列表信息
      *
      *
@@ -127,4 +140,46 @@ public class PubInquiryListController {
         String key = "currency";
         String key = "currency";
         return defaultValueService.findByKindAndKey(kind, key);
         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;
+    }
 }
 }

+ 296 - 0
src/main/java/com/uas/platform/b2b/model/InquiryRemind.java

@@ -0,0 +1,296 @@
+package com.uas.platform.b2b.model;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 针对用户的询价推荐提醒
+ *
+ * Created by hejq on 2018-01-31.
+ */
+public class InquiryRemind implements Serializable {
+
+    /**
+     * default serialVersionUID
+     */
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * id
+     */
+    private Long id;
+
+    /**
+     * 询价单号
+     */
+    private String code;
+
+    /**
+     * 询价企业名称
+     */
+    private String enName;
+
+    /**
+     * 询价企业UU
+     */
+    private Long enUU;
+
+    /**
+     * 联系人
+     */
+    private String userName;
+
+    /**
+     * 联系方式
+     */
+    private String userTel;
+
+    /**
+     * 询价品牌
+     */
+    private String brand;
+
+    /**
+     * 原厂型号
+     */
+    private String cmpCode;
+
+    /**
+     * 物料规格
+     */
+    private String spec;
+
+    /**
+     * 物料名称
+     */
+    private String title;
+
+    /**
+     * 需求数量
+     */
+    private Double needQty;
+
+    /**
+     * 发布日期
+     */
+    private Date reDate;
+
+    /**
+     * 截止日期
+     */
+    private Date endDate;
+
+    /**
+     * 记录来源id
+     */
+    private Long itemId;
+
+    /**
+     * 记录转报价后的id
+     */
+    private Long newId;
+
+    /**
+     * 单据状态
+     * <note>
+     * {@code 100 在录入}
+     * {@code 101 已提交}
+     * {@code 102 已审核}
+     * {@code 103 未通过}
+     * {@code 104 已通过}
+     * </note>
+     */
+    private Integer status;
+
+    /**
+     * 被推荐的企业UU
+     */
+    private Long vendUU;
+
+    /**
+     * 被推荐的人员UU
+     */
+    private Long vendUserUU;
+
+    /**
+     * 记录日期
+     */
+    private Date date;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getCode() {
+        return code;
+    }
+
+    public void setCode(String code) {
+        this.code = code;
+    }
+
+    public String getEnName() {
+        return enName;
+    }
+
+    public void setEnName(String enName) {
+        this.enName = enName;
+    }
+
+    public Long getEnUU() {
+        return enUU;
+    }
+
+    public void setEnUU(Long enUU) {
+        this.enUU = enUU;
+    }
+
+    public String getUserName() {
+        return userName;
+    }
+
+    public void setUserName(String userName) {
+        this.userName = userName;
+    }
+
+    public String getUserTel() {
+        return userTel;
+    }
+
+    public void setUserTel(String userTel) {
+        this.userTel = userTel;
+    }
+
+    public String getBrand() {
+        return brand;
+    }
+
+    public void setBrand(String brand) {
+        this.brand = brand;
+    }
+
+    public String getCmpCode() {
+        return cmpCode;
+    }
+
+    public void setCmpCode(String cmpCode) {
+        this.cmpCode = cmpCode;
+    }
+
+    public String getSpec() {
+        return spec;
+    }
+
+    public void setSpec(String spec) {
+        this.spec = spec;
+    }
+
+    public String getTitle() {
+        return title;
+    }
+
+    public void setTitle(String title) {
+        this.title = title;
+    }
+
+    public Double getNeedQty() {
+        return needQty;
+    }
+
+    public void setNeedQty(Double needQty) {
+        this.needQty = needQty;
+    }
+
+    public Date getReDate() {
+        return reDate;
+    }
+
+    public void setReDate(Date reDate) {
+        this.reDate = reDate;
+    }
+
+    public Date getEndDate() {
+        return endDate;
+    }
+
+    public void setEndDate(Date endDate) {
+        this.endDate = endDate;
+    }
+
+    public Long getItemId() {
+        return itemId;
+    }
+
+    public void setItemId(Long itemId) {
+        this.itemId = itemId;
+    }
+
+    public Long getNewId() {
+        return newId;
+    }
+
+    public void setNewId(Long newId) {
+        this.newId = newId;
+    }
+
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
+    public Long getVendUU() {
+        return vendUU;
+    }
+
+    public void setVendUU(Long vendUU) {
+        this.vendUU = vendUU;
+    }
+
+    public Long getVendUserUU() {
+        return vendUserUU;
+    }
+
+    public void setVendUserUU(Long vendUserUU) {
+        this.vendUserUU = vendUserUU;
+    }
+
+    public Date getDate() {
+        return date;
+    }
+
+    public void setDate(Date date) {
+        this.date = date;
+    }
+
+    @Override
+    public String toString() {
+        return "InquiryRemind{" +
+                "id=" + id +
+                ", code='" + code + '\'' +
+                ", enName='" + enName + '\'' +
+                ", enUU=" + enUU +
+                ", userName='" + userName + '\'' +
+                ", userTel='" + userTel + '\'' +
+                ", brand='" + brand + '\'' +
+                ", cmpCode='" + cmpCode + '\'' +
+                ", spec='" + spec + '\'' +
+                ", title='" + title + '\'' +
+                ", needQty=" + needQty +
+                ", reDate=" + reDate +
+                ", endDate=" + endDate +
+                ", itemId=" + itemId +
+                ", newId=" + newId +
+                ", status=" + status +
+                ", vendUU=" + vendUU +
+                ", vendUserUU=" + vendUserUU +
+                ", date=" + date +
+                '}';
+    }
+}

+ 22 - 0
src/main/java/com/uas/platform/b2b/ps/InquiryUtils.java

@@ -312,4 +312,26 @@ public class InquiryUtils {
         }
         }
         return null;
         return null;
     }
     }
+
+    /**
+     * 获取推荐列表信息
+     *
+     * @param pageInfo 分页参数
+     * @param searchFilter 过滤条件
+     * @param userUU 用户UU
+     * @param enUU 企业UU
+     * @return
+     * @throws Exception
+     */
+    public static Page<InquiryRemind> getRemind(PageInfo pageInfo, SearchFilter searchFilter, Long userUU, Long enUU) throws Exception {
+        JSONObject formData = JSON.parseObject(JSON.toJSONString(pageInfo));
+        if (searchFilter != null) {
+            formData.putAll(JSON.parseObject(JSON.toJSONString(searchFilter)));
+        }
+        formData.put("useruu", userUU);
+        formData.put("enuu", enUU);
+        HttpUtil.Response res = HttpUtil.sendGetRequest(url + "/inquiry/sale/remind", formData);
+        return (Page)JSONObject.parseObject(res.getResponseText(), new TypeReference<Page<InquiryRemind>>() {
+        }, new Feature[0]);
+    }
 }
 }

BIN
src/main/resources/jxls-tpl/public/inquiryRemind.xls


BIN
src/main/resources/jxls-tpl/public/publicInquiry.xls


+ 3 - 1
src/main/webapp/resources/js/index/app.js

@@ -5606,6 +5606,7 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
                                 if (response) {
                                 if (response) {
                                     params.total(response.totalElements);
                                     params.total(response.totalElements);
                                     $defer.resolve(response.content);
                                     $defer.resolve(response.content);
+                                    $scope.searchFilterXls = angular.copy(pageParams.searchFilter);//保存当前取值的关键词
                                 }
                                 }
                             }).error(function (err) {
                             }).error(function (err) {
                                 $scope.loading = false;
                                 $scope.loading = false;
@@ -5626,6 +5627,7 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
                                     if (response) {
                                     if (response) {
                                         params.total(response.totalElements);
                                         params.total(response.totalElements);
                                         $defer.resolve(response.content);
                                         $defer.resolve(response.content);
+                                        $scope.searchFilterXls = angular.copy(pageParams.searchFilter);//保存当前取值的关键词
                                     }
                                     }
                                 }).error(function (err) {
                                 }).error(function (err) {
                                     $scope.loading = false;
                                     $scope.loading = false;
@@ -6259,7 +6261,7 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
                     if (page) {
                     if (page) {
                         params.total(page.totalElement);
                         params.total(page.totalElement);
                         $defer.resolve(page.content);
                         $defer.resolve(page.content);
-                        $scope.searchFilterXls = angular.copy(pageParams.searchFilter);//保存当前取值的关键词
+                        $scope.searchFilterXls = angular.copy(pageParams.searchFilter);//保存当前取值的关键词 $scope.searchFilterXls = angular.copy(pageParams.searchFilter);//保存当前取值的关键词
                     }
                     }
                 }, function (response) {
                 }, function (response) {
                     $scope.loading = false;
                     $scope.loading = false;

+ 1 - 0
src/main/webapp/resources/tpl/index/baseInfo/inquiry_list.html

@@ -328,6 +328,7 @@
                         <!--(<em> 10 </em>)-->
                         <!--(<em> 10 </em>)-->
                     </span>
                     </span>
                     <a href="#/index">返回</a>
                     <a href="#/index">返回</a>
+                    <a href="pubInquiry/xls?keyword={{keyword}}&fromDate={{filterXls.fromDate}}&endDate={{filterXls.endDate}}&state={{active}}">导出</a>
                 </div>
                 </div>
                 <div class="tender-list-content">
                 <div class="tender-list-content">
                     <div class="container">
                     <div class="container">