| | |
| | | return ResultUtil.error("司机还未上班"); |
| | | } |
| | | Driver driver = driverService.selectById(travelOrder.getDriverId()); |
| | | if(driver.getServerStatus() == 2){ |
| | | return ResultUtil.error("司机正在服务中"); |
| | | } |
| | | order.setAgentId(driver.getAgentId()); |
| | | order.setBranchOfficeId(driver.getBranchOfficeId()); |
| | | order.setOrderTakingTime(new Date()); |
| | |
| | | driverService.updateById(driver); |
| | | |
| | | appUser.setCancelCount(0); |
| | | appUser.setIsException(1); |
| | | appUserService.updateById(appUser); |
| | | } |
| | | |
| | |
| | | this.updateById(order); |
| | | AppUser appUser = appUserService.selectById(uid); |
| | | appUser.setCancelCount(appUser.getCancelCount() + 1); |
| | | if(appUser.getCancelCount() >= 3){ |
| | | appUser.setIsException(2); |
| | | } |
| | | appUserService.updateById(appUser); |
| | | Driver driver = driverService.selectById(order.getDriverId()); |
| | | if(null != driver){ |
| | |
| | | Order orderPrice = getOrderPrice(1, d, 0, order1, city); |
| | | order.setEstimatedPrice(orderPrice.getEstimatedPrice()); |
| | | this.updateById(order); |
| | | |
| | | PushOrderInfoWarpper pushOrderInfoWarpper = new PushOrderInfoWarpper(); |
| | | pushOrderInfoWarpper.setId(order.getId()); |
| | | pushOrderInfoWarpper.setState(order.getState()); |
| | | pushOrderInfoWarpper.setEndAddress(order.getEndAddress()); |
| | | pushOrderInfoWarpper.setEndLat(order.getEndLat()); |
| | | pushOrderInfoWarpper.setEndLng(order.getEndLng()); |
| | | pushUtil.pushOrderInfo(order.getDriverId(), 2, pushOrderInfoWarpper); |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | |
| | | Order order = this.selectById(orderId); |
| | | OrderPriceWarpper orderPriceWarpper = new OrderPriceWarpper(); |
| | | BeanUtils.copyProperties(order, orderPriceWarpper); |
| | | AppUser appUser = appUserService.selectById(uid); |
| | | orderPriceWarpper.setBalance(appUser.getAccountBalance()); |
| | | Double orderMoney = order.getOrderMoney(); |
| | | //先算优惠券 |
| | | Coupon coupon = userToCouponService.queryCoupon(uid, orderMoney); |
| | | if(null != coupon){ |
| | | orderMoney = orderMoney - coupon.getCouponPreferentialAmount(); |
| | | orderPriceWarpper.setDiscountedPrice(coupon.getCouponPreferentialAmount()); |
| | | orderPriceWarpper.setCouponId(coupon.getId()); |
| | | orderPriceWarpper.setActualMileage(new BigDecimal(order.getActualMileage() / 1000).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | orderPriceWarpper.setTravelTime(Double.valueOf((order.getGetoffTime().getTime() - order.getStartTime().getTime()) / 60000).intValue()); |
| | | if(null == order.getPayTime()){ |
| | | AppUser appUser = appUserService.selectById(uid); |
| | | orderPriceWarpper.setBalance(appUser.getAccountBalance()); |
| | | Double orderMoney = order.getOrderMoney(); |
| | | //先算优惠券 |
| | | Coupon coupon = userToCouponService.queryCoupon(uid, orderMoney); |
| | | if(null != coupon){ |
| | | orderMoney = orderMoney - coupon.getCouponPreferentialAmount(); |
| | | orderPriceWarpper.setDiscountedPrice(coupon.getCouponPreferentialAmount()); |
| | | orderPriceWarpper.setCouponId(coupon.getId()); |
| | | } |
| | | orderPriceWarpper.setDiscount(0D); |
| | | orderPriceWarpper.setDiscountAmount(0D); |
| | | orderPriceWarpper.setPayType(1);//微信支付 |
| | | orderPriceWarpper.setPayMoney(orderMoney); |
| | | } |
| | | orderPriceWarpper.setDiscount(0D); |
| | | orderPriceWarpper.setDiscountAmount(0D); |
| | | orderPriceWarpper.setPayType(1);//微信支付 |
| | | orderPriceWarpper.setPayMoney(orderMoney); |
| | | return orderPriceWarpper; |
| | | } |
| | | |
| | |
| | | OrderPriceWarpper orderPriceWarpper = new OrderPriceWarpper(); |
| | | BeanUtils.copyProperties(order, orderPriceWarpper); |
| | | AppUser appUser = appUserService.selectById(uid); |
| | | orderPriceWarpper.setActualMileage(new BigDecimal(order.getActualMileage() / 1000).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | orderPriceWarpper.setTravelTime(Double.valueOf((order.getGetoffTime().getTime() - order.getStartTime().getTime()) / 60000).intValue()); |
| | | orderPriceWarpper.setBalance(appUser.getAccountBalance()); |
| | | orderPriceWarpper.setDiscount(0D); |
| | | orderPriceWarpper.setDiscountAmount(0D); |
| | |
| | | //先算优惠券 |
| | | Coupon coupon = userToCouponService.queryCoupon(uid, orderMoney); |
| | | if(null != coupon && null == couponId){ |
| | | orderMoney = orderMoney - coupon.getCouponPreferentialAmount(); |
| | | orderPriceWarpper.setDiscountedPrice(coupon.getCouponPreferentialAmount()); |
| | | orderPriceWarpper.setCouponId(coupon.getId()); |
| | | } |
| | |
| | | orderPriceWarpper.setDiscountedPrice(coupon1.getCouponPreferentialAmount()); |
| | | orderPriceWarpper.setCouponId(couponId); |
| | | } |
| | | if(payType == 1 && appUser.getHavDiscount() == 1){//使用余额抵扣 |
| | | if(payType == 1 && appUser.getHavDiscount() == 1 && balance >= orderMoney){//使用余额抵扣 |
| | | orderPriceWarpper.setDiscount(9D); |
| | | orderPriceWarpper.setDiscountAmount(orderMoney * 0.1); |
| | | orderMoney = orderMoney * 0.9; |
| | | orderPriceWarpper.setDiscountAmount(new BigDecimal(orderMoney * 0.1).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | orderMoney = new BigDecimal(orderMoney * 0.9).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | } |
| | | if(payType == 0){//不使用余额抵扣 |
| | | orderPriceWarpper.setPayType(1); |
| | |
| | | UserToCoupon userToCoupon = userToCouponService.selectById(couponId); |
| | | if(userToCoupon.getValidCount() > 0){ |
| | | userToCoupon.setValidCount(userToCoupon.getValidCount() - 1); |
| | | userToCouponService.updateById(userToCoupon); |
| | | Coupon coupon = couponService.selectById(userToCoupon.getCouponId()); |
| | | payMoney = payMoney - coupon.getCouponPreferentialAmount(); |
| | | order.setCouponId(coupon.getId()); |
| | | order.setDiscountedPrice(coupon.getCouponPreferentialAmount()); |
| | | userToCouponService.updateById(userToCoupon); |
| | | } |
| | | } |
| | | order.setPayType(1); |
| | |
| | | UserToCoupon userToCoupon = userToCouponService.selectById(couponId); |
| | | if(userToCoupon.getValidCount() > 0){ |
| | | userToCoupon.setValidCount(userToCoupon.getValidCount() - 1); |
| | | userToCouponService.updateById(userToCoupon); |
| | | Coupon coupon = couponService.selectById(userToCoupon.getCouponId()); |
| | | payMoney = payMoney - coupon.getCouponPreferentialAmount(); |
| | | order.setCouponId(coupon.getId()); |
| | | order.setDiscountedPrice(coupon.getCouponPreferentialAmount()); |
| | | |
| | | Driver driver = driverService.selectById(order.getDriverId()); |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(order.getDriverId()); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | accountChangeDetail.setOldData(driver.getCouponBalance()); |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetail.setChangeType(7); |
| | | accountChangeDetail.setOrderId(order.getId()); |
| | | accountChangeDetail.setExplain("优惠券收入"); |
| | | driver.setCouponBalance(driver.getCouponBalance() + coupon.getCouponPreferentialAmount()); |
| | | accountChangeDetail.setNewData(driver.getCouponBalance()); |
| | | driverService.updateById(driver); |
| | | accountChangeDetailService.insert(accountChangeDetail); |
| | | } |
| | | } |
| | | |
| | |
| | | UserToCoupon userToCoupon = userToCouponService.selectById(couponId); |
| | | if(userToCoupon.getValidCount() > 0){ |
| | | userToCoupon.setValidCount(userToCoupon.getValidCount() - 1); |
| | | userToCouponService.updateById(userToCoupon); |
| | | Coupon coupon = couponService.selectById(userToCoupon.getCouponId()); |
| | | payMoney = payMoney - coupon.getCouponPreferentialAmount(); |
| | | order.setCouponId(coupon.getId()); |
| | |
| | | this.updateById(order); |
| | | return ResultUtil.success(payCode); |
| | | |
| | | // TODO: 2023/5/18 取消支付后需要处理优惠券数据回退 |
| | | // |
| | | // |
| | | // new Thread(new Runnable() { |
| | |
| | | List<PlatformRechargeRecord> platformRechargeRecords = platformRechargeRecordService.selectList(new EntityWrapper<PlatformRechargeRecord>().eq("state", 2).last(" and balance > 0 order by payTime")); |
| | | Double discountedPrice = order.getDiscountedPrice(); |
| | | Driver driver = driverService.selectById(order.getDriverId()); |
| | | |
| | | UserToCoupon userToCoupon = userToCouponService.selectById(order.getCouponId()); |
| | | Coupon coupon = couponService.selectById(userToCoupon.getCouponId()); |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(order.getDriverId()); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | accountChangeDetail.setOldData(driver.getCouponBalance()); |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetail.setChangeType(7); |
| | | accountChangeDetail.setOrderId(order.getId()); |
| | | accountChangeDetail.setExplain("优惠券收入"); |
| | | driver.setCouponBalance(driver.getCouponBalance() + coupon.getCouponPreferentialAmount()); |
| | | accountChangeDetail.setNewData(driver.getCouponBalance()); |
| | | driverService.updateById(driver); |
| | | accountChangeDetailService.insert(accountChangeDetail); |
| | | |
| | | |
| | | for (PlatformRechargeRecord platformRechargeRecord : platformRechargeRecords) { |
| | | if(discountedPrice == 0){ |
| | | break; |
| | |
| | | notInvoiceOrder.setPageNum((notInvoiceOrder.getPageNum() - 1) * notInvoiceOrder.getPageSize());; |
| | | return this.baseMapper.queryNotInvoiceOrder(uid, notInvoiceOrder); |
| | | } |
| | | |
| | | |
| | | } |