111
This commit is contained in:
parent
b80b64f9c7
commit
f2c2c4a296
|
@ -408,7 +408,6 @@ public class CallbackServiceImpl implements ICallbackService {
|
|||
* 微信退款回调
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void weChatRefund(HttpServletRequest request) {
|
||||
String body = HttpUtils.getBody(request);
|
||||
CallbackLog etCallbackLog = new CallbackLog();
|
||||
|
@ -457,7 +456,7 @@ public class CallbackServiceImpl implements ICallbackService {
|
|||
Order order = new Order();
|
||||
order.setOrderNo(payBillVO.getOrderNo());
|
||||
order.setStatus(ServiceConstants.ORDER_STATUS_REFUNDED);
|
||||
int updateOrder = orderService.updateRlOrder(order);
|
||||
int updateOrder = orderService.updateRlOrderByOrderNo(order);
|
||||
ServiceUtil.assertion(updateOrder == 0, "更新订单状态失败");
|
||||
|
||||
// 3.更新支付单中的退款金额为已退款
|
||||
|
@ -466,7 +465,7 @@ public class CallbackServiceImpl implements ICallbackService {
|
|||
PayBillQuery updateQuery = new PayBillQuery();
|
||||
updateQuery.setStatusList(PayBillStatus.payedList());
|
||||
updateQuery.setPayId(refund.getPayId());
|
||||
int update = paymentService.updatePayBill(closeData);
|
||||
int update = paymentService.updateByQuery(closeData,updateQuery);
|
||||
ServiceUtil.assertion(update != 1, "修改订单状态失败");
|
||||
|
||||
// 3.1记录(转移)已退款金额
|
||||
|
@ -520,10 +519,12 @@ public class CallbackServiceImpl implements ICallbackService {
|
|||
.setScale(2, RoundingMode.HALF_UP);
|
||||
totalRefundCalculated = totalRefundCalculated.add(refundForDetail);
|
||||
detail.setRefundAmount(refundForDetail);
|
||||
int i = dividendDetailService.updateRefundAmount(detail.getId(), refundForDetail);
|
||||
ServiceUtil.assertion(i == 0, "更新分成表退款金额失败");
|
||||
}
|
||||
|
||||
// 检查总分红比例是否为100%
|
||||
ServiceUtil.assertion(!totalDividendProportion.equals(new BigDecimal("100")), "总分红比例必须为100%");
|
||||
ServiceUtil.assertion(!(totalDividendProportion.compareTo(new BigDecimal("100")) == 0), "总分红比例必须为100%");
|
||||
|
||||
// 如果总退款金额有误差,由商户承担差额
|
||||
BigDecimal difference = totalRefundCalculated.subtract(refundAmount).abs();
|
||||
|
@ -559,11 +560,11 @@ public class CallbackServiceImpl implements ICallbackService {
|
|||
// 余额退款
|
||||
for (DividendDetailVO dividendDetail : refundList) {
|
||||
UserVO userVO = userService.selectUserById(dividendDetail.getPartnerId());
|
||||
ServiceUtil.assertion(userVO.getBalance().compareTo(dividendDetail.getBeRefundedAmount()) < 0, "可退款金额不足");
|
||||
ServiceUtil.assertion(userVO.getBalance().compareTo(dividendDetail.getRefundAmount()) < 0, "可退款金额不足");
|
||||
|
||||
/* 记录账变 */
|
||||
int i = changeBalanceService.generateChangeBalance(dividendDetail.getOrderNo(), null, ServiceConstants.FLOW_TYPE_DISBURSE,
|
||||
ServiceConstants.REFUND, dividendDetail.getBeRefundedAmount(), dividendDetail.getPartnerId(), dividendDetail.getPartnerName(), dividendDetail.getPartnerPhone(),dividendDetail.getPartnerType());
|
||||
ServiceConstants.REFUND, dividendDetail.getRefundAmount(), dividendDetail.getPartnerId(), dividendDetail.getPartnerName(), dividendDetail.getPartnerPhone(),dividendDetail.getPartnerType());
|
||||
ServiceUtil.assertion(i == 0, "更新记录账变失败");
|
||||
update++;
|
||||
}
|
||||
|
|
|
@ -184,11 +184,11 @@ public class ChangeBalanceServiceImpl implements IChangeBalanceService
|
|||
reason = businessType.getDescription() + orderNo;
|
||||
if (businessType == BusinessType.SYSTEM_MODIFY) {
|
||||
rlChangeBalance.setCreateBy(getUsername());
|
||||
if (type.equals(FLOW_TYPE_DISBURSE)) {
|
||||
changeAmount = changeAmount.negate();
|
||||
}
|
||||
reason = changeType + payFee + "元";
|
||||
}
|
||||
if (type.equals(FLOW_TYPE_DISBURSE)) {
|
||||
changeAmount = changeAmount.negate();
|
||||
}
|
||||
}
|
||||
rlChangeBalance.setReason(reason);
|
||||
BigDecimal finalChangeAmount = changeAmount;
|
||||
|
|
|
@ -516,7 +516,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<update id="addRefundAmountByOrderNo">
|
||||
update ss_order
|
||||
set refund = refund + #{refundAmount}
|
||||
where order_no = #{orderNo} and refund <![CDATA[<]]> paid
|
||||
where order_no = #{orderNo} and refund <![CDATA[<]]> pay_fee
|
||||
</update>
|
||||
|
||||
<update id="updateRlOrder" parameterType="Order">
|
||||
|
|
|
@ -52,7 +52,7 @@ public class RefundValidatormpl implements IRefundValidator
|
|||
ServiceUtil.assertion(ORDER_PAY_STATUS_NON_PAYMENT.equals(orderVO.getPaid()), "订单未支付,不能发起退款");
|
||||
ServiceUtil.assertion(dto.getAmount().compareTo(BigDecimal.ZERO) <= 0, "退款金额不能为0");
|
||||
ServiceUtil.assertion(dto.getAmount().compareTo(orderVO.getPayFee()) > 0, "退款金额不能超过订单金额");
|
||||
ServiceUtil.assertion(!PayBillStatus.PAY_SUCCESS.getStatus().equals(payBillVO.getStatus()), "支付单状态非:"+PayBillStatus.PAY_SUCCESS.getMsg()+",不允许退款");
|
||||
ServiceUtil.assertion(!PayBillStatus.PAY_SUCCESS.getStatus().equals(payBillVO.getStatus()), "支付单状态非"+PayBillStatus.PAY_SUCCESS.getMsg()+",不允许退款");
|
||||
|
||||
RefundBO bo = new RefundBO();
|
||||
bo.setOrder(orderVO);
|
||||
|
|
Loading…
Reference in New Issue
Block a user