| | |
| | | order.setStartDistance(distance);//起步里程 |
| | | order.setStartPrice(num4);//起步价 |
| | | }else{ |
| | | BigDecimal subtract = new BigDecimal(distance).subtract(new BigDecimal(num3));//超出起步里程 |
| | | BigDecimal divide = subtract.divide(new BigDecimal(num5), new MathContext(2, RoundingMode.HALF_EVEN)); |
| | | BigDecimal subtract = new BigDecimal(distance).subtract(new BigDecimal(num3)).setScale(2, BigDecimal.ROUND_HALF_EVEN);//超出起步里程 |
| | | BigDecimal divide = subtract.divide(new BigDecimal(num5), 2, BigDecimal.ROUND_HALF_EVEN); |
| | | BigDecimal multiply = divide.multiply(new BigDecimal(num6)); |
| | | order.setStartDistance(num3);//起步里程 |
| | | order.setStartPrice(num4);//起步价 |
| | |
| | | } |
| | | //计算长途里程超出的部分 |
| | | if(distance.compareTo(num8) > 0){ |
| | | BigDecimal subtract1 = new BigDecimal(distance).subtract(new BigDecimal(num8)); |
| | | BigDecimal divide1 = subtract1.divide(new BigDecimal(num10), new MathContext(2, RoundingMode.HALF_EVEN)); |
| | | BigDecimal subtract1 = new BigDecimal(distance).subtract(new BigDecimal(num8)).setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | BigDecimal divide1 = subtract1.divide(new BigDecimal(num10), 2, BigDecimal.ROUND_HALF_EVEN); |
| | | BigDecimal multiply1 = divide1.multiply(new BigDecimal(num11)); |
| | | order.setOverLongDistance(subtract1.doubleValue());//超出长途里程 |
| | | order.setOverLongDistancePrice(multiply1.doubleValue());//超出长途里程费 |
| | |
| | | if(driver1.getServerStatus() == 2 || driver1.getOpenOrderQRCode() == 1){ |
| | | continue; |
| | | } |
| | | DriverWork driverWork = driverWorkService.selectOne(new EntityWrapper<DriverWork>().eq("driverId", driver1.getId()).eq("status", 1)); |
| | | if(null == driverWork){ |
| | | continue; |
| | | } |
| | | Map<String, Double> distance = GeodesyUtil.getDistance(value, order.getStartLng() + "," + order.getStartLat()); |
| | | Double wgs84 = distance.get("WGS84"); |
| | | if(d == null || d.compareTo(wgs84) > 0){ |
| | |
| | | if(ToolUtil.isEmpty(value)){ |
| | | continue; |
| | | } |
| | | DriverWork driverWork = driverWorkService.selectOne(new EntityWrapper<DriverWork>().eq("driverId", driver1.getId()).eq("status", 1)); |
| | | if(null == driverWork){ |
| | | continue; |
| | | } |
| | | |
| | | if(integral == null || integral.compareTo(driver1.getIntegral()) < 0){//积分大 |
| | | integral = driver1.getIntegral(); |
| | | score = driver1.getScore(); |
| | |
| | | if(order1.getState() == 101 || order1.getState() == 201){ |
| | | order1.setHallOrder(1); |
| | | OrderServiceImpl.this.updateById(order1); |
| | | ExtraPushOrder(order); |
| | | } |
| | | } |
| | | }, num4 * 1000); |
| | | }else{ |
| | | order.setHallOrder(1); |
| | | this.updateById(order); |
| | | ExtraPushOrder(order); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | public void ExtraPushOrder(Order order){ |
| | | String startLat = order.getStartLat(); |
| | | String startLng = order.getStartLng(); |
| | | |
| | | //找到中心点 |
| | | GeoJsonPoint geoJsonPoint = new GeoJsonPoint(Double.valueOf(startLng), Double.valueOf(startLat)); |
| | | Double num = 5D;//范围公里 |
| | | //构造半径 |
| | | Distance distanceR = new Distance(num, Metrics.KILOMETERS); |
| | | //画圆 |
| | | Circle circle = new Circle(geoJsonPoint, distanceR); |
| | | // 构造query对象 |
| | | Query query = Query.query(Criteria.where("location").withinSphere(circle)); |
| | | List<Location> locations = mongoTemplate.find(query, Location.class); |
| | | List<Integer> driverIds = locations.stream().map(Location::getDriverId).collect(Collectors.toList()); |
| | | if(driverIds.size() == 0){ |
| | | return; |
| | | } |
| | | List<DriverWork> tDriverWorks = driverWorkService.selectList(new EntityWrapper<DriverWork>().in("driverId", driverIds).eq("status", 1)); |
| | | driverIds = tDriverWorks.stream().map(DriverWork::getDriverId).collect(Collectors.toList()); |
| | | List<Driver> drivers = driverService.selectList(new EntityWrapper<Driver>().eq("approvalStatus", 2) |
| | | .eq("serverStatus", 1).eq("openOrderQRCode", 0).eq("status", 1).in("id", driverIds)); |
| | | if(drivers.size() == 0){ |
| | | return; |
| | | } |
| | | for (Driver driver1 : drivers) { |
| | | String value = redisUtil.getValue("DRIVER" + driver1.getId()); |
| | | if (ToolUtil.isEmpty(value)) { |
| | | return; |
| | | } |
| | | pushUtil.pushGrabOrderExtras(driver1.getId(), 2); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | @Override |
| | | public OrderPriceWarpper queryOrderPrice(Integer uid, Long orderId) throws Exception { |
| | | Order order = this.selectById(orderId); |
| | | Coupon coupon = userToCouponService.queryCoupon(uid, order.getOrderMoney()); |
| | | OrderPriceWarpper orderPriceWarpper = new OrderPriceWarpper(); |
| | | BeanUtils.copyProperties(order, orderPriceWarpper); |
| | | if(null != coupon){ |
| | | orderPriceWarpper.setCouponId(coupon.getId()); |
| | | orderPriceWarpper.setDiscountedPrice(coupon.getCouponPreferentialAmount()); |
| | | } |
| | | 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()); |
| | | return orderPriceWarpper; |
| | |
| | | |
| | | PaymentOrder paymentOrder = new PaymentOrder(); |
| | | paymentOrder.setBizOrderId(out_trade_no); |
| | | paymentOrder.setAmount(String.valueOf(payMoney * 100)); |
| | | paymentOrder.setAmount(String.valueOf(Double.valueOf(payMoney * 100).intValue())); |
| | | paymentOrder.setOrderName("代驾服务费"); |
| | | paymentOrder.setPayType("WX_MINI"); |
| | | paymentOrder.setTransferType("0"); |
| | |
| | | String status = jsonObject.getString("status"); |
| | | if("2".equals(status)){ |
| | | return ResultUtil.error("失败"); |
| | | } |
| | | if("0".equals(status)){ |
| | | return ResultUtil.error("处理中"); |
| | | } |
| | | String merOrderId = jsonObject.getString("merOrderId"); |
| | | String payCode = jsonObject.getString("payCode"); |
| | |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(order.getDriverId()); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | accountChangeDetail.setOldData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission()); |
| | | accountChangeDetail.setOldData(driver.getCouponBalance() + driver.getCommission()); |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetail.setChangeType(7); |
| | | accountChangeDetail.setOrderId(order.getId()); |
| | | accountChangeDetail.setExplain("优惠券收入"); |
| | | driver.setCommission(driver.getCommission() + coupon.getCouponPreferentialAmount()); |
| | | accountChangeDetail.setNewData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission()); |
| | | accountChangeDetail.setNewData(driver.getCouponBalance() + driver.getCommission()); |
| | | driverService.updateById(driver); |
| | | accountChangeDetailService.insert(accountChangeDetail); |
| | | } |
| | |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(order.getDriverId()); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | accountChangeDetail.setOldData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission()); |
| | | accountChangeDetail.setOldData(driver.getCouponBalance() + driver.getCommission()); |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetail.setChangeType(7); |
| | | accountChangeDetail.setOrderId(order.getId()); |
| | | accountChangeDetail.setExplain("优惠券收入"); |
| | | driver.setCommission(driver.getCommission() + coupon.getCouponPreferentialAmount()); |
| | | accountChangeDetail.setNewData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission()); |
| | | accountChangeDetail.setNewData(driver.getCouponBalance() + driver.getCommission()); |
| | | driverService.updateById(driver); |
| | | accountChangeDetailService.insert(accountChangeDetail); |
| | | } |
| | |
| | | String status = jsonObject.getString("status"); |
| | | if("2".equals(status)){ |
| | | return ResultUtil.error("失败"); |
| | | } |
| | | if("0".equals(status)){ |
| | | return ResultUtil.error("处理中"); |
| | | } |
| | | String merOrderId = jsonObject.getString("merOrderId"); |
| | | String payCode = jsonObject.getString("payCode"); |
| | |
| | | if(null != systemConfig){ |
| | | //{"num1":"10:00","num2":"14:00","num3":10,"num4":10,"num5":10,"num6":10,"num7":10,"num8":10,"num9":5,"num10":5} |
| | | JSONObject jsonObject = JSON.parseObject(systemConfig.getContent()); |
| | | Integer num5 = jsonObject.getInteger("num5"); |
| | | Integer num5 = jsonObject.getInteger("num6"); |
| | | |
| | | //增加积分变动记录 |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | |
| | | //司机分佣和司机推荐用户首单奖励都在平台的抽佣中扣除,剩余的为平台抽佣。 |
| | | Driver driver = driverService.selectById(order.getDriverId()); |
| | | AppUser appUser = appUserService.selectById(order.getUserId()); |
| | | |
| | | //首单积分奖励 |
| | | //司机推荐首单收入 |
| | | List<Integer> state = Arrays.asList(107, 108, 109); |
| | | int count = this.selectCount(new EntityWrapper<Order>().eq("userId", appUser.getId()).eq("status", 1).in("state", state)); |
| | | if(null != appUser.getInviterType() && appUser.getInviterType() == 2 && count == 1){ |
| | | Driver driver1 = driverService.selectById(appUser.getInviterId()); |
| | | SystemConfig systemConfig1 = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 4)); |
| | | JSONObject jsonObject2 = JSON.parseObject(systemConfig1.getContent()); |
| | | Integer num4 = jsonObject2.getInteger("num4"); |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(driver1.getId()); |
| | | accountChangeDetail.setType(2); |
| | | accountChangeDetail.setChangeType(5); |
| | | accountChangeDetail.setOrderId(order.getId()); |
| | | accountChangeDetail.setOldData(driver1.getIntegral().doubleValue()); |
| | | accountChangeDetail.setExplain("邀请用户首单积分奖励"); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | driver1.setIntegral(driver1.getIntegral() + num4); |
| | | accountChangeDetail.setNewData(driver1.getIntegral().doubleValue()); |
| | | accountChangeDetailService.insert(accountChangeDetail); |
| | | driverService.updateById(driver1); |
| | | } |
| | | |
| | | |
| | | |
| | | Double payMoney = order.getPayMoney();//todo 司机订单收入归并到佣金中一起提现 |
| | | SystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 3)); |
| | | if(null != systemConfig){ |
| | | JSONObject jsonObject = JSON.parseObject(systemConfig.getContent()); |
| | | Double num2 = jsonObject.getDouble("num2"); |
| | | Double num3 = jsonObject.getDouble("num3"); |
| | | if(order.getPayMoney() >= num2){ |
| | | if(order.getOrderMoney().compareTo(num2) >= 0){//订单金额大于num2开始分佣 |
| | | payMoney = payMoney - num3;//司机收入 |
| | | SystemConfig systemConfig1 = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 2)); |
| | | if(null != systemConfig1){ |
| | | JSONObject jsonObject1 = JSON.parseObject(systemConfig1.getContent()); |
| | | //司机推荐首单收入 |
| | | List<Integer> state = Arrays.asList(108, 109); |
| | | int count = this.selectCount(new EntityWrapper<Order>().eq("userId", appUser.getId()).eq("status", 1).in("state", state)); |
| | | if(null != appUser.getInviterType() && appUser.getInviterType() == 2 && count == 1){ |
| | | Double num1 = jsonObject1.getDouble("num1"); |
| | | num1 = (num3 >= num1 ? num1 : num3); |
| | |
| | | accountChangeDetail.setUserId(driver1.getId()); |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetail.setChangeType(5); |
| | | accountChangeDetail.setOldData(driver1.getBalance() + driver1.getBackgroundBalance() + driver1.getCouponBalance() + driver1.getCommission()); |
| | | accountChangeDetail.setExplain("订单分佣收入"); |
| | | accountChangeDetail.setOldData(driver1.getCouponBalance() + driver1.getCommission()); |
| | | accountChangeDetail.setExplain("邀请用户首单奖励"); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | driver1.setCommission(driver1.getCommission() + num1); |
| | | accountChangeDetail.setNewData(driver1.getBalance() + driver1.getBackgroundBalance() + driver1.getCouponBalance() + driver1.getCommission()); |
| | | accountChangeDetail.setNewData(driver1.getCouponBalance() + driver1.getCommission()); |
| | | driverService.updateById(driver1); |
| | | accountChangeDetailService.saveData(accountChangeDetail); |
| | | |
| | |
| | | } |
| | | |
| | | //开始处理层级抽佣 |
| | | if(null != driver & null != driver.getInviterType() && driver.getInviterType() == 2){ |
| | | if(num3 > 0 && null != driver & null != driver.getInviterType() && driver.getInviterType() == 2){ |
| | | Driver driver1 = driverService.selectById(driver.getInviterId());//一级司机 |
| | | if(null != driver1 && null != driver1.getInviterType() && driver1.getInviterType() == 2){ |
| | | Driver driver2 = driverService.selectById(driver1.getInviterId());//二级司机 |
| | |
| | | accountChangeDetail.setUserId(driver1.getId()); |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetail.setChangeType(5); |
| | | accountChangeDetail.setOldData(driver1.getBalance() + driver1.getBackgroundBalance() + driver1.getCouponBalance() + driver1.getCommission()); |
| | | accountChangeDetail.setOldData(driver1.getCouponBalance() + driver1.getCommission()); |
| | | accountChangeDetail.setExplain("订单分佣收入"); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | driver1.setCommission(driver1.getCommission() + num5); |
| | | accountChangeDetail.setNewData(driver1.getBalance() + driver1.getBackgroundBalance() + driver1.getCouponBalance() + driver1.getCommission()); |
| | | accountChangeDetail.setNewData(driver1.getCouponBalance() + driver1.getCommission()); |
| | | driverService.updateById(driver1); |
| | | accountChangeDetailService.saveData(accountChangeDetail); |
| | | |
| | |
| | | accountChangeDetail.setUserId(driver2.getId()); |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetail.setChangeType(5); |
| | | accountChangeDetail.setOldData(driver2.getBalance() + driver2.getBackgroundBalance() + driver2.getCouponBalance() + driver2.getCommission()); |
| | | accountChangeDetail.setOldData(driver2.getCouponBalance() + driver2.getCommission()); |
| | | accountChangeDetail.setExplain("订单分佣收入"); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | driver2.setCommission(driver2.getCommission() + num6); |
| | | accountChangeDetail.setNewData(driver2.getBalance() + driver2.getBackgroundBalance() + driver2.getCouponBalance() + driver2.getCommission()); |
| | | accountChangeDetail.setNewData(driver2.getCouponBalance() + driver2.getCommission()); |
| | | driverService.updateById(driver2); |
| | | accountChangeDetailService.saveData(accountChangeDetail); |
| | | |
| | |
| | | accountChangeDetail.setUserId(driver3.getId()); |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetail.setChangeType(5); |
| | | accountChangeDetail.setOldData(driver3.getBalance() + driver3.getBackgroundBalance() + driver3.getCouponBalance() + driver3.getCommission()); |
| | | accountChangeDetail.setOldData(driver3.getCouponBalance() + driver3.getCommission()); |
| | | accountChangeDetail.setExplain("订单分佣收入"); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | driver3.setCommission(driver3.getCommission() + num7); |
| | | accountChangeDetail.setNewData(driver3.getBalance() + driver3.getBackgroundBalance() + driver3.getCouponBalance() + driver3.getCommission()); |
| | | accountChangeDetail.setNewData(driver3.getCouponBalance() + driver3.getCommission()); |
| | | driverService.updateById(driver3); |
| | | accountChangeDetailService.saveData(accountChangeDetail); |
| | | |
| | |
| | | accountChangeDetail.setUserId(driver1.getId()); |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetail.setChangeType(5); |
| | | accountChangeDetail.setOldData(driver1.getBalance() + driver1.getBackgroundBalance() + driver1.getCouponBalance() + driver1.getCommission()); |
| | | accountChangeDetail.setOldData(driver1.getCouponBalance() + driver1.getCommission()); |
| | | accountChangeDetail.setExplain("订单分佣收入"); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | driver1.setCommission(driver1.getCommission() + num3_); |
| | | accountChangeDetail.setNewData(driver1.getBalance() + driver1.getBackgroundBalance() + driver1.getCouponBalance() + driver1.getCommission()); |
| | | accountChangeDetail.setNewData(driver1.getCouponBalance() + driver1.getCommission()); |
| | | driverService.updateById(driver1); |
| | | accountChangeDetailService.saveData(accountChangeDetail); |
| | | |
| | |
| | | accountChangeDetail.setUserId(driver2.getId()); |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetail.setChangeType(5); |
| | | accountChangeDetail.setOldData(driver2.getBalance() + driver2.getBackgroundBalance() + driver2.getCouponBalance() + driver2.getCommission()); |
| | | accountChangeDetail.setOldData(driver2.getCouponBalance() + driver2.getCommission()); |
| | | accountChangeDetail.setExplain("订单分佣收入"); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | driver2.setCommission(driver2.getCommission() + num4); |
| | | accountChangeDetail.setNewData(driver2.getBalance() + driver2.getBackgroundBalance() + driver2.getCouponBalance() + driver2.getCommission()); |
| | | accountChangeDetail.setNewData(driver2.getCouponBalance() + driver2.getCommission()); |
| | | driverService.updateById(driver2); |
| | | accountChangeDetailService.saveData(accountChangeDetail); |
| | | |
| | |
| | | accountChangeDetail.setUserId(driver1.getId()); |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetail.setChangeType(5); |
| | | accountChangeDetail.setOldData(driver1.getBalance() + driver1.getBackgroundBalance() + driver1.getCouponBalance() + driver1.getCommission()); |
| | | accountChangeDetail.setOldData(driver1.getCouponBalance() + driver1.getCommission()); |
| | | accountChangeDetail.setExplain("订单分佣收入"); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | driver1.setCommission(driver1.getCommission() + num2_); |
| | | accountChangeDetail.setNewData(driver1.getBalance() + driver1.getBackgroundBalance() + driver1.getCouponBalance() + driver1.getCommission()); |
| | | accountChangeDetail.setNewData(driver1.getCouponBalance() + driver1.getCommission()); |
| | | driverService.updateById(driver1); |
| | | accountChangeDetailService.saveData(accountChangeDetail); |
| | | |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | driver = driverService.selectById(order.getDriverId()); |
| | | //司机订单收入 |
| | | Revenue revenue = new Revenue(); |
| | | revenue.setType(1); |
| | |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetail.setChangeType(1); |
| | | accountChangeDetail.setOrderId(order.getId()); |
| | | accountChangeDetail.setOldData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission()); |
| | | accountChangeDetail.setOldData(driver.getCouponBalance() + driver.getCommission()); |
| | | driver.setCommission(driver.getCommission() + payMoney); |
| | | accountChangeDetail.setExplain("订单收入"); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | if(null != order.getCouponId()){ |
| | |
| | | |
| | | } |
| | | if(null != order.getDiscountAmount() && 0 < order.getDiscountAmount()){ |
| | | accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(order.getDriverId()); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | accountChangeDetail.setOldData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission()); |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetail.setChangeType(7); |
| | | accountChangeDetail.setOrderId(order.getId()); |
| | | accountChangeDetail.setExplain("折扣优惠收入"); |
| | | driver.setCommission(driver.getCommission() + order.getDiscountAmount()); |
| | | accountChangeDetail.setNewData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission()); |
| | | driverService.updateById(driver); |
| | | accountChangeDetailService.insert(accountChangeDetail); |
| | | //补贴中分账 |
| | | Double discountedPrice = order.getDiscountAmount(); |
| | | List<RechargeRecord> rechargeRecords = rechargeRecordService.selectList(new EntityWrapper<RechargeRecord>().eq("type", 4).eq("payStatus", 2).gt("surplusDividedAmount", 0).orderBy("createTime")); |
| | |
| | | } |
| | | } |
| | | } |
| | | accountChangeDetail.setNewData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission()); |
| | | accountChangeDetail.setNewData(driver.getCouponBalance() + driver.getCommission()); |
| | | driverService.updateById(driver); |
| | | accountChangeDetailService.saveData(accountChangeDetail); |
| | | |
| | |
| | | Double surplusDividedAmount = rechargeRecord.getSurplusDividedAmount(); |
| | | if(surplusDividedAmount.compareTo(payMoney) >= 0){ |
| | | //分账司机收入 |
| | | ResultUtil fengzhang = fengzhang(1, driver.getId(), driver.getMerchantNumber(), order.getId().longValue(), order.getOrderNo(), payMoney, 1); |
| | | ResultUtil fengzhang = fengzhang(1, driver.getId(), driver.getMerchantNumber(), order.getId().longValue(), rechargeRecord.getOrderNumber(), payMoney, 1); |
| | | if(10000 == fengzhang.getCode()){ |
| | | rechargeRecord.setSurplusDividedAmount(rechargeRecord.getSurplusDividedAmount() - payMoney); |
| | | rechargeRecordService.updateById(rechargeRecord); |
| | | } |
| | | break; |
| | | }else{ |
| | | ResultUtil fengzhang = fengzhang(1, driver.getId(), driver.getMerchantNumber(), order.getId().longValue(), order.getOrderNo(), surplusDividedAmount, 1); |
| | | ResultUtil fengzhang = fengzhang(1, driver.getId(), driver.getMerchantNumber(), order.getId().longValue(), rechargeRecord.getOrderNumber(), surplusDividedAmount, 1); |
| | | if(10000 == fengzhang.getCode()){ |
| | | rechargeRecord.setSurplusDividedAmount(0D); |
| | | rechargeRecordService.updateById(rechargeRecord); |
| | |
| | | Double surplusDividedAmount = rechargeRecord.getSurplusDividedAmount(); |
| | | if(surplusDividedAmount.compareTo(money) >= 0){ |
| | | //分账司机收入 |
| | | ResultUtil fengzhang = fengzhang(3, null, "553021440975", order.getId().longValue(), order.getOrderNo(), money, 1); |
| | | ResultUtil fengzhang = fengzhang(3, null, "553021440975", order.getId().longValue(), rechargeRecord.getOrderNumber(), money, 1); |
| | | if(10000 == fengzhang.getCode()){ |
| | | rechargeRecord.setSurplusDividedAmount(rechargeRecord.getSurplusDividedAmount() - money); |
| | | rechargeRecordService.updateById(rechargeRecord); |
| | | } |
| | | break; |
| | | }else{ |
| | | ResultUtil fengzhang = fengzhang(3, null, "553021440975", order.getId().longValue(), order.getOrderNo(), surplusDividedAmount, 1); |
| | | ResultUtil fengzhang = fengzhang(3, null, "553021440975", order.getId().longValue(), rechargeRecord.getOrderNumber(), surplusDividedAmount, 1); |
| | | if(10000 == fengzhang.getCode()){ |
| | | rechargeRecord.setSurplusDividedAmount(0D); |
| | | rechargeRecordService.updateById(rechargeRecord); |
| | |
| | | Double surplusDividedAmount = rechargeRecord.getSurplusDividedAmount(); |
| | | if(surplusDividedAmount.compareTo(balancePayment) >= 0){ |
| | | //分账司机收入 |
| | | ResultUtil fengzhang = fengzhang(1, driver.getId(), driver.getMerchantNumber(), order.getId().longValue(), order.getOrderNo(), balancePayment, 1); |
| | | ResultUtil fengzhang = fengzhang(1, driver.getId(), driver.getMerchantNumber(), order.getId().longValue(), rechargeRecord.getOrderNumber(), balancePayment, 1); |
| | | if(10000 == fengzhang.getCode()){ |
| | | rechargeRecord.setSurplusDividedAmount(rechargeRecord.getSurplusDividedAmount() - balancePayment); |
| | | rechargeRecordService.updateById(rechargeRecord); |
| | | } |
| | | break; |
| | | }else{ |
| | | ResultUtil fengzhang = fengzhang(1, driver.getId(), driver.getMerchantNumber(), order.getId().longValue(), order.getOrderNo(), surplusDividedAmount, 1); |
| | | ResultUtil fengzhang = fengzhang(1, driver.getId(), driver.getMerchantNumber(), order.getId().longValue(), rechargeRecord.getOrderNumber(), surplusDividedAmount, 1); |
| | | if(10000 == fengzhang.getCode()){ |
| | | rechargeRecord.setSurplusDividedAmount(0D); |
| | | rechargeRecordService.updateById(rechargeRecord); |
| | |
| | | Double surplusDividedAmount = rechargeRecord.getSurplusDividedAmount(); |
| | | if(surplusDividedAmount.compareTo(money) >= 0){ |
| | | //分账司机收入 |
| | | ResultUtil fengzhang = fengzhang(3, null, "553021440975", order.getId().longValue(), order.getOrderNo(), money, 1); |
| | | ResultUtil fengzhang = fengzhang(3, null, "553021440975", order.getId().longValue(), rechargeRecord.getOrderNumber(), money, 1); |
| | | if(10000 == fengzhang.getCode()){ |
| | | rechargeRecord.setSurplusDividedAmount(rechargeRecord.getSurplusDividedAmount() - money); |
| | | rechargeRecordService.updateById(rechargeRecord); |
| | | } |
| | | break; |
| | | }else{ |
| | | ResultUtil fengzhang = fengzhang(3, null, "553021440975", order.getId().longValue(), order.getOrderNo(), surplusDividedAmount, 1); |
| | | ResultUtil fengzhang = fengzhang(3, null, "553021440975", order.getId().longValue(), rechargeRecord.getOrderNumber(), surplusDividedAmount, 1); |
| | | if(10000 == fengzhang.getCode()){ |
| | | rechargeRecord.setSurplusDividedAmount(0D); |
| | | rechargeRecordService.updateById(rechargeRecord); |
| | |
| | | List<PamentOrderUser> splitList = new ArrayList<>(); |
| | | PamentOrderUser pamentOrderUser = new PamentOrderUser(); |
| | | pamentOrderUser.setSplitUserId(merchantNumber); |
| | | pamentOrderUser.setSplitAmount(amount.toString()); |
| | | pamentOrderUser.setSplitAmount(String.valueOf(Double.valueOf(amount * 100).intValue())); |
| | | pamentOrderUser.setSplitType("1"); |
| | | splitList.add(pamentOrderUser); |
| | | complete.setSplitList(splitList); |
| | |
| | | Receive receive = new Receive(); |
| | | receive.setOriginalMerOrderId(orderNumber); |
| | | receive.setAsynMerOrderId(divisionRecord.getMerOrderId()); |
| | | receive.setRcvAmount(divisionRecord.getAmount().toString()); |
| | | receive.setRcvAmount(String.valueOf(Double.valueOf(divisionRecord.getAmount() * 100).intValue())); |
| | | List<ReceiveUser> splitList = new ArrayList<>(); |
| | | ReceiveUser receiveUser = new ReceiveUser(); |
| | | receiveUser.setSplitUserId(merchantNumber); |
| | | receiveUser.setRcvSplitAmount(divisionRecord.getAmount().toString()); |
| | | receiveUser.setRcvSplitAmount(String.valueOf(Double.valueOf(divisionRecord.getAmount() * 100).intValue())); |
| | | splitList.add(receiveUser); |
| | | receive.setSplitList(splitList); |
| | | TrhRequest<Receive> request = new TrhRequest(); |
| | |
| | | Transfer transfer = new Transfer(); |
| | | transfer.setDepositMerOrderId(merOrderId); |
| | | transfer.setToUserId(toUserId); |
| | | transfer.setAmount(String.valueOf(Double.valueOf(amount * 100))); |
| | | transfer.setAmount(String.valueOf(Double.valueOf(amount * 100).intValue())); |
| | | transfer.setOrderName("补贴"); |
| | | transfer.setNotifyUrl(notifyUrl); |
| | | transfer.setParameter1(id.toString()); |