puzhibing
2023-03-18 c0f0b2825ed3dbef86b381c2490277164446dc10
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);
        }
    }
}