Forráskód Böngészése

修改客户信息

liujiankang 6 éve
szülő
commit
e48e609882

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

@@ -747,7 +747,7 @@
   <select id="listStatisticalCustomer" resultType="CustomerStatisticalInfo">
 SELECT
 	c.customer_id customerId,
-	cc.orderId orderId,
+	null AS orderId,
 	DATE_FORMAT(c.customer_create_time,'%Y-%m-%d')  AS createTime,
 	c.customer_name AS customerName,
 	c.customer_tel AS customerTel,
@@ -793,97 +793,18 @@ WHEN c.customer_is_solve = 7 THEN
 ELSE
 	'未知'
 END) AS customerIsSolve,
-DATE_FORMAT(oi.sales_pay_time,'%Y-%m-%d')  AS salesPayTime,
+null  AS salesPayTime,
 sc.company_name AS companyName,
 si.store_name AS storeName,
-soi.item_product_name AS itemProductName,
-soi.item_product_color as itemProductColor,
-soi.item_num as itemNum,
-(CASE
-WHEN cc.relationBackLogisticsCompany = 'sto' THEN
-	'申通快递'
-WHEN cc.relationBackLogisticsCompany = 'yto' THEN
-	'圆通快递'
-WHEN cc.relationBackLogisticsCompany = 'sf' THEN
-	'顺丰快递'
-WHEN cc.relationBackLogisticsCompany = 'ems' THEN
-	'邮政EMS'
-WHEN cc.relationBackLogisticsCompany = 'zto' THEN
-	'中通快递'
-WHEN cc.relationBackLogisticsCompany = 'zjs' THEN
-	'宅急送'
-WHEN cc.relationBackLogisticsCompany = 'yunda' THEN
-	'韵达快递'
-WHEN cc.relationBackLogisticsCompany = 'cces' THEN
-	'cces快递'
-WHEN cc.relationBackLogisticsCompany = 'pick' THEN
-	'上门提货'
-WHEN cc.relationBackLogisticsCompany = 'htky' THEN
-	'汇通快递'
-WHEN cc.relationBackLogisticsCompany = 'ttkdex' THEN
-	'天天快递'
-WHEN cc.relationBackLogisticsCompany = 'stars' THEN
-	'星晨急便'
-WHEN cc.relationBackLogisticsCompany = 'jd' THEN
-	'京东快递'
-WHEN cc.relationBackLogisticsCompany = 'dbkd' THEN
-	'德邦快递'
-WHEN cc.relationBackLogisticsCompany = '02' THEN
-	'上门送货'
-WHEN cc.relationBackLogisticsCompany = 'lianhaowuliu' THEN
-	'联昊通'
-ELSE
-	'未知'
-END) AS relationBackLogisticsCompany,
-cc.relationBackLogisticsNo AS relationBackLogisticsNo,
-DATE_FORMAT(cc.relationBackReceiptDate,'%Y-%m-%d')  AS relationBackReceiptDate,
-(CASE
-WHEN cc.relationBackStatus = 1 THEN
-	'未寄回'
-WHEN cc.relationBackStatus = 2 THEN
-	'已寄回'
-WHEN cc.relationBackStatus = 3 THEN
-	'已收货'
-ELSE
-	'未知'
-END) AS relationBackStatus,
-(CASE
-WHEN cc.relationSendLogisticsCompany = 'sto' THEN
-	'申通快递'
-WHEN cc.relationSendLogisticsCompany = 'yto' THEN
-	'圆通快递'
-WHEN cc.relationSendLogisticsCompany = 'sf' THEN
-	'顺丰快递'
-WHEN cc.relationSendLogisticsCompany = 'ems' THEN
-	'邮政EMS'
-WHEN cc.relationSendLogisticsCompany = 'zto' THEN
-	'中通快递'
-WHEN cc.relationSendLogisticsCompany = 'zjs' THEN
-	'宅急送'
-WHEN cc.relationSendLogisticsCompany = 'yunda' THEN
-	'韵达快递'
-WHEN cc.relationSendLogisticsCompany = 'cces' THEN
-	'cces快递'
-WHEN cc.relationSendLogisticsCompany = 'pick' THEN
-	'上门提货'
-WHEN cc.relationSendLogisticsCompany = 'htky' THEN
-	'汇通快递'
-WHEN cc.relationSendLogisticsCompany = 'ttkdex' THEN
-	'天天快递'
-WHEN cc.relationSendLogisticsCompany = 'stars' THEN
-	'星晨急便'
-WHEN cc.relationSendLogisticsCompany = 'jd' THEN
-	'京东快递'
-WHEN cc.relationSendLogisticsCompany = 'dbkd' THEN
-	'德邦快递'
-WHEN cc.relationBackLogisticsCompany = '02' THEN
-	'上门送货'
-WHEN cc.relationSendLogisticsCompany = 'lianhaowuliu' THEN
-	'联昊通'
-ELSE
-	'未知'
-END) AS relationSendLogisticsCompany,
-cc.relationSendLogisticsNo AS relationSendLogisticsNo,
+null AS itemProductName,
+null as itemProductColor,
+null as itemNum,
+null AS relationBackLogisticsCompany,
+null AS relationBackLogisticsNo,
+null  AS relationBackReceiptDate,
+null AS relationBackStatus,
+null AS relationSendLogisticsCompany,
+NULL AS relationSendLogisticsNo,
 (CASE
 WHEN c.customer_out_damaged = 1 THEN
 	'是'
@@ -902,190 +823,13 @@ ELSE
 END) AS customerSecondaryCustomer
 FROM
 	tb_rst_customer_info c
-LEFT JOIN (
-		SELECT
-			'3' AS customerIsSolve,
-			renewed_id AS relationId,
-			customer_id AS customerId,
-			tb_rst_relation_order.sales_id AS orderId,
-			signclosed_id AS signclosedId,
-			renewed_back_efast_order_id AS relationBackEfastOrderId,
-			renewed_back_name AS relationBackName,
-			renewed_back_tel AS relationBackTel,
-			renewed_back_status AS relationBackStatus,
-			renewed_back_logistics_company AS relationBackLogisticsCompany,
-			renewed_back_logistics_no AS relationBackLogisticsNo,
-			renewed_back_postage AS relationBackPostage,
-			renewed_back_machine_no AS relationBackMachineNo,
-			renewed_send_status AS relationSendStatus,
-			renewed_send_name AS relationSendName,
-			renewed_send_tel AS relationSendTel,
-			province_number AS provinceNumber,
-			city_number AS cityNumber,
-			area_number AS areaNumber,
-			renewed_send_merge_address AS relationSendMergeAddress,
-			renewed_send_address AS relationSendAddress,
-			renewed_send_logistics_company AS relationSendLogisticsCompany,
-			renewed_send_logistics_no AS relationSendLogisticsNo,
-			renewed_desc AS relationDesc,
-			renewed_state AS relationState,
-			renewed_alipay AS relationAlipay,
-			renewed_is_transfer AS relationIsTransfer,
-			renewed_alipay_name AS relationAlipayName,
-			renewed_back_receipt_date AS relationBackReceiptDate
-		FROM
-			tb_rst_renewed
-		LEFT JOIN tb_rst_relation_order on tb_rst_relation_order.relation_id = tb_rst_renewed.renewed_id
-		where tb_rst_relation_order.relation_type = '3'
-		UNION ALL
-			SELECT
-				'4' AS customerIsSolve,
-				repair_id AS relationId,
-				customer_id AS customerId,
-				tb_rst_relation_order.sales_id AS orderId,
-				signclosed_id AS signclosedId,
-				repair_back_efast_order_id AS relationBackEfastOrderId,
-				repair_back_name AS relationBackName,
-				repair_back_tel AS relationBackTel,
-				repair_back_status AS relationBackStatus,
-				repair_back_logistics_company AS relationBackLogisticsCompany,
-				repair_back_logistics_no AS relationBackLogisticsNo,
-				repair_back_postage AS relationBackPostage,
-				repair_back_machine_no AS relationBackMachineNo,
-				repair_send_status AS relationSendStatus,
-				repair_send_name AS relationSendName,
-				repair_send_tel AS relationSendTel,
-				province_number AS provinceNumber,
-				city_number AS cityNumber,
-				area_number AS areaNumber,
-				repair_send_merge_address AS relationSendMergeAddress,
-				repair_send_address AS relationSendAddress,
-				repair_send_logistics_company AS relationSendLogisticsCompany,
-				repair_send_logistics_no AS relationSendLogisticsNo,
-				repair_desc AS relationDesc,
-				repair_state AS relationState,
-				repair_alipay AS relationAlipay,
-				repair_is_transfer AS relationIsTransfer,
-				repair_alipay_name AS relationAlipayName,
-				repair_back_receipt_date AS relationBackReceiptDate
-			FROM
-				tb_rst_repair
-			LEFT JOIN tb_rst_relation_order on tb_rst_relation_order.relation_id = tb_rst_repair.repair_id
-			where tb_rst_relation_order.relation_type = '4'
-			UNION ALL
-				SELECT
-					'5' AS customerIsSolve,
-					reissue_id AS relationId,
-					customer_id AS customerId,
-					tb_rst_relation_order.sales_id AS orderId,
-					NULL AS signclosedId,
-					reissue_back_efast_order_id AS relationBackEfastOrderId,
-					NULL AS relationBackName,
-					NULL AS relationBackTel,
-					NULL AS relationBackStatus,
-					NULL AS relationBackLogisticsCompany,
-					NULL AS relationBackLogisticsNo,
-					NULL AS relationBackPostage,
-					NULL AS relationBackMachineNo,
-					reissue_send_status AS relationSendStatus,
-					reissue_send_name AS relationSendName,
-					reissue_send_tel AS relationSendTel,
-					province_number AS provinceNumber,
-					city_number AS cityNumber,
-					area_number AS areaNumber,
-					reissue_send_merge_address AS relationSendMergeAddress,
-					reissue_send_address AS relationSendAddress,
-					reissue_send_logistics_company AS relationSendLogisticsCompany,
-					reissue_send_logistics_no AS relationSendLogisticsNo,
-					reissue_desc AS relationDesc,
-					reissue_state AS relationState,
-					NULL AS relationAlipay,
-					NULL AS relationIsTransfer,
-					NULL AS relationAlipayName,
-					NULL AS relationBackReceiptDate
-				FROM
-					tb_rst_reissue
-				LEFT JOIN tb_rst_relation_order on tb_rst_relation_order.relation_id = tb_rst_reissue.reissue_id
-				where tb_rst_relation_order.relation_type = '5'
-				UNION ALL
-					SELECT
-						'6' AS customerIsSolve,
-						back_goods_id AS relationId,
-						customer_id AS customerId,
-						tb_rst_relation_order.sales_id AS orderId,
-						signclosed_id AS signclosedId,
-						NULL AS relationBackEfastOrderId,
-						back_goods_back_name AS relationBackName,
-						back_goods_back_tel AS relationBackTel,
-						back_goods_back_status AS relationBackStatus,
-						back_goods_back_logistics_company AS relationBackLogisticsCompany,
-						back_goods_back_logistics_no AS relationBackLogisticsNo,
-						back_goods_back_postage AS relationBackPostage,
-						back_goods_back_machine_no AS relationBackMachineNo,
-						NULL AS relationSendStatus,
-						NULL AS relationSendName,
-						NULL AS relationSendTel,
-						NULL AS provinceNumber,
-						NULL AS cityNumber,
-						NULL AS areaNumber,
-						NULL AS relationSendMergeAddress,
-						NULL AS relationSendAddress,
-						NULL AS relationSendLogisticsCompany,
-						NULL AS relationSendLogisticsNo,
-						back_goods_desc AS relationDesc,
-						back_goods_state AS relationState,
-						back_goods_alipay AS relationAlipay,
-						back_goods_is_transfer AS relationIsTransfer,
-						back_goods_alipay_name AS relationAlipayName,
-						back_goods_back_receipt_date AS relationBackReceiptDate
-					FROM
-						tb_rst_back_goods
-					LEFT JOIN tb_rst_relation_order on tb_rst_relation_order.relation_id = tb_rst_back_goods.back_goods_id
-					where tb_rst_relation_order.relation_type = '6'
-					UNION ALL
-						SELECT
-							'7' AS customerIsSolve,
-							noreason_back_id AS relationId,
-							customer_id AS customerId,
-							tb_rst_relation_order.sales_id AS orderId,
-							signclosed_id AS signclosedId,
-							NULL AS relationBackEfastOrderId,
-							noreason_back_back_name AS relationBackName,
-							noreason_back_back_tel AS relationBackTel,
-							noreason_back_back_status AS relationBackStatus,
-							noreason_back_back_logistics_company AS relationBackLogisticsCompany,
-							noreason_back_back_logistics_no AS relationBackLogisticsNo,
-							noreason_back_back_postage AS relationBackPostage,
-							noreason_back_back_machine_no AS relationBackMachineNo,
-							NULL AS relationSendStatus,
-							NULL AS relationSendName,
-							NULL AS relationSendTel,
-							NULL AS provinceNumber,
-							NULL AS cityNumber,
-							NULL AS areaNumber,
-							NULL AS relationSendMergeAddress,
-							NULL AS relationSendAddress,
-							NULL AS relationSendLogisticsCompany,
-							NULL AS relationSendLogisticsNo,
-							noreason_back_desc AS relationDesc,
-							noreason_back_state AS relationState,
-							noreason_back_alipay AS relationAlipay,
-							noreason_back_is_transfer AS relationIsTransfer,
-							noreason_back_alipay_name AS relationAlipayName,
-							noreason_back_receipt_date AS relationBackReceiptDate
-						FROM
-							tb_rst_noreason_back
-						LEFT JOIN tb_rst_relation_order on tb_rst_relation_order.relation_id = tb_rst_noreason_back.noreason_back_id
-						where tb_rst_relation_order.relation_type = '7'
-	) cc ON cc.customerId = c.customer_id
-LEFT JOIN tb_rst_sales_order_info oi ON cc.orderId = oi.sales_id
 LEFT JOIN tb_rst_question_describe qd ON c.customer_id = qd.customer_id
 LEFT JOIN tb_rst_complaint_question cq ON c.question_id = cq.question_id
 LEFT JOIN tb_rst_complaint_small_class csc ON csc.small_class_id = cq.small_class_id
 LEFT JOIN tb_rst_complaint_type ct ON ct.complaint_id = csc.complaint_id
 LEFT JOIN tb_rst_sales_company sc ON c.company_id = sc.company_id
 LEFT JOIN tb_rst_store_info si ON c.store_id = si.store_id
-LEFT JOIN tb_rst_sales_order_item soi ON soi.item_order_id = oi.sales_id
+
   </select>
   <!-- 退换货统计sql start -->
   <!-- 总销量 -->

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

@@ -30,6 +30,9 @@
             <if test="salesId != null ">
                 AND t.sales_id = #{salesId}
             </if >
+            <if test="relationCustomerId != null ">
+                AND t.relation_customer_id = #{relationCustomerId}
+            </if >
         </where>
     </select>
     <select id="getRelationOrderById" resultMap="BaseResultMap" parameterType="Integer" >

+ 178 - 115
watero-rst-web/src/main/java/com/iamberry/rst/controllers/cm/AdminCustomerController.java

@@ -15,10 +15,7 @@ import com.iamberry.rst.faces.sms.SmsService;
 import com.iamberry.rst.faces.sys.SysService;
 import com.iamberry.rst.util.CustomerCommonUtil;
 import com.iamberry.rst.util.SmsConfig;
-import com.iamberry.rst.utils.AdminUtils;
-import com.iamberry.rst.utils.OrderNoUtil;
-import com.iamberry.rst.utils.ResultMsg;
-import com.iamberry.rst.utils.StitchAttrUtil;
+import com.iamberry.rst.utils.*;
 import com.iamberry.wechat.tools.NameUtils;
 import com.iamberry.wechat.tools.ResponseJson;
 import com.iamberry.wechat.tools.ResultInfo;
@@ -30,6 +27,7 @@ import org.apache.poi.hssf.usermodel.*;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -104,7 +102,6 @@ public class AdminCustomerController {
     private RelationOrderService relationOrderService;
 
 
-
     /**
      * 获取客诉列表
      *
@@ -154,7 +151,7 @@ public class AdminCustomerController {
      */
     @RequiresPermissions("customer:update:customer")
     @RequestMapping(value = "/to_update_customer")
-    public ModelAndView toUpdateCustomer(HttpServletRequest request,Integer customerId) {
+    public ModelAndView toUpdateCustomer(HttpServletRequest request, Integer customerId) {
         ModelAndView mv = new ModelAndView("cm/customer/update_customer");
 
         ProductType productType = new ProductType();
@@ -173,7 +170,7 @@ public class AdminCustomerController {
         CustomerInfo customerInfo = customerService.getCustomerInfo(customerId);
         /*客诉信息处理-stast*/
         //对于区域处理
-        if(customerInfo!=null && customerInfo.getCustomerArea() != null){
+        if (customerInfo != null && customerInfo.getCustomerArea() != null) {
 //            String[] customerAreaAndCity = customerInfo.getCustomerArea().split("-");
 //            customerInfo.setProvinceName(customerAreaAndCity[0]);
 //            City city
@@ -182,37 +179,37 @@ public class AdminCustomerController {
         }
         /*客诉信息处理-end*/
         CustomerCommon customerCommon = new CustomerCommon();
-        if(customerInfo.getCustomerIsSolve() != null){
-            switch (customerInfo.getCustomerIsSolve()){   //处理结果: 1:已解决  2:未解决 3:换新  4:维修 5:补发 6:退货 7:无理由退货
+        if (customerInfo.getCustomerIsSolve() != null) {
+            switch (customerInfo.getCustomerIsSolve()) {   //处理结果: 1:已解决  2:未解决 3:换新  4:维修 5:补发 6:退货 7:无理由退货
                 case 3://获取换新
                     Renewed renewed = new Renewed();
                     renewed.setCustomerId(customerInfo.getCustomerId());
                     renewed = renewedService.getRenewed(renewed);
-                    customerCommon = CustomerCommonUtil.getCustomerCommon(3,renewed);
+                    customerCommon = CustomerCommonUtil.getCustomerCommon(3, renewed);
                     break;
                 case 4://维修
                     Repair repair = new Repair();
                     repair.setCustomerId(customerInfo.getCustomerId());
                     repair = repairService.getRepair(repair);
-                    customerCommon = CustomerCommonUtil.getCustomerCommon(4,repair);
+                    customerCommon = CustomerCommonUtil.getCustomerCommon(4, repair);
                     break;
                 case 5:
-                    Reissue reissue = new  Reissue();
+                    Reissue reissue = new Reissue();
                     reissue.setCustomerId(customerInfo.getCustomerId());
                     reissue = reissueService.getReissue(reissue);
-                    customerCommon = CustomerCommonUtil.getCustomerCommon(5,reissue);
+                    customerCommon = CustomerCommonUtil.getCustomerCommon(5, reissue);
                     break;
                 case 6:
-                    BackGoods backGoods = new  BackGoods();
+                    BackGoods backGoods = new BackGoods();
                     backGoods.setCustomerId(customerInfo.getCustomerId());
                     backGoods = backGoodsService.getBackGoods(backGoods);
-                    customerCommon = CustomerCommonUtil.getCustomerCommon(6,backGoods);
+                    customerCommon = CustomerCommonUtil.getCustomerCommon(6, backGoods);
                     break;
                 case 7:
-                    NoreasonBack noreasonBack = new  NoreasonBack();
+                    NoreasonBack noreasonBack = new NoreasonBack();
                     noreasonBack.setCustomerId(customerInfo.getCustomerId());
                     noreasonBack = noreasonBackService.getNoreasonBack(noreasonBack);
-                    customerCommon = CustomerCommonUtil.getCustomerCommon(7,noreasonBack);
+                    customerCommon = CustomerCommonUtil.getCustomerCommon(7, noreasonBack);
                     break;
             }
 
@@ -221,7 +218,7 @@ public class AdminCustomerController {
             customerCommon = customerCommonService.getListProduceAndFitting(customerCommon);
 
             // 2018/4/18  页面只会给寄回的赋值,在处理方式为补发的情况下,寄出需要赋值到寄回当中
-            if(customerInfo.getCustomerIsSolve() == 5){
+            if (customerInfo.getCustomerIsSolve() == 5) {
                 //售后寄回产品表
                 List<ClosedProdcue> closedProdcues = new ArrayList<ClosedProdcue>();
                 for (SendProdcue sendProdcue : customerCommon.getSendProdcues()) {
@@ -255,9 +252,9 @@ public class AdminCustomerController {
             }
             mv.addObject("customerCommon", customerCommon);
 
-            if(customerInfo.getTypeId() == 1){
+            if (customerInfo.getTypeId() == 1) {
                 customerInfo.setIsNeedSelectOrder(2);       //不需要订单
-            }else{
+            } else {
                 customerInfo.setIsNeedSelectOrder(1);
             }
 
@@ -276,32 +273,32 @@ public class AdminCustomerController {
 //            }
 //            mv.addObject("productList", productList);
 
-            if(customerInfo.getTypeId() != 1 && (customerInfo.getCustomerIsSolve() == 3 || customerInfo.getCustomerIsSolve() == 4 || customerInfo.getCustomerIsSolve() == 5 ||
-                    customerInfo.getCustomerIsSolve() == 6 || customerInfo.getCustomerIsSolve() == 7)){
+            if (customerInfo.getTypeId() != 1 && (customerInfo.getCustomerIsSolve() == 3 || customerInfo.getCustomerIsSolve() == 4 || customerInfo.getCustomerIsSolve() == 5 ||
+                    customerInfo.getCustomerIsSolve() == 6 || customerInfo.getCustomerIsSolve() == 7)) {
                 RelationOrder relationOrder = new RelationOrder();
                 relationOrder.setRelationType(customerCommon.getCustomerIsSolve());
                 relationOrder.setRelationId(customerCommon.getRelationId());
                 List<RelationOrder> relationOrderList = relationOrderService.getRelationOrderList(relationOrder);
 
                 String[] salesIds = new String[relationOrderList.size()];
-                for (int k=0; k<relationOrderList.size();k++){
+                for (int k = 0; k < relationOrderList.size(); k++) {
                     salesIds[k] = String.valueOf(relationOrderList.get(k).getSalesId());
                 }
                 SalesOrder so = new SalesOrder();
                 so.setSalesIds(salesIds);
                 List<SalesOrder> orderList = salesOrderService.listSalesOrder(so);
-                for (SalesOrder sor: orderList) {
+                for (SalesOrder sor : orderList) {
                     SalesOrderItem salesOrderItem = new SalesOrderItem();
                     salesOrderItem.setItemOrderId(sor.getSalesId());
                     List<SalesOrderItem> salesOrderItemList = salesOrderService.listSalesOrderItem(salesOrderItem);
                     sor.setSalesOrderItemList(salesOrderItemList);
                 }
                 mv.addObject("salesOrderList", orderList);
-            }else{
+            } else {
                 mv.addObject("salesOrderList", null);
             }
         }
-        if ("2".equals(customerInfo.getCustomerIsVisit())){ //1:不需要回访  2:需要回访
+        if ("2".equals(customerInfo.getCustomerIsVisit())) { //1:不需要回访  2:需要回访
             Visit visit = new Visit();
             visit.setCustomerId(customerInfo.getCustomerId());
             visit = visitService.getVisit(visit);
@@ -334,13 +331,14 @@ public class AdminCustomerController {
 
     /**
      * 查询问题描述
+     *
      * @return
      */
     @ResponseBody
     @RequiresPermissions("customer:add:customer")
     @RequestMapping(value = "/select_question_describe")
     public ResponseJson selectQuestionDescribe(HttpServletRequest request, Integer customerId) throws Exception {
-        if(customerId == null || customerId == 0){
+        if (customerId == null || customerId == 0) {
             return new ResponseJson(500, "未获取到问题描述", 500);
         }
         //查询问题描述表
@@ -460,9 +458,9 @@ public class AdminCustomerController {
         salesOrder.setSalesOrderItemList(list);
 
         try {
-           Integer flag = customerService.addOrder(salesOrder);
+            Integer flag = customerService.addOrder(salesOrder);
         } catch (RuntimeException e) {
-            return new ResponseJson(500, "添加订单失败--"+ e.getMessage(), 500);
+            return new ResponseJson(500, "添加订单失败--" + e.getMessage(), 500);
         }
         Integer orderId = salesOrder.getSalesId();
         ResponseJson rj = new ResponseJson(200, "添加订单成功", 200);
@@ -473,6 +471,7 @@ public class AdminCustomerController {
 
     /**
      * 查询销售公司
+     *
      * @return
      */
     @ResponseBody
@@ -487,6 +486,7 @@ public class AdminCustomerController {
         rj.addResponseKeyValue("companyInfoList", companyInfoList);
         return rj;
     }
+
     /**
      * 获取店铺集合
      *
@@ -520,12 +520,12 @@ public class AdminCustomerController {
     @ResponseBody
     @RequiresPermissions("customer:add:customer")
     @RequestMapping(value = "/select_salesOrder")
-    public ResponseJson listOrder(HttpServletRequest request, SalesOrder salesOrder,String ids,
-                @RequestParam(value = "pageSize", defaultValue = "20", required = false) Integer pageSize,
-                @RequestParam(value = "pageNO", defaultValue = "1", required = false) Integer pageNO,
-                @RequestParam(value = "totalNum", defaultValue = "0", required = false) Integer totalNum) {
+    public ResponseJson listOrder(HttpServletRequest request, SalesOrder salesOrder, String ids,
+                                  @RequestParam(value = "pageSize", defaultValue = "20", required = false) Integer pageSize,
+                                  @RequestParam(value = "pageNO", defaultValue = "1", required = false) Integer pageNO,
+                                  @RequestParam(value = "totalNum", defaultValue = "0", required = false) Integer totalNum) {
 
-        if(ids!= null && ids.indexOf("_") > -1){
+        if (ids != null && ids.indexOf("_") > -1) {
             String[] salesIds = ids.split("_");
             salesOrder.setSalesIds(salesIds);
         }
@@ -569,9 +569,9 @@ public class AdminCustomerController {
                                            @RequestParam(value = "pageSize", defaultValue = "10", required = false) Integer pageSize,
                                            @RequestParam(value = "pageNO", defaultValue = "1", required = false) Integer pageNO,
                                            @RequestParam(value = "totalNum", defaultValue = "0", required = false) Integer totalNum) throws Exception {
-       long x = new Date().getTime();
+        long x = new Date().getTime();
         ModelAndView mv = new ModelAndView("cm/customer/custome_list");
-        if(customerInfo.getAdminId() == null && isFirst == 1){
+        if (customerInfo.getAdminId() == null && isFirst == 1) {
             //获取登录员工id
             Integer adminId = AdminUtils.getLoginAdminId();
             customerInfo.setAdminId(adminId);
@@ -610,11 +610,11 @@ public class AdminCustomerController {
         customerInfo.setComplaintDetectList(null);
 
         StitchAttrUtil sa = StitchAttrUtil.getSa();
-        sa.addDatePro("yyyy-MM-dd","startTime","endTime");
+        sa.addDatePro("yyyy-MM-dd", "startTime", "endTime");
         sa.setModelAndView(customerInfo, mv, "/admin/customer/select_customer_list", pagedResult);
 
         long y = new Date().getTime();
-        System.out.println("使用时间:"+(y-x));
+        System.out.println("使用时间:" + (y - x));
         return mv;
     }
 
@@ -860,7 +860,7 @@ public class AdminCustomerController {
     public ResponseJson addCustomer(HttpServletRequest request, CustomerInfo customerInfo, SalesOrder salesOrder, CustomerCommon customerCommon,
                                     String sendProdcuesJson, String sendFittingsJson, String closedProdcuesJson, String closedFittingsJson) throws Exception {
         ResponseJson rjx = this.isValiData(customerInfo);
-        if(rjx.getResultCode() == 500){
+        if (rjx.getResultCode() == 500) {
             return rjx;
         }
 
@@ -869,7 +869,7 @@ public class AdminCustomerController {
         Integer typeCompany = customerInfo.getTypeCompany();    // 所属商城   1:美国watero; 2:上朵电动牙刷  3:优尼雅净水机
 
         Integer flag = 0;
-        if(customerInfo.getIsNeedSelectOrder() == 1){ ////1:需要有订单    2:不需要有订单
+        if (customerInfo.getIsNeedSelectOrder() == 1) { ////1:需要有订单    2:不需要有订单
             JSONArray jsonArray;
             List<SendProdcue> sendProdcueList;
             List<SendFitting> sendFittingList;
@@ -909,9 +909,9 @@ public class AdminCustomerController {
         } catch (RuntimeException e) {
             e.printStackTrace();
             return new ResponseJson(500, e.getMessage(), 500);
-        }catch (Exception e){
+        } catch (Exception e) {
             e.printStackTrace();
-            return new ResponseJson(500,"添加失败", 500);
+            return new ResponseJson(500, "添加失败", 500);
         }
         customerId = customerInfo.getCustomerId();
         logger.info("-----------------添加客诉结束----------------------");
@@ -983,9 +983,9 @@ public class AdminCustomerController {
     @RequiresPermissions("customer:update:customer")
     @RequestMapping("/update_customer")
     public ResponseJson updateCustomer(HttpServletRequest request, CustomerInfo customerInfo, SalesOrder salesOrder, CustomerCommon customerCommon,
-                                    String sendProdcuesJson, String sendFittingsJson, String closedProdcuesJson, String closedFittingsJson) throws Exception {
+                                       String sendProdcuesJson, String sendFittingsJson, String closedProdcuesJson, String closedFittingsJson) throws Exception {
         ResponseJson rjx = this.isValiData(customerInfo);
-        if(rjx.getResultCode() == 500){
+        if (rjx.getResultCode() == 500) {
             return rjx;
         }
         Integer flag = 0;
@@ -994,7 +994,7 @@ public class AdminCustomerController {
         String phone = customerInfo.getCustomerTel();       //手机号码
         Integer typeCompany = customerInfo.getTypeCompany();    // 所属商城   1:美国watero; 2:上朵电动牙刷  3:优尼雅净水机
 
-        if(customerInfo.getIsNeedSelectOrder() == 1){
+        if (customerInfo.getIsNeedSelectOrder() == 1) {
             JSONArray jsonArray;
             List<SendProdcue> sendProdcueList;
             List<SendFitting> sendFittingList;
@@ -1033,9 +1033,9 @@ public class AdminCustomerController {
         } catch (RuntimeException e) {
             e.printStackTrace();
             return new ResponseJson(500, e.getMessage(), 500);
-        }catch (Exception e){
+        } catch (Exception e) {
             e.printStackTrace();
-            return new ResponseJson(500,"修改失败", 500);
+            return new ResponseJson(500, "修改失败", 500);
         }
         customerId = customerInfo.getCustomerId();
         logger.info("-----------------修改客诉结束----------------------");
@@ -1055,7 +1055,7 @@ public class AdminCustomerController {
      */
     public ResponseJson isValiData(CustomerInfo customerInfo) {
         ResponseJson rj = new ResponseJson();
-        if(customerInfo.getAdminId() == null){
+        if (customerInfo.getAdminId() == null) {
             return new ResponseJson(500, "未填写客诉id", 500);
         }
         return rj;
@@ -1091,7 +1091,7 @@ public class AdminCustomerController {
                         return new ResponseJson(500, "问题修改失败!", 500);
                     }
                 }
-                url += "/" + complaintQuestionInfo.getQuestionId()+"/"+typeCompany;
+                url += "/" + complaintQuestionInfo.getQuestionId() + "/" + typeCompany;
                 switch (typeCompany) {
                     case 1:
                         con = SmsConfig.SEND_PRODUCT_SEND_WATERO;
@@ -1144,19 +1144,18 @@ public class AdminCustomerController {
         }
     }
 
-    String encodePhoneNumber(String number)
-    {
+    String encodePhoneNumber(String number) {
         int encnum = Integer.parseInt(number.substring(2));
 
-        int prefix = (number.charAt(1) - '2') /2;   // '3'=>0, '5'=>1, '[67]'=>2, '8'=>3
+        int prefix = (number.charAt(1) - '2') / 2;   // '3'=>0, '5'=>1, '[67]'=>2, '8'=>3
 
         encnum |= (prefix <<= 30);
 
         final byte[] raw = new byte[4];
 
-        raw[0] = (byte)(encnum >>> 24);
-        raw[1] = (byte)(encnum >>> 16);
-        raw[2] = (byte)(encnum >>> 8);
+        raw[0] = (byte) (encnum >>> 24);
+        raw[1] = (byte) (encnum >>> 16);
+        raw[2] = (byte) (encnum >>> 8);
         raw[3] = (byte) encnum;
 
         return Base64.encodeBase64URLSafeString(raw);
@@ -1368,15 +1367,15 @@ public class AdminCustomerController {
         if (StringUtils.isNotEmpty(mergeAddress)) {
             renewed.setRenewedSendMergeAddress(mergeAddress);
         }
-    if(renewed.getRenewedBackStatus() != null){
-        if(renewed.getRenewedBackStatus() != 1){
-            ComplaintSignclosedInfo cs = new ComplaintSignclosedInfo();
-            cs.setSignclosedCustomerId(renewed.getCustomerId());
-            cs.setSignclosedLogistics(renewed.getRenewedBackLogisticsCompany());
-            cs.setSignclosedLogisticsNumber(renewed.getRenewedBackLogisticsNo());
-            complaintSignclosedInfoService.updateSignclosedByCustomerId(cs);
+        if (renewed.getRenewedBackStatus() != null) {
+            if (renewed.getRenewedBackStatus() != 1) {
+                ComplaintSignclosedInfo cs = new ComplaintSignclosedInfo();
+                cs.setSignclosedCustomerId(renewed.getCustomerId());
+                cs.setSignclosedLogistics(renewed.getRenewedBackLogisticsCompany());
+                cs.setSignclosedLogisticsNumber(renewed.getRenewedBackLogisticsNo());
+                complaintSignclosedInfoService.updateSignclosedByCustomerId(cs);
+            }
         }
-    }
 
         //修改换新信息
         int num = renewedService.updateRenewedInfo(renewed, null, null);
@@ -1484,8 +1483,8 @@ public class AdminCustomerController {
             return new ResponseJson(500, "该efast订单号无效,请重新输入!", 500);
         }*/
 
-        if(repair.getRepairBackStatus() != null){
-            if(repair.getRepairBackStatus() != 1){
+        if (repair.getRepairBackStatus() != null) {
+            if (repair.getRepairBackStatus() != 1) {
                 ComplaintSignclosedInfo cs = new ComplaintSignclosedInfo();
                 cs.setSignclosedCustomerId(repair.getCustomerId());
                 cs.setSignclosedLogistics(repair.getRepairBackLogisticsCompany());
@@ -1755,7 +1754,7 @@ public class AdminCustomerController {
      */
     @ResponseBody
     @RequestMapping(value = "/selectNumberBacklog")
-    public ResultMsg selectTodo(HttpServletRequest request){
+    public ResultMsg selectTodo(HttpServletRequest request) {
         ResultMsg msg = new ResultMsg();
         CustomerInfo customerInfo = new CustomerInfo();
         //获取登录员工id
@@ -1777,12 +1776,12 @@ public class AdminCustomerController {
         customerCommon.setRelationCreateTime(new Date());
         Integer notSendCustomer = customerCommonService.listCustomerCommonByStatus(customerCommon);
 
-        Map<String,Integer> numberMap = new HashMap<>();
-        numberMap.put("notSolvedCustomer",notSolvedCustomer);
-        numberMap.put("amountReceivedCustomer",amountReceivedCustomer);
-        numberMap.put("noEntryCustomer",noEntryCustomer);
-        numberMap.put("notSendCustomer",notSendCustomer);
-        numberMap.put("adminDept",admin.getAdminDept());
+        Map<String, Integer> numberMap = new HashMap<>();
+        numberMap.put("notSolvedCustomer", notSolvedCustomer);
+        numberMap.put("amountReceivedCustomer", amountReceivedCustomer);
+        numberMap.put("noEntryCustomer", noEntryCustomer);
+        numberMap.put("notSendCustomer", notSendCustomer);
+        numberMap.put("adminDept", admin.getAdminDept());
         msg.setResultCode(ResultInfo.SUCCESSCODE);
         msg.setStatus(true);
         msg.setData(numberMap);
@@ -1798,12 +1797,12 @@ public class AdminCustomerController {
     @ResponseBody
     @RequiresPermissions("customer:list:customer")
     @RequestMapping("/get_custoner_info")
-    public ResponseJson getCustonerInfo(HttpServletRequest request,CustomerCommon customerCommon) throws Exception {
+    public ResponseJson getCustonerInfo(HttpServletRequest request, CustomerCommon customerCommon) throws Exception {
         if (customerCommon == null) {
             return new ResponseJson(500, "参数错误!", 500);
         }
         List<CustomerCommon> customerCommonList = customerCommonService.listCustomerCommon(customerCommon);
-        if(customerCommonList.size() < 1){
+        if (customerCommonList.size() < 1) {
             return new ResponseJson(500, "不存在相关客诉信息!", 500);
         } else {
             ResponseJson rj = new ResponseJson(200, "查询成功", 200);
@@ -1815,6 +1814,7 @@ public class AdminCustomerController {
 
     /**
      * 申请邮费
+     *
      * @return
      */
     @ResponseBody
@@ -1822,7 +1822,7 @@ public class AdminCustomerController {
     @RequestMapping(value = "/apply_postage")
     public ResponseJson applyPostage(HttpServletRequest request, Integer customerId) throws Exception {
         CustomerInfo customerInfo = customerService.getCustomerInfo(customerId);
-        if(customerInfo == null){
+        if (customerInfo == null) {
             return new ResponseJson(500, "未获取到客诉", 500);
         }
 
@@ -1831,50 +1831,51 @@ public class AdminCustomerController {
         List<CustomerCommon> customerCommonList = customerCommonService.listCustomerCommon(customerCommon);
         customerCommon = customerCommonList.get(0);
 
-        if(customerCommon.getRelationBackStatus() == 1){    //1:未寄回  2:已寄回  3:已收货  4:已签收待确认
+        if (customerCommon.getRelationBackStatus() == 1) {    //1:未寄回  2:已寄回  3:已收货  4:已签收待确认
             return new ResponseJson(500, "请修改寄回状态,并填写寄回信息", 500);
         }
 
-        if(customerCommon.getRelationBackStatus() == 2){    //1:未寄回  2:已寄回  3:已收货  4:已签收待确认
+        if (customerCommon.getRelationBackStatus() == 2) {    //1:未寄回  2:已寄回  3:已收货  4:已签收待确认
             return new ResponseJson(500, "产品正在寄回中!", 500);
         }
 
-        if(customerCommon.getRelationIsTransfer() == 0){    //relationIsTransfer 是否需要转账邮费  0:不需要 10:需要转账
+        if (customerCommon.getRelationIsTransfer() == 0) {    //relationIsTransfer 是否需要转账邮费  0:不需要 10:需要转账
             return new ResponseJson(500, "请修改邮费转账状态,并填写邮费信息", 500);
         }
 
-        if(customerCommon.getRelationBackPostage() == null || customerCommon.getRelationBackPostage() == 0  //relationBackPostage
-                || customerCommon.getRelationAlipay() == null || customerCommon.getRelationAlipayName() == null ){
+        if (customerCommon.getRelationBackPostage() == null || customerCommon.getRelationBackPostage() == 0  //relationBackPostage
+                || customerCommon.getRelationAlipay() == null || customerCommon.getRelationAlipayName() == null) {
             return new ResponseJson(500, "请填写邮费信息", 500);
         }
 
-        if(customerInfo.getCompanyId() == null || customerInfo.getCompanyId() == 0 ){
+        if (customerInfo.getCompanyId() == null || customerInfo.getCompanyId() == 0) {
             return new ResponseJson(500, "未正确选择销售公司", 500);
         }
 
         Postage age = new Postage();
         age.setCustomerId(customerInfo.getCustomerId());    //客诉id
         List<Postage> postageList = postageService.listPostage(age);
-        if(postageList != null && postageList.size() > 0){
+        if (postageList != null && postageList.size() > 0) {
             return new ResponseJson(500, "该条客诉已在申请邮费中了", 500);
         }
 
         ResponseJson rj = new ResponseJson(200, "可以申请邮费", 200);
-        rj.addResponseKeyValue("customerCommon",customerCommon);
-        rj.addResponseKeyValue("customerInfo",customerInfo);
+        rj.addResponseKeyValue("customerCommon", customerCommon);
+        rj.addResponseKeyValue("customerInfo", customerInfo);
         return rj;
     }
 
     /**
      * 申请邮费
+     *
      * @return
      */
     @ResponseBody
     @RequiresPermissions("customer:applyPostage:customer")
     @RequestMapping(value = "/add_postage")
-    public ResponseJson addPostage(HttpServletRequest request, Integer customerId,String postageLogisticsImg) throws Exception {
+    public ResponseJson addPostage(HttpServletRequest request, Integer customerId, String postageLogisticsImg) throws Exception {
         CustomerInfo customerInfo = customerService.getCustomerInfo(customerId);
-        if(customerInfo == null){
+        if (customerInfo == null) {
             return new ResponseJson(500, "未获取到客诉", 500);
         }
 
@@ -1883,40 +1884,40 @@ public class AdminCustomerController {
         List<CustomerCommon> customerCommonList = customerCommonService.listCustomerCommon(customerCommon);
         customerCommon = customerCommonList.get(0);
 
-        if(customerCommon.getRelationBackStatus() == 1){    //1:未寄回  2:已寄回  3:已收货  4:已签收待确认
+        if (customerCommon.getRelationBackStatus() == 1) {    //1:未寄回  2:已寄回  3:已收货  4:已签收待确认
             return new ResponseJson(500, "请修改寄回状态,并填写寄回信息", 500);
         }
 
-        if(customerCommon.getRelationBackStatus() == 2){    //1:未寄回  2:已寄回  3:已收货  4:已签收待确认
+        if (customerCommon.getRelationBackStatus() == 2) {    //1:未寄回  2:已寄回  3:已收货  4:已签收待确认
             return new ResponseJson(500, "产品正在寄回中!", 500);
         }
 
-        if(customerCommon.getRelationIsTransfer() == 0){    //relationIsTransfer 是否需要转账邮费  0:不需要 10:需要转账
+        if (customerCommon.getRelationIsTransfer() == 0) {    //relationIsTransfer 是否需要转账邮费  0:不需要 10:需要转账
             return new ResponseJson(500, "请修改邮费转账状态,并填写邮费信息", 500);
         }
 
-        if(customerCommon.getRelationBackPostage() == null || customerCommon.getRelationBackPostage() == 0  //relationBackPostage
-                || customerCommon.getRelationAlipay() == null || customerCommon.getRelationAlipayName() == null ){
+        if (customerCommon.getRelationBackPostage() == null || customerCommon.getRelationBackPostage() == 0  //relationBackPostage
+                || customerCommon.getRelationAlipay() == null || customerCommon.getRelationAlipayName() == null) {
             return new ResponseJson(500, "请填写邮费信息", 500);
         }
 
-        if(customerInfo.getCompanyId() == null || customerInfo.getCompanyId() == 0 ){
+        if (customerInfo.getCompanyId() == null || customerInfo.getCompanyId() == 0) {
             return new ResponseJson(500, "未正确选择销售公司", 500);
         }
 
         Postage age = new Postage();
         age.setCustomerId(customerInfo.getCustomerId());    //客诉id
         List<Postage> postageList = postageService.listPostage(age);
-        if(postageList != null && postageList.size() > 0){
+        if (postageList != null && postageList.size() > 0) {
             return new ResponseJson(500, "该条客诉已在申请邮费中了", 500);
         }
 
         String orderId = "";
-        for (SalesOrder salesOrder : customerCommon.getSalesOrderList()){
-            if("".equals(orderId)){
+        for (SalesOrder salesOrder : customerCommon.getSalesOrderList()) {
+            if ("".equals(orderId)) {
                 orderId = salesOrder.getSalesOrderId();
-            }else{
-                orderId += ","+salesOrder.getSalesOrderId();
+            } else {
+                orderId += "," + salesOrder.getSalesOrderId();
             }
         }
 
@@ -1941,7 +1942,7 @@ public class AdminCustomerController {
         postage.setPostageLogisticsImg(postageLogisticsImg);
         flag = postageService.savePostage(postage);
 
-        if(flag < 1){
+        if (flag < 1) {
             return new ResponseJson(500, "申请失败", 500);
         }
 
@@ -1984,7 +1985,7 @@ public class AdminCustomerController {
      */
     @ResponseBody
     @RequestMapping("/selectOnCustomer")
-    public ResponseJson listOnCustomer(HttpServletRequest request,CustomerInfo customerInfo) throws Exception {
+    public ResponseJson listOnCustomer(HttpServletRequest request, CustomerInfo customerInfo) throws Exception {
         if (customerInfo == null) {
             return new ResponseJson(500, "查询客诉失败!", 500);
         }
@@ -2000,13 +2001,14 @@ public class AdminCustomerController {
 
     /**
      * 根据efast订单号查询efast订单物流信息
+     *
      * @param request
      * @return
      * @throws Exception
      */
     @ResponseBody
     @RequestMapping("/getefastOrder")
-    public ResponseJson getEfastOrderInfo(HttpServletRequest request,String efastOrderId) throws Exception {
+    public ResponseJson getEfastOrderInfo(HttpServletRequest request, String efastOrderId) throws Exception {
         if (efastOrderId == null) {
             return new ResponseJson(500, "查询失败!", 500);
         }
@@ -2024,28 +2026,69 @@ public class AdminCustomerController {
     }
 
 
-
     /**
      * 下载客诉信息 (2018-05-29)
+     *
      * @param request
      * @param res
      * @param
      * @throws Exception
      */
     @RequestMapping("/download_customer_excel")
-    public void downloadEfastOrderExcel(HttpServletRequest request,HttpServletResponse res) throws Exception{
+    public void downloadEfastOrderExcel(HttpServletRequest request, HttpServletResponse res) throws Exception {
         List<CustomerStatisticalInfo> customerList = customerService.listStatisticalCustomer();
         String[] cells = {
-                "日期","姓名","联系电话","类别","来源入口",
-                "问题类别","小类名称","客诉问题","处理过程","购买日期",
-                "处理结果","销售公司","销售渠道","产品型号","产品颜色",
-                "产品数量","寄回快递","寄回单号","签收日期",
-                "状态","寄出快递","寄出快递","开箱损","二次客诉"
+                "日期", "姓名", "联系电话", "类别", "来源入口",
+                "问题类别", "小类名称", "客诉问题", "处理过程", "购买日期",
+                "处理结果", "销售公司", "销售渠道", "产品型号", "产品颜色",
+                "产品数量", "寄回快递", "寄回单号", "签收日期",
+                "状态", "寄出快递", "寄出快递", "开箱损", "二次客诉"
         };
-        //导出订单Excel并下载
-        customerExcel(request,res,cells,customerList);
+        List<CustomerStatisticalInfo> customerStatisticalInfoList = new ArrayList<>();
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
+        for (CustomerStatisticalInfo customerInfo : customerList) {
+            //新建一个容器
+            CustomerStatisticalInfo customer = new CustomerStatisticalInfo();
+            //将数据copy到新容器
+            BeanUtils.copyProperties(customerInfo, customer);
+            CustomerCommon customerCommon = new CustomerCommon();
+            customerCommon.setCustomerId(customerInfo.getCustomerId());
+            List<CustomerCommon> listCustomerCommon = customerCommonService.listCustomerCommon(customerCommon);
+            if(listCustomerCommon.size() > 0) {
+                for (CustomerCommon common : listCustomerCommon) {
+                    if (common.getSalesOrderList().size() > 0) {
+                        for (SalesOrder salesOrder : common.getSalesOrderList()) {
+                            if (salesOrder.getSalesOrderItemList().size() > 0) {
+                                for (SalesOrderItem salesOrderItem : salesOrder.getSalesOrderItemList()) {
+                                    customer.setRelationBackLogisticsCompany(common.getRelationBackLogisticsCompany());
+                                    customer.setRelationBackLogisticsNo(common.getRelationBackLogisticsNo());
+                                    customer.setRelationSendLogisticsCompany(common.getRelationSendLogisticsCompany());
+                                    customer.setRelationSendLogisticsNo(common.getRelationSendLogisticsNo());
+                                    customer.setRelationBackStatus(String.valueOf(common.getRelationBackStatus()));
+                                    customer.setRelationBackReceiptDate(common.getRelationBackReceiptDate() == null?null:format.format(common.getRelationBackReceiptDate()));
+                                    customer.setSalesPayTime(salesOrder.getSalesPayTime());
+                                    customer.setItemProductName(salesOrderItem.getItemProductName());
+                                    customer.setItemProductColor(salesOrderItem.getItemProductColor());
+                                    customer.setItemNum(String.valueOf(salesOrderItem.getItemNum()));
+                                    customerStatisticalInfoList.add(customer);
+                                }
+                            } else {
+                                customerStatisticalInfoList.add(customer);
+                            }
+                        }
+                    } else {
+                        customerStatisticalInfoList.add(customer);
+                    }
 
-    }
+                }
+            }else{
+                customerStatisticalInfoList.add(customer);
+            }
+        }
+            //导出订单Excel并下载
+            customerExcel(request,res,cells,customerStatisticalInfoList);
+
+        }
 
 
     /**
@@ -2095,6 +2138,26 @@ public class AdminCustomerController {
             if(customerStatisticalInfo.getSalesPayTime() != null ){
                 salesPayTime = format.format(customerStatisticalInfo.getSalesPayTime());
             }
+            String backLogisticsCompany = "";
+            if(customerStatisticalInfo.getRelationBackLogisticsCompany() != null){
+                backLogisticsCompany = KuaiDi100.replace(customerStatisticalInfo.getRelationBackLogisticsCompany());
+            }
+            String backStatus = "未知";
+            if(customerStatisticalInfo.getRelationBackStatus() != null){
+                if(customerStatisticalInfo.getRelationBackStatus().equals("1")){
+                    backStatus = "未寄回";
+                }
+                if(customerStatisticalInfo.getRelationBackStatus().equals("2")){
+                    backStatus = "已寄回";
+                }
+                if(customerStatisticalInfo.getRelationBackStatus().equals("3")){
+                    backStatus = "已收货";
+                }
+            }
+            String sendLogisticsCompany = "";
+            if(customerStatisticalInfo.getRelationSendLogisticsCompany() != null){
+                sendLogisticsCompany = KuaiDi100.replace(customerStatisticalInfo.getRelationSendLogisticsCompany());
+            }
 
             // 创建单元格,设置值
             row.createCell(0).setCellValue(createTime);
@@ -2106,18 +2169,18 @@ public class AdminCustomerController {
             row.createCell(6).setCellValue(customerStatisticalInfo.getSmallClassName() == null ? null : customerStatisticalInfo.getSmallClassName());
             row.createCell(7).setCellValue(customerStatisticalInfo.getDescribeTitle() == null ? null : customerStatisticalInfo.getDescribeTitle());
             row.createCell(8).setCellValue(customerStatisticalInfo.getDescribeHandleDesc() == null ? null : customerStatisticalInfo.getDescribeHandleDesc());
-            row.createCell(9).setCellValue(customerStatisticalInfo.getCustomerIsSolve() == null ? null : customerStatisticalInfo.getCustomerIsSolve());
-            row.createCell(10).setCellValue(salesPayTime);
+            row.createCell(9).setCellValue(salesPayTime);
+            row.createCell(10).setCellValue(customerStatisticalInfo.getCustomerIsSolve() == null ? null : customerStatisticalInfo.getCustomerIsSolve());
             row.createCell(11).setCellValue(customerStatisticalInfo.getCompanyName() == null ? null : customerStatisticalInfo.getCompanyName());
             row.createCell(12).setCellValue(customerStatisticalInfo.getStoreName() == null ? null : customerStatisticalInfo.getStoreName());
             row.createCell(13).setCellValue(customerStatisticalInfo.getItemProductName() == null ? null : customerStatisticalInfo.getItemProductName());
             row.createCell(14).setCellValue(customerStatisticalInfo.getItemProductColor() == null ? null : customerStatisticalInfo.getItemProductColor());
             row.createCell(15).setCellValue(customerStatisticalInfo.getItemNum() == null ? null : customerStatisticalInfo.getItemNum());
-            row.createCell(16).setCellValue(customerStatisticalInfo.getRelationBackLogisticsCompany() == null ? null : customerStatisticalInfo.getRelationBackLogisticsCompany());
+            row.createCell(16).setCellValue(backLogisticsCompany);
             row.createCell(17).setCellValue(customerStatisticalInfo.getRelationBackLogisticsNo() == null ? null : customerStatisticalInfo.getRelationBackLogisticsNo());
             row.createCell(18).setCellValue(customerStatisticalInfo.getRelationBackReceiptDate() == null ? null : customerStatisticalInfo.getRelationBackReceiptDate());
-            row.createCell(19).setCellValue(customerStatisticalInfo.getRelationBackStatus() == null ? null : customerStatisticalInfo.getRelationBackStatus());
-            row.createCell(20).setCellValue(customerStatisticalInfo.getRelationSendLogisticsCompany() == null ? null : customerStatisticalInfo.getRelationSendLogisticsCompany());
+            row.createCell(19).setCellValue(backStatus);
+            row.createCell(20).setCellValue(sendLogisticsCompany);
             row.createCell(21).setCellValue(customerStatisticalInfo.getRelationSendLogisticsNo() == null ? null : customerStatisticalInfo.getRelationSendLogisticsNo());
             row.createCell(22).setCellValue(customerStatisticalInfo.getCustomerOutDamaged() == null ? null : customerStatisticalInfo.getCustomerOutDamaged());
             row.createCell(23).setCellValue(customerStatisticalInfo.getCustomerSecondaryCustomer() == null ? null : customerStatisticalInfo.getCustomerSecondaryCustomer());

+ 32 - 0
watero-rst-web/src/main/java/com/iamberry/rst/utils/KuaiDi100.java

@@ -268,7 +268,39 @@ public class KuaiDi100 {
                 break;
             default:
                 break;
+            case "dbkd":
+                name = "德邦快递";
+                break;
         }
         return name;
     }
+
+    /**
+     * 获取快递公司
+     * @param firm
+     * @return
+     */
+    public String getPostFirm(String firm) {
+        String postFirm = "";
+        switch (firm) {
+            case "sto":postFirm = "申通快递";break;
+            case "yto":postFirm = "圆通快递";break;
+            case "sf":postFirm = "顺丰快递";break;
+            case "ems":postFirm = "邮政EMS";break;
+            case "zto":postFirm = "中通快递";break;
+            case "zjs":postFirm = "宅急送";break;
+            case "yunda":postFirm = "韵达快递";break;
+            case "cces":postFirm = "cces快递";break;
+            case "pick":postFirm = "上门提货";break;
+            case "htky":postFirm = "汇通快递";break;
+            case "ttkdex":postFirm = "天天快递";break;
+            case "stars":postFirm = "星晨急便";break;
+            case "jd":postFirm = "京东快递";break;
+            case "01":postFirm = "其他";break;
+            case "02":postFirm = "上门送货";break;
+            case "dbkd":postFirm = "德邦快递";break;
+            default:postFirm = "申通快递";break;
+        }
+        return postFirm;
+    }
 }

+ 4 - 2
watero-rst-web/src/main/webapp/WEB-INF/views/cm/customer/custome_list.ftl

@@ -755,9 +755,11 @@
 
     /* 所有trim_input 样式,input框都需要去除前后空格*/
     $(".trim_input").change(function(){
-        var value = $.trim($(this).val());
-        $(this).val(value);
+        /*var value = $.trim($(this).val());*/
+        var val = $(this).val().replace(/\s/g, "");
+        $(this).val(val);
     })
+
 </script>
 </body>
 </html>