Commit 128329b8945c7de5f11408fa2e63ed9da31a85f2

Authored by 娄高锋
1 parent 03466fc6

LGF 导出报错修改

src/main/java/com/bsth/controller/DownloadController.java
@@ -2,6 +2,7 @@ package com.bsth.controller; @@ -2,6 +2,7 @@ package com.bsth.controller;
2 2
3 import java.io.File; 3 import java.io.File;
4 import java.io.IOException; 4 import java.io.IOException;
  5 +import java.net.URLDecoder;
5 6
6 import org.apache.commons.io.FileUtils; 7 import org.apache.commons.io.FileUtils;
7 import org.springframework.context.annotation.Scope; 8 import org.springframework.context.annotation.Scope;
@@ -35,7 +36,7 @@ public class DownloadController @@ -35,7 +36,7 @@ public class DownloadController
35 File file=new File(moudelPath); 36 File file=new File(moudelPath);
36 HttpHeaders headers = new HttpHeaders(); 37 HttpHeaders headers = new HttpHeaders();
37 String realFileName=new String(fileName.getBytes("UTF-8"),"iso-8859-1");//为了解决中文名称乱码问题 38 String realFileName=new String(fileName.getBytes("UTF-8"),"iso-8859-1");//为了解决中文名称乱码问题
38 - headers.setContentDispositionFormData("attachment", realFileName); 39 + headers.setContentDispositionFormData("attachment", URLDecoder.decode(realFileName,"utf-8"));
39 headers.setContentType(MediaType.APPLICATION_OCTET_STREAM); 40 headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
40 return new ResponseEntity<byte[]>(FileUtils.readFileToByteArray(file), 41 return new ResponseEntity<byte[]>(FileUtils.readFileToByteArray(file),
41 headers, HttpStatus.CREATED); 42 headers, HttpStatus.CREATED);
src/main/java/com/bsth/controller/realcontrol/ScheduleRealInfoController.java
@@ -338,8 +338,8 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo, @@ -338,8 +338,8 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
338 338
339 @RequestMapping(value = "/correctForm") 339 @RequestMapping(value = "/correctForm")
340 public List<ScheduleRealInfo> correctForm(@RequestParam String line, @RequestParam String startDate, 340 public List<ScheduleRealInfo> correctForm(@RequestParam String line, @RequestParam String startDate,
341 - @RequestParam String endDate,@RequestParam String lpName,@RequestParam String code) {  
342 - return scheduleRealInfoService.correctForm(line, startDate, endDate, lpName, code); 341 + @RequestParam String endDate, @RequestParam String lpName, @RequestParam String code, @RequestParam String type) {
  342 + return scheduleRealInfoService.correctForm(line, startDate, endDate, lpName, code, type);
343 } 343 }
344 /** 344 /**
345 * @Title queryListWaybill 345 * @Title queryListWaybill
src/main/java/com/bsth/service/realcontrol/ScheduleRealInfoService.java
@@ -95,7 +95,7 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L @@ -95,7 +95,7 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L
95 95
96 List<Map<String,Object>> account(String line,String date,String code,String xlName, String type); 96 List<Map<String,Object>> account(String line,String date,String code,String xlName, String type);
97 97
98 - List<ScheduleRealInfo> correctForm(String line,String startDate,String endDate,String lpName,String code); 98 + List<ScheduleRealInfo> correctForm(String line,String startDate,String endDate,String lpName,String code, String type);
99 99
100 List<ScheduleRealInfo> queryListWaybill(String jName,String clZbh,String lpName,String date,String type); 100 List<ScheduleRealInfo> queryListWaybill(String jName,String clZbh,String lpName,String date,String type);
101 101
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
@@ -46,6 +46,7 @@ import org.slf4j.LoggerFactory; @@ -46,6 +46,7 @@ import org.slf4j.LoggerFactory;
46 import org.springframework.beans.factory.annotation.Autowired; 46 import org.springframework.beans.factory.annotation.Autowired;
47 import org.springframework.stereotype.Service; 47 import org.springframework.stereotype.Service;
48 48
  49 +import java.net.URLEncoder;
49 import java.text.DecimalFormat; 50 import java.text.DecimalFormat;
50 import java.text.ParseException; 51 import java.text.ParseException;
51 import java.text.SimpleDateFormat; 52 import java.text.SimpleDateFormat;
@@ -1302,8 +1303,28 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -1302,8 +1303,28 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1302 1303
1303 @Override 1304 @Override
1304 public List<ScheduleRealInfo> correctForm(String line, String startDate, 1305 public List<ScheduleRealInfo> correctForm(String line, String startDate,
1305 - String endDate, String lpName, String code) { 1306 + String endDate, String lpName, String code, String type) {
1306 List<ScheduleRealInfo> list = scheduleRealInfoRepository.correctForm(line,startDate,endDate,lpName,code); 1307 List<ScheduleRealInfo> list = scheduleRealInfoRepository.correctForm(line,startDate,endDate,lpName,code);
  1308 +
  1309 + if(type != null && type.length() != 0 && type.equals("export")){
  1310 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  1311 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  1312 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  1313 + Map<String,Object> m = new HashMap<String, Object>();
  1314 + ReportUtils ee = new ReportUtils();
  1315 + m.put("startDate", startDate);
  1316 + m.put("endDate", endDate);
  1317 + try {
  1318 + listI.add(list.iterator());
  1319 + String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\";
  1320 + ee.excelReplace(listI, new Object[] { m }, path+"mould\\correctForm.xls",
  1321 + path+"export\\" + URLEncoder.encode("修正报表", "UTF-8") + sdfSimple.format(sdfMonth.parse(startDate)) + "-" + sdfSimple.format(sdfMonth.parse(endDate)) + ".xls");
  1322 + } catch (Exception e) {
  1323 + // TODO: handle exception
  1324 + e.printStackTrace();
  1325 + }
  1326 + }
  1327 +
1307 return list; 1328 return list;
1308 } 1329 }
1309 1330
src/main/java/com/bsth/service/schedule/PeopleCarPlanServiceImpl.java
1 package com.bsth.service.schedule; 1 package com.bsth.service.schedule;
2 2
3 import java.math.BigDecimal; 3 import java.math.BigDecimal;
  4 +import java.net.URLEncoder;
4 import java.sql.ResultSet; 5 import java.sql.ResultSet;
5 import java.sql.SQLException; 6 import java.sql.SQLException;
6 import java.text.DecimalFormat; 7 import java.text.DecimalFormat;
@@ -463,7 +464,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -463,7 +464,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
463 listI.add(resList.iterator()); 464 listI.add(resList.iterator());
464 String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\"; 465 String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\";
465 ee.excelReplace(listI, new Object[] { m }, path+"mould\\workDaily.xls", 466 ee.excelReplace(listI, new Object[] { m }, path+"mould\\workDaily.xls",
466 - path+"export\\营运服务日报表" + sdfSimple.format(sdfMonth.parse(date)) + ".xls"); 467 + path+"export\\营运服务日报表"+ sdfSimple.format(sdfMonth.parse(date))+".xls");
467 } catch (Exception e) { 468 } catch (Exception e) {
468 // TODO: handle exception 469 // TODO: handle exception
469 e.printStackTrace(); 470 e.printStackTrace();
@@ -937,7 +938,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -937,7 +938,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
937 tempMap.put("sjfcFirst0", "/"); 938 tempMap.put("sjfcFirst0", "/");
938 tempMap.put("delayFirst0", "/"); 939 tempMap.put("delayFirst0", "/");
939 } 940 }
940 - if(moban0.getZdsjActual() != null){ 941 + if(moban0.getFcsjActual() != null){
941 String[] split = moban0.getFcsjActual().split(":"); 942 String[] split = moban0.getFcsjActual().split(":");
942 long min = Integer.valueOf(split[0])*60 + Integer.valueOf(split[1]); 943 long min = Integer.valueOf(split[0])*60 + Integer.valueOf(split[1]);
943 long delay = moban0.getFcsjT() - min; 944 long delay = moban0.getFcsjT() - min;
@@ -963,7 +964,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -963,7 +964,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
963 tempMap.put("sjfcFirst1", "/"); 964 tempMap.put("sjfcFirst1", "/");
964 tempMap.put("delayFirst1", "/"); 965 tempMap.put("delayFirst1", "/");
965 } 966 }
966 - if(moban1.getZdsjActual() != null){ 967 + if(moban1.getFcsjActual() != null){
967 String[] split = moban1.getFcsjActual().split(":"); 968 String[] split = moban1.getFcsjActual().split(":");
968 long min = Integer.valueOf(split[0])*60 + Integer.valueOf(split[1]); 969 long min = Integer.valueOf(split[0])*60 + Integer.valueOf(split[1]);
969 long delay = moban1.getFcsjT() - min; 970 long delay = moban1.getFcsjT() - min;
src/main/resources/static/pages/forms/mould/account.xls 0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/mould/historyMessage.xls 0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/statement/correctForm.html
@@ -67,7 +67,8 @@ @@ -67,7 +67,8 @@
67 <td rowspan="2">线路名</td> 67 <td rowspan="2">线路名</td>
68 <td rowspan="2">路牌</td> 68 <td rowspan="2">路牌</td>
69 <td rowspan="2">车号</td> 69 <td rowspan="2">车号</td>
70 - <td colspan="2">车号</td> 70 + <td rowspan="2">司机</td>
  71 + <td rowspan="2">售票员</td>
71 <td colspan="2">发车时间</td> 72 <td colspan="2">发车时间</td>
72 <td colspan="2">结束时间</td> 73 <td colspan="2">结束时间</td>
73 <td rowspan="2">修改人</td> 74 <td rowspan="2">修改人</td>
@@ -75,8 +76,6 @@ @@ -75,8 +76,6 @@
75 <td rowspan="2">备注</td> 76 <td rowspan="2">备注</td>
76 </tr> 77 </tr>
77 <tr> 78 <tr>
78 - <td>司机</td>  
79 - <td>售票员</td>  
80 <td>计划</td> 79 <td>计划</td>
81 <td>实际</td> 80 <td>实际</td>
82 <td>计划</td> 81 <td>计划</td>
@@ -97,7 +96,10 @@ @@ -97,7 +96,10 @@
97 </div> 96 </div>
98 97
99 <script> 98 <script>
100 - $(function(){ 99 + $(function(){
  100 + $("#export").attr('disabled',"true");
  101 +
  102 +
101 // 关闭左侧栏 103 // 关闭左侧栏
102 if (!$('body').hasClass('page-sidebar-closed')) 104 if (!$('body').hasClass('page-sidebar-closed'))
103 $('.menu-toggler.sidebar-toggler').click(); 105 $('.menu-toggler.sidebar-toggler').click();
@@ -196,14 +198,20 @@ @@ -196,14 +198,20 @@
196 } 198 }
197 } 199 }
198 }); 200 });
199 - 201 +
  202 + var line = $("#line").val();
  203 + var startDate = $("#startDate").val();
  204 + var endDate = $("#endDate").val();
  205 + var lpName = $("#lpName").val();
  206 + var code = $("#code").val();
200 $("#query").on("click",function(){ 207 $("#query").on("click",function(){
201 - var line = $("#line").val();  
202 - var startDate = $("#startDate").val();  
203 - var endDate = $("#endDate").val();  
204 - var lpName = $("#lpName").val();  
205 - var code = $("#code").val();  
206 - $post("/realSchedule/correctForm",{line:line,startDate:startDate,endDate:endDate,lpName:lpName,code:code},function(result){ 208 + line = $("#line").val();
  209 + startDate = $("#startDate").val();
  210 + endDate = $("#endDate").val();
  211 + lpName = $("#lpName").val();
  212 + code = $("#code").val();
  213 + var type = "query";
  214 + $post("/realSchedule/correctForm",{line:line,startDate:startDate,endDate:endDate,lpName:lpName,code:code,type:type},function(result){
207 $("#sDate").text(startDate); 215 $("#sDate").text(startDate);
208 $("#eDate").text(endDate); 216 $("#eDate").text(endDate);
209 var temp = {}; 217 var temp = {};
@@ -228,8 +236,22 @@ @@ -228,8 +236,22 @@
228 236
229 /* var list_correctForm_statistics = template('list_correctForm_statistics',temp); 237 /* var list_correctForm_statistics = template('list_correctForm_statistics',temp);
230 $('#forms .list_correctForm_statistics').html(list_correctForm_statistics); */ 238 $('#forms .list_correctForm_statistics').html(list_correctForm_statistics); */
  239 +
  240 + if(result.length == 0)
  241 + $("#export").attr('disabled',"true");
  242 + else
  243 + $("#export").removeAttr("disabled");
  244 +
231 }); 245 });
232 - }); 246 + });
  247 +
  248 + $("#export").on("click",function(){
  249 + var type = "export";
  250 + $get('/realSchedule/correctForm',{line:line,startDate:startDate,endDate:endDate,lpName:lpName,code:code,type:type},function(result){
  251 + window.open("/downloadFile/download?fileName=修正报表"+moment(startDate).format("YYYYMMDD")+"-"+moment(endDate).format("YYYYMMDD"));
  252 + });
  253 + });
  254 +
233 }); 255 });
234 </script> 256 </script>
235 <script type="text/html" id="list_correctForm"> 257 <script type="text/html" id="list_correctForm">