Showing
1 changed file
with
13 additions
and
1 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,8 +24,14 @@ public class OrderHelpController { | @@ -20,8 +24,14 @@ 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"; |
31 | + if (Objects.nonNull(orderCode)) { | ||
32 | + Optional.ofNullable(buyerOrderMapper.selectByOrderCode(orderCode)) | ||
33 | + .ifPresent(order -> yhProducer.send(topic, order)); | ||
34 | + } else if (Objects.nonNull(updateTime)) { | ||
25 | int updateTimeSeconds = DateUtil.getTimeSecondsFromStr(updateTime, "yyyyMMddHHmmss"); | 35 | int updateTimeSeconds = DateUtil.getTimeSecondsFromStr(updateTime, "yyyyMMddHHmmss"); |
26 | int maxUpdateTimeSeconds = DateUtil.getCurrentTimeSeconds() - 7 * 24 * 3600; | 36 | int maxUpdateTimeSeconds = DateUtil.getCurrentTimeSeconds() - 7 * 24 * 3600; |
27 | if (updateTimeSeconds > maxUpdateTimeSeconds) { | 37 | if (updateTimeSeconds > maxUpdateTimeSeconds) { |
@@ -31,4 +41,6 @@ public class OrderHelpController { | @@ -31,4 +41,6 @@ public class OrderHelpController { | ||
31 | .forEach(order -> yhProducer.send(topic, order)); | 41 | .forEach(order -> yhProducer.send(topic, order)); |
32 | } | 42 | } |
33 | 43 | ||
44 | + } | ||
45 | + | ||
34 | } | 46 | } |
-
Please register or login to post a comment