记得上下班打卡 | git大法好,push需谨慎
Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liquidnet-bus-v1
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
董敬伟
liquidnet-bus-v1
Commits
8faec223
Commit
8faec223
authored
Jan 07, 2022
by
胡佳晨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交资金
parent
faf4a598
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
352 additions
and
22 deletions
+352
-22
GoblinStatusConst.java
.../liquidnet/service/goblin/constant/GoblinStatusConst.java
+41
-2
GoblinOrderLogVo.java
...com/liquidnet/service/goblin/dto/vo/GoblinOrderLogVo.java
+67
-0
IGoblinStoreMoneyService.java
...rvice/goblin/service/manage/IGoblinStoreMoneyService.java
+16
-0
GoblinStoreMoneyController.java
.../goblin/controller/manage/GoblinStoreMoneyController.java
+45
-4
GoblinOrderServiceImpl.java
...t/service/goblin/service/impl/GoblinOrderServiceImpl.java
+34
-16
GoblinStoreMoneyServiceImpl.java
...blin/service/impl/manage/GoblinStoreMoneyServiceImpl.java
+45
-0
GoblinMongoUtils.java
...a/com/liquidnet/service/goblin/util/GoblinMongoUtils.java
+104
-0
No files found.
liquidnet-bus-api/liquidnet-service-goblin-api/src/main/java/com/liquidnet/service/goblin/constant/GoblinStatusConst.java
View file @
8faec223
...
...
@@ -25,7 +25,7 @@ public class GoblinStatusConst {
}
}
public
enum
Order
Status
{
public
enum
Status
{
ORDER_STATUS_0
(
0
,
"待付款(用户刚下单)"
),
ORDER_STATUS_2
(
2
,
"代发货(用户付完款 等待商城发货)"
),
ORDER_STATUS_3
(
3
,
"代收货(商城已经发货 等待用户确认收货)"
),
...
...
@@ -35,12 +35,51 @@ public class GoblinStatusConst {
ORDER_STATUS_7
(
7
,
"退货通过(用户已经确认收货后用户发出退货申请,商城同意所有退货申请 ,一个订单可能有多个单品)"
),
ORDER_STATUS_61
(
61
,
"发起-退款通过(用户已经付款但是商城还未发货,用户发出退款申请,商城同意退款)"
),
ORDER_STATUS_71
(
71
,
"发起-退货通过(用户已经确认收货后用户发出退货申请,商城同意所有退货申请 ,一个订单可能有多个单品)"
),
ORDER_LOG_STATUS_11
(
11
,
"确认付款"
),
ORDER_LOG_STATUS_12
(
12
,
"修改金额"
),
ORDER_LOG_STATUS_13
(
13
,
"发货"
),
ORDER_LOG_STATUS_14
(
14
,
"取消订单"
),
ORDER_LOG_STATUS_15
(
15
,
"修改物流单号"
),
ORDER_LOG_STATUS_16
(
16
,
"核销虚拟商品订单"
),
ORDER_LOG_STATUS_21
(
21
,
"退款申请"
),
ORDER_LOG_STATUS_22
(
22
,
"退款成功"
),
ORDER_LOG_STATUS_23
(
23
,
"退款拒绝"
),
ORDER_LOG_STATUS_24
(
24
,
"退货申请"
),
ORDER_LOG_STATUS_25
(
25
,
"退货拒绝"
),
ORDER_LOG_STATUS_26
(
26
,
"退货审核通过等待用户填写物流"
),
ORDER_LOG_STATUS_27
(
27
,
"待收货"
),
ORDER_LOG_STATUS_28
(
28
,
"退货完成"
),
ORDER_LOG_STATUS_29
(
29
,
"退款拒绝"
),
;
private
final
int
value
;
private
final
String
desc
;
Status
(
int
value
,
String
desc
)
{
this
.
value
=
value
;
this
.
desc
=
desc
;
}
public
int
getValue
()
{
return
value
;
}
public
String
getDesc
()
{
return
desc
;
}
}
public
enum
Type
{
OPERATION_TYPE_1
(
1
,
"用户"
),
OPERATION_TYPE_2
(
2
,
"商家"
),
;
private
final
int
value
;
private
final
String
desc
;
OrderStatus
(
int
value
,
String
desc
)
{
Type
(
int
value
,
String
desc
)
{
this
.
value
=
value
;
this
.
desc
=
desc
;
}
...
...
liquidnet-bus-api/liquidnet-service-goblin-api/src/main/java/com/liquidnet/service/goblin/dto/vo/GoblinOrderLogVo.java
0 → 100644
View file @
8faec223
package
com
.
liquidnet
.
service
.
goblin
.
dto
.
vo
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.liquidnet.commons.lang.util.DateUtil
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.math.BigDecimal
;
import
java.time.LocalDateTime
;
@ApiModel
@Data
public
class
GoblinOrderLogVo
implements
Cloneable
{
@ApiModelProperty
(
value
=
"订单id"
)
private
String
orderId
;
@ApiModelProperty
(
value
=
"订单号"
)
private
String
orderCode
;
@ApiModelProperty
(
value
=
"支付单号"
)
private
String
payCode
;
@ApiModelProperty
(
value
=
"订单类型"
)
private
String
orderType
;
@ApiModelProperty
(
value
=
" 商铺id"
)
private
String
storeId
;
@ApiModelProperty
(
value
=
" spuId"
)
private
String
spuId
;
@ApiModelProperty
(
value
=
" spu名称"
)
private
String
spuName
;
@ApiModelProperty
(
value
=
" skuId"
)
private
String
skuId
;
@ApiModelProperty
(
value
=
" sku实付价格[价格分]"
)
private
Long
skuPriceActual
;
@ApiModelProperty
(
value
=
" sku实付价格"
)
private
BigDecimal
skuPriceActualBig
;
@ApiModelProperty
(
value
=
" 日志类型[11-确认付款|12-修改金额|13-发货|14-取消订单|15-修改物流单号|16-核销虚拟商品订单|21-退款申请|22-退款成功|23-退款拒绝|24-退货申请|25-退货拒绝|26-退货审核通过等待用户填写物流(商家审核通过,等待用户寄回商品)|27-待收货(用户已确认)|28-退货完成|29-退款拒绝]"
)
private
Integer
status
;
@ApiModelProperty
(
value
=
" 备注"
)
private
String
remark
;
@ApiModelProperty
(
value
=
" 操作人Id"
)
private
String
operationId
;
@ApiModelProperty
(
value
=
" 操作人姓名"
)
private
String
operationName
;
@ApiModelProperty
(
value
=
" 操作人类型[1-用户|2-商家]"
)
private
Integer
operationType
;
@ApiModelProperty
(
value
=
" 创建时间"
)
@JsonFormat
(
shape
=
JsonFormat
.
Shape
.
STRING
,
pattern
=
DateUtil
.
DATE_FULL_STR
)
private
LocalDateTime
createdAt
;
public
BigDecimal
getSkuPriceActualBig
()
{
long
a
=
getSkuPriceActual
();
if
(
a
!=
0
)
{
return
new
BigDecimal
(
a
/
100
);
}
else
{
return
skuPriceActualBig
;
}
}
private
static
final
GoblinOrderLogVo
obj
=
new
GoblinOrderLogVo
();
public
static
GoblinOrderLogVo
getNew
()
{
try
{
return
(
GoblinOrderLogVo
)
obj
.
clone
();
}
catch
(
CloneNotSupportedException
e
)
{
return
new
GoblinOrderLogVo
();
}
}
}
liquidnet-bus-api/liquidnet-service-goblin-api/src/main/java/com/liquidnet/service/goblin/service/manage/IGoblinStoreMoneyService.java
0 → 100644
View file @
8faec223
package
com
.
liquidnet
.
service
.
goblin
.
service
.
manage
;
import
com.github.pagehelper.PageInfo
;
import
com.liquidnet.service.base.ResponseDto
;
import
com.liquidnet.service.goblin.dto.manage.GoblinStoreMgtCertificationParam
;
import
com.liquidnet.service.goblin.dto.manage.GoblinStoreMgtCompleteParam
;
import
com.liquidnet.service.goblin.dto.vo.GoblinOrderLogVo
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
javax.validation.Valid
;
public
interface
IGoblinStoreMoneyService
{
ResponseDto
<
PageInfo
<
GoblinOrderLogVo
>>
getSpuList
(
String
spuName
,
String
st
,
String
et
,
int
page
);
ResponseDto
<
PageInfo
<
GoblinOrderLogVo
>>
getOrderOperaList
(
String
spuId
,
String
orderCode
,
Integer
type
,
String
st
,
String
et
,
int
page
);
}
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/controller/manage/GoblinStoreMoneyController.java
View file @
8faec223
package
com
.
liquidnet
.
service
.
goblin
.
controller
.
manage
;
import
com.github.pagehelper.PageInfo
;
import
com.github.xiaoymin.knife4j.annotations.ApiSupport
;
import
com.liquidnet.service.base.ResponseDto
;
import
com.liquidnet.service.goblin.dto.vo.GoblinOrderLogVo
;
import
com.liquidnet.service.goblin.service.manage.IGoblinStoreMoneyService
;
import
com.liquidnet.service.goblin.util.GoblinRedisUtils
;
import
io.swagger.annotations.
Api
;
import
io.swagger.annotations.
*
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.*
;
import
javax.validation.Valid
;
@ApiSupport
(
order
=
149002
)
...
...
@@ -18,6 +23,42 @@ import org.springframework.web.bind.annotation.RestController;
@RequestMapping
(
"store/money"
)
public
class
GoblinStoreMoneyController
{
@Autowired
GoblinRedisUtils
goblinRedisUtils
;
IGoblinStoreMoneyService
goblinStoreMoneyService
;
@GetMapping
(
"spu/list"
)
@ApiOperation
(
"商品资金列表"
)
@ApiResponse
(
code
=
200
,
message
=
"接口返回对象参数"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
type
=
"form"
,
required
=
true
,
dataType
=
"String"
,
name
=
"spuName"
,
value
=
"商品名称"
),
@ApiImplicitParam
(
type
=
"form"
,
required
=
true
,
dataType
=
"String"
,
name
=
"st"
,
value
=
"起始时间"
),
@ApiImplicitParam
(
type
=
"form"
,
required
=
true
,
dataType
=
"String"
,
name
=
"et"
,
value
=
"终止时间"
),
@ApiImplicitParam
(
type
=
"form"
,
required
=
true
,
dataType
=
"Integer"
,
name
=
"page"
,
value
=
"页数"
),
})
public
ResponseDto
<
PageInfo
<
GoblinOrderLogVo
>>
getSpuList
(
@RequestParam
(
value
=
"spuName"
,
required
=
false
)
String
spuName
,
@RequestParam
(
value
=
"st"
,
required
=
false
)
String
st
,
@RequestParam
(
value
=
"et"
,
required
=
false
)
String
et
,
@RequestParam
(
value
=
"page"
)
Integer
page
)
{
return
goblinStoreMoneyService
.
getSpuList
(
spuName
,
st
,
et
,
page
);
}
@GetMapping
(
"orderOpera/list"
)
@ApiOperation
(
"商品订单操作日志列表"
)
@ApiResponse
(
code
=
200
,
message
=
"接口返回对象参数"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
type
=
"form"
,
required
=
true
,
dataType
=
"String"
,
name
=
"spuId"
,
value
=
"spuId"
),
@ApiImplicitParam
(
type
=
"form"
,
required
=
true
,
dataType
=
"String"
,
name
=
"orderCode"
,
value
=
"订单号"
),
@ApiImplicitParam
(
type
=
"form"
,
required
=
true
,
dataType
=
"Integer"
,
name
=
"type"
,
value
=
"交易类型[1-订单交易,2-订单退款,3-正在下单[订单交易],4-正在下单[订单退款]]"
),
@ApiImplicitParam
(
type
=
"form"
,
required
=
true
,
dataType
=
"String"
,
name
=
"st"
,
value
=
"起始时间"
),
@ApiImplicitParam
(
type
=
"form"
,
required
=
true
,
dataType
=
"String"
,
name
=
"et"
,
value
=
"终止时间"
),
@ApiImplicitParam
(
type
=
"form"
,
required
=
true
,
dataType
=
"Integer"
,
name
=
"page"
,
value
=
"页数"
),
})
public
ResponseDto
<
PageInfo
<
GoblinOrderLogVo
>>
getOrderOperaList
(
@RequestParam
(
value
=
"spuId"
,
required
=
false
)
String
spuId
,
@RequestParam
(
value
=
"orderCode"
,
required
=
false
)
String
orderCode
,
@RequestParam
(
value
=
"type"
,
required
=
false
)
Integer
type
,
@RequestParam
(
value
=
"st"
,
required
=
false
)
String
st
,
@RequestParam
(
value
=
"et"
,
required
=
false
)
String
et
,
@RequestParam
(
value
=
"page"
)
Integer
page
)
{
return
goblinStoreMoneyService
.
getOrderOperaList
(
spuId
,
orderCode
,
type
,
st
,
et
,
page
);
}
}
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/service/impl/GoblinOrderServiceImpl.java
View file @
8faec223
...
...
@@ -11,15 +11,11 @@ import com.liquidnet.service.goblin.constant.GoblinStatusConst;
import
com.liquidnet.service.goblin.dto.manage.GoblinOrderParam
;
import
com.liquidnet.service.goblin.dto.manage.GoblinOrderSkuParam
;
import
com.liquidnet.service.goblin.dto.manage.GoblinOrderStoreParam
;
import
com.liquidnet.service.goblin.dto.vo.GoblinPayInnerResultVo
;
import
com.liquidnet.service.goblin.dto.vo.GoblinOrderAttrVo
;
import
com.liquidnet.service.goblin.dto.vo.GoblinOrderSkuVo
;
import
com.liquidnet.service.goblin.dto.vo.GoblinStoreOrderVo
;
import
com.liquidnet.service.goblin.dto.vo.*
;
import
com.liquidnet.service.goblin.param.GoblinOrderPreParam
;
import
com.liquidnet.service.goblin.param.GoblinOrderSqlParam
;
import
com.liquidnet.service.goblin.param.PayAgainParam
;
import
com.liquidnet.service.goblin.param.SyncOrderParam
;
import
com.liquidnet.service.goblin.dto.vo.GoblinGoodsSkuInfoVo
;
import
com.liquidnet.service.goblin.entity.GoblinOrderAttr
;
import
com.liquidnet.service.goblin.entity.GoblinOrderSku
;
import
com.liquidnet.service.goblin.entity.GoblinStoreOrder
;
...
...
@@ -225,7 +221,7 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
GoblinOrderSku
orderSku
=
GoblinOrderSku
.
getNew
();
orderSku
.
setOrderSkuId
(
IDGenerator
.
nextTimeId2
());
orderSku
.
setOrderId
(
orderId
);
orderSku
.
setStatus
(
GoblinStatusConst
.
Order
Status
.
ORDER_STATUS_0
.
getValue
());
orderSku
.
setStatus
(
GoblinStatusConst
.
Status
.
ORDER_STATUS_0
.
getValue
());
orderSku
.
setSpuId
(
skuParam
.
getSpuId
());
orderSku
.
setSkuId
(
skuParam
.
getSkuId
());
orderSku
.
setNum
(
skuParam
.
getNumber
());
...
...
@@ -354,12 +350,12 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
payInnerResultVo
.
setPayType
(
preParam
.
getPayType
());
}
List
<
String
>
goblinOrderSkuIdList
=
CollectionUtil
.
linkedListString
();
LinkedList
<
String
>
sqls
=
CollectionUtil
.
linkedListString
();
sqls
.
add
(
SqlMapping
.
get
(
"goblin.order.create.sku_insert"
));
sqls
.
add
(
SqlMapping
.
get
(
"goblin.order.create.order_insert"
));
sqls
.
add
(
SqlMapping
.
get
(
"goblin.order.create.attr_insert"
));
for
(
GoblinOrderSqlParam
item
:
sqlParams
)
{
List
<
String
>
goblinOrderSkuIdList
=
CollectionUtil
.
linkedListString
();
LinkedList
<
Object
[]>
sqlDataSku
=
CollectionUtil
.
linkedListObjectArr
();
LinkedList
<
Object
[]>
sqlDataOrder
=
CollectionUtil
.
linkedListObjectArr
();
LinkedList
<
Object
[]>
sqlDataAttr
=
CollectionUtil
.
linkedListObjectArr
();
...
...
@@ -435,7 +431,7 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
return
ResponseDto
.
failure
(
"订单不存在"
);
}
if
(
storeOrderVo
.
getStatus
()
!=
GoblinStatusConst
.
Order
Status
.
ORDER_STATUS_0
.
getValue
())
{
if
(
storeOrderVo
.
getStatus
()
!=
GoblinStatusConst
.
Status
.
ORDER_STATUS_0
.
getValue
())
{
return
ResponseDto
.
failure
(
"订单无法支付"
);
//订单
}
String
returnCheckData
=
HttpUtil
.
get
(
checkUrl
+
"?code="
+
storeOrderVo
.
getPayCode
(),
null
);
...
...
@@ -523,8 +519,8 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
log
.
error
(
"订单号:"
+
syncOrderParam
.
getOrderCode
()
+
" 订单不存在"
);
return
"fail"
;
//订单不存在
}
if
(
orderVo
.
getStatus
()
!=
GoblinStatusConst
.
Order
Status
.
ORDER_STATUS_0
.
getValue
())
{
if
(
!
orderVo
.
getPayCode
().
equals
(
syncOrderParam
.
getCode
()))
{
if
(
orderVo
.
getStatus
()
!=
GoblinStatusConst
.
Status
.
ORDER_STATUS_0
.
getValue
())
{
if
(
orderVo
.
getPayCode
().
equals
(
syncOrderParam
.
getCode
()))
{
log
.
error
(
"订单号:"
+
syncOrderParam
.
getOrderCode
()
+
" 重复支付"
);
return
"fail"
;
//重复支付
}
...
...
@@ -537,12 +533,12 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
LinkedList
<
Object
[]>
sqlDataOrder
=
CollectionUtil
.
linkedListObjectArr
();
LinkedList
<
Object
[]>
sqlDataSku
=
CollectionUtil
.
linkedListObjectArr
();
GoblinStoreOrder
storeOrder
=
GoblinStoreOrder
.
getNew
();
if
(
orderVo
.
getStatus
()
==
GoblinStatusConst
.
Order
Status
.
ORDER_STATUS_5
.
getValue
()
&&
syncOrderParam
.
getStatus
().
equals
(
1
))
{
if
(
orderVo
.
getStatus
()
==
GoblinStatusConst
.
Status
.
ORDER_STATUS_5
.
getValue
()
&&
syncOrderParam
.
getStatus
().
equals
(
1
))
{
log
.
error
(
"订单号为 {} 的订单超时支付"
,
syncOrderParam
.
getOrderCode
());
// todo 操作超时支付
// orderVo.setStatus(GoblinStatusConst.OrderStatus.ORDER_STATUS_61.getValue());
// redisUtils.setGoblinOrder(orderVo.getOrderId(),orderVo);
}
else
if
((
orderVo
.
getStatus
()
==
GoblinStatusConst
.
OrderStatus
.
ORDER_STATUS_6
.
getValue
()
||
orderVo
.
getStatus
()
==
GoblinStatusConst
.
Order
Status
.
ORDER_STATUS_7
.
getValue
())
&&
syncOrderParam
.
getStatus
().
equals
(
1
))
{
}
else
if
((
orderVo
.
getStatus
()
==
GoblinStatusConst
.
Status
.
ORDER_STATUS_6
.
getValue
()
||
orderVo
.
getStatus
()
==
GoblinStatusConst
.
Status
.
ORDER_STATUS_7
.
getValue
())
&&
syncOrderParam
.
getStatus
().
equals
(
1
))
{
log
.
error
(
"订单号为 {} 的订单正在退款 或者已退款"
,
syncOrderParam
.
getOrderCode
());
}
else
if
(
syncOrderParam
.
getStatus
().
equals
(
1
))
{
log
.
error
(
"订单号为 {} 的订单正常流程"
,
syncOrderParam
.
getOrderCode
());
...
...
@@ -555,7 +551,7 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
}
else
{
storeOrder
.
setWriteOffCode
(
""
);
}
storeOrder
.
setStatus
(
GoblinStatusConst
.
Order
Status
.
ORDER_STATUS_2
.
getValue
());
storeOrder
.
setStatus
(
GoblinStatusConst
.
Status
.
ORDER_STATUS_2
.
getValue
());
storeOrder
.
setUpdatedAt
(
now
);
sqls
.
add
(
SqlMapping
.
get
(
"goblin_order.pay.order"
));
sqlDataOrder
.
add
(
new
Object
[]{
...
...
@@ -568,13 +564,35 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
GoblinOrderSkuVo
orderSkuVo
=
redisUtils
.
getGoblinOrderSkuVo
(
orderSkuVoIds
);
//增加销量
redisUtils
.
incrSkuSaleCount
(
orderSkuVo
.
getSkuId
(),
orderSkuVo
.
getNum
());
orderSkuVo
.
setStatus
(
GoblinStatusConst
.
Order
Status
.
ORDER_STATUS_2
.
getValue
());
orderSkuVo
.
setStatus
(
GoblinStatusConst
.
Status
.
ORDER_STATUS_2
.
getValue
());
//redis
redisUtils
.
setGoblinOrderSku
(
orderSkuVo
.
getOrderSkuId
(),
orderSkuVo
);
//mongo
mongoUtils
.
updateGoblinOrderSkuVo
(
orderSkuVo
.
getOrderSkuId
(),
orderSkuVo
);
//mongo 添加操作日志
GoblinOrderLogVo
logVo
=
GoblinOrderLogVo
.
getNew
();
logVo
.
setOrderId
(
orderVo
.
getOrderId
());
logVo
.
setOrderCode
(
orderVo
.
getOrderCode
());
logVo
.
setPayCode
(
orderVo
.
getPayCode
());
logVo
.
setStoreId
(
orderVo
.
getStoreId
());
if
(
orderSkuVo
.
getOrderSkuId
().
indexOf
(
GoblinStatusConst
.
MarketPreStatus
.
MARKET_PRE_PURCHASE
.
getValue
())
>
0
)
{
logVo
.
setOrderType
(
"zhengzai"
);
}
else
{
logVo
.
setOrderType
(
"order"
);
}
logVo
.
setSpuId
(
orderSkuVo
.
getSpuId
());
logVo
.
setSkuId
(
orderSkuVo
.
getSkuId
());
logVo
.
setSkuPriceActual
(
orderSkuVo
.
getSkuPriceActual
().
multiply
(
new
BigDecimal
(
100
)).
longValue
());
logVo
.
setStatus
(
GoblinStatusConst
.
Status
.
ORDER_LOG_STATUS_11
.
getValue
());
logVo
.
setRemark
(
GoblinStatusConst
.
Status
.
ORDER_LOG_STATUS_11
.
getDesc
());
logVo
.
setOperationId
(
orderVo
.
getUserId
());
logVo
.
setOperationName
(
orderVo
.
getUserName
());
logVo
.
setOperationType
(
GoblinStatusConst
.
Type
.
OPERATION_TYPE_1
.
getValue
());
logVo
.
setCreatedAt
(
LocalDateTime
.
now
());
mongoUtils
.
insertGoblinOrderLogVo
(
logVo
);
//mysql
sqlDataSku
.
add
(
new
Object
[]{
GoblinStatusConst
.
Order
Status
.
ORDER_STATUS_2
.
getValue
(),
now
,
GoblinStatusConst
.
Status
.
ORDER_STATUS_2
.
getValue
(),
now
,
orderSkuVo
.
getOrderSkuId
(),
now
,
now
});
}
...
...
@@ -587,7 +605,7 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
redisUtils
.
setGoblinOrder
(
orderId
,
orderVo
);
//删除未支付订单
redisUtils
.
removeGoblinOrder
(
null
,
orderId
);
//mongo
改
//mongo
mongoUtils
.
updateGoblinStoreOrderVo
(
orderId
,
orderVo
);
//mysql
queueUtils
.
sendMsgByRedis
(
MQConst
.
KylinQueue
.
SQL_ORDER_CREATE
.
getKey
(),
...
...
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/service/impl/manage/GoblinStoreMoneyServiceImpl.java
0 → 100644
View file @
8faec223
package
com
.
liquidnet
.
service
.
goblin
.
service
.
impl
.
manage
;
import
com.github.pagehelper.PageInfo
;
import
com.liquidnet.commons.lang.util.CurrentUtil
;
import
com.liquidnet.service.base.ResponseDto
;
import
com.liquidnet.service.goblin.dto.vo.GoblinOrderLogVo
;
import
com.liquidnet.service.goblin.dto.vo.GoblinStoreInfoVo
;
import
com.liquidnet.service.goblin.service.manage.IGoblinStoreMoneyService
;
import
com.liquidnet.service.goblin.util.GoblinMongoUtils
;
import
com.liquidnet.service.goblin.util.GoblinRedisUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.HashMap
;
import
java.util.List
;
@Service
public
class
GoblinStoreMoneyServiceImpl
implements
IGoblinStoreMoneyService
{
@Autowired
GoblinRedisUtils
redisUtils
;
@Autowired
GoblinMongoUtils
mongoUtils
;
@Override
public
ResponseDto
<
PageInfo
<
GoblinOrderLogVo
>>
getSpuList
(
String
spuName
,
String
st
,
String
et
,
int
page
)
{
String
uid
=
CurrentUtil
.
getCurrentUid
();
GoblinStoreInfoVo
vo
=
redisUtils
.
getStoreInfoVoByUid
(
uid
);
if
(
vo
==
null
)
{
return
ResponseDto
.
failure
(
"店铺不存在"
);
}
HashMap
<
String
,
Object
>
map
=
mongoUtils
.
moneyGetSpuList
(
spuName
,
st
,
et
,
vo
.
getStoreId
(),
page
);
PageInfo
<
GoblinOrderLogVo
>
info
=
new
PageInfo
((
List
<
GoblinOrderLogVo
>)
map
.
get
(
"data"
));
info
.
setTotal
((
Long
)
map
.
get
(
"total"
));
return
ResponseDto
.
success
(
info
);
}
@Override
public
ResponseDto
<
PageInfo
<
GoblinOrderLogVo
>>
getOrderOperaList
(
String
spuId
,
String
orderCode
,
Integer
type
,
String
st
,
String
et
,
int
page
)
{
HashMap
<
String
,
Object
>
map
=
mongoUtils
.
moneyGetSpuDetails
(
spuId
,
orderCode
,
type
,
st
,
et
,
page
);
PageInfo
<
GoblinOrderLogVo
>
info
=
new
PageInfo
((
List
<
GoblinOrderLogVo
>)
map
.
get
(
"data"
));
info
.
setTotal
((
Long
)
map
.
get
(
"total"
));
return
ResponseDto
.
success
(
info
);
}
}
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/util/GoblinMongoUtils.java
View file @
8faec223
...
...
@@ -3,6 +3,7 @@ package com.liquidnet.service.goblin.util;
import
com.liquidnet.commons.lang.util.CollectionUtil
;
import
com.liquidnet.commons.lang.util.DateUtil
;
import
com.liquidnet.service.base.PagedResult
;
import
com.liquidnet.service.goblin.constant.GoblinStatusConst
;
import
com.liquidnet.service.goblin.dto.manage.GoblinStoreMgtGoodsFilterParam
;
import
com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtGoodsListVo
;
import
com.liquidnet.service.goblin.dto.vo.*
;
...
...
@@ -15,6 +16,8 @@ import org.springframework.data.domain.PageRequest;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.domain.Sort
;
import
org.springframework.data.mongodb.core.MongoTemplate
;
import
org.springframework.data.mongodb.core.aggregation.Aggregation
;
import
org.springframework.data.mongodb.core.aggregation.AggregationResults
;
import
org.springframework.data.mongodb.core.convert.MongoConverter
;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.data.mongodb.core.query.Query
;
...
...
@@ -23,6 +26,8 @@ import org.springframework.stereotype.Component;
import
org.springframework.util.CollectionUtils
;
import
java.time.LocalDateTime
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.regex.Pattern
;
...
...
@@ -393,4 +398,103 @@ public class GoblinMongoUtils {
Query
.
query
(
Criteria
.
where
(
"orderSkuId"
).
is
(
orderSkuId
)).
getQueryObject
(),
object
);
}
//添加 操作日志
public
GoblinOrderLogVo
insertGoblinOrderLogVo
(
GoblinOrderLogVo
vo
)
{
return
mongoTemplate
.
insert
(
vo
,
GoblinOrderLogVo
.
class
.
getSimpleName
());
}
//资金列表
public
HashMap
<
String
,
Object
>
moneyGetSpuList
(
String
spuName
,
String
st
,
String
et
,
String
storeId
,
int
page
)
{
//查询销量
int
size
=
20
;
int
skipCount
=
((
page
-
1
)
*
size
);
List
<
GoblinGoodsInfoVo
>
spuIdAndName
=
null
;
Criteria
criteria
=
Criteria
.
where
(
"status"
).
in
(
GoblinStatusConst
.
Status
.
ORDER_LOG_STATUS_11
.
getValue
(),
GoblinStatusConst
.
Status
.
ORDER_LOG_STATUS_22
.
getValue
(),
GoblinStatusConst
.
Status
.
ORDER_LOG_STATUS_28
.
getValue
()).
and
(
"storeId"
).
is
(
storeId
);
if
(
spuName
!=
null
)
{
//根据spu名称查询spuId
Query
query
=
Query
.
query
(
Criteria
.
where
(
"name"
).
regex
(
".*?\\"
+
spuName
));
query
.
fields
().
include
(
"spuId"
).
include
(
"name"
);
spuIdAndName
=
mongoTemplate
.
find
(
query
,
GoblinGoodsInfoVo
.
class
,
GoblinGoodsInfoVo
.
class
.
getSimpleName
());
criteria
=
criteria
.
and
(
"spuId"
).
in
(
spuIdAndName
.
stream
().
map
(
GoblinGoodsInfoVo:
:
getSpuId
).
collect
(
Collectors
.
toList
()));
}
if
(
st
!=
null
&&
et
!=
null
)
{
criteria
=
criteria
.
and
(
"createdAt"
).
gte
(
st
).
lt
(
et
);
}
//查询聚合数据
Aggregation
aggregation
=
Aggregation
.
newAggregation
(
Aggregation
.
match
(
criteria
),
Aggregation
.
skip
(
skipCount
),
Aggregation
.
limit
(
size
),
Aggregation
.
group
(
"spuId"
)
.
first
(
"spuId"
).
as
(
"spuId"
)
.
first
(
"createdAt"
).
as
(
"createdAt"
)
.
sum
(
"skuPriceActual"
).
as
(
"skuPriceActual"
)
);
AggregationResults
<
GoblinOrderLogVo
>
outputType
=
mongoTemplate
.
aggregate
(
aggregation
,
GoblinOrderLogVo
.
class
.
getSimpleName
(),
GoblinOrderLogVo
.
class
);
List
<
GoblinOrderLogVo
>
dataList
=
new
ArrayList
(
outputType
.
getMappedResults
());
if
(
spuIdAndName
==
null
)
{
Query
query
=
Query
.
query
(
Criteria
.
where
(
"spuId"
).
in
(
dataList
.
stream
().
map
(
GoblinOrderLogVo:
:
getSpuId
).
collect
(
Collectors
.
toList
())));
query
.
fields
().
include
(
"spuId"
).
include
(
"name"
);
spuIdAndName
=
mongoTemplate
.
find
(
query
,
GoblinGoodsInfoVo
.
class
,
GoblinGoodsInfoVo
.
class
.
getSimpleName
());
}
//查询总数量
Query
countQuery
=
Query
.
query
(
criteria
);
countQuery
.
fields
().
include
(
"spuId"
);
List
<
GoblinOrderLogVo
>
countList
=
mongoTemplate
.
find
(
countQuery
,
GoblinOrderLogVo
.
class
,
GoblinOrderLogVo
.
class
.
getSimpleName
());
long
total
=
countList
.
stream
().
map
(
GoblinOrderLogVo:
:
getSpuId
).
distinct
().
collect
(
Collectors
.
toList
()).
size
();
//处理数据
for
(
GoblinOrderLogVo
item
:
dataList
)
{
for
(
GoblinGoodsInfoVo
item2
:
spuIdAndName
)
{
if
(
item
.
getSpuId
().
equals
(
item2
.
getSpuId
()))
{
item
.
setSpuName
(
item2
.
getName
());
break
;
}
}
}
HashMap
<
String
,
Object
>
map
=
CollectionUtil
.
mapStringObject
();
map
.
put
(
"data"
,
dataList
);
map
.
put
(
"total"
,
total
);
return
map
;
}
//商品订单操作日志列表
public
HashMap
<
String
,
Object
>
moneyGetSpuDetails
(
String
spuId
,
String
orderCode
,
Integer
type
,
String
st
,
String
et
,
int
page
)
{
//查询销量
int
size
=
20
;
int
skipCount
=
((
page
-
1
)
*
size
);
Criteria
criteria
=
Criteria
.
where
(
"status"
).
in
(
GoblinStatusConst
.
Status
.
ORDER_LOG_STATUS_11
.
getValue
()).
and
(
"spuId"
).
is
(
spuId
);
if
(
st
!=
null
&&
et
!=
null
)
{
criteria
=
criteria
.
and
(
"createdAt"
).
gte
(
st
).
lt
(
et
);
}
if
(
orderCode
!=
null
)
{
criteria
=
criteria
.
and
(
"orderCode"
).
is
(
orderCode
);
}
if
(
type
!=
null
)
{
switch
(
type
)
{
case
1
:
criteria
=
criteria
.
and
(
"orderType"
).
is
(
"order"
).
and
(
"status"
).
is
(
1
);
break
;
case
2
:
criteria
=
criteria
.
and
(
"orderType"
).
is
(
"order"
).
and
(
"status"
).
in
(
22
,
28
);
break
;
case
3
:
criteria
=
criteria
.
and
(
"orderType"
).
is
(
"zhengzai"
).
and
(
"status"
).
is
(
1
);
break
;
case
4
:
criteria
=
criteria
.
and
(
"orderType"
).
is
(
"zhengzai"
).
and
(
"status"
).
in
(
22
,
28
);
break
;
}
}
List
<
GoblinOrderLogVo
>
dataList
=
mongoTemplate
.
find
(
Query
.
query
(
criteria
),
GoblinOrderLogVo
.
class
,
GoblinOrderLogVo
.
class
.
getSimpleName
());
//查询总数量
Query
countQuery
=
Query
.
query
(
criteria
);
countQuery
.
fields
().
include
(
"spuId"
);
List
<
GoblinOrderLogVo
>
countList
=
mongoTemplate
.
find
(
countQuery
,
GoblinOrderLogVo
.
class
,
GoblinOrderLogVo
.
class
.
getSimpleName
());
long
total
=
countList
.
size
();
HashMap
<
String
,
Object
>
map
=
CollectionUtil
.
mapStringObject
();
map
.
put
(
"data"
,
dataList
);
map
.
put
(
"total"
,
total
);
return
map
;
}
}
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