非加价单调整完毕
This commit is contained in:
parent
3bfcafa2ba
commit
4882e59be9
|
|
@ -295,15 +295,25 @@ public class OrderDetailServiceImpl implements OrderDetailService {
|
|||
public synchronized void finish(Long orderDetailId) throws BaseAdaPayException {
|
||||
// 校验订单
|
||||
OrderDetail orderDetail = selectById(orderDetailId);
|
||||
Assert.notNull(orderDetail, "找不到对应的子订单");
|
||||
if(orderDetail == null){
|
||||
throw new BaseException("找不到对应的子订单");
|
||||
}
|
||||
Assert.isTrue(!orderDetail.getOrderStatus().equals(OrderStatus.FINISH.code()), "订单已经是完成状态");
|
||||
FinancialMaster financialMaster = financialMasterService.selectByOrderMasterId(orderDetail.getOrderMasterId());
|
||||
Assert.notNull(financialMaster, "找不到主财务单");
|
||||
if(financialMaster == null){
|
||||
throw new BaseException("找不到主财务单");
|
||||
}
|
||||
PaymentDTO payment = financialMasterService.selectPaymentById(financialMaster.getPaymentId());
|
||||
Assert.notNull(payment, "找不到支付记录");
|
||||
if(payment == null){
|
||||
throw new BaseException("找不到支付记录");
|
||||
}
|
||||
List<FinancialDetail> financialDetail = financialDetailService.selectListByOrderDetailId(orderDetailId);
|
||||
Assert.notNull(financialDetail, "找不到子财务单");
|
||||
Assert.isTrue(financialDetail.get(0).getPayStatus() == 1, "订单不是“已支付”状态");
|
||||
if(financialDetail == null){
|
||||
throw new BaseException("找不到子财务单");
|
||||
}
|
||||
if(financialDetail.get(0).getPayStatus() != 1){
|
||||
throw new BaseException("订单不是“已支付”状态");
|
||||
}
|
||||
// 更新订单状态
|
||||
orderDetailMapper.updateStatus(orderDetailId, OrderStatus.FINISH.code());
|
||||
// 分账账户信息
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ public interface FinancialMasterMapper {
|
|||
* @param id ID
|
||||
* @param payType 支付渠道
|
||||
*/
|
||||
void paySucceeded(@Param(value = "id") Long id, @Param(value = "payType") int payType);
|
||||
void paySucceeded(@Param(value = "paymentId")String paymentId, @Param(value = "id") Long id, @Param(value = "payType") int payType);
|
||||
|
||||
/**
|
||||
* 支付成功
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ import javax.annotation.Resource;
|
|||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.format.DateTimeFormatterBuilder;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
|
|
@ -105,7 +106,13 @@ public class FinancialMasterServiceImpl implements FinancialMasterService {
|
|||
List<FinancialMaster> result = financialMasterMapper.selectFinancialMasterList(param);
|
||||
if(!CollectionUtils.isEmpty(result)){
|
||||
financialMasterMapper.updateOrderStatus(result.get(0).getOrderMasterCode(), PayStatus.PAID.getCode());
|
||||
financialMasterMapper.paySucceeded(result.get(0).getId(), payType);
|
||||
financialMasterMapper.paySucceeded(paymentId, result.get(0).getId(), payType);
|
||||
FinancialDetail request = new FinancialDetail();
|
||||
request.setFinancialMasterId(result.get(0).getId());
|
||||
request.setPayStatus(PayStatus.PAID.getCode());
|
||||
request.setPayType(payType);
|
||||
request.setPayTime(new Date());
|
||||
financialDetailService.updateByFinancialMasterId(request);
|
||||
}else {
|
||||
logger.error("原单不存在!");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ import com.ghy.payment.service.FinancialMasterService;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
|
|
@ -44,6 +45,7 @@ public class PayCallbackService implements CallBackService {
|
|||
FinancialChangeRecordService financialChangeRecordService;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void onCallback(Event event) {
|
||||
logger.info("支付回调: {}", event);
|
||||
String data = event.getData();
|
||||
|
|
|
|||
|
|
@ -111,6 +111,7 @@
|
|||
|
||||
<update id="paySucceeded">
|
||||
UPDATE financial_master SET
|
||||
payment_id = #{paymentId},
|
||||
pay_status = 1 ,
|
||||
pay_type = #{payType},
|
||||
pay_time = SYSDATE(),
|
||||
|
|
|
|||
Loading…
Reference in New Issue