Authored by LUOXC

add

... ... @@ -3,11 +3,15 @@ package com.yoho.ufo.order.controller;
import com.yoho.core.rabbitmq.YhProducer;
import com.yoho.order.dal.BuyerOrderMapper;
import com.yoho.ufo.util.DateUtil;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.Objects;
import java.util.Optional;
@RestController
@RequestMapping(value = "/help")
... ... @@ -20,15 +24,23 @@ public class OrderHelpController {
private YhProducer yhProducer;
@RequestMapping(value = "/fixTimeoutNonConfirmOrder")
public void fixTimeoutNonConfirmOrder(String updateTime) {
public void fixTimeoutNonConfirmOrder(
@RequestParam(value = "updateTime", required = false) String updateTime
, @RequestParam(value = "orderCode", required = false) String orderCode) {
String topic = "buyerOrder.autoConfirm";
int updateTimeSeconds = DateUtil.getTimeSecondsFromStr(updateTime, "yyyyMMddHHmmss");
int maxUpdateTimeSeconds = DateUtil.getCurrentTimeSeconds() - 7 * 24 * 3600;
if (updateTimeSeconds > maxUpdateTimeSeconds) {
return;
if (Objects.nonNull(orderCode)) {
Optional.ofNullable(buyerOrderMapper.selectByOrderCode(orderCode))
.ifPresent(order -> yhProducer.send(topic, order));
} else if (Objects.nonNull(updateTime)) {
int updateTimeSeconds = DateUtil.getTimeSecondsFromStr(updateTime, "yyyyMMddHHmmss");
int maxUpdateTimeSeconds = DateUtil.getCurrentTimeSeconds() - 7 * 24 * 3600;
if (updateTimeSeconds > maxUpdateTimeSeconds) {
return;
}
buyerOrderMapper.selectByStatusAndUpdateTimeLess(4, updateTimeSeconds)
.forEach(order -> yhProducer.send(topic, order));
}
buyerOrderMapper.selectByStatusAndUpdateTimeLess(4, updateTimeSeconds)
.forEach(order -> yhProducer.send(topic, order));
}
}
... ...