Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
黄嘉阳
/
iot-platform-server
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
c6815154
authored
Sep 19, 2023
by
朱淼
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
定位
parent
dc8106e9
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
7 deletions
server-module/src/main/java/com/makeit/module/controller/space/PlatRegionSettingController.java
server-module/src/main/java/com/makeit/module/controller/wechat/space/PlatRegionSettingWechatController.java
server-service/src/main/java/com/makeit/service/platform/space/PlatRegionSettingService.java
server-service/src/main/java/com/makeit/service/platform/space/impl/PlatRegionSettingServiceImpl.java
server-module/src/main/java/com/makeit/module/controller/space/PlatRegionSettingController.java
View file @
c6815154
...
...
@@ -52,11 +52,18 @@ public class PlatRegionSettingController {
return
ApiResponseUtils
.
success
();
}
@ApiOperation
(
"定位"
)
@ApiOperation
(
"定位
(时间范围内定位)
"
)
@PostMapping
(
"locate"
)
public
ApiResponseEntity
<
List
<
PlatElderCoordinateVO
>>
locate
(
@RequestBody
PlatRegionSettingLocateDTO
dto
)
{
List
<
PlatElderCoordinateVO
>
list
=
platRegionSettingService
.
locate
(
dto
);
return
ApiResponseUtils
.
success
(
list
);
}
@ApiOperation
(
"实时定位"
)
@PostMapping
(
"nowDataLocate"
)
public
ApiResponseEntity
<
PlatElderCoordinateVO
>
nowDataLocate
(
@RequestBody
PlatRegionSettingLocateDTO
dto
)
{
PlatElderCoordinateVO
vo
=
platRegionSettingService
.
nowDataLocate
(
dto
);
return
ApiResponseUtils
.
success
(
vo
);
}
}
server-module/src/main/java/com/makeit/module/controller/wechat/space/PlatRegionSettingWechatController.java
View file @
c6815154
...
...
@@ -53,10 +53,17 @@ public class PlatRegionSettingWechatController {
return
ApiResponseUtils
.
success
();
}
@ApiOperation
(
"定位"
)
@ApiOperation
(
"定位
(时间范围内定位)
"
)
@PostMapping
(
"locate"
)
public
ApiResponseEntity
<
List
<
PlatElderCoordinateVO
>>
locate
(
@RequestBody
PlatRegionSettingLocateDTO
dto
)
{
List
<
PlatElderCoordinateVO
>
list
=
platRegionSettingService
.
locate
(
dto
);
return
ApiResponseUtils
.
success
(
list
);
}
@ApiOperation
(
"实时定位"
)
@PostMapping
(
"nowDataLocate"
)
public
ApiResponseEntity
<
PlatElderCoordinateVO
>
nowDataLocate
(
@RequestBody
PlatRegionSettingLocateDTO
dto
)
{
PlatElderCoordinateVO
vo
=
platRegionSettingService
.
nowDataLocate
(
dto
);
return
ApiResponseUtils
.
success
(
vo
);
}
}
server-service/src/main/java/com/makeit/service/platform/space/PlatRegionSettingService.java
View file @
c6815154
...
...
@@ -46,4 +46,6 @@ public interface PlatRegionSettingService extends IService<PlatRegionSetting> {
void
batchEdit
(
List
<
PlatRegionSettingDTO
>
dtos
);
List
<
PlatElderCoordinateVO
>
locate
(
PlatRegionSettingLocateDTO
dto
);
PlatElderCoordinateVO
nowDataLocate
(
PlatRegionSettingLocateDTO
dto
);
}
server-service/src/main/java/com/makeit/service/platform/space/impl/PlatRegionSettingServiceImpl.java
View file @
c6815154
...
...
@@ -20,6 +20,7 @@ import com.makeit.service.platform.device.PlatDeviceService;
import
com.makeit.service.platform.space.PlatRegionSettingService
;
import
com.makeit.utils.data.convert.BeanDtoVoUtils
;
import
com.makeit.utils.data.convert.JsonUtil
;
import
com.makeit.utils.data.validate.CollectionUtils
;
import
com.makeit.vo.platform.elder.realtime.PlatElderCoordinateVO
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -27,10 +28,7 @@ import org.springframework.transaction.annotation.Transactional;
import
java.math.BigDecimal
;
import
java.math.RoundingMode
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.*
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
...
...
@@ -166,7 +164,7 @@ public class PlatRegionSettingServiceImpl extends ServiceImpl<PlatRegionSettingM
@Override
public
List
<
PlatElderCoordinateVO
>
locate
(
PlatRegionSettingLocateDTO
dto
)
{
List
<
PlatElderCoordinateVO
>
vos
=
new
ArrayList
<>();
List
<
DeviceOperationLogEntity
>
list
=
iotProductDeviceService
.
getDeviceLogByTimeRange
(
dto
.
getDeviceId
(),
"reportProperty"
,
10
,
dto
.
getStartTime
(),
dto
.
getEndTime
());
List
<
DeviceOperationLogEntity
>
list
=
iotProductDeviceService
.
getDeviceLogByTimeRange
(
dto
.
getDeviceId
(),
"reportProperty"
,
10
0
,
dto
.
getStartTime
(),
dto
.
getEndTime
());
for
(
DeviceOperationLogEntity
log
:
list
){
DeviceInfoContentSpace
space
=
JsonUtil
.
toObj
((
String
)
log
.
getContent
(),
DeviceInfoContentSpace
.
class
);
if
(
space
.
getProperties
()!=
null
){
...
...
@@ -179,4 +177,18 @@ public class PlatRegionSettingServiceImpl extends ServiceImpl<PlatRegionSettingM
}
return
vos
;
}
@Override
public
PlatElderCoordinateVO
nowDataLocate
(
PlatRegionSettingLocateDTO
dto
)
{
PlatElderCoordinateVO
vo
=
new
PlatElderCoordinateVO
();
DeviceInfoContentSpace
space
=
iotProductDeviceService
.
getLastDeviceLogSpace
(
dto
.
getDeviceId
(),
10
);
if
(
space
==
null
){
return
null
;
}
if
(
space
.
getProperties
()!=
null
){
vo
.
setX
(
new
BigDecimal
(
space
.
getProperties
().
getDistance
()).
multiply
(
new
BigDecimal
(
Math
.
cos
(
space
.
getProperties
().
getAngle
())
+
""
)).
setScale
(
2
,
RoundingMode
.
HALF_UP
));
vo
.
setY
(
new
BigDecimal
(
space
.
getProperties
().
getDistance
()).
multiply
(
new
BigDecimal
(
Math
.
sin
(
space
.
getProperties
().
getAngle
())
+
""
)).
setScale
(
2
,
RoundingMode
.
HALF_UP
));
}
return
vo
;
}
}
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