Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
clx-performance
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
姜武杰
clx-performance
Commits
07d4dd9e
提交
07d4dd9e
authored
9月 25, 2023
作者:
huyufan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修改bug
上级
eb366661
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
26 行增加
和
9 行删除
+26
-9
OneGoodsOrderStrategy.java
.../clx/performance/strategy/impl/OneGoodsOrderStrategy.java
+7
-4
ThreeGoodsOrderStrategy.java
...lx/performance/strategy/impl/ThreeGoodsOrderStrategy.java
+7
-3
TwoGoodsOrderStrategy.java
.../clx/performance/strategy/impl/TwoGoodsOrderStrategy.java
+12
-2
没有找到文件。
performance-web/src/main/java/com/clx/performance/strategy/impl/OneGoodsOrderStrategy.java
浏览文件 @
07d4dd9e
...
@@ -32,6 +32,9 @@ import java.util.HashMap;
...
@@ -32,6 +32,9 @@ import java.util.HashMap;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
/**
* 全部平台
*/
@Component
(
"OneGoodsOrderStrategy"
)
@Component
(
"OneGoodsOrderStrategy"
)
@Slf4j
@Slf4j
public
class
OneGoodsOrderStrategy
implements
GoodsOrderStrategy
,
InitializingBean
{
public
class
OneGoodsOrderStrategy
implements
GoodsOrderStrategy
,
InitializingBean
{
...
@@ -66,7 +69,8 @@ public class OneGoodsOrderStrategy implements GoodsOrderStrategy, InitializingBe
...
@@ -66,7 +69,8 @@ public class OneGoodsOrderStrategy implements GoodsOrderStrategy, InitializingBe
List
<
OrderGoodsChildParams
>
childParamsList
=
orderGoodsParams
.
getOrderGoodsChildParams
();
List
<
OrderGoodsChildParams
>
childParamsList
=
orderGoodsParams
.
getOrderGoodsChildParams
();
BigDecimal
childSum
=
childParamsList
.
stream
().
map
(
OrderGoodsChildParams:
:
getExtractWeight
).
reduce
(
BigDecimal
childSum
=
childParamsList
.
stream
().
map
(
OrderGoodsChildParams:
:
getExtractWeight
).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
if
(
orderInfo
.
getResidueWeight
().
compareTo
(
childSum
)
<
0
)
{
BigDecimal
residueWeight
=
new
BigDecimal
(
orderInfo
.
getResidueWeight
());
if
(
residueWeight
.
compareTo
(
childSum
)
<
0
)
{
throw
new
ServiceSystemException
(
PerformanceResultEnum
.
HTTP_ERROR
,
"当前货单总吨数已超订单总吨数"
);
throw
new
ServiceSystemException
(
PerformanceResultEnum
.
HTTP_ERROR
,
"当前货单总吨数已超订单总吨数"
);
}
}
long
beginOrderGoodsId
=
orderGoodsIdGenerate
.
getOrderGoodsId
(
OrderGoodsTypeEnum
.
Status
.
PLATFORM
.
getCode
(),
childParamsList
.
size
());
long
beginOrderGoodsId
=
orderGoodsIdGenerate
.
getOrderGoodsId
(
OrderGoodsTypeEnum
.
Status
.
PLATFORM
.
getCode
(),
childParamsList
.
size
());
...
@@ -140,9 +144,8 @@ public class OneGoodsOrderStrategy implements GoodsOrderStrategy, InitializingBe
...
@@ -140,9 +144,8 @@ public class OneGoodsOrderStrategy implements GoodsOrderStrategy, InitializingBe
beginOrderGoodsId
=
beginOrderGoodsId
+
1
;
beginOrderGoodsId
=
beginOrderGoodsId
+
1
;
orderGoodsMapper
.
insert
(
orderGoods
);
orderGoodsMapper
.
insert
(
orderGoods
);
}
}
BigDecimal
subtract
=
orderInfo
.
getResidueWeight
().
subtract
(
childSum
);
log
.
info
(
"更新剩余订单量{}"
,
subtract
);
orderFeign
.
updateOrderInfoResidueWeight
(
orderInfo
.
getId
(),
1
,
null
,
residueWeight
.
subtract
(
childSum
));
orderFeign
.
updateOrderInfoResidueWeight
(
orderInfo
.
getId
(),
subtract
);
sendMq
(
mqMap
,
now
);
sendMq
(
mqMap
,
now
);
return
sendLazyTime
;
return
sendLazyTime
;
...
...
performance-web/src/main/java/com/clx/performance/strategy/impl/ThreeGoodsOrderStrategy.java
浏览文件 @
07d4dd9e
...
@@ -35,6 +35,9 @@ import java.util.HashMap;
...
@@ -35,6 +35,9 @@ import java.util.HashMap;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
/**
* 自由车辆
*/
@Component
(
"ThreeGoodsOrderStrategy"
)
@Component
(
"ThreeGoodsOrderStrategy"
)
@Slf4j
@Slf4j
public
class
ThreeGoodsOrderStrategy
implements
GoodsOrderStrategy
,
InitializingBean
{
public
class
ThreeGoodsOrderStrategy
implements
GoodsOrderStrategy
,
InitializingBean
{
...
@@ -70,7 +73,8 @@ public class ThreeGoodsOrderStrategy implements GoodsOrderStrategy, Initializing
...
@@ -70,7 +73,8 @@ public class ThreeGoodsOrderStrategy implements GoodsOrderStrategy, Initializing
List
<
OrderGoodsChildParams
>
childParamsList
=
orderGoodsParams
.
getOrderGoodsChildParams
();
List
<
OrderGoodsChildParams
>
childParamsList
=
orderGoodsParams
.
getOrderGoodsChildParams
();
BigDecimal
childSum
=
childParamsList
.
stream
().
map
(
OrderGoodsChildParams:
:
getExtractWeight
).
reduce
(
BigDecimal
childSum
=
childParamsList
.
stream
().
map
(
OrderGoodsChildParams:
:
getExtractWeight
).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
if
(
orderInfo
.
getResidueWeight
().
compareTo
(
childSum
)
<
0
)
{
BigDecimal
residueWeight
=
new
BigDecimal
(
orderInfo
.
getResidueWeight
());
if
(
residueWeight
.
compareTo
(
childSum
)
<
0
)
{
throw
new
ServiceSystemException
(
PerformanceResultEnum
.
HTTP_ERROR
,
"当前货单总吨数已超订单总吨数"
);
throw
new
ServiceSystemException
(
PerformanceResultEnum
.
HTTP_ERROR
,
"当前货单总吨数已超订单总吨数"
);
}
}
if
(
childParamsList
.
size
()
>
1
)
{
if
(
childParamsList
.
size
()
>
1
)
{
...
@@ -144,14 +148,14 @@ public class ThreeGoodsOrderStrategy implements GoodsOrderStrategy, Initializing
...
@@ -144,14 +148,14 @@ public class ThreeGoodsOrderStrategy implements GoodsOrderStrategy, Initializing
orderGoodsMapper
.
insert
(
orderGoods
);
orderGoodsMapper
.
insert
(
orderGoods
);
}
}
orderFeign
.
updateOrderInfoResidueWeight
(
orderInfo
.
getId
(),
orderInfo
.
getResidueWeight
()
.
subtract
(
childSum
));
orderFeign
.
updateOrderInfoResidueWeight
(
orderInfo
.
getId
(),
1
,
null
,
residueWeight
.
subtract
(
childSum
));
sendMq
(
mqMap
,
now
);
sendMq
(
mqMap
,
now
);
return
sendLazyTime
;
return
sendLazyTime
;
}
}
@Override
@Override
public
void
afterPropertiesSet
()
throws
Exception
{
public
void
afterPropertiesSet
()
throws
Exception
{
goodsOrderStrategyContext
.
strategyContext
.
put
(
TruckDemandEnum
.
TruckType
.
OWNER_CAR
.
getCode
(),
this
);
goodsOrderStrategyContext
.
strategyContext
.
put
(
TruckDemandEnum
.
TruckType
.
OWNER_CAR
.
getCode
(),
this
);
}
}
public
void
sendMq
(
Map
<
String
,
LocalDateTime
>
mqMap
,
LocalDateTime
now
)
{
public
void
sendMq
(
Map
<
String
,
LocalDateTime
>
mqMap
,
LocalDateTime
now
)
{
...
...
performance-web/src/main/java/com/clx/performance/strategy/impl/TwoGoodsOrderStrategy.java
浏览文件 @
07d4dd9e
...
@@ -35,6 +35,9 @@ import java.util.HashMap;
...
@@ -35,6 +35,9 @@ import java.util.HashMap;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
/**
* 部分平台
*/
@Component
(
"TwoGoodsOrderStrategy"
)
@Component
(
"TwoGoodsOrderStrategy"
)
@Slf4j
@Slf4j
public
class
TwoGoodsOrderStrategy
implements
GoodsOrderStrategy
,
InitializingBean
{
public
class
TwoGoodsOrderStrategy
implements
GoodsOrderStrategy
,
InitializingBean
{
...
@@ -71,7 +74,8 @@ public class TwoGoodsOrderStrategy implements GoodsOrderStrategy, InitializingBe
...
@@ -71,7 +74,8 @@ public class TwoGoodsOrderStrategy implements GoodsOrderStrategy, InitializingBe
List
<
OrderGoodsChildParams
>
childParamsList
=
orderGoodsParams
.
getOrderGoodsChildParams
();
List
<
OrderGoodsChildParams
>
childParamsList
=
orderGoodsParams
.
getOrderGoodsChildParams
();
BigDecimal
childSum
=
childParamsList
.
stream
().
map
(
OrderGoodsChildParams:
:
getExtractWeight
).
reduce
(
BigDecimal
childSum
=
childParamsList
.
stream
().
map
(
OrderGoodsChildParams:
:
getExtractWeight
).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
if
(
orderInfo
.
getResidueWeight
().
compareTo
(
childSum
)
<
0
)
{
BigDecimal
residueWeight
=
new
BigDecimal
(
orderInfo
.
getResidueWeight
());
if
(
residueWeight
.
compareTo
(
childSum
)
<
0
)
{
throw
new
ServiceSystemException
(
PerformanceResultEnum
.
HTTP_ERROR
,
"当前货单总吨数已超订单总吨数"
);
throw
new
ServiceSystemException
(
PerformanceResultEnum
.
HTTP_ERROR
,
"当前货单总吨数已超订单总吨数"
);
}
}
Map
<
String
,
LocalDateTime
>
mqMap
=
new
HashMap
<>();
Map
<
String
,
LocalDateTime
>
mqMap
=
new
HashMap
<>();
...
@@ -148,7 +152,13 @@ public class TwoGoodsOrderStrategy implements GoodsOrderStrategy, InitializingBe
...
@@ -148,7 +152,13 @@ public class TwoGoodsOrderStrategy implements GoodsOrderStrategy, InitializingBe
orderGoodsMapper
.
insert
(
orderGoods
);
orderGoodsMapper
.
insert
(
orderGoods
);
}
}
orderFeign
.
updateOrderInfoResidueWeight
(
orderInfo
.
getId
(),
orderInfo
.
getResidueWeight
().
subtract
(
childSum
));
if
(
childParamsList
.
size
()
>
1
)
{
orderFeign
.
updateOrderInfoResidueWeight
(
orderInfo
.
getId
(),
2
,
new
BigDecimal
(
orderInfo
.
getPlatformResidueCarryWeight
()).
subtract
(
childSum
),
residueWeight
.
subtract
(
childSum
));
}
else
{
orderFeign
.
updateOrderInfoResidueWeight
(
orderInfo
.
getId
(),
3
,
new
BigDecimal
(
orderInfo
.
getOwnResidueCarryWeight
()).
subtract
(
childSum
),
residueWeight
.
subtract
(
childSum
));
}
sendMq
(
mqMap
,
now
);
sendMq
(
mqMap
,
now
);
return
sendLazyTime
;
return
sendLazyTime
;
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论