...
|
...
|
@@ -31,6 +31,8 @@ import com.yohoufo.order.service.IPaymentService; |
|
|
import com.yohoufo.order.service.cache.CacheCleaner;
|
|
|
import com.yohoufo.order.service.cache.CacheKeyBuilder;
|
|
|
import com.yohoufo.order.service.proxy.InBoxFacade;
|
|
|
import com.yohoufo.order.service.proxy.InBoxThreadFactory;
|
|
|
import com.yohoufo.order.utils.PubThreadFactory;
|
|
|
import com.yohoufo.order.utils.SmsHelper;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
...
|
...
|
@@ -40,6 +42,10 @@ import org.springframework.stereotype.Service; |
|
|
import java.math.BigDecimal;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
import java.util.concurrent.ArrayBlockingQueue;
|
|
|
import java.util.concurrent.ExecutorService;
|
|
|
import java.util.concurrent.ThreadPoolExecutor;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
/**
|
|
|
* Created by chenchao on 2018/9/27.
|
...
|
...
|
@@ -49,6 +55,8 @@ public class AppraiseService { |
|
|
|
|
|
private static final Logger LOGGER = LoggerFactory.getLogger(AppraiseService.class);
|
|
|
|
|
|
private ExecutorService executorService = new ThreadPoolExecutor(5, 10, 60, TimeUnit.SECONDS, new ArrayBlockingQueue<>(10), new PubThreadFactory("appraise-processor"));
|
|
|
|
|
|
@Autowired
|
|
|
private IExpressInfoService expressInfoService;
|
|
|
|
...
|
...
|
@@ -132,11 +140,18 @@ public class AppraiseService { |
|
|
//先校验,提前把错误抛出
|
|
|
paymentService.transferMonCheck(tmReq);
|
|
|
//再分账
|
|
|
/**
|
|
|
boolean transferSuccessFlag=transferService.transfer(tmReq);
|
|
|
if(!transferSuccessFlag){
|
|
|
apiResponse.setCode(400);
|
|
|
apiResponse.setMessage("保证金分账失败");
|
|
|
}
|
|
|
*/
|
|
|
//改成异步的分账,不关心分账执行结果
|
|
|
executorService.execute(()->{
|
|
|
LOGGER.info("in appraiseSuccess,begin transfer async");
|
|
|
transferService.transfer(tmReq);
|
|
|
});
|
|
|
|
|
|
/**
|
|
|
* 退保证金给卖家
|
...
|
...
|
@@ -267,11 +282,18 @@ public class AppraiseService { |
|
|
//先校验,提前把错误抛出
|
|
|
paymentService.transferMonCheck(tmReq);
|
|
|
//再分账
|
|
|
/*
|
|
|
boolean transferSuccessFlag=transferService.transfer(tmReq);
|
|
|
if(!transferSuccessFlag){
|
|
|
apiResponse.setCode(400);
|
|
|
apiResponse.setMessage("保证金分账失败");
|
|
|
}
|
|
|
*/
|
|
|
//改成异步的分账,不关心分账执行结果
|
|
|
executorService.execute(()->{
|
|
|
LOGGER.info("in appraiseFail,begin transfer async");
|
|
|
transferService.transfer(tmReq);
|
|
|
});
|
|
|
|
|
|
BigDecimal goodsMoney = buyerOrder.getAmount();
|
|
|
PaymentRequest req = PaymentRequest.builder().uid(buyerUid)
|
...
|
...
|
|