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
0cf880f4
Commit
0cf880f4
authored
Jun 28, 2019
by
hanfeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改违章,把查询到的车型代码和类型保存到数据库3
parent
ca1e4608
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
100 additions
and
14 deletions
+100
-14
LicensePlateType.java
.../com/xxfc/platform/universal/entity/LicensePlateType.java
+15
-0
pom.xml
xx-universal/xx-universal-server/pom.xml
+4
-0
LicensePlateTypeBiz.java
.../com/xxfc/platform/universal/biz/LicensePlateTypeBiz.java
+36
-3
LicensePlateTypeMapper.java
...xfc/platform/universal/mapper/LicensePlateTypeMapper.java
+3
-2
TrafficViolationsService.java
.../platform/universal/service/TrafficViolationsService.java
+39
-7
VehicleBiz.java
...c/main/java/com/xxfc/platform/vehicle/biz/VehicleBiz.java
+3
-2
No files found.
xx-universal/xx-universal-api/src/main/java/com/xxfc/platform/universal/entity/LicensePlateType.java
View file @
0cf880f4
...
...
@@ -10,6 +10,7 @@ import javax.persistence.Column;
import
javax.persistence.Id
;
import
java.io.Serializable
;
import
java.util.Date
;
import
java.util.Objects
;
@Data
public
class
LicensePlateType
implements
Serializable
{
...
...
@@ -55,4 +56,18 @@ public class LicensePlateType implements Serializable {
public
LicensePlateType
()
{
}
@Override
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
return
true
;
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
return
false
;
LicensePlateType
that
=
(
LicensePlateType
)
o
;
return
code
.
equals
(
that
.
code
)
&&
type
.
equals
(
that
.
type
);
}
@Override
public
int
hashCode
()
{
return
Objects
.
hash
(
code
,
type
);
}
}
xx-universal/xx-universal-server/pom.xml
View file @
0cf880f4
...
...
@@ -72,6 +72,10 @@
<version>
2.0-SNAPSHOT
</version>
<scope>
compile
</scope>
</dependency>
<dependency>
<groupId>
antlr
</groupId>
<artifactId>
antlr
</artifactId>
</dependency>
</dependencies>
<build>
...
...
xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/biz/LicensePlateTypeBiz.java
View file @
0cf880f4
package
com
.
xxfc
.
platform
.
universal
.
biz
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
com.github.wxiaoqi.security.common.exception.BaseException
;
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
org.springframework.transaction.interceptor.TransactionAspectSupport
;
import
tk.mybatis.mapper.entity.Example
;
import
tk.mybatis.mapper.weekend.WeekendSqls
;
import
java.util.ArrayList
;
import
java.sql.SQLDataException
;
import
java.sql.SQLException
;
import
java.util.List
;
@Service
public
class
LicensePlateTypeBiz
extends
BaseBiz
<
LicensePlateTypeMapper
,
LicensePlateType
>
{
@Transactional
public
void
insertLicensePlateType
(
Array
List
<
LicensePlateType
>
licensePlateTypes
)
{
public
void
insertLicensePlateType
(
List
<
LicensePlateType
>
licensePlateTypes
)
{
mapper
.
insertLicensePlateType
(
licensePlateTypes
);
}
@Transactional
public
void
updateLicensePlateType
(
List
<
LicensePlateType
>
licensePlateTypes
)
throws
SQLException
{
// List<LicensePlateType> saveLicensePlateTypes = mapper.selectAll();
// HashSet<LicensePlateType> judgeSet = new HashSet<>();
// judgeSet.addAll(saveLicensePlateTypes);
// for (LicensePlateType licensePlateType : licensePlateTypes) {
//
// if (judgeSet.add(licensePlateType)) {
//
// mapper.updateByExample()
// }
// }
for
(
LicensePlateType
licensePlateType
:
licensePlateTypes
)
{
Example
exa
=
Example
.
builder
(
LicensePlateType
.
class
)
.
where
(
WeekendSqls
.<
LicensePlateType
>
custom
()
.
andEqualTo
(
LicensePlateType:
:
getCode
,
licensePlateType
.
getCode
())
).
build
();
int
flag
=
mapper
.
updateByExample
(
licensePlateType
,
exa
);
if
(
flag
==
0
)
{
insertSelective
(
licensePlateType
);
}
if
(
flag
>
1
)
{
throw
new
SQLException
(
"修改错误,同时修改多条数据"
);
}
}
}
}
xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/mapper/LicensePlateTypeMapper.java
View file @
0cf880f4
...
...
@@ -4,8 +4,9 @@ import com.xxfc.platform.universal.entity.LicensePlateType;
import
org.apache.ibatis.annotations.Param
;
import
tk.mybatis.mapper.common.Mapper
;
import
java.util.ArrayList
;
import
java.util.List
;
public
interface
LicensePlateTypeMapper
extends
Mapper
<
LicensePlateType
>
{
void
insertLicensePlateType
(
@Param
(
"licensePlateTypes"
)
Array
List
<
LicensePlateType
>
licensePlateTypes
);
void
insertLicensePlateType
(
@Param
(
"licensePlateTypes"
)
List
<
LicensePlateType
>
licensePlateTypes
);
}
xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/service/TrafficViolationsService.java
View file @
0cf880f4
...
...
@@ -3,7 +3,6 @@ package com.xxfc.platform.universal.service;
import
com.alibaba.fastjson.JSONObject
;
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.vo.TrafficViolations
;
...
...
@@ -15,6 +14,7 @@ import org.apache.http.util.EntityUtils;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.core.task.TaskExecutor
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Service
;
import
java.util.*
;
...
...
@@ -31,6 +31,9 @@ public class TrafficViolationsService {
@Autowired
private
LicensePlateTypeBiz
licensePlateTypeBiz
;
@Autowired
private
TaskExecutor
taskExecutor
;
@Value
(
"${ALIYUN.CODE}"
)
private
String
CODE
;
@Value
(
"${RETURN.TYPE}"
)
...
...
@@ -60,7 +63,6 @@ public class TrafficViolationsService {
* @return
* @throws Exception
*/
// @Scheduled(cron = "0 0 0 * * ?")
public
String
getCity
()
throws
Exception
{
Map
<
String
,
String
>
headers
=
new
HashMap
<
String
,
String
>();
...
...
@@ -98,8 +100,9 @@ public class TrafficViolationsService {
/**
* 放入bean中
* @throws Exception
* @return
*/
public
void
saveLicensePlateType
()
throws
Exception
{
public
ArrayList
<
LicensePlateType
>
saveLicensePlateType
()
throws
Exception
{
String
result
=
searchaLicensePlateType
();
if
(
StringUtils
.
isBlank
(
result
))
{
throw
new
BaseException
(
"错误! 查询不到车辆类型"
);
...
...
@@ -114,7 +117,10 @@ public class TrafficViolationsService {
for
(
Map
.
Entry
<
String
,
String
>
licensePlateTypeEntry
:
licensePlateTypeMap
.
entrySet
())
{
licensePlateTypes
.
add
(
new
LicensePlateType
(
licensePlateTypeEntry
.
getKey
(),
licensePlateTypeEntry
.
getValue
()));
}
licensePlateTypeBiz
.
insertLicensePlateType
(
licensePlateTypes
);
return
licensePlateTypes
;
}
...
...
@@ -144,7 +150,7 @@ public class TrafficViolationsService {
/**
* 调用接口获取车辆车
型
和代码
* 调用接口获取车辆车
牌
和代码
* @return
* @throws Exception
*/
...
...
@@ -163,11 +169,37 @@ public class TrafficViolationsService {
return
unicodeToString
(
EntityUtils
.
toString
(
entity
));
}
public
ArrayList
<
LicensePlateType
>
getLicensePlateType
()
{
/**
* 查询对应的车牌和车牌代码
* @return
* @throws Exception
*/
public
List
<
LicensePlateType
>
getLicensePlateType
()
throws
Exception
{
List
<
LicensePlateType
>
licensePlateTypes
=
licensePlateTypeBiz
.
selectListAll
();
if
(
CollectionUtils
.
isEmpty
(
licensePlateTypes
))
{
licensePlateTypes
=
saveLicensePlateType
();
List
<
LicensePlateType
>
finalLicensePlateTypes
=
licensePlateTypes
;
taskExecutor
.
execute
(
new
Runnable
()
{
@Override
public
void
run
()
{
insertLicensePlateType
(
finalLicensePlateTypes
);
}
});
}
return
null
;
return
licensePlateTypes
;
}
@Scheduled
(
cron
=
"0 0 0 0/3 * *"
)
private
void
updateLicensePlateType
(){
List
<
LicensePlateType
>
licensePlateTypes
=
licensePlateTypeBiz
.
selectListAll
();
licensePlateTypeBiz
.
updateLicensePlateType
(
licensePlateTypes
);
}
private
void
insertLicensePlateType
(
List
<
LicensePlateType
>
finalLicensePlateTypes
){
licensePlateTypeBiz
.
insertLicensePlateType
(
finalLicensePlateTypes
);
}
}
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/biz/VehicleBiz.java
View file @
0cf880f4
...
...
@@ -135,9 +135,10 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
return
new
ResponseEntity
<
byte
[]>(
FileUtils
.
readFileToByteArray
(
file
),
headers
,
HttpStatus
.
CREATED
);
}
@Cache
(
key
=
"vehical"
)
//
@Cache(key = "vehical")
public
Vehicle
get
(
String
id
){
return
mapper
.
selectByPrimaryKey
(
id
);
Vehicle
vehicle
=
mapper
.
selectByPrimaryKey
(
id
);
return
vehicle
;
}
/**
...
...
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