Authored by LUOXC

refactor

@@ -9,13 +9,9 @@ import com.yohoufo.common.annotation.InnerApi; @@ -9,13 +9,9 @@ import com.yohoufo.common.annotation.InnerApi;
9 import com.yohoufo.common.lock.RedisLock; 9 import com.yohoufo.common.lock.RedisLock;
10 import com.yohoufo.common.lock.RedisLockFactory; 10 import com.yohoufo.common.lock.RedisLockFactory;
11 import com.yohoufo.common.utils.ExecutorServiceUtils; 11 import com.yohoufo.common.utils.ExecutorServiceUtils;
12 -import com.yohoufo.dal.order.model.SellerWalletDetail;  
13 -import com.yohoufo.order.model.PayRefundBo;  
14 import com.yohoufo.order.model.request.OrderRequest; 12 import com.yohoufo.order.model.request.OrderRequest;
15 import com.yohoufo.order.model.request.TransferMoneyRequest; 13 import com.yohoufo.order.model.request.TransferMoneyRequest;
16 import com.yohoufo.order.service.IBuyerOrderService; 14 import com.yohoufo.order.service.IBuyerOrderService;
17 -import com.yohoufo.order.service.IPaymentService;  
18 -import com.yohoufo.order.service.concurrent.ThreadPoolFactory;  
19 import com.yohoufo.order.service.impl.BuyerOrderCancelService; 15 import com.yohoufo.order.service.impl.BuyerOrderCancelService;
20 import com.yohoufo.order.service.impl.PaymentServiceImpl; 16 import com.yohoufo.order.service.impl.PaymentServiceImpl;
21 import com.yohoufo.order.service.impl.TransferService; 17 import com.yohoufo.order.service.impl.TransferService;
@@ -31,8 +27,11 @@ import org.springframework.web.bind.annotation.RequestParam; @@ -31,8 +27,11 @@ import org.springframework.web.bind.annotation.RequestParam;
31 import org.springframework.web.bind.annotation.RestController; 27 import org.springframework.web.bind.annotation.RestController;
32 28
33 import java.math.BigDecimal; 29 import java.math.BigDecimal;
34 -import java.util.UUID;  
35 -import java.util.concurrent.*; 30 +import java.util.List;
  31 +import java.util.concurrent.ArrayBlockingQueue;
  32 +import java.util.concurrent.ExecutorService;
  33 +import java.util.concurrent.ThreadPoolExecutor;
  34 +import java.util.concurrent.TimeUnit;
36 import java.util.stream.IntStream; 35 import java.util.stream.IntStream;
37 36
38 @Slf4j 37 @Slf4j
@@ -151,22 +150,34 @@ public class OrderHelpController { @@ -151,22 +150,34 @@ public class OrderHelpController {
151 @IgnoreSession 150 @IgnoreSession
152 @IgnoreSignature 151 @IgnoreSignature
153 @InnerApi 152 @InnerApi
154 - @RequestMapping(value="/buyerCancel")  
155 - public ApiResponse buyerCancel(@RequestParam long orderCode, @RequestParam int uid) {  
156 - OrderRequest orderRequest = OrderRequest.builder()  
157 - .uid(uid)  
158 - .orderCode(orderCode)  
159 - .build();  
160 - buyerOrderService.cancel(orderRequest); 153 + @RequestMapping(value = "/buyerCancel")
  154 + public ApiResponse buyerCancel(@RequestBody List<OrderRequest> orders) {
  155 + orders.stream().forEach(order -> {
  156 + buyerOrderService.cancel(order);
  157 + try {
  158 + Thread.sleep(50);
  159 + } catch (InterruptedException e) {
  160 + e.printStackTrace();
  161 + }
  162 + });
161 return new ApiResponse.ApiResponseBuilder().code(200).message("处理成功").build(); 163 return new ApiResponse.ApiResponseBuilder().code(200).message("处理成功").build();
162 } 164 }
163 165
  166 +
  167 +
164 @IgnoreSession 168 @IgnoreSession
165 @IgnoreSignature 169 @IgnoreSignature
166 @InnerApi 170 @InnerApi
167 - @RequestMapping(value="/helperRefund")  
168 - public ApiResponse helperRefund(@RequestParam long orderCode, @RequestParam int uid) {  
169 - buyerOrderCancelService.helperRefund(uid,orderCode); 171 + @RequestMapping(value = "/helperRefund")
  172 + public ApiResponse helperRefund(@RequestBody List<OrderRequest> orders) {
  173 + orders.stream().forEach(order -> {
  174 + buyerOrderCancelService.helperRefund(order.getUid(), order.getOrderCode());
  175 + try {
  176 + Thread.sleep(50);
  177 + } catch (InterruptedException e) {
  178 + e.printStackTrace();
  179 + }
  180 + });
170 return new ApiResponse.ApiResponseBuilder().code(200).message("处理成功").build(); 181 return new ApiResponse.ApiResponseBuilder().code(200).message("处理成功").build();
171 } 182 }
172 183