diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/smartDevicesImpl/TbMeterRecordServiceImpl.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/smartDevicesImpl/TbMeterRecordServiceImpl.java index 13793fdd..2c206a81 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/smartDevicesImpl/TbMeterRecordServiceImpl.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/smartDevicesImpl/TbMeterRecordServiceImpl.java @@ -249,6 +249,7 @@ public class TbMeterRecordServiceImpl implements ITbMeterRecordService { .toArray(BigDecimal[]::new); hourMap.put("categories", hourCategories); hourMap.put("data", hourData); + hourMap.put("total" , hourList.stream().map(map -> new BigDecimal(map.get("total_consumption").toString())).reduce(BigDecimal::add).orElse(BigDecimal.ZERO).floatValue()); // day String[] monthArr = month.split("-"); @@ -262,6 +263,7 @@ public class TbMeterRecordServiceImpl implements ITbMeterRecordService { .toArray(BigDecimal[]::new); dayMap.put("categories", dayCategories); dayMap.put("data", dayData); + dayMap.put("total", dayList.stream().map(map -> new BigDecimal(map.get("total_consumption").toString())).reduce(BigDecimal::add).orElse(BigDecimal.ZERO).floatValue()); // month List> monthList = baseMapper.getMonthTrend(StrUtil.isBlank(floorId) ? null : Long.parseLong(floorId), StrUtil.isBlank(meterId) ? null : Long.parseLong(meterId), meterType, year); @@ -274,6 +276,7 @@ public class TbMeterRecordServiceImpl implements ITbMeterRecordService { .toArray(BigDecimal[]::new); monthMap.put("categories", monthCategories); monthMap.put("data", monthData); + monthMap.put("total", monthList.stream().map(map -> new BigDecimal(map.get("total_consumption").toString())).reduce(BigDecimal::add).orElse(BigDecimal.ZERO).floatValue()); resultMap.put("hour", hourMap); diff --git a/ruoyi-modules/Sis/src/main/java/org/dromara/sis/controller/SisVisitorController.java b/ruoyi-modules/Sis/src/main/java/org/dromara/sis/controller/SisVisitorController.java index 588bd650..01d34f98 100644 --- a/ruoyi-modules/Sis/src/main/java/org/dromara/sis/controller/SisVisitorController.java +++ b/ruoyi-modules/Sis/src/main/java/org/dromara/sis/controller/SisVisitorController.java @@ -1,36 +1,26 @@ package org.dromara.sis.controller; - -import cn.dev33.satoken.annotation.SaCheckPermission; import cn.hutool.core.date.DateField; import cn.hutool.core.date.DateUtil; -import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotNull; import lombok.RequiredArgsConstructor; -import org.dromara.common.mybatis.core.page.PageQuery; import org.dromara.common.mybatis.core.page.TableDataInfo; -import org.dromara.sis.domain.bo.SisPersonLibImgBo; -import org.dromara.sis.domain.vo.SisPersonLibImgVo; import org.dromara.sis.sdk.e8.E8PlatformApi; import org.dromara.sis.sdk.e8.domain.QueryDto; import org.dromara.sis.sdk.e8.domain.accessControl.req.AccessRecordFindReq; import org.dromara.sis.sdk.e8.domain.accessControl.res.AccessRecordFindRes; -import org.dromara.sis.service.ISisPersonLibImgService; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; -import java.util.ArrayList; import java.util.Date; -import java.util.List; /** * @author yuyongle * @version 1.0 - * @description: - * @date 2025/8/27 15:57 + * @since 2025/8/27 15:57 */ @Validated @RequiredArgsConstructor @@ -43,15 +33,15 @@ public class SisVisitorController { * 查询人员通行记录 */ @GetMapping("/list") - public TableDataInfo list(@RequestParam(required = false) String beginTime, + public TableDataInfo list(@RequestParam(required = false) String begTime, @RequestParam(required = false) String endTime, @NotNull(message = "页码不能为空") @RequestParam Integer pageNum, @NotNull(message = "页数不能为空") @RequestParam Integer pageSize, @RequestParam(required = false) String personName, @RequestParam(required = false) Integer recordType) { AccessRecordFindReq req = new AccessRecordFindReq(); - if (beginTime != null && !beginTime.isEmpty()) { - req.setStartTime(DateUtil.format(DateUtil.parse(beginTime), "yyyy-MM-dd 00:00:00")); + if (begTime != null && !begTime.isEmpty()) { + req.setStartTime(DateUtil.format(DateUtil.parse(begTime), "yyyy-MM-dd 00:00:00")); } else { // 默认设置为7天前 req.setStartTime(DateUtil.format(DateUtil.offset(new Date(), DateField.DAY_OF_MONTH, -7), "yyyy-MM-dd 00:00:00"));