| | |
| | | tPubTransactionDetails.setOrderType(7); |
| | | break; |
| | | } |
| | | pubTransactionDetailsService.insert(tPubTransactionDetails); |
| | | // type=1增加 type=2减少 |
| | | switch (type){ |
| | | case 1: |
| | |
| | | |
| | | 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; |
| | | } |
| | | /** |