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
5c86761f
Commit
5c86761f
authored
Jun 27, 2019
by
hezhen
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'base-modify' of
http://113.105.137.151:22280/youjj/cloud-platform
into base-modify
parents
b21d6db3
7c4b3d15
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
225 additions
and
39 deletions
+225
-39
LicensePlateType.java
.../com/xxfc/platform/universal/entity/LicensePlateType.java
+58
-0
SearchableCity.java
...va/com/xxfc/platform/universal/entity/SearchableCity.java
+1
-1
LicensePlateTypeBiz.java
.../com/xxfc/platform/universal/biz/LicensePlateTypeBiz.java
+19
-0
SearchableCityBiz.java
...va/com/xxfc/platform/universal/biz/SearchableCityBiz.java
+15
-0
TrafficViolationsController.java
...orm/universal/controller/TrafficViolationsController.java
+1
-1
LicensePlateTypeMapper.java
...xfc/platform/universal/mapper/LicensePlateTypeMapper.java
+11
-0
SearchableCityMapper.java
.../xxfc/platform/universal/mapper/SearchableCityMapper.java
+12
-0
TrafficViolationsService.java
.../platform/universal/service/TrafficViolationsService.java
+63
-37
LicensePlateType.xml
...cle-server/src/main/resources/mapper/LicensePlateType.xml
+10
-0
TimeTest.java
...ver/src/test/java/com/xxfc/platform/vehicle/TimeTest.java
+35
-0
No files found.
xx-universal/xx-universal-api/src/main/java/com/xxfc/platform/universal/entity/LicensePlateType.java
0 → 100644
View file @
5c86761f
package
com
.
xxfc
.
platform
.
universal
.
entity
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
lombok.Data
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
tk.mybatis.mapper.annotation.KeySql
;
import
tk.mybatis.mapper.code.IdentityDialect
;
import
javax.persistence.Column
;
import
javax.persistence.Id
;
import
java.io.Serializable
;
import
java.util.Date
;
@Data
public
class
LicensePlateType
implements
Serializable
{
/**
* id
*/
@Id
@KeySql
(
dialect
=
IdentityDialect
.
MYSQL
)
private
Integer
id
;
/**
* 车型代码
*/
private
String
code
;
/**
* 车型类型
*/
private
String
type
;
/**
* 创建时间
*/
@Column
(
name
=
"create_date"
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@JsonFormat
(
timezone
=
"GMT-8"
,
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
createDate
;
/**
* 修改时间
*/
@Column
(
name
=
"update_date"
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@JsonFormat
(
timezone
=
"GMT-8"
,
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
updateDate
;
public
LicensePlateType
(
String
code
,
String
type
)
{
this
.
code
=
code
;
this
.
type
=
type
;
}
public
LicensePlateType
()
{
}
}
xx-universal/xx-universal-api/src/main/java/com/xxfc/platform/universal/entity/
s
earchableCity.java
→
xx-universal/xx-universal-api/src/main/java/com/xxfc/platform/universal/entity/
S
earchableCity.java
View file @
5c86761f
...
@@ -11,7 +11,7 @@ import javax.persistence.Id;
...
@@ -11,7 +11,7 @@ import javax.persistence.Id;
import
java.util.Date
;
import
java.util.Date
;
@Data
@Data
public
class
s
earchableCity
{
public
class
S
earchableCity
{
@Id
@Id
@KeySql
(
dialect
=
IdentityDialect
.
MYSQL
)
@KeySql
(
dialect
=
IdentityDialect
.
MYSQL
)
...
...
xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/biz/LicensePlateTypeBiz.java
0 → 100644
View file @
5c86761f
package
com
.
xxfc
.
platform
.
universal
.
biz
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
com.xxfc.platform.universal.entity.LicensePlateType
;
import
com.xxfc.platform.universal.entity.SearchableCity
;
import
com.xxfc.platform.universal.mapper.LicensePlateTypeMapper
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.ArrayList
;
@Service
public
class
LicensePlateTypeBiz
extends
BaseBiz
<
LicensePlateTypeMapper
,
LicensePlateType
>
{
@Transactional
public
void
insertLicensePlateType
(
ArrayList
<
LicensePlateType
>
licensePlateTypes
)
{
mapper
.
insertLicensePlateType
(
licensePlateTypes
);
}
}
xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/biz/SearchableCityBiz.java
0 → 100644
View file @
5c86761f
package
com
.
xxfc
.
platform
.
universal
.
biz
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
com.xxfc.platform.universal.entity.SearchableCity
;
import
com.xxfc.platform.universal.mapper.SearchableCityMapper
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
@Service
public
class
SearchableCityBiz
extends
BaseBiz
<
SearchableCityMapper
,
SearchableCity
>
{
public
void
insertSearchableCities
(
ArrayList
<
SearchableCity
>
searchableCities
)
{
mapper
.
insertSearchableCities
(
searchableCities
);
}
}
xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/controller/TrafficViolationsController.java
View file @
5c86761f
...
@@ -49,7 +49,7 @@ public class TrafficViolationsController {
...
@@ -49,7 +49,7 @@ public class TrafficViolationsController {
@GetMapping
(
"/LicensePlateType"
)
@GetMapping
(
"/LicensePlateType"
)
public
ObjectRestResponse
getLicensePlateType
()
{
public
ObjectRestResponse
getLicensePlateType
()
{
try
{
try
{
return
ObjectRestResponse
.
succ
(
JSONObject
.
parse
(
tvService
.
getLicensePlateType
()
));
return
ObjectRestResponse
.
succ
(
tvService
.
getLicensePlateType
(
));
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
return
ObjectRestResponse
.
createDefaultFail
();
return
ObjectRestResponse
.
createDefaultFail
();
...
...
xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/mapper/LicensePlateTypeMapper.java
0 → 100644
View file @
5c86761f
package
com
.
xxfc
.
platform
.
universal
.
mapper
;
import
com.xxfc.platform.universal.entity.LicensePlateType
;
import
org.apache.ibatis.annotations.Param
;
import
tk.mybatis.mapper.common.Mapper
;
import
java.util.ArrayList
;
public
interface
LicensePlateTypeMapper
extends
Mapper
<
LicensePlateType
>
{
void
insertLicensePlateType
(
@Param
(
"licensePlateTypes"
)
ArrayList
<
LicensePlateType
>
licensePlateTypes
);
}
xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/mapper/SearchableCityMapper.java
0 → 100644
View file @
5c86761f
package
com
.
xxfc
.
platform
.
universal
.
mapper
;
import
com.xxfc.platform.universal.entity.SearchableCity
;
import
org.apache.ibatis.annotations.Param
;
import
tk.mybatis.mapper.common.Mapper
;
import
java.util.ArrayList
;
public
interface
SearchableCityMapper
extends
Mapper
<
SearchableCity
>
{
void
insertSearchableCities
(
@Param
(
value
=
"searchableCities"
)
ArrayList
<
SearchableCity
>
searchableCities
);
}
xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/service/TrafficViolationsService.java
View file @
5c86761f
package
com
.
xxfc
.
platform
.
universal
.
service
;
package
com
.
xxfc
.
platform
.
universal
.
service
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.xxfc.platform.universal.entity.searchableCity
;
import
com.github.wxiaoqi.security.common.exception.BaseException
;
import
com.xxfc.platform.universal.biz.LicensePlateTypeBiz
;
import
com.xxfc.platform.universal.biz.SearchableCityBiz
;
import
com.xxfc.platform.universal.entity.LicensePlateType
;
import
com.xxfc.platform.universal.utils.CertifHttpUtils
;
import
com.xxfc.platform.universal.utils.CertifHttpUtils
;
import
com.xxfc.platform.universal.vo.TrafficViolations
;
import
com.xxfc.platform.universal.vo.TrafficViolations
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.http.HttpEntity
;
import
org.apache.http.HttpEntity
;
import
org.apache.http.HttpResponse
;
import
org.apache.http.HttpResponse
;
import
org.apache.http.util.EntityUtils
;
import
org.apache.http.util.EntityUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.core.task.TaskExecutor
;
import
org.springframework.scheduling.annotation.Schedules
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.io.UnsupportedEncodingException
;
import
java.util.*
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.regex.Matcher
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
import
java.util.regex.Pattern
;
...
@@ -25,6 +28,9 @@ import java.util.regex.Pattern;
...
@@ -25,6 +28,9 @@ import java.util.regex.Pattern;
@Service
@Service
public
class
TrafficViolationsService
{
public
class
TrafficViolationsService
{
@Autowired
private
LicensePlateTypeBiz
licensePlateTypeBiz
;
@Value
(
"${ALIYUN.CODE}"
)
@Value
(
"${ALIYUN.CODE}"
)
private
String
CODE
;
private
String
CODE
;
@Value
(
"${RETURN.TYPE}"
)
@Value
(
"${RETURN.TYPE}"
)
...
@@ -50,29 +56,29 @@ public class TrafficViolationsService {
...
@@ -50,29 +56,29 @@ public class TrafficViolationsService {
/**
/**
* 支持城市
* 支持查询的城市
*
* @return
* @return
* @throws Exception
type 返回参数类型
* @throws Exception
*/
*/
// @Scheduled(cron = "0 0 0 * * ?")
@Scheduled
(
cron
=
"0 0 0 * * ?"
)
public
String
getCity
()
throws
Exception
{
public
String
getCity
()
throws
Exception
{
Map
<
String
,
String
>
headers
=
new
HashMap
<
String
,
String
>();
Map
<
String
,
String
>
headers
=
new
HashMap
<
String
,
String
>();
headers
.
put
(
AUTHORIZATION
,
"APPCODE "
+
CODE
);
headers
.
put
(
AUTHORIZATION
,
"APPCODE "
+
CODE
);
Map
<
String
,
String
>
querys
=
new
HashMap
<
String
,
String
>();
Map
<
String
,
String
>
querys
=
new
HashMap
<
String
,
String
>();
querys
.
put
(
TYPE_NAME
,
TYPE
);
querys
.
put
(
TYPE_NAME
,
TYPE
);
HttpResponse
httpResponse
=
CertifHttpUtils
.
doGet
(
CITY_HOST
,
CITY_PATH
,
CITY_METHOD
,
headers
,
querys
);
HttpResponse
httpResponse
=
CertifHttpUtils
.
doGet
(
CITY_HOST
,
CITY_PATH
,
CITY_METHOD
,
headers
,
querys
);
HttpEntity
entity
=
httpResponse
.
getEntity
();
HttpEntity
entity
=
httpResponse
.
getEntity
();
String
result
=
EntityUtils
.
toString
(
entity
);
// String result = EntityUtils.toString(entity);
JSONObject
.
parseObject
(
result
,
searchableCity
.
class
);
// ArrayList<SearchableCity> searchableCities = JSONObject.parseObject(result, ArrayList.class);
// searchableCities.forEach(searchableCity ->searchableCity.setCreateDate(new Date()) );
// searchableCityBiz.insertSearchableCities(searchableCities);
return
unicodeToString
(
EntityUtils
.
toString
(
entity
));
return
unicodeToString
(
EntityUtils
.
toString
(
entity
));
}
}
/**
/**
s
* 违章车辆查询
* 违章车辆查询
*
* @param trafficViolations
* @param trafficViolations
* @return
* @return
*/
*/
...
@@ -90,30 +96,26 @@ public class TrafficViolationsService {
...
@@ -90,30 +96,26 @@ public class TrafficViolationsService {
}
}
/**
/**
* 查询车牌类型
* 放入bean中
*
* @return
* @throws Exception
* @throws Exception
*
*/
*/
public
void
saveLicensePlateType
()
throws
Exception
{
public
String
getLicensePlateType
()
throws
Exception
{
String
result
=
searchaLicensePlateType
();
if
(
StringUtils
.
isBlank
(
result
))
{
Map
<
String
,
String
>
headers
=
new
HashMap
<
String
,
String
>(
);
throw
new
BaseException
(
"错误! 查询不到车辆类型"
);
headers
.
put
(
AUTHORIZATION
,
"APPCODE "
+
CODE
);
}
HashMap
<
String
,
String
>
querys
=
new
HashMap
<>(
);
Map
<
String
,
Object
>
resultMap
=
JSONObject
.
parseObject
(
result
,
Map
.
class
);
Integer
status
=
(
Integer
)
resultMap
.
get
(
"status"
);
HttpResponse
httpResponse
=
CertifHttpUtils
.
doGet
(
GET_LICENSE_PLATE_TYPE_HOST
,
Map
<
String
,
String
>
licensePlateTypeMap
=
(
Map
<
String
,
String
>)
resultMap
.
get
(
"result"
);
GET_LICENSE_PLATE_TYPE_PATH
,
if
(
status
!=
200
||
licensePlateTypeMap
==
null
)
{
GET_LICENSE_PLATE_TYPE_METHOD
,
throw
new
BaseException
(
"错误! 查询不到车辆类型"
);
headers
,
}
querys
ArrayList
<
LicensePlateType
>
licensePlateTypes
=
new
ArrayList
<>();
);
for
(
Map
.
Entry
<
String
,
String
>
licensePlateTypeEntry
:
licensePlateTypeMap
.
entrySet
())
{
HttpEntity
entity
=
httpResponse
.
getEntity
(
);
licensePlateTypes
.
add
(
new
LicensePlateType
(
licensePlateTypeEntry
.
getKey
(),
licensePlateTypeEntry
.
getValue
())
);
}
return
unicodeToString
(
EntityUtils
.
toString
(
entity
)
);
licensePlateTypeBiz
.
insertLicensePlateType
(
licensePlateTypes
);
}
}
/**
/**
...
@@ -141,7 +143,31 @@ public class TrafficViolationsService {
...
@@ -141,7 +143,31 @@ public class TrafficViolationsService {
}
}
/**
* 调用接口获取车辆车型和代码
* @return
* @throws Exception
*/
public
String
searchaLicensePlateType
()
throws
Exception
{
Map
<
String
,
String
>
headers
=
new
HashMap
<
String
,
String
>();
headers
.
put
(
AUTHORIZATION
,
"APPCODE "
+
CODE
);
HashMap
<
String
,
String
>
querys
=
new
HashMap
<>();
HttpResponse
httpResponse
=
CertifHttpUtils
.
doGet
(
GET_LICENSE_PLATE_TYPE_HOST
,
GET_LICENSE_PLATE_TYPE_PATH
,
GET_LICENSE_PLATE_TYPE_METHOD
,
headers
,
querys
);
HttpEntity
entity
=
httpResponse
.
getEntity
();
return
unicodeToString
(
EntityUtils
.
toString
(
entity
));
}
public
ArrayList
<
LicensePlateType
>
getLicensePlateType
()
{
List
<
LicensePlateType
>
licensePlateTypes
=
licensePlateTypeBiz
.
selectListAll
();
if
(
CollectionUtils
.
isEmpty
(
licensePlateTypes
))
{
}
return
null
;
}
}
}
xx-vehicle/xx-vehicle-server/src/main/resources/mapper/LicensePlateType.xml
0 → 100644
View file @
5c86761f
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.xxfc.platform.universal.mapper.LicensePlateTypeMapper"
>
<insert
id=
"insertLicensePlateType"
parameterType=
"List"
>
insert into license_plate_type (code,type,create_date,update_date) values
<foreach
collection=
"licensePlateTypes"
item=
"lpt"
index=
"index"
separator=
","
>
(#{lpt.code},#{lpt.createDate},#{lpt.updateDate})
</foreach>
</insert>
</mapper>
\ No newline at end of file
xx-vehicle/xx-vehicle-server/src/test/java/com/xxfc/platform/vehicle/TimeTest.java
View file @
5c86761f
...
@@ -17,6 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -17,6 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.test.context.junit4.SpringJUnit4ClassRunner
;
import
org.springframework.test.context.junit4.SpringJUnit4ClassRunner
;
import
java.io.Serializable
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
...
@@ -31,4 +32,38 @@ public class TimeTest {
...
@@ -31,4 +32,38 @@ public class TimeTest {
DateTime
startDay
=
DateTime
.
parse
(
"2019-06-04"
,
DEFAULT_DATE_TIME_FORMATTER
);
DateTime
startDay
=
DateTime
.
parse
(
"2019-06-04"
,
DEFAULT_DATE_TIME_FORMATTER
);
System
.
out
.
println
(
"test"
);
System
.
out
.
println
(
"test"
);
}
}
@Test
public
void
testStream
()
throws
Exception
{
ArrayList
<
Student
>
students
=
new
ArrayList
<>();
students
.
add
(
new
Student
(
"张1"
,
"11"
));
students
.
add
(
new
Student
(
"张2"
,
"12"
));
students
.
add
(
new
Student
(
"张3"
,
"13"
));
students
.
add
(
new
Student
(
"张4"
,
"14"
));
students
.
add
(
new
Student
(
"张5"
,
"15"
));
int
i
=
0
;
students
.
forEach
(
student
->
student
.
setCode
(
1
));
students
.
forEach
(
System
.
out
::
println
);
}
}
@Data
class
Student
implements
Serializable
{
private
String
name
;
private
String
age
;
private
int
code
;
public
Student
(
String
name
,
String
age
,
int
code
)
{
this
.
name
=
name
;
this
.
age
=
age
;
this
.
code
=
code
;
}
public
Student
(
String
name
,
String
age
)
{
this
.
name
=
name
;
this
.
age
=
age
;
}
}
}
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