From 13d2bd6a27f941cfd8f096a7ae2def858a565363 Mon Sep 17 00:00:00 2001 From: zhibing.pu <393733352@qq.com> Date: 星期三, 04 九月 2024 11:01:34 +0800 Subject: [PATCH] 修改2.0 bug --- DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/DriverOnlineServiceImpl.java | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-) diff --git a/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/DriverOnlineServiceImpl.java b/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/DriverOnlineServiceImpl.java index d86ae0c..055c978 100644 --- a/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/DriverOnlineServiceImpl.java +++ b/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/DriverOnlineServiceImpl.java @@ -156,7 +156,7 @@ } SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); List<DriverActivityHistory> driverActivityHistories = driverActivityHistoryMapper.selectList(new EntityWrapper<DriverActivityHistory>().eq("driverId", driverId) - .eq("type", 3).eq("carryOut", 1).last(" and day = '" + sdf.format(new Date()) + "'")); + .eq("type", 3).eq("carryOut", 1).last(" and day = '" + sdf.format(new Date()) + "' and driverActivityId in (select id from t_driver_activity where status = 3 and now() between startTime and endTime)")); //生成每个活动从开始上班到当前时间的时长记录 for (DriverActivityHistory driverActivityHistory : driverActivityHistories) { String value = redisUtil.getValue("driverActivity_" + driverId + "_" + driverActivityHistory.getId()); @@ -164,10 +164,10 @@ JSONObject jsonObject = JSON.parseObject(value); Long startTime = jsonObject.getLong("startTime"); long time = System.currentTimeMillis() - startTime; - redisUtil.setStrValue("driverActivity_" + driverId + "_" + driverActivityHistory.getId(), "{\"startTime\":" + startTime + ", \"time\":" + time + "}"); + redisUtil.setStrValue("driverActivity_" + driverId + "_" + driverActivityHistory.getId(), "{\"startTime\":" + startTime + ", \"time\":" + time + "}", 172800); }else{ long time = System.currentTimeMillis() - driverWork.getStartTime().getTime(); - redisUtil.setStrValue("driverActivity_" + driverId + "_" + driverActivityHistory.getId(), "{\"startTime\":" + driverWork.getStartTime().getTime() + ", \"time\":" + time + "}"); + redisUtil.setStrValue("driverActivity_" + driverId + "_" + driverActivityHistory.getId(), "{\"startTime\":" + driverWork.getStartTime().getTime() + ", \"time\":" + time + "}", 172800); } } } @@ -259,7 +259,7 @@ public void run() { Process process = null; try { - process = Runtime.getRuntime().exec("rm -rf /usr/local/nginx/html/files/audio/" + fileName); + process = Runtime.getRuntime().exec("sudo rm -rf /home/igotechgh/nginx/html/files/audio/" + fileName); } catch (IOException e) { throw new RuntimeException(e); } @@ -280,7 +280,7 @@ public void deductionDuration1() { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); List<DriverActivityHistory> driverActivityHistories = driverActivityHistoryMapper.selectList(new EntityWrapper<DriverActivityHistory>() - .eq("type", 3).eq("carryOut", 1).last(" and day = '" + sdf.format(new Date()) + "'")); + .eq("type", 3).eq("carryOut", 1).last(" and day = '" + sdf.format(new Date()) + "' and driverActivityId in (select id from t_driver_activity where status = 3 and now() between startTime and endTime)")); for (DriverActivityHistory driverActivityHistory : driverActivityHistories) { DriverWork driverWork = driverWorkService.selectOne(new EntityWrapper<DriverWork>().eq("driverId", driverActivityHistory.getDriverId()).eq("state", 1)); if(null == driverWork){ @@ -336,7 +336,7 @@ public void run() { Process process = null; try { - process = Runtime.getRuntime().exec("rm -rf /usr/local/nginx/html/files/audio/" + fileName); + process = Runtime.getRuntime().exec("sudo rm -rf /home/igotechgh/nginx/html/files/audio/" + fileName); } catch (IOException e) { throw new RuntimeException(e); } @@ -361,7 +361,7 @@ driverOnline.setDuration(driverOnline.getDuration() + (time * 60)); this.updateById(driverOnline); } - redisUtil.setStrValue("driverActivity_" + driverActivityHistory.getDriverId() + "_" + driverActivityHistory.getId(), "{\"startTime\":" + System.currentTimeMillis() + ", \"time\":" + 0 + "}"); + redisUtil.setStrValue("driverActivity_" + driverActivityHistory.getDriverId() + "_" + driverActivityHistory.getId(), "{\"startTime\":" + System.currentTimeMillis() + ", \"time\":" + 0 + "}", 172800); } } } -- Gitblit v1.7.1