Commit 128329b8945c7de5f11408fa2e63ed9da31a85f2
1 parent
03466fc6
LGF 导出报错修改
Showing
8 changed files
with
65 additions
and
20 deletions
src/main/java/com/bsth/controller/DownloadController.java
| ... | ... | @@ -2,6 +2,7 @@ package com.bsth.controller; |
| 2 | 2 | |
| 3 | 3 | import java.io.File; |
| 4 | 4 | import java.io.IOException; |
| 5 | +import java.net.URLDecoder; | |
| 5 | 6 | |
| 6 | 7 | import org.apache.commons.io.FileUtils; |
| 7 | 8 | import org.springframework.context.annotation.Scope; |
| ... | ... | @@ -35,7 +36,7 @@ public class DownloadController |
| 35 | 36 | File file=new File(moudelPath); |
| 36 | 37 | HttpHeaders headers = new HttpHeaders(); |
| 37 | 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 | 40 | headers.setContentType(MediaType.APPLICATION_OCTET_STREAM); |
| 40 | 41 | return new ResponseEntity<byte[]>(FileUtils.readFileToByteArray(file), |
| 41 | 42 | headers, HttpStatus.CREATED); | ... | ... |
src/main/java/com/bsth/controller/realcontrol/ScheduleRealInfoController.java
| ... | ... | @@ -338,8 +338,8 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, |
| 338 | 338 | |
| 339 | 339 | @RequestMapping(value = "/correctForm") |
| 340 | 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 | 345 | * @Title queryListWaybill | ... | ... |
src/main/java/com/bsth/service/realcontrol/ScheduleRealInfoService.java
| ... | ... | @@ -95,7 +95,7 @@ public interface ScheduleRealInfoService extends BaseService<ScheduleRealInfo, L |
| 95 | 95 | |
| 96 | 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 | 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 | 46 | import org.springframework.beans.factory.annotation.Autowired; |
| 47 | 47 | import org.springframework.stereotype.Service; |
| 48 | 48 | |
| 49 | +import java.net.URLEncoder; | |
| 49 | 50 | import java.text.DecimalFormat; |
| 50 | 51 | import java.text.ParseException; |
| 51 | 52 | import java.text.SimpleDateFormat; |
| ... | ... | @@ -1302,8 +1303,28 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 1302 | 1303 | |
| 1303 | 1304 | @Override |
| 1304 | 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 | 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 | 1328 | return list; |
| 1308 | 1329 | } |
| 1309 | 1330 | ... | ... |
src/main/java/com/bsth/service/schedule/PeopleCarPlanServiceImpl.java
| 1 | 1 | package com.bsth.service.schedule; |
| 2 | 2 | |
| 3 | 3 | import java.math.BigDecimal; |
| 4 | +import java.net.URLEncoder; | |
| 4 | 5 | import java.sql.ResultSet; |
| 5 | 6 | import java.sql.SQLException; |
| 6 | 7 | import java.text.DecimalFormat; |
| ... | ... | @@ -463,7 +464,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { |
| 463 | 464 | listI.add(resList.iterator()); |
| 464 | 465 | String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\"; |
| 465 | 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 | 468 | } catch (Exception e) { |
| 468 | 469 | // TODO: handle exception |
| 469 | 470 | e.printStackTrace(); |
| ... | ... | @@ -937,7 +938,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { |
| 937 | 938 | tempMap.put("sjfcFirst0", "/"); |
| 938 | 939 | tempMap.put("delayFirst0", "/"); |
| 939 | 940 | } |
| 940 | - if(moban0.getZdsjActual() != null){ | |
| 941 | + if(moban0.getFcsjActual() != null){ | |
| 941 | 942 | String[] split = moban0.getFcsjActual().split(":"); |
| 942 | 943 | long min = Integer.valueOf(split[0])*60 + Integer.valueOf(split[1]); |
| 943 | 944 | long delay = moban0.getFcsjT() - min; |
| ... | ... | @@ -963,7 +964,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { |
| 963 | 964 | tempMap.put("sjfcFirst1", "/"); |
| 964 | 965 | tempMap.put("delayFirst1", "/"); |
| 965 | 966 | } |
| 966 | - if(moban1.getZdsjActual() != null){ | |
| 967 | + if(moban1.getFcsjActual() != null){ | |
| 967 | 968 | String[] split = moban1.getFcsjActual().split(":"); |
| 968 | 969 | long min = Integer.valueOf(split[0])*60 + Integer.valueOf(split[1]); |
| 969 | 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 | 67 | <td rowspan="2">线路名</td> |
| 68 | 68 | <td rowspan="2">路牌</td> |
| 69 | 69 | <td rowspan="2">车号</td> |
| 70 | - <td colspan="2">车号</td> | |
| 70 | + <td rowspan="2">司机</td> | |
| 71 | + <td rowspan="2">售票员</td> | |
| 71 | 72 | <td colspan="2">发车时间</td> |
| 72 | 73 | <td colspan="2">结束时间</td> |
| 73 | 74 | <td rowspan="2">修改人</td> |
| ... | ... | @@ -75,8 +76,6 @@ |
| 75 | 76 | <td rowspan="2">备注</td> |
| 76 | 77 | </tr> |
| 77 | 78 | <tr> |
| 78 | - <td>司机</td> | |
| 79 | - <td>售票员</td> | |
| 80 | 79 | <td>计划</td> |
| 81 | 80 | <td>实际</td> |
| 82 | 81 | <td>计划</td> |
| ... | ... | @@ -97,7 +96,10 @@ |
| 97 | 96 | </div> |
| 98 | 97 | |
| 99 | 98 | <script> |
| 100 | - $(function(){ | |
| 99 | + $(function(){ | |
| 100 | + $("#export").attr('disabled',"true"); | |
| 101 | + | |
| 102 | + | |
| 101 | 103 | // 关闭左侧栏 |
| 102 | 104 | if (!$('body').hasClass('page-sidebar-closed')) |
| 103 | 105 | $('.menu-toggler.sidebar-toggler').click(); |
| ... | ... | @@ -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 | 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 | 215 | $("#sDate").text(startDate); |
| 208 | 216 | $("#eDate").text(endDate); |
| 209 | 217 | var temp = {}; |
| ... | ... | @@ -228,8 +236,22 @@ |
| 228 | 236 | |
| 229 | 237 | /* var list_correctForm_statistics = template('list_correctForm_statistics',temp); |
| 230 | 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 | 256 | </script> |
| 235 | 257 | <script type="text/html" id="list_correctForm"> | ... | ... |