Commit d6b091f5727af339384f6deda5935a95a16d9b39
1.application.properties文件部分参数转换成SystemParam数据
Showing
41 changed files
with
1309 additions
and
1331 deletions
pom.xml
| @@ -431,7 +431,6 @@ | @@ -431,7 +431,6 @@ | ||
| 431 | <plugins> | 431 | <plugins> |
| 432 | <plugin> | 432 | <plugin> |
| 433 | <artifactId>maven-compiler-plugin</artifactId> | 433 | <artifactId>maven-compiler-plugin</artifactId> |
| 434 | - <version>2.3.2</version><!--$NO-MVN-MAN-VER$ --> | ||
| 435 | <configuration> | 434 | <configuration> |
| 436 | <source>1.8</source> | 435 | <source>1.8</source> |
| 437 | <target>1.8</target> | 436 | <target>1.8</target> |
| @@ -439,7 +438,6 @@ | @@ -439,7 +438,6 @@ | ||
| 439 | </plugin> | 438 | </plugin> |
| 440 | <plugin> | 439 | <plugin> |
| 441 | <artifactId>maven-war-plugin</artifactId> | 440 | <artifactId>maven-war-plugin</artifactId> |
| 442 | - <version>2.2</version><!--$NO-MVN-MAN-VER$ --> | ||
| 443 | <configuration> | 441 | <configuration> |
| 444 | <failOnMissingWebXml>false</failOnMissingWebXml> | 442 | <failOnMissingWebXml>false</failOnMissingWebXml> |
| 445 | </configuration> | 443 | </configuration> |
src/main/java/com/bsth/Application.java
| 1 | package com.bsth; | 1 | package com.bsth; |
| 2 | 2 | ||
| 3 | +import com.bsth.data.SystemParamCache; | ||
| 3 | import com.fasterxml.jackson.annotation.JsonInclude; | 4 | import com.fasterxml.jackson.annotation.JsonInclude; |
| 4 | import com.fasterxml.jackson.databind.ObjectMapper; | 5 | import com.fasterxml.jackson.databind.ObjectMapper; |
| 5 | import com.fasterxml.jackson.databind.SerializationFeature; | 6 | import com.fasterxml.jackson.databind.SerializationFeature; |
| 7 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 6 | import org.springframework.boot.SpringApplication; | 8 | import org.springframework.boot.SpringApplication; |
| 7 | import org.springframework.boot.autoconfigure.SpringBootApplication; | 9 | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| 8 | import org.springframework.boot.builder.SpringApplicationBuilder; | 10 | import org.springframework.boot.builder.SpringApplicationBuilder; |
| @@ -22,6 +24,9 @@ public class Application extends SpringBootServletInitializer { | @@ -22,6 +24,9 @@ public class Application extends SpringBootServletInitializer { | ||
| 22 | 24 | ||
| 23 | public static ScheduledExecutorService mainServices = Executors.newScheduledThreadPool(21); | 25 | public static ScheduledExecutorService mainServices = Executors.newScheduledThreadPool(21); |
| 24 | 26 | ||
| 27 | + @Autowired | ||
| 28 | + private SystemParamCache systemParamCache; | ||
| 29 | + | ||
| 25 | @Override | 30 | @Override |
| 26 | protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { | 31 | protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { |
| 27 | return application.sources(Application.class); | 32 | return application.sources(Application.class); |
src/main/java/com/bsth/StartCommand.java
| 1 | -package com.bsth; | ||
| 2 | - | ||
| 3 | - | ||
| 4 | -import com.bsth.security.SecurityMetadataSourceService; | ||
| 5 | - | ||
| 6 | -import org.slf4j.Logger; | ||
| 7 | -import org.slf4j.LoggerFactory; | ||
| 8 | -import org.springframework.beans.factory.annotation.Autowired; | ||
| 9 | -import org.springframework.boot.CommandLineRunner; | ||
| 10 | -import org.springframework.stereotype.Component; | ||
| 11 | - | ||
| 12 | - | ||
| 13 | -/** | ||
| 14 | - * 随应用启动运行 | ||
| 15 | - * @author PanZhao | ||
| 16 | - * | ||
| 17 | - */ | ||
| 18 | -@Component | ||
| 19 | -public class StartCommand implements CommandLineRunner{ | ||
| 20 | - | ||
| 21 | - Logger logger = LoggerFactory.getLogger(this.getClass()); | ||
| 22 | - | ||
| 23 | - @Autowired | ||
| 24 | - SecurityMetadataSourceService invocationSecurityMetadataSourceService; | ||
| 25 | - | ||
| 26 | - @Override | ||
| 27 | - public void run(String... arg0){ | ||
| 28 | - | ||
| 29 | - try { | ||
| 30 | - //启动时加载所有资源 | ||
| 31 | - invocationSecurityMetadataSourceService.loadResourceDefine(); | ||
| 32 | - | ||
| 33 | - } catch (Exception e) { | ||
| 34 | - e.printStackTrace(); | ||
| 35 | - } | ||
| 36 | - } | ||
| 37 | -} | 1 | +package com.bsth; |
| 2 | + | ||
| 3 | + | ||
| 4 | +import com.bsth.security.SecurityMetadataSourceService; | ||
| 5 | + | ||
| 6 | +import org.slf4j.Logger; | ||
| 7 | +import org.slf4j.LoggerFactory; | ||
| 8 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 9 | +import org.springframework.boot.CommandLineRunner; | ||
| 10 | +import org.springframework.stereotype.Component; | ||
| 11 | + | ||
| 12 | + | ||
| 13 | +/** | ||
| 14 | + * 随应用启动运行 | ||
| 15 | + * @author PanZhao | ||
| 16 | + * | ||
| 17 | + */ | ||
| 18 | +@Component | ||
| 19 | +public class StartCommand implements CommandLineRunner{ | ||
| 20 | + | ||
| 21 | + Logger logger = LoggerFactory.getLogger(this.getClass()); | ||
| 22 | + | ||
| 23 | + @Autowired | ||
| 24 | + SecurityMetadataSourceService invocationSecurityMetadataSourceService; | ||
| 25 | + | ||
| 26 | + @Override | ||
| 27 | + public void run(String... arg0){ | ||
| 28 | + | ||
| 29 | + try { | ||
| 30 | + //启动时加载所有资源 | ||
| 31 | + invocationSecurityMetadataSourceService.loadResourceDefine(); | ||
| 32 | + } catch (Exception e) { | ||
| 33 | + e.printStackTrace(); | ||
| 34 | + } | ||
| 35 | + } | ||
| 36 | +} |
src/main/java/com/bsth/XDApplication.java
| @@ -46,8 +46,6 @@ public class XDApplication implements CommandLineRunner { | @@ -46,8 +46,6 @@ public class XDApplication implements CommandLineRunner { | ||
| 46 | @Autowired | 46 | @Autowired |
| 47 | BasicData.BasicDataLoader basicDataLoader; | 47 | BasicData.BasicDataLoader basicDataLoader; |
| 48 | @Autowired | 48 | @Autowired |
| 49 | - BasicData.WhiteIpDataLoader whiteIpDataLoader; | ||
| 50 | - @Autowired | ||
| 51 | UpdateDBThread fcxxUpdateThread; | 49 | UpdateDBThread fcxxUpdateThread; |
| 52 | @Autowired | 50 | @Autowired |
| 53 | ScheduleRefreshThread scheduleRefreshThread; | 51 | ScheduleRefreshThread scheduleRefreshThread; |
| @@ -164,7 +162,6 @@ public class XDApplication implements CommandLineRunner { | @@ -164,7 +162,6 @@ public class XDApplication implements CommandLineRunner { | ||
| 164 | sexec.scheduleWithFixedDelay(threadMonotor, 240, 60, TimeUnit.SECONDS);//线程监听(防止重要的线程阻塞、异常结束。以及部分主备切换工作) | 162 | sexec.scheduleWithFixedDelay(threadMonotor, 240, 60, TimeUnit.SECONDS);//线程监听(防止重要的线程阻塞、异常结束。以及部分主备切换工作) |
| 165 | sexec.scheduleWithFixedDelay(sampleTimeDataLoader, 140, 120 * 60, TimeUnit.SECONDS);//到离站预测需要的站点间耗时数据 | 163 | sexec.scheduleWithFixedDelay(sampleTimeDataLoader, 140, 120 * 60, TimeUnit.SECONDS);//到离站预测需要的站点间耗时数据 |
| 166 | sexec.scheduleWithFixedDelay(basicDataLoader, 1, 1, TimeUnit.HOURS);//基础数据更新 | 164 | sexec.scheduleWithFixedDelay(basicDataLoader, 1, 1, TimeUnit.HOURS);//基础数据更新 |
| 167 | - sexec.scheduleWithFixedDelay(whiteIpDataLoader, 0, 1, TimeUnit.MINUTES);//IP白名单数据更新 | ||
| 168 | sexec.scheduleWithFixedDelay(autoExecScanThread, 180, 50, TimeUnit.SECONDS);//班次自动执行 | 165 | sexec.scheduleWithFixedDelay(autoExecScanThread, 180, 50, TimeUnit.SECONDS);//班次自动执行 |
| 169 | //DirectivePushQueue.start();//消息队列 -指令,系统下发的 | 166 | //DirectivePushQueue.start();//消息队列 -指令,系统下发的 |
| 170 | WebSocketPushQueue.start();//消息队列 -webSocket ,推送至线调web页面的 | 167 | WebSocketPushQueue.start();//消息队列 -webSocket ,推送至线调web页面的 |
| @@ -210,7 +207,6 @@ public class XDApplication implements CommandLineRunner { | @@ -210,7 +207,6 @@ public class XDApplication implements CommandLineRunner { | ||
| 210 | sexec.scheduleWithFixedDelay(threadMonotor, 240, 60, TimeUnit.SECONDS);//线程监听(防止重要的线程阻塞、异常结束。以及部分主备切换工作) | 207 | sexec.scheduleWithFixedDelay(threadMonotor, 240, 60, TimeUnit.SECONDS);//线程监听(防止重要的线程阻塞、异常结束。以及部分主备切换工作) |
| 211 | sexec.scheduleWithFixedDelay(sampleTimeDataLoader, 140, 120 * 60, TimeUnit.SECONDS);//到离站预测需要的站点间耗时数据 | 208 | sexec.scheduleWithFixedDelay(sampleTimeDataLoader, 140, 120 * 60, TimeUnit.SECONDS);//到离站预测需要的站点间耗时数据 |
| 212 | sexec.scheduleWithFixedDelay(basicDataLoader, 1, 1, TimeUnit.HOURS);//基础数据更新 | 209 | sexec.scheduleWithFixedDelay(basicDataLoader, 1, 1, TimeUnit.HOURS);//基础数据更新 |
| 213 | - sexec.scheduleWithFixedDelay(whiteIpDataLoader, 0, 1, TimeUnit.MINUTES);//IP白名单数据更新 | ||
| 214 | sexec.scheduleWithFixedDelay(autoExecScanThread, 180, 50, TimeUnit.SECONDS);//班次自动执行 | 210 | sexec.scheduleWithFixedDelay(autoExecScanThread, 180, 50, TimeUnit.SECONDS);//班次自动执行 |
| 215 | DirectivePushQueue.start();//消息队列 -指令,系统下发的 | 211 | DirectivePushQueue.start();//消息队列 -指令,系统下发的 |
| 216 | WebSocketPushQueue.start();//消息队列 -webSocket ,推送至线调web页面的 | 212 | WebSocketPushQueue.start();//消息队列 -webSocket ,推送至线调web页面的 |
| @@ -257,7 +253,6 @@ public class XDApplication implements CommandLineRunner { | @@ -257,7 +253,6 @@ public class XDApplication implements CommandLineRunner { | ||
| 257 | sexec.scheduleWithFixedDelay(threadMonotor, 240, 60, TimeUnit.SECONDS);//线程监听(防止重要的线程阻塞、异常结束。以及部分主备切换工作) | 253 | sexec.scheduleWithFixedDelay(threadMonotor, 240, 60, TimeUnit.SECONDS);//线程监听(防止重要的线程阻塞、异常结束。以及部分主备切换工作) |
| 258 | sexec.scheduleWithFixedDelay(sampleTimeDataLoader, 140, 120 * 60, TimeUnit.SECONDS);//到离站预测需要的站点间耗时数据 | 254 | sexec.scheduleWithFixedDelay(sampleTimeDataLoader, 140, 120 * 60, TimeUnit.SECONDS);//到离站预测需要的站点间耗时数据 |
| 259 | sexec.scheduleWithFixedDelay(basicDataLoader, 1, 1, TimeUnit.HOURS);//基础数据更新 | 255 | sexec.scheduleWithFixedDelay(basicDataLoader, 1, 1, TimeUnit.HOURS);//基础数据更新 |
| 260 | - sexec.scheduleWithFixedDelay(whiteIpDataLoader, 0, 1, TimeUnit.MINUTES);//IP白名单数据更新 | ||
| 261 | sexec.scheduleWithFixedDelay(autoExecScanThread, 180, 50, TimeUnit.SECONDS);//班次自动执行 | 256 | sexec.scheduleWithFixedDelay(autoExecScanThread, 180, 50, TimeUnit.SECONDS);//班次自动执行 |
| 262 | //DirectivePushQueue.start();//消息队列 -指令,系统下发的 | 257 | //DirectivePushQueue.start();//消息队列 -指令,系统下发的 |
| 263 | WebSocketPushQueue.start();//消息队列 -webSocket ,推送至线调web页面的 | 258 | WebSocketPushQueue.start();//消息队列 -webSocket ,推送至线调web页面的 |
| @@ -303,7 +298,6 @@ public class XDApplication implements CommandLineRunner { | @@ -303,7 +298,6 @@ public class XDApplication implements CommandLineRunner { | ||
| 303 | sexec.scheduleWithFixedDelay(threadMonotor, 240, 60, TimeUnit.SECONDS);//线程监听(防止重要的线程阻塞、异常结束。以及部分主备切换工作) | 298 | sexec.scheduleWithFixedDelay(threadMonotor, 240, 60, TimeUnit.SECONDS);//线程监听(防止重要的线程阻塞、异常结束。以及部分主备切换工作) |
| 304 | sexec.scheduleWithFixedDelay(sampleTimeDataLoader, 140, 120 * 60, TimeUnit.SECONDS);//到离站预测需要的站点间耗时数据 | 299 | sexec.scheduleWithFixedDelay(sampleTimeDataLoader, 140, 120 * 60, TimeUnit.SECONDS);//到离站预测需要的站点间耗时数据 |
| 305 | sexec.scheduleWithFixedDelay(basicDataLoader, 1, 1, TimeUnit.HOURS);//基础数据更新 | 300 | sexec.scheduleWithFixedDelay(basicDataLoader, 1, 1, TimeUnit.HOURS);//基础数据更新 |
| 306 | - sexec.scheduleWithFixedDelay(whiteIpDataLoader, 0, 1, TimeUnit.MINUTES);//IP白名单数据更新 | ||
| 307 | sexec.scheduleWithFixedDelay(autoExecScanThread, 180, 50, TimeUnit.SECONDS);//班次自动执行 | 301 | sexec.scheduleWithFixedDelay(autoExecScanThread, 180, 50, TimeUnit.SECONDS);//班次自动执行 |
| 308 | DirectivePushQueue.start();//消息队列 -指令,系统下发的 | 302 | DirectivePushQueue.start();//消息队列 -指令,系统下发的 |
| 309 | WebSocketPushQueue.start();//消息队列 -webSocket ,推送至线调web页面的 | 303 | WebSocketPushQueue.start();//消息队列 -webSocket ,推送至线调web页面的 |
src/main/java/com/bsth/common/Setting.java deleted
100644 → 0
| 1 | -package com.bsth.common; | ||
| 2 | - | ||
| 3 | -import org.springframework.beans.factory.annotation.Value; | ||
| 4 | -import org.springframework.stereotype.Component; | ||
| 5 | - | ||
| 6 | -@Component | ||
| 7 | -public class Setting { | ||
| 8 | - | ||
| 9 | - | ||
| 10 | - private static boolean whiteipEnabled; | ||
| 11 | - | ||
| 12 | - private static boolean authorityEnabled; | ||
| 13 | - | ||
| 14 | - public static boolean isWhiteipEnabled() { | ||
| 15 | - return whiteipEnabled; | ||
| 16 | - } | ||
| 17 | - | ||
| 18 | - @Value("${enabled.whiteip}") | ||
| 19 | - public void setWhiteipEnabled(boolean whiteipEnabled) { | ||
| 20 | - Setting.whiteipEnabled = whiteipEnabled; | ||
| 21 | - } | ||
| 22 | - | ||
| 23 | - public static boolean isAuthorityEnabled() { | ||
| 24 | - return authorityEnabled; | ||
| 25 | - } | ||
| 26 | - | ||
| 27 | - @Value("${enabled.authority}") | ||
| 28 | - public void setAuthorityEnabled(boolean authorityEnabled) { | ||
| 29 | - Setting.authorityEnabled = authorityEnabled; | ||
| 30 | - } | ||
| 31 | -} |
src/main/java/com/bsth/common/SystemParamKeys.java
| @@ -6,4 +6,44 @@ package com.bsth.common; | @@ -6,4 +6,44 @@ package com.bsth.common; | ||
| 6 | public class SystemParamKeys { | 6 | public class SystemParamKeys { |
| 7 | 7 | ||
| 8 | public static final String SPECIAL_ROLES = "special.roles"; | 8 | public static final String SPECIAL_ROLES = "special.roles"; |
| 9 | + | ||
| 10 | + public static final String URL_HTTP_GPS_REAL_CACHE = "url.http.gps.real.cache"; | ||
| 11 | + | ||
| 12 | + public static final String URL_HTTP_GPS_REAL = "url.http.gps.real"; | ||
| 13 | + | ||
| 14 | + public static final String URL_HTTP_DIRECTIVE = "url.http.directive"; | ||
| 15 | + | ||
| 16 | + public static final String URL_HTTP_RFID = "url.http.rfid"; | ||
| 17 | + | ||
| 18 | + public static final String URL_HTTP_REPORT = "url.http.report.%s"; | ||
| 19 | + | ||
| 20 | + public static final String URL_HTTP_TICKETING = "url.http.ticketing"; | ||
| 21 | + | ||
| 22 | + public static final String URL_HTTP_DSM_ACK = "url.http.dsm.ack"; | ||
| 23 | + | ||
| 24 | + public static final String URL_HTTP_CP_ACK = "url.http.cp.ack"; | ||
| 25 | + | ||
| 26 | + public static final String MAIL_ADMIN = "mail.admin"; | ||
| 27 | + | ||
| 28 | + public static final String MAIL_WAYBILL = "mail.waybill"; | ||
| 29 | + | ||
| 30 | + public static final String ENABLED_FIRST_LAST_GENERATION = "enabled.first.last.generation"; | ||
| 31 | + | ||
| 32 | + public static final String ENABLED_FILTER_SQL_INJECTION = "enabled.filter.sql.injection"; | ||
| 33 | + | ||
| 34 | + public static final String ENABLED_SSO = "enabled.sso"; | ||
| 35 | + | ||
| 36 | + public static final String SSO_SYSTEM_CODE = "sso.system.code"; | ||
| 37 | + | ||
| 38 | + public static final String URL_HTTP_SSO_LOGIN = "url.http.sso.login"; | ||
| 39 | + | ||
| 40 | + public static final String URL_HTTP_SSO_LOGOUT = "url.http.sso.logout"; | ||
| 41 | + | ||
| 42 | + public static final String URL_HTTP_SSO_AUTH = "url.http.sso.auth"; | ||
| 43 | + | ||
| 44 | + public static final String URL_HTTP_MAINTENANCE = "url.http.maintenance"; | ||
| 45 | + | ||
| 46 | + public static final String ENABLED_WHITE_IP = "enabled.white.ip"; | ||
| 47 | + | ||
| 48 | + public static final String ENABLED_FILTER_AUTHORITY = "enabled.filter.authority"; | ||
| 9 | } | 49 | } |
src/main/java/com/bsth/controller/realcontrol/AdminUtilsController.java
| @@ -2,18 +2,32 @@ package com.bsth.controller.realcontrol; | @@ -2,18 +2,32 @@ package com.bsth.controller.realcontrol; | ||
| 2 | 2 | ||
| 3 | import java.lang.reflect.Field; | 3 | import java.lang.reflect.Field; |
| 4 | import java.lang.reflect.Modifier; | 4 | import java.lang.reflect.Modifier; |
| 5 | -import java.text.SimpleDateFormat; | ||
| 6 | import java.util.*; | 5 | import java.util.*; |
| 7 | 6 | ||
| 8 | -import com.bsth.common.Setting; | ||
| 9 | import com.bsth.data.BasicData; | 7 | import com.bsth.data.BasicData; |
| 10 | import com.bsth.security.SsoConfig; | 8 | import com.bsth.security.SsoConfig; |
| 11 | import com.bsth.service.SectionService; | 9 | import com.bsth.service.SectionService; |
| 12 | import com.bsth.service.StationService; | 10 | import com.bsth.service.StationService; |
| 11 | +import com.bsth.data.SystemParamCache; | ||
| 12 | +import com.bsth.data.directive.DayOfDirectives; | ||
| 13 | +import com.bsth.data.directive.DirectivesPstThread; | ||
| 14 | +import com.bsth.data.directive.GatewayHttpUtils; | ||
| 15 | +import com.bsth.data.gpsdata_v2.cache.GeoCacheData; | ||
| 16 | +import com.bsth.data.gpsdata_v2.handlers.overspeed.OverspeedProcess; | ||
| 17 | +import com.bsth.data.gpsdata_v2.load.GatewayHttpLoader; | ||
| 18 | +import com.bsth.data.gpsdata_v2.load.SocketClientLoader; | ||
| 19 | +import com.bsth.data.gpsdata_v2.rfid.RfidHttpLoader; | ||
| 20 | +import com.bsth.data.gpsdata_v2.thread.GpsDataLoaderThread; | ||
| 21 | +import com.bsth.data.msg_queue.DirectivePushQueue; | ||
| 22 | +import com.bsth.data.msg_queue.WebSocketPushQueue; | ||
| 23 | +import com.bsth.data.pilot80.PilotReport; | ||
| 24 | +import com.bsth.data.schedule.DayOfSchedule; | ||
| 25 | +import com.bsth.entity.realcontrol.ScheduleRealInfo; | ||
| 26 | +import com.bsth.filter.SQLInjectFilter; | ||
| 27 | +import com.bsth.service.SystemParamService; | ||
| 13 | import com.bsth.service.schedule.utils.SpringUtils; | 28 | import com.bsth.service.schedule.utils.SpringUtils; |
| 14 | import com.bsth.util.MailUtils; | 29 | import com.bsth.util.MailUtils; |
| 15 | import com.fasterxml.jackson.core.JsonProcessingException; | 30 | import com.fasterxml.jackson.core.JsonProcessingException; |
| 16 | -import com.fasterxml.jackson.databind.MapperFeature; | ||
| 17 | import com.fasterxml.jackson.databind.ObjectMapper; | 31 | import com.fasterxml.jackson.databind.ObjectMapper; |
| 18 | import com.fasterxml.jackson.databind.SerializationFeature; | 32 | import com.fasterxml.jackson.databind.SerializationFeature; |
| 19 | import org.slf4j.Logger; | 33 | import org.slf4j.Logger; |
| @@ -24,16 +38,6 @@ import org.springframework.web.bind.annotation.RequestParam; | @@ -24,16 +38,6 @@ import org.springframework.web.bind.annotation.RequestParam; | ||
| 24 | import org.springframework.web.bind.annotation.RestController; | 38 | import org.springframework.web.bind.annotation.RestController; |
| 25 | 39 | ||
| 26 | import com.bsth.common.ResponseCode; | 40 | import com.bsth.common.ResponseCode; |
| 27 | -import com.bsth.data.directive.DayOfDirectives; | ||
| 28 | -import com.bsth.data.directive.DirectivesPstThread; | ||
| 29 | -import com.bsth.data.gpsdata_v2.cache.GeoCacheData; | ||
| 30 | -import com.bsth.data.gpsdata_v2.handlers.overspeed.OverspeedProcess; | ||
| 31 | -import com.bsth.data.gpsdata_v2.thread.GpsDataLoaderThread; | ||
| 32 | -import com.bsth.data.msg_queue.DirectivePushQueue; | ||
| 33 | -import com.bsth.data.msg_queue.WebSocketPushQueue; | ||
| 34 | -import com.bsth.data.pilot80.PilotReport; | ||
| 35 | -import com.bsth.data.schedule.DayOfSchedule; | ||
| 36 | -import com.bsth.entity.realcontrol.ScheduleRealInfo; | ||
| 37 | import com.bsth.websocket.handler.SendUtils; | 41 | import com.bsth.websocket.handler.SendUtils; |
| 38 | 42 | ||
| 39 | import ch.qos.logback.classic.Level; | 43 | import ch.qos.logback.classic.Level; |
| @@ -74,16 +78,28 @@ public class AdminUtilsController { | @@ -74,16 +78,28 @@ public class AdminUtilsController { | ||
| 74 | private BasicData.BasicDataLoader basicDataLoader; | 78 | private BasicData.BasicDataLoader basicDataLoader; |
| 75 | 79 | ||
| 76 | @Autowired | 80 | @Autowired |
| 77 | - private Setting setting; | 81 | + private SectionService sectionService; |
| 78 | 82 | ||
| 79 | @Autowired | 83 | @Autowired |
| 80 | - private SsoConfig ssoConfig; | 84 | + private StationService stationService; |
| 81 | 85 | ||
| 82 | @Autowired | 86 | @Autowired |
| 83 | - private SectionService sectionService; | 87 | + private SystemParamService systemParamService; |
| 84 | 88 | ||
| 85 | @Autowired | 89 | @Autowired |
| 86 | - private StationService stationService; | 90 | + private SocketClientLoader socketClientLoader; |
| 91 | + | ||
| 92 | + @Autowired | ||
| 93 | + private GatewayHttpLoader gatewayHttpLoader; | ||
| 94 | + | ||
| 95 | + @Autowired | ||
| 96 | + private GatewayHttpUtils gatewayHttpUtils; | ||
| 97 | + | ||
| 98 | + @Autowired | ||
| 99 | + private RfidHttpLoader rfidHttpLoader; | ||
| 100 | + | ||
| 101 | + @Autowired | ||
| 102 | + private SsoConfig ssoConfig; | ||
| 87 | 103 | ||
| 88 | /** | 104 | /** |
| 89 | * 出现重复班次的车辆 | 105 | * 出现重复班次的车辆 |
| @@ -286,33 +302,6 @@ public class AdminUtilsController { | @@ -286,33 +302,6 @@ public class AdminUtilsController { | ||
| 286 | return "error"; | 302 | return "error"; |
| 287 | } | 303 | } |
| 288 | 304 | ||
| 289 | - | ||
| 290 | - | ||
| 291 | - @RequestMapping("/changeEmail") | ||
| 292 | - public String changeEmail(@RequestParam String email) { | ||
| 293 | - Map<String, Object> result = new HashMap<>(); | ||
| 294 | - try { | ||
| 295 | - mailUtils.setEmailSendToAddress(email); | ||
| 296 | - return "success"; | ||
| 297 | - } catch (Exception e) { | ||
| 298 | - e.printStackTrace(); | ||
| 299 | - } | ||
| 300 | - | ||
| 301 | - return "error"; | ||
| 302 | - } | ||
| 303 | - | ||
| 304 | - @RequestMapping("/viewEmail") | ||
| 305 | - public String viewEmail() { | ||
| 306 | - Map<String, Object> result = new HashMap<>(); | ||
| 307 | - try { | ||
| 308 | - return mailUtils.getEmailSendToAddress(); | ||
| 309 | - } catch (Exception e) { | ||
| 310 | - e.printStackTrace(); | ||
| 311 | - } | ||
| 312 | - | ||
| 313 | - return "error"; | ||
| 314 | - } | ||
| 315 | - | ||
| 316 | @RequestMapping("/refreshBasicAll") | 305 | @RequestMapping("/refreshBasicAll") |
| 317 | public String refreshBasicAll() { | 306 | public String refreshBasicAll() { |
| 318 | Map<String, Object> result = new HashMap<>(); | 307 | Map<String, Object> result = new HashMap<>(); |
| @@ -326,11 +315,11 @@ public class AdminUtilsController { | @@ -326,11 +315,11 @@ public class AdminUtilsController { | ||
| 326 | return "error"; | 315 | return "error"; |
| 327 | } | 316 | } |
| 328 | 317 | ||
| 329 | - @RequestMapping("/whiteipSwitch") | ||
| 330 | - public String whiteipSwitch(boolean whiteipEnabled) { | 318 | + @RequestMapping("/setInjectStr") |
| 319 | + public String setInjectStr(@RequestParam String injectStr) { | ||
| 331 | Map<String, Object> result = new HashMap<>(); | 320 | Map<String, Object> result = new HashMap<>(); |
| 332 | try { | 321 | try { |
| 333 | - setting.setWhiteipEnabled(whiteipEnabled); | 322 | + SQLInjectFilter.setInjStr(injectStr); |
| 334 | return "success"; | 323 | return "success"; |
| 335 | } catch (Exception e) { | 324 | } catch (Exception e) { |
| 336 | e.printStackTrace(); | 325 | e.printStackTrace(); |
| @@ -339,11 +328,11 @@ public class AdminUtilsController { | @@ -339,11 +328,11 @@ public class AdminUtilsController { | ||
| 339 | return "error"; | 328 | return "error"; |
| 340 | } | 329 | } |
| 341 | 330 | ||
| 342 | - @RequestMapping("/ssoEnabledSwitch") | ||
| 343 | - public String ssoEnabledSwitch(boolean ssoEnabled) { | ||
| 344 | - Map<String, Object> result = new HashMap<>(); | 331 | + @RequestMapping("/reloadSystemParam") |
| 332 | + public String reloadSystemParam() { | ||
| 345 | try { | 333 | try { |
| 346 | - ssoConfig.setSsoEnabled(ssoEnabled); | 334 | + systemParamService.refresh(); |
| 335 | + | ||
| 347 | return "success"; | 336 | return "success"; |
| 348 | } catch (Exception e) { | 337 | } catch (Exception e) { |
| 349 | e.printStackTrace(); | 338 | e.printStackTrace(); |
| @@ -352,11 +341,16 @@ public class AdminUtilsController { | @@ -352,11 +341,16 @@ public class AdminUtilsController { | ||
| 352 | return "error"; | 341 | return "error"; |
| 353 | } | 342 | } |
| 354 | 343 | ||
| 355 | - @RequestMapping("/reloadSystemParam") | ||
| 356 | - public String reloadSystemParam() { | ||
| 357 | - Map<String, Object> result = new HashMap<>(); | 344 | + @RequestMapping("/applySystemParam") |
| 345 | + public String applySystemParam() { | ||
| 358 | try { | 346 | try { |
| 359 | - basicDataLoader.loadSystemParam(); | 347 | + socketClientLoader.afterPropertiesSet(); |
| 348 | + gatewayHttpLoader.afterPropertiesSet(); | ||
| 349 | + gatewayHttpUtils.afterPropertiesSet(); | ||
| 350 | + rfidHttpLoader.afterPropertiesSet(); | ||
| 351 | + ssoConfig.setSystemCode(SystemParamCache.getSsoSystemCode()); | ||
| 352 | + ssoConfig.setSsoAuthUrl(SystemParamCache.getUrlHttpSsoAuth()); | ||
| 353 | + | ||
| 360 | return "success"; | 354 | return "success"; |
| 361 | } catch (Exception e) { | 355 | } catch (Exception e) { |
| 362 | e.printStackTrace(); | 356 | e.printStackTrace(); |
| @@ -365,11 +359,18 @@ public class AdminUtilsController { | @@ -365,11 +359,18 @@ public class AdminUtilsController { | ||
| 365 | return "error"; | 359 | return "error"; |
| 366 | } | 360 | } |
| 367 | 361 | ||
| 368 | - @RequestMapping("/authoritySwitch") | ||
| 369 | - public String authoritySwitch(boolean authorityEnabled) { | ||
| 370 | - Map<String, Object> result = new HashMap<>(); | 362 | + @RequestMapping("/reloadAndApplySystemParam") |
| 363 | + public String reloadAndApplySystemParam() { | ||
| 371 | try { | 364 | try { |
| 372 | - setting.setAuthorityEnabled(authorityEnabled); | 365 | + systemParamService.refresh(); |
| 366 | + | ||
| 367 | + socketClientLoader.afterPropertiesSet(); | ||
| 368 | + gatewayHttpLoader.afterPropertiesSet(); | ||
| 369 | + gatewayHttpUtils.afterPropertiesSet(); | ||
| 370 | + rfidHttpLoader.afterPropertiesSet(); | ||
| 371 | + ssoConfig.setSystemCode(SystemParamCache.getSsoSystemCode()); | ||
| 372 | + ssoConfig.setSsoAuthUrl(SystemParamCache.getUrlHttpSsoAuth()); | ||
| 373 | + | ||
| 373 | return "success"; | 374 | return "success"; |
| 374 | } catch (Exception e) { | 375 | } catch (Exception e) { |
| 375 | e.printStackTrace(); | 376 | e.printStackTrace(); |
src/main/java/com/bsth/controller/realcontrol/ScheduleRealInfoController.java
| 1 | package com.bsth.controller.realcontrol; | 1 | package com.bsth.controller.realcontrol; |
| 2 | 2 | ||
| 3 | -import java.io.*; | ||
| 4 | -import java.net.HttpURLConnection; | ||
| 5 | -import java.net.MalformedURLException; | ||
| 6 | -import java.net.URL; | ||
| 7 | -import java.net.URLEncoder; | ||
| 8 | -import java.sql.Connection; | ||
| 9 | -import java.sql.Date; | ||
| 10 | -import java.sql.PreparedStatement; | ||
| 11 | -import java.sql.ResultSet; | ||
| 12 | -import java.util.*; | ||
| 13 | - | ||
| 14 | -import com.bsth.common.Constants; | ||
| 15 | -import com.bsth.data.forecast.entity.ArrivalEntity; | ||
| 16 | -import com.bsth.data.maintenance_plan.MaintenancePlan; | ||
| 17 | -import com.bsth.data.maintenance_plan.MtPlanCenter; | ||
| 18 | -import com.bsth.entity.SystemParam; | ||
| 19 | -import com.bsth.entity.sys.Role; | 3 | +import com.alibaba.fastjson.JSONArray; |
| 4 | +import com.bsth.common.ResponseCode; | ||
| 5 | +import com.bsth.controller.BaseController; | ||
| 6 | +import com.bsth.controller.realcontrol.dto.ChangePersonCar; | ||
| 7 | +import com.bsth.controller.realcontrol.dto.DfsjChange; | ||
| 8 | +import com.bsth.data.BasicData; | ||
| 9 | +import com.bsth.data.SystemParamCache; | ||
| 10 | +import com.bsth.data.schedule.DayOfSchedule; | ||
| 11 | +import com.bsth.data.schedule.edit_logs.service.dto.SchEditInfoDto; | ||
| 12 | +import com.bsth.entity.realcontrol.ScheduleRealInfo; | ||
| 13 | +import com.bsth.entity.report.RepairReport; | ||
| 14 | +import com.bsth.entity.schedule.SchedulePlanInfo; | ||
| 20 | import com.bsth.entity.sys.SysUser; | 15 | import com.bsth.entity.sys.SysUser; |
| 21 | import com.bsth.security.util.SecurityUtils; | 16 | import com.bsth.security.util.SecurityUtils; |
| 17 | +import com.bsth.service.realcontrol.ScheduleRealInfoService; | ||
| 22 | import com.bsth.util.HttpClientUtils; | 18 | import com.bsth.util.HttpClientUtils; |
| 23 | import com.bsth.util.PrivilegeUtils; | 19 | import com.bsth.util.PrivilegeUtils; |
| 24 | -import com.bsth.util.ReportUtils; | ||
| 25 | -import com.bsth.util.db.DBUtils_MS; | ||
| 26 | -import com.bsth.util.db.DBUtils_control; | ||
| 27 | import com.fasterxml.jackson.databind.ObjectMapper; | 20 | import com.fasterxml.jackson.databind.ObjectMapper; |
| 28 | import org.apache.commons.io.IOUtils; | 21 | import org.apache.commons.io.IOUtils; |
| 29 | import org.apache.commons.lang3.StringEscapeUtils; | 22 | import org.apache.commons.lang3.StringEscapeUtils; |
| 30 | import org.apache.http.HttpEntity; | 23 | import org.apache.http.HttpEntity; |
| 31 | -import org.apache.http.HttpResponse; | ||
| 32 | import org.apache.http.client.config.RequestConfig; | 24 | import org.apache.http.client.config.RequestConfig; |
| 33 | import org.apache.http.client.methods.CloseableHttpResponse; | 25 | import org.apache.http.client.methods.CloseableHttpResponse; |
| 34 | import org.apache.http.client.methods.HttpGet; | 26 | import org.apache.http.client.methods.HttpGet; |
| 35 | import org.apache.http.impl.client.CloseableHttpClient; | 27 | import org.apache.http.impl.client.CloseableHttpClient; |
| 36 | -import org.joda.time.DateTime; | ||
| 37 | import org.joda.time.format.DateTimeFormat; | 28 | import org.joda.time.format.DateTimeFormat; |
| 38 | import org.joda.time.format.DateTimeFormatter; | 29 | import org.joda.time.format.DateTimeFormatter; |
| 39 | import org.slf4j.Logger; | 30 | import org.slf4j.Logger; |
| 40 | import org.slf4j.LoggerFactory; | 31 | import org.slf4j.LoggerFactory; |
| 41 | import org.springframework.beans.factory.annotation.Autowired; | 32 | import org.springframework.beans.factory.annotation.Autowired; |
| 42 | -import org.springframework.beans.factory.annotation.Value; | ||
| 43 | import org.springframework.web.bind.annotation.*; | 33 | import org.springframework.web.bind.annotation.*; |
| 44 | 34 | ||
| 45 | -import com.alibaba.fastjson.JSONArray; | ||
| 46 | -import com.bsth.common.ResponseCode; | ||
| 47 | -import com.bsth.controller.BaseController; | ||
| 48 | -import com.bsth.controller.realcontrol.dto.ChangePersonCar; | ||
| 49 | -import com.bsth.controller.realcontrol.dto.DfsjChange; | ||
| 50 | -import com.bsth.data.BasicData; | ||
| 51 | -import com.bsth.data.schedule.DayOfSchedule; | ||
| 52 | -import com.bsth.data.schedule.edit_logs.service.dto.SchEditInfoDto; | ||
| 53 | -import com.bsth.entity.realcontrol.ScheduleRealInfo; | ||
| 54 | -import com.bsth.entity.report.RepairReport; | ||
| 55 | -import com.bsth.entity.schedule.SchedulePlanInfo; | ||
| 56 | -import com.bsth.service.realcontrol.ScheduleRealInfoService; | 35 | +import java.io.*; |
| 36 | +import java.net.HttpURLConnection; | ||
| 37 | +import java.net.MalformedURLException; | ||
| 38 | +import java.net.URL; | ||
| 39 | +import java.net.URLEncoder; | ||
| 40 | +import java.util.*; | ||
| 57 | 41 | ||
| 58 | @RestController | 42 | @RestController |
| 59 | @RequestMapping("/realSchedule") | 43 | @RequestMapping("/realSchedule") |
| @@ -67,13 +51,7 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | @@ -67,13 +51,7 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | ||
| 67 | @Autowired | 51 | @Autowired |
| 68 | DayOfSchedule dayOfSchedule; | 52 | DayOfSchedule dayOfSchedule; |
| 69 | 53 | ||
| 70 | - @Value("${dsm.ack.url}") | ||
| 71 | - private String dsmUrl; | ||
| 72 | - | ||
| 73 | - @Value("${cp.ack.url}") | ||
| 74 | - private String cpUrl; | ||
| 75 | - | ||
| 76 | - @RequestMapping(value = "check_fgs_ascription", method = RequestMethod.POST) | 54 | + @RequestMapping(value = "check_fgs_ascription", method = RequestMethod.POST) |
| 77 | public Map<String, Object> checkPCFgsAscription(@RequestParam Long schId, String jGh, String sGh, String nbbm){ | 55 | public Map<String, Object> checkPCFgsAscription(@RequestParam Long schId, String jGh, String sGh, String nbbm){ |
| 78 | return scheduleRealInfoService.checkPCFgsAscription(schId, jGh, sGh, nbbm); | 56 | return scheduleRealInfoService.checkPCFgsAscription(schId, jGh, sGh, nbbm); |
| 79 | } | 57 | } |
| @@ -796,7 +774,7 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | @@ -796,7 +774,7 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | ||
| 796 | InputStream in = null; | 774 | InputStream in = null; |
| 797 | SysUser user = SecurityUtils.getCurrentUser(); | 775 | SysUser user = SecurityUtils.getCurrentUser(); |
| 798 | DateTimeFormatter fmt = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss"); | 776 | DateTimeFormatter fmt = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss"); |
| 799 | - StringBuilder url = new StringBuilder(dsmUrl), uri = new StringBuilder(); | 777 | + StringBuilder url = new StringBuilder(SystemParamCache.getUrlHttpDsmAck()), uri = new StringBuilder(); |
| 800 | HttpURLConnection con = null; | 778 | HttpURLConnection con = null; |
| 801 | try { | 779 | try { |
| 802 | uri.append("ddyName=").append(URLEncoder.encode(user == null ? "admin" : user.getUserName(), "UTF-8")); | 780 | uri.append("ddyName=").append(URLEncoder.encode(user == null ? "admin" : user.getUserName(), "UTF-8")); |
| @@ -845,7 +823,7 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | @@ -845,7 +823,7 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | ||
| 845 | public Map<String, Object> ackCp(@RequestParam Map<String, Object> param){ | 823 | public Map<String, Object> ackCp(@RequestParam Map<String, Object> param){ |
| 846 | Map<String, Object> res = new HashMap<>(); | 824 | Map<String, Object> res = new HashMap<>(); |
| 847 | BufferedReader br = null; | 825 | BufferedReader br = null; |
| 848 | - StringBuilder url = new StringBuilder(cpUrl); | 826 | + StringBuilder url = new StringBuilder(SystemParamCache.getUrlHttpCpAck()); |
| 849 | try { | 827 | try { |
| 850 | url.append(param.get("id")); | 828 | url.append(param.get("id")); |
| 851 | CloseableHttpClient httpClient = HttpClientUtils.defaultHttpClient(url.toString()); | 829 | CloseableHttpClient httpClient = HttpClientUtils.defaultHttpClient(url.toString()); |
| @@ -879,243 +857,4 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | @@ -879,243 +857,4 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | ||
| 879 | 857 | ||
| 880 | return res; | 858 | return res; |
| 881 | } | 859 | } |
| 882 | - | ||
| 883 | - @RequestMapping(value = "exportPlan", method = RequestMethod.GET) | ||
| 884 | - public Map<String, Object> exportPlan(@RequestParam String date){ | ||
| 885 | - Map<String, Object> res = new HashMap<>(); | ||
| 886 | - DateTimeFormatter dateTimeFormatter = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm"); | ||
| 887 | - Connection conn = null; | ||
| 888 | - PreparedStatement ps = null; | ||
| 889 | - ResultSet rs = null; | ||
| 890 | - | ||
| 891 | - List<Map<String, Object>> list = new ArrayList<>(); | ||
| 892 | - String sql = "select xl_name,xl_dir,schedule_date,fcsj,cl_zbh,j_name,bcsj from bsth_c_s_sp_info where schedule_date = ? and xl_bm in (22205, 202104, 202105, 202106, 202107, 210415) and bc_type = 'normal'"; | ||
| 893 | - try{ | ||
| 894 | - conn = DBUtils_control.getConnection(); | ||
| 895 | - ps = conn.prepareStatement(sql); | ||
| 896 | - ps.setString(1, date); | ||
| 897 | - rs = ps.executeQuery(); | ||
| 898 | - ObjectMapper mapper = new ObjectMapper(); | ||
| 899 | - | ||
| 900 | - while (rs.next()) { | ||
| 901 | - SchedulePlan schedulePlan = new SchedulePlan(); | ||
| 902 | - schedulePlan.setXlName(rs.getString("xl_name")); | ||
| 903 | - schedulePlan.setXlDir(rs.getInt("xl_dir")); | ||
| 904 | - Date scheduleDate = rs.getDate("schedule_date"); | ||
| 905 | - schedulePlan.setScheduleDate(new DateTime(scheduleDate.getTime()).toString("yyyy-MM-dd")); | ||
| 906 | - String fcsj = rs.getString("fcsj"); | ||
| 907 | - int bcsj = rs.getInt("bcsj"); | ||
| 908 | - DateTime fcsjDt = dateTimeFormatter.parseDateTime(schedulePlan.getScheduleDate() + " " + fcsj); | ||
| 909 | - schedulePlan.setFcsj(fcsjDt.toString("HH:mm:00")); | ||
| 910 | - DateTime ddsjDt = fcsjDt.plusMinutes(bcsj); | ||
| 911 | - schedulePlan.setDdsj(ddsjDt.toString("HH:mm:00")); | ||
| 912 | - schedulePlan.setSjdStart(fcsjDt.toString("HH:00:00")); | ||
| 913 | - DateTime endDt = fcsjDt.plusHours(1); | ||
| 914 | - schedulePlan.setSjdEnd(endDt.toString("HH:00:00")); | ||
| 915 | - schedulePlan.setClZbh(rs.getString("cl_zbh")); | ||
| 916 | - schedulePlan.setJsy(rs.getString("j_name")); | ||
| 917 | - schedulePlan.setBcsj(bcsj); | ||
| 918 | - | ||
| 919 | - list.add(mapper.readValue(mapper.writeValueAsString(schedulePlan), HashMap.class)); | ||
| 920 | - } | ||
| 921 | - List<Iterator<?>> iterators = new ArrayList<Iterator<?>>(); | ||
| 922 | - iterators.add(list.iterator()); | ||
| 923 | - String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | ||
| 924 | - String sourcePath = path + "mould/schedulePlan.xls"; | ||
| 925 | - | ||
| 926 | - new ReportUtils().excelReplace(iterators, new Object[]{}, sourcePath, path + "export/" + date + "-花博会专线班次.xls"); | ||
| 927 | - | ||
| 928 | - res.put("status", ResponseCode.SUCCESS); | ||
| 929 | - res.put("msg", "成功"); | ||
| 930 | - } catch (Exception e) { | ||
| 931 | - res.put("status", ResponseCode.ERROR); | ||
| 932 | - res.put("msg", e.getMessage()); | ||
| 933 | - } finally { | ||
| 934 | - DBUtils_control.close(rs, ps, conn); | ||
| 935 | - } | ||
| 936 | - | ||
| 937 | - return res; | ||
| 938 | - } | ||
| 939 | - | ||
| 940 | - public final static class SchedulePlan { | ||
| 941 | - private String company = "浦东公司[46]"; | ||
| 942 | - | ||
| 943 | - private String xlName = ""; | ||
| 944 | - | ||
| 945 | - private int xlDir; | ||
| 946 | - | ||
| 947 | - private String xlDirStr = ""; | ||
| 948 | - | ||
| 949 | - private String scheduleDate = ""; | ||
| 950 | - | ||
| 951 | - private String sjdStart = ""; | ||
| 952 | - | ||
| 953 | - private String sjdEnd = ""; | ||
| 954 | - | ||
| 955 | - private String fcsj = ""; | ||
| 956 | - | ||
| 957 | - private int bcsj; | ||
| 958 | - | ||
| 959 | - private String ddsj = ""; | ||
| 960 | - | ||
| 961 | - private int yys = 25; | ||
| 962 | - | ||
| 963 | - private String clZbh = ""; | ||
| 964 | - | ||
| 965 | - private String cph = ""; | ||
| 966 | - | ||
| 967 | - private String color = "绿牌"; | ||
| 968 | - | ||
| 969 | - private String jsy = ""; | ||
| 970 | - | ||
| 971 | - private String jsydh = ""; | ||
| 972 | - | ||
| 973 | - private int pj = 10; | ||
| 974 | - | ||
| 975 | - public String getCompany() { | ||
| 976 | - return company; | ||
| 977 | - } | ||
| 978 | - | ||
| 979 | - public void setCompany(String company) { | ||
| 980 | - this.company = company; | ||
| 981 | - } | ||
| 982 | - | ||
| 983 | - public String getXlName() { | ||
| 984 | - return xlName; | ||
| 985 | - } | ||
| 986 | - | ||
| 987 | - public void setXlName(String xlName) { | ||
| 988 | - this.xlName = xlName; | ||
| 989 | - } | ||
| 990 | - | ||
| 991 | - public int getXlDir() { | ||
| 992 | - return xlDir; | ||
| 993 | - } | ||
| 994 | - | ||
| 995 | - public void setXlDir(int xlDir) { | ||
| 996 | - this.xlDir = xlDir; | ||
| 997 | - } | ||
| 998 | - | ||
| 999 | - public String getXlDirStr() { | ||
| 1000 | - xlDirStr = ""; | ||
| 1001 | - if (xlDir == 0) { | ||
| 1002 | - xlDirStr = "上行"; | ||
| 1003 | - } else if (xlDir == 1) { | ||
| 1004 | - xlDirStr = "下行"; | ||
| 1005 | - } | ||
| 1006 | - return xlDirStr; | ||
| 1007 | - } | ||
| 1008 | - | ||
| 1009 | - public void setXlDirStr(String xlDirStr) { | ||
| 1010 | - this.xlDirStr = xlDirStr; | ||
| 1011 | - } | ||
| 1012 | - | ||
| 1013 | - public String getScheduleDate() { | ||
| 1014 | - return scheduleDate; | ||
| 1015 | - } | ||
| 1016 | - | ||
| 1017 | - public void setScheduleDate(String scheduleDate) { | ||
| 1018 | - this.scheduleDate = scheduleDate; | ||
| 1019 | - } | ||
| 1020 | - | ||
| 1021 | - public String getSjdStart() { | ||
| 1022 | - return sjdStart; | ||
| 1023 | - } | ||
| 1024 | - | ||
| 1025 | - public void setSjdStart(String sjdStart) { | ||
| 1026 | - this.sjdStart = sjdStart; | ||
| 1027 | - } | ||
| 1028 | - | ||
| 1029 | - public String getSjdEnd() { | ||
| 1030 | - return sjdEnd; | ||
| 1031 | - } | ||
| 1032 | - | ||
| 1033 | - public void setSjdEnd(String sjdEnd) { | ||
| 1034 | - this.sjdEnd = sjdEnd; | ||
| 1035 | - } | ||
| 1036 | - | ||
| 1037 | - public String getFcsj() { | ||
| 1038 | - return fcsj; | ||
| 1039 | - } | ||
| 1040 | - | ||
| 1041 | - public void setFcsj(String fcsj) { | ||
| 1042 | - this.fcsj = fcsj; | ||
| 1043 | - } | ||
| 1044 | - | ||
| 1045 | - public int getBcsj() { | ||
| 1046 | - return bcsj; | ||
| 1047 | - } | ||
| 1048 | - | ||
| 1049 | - public void setBcsj(int bcsj) { | ||
| 1050 | - this.bcsj = bcsj; | ||
| 1051 | - } | ||
| 1052 | - | ||
| 1053 | - public String getDdsj() { | ||
| 1054 | - return ddsj; | ||
| 1055 | - } | ||
| 1056 | - | ||
| 1057 | - public void setDdsj(String ddsj) { | ||
| 1058 | - this.ddsj = ddsj; | ||
| 1059 | - } | ||
| 1060 | - | ||
| 1061 | - public int getYys() { | ||
| 1062 | - return yys; | ||
| 1063 | - } | ||
| 1064 | - | ||
| 1065 | - public void setYys(int yys) { | ||
| 1066 | - this.yys = yys; | ||
| 1067 | - } | ||
| 1068 | - | ||
| 1069 | - public String getClZbh() { | ||
| 1070 | - return clZbh; | ||
| 1071 | - } | ||
| 1072 | - | ||
| 1073 | - public void setClZbh(String clZbh) { | ||
| 1074 | - this.clZbh = clZbh; | ||
| 1075 | - } | ||
| 1076 | - | ||
| 1077 | - public String getCph() { | ||
| 1078 | - cph = BasicData.nbbmCompanyPlateMap.get(clZbh); | ||
| 1079 | - if (cph == null) { | ||
| 1080 | - cph = ""; | ||
| 1081 | - } | ||
| 1082 | - return cph; | ||
| 1083 | - } | ||
| 1084 | - | ||
| 1085 | - public void setCph(String cph) { | ||
| 1086 | - this.cph = cph; | ||
| 1087 | - } | ||
| 1088 | - | ||
| 1089 | - public String getColor() { | ||
| 1090 | - return color; | ||
| 1091 | - } | ||
| 1092 | - | ||
| 1093 | - public void setColor(String color) { | ||
| 1094 | - this.color = color; | ||
| 1095 | - } | ||
| 1096 | - | ||
| 1097 | - public String getJsy() { | ||
| 1098 | - return jsy; | ||
| 1099 | - } | ||
| 1100 | - | ||
| 1101 | - public void setJsy(String jsy) { | ||
| 1102 | - this.jsy = jsy; | ||
| 1103 | - } | ||
| 1104 | - | ||
| 1105 | - public String getJsydh() { | ||
| 1106 | - return jsydh; | ||
| 1107 | - } | ||
| 1108 | - | ||
| 1109 | - public void setJsydh(String jsydh) { | ||
| 1110 | - this.jsydh = jsydh; | ||
| 1111 | - } | ||
| 1112 | - | ||
| 1113 | - public int getPj() { | ||
| 1114 | - return pj; | ||
| 1115 | - } | ||
| 1116 | - | ||
| 1117 | - public void setPj(int pj) { | ||
| 1118 | - this.pj = pj; | ||
| 1119 | - } | ||
| 1120 | - } | ||
| 1121 | } | 860 | } |
src/main/java/com/bsth/data/BasicData.java
| @@ -101,10 +101,6 @@ public class BasicData { | @@ -101,10 +101,6 @@ public class BasicData { | ||
| 101 | // 线路编码_日期 等级 | 101 | // 线路编码_日期 等级 |
| 102 | public static Map<String, String> lineDate2Level; | 102 | public static Map<String, String> lineDate2Level; |
| 103 | 103 | ||
| 104 | - public static List<WhiteIp> whiteIpList; | ||
| 105 | - | ||
| 106 | - private static Map<String, SystemParam> key2param = new HashMap<>(); | ||
| 107 | - | ||
| 108 | static Logger logger = LoggerFactory.getLogger(BasicData.class); | 104 | static Logger logger = LoggerFactory.getLogger(BasicData.class); |
| 109 | 105 | ||
| 110 | public static String getStationNameByCode(String code, String prefix){ | 106 | public static String getStationNameByCode(String code, String prefix){ |
| @@ -163,9 +159,6 @@ public class BasicData { | @@ -163,9 +159,6 @@ public class BasicData { | ||
| 163 | @Autowired | 159 | @Autowired |
| 164 | CalcIntervalRepository calcIntervalRepository; | 160 | CalcIntervalRepository calcIntervalRepository; |
| 165 | 161 | ||
| 166 | - @Autowired | ||
| 167 | - private SystemParamRepository systemParamRepository; | ||
| 168 | - | ||
| 169 | @Override | 162 | @Override |
| 170 | public void run() { | 163 | public void run() { |
| 171 | loadAllData(); | 164 | loadAllData(); |
| @@ -197,7 +190,6 @@ public class BasicData { | @@ -197,7 +190,6 @@ public class BasicData { | ||
| 197 | logger.info("load geo cache..,"); | 190 | logger.info("load geo cache..,"); |
| 198 | geoCacheData.loadData(); | 191 | geoCacheData.loadData(); |
| 199 | station2ParkBuffer.saveAll(); | 192 | station2ParkBuffer.saveAll(); |
| 200 | - loadSystemParam(); | ||
| 201 | logger.info("加载基础数据成功!,"); | 193 | logger.info("加载基础数据成功!,"); |
| 202 | } catch (Exception e) { | 194 | } catch (Exception e) { |
| 203 | logger.error("加载基础数据时出现异常,", e); | 195 | logger.error("加载基础数据时出现异常,", e); |
| @@ -457,60 +449,5 @@ public class BasicData { | @@ -457,60 +449,5 @@ public class BasicData { | ||
| 457 | 449 | ||
| 458 | lineDate2Level = result; | 450 | lineDate2Level = result; |
| 459 | } | 451 | } |
| 460 | - | ||
| 461 | - /** | ||
| 462 | - * 加载系统配置参数 | ||
| 463 | - */ | ||
| 464 | - public void loadSystemParam() { | ||
| 465 | - Map<String, SystemParam> key2param = new HashMap<>(); | ||
| 466 | - Iterator<SystemParam> systemParamIterator = systemParamRepository.findAll().iterator(); | ||
| 467 | - while (systemParamIterator.hasNext()) { | ||
| 468 | - SystemParam systemParam = systemParamIterator.next(); | ||
| 469 | - key2param.put(systemParam.getKey(), systemParam); | ||
| 470 | - } | ||
| 471 | - | ||
| 472 | - if (key2param.size() > 0) { | ||
| 473 | - BasicData.key2param = key2param; | ||
| 474 | - } | ||
| 475 | - } | ||
| 476 | - } | ||
| 477 | - | ||
| 478 | - @Component | ||
| 479 | - public static class WhiteIpDataLoader extends Thread { | ||
| 480 | - @Autowired | ||
| 481 | - JdbcTemplate jdbcTemplate; | ||
| 482 | - | ||
| 483 | - @Override | ||
| 484 | - public void run() { | ||
| 485 | - // IP白名单 | ||
| 486 | - loadData(); | ||
| 487 | - } | ||
| 488 | - | ||
| 489 | - /** | ||
| 490 | - * @Title: loadAllData | ||
| 491 | - * @Description: TODO(加载所有数据) | ||
| 492 | - */ | ||
| 493 | - public int loadData() { | ||
| 494 | - try { | ||
| 495 | - logger.info("开始加载IP白名单数据..,"); | ||
| 496 | - loadWhiteIp(); | ||
| 497 | - logger.info("加载IP白名单数据成功!,"); | ||
| 498 | - } catch (Exception e) { | ||
| 499 | - logger.error("加载IP白名单数据时出现异常,", e); | ||
| 500 | - } | ||
| 501 | - return 0; | ||
| 502 | - } | ||
| 503 | - | ||
| 504 | - /** | ||
| 505 | - * 加载IP白名单 | ||
| 506 | - */ | ||
| 507 | - public void loadWhiteIp() { | ||
| 508 | - List<WhiteIp> result = jdbcTemplate.query("select * from control_interface.bsth_c_white_ip where valid_date > now()", BeanPropertyRowMapper.newInstance(WhiteIp.class)); | ||
| 509 | - whiteIpList = result; | ||
| 510 | - } | ||
| 511 | - } | ||
| 512 | - | ||
| 513 | - public static Map<String, SystemParam> getSystemParam() { | ||
| 514 | - return key2param; | ||
| 515 | } | 452 | } |
| 516 | } | 453 | } |
src/main/java/com/bsth/data/SystemParamCache.java
0 → 100644
| 1 | +package com.bsth.data; | ||
| 2 | + | ||
| 3 | +import com.bsth.common.SystemParamKeys; | ||
| 4 | +import com.bsth.service.SystemParamService; | ||
| 5 | +import org.springframework.beans.factory.InitializingBean; | ||
| 6 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 7 | +import org.springframework.stereotype.Component; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * @author Hill | ||
| 11 | + */ | ||
| 12 | +@Component | ||
| 13 | +public class SystemParamCache implements InitializingBean { | ||
| 14 | + | ||
| 15 | + @Autowired | ||
| 16 | + private SystemParamService systemParamService; | ||
| 17 | + | ||
| 18 | + private static SystemParamService systemParamService1; | ||
| 19 | + | ||
| 20 | + public static String getSpecialRoles() { | ||
| 21 | + return systemParamService1.getValue(SystemParamKeys.SPECIAL_ROLES); | ||
| 22 | + } | ||
| 23 | + | ||
| 24 | + public static String getUrlHttpGpsRealCache() { | ||
| 25 | + return systemParamService1.getValue(SystemParamKeys.URL_HTTP_GPS_REAL_CACHE); | ||
| 26 | + } | ||
| 27 | + | ||
| 28 | + public static String getUrlHttpGpsReal() { | ||
| 29 | + return systemParamService1.getValue(SystemParamKeys.URL_HTTP_GPS_REAL); | ||
| 30 | + } | ||
| 31 | + | ||
| 32 | + public static String getUrlHttpDirective() { | ||
| 33 | + return systemParamService1.getValue(SystemParamKeys.URL_HTTP_DIRECTIVE); | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + public static String getUrlHttpRfid() { | ||
| 37 | + return systemParamService1.getValue(SystemParamKeys.URL_HTTP_RFID); | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + public static String getUrlHttpReport(String param) { | ||
| 41 | + return systemParamService1.getValue(String.format(SystemParamKeys.URL_HTTP_REPORT, param)); | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + public static String getUrlHttpTicketing() { | ||
| 45 | + return systemParamService1.getValue(SystemParamKeys.URL_HTTP_TICKETING); | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + public static String getUrlHttpDsmAck() { | ||
| 49 | + return systemParamService1.getValue(SystemParamKeys.URL_HTTP_DSM_ACK); | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + public static String getUrlHttpCpAck() { | ||
| 53 | + return systemParamService1.getValue(SystemParamKeys.URL_HTTP_CP_ACK); | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + public static String getMailAdmin() { | ||
| 57 | + return systemParamService1.getValue(SystemParamKeys.MAIL_ADMIN); | ||
| 58 | + } | ||
| 59 | + | ||
| 60 | + public static String getMailWaybill() { | ||
| 61 | + return systemParamService1.getValue(SystemParamKeys.MAIL_WAYBILL); | ||
| 62 | + } | ||
| 63 | + | ||
| 64 | + public static boolean getEnabledFirstLastGeneration() { | ||
| 65 | + return Boolean.parseBoolean(systemParamService1.getValue(SystemParamKeys.ENABLED_FIRST_LAST_GENERATION)); | ||
| 66 | + } | ||
| 67 | + | ||
| 68 | + public static boolean getEnabledFilterSqlInjection() { | ||
| 69 | + return Boolean.parseBoolean(systemParamService1.getValue(SystemParamKeys.ENABLED_FILTER_SQL_INJECTION)); | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + public static boolean getEnabledSso() { | ||
| 73 | + return Boolean.parseBoolean(systemParamService1.getValue(SystemParamKeys.ENABLED_SSO)); | ||
| 74 | + } | ||
| 75 | + | ||
| 76 | + public static String getSsoSystemCode() { | ||
| 77 | + return systemParamService1.getValue(SystemParamKeys.SSO_SYSTEM_CODE); | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + public static String getUrlHttpSsoLogin() { | ||
| 81 | + return systemParamService1.getValue(SystemParamKeys.URL_HTTP_SSO_LOGIN); | ||
| 82 | + } | ||
| 83 | + | ||
| 84 | + public static String getUrlHttpSsoLogout() { | ||
| 85 | + return systemParamService1.getValue(SystemParamKeys.URL_HTTP_SSO_LOGOUT); | ||
| 86 | + } | ||
| 87 | + | ||
| 88 | + public static String getUrlHttpSsoAuth() { | ||
| 89 | + return systemParamService1.getValue(SystemParamKeys.URL_HTTP_SSO_AUTH); | ||
| 90 | + } | ||
| 91 | + | ||
| 92 | + public static String getUrlHttpMaintenance() { | ||
| 93 | + return systemParamService1.getValue(SystemParamKeys.URL_HTTP_MAINTENANCE); | ||
| 94 | + } | ||
| 95 | + | ||
| 96 | + public static boolean getEnabledWhiteIp() { | ||
| 97 | + return Boolean.parseBoolean(systemParamService1.getValue(SystemParamKeys.ENABLED_WHITE_IP)); | ||
| 98 | + } | ||
| 99 | + | ||
| 100 | + public static boolean getEnableFilterAuthority() { | ||
| 101 | + return Boolean.parseBoolean(systemParamService1.getValue(SystemParamKeys.ENABLED_FILTER_AUTHORITY)); | ||
| 102 | + } | ||
| 103 | + | ||
| 104 | + @Override | ||
| 105 | + public void afterPropertiesSet() throws Exception { | ||
| 106 | + systemParamService1 = systemParamService; | ||
| 107 | + systemParamService1.refresh(); | ||
| 108 | + } | ||
| 109 | +} |
src/main/java/com/bsth/data/WhiteIpCache.java
0 → 100644
| 1 | +package com.bsth.data; | ||
| 2 | + | ||
| 3 | +import com.bsth.Application; | ||
| 4 | +import com.bsth.XDApplication; | ||
| 5 | +import com.bsth.entity.WhiteIp; | ||
| 6 | +import org.slf4j.Logger; | ||
| 7 | +import org.slf4j.LoggerFactory; | ||
| 8 | +import org.springframework.beans.factory.InitializingBean; | ||
| 9 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 10 | +import org.springframework.jdbc.core.BeanPropertyRowMapper; | ||
| 11 | +import org.springframework.jdbc.core.JdbcTemplate; | ||
| 12 | +import org.springframework.stereotype.Component; | ||
| 13 | + | ||
| 14 | +import java.util.List; | ||
| 15 | +import java.util.concurrent.TimeUnit; | ||
| 16 | + | ||
| 17 | +@Component | ||
| 18 | +public class WhiteIpCache implements InitializingBean { | ||
| 19 | + | ||
| 20 | + private final static Logger log = LoggerFactory.getLogger(WhiteIpCache.class); | ||
| 21 | + | ||
| 22 | + @Autowired | ||
| 23 | + private JdbcTemplate jdbcTemplate; | ||
| 24 | + | ||
| 25 | + private static List<WhiteIp> whiteIps; | ||
| 26 | + | ||
| 27 | + public static List<WhiteIp> getWhiteIps() { | ||
| 28 | + return whiteIps; | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | + @Override | ||
| 32 | + public void afterPropertiesSet() throws Exception { | ||
| 33 | + Application.mainServices.scheduleWithFixedDelay(new WhiteIpDataLoader(), 0, 1, TimeUnit.MINUTES); | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + class WhiteIpDataLoader extends Thread { | ||
| 37 | + | ||
| 38 | + @Override | ||
| 39 | + public void run() { | ||
| 40 | + if (SystemParamCache.getEnabledWhiteIp()) { | ||
| 41 | + loadData(); | ||
| 42 | + } | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + /** | ||
| 46 | + * @Title: loadAllData | ||
| 47 | + * @Description: TODO(加载所有数据) | ||
| 48 | + */ | ||
| 49 | + public int loadData() { | ||
| 50 | + try { | ||
| 51 | + log.info("开始加载IP白名单数据..,"); | ||
| 52 | + loadWhiteIp(); | ||
| 53 | + log.info("加载IP白名单数据成功!,"); | ||
| 54 | + } catch (Exception e) { | ||
| 55 | + log.error("加载IP白名单数据时出现异常,", e); | ||
| 56 | + } | ||
| 57 | + return 0; | ||
| 58 | + } | ||
| 59 | + | ||
| 60 | + /** | ||
| 61 | + * 加载IP白名单 | ||
| 62 | + */ | ||
| 63 | + public void loadWhiteIp() { | ||
| 64 | + List<WhiteIp> result = jdbcTemplate.query("select * from control_interface.bsth_c_white_ip where valid_date > now()", BeanPropertyRowMapper.newInstance(WhiteIp.class)); | ||
| 65 | + whiteIps = result; | ||
| 66 | + } | ||
| 67 | + } | ||
| 68 | +} |
src/main/java/com/bsth/data/directive/GatewayHttpUtils.java
| 1 | -package com.bsth.data.directive; | ||
| 2 | - | ||
| 3 | -import com.alibaba.fastjson.JSONObject; | ||
| 4 | -import com.bsth.util.ConfigUtil; | ||
| 5 | -import org.apache.http.client.config.RequestConfig; | ||
| 6 | -import org.apache.http.client.methods.CloseableHttpResponse; | ||
| 7 | -import org.apache.http.client.methods.HttpPost; | ||
| 8 | -import org.apache.http.entity.StringEntity; | ||
| 9 | -import org.apache.http.impl.client.CloseableHttpClient; | ||
| 10 | -import org.apache.http.impl.client.HttpClients; | ||
| 11 | -import org.apache.http.util.EntityUtils; | ||
| 12 | -import org.slf4j.Logger; | ||
| 13 | -import org.slf4j.LoggerFactory; | ||
| 14 | - | ||
| 15 | -/** | ||
| 16 | - * @author PanZhao | ||
| 17 | - * @ClassName: GatewayHttpUtils | ||
| 18 | - * @Description: TODO(和网关HTTP通讯工具类) | ||
| 19 | - * @date 2016年8月14日 下午9:50:46 | ||
| 20 | - */ | ||
| 21 | -public class GatewayHttpUtils { | ||
| 22 | - static Logger logger = LoggerFactory.getLogger(GatewayHttpUtils.class); | ||
| 23 | - | ||
| 24 | - static String url; | ||
| 25 | - static CloseableHttpClient httpClient = null; | ||
| 26 | - static HttpPost post; | ||
| 27 | - static RequestConfig requestConfig; | ||
| 28 | - static CloseableHttpResponse response; | ||
| 29 | - | ||
| 30 | - static { | ||
| 31 | - url = ConfigUtil.get("http.send.directive"); | ||
| 32 | - httpClient = HttpClients.createDefault(); | ||
| 33 | - post = new HttpPost(url); | ||
| 34 | - requestConfig = RequestConfig.custom() | ||
| 35 | - .setConnectTimeout(3000).setConnectionRequestTimeout(2000) | ||
| 36 | - .setSocketTimeout(3000).build(); | ||
| 37 | - post.setConfig(requestConfig); | ||
| 38 | - } | ||
| 39 | - | ||
| 40 | - public static int postJson(String jsonStr) { | ||
| 41 | - logger.info("send : " + jsonStr); | ||
| 42 | - | ||
| 43 | - int code = -1; | ||
| 44 | - try { | ||
| 45 | - post.setEntity(new StringEntity(jsonStr, "utf-8")); | ||
| 46 | - | ||
| 47 | - response = httpClient.execute(post); | ||
| 48 | - | ||
| 49 | - int statusCode = response.getStatusLine().getStatusCode(); | ||
| 50 | - if(statusCode != 200){ | ||
| 51 | - logger.error("http client status code: " + statusCode); | ||
| 52 | - } | ||
| 53 | - | ||
| 54 | - JSONObject json = JSONObject.parseObject(EntityUtils.toString(response.getEntity())); | ||
| 55 | - if (null != json && json.getInteger("errCode") == 0) | ||
| 56 | - code = 0; | ||
| 57 | - else | ||
| 58 | - logger.error("和网关http通讯失败,rs: " + json); | ||
| 59 | - | ||
| 60 | - if (null != response) | ||
| 61 | - response.close(); | ||
| 62 | - } catch (Exception e) { | ||
| 63 | - logger.error("", e); | ||
| 64 | - } | ||
| 65 | - return code; | ||
| 66 | - } | ||
| 67 | -} | 1 | +package com.bsth.data.directive; |
| 2 | + | ||
| 3 | +import com.alibaba.fastjson.JSONObject; | ||
| 4 | +import com.bsth.data.SystemParamCache; | ||
| 5 | +import org.apache.http.client.config.RequestConfig; | ||
| 6 | +import org.apache.http.client.methods.CloseableHttpResponse; | ||
| 7 | +import org.apache.http.client.methods.HttpPost; | ||
| 8 | +import org.apache.http.entity.StringEntity; | ||
| 9 | +import org.apache.http.impl.client.CloseableHttpClient; | ||
| 10 | +import org.apache.http.impl.client.HttpClients; | ||
| 11 | +import org.apache.http.util.EntityUtils; | ||
| 12 | +import org.slf4j.Logger; | ||
| 13 | +import org.slf4j.LoggerFactory; | ||
| 14 | +import org.springframework.beans.factory.InitializingBean; | ||
| 15 | +import org.springframework.stereotype.Component; | ||
| 16 | + | ||
| 17 | +/** | ||
| 18 | + * @author PanZhao | ||
| 19 | + * @ClassName: GatewayHttpUtils | ||
| 20 | + * @Description: TODO(和网关HTTP通讯工具类) | ||
| 21 | + * @date 2016年8月14日 下午9:50:46 | ||
| 22 | + */ | ||
| 23 | +@Component | ||
| 24 | +public class GatewayHttpUtils implements InitializingBean { | ||
| 25 | + static Logger logger = LoggerFactory.getLogger(GatewayHttpUtils.class); | ||
| 26 | + | ||
| 27 | + static String url; | ||
| 28 | + static CloseableHttpClient httpClient = null; | ||
| 29 | + static HttpPost post; | ||
| 30 | + static RequestConfig requestConfig; | ||
| 31 | + static CloseableHttpResponse response; | ||
| 32 | + | ||
| 33 | + public static int postJson(String jsonStr) { | ||
| 34 | + logger.info("send : " + jsonStr); | ||
| 35 | + | ||
| 36 | + int code = -1; | ||
| 37 | + try { | ||
| 38 | + post.setEntity(new StringEntity(jsonStr, "utf-8")); | ||
| 39 | + | ||
| 40 | + response = httpClient.execute(post); | ||
| 41 | + | ||
| 42 | + int statusCode = response.getStatusLine().getStatusCode(); | ||
| 43 | + if(statusCode != 200){ | ||
| 44 | + logger.error("http client status code: " + statusCode); | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + JSONObject json = JSONObject.parseObject(EntityUtils.toString(response.getEntity())); | ||
| 48 | + if (null != json && json.getInteger("errCode") == 0) | ||
| 49 | + code = 0; | ||
| 50 | + else | ||
| 51 | + logger.error("和网关http通讯失败,rs: " + json); | ||
| 52 | + | ||
| 53 | + if (null != response) | ||
| 54 | + response.close(); | ||
| 55 | + } catch (Exception e) { | ||
| 56 | + logger.error("", e); | ||
| 57 | + } | ||
| 58 | + return code; | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | + @Override | ||
| 62 | + public void afterPropertiesSet() throws Exception { | ||
| 63 | + url = SystemParamCache.getUrlHttpDirective(); | ||
| 64 | + httpClient = HttpClients.createDefault(); | ||
| 65 | + post = new HttpPost(url); | ||
| 66 | + requestConfig = RequestConfig.custom() | ||
| 67 | + .setConnectTimeout(3000).setConnectionRequestTimeout(2000) | ||
| 68 | + .setSocketTimeout(3000).build(); | ||
| 69 | + post.setConfig(requestConfig); | ||
| 70 | + } | ||
| 71 | +} |
src/main/java/com/bsth/data/gpsdata_v2/load/GatewayHttpLoader.java
| 1 | -package com.bsth.data.gpsdata_v2.load; | ||
| 2 | - | ||
| 3 | -import com.alibaba.fastjson.JSON; | ||
| 4 | -import com.bsth.data.BasicData; | ||
| 5 | -import com.bsth.data.gpsdata_v2.GpsRealData; | ||
| 6 | -import com.bsth.data.gpsdata_v2.entity.GpsEntity; | ||
| 7 | -import com.bsth.data.gpsdata_v2.utils.GpsDataUtils; | ||
| 8 | -import com.bsth.util.ConfigUtil; | ||
| 9 | -import org.apache.commons.lang3.StringUtils; | ||
| 10 | -import org.apache.http.HttpEntity; | ||
| 11 | -import org.apache.http.client.config.RequestConfig; | ||
| 12 | -import org.apache.http.client.methods.CloseableHttpResponse; | ||
| 13 | -import org.apache.http.client.methods.HttpGet; | ||
| 14 | -import org.apache.http.impl.client.CloseableHttpClient; | ||
| 15 | -import org.apache.http.impl.client.HttpClients; | ||
| 16 | -import org.slf4j.Logger; | ||
| 17 | -import org.slf4j.LoggerFactory; | ||
| 18 | -import org.springframework.beans.BeansException; | ||
| 19 | -import org.springframework.context.ApplicationContext; | ||
| 20 | -import org.springframework.context.ApplicationContextAware; | ||
| 21 | -import org.springframework.stereotype.Component; | ||
| 22 | - | ||
| 23 | -import java.io.BufferedReader; | ||
| 24 | -import java.io.InputStreamReader; | ||
| 25 | -import java.util.ArrayList; | ||
| 26 | -import java.util.List; | ||
| 27 | - | ||
| 28 | -/** | ||
| 29 | - * 从网关http 接口加载数据 | ||
| 30 | - * Created by panzhao on 2017/11/15. | ||
| 31 | - */ | ||
| 32 | -@Component | ||
| 33 | -public class GatewayHttpLoader implements ApplicationContextAware{ | ||
| 34 | - | ||
| 35 | - static Logger logger = LoggerFactory.getLogger(GatewayHttpLoader.class); | ||
| 36 | - | ||
| 37 | - static String url; | ||
| 38 | - static List<GpsEntity> list; | ||
| 39 | - static CloseableHttpClient httpClient = null; | ||
| 40 | - static HttpGet get; | ||
| 41 | - static RequestConfig requestConfig; | ||
| 42 | - static CloseableHttpResponse response; | ||
| 43 | - static HttpEntity entity; | ||
| 44 | - static BufferedReader br; | ||
| 45 | - | ||
| 46 | - static GpsRealData gpsRealData; | ||
| 47 | - | ||
| 48 | - static{ | ||
| 49 | - url = ConfigUtil.get("http.gps.real.url"); | ||
| 50 | - list = new ArrayList<>(); | ||
| 51 | - httpClient = HttpClients.createDefault(); | ||
| 52 | - get = new HttpGet(url); | ||
| 53 | - requestConfig = RequestConfig.custom() | ||
| 54 | - .setConnectTimeout(2500).setConnectionRequestTimeout(2000) | ||
| 55 | - .setSocketTimeout(2500).build(); | ||
| 56 | - get.setConfig(requestConfig); | ||
| 57 | - } | ||
| 58 | - | ||
| 59 | - public static List<GpsEntity> load(){ | ||
| 60 | - try{ | ||
| 61 | - if(list.size() > 0) | ||
| 62 | - list.clear(); | ||
| 63 | - | ||
| 64 | - response = httpClient.execute(get); | ||
| 65 | - entity = response.getEntity(); | ||
| 66 | - | ||
| 67 | - logger.info("entity:" + entity + "get:" + get); | ||
| 68 | - if(null == entity) | ||
| 69 | - return list; | ||
| 70 | - | ||
| 71 | - br = new BufferedReader(new InputStreamReader(entity.getContent())); | ||
| 72 | - | ||
| 73 | - StringBuilder sb = new StringBuilder(); | ||
| 74 | - String str; | ||
| 75 | - while ((str = br.readLine()) != null) | ||
| 76 | - sb.append(str); | ||
| 77 | - | ||
| 78 | - logger.debug("gps:" + sb.toString()); | ||
| 79 | - list = JSON.parseArray(JSON.parseObject(sb.toString()).getString("data"), GpsEntity.class); | ||
| 80 | - //过滤掉无效的点位 | ||
| 81 | - list = GpsDataUtils.clearInvalid(list); | ||
| 82 | - | ||
| 83 | - List<GpsEntity> ups = new ArrayList<>(); | ||
| 84 | - String nbbm; | ||
| 85 | - for (GpsEntity gps : list) { | ||
| 86 | - if (StringUtils.isBlank(gps.getDeviceId())) | ||
| 87 | - continue; | ||
| 88 | - | ||
| 89 | - if (gps_equals(gpsRealData.get(gps.getDeviceId()), gps)) | ||
| 90 | - continue; | ||
| 91 | - | ||
| 92 | - nbbm = BasicData.deviceId2NbbmMap.get(gps.getDeviceId()); | ||
| 93 | - gps.setNbbm(nbbm); | ||
| 94 | - ups.add(gps); | ||
| 95 | - } | ||
| 96 | - list = ups; | ||
| 97 | - | ||
| 98 | - if (null != response) | ||
| 99 | - response.close(); | ||
| 100 | - }catch (Exception e){ | ||
| 101 | - logger.error("", e); | ||
| 102 | - } | ||
| 103 | - return list; | ||
| 104 | - } | ||
| 105 | - | ||
| 106 | - | ||
| 107 | - private static boolean gps_equals(GpsEntity old, GpsEntity gps){ | ||
| 108 | - if(old != null && | ||
| 109 | - old.getTimestamp().equals(gps.getTimestamp()) && | ||
| 110 | - old.getLat().equals(gps.getLat()) && | ||
| 111 | - old.getLon().equals(gps.getLon())) | ||
| 112 | - return true; | ||
| 113 | - return false; | ||
| 114 | - } | ||
| 115 | - | ||
| 116 | - @Override | ||
| 117 | - public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { | ||
| 118 | - gpsRealData = applicationContext.getBean(GpsRealData.class); | ||
| 119 | - } | ||
| 120 | -} | 1 | +package com.bsth.data.gpsdata_v2.load; |
| 2 | + | ||
| 3 | +import com.alibaba.fastjson.JSON; | ||
| 4 | +import com.bsth.data.BasicData; | ||
| 5 | +import com.bsth.data.SystemParamCache; | ||
| 6 | +import com.bsth.data.gpsdata_v2.GpsRealData; | ||
| 7 | +import com.bsth.data.gpsdata_v2.entity.GpsEntity; | ||
| 8 | +import com.bsth.data.gpsdata_v2.utils.GpsDataUtils; | ||
| 9 | +import org.apache.commons.lang3.StringUtils; | ||
| 10 | +import org.apache.http.HttpEntity; | ||
| 11 | +import org.apache.http.client.config.RequestConfig; | ||
| 12 | +import org.apache.http.client.methods.CloseableHttpResponse; | ||
| 13 | +import org.apache.http.client.methods.HttpGet; | ||
| 14 | +import org.apache.http.impl.client.CloseableHttpClient; | ||
| 15 | +import org.apache.http.impl.client.HttpClients; | ||
| 16 | +import org.slf4j.Logger; | ||
| 17 | +import org.slf4j.LoggerFactory; | ||
| 18 | +import org.springframework.beans.BeansException; | ||
| 19 | +import org.springframework.beans.factory.InitializingBean; | ||
| 20 | +import org.springframework.context.ApplicationContext; | ||
| 21 | +import org.springframework.context.ApplicationContextAware; | ||
| 22 | +import org.springframework.stereotype.Component; | ||
| 23 | + | ||
| 24 | +import java.io.BufferedReader; | ||
| 25 | +import java.io.InputStreamReader; | ||
| 26 | +import java.util.ArrayList; | ||
| 27 | +import java.util.List; | ||
| 28 | + | ||
| 29 | +/** | ||
| 30 | + * 从网关http 接口加载数据 | ||
| 31 | + * Created by panzhao on 2017/11/15. | ||
| 32 | + */ | ||
| 33 | +@Component | ||
| 34 | +public class GatewayHttpLoader implements ApplicationContextAware, InitializingBean { | ||
| 35 | + | ||
| 36 | + static Logger logger = LoggerFactory.getLogger(GatewayHttpLoader.class); | ||
| 37 | + | ||
| 38 | + static String url; | ||
| 39 | + static List<GpsEntity> list; | ||
| 40 | + static CloseableHttpClient httpClient = null; | ||
| 41 | + static HttpGet get; | ||
| 42 | + static RequestConfig requestConfig; | ||
| 43 | + static CloseableHttpResponse response; | ||
| 44 | + static HttpEntity entity; | ||
| 45 | + static BufferedReader br; | ||
| 46 | + | ||
| 47 | + static GpsRealData gpsRealData; | ||
| 48 | + | ||
| 49 | + public static List<GpsEntity> load(){ | ||
| 50 | + try{ | ||
| 51 | + if(list.size() > 0) | ||
| 52 | + list.clear(); | ||
| 53 | + | ||
| 54 | + response = httpClient.execute(get); | ||
| 55 | + entity = response.getEntity(); | ||
| 56 | + | ||
| 57 | + logger.info("entity:" + entity + "get:" + get); | ||
| 58 | + if(null == entity) | ||
| 59 | + return list; | ||
| 60 | + | ||
| 61 | + br = new BufferedReader(new InputStreamReader(entity.getContent())); | ||
| 62 | + | ||
| 63 | + StringBuilder sb = new StringBuilder(); | ||
| 64 | + String str; | ||
| 65 | + while ((str = br.readLine()) != null) | ||
| 66 | + sb.append(str); | ||
| 67 | + | ||
| 68 | + logger.debug("gps:" + sb.toString()); | ||
| 69 | + list = JSON.parseArray(JSON.parseObject(sb.toString()).getString("data"), GpsEntity.class); | ||
| 70 | + //过滤掉无效的点位 | ||
| 71 | + list = GpsDataUtils.clearInvalid(list); | ||
| 72 | + | ||
| 73 | + List<GpsEntity> ups = new ArrayList<>(); | ||
| 74 | + String nbbm; | ||
| 75 | + for (GpsEntity gps : list) { | ||
| 76 | + if (StringUtils.isBlank(gps.getDeviceId())) | ||
| 77 | + continue; | ||
| 78 | + | ||
| 79 | + if (gps_equals(gpsRealData.get(gps.getDeviceId()), gps)) | ||
| 80 | + continue; | ||
| 81 | + | ||
| 82 | + nbbm = BasicData.deviceId2NbbmMap.get(gps.getDeviceId()); | ||
| 83 | + gps.setNbbm(nbbm); | ||
| 84 | + ups.add(gps); | ||
| 85 | + } | ||
| 86 | + list = ups; | ||
| 87 | + | ||
| 88 | + if (null != response) | ||
| 89 | + response.close(); | ||
| 90 | + }catch (Exception e){ | ||
| 91 | + logger.error("", e); | ||
| 92 | + } | ||
| 93 | + return list; | ||
| 94 | + } | ||
| 95 | + | ||
| 96 | + | ||
| 97 | + private static boolean gps_equals(GpsEntity old, GpsEntity gps){ | ||
| 98 | + if(old != null && | ||
| 99 | + old.getTimestamp().equals(gps.getTimestamp()) && | ||
| 100 | + old.getLat().equals(gps.getLat()) && | ||
| 101 | + old.getLon().equals(gps.getLon())) | ||
| 102 | + return true; | ||
| 103 | + return false; | ||
| 104 | + } | ||
| 105 | + | ||
| 106 | + @Override | ||
| 107 | + public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { | ||
| 108 | + gpsRealData = applicationContext.getBean(GpsRealData.class); | ||
| 109 | + } | ||
| 110 | + | ||
| 111 | + @Override | ||
| 112 | + public void afterPropertiesSet() throws Exception { | ||
| 113 | + url = SystemParamCache.getUrlHttpGpsReal(); | ||
| 114 | + list = new ArrayList<>(); | ||
| 115 | + httpClient = HttpClients.createDefault(); | ||
| 116 | + get = new HttpGet(url); | ||
| 117 | + requestConfig = RequestConfig.custom() | ||
| 118 | + .setConnectTimeout(2500).setConnectionRequestTimeout(2000) | ||
| 119 | + .setSocketTimeout(2500).build(); | ||
| 120 | + get.setConfig(requestConfig); | ||
| 121 | + } | ||
| 122 | +} |
src/main/java/com/bsth/data/gpsdata_v2/load/SocketClientLoader.java
| 1 | -package com.bsth.data.gpsdata_v2.load; | ||
| 2 | - | ||
| 3 | -import com.alibaba.fastjson.JSON; | ||
| 4 | -import com.bsth.data.BasicData; | ||
| 5 | -import com.bsth.data.gpsdata_v2.entity.GpsEntity; | ||
| 6 | -import com.bsth.data.gpsdata_v2.utils.GpsDataUtils; | ||
| 7 | -import com.bsth.util.ConfigUtil; | ||
| 8 | -import org.apache.http.HttpEntity; | ||
| 9 | -import org.apache.http.client.config.RequestConfig; | ||
| 10 | -import org.apache.http.client.methods.CloseableHttpResponse; | ||
| 11 | -import org.apache.http.client.methods.HttpGet; | ||
| 12 | -import org.apache.http.impl.client.CloseableHttpClient; | ||
| 13 | -import org.apache.http.impl.client.HttpClients; | ||
| 14 | -import org.slf4j.Logger; | ||
| 15 | -import org.slf4j.LoggerFactory; | ||
| 16 | -import org.springframework.stereotype.Component; | ||
| 17 | - | ||
| 18 | -import java.io.BufferedReader; | ||
| 19 | -import java.io.InputStreamReader; | ||
| 20 | -import java.util.ArrayList; | ||
| 21 | -import java.util.List; | ||
| 22 | - | ||
| 23 | -/** | ||
| 24 | - * 从专用的socket client 加载数据 | ||
| 25 | - * Created by panzhao on 2017/11/15. | ||
| 26 | - */ | ||
| 27 | -@Component | ||
| 28 | -public class SocketClientLoader { | ||
| 29 | - | ||
| 30 | - static Logger logger = LoggerFactory.getLogger(SocketClientLoader.class); | ||
| 31 | - | ||
| 32 | - static String url; | ||
| 33 | - static List<GpsEntity> list; | ||
| 34 | - static CloseableHttpClient httpClient = null; | ||
| 35 | - static HttpGet get; | ||
| 36 | - static RequestConfig requestConfig; | ||
| 37 | - static CloseableHttpResponse response; | ||
| 38 | - static HttpEntity entity; | ||
| 39 | - static BufferedReader br; | ||
| 40 | - | ||
| 41 | - static { | ||
| 42 | - url = ConfigUtil.get("http.gps.real.cache.url"); | ||
| 43 | - list = new ArrayList<>(); | ||
| 44 | - httpClient = HttpClients.createDefault(); | ||
| 45 | - get = new HttpGet(url); | ||
| 46 | - requestConfig = RequestConfig.custom() | ||
| 47 | - .setConnectTimeout(2500).setConnectionRequestTimeout(2000) | ||
| 48 | - .setSocketTimeout(2500).build(); | ||
| 49 | - get.setConfig(requestConfig); | ||
| 50 | - } | ||
| 51 | - | ||
| 52 | - public static List<GpsEntity> load(){ | ||
| 53 | - try { | ||
| 54 | - if(list.size() > 0) | ||
| 55 | - list.clear(); | ||
| 56 | - logger.info("load start..."); | ||
| 57 | - response = httpClient.execute(get); | ||
| 58 | - entity = response.getEntity(); | ||
| 59 | - if(null == entity) | ||
| 60 | - return list; | ||
| 61 | - | ||
| 62 | - br = new BufferedReader(new InputStreamReader(entity.getContent())); | ||
| 63 | - StringBuilder sb = new StringBuilder(); | ||
| 64 | - String str; | ||
| 65 | - while ((str = br.readLine()) != null) | ||
| 66 | - sb.append(str); | ||
| 67 | - | ||
| 68 | - list = JSON.parseArray(sb.toString(), GpsEntity.class); | ||
| 69 | - | ||
| 70 | - logger.info("load end ! size: " + list.size()); | ||
| 71 | - //过滤掉无效的点位 | ||
| 72 | - list = GpsDataUtils.clearInvalid(list); | ||
| 73 | - | ||
| 74 | - for (GpsEntity gps : list) { | ||
| 75 | - gps.setNbbm(BasicData.deviceId2NbbmMap.get(gps.getDeviceId())); | ||
| 76 | - } | ||
| 77 | - | ||
| 78 | - if (null != response) | ||
| 79 | - response.close(); | ||
| 80 | - } catch (Exception e) { | ||
| 81 | - logger.error("", e); | ||
| 82 | - } | ||
| 83 | - | ||
| 84 | - return list; | ||
| 85 | - } | ||
| 86 | -} | 1 | +package com.bsth.data.gpsdata_v2.load; |
| 2 | + | ||
| 3 | +import com.alibaba.fastjson.JSON; | ||
| 4 | +import com.bsth.data.BasicData; | ||
| 5 | +import com.bsth.data.SystemParamCache; | ||
| 6 | +import com.bsth.data.gpsdata_v2.entity.GpsEntity; | ||
| 7 | +import com.bsth.data.gpsdata_v2.utils.GpsDataUtils; | ||
| 8 | +import org.apache.http.HttpEntity; | ||
| 9 | +import org.apache.http.client.config.RequestConfig; | ||
| 10 | +import org.apache.http.client.methods.CloseableHttpResponse; | ||
| 11 | +import org.apache.http.client.methods.HttpGet; | ||
| 12 | +import org.apache.http.impl.client.CloseableHttpClient; | ||
| 13 | +import org.apache.http.impl.client.HttpClients; | ||
| 14 | +import org.slf4j.Logger; | ||
| 15 | +import org.slf4j.LoggerFactory; | ||
| 16 | +import org.springframework.beans.factory.InitializingBean; | ||
| 17 | +import org.springframework.stereotype.Component; | ||
| 18 | + | ||
| 19 | +import java.io.BufferedReader; | ||
| 20 | +import java.io.InputStreamReader; | ||
| 21 | +import java.util.ArrayList; | ||
| 22 | +import java.util.List; | ||
| 23 | + | ||
| 24 | +/** | ||
| 25 | + * 从专用的socket client 加载数据 | ||
| 26 | + * Created by panzhao on 2017/11/15. | ||
| 27 | + */ | ||
| 28 | +@Component | ||
| 29 | +public class SocketClientLoader implements InitializingBean { | ||
| 30 | + | ||
| 31 | + static Logger logger = LoggerFactory.getLogger(SocketClientLoader.class); | ||
| 32 | + | ||
| 33 | + static String url; | ||
| 34 | + static List<GpsEntity> list; | ||
| 35 | + static CloseableHttpClient httpClient = null; | ||
| 36 | + static HttpGet get; | ||
| 37 | + static RequestConfig requestConfig; | ||
| 38 | + static CloseableHttpResponse response; | ||
| 39 | + static HttpEntity entity; | ||
| 40 | + static BufferedReader br; | ||
| 41 | + | ||
| 42 | + public static List<GpsEntity> load(){ | ||
| 43 | + try { | ||
| 44 | + if(list.size() > 0) | ||
| 45 | + list.clear(); | ||
| 46 | + logger.info("load start..."); | ||
| 47 | + response = httpClient.execute(get); | ||
| 48 | + entity = response.getEntity(); | ||
| 49 | + if(null == entity) | ||
| 50 | + return list; | ||
| 51 | + | ||
| 52 | + br = new BufferedReader(new InputStreamReader(entity.getContent())); | ||
| 53 | + StringBuilder sb = new StringBuilder(); | ||
| 54 | + String str; | ||
| 55 | + while ((str = br.readLine()) != null) | ||
| 56 | + sb.append(str); | ||
| 57 | + | ||
| 58 | + list = JSON.parseArray(sb.toString(), GpsEntity.class); | ||
| 59 | + | ||
| 60 | + logger.info("load end ! size: " + list.size()); | ||
| 61 | + //过滤掉无效的点位 | ||
| 62 | + list = GpsDataUtils.clearInvalid(list); | ||
| 63 | + | ||
| 64 | + for (GpsEntity gps : list) { | ||
| 65 | + gps.setNbbm(BasicData.deviceId2NbbmMap.get(gps.getDeviceId())); | ||
| 66 | + } | ||
| 67 | + | ||
| 68 | + if (null != response) | ||
| 69 | + response.close(); | ||
| 70 | + } catch (Exception e) { | ||
| 71 | + logger.error("", e); | ||
| 72 | + } | ||
| 73 | + | ||
| 74 | + return list; | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | + @Override | ||
| 78 | + public void afterPropertiesSet() throws Exception { | ||
| 79 | + url = SystemParamCache.getUrlHttpGpsRealCache(); | ||
| 80 | + list = new ArrayList<>(); | ||
| 81 | + httpClient = HttpClients.createDefault(); | ||
| 82 | + get = new HttpGet(url); | ||
| 83 | + requestConfig = RequestConfig.custom() | ||
| 84 | + .setConnectTimeout(2500).setConnectionRequestTimeout(2000) | ||
| 85 | + .setSocketTimeout(2500).build(); | ||
| 86 | + get.setConfig(requestConfig); | ||
| 87 | + } | ||
| 88 | +} |
src/main/java/com/bsth/data/gpsdata_v2/rfid/RfidHttpLoader.java
| 1 | package com.bsth.data.gpsdata_v2.rfid; | 1 | package com.bsth.data.gpsdata_v2.rfid; |
| 2 | 2 | ||
| 3 | +import com.bsth.data.SystemParamCache; | ||
| 3 | import com.bsth.data.gpsdata_v2.rfid.entity.RfidInfo; | 4 | import com.bsth.data.gpsdata_v2.rfid.entity.RfidInfo; |
| 4 | -import com.bsth.util.ConfigUtil; | ||
| 5 | import com.fasterxml.jackson.databind.ObjectMapper; | 5 | import com.fasterxml.jackson.databind.ObjectMapper; |
| 6 | import org.apache.commons.io.IOUtils; | 6 | import org.apache.commons.io.IOUtils; |
| 7 | import org.slf4j.Logger; | 7 | import org.slf4j.Logger; |
| 8 | import org.slf4j.LoggerFactory; | 8 | import org.slf4j.LoggerFactory; |
| 9 | +import org.springframework.beans.factory.InitializingBean; | ||
| 10 | +import org.springframework.stereotype.Component; | ||
| 9 | 11 | ||
| 10 | import java.io.ByteArrayOutputStream; | 12 | import java.io.ByteArrayOutputStream; |
| 11 | import java.io.IOException; | 13 | import java.io.IOException; |
| @@ -20,11 +22,12 @@ import java.util.List; | @@ -20,11 +22,12 @@ import java.util.List; | ||
| 20 | * @author hill | 22 | * @author hill |
| 21 | * @date | 23 | * @date |
| 22 | */ | 24 | */ |
| 23 | -public class RfidHttpLoader { | 25 | +@Component |
| 26 | +public class RfidHttpLoader implements InitializingBean { | ||
| 24 | 27 | ||
| 25 | private final static Logger log = LoggerFactory.getLogger(RfidHttpLoader.class); | 28 | private final static Logger log = LoggerFactory.getLogger(RfidHttpLoader.class); |
| 26 | 29 | ||
| 27 | - private static String RFID_URL = ConfigUtil.get("http.rfid.url"); | 30 | + private static String RFID_URL; |
| 28 | 31 | ||
| 29 | public static List<RfidInfo> load() { | 32 | public static List<RfidInfo> load() { |
| 30 | List<RfidInfo> result = new ArrayList<>(); | 33 | List<RfidInfo> result = new ArrayList<>(); |
| @@ -75,4 +78,9 @@ public class RfidHttpLoader { | @@ -75,4 +78,9 @@ public class RfidHttpLoader { | ||
| 75 | 78 | ||
| 76 | return result; | 79 | return result; |
| 77 | } | 80 | } |
| 81 | + | ||
| 82 | + @Override | ||
| 83 | + public void afterPropertiesSet() throws Exception { | ||
| 84 | + RFID_URL = SystemParamCache.getUrlHttpRfid(); | ||
| 85 | + } | ||
| 78 | } | 86 | } |
src/main/java/com/bsth/data/maintenance_plan/MtPlanDataLoadThread.java
| 1 | package com.bsth.data.maintenance_plan; | 1 | package com.bsth.data.maintenance_plan; |
| 2 | 2 | ||
| 3 | +import com.bsth.data.SystemParamCache; | ||
| 3 | import com.fasterxml.jackson.databind.ObjectMapper; | 4 | import com.fasterxml.jackson.databind.ObjectMapper; |
| 4 | import org.apache.http.HttpEntity; | 5 | import org.apache.http.HttpEntity; |
| 5 | import org.apache.http.client.config.RequestConfig; | 6 | import org.apache.http.client.config.RequestConfig; |
| @@ -33,8 +34,7 @@ public class MtPlanDataLoadThread extends Thread implements InitializingBean { | @@ -33,8 +34,7 @@ public class MtPlanDataLoadThread extends Thread implements InitializingBean { | ||
| 33 | 34 | ||
| 34 | private Logger logger = LoggerFactory.getLogger(this.getClass()); | 35 | private Logger logger = LoggerFactory.getLogger(this.getClass()); |
| 35 | 36 | ||
| 36 | - @Value("${http.mtplan.interface}") | ||
| 37 | - private String url; | 37 | + private String url = SystemParamCache.getUrlHttpMaintenance(); |
| 38 | private CloseableHttpClient httpClient; | 38 | private CloseableHttpClient httpClient; |
| 39 | private RequestConfig requestConfig; | 39 | private RequestConfig requestConfig; |
| 40 | private CloseableHttpResponse response; | 40 | private CloseableHttpResponse response; |
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
| @@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONArray; | @@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONArray; | ||
| 5 | import com.bsth.common.Constants; | 5 | import com.bsth.common.Constants; |
| 6 | import com.bsth.common.ResponseCode; | 6 | import com.bsth.common.ResponseCode; |
| 7 | import com.bsth.data.LineConfigData; | 7 | import com.bsth.data.LineConfigData; |
| 8 | +import com.bsth.data.SystemParamCache; | ||
| 8 | import com.bsth.data.gpsdata_v2.GpsRealData; | 9 | import com.bsth.data.gpsdata_v2.GpsRealData; |
| 9 | import com.bsth.data.gpsdata_v2.utils.GpsDataRecovery; | 10 | import com.bsth.data.gpsdata_v2.utils.GpsDataRecovery; |
| 10 | import com.bsth.data.schedule.f_a_l.FirstAndLastHandler; | 11 | import com.bsth.data.schedule.f_a_l.FirstAndLastHandler; |
| @@ -27,7 +28,6 @@ import org.joda.time.format.DateTimeFormatter; | @@ -27,7 +28,6 @@ import org.joda.time.format.DateTimeFormatter; | ||
| 27 | import org.slf4j.Logger; | 28 | import org.slf4j.Logger; |
| 28 | import org.slf4j.LoggerFactory; | 29 | import org.slf4j.LoggerFactory; |
| 29 | import org.springframework.beans.factory.annotation.Autowired; | 30 | import org.springframework.beans.factory.annotation.Autowired; |
| 30 | -import org.springframework.beans.factory.annotation.Value; | ||
| 31 | import org.springframework.dao.DataIntegrityViolationException; | 31 | import org.springframework.dao.DataIntegrityViolationException; |
| 32 | import org.springframework.jdbc.core.BatchPreparedStatementSetter; | 32 | import org.springframework.jdbc.core.BatchPreparedStatementSetter; |
| 33 | import org.springframework.jdbc.core.JdbcTemplate; | 33 | import org.springframework.jdbc.core.JdbcTemplate; |
| @@ -54,9 +54,6 @@ import java.util.concurrent.ConcurrentMap; | @@ -54,9 +54,6 @@ import java.util.concurrent.ConcurrentMap; | ||
| 54 | @Component | 54 | @Component |
| 55 | public class DayOfSchedule { | 55 | public class DayOfSchedule { |
| 56 | 56 | ||
| 57 | - @Value("${ms.fl.generate}") | ||
| 58 | - private boolean generate; | ||
| 59 | - | ||
| 60 | Logger logger = LoggerFactory.getLogger(this.getClass()); | 57 | Logger logger = LoggerFactory.getLogger(this.getClass()); |
| 61 | 58 | ||
| 62 | //按线路分组的 “原始计划” 排班数据 | 59 | //按线路分组的 “原始计划” 排班数据 |
| @@ -187,6 +184,7 @@ public class DayOfSchedule { | @@ -187,6 +184,7 @@ public class DayOfSchedule { | ||
| 187 | */ | 184 | */ |
| 188 | public int reloadSch(String lineCode, String schDate, boolean forcePlan) { | 185 | public int reloadSch(String lineCode, String schDate, boolean forcePlan) { |
| 189 | try { | 186 | try { |
| 187 | + boolean generate = SystemParamCache.getEnabledFirstLastGeneration(); | ||
| 190 | List<ScheduleRealInfo> list; | 188 | List<ScheduleRealInfo> list; |
| 191 | 189 | ||
| 192 | if (forcePlan) | 190 | if (forcePlan) |
src/main/java/com/bsth/entity/LsStationRoute.java
| @@ -2,6 +2,7 @@ package com.bsth.entity; | @@ -2,6 +2,7 @@ package com.bsth.entity; | ||
| 2 | 2 | ||
| 3 | import com.fasterxml.jackson.annotation.JsonIgnore; | 3 | import com.fasterxml.jackson.annotation.JsonIgnore; |
| 4 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | 4 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; |
| 5 | +import org.geolatte.geom.Point; | ||
| 5 | import org.geolatte.geom.Polygon; | 6 | import org.geolatte.geom.Polygon; |
| 6 | import org.hibernate.annotations.DynamicInsert; | 7 | import org.hibernate.annotations.DynamicInsert; |
| 7 | import org.hibernate.annotations.DynamicUpdate; | 8 | import org.hibernate.annotations.DynamicUpdate; |
| @@ -73,10 +74,10 @@ public class LsStationRoute { | @@ -73,10 +74,10 @@ public class LsStationRoute { | ||
| 73 | private Integer outStationNmber; | 74 | private Integer outStationNmber; |
| 74 | 75 | ||
| 75 | // 站点路由到站距离 | 76 | // 站点路由到站距离 |
| 76 | - private Double distances = 0.; | 77 | + private Double distances; |
| 77 | 78 | ||
| 78 | // 站点路由到站时间 | 79 | // 站点路由到站时间 |
| 79 | - private Double toTime = 0.; | 80 | + private Double toTime; |
| 80 | 81 | ||
| 81 | // 首班时间 | 82 | // 首班时间 |
| 82 | private String firstTime; | 83 | private String firstTime; |
| @@ -88,7 +89,7 @@ public class LsStationRoute { | @@ -88,7 +89,7 @@ public class LsStationRoute { | ||
| 88 | private Integer directions; | 89 | private Integer directions; |
| 89 | 90 | ||
| 90 | // 版本号 | 91 | // 版本号 |
| 91 | - private Integer versions = 1; | 92 | + private Integer versions; |
| 92 | 93 | ||
| 93 | // 是否撤销 | 94 | // 是否撤销 |
| 94 | private Integer destroy = 0; | 95 | private Integer destroy = 0; |
| @@ -121,12 +122,12 @@ public class LsStationRoute { | @@ -121,12 +122,12 @@ public class LsStationRoute { | ||
| 121 | /** | 122 | /** |
| 122 | * 缓冲区几何图形类型 d 多边形 r 圆形 | 123 | * 缓冲区几何图形类型 d 多边形 r 圆形 |
| 123 | */ | 124 | */ |
| 124 | - private String shapedType = "r"; | 125 | + private String shapedType; |
| 125 | 126 | ||
| 126 | /** | 127 | /** |
| 127 | * 缓冲区为圆形时的半径(米) | 128 | * 缓冲区为圆形时的半径(米) |
| 128 | */ | 129 | */ |
| 129 | - private Integer radius = 80; | 130 | + private Integer radius; |
| 130 | 131 | ||
| 131 | /** | 132 | /** |
| 132 | * 多边形缓冲区坐标 字符串格式 POLYGON((lon lat, lon lat)) | 133 | * 多边形缓冲区坐标 字符串格式 POLYGON((lon lat, lon lat)) |
| @@ -146,6 +147,24 @@ public class LsStationRoute { | @@ -146,6 +147,24 @@ public class LsStationRoute { | ||
| 146 | @Transient | 147 | @Transient |
| 147 | private String bufferPolygonWgsWkt; | 148 | private String bufferPolygonWgsWkt; |
| 148 | 149 | ||
| 150 | + /** | ||
| 151 | + * 中心点 字符格式 Point(lon, lat) | ||
| 152 | + */ | ||
| 153 | + @JsonIgnore | ||
| 154 | + private Point centerPoint; | ||
| 155 | + | ||
| 156 | + /** | ||
| 157 | + * 中心点 数字格式 | ||
| 158 | + */ | ||
| 159 | + @Transient | ||
| 160 | + private String centerPointWkt; | ||
| 161 | + | ||
| 162 | + @JsonIgnore | ||
| 163 | + private Point centerPointWgs; | ||
| 164 | + | ||
| 165 | + @Transient | ||
| 166 | + private String centerPointWgsWkt; | ||
| 167 | + | ||
| 149 | public Integer getId() { | 168 | public Integer getId() { |
| 150 | return id; | 169 | return id; |
| 151 | } | 170 | } |
| @@ -385,4 +404,40 @@ public class LsStationRoute { | @@ -385,4 +404,40 @@ public class LsStationRoute { | ||
| 385 | public void setBufferPolygonWgsWkt(String bufferPolygonWgsWkt) { | 404 | public void setBufferPolygonWgsWkt(String bufferPolygonWgsWkt) { |
| 386 | this.bufferPolygonWgsWkt = bufferPolygonWgsWkt; | 405 | this.bufferPolygonWgsWkt = bufferPolygonWgsWkt; |
| 387 | } | 406 | } |
| 407 | + | ||
| 408 | + public Point getCenterPoint() { | ||
| 409 | + return centerPoint; | ||
| 410 | + } | ||
| 411 | + | ||
| 412 | + public void setCenterPoint(Point centerPoint) { | ||
| 413 | + this.centerPoint = centerPoint; | ||
| 414 | + } | ||
| 415 | + | ||
| 416 | + public String getCenterPointWkt() { | ||
| 417 | + if (centerPointWkt == null && this.centerPoint != null) { | ||
| 418 | + centerPointWkt = this.centerPoint.toString(); | ||
| 419 | + } | ||
| 420 | + | ||
| 421 | + return centerPointWkt; | ||
| 422 | + } | ||
| 423 | + | ||
| 424 | + public void setCenterPointWkt(String centerPointWkt) { | ||
| 425 | + this.centerPointWkt = centerPointWkt; | ||
| 426 | + } | ||
| 427 | + | ||
| 428 | + public Point getCenterPointWgs() { | ||
| 429 | + return centerPointWgs; | ||
| 430 | + } | ||
| 431 | + | ||
| 432 | + public void setCenterPointWgs(Point centerPointWgs) { | ||
| 433 | + this.centerPointWgs = centerPointWgs; | ||
| 434 | + } | ||
| 435 | + | ||
| 436 | + public String getCenterPointWgsWkt() { | ||
| 437 | + if (centerPointWgsWkt == null && this.centerPointWgs != null) { | ||
| 438 | + centerPointWgsWkt = this.centerPointWgs .toString(); | ||
| 439 | + } | ||
| 440 | + | ||
| 441 | + return centerPointWgsWkt; | ||
| 442 | + } | ||
| 388 | } | 443 | } |
| 389 | \ No newline at end of file | 444 | \ No newline at end of file |
src/main/java/com/bsth/entity/StationRoute.java
| 1 | package com.bsth.entity; | 1 | package com.bsth.entity; |
| 2 | 2 | ||
| 3 | import com.fasterxml.jackson.annotation.JsonIgnore; | 3 | import com.fasterxml.jackson.annotation.JsonIgnore; |
| 4 | +import org.geolatte.geom.Point; | ||
| 4 | import org.geolatte.geom.Polygon; | 5 | import org.geolatte.geom.Polygon; |
| 5 | 6 | ||
| 6 | import javax.persistence.*; | 7 | import javax.persistence.*; |
| @@ -179,6 +180,24 @@ public class StationRoute { | @@ -179,6 +180,24 @@ public class StationRoute { | ||
| 179 | @Transient | 180 | @Transient |
| 180 | private String bufferPolygonWgsWkt; | 181 | private String bufferPolygonWgsWkt; |
| 181 | 182 | ||
| 183 | + /** | ||
| 184 | + * 中心点 字符格式 Point(lon, lat) | ||
| 185 | + */ | ||
| 186 | + @JsonIgnore | ||
| 187 | + private Point centerPoint; | ||
| 188 | + | ||
| 189 | + /** | ||
| 190 | + * 中心点 数字格式 | ||
| 191 | + */ | ||
| 192 | + @Transient | ||
| 193 | + private String centerPointWkt; | ||
| 194 | + | ||
| 195 | + @JsonIgnore | ||
| 196 | + private Point centerPointWgs; | ||
| 197 | + | ||
| 198 | + @Transient | ||
| 199 | + private String centerPointWgsWkt; | ||
| 200 | + | ||
| 182 | public Integer getId() { | 201 | public Integer getId() { |
| 183 | return id; | 202 | return id; |
| 184 | } | 203 | } |
| @@ -418,4 +437,40 @@ public class StationRoute { | @@ -418,4 +437,40 @@ public class StationRoute { | ||
| 418 | public void setBufferPolygonWgsWkt(String bufferPolygonWgsWkt) { | 437 | public void setBufferPolygonWgsWkt(String bufferPolygonWgsWkt) { |
| 419 | this.bufferPolygonWgsWkt = bufferPolygonWgsWkt; | 438 | this.bufferPolygonWgsWkt = bufferPolygonWgsWkt; |
| 420 | } | 439 | } |
| 440 | + | ||
| 441 | + public Point getCenterPoint() { | ||
| 442 | + return centerPoint; | ||
| 443 | + } | ||
| 444 | + | ||
| 445 | + public void setCenterPoint(Point centerPoint) { | ||
| 446 | + this.centerPoint = centerPoint; | ||
| 447 | + } | ||
| 448 | + | ||
| 449 | + public String getCenterPointWkt() { | ||
| 450 | + if (centerPointWkt == null && this.centerPoint != null) { | ||
| 451 | + centerPointWkt = this.centerPoint.toString(); | ||
| 452 | + } | ||
| 453 | + | ||
| 454 | + return centerPointWkt; | ||
| 455 | + } | ||
| 456 | + | ||
| 457 | + public void setCenterPointWkt(String centerPointWkt) { | ||
| 458 | + this.centerPointWkt = centerPointWkt; | ||
| 459 | + } | ||
| 460 | + | ||
| 461 | + public Point getCenterPointWgs() { | ||
| 462 | + return centerPointWgs; | ||
| 463 | + } | ||
| 464 | + | ||
| 465 | + public void setCenterPointWgs(Point centerPointWgs) { | ||
| 466 | + this.centerPointWgs = centerPointWgs; | ||
| 467 | + } | ||
| 468 | + | ||
| 469 | + public String getCenterPointWgsWkt() { | ||
| 470 | + if (centerPointWgsWkt == null && this.centerPointWgs != null) { | ||
| 471 | + centerPointWgsWkt = this.centerPointWgs .toString(); | ||
| 472 | + } | ||
| 473 | + | ||
| 474 | + return centerPointWgsWkt; | ||
| 475 | + } | ||
| 421 | } | 476 | } |
| 422 | \ No newline at end of file | 477 | \ No newline at end of file |
src/main/java/com/bsth/entity/SystemParam.java
| 1 | package com.bsth.entity; | 1 | package com.bsth.entity; |
| 2 | 2 | ||
| 3 | -import com.bsth.common.Constants; | ||
| 4 | -import com.bsth.data.BasicData; | ||
| 5 | -import com.bsth.entity.sys.Role; | ||
| 6 | -import com.bsth.security.util.SecurityUtils; | ||
| 7 | - | ||
| 8 | import javax.persistence.*; | 3 | import javax.persistence.*; |
| 9 | -import java.util.Set; | ||
| 10 | 4 | ||
| 11 | /** | 5 | /** |
| 12 | * @author Hill | 6 | * @author Hill |
src/main/java/com/bsth/filter/AuthorityFilter.java
| @@ -2,15 +2,10 @@ package com.bsth.filter; | @@ -2,15 +2,10 @@ package com.bsth.filter; | ||
| 2 | 2 | ||
| 3 | import com.bsth.common.Constants; | 3 | import com.bsth.common.Constants; |
| 4 | import com.bsth.common.ResponseCode; | 4 | import com.bsth.common.ResponseCode; |
| 5 | -import com.bsth.common.Setting; | ||
| 6 | -import com.bsth.entity.sys.SysUser; | ||
| 7 | -import com.bsth.security.util.SecurityUtils; | 5 | +import com.bsth.data.SystemParamCache; |
| 8 | import com.fasterxml.jackson.databind.ObjectMapper; | 6 | import com.fasterxml.jackson.databind.ObjectMapper; |
| 9 | import org.slf4j.Logger; | 7 | import org.slf4j.Logger; |
| 10 | import org.slf4j.LoggerFactory; | 8 | import org.slf4j.LoggerFactory; |
| 11 | -import org.springframework.beans.factory.annotation.Autowired; | ||
| 12 | -import org.springframework.util.AntPathMatcher; | ||
| 13 | -import org.springframework.util.PathMatcher; | ||
| 14 | 9 | ||
| 15 | import javax.servlet.*; | 10 | import javax.servlet.*; |
| 16 | import javax.servlet.http.HttpServletRequest; | 11 | import javax.servlet.http.HttpServletRequest; |
| @@ -38,7 +33,7 @@ public class AuthorityFilter extends BaseFilter { | @@ -38,7 +33,7 @@ public class AuthorityFilter extends BaseFilter { | ||
| 38 | 33 | ||
| 39 | @Override | 34 | @Override |
| 40 | public void doFilter(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws IOException, ServletException { | 35 | public void doFilter(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws IOException, ServletException { |
| 41 | - if (!Setting.isAuthorityEnabled()) { | 36 | + if (!SystemParamCache.getEnableFilterAuthority()) { |
| 42 | chain.doFilter(request, response); | 37 | chain.doFilter(request, response); |
| 43 | return; | 38 | return; |
| 44 | } | 39 | } |
src/main/java/com/bsth/filter/SQLInjectFilter.java
| 1 | -package com.bsth.filter; | ||
| 2 | - | ||
| 3 | -import org.springframework.stereotype.Component; | ||
| 4 | - | ||
| 5 | -import javax.servlet.FilterChain; | ||
| 6 | -import javax.servlet.ServletException; | ||
| 7 | -import javax.servlet.http.HttpServletRequest; | ||
| 8 | -import javax.servlet.http.HttpServletResponse; | ||
| 9 | -import java.io.IOException; | ||
| 10 | -import java.util.Enumeration; | ||
| 11 | - | ||
| 12 | -//@Component | ||
| 13 | -public class SQLInjectFilter extends BaseFilter{ | ||
| 14 | - | ||
| 15 | - @Override | ||
| 16 | - public void doFilter(HttpServletRequest request, HttpServletResponse response, FilterChain chain) | ||
| 17 | - throws IOException, ServletException { | ||
| 18 | - //获取请求对象中的参数名称 | ||
| 19 | - Enumeration enu = request.getParameterNames(); | ||
| 20 | - | ||
| 21 | - //遍历枚举 | ||
| 22 | - while (enu.hasMoreElements()) { | ||
| 23 | - //取参数名 | ||
| 24 | - String paraName = (String)enu.nextElement(); | ||
| 25 | - | ||
| 26 | - //取参数值并校验 | ||
| 27 | - if (isSqlInject(request.getParameter(paraName))) { | ||
| 28 | - return; | ||
| 29 | - } | ||
| 30 | - } | ||
| 31 | - //校验完毕,放行 | ||
| 32 | - chain.doFilter(request, response); | ||
| 33 | - } | ||
| 34 | - | ||
| 35 | - private static boolean isSqlInject(String injectStr) { | ||
| 36 | - String injStr = "'|and|exec|create|insert|select|delete|update|count|*|%|chr|mid|master|truncate|drop|char|declare|;|or|-|+|,"; | ||
| 37 | - String injStrArr[] = injStr.split("\\|"); | ||
| 38 | - injectStr = injectStr.toLowerCase(); | ||
| 39 | - for (int i = 0; i < injStrArr.length; i++) { | ||
| 40 | - if (injectStr.indexOf(injStrArr[i]) >= 0) { | ||
| 41 | - return true; | ||
| 42 | - } | ||
| 43 | - } | ||
| 44 | - return false; | ||
| 45 | - } | ||
| 46 | -} | 1 | +package com.bsth.filter; |
| 2 | + | ||
| 3 | +import com.bsth.data.SystemParamCache; | ||
| 4 | +import org.springframework.stereotype.Component; | ||
| 5 | + | ||
| 6 | +import javax.servlet.FilterChain; | ||
| 7 | +import javax.servlet.ServletException; | ||
| 8 | +import javax.servlet.http.HttpServletRequest; | ||
| 9 | +import javax.servlet.http.HttpServletResponse; | ||
| 10 | +import java.io.IOException; | ||
| 11 | +import java.util.Enumeration; | ||
| 12 | + | ||
| 13 | +@Component | ||
| 14 | +public class SQLInjectFilter extends BaseFilter{ | ||
| 15 | + | ||
| 16 | + private static String injStr = "'|and|exec|create|insert|select|delete|update|count|*|%|chr|mid|master|truncate|drop|char|declare"; | ||
| 17 | + | ||
| 18 | + private final static String specialUri = "adminUtils"; | ||
| 19 | + | ||
| 20 | + @Override | ||
| 21 | + public void doFilter(HttpServletRequest request, HttpServletResponse response, FilterChain chain) | ||
| 22 | + throws IOException, ServletException { | ||
| 23 | + if (!SystemParamCache.getEnabledFilterSqlInjection()) { | ||
| 24 | + chain.doFilter(request, response); | ||
| 25 | + return; | ||
| 26 | + } | ||
| 27 | + | ||
| 28 | + //获取请求对象中的参数名称 | ||
| 29 | + Enumeration enu = request.getParameterNames(); | ||
| 30 | + String uri = request.getRequestURI(); | ||
| 31 | + | ||
| 32 | + if (uri.indexOf(specialUri) > -1) { | ||
| 33 | + chain.doFilter(request, response); | ||
| 34 | + return; | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | + //遍历枚举 | ||
| 38 | + while (enu.hasMoreElements()) { | ||
| 39 | + //取参数名 | ||
| 40 | + String paraName = (String)enu.nextElement(); | ||
| 41 | + | ||
| 42 | + //取参数值并校验 | ||
| 43 | + if (isSqlInject(request.getParameter(paraName))) { | ||
| 44 | + return; | ||
| 45 | + } | ||
| 46 | + } | ||
| 47 | + //校验完毕,放行 | ||
| 48 | + chain.doFilter(request, response); | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + private static boolean isSqlInject(String injectStr) { | ||
| 52 | + String injStrArr[] = injStr.split("\\|"); | ||
| 53 | + injectStr = injectStr.toLowerCase(); | ||
| 54 | + for (int i = 0; i < injStrArr.length; i++) { | ||
| 55 | + if (injectStr.indexOf(injStrArr[i]) >= 0) { | ||
| 56 | + return true; | ||
| 57 | + } | ||
| 58 | + } | ||
| 59 | + return false; | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + public static String getInjStr() { | ||
| 63 | + return injStr; | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + public static void setInjStr(String injStr) { | ||
| 67 | + SQLInjectFilter.injStr = injStr; | ||
| 68 | + } | ||
| 69 | +} |
src/main/java/com/bsth/filter/WhiteIpFilter.java
| 1 | package com.bsth.filter; | 1 | package com.bsth.filter; |
| 2 | 2 | ||
| 3 | -import com.bsth.common.Setting; | ||
| 4 | -import com.bsth.data.BasicData; | 3 | +import com.bsth.data.SystemParamCache; |
| 4 | +import com.bsth.data.WhiteIpCache; | ||
| 5 | import com.bsth.entity.WhiteIp; | 5 | import com.bsth.entity.WhiteIp; |
| 6 | import com.bsth.util.IpUtils; | 6 | import com.bsth.util.IpUtils; |
| 7 | import org.slf4j.Logger; | 7 | import org.slf4j.Logger; |
| @@ -24,7 +24,7 @@ public class WhiteIpFilter implements Filter { | @@ -24,7 +24,7 @@ public class WhiteIpFilter implements Filter { | ||
| 24 | @Override | 24 | @Override |
| 25 | public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { | 25 | public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { |
| 26 | 26 | ||
| 27 | - if (!Setting.isWhiteipEnabled()) { | 27 | + if (!SystemParamCache.getEnabledWhiteIp()) { |
| 28 | chain.doFilter(request, response); | 28 | chain.doFilter(request, response); |
| 29 | return; | 29 | return; |
| 30 | } | 30 | } |
| @@ -34,7 +34,7 @@ public class WhiteIpFilter implements Filter { | @@ -34,7 +34,7 @@ public class WhiteIpFilter implements Filter { | ||
| 34 | 34 | ||
| 35 | String ip = IpUtils.getIpAddr(req); | 35 | String ip = IpUtils.getIpAddr(req); |
| 36 | boolean isMatch = false; | 36 | boolean isMatch = false; |
| 37 | - List<WhiteIp> whiteIps = BasicData.whiteIpList; | 37 | + List<WhiteIp> whiteIps = WhiteIpCache.getWhiteIps(); |
| 38 | if (whiteIps != null) { | 38 | if (whiteIps != null) { |
| 39 | for (WhiteIp whiteIp : whiteIps) { | 39 | for (WhiteIp whiteIp : whiteIps) { |
| 40 | if (ip.equals(whiteIp.getIp())) { | 40 | if (ip.equals(whiteIp.getIp())) { |
| @@ -46,7 +46,7 @@ public class WhiteIpFilter implements Filter { | @@ -46,7 +46,7 @@ public class WhiteIpFilter implements Filter { | ||
| 46 | if (isMatch) { | 46 | if (isMatch) { |
| 47 | chain.doFilter(request, response); | 47 | chain.doFilter(request, response); |
| 48 | } else { | 48 | } else { |
| 49 | - logger.info(ip + "未在白名单中,不予访问"); | 49 | + logger.info("{}未在白名单中,不予访问", ip); |
| 50 | res.setStatus(404); | 50 | res.setStatus(404); |
| 51 | } | 51 | } |
| 52 | } | 52 | } |
src/main/java/com/bsth/repository/StationRouteRepository.java
| @@ -87,7 +87,7 @@ public interface StationRouteRepository extends BaseRepository<StationRoute, Int | @@ -87,7 +87,7 @@ public interface StationRouteRepository extends BaseRepository<StationRoute, Int | ||
| 87 | * | 87 | * |
| 88 | * [6]:distances(站点距离);[7]:station_name(站点名称);[8]:directions(方向)} | 88 | * [6]:distances(站点距离);[7]:station_name(站点名称);[8]:directions(方向)} |
| 89 | */ | 89 | */ |
| 90 | - @Query(value = "SELECT ST_X(s.center_point_wgs) g_lonx,ST_Y(s.center_point_wgs) g_laty,CONCAT(ST_X(s.center_point), ' ', ST_Y(s.center_point)) b_jwpoints,r.station_mark,r.station_route_code,s.station_code,r.distances,r.station_name,r.directions,r.station_name_en FROM bsth_c_stationroute r JOIN bsth_c_station s ON r.station = s.id WHERE r.line = ?1 and r.destroy = 0 ORDER BY r.directions,r.station_route_code", nativeQuery=true) | 90 | + @Query(value = "SELECT ST_X(r.center_point_wgs) g_lonx,ST_Y(r.center_point_wgs) g_laty,CONCAT(ST_X(r.center_point), ' ', ST_Y(r.center_point)) b_jwpoints,r.station_mark,r.station_route_code,s.station_code,r.distances,r.station_name,r.directions,r.station_name_en FROM bsth_c_stationroute r JOIN bsth_c_station s ON r.station = s.id WHERE r.line = ?1 and r.destroy = 0 ORDER BY r.directions,r.station_route_code", nativeQuery=true) |
| 91 | List<Object[]> usingSingle(Integer lineId); | 91 | List<Object[]> usingSingle(Integer lineId); |
| 92 | 92 | ||
| 93 | List<StationRoute> findByLine(Line line); | 93 | List<StationRoute> findByLine(Line line); |
src/main/java/com/bsth/security/SsoConfig.java
| @@ -55,7 +55,6 @@ public class SsoConfig { | @@ -55,7 +55,6 @@ public class SsoConfig { | ||
| 55 | return systemCode; | 55 | return systemCode; |
| 56 | } | 56 | } |
| 57 | 57 | ||
| 58 | - @Value("${sso.systemcode}") | ||
| 59 | public void setSystemCode(String systemCode) { | 58 | public void setSystemCode(String systemCode) { |
| 60 | this.systemCode = systemCode; | 59 | this.systemCode = systemCode; |
| 61 | } | 60 | } |
| @@ -85,7 +84,6 @@ public class SsoConfig { | @@ -85,7 +84,6 @@ public class SsoConfig { | ||
| 85 | return ssoAuthUrl; | 84 | return ssoAuthUrl; |
| 86 | } | 85 | } |
| 87 | 86 | ||
| 88 | - @Value("${sso.http.url.auth}") | ||
| 89 | public void setSsoAuthUrl(String ssoAuthUrl) { | 87 | public void setSsoAuthUrl(String ssoAuthUrl) { |
| 90 | this.ssoAuthUrl = ssoAuthUrl; | 88 | this.ssoAuthUrl = ssoAuthUrl; |
| 91 | } | 89 | } |
src/main/java/com/bsth/security/WebSecurityConfig.java
| 1 | package com.bsth.security; | 1 | package com.bsth.security; |
| 2 | 2 | ||
| 3 | import com.bsth.common.Constants; | 3 | import com.bsth.common.Constants; |
| 4 | -import com.bsth.common.Setting; | ||
| 5 | import com.bsth.filter.AuthorityFilter; | 4 | import com.bsth.filter.AuthorityFilter; |
| 6 | import com.bsth.filter.WhiteIpFilter; | 5 | import com.bsth.filter.WhiteIpFilter; |
| 7 | import com.bsth.security.filter.LoginInterceptor; | 6 | import com.bsth.security.filter.LoginInterceptor; |
| @@ -35,9 +34,6 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter { | @@ -35,9 +34,6 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter { | ||
| 35 | @Autowired | 34 | @Autowired |
| 36 | SecurityMetadataSourceService securityMetadataSourceService; | 35 | SecurityMetadataSourceService securityMetadataSourceService; |
| 37 | 36 | ||
| 38 | - @Autowired | ||
| 39 | - private Setting setting; | ||
| 40 | - | ||
| 41 | @Override | 37 | @Override |
| 42 | public void configure(WebSecurity web) throws Exception { | 38 | public void configure(WebSecurity web) throws Exception { |
| 43 | // 白名单 | 39 | // 白名单 |
src/main/java/com/bsth/service/SystemParamService.java
| @@ -6,4 +6,8 @@ import com.bsth.entity.SystemParam; | @@ -6,4 +6,8 @@ import com.bsth.entity.SystemParam; | ||
| 6 | * @author Hill | 6 | * @author Hill |
| 7 | */ | 7 | */ |
| 8 | public interface SystemParamService extends BaseService<SystemParam, Integer> { | 8 | public interface SystemParamService extends BaseService<SystemParam, Integer> { |
| 9 | + | ||
| 10 | + void refresh(); | ||
| 11 | + | ||
| 12 | + String getValue(String key); | ||
| 9 | } | 13 | } |
src/main/java/com/bsth/service/forms/impl/RevenueLoader.java
| 1 | -package com.bsth.service.forms.impl; | ||
| 2 | - | ||
| 3 | -import com.alibaba.fastjson.JSON; | ||
| 4 | -import com.bsth.util.ConfigUtil; | ||
| 5 | -import org.apache.http.HttpEntity; | ||
| 6 | -import org.apache.http.client.config.RequestConfig; | ||
| 7 | -import org.apache.http.client.methods.CloseableHttpResponse; | ||
| 8 | -import org.apache.http.client.methods.HttpGet; | ||
| 9 | -import org.apache.http.impl.client.CloseableHttpClient; | ||
| 10 | -import org.apache.http.impl.client.HttpClients; | ||
| 11 | -import org.slf4j.Logger; | ||
| 12 | -import org.slf4j.LoggerFactory; | ||
| 13 | -import org.springframework.stereotype.Component; | ||
| 14 | - | ||
| 15 | -import java.io.BufferedReader; | ||
| 16 | -import java.io.InputStreamReader; | ||
| 17 | -import java.util.ArrayList; | ||
| 18 | -import java.util.List; | ||
| 19 | -import java.util.Map; | ||
| 20 | - | ||
| 21 | -@Component | ||
| 22 | -public class RevenueLoader { | ||
| 23 | - | ||
| 24 | - static Logger logger = LoggerFactory.getLogger(RevenueLoader.class); | ||
| 25 | - | ||
| 26 | - static String url; | ||
| 27 | - static List<Map<String, Object>> list; | ||
| 28 | - static CloseableHttpClient httpClient = null; | ||
| 29 | - static HttpGet get; | ||
| 30 | - static RequestConfig requestConfig; | ||
| 31 | - static CloseableHttpResponse response; | ||
| 32 | - static HttpEntity entity; | ||
| 33 | - static BufferedReader br; | ||
| 34 | - | ||
| 35 | - /** | ||
| 36 | - * 从票务系统获取营收 | ||
| 37 | - * @param date | ||
| 38 | - * @param gsBm | ||
| 39 | - * @return | ||
| 40 | - */ | ||
| 41 | - public static List<Map<String, Object>> load(String date, String gsBm){ | ||
| 42 | - try { | ||
| 43 | - url = ConfigUtil.get("http.ticketing.interface") + "?revenueFlag=1&txnType=getLineRevenue&busiDate="+date+"&companyCode="+gsBm; | ||
| 44 | - list = new ArrayList<>(); | ||
| 45 | - httpClient = HttpClients.createDefault(); | ||
| 46 | - get = new HttpGet(url); | ||
| 47 | - requestConfig = RequestConfig.custom() | ||
| 48 | - .setConnectTimeout(10000).setConnectionRequestTimeout(10000) | ||
| 49 | - .setSocketTimeout(60000).build(); | ||
| 50 | - get.setConfig(requestConfig); | ||
| 51 | - if(list.size() > 0) | ||
| 52 | - list.clear(); | ||
| 53 | - logger.info("load start..."); | ||
| 54 | - response = httpClient.execute(get); | ||
| 55 | - entity = response.getEntity(); | ||
| 56 | - if(null == entity) | ||
| 57 | - return list; | ||
| 58 | - | ||
| 59 | - br = new BufferedReader(new InputStreamReader(entity.getContent())); | ||
| 60 | - StringBuilder sb = new StringBuilder(); | ||
| 61 | - String str; | ||
| 62 | - while ((str = br.readLine()) != null) | ||
| 63 | - sb.append(str); | ||
| 64 | - | ||
| 65 | - Map<String, Object> parseObj = JSON.parseObject(sb.toString(), Map.class); | ||
| 66 | - if(parseObj.get("status") != null && "SUCCESS".equals(parseObj.get("status").toString())){ | ||
| 67 | - for(Map<String, Object> m : (List<Map<String, Object>>) parseObj.get("respData")){ | ||
| 68 | - list.add(m); | ||
| 69 | - } | ||
| 70 | - } | ||
| 71 | - | ||
| 72 | - logger.info("load end ! size: " + list.size()); | ||
| 73 | - | ||
| 74 | - if (null != response) | ||
| 75 | - response.close(); | ||
| 76 | - } catch (Exception e) { | ||
| 77 | - logger.error("", e); | ||
| 78 | - } | ||
| 79 | - | ||
| 80 | - return list; | ||
| 81 | - } | ||
| 82 | -} | 1 | +package com.bsth.service.forms.impl; |
| 2 | + | ||
| 3 | +import com.alibaba.fastjson.JSON; | ||
| 4 | +import com.bsth.data.SystemParamCache; | ||
| 5 | +import com.bsth.util.ConfigUtil; | ||
| 6 | +import org.apache.http.HttpEntity; | ||
| 7 | +import org.apache.http.client.config.RequestConfig; | ||
| 8 | +import org.apache.http.client.methods.CloseableHttpResponse; | ||
| 9 | +import org.apache.http.client.methods.HttpGet; | ||
| 10 | +import org.apache.http.impl.client.CloseableHttpClient; | ||
| 11 | +import org.apache.http.impl.client.HttpClients; | ||
| 12 | +import org.slf4j.Logger; | ||
| 13 | +import org.slf4j.LoggerFactory; | ||
| 14 | +import org.springframework.stereotype.Component; | ||
| 15 | + | ||
| 16 | +import java.io.BufferedReader; | ||
| 17 | +import java.io.InputStreamReader; | ||
| 18 | +import java.util.ArrayList; | ||
| 19 | +import java.util.List; | ||
| 20 | +import java.util.Map; | ||
| 21 | + | ||
| 22 | +@Component | ||
| 23 | +public class RevenueLoader { | ||
| 24 | + | ||
| 25 | + static Logger logger = LoggerFactory.getLogger(RevenueLoader.class); | ||
| 26 | + | ||
| 27 | + static String url; | ||
| 28 | + static List<Map<String, Object>> list; | ||
| 29 | + static CloseableHttpClient httpClient = null; | ||
| 30 | + static HttpGet get; | ||
| 31 | + static RequestConfig requestConfig; | ||
| 32 | + static CloseableHttpResponse response; | ||
| 33 | + static HttpEntity entity; | ||
| 34 | + static BufferedReader br; | ||
| 35 | + | ||
| 36 | + /** | ||
| 37 | + * 从票务系统获取营收 | ||
| 38 | + * @param date | ||
| 39 | + * @param gsBm | ||
| 40 | + * @return | ||
| 41 | + */ | ||
| 42 | + public static List<Map<String, Object>> load(String date, String gsBm){ | ||
| 43 | + try { | ||
| 44 | + url = String.format(SystemParamCache.getUrlHttpTicketing(), date, gsBm); | ||
| 45 | + list = new ArrayList<>(); | ||
| 46 | + httpClient = HttpClients.createDefault(); | ||
| 47 | + get = new HttpGet(url); | ||
| 48 | + requestConfig = RequestConfig.custom() | ||
| 49 | + .setConnectTimeout(10000).setConnectionRequestTimeout(10000) | ||
| 50 | + .setSocketTimeout(60000).build(); | ||
| 51 | + get.setConfig(requestConfig); | ||
| 52 | + if(list.size() > 0) | ||
| 53 | + list.clear(); | ||
| 54 | + logger.info("load start..."); | ||
| 55 | + response = httpClient.execute(get); | ||
| 56 | + entity = response.getEntity(); | ||
| 57 | + if(null == entity) | ||
| 58 | + return list; | ||
| 59 | + | ||
| 60 | + br = new BufferedReader(new InputStreamReader(entity.getContent())); | ||
| 61 | + StringBuilder sb = new StringBuilder(); | ||
| 62 | + String str; | ||
| 63 | + while ((str = br.readLine()) != null) | ||
| 64 | + sb.append(str); | ||
| 65 | + | ||
| 66 | + Map<String, Object> parseObj = JSON.parseObject(sb.toString(), Map.class); | ||
| 67 | + if(parseObj.get("status") != null && "SUCCESS".equals(parseObj.get("status").toString())){ | ||
| 68 | + for(Map<String, Object> m : (List<Map<String, Object>>) parseObj.get("respData")){ | ||
| 69 | + list.add(m); | ||
| 70 | + } | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + logger.info("load end ! size: " + list.size()); | ||
| 74 | + | ||
| 75 | + if (null != response) | ||
| 76 | + response.close(); | ||
| 77 | + } catch (Exception e) { | ||
| 78 | + logger.error("", e); | ||
| 79 | + } | ||
| 80 | + | ||
| 81 | + return list; | ||
| 82 | + } | ||
| 83 | +} |
src/main/java/com/bsth/service/impl/LsStationRouteServiceImpl.java
| @@ -208,6 +208,8 @@ public class LsStationRouteServiceImpl extends BaseServiceImpl<LsStationRoute, I | @@ -208,6 +208,8 @@ public class LsStationRouteServiceImpl extends BaseServiceImpl<LsStationRoute, I | ||
| 208 | // 中心点坐标信息 | 208 | // 中心点坐标信息 |
| 209 | if (!isPresent) { | 209 | if (!isPresent) { |
| 210 | centerPoint(station); | 210 | centerPoint(station); |
| 211 | + stationRoute.setCenterPoint(station.getCenterPoint()); | ||
| 212 | + stationRoute.setCenterPointWgs(station.getCenterPointWgs()); | ||
| 211 | } | 213 | } |
| 212 | 214 | ||
| 213 | // 多边形缓冲区 | 215 | // 多边形缓冲区 |
| @@ -237,6 +239,10 @@ public class LsStationRouteServiceImpl extends BaseServiceImpl<LsStationRoute, I | @@ -237,6 +239,10 @@ public class LsStationRouteServiceImpl extends BaseServiceImpl<LsStationRoute, I | ||
| 237 | throw new IllegalArgumentException("历史版本不可变更"); | 239 | throw new IllegalArgumentException("历史版本不可变更"); |
| 238 | } | 240 | } |
| 239 | 241 | ||
| 242 | + if (!StringUtils.isEmpty(stationRoute.getCenterPointWkt())) { | ||
| 243 | + centerPoint(stationRoute); | ||
| 244 | + } | ||
| 245 | + | ||
| 240 | // 多边形缓冲区 | 246 | // 多边形缓冲区 |
| 241 | if ("d".equals(stationRoute.getShapedType())) { | 247 | if ("d".equals(stationRoute.getShapedType())) { |
| 242 | bufferPolygon(stationRoute); | 248 | bufferPolygon(stationRoute); |
| @@ -428,6 +434,17 @@ public class LsStationRouteServiceImpl extends BaseServiceImpl<LsStationRoute, I | @@ -428,6 +434,17 @@ public class LsStationRouteServiceImpl extends BaseServiceImpl<LsStationRoute, I | ||
| 428 | } | 434 | } |
| 429 | } | 435 | } |
| 430 | 436 | ||
| 437 | + protected void centerPoint(LsStationRoute route) { | ||
| 438 | + // 中心点坐标信息 | ||
| 439 | + String wkt = route.getCenterPointWkt(); | ||
| 440 | + if (!StringUtils.isEmpty(wkt)) { | ||
| 441 | + org.geolatte.geom.Point baidu = (org.geolatte.geom.Point) Wkt.fromWkt(wkt); | ||
| 442 | + org.geolatte.geom.Point wgs = GeoConverter.pointBd2wgs(wkt); | ||
| 443 | + route.setCenterPoint(baidu); | ||
| 444 | + route.setCenterPointWgs(wgs); | ||
| 445 | + } | ||
| 446 | + } | ||
| 447 | + | ||
| 431 | protected void bufferPolygon(LsStationRoute stationRoute) { | 448 | protected void bufferPolygon(LsStationRoute stationRoute) { |
| 432 | String wkt = stationRoute.getBufferPolygonWkt(); | 449 | String wkt = stationRoute.getBufferPolygonWkt(); |
| 433 | if (!StringUtils.isEmpty(wkt)) { | 450 | if (!StringUtils.isEmpty(wkt)) { |
src/main/java/com/bsth/service/impl/SystemParamServiceImpl.java
| 1 | package com.bsth.service.impl; | 1 | package com.bsth.service.impl; |
| 2 | 2 | ||
| 3 | import com.bsth.entity.SystemParam; | 3 | import com.bsth.entity.SystemParam; |
| 4 | +import com.bsth.repository.SystemParamRepository; | ||
| 4 | import com.bsth.service.SystemParamService; | 5 | import com.bsth.service.SystemParamService; |
| 6 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 7 | +import org.springframework.scheduling.annotation.EnableScheduling; | ||
| 8 | +import org.springframework.scheduling.annotation.Scheduled; | ||
| 9 | +import org.springframework.stereotype.Service; | ||
| 10 | + | ||
| 11 | +import java.util.HashMap; | ||
| 12 | +import java.util.Map; | ||
| 5 | 13 | ||
| 6 | /** | 14 | /** |
| 7 | * @author Hill | 15 | * @author Hill |
| 8 | */ | 16 | */ |
| 17 | +@Service | ||
| 18 | +@EnableScheduling | ||
| 9 | public class SystemParamServiceImpl extends BaseServiceImpl<SystemParam, Integer> implements SystemParamService { | 19 | public class SystemParamServiceImpl extends BaseServiceImpl<SystemParam, Integer> implements SystemParamService { |
| 20 | + | ||
| 21 | + @Autowired | ||
| 22 | + private SystemParamRepository systemParamRepository; | ||
| 23 | + | ||
| 24 | + private Map<String, String> pairs = new HashMap<>(); | ||
| 25 | + | ||
| 26 | + @Scheduled(cron = "0 0/30 * * * ?") | ||
| 27 | + public void refresh() { | ||
| 28 | + for (SystemParam sp : systemParamRepository.findAll()) { | ||
| 29 | + pairs.put(sp.getKey(), sp.getValue()); | ||
| 30 | + } | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | + public String getValue(String key) { | ||
| 34 | + return pairs.get(key); | ||
| 35 | + } | ||
| 10 | } | 36 | } |
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
| @@ -6,7 +6,6 @@ import java.math.BigDecimal; | @@ -6,7 +6,6 @@ import java.math.BigDecimal; | ||
| 6 | import java.net.HttpURLConnection; | 6 | import java.net.HttpURLConnection; |
| 7 | import java.net.MalformedURLException; | 7 | import java.net.MalformedURLException; |
| 8 | import java.net.URL; | 8 | import java.net.URL; |
| 9 | -import java.net.URLEncoder; | ||
| 10 | import java.sql.ResultSet; | 9 | import java.sql.ResultSet; |
| 11 | import java.sql.SQLException; | 10 | import java.sql.SQLException; |
| 12 | import java.text.DecimalFormat; | 11 | import java.text.DecimalFormat; |
| @@ -31,6 +30,7 @@ import java.util.regex.Pattern; | @@ -31,6 +30,7 @@ import java.util.regex.Pattern; | ||
| 31 | 30 | ||
| 32 | import com.bsth.entity.*; | 31 | import com.bsth.entity.*; |
| 33 | import com.bsth.util.*; | 32 | import com.bsth.util.*; |
| 33 | +import com.bsth.data.SystemParamCache; | ||
| 34 | import org.apache.commons.io.IOUtils; | 34 | import org.apache.commons.io.IOUtils; |
| 35 | import org.apache.commons.lang3.StringEscapeUtils; | 35 | import org.apache.commons.lang3.StringEscapeUtils; |
| 36 | import org.apache.commons.lang3.StringUtils; | 36 | import org.apache.commons.lang3.StringUtils; |
| @@ -116,6 +116,15 @@ import com.bsth.service.report.ReportService; | @@ -116,6 +116,15 @@ import com.bsth.service.report.ReportService; | ||
| 116 | import com.bsth.service.schedule.SchedulePlanInfoService; | 116 | import com.bsth.service.schedule.SchedulePlanInfoService; |
| 117 | import com.bsth.service.sys.DictionaryService; | 117 | import com.bsth.service.sys.DictionaryService; |
| 118 | import com.bsth.service.sys.DutyEmployeeService; | 118 | import com.bsth.service.sys.DutyEmployeeService; |
| 119 | +import com.bsth.util.Arith; | ||
| 120 | +import com.bsth.util.ComparableChild; | ||
| 121 | +import com.bsth.util.ComparableLp; | ||
| 122 | +import com.bsth.util.ComparableReal; | ||
| 123 | +import com.bsth.util.DateUtils; | ||
| 124 | +import com.bsth.util.ReportRelatedUtils; | ||
| 125 | +import com.bsth.util.ReportUtils; | ||
| 126 | +import com.bsth.util.TimeUtils; | ||
| 127 | +import com.bsth.util.CoordinateConverter; | ||
| 119 | import com.bsth.websocket.handler.SendUtils; | 128 | import com.bsth.websocket.handler.SendUtils; |
| 120 | import com.fasterxml.jackson.databind.ObjectMapper; | 129 | import com.fasterxml.jackson.databind.ObjectMapper; |
| 121 | import com.github.stuxuhai.jpinyin.PinyinException; | 130 | import com.github.stuxuhai.jpinyin.PinyinException; |
| @@ -124,8 +133,6 @@ import com.github.stuxuhai.jpinyin.PinyinHelper; | @@ -124,8 +133,6 @@ import com.github.stuxuhai.jpinyin.PinyinHelper; | ||
| 124 | import com.google.common.base.Splitter; | 133 | import com.google.common.base.Splitter; |
| 125 | import com.google.common.collect.Lists; | 134 | import com.google.common.collect.Lists; |
| 126 | 135 | ||
| 127 | -import javax.ws.rs.HEAD; | ||
| 128 | - | ||
| 129 | @Service | 136 | @Service |
| 130 | public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInfo, Long> | 137 | public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInfo, Long> |
| 131 | implements ScheduleRealInfoService, InitializingBean, DisposableBean { | 138 | implements ScheduleRealInfoService, InitializingBean, DisposableBean { |
| @@ -214,7 +221,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -214,7 +221,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 214 | 221 | ||
| 215 | @Autowired | 222 | @Autowired |
| 216 | RepairReportRepository repairReportRepository; | 223 | RepairReportRepository repairReportRepository; |
| 217 | - Logger logger = LoggerFactory.getLogger(this.getClass()); | 224 | + |
| 225 | + private final static Logger logger = LoggerFactory.getLogger(ScheduleRealInfoServiceImpl.class); | ||
| 218 | 226 | ||
| 219 | SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | 227 | SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), |
| 220 | sdfSimple = new SimpleDateFormat("yyyyMMdd"); | 228 | sdfSimple = new SimpleDateFormat("yyyyMMdd"); |
| @@ -6554,46 +6562,24 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -6554,46 +6562,24 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 6554 | 6562 | ||
| 6555 | @SuppressWarnings("unchecked") | 6563 | @SuppressWarnings("unchecked") |
| 6556 | private static Map<String, Object> request(String url) { | 6564 | private static Map<String, Object> request(String url) { |
| 6557 | - Map<String, Object> res = new HashMap<String, Object>(); | ||
| 6558 | - res.put("status", ResponseCode.SUCCESS); | ||
| 6559 | - InputStream in = null; | ||
| 6560 | - HttpURLConnection con = null; | 6565 | + Map<String, Object> res = new HashMap<>(); |
| 6561 | try { | 6566 | try { |
| 6562 | - con = (HttpURLConnection)new URL(url).openConnection(); | ||
| 6563 | - con.setRequestMethod("POST"); | ||
| 6564 | - con.setRequestProperty("keep-alive", "true"); | ||
| 6565 | - con.setRequestProperty("accept", "application/json"); | ||
| 6566 | - con.setRequestProperty("content-type", "application/json"); | ||
| 6567 | - con.setDoInput(true); | ||
| 6568 | - con.setReadTimeout(2500); | ||
| 6569 | - con.setConnectTimeout(2500); | ||
| 6570 | - | ||
| 6571 | - con.connect(); | ||
| 6572 | - if (con.getResponseCode() == 200) { | ||
| 6573 | - in = con.getInputStream(); | ||
| 6574 | - ByteArrayOutputStream bout = new ByteArrayOutputStream(); | ||
| 6575 | - IOUtils.copy(in, bout); bout.close(); | ||
| 6576 | - Map<String, Object> response = new ObjectMapper().readValue(bout.toByteArray(), Map.class); | ||
| 6577 | - if (!"报修成功".equals(response.get("msg"))) { | ||
| 6578 | - res.put("status", ResponseCode.ERROR); | ||
| 6579 | - res.putAll(response); | ||
| 6580 | - } | ||
| 6581 | - } else { | ||
| 6582 | - res.put("status", ResponseCode.ERROR); | ||
| 6583 | - res.put("msg", "调用上报接口异常"); | ||
| 6584 | - } | ||
| 6585 | - } catch (IOException e) { | 6567 | + StringBuilder sb = HttpClientUtils.post(url, null); |
| 6568 | + if (sb != null) { | ||
| 6569 | + Map<String, Object> response = new ObjectMapper().readValue(sb.toString(), Map.class); | ||
| 6570 | + if (!"报修成功".equals(response.get("msg"))) { | ||
| 6571 | + res.put("status", ResponseCode.ERROR); | ||
| 6572 | + res.putAll(response); | ||
| 6573 | + } | ||
| 6574 | + } else { | ||
| 6575 | + res.put("status", ResponseCode.ERROR); | ||
| 6576 | + res.put("msg", "调用上报接口异常"); | ||
| 6577 | + } | ||
| 6578 | + } catch (Exception e) { | ||
| 6586 | // TODO Auto-generated catch block | 6579 | // TODO Auto-generated catch block |
| 6580 | + logger.error("维修上报异常", e); | ||
| 6587 | res.put("status", ResponseCode.ERROR); | 6581 | res.put("status", ResponseCode.ERROR); |
| 6588 | res.put("msg", "调用上报接口异常"); | 6582 | res.put("msg", "调用上报接口异常"); |
| 6589 | - } finally { | ||
| 6590 | - try { | ||
| 6591 | - if (in != null) in.close(); | ||
| 6592 | - if (con != null) con.disconnect(); | ||
| 6593 | - } catch (IOException e) { | ||
| 6594 | - // TODO Auto-generated catch block | ||
| 6595 | - e.printStackTrace(); | ||
| 6596 | - } | ||
| 6597 | } | 6583 | } |
| 6598 | 6584 | ||
| 6599 | return res; | 6585 | return res; |
| @@ -6626,7 +6612,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -6626,7 +6612,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 6626 | // 分公司保存格式 分公司编码_公司编码 | 6612 | // 分公司保存格式 分公司编码_公司编码 |
| 6627 | String val = BasicData.nbbm2FgsCompanyCodeMap.get(incode); | 6613 | String val = BasicData.nbbm2FgsCompanyCodeMap.get(incode); |
| 6628 | String[] arr = val.split("_"); | 6614 | String[] arr = val.split("_"); |
| 6629 | - StringBuilder url = new StringBuilder(ConfigUtil.get("http.report.url." + arr[1])); | 6615 | + StringBuilder url = new StringBuilder(SystemParamCache.getUrlHttpReport(arr[1])); |
| 6630 | url.append("?nbbm=").append(incode).append("&bxy=").append(reportUser).append("&bxbm=").append(repairTypes).append("&fgs=").append(arr[0]); | 6616 | url.append("?nbbm=").append(incode).append("&bxy=").append(reportUser).append("&bxbm=").append(repairTypes).append("&fgs=").append(arr[0]); |
| 6631 | 6617 | ||
| 6632 | int count = repairReportRepository.repairReportBySch(id, isActive ? 1 : 0); | 6618 | int count = repairReportRepository.repairReportBySch(id, isActive ? 1 : 0); |
| @@ -6666,7 +6652,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -6666,7 +6652,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 6666 | // 分公司保存格式 分公司编码_公司编码 | 6652 | // 分公司保存格式 分公司编码_公司编码 |
| 6667 | String val = BasicData.nbbm2FgsCompanyCodeMap.get(rr.getIncode()); | 6653 | String val = BasicData.nbbm2FgsCompanyCodeMap.get(rr.getIncode()); |
| 6668 | String[] arr = val.split("_"); | 6654 | String[] arr = val.split("_"); |
| 6669 | - StringBuilder url = new StringBuilder(ConfigUtil.get("http.report.url." + arr[1])); | 6655 | + StringBuilder url = new StringBuilder(SystemParamCache.getUrlHttpReport(arr[1])); |
| 6670 | url.append("?nbbm=").append(rr.getIncode()).append("&bxy=").append(rr.getReportUser()).append("&bxbm=").append(rr.getRepairType()).append("&fgs=").append(arr[0]); | 6656 | url.append("?nbbm=").append(rr.getIncode()).append("&bxy=").append(rr.getReportUser()).append("&bxbm=").append(rr.getRepairType()).append("&fgs=").append(arr[0]); |
| 6671 | 6657 | ||
| 6672 | Map<String, Object> res = request(url.toString()); | 6658 | Map<String, Object> res = request(url.toString()); |
src/main/java/com/bsth/util/MailUtils.java
| 1 | package com.bsth.util; | 1 | package com.bsth.util; |
| 2 | 2 | ||
| 3 | +import com.bsth.data.SystemParamCache; | ||
| 3 | import com.bsth.email.SimpleMailSender; | 4 | import com.bsth.email.SimpleMailSender; |
| 4 | import com.bsth.email.entity.EmailBean; | 5 | import com.bsth.email.entity.EmailBean; |
| 5 | -import org.springframework.beans.factory.annotation.Value; | ||
| 6 | import org.springframework.stereotype.Component; | 6 | import org.springframework.stereotype.Component; |
| 7 | 7 | ||
| 8 | import java.util.List; | 8 | import java.util.List; |
| @@ -13,21 +13,10 @@ import java.util.List; | @@ -13,21 +13,10 @@ import java.util.List; | ||
| 13 | @Component | 13 | @Component |
| 14 | public class MailUtils { | 14 | public class MailUtils { |
| 15 | 15 | ||
| 16 | - @Value("${admin.mail}") | ||
| 17 | - private String emailSendToAddress; | ||
| 18 | - | ||
| 19 | private Tools tools = new Tools("mailbox.properties"); | 16 | private Tools tools = new Tools("mailbox.properties"); |
| 20 | 17 | ||
| 21 | private SimpleMailSender sms = new SimpleMailSender(tools.getValue("username"),tools.getValue("password")); | 18 | private SimpleMailSender sms = new SimpleMailSender(tools.getValue("username"),tools.getValue("password")); |
| 22 | 19 | ||
| 23 | - public String getEmailSendToAddress() { | ||
| 24 | - return emailSendToAddress; | ||
| 25 | - } | ||
| 26 | - | ||
| 27 | - public void setEmailSendToAddress(String emailSendToAddress) { | ||
| 28 | - this.emailSendToAddress = emailSendToAddress; | ||
| 29 | - } | ||
| 30 | - | ||
| 31 | /** | 20 | /** |
| 32 | * recipients | 21 | * recipients |
| 33 | * 收件人集合 | 22 | * 收件人集合 |
| @@ -52,9 +41,9 @@ public class MailUtils { | @@ -52,9 +41,9 @@ public class MailUtils { | ||
| 52 | 41 | ||
| 53 | * 邮件 | 42 | * 邮件 |
| 54 | */ | 43 | */ |
| 55 | - public int sendMail(String recipient,EmailBean mail){ | 44 | + public int sendMail(String recipient, EmailBean mail){ |
| 56 | try { | 45 | try { |
| 57 | - sms.send(recipient, mail.getSubject(),mail.getContent()); | 46 | + sms.send(recipient, mail.getSubject(), mail.getContent()); |
| 58 | } catch (Exception e) { | 47 | } catch (Exception e) { |
| 59 | e.printStackTrace(); | 48 | e.printStackTrace(); |
| 60 | return -1; | 49 | return -1; |
| @@ -63,6 +52,6 @@ public class MailUtils { | @@ -63,6 +52,6 @@ public class MailUtils { | ||
| 63 | } | 52 | } |
| 64 | 53 | ||
| 65 | public int sendMail(EmailBean mail){ | 54 | public int sendMail(EmailBean mail){ |
| 66 | - return sendMail(emailSendToAddress, mail); | 55 | + return sendMail(SystemParamCache.getMailAdmin(), mail); |
| 67 | } | 56 | } |
| 68 | } | 57 | } |
src/main/java/com/bsth/util/PrivilegeUtils.java
| 1 | package com.bsth.util; | 1 | package com.bsth.util; |
| 2 | 2 | ||
| 3 | -import com.bsth.common.Constants; | ||
| 4 | import com.bsth.common.SystemParamKeys; | 3 | import com.bsth.common.SystemParamKeys; |
| 5 | import com.bsth.data.BasicData; | 4 | import com.bsth.data.BasicData; |
| 5 | +import com.bsth.data.SystemParamCache; | ||
| 6 | import com.bsth.entity.SystemParam; | 6 | import com.bsth.entity.SystemParam; |
| 7 | import com.bsth.entity.sys.Role; | 7 | import com.bsth.entity.sys.Role; |
| 8 | import com.bsth.security.util.SecurityUtils; | 8 | import com.bsth.security.util.SecurityUtils; |
| @@ -16,11 +16,11 @@ public class PrivilegeUtils { | @@ -16,11 +16,11 @@ public class PrivilegeUtils { | ||
| 16 | 16 | ||
| 17 | public static int getHistoryEditDays() { | 17 | public static int getHistoryEditDays() { |
| 18 | Set<Role> roles = SecurityUtils.getCurrentUser().getRoles(); | 18 | Set<Role> roles = SecurityUtils.getCurrentUser().getRoles(); |
| 19 | - SystemParam param = BasicData.getSystemParam().get(SystemParamKeys.SPECIAL_ROLES); | 19 | + String specialRoles = SystemParamCache.getSpecialRoles(); |
| 20 | int days = 4; | 20 | int days = 4; |
| 21 | - if (param != null && param.getValue() != null) { | 21 | + if (specialRoles != null) { |
| 22 | for (Role role : roles) { | 22 | for (Role role : roles) { |
| 23 | - if (param.getValue().contains(String.format(",%s,", role.getCodeName()))) { | 23 | + if (specialRoles.contains(String.format(",%s,", role.getCodeName()))) { |
| 24 | days = 6; | 24 | days = 6; |
| 25 | } | 25 | } |
| 26 | } | 26 | } |
src/main/resources/application-cloud.properties
| @@ -40,34 +40,6 @@ spring.kafka.producer.acks= all | @@ -40,34 +40,6 @@ spring.kafka.producer.acks= all | ||
| 40 | spring.kafka.consumer.group-id= schedule-system | 40 | spring.kafka.consumer.group-id= schedule-system |
| 41 | spring.kafka.consumer.auto-offset-reset= latest | 41 | spring.kafka.consumer.auto-offset-reset= latest |
| 42 | 42 | ||
| 43 | -## gps client data | ||
| 44 | -http.gps.real.cache.url= http://10.10.150.24:12580/realGps/all | ||
| 45 | -## gateway real data | ||
| 46 | -http.gps.real.url= http://192.170.100.252:8080/transport_server/rtgps/ | ||
| 47 | -## gateway send directive | ||
| 48 | -http.send.directive = http://192.170.100.252:8080/transport_server/message/ | ||
| 49 | -## rfid data | ||
| 50 | -http.rfid.url= http://192.170.100.80:9000/rfid | ||
| 51 | -## wxsb | ||
| 52 | -http.report.url.05= http://116.228.197.222:8081/ygjwsystem_j2ee/clbx/clbx_dd.do | ||
| 53 | -http.report.url.22= http://116.247.73.122:9098/jgjwsystem_j2ee/clbx/clbx_dd.do | ||
| 54 | -http.report.url.26= http://116.236.141.34:8088/nhjwsystem_j2ee/clbx/clbx_dd.do | ||
| 55 | -http.report.url.55= http://180.168.216.248:8088/snjwsystem_j2ee/clbx/clbx_dd.do | ||
| 56 | -## http ticketing interface | ||
| 57 | -http.ticketing.interface= http://112.64.187.3:1080/gjService/request | ||
| 58 | -http.mtplan.interface= https://112.64.45.51/wxk-prod-api/service-api/pdgj/schedule/byinfo | ||
| 59 | -## first last generate | ||
| 60 | -ms.fl.generate=true | ||
| 61 | -## dsm ack interface | ||
| 62 | -dsm.ack.url= http://211.95.61.66:9008/modules/dsmCheckTheRecord/addDsm? | ||
| 63 | -## cp ack interface | ||
| 64 | -cp.ack.url= https://58.247.254.118:4003/prod-api/serverApi/instructionsIssue/confirm/ | ||
| 65 | -## admin mail | ||
| 66 | -admin.mail= 3090342880@qq.com | ||
| 67 | -## enabled | ||
| 68 | -enabled.whiteip= true | ||
| 69 | -enabled.authority= false | ||
| 70 | - | ||
| 71 | sso.enabled= true | 43 | sso.enabled= true |
| 72 | sso.systemcode = SYS0023 | 44 | sso.systemcode = SYS0023 |
| 73 | sso.http.url.login= https://112.64.45.51/portal/index.html#/login | 45 | sso.http.url.login= https://112.64.45.51/portal/index.html#/login |
src/main/resources/application-dev.properties
| @@ -45,29 +45,6 @@ spring.kafka.consumer.auto-offset-reset= latest | @@ -45,29 +45,6 @@ spring.kafka.consumer.auto-offset-reset= latest | ||
| 45 | spring.kafka.consumer.key-deserializer= org.apache.kafka.common.serialization.StringDeserializer | 45 | spring.kafka.consumer.key-deserializer= org.apache.kafka.common.serialization.StringDeserializer |
| 46 | spring.kafka.consumer.value-deserializer= org.apache.kafka.common.serialization.StringDeserializer | 46 | spring.kafka.consumer.value-deserializer= org.apache.kafka.common.serialization.StringDeserializer |
| 47 | 47 | ||
| 48 | -## gps client data | ||
| 49 | -http.gps.real.cache.url= http://10.10.150.24:12580/realGps/all | ||
| 50 | -## gateway real data | ||
| 51 | -http.gps.real.url= http://114.80.178.12:18080/transport_server/rtgps/ | ||
| 52 | -## gateway send directive | ||
| 53 | -http.send.directive = http://192.168.168.201:9090/transport_server/message/ | ||
| 54 | -## rfid data | ||
| 55 | -http.rfid.url= http://114.80.178.12:29000/rfid | ||
| 56 | -## http ticketing interface | ||
| 57 | -http.ticketing.interface= http://112.64.187.3:1080/gjService/request | ||
| 58 | -http.mtplan.interface= https://112.64.45.51/wxk-prod-api/service-api/pdgj/schedule/byinfo | ||
| 59 | -## first last generate | ||
| 60 | -ms.fl.generate=true | ||
| 61 | -## dsm ack interface | ||
| 62 | -dsm.ack.url= http://211.95.61.66:9008/modules/dsmCheckTheRecord/addDsm? | ||
| 63 | -## cp ack interface | ||
| 64 | -cp.ack.url= http://114.80.178.12:8778/prod-api/serverApi/instructionsIssue/confirm/ | ||
| 65 | -## admin mail | ||
| 66 | -admin.mail= 3090342880@qq.com | ||
| 67 | -## enabled | ||
| 68 | -enabled.whiteip= false | ||
| 69 | -enabled.authority= false | ||
| 70 | - | ||
| 71 | sso.enabled= false | 48 | sso.enabled= false |
| 72 | sso.systemcode = SYS0019 | 49 | sso.systemcode = SYS0019 |
| 73 | sso.http.url.login= http://180.169.154.251:28090/portal/index.html#/login | 50 | sso.http.url.login= http://180.169.154.251:28090/portal/index.html#/login |
src/main/resources/application-test.properties
| @@ -38,34 +38,6 @@ spring.kafka.consumer.auto-offset-reset= latest | @@ -38,34 +38,6 @@ spring.kafka.consumer.auto-offset-reset= latest | ||
| 38 | spring.kafka.consumer.key-deserializer= org.apache.kafka.common.serialization.StringDeserializer | 38 | spring.kafka.consumer.key-deserializer= org.apache.kafka.common.serialization.StringDeserializer |
| 39 | spring.kafka.consumer.value-deserializer= org.apache.kafka.common.serialization.StringDeserializer | 39 | spring.kafka.consumer.value-deserializer= org.apache.kafka.common.serialization.StringDeserializer |
| 40 | 40 | ||
| 41 | -## gps client data | ||
| 42 | -http.gps.real.cache.url= http://10.10.150.24:12580/realGps/all | ||
| 43 | -## gateway real data | ||
| 44 | -http.gps.real.url= http://192.170.100.252:8080/transport_server/rtgps/ | ||
| 45 | -## gateway send directive | ||
| 46 | -##http.send.directive = http://192.170.100.252:8080/transport_server/message/ | ||
| 47 | -## rfid data | ||
| 48 | -http.rfid.url= http://192.170.100.80:9000/rfid | ||
| 49 | -## wxsb | ||
| 50 | -http.report.url.05= http://116.228.197.222:8081/ygjwsystem_j2ee/clbx/clbx_dd.do | ||
| 51 | -http.report.url.22= http://116.247.73.122:9098/jgjwsystem_j2ee/clbx/clbx_dd.do | ||
| 52 | -http.report.url.26= http://116.236.141.34:8088/nhjwsystem_j2ee/clbx/clbx_dd.do | ||
| 53 | -http.report.url.55= http://180.168.216.248:8088/snjwsystem_j2ee/clbx/clbx_dd.do | ||
| 54 | -## http ticketing interface | ||
| 55 | -http.ticketing.interface= http://112.64.187.3:1080/gjService/request | ||
| 56 | -http.mtplan.interface= https://112.64.45.51/wxk-prod-api/service-api/pdgj/schedule/byinfo | ||
| 57 | -## first last generate | ||
| 58 | -ms.fl.generate=true | ||
| 59 | -## dsm ack interface | ||
| 60 | -dsm.ack.url= http://211.95.61.66:9008/modules/dsmCheckTheRecord/addDsm? | ||
| 61 | -## cp ack interface | ||
| 62 | -cp.ack.url= http://114.80.178.12:8778/prod-api/serverApi/instructionsIssue/confirm/ | ||
| 63 | -## admin mail | ||
| 64 | -admin.mail= 3090342880@qq.com | ||
| 65 | -## enabled | ||
| 66 | -enabled.whiteip= false | ||
| 67 | -enabled.authority= false | ||
| 68 | - | ||
| 69 | sso.enabled= true | 41 | sso.enabled= true |
| 70 | sso.systemcode = SYS0023 | 42 | sso.systemcode = SYS0023 |
| 71 | sso.http.url.login= https://112.64.45.51/portal/index.html#/login | 43 | sso.http.url.login= https://112.64.45.51/portal/index.html#/login |
src/main/resources/static/pages/base/carpark/edit.html
| 1 | -<!-- 编辑停车场 --> | ||
| 2 | -<div class="modal fade" id="editPoitsions_carpark_mobal" tabindex="-1" role="basic" aria-hidden="true"> | ||
| 3 | - <div class="modal-dialog"> | ||
| 4 | - <div class="modal-content"> | ||
| 5 | - <div class="modal-header"> | ||
| 6 | - <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button> | ||
| 7 | - <h4 class="modal-title">编辑停车场</h4> | ||
| 8 | - </div> | ||
| 9 | - <div class="modal-body"> | ||
| 10 | - | ||
| 11 | - <form class="form-horizontal" role="form" id="edit_carPark_form" action="/module" method="post"> | ||
| 12 | - | ||
| 13 | - <div class="alert alert-danger display-hide"> <button class="close" data-close="alert"></button> | ||
| 14 | - 您的输入有误,请检查下面的输入项 | ||
| 15 | - </div> | ||
| 16 | - <input type="hidden" name="id" id="idInput" /> | ||
| 17 | - <input type="hidden" name="bParkPoint" id="bParkPointInput" /> | ||
| 18 | - <input type="hidden" name="gParkPoint" id="gParkPointInput" /> | ||
| 19 | - <input type="hidden" name="dbType" id="dbTypeInput" value="b"/> | ||
| 20 | - <!-- 停车场名称 --> | ||
| 21 | - <div class="form-body"> | ||
| 22 | - <div class="form-group"> | ||
| 23 | - <label class="control-label col-md-3"> | ||
| 24 | - <span class="required"> * </span> 停车场名称 : | ||
| 25 | - </label> | ||
| 26 | - <div class="col-md-6"> | ||
| 27 | - <input type="text" class="form-control" name="parkName" id="parkNameInput" placeholder="请输入停车场名称"> | ||
| 28 | - </div> | ||
| 29 | - </div> | ||
| 30 | - </div> | ||
| 31 | - <!-- 停车场编码 --> | ||
| 32 | - <div class="form-body"> | ||
| 33 | - <div class="form-group"> | ||
| 34 | - <label class="control-label col-md-3"> | ||
| 35 | - <span class="required"> * </span>停车场编码 : | ||
| 36 | - </label> | ||
| 37 | - <div class="col-md-6"> | ||
| 38 | - <input type="text" class="form-control" name="parkCode" id="parkCodeInput" readonly="readonly" placeholder="请输入停车场编码"> | ||
| 39 | - </div> | ||
| 40 | - </div> | ||
| 41 | - </div> | ||
| 42 | - <!-- 经纬度坐标点 --> | ||
| 43 | - <div class="form-body"> | ||
| 44 | - <div class="form-group"> | ||
| 45 | - <label class="col-md-3 control-label"><span class="required"> * </span>经纬度坐标点:</label> | ||
| 46 | - <div class="col-md-6"> | ||
| 47 | - <input type="text" class="form-control" name="bCenterPoint" id="bCenterPointInput" readonly="readonly" placeholder="请输入经纬度坐标点"> | ||
| 48 | - </div> | ||
| 49 | - </div> | ||
| 50 | - </div> | ||
| 51 | - | ||
| 52 | - <!-- 几何图形类型 --> | ||
| 53 | - <div class="form-body"> | ||
| 54 | - <div class="form-group"> | ||
| 55 | - <label class="col-md-3 control-label"><span class="required"> * </span>几何图形类型:</label> | ||
| 56 | - <div class="col-md-6"> | ||
| 57 | - <input type="text" class="form-control" name="shapesType" id="shapesTypeSelect" readonly="readonly" placeholder="请输入几何图形类型"> | ||
| 58 | - </div> | ||
| 59 | - </div> | ||
| 60 | - </div> | ||
| 61 | - | ||
| 62 | - <!-- 圆形半径 --> | ||
| 63 | - <div class="form-body" id="radiusGroup"> | ||
| 64 | - <div class="form-group"> | ||
| 65 | - <label class="col-md-3 control-label"><span class="required"> * </span>圆形半径 :</label> | ||
| 66 | - <div class="col-md-6"> | ||
| 67 | - <input type="text" class="form-control" name="radius" id="radiusInput" placeholder="请输入圆形半径"> | ||
| 68 | - </div> | ||
| 69 | - </div> | ||
| 70 | - </div> | ||
| 71 | - <!-- 是否撤销 --> | ||
| 72 | - <div class="form-body"> | ||
| 73 | - <div class="form-group"> | ||
| 74 | - <label class="col-md-3 control-label"><span class="required"> * </span>是否撤销 :</label> | ||
| 75 | - <div class="col-md-6"> | ||
| 76 | - <select name="destroy" class="form-control" id="destroySelect"> | ||
| 77 | - <option value="">-- 请选择撤销类型 --</option> | ||
| 78 | - <option value="0">否</option> | ||
| 79 | - <option value="1">是</option> | ||
| 80 | - </select> | ||
| 81 | - </div> | ||
| 82 | - </div> | ||
| 83 | - </div> | ||
| 84 | - <!-- 面积 --> | ||
| 85 | - <div class="form-body"> | ||
| 86 | - <div class="form-group"> | ||
| 87 | - <label class="col-md-3 control-label">面积 :</label> | ||
| 88 | - <div class="col-md-6"> | ||
| 89 | - <input type="text" class="form-control" name="area" id="areaInput" > | ||
| 90 | - <span class="help-block">单位:平方米(㎡)</span> | ||
| 91 | - </div> | ||
| 92 | - </div> | ||
| 93 | - </div> | ||
| 94 | - | ||
| 95 | - <!-- 所属公司 --> | ||
| 96 | - <div class="form-body"> | ||
| 97 | - <div class="form-group"> | ||
| 98 | - <label class="col-md-3 control-label">所属公司 :</label> | ||
| 99 | - <div class="col-md-6"> | ||
| 100 | - <select name="company" class="form-control" style="width:100%" id="companySelect"> | ||
| 101 | - | ||
| 102 | - </select> | ||
| 103 | - </div> | ||
| 104 | - </div> | ||
| 105 | - </div> | ||
| 106 | - | ||
| 107 | - <!-- 所属分公司 --> | ||
| 108 | - <div class="form-body"> | ||
| 109 | - <div class="form-group"> | ||
| 110 | - <label class="col-md-3 control-label">所属分公司 :</label> | ||
| 111 | - <div class="col-md-6"> | ||
| 112 | - <select name="brancheCompany" class="form-control" style="width:100%" id="brancheCompanySelect"> | ||
| 113 | - </select> | ||
| 114 | - </div> | ||
| 115 | - </div> | ||
| 116 | - </div> | ||
| 117 | - | ||
| 118 | - <!-- 版本号 --> | ||
| 119 | - <div class="form-body"> | ||
| 120 | - <div class="form-group"> | ||
| 121 | - <label class="col-md-3 control-label">版本号 :</label> | ||
| 122 | - <div class="col-md-6"> | ||
| 123 | - <input type="text" class="form-control" name="versions" value='1' Readonly placeholder="请输入版本号"> | ||
| 124 | - </div> | ||
| 125 | - </div> | ||
| 126 | - </div> | ||
| 127 | - | ||
| 128 | - <!-- 描述/说明 --> | ||
| 129 | - <div class="form-group"> | ||
| 130 | - <label class="control-label col-md-3"> 描述/说明 : </label> | ||
| 131 | - <div class="col-md-6"> | ||
| 132 | - <textarea class="form-control" rows="3" name="descriptions" id="descriptionsTextarea" placeholder="请输入描述/说明"></textarea> | ||
| 133 | - </div> | ||
| 134 | - </div> | ||
| 135 | - </form> | ||
| 136 | - </div> | ||
| 137 | - <div class="modal-footer"> | ||
| 138 | - <button type="button" class="btn default" data-dismiss="modal">取消</button> | ||
| 139 | - <button type="button" class="btn btn-primary" id="editStationButton">提交数据</button> | ||
| 140 | - </div> | ||
| 141 | - </div> | ||
| 142 | - </div> | ||
| 143 | -</div> | ||
| 144 | -<script type="text/javascript"> | ||
| 145 | - | ||
| 146 | -$('#editPoitsions_carpark_mobal').on('editCarParkMobal_show', function(e, map,fun,carP,ajaxd){ | ||
| 147 | - /** 获取停车场信息对象 */ | ||
| 148 | - var CarParkObj = carP.getEitdCarPark(); | ||
| 149 | - // 获取修改停车场对象ID | ||
| 150 | - var carParkId = CarParkObj.carParkId; | ||
| 151 | - /** 根据修改停车场对象属性值 设值表单元素 @paran:<CarParkObj:停车场对象>*/ | ||
| 152 | - fun.setFormValue(CarParkObj); | ||
| 153 | - /** 填充公司下拉框 */ | ||
| 154 | - fun.selectTemp(function() { | ||
| 155 | - // 获取公司代码 | ||
| 156 | - var businessCode = CarParkObj.carParkCompany; | ||
| 157 | - // 获取公司元素并设值 | ||
| 158 | - $('#companySelect').val(businessCode); | ||
| 159 | - /** 填充分公司下拉框 @param:<businessCode:公司代码> */ | ||
| 160 | - fun.getbrancheCompanyValues(businessCode,function() { | ||
| 161 | - // 获取分公司元素并设值 | ||
| 162 | - $('#brancheCompanySelect').val(CarParkObj.carParkBrancheCompany); | ||
| 163 | - }); | ||
| 164 | - }); | ||
| 165 | - // 公司值改变事件 | ||
| 166 | - $('#companySelect').on('change',companySelectChangeSetBrancheValue); | ||
| 167 | - function companySelectChangeSetBrancheValue() { | ||
| 168 | - // 获取公司下拉框选择值 | ||
| 169 | - var businessCode = $('#companySelect').val(); | ||
| 170 | - // 分公司下拉框options属性值 | ||
| 171 | - var options = '<option value="">-- 请选择分公司 --</option>'; | ||
| 172 | - // 如果公司选择为空则分公司为空 ; 否则查询出所属公司下的分公司名称和相应分公司代码 | ||
| 173 | - if(businessCode == null || businessCode ==''){ | ||
| 174 | - // 填充分公司下拉框options | ||
| 175 | - $('#brancheCompanySelect').html(options); | ||
| 176 | - } else { | ||
| 177 | - // 查询出所属公司下的分公司名称和相应分公司代码 | ||
| 178 | - $get('/business/all', {upCode_eq: businessCode}, function(array){ | ||
| 179 | - // 遍历array | ||
| 180 | - $.each(array, function(i,d){ | ||
| 181 | - options += '<option value="'+d.businessCode+'">'+d.businessName+'</option>'; | ||
| 182 | - }); | ||
| 183 | - // 填充分公司下拉框options | ||
| 184 | - $('#brancheCompanySelect').html(options); | ||
| 185 | - }); | ||
| 186 | - } | ||
| 187 | - } | ||
| 188 | - // 显示mobal | ||
| 189 | - $('#editPoitsions_carpark_mobal').modal({show : true,backdrop: 'static',keyboard: false}); | ||
| 190 | - // 当调用 hide 实例方法时触发 | ||
| 191 | - $('#editPoitsions_carpark_mobal').on('hide.bs.modal', function () { | ||
| 192 | - clearSechear(); | ||
| 193 | - }); | ||
| 194 | - function clearSechear(){ | ||
| 195 | - map.clearMarkAndOverlays(); | ||
| 196 | - carP.setEitdCarPark({}); | ||
| 197 | - fun.initCarPark(carParkId); | ||
| 198 | - } | ||
| 199 | - // 编辑表单元素 | ||
| 200 | - var form = $('#edit_carPark_form'); | ||
| 201 | - // 获取错误提示元素 | ||
| 202 | - var error = $('.alert-danger', form); | ||
| 203 | - // 提交数据按钮事件 | ||
| 204 | - $('#editStationButton').on('click', function() { | ||
| 205 | - // 表单提交 | ||
| 206 | - form.submit(); | ||
| 207 | - }); | ||
| 208 | - // 表单验证 | ||
| 209 | - form.validate({ | ||
| 210 | - | ||
| 211 | - errorElement : 'span', | ||
| 212 | - | ||
| 213 | - errorClass : 'help-block help-block-error', | ||
| 214 | - | ||
| 215 | - focusInvalid : false, | ||
| 216 | - | ||
| 217 | - rules : { | ||
| 218 | - 'parkName' : {required : true,},// 停车场名称 必填项 | ||
| 219 | - 'parkCode' : {required : true},// 停车场编码 必填项 | ||
| 220 | - 'bCenterPoint' : {required : true,},// 经纬度坐标点 必填项 | ||
| 221 | - 'shapesType' : {required : true,},// 几何图形类型 必填项 | ||
| 222 | - 'radius' : {required : true,digits:true},// 圆形半径 必填项 | ||
| 223 | - 'destroy' : {required : true,},// 是否撤销 必填项 | ||
| 224 | - 'area' : {number:true,},// 面积 数字 | ||
| 225 | - 'descriptions' : {maxlength: 200,},// 描述/说明 最大长度200 | ||
| 226 | - }, | ||
| 227 | - invalidHandler : function(event, validator) { | ||
| 228 | - error.show(); | ||
| 229 | - App.scrollTo(error, -200); | ||
| 230 | - }, | ||
| 231 | - highlight : function(element) { | ||
| 232 | - $(element).closest('.form-group').addClass('has-error'); | ||
| 233 | - }, | ||
| 234 | - unhighlight : function(element) { | ||
| 235 | - $(element).closest('.form-group').removeClass('has-error'); | ||
| 236 | - }, | ||
| 237 | - success : function(label) { | ||
| 238 | - label.closest('.form-group').removeClass('has-error'); | ||
| 239 | - }, | ||
| 240 | - submitHandler : function(f) { | ||
| 241 | - var params = form.serializeJSON(); | ||
| 242 | - params.createBy = CarParkObj.carParkCreateBy; | ||
| 243 | - // 定义日期格式 | ||
| 244 | - var fs = 'YYYY-MM-DD HH:mm:ss' | ||
| 245 | - // 设置日期 | ||
| 246 | - params.createDate = moment(CarParkObj.carParkCreateDate).format(fs); | ||
| 247 | - error.hide(); | ||
| 248 | - if(params.shapesType=='多边形') | ||
| 249 | - params.shapesType = 'd'; | ||
| 250 | - else if(params.shapesType=='圆形') | ||
| 251 | - params.shapesType=='r'; | ||
| 252 | - ajaxd.carParkUpdate(params,function(resuntDate) { | ||
| 253 | - if(resuntDate.status=='SUCCESS') { | ||
| 254 | - // 弹出添加成功提示消息 | ||
| 255 | - layer.msg('修改成功...'); | ||
| 256 | - }else { | ||
| 257 | - // 弹出添加失败提示消息 | ||
| 258 | - layer.msg('修改失败...'); | ||
| 259 | - } | ||
| 260 | - clearSechear(); | ||
| 261 | - $('#editPoitsions_carpark_mobal').modal('hide'); | ||
| 262 | - }) | ||
| 263 | - } | ||
| 264 | - }); | 1 | +<!-- 编辑停车场 --> |
| 2 | +<div class="modal fade" id="editPoitsions_carpark_mobal" tabindex="-1" role="basic" aria-hidden="true"> | ||
| 3 | + <div class="modal-dialog"> | ||
| 4 | + <div class="modal-content"> | ||
| 5 | + <div class="modal-header"> | ||
| 6 | + <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button> | ||
| 7 | + <h4 class="modal-title">编辑停车场</h4> | ||
| 8 | + </div> | ||
| 9 | + <div class="modal-body"> | ||
| 10 | + | ||
| 11 | + <form class="form-horizontal" role="form" id="edit_carPark_form" action="/module" method="post"> | ||
| 12 | + | ||
| 13 | + <div class="alert alert-danger display-hide"> <button class="close" data-close="alert"></button> | ||
| 14 | + 您的输入有误,请检查下面的输入项 | ||
| 15 | + </div> | ||
| 16 | + <input type="hidden" name="id" id="idInput" /> | ||
| 17 | + <input type="hidden" name="bParkPoint" id="bParkPointInput" /> | ||
| 18 | + <input type="hidden" name="gParkPoint" id="gParkPointInput" /> | ||
| 19 | + <input type="hidden" name="createBy" value="35" /> | ||
| 20 | + <input type="hidden" name="dbType" id="dbTypeInput" value="b"/> | ||
| 21 | + <!-- 停车场名称 --> | ||
| 22 | + <div class="form-body"> | ||
| 23 | + <div class="form-group"> | ||
| 24 | + <label class="control-label col-md-3"> | ||
| 25 | + <span class="required"> * </span> 停车场名称 : | ||
| 26 | + </label> | ||
| 27 | + <div class="col-md-6"> | ||
| 28 | + <input type="text" class="form-control" name="parkName" id="parkNameInput" placeholder="请输入停车场名称"> | ||
| 29 | + </div> | ||
| 30 | + </div> | ||
| 31 | + </div> | ||
| 32 | + <!-- 停车场编码 --> | ||
| 33 | + <div class="form-body"> | ||
| 34 | + <div class="form-group"> | ||
| 35 | + <label class="control-label col-md-3"> | ||
| 36 | + <span class="required"> * </span>停车场编码 : | ||
| 37 | + </label> | ||
| 38 | + <div class="col-md-6"> | ||
| 39 | + <input type="text" class="form-control" name="parkCode" id="parkCodeInput" readonly="readonly" placeholder="请输入停车场编码"> | ||
| 40 | + </div> | ||
| 41 | + </div> | ||
| 42 | + </div> | ||
| 43 | + <!-- 经纬度坐标点 --> | ||
| 44 | + <div class="form-body"> | ||
| 45 | + <div class="form-group"> | ||
| 46 | + <label class="col-md-3 control-label"><span class="required"> * </span>经纬度坐标点:</label> | ||
| 47 | + <div class="col-md-6"> | ||
| 48 | + <input type="text" class="form-control" name="bCenterPoint" id="bCenterPointInput" readonly="readonly" placeholder="请输入经纬度坐标点"> | ||
| 49 | + </div> | ||
| 50 | + </div> | ||
| 51 | + </div> | ||
| 52 | + | ||
| 53 | + <!-- 几何图形类型 --> | ||
| 54 | + <div class="form-body"> | ||
| 55 | + <div class="form-group"> | ||
| 56 | + <label class="col-md-3 control-label"><span class="required"> * </span>几何图形类型:</label> | ||
| 57 | + <div class="col-md-6"> | ||
| 58 | + <input type="text" class="form-control" name="shapesType" id="shapesTypeSelect" readonly="readonly" placeholder="请输入几何图形类型"> | ||
| 59 | + </div> | ||
| 60 | + </div> | ||
| 61 | + </div> | ||
| 62 | + | ||
| 63 | + <!-- 圆形半径 --> | ||
| 64 | + <div class="form-body" id="radiusGroup"> | ||
| 65 | + <div class="form-group"> | ||
| 66 | + <label class="col-md-3 control-label"><span class="required"> * </span>圆形半径 :</label> | ||
| 67 | + <div class="col-md-6"> | ||
| 68 | + <input type="text" class="form-control" name="radius" id="radiusInput" placeholder="请输入圆形半径"> | ||
| 69 | + </div> | ||
| 70 | + </div> | ||
| 71 | + </div> | ||
| 72 | + <!-- 是否撤销 --> | ||
| 73 | + <div class="form-body"> | ||
| 74 | + <div class="form-group"> | ||
| 75 | + <label class="col-md-3 control-label"><span class="required"> * </span>是否撤销 :</label> | ||
| 76 | + <div class="col-md-6"> | ||
| 77 | + <select name="destroy" class="form-control" id="destroySelect"> | ||
| 78 | + <option value="">-- 请选择撤销类型 --</option> | ||
| 79 | + <option value="0">否</option> | ||
| 80 | + <option value="1">是</option> | ||
| 81 | + </select> | ||
| 82 | + </div> | ||
| 83 | + </div> | ||
| 84 | + </div> | ||
| 85 | + <!-- 面积 --> | ||
| 86 | + <div class="form-body"> | ||
| 87 | + <div class="form-group"> | ||
| 88 | + <label class="col-md-3 control-label">面积 :</label> | ||
| 89 | + <div class="col-md-6"> | ||
| 90 | + <input type="text" class="form-control" name="area" id="areaInput" > | ||
| 91 | + <span class="help-block">单位:平方米(㎡)</span> | ||
| 92 | + </div> | ||
| 93 | + </div> | ||
| 94 | + </div> | ||
| 95 | + | ||
| 96 | + <!-- 所属公司 --> | ||
| 97 | + <div class="form-body"> | ||
| 98 | + <div class="form-group"> | ||
| 99 | + <label class="col-md-3 control-label">所属公司 :</label> | ||
| 100 | + <div class="col-md-6"> | ||
| 101 | + <select name="company" class="form-control" style="width:100%" id="companySelect"> | ||
| 102 | + | ||
| 103 | + </select> | ||
| 104 | + </div> | ||
| 105 | + </div> | ||
| 106 | + </div> | ||
| 107 | + | ||
| 108 | + <!-- 所属分公司 --> | ||
| 109 | + <div class="form-body"> | ||
| 110 | + <div class="form-group"> | ||
| 111 | + <label class="col-md-3 control-label">所属分公司 :</label> | ||
| 112 | + <div class="col-md-6"> | ||
| 113 | + <select name="brancheCompany" class="form-control" style="width:100%" id="brancheCompanySelect"> | ||
| 114 | + </select> | ||
| 115 | + </div> | ||
| 116 | + </div> | ||
| 117 | + </div> | ||
| 118 | + | ||
| 119 | + <!-- 版本号 --> | ||
| 120 | + <div class="form-body"> | ||
| 121 | + <div class="form-group"> | ||
| 122 | + <label class="col-md-3 control-label">版本号 :</label> | ||
| 123 | + <div class="col-md-6"> | ||
| 124 | + <input type="text" class="form-control" name="versions" value='1' Readonly placeholder="请输入版本号"> | ||
| 125 | + </div> | ||
| 126 | + </div> | ||
| 127 | + </div> | ||
| 128 | + | ||
| 129 | + <!-- 描述/说明 --> | ||
| 130 | + <div class="form-group"> | ||
| 131 | + <label class="control-label col-md-3"> 描述/说明 : </label> | ||
| 132 | + <div class="col-md-6"> | ||
| 133 | + <textarea class="form-control" rows="3" name="descriptions" id="descriptionsTextarea" placeholder="请输入描述/说明"></textarea> | ||
| 134 | + </div> | ||
| 135 | + </div> | ||
| 136 | + </form> | ||
| 137 | + </div> | ||
| 138 | + <div class="modal-footer"> | ||
| 139 | + <button type="button" class="btn default" data-dismiss="modal">取消</button> | ||
| 140 | + <button type="button" class="btn btn-primary" id="editStationButton">提交数据</button> | ||
| 141 | + </div> | ||
| 142 | + </div> | ||
| 143 | + </div> | ||
| 144 | +</div> | ||
| 145 | +<script type="text/javascript"> | ||
| 146 | + | ||
| 147 | +$('#editPoitsions_carpark_mobal').on('editCarParkMobal_show', function(e, map,fun,carP,ajaxd){ | ||
| 148 | + /** 获取停车场信息对象 */ | ||
| 149 | + var CarParkObj = carP.getEitdCarPark(); | ||
| 150 | + // 获取修改停车场对象ID | ||
| 151 | + var carParkId = CarParkObj.carParkId; | ||
| 152 | + /** 根据修改停车场对象属性值 设值表单元素 @paran:<CarParkObj:停车场对象>*/ | ||
| 153 | + fun.setFormValue(CarParkObj); | ||
| 154 | + /** 填充公司下拉框 */ | ||
| 155 | + fun.selectTemp(function() { | ||
| 156 | + // 获取公司代码 | ||
| 157 | + var businessCode = CarParkObj.carParkCompany; | ||
| 158 | + // 获取公司元素并设值 | ||
| 159 | + $('#companySelect').val(businessCode); | ||
| 160 | + /** 填充分公司下拉框 @param:<businessCode:公司代码> */ | ||
| 161 | + fun.getbrancheCompanyValues(businessCode,function() { | ||
| 162 | + // 获取分公司元素并设值 | ||
| 163 | + $('#brancheCompanySelect').val(CarParkObj.carParkBrancheCompany); | ||
| 164 | + }); | ||
| 165 | + }); | ||
| 166 | + // 公司值改变事件 | ||
| 167 | + $('#companySelect').on('change',companySelectChangeSetBrancheValue); | ||
| 168 | + function companySelectChangeSetBrancheValue() { | ||
| 169 | + // 获取公司下拉框选择值 | ||
| 170 | + var businessCode = $('#companySelect').val(); | ||
| 171 | + // 分公司下拉框options属性值 | ||
| 172 | + var options = '<option value="">-- 请选择分公司 --</option>'; | ||
| 173 | + // 如果公司选择为空则分公司为空 ; 否则查询出所属公司下的分公司名称和相应分公司代码 | ||
| 174 | + if(businessCode == null || businessCode ==''){ | ||
| 175 | + // 填充分公司下拉框options | ||
| 176 | + $('#brancheCompanySelect').html(options); | ||
| 177 | + } else { | ||
| 178 | + // 查询出所属公司下的分公司名称和相应分公司代码 | ||
| 179 | + $get('/business/all', {upCode_eq: businessCode}, function(array){ | ||
| 180 | + // 遍历array | ||
| 181 | + $.each(array, function(i,d){ | ||
| 182 | + options += '<option value="'+d.businessCode+'">'+d.businessName+'</option>'; | ||
| 183 | + }); | ||
| 184 | + // 填充分公司下拉框options | ||
| 185 | + $('#brancheCompanySelect').html(options); | ||
| 186 | + }); | ||
| 187 | + } | ||
| 188 | + } | ||
| 189 | + // 显示mobal | ||
| 190 | + $('#editPoitsions_carpark_mobal').modal({show : true,backdrop: 'static',keyboard: false}); | ||
| 191 | + // 当调用 hide 实例方法时触发 | ||
| 192 | + $('#editPoitsions_carpark_mobal').on('hide.bs.modal', function () { | ||
| 193 | + clearSechear(); | ||
| 194 | + }); | ||
| 195 | + function clearSechear(){ | ||
| 196 | + map.clearMarkAndOverlays(); | ||
| 197 | + carP.setEitdCarPark({}); | ||
| 198 | + fun.initCarPark(carParkId); | ||
| 199 | + } | ||
| 200 | + // 编辑表单元素 | ||
| 201 | + var form = $('#edit_carPark_form'); | ||
| 202 | + // 获取错误提示元素 | ||
| 203 | + var error = $('.alert-danger', form); | ||
| 204 | + // 提交数据按钮事件 | ||
| 205 | + $('#editStationButton').on('click', function() { | ||
| 206 | + // 表单提交 | ||
| 207 | + form.submit(); | ||
| 208 | + }); | ||
| 209 | + // 表单验证 | ||
| 210 | + form.validate({ | ||
| 211 | + | ||
| 212 | + errorElement : 'span', | ||
| 213 | + | ||
| 214 | + errorClass : 'help-block help-block-error', | ||
| 215 | + | ||
| 216 | + focusInvalid : false, | ||
| 217 | + | ||
| 218 | + rules : { | ||
| 219 | + 'parkName' : {required : true,},// 停车场名称 必填项 | ||
| 220 | + 'parkCode' : {required : true},// 停车场编码 必填项 | ||
| 221 | + 'bCenterPoint' : {required : true,},// 经纬度坐标点 必填项 | ||
| 222 | + 'shapesType' : {required : true,},// 几何图形类型 必填项 | ||
| 223 | + 'radius' : {required : true,digits:true},// 圆形半径 必填项 | ||
| 224 | + 'destroy' : {required : true,},// 是否撤销 必填项 | ||
| 225 | + 'area' : {number:true,},// 面积 数字 | ||
| 226 | + 'descriptions' : {maxlength: 200,},// 描述/说明 最大长度200 | ||
| 227 | + }, | ||
| 228 | + invalidHandler : function(event, validator) { | ||
| 229 | + error.show(); | ||
| 230 | + App.scrollTo(error, -200); | ||
| 231 | + }, | ||
| 232 | + highlight : function(element) { | ||
| 233 | + $(element).closest('.form-group').addClass('has-error'); | ||
| 234 | + }, | ||
| 235 | + unhighlight : function(element) { | ||
| 236 | + $(element).closest('.form-group').removeClass('has-error'); | ||
| 237 | + }, | ||
| 238 | + success : function(label) { | ||
| 239 | + label.closest('.form-group').removeClass('has-error'); | ||
| 240 | + }, | ||
| 241 | + submitHandler : function(f) { | ||
| 242 | + var params = form.serializeJSON(); | ||
| 243 | + params.createBy = CarParkObj.carParkCreateBy; | ||
| 244 | + // 定义日期格式 | ||
| 245 | + var fs = 'YYYY-MM-DD HH:mm:ss' | ||
| 246 | + // 设置日期 | ||
| 247 | + params.createDate = moment(CarParkObj.carParkCreateDate).format(fs); | ||
| 248 | + error.hide(); | ||
| 249 | + if(params.shapesType=='多边形') | ||
| 250 | + params.shapesType = 'd'; | ||
| 251 | + else if(params.shapesType=='圆形') | ||
| 252 | + params.shapesType=='r'; | ||
| 253 | + ajaxd.carParkUpdate(params,function(resuntDate) { | ||
| 254 | + if(resuntDate.status=='SUCCESS') { | ||
| 255 | + // 弹出添加成功提示消息 | ||
| 256 | + layer.msg('修改成功...'); | ||
| 257 | + }else { | ||
| 258 | + // 弹出添加失败提示消息 | ||
| 259 | + layer.msg('修改失败...'); | ||
| 260 | + } | ||
| 261 | + clearSechear(); | ||
| 262 | + $('#editPoitsions_carpark_mobal').modal('hide'); | ||
| 263 | + }) | ||
| 264 | + } | ||
| 265 | + }); | ||
| 265 | }); | 266 | }); |
| 266 | </script> | 267 | </script> |
| 267 | \ No newline at end of file | 268 | \ No newline at end of file |
src/main/resources/static/pages/base/section/js/section-operation.js
| @@ -93,8 +93,8 @@ var SectionOperation = function () { | @@ -93,8 +93,8 @@ var SectionOperation = function () { | ||
| 93 | html.push('<span class="help-block" style="color:#DDD;font-size: 15px;">南北向:');html.push((section.snDirection === undefined ? '' : section.snDirection == 0 ? '南->北' : '北->南'));html.push('</span>'); | 93 | html.push('<span class="help-block" style="color:#DDD;font-size: 15px;">南北向:');html.push((section.snDirection === undefined ? '' : section.snDirection == 0 ? '南->北' : '北->南'));html.push('</span>'); |
| 94 | html.push('<span class="help-block" style="color:#DDD;font-size: 15px;">路段限速:');html.push(section.speedLimit);html.push('</span>'); | 94 | html.push('<span class="help-block" style="color:#DDD;font-size: 15px;">路段限速:');html.push(section.speedLimit);html.push('</span>'); |
| 95 | html.push('<span class="help-block" style="color:#DDD;font-size: 15px;">路段长度:');html.push(section.sectionDistance);html.push('</span>'); | 95 | html.push('<span class="help-block" style="color:#DDD;font-size: 15px;">路段长度:');html.push(section.sectionDistance);html.push('</span>'); |
| 96 | - html.push('<button class="info_win_btn" onclick="SectionOperation.editSection(');html.push(section.id);html.push(');">修改路段信息</button>'); | ||
| 97 | - html.push('<button class="info_win_btn" onclick="SectionOperation.editPolyline(');html.push(section.id);html.push(');">移动路段位置</button>'); | 96 | + html.push('<button id="editSectionInfo" class="info_win_btn">修改路段信息</button>'); |
| 97 | + html.push('<button id="movePolyline" class="info_win_btn">移动路段位置</button>'); | ||
| 98 | 98 | ||
| 99 | var infoWindow = new BMap.InfoWindow(html.join(''), opts); | 99 | var infoWindow = new BMap.InfoWindow(html.join(''), opts); |
| 100 | var icon = new BMap.Icon('/pages/base/stationroute/css/img/blank.gif', new BMap.Size(20, 20)); | 100 | var icon = new BMap.Icon('/pages/base/stationroute/css/img/blank.gif', new BMap.Size(20, 20)); |
| @@ -110,6 +110,12 @@ var SectionOperation = function () { | @@ -110,6 +110,12 @@ var SectionOperation = function () { | ||
| 110 | map.addOverlay(marker); | 110 | map.addOverlay(marker); |
| 111 | marker.setPosition(path[Math.ceil(path.length / 2)]); | 111 | marker.setPosition(path[Math.ceil(path.length / 2)]); |
| 112 | marker.openInfoWindow(infoWindow); | 112 | marker.openInfoWindow(infoWindow); |
| 113 | + $('#editSectionInfo').on('click', function() { | ||
| 114 | + operation.editSection(section.id); | ||
| 115 | + }); | ||
| 116 | + $('#movePolyline').on('click', function() { | ||
| 117 | + operation.editPolyline(section.id); | ||
| 118 | + }); | ||
| 113 | }); | 119 | }); |
| 114 | }, | 120 | }, |
| 115 | editPolyline : function(sectionId) { | 121 | editPolyline : function(sectionId) { |
src/main/resources/static/pages/base/station/js/station-positions-function.js
| @@ -24,8 +24,8 @@ var PositionsPublicFunctions = function () { | @@ -24,8 +24,8 @@ var PositionsPublicFunctions = function () { | ||
| 24 | html.push('<span class="help-block" style="color:#DDD;font-size: 15px;">南北向:');html.push(station.snDirection === undefined ? '' : station.snDirection == 0 ? '南->北' : '北->南');html.push('</span>'); | 24 | html.push('<span class="help-block" style="color:#DDD;font-size: 15px;">南北向:');html.push(station.snDirection === undefined ? '' : station.snDirection == 0 ? '南->北' : '北->南');html.push('</span>'); |
| 25 | html.push('<span class="help-block" style="color:#DDD;font-size: 15px;">路段编码:');html.push(station.roadCoding ? station.roadCoding : '');html.push('</span>'); | 25 | html.push('<span class="help-block" style="color:#DDD;font-size: 15px;">路段编码:');html.push(station.roadCoding ? station.roadCoding : '');html.push('</span>'); |
| 26 | html.push('<span class="help-block" style="color:#DDD;font-size: 15px;">地址:');html.push(station.address);html.push('</span>'); | 26 | html.push('<span class="help-block" style="color:#DDD;font-size: 15px;">地址:');html.push(station.address);html.push('</span>'); |
| 27 | - html.push('<button class="info_win_btn" onclick="StationPositionsWorldsBMap.editStation(');html.push(station.id);html.push(');">修改站点信息</button>'); | ||
| 28 | - html.push('<button class="info_win_btn" onclick="StationPositionsWorldsBMap.setDragEnable(true);">移动中心点</button>'); | 27 | + html.push('<button id="editStationInfo" class="info_win_btn">修改站点信息</button>'); |
| 28 | + html.push('<button id="moveCenterPoint" class="info_win_btn">移动中心点</button>'); | ||
| 29 | // 信息窗口参数属性 | 29 | // 信息窗口参数属性 |
| 30 | var opts = { | 30 | var opts = { |
| 31 | // 信息窗口宽度 | 31 | // 信息窗口宽度 |
src/main/resources/static/pages/base/station/js/station-positions-map.js
| @@ -67,6 +67,12 @@ var StationPositionsWorldsBMap = function () { | @@ -67,6 +67,12 @@ var StationPositionsWorldsBMap = function () { | ||
| 67 | marker.addEventListener("click",function() { | 67 | marker.addEventListener("click",function() { |
| 68 | //开启信息窗口 | 68 | //开启信息窗口 |
| 69 | marker.openInfoWindow(infoWindow, station.point); | 69 | marker.openInfoWindow(infoWindow, station.point); |
| 70 | + $('#editStationInfo').on('click', function() { | ||
| 71 | + StationPositionsWorldsBMap.editStation(station.id); | ||
| 72 | + }); | ||
| 73 | + $('#moveCenterPoint').on('click', function() { | ||
| 74 | + StationPositionsWorldsBMap.setDragEnable(true); | ||
| 75 | + }); | ||
| 70 | }); | 76 | }); |
| 71 | }, | 77 | }, |
| 72 | // 定位 | 78 | // 定位 |
src/main/resources/static/pages/base/stationroute/js/routes-operation.js
| @@ -419,8 +419,9 @@ var RoutesOperation = (function () { | @@ -419,8 +419,9 @@ var RoutesOperation = (function () { | ||
| 419 | 419 | ||
| 420 | if(status > 0){ | 420 | if(status > 0){ |
| 421 | htm += '<div>' + | 421 | htm += '<div>' + |
| 422 | - '<button class="info_win_btn" id="editStation" onclick="RoutesOperation.editStation(' + stationRoute.id+','+stationRoute.directions + ')">修改</button>' + | ||
| 423 | - '<button class="info_win_btn" onclick="RoutesOperation.destroyStation('+ stationRoute.id + ','+stationRoute.line.id+','+stationRoute.directions+')">撤销</button>'; | 422 | + '<button class="info_win_btn" onclick="RoutesOperation.editStation(' + stationRoute.id+','+stationRoute.directions + ')">修改</button>' + |
| 423 | + '<button class="info_win_btn" onclick="RoutesOperation.destroyStation('+ stationRoute.id + ','+stationRoute.line.id+','+stationRoute.directions+')">撤销</button>' + | ||
| 424 | + '<button class="info_win_btn" onclick="RoutesOperation.editCenterPoint(' + stationRoute.id+','+stationRoute.directions + ')">站级中心点</button>'; | ||
| 424 | if (stationRoute.stationMark == 'E') { | 425 | if (stationRoute.stationMark == 'E') { |
| 425 | htm += '<button class="info_win_btn" onclick="RoutesOperation.geoPremise(' + stationRoute.id + ')">前置电子围栏</button></div>'; | 426 | htm += '<button class="info_win_btn" onclick="RoutesOperation.geoPremise(' + stationRoute.id + ')">前置电子围栏</button></div>'; |
| 426 | } else { | 427 | } else { |
| @@ -912,6 +913,37 @@ var RoutesOperation = (function () { | @@ -912,6 +913,37 @@ var RoutesOperation = (function () { | ||
| 912 | }); | 913 | }); |
| 913 | busline.getBusList(lineName); | 914 | busline.getBusList(lineName); |
| 914 | }, | 915 | }, |
| 916 | + | ||
| 917 | + /** | ||
| 918 | + * 移动站级中心点 | ||
| 919 | + * @param stationRouteId | ||
| 920 | + */ | ||
| 921 | + editCenterPoint: function (stationRouteId) { | ||
| 922 | + jQuery.extend(true, editStationRoute, stationArray[stationRouteId]); | ||
| 923 | + var centerPointWkt = editStationRoute.centerPointWkt; | ||
| 924 | + if (!centerPointWkt) { | ||
| 925 | + centerPointWkt = editStationRoute.station.centerPointWkt; | ||
| 926 | + } | ||
| 927 | + centerPointWkt = centerPointWkt.substring(6, centerPointWkt.length - 1); | ||
| 928 | + var coordindates = centerPointWkt.split(" ") | ||
| 929 | + var marker = new BMap.Marker(new BMap.Point(coordindates[0], coordindates[1]), {enableDragging: true}); | ||
| 930 | + operation.clearMarkAndOverlays(); | ||
| 931 | + baiduMap.addOverlay(marker); | ||
| 932 | + marker.setTop(true); | ||
| 933 | + marker.addEventListener('rightclick', operation.confirmCenterPoint); | ||
| 934 | + layer.msg('拖动站点至相应位置,然后右击确定中心点!'); | ||
| 935 | + }, | ||
| 936 | + | ||
| 937 | + confirmCenterPoint: function(event) { | ||
| 938 | + var marker = event.target, point = marker.point, centerPointWkt = 'POINT(' + point.lng + ' ' + point.lat + ')'; | ||
| 939 | + marker.removeEventListener('rightclick', operation.confirmCenterPoint); | ||
| 940 | + RoutesService.modifyStationRoute({id: editStationRoute.id, 'line.id': lineId, versions: versions, 'station.id': editStationRoute.station.id, centerPointWkt: centerPointWkt}, function() { | ||
| 941 | + stationArray[editStationRoute.id].centerPointWkt = centerPointWkt; | ||
| 942 | + layer.msg('站级中心点设置成功!'); | ||
| 943 | + RoutesOperation.resjtreeDate(lineId, directions, versions); | ||
| 944 | + }) | ||
| 945 | + }, | ||
| 946 | + | ||
| 915 | /** | 947 | /** |
| 916 | * 编辑站点路由 | 948 | * 编辑站点路由 |
| 917 | * @param stationRouteId | 949 | * @param stationRouteId |