Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
clx-performance
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
姜武杰
clx-performance
Commits
d40635ca
提交
d40635ca
authored
6月 04, 2024
作者:
艾庆国
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'refs/heads/v16.3_line_warn_20240528' into dev
上级
fff13c0c
93d539db
显示空白字符变更
内嵌
并排
正在显示
27 个修改的文件
包含
432 行增加
和
43 行删除
+432
-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
LineWarnInfoVO.java
...va/com/clx/performance/vo/pc/linewarn/LineWarnInfoVO.java
+13
-0
LineWarnConfigController.java
...ance/controller/pc/linewarn/LineWarnConfigController.java
+18
-5
TempLineWarnController.java
...x/performance/controller/temp/TempLineWarnController.java
+30
-0
LineWarnInfoDaoImpl.java
...lx/performance/dao/impl/linewarn/LineWarnInfoDaoImpl.java
+1
-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
LineWarnInfo.java
...java/com/clx/performance/model/linewarn/LineWarnInfo.java
+1
-0
LineWarnOrderGoods.java
...om/clx/performance/model/linewarn/LineWarnOrderGoods.java
+1
-0
LineWarnCommonServiceImpl.java
...ance/service/impl/linewarn/LineWarnCommonServiceImpl.java
+7
-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
+93
-0
LineWarnCommonService.java
...x/performance/service/linewarn/LineWarnCommonService.java
+1
-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
GdService.java
...src/main/java/com/clx/performance/utils/gd/GdService.java
+49
-0
GdUtils.java
...b/src/main/java/com/clx/performance/utils/gd/GdUtils.java
+6
-0
没有找到文件。
performance-api/src/main/java/com/clx/performance/enums/linewarn/LineWarnConfigEnum.java
浏览文件 @
d40635ca
...
@@ -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
浏览文件 @
d40635ca
...
@@ -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
浏览文件 @
d40635ca
...
@@ -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
浏览文件 @
d40635ca
...
@@ -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-api/src/main/java/com/clx/performance/vo/pc/linewarn/LineWarnInfoVO.java
浏览文件 @
d40635ca
...
@@ -67,6 +67,19 @@ public class LineWarnInfoVO {
...
@@ -67,6 +67,19 @@ public class LineWarnInfoVO {
@ApiModelProperty
(
value
=
"预警暂停时间"
,
example
=
""
)
@ApiModelProperty
(
value
=
"预警暂停时间"
,
example
=
""
)
private
String
suspendTime
;
private
String
suspendTime
;
@ApiModelProperty
(
value
=
"挂单数"
,
example
=
"1"
)
private
Integer
pengNum
;
@ApiModelProperty
(
value
=
"接单数"
,
example
=
"1"
)
private
Integer
takeNum
;
@ApiModelProperty
(
value
=
"到达货源地车数"
,
example
=
"1"
)
private
Integer
arriveSendNum
;
@ApiModelProperty
(
value
=
"装车车数"
,
example
=
"1"
)
private
Integer
loadNum
;
@ApiModelProperty
(
value
=
"到达目的地车数"
,
example
=
"1"
)
private
Integer
arriveReceiveNum
;
@ApiModelProperty
(
value
=
"卸车车数"
,
example
=
"1"
)
private
Integer
unloadNum
;
@ApiModelProperty
(
value
=
"处理状态:1待处理 2已处理 3暂停预警"
,
example
=
"1"
)
@ApiModelProperty
(
value
=
"处理状态:1待处理 2已处理 3暂停预警"
,
example
=
"1"
)
private
Integer
status
;
private
Integer
status
;
public
Integer
getStatus
()
{
public
Integer
getStatus
()
{
...
...
performance-web/src/main/java/com/clx/performance/controller/pc/linewarn/LineWarnConfigController.java
浏览文件 @
d40635ca
...
@@ -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
浏览文件 @
d40635ca
package
com
.
clx
.
performance
.
controller
.
temp
;
import
com.msl.common.result.Result
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
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
{
@ApiOperation
(
value
=
"test"
,
notes
=
"<br>By:艾庆国"
)
@PostMapping
(
"/test"
)
public
Result
test
()
{
return
Result
.
ok
();
}
}
performance-web/src/main/java/com/clx/performance/dao/impl/linewarn/LineWarnInfoDaoImpl.java
浏览文件 @
d40635ca
...
@@ -49,6 +49,7 @@ public class LineWarnInfoDaoImpl extends BaseDaoImpl<LineWarnInfoMapper, LineWar
...
@@ -49,6 +49,7 @@ public class LineWarnInfoDaoImpl extends BaseDaoImpl<LineWarnInfoMapper, LineWar
public
boolean
updateWarnTime
(
LineWarnInfo
item
)
{
public
boolean
updateWarnTime
(
LineWarnInfo
item
)
{
return
update
(
lUdWrapper
()
return
update
(
lUdWrapper
()
.
eq
(
LineWarnInfo:
:
getId
,
item
.
getId
())
.
eq
(
LineWarnInfo:
:
getId
,
item
.
getId
())
.
set
(
LineWarnInfo:
:
getWeather
,
item
.
getWeather
())
.
set
(
LineWarnInfo:
:
getWarnTime
,
item
.
getWarnTime
())
.
set
(
LineWarnInfo:
:
getWarnTime
,
item
.
getWarnTime
())
);
);
}
}
...
...
performance-web/src/main/java/com/clx/performance/extranal/order/InternalReportService.java
0 → 100644
浏览文件 @
d40635ca
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
浏览文件 @
d40635ca
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
浏览文件 @
d40635ca
...
@@ -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/LineWarnInfo.java
浏览文件 @
d40635ca
...
@@ -36,6 +36,7 @@ public class LineWarnInfo implements HasKey<Integer> {
...
@@ -36,6 +36,7 @@ public class LineWarnInfo implements HasKey<Integer> {
private
Integer
receiveAddressId
;
//收货地址id
private
Integer
receiveAddressId
;
//收货地址id
private
String
receiveAddress
;
//收货地址
private
String
receiveAddress
;
//收货地址
private
LocalDateTime
suspendTime
;
//预警暂停时间
private
LocalDateTime
suspendTime
;
//预警暂停时间
private
String
weather
;
//天气
private
LocalDateTime
warnTime
;
//预警时间
private
LocalDateTime
warnTime
;
//预警时间
private
Integer
status
;
//处理状态:1待处理 2已处理 3暂停预警
private
Integer
status
;
//处理状态:1待处理 2已处理 3暂停预警
private
String
createBy
;
//创建人
private
String
createBy
;
//创建人
...
...
performance-web/src/main/java/com/clx/performance/model/linewarn/LineWarnOrderGoods.java
浏览文件 @
d40635ca
...
@@ -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/LineWarnCommonServiceImpl.java
浏览文件 @
d40635ca
...
@@ -26,6 +26,11 @@ public class LineWarnCommonServiceImpl implements LineWarnCommonService {
...
@@ -26,6 +26,11 @@ public class LineWarnCommonServiceImpl implements LineWarnCommonService {
@Override
@Override
public
void
lineWarnInfoUpdate
(
OrderGoods
orderGoods
,
LineWarnInfo
lineWarnInfo
,
LineWarnConfig
lineWarnConfig
){
public
void
lineWarnInfoUpdate
(
OrderGoods
orderGoods
,
LineWarnInfo
lineWarnInfo
,
LineWarnConfig
lineWarnConfig
){
lineWarnInfoUpdate
(
orderGoods
,
lineWarnInfo
,
lineWarnConfig
,
null
);
}
@Override
public
void
lineWarnInfoUpdate
(
OrderGoods
orderGoods
,
LineWarnInfo
lineWarnInfo
,
LineWarnConfig
lineWarnConfig
,
String
weather
){
// 更新
// 更新
if
(
lineWarnInfo
!=
null
){
if
(
lineWarnInfo
!=
null
){
...
@@ -33,6 +38,7 @@ public class LineWarnCommonServiceImpl implements LineWarnCommonService {
...
@@ -33,6 +38,7 @@ public class LineWarnCommonServiceImpl implements LineWarnCommonService {
LocalDateTime
nextTime
=
lineWarnInfo
.
getWarnTime
().
plusMinutes
(
lineWarnConfig
.
getInterval
().
multiply
(
new
BigDecimal
(
MIN_FER_HOUR
)).
intValue
());
LocalDateTime
nextTime
=
lineWarnInfo
.
getWarnTime
().
plusMinutes
(
lineWarnConfig
.
getInterval
().
multiply
(
new
BigDecimal
(
MIN_FER_HOUR
)).
intValue
());
if
(
nextTime
.
isAfter
(
LocalDateTime
.
now
()))
{
return
;}
if
(
nextTime
.
isAfter
(
LocalDateTime
.
now
()))
{
return
;}
lineWarnInfo
.
setWeather
(
weather
);
lineWarnInfo
.
setWarnTime
(
LocalDateTime
.
now
());
lineWarnInfo
.
setWarnTime
(
LocalDateTime
.
now
());
lineWarnInfoDao
.
updateWarnTime
(
lineWarnInfo
);
lineWarnInfoDao
.
updateWarnTime
(
lineWarnInfo
);
...
@@ -54,6 +60,7 @@ public class LineWarnCommonServiceImpl implements LineWarnCommonService {
...
@@ -54,6 +60,7 @@ public class LineWarnCommonServiceImpl implements LineWarnCommonService {
lineWarnInfo
.
setReceiveAddressId
(
orderGoods
.
getReceiveAddressId
());
lineWarnInfo
.
setReceiveAddressId
(
orderGoods
.
getReceiveAddressId
());
lineWarnInfo
.
setReceiveAddress
(
orderGoods
.
getReceiveAddressShorter
());
lineWarnInfo
.
setReceiveAddress
(
orderGoods
.
getReceiveAddressShorter
());
lineWarnInfo
.
setWeather
(
weather
);
lineWarnInfo
.
setWarnTime
(
LocalDateTime
.
now
());
lineWarnInfo
.
setWarnTime
(
LocalDateTime
.
now
());
lineWarnInfoDao
.
saveEntity
(
lineWarnInfo
);
lineWarnInfoDao
.
saveEntity
(
lineWarnInfo
);
...
...
performance-web/src/main/java/com/clx/performance/service/impl/linewarn/LineWarnCongestionWarnServiceImpl.java
0 → 100644
浏览文件 @
d40635ca
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
浏览文件 @
fff13c0c
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
浏览文件 @
d40635ca
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
浏览文件 @
d40635ca
...
@@ -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
浏览文件 @
d40635ca
...
@@ -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
浏览文件 @
d40635ca
package
com
.
clx
.
performance
.
service
.
impl
.
linewarn
;
package
com
.
clx
.
performance
.
service
.
impl
.
linewarn
;
import
com.clx.order.vo.feign.FeignAddressVO
;
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.extranal.user.AddressService
;
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.gd.GdUtils
;
import
com.msl.common.base.Optional
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
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
;
@Autowired
private
GdUtils
gdUtils
;
@Autowired
private
AddressService
addressService
;
@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
;
}
Optional
<
FeignAddressVO
>
addressOptional
=
addressService
.
getSendAndReceiveAddress
(
orderGoods
.
getSendAddressId
(),
orderGoods
.
getReceiveAddressId
());
if
(
addressOptional
.
isEmpty
())
{
return
;}
FeignAddressVO
feignAddressVO
=
addressOptional
.
get
();
if
(
feignAddressVO
.
getSendAddress
()!=
null
&&
StringUtils
.
isNotBlank
(
feignAddressVO
.
getSendAddress
().
getCityCode
())){
String
weather
=
gdUtils
.
getWeather
(
feignAddressVO
.
getSendAddress
().
getCityCode
());
if
(
weatherCheck
(
weather
)){
// 更新
lineWarnCommonService
.
lineWarnInfoUpdate
(
orderGoods
,
lineWarnInfo
,
lineWarnConfig
,
weather
);
}
}
if
(
feignAddressVO
.
getReceiveAddress
()!=
null
&&
StringUtils
.
isNotBlank
(
feignAddressVO
.
getReceiveAddress
().
getCityCode
())){
String
weather
=
gdUtils
.
getWeather
(
feignAddressVO
.
getReceiveAddress
().
getCityCode
());
if
(
weatherCheck
(
weather
)){
// 更新
lineWarnCommonService
.
lineWarnInfoUpdate
(
orderGoods
,
lineWarnInfo
,
lineWarnConfig
,
weather
);
}
}
}
/**
* 天气验证
*/
private
boolean
weatherCheck
(
String
weather
){
if
(
weather
.
contains
(
"雨"
)
||
weather
.
contains
(
"雪"
)
||
weather
.
contains
(
"沙尘暴"
)
||
weather
.
contains
(
"强沙尘暴"
)
||
weather
.
contains
(
"大雾"
)
||
weather
.
contains
(
"浓雾"
)
||
weather
.
contains
(
"强浓雾"
)
||
weather
.
contains
(
"特强浓雾"
)
||
weather
.
contains
(
"雾"
)
||
weather
.
contains
(
"中度霾"
)
||
weather
.
contains
(
"重度霾"
)
||
weather
.
contains
(
"严重霾"
)
){
return
true
;
}
return
false
;
}
}
}
}
performance-web/src/main/java/com/clx/performance/service/linewarn/LineWarnCommonService.java
浏览文件 @
d40635ca
...
@@ -8,4 +8,5 @@ public interface LineWarnCommonService {
...
@@ -8,4 +8,5 @@ public interface LineWarnCommonService {
void
lineWarnInfoUpdate
(
OrderGoods
orderGoods
,
LineWarnInfo
lineWarnInfo
,
LineWarnConfig
lineWarnConfig
);
void
lineWarnInfoUpdate
(
OrderGoods
orderGoods
,
LineWarnInfo
lineWarnInfo
,
LineWarnConfig
lineWarnConfig
);
void
lineWarnInfoUpdate
(
OrderGoods
orderGoods
,
LineWarnInfo
lineWarnInfo
,
LineWarnConfig
lineWarnConfig
,
String
weather
);
}
}
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
浏览文件 @
d40635ca
...
@@ -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
浏览文件 @
d40635ca
...
@@ -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
浏览文件 @
d40635ca
...
@@ -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
浏览文件 @
d40635ca
...
@@ -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
);
}
}
performance-web/src/main/java/com/clx/performance/utils/gd/GdService.java
浏览文件 @
d40635ca
...
@@ -33,6 +33,7 @@ public class GdService {
...
@@ -33,6 +33,7 @@ public class GdService {
private
static
final
String
REGEO_API
=
"https://restapi.amap.com/v3/geocode/regeo"
;
//逆地理编码
private
static
final
String
REGEO_API
=
"https://restapi.amap.com/v3/geocode/regeo"
;
//逆地理编码
private
static
final
String
WEATHER_API
=
"https://restapi.amap.com/v3/weather/weatherInfo?parameters"
;
//天气
private
String
gaodeKey
=
"b2550e16bbc7bf9f6cd168e0f21709fc"
;
private
String
gaodeKey
=
"b2550e16bbc7bf9f6cd168e0f21709fc"
;
...
@@ -356,4 +357,52 @@ public class GdService {
...
@@ -356,4 +357,52 @@ public class GdService {
return
!
Objects
.
isNull
(
value
)
&&
BigDecimal
.
ZERO
.
compareTo
(
value
)
!=
0
?
value
.
setScale
(
2
,
4
)
:
BigDecimal
.
ZERO
;
return
!
Objects
.
isNull
(
value
)
&&
BigDecimal
.
ZERO
.
compareTo
(
value
)
!=
0
?
value
.
setScale
(
2
,
4
)
:
BigDecimal
.
ZERO
;
}
}
public
String
getWeather
(
String
city
){
return
getWeather
(
gaodeKey
,
city
);
}
public
static
String
getWeather
(
String
key
,
String
city
)
{
String
url
=
WEATHER_API
+
"?output=json&city="
+
city
+
"&extensions=base&key="
+
key
;
String
resultStr
;
try
{
resultStr
=
HttpUtils
.
httpGetRequest
(
url
);
}
catch
(
Exception
e
)
{
throw
new
ServiceSystemException
(
ResultCodeEnum
.
FAIL
,
"调用高德地理编码接口异常"
);
}
if
(
StringUtils
.
isBlank
(
resultStr
))
{
throw
new
ServiceSystemException
(
ResultCodeEnum
.
FAIL
,
"调用高德天气接口异常, 返回结果空"
);}
JSONObject
retJSONObject
=
JSONObject
.
parseObject
(
resultStr
);
if
(
Objects
.
isNull
(
retJSONObject
))
{
throw
new
ServiceSystemException
(
ResultCodeEnum
.
FAIL
,
"调用高德天气接口异常, 返回结果转换异常, result:"
+
resultStr
);}
Integer
status
=
retJSONObject
.
getInteger
(
"status"
);
if
(!
Objects
.
equals
(
1
,
status
))
{
if
(
Objects
.
equals
(
10001
,
status
))
{
throw
new
ServiceSystemException
(
ResultCodeEnum
.
FAIL
,
"调用高德天气接口异常, 无效key, result:"
+
resultStr
);}
else
if
(
Objects
.
equals
(
10002
,
status
))
{
throw
new
ServiceSystemException
(
ResultCodeEnum
.
FAIL
,
"调用高德天气接口异常, 没有权限使用相应的服务或者请求接口的路径拼写错误, result:"
+
resultStr
);}
else
if
(
Objects
.
equals
(
10003
,
status
))
{
throw
new
ServiceSystemException
(
ResultCodeEnum
.
FAIL
,
"调用高德天气接口异常, 访问已超出日访问量, result:"
+
resultStr
);}
else
if
(
Objects
.
equals
(
10004
,
status
))
{
throw
new
ServiceSystemException
(
ResultCodeEnum
.
FAIL
,
"调用高德天气接口异常, 单位时间内访问过于频繁, result:"
+
resultStr
);}
else
if
(
Objects
.
equals
(
10010
,
status
))
{
throw
new
ServiceSystemException
(
ResultCodeEnum
.
FAIL
,
"调用高德天气接口异常, IP访问超限, result:"
+
resultStr
);}
else
if
(
Objects
.
equals
(
10044
,
status
))
{
throw
new
ServiceSystemException
(
ResultCodeEnum
.
FAIL
,
"调用高德天气接口异常, 账号维度日调用量超出限制, result:"
+
resultStr
);}
else
if
(
Objects
.
equals
(
40000
,
status
))
{
throw
new
ServiceSystemException
(
ResultCodeEnum
.
FAIL
,
"调用高德天气接口异常, 余额耗尽, result:"
+
resultStr
);}
else
if
(
Objects
.
equals
(
40002
,
status
))
{
throw
new
ServiceSystemException
(
ResultCodeEnum
.
FAIL
,
"调用高德天气接口异常, 购买服务到期, result:"
+
resultStr
);}
else
if
(
Objects
.
equals
(
20802
,
status
))
{
throw
new
ServiceSystemException
(
ResultCodeEnum
.
FAIL
,
"调用高德天气接口异常, 路线计算失败, result:"
+
resultStr
);
}
else
if
(
Objects
.
equals
(
20803
,
status
))
{
throw
new
ServiceSystemException
(
ResultCodeEnum
.
FAIL
,
"调用高德天气接口异常, 起点终点距离过长, result:"
+
resultStr
);
}
else
{
throw
new
ServiceSystemException
(
ResultCodeEnum
.
FAIL
,
"调用高德天气接口异常, 状态异常, result:"
+
resultStr
);}
}
// 解析
JSONArray
geocodes
=
retJSONObject
.
getJSONArray
(
"lives"
);
if
(
Objects
.
isNull
(
geocodes
))
{
throw
new
ServiceSystemException
(
ResultCodeEnum
.
FAIL
,
"调用高德天气接口异常, result:"
+
resultStr
);}
JSONObject
item
=
geocodes
.
getJSONObject
(
0
);
String
weather
=
item
.
getString
(
"weather"
);
return
weather
;
}
}
}
performance-web/src/main/java/com/clx/performance/utils/gd/GdUtils.java
浏览文件 @
d40635ca
...
@@ -72,4 +72,10 @@ public class GdUtils {
...
@@ -72,4 +72,10 @@ public class GdUtils {
return
GpsUtil
.
distanceM
(
currentPosition
[
0
],
currentPosition
[
1
],
destinationLongitude
,
destinationLatitude
);
return
GpsUtil
.
distanceM
(
currentPosition
[
0
],
currentPosition
[
1
],
destinationLongitude
,
destinationLatitude
);
}
}
/**
* 天气
*/
public
String
getWeather
(
String
city
){
return
gdService
.
getWeather
(
city
);
}
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论