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
cea5f99e
Commit
cea5f99e
authored
Dec 20, 2023
by
shiyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
小程序寄售详情
parent
08718b93
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
411 additions
and
59 deletions
+411
-59
ch-core/src/main/java/com/wwdz/ch/core/consts/ConsignSaleEnum.java
...rc/main/java/com/wwdz/ch/core/consts/ConsignSaleEnum.java
+1
-0
ch-core/src/main/java/com/wwdz/ch/core/consts/LogisticsEnum.java
.../src/main/java/com/wwdz/ch/core/consts/LogisticsEnum.java
+37
-0
ch-core/src/main/java/com/wwdz/ch/core/entity/ConsignSaleRecordVo.java
...ain/java/com/wwdz/ch/core/entity/ConsignSaleRecordVo.java
+45
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/config/WebMvcConfiguration.java
.../main/java/com/wwdz/ch/wx/config/WebMvcConfiguration.java
+2
-2
ch-wx-api/src/main/java/com/wwdz/ch/wx/entity/vo/ConsignSaleAppletVo.java
...in/java/com/wwdz/ch/wx/entity/vo/ConsignSaleAppletVo.java
+12
-1
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/ConsignSaleServiceImpl.java
...main/java/com/wwdz/ch/wx/impl/ConsignSaleServiceImpl.java
+213
-55
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/ConsignSaleService.java
.../main/java/com/wwdz/ch/wx/service/ConsignSaleService.java
+22
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/ConsignSaleController.java
...c/main/java/com/wwdz/ch/wx/web/ConsignSaleController.java
+79
-1
No files found.
ch-core/src/main/java/com/wwdz/ch/core/consts/ConsignSaleEnum.java
View file @
cea5f99e
...
...
@@ -103,6 +103,7 @@ public class ConsignSaleEnum {
FINISH
(
90
,
"寄售单完成"
),
CUSTOM_CANCEL
(
100
,
"用户取消寄售"
),
SYS_CANCEL
(
101
,
"平台取消寄售"
),
TIME_OUT_CANCEL
(
102
,
"超时未确认,取消寄售"
),
;
private
int
code
;
...
...
ch-core/src/main/java/com/wwdz/ch/core/consts/LogisticsEnum.java
0 → 100644
View file @
cea5f99e
package
com.wwdz.ch.core.consts
;
public
enum
LogisticsEnum
{
JD
(
"JD"
,
"京东快递"
),
SF
(
"SF"
,
"顺丰快递"
),
STO
(
"STO"
,
"申通快递"
),
YTO
(
"YTO"
,
"圆通快递"
),
ZTO
(
"ZTO"
,
"中通快递"
),
YUNDA
(
"YUNDA"
,
"韵达快递"
),
;
private
String
code
;
private
String
name
;
LogisticsEnum
(
String
code
,
String
name
)
{
this
.
code
=
code
;
this
.
name
=
name
;
}
public
static
String
getNameByCode
(
String
code
)
{
for
(
LogisticsEnum
logisticsEnum
:
LogisticsEnum
.
values
())
{
if
(
code
.
equals
(
logisticsEnum
.
getCode
()))
{
return
logisticsEnum
.
getName
();
}
}
return
null
;
}
public
String
getCode
()
{
return
code
;
}
public
String
getName
()
{
return
name
;
}
}
ch-core/src/main/java/com/wwdz/ch/core/entity/ConsignSaleRecordVo.java
0 → 100644
View file @
cea5f99e
package
com.wwdz.ch.core.entity
;
import
com.xxdxxs.entity.Entity
;
import
lombok.Data
;
import
java.util.Date
;
@Data
public
class
ConsignSaleRecordVo
implements
Entity
{
private
String
content
;
private
String
remark
;
private
String
saleId
;
private
String
itemName
;
private
String
image
;
private
Date
time
;
/**
* 是否有估价
*/
private
Boolean
isHasPrice
;
/**
* 是否超时未确认
*/
private
Boolean
isTimeOut
;
private
String
tip
;
/**
* 客户端状态
*/
private
Integer
customState
;
/**
* 客户端状态
*/
private
String
customStateName
;
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/config/WebMvcConfiguration.java
View file @
cea5f99e
...
...
@@ -40,8 +40,8 @@ public class WebMvcConfiguration implements WebMvcConfigurer {
.
excludePathPatterns
(
"/*.html"
,
"/**/*.html"
,
"/**/*.css"
,
"/**/*.js"
,
"/wx/user/loginByWx"
,
"/wx/user/finishLogin"
,
"/wx/user/loginByMobile"
,
"/wx/user/loginRegCaptcha"
,
"/wx/user/updateRegCaptcha"
,
"/wx/user/login"
,
"/wx/user/fillCode"
,
"/officialAccountCallback/**"
,
"/imCallback/**"
,
"/wx/category/**"
//
"/wx/consignSale/**", "/wx/item/**"
"/imCallback/**"
,
"/wx/category/**"
,
"/wx/consignSale/**"
,
"/wx/item/**"
/* "/wx/officialAccount/**",
"/wx/item/**",
"/wx/aiAssistant/**",
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/entity/vo/ConsignSaleAppletVo.java
View file @
cea5f99e
...
...
@@ -22,13 +22,24 @@ public class ConsignSaleAppletVo implements Entity {
/**
* 商品名称
*/
private
String
n
ame
;
private
String
itemN
ame
;
/**
* 寄售单号
*/
private
String
saleId
;
/**
* 客户端状态
*/
private
Integer
customState
;
/**
* 客户端状态
*/
private
String
customStateName
;
/**
* 下单时间
*/
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/ConsignSaleServiceImpl.java
View file @
cea5f99e
...
...
@@ -4,6 +4,7 @@ import com.alibaba.dubbo.config.annotation.Reference;
import
com.github.pagehelper.PageInfo
;
import
com.wwdz.ch.core.consts.ConsignSaleEnum
;
import
com.wwdz.ch.core.consts.ItemStateEnum
;
import
com.wwdz.ch.core.entity.ConsignSaleRecordVo
;
import
com.wwdz.ch.core.entity.ConsignSaleVo
;
import
com.wwdz.ch.core.type.PageSearchResult
;
import
com.wwdz.ch.core.type.Result
;
...
...
@@ -21,8 +22,10 @@ import com.wwdz.ch.db.domain.User;
import
com.wwdz.ch.db.dto.request.CoinRequestDto
;
import
com.wwdz.ch.db.dto.request.ConsignSaleRequestDto
;
import
com.wwdz.ch.wx.entity.vo.AppletStateNodeVo
;
import
com.wwdz.ch.wx.entity.vo.ConsignSaleAppletVo
;
import
com.wwdz.ch.wx.service.ConsignSaleService
;
import
com.wwdz.user.api.service.user.UserReadService
;
import
com.xxdxxs.utils.DateUtils
;
import
com.xxdxxs.utils.EntityMapper
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -175,73 +178,228 @@ public class ConsignSaleServiceImpl implements ConsignSaleService {
@Override
public
Result
findDetail
(
ConsignSaleRequestDto
dto
)
{
String
saleId
=
dto
.
getSaleId
();
List
<
ConsignSaleRecord
>
consignSaleRecordList
=
consignSaleRecordDao
.
find
(
saleId
);
List
<
AppletStateNodeVo
>
appletStateNodeVoList
=
new
ArrayList
<>();
ConsignSaleEnum
.
AppletNodeDescEnum
[]
appletNodeDescEnums
=
ConsignSaleEnum
.
AppletNodeDescEnum
.
values
();
List
<
ConsignSaleEnum
.
AppletNodeDescEnum
>
appletNodeDescEnumList
=
Arrays
.
stream
(
appletNodeDescEnums
).
collect
(
Collectors
.
toList
());
//判断最终状态是否取消寄售
long
cancelTypeRecordNum
=
consignSaleRecordList
.
stream
().
filter
(
a
->
a
.
getType
().
intValue
()==
ConsignSaleEnum
.
OperateTypeEnum
.
SYS_CANCEL
.
getCode
()
||
a
.
getType
().
intValue
()==
ConsignSaleEnum
.
OperateTypeEnum
.
CUSTOM_CANCEL
.
getCode
()).
count
();
//没有取消寄售,则时间线最终的状态为寄售完成
if
(
cancelTypeRecordNum
==
0
)
{
appletNodeDescEnumList
.
remove
((
appletNodeDescEnumList
.
size
()
-
1
));
}
ConsignSaleAppletVo
consignSaleAppletVo
=
new
ConsignSaleAppletVo
();
try
{
String
saleId
=
dto
.
getSaleId
();
List
<
ConsignSaleRecord
>
consignSaleRecordList
=
consignSaleRecordDao
.
find
(
saleId
);
List
<
AppletStateNodeVo
>
appletStateNodeVoList
=
new
ArrayList
<>();
ConsignSale
consignSale
=
consignSaleDao
.
findById
(
saleId
);
long
itemId
=
consignSale
.
getItemId
();
Item
item
=
itemDao
.
findById
(
itemId
);
consignSaleAppletVo
.
setSaleId
(
saleId
);
consignSaleAppletVo
.
setImage
(
item
.
getImages
().
split
(
";"
)[
0
]);
consignSaleAppletVo
.
setItemName
(
item
.
getName
());
consignSaleAppletVo
.
setSaleTime
(
consignSale
.
getSaleTime
());
consignSaleAppletVo
.
setLogisticsCode
(
consignSale
.
getLogisticsCode
());
consignSaleAppletVo
.
setLogisticsName
(
consignSale
.
getLogisticsCode
());
consignSaleAppletVo
.
setWaybill
(
consignSale
.
getWaybill
());
consignSaleAppletVo
.
setSendType
(
"自行寄出"
);
consignSaleAppletVo
.
setCustomState
(
consignSale
.
getCustomState
());
consignSaleAppletVo
.
setCustomStateName
(
ConsignSaleEnum
.
SaleForUserStateEnum
.
getNameByCode
(
consignSale
.
getCustomState
()));
ConsignSaleEnum
.
AppletNodeDescEnum
[]
appletNodeDescEnums
=
ConsignSaleEnum
.
AppletNodeDescEnum
.
values
();
List
<
ConsignSaleEnum
.
AppletNodeDescEnum
>
appletNodeDescEnumList
=
Arrays
.
stream
(
appletNodeDescEnums
).
collect
(
Collectors
.
toList
());
for
(
ConsignSaleEnum
.
AppletNodeDescEnum
appletNodeDescEnum
:
appletNodeDescEnumList
)
{
AppletStateNodeVo
appletStateNodeVo
=
new
AppletStateNodeVo
();
appletStateNodeVo
.
setNode
(
appletNodeDescEnum
.
getNode
());
appletStateNodeVo
.
setDesc
(
appletStateNodeVo
.
getDesc
());
appletStateNodeVo
.
setPassed
(
false
);
appletStateNodeVoList
.
add
(
appletStateNodeVo
);
}
//逐一判断节点
//下单成功
AppletStateNodeVo
appletStateNodeVo1
=
new
AppletStateNodeVo
();
appletStateNodeVo1
.
setNode
(
ConsignSaleEnum
.
AppletNodeDescEnum
.
CREATE_ORDER
.
getNode
());
ConsignSaleRecord
consignSaleRecord1
=
consignSaleRecordList
.
stream
().
filter
(
a
->
a
.
getType
().
intValue
()==
ConsignSaleEnum
.
OperateTypeEnum
.
CREATE_ORDER
.
getCode
()).
collect
(
Collectors
.
toList
()).
get
(
0
);
appletStateNodeVo1
.
setTime
(
consignSaleRecord1
.
getCreateTime
());
appletStateNodeVoList
.
add
(
appletStateNodeVo1
);
for
(
ConsignSaleRecord
consignSaleRecord
:
consignSaleRecordList
)
{
if
(
consignSaleRecord
.
getType
().
intValue
()
==
ConsignSaleEnum
.
OperateTypeEnum
.
CREATE_ORDER
.
getCode
())
{
appletStateNodeVoList
.
get
(
0
).
setPassed
(
true
);
appletStateNodeVoList
.
get
(
0
).
setTime
(
consignSaleRecord
.
getCreateTime
());
appletStateNodeVoList
.
get
(
1
).
setPassed
(
true
);
appletStateNodeVoList
.
get
(
1
).
setDesc
(
ConsignSaleEnum
.
AppletNodeDescEnum
.
VALUATE
.
getDes
());
}
else
if
(
consignSaleRecord
.
getType
().
intValue
()
==
ConsignSaleEnum
.
OperateTypeEnum
.
SYS_CANCEL
.
getCode
())
{
appletStateNodeVoList
.
get
(
7
).
setPassed
(
true
);
appletStateNodeVoList
.
get
(
7
).
setDesc
(
consignSaleRecord
.
getContent
()
+
";"
+
consignSaleRecord
.
getRemark
());
break
;
}
else
if
(
consignSaleRecord
.
getType
().
intValue
()
==
ConsignSaleEnum
.
OperateTypeEnum
.
CUSTOM_CANCEL
.
getCode
())
{
appletStateNodeVoList
.
get
(
7
).
setPassed
(
true
);
appletStateNodeVoList
.
get
(
7
).
setDesc
(
consignSaleRecord
.
getContent
()
+
";"
+
consignSaleRecord
.
getRemark
());
break
;
}
else
if
(
consignSaleRecord
.
getType
().
intValue
()
==
ConsignSaleEnum
.
OperateTypeEnum
.
TIME_OUT_CANCEL
.
getCode
())
{
appletStateNodeVoList
.
get
(
7
).
setPassed
(
true
);
appletStateNodeVoList
.
get
(
7
).
setDesc
(
consignSaleRecord
.
getContent
());
break
;
}
//图文估价
else
if
(
consignSaleRecord
.
getType
().
intValue
()
==
ConsignSaleEnum
.
OperateTypeEnum
.
VALUATE
.
getCode
())
{
appletStateNodeVoList
.
get
(
1
).
setDesc
(
consignSaleRecord
.
getContent
()
+
";"
+
consignSaleRecord
.
getRemark
());
}
//送货至平台
else
if
(
consignSaleRecord
.
getType
().
intValue
()
==
ConsignSaleEnum
.
OperateTypeEnum
.
USER_SEND
.
getCode
())
{
appletStateNodeVoList
.
get
(
2
).
setPassed
(
true
);
appletStateNodeVoList
.
get
(
2
).
setDesc
(
consignSaleRecord
.
getContent
()
+
";"
+
consignSaleRecord
.
getRemark
());
consignSaleAppletVo
.
setSendTime
(
consignSaleRecord
.
getCreateTime
());
}
// 平台事务鉴定并定价,尚未鉴定
else
if
(
consignSaleRecord
.
getType
().
intValue
()
==
ConsignSaleEnum
.
OperateTypeEnum
.
IDENTIFY
.
getCode
())
{
appletStateNodeVoList
.
get
(
3
).
setPassed
(
true
);
appletStateNodeVoList
.
get
(
3
).
setDesc
(
ConsignSaleEnum
.
AppletNodeDescEnum
.
IDENTIFY
.
getDes
());
}
// 平台事务鉴定并定价,鉴定后
else
if
(
consignSaleRecord
.
getType
().
intValue
()
==
ConsignSaleEnum
.
OperateTypeEnum
.
WAIT_USER_CONFIRM_IDENTIFY
.
getCode
())
{
appletStateNodeVoList
.
get
(
3
).
setPassed
(
true
);
appletStateNodeVoList
.
get
(
3
).
setDesc
(
consignSaleRecord
.
getContent
()
+
";"
+
consignSaleRecord
.
getRemark
());
}
// 寄售中
else
if
(
consignSaleRecord
.
getType
().
intValue
()
==
ConsignSaleEnum
.
OperateTypeEnum
.
SALEING
.
getCode
())
{
appletStateNodeVoList
.
get
(
4
).
setPassed
(
true
);
}
// 货品售出,待结款
else
if
(
consignSaleRecord
.
getType
().
intValue
()
==
ConsignSaleEnum
.
OperateTypeEnum
.
SALED
.
getCode
())
{
appletStateNodeVoList
.
get
(
5
).
setPassed
(
true
);
appletStateNodeVoList
.
get
(
5
).
setDesc
(
ConsignSaleEnum
.
AppletNodeDescEnum
.
PRE_PAY
.
getDes
());
}
// 平台完成结款
else
if
(
consignSaleRecord
.
getType
().
intValue
()
==
ConsignSaleEnum
.
OperateTypeEnum
.
FINISH
.
getCode
())
{
appletStateNodeVoList
.
get
(
6
).
setPassed
(
true
);
consignSaleAppletVo
.
setFinishTime
(
consignSaleRecord
.
getCreateTime
());
}
//平台依据图文估价
AppletStateNodeVo
appletStateNodeVo2
=
new
AppletStateNodeVo
();
appletStateNodeVo2
.
setNode
(
ConsignSaleEnum
.
AppletNodeDescEnum
.
VALUATE
.
getNode
());
List
<
ConsignSaleRecord
>
consignSaleRecordList2
=
consignSaleRecordList
.
stream
().
filter
(
a
->
a
.
getType
().
intValue
()==
ConsignSaleEnum
.
OperateTypeEnum
.
WAIT_USER_CONFIRM_VALUATE
.
getCode
()).
collect
(
Collectors
.
toList
());
if
(
CollectionUtils
.
isEmpty
(
consignSaleRecordList2
))
{
appletStateNodeVo2
.
setDesc
(
ConsignSaleEnum
.
AppletNodeDescEnum
.
VALUATE
.
getDes
());
}
else
{
appletStateNodeVo2
.
setDesc
(
consignSaleRecordList2
.
get
(
0
).
getContent
()+
";"
+
consignSaleRecordList2
.
get
(
0
).
getRemark
());
}
//判断最终状态是否取消寄售,如果是取消寄售,需要把中间没有经历的节点删除
if
(
appletStateNodeVoList
.
get
(
7
).
getPassed
())
{
appletStateNodeVoList
=
appletStateNodeVoList
.
stream
().
filter
(
appletStateNodeVo
->
appletStateNodeVo
.
getPassed
()).
collect
(
Collectors
.
toList
());
}
else
{
//没有取消寄售,则取消最后的取消节点
appletStateNodeVoList
.
remove
(
7
);
}
consignSaleAppletVo
.
setNodeVoList
(
appletStateNodeVoList
);
return
Result
.
success
(
consignSaleAppletVo
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"寄售单详情查询 error : {}"
,
e
);
}
appletStateNodeVoList
.
add
(
appletStateNodeVo2
);
return
Result
.
failed
();
}
//送货至平台
AppletStateNodeVo
appletStateNodeVo3
=
new
AppletStateNodeVo
();
appletStateNodeVo3
.
setNode
(
ConsignSaleEnum
.
AppletNodeDescEnum
.
SEND
.
getNode
());
List
<
ConsignSaleRecord
>
consignSaleRecordList3
=
consignSaleRecordList
.
stream
().
filter
(
a
->
a
.
getType
().
intValue
()==
ConsignSaleEnum
.
OperateTypeEnum
.
USER_SEND
.
getCode
()).
collect
(
Collectors
.
toList
());
if
(
CollectionUtils
.
isEmpty
(
consignSaleRecordList3
))
{
appletStateNodeVo3
.
setDesc
(
ConsignSaleEnum
.
AppletNodeDescEnum
.
SEND
.
getDes
());
}
else
{
appletStateNodeVo3
.
setDesc
(
consignSaleRecordList3
.
get
(
0
).
getContent
()+
";"
+
consignSaleRecordList3
.
get
(
0
).
getRemark
());
@Override
public
Result
findImgValuateDetail
(
ConsignSaleRequestDto
dto
)
{
try
{
//首先检验有没有超时
String
saleId
=
dto
.
getSaleId
();
List
<
ConsignSaleRecord
>
consignSaleRecordList
=
consignSaleRecordDao
.
find
(
saleId
);
ConsignSale
consignSale
=
consignSaleDao
.
findById
(
saleId
);
long
itemId
=
consignSale
.
getItemId
();
Item
item
=
itemDao
.
findById
(
itemId
);
ConsignSaleRecordVo
consignSaleRecordVo
=
new
ConsignSaleRecordVo
();
consignSaleRecordVo
.
setImage
(
item
.
getImages
().
split
(
";"
)[
0
]);
consignSaleRecordVo
.
setItemName
(
item
.
getName
());
consignSaleRecordVo
.
setCustomState
(
consignSale
.
getCustomState
());
consignSaleRecordVo
.
setIsTimeOut
(
false
);
consignSaleRecordList
=
consignSaleRecordList
.
stream
().
filter
(
consignSaleRecord
->
consignSaleRecord
.
getType
().
intValue
()
==
ConsignSaleEnum
.
OperateTypeEnum
.
VALUATE
.
getCode
()).
collect
(
Collectors
.
toList
());
if
(
CollectionUtils
.
isEmpty
(
consignSaleRecordList
))
{
consignSaleRecordVo
.
setIsHasPrice
(
false
);
}
else
{
consignSaleRecordVo
.
setIsHasPrice
(
true
);
consignSaleRecordVo
.
setContent
(
consignSaleRecordList
.
get
(
0
).
getContent
());
consignSaleRecordVo
.
setRemark
(
consignSaleRecordList
.
get
(
0
).
getRemark
());
consignSaleRecordVo
.
setTime
(
consignSaleRecordList
.
get
(
0
).
getCreateTime
());
}
consignSaleRecordVo
.
setTip
(
"初步估价结果仅供参考,想要获得真实的报价需要将货品送至平台,由平台专家对实物进行专业鉴定才可以得出结果。"
);
long
num
=
consignSaleRecordList
.
stream
().
filter
(
consignSaleRecord
->
consignSaleRecord
.
getType
().
intValue
()
==
ConsignSaleEnum
.
OperateTypeEnum
.
USER_CONFIRM_VALUATE
.
getCode
()).
count
();
//尚未确认
if
(
num
==
0
)
{
Date
startTime
=
consignSaleRecordList
.
get
(
0
).
getCreateTime
();
Date
endTime
=
new
Date
();
long
diffInMillies
=
Math
.
abs
(
endTime
.
getTime
()
-
startTime
.
getTime
());
long
diffInHours
=
diffInMillies
/
(
60
*
60
*
1000
);
if
(
diffInHours
>=
24
)
{
consignSaleRecordVo
.
setIsTimeOut
(
true
);
//超时了,但是当前寄售单不是取消状态,就更新寄售单状态
if
(
consignSale
.
getCustomState
().
intValue
()
!=
ConsignSaleEnum
.
SaleForUserStateEnum
.
CANCEL
.
getCode
())
{
//超时取消
timeOutForCancel
(
dto
);
consignSaleRecordVo
.
setCustomState
(
ConsignSaleEnum
.
SaleForUserStateEnum
.
CANCEL
.
getCode
());
logger
.
info
(
">>>>>> 寄售单图文估价超时未确认,更改寄售单状态为已取消,并记录操作节点 <<<<<<<"
);
}
else
{
logger
.
info
(
">>>>>> 寄售单号:{} , 查看图文估价详情,已是取消状态 <<<<<<<"
,
saleId
);
}
}
}
return
Result
.
success
(
consignSaleRecordVo
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"图文估价详情 error : {}"
,
e
);
}
appletStateNodeVoList
.
add
(
appletStateNodeVo3
);
return
Result
.
failed
();
}
//平台实物鉴定并定价
consignSaleRecordList
.
forEach
(
consignSaleRecord
->
{
AppletStateNodeVo
appletStateNodeVo
=
new
AppletStateNodeVo
();
String
type
=
consignSaleRecord
.
getType
().
toString
();
ConsignSaleEnum
.
AppletNodeDescEnum
appletNodeDescEnum
=
ConsignSaleEnum
.
AppletNodeDescEnum
.
getAppletNodeDescByType
(
type
);
if
(
appletNodeDescEnum
!=
null
)
{
appletStateNodeVo
.
setNode
(
appletNodeDescEnum
.
getNode
());
@Override
public
Result
findIdentifyDetail
(
ConsignSaleRequestDto
dto
)
{
try
{
String
saleId
=
dto
.
getSaleId
();
ConsignSale
consignSale
=
consignSaleDao
.
findById
(
saleId
);
long
itemId
=
consignSale
.
getItemId
();
Item
item
=
itemDao
.
findById
(
itemId
);
ConsignSaleRecordVo
consignSaleRecordVo
=
new
ConsignSaleRecordVo
();
consignSaleRecordVo
.
setImage
(
item
.
getImages
().
split
(
";"
)[
0
]);
consignSaleRecordVo
.
setItemName
(
item
.
getName
());
consignSaleRecordVo
.
setCustomState
(
consignSale
.
getCustomState
());
consignSaleRecordVo
.
setIsTimeOut
(
false
);
List
<
ConsignSaleRecord
>
consignSaleRecordList
=
consignSaleRecordDao
.
find
(
saleId
);
consignSaleRecordList
=
consignSaleRecordList
.
stream
().
filter
(
consignSaleRecord
->
consignSaleRecord
.
getType
().
intValue
()
==
ConsignSaleEnum
.
OperateTypeEnum
.
IDENTIFY
.
getCode
()).
collect
(
Collectors
.
toList
());
if
(
CollectionUtils
.
isEmpty
(
consignSaleRecordList
))
{
consignSaleRecordVo
.
setIsHasPrice
(
false
);
}
else
{
consignSaleRecordVo
.
setIsHasPrice
(
true
);
consignSaleRecordVo
.
setContent
(
consignSaleRecordList
.
get
(
0
).
getContent
());
consignSaleRecordVo
.
setRemark
(
consignSaleRecordList
.
get
(
0
).
getRemark
());
consignSaleRecordVo
.
setTime
(
consignSaleRecordList
.
get
(
0
).
getCreateTime
());
}
appletStateNodeVoList
.
add
(
appletStateNodeVo
);
});
return
null
;
long
num
=
consignSaleRecordList
.
stream
().
filter
(
consignSaleRecord
->
consignSaleRecord
.
getType
().
intValue
()
==
ConsignSaleEnum
.
OperateTypeEnum
.
USER_CONFIRM_IDENTIFY
.
getCode
()).
count
();
//尚未确认
if
(
num
==
0
)
{
Date
startTime
=
consignSaleRecordList
.
get
(
0
).
getCreateTime
();
Date
endTime
=
new
Date
();
long
diffInMillies
=
Math
.
abs
(
endTime
.
getTime
()
-
startTime
.
getTime
());
long
diffInHours
=
diffInMillies
/
(
60
*
60
*
1000
);
if
(
diffInHours
>=
24
)
{
consignSaleRecordVo
.
setIsTimeOut
(
true
);
//超时了,但是当前寄售单不是取消状态,就更新寄售单状态
if
(
consignSale
.
getCustomState
().
intValue
()
!=
ConsignSaleEnum
.
SaleForUserStateEnum
.
CANCEL
.
getCode
())
{
//超时取消
timeOutForCancel
(
dto
);
consignSaleRecordVo
.
setCustomState
(
ConsignSaleEnum
.
SaleForUserStateEnum
.
CANCEL
.
getCode
());
logger
.
info
(
">>>>>> 寄售单实物鉴定超时未确认,更改寄售单状态为已取消,并记录操作节点 <<<<<<<"
);
}
else
{
logger
.
info
(
">>>>>> 寄售单号:{} , 查看实物鉴定详情,已是取消状态 <<<<<<<"
,
saleId
);
}
}
}
return
Result
.
success
(
consignSaleRecordVo
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"实物鉴定详情 error : {}"
,
e
);
}
return
Result
.
failed
();
}
@Transactional
@Override
public
Result
timeOutForCancel
(
ConsignSaleRequestDto
dto
)
{
try
{
ConsignSale
consignSale
=
new
ConsignSale
();
consignSale
.
setSaleId
(
dto
.
getSaleId
());
consignSale
.
setCustomState
(
ConsignSaleEnum
.
SaleForUserStateEnum
.
CANCEL
.
getCode
());
consignSale
.
setSystemState
(
ConsignSaleEnum
.
SaleForSysStateEnum
.
CANCEL
.
getCode
());
consignSaleDao
.
update
(
consignSale
);
//用户超时未确认,取消寄售单
consignSaleRecordDao
.
insert
(
dto
.
getSaleId
(),
"超时未确认,取消寄售"
,
ConsignSaleEnum
.
OperateTypeEnum
.
TIME_OUT_CANCEL
.
getCode
(),
null
);
return
Result
.
success
();
}
catch
(
Exception
e
)
{
logger
.
error
(
"用户超时未确认,取消寄售单 error : {}"
,
e
);
TransactionAspectSupport
.
currentTransactionStatus
().
setRollbackOnly
();
}
return
Result
.
failed
();
}
@Override
public
Result
confirmForImgValuate
(
ConsignSaleRequestDto
dto
)
{
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/ConsignSaleService.java
View file @
cea5f99e
...
...
@@ -36,6 +36,20 @@ public interface ConsignSaleService {
*/
Result
findDetail
(
ConsignSaleRequestDto
dto
);
/**
* 图文估价详情
* @param dto
* @return
*/
Result
findImgValuateDetail
(
ConsignSaleRequestDto
dto
);
/**
* 实物鉴定详情
* @param dto
* @return
*/
Result
findIdentifyDetail
(
ConsignSaleRequestDto
dto
);
/**
* 图文鉴定后用户确认
...
...
@@ -44,6 +58,14 @@ public interface ConsignSaleService {
*/
Result
confirmForImgValuate
(
ConsignSaleRequestDto
dto
);
/**
* 超时未确认取消寄售单
* @param dto
* @return
*/
Result
timeOutForCancel
(
ConsignSaleRequestDto
dto
);
/**
* 用户寄出商品
* @param dto
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/ConsignSaleController.java
View file @
cea5f99e
package
com.wwdz.ch.wx.web
;
import
com.alibaba.fastjson.JSON
;
import
com.wwdz.ch.core.consts.LogisticsEnum
;
import
com.wwdz.ch.core.consts.ResultCode
;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.db.dto.request.ConsignSaleRequestDto
;
...
...
@@ -19,7 +20,8 @@ import org.springframework.web.bind.annotation.PostMapping;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.Map
;
import
java.util.*
;
/**
* 寄售单
...
...
@@ -104,6 +106,47 @@ public class ConsignSaleController {
}
@ApiOperation
(
value
=
"用户查询寄售单详情"
)
@PostMapping
(
"/findDetail"
)
public
Result
findDetail
(
@RequestBody
ConsignSaleRequestDto
dto
)
{
logger
.
info
(
"【请求开始】用户查询寄售单详情,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
Validator
validator
=
new
Validator
(
FormHandler
.
ofEntity
(
dto
));
validator
.
set
(
"saleId"
,
"寄售单号"
).
must
().
string
()
.
end
();
if
(!
validator
.
isValid
())
{
return
Result
.
failed
(
ResultCode
.
PARAM_ERROR
.
getCode
(),
validator
.
getErrorInfo
());
}
return
consignSaleService
.
findDetail
(
dto
);
}
@ApiOperation
(
value
=
"图文估价详情"
)
@PostMapping
(
"/findImgValuateDetail"
)
public
Result
findImgValuateDetail
(
@RequestBody
ConsignSaleRequestDto
dto
)
{
logger
.
info
(
"【请求开始】图文估价详情,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
Validator
validator
=
new
Validator
(
FormHandler
.
ofEntity
(
dto
));
validator
.
set
(
"saleId"
,
"寄售单号"
).
must
().
string
()
.
end
();
if
(!
validator
.
isValid
())
{
return
Result
.
failed
(
ResultCode
.
PARAM_ERROR
.
getCode
(),
validator
.
getErrorInfo
());
}
return
consignSaleService
.
findImgValuateDetail
(
dto
);
}
@ApiOperation
(
value
=
"实物鉴定详情"
)
@PostMapping
(
"/findIdentifyDetail"
)
public
Result
findIdentifyDetail
(
@RequestBody
ConsignSaleRequestDto
dto
)
{
logger
.
info
(
"【请求开始】实物鉴定详情,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
Validator
validator
=
new
Validator
(
FormHandler
.
ofEntity
(
dto
));
validator
.
set
(
"saleId"
,
"寄售单号"
).
must
().
string
()
.
end
();
if
(!
validator
.
isValid
())
{
return
Result
.
failed
(
ResultCode
.
PARAM_ERROR
.
getCode
(),
validator
.
getErrorInfo
());
}
return
consignSaleService
.
findIdentifyDetail
(
dto
);
}
@ApiOperation
(
value
=
"图文鉴定后用户确认"
)
@PostMapping
(
"/confirmForImgValuate"
)
...
...
@@ -144,6 +187,20 @@ public class ConsignSaleController {
}
@ApiOperation
(
value
=
"超时未确认取消寄售单"
)
@PostMapping
(
"/timeOutForcancel"
)
public
Result
timeOutForcancel
(
@RequestBody
ConsignSaleRequestDto
dto
)
{
logger
.
info
(
"【请求开始】超时未确认取消寄售单,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
Validator
validator
=
new
Validator
(
FormHandler
.
ofEntity
(
dto
));
validator
.
set
(
"saleId"
,
"寄售单号"
).
must
().
string
()
.
end
();
if
(!
validator
.
isValid
())
{
return
Result
.
failed
(
ResultCode
.
PARAM_ERROR
.
getCode
(),
validator
.
getErrorInfo
());
}
return
consignSaleService
.
timeOutForCancel
(
dto
);
}
@ApiOperation
(
value
=
"用户取消寄售单"
)
@PostMapping
(
"/cancel"
)
public
Result
cancel
(
@RequestBody
ConsignSaleRequestDto
dto
)
{
...
...
@@ -157,4 +214,25 @@ public class ConsignSaleController {
}
return
consignSaleService
.
customCancel
(
dto
);
}
@ApiOperation
(
value
=
"获取快递公司列表"
)
@PostMapping
(
"/getLogisticsList"
)
public
Result
getLogisticsList
()
{
try
{
LogisticsEnum
[]
logisticsEnums
=
LogisticsEnum
.
values
();
List
<
Map
<
String
,
String
>>
mapList
=
new
ArrayList
<>();
Arrays
.
stream
(
logisticsEnums
).
forEach
(
logisticsEnum
->
{
mapList
.
add
(
new
HashMap
()
{{
put
(
"code"
,
logisticsEnum
.
getCode
());
}});
mapList
.
add
(
new
HashMap
()
{{
put
(
"name"
,
logisticsEnum
.
getName
());
}});
});
return
Result
.
success
(
mapList
);
}
catch
(
Exception
e
)
{
return
Result
.
failed
();
}
}
}
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