Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
clx-performance
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
姜武杰
clx-performance
Commits
c79f642b
提交
c79f642b
authored
10月 22, 2024
作者:
刘海泉
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
提交保存异常上报信息
上级
ad1cdfd7
显示空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
257 行增加
和
10 行删除
+257
-10
RedisConstants.java
...ain/java/com/clx/performance/constant/RedisConstants.java
+3
-0
PerformanceSdkFeignController.java
...mance/controller/feign/PerformanceSdkFeignController.java
+44
-6
OrderChildExceptionReportService.java
...performance/service/OrderChildExceptionReportService.java
+14
-0
OrderChildExceptionReportServiceImpl.java
...ce/service/impl/OrderChildExceptionReportServiceImpl.java
+111
-0
OrderChildExceptionReportStruct.java
...x/performance/struct/OrderChildExceptionReportStruct.java
+15
-0
ExceptionReportEnum.java
...n/java/com/clx/performance/enums/ExceptionReportEnum.java
+37
-0
PerformanceSDKFeign.java
...n/java/com/clx/performance/feign/PerformanceSDKFeign.java
+33
-4
没有找到文件。
clx-performance-web/src/main/java/com/clx/performance/constant/RedisConstants.java
浏览文件 @
c79f642b
...
...
@@ -57,4 +57,7 @@ public class RedisConstants {
*/
public
static
final
String
ORDER_LAST_TRUCK_CHILD
=
"clx-performance:order:last:truck:child:"
;
//异常上报编号
public
static
final
String
EXCEPTION_REPORT_CACHE_KEY
=
"clx-performance:exception:report:cache:key:"
;
}
clx-performance-web/src/main/java/com/clx/performance/controller/feign/PerformanceSdkFeignController.java
浏览文件 @
c79f642b
package
com
.
clx
.
performance
.
controller
.
feign
;
import
com.clx.open.sdk.request.action.GetOrderBreakContractOwnerRuleFileAction
;
import
com.clx.open.sdk.request.action.QueryPerformanceProgressAction
;
import
com.clx.open.sdk.request.action.QueryPerformanceProgressLogAction
;
import
com.clx.open.sdk.request.action.*
;
import
com.clx.open.sdk.request.dto.BatchOrderStatisticsDTO
;
import
com.clx.open.sdk.request.dto.BatchOrderStatisticsInfoDTO
;
import
com.clx.open.sdk.request.dto.OrderCanExtractWeightDTO
;
...
...
@@ -18,16 +16,16 @@ import com.clx.performance.vo.pc.PerformanceProgressVO;
import
com.clx.performance.vo.pc.breakcontract.carrier.BreakContractOwnerRuleFileVO
;
import
com.msl.common.result.Result
;
import
com.msl.user.utils.TokenUtil
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
jakarta.validation.constraints.NotBlank
;
import
jakarta.validation.constraints.NotEmpty
;
import
lombok.AllArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
jakarta.validation.constraints.NotBlank
;
import
jakarta.validation.constraints.NotEmpty
;
import
java.math.BigDecimal
;
import
java.util.List
;
...
...
@@ -58,6 +56,8 @@ public class PerformanceSdkFeignController {
private
final
OrderService
orderService
;
private
final
OrderChildExceptionReportService
orderChildExceptionReportService
;
@Operation
(
summary
=
"货主端取消订单"
,
description
=
"<br>By:胡宇帆"
)
@PostMapping
(
"/ownCancelOrderPre"
)
...
...
@@ -143,4 +143,42 @@ public class PerformanceSdkFeignController {
}
//数媒宝同步异常上报信息
@PostMapping
(
"clx-performance/feign/sdk/smbSyncExceptionReportInfo"
)
Result
<
String
>
smbSyncExceptionReportInfo
(
@RequestBody
@Validated
SmbSyncExceptionReportInfoAction
action
){
return
orderChildExceptionReportService
.
smbSyncExceptionReportInfo
(
action
);
}
//数媒宝同步异常上报结果
@PostMapping
(
"clx-performance/feign/sdk/smbSyncExceptionReportResult"
)
Result
<
Object
>
smbSyncExceptionReportResult
(
@RequestBody
@Validated
SmbSyncExceptionReportResultAction
action
){
return
orderChildExceptionReportService
.
smbSyncExceptionReportResult
(
action
);
}
//数媒宝撤销异常上报
@PostMapping
(
"clx-performance/feign/sdk/smbWithdrawExceptionReport"
)
Result
<
Object
>
smbWithdrawExceptionReport
(
@RequestBody
@Validated
SmbWithdrawExceptionReportAction
action
){
return
orderChildExceptionReportService
.
smbWithdrawExceptionReport
(
action
);
}
//马上来供应链同步异常上报信息
@PostMapping
(
"clx-performance/feign/sdk/mslSyncExceptionReportInfo"
)
Result
<
String
>
mslSyncExceptionReportInfo
(
@RequestBody
@Validated
MslSyncExceptionReportInfoAction
action
){
return
orderChildExceptionReportService
.
mslSyncExceptionReportInfo
(
action
);
}
//马上来供应链同步异常上报结果
@PostMapping
(
"clx-performance/feign/sdk/mslSyncExceptionReportResult"
)
Result
<
Object
>
mslSyncExceptionReportResult
(
@RequestBody
@Validated
MslSyncExceptionReportResultAction
action
){
return
orderChildExceptionReportService
.
mslSyncExceptionReportResult
(
action
);
}
//马上来供应链撤销异常上报
@PostMapping
(
"clx-performance/feign/sdk/mslWithdrawExceptionReport"
)
Result
<
Object
>
mslWithdrawExceptionReport
(
@RequestBody
@Validated
MslWithdrawExceptionReportAction
action
){
return
orderChildExceptionReportService
.
mslWithdrawExceptionReport
(
action
);
}
}
clx-performance-web/src/main/java/com/clx/performance/service/OrderChildExceptionReportService.java
浏览文件 @
c79f642b
package
com
.
clx
.
performance
.
service
;
import
com.clx.open.sdk.request.action.*
;
import
com.msl.common.result.Result
;
/**
* @author kavin
* Date 2024-10-22
* Time 10:38
*/
public
interface
OrderChildExceptionReportService
{
Result
<
String
>
smbSyncExceptionReportInfo
(
SmbSyncExceptionReportInfoAction
action
);
Result
<
Object
>
smbSyncExceptionReportResult
(
SmbSyncExceptionReportResultAction
action
);
Result
<
Object
>
smbWithdrawExceptionReport
(
SmbWithdrawExceptionReportAction
action
);
Result
<
String
>
mslSyncExceptionReportInfo
(
MslSyncExceptionReportInfoAction
action
);
Result
<
Object
>
mslSyncExceptionReportResult
(
MslSyncExceptionReportResultAction
action
);
Result
<
Object
>
mslWithdrawExceptionReport
(
MslWithdrawExceptionReportAction
action
);
}
clx-performance-web/src/main/java/com/clx/performance/service/impl/OrderChildExceptionReportServiceImpl.java
浏览文件 @
c79f642b
package
com
.
clx
.
performance
.
service
.
impl
;
import
com.clx.open.sdk.request.action.*
;
import
com.clx.performance.constant.RedisConstants
;
import
com.clx.performance.dao.OrderChildExceptionReportDao
;
import
com.clx.performance.enums.ExceptionReportEnum
;
import
com.clx.performance.enums.SyncPlatformEnum
;
import
com.clx.performance.model.OrderChildExceptionReport
;
import
com.clx.performance.service.OrderChildExceptionReportService
;
import
com.clx.performance.struct.OrderChildExceptionReportStruct
;
import
com.clx.performance.utils.LocalDateTimeUtils
;
import
com.msl.common.result.Result
;
import
com.msl.common.utils.DateUtils
;
import
lombok.AllArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.stereotype.Service
;
import
java.time.LocalDateTime
;
import
java.util.List
;
import
java.util.concurrent.TimeUnit
;
/**
* @author kavin
* Date 2024-10-22
...
...
@@ -11,5 +28,99 @@ import org.springframework.stereotype.Service;
*/
@Service
@Slf4j
@AllArgsConstructor
public
class
OrderChildExceptionReportServiceImpl
implements
OrderChildExceptionReportService
{
private
final
OrderChildExceptionReportStruct
orderChildExceptionReportStruct
;
private
final
OrderChildExceptionReportDao
orderChildExceptionReportDao
;
private
final
RedisTemplate
<
String
,
Integer
>
redisTemplate
;
@Override
public
Result
<
String
>
smbSyncExceptionReportInfo
(
SmbSyncExceptionReportInfoAction
action
)
{
OrderChildExceptionReport
report
=
orderChildExceptionReportStruct
.
convertInfoSmbAction
(
action
);
return
Result
.
ok
(
saveExceptionReportInfo
(
report
,
SyncPlatformEnum
.
Source
.
TRADE_PLATFORM
.
getCode
()));
}
@Override
public
Result
<
Object
>
smbSyncExceptionReportResult
(
SmbSyncExceptionReportResultAction
action
)
{
return
null
;
}
@Override
public
Result
<
Object
>
smbWithdrawExceptionReport
(
SmbWithdrawExceptionReportAction
action
)
{
return
null
;
}
@Override
public
Result
<
String
>
mslSyncExceptionReportInfo
(
MslSyncExceptionReportInfoAction
action
)
{
OrderChildExceptionReport
report
=
orderChildExceptionReportStruct
.
convertInfoMslAction
(
action
);
return
Result
.
ok
(
saveExceptionReportInfo
(
report
,
SyncPlatformEnum
.
Source
.
NEW_OWNER_CLIENT
.
getCode
()));
}
@Override
public
Result
<
Object
>
mslSyncExceptionReportResult
(
MslSyncExceptionReportResultAction
action
)
{
return
null
;
}
@Override
public
Result
<
Object
>
mslWithdrawExceptionReport
(
MslWithdrawExceptionReportAction
action
)
{
return
null
;
}
private
String
saveExceptionReportInfo
(
OrderChildExceptionReport
report
,
Integer
source
){
report
.
setReportNo
(
getReportNo
());
report
.
setSource
(
source
);
report
.
setStatus
(
ExceptionReportEnum
.
Status
.
WAIT_DEAL
.
getCode
());
orderChildExceptionReportDao
.
saveEntity
(
report
);
return
report
.
getReportNo
();
}
public
String
getReportNo
(){
LocalDateTime
begin
=
LocalDateTime
.
now
();
String
datetime
=
DateUtils
.
formatDateTime
(
begin
,
"yyyyMMdd"
).
get
();
String
reportCacheKey
=
getReportCacheKey
(
datetime
);
int
randomNumber
=
(
int
)
(
Math
.
random
()
*
99999999
)
+
10000000
;
boolean
isFirst
=
false
;
if
(
Boolean
.
TRUE
.
equals
(
redisTemplate
.
hasKey
(
reportCacheKey
))){
List
<
Integer
>
range
=
redisTemplate
.
opsForList
().
range
(
reportCacheKey
,
0
,
-
1
);
if
(
CollectionUtils
.
isNotEmpty
(
range
)){
//如果缓存中包含生成的数字,则重新获取
while
(
range
.
contains
(
randomNumber
)){
randomNumber
=
(
int
)
(
Math
.
random
()
*
99999999
)
+
10000000
;
}
redisTemplate
.
opsForList
().
leftPush
(
reportCacheKey
,
randomNumber
);
}
else
{
isFirst
=
true
;
}
}
else
{
//首次
isFirst
=
true
;
}
if
(
isFirst
){
redisTemplate
.
opsForList
().
leftPush
(
reportCacheKey
,
randomNumber
);
LocalDateTime
end
=
LocalDateTimeUtils
.
getDayEnd
(
begin
);
long
seconds
=
LocalDateTimeUtils
.
betweenSecond
(
begin
,
end
);
redisTemplate
.
expire
(
reportCacheKey
,
seconds
,
TimeUnit
.
SECONDS
);
}
return
"YCSB"
+
datetime
+
randomNumber
;
}
public
String
getReportCacheKey
(
String
datetime
){
return
RedisConstants
.
EXCEPTION_REPORT_CACHE_KEY
+
datetime
;
}
public
static
void
main
(
String
[]
args
)
{
LocalDateTime
begin
=
LocalDateTime
.
now
();
LocalDateTime
end
=
LocalDateTimeUtils
.
getDayEnd
(
begin
);
long
seconds
=
LocalDateTimeUtils
.
betweenSecond
(
begin
,
end
);
System
.
out
.
println
(
seconds
);
}
}
clx-performance-web/src/main/java/com/clx/performance/struct/OrderChildExceptionReportStruct.java
0 → 100644
浏览文件 @
c79f642b
package
com
.
clx
.
performance
.
struct
;
import
com.clx.open.sdk.request.action.MslSyncExceptionReportInfoAction
;
import
com.clx.open.sdk.request.action.SmbSyncExceptionReportInfoAction
;
import
com.clx.performance.model.OrderChildExceptionReport
;
import
com.msl.common.utils.DateStructUtil
;
import
com.msl.common.utils.DateUtils
;
import
org.mapstruct.Mapper
;
@Mapper
(
componentModel
=
"spring"
,
uses
=
DateStructUtil
.
class
,
imports
=
{
DateUtils
.
class
})
public
interface
OrderChildExceptionReportStruct
{
OrderChildExceptionReport
convertInfoSmbAction
(
SmbSyncExceptionReportInfoAction
action
);
OrderChildExceptionReport
convertInfoMslAction
(
MslSyncExceptionReportInfoAction
action
);
}
performance-api/src/main/java/com/clx/performance/enums/ExceptionReportEnum.java
0 → 100644
浏览文件 @
c79f642b
package
com
.
clx
.
performance
.
enums
;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
import
java.util.Arrays
;
import
java.util.Optional
;
public
enum
ExceptionReportEnum
{
;
@Getter
@AllArgsConstructor
public
enum
Status
{
//:1:待处理 2:申诉中 3:已处理 4:已撤回
WAIT_DEAL
(
1
,
"待处理"
),
APPEAL_IN_PROGRESS
(
2
,
"申诉中"
),
PROCESSED
(
3
,
"已处理"
),
WITHDRAWN
(
4
,
"已撤回"
),
;
private
final
Integer
code
;
private
final
String
name
;
public
static
Optional
<
Status
>
getByCode
(
Integer
code
)
{
return
Arrays
.
stream
(
values
()).
filter
(
e
->
e
.
code
.
equals
(
code
)).
findFirst
();
}
public
static
String
getMsgByCode
(
Integer
code
)
{
if
(
code
==
null
)
{
return
null
;}
return
getByCode
(
code
).
map
(
Status:
:
getName
).
orElse
(
null
);
}
}
}
performance-api/src/main/java/com/clx/performance/feign/PerformanceSDKFeign.java
浏览文件 @
c79f642b
package
com
.
clx
.
performance
.
feign
;
import
com.clx.open.sdk.request.action.GetOrderBreakContractOwnerRuleFileAction
;
import
com.clx.open.sdk.request.action.QueryPerformanceProgressAction
;
import
com.clx.open.sdk.request.action.QueryPerformanceProgressLogAction
;
import
com.clx.open.sdk.request.action.*
;
import
com.clx.open.sdk.request.dto.BatchOrderStatisticsDTO
;
import
com.clx.open.sdk.request.dto.BatchOrderStatisticsInfoDTO
;
import
com.clx.open.sdk.request.dto.OrderCanExtractWeightDTO
;
...
...
@@ -13,13 +11,14 @@ import com.clx.performance.vo.pc.PerformanceProgressOperationLogVO;
import
com.clx.performance.vo.pc.PerformanceProgressVO
;
import
com.clx.performance.vo.pc.breakcontract.carrier.BreakContractOwnerRuleFileVO
;
import
com.msl.common.result.Result
;
import
jakarta.validation.constraints.NotEmpty
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
jakarta.validation.constraints.NotEmpty
;
import
java.math.BigDecimal
;
import
java.util.List
;
...
...
@@ -75,4 +74,34 @@ public interface PerformanceSDKFeign {
@GetMapping
(
"clx-performance/feign/sdk/queryOrderStatistics"
)
Result
<
BatchOrderStatisticsDTO
>
queryOrderStatistics
(
@RequestParam
(
"orderNoList"
)
@NotEmpty
(
message
=
"订单编号集合不能为空"
)
List
<
String
>
orderNoList
);
@PostMapping
(
"clx-performance/feign/sdk/smbSyncExceptionReportInfo"
)
Result
<
String
>
smbSyncExceptionReportInfo
(
@RequestBody
@Validated
SmbSyncExceptionReportInfoAction
action
);
@PostMapping
(
"clx-performance/feign/sdk/smbSyncExceptionReportResult"
)
Result
<
Object
>
smbSyncExceptionReportResult
(
@RequestBody
@Validated
SmbSyncExceptionReportResultAction
action
);
@PostMapping
(
"clx-performance/feign/sdk/smbWithdrawExceptionReport"
)
Result
<
Object
>
smbWithdrawExceptionReport
(
@RequestBody
@Validated
SmbWithdrawExceptionReportAction
action
);
@PostMapping
(
"clx-performance/feign/sdk/mslSyncExceptionReportInfo"
)
Result
<
String
>
mslSyncExceptionReportInfo
(
@RequestBody
@Validated
MslSyncExceptionReportInfoAction
action
);
@PostMapping
(
"clx-performance/feign/sdk/mslSyncExceptionReportResult"
)
Result
<
Object
>
mslSyncExceptionReportResult
(
@RequestBody
@Validated
MslSyncExceptionReportResultAction
action
);
@PostMapping
(
"clx-performance/feign/sdk/mslWithdrawExceptionReport"
)
Result
<
Object
>
mslWithdrawExceptionReport
(
@RequestBody
@Validated
MslWithdrawExceptionReportAction
action
);
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论