Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
clx-performance
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
姜武杰
clx-performance
Commits
059a78d0
提交
059a78d0
authored
6月 04, 2024
作者:
艾庆国
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
线路预警
上级
25ad987c
显示空白字符变更
内嵌
并排
正在显示
20 个修改的文件
包含
314 行增加
和
43 行删除
+314
-43
LineWarnConfigEnum.java
...om/clx/performance/enums/linewarn/LineWarnConfigEnum.java
+1
-1
LineWarnConfigAddParam.java
...performance/param/pc/linewarn/LineWarnConfigAddParam.java
+2
-0
LineWarnConfigUpdateParam.java
...formance/param/pc/linewarn/LineWarnConfigUpdateParam.java
+2
-1
LineWarnConfigVO.java
.../com/clx/performance/vo/pc/linewarn/LineWarnConfigVO.java
+2
-0
LineWarnConfigController.java
...ance/controller/pc/linewarn/LineWarnConfigController.java
+18
-5
TempLineWarnController.java
...x/performance/controller/temp/TempLineWarnController.java
+38
-0
InternalReportService.java
...clx/performance/extranal/order/InternalReportService.java
+12
-0
InternalReportServiceImpl.java
...rmance/extranal/order/impl/InternalReportServiceImpl.java
+40
-0
LineWarnConfig.java
...va/com/clx/performance/model/linewarn/LineWarnConfig.java
+1
-0
LineWarnOrderGoods.java
...om/clx/performance/model/linewarn/LineWarnOrderGoods.java
+1
-0
LineWarnCongestionWarnServiceImpl.java
...vice/impl/linewarn/LineWarnCongestionWarnServiceImpl.java
+70
-0
LineWarnJamWarnServiceImpl.java
...nce/service/impl/linewarn/LineWarnJamWarnServiceImpl.java
+0
-16
LineWarnLineWarnServiceImpl.java
...ce/service/impl/linewarn/LineWarnLineWarnServiceImpl.java
+54
-1
LineWarnMqHandlerServiceImpl.java
...e/service/impl/linewarn/LineWarnMqHandlerServiceImpl.java
+15
-12
LineWarnMqServiceImpl.java
...formance/service/impl/linewarn/LineWarnMqServiceImpl.java
+7
-3
LineWarnWeatherWarnServiceImpl.java
...service/impl/linewarn/LineWarnWeatherWarnServiceImpl.java
+45
-0
LineWarnCongestionWarnService.java
...mance/service/linewarn/LineWarnCongestionWarnService.java
+2
-2
LineWarnLineWarnService.java
...performance/service/linewarn/LineWarnLineWarnService.java
+1
-1
LineWarnMqHandlerService.java
...erformance/service/linewarn/LineWarnMqHandlerService.java
+1
-0
LineWarnMqService.java
...m/clx/performance/service/linewarn/LineWarnMqService.java
+2
-1
没有找到文件。
performance-api/src/main/java/com/clx/performance/enums/linewarn/LineWarnConfigEnum.java
浏览文件 @
059a78d0
...
@@ -15,8 +15,8 @@ public enum LineWarnConfigEnum {
...
@@ -15,8 +15,8 @@ public enum LineWarnConfigEnum {
TAKE
(
1
,
"接单预警"
),
TAKE
(
1
,
"接单预警"
),
LOAD
(
2
,
"装车预警"
),
LOAD
(
2
,
"装车预警"
),
UNLOAD
(
3
,
"卸车预警"
),
UNLOAD
(
3
,
"卸车预警"
),
JAM
(
4
,
"拥堵预警 "
),
CONGESTION
(
4
,
"拥堵预警"
),
WEATHER
(
5
,
"天气预警"
),
WEATHER
(
5
,
"天气预警"
),
CHILD_ABNORMAL
(
6
,
"运单异常"
),
CHILD_ABNORMAL
(
6
,
"运单异常"
),
LINE_ABNORMAL
(
7
,
"线路异常"
),
LINE_ABNORMAL
(
7
,
"线路异常"
),
...
...
performance-api/src/main/java/com/clx/performance/param/pc/linewarn/LineWarnConfigAddParam.java
浏览文件 @
059a78d0
...
@@ -31,5 +31,7 @@ public class LineWarnConfigAddParam {
...
@@ -31,5 +31,7 @@ public class LineWarnConfigAddParam {
private
BigDecimal
timeRatio
;
private
BigDecimal
timeRatio
;
@ApiModelProperty
(
value
=
"任务完成占比"
,
example
=
"1.3"
)
@ApiModelProperty
(
value
=
"任务完成占比"
,
example
=
"1.3"
)
private
BigDecimal
taskCompleteRatio
;
private
BigDecimal
taskCompleteRatio
;
@ApiModelProperty
(
value
=
"交通增加时间(分钟)"
,
example
=
"1"
)
private
Integer
congestionTime
;
}
}
performance-api/src/main/java/com/clx/performance/param/pc/linewarn/LineWarnConfigUpdateParam.java
浏览文件 @
059a78d0
...
@@ -35,5 +35,6 @@ public class LineWarnConfigUpdateParam {
...
@@ -35,5 +35,6 @@ public class LineWarnConfigUpdateParam {
private
BigDecimal
timeRatio
;
private
BigDecimal
timeRatio
;
@ApiModelProperty
(
value
=
"任务完成占比"
,
example
=
"1.3"
)
@ApiModelProperty
(
value
=
"任务完成占比"
,
example
=
"1.3"
)
private
BigDecimal
taskCompleteRatio
;
private
BigDecimal
taskCompleteRatio
;
@ApiModelProperty
(
value
=
"交通增加时间(分钟)"
,
example
=
"1"
)
private
Integer
congestionTime
;
}
}
performance-api/src/main/java/com/clx/performance/vo/pc/linewarn/LineWarnConfigVO.java
浏览文件 @
059a78d0
...
@@ -49,6 +49,8 @@ public class LineWarnConfigVO {
...
@@ -49,6 +49,8 @@ public class LineWarnConfigVO {
private
BigDecimal
timeRatio
;
private
BigDecimal
timeRatio
;
@ApiModelProperty
(
value
=
"任务完成占比"
,
example
=
"1.3"
)
@ApiModelProperty
(
value
=
"任务完成占比"
,
example
=
"1.3"
)
private
BigDecimal
taskCompleteRatio
;
private
BigDecimal
taskCompleteRatio
;
@ApiModelProperty
(
value
=
"交通增加时间(分钟)"
,
example
=
"1"
)
private
Integer
congestionTime
;
@ApiModelProperty
(
value
=
"状态:1启用 2禁用"
,
example
=
"1"
)
@ApiModelProperty
(
value
=
"状态:1启用 2禁用"
,
example
=
"1"
)
private
Integer
status
;
private
Integer
status
;
...
...
performance-web/src/main/java/com/clx/performance/controller/pc/linewarn/LineWarnConfigController.java
浏览文件 @
059a78d0
...
@@ -40,8 +40,15 @@ public class LineWarnConfigController {
...
@@ -40,8 +40,15 @@ public class LineWarnConfigController {
||
Objects
.
equals
(
param
.
getWarnType
(),
LineWarnConfigEnum
.
WarnType
.
LOAD
.
getCode
())
||
Objects
.
equals
(
param
.
getWarnType
(),
LineWarnConfigEnum
.
WarnType
.
LOAD
.
getCode
())
||
Objects
.
equals
(
param
.
getWarnType
(),
LineWarnConfigEnum
.
WarnType
.
UNLOAD
.
getCode
())
||
Objects
.
equals
(
param
.
getWarnType
(),
LineWarnConfigEnum
.
WarnType
.
UNLOAD
.
getCode
())
){
){
if
(
Objects
.
isNull
(
param
.
getTimeRatio
())){
throw
new
ServiceSystemException
(
ResultCodeEnum
.
ILLEGAL_PARAMETER
,
"时间占比不能为空"
);}
if
(
Objects
.
isNull
(
param
.
getTimeRatio
())){
if
(
Objects
.
isNull
(
param
.
getTaskCompleteRatio
())){
throw
new
ServiceSystemException
(
ResultCodeEnum
.
ILLEGAL_PARAMETER
,
"任务完成占比不能为空"
);}
throw
new
ServiceSystemException
(
ResultCodeEnum
.
ILLEGAL_PARAMETER
,
"时间占比不能为空"
);}
if
(
Objects
.
isNull
(
param
.
getTaskCompleteRatio
())){
throw
new
ServiceSystemException
(
ResultCodeEnum
.
ILLEGAL_PARAMETER
,
"任务完成占比不能为空"
);}
}
if
(
Objects
.
equals
(
param
.
getWarnType
(),
LineWarnConfigEnum
.
WarnType
.
CONGESTION
.
getCode
())
){
if
(
Objects
.
isNull
(
param
.
getCongestionTime
())){
throw
new
ServiceSystemException
(
ResultCodeEnum
.
ILLEGAL_PARAMETER
,
"交通增加时间不能为空"
);}
}
}
lineWarnConfigService
.
saveConfig
(
param
);
lineWarnConfigService
.
saveConfig
(
param
);
...
@@ -56,10 +63,16 @@ public class LineWarnConfigController {
...
@@ -56,10 +63,16 @@ public class LineWarnConfigController {
||
Objects
.
equals
(
param
.
getWarnType
(),
LineWarnConfigEnum
.
WarnType
.
LOAD
.
getCode
())
||
Objects
.
equals
(
param
.
getWarnType
(),
LineWarnConfigEnum
.
WarnType
.
LOAD
.
getCode
())
||
Objects
.
equals
(
param
.
getWarnType
(),
LineWarnConfigEnum
.
WarnType
.
UNLOAD
.
getCode
())
||
Objects
.
equals
(
param
.
getWarnType
(),
LineWarnConfigEnum
.
WarnType
.
UNLOAD
.
getCode
())
){
){
if
(
Objects
.
isNull
(
param
.
getTimeRatio
())){
throw
new
ServiceSystemException
(
ResultCodeEnum
.
ILLEGAL_PARAMETER
,
"时间占比不能为空"
);}
if
(
Objects
.
isNull
(
param
.
getTimeRatio
())){
if
(
Objects
.
isNull
(
param
.
getTaskCompleteRatio
())){
throw
new
ServiceSystemException
(
ResultCodeEnum
.
ILLEGAL_PARAMETER
,
"任务完成占比不能为空"
);}
throw
new
ServiceSystemException
(
ResultCodeEnum
.
ILLEGAL_PARAMETER
,
"时间占比不能为空"
);}
if
(
Objects
.
isNull
(
param
.
getTaskCompleteRatio
())){
throw
new
ServiceSystemException
(
ResultCodeEnum
.
ILLEGAL_PARAMETER
,
"任务完成占比不能为空"
);}
}
if
(
Objects
.
equals
(
param
.
getWarnType
(),
LineWarnConfigEnum
.
WarnType
.
CONGESTION
.
getCode
())
){
if
(
Objects
.
isNull
(
param
.
getCongestionTime
())){
throw
new
ServiceSystemException
(
ResultCodeEnum
.
ILLEGAL_PARAMETER
,
"交通增加时间不能为空"
);}
}
}
lineWarnConfigService
.
updateConfig
(
param
);
lineWarnConfigService
.
updateConfig
(
param
);
return
Result
.
ok
();
return
Result
.
ok
();
}
}
...
...
performance-web/src/main/java/com/clx/performance/controller/temp/TempLineWarnController.java
0 → 100644
浏览文件 @
059a78d0
package
com
.
clx
.
performance
.
controller
.
temp
;
import
com.clx.performance.service.linewarn.LineWarnMqService
;
import
com.msl.common.result.Result
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* @Author: aiqingguo
* @Description: 临时接口
* @Date: 2023-8-21 12:10:16
* @Version: 1.0
*/
@Slf4j
@RestController
@RequestMapping
(
value
=
"/temp/lineWarn"
)
public
class
TempLineWarnController
{
@Autowired
private
LineWarnMqService
lineWarnMqService
;
@ApiOperation
(
value
=
"线路上报"
,
notes
=
"<br>By:艾庆国"
)
@PostMapping
(
"/lineReport"
)
public
Result
lineReport
(
Integer
sendSystemAddressId
,
Integer
receiveSystemAddressId
,
Integer
reportType
,
Integer
estimatedTravelTime
)
{
lineWarnMqService
.
lineReport
(
sendSystemAddressId
,
receiveSystemAddressId
,
reportType
,
estimatedTravelTime
);
return
Result
.
ok
();
}
}
performance-web/src/main/java/com/clx/performance/extranal/order/InternalReportService.java
0 → 100644
浏览文件 @
059a78d0
package
com
.
clx
.
performance
.
extranal
.
order
;
public
interface
InternalReportService
{
Boolean
checkLineJam
(
Integer
sendSystemAddressId
,
Integer
receiveSystemAddressId
,
String
beginTime
,
Integer
duration
);
Boolean
checkLineAbnormal
(
Integer
sendSystemAddressId
,
Integer
receiveSystemAddressId
,
String
beginTime
);
}
performance-web/src/main/java/com/clx/performance/extranal/order/impl/InternalReportServiceImpl.java
0 → 100644
浏览文件 @
059a78d0
package
com
.
clx
.
performance
.
extranal
.
order
.
impl
;
import
com.clx.order.feign.InternalReportFeign
;
import
com.clx.performance.extranal.order.InternalReportService
;
import
com.msl.common.base.Optional
;
import
com.msl.common.result.Result
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
@Slf4j
@Service
public
class
InternalReportServiceImpl
implements
InternalReportService
{
@Autowired
private
InternalReportFeign
internalReportFeign
;
@Override
public
Boolean
checkLineJam
(
Integer
sendSystemAddressId
,
Integer
receiveSystemAddressId
,
String
beginTime
,
Integer
duration
)
{
return
Optional
.
of
(
internalReportFeign
.
checkLineJam
(
sendSystemAddressId
,
receiveSystemAddressId
,
beginTime
,
duration
))
.
filter
(
Result:
:
succeed
)
.
map
(
Result:
:
getData
)
.
orElse
(
false
);
}
@Override
public
Boolean
checkLineAbnormal
(
Integer
sendSystemAddressId
,
Integer
receiveSystemAddressId
,
String
beginTime
)
{
return
Optional
.
of
(
internalReportFeign
.
checkLineAbnormal
(
sendSystemAddressId
,
receiveSystemAddressId
,
beginTime
))
.
filter
(
Result:
:
succeed
)
.
map
(
Result:
:
getData
)
.
orElse
(
false
);
}
}
performance-web/src/main/java/com/clx/performance/model/linewarn/LineWarnConfig.java
浏览文件 @
059a78d0
...
@@ -33,6 +33,7 @@ public class LineWarnConfig implements HasKey<Integer> {
...
@@ -33,6 +33,7 @@ public class LineWarnConfig implements HasKey<Integer> {
private
BigDecimal
interval
;
//预警间隔(小时)
private
BigDecimal
interval
;
//预警间隔(小时)
private
BigDecimal
timeRatio
;
//时间占比(%)
private
BigDecimal
timeRatio
;
//时间占比(%)
private
BigDecimal
taskCompleteRatio
;
//任务完成占比
private
BigDecimal
taskCompleteRatio
;
//任务完成占比
private
Integer
congestionTime
;
//拥堵时间(分钟)
private
Integer
deleteStatus
;
//删除状态: 0-否;1-是
private
Integer
deleteStatus
;
//删除状态: 0-否;1-是
private
Integer
status
;
//状态:1启用 2禁用
private
Integer
status
;
//状态:1启用 2禁用
private
String
createBy
;
//创建人
private
String
createBy
;
//创建人
...
...
performance-web/src/main/java/com/clx/performance/model/linewarn/LineWarnOrderGoods.java
浏览文件 @
059a78d0
...
@@ -37,6 +37,7 @@ public class LineWarnOrderGoods implements HasKey<Integer> {
...
@@ -37,6 +37,7 @@ public class LineWarnOrderGoods implements HasKey<Integer> {
private
Integer
loadNum
;
//装车车数
private
Integer
loadNum
;
//装车车数
private
Integer
arriveReceiveNum
;
//到达目的地车数
private
Integer
arriveReceiveNum
;
//到达目的地车数
private
Integer
unloadNum
;
//卸车车数
private
Integer
unloadNum
;
//卸车车数
private
LocalDateTime
lastLineReportTime
;
//上次线路上报时间
private
Integer
status
;
//状态
private
Integer
status
;
//状态
private
Integer
warnStatus
;
//预警使能:0禁用 1启用
private
Integer
warnStatus
;
//预警使能:0禁用 1启用
private
LocalDateTime
createTime
;
//创建时间
private
LocalDateTime
createTime
;
//创建时间
...
...
performance-web/src/main/java/com/clx/performance/service/impl/linewarn/LineWarnCongestionWarnServiceImpl.java
0 → 100644
浏览文件 @
059a78d0
package
com
.
clx
.
performance
.
service
.
impl
.
linewarn
;
import
com.clx.performance.dao.linewarn.LineWarnConfigDao
;
import
com.clx.performance.dao.linewarn.LineWarnInfoDao
;
import
com.clx.performance.dto.linewarn.LineWarnCommonInfoDTO
;
import
com.clx.performance.enums.linewarn.LineWarnConfigEnum
;
import
com.clx.performance.enums.linewarn.LineWarnInfoEnum
;
import
com.clx.performance.extranal.order.InternalReportService
;
import
com.clx.performance.model.OrderGoods
;
import
com.clx.performance.model.linewarn.LineWarnConfig
;
import
com.clx.performance.model.linewarn.LineWarnInfo
;
import
com.clx.performance.service.linewarn.LineWarnCommonService
;
import
com.clx.performance.service.linewarn.LineWarnCongestionWarnService
;
import
com.clx.performance.utils.LocalDateTimeUtils
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.time.LocalDateTime
;
import
java.util.List
;
import
java.util.Objects
;
@Slf4j
@Service
public
class
LineWarnCongestionWarnServiceImpl
implements
LineWarnCongestionWarnService
{
// 默认监控时间
private
static
final
int
DEFAULT_TIME
=
5
;
@Autowired
private
LineWarnConfigDao
lineWarnConfigDao
;
@Autowired
private
InternalReportService
internalReportService
;
@Autowired
private
LineWarnCommonService
lineWarnCommonService
;
@Autowired
private
LineWarnInfoDao
lineWarnInfoDao
;
@Override
public
void
congestionWarn
(
OrderGoods
orderGoods
,
LineWarnCommonInfoDTO
lineWarnCommonInfo
)
{
LocalDateTime
beginTime
=
LocalDateTime
.
now
().
minusMinutes
(
DEFAULT_TIME
);
List
<
LineWarnConfig
>
lineWarnConfigList
=
lineWarnConfigDao
.
listByWarnType
(
LineWarnConfigEnum
.
WarnType
.
CONGESTION
.
getCode
());
if
(
lineWarnConfigList
.
isEmpty
())
{
return
;}
for
(
LineWarnConfig
item
:
lineWarnConfigList
)
{
doCongestionWarn
(
orderGoods
,
item
,
beginTime
);
}
}
private
void
doCongestionWarn
(
OrderGoods
orderGoods
,
LineWarnConfig
lineWarnConfig
,
LocalDateTime
beginTime
){
LineWarnInfo
lineWarnInfo
=
lineWarnInfoDao
.
findByOrderGoodsNoAndWarnConfigId
(
orderGoods
.
getOrderGoodsNo
(),
lineWarnConfig
.
getId
()).
orNull
();
if
(
lineWarnInfo
!=
null
&&
Objects
.
equals
(
lineWarnInfo
.
getStatus
(),
LineWarnInfoEnum
.
Status
.
RESOLVE
.
getCode
())){
return
;
}
// 检测是否拥堵
Boolean
flag
=
internalReportService
.
checkLineJam
(
orderGoods
.
getSendSystemAddressId
(),
orderGoods
.
getReceiveSystemAddressId
(),
LocalDateTimeUtils
.
formatTime
(
beginTime
),
lineWarnConfig
.
getCongestionTime
());
if
(!
flag
)
{
return
;}
// 更新
lineWarnCommonService
.
lineWarnInfoUpdate
(
orderGoods
,
lineWarnInfo
,
lineWarnConfig
);
}
}
performance-web/src/main/java/com/clx/performance/service/impl/linewarn/LineWarnJamWarnServiceImpl.java
deleted
100644 → 0
浏览文件 @
25ad987c
package
com
.
clx
.
performance
.
service
.
impl
.
linewarn
;
import
com.clx.performance.dto.linewarn.LineWarnCommonInfoDTO
;
import
com.clx.performance.model.OrderGoods
;
import
com.clx.performance.service.linewarn.LineWarnJamWarnService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Service
;
@Slf4j
@Service
public
class
LineWarnJamWarnServiceImpl
implements
LineWarnJamWarnService
{
@Override
public
void
jamWarn
(
OrderGoods
orderGoods
,
LineWarnCommonInfoDTO
lineWarnCommonInfo
)
{
}
}
performance-web/src/main/java/com/clx/performance/service/impl/linewarn/LineWarnLineWarnServiceImpl.java
浏览文件 @
059a78d0
package
com
.
clx
.
performance
.
service
.
impl
.
linewarn
;
package
com
.
clx
.
performance
.
service
.
impl
.
linewarn
;
import
com.clx.performance.dao.linewarn.LineWarnConfigDao
;
import
com.clx.performance.dao.linewarn.LineWarnInfoDao
;
import
com.clx.performance.dto.linewarn.LineWarnCommonInfoDTO
;
import
com.clx.performance.dto.linewarn.LineWarnCommonInfoDTO
;
import
com.clx.performance.enums.linewarn.LineWarnConfigEnum
;
import
com.clx.performance.enums.linewarn.LineWarnInfoEnum
;
import
com.clx.performance.extranal.order.InternalReportService
;
import
com.clx.performance.model.OrderGoods
;
import
com.clx.performance.model.OrderGoods
;
import
com.clx.performance.model.linewarn.LineWarnConfig
;
import
com.clx.performance.model.linewarn.LineWarnInfo
;
import
com.clx.performance.service.linewarn.LineWarnCommonService
;
import
com.clx.performance.service.linewarn.LineWarnLineWarnService
;
import
com.clx.performance.service.linewarn.LineWarnLineWarnService
;
import
com.clx.performance.utils.LocalDateTimeUtils
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.time.LocalDateTime
;
import
java.util.List
;
import
java.util.Objects
;
@Slf4j
@Slf4j
@Service
@Service
public
class
LineWarnLineWarnServiceImpl
implements
LineWarnLineWarnService
{
public
class
LineWarnLineWarnServiceImpl
implements
LineWarnLineWarnService
{
// 默认监控时间
private
static
final
int
DEFAULT_TIME
=
5
;
@Autowired
private
LineWarnConfigDao
lineWarnConfigDao
;
@Autowired
private
LineWarnInfoDao
lineWarnInfoDao
;
@Autowired
private
InternalReportService
internalReportService
;
@Autowired
private
LineWarnCommonService
lineWarnCommonService
;
@Override
@Override
public
void
lineWarn
(
OrderGoods
orderGoods
,
LineWarnCommonInfoDTO
lineWarnCommonInfo
)
{
public
void
lineAbnormalWarn
(
OrderGoods
orderGoods
,
LineWarnCommonInfoDTO
lineWarnCommonInfo
)
{
LocalDateTime
beginTime
=
LocalDateTime
.
now
().
minusMinutes
(
DEFAULT_TIME
);
List
<
LineWarnConfig
>
lineWarnConfigList
=
lineWarnConfigDao
.
listByWarnType
(
LineWarnConfigEnum
.
WarnType
.
LINE_ABNORMAL
.
getCode
());
if
(
lineWarnConfigList
.
isEmpty
())
{
return
;}
for
(
LineWarnConfig
item
:
lineWarnConfigList
)
{
doLineAbnormalWarn
(
orderGoods
,
item
,
beginTime
);
}
}
private
void
doLineAbnormalWarn
(
OrderGoods
orderGoods
,
LineWarnConfig
lineWarnConfig
,
LocalDateTime
beginTime
){
LineWarnInfo
lineWarnInfo
=
lineWarnInfoDao
.
findByOrderGoodsNoAndWarnConfigId
(
orderGoods
.
getOrderGoodsNo
(),
lineWarnConfig
.
getId
()).
orNull
();
if
(
lineWarnInfo
!=
null
&&
Objects
.
equals
(
lineWarnInfo
.
getStatus
(),
LineWarnInfoEnum
.
Status
.
RESOLVE
.
getCode
())){
return
;
}
}
// 检测线路是否异常
Boolean
flag
=
internalReportService
.
checkLineAbnormal
(
orderGoods
.
getSendSystemAddressId
(),
orderGoods
.
getReceiveSystemAddressId
(),
LocalDateTimeUtils
.
formatTime
(
beginTime
));
if
(!
flag
)
{
return
;}
// 更新
lineWarnCommonService
.
lineWarnInfoUpdate
(
orderGoods
,
lineWarnInfo
,
lineWarnConfig
);
}
}
}
performance-web/src/main/java/com/clx/performance/service/impl/linewarn/LineWarnMqHandlerServiceImpl.java
浏览文件 @
059a78d0
...
@@ -48,7 +48,7 @@ public class LineWarnMqHandlerServiceImpl implements LineWarnMqHandlerService {
...
@@ -48,7 +48,7 @@ public class LineWarnMqHandlerServiceImpl implements LineWarnMqHandlerService {
@Autowired
@Autowired
private
LineWarnLoadWarnService
lineWarnLoadWarnService
;
private
LineWarnLoadWarnService
lineWarnLoadWarnService
;
@Autowired
@Autowired
private
LineWarn
JamWarnService
lineWarnJam
WarnService
;
private
LineWarn
CongestionWarnService
lineWarnCongestion
WarnService
;
@Autowired
@Autowired
private
LineWarnWeatherWarnService
lineWarnWeatherWarnService
;
private
LineWarnWeatherWarnService
lineWarnWeatherWarnService
;
@Autowired
@Autowired
...
@@ -59,6 +59,7 @@ public class LineWarnMqHandlerServiceImpl implements LineWarnMqHandlerService {
...
@@ -59,6 +59,7 @@ public class LineWarnMqHandlerServiceImpl implements LineWarnMqHandlerService {
private
OrderChildDao
orderChildDao
;
private
OrderChildDao
orderChildDao
;
@Override
@Override
public
void
orderGoodsAdd
(
LineWarnOrderGoodsAddMqParam
mq
)
{
public
void
orderGoodsAdd
(
LineWarnOrderGoodsAddMqParam
mq
)
{
OrderGoods
orderGoods
=
orderGoodsDao
OrderGoods
orderGoods
=
orderGoodsDao
...
@@ -126,13 +127,6 @@ public class LineWarnMqHandlerServiceImpl implements LineWarnMqHandlerService {
...
@@ -126,13 +127,6 @@ public class LineWarnMqHandlerServiceImpl implements LineWarnMqHandlerService {
log
.
info
(
"卸车预警异常,msg:{}"
,
e
.
getMessage
());
log
.
info
(
"卸车预警异常,msg:{}"
,
e
.
getMessage
());
}
}
// 拥堵预警
try
{
lineWarnJamWarnService
.
jamWarn
(
orderGoods
,
lineWarnCommonInfo
);
}
catch
(
Exception
e
){
log
.
info
(
"拥堵预警异常,msg:{}"
,
e
.
getMessage
());
}
// 天气预警
// 天气预警
try
{
try
{
lineWarnWeatherWarnService
.
weatherWarn
(
orderGoods
,
lineWarnCommonInfo
);
lineWarnWeatherWarnService
.
weatherWarn
(
orderGoods
,
lineWarnCommonInfo
);
...
@@ -147,16 +141,25 @@ public class LineWarnMqHandlerServiceImpl implements LineWarnMqHandlerService {
...
@@ -147,16 +141,25 @@ public class LineWarnMqHandlerServiceImpl implements LineWarnMqHandlerService {
log
.
info
(
"运单异常异常,msg:{}"
,
e
.
getMessage
());
log
.
info
(
"运单异常异常,msg:{}"
,
e
.
getMessage
());
}
}
// 拥堵预警
try
{
lineWarnCongestionWarnService
.
congestionWarn
(
orderGoods
,
lineWarnCommonInfo
);
}
catch
(
Exception
e
)
{
log
.
info
(
"拥堵预警异常,msg:{}"
,
e
.
getMessage
());
}
// 线路异常
// 线路异常
try
{
try
{
lineWarnLineWarnService
.
lineWarn
(
orderGoods
,
lineWarnCommonInfo
);
lineWarnLineWarnService
.
line
Abnormal
Warn
(
orderGoods
,
lineWarnCommonInfo
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
info
(
"
运单异常
异常,msg:{}"
,
e
.
getMessage
());
log
.
info
(
"
线路
异常,msg:{}"
,
e
.
getMessage
());
}
}
}
}
@Override
@Override
public
void
notice
(
LineWarnNoticeMqParam
mq
)
{
public
void
notice
(
LineWarnNoticeMqParam
mq
)
{
}
}
}
}
performance-web/src/main/java/com/clx/performance/service/impl/linewarn/LineWarnMqServiceImpl.java
浏览文件 @
059a78d0
...
@@ -57,16 +57,20 @@ public class LineWarnMqServiceImpl implements LineWarnMqService {
...
@@ -57,16 +57,20 @@ public class LineWarnMqServiceImpl implements LineWarnMqService {
}
}
@Override
@Override
public
void
lineReport
(
Integer
sendSystemAddressId
,
Integer
receiveSystemAddressId
,
Integer
reportType
)
{
public
void
lineReport
(
Integer
sendSystemAddressId
,
Integer
receiveSystemAddressId
,
Integer
reportType
,
Integer
estimatedTravelTime
)
{
LineWarnLineReportMqParam
mq
=
new
LineWarnLineReportMqParam
();
LineWarnLineReportMqParam
mq
=
new
LineWarnLineReportMqParam
();
mq
.
setSendSystemAddressId
(
sendSystemAddressId
);
mq
.
setSendSystemAddressId
(
sendSystemAddressId
);
mq
.
setReceiveSystemAddressId
(
receiveSystemAddressId
);
mq
.
setReceiveSystemAddressId
(
receiveSystemAddressId
);
mq
.
setReportType
(
reportType
);
mq
.
setReportType
(
reportType
);
mq
.
setEstimatedTravelTime
(
estimatedTravelTime
);
MqDelay
delay
=
new
MqDelay
<>(
RabbitKeyLineWarnConstants
.
DEFAULT_EXCHANGE
,
RabbitKeyLineWarnConstants
.
LINE_WARN_LINE_REPORT_ROUTING_KEY
,
new
MqWrapper
<>(
mq
));
MqDelay
delay
=
new
MqDelay
<>(
RabbitKeyLineWarnConstants
.
DEFAULT_EXCHANGE
,
RabbitKeyLineWarnConstants
.
LINE_WARN_LINE_REPORT_ROUTING_KEY
,
new
MqWrapper
<>(
mq
));
Message
message
=
MessageBuilder
.
withBody
(
JSON
.
toJSONString
(
new
MqWrapper
<>(
delay
)).
getBytes
()).
build
();
Message
message
=
MessageBuilder
.
withBody
(
JSON
.
toJSONString
(
new
MqWrapper
<>(
delay
)).
getBytes
()).
build
();
message
.
getMessageProperties
().
setExpiration
(
"5000"
);
message
.
getMessageProperties
().
setExpiration
(
"5000"
);
rabbitTemplate
.
send
(
RabbitKeyLineWarnConstants
.
DEFAULT_EXCHANGE
,
RabbitKeyLineWarnConstants
.
DEFAULT_DELAY_ROUTING_KEY
,
message
);
rabbitTemplate
.
send
(
RabbitKeyLineWarnConstants
.
DEFAULT_EXCHANGE
,
RabbitKeyLineWarnConstants
.
DEFAULT_DELAY_ROUTING_KEY
,
message
);
}
}
}
}
performance-web/src/main/java/com/clx/performance/service/impl/linewarn/LineWarnWeatherWarnServiceImpl.java
浏览文件 @
059a78d0
package
com
.
clx
.
performance
.
service
.
impl
.
linewarn
;
package
com
.
clx
.
performance
.
service
.
impl
.
linewarn
;
import
com.clx.performance.dao.linewarn.LineWarnConfigDao
;
import
com.clx.performance.dao.linewarn.LineWarnInfoDao
;
import
com.clx.performance.dto.linewarn.LineWarnCommonInfoDTO
;
import
com.clx.performance.dto.linewarn.LineWarnCommonInfoDTO
;
import
com.clx.performance.enums.linewarn.LineWarnConfigEnum
;
import
com.clx.performance.enums.linewarn.LineWarnInfoEnum
;
import
com.clx.performance.extranal.order.InternalReportService
;
import
com.clx.performance.model.OrderGoods
;
import
com.clx.performance.model.OrderGoods
;
import
com.clx.performance.model.linewarn.LineWarnConfig
;
import
com.clx.performance.model.linewarn.LineWarnInfo
;
import
com.clx.performance.service.linewarn.LineWarnCommonService
;
import
com.clx.performance.service.linewarn.LineWarnWeatherWarnService
;
import
com.clx.performance.service.linewarn.LineWarnWeatherWarnService
;
import
com.clx.performance.utils.LocalDateTimeUtils
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.time.LocalDateTime
;
import
java.util.List
;
import
java.util.Objects
;
@Slf4j
@Slf4j
@Service
@Service
public
class
LineWarnWeatherWarnServiceImpl
implements
LineWarnWeatherWarnService
{
public
class
LineWarnWeatherWarnServiceImpl
implements
LineWarnWeatherWarnService
{
@Autowired
private
LineWarnConfigDao
lineWarnConfigDao
;
@Autowired
private
InternalReportService
internalReportService
;
@Autowired
private
LineWarnCommonService
lineWarnCommonService
;
@Autowired
private
LineWarnInfoDao
lineWarnInfoDao
;
@Override
@Override
public
void
weatherWarn
(
OrderGoods
orderGoods
,
LineWarnCommonInfoDTO
lineWarnCommonInfo
)
{
public
void
weatherWarn
(
OrderGoods
orderGoods
,
LineWarnCommonInfoDTO
lineWarnCommonInfo
)
{
List
<
LineWarnConfig
>
lineWarnConfigList
=
lineWarnConfigDao
.
listByWarnType
(
LineWarnConfigEnum
.
WarnType
.
WEATHER
.
getCode
());
if
(
lineWarnConfigList
.
isEmpty
())
{
return
;}
for
(
LineWarnConfig
item
:
lineWarnConfigList
)
{
doWeather
(
orderGoods
,
item
);
}
}
private
void
doWeather
(
OrderGoods
orderGoods
,
LineWarnConfig
lineWarnConfig
){
LineWarnInfo
lineWarnInfo
=
lineWarnInfoDao
.
findByOrderGoodsNoAndWarnConfigId
(
orderGoods
.
getOrderGoodsNo
(),
lineWarnConfig
.
getId
()).
orNull
();
if
(
lineWarnInfo
!=
null
&&
Objects
.
equals
(
lineWarnInfo
.
getStatus
(),
LineWarnInfoEnum
.
Status
.
RESOLVE
.
getCode
())){
return
;
}
// 更新
lineWarnCommonService
.
lineWarnInfoUpdate
(
orderGoods
,
lineWarnInfo
,
lineWarnConfig
);
}
}
}
}
performance-web/src/main/java/com/clx/performance/service/linewarn/LineWarn
Jam
WarnService.java
→
performance-web/src/main/java/com/clx/performance/service/linewarn/LineWarn
Congestion
WarnService.java
浏览文件 @
059a78d0
...
@@ -3,8 +3,8 @@ package com.clx.performance.service.linewarn;
...
@@ -3,8 +3,8 @@ package com.clx.performance.service.linewarn;
import
com.clx.performance.dto.linewarn.LineWarnCommonInfoDTO
;
import
com.clx.performance.dto.linewarn.LineWarnCommonInfoDTO
;
import
com.clx.performance.model.OrderGoods
;
import
com.clx.performance.model.OrderGoods
;
public
interface
LineWarn
Jam
WarnService
{
public
interface
LineWarn
Congestion
WarnService
{
void
jam
Warn
(
OrderGoods
orderGoods
,
LineWarnCommonInfoDTO
lineWarnCommonInfo
);
void
congestion
Warn
(
OrderGoods
orderGoods
,
LineWarnCommonInfoDTO
lineWarnCommonInfo
);
}
}
performance-web/src/main/java/com/clx/performance/service/linewarn/LineWarnLineWarnService.java
浏览文件 @
059a78d0
...
@@ -5,6 +5,6 @@ import com.clx.performance.model.OrderGoods;
...
@@ -5,6 +5,6 @@ import com.clx.performance.model.OrderGoods;
public
interface
LineWarnLineWarnService
{
public
interface
LineWarnLineWarnService
{
void
lineWarn
(
OrderGoods
orderGoods
,
LineWarnCommonInfoDTO
lineWarnCommonInfo
);
void
line
Abnormal
Warn
(
OrderGoods
orderGoods
,
LineWarnCommonInfoDTO
lineWarnCommonInfo
);
}
}
performance-web/src/main/java/com/clx/performance/service/linewarn/LineWarnMqHandlerService.java
浏览文件 @
059a78d0
...
@@ -11,4 +11,5 @@ public interface LineWarnMqHandlerService {
...
@@ -11,4 +11,5 @@ public interface LineWarnMqHandlerService {
void
lineWarn
(
LineWarnLineWarnMqParam
mq
);
void
lineWarn
(
LineWarnLineWarnMqParam
mq
);
void
notice
(
LineWarnNoticeMqParam
mq
);
void
notice
(
LineWarnNoticeMqParam
mq
);
}
}
performance-web/src/main/java/com/clx/performance/service/linewarn/LineWarnMqService.java
浏览文件 @
059a78d0
...
@@ -8,5 +8,6 @@ public interface LineWarnMqService {
...
@@ -8,5 +8,6 @@ public interface LineWarnMqService {
void
lineWarnNotice
(
Integer
infoId
);
void
lineWarnNotice
(
Integer
infoId
);
void
lineReport
(
Integer
sendSystemAddressId
,
Integer
receiveSystemAddressId
,
Integer
reportType
);
void
lineReport
(
Integer
sendSystemAddressId
,
Integer
receiveSystemAddressId
,
Integer
reportType
,
Integer
estimatedTravelTime
);
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论