Authored by LUOXC

refactor

... ... @@ -9,13 +9,9 @@ import com.yohoufo.common.annotation.InnerApi;
import com.yohoufo.common.lock.RedisLock;
import com.yohoufo.common.lock.RedisLockFactory;
import com.yohoufo.common.utils.ExecutorServiceUtils;
import com.yohoufo.dal.order.model.SellerWalletDetail;
import com.yohoufo.order.model.PayRefundBo;
import com.yohoufo.order.model.request.OrderRequest;
import com.yohoufo.order.model.request.TransferMoneyRequest;
import com.yohoufo.order.service.IBuyerOrderService;
import com.yohoufo.order.service.IPaymentService;
import com.yohoufo.order.service.concurrent.ThreadPoolFactory;
import com.yohoufo.order.service.impl.BuyerOrderCancelService;
import com.yohoufo.order.service.impl.PaymentServiceImpl;
import com.yohoufo.order.service.impl.TransferService;
... ... @@ -31,8 +27,11 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.math.BigDecimal;
import java.util.UUID;
import java.util.concurrent.*;
import java.util.List;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.stream.IntStream;
@Slf4j
... ... @@ -151,22 +150,34 @@ public class OrderHelpController {
@IgnoreSession
@IgnoreSignature
@InnerApi
@RequestMapping(value="/buyerCancel")
public ApiResponse buyerCancel(@RequestParam long orderCode, @RequestParam int uid) {
OrderRequest orderRequest = OrderRequest.builder()
.uid(uid)
.orderCode(orderCode)
.build();
buyerOrderService.cancel(orderRequest);
@RequestMapping(value = "/buyerCancel")
public ApiResponse buyerCancel(@RequestBody List<OrderRequest> orders) {
orders.stream().forEach(order -> {
buyerOrderService.cancel(order);
try {
Thread.sleep(50);
} catch (InterruptedException e) {
e.printStackTrace();
}
});
return new ApiResponse.ApiResponseBuilder().code(200).message("处理成功").build();
}
@IgnoreSession
@IgnoreSignature
@InnerApi
@RequestMapping(value="/helperRefund")
public ApiResponse helperRefund(@RequestParam long orderCode, @RequestParam int uid) {
buyerOrderCancelService.helperRefund(uid,orderCode);
@RequestMapping(value = "/helperRefund")
public ApiResponse helperRefund(@RequestBody List<OrderRequest> orders) {
orders.stream().forEach(order -> {
buyerOrderCancelService.helperRefund(order.getUid(), order.getOrderCode());
try {
Thread.sleep(50);
} catch (InterruptedException e) {
e.printStackTrace();
}
});
return new ApiResponse.ApiResponseBuilder().code(200).message("处理成功").build();
}
... ...