|
@@ -1819,23 +1819,25 @@ public class AdminCustomerController {
|
|
|
*
|
|
|
* @param request
|
|
|
* @param res
|
|
|
- * @param
|
|
|
+ * @param type 1查询客诉订单 2查询寄回订单
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
@ResponseBody
|
|
|
@RequestMapping("/download_customer_excel")
|
|
|
- public ResponseJson downloadEfastOrderExcel(HttpServletRequest request, HttpServletResponse res, CustomerInfo customerInfo) throws Exception {
|
|
|
+ public ResponseJson downloadEfastOrderExcel(HttpServletRequest request, HttpServletResponse res, CustomerInfo customerInfo,Integer type) throws Exception {
|
|
|
String path = request.getSession().getServletContext().getRealPath("/");
|
|
|
- new Thread(new Mythread(path,customerInfo)).start();
|
|
|
+ new Thread(new Mythread(path,customerInfo,type)).start();
|
|
|
return new ResponseJson(200, "查询成功", 200);
|
|
|
}
|
|
|
|
|
|
class Mythread extends Thread{
|
|
|
private String path;
|
|
|
private CustomerInfo customerInfo;
|
|
|
- public Mythread(String path,CustomerInfo customerInfo) {
|
|
|
+ private Integer type;
|
|
|
+ public Mythread(String path,CustomerInfo customerInfo,Integer type) {
|
|
|
this.path=path;
|
|
|
this.customerInfo=customerInfo;
|
|
|
+ this.type=type;
|
|
|
}
|
|
|
@Override
|
|
|
public void run(){
|
|
@@ -1873,71 +1875,114 @@ public class AdminCustomerController {
|
|
|
List<CustomerCommon> listCustomerCommon = customerService.listCustomerCommons(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()) {
|
|
|
- if(common.getSignclosedInfos().size() > 0){
|
|
|
- for(ComplaintSignclosedInfo signclosedInfo : common.getSignclosedInfos()){
|
|
|
- for (SignclosedProductInfo signclosedProductInfo : signclosedInfo.getSignclosedProductInfoList()) {
|
|
|
- //将数据copy到新容器
|
|
|
- CustomerStatisticalInfo customers = new CustomerStatisticalInfo();
|
|
|
- BeanUtils.copyProperties(customer, customers);
|
|
|
- customers.setRelationBackLogisticsCompany(signclosedInfo.getSignclosedLogistics());
|
|
|
- customers.setRelationBackLogisticsNo(signclosedInfo.getSignclosedLogisticsNumber());
|
|
|
- customers.setRelationBackStatus(String.valueOf(signclosedInfo.getSignclosedIsReceiving()));
|
|
|
- if(signclosedInfo.getSignclosedDate() == null){
|
|
|
- customers.setRelationBackReceiptDate(null);
|
|
|
- }else{
|
|
|
- customers.setRelationBackReceiptDate(sdf4.format(signclosedInfo.getSignclosedDate()));
|
|
|
- }
|
|
|
- customers.setSignclosedProductInfo(signclosedProductInfo.getProductName()+"("+signclosedProductInfo.getColorName()+")"+"*"+signclosedProductInfo.getProductNum());
|
|
|
- customers.setItemProductColor(signclosedProductInfo.getColorName());
|
|
|
- customers.setRelationSendLogisticsCompany(salesOrder.getSalesPostNum());
|
|
|
- customers.setRelationSendLogisticsNo(salesOrder.getSalesPostFirm());
|
|
|
+ if(type == 1){
|
|
|
+ if (common.getSalesOrderList().size() > 0) {
|
|
|
+ for (SalesOrder salesOrder : common.getSalesOrderList()) {
|
|
|
+ if (salesOrder.getSalesOrderItemList().size() > 0) {
|
|
|
+ for (SalesOrderItem salesOrderItem : salesOrder.getSalesOrderItemList()) {
|
|
|
+ if(common.getSignclosedInfos().size() > 0){
|
|
|
+ //将数据copy到新容器
|
|
|
+ CustomerStatisticalInfo customers = new CustomerStatisticalInfo();
|
|
|
+ BeanUtils.copyProperties(customer, customers);
|
|
|
+ /* customers.setRelationBackLogisticsCompany(signclosedInfo.getSignclosedLogistics());
|
|
|
+ customers.setRelationBackLogisticsNo(signclosedInfo.getSignclosedLogisticsNumber());
|
|
|
+ customers.setRelationBackStatus(String.valueOf(signclosedInfo.getSignclosedIsReceiving()));
|
|
|
+ if(signclosedInfo.getSignclosedDate() == null){
|
|
|
+ customers.setRelationBackReceiptDate(null);
|
|
|
+ }else{
|
|
|
+ customers.setRelationBackReceiptDate(sdf4.format(signclosedInfo.getSignclosedDate()));
|
|
|
+ }
|
|
|
+ customers.setSignclosedProductInfo(signclosedProductInfo.getProductName()+"("+signclosedProductInfo.getColorName()+")"+"*"+signclosedProductInfo.getProductNum());
|
|
|
+ customers.setItemProductColor(signclosedProductInfo.getColorName());*/
|
|
|
+ customers.setRelationSendLogisticsCompany(salesOrder.getSalesPostFirm());
|
|
|
+ customers.setRelationSendLogisticsNo(salesOrder.getSalesPostNum());
|
|
|
|
|
|
- customers.setSalesPayTime(salesOrder.getSalesPayTime());
|
|
|
- customers.setItemProductName(salesOrderItem.getItemProductName());
|
|
|
+ customers.setSalesPayTime(salesOrder.getSalesPayTime());
|
|
|
+ customers.setItemProductName(salesOrderItem.getItemProductName());
|
|
|
|
|
|
- customers.setItemNum(String.valueOf(salesOrderItem.getItemNum()));
|
|
|
- if(salesOrderItem.getTypeName() != null || !salesOrderItem.getTypeName().equals("")){
|
|
|
- customers.setTypeName(String.valueOf(salesOrderItem.getTypeName()));
|
|
|
- }
|
|
|
- customers.setRelationFactoryCosts(customerInfo.getRelationFactoryCosts());
|
|
|
- customers.setRelationCustomerCosts(customerInfo.getRelationCustomerCosts());
|
|
|
- customers.setSignclosedProductInfos(common.getSignclosedProductInfos());
|
|
|
- String postageString = "";
|
|
|
- //查询邮费信息
|
|
|
- List<PostageInfo> listPostageInfo = customerService.listPostageInfo(customers.getRelationId());
|
|
|
- if(listPostageInfo.size() > 0){
|
|
|
- for(PostageInfo postageInfo : listPostageInfo){
|
|
|
- String state = "";
|
|
|
- if(postageInfo.getPostageStatus() == 1){
|
|
|
- state = "未申请";
|
|
|
- }
|
|
|
- if(postageInfo.getPostageStatus() == 2){
|
|
|
- state = "已申请(待转账)";
|
|
|
- }
|
|
|
- if(postageInfo.getPostageStatus() == 3){
|
|
|
- state = "已转账";
|
|
|
+ customers.setItemNum(String.valueOf(salesOrderItem.getItemNum()));
|
|
|
+ if(salesOrderItem.getTypeName() != null || !salesOrderItem.getTypeName().equals("")){
|
|
|
+ customers.setTypeName(String.valueOf(salesOrderItem.getTypeName()));
|
|
|
+ }
|
|
|
+ customers.setRelationFactoryCosts(customerInfo.getRelationFactoryCosts());
|
|
|
+ customers.setRelationCustomerCosts(customerInfo.getRelationCustomerCosts());
|
|
|
+ customers.setSignclosedProductInfos(common.getSignclosedProductInfos());
|
|
|
+ String postageString = "";
|
|
|
+ //查询邮费信息
|
|
|
+ List<PostageInfo> listPostageInfo = customerService.listPostageInfo(customers.getRelationId());
|
|
|
+ if(listPostageInfo.size() > 0){
|
|
|
+ for(PostageInfo postageInfo : listPostageInfo){
|
|
|
+ String state = "";
|
|
|
+ if(postageInfo.getPostageStatus() == 1){
|
|
|
+ state = "未申请";
|
|
|
+ }
|
|
|
+ if(postageInfo.getPostageStatus() == 2){
|
|
|
+ state = "已申请(待转账)";
|
|
|
+ }
|
|
|
+ if(postageInfo.getPostageStatus() == 3){
|
|
|
+ state = "已转账";
|
|
|
+ }
|
|
|
+ postageString = postageString+"状态:"+state+" ,金额:"+postageInfo.getPostageAmount()/100+" ,支付宝账号:"+postageInfo.getPostageAlipay()+";";
|
|
|
}
|
|
|
- postageString = postageString+"状态:"+state+" ,金额:"+postageInfo.getPostageAmount()/100+" ,支付宝账号:"+postageInfo.getPostageAlipay()+";";
|
|
|
}
|
|
|
- }
|
|
|
- customers.setPostageString(postageString);
|
|
|
- customerStatisticalInfoList.add(customers);
|
|
|
- }
|
|
|
+ customers.setPostageString(postageString);
|
|
|
+ customerStatisticalInfoList.add(customers);
|
|
|
}
|
|
|
}
|
|
|
+ } else {
|
|
|
+ customerStatisticalInfoList.add(customer);
|
|
|
}
|
|
|
- } else {
|
|
|
- customerStatisticalInfoList.add(customer);
|
|
|
}
|
|
|
+ } else {
|
|
|
+ customerStatisticalInfoList.add(customer);
|
|
|
}
|
|
|
- } else {
|
|
|
- customerStatisticalInfoList.add(customer);
|
|
|
- }
|
|
|
-
|
|
|
+ }else if (type == 2){
|
|
|
+ if(common.getSignclosedInfos().size() > 0){
|
|
|
+ for(ComplaintSignclosedInfo signclosedInfo : common.getSignclosedInfos()){
|
|
|
+ for (SignclosedProductInfo signclosedProductInfo : signclosedInfo.getSignclosedProductInfoList()) {
|
|
|
+ //将数据copy到新容器
|
|
|
+ CustomerStatisticalInfo customers = new CustomerStatisticalInfo();
|
|
|
+ BeanUtils.copyProperties(customer, customers);
|
|
|
+ customers.setRelationBackLogisticsCompany(signclosedInfo.getSignclosedLogistics());
|
|
|
+ customers.setRelationBackLogisticsNo(signclosedInfo.getSignclosedLogisticsNumber());
|
|
|
+ customers.setRelationBackStatus(String.valueOf(signclosedInfo.getSignclosedIsReceiving()));
|
|
|
+ if(signclosedInfo.getSignclosedDate() == null){
|
|
|
+ customers.setRelationBackReceiptDate(null);
|
|
|
+ }else{
|
|
|
+ customers.setRelationBackReceiptDate(sdf4.format(signclosedInfo.getSignclosedDate()));
|
|
|
+ }
|
|
|
+ customers.setSignclosedProductInfo(signclosedProductInfo.getProductName()+"("+signclosedProductInfo.getColorName()+")"+"*"+signclosedProductInfo.getProductNum());
|
|
|
+ customers.setItemProductColor(signclosedProductInfo.getColorName());
|
|
|
+
|
|
|
+ customers.setRelationFactoryCosts(customerInfo.getRelationFactoryCosts());
|
|
|
+ customers.setRelationCustomerCosts(customerInfo.getRelationCustomerCosts());
|
|
|
+ customers.setSignclosedProductInfos(common.getSignclosedProductInfos());
|
|
|
+ String postageString = "";
|
|
|
+ //查询邮费信息
|
|
|
+ List<PostageInfo> listPostageInfo = customerService.listPostageInfo(customers.getRelationId());
|
|
|
+ if(listPostageInfo.size() > 0){
|
|
|
+ for(PostageInfo postageInfo : listPostageInfo){
|
|
|
+ String state = "";
|
|
|
+ if(postageInfo.getPostageStatus() == 1){
|
|
|
+ state = "未申请";
|
|
|
+ }
|
|
|
+ if(postageInfo.getPostageStatus() == 2){
|
|
|
+ state = "已申请(待转账)";
|
|
|
+ }
|
|
|
+ if(postageInfo.getPostageStatus() == 3){
|
|
|
+ state = "已转账";
|
|
|
+ }
|
|
|
+ postageString = postageString+"状态:"+state+" ,金额:"+postageInfo.getPostageAmount()/100+" ,支付宝账号:"+postageInfo.getPostageAlipay()+";";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ customers.setPostageString(postageString);
|
|
|
+ customerStatisticalInfoList.add(customers);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ customerStatisticalInfoList.add(customer);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}else{
|
|
|
customerStatisticalInfoList.add(customer);
|
|
@@ -1963,7 +2008,7 @@ public class AdminCustomerController {
|
|
|
}
|
|
|
//导出订单Excel并下载
|
|
|
try {
|
|
|
- customerExcel(cells,customerStatisticalInfoList,downloadProgressInfo,path);
|
|
|
+ customerExcel(cells,customerStatisticalInfoList,downloadProgressInfo,path,type);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
@@ -1978,7 +2023,7 @@ public class AdminCustomerController {
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public void customerExcel(String[] cells,List<CustomerStatisticalInfo> customerList,
|
|
|
- DownloadProgressInfo downloadProgressInfo,String path) throws Exception {
|
|
|
+ DownloadProgressInfo downloadProgressInfo,String path,Integer type) throws Exception {
|
|
|
|
|
|
//创建一个workbook,对应一个Excel文件
|
|
|
HSSFWorkbook wb = new HSSFWorkbook();
|
|
@@ -2019,7 +2064,13 @@ public class AdminCustomerController {
|
|
|
}
|
|
|
String backLogisticsCompany = "";
|
|
|
if(customerStatisticalInfo.getRelationBackLogisticsCompany() != null){
|
|
|
- backLogisticsCompany = KuaiDi100.replace(customerStatisticalInfo.getRelationBackLogisticsCompany());
|
|
|
+
|
|
|
+ LogisticsInfo logisticsInfo = logisticsInfoService.getLogisticsNameByRSTCode(customerStatisticalInfo.getRelationBackLogisticsCompany());
|
|
|
+ if(logisticsInfo != null){
|
|
|
+ backLogisticsCompany = logisticsInfo.getLogisticsName();
|
|
|
+ }else{
|
|
|
+ backLogisticsCompany = customerStatisticalInfo.getRelationBackLogisticsCompany();
|
|
|
+ }
|
|
|
}
|
|
|
String backStatus = "未知";
|
|
|
if(customerStatisticalInfo.getRelationBackStatus() != null){
|
|
@@ -2035,7 +2086,12 @@ public class AdminCustomerController {
|
|
|
}
|
|
|
String sendLogisticsCompany = "";
|
|
|
if(customerStatisticalInfo.getRelationSendLogisticsCompany() != null){
|
|
|
- sendLogisticsCompany = KuaiDi100.replace(customerStatisticalInfo.getRelationSendLogisticsCompany());
|
|
|
+ LogisticsInfo logisticsInfo = logisticsInfoService.getLogisticsNameByRSTCode(customerStatisticalInfo.getRelationSendLogisticsCompany());
|
|
|
+ if(logisticsInfo != null){
|
|
|
+ sendLogisticsCompany = logisticsInfo.getLogisticsName();
|
|
|
+ }else{
|
|
|
+ sendLogisticsCompany = customerStatisticalInfo.getRelationSendLogisticsCompany();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// 创建单元格,设置值
|
|
@@ -2091,8 +2147,9 @@ public class AdminCustomerController {
|
|
|
row.createCell(29).setCellValue(customerStatisticalInfo.getPostageString());
|
|
|
|
|
|
}
|
|
|
+
|
|
|
//下载导出订单Excel
|
|
|
- downloadCustomerExcel(wb,downloadProgressInfo,path,"客诉报表");
|
|
|
+ downloadCustomerExcel(wb,downloadProgressInfo,path,"客诉报表"+ (type== 1 ? "(客诉订单)" : "(寄回订单)"));
|
|
|
}
|
|
|
|
|
|
/**
|