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
53f18771
Commit
53f18771
authored
Sep 08, 2023
by
刘林
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/develop_dl' into develop_dl
parents
9157ffd3
7d5825e3
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
297 additions
and
51 deletions
+297
-51
EquipQrDateDto.java
...yeejoin/equipmanage/common/entity/dto/EquipQrDateDto.java
+29
-0
CalculationRulesEnum.java
...eejoin/equipmanage/common/enums/CalculationRulesEnum.java
+51
-0
OrgUsrServiceImpl.java
...oot/module/common/biz/service/impl/OrgUsrServiceImpl.java
+4
-1
UpdateQrCodeAction.java
...va/com/yeejoin/equipmanage/action/UpdateQrCodeAction.java
+102
-0
CarIotNewListener.java
...a/com/yeejoin/equipmanage/listener/CarIotNewListener.java
+1
-0
CarPropertyMapper.java
...ava/com/yeejoin/equipmanage/mapper/CarPropertyMapper.java
+1
-1
CarPropertyJob.java
...n/java/com/yeejoin/equipmanage/quartz/CarPropertyJob.java
+19
-2
ICarService.java
...ain/java/com/yeejoin/equipmanage/service/ICarService.java
+6
-1
CarServiceImpl.java
.../com/yeejoin/equipmanage/service/impl/CarServiceImpl.java
+4
-6
IFireResourceSupervisionServiceImpl.java
...age/service/impl/IFireResourceSupervisionServiceImpl.java
+3
-3
WlCarMileageServiceImpl.java
...oin/equipmanage/service/impl/WlCarMileageServiceImpl.java
+21
-8
ThreadCarMileageTreatment.java
...yeejoin/equipmanage/thread/ThreadCarMileageTreatment.java
+18
-18
PlanTaskServiceImpl.java
...mos/patrol/business/service/impl/PlanTaskServiceImpl.java
+17
-4
CarPropertyMapper.xml
...tem-equip/src/main/resources/mapper/CarPropertyMapper.xml
+4
-3
FireFightingSystemMapper.xml
...ip/src/main/resources/mapper/FireFightingSystemMapper.xml
+3
-4
dbTemplate_plan_task.xml
...rol/src/main/resources/db/mapper/dbTemplate_plan_task.xml
+14
-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/EquipQrDateDto.java
0 → 100644
View file @
53f18771
package
com
.
yeejoin
.
equipmanage
.
common
.
entity
.
dto
;
import
lombok.Data
;
import
java.util.List
;
import
java.util.Map
;
/**
* @author DELL
*/
@Data
public
class
EquipQrDateDto
{
/**
* 类型
*/
private
String
type
;
/**
* 对比属性
*/
private
String
contrast
;
/**
* 需要赋码判断的数据
*/
private
List
<
Map
<
String
,
String
>>
data
;
}
amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/enums/CalculationRulesEnum.java
0 → 100644
View file @
53f18771
package
com
.
yeejoin
.
equipmanage
.
common
.
enums
;
/**
* 赋码计算规则
* @author DELL
*/
public
enum
CalculationRulesEnum
{
EQ
(
"eq"
,
"等于"
),
NE
(
"ne"
,
"不等于"
),
GT
(
"gt"
,
"大于"
),
GE
(
"ge"
,
"大于等于"
),
LT
(
"lt"
,
"小于"
),
LE
(
"le"
,
"小于等于"
);
private
String
code
;
private
String
type
;
CalculationRulesEnum
(
String
code
,
String
type
)
{
this
.
code
=
code
;
this
.
type
=
type
;
}
public
String
getCode
()
{
return
code
;
}
public
void
setCode
(
String
code
)
{
this
.
code
=
code
;
}
public
String
getType
()
{
return
type
;
}
public
void
setType
(
String
type
)
{
this
.
type
=
type
;
}
public
static
CalculationRulesEnum
getEnum
(
String
code
)
{
CalculationRulesEnum
calculationRulesEnum
=
null
;
for
(
CalculationRulesEnum
type:
CalculationRulesEnum
.
values
())
{
if
(
type
.
getCode
().
equals
(
code
))
{
calculationRulesEnum
=
type
;
break
;
}
}
return
calculationRulesEnum
;
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-common-biz/src/main/java/com/yeejoin/amos/boot/module/common/biz/service/impl/OrgUsrServiceImpl.java
View file @
53f18771
...
...
@@ -3260,6 +3260,9 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
public
PeopleInfoDto
selectPeopleByIdNoAuth
(
Long
id
)
{
PeopleBasicInfoDto
peopleBasicInfoDto
=
new
PeopleBasicInfoDto
();
OrgUsr
orgUsr
=
this
.
baseMapper
.
selectById
(
id
);
QueryWrapper
<
OrgUsr
>
queryWrapper2
=
new
QueryWrapper
<>();
queryWrapper2
.
eq
(
"sequenceNbr"
,
orgUsr
.
getParentId
());
OrgUsr
orgUsrParent
=
this
.
baseMapper
.
selectOne
(
queryWrapper2
);
// 动态表单数据
List
<
FormValue
>
formValues
=
getFormValue
(
id
);
...
...
@@ -3297,7 +3300,7 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
peopleBasicInfoDto
.
setSequenceNbr
(
orgUsr
.
getSequenceNbr
().
toString
());
peopleBasicInfoDto
.
setCompany
(
orgUsr
.
getParentId
());
peopleBasicInfoDto
.
setBizOrgName
(
orgUsr
.
getParentName
());
peopleBasicInfoDto
.
setBizOrgCode
(
orgUsr
.
getBizOrgCode
());
peopleBasicInfoDto
.
setBizOrgCode
(
orgUsr
Parent
.
getBizOrgCode
());
peopleBasicInfoDto
.
setCompanyCode
(
orgUsr
.
getParentId
());
peopleBasicInfoDto
.
setCompanyName
(
orgUsr
.
getParentName
());
peopleBasicInfoDto
.
setPersonStatus
(
orgUsr
.
getPersonStatus
());
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/action/UpdateQrCodeAction.java
0 → 100644
View file @
53f18771
package
com
.
yeejoin
.
equipmanage
.
action
;
import
com.alibaba.fastjson.JSONObject
;
import
com.google.gson.JsonObject
;
import
com.yeejoin.amos.component.rule.MethodParam
;
import
com.yeejoin.amos.component.rule.RuleActionBean
;
import
com.yeejoin.amos.component.rule.RuleMethod
;
import
com.yeejoin.equipmanage.common.entity.dto.EquipQrDateDto
;
import
com.yeejoin.equipmanage.common.enums.CalculationRulesEnum
;
import
com.yeejoin.equipmanage.common.utils.DateUtils
;
import
com.yeejoin.equipmanage.service.ICarService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.CollectionUtils
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.stream.Collectors
;
/**
* 赋码动作
* @author DELL
*/
@Component
@RuleActionBean
(
beanLabel
=
"动态预案"
)
@Slf4j
public
class
UpdateQrCodeAction
{
@Autowired
private
ICarService
carService
;
private
final
String
CAR_ID
=
"carId"
;
@RuleMethod
(
methodLabel
=
"更新码"
,
project
=
"车辆更新码颜色"
)
public
void
updateCarQrCode
(
@MethodParam
(
paramLabel
=
"判断值"
)
String
value
,
@MethodParam
(
paramLabel
=
"赋码颜色"
)
String
color
,
@MethodParam
(
paramLabel
=
"判断对象"
)
Object
equipQrDateDto
,
@MethodParam
(
paramLabel
=
"是否启用"
)
Boolean
enable
,
@MethodParam
(
paramLabel
=
"计算规则"
)
String
rule
)
{
if
(
Boolean
.
TRUE
.
equals
(
enable
))
{
EquipQrDateDto
equipQrDateDtoN
=
JSONObject
.
parseObject
(
equipQrDateDto
.
toString
(),
EquipQrDateDto
.
class
);
List
<
Map
<
String
,
String
>>
data
=
equipQrDateDtoN
.
getData
();
String
contrast
=
equipQrDateDtoN
.
getContrast
();
if
(!
CollectionUtils
.
isEmpty
(
data
))
{
List
<
String
>
collect
=
data
.
stream
().
map
(
map
->
{
try
{
String
carId
=
null
;
String
s
=
map
.
get
(
contrast
).
replace
(
"T"
,
" "
);
Date
date
=
DateUtils
.
longStr2Date
(
s
);
int
i
=
DateUtils
.
dateBetween
(
date
,
new
Date
());
CalculationRulesEnum
anEnum
=
CalculationRulesEnum
.
getEnum
(
rule
);
switch
(
anEnum
)
{
case
EQ:
if
(
i
==
Integer
.
parseInt
(
value
))
{
carId
=
String
.
valueOf
(
map
.
get
(
CAR_ID
));
}
break
;
case
GT:
if
(
i
>
Integer
.
parseInt
(
value
))
{
carId
=
String
.
valueOf
(
map
.
get
(
CAR_ID
));
}
break
;
case
GE:
if
(
i
>=
Integer
.
parseInt
(
value
))
{
carId
=
String
.
valueOf
(
map
.
get
(
CAR_ID
));
}
break
;
case
LE:
if
(
i
<=
Integer
.
parseInt
(
value
))
{
carId
=
String
.
valueOf
(
map
.
get
(
CAR_ID
));
}
break
;
case
LT:
if
(
i
<
Integer
.
parseInt
(
value
))
{
carId
=
String
.
valueOf
(
map
.
get
(
CAR_ID
));
}
break
;
case
NE:
if
(
i
!=
Integer
.
parseInt
(
value
))
{
carId
=
String
.
valueOf
(
map
.
get
(
CAR_ID
));
}
break
;
default
:
break
;
}
return
carId
;
}
catch
(
ParseException
e
)
{
log
.
error
(
"日期转换失败"
);
e
.
printStackTrace
();
return
null
;
}
}).
filter
(
Objects:
:
nonNull
).
collect
(
Collectors
.
toList
());
carService
.
updateCarQrCode
(
collect
,
color
);
}
}
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/listener/CarIotNewListener.java
View file @
53f18771
...
...
@@ -119,6 +119,7 @@ public class CarIotNewListener extends EmqxListener {
deviceInfo
.
get
(
iotCode
).
interrupt
();
deviceInfo
.
remove
(
iotCode
);
}
catch
(
Exception
e
)
{
deviceInfo
.
remove
(
iotCode
);
}
logger
.
info
(
"topic---------------------"
+
topic
+
"开启计时线程"
);
ThreadCar
threadCar
=
new
ThreadCar
(
topic
,
jsonObject
,
this
.
iWlCarMileageService
,
this
.
iotFeign
,
this
.
iCarService
,
clipping_time
);
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/mapper/CarPropertyMapper.java
View file @
53f18771
...
...
@@ -37,6 +37,6 @@ public interface CarPropertyMapper extends BaseMapper<CarProperty> {
Map
<
String
,
Object
>
getCarPropertyByCarIds
(
List
<
Long
>
carIds
);
List
<
Map
<
String
,
Object
>>
selectIndexByTime
(
String
carStartIndexKey
);
List
<
Map
<
String
,
String
>>
selectIndexByTime
(
String
carStartIndexKey
);
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/quartz/CarPropertyJob.java
View file @
53f18771
package
com
.
yeejoin
.
equipmanage
.
quartz
;
import
com.yeejoin.amos.component.rule.RuleTrigger
;
import
com.yeejoin.equipmanage.common.entity.dto.EquipQrDateDto
;
import
com.yeejoin.equipmanage.service.ICarService
;
import
com.yeejoin.equipmanage.service.impl.CarServiceImpl
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -8,6 +10,9 @@ import org.springframework.scheduling.annotation.EnableScheduling;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Component
;
import
java.util.List
;
import
java.util.Map
;
/**
* 定时监控车辆相关指标
* @author xxz
...
...
@@ -20,13 +25,25 @@ public class CarPropertyJob {
@Autowired
private
ICarService
carService
;
@Autowired
private
RuleTrigger
ruleTrigger
;
/**
* 车辆赋红码。定时查询车辆启停更新时间,
*/
@Scheduled
(
cron
=
"${update.car.qrCode}"
)
public
void
UpdateCarQrCode
(){
public
void
UpdateCarQrCode
()
{
carService
.
updateCarStartStatus
();
List
<
Map
<
String
,
String
>>
list
=
carService
.
updateCarStartStatus
();
EquipQrDateDto
equipQrDateDto
=
new
EquipQrDateDto
();
equipQrDateDto
.
setContrast
(
"updateDate"
);
equipQrDateDto
.
setType
(
"car"
);
equipQrDateDto
.
setData
(
list
);
try
{
ruleTrigger
.
publish
(
equipQrDateDto
,
"中心配置赋码规则/update-qr-code"
,
null
);
}
catch
(
Exception
e
)
{
log
.
error
(
"调用规则失败: {}"
,
e
.
getMessage
());
}
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/ICarService.java
View file @
53f18771
...
...
@@ -211,7 +211,12 @@ public interface ICarService extends IService<Car> {
/**
* 查询车辆启动状态,赋码
*/
void
updateCarStartStatus
();
List
<
Map
<
String
,
String
>>
updateCarStartStatus
();
/**
* 赋码
*/
void
updateCarQrCode
(
List
<
String
>
carIds
,
String
status
);
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/CarServiceImpl.java
View file @
53f18771
...
...
@@ -1969,14 +1969,12 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
}
@Override
public
void
updateCarStartStatus
()
{
List
<
Map
<
String
,
Object
>>
list
=
carPropertyMapper
.
selectIndexByTime
(
CAR_START_INDEX_KEY
);
List
<
String
>
carIds
=
list
.
stream
().
map
(
o
->
String
.
valueOf
(
o
.
get
(
"carId"
))).
collect
(
Collectors
.
toList
());
// 近七天未启动赋红码
updateCarQrCode
(
carIds
,
"2"
);
public
List
<
Map
<
String
,
String
>>
updateCarStartStatus
()
{
return
carPropertyMapper
.
selectIndexByTime
(
CAR_START_INDEX_KEY
);
}
private
void
updateCarQrCode
(
List
<
String
>
carIds
,
String
status
)
{
@Override
public
void
updateCarQrCode
(
List
<
String
>
carIds
,
String
status
)
{
carMapper
.
updateStatusByIds
(
carIds
,
status
);
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/IFireResourceSupervisionServiceImpl.java
View file @
53f18771
...
...
@@ -52,9 +52,9 @@ public class IFireResourceSupervisionServiceImpl implements IFireResourceSupervi
private
FireResourceStatsDTO
buildFireResourceStatsDTO
(
Map
<
String
,
Object
>
resultMap
)
{
FireResourceStatsDTO
fireResourceStats
=
new
FireResourceStatsDTO
();
fireResourceStats
.
setTotalCounts
(
(
long
)
resultMap
.
get
(
"totalCount"
));
fireResourceStats
.
setYellowCounts
(
(
long
)
resultMap
.
get
(
"yellowCodeCount"
)
);
fireResourceStats
.
setRedCounts
(
(
long
)
resultMap
.
get
(
"redCodeCount"
));
fireResourceStats
.
setTotalCounts
(
Long
.
valueOf
(
resultMap
.
get
(
"totalCount"
).
toString
()
));
fireResourceStats
.
setYellowCounts
(
Long
.
valueOf
(
resultMap
.
get
(
"yellowCodeCount"
).
toString
())
);
fireResourceStats
.
setRedCounts
(
Long
.
valueOf
(
resultMap
.
get
(
"redCodeCount"
).
toString
()
));
long
expCount
=
fireResourceStats
.
getYellowCounts
()
+
fireResourceStats
.
getRedCounts
();
double
abnormalRatio
=
0
;
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/WlCarMileageServiceImpl.java
View file @
53f18771
...
...
@@ -3,7 +3,6 @@ package com.yeejoin.equipmanage.service.impl;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
...
...
@@ -27,8 +26,10 @@ import org.springframework.scheduling.annotation.EnableAsync;
import
org.springframework.scheduling.annotation.EnableScheduling
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Service
;
import
org.typroject.tyboot.component.emq.EmqKeeper
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
javax.annotation.Resource
;
import
java.io.BufferedReader
;
import
java.io.IOException
;
import
java.io.InputStreamReader
;
...
...
@@ -66,6 +67,9 @@ public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlC
@Value
(
"${mileage.parameter}"
)
private
Double
mileageParameter
;
@Resource
private
EmqKeeper
emqKeeper
;
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
HttpUtil
.
class
);
private
final
String
GUIDE_KEY
=
"813684495d9a3981dd2c7694916fe404"
;
...
...
@@ -89,7 +93,7 @@ public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlC
double
speed
=
0
;
WlCarMileage
wlCarMileage
=
this
.
getById
(
id
);
String
iotCode
=
wlCarMileage
.
getIotCode
();
String
measurement
=
"0THMcLKR"
;
String
measurement
=
iotCode
.
substring
(
0
,
8
)
;
String
deviceName
=
iotCode
.
replace
(
measurement
,
""
);
// 由于iot存在毫秒故结束时间要+1秒 iot+1秒有bug还是查不到 +2秒
ResponseModel
<
List
<
Object
>>
result
=
iotFeign
.
getLiveData
(
measurement
,
deviceName
,
wlCarMileage
.
getStartTime
(),
...
...
@@ -337,9 +341,8 @@ public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlC
double
startLongitude
=
lastObj
.
getDoubleValue
(
"FireCar_Longitude"
);
double
startLatitude
=
lastObj
.
getDoubleValue
(
"FireCar_Latitude"
);
// 当前速度
double
v
=
Double
.
parseDouble
(
String
.
valueOf
(
lastObj
.
get
(
"FireCar_Speed"
)));
int
ceil
=
(
int
)
Math
.
ceil
(
v
);
item
.
setStartSpeed
(
ceil
);
Double
v
=
Double
.
parseDouble
(
String
.
valueOf
(
lastObj
.
get
(
"FireCar_Speed"
)));
item
.
setStartSpeed
(
v
.
intValue
());
double
travel
=
0.0
;
// 获取里程
for
(
int
i
=
0
;
i
<
filterList
.
size
()
-
1
;
i
++)
{
...
...
@@ -354,7 +357,7 @@ public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlC
// 里程耗时
long
takeTime
=
(
date
.
getTime
())
-
(
item
.
getStartTime
().
getTime
());
// 修改0点未结束里程记录
item
.
setEndSpeed
(
ceil
);
item
.
setEndSpeed
(
v
.
intValue
()
);
item
.
setEndTime
(
date
);
item
.
setEndLatitude
(
startLatitude
);
item
.
setEndLongitude
(
startLongitude
);
...
...
@@ -374,12 +377,22 @@ public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlC
item
.
setEndName
(
null
);
item
.
setTravel
(
null
);
item
.
setTakeTime
(
null
);
item
.
setStartSpeed
(
ceil
);
item
.
setStartSpeed
(
v
.
intValue
()
);
item
.
setStartTime
(
item
.
getDate
());
item
.
setStartLongitude
(
startLongitude
);
item
.
setStartLatitude
(
startLatitude
);
this
.
baseMapper
.
insert
(
item
);
HashMap
<
String
,
String
>
messageMap
=
new
HashMap
<>();
messageMap
.
put
(
"FireCar_Latitude"
,
String
.
valueOf
(
startLatitude
));
messageMap
.
put
(
"FireCar_Longitude"
,
String
.
valueOf
(
startLongitude
));
messageMap
.
put
(
"FireCar_Speed"
,
String
.
valueOf
(
v
.
intValue
()));
messageMap
.
put
(
"time"
,
String
.
valueOf
(
item
.
getDate
().
getTime
()));
messageMap
.
put
(
"name"
,
"轨迹切分消息!!!"
);
log
.
info
(
"-----------新增开始里程成功:::"
+
JSONObject
.
toJSONString
(
item
)+
"-----------------"
);
try
{
emqKeeper
.
getMqttClient
().
publish
(
item
.
getIotCode
().
substring
(
0
,
8
)+
"/"
+
item
.
getIotCode
().
substring
(
8
)+
"/property"
,
JSON
.
toJSON
(
messageMap
).
toString
().
getBytes
(
"UTF-8"
),
1
,
false
);
}
catch
(
Exception
e
)
{
}
//根据iotcode获取车辆并且同步经纬度到车辆
Car
car
=
iCarService
.
getOne
(
new
QueryWrapper
<
Car
>().
eq
(
"iot_code"
,
item
.
getIotCode
()));
car
.
setLongitude
(
startLongitude
);
...
...
@@ -390,7 +403,7 @@ public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlC
});
log
.
info
(
"轨迹切分任务执行完成.............."
);
log
.
info
(
"-------------------对于切割完成的数据进行倒计时操作----------------------------------"
);
ThreadCarMileageTreatment
threadCarMileageTreatment
=
new
ThreadCarMileageTreatment
();
ThreadCarMileageTreatment
threadCarMileageTreatment
=
new
ThreadCarMileageTreatment
(
this
,
iCarService
,
iotFeign
);
log
.
info
(
"-------------------对于切割完成的数据进行倒计时开始----------------------------------"
);
threadCarMileageTreatment
.
start
();
log
.
info
(
"-------------------对于切割完成的数据进行倒计时结束----------------------------------"
);
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/thread/ThreadCarMileageTreatment.java
View file @
53f18771
...
...
@@ -8,19 +8,14 @@ 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.ICarService
;
import
com.yeejoin.equipmanage.service.IWlCarMileageService
;
import
com.yeejoin.equipmanage.service.impl.CarServiceImpl
;
import
com.yeejoin.equipmanage.service.impl.WlCarMileageServiceImpl
;
import
com.yeejoin.equipmanage.utils.CarUtils
;
import
liquibase.pro.packaged.E
;
import
org.jfree.util.Log
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.ObjectUtils
;
import
org.typroject.tyboot.component.emq.EmqKeeper
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
java.math.BigDecimal
;
...
...
@@ -28,20 +23,21 @@ import java.util.ArrayList;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
@Component
public
class
ThreadCarMileageTreatment
extends
Thread
{
Logger
logger
=
LoggerFactory
.
getLogger
(
ThreadCarMileageTreatment
.
class
);
@Autowired
private
WlCarMileageServiceImpl
wlCarMileageServiceImpl
;
@Autowired
CarServiceImpl
carServiceImpl
;
@Autowired
private
IotFeign
iotFeign
;
private
final
WlCarMileageServiceImpl
wlCarMileageServiceImpl
;
private
final
ICarService
iCarService
;
private
final
IotFeign
iotFeign
;
@Value
(
"${mileage.clippingtime}"
)
private
Long
clipping_time
;
public
ThreadCarMileageTreatment
(
WlCarMileageServiceImpl
wlCarMileageServiceImpl
,
ICarService
iCarService
,
IotFeign
iotFeign
)
{
this
.
wlCarMileageServiceImpl
=
wlCarMileageServiceImpl
;
this
.
iCarService
=
iCarService
;
this
.
iotFeign
=
iotFeign
;
}
@Override
public
void
run
()
{
logger
.
info
(
"----------------------------------------------------开始处理未结束里程---------------------------------"
);
...
...
@@ -52,19 +48,21 @@ public class ThreadCarMileageTreatment extends Thread {
Car
car
=
null
;
List
<
WlCarMileage
>
wlCarMileageList
=
wlCarMileageServiceImpl
.
list
(
new
QueryWrapper
<
WlCarMileage
>().
isNull
(
"end_time"
));
for
(
int
i
=
0
;
i
<
wlCarMileageList
.
size
();
i
++)
{
car
=
carServiceImpl
.
getOne
(
new
QueryWrapper
<
Car
>().
eq
(
"iot_code"
,
wlCarMileageList
.
get
(
i
).
getIotCode
()));
car
=
iCarService
.
getOne
(
new
QueryWrapper
<
Car
>().
eq
(
"iot_code"
,
wlCarMileageList
.
get
(
i
).
getIotCode
()));
String
coordinateSting
=
String
.
valueOf
(
car
.
getLongitude
())
+
String
.
valueOf
(
car
.
getLatitude
());
hashMap
.
put
(
car
.
getIotCode
(),
coordinateSting
);
}
logger
.
info
(
"----------------获取到的未处理的车辆坐标信息::"
+
JSONObject
.
toJSONString
(
hashMap
));
try
{
Thread
.
sleep
(
clipping_time
);
for
(
int
i
=
0
;
i
<
wlCarMileageList
.
size
();
i
++)
{
WlCarMileage
wlCarMileage
=
wlCarMileageList
.
get
(
i
);
car
=
carServiceImpl
.
getOne
(
new
QueryWrapper
<
Car
>().
eq
(
"iot_code"
,
wlCarMileage
.
getIotCode
()));
car
=
iCarService
.
getOne
(
new
QueryWrapper
<
Car
>().
eq
(
"iot_code"
,
wlCarMileage
.
getIotCode
()));
String
coordinateSting
=
String
.
valueOf
(
car
.
getLongitude
())
+
String
.
valueOf
(
car
.
getLatitude
());
if
(
coordinateSting
.
equals
(
hashMap
.
get
(
car
.
getIotCode
())))
{
//增加对于无效坐标的兼容处理,由于无效坐标的存储精度不一样 可能会导致0的位数发生差异从而到时无法判断生效
if
(
coordinateSting
.
equals
(
hashMap
.
get
(
car
.
getIotCode
()))||(
handlerUnActiveCoodinate
(
coordinateSting
).
equals
(
handlerUnActiveCoodinate
(
hashMap
.
get
(
car
.
getIotCode
())))))
{
String
iotCode
=
car
.
getIotCode
();
String
measurement
=
"0THMcLKR"
;
String
measurement
=
iotCode
.
substring
(
0
,
8
)
;
String
deviceName
=
iotCode
.
replace
(
measurement
,
""
);
last
=
wlCarMileageServiceImpl
.
getOne
(
new
LambdaQueryWrapper
<
WlCarMileage
>().
eq
(
WlCarMileage:
:
getIotCode
,
iotCode
)
...
...
@@ -139,6 +137,8 @@ public class ThreadCarMileageTreatment extends Thread {
wlCarMileageServiceImpl
.
updateById
(
last
);
}
}
public
String
handlerUnActiveCoodinate
(
String
coodeinateString
){
return
coodeinateString
.
replace
(
"0"
,
""
).
replace
(
"."
,
""
);
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-patrol-biz/src/main/java/com/yeejoin/amos/patrol/business/service/impl/PlanTaskServiceImpl.java
View file @
53f18771
...
...
@@ -2038,6 +2038,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
int
xcdw
=
0
;
int
hgdw
=
0
;
int
lcdw
=
0
;
int
zxcdw
=
0
;
for
(
Map
<
String
,
Object
>
map
:
statics
)
{
if
(
map
.
get
(
"code"
).
equals
(
"xfxcjrljxcdw"
))
{
...
...
@@ -2049,6 +2050,9 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
if
(
map
.
get
(
"code"
).
equals
(
"xfxcjrlcdw"
))
{
lcdw
=
Integer
.
parseInt
(
map
.
get
(
"value"
).
toString
());
}
if
(
map
.
get
(
"code"
).
equals
(
"xfxcjrzxcdw"
))
{
zxcdw
=
Integer
.
parseInt
(
map
.
get
(
"value"
).
toString
());
}
}
if
(
xcdw
==
0
)
{
for
(
Map
<
String
,
Object
>
map
:
statics
...
...
@@ -2056,6 +2060,18 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
if
(
map
.
get
(
"code"
).
equals
(
"xfxchgzb"
))
{
map
.
put
(
"value"
,
"0"
);
}
}
}
else
{
for
(
Map
<
String
,
Object
>
map
:
statics
)
{
if
(
map
.
get
(
"code"
).
equals
(
"xfxchgzb"
))
{
map
.
put
(
"value"
,
String
.
valueOf
((((
double
)
hgdw
/
(
double
)
xcdw
))
*
100
));
}
}
}
if
(
zxcdw
==
0
)
{
for
(
Map
<
String
,
Object
>
map
:
statics
)
{
if
(
map
.
get
(
"code"
).
equals
(
"xfxclcl"
))
{
map
.
put
(
"value"
,
"0"
);
}
...
...
@@ -2063,11 +2079,8 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
}
else
{
for
(
Map
<
String
,
Object
>
map
:
statics
)
{
if
(
map
.
get
(
"code"
).
equals
(
"xfxchgzb"
))
{
map
.
put
(
"value"
,(
hgdw
/
xcdw
)*
100
);
}
if
(
map
.
get
(
"code"
).
equals
(
"xfxclcl"
))
{
map
.
put
(
"value"
,
(
lcdw
/
xcdw
)*
100
);
map
.
put
(
"value"
,
String
.
valueOf
((((
double
)
lcdw
/
(
double
)
zxcdw
))*
100
)
);
}
}
}
...
...
amos-boot-system-equip/src/main/resources/mapper/CarPropertyMapper.xml
View file @
53f18771
...
...
@@ -100,12 +100,13 @@
<select
id=
"selectIndexByTime"
resultType=
"map"
>
SELECT
car_id carId
car_id carId,
update_date updateDate
FROM
wl_car_property
WHERE
equipment_index_key = #{carStartIndexKey} AND `value` IS NOT NULL
AND
DATE_SUB(CURDATE( ), INTERVAL 7 DAY ) > update_date
equipment_index_key = #{carStartIndexKey} AND `value` IS NOT NULL
-- AND
DATE_SUB(CURDATE( ), INTERVAL 7 DAY ) > update_date
</select>
</mapper>
amos-boot-system-equip/src/main/resources/mapper/FireFightingSystemMapper.xml
View file @
53f18771
...
...
@@ -5967,8 +5967,8 @@
<select
id=
"selectCarStats"
resultType=
"java.util.Map"
>
SELECT
COUNT(*) AS totalCount,
0
AS yellowCodeCount,
0
AS redCodeCount
SUM(CASE WHEN wc.equip_status = 1 then 1 else 0 end )
AS yellowCodeCount,
SUM(CASE WHEN wc.equip_status = 2 then 1 else 0 end )
AS redCodeCount
FROM
wl_car wc
LEFT JOIN wl_equipment wle ON wle.id = wc.equipment_id
...
...
@@ -6063,9 +6063,8 @@
LEFT JOIN wl_equipment_detail AS det ON spe.equipment_detail_id = det.id
LEFT JOIN wl_equipment AS wle ON wle.id = det.equipment_id
LEFT JOIN wl_equipment_category cate ON cate.id = wle.category_id
LEFT JOIN wl_stock_detail AS wlsd on wlsd.equipment_detail_id = det.id
WHERE
find_in_set(#{systemId},spe.system_id) and spe.single = true
and wlsd.`status` = 1
find_in_set(#{systemId},spe.system_id) and spe.single = true
ORDER BY
spe.equip_status desc
</select>
...
...
amos-boot-system-patrol/src/main/resources/db/mapper/dbTemplate_plan_task.xml
View file @
53f18771
...
...
@@ -1359,6 +1359,20 @@
<select
id=
"getStatics"
resultType=
"java.util.Map"
>
SELECT
'0' AS `key`,
ifnull( sum( `p_plan_task`.`point_num` ), 0 ) AS `value`,
'' AS unit,
'今日总巡查点位' AS `name`,
'xfxcjrzxcdw' AS code
FROM
`p_plan_task`
WHERE
DATE_FORMAT( check_date, '%Y-%m-%d' ) = CURRENT_DATE ()
<if
test=
"bizOrgCode != null and bizOrgCode != ''"
>
AND org_code LIKE CONCAT(#{bizOrgCode}, '%')
</if>
UNION ALL
SELECT
'1' AS `key`,
ifnull( sum( `p_plan_task`.`finish_num` ), 0 ) AS `value`,
'' AS unit,
...
...
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