Browse Source

Merge branch 'master' of http://git.iamberry.com/hexiugang/iamberry-common-parent

# Conflicts:
#	watero-rst-web/src/main/webapp/common/js/salesOrder/salesOrder.js
wangxiaoming 6 years ago
parent
commit
8b9fbcc9c2

+ 2 - 0
watero-rst-core/src/main/java/com.iamberry.rst.core/cm/CustomerStatisticalInfo.java

@@ -15,6 +15,8 @@ public class CustomerStatisticalInfo implements Serializable {
     private static final long serialVersionUID = 7150678136334412114L;
     private Integer customerId;//客诉id
     private Integer orderId;//订单id
+    @DateTimeFormat(pattern="yyyy-MM-dd")
+    @JsonFormat(pattern="yyyy-MM-dd",timezone = "GMT+8")
     private Date createTime;//创建日期
     private String customerName;//姓名
     private String customerTel;//联系电话

+ 74 - 0
watero-rst-core/src/main/java/com.iamberry.rst.core/cm/DownloadProgressInfo.java

@@ -0,0 +1,74 @@
+package com.iamberry.rst.core.cm;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * Created by Administrator on 2019/4/1.
+ */
+public class DownloadProgressInfo implements Serializable {
+    private static final long serialVersionUID = -532651953639505413L;
+    private Integer downloadId;
+    private Integer downloadAdminId;
+    private String downloadProgress;
+    private Integer downloadStatus;
+    private String downloadUrl;
+    private Date downloadDate;
+    private Date downloadCreateTime;
+
+    public Integer getDownloadId() {
+        return downloadId;
+    }
+
+    public void setDownloadId(Integer downloadId) {
+        this.downloadId = downloadId;
+    }
+
+    public Integer getDownloadAdminId() {
+        return downloadAdminId;
+    }
+
+    public void setDownloadAdminId(Integer downloadAdminId) {
+        this.downloadAdminId = downloadAdminId;
+    }
+
+    public String getDownloadProgress() {
+        return downloadProgress;
+    }
+
+    public void setDownloadProgress(String downloadProgress) {
+        this.downloadProgress = downloadProgress;
+    }
+
+    public Integer getDownloadStatus() {
+        return downloadStatus;
+    }
+
+    public void setDownloadStatus(Integer downloadStatus) {
+        this.downloadStatus = downloadStatus;
+    }
+
+    public String getDownloadUrl() {
+        return downloadUrl;
+    }
+
+    public void setDownloadUrl(String downloadUrl) {
+        this.downloadUrl = downloadUrl;
+    }
+
+    public Date getDownloadDate() {
+        return downloadDate;
+    }
+
+    public void setDownloadDate(Date downloadDate) {
+        this.downloadDate = downloadDate;
+    }
+
+    public Date getDownloadCreateTime() {
+        return downloadCreateTime;
+    }
+
+    public void setDownloadCreateTime(Date downloadCreateTime) {
+        this.downloadCreateTime = downloadCreateTime;
+    }
+}

+ 22 - 0
watero-rst-interface/src/main/java/com/iamberry/rst/faces/cm/CustomerService.java

@@ -372,4 +372,26 @@ public interface CustomerService {
      * 修改订单项所有退货数量为0
      */
     Integer updateItemreturnNumByorderid(Integer itemOrderId);
+
+
+    /**
+     * 查询下载进度列表
+     * @param downloadProgressInfo
+     * @return
+     */
+    List<DownloadProgressInfo> listDownloadProgressInfo(DownloadProgressInfo downloadProgressInfo);
+
+    /**
+     * 修改下载进度列表
+     * @param downloadProgressInfo
+     * @return
+     */
+    Integer updateDownloadProgressInfo(DownloadProgressInfo downloadProgressInfo);
+
+    /**
+     * 添加下载进度列表
+     * @param downloadProgressInfo
+     * @return
+     */
+    Integer addDownloadProgressInfo(DownloadProgressInfo downloadProgressInfo);
 }

+ 15 - 0
watero-rst-service/src/main/java/com/iamberry/rst/service/cm/CustomerServiceImpl.java

@@ -1850,4 +1850,19 @@ public class CustomerServiceImpl implements CustomerService {
     public Integer updateItemreturnNumByorderid(Integer itemOrderId) {
         return customerInfoMapper.updateItemreturnNumByorderid(itemOrderId);
     }
+
+    @Override
+    public List<DownloadProgressInfo> listDownloadProgressInfo(DownloadProgressInfo downloadProgressInfo) {
+        return customerInfoMapper.listDownloadProgressInfo(downloadProgressInfo);
+    }
+
+    @Override
+    public Integer updateDownloadProgressInfo(DownloadProgressInfo downloadProgressInfo) {
+        return customerInfoMapper.updateDownloadProgressInfo(downloadProgressInfo);
+    }
+
+    @Override
+    public Integer addDownloadProgressInfo(DownloadProgressInfo downloadProgressInfo) {
+        return customerInfoMapper.addDownloadProgressInfo(downloadProgressInfo);
+    }
 }

+ 20 - 0
watero-rst-service/src/main/java/com/iamberry/rst/service/cm/mapper/CustomerInfoMapper.java

@@ -226,4 +226,24 @@ public interface CustomerInfoMapper {
      */
     Integer updateItemreturnNumByorderid(Integer itemOrderId);
 
+    /**
+     * 查询下载进度列表
+     * @param downloadProgressInfo
+     * @return
+     */
+    List<DownloadProgressInfo> listDownloadProgressInfo(DownloadProgressInfo downloadProgressInfo);
+
+    /**
+     * 修改下载进度列表
+     * @param downloadProgressInfo
+     * @return
+     */
+    Integer updateDownloadProgressInfo(DownloadProgressInfo downloadProgressInfo);
+
+    /**
+     * 添加下载进度列表
+     * @param downloadProgressInfo
+     * @return
+     */
+    Integer addDownloadProgressInfo(DownloadProgressInfo downloadProgressInfo);
 }

+ 57 - 1
watero-rst-service/src/main/java/com/iamberry/rst/service/cm/mapper/customerInfoMapper.xml

@@ -729,7 +729,7 @@
 SELECT
 	c.customer_id customerId,
 	null AS orderId,
-	DATE_FORMAT(c.customer_create_time,'%Y-%m-%d')  AS createTime,
+	c.customer_create_time AS createTime,
 	c.customer_name AS customerName,
 	c.customer_tel AS customerTel,
 (CASE
@@ -1432,4 +1432,60 @@ LEFT JOIN tb_rst_cm_sendback_info csi ON csi.relation_id = cr.relation_id
         item_return_num = 0
     where item_order_id = #{itemOrderId}
   </update>
+  <!--查询客诉下载进度sql state -->
+  <select id="listDownloadProgressInfo" parameterType="DownloadProgressInfo" resultType="DownloadProgressInfo">
+      SELECT * FROM tb_rst_download_progress_info
+      <where>
+        <if test="downloadId != null || downloadId != ''">
+          download_id = #{downloadId}
+        </if>
+        <if test="downloadAdminId != null || downloadAdminId != ''">
+          download_admin_id = #{downloadAdminId}
+        </if>
+        <if test="downloadStatus != null || downloadStatus != ''">
+          download_status = #{downloadStatus}
+        </if>
+      </where>
+  </select>
+  <update id="updateDownloadProgressInfo" parameterType="DownloadProgressInfo">
+      update tb_rst_download_progress_info
+      <set>
+        <if test="downloadStatus != null || downloadStatus != ''">
+          download_status = #{downloadStatus},
+        </if>
+        <if test="downloadProgress != null || downloadProgress != ''">
+          download_progress = #{downloadProgress},
+        </if>
+        <if test="downloadUrl != null || downloadUrl != ''">
+          download_url = #{downloadUrl},
+        </if>
+        <if test="downloadDate != null || downloadDate != ''">
+          download_date = #{downloadDate}
+        </if>
+      </set>
+
+  </update>
+
+  <insert id="addDownloadProgressInfo" parameterType="DownloadProgressInfo"  keyProperty="downloadId" useGeneratedKeys="true">
+    insert into tb_rst_download_progress_info
+    (
+    download_id,
+    download_admin_id,
+    download_progress,
+    download_status,
+    download_url,
+    download_create_time
+    )
+    VALUES
+    (
+    #{downloadId},
+    #{downloadAdminId},
+    #{downloadProgress},
+    #{downloadStatus},
+    #{downloadUrl},
+    NOW()
+    )
+  </insert>
+  <!--查询客诉下载进度sql end -->
+  
 </mapper>

+ 1 - 0
watero-rst-service/src/main/java/com/iamberry/rst/service/cm/mapper/salesOrderMapper.xml

@@ -392,6 +392,7 @@
         from tb_rst_sales_order_info
         LEFT JOIN tb_rst_sales_order_item oi ON tb_rst_sales_order_info.sales_id = oi.item_order_id
         <where>
+            sales_status != 3
             <if test="salesIsDownload !=null and salesIsDownload !=''">
                 AND sales_is_download = #{salesIsDownload}
             </if>

+ 59 - 7
watero-rst-web/src/main/java/com/iamberry/rst/controllers/cm/AdminCustomerController.java

@@ -47,6 +47,7 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.*;
 import java.text.MessageFormat;
+import java.text.NumberFormat;
 import java.text.SimpleDateFormat;
 import java.util.*;
 
@@ -592,7 +593,7 @@ public class AdminCustomerController {
 
         CustomerInfo ci = (CustomerInfo) map.get("customer");
         if(ci != null){
-            if(ci.getCustomerProvinceId() != null && "".equals(ci.getCustomerProvinceId())){
+            if(ci.getCustomerProvinceId() != null && !"".equals(ci.getCustomerProvinceId())){
                 Province province = new Province();
                 province.setProvinceId(Integer.valueOf(ci.getCustomerProvinceId()));
                 List<Province> provinceList = addressService.listProvince(province);
@@ -601,7 +602,7 @@ public class AdminCustomerController {
                 ci.setCustomerProvinceName("");
             }
 
-            if(ci.getCustomerCityId() != null && "".equals(ci.getCustomerCityId())){
+            if(ci.getCustomerCityId() != null && !"".equals(ci.getCustomerCityId())){
                 City city = new City();
                 city.setCityId(Integer.valueOf(ci.getCustomerCityId()));
                 List<City>  cityList = addressService.listCity(city);
@@ -610,7 +611,7 @@ public class AdminCustomerController {
                 ci.setCustomerCityName("");
             }
 
-            if(ci.getCustomerDistrictId() != null && "".equals(ci.getCustomerDistrictId())){
+            if(ci.getCustomerDistrictId() != null && !"".equals(ci.getCustomerDistrictId())){
                 District district = new District();
                 district.setDistrictId(Integer.valueOf(ci.getCustomerDistrictId()));
                 List<District> districtList = addressService.listDistrict(district);
@@ -1692,6 +1693,18 @@ public class AdminCustomerController {
      */
     @RequestMapping("/download_customer_excel")
     public void downloadEfastOrderExcel(HttpServletRequest request, HttpServletResponse res) throws Exception {
+        Admin admin = AdminUtils.getLoginAdmin();
+        //添加一条下载记录
+        DownloadProgressInfo downloadProgressInfo = new DownloadProgressInfo();
+        downloadProgressInfo.setDownloadAdminId(admin.getAdminId());
+        downloadProgressInfo.setDownloadProgress("00.00%");
+        downloadProgressInfo.setDownloadStatus(1);
+        customerService.addDownloadProgressInfo(downloadProgressInfo);
+        //循环一次的时间(毫秒)
+        long cycleOne = 0;
+        long cycleOnes = 0;
+        Date date = new Date();
+        int s = 0;
         List<CustomerStatisticalInfo> customerList = customerService.listStatisticalCustomer();
         String[] cells = {
                 "日期", "姓名", "联系电话", "类别", "来源入口",
@@ -1701,8 +1714,9 @@ public class AdminCustomerController {
                 "状态", "寄出快递", "寄出快递", "开箱损", "二次客诉", "跟进客服", "工厂报价", "客户报价", "邮费信息"
         };
         List<CustomerStatisticalInfo> customerStatisticalInfoList = new ArrayList<>();
-        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
         for (CustomerStatisticalInfo customerInfo : customerList) {
+            long startTime=System.currentTimeMillis();   //获取开始时间
+            s++;
             //新建一个容器
             CustomerStatisticalInfo customer = new CustomerStatisticalInfo();
             //将数据copy到新容器
@@ -1769,9 +1783,27 @@ public class AdminCustomerController {
             }else{
                 customerStatisticalInfoList.add(customer);
             }
+            long endTime=System.currentTimeMillis(); //获取结束时间
+            if(s == 1){
+                cycleOne = startTime - endTime;
+                cycleOnes = cycleOne * customerList.size();
+                date.setTime(cycleOnes);
+                //修改预计下载完成时间
+                downloadProgressInfo.setDownloadDate(date);
+                downloadProgressInfo.setDownloadProgress("01.00%");//进度变为1
+                customerService.updateDownloadProgressInfo(downloadProgressInfo);
+            }else{
+                NumberFormat numberFormat = NumberFormat.getInstance();
+                numberFormat.setMaximumFractionDigits(2);
+                float percentage = (float) s / (float) customerList.size() * 100;
+                String result = numberFormat.format(percentage);
+                downloadProgressInfo.setDownloadProgress(result);
+                customerService.updateDownloadProgressInfo(downloadProgressInfo);
+            }
+
         }
             //导出订单Excel并下载
-            customerExcel(request,res,cells,customerStatisticalInfoList);
+            customerExcel(request,res,cells,customerStatisticalInfoList,downloadProgressInfo);
 
         }
 
@@ -1784,7 +1816,8 @@ public class AdminCustomerController {
      * @throws Exception
      */
     public void customerExcel(HttpServletRequest request,HttpServletResponse res,
-                                String[] cells,List<CustomerStatisticalInfo> customerList) throws Exception {
+                                String[] cells,List<CustomerStatisticalInfo> customerList,
+                              DownloadProgressInfo downloadProgressInfo) throws Exception {
 
         //创建一个workbook,对应一个Excel文件
         HSSFWorkbook wb = new HSSFWorkbook();
@@ -1885,7 +1918,26 @@ public class AdminCustomerController {
 
         }
         //下载导出订单Excel
-        downloadCustomerExcel(res,wb);
+       downloadCustomerExcel(wb,downloadProgressInfo);
+    }
+
+    /**
+     * 下载导出客诉到本地
+     * @param wb
+     * @throws Exception
+     */
+    public void downloadCustomerExcel(HSSFWorkbook wb,DownloadProgressInfo downloadProgressInfo) throws Exception{
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
+        String fileName = format.format(new Date()) + "客诉报表";
+        try {
+        FileOutputStream fout = new FileOutputStream("/common/customerExcel/"+fileName+downloadProgressInfo.getDownloadId()+".xls");
+        wb.write(fout);
+        fout.close();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        downloadProgressInfo.setDownloadStatus(2);
+        downloadProgressInfo.setDownloadUrl("/common/customerExcel/"+fileName+downloadProgressInfo.getDownloadId()+".xls");
     }
 
     /**

+ 8 - 2
watero-rst-web/src/main/java/com/iamberry/rst/controllers/order/AdminOrderController.java

@@ -821,8 +821,12 @@ public class AdminOrderController {
                     row.add(strarray[1]);
                 }
                 row.add(salesOrder.getSalesAddressInfo() == null ? null:salesOrder.getSalesAddressInfo());
-                String frim = replace(salesOrder.getSalesPostFirm());
-                row.add(frim);
+                if(salesOrder.getSalesPostFirm() != null){
+                    String frim = replace(salesOrder.getSalesPostFirm());
+                    row.add(frim);
+                }else{
+                    row.add(null);
+                }
                 row.add(salesOrder.getSalesPostNum() == null ? null:salesOrder.getSalesPostNum());
                 row.add(salesOrder.getItemProductName() == null ? null:salesOrder.getItemProductName()+(salesOrder.getItemProductColor() == null ? null:"-"+salesOrder.getItemProductColor()));
                 //row.add(salesOrder.getItemProductColor() == null ? null:salesOrder.getItemProductColor());
@@ -833,6 +837,8 @@ public class AdminOrderController {
                 if(salesOrder.getSalesDistributionTime() == null){
                     if(salesOrder.getSalesSendTime() != null){
                         row.add(formatter.format(salesOrder.getSalesSendTime()));
+                    }else{
+                        row.add(null);
                     }
                 }else{
                     row.add(formatter.format(salesOrder.getSalesDistributionTime()));

+ 1 - 0
watero-rst-web/src/main/resources/watero-rst-orm.xml

@@ -199,6 +199,7 @@
 
 		<typeAlias type="com.iamberry.rst.core.order.SmsTemplateInfo" alias="SmsTemplateInfo"/>
 		<typeAlias type="com.iamberry.rst.core.order.SmsSignatureInfo" alias="SmsSignatureInfo"/>
+		<typeAlias type="com.iamberry.rst.core.cm.DownloadProgressInfo" alias="DownloadProgressInfo"/>
 	</typeAliases>
 	<!-- PageHelper -->
 	<plugins>

+ 6 - 6
watero-rst-web/src/main/webapp/WEB-INF/views/cm/customer/update_relation.ftl

@@ -59,9 +59,9 @@
         </div>
         <div <#if procMethod.procMethodIsBack == 1>class="tabCon"</#if> style="display: none;">
             <div class="row cl">
-                <div class="formControls col-2 col-sm-2 text-r">
+                <#--<div class="formControls col-2 col-sm-2 text-r">
                     <strong>寄回信息</strong>
-                </div>
+                </div>-->
                 <div class="formControls col-10 col-sm-10">
                     <table class="table table-border table-bg table-bordered" >
                         <thead>
@@ -343,9 +343,9 @@
                 </div>
             </div>
             <div class="row cl" id="postageInformation" style="display: none;">
-                <div class="formControls col-2 col-sm-2 text-r">
+                <#--<div class="formControls col-2 col-sm-2 text-r">
                     <strong>邮费信息</strong>
-                </div>
+                </div>-->
                 <div class="formControls col-10 col-sm-10">
                 <table class="table table-border table-bg table-bordered" >
                     <thead>
@@ -638,9 +638,9 @@
 
         <div <#if procMethod.procMethodIsBack == 1>class="tabCon"</#if>style="display: none;">
                 <div class="row cl" id="informationInformation">
-                    <div class="formControls col-2 col-sm-2 text-r">
+                    <#--<div class="formControls col-2 col-sm-2 text-r">
                         <strong>收费信息</strong>
-                    </div>
+                    </div>-->
                     <div class="formControls col-10 col-sm-10">
                         <table class="table table-border table-bg table-bordered" >
                             <thead>

+ 5 - 1
watero-rst-web/src/main/webapp/WEB-INF/views/order/salesOrder/sales_order_detail.ftl

@@ -155,7 +155,9 @@
                         <#--<th>产品图片</th>-->
                         <th>产品市场价(¥)</th>
                         <th>产品折扣价(¥)</th>
-                        <th>产品数量</th>
+                        <th>未退货数量</th>
+                        <th>已退货数量</th>
+                        <th>产品总数</th>
                     </tr>
                     <#if order.salesOrderItemList?? &&  (order.salesOrderItemList?size > 0) >
                         <#list order.salesOrderItemList as item>
@@ -165,6 +167,8 @@
                                 <#--<td>${item.itemProductPic!''}</td>-->
                                 <td>${item.itemProductPrice/100!''}</td>
                                 <td>${item.itemProductDiscount/100!''}</td>
+                                <td>${item.itemNum-item.itemReturnNum}</td>
+                                <td>${item.itemReturnNum}</td>
                                 <td>${item.itemNum}</td>
                             </tr>
                         </#list>

+ 3 - 1
watero-rst-web/src/main/webapp/common/js/salesOrder/salesOrder.js

@@ -154,7 +154,9 @@ function setSelectCustomer(customerId){
                 if(isEmpty(cmRelation.areaNumber)){
                     ulc.setUlcById(2,cmRelation.areaNumber);
                 }
-                setSelectProduct(data.returnMsg.colorIds);
+                if(data.returnMsg.colorIds != null){
+                    setSelectProduct(data.returnMsg.colorIds);
+                }
             }else{
             }
             $("#salesCustomer").show();