From 782862750392a4428c40d6407b509aa015a5aa7d Mon Sep 17 00:00:00 2001 From: xuhy <3313886187@qq.com> Date: 星期一, 15 九月 2025 17:35:21 +0800 Subject: [PATCH] 修改 --- ManagementZYTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/TIncomeController.java | 77 +++++++++++++++++++++++++++++++------- 1 files changed, 62 insertions(+), 15 deletions(-) diff --git a/ManagementZYTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/TIncomeController.java b/ManagementZYTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/TIncomeController.java index bf91ce1..67da92a 100644 --- a/ManagementZYTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/TIncomeController.java +++ b/ManagementZYTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/TIncomeController.java @@ -140,7 +140,6 @@ tPubTransactionDetails.setOrderType(7); break; } - pubTransactionDetailsService.insert(tPubTransactionDetails); // type=1增加 type=2减少 switch (type){ case 1: @@ -148,22 +147,27 @@ BigDecimal add = tDriver.getBalance().add(bigDecimal); tDriver.setBalance(add); + BigDecimal laveBusinessMoney = new BigDecimal(tDriver.getLaveBusinessMoney()).add(bigDecimal); + tDriver.setLaveBusinessMoney(laveBusinessMoney.doubleValue()); break; case 2: BigDecimal bigDecimal1 = new BigDecimal(mount); BigDecimal subtract = tDriver.getBalance().subtract(bigDecimal1); int comparisonResult = subtract.compareTo(BigDecimal.ZERO); // 小于0 设置为0 不要为负数 - if (comparisonResult<0){ -// tDriver.setBalance(BigDecimal.ZERO); - - return 502; - }else{ + if (comparisonResult>0){ tDriver.setBalance(subtract); + } + BigDecimal laveBusinessMoney1 = new BigDecimal(tDriver.getLaveBusinessMoney()).subtract(bigDecimal1); + int comparisonResult1 = laveBusinessMoney1.compareTo(BigDecimal.ZERO); + if (comparisonResult1>0){ + tDriver.setLaveBusinessMoney(laveBusinessMoney1.doubleValue()); } break; } driverService.updateById(tDriver); + tPubTransactionDetails.setDriverBalance(tDriver.getLaveBusinessMoney()); + pubTransactionDetailsService.insert(tPubTransactionDetails); return SUCCESS_TIP; } /** @@ -179,7 +183,9 @@ beginTime = timeArray[0]; endTime = timeArray[1]; } - List<TOrderPrivateCar> tOrderPrivateCars = orderPrivateCarService.selectList(null); + List<TOrderPrivateCar> tOrderPrivateCars = orderPrivateCarService.selectList( + new EntityWrapper<TOrderPrivateCar>().eq("driverId",id) + ); List<Map<String, Object>> res = new ArrayList<>(); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); @@ -209,10 +215,11 @@ temp.put("amount",income.getMoney()); temp.put("withType","订单号"); // todo 新增收入明细时 需要存储当前账户余额 - temp.put("balance",0); + temp.put("balance",income.getDriverBalance()); res.add(temp); } } + // 司机专车订单ids List<Integer> orderIds = orderPrivateCarService.selectList(new EntityWrapper<TOrderPrivateCar>() .eq("driverId", id)).stream() @@ -245,7 +252,7 @@ temp.put("amount",income.getMoney()); temp.put("withType","订单号"); // todo 新增收入明细时 需要存储当前账户余额 - temp.put("balance",0); + temp.put("balance",income.getDriverBalance()); res.add(temp); } } @@ -270,7 +277,7 @@ temp.put("amount",details.getMoney()); temp.put("withType","交易流水号"); // todo 新增收入明细时 需要存储当前账户余额 - temp.put("balance",0); + temp.put("balance",details.getDriverBalance()); res.add(temp); } } @@ -295,12 +302,12 @@ temp.put("amount",details.getMoney()); temp.put("withType","交易流水号"); // todo 新增收入明细时 需要存储当前账户余额 - temp.put("balance",0); + temp.put("balance",details.getDriverBalance()); res.add(temp); } } // 平台充值 - if (handleType == null || handleType == 6){ + if (handleType == null || handleType == 5){ Wrapper<TPubTransactionDetails> eq = new EntityWrapper<TPubTransactionDetails>() .eq("userId", id) .eq("orderType", 6) @@ -320,12 +327,12 @@ temp.put("amount",details.getMoney()); temp.put("withType","无"); // todo 新增收入明细时 需要存储当前账户余额 - temp.put("balance",0); + temp.put("balance",details.getDriverBalance()); res.add(temp); } } // 平台扣除 - if (handleType == null || handleType == 7){ + if (handleType == null || handleType == 6){ Wrapper<TPubTransactionDetails> eq = new EntityWrapper<TPubTransactionDetails>() .eq("userId", id) .eq("orderType", 7) @@ -346,10 +353,50 @@ temp.put("amount",details.getMoney()); temp.put("withType","无"); // todo 新增收入明细时 需要存储当前账户余额 - temp.put("balance",0); + temp.put("balance",details.getDriverBalance()); res.add(temp); } } + // 取消订单收入 + if (handleType == null || handleType == 7){ + Wrapper<Income> eq = new EntityWrapper<Income>() + .eq("objectId", id) + .eq("type", 3) + .eq("userType", 2); + if (beginTime!=null){ + eq.ge("insertTime", beginTime); + eq.le("insertTime", endTime); + } + List<Income> incomes = tIncomeService.selectList(eq); + for (Income income : incomes) { + Map<String, Object> temp = new HashMap<>(); + String times = simpleDateFormat.format(income.getInsertTime()); + if (income.getIncomeId()!=null){ + TOrderPrivateCar tOrderPrivateCar = tOrderPrivateCars.stream().filter(e -> e.getId() + .equals(income.getIncomeId())).findFirst().orElse(null); + temp.put("orderNumber",tOrderPrivateCar==null?null:tOrderPrivateCar.getOrderNum()); + temp.put("remark",tOrderPrivateCar.getRemark()); + } + temp.put("times",times); + temp.put("handleType","取消订单收入"); + temp.put("amount",income.getMoney()); + temp.put("withType","订单号"); + // todo 新增收入明细时 需要存储当前账户余额 + temp.put("balance",income.getDriverBalance()); + res.add(temp); + } + } + res.sort((o1, o2) -> { + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + try { + Date date1 = format.parse((String) o1.get("times")); + Date date2 = format.parse((String) o2.get("times")); + return date2.compareTo(date1); // 降序 + } catch (Exception e) { + e.printStackTrace(); + return 0; + } + }); return res; } @RequestMapping("/getExcel") -- Gitblit v1.7.1