Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Q
qk_backend
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
quanku
qk_backend
Commits
25d14eb6
Commit
25d14eb6
authored
May 22, 2024
by
shiyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
多场景物流信息查询
parent
4f92c358
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
109 additions
and
9 deletions
+109
-9
ch-core/src/main/java/com/wwdz/ch/core/consts/CommConsts.java
...ore/src/main/java/com/wwdz/ch/core/consts/CommConsts.java
+5
-0
ch-core/src/main/java/com/wwdz/ch/core/consts/CommonEnum.java
...ore/src/main/java/com/wwdz/ch/core/consts/CommonEnum.java
+40
-1
ch-core/src/main/java/com/wwdz/ch/core/entity/LogisticsRequestDto.java
...ain/java/com/wwdz/ch/core/entity/LogisticsRequestDto.java
+2
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/api/LogisticsApi.java
ch-wx-api/src/main/java/com/wwdz/ch/wx/api/LogisticsApi.java
+2
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/distribution/LogisticsServiceImpl.java
...om/wwdz/ch/wx/impl/distribution/LogisticsServiceImpl.java
+42
-4
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/distribution/LogisticsService.java
...com/wwdz/ch/wx/service/distribution/LogisticsService.java
+1
-2
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/distribution/DistributionOrderController.java
...z/ch/wx/web/distribution/DistributionOrderController.java
+2
-2
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/distribution/LogisticsController.java
.../com/wwdz/ch/wx/web/distribution/LogisticsController.java
+15
-0
No files found.
ch-core/src/main/java/com/wwdz/ch/core/consts/CommConsts.java
View file @
25d14eb6
...
@@ -68,4 +68,9 @@ public interface CommConsts {
...
@@ -68,4 +68,9 @@ public interface CommConsts {
* 平台中转鉴定单前缀
* 平台中转鉴定单前缀
*/
*/
public
final
static
String
IDENTIFY_ORDER_PREFIX
=
"IE"
;
public
final
static
String
IDENTIFY_ORDER_PREFIX
=
"IE"
;
/**
* 平台收货地址
*/
public
final
static
String
SYSTEM_DEFAULT_ADDRESS
=
"换藏平台,13216703670,浙江省杭州市钱塘区2号大街海聚中心1幢1601"
;
}
}
ch-core/src/main/java/com/wwdz/ch/core/consts/CommonEnum.java
View file @
25d14eb6
...
@@ -72,7 +72,7 @@ public class CommonEnum {
...
@@ -72,7 +72,7 @@ public class CommonEnum {
public
enum
LogisticsTypeEnum
{
public
enum
LogisticsTypeEnum
{
FROM
(
1
,
"藏家
基础
物流"
),
FROM
(
1
,
"藏家
寄出
物流"
),
DELIVERY
(
2
,
"平台发货物流"
),
DELIVERY
(
2
,
"平台发货物流"
),
SEND_BACK
(
3
,
"平台退回物流"
),
SEND_BACK
(
3
,
"平台退回物流"
),
;
;
...
@@ -105,7 +105,46 @@ public class CommonEnum {
...
@@ -105,7 +105,46 @@ public class CommonEnum {
}
}
/**
* 物流状态
*/
public
enum
LogisticsStateEnum
{
NO_TRAIL
(
0
,
"暂无轨迹信息"
),
COLLECTED
(
1
,
"已揽收"
),
ON_THE_WAY
(
2
,
"在途中"
),
SIGNED
(
3
,
"签收"
),
PROBLEM
(
4
,
"问题件"
),
FORWARD
(
5
,
"转寄"
),
CUSTOMS_CLEARANCE
(
6
,
"清关"
),
;
private
int
code
;
private
String
des
;
LogisticsStateEnum
(
int
code
,
String
des
)
{
this
.
code
=
code
;
this
.
des
=
des
;
}
public
static
String
getNameByCode
(
int
code
)
{
for
(
LogisticsStateEnum
logisticsStateEnum
:
LogisticsStateEnum
.
values
())
{
if
(
code
==
logisticsStateEnum
.
getCode
())
{
return
logisticsStateEnum
.
getDes
();
}
}
return
null
;
}
public
int
getCode
()
{
return
code
;
}
public
String
getDes
()
{
return
des
;
}
}
public
enum
SourceEnum
{
public
enum
SourceEnum
{
...
...
ch-core/src/main/java/com/wwdz/ch/core/entity/LogisticsRequestDto.java
View file @
25d14eb6
...
@@ -6,6 +6,8 @@ import lombok.Data;
...
@@ -6,6 +6,8 @@ import lombok.Data;
@Data
@Data
public
class
LogisticsRequestDto
implements
Entity
{
public
class
LogisticsRequestDto
implements
Entity
{
private
String
distributionOrderId
;
private
String
logisticsCode
;
private
String
logisticsCode
;
private
String
waybill
;
private
String
waybill
;
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/api/LogisticsApi.java
View file @
25d14eb6
package
com.wwdz.ch.wx.api
;
package
com.wwdz.ch.wx.api
;
import
com.wwdz.ch.core.consts.CommonEnum
;
import
com.wwdz.ch.core.consts.LogisticsEnum
;
import
com.wwdz.ch.core.consts.LogisticsEnum
;
import
com.wwdz.ch.core.entity.LogisticsInfo
;
import
com.wwdz.ch.core.entity.LogisticsInfo
;
import
com.wwdz.ch.core.entity.LogisticsRequestDto
;
import
com.wwdz.ch.core.entity.LogisticsRequestDto
;
...
@@ -78,6 +79,7 @@ public class LogisticsApi {
...
@@ -78,6 +79,7 @@ public class LogisticsApi {
logisticsInfo
.
setWaybill
(
dto
.
getWaybill
());
logisticsInfo
.
setWaybill
(
dto
.
getWaybill
());
logisticsInfo
.
setTrailInfoList
(
trailInfoList
);
logisticsInfo
.
setTrailInfoList
(
trailInfoList
);
logisticsInfo
.
setState
(
state
);
logisticsInfo
.
setState
(
state
);
logisticsInfo
.
setStateName
(
CommonEnum
.
LogisticsStateEnum
.
getNameByCode
(
Integer
.
parseInt
(
state
)));
return
Result
.
success
(
logisticsInfo
);
return
Result
.
success
(
logisticsInfo
);
}
}
return
Result
.
failed
();
return
Result
.
failed
();
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/distribution/LogisticsServiceImpl.java
View file @
25d14eb6
package
com.wwdz.ch.wx.impl.distribution
;
package
com.wwdz.ch.wx.impl.distribution
;
import
com.wwdz.ch.core.consts.CommConsts
;
import
com.wwdz.ch.core.consts.CommonEnum
;
import
com.wwdz.ch.core.entity.LogisticsInfo
;
import
com.wwdz.ch.core.entity.LogisticsInfo
;
import
com.wwdz.ch.core.entity.LogisticsRequestDto
;
import
com.wwdz.ch.core.entity.LogisticsRequestDto
;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.db.dao.distribution.DistributionOrderDao
;
import
com.wwdz.ch.db.dao.distribution.DistributionOrderDao
;
import
com.wwdz.ch.db.dao.distribution.IdentifyOrderDao
;
import
com.wwdz.ch.db.domain.distribution.DistributionOrder
;
import
com.wwdz.ch.db.domain.distribution.DistributionOrder
;
import
com.wwdz.ch.db.domain.distribution.IdentifyOrder
;
import
com.wwdz.ch.wx.api.LogisticsApi
;
import
com.wwdz.ch.wx.api.LogisticsApi
;
import
com.wwdz.ch.wx.service.distribution.LogisticsService
;
import
com.wwdz.ch.wx.service.distribution.LogisticsService
;
import
com.xxdxxs.utils.StringUtils
;
import
com.xxdxxs.utils.StringUtils
;
...
@@ -24,6 +28,9 @@ public class LogisticsServiceImpl implements LogisticsService {
...
@@ -24,6 +28,9 @@ public class LogisticsServiceImpl implements LogisticsService {
@Autowired
@Autowired
DistributionOrderDao
distributionOrderDao
;
DistributionOrderDao
distributionOrderDao
;
@Autowired
IdentifyOrderDao
identifyOrderDao
;
@Override
@Override
public
Result
findLogisticsInfo
(
String
orderId
)
{
public
Result
findLogisticsInfo
(
String
orderId
)
{
try
{
try
{
...
@@ -41,8 +48,9 @@ public class LogisticsServiceImpl implements LogisticsService {
...
@@ -41,8 +48,9 @@ public class LogisticsServiceImpl implements LogisticsService {
logisticsInfo
.
setDistributionOrderId
(
orderId
);
logisticsInfo
.
setDistributionOrderId
(
orderId
);
result
.
setData
(
logisticsInfo
);
result
.
setData
(
logisticsInfo
);
return
result
;
return
result
;
}
else
{
return
Result
.
failed
(
"暂未查询到物流信息"
);
}
}
return
result
;
}
else
{
}
else
{
return
Result
.
failed
(
"承运商信息为空"
);
return
Result
.
failed
(
"承运商信息为空"
);
}
}
...
@@ -57,9 +65,39 @@ public class LogisticsServiceImpl implements LogisticsService {
...
@@ -57,9 +65,39 @@ public class LogisticsServiceImpl implements LogisticsService {
@Override
@Override
public
Result
findLogisticsInfo
(
LogisticsRequestDto
dto
)
{
public
Result
findLogisticsInfo
(
LogisticsRequestDto
dto
)
{
try
{
try
{
int
type
=
dto
.
getType
();
String
logisticsCode
=
null
;
String
waybill
=
null
;
String
receiverInfo
=
null
;
if
(
type
==
CommonEnum
.
LogisticsTypeEnum
.
FROM
.
getCode
())
{
IdentifyOrder
identifyOrder
=
identifyOrderDao
.
findByDistributionOrderId
(
dto
.
getDistributionOrderId
());
logisticsCode
=
identifyOrder
.
getFromLogisticsCode
();
waybill
=
identifyOrder
.
getFromWaybill
();
receiverInfo
=
CommConsts
.
SYSTEM_DEFAULT_ADDRESS
;
}
else
if
(
type
==
CommonEnum
.
LogisticsTypeEnum
.
DELIVERY
.
getCode
())
{
DistributionOrder
distributionOrder
=
distributionOrderDao
.
findById
(
dto
.
getDistributionOrderId
());
logisticsCode
=
distributionOrder
.
getLogisticsCode
();
waybill
=
distributionOrder
.
getWaybill
();
receiverInfo
=
distributionOrder
.
getReceiverName
()
+
","
+
distributionOrder
.
getReceiverPhone
()
+
","
+
distributionOrder
.
getReceiverAddress
();
}
else
if
(
type
==
CommonEnum
.
LogisticsTypeEnum
.
SEND_BACK
.
getCode
())
{
IdentifyOrder
identifyOrder
=
identifyOrderDao
.
findByDistributionOrderId
(
dto
.
getDistributionOrderId
());
logisticsCode
=
identifyOrder
.
getOutLogisticsCode
();
waybill
=
identifyOrder
.
getOutWaybill
();
receiverInfo
=
identifyOrder
.
getReturnName
()
+
","
+
identifyOrder
.
getReturnPhone
()
+
","
+
identifyOrder
.
getReturnAddress
();
}
LogisticsRequestDto
logisticsRequestDto
=
new
LogisticsRequestDto
();
logisticsRequestDto
.
setLogisticsCode
(
logisticsCode
);
logisticsRequestDto
.
setWaybill
(
waybill
);
Result
result
=
logisticsApi
.
findTrails
(
logisticsRequestDto
);
if
(
result
.
getSuccess
())
{
LogisticsInfo
logisticsInfo
=
(
LogisticsInfo
)
result
.
getData
();
logisticsInfo
.
setReceiverInfo
(
receiverInfo
);
logisticsInfo
.
setDistributionOrderId
(
dto
.
getDistributionOrderId
());
result
.
setData
(
logisticsInfo
);
return
result
;
}
else
{
return
Result
.
failed
(
"暂未查询到物流信息"
);
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
logger
.
error
(
"查询物流轨迹 error : {}"
,
e
);
logger
.
error
(
"查询物流轨迹 error : {}"
,
e
);
}
}
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/distribution/LogisticsService.java
View file @
25d14eb6
...
@@ -15,8 +15,7 @@ public interface LogisticsService {
...
@@ -15,8 +15,7 @@ public interface LogisticsService {
/**
/**
* 查询订单物流轨迹
* 查询订单物流轨迹
* @param waybill
* @param dto
* @param type
* @return
* @return
*/
*/
Result
findLogisticsInfo
(
LogisticsRequestDto
dto
);
Result
findLogisticsInfo
(
LogisticsRequestDto
dto
);
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/distribution/DistributionOrderController.java
View file @
25d14eb6
...
@@ -144,10 +144,10 @@ public class DistributionOrderController {
...
@@ -144,10 +144,10 @@ public class DistributionOrderController {
return
distributionOrderService
.
cancel
(
dto
);
return
distributionOrderService
.
cancel
(
dto
);
}
}
@ApiOperation
(
value
=
"发货"
)
@ApiOperation
(
value
=
"
藏家
发货"
)
@PostMapping
(
"/delivery"
)
@PostMapping
(
"/delivery"
)
public
Result
delivery
(
@RequestBody
DistributionOrderRequestDto
dto
)
{
public
Result
delivery
(
@RequestBody
DistributionOrderRequestDto
dto
)
{
logger
.
info
(
"发货,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
logger
.
info
(
"
藏家
发货,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
Validator
validator
=
new
Validator
(
FormHandler
.
ofEntity
(
dto
));
Validator
validator
=
new
Validator
(
FormHandler
.
ofEntity
(
dto
));
validator
.
set
(
"distributionOrderId"
,
"分销订单号"
).
must
().
string
()
validator
.
set
(
"distributionOrderId"
,
"分销订单号"
).
must
().
string
()
.
set
(
"logisticsCode"
,
"快递公司编码"
).
must
().
string
()
.
set
(
"logisticsCode"
,
"快递公司编码"
).
must
().
string
()
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/distribution/LogisticsController.java
View file @
25d14eb6
package
com.wwdz.ch.wx.web.distribution
;
package
com.wwdz.ch.wx.web.distribution
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.wwdz.ch.core.entity.LogisticsRequestDto
;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.db.dto.request.distribution.DistributionOrderRequestDto
;
import
com.wwdz.ch.db.dto.request.distribution.DistributionOrderRequestDto
;
import
com.wwdz.ch.wx.entity.request.SelfPageRequestDto
;
import
com.wwdz.ch.wx.entity.request.SelfPageRequestDto
;
...
@@ -40,4 +41,18 @@ public class LogisticsController {
...
@@ -40,4 +41,18 @@ public class LogisticsController {
return
logisticsService
.
findLogisticsInfo
(
dto
.
getDistributionOrderId
());
return
logisticsService
.
findLogisticsInfo
(
dto
.
getDistributionOrderId
());
}
}
@ApiOperation
(
value
=
"查询不同场景的物流轨迹"
)
@PostMapping
(
"/findLogisticsInfoByType"
)
public
Result
findLogisticsInfoByType
(
@RequestBody
LogisticsRequestDto
dto
)
{
logger
.
info
(
"查询不同场景的物流轨迹,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
Validator
validator
=
new
Validator
(
FormHandler
.
ofEntity
(
dto
));
validator
.
set
(
"distributionOrderId"
,
"订单号"
).
must
().
string
()
.
set
(
"type"
,
"场景类型"
).
must
().
number
()
.
end
();
if
(!
validator
.
isValid
())
{
return
Result
.
failed
(
validator
.
getErrorInfo
());
}
return
logisticsService
.
findLogisticsInfo
(
dto
);
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment