From ef04ce57881e6a338b10d596c5eb76b2220598bf Mon Sep 17 00:00:00 2001 From: puzhibing <393733352@qq.com> Date: 星期四, 31 八月 2023 11:16:49 +0800 Subject: [PATCH] 更新版本 --- user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/impl/OrderServiceImpl.java | 250 +++++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 205 insertions(+), 45 deletions(-) diff --git a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/impl/OrderServiceImpl.java b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/impl/OrderServiceImpl.java index fc8927c..b7cb35f 100644 --- a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/impl/OrderServiceImpl.java +++ b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/impl/OrderServiceImpl.java @@ -33,6 +33,7 @@ import org.springframework.data.mongodb.core.query.Query; import org.springframework.stereotype.Service; +import javax.annotation.Resource; import java.math.BigDecimal; import java.math.MathContext; import java.math.RoundingMode; @@ -112,6 +113,15 @@ @Autowired private IRechargeRecordService rechargeRecordService; + @Autowired + private IOrderService orderService; + + @Resource + private ICompanyFundFlowService companyFundFlowService; + + @Autowired + private IBranchOfficeService branchOfficeService; + @Value("${wx.appletsAppid}") private String appletsAppid; @@ -144,15 +154,28 @@ estimatedCostsWarpper.setTravelTime(Integer.valueOf(distance.get("duration")) / 60); } String city = ""; + Integer branchOfficeId = null; District geocode = MapUtil.geocode(estimatedCosts.getStartLng().toString(), estimatedCosts.getStartLat().toString()); if(null != geocode){ - WeatherCity weatherCity = weatherCityService.selectOne(new EntityWrapper<WeatherCity>() - .where("'" + geocode.getCity() + "' like CONCAT('%', city, '%') and '" + geocode.getDistrict() + "' like CONCAT('%', district, '%') ")); - city = null != weatherCity ? weatherCity.getId().toString() : ""; + String districtCode = geocode.getDistrictCode(); + BranchOffice branchOffice = branchOfficeService.selectOne(new EntityWrapper<BranchOffice>().eq("status", 1).eq("districtCode", districtCode)); + if(null == branchOffice){ + String cityCode = geocode.getCityCode(); + branchOffice = branchOfficeService.selectOne(new EntityWrapper<BranchOffice>().eq("status", 1).eq("cityCode", cityCode)); + if(null == branchOffice){ + String provinceCode = geocode.getProvinceCode(); + branchOffice = branchOfficeService.selectOne(new EntityWrapper<BranchOffice>().eq("status", 1).eq("provinceCode", provinceCode)); + } + } + if(null == branchOffice){ + return ResultUtil.error("起点暂无企业服务"); + } + branchOfficeId = branchOffice.getId(); } + Order order1 = new Order(); order1.setCreateTime(new Date()); - Order order = getOrderPrice(1, d, 0, order1, city); + Order order = getOrderPrice(1, d, 0, order1, city, branchOfficeId); Double estimatedPrice = order.getEstimatedPrice(); Coupon coupon = userToCouponService.queryCoupon(uid, estimatedPrice); if(null != coupon){ @@ -167,7 +190,7 @@ int i = 0; Double scope = 5D; while (true){ - List<NearbyDriverWarpper> nearbyDriverWarppers = driverService.queryDriverPosition(estimatedCosts.getLng().toString(), estimatedCosts.getLat().toString(), scope); + List<NearbyDriverWarpper> nearbyDriverWarppers = driverService.queryDriverPosition(estimatedCosts.getStartLng().toString(), estimatedCosts.getStartLat().toString(), scope); if(nearbyDriverWarppers.size() == 0){ scope += 5; i++; @@ -205,9 +228,9 @@ * @param city 查询天气的城市 * @return */ - public Order getOrderPrice(Integer type, Double distance, Integer waitTime, Order order, String city){ + public Order getOrderPrice(Integer type, Double distance, Integer waitTime, Order order, String city, Integer branchOfficeId){ order = getOrderInitialPrice(order); - SystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 5)); + SystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 5).eq("companyId", branchOfficeId)); if(null == systemConfig){ if(type == 1){//预估金额 order.setEstimatedPrice(0D); @@ -308,6 +331,7 @@ Double num7 = extraCost.getDouble("num7");//恶劣天气超出公里 Double num8 = extraCost.getDouble("num8");//恶劣天气超出公里单价 X/公里 Double num9 = extraCost.getDouble("num9");//恶劣天气最高收取金额 + Double num10 = extraCost.getDouble("num10");//节假日收费 //等待费用 if(waitTime.compareTo(num1 * 60) >= 0){ @@ -321,40 +345,41 @@ } //恶劣天气 - systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 8)); + systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 8).eq("companyId", branchOfficeId)); if(null != systemConfig){ JSONObject jsonObject1 = JSON.parseObject(systemConfig.getContent()); Integer num11 = jsonObject1.getInteger("num1");//开启恶劣天气计价 + Integer num31 = jsonObject1.getInteger("num3"); if(1 == num11){ - boolean badWeather = WeatherUtil.isBadWeather(city); - if(badWeather){ - order.setBadWeatherDistance(num5);//恶劣天气公里 - order.setBadWeatherPrice(num6);//恶劣天气费 - if(distance.compareTo(num7) > 0){ - BigDecimal subtract = new BigDecimal(distance).subtract(new BigDecimal(num7)); - BigDecimal multiply = subtract.multiply(new BigDecimal(num8)); - order.setOverBadWeatherDistance(subtract.doubleValue());//恶劣天气超出公里 - order.setOverBadWeatherPrice(multiply.doubleValue());//恶劣天气超出公里费 - } + order.setBadWeatherDistance(num5);//恶劣天气公里 + order.setBadWeatherPrice(num6);//恶劣天气费 + if(distance.compareTo(num7) > 0){ + BigDecimal subtract = new BigDecimal(distance).subtract(new BigDecimal(num7)); + BigDecimal multiply = subtract.multiply(new BigDecimal(num8)); + order.setOverBadWeatherDistance(subtract.doubleValue());//恶劣天气超出公里 + order.setOverBadWeatherPrice(multiply.doubleValue());//恶劣天气超出公里费 + } - double add = new BigDecimal(order.getOverBadWeatherPrice()).add(new BigDecimal(order.getBadWeatherPrice())).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); - if(num9.compareTo(add) < 0){//超出最高金额(重新调整金额) - if(num9.compareTo(num6) < 0){//如果恶劣天气费大于最高金额 - order.setBadWeatherPrice(num9);//恶劣天气费 - order.setOverBadWeatherPrice(0D);//恶劣天气超出公里费 - }else{ - BigDecimal subtract = new BigDecimal(num9).subtract(new BigDecimal(add)); - order.setOverBadWeatherPrice(subtract.doubleValue());//恶劣天气超出公里费 - } + double add = new BigDecimal(order.getOverBadWeatherPrice()).add(new BigDecimal(order.getBadWeatherPrice())).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); + if(num9.compareTo(add) < 0){//超出最高金额(重新调整金额) + if(num9.compareTo(num6) < 0){//如果恶劣天气费大于最高金额 + order.setBadWeatherPrice(num9);//恶劣天气费 + order.setOverBadWeatherPrice(0D);//恶劣天气超出公里费 + }else{ + BigDecimal subtract = new BigDecimal(num9).subtract(new BigDecimal(add)); + order.setOverBadWeatherPrice(subtract.doubleValue());//恶劣天气超出公里费 } } + } + if(1 == num31){//节假日 + order.setHolidayPrice(num10); } } //计算总金额 BigDecimal bigDecimal = new BigDecimal(order.getStartPrice() + order.getOverDrivePrice() + order.getLongDistancePrice() + order.getOverLongDistancePrice() + - order.getWaitTimePrice() + order.getOutWaitTimePrice() + order.getBadWeatherPrice() + order.getOverBadWeatherPrice() - order.getDiscountAmount()).setScale(2, BigDecimal.ROUND_HALF_EVEN); + order.getWaitTimePrice() + order.getOutWaitTimePrice() + order.getBadWeatherPrice() + order.getOverBadWeatherPrice()+order.getHolidayPrice() - order.getDiscountAmount()).setScale(2, BigDecimal.ROUND_HALF_EVEN); if(type == 1){//预估价 order.setEstimatedPrice(bigDecimal.doubleValue()); @@ -389,10 +414,12 @@ order.setBadWeatherPrice(0D);//恶劣天气里程费 order.setOverBadWeatherDistance(0D);//恶劣天气超出里程 order.setOverBadWeatherPrice(0D);//恶劣天气超出里程费 + order.setHolidayPrice(0D);//节假日 order.setDiscountedPrice(0D);//优惠金额 order.setCouponId(null);//优惠券 order.setDiscountAmount(0D);//折扣优惠金额 order.setDiscount(0D);//折扣 + order.setHolidayPrice(0D); return order; } @@ -451,14 +478,27 @@ order.setEstimatedTime(Integer.valueOf(distance.get("duration")) / 60); } String city = ""; - District geocode = MapUtil.geocode(order.getStartLng(), order.getStartLat()); + Integer branchOfficeId = null; + District geocode = MapUtil.geocode(order.getStartLng().toString(), order.getStartLat().toString()); if(null != geocode){ - WeatherCity weatherCity = weatherCityService.selectOne(new EntityWrapper<WeatherCity>() - .where("'" + geocode.getCity() + "' like CONCAT('%', city, '%') and '" + geocode.getDistrict() + "' like CONCAT('%', district, '%') ")); - city = null != weatherCity ? weatherCity.getId().toString() : ""; + String districtCode = geocode.getDistrictCode(); + BranchOffice branchOffice = branchOfficeService.selectOne(new EntityWrapper<BranchOffice>().eq("status", 1).eq("districtCode", districtCode)); + if(null == branchOffice){ + String cityCode = geocode.getCityCode(); + branchOffice = branchOfficeService.selectOne(new EntityWrapper<BranchOffice>().eq("status", 1).eq("cityCode", cityCode)); + if(null == branchOffice){ + String provinceCode = geocode.getProvinceCode(); + branchOffice = branchOfficeService.selectOne(new EntityWrapper<BranchOffice>().eq("status", 1).eq("provinceCode", provinceCode)); + } + } + if(null == branchOffice){ + return ResultUtil.error("起点暂无企业服务"); + } + branchOfficeId = branchOffice.getId(); } + order.setCreateTime(new Date()); - order = getOrderPrice(1, d, 0, order, city); + order = getOrderPrice(1, d, 0, order, city, branchOfficeId); if(null != travelOrder.getDriverId()){ DriverWork driverWork = driverWorkService.selectOne(new EntityWrapper<DriverWork>().eq("driverId", travelOrder.getDriverId()).eq("status", 1)); if(null == driverWork){ @@ -498,6 +538,7 @@ } } } + redisUtil.setStrValue("newOrder", "true"); return ResultUtil.success(order.getId()); } @@ -571,7 +612,8 @@ continue; } Driver driver1 = driverService.selectById(youTuiDriver.getDriverId()); - if(driver1.getServerStatus() == 2 || driver1.getOpenOrderQRCode() == 1){ + int count = orderService.selectCount(new EntityWrapper<Order>().eq("driverId", youTuiDriver.getDriverId()).eq("status", 1).in("state", Arrays.asList(102, 103, 104, 105, 201, 401))); + if(driver1.getServerStatus() == 2 || driver1.getOpenOrderQRCode() == 1 || count > 0){ continue; } DriverWork driverWork = driverWorkService.selectOne(new EntityWrapper<DriverWork>().eq("driverId", driver1.getId()).eq("status", 1)); @@ -625,6 +667,10 @@ } DriverWork driverWork = driverWorkService.selectOne(new EntityWrapper<DriverWork>().eq("driverId", driver1.getId()).eq("status", 1)); if(null == driverWork){ + continue; + } + int count = orderService.selectCount(new EntityWrapper<Order>().eq("driverId", driver1.getId()).eq("status", 1).in("state", Arrays.asList(102, 103, 104, 105, 201, 401))); + if(count > 0){ continue; } @@ -687,6 +733,7 @@ order1.setHallOrder(1); OrderServiceImpl.this.updateById(order1); ExtraPushOrder(order); + redisUtil.setStrValue("lobbyOrder", "true"); } } }, num4 * 1000); @@ -694,6 +741,7 @@ order.setHallOrder(1); this.updateById(order); ExtraPushOrder(order); + redisUtil.setStrValue("lobbyOrder", "true"); } redisUtil.unlock(); }catch (Exception e){ @@ -783,8 +831,10 @@ PushOrderInfoWarpper pushOrderInfoWarpper = new PushOrderInfoWarpper(); pushOrderInfoWarpper.setId(order.getId()); pushOrderInfoWarpper.setState(order.getState()); + pushOrderInfoWarpper.setCancelObject(1); pushUtil.pushOrderInfo(order.getDriverId(), 2, pushOrderInfoWarpper); } + redisUtil.setStrValue("cancelOrder", "true"); return ResultUtil.success(); } @@ -824,6 +874,12 @@ @Override public ResultUtil editOrderEndAddress(Integer uid, EditOrderEndAddress editOrderEndAddress) throws Exception { Order order = this.selectById(editOrderEndAddress.getOrderId()); + + String endAddress = editOrderEndAddress.getEndAddress(); + endAddress = endAddress.replaceAll("& #40;", "("); + endAddress = endAddress.replaceAll("& #41;", ")"); + editOrderEndAddress.setEndAddress(endAddress); + order.setEndAddress(editOrderEndAddress.getEndAddress()); order.setEndLat(editOrderEndAddress.getEndLat().toString()); order.setEndLng(editOrderEndAddress.getEndLng().toString()); @@ -839,15 +895,27 @@ order.setEstimatedTime(Integer.valueOf(distance.get("duration")) / 60); } String city = ""; + Integer branchOfficeId = null; District geocode = MapUtil.geocode(order.getStartLng().toString(), order.getStartLat().toString()); if(null != geocode){ - WeatherCity weatherCity = weatherCityService.selectOne(new EntityWrapper<WeatherCity>() - .where("'" + geocode.getCity() + "' like CONCAT('%', city, '%') and '" + geocode.getDistrict() + "' like CONCAT('%', district, '%') ")); - city = null != weatherCity ? weatherCity.getId().toString() : ""; + String districtCode = geocode.getDistrictCode(); + BranchOffice branchOffice = branchOfficeService.selectOne(new EntityWrapper<BranchOffice>().eq("status", 1).eq("districtCode", districtCode)); + if(null == branchOffice){ + String cityCode = geocode.getCityCode(); + branchOffice = branchOfficeService.selectOne(new EntityWrapper<BranchOffice>().eq("status", 1).eq("cityCode", cityCode)); + if(null == branchOffice){ + String provinceCode = geocode.getProvinceCode(); + branchOffice = branchOfficeService.selectOne(new EntityWrapper<BranchOffice>().eq("status", 1).eq("provinceCode", provinceCode)); + } + } + if(null == branchOffice){ + return ResultUtil.error("起点暂无企业服务"); + } + branchOfficeId = branchOffice.getId(); } Order order1 = new Order(); BeanUtils.copyProperties(order, order1); - Order orderPrice = getOrderPrice(1, d, 0, order1, city); + Order orderPrice = getOrderPrice(1, d, 0, order1, city, branchOfficeId); order.setEstimatedPrice(orderPrice.getEstimatedPrice()); this.updateById(order); @@ -893,12 +961,15 @@ orderPriceWarpper.setWaitTime((m < 10 ? "0" + m : m) + ":" + (s < 10 ? "0" + s : s)); orderPriceWarpper.setWaitTimePrice(order.getWaitTimePrice() + order.getOutWaitTimePrice()); orderPriceWarpper.setDiscountAmount(order.getDiscountAmount()); + orderPriceWarpper.setCouponId(order.getCouponId()); orderPriceWarpper.setDiscountedPrice(order.getDiscountedPrice()); orderPriceWarpper.setBadWeatherPrice(order.getBadWeatherPrice()); orderPriceWarpper.setPayMoney(order.getPayMoney()); + orderPriceWarpper.setOrderMoney(order.getOrderMoney()); if(order.getState() < 107){ orderPriceWarpper.setPayMoney(order.getOrderMoney()); } + orderPriceWarpper.setHolidayPrice(order.getHolidayPrice()); return orderPriceWarpper; } @@ -936,9 +1007,9 @@ orderPriceWarpper.setCouponId(coupon.getId()); } if(payType == 1 && null == couponId && appUser.getHavDiscount() == 1 && balance.compareTo(orderMoney) >= 0){//使用余额抵扣 - orderPriceWarpper.setDiscount(9D); - 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(); + orderPriceWarpper.setDiscount(9.5D); + orderPriceWarpper.setDiscountAmount(new BigDecimal(orderMoney * 0.05).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); + orderMoney = new BigDecimal(orderMoney * 0.95).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); } if(null != couponId){ UserToCoupon userToCoupon = userToCouponService.selectById(couponId); @@ -1473,6 +1544,7 @@ accountChangeDetailService.saveData(accountChangeDetail); //补贴中分账 + Double balance = revenueService.queryCompanyBalance();//平台账户余额 Double discountedPrice = order.getDiscountedPrice(); List<RechargeRecord> rechargeRecords = rechargeRecordService.selectList(new EntityWrapper<RechargeRecord>().eq("type", 4).eq("payStatus", 2).gt("surplusDividedAmount", 0).orderBy("createTime")); for (RechargeRecord rechargeRecord : rechargeRecords) { @@ -1498,6 +1570,14 @@ } } + CompanyFundFlow companyFundFlow = new CompanyFundFlow(); + companyFundFlow.setBalance(new BigDecimal(balance)); + companyFundFlow.setObjectType(1); + companyFundFlow.setDriverId(driver.getId()); + companyFundFlow.setType(5); + companyFundFlow.setMoney(new BigDecimal(order.getDiscountedPrice())); + companyFundFlow.setCreateTime(new Date()); + companyFundFlowService.insert(companyFundFlow); } } @@ -1543,6 +1623,7 @@ JSONObject jsonObject = JSON.parseObject(systemConfig.getContent()); Double num2 = jsonObject.getDouble("num2"); Double num3 = jsonObject.getDouble("num3"); + Double num4_ = jsonObject.getDouble("num4"); if(order.getOrderMoney().compareTo(num2) >= 0){//订单金额大于num2开始分佣 AccountChangeDetail accountChangeDetail1 = new AccountChangeDetail(); accountChangeDetail1.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(5)); @@ -1944,10 +2025,60 @@ } } } - //处理代理商抽佣 - if(num3 > 0 && null != driver){ + //处理平台抽佣 + if(num4_ > 0){ + //先平台抽佣 + num4_ = (num3 >= num4_ ? num4_ : num3); Revenue revenue = new Revenue(); - revenue.setType(1); + revenue.setType(2); + revenue.setUserType(4); + revenue.setUserId(driver.getAgentId()); + revenue.setOrderId(order.getId()); + revenue.setAmount(num4_); + revenue.setCreateTime(new Date()); + revenueService.insert(revenue); + //司机充值记录分账 + Double num4_1 = num4_; + List<RechargeRecord> rechargeRecords = rechargeRecordService.selectList(new EntityWrapper<RechargeRecord>().eq("type", 2).eq("userId", driver.getId()).eq("payStatus", 2).gt("surplusDividedAmount", 0).orderBy("createTime")); + for (RechargeRecord rechargeRecord : rechargeRecords) { + Double surplusDividedAmount = rechargeRecord.getSurplusDividedAmount(); + if(surplusDividedAmount.compareTo(num4_1) >= 0){ + ResultUtil fengzhang = fengzhang(3, null, "553021440975", order.getId().longValue(), rechargeRecord.getId(), rechargeRecord.getOrderNumber(), num4_1, 3); + if(10000 == fengzhang.getCode()){ + rechargeRecord.setSurplusDividedAmount(new BigDecimal(rechargeRecord.getSurplusDividedAmount()).subtract(new BigDecimal(num4_1)).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); + rechargeRecordService.updateById(rechargeRecord); + } + break; + }else{ + ResultUtil fengzhang = fengzhang(3, null, "553021440975", order.getId().longValue(), rechargeRecord.getId(), rechargeRecord.getOrderNumber(), surplusDividedAmount, 3); + if(10000 == fengzhang.getCode()){ + rechargeRecord.setSurplusDividedAmount(0D); + rechargeRecordService.updateById(rechargeRecord); + num4_1 = new BigDecimal(num4_1).subtract(new BigDecimal(surplusDividedAmount)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); + }else{ + break; + } + } + } + Double balance = revenueService.queryAgentBalance(driver.getAgentId()); + //记录企业流水 + CompanyFundFlow companyFundFlow = new CompanyFundFlow(); + companyFundFlow.setType(3); + companyFundFlow.setObjectType(1); + companyFundFlow.setObjectId(null); + companyFundFlow.setBalance(new BigDecimal(balance)); + companyFundFlow.setMoney(new BigDecimal(num4_)); + companyFundFlow.setCreateTime(new Date()); + companyFundFlowService.insert(companyFundFlow); + double v = new BigDecimal(num3).subtract(new BigDecimal(num4_)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); + num3 = (num3 >= num4_ ? v : 0); + } + + //代理商分佣 + if(num3 > 0 && null != driver){ + Double balance = revenueService.queryAgentBalance(driver.getAgentId()); + Revenue revenue = new Revenue(); + revenue.setType(2); revenue.setUserType(3); revenue.setUserId(driver.getAgentId()); revenue.setOrderId(order.getId()); @@ -1979,6 +2110,16 @@ } } } + + //记录企业流水 + CompanyFundFlow companyFundFlow = new CompanyFundFlow(); + companyFundFlow.setType(3); + companyFundFlow.setObjectType(2); + companyFundFlow.setObjectId(driver.getAgentId()); + companyFundFlow.setBalance(new BigDecimal(balance)); + companyFundFlow.setMoney(new BigDecimal(num3)); + companyFundFlow.setCreateTime(new Date()); + companyFundFlowService.insert(companyFundFlow); } } } @@ -2003,7 +2144,7 @@ revenue.setUserType(2); revenue.setUserId(driver.getId()); revenue.setOrderId(order.getId()); - revenue.setAmount(order.getPayMoney() + order.getDiscountedPrice() + order.getDiscountAmount()); + revenue.setAmount(order.getPayMoney() + order.getDiscountedPrice());//todo 折扣司机承担 revenue.setCreateTime(new Date()); revenueService.insert(revenue); @@ -2064,6 +2205,7 @@ accountChangeDetailService.saveData(accountChangeDetail); //补贴中分账 + Double balance = revenueService.queryCompanyBalance(); Double discountedPrice = order.getDiscountedPrice(); List<RechargeRecord> rechargeRecords1 = rechargeRecordService.selectList(new EntityWrapper<RechargeRecord>().eq("type", 4).eq("payStatus", 2).gt("surplusDividedAmount", 0).orderBy("createTime")); for (RechargeRecord rechargeRecord : rechargeRecords1) { @@ -2088,6 +2230,14 @@ } } } + CompanyFundFlow companyFundFlow = new CompanyFundFlow(); + companyFundFlow.setBalance(new BigDecimal(balance)); + companyFundFlow.setObjectType(1); + companyFundFlow.setDriverId(driver.getId()); + companyFundFlow.setType(5); + companyFundFlow.setMoney(new BigDecimal(order.getDiscountedPrice())); + companyFundFlow.setCreateTime(new Date()); + companyFundFlowService.insert(companyFundFlow); } // TODO: 2023/6/25 折扣优惠由司机承担 @@ -2228,6 +2378,7 @@ driverService.updateById(driver); accountChangeDetailService.saveData(accountChangeDetail); //补贴中分账 + Double balance = revenueService.queryCompanyBalance(); Double discountedPrice = order.getDiscountedPrice(); List<RechargeRecord> rechargeRecords = rechargeRecordService.selectList(new EntityWrapper<RechargeRecord>().eq("type", 4).eq("payStatus", 2).gt("surplusDividedAmount", 0).orderBy("createTime")); for (RechargeRecord rechargeRecord : rechargeRecords) { @@ -2253,6 +2404,15 @@ } } + CompanyFundFlow companyFundFlow = new CompanyFundFlow(); + companyFundFlow.setBalance(new BigDecimal(balance)); + companyFundFlow.setObjectType(1); + companyFundFlow.setDriverId(driver.getId()); + companyFundFlow.setType(5); + companyFundFlow.setMoney(new BigDecimal(order.getDiscountedPrice())); + companyFundFlow.setCreateTime(new Date()); + companyFundFlowService.insert(companyFundFlow); + } } -- Gitblit v1.7.1