Commit b5e0298a33635eb3eb77c2cb226eb43c6156ebc4
1 parent
91401ea6
feat:定时任务项目
Showing
3 changed files
with
8 additions
and
8 deletions
job/src/main/java/com/canrd/shop/job/OrderOverTimeJob.java
@@ -36,6 +36,7 @@ public class OrderOverTimeJob { | @@ -36,6 +36,7 @@ public class OrderOverTimeJob { | ||
36 | public void payOverTimeExecute() { | 36 | public void payOverTimeExecute() { |
37 | log.info("执行开始时间:{}", DateTime.now().toString("yyyy-MM-dd HH:mm:ss")); | 37 | log.info("执行开始时间:{}", DateTime.now().toString("yyyy-MM-dd HH:mm:ss")); |
38 | LambdaQueryWrapper<OrdersDO> queryWrapper = new LambdaQueryWrapper<OrdersDO>() | 38 | LambdaQueryWrapper<OrdersDO> queryWrapper = new LambdaQueryWrapper<OrdersDO>() |
39 | + .in(OrdersDO::getOrderstatus, Arrays.asList(0, 1, 2)) | ||
39 | .in(OrdersDO::getPaymentstatus, Arrays.asList(0, 1)); | 40 | .in(OrdersDO::getPaymentstatus, Arrays.asList(0, 1)); |
40 | List<OrdersDO> ordersDOS = ordersService.list(queryWrapper); | 41 | List<OrdersDO> ordersDOS = ordersService.list(queryWrapper); |
41 | 42 | ||
@@ -44,15 +45,14 @@ public class OrderOverTimeJob { | @@ -44,15 +45,14 @@ public class OrderOverTimeJob { | ||
44 | ordersDOS.forEach(ordersDO -> { | 45 | ordersDOS.forEach(ordersDO -> { |
45 | DateTime createTime = new DateTime(ordersDO.getCreatedate()); | 46 | DateTime createTime = new DateTime(ordersDO.getCreatedate()); |
46 | if (DateTime.now().isAfter(createTime.plusDays(Constant.ONE))) { | 47 | if (DateTime.now().isAfter(createTime.plusDays(Constant.ONE))) { |
47 | - ordersDO.setOrderstatus(-1); | ||
48 | - ordersDO.setPaymentstatus(-1); | 48 | + ordersDO.setOrderstatus(3); |
49 | ordersDO.setModifydate(DateTime.now().toDate()); | 49 | ordersDO.setModifydate(DateTime.now().toDate()); |
50 | updateOrdersList.add(ordersDO); | 50 | updateOrdersList.add(ordersDO); |
51 | } | 51 | } |
52 | 52 | ||
53 | }); | 53 | }); |
54 | if (!CollectionUtils.isEmpty(updateOrdersList)) { | 54 | if (!CollectionUtils.isEmpty(updateOrdersList)) { |
55 | - ordersService.updateBatchById(ordersDOS); | 55 | + ordersService.updateBatchById(updateOrdersList); |
56 | } | 56 | } |
57 | 57 | ||
58 | } | 58 | } |
job/src/main/resources/application-local.yml
@@ -59,7 +59,7 @@ spring: | @@ -59,7 +59,7 @@ spring: | ||
59 | testOnReturn: true | 59 | testOnReturn: true |
60 | password: 123456 | 60 | password: 123456 |
61 | time-between-eviction-runs-millis: 1000 | 61 | time-between-eviction-runs-millis: 1000 |
62 | - url: jdbc:mysql://39.108.227.113:3306/jfinalshop?useUnicode=true&characterEncoding=UTF-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai&useSSL=false&autoReconnect=true&failOverReadOnly=false&maxReconnects=10&allowMultiQueries=true&useAffectedRows=true&autoReconnectForPools=true | 62 | + url: jdbc:mysql://39.108.227.113:3307/jfinalshop?useUnicode=true&characterEncoding=UTF-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai&useSSL=false&autoReconnect=true&failOverReadOnly=false&maxReconnects=10&allowMultiQueries=true&useAffectedRows=true&autoReconnectForPools=true |
63 | username: root | 63 | username: root |
64 | 64 | ||
65 | 65 |
job/src/main/resources/application.yml
@@ -2,9 +2,9 @@ server: | @@ -2,9 +2,9 @@ server: | ||
2 | port: 9000 | 2 | port: 9000 |
3 | 3 | ||
4 | spring: | 4 | spring: |
5 | - # 不占用端口启动 | ||
6 | - main: | ||
7 | - allow-bean-definition-overriding: true | ||
8 | - web-application-type: none | 5 | +# # 不占用端口启动 |
6 | +# main: | ||
7 | +# allow-bean-definition-overriding: true | ||
8 | +# web-application-type: none | ||
9 | profiles: | 9 | profiles: |
10 | active: local | 10 | active: local |
11 | \ No newline at end of file | 11 | \ No newline at end of file |