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
9bc23146
Commit
9bc23146
authored
Jun 15, 2023
by
caotao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
车辆统计页面接口提交
parent
5282006a
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
1062 additions
and
356 deletions
+1062
-356
CarEquipAlarmInfoDto.java
...n/equipmanage/common/entity/dto/CarEquipAlarmInfoDto.java
+35
-0
CarEquipStateInfoDto.java
...n/equipmanage/common/entity/dto/CarEquipStateInfoDto.java
+41
-0
CarController.java
...ava/com/yeejoin/equipmanage/controller/CarController.java
+81
-4
BasicTableDataDto.java
...n/java/com/yeejoin/equipmanage/dto/BasicTableDataDto.java
+92
-0
CarAreaInfoDto.java
...main/java/com/yeejoin/equipmanage/dto/CarAreaInfoDto.java
+10
-0
CarExceptionDto.java
...ain/java/com/yeejoin/equipmanage/dto/CarExceptionDto.java
+11
-0
CarExportDto.java
...c/main/java/com/yeejoin/equipmanage/dto/CarExportDto.java
+20
-0
ChartIntegerDto.java
...ain/java/com/yeejoin/equipmanage/dto/ChartIntegerDto.java
+10
-0
ColModel.java
...z/src/main/java/com/yeejoin/equipmanage/dto/ColModel.java
+21
-0
MileageDto.java
...src/main/java/com/yeejoin/equipmanage/dto/MileageDto.java
+13
-0
MypageDto.java
.../src/main/java/com/yeejoin/equipmanage/dto/MypageDto.java
+17
-0
ZZChartsDto.java
...rc/main/java/com/yeejoin/equipmanage/dto/ZZChartsDto.java
+30
-0
CarIotNewListener.java
...a/com/yeejoin/equipmanage/listener/CarIotNewListener.java
+25
-1
CarMapper.java
...c/main/java/com/yeejoin/equipmanage/mapper/CarMapper.java
+5
-1
WlCarMileageMapper.java
...va/com/yeejoin/equipmanage/mapper/WlCarMileageMapper.java
+2
-0
ICarService.java
...ain/java/com/yeejoin/equipmanage/service/ICarService.java
+18
-0
IWlCarMileageService.java
...com/yeejoin/equipmanage/service/IWlCarMileageService.java
+2
-0
CarServiceImpl.java
.../com/yeejoin/equipmanage/service/impl/CarServiceImpl.java
+253
-11
WlCarMileageServiceImpl.java
...oin/equipmanage/service/impl/WlCarMileageServiceImpl.java
+9
-1
application-dev.properties
...ystem-equip/src/main/resources/application-dev.properties
+13
-9
application.properties
...ot-system-equip/src/main/resources/application.properties
+1
-2
CarMapper.xml
...boot-system-equip/src/main/resources/mapper/CarMapper.xml
+338
-327
WlCarMileageMapper.xml
...em-equip/src/main/resources/mapper/WlCarMileageMapper.xml
+15
-0
No files found.
amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/entity/dto/CarEquipAlarmInfoDto.java
0 → 100644
View file @
9bc23146
package
com
.
yeejoin
.
equipmanage
.
common
.
entity
.
dto
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.models.auth.In
;
import
lombok.Data
;
import
org.joda.time.DateTime
;
import
java.util.Date
;
/**
* 消防车信息
*
* @author wujiang
* @date 2020-07-07
*/
@Data
public
class
CarEquipAlarmInfoDto
{
private
static
final
long
serialVersionUID
=
1L
;
@ApiModelProperty
(
value
=
"序号"
)
private
Integer
no
;
@ApiModelProperty
(
value
=
"告警车辆"
)
private
String
carNum
;
@ApiModelProperty
(
value
=
"扩展字段2"
)
private
String
extra2
;
@ApiModelProperty
(
value
=
"告警时间"
)
private
String
alarmDate
=
new
DateTime
().
toLocalDate
().
toString
();
@ApiModelProperty
(
value
=
"告警信息"
)
private
String
alarmMessage
=
"该设备电量低!"
;
}
amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/entity/dto/CarEquipStateInfoDto.java
0 → 100644
View file @
9bc23146
package
com
.
yeejoin
.
equipmanage
.
common
.
entity
.
dto
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler
;
import
com.yeejoin.equipmanage.common.entity.*
;
import
com.yeejoin.equipmanage.common.entity.publics.BaseEntity
;
import
com.yeejoin.equipmanage.common.entity.vo.EquipmentOnCarAppVO
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
java.math.BigDecimal
;
import
java.util.List
;
/**
* 消防车信息
*
* @author wujiang
* @date 2020-07-07
*/
@Data
public
class
CarEquipStateInfoDto
{
private
static
final
long
serialVersionUID
=
1L
;
@ApiModelProperty
(
value
=
"车牌号"
)
private
String
carNum
;
@ApiModelProperty
(
value
=
"机构/部门名称"
)
private
String
bizOrgName
;
@ApiModelProperty
(
value
=
"扩展字段2"
)
private
String
extra2
;
@ApiModelProperty
(
value
=
"设备状态"
)
private
String
equipState
;
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/controller/CarController.java
View file @
9bc23146
...
...
@@ -12,6 +12,8 @@ import com.yeejoin.amos.feign.privilege.Privilege;
import
com.yeejoin.equipmanage.common.dto.CarInfoDto
;
import
com.yeejoin.equipmanage.common.dto.CarStatusInfoDto
;
import
com.yeejoin.equipmanage.common.entity.*
;
import
com.yeejoin.equipmanage.common.entity.dto.CarEquipAlarmInfoDto
;
import
com.yeejoin.equipmanage.common.entity.dto.CarEquipStateInfoDto
;
import
com.yeejoin.equipmanage.common.entity.dto.CommonFile
;
import
com.yeejoin.equipmanage.common.entity.publics.CommonResponse
;
import
com.yeejoin.equipmanage.common.entity.vo.CarIndexVo
;
...
...
@@ -20,6 +22,7 @@ import com.yeejoin.equipmanage.common.entity.vo.EquipmentOnCarAppVO;
import
com.yeejoin.equipmanage.common.enums.*
;
import
com.yeejoin.equipmanage.common.utils.*
;
import
com.yeejoin.equipmanage.common.vo.*
;
import
com.yeejoin.equipmanage.dto.*
;
import
com.yeejoin.equipmanage.fegin.JcsFeign
;
import
com.yeejoin.equipmanage.mapper.*
;
import
com.yeejoin.equipmanage.service.*
;
...
...
@@ -31,6 +34,7 @@ import io.swagger.annotations.ApiParam;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.http.HttpResponse
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
...
...
@@ -49,6 +53,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.*
;
import
java.util.stream.Collectors
;
...
...
@@ -416,7 +421,7 @@ public class CarController extends AbstractBaseController {
* @return
*/
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
GET
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"根据id查询"
,
notes
=
"根据id查询"
)
public
Car
selectById
(
HttpServletRequest
request
,
@PathVariable
Long
id
)
{
return
iCarService
.
selectOneById
(
id
);
...
...
@@ -1391,10 +1396,82 @@ public class CarController extends AbstractBaseController {
return
ResponseHelper
.
buildResponse
(
iCarService
.
getQRCode
(
id
));
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@RequestMapping
(
value
=
"/location"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"获取二维码图片"
,
notes
=
"获取二维码图片"
)
public
ResponseModel
<
Object
>
location
()
throws
Exception
{
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"获取二维码图片"
,
notes
=
"获取二维码图片"
)
public
ResponseModel
<
Object
>
location
()
throws
Exception
{
return
ResponseHelper
.
buildResponse
(
iCarService
.
location
());
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@RequestMapping
(
value
=
"/getCountOfCar"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"车辆统计-获取车辆总数"
,
notes
=
"车辆统计-获取车辆总数"
)
public
Map
<
String
,
Integer
>
getCountOfCar
()
{
return
iCarService
.
getCountOfCar
();
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@RequestMapping
(
value
=
"/getCountOfCarBelongCompany"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"车辆统计-获取车辆归属单位总数"
,
notes
=
"车辆统计-获取车辆归属单位总数"
)
public
ResponseModel
<
Integer
>
getCountOfCarBelongCompany
()
{
return
CommonResponseUtil
.
success
(
iCarService
.
getCountOfCarBelongCompany
());
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@RequestMapping
(
value
=
"/getCarCategoryInfo"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"车辆统计-获取车辆分类用途信息"
,
notes
=
"车辆统计-获取车辆分类用途信息"
)
public
List
<
ChartIntegerDto
>
getCarCategoryInfo
()
{
return
iCarService
.
getCarCategoryInfo
();
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@RequestMapping
(
value
=
"/getCarEquipStateInfo"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"车辆统计-获取设备状态信息"
,
notes
=
"车辆统计-获取设备状态信息"
)
public
Page
<
CarEquipStateInfoDto
>
getCarEquipStateInfo
()
{
return
iCarService
.
getCarEquipStateInfo
();
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@RequestMapping
(
value
=
"/getCarEquipAlarmInfoDto"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"车辆统计-获取设备告警信息"
,
notes
=
"车辆统计-获取设备告警信息"
)
public
Page
<
CarEquipAlarmInfoDto
>
getCarEquipAlarmInfoDto
()
{
return
iCarService
.
getCarEquipAlarmInfoDto
();
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@RequestMapping
(
value
=
"/getCarBelongAreaInfo"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"车辆统计-获取车辆归属信息接口"
,
notes
=
"车辆统计-获取车辆归属信息接口"
)
public
List
<
ChartIntegerDto
>
getCarBelongAreaInfo
()
{
return
iCarService
.
getCarBelongAreaInfo
();
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@RequestMapping
(
value
=
"/getCarAreaInfo"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"车辆统计-获取片区车辆归属信息接口"
,
notes
=
"车辆统计-获取片区车辆归属信息接口"
)
public
Page
<
CarAreaInfoDto
>
getCarAreaInfo
(
@RequestParam
Long
id
)
{
return
iCarService
.
getCarAreaInfo
(
id
);
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@RequestMapping
(
value
=
"/getCarMileageInfoByMoth"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"车辆统计-按照月份统计车辆里程"
,
notes
=
"车辆统计-按照月份统计车辆里程"
)
public
Page
<
MileageDto
>
getCarMileageInfoByMoth
(
@RequestParam
String
date
)
{
return
iCarService
.
getCarMileageInfoByMoth
(
date
);
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@RequestMapping
(
value
=
"/exportCarMileageInfoByMoth"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"车辆统计-按照月份统计车辆里程"
,
notes
=
"车辆统计-按照月份统计车辆里程"
)
public
void
exportCarMileageInfoByMoth
(
@RequestParam
String
date
,
HttpServletResponse
response
)
{
List
<
CarExportDto
>
list
=
this
.
iCarService
.
exportCarMileageInfoByMoth
(
date
);
String
name
=
"车辆里程月度统计表-"
+
date
;
FileHelper
.
exportExcel
(
list
,
name
,
name
,
CarExportDto
.
class
,
UUID
.
randomUUID
().
toString
()+
".xls"
,
response
);
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@RequestMapping
(
value
=
"/getCarMileageInfoByMothOFDay"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"车辆统计-按照月份统计每天的车辆里程"
,
notes
=
"车辆统计-按照月份统计每天的车辆里程"
)
public
ZZChartsDto
getCarMileageInfoByMothOFDay
(
@RequestParam
String
iotCode
)
{
return
iCarService
.
getCarMileageInfoByMothOFDay
(
iotCode
);
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@RequestMapping
(
value
=
"/getCarExcepitonTrack"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"车辆统计-按照日期范围获取异常车辆"
,
notes
=
"车辆统计-按照日期范围获取异常车辆"
)
public
Page
<
CarExceptionDto
>
getCarExcepitonTrack
(
@RequestParam
Integer
type
)
{
return
iCarService
.
getCarExcepitonTrack
(
type
);
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/dto/BasicTableDataDto.java
0 → 100644
View file @
9bc23146
package
com
.
yeejoin
.
equipmanage
.
dto
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
lombok.Data
;
import
java.util.List
;
@Data
public
class
BasicTableDataDto
{
// {
// "dataGridMock": {
// "current": 1,
// "total": 5,
// "pagination": false,
// "totalPage": 1,
// "dataList": [
// {
// "title2_measure": "蒋公岭风电场",
// "title1_measure": "鄂A 350L9",
// "title3_measure": "开机",
// "title4_measure": "20%",
// "_id": 1
// },
// {
// "title2_measure": "蒋公岭风电场",
// "title1_measure": "鄂A 350L8",
// "title3_measure": "开机",
// "title4_measure": "20%",
// "_id": 2
// },
// {
// "title2_measure": "蒋公岭风电场",
// "title1_measure": "鄂A 350L4",
// "title3_measure": "开机",
// "title4_measure": "20%",
// "_id": 3
// },
// {
// "title2_measure": "蒋公岭风电场",
// "title1_measure": "鄂A 350L5",
// "title3_measure": "关机",
// "title4_measure": "20%",
// "_id": 4
// },
// {
// "title2_measure": "蒋公岭风电场",
// "title1_measure": "鄂A 350L6",
// "title3_measure": "开机",
// "title4_measure": "20%",
// "_id": 5
// }
// ],
// "pageSize": 10
// },
// "colModel": [
// {
// "fid": "title1_measure",
// "dataIndex": "title1_measure",
// "name": "车牌号",
// "title": "车牌号",
// "type": "dataGrid",
// "key": "title1_measure"
// },
// {
// "fid": "title2_measure",
// "dataIndex": "title2_measure",
// "name": "所属单位",
// "title": "所属单位",
// "type": "dataGrid",
// "key": "title2_measure"
// },
// {
// "fid": "title3_measure",
// "dataIndex": "title3_measure",
// "name": "设备状态",
// "title": "设备状态",
// "type": "dataGrid",
// "key": "title3_measure"
// },
// {
// "fid": "title4_measure",
// "dataIndex": "title4_measure",
// "name": "设备电量",
// "title": "设备电量",
// "type": "dataGrid",
// "key": "title4_measure"
// }
// ]
// }
private
MypageDto
dataGridMock
;
private
List
<
ColModel
>
colModel
;
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/dto/CarAreaInfoDto.java
0 → 100644
View file @
9bc23146
package
com
.
yeejoin
.
equipmanage
.
dto
;
import
lombok.Data
;
@Data
public
class
CarAreaInfoDto
{
private
Integer
no
;
private
String
name
;
private
Integer
countOfCar
=
0
;
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/dto/CarExceptionDto.java
0 → 100644
View file @
9bc23146
package
com
.
yeejoin
.
equipmanage
.
dto
;
import
lombok.Data
;
@Data
public
class
CarExceptionDto
{
private
String
carNumber
;
private
String
belongStation
;
private
String
belongStation1
=
"运行轨迹"
;
private
String
carId
;
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/dto/CarExportDto.java
0 → 100644
View file @
9bc23146
package
com
.
yeejoin
.
equipmanage
.
dto
;
import
cn.afterturn.easypoi.excel.annotation.Excel
;
import
lombok.Data
;
@Data
public
class
CarExportDto
{
@Excel
(
name
=
"车辆编号"
)
private
String
code
;
@Excel
(
name
=
"车牌号"
)
private
String
carNumber
;
@Excel
(
name
=
"所属单位"
)
private
String
orgName
;
@Excel
(
name
=
"车辆型号"
)
private
String
standard
;
@Excel
(
name
=
"排量(升)"
)
private
String
displacement
;
@Excel
(
name
=
"里程数(km)"
)
private
String
totalTravel
;
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/dto/ChartIntegerDto.java
0 → 100644
View file @
9bc23146
package
com
.
yeejoin
.
equipmanage
.
dto
;
import
lombok.Data
;
@Data
public
class
ChartIntegerDto
{
private
Long
companyId
;
private
String
name
;
private
Integer
value
=
0
;
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/dto/ColModel.java
0 → 100644
View file @
9bc23146
package
com
.
yeejoin
.
equipmanage
.
dto
;
import
lombok.Data
;
@Data
public
class
ColModel
{
private
String
fid
;
private
String
dataIndex
;
private
String
name
;
private
String
title
;
private
String
type
=
"dataGrid"
;
private
String
key
;
public
ColModel
(
String
fid
,
String
name
){
this
.
fid
=
fid
;
this
.
dataIndex
=
fid
;
this
.
key
=
fid
;
this
.
type
=
"dataGrid"
;
this
.
name
=
name
;
this
.
title
=
name
;
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/dto/MileageDto.java
0 → 100644
View file @
9bc23146
package
com
.
yeejoin
.
equipmanage
.
dto
;
import
lombok.Data
;
@Data
public
class
MileageDto
{
private
String
carCode
;
private
String
carNum
;
private
Double
totalTravel
;
private
String
total
;
//iotCode+date
private
String
iotCode
;
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/dto/MypageDto.java
0 → 100644
View file @
9bc23146
package
com
.
yeejoin
.
equipmanage
.
dto
;
import
io.swagger.models.auth.In
;
import
lombok.Data
;
import
java.util.List
;
@Data
public
class
MypageDto
{
private
Integer
current
;
private
Integer
total
;
private
Boolean
pagination
;
private
Integer
totalPage
;
private
List
dataList
;
private
Integer
pageSize
;
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/dto/ZZChartsDto.java
0 → 100644
View file @
9bc23146
package
com
.
yeejoin
.
equipmanage
.
dto
;
import
lombok.Data
;
import
java.util.List
;
@Data
public
class
ZZChartsDto
{
// {
// "seriesData": [
// 2,
// 1,
// 1,
// 2,
// "1.7"
// ],
// "axisData": [
// "A",
// "B",
// "C",
// "D",
// "E"
// ]
// }
//Y轴
private
List
seriesData
;
// X轴
private
List
axisData
;
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/listener/CarIotNewListener.java
View file @
9bc23146
...
...
@@ -65,8 +65,10 @@ public class CarIotNewListener extends EmqxListener {
String
deviceName
=
topic
.
split
(
"/"
)[
1
];
String
iotCode
=
measurement
+
deviceName
;
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
message
.
toString
());
//通过消息存电量到扩展字段2
this
.
updateEquipBattery
(
jsonObject
,
iotCode
);
if
(
jsonObject
.
containsKey
(
"FireCar_Longitude"
))
{
this
.
updateCarLocation
(
jsonObject
,
iotCode
);
this
.
updateCarLocation
(
jsonObject
,
iotCode
);
//如果map中已经存在该设备或者该设备有但是线程已经执行了
if
((!
deviceInfo
.
containsKey
(
iotCode
))
||
(
deviceInfo
.
containsKey
(
iotCode
)
&&
deviceInfo
.
get
(
iotCode
)
==
null
))
{
ThreadCar
threadCar
=
new
ThreadCar
(
iotCode
,
jsonObject
,
this
.
iWlCarMileageService
,
this
.
iotFeign
,
this
.
iCarService
,
this
.
emqkeeper
,
clipping_time
);
...
...
@@ -163,6 +165,7 @@ public class CarIotNewListener extends EmqxListener {
calendar
.
set
(
Calendar
.
HOUR
,
calendar
.
get
(
Calendar
.
HOUR
)
+
8
);
return
calendar
.
getTime
();
}
public
void
updateCarLocation
(
JSONObject
jsonObject
,
String
iotCode
)
{
if
(
jsonObject
.
containsKey
(
"FireCar_Longitude"
)
&&
jsonObject
.
containsKey
(
"FireCar_Latitude"
))
{
// 获取开始坐标
...
...
@@ -196,4 +199,25 @@ public class CarIotNewListener extends EmqxListener {
}
}
}
//存储设备电量到扩展字段2
public
void
updateEquipBattery
(
JSONObject
jsonObject
,
String
iotCode
)
{
Integer
power
=
0
;
if
(
jsonObject
.
containsKey
(
"additionalInformations"
)
&&
jsonObject
.
get
(
"additionalInformations"
)
!=
null
)
{
JSONObject
jsonObject1
=
JSONObject
.
parseObject
(
jsonObject
.
get
(
"additionalInformations"
).
toString
());
if
(
jsonObject1
!=
null
)
{
JSONObject
jsonObject2
=
JSONObject
.
parseObject
(
jsonObject1
.
get
(
"additionalInformations"
).
toString
());
if
(
jsonObject2
!=
null
&&
jsonObject2
.
containsKey
(
"power"
))
{
power
=
jsonObject2
.
getInteger
(
"power"
);
}
}
}
Car
car
=
iCarService
.
getOne
(
new
LambdaQueryWrapper
<
Car
>().
eq
(
Car:
:
getIotCode
,
iotCode
));
if
(
car
!=
null
&&
power
!=
0
)
{
car
.
setExtra2
(
power
.
toString
());
iCarService
.
updateById
(
car
);
System
.
out
.
println
(
"-----------更新车辆设备电池电量成功--------"
);
}
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/mapper/CarMapper.java
View file @
9bc23146
...
...
@@ -5,6 +5,8 @@ import com.yeejoin.equipmanage.common.datasync.entity.FireVehicle;
import
com.yeejoin.equipmanage.common.dto.CarFusionDto
;
import
com.yeejoin.equipmanage.common.entity.Car
;
import
com.yeejoin.equipmanage.common.entity.dto.CarDto
;
import
com.yeejoin.equipmanage.common.entity.dto.CarEquipAlarmInfoDto
;
import
com.yeejoin.equipmanage.common.entity.dto.CarEquipStateInfoDto
;
import
com.yeejoin.equipmanage.common.entity.vo.CarIndexVo
;
import
com.yeejoin.equipmanage.common.entity.vo.CarPropertyVo
;
import
com.yeejoin.equipmanage.common.entity.vo.EquipmentOnCarAppVO
;
...
...
@@ -82,5 +84,7 @@ public interface CarMapper extends BaseMapper<Car> {
List
<
Map
<
String
,
Object
>>
getCarState
();
List
<
Map
<
String
,
Object
>>
getFirePowerInfo
();
Integer
getCarCategoryCountByCategoryID
(
Long
categoryID
);
List
<
CarEquipStateInfoDto
>
getCarEquipStateInfo
();
List
<
CarEquipAlarmInfoDto
>
getCarEquipAlarmInfo
(
Integer
batteryNumber
);
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/mapper/WlCarMileageMapper.java
View file @
9bc23146
...
...
@@ -20,5 +20,7 @@ public interface WlCarMileageMapper extends BaseMapper<WlCarMileage> {
Double
totalMileage
(
String
iotCode
);
List
<
WlCarMileage
>
list
(
@Param
(
"date"
)
String
date
);
Double
getTotalTravelByIotCodeAndDate
(
String
date
,
String
iotCode
);
Double
getTotalTravelByIotCodeAndDateProd
(
String
startDate
,
String
endDate
,
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 @
9bc23146
...
...
@@ -13,10 +13,14 @@ import com.yeejoin.equipmanage.common.entity.CarInfo;
import
com.yeejoin.equipmanage.common.entity.CarProperty
;
import
com.yeejoin.equipmanage.common.entity.EquipmentCategory
;
import
com.yeejoin.equipmanage.common.entity.dto.CarDto
;
import
com.yeejoin.equipmanage.common.entity.dto.CarEquipAlarmInfoDto
;
import
com.yeejoin.equipmanage.common.entity.dto.CarEquipStateInfoDto
;
import
com.yeejoin.equipmanage.common.entity.vo.CarIndexVo
;
import
com.yeejoin.equipmanage.common.entity.vo.CarPropertyVo
;
import
com.yeejoin.equipmanage.common.vo.*
;
import
com.yeejoin.equipmanage.dto.*
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
...
...
@@ -189,4 +193,18 @@ public interface ICarService extends IService<Car> {
IPage
getQRCode
(
Long
id
);
List
<
Car
>
location
();
// 获取车辆总数
Map
<
String
,
Integer
>
getCountOfCar
();
// 获取车辆归属单位总数
Map
<
String
,
Integer
>
getCountOfCarBelongCompany
();
List
<
ChartIntegerDto
>
getCarCategoryInfo
()
;
Page
<
CarEquipStateInfoDto
>
getCarEquipStateInfo
();
Page
<
CarEquipAlarmInfoDto
>
getCarEquipAlarmInfoDto
();
List
<
ChartIntegerDto
>
getCarBelongAreaInfo
()
;
Page
<
CarAreaInfoDto
>
getCarAreaInfo
(
Long
id
)
;
Page
<
MileageDto
>
getCarMileageInfoByMoth
(
String
date
);
List
<
CarExportDto
>
exportCarMileageInfoByMoth
(
String
date
);
ZZChartsDto
getCarMileageInfoByMothOFDay
(
String
iotCode
);
Page
<
CarExceptionDto
>
getCarExcepitonTrack
(
Integer
type
);
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/IWlCarMileageService.java
View file @
9bc23146
...
...
@@ -33,4 +33,6 @@ public interface IWlCarMileageService extends IService<WlCarMileage> {
//根据iot编码查询是否有未结束里程
Boolean
getUncompleteMileagByIotCode
(
String
iotCode
);
Double
getTotalTravelByIotCodeAndDate
(
String
date
,
String
iotCode
);
Double
getTotalTravelByIotCodeAndDateProd
(
String
StartDate
,
String
endDate
,
String
iotCode
);
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/CarServiceImpl.java
View file @
9bc23146
package
com
.
yeejoin
.
equipmanage
.
service
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.TypeReference
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper
;
...
...
@@ -17,6 +19,8 @@ import com.yeejoin.amos.component.feign.config.InnerInvokException;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
com.yeejoin.amos.feign.privilege.model.CompanyModel
;
import
com.yeejoin.amos.feign.privilege.model.UserOrgTreeModel
;
import
com.yeejoin.amos.feign.systemctl.Systemctl
;
import
com.yeejoin.equipmanage.common.datasync.entity.FireVehicle
;
import
com.yeejoin.equipmanage.common.dto.CarFusionDto
;
...
...
@@ -24,6 +28,8 @@ import com.yeejoin.equipmanage.common.dto.CarInfoDto;
import
com.yeejoin.equipmanage.common.dto.CarStatusInfoDto
;
import
com.yeejoin.equipmanage.common.entity.*
;
import
com.yeejoin.equipmanage.common.entity.dto.CarDto
;
import
com.yeejoin.equipmanage.common.entity.dto.CarEquipAlarmInfoDto
;
import
com.yeejoin.equipmanage.common.entity.dto.CarEquipStateInfoDto
;
import
com.yeejoin.equipmanage.common.entity.publics.BaseEntity
;
import
com.yeejoin.equipmanage.common.entity.vo.CarIndexVo
;
import
com.yeejoin.equipmanage.common.entity.vo.CarPropertyVo
;
...
...
@@ -32,6 +38,7 @@ import com.yeejoin.equipmanage.common.enums.*;
import
com.yeejoin.equipmanage.common.exception.CommonException
;
import
com.yeejoin.equipmanage.common.utils.*
;
import
com.yeejoin.equipmanage.common.vo.*
;
import
com.yeejoin.equipmanage.dto.*
;
import
com.yeejoin.equipmanage.mapper.*
;
import
com.yeejoin.equipmanage.remote.RemoteSecurityService
;
import
com.yeejoin.equipmanage.service.*
;
...
...
@@ -60,7 +67,10 @@ import javax.servlet.http.HttpServletRequest;
import
java.io.ByteArrayInputStream
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.PrintStream
;
import
java.math.BigDecimal
;
import
java.time.LocalDate
;
import
java.time.ZoneId
;
import
java.util.*
;
import
java.util.function.Consumer
;
import
java.util.function.Function
;
...
...
@@ -156,6 +166,11 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
@Value
(
"${systemctl.sync.switch}"
)
private
Boolean
syncSwitch
;
@Value
(
"${equip.car.alarmBattery}"
)
private
Integer
carEquipAlarmBatteryNumber
;
@Value
(
"${equip.car.maxTravel}"
)
private
Double
carMaxTravel
;
@Autowired
@Lazy
private
IWlCarMileageService
iWlCarMileageService
;
...
...
@@ -1176,7 +1191,7 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
carInfoVo
.
setCategoryId
(
equipment
!=
null
?
equipment
.
getCategoryId
()
:
null
);
carInfoVo
.
setCategoryName
(
categoryMap
.
get
(
carInfoVo
.
getCategoryId
()));
carInfoVo
.
setName
(
car
.
getName
());
if
(
car
.
getImg
()
!=
null
){
if
(
car
.
getImg
()
!=
null
)
{
List
<
String
>
img
=
new
ArrayList
<>();
img
.
add
(
car
.
getImg
().
get
(
0
).
getUrl
());
...
...
@@ -1337,7 +1352,7 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
equipment
.
setEquipmentCategory
(
equipmentCategoryMapper
.
selectById
(
equipment
.
getCategoryId
()));
}
car
.
setEquipment
(
equipment
);
if
(
car
.
getCountry
()!=
null
)
{
if
(
car
.
getCountry
()
!=
null
)
{
car
.
setCountryName
(
iSystemDicService
.
getOne
(
new
QueryWrapper
<
SystemDic
>().
eq
(
"id"
,
car
.
getCountry
())).
getName
());
}
...
...
@@ -1351,8 +1366,7 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
List
<
Equipment
>
equipment1
=
iEquipmentService
.
listByCategoryId
(
equipment
.
getCategoryId
());
car
.
setUnit
(
equipment1
.
get
(
0
).
getUnit
());
car
.
setCategoryId
(
equipment
.
getCategoryId
());
if
(
car
.
getIsImport
()!=
null
)
{
if
(
car
.
getIsImport
()
!=
null
)
{
car
.
setImportStr
(
car
.
getIsImport
()
?
"进口"
:
"国产"
);
}
if
(!
ObjectUtils
.
isEmpty
(
car
.
getIotCode
()))
{
...
...
@@ -1363,8 +1377,7 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
.
orderByDesc
(
WlCarMileage:
:
getEndTime
).
last
(
"limit 1"
));
car
.
setSpeed
(
last
!=
null
?
last
.
getEndSpeed
()
:
null
);
//产品 和 设备 各8位
if
(
car
.
getIotCode
().
length
()>=
16
)
{
if
(
car
.
getIotCode
().
length
()
>=
16
)
{
car
.
setIotMeasurement
(
car
.
getIotCode
().
substring
(
0
,
8
));
car
.
setIotDeviceName
(
car
.
getIotCode
().
substring
(
8
,
car
.
getIotCode
().
length
()));
}
...
...
@@ -1501,8 +1514,8 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
}
@Override
public
List
<
CarDto
>
getTeamCarList
(
String
sequenceNbr
,
Long
id
,
Double
longitude
,
Double
latitude
)
{
List
<
CarDto
>
list
=
carMapper
.
getTeamCarList
(
sequenceNbr
,
id
,
carState
);
public
List
<
CarDto
>
getTeamCarList
(
String
sequenceNbr
,
Long
id
,
Double
longitude
,
Double
latitude
)
{
List
<
CarDto
>
list
=
carMapper
.
getTeamCarList
(
sequenceNbr
,
id
,
carState
);
if
(!
CollectionUtils
.
isEmpty
(
list
))
{
if
(
longitude
!=
null
&&
latitude
!=
null
)
{
List
<
Long
>
idList
=
list
.
stream
().
map
(
CarDto:
:
getSequenceNbr
).
collect
(
Collectors
.
toList
());
...
...
@@ -1672,7 +1685,7 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
}
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
...
...
@@ -1683,7 +1696,7 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
}
String
url
=
""
;
JSONObject
jsonObject
=
new
JSONObject
();
byte
[]
bytes
=
QRCodeUtil
.
generateQRCodeImageByteData
(
car
.
getQrCode
(),
200
);
byte
[]
bytes
=
QRCodeUtil
.
generateQRCodeImageByteData
(
car
.
getQrCode
(),
200
);
InputStream
inputStream
=
new
ByteArrayInputStream
(
bytes
);
try
{
MultipartFile
file
=
new
MockMultipartFile
(
car
.
getQrCode
()
+
".jpg"
,
car
.
getQrCode
()
+
".jpg"
,
...
...
@@ -1708,10 +1721,239 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
}
@Override
public
List
<
Car
>
location
()
{
List
<
Car
>
list
=
this
.
list
();
return
list
;
}
@Override
public
Map
<
String
,
Integer
>
getCountOfCar
()
{
Map
<
String
,
Integer
>
map
=
new
HashMap
<>();
map
.
put
(
"countofCar"
,
this
.
list
(
new
QueryWrapper
<
Car
>().
groupBy
(
"id"
)).
size
());
return
map
;
}
@Override
public
Map
<
String
,
Integer
>
getCountOfCarBelongCompany
()
{
Map
<
String
,
Integer
>
map
=
new
HashMap
<>();
map
.
put
(
"countofCompany"
,
this
.
list
(
new
QueryWrapper
<
Car
>().
groupBy
(
"biz_org_code"
)).
size
());
return
map
;
}
@Override
public
List
<
ChartIntegerDto
>
getCarCategoryInfo
()
{
List
<
ChartIntegerDto
>
list1
=
new
ArrayList
<>();
List
<
EquipmentCategory
>
list
=
equipmentCategoryMapper
.
selectList
(
new
QueryWrapper
<
EquipmentCategory
>().
isNotNull
(
"parent_id"
));
if
(
list
.
size
()
>
0
)
{
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
ChartIntegerDto
chartIntegerDto
=
new
ChartIntegerDto
();
Integer
count
=
carMapper
.
getCarCategoryCountByCategoryID
(
list
.
get
(
i
).
getId
());
chartIntegerDto
.
setName
(
list
.
get
(
i
).
getName
());
chartIntegerDto
.
setValue
(
count
);
list1
.
add
(
chartIntegerDto
);
}
}
return
list1
;
}
@Override
public
Page
<
CarEquipStateInfoDto
>
getCarEquipStateInfo
()
{
// BasicTableDataDto basicTableDataDto = new BasicTableDataDto();
// List<ColModel> colModels = new ArrayList<>();
// colModels.add(new ColModel("carNum","车牌号"));
// colModels.add(new ColModel("bizOrgName","所属单位"));
// colModels.add(new ColModel("equipState","设备状态"));
// colModels.add(new ColModel("extra2","设备电量"));
Page
<
CarEquipStateInfoDto
>
page
=
new
Page
<>();
List
<
CarEquipStateInfoDto
>
list
=
carMapper
.
getCarEquipStateInfo
();
if
(
list
.
size
()
>
0
)
{
list
.
forEach
(
carEquipStateInfoDto
->
{
if
(
carEquipStateInfoDto
.
getExtra2
()
!=
null
)
{
carEquipStateInfoDto
.
setEquipState
(
"开机"
);
carEquipStateInfoDto
.
setExtra2
(
carEquipStateInfoDto
.
getExtra2
()
+
"%"
);
}
else
{
carEquipStateInfoDto
.
setEquipState
(
"关机"
);
carEquipStateInfoDto
.
setExtra2
(
"未上报"
);
}
});
}
page
.
setRecords
(
list
);
page
.
setTotal
(
list
.
size
());
page
.
setCurrent
(
1
);
page
.
setSize
(
10
);
// page.setPagination(true);
// page.setTotal((list.size()/page.getPageSize()));
// basicTableDataDto.setDataGridMock(page);
// basicTableDataDto.setColModel(colModels);
return
page
;
}
@Override
public
Page
<
CarEquipAlarmInfoDto
>
getCarEquipAlarmInfoDto
()
{
Page
<
CarEquipAlarmInfoDto
>
page
=
new
Page
<>();
List
<
CarEquipAlarmInfoDto
>
list
=
carMapper
.
getCarEquipAlarmInfo
(
carEquipAlarmBatteryNumber
);
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
list
.
get
(
i
).
setNo
(
i
+
1
);
}
page
.
setRecords
(
list
);
page
.
setTotal
(
list
.
size
());
page
.
setCurrent
(
1
);
page
.
setSize
(
10
);
return
page
;
}
@Override
public
List
<
ChartIntegerDto
>
getCarBelongAreaInfo
()
{
List
<
ChartIntegerDto
>
list
=
new
ArrayList
<>();
FeignClientResult
<
java
.
util
.
Collection
<
CompanyModel
>>
de
=
Privilege
.
companyClient
.
queryAgencyTree
(
null
);
//如果是公司则获取所有片区
CompanyModel
[]
companyModelList
=
de
.
getResult
().
toArray
(
new
CompanyModel
[
0
]);
if
(
companyModelList
.
length
==
1
&&
companyModelList
[
0
].
getLevel
().
equals
(
"headquarter"
))
{
List
<
CompanyModel
>
companyModels
=
new
ArrayList
<
CompanyModel
>(
companyModelList
[
0
].
getChildren
());
for
(
int
i
=
0
;
i
<
companyModels
.
size
();
i
++)
{
ChartIntegerDto
chartIntegerDto
=
new
ChartIntegerDto
();
CompanyModel
companyModel1
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
companyModels
.
get
(
i
)),
CompanyModel
.
class
);
Integer
count
=
this
.
count
(
new
QueryWrapper
<
Car
>().
like
(
"biz_org_code"
,
companyModel1
.
getOrgCode
()));
chartIntegerDto
.
setName
(
companyModel1
.
getCompanyName
());
chartIntegerDto
.
setCompanyId
(
companyModel1
.
getSequenceNbr
());
chartIntegerDto
.
setValue
(
count
);
list
.
add
(
chartIntegerDto
);
}
}
return
list
;
}
@Override
public
Page
<
CarAreaInfoDto
>
getCarAreaInfo
(
Long
id
)
{
Page
<
CarAreaInfoDto
>
page
=
new
Page
<>();
List
<
CarAreaInfoDto
>
list
=
new
ArrayList
<>();
FeignClientResult
<
java
.
util
.
Collection
<
CompanyModel
>>
de
=
Privilege
.
companyClient
.
querySubAgencyTree
(
id
);
//如果是公司则获取所有片区
ArrayList
<
CompanyModel
>
companyModels
=
(
ArrayList
<
CompanyModel
>)
de
.
getResult
();
if
(
companyModels
.
size
()
>
0
)
{
for
(
int
i
=
0
;
i
<
companyModels
.
size
();
i
++)
{
CompanyModel
companyModel
=
companyModels
.
get
(
i
);
CarAreaInfoDto
carAreaInfoDto
=
new
CarAreaInfoDto
();
Integer
count
=
this
.
count
(
new
QueryWrapper
<
Car
>().
like
(
"biz_org_code"
,
companyModel
.
getOrgCode
()));
carAreaInfoDto
.
setNo
(
i
+
1
);
carAreaInfoDto
.
setName
(
companyModel
.
getCompanyName
());
carAreaInfoDto
.
setCountOfCar
(
count
);
list
.
add
(
carAreaInfoDto
);
}
}
page
.
setRecords
(
list
);
page
.
setTotal
(
list
.
size
());
page
.
setCurrent
(
1
);
page
.
setSize
(
10
);
return
page
;
}
@Override
public
Page
<
MileageDto
>
getCarMileageInfoByMoth
(
String
date
)
{
Page
<
MileageDto
>
page
=
new
Page
<>();
List
<
MileageDto
>
mileageDtoList
=
new
ArrayList
<>();
List
<
Car
>
list
=
this
.
list
();
if
(
list
.
size
()
>
0
)
{
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
MileageDto
mileageDto
=
new
MileageDto
();
Double
totalTravel
=
iWlCarMileageService
.
getTotalTravelByIotCodeAndDate
(
date
,
list
.
get
(
i
).
getIotCode
());
mileageDto
.
setCarNum
(
list
.
get
(
i
).
getCarNum
());
mileageDto
.
setCarCode
(
list
.
get
(
i
).
getCode
());
mileageDto
.
setIotCode
(
date
+
"::"
+
list
.
get
(
i
).
getIotCode
());
mileageDto
.
setTotal
(
carMaxTravel
+
"KM"
);
if
(
totalTravel
!=
null
)
{
mileageDto
.
setTotalTravel
((
totalTravel
/
carMaxTravel
)
*
100
);
}
else
{
mileageDto
.
setTotalTravel
(
0.0
);
}
mileageDtoList
.
add
(
mileageDto
);
}
}
page
.
setRecords
(
mileageDtoList
);
page
.
setTotal
(
mileageDtoList
.
size
());
page
.
setCurrent
(
1
);
page
.
setSize
(
10
);
return
page
;
}
@Override
public
List
<
CarExportDto
>
exportCarMileageInfoByMoth
(
String
date
)
{
List
<
CarExportDto
>
carExportDtos
=
new
ArrayList
<>();
List
<
Car
>
list
=
this
.
list
();
if
(
list
.
size
()
>
0
)
{
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
CarExportDto
carExportDto
=
new
CarExportDto
();
Double
totalTravel
=
iWlCarMileageService
.
getTotalTravelByIotCodeAndDate
(
date
,
list
.
get
(
i
).
getIotCode
());
Car
car
=
list
.
get
(
i
);
carExportDto
.
setCode
(
car
.
getCode
());
carExportDto
.
setCarNumber
(
car
.
getCarNum
());
carExportDto
.
setOrgName
(
car
.
getBizOrgName
());
carExportDto
.
setStandard
(
car
.
getStandard
());
carExportDto
.
setDisplacement
(
car
.
getDisplacement
());
if
(
totalTravel
!=
null
){
carExportDto
.
setTotalTravel
(
String
.
valueOf
(
totalTravel
));
}
else
{
carExportDto
.
setTotalTravel
(
"0"
);
}
carExportDtos
.
add
(
carExportDto
);
}
}
return
carExportDtos
;
}
@Override
public
ZZChartsDto
getCarMileageInfoByMothOFDay
(
String
iotCode
)
{
ZZChartsDto
zzChartsDto
=
new
ZZChartsDto
();
//X轴数据
List
<
String
>
x
=
new
ArrayList
<>();
// Y轴数据
List
<
Double
>
y
=
new
ArrayList
<>();
String
[]
datas
=
iotCode
.
split
(
"::"
);
TreeMap
<
String
,
Double
>
map
=
new
TreeMap
<>();
String
[]
dates
=
datas
[
0
].
split
(
"-"
);
Calendar
calendar
=
Calendar
.
getInstance
(
Locale
.
CHINA
);
calendar
.
set
(
Calendar
.
YEAR
,
Integer
.
parseInt
(
dates
[
0
]));
calendar
.
set
(
Calendar
.
MONTH
,
Integer
.
parseInt
(
dates
[
1
]));
for
(
int
i
=
0
;
i
<
calendar
.
getActualMaximum
(
Calendar
.
DATE
);
i
++)
{
String
dateStr
=
i
<
9
?
dates
[
1
]+
"-0"
+
(
i
+
1
)
:
dates
[
1
]
+
"-"
+
(
i
+
1
);
Double
totalTravel
=
iWlCarMileageService
.
getTotalTravelByIotCodeAndDate
(
dateStr
,
datas
[
1
]);
if
(
totalTravel
==
null
)
{
totalTravel
=
0.0
;
}
x
.
add
(
dateStr
);
y
.
add
(
totalTravel
);
}
zzChartsDto
.
setAxisData
(
x
);
zzChartsDto
.
setSeriesData
(
y
);
return
zzChartsDto
;
}
@Override
public
Page
<
CarExceptionDto
>
getCarExcepitonTrack
(
Integer
type
)
{
Page
<
CarExceptionDto
>
page
=
new
Page
<>();
List
<
CarExceptionDto
>
carExceptionDtos
=
new
ArrayList
<>();
LocalDate
localDate
=
LocalDate
.
now
(
ZoneId
.
of
(
"+8"
));
String
startDate
=
localDate
.
plusDays
(-
1
).
toString
();
String
endDate
=
localDate
.
plusDays
((
0
-
type
)).
toString
();
List
<
Car
>
list
=
this
.
list
();
if
(
list
.
size
()
>
0
)
{
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
CarExceptionDto
carExceptionDto
=
new
CarExceptionDto
();
Double
totalTravel
=
iWlCarMileageService
.
getTotalTravelByIotCodeAndDateProd
(
startDate
,
endDate
,
list
.
get
(
i
).
getIotCode
());
if
(!(
totalTravel
!=
null
&&
totalTravel
>
0.0
))
{
carExceptionDto
.
setCarId
(
String
.
valueOf
(
list
.
get
(
i
).
getId
()));
carExceptionDto
.
setCarNumber
(
list
.
get
(
i
).
getCarNum
());
carExceptionDto
.
setBelongStation
(
list
.
get
(
i
).
getBizOrgName
());
carExceptionDtos
.
add
(
carExceptionDto
);
}
}
}
page
.
setRecords
(
carExceptionDtos
);
page
.
setTotal
(
carExceptionDtos
.
size
());
page
.
setCurrent
(
1
);
page
.
setSize
(
10
);
return
page
;
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/WlCarMileageServiceImpl.java
View file @
9bc23146
...
...
@@ -391,7 +391,6 @@ public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlC
return
integer
<=
0
;
}
private
String
getAddress
(
double
longitude
,
double
lantitude
)
{
StringBuilder
api
=
new
StringBuilder
(
GUIDE_ADDRESS_URL
);
api
.
append
(
"key="
).
append
(
GUIDE_KEY
).
append
(
"&location="
).
append
(
longitude
).
append
(
","
).
append
(
lantitude
)
...
...
@@ -430,4 +429,13 @@ public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlC
}
return
res
.
toString
();
}
@Override
public
Double
getTotalTravelByIotCodeAndDate
(
String
date
,
String
iotCode
)
{
return
this
.
baseMapper
.
getTotalTravelByIotCodeAndDate
(
date
,
iotCode
);
}
@Override
public
Double
getTotalTravelByIotCodeAndDateProd
(
String
startDate
,
String
endDate
,
String
iotCode
)
{
return
this
.
baseMapper
.
getTotalTravelByIotCodeAndDateProd
(
startDate
,
endDate
,
iotCode
);
}
}
amos-boot-system-equip/src/main/resources/application-dev.properties
View file @
9bc23146
spring.datasource.driver-class-name
=
com.mysql.cj.jdbc.Driver
spring.datasource.url
=
jdbc:mysql://172.16.10.2
15:3307/dl_business_v3.0.1.3
?useUnicode=true&allowMultiQueries=true&characterEncoding=utf-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai
spring.datasource.url
=
jdbc:mysql://172.16.10.2
20:3306/equipment
?useUnicode=true&allowMultiQueries=true&characterEncoding=utf-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai
spring.datasource.username
=
root
spring.datasource.password
=
Yeejoin@2020
spring.datasource.type
=
com.zaxxer.hikari.HikariDataSource
...
...
@@ -14,13 +14,13 @@ spring.datasource.hikari.connection-test-query= SELECT 1
# \u6587\u4EF6\u670D\u52A1\u5668\u5730\u5740
fileserver_domain
=
http://172.16.10.2
15
:9000/
fileserver_domain
=
http://172.16.10.2
20
:9000/
#eureka.instance.ip-address= 172.16.3.135
eureka.instance.hostname
=
172.16.10.2
15
eureka.instance.hostname
=
172.16.10.2
20
eureka.instance.prefer-ip-address
=
true
eureka.client.serviceUrl.defaultZone
=
http://${spring.security.user.name}:${spring.security.user.password}@172.16.10.2
15
:10001/eureka/
eureka.client.serviceUrl.defaultZone
=
http://${spring.security.user.name}:${spring.security.user.password}@172.16.10.2
20
:10001/eureka/
spring.security.user.name
=
admin
spring.security.user.password
=
a1234560
security.productApp
=
STUDIO_APP_MOBILE
...
...
@@ -35,7 +35,7 @@ amos.system.user.product=STUDIO_APP_WEB
spring.redis.database
=
1
spring.redis.host
=
172.16.10.2
15
spring.redis.host
=
172.16.10.2
20
spring.redis.port
=
6379
spring.redis.password
=
yeejoin@2020
spring.redis.lettuce.pool.max-active
=
200
...
...
@@ -47,10 +47,10 @@ spring.redis.expire.time=30000
## emqx
emqx.clean-session
=
true
emqx.client-id
=
${spring.application.name}-${random.int[1024,65536]}
emqx.broker
=
tcp://172.16.10.2
15
:1883
emqx.broker
=
tcp://172.16.10.2
20
:1883
emqx.user-name
=
admin
emqx.password
=
public
mqtt.scene.host
=
mqtt://172.16.10.2
15
:8083/mqtt
mqtt.scene.host
=
mqtt://172.16.10.2
20
:8083/mqtt
mqtt.client.product.id
=
mqtt
mqtt.topic
=
topic_mqtt
spring.mqtt.completionTimeout
=
3000
...
...
@@ -135,4 +135,8 @@ water.level.indexKey=FHS_FirePoolDevice_WaterLevel,FHS_LevelDetector_WaterLevel,
mileage.parameter
=
0.5
# 江西电建-车辆里程跨天记录切分(每日0点执行)
mileage.segmentation.cron
=
0 0 0 * * ?
mileage.clippingtime
=
600000
\ No newline at end of file
mileage.clippingtime
=
600000
equip.car.alarmBattery
=
10
equip.car.maxTravel
=
400
equip.risk.model.topic
=
""
#
mileage.segmentation.cron
=
0 */2 * * * ?
\ No newline at end of file
amos-boot-system-equip/src/main/resources/application.properties
View file @
9bc23146
...
...
@@ -80,8 +80,7 @@ equip.message.create.topic=emq.risk.created
# \u4E2D\u5FC3\u7EA7\u76D1\u542C\u4E3B\u9898
equip.center.risk.topic
=
equip/risk/trigger
patrol.center.risk.topic
=
patrol/risk/trigger
# \u4E2D\u5FC3\u7EA7\u53D1\u9001\u81F3\u98CE\u9669\u670D\u52A1\u6D88\u606F\u683C\u5F0F
equip.risk.model.topic
=
equip/data/analysis
# \u4E2D\u5FC3\u7EA7\u53D1\u9001\u81F3\u98CE\u9669\u670D\u52A1\u6D88\u606F\u683C\u5
# \u63A5\u53E3\u5730\u5740
equip.scene.detail.url
=
${server.servlet.context-path}/scene/%s/detail/list
...
...
amos-boot-system-equip/src/main/resources/mapper/CarMapper.xml
View file @
9bc23146
...
...
@@ -97,53 +97,53 @@
</select>
<select
id=
"selectEquipmentOnCarAppList"
resultMap=
"EquipmentOnCarAppList"
>
select * from (
select
car_id,
wed.equipment_id,
wed.name,
wes.qr_code AS code,
wed.standard,
wed.brand,
wed.maintenance_cycle
FROM
wl_equipment_on_car wleo
LEFT JOIN wl_equipment_detail wed ON wleo.equipment_detail_id = wed.id
LEFT JOIN wl_equipment_specific wes ON wleo.equipment_specific_id = wes.id
union
all
select
car_id,
wed.equipment_id,
wed.name,
wsd.qr_code AS code,
wed.standard,
wed.brand,
wed.maintenance_cycle from
wl_extinguishant_on_car as wlex
left join
wl_equipment_detail wed ON wlex.equipment_detail_id = wed.id
left join
wl_stock_detail wsd ON wlex.stock_detail_id = wsd.id
) as dat
where car_id=#{carId} and name IS NOT NULL
</select>
select * from (
select
car_id,
wed.equipment_id,
wed.name,
wes.qr_code AS code,
wed.standard,
wed.brand,
wed.maintenance_cycle
FROM
wl_equipment_on_car wleo
LEFT JOIN wl_equipment_detail wed ON wleo.equipment_detail_id = wed.id
LEFT JOIN wl_equipment_specific wes ON wleo.equipment_specific_id = wes.id
union
all
select
car_id,
wed.equipment_id,
wed.name,
wsd.qr_code AS code,
wed.standard,
wed.brand,
wed.maintenance_cycle from
wl_extinguishant_on_car as wlex
left join
wl_equipment_detail wed ON wlex.equipment_detail_id = wed.id
left join
wl_stock_detail wsd ON wlex.stock_detail_id = wsd.id
) as dat
where car_id=#{carId} and name IS NOT NULL
</select>
<select
id=
"getCarIndexs"
resultMap=
"carIotInfoMap"
>
SELECT
c.id,
c.name,
ei.NAME AS perfQuotaName,
ei.name_key,
cp.value,
ei.unit AS unitName,
ei.group_name,
c.iot_code,
c.qr_code AS qrCode
FROM
wl_car_property cp
LEFT JOIN wl_equipment_index ei ON ei.id = cp.equipment_index_id
LEFT JOIN wl_car c ON c.id = cp.car_id
WHERE
cp.car_id = #{carId}
</select>
SELECT
c.id,
c.name,
ei.NAME AS perfQuotaName,
ei.name_key,
cp.value,
ei.unit AS unitName,
ei.group_name,
c.iot_code,
c.qr_code AS qrCode
FROM
wl_car_property cp
LEFT JOIN wl_equipment_index ei ON ei.id = cp.equipment_index_id
LEFT JOIN wl_car c ON c.id = cp.car_id
WHERE
cp.car_id = #{carId}
</select>
<select
id=
"getCarsIotInfo"
resultMap=
"carIotInfoMap"
>
SELECT
c.id,
...
...
@@ -173,58 +173,58 @@
ORDER BY c.id
</select>
<select
id=
"getCarsIotInfoByIotCode"
resultMap=
"carIotInfoMap"
>
SELECT
c.id,
c.name,
c.car_num,
ei.NAME AS perfQuotaName,
ei.name_key,
cp.value,
ei.unit AS unitName,
ei.group_name,
c.iot_code AS iotCode,
c.qr_code AS qrCode
FROM
wl_car c,
wl_car_property cp,
wl_equipment_index ei
WHERE
c.id = cp.car_id
AND cp.equipment_index_id = ei.id
AND c.iot_code = #{iotCode}
ORDER BY c.id
</select>
SELECT
c.id,
c.name,
c.car_num,
ei.NAME AS perfQuotaName,
ei.name_key,
cp.value,
ei.unit AS unitName,
ei.group_name,
c.iot_code AS iotCode,
c.qr_code AS qrCode
FROM
wl_car c,
wl_car_property cp,
wl_equipment_index ei
WHERE
c.id = cp.car_id
AND cp.equipment_index_id = ei.id
AND c.iot_code = #{iotCode}
ORDER BY c.id
</select>
<select
id=
"getCarEquipmentStateByCarId"
resultType=
"com.yeejoin.equipmanage.common.vo.EquipStateOnCarVo"
>
SELECT
d.`name` AS equipName,
es.qr_code AS code,
es.iot_code AS iotCode,
es.code AS equipCode
FROM
wl_equipment_on_car oc,
wl_equipment_detail d,
wl_equipment_specific es
WHERE
oc.equipment_specific_id = es.id
AND es.equipment_detail_id = d.id
AND oc.car_id = #{id}
GROUP BY es.id
UNION ALL
SELECT
d.`name` AS equipName,
es.qr_code AS code,
es.iot_code AS iotCode,
es.code AS equipCode
FROM
wl_extinguishant_on_car weoc,
wl_equipment_detail d,
wl_equipment_specific es
WHERE
es.equipment_detail_id = d.id
AND weoc.equipment_detail_id = d.id
AND weoc.car_id = #{id}
GROUP BY es.id
</select>
SELECT
d.`name` AS equipName,
es.qr_code AS code,
es.iot_code AS iotCode,
es.code AS equipCode
FROM
wl_equipment_on_car oc,
wl_equipment_detail d,
wl_equipment_specific es
WHERE
oc.equipment_specific_id = es.id
AND es.equipment_detail_id = d.id
AND oc.car_id = #{id}
GROUP BY es.id
UNION ALL
SELECT
d.`name` AS equipName,
es.qr_code AS code,
es.iot_code AS iotCode,
es.code AS equipCode
FROM
wl_extinguishant_on_car weoc,
wl_equipment_detail d,
wl_equipment_specific es
WHERE
es.equipment_detail_id = d.id
AND weoc.equipment_detail_id = d.id
AND weoc.car_id = #{id}
GROUP BY es.id
</select>
<select
id=
"getIotCodeList"
resultType=
"String"
>
SELECT
iot_code
...
...
@@ -238,27 +238,27 @@
AND iot_code IS NOT NULL
</select>
<select
id=
"getCarsByIotCode"
resultType=
"com.yeejoin.equipmanage.common.entity.Car"
>
SELECT
wc.car_num
FROM
wl_car wc
WHERE
wc.iot_code IS NOT NULL
AND
wc.iot_code = #{iotCode}
</select>
<select
id=
"getCarsByIotCodeExcludeCarId"
resultType=
"com.yeejoin.equipmanage.common.entity.Car"
>
SELECT
wc.car_num
FROM
wl_car wc
WHERE
wc.iot_code IS NOT NULL
AND
wc.iot_code = #{iotCode}
AND wc.id != #{carId}
</select>
SELECT
wc.car_num
FROM
wl_car wc
WHERE
wc.iot_code IS NOT NULL
AND
wc.iot_code = #{iotCode}
</select>
<select
id=
"getCarsByIotCodeExcludeCarId"
resultType=
"com.yeejoin.equipmanage.common.entity.Car"
>
SELECT
wc.car_num
FROM
wl_car wc
WHERE
wc.iot_code IS NOT NULL
AND
wc.iot_code = #{iotCode}
AND wc.id != #{carId}
</select>
<select
id=
"getCarsInfoByOrgCode"
resultMap=
"carIotInfoMap"
>
...
...
@@ -297,8 +297,8 @@
WHERE TRIM(wc.iot_code) != '' AND wc.iot_code IS NOT NULL AND wei.is_iot=1
</select>
<select
id=
"getUtilName"
resultType=
"String"
>
select name from wl_unit where id = #{id}
</select>
select name from wl_unit where id = #{id}
</select>
<select
id=
"getFireVehicleDetailById"
resultType=
"com.yeejoin.equipmanage.common.datasync.entity.FireVehicle"
>
SELECT
c.id,
...
...
@@ -339,56 +339,56 @@
<select
id=
"getCarNumGroupByTeamId"
resultType=
"map"
>
SELECT
team_id AS teamId,
COUNT(id) AS carNum
team_id AS teamId,
COUNT(id) AS carNum
FROM
wl_car
wl_car
where
team_id is not null
team_id is not null
GROUP BY
team_id
ORDER BY
create_date DESC
team_id
ORDER BY
create_date DESC
</select>
<select
id=
"getTeamCarList"
resultType=
"com.yeejoin.equipmanage.common.entity.dto.CarDto"
>
SELECT
c.team_id,
c.team_name,
c.id AS sequenceNbr,
c.`name`,
c.car_num,
d.`name` AS car_state,
4 AS personNum,
c.iot_code,
0 AS distance
FROM
wl_car c
LEFT JOIN wl_system_dic d ON c.car_state = d.`code`
<where>
c.team_id IS NOT NULL
<if
test=
"id != null"
>
AND c.team_id = #{id}
</if>
<if
test=
"carState != null and carState != ''"
>
AND d.type = #{carState}
</if>
<if
test=
"sequenceNbr != null and sequenceNbr != ''"
>
AND c.id = #{sequenceNbr}
</if>
c.team_id,
c.team_name,
c.id AS sequenceNbr,
c.`name`,
c.car_num,
d.`name` AS car_state,
4 AS personNum,
c.iot_code,
0 AS distance
FROM
wl_car c
LEFT JOIN wl_system_dic d ON c.car_state = d.`code`
<where>
c.team_id IS NOT NULL
<if
test=
"id != null"
>
AND c.team_id = #{id}
</if>
<if
test=
"carState != null and carState != ''"
>
AND d.type = #{carState}
</if>
<if
test=
"sequenceNbr != null and sequenceNbr != ''"
>
AND c.id = #{sequenceNbr}
</if>
</where>
</select>
<select
id=
"getCarPropertyList"
resultType=
"com.yeejoin.equipmanage.common.entity.vo.CarPropertyVo"
>
SELECT
c.id AS carId,
i.`name`,
i.name_key,
p.`value`,
i.unit,
i.is_iot
c.id AS carId,
i.`name`,
i.name_key,
p.`value`,
i.unit,
i.is_iot
FROM
wl_car c
LEFT JOIN wl_car_property p ON p.car_id = c.id
LEFT JOIN wl_equipment_index i ON i.id = p.equipment_index_id
wl_car c
LEFT JOIN wl_car_property p ON p.car_id = c.id
LEFT JOIN wl_equipment_index i ON i.id = p.equipment_index_id
<where>
<if
test=
"idList != null and idList.size() > 0"
>
c.id IN
...
...
@@ -417,174 +417,171 @@
</select>
<select
id=
"getCarResourceMapList"
resultType=
"map"
>
SELECT
*
*
FROM
(
SELECT
eqCar.car_id carId,
eqCar.equipment_detail_id equipId,
eqDetail.NAME equipName,
"equipment" equipType,
sum( eqCar.amount ) equipCount
FROM
wl_equipment_on_car eqCar
LEFT JOIN wl_equipment_detail eqDetail ON eqDetail.id = eqCar.equipment_detail_id
WHERE
eqCar.car_id IS NOT NULL
GROUP BY
eqCar.car_id,
eqCar.equipment_detail_id
) t
(
SELECT
eqCar.car_id carId,
eqCar.equipment_detail_id equipId,
eqDetail.NAME equipName,
"equipment" equipType,
sum( eqCar.amount ) equipCount
FROM
wl_equipment_on_car eqCar
LEFT JOIN wl_equipment_detail eqDetail ON eqDetail.id = eqCar.equipment_detail_id
WHERE
1 = 1
<if
test=
"carId != null and carId != ''"
>
AND t.carId = #{carId}
</if>
eqCar.car_id IS NOT NULL
GROUP BY
eqCar.car_id,
eqCar.equipment_detail_id
) t
WHERE
1 = 1
<if
test=
"carId != null and carId != ''"
>
AND t.carId = #{carId}
</if>
UNION ALL
SELECT
*
*
FROM
(
SELECT
eqCar.car_id carId,
eqCar.equipment_detail_id equipId,
eqDetail.NAME equipName,
"fireAgent" equipType,
sum( eqCar.amount ) equipCount
FROM
(
SELECT
eqCar.car_id carId,
eqCar.equipment_detail_id equipId,
eqDetail.NAME equipName,
"fireAgent" equipType,
sum( eqCar.amount ) equipCount
FROM
wl_extinguishant_on_car eqCar
LEFT JOIN wl_equipment_detail eqDetail ON eqDetail.id = eqCar.equipment_detail_id
WHERE
eqCar.car_id IS NOT NULL
GROUP BY
eqCar.car_id,
eqCar.equipment_detail_id
) t
wl_extinguishant_on_car eqCar
LEFT JOIN wl_equipment_detail eqDetail ON eqDetail.id = eqCar.equipment_detail_id
WHERE
eqCar.car_id IS NOT NULL
GROUP BY
eqCar.car_id,
eqCar.equipment_detail_id
) t
WHERE
1 = 1
1 = 1
<if
test=
"carId != null and carId != ''"
>
AND t.carId = #{carId}
</if>
</select>
<select
id=
"getCarStateInfoByCarNum"
resultType=
"map"
>
SELECT
car.id,
car.`name` as carType,
car.car_num as carNum,
(
SELECT
(
CASE
WHEN (
DATEDIFF(CURDATE(), carm.update_date)
<![CDATA[<=]]>
7
) THEN
'待命'
ELSE
'异常'
END
)
FROM
wl_car_property carm
LEFT JOIN wl_equipment_index ei ON ei.id = carm.equipment_index_id
WHERE
ei.name_key = 'FireCar_Start'
AND carm.car_id = car.id
) as 'status',
(
SELECT
(
CASE
WHEN carm.
VALUE
= 'true' THEN
'启动'
ELSE
'停止'
END
)
FROM
wl_car_property carm
LEFT JOIN wl_equipment_index ei ON ei.id = carm.equipment_index_id
WHERE
ei.name_key = 'FireCar_Start'
AND carm.car_id = car.id
) AS startup,
(
SELECT
DATE_FORMAT(
carm.update_date,
"%Y-%m-%d %H:%i:%s"
)
FROM
wl_car_property carm
LEFT JOIN wl_equipment_index ei ON ei.id = carm.equipment_index_id
WHERE
ei.name_key = 'FireCar_Start'
AND carm.car_id = car.id
) AS startdate,
(
SELECT
(
CASE
WHEN carm.`value` IS NULL THEN
'异常'
ELSE
'正常'
END
)
FROM
wl_car_property carm
LEFT JOIN wl_equipment_index ei ON ei.id = carm.equipment_index_id
WHERE
(
ei.name_key = 'FireCar_GDLatitude'
OR ei.name_key = 'FireCar_GDLongitude'
)
AND carm.car_id = car.id
LIMIT 1
) AS locationStatus,
mi.`name` manufacturer,
sd.`name` as country,
car.brand,
car.standard,
car.chassis_brand as chassisBrand,
csd.`name` as chassisCountry,
(CASE WHEN car.ccc_auth = TRUE THEN '是' ELSE '否' END) as cccAuth,
(CASE WHEN car.is_import = TRUE THEN '进口' ELSE '国产' END) as isImport
FROM
wl_car AS car
LEFT JOIN wl_manufacturer_info mi ON mi.id = car.manufacturer_id
LEFT JOIN wl_system_dic sd ON sd.id = car.country
LEFT JOIN wl_system_dic csd ON csd.id = car.chassis_country
WHERE car.car_num = #{carNum}
SELECT
car.id,
car.`name` as carType,
car.car_num as carNum,
(
SELECT
(
CASE
WHEN (
DATEDIFF(CURDATE(), carm.update_date)
<![CDATA[<=]]>
7
) THEN
'待命'
ELSE
'异常'
END
)
FROM
wl_car_property carm
LEFT JOIN wl_equipment_index ei ON ei.id = carm.equipment_index_id
WHERE
ei.name_key = 'FireCar_Start'
AND carm.car_id = car.id
) as 'status',
(
SELECT
(
CASE
WHEN carm.
VALUE
= 'true' THEN
'启动'
ELSE
'停止'
END
)
FROM
wl_car_property carm
LEFT JOIN wl_equipment_index ei ON ei.id = carm.equipment_index_id
WHERE
ei.name_key = 'FireCar_Start'
AND carm.car_id = car.id
) AS startup,
(
SELECT
DATE_FORMAT(
carm.update_date,
"%Y-%m-%d %H:%i:%s"
)
FROM
wl_car_property carm
LEFT JOIN wl_equipment_index ei ON ei.id = carm.equipment_index_id
WHERE
ei.name_key = 'FireCar_Start'
AND carm.car_id = car.id
) AS startdate,
(
SELECT
(
CASE
WHEN carm.`value` IS NULL THEN
'异常'
ELSE
'正常'
END
)
FROM
wl_car_property carm
LEFT JOIN wl_equipment_index ei ON ei.id = carm.equipment_index_id
WHERE
(
ei.name_key = 'FireCar_GDLatitude'
OR ei.name_key = 'FireCar_GDLongitude'
)
AND carm.car_id = car.id
LIMIT 1
) AS locationStatus,
mi.`name` manufacturer,
sd.`name` as country,
car.brand,
car.standard,
car.chassis_brand as chassisBrand,
csd.`name` as chassisCountry,
(CASE WHEN car.ccc_auth = TRUE THEN '是' ELSE '否' END) as cccAuth,
(CASE WHEN car.is_import = TRUE THEN '进口' ELSE '国产' END) as isImport
FROM
wl_car AS car
LEFT JOIN wl_manufacturer_info mi ON mi.id = car.manufacturer_id
LEFT JOIN wl_system_dic sd ON sd.id = car.country
LEFT JOIN wl_system_dic csd ON csd.id = car.chassis_country
WHERE car.car_num = #{carNum}
</select>
<select
id=
"equipmentCarList"
resultType=
"com.yeejoin.equipmanage.common.entity.Car"
>
select
* from wl_car c LEFT JOIN wl_equipment w
on c.equipment_id=w.id
select
* from wl_car c LEFT JOIN wl_equipment w
on c.equipment_id=w.id
where c.car_state in ('1','2')
<if
test=
"teamId != null"
>
and
c.team_id=#{teamId}
and c.team_id=#{teamId}
</if>
<if
test=
"name != null"
>
and
c.name LIKE CONCAT('%',#{name},'%' )
and c.name LIKE CONCAT('%',#{name},'%' )
</if>
<if
test=
"code != null"
>
and
w.`code` like CONCAT(#{code},'%' )
and w.`code` like CONCAT(#{code},'%' )
</if>
<if
test=
"id != null"
>
<if
test=
"isNo != null and isNo"
>
and
c.id =#{id}
and c.id =#{id}
</if>
<if
test=
"isNo != null and !isNo"
>
and
c.id !=#{id}
and c.id !=#{id}
</if>
</if>
...
...
@@ -593,20 +590,20 @@
</select>
<select
id=
"equipmentCarListcount"
resultType=
"int"
>
select
count(c.id) from wl_car c LEFT JOIN wl_equipment w
on c.equipment_id=w.id
select
count(c.id) from wl_car c LEFT JOIN wl_equipment w
on c.equipment_id=w.id
where c.car_state in ('1','2')
<if
test=
"teamId != null"
>
and
c.team_id=#{teamId}
and c.team_id=#{teamId}
</if>
<if
test=
"name != null"
>
and
c.name LIKE CONCAT('%',#{name},'%' )
and c.name LIKE CONCAT('%',#{name},'%' )
</if>
<if
test=
"code != null"
>
and
w.`code` like CONCAT(#{code},'%' )
and w.`code` like CONCAT(#{code},'%' )
</if>
<if
test=
"id != null"
>
and
c.id =#{id}
and c.id =#{id}
</if>
</select>
...
...
@@ -652,27 +649,26 @@
</select>
<select
id=
"queryCompanyIotStaData"
resultType=
"java.util.Map"
>
--
SELECT
--
s.biz_org_code as bizOrgCode,
--
c.code as categoryCode,
--
count(1) as total
--
FROM
--
`wl_car` s,
--
wl_equipment e,
--
wl_equipment_category c
--
where
--
e.is_iot=1
-- and
s.equipment_id = e.`id`
--
and e.category_id = c.id
--
and s.biz_org_code is not null
--
GROUP BY s.biz_org_code ,c.code
--
--
UNION
--
SELECT
--
s.biz_org_code as bizOrgCode,
--
c.code as categoryCode,
--
count(1) as total
--
FROM
--
`wl_car` s,
--
wl_equipment e,
--
wl_equipment_category c
--
where
--
e.is_iot=1
-- and
s.equipment_id = e.`id`
--
and e.category_id = c.id
--
and s.biz_org_code is not null
--
GROUP BY s.biz_org_code ,c.code
--
--
UNION
SELECT
SELECT
s.biz_org_code as bizOrgCode,
c.code as categoryCode,
count(1) as total
...
...
@@ -682,7 +678,7 @@
wl_equipment_category c
where
e.is_iot=1
and
s.equipment_code = e.`code`
and s.equipment_code = e.`code`
and e.category_id = c.id
and s.biz_org_code is not null
GROUP BY s.biz_org_code ,c.code
...
...
@@ -690,16 +686,31 @@
<select
id=
"getCarState"
resultType=
"Map"
>
SELECT
*
*
FROM
v_fire_firecar_num
v_fire_firecar_num
</select>
<select
id=
"getFirePowerInfo"
resultType=
"Map"
>
SELECT
department_name departmentName,
total,
on_duty onDuty
department_name departmentName,
total,
on_duty onDuty
FROM
v_duty_person
v_duty_person
</select>
<select
id=
"getCarCategoryCountByCategoryID"
resultType=
"Integer"
>
SELECT count(1) count
FROM `wl_car` LEFT JOIN wl_equipment
on wl_car.equipment_id = wl_equipment.id
WHERE wl_equipment.category_id = #{categoryID}
</select>
<select
id=
"getCarEquipStateInfo"
resultType=
"com.yeejoin.equipmanage.common.entity.dto.CarEquipStateInfoDto"
>
SELECT car_num carNum,biz_org_name bizOrgName,extra2
FROM `wl_car`
</select>
<select
id=
"getCarEquipAlarmInfo"
resultType=
"com.yeejoin.equipmanage.common.entity.dto.CarEquipAlarmInfoDto"
>
SELECT car_num carNum,extra2
FROM `wl_car`
where extra2
<
#{batteryNumber}
</select>
</mapper>
amos-boot-system-equip/src/main/resources/mapper/WlCarMileageMapper.xml
View file @
9bc23146
...
...
@@ -54,4 +54,19 @@
AND wcm.start_time IS NOT NULL
AND wcm.end_time IS NULL
</select>
<select
id =
"getTotalTravelByIotCodeAndDate"
resultType=
"Double"
>
SELECT SUM(travel)
FROM wl_car_mileage
WHERE date LIKE concat('%',#{date},'%')
AND
iot_code = #{iotCode}
</select>
<select
id =
"getTotalTravelByIotCodeAndDateProd"
resultType=
"Double"
>
SELECT SUM(travel)
FROM wl_car_mileage
WHERE date
<
= #{startDate} AND date
>
= #{endDate}
AND
iot_code = #{iotCode}
</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