Commit 0a494b99553648eab4342f147020fa5392214c7d

Authored by ljq
1 parent e6f34e32

线路基本信息接口 线路参数信息接口 线路走向接口 线路停靠站信息接口 车辆发车信息接口

... ... @@ -49,12 +49,46 @@
49 49 <groupId>org.springframework.boot</groupId>
50 50 <artifactId>spring-boot-starter-jdbc</artifactId>
51 51 </dependency>
52   -
  52 +
  53 + <dependency>
  54 + <groupId>org.apache.httpcomponents</groupId>
  55 + <artifactId>httpcore</artifactId>
  56 + <version>4.4.10</version>
  57 + </dependency>
  58 +
53 59 <dependency>
54 60 <groupId>joda-time</groupId>
55 61 <artifactId>joda-time</artifactId>
56 62 </dependency>
57   - </dependencies>
  63 +
  64 + <dependency>
  65 + <groupId>org.apache.httpcomponents</groupId>
  66 + <artifactId>httpclient</artifactId>
  67 + <version>4.5.6</version>
  68 + </dependency>
  69 +
  70 + <dependency>
  71 + <groupId>com.vaadin.external.google</groupId>
  72 + <artifactId>android-json</artifactId>
  73 + <version>0.0.20131108.vaadin1</version>
  74 + <scope>compile</scope>
  75 + </dependency>
  76 +
  77 + <dependency>
  78 + <groupId>com.vaadin.external.google</groupId>
  79 + <artifactId>android-json</artifactId>
  80 + <version>0.0.20131108.vaadin1</version>
  81 + <scope>compile</scope>
  82 + </dependency>
  83 +
  84 + <dependency>
  85 + <groupId>net.sf.json-lib</groupId>
  86 + <artifactId>json-lib</artifactId>
  87 + <version>2.4</version>
  88 + <classifier>jdk15</classifier>
  89 + </dependency>
  90 +
  91 + </dependencies>
58 92  
59 93 <build>
60 94 <plugins>
... ...
src/main/java/com/bsth/entity/Clfcxxb.java 0 → 100644
  1 +package com.bsth.entity;
  2 +
  3 +import javax.xml.crypto.Data;
  4 +
  5 +public class Clfcxxb {
  6 + private String rq;
  7 + private String lineCode;
  8 + private String lineName;
  9 + private String lineNameEs;
  10 + private String lpName;
  11 + private String lpSn;
  12 + private String dfsj;
  13 + private String nbbm;
  14 + private String cph;
  15 + private String bcType;
  16 + private String endStationName;
  17 + private String endStationNameEs;
  18 + private Integer updown;
  19 + private String jGh;
  20 + private String JName;
  21 + private String remakrs;
  22 + private Integer sn;
  23 +
  24 + public String getRq() {
  25 + return rq;
  26 + }
  27 +
  28 + public void setRq(String rq) {
  29 + this.rq = rq;
  30 + }
  31 +
  32 + public String getLineCode() {
  33 + return lineCode;
  34 + }
  35 +
  36 + public void setLineCode(String lineCode) {
  37 + this.lineCode = lineCode;
  38 + }
  39 +
  40 + public String getLineName() {
  41 + return lineName;
  42 + }
  43 +
  44 + public void setLineName(String lineName) {
  45 + this.lineName = lineName;
  46 + }
  47 +
  48 + public String getLineNameEs() {
  49 + return lineNameEs;
  50 + }
  51 +
  52 + public void setLineNameEs(String lineNameEs) {
  53 + this.lineNameEs = lineNameEs;
  54 + }
  55 +
  56 + public String getLpName() {
  57 + return lpName;
  58 + }
  59 +
  60 + public void setLpName(String lpName) {
  61 + this.lpName = lpName;
  62 + }
  63 +
  64 + public String getLpSn() {
  65 + return lpSn;
  66 + }
  67 +
  68 + public void setLpSn(String lpSn) {
  69 + this.lpSn = lpSn;
  70 + }
  71 +
  72 + public String getDfsj() {
  73 + return dfsj;
  74 + }
  75 +
  76 + public void setDfsj(String dfsj) {
  77 + this.dfsj = dfsj;
  78 + }
  79 +
  80 + public String getNbbm() {
  81 + return nbbm;
  82 + }
  83 +
  84 + public void setNbbm(String nbbm) {
  85 + this.nbbm = nbbm;
  86 + }
  87 +
  88 + public String getCph() {
  89 + return cph;
  90 + }
  91 +
  92 + public void setCph(String cph) {
  93 + this.cph = cph;
  94 + }
  95 +
  96 + public String getBcType() {
  97 + return bcType;
  98 + }
  99 +
  100 + public void setBcType(String bcType) {
  101 + this.bcType = bcType;
  102 + }
  103 +
  104 + public String getEndStationName() {
  105 + return endStationName;
  106 + }
  107 +
  108 + public void setEndStationName(String endStationName) {
  109 + this.endStationName = endStationName;
  110 + }
  111 +
  112 + public String getEndStationNameEs() {
  113 + return endStationNameEs;
  114 + }
  115 +
  116 + public void setEndStationNameEs(String endStationNameEs) {
  117 + this.endStationNameEs = endStationNameEs;
  118 + }
  119 +
  120 + public Integer getUpdown() {
  121 + return updown;
  122 + }
  123 +
  124 + public void setUpdown(Integer updown) {
  125 + this.updown = updown;
  126 + }
  127 +
  128 + public String getjGh() {
  129 + return jGh;
  130 + }
  131 +
  132 + public void setjGh(String jGh) {
  133 + this.jGh = jGh;
  134 + }
  135 +
  136 + public String getJName() {
  137 + return JName;
  138 + }
  139 +
  140 + public void setJName(String JName) {
  141 + this.JName = JName;
  142 + }
  143 +
  144 + public String getRemakrs() {
  145 + return remakrs;
  146 + }
  147 +
  148 + public void setRemakrs(String remakrs) {
  149 + this.remakrs = remakrs;
  150 + }
  151 +
  152 + public Integer getSn() {
  153 + return sn;
  154 + }
  155 +
  156 + public void setSn(Integer sn) {
  157 + this.sn = sn;
  158 + }
  159 +}
... ...
src/main/java/com/bsth/serviec_jk/JkToken.java 0 → 100644
  1 +package com.bsth.serviec_jk;
  2 +
  3 +import com.fasterxml.jackson.databind.ObjectMapper;
  4 +import org.apache.tomcat.util.http.fileupload.IOUtils;
  5 +
  6 +import java.io.*;
  7 +import java.net.HttpURLConnection;
  8 +import java.net.MalformedURLException;
  9 +import java.net.URL;
  10 +import java.net.URLEncoder;
  11 +import java.util.*;
  12 +
  13 +public class JkToken {
  14 + //加密的token码
  15 + public static String jkdata() {
  16 + try {
  17 + String token ="abfed98867c64fde99f7f88a4532efa8";
  18 + String endpoint = "http://180.167.126.126:8992/api/getcode";
  19 + InputStream in = null;
  20 + try {
  21 + HttpURLConnection con = (HttpURLConnection) new URL(endpoint).openConnection();
  22 + con.setDoInput(true);
  23 + con.setDoOutput(true);
  24 + con.setRequestMethod("GET");
  25 + con.setConnectTimeout(10000);
  26 + con.setReadTimeout(10000);
  27 + con.setRequestProperty("keep-alive", "true");
  28 + con.setRequestProperty("accept", "application/json");
  29 + con.setRequestProperty("content-type", "application/json");
  30 +
  31 + if (con.getResponseCode() == 200) {
  32 + in = con.getInputStream();
  33 + ByteArrayOutputStream bout = new ByteArrayOutputStream();
  34 + IOUtils.copy(in, bout);
  35 + Map map = new ObjectMapper().readValue(bout.toByteArray(), Map.class);
  36 + String sd = encrypt(token,(String)map.get("result"));
  37 + return sd;
  38 + }
  39 +
  40 +
  41 +
  42 + } catch (MalformedURLException e) {
  43 + // TODO Auto-generated catch block
  44 + e.printStackTrace();
  45 + } catch (IOException e) {
  46 + // TODO Auto-generated catch block
  47 + e.printStackTrace();
  48 + }
  49 + } catch (Exception e) {
  50 + e.printStackTrace();
  51 + }
  52 + return null;
  53 + }
  54 +
  55 +
  56 + public static String encrypt(String token, String code) throws Exception {
  57 + if (token.length() != 32) throw new Exception("token 长度不正确");
  58 + code = padRight(code, 16, '0');
  59 +
  60 + String tmpToken = "";
  61 + for (int i = 0; i < 8; i++){
  62 + String subString = code.substring(i * 2, (i + 1) * 2);
  63 + tmpToken += subString + token.substring(i * 4, (i + 1) * 4);
  64 + }
  65 + int pos = tmpToken.length() / 2;
  66 + tmpToken = tmpToken.substring(pos) + tmpToken.substring(0, pos);
  67 +
  68 + pos = tmpToken.length() / 4;
  69 + tmpToken = tmpToken.substring(pos * 3) + tmpToken.substring(pos, pos * 3) + tmpToken.substring(0, pos);
  70 + return URLEncoder.encode(tmpToken, "GBK");
  71 + }
  72 +
  73 +
  74 + public static String padRight(String s, int len, char ch){
  75 + int diff = len - s.length();
  76 + if (diff <= 0) {
  77 + return s;
  78 + }
  79 +
  80 + char[] charr = new char[len];
  81 + System.arraycopy(s.toCharArray(), 0, charr, 0, s.length());
  82 + for (int i = s.length(); i < len; i++) {
  83 + charr[i] = ch;
  84 + }
  85 + return new String(charr);
  86 + }
  87 +
  88 + public static void main(String[] args) {
  89 + jkdata();
  90 + }
  91 +
  92 +}
... ...
src/main/java/com/bsth/serviec_jk/WebserviceSign.java 0 → 100644
  1 +package com.bsth.serviec_jk;
  2 +
  3 +import java.security.MessageDigest;
  4 +import java.util.Arrays;
  5 +import java.util.Map;
  6 +
  7 +public class WebserviceSign {
  8 +
  9 +
  10 + public static String getRandomString(Integer i){
  11 + return "t5sdv";
  12 + }
  13 +
  14 +
  15 + public static String getSHA1(Map<String, String> map) throws Exception {
  16 +
  17 + try {
  18 + String[] array = new String[map.size()];
  19 + map.values().toArray(array);
  20 + StringBuffer sb = new StringBuffer();
  21 +
  22 + // 字符串排序
  23 + Arrays.sort(array);
  24 + for (int i = 0; i < array.length; i++) {
  25 + sb.append(array[i]);
  26 + }
  27 + String str = sb.toString();
  28 + // SHA1签名生成
  29 + MessageDigest md = MessageDigest.getInstance("SHA-1");
  30 + md.update(str.getBytes());
  31 + byte[] digest = md.digest();
  32 +
  33 + StringBuffer hexstr = new StringBuffer();
  34 + String shaHex = "";
  35 + for (int i = 0; i < digest.length; i++) {
  36 + shaHex = Integer.toHexString(digest[i] & 0xFF);
  37 + if (shaHex.length() < 2) {
  38 + hexstr.append(0);
  39 + }
  40 + hexstr.append(shaHex);
  41 + }
  42 + return hexstr.toString();
  43 + } catch (Exception e) {
  44 + throw e;
  45 + }
  46 + }
  47 +}
... ...
src/main/java/com/bsth/serviec_jk/car_start/CarStartService.java 0 → 100644
  1 +package com.bsth.serviec_jk.car_start;
  2 +
  3 +import com.alibaba.fastjson.JSON;
  4 +import com.bsth.entity.Clfcxxb;
  5 +import com.bsth.serviec_jk.JkToken;
  6 +import com.bsth.serviec_jk.xl_basic.HttpService;
  7 +import com.bsth.utils.HttpUtils;
  8 +import org.slf4j.Logger;
  9 +import org.slf4j.LoggerFactory;
  10 +import org.springframework.beans.factory.annotation.Autowired;
  11 +import org.springframework.jdbc.core.BeanPropertyRowMapper;
  12 +import org.springframework.jdbc.core.JdbcTemplate;
  13 +import org.springframework.scheduling.annotation.EnableScheduling;
  14 +import org.springframework.scheduling.annotation.Scheduled;
  15 +import org.springframework.stereotype.Service;
  16 +import org.springframework.transaction.annotation.Transactional;
  17 +
  18 +import java.io.UnsupportedEncodingException;
  19 +import java.net.URLEncoder;
  20 +import java.util.*;
  21 +
  22 +@Service
  23 +@EnableScheduling
  24 +public class CarStartService {
  25 +
  26 + @Autowired
  27 + JdbcTemplate jdbcTemplate;
  28 +
  29 + private final static Logger log = LoggerFactory.getLogger(HttpUtils.class);
  30 + //车辆发车信息
  31 + @Transactional()
  32 + @Scheduled(cron = "0 */1 * * * ?") //每分钟执行一回
  33 + public void listall() throws UnsupportedEncodingException {
  34 + log.info("调用车辆发车信息接口开始---------------");
  35 + long startTime=System.currentTimeMillis();
  36 + String url="http://180.167.126.126:8992/api/todaybuslinescheduleshiftinfo/addEntityList";
  37 + Map<String,Object> map = new HashMap<>();
  38 + //不走缓存,暂时直连数据库
  39 + List<Clfcxxb> list = jdbcTemplate.query("select * from bsth_t_clfcxxb", BeanPropertyRowMapper.newInstance(Clfcxxb.class));
  40 + Map<String,Object> numap = new LinkedHashMap<>();
  41 + List numlist = new ArrayList();
  42 + for (Clfcxxb x:list) {
  43 + //数据整理
  44 + numap.put("ScheduleDate",x.getRq());
  45 + numap.put("BusLineCode",x.getLineCode());
  46 + numap.put("MainBusID",null);
  47 + numap.put("GuideBoardID",null);
  48 + numap.put("ShiftSN",null);
  49 + numap.put("BusLineName",x.getLineName());
  50 + numap.put("MainBusCode",x.getNbbm());
  51 + numap.put("MainBusNumber",x.getCph());
  52 + numap.put("MainBusCompanyNumber",null);
  53 + numap.put("TerminalCode",null);
  54 + numap.put("TemplateID",0);
  55 + numap.put("GuideBoardName",null);
  56 + numap.put("DriverEmpCode",null);
  57 + numap.put("DriverEmpName",x.getJName());
  58 + numap.put("DriverEmpNumber",x.getjGh());
  59 + numap.put("ConductorEmpCode",null);
  60 + numap.put("ConductorEmpName",null);
  61 + numap.put("ConductorEmpNumber",null);
  62 + numap.put("CompanyCode",null);
  63 + numap.put("CompanyName",null);
  64 + numap.put("SubCompanyCode",null);
  65 + numap.put("SubCompanyName",null);
  66 + numap.put("ShiftTypeCode",x.getBcType());
  67 + numap.put("ShiftStateCode",null);
  68 + numap.put("NondoTypeCode",null);
  69 + numap.put("ShiftDirectionCode",null);
  70 + numap.put("ShiftStartPlanTime",null);
  71 + numap.put("ShiftStartWaitTime",x.getDfsj());
  72 + numap.put("ShiftStartWaitNote",null);
  73 + numap.put("ShiftStartFinishTime",null);
  74 + numap.put("ShiftStartPlanStationCode",x.getSn());
  75 + numap.put("ShiftStartAutoCode",null);
  76 + numap.put("ShiftStartNote",null);
  77 + numap.put("ShiftEndPlanStationCode",null);
  78 + numap.put("ShiftEndPlanTime",null);
  79 + numap.put("ShiftEndFinishTime",null);
  80 + numap.put("ShiftEndAutoCode",null);
  81 + numap.put("ShiftEndNote",null);
  82 + numap.put("PlanKilometer",null);
  83 + numap.put("FinishKilometer",null);
  84 + numap.put("GPSKilometer",null);
  85 + numap.put("PlanFinishTime",null);
  86 + numap.put("FinishFinishTime",null);
  87 + numap.put("KilometerFinishRate",null);
  88 + numap.put("ShiftNumberFinishRate",null);
  89 + numap.put("ReplaceBusLineCode",null);
  90 + numap.put("ReplaceText",null);
  91 + numap.put("DispathUserName",null);
  92 + numap.put("DispathDatetime",null);
  93 + numap.put("MessageID",null);
  94 + numap.put("MessageDatetime",null);
  95 + numap.put("TerminalReceiveCode",null);
  96 + numap.put("TerminalReceiveDatetime",null);
  97 + numap.put("DriverConfirmCode",null);
  98 + numap.put("DriverConfirmDatetime",null);
  99 + numlist.add(numap);
  100 + numap = new LinkedHashMap<>();
  101 +
  102 + }
  103 +
  104 + String token = JkToken.jkdata();
  105 + map.put("list",numlist);
  106 + int count = 1;
  107 + if(numlist.size()==0){
  108 + return;
  109 + }
  110 + if(null !=numlist && numlist.size()>1000){
  111 +
  112 + for (int i = 0; i <numlist.size() ; ) {
  113 +
  114 + if(numlist.size()> i + 1000){
  115 + log.info("第"+count+"次调用-----------");
  116 + String json = "list=" + URLEncoder.encode(JSON.toJSONStringWithDateFormat(numlist.subList(i,i+1000), "yyyy-MM-dd HH:mm:ss"), "UTF-8");
  117 + int resultCount= HttpService.httpRequestResulty(json,token,url,count);
  118 + }else {
  119 + log.info("第"+count+"次调用-----------");
  120 + String json = "list=" + URLEncoder.encode(JSON.toJSONStringWithDateFormat(numlist.subList(i,numlist.size()), "yyyy-MM-dd HH:mm:ss"), "UTF-8");
  121 + int resultCount= HttpService.httpRequestResulty(json,token,url,count);
  122 + }
  123 + i=i+1000;
  124 + count++;
  125 + }
  126 + }else {
  127 + String json = "list=" + URLEncoder.encode(JSON.toJSONStringWithDateFormat(numlist.subList(0,numlist.size()), "yyyy-MM-dd HH:mm:ss"), "UTF-8");
  128 + int resultCount= HttpService.httpRequestResulty(json,token,url,count);
  129 + }
  130 + long endTime=System.currentTimeMillis();
  131 + log.info("调用车辆发车信息接口结束---------------共计执行时间:"+(endTime-startTime));
  132 + }
  133 +
  134 +}
... ...
src/main/java/com/bsth/serviec_jk/xl_basic/HttpService.java 0 → 100644
  1 +package com.bsth.serviec_jk.xl_basic;
  2 +
  3 +import com.alibaba.fastjson.JSONObject;
  4 +import com.bsth.utils.HttpUtils;
  5 +import com.bsth.utils.postUtil;
  6 +import org.slf4j.Logger;
  7 +import org.slf4j.LoggerFactory;
  8 +
  9 +import java.io.IOException;
  10 +import java.io.UnsupportedEncodingException;
  11 +
  12 +
  13 +public class HttpService {
  14 + private final static Logger log = LoggerFactory.getLogger(HttpUtils.class);
  15 +
  16 + public static int httpRequestResult(JSONObject json, String token, String url, int count){
  17 +
  18 +
  19 +
  20 + String result= null;
  21 + try {
  22 + result = postUtil.send(url, json, "UTF-8", token);
  23 + System.out.println(result);
  24 + } catch (UnsupportedEncodingException e) {
  25 + e.printStackTrace();
  26 + } catch (IOException e) {
  27 + e.printStackTrace();
  28 + }
  29 + log.info("返回结果------------------"+result);
  30 + if(result !=null){
  31 + if(result.indexOf("state")!=-1){
  32 + log.info("第"+count+"次调用插入成功!");
  33 + return 1;
  34 + }else {
  35 + log.info("第"+count+"次调用插入失败!");
  36 + return -1;
  37 + }
  38 + }
  39 + log.info("第"+count+"次调用插入未返回数据!");
  40 + return -1;
  41 + }
  42 +
  43 + public static int httpRequestResulty(String json, String token, String url, int count){
  44 + String result= null;
  45 + try {
  46 + result = postUtil.sendy(url, json, "UTF-8", token);
  47 + System.out.println(result);
  48 + } catch (UnsupportedEncodingException e) {
  49 + e.printStackTrace();
  50 + } catch (IOException e) {
  51 + e.printStackTrace();
  52 + }
  53 + log.info("返回结果------------------"+result);
  54 + if(result !=null){
  55 + if(result.indexOf("state")!=-1){
  56 + log.info("第"+count+"次调用插入成功!");
  57 + return 1;
  58 + }else {
  59 + log.info("第"+count+"次调用插入失败!");
  60 + return -1;
  61 + }
  62 + }
  63 + log.info("第"+count+"次调用插入未返回数据!");
  64 + return -1;
  65 + }
  66 +}
... ...
src/main/java/com/bsth/serviec_jk/xl_basic/XlBasicService.java 0 → 100644
  1 +package com.bsth.serviec_jk.xl_basic;
  2 +
  3 +import com.alibaba.fastjson.JSONObject;
  4 +import com.bsth.serviec_jk.JkToken;
  5 +import com.bsth.serviec_jk.WebserviceSign;
  6 +import com.bsth.utils.HttpUtils;
  7 +import com.fasterxml.jackson.databind.ObjectMapper;
  8 +import org.apache.tomcat.util.http.fileupload.IOUtils;
  9 +import org.slf4j.Logger;
  10 +import org.slf4j.LoggerFactory;
  11 +import org.springframework.scheduling.annotation.EnableScheduling;
  12 +import org.springframework.scheduling.annotation.Scheduled;
  13 +import org.springframework.stereotype.Controller;
  14 +import org.springframework.transaction.annotation.Transactional;
  15 +import org.springframework.web.bind.annotation.RequestMapping;
  16 +import java.io.ByteArrayOutputStream;
  17 +import java.io.IOException;
  18 +import java.io.InputStream;
  19 +import java.net.HttpURLConnection;
  20 +import java.net.MalformedURLException;
  21 +import java.net.URL;
  22 +import java.util.*;
  23 +@Controller
  24 +@RequestMapping("api")
  25 +@EnableScheduling
  26 +public class XlBasicService {
  27 +
  28 + private final static Logger log = LoggerFactory.getLogger(HttpUtils.class);
  29 +
  30 + //线路基本信息接口
  31 + @Transactional()
  32 + @Scheduled(cron = "0 0 1 * * ?") //每天凌晨一点 执行
  33 + public void xlbasic() {
  34 + log.info("调用线路基本信息接口开始---------------");
  35 + long startTime=System.currentTimeMillis();
  36 + Map<String,Object> xlmap = new LinkedHashMap<>();
  37 + String url = "http://180.167.126.126:8992/api/buslineinfo/insertlist";
  38 + try{
  39 + String password = "6DABD12209BEDAB0808CF7DC967EC2B4C6748277";
  40 + String timestamp = String.valueOf(System.currentTimeMillis());
  41 + String nonce = WebserviceSign.getRandomString(5);
  42 + Map<String, String> map = new HashMap<String, String>();
  43 + map.put("timestamp", timestamp);//时间戳
  44 + map.put("nonce", nonce);//随机字符串
  45 + map.put("password", password);//密码
  46 + String signStr = WebserviceSign.getSHA1(map);
  47 + String endpoint = "http://114.80.178.12:9089/webservice/rest/line/all?timestamp="+timestamp+"&nonce="+nonce+"&password="+password+"&sign="+signStr;
  48 + InputStream in = null;
  49 + try {
  50 + HttpURLConnection con = (HttpURLConnection)new URL(endpoint).openConnection();
  51 + con.setDoInput(true);
  52 + con.setDoOutput(true);
  53 + con.setRequestMethod("GET");
  54 + con.setConnectTimeout(5000);
  55 + con.setReadTimeout(5000);
  56 + con.setRequestProperty("keep-alive", "true");
  57 + con.setRequestProperty("accept", "application/json");
  58 + con.setRequestProperty("content-type", "application/json");
  59 + if (con.getResponseCode() == 200) {
  60 + in = con.getInputStream();
  61 + ByteArrayOutputStream bout = new ByteArrayOutputStream();
  62 + IOUtils.copy(in, bout);
  63 + List m = new ObjectMapper().readValue(bout.toByteArray(), List.class);
  64 + String token = JkToken.jkdata();
  65 + xlmap.put("AccessToken", token);
  66 + xlmap.put("DeleteAll", "true");
  67 + Map stmap = new LinkedHashMap();
  68 + List numlist = new ArrayList();
  69 + for (Object o:m){
  70 + Map ke = (Map)o;
  71 + //替换key
  72 + stmap.put("BusLineCode", ke.get("lineCode"));
  73 + stmap.put("BusLineName", ke.get("name"));
  74 + stmap.put("BusLineEngName", null);
  75 + stmap.put("BusLineShortName", null);
  76 + stmap.put("CompanyCode", null);
  77 + stmap.put("CompanyName", ke.get("company"));
  78 + stmap.put("SubCompanyCode", null);
  79 + stmap.put("SubCompanyName", ke.get("brancheCompany"));
  80 + stmap.put("StartDate", null);
  81 + stmap.put("linePlayType", null);
  82 + stmap.put("BusLinePropertyCode", ke.get("nature"));
  83 + stmap.put("BusLineGradeCode", ke.get("level"));
  84 + stmap.put("CompanyContacts", null);
  85 + stmap.put("ContactsPhone", null);
  86 + stmap.put("BusLineLeader", null);
  87 + stmap.put("LeaderPhone", null);
  88 + stmap.put("ParentBusLineCode", null);
  89 + stmap.put("UpFirstTime", null);
  90 + stmap.put("UpLastTime", null);
  91 + stmap.put("StartingStation", ke.get("startStationName"));
  92 + stmap.put("DnFirstTime", null);
  93 + stmap.put("DnLastTime", null);
  94 + stmap.put("EndStation", ke.get("endStationName"));
  95 + stmap.put("CrossRegion", null);
  96 + stmap.put("Remark", null);
  97 + stmap.put("TiceSeller", null);
  98 + stmap.put("RunTime", null);
  99 + stmap.put("ParkCode", null);
  100 + stmap.put("ParkName", null);
  101 + stmap.put("VehicleConfigurationNum", null);
  102 + stmap.put("RoadVector", null);
  103 + stmap.put("EquipmentLineCode", ke.get("eqLinecode"));
  104 + stmap.put("RouteEvolution", null);
  105 + stmap.put("AirConditionedVehiclesNum", null);
  106 + stmap.put("LineLength", null);
  107 + stmap.put("OrdinaryVehiclesNum", null);
  108 + stmap.put("RoutePlanningType", null);
  109 + stmap.put("ShangHaiLineCode", null);
  110 + stmap.put("IsNightTrain", ke.get("supperLine"));
  111 + stmap.put("WarrantBusNum", null);
  112 + stmap.put("WarrantBusDate", null);
  113 + stmap.put("IsInUse", ke.get("destroy"));
  114 + stmap.put("IsOperate", null);
  115 + stmap.put("LargeIntervalLevel", null);
  116 + numlist.add(stmap);
  117 + stmap = new LinkedHashMap();
  118 + }
  119 + xlmap.put("DataList", numlist);
  120 + int count = 1;
  121 + if (numlist.size() == 0) {
  122 + return;
  123 + }
  124 + if (null != numlist && numlist.size() > 1000) {
  125 +
  126 + for (int i = 0; i < numlist.size(); ) {
  127 + if (count > 1) {
  128 + xlmap.put("DeleteAll", "false");
  129 + }
  130 + if (numlist.size() > i + 1000) {
  131 + log.info("第" + count + "次调用-----------");
  132 + xlmap.put("DataList", numlist.subList(i, i + 1000));
  133 + JSONObject json = new JSONObject(xlmap);
  134 + int resultCount = HttpService.httpRequestResult(json, token, url, count);
  135 + } else {
  136 + log.info("第" + count + "次调用-----------");
  137 + xlmap.put("DataList", numlist.subList(i, numlist.size()));
  138 + JSONObject json = new JSONObject(xlmap);
  139 + int resultCount = HttpService.httpRequestResult(json, token, url, count);
  140 + }
  141 + i = i + 1000;
  142 + count++;
  143 +
  144 + }
  145 + } else {
  146 + xlmap.put("DataList", numlist.subList(0, numlist.size()));
  147 + JSONObject json = new JSONObject(xlmap);
  148 + int resultCount = HttpService.httpRequestResult(json, token, url, count);
  149 + }
  150 + long endTime=System.currentTimeMillis();
  151 + log.info("调用线路基本信息插入接口结束---------------共计执行时间:"+(endTime-startTime));
  152 + }
  153 + } catch (MalformedURLException e) {
  154 + // TODO Auto-generated catch block
  155 + e.printStackTrace();
  156 + } catch (IOException e) {
  157 + // TODO Auto-generated catch block
  158 + e.printStackTrace();
  159 + }
  160 + }catch(Exception e){
  161 + e.printStackTrace();
  162 + }
  163 + }
  164 +
  165 + //线路参数信息接口
  166 + @Transactional()
  167 + @Scheduled(cron = "0 0 1 * * ?")//每天凌晨一点 执行
  168 + public void xlparameter(){
  169 + log.info("调用线路参数信息接口开始---------------");
  170 + long startTime=System.currentTimeMillis();
  171 + String url = "http://180.167.126.126:8992/api/buslineparmterinfo/insertlist";
  172 + Map<String,Object> xlmap = new HashMap<>();
  173 + try{
  174 + String password = "6DABD12209BEDAB0808CF7DC967EC2B4C6748277";
  175 + String timestamp = String.valueOf(System.currentTimeMillis());
  176 + String nonce = WebserviceSign.getRandomString(5);
  177 + Map<String, String> map = new HashMap<String, String>();
  178 + map.put("timestamp", timestamp);//时间戳
  179 + map.put("nonce", nonce);//随机字符串
  180 + map.put("password", password);//密码
  181 + String signStr = WebserviceSign.getSHA1(map);
  182 + String endpoint = "http://114.80.178.12:9089/webservice/rest/line/all?timestamp="+timestamp+"&nonce="+nonce+"&password="+password+"&sign="+signStr;
  183 + InputStream in = null;
  184 + try {
  185 + HttpURLConnection con = (HttpURLConnection)new URL(endpoint).openConnection();
  186 + con.setDoInput(true);
  187 + con.setDoOutput(true);
  188 + con.setRequestMethod("GET");
  189 + con.setConnectTimeout(5000);
  190 + con.setReadTimeout(5000);
  191 + con.setRequestProperty("keep-alive", "true");
  192 + con.setRequestProperty("accept", "application/json");
  193 + con.setRequestProperty("content-type", "application/json");
  194 +
  195 + if (con.getResponseCode() == 200) {
  196 + in = con.getInputStream();
  197 + ByteArrayOutputStream bout = new ByteArrayOutputStream();
  198 + IOUtils.copy(in, bout);
  199 + Map stmap = new LinkedHashMap();
  200 + List m = new ObjectMapper().readValue(bout.toByteArray(), List.class);
  201 + List numlist = new ArrayList();
  202 + for (Object o:m){
  203 + Map ke = (Map)o;
  204 + stmap.put("BusLineCode",ke.get("lineCode"));
  205 + stmap.put("UpKilometer",null);
  206 + stmap.put("DnKilometer",null);
  207 + stmap.put("MPBegTime",null);
  208 + stmap.put("MPEndTime",null);
  209 + stmap.put("EPBegTime",null);
  210 + stmap.put("EPEndTime",null);
  211 + stmap.put("SNPBegTime",null);
  212 + stmap.put("SNPEndTime",null);
  213 + stmap.put("MPUpTravelTime",null);
  214 + stmap.put("MPDnTravelTime",null);
  215 + stmap.put("EPUpTravelTime",null);
  216 + stmap.put("EPDnTravelTime",null);
  217 + stmap.put("SNPUpTravelTime",null);
  218 + stmap.put("SNPDnTravelTime",null);
  219 + stmap.put("LowUpTravelTime",null);
  220 + stmap.put("LowDnTravelTime",null);
  221 + stmap.put("StartingToParkTime",null);
  222 + stmap.put("StartingToParkKilometer",null);
  223 + stmap.put("LastingToParkTime",null);
  224 + stmap.put("LastingToParkKilometer",null);
  225 + stmap.put("MPLargeMargin",ke.get("earlyIntervalLg"));
  226 + stmap.put("EPLargeMargin",ke.get("lateIntervalLg"));
  227 + stmap.put("LowLargeMargin",ke.get("intervalLg"));
  228 + stmap.put("MaxOverSpeed",null);
  229 + stmap.put("OverStopTime",ke.get("lagStation"));
  230 + stmap.put("LessStopTime",ke.get("skip"));
  231 + stmap.put("BusMaxGather",null);
  232 + stmap.put("DeleteFlag",ke.get("destroy"));
  233 + stmap.put("Remark",null);
  234 + stmap.put("SpeedNormal",ke.get("speedLimit"));
  235 + stmap.put("SpeedRain",null);
  236 + stmap.put("SpeedDenseFog",null);
  237 + stmap.put("SpeedIce",null);
  238 + stmap.put("SpeedFestival",null);
  239 + stmap.put("Speeding",ke.get("speeding"));
  240 + stmap.put("String",ke.get("crossedLine"));
  241 + stmap.put("Transboundary",ke.get("overflights"));
  242 + stmap.put("describe",null);
  243 + stmap.put("ParkingLot",null);
  244 + stmap.put("FromMileage",null);
  245 + stmap.put("OutTime",null);
  246 + stmap.put("ProcessionMileage",null);
  247 + numlist.add(stmap);
  248 + stmap = new LinkedHashMap();
  249 + }
  250 + String token = JkToken.jkdata();
  251 + xlmap.put("AccessToken",token);
  252 + xlmap.put("DeleteAll","true");
  253 + xlmap.put("DataList",numlist);
  254 + int count = 1;
  255 + if (numlist.size() == 0) {
  256 + return;
  257 + }
  258 + if (null != numlist && numlist.size() > 1000) {
  259 +
  260 + for (int i = 0; i < numlist.size(); ) {
  261 + if (count > 1) {
  262 + xlmap.put("DeleteAll", "false");
  263 + }
  264 + if (numlist.size() > i + 1000) {
  265 + log.info("第" + count + "次调用-----------");
  266 + xlmap.put("DataList", numlist.subList(i, i + 1000));
  267 + JSONObject json = new JSONObject(xlmap);
  268 + int resultCount = HttpService.httpRequestResult(json, token, url, count);
  269 + } else {
  270 + log.info("第" + count + "次调用-----------");
  271 + xlmap.put("DataList", numlist.subList(i, numlist.size()));
  272 + JSONObject json = new JSONObject(xlmap);
  273 + int resultCount = HttpService.httpRequestResult(json, token, url, count);
  274 + }
  275 + i = i + 1000;
  276 + count++;
  277 + }
  278 + } else {
  279 + xlmap.put("DataList", numlist.subList(0, numlist.size()));
  280 + JSONObject json = new JSONObject(xlmap);
  281 + int resultCount = HttpService.httpRequestResult(json, token, url, count);
  282 + }
  283 + long endTime=System.currentTimeMillis();
  284 + log.info("调用线路参数信息插入接口结束---------------共计执行时间:"+(endTime-startTime));
  285 + }
  286 + } catch (MalformedURLException e) {
  287 + // TODO Auto-generated catch block
  288 + e.printStackTrace();
  289 + } catch (IOException e) {
  290 + // TODO Auto-generated catch block
  291 + e.printStackTrace();
  292 + }
  293 + }catch(Exception e){
  294 + e.printStackTrace();
  295 + }
  296 + }
  297 +
  298 + ////线路走向接口
  299 + @Transactional()
  300 + @Scheduled(cron = "0 0 1 * * ?")//每天凌晨一点 执行
  301 + public void postrend(){
  302 + log.info("调用线路走向接口开始---------------");
  303 + long startTime=System.currentTimeMillis();
  304 + Map<String,Object> xlmap = new HashMap<>();
  305 + List numlist = new ArrayList();
  306 + String url="http://180.167.126.126:8992/api/stationnetpoints/insertlist";
  307 + try{
  308 + String password = "6DABD12209BEDAB0808CF7DC967EC2B4C6748277";
  309 + String timestamp = String.valueOf(System.currentTimeMillis());
  310 + String nonce = WebserviceSign.getRandomString(5);
  311 + Map<String, String> map = new HashMap<String, String>();
  312 + map.put("timestamp", timestamp);//时间戳
  313 + map.put("nonce", nonce);//随机字符串
  314 + map.put("password", password);//密码
  315 + String signStr = WebserviceSign.getSHA1(map);
  316 + List list = new ArrayList();
  317 + list.add("22");//四家公司
  318 + list.add("26");
  319 + list.add("55");
  320 + list.add("05");
  321 + try {
  322 + for (Object t:list ) {
  323 + String endpoint = "http://114.80.178.12:9089/webservice/rest/ld_section/"+t+"?timestamp=" + timestamp + "&nonce=" + nonce + "&password=" + password + "&sign=" + signStr;
  324 + InputStream in = null;
  325 + HttpURLConnection con = (HttpURLConnection) new URL(endpoint).openConnection();
  326 + con.setDoInput(true);
  327 + con.setDoOutput(true);
  328 + con.setRequestMethod("GET");
  329 + con.setConnectTimeout(5000);
  330 + con.setReadTimeout(5000);
  331 + con.setRequestProperty("keep-alive", "true");
  332 + con.setRequestProperty("accept", "application/json");
  333 + con.setRequestProperty("content-type", "application/json");
  334 +
  335 + if (con.getResponseCode() == 200) {
  336 + in = con.getInputStream();
  337 + ByteArrayOutputStream bout = new ByteArrayOutputStream();
  338 + IOUtils.copy(in, bout);
  339 + Map stmap = new LinkedHashMap();
  340 + Map m = new ObjectMapper().readValue(bout.toByteArray(), Map.class);
  341 + Map<String, Object> numMap = new LinkedHashMap<>();
  342 + List n = new ArrayList();
  343 + for (Object key : m.keySet()) {
  344 + List lit = (List) m.get(key);
  345 + Map st = (Map) lit.get(0);
  346 + Map section = (Map) st.get("section");
  347 + numMap.put("BusLineCode", st.get("lineCode"));
  348 + numMap.put("BusLineName", null);
  349 + numMap.put("Directions", st.get("directions"));
  350 + numMap.put("DirIndex ", st.get("sectionrouteCode"));
  351 + String lay[] = zbd(section.get("gsectionVector").toString());
  352 + if(lay != null) { //坐标类型问题传不过去 传null
  353 + numMap.put("LongitudeX", String.format("%.8f", Double.parseDouble(lay[0])));
  354 + numMap.put("LatitudeY", String.format("%.8f", Double.parseDouble(lay[1])));
  355 + }else {
  356 + numMap.put("LongitudeX", null);
  357 + numMap.put("LatitudeY", null);
  358 + }
  359 + numlist.add(numMap);
  360 + numMap = new LinkedHashMap<>();
  361 + }
  362 + }
  363 + }
  364 + String token = JkToken.jkdata();
  365 + xlmap.put("AccessToken",token);
  366 + xlmap.put("DeleteAll","true");
  367 + xlmap.put("DataList",numlist);
  368 +
  369 + int count=1;
  370 + if(numlist.size()==0){
  371 + return;
  372 + }
  373 + if(null !=numlist && numlist.size()>1000){
  374 +
  375 + for (int i = 0; i <numlist.size() ; ) {
  376 + if(count > 1){
  377 + xlmap.put("DeleteAll","false");
  378 + }
  379 + if(numlist.size()> i + 1000){
  380 + log.info("第"+count+"次调用-----------");
  381 + xlmap.put("DataList",numlist.subList(i,i+1000));
  382 + JSONObject json = new JSONObject(xlmap);
  383 + int resultCount= HttpService.httpRequestResult(json,token,url,count);
  384 + }else {
  385 + log.info("第"+count+"次调用-----------");
  386 + xlmap.put("DataList",numlist.subList(i,numlist.size()));
  387 + JSONObject json = new JSONObject(xlmap);
  388 + int resultCount= HttpService.httpRequestResult(json,token,url,count);
  389 + }
  390 + i=i+1000;
  391 + count++;
  392 + }
  393 + }else {
  394 + xlmap.put("DataList",numlist.subList(0,numlist.size()));
  395 + JSONObject json = new JSONObject(xlmap);
  396 + int resultCount= HttpService.httpRequestResult(json,token,url,count);
  397 + }
  398 + long endTime=System.currentTimeMillis();
  399 + log.info("调用线路走向插入接口结束---------------共计执行时间:"+(endTime-startTime));
  400 + } catch (MalformedURLException e) {
  401 + // TODO Auto-generated catch block
  402 + e.printStackTrace();
  403 + } catch (IOException e) {
  404 + // TODO Auto-generated catch block
  405 + e.printStackTrace();
  406 + }
  407 + }catch(Exception e){
  408 + e.printStackTrace();
  409 + }
  410 + }
  411 +
  412 + //查询线路停靠站信息接口
  413 + @Transactional()
  414 + @Scheduled(cron = "0 0 1 * * ?")//每天凌晨一点 执行
  415 + public void site(){
  416 + log.info("调用线路停靠站信息接口开始---------------");
  417 + long startTime=System.currentTimeMillis();
  418 + Map<String,Object> xlmap = new HashMap<>();
  419 + List numlist = new ArrayList();
  420 + String url="http://180.167.126.126:8992/api/buslinenetstation/insertlist";
  421 + try{
  422 + String password = "6DABD12209BEDAB0808CF7DC967EC2B4C6748277";
  423 + String timestamp = String.valueOf(System.currentTimeMillis());
  424 + String nonce = WebserviceSign.getRandomString(5);
  425 + Map<String, String> map = new HashMap<String, String>();
  426 + map.put("timestamp", timestamp);//时间戳
  427 + map.put("nonce", nonce);//随机字符串
  428 + map.put("password", password);//密码
  429 + String signStr = WebserviceSign.getSHA1(map);
  430 + List list = new ArrayList();
  431 + list.add("22"); list.add("26"); list.add("55"); list.add("05"); //四家公司
  432 + try {
  433 + for (Object t:list ) {
  434 + String endpoint = "http://114.80.178.12:9089/webservice/rest/station/" + t + "?timestamp=" + timestamp + "&nonce=" + nonce + "&password=" + password + "&sign=" + signStr;
  435 + InputStream in = null;
  436 + HttpURLConnection con = (HttpURLConnection) new URL(endpoint).openConnection();
  437 + con.setDoInput(true);
  438 + con.setDoOutput(true);
  439 + con.setRequestMethod("GET");
  440 + con.setConnectTimeout(5000);
  441 + con.setReadTimeout(5000);
  442 + con.setRequestProperty("keep-alive", "true");
  443 + con.setRequestProperty("accept", "application/json");
  444 + con.setRequestProperty("content-type", "application/json");
  445 + if (con.getResponseCode() == 200) {
  446 + in = con.getInputStream();
  447 + ByteArrayOutputStream bout = new ByteArrayOutputStream();
  448 + IOUtils.copy(in, bout);
  449 + Map m = new ObjectMapper().readValue(bout.toByteArray(), Map.class);
  450 + Map<String, Object> numMap = new LinkedHashMap<>();
  451 + for (Object key : m.keySet()) {
  452 + List lit = (List) m.get(key);
  453 + for (Object o : lit) {
  454 + Map st = (Map) o;
  455 + Map station = (Map) st.get("station");
  456 + numMap.put("BusLineCode", st.get("lineCode"));
  457 + numMap.put("BusLineName", 0);
  458 + numMap.put("Directions", 0);
  459 + numMap.put("DirIndex", 0);
  460 + numMap.put("StationCode ", st.get("stationCode"));
  461 + numMap.put("StationName", st.get("stationName"));
  462 + if (st.get("stationMark").equals("B")) {
  463 + numMap.put("StationTypeCode", 1);
  464 + } else if (st.get("stationMark").equals("E")) {
  465 + numMap.put("StationTypeCode", 2);
  466 + } else {
  467 + numMap.put("StationTypeCode", 0);
  468 + }
  469 + numMap.put("StationEngName", 0);
  470 + numMap.put("StationAddress", st.get("stationName"));
  471 + if (station != null) {
  472 + numMap.put("LongitudeX", station.get("lon"));
  473 + numMap.put("LatitudeY", station.get("lat"));
  474 + } else {
  475 + numMap.put("LongitudeX", 0);
  476 + numMap.put("LatitudeY", 0);
  477 + }
  478 + numMap.put("FirstTime", st.get("firstTime"));
  479 + numMap.put("LastTime", st.get("endTime"));
  480 + numMap.put("OperateTimes", 0);
  481 + numlist.add(numMap);
  482 + numMap = new LinkedHashMap<>();
  483 + }
  484 + }
  485 + }
  486 + }
  487 + String token = JkToken.jkdata();
  488 + xlmap.put("AccessToken",token);
  489 + xlmap.put("DeleteAll","true");
  490 + xlmap.put("DataList",numlist);
  491 + int count = 1;
  492 + if(numlist.size() == 0){
  493 + return;
  494 + }
  495 + if(null !=numlist && numlist.size() > 1000){
  496 +
  497 + for (int i = 0; i < numlist.size() ; ) {
  498 + if(count > 1){
  499 + xlmap.put("DeleteAll","false");
  500 + }
  501 + if(numlist.size() > i + 1000){
  502 + log.info("第"+count+"次调用-----------");
  503 + xlmap.put("DataList",numlist.subList(i,i+1000));
  504 + JSONObject json = new JSONObject(xlmap);
  505 + int resultCount= HttpService.httpRequestResult(json,token,url,count);
  506 + }else {
  507 + log.info("第"+count+"次调用-----------");
  508 + xlmap.put("DataList",numlist.subList(i,numlist.size()));
  509 + JSONObject json = new JSONObject(xlmap);
  510 + int resultCount= HttpService.httpRequestResult(json,token,url,count);
  511 + }
  512 + i = i + 1000;
  513 + count++;
  514 +
  515 + }
  516 + }else {
  517 + xlmap.put("DataList",numlist.subList(0,numlist.size()));
  518 + JSONObject json = new JSONObject(xlmap);
  519 + int resultCount= HttpService.httpRequestResult(json,token,url,count);
  520 + }
  521 + long endTime=System.currentTimeMillis();
  522 + log.info("调用线路停靠站信息插入接口结束---------------共计执行时间:"+(endTime-startTime));
  523 +
  524 + } catch (MalformedURLException e) {
  525 + // TODO Auto-generated catch block
  526 + e.printStackTrace();
  527 + } catch (IOException e) {
  528 + // TODO Auto-generated catch block
  529 + e.printStackTrace();
  530 + }
  531 + }catch(Exception e){
  532 + e.printStackTrace();
  533 + }
  534 + }
  535 +
  536 + //线路走向坐标类型转换格式
  537 + public static String[] zbd(String gsectionVector){
  538 + String longStr = new String(gsectionVector.replaceAll("[^\\d,. ]+", ""));
  539 + String [] loglat = longStr.split(",");
  540 + String lay ="";
  541 + lay+=loglat[loglat.length-1];
  542 + String [] la = loglat = lay.split(" ");
  543 + return la;
  544 + }
  545 +
  546 +
  547 +}
... ...
src/main/java/com/bsth/utils/postUtil.java 0 → 100644
  1 +package com.bsth.utils;
  2 +
  3 +import com.alibaba.fastjson.JSONObject;
  4 +import net.sf.json.JSONArray;
  5 +import org.apache.http.HttpEntity;
  6 +import org.apache.http.ParseException;
  7 +import org.apache.http.client.methods.CloseableHttpResponse;
  8 +import org.apache.http.client.methods.HttpPost;
  9 +import org.apache.http.entity.StringEntity;
  10 +import org.apache.http.impl.client.CloseableHttpClient;
  11 +import org.apache.http.impl.client.HttpClients;
  12 +import org.apache.http.message.BasicHeader;
  13 +import org.apache.http.util.EntityUtils;
  14 +import java.io.IOException;
  15 +
  16 +public class postUtil {
  17 +
  18 + public static String send(String url, JSONObject jsonObject, String encoding, String token) throws ParseException, IOException {
  19 + String body = "";
  20 +
  21 + CloseableHttpClient client = HttpClients.createDefault();
  22 +
  23 + HttpPost httpPost = new HttpPost(url);
  24 +
  25 + StringEntity s = new StringEntity(jsonObject.toString(), "utf-8");
  26 + s.setContentEncoding(new BasicHeader("Content-Type", "application/json"));
  27 +
  28 + httpPost.setEntity(s);
  29 + System.out.println("请求地址:" + url);
  30 +
  31 + httpPost.setHeader("Content-type", "application/json");
  32 + httpPost.setHeader("Access-Token", token);
  33 +
  34 + CloseableHttpResponse response = client.execute(httpPost);
  35 +
  36 + HttpEntity entity = response.getEntity();
  37 + if (entity != null)
  38 + {
  39 + body = EntityUtils.toString(entity, encoding);
  40 + }
  41 + EntityUtils.consume(entity);
  42 +
  43 + response.close();
  44 + return body;
  45 + }
  46 +
  47 + public static String sendy(String url, String object, String encoding, String token) throws ParseException, IOException {
  48 + String body = "";
  49 +
  50 + CloseableHttpClient client = HttpClients.createDefault();
  51 +
  52 + HttpPost httpPost = new HttpPost(url);
  53 +
  54 + StringEntity s = new StringEntity(object, "utf-8");
  55 + s.setContentEncoding(new BasicHeader("Content-Type", "application/json"));
  56 +
  57 + httpPost.setEntity(s);
  58 + System.out.println("请求地址:" + url);
  59 +
  60 + httpPost.setHeader("Content-type", "application/json");
  61 + httpPost.setHeader("Access-Token", token);
  62 +
  63 + CloseableHttpResponse response = client.execute(httpPost);
  64 +
  65 + HttpEntity entity = response.getEntity();
  66 + if (entity != null)
  67 + {
  68 + body = EntityUtils.toString(entity, encoding);
  69 + }
  70 + EntityUtils.consume(entity);
  71 +
  72 + response.close();
  73 + return body;
  74 + }
  75 +
  76 +}
... ...
target/classes/app.properties deleted 100644 → 0
target/classes/application-dev.yml deleted 100644 → 0
1   -server:
2   - port: 10010
3   -
4   -management:
5   - port: 9001
6   - address: 127.0.0.1
7   - security:
8   - enabled: false
9   - context-path: /manage
10   -
11   -#DATASOURCE
12   -spring:
13   - datasource:
14   - driver-class-name: com.mysql.jdbc.Driver
15   - url: jdbc:mysql://192.168.168.241/pd_control?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2B8
16   - username: root
17   - password: root2jsp
18   - max-active: 100
19   - max-idle: 8
20   - min-idle: 8
21   - initial-size: 5
22   - test-on-borrow: true
23   - test-on-connect: true
24   - test-on-return: true
25   - test-while-idle: true
26   - validation-query: select 1
27   -## gateway real data
28   -http:
29   - gps:
30   - real:
31   - url: http://114.80.178.12:18080/transport_server/rtgps/
32 0 \ No newline at end of file
target/classes/application-prod.yml deleted 100644 → 0
1   -server:
2   - port: 29088
3   -
4   -management:
5   - port: 9001
6   - address: 127.0.0.1
7   - security:
8   - enabled: false
9   - context-path: /manage
10   -
11   -#DATASOURCE
12   -spring:
13   - datasource:
14   - driver-class-name: com.mysql.jdbc.Driver
15   - url: jdbc:mysql://10.10.200.121/control?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2B8
16   - username: root
17   - password: root2jsp
18   - max-active: 100
19   - max-idle: 8
20   - min-idle: 8
21   - initial-size: 5
22   - test-on-borrow: true
23   - test-on-connect: true
24   - test-on-return: true
25   - test-while-idle: true
26   - validation-query: select 1
27   -## gateway real data
28   -http:
29   - gps:
30   - real:
31   - url: http://10.10.200.79:8080/transport_server/rtgps/
32 0 \ No newline at end of file
target/classes/application.yml deleted 100644 → 0
1   -spring:
2   - profiles:
3   - active: dev
4   - view:
5   - suffix: .html
6   -server:
7   - session-timeout: -1
8   -security:
9   - basic:
10   - enabled: false
11   - compression:
12   - enabled: true
13   - mime-types: application/json,application/xml,text/html,text/xml,text/plain,text/javascript,text/css,application/javascript
14   -hibernate:
15   - jdbc:
16   - batch_size: 50
17   -
18   -# \u4E0A\u4F20\u6587\u4EF6\u5927\u5C0F\u9650\u5236\u914D\u7F6E
19   -# File size limit
20   -multipart:
21   - maxFileSize: -1
22   -# Total request size for a multipart/form-data
23   - maxRequestSize: -1
24 0 \ No newline at end of file
target/classes/com/bsth/Application.class deleted 100644 → 0
No preview for this file type
target/classes/com/bsth/serviec_jk/CarGps/CarGps.class deleted 100644 → 0
No preview for this file type
target/classes/com/bsth/serviec_jk/GetPwldMain.class deleted 100644 → 0
No preview for this file type
target/classes/com/bsth/serviec_jk/WebserviceSign.class deleted 100644 → 0
No preview for this file type
target/classes/com/bsth/serviec_jk/xl_basic/XlBasic.class deleted 100644 → 0
No preview for this file type
target/classes/com/bsth/utils/CallBack.class deleted 100644 → 0
No preview for this file type
target/classes/com/bsth/utils/HttpUtils$1.class deleted 100644 → 0
No preview for this file type
target/classes/com/bsth/utils/HttpUtils.class deleted 100644 → 0
No preview for this file type
target/classes/logback.xml deleted 100644 → 0
1   -<?xml version="1.0" encoding="UTF-8" ?>
2   -<!-- scan="true" 当此属性设置为true时,配置文件如果发生改变,将会被重新加载,默认值为true。 -->
3   -<!-- scanPeriod="30 seconds" 设置每30秒自动扫描,若没有指定具体单位则以milliseconds为标准(单位:milliseconds, seconds, minutes or hours) -->
4   -<!-- debug="false"当此属性设置为true时,将打印出logback内部日志信息,实时查看logback运行状态。默认值为false。-->
5   -<configuration scan="true" scanPeriod="30 seconds">
6   - <property name="LOG_BASE" value="D:/control4cloud_logs" />
7   - <!-- 控制台输出 -->
8   - <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
9   - <encoder>
10   - <!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
11   - <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%file:%line] %-5level-%msg%n</pattern>
12   - </encoder>
13   - </appender>
14   -
15   - <!-- 主日志文件 -->
16   - <appender name="FILE"
17   - class="ch.qos.logback.core.rolling.RollingFileAppender">
18   - <file>${LOG_BASE}/main/main.log</file>
19   - <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
20   - <fileNamePattern>${LOG_BASE}/main/main-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
21   - <timeBasedFileNamingAndTriggeringPolicy
22   - class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
23   - <maxFileSize>100MB</maxFileSize>
24   - </timeBasedFileNamingAndTriggeringPolicy>
25   - </rollingPolicy>
26   - <encoder>
27   - <pattern>%msg%n</pattern>
28   - </encoder>
29   -
30   - <layout class="ch.qos.logback.classic.PatternLayout">
31   - <!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
32   - <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%file:%line] %-5level-%msg%n
33   - </pattern>
34   - </layout>
35   - </appender>
36   -
37   - <!-- 日志输出级别 -->
38   - <root level="info">
39   - <appender-ref ref="FILE" />
40   - <appender-ref ref="STDOUT" />
41   - </root>
42   -
43   -</configuration>
44 0 \ No newline at end of file