|
@@ -45,6 +45,10 @@ import com.fs.his.service.*;
|
|
|
import com.fs.his.utils.ConfigUtil;
|
|
|
import com.fs.his.utils.PhoneUtil;
|
|
|
import com.fs.his.vo.*;
|
|
|
+import com.fs.hisStore.domain.FsStoreOrderScrm;
|
|
|
+import com.fs.hisStore.domain.FsStorePaymentScrm;
|
|
|
+import com.fs.hisStore.mapper.FsStoreOrderScrmMapper;
|
|
|
+import com.fs.hisStore.mapper.FsStorePaymentScrmMapper;
|
|
|
import com.fs.hisapi.domain.ApiResponse;
|
|
|
import com.fs.hisapi.param.CreateOrderParam;
|
|
|
import com.fs.hisapi.param.RecipeDetailParam;
|
|
@@ -132,6 +136,10 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService {
|
|
|
private HuiFuService huiFuService;
|
|
|
@Autowired
|
|
|
private FsStoreOrderMapper fsStoreOrderMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private FsStoreOrderScrmMapper fsStoreOrderScrmMapper;
|
|
|
+
|
|
|
@Autowired
|
|
|
private FsStoreOrderItemMapper fsStoreOrderItemMapper;
|
|
|
@Autowired
|
|
@@ -151,6 +159,9 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService {
|
|
|
private IFsStorePaymentService storePaymentService;
|
|
|
@Autowired
|
|
|
private FsStorePaymentMapper fsStorePaymentMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private FsStorePaymentScrmMapper fsStorePaymentScrmMapper;
|
|
|
@Autowired
|
|
|
private IFsExpressService expressService;
|
|
|
@Autowired
|
|
@@ -1388,10 +1399,10 @@ 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 {
|
|
|
- FsStoreOrder order = null;
|
|
|
+ FsStoreOrderScrm order = null;
|
|
|
if (type.equals(1)) {
|
|
|
|
|
|
- FsStorePayment storePayment = fsStorePaymentMapper.selectFsStorePaymentByPaymentCode(payCode);
|
|
|
+ FsStorePaymentScrm storePayment = fsStorePaymentScrmMapper.selectFsStorePaymentByPaymentCode(payCode);
|
|
|
if (storePayment != null) {
|
|
|
if (storePayment.getStatus().equals(0)) {
|
|
|
log.info(payCode + "待支付");
|
|
@@ -1414,31 +1425,40 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService {
|
|
|
}
|
|
|
fsStorePaymentMapper.updateFsStorePayment(paymentMap);
|
|
|
log.info(payCode + "已支付");
|
|
|
- order = fsStoreOrderMapper.selectFsStoreOrderByOrderId(Long.parseLong(storePayment.getBusinessId()));
|
|
|
+ order = fsStoreOrderScrmMapper.selectFsStoreOrderById(Long.parseLong(storePayment.getBusinessOrderId()));
|
|
|
}
|
|
|
} else {
|
|
|
log.info(payCode + "支付单号不存在");
|
|
|
return R.error("支付单号不存在");
|
|
|
}
|
|
|
} else if (type.equals(2)) {
|
|
|
- order = fsStoreOrderMapper.selectFsStoreOrderByOrderCode(orderCode);
|
|
|
+ order = fsStoreOrderScrmMapper.selectFsStoreOrderByOrderCode(orderCode);
|
|
|
}
|
|
|
- if (order != null && !order.getStatus().equals(FsStoreOrderStatusEnum.STATUS_1.getValue())) {
|
|
|
+// 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.getIsPay().equals(0)) {
|
|
|
+
|
|
|
+ if (order != null && !order.getPaid().equals(0)) {
|
|
|
log.info(payCode + "订单号支付不为待支付回退");
|
|
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
return R.error();
|
|
|
}
|
|
|
- fsStoreOrderLogsService.create(order.getOrderId(), FsStoreOrderLogEnum.PAY_ORDER_SUCCESS.getValue(),
|
|
|
+ fsStoreOrderLogsService.create(order.getId(), FsStoreOrderLogEnum.PAY_ORDER_SUCCESS.getValue(),
|
|
|
FsStoreOrderLogEnum.PAY_ORDER_SUCCESS.getDesc());
|
|
|
- FsStoreOrder storeOrder = new FsStoreOrder();
|
|
|
- storeOrder.setOrderId(order.getOrderId());
|
|
|
- storeOrder.setIsPay(1);
|
|
|
- storeOrder.setStatus(2);
|
|
|
+ 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());
|
|
@@ -1451,20 +1471,20 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService {
|
|
|
} else {
|
|
|
storeOrder.setFollowDoctorId(iFsDoctorService.selectFollowDoctorDoctorByPackage());
|
|
|
}
|
|
|
- if (order.getCycle() >= followRate) {
|
|
|
+ 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());
|
|
|
- fsStoreOrderMapper.updateFsStoreOrder(storeOrder);
|
|
|
+ fsStoreOrderScrmMapper.updateFsStoreOrder(storeOrder);
|
|
|
//更新优惠券状态
|
|
|
- if (order.getUserCouponId() != null && order.getUserCouponId() > 0) {
|
|
|
- FsUserCoupon userCoupon = userCouponService.selectFsUserCouponById(order.getUserCouponId());
|
|
|
+ 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.getOrderId());
|
|
|
+ userCoupon.setBusinessId(order.getId());
|
|
|
userCoupon.setBusinessType(2);
|
|
|
userCoupon.setStatus(1);
|
|
|
userCouponService.updateFsUserCoupon(userCoupon);
|