Commit b42482ae16b663f39ce51e5e8818241b6c6bb304
1 parent
d7f90c62
bf
Showing
3 changed files
with
31 additions
and
53 deletions
bsthLineProfiles/src/main/java/com/ruoyi/project/system/line/controller/BsthTLineHistoryReportController.java
| 1 | package com.ruoyi.project.system.line.controller; | 1 | package com.ruoyi.project.system.line.controller; |
| 2 | 2 | ||
| 3 | -import java.io.IOException; | ||
| 4 | -import java.io.OutputStream; | 3 | + |
| 5 | import java.lang.reflect.Constructor; | 4 | import java.lang.reflect.Constructor; |
| 6 | import java.lang.reflect.Field; | 5 | import java.lang.reflect.Field; |
| 7 | -import java.lang.reflect.Method; | ||
| 8 | -import java.net.URLEncoder; | ||
| 9 | -import java.nio.charset.StandardCharsets; | ||
| 10 | import java.text.SimpleDateFormat; | 6 | import java.text.SimpleDateFormat; |
| 11 | -import java.time.LocalDateTime; | ||
| 12 | import java.util.ArrayList; | 7 | import java.util.ArrayList; |
| 13 | import java.util.Date; | 8 | import java.util.Date; |
| 14 | import java.util.HashMap; | 9 | import java.util.HashMap; |
| 15 | import java.util.List; | 10 | import java.util.List; |
| 16 | import java.util.Map; | 11 | import java.util.Map; |
| 17 | import java.util.stream.Collectors; | 12 | import java.util.stream.Collectors; |
| 18 | - | ||
| 19 | -import cn.hutool.core.collection.CollUtil; | ||
| 20 | -import cn.hutool.core.io.IoUtil; | ||
| 21 | import cn.hutool.poi.excel.ExcelWriter; | 13 | import cn.hutool.poi.excel.ExcelWriter; |
| 22 | -import cn.hutool.poi.excel.StyleSet; | ||
| 23 | import com.ruoyi.project.system.line.domain.Export; | 14 | import com.ruoyi.project.system.line.domain.Export; |
| 24 | -import org.apache.poi.*; | ||
| 25 | import com.ruoyi.common.utils.poi.ExcelUtil; | 15 | import com.ruoyi.common.utils.poi.ExcelUtil; |
| 26 | import com.ruoyi.project.system.line.domain.LineHistoryReport; | 16 | import com.ruoyi.project.system.line.domain.LineHistoryReport; |
| 27 | import org.apache.poi.ss.usermodel.*; | 17 | import org.apache.poi.ss.usermodel.*; |
| 28 | import org.apache.shiro.authz.annotation.RequiresPermissions; | 18 | import org.apache.shiro.authz.annotation.RequiresPermissions; |
| 29 | import org.springframework.beans.factory.annotation.Autowired; | 19 | import org.springframework.beans.factory.annotation.Autowired; |
| 30 | import org.springframework.stereotype.Controller; | 20 | import org.springframework.stereotype.Controller; |
| 31 | -import org.springframework.ui.ModelMap; | ||
| 32 | import org.springframework.web.bind.annotation.GetMapping; | 21 | import org.springframework.web.bind.annotation.GetMapping; |
| 33 | -import org.springframework.web.bind.annotation.PathVariable; | ||
| 34 | import org.springframework.web.bind.annotation.PostMapping; | 22 | import org.springframework.web.bind.annotation.PostMapping; |
| 35 | import org.springframework.web.bind.annotation.RequestMapping; | 23 | import org.springframework.web.bind.annotation.RequestMapping; |
| 36 | import org.springframework.web.bind.annotation.ResponseBody; | 24 | import org.springframework.web.bind.annotation.ResponseBody; |
| 37 | - | ||
| 38 | -import com.ruoyi.common.utils.security.ShiroUtils; | ||
| 39 | import com.ruoyi.framework.aspectj.lang.annotation.Log; | 25 | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| 40 | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; | 26 | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| 41 | -import com.ruoyi.framework.config.RuoYiConfig; | ||
| 42 | import com.ruoyi.framework.web.controller.BaseController; | 27 | import com.ruoyi.framework.web.controller.BaseController; |
| 43 | import com.ruoyi.framework.web.domain.AjaxResult; | 28 | import com.ruoyi.framework.web.domain.AjaxResult; |
| 44 | import com.ruoyi.framework.web.page.TableDataInfo; | 29 | import com.ruoyi.framework.web.page.TableDataInfo; |
| 45 | import com.ruoyi.project.system.dict.domain.DictData; | 30 | import com.ruoyi.project.system.dict.domain.DictData; |
| 46 | import com.ruoyi.project.system.dict.service.IDictDataService; | 31 | import com.ruoyi.project.system.dict.service.IDictDataService; |
| 47 | import com.ruoyi.project.system.line.domain.BsthTLine; | 32 | import com.ruoyi.project.system.line.domain.BsthTLine; |
| 48 | -import com.ruoyi.project.system.line.domain.LineEditReport; | ||
| 49 | import com.ruoyi.project.system.line.service.IBsthTLineService; | 33 | import com.ruoyi.project.system.line.service.IBsthTLineService; |
| 50 | -import com.ruoyi.project.system.user.domain.User; | ||
| 51 | import com.ruoyi.project.system.user.service.IUserService; | 34 | import com.ruoyi.project.system.user.service.IUserService; |
| 52 | import com.ruoyi.project.utils.ExcelUtils; | 35 | import com.ruoyi.project.utils.ExcelUtils; |
| 53 | - | ||
| 54 | -import javax.servlet.ServletOutputStream; | ||
| 55 | -import javax.servlet.http.HttpServletRequest; | ||
| 56 | import javax.servlet.http.HttpServletResponse; | 36 | import javax.servlet.http.HttpServletResponse; |
| 57 | 37 | ||
| 58 | @Controller | 38 | @Controller |
| @@ -104,6 +84,7 @@ public class BsthTLineHistoryReportController extends BaseController | @@ -104,6 +84,7 @@ public class BsthTLineHistoryReportController extends BaseController | ||
| 104 | List<DictData> dicts = dictDataService.selectDictDataList(null); | 84 | List<DictData> dicts = dictDataService.selectDictDataList(null); |
| 105 | Map<String,List<DictData>> dictMap = new HashMap(); | 85 | Map<String,List<DictData>> dictMap = new HashMap(); |
| 106 | List<String> titles=new ArrayList<>(); | 86 | List<String> titles=new ArrayList<>(); |
| 87 | + titles.add("lineName"); | ||
| 107 | for(DictData d : dicts) { | 88 | for(DictData d : dicts) { |
| 108 | if(dictMap.get(d.getDictType()) == null) { | 89 | if(dictMap.get(d.getDictType()) == null) { |
| 109 | dictMap.put(d.getDictType(), new ArrayList<DictData>()); | 90 | dictMap.put(d.getDictType(), new ArrayList<DictData>()); |
| @@ -122,13 +103,15 @@ public class BsthTLineHistoryReportController extends BaseController | @@ -122,13 +103,15 @@ public class BsthTLineHistoryReportController extends BaseController | ||
| 122 | Field f2 = line.getClass().getDeclaredField(name+"Old"); | 103 | Field f2 = line.getClass().getDeclaredField(name+"Old"); |
| 123 | f.setAccessible(true); | 104 | f.setAccessible(true); |
| 124 | f2.setAccessible(true); | 105 | f2.setAccessible(true); |
| 125 | - f.get(line); | ||
| 126 | String v =f.get(line)==null?"":f.get(line).toString(); | 106 | String v =f.get(line)==null?"":f.get(line).toString(); |
| 127 | String vo=f2.get(line)==null?"":f2.get(line).toString(); | 107 | String vo=f2.get(line)==null?"":f2.get(line).toString(); |
| 128 | //如果没变置空 | 108 | //如果没变置空 |
| 129 | if(v.equals(vo)){ | 109 | if(v.equals(vo)){ |
| 130 | f.set(line, null); | 110 | f.set(line, null); |
| 131 | f2.set(line, null); | 111 | f2.set(line, null); |
| 112 | + }else { | ||
| 113 | + titles.add(name); | ||
| 114 | + titles.add(name+"Old"); | ||
| 132 | } | 115 | } |
| 133 | v =f.get(line)==null?"":f.get(line).toString(); | 116 | v =f.get(line)==null?"":f.get(line).toString(); |
| 134 | vo=f2.get(line)==null?"":f2.get(line).toString(); | 117 | vo=f2.get(line)==null?"":f2.get(line).toString(); |
| @@ -188,7 +171,7 @@ public class BsthTLineHistoryReportController extends BaseController | @@ -188,7 +171,7 @@ public class BsthTLineHistoryReportController extends BaseController | ||
| 188 | // TODO Auto-generated catch block | 171 | // TODO Auto-generated catch block |
| 189 | e.printStackTrace(); | 172 | e.printStackTrace(); |
| 190 | } | 173 | } |
| 191 | - | 174 | + titles=titles.stream().distinct().collect(Collectors.toList()); |
| 192 | 175 | ||
| 193 | ExcelUtil<LineHistoryReport> util = new ExcelUtil<LineHistoryReport>(LineHistoryReport.class); | 176 | ExcelUtil<LineHistoryReport> util = new ExcelUtil<LineHistoryReport>(LineHistoryReport.class); |
| 194 | util.setTitles(titles); | 177 | util.setTitles(titles); |
| @@ -201,13 +184,12 @@ public class BsthTLineHistoryReportController extends BaseController | @@ -201,13 +184,12 @@ public class BsthTLineHistoryReportController extends BaseController | ||
| 201 | @Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT) | 184 | @Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT) |
| 202 | @RequestMapping("/export2") | 185 | @RequestMapping("/export2") |
| 203 | @ResponseBody | 186 | @ResponseBody |
| 204 | - public void export(HttpServletResponse response, BsthTLine bsthTLine, HttpServletRequest request) throws NoSuchFieldException { | 187 | + public void export(HttpServletResponse response, BsthTLine bsthTLine) throws NoSuchFieldException { |
| 205 | //查询变更记录 | 188 | //查询变更记录 |
| 206 | List<LineHistoryReport> list =bsthTLineService.getLineHistoryReport(bsthTLine); | 189 | List<LineHistoryReport> list =bsthTLineService.getLineHistoryReport(bsthTLine); |
| 207 | 190 | ||
| 208 | List<DictData> dicts = dictDataService.selectDictDataList(null); | 191 | List<DictData> dicts = dictDataService.selectDictDataList(null); |
| 209 | Map<String,List<DictData>> dictMap = new HashMap(); | 192 | Map<String,List<DictData>> dictMap = new HashMap(); |
| 210 | - List<String> titles=new ArrayList<>(); | ||
| 211 | for(DictData d : dicts) { | 193 | for(DictData d : dicts) { |
| 212 | if(dictMap.get(d.getDictType()) == null) { | 194 | if(dictMap.get(d.getDictType()) == null) { |
| 213 | dictMap.put(d.getDictType(), new ArrayList<DictData>()); | 195 | dictMap.put(d.getDictType(), new ArrayList<DictData>()); |
| @@ -301,7 +283,10 @@ public class BsthTLineHistoryReportController extends BaseController | @@ -301,7 +283,10 @@ public class BsthTLineHistoryReportController extends BaseController | ||
| 301 | writer.passCurrentRow(); | 283 | writer.passCurrentRow(); |
| 302 | writer.passCurrentRow(); | 284 | writer.passCurrentRow(); |
| 303 | //设置列名 | 285 | //设置列名 |
| 304 | - writer.merge(0,0,0,13, "2021年1月1日起至今延辟调线路情况",true); | 286 | + String createTimeStr="".equals(bsthTLine.getCreateTimeStr())?"":bsthTLine.getCreateTimeStr().substring(0,10); |
| 287 | + String getCreateTimeEnd="".equals(bsthTLine.getCreateTimeEnd())?"今":bsthTLine.getCreateTimeEnd().substring(0,10); | ||
| 288 | + String title=createTimeStr+"至"+getCreateTimeEnd+"延辟调线路情况"; | ||
| 289 | + writer.merge(0,0,0,13,title,true); | ||
| 305 | writer.setRowHeight(0,30); | 290 | writer.setRowHeight(0,30); |
| 306 | writer.merge(1,2,0,0,"单位",false); | 291 | writer.merge(1,2,0,0,"单位",false); |
| 307 | writer.merge(1,2,1,1,"序号",false); | 292 | writer.merge(1,2,1,1,"序号",false); |
| @@ -441,7 +426,7 @@ public class BsthTLineHistoryReportController extends BaseController | @@ -441,7 +426,7 @@ public class BsthTLineHistoryReportController extends BaseController | ||
| 441 | writer.write(result, false); | 426 | writer.write(result, false); |
| 442 | //设置行高 | 427 | //设置行高 |
| 443 | ExcelUtils.setHeight(writer, (short) 2); | 428 | ExcelUtils.setHeight(writer, (short) 2); |
| 444 | - ExcelUtils.downloadExcel(response,"变更报表",writer); | 429 | + ExcelUtils.downloadExcel(response,title,writer); |
| 445 | } | 430 | } |
| 446 | 431 | ||
| 447 | public static Object getObjectField(Field field,String valueStr) throws Exception{ | 432 | public static Object getObjectField(Field field,String valueStr) throws Exception{ |
bsthLineProfiles/src/main/java/com/ruoyi/project/system/line/domain/LineHistoryReport.java
| @@ -323,7 +323,7 @@ public class LineHistoryReport extends BaseEntity | @@ -323,7 +323,7 @@ public class LineHistoryReport extends BaseEntity | ||
| 323 | 323 | ||
| 324 | @Excel(name = "站点名称") | 324 | @Excel(name = "站点名称") |
| 325 | private String halfwayStation; | 325 | private String halfwayStation; |
| 326 | - @Excel(name = "站点名称") | 326 | + @Excel(name = "原站点名称") |
| 327 | private String halfwayStationOld; | 327 | private String halfwayStationOld; |
| 328 | 328 | ||
| 329 | @Excel(name = "高峰系数") | 329 | @Excel(name = "高峰系数") |
bsthLineProfiles/src/main/resources/templates/system/line/map.html
| @@ -197,20 +197,24 @@ body, html, #container { | @@ -197,20 +197,24 @@ body, html, #container { | ||
| 197 | }); | 197 | }); |
| 198 | var stations | 198 | var stations |
| 199 | */ | 199 | */ |
| 200 | - | 200 | + var sp; |
| 201 | + var myicon = new BMapGL.Icon( | ||
| 202 | + 'http://webmap0.map.bdstatic.com/wolfman/static/common/images/us_cursor_9517a2b.png', // 百度图片 | ||
| 203 | + new BMapGL.Size(18,26), // 视窗大小 | ||
| 204 | + { | ||
| 205 | + imageSize: new BMapGL.Size(144,92), // 引用图片实际大小 | ||
| 206 | + imageOffset:new BMapGL.Size(18,22) // 图片相对视窗的偏移 | ||
| 207 | + } | ||
| 208 | + ); | ||
| 201 | //地点查询 | 209 | //地点查询 |
| 202 | function searchStation(){ | 210 | function searchStation(){ |
| 203 | - var station=$('#stations').val(); | ||
| 204 | - var distance=$("#distance").val() | ||
| 205 | - | ||
| 206 | - //创建地址解析器实例 | ||
| 207 | - var myGeo = new BMapGL.Geocoder(); | ||
| 208 | - // 将地址解析结果显示在地图上,并调整地图视野 | ||
| 209 | - myGeo.getPoint(station, function(point){ | ||
| 210 | - map.clearOverlays(); | ||
| 211 | - map.centerAndZoom(point, 17); | ||
| 212 | - a(point.lng,point.lat,distance) | ||
| 213 | - }, '上海市') | 211 | + var distance=$("#distance").val(); |
| 212 | + map.clearOverlays(); | ||
| 213 | + map.centerAndZoom(sp, 18); | ||
| 214 | + var marker = new BMapGL.Marker(sp); | ||
| 215 | + marker.setIcon(myicon); | ||
| 216 | + map.addOverlay(marker); //添加标注 | ||
| 217 | + a(sp.lng,sp.lat,distance); | ||
| 214 | } | 218 | } |
| 215 | 219 | ||
| 216 | //道路查询 | 220 | //道路查询 |
| @@ -401,19 +405,16 @@ body, html, #container { | @@ -401,19 +405,16 @@ body, html, #container { | ||
| 401 | var _value = e.item.value; | 405 | var _value = e.item.value; |
| 402 | myValue = _value.province + _value.city + _value.district + _value.street + _value.business; | 406 | myValue = _value.province + _value.city + _value.district + _value.street + _value.business; |
| 403 | G("stations").innerHTML ="onconfirm<br />index = " + e.item.index + "<br />myValue = " + myValue; | 407 | G("stations").innerHTML ="onconfirm<br />index = " + e.item.index + "<br />myValue = " + myValue; |
| 404 | - | ||
| 405 | setPlace(); | 408 | setPlace(); |
| 406 | }); | 409 | }); |
| 407 | function setPlace(){ | 410 | function setPlace(){ |
| 408 | - map.clearOverlays(); //清除地图上所有覆盖物 | ||
| 409 | function myFun(){ | 411 | function myFun(){ |
| 410 | - var pp = local.getResults().getPoi(0).point; //获取第一个智能搜索的结果 | ||
| 411 | - map.centerAndZoom(pp, 18); | ||
| 412 | - map.addOverlay(new BMapGL.Marker(pp)); //添加标注 | 412 | + sp = local.getResults().getPoi(0).point; //获取第一个智能搜索的结果 |
| 413 | } | 413 | } |
| 414 | var local = new BMapGL.LocalSearch(map, { //智能搜索 | 414 | var local = new BMapGL.LocalSearch(map, { //智能搜索 |
| 415 | onSearchComplete: myFun | 415 | onSearchComplete: myFun |
| 416 | }); | 416 | }); |
| 417 | + local.search(myValue); | ||
| 417 | } | 418 | } |
| 418 | 419 | ||
| 419 | 420 | ||
| @@ -468,14 +469,6 @@ body, html, #container { | @@ -468,14 +469,6 @@ body, html, #container { | ||
| 468 | map.addEventListener('rightclick', function(e){ | 469 | map.addEventListener('rightclick', function(e){ |
| 469 | var pt = e.latlng; | 470 | var pt = e.latlng; |
| 470 | var marker = new BMapGL.Marker(new BMapGL.Point(pt.lng, pt.lat)); | 471 | var marker = new BMapGL.Marker(new BMapGL.Point(pt.lng, pt.lat)); |
| 471 | - var myicon = new BMapGL.Icon( | ||
| 472 | - 'http://webmap0.map.bdstatic.com/wolfman/static/common/images/us_cursor_9517a2b.png', // 百度图片 | ||
| 473 | - new BMapGL.Size(18,26), // 视窗大小 | ||
| 474 | - { | ||
| 475 | - imageSize: new BMapGL.Size(144,92), // 引用图片实际大小 | ||
| 476 | - imageOffset:new BMapGL.Size(18,22) // 图片相对视窗的偏移 | ||
| 477 | - } | ||
| 478 | - ); | ||
| 479 | marker.setIcon(myicon); | 472 | marker.setIcon(myicon); |
| 480 | map.removeOverlay(p); | 473 | map.removeOverlay(p); |
| 481 | p=marker; | 474 | p=marker; |