|
@@ -1613,16 +1613,16 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
|
|
|
@Override
|
|
|
@Transactional
|
|
|
//类型1支付回调 类型2货到付款
|
|
|
- public String payConfirm(Integer type, Long orderId, String payCode, String tradeNo, String bankTransactionId, String bankSerialNo) {
|
|
|
+ public String payConfirm(Integer type,Long orderId,String payCode,String tradeNo,String bankTransactionId,String bankSerialNo) {
|
|
|
//支付订单
|
|
|
// try {
|
|
|
- FsStoreOrderScrm order = null;
|
|
|
- if (type.equals(1)) {
|
|
|
- FsStorePaymentScrm storePayment = paymentService.selectFsStorePaymentByCode(payCode);
|
|
|
- if (storePayment == null || !storePayment.getStatus().equals(0)) {
|
|
|
+ FsStoreOrderScrm order=null;
|
|
|
+ if(type.equals(1)){
|
|
|
+ FsStorePaymentScrm storePayment=paymentService.selectFsStorePaymentByCode(payCode);
|
|
|
+ if(storePayment==null||!storePayment.getStatus().equals(0)){
|
|
|
return "";
|
|
|
}
|
|
|
- FsStorePaymentScrm storePaymentMap = new FsStorePaymentScrm();
|
|
|
+ FsStorePaymentScrm storePaymentMap=new FsStorePaymentScrm();
|
|
|
storePaymentMap.setPaymentId(storePayment.getPaymentId());
|
|
|
storePaymentMap.setStatus(1);
|
|
|
storePaymentMap.setPayTime(new Date());
|
|
@@ -1630,49 +1630,51 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
|
|
|
storePaymentMap.setBankSerialNo(bankSerialNo);
|
|
|
storePaymentMap.setBankTransactionId(bankTransactionId);
|
|
|
paymentService.updateFsStorePayment(storePaymentMap);
|
|
|
- order = fsStoreOrderMapper.selectFsStoreOrderById(storePayment.getOrderId());
|
|
|
- if (order != null && !order.getStatus().equals(OrderInfoEnum.STATUS_0.getValue())) {
|
|
|
+ order=fsStoreOrderMapper.selectFsStoreOrderById(storePayment.getOrderId());
|
|
|
+ if(order!=null&&!order.getStatus().equals(OrderInfoEnum.STATUS_0.getValue())){
|
|
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
return "";
|
|
|
}
|
|
|
- if (order != null && !order.getPaid().equals(0)) {
|
|
|
+ if(order!=null&&!order.getPaid().equals(0)){
|
|
|
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if(type.equals(2)){
|
|
|
+ //货到付款
|
|
|
+ order=fsStoreOrderMapper.selectFsStoreOrderById(orderId);
|
|
|
+ if(!order.getStatus().equals(OrderInfoEnum.STATUS_0.getValue())){
|
|
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
return "";
|
|
|
- } else if (type.equals(2)) {
|
|
|
- //货到付款
|
|
|
- order = fsStoreOrderMapper.selectFsStoreOrderById(orderId);
|
|
|
- if (!order.getStatus().equals(OrderInfoEnum.STATUS_0.getValue())) {
|
|
|
- TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
- return "";
|
|
|
- }
|
|
|
- }
|
|
|
- //写入公司佣金 当有归属公司时只进行公司分佣
|
|
|
- if (order.getCompanyId() != null && order.getCompanyId() > 0) {
|
|
|
- companyService.addCompanyTuiMoney(order);
|
|
|
- //没有归属公司对个人分佣
|
|
|
- } else if (order.getIsPackage() != 1 && order.getTuiUserId() != null && order.getTuiUserId() > 0) {
|
|
|
- //处理佣金 套餐不分佣金
|
|
|
- FsStoreOrderItemScrm orderItemMap = new FsStoreOrderItemScrm();
|
|
|
- orderItemMap.setOrderId(order.getId());
|
|
|
- List<FsStoreOrderItemScrm> items = storeOrderItemService.selectFsStoreOrderItemList(orderItemMap);
|
|
|
- userService.addTuiMoney(order, items);
|
|
|
- }
|
|
|
- //增加用户购买次数
|
|
|
- userService.incPayCount(order.getUserId());
|
|
|
- //增加状态
|
|
|
- orderStatusService.create(order.getId(), OrderLogEnum.PAY_ORDER_SUCCESS.getValue(),
|
|
|
- OrderLogEnum.PAY_ORDER_SUCCESS.getDesc());
|
|
|
- FsStoreOrderScrm storeOrder = new FsStoreOrderScrm();
|
|
|
- storeOrder.setId(order.getId());
|
|
|
- storeOrder.setPaid(OrderInfoEnum.PAY_STATUS_1.getValue());
|
|
|
- storeOrder.setStatus(OrderInfoEnum.STATUS_1.getValue());
|
|
|
- storeOrder.setPayTime(new Date());
|
|
|
- fsStoreOrderMapper.updateFsStoreOrder(storeOrder);
|
|
|
- // 添加订单审核
|
|
|
- if (storeOrder.getCompanyId() != null) {
|
|
|
- addOrderAudit(order);
|
|
|
}
|
|
|
}
|
|
|
+ //写入公司佣金 当有归属公司时只进行公司分佣
|
|
|
+ if(order.getCompanyId()!=null&&order.getCompanyId()>0){
|
|
|
+ companyService.addCompanyTuiMoney(order);
|
|
|
+ //没有归属公司对个人分佣
|
|
|
+ }
|
|
|
+ else if (order.getIsPackage()!=1&&order.getTuiUserId()!=null&&order.getTuiUserId()>0){
|
|
|
+ //处理佣金 套餐不分佣金
|
|
|
+ FsStoreOrderItemScrm orderItemMap=new FsStoreOrderItemScrm();
|
|
|
+ orderItemMap.setOrderId(order.getId());
|
|
|
+ List<FsStoreOrderItemScrm> items= storeOrderItemService.selectFsStoreOrderItemList(orderItemMap);
|
|
|
+ userService.addTuiMoney(order,items);
|
|
|
+ }
|
|
|
+ //增加用户购买次数
|
|
|
+ userService.incPayCount(order.getUserId());
|
|
|
+ //增加状态
|
|
|
+ orderStatusService.create(order.getId(), OrderLogEnum.PAY_ORDER_SUCCESS.getValue(),
|
|
|
+ OrderLogEnum.PAY_ORDER_SUCCESS.getDesc());
|
|
|
+ FsStoreOrderScrm storeOrder = new FsStoreOrderScrm();
|
|
|
+ storeOrder.setId(order.getId());
|
|
|
+ storeOrder.setPaid(OrderInfoEnum.PAY_STATUS_1.getValue());
|
|
|
+ storeOrder.setStatus(OrderInfoEnum.STATUS_1.getValue());
|
|
|
+ storeOrder.setPayTime(new Date());
|
|
|
+ fsStoreOrderMapper.updateFsStoreOrder(storeOrder);
|
|
|
+ // 添加订单审核
|
|
|
+ if (storeOrder.getCompanyId()!=null){
|
|
|
+ addOrderAudit(order);
|
|
|
+ }
|
|
|
|
|
|
return "SUCCESS";
|
|
|
|