|
@@ -1682,142 +1682,189 @@ 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 {
|
|
|
+ @ResponseBody
|
|
|
+ @RequestMapping("/to_download_customer_excel")
|
|
|
+ public ModelAndView toDownloadCustomerExcel(HttpServletRequest request, HttpServletResponse res, CustomerInfo customerInfo) throws Exception {
|
|
|
+ ModelAndView mv = new ModelAndView("cm/customer/download_customer");
|
|
|
Admin admin = AdminUtils.getLoginAdmin();
|
|
|
- //添加一条下载记录
|
|
|
+ //获取销售公司
|
|
|
+ List<CompanyInfo> companyInfoList = companyInfoService.listCompanyInfo(new CompanyInfo());
|
|
|
+ //查询店铺
|
|
|
+ StoreInfo storeInfo = new StoreInfo();
|
|
|
+ storeInfo.setCompanyId(companyInfoList.get(0).getCompanyId());
|
|
|
+ List<StoreInfo> storeList = storeInfoService.listStore(storeInfo);
|
|
|
+ //查询处理类型
|
|
|
+ List<ProcType> procTypeList = customerService.listProcType();
|
|
|
+ //查询登录人下载客诉记录
|
|
|
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 = {
|
|
|
- "日期", "姓名", "联系电话", "类别", "来源入口",
|
|
|
- "问题类别", "小类名称", "客诉问题", "处理过程", "购买日期",
|
|
|
- "处理方式","处理结果", "销售公司", "销售渠道", "产品型号", "产品颜色",
|
|
|
- "产品数量", "寄回快递", "寄回单号", "签收日期",
|
|
|
- "状态", "寄出快递", "寄出快递", "开箱损", "二次客诉", "跟进客服", "工厂报价", "客户报价", "邮费信息"
|
|
|
- };
|
|
|
- List<CustomerStatisticalInfo> customerStatisticalInfoList = new ArrayList<>();
|
|
|
- for (CustomerStatisticalInfo customerInfo : customerList) {
|
|
|
- long startTime=System.currentTimeMillis(); //获取开始时间
|
|
|
- s++;
|
|
|
- //新建一个容器
|
|
|
- CustomerStatisticalInfo customer = new CustomerStatisticalInfo();
|
|
|
- //将数据copy到新容器
|
|
|
- BeanUtils.copyProperties(customerInfo, customer);
|
|
|
- CustomerCommon customerCommon = new CustomerCommon();
|
|
|
- customerCommon.setCustomerId(customerInfo.getCustomerId());
|
|
|
- customerCommon.setRelationId(customerInfo.getRelationId());
|
|
|
- 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()) {
|
|
|
- //将数据copy到新容器
|
|
|
- CustomerStatisticalInfo customers = new CustomerStatisticalInfo();
|
|
|
- BeanUtils.copyProperties(customer, customers);
|
|
|
- customers.setRelationBackLogisticsCompany(customerInfo.getRelationBackLogisticsCompany());
|
|
|
- customers.setRelationBackLogisticsNo(customerInfo.getRelationBackLogisticsNo());
|
|
|
- customers.setRelationSendLogisticsCompany(customerInfo.getRelationSendLogisticsCompany());
|
|
|
- customers.setRelationSendLogisticsNo(customerInfo.getRelationSendLogisticsNo());
|
|
|
- customers.setRelationBackStatus(String.valueOf(customerInfo.getRelationBackStatus()));
|
|
|
- if(customerInfo.getRelationBackReceiptDate() == null){
|
|
|
- customers.setRelationBackReceiptDate(null);
|
|
|
- }else{
|
|
|
- customers.setRelationBackReceiptDate(customerInfo.getRelationBackReceiptDate());
|
|
|
- }
|
|
|
- customers.setSalesPayTime(salesOrder.getSalesPayTime());
|
|
|
- customers.setItemProductName(salesOrderItem.getItemProductName());
|
|
|
- customers.setItemProductColor(salesOrderItem.getItemProductColor());
|
|
|
- customers.setItemNum(String.valueOf(salesOrderItem.getItemNum()));
|
|
|
- customers.setRelationFactoryCosts(customerInfo.getRelationFactoryCosts());
|
|
|
- customers.setRelationCustomerCosts(customerInfo.getRelationCustomerCosts());
|
|
|
- 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 = "已转账";
|
|
|
+ List<DownloadProgressInfo> listDownloadProgressInfo = customerService.listDownloadProgressInfo(downloadProgressInfo);
|
|
|
+ mv.addObject("listDownloadProgressInfo",listDownloadProgressInfo);
|
|
|
+ mv.addObject("companyInfoList",companyInfoList);
|
|
|
+ mv.addObject("storeList",storeList);
|
|
|
+ mv.addObject("procTypeList",procTypeList);
|
|
|
+ return mv;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 下载客诉信息 (2018-05-29)
|
|
|
+ *
|
|
|
+ * @param request
|
|
|
+ * @param res
|
|
|
+ * @param
|
|
|
+ * @throws Exception
|
|
|
+ */
|
|
|
+ @ResponseBody
|
|
|
+ @RequestMapping("/download_customer_excel")
|
|
|
+ public ResponseJson downloadEfastOrderExcel(HttpServletRequest request, HttpServletResponse res, CustomerInfo customerInfo) throws Exception {
|
|
|
+ String path = request.getSession().getServletContext().getRealPath("/");
|
|
|
+ new Thread(new Mythread(path,customerInfo)).start();
|
|
|
+ return new ResponseJson(200, "查询成功", 200);
|
|
|
+ }
|
|
|
+
|
|
|
+ class Mythread extends Thread{
|
|
|
+ private String path;
|
|
|
+ private CustomerInfo customerInfo;
|
|
|
+ public Mythread(String path,CustomerInfo customerInfo) {
|
|
|
+ this.path=path;
|
|
|
+ this.customerInfo=customerInfo;
|
|
|
+ }
|
|
|
+ @Override
|
|
|
+ public void run(){
|
|
|
+ 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;
|
|
|
+ int s = 0;
|
|
|
+ List<CustomerStatisticalInfo> customerList = customerService.listStatisticalCustomer(customerInfo);
|
|
|
+ String[] cells = {
|
|
|
+ "日期", "姓名", "联系电话", "类别", "来源入口",
|
|
|
+ "问题类别", "小类名称", "客诉问题", "处理过程", "购买日期",
|
|
|
+ "处理方式","处理结果", "销售公司", "销售渠道", "产品型号", "产品颜色",
|
|
|
+ "产品数量", "寄回快递", "寄回单号", "签收日期",
|
|
|
+ "状态", "寄出快递", "寄出快递", "开箱损", "二次客诉", "跟进客服", "工厂报价", "客户报价", "邮费信息"
|
|
|
+ };
|
|
|
+ List<CustomerStatisticalInfo> customerStatisticalInfoList = new ArrayList<>();
|
|
|
+ for (CustomerStatisticalInfo customerInfo : customerList) {
|
|
|
+ long startTime=System.currentTimeMillis(); //获取开始时间
|
|
|
+ s++;
|
|
|
+ //新建一个容器
|
|
|
+ CustomerStatisticalInfo customer = new CustomerStatisticalInfo();
|
|
|
+ //将数据copy到新容器
|
|
|
+ BeanUtils.copyProperties(customerInfo, customer);
|
|
|
+ CustomerCommon customerCommon = new CustomerCommon();
|
|
|
+ customerCommon.setCustomerId(customerInfo.getCustomerId());
|
|
|
+ customerCommon.setRelationId(customerInfo.getRelationId());
|
|
|
+ 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()) {
|
|
|
+ //将数据copy到新容器
|
|
|
+ CustomerStatisticalInfo customers = new CustomerStatisticalInfo();
|
|
|
+ BeanUtils.copyProperties(customer, customers);
|
|
|
+ customers.setRelationBackLogisticsCompany(customerInfo.getRelationBackLogisticsCompany());
|
|
|
+ customers.setRelationBackLogisticsNo(customerInfo.getRelationBackLogisticsNo());
|
|
|
+ customers.setRelationSendLogisticsCompany(customerInfo.getRelationSendLogisticsCompany());
|
|
|
+ customers.setRelationSendLogisticsNo(customerInfo.getRelationSendLogisticsNo());
|
|
|
+ customers.setRelationBackStatus(String.valueOf(customerInfo.getRelationBackStatus()));
|
|
|
+ if(customerInfo.getRelationBackReceiptDate() == null){
|
|
|
+ customers.setRelationBackReceiptDate(null);
|
|
|
+ }else{
|
|
|
+ customers.setRelationBackReceiptDate(customerInfo.getRelationBackReceiptDate());
|
|
|
+ }
|
|
|
+ customers.setSalesPayTime(salesOrder.getSalesPayTime());
|
|
|
+ customers.setItemProductName(salesOrderItem.getItemProductName());
|
|
|
+ customers.setItemProductColor(salesOrderItem.getItemProductColor());
|
|
|
+ customers.setItemNum(String.valueOf(salesOrderItem.getItemNum()));
|
|
|
+ customers.setRelationFactoryCosts(customerInfo.getRelationFactoryCosts());
|
|
|
+ customers.setRelationCustomerCosts(customerInfo.getRelationCustomerCosts());
|
|
|
+ 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{
|
|
|
+ customerStatisticalInfoList.add(customer);
|
|
|
}
|
|
|
- }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{
|
|
|
+ long endTime=System.currentTimeMillis(); //获取结束时间
|
|
|
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);
|
|
|
+ if(s == 1){
|
|
|
+ cycleOne = endTime - startTime;
|
|
|
+
|
|
|
+ SimpleDateFormat sdf3=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ cycleOnes = cycleOne * customerList.size();
|
|
|
+ //修改预计下载完成时间
|
|
|
+ downloadProgressInfo.setDownloadDate(sdf3.format(new Date().getTime()+cycleOnes));
|
|
|
+ downloadProgressInfo.setDownloadProgress(result);
|
|
|
+ customerService.updateDownloadProgressInfo(downloadProgressInfo);
|
|
|
+ }else{
|
|
|
+ numberFormat.setMaximumFractionDigits(2);
|
|
|
+ downloadProgressInfo.setDownloadProgress(result);
|
|
|
+ customerService.updateDownloadProgressInfo(downloadProgressInfo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //导出订单Excel并下载
|
|
|
+ try {
|
|
|
+ customerExcel(cells,customerStatisticalInfoList,downloadProgressInfo,path);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
}
|
|
|
|
|
|
}
|
|
|
- //导出订单Excel并下载
|
|
|
- customerExcel(request,res,cells,customerStatisticalInfoList,downloadProgressInfo);
|
|
|
-
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 导出订单Excel并下载
|
|
|
- * @param request
|
|
|
- * @param res
|
|
|
* @param cells
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
- public void customerExcel(HttpServletRequest request,HttpServletResponse res,
|
|
|
- String[] cells,List<CustomerStatisticalInfo> customerList,
|
|
|
- DownloadProgressInfo downloadProgressInfo) throws Exception {
|
|
|
+ public void customerExcel(String[] cells,List<CustomerStatisticalInfo> customerList,
|
|
|
+ DownloadProgressInfo downloadProgressInfo,String path) throws Exception {
|
|
|
|
|
|
//创建一个workbook,对应一个Excel文件
|
|
|
HSSFWorkbook wb = new HSSFWorkbook();
|
|
@@ -1918,7 +1965,7 @@ public class AdminCustomerController {
|
|
|
|
|
|
}
|
|
|
//下载导出订单Excel
|
|
|
- downloadCustomerExcel(wb,downloadProgressInfo);
|
|
|
+ downloadCustomerExcel(wb,downloadProgressInfo,path);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -1926,18 +1973,19 @@ public class AdminCustomerController {
|
|
|
* @param wb
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
- public void downloadCustomerExcel(HSSFWorkbook wb,DownloadProgressInfo downloadProgressInfo) throws Exception{
|
|
|
+ public void downloadCustomerExcel(HSSFWorkbook wb,DownloadProgressInfo downloadProgressInfo,String path) 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");
|
|
|
+ FileOutputStream fout = new FileOutputStream(path+"/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");
|
|
|
+ downloadProgressInfo.setDownloadUrl("\\common\\customerExcel\\"+fileName+downloadProgressInfo.getDownloadId()+".xls");
|
|
|
+ customerService.updateDownloadProgressInfo(downloadProgressInfo);
|
|
|
}
|
|
|
|
|
|
/**
|