Commit b42482ae16b663f39ce51e5e8818241b6c6bb304

Authored by yiming
1 parent d7f90c62

bf

bsthLineProfiles/src/main/java/com/ruoyi/project/system/line/controller/BsthTLineHistoryReportController.java
1 1 package com.ruoyi.project.system.line.controller;
2 2  
3   -import java.io.IOException;
4   -import java.io.OutputStream;
  3 +
5 4 import java.lang.reflect.Constructor;
6 5 import java.lang.reflect.Field;
7   -import java.lang.reflect.Method;
8   -import java.net.URLEncoder;
9   -import java.nio.charset.StandardCharsets;
10 6 import java.text.SimpleDateFormat;
11   -import java.time.LocalDateTime;
12 7 import java.util.ArrayList;
13 8 import java.util.Date;
14 9 import java.util.HashMap;
15 10 import java.util.List;
16 11 import java.util.Map;
17 12 import java.util.stream.Collectors;
18   -
19   -import cn.hutool.core.collection.CollUtil;
20   -import cn.hutool.core.io.IoUtil;
21 13 import cn.hutool.poi.excel.ExcelWriter;
22   -import cn.hutool.poi.excel.StyleSet;
23 14 import com.ruoyi.project.system.line.domain.Export;
24   -import org.apache.poi.*;
25 15 import com.ruoyi.common.utils.poi.ExcelUtil;
26 16 import com.ruoyi.project.system.line.domain.LineHistoryReport;
27 17 import org.apache.poi.ss.usermodel.*;
28 18 import org.apache.shiro.authz.annotation.RequiresPermissions;
29 19 import org.springframework.beans.factory.annotation.Autowired;
30 20 import org.springframework.stereotype.Controller;
31   -import org.springframework.ui.ModelMap;
32 21 import org.springframework.web.bind.annotation.GetMapping;
33   -import org.springframework.web.bind.annotation.PathVariable;
34 22 import org.springframework.web.bind.annotation.PostMapping;
35 23 import org.springframework.web.bind.annotation.RequestMapping;
36 24 import org.springframework.web.bind.annotation.ResponseBody;
37   -
38   -import com.ruoyi.common.utils.security.ShiroUtils;
39 25 import com.ruoyi.framework.aspectj.lang.annotation.Log;
40 26 import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
41   -import com.ruoyi.framework.config.RuoYiConfig;
42 27 import com.ruoyi.framework.web.controller.BaseController;
43 28 import com.ruoyi.framework.web.domain.AjaxResult;
44 29 import com.ruoyi.framework.web.page.TableDataInfo;
45 30 import com.ruoyi.project.system.dict.domain.DictData;
46 31 import com.ruoyi.project.system.dict.service.IDictDataService;
47 32 import com.ruoyi.project.system.line.domain.BsthTLine;
48   -import com.ruoyi.project.system.line.domain.LineEditReport;
49 33 import com.ruoyi.project.system.line.service.IBsthTLineService;
50   -import com.ruoyi.project.system.user.domain.User;
51 34 import com.ruoyi.project.system.user.service.IUserService;
52 35 import com.ruoyi.project.utils.ExcelUtils;
53   -
54   -import javax.servlet.ServletOutputStream;
55   -import javax.servlet.http.HttpServletRequest;
56 36 import javax.servlet.http.HttpServletResponse;
57 37  
58 38 @Controller
... ... @@ -104,6 +84,7 @@ public class BsthTLineHistoryReportController extends BaseController
104 84 List<DictData> dicts = dictDataService.selectDictDataList(null);
105 85 Map<String,List<DictData>> dictMap = new HashMap();
106 86 List<String> titles=new ArrayList<>();
  87 + titles.add("lineName");
107 88 for(DictData d : dicts) {
108 89 if(dictMap.get(d.getDictType()) == null) {
109 90 dictMap.put(d.getDictType(), new ArrayList<DictData>());
... ... @@ -122,13 +103,15 @@ public class BsthTLineHistoryReportController extends BaseController
122 103 Field f2 = line.getClass().getDeclaredField(name+"Old");
123 104 f.setAccessible(true);
124 105 f2.setAccessible(true);
125   - f.get(line);
126 106 String v =f.get(line)==null?"":f.get(line).toString();
127 107 String vo=f2.get(line)==null?"":f2.get(line).toString();
128 108 //如果没变置空
129 109 if(v.equals(vo)){
130 110 f.set(line, null);
131 111 f2.set(line, null);
  112 + }else {
  113 + titles.add(name);
  114 + titles.add(name+"Old");
132 115 }
133 116 v =f.get(line)==null?"":f.get(line).toString();
134 117 vo=f2.get(line)==null?"":f2.get(line).toString();
... ... @@ -188,7 +171,7 @@ public class BsthTLineHistoryReportController extends BaseController
188 171 // TODO Auto-generated catch block
189 172 e.printStackTrace();
190 173 }
191   -
  174 + titles=titles.stream().distinct().collect(Collectors.toList());
192 175  
193 176 ExcelUtil<LineHistoryReport> util = new ExcelUtil<LineHistoryReport>(LineHistoryReport.class);
194 177 util.setTitles(titles);
... ... @@ -201,13 +184,12 @@ public class BsthTLineHistoryReportController extends BaseController
201 184 @Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT)
202 185 @RequestMapping("/export2")
203 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 189 List<LineHistoryReport> list =bsthTLineService.getLineHistoryReport(bsthTLine);
207 190  
208 191 List<DictData> dicts = dictDataService.selectDictDataList(null);
209 192 Map<String,List<DictData>> dictMap = new HashMap();
210   - List<String> titles=new ArrayList<>();
211 193 for(DictData d : dicts) {
212 194 if(dictMap.get(d.getDictType()) == null) {
213 195 dictMap.put(d.getDictType(), new ArrayList<DictData>());
... ... @@ -301,7 +283,10 @@ public class BsthTLineHistoryReportController extends BaseController
301 283 writer.passCurrentRow();
302 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 290 writer.setRowHeight(0,30);
306 291 writer.merge(1,2,0,0,"单位",false);
307 292 writer.merge(1,2,1,1,"序号",false);
... ... @@ -441,7 +426,7 @@ public class BsthTLineHistoryReportController extends BaseController
441 426 writer.write(result, false);
442 427 //设置行高
443 428 ExcelUtils.setHeight(writer, (short) 2);
444   - ExcelUtils.downloadExcel(response,"变更报表",writer);
  429 + ExcelUtils.downloadExcel(response,title,writer);
445 430 }
446 431  
447 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 323  
324 324 @Excel(name = "站点名称")
325 325 private String halfwayStation;
326   - @Excel(name = "站点名称")
  326 + @Excel(name = "站点名称")
327 327 private String halfwayStationOld;
328 328  
329 329 @Excel(name = "高峰系数")
... ...
bsthLineProfiles/src/main/resources/templates/system/line/map.html
... ... @@ -197,20 +197,24 @@ body, html, #container {
197 197 });
198 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 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 405 var _value = e.item.value;
402 406 myValue = _value.province + _value.city + _value.district + _value.street + _value.business;
403 407 G("stations").innerHTML ="onconfirm<br />index = " + e.item.index + "<br />myValue = " + myValue;
404   -
405 408 setPlace();
406 409 });
407 410 function setPlace(){
408   - map.clearOverlays(); //清除地图上所有覆盖物
409 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 414 var local = new BMapGL.LocalSearch(map, { //智能搜索
415 415 onSearchComplete: myFun
416 416 });
  417 + local.search(myValue);
417 418 }
418 419  
419 420  
... ... @@ -468,14 +469,6 @@ body, html, #container {
468 469 map.addEventListener('rightclick', function(e){
469 470 var pt = e.latlng;
470 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 472 marker.setIcon(myicon);
480 473 map.removeOverlay(p);
481 474 p=marker;
... ...