|
@@ -1426,14 +1426,14 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService {
|
|
|
@Transactional(rollbackFor = Throwable.class, propagation = Propagation.REQUIRED)
|
|
|
public R payConfirm(String orderCode, String payCode, String tradeNo, String payType, Integer type) {
|
|
|
try {
|
|
|
- FsStoreOrderScrm order = null;
|
|
|
+ FsStoreOrder order = null;
|
|
|
if (type.equals(1)) {
|
|
|
|
|
|
- FsStorePaymentScrm storePayment = fsStorePaymentScrmMapper.selectFsStorePaymentByPaymentCode(payCode);
|
|
|
+ FsStorePayment storePayment = fsStorePaymentMapper.selectFsStorePaymentByPaymentCode(payCode);
|
|
|
if (storePayment != null) {
|
|
|
if (storePayment.getStatus().equals(0)) {
|
|
|
log.info(payCode + "待支付");
|
|
|
- FsStorePaymentScrm paymentMap = new FsStorePaymentScrm();
|
|
|
+ FsStorePayment paymentMap = new FsStorePayment();
|
|
|
paymentMap.setPaymentId(storePayment.getPaymentId());
|
|
|
paymentMap.setStatus(1);
|
|
|
paymentMap.setPayTime(new Date());
|
|
@@ -1450,42 +1450,33 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService {
|
|
|
paymentMap.setBankSerialNo(orderResult.getBankOrderId());
|
|
|
paymentMap.setBankTransactionId(orderResult.getBankTrxId());
|
|
|
}
|
|
|
- fsStorePaymentScrmMapper.updateFsStorePayment(paymentMap);
|
|
|
+ fsStorePaymentMapper.updateFsStorePayment(paymentMap);
|
|
|
log.info(payCode + "已支付");
|
|
|
- order = fsStoreOrderScrmMapper.selectFsStoreOrderById(Long.parseLong(storePayment.getBusinessOrderId()));
|
|
|
+ order = fsStoreOrderMapper.selectFsStoreOrderByOrderId(Long.parseLong(storePayment.getBusinessId()));
|
|
|
}
|
|
|
} else {
|
|
|
log.info(payCode + "支付单号不存在");
|
|
|
return R.error("支付单号不存在");
|
|
|
}
|
|
|
} else if (type.equals(2)) {
|
|
|
- order = fsStoreOrderScrmMapper.selectFsStoreOrderByOrderCode(orderCode);
|
|
|
+ order = fsStoreOrderMapper.selectFsStoreOrderByOrderCode(orderCode);
|
|
|
}
|
|
|
-// if (order != null && !order.getStatus().equals(FsStoreOrderStatusEnum.STATUS_1.getValue())) {
|
|
|
-// log.info(payCode + "订单号不为待支付回退");
|
|
|
-// TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
-// return R.error();
|
|
|
-// }
|
|
|
-
|
|
|
- //orderScrm迁移的表待支付状态码为:0
|
|
|
- if (order != null && !order.getStatus().equals(0)) {//判断订单状态是否待支付
|
|
|
+ if (order != null && !order.getStatus().equals(FsStoreOrderStatusEnum.STATUS_1.getValue())) {
|
|
|
log.info(payCode + "订单号不为待支付回退");
|
|
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
return R.error();
|
|
|
}
|
|
|
-
|
|
|
- if (order != null && !order.getPaid().equals(0)) {
|
|
|
+ if (order != null && !order.getIsPay().equals(0)) {
|
|
|
log.info(payCode + "订单号支付不为待支付回退");
|
|
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
return R.error();
|
|
|
}
|
|
|
- fsStoreOrderLogsService.create(order.getId(), FsStoreOrderLogEnum.PAY_ORDER_SUCCESS.getValue(),
|
|
|
+ fsStoreOrderLogsService.create(order.getOrderId(), FsStoreOrderLogEnum.PAY_ORDER_SUCCESS.getValue(),
|
|
|
FsStoreOrderLogEnum.PAY_ORDER_SUCCESS.getDesc());
|
|
|
- FsStoreOrderScrm storeOrder = new FsStoreOrderScrm();
|
|
|
- storeOrder.setId(order.getId());
|
|
|
- storeOrder.setPaid(1);
|
|
|
-// storeOrder.setStatus(2);
|
|
|
- storeOrder.setStatus(1);//代发货
|
|
|
+ FsStoreOrder storeOrder = new FsStoreOrder();
|
|
|
+ storeOrder.setOrderId(order.getOrderId());
|
|
|
+ storeOrder.setIsPay(1);
|
|
|
+ storeOrder.setStatus(2);
|
|
|
storeOrder.setPrescribePrice(order.getTotalPrice());
|
|
|
SysConfig sysConfig = sysConfigMapper.selectConfigByConfigKey("his.store");
|
|
|
Map<String, Object> config = (Map<String, Object>) JSON.parse(sysConfig.getConfigValue());
|
|
@@ -1498,20 +1489,20 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService {
|
|
|
} else {
|
|
|
storeOrder.setFollowDoctorId(iFsDoctorService.selectFollowDoctorDoctorByPackage());
|
|
|
}
|
|
|
- if (order.getCycle() != null && order.getCycle() >= followRate) {
|
|
|
+ if (order.getCycle() >= followRate) {
|
|
|
Calendar calendar = Calendar.getInstance();
|
|
|
calendar.setTime(new Date());
|
|
|
calendar.add(Calendar.DAY_OF_MONTH, followRate);
|
|
|
storeOrder.setFollowTime(calendar.getTime());
|
|
|
}
|
|
|
storeOrder.setPayTime(new Date());
|
|
|
- fsStoreOrderScrmMapper.updateFsStoreOrder(storeOrder);
|
|
|
+ fsStoreOrderMapper.updateFsStoreOrder(storeOrder);
|
|
|
//更新优惠券状态
|
|
|
- if (order.getCouponId() != null && order.getCouponId() > 0) {
|
|
|
- FsUserCoupon userCoupon = userCouponService.selectFsUserCouponById(order.getCouponId());
|
|
|
+ if (order.getUserCouponId() != null && order.getUserCouponId() > 0) {
|
|
|
+ FsUserCoupon userCoupon = userCouponService.selectFsUserCouponById(order.getUserCouponId());
|
|
|
if (userCoupon != null && userCoupon.getStatus().equals(0)) {
|
|
|
userCoupon.setUseTime(new Date());
|
|
|
- userCoupon.setBusinessId(order.getId());
|
|
|
+ userCoupon.setBusinessId(order.getOrderId());
|
|
|
userCoupon.setBusinessType(2);
|
|
|
userCoupon.setStatus(1);
|
|
|
userCouponService.updateFsUserCoupon(userCoupon);
|