Commit 28d9bc72264dfbdf01be099ffd561b2af8be714a
1 parent
43c95db6
李强
Showing
10 changed files
with
139 additions
and
62 deletions
src/main/java/com/bsth/controller/StationRouteController.java
| @@ -92,11 +92,10 @@ public class StationRouteController extends BaseController<StationRoute, Integer | @@ -92,11 +92,10 @@ public class StationRouteController extends BaseController<StationRoute, Integer | ||
| 92 | * | 92 | * |
| 93 | * @param map <id:线路ID> | 93 | * @param map <id:线路ID> |
| 94 | * | 94 | * |
| 95 | - * @return Map<String, Object> <SUCCESS ; ERROR> | 95 | + * @return Map<String, Object> <SUCCESS ; ERROR ; NOTDATA> |
| 96 | */ | 96 | */ |
| 97 | @RequestMapping(value = "/usingSingle",method = RequestMethod.POST) | 97 | @RequestMapping(value = "/usingSingle",method = RequestMethod.POST) |
| 98 | public Map<String, Object> usingSingle(@RequestParam Map<String, Object> map) { | 98 | public Map<String, Object> usingSingle(@RequestParam Map<String, Object> map) { |
| 99 | - | ||
| 100 | return service.usingSingle(map); | 99 | return service.usingSingle(map); |
| 101 | } | 100 | } |
| 102 | 101 |
src/main/java/com/bsth/repository/SectionRouteRepository.java
| @@ -142,6 +142,13 @@ public interface SectionRouteRepository extends BaseRepository<SectionRoute, Int | @@ -142,6 +142,13 @@ public interface SectionRouteRepository extends BaseRepository<SectionRoute, Int | ||
| 142 | @Query(value = " select MAX(r.sectionroute_code) as sectionrouteCode from bsth_c_sectionroute r WHERE r.line=?1 and r.directions =?2 and r.sectionroute_code< ?3", nativeQuery=true) | 142 | @Query(value = " select MAX(r.sectionroute_code) as sectionrouteCode from bsth_c_sectionroute r WHERE r.line=?1 and r.directions =?2 and r.sectionroute_code< ?3", nativeQuery=true) |
| 143 | List<Object[]> findUpSectionRouteCode(Integer lineId,Integer direction,Integer stationRouteCode); | 143 | List<Object[]> findUpSectionRouteCode(Integer lineId,Integer direction,Integer stationRouteCode); |
| 144 | 144 | ||
| 145 | + /** | ||
| 146 | + * @Description :TODO(获取路段路由信息) | ||
| 147 | + * | ||
| 148 | + * @param lineId:线路ID;directions:方向 | ||
| 149 | + * | ||
| 150 | + * @return List<Map<String, Object>> {[0]:directions(方向);[1]:bsection_vector(路段坐标);[2]:speed_limit(限速);[3]:section_name(路段名称)} | ||
| 151 | + */ | ||
| 145 | @Query(value = "SELECT " + | 152 | @Query(value = "SELECT " + |
| 146 | "c.directions," + | 153 | "c.directions," + |
| 147 | "AsText(s.bsection_vector) as bsection_vector," + | 154 | "AsText(s.bsection_vector) as bsection_vector," + |
| @@ -149,5 +156,5 @@ public interface SectionRouteRepository extends BaseRepository<SectionRoute, Int | @@ -149,5 +156,5 @@ public interface SectionRouteRepository extends BaseRepository<SectionRoute, Int | ||
| 149 | "s.section_name " + | 156 | "s.section_name " + |
| 150 | " FROM bsth_c_sectionroute c " + | 157 | " FROM bsth_c_sectionroute c " + |
| 151 | " LEFT JOIN bsth_c_section s on c.section = s.id where c.line = ?1 and c.directions = ?2", nativeQuery=true) | 158 | " LEFT JOIN bsth_c_section s on c.section = s.id where c.line = ?1 and c.directions = ?2", nativeQuery=true) |
| 152 | -List<Object[]> sectionRouteVector(Integer lineId,Integer directions); | 159 | + List<Object[]> sectionRouteVector(Integer lineId,Integer directions); |
| 153 | } | 160 | } |
src/main/java/com/bsth/repository/StationRouteRepository.java
| @@ -126,7 +126,11 @@ public interface StationRouteRepository extends BaseRepository<StationRoute, Int | @@ -126,7 +126,11 @@ public interface StationRouteRepository extends BaseRepository<StationRoute, Int | ||
| 126 | * | 126 | * |
| 127 | * @param lineId:线路ID | 127 | * @param lineId:线路ID |
| 128 | * | 128 | * |
| 129 | - * @return List<Object[]> | 129 | + * @return List<Object[]>:{[0]:g_lonx(GPS经度);[1]:g_laty(GPS纬度);[2]:b_jwpoints(百度经纬度坐标) |
| 130 | + * | ||
| 131 | + * [3]:station_mark(站点类型);[4]:station_route_code(站点序号);[5]:station_cod(站点编码); | ||
| 132 | + * | ||
| 133 | + * [6]:distances(站点距离);[7]:station_name(站点名称);[8]:directions(方向)} | ||
| 130 | */ | 134 | */ |
| 131 | @Query(value = "SELECT * FROM ("+ | 135 | @Query(value = "SELECT * FROM ("+ |
| 132 | "SELECT b.g_lonx," + | 136 | "SELECT b.g_lonx," + |
src/main/java/com/bsth/service/StationRouteService.java
| @@ -65,7 +65,7 @@ public interface StationRouteService extends BaseService<StationRoute, Integer> | @@ -65,7 +65,7 @@ public interface StationRouteService extends BaseService<StationRoute, Integer> | ||
| 65 | * | 65 | * |
| 66 | * @param map <id:线路ID> | 66 | * @param map <id:线路ID> |
| 67 | * | 67 | * |
| 68 | - * @return Map<String, Object> <SUCCESS ; ERROR> | 68 | + * @return Map<String, Object> <SUCCESS ; ERROR ; NOTDATA> |
| 69 | */ | 69 | */ |
| 70 | Map<String, Object> usingSingle(Map<String, Object> map); | 70 | Map<String, Object> usingSingle(Map<String, Object> map); |
| 71 | 71 |
src/main/java/com/bsth/service/impl/StationRouteServiceImpl.java
| 1 | package com.bsth.service.impl; | 1 | package com.bsth.service.impl; |
| 2 | 2 | ||
| 3 | -import java.awt.Point; | ||
| 4 | import java.io.ByteArrayInputStream; | 3 | import java.io.ByteArrayInputStream; |
| 5 | import java.io.File; | 4 | import java.io.File; |
| 6 | import java.io.InputStream; | 5 | import java.io.InputStream; |
| 6 | +import java.text.DecimalFormat; | ||
| 7 | import java.util.ArrayList; | 7 | import java.util.ArrayList; |
| 8 | import java.util.HashMap; | 8 | import java.util.HashMap; |
| 9 | import java.util.List; | 9 | import java.util.List; |
| @@ -23,7 +23,7 @@ import com.bsth.repository.StationRepository; | @@ -23,7 +23,7 @@ import com.bsth.repository.StationRepository; | ||
| 23 | import com.bsth.repository.StationRouteRepository; | 23 | import com.bsth.repository.StationRouteRepository; |
| 24 | import com.bsth.service.StationRouteService; | 24 | import com.bsth.service.StationRouteService; |
| 25 | import com.bsth.util.FTPClientUtils; | 25 | import com.bsth.util.FTPClientUtils; |
| 26 | -import com.bsth.util.Test; | 26 | +import com.bsth.util.PackTarGZUtils; |
| 27 | import com.bsth.util.db.DBUtils_MS; | 27 | import com.bsth.util.db.DBUtils_MS; |
| 28 | 28 | ||
| 29 | /** | 29 | /** |
| @@ -505,11 +505,12 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | @@ -505,11 +505,12 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | ||
| 505 | * | 505 | * |
| 506 | * @param map <lineId:线路ID> | 506 | * @param map <lineId:线路ID> |
| 507 | * | 507 | * |
| 508 | - * @return Map<String, Object> <SUCCESS ; ERROR> | 508 | + * @return Map<String, Object> <SUCCESS ; ERROR ; NOTDATA> |
| 509 | */ | 509 | */ |
| 510 | @Override | 510 | @Override |
| 511 | public Map<String, Object> usingSingle(Map<String, Object> map) { | 511 | public Map<String, Object> usingSingle(Map<String, Object> map) { |
| 512 | 512 | ||
| 513 | + // 返回值map | ||
| 513 | Map<String, Object> resultMap = new HashMap<String,Object>(); | 514 | Map<String, Object> resultMap = new HashMap<String,Object>(); |
| 514 | 515 | ||
| 515 | try { | 516 | try { |
| @@ -517,65 +518,75 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | @@ -517,65 +518,75 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | ||
| 517 | // 获取线路ID | 518 | // 获取线路ID |
| 518 | Integer lineId = map.get("lineId").equals("") ? 0 : Integer.parseInt(map.get("lineId").toString()); | 519 | Integer lineId = map.get("lineId").equals("") ? 0 : Integer.parseInt(map.get("lineId").toString()); |
| 519 | 520 | ||
| 520 | - /** 查询线路信息 */ | 521 | + /** 查询线路信息 @param:<lineId:线路ID> */ |
| 521 | Line line = lineRepository.findOne(lineId); | 522 | Line line = lineRepository.findOne(lineId); |
| 522 | 523 | ||
| 524 | + /** 查询线路信息下的站点路由信息 @param:<lineId:线路ID> */ | ||
| 523 | List<Object[]> objects = repository.usingSingle(lineId); | 525 | List<Object[]> objects = repository.usingSingle(lineId); |
| 524 | 526 | ||
| 525 | if (objects.size()>0) { | 527 | if (objects.size()>0) { |
| 526 | 528 | ||
| 527 | - /** 获取配置文件里的ftp参数 */ | 529 | + /** 获取配置文件里的ftp登录参数 */ |
| 528 | Map<String, Object> FTPParamMap = readPropertiesGetFTPParam(); | 530 | Map<String, Object> FTPParamMap = readPropertiesGetFTPParam(); |
| 529 | 531 | ||
| 530 | // 压缩文件名 | 532 | // 压缩文件名 |
| 531 | String odlGzFileName = line.getLineCode() + ".txt.gz"; | 533 | String odlGzFileName = line.getLineCode() + ".txt.gz"; |
| 532 | 534 | ||
| 533 | - // text文件名 | 535 | + // txt文件名 |
| 534 | String textFileName = line.getLineCode() + ".txt"; | 536 | String textFileName = line.getLineCode() + ".txt"; |
| 535 | 537 | ||
| 538 | + // 创建一个ftp上传实例 | ||
| 536 | FTPClientUtils clientUtils = new FTPClientUtils(); | 539 | FTPClientUtils clientUtils = new FTPClientUtils(); |
| 537 | 540 | ||
| 541 | + // IP | ||
| 538 | String url = FTPParamMap.get("url").toString(); | 542 | String url = FTPParamMap.get("url").toString(); |
| 539 | 543 | ||
| 544 | + // 端口 | ||
| 540 | int port = Integer.valueOf(FTPParamMap.get("port").toString()); | 545 | int port = Integer.valueOf(FTPParamMap.get("port").toString()); |
| 541 | 546 | ||
| 547 | + // 用户名 | ||
| 542 | String username = FTPParamMap.get("username").toString(); | 548 | String username = FTPParamMap.get("username").toString(); |
| 543 | 549 | ||
| 550 | + // 密码 | ||
| 544 | String password = FTPParamMap.get("password").toString(); | 551 | String password = FTPParamMap.get("password").toString(); |
| 545 | 552 | ||
| 553 | + // 相对路径 | ||
| 546 | String remotePath = FTPParamMap.get("remotePath").toString(); | 554 | String remotePath = FTPParamMap.get("remotePath").toString(); |
| 547 | 555 | ||
| 548 | - /** 如果行单文件已存在则删除 */ | 556 | + /** 如果已存在相同行单文件名则先删除 */ |
| 549 | clientUtils.deleteFtpFile(url, port, username, password, remotePath, odlGzFileName); | 557 | clientUtils.deleteFtpFile(url, port, username, password, remotePath, odlGzFileName); |
| 550 | 558 | ||
| 551 | clientUtils.deleteFtpFile(url, port, username, password, remotePath, textFileName); | 559 | clientUtils.deleteFtpFile(url, port, username, password, remotePath, textFileName); |
| 552 | 560 | ||
| 561 | + /** 行单文件内容 @param:<objects:站点路由;lineId:线路ID>*/ | ||
| 553 | String textStr = newTextFileToFTP(objects,lineId); | 562 | String textStr = newTextFileToFTP(objects,lineId); |
| 554 | 563 | ||
| 555 | - /*textStr = line.getName() + "\t" + "2" + "\r\n" + textStr;*/ | 564 | + /*textStr = line.getName() + "\t" + "2" + "\r" + textStr;*/ |
| 556 | 565 | ||
| 557 | - textStr = line.getName() + "\t" + "2" + "\r" + textStr; | 566 | + textStr = line.getName() + " " + "2" + "\r" + textStr; |
| 558 | 567 | ||
| 559 | InputStream input = new ByteArrayInputStream(textStr.getBytes("gbk")); | 568 | InputStream input = new ByteArrayInputStream(textStr.getBytes("gbk")); |
| 560 | 569 | ||
| 561 | - /** 生成text文件 */ | 570 | + /** 生成txt文件,上传ftp */ |
| 562 | clientUtils.uploadFile(url, port, username, password, remotePath, textFileName, input); | 571 | clientUtils.uploadFile(url, port, username, password, remotePath, textFileName, input); |
| 563 | 572 | ||
| 564 | - Test test= new Test(); | ||
| 565 | - | 573 | + // 创建打包实例 |
| 574 | + PackTarGZUtils packTarGZUtils= new PackTarGZUtils(); | ||
| 566 | 575 | ||
| 576 | + /** 获取txt文件 */ | ||
| 567 | File textFile = clientUtils.GetFtpFile(url, port, username, password, remotePath, textFileName); | 577 | File textFile = clientUtils.GetFtpFile(url, port, username, password, remotePath, textFileName); |
| 568 | 578 | ||
| 569 | /*File[] sources = new File[] {textFile};*/ | 579 | /*File[] sources = new File[] {textFile};*/ |
| 570 | File[] sources = new File[] {textFile}; | 580 | File[] sources = new File[] {textFile}; |
| 571 | 581 | ||
| 572 | File target = new File(odlGzFileName); | 582 | File target = new File(odlGzFileName); |
| 573 | - | ||
| 574 | - File targetFile = test.pack(sources, target); | 583 | + |
| 584 | + // 将txt文件打包 | ||
| 585 | + File targetFile = packTarGZUtils.pack(sources, target); | ||
| 575 | 586 | ||
| 576 | /*clientUtils.testUpLoadFromDisk(targetFile,targetFile.getName());*/ | 587 | /*clientUtils.testUpLoadFromDisk(targetFile,targetFile.getName());*/ |
| 577 | 588 | ||
| 578 | - clientUtils.testUpLoadFromDisk(targetFile, targetFile.getName(), url, port, username, password, remotePath); | 589 | + clientUtils.FTPUpLoadFromDisk(targetFile, targetFile.getName(), url, port, username, password, remotePath); |
| 579 | 590 | ||
| 580 | resultMap.put("status", ResponseCode.SUCCESS); | 591 | resultMap.put("status", ResponseCode.SUCCESS); |
| 581 | 592 | ||
| @@ -595,15 +606,31 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | @@ -595,15 +606,31 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | ||
| 595 | return resultMap; | 606 | return resultMap; |
| 596 | } | 607 | } |
| 597 | 608 | ||
| 609 | + /** | ||
| 610 | + * @Description : TODO(形成行单文件内容) | ||
| 611 | + * | ||
| 612 | + * @param objects :站点路由信息 | ||
| 613 | + * | ||
| 614 | + * {[0]:g_lonx(GPS经度);[1]:g_laty(GPS纬度);[2]:b_jwpoints(百度经纬度坐标) | ||
| 615 | + * | ||
| 616 | + * [3]:station_mark(站点类型);[4]:station_route_code(站点序号);[5]:station_cod(站点编码); | ||
| 617 | + * | ||
| 618 | + * [6]:distances(站点距离);[7]:station_name(站点名称);[8]:directions(方向)} | ||
| 619 | + * | ||
| 620 | + * @param lineId :线路ID | ||
| 621 | + * | ||
| 622 | + * @return String | ||
| 623 | + */ | ||
| 598 | public String newTextFileToFTP(List<Object[]> objects,Integer lineId) { | 624 | public String newTextFileToFTP(List<Object[]> objects,Integer lineId) { |
| 599 | 625 | ||
| 626 | + // 返回值String | ||
| 600 | String stationRStr = ""; | 627 | String stationRStr = ""; |
| 601 | 628 | ||
| 602 | // windows下的文本文件换行符 | 629 | // windows下的文本文件换行符 |
| 603 | //String enterStr = "\r\n"; | 630 | //String enterStr = "\r\n"; |
| 604 | 631 | ||
| 605 | // linux/unix下的文本文件换行符 | 632 | // linux/unix下的文本文件换行符 |
| 606 | - String enterStr = "\r"; | 633 | + String enterStr = "\r"; |
| 607 | 634 | ||
| 608 | if(objects.size()>0) { | 635 | if(objects.size()>0) { |
| 609 | 636 | ||
| @@ -618,15 +645,17 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | @@ -618,15 +645,17 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | ||
| 618 | lat = "\t" + lat; | 645 | lat = "\t" + lat; |
| 619 | 646 | ||
| 620 | // 站点类型 | 647 | // 站点类型 |
| 621 | - String stationMake = objects.get(i)[3].equals("") ? "" : objects.get(i)[3].toString(); | 648 | + String stationMakeStr = objects.get(i)[3].equals("") ? "" : objects.get(i)[3].toString(); |
| 622 | 649 | ||
| 623 | - if(stationMake.equals("E")) { | 650 | + String stationMake = ""; |
| 651 | + | ||
| 652 | + if(stationMakeStr.equals("E")) { | ||
| 624 | 653 | ||
| 625 | - stationMake = "\t" + "2"; | 654 | + stationMake = "\t2"; |
| 626 | 655 | ||
| 627 | }else { | 656 | }else { |
| 628 | 657 | ||
| 629 | - stationMake ="\t" + "1"; | 658 | + stationMake ="\t1"; |
| 630 | 659 | ||
| 631 | } | 660 | } |
| 632 | 661 | ||
| @@ -640,30 +669,35 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | @@ -640,30 +669,35 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | ||
| 640 | 669 | ||
| 641 | stationCode = "\t" +stationCode; | 670 | stationCode = "\t" +stationCode; |
| 642 | 671 | ||
| 643 | - double dis = objects.get(i)[6]==null ? 0.0 : Double.parseDouble(objects.get(i)[6].toString()); | 672 | + double dis = objects.get(i)[6]==null ? 0.0 : Double.parseDouble(objects.get(i)[6].toString())*1000; |
| 644 | 673 | ||
| 645 | - double tempd = dis*1000; | 674 | + String tempDistc = String.valueOf((int) dis); |
| 646 | 675 | ||
| 647 | // 站点距离 | 676 | // 站点距离 |
| 648 | - String staitondistance = "\t" + String.valueOf((int) tempd); | 677 | + String staitondistance = "\t" + tempDistc; |
| 649 | 678 | ||
| 650 | // 站点名称 | 679 | // 站点名称 |
| 651 | String stationName = objects.get(i)[7].equals("") ? "" : objects.get(i)[7].toString(); | 680 | String stationName = objects.get(i)[7].equals("") ? "" : objects.get(i)[7].toString(); |
| 652 | 681 | ||
| 682 | + stationName = "\t" +stationName; | ||
| 683 | + | ||
| 653 | // 限速 | 684 | // 限速 |
| 654 | // String sleepStr = " " + "60"; | 685 | // String sleepStr = " " + "60"; |
| 655 | 686 | ||
| 687 | + // 限速 | ||
| 656 | String sleepStr = ""; | 688 | String sleepStr = ""; |
| 657 | 689 | ||
| 690 | + // 方向 | ||
| 658 | int directions = objects.get(i)[8]==null ? null : Integer.valueOf(objects.get(i)[8].toString()); | 691 | int directions = objects.get(i)[8]==null ? null : Integer.valueOf(objects.get(i)[8].toString()); |
| 659 | 692 | ||
| 693 | + /** 获取路段路由信息 @pararm:<lineId:线路ID;directions:方向> */ | ||
| 660 | List<Object[]> sobje = routeRepository.sectionRouteVector(lineId,directions); | 694 | List<Object[]> sobje = routeRepository.sectionRouteVector(lineId,directions); |
| 661 | 695 | ||
| 662 | if(sobje.size()==1) { | 696 | if(sobje.size()==1) { |
| 663 | 697 | ||
| 664 | - sleepStr = sobje.get(0)[2] == null ? "" : sobje.get(0)[2].toString(); | 698 | + double dsleepStr = sobje.get(0)[2] == null ? 60d : Double.valueOf(sobje.get(0)[2].toString()); |
| 665 | 699 | ||
| 666 | - sleepStr = "\t" + sleepStr; | 700 | + sleepStr = "\t" + new DecimalFormat("0").format(dsleepStr); |
| 667 | 701 | ||
| 668 | }else if(sobje.size()>1){ | 702 | }else if(sobje.size()>1){ |
| 669 | 703 | ||
| @@ -676,9 +710,11 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | @@ -676,9 +710,11 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | ||
| 676 | 710 | ||
| 677 | if(stationName.equals(sectionNameA[0])){ | 711 | if(stationName.equals(sectionNameA[0])){ |
| 678 | 712 | ||
| 679 | - sleepStr = sobje.get(j)[2].toString(); | 713 | + /*sleepStr = sobje.get(j)[2].toString();*/ |
| 714 | + | ||
| 715 | + double dsleepStrt = sobje.get(0)[2] == null ? 60d : Double.valueOf(sobje.get(j)[2].toString()); | ||
| 680 | 716 | ||
| 681 | - sleepStr = "\t" + sleepStr; | 717 | + sleepStr = "\t" + new DecimalFormat("0").format(dsleepStrt); |
| 682 | 718 | ||
| 683 | } | 719 | } |
| 684 | 720 | ||
| @@ -700,12 +736,6 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | @@ -700,12 +736,6 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | ||
| 700 | sleepStr = sleepStr + GetFormPointOnPolylineSeleepLimit(pointsM,sobje);*/ | 736 | sleepStr = sleepStr + GetFormPointOnPolylineSeleepLimit(pointsM,sobje);*/ |
| 701 | } | 737 | } |
| 702 | 738 | ||
| 703 | - if(sleepStr.equals("")) | ||
| 704 | - sleepStr = "\t" + "60"; | ||
| 705 | - | ||
| 706 | - | ||
| 707 | - stationName = "\t" +stationName; | ||
| 708 | - | ||
| 709 | stationRStr = stationRStr + lng + lat + stationMake + stationNo + stationCode + staitondistance + sleepStr + stationName + enterStr; | 739 | stationRStr = stationRStr + lng + lat + stationMake + stationNo + stationCode + staitondistance + sleepStr + stationName + enterStr; |
| 710 | 740 | ||
| 711 | } | 741 | } |
| @@ -800,8 +830,14 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | @@ -800,8 +830,14 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | ||
| 800 | return success; | 830 | return success; |
| 801 | } | 831 | } |
| 802 | 832 | ||
| 833 | + /** | ||
| 834 | + * @Description:TOOD(获取FTP登录参数) 这里暂时只做一个map值返回,以后可以作为ftp登录类提出来 | ||
| 835 | + * | ||
| 836 | + * @return : Map<String, Object> <url:IP;port:端口;username:用户名;password:密码;remotePath:相对路径> | ||
| 837 | + */ | ||
| 803 | public Map<String, Object> readPropertiesGetFTPParam(){ | 838 | public Map<String, Object> readPropertiesGetFTPParam(){ |
| 804 | 839 | ||
| 840 | + // 返回值map | ||
| 805 | Map<String, Object> resultMap = new HashMap<String, Object>(); | 841 | Map<String, Object> resultMap = new HashMap<String, Object>(); |
| 806 | 842 | ||
| 807 | Properties env = new Properties(); | 843 | Properties env = new Properties(); |
src/main/java/com/bsth/util/FTPClientUtils.java
| 1 | package com.bsth.util; | 1 | package com.bsth.util; |
| 2 | 2 | ||
| 3 | -import java.io.BufferedReader; | ||
| 4 | import java.io.ByteArrayInputStream; | 3 | import java.io.ByteArrayInputStream; |
| 5 | import java.io.File; | 4 | import java.io.File; |
| 6 | import java.io.FileInputStream; | 5 | import java.io.FileInputStream; |
| @@ -8,7 +7,6 @@ import java.io.FileNotFoundException; | @@ -8,7 +7,6 @@ import java.io.FileNotFoundException; | ||
| 8 | import java.io.FileOutputStream; | 7 | import java.io.FileOutputStream; |
| 9 | import java.io.IOException; | 8 | import java.io.IOException; |
| 10 | import java.io.InputStream; | 9 | import java.io.InputStream; |
| 11 | -import java.io.InputStreamReader; | ||
| 12 | import java.io.OutputStream; | 10 | import java.io.OutputStream; |
| 13 | import java.io.UnsupportedEncodingException; | 11 | import java.io.UnsupportedEncodingException; |
| 14 | 12 | ||
| @@ -103,8 +101,25 @@ public class FTPClientUtils { | @@ -103,8 +101,25 @@ public class FTPClientUtils { | ||
| 103 | return success; | 101 | return success; |
| 104 | } | 102 | } |
| 105 | 103 | ||
| 106 | - // 将本地文件上传到FTP服务器上 | ||
| 107 | - public void testUpLoadFromDisk(File file,String name,String url, int port, String username, String password, String remotePath){ | 104 | + /** |
| 105 | + * @Description : TOOD(将本地文件上传到FTP服务器上) | ||
| 106 | + * | ||
| 107 | + * @param file | ||
| 108 | + * | ||
| 109 | + * @param name | ||
| 110 | + * | ||
| 111 | + * @param url | ||
| 112 | + * | ||
| 113 | + * @param port | ||
| 114 | + * | ||
| 115 | + * @param username | ||
| 116 | + * | ||
| 117 | + * @param password | ||
| 118 | + * | ||
| 119 | + * @param remotePath | ||
| 120 | + * | ||
| 121 | + */ | ||
| 122 | + public void FTPUpLoadFromDisk(File file,String name,String url, int port, String username, String password, String remotePath){ | ||
| 108 | 123 | ||
| 109 | try { | 124 | try { |
| 110 | FileInputStream in=new FileInputStream(file); | 125 | FileInputStream in=new FileInputStream(file); |
| @@ -143,16 +158,21 @@ public class FTPClientUtils { | @@ -143,16 +158,21 @@ public class FTPClientUtils { | ||
| 143 | } | 158 | } |
| 144 | 159 | ||
| 145 | /** | 160 | /** |
| 146 | - * <删除FTP上的文件> | ||
| 147 | - * <远程删除FTP服务器上的录音文件> | 161 | + * @Description (删除FTP上的文件) |
| 162 | + * | ||
| 148 | * @param url FTP服务器IP地址 | 163 | * @param url FTP服务器IP地址 |
| 164 | + * | ||
| 149 | * @param port FTP服务器端口 | 165 | * @param port FTP服务器端口 |
| 166 | + * | ||
| 150 | * @param username FTP服务器登录名 | 167 | * @param username FTP服务器登录名 |
| 168 | + * | ||
| 151 | * @param password FTP服务器密码 | 169 | * @param password FTP服务器密码 |
| 170 | + * | ||
| 152 | * @param remotePath 远程文件路径 | 171 | * @param remotePath 远程文件路径 |
| 172 | + * | ||
| 153 | * @param fileName 待删除的文件名 | 173 | * @param fileName 待删除的文件名 |
| 154 | - * @return | ||
| 155 | - * @see [类、类#方法、类#成员] | 174 | + * |
| 175 | + * @return boolean | ||
| 156 | */ | 176 | */ |
| 157 | public static boolean deleteFtpFile(String url, int port, String username, String password, String remotePath, String fileName){ | 177 | public static boolean deleteFtpFile(String url, int port, String username, String password, String remotePath, String fileName){ |
| 158 | 178 |
src/main/resources/static/pages/base/line/js/line-add-form.js
| @@ -49,6 +49,8 @@ $(function(){ | @@ -49,6 +49,8 @@ $(function(){ | ||
| 49 | // 填充公司下拉框选择值 | 49 | // 填充公司下拉框选择值 |
| 50 | $get('/business/all', {upCode_eq: '77'}, function(array){ | 50 | $get('/business/all', {upCode_eq: '77'}, function(array){ |
| 51 | 51 | ||
| 52 | + console.log(array); | ||
| 53 | + | ||
| 52 | // 公司下拉options属性值 | 54 | // 公司下拉options属性值 |
| 53 | var options = '<option value="">-- 请选择公司 --</option>'; | 55 | var options = '<option value="">-- 请选择公司 --</option>'; |
| 54 | 56 |
src/main/resources/static/pages/base/line/js/line-edit-form.js
| @@ -12,7 +12,7 @@ | @@ -12,7 +12,7 @@ | ||
| 12 | // 初始化公司下拉框 | 12 | // 初始化公司下拉框 |
| 13 | selectTemp(function(){ | 13 | selectTemp(function(){ |
| 14 | 14 | ||
| 15 | - // 根据ID查询详细信息 | 15 | + /** 根据ID查询详细信息 */ |
| 16 | $get('/line/' + lineId ,null, function(result){ | 16 | $get('/line/' + lineId ,null, function(result){ |
| 17 | 17 | ||
| 18 | // 如果不为空 | 18 | // 如果不为空 |
| @@ -24,7 +24,7 @@ | @@ -24,7 +24,7 @@ | ||
| 24 | // 设置日期 | 24 | // 设置日期 |
| 25 | result.openDate = moment(result.openDate).format(fs); | 25 | result.openDate = moment(result.openDate).format(fs); |
| 26 | 26 | ||
| 27 | - // 填充修改线路表单元素值 | 27 | + /** 填充修改线路表单元素值 @param:<result:数据结果集;line_edit_form:表单元素> */ |
| 28 | putFormData(result, '#line_edit_form'); | 28 | putFormData(result, '#line_edit_form'); |
| 29 | 29 | ||
| 30 | // 设置公司值 | 30 | // 设置公司值 |
| @@ -60,7 +60,7 @@ | @@ -60,7 +60,7 @@ | ||
| 60 | // 输入线路名称,自动生成英文名称和线路简称 | 60 | // 输入线路名称,自动生成英文名称和线路简称 |
| 61 | $('#nameInput').on('keyup', setPinYin); | 61 | $('#nameInput').on('keyup', setPinYin); |
| 62 | 62 | ||
| 63 | - // 根据线路名称值设置英文名称值和线路简称 | 63 | + /** 根据线路名称值设置英文名称值和线路简称 */ |
| 64 | function setPinYin(){ | 64 | function setPinYin(){ |
| 65 | 65 | ||
| 66 | // 获取线路名称值 | 66 | // 获取线路名称值 |
| @@ -74,7 +74,7 @@ | @@ -74,7 +74,7 @@ | ||
| 74 | } | 74 | } |
| 75 | 75 | ||
| 76 | 76 | ||
| 77 | - // 公司下拉框 | 77 | + /** 公司下拉框 @param:<callback:回调函数> */ |
| 78 | function selectTemp(callback) { | 78 | function selectTemp(callback) { |
| 79 | 79 | ||
| 80 | // 填充公司下拉框选择值 | 80 | // 填充公司下拉框选择值 |
| @@ -453,7 +453,7 @@ | @@ -453,7 +453,7 @@ | ||
| 453 | } | 453 | } |
| 454 | }); | 454 | }); |
| 455 | 455 | ||
| 456 | - // 联系电话(手机/电话皆可)验证 | 456 | + /** 联系电话(手机/电话皆可)验证 */ |
| 457 | $.validator.addMethod("isPhone", function(value,element) { | 457 | $.validator.addMethod("isPhone", function(value,element) { |
| 458 | 458 | ||
| 459 | // 长度 | 459 | // 长度 |
src/main/resources/static/pages/base/line/js/line-list-table.js
| 1 | /** | 1 | /** |
| 2 | * | 2 | * |
| 3 | - * @JSName : list.js(线路信息list.html页面js) | 3 | + * @JSName : line-list-table.js(线路信息list.html页面js) |
| 4 | * | 4 | * |
| 5 | * @Author : bsth@lq | 5 | * @Author : bsth@lq |
| 6 | * | 6 | * |
| @@ -27,14 +27,16 @@ | @@ -27,14 +27,16 @@ | ||
| 27 | 27 | ||
| 28 | }); | 28 | }); |
| 29 | 29 | ||
| 30 | - // 填充公司下拉框options,并添加公司下拉框值改变事件setbrancheCompanySelectOptions | 30 | + // 填充公司下拉框options |
| 31 | $('#companySelect').html(options) | 31 | $('#companySelect').html(options) |
| 32 | + | ||
| 33 | + /** 闵行没下属公司,这里暂时注释公司值改变事件 */ | ||
| 32 | //$('#companySelect').html(options).on('change', setbrancheCompanySelectOptions); | 34 | //$('#companySelect').html(options).on('change', setbrancheCompanySelectOptions); |
| 33 | 35 | ||
| 34 | }); | 36 | }); |
| 35 | 37 | ||
| 36 | - /** 填充分公司下拉框 */ | ||
| 37 | - setbrancheCompanySelectOptions(); | 38 | + /** 填充分公司下拉框。--- 闵行没下属公司,这里暂时注释*/ |
| 39 | + /* setbrancheCompanySelectOptions();*/ | ||
| 38 | 40 | ||
| 39 | /** 填充分公司下拉框选择值 */ | 41 | /** 填充分公司下拉框选择值 */ |
| 40 | function setbrancheCompanySelectOptions(){ | 42 | function setbrancheCompanySelectOptions(){ |
| @@ -53,7 +55,7 @@ | @@ -53,7 +55,7 @@ | ||
| 53 | 55 | ||
| 54 | } else { | 56 | } else { |
| 55 | 57 | ||
| 56 | - // 查询出所属公司下的分公司名称和相应分公司代码 | 58 | + /** 查询出所属公司下的分公司名称和相应分公司代码 @param:<upCode_eq:公司代码> */ |
| 57 | $get('/business/all', {upCode_eq: businessCode}, function(array){ | 59 | $get('/business/all', {upCode_eq: businessCode}, function(array){ |
| 58 | 60 | ||
| 59 | // 遍历array | 61 | // 遍历array |
| @@ -75,7 +77,7 @@ | @@ -75,7 +77,7 @@ | ||
| 75 | // 选择框 | 77 | // 选择框 |
| 76 | var icheckOptions = {checkboxClass: 'icheckbox_flat-blue',increaseArea: '20%'}; | 78 | var icheckOptions = {checkboxClass: 'icheckbox_flat-blue',increaseArea: '20%'}; |
| 77 | 79 | ||
| 78 | - // 表格数据分页加载 | 80 | + /** 表格数据分页加载 @param:<null:搜索参数;true:是否重新分页> */ |
| 79 | loadTableDate(null,true); | 81 | loadTableDate(null,true); |
| 80 | 82 | ||
| 81 | /** 重置按钮事件 */ | 83 | /** 重置按钮事件 */ |
| @@ -84,7 +86,7 @@ | @@ -84,7 +86,7 @@ | ||
| 84 | // 清空搜索框值 | 86 | // 清空搜索框值 |
| 85 | $('tr.filter input,select').val('').change(); | 87 | $('tr.filter input,select').val('').change(); |
| 86 | 88 | ||
| 87 | - // 重新加载表格数据 | 89 | + /** 表格数据分页加载 @param:<null:搜索参数;true:是否重新分页> */ |
| 88 | loadTableDate(null,true); | 90 | loadTableDate(null,true); |
| 89 | }); | 91 | }); |
| 90 | 92 | ||
| @@ -120,8 +122,10 @@ | @@ -120,8 +122,10 @@ | ||
| 120 | } | 122 | } |
| 121 | } | 123 | } |
| 122 | }); | 124 | }); |
| 125 | + | ||
| 123 | page = 0; | 126 | page = 0; |
| 124 | 127 | ||
| 128 | + /** 表格数据分页加载 @param:<params:搜索参数;true:是否重新分页> */ | ||
| 125 | loadTableDate(params,true); | 129 | loadTableDate(params,true); |
| 126 | }); | 130 | }); |
| 127 | 131 | ||
| @@ -149,8 +153,6 @@ | @@ -149,8 +153,6 @@ | ||
| 149 | // 异步请求获取表格数据 | 153 | // 异步请求获取表格数据 |
| 150 | $.get('/line',params,function(result){ | 154 | $.get('/line',params,function(result){ |
| 151 | 155 | ||
| 152 | - console.log(result); | ||
| 153 | - | ||
| 154 | // 添加序号 | 156 | // 添加序号 |
| 155 | result.content.page = page; | 157 | result.content.page = page; |
| 156 | 158 | ||
| @@ -244,7 +246,7 @@ | @@ -244,7 +246,7 @@ | ||
| 244 | }); | 246 | }); |
| 245 | } | 247 | } |
| 246 | 248 | ||
| 247 | - // 生成行单 | 249 | + /** 生成行单,这里暂时只做了单选生成。 */ |
| 248 | $('#datatable_ajax_tools #createUsingSingle').on('click', function() { | 250 | $('#datatable_ajax_tools #createUsingSingle').on('click', function() { |
| 249 | 251 | ||
| 250 | // 获取选中行 | 252 | // 获取选中行 |
| @@ -275,11 +277,13 @@ | @@ -275,11 +277,13 @@ | ||
| 275 | 277 | ||
| 276 | lineName = arrChk.val(); | 278 | lineName = arrChk.val(); |
| 277 | 279 | ||
| 280 | + // 请求参数 | ||
| 278 | var params = {lineId:id}; | 281 | var params = {lineId:id}; |
| 279 | 282 | ||
| 280 | // 弹出正在加载层 | 283 | // 弹出正在加载层 |
| 281 | var index = layer.load(0); | 284 | var index = layer.load(0); |
| 282 | 285 | ||
| 286 | + /** 生成线路行单 @pararm:<params:请求参数> */ | ||
| 283 | $post('/stationroute/usingSingle',params,function(data) { | 287 | $post('/stationroute/usingSingle',params,function(data) { |
| 284 | 288 | ||
| 285 | // 关闭弹出框 | 289 | // 关闭弹出框 |
src/main/resources/static/pages/base/line/list.html
| @@ -53,6 +53,7 @@ | @@ -53,6 +53,7 @@ | ||
| 53 | <th width="7%">线路编码</th> | 53 | <th width="7%">线路编码</th> |
| 54 | <th width="8%">线路名称</th> | 54 | <th width="8%">线路名称</th> |
| 55 | <th width="7%">所属公司</th> | 55 | <th width="7%">所属公司</th> |
| 56 | + <!-- 闵行没有下属公司,这里暂时注释掉 --> | ||
| 56 | <!-- <th width="8%">所属分公司</th> --> | 57 | <!-- <th width="8%">所属分公司</th> --> |
| 57 | <th width="6%">线路性质</th> | 58 | <th width="6%">线路性质</th> |
| 58 | <th width="6%">线路等级</th> | 59 | <th width="6%">线路等级</th> |
| @@ -72,12 +73,15 @@ | @@ -72,12 +73,15 @@ | ||
| 72 | <input type="text" class="form-control form-filter input-sm" name="name_like"> | 73 | <input type="text" class="form-control form-filter input-sm" name="name_like"> |
| 73 | </td> | 74 | </td> |
| 74 | <td> | 75 | <td> |
| 76 | + <!-- 公司这里没使用字典表,暂时查的公司表 --> | ||
| 75 | <select name="company_eq" class="form-control" id="companySelect"></select> | 77 | <select name="company_eq" class="form-control" id="companySelect"></select> |
| 76 | </td> | 78 | </td> |
| 79 | + <!-- 闵行没有下属公司,这里暂时注释掉 --> | ||
| 77 | <!-- <td> | 80 | <!-- <td> |
| 78 | <select name="brancheCompany_eq" class="form-control" id="brancheCompanySelect"></select> | 81 | <select name="brancheCompany_eq" class="form-control" id="brancheCompanySelect"></select> |
| 79 | </td> --> | 82 | </td> --> |
| 80 | <td> | 83 | <td> |
| 84 | + <!-- 这里没使用字典表,暂时写在页面上 --> | ||
| 81 | <select name="nature_like" class="form-control" id="natureSelect"> | 85 | <select name="nature_like" class="form-control" id="natureSelect"> |
| 82 | <option value="">请选择...</option> | 86 | <option value="">请选择...</option> |
| 83 | <option value="lj">路救</option> | 87 | <option value="lj">路救</option> |
| @@ -93,6 +97,7 @@ | @@ -93,6 +97,7 @@ | ||
| 93 | </select> | 97 | </select> |
| 94 | </td> | 98 | </td> |
| 95 | <td> | 99 | <td> |
| 100 | + <!-- 这里没使用字典表,暂时写在页面上 --> | ||
| 96 | <select name="level_eq" class="form-control" id="levelSelect"> | 101 | <select name="level_eq" class="form-control" id="levelSelect"> |
| 97 | <option value="">请选择...</option> | 102 | <option value="">请选择...</option> |
| 98 | <option value="1">一级线路</option> | 103 | <option value="1">一级线路</option> |
| @@ -104,6 +109,7 @@ | @@ -104,6 +109,7 @@ | ||
| 104 | <input type="text" class="form-control form-filter input-sm" name="shanghaiLinecode_eq"> | 109 | <input type="text" class="form-control form-filter input-sm" name="shanghaiLinecode_eq"> |
| 105 | </td> | 110 | </td> |
| 106 | <td> | 111 | <td> |
| 112 | + <!-- 这里没使用字典表,暂时写在页面上 --> | ||
| 107 | <select class="form-control form-filter " name="destroy_eq"> | 113 | <select class="form-control form-filter " name="destroy_eq"> |
| 108 | <option value="">请选择...</option> | 114 | <option value="">请选择...</option> |
| 109 | <option value="0">运营</option> | 115 | <option value="0">运营</option> |
| @@ -225,7 +231,6 @@ | @@ -225,7 +231,6 @@ | ||
| 225 | 闵行公司 | 231 | 闵行公司 |
| 226 | {{/if}} | 232 | {{/if}} |
| 227 | </td> | 233 | </td> |
| 228 | - | ||
| 229 | <td> | 234 | <td> |
| 230 | {{if obj.nature == 'lj'}} | 235 | {{if obj.nature == 'lj'}} |
| 231 | 路救 | 236 | 路救 |