| | |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.util.LinkedMultiValueMap; |
| | | import org.springframework.util.MultiValueMap; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | private IServerCarModelService serverCarModelService; |
| | | @Autowired |
| | | private IAppOpenInfoService appOpenInfoService; |
| | | |
| | | @Resource |
| | | private UserInfoMapper userInfoMapper; |
| | | @Value("${filePath}") |
| | | private String filePath; |
| | | |
| | |
| | | if(null == orderPrivateCar){ |
| | | return ResultUtil.error("取消订单失败,订单信息有误"); |
| | | } |
| | | if(orderPrivateCar.getPayMethod() == 0 && orderPrivateCar.getPaymentAdvanceMoney()>0 && orderPrivateCar.getState() > 5 && orderPrivateCar.getState() != 11){ |
| | | if(orderPrivateCar.getPayMethod() == 0 && (Objects.nonNull(orderPrivateCar.getPaymentAdvanceMoney()) && orderPrivateCar.getPaymentAdvanceMoney()>0) && orderPrivateCar.getState() > 5 && orderPrivateCar.getState() != 11){ |
| | | return ResultUtil.error("取消订单失败,当前状态无法取消"); |
| | | } |
| | | if(orderPrivateCar.getPayMethod() == 1 && orderPrivateCar.getState() > 5 && orderPrivateCar.getState() != 11){ |
| | |
| | | integer = orderCancelService.saveData(id, 1, "无司机接单", "无司机接单", null, null, 2, 1, uid); |
| | | orderPrivateCar.setState(10); |
| | | this.updateById(orderPrivateCar); |
| | | if (orderPrivateCar.getPayMethod() == 0 && (Objects.nonNull(orderPrivateCar.getPaymentAdvanceMoney()) && orderPrivateCar.getPaymentAdvanceMoney()>0)) { |
| | | // 退款 |
| | | if (orderPrivateCar.getPayType() == 1 && orderPrivateCar.getOrderMoney() != 0) {//微信退款 |
| | | // 微信退款 |
| | | payMoneyUtil.wxRefund(orderPrivateCar.getTransactionId(), orderPrivateCar.getOrderNum(), String.valueOf(orderPrivateCar.getPaymentAdvanceMoney()), String.valueOf(new BigDecimal(orderPrivateCar.getPaymentAdvanceMoney())), "/base/transferWXNotify"); |
| | | // orderPrivateCar.setPayMoney(new BigDecimal(orderPrivateCar.getOrderMoney()).doubleValue()); |
| | | } |
| | | if (orderPrivateCar.getPayType() == 2 && orderPrivateCar.getOrderMoney() != 0) {//支付宝退款 |
| | | // 支付宝退款 |
| | | payMoneyUtil.aliRefund(orderPrivateCar.getTransactionId(), String.valueOf(new BigDecimal(orderPrivateCar.getPaymentAdvanceMoney()).multiply(new BigDecimal(100)))); |
| | | // orderPrivateCar.setPayMoney(new BigDecimal(orderPrivateCar.getOrderMoney()).doubleValue()); |
| | | } |
| | | if (orderPrivateCar.getPayType() == 3 && orderPrivateCar.getOrderMoney() != 0) {//余额支付 |
| | | BigDecimal refundMoney = new BigDecimal(orderPrivateCar.getPaymentAdvanceMoney()); |
| | | // 余额退款 |
| | | UserInfo userInfo = userInfoMapper.selectById(orderPrivateCar.getUserId()); |
| | | userInfo.setBalance(new BigDecimal(userInfo.getBalance()).add(refundMoney).doubleValue()); |
| | | userInfoMapper.updateById(userInfo); |
| | | } |
| | | } |
| | | } |
| | | }else { |
| | | CancleOrder query = cancleOrderService.query(orderPrivateCar.getOrderType(), 1, orderPrivateCar.getCompanyId()); |
| | |
| | | |
| | | orderPrivateCar.setState(10); |
| | | this.updateById(orderPrivateCar); |
| | | if (orderPrivateCar.getPayMethod() == 0 && (Objects.nonNull(orderPrivateCar.getPaymentAdvanceMoney()) && orderPrivateCar.getPaymentAdvanceMoney()>0)) { |
| | | // 退款 |
| | | if (orderPrivateCar.getPayType() == 1 && orderPrivateCar.getOrderMoney() != 0) {//微信退款 |
| | | // 微信退款 |
| | | payMoneyUtil.wxRefund(orderPrivateCar.getTransactionId(), orderPrivateCar.getOrderNum(), String.valueOf(orderPrivateCar.getPaymentAdvanceMoney()), String.valueOf(new BigDecimal(orderPrivateCar.getPaymentAdvanceMoney())), "/base/transferWXNotify"); |
| | | // orderPrivateCar.setPayMoney(new BigDecimal(orderPrivateCar.getOrderMoney()).doubleValue()); |
| | | } |
| | | if (orderPrivateCar.getPayType() == 2 && orderPrivateCar.getOrderMoney() != 0) {//支付宝退款 |
| | | // 支付宝退款 |
| | | payMoneyUtil.aliRefund(orderPrivateCar.getTransactionId(), String.valueOf(new BigDecimal(orderPrivateCar.getPaymentAdvanceMoney()).multiply(new BigDecimal(100)))); |
| | | // orderPrivateCar.setPayMoney(new BigDecimal(orderPrivateCar.getOrderMoney()).doubleValue()); |
| | | } |
| | | if (orderPrivateCar.getPayType() == 3 && orderPrivateCar.getOrderMoney() != 0) {//余额支付 |
| | | BigDecimal refundMoney = new BigDecimal(orderPrivateCar.getPaymentAdvanceMoney()); |
| | | // 余额退款 |
| | | UserInfo userInfo = userInfoMapper.selectById(orderPrivateCar.getUserId()); |
| | | userInfo.setBalance(new BigDecimal(userInfo.getBalance()).add(refundMoney).doubleValue()); |
| | | userInfoMapper.updateById(userInfo); |
| | | } |
| | | } |
| | | } |
| | | this.deleteTask(id);//删除定时任务 |
| | | |
| | |
| | | transactionDetailsService.saveData(orderPrivateCar.getUserId(), "完成订单", query.getAmount(), 2, 1, 1, 1, query.getOrderId()); |
| | | // orderPrivateCar.setState(8); |
| | | orderPrivateCar.setPayType(type); |
| | | orderPrivateCar.setTransactionId(order_id); |
| | | if(!StringUtils.hasLength(orderPrivateCar.getTransactionId())){ |
| | | orderPrivateCar.setTransactionId(order_id); |
| | | } |
| | | this.updateById(orderPrivateCar); |
| | | |
| | | UserInfo userInfo = userInfoService.selectById(orderPrivateCar.getUserId()); |
| | | SysIntegral query1 = sysIntegralMapper.query(orderPrivateCar.getCompanyId()); |
| | | userInfo.setIntegral(userInfo.getIntegral() + (query.getAmount().intValue() * query1.getIntegral()));//积分 |
| | | userInfoService.updateById(userInfo); |
| | | // UserInfo userInfo = userInfoService.selectById(orderPrivateCar.getUserId()); |
| | | // SysIntegral query1 = sysIntegralMapper.query(orderPrivateCar.getCompanyId()); |
| | | // userInfo.setIntegral(userInfo.getIntegral() + (query.getAmount().intValue() * query1.getIntegral()));//积分 |
| | | // userInfoService.updateById(userInfo); |
| | | |
| | | //处理优惠券和红包 |
| | | if(null != orderPrivateCar.getCouponId()){ |