记得上下班打卡 | 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
98ec262f
Commit
98ec262f
authored
Apr 26, 2022
by
wanglele
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
兑换码sku--->时间
parent
33d5203e
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
94 additions
and
18 deletions
+94
-18
GoblinRedisConst.java
...m/liquidnet/service/goblin/constant/GoblinRedisConst.java
+5
-0
GoblinNftExActivityMapper.xml
...idnet.service.goblin.mapper/GoblinNftExActivityMapper.xml
+1
-1
GoblinNftExActivityController.java
...roller/goblin/activity/GoblinNftExActivityController.java
+5
-9
GoblinNftExSkuServiceImpl.java
...atform/service/impl/goblin/GoblinNftExSkuServiceImpl.java
+72
-4
GoblinRedisUtils.java
...om/liquidnet/service/platform/utils/GoblinRedisUtils.java
+11
-4
No files found.
liquidnet-bus-api/liquidnet-service-goblin-api/src/main/java/com/liquidnet/service/goblin/constant/GoblinRedisConst.java
View file @
98ec262f
...
...
@@ -292,6 +292,11 @@ public class GoblinRedisConst {
*/
public
static
final
String
ACTIVITY_SKU_CODE
=
PREFIX
.
concat
(
"activity:sku:code:"
);
/**
* 兑换码sku时间
*/
public
static
final
String
ACTIVITY_SKU_TIME
=
PREFIX
.
concat
(
"activity:sku:time"
);
/**
* 是否购买过技术数字藏品
*/
...
...
liquidnet-bus-do/liquidnet-service-goblin-do/src/main/resources/com.liquidnet.service.goblin.mapper/GoblinNftExActivityMapper.xml
View file @
98ec262f
...
...
@@ -14,7 +14,7 @@
<where>
<if
test=
"title != null and title != ''"
>
<bind
name=
"likeTitle"
value=
"'%' + title + '%'"
/>
and title like #{likeTitle
,jdbcType=VARCHAR
}
and title like #{likeTitle}
</if>
<if
test=
"startTime != null"
>
and created_at
>
#{startTime,jdbcType=TIMESTAMP}
...
...
liquidnet-bus-service/liquidnet-service-platform/liquidnet-service-platform-impl/src/main/java/com/liquidnet/service/platform/controller/goblin/activity/GoblinNftExActivityController.java
View file @
98ec262f
...
...
@@ -5,7 +5,6 @@ import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import
com.liquidnet.service.base.ResponseDto
;
import
com.liquidnet.service.goblin.dto.vo.GoblinNftExActivityVo
;
import
com.liquidnet.service.goblin.dto.vo.GoblinNftSkuVo
;
import
com.liquidnet.service.goblin.entity.GoblinGoods
;
import
com.liquidnet.service.goblin.param.GoblinNftExActivityParam
;
import
com.liquidnet.service.goblin.service.IGoblinNftExActivityService
;
import
io.swagger.annotations.Api
;
...
...
@@ -15,7 +14,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.validation.Valid
;
import
java.util.List
;
...
...
@@ -39,14 +37,14 @@ public class GoblinNftExActivityController {
@ApiOperationSupport
(
order
=
1
)
@ApiOperation
(
value
=
"添加nft兑换活动"
)
@PostMapping
(
"add"
)
public
ResponseDto
<
String
>
add
(
@Valid
@RequestBody
GoblinNftExActivityParam
goblinNftExActivityParam
){
public
ResponseDto
<
String
>
add
(
@Valid
@RequestBody
GoblinNftExActivityParam
goblinNftExActivityParam
)
{
return
ResponseDto
.
success
(
iGoblinNftExActivityService
.
add
(
goblinNftExActivityParam
));
}
@ApiOperationSupport
(
order
=
2
)
@ApiOperation
(
value
=
"活动列表"
)
@PostMapping
(
"pageList"
)
public
ResponseDto
<
PageInfo
<
GoblinNftExActivityVo
>>
pageList
(
@Valid
@RequestBody
GoblinNftExActivityParam
goblinNftExActivityParam
){
public
ResponseDto
<
PageInfo
<
GoblinNftExActivityVo
>>
pageList
(
@Valid
@RequestBody
GoblinNftExActivityParam
goblinNftExActivityParam
)
{
return
ResponseDto
.
success
(
iGoblinNftExActivityService
.
pageList
(
goblinNftExActivityParam
));
}
...
...
@@ -54,16 +52,14 @@ public class GoblinNftExActivityController {
@ApiOperationSupport
(
order
=
3
)
@ApiOperation
(
value
=
"根据nft兑换活动获取绑定商品"
)
@PostMapping
(
"selectNftSkuByActivityId/{activityId}"
)
public
ResponseDto
<
List
<
GoblinNftSkuVo
>>
selectNftSkuByActivityId
(
@PathVariable
(
"activityId"
)
String
activityId
)
{
public
ResponseDto
<
List
<
GoblinNftSkuVo
>>
selectNftSkuByActivityId
(
@PathVariable
(
"activityId"
)
String
activityId
)
{
return
ResponseDto
.
success
(
iGoblinNftExActivityService
.
selectNftSkuByActivityId
(
activityId
));
}
@ApiOperationSupport
(
order
=
4
)
@ApiOperation
(
value
=
"excel导出"
)
@PostMapping
(
"excel"
)
public
void
excel
(
HttpServletResponse
httpServletResponse
,
@RequestBody
GoblinNftExActivityParam
goblinNftExActivityParam
)
{
iGoblinNftExActivityService
.
excel
(
httpServletResponse
,
goblinNftExActivityParam
);
public
void
excel
(
HttpServletResponse
httpServletResponse
,
@RequestBody
GoblinNftExActivityParam
goblinNftExActivityParam
)
{
iGoblinNftExActivityService
.
excel
(
httpServletResponse
,
goblinNftExActivityParam
);
}
}
liquidnet-bus-service/liquidnet-service-platform/liquidnet-service-platform-impl/src/main/java/com/liquidnet/service/platform/service/impl/goblin/GoblinNftExSkuServiceImpl.java
View file @
98ec262f
package
com
.
liquidnet
.
service
.
platform
.
service
.
impl
.
goblin
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.liquidnet.commons.lang.util.IDGenerator
;
import
com.liquidnet.commons.lang.util.StringUtil
;
import
com.liquidnet.service.goblin.dto.vo.GoblinGoodsSkuInfoVo
;
import
com.liquidnet.service.goblin.dto.vo.GoblinNftExCodeVo
;
import
com.liquidnet.service.goblin.dto.vo.GoblinNftExSkuVo
;
import
com.liquidnet.service.goblin.entity.GoblinGoodsSku
;
import
com.liquidnet.service.goblin.entity.GoblinNftExCode
;
import
com.liquidnet.service.goblin.entity.GoblinNftExSku
;
...
...
@@ -22,6 +25,7 @@ import org.springframework.transaction.annotation.Transactional;
import
java.math.BigDecimal
;
import
java.time.Duration
;
import
java.time.LocalDateTime
;
import
java.time.format.DateTimeFormatter
;
import
java.util.*
;
/**
...
...
@@ -87,6 +91,9 @@ public class GoblinNftExSkuServiceImpl implements IGoblinNftExSkuService {
// 构建对象
long
startr
=
System
.
currentTimeMillis
();
Map
<
String
,
GoblinNftExSkuParam
>
goblinNftExSkuParamMap
=
new
HashMap
<>();
for
(
GoblinNftExSkuParam
goblinNftExSkuParam
:
goblinNftExSkuParams
)
{
GoblinNftExSku
goblinNftExSku
=
new
GoblinNftExSku
();
...
...
@@ -142,6 +149,9 @@ public class GoblinNftExSkuServiceImpl implements IGoblinNftExSkuService {
// redis 存储
goblinRedisUtils
.
addCode
(
code
,
goblinNftExCodeVo
,
millisNum
);
}
goblinNftExSkuParamMap
.
put
(
key
,
goblinNftExSkuParam
);
}
break
;
...
...
@@ -186,22 +196,81 @@ public class GoblinNftExSkuServiceImpl implements IGoblinNftExSkuService {
goblinRedisUtils
.
addCode
(
code
,
goblinNftExCodeVo
,
millisNum
);
// goblinNftExCodeArrayList.add(GoblinNftExCodeVo.getNew().copy(goblinNftExCode));
}
GoblinNftExSkuParam
value
=
goblinNftExSkuParamMap
.
get
(
goblinNftExSkuParam
.
getSkuId
());
if
(
value
==
null
)
{
goblinNftExSkuParamMap
.
put
(
goblinNftExSkuParam
.
getSkuId
(),
goblinNftExSkuParam
);
}
goblinNftExSkus
.
add
(
goblinNftExSku
);
// goblinNftExSkuArrayList.add(GoblinNftExSkuVo.getNew().copy(goblinNftExSku));
}
}
log
.
debug
(
"RDM耗时:ms"
,
System
.
currentTimeMillis
()
-
startr
);
for
(
String
key
:
goblinNftExSkuParamMap
.
keySet
())
{
Object
object
=
goblinRedisUtils
.
getSkuTime
(
key
);
GoblinNftExSkuParam
goblinNftExSkuParam
=
goblinNftExSkuParamMap
.
get
(
key
);
LocalDateTime
exStartTime
=
goblinNftExSkuParam
.
getExStartTime
();
// "2022-06-26 19:00:00";
LocalDateTime
exStopTime
=
goblinNftExSkuParam
.
getExStopTime
();
// "2024-06-26 19:00:00";
if
(!
StringUtil
.
isEmpty
(
object
))
{
GoblinNftExSkuVo
goblinNftExSkuVo
=
JSON
.
parseObject
(
object
.
toString
(),
GoblinNftExSkuVo
.
class
);
// redis存储 单个sku的开始和结束时间
LocalDateTime
rdExStartTime
=
goblinNftExSkuVo
.
getExStartTime
();
// "2019-06-26 19:00:00";
LocalDateTime
rdExStopTime
=
goblinNftExSkuVo
.
getExStopTime
();
// "2023-06-26 19:00:00";
// 时间比对
if
(!
rdExStartTime
.
isAfter
(
exStartTime
))
{
exStartTime
=
rdExStartTime
;
}
if
(
rdExStopTime
.
isAfter
(
exStopTime
))
{
exStopTime
=
rdExStopTime
;
}
}
GoblinNftExSkuVo
goblinNftExSkuVo
=
GoblinNftExSkuVo
.
getNew
();
goblinNftExSkuVo
.
setExStartTime
(
exStartTime
);
goblinNftExSkuVo
.
setExStopTime
(
exStopTime
);
// goblinNftExSkus.addSkuTime(key);
}
log
.
debug
(
"RDM耗时:ms"
,
System
.
currentTimeMillis
()
-
startr
);
// 数据库操作
long
startm
=
System
.
currentTimeMillis
();
goblinNftExSkuMapper
.
addGoblinNftExSkus
(
goblinNftExSkus
);
goblinNftExCodeMapper
.
addGoblinNftExCodes
(
goblinNftExCodes
);
log
.
debug
(
"MSQ耗时:ms"
,
System
.
currentTimeMillis
()
-
startm
);
log
.
debug
(
"MSQ耗时:ms"
,
System
.
currentTimeMillis
()
-
startm
);
return
true
;
}
public
static
void
main
(
String
[]
args
)
{
String
time1
=
"2019-06-26 19:00:00"
;
String
time2
=
"2022-06-26 19:00:00"
;
String
time3
=
"2023-06-26 19:00:00"
;
String
time4
=
"2024-06-26 19:00:00"
;
DateTimeFormatter
dtf2
=
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd HH:mm:ss"
);
LocalDateTime
localDateTime
=
LocalDateTime
.
parse
(
time1
,
dtf2
);
LocalDateTime
localDateTime2
=
LocalDateTime
.
parse
(
time2
,
dtf2
);
LocalDateTime
localDateTime3
=
LocalDateTime
.
parse
(
time3
,
dtf2
);
LocalDateTime
localDateTime4
=
LocalDateTime
.
parse
(
time4
,
dtf2
);
System
.
out
.
println
(
localDateTime
.
isAfter
(
localDateTime2
));
// 当time1小于当前时间是返回false
System
.
out
.
println
(
localDateTime3
.
isAfter
(
localDateTime4
));
}
/**
* 获取每个sku的兑换码生成数量
*
...
...
@@ -245,5 +314,4 @@ public class GoblinNftExSkuServiceImpl implements IGoblinNftExSkuService {
}
}
liquidnet-bus-service/liquidnet-service-platform/liquidnet-service-platform-impl/src/main/java/com/liquidnet/service/platform/utils/GoblinRedisUtils.java
View file @
98ec262f
...
...
@@ -9,10 +9,7 @@ import com.liquidnet.service.base.constant.MQConst;
import
com.liquidnet.service.goblin.constant.GoblinRedisConst
;
import
com.liquidnet.service.goblin.dto.GoblinQueueBizIntegralDto
;
import
com.liquidnet.service.goblin.dto.GoblinStoreMarketDto
;
import
com.liquidnet.service.goblin.dto.vo.GoblinGoodsSkuInfoVo
;
import
com.liquidnet.service.goblin.dto.vo.GoblinNftExCodeVo
;
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.entity.GoblinGoodsSku
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
...
...
@@ -233,6 +230,16 @@ public class GoblinRedisUtils {
getRedis
().
del
(
code
);
}
/**
* 获取sku时间
* @param skuId
* @return
*/
public
Object
getSkuTime
(
String
skuId
)
{
String
key
=
GoblinRedisConst
.
ACTIVITY_SKU_TIME
.
concat
(
skuId
);
return
getRedis
().
get
(
key
);
}
/* ---------------------------------------- ---------------------------------------- */
/* ---------------------------------------- ---------------------------------------- */
/* ---------------------------------------- ---------------------------------------- */
...
...
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