| | |
| | | /** |
| | | * 提现操作 |
| | | * @param money |
| | | * @param code |
| | | * @param name |
| | | * @param uid |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil withdrawal(Double money, String code, String name, Integer uid, Integer type,String bankName) throws Exception { |
| | | public ResultUtil withdrawal(Double money, Integer uid, Integer type, Integer language) throws Exception { |
| | | if(money.compareTo(0D) <= 0){ |
| | | return ResultUtil.error("提现金额必须大于0"); |
| | | return ResultUtil.error(language == 1 ? "提现金额必须大于0" : language == 2 ? "The withdrawal amount must be greater than 0" : "Le montant du retrait doit être supérieur à 0"); |
| | | } |
| | | Driver driver = driverService.selectById(uid); |
| | | Integer withdrawalRule = driverService.getWithdrawalRule(); |
| | | if(withdrawalRule==null){ |
| | | return ResultUtil.error("暂未设置提现时间,请联系平台"); |
| | | return ResultUtil.error(language == 1 ? "暂未设置提现时间,请联系平台" : language == 2 ? "No withdrawal time has been set, please contact the platform" : "Aucune heure de retrait n’a été définie pour le moment. Veuillez contacter la plateforme"); |
| | | } |
| | | String week =withdrawalRule==1?"星期一": |
| | | withdrawalRule==2?"星期二": |
| | |
| | | withdrawalRule==6?"星期六":"星期日"; |
| | | String weeks = DateUtil.getAfterDayWeek("0"); |
| | | if(!weeks.equals(week)){ |
| | | return ResultUtil.error(" 每周"+(withdrawalRule==1?"一": |
| | | withdrawalRule==2?"二": |
| | | withdrawalRule==3?"三": |
| | | withdrawalRule==4?"四": |
| | | withdrawalRule==5?"五": |
| | | withdrawalRule==6?"六":"日")+"统一申请提现,平台统一处理。"); |
| | | return ResultUtil.error((language == 1 ? "每周" : language == 2 ? "Every" : "Chaque") +(withdrawalRule==1? (language == 1 ? "一" : language == 2 ? "Monday" : "lundi") : |
| | | withdrawalRule==2?(language == 1 ? "二" : language == 2 ? "Tuesday" : "mardi"): |
| | | withdrawalRule==3?(language == 1 ? "三" : language == 2 ? "Wednesday" : "mercredi"): |
| | | withdrawalRule==4?(language == 1 ? "四" : language == 2 ? "Thursday" : "jeudi"): |
| | | withdrawalRule==5?(language == 1 ? "五" : language == 2 ? "Friday" : "vendredi"): |
| | | withdrawalRule==6?(language == 1 ? "六" : language == 2 ? "Saturday" : "samedi"):(language == 1 ? "日" : language == 2 ? "Sunday" : "dimanche")) + |
| | | (language == 1 ? "统一申请提现,平台统一处理。" : language == 2 ? "nified application for withdrawal, platform unified processing" : "Demande de retrait unifiée et traitement unifié sur la plateforme")); |
| | | } |
| | | if(null == type){ |
| | | type = 1; |
| | |
| | | Withdrawal withdrawal = new Withdrawal(); |
| | | if(type == 1){ |
| | | if(null == driver.getLaveActivityMoney()){ |
| | | return ResultUtil.error("账户没有余额,不能提现"); |
| | | return ResultUtil.error(language == 1 ? "账户没有余额,不能提现" : language == 2 ? "There is no balance in the account, no cash can be withdrawn" : "Le compte n’a pas de solde et ne peut pas être retiré"); |
| | | } |
| | | if(driver.getLaveActivityMoney().compareTo(money) < 0){ |
| | | return ResultUtil.error("提现金额必须小于账户余额"); |
| | | return ResultUtil.error(language == 1 ? "提现金额必须小于账户余额" : language == 2 ? "The withdrawal amount must be less than the account balance" : "Le montant du retrait doit être inférieur au solde du compte"); |
| | | } |
| | | withdrawal.setBalance(driver.getLaveActivityMoney()); |
| | | } |
| | | if(type == 2){ |
| | | if(null == driver.getLaveBusinessMoney()){ |
| | | return ResultUtil.error("账户没有余额,不能提现"); |
| | | return ResultUtil.error(language == 1 ? "账户没有余额,不能提现" : language == 2 ? "There is no balance in the account, no cash can be withdrawn" : "Le compte n’a pas de solde et ne peut pas être retiré"); |
| | | } |
| | | |
| | | Double money1 = driverService.getThisWeekMoney(uid); |
| | | Double laveBusinessMoney =driver.getLaveBusinessMoney()-(money1==null?0d:money1); |
| | | if(laveBusinessMoney.compareTo(money) < 0){ |
| | | return ResultUtil.error("提现金额必须小于账户余额"); |
| | | return ResultUtil.error(language == 1 ? "提现金额必须小于账户余额" : language == 2 ? "The withdrawal amount must be less than the account balance" : "Le montant du retrait doit être inférieur au solde du compte"); |
| | | } |
| | | withdrawal.setBalance(driver.getLaveBusinessMoney()-(money1==null?0d:money1)); |
| | | } |
| | | withdrawal.setCode(code); |
| | | withdrawal.setCode(driver.getPhone());// TODO: 2023/7/5 第三方支支持手机号提现 |
| | | withdrawal.setBankName(driver.getPhoneOperator()); |
| | | withdrawal.setFlag(1); |
| | | withdrawal.setInsertTime(new Date()); |
| | | withdrawal.setMoney(money); |
| | | withdrawal.setName(name); |
| | | withdrawal.setName(driver.getFirstName() + " " + driver.getLastName()); |
| | | withdrawal.setState(1); |
| | | withdrawal.setUserId(uid); |
| | | withdrawal.setUserType(2); |
| | | withdrawal.setBankName(bankName); |
| | | withdrawal.setType(type); |
| | | withdrawal.setWithdrawalType(1);//线上 |
| | | this.insert(withdrawal); |
| | | |
| | | if(type == 1){ |
| | | double v = new BigDecimal(driver.getLaveActivityMoney()).subtract(new BigDecimal(money)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); |
| | |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil withdrawalAudit(Integer id, Integer state) throws Exception { |
| | | public ResultUtil withdrawalAudit(Integer id, Integer state, Integer language) throws Exception { |
| | | Withdrawal withdrawal = this.selectById(id); |
| | | if(withdrawal.getState() == 2){ |
| | | return ResultUtil.error("申请已审核通过,不能重复提交"); |
| | | return ResultUtil.error(language == 1 ? "申请已审核通过,不能重复提交" : language == 2 ? "The application has been approved and cannot be submitted again" : "La demande a été examinée et approuvée et ne peut pas être soumise en double"); |
| | | } |
| | | if(withdrawal.getState() == 3){ |
| | | return ResultUtil.error("申请已审核拒绝,不能重复提交"); |
| | | return ResultUtil.error(language == 1 ? "车牌号已经使用" : language == 2 ? "The application has been rejected and cannot be submitted again" : "La demande a été examinée et rejetée, ne peut pas être soumise en double"); |
| | | } |
| | | |
| | | if(withdrawal.getUserType() == 1){//用户 |