记得上下班打卡 | 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
0c53da83
Commit
0c53da83
authored
May 07, 2022
by
胡佳晨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交接口
parent
c0116767
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
69 additions
and
14 deletions
+69
-14
GoblinListDetailsVo.java
.../liquidnet/service/goblin/dto/vo/GoblinListDetailsVo.java
+3
-0
IGoblinListService.java
...net/service/goblin/service/manage/IGoblinListService.java
+2
-0
GoblinList.java
.../java/com/liquidnet/service/goblin/entity/GoblinList.java
+5
-0
db_goblin_list.sql
...lin/liquidnet-service-goblin-impl/docu/db_goblin_list.sql
+2
-1
GoblinListController.java
...ervice/goblin/controller/manage/GoblinListController.java
+11
-1
GoblinListServiceImpl.java
...ice/goblin/service/impl/manage/GoblinListServiceImpl.java
+29
-4
GoblinMongoUtils.java
...a/com/liquidnet/service/goblin/util/GoblinMongoUtils.java
+9
-5
GoblinRedisUtils.java
...a/com/liquidnet/service/goblin/util/GoblinRedisUtils.java
+4
-0
sqlmap.properties
...-service-goblin-impl/src/main/resources/sqlmap.properties
+4
-3
No files found.
liquidnet-bus-api/liquidnet-service-goblin-api/src/main/java/com/liquidnet/service/goblin/dto/vo/GoblinListDetailsVo.java
View file @
0c53da83
...
...
@@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModelProperty;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
import
java.util.List
;
@Data
...
...
@@ -30,6 +31,8 @@ public class GoblinListDetailsVo implements Serializable, Cloneable {
private
String
blackUrl
;
@ApiModelProperty
(
value
=
"商品数据"
)
private
List
<
GoblinListDetailsItemVo
>
itemVo
;
@ApiModelProperty
(
value
=
"创建时间"
)
private
String
createdAt
;
private
static
final
GoblinListDetailsVo
obj
=
new
GoblinListDetailsVo
();
...
...
liquidnet-bus-api/liquidnet-service-goblin-api/src/main/java/com/liquidnet/service/goblin/service/manage/IGoblinListService.java
View file @
0c53da83
...
...
@@ -28,4 +28,6 @@ public interface IGoblinListService {
ResponseDto
<
Boolean
>
create
(
GoblinListCreateParam
param
);
ResponseDto
<
Boolean
>
update
(
GoblinListUpdateParam
param
);
ResponseDto
<
Boolean
>
delete
(
String
listId
);
}
liquidnet-bus-do/liquidnet-service-goblin-do/src/main/java/com/liquidnet/service/goblin/entity/GoblinList.java
View file @
0c53da83
...
...
@@ -74,6 +74,11 @@ public class GoblinList implements Serializable {
*/
private
String
blackUrl
;
/**
* 删除标记
*/
private
String
delTag
;
/**
* 补充字段
*/
...
...
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/docu/db_goblin_list.sql
View file @
0c53da83
...
...
@@ -9,9 +9,10 @@ CREATE TABLE `goblin_list`
`white_url`
varchar
(
512
)
DEFAULT
''
COMMENT
'白名单xls地址'
,
`time_start`
datetime
DEFAULT
null
COMMENT
'开始时间'
,
`time_end`
datetime
DEFAULT
null
COMMENT
'结束时间'
,
`tag_type`
int
DEFAULT
0
COMM
I
T
'标签[0-提前购买|1-分段购买]'
,
`tag_type`
int
DEFAULT
0
COMM
EN
T
'标签[0-提前购买|1-分段购买]'
,
`black_type`
int
DEFAULT
1
COMMENT
'黑名单类型[0-会员|1-指定用户]'
,
`black_url`
varchar
(
512
)
DEFAULT
''
COMMENT
'黑名单xls地址'
,
`del_tag`
int
DEFAULT
0
COMMENT
'是否删除[0-否|1-是]'
,
`comment`
varchar
(
255
)
DEFAULT
''
COMMENT
'补充字段'
,
`created_at`
datetime
NULL
DEFAULT
CURRENT_TIMESTAMP
COMMENT
'创建时间'
,
`updated_at`
datetime
NULL
DEFAULT
CURRENT_TIMESTAMP
COMMENT
'更新时间'
,
...
...
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/controller/manage/GoblinListController.java
View file @
0c53da83
...
...
@@ -50,7 +50,7 @@ public class GoblinListController {
@ApiImplicitParam
(
type
=
"form"
,
required
=
true
,
dataType
=
"String"
,
name
=
"listId"
,
value
=
"名单id"
),
})
@GetMapping
(
"details"
)
public
ResponseDto
<
GoblinListDetailsVo
>
details
(
@NotBlank
(
message
=
"
店铺
ID不能为空"
)
@RequestParam
String
listId
)
{
public
ResponseDto
<
GoblinListDetailsVo
>
details
(
@NotBlank
(
message
=
"
集合
ID不能为空"
)
@RequestParam
String
listId
)
{
return
goblinListService
.
getDetails
(
listId
);
}
...
...
@@ -67,4 +67,14 @@ public class GoblinListController {
return
goblinListService
.
update
(
param
);
}
@ApiOperationSupport
(
order
=
1
)
@ApiOperation
(
value
=
"删除"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
type
=
"form"
,
required
=
true
,
dataType
=
"String"
,
name
=
"listId"
,
value
=
"名单id"
),
})
@DeleteMapping
(
"delete"
)
public
ResponseDto
<
Boolean
>
update
(
@NotBlank
(
message
=
"集合ID不能为空"
)
@RequestParam
String
listId
)
{
return
goblinListService
.
delete
(
listId
);
}
}
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/service/impl/manage/GoblinListServiceImpl.java
View file @
0c53da83
...
...
@@ -3,6 +3,7 @@ package com.liquidnet.service.goblin.service.impl.manage;
import
com.github.pagehelper.PageInfo
;
import
com.liquidnet.commons.lang.util.CollectionUtil
;
import
com.liquidnet.commons.lang.util.CurrentUtil
;
import
com.liquidnet.commons.lang.util.DateUtil
;
import
com.liquidnet.commons.lang.util.IDGenerator
;
import
com.liquidnet.service.base.PagedResult
;
import
com.liquidnet.service.base.ResponseDto
;
...
...
@@ -20,6 +21,7 @@ import com.liquidnet.service.goblin.util.QueueUtils;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.text.DateFormat
;
import
java.time.LocalDateTime
;
import
java.time.format.DateTimeFormatter
;
import
java.util.HashMap
;
...
...
@@ -128,8 +130,8 @@ public class GoblinListServiceImpl implements IGoblinListService {
}
collectVos
=
redisUtils
.
getGoblinListCollect
(
skuId
);
for
(
GoblinListCollectVo
collectItem
:
collectVos
)
{
if
((
st
.
isAfter
(
collectItem
.
getTimeStart
().
minusSeconds
(
1
))
&&
st
.
isBefore
(
collectItem
.
getTimeEnd
().
pl
usSeconds
(
1
)))
||
(
et
.
isAfter
(
collectItem
.
getTimeStart
().
minusSeconds
(
1
))
&&
et
.
isBefore
(
collectItem
.
getTimeEnd
().
pl
usSeconds
(
1
))))
{
if
((
st
.
isAfter
(
collectItem
.
getTimeStart
().
minusSeconds
(
1
))
&&
st
.
isBefore
(
collectItem
.
getTimeEnd
().
min
usSeconds
(
1
)))
||
(
et
.
isAfter
(
collectItem
.
getTimeStart
().
minusSeconds
(
1
))
&&
et
.
isBefore
(
collectItem
.
getTimeEnd
().
min
usSeconds
(
1
))))
{
return
ResponseDto
.
failure
(
"sku时间不能重合"
);
}
}
...
...
@@ -139,7 +141,7 @@ public class GoblinListServiceImpl implements IGoblinListService {
}
collectVos
=
redisUtils
.
getGoblinListCollect
(
skuId
);
for
(
GoblinListCollectVo
collectItem
:
collectVos
)
{
if
(
st
.
isAfter
(
collectItem
.
getTimeStart
().
minusSeconds
(
1
))
&&
st
.
isBefore
(
collectItem
.
getTimeEnd
().
pl
usSeconds
(
1
)))
{
if
(
st
.
isAfter
(
collectItem
.
getTimeStart
().
minusSeconds
(
1
))
&&
st
.
isBefore
(
collectItem
.
getTimeEnd
().
min
usSeconds
(
1
)))
{
return
ResponseDto
.
failure
(
"sku时间不能重合"
);
}
}
...
...
@@ -154,6 +156,7 @@ public class GoblinListServiceImpl implements IGoblinListService {
vo
.
setTimeStart
(
param
.
getTimeStart
());
vo
.
setTimeEnd
(
param
.
getTimeEnd
());
vo
.
setWhiteType
(
param
.
getWhiteType
());
vo
.
setCreatedAt
(
DateUtil
.
format
(
now
,
DateUtil
.
Formatter
.
yyyyMMddHHmmss
));
//判断 白名单类型
if
(
param
.
getWhiteType
().
equals
(
1
))
{
//需要xls文件
if
(
param
.
getWhiteUrl
()
==
null
||
param
.
getWhiteUrl
().
equals
(
""
))
{
...
...
@@ -172,6 +175,7 @@ public class GoblinListServiceImpl implements IGoblinListService {
itemVo
.
setPriceV
(
item
.
getPriceV
());
itemVo
.
setSkuStock
(
item
.
getSkuStock
());
itemVo
.
setProductId
(
item
.
getProductId
());
voItemList
.
add
(
itemVo
);
//库存
int
skuStock
=
redisUtils
.
decrSkuStock
(
null
,
itemVo
.
getSkuId
(),
itemVo
.
getSkuStock
());
if
(
skuStock
<
0
)
{
...
...
@@ -239,10 +243,31 @@ public class GoblinListServiceImpl implements IGoblinListService {
queueUtils
.
sendMsgByRedisXls
(
param
.
getBlackUrl
(),
blackUrl
,
"4"
,
item
.
getSkuId
());
}
redisUtils
.
setGoblinListDetailsVo
(
vo
);
mongoUtils
.
changeGoblinListDetailsVo
(
param
.
getListId
(),
vo
);
mongoUtils
.
changeGoblinListDetailsVo
(
vo
);
//sql入库
queueUtils
.
sendMsgByRedis
(
MQConst
.
GoblinQueue
.
GOBLIN_STORE_MARKET
.
getKey
(),
SqlMapping
.
get
(
"goblin_list_update"
,
param
.
getWhiteUrl
(),
param
.
getWhiteType
(),
param
.
getBlackUrl
(),
now
,
param
.
getListId
()));
return
ResponseDto
.
success
();
}
@Override
public
ResponseDto
<
Boolean
>
delete
(
String
listId
)
{
LocalDateTime
now
=
LocalDateTime
.
now
();
GoblinListDetailsVo
vo
=
redisUtils
.
getGoblinListDetailsVo
(
listId
);
if
(
vo
==
null
||
!
vo
.
getUid
().
equals
(
CurrentUtil
.
getCurrentUid
()))
{
return
ResponseDto
.
failure
(
"信息错误"
);
}
for
(
GoblinListDetailsItemVo
item
:
vo
.
getItemVo
())
{
// 白名单
queueUtils
.
sendMsgByRedisXls
(
""
,
vo
.
getWhiteUrl
(),
"3"
,
item
.
getSkuId
());
// 黑名单
queueUtils
.
sendMsgByRedisXls
(
""
,
vo
.
getBlackUrl
(),
"4"
,
item
.
getSkuId
());
}
redisUtils
.
delGoblinListDetailsVo
(
listId
);
mongoUtils
.
removeGoblinListDetailsVo
(
listId
);
//sql入库
queueUtils
.
sendMsgByRedis
(
MQConst
.
GoblinQueue
.
GOBLIN_STORE_MARKET
.
getKey
(),
SqlMapping
.
get
(
"goblin_list_remove"
,
now
,
listId
));
return
ResponseDto
.
success
();
}
}
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/util/GoblinMongoUtils.java
View file @
0c53da83
...
...
@@ -1614,22 +1614,26 @@ public class GoblinMongoUtils {
mongoTemplate
.
insert
(
vo
,
GoblinListDetailsVo
.
class
.
getSimpleName
());
}
public
Boolean
changeGoblinListDetailsVo
(
String
ucouponId
,
GoblinListDetailsVo
vo
)
{
public
void
removeGoblinListDetailsVo
(
String
listId
)
{
mongoTemplate
.
remove
(
Query
.
query
(
Criteria
.
where
(
"listId"
).
is
(
listId
)),
GoblinListDetailsVo
.
class
.
getSimpleName
());
}
public
Boolean
changeGoblinListDetailsVo
(
GoblinListDetailsVo
vo
)
{
return
mongoTemplate
.
getCollection
(
GoblinListDetailsVo
.
class
.
getSimpleName
())
.
updateOne
(
Query
.
query
(
Criteria
.
where
(
"
ucouponId"
).
is
(
ucouponId
)).
getQueryObject
(),
.
updateOne
(
Query
.
query
(
Criteria
.
where
(
"
listId"
).
is
(
vo
.
getListId
()
)).
getQueryObject
(),
ObjectUtil
.
cloneBasicDBObject
().
append
(
"$set"
,
mongoConverter
.
convertToMongoType
(
vo
))
).
getModifiedCount
()
>
0
;
}
public
HashMap
<
String
,
Object
>
getGoblinListVo
(
String
name
,
String
uid
,
Integer
pageNum
)
{
public
HashMap
<
String
,
Object
>
getGoblinListVo
(
String
name
,
String
uid
,
Integer
pageNum
)
{
int
pageSize
=
20
;
Criteria
criteria
=
Criteria
.
where
(
"uid"
).
is
(
uid
);
if
(
name
!=
null
&&!
name
.
equals
(
""
))
{
if
(
name
!=
null
&&
!
name
.
equals
(
""
))
{
criteria
=
criteria
.
and
(
"name"
).
regex
(
"^.*"
+
name
+
".*$"
);
}
Query
query
=
Query
.
query
(
criteria
);
long
total
=
mongoTemplate
.
count
(
query
,
GoblinListDetailsVo
.
class
,
GoblinListDetailsVo
.
class
.
getSimpleName
());
long
total
=
mongoTemplate
.
count
(
query
,
GoblinListDetailsVo
.
class
,
GoblinListDetailsVo
.
class
.
getSimpleName
());
query
.
with
(
PageRequest
.
of
(
pageNum
-
1
,
pageSize
)).
with
(
Sort
.
by
(
Sort
.
Order
.
desc
(
"createdAt"
)));
List
<
GoblinListDetailsVo
>
list
=
mongoTemplate
.
find
(
query
,
GoblinListDetailsVo
.
class
,
GoblinListDetailsVo
.
class
.
getSimpleName
());
...
...
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/util/GoblinRedisUtils.java
View file @
0c53da83
...
...
@@ -1727,6 +1727,10 @@ public class GoblinRedisUtils {
redisUtil
.
set
(
GoblinRedisConst
.
LIST_DETAILS
.
concat
(
vo
.
getListId
()),
vo
);
}
public
void
delGoblinListDetailsVo
(
String
listId
){
redisUtil
.
del
(
GoblinRedisConst
.
LIST_DETAILS
.
concat
(
listId
));
}
public
GoblinListDetailsVo
getGoblinListDetailsVo
(
String
listId
)
{
Object
obj
=
redisUtil
.
get
(
GoblinRedisConst
.
LIST_DETAILS
.
concat
(
listId
));
if
(
obj
==
null
)
{
...
...
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/resources/sqlmap.properties
View file @
0c53da83
...
...
@@ -150,6 +150,7 @@ adam_user_busi_acct.add=INSERT INTO adam_user_busi_acct (`uid`, busi, uuid, `wor
#---- \u9ED1\u767D\u540D\u5355 ----
goblin_list_insert
=
"INSERT INTO goblin_list (`list_id`,`uid`,`name`,`white_type`,`white_url`,`time_start`,`time_end`,`tag_type`,`black_url`,`created_at`) VALUES (?,?,?,?,?,?,?,?,?,?)"
goblin_list_detail_insert
=
"INSERT INTO goblin_list_details (`list_id`,`spu_id`,`sku_id`,`created_at`,`sku_stock`,`price_v`,`product_id`,`price`) VALUES (?,?,?,?,?,?,?,?)"
goblin_list_update
=
"UPDATE goblin_list SET white_url = ? ,white_type = ? , black_url = ? , updated_at = ? WHERE list_id = ?"
\ No newline at end of file
goblin_list_insert
=
INSERT INTO goblin_list (`list_id`,`uid`,`name`,`white_type`,`white_url`,`time_start`,`time_end`,`tag_type`,`black_url`,`created_at`) VALUES (?,?,?,?,?,?,?,?,?,?)
goblin_list_detail_insert
=
INSERT INTO goblin_list_details (`list_id`,`spu_id`,`sku_id`,`created_at`,`sku_stock`,`price_v`,`product_id`,`price`) VALUES (?,?,?,?,?,?,?,?)
goblin_list_update
=
UPDATE goblin_list SET white_url = ? ,white_type = ? , black_url = ? , updated_at = ? WHERE list_id = ?
goblin_list_remove
=
UPDATE goblin_list set del_tag = 1 , updated_at = ? WHERE list_id = ?
\ No newline at end of file
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