大屏
This commit is contained in:
@@ -3,6 +3,8 @@ package com.dc.dc_project.controller.bigScreen;
|
||||
|
||||
import com.dc.dc_project.common.ResponseResult;
|
||||
import com.dc.dc_project.model.dto.LaboratoryDto;
|
||||
import com.dc.dc_project.model.vo.BigScreenStatistics;
|
||||
import com.dc.dc_project.service.BigScreenService;
|
||||
import com.dc.dc_project.service.LaboratoryService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
@@ -17,6 +19,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
public class LaboratoryBigScreenController {
|
||||
|
||||
private final LaboratoryService laboratoryService;
|
||||
private final BigScreenService bigScreenService;
|
||||
|
||||
@PostMapping("/list")
|
||||
@Operation(summary = "实验室列表")
|
||||
@@ -24,4 +27,17 @@ public class LaboratoryBigScreenController {
|
||||
return laboratoryService.getList(laboratoryDto);
|
||||
}
|
||||
|
||||
@PostMapping("/Statistics")
|
||||
@Operation(summary = "大屏统计信息")
|
||||
public ResponseResult getStatistics() {
|
||||
return bigScreenService.getPigStatistics();
|
||||
}
|
||||
|
||||
@PostMapping("/record_entrust")
|
||||
@Operation(summary = "本年实验室委托统计")
|
||||
public ResponseResult recordEntrust() {
|
||||
return bigScreenService.getRecordEntrustStatistics();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.dc.dc_project.model.vo;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class BigScreenStatistics {
|
||||
|
||||
/**
|
||||
* 实验室数量
|
||||
*/
|
||||
private Long laboratoryCount;
|
||||
|
||||
/**
|
||||
* 设备数量
|
||||
*/
|
||||
private Long deviceCount;
|
||||
|
||||
/**
|
||||
* 人员数量
|
||||
*/
|
||||
private Long personCount;
|
||||
|
||||
/**
|
||||
* 工程数量
|
||||
*/
|
||||
private Long projectCount;
|
||||
|
||||
/**
|
||||
* 在建工程数量
|
||||
*/
|
||||
private Long projectBuildingCount;
|
||||
|
||||
/**
|
||||
* 完工工程数量
|
||||
*/
|
||||
private Long projectCompletedCount;
|
||||
|
||||
/**
|
||||
* 委托数量
|
||||
*/
|
||||
private Long entrustCount;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.dc.dc_project.model.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class RecordEntrustStatisticsVo {
|
||||
|
||||
/**
|
||||
* 月份
|
||||
*/
|
||||
private Integer month;
|
||||
|
||||
/**
|
||||
* 委托总数量
|
||||
*/
|
||||
private Integer entrustCount;
|
||||
|
||||
/**
|
||||
* 报告数量
|
||||
*/
|
||||
private Integer reportCount;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.dc.dc_project.service;
|
||||
|
||||
import com.dc.dc_project.common.ResponseResult;
|
||||
|
||||
public interface BigScreenService {
|
||||
/**
|
||||
* 大屏统计信息
|
||||
* @return
|
||||
*/
|
||||
ResponseResult getPigStatistics();
|
||||
|
||||
/**
|
||||
* 大屏委托统计信息
|
||||
* @return
|
||||
*/
|
||||
ResponseResult getRecordEntrustStatistics();
|
||||
}
|
||||
@@ -18,4 +18,10 @@ public interface LaboratoryService extends IService<Laboratory> {
|
||||
* @return
|
||||
*/
|
||||
ResponseResult getList(LaboratoryDto laboratoryDto);
|
||||
|
||||
/**
|
||||
* 大屏获取数量统计
|
||||
* @return
|
||||
*/
|
||||
ResponseResult getPigStatistics();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.dc.dc_project.service.impl;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.dc.dc_project.common.ResponseResult;
|
||||
import com.dc.dc_project.model.pojo.RecordEntrust;
|
||||
import com.dc.dc_project.model.vo.BigScreenStatistics;
|
||||
import com.dc.dc_project.model.vo.RecordEntrustStatisticsVo;
|
||||
import com.dc.dc_project.service.*;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class BigScreenServiceImpl implements BigScreenService {
|
||||
|
||||
private final LaboratoryService laboratoryService;
|
||||
private final EquipmentService equipmentService;
|
||||
private final StandardService standardService;
|
||||
private final PersonnelService personnelService;
|
||||
private final RecordEntrustService recordEntrustService;
|
||||
@Override
|
||||
public ResponseResult getPigStatistics() {
|
||||
BigScreenStatistics bigScreenStatistics = new BigScreenStatistics();
|
||||
//试验室
|
||||
bigScreenStatistics.setLaboratoryCount(laboratoryService.count());
|
||||
bigScreenStatistics.setDeviceCount(equipmentService.count());
|
||||
bigScreenStatistics.setPersonCount(personnelService.count());
|
||||
bigScreenStatistics.setProjectCount(standardService.count());
|
||||
bigScreenStatistics.setProjectBuildingCount(standardService.count());
|
||||
bigScreenStatistics.setProjectCompletedCount(standardService.count());
|
||||
bigScreenStatistics.setEntrustCount(recordEntrustService.count());
|
||||
return ResponseResult.success(bigScreenStatistics);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult getRecordEntrustStatistics() {
|
||||
// 获取本年时间
|
||||
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss");
|
||||
// 本年开始时间(1月1日 00:00:00)
|
||||
LocalDateTime startTime = LocalDateTime.of(LocalDateTime.now().getYear(), 1, 1, 0, 0, 0);
|
||||
String startTimeStr = startTime.format(dtf);
|
||||
// 结束时间为当前时间
|
||||
LocalDateTime endTime = LocalDateTime.now();
|
||||
String endTimeStr = endTime.format(dtf);
|
||||
for (int i = 1; i < 13; i++) {
|
||||
RecordEntrustStatisticsVo recordEntrustStatistics = new RecordEntrustStatisticsVo();
|
||||
recordEntrustStatistics.setMonth(i);
|
||||
recordEntrustStatistics.setEntrustCount(recordEntrustService.count(new LambdaQueryWrapper<>().between(, startTime, endTime)));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import com.dc.dc_project.model.dto.LaboratoryDto;
|
||||
import com.dc.dc_project.model.pojo.Laboratory;
|
||||
import com.dc.dc_project.model.pojo.Standard;
|
||||
import com.dc.dc_project.model.pojo.StandardCategory;
|
||||
import com.dc.dc_project.model.vo.BigScreenStatistics;
|
||||
import com.dc.dc_project.model.vo.LaboratoryVo;
|
||||
import com.dc.dc_project.service.LaboratoryService;
|
||||
import com.dc.dc_project.mapper.LaboratoryMapper;
|
||||
@@ -65,4 +66,13 @@ public class LaboratoryServiceImpl extends ServiceImpl<LaboratoryMapper, Laborat
|
||||
|
||||
return ResponseResult.success(laboratoryVos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult getPigStatistics() {
|
||||
BigScreenStatistics bigScreenStatistics = new BigScreenStatistics();
|
||||
//试验室
|
||||
bigScreenStatistics.setLaboratoryCount(baseMapper.selectCount(null));
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
55
src/main/java/com/dc/dc_project/utils/DateUtils.java
Normal file
55
src/main/java/com/dc/dc_project/utils/DateUtils.java
Normal file
@@ -0,0 +1,55 @@
|
||||
package com.dc.dc_project.utils;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
/**
|
||||
* 日期时间工具类
|
||||
*/
|
||||
public class DateUtils {
|
||||
|
||||
/**
|
||||
* 获取当前年份
|
||||
* @return 当前年份字符串 (yyyy)
|
||||
*/
|
||||
public static String getCurrentYear() {
|
||||
return String.valueOf(LocalDate.now().getYear());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前年月
|
||||
* @return 当前年月字符串 (yyyy-MM)
|
||||
*/
|
||||
public static String getCurrentYearMonth() {
|
||||
return LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前年月日
|
||||
* @return 当前日期字符串 (yyyy-MM-dd)
|
||||
*/
|
||||
public static String getCurrentDate() {
|
||||
return LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据指定年月日获取日期字符串
|
||||
* @param year 年
|
||||
* @param month 月
|
||||
* @param day 日
|
||||
* @return 指定日期字符串 (yyyy-MM-dd)
|
||||
*/
|
||||
public static String getDate(int year, int month, int day) {
|
||||
LocalDate date = LocalDate.of(year, month, day);
|
||||
return date.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前完整日期时间
|
||||
* @return 当前日期时间字符串 (yyyy-MM-dd HH:mm:ss)
|
||||
*/
|
||||
public static String getCurrentDateTime() {
|
||||
return LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user