Commit 7b70144aea16bd3e0ff589b057a271b15c0959c1
1 parent
2ea9f571
bsthlq <2519941818@qq.com>线路文件生成BUG修改
Showing
8 changed files
with
119 additions
and
81 deletions
src/main/java/com/bsth/repository/SectionRouteRepository.java
| @@ -163,7 +163,7 @@ public interface SectionRouteRepository extends BaseRepository<SectionRoute, Int | @@ -163,7 +163,7 @@ public interface SectionRouteRepository extends BaseRepository<SectionRoute, Int | ||
| 163 | "s.speed_limit," + | 163 | "s.speed_limit," + |
| 164 | "s.section_name " + | 164 | "s.section_name " + |
| 165 | " FROM bsth_c_sectionroute c " + | 165 | " FROM bsth_c_sectionroute c " + |
| 166 | - " LEFT JOIN bsth_c_section s on c.section = s.id where c.line = ?1 and c.directions = ?2", nativeQuery=true) | 166 | + " LEFT JOIN bsth_c_section s on c.section = s.id where c.line = ?1 and c.directions = ?2 and c.destroy = 0", nativeQuery=true) |
| 167 | List<Object[]> sectionRouteVector(Integer lineId,Integer directions); | 167 | List<Object[]> sectionRouteVector(Integer lineId,Integer directions); |
| 168 | 168 | ||
| 169 | @Transactional | 169 | @Transactional |
src/main/java/com/bsth/repository/StationRouteRepository.java
| @@ -153,7 +153,7 @@ public interface StationRouteRepository extends BaseRepository<StationRoute, Int | @@ -153,7 +153,7 @@ public interface StationRouteRepository extends BaseRepository<StationRoute, Int | ||
| 153 | "s.station_route_code," + | 153 | "s.station_route_code," + |
| 154 | "s.directions," + | 154 | "s.directions," + |
| 155 | "s.distances,"+ | 155 | "s.distances,"+ |
| 156 | - "s.station FROM bsth_c_stationroute s where s.line = ?1) a " + | 156 | + "s.station FROM bsth_c_stationroute s where s.line = ?1 and s.destroy=0) a " + |
| 157 | "LEFT JOIN bsth_c_station b " + | 157 | "LEFT JOIN bsth_c_station b " + |
| 158 | " on a.station = b.id ORDER BY a.directions ASC ) k ORDER BY k.directions,k.station_route_code ASC", nativeQuery=true) | 158 | " on a.station = b.id ORDER BY a.directions ASC ) k ORDER BY k.directions,k.station_route_code ASC", nativeQuery=true) |
| 159 | List<Object[]> usingSingle(Integer lineId); | 159 | List<Object[]> usingSingle(Integer lineId); |
src/main/java/com/bsth/service/impl/StationRouteServiceImpl.java
| @@ -24,6 +24,7 @@ import org.springframework.transaction.annotation.Transactional; | @@ -24,6 +24,7 @@ import org.springframework.transaction.annotation.Transactional; | ||
| 24 | 24 | ||
| 25 | import java.io.ByteArrayInputStream; | 25 | import java.io.ByteArrayInputStream; |
| 26 | import java.io.File; | 26 | import java.io.File; |
| 27 | +import java.io.FileOutputStream; | ||
| 27 | import java.io.InputStream; | 28 | import java.io.InputStream; |
| 28 | import java.text.DecimalFormat; | 29 | import java.text.DecimalFormat; |
| 29 | import java.util.*; | 30 | import java.util.*; |
| @@ -511,57 +512,38 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | @@ -511,57 +512,38 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | ||
| 511 | */ | 512 | */ |
| 512 | @Override | 513 | @Override |
| 513 | public Map<String, Object> usingSingle(Map<String, Object> map) { | 514 | public Map<String, Object> usingSingle(Map<String, Object> map) { |
| 514 | - | ||
| 515 | // 返回值map | 515 | // 返回值map |
| 516 | Map<String, Object> resultMap = new HashMap<String,Object>(); | 516 | Map<String, Object> resultMap = new HashMap<String,Object>(); |
| 517 | - | ||
| 518 | try { | 517 | try { |
| 519 | - | ||
| 520 | // 获取线路ID | 518 | // 获取线路ID |
| 521 | 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()); |
| 522 | - | ||
| 523 | /** 查询线路信息 @param:<lineId:线路ID> */ | 520 | /** 查询线路信息 @param:<lineId:线路ID> */ |
| 524 | Line line = lineRepository.findOne(lineId); | 521 | Line line = lineRepository.findOne(lineId); |
| 525 | - | ||
| 526 | /** 查询线路信息下的站点路由信息 @param:<lineId:线路ID> */ | 522 | /** 查询线路信息下的站点路由信息 @param:<lineId:线路ID> */ |
| 527 | List<Object[]> objects = repository.usingSingle(lineId); | 523 | List<Object[]> objects = repository.usingSingle(lineId); |
| 528 | - | ||
| 529 | if (objects.size()>0) { | 524 | if (objects.size()>0) { |
| 530 | - | ||
| 531 | /** 获取配置文件里的ftp登录参数 */ | 525 | /** 获取配置文件里的ftp登录参数 */ |
| 532 | Map<String, Object> FTPParamMap = readPropertiesGetFTPParam(); | 526 | Map<String, Object> FTPParamMap = readPropertiesGetFTPParam(); |
| 533 | - | ||
| 534 | // 压缩文件名 | 527 | // 压缩文件名 |
| 535 | String odlGzFileName = line.getLineCode() + ".txt.gz"; | 528 | String odlGzFileName = line.getLineCode() + ".txt.gz"; |
| 536 | - | ||
| 537 | // txt文件名 | 529 | // txt文件名 |
| 538 | String textFileName = line.getLineCode() + ".txt"; | 530 | String textFileName = line.getLineCode() + ".txt"; |
| 539 | - | ||
| 540 | // 创建一个ftp上传实例 | 531 | // 创建一个ftp上传实例 |
| 541 | FTPClientUtils clientUtils = new FTPClientUtils(); | 532 | FTPClientUtils clientUtils = new FTPClientUtils(); |
| 542 | - | ||
| 543 | // IP | 533 | // IP |
| 544 | String url = FTPParamMap.get("url").toString(); | 534 | String url = FTPParamMap.get("url").toString(); |
| 545 | - | ||
| 546 | // 端口 | 535 | // 端口 |
| 547 | int port = Integer.valueOf(FTPParamMap.get("port").toString()); | 536 | int port = Integer.valueOf(FTPParamMap.get("port").toString()); |
| 548 | - | ||
| 549 | // 用户名 | 537 | // 用户名 |
| 550 | String username = FTPParamMap.get("username").toString(); | 538 | String username = FTPParamMap.get("username").toString(); |
| 551 | - | ||
| 552 | // 密码 | 539 | // 密码 |
| 553 | String password = FTPParamMap.get("password").toString(); | 540 | String password = FTPParamMap.get("password").toString(); |
| 554 | - | ||
| 555 | // 相对路径 | 541 | // 相对路径 |
| 556 | String remotePath = FTPParamMap.get("remotePath").toString(); | 542 | String remotePath = FTPParamMap.get("remotePath").toString(); |
| 557 | - | ||
| 558 | /** 如果已存在相同行单文件名则先删除 */ | 543 | /** 如果已存在相同行单文件名则先删除 */ |
| 559 | clientUtils.deleteFtpFile(url, port, username, password, remotePath, odlGzFileName); | 544 | clientUtils.deleteFtpFile(url, port, username, password, remotePath, odlGzFileName); |
| 560 | - | ||
| 561 | clientUtils.deleteFtpFile(url, port, username, password, remotePath, textFileName); | 545 | clientUtils.deleteFtpFile(url, port, username, password, remotePath, textFileName); |
| 562 | - | ||
| 563 | String textStr = ""; | 546 | String textStr = ""; |
| 564 | - | ||
| 565 | boolean tempTag = ishxType(objects); | 547 | boolean tempTag = ishxType(objects); |
| 566 | 548 | ||
| 567 | if(tempTag) | 549 | if(tempTag) |
| @@ -575,6 +557,12 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | @@ -575,6 +557,12 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | ||
| 575 | 557 | ||
| 576 | InputStream input = new ByteArrayInputStream(textStr.getBytes("gbk")); | 558 | InputStream input = new ByteArrayInputStream(textStr.getBytes("gbk")); |
| 577 | 559 | ||
| 560 | + // FileOutputStream fos = new FileOutputStream("test.txt"); | ||
| 561 | + /*int len = 0 ; | ||
| 562 | + byte[] cbuf = new byte[1024]; | ||
| 563 | + while((len = input.read(cbuf)) != -1) { | ||
| 564 | + fos.write(cbuf, 0, len); | ||
| 565 | + }*/ | ||
| 578 | /** 生成txt文件,上传ftp */ | 566 | /** 生成txt文件,上传ftp */ |
| 579 | clientUtils.uploadFile(url, port, username, password, remotePath, textFileName, input); | 567 | clientUtils.uploadFile(url, port, username, password, remotePath, textFileName, input); |
| 580 | 568 | ||
| @@ -645,25 +633,23 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | @@ -645,25 +633,23 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | ||
| 645 | * @return String | 633 | * @return String |
| 646 | */ | 634 | */ |
| 647 | public String newTextFileToFTP(List<Object[]> objects,Integer lineId) { | 635 | public String newTextFileToFTP(List<Object[]> objects,Integer lineId) { |
| 648 | - | ||
| 649 | // 返回值String | 636 | // 返回值String |
| 650 | String stationRStr = ""; | 637 | String stationRStr = ""; |
| 651 | - | ||
| 652 | // windows下的文本文件换行符 | 638 | // windows下的文本文件换行符 |
| 653 | //String enterStr = "\r\n"; | 639 | //String enterStr = "\r\n"; |
| 654 | - | ||
| 655 | // linux/unix下的文本文件换行符 | 640 | // linux/unix下的文本文件换行符 |
| 656 | String enterStr = "\r"; | 641 | String enterStr = "\r"; |
| 657 | - | 642 | + int defaultZdxh = 0; |
| 658 | if(objects.size()>0) { | 643 | if(objects.size()>0) { |
| 659 | - | ||
| 660 | for(int i = 0; i<objects.size();i++) { | 644 | for(int i = 0; i<objects.size();i++) { |
| 661 | - | 645 | + defaultZdxh ++ ; |
| 662 | // 经度 | 646 | // 经度 |
| 663 | - String lng = objects.get(i)[0].equals("") ? "" : objects.get(i)[0].toString(); | 647 | + String lng = objects.get(i)[0].equals("") ? "0" : objects.get(i)[0].toString(); |
| 664 | 648 | ||
| 665 | // 纬度 | 649 | // 纬度 |
| 666 | - String lat = objects.get(i)[1].equals("") ? "" : objects.get(i)[1].toString(); | 650 | + String lat = objects.get(i)[1].equals("") ? "0" : objects.get(i)[1].toString(); |
| 651 | + | ||
| 652 | + Point point = new Point(Double.valueOf(lng), Double.valueOf(lat)); | ||
| 667 | 653 | ||
| 668 | lat = "\t" + lat; | 654 | lat = "\t" + lat; |
| 669 | 655 | ||
| @@ -673,23 +659,32 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | @@ -673,23 +659,32 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | ||
| 673 | String stationMake = ""; | 659 | String stationMake = ""; |
| 674 | 660 | ||
| 675 | if(stationMakeStr.equals("E")) { | 661 | if(stationMakeStr.equals("E")) { |
| 676 | - | ||
| 677 | stationMake = "\t2"; | 662 | stationMake = "\t2"; |
| 678 | - | ||
| 679 | }else { | 663 | }else { |
| 680 | - | ||
| 681 | stationMake ="\t1"; | 664 | stationMake ="\t1"; |
| 682 | - | ||
| 683 | } | 665 | } |
| 684 | 666 | ||
| 685 | // 站点序号 | 667 | // 站点序号 |
| 686 | - String stationNo = objects.get(i)[4].equals("") ? "" : objects.get(i)[4].toString(); | 668 | + // String stationNo = objects.get(i)[4].equals("") ? "" : objects.get(i)[4].toString(); |
| 669 | + String stationNo = String.valueOf(defaultZdxh); | ||
| 687 | 670 | ||
| 688 | stationNo = "\t" + stationNo; | 671 | stationNo = "\t" + stationNo; |
| 689 | 672 | ||
| 690 | // 站点编码 | 673 | // 站点编码 |
| 691 | String stationCode = objects.get(i)[5].equals("") ? "" : objects.get(i)[5].toString(); | 674 | String stationCode = objects.get(i)[5].equals("") ? "" : objects.get(i)[5].toString(); |
| 692 | 675 | ||
| 676 | + int len = stationCode.length(); | ||
| 677 | + if(len<8) { | ||
| 678 | + int dx = 8 - len; | ||
| 679 | + String addStr = ""; | ||
| 680 | + for(int p =0;p<dx;p++) { | ||
| 681 | + addStr = addStr + "0"; | ||
| 682 | + } | ||
| 683 | + stationCode = addStr + stationCode; | ||
| 684 | + }else if(len>8){ | ||
| 685 | + stationCode = stationCode.substring(8); | ||
| 686 | + } | ||
| 687 | + | ||
| 693 | stationCode = "\t" +stationCode; | 688 | stationCode = "\t" +stationCode; |
| 694 | 689 | ||
| 695 | double dis = objects.get(i)[6]==null ? 0.0 : Double.parseDouble(objects.get(i)[6].toString())*1000; | 690 | double dis = objects.get(i)[6]==null ? 0.0 : Double.parseDouble(objects.get(i)[6].toString())*1000; |
| @@ -709,41 +704,33 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | @@ -709,41 +704,33 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | ||
| 709 | 704 | ||
| 710 | // 限速 | 705 | // 限速 |
| 711 | String sleepStr = ""; | 706 | String sleepStr = ""; |
| 712 | - | ||
| 713 | // 方向 | 707 | // 方向 |
| 714 | int directions = objects.get(i)[8]==null ? null : Integer.valueOf(objects.get(i)[8].toString()); | 708 | int directions = objects.get(i)[8]==null ? null : Integer.valueOf(objects.get(i)[8].toString()); |
| 715 | - | ||
| 716 | /** 获取路段路由信息 @pararm:<lineId:线路ID;directions:方向> */ | 709 | /** 获取路段路由信息 @pararm:<lineId:线路ID;directions:方向> */ |
| 717 | List<Object[]> sobje = routeRepository.sectionRouteVector(lineId,directions); | 710 | List<Object[]> sobje = routeRepository.sectionRouteVector(lineId,directions); |
| 718 | - | ||
| 719 | if(sobje.size()==1) { | 711 | if(sobje.size()==1) { |
| 720 | - | ||
| 721 | - double dsleepStr = sobje.get(0)[2] == null ? 60d : Double.valueOf(sobje.get(0)[2].toString()); | ||
| 722 | - | ||
| 723 | - sleepStr = "\t" + new DecimalFormat("0").format(dsleepStr); | ||
| 724 | - | 712 | + int dsleepStr = sobje.get(0)[2] == null || sobje.get(0)[2].equals("") ? 60 : Integer.valueOf(sobje.get(0)[2].toString()); |
| 713 | + sleepStr = "\t" + String.valueOf(dsleepStr); | ||
| 725 | }else if(sobje.size()>1){ | 714 | }else if(sobje.size()>1){ |
| 726 | - | ||
| 727 | - /** 这里暂时只根据站点名称去匹配所在路段的限速值 ,如果路段名称"至"之前的地名与站点名称等同,就认为站点在路段上。 */ | ||
| 728 | for(int j =0;j<sobje.size();j++) { | 715 | for(int j =0;j<sobje.size();j++) { |
| 729 | - | ||
| 730 | - String sectionName = sobje.get(j)[3].toString(); | ||
| 731 | - | ||
| 732 | - String sectionNameA[] = sectionName.split("至"); | ||
| 733 | - | ||
| 734 | - if(stationName.equals(sectionNameA[0])){ | ||
| 735 | - | ||
| 736 | - /*sleepStr = sobje.get(j)[2].toString();*/ | ||
| 737 | - | ||
| 738 | - double dsleepStrt = sobje.get(0)[2] == null ? 60d : Double.valueOf(sobje.get(j)[2].toString()); | ||
| 739 | - | ||
| 740 | - sleepStr = "\t" + new DecimalFormat("0").format(dsleepStrt); | ||
| 741 | - | 716 | + int dsleepStrt = sobje.get(0)[2] == null || sobje.get(0)[2].equals("") ? 60 : Integer.valueOf(sobje.get(j)[2].toString()); |
| 717 | + String pointsStr = sobje.get(j)[1]==null || sobje.get(j)[1].equals("") ? null : sobje.get(j)[1].toString(); | ||
| 718 | + pointsStr = pointsStr.substring(11, pointsStr.length()-1); | ||
| 719 | + List<Point> ps = new ArrayList<>(); | ||
| 720 | + String[] pArray = pointsStr.split(","); | ||
| 721 | + for(int a = 0; a <pArray.length; a++) { | ||
| 722 | + String[] tmepA = pArray[a].split(" "); | ||
| 723 | + Point temp = new Point(Double.valueOf(tmepA[0]), Double.valueOf(tmepA[1])); | ||
| 724 | + ps.add(temp); | ||
| 725 | + } | ||
| 726 | + if(GeoUtils.isInSection(ps, point)) { | ||
| 727 | + sleepStr = "\t" + String.valueOf(dsleepStrt); | ||
| 728 | + break; | ||
| 742 | } | 729 | } |
| 743 | - | ||
| 744 | } | 730 | } |
| 745 | } | 731 | } |
| 746 | - | 732 | + if(sleepStr.equals("")) |
| 733 | + sleepStr = "\t" + "60"; | ||
| 747 | stationRStr = stationRStr + lng + lat + stationMake + stationNo + stationCode + staitondistance + sleepStr + stationName + enterStr; | 734 | stationRStr = stationRStr + lng + lat + stationMake + stationNo + stationCode + staitondistance + sleepStr + stationName + enterStr; |
| 748 | } | 735 | } |
| 749 | 736 | ||
| @@ -762,9 +749,12 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | @@ -762,9 +749,12 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | ||
| 762 | for(int i = 0; i<objects.size();i++) { | 749 | for(int i = 0; i<objects.size();i++) { |
| 763 | if(Integer.valueOf(objects.get(i)[8].toString())==0) { | 750 | if(Integer.valueOf(objects.get(i)[8].toString())==0) { |
| 764 | // 经度 | 751 | // 经度 |
| 765 | - String lng = objects.get(i)[0].equals("") ? "" : objects.get(i)[0].toString(); | 752 | + String lng = objects.get(i)[0].equals("") ? "0" : objects.get(i)[0].toString(); |
| 753 | + | ||
| 766 | // 纬度 | 754 | // 纬度 |
| 767 | - String lat = objects.get(i)[1].equals("") ? "" : objects.get(i)[1].toString(); | 755 | + String lat = objects.get(i)[1].equals("") ? "0" : objects.get(i)[1].toString(); |
| 756 | + | ||
| 757 | + Point point = new Point(Double.valueOf(lng), Double.valueOf(lat)); | ||
| 768 | lat = "\t" + lat; | 758 | lat = "\t" + lat; |
| 769 | // 站点类型 | 759 | // 站点类型 |
| 770 | String stationMakeStr = objects.get(i)[3].equals("") ? "" : objects.get(i)[3].toString(); | 760 | String stationMakeStr = objects.get(i)[3].equals("") ? "" : objects.get(i)[3].toString(); |
| @@ -779,6 +769,17 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | @@ -779,6 +769,17 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | ||
| 779 | String stationNo = "\t" + xh; | 769 | String stationNo = "\t" + xh; |
| 780 | // 站点编码 | 770 | // 站点编码 |
| 781 | String stationCode = objects.get(i)[5].equals("") ? "" : objects.get(i)[5].toString(); | 771 | String stationCode = objects.get(i)[5].equals("") ? "" : objects.get(i)[5].toString(); |
| 772 | + int len = stationCode.length(); | ||
| 773 | + if(len<8) { | ||
| 774 | + int dx = 8 - len; | ||
| 775 | + String addStr = ""; | ||
| 776 | + for(int p =0;p<dx;p++) { | ||
| 777 | + addStr = addStr + "0"; | ||
| 778 | + } | ||
| 779 | + stationCode = addStr + stationCode; | ||
| 780 | + }else if(len>8){ | ||
| 781 | + stationCode = stationCode.substring(8); | ||
| 782 | + } | ||
| 782 | stationCode = "\t" +stationCode; | 783 | stationCode = "\t" +stationCode; |
| 783 | double dis = objects.get(i)[6]==null ? 0.0 : Double.parseDouble(objects.get(i)[6].toString())*1000; | 784 | double dis = objects.get(i)[6]==null ? 0.0 : Double.parseDouble(objects.get(i)[6].toString())*1000; |
| 784 | String tempDistc = String.valueOf((int) dis); | 785 | String tempDistc = String.valueOf((int) dis); |
| @@ -794,20 +795,28 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | @@ -794,20 +795,28 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | ||
| 794 | /** 获取路段路由信息 @pararm:<lineId:线路ID;directions:方向> */ | 795 | /** 获取路段路由信息 @pararm:<lineId:线路ID;directions:方向> */ |
| 795 | List<Object[]> sobje = routeRepository.sectionRouteVector(lineId,directions); | 796 | List<Object[]> sobje = routeRepository.sectionRouteVector(lineId,directions); |
| 796 | if(sobje.size()==1) { | 797 | if(sobje.size()==1) { |
| 797 | - double dsleepStr = sobje.get(0)[2] == null ? 60d : Double.valueOf(sobje.get(0)[2].toString()); | ||
| 798 | - sleepStr = "\t" + new DecimalFormat("0").format(dsleepStr); | 798 | + int dsleepStr = sobje.get(0)[2] == null || sobje.get(0)[2].equals("") ? 60 : Integer.valueOf(sobje.get(0)[2].toString()); |
| 799 | + sleepStr = "\t" + String.valueOf(dsleepStr); | ||
| 799 | }else if(sobje.size()>1){ | 800 | }else if(sobje.size()>1){ |
| 800 | - /** 这里暂时只根据站点名称去匹配所在路段的限速值 ,如果路段名称"至"之前的地名与站点名称等同,就认为站点在路段上。 */ | ||
| 801 | for(int j =0;j<sobje.size();j++) { | 801 | for(int j =0;j<sobje.size();j++) { |
| 802 | - String sectionName = sobje.get(j)[3].toString(); | ||
| 803 | - String sectionNameA[] = sectionName.split("至"); | ||
| 804 | - if(stationName.equals(sectionNameA[0])){ | ||
| 805 | - /*sleepStr = sobje.get(j)[2].toString();*/ | ||
| 806 | - double dsleepStrt = sobje.get(0)[2] == null ? 60d : Double.valueOf(sobje.get(j)[2].toString()); | ||
| 807 | - sleepStr = "\t" + new DecimalFormat("0").format(dsleepStrt); | 802 | + int dsleepStrt = sobje.get(0)[2] == null || sobje.get(0)[2].equals("") ? 60 : Integer.valueOf(sobje.get(j)[2].toString()); |
| 803 | + String pointsStr = sobje.get(j)[1]==null || sobje.get(j)[1].equals("") ? null : sobje.get(j)[1].toString(); | ||
| 804 | + pointsStr = pointsStr.substring(11, pointsStr.length()-1); | ||
| 805 | + List<Point> ps = new ArrayList<>(); | ||
| 806 | + String[] pArray = pointsStr.split(","); | ||
| 807 | + for(int a = 0; a <pArray.length; a++) { | ||
| 808 | + String[] tmepA = pArray[a].split(" "); | ||
| 809 | + Point temp = new Point(Double.valueOf(tmepA[0]), Double.valueOf(tmepA[1])); | ||
| 810 | + ps.add(temp); | ||
| 811 | + } | ||
| 812 | + if(GeoUtils.isInSection(ps, point)) { | ||
| 813 | + sleepStr = "\t" + String.valueOf(dsleepStrt); | ||
| 814 | + break; | ||
| 808 | } | 815 | } |
| 809 | } | 816 | } |
| 810 | } | 817 | } |
| 818 | + if(sleepStr.equals("")) | ||
| 819 | + sleepStr = "\t" + "60"; | ||
| 811 | xh++; | 820 | xh++; |
| 812 | restStr = restStr + lng + lat + stationMake + stationNo + stationCode + staitondistance + sleepStr + stationName + enterStr; | 821 | restStr = restStr + lng + lat + stationMake + stationNo + stationCode + staitondistance + sleepStr + stationName + enterStr; |
| 813 | } | 822 | } |
src/main/resources/static/pages/base/timesmodel/js/add-form-reload.js
| @@ -46,7 +46,8 @@ | @@ -46,7 +46,8 @@ | ||
| 46 | obj.jhlc = d[i].jhlc;// 计划里程 | 46 | obj.jhlc = d[i].jhlc;// 计划里程 |
| 47 | obj.lp = d[i].lp==null ? null : d[i].lp.id;// 路牌id | 47 | obj.lp = d[i].lp==null ? null : d[i].lp.id;// 路牌id |
| 48 | obj.lpType = d[i].lp==null ? null : d[i].lp.lpType;// 路牌类型 | 48 | obj.lpType = d[i].lp==null ? null : d[i].lp.lpType;// 路牌类型 |
| 49 | - obj.parent = d[i].lp.lpName;// 路牌名称 | 49 | + obj.parent = d[i].lp.lpNo;// 路牌名称 |
| 50 | + obj.lpName = d[i].lp.lpName; | ||
| 50 | obj.lpNo = d[i].lp.lpNo;// 路牌编码 | 51 | obj.lpNo = d[i].lp.lpNo;// 路牌编码 |
| 51 | obj.tcc = d[i].tcc==null ? null : d[i].tcc.id;// 停车场id | 52 | obj.tcc = d[i].tcc==null ? null : d[i].tcc.id;// 停车场id |
| 52 | obj.ttinfo = d[i].ttinfo==null ? null : d[i].ttinfo.id;// 时刻表id | 53 | obj.ttinfo = d[i].ttinfo==null ? null : d[i].ttinfo.id;// 时刻表id |
| @@ -60,7 +61,7 @@ | @@ -60,7 +61,7 @@ | ||
| 60 | resultD.push(obj); | 61 | resultD.push(obj); |
| 61 | if(lpA.indexOf(obj.lpNo)<0) { | 62 | if(lpA.indexOf(obj.lpNo)<0) { |
| 62 | lpA.push(obj.lpNo); | 63 | lpA.push(obj.lpNo); |
| 63 | - rsLpA.push({'lp':obj.lp,'lpNo':obj.lpNo,'lpName':obj.parent,'lpType':obj.lpType}); | 64 | + rsLpA.push({'lp':obj.lp,'lpNo':obj.lpNo,'lpName':obj.lpName,'lpType':obj.lpType}); |
| 64 | } | 65 | } |
| 65 | } | 66 | } |
| 66 | // 返回渲染图形的数据格式. | 67 | // 返回渲染图形的数据格式. |
src/main/resources/static/pages/base/timesmodel/js/add-form-wizard.js
| @@ -407,7 +407,9 @@ var SKBFormWizard = function() { | @@ -407,7 +407,9 @@ var SKBFormWizard = function() { | ||
| 407 | obj.jhlc = d[i].jhlc;// 计划里程 | 407 | obj.jhlc = d[i].jhlc;// 计划里程 |
| 408 | obj.lp = d[i].lp==null ? null : d[i].lp.id;// 路牌id | 408 | obj.lp = d[i].lp==null ? null : d[i].lp.id;// 路牌id |
| 409 | obj.lpType = d[i].lp==null ? null : d[i].lp.lpType;// 路牌类型 | 409 | obj.lpType = d[i].lp==null ? null : d[i].lp.lpType;// 路牌类型 |
| 410 | - obj.parent = d[i].lp.lpName;// 路牌名称 | 410 | + // obj.parent = d[i].lp.lpName;// 路牌名称 |
| 411 | + // obj.parent = parseInt(d[i].lp.lpNo);// 路牌名称 | ||
| 412 | + obj.lpName = d[i].lp.lpName; | ||
| 411 | obj.lpNo = d[i].lp.lpNo;// 路牌编码 | 413 | obj.lpNo = d[i].lp.lpNo;// 路牌编码 |
| 412 | obj.tcc = d[i].tcc==null ? null : d[i].tcc.id;// 停车场id | 414 | obj.tcc = d[i].tcc==null ? null : d[i].tcc.id;// 停车场id |
| 413 | obj.ttinfo = d[i].ttinfo==null ? null : d[i].ttinfo.id;// 时刻表id | 415 | obj.ttinfo = d[i].ttinfo==null ? null : d[i].ttinfo.id;// 时刻表id |
| @@ -421,7 +423,7 @@ var SKBFormWizard = function() { | @@ -421,7 +423,7 @@ var SKBFormWizard = function() { | ||
| 421 | resultD.push(obj); | 423 | resultD.push(obj); |
| 422 | if(lpA.indexOf(obj.lpNo)<0) { | 424 | if(lpA.indexOf(obj.lpNo)<0) { |
| 423 | lpA.push(obj.lpNo); | 425 | lpA.push(obj.lpNo); |
| 424 | - rsLpA.push({'lp':obj.lp,'lpNo':obj.lpNo,'lpName':obj.parent,'lpType':obj.lpType}); | 426 | + rsLpA.push({'lp':obj.lp,'lpNo':obj.lpNo,'lpName':obj.lpName,'lpType':obj.lpType}); |
| 425 | } | 427 | } |
| 426 | } | 428 | } |
| 427 | // 返回渲染图形的数据格式. | 429 | // 返回渲染图形的数据格式. |
src/main/resources/static/pages/base/timesmodel/js/base-fun.js
| @@ -388,7 +388,7 @@ var BaseFun = function() { | @@ -388,7 +388,7 @@ var BaseFun = function() { | ||
| 388 | var jar = baseF.tzsmbcsj01( | 388 | var jar = baseF.tzsmbcsj01( |
| 389 | baseF.setbcsAndfcno(baseF.tzsmbcsj01(baseF.setbcsAndfcno(baseF.tzsztest(cara,jar01,dataMap)),dataMap.smbcsjArr,dataMap.ccsjArr,dataMap.cclcArr,dataMap.qdzArr,saa[0].lbsj,dataMap)), | 389 | baseF.setbcsAndfcno(baseF.tzsmbcsj01(baseF.setbcsAndfcno(baseF.tzsztest(cara,jar01,dataMap)),dataMap.smbcsjArr,dataMap.ccsjArr,dataMap.cclcArr,dataMap.qdzArr,saa[0].lbsj,dataMap)), |
| 390 | dataMap.smbcsjArr,dataMap.ccsjArr,dataMap.cclcArr,dataMap.qdzArr,saa[0].lbsj,dataMap); | 390 | dataMap.smbcsjArr,dataMap.ccsjArr,dataMap.cclcArr,dataMap.qdzArr,saa[0].lbsj,dataMap); |
| 391 | - // return {'json':jar,'bxrcgs':bxrcgs}; | 391 | + // return {'json':jar,'bxrcgs':bxrcgs}; |
| 392 | for(var r = 0 ; r < bxrcgs.length; r++) { | 392 | for(var r = 0 ; r < bxrcgs.length; r++) { |
| 393 | var lpNo = bxrcgs[r].lpNo; | 393 | var lpNo = bxrcgs[r].lpNo; |
| 394 | var gsv = 0 , bczs = 0; | 394 | var gsv = 0 , bczs = 0; |
| @@ -401,8 +401,9 @@ var BaseFun = function() { | @@ -401,8 +401,9 @@ var BaseFun = function() { | ||
| 401 | bxrcgs[r].sjgsV = gsv; | 401 | bxrcgs[r].sjgsV = gsv; |
| 402 | bxrcgs[r].bczs = bczs; | 402 | bxrcgs[r].bczs = bczs; |
| 403 | } | 403 | } |
| 404 | + //debugger; | ||
| 404 | var jar3 = baseF.dqbcsAndgs(bxrcgs,jar,dataMap,cara.length); | 405 | var jar3 = baseF.dqbcsAndgs(bxrcgs,jar,dataMap,cara.length); |
| 405 | - // return {'json':jar3,'bxrcgs':bxrcgs}; | 406 | + //return {'json':jar3,'bxrcgs':bxrcgs}; |
| 406 | /*var jar4 = baseF.tzsmbcsj01( | 407 | /*var jar4 = baseF.tzsmbcsj01( |
| 407 | baseF.setbcsAndfcno(baseF.tzsmbcsj01(baseF.setbcsAndfcno(baseF.tzsztest(cara,jar3,dataMap)),dataMap.smbcsjArr,dataMap.ccsjArr,dataMap.cclcArr,dataMap.qdzArr,saa[0].lbsj,dataMap)), | 408 | baseF.setbcsAndfcno(baseF.tzsmbcsj01(baseF.setbcsAndfcno(baseF.tzsztest(cara,jar3,dataMap)),dataMap.smbcsjArr,dataMap.ccsjArr,dataMap.cclcArr,dataMap.qdzArr,saa[0].lbsj,dataMap)), |
| 408 | dataMap.smbcsjArr,dataMap.ccsjArr,dataMap.cclcArr,dataMap.qdzArr,saa[0].lbsj,dataMap);*/ | 409 | dataMap.smbcsjArr,dataMap.ccsjArr,dataMap.cclcArr,dataMap.qdzArr,saa[0].lbsj,dataMap);*/ |
| @@ -538,9 +539,11 @@ var BaseFun = function() { | @@ -538,9 +539,11 @@ var BaseFun = function() { | ||
| 538 | for(var q = 0 ; q < qbbfbc.length; q++) { | 539 | for(var q = 0 ; q < qbbfbc.length; q++) { |
| 539 | if(q<(qbbfbc.length-1)) | 540 | if(q<(qbbfbc.length-1)) |
| 540 | qbbfbc[q].STOPTIME = qbbfbc[q].STOPTIME + vag; | 541 | qbbfbc[q].STOPTIME = qbbfbc[q].STOPTIME + vag; |
| 541 | - if(q==0) | ||
| 542 | - continue; | ||
| 543 | - else { | 542 | + if(q==0) { |
| 543 | + var fcsj_ = baseF.getDateTime(qbbfbc[q].fcsj); | ||
| 544 | + fcsj_.setMinutes(fcsj_.getMinutes() + qbbfbc[q].bcsj); | ||
| 545 | + qbbfbc[q].ARRIVALTIME = baseF.getTimeStr(fcsj_); | ||
| 546 | + }else { | ||
| 544 | var ddsj_ = baseF.getDateTime(qbbfbc[q-1].ARRIVALTIME); | 547 | var ddsj_ = baseF.getDateTime(qbbfbc[q-1].ARRIVALTIME); |
| 545 | ddsj_.setMinutes(ddsj_.getMinutes() + qbbfbc[q-1].STOPTIME); | 548 | ddsj_.setMinutes(ddsj_.getMinutes() + qbbfbc[q-1].STOPTIME); |
| 546 | qbbfbc[q].fcsj = baseF.getTimeStr(ddsj_); | 549 | qbbfbc[q].fcsj = baseF.getTimeStr(ddsj_); |
| @@ -616,6 +619,9 @@ var BaseFun = function() { | @@ -616,6 +619,9 @@ var BaseFun = function() { | ||
| 616 | var dygbcfcsj = baseF.getDateTime(obj.fcsj); | 619 | var dygbcfcsj = baseF.getDateTime(obj.fcsj); |
| 617 | dygbcfcsj.setMinutes(dygbcfcsj.getMinutes() - dx); | 620 | dygbcfcsj.setMinutes(dygbcfcsj.getMinutes() - dx); |
| 618 | obj.fcsj = baseF.getTimeStr(dygbcfcsj); | 621 | obj.fcsj = baseF.getTimeStr(dygbcfcsj); |
| 622 | + | ||
| 623 | + dygbcfcsj.setMinutes(dygbcfcsj.getMinutes() + obj.bcsj); | ||
| 624 | + obj.ARRIVALTIME = baseF.getTimeStr(dygbcfcsj); | ||
| 619 | }, | 625 | }, |
| 620 | 626 | ||
| 621 | zhygbcUpd: function(obj,xgOjb,dx) { | 627 | zhygbcUpd: function(obj,xgOjb,dx) { |
src/main/resources/static/pages/base/timesmodel/js/d3.relationshipgraph.js
| @@ -647,7 +647,6 @@ var RelationshipGraph = function () { | @@ -647,7 +647,6 @@ var RelationshipGraph = function () { | ||
| 647 | .ordinal() | 647 | .ordinal() |
| 648 | .domain(this.configuration.lpNameA) | 648 | .domain(this.configuration.lpNameA) |
| 649 | .rangeRoundBands([ 0, this.configuration.height], .1); | 649 | .rangeRoundBands([ 0, this.configuration.height], .1); |
| 650 | - | ||
| 651 | this.configuration.y = y; | 650 | this.configuration.y = y; |
| 652 | // 创建X轴 | 651 | // 创建X轴 |
| 653 | var xAxis = d3.svg | 652 | var xAxis = d3.svg |
src/main/resources/static/pages/base/timesmodel/js/gantt.js
| @@ -70,8 +70,28 @@ | @@ -70,8 +70,28 @@ | ||
| 70 | }else { | 70 | }else { |
| 71 | var jsonA = JSON.parse(objD); | 71 | var jsonA = JSON.parse(objD); |
| 72 | // 使用已有的时刻表明细数据渲染视图. | 72 | // 使用已有的时刻表明细数据渲染视图. |
| 73 | - data = {'json':jsonA.rsD,'bxrcgs':null}; | 73 | + // data = {'json':jsonA.rsD,'bxrcgs':null}; |
| 74 | CSMap = {'gattA':null,'stopSpace': Math.round(map.zzsj/map.clzs),'maxCar':jsonA.rsLP}; | 74 | CSMap = {'gattA':null,'stopSpace': Math.round(map.zzsj/map.clzs),'maxCar':jsonA.rsLP}; |
| 75 | + var cara = jsonA.rsLP; | ||
| 76 | + var rsjar = jsonA.rsD; | ||
| 77 | + var resultJA = new Array(); | ||
| 78 | + for(var m = 0 ; m < cara.length; m++) { | ||
| 79 | + // 获取路牌编号. | ||
| 80 | + var lpNo_ = cara[m].lpNo; | ||
| 81 | + // 定义路牌下的所有班次. | ||
| 82 | + var lpbc_ = new Array(); | ||
| 83 | + // 遍历班次数. | ||
| 84 | + for(var x =0 ; x <rsjar.length; x++) { | ||
| 85 | + // 判断当期遍历的班次是否属于当前的路牌. | ||
| 86 | + if(rsjar[x].lpNo == lpNo_) { | ||
| 87 | + lpbc_.push(rsjar[x]); | ||
| 88 | + } | ||
| 89 | + } | ||
| 90 | + // 按照发车序号顺序排序. | ||
| 91 | + lpbc_.sort(function(a,b){return a.fcno-b.fcno}); | ||
| 92 | + resultJA = resultJA.concat(BaseFun.addjclbbc01(lpbc_,dataMap,stopAraay[0].lbsj,map)); | ||
| 93 | + } | ||
| 94 | + data = {'json':rsjar,'bxrcgs':null}; | ||
| 75 | } | 95 | } |
| 76 | // 创建甘特图对象. | 96 | // 创建甘特图对象. |
| 77 | var graph = d3.select('#ganttSvg').relationshipGraph( | 97 | var graph = d3.select('#ganttSvg').relationshipGraph( |
| @@ -401,6 +421,7 @@ | @@ -401,6 +421,7 @@ | ||
| 401 | var hours=Math.floor(leave1/(3600*1000)); | 421 | var hours=Math.floor(leave1/(3600*1000)); |
| 402 | DXHOURS = days*24+hours; | 422 | DXHOURS = days*24+hours; |
| 403 | WIDTH = DXHOURS*MINUTE*MULTIPLE; | 423 | WIDTH = DXHOURS*MINUTE*MULTIPLE; |
| 424 | + debugger; | ||
| 404 | var lpsplitA = getylp(p.yAxisCarArray); | 425 | var lpsplitA = getylp(p.yAxisCarArray); |
| 405 | var args = { | 426 | var args = { |
| 406 | 'valueKeyName': VALUEKEYNAME, | 427 | 'valueKeyName': VALUEKEYNAME, |