jzdsh 4 lat temu
rodzic
commit
275713d2b2

+ 49 - 82
src/main/java/com/yc/education/controller/admin/ProviderAdminController.java

@@ -1342,7 +1342,7 @@ public class ProviderAdminController extends BaseController {
     public void providerExport(String sDateVal,String eDateVal,String monthVal,String recommenderName,String cityName, HttpServletResponse response) {
 
 
-        HSSFWorkbook wb = new HSSFWorkbook( );//创建文档对象
+        HSSFWorkbook wb = new HSSFWorkbook();//创建文档对象
         HSSFSheet sheet = wb.createSheet("服务商商家信息表");//建立新的表单对象
         HSSFRow row; //行
         row = sheet.createRow(0);//行  创建第一行 设置标题
@@ -1364,65 +1364,64 @@ public class ProviderAdminController extends BaseController {
             refferPhone = recom.getPhone().trim();//推荐人电话
         }
         /*将空字符串赋值为null*/
-        if (StringUtils.isBlank(sDateVal)||StringUtils.isBlank(eDateVal)){
-            sDateVal=null;
-            eDateVal=null;
+        if (StringUtils.isBlank(sDateVal) || StringUtils.isBlank(eDateVal)) {
+            sDateVal = null;
+            eDateVal = null;
         }
         /*如果条件全为空就默认查询当前月份的商家信息*/
-        if (StringUtils.isBlank(sDateVal)&&StringUtils.isBlank(eDateVal)&&StringUtils.isBlank(monthVal)&&StringUtils.isBlank(recommenderName)&&StringUtils.isBlank(cityName)){
+        if (StringUtils.isBlank(sDateVal) && StringUtils.isBlank(eDateVal) && StringUtils.isBlank(monthVal) && StringUtils.isBlank(recommenderName) && StringUtils.isBlank(cityName)) {
             Calendar calendar = Calendar.getInstance();
-            int nowMonthVal = calendar.get(Calendar.MONTH)+1;
-            if (nowMonthVal<10){
-                String monthValStr = "0"+nowMonthVal;
+            int nowMonthVal = calendar.get(Calendar.MONTH) + 1;
+            if (nowMonthVal < 10) {
+                String monthValStr = "0" + nowMonthVal;
                 monthVal = monthValStr;
-            }else {
+            } else {
                 monthVal = String.valueOf(nowMonthVal);
             }
         }
-        List< Provider > list = iProviderService.listProviderInfoExport(sDateVal,eDateVal,monthVal,refferPhone,cityName);//查询服务商信息
+        List<Provider> list = iProviderService.listProviderInfoExport(sDateVal, eDateVal, monthVal, refferPhone, cityName);//查询服务商信息
 
-        List< Authentication > listAllAuthentication = iAuthenticationService.listAuthenticationInfoProvider("", "", "", "", 1, Integer.MAX_VALUE);
+        List<Authentication> listAllAuthentication = iAuthenticationService.listAuthenticationInfoProvider("", "", "", "", 1, Integer.MAX_VALUE);
 
-        List< Recommender > listAllRecommender = iRecommenderService.listAllRecommender(1, Integer.MAX_VALUE);//查询所有推荐人信息
-        if (list != null && list.size( ) != 0) {
+        List<Recommender> listAllRecommender = iRecommenderService.listAllRecommender(1, Integer.MAX_VALUE);//查询所有推荐人信息
+        if (list != null && list.size() != 0) {
 
             for (Provider provider : list) {
 
-                if (provider.getUserId( ) != null) {
+                if (provider.getUserId() != null) {
 
-                    UserInfo userInfo = iUserInfoService.selectByKey(provider.getUserId( ));
+                    UserInfo userInfo = iUserInfoService.selectByKey(provider.getUserId());
 
                     if (userInfo != null) {
-                        provider.setNickName(userInfo.getNickName( ));//设置用户昵称
+                        provider.setNickName(userInfo.getNickName());//设置用户昵称
                     }
                 }
                 /*从认证表中获取认证时间*/
-                if (listAllAuthentication != null && listAllAuthentication.size( ) != 0) {
+                if (listAllAuthentication != null && listAllAuthentication.size() != 0) {
 
                     for (Authentication authentication : listAllAuthentication) {
 
-                        if (authentication.getStoreId( ).equals(provider.getId( ))) {
-                            provider.setAuTime(authentication.getCreateDate( ));//给认证时间赋值
-                            if (authentication.getStoreId( ).equals(provider.getId( ))) {
-                                provider.setAuTime(authentication.getCreateDate( ));//给认证时间赋值
+                        if (authentication.getStoreId().equals(provider.getId())) {
+                            provider.setAuTime(authentication.getCreateDate());//给认证时间赋值
+                            if (authentication.getStoreId().equals(provider.getId())) {
+                                provider.setAuTime(authentication.getCreateDate());//给认证时间赋值
                             }
                         }
                     }
                     /*从推荐人表中获取推荐人姓名,电话,城市*/
 
-                    if (listAllRecommender != null && listAllRecommender.size( ) != 0) {
+                    if (listAllRecommender != null && listAllRecommender.size() != 0) {
                         for (Recommender recommender : listAllRecommender) {
-                            if (recommender.getPhone( ).equals(provider.getReferrerPhone( ))) {
-                                provider.setReferTelphon(recommender.getPhone( ));//设置推荐人电话
-                                provider.setReferName(recommender.getName( ));//设置推荐人姓名
-                                provider.setReferCity(recommender.getCity( ));//设置推荐人城市
+                            if (recommender.getPhone().equals(provider.getReferrerPhone())) {
+                                provider.setReferTelphon(recommender.getPhone());//设置推荐人电话
+                                provider.setReferName(recommender.getName());//设置推荐人姓名
+                                provider.setReferCity(recommender.getCity());//设置推荐人城市
                             }
                         }
                     }
                 }
             }
             SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd");
-            if (list != null && list.size( ) != 0) {
 
             if (list != null && list.size() != 0) {
                 for (int i = 2; i <= list.size() + 1; i++) {
@@ -1450,10 +1449,6 @@ public class ProviderAdminController extends BaseController {
                     row.createCell(8).setCellValue(list.get(i - 2).getTelphone());
                     row.createCell(9).setCellValue(f.format(list.get(i - 2).getCreateDate()));
                     row.createCell(10).setCellValue(f.format(list.get(i - 2).getModifiedDate()));
-                    row.createCell(7).setCellValue(list.get(i - 2).getAuthPhone());
-                    row.createCell(8).setCellValue(list.get(i - 2).getTelphone());
-                    row.createCell(9).setCellValue(f.format(list.get(i - 2).getCreateDate()));
-                    row.createCell(10).setCellValue(f.format(list.get(i - 2).getModifiedDate()));
 
 
                     if ("0".equals(list.get(i - 2).getStatus())) {
@@ -1476,12 +1471,7 @@ public class ProviderAdminController extends BaseController {
                     row.createCell(14).setCellValue(list.get(i - 2).getReferTelphon());
                     row.createCell(15).setCellValue(list.get(i - 2).getReferCity());
                     row.createCell(16).setCellValue(list.get(i - 2).getOperator());
-                    row.createCell(17).setCellValue(list.get(i - 2).getPv());
-                    row.createCell(13).setCellValue(list.get(i - 2).getReferName());
-                    row.createCell(14).setCellValue(list.get(i - 2).getReferTelphon());
-                    row.createCell(15).setCellValue(list.get(i - 2).getReferCity());
-                    row.createCell(16).setCellValue(list.get(i - 2).getOperator());
-                    row.createCell(17).setCellValue(list.get(i - 2).getPv());
+                    row.createCell(17).setCellValue(list.get(i - 2).getPv() == null ? 0:list.get(i-2).getPv());
                 }
             } else {
                 row.createCell(0).setCellValue("");
@@ -1497,15 +1487,10 @@ public class ProviderAdminController extends BaseController {
                 row.createCell(8).setCellValue("");
                 row.createCell(9).setCellValue("");
                 row.createCell(10).setCellValue("");
-                row.createCell(7).setCellValue("");
-                row.createCell(8).setCellValue("");
-                row.createCell(9).setCellValue("");
-                row.createCell(10).setCellValue("");
 
 
                 row.createCell(11).setCellValue("");
 
-                row.createCell(11).setCellValue("");
 
 
                 row.createCell(12).setCellValue("");
@@ -1515,49 +1500,31 @@ public class ProviderAdminController extends BaseController {
                 row.createCell(15).setCellValue("");
                 row.createCell(16).setCellValue("");
                 row.createCell(17).setCellValue("");
-                row.createCell(13).setCellValue("");
-                row.createCell(14).setCellValue("");
-                row.createCell(15).setCellValue("");
-                row.createCell(16).setCellValue("");
-                row.createCell(17).setCellValue("");
             }
-        }
-                        row.createCell(13).setCellValue(list.get(i - 2).getReferName( ));
-                        row.createCell(14).setCellValue(list.get(i - 2).getReferTelphon( ));
-                        row.createCell(15).setCellValue(list.get(i - 2).getReferCity( ));
-                        row.createCell(16).setCellValue(list.get(i - 2).getOperator( ));
-                        row.createCell(17).setCellValue(list.get(i - 2).getPv( ) == null ? 0 : list.get(i - 2).getPv( ));
-                        row.createCell(13).setCellValue(list.get(i - 2).getReferName( ));
-                        row.createCell(14).setCellValue(list.get(i - 2).getReferTelphon( ));
-                        row.createCell(15).setCellValue(list.get(i - 2).getReferCity( ));
-                        row.createCell(16).setCellValue(list.get(i - 2).getOperator( ));
-                        row.createCell(17).setCellValue(list.get(i - 2).getPv( ));
-                    }
-                }
-                OutputStream outputStream = null;
-                try {
-                    response.setContentType("application/msexcel");
-                    response.setHeader("Content-Disposition", "attachment;filename=" + new String("providerExport.xls".getBytes("utf-8"), "ISO-8859-1"));
-                    outputStream = response.getOutputStream( );
-                    wb.write(outputStream);
-
-                } catch (IOException e) {
-                    e.printStackTrace( );
-                }
-                try {
-                    outputStream.flush( );
-                } catch (IOException e) {
-                    e.printStackTrace( );
-                }
-                try {
-                    outputStream.close( );
-                } catch (IOException e) {
-                    e.printStackTrace( );
-                }
-          /*  }*/
 
-    }
+            OutputStream outputStream = null;
+            try {
+                response.setContentType("application/msexcel");
+                response.setHeader("Content-Disposition", "attachment;filename=" + new String("providerExport.xls".getBytes("utf-8"), "ISO-8859-1"));
+                outputStream = response.getOutputStream();
+                wb.write(outputStream);
 
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+            try {
+                outputStream.flush();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+            try {
+                outputStream.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+
+        }
+    }
     /**
      * ajax 跳转
      * @return