Commit 9d1934fbd5b8d025f27ff08693f095638e650ebe
1 parent
1dd9999f
Signed-off-by: yrf123456 <463058651@qq.com>
Showing
18 changed files
with
308 additions
and
24 deletions
src/main/java/com/bsth/controller/LineController.java
| 1 | 1 | package com.bsth.controller; |
| 2 | 2 | |
| 3 | +import java.util.HashMap; | |
| 3 | 4 | import java.util.Map; |
| 4 | 5 | |
| 5 | 6 | import org.springframework.beans.factory.annotation.Autowired; |
| 6 | 7 | import org.springframework.web.bind.annotation.RequestMapping; |
| 7 | 8 | import org.springframework.web.bind.annotation.RequestMethod; |
| 9 | +import org.springframework.web.bind.annotation.RequestParam; | |
| 8 | 10 | import org.springframework.web.bind.annotation.RestController; |
| 9 | 11 | |
| 12 | +import com.bsth.common.ResponseCode; | |
| 10 | 13 | import com.bsth.entity.Line; |
| 11 | 14 | import com.bsth.service.LineService; |
| 12 | 15 | import com.bsth.util.GetUIDAndCode; |
| ... | ... | @@ -50,12 +53,22 @@ public class LineController extends BaseController<Line, Integer> { |
| 50 | 53 | */ |
| 51 | 54 | @RequestMapping(method = RequestMethod.POST) |
| 52 | 55 | public Map<String, Object> save(Line t){ |
| 53 | - | |
| 56 | + Map<String, Object> map = new HashMap<>(); | |
| 54 | 57 | if(t.getId()==null) { |
| 55 | 58 | |
| 56 | 59 | t.setId(Integer.valueOf(t.getLineCode())); |
| 57 | 60 | |
| 58 | 61 | } |
| 62 | + if( (t.getId().toString().length()) > 6) { | |
| 63 | + | |
| 64 | + map.put("status", ResponseCode.ERROR); | |
| 65 | + return map; | |
| 66 | + } | |
| 59 | 67 | return service.save(t); |
| 60 | 68 | } |
| 69 | + | |
| 70 | + @RequestMapping(value ="/findById" , method = RequestMethod.GET) | |
| 71 | + Line findByID(@RequestParam(defaultValue = "id") Integer id){ | |
| 72 | + return service.findById(id); | |
| 73 | + } | |
| 61 | 74 | } | ... | ... |
src/main/java/com/bsth/controller/StationRouteController.java
| ... | ... | @@ -12,6 +12,8 @@ import org.springframework.web.bind.annotation.RestController; |
| 12 | 12 | import java.util.List; |
| 13 | 13 | import java.util.Map; |
| 14 | 14 | |
| 15 | +import javax.servlet.http.HttpServletResponse; | |
| 16 | + | |
| 15 | 17 | /** |
| 16 | 18 | * |
| 17 | 19 | * @ClassName: StationRouteController(站点路由控制器) |
| ... | ... | @@ -48,6 +50,18 @@ public class StationRouteController extends BaseController<StationRoute, Integer |
| 48 | 50 | } |
| 49 | 51 | |
| 50 | 52 | /** |
| 53 | + * @Description :TODO(查询路段信息) | |
| 54 | + * | |
| 55 | + * @param map <line.id_eq:线路ID; directions_eq:方向> | |
| 56 | + * | |
| 57 | + * @return Map<String, Object> | |
| 58 | + */ | |
| 59 | + @RequestMapping(value = "/export" , method = RequestMethod.GET) | |
| 60 | + public Map<String, Object> export(@RequestParam Integer id, HttpServletResponse resp) { | |
| 61 | + return service.getSectionRouteExport(id, resp); | |
| 62 | + } | |
| 63 | + | |
| 64 | + /** | |
| 51 | 65 | * @param String |
| 52 | 66 | * @throws |
| 53 | 67 | * @Description: TODO(批量撤销站点) | ... | ... |
src/main/java/com/bsth/repository/StationRouteRepository.java
| ... | ... | @@ -15,6 +15,7 @@ import org.springframework.transaction.annotation.Transactional; |
| 15 | 15 | |
| 16 | 16 | import com.bsth.entity.Line; |
| 17 | 17 | import com.bsth.entity.StationRoute; |
| 18 | +import com.bsth.entity.StationRouteCache; | |
| 18 | 19 | |
| 19 | 20 | /** |
| 20 | 21 | * |
| ... | ... | @@ -86,6 +87,9 @@ public interface StationRouteRepository extends BaseRepository<StationRoute, Int |
| 86 | 87 | "ON a.`stationRoute.station` = b.id ORDER BY a.`stationRoute.stationRouteCode` ASC", nativeQuery=true) |
| 87 | 88 | List<Object[]> findPoints(int line,int directions); |
| 88 | 89 | |
| 90 | + @Query("select r from StationRoute r where r.line.id=?1 and r.destroy=0 order by r.directions ASC ,r.stationRouteCode ASC") | |
| 91 | + // @Query(value = "SELECT * from bsth_c_stationroute line = ?1 and destroy=0 bsth_c_station ORDER BY directions ASC, stationRouteCode ASC", nativeQuery=true) | |
| 92 | + List<StationRoute> findStationExport(int line); | |
| 89 | 93 | |
| 90 | 94 | /** |
| 91 | 95 | * @Description :TODO(查询线路某方向下的站点序号与类型) | ... | ... |
src/main/java/com/bsth/service/LineService.java
| 1 | 1 | package com.bsth.service; |
| 2 | 2 | |
| 3 | +import org.springframework.web.bind.annotation.RequestMapping; | |
| 4 | +import org.springframework.web.bind.annotation.RequestMethod; | |
| 5 | + | |
| 3 | 6 | import com.bsth.entity.Line; |
| 4 | 7 | |
| 5 | 8 | /** |
| ... | ... | @@ -27,4 +30,6 @@ public interface LineService extends BaseService<Line, Integer> { |
| 27 | 30 | long selectMaxIdToLineCode(); |
| 28 | 31 | |
| 29 | 32 | Line findByLineCode(String lineCode); |
| 33 | + | |
| 34 | + Line findById(Integer id); | |
| 30 | 35 | } | ... | ... |
src/main/java/com/bsth/service/StationRouteService.java
| ... | ... | @@ -3,6 +3,8 @@ package com.bsth.service; |
| 3 | 3 | import java.util.List; |
| 4 | 4 | import java.util.Map; |
| 5 | 5 | |
| 6 | +import javax.servlet.http.HttpServletResponse; | |
| 7 | + | |
| 6 | 8 | import com.bsth.entity.StationRoute; |
| 7 | 9 | |
| 8 | 10 | /** |
| ... | ... | @@ -105,5 +107,10 @@ public interface StationRouteService extends BaseService<StationRoute, Integer> |
| 105 | 107 | |
| 106 | 108 | Map<String, Object> upddis(Map<String, Object> map); |
| 107 | 109 | |
| 108 | - | |
| 110 | + /** | |
| 111 | + * @param id | |
| 112 | + * @return | |
| 113 | + */ | |
| 114 | + Map<String, Object> getSectionRouteExport(Integer id, HttpServletResponse resp); | |
| 115 | + | |
| 109 | 116 | } | ... | ... |
src/main/java/com/bsth/service/impl/LineServiceImpl.java
| ... | ... | @@ -44,4 +44,10 @@ public class LineServiceImpl extends BaseServiceImpl<Line, Integer> implements L |
| 44 | 44 | return repository.findByLineCode(lineCode); |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | + @Override | |
| 48 | + public Line findById(Integer id) { | |
| 49 | + // TODO Auto-generated method stub | |
| 50 | + return repository.findOne(id); | |
| 51 | + } | |
| 52 | + | |
| 47 | 53 | } | ... | ... |
src/main/java/com/bsth/service/impl/StationRouteServiceImpl.java
| ... | ... | @@ -11,6 +11,7 @@ import com.bsth.repository.StationRepository; |
| 11 | 11 | import com.bsth.repository.StationRouteCacheRepository; |
| 12 | 12 | import com.bsth.repository.StationRouteRepository; |
| 13 | 13 | import com.bsth.service.StationRouteService; |
| 14 | +import com.bsth.util.ExcelUtil; | |
| 14 | 15 | import com.bsth.util.FTPClientUtils; |
| 15 | 16 | import com.bsth.util.PackTarGZUtils; |
| 16 | 17 | import com.bsth.util.Geo.GeoUtils; |
| ... | ... | @@ -29,6 +30,8 @@ import java.io.InputStream; |
| 29 | 30 | import java.text.DecimalFormat; |
| 30 | 31 | import java.util.*; |
| 31 | 32 | |
| 33 | +import javax.servlet.http.HttpServletResponse; | |
| 34 | + | |
| 32 | 35 | /** |
| 33 | 36 | * |
| 34 | 37 | * @ClassName: StationRouteServiceImpl(站点路由service业务层实现类) |
| ... | ... | @@ -71,6 +74,57 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ |
| 71 | 74 | return repository.findAll(new CustomerSpecs<StationRoute>(map), new Sort(orderList)); |
| 72 | 75 | } |
| 73 | 76 | |
| 77 | + @Override | |
| 78 | + public Map<String, Object> getSectionRouteExport(Integer id, HttpServletResponse resp) { | |
| 79 | + Map<String, Object> resultMap = new HashMap<String, Object>(); | |
| 80 | + try { | |
| 81 | + // List<Map<String, Object>> resultList = new ArrayList<Map<String,Object>>(); | |
| 82 | + Map<String,Object> resultExcel = new HashMap<String,Object>();//导出参数的对象 | |
| 83 | + /* 添加表头*/ | |
| 84 | + List<String> title = new ArrayList<String>(); | |
| 85 | + title.add("线路ID"); | |
| 86 | + title.add("方向"); | |
| 87 | + title.add("站点ID"); | |
| 88 | + title.add("站点顺序号"); | |
| 89 | + title.add("站点备注"); | |
| 90 | + title.add("站点名称"); | |
| 91 | + title.add("站点距离(km)"); | |
| 92 | + title.add("站点时长(min)"); | |
| 93 | + title.add("线路名称"); | |
| 94 | + resultExcel.put("title", title); | |
| 95 | + /* 添加表单*/ | |
| 96 | + Map<String,List<String>> temp = new HashMap<String,List<String>>(); | |
| 97 | + List<StationRoute> strtionList = repository.findStationExport(id); | |
| 98 | + if(strtionList == null){ | |
| 99 | + logger.info("没有数据导,出用户信息失败!"); | |
| 100 | + } else { | |
| 101 | + | |
| 102 | + for (int i = 0; i < strtionList.size(); i++) { | |
| 103 | + StationRoute station = strtionList.get(i); | |
| 104 | + | |
| 105 | + List<String> varList = new ArrayList<String>(); | |
| 106 | + varList.add(station.getLine().getId().toString()); | |
| 107 | + varList.add(station.getDirections().toString()); | |
| 108 | + varList.add(station.getStationCode()); | |
| 109 | + varList.add(station.getStationRouteCode().toString()); | |
| 110 | + varList.add(station.getStationMark()); | |
| 111 | + varList.add(station.getStationName()); | |
| 112 | + varList.add(station.getDistances().toString()); | |
| 113 | + varList.add(station.getToTime().toString()); | |
| 114 | + varList.add(station.getLine().getName()); | |
| 115 | + temp.put((i+1)+"", varList); | |
| 116 | + } | |
| 117 | + } | |
| 118 | + resultExcel.put("content", temp); | |
| 119 | + ExcelUtil excelUtil = new ExcelUtil(); | |
| 120 | + excelUtil.buildExcelDocument(resultExcel, strtionList.get(0).getLine().getName()+"线路站点",resp); | |
| 121 | + resultMap.put("status", ResponseCode.SUCCESS); | |
| 122 | + } catch (Exception e) { | |
| 123 | + resultMap.put("status", ResponseCode.ERROR); | |
| 124 | + logger.error("save erro.", e); | |
| 125 | + } | |
| 126 | + return resultMap; | |
| 127 | + } | |
| 74 | 128 | |
| 75 | 129 | /** |
| 76 | 130 | * @Description : TODO(根据路段路由Id批量撤销路段) | ... | ... |
src/main/java/com/bsth/service/impl/StationServiceImpl.java
| ... | ... | @@ -689,7 +689,7 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem |
| 689 | 689 | String bJwpoints[] = stationNameList.get(k)[0].toString().split(" "); |
| 690 | 690 | Point p2 = new Point(Double.parseDouble(bJwpoints[0]),Double.parseDouble(bJwpoints[1])); |
| 691 | 691 | double jl = GeoUtils.getDistance(p1, p2); |
| 692 | - if(jl<=20d) { | |
| 692 | + if(jl<=60d) { | |
| 693 | 693 | rsM.put("id", stationNameList.get(k)[1]); |
| 694 | 694 | temp = true; |
| 695 | 695 | break; | ... | ... |
src/main/java/com/bsth/util/ExcelUtil.java
0 → 100644
| 1 | +package com.bsth.util; | |
| 2 | + | |
| 3 | +import java.io.OutputStream; | |
| 4 | +import java.net.URLEncoder; | |
| 5 | +import java.util.List; | |
| 6 | +import java.util.Map; | |
| 7 | + | |
| 8 | +import javax.servlet.http.HttpServletResponse; | |
| 9 | + | |
| 10 | +import org.apache.poi.hssf.usermodel.HSSFCellStyle; | |
| 11 | +import org.apache.poi.hssf.usermodel.HSSFFont; | |
| 12 | +import org.apache.poi.hssf.usermodel.HSSFRow; | |
| 13 | +import org.apache.poi.hssf.usermodel.HSSFSheet; | |
| 14 | +import org.apache.poi.hssf.usermodel.HSSFWorkbook; | |
| 15 | +import org.apache.poi.hssf.util.HSSFColor; | |
| 16 | + | |
| 17 | +/** | |
| 18 | + * @ClassName: ExcelUtil.java | |
| 19 | + * @Description: TODO() | |
| 20 | + * @author: YouRuiFeng | |
| 21 | + * @date: 2017-8-13 下午3:00:44 | |
| 22 | + * | |
| 23 | + */ | |
| 24 | + | |
| 25 | +@SuppressWarnings("deprecation") | |
| 26 | +public class ExcelUtil { | |
| 27 | + | |
| 28 | + | |
| 29 | + public void buildExcelDocument(Map<String, Object> map, String exportName, HttpServletResponse response) throws Exception { | |
| 30 | + // 声明一个工作薄 | |
| 31 | + HSSFWorkbook workbook = new HSSFWorkbook(); | |
| 32 | + /* // 生成一个表格 | |
| 33 | + HSSFSheet sheet = workbook.createSheet(title); | |
| 34 | + // 设置表格默认列宽度为15个字节 | |
| 35 | + sheet.setDefaultColumnWidth((short) 15);*/ | |
| 36 | + // 生成一个样式 | |
| 37 | + HSSFCellStyle style = workbook.createCellStyle(); | |
| 38 | + // 设置这些样式 | |
| 39 | + style.setFillForegroundColor(HSSFColor.SKY_BLUE.index); | |
| 40 | + style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND); | |
| 41 | + style.setBorderBottom(HSSFCellStyle.BORDER_THIN); | |
| 42 | + style.setBorderLeft(HSSFCellStyle.BORDER_THIN); | |
| 43 | + style.setBorderRight(HSSFCellStyle.BORDER_THIN); | |
| 44 | + style.setBorderTop(HSSFCellStyle.BORDER_THIN); | |
| 45 | + style.setAlignment(HSSFCellStyle.ALIGN_CENTER); | |
| 46 | + // 生成一个字体 | |
| 47 | + HSSFFont font = workbook.createFont(); | |
| 48 | + font.setColor(HSSFColor.VIOLET.index); | |
| 49 | + font.setFontHeightInPoints((short) 12); | |
| 50 | + font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD); | |
| 51 | + // 把字体应用到当前的样式 | |
| 52 | + style.setFont(font); | |
| 53 | + HSSFCellStyle cellStyle =workbook.createCellStyle(); | |
| 54 | + cellStyle.setFont(font); | |
| 55 | + cellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER); //水平布局:居中 | |
| 56 | + cellStyle.setWrapText(true); | |
| 57 | + | |
| 58 | + //获取sheet名称 | |
| 59 | + String sheetName = (null==map.get("sheetName"))?"Sheet":map.get("sheetName").toString(); | |
| 60 | + List<String> titleList = (List<String>) map.get("title"); | |
| 61 | + Map<String,List<String>> content = (Map<String,List<String>>)map.get("content"); | |
| 62 | + //设置wordsheet名 | |
| 63 | + HSSFSheet sheet = workbook.createSheet(sheetName); | |
| 64 | + //创建第一行 | |
| 65 | + HSSFRow row = sheet.createRow(0); | |
| 66 | + //设置 ABCD列名 | |
| 67 | + sheet.autoSizeColumn((short)0); | |
| 68 | + for(int i=0;i<titleList.size();i++){ | |
| 69 | + row.createCell(i).setCellValue(titleList.get(i)); | |
| 70 | + row.setRowStyle(cellStyle); | |
| 71 | + } | |
| 72 | + for(int i=1;i<=content.size();i++){ | |
| 73 | + sheet.autoSizeColumn((short)i); //调整第一列宽度 | |
| 74 | + HSSFRow row_ = sheet.createRow(i); | |
| 75 | + List<String> temp = content.get(i+""); | |
| 76 | + for(int j=0;j<temp.size();j++){ | |
| 77 | + row_.createCell(j).setCellValue(temp.get(j)); | |
| 78 | + row_.setRowStyle(cellStyle); | |
| 79 | + } | |
| 80 | + } | |
| 81 | + String filename =exportName+ ".xls"; | |
| 82 | + response.reset();//设置为没有缓存 | |
| 83 | + response.setContentType("application/vnd.ms-excel;charset=utf-8"); | |
| 84 | + response.setHeader("Content-disposition", "attachment;filename=" + URLEncoder.encode(filename, "UTF-8")); | |
| 85 | + OutputStream ouputStream = response.getOutputStream(); | |
| 86 | + workbook.write(ouputStream); | |
| 87 | + ouputStream.flush(); | |
| 88 | + ouputStream.close(); | |
| 89 | + | |
| 90 | + } | |
| 91 | +} | ... | ... |
src/main/resources/static/pages/base/line/edit.html
| ... | ... | @@ -46,6 +46,10 @@ |
| 46 | 46 | |
| 47 | 47 | <!-- 表单分组组件 form-group START --> |
| 48 | 48 | <div class="form-group"> |
| 49 | + <!-- in_use字段 START --> | |
| 50 | + <input type="hidden" name="inUse" id="inUseInput" placeholder="隐藏字段" readonly="readonly"> | |
| 51 | + <!-- in_use字段 END --> | |
| 52 | + | |
| 49 | 53 | <!-- 线路编码 (* 必填项) START --> |
| 50 | 54 | <div class="col-md-6"> |
| 51 | 55 | <label class="control-label col-md-5"> | ... | ... |
src/main/resources/static/pages/base/line/js/line-add-form.js
| ... | ... | @@ -9,12 +9,12 @@ |
| 9 | 9 | |
| 10 | 10 | $(function(){ |
| 11 | 11 | /** 获取线路编码 @param cb <回调函数> */ |
| 12 | - function getLineCode(cb) { | |
| 13 | - /** get请求获取线路编码。返回线路编码值 */ | |
| 12 | + /*function getLineCode(cb) { | |
| 13 | + *//** get请求获取线路编码。返回线路编码值 *//* | |
| 14 | 14 | $.get('/line/getLineCode',function(lineCode){ |
| 15 | 15 | return cb && cb(lineCode); |
| 16 | 16 | }); |
| 17 | - } | |
| 17 | + }*/ | |
| 18 | 18 | /** 填充分公司下拉框选择值 */ |
| 19 | 19 | function setbrancheCompanySelectOptions(){ |
| 20 | 20 | // 获取公司下拉框选择值 |
| ... | ... | @@ -48,11 +48,11 @@ $(function(){ |
| 48 | 48 | $('#shortNameInput').val(pinyin.getCamelChars(val)); |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - /** 获取线路编码元素并设值 @param 匿名函数 */ | |
| 51 | + /** 获取线路编码元素并设值 @param 匿名函数 *//* | |
| 52 | 52 | getLineCode(function(result){ |
| 53 | 53 | // 设置线路编码值 |
| 54 | 54 | $('#lineCodeInput').val(result); |
| 55 | - }) | |
| 55 | + })*/ | |
| 56 | 56 | /** 输入线路名称,自动生成英文名称和线路简称 */ |
| 57 | 57 | $('#nameInput').on('keyup', setPinYin); |
| 58 | 58 | /** 开辟日期 日期控件 <format:日期控件时间格式;locale:语言> */ |
| ... | ... | @@ -196,7 +196,7 @@ $(function(){ |
| 196 | 196 | // 如果大于零,则已存在录入的线路编码;否则不存在 |
| 197 | 197 | if(len > 0) { |
| 198 | 198 | |
| 199 | - // 定义已有的线路编码 | |
| 199 | + /*// 定义已有的线路编码 | |
| 200 | 200 | var oldCode = params.lineCode; |
| 201 | 201 | |
| 202 | 202 | // 自动获取线路编码 |
| ... | ... | @@ -210,8 +210,11 @@ $(function(){ |
| 210 | 210 | btn : [ '确认提示并提交', '取消' ] |
| 211 | 211 | }, submit); |
| 212 | 212 | |
| 213 | - }); | |
| 214 | - | |
| 213 | + });*/ | |
| 214 | + layer.open({ | |
| 215 | + title: '消息提示' | |
| 216 | + ,content: '线路编码【'+params.lineCode+'】已存在,请重新输入编码!' | |
| 217 | + }); | |
| 215 | 218 | } else { |
| 216 | 219 | |
| 217 | 220 | // 提交 | ... | ... |
src/main/resources/static/pages/base/line/js/line-edit-form.js
| ... | ... | @@ -100,10 +100,13 @@ |
| 100 | 100 | selectTemp(function(){ |
| 101 | 101 | /** 根据ID查询详细信息 */ |
| 102 | 102 | $get('/line/' + lineId ,null, function(result){ |
| 103 | + debugger; | |
| 103 | 104 | // 如果不为空 |
| 104 | 105 | if(result) { |
| 105 | 106 | // 定义日期格式 |
| 106 | - var fs = 'YYYY-MM-DD' | |
| 107 | + var fs = 'YYYY-MM-DD'; | |
| 108 | + // 设置inUse | |
| 109 | + $('#inUseInput').val(result.inUse); | |
| 107 | 110 | // 设置日期 |
| 108 | 111 | result.openDate = moment(result.openDate).format(fs); |
| 109 | 112 | /** 填充修改线路表单元素值 @param:<result:数据结果集;line_edit_form:表单元素> */ |
| ... | ... | @@ -242,7 +245,7 @@ |
| 242 | 245 | // 提交 |
| 243 | 246 | submit(); |
| 244 | 247 | } else { |
| 245 | - // 定义已有的线路编码 | |
| 248 | + /*// 定义已有的线路编码 | |
| 246 | 249 | var oldCode = params.lineCode; |
| 247 | 250 | // 重新设置提交参数线路编码值 |
| 248 | 251 | params.lineCode = lineId; |
| ... | ... | @@ -250,7 +253,11 @@ |
| 250 | 253 | layer.confirm('线路编码【'+oldCode+'】已存在!自动顺延为如下:<br>线路编码:'+lineId, { |
| 251 | 254 | btn : [ '确认提示并提交', '取消' ] |
| 252 | 255 | }, submit); |
| 253 | - | |
| 256 | + */ | |
| 257 | + layer.open({ | |
| 258 | + title: '消息提示' | |
| 259 | + ,content: '线路编码【'+params.lineCode+'】已存在,请重新输入编码!' | |
| 260 | + }); | |
| 254 | 261 | } |
| 255 | 262 | } else { |
| 256 | 263 | // 提交 | ... | ... |
src/main/resources/static/pages/base/line/js/line-list-table.js
| ... | ... | @@ -336,7 +336,7 @@ |
| 336 | 336 | var arrChk = $("input[type='checkbox']:checked"); |
| 337 | 337 | var len = arrChk.length; |
| 338 | 338 | // 选中行ID与线路名称 |
| 339 | - var id = '', lineName = ''; | |
| 339 | + var id = ''; | |
| 340 | 340 | if(len>1) { |
| 341 | 341 | // 弹出添加成功提示消息 |
| 342 | 342 | layer.msg('存在多选,请只选中一行!'); |
| ... | ... | @@ -370,4 +370,37 @@ |
| 370 | 370 | window.location.href = "/pages/base/line/map.html?no="+id; |
| 371 | 371 | } |
| 372 | 372 | }); |
| 373 | + | |
| 374 | + // 导出线路站点 | |
| 375 | + $('#datatable_ajax_tools #exportStation').on('click', function() { | |
| 376 | + // 获取选中行. | |
| 377 | + var arrChk = $("input[type='checkbox']:checked"); | |
| 378 | + var len = arrChk.length; | |
| 379 | + // 选中行ID与线路名称 | |
| 380 | + var id = ''; | |
| 381 | + if(len>1) { | |
| 382 | + // 弹出添加成功提示消息 | |
| 383 | + layer.msg('存在多选,请只选中一行!'); | |
| 384 | + return ; | |
| 385 | + }else if(len==0) { | |
| 386 | + // 弹出添加成功提示消息 | |
| 387 | + layer.msg('请选中一条线路!'); | |
| 388 | + return ; | |
| 389 | + }else { | |
| 390 | + id = arrChk.data('id'); | |
| 391 | + var param = {}; | |
| 392 | + param.id = id; | |
| 393 | + window.open('/stationroute/export?id='+id); | |
| 394 | + | |
| 395 | + /*$.get("/stationroute/export",param,function(result) { | |
| 396 | + if(result.status == "ERROR") { | |
| 397 | + layer.msg("导出文件失败!"); | |
| 398 | + } else if(result.status == "ERROR") { | |
| 399 | + layer.msg("导出文件成功!"); | |
| 400 | + } else { | |
| 401 | + layer.msg("未知异常!"); | |
| 402 | + } | |
| 403 | + });*/ | |
| 404 | + } | |
| 405 | + }); | |
| 373 | 406 | })(); |
| 374 | 407 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/base/line/list.html
| ... | ... | @@ -5,7 +5,7 @@ |
| 5 | 5 | <div class="page-title"> |
| 6 | 6 | <h1>线路信息</h1> |
| 7 | 7 | </div> |
| 8 | -</div> | |
| 8 | + | |
| 9 | 9 | <!-- 片段标题 END --> |
| 10 | 10 | |
| 11 | 11 | <!-- 线路信息导航栏组件 START --> |
| ... | ... | @@ -40,6 +40,9 @@ |
| 40 | 40 | <li> |
| 41 | 41 | <a href="javascript:;" data-action="1" id="editRoute" class="tool-action"> <i class="fa fa-level-up"></i>上传GPS生成路线</a> |
| 42 | 42 | </li> |
| 43 | + <li> | |
| 44 | + <a href="javascript:;" data-action="2" id="exportStation" class="tool-action"> <i class="fa fa-level-up"></i>导出线路站点Excel</a> | |
| 45 | + </li> | |
| 43 | 46 | <!-- <li><a href="javascript:;" data-action="0" class="tool-action"> <i class="fa fa-print"></i> 打印 |
| 44 | 47 | </a></li> |
| 45 | 48 | <li><a href="javascript:;" data-action="1" class="tool-action"> <i class="fa fa-copy"></i> 复制 |
| ... | ... | @@ -151,6 +154,7 @@ |
| 151 | 154 | </div> |
| 152 | 155 | </div> |
| 153 | 156 | </div> |
| 157 | +</div> | |
| 154 | 158 | <!-- |
| 155 | 159 | |
| 156 | 160 | <td style="vertical-align: middle;"> | ... | ... |
src/main/resources/static/pages/base/stationroute/addstationstemplate.html
| ... | ... | @@ -212,17 +212,25 @@ $('#add_station_template_mobal').on('AddStationTempMobal.show', function(e,map,a |
| 212 | 212 | // 定义路段信息字符串 |
| 213 | 213 | var sectionJSON = JSON.stringify(jsonArray); |
| 214 | 214 | // 路段信息JSON字符串 |
| 215 | - params.sectionJSON = sectionJSON; | |
| 216 | - addSave(params,addLine.id,directionData); | |
| 215 | + // if(sectionJSON != null && sectionJSON != "") { | |
| 216 | + params.sectionJSON = sectionJSON; | |
| 217 | + addSave(params,addLine.id,directionData); | |
| 218 | + /* } else { | |
| 219 | + layer.msg('百度地图上没有此线路的相应路段,请更换方式规划!!!'); | |
| 220 | + } */ | |
| 217 | 221 | }else { |
| 218 | 222 | // 根据坐标点获取两点之间的折线路段 |
| 219 | 223 | map.getSectionListPlonly(stationdataList,function(sectiondata) { |
| 220 | 224 | // 定义路段信息字符串 |
| 221 | 225 | var sectionJSON = JSON.stringify(sectiondata); |
| 222 | 226 | // 路段信息JSON字符串 |
| 223 | - params.sectionJSON = sectionJSON; | |
| 224 | - addSave(params,addLine.id,directionData); | |
| 225 | - | |
| 227 | + //if(sectionJSON != null && sectionJSON != "") { | |
| 228 | + params.sectionJSON = sectionJSON; | |
| 229 | + addSave(params,addLine.id,directionData); | |
| 230 | + /* } else { | |
| 231 | + layer.msg('无法生成路段,请重试!'); | |
| 232 | + return; | |
| 233 | + } */ | |
| 226 | 234 | }); |
| 227 | 235 | } |
| 228 | 236 | }); | ... | ... |
src/main/resources/static/pages/base/stationroute/deletesection.html
| ... | ... | @@ -193,10 +193,24 @@ $('#delete_section_mobal').on('deleteSectionMobal.show',function(e, ajaxd, line, |
| 193 | 193 | page = 0; |
| 194 | 194 | loadTableDate(params, true); |
| 195 | 195 | } |
| 196 | + function getLineCode(id) { | |
| 197 | + var lineCode; | |
| 198 | + $.ajax({ | |
| 199 | + url: "/line/findById", //请求地址 | |
| 200 | + type: "Get", | |
| 201 | + async:false, | |
| 202 | + //请求方式 | |
| 203 | + data: { id : id}, //请求参数 | |
| 204 | + success: function (result) { | |
| 205 | + lineCode = result.lineCode; | |
| 206 | + } | |
| 207 | + }); | |
| 208 | + return lineCode; | |
| 209 | + } | |
| 196 | 210 | function getParams() { |
| 197 | 211 | // 搜索参数集合 |
| 198 | 212 | params = {}; |
| 199 | - params.lineCode_eq = line.id; | |
| 213 | + params.lineCode_eq = getLineCode(line.id); | |
| 200 | 214 | params.directions_eq = delBatch.dir; |
| 201 | 215 | params.destroy_eq = "0"; //默认查没有撤销的路段 |
| 202 | 216 | return params; | ... | ... |
src/main/resources/static/pages/base/stationroute/deletestation.html
| ... | ... | @@ -194,10 +194,24 @@ $('#delete_station_mobal').on('deleteStationMobal.show',function(e, ajaxd, line, |
| 194 | 194 | page = 0; |
| 195 | 195 | loadTableDate(params, true); |
| 196 | 196 | } |
| 197 | + function getLineCode(id) { | |
| 198 | + var lineCode; | |
| 199 | + $.ajax({ | |
| 200 | + url: "/line/findById", //请求地址 | |
| 201 | + type: "Get", | |
| 202 | + async:false, | |
| 203 | + //请求方式 | |
| 204 | + data: { id : id}, //请求参数 | |
| 205 | + success: function (result) { | |
| 206 | + lineCode = result.lineCode; | |
| 207 | + } | |
| 208 | + }); | |
| 209 | + return lineCode; | |
| 210 | + } | |
| 197 | 211 | function getParams() { |
| 198 | 212 | // 搜索参数集合 |
| 199 | 213 | params = {}; |
| 200 | - params.lineCode_eq = line.id; | |
| 214 | + params.lineCode_eq = getLineCode(line.id); | |
| 201 | 215 | params.directions_eq = delBatch.dir; |
| 202 | 216 | params.destroy_eq = "0"; //默认查没有撤销的站点 |
| 203 | 217 | return params; | ... | ... |
src/main/resources/static/pages/base/stationroute/js/stationroute-list-reload.js
| ... | ... | @@ -58,13 +58,16 @@ $(function(){ |
| 58 | 58 | /** 初始化下行树 @param:<Line.id:线路Id;1:下行> */ |
| 59 | 59 | PublicFunctions.TreeUpOrDown(Line.id,'1'); |
| 60 | 60 | |
| 61 | + var start =new Date(); | |
| 62 | + console.log(start); | |
| 61 | 63 | /** 查询路段信息 @param:<Line.id:线路Id;dir:方向> @return:data:路段数据 */ |
| 62 | 64 | GetAjaxData.getSectionRouteInfo(Line.id,dir,function(data) { |
| 63 | 65 | /** 在地图上画出线路走向 @param:<Line.id:线路Id;0:上行;data:路段数据> */ |
| 64 | 66 | PublicFunctions.linePanlThree(Line.id,data,dir); |
| 65 | 67 | |
| 66 | 68 | }); |
| 67 | - | |
| 69 | + var finish =new Date(); | |
| 70 | + console.log(finish); | |
| 68 | 71 | },500); |
| 69 | 72 | |
| 70 | 73 | }else { | ... | ... |