Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cloud-platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
youjj
cloud-platform
Commits
761b2770
Commit
761b2770
authored
Apr 18, 2019
by
youjj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
聚合数据,车辆违章查询相关
parent
68e23f6b
Changes
24
Hide whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
863 additions
and
6 deletions
+863
-6
pom.xml
pom.xml
+2
-0
MemberInfoVo.java
...er-api/src/main/java/com/xxfc/member/vo/MemberInfoVo.java
+0
-3
MemberInfoService.java
.../main/java/com/xxfc/member/service/MemberInfoService.java
+0
-1
MemberInfoControllerTest.java
.../com/xxfc/member/controller/MemberInfoControllerTest.java
+0
-2
pom.xml
xx-third-party-api/pom.xml
+36
-0
ITrafficViolationsService.java
...va/com/xxfc/thirdparty/api/ITrafficViolationsService.java
+46
-0
JuheCarPreInfo.java
...c/main/java/com/xxfc/thirdparty/model/JuheCarPreInfo.java
+18
-0
JuheResult.java
...i/src/main/java/com/xxfc/thirdparty/model/JuheResult.java
+11
-0
JuheTrafficViolationsBalanceInfo.java
...fc/thirdparty/model/JuheTrafficViolationsBalanceInfo.java
+11
-0
JuheTrafficViolationsCityInfo.java
.../xxfc/thirdparty/model/JuheTrafficViolationsCityInfo.java
+16
-0
JuheTrafficViolationsInfo.java
.../com/xxfc/thirdparty/model/JuheTrafficViolationsInfo.java
+33
-0
JuheTrafficViolationsInfoItem.java
.../xxfc/thirdparty/model/JuheTrafficViolationsInfoItem.java
+19
-0
JuheTrafficViolationsProvinceInfo.java
...c/thirdparty/model/JuheTrafficViolationsProvinceInfo.java
+12
-0
pom.xml
xx-third-party/pom.xml
+151
-0
ThirdPartyApplication.java
.../main/java/com/xxfc/thirdparty/ThirdPartyApplication.java
+23
-0
RestConfiguration.java
...in/java/com/xxfc/thirdparty/config/RestConfiguration.java
+13
-0
WebConfiguration.java
...ain/java/com/xxfc/thirdparty/config/WebConfiguration.java
+54
-0
TrafficViolationsController.java
...fc/thirdparty/controller/TrafficViolationsController.java
+43
-0
TrafficViolationsService.java
...com/xxfc/thirdparty/service/TrafficViolationsService.java
+112
-0
application.yml
xx-third-party/src/main/resources/application.yml
+139
-0
bootstrap.yml
xx-third-party/src/main/resources/bootstrap.yml
+11
-0
mybatis-generator.xml
...rd-party/src/main/resources/builder/mybatis-generator.xml
+59
-0
ThirdPartyApplicationTests.java
.../java/com/xxfc/thirdparty/ThirdPartyApplicationTests.java
+11
-0
TrafficViolationsServiceTest.java
...xxfc/thirdparty/service/TrafficViolationsServiceTest.java
+43
-0
No files found.
pom.xml
View file @
761b2770
...
@@ -38,6 +38,8 @@
...
@@ -38,6 +38,8 @@
<module>
ace-modules
</module>
<module>
ace-modules
</module>
<module>
xx-member
</module>
<module>
xx-member
</module>
<module>
xx-member-api
</module>
<module>
xx-member-api
</module>
<module>
xx-third-party
</module>
<module>
xx-third-party-api
</module>
</modules>
</modules>
<packaging>
pom
</packaging>
<packaging>
pom
</packaging>
<developers>
<developers>
...
...
xx-member-api/src/main/java/com/xxfc/member/vo/MemberInfoVo.java
View file @
761b2770
package
com
.
xxfc
.
member
.
vo
;
package
com
.
xxfc
.
member
.
vo
;
import
com.fasterxml.jackson.annotation.JsonFilter
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
lombok.Data
;
import
lombok.Data
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
javax.persistence.Column
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
...
...
xx-member/src/main/java/com/xxfc/member/service/MemberInfoService.java
View file @
761b2770
...
@@ -11,7 +11,6 @@ import com.xxfc.member.mapper.MemberFamilyInfoMapper;
...
@@ -11,7 +11,6 @@ import com.xxfc.member.mapper.MemberFamilyInfoMapper;
import
com.xxfc.member.mapper.MemberInfoMapper
;
import
com.xxfc.member.mapper.MemberInfoMapper
;
import
com.xxfc.member.vo.MemberFamilyInfoVo
;
import
com.xxfc.member.vo.MemberFamilyInfoVo
;
import
com.xxfc.member.vo.MemberInfoVo
;
import
com.xxfc.member.vo.MemberInfoVo
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
...
xx-member/src/test/java/com/xxfc/member/controller/MemberInfoControllerTest.java
View file @
761b2770
...
@@ -4,7 +4,6 @@ import com.github.wxiaoqi.security.common.msg.BaseResponse;
...
@@ -4,7 +4,6 @@ import com.github.wxiaoqi.security.common.msg.BaseResponse;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.msg.TableResultResponse
;
import
com.github.wxiaoqi.security.common.msg.TableResultResponse
;
import
com.xxfc.member.MemberApplicationTests
;
import
com.xxfc.member.MemberApplicationTests
;
import
com.xxfc.member.entity.MemberFamilyInfo
;
import
com.xxfc.member.vo.MemberFamilyInfoVo
;
import
com.xxfc.member.vo.MemberFamilyInfoVo
;
import
com.xxfc.member.vo.MemberInfoVo
;
import
com.xxfc.member.vo.MemberInfoVo
;
import
org.junit.Assert
;
import
org.junit.Assert
;
...
@@ -14,7 +13,6 @@ import org.junit.Test;
...
@@ -14,7 +13,6 @@ import org.junit.Test;
import
org.junit.runners.MethodSorters
;
import
org.junit.runners.MethodSorters
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
javax.persistence.Table
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.Date
;
...
...
xx-third-party-api/pom.xml
0 → 100644
View file @
761b2770
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<parent>
<artifactId>
ace-security
</artifactId>
<groupId>
com.github.wxiaoqi
</groupId>
<version>
2.0-SNAPSHOT
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
xx-third-party-api
</artifactId>
<dependencies>
<!-- ace -->
<dependency>
<groupId>
com.github.wxiaoqi
</groupId>
<artifactId>
ace-common
</artifactId>
<version>
2.0-SNAPSHOT
</version>
</dependency>
<!-- 持久层 -->
<dependency>
<groupId>
com.github.pagehelper
</groupId>
<artifactId>
pagehelper-spring-boot-starter
</artifactId>
<version>
1.2.3
</version>
</dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-openfeign
</artifactId>
</dependency>
</dependencies>
</project>
\ No newline at end of file
xx-third-party-api/src/main/java/com/xxfc/thirdparty/api/ITrafficViolationsService.java
0 → 100644
View file @
761b2770
package
com
.
xxfc
.
thirdparty
.
api
;
import
com.xxfc.thirdparty.model.JuheResult
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
@FeignClient
(
"xx-third-party"
)
@RequestMapping
(
"3p/tv"
)
public
interface
ITrafficViolationsService
{
/**
* 获取支持的城市
* @param province
* @return
*/
@RequestMapping
(
value
=
"city"
,
method
=
RequestMethod
.
GET
)
JuheResult
getCityInfo
(
String
province
);
/**
* 查违章
* @param city 城市代码
* @param hphm 车牌号码
* @param hpzl 车辆类型 01:大车,02:小车
* @param engineno 发动机号
* @param classno 车架号
* @return
*/
@RequestMapping
(
value
=
"trafficViolations"
,
method
=
RequestMethod
.
GET
)
JuheResult
queryTrafficViolations
(
String
city
,
String
hphm
,
String
hpzl
,
String
engineno
,
String
classno
);
/**
* 获取剩余查询次数
* @return
*/
@RequestMapping
(
value
=
"balance"
,
method
=
RequestMethod
.
GET
)
JuheResult
getBalance
();
/**
* 根据车牌查归属地
* @param hphm 车牌号码
* @return
*/
@RequestMapping
(
value
=
"carPre"
,
method
=
RequestMethod
.
GET
)
JuheResult
carPre
(
String
hphm
);
}
xx-third-party-api/src/main/java/com/xxfc/thirdparty/model/JuheCarPreInfo.java
0 → 100644
View file @
761b2770
package
com
.
xxfc
.
thirdparty
.
model
;
import
lombok.Data
;
/**
* 根据车牌前缀查地区的返回结果
*/
@Data
public
class
JuheCarPreInfo
{
String
city_name
;
String
city_code
;
String
abbr
;
String
engine
;
String
engineno
;
String
classa
;
String
classno
;
String
province
;
}
xx-third-party-api/src/main/java/com/xxfc/thirdparty/model/JuheResult.java
0 → 100644
View file @
761b2770
package
com
.
xxfc
.
thirdparty
.
model
;
import
lombok.Data
;
@Data
public
class
JuheResult
<
T
>
{
String
resultcode
;
String
reason
;
T
result
;
Integer
error_code
;
}
xx-third-party-api/src/main/java/com/xxfc/thirdparty/model/JuheTrafficViolationsBalanceInfo.java
0 → 100644
View file @
761b2770
package
com
.
xxfc
.
thirdparty
.
model
;
import
lombok.Data
;
/**
* 车辆违章查询剩余次数
*/
@Data
public
class
JuheTrafficViolationsBalanceInfo
{
String
surplus
;
}
xx-third-party-api/src/main/java/com/xxfc/thirdparty/model/JuheTrafficViolationsCityInfo.java
0 → 100644
View file @
761b2770
package
com
.
xxfc
.
thirdparty
.
model
;
import
lombok.Data
;
@Data
public
class
JuheTrafficViolationsCityInfo
{
String
city_name
;
String
city_code
;
String
abbr
;
String
engine
;
String
engineno
;
String
classa
;
String
classno
;
String
regist
;
String
registno
;
}
xx-third-party-api/src/main/java/com/xxfc/thirdparty/model/JuheTrafficViolationsInfo.java
0 → 100644
View file @
761b2770
package
com
.
xxfc
.
thirdparty
.
model
;
import
lombok.Data
;
import
java.util.List
;
/**
* 违章信息
*/
@Data
public
class
JuheTrafficViolationsInfo
{
/**
* 省份代码
*/
String
province
;
/**
* 城市代码
*/
String
city
;
/**
* 车牌号码
*/
String
hphm
;
/**
* 牌类型,默认02:小型车,01:大型车
*/
String
hpzl
;
/**
* 违章信息列表
*/
List
<
JuheTrafficViolationsInfoItem
>
lists
;
}
xx-third-party-api/src/main/java/com/xxfc/thirdparty/model/JuheTrafficViolationsInfoItem.java
0 → 100644
View file @
761b2770
package
com
.
xxfc
.
thirdparty
.
model
;
import
lombok.Data
;
/**
* 违章信息项
*/
@Data
public
class
JuheTrafficViolationsInfoItem
{
String
data
;
String
area
;
String
act
;
String
code
;
String
fen
;
String
wzcity
;
String
money
;
String
handled
;
String
archiveno
;
}
xx-third-party-api/src/main/java/com/xxfc/thirdparty/model/JuheTrafficViolationsProvinceInfo.java
0 → 100644
View file @
761b2770
package
com
.
xxfc
.
thirdparty
.
model
;
import
lombok.Data
;
import
java.util.List
;
@Data
public
class
JuheTrafficViolationsProvinceInfo
{
String
province
;
String
province_code
;
List
<
JuheTrafficViolationsCityInfo
>
citys
;
}
xx-third-party/pom.xml
0 → 100644
View file @
761b2770
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<parent>
<artifactId>
ace-security
</artifactId>
<groupId>
com.github.wxiaoqi
</groupId>
<version>
2.0-SNAPSHOT
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
xx-third-party
</artifactId>
<dependencies>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
</dependency>
<!-- service -->
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-alibaba-sentinel
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-alibaba-nacos-config
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-alibaba-nacos-discovery
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-openfeign
</artifactId>
</dependency>
<!-- ace -->
<dependency>
<groupId>
com.github.wxiaoqi
</groupId>
<artifactId>
xx-third-party-api
</artifactId>
<version>
2.0-SNAPSHOT
</version>
</dependency>
<dependency>
<groupId>
com.github.wxiaoqi
</groupId>
<artifactId>
ace-common
</artifactId>
<version>
2.0-SNAPSHOT
</version>
</dependency>
<dependency>
<groupId>
com.github.wxiaoqi
</groupId>
<artifactId>
ace-auth-client
</artifactId>
<version>
2.0-SNAPSHOT
</version>
</dependency>
<dependency>
<groupId>
com.github.wxiaoqi
</groupId>
<artifactId>
ace-cache
</artifactId>
<version>
0.0.2
</version>
</dependency>
<!-- 持久层 -->
<dependency>
<groupId>
tk.mybatis
</groupId>
<artifactId>
mapper-spring-boot-starter
</artifactId>
<version>
1.1.2
</version>
</dependency>
<dependency>
<groupId>
com.github.pagehelper
</groupId>
<artifactId>
pagehelper-spring-boot-starter
</artifactId>
<version>
1.2.3
</version>
</dependency>
<dependency>
<groupId>
com.github.drtrang
</groupId>
<artifactId>
druid-spring-boot2-starter
</artifactId>
<version>
1.1.10
</version>
</dependency>
<dependency>
<groupId>
mysql
</groupId>
<artifactId>
mysql-connector-java
</artifactId>
</dependency>
<!-- utils -->
<dependency>
<groupId>
com.alibaba
</groupId>
<artifactId>
fastjson
</artifactId>
<version>
1.2.33
</version>
</dependency>
<dependency>
<groupId>
org.apache.commons
</groupId>
<artifactId>
commons-lang3
</artifactId>
<version>
3.4
</version>
</dependency>
<dependency>
<groupId>
log4j
</groupId>
<artifactId>
log4j
</artifactId>
<version>
1.2.17
</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
</plugin>
<!-- mybatis generator自动生成代码 -->
<plugin>
<groupId>
org.mybatis.generator
</groupId>
<artifactId>
mybatis-generator-maven-plugin
</artifactId>
<version>
1.3.7
</version>
<dependencies>
<dependency>
<groupId>
mysql
</groupId>
<artifactId>
mysql-connector-java
</artifactId>
<version>
8.0.15
</version>
</dependency>
<dependency>
<groupId>
org.mybatis.generator
</groupId>
<artifactId>
mybatis-generator-core
</artifactId>
<version>
1.3.7
</version>
</dependency>
<dependency>
<groupId>
tk.mybatis
</groupId>
<artifactId>
mapper
</artifactId>
<version>
4.0.4
</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>
Generate MyBatis Artifacts
</id>
<phase>
package
</phase>
<goals>
<goal>
generate
</goal>
</goals>
</execution>
</executions>
<configuration>
<!--允许移动生成的文件 -->
<verbose>
true
</verbose>
<!-- 是否覆盖 -->
<overwrite>
true
</overwrite>
<!-- 自动生成的配置 -->
<configurationFile>
src/main/resources/builder/mybatis-generator.xml
</configurationFile>
</configuration>
</plugin>
</plugins>
</build>
</project>
\ No newline at end of file
xx-third-party/src/main/java/com/xxfc/thirdparty/ThirdPartyApplication.java
0 → 100644
View file @
761b2770
package
com
.
xxfc
.
thirdparty
;
import
com.ace.cache.EnableAceCache
;
import
org.mybatis.spring.annotation.MapperScan
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.cloud.client.discovery.EnableDiscoveryClient
;
import
org.springframework.cloud.openfeign.EnableFeignClients
;
import
org.springframework.transaction.annotation.EnableTransactionManagement
;
@SpringBootApplication
@EnableDiscoveryClient
//@EnableAceAuthClient
@EnableAceCache
@EnableTransactionManagement
@MapperScan
(
"com.xxfc.thirdparty.mapper"
)
@EnableFeignClients
({
"com.github.wxiaoqi.security.auth.client.feign"
})
public
class
ThirdPartyApplication
{
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
ThirdPartyApplication
.
class
,
args
);
}
}
xx-third-party/src/main/java/com/xxfc/thirdparty/config/RestConfiguration.java
0 → 100644
View file @
761b2770
package
com
.
xxfc
.
thirdparty
.
config
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.web.client.RestTemplate
;
@Configuration
public
class
RestConfiguration
{
@Bean
public
RestTemplate
restTemplate
()
{
return
new
RestTemplate
();
}
}
xx-third-party/src/main/java/com/xxfc/thirdparty/config/WebConfiguration.java
0 → 100644
View file @
761b2770
package
com
.
xxfc
.
thirdparty
.
config
;
import
com.github.wxiaoqi.security.auth.client.interceptor.ServiceAuthRestInterceptor
;
import
com.github.wxiaoqi.security.auth.client.interceptor.UserAuthRestInterceptor
;
import
com.github.wxiaoqi.security.common.handler.GlobalExceptionHandler
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Primary
;
import
org.springframework.web.servlet.config.annotation.InterceptorRegistry
;
import
org.springframework.web.servlet.config.annotation.WebMvcConfigurer
;
import
java.util.ArrayList
;
import
java.util.Collections
;
@Configuration
(
"thirdpartyWebConfig"
)
@Primary
public
class
WebConfiguration
implements
WebMvcConfigurer
{
@Bean
GlobalExceptionHandler
getGlobalExceptionHandler
()
{
return
new
GlobalExceptionHandler
();
}
@Override
public
void
addInterceptors
(
InterceptorRegistry
registry
)
{
registry
.
addInterceptor
(
getServiceAuthRestInterceptor
()).
addPathPatterns
(
getIncludePathPatterns
()).
addPathPatterns
(
"/3p/**"
);
registry
.
addInterceptor
(
getUserAuthRestInterceptor
()).
addPathPatterns
(
getIncludePathPatterns
());
}
@Bean
ServiceAuthRestInterceptor
getServiceAuthRestInterceptor
()
{
return
new
ServiceAuthRestInterceptor
();
}
@Bean
UserAuthRestInterceptor
getUserAuthRestInterceptor
()
{
return
new
UserAuthRestInterceptor
();
}
/**
* 需要用户和服务认证判断的路径
* @return
*/
private
ArrayList
<
String
>
getIncludePathPatterns
()
{
ArrayList
<
String
>
list
=
new
ArrayList
<>();
String
[]
urls
=
{
"/3p/**"
};
Collections
.
addAll
(
list
,
urls
);
return
list
;
}
}
xx-third-party/src/main/java/com/xxfc/thirdparty/controller/TrafficViolationsController.java
0 → 100644
View file @
761b2770
package
com
.
xxfc
.
thirdparty
.
controller
;
import
com.xxfc.thirdparty.api.ITrafficViolationsService
;
import
com.xxfc.thirdparty.model.JuheResult
;
import
com.xxfc.thirdparty.service.TrafficViolationsService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
@RestController
@RequestMapping
(
"3p/tv"
)
public
class
TrafficViolationsController
implements
ITrafficViolationsService
{
@Autowired
TrafficViolationsService
tvService
;
@Override
@GetMapping
(
"city"
)
public
JuheResult
getCityInfo
(
String
province
)
{
return
tvService
.
getCity
(
province
);
}
@Override
@GetMapping
(
"trafficViolations"
)
public
JuheResult
queryTrafficViolations
(
String
city
,
String
hphm
,
String
hpzl
,
String
engineno
,
String
classno
)
{
return
tvService
.
queryViolations
(
city
,
hphm
,
hpzl
,
engineno
,
classno
);
}
@Override
@GetMapping
(
"balance"
)
public
JuheResult
getBalance
()
{
return
tvService
.
queryBalance
();
}
@Override
@GetMapping
(
"carPre"
)
public
JuheResult
carPre
(
String
hphm
)
{
return
tvService
.
queryCityByHphm
(
hphm
);
}
}
xx-third-party/src/main/java/com/xxfc/thirdparty/service/TrafficViolationsService.java
0 → 100644
View file @
761b2770
package
com
.
xxfc
.
thirdparty
.
service
;
import
com.alibaba.fastjson.JSON
;
import
com.xxfc.thirdparty.model.*
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.springframework.web.client.RestClientException
;
import
org.springframework.web.client.RestTemplate
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* 违章查询
*/
@Service
public
class
TrafficViolationsService
{
@Value
(
"${juhe.key}"
)
private
String
KEY
;
//支持的城市
private
static
final
String
URL_GET_CITY
=
"http://v.juhe.cn/wz/citys?"
+
"province={province}&dtype={dtype}&format={format}&callback={callback}&key={key}"
;
//查违章
private
static
final
String
URL_QUERY_WZ
=
"http://v.juhe.cn/wz/query?"
+
"dtype={dtype}&city={city}&hphm={hphm}&hpzl={hpzl}&engineno={engineno}&classno={classno}&key={key}"
;
//剩余次数
private
static
final
String
URL_BALANCE
=
"http://v.juhe.cn/wz/status?"
+
"dtype={dtype}&key={key}"
;
//根据车牌查城市
private
static
final
String
URL_CAR_PRE
=
"http://v.juhe.cn/wz/carPre?"
+
"hphm={hphm}&key={key}"
;
@Autowired
RestTemplate
restTemplate
;
/**
* 获取支持城市
* province string N 默认全部,省份简写,如:ZJ、JS
* dtype string N 返回数据格式:json或xml或jsonp,默认json
* format int N 格式选择1或2,默认1
* callback String N 返回格式选择jsonp时,必须传递
* {"resultcode":"101","reason":"error key","result":null,"error_code":10001}
*/
public
JuheResult
<
Map
<
String
,
JuheTrafficViolationsProvinceInfo
>>
getCity
(
String
province
)
{
Map
<
String
,
String
>
paramsMap
=
new
HashMap
<>();
paramsMap
.
put
(
"key"
,
KEY
);
paramsMap
.
put
(
"province"
,
province
==
null
?
""
:
province
);
paramsMap
.
put
(
"dtype"
,
"json"
);
paramsMap
.
put
(
"format"
,
""
);
paramsMap
.
put
(
"callback"
,
""
);
return
query
(
URL_GET_CITY
,
paramsMap
);
}
/**
* 查违章
* dtype string 否 返回数据格式:默认:json
* city String 是 城市代码 *
* hphm String 是 号牌号码 完整7位 ,需要utf8 urlencode*
* hpzl String 是 号牌类型,默认02:小型车,01:大型车
* engineno String 否 发动机号 (具体是否需要根据城市接口中的参数填写)
* classno String 否 车架号 (具体是否需要根据城市接口中的参数填写)
*/
public
JuheResult
<
JuheTrafficViolationsInfo
>
queryViolations
(
String
city
,
String
hphm
,
String
hpzl
,
String
engineno
,
String
classno
)
{
Map
<
String
,
String
>
paramsMap
=
new
HashMap
<>();
paramsMap
.
put
(
"key"
,
KEY
);
paramsMap
.
put
(
"dtype"
,
"json"
);
paramsMap
.
put
(
"city"
,
city
);
paramsMap
.
put
(
"hphm"
,
hphm
);
paramsMap
.
put
(
"hpzl"
,
hpzl
);
paramsMap
.
put
(
"engineno"
,
engineno
);
paramsMap
.
put
(
"classno"
,
classno
);
return
query
(
URL_QUERY_WZ
,
paramsMap
);
}
/**
* 查询剩余次数
*/
public
JuheResult
<
JuheTrafficViolationsBalanceInfo
>
queryBalance
()
{
Map
<
String
,
String
>
paramsMap
=
new
HashMap
<>();
paramsMap
.
put
(
"key"
,
KEY
);
paramsMap
.
put
(
"dtype"
,
"json"
);
return
query
(
URL_BALANCE
,
paramsMap
);
}
/**
* 根据车牌前缀查城市参数
*/
public
JuheResult
<
JuheCarPreInfo
>
queryCityByHphm
(
String
hphm
)
{
Map
<
String
,
String
>
paramsMap
=
new
HashMap
<>();
paramsMap
.
put
(
"key"
,
KEY
);
paramsMap
.
put
(
"hphm"
,
hphm
);
return
query
(
URL_CAR_PRE
,
paramsMap
);
}
private
JuheResult
query
(
String
url
,
Map
<
String
,
String
>
paramsMap
)
{
try
{
String
responseStr
=
restTemplate
.
getForObject
(
url
,
String
.
class
,
paramsMap
);
return
JSON
.
parseObject
(
responseStr
,
JuheResult
.
class
);
}
catch
(
RestClientException
ex
)
{
JuheResult
result
=
new
JuheResult
();
result
.
setReason
(
"请求错误"
);
result
.
setResultcode
(
"500"
);
return
result
;
}
}
}
xx-third-party/src/main/resources/application.yml
0 → 100644
View file @
761b2770
server
:
port
:
8002
logging
:
level
:
com.xxfc.member
:
DEBUG
spring
:
application
:
name
:
xx-third-party
jackson
:
date-format
:
yyyy-MM-dd HH:mm:ss
time-zone
:
GMT+8
default-property-inclusion
:
non_null
datasource
:
name
:
test
url
:
jdbc:mysql://${MYSQL_HOST:localhost}:${MYSQL_PORT:3306}/ag_admin_v1?useUnicode=true&characterEncoding=UTF8
username
:
root
password
:
123456
# 使用druid数据源
type
:
com.alibaba.druid.pool.DruidDataSource
driver-class-name
:
com.mysql.jdbc.Driver
filters
:
stat
maxActive
:
20
initialSize
:
1
maxWait
:
60000
minIdle
:
1
timeBetweenEvictionRunsMillis
:
60000
minEvictableIdleTimeMillis
:
300000
validationQuery
:
select 'x'
testWhileIdle
:
true
testOnBorrow
:
false
testOnReturn
:
false
poolPreparedStatements
:
true
maxOpenPreparedStatements
:
20
rabbitmq
:
host
:
${RABBIT_MQ_HOST:localhost}
port
:
${RABBIT_MQ_PORT:5672}
username
:
guest
password
:
guest
sleuth
:
enabled
:
true
http
:
legacy
:
enabled
:
true
cloud
:
nacos
:
discovery
:
server-addr
:
127.0.0.1:8848
sentinel
:
transport
:
dashboard
:
localhost:8080
sample
:
zipkin
:
# When enabled=false, traces log to the console. Comment to send to zipkin
enabled
:
false
mybatis
:
# basepackage: com.github.wxiaoqi.security.admin.mapper
# xmlLocation: classpath:mapper/**/*.xml
mapper-locations
:
"
classpath*:mapper/**/*.xml"
configuration
:
log-impl
:
org.apache.ibatis.logging.stdout.StdOutImpl
map-underscore-to-camel-case
:
true
mapper
:
mappers
:
com.github.wxiaoqi.security.common.mapper.MysqlMapper
# 必须配置
feign
:
httpclient
:
enabled
:
false
okhttp
:
enabled
:
true
ribbon
:
eureka
:
enabled
:
true
ReadTimeout
:
100000
ConnectTimeout
:
100000
MaxAutoRetries
:
0
MaxAutoRetriesNextServer
:
1
OkToRetryOnAllOperations
:
false
hystrix
:
threadpool
:
default
:
coreSize
:
1000
##并发执行的最大线程数,默认10
maxQueueSize
:
1000
##BlockingQueue的最大队列数
queueSizeRejectionThreshold
:
500
##即使maxQueueSize没有达到,达到queueSizeRejectionThreshold该值后,请求也会被拒绝
command
:
default
:
execution
:
isolation
:
thread
:
timeoutInMilliseconds
:
110000
# 配置swagger
swagger
:
enabled
:
true
base-package
:
com.github.wxiaoqi.security.admin
title
:
ace-admin
version
:
1.0.0.SNAPSHOT
description
:
管理后端服务
contact
:
name
:
admin
auth
:
serviceId
:
xx-third-party
user
:
token-header
:
Authorization
client
:
id
:
xx-member
secret
:
123456
token-header
:
x-client-token
#redis-cache 相关
redis
:
pool
:
maxActive
:
300
maxIdle
:
100
maxWait
:
1000
host
:
${REDIS_HOST:localhost}
port
:
${REDIS_PORT:6379}
password
:
timeout
:
2000
# 服务或应用名
sysName
:
xx-member
enable
:
true
database
:
0
management
:
endpoints
:
web
:
exposure
:
include
:
'
*'
security
:
enabled
:
false
juhe
:
key
:
714ac24873c6a8b76114dca575a3748b
\ No newline at end of file
xx-third-party/src/main/resources/bootstrap.yml
0 → 100644
View file @
761b2770
spring
:
application
:
name
:
xx-third-party
cloud
:
nacos
:
config
:
server-addr
:
127.0.0.1:8848
# server-addr: 10.5.52.2:8848
file-extension
:
yaml
profiles
:
active
:
dev
\ No newline at end of file
xx-third-party/src/main/resources/builder/mybatis-generator.xml
0 → 100644
View file @
761b2770
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE generatorConfiguration
PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
"http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<generatorConfiguration>
<context
id=
"Mysql"
targetRuntime=
"MyBatis3"
>
<property
name=
"beginningDelimiter"
value=
"`"
/>
<property
name=
"endingDelimiter"
value=
"`"
/>
<property
name=
"mergeable"
value=
"false"
/>
<plugin
type=
"tk.mybatis.mapper.generator.MapperPlugin"
>
<property
name=
"mappers"
value=
"tk.mybatis.mapper.common.Mapper"
/>
<!-- caseSensitive默认false,当数据库表名区分大小写时,可以将该属性设置为true -->
<property
name=
"caseSensitive"
value=
"false"
/>
</plugin>
<!--去除注释 -->
<commentGenerator>
<property
name=
"suppressAllComments"
value=
"true"
/>
<property
name=
"suppressDate"
value=
"true"
/>
</commentGenerator>
<jdbcConnection
driverClass=
"com.mysql.cj.jdbc.Driver"
connectionURL=
"jdbc:mysql://localhost:3306/ag_admin_v1?useUnicode=true&characterEncoding=UTF8&nullCatalogMeansCurrent=true"
userId=
"root"
password=
"123456"
>
</jdbcConnection>
<!-- Model -->
<javaModelGenerator
targetPackage=
"com.xxfc.member.entity"
targetProject=
"src/main/java"
>
<property
name=
"enableSubPackages"
value=
"true"
/>
<property
name=
"trimStrings"
value=
"true"
/>
</javaModelGenerator>
<!-- XML -->
<sqlMapGenerator
targetPackage=
"com.xxfc.member.mapper"
targetProject=
"src/main/resources/mapper"
>
<property
name=
"enableSubPackages"
value=
"true"
/>
</sqlMapGenerator>
<!-- Mapper -->
<javaClientGenerator
targetPackage=
"com.xxfc.member.mapper"
targetProject=
"src/main/java"
type=
"XMLMAPPER"
>
<property
name=
"enableSubPackages"
value=
"true"
/>
</javaClientGenerator>
<table
tableName=
"member_info"
domainObjectName=
"MemberInfo"
enableCountByExample=
"false"
enableUpdateByExample=
"false"
enableDeleteByExample=
"false"
enableSelectByExample=
"false"
selectByExampleQueryId=
"false"
/>
<table
tableName=
"member_family_info"
domainObjectName=
"MemberFamilyInfo"
enableCountByExample=
"false"
enableUpdateByExample=
"false"
enableDeleteByExample=
"false"
enableSelectByExample=
"false"
selectByExampleQueryId=
"false"
/>
</context>
</generatorConfiguration>
\ No newline at end of file
xx-third-party/src/test/java/com/xxfc/thirdparty/ThirdPartyApplicationTests.java
0 → 100644
View file @
761b2770
package
com
.
xxfc
.
thirdparty
;
import
org.junit.runner.RunWith
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.test.context.junit4.SpringRunner
;
@RunWith
(
SpringRunner
.
class
)
@SpringBootTest
public
class
ThirdPartyApplicationTests
{
}
xx-third-party/src/test/java/com/xxfc/thirdparty/service/TrafficViolationsServiceTest.java
0 → 100644
View file @
761b2770
package
com
.
xxfc
.
thirdparty
.
service
;
import
com.xxfc.thirdparty.ThirdPartyApplicationTests
;
import
com.xxfc.thirdparty.model.JuheResult
;
import
org.junit.Before
;
import
org.junit.Test
;
import
org.springframework.beans.factory.annotation.Autowired
;
public
class
TrafficViolationsServiceTest
extends
ThirdPartyApplicationTests
{
@Autowired
TrafficViolationsService
service
;
@Before
public
void
setUp
()
throws
Exception
{
}
@Test
public
void
getCity
()
{
JuheResult
result
=
service
.
getCity
(
null
);
System
.
out
.
println
(
result
);
}
@Test
public
void
queryViolations
()
{
JuheResult
result
=
service
.
queryViolations
(
"GD_DG"
,
"粤S0634C"
,
"02"
,
"1615000569"
,
"LGWEF6A5XGH002066"
);
System
.
out
.
println
(
result
);
}
@Test
public
void
queryBalance
()
{
JuheResult
result
=
service
.
queryBalance
();
System
.
out
.
println
(
result
);
}
@Test
public
void
queryCityByHphm
()
{
JuheResult
result
=
service
.
queryCityByHphm
(
"粤S0634C"
);
System
.
out
.
println
(
result
);
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment