Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mall-server
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
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
yimu
mall-server
Commits
744cc9fb
Commit
744cc9fb
authored
Mar 18, 2022
by
wangpeng
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' into 'test'
预热定时任务 See merge request
!36
parents
d0a27a16
8c28cfd2
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
53 additions
and
1 deletion
+53
-1
SpuStatusEnum.java
...server/admin/goods_center/enums/status/SpuStatusEnum.java
+2
-1
ISpuService.java
...m/mall/server/admin/goods_center/service/ISpuService.java
+2
-0
SpuServiceImpl.java
...erver/admin/goods_center/service/impl/SpuServiceImpl.java
+8
-0
GoodsTask.java
.../java/com/fzm/mall/server/admin/task/goods/GoodsTask.java
+41
-0
No files found.
mall-server-admin/src/main/java/com/fzm/mall/server/admin/goods_center/enums/status/SpuStatusEnum.java
View file @
744cc9fb
...
@@ -22,7 +22,8 @@ public enum SpuStatusEnum {
...
@@ -22,7 +22,8 @@ public enum SpuStatusEnum {
CHECK_FAIL
(
6
),
//审核未通过
CHECK_FAIL
(
6
),
//审核未通过
CHECK_PASS
(
7
),
//审核通过
CHECK_PASS
(
7
),
//审核通过
CANCEL
(
8
),
//取消发布
CANCEL
(
8
),
//取消发布
DRAFT
(
9
);
//草稿
DRAFT
(
9
),
//草稿
PREHEAT
(
10
);
//预热
private
Integer
status
;
private
Integer
status
;
...
...
mall-server-admin/src/main/java/com/fzm/mall/server/admin/goods_center/service/ISpuService.java
View file @
744cc9fb
...
@@ -161,4 +161,6 @@ public interface ISpuService extends IService<Spu> {
...
@@ -161,4 +161,6 @@ public interface ISpuService extends IService<Spu> {
*/
*/
List
<
GoodsListVO
>
getSpuByVague
(
String
goodsInfo
,
String
merchantId
);
List
<
GoodsListVO
>
getSpuByVague
(
String
goodsInfo
,
String
merchantId
);
List
<
Spu
>
listForPreheat
();
}
}
mall-server-admin/src/main/java/com/fzm/mall/server/admin/goods_center/service/impl/SpuServiceImpl.java
View file @
744cc9fb
...
@@ -545,4 +545,12 @@ public class SpuServiceImpl extends ServiceImpl<SpuMapper, Spu> implements ISpuS
...
@@ -545,4 +545,12 @@ public class SpuServiceImpl extends ServiceImpl<SpuMapper, Spu> implements ISpuS
externalTokenService
.
updateById
(
externalToken
);
externalTokenService
.
updateById
(
externalToken
);
}
}
}
}
@Override
public
List
<
Spu
>
listForPreheat
()
{
LambdaQueryWrapper
<
Spu
>
qw
=
new
LambdaQueryWrapper
<>();
qw
.
eq
(
Spu:
:
getStatus
,
SpuStatusEnum
.
PREHEAT
.
getStatus
());
return
list
(
qw
);
}
}
}
mall-server-admin/src/main/java/com/fzm/mall/server/admin/task/goods/GoodsTask.java
0 → 100644
View file @
744cc9fb
package
com
.
fzm
.
mall
.
server
.
admin
.
task
.
goods
;
import
com.fzm.mall.server.admin.goods_center.enums.status.SpuStatusEnum
;
import
com.fzm.mall.server.admin.goods_center.model.Spu
;
import
com.fzm.mall.server.admin.goods_center.service.ISpuService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Component
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.List
;
/**
* @author wangp
* @date 2021/6/18 10:43
* @description 订单定时任务
* @since JDK 1.8
*/
@Component
@Slf4j
@Transactional
public
class
GoodsTask
{
@Autowired
private
ISpuService
spuService
;
//预热商品上架
@Scheduled
(
cron
=
"10 * * * * ?"
)
public
void
yrsj
()
{
List
<
Spu
>
spuList
=
spuService
.
listForPreheat
();
spuList
.
forEach
(
v
->
{
if
(
v
.
getPreheatEndTime
()
<
System
.
currentTimeMillis
())
{
//修改状态为上架
spuService
.
updateStatus
(
v
.
getGoodsId
(),
SpuStatusEnum
.
ON
.
getStatus
(),
""
);
}
});
}
}
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