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
77924dc6
Commit
77924dc6
authored
Feb 13, 2023
by
wujiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交车辆管理新代码
parent
d95095f2
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
897 additions
and
42 deletions
+897
-42
Car.java
.../main/java/com/yeejoin/equipmanage/common/entity/Car.java
+17
-9
WlCarMileage.java
...a/com/yeejoin/equipmanage/common/entity/WlCarMileage.java
+86
-0
CarTravelDto.java
...m/yeejoin/equipmanage/common/entity/dto/CarTravelDto.java
+19
-0
EquipTypeAmountPageDTO.java
...equipmanage/common/entity/dto/EquipTypeAmountPageDTO.java
+13
-0
EquipTypeImgAmountVO.java
...in/equipmanage/common/entity/vo/EquipTypeImgAmountVO.java
+6
-0
CoordinateUtil.java
.../com/yeejoin/equipmanage/common/utils/CoordinateUtil.java
+18
-0
QRCodeUtil.java
...java/com/yeejoin/equipmanage/common/utils/QRCodeUtil.java
+41
-0
CORSFilter.java
.../main/java/com/yeejoin/equipmanage/config/CORSFilter.java
+52
-0
CarController.java
...ava/com/yeejoin/equipmanage/controller/CarController.java
+0
-0
Coordinate.java
...n/java/com/yeejoin/equipmanage/controller/Coordinate.java
+15
-0
FireFightingSystemController.java
.../equipmanage/controller/FireFightingSystemController.java
+44
-0
WlCarMileageController.java
...eejoin/equipmanage/controller/WlCarMileageController.java
+223
-0
IotFeign.java
...src/main/java/com/yeejoin/equipmanage/fegin/IotFeign.java
+25
-28
CarIotListener.java
...java/com/yeejoin/equipmanage/listener/CarIotListener.java
+165
-0
WlCarMileageMapper.java
...va/com/yeejoin/equipmanage/mapper/WlCarMileageMapper.java
+21
-0
ICarService.java
...ain/java/com/yeejoin/equipmanage/service/ICarService.java
+10
-5
IWlCarMileageService.java
...com/yeejoin/equipmanage/service/IWlCarMileageService.java
+23
-0
CarServiceImpl.java
.../com/yeejoin/equipmanage/service/impl/CarServiceImpl.java
+0
-0
FireFightingSystemServiceImpl.java
...uipmanage/service/impl/FireFightingSystemServiceImpl.java
+0
-0
WlCarMileageServiceImpl.java
...oin/equipmanage/service/impl/WlCarMileageServiceImpl.java
+67
-0
AmostEquipApplication.java
...quip/src/main/java/com/yeejoin/AmostEquipApplication.java
+20
-0
FireFightingSystemMapper.xml
...ip/src/main/resources/mapper/FireFightingSystemMapper.xml
+7
-0
WlCarMileageMapper.xml
...em-equip/src/main/resources/mapper/WlCarMileageMapper.xml
+25
-0
No files found.
amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/entity/Car.java
View file @
77924dc6
...
...
@@ -104,10 +104,7 @@ public class Car extends BaseEntity {
@ApiModelProperty
(
value
=
"队伍名称(冗余字段来源于平台)"
)
private
String
teamName
;
//新加
@ApiModelProperty
(
value
=
"机构/部门名称"
)
@TableField
(
"biz_org_name"
)
private
String
bizOrgName
;
...
...
@@ -116,12 +113,6 @@ public class Car extends BaseEntity {
@TableField
(
"biz_org_code"
)
private
String
bizOrgCode
;
@ApiModelProperty
(
value
=
"图片"
)
@TableField
(
exist
=
false
)
private
List
<
UploadFile
>
img
;
...
...
@@ -176,4 +167,21 @@ public class Car extends BaseEntity {
@TableField
(
exist
=
false
)
private
String
iotStatus
;
@TableField
(
exist
=
false
)
private
Long
categoryId
;
@TableField
(
exist
=
false
)
private
String
importStr
;
@TableField
(
exist
=
false
)
private
Integer
totalTravel
;
@TableField
(
exist
=
false
)
private
double
longtitude
;
@TableField
(
exist
=
false
)
private
double
latitude
;
@TableField
(
exist
=
false
)
private
Integer
speed
;
}
amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/entity/WlCarMileage.java
0 → 100644
View file @
77924dc6
package
com
.
yeejoin
.
equipmanage
.
common
.
entity
;
import
java.sql.Time
;
import
java.util.Date
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.yeejoin.equipmanage.common.entity.publics.BaseEntity
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
/**
* 车量里程表
*
* @author duanwei
* @date 2023-02-01
*/
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@Accessors
(
chain
=
true
)
@ApiModel
(
value
=
"WlCarMileage对象"
,
description
=
"车量里程表"
)
public
class
WlCarMileage
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
1L
;
@ApiModelProperty
(
value
=
"iot编码"
)
private
String
iotCode
;
@ApiModelProperty
(
value
=
"里程km"
)
private
Double
travel
;
@ApiModelProperty
(
value
=
"日期"
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd"
)
private
Date
date
;
@ApiModelProperty
(
value
=
"开始时间"
)
private
Date
startTime
;
@ApiModelProperty
(
value
=
"结束时间"
)
private
Date
endTime
;
@ApiModelProperty
(
value
=
"耗时"
)
private
Long
takeTime
;
@ApiModelProperty
(
value
=
"开始地址"
)
private
String
startName
;
@ApiModelProperty
(
value
=
"结束地址"
)
private
String
endName
;
@ApiModelProperty
(
value
=
"开始精度"
)
private
Double
startLongitude
;
@ApiModelProperty
(
value
=
"开始纬度"
)
private
Double
startLatitude
;
@ApiModelProperty
(
value
=
"结束精度"
)
private
Double
endLongitude
;
@ApiModelProperty
(
value
=
"结束纬度"
)
private
Double
endLatitude
;
@ApiModelProperty
(
value
=
"开始速度km/h"
)
private
Integer
startSpeed
;
@ApiModelProperty
(
value
=
"结束速度km/h"
)
private
Integer
endSpeed
;
@TableField
(
exist
=
false
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd"
)
private
Date
filterDate
;
@TableField
(
exist
=
false
)
private
String
name
;
@TableField
(
exist
=
false
)
private
String
time
;
@TableField
(
exist
=
false
)
private
long
carId
;
}
amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/entity/dto/CarTravelDto.java
0 → 100644
View file @
77924dc6
package
com
.
yeejoin
.
equipmanage
.
common
.
entity
.
dto
;
import
java.util.List
;
import
com.yeejoin.equipmanage.common.entity.WlCarMileage
;
import
lombok.Data
;
@Data
public
class
CarTravelDto
{
Long
total
;
String
totalTime
;
Integer
totalTravel
;
List
<
WlCarMileage
>
records
;
}
amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/entity/dto/EquipTypeAmountPageDTO.java
View file @
77924dc6
...
...
@@ -66,4 +66,17 @@ public class EquipTypeAmountPageDTO extends BaseDTO<EquipmentSpecific> {
@ApiModelProperty
(
value
=
"缺陷管理新增页面用,其余地方可忽略 1-是缺陷管理 0-不是"
)
private
Integer
isDefect
;
@ApiModelProperty
(
value
=
"关键字-地图用"
)
private
String
keyword
;
@ApiModelProperty
(
value
=
"页数-地图用"
)
private
Integer
current
;
@ApiModelProperty
(
value
=
"分页大小-地图用"
)
private
Integer
size
;
@ApiModelProperty
(
value
=
"车牌号"
)
private
String
carNum
;
}
amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/entity/vo/EquipTypeImgAmountVO.java
View file @
77924dc6
...
...
@@ -55,4 +55,10 @@ public class EquipTypeImgAmountVO {
@ApiModelProperty
(
value
=
"所在建筑"
)
private
String
belongBuildName
;
@ApiModelProperty
(
value
=
"精度"
)
private
Double
longitude
;
@ApiModelProperty
(
value
=
"纬度"
)
private
Double
latitude
;
}
amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/utils/CoordinateUtil.java
0 → 100644
View file @
77924dc6
package
com
.
yeejoin
.
equipmanage
.
common
.
utils
;
public
class
CoordinateUtil
{
// WGS84标准参考椭球中的地球长半径(单位:千米)
private
static
final
double
EARH_RADIUS_WGS84
=
6378137.0
/
1000
;
public
static
double
distance
(
double
lat1
,
double
lng1
,
double
lat2
,
double
lng2
)
{
double
radLat1
=
Math
.
toRadians
(
lat1
);
double
radLat2
=
Math
.
toRadians
(
lat2
);
double
a
=
radLat1
-
radLat2
;
double
b
=
Math
.
toRadians
(
lng1
)
-
Math
.
toRadians
(
lng2
);
double
s
=
2
*
Math
.
asin
(
Math
.
sqrt
(
Math
.
pow
(
Math
.
sin
(
a
/
2
),
2
)
+
Math
.
cos
(
radLat1
)
*
Math
.
cos
(
radLat2
)
*
Math
.
pow
(
Math
.
sin
(
b
/
2
),
2
)));
return
Math
.
round
(
s
*
EARH_RADIUS_WGS84
);
}
}
amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/utils/QRCodeUtil.java
View file @
77924dc6
...
...
@@ -226,4 +226,45 @@ public class QRCodeUtil {
System
.
out
.
println
(
genQrCodeBase64PngWithWord
(
"101"
,
100
,
100
,
"sd"
,
100
));
}
/**
* 根据二维码信息,生成二维码图片 用户excel,word等导出图片 可自定义图片大小
*
* @param content
* @return
*/
public
static
byte
[]
generateQRCodeImageByteData
(
String
content
,
int
size
)
{
ByteArrayOutputStream
out
=
new
ByteArrayOutputStream
();
try
{
Hashtable
<
EncodeHintType
,
Object
>
hints
=
new
Hashtable
<
EncodeHintType
,
Object
>();
hints
.
put
(
EncodeHintType
.
ERROR_CORRECTION
,
ErrorCorrectionLevel
.
H
);
hints
.
put
(
EncodeHintType
.
CHARACTER_SET
,
CHARSET
);
hints
.
put
(
EncodeHintType
.
MARGIN
,
1
);
BitMatrix
bitMatrix
=
new
MultiFormatWriter
().
encode
(
content
,
BarcodeFormat
.
QR_CODE
,
size
,
size
,
hints
);
int
width
=
bitMatrix
.
getWidth
();
int
height
=
bitMatrix
.
getHeight
();
BufferedImage
image
=
new
BufferedImage
(
width
,
height
,
BufferedImage
.
TYPE_INT_RGB
);
for
(
int
x
=
0
;
x
<
width
;
x
++)
{
for
(
int
y
=
0
;
y
<
height
;
y
++)
{
image
.
setRGB
(
x
,
y
,
bitMatrix
.
get
(
x
,
y
)
?
0xFF000000
:
0xFFFFFFFF
);
}
}
ImageIO
.
write
(
image
,
"png"
,
out
);
return
out
.
toByteArray
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
finally
{
try
{
out
.
close
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
return
null
;
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/config/CORSFilter.java
0 → 100644
View file @
77924dc6
package
com
.
yeejoin
.
equipmanage
.
config
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.core.Ordered
;
import
org.springframework.core.annotation.Order
;
import
javax.servlet.*
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
/**
* @program: api
* @description:
* @author: duanwei
* @create: 2019-12-13 11:16
**/
@Order
(
Ordered
.
HIGHEST_PRECEDENCE
)
@Configuration
public
class
CORSFilter
implements
Filter
{
@Override
public
void
init
(
FilterConfig
filterConfig
)
throws
ServletException
{
}
@Override
public
void
doFilter
(
ServletRequest
servletRequest
,
ServletResponse
servletResponse
,
FilterChain
filterChain
)
throws
IOException
,
ServletException
{
HttpServletRequest
request
=
(
HttpServletRequest
)
servletRequest
;
HttpServletResponse
response
=
(
HttpServletResponse
)
servletResponse
;
response
.
setHeader
(
"Access-Control-Allow-Origin"
,
"*"
);
response
.
setHeader
(
"Access-Control-Allow-Methods"
,
"POST,GET,OPTIONS,PUT,DELETE,PATCH,HEAD"
);
response
.
setHeader
(
"Access-Control-Allow-Credentials"
,
"true"
);
response
.
setHeader
(
"Access-Control-Allow-Max-Age"
,
"3600"
);
response
.
setHeader
(
"Access-Control-Allow-Headers"
,
"Origin, X-Requested-With, X-Access-Token, X-Api-Key, Content-Type, Accept, Cache-Control,appkey,token,product"
);
//response.setHeader("Access-Control-Allow-Headers","*");
if
(
"OPTIONS"
.
equalsIgnoreCase
(
request
.
getMethod
()))
{
response
.
setStatus
(
HttpServletResponse
.
SC_OK
);
}
else
{
filterChain
.
doFilter
(
servletRequest
,
servletResponse
);
}
}
@Override
public
void
destroy
()
{
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/controller/CarController.java
View file @
77924dc6
This diff is collapsed.
Click to expand it.
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/controller/Coordinate.java
0 → 100644
View file @
77924dc6
package
com
.
yeejoin
.
equipmanage
.
controller
;
import
java.util.List
;
import
lombok.Data
;
@Data
public
class
Coordinate
{
//经纬度
private
List
<
Double
>
lnglat
;
//车速
private
int
speed
;
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/controller/FireFightingSystemController.java
View file @
77924dc6
...
...
@@ -492,6 +492,50 @@ public class FireFightingSystemController extends AbstractBaseController {
}
@GetMapping
(
value
=
"/getEquipTypeAmountCar"
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"九大类下装备,通过code截取"
,
notes
=
"九大类下装备信息列表"
)
public
IPage
<
EquipTypeImgAmountVO
>
getEquipTypeAmountCarByGet
(
EquipTypeAmountPageDTO
equipTypeAmountPage
)
{
String
[]
result
=
hierarchy
.
split
(
","
);
Map
<
Integer
,
Integer
>
map
=
new
HashMap
<>();
for
(
int
i
=
0
;
i
<
result
.
length
;
i
++)
{
map
.
put
(
i
,
Integer
.
valueOf
(
result
[
i
]));
}
if
(
equipTypeAmountPage
.
getCurrent
()!=
null
&&
equipTypeAmountPage
.
getSize
()!=
null
)
{
equipTypeAmountPage
.
setPage
(
new
Page
<>(
equipTypeAmountPage
.
getCurrent
(),
equipTypeAmountPage
.
getSize
()));
}
if
(
StringUtil
.
isNotEmpty
(
equipTypeAmountPage
.
getEquipmentClassificationCode
()))
{
QueryWrapper
<
EquipmentCategory
>
equipmentCategoryQueryWrapper
=
new
QueryWrapper
<>();
equipmentCategoryQueryWrapper
.
eq
(
"code"
,
equipTypeAmountPage
.
getEquipmentClassificationCode
());
equipmentCategoryQueryWrapper
.
eq
(
"industry_code"
,
equipTypeAmountPage
.
getIndustryCode
());
EquipmentCategory
equipmentCategory
=
equipmentCategoryService
.
getOne
(
equipmentCategoryQueryWrapper
);
if
(
equipmentCategory
==
null
)
{
throw
new
RuntimeException
(
"装备定义code有误"
);
}
int
inhierarchy
=
1
;
for
(
int
i
=
0
;
i
<
result
.
length
+
1
;
i
++)
{
//进来先判断是否默认就是空,如果为空第一层
if
(
equipmentCategory
.
getParentId
()
==
null
)
{
//判断是否是最下面的子节点
if
(
i
>=
4
)
{
inhierarchy
=
8
;
}
else
{
inhierarchy
=
map
.
get
(
i
);
}
break
;
}
else
{
//查找到循环几次为空
equipmentCategory
=
equipmentCategoryService
.
getById
(
equipmentCategory
.
getParentId
());
}
}
return
fireFightingSystemService
.
getColaCategoryAmountCarList
(
inhierarchy
,
equipTypeAmountPage
.
getEquipmentClassificationCode
().
substring
(
0
,
inhierarchy
),
equipTypeAmountPage
);
}
else
{
return
fireFightingSystemService
.
getColaCategoryAmountCarList
(
0
,
null
,
equipTypeAmountPage
);
}
}
@PostMapping
(
value
=
"/getEquipTypeAmountEqu"
)
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/controller/WlCarMileageController.java
0 → 100644
View file @
77924dc6
package
com
.
yeejoin
.
equipmanage
.
controller
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Date
;
import
java.util.List
;
import
javax.servlet.http.HttpServletRequest
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.MediaType
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.equipmanage.common.entity.WlCarMileage
;
import
com.yeejoin.equipmanage.common.entity.dto.CarTravelDto
;
import
com.yeejoin.equipmanage.common.utils.NameUtils
;
import
com.yeejoin.equipmanage.service.IWlCarMileageService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
/**
* 车量里程表
*
* @author duanwei
* @date 2023-02-01
*/
@RestController
@Api
(
tags
=
"车量里程表Api"
)
@RequestMapping
(
value
=
"/wl-car-mileage"
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
public
class
WlCarMileageController
{
@Autowired
IWlCarMileageService
iWlCarMileageService
;
/**
* 新增车量里程表
*
* @return
*/
@RequestMapping
(
value
=
"/save"
,
method
=
RequestMethod
.
POST
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"新增车量里程表"
,
notes
=
"新增车量里程表"
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
public
boolean
saveWlCarMileage
(
HttpServletRequest
request
,
@RequestBody
WlCarMileage
wlCarMileage
)
{
return
iWlCarMileageService
.
save
(
wlCarMileage
);
}
/**
* 根据id删除
*
* @param id
* @return
*/
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
DELETE
)
@ApiOperation
(
httpMethod
=
"DELETE"
,
value
=
"根据id删除"
,
notes
=
"根据id删除"
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
public
boolean
deleteById
(
HttpServletRequest
request
,
@PathVariable
Long
id
)
{
return
iWlCarMileageService
.
removeById
(
id
);
}
/**
* 修改车量里程表
*
* @return
*/
@RequestMapping
(
value
=
"/updateById"
,
method
=
RequestMethod
.
PUT
)
@ApiOperation
(
httpMethod
=
"PUT"
,
value
=
"修改车量里程表"
,
notes
=
"修改车量里程表"
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
public
boolean
updateByIdWlCarMileage
(
HttpServletRequest
request
,
@RequestBody
WlCarMileage
wlCarMileage
)
{
return
iWlCarMileageService
.
updateById
(
wlCarMileage
);
}
/**
* 根据id查询
*
* @param id
* @return
*/
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"根据id查询"
,
notes
=
"根据id查询"
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
public
WlCarMileage
selectById
(
HttpServletRequest
request
,
@PathVariable
Long
id
)
{
return
iWlCarMileageService
.
getById
(
id
);
}
/**
* 列表分页查询
*
* @return
*/
@RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"列表分页查询"
,
notes
=
"列表分页查询"
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
public
IPage
<
WlCarMileage
>
listPage
(
String
pageNum
,
String
pageSize
,
WlCarMileage
wlCarMileage
)
{
Page
<
WlCarMileage
>
pageBean
;
QueryWrapper
<
WlCarMileage
>
wlCarMileageQueryWrapper
=
new
QueryWrapper
<>();
Class
<?
extends
WlCarMileage
>
aClass
=
wlCarMileage
.
getClass
();
Arrays
.
stream
(
aClass
.
getDeclaredFields
()).
forEach
(
field
->
{
try
{
field
.
setAccessible
(
true
);
Object
o
=
field
.
get
(
wlCarMileage
);
if
(
o
!=
null
)
{
Class
<?>
type
=
field
.
getType
();
String
name
=
NameUtils
.
camel2Underline
(
field
.
getName
());
if
(
type
.
equals
(
Integer
.
class
))
{
Integer
fileValue
=
(
Integer
)
field
.
get
(
wlCarMileage
);
wlCarMileageQueryWrapper
.
eq
(
name
,
fileValue
);
}
else
if
(
type
.
equals
(
Long
.
class
))
{
Long
fileValue
=
(
Long
)
field
.
get
(
wlCarMileage
);
wlCarMileageQueryWrapper
.
eq
(
name
,
fileValue
);
}
else
if
(
type
.
equals
(
String
.
class
))
{
String
fileValue
=
(
String
)
field
.
get
(
wlCarMileage
);
wlCarMileageQueryWrapper
.
eq
(
name
,
fileValue
);
}
else
if
(
type
.
equals
(
Date
.
class
))
{
Date
fileValue
=
(
Date
)
field
.
get
(
wlCarMileage
);
wlCarMileageQueryWrapper
.
eq
(
name
,
fileValue
);
}
else
{
String
fileValue
=
(
String
)
field
.
get
(
wlCarMileage
);
wlCarMileageQueryWrapper
.
eq
(
name
,
fileValue
);
}
}
}
catch
(
Exception
e
)
{
}
});
IPage
<
WlCarMileage
>
page
;
if
(
StringUtils
.
isBlank
(
pageNum
)
||
StringUtils
.
isBlank
(
pageSize
))
{
pageBean
=
new
Page
<>(
0
,
Long
.
MAX_VALUE
);
}
else
{
pageBean
=
new
Page
<>(
Integer
.
parseInt
(
pageNum
),
Integer
.
parseInt
(
pageSize
));
}
page
=
iWlCarMileageService
.
page
(
pageBean
,
wlCarMileageQueryWrapper
);
return
page
;
}
/**
* 列表分页查询
*
* @return
*/
@RequestMapping
(
value
=
"/page"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"列表分页查询"
,
notes
=
"列表分页查询"
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
public
CarTravelDto
page
(
Integer
pageNum
,
Integer
pageSize
,
WlCarMileage
wlCarMileage
)
{
Page
<
WlCarMileage
>
pageBean
;
if
(
pageNum
==
null
||
pageSize
==
null
)
{
pageBean
=
new
Page
<>(
0
,
Long
.
MAX_VALUE
);
}
else
{
pageBean
=
new
Page
<>(
pageNum
,
pageSize
);
}
Page
<
WlCarMileage
>
page
=
iWlCarMileageService
.
page
(
pageBean
,
wlCarMileage
);
CarTravelDto
carTravelDto
=
new
CarTravelDto
();
carTravelDto
.
setRecords
(
page
.
getRecords
());
carTravelDto
.
setTotal
(
page
.
getTotal
());
long
totalTime
=
0
;
int
totalTravel
=
0
;
for
(
WlCarMileage
wl
:
page
.
getRecords
())
{
totalTravel
+=
wl
.
getTravel
();
totalTime
+=
wl
.
getTakeTime
();
}
// // 初始化format格式
// SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss");
// // 设置时区,跳过此步骤会默认设置为"GMT+08:00" 得到的结果会多出来8个小时
// dateFormat.setTimeZone(TimeZone.getTimeZone("GMT+00:00"));
//
// String timeStr = dateFormat.format(totalTime);
carTravelDto
.
setTotalTime
(
millisToStringShort
(
totalTime
));
carTravelDto
.
setTotalTravel
(
totalTravel
);
return
carTravelDto
;
}
public
String
millisToStringShort
(
long
millis
)
{
StringBuffer
strBuilder
=
new
StringBuffer
();
long
temp
=
millis
;
long
hper
=
60
*
60
*
1000
;
long
mper
=
60
*
1000
;
long
sper
=
1000
;
if
(
temp
/
hper
>
0
)
{
if
((
temp
/
hper
)
<
10
)
{
strBuilder
.
append
(
0
);
}
strBuilder
.
append
(
temp
/
hper
).
append
(
":"
);
}
temp
=
temp
%
hper
;
if
(
temp
/
mper
>
0
)
{
if
((
temp
/
mper
)
<
10
)
{
strBuilder
.
append
(
0
);
}
strBuilder
.
append
(
temp
/
mper
).
append
(
":"
);
}
temp
=
temp
%
mper
;
if
(
temp
/
sper
>
0
)
{
if
((
temp
/
sper
)
<
10
)
{
strBuilder
.
append
(
0
);
}
strBuilder
.
append
(
temp
/
sper
);
}
return
strBuilder
.
toString
();
}
/**
* 获取轨迹
*
* @return
*/
@RequestMapping
(
value
=
"/travel"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"获取轨迹"
,
notes
=
"获取轨迹"
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
public
List
<
Coordinate
>
travel
(
long
id
)
{
return
iWlCarMileageService
.
getCoordinateList
(
id
);
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/fegin/IotFeign.java
View file @
77924dc6
package
com
.
yeejoin
.
equipmanage
.
fegin
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestHeader
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
/**
* @author DELL
*/
@FeignClient
(
name
=
"${iot.vehicle.track}"
,
path
=
"iot"
,
configuration
=
{
FeignConfiguration
.
class
})
//@FeignClient(name = "AMOS-API-IOT", path = "iot", configuration = {
// FeignConfiguration.class }, url = "http://39.98.224.23:33001")
@FeignClient
(
name
=
"AMOS-API-IOT"
,
path
=
"iot"
,
configuration
=
{
FeignConfiguration
.
class
})
public
interface
IotFeign
{
@RequestMapping
(
value
=
"/v1/livedata/list"
,
method
=
RequestMethod
.
GET
,
consumes
=
"application/json"
)
ResponseModel
selectList
(
@RequestHeader
(
"appKey"
)
String
appKey
,
@RequestHeader
(
"product"
)
String
product
,
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"timeStart"
)
String
beginDate
,
@RequestParam
(
value
=
"timeEnd"
)
String
endDate
,
@RequestParam
(
value
=
"productKey"
)
String
productKey
,
ResponseModel
selectList
(
@RequestHeader
(
"appKey"
)
String
appKey
,
@RequestHeader
(
"product"
)
String
product
,
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"timeStart"
)
String
beginDate
,
@RequestParam
(
value
=
"timeEnd"
)
String
endDate
,
@RequestParam
(
value
=
"productKey"
)
String
productKey
,
@RequestParam
(
value
=
"deviceName"
)
String
deviceName
,
@RequestParam
(
required
=
false
,
value
=
"fieldKey"
)
String
fieldKey
);
@RequestMapping
(
value
=
"/v1/livedata/page"
,
method
=
RequestMethod
.
GET
,
consumes
=
"application/json"
)
ResponseModel
selectPage
(
@RequestHeader
(
"appKey"
)
String
appKey
,
@RequestHeader
(
"product"
)
String
product
,
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"timeStart"
)
String
beginDate
,
@RequestParam
(
value
=
"timeEnd"
)
String
endDate
,
@RequestParam
(
value
=
"productKey"
)
String
productKey
,
ResponseModel
selectPage
(
@RequestHeader
(
"appKey"
)
String
appKey
,
@RequestHeader
(
"product"
)
String
product
,
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"timeStart"
)
String
beginDate
,
@RequestParam
(
value
=
"timeEnd"
)
String
endDate
,
@RequestParam
(
value
=
"productKey"
)
String
productKey
,
@RequestParam
(
value
=
"deviceName"
)
String
deviceName
,
@RequestParam
(
required
=
false
,
value
=
"fieldKey"
)
String
fieldKey
,
@RequestParam
(
value
=
"current"
)
Integer
current
,
@RequestParam
(
value
=
"size"
)
Integer
size
);
@RequestParam
(
value
=
"current"
)
Integer
current
,
@RequestParam
(
value
=
"size"
)
Integer
size
);
@RequestMapping
(
value
=
"v1/livedata/common/top"
,
method
=
RequestMethod
.
GET
,
consumes
=
"application/json"
)
ResponseModel
selectOne
(
@RequestHeader
(
"appKey"
)
String
appKey
,
@RequestHeader
(
"product"
)
String
product
,
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"top"
)
String
top
,
ResponseModel
selectOne
(
@RequestHeader
(
"appKey"
)
String
appKey
,
@RequestHeader
(
"product"
)
String
product
,
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"top"
)
String
top
,
@RequestParam
(
value
=
"productKey"
)
String
productKey
,
@RequestParam
(
value
=
"deviceName"
)
String
deviceName
,
@RequestParam
(
"FHS_FirePump_RunStatus"
)
String
key
,
@RequestParam
(
value
=
"deviceName"
)
String
deviceName
,
@RequestParam
(
"FHS_FirePump_RunStatus"
)
String
key
,
@RequestParam
(
required
=
false
,
value
=
"fieldKey"
)
String
fieldKey
);
@GetMapping
(
"/v1/livedata/common/list"
)
ResponseModel
<
List
<
Object
>>
getLiveData
(
@RequestParam
(
"measurement"
)
String
measurement
,
@RequestParam
(
"deviceName"
)
String
deviceName
,
@RequestParam
(
"timeStart"
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
Date
timeStart
,
@RequestParam
(
"timeEnd"
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
Date
timeEnd
);
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/listener/CarIotListener.java
0 → 100644
View file @
77924dc6
package
com
.
yeejoin
.
equipmanage
.
listener
;
import
java.io.BufferedReader
;
import
java.io.IOException
;
import
java.io.InputStreamReader
;
import
java.net.HttpURLConnection
;
import
java.net.URL
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
org.eclipse.paho.client.mqttv3.MqttMessage
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.typroject.tyboot.component.emq.EmqxListener
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.yeejoin.equipmanage.common.entity.WlCarMileage
;
import
com.yeejoin.equipmanage.common.utils.CoordinateUtil
;
import
com.yeejoin.equipmanage.fegin.IotFeign
;
import
com.yeejoin.equipmanage.service.IWlCarMileageService
;
@Component
public
class
CarIotListener
extends
EmqxListener
{
@Autowired
private
IWlCarMileageService
iWlCarMileageService
;
@Autowired
private
IotFeign
iotFeign
;
private
final
String
GUIDE_KEY
=
"813684495d9a3981dd2c7694916fe404"
;
private
final
String
GUIDE_URL
=
"https://restapi.amap.com/v3/geocode/regeo?"
;
@Override
public
void
processMessage
(
String
topic
,
MqttMessage
message
)
throws
Exception
{
String
measurement
=
topic
.
split
(
"/"
)[
0
];
String
deviceName
=
topic
.
split
(
"/"
)[
1
];
String
iotCode
=
measurement
+
deviceName
;
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
message
.
toString
());
if
(
jsonObject
.
containsKey
(
"startUp"
))
{
if
(
jsonObject
.
getBooleanValue
(
"startUp"
))
{
WlCarMileage
wlCarMileage
=
new
WlCarMileage
();
wlCarMileage
.
setIotCode
(
iotCode
);
wlCarMileage
.
setDate
(
new
Date
());
iWlCarMileageService
.
save
(
wlCarMileage
);
}
else
{
// 获取结束坐标
WlCarMileage
last
=
iWlCarMileageService
.
getOne
(
new
LambdaQueryWrapper
<
WlCarMileage
>()
.
eq
(
WlCarMileage:
:
getIotCode
,
iotCode
).
isNull
(
WlCarMileage:
:
getEndLongitude
)
.
isNull
(
WlCarMileage:
:
getEndLatitude
).
orderByDesc
(
WlCarMileage:
:
getEndTime
).
last
(
"limit 1"
));
ResponseModel
<
List
<
Object
>>
result
=
iotFeign
.
getLiveData
(
measurement
,
deviceName
,
last
.
getStartTime
(),
new
Date
());
List
<
Object
>
list
=
result
.
getResult
();
if
(
list
!=
null
&&
list
.
size
()
>
0
)
{
//获取最后一个有坐标的数据
JSONObject
lastObj
=
null
;
for
(
int
i
=
list
.
size
()-
1
;
i
>=
0
;
i
--)
{
JSONObject
Obj
=
JSONObject
.
parseObject
(
JSONObject
.
toJSONString
(
list
.
get
(
i
)));
if
(
Obj
.
get
(
"FireCar_Longitude"
)!=
null
&&
Obj
.
get
(
"FireCar_Latitude"
)!=
null
)
{
lastObj
=
Obj
;
break
;
}
}
//JSONObject lastObj = JSONObject.parseObject(JSONObject.toJSONString(list.get(list.size() - 1)));
if
(
lastObj
==
null
)
{
lastObj
=
new
JSONObject
();
lastObj
.
put
(
"FireCar_Longitude"
,
0.0
);
lastObj
.
put
(
"FireCar_Latitude"
,
0.0
);
lastObj
.
put
(
"currentTime"
,
0
);
lastObj
.
put
(
"FireCar_Speed"
,
0
);
}
double
endLongitude
=
lastObj
.
getDoubleValue
(
"FireCar_Longitude"
);
double
endLatitude
=
lastObj
.
getDoubleValue
(
"FireCar_Latitude"
);
long
currentTime
=
lastObj
.
getLongValue
(
"currentTime"
);
long
takeTime
=
currentTime
-
last
.
getStartTime
().
getTime
();
last
.
setEndLongitude
(
endLongitude
);
last
.
setEndLatitude
(
endLatitude
);
last
.
setEndTime
(
new
Date
(
currentTime
));
last
.
setEndName
(
getAddress
(
endLongitude
,
endLatitude
));
last
.
setEndSpeed
(
lastObj
.
getIntValue
(
"FireCar_Speed"
));
last
.
setTakeTime
(
takeTime
);
double
travel
=
0
;
// 获取里程
for
(
int
i
=
0
;
i
<
list
.
size
()
-
1
;
i
++)
{
JSONObject
start
=
JSONObject
.
parseObject
(
JSONObject
.
toJSONString
(
list
.
get
(
i
)));
JSONObject
end
=
JSONObject
.
parseObject
(
JSONObject
.
toJSONString
(
list
.
get
(
i
+
1
)));
travel
+=
CoordinateUtil
.
distance
(
start
.
getDoubleValue
(
"FireCar_Longitude"
),
start
.
getDoubleValue
(
"FireCar_Latitude"
),
end
.
getDoubleValue
(
"FireCar_Longitude"
),
end
.
getDoubleValue
(
"FireCar_Latitude"
));
}
last
.
setTravel
(
travel
);
iWlCarMileageService
.
updateById
(
last
);
}
}
}
else
if
(
jsonObject
.
containsKey
(
"FireCar_Longitude"
)){
WlCarMileage
last
=
iWlCarMileageService
.
getOne
(
new
LambdaQueryWrapper
<
WlCarMileage
>()
.
eq
(
WlCarMileage:
:
getIotCode
,
iotCode
).
isNull
(
WlCarMileage:
:
getStartLongitude
)
.
isNull
(
WlCarMileage:
:
getStartLatitude
).
orderByDesc
(
WlCarMileage:
:
getEndTime
).
last
(
"limit 1"
));
if
(
last
!=
null
&&
jsonObject
.
containsKey
(
"FireCar_Longitude"
)
&&
jsonObject
.
containsKey
(
"FireCar_Latitude"
))
{
// 获取开始坐标
double
startLongitude
=
jsonObject
.
getDoubleValue
(
"FireCar_Longitude"
);
double
startLatitude
=
jsonObject
.
getDoubleValue
(
"FireCar_Latitude"
);
long
currentTime
=
jsonObject
.
getLongValue
(
"currentTime"
);
last
.
setStartLongitude
(
startLongitude
);
last
.
setStartLatitude
(
startLatitude
);
last
.
setStartTime
(
new
Date
(
currentTime
));
last
.
setStartName
(
getAddress
(
startLongitude
,
startLatitude
));
last
.
setStartSpeed
(
jsonObject
.
getIntValue
(
"FireCar_Speed"
));
iWlCarMileageService
.
updateById
(
last
);
}
}
System
.
out
.
println
(
topic
);
System
.
out
.
println
(
message
);
}
public
String
getAddress
(
double
longitude
,
double
lantitude
)
{
StringBuilder
api
=
new
StringBuilder
(
GUIDE_URL
);
api
.
append
(
"key="
).
append
(
GUIDE_KEY
).
append
(
"&location="
).
append
(
longitude
).
append
(
","
).
append
(
lantitude
)
.
append
(
"&radius=1000"
).
append
(
"&batch=false"
).
append
(
"&extensions=base"
).
append
(
"&roadlevel=0"
)
.
append
(
"&batch=false"
);
StringBuilder
res
=
new
StringBuilder
();
BufferedReader
in
=
null
;
try
{
System
.
out
.
println
(
api
.
toString
());
URL
url
=
new
URL
(
api
.
toString
());
HttpURLConnection
conn
=
(
HttpURLConnection
)
url
.
openConnection
();
conn
.
setDoOutput
(
true
);
conn
.
setRequestMethod
(
"POST"
);
in
=
new
BufferedReader
(
new
InputStreamReader
(
conn
.
getInputStream
(),
"UTF-8"
));
String
line
;
while
((
line
=
in
.
readLine
())
!=
null
)
{
res
.
append
(
line
).
append
(
"\n"
);
}
JSONObject
object
=
JSONObject
.
parseObject
(
res
.
toString
());
System
.
out
.
println
(
object
);
JSONObject
regeocode
=
object
.
getJSONObject
(
"regeocode"
);
String
address
=
regeocode
.
getString
(
"formatted_address"
);
if
(
"[]"
.
equals
(
address
))
{
System
.
out
.
println
(
"===============无效坐标:"
+
longitude
+
","
+
lantitude
);
address
=
"无效坐标"
;
}
res
=
new
StringBuilder
(
address
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
finally
{
try
{
if
(
in
!=
null
)
{
in
.
close
();
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
return
res
.
toString
();
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/mapper/WlCarMileageMapper.java
0 → 100644
View file @
77924dc6
package
com
.
yeejoin
.
equipmanage
.
mapper
;
import
org.apache.ibatis.annotations.Param
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.equipmanage.common.entity.WlCarMileage
;
/**
* 车量里程表 Mapper 接口
*
* @author duanwei
* @date 2023-02-01
*/
public
interface
WlCarMileageMapper
extends
BaseMapper
<
WlCarMileage
>
{
Page
<
WlCarMileage
>
page
(
Page
<
WlCarMileage
>
page
,
@Param
(
"wlCarMileage"
)
WlCarMileage
wlCarMileage
);
Integer
totalMileage
(
String
iotCode
);
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/ICarService.java
View file @
77924dc6
...
...
@@ -82,6 +82,7 @@ public interface ICarService extends IService<Car> {
/**
* 根据车辆id查询车辆详情信息
*
* @param id
* @param orgCode
* @param isIot
...
...
@@ -89,7 +90,6 @@ public interface ICarService extends IService<Car> {
*/
CarForUE4VO
getCarDetailByCarNumToThreeDimensional
(
Long
id
,
String
orgCode
);
/**
* 添加车辆
*/
...
...
@@ -126,6 +126,7 @@ public interface ICarService extends IService<Car> {
/**
* 车辆详情接口
*
* @return List<CarInfoVo>
* @param teamId 队伍id
* @param name 车辆名称
...
...
@@ -134,6 +135,7 @@ public interface ICarService extends IService<Car> {
/**
* 队伍车辆详情接口
*
* @return List<CarInfoVo>
* @param teamId 队伍id
* @param name 车辆名称
...
...
@@ -147,10 +149,11 @@ public interface ICarService extends IService<Car> {
*/
Boolean
updateCarStatus
(
List
<
CarStatusInfoDto
>
cars
);
List
<
CarDto
>
getTeamCarList
(
String
sequenceNbr
,
Long
id
,
Double
longitude
,
Double
latitude
);
List
<
CarDto
>
getTeamCarList
(
String
sequenceNbr
,
Long
id
,
Double
longitude
,
Double
latitude
);
/**
* 获取车辆属性集合值(参数均为非必填)
*
* @param idList 车辆ID集合
* @param teamId 队伍ID
* @param nameKeys 属性编码,中间英文逗号隔开
...
...
@@ -166,10 +169,12 @@ public interface ICarService extends IService<Car> {
Object
getCarStateInfoByCarNum
(
String
carNum
);
Page
<
CarInfoDto
>
equipmentCarList
(
Page
<
CarInfoDto
>
pag
,
Long
teamId
,
String
name
,
String
code
,
Long
id
,
Boolean
isNo
);
Page
<
CarInfoDto
>
equipmentCarList
(
Page
<
CarInfoDto
>
pag
,
Long
teamId
,
String
name
,
String
code
,
Long
id
,
Boolean
isNo
);
/**
* 获取融合终端车辆列表
*
* @return
*/
List
<
CarFusionDto
>
getCarFusionList
();
...
...
@@ -179,10 +184,10 @@ public interface ICarService extends IService<Car> {
*/
void
refreshStaData
();
/**
* iot装备更新redis 统计数据
*/
void
iotrefreshStaData
();
IPage
getQRCode
(
Long
id
);
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/IWlCarMileageService.java
0 → 100644
View file @
77924dc6
package
com
.
yeejoin
.
equipmanage
.
service
;
import
java.util.List
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.yeejoin.equipmanage.common.entity.WlCarMileage
;
import
com.yeejoin.equipmanage.controller.Coordinate
;
/**
* 车量里程表 服务类
*
* @author duanwei
* @date 2023-02-01
*/
public
interface
IWlCarMileageService
extends
IService
<
WlCarMileage
>
{
Page
<
WlCarMileage
>
page
(
Page
<
WlCarMileage
>
page
,
WlCarMileage
wlCarMileage
);
Integer
totalMileage
(
String
iotCode
);
List
<
Coordinate
>
getCoordinateList
(
long
id
);
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/CarServiceImpl.java
View file @
77924dc6
This diff is collapsed.
Click to expand it.
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/FireFightingSystemServiceImpl.java
View file @
77924dc6
This diff is collapsed.
Click to expand it.
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/WlCarMileageServiceImpl.java
0 → 100644
View file @
77924dc6
package
com
.
yeejoin
.
equipmanage
.
service
.
impl
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.yeejoin.equipmanage.common.entity.WlCarMileage
;
import
com.yeejoin.equipmanage.controller.Coordinate
;
import
com.yeejoin.equipmanage.fegin.IotFeign
;
import
com.yeejoin.equipmanage.mapper.WlCarMileageMapper
;
import
com.yeejoin.equipmanage.service.IWlCarMileageService
;
/**
* 车量里程表 服务实现类
*
* @author duanwei
* @date 2023-02-01
*/
@Service
public
class
WlCarMileageServiceImpl
extends
ServiceImpl
<
WlCarMileageMapper
,
WlCarMileage
>
implements
IWlCarMileageService
{
@Autowired
IotFeign
iotFeign
;
@Override
public
Page
<
WlCarMileage
>
page
(
Page
<
WlCarMileage
>
page
,
WlCarMileage
wlCarMileage
)
{
return
this
.
baseMapper
.
page
(
page
,
wlCarMileage
);
}
@Override
public
Integer
totalMileage
(
String
iotCode
)
{
return
this
.
baseMapper
.
totalMileage
(
iotCode
);
}
@Override
public
List
<
Coordinate
>
getCoordinateList
(
long
id
)
{
WlCarMileage
wlCarMileage
=
this
.
getById
(
id
);
String
iotCode
=
wlCarMileage
.
getIotCode
();
String
measurement
=
"0THMcLKR"
;
String
deviceName
=
iotCode
.
replace
(
measurement
,
""
);
ResponseModel
<
List
<
Object
>>
result
=
iotFeign
.
getLiveData
(
measurement
,
deviceName
,
wlCarMileage
.
getStartTime
(),
wlCarMileage
.
getEndTime
());
List
<
Object
>
list
=
result
.
getResult
();
List
<
Coordinate
>
coordinateList
=
new
ArrayList
<
Coordinate
>();
if
(
list
!=
null
)
{
for
(
Object
object
:
list
)
{
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
JSONObject
.
toJSONString
(
object
));
Coordinate
coordinate
=
new
Coordinate
();
List
<
Double
>
lnglat
=
new
ArrayList
<
Double
>();
lnglat
.
add
(
jsonObject
.
getDoubleValue
(
"FireCar_Longitude"
));
lnglat
.
add
(
jsonObject
.
getDoubleValue
(
"FireCar_Latitude"
));
coordinate
.
setLnglat
(
lnglat
);
coordinate
.
setSpeed
(
jsonObject
.
getIntValue
(
"FireCar_Speed"
));
coordinateList
.
add
(
coordinate
);
}
}
return
coordinateList
;
}
}
amos-boot-system-equip/src/main/java/com/yeejoin/AmostEquipApplication.java
View file @
77924dc6
...
...
@@ -3,9 +3,11 @@ package com.yeejoin;
import
java.net.InetAddress
;
import
java.net.UnknownHostException
;
import
org.eclipse.paho.client.mqttv3.MqttException
;
import
org.mybatis.spring.annotation.MapperScan
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
...
...
@@ -20,9 +22,11 @@ import org.springframework.core.env.Environment;
import
org.springframework.scheduling.annotation.EnableAsync
;
import
org.springframework.transaction.annotation.EnableTransactionManagement
;
import
org.springframework.web.client.RestTemplate
;
import
org.typroject.tyboot.component.emq.EmqKeeper
;
import
org.typroject.tyboot.core.restful.exception.GlobalExceptionHandler
;
import
com.yeejoin.amos.boot.biz.common.utils.oConvertUtils
;
import
com.yeejoin.equipmanage.listener.CarIotListener
;
@SpringBootApplication
@EnableTransactionManagement
...
...
@@ -40,6 +44,12 @@ public class AmostEquipApplication {
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
AmostEquipApplication
.
class
);
@Autowired
private
EmqKeeper
emqKeeper
;
@Autowired
private
CarIotListener
carIotListener
;
public
static
void
main
(
String
[]
args
)
throws
UnknownHostException
{
ConfigurableApplicationContext
context
=
SpringApplication
.
run
(
AmostEquipApplication
.
class
,
args
);
Environment
env
=
context
.
getEnvironment
();
...
...
@@ -57,4 +67,14 @@ public class AmostEquipApplication {
RestTemplate
restTemplate
(){
return
new
RestTemplate
();
}
/**
* 初始化MQTT
*
* @throws MqttException
*/
@Bean
void
initMqtt
()
throws
MqttException
{
emqKeeper
.
getMqttClient
().
subscribe
(
"+/+/property"
,
1
,
carIotListener
);
}
}
amos-boot-system-equip/src/main/resources/mapper/FireFightingSystemMapper.xml
View file @
77924dc6
...
...
@@ -1893,6 +1893,12 @@
<if
test=
"equipTypeAmountPage.iotCode!=null and equipTypeAmountPage.iotCode!=''"
>
AND wlc.iot_code LIKE CONCAT('%',#{equipTypeAmountPage.iotCode},'%')
</if>
<if
test=
"equipTypeAmountPage.carNum!=null and equipTypeAmountPage.carNum!=''"
>
And wlc.car_num LIKE CONCAT('%',#{equipTypeAmountPage.carNum},'%')
</if>
<if
test=
"equipTypeAmountPage.keyword!=null and equipTypeAmountPage.keyword!=''"
>
And (wlc.`NAME` LIKE CONCAT('%',#{equipTypeAmountPage.keyword},'%') OR wlc.car_num LIKE CONCAT('%',#{equipTypeAmountPage.keyword},'%'))
</if>
)s2
<if
test=
"equipTypeAmountPage.warehouseStructureName!=null and equipTypeAmountPage.warehouseStructureName!=''"
>
where s2.full_name LIKE CONCAT('%',#{equipTypeAmountPage.warehouseStructureName},'%')
...
...
@@ -1900,6 +1906,7 @@
<if
test=
"equipTypeAmountPage.bizOrgCode!=null and equipTypeAmountPage.bizOrgCode!=''"
>
where s2.bizOrgCode LIKE CONCAT(#{equipTypeAmountPage.bizOrgCode},'%')
</if>
order by createDate DESC
</select>
...
...
amos-boot-system-equip/src/main/resources/mapper/WlCarMileageMapper.xml
0 → 100644
View file @
77924dc6
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.yeejoin.equipmanage.mapper.WlCarMileageMapper"
>
<select
id=
"totalMileage"
resultType=
"Integer"
>
SELECT SUM(travel) FROM wl_car_mileage WHERE iot_code = #{iotCode}
</select>
<select
id=
"page"
resultType=
"com.yeejoin.equipmanage.common.entity.WlCarMileage"
>
SELECT*,date AS name,DATE_FORMAT(from_unixtime(take_time),'%H:%i:%s') AS time FROM wl_car_mileage
LEFT JOIN wl_car ON wl_car.iot_code = wl_car_mileage.iot_code
<where>
<if
test=
"wlCarMileage.carId != null"
>
AND wl_car.id = #{wlCarMileage.carId}
</if>
<if
test=
"wlCarMileage.iotCode != null"
>
AND wl_car_mileage.iot_code = #{wlCarMileage.iotCode}
</if>
<if
test=
"wlCarMileage.filterDate != null"
>
AND wl_car_mileage.date = #{wlCarMileage.filterDate}
</if>
</where>
</select>
</mapper>
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