Authored by chenchao

complete note

... ... @@ -109,7 +109,9 @@ public class AppraiseService {
private static final Logger LOGGER = LoggerFactory.getLogger(AppraiseService.class);
private ExecutorService executorService = new ThreadPoolExecutor(5, 10, 60, TimeUnit.SECONDS, new ArrayBlockingQueue<>(1000), new PubThreadFactory("appraise-processor"));
private ExecutorService executorService = new ThreadPoolExecutor(5, 10, 60, TimeUnit.SECONDS,
new ArrayBlockingQueue<>(1000),
new PubThreadFactory("appraise-processor"));
@Autowired
private IExpressInfoService expressInfoService;
... ... @@ -771,7 +773,17 @@ public class AppraiseService {
return apiResponse;
}
//更新卖家订单的状态,并清缓存
/**
* 更新卖家订单的状态,并清缓存
* @param sellerUid
* @param sellerOrderCode
* @param expectSOStatus
* @param targetSoStatus
* @param skup
* @param orderCode
* @param buyerUid
* @return
*/
private SellerOrderGoods updateSellerOrderStatusAndCleanCache(int sellerUid,
long sellerOrderCode,
SellerOrderStatus expectSOStatus,
... ... @@ -1247,16 +1259,12 @@ public class AppraiseService {
*/
SellerOrderGoods sellerOrderGoods = updateSellerOrderStatusAndCleanCache(sellerUid, sellerOrderCode, expectSOStatus, targetSoStatus,
skup, orderCode, buyerUid);
//退款给卖家(仅退一次)
PaymentRequest refundReqOfSeller = operateMoneyWhenOk(buyerUid, orderCode, skup, sellerOrder, targetSoStatus);
try {
//记录订单的状态变更信息
LOGGER.info("in judgeCenterPass record status change, orderCode {},uid {} ,sellerUid {}", orderCode, buyerUid, sellerUid);
orderStatusFlowService.addAsy(buyerOrder.getOrderCode(), targetOrderStatus.getCode());
//TODO 鉴定通过,
Product product = Optional.ofNullable(sellerOrderGoods).map(SellerOrderGoods::getProductId).map(productMapper::selectByPrimaryKey).orElse(null);
inBoxFacade.appraisePassNoticeSeller(buyerUid, orderCode, sellerOrderGoods, product);
... ... @@ -1287,6 +1295,12 @@ public class AppraiseService {
return apiResponse;
}
/**
* 鉴定通过转货款
* @param sellerUid
* @param skup
* @param orderCode
*/
private void transferGoodsMoneyWhenPass(Integer sellerUid, Integer skup, Long orderCode){
BigDecimal saleIncome = getSaleIncome(sellerUid, skup);
... ... @@ -1318,15 +1332,7 @@ public class AppraiseService {
*/
private PaymentRequest operateMoneyWhenOk(Integer buyerUid, Long orderCode, int skup, SellerOrder sellerOrder, SellerOrderStatus targetSoStatus) {
final Integer sellerUid = sellerOrder.getUid();
BigDecimal saleIncome = getSaleIncome(sellerUid, skup);
TranseferCellNode transeferCellNode = new TranseferCellNode();
transeferCellNode.setUid(sellerUid);
transeferCellNode.setAmount(saleIncome);
transferGoodsMoneyWhenPass(sellerUid, skup, orderCode);
//退保证金给卖家
//refund earnestMoney
BigDecimal earnestMoney = sellerOrder.getEarnestMoney();
... ... @@ -1335,6 +1341,15 @@ public class AppraiseService {
return refundReqOfSeller;
}
/**
* 鉴定通过,鉴定中心发货给买家
* @param expressCompanyId
* @param orderCode
* @param wayBillCode
* @param depotNum
* @param mobile
* @return
*/
public ApiResponse appraiseSuccessAndDelivery(Integer expressCompanyId, Long orderCode, String wayBillCode, Integer depotNum, String mobile) {
ApiResponse apiResponse = new ApiResponse();
BuyerOrder buyerOrder = buyerOrderMapper.selectOnlyByOrderCode(orderCode);
... ...