Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
Project
Project
Details
Activity
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
项目统一框架
amos-boot-biz
Commits
a97d4879
Commit
a97d4879
authored
Sep 23, 2021
by
kongfm
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
根据任务id 经纬度 返回距离事故电梯距离
parent
809b6dfb
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
79 additions
and
5 deletions
+79
-5
DispatchTaskMapper.java
...n/amos/boot/module/tzs/api/mapper/DispatchTaskMapper.java
+3
-0
IDispatchTaskService.java
...mos/boot/module/tzs/api/service/IDispatchTaskService.java
+2
-0
DispatchTaskMapper.xml
...-tzs-api/src/main/resources/mapper/DispatchTaskMapper.xml
+30
-0
RescueStationMapper.xml
...tzs-api/src/main/resources/mapper/RescueStationMapper.xml
+3
-3
WechatController.java
...amos/boot/module/tzs/biz/controller/WechatController.java
+35
-1
WechatRelationController.java
...t/module/tzs/biz/controller/WechatRelationController.java
+1
-1
DispatchTaskServiceImpl.java
.../module/tzs/biz/service/impl/DispatchTaskServiceImpl.java
+5
-0
No files found.
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/api/mapper/DispatchTaskMapper.java
View file @
a97d4879
...
...
@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.tzs.api.mapper;
import
com.yeejoin.amos.boot.module.tzs.api.entity.DispatchTask
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Param
;
/**
* 派遣任务 Mapper 接口
...
...
@@ -11,4 +12,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/
public
interface
DispatchTaskMapper
extends
BaseMapper
<
DispatchTask
>
{
String
returnDistanceByTaskId
(
@Param
(
"taskId"
)
Long
taskId
,
@Param
(
"lon"
)
String
lon
,
@Param
(
"lat"
)
String
lat
);
}
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/api/service/IDispatchTaskService.java
View file @
a97d4879
...
...
@@ -16,4 +16,6 @@ public interface IDispatchTaskService {
Boolean
createDispatchTask
(
DispatchTaskDto
dispatchTaskDto
,
AgencyUserModel
sendUser
);
DispatchTaskDto
getTaskInfo
(
String
orgTypeCode
,
Long
alertId
);
String
returnDistanceByTaskId
(
Long
taskId
,
String
longitude
,
String
latitude
);
}
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/resources/mapper/DispatchTaskMapper.xml
View file @
a97d4879
...
...
@@ -2,4 +2,34 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.yeejoin.amos.boot.module.tzs.api.mapper.DispatchTaskMapper"
>
<select
id=
"returnDistanceByTaskId"
resultType=
"java.lang.String"
>
select
(
ACOS(
SIN(
(#{lat} * PI()) / 180
) * SIN(
(
el.latitude * PI()
) / 180
) + COS(
(#{lat} * PI()) / 180
) * COS(
(
el.latitude * PI()
) / 180
) * COS(
(#{lon} * PI()) / 180 - (
el.longitude * PI()
) / 180
)
) * 6371000
) AS distance
from tz_dispatch_task ta
left JOIN tz_alert_called al on al.sequence_nbr = ta.alert_id
left JOIN tcb_elevator el on el.sequence_nbr = al.equipment_id
where ta.sequence_nbr = #{taskId}
</select>
</mapper>
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/resources/mapper/RescueStationMapper.xml
View file @
a97d4879
...
...
@@ -13,19 +13,19 @@
(
ACOS(
SIN(
(#{lat} *
3.1415
) / 180
(#{lat} *
PI()
) / 180
) * SIN(
(
tcb_rescue_station.latitude * PI()
) / 180
) + COS(
(#{lat} *
3.1415
) / 180
(#{lat} *
PI()
) / 180
) * COS(
(
tcb_rescue_station.latitude * PI()
) / 180
) * COS(
(#{lon} *
3.1415
) / 180 - (
(#{lon} *
PI()
) / 180 - (
tcb_rescue_station.longitude * PI()
) / 180
)
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/biz/controller/WechatController.java
View file @
a97d4879
...
...
@@ -5,13 +5,16 @@ import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.boot.module.tzs.api.dto.WechatAccessDto
;
import
com.yeejoin.amos.boot.module.tzs.api.entity.WechatRelation
;
import
com.yeejoin.amos.boot.module.tzs.api.service.IDispatchTaskService
;
import
com.yeejoin.amos.boot.module.tzs.api.service.IWechatService
;
import
com.yeejoin.amos.boot.module.tzs.biz.service.impl.WechatRelationServiceImpl
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.feign.systemctl.Systemctl
;
import
com.yeejoin.amos.feign.systemctl.model.SmsRecordModel
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
import
org.apache.commons.codec.digest.DigestUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -23,7 +26,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
org.w3c.dom.Node
;
...
...
@@ -62,6 +67,9 @@ public class WechatController extends BaseController {
@Autowired
WechatRelationServiceImpl
wechatRelationServiceImpl
;
@Autowired
IDispatchTaskService
dispatchTaskService
;
/**
...
...
@@ -182,7 +190,7 @@ public class WechatController extends BaseController {
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@GetMapping
(
value
=
"/getOpenIdTel/{code}"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"根据微信code获取openId和手机号接口"
,
notes
=
"根据微信code获取openId和手机号接口"
)
public
ResponseModel
<
WechatAccessDto
>
get
AccessToken
(
@PathVariable
String
code
)
{
public
ResponseModel
<
WechatAccessDto
>
get
OpenIdTel
(
@PathVariable
String
code
)
{
WechatAccessDto
wechatAccessDto
=
new
WechatAccessDto
();
String
openId
=
wechatService
.
getOpenId
(
code
);
if
(
StringUtils
.
isNotEmpty
(
openId
))
{
...
...
@@ -195,6 +203,32 @@ public class WechatController extends BaseController {
return
ResponseHelper
.
buildResponse
(
wechatAccessDto
);
}
/**
* 根据任务id 经纬度 返回现在距离任务距离
*
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@PostMapping
(
value
=
"/returnDistance"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"根据任务id 经纬度 返回现在距离任务距离"
,
notes
=
"根据任务id 经纬度 返回现在距离任务距离"
)
public
ResponseModel
<
String
>
returnDistance
(
@ApiParam
(
value
=
"任务id"
,
required
=
true
)
@RequestParam
(
name
=
"taskId"
)
Long
taskId
,
@ApiParam
(
value
=
"经度"
,
required
=
true
)
@RequestParam
(
name
=
"longitude"
)
String
longitude
,
@ApiParam
(
value
=
"纬度"
,
required
=
true
)
@RequestParam
(
name
=
"latitude"
)
String
latitude
)
{
if
(
ValidationUtil
.
isEmpty
(
taskId
)
||
ValidationUtil
.
isEmpty
(
longitude
)
||
ValidationUtil
.
isEmpty
(
latitude
)){
throw
new
BadRequest
(
"参数校验失败."
);
}
String
distance
=
dispatchTaskService
.
returnDistanceByTaskId
(
taskId
,
longitude
,
latitude
);
return
ResponseHelper
.
buildResponse
(
distance
);
}
/**
* 创建验证码
* @return
*/
public
static
String
getrandom
(){
String
code
=
""
;
Random
random
=
new
Random
();
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/biz/controller/WechatRelationController.java
View file @
a97d4879
...
...
@@ -27,7 +27,7 @@ import org.typroject.tyboot.core.foundation.enumeration.UserType;
* @date 2021-09-22
*/
@RestController
@Api
(
tags
=
"openId与手机号对应关系
表
"
)
@Api
(
tags
=
"openId与手机号对应关系
API
"
)
@RequestMapping
(
value
=
"/wechat-relation"
)
public
class
WechatRelationController
extends
BaseController
{
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/biz/service/impl/DispatchTaskServiceImpl.java
View file @
a97d4879
...
...
@@ -168,6 +168,11 @@ public class DispatchTaskServiceImpl extends BaseService<DispatchTaskDto,Dispatc
return
dispatchTaskDto
;
}
@Override
public
String
returnDistanceByTaskId
(
Long
taskId
,
String
longitude
,
String
latitude
)
{
return
baseMapper
.
returnDistanceByTaskId
(
taskId
,
longitude
,
latitude
);
}
@Transactional
@Override
public
Boolean
createDispatchTask
(
DispatchTaskDto
dispatchTaskDto
,
AgencyUserModel
sendUser
)
{
...
...
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