refactor(sis): 1
This commit is contained in:
@@ -249,6 +249,7 @@ public class TbMeterRecordServiceImpl implements ITbMeterRecordService {
|
|||||||
.toArray(BigDecimal[]::new);
|
.toArray(BigDecimal[]::new);
|
||||||
hourMap.put("categories", hourCategories);
|
hourMap.put("categories", hourCategories);
|
||||||
hourMap.put("data", hourData);
|
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
|
// day
|
||||||
String[] monthArr = month.split("-");
|
String[] monthArr = month.split("-");
|
||||||
@@ -262,6 +263,7 @@ public class TbMeterRecordServiceImpl implements ITbMeterRecordService {
|
|||||||
.toArray(BigDecimal[]::new);
|
.toArray(BigDecimal[]::new);
|
||||||
dayMap.put("categories", dayCategories);
|
dayMap.put("categories", dayCategories);
|
||||||
dayMap.put("data", dayData);
|
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
|
// month
|
||||||
List<Map<String, Object>> monthList = baseMapper.getMonthTrend(StrUtil.isBlank(floorId) ? null : Long.parseLong(floorId), StrUtil.isBlank(meterId) ? null : Long.parseLong(meterId), meterType, year);
|
List<Map<String, Object>> 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);
|
.toArray(BigDecimal[]::new);
|
||||||
monthMap.put("categories", monthCategories);
|
monthMap.put("categories", monthCategories);
|
||||||
monthMap.put("data", monthData);
|
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);
|
resultMap.put("hour", hourMap);
|
||||||
|
@@ -1,36 +1,26 @@
|
|||||||
package org.dromara.sis.controller;
|
package org.dromara.sis.controller;
|
||||||
|
|
||||||
|
|
||||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
|
||||||
import cn.hutool.core.date.DateField;
|
import cn.hutool.core.date.DateField;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
|
||||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
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.E8PlatformApi;
|
||||||
import org.dromara.sis.sdk.e8.domain.QueryDto;
|
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.req.AccessRecordFindReq;
|
||||||
import org.dromara.sis.sdk.e8.domain.accessControl.res.AccessRecordFindRes;
|
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.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author yuyongle
|
* @author yuyongle
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
* @description:
|
* @since 2025/8/27 15:57
|
||||||
* @date 2025/8/27 15:57
|
|
||||||
*/
|
*/
|
||||||
@Validated
|
@Validated
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@@ -43,15 +33,15 @@ public class SisVisitorController {
|
|||||||
* 查询人员通行记录
|
* 查询人员通行记录
|
||||||
*/
|
*/
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public TableDataInfo<AccessRecordFindRes> list(@RequestParam(required = false) String beginTime,
|
public TableDataInfo<AccessRecordFindRes> list(@RequestParam(required = false) String begTime,
|
||||||
@RequestParam(required = false) String endTime,
|
@RequestParam(required = false) String endTime,
|
||||||
@NotNull(message = "页码不能为空") @RequestParam Integer pageNum,
|
@NotNull(message = "页码不能为空") @RequestParam Integer pageNum,
|
||||||
@NotNull(message = "页数不能为空") @RequestParam Integer pageSize,
|
@NotNull(message = "页数不能为空") @RequestParam Integer pageSize,
|
||||||
@RequestParam(required = false) String personName,
|
@RequestParam(required = false) String personName,
|
||||||
@RequestParam(required = false) Integer recordType) {
|
@RequestParam(required = false) Integer recordType) {
|
||||||
AccessRecordFindReq req = new AccessRecordFindReq();
|
AccessRecordFindReq req = new AccessRecordFindReq();
|
||||||
if (beginTime != null && !beginTime.isEmpty()) {
|
if (begTime != null && !begTime.isEmpty()) {
|
||||||
req.setStartTime(DateUtil.format(DateUtil.parse(beginTime), "yyyy-MM-dd 00:00:00"));
|
req.setStartTime(DateUtil.format(DateUtil.parse(begTime), "yyyy-MM-dd 00:00:00"));
|
||||||
} else {
|
} else {
|
||||||
// 默认设置为7天前
|
// 默认设置为7天前
|
||||||
req.setStartTime(DateUtil.format(DateUtil.offset(new Date(), DateField.DAY_OF_MONTH, -7), "yyyy-MM-dd 00:00:00"));
|
req.setStartTime(DateUtil.format(DateUtil.offset(new Date(), DateField.DAY_OF_MONTH, -7), "yyyy-MM-dd 00:00:00"));
|
||||||
|
Reference in New Issue
Block a user