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 9847b381
authored
Dec 22, 2021
by
levphon
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
工单标准接口
1 parent
33b34cec
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
38 deletions
src/main/java/cn/com/glsx/stdinterface/modules/service/WorkOrderService.java
src/main/java/cn/com/glsx/stdinterface/modules/service/WorkOrderService.java
View file @
9847b38
...
...
@@ -2,10 +2,9 @@ package cn.com.glsx.stdinterface.modules.service;
import
cn.com.glsx.devicemonitor.api.dto.request.DeviceLocationItem
;
import
cn.com.glsx.devicemonitor.api.dto.request.DeviceLocationRequest
;
import
cn.com.glsx.devicemonitor.api.dto.response.DeviceDTO
;
import
cn.com.glsx.devicemonitor.api.dto.response.GpsBsData
;
import
cn.com.glsx.devicemonitor.api.enums.DeviceTypeRelationEnum
;
import
cn.com.glsx.devicemonitor.api.
feign.DeviceFeignService
;
import
cn.com.glsx.devicemonitor.api.
enums.DeviceWireTypeEnum
;
import
cn.com.glsx.devicemonitor.api.feign.GpsBsFeignService
;
import
cn.com.glsx.stdinterface.common.enums.BizServiceType
;
import
cn.com.glsx.stdinterface.common.enums.DeviceComposeEnum
;
...
...
@@ -30,14 +29,12 @@ import com.google.gson.reflect.TypeToken;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.Resource
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.stream.Collectors
;
@Slf4j
@Service
...
...
@@ -67,9 +64,6 @@ public class WorkOrderService {
@Autowired
private
GpsBsFeignService
gpsBsFeignService
;
@Autowired
private
DeviceFeignService
deviceFeignService
;
/**
* 不需要登录得开放用户服务
*/
...
...
@@ -215,7 +209,7 @@ public class WorkOrderService {
}
private
String
getBhgServiceCode
(
String
orderSource
,
String
deviceSign
)
{
String
serviceCode
=
""
;
String
serviceCode
=
"
NES
"
;
if
(
OrderSourceEnum
.
ZLGJ
.
getCode
().
equals
(
orderSource
))
{
// 保活干那边仲利服务项目目前有这些,但是接口单只有008,009,010
// 有线 + 无线设备(仲利) 008
...
...
@@ -224,20 +218,20 @@ public class WorkOrderService {
// 有线设备(仲利) 016
// 无线 + 无线 + 无线设备(仲利) 018
if
(
DeviceComposeEnum
.
SINGLE_WIRED
.
getCode
().
equals
(
deviceSign
))
{
return
"016"
;
return
serviceCode
+
"016"
;
}
else
if
(
DeviceComposeEnum
.
SINGLE_WIRELESS
.
getCode
().
equals
(
deviceSign
))
{
return
"010"
;
return
serviceCode
+
"010"
;
}
else
if
(
DeviceComposeEnum
.
ONE_WIRED_ONE_WIRELESS
.
getCode
().
equals
(
deviceSign
))
{
return
"008"
;
return
serviceCode
+
"008"
;
}
else
if
(
DeviceComposeEnum
.
TWO_WIRELESS
.
getCode
().
equals
(
deviceSign
))
{
return
"009"
;
return
serviceCode
+
"009"
;
}
else
if
(
DeviceComposeEnum
.
THREE_WIRELESS
.
getCode
().
equals
(
deviceSign
))
{
return
"018"
;
return
serviceCode
+
"018"
;
}
}
else
if
(
OrderSourceEnum
.
PAZL
.
getCode
().
equals
(
orderSource
))
{
}
return
serviceCode
;
return
""
;
}
public
void
checkInstallOrder
(
InstallWorkOrderBO
orderReq
)
{
...
...
@@ -368,26 +362,35 @@ public class WorkOrderService {
List
<
DeviceLocationItem
>
devices
=
Lists
.
newArrayList
();
//目前只有GPS设备
verifyBO
.
getDevices
().
forEach
(
device
->
{
device
.
setDeviceCode
(
DeviceTypeRelationEnum
.
GPS
.
getDeviceCode
());
DeviceLocationItem
item
=
new
DeviceLocationItem
();
item
.
setSn
(
device
.
getSn
());
item
.
setDeviceCode
(
DeviceTypeRelationEnum
.
GPS
.
getDeviceCode
());
item
.
setCheckCode
(
device
.
getCheckCode
());
if
(
isApiCall
)
{
//设备类型补全、转换
DeviceWireTypeEnum
deviceWireTypeEnum
=
DeviceWireTypeEnum
.
findByBhgDeviceType
(
device
.
getDeviceCode
());
if
(
deviceWireTypeEnum
==
null
)
{
throw
new
StdInterfaceException
(
"2145415"
,
String
.
format
(
"%s设备类型(%s)有误"
,
device
.
getSn
(),
device
.
getDeviceCode
()));
}
item
.
setWireType
(
deviceWireTypeEnum
.
getType
());
}
devices
.
add
(
item
);
});
DeviceLocationRequest
deviceLocationRequest
=
new
DeviceLocationRequest
();
deviceLocationRequest
.
setVerifyTimeFlag
(
false
);
deviceLocationRequest
.
setDevices
(
devices
);
R
<
List
<
GpsBsData
>>
locationListR
=
gpsBsFeignService
.
locationCheck
(
deviceLocationRequest
);
log
.
info
(
"工单{}位置点验证结果:{}"
,
verifyBO
.
getWorkOrderNo
(),
JSONUtil
.
toJsonStr
(
locationListR
));
if
(!
locationListR
.
isSuccess
())
{
throw
new
StdInterfaceException
(
String
.
valueOf
(
locationListR
.
getCode
()),
locationListR
.
getMessage
());
//运营激活,不需要验证位置点
if
(
isApiCall
)
{
DeviceLocationRequest
deviceLocationRequest
=
new
DeviceLocationRequest
();
deviceLocationRequest
.
setVerifyTimeFlag
(
true
);
deviceLocationRequest
.
setBsBackfillGps
(
true
);
deviceLocationRequest
.
setDevices
(
devices
);
R
<
List
<
GpsBsData
>>
locationListR
=
gpsBsFeignService
.
locationCheck
(
deviceLocationRequest
);
log
.
info
(
"工单{}位置点验证结果:{}"
,
verifyBO
.
getBizWorkOrderNo
(),
JSONUtil
.
toJsonStr
(
locationListR
));
if
(!
locationListR
.
isSuccess
())
{
throw
new
StdInterfaceException
(
String
.
valueOf
(
locationListR
.
getCode
()),
locationListR
.
getMessage
());
}
}
// TODO: 2021/12/16 位置点存一下
}
/**
...
...
@@ -472,6 +475,8 @@ public class WorkOrderService {
vdev
.
setBindStatus
(
1
);
vdev
.
setTrialType
(
0
);
vdev
.
setHisType
(
0
);
vdev
.
setCreatedDate
(
new
Date
());
vdev
.
setCreatedBy
(
vehicle
.
getCreatedBy
());
devices
.
add
(
vdev
);
ActivatedVehicleDeviceDTO
deviceDTO
=
new
ActivatedVehicleDeviceDTO
();
...
...
@@ -481,10 +486,6 @@ public class WorkOrderService {
activatedDevices
.
add
(
deviceDTO
);
});
vehicleDeviceMapper
.
insertList
(
devices
);
//如果设备在新e盾设备库不存在,需要设备同步
List
<
String
>
snList
=
orderReq
.
getDevices
().
stream
().
map
(
SimpleDeviceItem:
:
getSn
).
collect
(
Collectors
.
toList
());
syncDevices
(
snList
);
}
return
activatedDevices
;
}
...
...
@@ -508,12 +509,4 @@ public class WorkOrderService {
return
vehicle
;
}
@Async
public
void
syncDevices
(
List
<
String
>
snList
)
{
snList
.
forEach
(
sn
->
{
R
<
DeviceDTO
>
deviceR
=
deviceFeignService
.
getOrStoreDeviceBySn
(
sn
,
true
);
log
.
info
(
"{}设备同步返回{}"
,
sn
,
JSONUtil
.
toJsonStr
(
deviceR
));
});
}
}
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