Authored by LUOXC

fixdata

... ... @@ -45,4 +45,8 @@ public interface BuyerOrderMapper {
int selectCountByStatusForFastDelivery(@Param("currentSecondMinus36Hours")Integer currentSecondMinus24Hours);
List<BuyerOrder> selectMinFalultList(@Param("buyerOrderReq") BuyerOrderReq req);
List<BuyerOrder> selectByStatusAndUpdateTimeLess(@Param("status")int status, @Param("updateTime")int updateTime);
}
... ...
... ... @@ -366,4 +366,11 @@
limit #{buyerOrderReq.start},#{buyerOrderReq.size}
</if>
</select>
<select id="selectByStatusAndUpdateTimeLess" resultMap="BaseResultMap">
select <include refid="Base_Column_List"></include>
from buyer_order
where status = #{status} and update_time < #{updateTime}
</select>
</mapper>
\ No newline at end of file
... ...
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.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
@RestController
@RequestMapping(value = "/help")
public class OrderHelpController {
@Autowired
private BuyerOrderMapper buyerOrderMapper;
@Resource(name = "yhProducer")
private YhProducer yhProducer;
@RequestMapping(value = "/fixTimeoutNonConfirmOrder")
public void fixTimeoutNonConfirmOrder(String updateTime) {
String topic = "buyerOrder.autoConfirm";
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));
}
}
... ...