Commit dfdfd532cf56f093691c032c0c53bb6452fa9d99
1 parent
d07bf7b8
1.共和县
Showing
7 changed files
with
19 additions
and
360 deletions
src/main/java/com/bsth/CXFConfig.java
| @@ -17,7 +17,6 @@ import com.bsth.server_rs.directive.DirectiveRestService; | @@ -17,7 +17,6 @@ import com.bsth.server_rs.directive.DirectiveRestService; | ||
| 17 | import com.bsth.server_rs.electric.ElectricService; | 17 | import com.bsth.server_rs.electric.ElectricService; |
| 18 | import com.bsth.server_rs.exception.AesExceptionMapper; | 18 | import com.bsth.server_rs.exception.AesExceptionMapper; |
| 19 | import com.bsth.server_rs.gps.GpsRestService; | 19 | import com.bsth.server_rs.gps.GpsRestService; |
| 20 | -import com.bsth.server_rs.info_publish.XxfbRestService; | ||
| 21 | import com.bsth.server_rs.logs.RealLogRestService; | 20 | import com.bsth.server_rs.logs.RealLogRestService; |
| 22 | import com.bsth.server_rs.rate.RateService; | 21 | import com.bsth.server_rs.rate.RateService; |
| 23 | import com.bsth.server_rs.schedule.plan.SchedulePlanService; | 22 | import com.bsth.server_rs.schedule.plan.SchedulePlanService; |
| @@ -130,8 +129,6 @@ public class CXFConfig { | @@ -130,8 +129,6 @@ public class CXFConfig { | ||
| 130 | private CarparkRestService carparkRestService; | 129 | private CarparkRestService carparkRestService; |
| 131 | @Autowired | 130 | @Autowired |
| 132 | private DepartureRestService departureRestService; | 131 | private DepartureRestService departureRestService; |
| 133 | - @Autowired | ||
| 134 | - private XxfbRestService xxfbRestService; | ||
| 135 | 132 | ||
| 136 | @Bean | 133 | @Bean |
| 137 | public Server rsServer() { | 134 | public Server rsServer() { |
| @@ -158,8 +155,7 @@ public class CXFConfig { | @@ -158,8 +155,7 @@ public class CXFConfig { | ||
| 158 | rateService, | 155 | rateService, |
| 159 | destroyDetailRestService, | 156 | destroyDetailRestService, |
| 160 | carparkRestService, | 157 | carparkRestService, |
| 161 | - departureRestService, | ||
| 162 | - xxfbRestService)); | 158 | + departureRestService)); |
| 163 | endpoint.setProviders(Arrays.asList(new JacksonJsonProvider(), new AesExceptionMapper())); | 159 | endpoint.setProviders(Arrays.asList(new JacksonJsonProvider(), new AesExceptionMapper())); |
| 164 | //endpoint.setFeatures(Arrays.asList(new Swagger2Feature())); | 160 | //endpoint.setFeatures(Arrays.asList(new Swagger2Feature())); |
| 165 | endpoint.getInInterceptors().add(new AuthorizeInterceptor_IN()); | 161 | endpoint.getInInterceptors().add(new AuthorizeInterceptor_IN()); |
src/main/java/com/bsth/server_rs/info_publish/Accuracy.java deleted
100644 → 0
| 1 | -package com.bsth.server_rs.info_publish; | ||
| 2 | - | ||
| 3 | -import com.fasterxml.jackson.annotation.JsonIgnore; | ||
| 4 | - | ||
| 5 | -public class Accuracy { | ||
| 6 | - | ||
| 7 | - private int rq; | ||
| 8 | - | ||
| 9 | - private String lineCode; | ||
| 10 | - | ||
| 11 | - private String lineName; | ||
| 12 | - | ||
| 13 | - @JsonIgnore | ||
| 14 | - private int zfbs; | ||
| 15 | - | ||
| 16 | - @JsonIgnore | ||
| 17 | - private int jdzqs; | ||
| 18 | - | ||
| 19 | - @JsonIgnore | ||
| 20 | - private int xdzqs; | ||
| 21 | - | ||
| 22 | - private double jdzql; | ||
| 23 | - | ||
| 24 | - private double xdzql; | ||
| 25 | - | ||
| 26 | - public int getRq() { | ||
| 27 | - return rq; | ||
| 28 | - } | ||
| 29 | - | ||
| 30 | - public void setRq(int rq) { | ||
| 31 | - this.rq = rq; | ||
| 32 | - } | ||
| 33 | - | ||
| 34 | - public String getLineCode() { | ||
| 35 | - return lineCode; | ||
| 36 | - } | ||
| 37 | - | ||
| 38 | - public void setLineCode(String lineCode) { | ||
| 39 | - this.lineCode = lineCode; | ||
| 40 | - } | ||
| 41 | - | ||
| 42 | - public String getLineName() { | ||
| 43 | - return lineName; | ||
| 44 | - } | ||
| 45 | - | ||
| 46 | - public void setLineName(String lineName) { | ||
| 47 | - this.lineName = lineName; | ||
| 48 | - } | ||
| 49 | - | ||
| 50 | - public int getZfbs() { | ||
| 51 | - return zfbs; | ||
| 52 | - } | ||
| 53 | - | ||
| 54 | - public void setZfbs(int zfbs) { | ||
| 55 | - this.zfbs = zfbs; | ||
| 56 | - } | ||
| 57 | - | ||
| 58 | - public int getJdzqs() { | ||
| 59 | - return jdzqs; | ||
| 60 | - } | ||
| 61 | - | ||
| 62 | - public void setJdzqs(int jdzqs) { | ||
| 63 | - this.jdzqs = jdzqs; | ||
| 64 | - } | ||
| 65 | - | ||
| 66 | - public int getXdzqs() { | ||
| 67 | - return xdzqs; | ||
| 68 | - } | ||
| 69 | - | ||
| 70 | - public void setXdzqs(int xdzqs) { | ||
| 71 | - this.xdzqs = xdzqs; | ||
| 72 | - } | ||
| 73 | - | ||
| 74 | - public double getJdzql() { | ||
| 75 | - return jdzql; | ||
| 76 | - } | ||
| 77 | - | ||
| 78 | - public void setJdzql(double jdzql) { | ||
| 79 | - this.jdzql = jdzql; | ||
| 80 | - } | ||
| 81 | - | ||
| 82 | - public double getXdzql() { | ||
| 83 | - return xdzql; | ||
| 84 | - } | ||
| 85 | - | ||
| 86 | - public void setXdzql(double xdzql) { | ||
| 87 | - this.xdzql = xdzql; | ||
| 88 | - } | ||
| 89 | -} |
src/main/java/com/bsth/server_rs/info_publish/XxfbRestService.java deleted
100644 → 0
| 1 | -package com.bsth.server_rs.info_publish; | ||
| 2 | - | ||
| 3 | -import com.bsth.entity.DutyEmployee; | ||
| 4 | -import com.bsth.entity.ScheduleRealInfo; | ||
| 5 | -import com.bsth.util.DBUtils_Xxfb; | ||
| 6 | -import com.google.common.collect.ArrayListMultimap; | ||
| 7 | -import org.slf4j.Logger; | ||
| 8 | -import org.slf4j.LoggerFactory; | ||
| 9 | -import org.springframework.jdbc.core.BeanPropertyRowMapper; | ||
| 10 | -import org.springframework.jdbc.core.JdbcTemplate; | ||
| 11 | -import org.springframework.stereotype.Component; | ||
| 12 | - | ||
| 13 | -import javax.ws.rs.GET; | ||
| 14 | -import javax.ws.rs.Path; | ||
| 15 | -import javax.ws.rs.PathParam; | ||
| 16 | -import javax.ws.rs.Produces; | ||
| 17 | -import javax.ws.rs.core.MediaType; | ||
| 18 | -import java.util.*; | ||
| 19 | - | ||
| 20 | -/** | ||
| 21 | - * @author Hill. | ||
| 22 | - */ | ||
| 23 | -@Component | ||
| 24 | -@Path("/xxfb") | ||
| 25 | -@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) | ||
| 26 | -public class XxfbRestService { | ||
| 27 | - | ||
| 28 | - private static Logger logger = LoggerFactory.getLogger(XxfbRestService.class); | ||
| 29 | - | ||
| 30 | - @GET | ||
| 31 | - @Path("/{rq}/{lineCode}") | ||
| 32 | - public Map<String, Object> waybill(@PathParam("rq") int rq, @PathParam("lineCode") String lineCode) { | ||
| 33 | - Map<String, Object> map = new HashMap<String, Object>(); | ||
| 34 | - map.put("errCode", "0"); | ||
| 35 | - try { | ||
| 36 | - JdbcTemplate jdbcTemplate = DBUtils_Xxfb.getJdbcTemplate(); | ||
| 37 | - List<Accuracy> accuracies = jdbcTemplate.query("select * from bsth_h_accuracy where rq = ? and line_code = ? order by rq, line_code", new Object[] { rq, lineCode }, BeanPropertyRowMapper.newInstance(Accuracy.class)); | ||
| 38 | - map.put("data", accuracies); | ||
| 39 | - } catch (Exception e) { | ||
| 40 | - logger.error("", e); | ||
| 41 | - map.put("errCode", 1); | ||
| 42 | - map.put("errMsg", "服务器出现异常!"); | ||
| 43 | - } | ||
| 44 | - | ||
| 45 | - return map; | ||
| 46 | - } | ||
| 47 | - | ||
| 48 | - @GET | ||
| 49 | - @Path("/{rq}") | ||
| 50 | - public Map<String, Object> waybill(@PathParam("rq") int rq) { | ||
| 51 | - Map<String, Object> map = new HashMap<String, Object>(); | ||
| 52 | - map.put("errCode", "0"); | ||
| 53 | - try { | ||
| 54 | - JdbcTemplate jdbcTemplate = DBUtils_Xxfb.getJdbcTemplate(); | ||
| 55 | - List<Accuracy> accuracies = jdbcTemplate.query("select * from bsth_h_accuracy where rq = ? order by rq, line_code", new Object[] { rq }, BeanPropertyRowMapper.newInstance(Accuracy.class)); | ||
| 56 | - map.put("data", accuracies); | ||
| 57 | - } catch (Exception e) { | ||
| 58 | - logger.error("", e); | ||
| 59 | - map.put("errCode", 1); | ||
| 60 | - map.put("errMsg", "服务器出现异常!"); | ||
| 61 | - } | ||
| 62 | - | ||
| 63 | - return map; | ||
| 64 | - } | ||
| 65 | -} |
src/main/java/com/bsth/util/DBUtils_Xxfb.java deleted
100644 → 0
| 1 | -package com.bsth.util; | ||
| 2 | - | ||
| 3 | -import com.mchange.v2.c3p0.DataSources; | ||
| 4 | -import org.apache.log4j.Logger; | ||
| 5 | -import org.springframework.beans.factory.InitializingBean; | ||
| 6 | -import org.springframework.beans.factory.annotation.Value; | ||
| 7 | -import org.springframework.jdbc.core.JdbcTemplate; | ||
| 8 | -import org.springframework.stereotype.Component; | ||
| 9 | - | ||
| 10 | -import javax.sql.DataSource; | ||
| 11 | -import java.sql.Connection; | ||
| 12 | -import java.sql.ResultSet; | ||
| 13 | -import java.sql.SQLException; | ||
| 14 | -import java.sql.Statement; | ||
| 15 | -import java.util.HashMap; | ||
| 16 | -import java.util.Map; | ||
| 17 | - | ||
| 18 | -/** | ||
| 19 | - * 网关ms库连接池 | ||
| 20 | - * @author PanZhao | ||
| 21 | - * | ||
| 22 | - */ | ||
| 23 | -@Component | ||
| 24 | -public class DBUtils_Xxfb implements InitializingBean { | ||
| 25 | - | ||
| 26 | - @Value("${xxfb.mysql.driver}") | ||
| 27 | - private String driver; | ||
| 28 | - | ||
| 29 | - @Value("${xxfb.mysql.url}") | ||
| 30 | - private String url = null; | ||
| 31 | - | ||
| 32 | - @Value("${xxfb.mysql.username}") | ||
| 33 | - private String username = null; | ||
| 34 | - | ||
| 35 | - @Value("${xxfb.mysql.password}") | ||
| 36 | - private String pwd = null; | ||
| 37 | - | ||
| 38 | - private static DataSource ds_pooled; | ||
| 39 | - | ||
| 40 | - private static JdbcTemplate jdbcTemplate; | ||
| 41 | - | ||
| 42 | - static Logger logger = Logger.getLogger(DBUtils_Xxfb.class); | ||
| 43 | - | ||
| 44 | - /** | ||
| 45 | - * 获取连接对象 | ||
| 46 | - */ | ||
| 47 | - public static Connection getConnection() throws SQLException { | ||
| 48 | - return ds_pooled.getConnection(); | ||
| 49 | - } | ||
| 50 | - | ||
| 51 | - /** | ||
| 52 | - * 释放连接池资源 | ||
| 53 | - */ | ||
| 54 | - public static void clearup() { | ||
| 55 | - if (ds_pooled != null) { | ||
| 56 | - try { | ||
| 57 | - DataSources.destroy(ds_pooled); | ||
| 58 | - } catch (SQLException e) { | ||
| 59 | - logger.error(e.toString()); | ||
| 60 | - e.printStackTrace(); | ||
| 61 | - } | ||
| 62 | - } | ||
| 63 | - } | ||
| 64 | - | ||
| 65 | - /** | ||
| 66 | - * 资源关闭 | ||
| 67 | - * | ||
| 68 | - * @param rs | ||
| 69 | - * @param stmt | ||
| 70 | - * @param conn | ||
| 71 | - */ | ||
| 72 | - public static void close(ResultSet rs, Statement stmt, Connection conn) { | ||
| 73 | - if (rs != null) { | ||
| 74 | - try { | ||
| 75 | - rs.close(); | ||
| 76 | - } catch (SQLException e) { | ||
| 77 | - logger.error(e.toString()); | ||
| 78 | - e.printStackTrace(); | ||
| 79 | - } | ||
| 80 | - } | ||
| 81 | - | ||
| 82 | - if (stmt != null) { | ||
| 83 | - try { | ||
| 84 | - stmt.close(); | ||
| 85 | - } catch (SQLException e) { | ||
| 86 | - logger.error(e.toString()); | ||
| 87 | - e.printStackTrace(); | ||
| 88 | - } | ||
| 89 | - } | ||
| 90 | - | ||
| 91 | - if (conn != null) { | ||
| 92 | - try { | ||
| 93 | - conn.close(); | ||
| 94 | - } catch (SQLException e) { | ||
| 95 | - logger.error(e.toString()); | ||
| 96 | - e.printStackTrace(); | ||
| 97 | - } | ||
| 98 | - } | ||
| 99 | - } | ||
| 100 | - | ||
| 101 | - public static DataSource getDataSource(){ | ||
| 102 | - return ds_pooled; | ||
| 103 | - } | ||
| 104 | - | ||
| 105 | - public static JdbcTemplate getJdbcTemplate() { | ||
| 106 | - return jdbcTemplate; | ||
| 107 | - } | ||
| 108 | - | ||
| 109 | - @Override | ||
| 110 | - public void afterPropertiesSet() throws Exception { | ||
| 111 | - try { | ||
| 112 | - Class.forName(driver); | ||
| 113 | - // 设置连接数据库的配置信息 | ||
| 114 | - DataSource ds_un_pooled = DataSources.unpooledDataSource(url, username, pwd); | ||
| 115 | - Map<String, Object> pool_conf = new HashMap<>(); | ||
| 116 | - // 设置最大连接数 | ||
| 117 | - pool_conf.put("maxPoolSize", 10); | ||
| 118 | - | ||
| 119 | - pool_conf.put("testConnectionOnCheckout", false); | ||
| 120 | - //异步检测连接的有效性 | ||
| 121 | - pool_conf.put("testConnectionOnCheckin", true); | ||
| 122 | - //30秒检测一次 | ||
| 123 | - pool_conf.put("idleConnectionTestPeriod", 30); | ||
| 124 | - ds_pooled = DataSources.pooledDataSource(ds_un_pooled, pool_conf); | ||
| 125 | - jdbcTemplate = new JdbcTemplate(ds_pooled); | ||
| 126 | - } catch (ClassNotFoundException e) { | ||
| 127 | - logger.error(e.toString()); | ||
| 128 | - } catch (SQLException e) { | ||
| 129 | - logger.error(e.toString()); | ||
| 130 | - } | ||
| 131 | - } | ||
| 132 | -} |
src/main/resources/application-ghx.properties
| @@ -37,9 +37,4 @@ http.gps.real.url= http://127.0.0.1:8080/transport_server/rtgps/ | @@ -37,9 +37,4 @@ http.gps.real.url= http://127.0.0.1:8080/transport_server/rtgps/ | ||
| 37 | ms.mysql.driver= com.mysql.jdbc.Driver | 37 | ms.mysql.driver= com.mysql.jdbc.Driver |
| 38 | ms.mysql.url= jdbc:mysql://192.168.0.227/ms?useUnicode=true&characterEncoding=utf-8 | 38 | ms.mysql.url= jdbc:mysql://192.168.0.227/ms?useUnicode=true&characterEncoding=utf-8 |
| 39 | ms.mysql.username= root | 39 | ms.mysql.username= root |
| 40 | -ms.mysql.password= root2jsp | ||
| 41 | - | ||
| 42 | -xxfb.mysql.driver= com.mysql.jdbc.Driver | ||
| 43 | -xxfb.mysql.url= jdbc:mysql://192.168.0.227/info_publish?useUnicode=true&characterEncoding=utf-8 | ||
| 44 | -xxfb.mysql.username= root | ||
| 45 | -xxfb.mysql.password= root2jsp | ||
| 46 | \ No newline at end of file | 40 | \ No newline at end of file |
| 41 | +ms.mysql.password= root2jsp | ||
| 47 | \ No newline at end of file | 42 | \ No newline at end of file |
src/main/resources/application-prod.properties deleted
100644 → 0
| 1 | -server.port=9089 | ||
| 2 | -management.port= 9001 | ||
| 3 | -management.address= 127.0.0.1 | ||
| 4 | - | ||
| 5 | -spring.jpa.hibernate.ddl-auto= none | ||
| 6 | -spring.jpa.hibernate.naming_strategy= org.hibernate.cfg.ImprovedNamingStrategy | ||
| 7 | -#DATABASE | ||
| 8 | -spring.jpa.database= MYSQL | ||
| 9 | -spring.jpa.show-sql= false | ||
| 10 | -spring.datasource.driver-class-name= com.mysql.jdbc.Driver | ||
| 11 | -spring.datasource.url= jdbc:mysql://58.34.47.74/control?useUnicode=true&characterEncoding=utf-8&useSSL=false | ||
| 12 | -spring.datasource.username= root | ||
| 13 | -spring.datasource.password= A123456ab | ||
| 14 | -#DATASOURCE | ||
| 15 | -spring.datasource.max-active=100 | ||
| 16 | -spring.datasource.max-idle=8 | ||
| 17 | -spring.datasource.min-idle=8 | ||
| 18 | -spring.datasource.initial-size=3 | ||
| 19 | - | ||
| 20 | -spring.datasource.test-on-borrow=true | ||
| 21 | -spring.datasource.test-on-connect=true | ||
| 22 | -spring.datasource.test-on-return=true | ||
| 23 | -spring.datasource.test-while-idle=true | ||
| 24 | -spring.datasource.validation-query=select 1 | ||
| 25 | - | ||
| 26 | -#REDIS | ||
| 27 | -spring.redis.database=0 | ||
| 28 | -spring.redis.host=127.0.0.1 | ||
| 29 | -spring.redis.password=LHjDZkwL2y41IvQk | ||
| 30 | -spring.redis.port=16379 | ||
| 31 | - | ||
| 32 | -http.control.service_data_url= http://127.0.0.1:9088/companyService | ||
| 33 | -http.control.secret.key= dVPHJkWUt5FhMT7jrM2dLV7QvlHAmZFd42rs1P0usBx8A7HZki | ||
| 34 | - | ||
| 35 | -http.gps.real.url= http://127.0.0.1:8080/transport_server/rtgps/ | ||
| 36 | - | ||
| 37 | -ms.mysql.driver= com.mysql.jdbc.Driver | ||
| 38 | -ms.mysql.url= jdbc:mysql://58.34.47.74/ms?useUnicode=true&characterEncoding=utf-8 | ||
| 39 | -ms.mysql.username= root | ||
| 40 | -ms.mysql.password= A123456ab | ||
| 41 | - | ||
| 42 | -xxfb.mysql.driver= com.mysql.jdbc.Driver | ||
| 43 | -xxfb.mysql.url= jdbc:mysql://58.34.47.74/info_publish?useUnicode=true&characterEncoding=utf-8 | ||
| 44 | -xxfb.mysql.username= root | ||
| 45 | -xxfb.mysql.password= A123456ab | ||
| 46 | \ No newline at end of file | 0 | \ No newline at end of file |
src/main/resources/application.properties
| 1 | -spring.profiles: dev,prod | ||
| 2 | -spring.profiles.active: prod | ||
| 3 | - | ||
| 4 | -spring.view.suffix=.html | ||
| 5 | -server.session-timeout=-1 | ||
| 6 | -security.basic.enabled=false | ||
| 7 | - | ||
| 8 | -# \u4E0A\u4F20\u6587\u4EF6\u5927\u5C0F\u9650\u5236\u914D\u7F6E | ||
| 9 | -# File size limit | ||
| 10 | -multipart.maxFileSize = -1 | ||
| 11 | -# Total request size for a multipart/form-data | ||
| 12 | -multipart.maxRequestSize = -1 | ||
| 13 | - | ||
| 14 | -server.compression.enabled=true | ||
| 15 | -server.compression.mime-types=application/json,application/xml,text/html,text/xml,text/plain,text/javascript,text/css,application/javascript | ||
| 16 | - | ||
| 17 | -#redis | ||
| 18 | -cache.days=15 | 1 | +spring.profiles.active= ghx |
| 2 | + | ||
| 3 | +spring.view.suffix=.html | ||
| 4 | +server.session-timeout=-1 | ||
| 5 | +security.basic.enabled=false | ||
| 6 | + | ||
| 7 | +# \u4E0A\u4F20\u6587\u4EF6\u5927\u5C0F\u9650\u5236\u914D\u7F6E | ||
| 8 | +# File size limit | ||
| 9 | +multipart.maxFileSize = -1 | ||
| 10 | +# Total request size for a multipart/form-data | ||
| 11 | +multipart.maxRequestSize = -1 | ||
| 12 | + | ||
| 13 | +server.compression.enabled=true | ||
| 14 | +server.compression.mime-types=application/json,application/xml,text/html,text/xml,text/plain,text/javascript,text/css,application/javascript | ||
| 15 | + | ||
| 16 | +#redis | ||
| 17 | +cache.days=15 |