Showing
3 changed files
with
45 additions
and
0 deletions
@@ -45,4 +45,8 @@ public interface BuyerOrderMapper { | @@ -45,4 +45,8 @@ public interface BuyerOrderMapper { | ||
45 | int selectCountByStatusForFastDelivery(@Param("currentSecondMinus36Hours")Integer currentSecondMinus24Hours); | 45 | int selectCountByStatusForFastDelivery(@Param("currentSecondMinus36Hours")Integer currentSecondMinus24Hours); |
46 | 46 | ||
47 | List<BuyerOrder> selectMinFalultList(@Param("buyerOrderReq") BuyerOrderReq req); | 47 | List<BuyerOrder> selectMinFalultList(@Param("buyerOrderReq") BuyerOrderReq req); |
48 | + | ||
49 | + | ||
50 | + List<BuyerOrder> selectByStatusAndUpdateTimeLess(@Param("status")int status, @Param("updateTime")int updateTime); | ||
51 | + | ||
48 | } | 52 | } |
@@ -366,4 +366,11 @@ | @@ -366,4 +366,11 @@ | ||
366 | limit #{buyerOrderReq.start},#{buyerOrderReq.size} | 366 | limit #{buyerOrderReq.start},#{buyerOrderReq.size} |
367 | </if> | 367 | </if> |
368 | </select> | 368 | </select> |
369 | + | ||
370 | + | ||
371 | + <select id="selectByStatusAndUpdateTimeLess" resultMap="BaseResultMap"> | ||
372 | + select <include refid="Base_Column_List"></include> | ||
373 | + from buyer_order | ||
374 | + where status = #{status} and update_time < #{updateTime} | ||
375 | + </select> | ||
369 | </mapper> | 376 | </mapper> |
1 | +package com.yoho.ufo.order.controller; | ||
2 | + | ||
3 | +import com.yoho.core.rabbitmq.YhProducer; | ||
4 | +import com.yoho.order.dal.BuyerOrderMapper; | ||
5 | +import com.yoho.ufo.util.DateUtil; | ||
6 | +import org.springframework.beans.factory.annotation.Autowired; | ||
7 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
8 | +import org.springframework.web.bind.annotation.RestController; | ||
9 | + | ||
10 | +import javax.annotation.Resource; | ||
11 | + | ||
12 | +@RestController | ||
13 | +@RequestMapping(value = "/help") | ||
14 | +public class OrderHelpController { | ||
15 | + | ||
16 | + @Autowired | ||
17 | + private BuyerOrderMapper buyerOrderMapper; | ||
18 | + | ||
19 | + @Resource(name = "yhProducer") | ||
20 | + private YhProducer yhProducer; | ||
21 | + | ||
22 | + @RequestMapping(value = "/fixTimeoutNonConfirmOrder") | ||
23 | + public void fixTimeoutNonConfirmOrder(String updateTime) { | ||
24 | + 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; | ||
29 | + } | ||
30 | + buyerOrderMapper.selectByStatusAndUpdateTimeLess(4, updateTimeSeconds) | ||
31 | + .forEach(order -> yhProducer.send(topic, order)); | ||
32 | + } | ||
33 | + | ||
34 | +} |
-
Please register or login to post a comment