大屏、产值

This commit is contained in:
lcj
2025-10-17 11:51:09 +08:00
parent b7a52de2d2
commit c72275859f
12 changed files with 173 additions and 130 deletions

View File

@ -326,7 +326,7 @@ ys7:
app-key: 3acf9f1a43dc4209841e0893003db0a2
app-secret: 09e29c70ae1161fbc3ce2030fc09ba2e
job:
capture-enabled: true # 控制是否启用萤石抓拍任务
capture-enabled: false # 控制是否启用萤石抓拍任务
device-sync-enabled: true # 控制是否同步萤石设备
# 斯巴达算法
sparta:

View File

@ -186,14 +186,6 @@ public class ProjectBigScreenController extends BaseController {
@GetMapping("/news/{projectId}")
public R<List<BusProjectNewsVo>> getProjectNews(@NotNull(message = "主键不能为空")
@PathVariable Long projectId) {
// List<BusCorporateEvents> busCorporateEvents = projectBigScreenMapper.getBusCorporateEvents();
// return R.ok(busCorporateEvents.stream().map(event -> {
// BusProjectNewsVo vo = new BusProjectNewsVo();
// vo.setId(event.getId());
// vo.setTitle(event.getHeadline());
// vo.setContent(event.getContent());
// return vo;
// }).toList());
return R.ok(projectBigScreenService.getProjectNews(projectId));
}
@ -204,23 +196,6 @@ public class ProjectBigScreenController extends BaseController {
@GetMapping("/safetyInspection/{projectId}")
public R<List<ProjectSafetyInspectionVo>> getProjectSafetyInspection(@NotNull(message = "主键不能为空")
@PathVariable Long projectId) {
/* BusProject project = projectService.getById(projectId);
projectId = project.getGoId();
String pic;
if (projectId == 60) {
pic = "http://xny.yj-3d.com:7464";
} else {
pic = "http://xny.yj-3d.com:7363";
}
List<BusTour> busTours = projectBigScreenMapper.selectTourByProjectId(projectId);
return R.ok(busTours.stream().map(tour -> {
ProjectSafetyInspectionVo vo = new ProjectSafetyInspectionVo();
vo.setId(tour.getId());
vo.setViolationType(tour.getTourType());
vo.setPicture(pic + tour.getPicture());
vo.setCreateTime(tour.getCreatedAt());
return vo;
}).toList());*/
return R.ok(projectBigScreenService.getProjectSafetyInspection(projectId));
}
@ -231,51 +206,6 @@ public class ProjectBigScreenController extends BaseController {
@GetMapping("/people/{projectId}")
public R<ProjectPeopleVo> getProjectPeople(@NotNull(message = "主键不能为空")
@PathVariable Long projectId) {
// BusProject project = projectService.getById(projectId);
// projectId = project.getGoId();
// Integer projectUserCount = projectBigScreenMapper.getProjectUserCount(projectId);
// ProjectPeopleVo vo = new ProjectPeopleVo();
// vo.setPeopleCount(BigDecimal.valueOf(projectUserCount));
// Integer attendanceCount = projectBigScreenMapper.getAttendanceCount(projectId, DateUtils.getDate());
// vo.setAttendanceCount(BigDecimal.valueOf(attendanceCount));
// vo.setAttendanceRate(BigDecimalUtil.toPercentage(BigDecimal.valueOf(attendanceCount), BigDecimal.valueOf(projectUserCount)));
// List<BusConstructionUser> projectUserList = projectBigScreenMapper.getProjectUserList(projectId);
// List<BusProjectTeamByGo> teamList = projectBigScreenMapper.getTeamList(projectId);
//
// List<ProjectTeamAttendanceVo> teamAttendanceList = new ArrayList<>();
// String punchRange = project.getPunchRange();
// String punchTime = "";
// if (punchRange != null) {
// String start = punchRange.split(",")[0];
// punchTime = LocalDate.now() + " " + start;
// }
// if (projectUserList != null && teamList != null) {
// projectUserList = projectUserList.stream().filter(user -> user.getTeamId() != null).toList();
// Map<Long, List<BusConstructionUser>> userMap = projectUserList.stream()
// .collect(Collectors.groupingBy(BusConstructionUser::getTeamId));
// for (BusProjectTeamByGo team : teamList) {
// ProjectTeamAttendanceVo vo1 = new ProjectTeamAttendanceVo();
// vo1.setId(team.getId());
// vo1.setTeamName(team.getName());
// vo1.setAttendanceTime(punchTime);
// vo1.setAttendanceNumber(BigDecimal.ZERO);
// List<BusConstructionUser> userList = userMap.get(team.getId());
// if (CollUtil.isNotEmpty(userList)) {
// List<String> list = userList.stream().map(BusConstructionUser::getOpenid).distinct().toList();
// Integer aCount = projectBigScreenMapper.getAttendanceCountByOpenIds(list, LocalDate.now());
// vo1.setAttendanceNumber(BigDecimal.valueOf(aCount));
// }
// vo1.setAllNumber(BigDecimal.valueOf(userMap.getOrDefault(team.getId(), List.of()).size()));
// if (vo1.getAttendanceNumber() != null && vo1.getAllNumber() != null && vo1.getAllNumber().compareTo(BigDecimal.ZERO) != 0) {
// vo1.setAttendanceRate(BigDecimalUtil.toPercentage(vo1.getAttendanceNumber(), vo1.getAllNumber()));
// } else {
// vo1.setAttendanceRate(BigDecimal.ZERO);
// }
// teamAttendanceList.add(vo1);
// }
// }
// vo.setTeamAttendanceList(teamAttendanceList);
// return R.ok(vo);
return R.ok(projectBigScreenService.getProjectPeople(projectId));
}
@ -296,18 +226,7 @@ public class ProjectBigScreenController extends BaseController {
@GetMapping("/generalize/{projectId}")
public R<String> getProjectGeneralize(@NotNull(message = "主键不能为空")
@PathVariable Long projectId) {
// BusProject project = projectService.getById(projectId);
// if (project != null) {
// Long goId = project.getGoId();
// if (goId != null) {
// List<SysProjectIntroduce> sysProjectIntroduces = projectBigScreenMapper.selectByProjectId(goId);
// if (CollUtil.isNotEmpty(sysProjectIntroduces)) {
// return R.ok(sysProjectIntroduces.getFirst().getRichText());
// }
// }
// }
return R.ok(projectBigScreenService.getProjectGeneralize(projectId));
// return R.ok();
}
/**
@ -347,11 +266,11 @@ public class ProjectBigScreenController extends BaseController {
if (count > 0) {
throw new ServiceException("已存在同名萤石摄像头", HttpStatus.CONFLICT);
}
// todo 更新云端名称
/* Boolean result = ys7Manager.updateDeviceName(one.getDeviceSerial(), deviceName);
// 更新云端名称
Boolean result = ys7Manager.updateDeviceName(one.getDeviceSerial(), deviceName);
if (!result) {
throw new ServiceException("更新云端萤石摄像头名称异常", HttpStatus.ERROR);
}*/
}
}
return toAjax(othYs7DeviceService.updateById(ys7Device));
}

View File

@ -25,4 +25,19 @@ public class OutConstructionAllValueVo implements Serializable {
* 对甲产值
*/
private BigDecimal ownerValue;
/**
* 人工填报数量
*/
private BigDecimal artificialNum;
/**
* 无人机识别数量
*/
private BigDecimal uavNum;
/**
* 确认数量
*/
private BigDecimal confirmNum;
}

View File

@ -171,4 +171,9 @@ public class OutConstructionValueVo implements Serializable {
* 工作类型
*/
private String workType;
/**
* 计量方式0无 1数量 2百分比
*/
private String unitType;
}

View File

@ -275,6 +275,27 @@ public class OutConstructionValueServiceImpl extends ServiceImpl<OutConstruction
.reduce(BigDecimal.ZERO, BigDecimal::add)
.setScale(4, RoundingMode.HALF_UP);
vo.setOwnerValue(ownerValue);
// 统计确认数量
BigDecimal confirmNum = list.stream()
.map(OutConstructionValueVo::getConfirmNum)
.filter(Objects::nonNull)
.map(BigDecimal::valueOf) // 转换成 BigDecimal
.reduce(BigDecimal.ZERO, BigDecimal::add);
vo.setConfirmNum(confirmNum);
// 统计人工填报数量
BigDecimal artificialNum = list.stream()
.map(OutConstructionValueVo::getArtificialNum)
.filter(Objects::nonNull)
.map(BigDecimal::valueOf) // 转换成 BigDecimal
.reduce(BigDecimal.ZERO, BigDecimal::add);
vo.setArtificialNum(artificialNum);
// 统计无人机识别数量
BigDecimal uavNum = list.stream()
.map(OutConstructionValueVo::getUavNum)
.filter(Objects::nonNull)
.map(BigDecimal::valueOf) // 转换成 BigDecimal
.reduce(BigDecimal.ZERO, BigDecimal::add);
vo.setUavNum(uavNum);
return vo;
}
@ -335,6 +356,7 @@ public class OutConstructionValueServiceImpl extends ServiceImpl<OutConstruction
PgsProgressCategoryVo pgsProgressCategoryVo = pgsProgressCategoryService.queryById(vo.getProgressCategoryId());
vo.setProgressCategoryName(pgsProgressCategoryVo.getName());
vo.setWorkType(pgsProgressCategoryVo.getWorkType());
vo.setUnitType(pgsProgressCategoryVo.getUnitType());
PgsProgressCategoryVo pgsProgressCategoryVo1 = pgsProgressCategoryService.queryById(pgsProgressCategoryVo.getParentId());
vo.setCategoryId(pgsProgressCategoryVo1.getId());
vo.setCategoryName(pgsProgressCategoryVo1.getName());

View File

@ -3,6 +3,8 @@ package org.dromara.quality.domain.vo.qualityinspection;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.dromara.common.translation.annotation.Translation;
import org.dromara.common.translation.constant.TransConstant;
import java.util.Date;
@ -23,6 +25,12 @@ public class QltQualityInspectionGis {
/**
* 巡检类型
*/
private String inspectionType;
/**
* 巡检类型名称
*/
@Translation(type = TransConstant.DICT_TYPE_TO_LABEL, mapper = "inspectionType", other = "quality_inspection_check_type")
private String inspectionTypeLabel;
/**

View File

@ -27,7 +27,12 @@ public class QltQualityInspectionListGisVo implements Serializable {
private Long count;
/**
* 巡检情况
* 整改列表
*/
private List<QltQualityInspectionGis> correctList;
/**
* 整改总数
*/
private Long correctSituation;

View File

@ -36,10 +36,8 @@ import org.dromara.quality.domain.vo.qualityinspection.QltQualityInspectionListG
import org.dromara.quality.domain.vo.qualityinspection.QltQualityInspectionVo;
import org.dromara.quality.mapper.QltQualityInspectionMapper;
import org.dromara.quality.service.IQltQualityInspectionService;
import org.dromara.system.domain.vo.SysDictDataVo;
import org.dromara.system.domain.vo.SysOssVo;
import org.dromara.system.service.ISysDictDataService;
import org.dromara.system.service.ISysDictTypeService;
import org.dromara.system.service.ISysOssService;
import org.dromara.system.service.ISysUserService;
import org.dromara.websocket.ChatServerHandler;
@ -83,9 +81,6 @@ public class QltQualityInspectionServiceImpl extends ServiceImpl<QltQualityInspe
@Resource
private ISysDictDataService dictDataService;
@Resource
private ISysDictTypeService dictTypeService;
@Resource
private ChatServerHandler chatServerHandler;
@ -148,39 +143,33 @@ public class QltQualityInspectionServiceImpl extends ServiceImpl<QltQualityInspe
if (CollUtil.isEmpty(qualityInspectionList)) {
return gisVo;
}
// 获取字典值
List<SysDictDataVo> dictDataVoList = dictTypeService.selectDictDataByType(QltQualityConstant.QUALITY_INSPECTION_CHECK_TYPE);
Map<String, String> dictDataMap = dictDataVoList.stream().collect(Collectors.toMap(SysDictDataVo::getDictValue, SysDictDataVo::getDictLabel));
// 获取最新的检查工单
List<QltQualityInspection> topList = qualityInspectionList.stream()
.sorted(Comparator.comparing(QltQualityInspection::getCreateTime).reversed())
.limit(Optional.ofNullable(req.getPageSize()).orElse(20))
.toList();
// 转换为 GIS 对象,并设置标签
List<QltQualityInspectionGis> gisList = topList.stream().map(qualityInspection -> {
// 获取巡检情况
List<QltQualityInspectionGis> list = qualityInspectionList.stream()
.filter(q -> "2".equals(q.getIsReply()))
.toList().stream().map(q -> {
QltQualityInspectionGis gis = new QltQualityInspectionGis();
BeanUtils.copyProperties(qualityInspection, gis);
String label = dictDataMap.get(qualityInspection.getInspectionType());
if (label != null) {
gis.setInspectionTypeLabel(label);
}
BeanUtils.copyProperties(q, gis);
return gis;
}).toList();
gisVo.setList(list.stream()
.sorted(Comparator.comparing(QltQualityInspectionGis::getCreateTime).reversed())
.limit(Optional.ofNullable(req.getPageSize()).orElse(20))
.toList());
gisVo.setCount((long) list.size());
// 获取整改情况
long passCount = 0L;
for (QltQualityInspection qualityInspection : qualityInspectionList) {
if ("1".equals(qualityInspection.getIsReply())) {
if (!qualityInspection.getInspectionStatus().equals(QltQualityInspectionStatusEnum.INFORM.getValue())) {
passCount++;
}
}
}
gisVo.setList(gisList);
gisVo.setCount((long) qualityInspectionList.stream()
.filter(q -> "2".equals(q.getIsReply()))
.toList()
.size());
gisVo.setCorrectSituation(passCount);
List<QltQualityInspectionGis> correctList = qualityInspectionList.stream()
.filter(q -> "1".equals(q.getIsReply()))
.filter(q -> !q.getInspectionStatus().equals(QltQualityInspectionStatusEnum.INFORM.getValue()))
.toList().stream().map(q -> {
QltQualityInspectionGis gis = new QltQualityInspectionGis();
BeanUtils.copyProperties(q, gis);
return gis;
}).toList();
gisVo.setCorrectSituation((long) correctList.size());
gisVo.setCorrectList(correctList.stream()
.sorted(Comparator.comparing(QltQualityInspectionGis::getCreateTime).reversed())
.limit(Optional.ofNullable(req.getPageSize()).orElse(20))
.toList());
// gisVo.setCorrectSituation(String.format("%.2f", passCount * 100.0 / qualityInspectionList.size()));
return gisVo;
}

View File

@ -3,7 +3,6 @@ package org.dromara.safety.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import org.dromara.common.core.domain.R;
import org.dromara.common.excel.utils.ExcelUtil;
@ -74,7 +73,7 @@ public class HseRecognizeRecordController extends BaseController {
@SaCheckPermission("safety:recognizeRecord:remove")
@Log(title = "识别记录", businessType = BusinessType.DELETE)
@DeleteMapping("/{id}")
public R<Void> remove(@NotEmpty(message = "主键不能为空")
public R<Void> remove(@NotNull(message = "主键不能为空")
@PathVariable Long id) {
return toAjax(recognizeRecordService.deleteById(id));
}

View File

@ -0,0 +1,53 @@
package org.dromara.safety.domain.vo.safetyinspection;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
/**
* @author lilemy
* @date 2025-10-17 09:26
*/
@Data
public class HseSafetyInspectionGis implements Serializable {
@Serial
private static final long serialVersionUID = 3098473090533804934L;
/**
* 主键ID
*/
private Long id;
/**
* 项目ID
*/
private Long projectId;
/**
* 检查类型
*/
private String checkType;
/**
* 检查项目
*/
private String checkProject;
/**
* 违章类型
*/
private String violationType;
/**
* 巡检结果
*/
private String inspectionResult;
/**
* 工单状态1通知 2整改 3复查
*/
private String status;
}

View File

@ -27,11 +27,21 @@ public class HseSafetyInspectionListGisVo implements Serializable {
*/
private Long teamMeetingCount;
/**
* 安全巡检列表
*/
private List<HseSafetyInspectionGis> safetyInspectionList;
/**
* 安全巡检总数
*/
private Long safetyInspectionCount;
/**
* 整改情况列表
*/
private List<HseSafetyInspectionGis> correctSituationList;
/**
* 整改情况总数
*/

View File

@ -35,6 +35,7 @@ import org.dromara.safety.domain.HseSafetyInspection;
import org.dromara.safety.domain.HseTeamMeeting;
import org.dromara.safety.domain.dto.safetyinspection.*;
import org.dromara.safety.domain.enums.HseSafetyInspectionStatusEnum;
import org.dromara.safety.domain.vo.safetyinspection.HseSafetyInspectionGis;
import org.dromara.safety.domain.vo.safetyinspection.HseSafetyInspectionListGisVo;
import org.dromara.safety.domain.vo.safetyinspection.HseSafetyInspectionVo;
import org.dromara.safety.domain.vo.teammeeting.HseTeamMeetingGis;
@ -229,11 +230,28 @@ public class HseSafetyInspectionServiceImpl extends ServiceImpl<HseSafetyInspect
}
}
}
List<HseSafetyInspection> passList = safetyInspectionList.stream()
.filter(q -> "1".equals(q.getIsReply()))
.filter(q -> !q.getStatus().equals(HseSafetyInspectionStatusEnum.INFORM.getValue()))
.toList();
List<HseSafetyInspectionGis> pass = passList.stream().map(s -> {
HseSafetyInspectionGis gis = new HseSafetyInspectionGis();
BeanUtils.copyProperties(s, gis);
return gis;
}).toList();
gisVo.setTeamMeetingCount((long) teamMeetings.size());
gisVo.setSafetyInspectionCount((long) safetyInspectionList.stream()
List<HseSafetyInspectionGis> inspections = safetyInspectionList.stream()
.filter(q -> "2".equals(q.getIsReply()))
.toList().size());
.toList()
.stream().map(p -> {
HseSafetyInspectionGis gis = new HseSafetyInspectionGis();
BeanUtils.copyProperties(p, gis);
return gis;
}).toList();
gisVo.setSafetyInspectionCount((long) inspections.size());
gisVo.setSafetyInspectionList(inspections);
gisVo.setCorrectSituationCount(passCount);
gisVo.setCorrectSituationList(pass);
gisVo.setCorrectSituation(String.format("%.2f", passCount * 100.0 / safetyInspectionList.size()));
return gisVo;
}