Authored by mali

Merge branch 'master' into hotfix_erp_add_mobile_1218

@@ -129,6 +129,9 @@ public class PaymentServiceImpl implements IPaymentService { @@ -129,6 +129,9 @@ public class PaymentServiceImpl implements IPaymentService {
129 TradeBillsMapper tradeBillsMapper; 129 TradeBillsMapper tradeBillsMapper;
130 130
131 @Autowired 131 @Autowired
  132 + EntrySellerRechargeOrderMapper entrySellerRechargeOrderMapper;
  133 +
  134 + @Autowired
132 private BuyerCancelCompensateComputeHandler buyerCancelCompensateComputeHandler; 135 private BuyerCancelCompensateComputeHandler buyerCancelCompensateComputeHandler;
133 136
134 137
@@ -884,10 +887,27 @@ public class PaymentServiceImpl implements IPaymentService { @@ -884,10 +887,27 @@ public class PaymentServiceImpl implements IPaymentService {
884 throw new ServiceException(400, "manualDeal:流水已经处理过id=" + tradeBills.getId()); 887 throw new ServiceException(400, "manualDeal:流水已经处理过id=" + tradeBills.getId());
885 } 888 }
886 889
  890 + boolean isMerchantExit = false;
  891 + // 是否为退出入驻订单
  892 + CodeMeta codeMeta = orderCodeGenerator.expId(orderCode);
  893 + if(codeMeta.getType() == OrderCodeType.SELLER_RECHARGE_EARNEST_TYPE.getType()) {
  894 + EntrySellerRechargeOrder order = entrySellerRechargeOrderMapper.selectByOrderCode(orderCode);
  895 + if(order != null && order.getStatus() != null && order.getType() != null && order.getType() == 3) {
  896 + if (order.getStatus() == 0) {
  897 + isMerchantExit = true;
  898 + } else {
  899 + throw new ServiceException(400, "manualDeal:退款已成功,id=" + tradeBills.getId());
  900 + }
  901 + } else {
  902 + throw new ServiceException(400, "manualDeal:商家退出入驻订单异常,id=" + tradeBills.getId());
  903 + }
  904 + }
  905 +
887 // '1:买家uid; 2:卖家uid','1:保证金;2:货款;3:补偿款', '1:用户收入; 2:用户支出' 906 // '1:买家uid; 2:卖家uid','1:保证金;2:货款;3:补偿款', '1:用户收入; 2:用户支出'
888 try { 907 try {
889 - if (/* 退货款 */ (tradeBills.getUserType() == 1 && tradeBills.getTradeType() == 2 && tradeBills.getIncomeOutcome() == 1)  
890 - /* 退保证金 */ || (tradeBills.getUserType() == 2 && tradeBills.getTradeType() == 1 && tradeBills.getIncomeOutcome() == 1)) { 908 + if (/* 退货款 */((tradeBills.getUserType() == 1 && tradeBills.getTradeType() == 2 && tradeBills.getIncomeOutcome() == 1)
  909 + /* 退保证金(普通用户) */
  910 + || (tradeBills.getUserType() == 2 && tradeBills.getTradeType() == 1 && tradeBills.getIncomeOutcome() == 1 && !isMerchantExit))) {
891 logger.warn("manualDeal人工退款 , tradeBills is {}", tradeBills); 911 logger.warn("manualDeal人工退款 , tradeBills is {}", tradeBills);
892 PayRefundBo refundBo = manualRefund(orderCode, amount); 912 PayRefundBo refundBo = manualRefund(orderCode, amount);
893 if (refundBo.getRefundStatus() == RefundContant.PAYMENT_REFUND_RESULTCODE_SUCCESS) { 913 if (refundBo.getRefundStatus() == RefundContant.PAYMENT_REFUND_RESULTCODE_SUCCESS) {