From c0f0b2825ed3dbef86b381c2490277164446dc10 Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期六, 18 三月 2023 17:28:01 +0800
Subject: [PATCH] 新增加司机端接口

---
 driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/DriverServiceImpl.java |   31 +++++++++++++++++++++++++++++++
 1 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/DriverServiceImpl.java b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/DriverServiceImpl.java
index f601368..4a71c4b 100644
--- a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/DriverServiceImpl.java
+++ b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/DriverServiceImpl.java
@@ -510,6 +510,8 @@
         Driver driver = this.selectById(uid);
         DriverInfoWarpper driverInfo = new DriverInfoWarpper();
         BeanUtils.copyProperties(driver, driverInfo);
+        driverInfo.setBalance(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission());
+
         YouTuiDriver youTuiDriver = youTuiDriverService.selectOne(new EntityWrapper<YouTuiDriver>().eq("driverId", uid).last(" and failureTime > now() order by failureTime limit 0, 1"));
         if(null != youTuiDriver){
             driverInfo.setYouTuiStart(youTuiDriver.getCreateTime().getTime());
@@ -550,6 +552,12 @@
         if(ToolUtil.isNotEmpty(driverInfo.getEmergencyPhone())){
             driver.setEmergencyPhone(driverInfo.getEmergencyPhone());
         }
+        if(ToolUtil.isNotEmpty(driverInfo.getWxCollectionCode())){
+            driver.setWxCollectionCode(driverInfo.getWxCollectionCode());
+        }
+        if(ToolUtil.isNotEmpty(driverInfo.getZfbCollectionCode())){
+            driver.setZfbCollectionCode(driverInfo.getZfbCollectionCode());
+        }
         if(ToolUtil.isNotEmpty(driverInfo.getPhone()) && ToolUtil.isNotEmpty(driverInfo.getCode())){
             String value = redisUtil.getValue(driverInfo.getPhone());
             if(ToolUtil.isEmpty(value)){
@@ -563,4 +571,27 @@
         this.updateById(driver);
         return ResultUtil.success();
     }
+
+    @Override
+    public void emptyIntegral() {
+        List<Driver> drivers = this.selectList(new EntityWrapper<Driver>().eq("approvalStatus", 2).eq("status", 1));
+        List<AccountChangeDetail> list = new ArrayList<>();
+        for (Driver driver : drivers) {
+            AccountChangeDetail accountChangeDetail = new AccountChangeDetail();
+            accountChangeDetail.setUserType(2);
+            accountChangeDetail.setUserId(driver.getId());
+            accountChangeDetail.setCreateTime(new Date());
+            accountChangeDetail.setOldData(driver.getIntegral().doubleValue());
+            accountChangeDetail.setType(2);
+            accountChangeDetail.setExplain("定时清空积分");
+            driver.setIntegral(0);
+            accountChangeDetail.setNewData(driver.getIntegral().doubleValue());
+            list.add(accountChangeDetail);
+        }
+        if(drivers.size() > 0){
+            this.updateBatchById(drivers);
+            accountChangeDetailService.insertBatch(list);
+        }
+
+    }
 }

--
Gitblit v1.7.1