Showing
1 changed file
with
19 additions
and
7 deletions
@@ -3,11 +3,15 @@ package com.yoho.ufo.order.controller; | @@ -3,11 +3,15 @@ package com.yoho.ufo.order.controller; | ||
3 | import com.yoho.core.rabbitmq.YhProducer; | 3 | import com.yoho.core.rabbitmq.YhProducer; |
4 | import com.yoho.order.dal.BuyerOrderMapper; | 4 | import com.yoho.order.dal.BuyerOrderMapper; |
5 | import com.yoho.ufo.util.DateUtil; | 5 | import com.yoho.ufo.util.DateUtil; |
6 | +import org.apache.ibatis.annotations.Param; | ||
6 | import org.springframework.beans.factory.annotation.Autowired; | 7 | import org.springframework.beans.factory.annotation.Autowired; |
7 | import org.springframework.web.bind.annotation.RequestMapping; | 8 | import org.springframework.web.bind.annotation.RequestMapping; |
9 | +import org.springframework.web.bind.annotation.RequestParam; | ||
8 | import org.springframework.web.bind.annotation.RestController; | 10 | import org.springframework.web.bind.annotation.RestController; |
9 | 11 | ||
10 | import javax.annotation.Resource; | 12 | import javax.annotation.Resource; |
13 | +import java.util.Objects; | ||
14 | +import java.util.Optional; | ||
11 | 15 | ||
12 | @RestController | 16 | @RestController |
13 | @RequestMapping(value = "/help") | 17 | @RequestMapping(value = "/help") |
@@ -20,15 +24,23 @@ public class OrderHelpController { | @@ -20,15 +24,23 @@ public class OrderHelpController { | ||
20 | private YhProducer yhProducer; | 24 | private YhProducer yhProducer; |
21 | 25 | ||
22 | @RequestMapping(value = "/fixTimeoutNonConfirmOrder") | 26 | @RequestMapping(value = "/fixTimeoutNonConfirmOrder") |
23 | - public void fixTimeoutNonConfirmOrder(String updateTime) { | 27 | + public void fixTimeoutNonConfirmOrder( |
28 | + @RequestParam(value = "updateTime", required = false) String updateTime | ||
29 | + , @RequestParam(value = "orderCode", required = false) String orderCode) { | ||
24 | String topic = "buyerOrder.autoConfirm"; | 30 | String topic = "buyerOrder.autoConfirm"; |
25 | - int updateTimeSeconds = DateUtil.getTimeSecondsFromStr(updateTime, "yyyyMMddHHmmss"); | ||
26 | - int maxUpdateTimeSeconds = DateUtil.getCurrentTimeSeconds() - 7 * 24 * 3600; | ||
27 | - if (updateTimeSeconds > maxUpdateTimeSeconds) { | ||
28 | - return; | 31 | + if (Objects.nonNull(orderCode)) { |
32 | + Optional.ofNullable(buyerOrderMapper.selectByOrderCode(orderCode)) | ||
33 | + .ifPresent(order -> yhProducer.send(topic, order)); | ||
34 | + } else if (Objects.nonNull(updateTime)) { | ||
35 | + int updateTimeSeconds = DateUtil.getTimeSecondsFromStr(updateTime, "yyyyMMddHHmmss"); | ||
36 | + int maxUpdateTimeSeconds = DateUtil.getCurrentTimeSeconds() - 7 * 24 * 3600; | ||
37 | + if (updateTimeSeconds > maxUpdateTimeSeconds) { | ||
38 | + return; | ||
39 | + } | ||
40 | + buyerOrderMapper.selectByStatusAndUpdateTimeLess(4, updateTimeSeconds) | ||
41 | + .forEach(order -> yhProducer.send(topic, order)); | ||
29 | } | 42 | } |
30 | - buyerOrderMapper.selectByStatusAndUpdateTimeLess(4, updateTimeSeconds) | ||
31 | - .forEach(order -> yhProducer.send(topic, order)); | 43 | + |
32 | } | 44 | } |
33 | 45 | ||
34 | } | 46 | } |
-
Please register or login to post a comment