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 | 36 | public void payOverTimeExecute() { |
37 | 37 | log.info("执行开始时间:{}", DateTime.now().toString("yyyy-MM-dd HH:mm:ss")); |
38 | 38 | LambdaQueryWrapper<OrdersDO> queryWrapper = new LambdaQueryWrapper<OrdersDO>() |
39 | + .in(OrdersDO::getOrderstatus, Arrays.asList(0, 1, 2)) | |
39 | 40 | .in(OrdersDO::getPaymentstatus, Arrays.asList(0, 1)); |
40 | 41 | List<OrdersDO> ordersDOS = ordersService.list(queryWrapper); |
41 | 42 | |
... | ... | @@ -44,15 +45,14 @@ public class OrderOverTimeJob { |
44 | 45 | ordersDOS.forEach(ordersDO -> { |
45 | 46 | DateTime createTime = new DateTime(ordersDO.getCreatedate()); |
46 | 47 | if (DateTime.now().isAfter(createTime.plusDays(Constant.ONE))) { |
47 | - ordersDO.setOrderstatus(-1); | |
48 | - ordersDO.setPaymentstatus(-1); | |
48 | + ordersDO.setOrderstatus(3); | |
49 | 49 | ordersDO.setModifydate(DateTime.now().toDate()); |
50 | 50 | updateOrdersList.add(ordersDO); |
51 | 51 | } |
52 | 52 | |
53 | 53 | }); |
54 | 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 | 59 | testOnReturn: true |
60 | 60 | password: 123456 |
61 | 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 | 63 | username: root |
64 | 64 | |
65 | 65 | ... | ... |
job/src/main/resources/application.yml
... | ... | @@ -2,9 +2,9 @@ server: |
2 | 2 | port: 9000 |
3 | 3 | |
4 | 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 | 9 | profiles: |
10 | 10 | active: local |
11 | 11 | \ No newline at end of file | ... | ... |