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
Show whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
1491 additions
and
337 deletions
+1491
-337
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
+163
-54
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
+131
-57
FireFightingSystemServiceImpl.java
...uipmanage/service/impl/FireFightingSystemServiceImpl.java
+300
-184
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 {
...
@@ -104,10 +104,7 @@ public class Car extends BaseEntity {
@ApiModelProperty
(
value
=
"队伍名称(冗余字段来源于平台)"
)
@ApiModelProperty
(
value
=
"队伍名称(冗余字段来源于平台)"
)
private
String
teamName
;
private
String
teamName
;
//新加
//新加
@ApiModelProperty
(
value
=
"机构/部门名称"
)
@ApiModelProperty
(
value
=
"机构/部门名称"
)
@TableField
(
"biz_org_name"
)
@TableField
(
"biz_org_name"
)
private
String
bizOrgName
;
private
String
bizOrgName
;
...
@@ -116,12 +113,6 @@ public class Car extends BaseEntity {
...
@@ -116,12 +113,6 @@ public class Car extends BaseEntity {
@TableField
(
"biz_org_code"
)
@TableField
(
"biz_org_code"
)
private
String
bizOrgCode
;
private
String
bizOrgCode
;
@ApiModelProperty
(
value
=
"图片"
)
@ApiModelProperty
(
value
=
"图片"
)
@TableField
(
exist
=
false
)
@TableField
(
exist
=
false
)
private
List
<
UploadFile
>
img
;
private
List
<
UploadFile
>
img
;
...
@@ -176,4 +167,21 @@ public class Car extends BaseEntity {
...
@@ -176,4 +167,21 @@ public class Car extends BaseEntity {
@TableField
(
exist
=
false
)
@TableField
(
exist
=
false
)
private
String
iotStatus
;
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> {
...
@@ -66,4 +66,17 @@ public class EquipTypeAmountPageDTO extends BaseDTO<EquipmentSpecific> {
@ApiModelProperty
(
value
=
"缺陷管理新增页面用,其余地方可忽略 1-是缺陷管理 0-不是"
)
@ApiModelProperty
(
value
=
"缺陷管理新增页面用,其余地方可忽略 1-是缺陷管理 0-不是"
)
private
Integer
isDefect
;
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 {
...
@@ -55,4 +55,10 @@ public class EquipTypeImgAmountVO {
@ApiModelProperty
(
value
=
"所在建筑"
)
@ApiModelProperty
(
value
=
"所在建筑"
)
private
String
belongBuildName
;
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 {
...
@@ -226,4 +226,45 @@ public class QRCodeUtil {
System
.
out
.
println
(
genQrCodeBase64PngWithWord
(
"101"
,
100
,
100
,
"sd"
,
100
));
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
package
com
.
yeejoin
.
equipmanage
.
controller
;
package
com
.
yeejoin
.
equipmanage
.
controller
;
import
java.io.ByteArrayInputStream
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
org.springframework.http.HttpEntity
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.http.HttpMethod
;
import
org.springframework.http.MediaType
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.mock.web.MockMultipartFile
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PostMapping
;
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.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.client.RestTemplate
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
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
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.healthmarketscience.jackcess.util.OleBlob.ContentType
;
import
com.itextpdf.text.pdf.codec.Base64.InputStream
;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
import
com.yeejoin.amos.boot.biz.common.dto.OrgMenuDto
;
import
com.yeejoin.amos.boot.biz.common.dto.OrgMenuDto
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.model.CompanyModel
;
import
com.yeejoin.amos.feign.systemctl.Systemctl
;
import
com.yeejoin.equipmanage.common.dto.CarInfoDto
;
import
com.yeejoin.equipmanage.common.dto.CarInfoDto
;
import
com.yeejoin.equipmanage.common.dto.CarStatusInfoDto
;
import
com.yeejoin.equipmanage.common.dto.CarStatusInfoDto
;
import
com.yeejoin.equipmanage.common.entity.*
;
import
com.yeejoin.equipmanage.common.entity.Car
;
import
com.yeejoin.equipmanage.common.entity.CarProperty
;
import
com.yeejoin.equipmanage.common.entity.Equipment
;
import
com.yeejoin.equipmanage.common.entity.EquipmentCategory
;
import
com.yeejoin.equipmanage.common.entity.EquipmentDetail
;
import
com.yeejoin.equipmanage.common.entity.EquipmentIndex
;
import
com.yeejoin.equipmanage.common.entity.EquipmentOnCar
;
import
com.yeejoin.equipmanage.common.entity.EquipmentQrcode
;
import
com.yeejoin.equipmanage.common.entity.ManufacturerInfo
;
import
com.yeejoin.equipmanage.common.entity.SystemDic
;
import
com.yeejoin.equipmanage.common.entity.publics.CommonResponse
;
import
com.yeejoin.equipmanage.common.entity.publics.CommonResponse
;
import
com.yeejoin.equipmanage.common.entity.vo.CarIndexVo
;
import
com.yeejoin.equipmanage.common.entity.vo.CarIndexVo
;
import
com.yeejoin.equipmanage.common.entity.vo.EquipmentOnCarAppVO
;
import
com.yeejoin.equipmanage.common.entity.vo.EquipmentOnCarAppVO
;
import
com.yeejoin.equipmanage.common.enums.*
;
import
com.yeejoin.equipmanage.common.enums.CarStatusEnum
;
import
com.yeejoin.equipmanage.common.utils.*
;
import
com.yeejoin.equipmanage.common.enums.IndustryEnum
;
import
com.yeejoin.equipmanage.common.vo.*
;
import
com.yeejoin.equipmanage.common.enums.OnBoardEquipmentEnum
;
import
com.yeejoin.equipmanage.config.EquipmentIotMqttReceiveConfig
;
import
com.yeejoin.equipmanage.common.enums.SourceTypeEnum
;
import
com.yeejoin.equipmanage.common.enums.SystemDicTypeEum
;
import
com.yeejoin.equipmanage.common.enums.TrueOrFalseEnum
;
import
com.yeejoin.equipmanage.common.utils.CommonResponseUtil
;
import
com.yeejoin.equipmanage.common.utils.DateUtils
;
import
com.yeejoin.equipmanage.common.utils.NameUtils
;
import
com.yeejoin.equipmanage.common.utils.ParsePropertyUtil
;
import
com.yeejoin.equipmanage.common.utils.QRCodeUtil
;
import
com.yeejoin.equipmanage.common.utils.SpringUtils
;
import
com.yeejoin.equipmanage.common.utils.StringUtil
;
import
com.yeejoin.equipmanage.common.vo.CarForUE4VO
;
import
com.yeejoin.equipmanage.common.vo.CarInfosResponse
;
import
com.yeejoin.equipmanage.common.vo.EquipStateOnCarVo
;
import
com.yeejoin.equipmanage.common.vo.ExtinguishantLossRequest
;
import
com.yeejoin.equipmanage.common.vo.ExtinguishantRequeset
;
import
com.yeejoin.equipmanage.common.vo.LonAndLatEntityVo
;
import
com.yeejoin.equipmanage.common.vo.OnBoardEquipment
;
import
com.yeejoin.equipmanage.fegin.JcsFeign
;
import
com.yeejoin.equipmanage.fegin.JcsFeign
;
import
com.yeejoin.equipmanage.mapper.*
;
import
com.yeejoin.equipmanage.mapper.CarInfoMapper
;
import
com.yeejoin.equipmanage.service.*
;
import
com.yeejoin.equipmanage.mapper.CarMapper
;
import
com.yeejoin.equipmanage.service.impl.EquipmentSpecificSerivceImpl
;
import
com.yeejoin.equipmanage.mapper.CarPropertyMapper
;
import
com.yeejoin.equipmanage.mapper.EquipmentCategoryMapper
;
import
com.yeejoin.equipmanage.mapper.EquipmentDetailMapper
;
import
com.yeejoin.equipmanage.mapper.EquipmentIndexMapper
;
import
com.yeejoin.equipmanage.mapper.EquipmentMapper
;
import
com.yeejoin.equipmanage.mapper.EquipmentQrcodeMapper
;
import
com.yeejoin.equipmanage.mapper.ExtinguishantOnCarMapper
;
import
com.yeejoin.equipmanage.mapper.ManufacturerInfoMapper
;
import
com.yeejoin.equipmanage.mapper.SystemDicMapper
;
import
com.yeejoin.equipmanage.service.ICarInfoService
;
import
com.yeejoin.equipmanage.service.ICarLonAndLatDataService
;
import
com.yeejoin.equipmanage.service.ICarPropertyService
;
import
com.yeejoin.equipmanage.service.ICarService
;
import
com.yeejoin.equipmanage.service.IEquipmentDetailService
;
import
com.yeejoin.equipmanage.service.IEquipmentIndexService
;
import
com.yeejoin.equipmanage.service.IEquipmentOnCarService
;
import
com.yeejoin.equipmanage.service.IEquipmentQrcodeService
;
import
com.yeejoin.equipmanage.service.IEquipmentService
;
import
com.yeejoin.equipmanage.service.ISourceStatistics
;
import
com.yeejoin.equipmanage.service.ISyncDataService
;
import
com.yeejoin.equipmanage.service.ISystemDicService
;
import
com.yeejoin.equipmanage.service.ProductionQRCode
;
import
com.yeejoin.equipmanage.service.impl.FireFightingSystemServiceImpl
;
import
com.yeejoin.equipmanage.service.impl.FireFightingSystemServiceImpl
;
import
com.yeejoin.equipmanage.service.impl.SourcesStatisticsImpl
;
import
com.yeejoin.equipmanage.service.impl.SourcesStatisticsImpl
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
import
io.swagger.annotations.ApiParam
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
org.springframework.http.*
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.client.RestTemplate
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
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
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.*
;
import
java.util.stream.Collectors
;
/**
/**
* 消防车信息
* 消防车信息
...
@@ -171,21 +247,29 @@ public class CarController extends AbstractBaseController {
...
@@ -171,21 +247,29 @@ public class CarController extends AbstractBaseController {
// Car carInstance = iCarService.saveCar(user, car, carInfo, carpList);
// Car carInstance = iCarService.saveCar(user, car, carInfo, carpList);
// saveFile(carInstance); 图片视频后期统一处理
// saveFile(carInstance); 图片视频后期统一处理
//如果默认有id值则认为是更新
if
(
car
.
getId
()!=
null
)
{
Car
car2
=
updateCar
(
car
);
CarController
controllerProxy
=
SpringUtils
.
getBean
(
CarController
.
class
);
controllerProxy
.
refreshAllCount
();
return
car2
;
}
// 验证车辆code唯一性
// 验证车辆code唯一性
String
iotCode
=
car
.
getIotCode
();
String
iotCode
=
car
.
getIotCode
();
if
(
StringUtils
.
isNotEmpty
(
iotCode
)
&&
StringUtils
.
isNotEmpty
(
iotCode
.
trim
()))
{
if
(
StringUtils
.
isNotEmpty
(
iotCode
)
&&
StringUtils
.
isNotEmpty
(
iotCode
.
trim
()))
{
Car
ar
=
carMapper
.
getCarsByIotCode
(
car
.
getIotCode
());
Car
ar
=
carMapper
.
getCarsByIotCode
(
car
.
getIotCode
());
if
(
ar
!=
null
)
{
if
(
ar
!=
null
)
{
throw
new
BadRequest
(
"物联编码重复"
);
throw
new
BadRequest
(
"物联编码重复"
);
}
}
if
(
StringUtils
.
isNotEmpty
(
haveUsedIotPrefix
)
&&
Arrays
.
stream
(
haveUsedIotPrefix
.
split
(
","
)).
anyMatch
(
iotCode:
:
startsWith
)){
if
(
StringUtils
.
isNotEmpty
(
haveUsedIotPrefix
)
&&
Arrays
.
stream
(
haveUsedIotPrefix
.
split
(
","
)).
anyMatch
(
iotCode:
:
startsWith
))
{
throw
new
BadRequest
(
"物联编码航班已占用"
);
throw
new
BadRequest
(
"物联编码航班已占用"
);
}
}
}
}
car
.
setQrCode
(
QRCodeUtil
.
generateQRCode
());
car
.
setQrCode
(
QRCodeUtil
.
generateQRCode
());
List
<
CarProperty
>
carPropertyList
=
car
.
getCarPropertyList
();
List
<
CarProperty
>
carPropertyList
=
car
.
getCarPropertyList
();
if
(
carPropertyList
.
size
()
>
0
)
{
if
(
carPropertyList
!=
null
&&
carPropertyList
.
size
()
>
0
)
{
carPropertyList
.
forEach
(
x
->
{
carPropertyList
.
forEach
(
x
->
{
QueryWrapper
<
EquipmentIndex
>
queryWrapper
=
new
QueryWrapper
<>();
QueryWrapper
<
EquipmentIndex
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"id"
,
x
.
getEquipmentIndexId
());
queryWrapper
.
eq
(
"id"
,
x
.
getEquipmentIndexId
());
...
@@ -200,6 +284,18 @@ public class CarController extends AbstractBaseController {
...
@@ -200,6 +284,18 @@ public class CarController extends AbstractBaseController {
}
}
});
});
}
}
if
(
ObjectUtils
.
isEmpty
(
car
.
getName
()))
{
Equipment
equipment
=
iEquipmentService
.
getById
(
car
.
getEquipmentId
());
car
.
setName
(
equipment
!=
null
?
equipment
.
getName
()
:
null
);
}
if
(
ObjectUtils
.
isEmpty
(
car
.
getBizOrgName
())
&&
!
ObjectUtils
.
isEmpty
(
car
.
getBizOrgCode
()))
{
FeignClientResult
<
Map
<
String
,
Object
>>
result
=
Privilege
.
companyClient
.
queryByOrgcode
(
car
.
getBizOrgCode
());
System
.
out
.
println
(
"=============================="
+
JSONObject
.
toJSONString
(
result
.
getResult
()));
if
(
result
.
getResult
()
!=
null
&&
result
.
getResult
().
containsKey
(
"compnay"
))
{
Map
<
String
,
String
>
map
=
(
Map
<
String
,
String
>)
result
.
getResult
().
get
(
"compnay"
);
car
.
setBizOrgName
(
map
.
get
(
"companyName"
));
}
}
Car
car2
=
iCarService
.
saveOne
(
car
);
Car
car2
=
iCarService
.
saveOne
(
car
);
CarController
controllerProxy
=
SpringUtils
.
getBean
(
CarController
.
class
);
CarController
controllerProxy
=
SpringUtils
.
getBean
(
CarController
.
class
);
controllerProxy
.
refreshAllCount
();
controllerProxy
.
refreshAllCount
();
...
@@ -233,8 +329,6 @@ public class CarController extends AbstractBaseController {
...
@@ -233,8 +329,6 @@ public class CarController extends AbstractBaseController {
// });
// });
// }
// }
@Async
(
"equipAsyncExecutor"
)
@Async
(
"equipAsyncExecutor"
)
public
void
refreshAllCount
()
{
public
void
refreshAllCount
()
{
// 清空单位装备分类树缓存
// 清空单位装备分类树缓存
...
@@ -252,7 +346,6 @@ public class CarController extends AbstractBaseController {
...
@@ -252,7 +346,6 @@ public class CarController extends AbstractBaseController {
iSourceStatistics
.
initAllCategoryStatisticsData
(
SourceTypeEnum
.
IOT
);
iSourceStatistics
.
initAllCategoryStatisticsData
(
SourceTypeEnum
.
IOT
);
}
}
/**
/**
* 根据iotCode查询
* 根据iotCode查询
*
*
...
@@ -313,21 +406,32 @@ public class CarController extends AbstractBaseController {
...
@@ -313,21 +406,32 @@ public class CarController extends AbstractBaseController {
// saveFile(carInstance);视频图片文件后期统一处理
// saveFile(carInstance);视频图片文件后期统一处理
String
iotCode
=
car
.
getIotCode
();
String
iotCode
=
car
.
getIotCode
();
if
(
StringUtil
.
isNotEmpty
(
iotCode
)
&&
StringUtils
.
isNotEmpty
(
iotCode
.
trim
()))
{
if
(
StringUtil
.
isNotEmpty
(
iotCode
)
&&
StringUtils
.
isNotEmpty
(
iotCode
.
trim
()))
{
Car
ar
=
carMapper
.
getCarsByIotCodeExcludeCarId
(
car
.
getIotCode
(),
car
.
getId
());
Car
ar
=
carMapper
.
getCarsByIotCodeExcludeCarId
(
car
.
getIotCode
(),
car
.
getId
());
if
(
ar
!=
null
)
{
if
(
ar
!=
null
)
{
throw
new
BadRequest
(
"物联编码重复"
);
throw
new
BadRequest
(
"物联编码重复"
);
}
}
if
(
StringUtils
.
isNotEmpty
(
haveUsedIotPrefix
)
&&
Arrays
.
stream
(
haveUsedIotPrefix
.
split
(
","
)).
anyMatch
(
iotCode:
:
startsWith
)){
if
(
StringUtils
.
isNotEmpty
(
haveUsedIotPrefix
)
&&
Arrays
.
stream
(
haveUsedIotPrefix
.
split
(
","
)).
anyMatch
(
iotCode:
:
startsWith
))
{
throw
new
BadRequest
(
"物联编码航班已占用"
);
throw
new
BadRequest
(
"物联编码航班已占用"
);
}
}
}
}
// 用来解绑车辆
if
(!
ObjectUtils
.
isEmpty
(
car
.
getTeamId
()))
{
//用来解绑车辆
jcsFeign
.
getUserCar
(
car
.
getId
(),
car
.
getTeamId
());
if
(!
ObjectUtils
.
isEmpty
(
car
.
getTeamId
())){
}
jcsFeign
.
getUserCar
(
car
.
getId
(),
car
.
getTeamId
());
if
(
ObjectUtils
.
isEmpty
(
car
.
getName
()))
{
Equipment
equipment
=
iEquipmentService
.
getById
(
car
.
getEquipmentId
());
car
.
setName
(
equipment
!=
null
?
equipment
.
getName
()
:
null
);
}
if
(
ObjectUtils
.
isEmpty
(
car
.
getBizOrgName
())
&&
!
ObjectUtils
.
isEmpty
(
car
.
getBizOrgCode
()))
{
FeignClientResult
<
Map
<
String
,
Object
>>
result
=
Privilege
.
companyClient
.
queryByOrgcode
(
car
.
getBizOrgCode
());
System
.
out
.
println
(
"=============================="
+
JSONObject
.
toJSONString
(
result
.
getResult
()));
if
(
result
.
getResult
()
!=
null
&&
result
.
getResult
().
containsKey
(
"compnay"
))
{
Map
<
String
,
String
>
map
=
(
Map
<
String
,
String
>)
result
.
getResult
().
get
(
"compnay"
);
car
.
setBizOrgName
(
map
.
get
(
"companyName"
));
}
}
}
Car
car1
=
iCarService
.
updateOneById
(
car
);
Car
car1
=
iCarService
.
updateOneById
(
car
);
CarController
controllerProxy
=
SpringUtils
.
getBean
(
CarController
.
class
);
CarController
controllerProxy
=
SpringUtils
.
getBean
(
CarController
.
class
);
...
@@ -923,8 +1027,7 @@ public class CarController extends AbstractBaseController {
...
@@ -923,8 +1027,7 @@ public class CarController extends AbstractBaseController {
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"获取九大类二级统计"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"获取九大类二级统计"
)
@RequestMapping
(
value
=
"/getCarList/{ercode}"
,
method
=
RequestMethod
.
GET
,
produces
=
"application/json;charset=UTF-8"
)
@RequestMapping
(
value
=
"/getCarList/{ercode}"
,
method
=
RequestMethod
.
GET
,
produces
=
"application/json;charset=UTF-8"
)
public
IPage
<
Car
>
getCarList
(
@PathVariable
(
value
=
"ercode"
)
String
ercode
,
String
orgcode
,
Car
car
,
String
public
IPage
<
Car
>
getCarList
(
@PathVariable
(
value
=
"ercode"
)
String
ercode
,
String
orgcode
,
Car
car
,
String
pageNum
,
pageNum
,
String
pageSize
)
{
String
pageSize
)
{
Page
<
Car
>
pageBean
;
Page
<
Car
>
pageBean
;
if
(
StringUtils
.
isBlank
(
pageNum
)
||
StringUtils
.
isBlank
(
pageSize
))
{
if
(
StringUtils
.
isBlank
(
pageNum
)
||
StringUtils
.
isBlank
(
pageSize
))
{
...
@@ -1098,8 +1201,8 @@ public class CarController extends AbstractBaseController {
...
@@ -1098,8 +1201,8 @@ public class CarController extends AbstractBaseController {
Map
<
Long
,
List
<
CarIndexVo
>>
map
=
null
;
Map
<
Long
,
List
<
CarIndexVo
>>
map
=
null
;
// String orgCode = getOrgCode();
// String orgCode = getOrgCode();
ReginParams
ReginParams
=
getSelectedOrgInfo
();
ReginParams
ReginParams
=
getSelectedOrgInfo
();
String
orgCode
=
ReginParams
.
getPersonIdentity
().
getBizOrgCode
();
String
orgCode
=
ReginParams
.
getPersonIdentity
().
getBizOrgCode
();
List
<
CarIndexVo
>
carVoList
=
iCarService
.
getCarsIotInfo
(
orgCode
);
List
<
CarIndexVo
>
carVoList
=
iCarService
.
getCarsIotInfo
(
orgCode
);
if
(!
carVoList
.
isEmpty
())
{
if
(!
carVoList
.
isEmpty
())
{
...
@@ -1251,9 +1354,9 @@ public class CarController extends AbstractBaseController {
...
@@ -1251,9 +1354,9 @@ public class CarController extends AbstractBaseController {
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"获取消防队伍的消防车辆"
,
notes
=
"获取消防队伍的消防车辆"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"获取消防队伍的消防车辆"
,
notes
=
"获取消防队伍的消防车辆"
)
public
ResponseModel
getTeamCarList
(
@RequestParam
(
required
=
false
)
Long
id
,
public
ResponseModel
getTeamCarList
(
@RequestParam
(
required
=
false
)
Long
id
,
@RequestParam
(
required
=
false
)
String
sequenceNbr
,
@RequestParam
(
required
=
false
)
String
sequenceNbr
,
@RequestParam
(
required
=
false
)
Double
longitude
,
@RequestParam
(
required
=
false
)
Double
longitude
,
@RequestParam
(
required
=
false
)
Double
latitude
)
{
@RequestParam
(
required
=
false
)
Double
latitude
)
{
return
CommonResponseUtil
.
success
(
iCarService
.
getTeamCarList
(
sequenceNbr
,
id
,
longitude
,
latitude
));
return
CommonResponseUtil
.
success
(
iCarService
.
getTeamCarList
(
sequenceNbr
,
id
,
longitude
,
latitude
));
}
}
/**
/**
...
@@ -1302,7 +1405,6 @@ public class CarController extends AbstractBaseController {
...
@@ -1302,7 +1405,6 @@ public class CarController extends AbstractBaseController {
return
ResponseHelper
.
buildResponse
(
menusList
.
getResult
());
return
ResponseHelper
.
buildResponse
(
menusList
.
getResult
());
}
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/iot/companyTreeByUserAndType"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/iot/companyTreeByUserAndType"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"根据登录人及类型获取公司部门树"
,
notes
=
"根据登录人及类型获取公司部门树"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"根据登录人及类型获取公司部门树"
,
notes
=
"根据登录人及类型获取公司部门树"
)
...
@@ -1310,4 +1412,11 @@ public class CarController extends AbstractBaseController {
...
@@ -1310,4 +1412,11 @@ public class CarController extends AbstractBaseController {
FeignClientResult
<
List
<
OrgMenuDto
>>
menusList
=
jcsFeign
.
getCompanyDeptTreeWithAuth
(
iotAuthKey
,
null
);
FeignClientResult
<
List
<
OrgMenuDto
>>
menusList
=
jcsFeign
.
getCompanyDeptTreeWithAuth
(
iotAuthKey
,
null
);
return
ResponseHelper
.
buildResponse
(
menusList
.
getResult
());
return
ResponseHelper
.
buildResponse
(
menusList
.
getResult
());
}
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/getQRCode"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"获取二维码图片"
,
notes
=
"获取二维码图片"
)
public
ResponseModel
<
Object
>
getQRCode
(
long
id
)
throws
Exception
{
return
ResponseHelper
.
buildResponse
(
iCarService
.
getQRCode
(
id
));
}
}
}
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 {
...
@@ -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"
)
@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
;
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.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.RequestHeader
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
/**
/**
* @author DELL
* @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
{
public
interface
IotFeign
{
@RequestMapping
(
value
=
"/v1/livedata/list"
,
method
=
RequestMethod
.
GET
,
consumes
=
"application/json"
)
@RequestMapping
(
value
=
"/v1/livedata/list"
,
method
=
RequestMethod
.
GET
,
consumes
=
"application/json"
)
ResponseModel
selectList
(
ResponseModel
selectList
(
@RequestHeader
(
"appKey"
)
String
appKey
,
@RequestHeader
(
"product"
)
String
product
,
@RequestHeader
(
"appKey"
)
String
appKey
,
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"timeStart"
)
String
beginDate
,
@RequestHeader
(
"product"
)
String
product
,
@RequestParam
(
value
=
"timeEnd"
)
String
endDate
,
@RequestParam
(
value
=
"productKey"
)
String
productKey
,
@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
(
value
=
"deviceName"
)
String
deviceName
,
@RequestParam
(
required
=
false
,
value
=
"fieldKey"
)
String
fieldKey
);
@RequestParam
(
required
=
false
,
value
=
"fieldKey"
)
String
fieldKey
);
@RequestMapping
(
value
=
"/v1/livedata/page"
,
method
=
RequestMethod
.
GET
,
consumes
=
"application/json"
)
@RequestMapping
(
value
=
"/v1/livedata/page"
,
method
=
RequestMethod
.
GET
,
consumes
=
"application/json"
)
ResponseModel
selectPage
(
ResponseModel
selectPage
(
@RequestHeader
(
"appKey"
)
String
appKey
,
@RequestHeader
(
"product"
)
String
product
,
@RequestHeader
(
"appKey"
)
String
appKey
,
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"timeStart"
)
String
beginDate
,
@RequestHeader
(
"product"
)
String
product
,
@RequestParam
(
value
=
"timeEnd"
)
String
endDate
,
@RequestParam
(
value
=
"productKey"
)
String
productKey
,
@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
(
value
=
"deviceName"
)
String
deviceName
,
@RequestParam
(
required
=
false
,
value
=
"fieldKey"
)
String
fieldKey
,
@RequestParam
(
required
=
false
,
value
=
"fieldKey"
)
String
fieldKey
,
@RequestParam
(
value
=
"current"
)
Integer
current
,
@RequestParam
(
value
=
"current"
)
Integer
current
,
@RequestParam
(
value
=
"size"
)
Integer
size
);
@RequestParam
(
value
=
"size"
)
Integer
size
);
@RequestMapping
(
value
=
"v1/livedata/common/top"
,
method
=
RequestMethod
.
GET
,
consumes
=
"application/json"
)
@RequestMapping
(
value
=
"v1/livedata/common/top"
,
method
=
RequestMethod
.
GET
,
consumes
=
"application/json"
)
ResponseModel
selectOne
(
ResponseModel
selectOne
(
@RequestHeader
(
"appKey"
)
String
appKey
,
@RequestHeader
(
"product"
)
String
product
,
@RequestHeader
(
"appKey"
)
String
appKey
,
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"top"
)
String
top
,
@RequestHeader
(
"product"
)
String
product
,
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"top"
)
String
top
,
@RequestParam
(
value
=
"productKey"
)
String
productKey
,
@RequestParam
(
value
=
"productKey"
)
String
productKey
,
@RequestParam
(
value
=
"deviceName"
)
String
deviceName
,
@RequestParam
(
value
=
"deviceName"
)
String
deviceName
,
@RequestParam
(
"FHS_FirePump_RunStatus"
)
String
key
,
@RequestParam
(
"FHS_FirePump_RunStatus"
)
String
key
,
@RequestParam
(
required
=
false
,
value
=
"fieldKey"
)
String
fieldKey
);
@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> {
...
@@ -82,6 +82,7 @@ public interface ICarService extends IService<Car> {
/**
/**
* 根据车辆id查询车辆详情信息
* 根据车辆id查询车辆详情信息
*
* @param id
* @param id
* @param orgCode
* @param orgCode
* @param isIot
* @param isIot
...
@@ -89,7 +90,6 @@ public interface ICarService extends IService<Car> {
...
@@ -89,7 +90,6 @@ public interface ICarService extends IService<Car> {
*/
*/
CarForUE4VO
getCarDetailByCarNumToThreeDimensional
(
Long
id
,
String
orgCode
);
CarForUE4VO
getCarDetailByCarNumToThreeDimensional
(
Long
id
,
String
orgCode
);
/**
/**
* 添加车辆
* 添加车辆
*/
*/
...
@@ -126,6 +126,7 @@ public interface ICarService extends IService<Car> {
...
@@ -126,6 +126,7 @@ public interface ICarService extends IService<Car> {
/**
/**
* 车辆详情接口
* 车辆详情接口
*
* @return List<CarInfoVo>
* @return List<CarInfoVo>
* @param teamId 队伍id
* @param teamId 队伍id
* @param name 车辆名称
* @param name 车辆名称
...
@@ -134,6 +135,7 @@ public interface ICarService extends IService<Car> {
...
@@ -134,6 +135,7 @@ public interface ICarService extends IService<Car> {
/**
/**
* 队伍车辆详情接口
* 队伍车辆详情接口
*
* @return List<CarInfoVo>
* @return List<CarInfoVo>
* @param teamId 队伍id
* @param teamId 队伍id
* @param name 车辆名称
* @param name 车辆名称
...
@@ -147,10 +149,11 @@ public interface ICarService extends IService<Car> {
...
@@ -147,10 +149,11 @@ public interface ICarService extends IService<Car> {
*/
*/
Boolean
updateCarStatus
(
List
<
CarStatusInfoDto
>
cars
);
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 idList 车辆ID集合
* @param teamId 队伍ID
* @param teamId 队伍ID
* @param nameKeys 属性编码,中间英文逗号隔开
* @param nameKeys 属性编码,中间英文逗号隔开
...
@@ -166,10 +169,12 @@ public interface ICarService extends IService<Car> {
...
@@ -166,10 +169,12 @@ public interface ICarService extends IService<Car> {
Object
getCarStateInfoByCarNum
(
String
carNum
);
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
* @return
*/
*/
List
<
CarFusionDto
>
getCarFusionList
();
List
<
CarFusionDto
>
getCarFusionList
();
...
@@ -179,10 +184,10 @@ public interface ICarService extends IService<Car> {
...
@@ -179,10 +184,10 @@ public interface ICarService extends IService<Car> {
*/
*/
void
refreshStaData
();
void
refreshStaData
();
/**
/**
* iot装备更新redis 统计数据
* iot装备更新redis 统计数据
*/
*/
void
iotrefreshStaData
();
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
...
@@ -17,6 +17,7 @@ import com.yeejoin.amos.component.feign.config.InnerInvokException;
...
@@ -17,6 +17,7 @@ import com.yeejoin.amos.component.feign.config.InnerInvokException;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
com.yeejoin.amos.feign.systemctl.Systemctl
;
import
com.yeejoin.equipmanage.common.datasync.entity.FireVehicle
;
import
com.yeejoin.equipmanage.common.datasync.entity.FireVehicle
;
import
com.yeejoin.equipmanage.common.dto.CarFusionDto
;
import
com.yeejoin.equipmanage.common.dto.CarFusionDto
;
import
com.yeejoin.equipmanage.common.dto.CarInfoDto
;
import
com.yeejoin.equipmanage.common.dto.CarInfoDto
;
...
@@ -35,23 +36,30 @@ import com.yeejoin.equipmanage.mapper.*;
...
@@ -35,23 +36,30 @@ import com.yeejoin.equipmanage.mapper.*;
import
com.yeejoin.equipmanage.remote.RemoteSecurityService
;
import
com.yeejoin.equipmanage.remote.RemoteSecurityService
;
import
com.yeejoin.equipmanage.service.*
;
import
com.yeejoin.equipmanage.service.*
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.http.entity.ContentType
;
import
org.gavaghan.geodesy.Ellipsoid
;
import
org.gavaghan.geodesy.Ellipsoid
;
import
org.gavaghan.geodesy.GeodeticCalculator
;
import
org.gavaghan.geodesy.GeodeticCalculator
;
import
org.gavaghan.geodesy.GlobalCoordinates
;
import
org.gavaghan.geodesy.GlobalCoordinates
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.mock.web.MockMultipartFile
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
org.typroject.tyboot.core.foundation.utils.Bean
;
import
org.typroject.tyboot.core.foundation.utils.Bean
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
javax.annotation.PostConstruct
;
import
javax.annotation.PostConstruct
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
java.io.ByteArrayInputStream
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.util.*
;
import
java.util.*
;
import
java.util.function.Consumer
;
import
java.util.function.Consumer
;
...
@@ -138,7 +146,6 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
...
@@ -138,7 +146,6 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
@Autowired
@Autowired
private
IEquipmentCategoryService
iEquipmentCategoryService
;
private
IEquipmentCategoryService
iEquipmentCategoryService
;
@Value
(
"${equip.dict.car-state}"
)
@Value
(
"${equip.dict.car-state}"
)
private
String
carState
;
private
String
carState
;
...
@@ -148,6 +155,9 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
...
@@ -148,6 +155,9 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
@Value
(
"${systemctl.sync.switch}"
)
@Value
(
"${systemctl.sync.switch}"
)
private
Boolean
syncSwitch
;
private
Boolean
syncSwitch
;
@Autowired
private
IWlCarMileageService
iWlCarMileageService
;
/**
/**
* 当前登录用户信息
* 当前登录用户信息
*/
*/
...
@@ -717,7 +727,8 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
...
@@ -717,7 +727,8 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
@Override
@Override
public
Map
<
String
,
String
>
loadingExtinguishants
(
Long
carId
,
List
<
ExtinguishantRequeset
>
extinguishants
)
{
public
Map
<
String
,
String
>
loadingExtinguishants
(
Long
carId
,
List
<
ExtinguishantRequeset
>
extinguishants
)
{
Car
car
=
this
.
getById
(
carId
);
Car
car
=
this
.
getById
(
carId
);
if
(
car
.
getCarState
().
equals
(
CarStatusEnum
.
WX
.
getCode
())
||
car
.
getCarState
().
equals
(
CarStatusEnum
.
BF
.
getCode
()))
{
if
(
car
.
getCarState
().
equals
(
CarStatusEnum
.
WX
.
getCode
())
||
car
.
getCarState
().
equals
(
CarStatusEnum
.
BF
.
getCode
()))
{
throw
new
RuntimeException
(
"报废维修车辆不能装载"
);
throw
new
RuntimeException
(
"报废维修车辆不能装载"
);
}
}
LoadingParams
params
=
new
LoadingParams
(
carId
,
extinguishants
);
LoadingParams
params
=
new
LoadingParams
(
carId
,
extinguishants
);
...
@@ -893,11 +904,13 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
...
@@ -893,11 +904,13 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
List
<
SystemDic
>
list
=
systemDicMapper
.
selectByMap
(
columnMap
);
List
<
SystemDic
>
list
=
systemDicMapper
.
selectByMap
(
columnMap
);
ParsePropertyUtil
.
setting
(
journal:
:
setState
,
()
->
list
.
get
(
0
).
getId
().
toString
());
ParsePropertyUtil
.
setting
(
journal:
:
setState
,
()
->
list
.
get
(
0
).
getId
().
toString
());
journal
.
setRemark
(
user
.
getRealName
()
+
"将"
+
equipmentDetail
.
getName
()
+
"装备装载到车牌号为【"
+
car
.
getCarNum
()
+
"】的车辆上。"
);
journal
.
setRemark
(
user
.
getRealName
()
+
"将"
+
equipmentDetail
.
getName
()
+
"装备装载到车牌号为【"
+
car
.
getCarNum
()
+
"】的车辆上。"
);
journal
.
setWarehouseStructureId
(
detail
.
getWarehouseStructureId
());
journal
.
setWarehouseStructureId
(
detail
.
getWarehouseStructureId
());
journal
.
setCarId
(
eq
.
getCarId
());
journal
.
setCarId
(
eq
.
getCarId
());
}
else
if
(
typeEnum
==
OnBoardEquipmentEnum
.
UNLOAD
)
{
}
else
if
(
typeEnum
==
OnBoardEquipmentEnum
.
UNLOAD
)
{
journal
.
setRemark
(
user
.
getRealName
()
+
"从车牌号为【"
+
car
.
getCarNum
()
+
"】的车辆上卸载了"
+
equipmentDetail
.
getName
()
+
"装备。"
);
journal
.
setRemark
(
user
.
getRealName
()
+
"从车牌号为【"
+
car
.
getCarNum
()
+
"】的车辆上卸载了"
+
equipmentDetail
.
getName
()
+
"装备。"
);
journal
.
setWarehouseStructureId
(
shelfCellId
);
journal
.
setWarehouseStructureId
(
shelfCellId
);
journal
.
setCarId
(
eq
.
getCarId
());
journal
.
setCarId
(
eq
.
getCarId
());
}
}
...
@@ -949,7 +962,7 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
...
@@ -949,7 +962,7 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
private
void
updateStockDetail
(
StockDetail
detail
,
String
type
,
Long
warehouseId
,
Long
shelfCellId
)
{
private
void
updateStockDetail
(
StockDetail
detail
,
String
type
,
Long
warehouseId
,
Long
shelfCellId
)
{
OnBoardEquipmentEnum
typeEnum
=
OnBoardEquipmentEnum
.
getEnum
(
type
);
OnBoardEquipmentEnum
typeEnum
=
OnBoardEquipmentEnum
.
getEnum
(
type
);
if
(
typeEnum
==
OnBoardEquipmentEnum
.
LOAD
)
{
if
(
typeEnum
==
OnBoardEquipmentEnum
.
LOAD
)
{
//
TODO 更新为自己去反,之前为减去1,这样在设备管理方式为批量管理时,就不对了
//
TODO 更新为自己去反,之前为减去1,这样在设备管理方式为批量管理时,就不对了
updateStock
(
detail
,
detail
.
getAmount
()
*
-
1
);
updateStock
(
detail
,
detail
.
getAmount
()
*
-
1
);
detail
.
setAmount
(
0.0
);
detail
.
setAmount
(
0.0
);
detail
.
setStatus
(
EquipStatusEnum
.
ONCAR
.
getCode
().
toString
());
detail
.
setStatus
(
EquipStatusEnum
.
ONCAR
.
getCode
().
toString
());
...
@@ -964,7 +977,7 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
...
@@ -964,7 +977,7 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
detail
.
setWarehouseStructureId
(
shelfCellId
);
detail
.
setWarehouseStructureId
(
shelfCellId
);
}
}
detail
.
setStatus
(
EquipStatusEnum
.
REPERTORY
.
getCode
().
toString
());
detail
.
setStatus
(
EquipStatusEnum
.
REPERTORY
.
getCode
().
toString
());
//
卸载将卸载的数量恢复
//
卸载将卸载的数量恢复
updateStock
(
detail
,
detail
.
getAmount
());
updateStock
(
detail
,
detail
.
getAmount
());
}
}
stockDetailMapper
.
updateById
(
detail
);
stockDetailMapper
.
updateById
(
detail
);
...
@@ -974,11 +987,12 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
...
@@ -974,11 +987,12 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
public
void
unloadEquipment
(
OnBoardEquipment
equipment
,
AgencyUserModel
user
)
{
public
void
unloadEquipment
(
OnBoardEquipment
equipment
,
AgencyUserModel
user
)
{
List
<
Equip
>
eqs
=
generate
(
equipment
);
List
<
Equip
>
eqs
=
generate
(
equipment
);
String
area
=
equipment
.
getArea
();
String
area
=
equipment
.
getArea
();
//TODO: 是否返回原始位置:true-是 false -否 ,equipment.getShelfCellCode() 为空或者为null,代表,装备的卸载是,放回原位
// TODO: 是否返回原始位置:true-是 false -否 ,equipment.getShelfCellCode()
// 为空或者为null,代表,装备的卸载是,放回原位
boolean
isOriPosition
=
StringUtil
.
isEmpty
(
equipment
.
getShelfCellCode
());
boolean
isOriPosition
=
StringUtil
.
isEmpty
(
equipment
.
getShelfCellCode
());
//
新存放的货位id,不放回原位使用
//
新存放的货位id,不放回原位使用
Long
shelfCellId
=
null
;
Long
shelfCellId
=
null
;
//
TODO: 不放回原位,查询存放位置(正常逻辑,应该是前端返回操作类型及货位id,后端不需要进行查询)
//
TODO: 不放回原位,查询存放位置(正常逻辑,应该是前端返回操作类型及货位id,后端不需要进行查询)
if
(!
isOriPosition
&&
equipment
.
getWarehouseId
()
!=
null
)
{
if
(!
isOriPosition
&&
equipment
.
getWarehouseId
()
!=
null
)
{
shelfCellId
=
queryShelfCellId
(
equipment
);
shelfCellId
=
queryShelfCellId
(
equipment
);
}
}
...
@@ -993,9 +1007,10 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
...
@@ -993,9 +1007,10 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
if
(
null
==
detail
)
{
if
(
null
==
detail
)
{
throw
new
RuntimeException
(
"二维码为【"
+
eq
.
getQrCode
()
+
"】的装备未记录在库!"
);
throw
new
RuntimeException
(
"二维码为【"
+
eq
.
getQrCode
()
+
"】的装备未记录在库!"
);
}
}
//
卸载将转载的数量回复回去
//
卸载将转载的数量回复回去
if
(
finalShelfCellId
!=
null
)
{
if
(
finalShelfCellId
!=
null
)
{
iEquipmentDetailService
.
update
(
new
UpdateWrapper
<
EquipmentDetail
>().
eq
(
"id"
,
eq
.
getEquipmentDetailId
()).
set
(
"area"
,
area
));
iEquipmentDetailService
.
update
(
new
UpdateWrapper
<
EquipmentDetail
>().
eq
(
"id"
,
eq
.
getEquipmentDetailId
()).
set
(
"area"
,
area
));
}
}
detail
.
setAmount
(
equipmentOnCar
.
getAmount
());
detail
.
setAmount
(
equipmentOnCar
.
getAmount
());
unLoad
(
equipmentOnCar
);
unLoad
(
equipmentOnCar
);
...
@@ -1033,7 +1048,7 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
...
@@ -1033,7 +1048,7 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
}
}
private
Long
queryShelfCellId
(
OnBoardEquipment
equipment
)
{
private
Long
queryShelfCellId
(
OnBoardEquipment
equipment
)
{
//
存放到其他位置
//
存放到其他位置
Map
<
String
,
Object
>
columnMap
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
columnMap
=
new
HashMap
<
String
,
Object
>();
columnMap
.
put
(
"warehouse_id"
,
equipment
.
getWarehouseId
());
columnMap
.
put
(
"warehouse_id"
,
equipment
.
getWarehouseId
());
columnMap
.
put
(
"code"
,
equipment
.
getShelfCellCode
());
columnMap
.
put
(
"code"
,
equipment
.
getShelfCellCode
());
...
@@ -1082,7 +1097,7 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
...
@@ -1082,7 +1097,7 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
@Override
@Override
public
Car
saveOne
(
Car
car
)
{
public
Car
saveOne
(
Car
car
)
{
//
如果没有状态默认状态在位
//
如果没有状态默认状态在位
if
(
StringUtils
.
isEmpty
(
car
.
getCarState
()))
{
if
(
StringUtils
.
isEmpty
(
car
.
getCarState
()))
{
car
.
setCarState
(
CarStatusEnum
.
ZW
.
getCode
());
car
.
setCarState
(
CarStatusEnum
.
ZW
.
getCode
());
}
}
...
@@ -1130,7 +1145,7 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
...
@@ -1130,7 +1145,7 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
wrapper
.
orderByDesc
(
BaseEntity:
:
getCreateDate
);
wrapper
.
orderByDesc
(
BaseEntity:
:
getCreateDate
);
List
<
Car
>
carList
=
this
.
list
(
wrapper
);
List
<
Car
>
carList
=
this
.
list
(
wrapper
);
List
<
Equipment
>
equipmentList
=
iEquipmentService
.
list
();
List
<
Equipment
>
equipmentList
=
iEquipmentService
.
list
();
/*统一车辆图片使用装备定义图片 2021-10-27 陈召
*/
/* 统一车辆图片使用装备定义图片 2021-10-27 陈召
*/
equipmentList
.
stream
().
filter
(
e
->
e
.
getName
().
contains
(
"车"
)).
forEach
(
e
->
{
equipmentList
.
stream
().
filter
(
e
->
e
.
getName
().
contains
(
"车"
)).
forEach
(
e
->
{
carList
.
forEach
(
car
->
{
carList
.
forEach
(
car
->
{
if
(
e
.
getId
().
equals
(
car
.
getEquipmentId
()))
{
if
(
e
.
getId
().
equals
(
car
.
getEquipmentId
()))
{
...
@@ -1142,18 +1157,19 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
...
@@ -1142,18 +1157,19 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
}
}
});
});
});
});
/*统一车辆图片使用装备定义图片 2021-10-27 陈召*/
/* 统一车辆图片使用装备定义图片 2021-10-27 陈召 */
Map
<
Long
,
Equipment
>
keyMap
=
equipmentList
.
stream
().
collect
(
Collectors
.
toMap
(
BaseEntity:
:
getId
,
Function
.
identity
()));
Map
<
Long
,
Equipment
>
keyMap
=
equipmentList
.
stream
()
.
collect
(
Collectors
.
toMap
(
BaseEntity:
:
getId
,
Function
.
identity
()));
List
<
EquipmentCategory
>
categoryList
=
iEquipmentCategoryService
.
list
();
List
<
EquipmentCategory
>
categoryList
=
iEquipmentCategoryService
.
list
();
Map
<
Long
,
String
>
categoryMap
=
categoryList
.
stream
().
collect
(
Collectors
.
toMap
(
BaseEntity:
:
getId
,
EquipmentCategory:
:
getName
));
Map
<
Long
,
String
>
categoryMap
=
categoryList
.
stream
()
.
collect
(
Collectors
.
toMap
(
BaseEntity:
:
getId
,
EquipmentCategory:
:
getName
));
List
<
UploadFile
>
fileList
=
iUploadFileService
.
list
(
new
LambdaQueryWrapper
<
UploadFile
>()
List
<
UploadFile
>
fileList
=
iUploadFileService
.
list
(
new
LambdaQueryWrapper
<
UploadFile
>()
.
eq
(
UploadFile:
:
getObjectType
,
"car"
)
.
eq
(
UploadFile:
:
getObjectType
,
"car"
).
eq
(
UploadFile:
:
getFileType
,
"image"
));
.
eq
(
UploadFile:
:
getFileType
,
"image"
));
// 车载装备
// 车载装备
List
<
Map
<
String
,
Object
>>
carResourceMapList
=
this
.
baseMapper
.
getCarResourceMapList
(
null
);
List
<
Map
<
String
,
Object
>>
carResourceMapList
=
this
.
baseMapper
.
getCarResourceMapList
(
null
);
Map
<
String
,
List
<
Map
<
String
,
Object
>>>
carResourceMap
=
Map
<
String
,
List
<
Map
<
String
,
Object
>>>
carResourceMap
=
carResourceMapList
.
stream
()
carResourceMapList
.
stream
()
.
collect
(
Collectors
.
groupingBy
(
car
->
car
.
get
(
"carId"
).
toString
()));
.
collect
(
Collectors
.
groupingBy
(
car
->
car
.
get
(
"carId"
).
toString
()));
return
carList
.
stream
().
map
(
car
->
{
return
carList
.
stream
().
map
(
car
->
{
CarInfoDto
carInfoVo
=
new
CarInfoDto
();
CarInfoDto
carInfoVo
=
new
CarInfoDto
();
Bean
.
copyExistPropertis
(
car
,
carInfoVo
);
Bean
.
copyExistPropertis
(
car
,
carInfoVo
);
...
@@ -1163,7 +1179,7 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
...
@@ -1163,7 +1179,7 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
carInfoVo
.
setCategoryId
(
equipment
!=
null
?
equipment
.
getCategoryId
()
:
null
);
carInfoVo
.
setCategoryId
(
equipment
!=
null
?
equipment
.
getCategoryId
()
:
null
);
carInfoVo
.
setCategoryName
(
categoryMap
.
get
(
carInfoVo
.
getCategoryId
()));
carInfoVo
.
setCategoryName
(
categoryMap
.
get
(
carInfoVo
.
getCategoryId
()));
carInfoVo
.
setName
(
car
.
getName
());
carInfoVo
.
setName
(
car
.
getName
());
if
(
car
.
getImg
()
!=
null
)
{
if
(
car
.
getImg
()
!=
null
)
{
List
<
String
>
img
=
new
ArrayList
<>();
List
<
String
>
img
=
new
ArrayList
<>();
img
.
add
(
car
.
getImg
().
get
(
0
).
getUrl
());
img
.
add
(
car
.
getImg
().
get
(
0
).
getUrl
());
...
@@ -1192,8 +1208,11 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
...
@@ -1192,8 +1208,11 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
CarIndexVo
carIndexVo
=
new
CarIndexVo
();
CarIndexVo
carIndexVo
=
new
CarIndexVo
();
carIndexVo
.
setId
(
car
.
getId
());
carIndexVo
.
setId
(
car
.
getId
());
List
<
CarPropertyVo
>
propertyList
=
carPropertyService
.
getCarPropertyList
(
carIndexVo
);
List
<
CarPropertyVo
>
propertyList
=
carPropertyService
.
getCarPropertyList
(
carIndexVo
);
List
<
CarPropertyVo
>
fireVehicleInfoList
=
propertyList
.
stream
().
filter
(
propertyVo
->
0
==
propertyVo
.
getIsIot
()).
collect
(
Collectors
.
toList
());
List
<
CarPropertyVo
>
fireVehicleInfoList
=
propertyList
.
stream
().
filter
(
propertyVo
->
0
==
propertyVo
.
getIsIot
())
List
<
CarPropertyVo
>
fireVehicleMeasurementList
=
propertyList
.
stream
().
filter
(
propertyVo
->
propertyVo
.
getIsIot
()
!=
null
&&
1
==
propertyVo
.
getIsIot
()).
collect
(
Collectors
.
toList
());
.
collect
(
Collectors
.
toList
());
List
<
CarPropertyVo
>
fireVehicleMeasurementList
=
propertyList
.
stream
()
.
filter
(
propertyVo
->
propertyVo
.
getIsIot
()
!=
null
&&
1
==
propertyVo
.
getIsIot
())
.
collect
(
Collectors
.
toList
());
syncDataService
.
syncCreatedFireVehicleInfo
(
fireVehicleInfoList
);
syncDataService
.
syncCreatedFireVehicleInfo
(
fireVehicleInfoList
);
syncDataService
.
syncCreatedFireVehicleMeasurement
(
fireVehicleMeasurementList
);
syncDataService
.
syncCreatedFireVehicleMeasurement
(
fireVehicleMeasurementList
);
}
}
...
@@ -1201,8 +1220,11 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
...
@@ -1201,8 +1220,11 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
@Override
@Override
public
void
dataSyncDeletedIds
(
List
<
Long
>
carIds
)
{
public
void
dataSyncDeletedIds
(
List
<
Long
>
carIds
)
{
List
<
CarPropertyVo
>
propertyList
=
carPropertyService
.
getCarPropertyListByCarIds
(
carIds
);
List
<
CarPropertyVo
>
propertyList
=
carPropertyService
.
getCarPropertyListByCarIds
(
carIds
);
List
<
Long
>
fireVehicleInfoList
=
propertyList
.
stream
().
filter
(
propertyVo
->
0
==
propertyVo
.
getIsIot
()).
map
(
CarPropertyVo:
:
getId
).
collect
(
Collectors
.
toList
());
List
<
Long
>
fireVehicleInfoList
=
propertyList
.
stream
().
filter
(
propertyVo
->
0
==
propertyVo
.
getIsIot
())
List
<
Long
>
fireVehicleMeasurementList
=
propertyList
.
stream
().
filter
(
propertyVo
->
propertyVo
.
getIsIot
()
!=
null
&&
1
==
propertyVo
.
getIsIot
()).
map
(
CarPropertyVo:
:
getId
).
collect
(
Collectors
.
toList
());
.
map
(
CarPropertyVo:
:
getId
).
collect
(
Collectors
.
toList
());
List
<
Long
>
fireVehicleMeasurementList
=
propertyList
.
stream
()
.
filter
(
propertyVo
->
propertyVo
.
getIsIot
()
!=
null
&&
1
==
propertyVo
.
getIsIot
())
.
map
(
CarPropertyVo:
:
getId
).
collect
(
Collectors
.
toList
());
syncDataService
.
syncDeletedFireVehicleInfo
(
fireVehicleInfoList
);
syncDataService
.
syncDeletedFireVehicleInfo
(
fireVehicleInfoList
);
syncDataService
.
syncDeletedFireVehicleMeasurement
(
fireVehicleMeasurementList
);
syncDataService
.
syncDeletedFireVehicleMeasurement
(
fireVehicleMeasurementList
);
}
}
...
@@ -1224,8 +1246,10 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
...
@@ -1224,8 +1246,10 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
public
Car
updateOneById
(
Car
car
)
{
public
Car
updateOneById
(
Car
car
)
{
String
orgCode
=
remoteSecurityService
.
getAgencyUser
().
getCompanys
().
get
(
0
).
getOrgCode
();
String
orgCode
=
remoteSecurityService
.
getAgencyUser
().
getCompanys
().
get
(
0
).
getOrgCode
();
car
.
setOrgCode
(
orgCode
);
car
.
setOrgCode
(
orgCode
);
// @TableField(updateStrategy = FieldStrategy.IGNORED) 置空不生效 为空单独设置 by kongfm 2021-09-09
// @TableField(updateStrategy = FieldStrategy.IGNORED) 置空不生效 为空单独设置 by kongfm
this
.
update
(
new
LambdaUpdateWrapper
<
Car
>().
set
(
Car:
:
getAgencyId
,
car
.
getAgencyId
()).
set
(
Car:
:
getTeamId
,
car
.
getTeamId
()).
eq
(
Car:
:
getId
,
car
.
getId
()));
// 2021-09-09
this
.
update
(
new
LambdaUpdateWrapper
<
Car
>().
set
(
Car:
:
getAgencyId
,
car
.
getAgencyId
())
.
set
(
Car:
:
getTeamId
,
car
.
getTeamId
()).
eq
(
Car:
:
getId
,
car
.
getId
()));
boolean
update
=
this
.
updateById
(
car
);
boolean
update
=
this
.
updateById
(
car
);
// AST数据同步
// AST数据同步
if
(
update
&&
syncSwitch
)
{
if
(
update
&&
syncSwitch
)
{
...
@@ -1324,13 +1348,27 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
...
@@ -1324,13 +1348,27 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
equipment
.
setEquipmentCategory
(
equipmentCategoryMapper
.
selectById
(
equipment
.
getCategoryId
()));
equipment
.
setEquipmentCategory
(
equipmentCategoryMapper
.
selectById
(
equipment
.
getCategoryId
()));
}
}
car
.
setEquipment
(
equipment
);
car
.
setEquipment
(
equipment
);
car
.
setCountryName
(
iSystemDicService
.
getOne
(
new
QueryWrapper
<
SystemDic
>().
eq
(
"id"
,
car
.
getCountry
())).
getName
());
car
.
setCountryName
(
car
.
setChassisCountryName
(
iSystemDicService
.
getOne
(
new
QueryWrapper
<
SystemDic
>().
eq
(
"id"
,
car
.
getCountry
())).
getName
());
iSystemDicService
.
getOne
(
new
QueryWrapper
<
SystemDic
>().
eq
(
"id"
,
car
.
getChassisCountry
())).
getName
());
if
(!
ObjectUtils
.
isEmpty
(
car
.
getChassisCountry
()))
{
car
.
setJournals
(
journalService
.
list
(
new
QueryWrapper
<
Journal
>().
eq
(
"car_id"
,
car
.
getId
()).
orderByAsc
(
"create_date"
)));
car
.
setChassisCountryName
(
iSystemDicService
.
getOne
(
new
QueryWrapper
<
SystemDic
>().
eq
(
"id"
,
car
.
getChassisCountry
())).
getName
());
}
car
.
setJournals
(
journalService
.
list
(
new
QueryWrapper
<
Journal
>().
eq
(
"car_id"
,
car
.
getId
()).
orderByAsc
(
"create_date"
)));
car
.
setEquipmentsOnCar
(
this
.
baseMapper
.
selectEquipmentOnCarAppList
(
car
.
getId
()));
car
.
setEquipmentsOnCar
(
this
.
baseMapper
.
selectEquipmentOnCarAppList
(
car
.
getId
()));
List
<
Equipment
>
equipment1
=
iEquipmentService
.
listByCategoryId
(
equipment
.
getCategoryId
());
List
<
Equipment
>
equipment1
=
iEquipmentService
.
listByCategoryId
(
equipment
.
getCategoryId
());
car
.
setUnit
(
equipment1
.
get
(
0
).
getUnit
());
car
.
setUnit
(
equipment1
.
get
(
0
).
getUnit
());
car
.
setCategoryId
(
equipment
.
getCategoryId
());
car
.
setImportStr
(
car
.
getIsImport
()
?
"进口"
:
"国产"
);
if
(!
ObjectUtils
.
isEmpty
(
car
.
getIotCode
()))
{
Integer
totalTravel
=
iWlCarMileageService
.
totalMileage
(
car
.
getIotCode
());
car
.
setTotalTravel
(
totalTravel
);
WlCarMileage
last
=
iWlCarMileageService
.
getOne
(
new
LambdaQueryWrapper
<
WlCarMileage
>().
eq
(
WlCarMileage:
:
getIotCode
,
car
.
getIotCode
())
.
orderByDesc
(
WlCarMileage:
:
getEndTime
).
last
(
"limit 1"
));
car
.
setSpeed
(
last
!=
null
?
last
.
getEndSpeed
()
:
null
);
}
return
car
;
return
car
;
}
}
...
@@ -1443,8 +1481,8 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
...
@@ -1443,8 +1481,8 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
if
(!
ValidationUtil
.
isEmpty
(
cars
))
{
if
(!
ValidationUtil
.
isEmpty
(
cars
))
{
List
<
String
>
carIdList
=
Lists
.
transform
(
cars
,
CarStatusInfoDto:
:
getSequenceNbr
);
List
<
String
>
carIdList
=
Lists
.
transform
(
cars
,
CarStatusInfoDto:
:
getSequenceNbr
);
List
<
Car
>
carList
=
carMapper
.
selectBatchIds
(
carIdList
);
List
<
Car
>
carList
=
carMapper
.
selectBatchIds
(
carIdList
);
Map
<
String
,
String
>
carStatusMap
=
Map
<
String
,
String
>
carStatusMap
=
cars
.
stream
()
cars
.
stream
()
.
collect
(
Collectors
.
toMap
(
CarStatusInfoDto:
:
getSequenceNbr
,
CarStatusInfoDto:
:
getStatus
));
.
collect
(
Collectors
.
toMap
(
CarStatusInfoDto:
:
getSequenceNbr
,
CarStatusInfoDto:
:
getStatus
));
carList
.
forEach
(
car
->
{
carList
.
forEach
(
car
->
{
String
carStatusCode
=
carStatusMap
.
get
(
car
.
getId
().
toString
());
String
carStatusCode
=
carStatusMap
.
get
(
car
.
getId
().
toString
());
// 可进行更新操作
// 可进行更新操作
...
@@ -1463,17 +1501,18 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
...
@@ -1463,17 +1501,18 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
}
}
@Override
@Override
public
List
<
CarDto
>
getTeamCarList
(
String
sequenceNbr
,
Long
id
,
Double
longitude
,
Double
latitude
)
{
public
List
<
CarDto
>
getTeamCarList
(
String
sequenceNbr
,
Long
id
,
Double
longitude
,
Double
latitude
)
{
List
<
CarDto
>
list
=
carMapper
.
getTeamCarList
(
sequenceNbr
,
id
,
carState
);
List
<
CarDto
>
list
=
carMapper
.
getTeamCarList
(
sequenceNbr
,
id
,
carState
);
if
(!
CollectionUtils
.
isEmpty
(
list
))
{
if
(!
CollectionUtils
.
isEmpty
(
list
))
{
if
(
longitude
!=
null
&&
latitude
!=
null
)
{
if
(
longitude
!=
null
&&
latitude
!=
null
)
{
List
<
Long
>
idList
=
list
.
stream
().
map
(
CarDto:
:
getSequenceNbr
).
collect
(
Collectors
.
toList
());
List
<
Long
>
idList
=
list
.
stream
().
map
(
CarDto:
:
getSequenceNbr
).
collect
(
Collectors
.
toList
());
List
<
CarPropertyVo
>
propertyList
=
getCarPropertyList
(
idList
,
null
,
nameKeys
,
1
);
List
<
CarPropertyVo
>
propertyList
=
getCarPropertyList
(
idList
,
null
,
nameKeys
,
1
);
if
(!
CollectionUtils
.
isEmpty
(
propertyList
))
{
if
(!
CollectionUtils
.
isEmpty
(
propertyList
))
{
list
.
stream
().
forEach
(
x
->
{
list
.
stream
().
forEach
(
x
->
{
List
<
CarPropertyVo
>
collect
=
propertyList
.
stream
().
filter
(
y
->
y
.
getCarId
().
equals
(
x
.
getSequenceNbr
())).
collect
(
Collectors
.
toList
());
List
<
CarPropertyVo
>
collect
=
propertyList
.
stream
()
final
Double
[]
longitudeVal
=
{
null
};
.
filter
(
y
->
y
.
getCarId
().
equals
(
x
.
getSequenceNbr
())).
collect
(
Collectors
.
toList
());
final
Double
[]
latitudeVal
=
{
null
};
final
Double
[]
longitudeVal
=
{
null
};
final
Double
[]
latitudeVal
=
{
null
};
collect
.
stream
().
forEach
(
z
->
{
collect
.
stream
().
forEach
(
z
->
{
String
nameKey
=
z
.
getNameKey
();
String
nameKey
=
z
.
getNameKey
();
String
value
=
z
.
getValue
();
String
value
=
z
.
getValue
();
...
@@ -1495,7 +1534,8 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
...
@@ -1495,7 +1534,8 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
if
(
longitudeVal
[
0
]
!=
null
&&
latitudeVal
[
0
]
!=
null
)
{
if
(
longitudeVal
[
0
]
!=
null
&&
latitudeVal
[
0
]
!=
null
)
{
GlobalCoordinates
source
=
new
GlobalCoordinates
(
longitudeVal
[
0
],
latitudeVal
[
0
]);
GlobalCoordinates
source
=
new
GlobalCoordinates
(
longitudeVal
[
0
],
latitudeVal
[
0
]);
GlobalCoordinates
target
=
new
GlobalCoordinates
(
longitude
,
latitude
);
GlobalCoordinates
target
=
new
GlobalCoordinates
(
longitude
,
latitude
);
double
distance
=
new
GeodeticCalculator
().
calculateGeodeticCurve
(
Ellipsoid
.
Sphere
,
source
,
target
).
getEllipsoidalDistance
();
double
distance
=
new
GeodeticCalculator
()
.
calculateGeodeticCurve
(
Ellipsoid
.
Sphere
,
source
,
target
).
getEllipsoidalDistance
();
BigDecimal
decimal
=
new
BigDecimal
(
distance
/
1000
);
BigDecimal
decimal
=
new
BigDecimal
(
distance
/
1000
);
x
.
setDistance
(
decimal
.
setScale
(
2
,
BigDecimal
.
ROUND_HALF_DOWN
).
doubleValue
());
x
.
setDistance
(
decimal
.
setScale
(
2
,
BigDecimal
.
ROUND_HALF_DOWN
).
doubleValue
());
}
}
...
@@ -1527,7 +1567,6 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
...
@@ -1527,7 +1567,6 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
return
carMapper
.
getCarStateInfoByCarNum
(
carNum
);
return
carMapper
.
getCarStateInfoByCarNum
(
carNum
);
}
}
@Override
@Override
public
CarForUE4VO
getCarDetailByCarNumToThreeDimensional
(
Long
carId
,
String
orgCode
)
{
public
CarForUE4VO
getCarDetailByCarNumToThreeDimensional
(
Long
carId
,
String
orgCode
)
{
CarForUE4VO
carForUE4VO
=
new
CarForUE4VO
();
CarForUE4VO
carForUE4VO
=
new
CarForUE4VO
();
...
@@ -1543,7 +1582,8 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
...
@@ -1543,7 +1582,8 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
carForUE4VO
.
setCarType
(
equipment
.
getEquipmentCategory
().
getName
());
carForUE4VO
.
setCarType
(
equipment
.
getEquipmentCategory
().
getName
());
// 数据库字段(is_import 0->国产, 1->进口)
// 数据库字段(is_import 0->国产, 1->进口)
carForUE4VO
.
setIsImport
(
Boolean
.
TRUE
.
equals
(
car
.
getIsImport
())
?
TrueOrFalseEnum
.
real
.
desc
:
TrueOrFalseEnum
.
fake
.
desc
);
carForUE4VO
.
setIsImport
(
Boolean
.
TRUE
.
equals
(
car
.
getIsImport
())
?
TrueOrFalseEnum
.
real
.
desc
:
TrueOrFalseEnum
.
fake
.
desc
);
carForUE4VO
.
setBrand
(
car
.
getBrand
());
carForUE4VO
.
setBrand
(
car
.
getBrand
());
QueryWrapper
<
SystemDic
>
countryQueryWrapper
=
new
QueryWrapper
<>();
QueryWrapper
<
SystemDic
>
countryQueryWrapper
=
new
QueryWrapper
<>();
countryQueryWrapper
.
eq
(
"id"
,
car
.
getCountry
());
countryQueryWrapper
.
eq
(
"id"
,
car
.
getCountry
());
...
@@ -1552,7 +1592,8 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
...
@@ -1552,7 +1592,8 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
carForUE4VO
.
setStandard
(
car
.
getStandard
());
carForUE4VO
.
setStandard
(
car
.
getStandard
());
ManufacturerInfo
manufacturerInfo
=
iManufacturerInfoService
.
getById
(
car
.
getManufacturerId
());
ManufacturerInfo
manufacturerInfo
=
iManufacturerInfoService
.
getById
(
car
.
getManufacturerId
());
carForUE4VO
.
setManufacturerName
(
manufacturerInfo
.
getName
());
carForUE4VO
.
setManufacturerName
(
manufacturerInfo
.
getName
());
carForUE4VO
.
setCccAuth
(
Boolean
.
TRUE
.
equals
(
car
.
getCccAuth
())
?
TrueOrFalseEnum
.
real
.
flag
:
TrueOrFalseEnum
.
fake
.
flag
);
carForUE4VO
.
setCccAuth
(
Boolean
.
TRUE
.
equals
(
car
.
getCccAuth
())
?
TrueOrFalseEnum
.
real
.
flag
:
TrueOrFalseEnum
.
fake
.
flag
);
QueryWrapper
<
SystemDic
>
chassisCountryQueryWrapper
=
new
QueryWrapper
<>();
QueryWrapper
<
SystemDic
>
chassisCountryQueryWrapper
=
new
QueryWrapper
<>();
chassisCountryQueryWrapper
.
eq
(
"id"
,
car
.
getChassisCountry
());
chassisCountryQueryWrapper
.
eq
(
"id"
,
car
.
getChassisCountry
());
SystemDic
dic
=
iSystemDicService
.
getBaseMapper
().
selectOne
(
chassisCountryQueryWrapper
);
SystemDic
dic
=
iSystemDicService
.
getBaseMapper
().
selectOne
(
chassisCountryQueryWrapper
);
...
@@ -1561,26 +1602,26 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
...
@@ -1561,26 +1602,26 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
return
carForUE4VO
;
return
carForUE4VO
;
}
}
@Override
@Override
public
Page
<
CarInfoDto
>
equipmentCarList
(
Page
<
CarInfoDto
>
pag
,
Long
teamId
,
String
name
,
String
code
,
Long
id
,
Boolean
isNo
)
{
public
Page
<
CarInfoDto
>
equipmentCarList
(
Page
<
CarInfoDto
>
pag
,
Long
teamId
,
String
name
,
String
code
,
Long
id
,
Boolean
isNo
)
{
List
<
Car
>
carList
=
carMapper
.
equipmentCarList
(
pag
.
offset
(),
pag
.
getSize
(),
teamId
,
name
,
code
,
id
,
isNo
);
List
<
Car
>
carList
=
carMapper
.
equipmentCarList
(
pag
.
offset
(),
pag
.
getSize
(),
teamId
,
name
,
code
,
id
,
isNo
);
int
num
=
carMapper
.
equipmentCarListcount
(
teamId
,
name
,
code
,
id
,
isNo
);
int
num
=
carMapper
.
equipmentCarListcount
(
teamId
,
name
,
code
,
id
,
isNo
);
List
<
Equipment
>
equipmentList
=
iEquipmentService
.
list
();
List
<
Equipment
>
equipmentList
=
iEquipmentService
.
list
();
Map
<
Long
,
Equipment
>
keyMap
=
equipmentList
.
stream
().
collect
(
Collectors
.
toMap
(
BaseEntity:
:
getId
,
Function
.
identity
()));
Map
<
Long
,
Equipment
>
keyMap
=
equipmentList
.
stream
()
.
collect
(
Collectors
.
toMap
(
BaseEntity:
:
getId
,
Function
.
identity
()));
List
<
EquipmentCategory
>
categoryList
=
iEquipmentCategoryService
.
list
();
List
<
EquipmentCategory
>
categoryList
=
iEquipmentCategoryService
.
list
();
Map
<
Long
,
String
>
categoryMap
=
categoryList
.
stream
().
collect
(
Collectors
.
toMap
(
BaseEntity:
:
getId
,
EquipmentCategory:
:
getName
));
Map
<
Long
,
String
>
categoryMap
=
categoryList
.
stream
()
.
collect
(
Collectors
.
toMap
(
BaseEntity:
:
getId
,
EquipmentCategory:
:
getName
));
List
<
UploadFile
>
fileList
=
iUploadFileService
.
list
(
new
LambdaQueryWrapper
<
UploadFile
>()
List
<
UploadFile
>
fileList
=
iUploadFileService
.
list
(
new
LambdaQueryWrapper
<
UploadFile
>()
.
eq
(
UploadFile:
:
getObjectType
,
"car"
)
.
eq
(
UploadFile:
:
getObjectType
,
"car"
).
eq
(
UploadFile:
:
getFileType
,
"image"
));
.
eq
(
UploadFile:
:
getFileType
,
"image"
));
// 车载装备
// 车载装备
List
<
Map
<
String
,
Object
>>
carResourceMapList
=
this
.
baseMapper
.
getCarResourceMapList
(
null
);
List
<
Map
<
String
,
Object
>>
carResourceMapList
=
this
.
baseMapper
.
getCarResourceMapList
(
null
);
Map
<
String
,
List
<
Map
<
String
,
Object
>>>
carResourceMap
=
Map
<
String
,
List
<
Map
<
String
,
Object
>>>
carResourceMap
=
carResourceMapList
.
stream
()
carResourceMapList
.
stream
()
.
collect
(
Collectors
.
groupingBy
(
car
->
car
.
get
(
"carId"
).
toString
()));
.
collect
(
Collectors
.
groupingBy
(
car
->
car
.
get
(
"carId"
).
toString
()));
List
<
CarInfoDto
>
CarInfoDtoList
=
carList
.
stream
().
map
(
car
->
{
List
<
CarInfoDto
>
CarInfoDtoList
=
carList
.
stream
().
map
(
car
->
{
CarInfoDto
carInfoVo
=
new
CarInfoDto
();
CarInfoDto
carInfoVo
=
new
CarInfoDto
();
Bean
.
copyExistPropertis
(
car
,
carInfoVo
);
Bean
.
copyExistPropertis
(
car
,
carInfoVo
);
...
@@ -1590,8 +1631,8 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
...
@@ -1590,8 +1631,8 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
carInfoVo
.
setCategoryId
(
equipment
!=
null
?
equipment
.
getCategoryId
()
:
null
);
carInfoVo
.
setCategoryId
(
equipment
!=
null
?
equipment
.
getCategoryId
()
:
null
);
carInfoVo
.
setCategoryName
(
categoryMap
.
get
(
carInfoVo
.
getCategoryId
()));
carInfoVo
.
setCategoryName
(
categoryMap
.
get
(
carInfoVo
.
getCategoryId
()));
carInfoVo
.
setImage
(
fileList
.
stream
().
filter
(
f
->
f
.
getObjectId
().
equals
(
car
.
getId
()))
carInfoVo
.
setImage
(
fileList
.
stream
().
filter
(
f
->
f
.
getObjectId
().
equals
(
car
.
getId
()))
.
map
(
UploadFile:
:
getUrl
).
collect
(
Collectors
.
toList
()));
.
map
(
UploadFile:
:
getUrl
).
collect
(
Collectors
.
toList
()));
if
(
equipment
.
getImg
()
!=
null
)
{
if
(
equipment
.
getImg
()
!=
null
)
{
List
<
String
>
img
=
new
ArrayList
<>();
List
<
String
>
img
=
new
ArrayList
<>();
...
@@ -1599,7 +1640,6 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
...
@@ -1599,7 +1640,6 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
carInfoVo
.
setImage
(
img
);
carInfoVo
.
setImage
(
img
);
}
}
carInfoVo
.
setResourceList
(
carResourceMap
.
get
(
car
.
getId
().
toString
()));
carInfoVo
.
setResourceList
(
carResourceMap
.
get
(
car
.
getId
().
toString
()));
return
carInfoVo
;
return
carInfoVo
;
}).
collect
(
Collectors
.
toList
());
}).
collect
(
Collectors
.
toList
());
...
@@ -1630,10 +1670,44 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
...
@@ -1630,10 +1670,44 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
}
}
private
String
buildKey
(
Map
<
String
,
Object
>
row
)
{
private
String
buildKey
(
Map
<
String
,
Object
>
row
)
{
return
SourcesStatisticsImpl
.
PREFIX_CATEGORY_COUNT
+
row
.
get
(
"bizOrgCode"
).
toString
()
+
"_"
+
SourceTypeEnum
.
CAR
.
getCode
()
+
"_"
+
row
.
get
(
"categoryCode"
).
toString
();
return
SourcesStatisticsImpl
.
PREFIX_CATEGORY_COUNT
+
row
.
get
(
"bizOrgCode"
).
toString
()
+
"_"
+
SourceTypeEnum
.
CAR
.
getCode
()
+
"_"
+
row
.
get
(
"categoryCode"
).
toString
();
}
}
private
String
iotbuildKey
(
Map
<
String
,
Object
>
row
)
{
private
String
iotbuildKey
(
Map
<
String
,
Object
>
row
)
{
return
SourcesStatisticsImpl
.
PREFIX_CATEGORY_COUNT
+
row
.
get
(
"bizOrgCode"
).
toString
()
+
"_"
+
SourceTypeEnum
.
IOT
.
getCode
()
+
"_"
+
row
.
get
(
"categoryCode"
).
toString
();
return
SourcesStatisticsImpl
.
PREFIX_CATEGORY_COUNT
+
row
.
get
(
"bizOrgCode"
).
toString
()
+
"_"
+
SourceTypeEnum
.
IOT
.
getCode
()
+
"_"
+
row
.
get
(
"categoryCode"
).
toString
();
}
@Override
public
IPage
getQRCode
(
Long
id
)
{
Car
car
=
this
.
getById
(
id
);
if
(
car
==
null
)
{
return
null
;
}
String
url
=
""
;
JSONObject
jsonObject
=
new
JSONObject
();
byte
[]
bytes
=
QRCodeUtil
.
generateQRCodeImageByteData
(
car
.
getQrCode
(),
200
);
InputStream
inputStream
=
new
ByteArrayInputStream
(
bytes
);
try
{
MultipartFile
file
=
new
MockMultipartFile
(
car
.
getQrCode
()
+
".jpg"
,
car
.
getQrCode
()
+
".jpg"
,
ContentType
.
APPLICATION_OCTET_STREAM
.
toString
(),
inputStream
);
FeignClientResult
<
Map
<
String
,
String
>>
date
=
Systemctl
.
fileStorageClient
.
updateCommonFileFree
(
file
,
"jxiop/qrcode"
);
if
(
date
!=
null
)
{
Map
<
String
,
String
>
map
=
date
.
getResult
();
Iterator
<
String
>
it
=
map
.
keySet
().
iterator
();
String
urlString
=
it
.
next
();
jsonObject
.
put
(
"fileUrl"
,
urlString
);
jsonObject
.
put
(
"fileName"
,
car
.
getQrCode
());
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
List
list
=
new
ArrayList
();
list
.
add
(
jsonObject
);
IPage
page
=
new
Page
(
1
,
100
);
page
.
setRecords
(
list
);
return
page
;
}
}
}
}
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
...
@@ -163,22 +163,26 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
...
@@ -163,22 +163,26 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
@Value
(
"${redis_equip_type_count}"
)
@Value
(
"${redis_equip_type_count}"
)
private
String
equipTypeAndCount
;
private
String
equipTypeAndCount
;
@Autowired
IWlCarMileageService
iWlCarMileageService
;
@Override
@Override
public
List
<
EquipCountBySystemVO
>
getEquipCountBySystemId
(
Long
systemId
)
{
public
List
<
EquipCountBySystemVO
>
getEquipCountBySystemId
(
Long
systemId
)
{
return
this
.
baseMapper
.
getEquipCountBySystemId
(
systemId
);
return
this
.
baseMapper
.
getEquipCountBySystemId
(
systemId
);
}
}
@Override
@Override
public
List
<
EquiplistSpecificBySystemVO
>
public
List
<
EquiplistSpecificBySystemVO
>
getEquiplistBySystemId
(
Long
systemId
)
{
getEquiplistBySystemId
(
Long
systemId
)
{
return
this
.
baseMapper
.
getEquiplistBySystemId
(
systemId
);
return
this
.
baseMapper
.
getEquiplistBySystemId
(
systemId
);
}
}
@Override
@Override
public
Map
<
String
,
Object
>
queryEquipmenInfoAndCount
(
String
equimentName
,
String
equimentCode
,
String
construction
,
public
Map
<
String
,
Object
>
queryEquipmenInfoAndCount
(
String
equimentName
,
String
equimentCode
,
String
construction
,
String
maintenance
,
String
bizOrgCode
,
String
formGroupId
,
int
current
,
int
pageSize
,
String
controBoxBuildId
,
String
companyId
,
String
nameOrCode
)
{
String
maintenance
,
String
bizOrgCode
,
String
formGroupId
,
int
current
,
int
pageSize
,
String
controBoxBuildId
,
String
companyId
,
String
nameOrCode
)
{
Map
<
String
,
Object
>
map
=
equipmentManageService
.
queryEquipmenInfoAndCount
(
equimentName
,
equimentCode
,
Map
<
String
,
Object
>
map
=
equipmentManageService
.
queryEquipmenInfoAndCount
(
equimentName
,
equimentCode
,
construction
,
maintenance
,
bizOrgCode
,
formGroupId
,
current
,
pageSize
,
controBoxBuildId
,
companyId
,
nameOrCode
);
construction
,
maintenance
,
bizOrgCode
,
formGroupId
,
current
,
pageSize
,
controBoxBuildId
,
companyId
,
nameOrCode
);
List
<
EquipmentManageVo
>
dataList
=
(
List
<
EquipmentManageVo
>)
map
.
get
(
"dataList"
);
List
<
EquipmentManageVo
>
dataList
=
(
List
<
EquipmentManageVo
>)
map
.
get
(
"dataList"
);
StringBuilder
stb
=
new
StringBuilder
();
StringBuilder
stb
=
new
StringBuilder
();
dataList
.
forEach
(
y
->
{
dataList
.
forEach
(
y
->
{
...
@@ -188,14 +192,14 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
...
@@ -188,14 +192,14 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
stb
.
append
(
y
.
getChargePerson
());
stb
.
append
(
y
.
getChargePerson
());
}
}
});
});
//此userMap已被注掉
无用代码
// 此userMap已被注掉
无用代码
/* Map<String, String> userMap = new HashMap<>();
/*
if (StringUtil.isNotEmpty(stb)) {
* Map<String, String> userMap = new HashMap<>(); if
List<AgencyUserModel> agencyUserModels = remoteSecurityService.listUserByUserIds(stb.toString());
* (StringUtil.isNotEmpty(stb)) { List<AgencyUserModel> agencyUserModels =
agencyUserModels.forEach(z -> {
* remoteSecurityService.listUserByUserIds(stb.toString());
userMap.put(z.getUserId(), z.getRealName());
* agencyUserModels.forEach(z -> {
userMap.put(z.getUserId(), z.getRealName());
});
* }); }
}
*/
*/
dataList
.
forEach
(
x
->
{
dataList
.
forEach
(
x
->
{
// x.setChargePerson(userMap.get(x.getChargePerson()));
// x.setChargePerson(userMap.get(x.getChargePerson()));
x
.
setSystemimg
(
equipmentManageMapper
.
getFiles
(
valueOf
(
x
.
getId
()),
"face"
));
x
.
setSystemimg
(
equipmentManageMapper
.
getFiles
(
valueOf
(
x
.
getId
()),
"face"
));
...
@@ -425,8 +429,9 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
...
@@ -425,8 +429,9 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
// responses.add(p);
// responses.add(p);
// });
// });
// List<PointTreeVo> regionList = responses.stream().filter(r -> "TRUE".equals(r.getIsRegion())).collect(Collectors.toList());
// List<PointTreeVo> regionList = responses.stream().filter(r -> "TRUE".equals(r.getIsRegion())).collect(Collectors.toList());
if
(
"dl"
.
equals
(
type
)){
if
(
"dl"
.
equals
(
type
))
{
FeignClientResult
<
List
<
OrgUsrDto
>>
feignClientResult
=
jcsFeignClient
.
getCompanyDeptListWithAuth
(
authKey
,
"COMPANY"
,
"dl"
);
FeignClientResult
<
List
<
OrgUsrDto
>>
feignClientResult
=
jcsFeignClient
.
getCompanyDeptListWithAuth
(
authKey
,
"COMPANY"
,
"dl"
);
orgCode
=
feignClientResult
.
getResult
().
get
(
0
).
getBizOrgCode
();
orgCode
=
feignClientResult
.
getResult
().
get
(
0
).
getBizOrgCode
();
}
}
List
<
PointTreeVo
>
buildList
=
buildingMapper
.
getBuildList
(
orgCode
,
null
);
List
<
PointTreeVo
>
buildList
=
buildingMapper
.
getBuildList
(
orgCode
,
null
);
...
@@ -525,7 +530,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
...
@@ -525,7 +530,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
* @return
* @return
*/
*/
public
List
<
PointTreeVo
>
transferListToPointTree
(
List
<
PointTreeVo
>
allRiskSource
,
String
id
,
String
instanceId
)
{
public
List
<
PointTreeVo
>
transferListToPointTree
(
List
<
PointTreeVo
>
allRiskSource
,
String
id
,
String
instanceId
)
{
//
TODO id为空,为消防建筑使用;id不为空,为点位图使用
//
TODO id为空,为消防建筑使用;id不为空,为点位图使用
List
<
PointTreeVo
>
pointData
=
fireFightingSystemMapper
.
getPointData
(
id
,
instanceId
);
List
<
PointTreeVo
>
pointData
=
fireFightingSystemMapper
.
getPointData
(
id
,
instanceId
);
if
(!
CollectionUtils
.
isEmpty
(
pointData
))
{
if
(!
CollectionUtils
.
isEmpty
(
pointData
))
{
// 查询所有wl_source_scene,判断是否绑定
// 查询所有wl_source_scene,判断是否绑定
...
@@ -539,8 +544,10 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
...
@@ -539,8 +544,10 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
Map
<
Long
,
String
>
sourceSceneMap
=
null
;
Map
<
Long
,
String
>
sourceSceneMap
=
null
;
String
equipSpecificIds
=
null
;
String
equipSpecificIds
=
null
;
if
(!
CollectionUtils
.
isEmpty
(
sourceSceneList
))
{
if
(!
CollectionUtils
.
isEmpty
(
sourceSceneList
))
{
sourceSceneMap
=
sourceSceneList
.
stream
().
collect
(
Collectors
.
toMap
(
SourceScene:
:
getSourceId
,
SourceScene:
:
getPointInScene
));
sourceSceneMap
=
sourceSceneList
.
stream
()
List
<
String
>
equipSpecificIdList
=
sourceSceneList
.
stream
().
map
(
SourceScene:
:
getPointInScene
).
collect
(
Collectors
.
toList
());
.
collect
(
Collectors
.
toMap
(
SourceScene:
:
getSourceId
,
SourceScene:
:
getPointInScene
));
List
<
String
>
equipSpecificIdList
=
sourceSceneList
.
stream
().
map
(
SourceScene:
:
getPointInScene
)
.
collect
(
Collectors
.
toList
());
equipSpecificIds
=
String
.
join
(
","
,
equipSpecificIdList
);
equipSpecificIds
=
String
.
join
(
","
,
equipSpecificIdList
);
}
}
// 优化不查指标
// 优化不查指标
...
@@ -611,8 +618,9 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
...
@@ -611,8 +618,9 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
* @param id
* @param id
* @return
* @return
*/
*/
public
List
<
PointTreeVo
>
transferListToPointTreeNew
(
List
<
PointTreeVo
>
allRiskSource
,
String
id
,
String
instanceId
,
String
displayName
)
{
public
List
<
PointTreeVo
>
transferListToPointTreeNew
(
List
<
PointTreeVo
>
allRiskSource
,
String
id
,
String
instanceId
,
//TODO id为空,为消防建筑使用;id不为空,为点位图使用
String
displayName
)
{
// TODO id为空,为消防建筑使用;id不为空,为点位图使用
List
<
PointTreeVo
>
pointData
=
fireFightingSystemMapper
.
getPointDataNew
(
id
,
instanceId
,
displayName
);
List
<
PointTreeVo
>
pointData
=
fireFightingSystemMapper
.
getPointDataNew
(
id
,
instanceId
,
displayName
);
if
(!
CollectionUtils
.
isEmpty
(
pointData
))
{
if
(!
CollectionUtils
.
isEmpty
(
pointData
))
{
// 查询所有wl_source_scene,判断是否绑定
// 查询所有wl_source_scene,判断是否绑定
...
@@ -620,8 +628,10 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
...
@@ -620,8 +628,10 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
Map
<
Long
,
String
>
sourceSceneMap
=
null
;
Map
<
Long
,
String
>
sourceSceneMap
=
null
;
String
equipSpecificIds
=
null
;
String
equipSpecificIds
=
null
;
if
(!
CollectionUtils
.
isEmpty
(
sourceSceneList
))
{
if
(!
CollectionUtils
.
isEmpty
(
sourceSceneList
))
{
sourceSceneMap
=
sourceSceneList
.
stream
().
collect
(
Collectors
.
toMap
(
SourceScene:
:
getSourceId
,
SourceScene:
:
getPointInScene
));
sourceSceneMap
=
sourceSceneList
.
stream
()
List
<
String
>
equipSpecificIdList
=
sourceSceneList
.
stream
().
map
(
SourceScene:
:
getPointInScene
).
collect
(
Collectors
.
toList
());
.
collect
(
Collectors
.
toMap
(
SourceScene:
:
getSourceId
,
SourceScene:
:
getPointInScene
));
List
<
String
>
equipSpecificIdList
=
sourceSceneList
.
stream
().
map
(
SourceScene:
:
getPointInScene
)
.
collect
(
Collectors
.
toList
());
equipSpecificIds
=
String
.
join
(
","
,
equipSpecificIdList
);
equipSpecificIds
=
String
.
join
(
","
,
equipSpecificIdList
);
}
}
// 优化不查指标
// 优化不查指标
...
@@ -685,7 +695,6 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
...
@@ -685,7 +695,6 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
return
Collections
.
emptyList
();
return
Collections
.
emptyList
();
}
}
/**
/**
* 生成树结构
* 生成树结构
*
*
...
@@ -787,7 +796,8 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
...
@@ -787,7 +796,8 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
map
.
put
(
"color"
,
""
);
map
.
put
(
"color"
,
""
);
return
map
;
return
map
;
}
}
if
(
StringUtil
.
isNotEmpty
(
indexVo
.
getIndexValue
())
&&
TrueOrFalseEnum
.
real
.
value
.
toUpperCase
().
equals
(
indexVo
.
getIndexValue
().
toUpperCase
()))
{
if
(
StringUtil
.
isNotEmpty
(
indexVo
.
getIndexValue
())
&&
TrueOrFalseEnum
.
real
.
value
.
toUpperCase
().
equals
(
indexVo
.
getIndexValue
().
toUpperCase
()))
{
map
.
put
(
"runStatus"
,
indexVo
.
getIndexName
());
map
.
put
(
"runStatus"
,
indexVo
.
getIndexName
());
map
.
put
(
"color"
,
indexVo
.
getColor
());
map
.
put
(
"color"
,
indexVo
.
getColor
());
return
map
;
return
map
;
...
@@ -822,11 +832,11 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
...
@@ -822,11 +832,11 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
if
(
i
>
0
&&
syncSwitch
)
{
if
(
i
>
0
&&
syncSwitch
)
{
syncDataService
.
syncDeletedFireFightingSystem
(
Arrays
.
asList
(
id
));
syncDataService
.
syncDeletedFireFightingSystem
(
Arrays
.
asList
(
id
));
}
}
//
删除系统图与设备关系表
//
删除系统图与设备关系表
QueryWrapper
<
SourceScene
>
ssWrapper
=
new
QueryWrapper
<
SourceScene
>();
QueryWrapper
<
SourceScene
>
ssWrapper
=
new
QueryWrapper
<
SourceScene
>();
ssWrapper
.
lambda
().
eq
(
SourceScene:
:
getSourceId
,
id
);
ssWrapper
.
lambda
().
eq
(
SourceScene:
:
getSourceId
,
id
);
sourceSceneMapper
.
delete
(
ssWrapper
);
sourceSceneMapper
.
delete
(
ssWrapper
);
//
删除动态关联表单实例数据
//
删除动态关联表单实例数据
if
(
entity
.
getInstanceId
()
!=
null
)
{
if
(
entity
.
getInstanceId
()
!=
null
)
{
instanceService
.
remove
(
new
LambdaQueryWrapper
<
DynamicFormInstance
>().
eq
(
DynamicFormInstance:
:
getInstanceId
,
instanceService
.
remove
(
new
LambdaQueryWrapper
<
DynamicFormInstance
>().
eq
(
DynamicFormInstance:
:
getInstanceId
,
entity
.
getInstanceId
()));
entity
.
getInstanceId
()));
...
@@ -913,6 +923,16 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
...
@@ -913,6 +923,16 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
if
(!
x
.
getEqtype
().
startsWith
(
"4"
)
&&
StringUtil
.
isNotEmpty
(
x
.
getAmount
()))
{
if
(!
x
.
getEqtype
().
startsWith
(
"4"
)
&&
StringUtil
.
isNotEmpty
(
x
.
getAmount
()))
{
x
.
setAmount
(
x
.
getAmount
().
split
(
"\\."
)[
0
]);
x
.
setAmount
(
x
.
getAmount
().
split
(
"\\."
)[
0
]);
}
}
if
(!
ObjectUtils
.
isEmpty
(
x
.
getIotCode
()))
{
WlCarMileage
last
=
iWlCarMileageService
.
getOne
(
new
LambdaQueryWrapper
<
WlCarMileage
>().
eq
(
WlCarMileage:
:
getIotCode
,
x
.
getIotCode
())
.
orderByDesc
(
WlCarMileage:
:
getEndTime
).
last
(
"limit 1"
));
if
(
last
!=
null
)
{
x
.
setLongitude
(
last
.
getEndLongitude
());
x
.
setLatitude
(
last
.
getEndLatitude
());
}
}
});
});
return
list
;
return
list
;
}
}
...
@@ -1007,14 +1027,17 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
...
@@ -1007,14 +1027,17 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
map
.
put
(
"status"
,
list1
);
map
.
put
(
"status"
,
list1
);
resList
.
add
(
map
);
resList
.
add
(
map
);
i
++;
i
++;
};
}
;
}
}
return
resList
;
return
resList
;
}
}
@Override
@Override
public
List
<
Map
<
String
,
Object
>>
getFireSystemEquipStatusList
(
String
bizOrgCode
,
String
systemCode
,
String
categoryCodes
)
{
public
List
<
Map
<
String
,
Object
>>
getFireSystemEquipStatusList
(
String
bizOrgCode
,
String
systemCode
,
List
<
Map
<
String
,
Object
>>
list
=
fireFightingSystemMapper
.
getFireSystemEquipStatusList
(
bizOrgCode
,
systemCode
,
categoryCodes
);
String
categoryCodes
)
{
List
<
Map
<
String
,
Object
>>
list
=
fireFightingSystemMapper
.
getFireSystemEquipStatusList
(
bizOrgCode
,
systemCode
,
categoryCodes
);
List
<
Map
<
String
,
Object
>>
resList
=
new
ArrayList
<>();
List
<
Map
<
String
,
Object
>>
resList
=
new
ArrayList
<>();
int
i
=
1
;
int
i
=
1
;
if
(
0
<
list
.
size
())
{
if
(
0
<
list
.
size
())
{
...
@@ -1037,7 +1060,8 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
...
@@ -1037,7 +1060,8 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
map
.
put
(
"status"
,
list1
);
map
.
put
(
"status"
,
list1
);
resList
.
add
(
map
);
resList
.
add
(
map
);
i
++;
i
++;
};
}
;
}
}
return
resList
;
return
resList
;
}
}
...
@@ -1048,8 +1072,11 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
...
@@ -1048,8 +1072,11 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
}
}
@Override
@Override
public
IPage
<
EquipmentAlarmBySystemIdOrSourceIdVO
>
getEquipmentAlarmBySystemIdOrSourceIdVO
(
IPage
<
EquipmentAlarmBySystemIdOrSourceIdVO
>
page
,
Long
sourceId
,
Long
systemId
,
Integer
confirmType
,
String
createDate
,
String
type
,
String
equipmentId
)
{
public
IPage
<
EquipmentAlarmBySystemIdOrSourceIdVO
>
getEquipmentAlarmBySystemIdOrSourceIdVO
(
return
this
.
baseMapper
.
getEquipmentAlarmBySystemIdOrSourceIdVO
(
page
,
sourceId
,
systemId
,
confirmType
,
createDate
,
type
,
equipmentId
);
IPage
<
EquipmentAlarmBySystemIdOrSourceIdVO
>
page
,
Long
sourceId
,
Long
systemId
,
Integer
confirmType
,
String
createDate
,
String
type
,
String
equipmentId
)
{
return
this
.
baseMapper
.
getEquipmentAlarmBySystemIdOrSourceIdVO
(
page
,
sourceId
,
systemId
,
confirmType
,
createDate
,
type
,
equipmentId
);
}
}
private
static
String
getInet4Address
()
{
private
static
String
getInet4Address
()
{
...
@@ -1057,10 +1084,10 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
...
@@ -1057,10 +1084,10 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
String
ip
=
null
;
String
ip
=
null
;
try
{
try
{
nis
=
NetworkInterface
.
getNetworkInterfaces
();
nis
=
NetworkInterface
.
getNetworkInterfaces
();
for
(;
nis
.
hasMoreElements
();
)
{
for
(;
nis
.
hasMoreElements
();
)
{
NetworkInterface
ni
=
nis
.
nextElement
();
NetworkInterface
ni
=
nis
.
nextElement
();
Enumeration
<
InetAddress
>
ias
=
ni
.
getInetAddresses
();
Enumeration
<
InetAddress
>
ias
=
ni
.
getInetAddresses
();
for
(;
ias
.
hasMoreElements
();
)
{
for
(;
ias
.
hasMoreElements
();
)
{
InetAddress
ia
=
ias
.
nextElement
();
InetAddress
ia
=
ias
.
nextElement
();
if
(
ia
instanceof
Inet4Address
&&
!
ia
.
getHostAddress
().
equals
(
"127.0.0.1"
))
{
if
(
ia
instanceof
Inet4Address
&&
!
ia
.
getHostAddress
().
equals
(
"127.0.0.1"
))
{
ip
=
ia
.
getHostAddress
();
ip
=
ia
.
getHostAddress
();
...
@@ -1138,7 +1165,8 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
...
@@ -1138,7 +1165,8 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
@Override
@Override
public
List
<
FireFightingSystemTreeVo
>
getSystemTreeByOrgCode
(
String
bizOrgCode
)
{
public
List
<
FireFightingSystemTreeVo
>
getSystemTreeByOrgCode
(
String
bizOrgCode
)
{
// 获取公司部门list
// 获取公司部门list
List
<
OrgUsrDto
>
orgUsrLists
=
jcsRemoteService
.
getCompanyDeptListWithAuth
(
"COMPANY,DEPARTMENT"
,
bizOrgCode
,
null
);
List
<
OrgUsrDto
>
orgUsrLists
=
jcsRemoteService
.
getCompanyDeptListWithAuth
(
"COMPANY,DEPARTMENT"
,
bizOrgCode
,
null
);
List
<
FireFightingSystemTreeVo
>
fireFightingSystemTreeList
=
orgUsrLists
.
stream
().
map
(
key
->
{
List
<
FireFightingSystemTreeVo
>
fireFightingSystemTreeList
=
orgUsrLists
.
stream
().
map
(
key
->
{
FireFightingSystemTreeVo
vo
=
new
FireFightingSystemTreeVo
();
FireFightingSystemTreeVo
vo
=
new
FireFightingSystemTreeVo
();
vo
.
setId
(
valueOf
(
key
.
getSequenceNbr
()));
vo
.
setId
(
valueOf
(
key
.
getSequenceNbr
()));
...
@@ -1250,8 +1278,8 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
...
@@ -1250,8 +1278,8 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
@Override
@Override
public
Object
getCarTypeAndCount
(
String
bizOrgCode
)
{
public
Object
getCarTypeAndCount
(
String
bizOrgCode
)
{
if
(
redisUtils
.
hasKey
(
carTypeAndCount
+
bizOrgCode
))
{
if
(
redisUtils
.
hasKey
(
carTypeAndCount
+
bizOrgCode
))
{
return
JSONArray
.
parseArray
(
return
JSONArray
.
parseArray
(
JSONArray
.
toJSONString
(
redisUtils
.
get
(
carTypeAndCount
+
bizOrgCode
)),
JSONArray
.
toJSONString
(
redisUtils
.
get
(
carTypeAndCount
+
bizOrgCode
)),
EquipmentCategory
.
class
);
EquipmentCategory
.
class
);
}
else
{
}
else
{
return
refreshCarTypeAndCount
(
bizOrgCode
);
return
refreshCarTypeAndCount
(
bizOrgCode
);
}
}
...
@@ -1260,8 +1288,8 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
...
@@ -1260,8 +1288,8 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
@Override
@Override
public
Object
iotgetEquipmentTypeAndCount
(
String
bizOrgCode
)
throws
Exception
{
public
Object
iotgetEquipmentTypeAndCount
(
String
bizOrgCode
)
throws
Exception
{
if
(
redisUtils
.
hasKey
(
"iotTypeAndCount"
+
bizOrgCode
))
{
if
(
redisUtils
.
hasKey
(
"iotTypeAndCount"
+
bizOrgCode
))
{
return
JSONArray
.
parseArray
(
return
JSONArray
.
parseArray
(
JSONArray
.
toJSONString
(
redisUtils
.
get
(
"iotTypeAndCount"
+
bizOrgCode
)),
JSONArray
.
toJSONString
(
redisUtils
.
get
(
"iotTypeAndCount"
+
bizOrgCode
)),
EquipmentCategory
.
class
);
EquipmentCategory
.
class
);
}
else
{
}
else
{
return
iotrefreshEquipmentTypeAndCount
(
bizOrgCode
);
return
iotrefreshEquipmentTypeAndCount
(
bizOrgCode
);
}
}
...
@@ -1274,7 +1302,6 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
...
@@ -1274,7 +1302,6 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
// }
// }
// List<EquipmentCategory> list = typeListTree(responseList, bizOrgCode, SourceTypeEnum.IOT);
// List<EquipmentCategory> list = typeListTree(responseList, bizOrgCode, SourceTypeEnum.IOT);
List
<
EquipmentCategory
>
responseList
=
this
.
typeList
();
List
<
EquipmentCategory
>
responseList
=
this
.
typeList
();
if
(
responseList
==
null
||
responseList
.
size
()
<
1
)
{
if
(
responseList
==
null
||
responseList
.
size
()
<
1
)
{
return
null
;
return
null
;
...
@@ -1301,10 +1328,8 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
...
@@ -1301,10 +1328,8 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
return
list
;
return
list
;
}
}
public
List
<
EquipmentCategory
>
typeList
()
{
public
List
<
EquipmentCategory
>
typeList
()
{
return
this
.
iEquipmentCategoryService
return
this
.
iEquipmentCategoryService
.
getEquipmentCategoryList
(
Integer
.
valueOf
(
equipmentCategoryLeftTypeCode
));
.
getEquipmentCategoryList
(
Integer
.
valueOf
(
equipmentCategoryLeftTypeCode
));
}
}
public
List
<
EquipmentCategory
>
typeListTree
(
List
<
EquipmentCategory
>
equipmentCategorys
,
String
bizOrgCode
,
public
List
<
EquipmentCategory
>
typeListTree
(
List
<
EquipmentCategory
>
equipmentCategorys
,
String
bizOrgCode
,
...
@@ -1382,7 +1407,6 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
...
@@ -1382,7 +1407,6 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
return
resultMap
;
return
resultMap
;
}
}
@Override
@Override
public
Map
<
String
,
Object
>
equipAlarmTOP
(
HashMap
<
String
,
Object
>
hashMap
)
{
public
Map
<
String
,
Object
>
equipAlarmTOP
(
HashMap
<
String
,
Object
>
hashMap
)
{
Map
<
String
,
Object
>
resultMap
=
new
HashMap
<>();
Map
<
String
,
Object
>
resultMap
=
new
HashMap
<>();
...
@@ -1442,6 +1466,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
...
@@ -1442,6 +1466,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
public
Map
<
String
,
Object
>
statisticsByStation
(
String
bizOrgCode
)
{
public
Map
<
String
,
Object
>
statisticsByStation
(
String
bizOrgCode
)
{
return
fireFightingSystemMapper
.
statisticsByStation
(
bizOrgCode
);
return
fireFightingSystemMapper
.
statisticsByStation
(
bizOrgCode
);
}
}
@Override
@Override
public
Map
<
String
,
Object
>
todayAlarmEquipment
(
String
bizOrgCode
)
{
public
Map
<
String
,
Object
>
todayAlarmEquipment
(
String
bizOrgCode
)
{
Map
<
String
,
Object
>
map
=
fireFightingSystemMapper
.
todayAlarmEquipment
(
bizOrgCode
);
Map
<
String
,
Object
>
map
=
fireFightingSystemMapper
.
todayAlarmEquipment
(
bizOrgCode
);
...
@@ -1502,6 +1527,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
...
@@ -1502,6 +1527,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
public
Page
<
Map
<
String
,
Object
>>
equipList
(
Page
page
,
String
bizOrgCode
)
{
public
Page
<
Map
<
String
,
Object
>>
equipList
(
Page
page
,
String
bizOrgCode
)
{
return
fireFightingSystemMapper
.
equipList
(
page
,
bizOrgCode
);
return
fireFightingSystemMapper
.
equipList
(
page
,
bizOrgCode
);
}
}
@Override
@Override
public
BigScreenVo
getSystemAlarmInfoNum
(
String
companyCode
)
{
public
BigScreenVo
getSystemAlarmInfoNum
(
String
companyCode
)
{
BigScreenVo
bigScreenVo
=
new
BigScreenVo
();
BigScreenVo
bigScreenVo
=
new
BigScreenVo
();
...
@@ -1566,25 +1592,28 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
...
@@ -1566,25 +1592,28 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
ArrayList
<
Map
<
String
,
Object
>>
systemList
=
new
ArrayList
<>();
ArrayList
<
Map
<
String
,
Object
>>
systemList
=
new
ArrayList
<>();
if
(!
CollectionUtils
.
isEmpty
(
system
))
{
if
(!
CollectionUtils
.
isEmpty
(
system
))
{
// 换流站信息
// 换流站信息
if
(!
ObjectUtils
.
isEmpty
(
system
.
get
(
0
).
get
(
"stationName"
)))
{
if
(!
ObjectUtils
.
isEmpty
(
system
.
get
(
0
).
get
(
"stationName"
)))
{
map
.
put
(
"station"
,
system
.
get
(
0
).
get
(
"stationName"
));
map
.
put
(
"station"
,
system
.
get
(
0
).
get
(
"stationName"
));
}
else
{
}
else
{
map
.
put
(
"station"
,
""
);
map
.
put
(
"station"
,
""
);
}
}
map
.
put
(
"time"
,
startDate
.
substring
(
0
,
7
));
map
.
put
(
"time"
,
startDate
.
substring
(
0
,
7
));
// 单个系统数据
// 单个系统数据
for
(
Map
<
String
,
Object
>
sys
:
system
)
{
for
(
Map
<
String
,
Object
>
sys
:
system
)
{
HashMap
<
String
,
Object
>
systemData
=
new
HashMap
<>();
HashMap
<
String
,
Object
>
systemData
=
new
HashMap
<>();
List
<
Map
>
collect
=
indicatorConfiguration
.
stream
().
List
<
Map
>
collect
=
indicatorConfiguration
.
stream
()
filter
(
item
->
item
.
get
(
"code"
).
equals
(
String
.
valueOf
(
sys
.
get
(
"typeCode"
)))).
collect
(
Collectors
.
toList
());
.
filter
(
item
->
item
.
get
(
"code"
).
equals
(
String
.
valueOf
(
sys
.
get
(
"typeCode"
))))
.
collect
(
Collectors
.
toList
());
if
(!
CollectionUtils
.
isEmpty
(
collect
))
{
if
(!
CollectionUtils
.
isEmpty
(
collect
))
{
// 系统名称
// 系统名称
systemData
.
put
(
"systemName"
,
ObjectUtils
.
isEmpty
(
sys
.
get
(
"name"
))
?
""
:
String
.
valueOf
(
sys
.
get
(
"name"
)));
systemData
.
put
(
"systemName"
,
ObjectUtils
.
isEmpty
(
sys
.
get
(
"name"
))
?
""
:
String
.
valueOf
(
sys
.
get
(
"name"
)));
// 系统对应指标
// 系统对应指标
String
indicator
=
String
.
valueOf
(
collect
.
get
(
0
).
get
(
"index"
));
String
indicator
=
String
.
valueOf
(
collect
.
get
(
0
).
get
(
"index"
));
List
<
Map
<
String
,
Object
>>
alarmMessageList
=
fireFightingSystemMapper
.
selectAlarmList
(
bizOrgCode
,
startDate
.
substring
(
0
,
7
),
String
.
valueOf
(
sys
.
get
(
"id"
)));
List
<
Map
<
String
,
Object
>>
alarmMessageList
=
fireFightingSystemMapper
.
selectAlarmList
(
bizOrgCode
,
startDate
.
substring
(
0
,
7
),
String
.
valueOf
(
sys
.
get
(
"id"
)));
// 单个系统循环列表
// 单个系统循环列表
ArrayList
<
Map
<
String
,
Object
>>
maps
=
new
ArrayList
<>();
ArrayList
<
Map
<
String
,
Object
>>
maps
=
new
ArrayList
<>();
// 系统下告警统计列表
// 系统下告警统计列表
...
@@ -1593,25 +1622,35 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
...
@@ -1593,25 +1622,35 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
for
(
Map
<
String
,
Object
>
alarm
:
alarmMessageList
)
{
for
(
Map
<
String
,
Object
>
alarm
:
alarmMessageList
)
{
HashMap
<
String
,
Object
>
alarmMap
=
new
HashMap
<>();
HashMap
<
String
,
Object
>
alarmMap
=
new
HashMap
<>();
// 设备类型
// 设备类型
alarmMap
.
put
(
"equipment_name"
,
ObjectUtils
.
isEmpty
(
alarm
.
get
(
"equipment_name"
))
?
""
:
String
.
valueOf
(
alarm
.
get
(
"equipment_name"
)));
alarmMap
.
put
(
"equipment_name"
,
ObjectUtils
.
isEmpty
(
alarm
.
get
(
"equipment_name"
))
?
""
:
String
.
valueOf
(
alarm
.
get
(
"equipment_name"
)));
// 设备总数
// 设备总数
alarmMap
.
put
(
"num"
,
ObjectUtils
.
isEmpty
(
alarm
.
get
(
"num"
))
?
""
:
String
.
valueOf
(
alarm
.
get
(
"num"
)));
alarmMap
.
put
(
"num"
,
ObjectUtils
.
isEmpty
(
alarm
.
get
(
"num"
))
?
""
:
String
.
valueOf
(
alarm
.
get
(
"num"
)));
// 正常设备总数
// 正常设备总数
alarmMap
.
put
(
"normalEquipNum"
,
ObjectUtils
.
isEmpty
(
alarm
.
get
(
"normalEquipNum"
))
?
""
:
String
.
valueOf
(
alarm
.
get
(
"normalEquipNum"
)));
alarmMap
.
put
(
"normalEquipNum"
,
ObjectUtils
.
isEmpty
(
alarm
.
get
(
"normalEquipNum"
))
?
""
:
String
.
valueOf
(
alarm
.
get
(
"normalEquipNum"
)));
// 设备正确率
// 设备正确率
alarmMap
.
put
(
"normalEquipPercent"
,
ObjectUtils
.
isEmpty
(
alarm
.
get
(
"normalEquipPercent"
))
?
""
:
String
.
valueOf
(
alarm
.
get
(
"normalEquipPercent"
)));
alarmMap
.
put
(
"normalEquipPercent"
,
ObjectUtils
.
isEmpty
(
alarm
.
get
(
"normalEquipPercent"
))
?
""
:
String
.
valueOf
(
alarm
.
get
(
"normalEquipPercent"
)));
// 设备故障总数
// 设备故障总数
alarmMap
.
put
(
"fault_equip_num"
,
ObjectUtils
.
isEmpty
(
alarm
.
get
(
"fault_equip_num"
))
?
""
:
String
.
valueOf
(
alarm
.
get
(
"fault_equip_num"
)));
alarmMap
.
put
(
"fault_equip_num"
,
ObjectUtils
.
isEmpty
(
alarm
.
get
(
"fault_equip_num"
))
?
""
:
String
.
valueOf
(
alarm
.
get
(
"fault_equip_num"
)));
// 故障信息条数
// 故障信息条数
alarmMap
.
put
(
"alarm_info_num"
,
ObjectUtils
.
isEmpty
(
alarm
.
get
(
"fault_info_num"
))
?
""
:
String
.
valueOf
(
alarm
.
get
(
"fault_info_num"
)));
alarmMap
.
put
(
"alarm_info_num"
,
ObjectUtils
.
isEmpty
(
alarm
.
get
(
"fault_info_num"
))
?
""
:
String
.
valueOf
(
alarm
.
get
(
"fault_info_num"
)));
// 设备故障率
// 设备故障率
alarmMap
.
put
(
"faultEquipPercent"
,
ObjectUtils
.
isEmpty
(
alarm
.
get
(
"faultEquipPercent"
))
?
""
:
String
.
valueOf
(
alarm
.
get
(
"faultEquipPercent"
)));
alarmMap
.
put
(
"faultEquipPercent"
,
ObjectUtils
.
isEmpty
(
alarm
.
get
(
"faultEquipPercent"
))
?
""
:
String
.
valueOf
(
alarm
.
get
(
"faultEquipPercent"
)));
// 报警设备总数
// 报警设备总数
alarmMap
.
put
(
"alarm_equip_num"
,
ObjectUtils
.
isEmpty
(
alarm
.
get
(
"alarm_equip_num"
))
?
""
:
String
.
valueOf
(
alarm
.
get
(
"alarm_equip_num"
)));
alarmMap
.
put
(
"alarm_equip_num"
,
ObjectUtils
.
isEmpty
(
alarm
.
get
(
"alarm_equip_num"
))
?
""
:
String
.
valueOf
(
alarm
.
get
(
"alarm_equip_num"
)));
// 报警设备占比
// 报警设备占比
alarmMap
.
put
(
"alarmEquipPercent"
,
ObjectUtils
.
isEmpty
(
alarm
.
get
(
"alarmEquipPercent"
))
?
""
:
String
.
valueOf
(
alarm
.
get
(
"alarmEquipPercent"
)));
alarmMap
.
put
(
"alarmEquipPercent"
,
ObjectUtils
.
isEmpty
(
alarm
.
get
(
"alarmEquipPercent"
))
?
""
:
String
.
valueOf
(
alarm
.
get
(
"alarmEquipPercent"
)));
// 信息总数
// 信息总数
alarmMap
.
put
(
"total_info_num"
,
ObjectUtils
.
isEmpty
(
alarm
.
get
(
"total_info_num"
))
?
""
:
String
.
valueOf
(
alarm
.
get
(
"total_info_num"
)));
alarmMap
.
put
(
"total_info_num"
,
ObjectUtils
.
isEmpty
(
alarm
.
get
(
"total_info_num"
))
?
""
:
String
.
valueOf
(
alarm
.
get
(
"total_info_num"
)));
maps
.
add
(
alarmMap
);
maps
.
add
(
alarmMap
);
}
}
...
@@ -1631,9 +1670,11 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
...
@@ -1631,9 +1670,11 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
}
}
systemData
.
put
(
"list"
,
maps
);
systemData
.
put
(
"list"
,
maps
);
// 系统对应总结
// 系统对应总结
Map
<
String
,
Object
>
summarize
=
fireFightingSystemMapper
.
selectMonthSummarize
(
startDate
.
substring
(
0
,
7
),
String
.
valueOf
(
sys
.
get
(
"id"
)));
Map
<
String
,
Object
>
summarize
=
fireFightingSystemMapper
.
selectMonthSummarize
(
startDate
.
substring
(
0
,
7
),
String
.
valueOf
(
sys
.
get
(
"id"
)));
if
(!
ObjectUtils
.
isEmpty
(
summarize
))
{
if
(!
ObjectUtils
.
isEmpty
(
summarize
))
{
systemData
.
put
(
"summarize"
,
ObjectUtils
.
isEmpty
(
summarize
.
get
(
"summary_info"
))
?
""
:
String
.
valueOf
(
summarize
.
get
(
"summary_info"
)));
systemData
.
put
(
"summarize"
,
ObjectUtils
.
isEmpty
(
summarize
.
get
(
"summary_info"
))
?
""
:
String
.
valueOf
(
summarize
.
get
(
"summary_info"
)));
}
else
{
}
else
{
systemData
.
put
(
"summarize"
,
""
);
systemData
.
put
(
"summarize"
,
""
);
...
@@ -1642,11 +1683,13 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
...
@@ -1642,11 +1683,13 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
// echarts图
// echarts图
String
[]
split
=
indicator
.
split
(
","
);
String
[]
split
=
indicator
.
split
(
","
);
List
<
String
>
indicatorList
=
Arrays
.
asList
(
split
);
List
<
String
>
indicatorList
=
Arrays
.
asList
(
split
);
List
<
Map
<
String
,
Object
>>
pieChartList
=
fireFightingSystemMapper
.
selectMonthPieChart
(
String
.
valueOf
(
sys
.
get
(
"code"
)),
startDate
,
endDate
);
List
<
Map
<
String
,
Object
>>
pieChartList
=
fireFightingSystemMapper
List
<
Map
<
String
,
Object
>>
pieChartListTwo
=
fireFightingSystemMapper
.
selectMonthPieChartTwo
(
String
.
valueOf
(
sys
.
get
(
"code"
)),
startDate
,
endDate
,
indicatorList
);
.
selectMonthPieChart
(
String
.
valueOf
(
sys
.
get
(
"code"
)),
startDate
,
endDate
);
List
<
Map
<
String
,
Object
>>
pieChartListTwo
=
fireFightingSystemMapper
List
<
Map
<
String
,
Object
>>
selectMonthPolyline
=
fireFightingSystemMapper
.
selectMonthPolyline
(
String
.
valueOf
(
sys
.
get
(
"code"
)),
startDate
,
endDate
,
indicatorList
);
.
selectMonthPieChartTwo
(
String
.
valueOf
(
sys
.
get
(
"code"
)),
startDate
,
endDate
,
indicatorList
);
List
<
Map
<
String
,
Object
>>
selectMonthPolyline
=
fireFightingSystemMapper
.
selectMonthPolyline
(
String
.
valueOf
(
sys
.
get
(
"code"
)),
startDate
,
endDate
,
indicatorList
);
String
pieChart
=
ChartsUtils
.
pieChart
(
pieChartList
,
"故障设备类型占比"
);
String
pieChart
=
ChartsUtils
.
pieChart
(
pieChartList
,
"故障设备类型占比"
);
systemData
.
put
(
"bing1"
,
pieChart
);
systemData
.
put
(
"bing1"
,
pieChart
);
...
@@ -1663,9 +1706,9 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
...
@@ -1663,9 +1706,9 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
systemData
.
put
(
"bing2"
,
pieChart1
);
systemData
.
put
(
"bing2"
,
pieChart1
);
}
}
if
(!
CollectionUtils
.
isEmpty
(
selectMonthPolyline
))
{
if
(!
CollectionUtils
.
isEmpty
(
selectMonthPolyline
))
{
String
pieChart2
=
ChartsUtils
.
manyLineChart
(
selectMonthPolyline
,
"报警趋势"
,
"日期"
,
"报警数量"
,
"month"
);
String
pieChart2
=
ChartsUtils
.
manyLineChart
(
selectMonthPolyline
,
"报警趋势"
,
"日期"
,
"报警数量"
,
"month"
);
systemData
.
put
(
"bing3"
,
pieChart2
);
systemData
.
put
(
"bing3"
,
pieChart2
);
}
else
{
}
else
{
systemData
.
put
(
"bing3"
,
""
);
systemData
.
put
(
"bing3"
,
""
);
...
@@ -1677,12 +1720,10 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
...
@@ -1677,12 +1720,10 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
}
}
}
else
{
}
else
{
return
null
;
return
null
;
}
}
return
map
;
return
map
;
}
}
...
@@ -1702,8 +1743,8 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
...
@@ -1702,8 +1743,8 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
@Override
@Override
public
String
iotMonthReport
(
String
bizOrgCode
,
String
startDate
,
String
endDate
)
{
public
String
iotMonthReport
(
String
bizOrgCode
,
String
startDate
,
String
endDate
)
{
Map
<
String
,
Object
>
DataMap
=
getData
(
bizOrgCode
,
startDate
,
endDate
);
Map
<
String
,
Object
>
DataMap
=
getData
(
bizOrgCode
,
startDate
,
endDate
);
if
(
DataMap
==
null
)
{
if
(
DataMap
==
null
)
{
return
null
;
return
null
;
}
}
WordTemplateUtils
instance
=
WordTemplateUtils
.
getInstance
();
WordTemplateUtils
instance
=
WordTemplateUtils
.
getInstance
();
String
pdfUrlString
=
""
;
String
pdfUrlString
=
""
;
...
@@ -1715,7 +1756,8 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
...
@@ -1715,7 +1756,8 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
RequestContext
.
setToken
(
token
.
getToke
());
RequestContext
.
setToken
(
token
.
getToke
());
RequestContext
.
setProduct
(
token
.
getProduct
());
RequestContext
.
setProduct
(
token
.
getProduct
());
RequestContext
.
setAppKey
(
token
.
getAppKey
());
RequestContext
.
setAppKey
(
token
.
getAppKey
());
MultipartFile
multipartFile
=
new
MyByteArrayMultipartFile
(
"file"
,
"file.pdf"
,
"application/pdf"
,
file2byte
(
filepdf
));
MultipartFile
multipartFile
=
new
MyByteArrayMultipartFile
(
"file"
,
"file.pdf"
,
"application/pdf"
,
file2byte
(
filepdf
));
FeignClientResult
<
Map
<
String
,
String
>>
result
=
Systemctl
.
fileStorageClient
.
updateCommonFile
(
multipartFile
);
FeignClientResult
<
Map
<
String
,
String
>>
result
=
Systemctl
.
fileStorageClient
.
updateCommonFile
(
multipartFile
);
if
(
result
!=
null
)
{
if
(
result
!=
null
)
{
Iterator
<
String
>
it
=
result
.
getResult
().
keySet
().
iterator
();
Iterator
<
String
>
it
=
result
.
getResult
().
keySet
().
iterator
();
...
@@ -1736,7 +1778,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
...
@@ -1736,7 +1778,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
uploadFile
.
setUrl
(
pdfUrlString
);
uploadFile
.
setUrl
(
pdfUrlString
);
uploadFile
.
setFileType
(
"image"
);
uploadFile
.
setFileType
(
"image"
);
uploadFile
.
setObjectType
(
"m-report"
);
uploadFile
.
setObjectType
(
"m-report"
);
long
time
=
DateUtils
.
longStr2Date
(
startDate
+
" 00:00:00"
).
getTime
();
long
time
=
DateUtils
.
longStr2Date
(
startDate
+
" 00:00:00"
).
getTime
();
uploadFile
.
setObjectId
(
time
);
uploadFile
.
setObjectId
(
time
);
uploadFile
.
setName
(
"换流站月总结分析报告"
);
uploadFile
.
setName
(
"换流站月总结分析报告"
);
uploadFile
.
setDepartmentOrgcode
(
bizOrgCode
);
uploadFile
.
setDepartmentOrgcode
(
bizOrgCode
);
...
@@ -1775,47 +1817,66 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
...
@@ -1775,47 +1817,66 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
ArrayList
<
Map
<
String
,
Object
>>
dataList
=
new
ArrayList
<>();
ArrayList
<
Map
<
String
,
Object
>>
dataList
=
new
ArrayList
<>();
for
(
Map
<
String
,
Object
>
system
:
systemList
)
{
for
(
Map
<
String
,
Object
>
system
:
systemList
)
{
HashMap
<
String
,
Object
>
systemData
=
new
HashMap
<>();
HashMap
<
String
,
Object
>
systemData
=
new
HashMap
<>();
List
<
Map
>
collect
=
indicatorConfiguration
.
stream
().
List
<
Map
>
collect
=
indicatorConfiguration
.
stream
()
filter
(
item
->
item
.
get
(
"code"
).
equals
(
String
.
valueOf
(
system
.
get
(
"typeCode"
)))).
collect
(
Collectors
.
toList
());
.
filter
(
item
->
item
.
get
(
"code"
).
equals
(
String
.
valueOf
(
system
.
get
(
"typeCode"
))))
.
collect
(
Collectors
.
toList
());
if
(!
CollectionUtils
.
isEmpty
(
collect
))
{
if
(!
CollectionUtils
.
isEmpty
(
collect
))
{
// 系统名称
// 系统名称
systemData
.
put
(
"systemName"
,
ObjectUtils
.
isEmpty
(
system
.
get
(
"name"
))
?
""
:
String
.
valueOf
(
system
.
get
(
"name"
)));
systemData
.
put
(
"systemName"
,
ObjectUtils
.
isEmpty
(
system
.
get
(
"name"
))
?
""
:
String
.
valueOf
(
system
.
get
(
"name"
)));
// 系统对应指标
// 系统对应指标
String
indicator
=
String
.
valueOf
(
collect
.
get
(
0
).
get
(
"index"
));
String
indicator
=
String
.
valueOf
(
collect
.
get
(
0
).
get
(
"index"
));
String
[]
split
=
indicator
.
split
(
","
);
String
[]
split
=
indicator
.
split
(
","
);
List
<
String
>
indicatorList
=
Arrays
.
asList
(
split
);
List
<
String
>
indicatorList
=
Arrays
.
asList
(
split
);
List
<
Map
<
String
,
Object
>>
weekReportList
=
fireFightingSystemMapper
.
selectWeekReportList
(
String
.
valueOf
(
system
.
get
(
"id"
)),
startDate
,
endDate
);
List
<
Map
<
String
,
Object
>>
weekReportList
=
fireFightingSystemMapper
.
selectWeekReportList
(
String
.
valueOf
(
system
.
get
(
"id"
)),
startDate
,
endDate
);
ArrayList
<
Map
<
String
,
Object
>>
list
=
new
ArrayList
<>();
ArrayList
<
Map
<
String
,
Object
>>
list
=
new
ArrayList
<>();
if
(!
CollectionUtils
.
isEmpty
(
weekReportList
))
{
if
(!
CollectionUtils
.
isEmpty
(
weekReportList
))
{
for
(
Map
<
String
,
Object
>
weekItem
:
weekReportList
)
{
for
(
Map
<
String
,
Object
>
weekItem
:
weekReportList
)
{
HashMap
<
String
,
Object
>
listItem
=
new
HashMap
<>();
HashMap
<
String
,
Object
>
listItem
=
new
HashMap
<>();
// 设备类型
// 设备类型
listItem
.
put
(
"name"
,
ObjectUtils
.
isEmpty
(
weekItem
.
get
(
"name"
))
?
""
:
String
.
valueOf
(
weekItem
.
get
(
"name"
)));
listItem
.
put
(
"name"
,
ObjectUtils
.
isEmpty
(
weekItem
.
get
(
"name"
))
?
""
:
String
.
valueOf
(
weekItem
.
get
(
"name"
)));
// 设备总数
// 设备总数
listItem
.
put
(
"num"
,
ObjectUtils
.
isEmpty
(
weekItem
.
get
(
"num"
))
?
""
:
String
.
valueOf
(
weekItem
.
get
(
"num"
)));
listItem
.
put
(
"num"
,
ObjectUtils
.
isEmpty
(
weekItem
.
get
(
"num"
))
?
""
:
String
.
valueOf
(
weekItem
.
get
(
"num"
)));
// 无异常设备总数
// 无异常设备总数
listItem
.
put
(
"normalNum"
,
ObjectUtils
.
isEmpty
(
weekItem
.
get
(
"normalNum"
))
?
""
:
String
.
valueOf
(
weekItem
.
get
(
"normalNum"
)));
listItem
.
put
(
"normalNum"
,
ObjectUtils
.
isEmpty
(
weekItem
.
get
(
"normalNum"
))
?
""
:
String
.
valueOf
(
weekItem
.
get
(
"normalNum"
)));
// 物联指标
// 物联指标
listItem
.
put
(
"type_name"
,
ObjectUtils
.
isEmpty
(
weekItem
.
get
(
"type_name"
))
?
""
:
String
.
valueOf
(
weekItem
.
get
(
"type_name"
)));
listItem
.
put
(
"type_name"
,
ObjectUtils
.
isEmpty
(
weekItem
.
get
(
"type_name"
))
?
""
:
String
.
valueOf
(
weekItem
.
get
(
"type_name"
)));
// 监测数据
// 监测数据
listItem
.
put
(
"monitoringData"
,
ObjectUtils
.
isEmpty
(
weekItem
.
get
(
"monitoringData"
))
?
""
:
String
.
valueOf
(
weekItem
.
get
(
"monitoringData"
)));
listItem
.
put
(
"monitoringData"
,
ObjectUtils
.
isEmpty
(
weekItem
.
get
(
"monitoringData"
))
?
""
:
String
.
valueOf
(
weekItem
.
get
(
"monitoringData"
)));
// 获取方式
// 获取方式
listItem
.
put
(
"acquisition"
,
ObjectUtils
.
isEmpty
(
weekItem
.
get
(
"acquisition"
))
?
""
:
String
.
valueOf
(
weekItem
.
get
(
"acquisition"
)));
listItem
.
put
(
"acquisition"
,
ObjectUtils
.
isEmpty
(
weekItem
.
get
(
"acquisition"
))
?
""
:
String
.
valueOf
(
weekItem
.
get
(
"acquisition"
)));
// 正常标准
// 正常标准
listItem
.
put
(
"normal"
,
ObjectUtils
.
isEmpty
(
weekItem
.
get
(
"normal"
))
?
""
:
String
.
valueOf
(
weekItem
.
get
(
"normal"
)));
listItem
.
put
(
"normal"
,
ObjectUtils
.
isEmpty
(
weekItem
.
get
(
"normal"
))
?
""
:
String
.
valueOf
(
weekItem
.
get
(
"normal"
)));
// 7日告警设备数
// 7日告警设备数
if
(!
ObjectUtils
.
isEmpty
(
weekItem
.
get
(
"type_code"
))
&&
!
ObjectUtils
.
isEmpty
(
weekItem
.
get
(
"code"
)))
{
if
(!
ObjectUtils
.
isEmpty
(
weekItem
.
get
(
"type_code"
))
Integer
integer
=
fireFightingSystemMapper
.
selectWeekAlarmsEquip
(
valueOf
(
system
.
get
(
"id"
)),
valueOf
(
weekItem
.
get
(
"type_code"
)),
valueOf
(
weekItem
.
get
(
"code"
)),
startDate
,
endDate
,
String
.
valueOf
(
weekItem
.
get
(
"type_code"
)));
&&
!
ObjectUtils
.
isEmpty
(
weekItem
.
get
(
"code"
)))
{
Integer
integer
=
fireFightingSystemMapper
.
selectWeekAlarmsEquip
(
valueOf
(
system
.
get
(
"id"
)),
valueOf
(
weekItem
.
get
(
"type_code"
)),
valueOf
(
weekItem
.
get
(
"code"
)),
startDate
,
endDate
,
String
.
valueOf
(
weekItem
.
get
(
"type_code"
)));
listItem
.
put
(
"alarmEquipNum"
,
String
.
valueOf
(
integer
));
listItem
.
put
(
"alarmEquipNum"
,
String
.
valueOf
(
integer
));
}
else
{
}
else
{
listItem
.
put
(
"alarmEquipNum"
,
String
.
valueOf
(
0
));
listItem
.
put
(
"alarmEquipNum"
,
String
.
valueOf
(
0
));
}
}
// listItem.put("alarmEquipNum", ObjectUtils.isEmpty(weekItem.get("alarmEquipNum")) ? "" : String.valueOf(weekItem.get("alarmEquipNum")));
// listItem.put("alarmEquipNum",
// ObjectUtils.isEmpty(weekItem.get("alarmEquipNum")) ? "" :
// String.valueOf(weekItem.get("alarmEquipNum")));
// 7日告警条数
// 7日告警条数
if
(!
ObjectUtils
.
isEmpty
(
weekItem
.
get
(
"type_code"
))
&&
!
ObjectUtils
.
isEmpty
(
weekItem
.
get
(
"code"
)))
{
if
(!
ObjectUtils
.
isEmpty
(
weekItem
.
get
(
"type_code"
))
Integer
integer
=
fireFightingSystemMapper
.
selectAlarms
(
valueOf
(
system
.
get
(
"id"
)),
valueOf
(
weekItem
.
get
(
"type_code"
)),
valueOf
(
weekItem
.
get
(
"code"
)),
startDate
,
endDate
,
indicatorList
);
&&
!
ObjectUtils
.
isEmpty
(
weekItem
.
get
(
"code"
)))
{
Integer
integer
=
fireFightingSystemMapper
.
selectAlarms
(
valueOf
(
system
.
get
(
"id"
)),
valueOf
(
weekItem
.
get
(
"type_code"
)),
valueOf
(
weekItem
.
get
(
"code"
)),
startDate
,
endDate
,
indicatorList
);
listItem
.
put
(
"trueNum"
,
String
.
valueOf
(
integer
));
listItem
.
put
(
"trueNum"
,
String
.
valueOf
(
integer
));
}
else
{
}
else
{
listItem
.
put
(
"trueNum"
,
String
.
valueOf
(
0
));
listItem
.
put
(
"trueNum"
,
String
.
valueOf
(
0
));
...
@@ -1837,51 +1898,70 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
...
@@ -1837,51 +1898,70 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
}
}
// 总结
// 总结
Map
<
String
,
Object
>
summarize
=
fireFightingSystemMapper
.
selectWeekSummarize
(
valueOf
(
system
.
get
(
"id"
)),
startDate
,
endDate
,
indicatorList
);
Map
<
String
,
Object
>
summarize
=
fireFightingSystemMapper
.
selectWeekSummarize
(
valueOf
(
system
.
get
(
"id"
)),
startDate
,
endDate
,
indicatorList
);
// if (!ObjectUtils.isEmpty(summarize.get("contant"))) {
// if (!ObjectUtils.isEmpty(summarize.get("contant"))) {
// systemData.put("summarize", String.valueOf(summarize.get("contant")));
// systemData.put("summarize", String.valueOf(summarize.get("contant")));
// } else {
// } else {
// systemData.put("summarize", "");
// systemData.put("summarize", "");
// }
// }
systemData
.
put
(
"summarize"
,
ObjectUtils
.
isEmpty
(
summarize
.
get
(
"name"
))?
0
:
summarize
.
get
(
"name"
)
systemData
.
put
(
"summarize"
,
ObjectUtils
.
isEmpty
(
summarize
.
get
(
"name"
))
?
0
+
"设备总数"
+(
ObjectUtils
.
isEmpty
(
summarize
.
get
(
"equipNum"
))?
0
:
summarize
.
get
(
"equipNum"
))
:
summarize
.
get
(
"name"
)
+
"设备总数"
+
"台,正常设备"
+(
ObjectUtils
.
isEmpty
(
summarize
.
get
(
"normalNum"
))?
0
:
summarize
.
get
(
"normalNum"
))
+
(
ObjectUtils
.
isEmpty
(
summarize
.
get
(
"equipNum"
))
?
0
:
summarize
.
get
(
"equipNum"
))
+
"台,正常率"
+(
ObjectUtils
.
isEmpty
(
summarize
.
get
(
"normalRate"
))?
0
:
summarize
.
get
(
"normalRate"
))
+
"台,正常设备"
+
"%,故障设备"
+(
ObjectUtils
.
isEmpty
(
summarize
.
get
(
"faultNum"
))?
0
:
summarize
.
get
(
"faultNum"
))
+
(
ObjectUtils
.
isEmpty
(
summarize
.
get
(
"normalNum"
))
?
0
:
summarize
.
get
(
"normalNum"
))
+
"台,故障率为"
+(
ObjectUtils
.
isEmpty
(
summarize
.
get
(
"faultRate"
))?
0
:
summarize
.
get
(
"faultRate"
))
+
"台,正常率"
+
"%,七日告警设备为"
+(
ObjectUtils
.
isEmpty
(
summarize
.
get
(
"exepctionNum"
))?
0
:
summarize
.
get
(
"exepctionNum"
))
+
(
ObjectUtils
.
isEmpty
(
summarize
.
get
(
"normalRate"
))
?
0
+
"台,同比上周"
+(
ObjectUtils
.
isEmpty
(
summarize
.
get
(
"status1"
))?
"增加"
:
summarize
.
get
(
"status1"
))+(
ObjectUtils
.
isEmpty
(
summarize
.
get
(
"exepctionWOW"
))?
0
:
summarize
.
get
(
"exepctionWOW"
))
:
summarize
.
get
(
"normalRate"
))
+
"%,七日告警总数为"
+(
ObjectUtils
.
isEmpty
(
summarize
.
get
(
"alarmNum"
))?
0
:
summarize
.
get
(
"alarmNum"
))
+
"%,故障设备"
+
"条,同比上周"
+(
ObjectUtils
.
isEmpty
(
summarize
.
get
(
"status2"
))?
"增加"
:
summarize
.
get
(
"status2"
))+(
ObjectUtils
.
isEmpty
(
summarize
.
get
(
"alarmWOW"
))?
0
:
summarize
.
get
(
"alarmWOW"
))
+
(
ObjectUtils
.
isEmpty
(
summarize
.
get
(
"faultNum"
))
?
0
:
summarize
.
get
(
"faultNum"
))
+
"%。"
+
"台,故障率为"
);
+
(
ObjectUtils
.
isEmpty
(
summarize
.
get
(
"faultRate"
))
?
0
:
summarize
.
get
(
"faultRate"
))
+
"%,七日告警设备为"
+
(
ObjectUtils
.
isEmpty
(
summarize
.
get
(
"exepctionNum"
))
?
0
:
summarize
.
get
(
"exepctionNum"
))
+
"台,同比上周"
+
(
ObjectUtils
.
isEmpty
(
summarize
.
get
(
"status1"
))
?
"增加"
:
summarize
.
get
(
"status1"
))
+
(
ObjectUtils
.
isEmpty
(
summarize
.
get
(
"exepctionWOW"
))
?
0
:
summarize
.
get
(
"exepctionWOW"
))
+
"%,七日告警总数为"
+
(
ObjectUtils
.
isEmpty
(
summarize
.
get
(
"alarmNum"
))
?
0
:
summarize
.
get
(
"alarmNum"
))
+
"条,同比上周"
+
(
ObjectUtils
.
isEmpty
(
summarize
.
get
(
"status2"
))
?
"增加"
:
summarize
.
get
(
"status2"
))
+
(
ObjectUtils
.
isEmpty
(
summarize
.
get
(
"alarmWOW"
))
?
0
:
summarize
.
get
(
"alarmWOW"
))
+
"%。"
);
// echarts 图表
// echarts 图表
//List<Map<String, Object>> mapList = fireFightingSystemMapper.selectWeekEquipEchart(valueOf(system.get("code")), startDate, endDate, indicatorList);
// List<Map<String, Object>> mapList =
// fireFightingSystemMapper.selectWeekEquipEchart(valueOf(system.get("code")),
// startDate, endDate, indicatorList);
ArrayList
<
Map
<
String
,
Object
>>
mapList
=
new
ArrayList
<>();
ArrayList
<
Map
<
String
,
Object
>>
mapList
=
new
ArrayList
<>();
HashMap
<
String
,
Object
>
dayEchartsDate
=
new
HashMap
<>();
HashMap
<
String
,
Object
>
dayEchartsDate
=
new
HashMap
<>();
dayEchartsDate
.
put
(
"type"
,
"正常设备"
);
dayEchartsDate
.
put
(
"type"
,
"正常设备"
);
dayEchartsDate
.
put
(
"value"
,
ObjectUtils
.
isEmpty
(
summarize
.
get
(
"normalNum"
))?
0
:
summarize
.
get
(
"normalNum"
));
dayEchartsDate
.
put
(
"value"
,
ObjectUtils
.
isEmpty
(
summarize
.
get
(
"normalNum"
))
?
0
:
summarize
.
get
(
"normalNum"
));
mapList
.
add
(
dayEchartsDate
);
mapList
.
add
(
dayEchartsDate
);
HashMap
<
String
,
Object
>
dayEchartsDate1
=
new
HashMap
<>();
HashMap
<
String
,
Object
>
dayEchartsDate1
=
new
HashMap
<>();
dayEchartsDate1
.
put
(
"type"
,
"异常设备"
);
dayEchartsDate1
.
put
(
"type"
,
"异常设备"
);
if
(!
ObjectUtils
.
isEmpty
(
summarize
.
get
(
"equipNum"
))
||
!
ObjectUtils
.
isEmpty
(
summarize
.
get
(
"normalNum"
))){
if
(!
ObjectUtils
.
isEmpty
(
summarize
.
get
(
"equipNum"
))
dayEchartsDate1
.
put
(
"value"
,
Integer
.
parseInt
(
String
.
valueOf
(
summarize
.
get
(
"equipNum"
)))
||
!
ObjectUtils
.
isEmpty
(
summarize
.
get
(
"normalNum"
)))
{
-
Integer
.
parseInt
(
String
.
valueOf
(
summarize
.
get
(
"normalNum"
))));
dayEchartsDate1
.
put
(
"value"
,
Integer
.
parseInt
(
String
.
valueOf
(
summarize
.
get
(
"equipNum"
)))
}
else
{
-
Integer
.
parseInt
(
String
.
valueOf
(
summarize
.
get
(
"normalNum"
))));
dayEchartsDate1
.
put
(
"value"
,
0
);
}
else
{
dayEchartsDate1
.
put
(
"value"
,
0
);
}
}
mapList
.
add
(
dayEchartsDate1
);
mapList
.
add
(
dayEchartsDate1
);
String
pieChart1
=
ChartsUtils
.
pieChart
(
mapList
,
"告警设备占比"
);
String
pieChart1
=
ChartsUtils
.
pieChart
(
mapList
,
"告警设备占比"
);
systemData
.
put
(
"pictureLeft"
,
pieChart1
);
systemData
.
put
(
"pictureLeft"
,
pieChart1
);
List
<
Map
<
String
,
Object
>>
weekEchart
=
fireFightingSystemMapper
.
selectWeekEchart
(
valueOf
(
system
.
get
(
"code"
)),
startDate
,
endDate
);
List
<
Map
<
String
,
Object
>>
weekEchart
=
fireFightingSystemMapper
.
selectWeekEchart
(
valueOf
(
system
.
get
(
"code"
)),
startDate
,
endDate
);
String
pieChart2
=
ChartsUtils
.
pieChart
(
weekEchart
,
"故障设备类型占比"
);
String
pieChart2
=
ChartsUtils
.
pieChart
(
weekEchart
,
"故障设备类型占比"
);
systemData
.
put
(
"pictureCenter"
,
pieChart2
);
systemData
.
put
(
"pictureCenter"
,
pieChart2
);
List
<
Map
<
String
,
Object
>>
linesEchart
=
fireFightingSystemMapper
.
selectWeekLinesEchart
(
valueOf
(
system
.
get
(
"code"
)),
startDate
,
endDate
,
indicatorList
);
List
<
Map
<
String
,
Object
>>
linesEchart
=
fireFightingSystemMapper
.
selectWeekLinesEchart
(
valueOf
(
system
.
get
(
"code"
)),
startDate
,
endDate
,
indicatorList
);
String
lines
=
ChartsUtils
.
manyLineChart
(
linesEchart
,
"报警趋势"
,
"日期"
,
"报警数量"
,
"week"
);
String
lines
=
ChartsUtils
.
manyLineChart
(
linesEchart
,
"报警趋势"
,
"日期"
,
"报警数量"
,
"week"
);
systemData
.
put
(
"lines"
,
lines
);
systemData
.
put
(
"lines"
,
lines
);
...
@@ -1892,11 +1972,10 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
...
@@ -1892,11 +1972,10 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
}
}
}
else
{
}
else
{
return
null
;
return
null
;
}
}
return
map
;
return
map
;
}
}
...
@@ -1916,7 +1995,8 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
...
@@ -1916,7 +1995,8 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
RequestContext
.
setToken
(
token
.
getToke
());
RequestContext
.
setToken
(
token
.
getToke
());
RequestContext
.
setProduct
(
token
.
getProduct
());
RequestContext
.
setProduct
(
token
.
getProduct
());
RequestContext
.
setAppKey
(
token
.
getAppKey
());
RequestContext
.
setAppKey
(
token
.
getAppKey
());
MultipartFile
multipartFile
=
new
MyByteArrayMultipartFile
(
"file"
,
"file.pdf"
,
"application/pdf"
,
file2byte
(
filepdf
));
MultipartFile
multipartFile
=
new
MyByteArrayMultipartFile
(
"file"
,
"file.pdf"
,
"application/pdf"
,
file2byte
(
filepdf
));
FeignClientResult
<
Map
<
String
,
String
>>
result
=
Systemctl
.
fileStorageClient
.
updateCommonFile
(
multipartFile
);
FeignClientResult
<
Map
<
String
,
String
>>
result
=
Systemctl
.
fileStorageClient
.
updateCommonFile
(
multipartFile
);
if
(
result
!=
null
)
{
if
(
result
!=
null
)
{
Iterator
<
String
>
it
=
result
.
getResult
().
keySet
().
iterator
();
Iterator
<
String
>
it
=
result
.
getResult
().
keySet
().
iterator
();
...
@@ -1936,7 +2016,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
...
@@ -1936,7 +2016,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
uploadFile
.
setUrl
(
pdfUrlString
);
uploadFile
.
setUrl
(
pdfUrlString
);
uploadFile
.
setFileType
(
"image"
);
uploadFile
.
setFileType
(
"image"
);
uploadFile
.
setObjectType
(
"w-report"
);
uploadFile
.
setObjectType
(
"w-report"
);
long
time
=
DateUtils
.
longStr2Date
(
startDate
+
" 00:00:00"
).
getTime
();
long
time
=
DateUtils
.
longStr2Date
(
startDate
+
" 00:00:00"
).
getTime
();
uploadFile
.
setObjectId
(
time
);
uploadFile
.
setObjectId
(
time
);
uploadFile
.
setName
(
"换流站周总结分析报告"
);
uploadFile
.
setName
(
"换流站周总结分析报告"
);
uploadFile
.
setDepartmentOrgcode
(
bizOrgCode
);
uploadFile
.
setDepartmentOrgcode
(
bizOrgCode
);
...
@@ -1972,18 +2052,21 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
...
@@ -1972,18 +2052,21 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
ArrayList
<
Map
<
String
,
Object
>>
dataList
=
new
ArrayList
<>();
ArrayList
<
Map
<
String
,
Object
>>
dataList
=
new
ArrayList
<>();
for
(
Map
<
String
,
Object
>
system
:
systemList
)
{
for
(
Map
<
String
,
Object
>
system
:
systemList
)
{
HashMap
<
String
,
Object
>
systemData
=
new
HashMap
<>();
HashMap
<
String
,
Object
>
systemData
=
new
HashMap
<>();
List
<
Map
>
collect
=
indicatorConfiguration
.
stream
().
List
<
Map
>
collect
=
indicatorConfiguration
.
stream
()
filter
(
item
->
item
.
get
(
"code"
).
equals
(
String
.
valueOf
(
system
.
get
(
"typeCode"
)))).
collect
(
Collectors
.
toList
());
.
filter
(
item
->
item
.
get
(
"code"
).
equals
(
String
.
valueOf
(
system
.
get
(
"typeCode"
))))
.
collect
(
Collectors
.
toList
());
if
(!
CollectionUtils
.
isEmpty
(
collect
))
{
if
(!
CollectionUtils
.
isEmpty
(
collect
))
{
// 系统名称
// 系统名称
systemData
.
put
(
"systemName"
,
ObjectUtils
.
isEmpty
(
system
.
get
(
"name"
))
?
""
:
String
.
valueOf
(
system
.
get
(
"name"
)));
systemData
.
put
(
"systemName"
,
ObjectUtils
.
isEmpty
(
system
.
get
(
"name"
))
?
""
:
String
.
valueOf
(
system
.
get
(
"name"
)));
// 系统对应指标
// 系统对应指标
String
indicator
=
String
.
valueOf
(
collect
.
get
(
0
).
get
(
"index"
));
String
indicator
=
String
.
valueOf
(
collect
.
get
(
0
).
get
(
"index"
));
String
[]
split
=
indicator
.
split
(
","
);
String
[]
split
=
indicator
.
split
(
","
);
List
<
String
>
indicatorList
=
Arrays
.
asList
(
split
);
List
<
String
>
indicatorList
=
Arrays
.
asList
(
split
);
List
<
Map
<
String
,
Object
>>
weekReportList
=
fireFightingSystemMapper
.
selectWeekReportList
(
String
.
valueOf
(
system
.
get
(
"id"
)),
startDate
,
endDate
);
List
<
Map
<
String
,
Object
>>
weekReportList
=
fireFightingSystemMapper
.
selectWeekReportList
(
String
.
valueOf
(
system
.
get
(
"id"
)),
startDate
,
endDate
);
ArrayList
<
Map
<
String
,
Object
>>
list
=
new
ArrayList
<>();
ArrayList
<
Map
<
String
,
Object
>>
list
=
new
ArrayList
<>();
ArrayList
<
Map
<
String
,
Object
>>
alarmMapList
=
new
ArrayList
<>();
ArrayList
<
Map
<
String
,
Object
>>
alarmMapList
=
new
ArrayList
<>();
Map
<
String
,
Object
>
binMap
=
new
HashMap
<>();
Map
<
String
,
Object
>
binMap
=
new
HashMap
<>();
...
@@ -1991,35 +2074,49 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
...
@@ -1991,35 +2074,49 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
for
(
Map
<
String
,
Object
>
weekItem
:
weekReportList
)
{
for
(
Map
<
String
,
Object
>
weekItem
:
weekReportList
)
{
HashMap
<
String
,
Object
>
listItem
=
new
HashMap
<>();
HashMap
<
String
,
Object
>
listItem
=
new
HashMap
<>();
// 设备类型
// 设备类型
listItem
.
put
(
"name"
,
ObjectUtils
.
isEmpty
(
weekItem
.
get
(
"name"
))
?
""
:
String
.
valueOf
(
weekItem
.
get
(
"name"
)));
listItem
.
put
(
"name"
,
ObjectUtils
.
isEmpty
(
weekItem
.
get
(
"name"
))
?
""
:
String
.
valueOf
(
weekItem
.
get
(
"name"
)));
// 设备总数
// 设备总数
listItem
.
put
(
"num"
,
ObjectUtils
.
isEmpty
(
weekItem
.
get
(
"num"
))
?
""
:
String
.
valueOf
(
weekItem
.
get
(
"num"
)));
listItem
.
put
(
"num"
,
ObjectUtils
.
isEmpty
(
weekItem
.
get
(
"num"
))
?
""
:
String
.
valueOf
(
weekItem
.
get
(
"num"
)));
// 无异常设备总数
// 无异常设备总数
listItem
.
put
(
"normalNum"
,
ObjectUtils
.
isEmpty
(
weekItem
.
get
(
"normalNum"
))
?
""
:
String
.
valueOf
(
weekItem
.
get
(
"normalNum"
)));
listItem
.
put
(
"normalNum"
,
ObjectUtils
.
isEmpty
(
weekItem
.
get
(
"normalNum"
))
?
""
:
String
.
valueOf
(
weekItem
.
get
(
"normalNum"
)));
// 物联指标
// 物联指标
listItem
.
put
(
"type_name"
,
ObjectUtils
.
isEmpty
(
weekItem
.
get
(
"type_name"
))
?
""
:
String
.
valueOf
(
weekItem
.
get
(
"type_name"
)));
listItem
.
put
(
"type_name"
,
ObjectUtils
.
isEmpty
(
weekItem
.
get
(
"type_name"
))
?
""
:
String
.
valueOf
(
weekItem
.
get
(
"type_name"
)));
// 监测数据
// 监测数据
listItem
.
put
(
"monitoringData"
,
ObjectUtils
.
isEmpty
(
weekItem
.
get
(
"monitoringData"
))
?
""
:
String
.
valueOf
(
weekItem
.
get
(
"monitoringData"
)));
listItem
.
put
(
"monitoringData"
,
ObjectUtils
.
isEmpty
(
weekItem
.
get
(
"monitoringData"
))
?
""
:
String
.
valueOf
(
weekItem
.
get
(
"monitoringData"
)));
// 获取方式
// 获取方式
listItem
.
put
(
"acquisition"
,
ObjectUtils
.
isEmpty
(
weekItem
.
get
(
"acquisition"
))
?
""
:
String
.
valueOf
(
weekItem
.
get
(
"acquisition"
)));
listItem
.
put
(
"acquisition"
,
ObjectUtils
.
isEmpty
(
weekItem
.
get
(
"acquisition"
))
?
""
:
String
.
valueOf
(
weekItem
.
get
(
"acquisition"
)));
// 正常标准
// 正常标准
listItem
.
put
(
"normal"
,
ObjectUtils
.
isEmpty
(
weekItem
.
get
(
"normal"
))
?
""
:
String
.
valueOf
(
weekItem
.
get
(
"normal"
)));
listItem
.
put
(
"normal"
,
ObjectUtils
.
isEmpty
(
weekItem
.
get
(
"normal"
))
?
""
:
String
.
valueOf
(
weekItem
.
get
(
"normal"
)));
// 日告警设备数
// 日告警设备数
listItem
.
put
(
"alarmEquipNum"
,
ObjectUtils
.
isEmpty
(
weekItem
.
get
(
"alarmEquipNum"
))
?
""
:
String
.
valueOf
(
weekItem
.
get
(
"alarmEquipNum"
)));
listItem
.
put
(
"alarmEquipNum"
,
ObjectUtils
.
isEmpty
(
weekItem
.
get
(
"alarmEquipNum"
))
?
""
:
String
.
valueOf
(
weekItem
.
get
(
"alarmEquipNum"
)));
// 日告警条数
// 日告警条数
if
(!
ObjectUtils
.
isEmpty
(
weekItem
.
get
(
"type_code"
))
&&
!
ObjectUtils
.
isEmpty
(
weekItem
.
get
(
"code"
)))
{
if
(!
ObjectUtils
.
isEmpty
(
weekItem
.
get
(
"type_code"
))
Integer
integer
=
fireFightingSystemMapper
.
selectAlarms
(
valueOf
(
system
.
get
(
"id"
)),
valueOf
(
weekItem
.
get
(
"type_code"
)),
valueOf
(
weekItem
.
get
(
"code"
)),
startDate
,
endDate
,
indicatorList
);
&&
!
ObjectUtils
.
isEmpty
(
weekItem
.
get
(
"code"
)))
{
Integer
integer
=
fireFightingSystemMapper
.
selectAlarms
(
valueOf
(
system
.
get
(
"id"
)),
valueOf
(
weekItem
.
get
(
"type_code"
)),
valueOf
(
weekItem
.
get
(
"code"
)),
startDate
,
endDate
,
indicatorList
);
listItem
.
put
(
"trueNum"
,
String
.
valueOf
(
integer
));
listItem
.
put
(
"trueNum"
,
String
.
valueOf
(
integer
));
}
else
{
}
else
{
listItem
.
put
(
"trueNum"
,
String
.
valueOf
(
0
));
listItem
.
put
(
"trueNum"
,
String
.
valueOf
(
0
));
}
}
if
(!
ObjectUtils
.
isEmpty
(
weekItem
.
get
(
"type_code"
))
&&
String
.
valueOf
(
weekItem
.
get
(
"type_code"
)).
endsWith
(
"Fault"
)){
if
(!
ObjectUtils
.
isEmpty
(
weekItem
.
get
(
"type_code"
))
if
(!
ObjectUtils
.
isEmpty
(
binMap
)
&&
!
ObjectUtils
.
isEmpty
(
listItem
.
get
(
"name"
))
&&
binMap
.
containsKey
(
String
.
valueOf
(
listItem
.
get
(
"name"
)))){
&&
String
.
valueOf
(
weekItem
.
get
(
"type_code"
)).
endsWith
(
"Fault"
))
{
if
(!
ObjectUtils
.
isEmpty
(
binMap
)
&&
!
ObjectUtils
.
isEmpty
(
listItem
.
get
(
"name"
))
&&
binMap
.
containsKey
(
String
.
valueOf
(
listItem
.
get
(
"name"
))))
{
int
newValue
=
Integer
.
parseInt
(
String
.
valueOf
(
listItem
.
get
(
"alarmEquipNum"
)));
int
newValue
=
Integer
.
parseInt
(
String
.
valueOf
(
listItem
.
get
(
"alarmEquipNum"
)));
int
oldValue
=
Integer
.
parseInt
(
String
.
valueOf
(
binMap
.
get
(
String
.
valueOf
(
listItem
.
get
(
"name"
)))));
int
oldValue
=
Integer
binMap
.
put
(
String
.
valueOf
(
listItem
.
get
(
"name"
)),
newValue
+
oldValue
);
.
parseInt
(
String
.
valueOf
(
binMap
.
get
(
String
.
valueOf
(
listItem
.
get
(
"name"
)))));
}
else
{
binMap
.
put
(
String
.
valueOf
(
listItem
.
get
(
"name"
)),
newValue
+
oldValue
);
binMap
.
put
(
String
.
valueOf
(
listItem
.
get
(
"name"
)),
listItem
.
get
(
"alarmEquipNum"
));
}
else
{
binMap
.
put
(
String
.
valueOf
(
listItem
.
get
(
"name"
)),
listItem
.
get
(
"alarmEquipNum"
));
}
}
}
}
...
@@ -2048,33 +2145,48 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
...
@@ -2048,33 +2145,48 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
}
}
// 总结
// 总结
Map
<
String
,
Object
>
summarize
=
fireFightingSystemMapper
.
selectDaySummarize
(
valueOf
(
system
.
get
(
"id"
)),
startDate
,
endDate
,
indicatorList
);
Map
<
String
,
Object
>
summarize
=
fireFightingSystemMapper
.
selectDaySummarize
(
valueOf
(
system
.
get
(
"id"
)),
startDate
,
endDate
,
indicatorList
);
// if (!ObjectUtils.isEmpty(summarize.get("contant"))) {
// if (!ObjectUtils.isEmpty(summarize.get("contant"))) {
// systemData.put("summarize", String.valueOf(summarize.get("contant")));
// systemData.put("summarize", String.valueOf(summarize.get("contant")));
// } else {
// } else {
// systemData.put("summarize", "");
// systemData.put("summarize", "");
// }
// }
systemData
.
put
(
"summarize"
,
ObjectUtils
.
isEmpty
(
summarize
.
get
(
"name"
))?
0
:
summarize
.
get
(
"name"
)+
"设备总数"
+(
ObjectUtils
.
isEmpty
(
summarize
.
get
(
"equipNum"
))?
0
:
summarize
.
get
(
"equipNum"
))
systemData
.
put
(
"summarize"
,
ObjectUtils
.
isEmpty
(
summarize
.
get
(
"name"
))
?
0
+
"台,今日告警设备为"
+(
ObjectUtils
.
isEmpty
(
summarize
.
get
(
"dayNum"
))?
0
:
summarize
.
get
(
"dayNum"
))+
"台,告警总数为"
+(
ObjectUtils
.
isEmpty
(
summarize
.
get
(
"alarmNum"
))?
0
:
summarize
.
get
(
"alarmNum"
))+
:
summarize
.
get
(
"name"
)
+
"设备总数"
"条,正常设备"
+(
ObjectUtils
.
isEmpty
(
summarize
.
get
(
"normalNum"
))?
0
:
summarize
.
get
(
"normalNum"
))+
"台,正常率"
+(
ObjectUtils
.
isEmpty
(
summarize
.
get
(
"normalRate"
))?
0
:
summarize
.
get
(
"normalRate"
))+
"%"
);
+
(
ObjectUtils
.
isEmpty
(
summarize
.
get
(
"equipNum"
))
?
0
:
summarize
.
get
(
"equipNum"
))
+
"台,今日告警设备为"
+
(
ObjectUtils
.
isEmpty
(
summarize
.
get
(
"dayNum"
))
?
0
:
summarize
.
get
(
"dayNum"
))
+
"台,告警总数为"
+
(
ObjectUtils
.
isEmpty
(
summarize
.
get
(
"alarmNum"
))
?
0
:
summarize
.
get
(
"alarmNum"
))
+
"条,正常设备"
+
(
ObjectUtils
.
isEmpty
(
summarize
.
get
(
"normalNum"
))
?
0
:
summarize
.
get
(
"normalNum"
))
+
"台,正常率"
+
(
ObjectUtils
.
isEmpty
(
summarize
.
get
(
"normalRate"
))
?
0
:
summarize
.
get
(
"normalRate"
))
+
"%"
);
// echarts 图表
// echarts 图表
List
<
Map
<
String
,
Object
>>
mapList
=
fireFightingSystemMapper
.
selectDayEquipEchart
(
valueOf
(
system
.
get
(
"code"
)),
startDate
,
endDate
);
List
<
Map
<
String
,
Object
>>
mapList
=
fireFightingSystemMapper
.
selectDayEquipEchart
(
valueOf
(
system
.
get
(
"code"
)),
startDate
,
endDate
);
String
pieChart1
=
ChartsUtils
.
pieChart
(
alarmMapList
,
"故障设备类型占比"
);
String
pieChart1
=
ChartsUtils
.
pieChart
(
alarmMapList
,
"故障设备类型占比"
);
// List<Map<String, Object>> dayEcharts = fireFightingSystemMapper.selectDayEchart(valueOf(system.get("id")), startDate, indicatorList);
// List<Map<String, Object>> dayEcharts =
// fireFightingSystemMapper.selectDayEchart(valueOf(system.get("id")),
// startDate, indicatorList);
ArrayList
<
Map
<
String
,
Object
>>
dayEchart
=
new
ArrayList
<>();
ArrayList
<
Map
<
String
,
Object
>>
dayEchart
=
new
ArrayList
<>();
HashMap
<
String
,
Object
>
dayEchartsDate
=
new
HashMap
<>();
HashMap
<
String
,
Object
>
dayEchartsDate
=
new
HashMap
<>();
dayEchartsDate
.
put
(
"type"
,
"正常设备"
);
dayEchartsDate
.
put
(
"type"
,
"正常设备"
);
dayEchartsDate
.
put
(
"value"
,
ObjectUtils
.
isEmpty
(
summarize
.
get
(
"normalNum"
))?
0
:
summarize
.
get
(
"normalNum"
));
dayEchartsDate
.
put
(
"value"
,
ObjectUtils
.
isEmpty
(
summarize
.
get
(
"normalNum"
))
?
0
:
summarize
.
get
(
"normalNum"
));
dayEchart
.
add
(
dayEchartsDate
);
dayEchart
.
add
(
dayEchartsDate
);
HashMap
<
String
,
Object
>
dayEchartsDate1
=
new
HashMap
<>();
HashMap
<
String
,
Object
>
dayEchartsDate1
=
new
HashMap
<>();
dayEchartsDate1
.
put
(
"type"
,
"异常设备"
);
dayEchartsDate1
.
put
(
"type"
,
"异常设备"
);
if
(!
ObjectUtils
.
isEmpty
(
summarize
.
get
(
"equipNum"
))
||
!
ObjectUtils
.
isEmpty
(
summarize
.
get
(
"normalNum"
))){
if
(!
ObjectUtils
.
isEmpty
(
summarize
.
get
(
"equipNum"
))
dayEchartsDate1
.
put
(
"value"
,
Integer
.
parseInt
(
String
.
valueOf
(
summarize
.
get
(
"equipNum"
)))
||
!
ObjectUtils
.
isEmpty
(
summarize
.
get
(
"normalNum"
)))
{
-
Integer
.
parseInt
(
String
.
valueOf
(
summarize
.
get
(
"normalNum"
))));
dayEchartsDate1
.
put
(
"value"
,
Integer
.
parseInt
(
String
.
valueOf
(
summarize
.
get
(
"equipNum"
)))
}
else
{
-
Integer
.
parseInt
(
String
.
valueOf
(
summarize
.
get
(
"normalNum"
))));
dayEchartsDate1
.
put
(
"value"
,
0
);
}
else
{
dayEchartsDate1
.
put
(
"value"
,
0
);
}
}
dayEchart
.
add
(
dayEchartsDate1
);
dayEchart
.
add
(
dayEchartsDate1
);
...
@@ -2082,7 +2194,6 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
...
@@ -2082,7 +2194,6 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
systemData
.
put
(
"pictureRight"
,
pieChart1
);
systemData
.
put
(
"pictureRight"
,
pieChart1
);
systemData
.
put
(
"pictureLeft"
,
pieChart2
);
systemData
.
put
(
"pictureLeft"
,
pieChart2
);
systemData
.
put
(
"sysData"
,
list
);
systemData
.
put
(
"sysData"
,
list
);
dataList
.
add
(
systemData
);
dataList
.
add
(
systemData
);
map
.
put
(
"data"
,
dataList
);
map
.
put
(
"data"
,
dataList
);
...
@@ -2090,18 +2201,17 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
...
@@ -2090,18 +2201,17 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
}
}
}
else
{
}
else
{
return
null
;
return
null
;
}
}
return
map
;
return
map
;
}
}
@Override
@Override
public
String
iotDayReport
(
String
bizOrgCode
,
String
startDate
,
String
endDate
)
{
public
String
iotDayReport
(
String
bizOrgCode
,
String
startDate
,
String
endDate
)
{
Map
<
String
,
Object
>
dataMap
=
getDayData
(
bizOrgCode
,
startDate
,
endDate
);
Map
<
String
,
Object
>
dataMap
=
getDayData
(
bizOrgCode
,
startDate
,
endDate
);
if
(
dataMap
==
null
)
{
if
(
dataMap
==
null
)
{
return
null
;
return
null
;
}
}
WordTemplateUtils
instance
=
WordTemplateUtils
.
getInstance
();
WordTemplateUtils
instance
=
WordTemplateUtils
.
getInstance
();
...
@@ -2114,7 +2224,8 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
...
@@ -2114,7 +2224,8 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
RequestContext
.
setToken
(
token
.
getToke
());
RequestContext
.
setToken
(
token
.
getToke
());
RequestContext
.
setProduct
(
token
.
getProduct
());
RequestContext
.
setProduct
(
token
.
getProduct
());
RequestContext
.
setAppKey
(
token
.
getAppKey
());
RequestContext
.
setAppKey
(
token
.
getAppKey
());
MultipartFile
multipartFile
=
new
MyByteArrayMultipartFile
(
"file"
,
"file.pdf"
,
"application/pdf"
,
file2byte
(
filepdf
));
MultipartFile
multipartFile
=
new
MyByteArrayMultipartFile
(
"file"
,
"file.pdf"
,
"application/pdf"
,
file2byte
(
filepdf
));
FeignClientResult
<
Map
<
String
,
String
>>
result
=
Systemctl
.
fileStorageClient
.
updateCommonFile
(
multipartFile
);
FeignClientResult
<
Map
<
String
,
String
>>
result
=
Systemctl
.
fileStorageClient
.
updateCommonFile
(
multipartFile
);
if
(
result
!=
null
)
{
if
(
result
!=
null
)
{
Iterator
<
String
>
it
=
result
.
getResult
().
keySet
().
iterator
();
Iterator
<
String
>
it
=
result
.
getResult
().
keySet
().
iterator
();
...
@@ -2134,7 +2245,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
...
@@ -2134,7 +2245,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
uploadFile
.
setUrl
(
pdfUrlString
);
uploadFile
.
setUrl
(
pdfUrlString
);
uploadFile
.
setFileType
(
"image"
);
uploadFile
.
setFileType
(
"image"
);
uploadFile
.
setObjectType
(
"d-report"
);
uploadFile
.
setObjectType
(
"d-report"
);
long
time
=
DateUtils
.
longStr2Date
(
startDate
+
" 00:00:00"
).
getTime
();
long
time
=
DateUtils
.
longStr2Date
(
startDate
+
" 00:00:00"
).
getTime
();
// DateUtils.getCurrentDayStartTime(new Date()).getTime();
// DateUtils.getCurrentDayStartTime(new Date()).getTime();
uploadFile
.
setObjectId
(
time
);
uploadFile
.
setObjectId
(
time
);
uploadFile
.
setName
(
"换流站日总结分析报告"
);
uploadFile
.
setName
(
"换流站日总结分析报告"
);
...
@@ -2166,7 +2277,8 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
...
@@ -2166,7 +2277,8 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
@Override
@Override
public
List
<
Map
<
String
,
Object
>>
getEquipExpiryStatistics
(
String
bizOrgCode
,
Integer
expiryDayNum
)
{
public
List
<
Map
<
String
,
Object
>>
getEquipExpiryStatistics
(
String
bizOrgCode
,
Integer
expiryDayNum
)
{
List
<
Map
<
String
,
Object
>>
equipExpiryStatistics
=
fireFightingSystemMapper
.
getEquipExpiryStatistics
(
bizOrgCode
,
expiryDayNum
);
List
<
Map
<
String
,
Object
>>
equipExpiryStatistics
=
fireFightingSystemMapper
.
getEquipExpiryStatistics
(
bizOrgCode
,
expiryDayNum
);
equipExpiryStatistics
.
forEach
(
item
->
{
equipExpiryStatistics
.
forEach
(
item
->
{
item
.
put
(
"value"
,
Integer
.
parseInt
(
item
.
get
(
"value"
).
toString
()));
item
.
put
(
"value"
,
Integer
.
parseInt
(
item
.
get
(
"value"
).
toString
()));
});
});
...
@@ -2247,14 +2359,17 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
...
@@ -2247,14 +2359,17 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
// 系统状态及今日告警设备统计
// 系统状态及今日告警设备统计
if
(!
CollectionUtils
.
isEmpty
(
records
))
{
if
(!
CollectionUtils
.
isEmpty
(
records
))
{
List
<
Long
>
idList
=
records
.
stream
().
map
(
FireFightingSystemDto:
:
getId
).
collect
(
Collectors
.
toList
());
List
<
Long
>
idList
=
records
.
stream
().
map
(
FireFightingSystemDto:
:
getId
).
collect
(
Collectors
.
toList
());
List
<
FireFightingSystemDto
>
list
=
equipmentSpecificSerivce
.
fireSysIotEquipAlarmCount
(
new
Date
(),
bizOrgCode
);
List
<
FireFightingSystemDto
>
list
=
equipmentSpecificSerivce
.
fireSysIotEquipAlarmCount
(
new
Date
(),
bizOrgCode
);
if
(!
CollectionUtils
.
isEmpty
(
list
))
{
if
(!
CollectionUtils
.
isEmpty
(
list
))
{
//使用stream流把list1和list2根据属性userId合并一个list集合,并根据状态倒序、系统排序升序
// 使用stream流把list1和list2根据属性userId合并一个list集合,并根据状态倒序、系统排序升序
List
<
FireFightingSystemDto
>
collect
=
records
.
stream
().
peek
(
m
->
list
.
stream
().
filter
(
m2
->
Objects
.
equals
(
m
.
getId
(),
m2
.
getId
())).
forEach
(
m2
->
{
List
<
FireFightingSystemDto
>
collect
=
records
.
stream
()
.
peek
(
m
->
list
.
stream
().
filter
(
m2
->
Objects
.
equals
(
m
.
getId
(),
m2
.
getId
())).
forEach
(
m2
->
{
m
.
setAlarmEquipTotal
(
m2
.
getAlarmEquipTotal
());
m
.
setAlarmEquipTotal
(
m2
.
getAlarmEquipTotal
());
m
.
setStatus
(
m2
.
getStatus
());
m
.
setStatus
(
m2
.
getStatus
());
})).
sorted
(
Comparator
.
comparing
(
FireFightingSystemDto:
:
getStatus
,
Comparator
.
reverseOrder
())
})).
sorted
(
Comparator
.
comparing
(
FireFightingSystemDto:
:
getStatus
,
Comparator
.
reverseOrder
())
.
thenComparing
(
FireFightingSystemDto:
:
getSort
)).
collect
(
Collectors
.
toList
());
.
thenComparing
(
FireFightingSystemDto:
:
getSort
))
.
collect
(
Collectors
.
toList
());
pages
.
setRecords
(
collect
);
pages
.
setRecords
(
collect
);
}
}
}
}
...
@@ -2263,15 +2378,16 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
...
@@ -2263,15 +2378,16 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
@Override
@Override
public
List
<
OrgMenuDto
>
systemAndEquipmentTreeByBziOrgCode
()
{
public
List
<
OrgMenuDto
>
systemAndEquipmentTreeByBziOrgCode
()
{
FeignClientResult
<
List
<
OrgUsrDto
>>
feignClientResult
=
jcsFeignClient
.
getCompanyDeptListWithAuth
(
authKey
,
"COMPANY"
,
"dl"
);
FeignClientResult
<
List
<
OrgUsrDto
>>
feignClientResult
=
jcsFeignClient
.
getCompanyDeptListWithAuth
(
authKey
,
"COMPANY"
,
"dl"
);
String
bizOrgCode
=
feignClientResult
.
getResult
().
get
(
0
).
getBizOrgCode
();
String
bizOrgCode
=
feignClientResult
.
getResult
().
get
(
0
).
getBizOrgCode
();
List
<
Map
<
String
,
Object
>>
list
=
fireFightingSystemMapper
.
systemAndEquipment
(
bizOrgCode
);
List
<
Map
<
String
,
Object
>>
list
=
fireFightingSystemMapper
.
systemAndEquipment
(
bizOrgCode
);
return
systemAndEquipmentTree
(
list
);
return
systemAndEquipmentTree
(
list
);
}
}
@Override
@Override
public
Map
<
String
,
Object
>
getSystemDetailByCode
(
String
systemCode
)
{
public
Map
<
String
,
Object
>
getSystemDetailByCode
(
String
systemCode
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
LambdaQueryWrapper
<
FireFightingSystemEntity
>
wrapper
=
new
LambdaQueryWrapper
<>();
LambdaQueryWrapper
<
FireFightingSystemEntity
>
wrapper
=
new
LambdaQueryWrapper
<>();
wrapper
.
eq
(
FireFightingSystemEntity:
:
getCode
,
systemCode
);
wrapper
.
eq
(
FireFightingSystemEntity:
:
getCode
,
systemCode
);
List
<
FireFightingSystemEntity
>
systemEntities
=
this
.
list
(
wrapper
);
List
<
FireFightingSystemEntity
>
systemEntities
=
this
.
list
(
wrapper
);
...
@@ -2282,33 +2398,34 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
...
@@ -2282,33 +2398,34 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
}
}
map
.
put
(
"isExist"
,
true
);
map
.
put
(
"isExist"
,
true
);
if
(
systemEntities
!=
null
)
{
if
(
systemEntities
!=
null
)
{
FireFightingSystemVo
fireFightingSystemVo
=
fireFightingSystemMapper
.
getFightingSysInfo
(
systemEntities
.
get
(
0
).
getCode
(),
systemEntities
.
get
(
0
).
getId
());
FireFightingSystemVo
fireFightingSystemVo
=
fireFightingSystemMapper
.
getFightingSysInfo
(
systemEntities
.
get
(
0
).
getCode
(),
systemEntities
.
get
(
0
).
getId
());
map
.
put
(
"systemStatus"
,
"异常"
.
equals
(
fireFightingSystemVo
.
getStatus
())
?
false
:
true
);
map
.
put
(
"systemStatus"
,
"异常"
.
equals
(
fireFightingSystemVo
.
getStatus
())
?
false
:
true
);
}
else
{
}
else
{
map
.
put
(
"systemStatus"
,
true
);
map
.
put
(
"systemStatus"
,
true
);
}
}
map
.
put
(
"name"
,
systemEntities
.
get
(
0
).
getName
());
map
.
put
(
"name"
,
systemEntities
.
get
(
0
).
getName
());
map
.
put
(
"code"
,
systemEntities
.
get
(
0
).
getCode
());
map
.
put
(
"code"
,
systemEntities
.
get
(
0
).
getCode
());
map
.
put
(
"installDate"
,
systemEntities
.
get
(
0
).
getInstallDate
());
map
.
put
(
"installDate"
,
systemEntities
.
get
(
0
).
getInstallDate
());
map
.
put
(
"chargePersonPhone"
,
systemEntities
.
get
(
0
).
getChargePersonPhone
());
map
.
put
(
"chargePersonPhone"
,
systemEntities
.
get
(
0
).
getChargePersonPhone
());
map
.
put
(
"chargePersonName"
,
systemEntities
.
get
(
0
).
getChargePersonName
());
map
.
put
(
"chargePersonName"
,
systemEntities
.
get
(
0
).
getChargePersonName
());
map
.
put
(
"designOrg"
,
systemEntities
.
get
(
0
).
getDesignOrg
());
map
.
put
(
"designOrg"
,
systemEntities
.
get
(
0
).
getDesignOrg
());
map
.
put
(
"designOrgTelephone"
,
systemEntities
.
get
(
0
).
getDesignOrgTelephone
());
map
.
put
(
"designOrgTelephone"
,
systemEntities
.
get
(
0
).
getDesignOrgTelephone
());
map
.
put
(
"leadDesigner"
,
systemEntities
.
get
(
0
).
getLeadDesigner
());
map
.
put
(
"leadDesigner"
,
systemEntities
.
get
(
0
).
getLeadDesigner
());
Long
num
=
this
.
baseMapper
.
selectEquipCountBySystemId
(
systemEntities
.
get
(
0
).
getId
());
Long
num
=
this
.
baseMapper
.
selectEquipCountBySystemId
(
systemEntities
.
get
(
0
).
getId
());
String
systemType
=
this
.
baseMapper
.
selectEquipSystemType
(
systemCode
);
String
systemType
=
this
.
baseMapper
.
selectEquipSystemType
(
systemCode
);
map
.
put
(
"systemType"
,
systemType
);
map
.
put
(
"systemType"
,
systemType
);
map
.
put
(
"num"
,
num
);
map
.
put
(
"num"
,
num
);
return
map
;
return
map
;
}
}
public
static
List
<
OrgMenuDto
>
systemAndEquipmentTree
(
List
<
Map
<
String
,
Object
>>
list
)
{
public
static
List
<
OrgMenuDto
>
systemAndEquipmentTree
(
List
<
Map
<
String
,
Object
>>
list
)
{
List
<
OrgMenuDto
>
menuList
=
list
.
stream
()
List
<
OrgMenuDto
>
menuList
=
list
.
stream
()
.
map
(
o
->
new
OrgMenuDto
(
Long
.
parseLong
(
o
.
get
(
"id"
).
toString
()),
o
.
get
(
"name"
).
toString
(),
.
map
(
o
->
new
OrgMenuDto
(
Long
.
parseLong
(
o
.
get
(
"id"
).
toString
()),
o
.
get
(
"name"
).
toString
(),
ObjectUtils
.
isEmpty
(
o
.
get
(
"parentId"
))
?
0L
:
Long
.
parseLong
(
o
.
get
(
"parentId"
).
toString
()),
ObjectUtils
.
isEmpty
(
o
.
get
(
"parentId"
))
?
0L
:
Long
.
parseLong
(
o
.
get
(
"parentId"
).
toString
()),
ObjectUtils
.
isEmpty
(
o
.
get
(
"code"
))
?
""
:
o
.
get
(
"code"
).
toString
()
,
ObjectUtils
.
isEmpty
(
o
.
get
(
"code"
))
?
""
:
o
.
get
(
"code"
).
toString
(),
false
,
false
,
o
.
get
(
"bizOrgCode"
).
toString
()))
o
.
get
(
"bizOrgCode"
).
toString
()))
.
collect
(
Collectors
.
toList
());
.
collect
(
Collectors
.
toList
());
List
<
OrgMenuDto
>
result
=
new
ArrayList
<>();
List
<
OrgMenuDto
>
result
=
new
ArrayList
<>();
Map
<
Long
,
OrgMenuDto
>
map
=
new
HashMap
<>(
menuList
.
size
());
Map
<
Long
,
OrgMenuDto
>
map
=
new
HashMap
<>(
menuList
.
size
());
...
@@ -2336,7 +2453,6 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
...
@@ -2336,7 +2453,6 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
return
result
;
return
result
;
}
}
@Override
@Override
public
Map
<
String
,
Object
>
getStationConnectStatus
()
{
public
Map
<
String
,
Object
>
getStationConnectStatus
()
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
...
...
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;
...
@@ -3,9 +3,11 @@ package com.yeejoin;
import
java.net.InetAddress
;
import
java.net.InetAddress
;
import
java.net.UnknownHostException
;
import
java.net.UnknownHostException
;
import
org.eclipse.paho.client.mqttv3.MqttException
;
import
org.mybatis.spring.annotation.MapperScan
;
import
org.mybatis.spring.annotation.MapperScan
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
...
@@ -20,9 +22,11 @@ import org.springframework.core.env.Environment;
...
@@ -20,9 +22,11 @@ import org.springframework.core.env.Environment;
import
org.springframework.scheduling.annotation.EnableAsync
;
import
org.springframework.scheduling.annotation.EnableAsync
;
import
org.springframework.transaction.annotation.EnableTransactionManagement
;
import
org.springframework.transaction.annotation.EnableTransactionManagement
;
import
org.springframework.web.client.RestTemplate
;
import
org.springframework.web.client.RestTemplate
;
import
org.typroject.tyboot.component.emq.EmqKeeper
;
import
org.typroject.tyboot.core.restful.exception.GlobalExceptionHandler
;
import
org.typroject.tyboot.core.restful.exception.GlobalExceptionHandler
;
import
com.yeejoin.amos.boot.biz.common.utils.oConvertUtils
;
import
com.yeejoin.amos.boot.biz.common.utils.oConvertUtils
;
import
com.yeejoin.equipmanage.listener.CarIotListener
;
@SpringBootApplication
@SpringBootApplication
@EnableTransactionManagement
@EnableTransactionManagement
...
@@ -40,6 +44,12 @@ public class AmostEquipApplication {
...
@@ -40,6 +44,12 @@ public class AmostEquipApplication {
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
AmostEquipApplication
.
class
);
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
{
public
static
void
main
(
String
[]
args
)
throws
UnknownHostException
{
ConfigurableApplicationContext
context
=
SpringApplication
.
run
(
AmostEquipApplication
.
class
,
args
);
ConfigurableApplicationContext
context
=
SpringApplication
.
run
(
AmostEquipApplication
.
class
,
args
);
Environment
env
=
context
.
getEnvironment
();
Environment
env
=
context
.
getEnvironment
();
...
@@ -57,4 +67,14 @@ public class AmostEquipApplication {
...
@@ -57,4 +67,14 @@ public class AmostEquipApplication {
RestTemplate
restTemplate
(){
RestTemplate
restTemplate
(){
return
new
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 @@
...
@@ -1893,6 +1893,12 @@
<if
test=
"equipTypeAmountPage.iotCode!=null and equipTypeAmountPage.iotCode!=''"
>
<if
test=
"equipTypeAmountPage.iotCode!=null and equipTypeAmountPage.iotCode!=''"
>
AND wlc.iot_code LIKE CONCAT('%',#{equipTypeAmountPage.iotCode},'%')
AND wlc.iot_code LIKE CONCAT('%',#{equipTypeAmountPage.iotCode},'%')
</if>
</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
)s2
<if
test=
"equipTypeAmountPage.warehouseStructureName!=null and equipTypeAmountPage.warehouseStructureName!=''"
>
<if
test=
"equipTypeAmountPage.warehouseStructureName!=null and equipTypeAmountPage.warehouseStructureName!=''"
>
where s2.full_name LIKE CONCAT('%',#{equipTypeAmountPage.warehouseStructureName},'%')
where s2.full_name LIKE CONCAT('%',#{equipTypeAmountPage.warehouseStructureName},'%')
...
@@ -1900,6 +1906,7 @@
...
@@ -1900,6 +1906,7 @@
<if
test=
"equipTypeAmountPage.bizOrgCode!=null and equipTypeAmountPage.bizOrgCode!=''"
>
<if
test=
"equipTypeAmountPage.bizOrgCode!=null and equipTypeAmountPage.bizOrgCode!=''"
>
where s2.bizOrgCode LIKE CONCAT(#{equipTypeAmountPage.bizOrgCode},'%')
where s2.bizOrgCode LIKE CONCAT(#{equipTypeAmountPage.bizOrgCode},'%')
</if>
</if>
order by createDate DESC
order by createDate DESC
</select>
</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