Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
eshiled-new
/
ne-shield-standard-interfaces
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
1
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 4bce0607
authored
Dec 21, 2021
by
杨林龙
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
优化存储数据逻辑
1 parent
bbc77ce7
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
47 deletions
src/main/java/cn/com/glsx/stdinterface/modules/service/DeviceLocationService.java
src/test/java/cn/com/glsx/stdinterface/modules/MainTest.java
src/main/java/cn/com/glsx/stdinterface/modules/service/DeviceLocationService.java
View file @
4bce060
...
@@ -33,7 +33,7 @@ public class DeviceLocationService {
...
@@ -33,7 +33,7 @@ public class DeviceLocationService {
* @param deviceLocationDtoList
* @param deviceLocationDtoList
*/
*/
public
void
saveOrUpdateDeviceLocationData
(
Collection
<
DeviceLocationDto
>
deviceLocationDtoList
)
{
public
void
saveOrUpdateDeviceLocationData
(
Collection
<
DeviceLocationDto
>
deviceLocationDtoList
)
{
deviceLocationDtoList
.
forEach
(
deviceLocationDto
->
{
for
(
DeviceLocationDto
deviceLocationDto
:
deviceLocationDtoList
)
{
DeviceLocation
locationBySn
=
deviceLocationMapper
.
getDeviceLocationBySn
(
deviceLocationDto
.
getSn
());
DeviceLocation
locationBySn
=
deviceLocationMapper
.
getDeviceLocationBySn
(
deviceLocationDto
.
getSn
());
if
(
ObjectUtil
.
isNull
(
locationBySn
))
{
if
(
ObjectUtil
.
isNull
(
locationBySn
))
{
DeviceLocation
deviceLocation
=
new
DeviceLocation
();
DeviceLocation
deviceLocation
=
new
DeviceLocation
();
...
@@ -44,7 +44,7 @@ public class DeviceLocationService {
...
@@ -44,7 +44,7 @@ public class DeviceLocationService {
mergeData
(
locationBySn
,
deviceLocationDto
);
mergeData
(
locationBySn
,
deviceLocationDto
);
deviceLocationMapper
.
updateByPrimaryKeySelective
(
locationBySn
);
deviceLocationMapper
.
updateByPrimaryKeySelective
(
locationBySn
);
}
}
}
);
}
}
}
private
void
mergeData
(
DeviceLocation
locationBySn
,
DeviceLocationDto
deviceLocationDto
)
{
private
void
mergeData
(
DeviceLocation
locationBySn
,
DeviceLocationDto
deviceLocationDto
)
{
...
...
src/test/java/cn/com/glsx/stdinterface/modules/MainTest.java
View file @
4bce060
package
cn
.
com
.
glsx
.
stdinterface
.
modules
;
package
cn
.
com
.
glsx
.
stdinterface
.
modules
;
import
cn.com.glsx.stdinterface.modules.model.CommonApiRequest
;
import
cn.com.glsx.stdinterface.modules.model.CommonApiRequest
;
import
cn.com.glsx.stdinterface.modules.model.InstallWorkOrderBO
;
//
import cn.com.glsx.stdinterface.modules.model.InstallWorkOrderBO;
import
cn.com.glsx.stdinterface.modules.util.Sm4EncryptUtils
;
import
cn.com.glsx.stdinterface.modules.util.Sm4EncryptUtils
;
import
cn.hutool.http.HttpUtil
;
import
cn.hutool.http.HttpUtil
;
import
cn.hutool.json.JSONUtil
;
import
cn.hutool.json.JSONUtil
;
...
@@ -12,50 +12,50 @@ import org.springframework.util.DigestUtils;
...
@@ -12,50 +12,50 @@ import org.springframework.util.DigestUtils;
public
class
MainTest
{
public
class
MainTest
{
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
InstallWorkOrderBO
orderBO
=
new
InstallWorkOrderBO
();
//
InstallWorkOrderBO orderBO = new InstallWorkOrderBO();
orderBO
.
setWorkOrderNo
(
SnowFlake
.
nextSerialNumber
());
//
orderBO.setWorkOrderNo(SnowFlake.nextSerialNumber());
orderBO
.
setVin
(
"LB888"
+
orderBO
.
getWorkOrderNo
());
//
orderBO.setVin("LB888" + orderBO.getWorkOrderNo());
//
orderBO
.
setVinHash
(
DigestUtils
.
md5DigestAsHex
(
orderBO
.
getVin
().
getBytes
()));
//
orderBO.setVinHash(DigestUtils.md5DigestAsHex(orderBO.getVin().getBytes()));
orderBO
.
setLesseeName
(
"张三"
);
//
orderBO.setLesseeName("张三");
orderBO
.
setLesseePhone
(
"13800138000"
);
//
orderBO.setLesseePhone("13800138000");
orderBO
.
setColor
(
"红色"
);
//
orderBO.setColor("红色");
orderBO
.
setInnerColor
(
"黑色"
);
//
orderBO.setInnerColor("黑色");
orderBO
.
setPlateNo
(
"粤B12345"
);
//
orderBO.setPlateNo("粤B12345");
orderBO
.
setEngineNo
(
"6411973"
);
//
orderBO.setEngineNo("6411973");
orderBO
.
setDistrict
(
"广东"
);
//
orderBO.setDistrict("广东");
orderBO
.
setShopName
(
"上海融玉汽车服务有限公司"
);
//
orderBO.setShopName("上海融玉汽车服务有限公司");
orderBO
.
setShopContactor
(
"门店联系人"
);
//
orderBO.setShopContactor("门店联系人");
orderBO
.
setShopTelephone
(
"13800138001"
);
//
orderBO.setShopTelephone("13800138001");
orderBO
.
setRemark
(
"备注"
);
//
orderBO.setRemark("备注");
orderBO
.
setServicePeriod
(
24
);
//
orderBO.setServicePeriod(24);
orderBO
.
setFundProvider
(
"仲利租赁"
);
//
orderBO.setFundProvider("仲利租赁");
orderBO
.
setPurchaseType
(
"自采"
);
//
orderBO.setPurchaseType("自采");
orderBO
.
setRentType
(
"回租"
);
//
orderBO.setRentType("回租");
orderBO
.
setNeedInstall
(
"Y"
);
//
orderBO.setNeedInstall("Y");
//
orderBO
.
setInstallCompose
(
"00011"
);
//
orderBO.setInstallCompose("00011");
orderBO
.
setInstallExplain
(
null
);
//
orderBO.setInstallExplain(null);
orderBO
.
setInstallTime
(
DateUtils
.
parse
(
"2021-12-08 12:24:57"
));
//
orderBO.setInstallTime(DateUtils.parse("2021-12-08 12:24:57"));
orderBO
.
setInstallAddress
(
"上海融玉总部普陀店"
);
//
orderBO.setInstallAddress("上海融玉总部普陀店");
orderBO
.
setNeedInsure
(
"N"
);
//
orderBO.setNeedInsure("N");
//
String
originData
=
JSONUtil
.
toJsonStr
(
orderBO
);
//
String originData = JSONUtil.toJsonStr(orderBO);
System
.
out
.
println
(
originData
);
//
System.out.println(originData);
String
encryptData
=
Sm4EncryptUtils
.
encryptCbc
(
"E76F7D9A27F63E6BA5F4282D81BA9E50"
,
originData
);
//
String encryptData = Sm4EncryptUtils.encryptCbc("E76F7D9A27F63E6BA5F4282D81BA9E50", originData);
System
.
out
.
println
(
encryptData
);
//
System.out.println(encryptData);
//
CommonApiRequest
request
=
new
CommonApiRequest
();
//
CommonApiRequest request = new CommonApiRequest();
request
.
setTimestamp
(
System
.
currentTimeMillis
());
//
request.setTimestamp(System.currentTimeMillis());
request
.
setOrganization
(
"zlgj"
);
//
request.setOrganization("zlgj");
request
.
setData
(
encryptData
);
//
request.setData(encryptData);
request
.
setDataType
(
1
);
//
request.setDataType(1);
String
requestData
=
JSONUtil
.
toJsonStr
(
request
);
//
String requestData = JSONUtil.toJsonStr(request);
System
.
out
.
println
(
requestData
);
//
System.out.println(requestData);
//
String
url
=
"http://192.168.3.152:8387/stdinterface/workorder/create"
;
//
String url = "http://192.168.3.152:8387/stdinterface/workorder/create";
String
result
=
HttpUtil
.
createPost
(
url
).
body
(
requestData
).
execute
().
body
();
//
String result = HttpUtil.createPost(url).body(requestData).execute().body();
System
.
out
.
println
(
result
);
//
System.out.println(result);
}
}
}
}
Write
Preview
Markdown
is supported
Attach a file
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 post a comment