Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
clx-performance
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
姜武杰
clx-performance
Commits
30b32641
提交
30b32641
authored
6月 19, 2024
作者:
艾庆国
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'refs/heads/v16.3_line_warn_20240528' into dev
上级
c872bdc9
fdd7116f
隐藏空白字符变更
内嵌
并排
正在显示
25 个修改的文件
包含
459 行增加
和
49 行删除
+459
-49
OrderEnum.java
...pi/src/main/java/com/clx/performance/enums/OrderEnum.java
+161
-0
VehicleWarnUserEnum.java
...lx/performance/enums/vehiclewarn/VehicleWarnUserEnum.java
+1
-1
RabbitLineWarnConfig.java
...java/com/clx/performance/config/RabbitLineWarnConfig.java
+1
-1
RedisConstants.java
...ain/java/com/clx/performance/constant/RedisConstants.java
+6
-0
TempLineWarnController.java
...x/performance/controller/temp/TempLineWarnController.java
+62
-0
OrderChildDao.java
.../src/main/java/com/clx/performance/dao/OrderChildDao.java
+1
-1
OrderChildDaoImpl.java
.../java/com/clx/performance/dao/impl/OrderChildDaoImpl.java
+2
-2
LineWarnConfigDaoImpl.java
.../performance/dao/impl/linewarn/LineWarnConfigDaoImpl.java
+1
-0
LineWarnInfoDaoImpl.java
...lx/performance/dao/impl/linewarn/LineWarnInfoDaoImpl.java
+1
-1
OrderChildMapper.java
...ain/java/com/clx/performance/mapper/OrderChildMapper.java
+19
-10
LineWarnCommonServiceImpl.java
...ance/service/impl/linewarn/LineWarnCommonServiceImpl.java
+14
-0
LineWarnConfigServiceImpl.java
...ance/service/impl/linewarn/LineWarnConfigServiceImpl.java
+10
-0
LineWarnCongestionWarnServiceImpl.java
...vice/impl/linewarn/LineWarnCongestionWarnServiceImpl.java
+4
-0
LineWarnInfoServiceImpl.java
...rmance/service/impl/linewarn/LineWarnInfoServiceImpl.java
+8
-0
LineWarnLineWarnServiceImpl.java
...ce/service/impl/linewarn/LineWarnLineWarnServiceImpl.java
+4
-0
LineWarnLoadWarnServiceImpl.java
...ce/service/impl/linewarn/LineWarnLoadWarnServiceImpl.java
+11
-3
LineWarnMqHandlerServiceImpl.java
...e/service/impl/linewarn/LineWarnMqHandlerServiceImpl.java
+12
-4
LineWarnOrderChildWarnServiceImpl.java
...vice/impl/linewarn/LineWarnOrderChildWarnServiceImpl.java
+5
-1
LineWarnTakeWarnServiceImpl.java
...ce/service/impl/linewarn/LineWarnTakeWarnServiceImpl.java
+28
-6
LineWarnUnloadServiceImpl.java
...ance/service/impl/linewarn/LineWarnUnloadServiceImpl.java
+12
-4
LineWarnWeatherWarnServiceImpl.java
...service/impl/linewarn/LineWarnWeatherWarnServiceImpl.java
+36
-11
LineWarnCommonService.java
...x/performance/service/linewarn/LineWarnCommonService.java
+2
-0
VehicleWarnRangeSqlProvider.java
.../sqlProvider/vehiclewarn/VehicleWarnRangeSqlProvider.java
+4
-4
GdService.java
...src/main/java/com/clx/performance/utils/gd/GdService.java
+48
-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/OrderEnum.java
0 → 100644
浏览文件 @
30b32641
package
com
.
clx
.
performance
.
enums
;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.Objects
;
public
enum
OrderEnum
{
;
//订单状态: 0待报价 1客户确认中 2报价已确认 3平台已承接 4已取消 5暂停 6拒绝承运 7 挂单中 8运输中 9订单已完成 10 已失效
@Getter
@AllArgsConstructor
public
enum
Status
{
WAIT_QUOTATION
(
0
,
"待报价"
),
CUSTOMER_CONFIRMING
(
1
,
"客户确认中"
),
QUOTATION_CONFIRMED
(
2
,
"报价已确认"
),
PLATFORM_UNDERTAKING
(
3
,
"平台已承接"
),
CANCELED
(
4
,
"已取消"
),
SUSPEND
(
5
,
"暂停"
),
REFUSAL_TO_CARRY
(
6
,
"拒绝承运"
),
ON_ORDER
(
7
,
"挂单中"
),
IN_TRANSIT
(
8
,
"运输中"
),
SUCCESS
(
9
,
"订单已完成"
),
EXPIRED
(
10
,
"已失效"
),
POST_ORDER
(
11
,
"已挂单"
),
COMPLETED
(
12
,
"已完结"
)
;
private
final
Integer
code
;
private
final
String
name
;
public
static
Status
getByCode
(
int
code
)
{
for
(
Status
type:
Status
.
values
()){
if
(
type
.
code
==
code
){
return
type
;
}
}
return
null
;
}
}
//申请状态 1.申请 2.驳回 3.同意 4.过期'
@Getter
@AllArgsConstructor
public
enum
CancelApplyStatus
{
APPLY
(
1
,
"申请"
),
REJECT
(
2
,
"驳回"
),
AGREE
(
3
,
"同意"
),
EXPIRED
(
4
,
"过期"
);
private
final
int
code
;
private
final
String
name
;
public
static
Status
getByCode
(
int
code
)
{
for
(
Status
type:
Status
.
values
()){
if
(
type
.
code
==
code
){
return
type
;
}
}
return
null
;
}
}
//报价状态 2.确认报价 3.驳回报价 4.报价过期'
@Getter
@AllArgsConstructor
public
enum
QuotationStatus
{
CONFIRM
(
2
,
"确认报价"
),
REJECT
(
3
,
"驳回报价"
),
EXPIRE
(
4
,
"报价过期"
);
private
final
int
code
;
private
final
String
name
;
public
static
QuotationStatus
getByCode
(
Integer
code
)
{
for
(
QuotationStatus
type:
QuotationStatus
.
values
()){
if
(
type
.
code
==
code
){
return
type
;
}
}
return
null
;
}
}
@Getter
@AllArgsConstructor
public
enum
OverWeight
{
NO
(
0
,
"否"
),
YES
(
1
,
"是"
);
private
final
Integer
code
;
private
final
String
name
;
public
static
OverWeight
getByCode
(
Integer
code
)
{
for
(
OverWeight
type:
OverWeight
.
values
()){
if
(
Objects
.
equals
(
type
.
code
,
code
)){
return
type
;
}
}
return
null
;
}
}
@Getter
@AllArgsConstructor
public
enum
ReportFlag
{
NO
(
0
,
"否"
),
YES
(
1
,
"是"
);
private
final
int
code
;
private
final
String
name
;
public
static
String
getNameByCode
(
int
code
)
{
for
(
ReportFlag
type:
ReportFlag
.
values
()){
if
(
type
.
code
==
code
){
return
type
.
getName
();
}
}
return
null
;
}
}
//预付运费标识 1:部分预付 2:全额预付
@Getter
@AllArgsConstructor
public
enum
PrepayFreightFlag
{
PART
(
1
,
"部分预付"
),
ALL
(
2
,
"全额预付"
);
private
final
Integer
code
;
private
final
String
name
;
public
static
String
getByCode
(
Integer
code
)
{
for
(
PrepayFreightFlag
type:
PrepayFreightFlag
.
values
()){
if
(
Objects
.
equals
(
type
.
code
,
code
)){
return
type
.
getName
();
}
}
return
null
;
}
}
public
static
final
List
<
Integer
>
BORROW_TIP_STATUS_lIST
=
Arrays
.
asList
(
Status
.
PLATFORM_UNDERTAKING
.
getCode
(),
Status
.
ON_ORDER
.
getCode
(),
Status
.
POST_ORDER
.
getCode
(),
Status
.
IN_TRANSIT
.
getCode
()
);
//外部系统可以修改数据的状态
public
static
final
List
<
Integer
>
SYNC_ORDER_UPDATE_lIST
=
Arrays
.
asList
(
Status
.
CUSTOMER_CONFIRMING
.
getCode
(),
Status
.
QUOTATION_CONFIRMED
.
getCode
(),
Status
.
PLATFORM_UNDERTAKING
.
getCode
(),
Status
.
ON_ORDER
.
getCode
(),
Status
.
POST_ORDER
.
getCode
(),
Status
.
IN_TRANSIT
.
getCode
()
);
}
performance-api/src/main/java/com/clx/performance/enums/vehiclewarn/VehicleWarnUserEnum.java
浏览文件 @
30b32641
...
@@ -24,7 +24,7 @@ public enum VehicleWarnUserEnum {
...
@@ -24,7 +24,7 @@ public enum VehicleWarnUserEnum {
@Getter
@Getter
@AllArgsConstructor
@AllArgsConstructor
public
enum
NoticeStatus
{
public
enum
NoticeStatus
{
NO
(
0
,
"
禁用
"
),
NO
(
0
,
"
关闭
"
),
YES
(
1
,
"开启"
),
YES
(
1
,
"开启"
),
;
;
...
...
performance-web/src/main/java/com/clx/performance/config/RabbitLineWarnConfig.java
浏览文件 @
30b32641
...
@@ -99,7 +99,7 @@ public class RabbitLineWarnConfig {
...
@@ -99,7 +99,7 @@ public class RabbitLineWarnConfig {
}
}
@Bean
@Bean
public
Binding
lineWarnLineReportQueueBinding
()
{
public
Binding
lineWarnLineReportQueueBinding
()
{
return
BindingBuilder
.
bind
(
lineWarn
Notice
Queue
()).
to
(
lineWarnDefaultExchange
())
return
BindingBuilder
.
bind
(
lineWarn
LineReport
Queue
()).
to
(
lineWarnDefaultExchange
())
.
with
(
RabbitKeyLineWarnConstants
.
LINE_WARN_LINE_REPORT_ROUTING_KEY
);
.
with
(
RabbitKeyLineWarnConstants
.
LINE_WARN_LINE_REPORT_ROUTING_KEY
);
}
}
...
...
performance-web/src/main/java/com/clx/performance/constant/RedisConstants.java
浏览文件 @
30b32641
...
@@ -36,4 +36,10 @@ public class RedisConstants {
...
@@ -36,4 +36,10 @@ public class RedisConstants {
public
static
final
String
MESSAGE_RESET_PASSWORD_TOKEN
=
"message:resetpassword:token:"
;
public
static
final
String
MESSAGE_RESET_PASSWORD_TOKEN
=
"message:resetpassword:token:"
;
/**
* 线路天气预警
*/
public
static
final
String
LINE_WARN_WEATHER
=
"clx-performance:lineWarn:weather:"
;
}
}
performance-web/src/main/java/com/clx/performance/controller/temp/TempLineWarnController.java
浏览文件 @
30b32641
package
com
.
clx
.
performance
.
controller
.
temp
;
package
com
.
clx
.
performance
.
controller
.
temp
;
import
com.clx.order.vo.feign.FeignAddressVO
;
import
com.clx.performance.extranal.user.AddressService
;
import
com.clx.performance.service.linewarn.LineWarnMqHandlerService
;
import
com.clx.performance.service.linewarn.LineWarnMqService
;
import
com.clx.performance.service.linewarn.LineWarnMqService
;
import
com.clx.performance.utils.gd.GdUtils
;
import
com.msl.common.base.Optional
;
import
com.msl.common.result.Result
;
import
com.msl.common.result.Result
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
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.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.Arrays
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
/**
* @Author: aiqingguo
* @Author: aiqingguo
* @Description: 临时接口
* @Description: 临时接口
...
@@ -22,6 +32,12 @@ public class TempLineWarnController {
...
@@ -22,6 +32,12 @@ public class TempLineWarnController {
@Autowired
@Autowired
private
LineWarnMqService
lineWarnMqService
;
private
LineWarnMqService
lineWarnMqService
;
@Autowired
private
AddressService
addressService
;
@Autowired
private
GdUtils
gdUtils
;
@Autowired
private
LineWarnMqHandlerService
lineWarnMqHandlerService
;
@ApiOperation
(
value
=
"test"
,
notes
=
"<br>By:艾庆国"
)
@ApiOperation
(
value
=
"test"
,
notes
=
"<br>By:艾庆国"
)
@PostMapping
(
"/test"
)
@PostMapping
(
"/test"
)
...
@@ -45,5 +61,51 @@ public class TempLineWarnController {
...
@@ -45,5 +61,51 @@ public class TempLineWarnController {
lineWarnMqService
.
orderGoodsAdd
(
orderGoodsNo
);
lineWarnMqService
.
orderGoodsAdd
(
orderGoodsNo
);
return
Result
.
ok
();
return
Result
.
ok
();
}
}
@ApiOperation
(
value
=
"天气"
,
notes
=
"<br>By:艾庆国"
)
@PostMapping
(
"/weather"
)
public
Result
<
Map
<
String
,
String
>>
weather
(
Integer
sendAddressId
,
Integer
receiveAddressId
)
{
Map
<
String
,
String
>
result
=
new
HashMap
<>();
Optional
<
FeignAddressVO
>
addressOptional
=
addressService
.
getSendAndReceiveAddress
(
sendAddressId
,
receiveAddressId
);
if
(
addressOptional
.
isEmpty
())
{
return
Result
.
ok
(
result
);}
FeignAddressVO
feignAddressVO
=
addressOptional
.
get
();
if
(
feignAddressVO
.
getSendAddress
()!=
null
){
String
cityCode
=
gdUtils
.
getCity
(
feignAddressVO
.
getSendAddress
().
getLongitude
(),
feignAddressVO
.
getSendAddress
().
getLatitude
());
String
weather
=
gdUtils
.
getWeather
(
cityCode
);
result
.
put
(
"send"
,
weather
);
}
if
(
feignAddressVO
.
getReceiveAddress
()!=
null
){
String
cityCode
=
gdUtils
.
getCity
(
feignAddressVO
.
getReceiveAddress
().
getLongitude
(),
feignAddressVO
.
getReceiveAddress
().
getLatitude
());
String
weather
=
gdUtils
.
getWeather
(
cityCode
);
result
.
put
(
"receive"
,
weather
);
}
return
Result
.
ok
(
result
);
}
@ApiOperation
(
value
=
"发送预警短信"
,
notes
=
"<br>By:艾庆国"
)
@PostMapping
(
"/sendSms"
)
public
Result
sendSms
(
String
mobile
,
String
warnName
,
String
orderGoodsNo
)
{
lineWarnMqHandlerService
.
sendSms
(
Arrays
.
asList
(
mobile
),
warnName
,
orderGoodsNo
);
return
Result
.
ok
();
}
@ApiOperation
(
value
=
"发送预警外呼"
,
notes
=
"<br>By:艾庆国"
)
@PostMapping
(
"/sendClink"
)
public
Result
sendClink
(
String
mobile
,
String
warnName
,
String
orderGoodsNo
)
{
lineWarnMqHandlerService
.
sendClink
(
Arrays
.
asList
(
mobile
),
warnName
,
orderGoodsNo
);
return
Result
.
ok
();
}
}
}
performance-web/src/main/java/com/clx/performance/dao/OrderChildDao.java
浏览文件 @
30b32641
...
@@ -183,7 +183,7 @@ public interface OrderChildDao extends BaseDao<OrderChildMapper, OrderChild, Int
...
@@ -183,7 +183,7 @@ public interface OrderChildDao extends BaseDao<OrderChildMapper, OrderChild, Int
List
<
OrderChild
>
listByOrderGoodsNoAndStatus
(
String
orderGoodsNo
,
List
<
Integer
>
statusList
);
List
<
OrderChild
>
listByOrderGoodsNoAndStatus
(
String
orderGoodsNo
,
List
<
Integer
>
statusList
);
BigDecimal
sumTakeWeightByOrderGoodsNo
(
String
orderGoodsNo
);
BigDecimal
sumTakeWeightByOrderGoodsNo
(
String
orderGoodsNo
,
BigDecimal
defaultWeight
);
BigDecimal
sumLoadWeightByOrderGoodsNo
(
String
orderGoodsNo
);
BigDecimal
sumLoadWeightByOrderGoodsNo
(
String
orderGoodsNo
);
BigDecimal
sumUnloadWeightByOrderGoodsNo
(
String
orderGoodsNo
);
BigDecimal
sumUnloadWeightByOrderGoodsNo
(
String
orderGoodsNo
);
...
...
performance-web/src/main/java/com/clx/performance/dao/impl/OrderChildDaoImpl.java
浏览文件 @
30b32641
...
@@ -578,8 +578,8 @@ public class OrderChildDaoImpl extends BaseDaoImpl<OrderChildMapper, OrderChild,
...
@@ -578,8 +578,8 @@ public class OrderChildDaoImpl extends BaseDaoImpl<OrderChildMapper, OrderChild,
}
}
@Override
@Override
public
BigDecimal
sumTakeWeightByOrderGoodsNo
(
String
orderGoodsNo
)
{
public
BigDecimal
sumTakeWeightByOrderGoodsNo
(
String
orderGoodsNo
,
BigDecimal
defaultWeight
)
{
return
baseMapper
.
sumTakeWeightByOrderGoodsNo
(
orderGoodsNo
);
return
baseMapper
.
sumTakeWeightByOrderGoodsNo
(
orderGoodsNo
,
defaultWeight
);
}
}
@Override
@Override
...
...
performance-web/src/main/java/com/clx/performance/dao/impl/linewarn/LineWarnConfigDaoImpl.java
浏览文件 @
30b32641
...
@@ -27,6 +27,7 @@ public class LineWarnConfigDaoImpl extends BaseDaoImpl<LineWarnConfigMapper, Lin
...
@@ -27,6 +27,7 @@ public class LineWarnConfigDaoImpl extends BaseDaoImpl<LineWarnConfigMapper, Lin
.
set
(
LineWarnConfig:
:
getInterval
,
item
.
getInterval
())
.
set
(
LineWarnConfig:
:
getInterval
,
item
.
getInterval
())
.
set
(
LineWarnConfig:
:
getTimeRatio
,
item
.
getTimeRatio
())
.
set
(
LineWarnConfig:
:
getTimeRatio
,
item
.
getTimeRatio
())
.
set
(
LineWarnConfig:
:
getTaskCompleteRatio
,
item
.
getTaskCompleteRatio
())
.
set
(
LineWarnConfig:
:
getTaskCompleteRatio
,
item
.
getTaskCompleteRatio
())
.
set
(
LineWarnConfig:
:
getCongestionTime
,
item
.
getCongestionTime
())
);
);
}
}
...
...
performance-web/src/main/java/com/clx/performance/dao/impl/linewarn/LineWarnInfoDaoImpl.java
浏览文件 @
30b32641
...
@@ -38,7 +38,7 @@ public class LineWarnInfoDaoImpl extends BaseDaoImpl<LineWarnInfoMapper, LineWar
...
@@ -38,7 +38,7 @@ public class LineWarnInfoDaoImpl extends BaseDaoImpl<LineWarnInfoMapper, LineWar
public
boolean
updateSuspendTime
(
LineWarnInfo
item
)
{
public
boolean
updateSuspendTime
(
LineWarnInfo
item
)
{
return
update
(
lUdWrapper
()
return
update
(
lUdWrapper
()
.
eq
(
LineWarnInfo:
:
get
WarnConfigId
,
item
.
getWarnConfig
Id
())
.
eq
(
LineWarnInfo:
:
get
Id
,
item
.
get
Id
())
.
ne
(
LineWarnInfo:
:
getStatus
,
LineWarnInfoEnum
.
Status
.
RESOLVE
.
getCode
())
.
ne
(
LineWarnInfo:
:
getStatus
,
LineWarnInfoEnum
.
Status
.
RESOLVE
.
getCode
())
.
set
(
LineWarnInfo:
:
getSuspendTime
,
item
.
getSuspendTime
())
.
set
(
LineWarnInfo:
:
getSuspendTime
,
item
.
getSuspendTime
())
);
);
...
...
performance-web/src/main/java/com/clx/performance/mapper/OrderChildMapper.java
浏览文件 @
30b32641
...
@@ -122,38 +122,47 @@ public interface OrderChildMapper extends BaseMapper<OrderChild> {
...
@@ -122,38 +122,47 @@ public interface OrderChildMapper extends BaseMapper<OrderChild> {
@SelectProvider
(
type
=
OrderChildSqlProvider
.
class
,
method
=
"statisticsTruckMonth"
)
@SelectProvider
(
type
=
OrderChildSqlProvider
.
class
,
method
=
"statisticsTruckMonth"
)
MonthInComeAndOrderedVO
statisticsTruckMonth
(
@Param
(
"startTime"
)
LocalDateTime
startTime
,
@Param
(
"endTime"
)
LocalDateTime
endTime
,
@Param
(
"truckNo"
)
String
truckNo
);
MonthInComeAndOrderedVO
statisticsTruckMonth
(
@Param
(
"startTime"
)
LocalDateTime
startTime
,
@Param
(
"endTime"
)
LocalDateTime
endTime
,
@Param
(
"truckNo"
)
String
truckNo
);
@Select
(
"select sum(weight) from order_child where order_goods_no=#{orderGoodsNo} and status in(10,20,30,40,50,60,70,80,90,100)"
)
@Select
(
"select sum(if (status>=50, load_net, #{defaultWeight})) from order_child "
+
BigDecimal
sumTakeWeightByOrderGoodsNo
(
String
orderGoodsNo
);
" where order_goods_no=#{orderGoodsNo} and status in(10,20,30,40,50,60,70,80,90,100)"
)
BigDecimal
sumTakeWeightByOrderGoodsNo
(
String
orderGoodsNo
,
BigDecimal
defaultWeight
);
@Select
(
"select sum(weight) from order_child where order_goods_no=#{orderGoodsNo} and status in(50,60,70,80,90,100)"
)
@Select
(
"select sum(load_net) from order_child "
+
" where order_goods_no=#{orderGoodsNo} and status in(50,60,70,80,90,100)"
)
BigDecimal
sumLoadWeightByOrderGoodsNo
(
String
orderGoodsNo
);
BigDecimal
sumLoadWeightByOrderGoodsNo
(
String
orderGoodsNo
);
@Select
(
"select sum(weight) from order_child where order_goods_no=#{orderGoodsNo} and status in(80,90,100)"
)
@Select
(
"select sum(if (unload_net>load_net, load_net, unload_net)) from order_child "
+
" where order_goods_no=#{orderGoodsNo} and status in(80,90,100)"
)
BigDecimal
sumUnloadWeightByOrderGoodsNo
(
String
orderGoodsNo
);
BigDecimal
sumUnloadWeightByOrderGoodsNo
(
String
orderGoodsNo
);
@Select
(
"<script>select order_goods_no, count(*) num from order_child where status in(10,20,30,40,50,60,70,80,90,100) "
+
@Select
(
"<script>select order_goods_no, count(*) num from order_child "
+
" and order_goods_no in <foreach collection='list' item='item' open='(' separator=',' close=')'>#{item}</foreach> "
+
" where status in(10,20,30,40,50,60,70,80,90,100) "
+
" and order_goods_no "
+
" in <foreach collection='list' item='item' open='(' separator=',' close=')'>#{item}</foreach> "
+
" group by order_goods_no "
+
" group by order_goods_no "
+
"</script>"
)
"</script>"
)
List
<
LineWarnOrderChildStatisticsDTO
>
sumTakeNumByOrderGoodsNoList
(
List
<
String
>
orderGoodsNoList
);
List
<
LineWarnOrderChildStatisticsDTO
>
sumTakeNumByOrderGoodsNoList
(
List
<
String
>
orderGoodsNoList
);
@Select
(
"<script>select order_goods_no, count(*) num from order_child where status in(40,50,60,70,80,90,100) "
+
@Select
(
"<script>select order_goods_no, count(*) num from order_child where status in(40,50,60,70,80,90,100) "
+
" and order_goods_no in <foreach collection='list' item='item' open='(' separator=',' close=')'>#{item}</foreach> "
+
" and order_goods_no "
+
" in <foreach collection='list' item='item' open='(' separator=',' close=')'>#{item}</foreach> "
+
" group by order_goods_no "
+
" group by order_goods_no "
+
"</script>"
)
"</script>"
)
List
<
LineWarnOrderChildStatisticsDTO
>
sumArriveSendNumByOrderGoodsNoList
(
List
<
String
>
orderGoodsNoList
);
List
<
LineWarnOrderChildStatisticsDTO
>
sumArriveSendNumByOrderGoodsNoList
(
List
<
String
>
orderGoodsNoList
);
@Select
(
"<script>select order_goods_no, count(*) num from order_child where status in(50,60,70,80,90,100) "
+
@Select
(
"<script>select order_goods_no, count(*) num from order_child where status in(50,60,70,80,90,100) "
+
" and order_goods_no in <foreach collection='list' item='item' open='(' separator=',' close=')'>#{item}</foreach> "
+
" and order_goods_no "
+
" in <foreach collection='list' item='item' open='(' separator=',' close=')'>#{item}</foreach> "
+
" group by order_goods_no "
+
" group by order_goods_no "
+
"</script>"
)
"</script>"
)
List
<
LineWarnOrderChildStatisticsDTO
>
sumLoadNumByOrderGoodsNoList
(
List
<
String
>
orderGoodsNoList
);
List
<
LineWarnOrderChildStatisticsDTO
>
sumLoadNumByOrderGoodsNoList
(
List
<
String
>
orderGoodsNoList
);
@Select
(
"<script>select order_goods_no, count(*) num from order_child where status in(70,80,90,100) "
+
@Select
(
"<script>select order_goods_no, count(*) num from order_child where status in(70,80,90,100) "
+
" and order_goods_no in <foreach collection='list' item='item' open='(' separator=',' close=')'>#{item}</foreach> "
+
" and order_goods_no "
+
" in <foreach collection='list' item='item' open='(' separator=',' close=')'>#{item}</foreach> "
+
" group by order_goods_no "
+
" group by order_goods_no "
+
"</script>"
)
"</script>"
)
List
<
LineWarnOrderChildStatisticsDTO
>
sumArriveRecieveNumByOrderGoodsNoList
(
List
<
String
>
orderGoodsNoList
);
List
<
LineWarnOrderChildStatisticsDTO
>
sumArriveRecieveNumByOrderGoodsNoList
(
List
<
String
>
orderGoodsNoList
);
@Select
(
"<script>select order_goods_no, count(*) num from order_child where status in(80,90,100) "
+
@Select
(
"<script>select order_goods_no, count(*) num from order_child where status in(80,90,100) "
+
" and order_goods_no in <foreach collection='list' item='item' open='(' separator=',' close=')'>#{item}</foreach> "
+
" and order_goods_no "
+
" in <foreach collection='list' item='item' open='(' separator=',' close=')'>#{item}</foreach> "
+
" group by order_goods_no "
+
" group by order_goods_no "
+
"</script>"
)
"</script>"
)
List
<
LineWarnOrderChildStatisticsDTO
>
sumUnloadNumByOrderGoodsNoList
(
List
<
String
>
orderGoodsNoList
);
List
<
LineWarnOrderChildStatisticsDTO
>
sumUnloadNumByOrderGoodsNoList
(
List
<
String
>
orderGoodsNoList
);
...
...
performance-web/src/main/java/com/clx/performance/service/impl/linewarn/LineWarnCommonServiceImpl.java
浏览文件 @
30b32641
...
@@ -68,4 +68,18 @@ public class LineWarnCommonServiceImpl implements LineWarnCommonService {
...
@@ -68,4 +68,18 @@ public class LineWarnCommonServiceImpl implements LineWarnCommonService {
lineWarnMqService
.
lineWarnNotice
(
lineWarnInfo
.
getId
());
lineWarnMqService
.
lineWarnNotice
(
lineWarnInfo
.
getId
());
}
}
/**
* 暂停检测
*/
@Override
public
boolean
suspendCheck
(
LineWarnInfo
lineWarnInfo
){
if
(
lineWarnInfo
==
null
)
{
return
false
;}
if
(
lineWarnInfo
.
getSuspendTime
()
!=
null
&&
lineWarnInfo
.
getSuspendTime
().
isAfter
(
LocalDateTime
.
now
())){
return
true
;
}
return
false
;
}
}
}
performance-web/src/main/java/com/clx/performance/service/impl/linewarn/LineWarnConfigServiceImpl.java
浏览文件 @
30b32641
...
@@ -2,9 +2,11 @@ package com.clx.performance.service.impl.linewarn;
...
@@ -2,9 +2,11 @@ package com.clx.performance.service.impl.linewarn;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.clx.performance.dao.linewarn.LineWarnConfigDao
;
import
com.clx.performance.dao.linewarn.LineWarnConfigDao
;
import
com.clx.performance.dao.linewarn.LineWarnInfoDao
;
import
com.clx.performance.enums.ResultEnum
;
import
com.clx.performance.enums.ResultEnum
;
import
com.clx.performance.enums.linewarn.LineWarnConfigEnum
;
import
com.clx.performance.enums.linewarn.LineWarnConfigEnum
;
import
com.clx.performance.model.linewarn.LineWarnConfig
;
import
com.clx.performance.model.linewarn.LineWarnConfig
;
import
com.clx.performance.model.vehiclewarn.VehicleWarnInfo
;
import
com.clx.performance.param.pc.linewarn.*
;
import
com.clx.performance.param.pc.linewarn.*
;
import
com.clx.performance.service.linewarn.LineWarnConfigService
;
import
com.clx.performance.service.linewarn.LineWarnConfigService
;
import
com.clx.performance.struct.linewarn.LineWarnConfigStruct
;
import
com.clx.performance.struct.linewarn.LineWarnConfigStruct
;
...
@@ -32,6 +34,9 @@ public class LineWarnConfigServiceImpl implements LineWarnConfigService {
...
@@ -32,6 +34,9 @@ public class LineWarnConfigServiceImpl implements LineWarnConfigService {
@Autowired
@Autowired
private
LineWarnConfigStruct
lineWarnConfigStruct
;
private
LineWarnConfigStruct
lineWarnConfigStruct
;
@Autowired
private
LineWarnInfoDao
lineWarnInfoDao
;
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
@Override
public
void
saveConfig
(
LineWarnConfigAddParam
param
)
{
public
void
saveConfig
(
LineWarnConfigAddParam
param
)
{
...
@@ -77,6 +82,11 @@ public class LineWarnConfigServiceImpl implements LineWarnConfigService {
...
@@ -77,6 +82,11 @@ public class LineWarnConfigServiceImpl implements LineWarnConfigService {
lineWarnConfig
.
setTaskCompleteRatio
(
param
.
getTaskCompleteRatio
());
lineWarnConfig
.
setTaskCompleteRatio
(
param
.
getTaskCompleteRatio
());
lineWarnConfig
.
setCongestionTime
(
param
.
getCongestionTime
());
lineWarnConfig
.
setCongestionTime
(
param
.
getCongestionTime
());
lineWarnConfigDao
.
updateConfig
(
lineWarnConfig
);
lineWarnConfigDao
.
updateConfig
(
lineWarnConfig
);
// 同步历史数据
VehicleWarnInfo
vehicleWarnInfo
=
new
VehicleWarnInfo
();
lineWarnInfoDao
.
updateByConfig
(
lineWarnConfig
.
getId
()
,
lineWarnConfig
.
getWarnName
(),
lineWarnConfig
.
getWarnLevel
());
}
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
@Override
...
...
performance-web/src/main/java/com/clx/performance/service/impl/linewarn/LineWarnCongestionWarnServiceImpl.java
浏览文件 @
30b32641
...
@@ -57,6 +57,10 @@ public class LineWarnCongestionWarnServiceImpl implements LineWarnCongestionWarn
...
@@ -57,6 +57,10 @@ public class LineWarnCongestionWarnServiceImpl implements LineWarnCongestionWarn
return
;
return
;
}
}
// 暂停检测
boolean
suspend
=
lineWarnCommonService
.
suspendCheck
(
lineWarnInfo
);
if
(
suspend
)
{
return
;}
// 检测是否拥堵
// 检测是否拥堵
Boolean
flag
=
internalReportService
.
checkLineJam
(
orderGoods
.
getSendSystemAddressId
(),
Boolean
flag
=
internalReportService
.
checkLineJam
(
orderGoods
.
getSendSystemAddressId
(),
orderGoods
.
getReceiveSystemAddressId
(),
orderGoods
.
getReceiveSystemAddressId
(),
...
...
performance-web/src/main/java/com/clx/performance/service/impl/linewarn/LineWarnInfoServiceImpl.java
浏览文件 @
30b32641
...
@@ -3,6 +3,7 @@ package com.clx.performance.service.impl.linewarn;
...
@@ -3,6 +3,7 @@ package com.clx.performance.service.impl.linewarn;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.clx.performance.dao.OrderChildDao
;
import
com.clx.performance.dao.OrderChildDao
;
import
com.clx.performance.dao.OrderGoodsDao
;
import
com.clx.performance.dao.linewarn.LineWarnInfoDao
;
import
com.clx.performance.dao.linewarn.LineWarnInfoDao
;
import
com.clx.performance.dao.linewarn.LineWarnLogDao
;
import
com.clx.performance.dao.linewarn.LineWarnLogDao
;
import
com.clx.performance.dao.linewarn.LineWarnRangeDao
;
import
com.clx.performance.dao.linewarn.LineWarnRangeDao
;
...
@@ -11,6 +12,7 @@ import com.clx.performance.enums.ResultEnum;
...
@@ -11,6 +12,7 @@ import com.clx.performance.enums.ResultEnum;
import
com.clx.performance.enums.linewarn.LineWarnInfoEnum
;
import
com.clx.performance.enums.linewarn.LineWarnInfoEnum
;
import
com.clx.performance.enums.linewarn.LineWarnLogEnum
;
import
com.clx.performance.enums.linewarn.LineWarnLogEnum
;
import
com.clx.performance.enums.linewarn.LineWarnRangEnum
;
import
com.clx.performance.enums.linewarn.LineWarnRangEnum
;
import
com.clx.performance.model.OrderGoods
;
import
com.clx.performance.model.linewarn.LineWarnInfo
;
import
com.clx.performance.model.linewarn.LineWarnInfo
;
import
com.clx.performance.model.linewarn.LineWarnLog
;
import
com.clx.performance.model.linewarn.LineWarnLog
;
import
com.clx.performance.model.linewarn.LineWarnRange
;
import
com.clx.performance.model.linewarn.LineWarnRange
;
...
@@ -49,6 +51,8 @@ public class LineWarnInfoServiceImpl implements LineWarnInfoService {
...
@@ -49,6 +51,8 @@ public class LineWarnInfoServiceImpl implements LineWarnInfoService {
@Autowired
@Autowired
private
OrderChildDao
orderChildDao
;
private
OrderChildDao
orderChildDao
;
@Autowired
private
OrderGoodsDao
orderGoodsDao
;
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
@Override
...
@@ -120,12 +124,15 @@ public class LineWarnInfoServiceImpl implements LineWarnInfoService {
...
@@ -120,12 +124,15 @@ public class LineWarnInfoServiceImpl implements LineWarnInfoService {
// 更新车数统计数据
// 更新车数统计数据
List
<
String
>
orderGoodsNoList
=
page
.
getRecords
().
stream
().
map
(
item
->
item
.
getOrderGoodsNo
()).
collect
(
Collectors
.
toList
());
List
<
String
>
orderGoodsNoList
=
page
.
getRecords
().
stream
().
map
(
item
->
item
.
getOrderGoodsNo
()).
collect
(
Collectors
.
toList
());
if
(!
orderGoodsNoList
.
isEmpty
())
{
if
(!
orderGoodsNoList
.
isEmpty
())
{
List
<
OrderGoods
>
pengList
=
orderGoodsDao
.
selectListByOrderGoodsList
(
orderGoodsNoList
);
List
<
LineWarnOrderChildStatisticsDTO
>
takeList
=
orderChildDao
.
sumTakeNumByOrderGoodsNoList
(
orderGoodsNoList
);
List
<
LineWarnOrderChildStatisticsDTO
>
takeList
=
orderChildDao
.
sumTakeNumByOrderGoodsNoList
(
orderGoodsNoList
);
List
<
LineWarnOrderChildStatisticsDTO
>
sendList
=
orderChildDao
.
sumArriveSendNumByOrderGoodsNoList
(
orderGoodsNoList
);
List
<
LineWarnOrderChildStatisticsDTO
>
sendList
=
orderChildDao
.
sumArriveSendNumByOrderGoodsNoList
(
orderGoodsNoList
);
List
<
LineWarnOrderChildStatisticsDTO
>
loadList
=
orderChildDao
.
sumLoadNumByOrderGoodsNoList
(
orderGoodsNoList
);
List
<
LineWarnOrderChildStatisticsDTO
>
loadList
=
orderChildDao
.
sumLoadNumByOrderGoodsNoList
(
orderGoodsNoList
);
List
<
LineWarnOrderChildStatisticsDTO
>
receiveList
=
orderChildDao
.
sumArriveRecieveNumByOrderGoodsNoList
(
orderGoodsNoList
);
List
<
LineWarnOrderChildStatisticsDTO
>
receiveList
=
orderChildDao
.
sumArriveRecieveNumByOrderGoodsNoList
(
orderGoodsNoList
);
List
<
LineWarnOrderChildStatisticsDTO
>
unloadList
=
orderChildDao
.
sumUnloadNumByOrderGoodsNoList
(
orderGoodsNoList
);
List
<
LineWarnOrderChildStatisticsDTO
>
unloadList
=
orderChildDao
.
sumUnloadNumByOrderGoodsNoList
(
orderGoodsNoList
);
Map
<
String
,
OrderGoods
>
pengMap
=
pengList
.
stream
().
collect
(
Collectors
.
toMap
(
item
->
item
.
getOrderGoodsNo
(),
item
->
item
));
Map
<
String
,
LineWarnOrderChildStatisticsDTO
>
takeMap
=
takeList
.
stream
().
collect
(
Collectors
.
toMap
(
item
->
item
.
getOrderGoodsNo
(),
item
->
item
));
Map
<
String
,
LineWarnOrderChildStatisticsDTO
>
takeMap
=
takeList
.
stream
().
collect
(
Collectors
.
toMap
(
item
->
item
.
getOrderGoodsNo
(),
item
->
item
));
Map
<
String
,
LineWarnOrderChildStatisticsDTO
>
sendMap
=
sendList
.
stream
().
collect
(
Collectors
.
toMap
(
item
->
item
.
getOrderGoodsNo
(),
item
->
item
));
Map
<
String
,
LineWarnOrderChildStatisticsDTO
>
sendMap
=
sendList
.
stream
().
collect
(
Collectors
.
toMap
(
item
->
item
.
getOrderGoodsNo
(),
item
->
item
));
Map
<
String
,
LineWarnOrderChildStatisticsDTO
>
loadMap
=
loadList
.
stream
().
collect
(
Collectors
.
toMap
(
item
->
item
.
getOrderGoodsNo
(),
item
->
item
));
Map
<
String
,
LineWarnOrderChildStatisticsDTO
>
loadMap
=
loadList
.
stream
().
collect
(
Collectors
.
toMap
(
item
->
item
.
getOrderGoodsNo
(),
item
->
item
));
...
@@ -133,6 +140,7 @@ public class LineWarnInfoServiceImpl implements LineWarnInfoService {
...
@@ -133,6 +140,7 @@ public class LineWarnInfoServiceImpl implements LineWarnInfoService {
Map
<
String
,
LineWarnOrderChildStatisticsDTO
>
unloadMap
=
unloadList
.
stream
().
collect
(
Collectors
.
toMap
(
item
->
item
.
getOrderGoodsNo
(),
item
->
item
));
Map
<
String
,
LineWarnOrderChildStatisticsDTO
>
unloadMap
=
unloadList
.
stream
().
collect
(
Collectors
.
toMap
(
item
->
item
.
getOrderGoodsNo
(),
item
->
item
));
for
(
LineWarnInfoVO
item
:
page
.
getRecords
())
{
for
(
LineWarnInfoVO
item
:
page
.
getRecords
())
{
item
.
setPengNum
(
pengMap
.
get
(
item
.
getOrderGoodsNo
())
==
null
?
0
:
pengMap
.
get
(
item
.
getOrderGoodsNo
()).
getNeedTruckNum
());
item
.
setTakeNum
(
takeMap
.
get
(
item
.
getOrderGoodsNo
())
==
null
?
0
:
takeMap
.
get
(
item
.
getOrderGoodsNo
()).
getNum
());
item
.
setTakeNum
(
takeMap
.
get
(
item
.
getOrderGoodsNo
())
==
null
?
0
:
takeMap
.
get
(
item
.
getOrderGoodsNo
()).
getNum
());
item
.
setArriveSendNum
(
sendMap
.
get
(
item
.
getOrderGoodsNo
())
==
null
?
0
:
sendMap
.
get
(
item
.
getOrderGoodsNo
()).
getNum
());
item
.
setArriveSendNum
(
sendMap
.
get
(
item
.
getOrderGoodsNo
())
==
null
?
0
:
sendMap
.
get
(
item
.
getOrderGoodsNo
()).
getNum
());
item
.
setLoadNum
(
loadMap
.
get
(
item
.
getOrderGoodsNo
())
==
null
?
0
:
loadMap
.
get
(
item
.
getOrderGoodsNo
()).
getNum
());
item
.
setLoadNum
(
loadMap
.
get
(
item
.
getOrderGoodsNo
())
==
null
?
0
:
loadMap
.
get
(
item
.
getOrderGoodsNo
()).
getNum
());
...
...
performance-web/src/main/java/com/clx/performance/service/impl/linewarn/LineWarnLineWarnServiceImpl.java
浏览文件 @
30b32641
...
@@ -55,6 +55,10 @@ public class LineWarnLineWarnServiceImpl implements LineWarnLineWarnService {
...
@@ -55,6 +55,10 @@ public class LineWarnLineWarnServiceImpl implements LineWarnLineWarnService {
return
;
return
;
}
}
// 暂停检测
boolean
suspend
=
lineWarnCommonService
.
suspendCheck
(
lineWarnInfo
);
if
(
suspend
)
{
return
;}
// 检测线路是否异常
// 检测线路是否异常
Boolean
flag
=
internalReportService
.
checkLineAbnormal
(
orderGoods
.
getSendSystemAddressId
(),
Boolean
flag
=
internalReportService
.
checkLineAbnormal
(
orderGoods
.
getSendSystemAddressId
(),
orderGoods
.
getReceiveSystemAddressId
(),
orderGoods
.
getReceiveSystemAddressId
(),
...
...
performance-web/src/main/java/com/clx/performance/service/impl/linewarn/LineWarnLoadWarnServiceImpl.java
浏览文件 @
30b32641
...
@@ -17,6 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -17,6 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.math.RoundingMode
;
import
java.time.Duration
;
import
java.time.Duration
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.util.Arrays
;
import
java.util.Arrays
;
...
@@ -47,6 +48,8 @@ public class LineWarnLoadWarnServiceImpl implements LineWarnLoadWarnService {
...
@@ -47,6 +48,8 @@ public class LineWarnLoadWarnServiceImpl implements LineWarnLoadWarnService {
int
needTime
=
unloadTimeAvg
+
arriveReceiveExpectTime
;
int
needTime
=
unloadTimeAvg
+
arriveReceiveExpectTime
;
// 接单最长时间
// 接单最长时间
long
difTime
=
totalTime
-
needTime
;
long
difTime
=
totalTime
-
needTime
;
if
(
difTime
<
0
){
difTime
=
0
;}
// 任务量
// 任务量
BigDecimal
taskWeight
=
lineWarnCommonInfo
.
getTaskWeight
();
BigDecimal
taskWeight
=
lineWarnCommonInfo
.
getTaskWeight
();
...
@@ -54,8 +57,9 @@ public class LineWarnLoadWarnServiceImpl implements LineWarnLoadWarnService {
...
@@ -54,8 +57,9 @@ public class LineWarnLoadWarnServiceImpl implements LineWarnLoadWarnService {
BigDecimal
taskCompleteRatio
=
BigDecimal
.
ZERO
;
BigDecimal
taskCompleteRatio
=
BigDecimal
.
ZERO
;
BigDecimal
weight
=
orderChildDao
.
sumLoadWeightByOrderGoodsNo
(
orderGoods
.
getOrderGoodsNo
());
BigDecimal
weight
=
orderChildDao
.
sumLoadWeightByOrderGoodsNo
(
orderGoods
.
getOrderGoodsNo
());
if
(
weight
!=
null
){
if
(
weight
!=
null
){
taskCompleteRatio
=
weight
.
divide
(
taskWeight
,
4
,
BigDecimal
.
ROUND_
UP
).
movePointRight
(
2
);
taskCompleteRatio
=
weight
.
divide
(
taskWeight
,
4
,
RoundingMode
.
UP
).
movePointRight
(
2
);
}
}
log
.
info
(
"装车预警,任务量:{}, 完成量:{}, 任务完成率:{}, 总时间:{}, 需要时间:{}, 相差时间:{}"
,
taskWeight
,
weight
,
taskCompleteRatio
,
totalTime
,
needTime
,
difTime
);
List
<
LineWarnConfig
>
lineWarnConfigList
=
lineWarnConfigDao
List
<
LineWarnConfig
>
lineWarnConfigList
=
lineWarnConfigDao
.
listByWarnType
(
LineWarnConfigEnum
.
WarnType
.
LOAD
.
getCode
());
.
listByWarnType
(
LineWarnConfigEnum
.
WarnType
.
LOAD
.
getCode
());
...
@@ -76,12 +80,16 @@ public class LineWarnLoadWarnServiceImpl implements LineWarnLoadWarnService {
...
@@ -76,12 +80,16 @@ public class LineWarnLoadWarnServiceImpl implements LineWarnLoadWarnService {
return
;
return
;
}
}
int
time
=
lineWarnConfig
.
getTimeRatio
().
multiply
(
new
BigDecimal
(
difTime
)).
intValue
();
// 暂停检测
boolean
suspend
=
lineWarnCommonService
.
suspendCheck
(
lineWarnInfo
);
if
(
suspend
)
{
return
;}
int
time
=
lineWarnConfig
.
getTimeRatio
().
multiply
(
new
BigDecimal
(
difTime
)).
movePointLeft
(
2
).
intValue
();
// 未达到时间占比
// 未达到时间占比
if
(
pendingOrderTime
.
plusMinutes
(
time
).
isAfter
(
LocalDateTime
.
now
())){
return
;}
if
(
pendingOrderTime
.
plusMinutes
(
time
).
isAfter
(
LocalDateTime
.
now
())){
return
;}
// 达到任务占比
// 达到任务占比
if
(
lineWarnConfig
.
getTaskCompleteRatio
().
compareTo
(
taskCompleteRatio
)
>=
0
)
{
return
;}
if
(
lineWarnConfig
.
getTaskCompleteRatio
().
compareTo
(
taskCompleteRatio
)
<
0
)
{
return
;}
// 更新
// 更新
lineWarnCommonService
.
lineWarnInfoUpdate
(
orderGoods
,
lineWarnInfo
,
lineWarnConfig
);
lineWarnCommonService
.
lineWarnInfoUpdate
(
orderGoods
,
lineWarnInfo
,
lineWarnConfig
);
...
...
performance-web/src/main/java/com/clx/performance/service/impl/linewarn/LineWarnMqHandlerServiceImpl.java
浏览文件 @
30b32641
...
@@ -47,6 +47,7 @@ public class LineWarnMqHandlerServiceImpl implements LineWarnMqHandlerService {
...
@@ -47,6 +47,7 @@ public class LineWarnMqHandlerServiceImpl implements LineWarnMqHandlerService {
// 缺省装卸车时间
// 缺省装卸车时间
private
static
final
int
DEFAULT_LOAD_UNLOAD_TIME
=
60
;
private
static
final
int
DEFAULT_LOAD_UNLOAD_TIME
=
60
;
private
static
final
int
DEFAULT_LOAD_UNLOAD_DAY
=
7
;
private
static
final
int
DEFAULT_LOAD_UNLOAD_DAY
=
7
;
private
static
final
int
SECOND_PER_MIN
=
60
;
@Autowired
@Autowired
private
ClxMessageConfig
clxMessageConfig
;
private
ClxMessageConfig
clxMessageConfig
;
...
@@ -94,14 +95,14 @@ public class LineWarnMqHandlerServiceImpl implements LineWarnMqHandlerService {
...
@@ -94,14 +95,14 @@ public class LineWarnMqHandlerServiceImpl implements LineWarnMqHandlerService {
.
getOrderInfo
(
orderGoods
.
getOrderNo
()).
orElseThrow
(
ResultEnum
.
DATA_NOT_FIND
);
.
getOrderInfo
(
orderGoods
.
getOrderNo
()).
orElseThrow
(
ResultEnum
.
DATA_NOT_FIND
);
// 计算货源地到
// 计算货源地到
int
arrive
Send
ExpectTime
=
gdUtils
.
getNeedTime
(
new
BigDecimal
[]{
orderGoods
.
getSendLongitude
(),
int
arrive
Receive
ExpectTime
=
gdUtils
.
getNeedTime
(
new
BigDecimal
[]{
orderGoods
.
getSendLongitude
(),
orderGoods
.
getSendLatitude
()},
orderGoods
.
getReceiveLongitude
(),
orderGoods
.
getReceiveLatitude
());
orderGoods
.
getSendLatitude
()},
orderGoods
.
getReceiveLongitude
(),
orderGoods
.
getReceiveLatitude
());
LineWarnOrderGoods
lineWarnOrderGoods
=
new
LineWarnOrderGoods
();
LineWarnOrderGoods
lineWarnOrderGoods
=
new
LineWarnOrderGoods
();
lineWarnOrderGoods
.
setOrderGoodsNo
(
orderGoods
.
getOrderGoodsNo
());
lineWarnOrderGoods
.
setOrderGoodsNo
(
orderGoods
.
getOrderGoodsNo
());
lineWarnOrderGoods
.
setTransportEndTime
(
LocalDateTimeUtils
.
parseTime
(
orderInfo
.
getTransportEndTime
()));
lineWarnOrderGoods
.
setTransportEndTime
(
LocalDateTimeUtils
.
parseTime
(
orderInfo
.
getTransportEndTime
()));
lineWarnOrderGoods
.
setPendingOrderTime
(
orderGoods
.
getPendingOrderTime
());
lineWarnOrderGoods
.
setPendingOrderTime
(
orderGoods
.
getPendingOrderTime
());
lineWarnOrderGoods
.
setArriveReceiveExpectTime
(
arrive
SendExpectTime
==
0
?
null
:
arriveSend
ExpectTime
);
lineWarnOrderGoods
.
setArriveReceiveExpectTime
(
arrive
ReceiveExpectTime
==
0
?
null
:
arriveReceive
ExpectTime
);
lineWarnOrderGoodsDao
.
saveEntity
(
lineWarnOrderGoods
);
lineWarnOrderGoodsDao
.
saveEntity
(
lineWarnOrderGoods
);
}
}
...
@@ -126,12 +127,18 @@ public class LineWarnMqHandlerServiceImpl implements LineWarnMqHandlerService {
...
@@ -126,12 +127,18 @@ public class LineWarnMqHandlerServiceImpl implements LineWarnMqHandlerService {
.
loadTimeAvg
(
orderGoods
.
getSendAddressId
(),
orderGoods
.
getReceiveAddressId
(),
.
loadTimeAvg
(
orderGoods
.
getSendAddressId
(),
orderGoods
.
getReceiveAddressId
(),
orderGoods
.
getSendSystemAddressId
(),
orderGoods
.
getReceiveSystemAddressId
(),
orderGoods
.
getSendSystemAddressId
(),
orderGoods
.
getReceiveSystemAddressId
(),
LocalDateTimeUtils
.
formatTime
(
LocalDateTime
.
now
().
minusDays
(
DEFAULT_LOAD_UNLOAD_DAY
)));
LocalDateTimeUtils
.
formatTime
(
LocalDateTime
.
now
().
minusDays
(
DEFAULT_LOAD_UNLOAD_DAY
)));
if
(
loadTimeAvg
==
null
)
{
loadTimeAvg
=
DEFAULT_LOAD_UNLOAD_TIME
;}
else
{
loadTimeAvg
=
loadTimeAvg
/
SECOND_PER_MIN
;}
Integer
unloadTimeAvg
=
orderChildDao
Integer
unloadTimeAvg
=
orderChildDao
.
unloadTimeAvg
(
orderGoods
.
getSendAddressId
(),
orderGoods
.
getReceiveAddressId
(),
.
unloadTimeAvg
(
orderGoods
.
getSendAddressId
(),
orderGoods
.
getReceiveAddressId
(),
orderGoods
.
getSendSystemAddressId
(),
orderGoods
.
getReceiveSystemAddressId
(),
orderGoods
.
getSendSystemAddressId
(),
orderGoods
.
getReceiveSystemAddressId
(),
LocalDateTimeUtils
.
formatTime
(
LocalDateTime
.
now
().
minusDays
(
DEFAULT_LOAD_UNLOAD_DAY
)));
LocalDateTimeUtils
.
formatTime
(
LocalDateTime
.
now
().
minusDays
(
DEFAULT_LOAD_UNLOAD_DAY
)));
lineWarnCommonInfo
.
setLoadTimeAvg
(
loadTimeAvg
!=
null
?
loadTimeAvg:
DEFAULT_LOAD_UNLOAD_TIME
);
if
(
unloadTimeAvg
==
null
)
{
unloadTimeAvg
=
DEFAULT_LOAD_UNLOAD_TIME
;}
lineWarnCommonInfo
.
setUnloadTimeAvg
(
unloadTimeAvg
!=
null
?
unloadTimeAvg:
DEFAULT_LOAD_UNLOAD_TIME
);
else
{
unloadTimeAvg
=
unloadTimeAvg
/
SECOND_PER_MIN
;}
lineWarnCommonInfo
.
setLoadTimeAvg
(
loadTimeAvg
);
lineWarnCommonInfo
.
setUnloadTimeAvg
(
unloadTimeAvg
);
log
.
info
(
"线路预警, lineWarnCommonInfo:{}"
,
lineWarnCommonInfo
);
log
.
info
(
"线路预警, lineWarnCommonInfo:{}"
,
lineWarnCommonInfo
);
...
@@ -254,6 +261,7 @@ public class LineWarnMqHandlerServiceImpl implements LineWarnMqHandlerService {
...
@@ -254,6 +261,7 @@ public class LineWarnMqHandlerServiceImpl implements LineWarnMqHandlerService {
ClinkMessageReq
req
=
new
ClinkMessageReq
();
ClinkMessageReq
req
=
new
ClinkMessageReq
();
StringBuilder
sb
=
new
StringBuilder
();
StringBuilder
sb
=
new
StringBuilder
();
sb
.
append
(
"触发"
);
sb
.
append
(
"触发"
);
sb
.
append
(
warnName
);
sb
.
append
(
warnName
);
sb
.
append
(
"预警;货单"
);
sb
.
append
(
"预警;货单"
);
...
...
performance-web/src/main/java/com/clx/performance/service/impl/linewarn/LineWarnOrderChildWarnServiceImpl.java
浏览文件 @
30b32641
...
@@ -30,7 +30,7 @@ public class LineWarnOrderChildWarnServiceImpl implements LineWarnOrderChildWarn
...
@@ -30,7 +30,7 @@ public class LineWarnOrderChildWarnServiceImpl implements LineWarnOrderChildWarn
@Override
@Override
public
void
orderChildWarn
(
OrderGoods
orderGoods
)
{
public
void
orderChildWarn
(
OrderGoods
orderGoods
)
{
List
<
LineWarnConfig
>
lineWarnConfigList
=
lineWarnConfigDao
List
<
LineWarnConfig
>
lineWarnConfigList
=
lineWarnConfigDao
.
listByWarnType
(
LineWarnConfigEnum
.
WarnType
.
UNLOAD
.
getCode
());
.
listByWarnType
(
LineWarnConfigEnum
.
WarnType
.
CHILD_ABNORMAL
.
getCode
());
if
(
lineWarnConfigList
.
isEmpty
())
{
return
;}
if
(
lineWarnConfigList
.
isEmpty
())
{
return
;}
for
(
LineWarnConfig
item
:
lineWarnConfigList
)
{
for
(
LineWarnConfig
item
:
lineWarnConfigList
)
{
...
@@ -46,6 +46,10 @@ public class LineWarnOrderChildWarnServiceImpl implements LineWarnOrderChildWarn
...
@@ -46,6 +46,10 @@ public class LineWarnOrderChildWarnServiceImpl implements LineWarnOrderChildWarn
return
;
return
;
}
}
// 暂停检测
boolean
suspend
=
lineWarnCommonService
.
suspendCheck
(
lineWarnInfo
);
if
(
suspend
)
{
return
;}
// 更新
// 更新
lineWarnCommonService
.
lineWarnInfoUpdate
(
orderGoods
,
lineWarnInfo
,
lineWarnConfig
);
lineWarnCommonService
.
lineWarnInfoUpdate
(
orderGoods
,
lineWarnInfo
,
lineWarnConfig
);
}
}
...
...
performance-web/src/main/java/com/clx/performance/service/impl/linewarn/LineWarnTakeWarnServiceImpl.java
浏览文件 @
30b32641
package
com
.
clx
.
performance
.
service
.
impl
.
linewarn
;
package
com
.
clx
.
performance
.
service
.
impl
.
linewarn
;
import
com.clx.order.vo.feign.FeignOrderInfoVO
;
import
com.clx.performance.dao.OrderChildDao
;
import
com.clx.performance.dao.OrderChildDao
;
import
com.clx.performance.dao.linewarn.LineWarnConfigDao
;
import
com.clx.performance.dao.linewarn.LineWarnConfigDao
;
import
com.clx.performance.dao.linewarn.LineWarnInfoDao
;
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.dto.linewarn.LineWarnOrderChildStatisticsDTO
;
import
com.clx.performance.dto.linewarn.LineWarnOrderChildStatisticsDTO
;
import
com.clx.performance.enums.OrderEnum
;
import
com.clx.performance.enums.PerformanceResultEnum
;
import
com.clx.performance.enums.linewarn.LineWarnConfigEnum
;
import
com.clx.performance.enums.linewarn.LineWarnConfigEnum
;
import
com.clx.performance.enums.linewarn.LineWarnInfoEnum
;
import
com.clx.performance.enums.linewarn.LineWarnInfoEnum
;
import
com.clx.performance.extranal.user.OrderService
;
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.LineWarnConfig
;
import
com.clx.performance.model.linewarn.LineWarnInfo
;
import
com.clx.performance.model.linewarn.LineWarnInfo
;
...
@@ -17,6 +21,7 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -17,6 +21,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.math.RoundingMode
;
import
java.time.Duration
;
import
java.time.Duration
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.util.Arrays
;
import
java.util.Arrays
;
...
@@ -28,6 +33,8 @@ import java.util.Objects;
...
@@ -28,6 +33,8 @@ import java.util.Objects;
public
class
LineWarnTakeWarnServiceImpl
implements
LineWarnTakeWarnService
{
public
class
LineWarnTakeWarnServiceImpl
implements
LineWarnTakeWarnService
{
// 默认时间
// 默认时间
private
static
final
int
DEFAULT_TIME
=
60
;
private
static
final
int
DEFAULT_TIME
=
60
;
private
static
final
BigDecimal
OVER_WEIGHT
=
new
BigDecimal
(
50
);
private
static
final
BigDecimal
STANDARD_WEIGHT
=
new
BigDecimal
(
35
);
@Autowired
@Autowired
private
LineWarnConfigDao
lineWarnConfigDao
;
private
LineWarnConfigDao
lineWarnConfigDao
;
@Autowired
@Autowired
...
@@ -36,6 +43,8 @@ public class LineWarnTakeWarnServiceImpl implements LineWarnTakeWarnService {
...
@@ -36,6 +43,8 @@ public class LineWarnTakeWarnServiceImpl implements LineWarnTakeWarnService {
private
LineWarnCommonService
lineWarnCommonService
;
private
LineWarnCommonService
lineWarnCommonService
;
@Autowired
@Autowired
private
OrderChildDao
orderChildDao
;
private
OrderChildDao
orderChildDao
;
@Autowired
private
OrderService
orderService
;
@Override
@Override
public
void
takeWarn
(
OrderGoods
orderGoods
,
LineWarnCommonInfoDTO
lineWarnCommonInfo
)
{
public
void
takeWarn
(
OrderGoods
orderGoods
,
LineWarnCommonInfoDTO
lineWarnCommonInfo
)
{
...
@@ -49,16 +58,25 @@ public class LineWarnTakeWarnServiceImpl implements LineWarnTakeWarnService {
...
@@ -49,16 +58,25 @@ public class LineWarnTakeWarnServiceImpl implements LineWarnTakeWarnService {
int
needTime
=
DEFAULT_TIME
+
loadTimeAvg
+
unloadTimeAvg
+
arriveReceiveExpectTime
;
int
needTime
=
DEFAULT_TIME
+
loadTimeAvg
+
unloadTimeAvg
+
arriveReceiveExpectTime
;
// 接单最长时间
// 接单最长时间
long
difTime
=
totalTime
-
needTime
;
long
difTime
=
totalTime
-
needTime
;
if
(
difTime
<
0
){
difTime
=
0
;}
// 任务量
// 任务量
BigDecimal
taskWeight
=
lineWarnCommonInfo
.
getTaskWeight
();
BigDecimal
taskWeight
=
lineWarnCommonInfo
.
getTaskWeight
();
// 任务完成率
// 任务完成率
BigDecimal
taskCompleteRatio
=
BigDecimal
.
ZERO
;
BigDecimal
taskCompleteRatio
=
BigDecimal
.
ZERO
;
BigDecimal
weight
=
orderChildDao
.
sumTakeWeightByOrderGoodsNo
(
orderGoods
.
getOrderGoodsNo
());
if
(
weight
!=
null
){
taskCompleteRatio
=
weight
.
divide
(
taskWeight
,
4
,
BigDecimal
.
ROUND_UP
).
movePointRight
(
2
);
}
FeignOrderInfoVO
orderInfo
=
orderService
.
getOrderInfo
(
orderGoods
.
getOrderNo
()).
orElseThrow
(
PerformanceResultEnum
.
ORDER_INVALID
);
BigDecimal
weight
=
orderChildDao
.
sumTakeWeightByOrderGoodsNo
(
orderGoods
.
getOrderGoodsNo
(),
Objects
.
equals
(
orderInfo
.
getOverWeight
(),
OrderEnum
.
OverWeight
.
YES
.
getCode
())
?
OVER_WEIGHT
:
STANDARD_WEIGHT
);
if
(
weight
==
null
)
{
weight
=
BigDecimal
.
ZERO
;}
taskCompleteRatio
=
weight
.
divide
(
taskWeight
,
4
,
RoundingMode
.
UP
).
movePointRight
(
2
);
log
.
info
(
"接单预警,任务量:{}, 完成量:{}, 任务完成率:{}, 总时间:{}, 需要时间:{}, 相差时间:{}"
,
taskWeight
,
weight
,
taskCompleteRatio
,
totalTime
,
needTime
,
difTime
);
List
<
LineWarnConfig
>
lineWarnConfigList
=
lineWarnConfigDao
List
<
LineWarnConfig
>
lineWarnConfigList
=
lineWarnConfigDao
.
listByWarnType
(
LineWarnConfigEnum
.
WarnType
.
TAKE
.
getCode
());
.
listByWarnType
(
LineWarnConfigEnum
.
WarnType
.
TAKE
.
getCode
());
if
(
lineWarnConfigList
.
isEmpty
())
{
return
;}
if
(
lineWarnConfigList
.
isEmpty
())
{
return
;}
...
@@ -78,12 +96,16 @@ public class LineWarnTakeWarnServiceImpl implements LineWarnTakeWarnService {
...
@@ -78,12 +96,16 @@ public class LineWarnTakeWarnServiceImpl implements LineWarnTakeWarnService {
return
;
return
;
}
}
int
time
=
lineWarnConfig
.
getTimeRatio
().
multiply
(
new
BigDecimal
(
difTime
)).
intValue
();
// 暂停检测
boolean
suspend
=
lineWarnCommonService
.
suspendCheck
(
lineWarnInfo
);
if
(
suspend
)
{
return
;}
int
time
=
lineWarnConfig
.
getTimeRatio
().
multiply
(
new
BigDecimal
(
difTime
)).
movePointLeft
(
2
).
intValue
();
// 未达到时间占比
// 未达到时间占比
if
(
pendingOrderTime
.
plusMinutes
(
time
).
isAfter
(
LocalDateTime
.
now
())){
return
;}
if
(
pendingOrderTime
.
plusMinutes
(
time
).
isAfter
(
LocalDateTime
.
now
())){
return
;}
// 达到任务占比
// 达到任务占比
if
(
lineWarnConfig
.
getTaskCompleteRatio
().
compareTo
(
taskCompleteRatio
)
>=
0
)
{
return
;}
if
(
lineWarnConfig
.
getTaskCompleteRatio
().
compareTo
(
taskCompleteRatio
)
<
0
)
{
return
;}
// 更新
// 更新
lineWarnCommonService
.
lineWarnInfoUpdate
(
orderGoods
,
lineWarnInfo
,
lineWarnConfig
);
lineWarnCommonService
.
lineWarnInfoUpdate
(
orderGoods
,
lineWarnInfo
,
lineWarnConfig
);
...
...
performance-web/src/main/java/com/clx/performance/service/impl/linewarn/LineWarnUnloadServiceImpl.java
浏览文件 @
30b32641
...
@@ -16,6 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -16,6 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.math.RoundingMode
;
import
java.time.Duration
;
import
java.time.Duration
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.util.List
;
import
java.util.List
;
...
@@ -42,15 +43,18 @@ public class LineWarnUnloadServiceImpl implements LineWarnUnloadWarnService {
...
@@ -42,15 +43,18 @@ public class LineWarnUnloadServiceImpl implements LineWarnUnloadWarnService {
int
needTime
=
0
;
int
needTime
=
0
;
// 接单最长时间
// 接单最长时间
long
difTime
=
totalTime
-
needTime
;
long
difTime
=
totalTime
-
needTime
;
if
(
difTime
<
0
){
difTime
=
0
;}
// 任务量
// 任务量
BigDecimal
taskWeight
=
lineWarnCommonInfo
.
getTaskWeight
();
BigDecimal
taskWeight
=
lineWarnCommonInfo
.
getTaskWeight
();
// 任务完成率
// 任务完成率
BigDecimal
taskCompleteRatio
=
BigDecimal
.
ZERO
;
BigDecimal
taskCompleteRatio
=
BigDecimal
.
ZERO
;
BigDecimal
weight
=
orderChildDao
.
sum
Take
WeightByOrderGoodsNo
(
orderGoods
.
getOrderGoodsNo
());
BigDecimal
weight
=
orderChildDao
.
sum
Unload
WeightByOrderGoodsNo
(
orderGoods
.
getOrderGoodsNo
());
if
(
weight
!=
null
){
if
(
weight
!=
null
){
taskCompleteRatio
=
weight
.
divide
(
taskWeight
,
4
,
BigDecimal
.
ROUND_
UP
).
movePointRight
(
2
);
taskCompleteRatio
=
weight
.
divide
(
taskWeight
,
4
,
RoundingMode
.
UP
).
movePointRight
(
2
);
}
}
log
.
info
(
"卸车预警,任务量:{}, 完成量:{}, 任务完成率:{}, 总时间:{}, 需要时间:{}, 相差时间:{}"
,
taskWeight
,
weight
,
taskCompleteRatio
,
totalTime
,
needTime
,
difTime
);
List
<
LineWarnConfig
>
lineWarnConfigList
=
lineWarnConfigDao
List
<
LineWarnConfig
>
lineWarnConfigList
=
lineWarnConfigDao
.
listByWarnType
(
LineWarnConfigEnum
.
WarnType
.
UNLOAD
.
getCode
());
.
listByWarnType
(
LineWarnConfigEnum
.
WarnType
.
UNLOAD
.
getCode
());
...
@@ -71,12 +75,16 @@ public class LineWarnUnloadServiceImpl implements LineWarnUnloadWarnService {
...
@@ -71,12 +75,16 @@ public class LineWarnUnloadServiceImpl implements LineWarnUnloadWarnService {
return
;
return
;
}
}
int
time
=
lineWarnConfig
.
getTimeRatio
().
multiply
(
new
BigDecimal
(
difTime
)).
intValue
();
// 暂停检测
boolean
suspend
=
lineWarnCommonService
.
suspendCheck
(
lineWarnInfo
);
if
(
suspend
)
{
return
;}
int
time
=
lineWarnConfig
.
getTimeRatio
().
multiply
(
new
BigDecimal
(
difTime
)).
movePointLeft
(
2
).
intValue
();
// 未达到时间占比
// 未达到时间占比
if
(
pendingOrderTime
.
plusMinutes
(
time
).
isAfter
(
LocalDateTime
.
now
())){
return
;}
if
(
pendingOrderTime
.
plusMinutes
(
time
).
isAfter
(
LocalDateTime
.
now
())){
return
;}
// 达到任务占比
// 达到任务占比
if
(
lineWarnConfig
.
getTaskCompleteRatio
().
compareTo
(
taskCompleteRatio
)
>=
0
)
{
return
;}
if
(
lineWarnConfig
.
getTaskCompleteRatio
().
compareTo
(
taskCompleteRatio
)
<
0
)
{
return
;}
// 更新
// 更新
lineWarnCommonService
.
lineWarnInfoUpdate
(
orderGoods
,
lineWarnInfo
,
lineWarnConfig
);
lineWarnCommonService
.
lineWarnInfoUpdate
(
orderGoods
,
lineWarnInfo
,
lineWarnConfig
);
...
...
performance-web/src/main/java/com/clx/performance/service/impl/linewarn/LineWarnWeatherWarnServiceImpl.java
浏览文件 @
30b32641
package
com
.
clx
.
performance
.
service
.
impl
.
linewarn
;
package
com
.
clx
.
performance
.
service
.
impl
.
linewarn
;
import
com.clx.order.vo.feign.FeignAddressVO
;
import
com.clx.order.vo.feign.FeignAddressVO
;
import
com.clx.performance.constant.RedisConstants
;
import
com.clx.performance.dao.linewarn.LineWarnConfigDao
;
import
com.clx.performance.dao.linewarn.LineWarnConfigDao
;
import
com.clx.performance.dao.linewarn.LineWarnInfoDao
;
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.LineWarnConfigEnum
;
import
com.clx.performance.enums.linewarn.LineWarnInfoEnum
;
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.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.LineWarnConfig
;
...
@@ -18,19 +18,20 @@ import com.msl.common.base.Optional;
...
@@ -18,19 +18,20 @@ import com.msl.common.base.Optional;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.Objects
;
import
java.util.concurrent.TimeUnit
;
@Slf4j
@Slf4j
@Service
@Service
public
class
LineWarnWeatherWarnServiceImpl
implements
LineWarnWeatherWarnService
{
public
class
LineWarnWeatherWarnServiceImpl
implements
LineWarnWeatherWarnService
{
@Autowired
@Autowired
private
LineWarnConfigDao
lineWarnConfigDao
;
private
LineWarnConfigDao
lineWarnConfigDao
;
@Autowired
private
InternalReportService
internalReportService
;
@Autowired
@Autowired
private
LineWarnCommonService
lineWarnCommonService
;
private
LineWarnCommonService
lineWarnCommonService
;
@Autowired
@Autowired
...
@@ -39,10 +40,15 @@ public class LineWarnWeatherWarnServiceImpl implements LineWarnWeatherWarnServic
...
@@ -39,10 +40,15 @@ public class LineWarnWeatherWarnServiceImpl implements LineWarnWeatherWarnServic
private
GdUtils
gdUtils
;
private
GdUtils
gdUtils
;
@Autowired
@Autowired
private
AddressService
addressService
;
private
AddressService
addressService
;
@Autowired
private
RedisTemplate
<
String
,
String
>
redisTemplate
;
@Override
@Override
public
void
weatherWarn
(
OrderGoods
orderGoods
,
LineWarnCommonInfoDTO
lineWarnCommonInfo
)
{
public
void
weatherWarn
(
OrderGoods
orderGoods
,
LineWarnCommonInfoDTO
lineWarnCommonInfo
)
{
Boolean
flag
=
redisTemplate
.
opsForValue
().
setIfAbsent
(
RedisConstants
.
LINE_WARN_WEATHER
+
orderGoods
.
getOrderGoodsNo
(),
orderGoods
.
getOrderGoodsNo
(),
1
,
TimeUnit
.
HOURS
);
if
(!
flag
)
{
return
;}
List
<
LineWarnConfig
>
lineWarnConfigList
=
lineWarnConfigDao
List
<
LineWarnConfig
>
lineWarnConfigList
=
lineWarnConfigDao
.
listByWarnType
(
LineWarnConfigEnum
.
WarnType
.
WEATHER
.
getCode
());
.
listByWarnType
(
LineWarnConfigEnum
.
WarnType
.
WEATHER
.
getCode
());
if
(
lineWarnConfigList
.
isEmpty
())
{
return
;}
if
(
lineWarnConfigList
.
isEmpty
())
{
return
;}
...
@@ -61,28 +67,47 @@ public class LineWarnWeatherWarnServiceImpl implements LineWarnWeatherWarnServic
...
@@ -61,28 +67,47 @@ public class LineWarnWeatherWarnServiceImpl implements LineWarnWeatherWarnServic
return
;
return
;
}
}
// 暂停检测
boolean
suspend
=
lineWarnCommonService
.
suspendCheck
(
lineWarnInfo
);
if
(
suspend
)
{
return
;}
String
weatherAll
=
""
;
Optional
<
FeignAddressVO
>
addressOptional
=
addressService
Optional
<
FeignAddressVO
>
addressOptional
=
addressService
.
getSendAndReceiveAddress
(
orderGoods
.
getSendAddressId
(),
orderGoods
.
getReceiveAddressId
());
.
getSendAndReceiveAddress
(
orderGoods
.
getSendAddressId
(),
orderGoods
.
getReceiveAddressId
());
if
(
addressOptional
.
isEmpty
())
{
return
;}
if
(
addressOptional
.
isEmpty
())
{
return
;}
FeignAddressVO
feignAddressVO
=
addressOptional
.
get
();
FeignAddressVO
feignAddressVO
=
addressOptional
.
get
();
if
(
feignAddressVO
.
getSendAddress
()!=
null
if
(
feignAddressVO
.
getSendAddress
()!=
null
){
&&
StringUtils
.
isNotBlank
(
feignAddressVO
.
getSendAddress
().
getCityCode
())){
String
cityCode
=
gdUtils
.
getCity
(
feignAddressVO
.
getSendAddress
().
getLongitude
(),
String
weather
=
gdUtils
.
getWeather
(
feignAddressVO
.
getSendAddress
().
getCityCode
());
feignAddressVO
.
getSendAddress
().
getLatitude
());
String
weather
=
gdUtils
.
getWeather
(
cityCode
);
if
(
weatherCheck
(
weather
)){
if
(
weatherCheck
(
weather
)){
weatherAll
=
weather
;
// 更新
// 更新
lineWarnCommonService
.
lineWarnInfoUpdate
(
orderGoods
,
lineWarnInfo
,
lineWarnConfig
,
weather
);
lineWarnCommonService
.
lineWarnInfoUpdate
(
orderGoods
,
lineWarnInfo
,
lineWarnConfig
,
weather
);
}
}
}
}
if
(
feignAddressVO
.
getReceiveAddress
()!=
null
if
(
feignAddressVO
.
getReceiveAddress
()!=
null
){
&&
StringUtils
.
isNotBlank
(
feignAddressVO
.
getReceiveAddress
().
getCityCode
())){
String
cityCode
=
gdUtils
.
getCity
(
feignAddressVO
.
getReceiveAddress
().
getLongitude
(),
String
weather
=
gdUtils
.
getWeather
(
feignAddressVO
.
getReceiveAddress
().
getCityCode
());
feignAddressVO
.
getReceiveAddress
().
getLatitude
());
String
weather
=
gdUtils
.
getWeather
(
cityCode
);
if
(
weatherCheck
(
weather
)){
if
(
weatherCheck
(
weather
)){
// 更新
if
(
StringUtils
.
isBlank
(
weatherAll
)){
weatherAll
=
weather
;}
lineWarnCommonService
.
lineWarnInfoUpdate
(
orderGoods
,
lineWarnInfo
,
lineWarnConfig
,
weather
);
else
{
//不相同,逗号分隔
if
(!
weatherAll
.
equals
(
weather
)){
weatherAll
=
weatherAll
+
","
+
weather
;
}
}
}
}
}
}
if
(
StringUtils
.
isNotBlank
(
weatherAll
)){
// 更新
lineWarnCommonService
.
lineWarnInfoUpdate
(
orderGoods
,
lineWarnInfo
,
lineWarnConfig
,
weatherAll
);
}
}
}
/**
/**
...
...
performance-web/src/main/java/com/clx/performance/service/linewarn/LineWarnCommonService.java
浏览文件 @
30b32641
...
@@ -9,4 +9,6 @@ public interface LineWarnCommonService {
...
@@ -9,4 +9,6 @@ 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
);
void
lineWarnInfoUpdate
(
OrderGoods
orderGoods
,
LineWarnInfo
lineWarnInfo
,
LineWarnConfig
lineWarnConfig
,
String
weather
);
boolean
suspendCheck
(
LineWarnInfo
lineWarnInfo
);
}
}
performance-web/src/main/java/com/clx/performance/sqlProvider/vehiclewarn/VehicleWarnRangeSqlProvider.java
浏览文件 @
30b32641
...
@@ -23,11 +23,11 @@ public class VehicleWarnRangeSqlProvider {
...
@@ -23,11 +23,11 @@ public class VehicleWarnRangeSqlProvider {
if
(
Objects
.
nonNull
(
param
.
getWarnRang
()))
{
WHERE
(
"warn_rang = #{param.warnRang}"
);}
if
(
Objects
.
nonNull
(
param
.
getWarnRang
()))
{
WHERE
(
"warn_rang = #{param.warnRang}"
);}
if
(
StringUtils
.
isNotBlank
(
param
.
getSuspendObject
()))
{
if
(
StringUtils
.
isNotBlank
(
param
.
getSuspendObject
()))
{
WHERE
(
"((warn_ra
ge
=1 and child_no =#{param.suspendObject}) "
+
WHERE
(
"((warn_ra
ng
=1 and child_no =#{param.suspendObject}) "
+
"or (warn_ra
ge
=2 and order_goods_no =#{param.suspendObject}))"
);}
"or (warn_ra
ng
=2 and order_goods_no =#{param.suspendObject}))"
);}
if
(
StringUtils
.
isNotBlank
(
param
.
getBeginTime
()))
{
WHERE
(
"
create
_time >= #{param.beginTime}"
);}
if
(
StringUtils
.
isNotBlank
(
param
.
getBeginTime
()))
{
WHERE
(
"
warn_end
_time >= #{param.beginTime}"
);}
if
(
StringUtils
.
isNotBlank
(
param
.
getEndTime
()))
{
WHERE
(
"
create
_time <= #{param.endTime}"
);}
if
(
StringUtils
.
isNotBlank
(
param
.
getEndTime
()))
{
WHERE
(
"
warn_end
_time <= #{param.endTime}"
);}
ORDER_BY
(
"id desc"
);
ORDER_BY
(
"id desc"
);
}}.
toString
();
}}.
toString
();
...
...
performance-web/src/main/java/com/clx/performance/utils/gd/GdService.java
浏览文件 @
30b32641
...
@@ -12,6 +12,7 @@ import org.apache.commons.lang.StringUtils;
...
@@ -12,6 +12,7 @@ import org.apache.commons.lang.StringUtils;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.math.RoundingMode
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Comparator
;
import
java.util.Comparator
;
import
java.util.List
;
import
java.util.List
;
...
@@ -35,6 +36,7 @@ public class GdService {
...
@@ -35,6 +36,7 @@ public class GdService {
private
static
final
String
WEATHER_API
=
"https://restapi.amap.com/v3/weather/weatherInfo?parameters"
;
//天气
private
static
final
String
WEATHER_API
=
"https://restapi.amap.com/v3/weather/weatherInfo?parameters"
;
//天气
private
static
final
String
CITY_API
=
"https://restapi.amap.com/v3/geocode/regeo?parameters"
;
//城市
private
String
gaodeKey
=
"b2550e16bbc7bf9f6cd168e0f21709fc"
;
private
String
gaodeKey
=
"b2550e16bbc7bf9f6cd168e0f21709fc"
;
...
@@ -405,4 +407,50 @@ public class GdService {
...
@@ -405,4 +407,50 @@ public class GdService {
return
weather
;
return
weather
;
}
}
public
String
getCity
(
BigDecimal
longitude
,
BigDecimal
latitude
){
return
getCity
(
gaodeKey
,
longitude
,
latitude
);
}
public
static
String
getCity
(
String
key
,
BigDecimal
longitude
,
BigDecimal
latitude
)
{
String
url
=
CITY_API
+
"?output=json&location="
+
longitude
.
setScale
(
6
,
RoundingMode
.
HALF_UP
)+
","
+
latitude
.
setScale
(
2
,
RoundingMode
.
HALF_UP
)+
"&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
);}
}
// 解析
String
adcode
=
retJSONObject
.
getJSONObject
(
"regeocode"
).
getJSONObject
(
"addressComponent"
).
getString
(
"adcode"
);
if
(
StringUtils
.
isBlank
(
adcode
))
{
throw
new
ServiceSystemException
(
ResultCodeEnum
.
FAIL
,
"调用高德城市编码接口异常, result:"
+
resultStr
);}
return
adcode
;
}
}
}
performance-web/src/main/java/com/clx/performance/utils/gd/GdUtils.java
浏览文件 @
30b32641
...
@@ -80,6 +80,12 @@ public class GdUtils {
...
@@ -80,6 +80,12 @@ public class GdUtils {
public
String
getWeather
(
String
city
){
public
String
getWeather
(
String
city
){
return
gdService
.
getWeather
(
city
);
return
gdService
.
getWeather
(
city
);
}
}
/**
* 天气
*/
public
String
getCity
(
BigDecimal
longitude
,
BigDecimal
latitude
){
return
gdService
.
getCity
(
longitude
,
latitude
);
}
/**
/**
* 获取线路
* 获取线路
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论