|
@@ -3599,117 +3599,4 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService {
|
|
public Long selectFsStoreOrderListVOByErpAccountByExportCount(FsStoreOrderParam param) {
|
|
public Long selectFsStoreOrderListVOByErpAccountByExportCount(FsStoreOrderParam param) {
|
|
return fsStoreOrderMapper.selectFsStoreOrderListVOByErpAccountByExportCount(param);
|
|
return fsStoreOrderMapper.selectFsStoreOrderListVOByErpAccountByExportCount(param);
|
|
}
|
|
}
|
|
-
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
- @Transactional(rollbackFor = Throwable.class, propagation = Propagation.REQUIRED)
|
|
|
|
- public R payMiniProgramConfirm(String orderCode, String payCode, HuiFuResult huiFuResult, String payType, Integer type) {
|
|
|
|
- String tradeNo=huiFuResult.getHf_seq_id();
|
|
|
|
- try {
|
|
|
|
- FsStoreOrderScrm order = null;
|
|
|
|
- if (type.equals(1)) {
|
|
|
|
- FsStorePaymentScrm storePayment = fsStorePaymentScrmMapper.selectFsStorePaymentByPaymentCode(payCode);
|
|
|
|
- if (storePayment != null) {
|
|
|
|
- if (storePayment.getStatus().equals(0)) {
|
|
|
|
- log.info(payCode + "待支付");
|
|
|
|
- FsStorePaymentScrm paymentMap = new FsStorePaymentScrm();
|
|
|
|
- paymentMap.setPaymentId(storePayment.getPaymentId());
|
|
|
|
- paymentMap.setStatus(1);
|
|
|
|
- paymentMap.setPayTime(new Date());
|
|
|
|
- paymentMap.setTradeNo(tradeNo);
|
|
|
|
- paymentMap.setBankTransactionId(huiFuResult.getOut_trans_id());
|
|
|
|
- if (payType.equals(PayType.WECHAT_MINI_PROGRAM_PAYMENT.getCode())) {
|
|
|
|
- paymentMap.setPayTypeCode(PayType.WECHAT_MINI_PROGRAM_PAYMENT.name());
|
|
|
|
- } else if (payType.equals(PayType.ALIPAY_BARCODE_PAYMENT.getCode())) {
|
|
|
|
- paymentMap.setPayTypeCode(PayType.ALIPAY_BARCODE_PAYMENT.name());
|
|
|
|
- }
|
|
|
|
- if (storePayment.getPayMode().equals("yb")) {
|
|
|
|
- OrderQueryDTO orderQueryDTO = new OrderQueryDTO();
|
|
|
|
- orderQueryDTO.setUpOrderId(tradeNo);
|
|
|
|
- OrderResult orderResult = ybPayService.getOrder(orderQueryDTO);
|
|
|
|
- paymentMap.setBankSerialNo(orderResult.getBankOrderId());
|
|
|
|
- paymentMap.setBankTransactionId(orderResult.getBankTrxId());
|
|
|
|
- }
|
|
|
|
- fsStorePaymentScrmMapper.updateFsStorePayment(paymentMap);
|
|
|
|
- log.info(payCode + "已支付");
|
|
|
|
- order = fsStoreOrderScrmMapper.selectFsStoreOrderById(Long.parseLong(storePayment.getBusinessOrderId()));
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- log.info(payCode + "支付单号不存在");
|
|
|
|
- return R.error("支付单号不存在");
|
|
|
|
- }
|
|
|
|
- } else if (type.equals(2)) {
|
|
|
|
- order = fsStoreOrderScrmMapper.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)) {//判断订单状态是否待支付
|
|
|
|
- log.info(payCode + "订单号不为待支付回退");
|
|
|
|
- TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
|
- return R.error();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (order != null && !order.getPaid().equals(0)) {
|
|
|
|
- log.info(payCode + "订单号支付不为待支付回退");
|
|
|
|
- TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
|
- return R.error();
|
|
|
|
- }
|
|
|
|
- fsStoreOrderLogsService.create(order.getId(), 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);//代发货
|
|
|
|
- storeOrder.setPrescribePrice(order.getTotalPrice());
|
|
|
|
- SysConfig sysConfig = sysConfigMapper.selectConfigByConfigKey("his.store");
|
|
|
|
- Map<String, Object> config = (Map<String, Object>) JSON.parse(sysConfig.getConfigValue());
|
|
|
|
- Integer followRate = (Integer) config.get("followRate");
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- Long followDoctorId = fsPackageOrderMapper.selectFsPackageOrderByUserId(order.getUserId());
|
|
|
|
- if (followDoctorId != null && followDoctorId > 0) {
|
|
|
|
- storeOrder.setFollowDoctorId(followDoctorId);
|
|
|
|
- } else {
|
|
|
|
- storeOrder.setFollowDoctorId(iFsDoctorService.selectFollowDoctorDoctorByPackage());
|
|
|
|
- }
|
|
|
|
- if (order.getCycle() != null && 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);
|
|
|
|
- //更新优惠券状态
|
|
|
|
- if (order.getCouponId() != null && order.getCouponId() > 0) {
|
|
|
|
- FsUserCoupon userCoupon = userCouponService.selectFsUserCouponById(order.getCouponId());
|
|
|
|
- if (userCoupon != null && userCoupon.getStatus().equals(0)) {
|
|
|
|
- userCoupon.setUseTime(new Date());
|
|
|
|
- userCoupon.setBusinessId(order.getId());
|
|
|
|
- userCoupon.setBusinessType(2);
|
|
|
|
- userCoupon.setStatus(1);
|
|
|
|
- userCouponService.updateFsUserCoupon(userCoupon);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- return R.ok();
|
|
|
|
- } catch (Exception e) {
|
|
|
|
- log.info(payCode + "异常了" + e.getMessage());
|
|
|
|
- TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
|
- FsStorePaymentError err = new FsStorePaymentError();
|
|
|
|
- err.setOrderNo(orderCode);
|
|
|
|
- err.setOrderFlowNo(tradeNo);
|
|
|
|
- err.setStatus(0);
|
|
|
|
- err.setMsg(e.getMessage());
|
|
|
|
- err.setCreateTime(DateUtils.getNowDate());
|
|
|
|
- fsStorePaymentErrorMapper.insertFsStorePaymentError(err);
|
|
|
|
- return R.error();
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
}
|
|
}
|