测试问题代码修改

This commit is contained in:
纪寒 2023-11-16 16:53:24 +08:00
parent 1b7e104213
commit 4aec3a2467
3 changed files with 39 additions and 33 deletions

View File

@ -399,6 +399,17 @@ public class WeChatPayNotifyServiceImpl implements WeChatPayNotifyService {
log.info("微信退款通知,记录商品订单微信退款单信息失败,订单编号 =====> {}", refundNotifyVO.getOutTradeNo());
}
}
//处理专家咨询订单-医生拒单退款信息
if (RefundStatusEnum.SUCCESS.getInfo().equals(refundNotifyVO.getRefundStatus())
&& StringUtils.isNotBlank(detailsOrderInfo.getOrderStatus())
&& GooodsOrderStatusEnum.REFUNDED.getInfo().equals(detailsOrderInfo.getOrderStatus())
&& OrderTypeEnum.HEALTH_CONSULTATION.getInfo().equals(detailsOrderInfo.getOrderType())) {
RefundInfo refundInfo = buildRefundInfo(plainText, refundNotifyVO);
int refundCount = refundInfoMapper.updateRefundInfoByNo(refundInfo);
if (refundCount < 1) {
log.info("微信退款通知,记录专家咨询订单微信退款单信息失败,订单编号 =====> {}", refundNotifyVO.getOutTradeNo());
}
}
if (RefundStatusEnum.CLOSED.getInfo().equals(refundNotifyVO.getRefundStatus())) {
log.info("当前商品退款单已经关闭,订单号 ====> {}, 退款单号 =====> {}", refundNotifyVO.getOutTradeNo(), refundNotifyVO.getOutRefundNo());
}

View File

@ -10,14 +10,7 @@ import com.xinelu.applet.vo.wechatpaymentinfo.vo.WeChatRefundInfoVO;
import com.xinelu.common.config.WeChatPaymentUrlConfig;
import com.xinelu.common.config.XylWeChatPaymentConfig;
import com.xinelu.common.core.domain.AjaxResult;
import com.xinelu.common.enums.ConfirmRefundStatusEnum;
import com.xinelu.common.enums.GooodsOrderStatusEnum;
import com.xinelu.common.enums.IntegralChangeType;
import com.xinelu.common.enums.OrderStatusEnum;
import com.xinelu.common.enums.OrderTypeEnum;
import com.xinelu.common.enums.PaymentMerchantTypeEnum;
import com.xinelu.common.enums.RefundStatusEnum;
import com.xinelu.common.enums.RefundTypeEnum;
import com.xinelu.common.enums.*;
import com.xinelu.common.exception.ServiceException;
import com.xinelu.manage.domain.appointmentorder.AppointmentOrder;
import com.xinelu.manage.domain.goodsOrder.GoodsOrder;
@ -34,13 +27,6 @@ import com.xinelu.manage.service.consultationInfo.IConsultationInfoService;
import com.xinelu.manage.service.scheduleplandetail.ISchedulePlanDetailService;
import com.xinelu.manage.vo.goodsorder.GoodsInfoRedemptionVO;
import com.xinelu.manage.vo.patientinfo.PatientInfoVO;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Objects;
import javax.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.client.methods.CloseableHttpResponse;
@ -52,6 +38,14 @@ import org.apache.http.util.EntityUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Objects;
/**
* @Description 微信退款业务层实现类
* @Author 纪寒
@ -80,10 +74,10 @@ public class WeChatRefundServiceImpl implements WeChatRefundService {
private PatientIntegralChangeMapper patientIntegralChangeMapper;
@Resource
private PatientInfoMapper patientInfoMapper;
@Resource
private IConsultationInfoService consultationInfoService;
@Resource
private ISchedulePlanDetailService planDetailService;
@Resource
private IConsultationInfoService consultationInfoService;
@Resource
private ISchedulePlanDetailService planDetailService;
/**
* 成功状态码
@ -245,24 +239,25 @@ public class WeChatRefundServiceImpl implements WeChatRefundService {
if (Objects.isNull(goodsOrderInfo.getTotalPrice()) || goodsOrderInfo.getTotalPrice().compareTo(BigDecimal.ZERO) <= 0) {
return AjaxResult.error("当前订单金额异常,无法拒单!");
}
//直接将订单状态修改为已退款因为微信支付回调有延迟导致医生APP端拒单以后订单状态无法及时刷新
goodsOrderMapper.updateGoodsOrderStatus(OrderStatusEnum.REFUNDED.getInfo(), closeOrderDTO.getOrderNo());
Long patientId = Objects.isNull(goodsOrderInfo.getPatientId()) ? 0 : goodsOrderInfo.getPatientId();
String outRefundNo = com.xinelu.common.utils.StringUtils.fillZeroByPatientId(patientId, 5) + System.nanoTime();
String refundParam = this.buildHealthConsultationRefundParam(goodsOrderInfo, outRefundNo);
String refundReason = StringUtils.isBlank(closeOrderDTO.getRemark()) ? "" : closeOrderDTO.getRemark();
this.applyWeRefund(refundParam, null, goodsOrderInfo, patientId, refundReason);
// 查询是否为专家咨询订单修改时间段的可预约状态
GoodsOrder goodsOrder = goodsOrderMapper.getGoodsOrderByOrderNo(closeOrderDTO.getOrderNo());
if (goodsOrder.getConsultationInfoId() != null) {
ConsultationInfoDTO consultationInfo = consultationInfoService.selectConsultationInfoById(goodsOrder.getConsultationInfoId());
if (consultationInfo != null && consultationInfo.getSchedulePlanDetailId() != null) {
// 修改预约时间段的状态
SchedulePlanDetail schedulePlanDetail = new SchedulePlanDetail();
schedulePlanDetail.setId(consultationInfo.getSchedulePlanDetailId());
schedulePlanDetail.setApplyState("0");
planDetailService.update(schedulePlanDetail);
}
}
return AjaxResult.success();
// 查询是否为专家咨询订单修改时间段的可预约状态
if (goodsOrderInfo.getConsultationInfoId() != null) {
ConsultationInfoDTO consultationInfo = consultationInfoService.selectConsultationInfoById(goodsOrderInfo.getConsultationInfoId());
if (consultationInfo != null && consultationInfo.getSchedulePlanDetailId() != null) {
// 修改预约时间段的状态
SchedulePlanDetail schedulePlanDetail = new SchedulePlanDetail();
schedulePlanDetail.setId(consultationInfo.getSchedulePlanDetailId());
schedulePlanDetail.setApplyState("0");
planDetailService.update(schedulePlanDetail);
}
}
return AjaxResult.success();
}
/**

View File

@ -98,7 +98,7 @@ public class RefundInfoTaskServiceImpl implements RefundInfoTaskService {
*/
@Override
public void automaticProcessHealthConsultationRefund() {
List<RefundOrderInfoVO> refundGoodsOrderLit = goodsOrderMapper.getRefundGoodsOrderInfo(GooodsOrderStatusEnum.WAIT_RECEIVED_GOODS.getInfo(), RefundStatusEnum.PROCESSING.getInfo(), ConfirmRefundStatusEnum.CONFIRMED.getInfo());
List<RefundOrderInfoVO> refundGoodsOrderLit = goodsOrderMapper.getRefundGoodsOrderInfo(GooodsOrderStatusEnum.REFUNDED.getInfo(), RefundStatusEnum.PROCESSING.getInfo(), ConfirmRefundStatusEnum.CONFIRMED.getInfo());
if (CollectionUtils.isEmpty(refundGoodsOrderLit)) {
return;
}