Commit ede0e52a4cd0bb55c549adbb33694895f61df903
Merge branch 'minhang' of 192.168.168.201:panzhaov5/bsth_control into minhang
Showing
19 changed files
with
597 additions
and
353 deletions
src/main/java/com/bsth/controller/realcontrol/ScheduleRealInfoController.java
| ... | ... | @@ -319,8 +319,9 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, |
| 319 | 319 | |
| 320 | 320 | @RequestMapping(value = "/correctForm") |
| 321 | 321 | public List<SchEditInfoDto> correctForm(@RequestParam String line, @RequestParam String date, |
| 322 | + @RequestParam String endDate, | |
| 322 | 323 | @RequestParam String lpName, @RequestParam String code, @RequestParam String type) { |
| 323 | - return scheduleRealInfoService.correctForm(line, date, lpName, code, type); | |
| 324 | + return scheduleRealInfoService.correctForm(line, date, endDate, lpName, code, type); | |
| 324 | 325 | } |
| 325 | 326 | /** |
| 326 | 327 | * @Title queryListWaybill | ... | ... |
src/main/java/com/bsth/controller/report/ReportController.java
| ... | ... | @@ -110,6 +110,7 @@ public class ReportController { |
| 110 | 110 | Map<String, Object> m = new HashMap<String, Object>(); |
| 111 | 111 | m.put("i", i); |
| 112 | 112 | m.put("nbbm", a.getNbbm()); |
| 113 | + m.put("pzh", a.getPzh()); | |
| 113 | 114 | m.put("stopName", a.getStopName()); |
| 114 | 115 | m.put("jzsj", a.getJzsj()); |
| 115 | 116 | m.put("czsj", a.getCzsj()); | ... | ... |
src/main/java/com/bsth/controller/report/SheetController.java
| ... | ... | @@ -36,9 +36,21 @@ public class SheetController extends BaseController<Sheet, Integer>{ |
| 36 | 36 | List<Sheet> list=sheetService.sheetList(id); |
| 37 | 37 | return list; |
| 38 | 38 | } |
| 39 | + @RequestMapping(value = "/exportList",method = RequestMethod.GET) | |
| 40 | + public List<Sheet> exportList(@RequestParam Integer id){ | |
| 41 | + List<Sheet> list=sheetService.exportList(id); | |
| 42 | + return list; | |
| 43 | + } | |
| 44 | + | |
| 39 | 45 | @RequestMapping(value = "/countList",method = RequestMethod.GET) |
| 40 | 46 | public List<Map<String, Object>> countList(@RequestParam Map<String, Object> map){ |
| 41 | 47 | List<Map<String, Object>> list=sheetService.countList(map); |
| 42 | 48 | return list; |
| 43 | 49 | } |
| 50 | + | |
| 51 | + @RequestMapping(value = "/listSheet",method = RequestMethod.GET) | |
| 52 | + public List<Map<String, Object>> listSheet(@RequestParam Map<String, Object> map){ | |
| 53 | + List<Map<String, Object>> list=sheetService.listSheet(map); | |
| 54 | + return list; | |
| 55 | + } | |
| 44 | 56 | } | ... | ... |
src/main/java/com/bsth/entity/excep/ArrivalInfo.java
| ... | ... | @@ -20,6 +20,8 @@ public class ArrivalInfo { |
| 20 | 20 | |
| 21 | 21 | private String nbbm; |
| 22 | 22 | |
| 23 | + | |
| 24 | + private String pzh; | |
| 23 | 25 | /** 站点名称 */ |
| 24 | 26 | private String stopName; |
| 25 | 27 | |
| ... | ... | @@ -243,6 +245,14 @@ public class ArrivalInfo { |
| 243 | 245 | public void setJzsj(String jzsj) { |
| 244 | 246 | this.jzsj = jzsj; |
| 245 | 247 | } |
| 248 | + | |
| 249 | + public String getPzh() { | |
| 250 | + return pzh; | |
| 251 | + } | |
| 252 | + | |
| 253 | + public void setPzh(String pzh) { | |
| 254 | + this.pzh = pzh; | |
| 255 | + } | |
| 246 | 256 | |
| 247 | 257 | |
| 248 | 258 | ... | ... |
src/main/java/com/bsth/entity/mcy_forms/Changetochange.java
| ... | ... | @@ -12,6 +12,8 @@ public class Changetochange { |
| 12 | 12 | @GeneratedValue |
| 13 | 13 | private Integer id; |
| 14 | 14 | |
| 15 | + private Long sId; | |
| 16 | + | |
| 15 | 17 | private String rq;//日期 |
| 16 | 18 | |
| 17 | 19 | private String gs;//公司 |
| ... | ... | @@ -171,7 +173,15 @@ public class Changetochange { |
| 171 | 173 | public void setXgr(String xgr) { |
| 172 | 174 | this.xgr = xgr; |
| 173 | 175 | } |
| 174 | - | |
| 175 | 176 | |
| 177 | + public Long getsId() { | |
| 178 | + return sId; | |
| 179 | + } | |
| 180 | + | |
| 181 | + public void setsId(Long sId) { | |
| 182 | + this.sId = sId; | |
| 183 | + } | |
| 184 | + | |
| 185 | + | |
| 176 | 186 | |
| 177 | 187 | } | ... | ... |
src/main/java/com/bsth/service/realcontrol/ScheduleRealInfoService.java
| ... | ... | @@ -105,7 +105,7 @@ public interface ScheduleRealInfoService extends BaseService<ScheduleRealInfo, L |
| 105 | 105 | List<Map<String,Object>> accountPx(String line,String date,String code,String xlName, String px); |
| 106 | 106 | |
| 107 | 107 | |
| 108 | - List<SchEditInfoDto> correctForm(String line,String date,String lpName,String code, String type); | |
| 108 | + List<SchEditInfoDto> correctForm(String line,String date,String endDate,String lpName,String code, String type); | |
| 109 | 109 | |
| 110 | 110 | List<ScheduleRealInfo> queryListWaybill(String jName,String clZbh,String lpName,String date,String line); |
| 111 | 111 | ... | ... |
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
| ... | ... | @@ -1965,7 +1965,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 1965 | 1965 | }*/ |
| 1966 | 1966 | |
| 1967 | 1967 | @Override |
| 1968 | - public List<SchEditInfoDto> correctForm(String line,String date, | |
| 1968 | + public List<SchEditInfoDto> correctForm(String line,String date,String endDate, | |
| 1969 | 1969 | String lpName,String code, String type) { |
| 1970 | 1970 | |
| 1971 | 1971 | // var types = {'DFTZ': '待发调整', 'FCXXWT':'发车信息微调', 'JHLB': '计划烂班', 'CXLB': '撤销烂班', |
| ... | ... | @@ -1991,17 +1991,17 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 1991 | 1991 | String sql = "select t1.*, " |
| 1992 | 1992 | + "t2.fcsj,t2.lp_name,t2.cl_zbh,t2.j_gh,t2.j_name," |
| 1993 | 1993 | + "t2.xl_dir,t2.real_exec_date from (select * from " |
| 1994 | - + "logger_sch_modify where rq=? and line_code=? )" | |
| 1994 | + + "logger_sch_modify where rq BETWEEN ? and ? and line_code=? )" | |
| 1995 | 1995 | + " t1 INNER JOIN bsth_c_s_sp_info_real t2 on " |
| 1996 | 1996 | + "t1.sch_id=t2.id where 1=1 " + cont; |
| 1997 | 1997 | |
| 1998 | 1998 | List<SchEditInfoDto> list = jdbcTemplate.query(sql, |
| 1999 | - new BeanPropertyRowMapper(SchEditInfoDto.class),date, line); | |
| 1999 | + new BeanPropertyRowMapper(SchEditInfoDto.class),date,endDate, line); | |
| 2000 | 2000 | List<SchEditInfoDto> lists=new ArrayList<SchEditInfoDto>(); |
| 2001 | 2001 | for (int i = 0; i < list.size(); i++) { |
| 2002 | 2002 | SchEditInfoDto t=list.get(i); |
| 2003 | 2003 | if(map.get(t.getType())!=null){ |
| 2004 | - t.setType2(t.getTimeStr()+":"+map.get(t.getType()).toString()); | |
| 2004 | + t.setType2(t.getUser()+"于"+t.getTimeStr()+"进行"+map.get(t.getType()).toString()+";"); | |
| 2005 | 2005 | }else{ |
| 2006 | 2006 | t.setType2(""); |
| 2007 | 2007 | } |
| ... | ... | @@ -2013,6 +2013,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 2013 | 2013 | fage=false; |
| 2014 | 2014 | } |
| 2015 | 2015 | } |
| 2016 | + | |
| 2016 | 2017 | if(fage){ |
| 2017 | 2018 | lists.add(t); |
| 2018 | 2019 | } |
| ... | ... | @@ -2030,6 +2031,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 2030 | 2031 | for (SchEditInfoDto d : lists) { |
| 2031 | 2032 | Map<String, Object> tempMap = new HashMap<String, Object>(); |
| 2032 | 2033 | tempMap.put("lpName", d.getLpName()); |
| 2034 | + tempMap.put("rq", d.getRq()); | |
| 2033 | 2035 | tempMap.put("clZbh", d.getClZbh()); |
| 2034 | 2036 | tempMap.put("jName", d.getjName()+"/"+d.getjGh()); |
| 2035 | 2037 | tempMap.put("fcsj", d.getFcsj()); | ... | ... |
src/main/java/com/bsth/service/report/SheetService.java
| ... | ... | @@ -10,6 +10,7 @@ public interface SheetService extends BaseService<Sheet, Integer>{ |
| 10 | 10 | public List<Map<String, Object>> bcPunctual(Map<String, Object> map); |
| 11 | 11 | public String saveSheetList(String date) throws Exception; |
| 12 | 12 | public List<Map<String, Object>> countList(Map<String, Object> map); |
| 13 | - | |
| 13 | + public List<Map<String, Object>> listSheet(Map<String, Object> map); | |
| 14 | 14 | public List<Sheet> sheetList(Integer id); |
| 15 | + public List<Sheet> exportList(Integer id); | |
| 15 | 16 | } | ... | ... |
src/main/java/com/bsth/service/report/impl/ReportServiceImpl.java
| ... | ... | @@ -156,7 +156,9 @@ public class ReportServiceImpl implements ReportService{ |
| 156 | 156 | while(rs.next()){ |
| 157 | 157 | arr = new ArrivalInfo(); |
| 158 | 158 | arr.setDeviceId(rs.getString("device_id")); |
| 159 | - arr.setNbbm(BasicData.deviceId2NbbmMap.get(arr.getDeviceId())); | |
| 159 | + String nbbm=BasicData.deviceId2NbbmMap.get(arr.getDeviceId()); | |
| 160 | + arr.setNbbm(nbbm); | |
| 161 | + arr.setPzh(BasicData.nbbmCompanyPlateMap.get(nbbm)); | |
| 160 | 162 | if(null == arr.getNbbm()){ |
| 161 | 163 | logger.warn("未注册的设备号," + arr.getDeviceId()); |
| 162 | 164 | continue; | ... | ... |
src/main/java/com/bsth/service/report/impl/SheetServiceImpl.java
| 1 | 1 | package com.bsth.service.report.impl; |
| 2 | 2 | |
| 3 | +import java.lang.reflect.InvocationTargetException; | |
| 3 | 4 | import java.sql.ResultSet; |
| 4 | 5 | import java.sql.SQLException; |
| 5 | 6 | import java.text.DecimalFormat; |
| ... | ... | @@ -42,6 +43,7 @@ import com.bsth.service.report.SheetService; |
| 42 | 43 | import com.bsth.util.BatchSaveUtils; |
| 43 | 44 | import com.bsth.util.ComparableChild; |
| 44 | 45 | import com.bsth.util.ComparableReal; |
| 46 | +import com.bsth.util.ReportRelatedUtils; | |
| 45 | 47 | import com.google.common.util.concurrent.AbstractScheduledService.Scheduler; |
| 46 | 48 | |
| 47 | 49 | @Service |
| ... | ... | @@ -658,7 +660,8 @@ public class SheetServiceImpl extends BaseServiceImpl<Sheet, Integer> implements |
| 658 | 660 | fgs=map.get("fgs").toString(); |
| 659 | 661 | } |
| 660 | 662 | String date=map.get("date").toString(); |
| 661 | - String sql="select * from bsth_c_sheet where date='"+date+"'"; | |
| 663 | + String endDate=map.get("endDate").toString(); | |
| 664 | + String sql="select * from bsth_c_sheet where date BETWEEN '"+date+"' and '"+endDate+"'"; | |
| 662 | 665 | if(line.trim().equals("")){ |
| 663 | 666 | sql +=" and gs like '%"+gs+"%' and fgs like '%"+fgs+"%'"; |
| 664 | 667 | }else{ |
| ... | ... | @@ -721,6 +724,7 @@ public class SheetServiceImpl extends BaseServiceImpl<Sheet, Integer> implements |
| 721 | 724 | String gs=BasicData.businessCodeNameMap.get(list.get(0).getGs()); |
| 722 | 725 | String fgs=BasicData.businessFgsCodeNameMap.get(list.get(0).getFgs()+"_"+list.get(0).getGs()); |
| 723 | 726 | String line=BasicData.lineCode2NameMap.get(list.get(0).getLine()); |
| 727 | + String date=list.get(0).getDate(); | |
| 724 | 728 | Integer id=list.get(0).getId(); |
| 725 | 729 | int bcs=list.size(); |
| 726 | 730 | int zdbcs=0; |
| ... | ... | @@ -740,6 +744,7 @@ public class SheetServiceImpl extends BaseServiceImpl<Sheet, Integer> implements |
| 740 | 744 | map.put("zdbcs", zdbcs); |
| 741 | 745 | map.put("zdlv", df.format(zdlv)+"%"); |
| 742 | 746 | map.put("id", id); |
| 747 | + map.put("date", date); | |
| 743 | 748 | return map; |
| 744 | 749 | } |
| 745 | 750 | @Override |
| ... | ... | @@ -781,6 +786,128 @@ public class SheetServiceImpl extends BaseServiceImpl<Sheet, Integer> implements |
| 781 | 786 | return list; |
| 782 | 787 | } |
| 783 | 788 | |
| 789 | + @Override | |
| 790 | + public List<Sheet> exportList(Integer id) { | |
| 791 | + // TODO Auto-generated method stub | |
| 792 | + ReportRelatedUtils rru = new ReportRelatedUtils(); | |
| 793 | + Sheet sheet=sheetRepository.findOne(id); | |
| 794 | + String sql="select * from bsth_c_sheet where date='"+sheet.getDate()+"' and line = '"+sheet.getLine()+"'" | |
| 795 | + + " order by xl_dir,jhsj"; | |
| 796 | + | |
| 797 | + List<Sheet> list=jdbcTemplate.query(sql, | |
| 798 | + new RowMapper<Sheet>(){ | |
| 799 | + @Override | |
| 800 | + public Sheet mapRow(ResultSet rs, int rowNum) throws SQLException { | |
| 801 | + Sheet s=new Sheet(); | |
| 802 | + s.setId(rs.getInt("id")); | |
| 803 | + s.setGs(rs.getString("gs")); | |
| 804 | + s.setFgs(rs.getString("fgs")); | |
| 805 | + s.setLine(rs.getString("line")); | |
| 806 | + s.setDate(rs.getString("date")); | |
| 807 | + s.setJhsj(rs.getString("jhsj")); | |
| 808 | + s.setJhsjt(rs.getLong("jhsjt")); | |
| 809 | + s.setSjsj(rs.getString("sjsj")); | |
| 810 | + s.setSjsjt(rs.getLong("sjsjt")); | |
| 811 | + s.setZdname(rs.getString("zdname")); | |
| 812 | + return s; | |
| 813 | + } | |
| 814 | + }); | |
| 815 | + | |
| 816 | + List<Map<String, Object>> listMap = new ArrayList<Map<String, Object>>(); | |
| 817 | + for (int i = 0; i < list.size(); i++) { | |
| 818 | + Sheet t=list.get(i); | |
| 819 | + t.setLine(BasicData.lineCode2NameMap.get(t.getLine())); | |
| 820 | + Long sjc=t.getJhsjt()-t.getSjsjt(); | |
| 821 | + if(sjc>= 3*60*1000*-1 && sjc <=1*60*1000){ | |
| 822 | + t.setSfzd("准点"); | |
| 823 | + }else{ | |
| 824 | + t.setSfzd("不准点"); | |
| 825 | + } | |
| 826 | + | |
| 827 | + try { | |
| 828 | + Map<String, Object> map = rru.getMapValue(t); | |
| 829 | + listMap.add(map); | |
| 830 | + } catch (ClassNotFoundException e) { | |
| 831 | + // TODO Auto-generated catch block | |
| 832 | + e.printStackTrace(); | |
| 833 | + } catch (IllegalAccessException e) { | |
| 834 | + // TODO Auto-generated catch block | |
| 835 | + e.printStackTrace(); | |
| 836 | + } catch (InvocationTargetException e) { | |
| 837 | + // TODO Auto-generated catch block | |
| 838 | + e.printStackTrace(); | |
| 839 | + } catch (NoSuchMethodException e) { | |
| 840 | + // TODO Auto-generated catch block | |
| 841 | + e.printStackTrace(); | |
| 842 | + } catch (NoSuchFieldException e) { | |
| 843 | + // TODO Auto-generated catch block | |
| 844 | + e.printStackTrace(); | |
| 845 | + } | |
| 846 | + | |
| 847 | + } | |
| 848 | + | |
| 849 | + return list; | |
| 850 | + } | |
| 851 | + @Override | |
| 852 | + public List<Map<String, Object>> listSheet(Map<String, Object> map) { | |
| 853 | + // TODO Auto-generated method stub | |
| 854 | + List<Map<String, Object>> listmap=new ArrayList<Map<String,Object>>(); | |
| 855 | + Integer id=Integer.parseInt(map.get("id").toString()); | |
| 856 | + Sheet sheet=sheetRepository.findOne(id); | |
| 857 | + String date=map.get("date").toString(); | |
| 858 | + String endDate=map.get("endDate").toString(); | |
| 859 | + | |
| 860 | + String sqlByDate="select date from bsth_c_sheet where date BETWEEN '"+date+"' and '"+endDate+"'" | |
| 861 | + + "and line = '"+sheet.getLine()+"' group by date order by date"; | |
| 862 | + | |
| 863 | + List<String> dateList=jdbcTemplate.query(sqlByDate, | |
| 864 | + new RowMapper<String>(){ | |
| 865 | + @Override | |
| 866 | + public String mapRow(ResultSet rs, int rowNum) throws SQLException { | |
| 867 | + String date=rs.getString("date"); | |
| 868 | + | |
| 869 | + return date; | |
| 870 | + } | |
| 871 | + }); | |
| 872 | + | |
| 873 | + String sql="select * from bsth_c_sheet where date BETWEEN '"+date+"' and '"+endDate+"'" | |
| 874 | + + " and line ='"+sheet.getLine()+"' order by date"; | |
| 875 | + | |
| 876 | + List<Sheet> list=jdbcTemplate.query(sql, | |
| 877 | + new RowMapper<Sheet>(){ | |
| 878 | + @Override | |
| 879 | + public Sheet mapRow(ResultSet rs, int rowNum) throws SQLException { | |
| 880 | + Sheet s=new Sheet(); | |
| 881 | + s.setGs(rs.getString("gs")); | |
| 882 | + s.setFgs(rs.getString("fgs")); | |
| 883 | + s.setLine(rs.getString("line")); | |
| 884 | + s.setDate(rs.getString("date")); | |
| 885 | + s.setJhsj(rs.getString("jhsj")); | |
| 886 | + s.setJhsjt(rs.getLong("jhsjt")); | |
| 887 | + s.setSjsj(rs.getString("sjsj")); | |
| 888 | + s.setSjsjt(rs.getLong("sjsjt")); | |
| 889 | + s.setId(rs.getInt("id")); | |
| 890 | + return s; | |
| 891 | + } | |
| 892 | + }); | |
| 893 | + for (int i = 0; i < dateList.size(); i++) { | |
| 894 | + String s=dateList.get(i); | |
| 895 | + List<Sheet> newList=new ArrayList<Sheet>(); | |
| 896 | + for (int j = 0; j < list.size(); j++) { | |
| 897 | + Sheet t=list.get(j); | |
| 898 | + if(t.getDate().equals(s)){ | |
| 899 | + newList.add(t); | |
| 900 | + } | |
| 901 | + } | |
| 902 | + | |
| 903 | + if(newList.size()>0){ | |
| 904 | + Map<String, Object> newmap=culateByLine(newList); | |
| 905 | + listmap.add(newmap); | |
| 906 | + } | |
| 907 | + } | |
| 908 | + return listmap; | |
| 909 | + } | |
| 910 | + | |
| 784 | 911 | |
| 785 | 912 | } |
| 786 | 913 | class ComparableAcual implements Comparator<ScheduleRealInfo>{ | ... | ... |
src/main/java/com/bsth/service/traffic/YgcBasicDataService.java
| 1 | -package com.bsth.service.traffic; | |
| 2 | - | |
| 3 | -/** | |
| 4 | - * 运管处基础数据操作接口类 | |
| 5 | - * Created by zlz on 2017/6/16. | |
| 6 | - */ | |
| 7 | -public interface YgcBasicDataService { | |
| 8 | - /** | |
| 9 | - * 更新运管处基础数据 | |
| 10 | - */ | |
| 11 | - void updateYgcBasicData(); | |
| 12 | -} | |
| 13 | - | |
| 1 | +package com.bsth.service.traffic; | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * 运管处基础数据操作接口类 | |
| 5 | + * Created by zlz on 2017/6/16. | |
| 6 | + */ | |
| 7 | +public interface YgcBasicDataService { | |
| 8 | + /** | |
| 9 | + * 更新运管处基础数据 | |
| 10 | + */ | |
| 11 | + void updateYgcBasicData(); | |
| 12 | +} | |
| 13 | + | ... | ... |
src/main/java/com/bsth/service/traffic/impl/YgcBasicDataServiceImpl.java
| 1 | -package com.bsth.service.traffic.impl; | |
| 2 | - | |
| 3 | -import com.bsth.service.impl.TrafficManageServiceImpl; | |
| 4 | -import com.bsth.service.traffic.YgcBasicDataService; | |
| 5 | -import com.bsth.util.db.DBUtils_oldSystem; | |
| 6 | -import org.apache.axiom.om.*; | |
| 7 | -import org.apache.axis2.addressing.EndpointReference; | |
| 8 | -import org.apache.axis2.client.Options; | |
| 9 | -import org.apache.axis2.client.ServiceClient; | |
| 10 | -import org.apache.commons.codec.digest.DigestUtils; | |
| 11 | -import org.slf4j.Logger; | |
| 12 | -import org.slf4j.LoggerFactory; | |
| 13 | -import org.springframework.beans.factory.annotation.Autowired; | |
| 14 | -import org.springframework.jdbc.core.BatchPreparedStatementSetter; | |
| 15 | -import org.springframework.jdbc.core.JdbcTemplate; | |
| 16 | -import org.springframework.stereotype.Service; | |
| 17 | -import org.w3c.dom.Document; | |
| 18 | -import org.w3c.dom.NodeList; | |
| 19 | - | |
| 20 | -import javax.activation.DataHandler; | |
| 21 | -import javax.xml.parsers.DocumentBuilder; | |
| 22 | -import javax.xml.parsers.DocumentBuilderFactory; | |
| 23 | -import java.io.*; | |
| 24 | -import java.sql.PreparedStatement; | |
| 25 | -import java.sql.SQLException; | |
| 26 | -import java.util.ArrayList; | |
| 27 | -import java.util.HashMap; | |
| 28 | -import java.util.List; | |
| 29 | -import java.util.zip.ZipEntry; | |
| 30 | -import java.util.zip.ZipFile; | |
| 31 | -import java.util.zip.ZipInputStream; | |
| 32 | - | |
| 33 | -/** | |
| 34 | - * 运管处基础数据操作类 | |
| 35 | - * Created by zq on 2017/6/15. | |
| 36 | - */ | |
| 37 | -@Service | |
| 38 | -public class YgcBasicDataServiceImpl implements YgcBasicDataService{ | |
| 39 | - Logger logger = LoggerFactory.getLogger(TrafficManageServiceImpl.class); | |
| 40 | - | |
| 41 | - @Autowired | |
| 42 | - JdbcTemplate jdbcTemplate; | |
| 43 | - | |
| 44 | - private static String IP = "218.242.195.76:9091"; | |
| 45 | - private static String targetEndpoint = "http://" + IP +"/ygc.TransManager.Basicdown?wsdl"; | |
| 46 | - private static String namespace = "http://service.shygc.com"; | |
| 47 | - private static String userName = "admin"; | |
| 48 | - private static String passWord = "000000"; | |
| 49 | - private static EndpointReference targetEPR; | |
| 50 | - { | |
| 51 | - try { | |
| 52 | - targetEPR = new EndpointReference(targetEndpoint); | |
| 53 | - } catch (Exception e) { | |
| 54 | - e.printStackTrace(); | |
| 55 | - } | |
| 56 | - } | |
| 57 | - | |
| 58 | - /** | |
| 59 | - * 更新运管处基础数据 | |
| 60 | - */ | |
| 61 | - public void updateYgcBasicData(){ | |
| 62 | - String saveFile = "ygcBasicData.zip"; | |
| 63 | - String flag = "failure"; | |
| 64 | - try { | |
| 65 | - // 调用接口下载基础数据 | |
| 66 | - if(download(userName, DigestUtils.md5Hex(passWord), saveFile)){ | |
| 67 | - // 读取基础数据zip | |
| 68 | - StringBuffer sb = readZipFile(saveFile); | |
| 69 | - // 解析xml | |
| 70 | - List<HashMap<String,String>> result = parseXml(sb); | |
| 71 | - // 插入数据库 | |
| 72 | - if(result != null && result.size() > 0){ | |
| 73 | - insertRecord(result); | |
| 74 | - } | |
| 75 | - } | |
| 76 | - flag = "success"; | |
| 77 | - }catch (Exception e){ | |
| 78 | - e.printStackTrace(); | |
| 79 | - } | |
| 80 | - finally { | |
| 81 | - // 删除文件 | |
| 82 | - File fill = new File(saveFile); | |
| 83 | - logger.info("updateYgcBasicData:"+fill.getAbsolutePath()); | |
| 84 | - logger.info("updateYgcBasicData:"+flag); | |
| 85 | - if(fill.exists()){ | |
| 86 | - fill.delete(); | |
| 87 | - } | |
| 88 | - } | |
| 89 | - } | |
| 90 | - /** | |
| 91 | - * 下载基础数据,并生成rar文件 | |
| 92 | - * @param userName | |
| 93 | - * @param password | |
| 94 | - * @param saveFile | |
| 95 | - * @return | |
| 96 | - */ | |
| 97 | - private boolean download(String userName, String password, String saveFile) | |
| 98 | - { | |
| 99 | - try | |
| 100 | - { | |
| 101 | - OMElement data = buildDownloadEnvelope(userName, password); | |
| 102 | - ServiceClient sender = new ServiceClient(); | |
| 103 | - Options options = sender.getOptions(); | |
| 104 | - options.setProperty("SO_TIMEOUT", Integer.valueOf(1800000)); | |
| 105 | - options.setTo(targetEPR); | |
| 106 | - sender.setOptions(options); | |
| 107 | - System.out.println("The data in method download: " + data); | |
| 108 | - data.build(); | |
| 109 | - OMElement ome = sender.sendReceive(data); | |
| 110 | - | |
| 111 | - OMText binaryNode = (OMText)ome.getFirstOMChild(); | |
| 112 | - binaryNode.setOptimize(true); | |
| 113 | - DataHandler actualDH = (DataHandler)binaryNode.getDataHandler(); | |
| 114 | - FileOutputStream imageOutStream = new FileOutputStream(saveFile); | |
| 115 | - InputStream is = actualDH.getInputStream(); | |
| 116 | - int read ; | |
| 117 | - byte[] buffer = new byte[1024]; | |
| 118 | - while ((read = is.read(buffer)) != -1) { | |
| 119 | - imageOutStream.write(buffer, 0, read); | |
| 120 | - } | |
| 121 | - return true; | |
| 122 | - } catch (Exception e) { | |
| 123 | - e.printStackTrace(); | |
| 124 | - }return false; | |
| 125 | - } | |
| 126 | - | |
| 127 | - /** | |
| 128 | - * 构建webservice接口参数 | |
| 129 | - * @param userName | |
| 130 | - * @param password | |
| 131 | - * @return | |
| 132 | - */ | |
| 133 | - private OMElement buildDownloadEnvelope(String userName, String password) | |
| 134 | - { | |
| 135 | - OMFactory fac = OMAbstractFactory.getOMFactory(); | |
| 136 | - OMNamespace omNs = fac.createOMNamespace(namespace, | |
| 137 | - "ser"); | |
| 138 | - OMElement data = fac.createOMElement("downloadAllDataFile", omNs); | |
| 139 | - OMElement _userName = fac.createOMElement("userName", omNs); | |
| 140 | - _userName.setText(userName); | |
| 141 | - OMElement _passWord = fac.createOMElement("passWord", omNs); | |
| 142 | - _passWord.setText(String.valueOf(password)); | |
| 143 | - | |
| 144 | - data.addChild(_userName); | |
| 145 | - data.addChild(_passWord); | |
| 146 | - | |
| 147 | - OMElement soap = fac.createOMElement("downloadAllDataFile", omNs); | |
| 148 | - soap.addChild(data); | |
| 149 | - return soap; | |
| 150 | - } | |
| 151 | - | |
| 152 | - /** | |
| 153 | - * 读取zip文件的内容 | |
| 154 | - * @param file | |
| 155 | - * @return | |
| 156 | - * @throws Exception | |
| 157 | - */ | |
| 158 | - public StringBuffer readZipFile(String file) throws Exception { | |
| 159 | - ZipFile zf = new ZipFile(file); | |
| 160 | - InputStream in = new BufferedInputStream(new FileInputStream(file)); | |
| 161 | - ZipInputStream zin = new ZipInputStream(in); | |
| 162 | - ZipEntry ze; | |
| 163 | - StringBuffer sb = new StringBuffer(); | |
| 164 | - while ((ze = zin.getNextEntry()) != null) { | |
| 165 | - System.out.print(ze); | |
| 166 | - if (ze.isDirectory()) { | |
| 167 | - } else { | |
| 168 | - System.err.println("file - " + ze.getName() + " : " | |
| 169 | - + ze.getSize() + " bytes"); | |
| 170 | - long size = ze.getSize(); | |
| 171 | - if (size > 0) { | |
| 172 | - BufferedReader br = new BufferedReader( | |
| 173 | - new InputStreamReader(zf.getInputStream(ze),"GBK")); | |
| 174 | - String line; | |
| 175 | - boolean addFlag = false; | |
| 176 | - while ((line = br.readLine()) != null) { | |
| 177 | - if(line.indexOf("BusLineList") != -1){ | |
| 178 | - addFlag = true; | |
| 179 | - } | |
| 180 | - if(addFlag){ | |
| 181 | - sb.append(line); | |
| 182 | - } | |
| 183 | - | |
| 184 | - if(line.indexOf("/BusLineList") != -1){ | |
| 185 | - break; | |
| 186 | - } | |
| 187 | - } | |
| 188 | - br.close(); | |
| 189 | - } | |
| 190 | - } | |
| 191 | - } | |
| 192 | - zin.closeEntry(); | |
| 193 | - return sb; | |
| 194 | - } | |
| 195 | - | |
| 196 | - /** | |
| 197 | - * 解析xml | |
| 198 | - * @param sb | |
| 199 | - */ | |
| 200 | - private List<HashMap<String,String>> parseXml(StringBuffer sb){ | |
| 201 | - List<HashMap<String,String>> list = new ArrayList<>(); | |
| 202 | - HashMap<String,String> map; | |
| 203 | - try { | |
| 204 | - DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); | |
| 205 | - DocumentBuilder builder = factory.newDocumentBuilder(); | |
| 206 | - Document doc = builder.parse(new ByteArrayInputStream(sb.toString().getBytes())); | |
| 207 | - NodeList nl = doc.getElementsByTagName("BusLine"); | |
| 208 | - String lineName; //线路名称 | |
| 209 | - String lineId; // 线路ID | |
| 210 | - String abbreviation ; // 公司名称 | |
| 211 | - String ddfs ; // 调度方式 | |
| 212 | - String lineStandardCode; // 上海市线路编码 | |
| 213 | - String parentUnitName ; // 总公司 | |
| 214 | - for (int i = 0; i < nl.getLength(); i++) { | |
| 215 | - parentUnitName = doc.getElementsByTagName("ParentUnitName").item(i).getFirstChild() == null ?"": | |
| 216 | - doc.getElementsByTagName("ParentUnitName").item(i).getFirstChild().getNodeValue(); | |
| 217 | - if(parentUnitName.indexOf("浦东") != -1){// 只查找浦东的数据 | |
| 218 | - lineName = doc.getElementsByTagName("LineName").item(i).getFirstChild() == null ?"": | |
| 219 | - doc.getElementsByTagName("LineName").item(i).getFirstChild().getNodeValue(); | |
| 220 | - lineId = doc.getElementsByTagName("LineId").item(i).getFirstChild() == null ?"": | |
| 221 | - doc.getElementsByTagName("LineId").item(i).getFirstChild().getNodeValue(); | |
| 222 | - abbreviation = doc.getElementsByTagName("Abbreviation").item(i).getFirstChild() == null ?"": | |
| 223 | - doc.getElementsByTagName("Abbreviation").item(i).getFirstChild().getNodeValue(); | |
| 224 | - ddfs = doc.getElementsByTagName("DDFS").item(i).getFirstChild() == null ?"": | |
| 225 | - doc.getElementsByTagName("DDFS").item(i).getFirstChild().getNodeValue(); | |
| 226 | - lineStandardCode = doc.getElementsByTagName("LineStandardCode").item(i).getFirstChild() == null ?"": | |
| 227 | - doc.getElementsByTagName("LineStandardCode").item(i).getFirstChild().getNodeValue(); | |
| 228 | - map = new HashMap<>(); | |
| 229 | - map.put("lineName",lineName); | |
| 230 | - map.put("lineId",lineId); | |
| 231 | - map.put("abbreviation",abbreviation); | |
| 232 | - map.put("ddfs",ddfs); | |
| 233 | - map.put("lineStandardCode",lineStandardCode); | |
| 234 | - list.add(map); | |
| 235 | - } | |
| 236 | - } | |
| 237 | - }catch (Exception e){ | |
| 238 | - e.printStackTrace();; | |
| 239 | - } | |
| 240 | - return list; | |
| 241 | - } | |
| 242 | - | |
| 243 | - /** | |
| 244 | - * 批量插入用法 | |
| 245 | - * @param list | |
| 246 | - */ | |
| 247 | - public boolean insertRecord(List<HashMap<String,String>> list) | |
| 248 | - { | |
| 249 | - boolean flag = false; | |
| 250 | - final List<HashMap<String,String>> tempList=list; | |
| 251 | - String sql="INSERT INTO JJWGPS_T_SHSXLFILE(XLID,SHSXLBM,XLMC,GSMC,DDFS,CREATETIME,XLMC_ALL) VALUES (?,?,?,?,?,SYSDATE,?)"; | |
| 252 | - jdbcTemplate = new JdbcTemplate(DBUtils_oldSystem.getDataSource()); | |
| 253 | - jdbcTemplate.batchUpdate(sql, new BatchPreparedStatementSetter() | |
| 254 | - { | |
| 255 | - public void setValues(PreparedStatement ps, int i)throws SQLException | |
| 256 | - { | |
| 257 | - String lineId =tempList.get(i).get("lineId"); | |
| 258 | - String lineStandardCode =tempList.get(i).get("lineStandardCode"); | |
| 259 | - String lineName =tempList.get(i).get("lineName"); | |
| 260 | - String abbreviation =tempList.get(i).get("abbreviation"); | |
| 261 | - String ddfs =tempList.get(i).get("ddfs"); | |
| 262 | - String lineNameAll = lineName; | |
| 263 | - if(ddfs.equals("2")){ | |
| 264 | - lineNameAll = lineName+"区间(走向部分在全程线路之外)"; | |
| 265 | - }else if(ddfs.equals("7")){ | |
| 266 | - lineNameAll = lineName+"区间(走向在全程线路之内)"; | |
| 267 | - } | |
| 268 | - ps.setString(1, lineId); | |
| 269 | - ps.setString(2, lineStandardCode); | |
| 270 | - ps.setString(3, lineName); | |
| 271 | - ps.setString(4, abbreviation); | |
| 272 | - ps.setString(5, ddfs); | |
| 273 | - ps.setString(6, lineNameAll); | |
| 274 | - } | |
| 275 | - public int getBatchSize() | |
| 276 | - { | |
| 277 | - return tempList.size(); | |
| 278 | - } | |
| 279 | - }); | |
| 280 | - flag = true; | |
| 281 | - return flag; | |
| 282 | - } | |
| 283 | -} | |
| 1 | +package com.bsth.service.traffic.impl; | |
| 2 | + | |
| 3 | +import com.bsth.service.impl.TrafficManageServiceImpl; | |
| 4 | +import com.bsth.service.traffic.YgcBasicDataService; | |
| 5 | +import com.bsth.util.db.DBUtils_oldSystem; | |
| 6 | +import org.apache.axiom.om.*; | |
| 7 | +import org.apache.axis2.addressing.EndpointReference; | |
| 8 | +import org.apache.axis2.client.Options; | |
| 9 | +import org.apache.axis2.client.ServiceClient; | |
| 10 | +import org.apache.commons.codec.digest.DigestUtils; | |
| 11 | +import org.slf4j.Logger; | |
| 12 | +import org.slf4j.LoggerFactory; | |
| 13 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 14 | +import org.springframework.jdbc.core.BatchPreparedStatementSetter; | |
| 15 | +import org.springframework.jdbc.core.JdbcTemplate; | |
| 16 | +import org.springframework.stereotype.Service; | |
| 17 | +import org.w3c.dom.Document; | |
| 18 | +import org.w3c.dom.NodeList; | |
| 19 | + | |
| 20 | +import javax.activation.DataHandler; | |
| 21 | +import javax.xml.parsers.DocumentBuilder; | |
| 22 | +import javax.xml.parsers.DocumentBuilderFactory; | |
| 23 | +import java.io.*; | |
| 24 | +import java.sql.PreparedStatement; | |
| 25 | +import java.sql.SQLException; | |
| 26 | +import java.util.ArrayList; | |
| 27 | +import java.util.HashMap; | |
| 28 | +import java.util.List; | |
| 29 | +import java.util.zip.ZipEntry; | |
| 30 | +import java.util.zip.ZipFile; | |
| 31 | +import java.util.zip.ZipInputStream; | |
| 32 | + | |
| 33 | +/** | |
| 34 | + * 运管处基础数据操作类 | |
| 35 | + * Created by zq on 2017/6/15. | |
| 36 | + */ | |
| 37 | +@Service | |
| 38 | +public class YgcBasicDataServiceImpl implements YgcBasicDataService{ | |
| 39 | + Logger logger = LoggerFactory.getLogger(TrafficManageServiceImpl.class); | |
| 40 | + | |
| 41 | + @Autowired | |
| 42 | + JdbcTemplate jdbcTemplate; | |
| 43 | + | |
| 44 | + private static String IP = "218.242.195.76:9091"; | |
| 45 | + private static String targetEndpoint = "http://" + IP +"/ygc.TransManager.Basicdown?wsdl"; | |
| 46 | + private static String namespace = "http://service.shygc.com"; | |
| 47 | + private static String userName = "admin"; | |
| 48 | + private static String passWord = "000000"; | |
| 49 | + private static EndpointReference targetEPR; | |
| 50 | + { | |
| 51 | + try { | |
| 52 | + targetEPR = new EndpointReference(targetEndpoint); | |
| 53 | + } catch (Exception e) { | |
| 54 | + e.printStackTrace(); | |
| 55 | + } | |
| 56 | + } | |
| 57 | + | |
| 58 | + /** | |
| 59 | + * 更新运管处基础数据 | |
| 60 | + */ | |
| 61 | + public void updateYgcBasicData(){ | |
| 62 | + String saveFile = "ygcBasicData.zip"; | |
| 63 | + String flag = "failure"; | |
| 64 | + try { | |
| 65 | + // 调用接口下载基础数据 | |
| 66 | + if(download(userName, DigestUtils.md5Hex(passWord), saveFile)){ | |
| 67 | + // 读取基础数据zip | |
| 68 | + StringBuffer sb = readZipFile(saveFile); | |
| 69 | + // 解析xml | |
| 70 | + List<HashMap<String,String>> result = parseXml(sb); | |
| 71 | + // 插入数据库 | |
| 72 | + if(result != null && result.size() > 0){ | |
| 73 | + insertRecord(result); | |
| 74 | + } | |
| 75 | + } | |
| 76 | + flag = "success"; | |
| 77 | + }catch (Exception e){ | |
| 78 | + e.printStackTrace(); | |
| 79 | + } | |
| 80 | + finally { | |
| 81 | + // 删除文件 | |
| 82 | + File fill = new File(saveFile); | |
| 83 | + logger.info("updateYgcBasicData:"+fill.getAbsolutePath()); | |
| 84 | + logger.info("updateYgcBasicData:"+flag); | |
| 85 | + if(fill.exists()){ | |
| 86 | + fill.delete(); | |
| 87 | + } | |
| 88 | + } | |
| 89 | + } | |
| 90 | + /** | |
| 91 | + * 下载基础数据,并生成rar文件 | |
| 92 | + * @param userName | |
| 93 | + * @param password | |
| 94 | + * @param saveFile | |
| 95 | + * @return | |
| 96 | + */ | |
| 97 | + private boolean download(String userName, String password, String saveFile) | |
| 98 | + { | |
| 99 | + try | |
| 100 | + { | |
| 101 | + OMElement data = buildDownloadEnvelope(userName, password); | |
| 102 | + ServiceClient sender = new ServiceClient(); | |
| 103 | + Options options = sender.getOptions(); | |
| 104 | + options.setProperty("SO_TIMEOUT", Integer.valueOf(1800000)); | |
| 105 | + options.setTo(targetEPR); | |
| 106 | + sender.setOptions(options); | |
| 107 | + System.out.println("The data in method download: " + data); | |
| 108 | + data.build(); | |
| 109 | + OMElement ome = sender.sendReceive(data); | |
| 110 | + | |
| 111 | + OMText binaryNode = (OMText)ome.getFirstOMChild(); | |
| 112 | + binaryNode.setOptimize(true); | |
| 113 | + DataHandler actualDH = (DataHandler)binaryNode.getDataHandler(); | |
| 114 | + FileOutputStream imageOutStream = new FileOutputStream(saveFile); | |
| 115 | + InputStream is = actualDH.getInputStream(); | |
| 116 | + int read ; | |
| 117 | + byte[] buffer = new byte[1024]; | |
| 118 | + while ((read = is.read(buffer)) != -1) { | |
| 119 | + imageOutStream.write(buffer, 0, read); | |
| 120 | + } | |
| 121 | + return true; | |
| 122 | + } catch (Exception e) { | |
| 123 | + e.printStackTrace(); | |
| 124 | + }return false; | |
| 125 | + } | |
| 126 | + | |
| 127 | + /** | |
| 128 | + * 构建webservice接口参数 | |
| 129 | + * @param userName | |
| 130 | + * @param password | |
| 131 | + * @return | |
| 132 | + */ | |
| 133 | + private OMElement buildDownloadEnvelope(String userName, String password) | |
| 134 | + { | |
| 135 | + OMFactory fac = OMAbstractFactory.getOMFactory(); | |
| 136 | + OMNamespace omNs = fac.createOMNamespace(namespace, | |
| 137 | + "ser"); | |
| 138 | + OMElement data = fac.createOMElement("downloadAllDataFile", omNs); | |
| 139 | + OMElement _userName = fac.createOMElement("userName", omNs); | |
| 140 | + _userName.setText(userName); | |
| 141 | + OMElement _passWord = fac.createOMElement("passWord", omNs); | |
| 142 | + _passWord.setText(String.valueOf(password)); | |
| 143 | + | |
| 144 | + data.addChild(_userName); | |
| 145 | + data.addChild(_passWord); | |
| 146 | + | |
| 147 | + OMElement soap = fac.createOMElement("downloadAllDataFile", omNs); | |
| 148 | + soap.addChild(data); | |
| 149 | + return soap; | |
| 150 | + } | |
| 151 | + | |
| 152 | + /** | |
| 153 | + * 读取zip文件的内容 | |
| 154 | + * @param file | |
| 155 | + * @return | |
| 156 | + * @throws Exception | |
| 157 | + */ | |
| 158 | + public StringBuffer readZipFile(String file) throws Exception { | |
| 159 | + ZipFile zf = new ZipFile(file); | |
| 160 | + InputStream in = new BufferedInputStream(new FileInputStream(file)); | |
| 161 | + ZipInputStream zin = new ZipInputStream(in); | |
| 162 | + ZipEntry ze; | |
| 163 | + StringBuffer sb = new StringBuffer(); | |
| 164 | + while ((ze = zin.getNextEntry()) != null) { | |
| 165 | + System.out.print(ze); | |
| 166 | + if (ze.isDirectory()) { | |
| 167 | + } else { | |
| 168 | + System.err.println("file - " + ze.getName() + " : " | |
| 169 | + + ze.getSize() + " bytes"); | |
| 170 | + long size = ze.getSize(); | |
| 171 | + if (size > 0) { | |
| 172 | + BufferedReader br = new BufferedReader( | |
| 173 | + new InputStreamReader(zf.getInputStream(ze),"GBK")); | |
| 174 | + String line; | |
| 175 | + boolean addFlag = false; | |
| 176 | + while ((line = br.readLine()) != null) { | |
| 177 | + if(line.indexOf("BusLineList") != -1){ | |
| 178 | + addFlag = true; | |
| 179 | + } | |
| 180 | + if(addFlag){ | |
| 181 | + sb.append(line); | |
| 182 | + } | |
| 183 | + | |
| 184 | + if(line.indexOf("/BusLineList") != -1){ | |
| 185 | + break; | |
| 186 | + } | |
| 187 | + } | |
| 188 | + br.close(); | |
| 189 | + } | |
| 190 | + } | |
| 191 | + } | |
| 192 | + zin.closeEntry(); | |
| 193 | + return sb; | |
| 194 | + } | |
| 195 | + | |
| 196 | + /** | |
| 197 | + * 解析xml | |
| 198 | + * @param sb | |
| 199 | + */ | |
| 200 | + private List<HashMap<String,String>> parseXml(StringBuffer sb){ | |
| 201 | + List<HashMap<String,String>> list = new ArrayList<>(); | |
| 202 | + HashMap<String,String> map; | |
| 203 | + try { | |
| 204 | + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); | |
| 205 | + DocumentBuilder builder = factory.newDocumentBuilder(); | |
| 206 | + Document doc = builder.parse(new ByteArrayInputStream(sb.toString().getBytes())); | |
| 207 | + NodeList nl = doc.getElementsByTagName("BusLine"); | |
| 208 | + String lineName; //线路名称 | |
| 209 | + String lineId; // 线路ID | |
| 210 | + String abbreviation ; // 公司名称 | |
| 211 | + String ddfs ; // 调度方式 | |
| 212 | + String lineStandardCode; // 上海市线路编码 | |
| 213 | + String parentUnitName ; // 总公司 | |
| 214 | + for (int i = 0; i < nl.getLength(); i++) { | |
| 215 | + parentUnitName = doc.getElementsByTagName("ParentUnitName").item(i).getFirstChild() == null ?"": | |
| 216 | + doc.getElementsByTagName("ParentUnitName").item(i).getFirstChild().getNodeValue(); | |
| 217 | + if(parentUnitName.indexOf("浦东") != -1){// 只查找浦东的数据 | |
| 218 | + lineName = doc.getElementsByTagName("LineName").item(i).getFirstChild() == null ?"": | |
| 219 | + doc.getElementsByTagName("LineName").item(i).getFirstChild().getNodeValue(); | |
| 220 | + lineId = doc.getElementsByTagName("LineId").item(i).getFirstChild() == null ?"": | |
| 221 | + doc.getElementsByTagName("LineId").item(i).getFirstChild().getNodeValue(); | |
| 222 | + abbreviation = doc.getElementsByTagName("Abbreviation").item(i).getFirstChild() == null ?"": | |
| 223 | + doc.getElementsByTagName("Abbreviation").item(i).getFirstChild().getNodeValue(); | |
| 224 | + ddfs = doc.getElementsByTagName("DDFS").item(i).getFirstChild() == null ?"": | |
| 225 | + doc.getElementsByTagName("DDFS").item(i).getFirstChild().getNodeValue(); | |
| 226 | + lineStandardCode = doc.getElementsByTagName("LineStandardCode").item(i).getFirstChild() == null ?"": | |
| 227 | + doc.getElementsByTagName("LineStandardCode").item(i).getFirstChild().getNodeValue(); | |
| 228 | + map = new HashMap<>(); | |
| 229 | + map.put("lineName",lineName); | |
| 230 | + map.put("lineId",lineId); | |
| 231 | + map.put("abbreviation",abbreviation); | |
| 232 | + map.put("ddfs",ddfs); | |
| 233 | + map.put("lineStandardCode",lineStandardCode); | |
| 234 | + list.add(map); | |
| 235 | + } | |
| 236 | + } | |
| 237 | + }catch (Exception e){ | |
| 238 | + e.printStackTrace();; | |
| 239 | + } | |
| 240 | + return list; | |
| 241 | + } | |
| 242 | + | |
| 243 | + /** | |
| 244 | + * 批量插入用法 | |
| 245 | + * @param list | |
| 246 | + */ | |
| 247 | + public boolean insertRecord(List<HashMap<String,String>> list) | |
| 248 | + { | |
| 249 | + boolean flag = false; | |
| 250 | + final List<HashMap<String,String>> tempList=list; | |
| 251 | + String sql="INSERT INTO JJWGPS_T_SHSXLFILE(XLID,SHSXLBM,XLMC,GSMC,DDFS,CREATETIME,XLMC_ALL) VALUES (?,?,?,?,?,SYSDATE,?)"; | |
| 252 | + jdbcTemplate = new JdbcTemplate(DBUtils_oldSystem.getDataSource()); | |
| 253 | + jdbcTemplate.batchUpdate(sql, new BatchPreparedStatementSetter() | |
| 254 | + { | |
| 255 | + public void setValues(PreparedStatement ps, int i)throws SQLException | |
| 256 | + { | |
| 257 | + String lineId =tempList.get(i).get("lineId"); | |
| 258 | + String lineStandardCode =tempList.get(i).get("lineStandardCode"); | |
| 259 | + String lineName =tempList.get(i).get("lineName"); | |
| 260 | + String abbreviation =tempList.get(i).get("abbreviation"); | |
| 261 | + String ddfs =tempList.get(i).get("ddfs"); | |
| 262 | + String lineNameAll = lineName; | |
| 263 | + if(ddfs.equals("2")){ | |
| 264 | + lineNameAll = lineName+"区间(走向部分在全程线路之外)"; | |
| 265 | + }else if(ddfs.equals("7")){ | |
| 266 | + lineNameAll = lineName+"区间(走向在全程线路之内)"; | |
| 267 | + } | |
| 268 | + ps.setString(1, lineId); | |
| 269 | + ps.setString(2, lineStandardCode); | |
| 270 | + ps.setString(3, lineName); | |
| 271 | + ps.setString(4, abbreviation); | |
| 272 | + ps.setString(5, ddfs); | |
| 273 | + ps.setString(6, lineNameAll); | |
| 274 | + } | |
| 275 | + public int getBatchSize() | |
| 276 | + { | |
| 277 | + return tempList.size(); | |
| 278 | + } | |
| 279 | + }); | |
| 280 | + flag = true; | |
| 281 | + return flag; | |
| 282 | + } | |
| 283 | +} | ... | ... |
src/main/resources/static/pages/forms/mould/correctForm.xls
No preview for this file type
src/main/resources/static/pages/forms/mould/inoutstation.xls
No preview for this file type
src/main/resources/static/pages/forms/statement/correctForm.html
| ... | ... | @@ -32,13 +32,13 @@ |
| 32 | 32 | <select class="form-control" name="line" id="line" style="width: 136px;"></select> |
| 33 | 33 | </div> |
| 34 | 34 | <div style="display: inline-block;margin-left: 15px;"> |
| 35 | - <span class="item-label" style="width: 80px;">时间: </span> | |
| 35 | + <span class="item-label" style="width: 80px;">开始时间: </span> | |
| 36 | 36 | <input class="form-control" type="text" id="date" style="width: 120px;"/> |
| 37 | 37 | </div> |
| 38 | -<!-- <div style="display: inline-block;margin-left: 15px;"> --> | |
| 39 | -<!-- <span class="item-label" style="width: 80px;">结束时间: </span> --> | |
| 40 | -<!-- <input class="form-control" type="text" id="endDate" style="width: 120px;"/> --> | |
| 41 | -<!-- </div> --> | |
| 38 | + <div style="display: inline-block;margin-left: 15px;"> | |
| 39 | + <span class="item-label" style="width: 80px;">结束时间: </span> | |
| 40 | + <input class="form-control" type="text" id="endDate" style="width: 120px;"/> | |
| 41 | + </div> | |
| 42 | 42 | <div style="display: inline-block;margin-left: 15px"> |
| 43 | 43 | <span class="item-label" style="width: 140px;">路牌: </span> |
| 44 | 44 | <select class="form-control" name="lpName" id="lpName" style="width: 136px;"></select> |
| ... | ... | @@ -59,10 +59,11 @@ |
| 59 | 59 | <table class="table table-bordered table-hover table-checkable" id="forms"> |
| 60 | 60 | <thead> |
| 61 | 61 | <tr> |
| 62 | - <th colspan="6">营运车辆修正统计表</th> | |
| 62 | + <th colspan="7">营运车辆修正统计表</th> | |
| 63 | 63 | </tr> |
| 64 | 64 | <tr> |
| 65 | 65 | <td>编号</td> |
| 66 | + <td>日期</td> | |
| 66 | 67 | <td>路牌</td> |
| 67 | 68 | <td>车号</td> |
| 68 | 69 | <td>司机</td> |
| ... | ... | @@ -96,6 +97,10 @@ |
| 96 | 97 | format : 'YYYY-MM-DD', |
| 97 | 98 | locale : 'zh-cn' |
| 98 | 99 | }); |
| 100 | + $("#endDate").datetimepicker({ | |
| 101 | + format : 'YYYY-MM-DD', | |
| 102 | + locale : 'zh-cn' | |
| 103 | + }); | |
| 99 | 104 | var d = new Date(); |
| 100 | 105 | var year = d.getFullYear(); |
| 101 | 106 | var month = d.getMonth() + 1; |
| ... | ... | @@ -105,6 +110,7 @@ |
| 105 | 110 | if(day < 10) |
| 106 | 111 | day = "0" + day; |
| 107 | 112 | $("#date").val(year + "-" + month + "-" + day); |
| 113 | + $("#endDate").val(year + "-" + month + "-" + day); | |
| 108 | 114 | |
| 109 | 115 | $.get('/basic/lineCode2Name',function(result){ |
| 110 | 116 | var data=[]; |
| ... | ... | @@ -197,16 +203,18 @@ |
| 197 | 203 | }); |
| 198 | 204 | |
| 199 | 205 | var line = $("#line").val(); |
| 200 | - var date = $("#startDate").val(); | |
| 206 | + var date = $("#date").val();endDate | |
| 201 | 207 | var lpName = $("#lpName").val(); |
| 208 | + var endDate = $("#endDate").val(); | |
| 202 | 209 | var code = $("#code").val(); |
| 203 | 210 | $("#query").on("click",function(){ |
| 204 | 211 | line = $("#line").val(); |
| 205 | 212 | date = $("#date").val(); |
| 206 | 213 | lpName = $("#lpName").val(); |
| 207 | 214 | code = $("#code").val(); |
| 215 | + endDate = $("#endDate").val(); | |
| 208 | 216 | var type = "query"; |
| 209 | - $get("/realSchedule/correctForm",{line:line,date:date,lpName:lpName,code:code,type:type},function(result){ | |
| 217 | + $get("/realSchedule/correctForm",{line:line,date:date,endDate:endDate,lpName:lpName,code:code,type:type},function(result){ | |
| 210 | 218 | var list_correctForm = template('list_correctForm',{list:result}); |
| 211 | 219 | // 把渲染好的模版html文本追加到表格中 |
| 212 | 220 | $('#forms .list_correctForm').html(list_correctForm); |
| ... | ... | @@ -224,7 +232,7 @@ |
| 224 | 232 | |
| 225 | 233 | $("#export").on("click",function(){ |
| 226 | 234 | var type = "export"; |
| 227 | - $get('/realSchedule/correctForm',{line:line,date:date,lpName:lpName,code:code,type:type},function(result){ | |
| 235 | + $get('/realSchedule/correctForm',{line:line,date:date,endDate:endDate,lpName:lpName,code:code,type:type},function(result){ | |
| 228 | 236 | window.open("/downloadFile/download?fileName=修正报表"+date); |
| 229 | 237 | }); |
| 230 | 238 | }); |
| ... | ... | @@ -234,7 +242,8 @@ |
| 234 | 242 | <script type="text/html" id="list_correctForm"> |
| 235 | 243 | {{each list as obj i}} |
| 236 | 244 | <tr> |
| 237 | - <td>{{i+1}}</td> | |
| 245 | + <td>{{i+1}}</td> | |
| 246 | + <td>{{obj.rq}}</td> | |
| 238 | 247 | <td>{{obj.lpName}}</td> |
| 239 | 248 | <td>{{obj.clZbh}}</td> |
| 240 | 249 | <td>{{obj.jName}}/{{obj.jGh}}</td> |
| ... | ... | @@ -244,7 +253,7 @@ |
| 244 | 253 | {{/each}} |
| 245 | 254 | {{if list.length == 0}} |
| 246 | 255 | <tr> |
| 247 | - <td colspan="6"><h6 class="muted">没有找到相关数据</h6></td> | |
| 256 | + <td colspan="7"><h6 class="muted">没有找到相关数据</h6></td> | |
| 248 | 257 | </tr> |
| 249 | 258 | {{/if}} |
| 250 | 259 | </script> | ... | ... |
src/main/resources/static/pages/oil/add.html
| ... | ... | @@ -173,7 +173,7 @@ |
| 173 | 173 | <div class="row"> |
| 174 | 174 | <div class="col-md-offset-3 col-md-4"> |
| 175 | 175 | <button type="submit" class="btn green" ><i class="fa fa-check"></i> 提交</button> |
| 176 | - <a type="button" class="btn default" href="list.html" data-pjax><i class="fa fa-times"></i> 取消</a> | |
| 176 | + <a type="button" class="btn default" href="list_ph.html" data-pjax><i class="fa fa-times"></i> 取消</a> | |
| 177 | 177 | </div> |
| 178 | 178 | </div> |
| 179 | 179 | </div> | ... | ... |
src/main/resources/static/pages/report/inoutstation.html
| ... | ... | @@ -31,7 +31,7 @@ |
| 31 | 31 | <div style="display: inline-block;margin-left: 15px;"> |
| 32 | 32 | <input class="item-label" type="radio" name="typeLx" checked="checked" value="1" /> |
| 33 | 33 | 班次执行情况 |
| 34 | - <input class="item-label" type="radio" name="typeLX" value="2" /> | |
| 34 | + <input class="item-label" type="radio" name="typeLx" value="2" /> | |
| 35 | 35 | 车辆/站点 |
| 36 | 36 | </div> |
| 37 | 37 | <div style="display: inline-block; margin-left: 33px;" id="gsdmDiv"> |
| ... | ... | @@ -116,16 +116,17 @@ |
| 116 | 116 | <thead> |
| 117 | 117 | <tr> |
| 118 | 118 | <td width="3%"></td> |
| 119 | - <td width="9%">内部编码</td> | |
| 120 | - <td width="8%">到站名称</td> | |
| 121 | - <td width="8%">到站时刻</td> | |
| 122 | - <td width="8%">离站时刻</td> | |
| 123 | - <td width="8%">是否开关门</td> | |
| 124 | - <td width="8%">上下行</td> | |
| 119 | + <td width="8%">内部编码</td> | |
| 120 | + <td width="8%">牌照号</td> | |
| 121 | + <td width="7%">到站名称</td> | |
| 122 | + <td width="7%">到站时刻</td> | |
| 123 | + <td width="7%">离站时刻</td> | |
| 124 | + <td width="7%">是否开关门</td> | |
| 125 | + <td width="7%">上下行</td> | |
| 125 | 126 | <td width="8%">开门速度(公里/小时)</td> |
| 126 | - <td width="8%">补发</td> | |
| 127 | - <td width="8%">刷卡次数</td> | |
| 128 | - <td width="8%">刷卡金额</td> | |
| 127 | + <td width="7%">补发</td> | |
| 128 | + <td width="7%">刷卡次数</td> | |
| 129 | + <td width="7%">刷卡金额</td> | |
| 129 | 130 | <td width="8%">免费刷卡次数</td> |
| 130 | 131 | <td width="8%">免费刷卡金额</td> |
| 131 | 132 | </tr> |
| ... | ... | @@ -497,6 +498,7 @@ |
| 497 | 498 | <tr> |
| 498 | 499 | <td>{{i+1}}</td> |
| 499 | 500 | <td>{{obj.nbbm}}</td> |
| 501 | + <td>{{obj.pzh}}</td> | |
| 500 | 502 | <td>{{obj.stopName}}</td> |
| 501 | 503 | <td>{{obj.jzsj}}</td> |
| 502 | 504 | <td>{{obj.czsj}}</td> | ... | ... |
src/main/resources/static/pages/report/sheet/list.html
| ... | ... | @@ -18,7 +18,7 @@ |
| 18 | 18 | |
| 19 | 19 | <div class="page-head"> |
| 20 | 20 | <div class="page-title" style="margin-left: 20px"> |
| 21 | - <button>数据导出</button> | |
| 21 | + <button id="exportList">数据导出</button> | |
| 22 | 22 | </div> |
| 23 | 23 | </div> |
| 24 | 24 | |
| ... | ... | @@ -27,7 +27,7 @@ |
| 27 | 27 | <div class="portlet light porttlet-fit bordered"> |
| 28 | 28 | <div class="portlet-body"> |
| 29 | 29 | <div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 600px"> |
| 30 | - <table class="table table-bordered table-hover table-checkable" id="forms_1"> | |
| 30 | + <table class="table table-bordered table-hover table-checkable" id="forms_2"> | |
| 31 | 31 | <thead> |
| 32 | 32 | <tr> |
| 33 | 33 | <td></td> |
| ... | ... | @@ -40,7 +40,7 @@ |
| 40 | 40 | </tr> |
| 41 | 41 | </thead> |
| 42 | 42 | |
| 43 | - <tbody > | |
| 43 | + <tbody> | |
| 44 | 44 | |
| 45 | 45 | </tbody> |
| 46 | 46 | </table> |
| ... | ... | @@ -55,32 +55,28 @@ |
| 55 | 55 | // 关闭左侧栏 |
| 56 | 56 | if (!$('body').hasClass('page-sidebar-closed')) |
| 57 | 57 | $('.menu-toggler.sidebar-toggler').click(); |
| 58 | - | |
| 58 | + var no=""; | |
| 59 | 59 | $("#sheetList").on('init', function (e, id) { |
| 60 | + no=id; | |
| 60 | 61 | $get('/sheet/sheetList',{id:id},function(result){ |
| 61 | - var sheetList_1 = template('sheetList_1',{list:result}); | |
| 62 | - $('#forms_1 tbody').html(sheetList_1); | |
| 62 | + var sheetList_2 = template('sheetList_2',{list:result}); | |
| 63 | + $('#forms_2 tbody').html(sheetList_2); | |
| 63 | 64 | }); |
| 64 | 65 | }) |
| 65 | - /* $("#query").on('click',function(){ | |
| 66 | - var line = $("#line").val(); | |
| 67 | - var date = $("#date").val(); | |
| 68 | - var fgs=$('#fgsdm').val(); | |
| 69 | - var gs=$('#gsdm').val(); | |
| 70 | - $get('/sheet/countList',{line:line,date:date,gs:gs,fgs:fgs},function(result){ | |
| 71 | - var sheetList = template('sheetList',{list:result}); | |
| 72 | - $('#forms tbody').html(sheetList); | |
| 73 | - $('.btn-sheetList').on('click', openSheetList); | |
| 74 | - }); | |
| 75 | - }); */ | |
| 66 | + $("#exportList").on('click',function(){ | |
| 67 | + | |
| 68 | + $get('/sheet/exportList',params,function(result){ | |
| 69 | + window.open("/downloadFile/download?fileName=班次车辆人员月报表"+moment($("#startDate").val()).format("YYYYMMDD")); | |
| 70 | + }); | |
| 71 | + }); | |
| 76 | 72 | |
| 77 | 73 | |
| 78 | 74 | }); |
| 79 | 75 | </script> |
| 80 | -<script type="text/html" id="sheetList_1"> | |
| 76 | +<script type="text/html" id="sheetList_2"> | |
| 81 | 77 | {{each list as obj i}} |
| 82 | 78 | <tr {{if obj.sfzd!="Y"}}style="color: red" {{/if}}> |
| 83 | - <td>{{i}}</td> | |
| 79 | + <td>{{i+1}}</td> | |
| 84 | 80 | <td>{{obj.date}}</td> |
| 85 | 81 | <td>{{obj.line}}</td> |
| 86 | 82 | <td>{{obj.zdname}}</td> | ... | ... |
src/main/resources/static/pages/report/sheet/sheetList.html
| ... | ... | @@ -35,14 +35,20 @@ |
| 35 | 35 | <span class="item-label" style="width: 80px;">分公司: </span> |
| 36 | 36 | <select class="form-control" name="subCompany" id="fgsdm" style="width: 180px;"></select> |
| 37 | 37 | </div> |
| 38 | - <div style="display: inline-block;margin-left: 15px;"> | |
| 38 | + <div style="margin-top: 10px"> | |
| 39 | + </div> | |
| 40 | + <div style="display: inline-block;margin-left: 33px;"> | |
| 39 | 41 | <span class="item-label" style="width: 80px;">线路: </span> |
| 40 | 42 | <select class="form-control" name="line" id="line" style="width: 180px;"></select> |
| 41 | 43 | </div> |
| 42 | 44 | <div style="display: inline-block;"> |
| 43 | - <span class="item-label" style="width: 80px;">时间: </span> | |
| 45 | + <span class="item-label" style="width: 80px;margin-left: 24px;">开始时间: </span> | |
| 44 | 46 | <input class="form-control" type="text" id="date" style="width: 180px;"/> |
| 45 | 47 | </div> |
| 48 | + <div style="display: inline-block;"> | |
| 49 | + <span class="item-label" style="width: 80px;margin-left: 24px;">结束时间: </span> | |
| 50 | + <input class="form-control" type="text" id="endDate" style="width: 180px;"/> | |
| 51 | + </div> | |
| 46 | 52 | |
| 47 | 53 | <div class="form-group"> |
| 48 | 54 | <input class="btn btn-default" type="button" id="query" value="查询"/> |
| ... | ... | @@ -65,7 +71,28 @@ |
| 65 | 71 | </tr> |
| 66 | 72 | </thead> |
| 67 | 73 | |
| 68 | - <tbody > | |
| 74 | + <tbody> | |
| 75 | + | |
| 76 | + </tbody> | |
| 77 | + </table> | |
| 78 | + </div> | |
| 79 | + | |
| 80 | + <div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 906px"> | |
| 81 | + <table class="table table-bordered table-hover table-checkable" id="forms_1"> | |
| 82 | + <thead> | |
| 83 | + <tr class="hidden"> | |
| 84 | + <td>公司</td> | |
| 85 | + <td>分公司</td> | |
| 86 | + <td>日期</td> | |
| 87 | + <td>线路</td> | |
| 88 | + <td>班次数</td> | |
| 89 | + <td>准点班次数</td> | |
| 90 | + <td>准点率</td> | |
| 91 | + <td>查看</td> | |
| 92 | + </tr> | |
| 93 | + </thead> | |
| 94 | + | |
| 95 | + <tbody> | |
| 69 | 96 | |
| 70 | 97 | </tbody> |
| 71 | 98 | </table> |
| ... | ... | @@ -85,6 +112,10 @@ |
| 85 | 112 | format : 'YYYY-MM-DD', |
| 86 | 113 | locale : 'zh-cn' |
| 87 | 114 | }); |
| 115 | + $("#endDate").datetimepicker({ | |
| 116 | + format : 'YYYY-MM-DD', | |
| 117 | + locale : 'zh-cn' | |
| 118 | + }); | |
| 88 | 119 | var d = new Date(); |
| 89 | 120 | var year = d.getFullYear(); |
| 90 | 121 | var month = d.getMonth() + 1; |
| ... | ... | @@ -93,8 +124,10 @@ |
| 93 | 124 | day = "0"+day; |
| 94 | 125 | if(month > 9){ |
| 95 | 126 | $("#date").val(year + "-" + month + "-" + day); |
| 127 | + $("#endDate").val(year + "-" + month + "-" + day); | |
| 96 | 128 | } else { |
| 97 | 129 | $("#date").val(year + "-0" + month + "-" + day); |
| 130 | + $("#endDate").val(year + "-" + month + "-" + day); | |
| 98 | 131 | } |
| 99 | 132 | |
| 100 | 133 | var fage=false; |
| ... | ... | @@ -172,19 +205,34 @@ |
| 172 | 205 | $("#query").on('click',function(){ |
| 173 | 206 | var line = $("#line").val(); |
| 174 | 207 | var date = $("#date").val(); |
| 208 | + var endDate = $("#endDate").val(); | |
| 175 | 209 | var fgs=$('#fgsdm').val(); |
| 176 | 210 | var gs=$('#gsdm').val(); |
| 177 | - $get('/sheet/countList',{line:line,date:date,gs:gs,fgs:fgs},function(result){ | |
| 211 | + $get('/sheet/countList',{line:line,date:date,endDate:endDate,gs:gs,fgs:fgs},function(result){ | |
| 178 | 212 | var sheetList = template('sheetList',{list:result}); |
| 179 | 213 | $('#forms tbody').html(sheetList); |
| 180 | - $('.btn-sheetList').on('click', openSheetList); | |
| 214 | + $('.btn-sheetList').on('click', showSheetList); | |
| 181 | 215 | }); |
| 182 | 216 | // $post('/sheet/saveListSheet',function(result){ |
| 183 | 217 | // }); |
| 184 | 218 | }); |
| 185 | - | |
| 219 | + function showSheetList(){ | |
| 220 | + var id = $(this).data('id'); | |
| 221 | + var date = $("#date").val(); | |
| 222 | + var endDate = $("#endDate").val(); | |
| 223 | + $get('/sheet/listSheet',{id:id,date:date,endDate:endDate},function(result){ | |
| 224 | + var sheetList = template('sheetList_1',{list:result}); | |
| 225 | + | |
| 226 | + $('#forms_1 tbody').html(sheetList); | |
| 227 | + $('.btn-sheetList_1').on('click', openSheetList); | |
| 228 | + $("#forms_1 .hidden").removeClass("hidden"); | |
| 229 | + $("html,body").animate({scrollTop:$("#forms_1").offset().top},1000); | |
| 230 | + | |
| 231 | + }); | |
| 232 | + } | |
| 186 | 233 | function openSheetList(){ |
| 187 | 234 | var id = $(this).data('id'); |
| 235 | + console.log(id); | |
| 188 | 236 | $.get('/pages/report/sheet/list.html', function (content) { |
| 189 | 237 | layer.open({ |
| 190 | 238 | type: 1, |
| ... | ... | @@ -221,4 +269,27 @@ |
| 221 | 269 | <td colspan="7"><h6 class="muted">没有找到相关数据</h6></td> |
| 222 | 270 | </tr> |
| 223 | 271 | {{/if}} |
| 272 | +</script> | |
| 273 | + | |
| 274 | +<script type="text/html" id="sheetList_1"> | |
| 275 | + {{each list as obj i}} | |
| 276 | + <tr> | |
| 277 | + <td>{{obj.gs}}</td> | |
| 278 | + <td>{{obj.fgs}}</td> | |
| 279 | + <td>{{obj.date}}</td> | |
| 280 | + <td>{{obj.line}}</td> | |
| 281 | + <td>{{obj.bcs}}</td> | |
| 282 | + <td>{{obj.zdbcs}}</td> | |
| 283 | + <td>{{obj.zdlv}}</td> | |
| 284 | + <td> | |
| 285 | + <button type="button" class="btn btn-sm blue btn-sheetList_1" | |
| 286 | + data-id="{{obj.id}}">详细</button> | |
| 287 | + </td> | |
| 288 | + </tr> | |
| 289 | + {{/each}} | |
| 290 | + {{if list.length == 0}} | |
| 291 | + <tr> | |
| 292 | + <td colspan="7"><h6 class="muted">没有找到相关数据</h6></td> | |
| 293 | + </tr> | |
| 294 | + {{/if}} | |
| 224 | 295 | </script> |
| 225 | 296 | \ No newline at end of file | ... | ... |