From 49f47b6b886a912b6dab1a1596a1ee44b09fad45 Mon Sep 17 00:00:00 2001 From: pengwei Date: Thu, 24 Jul 2025 18:13:30 +0800 Subject: [PATCH] =?UTF-8?q?fit=EF=BC=9A=E5=89=94=E9=99=A4=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../supervision/service/SupRotaService.java | 44 ++++++++++--------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/src/main/java/com/biutag/supervision/service/SupRotaService.java b/src/main/java/com/biutag/supervision/service/SupRotaService.java index a783114..824c7c5 100644 --- a/src/main/java/com/biutag/supervision/service/SupRotaService.java +++ b/src/main/java/com/biutag/supervision/service/SupRotaService.java @@ -28,42 +28,44 @@ public class SupRotaService extends ServiceImpl { private final SupDepartService departService; //展示数据的接口 - public JSONObject getSupRotaTable(SupRotaQueryParam queryParam){ + public JSONObject getSupRotaTable(SupRotaQueryParam queryParam) { UserAuth user = UserContextHolder.getCurrentUser(); //判断传入的id是市局、还是分局 - JSONObject jsonObject=new JSONObject(); - if (StrUtil.isBlank(queryParam.getDeptId()) && (user.getRoleCodes().contains(RoleCodeEnum.FIRST_ADMIN.getCode()) || user.getRoleCodes().contains(RoleCodeEnum.ADMIN.getCode()))) { + JSONObject jsonObject = new JSONObject(); + String dateTime = null; + // 获取当前的本地时间 + LocalTime currentTime = LocalTime.now(); - SupDepart supDepart = departService.getById(AppConstants.ROOT_DEPART_ID); + // 定义时间格式化为字符串的格式 + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("HH:mm:ss"); - // 获取当前的本地时间 - LocalTime currentTime = LocalTime.now(); + // 将本地时间格式化为字符串 + String timeString = currentTime.format(formatter); - // 定义时间格式化为字符串的格式 - DateTimeFormatter formatter = DateTimeFormatter.ofPattern("HH:mm:ss"); + dateTime = queryParam.getDate() + " " + timeString; + if (StrUtil.isBlank(queryParam.getDeptId()) && (user.getRoleCodes().contains(RoleCodeEnum.FIRST_ADMIN.getCode()) || user.getRoleCodes().contains(RoleCodeEnum.ADMIN.getCode()))) { + + SupDepart supDepart = departService.getById(AppConstants.ROOT_DEPART_ID); - // 将本地时间格式化为字符串 - String timeString = currentTime.format(formatter); - String dateTime=queryParam.getDate() + " "+timeString; //市局的数据进行分类 //市局本身 List supRota = baseMapper.selectList(new LambdaQueryWrapper() - .eq(SupRota::getDeptCode,supDepart.getId()) - .ge(SupRota::getStartTime,dateTime) - .le(SupRota::getEndTime,dateTime)); - jsonObject.fluentPut("cityBureau",supRota); + .eq(SupRota::getDeptCode, supDepart.getId()) + .ge(SupRota::getStartTime, dateTime) + .le(SupRota::getEndTime, dateTime)); + jsonObject.fluentPut("cityBureau", supRota); //分局 - List suboffice =baseMapper.getSubofficeData(queryParam.getDate(),"3"); - jsonObject.fluentPut("suboffice",suboffice); + List suboffice = baseMapper.getSubofficeData(dateTime, "3"); + jsonObject.fluentPut("suboffice", suboffice); //局属单位 - List departmental =baseMapper.getSubofficeData(queryParam.getDate(),"4"); - jsonObject.fluentPut("departmental",departmental); + List departmental = baseMapper.getSubofficeData(dateTime, "4"); + jsonObject.fluentPut("departmental", departmental); } else { - List supRotaList = baseMapper.getSupRotaList(queryParam.getDate(),queryParam.getDeptId()); - jsonObject.fluentPut("supRotaList",supRotaList); + List supRotaList = baseMapper.getSupRotaList(dateTime, queryParam.getDeptId()); + jsonObject.fluentPut("supRotaList", supRotaList); } return jsonObject; }