企业大屏

This commit is contained in:
lcj
2025-09-12 19:49:28 +08:00
parent d77e12ee4e
commit dd025df653
10 changed files with 172 additions and 48 deletions

View File

@ -55,6 +55,14 @@ spring:
url: jdbc:mysql://192.168.110.2:13386/xinnengyuan?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true url: jdbc:mysql://192.168.110.2:13386/xinnengyuan?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
username: xinnengyuan username: xinnengyuan
password: mEZPC5Sdf3r2HENi password: mEZPC5Sdf3r2HENi
# 从库数据源
slave:
lazy: true
type: ${spring.datasource.type}
driverClassName: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://192.168.110.2:13386/zmkgc?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
username: zmkgc
password: nWKDKRNRT48tFBdh
# # 从库数据源 # # 从库数据源
# slave: # slave:
# lazy: true # lazy: true

View File

@ -77,6 +77,15 @@ public class EnterpriseBigScreenController {
return R.ok(enterpriseBigScreenService.getProjectOutputValueComparison()); return R.ok(enterpriseBigScreenService.getProjectOutputValueComparison());
} }
/**
* 项目进度完成度和计划容量
*/
@SaCheckPermission("enterprise:bigScreen:projectProgressCapacity")
@GetMapping("/projectProgressCapacity")
public R<List<ProjectProgressCapacityVo>> getProjectProgressCapacity() {
return R.ok(enterpriseBigScreenService.getProjectProgressCapacity());
}
/** /**
* 风险预警 * 风险预警
*/ */

View File

@ -164,9 +164,9 @@ public class ProjectBigScreenController {
projectId = project.getGoId(); projectId = project.getGoId();
String pic; String pic;
if (projectId == 60) { if (projectId == 60) {
pic = "http://xny.yj-3d.com:7363/"; pic = "http://xny.yj-3d.com:7464";
} else { } else {
pic = "http://xny.yj-3d.com:7464/"; pic = "http://xny.yj-3d.com:7363";
} }
List<BusTour> busTours = projectBigScreenMapper.selectTourByProjectId(projectId); List<BusTour> busTours = projectBigScreenMapper.selectTourByProjectId(projectId);
return R.ok(busTours.stream().map(tour -> { return R.ok(busTours.stream().map(tour -> {
@ -256,7 +256,9 @@ public class ProjectBigScreenController {
Long goId = project.getGoId(); Long goId = project.getGoId();
if (goId != null) { if (goId != null) {
List<SysProjectIntroduce> sysProjectIntroduces = projectBigScreenMapper.selectByProjectId(goId); List<SysProjectIntroduce> sysProjectIntroduces = projectBigScreenMapper.selectByProjectId(goId);
return R.ok(sysProjectIntroduces.getFirst().getRichText()); if (CollUtil.isNotEmpty(sysProjectIntroduces)) {
return R.ok(sysProjectIntroduces.getFirst().getRichText());
}
} }
} }
// return R.ok(projectBigScreenService.getProjectGeneralize(projectId)); // return R.ok(projectBigScreenService.getProjectGeneralize(projectId));

View File

@ -17,22 +17,22 @@ public class EnterpriseKeyIndexVo implements Serializable {
private static final long serialVersionUID = -3987781906203623727L; private static final long serialVersionUID = -3987781906203623727L;
/** /**
* 在建项目数量 * 光伏项目数量
*/ */
private Long ongoingProject; private Integer photovoltaicCount;
/** /**
* 合同总额(单位:亿元) * 风电项目数量
*/ */
private Long totalContractAmount; private Integer windElectricityCount;
/** /**
* 总容量 * 光伏项目总容量
*/ */
private BigDecimal totalCapacity; private BigDecimal photovoltaicTotalCapacity;
/** /**
* 今日施工项目数 * 风电项目总容
*/ */
private Long todayProject; private BigDecimal windElectricityTotalCapacity;
} }

View File

@ -0,0 +1,39 @@
package org.dromara.bigscreen.domain.vo;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* @author lilemy
* @date 2025-09-12 18:55
*/
@Data
public class ProjectProgressCapacityVo implements Serializable {
@Serial
private static final long serialVersionUID = -7370580195063977801L;
/**
* 项目id
*/
private Long projectId;
/**
* 项目名称
*/
private String projectName;
/**
* 进度百分比
*/
private BigDecimal progressPercentage;
/**
* 计划容量
*/
private BigDecimal plannedCapacity;
}

View File

@ -1,10 +1,7 @@
package org.dromara.bigscreen.service; package org.dromara.bigscreen.service;
import org.dromara.bigscreen.domain.dto.WeatherQueryReq; import org.dromara.bigscreen.domain.dto.WeatherQueryReq;
import org.dromara.bigscreen.domain.vo.EnterpriseKeyIndexVo; import org.dromara.bigscreen.domain.vo.*;
import org.dromara.bigscreen.domain.vo.OutputValueComparisonVo;
import org.dromara.bigscreen.domain.vo.ProjectProgressAnalysisVo;
import org.dromara.bigscreen.domain.vo.RiskEarlyWarningVo;
import org.dromara.manager.weathermanager.vo.WeatherVo; import org.dromara.manager.weathermanager.vo.WeatherVo;
import java.util.List; import java.util.List;
@ -50,4 +47,11 @@ public interface EnterpriseBigScreenService {
* @return 天气列表 * @return 天气列表
*/ */
List<WeatherVo> getWeather3DaysList(WeatherQueryReq req); List<WeatherVo> getWeather3DaysList(WeatherQueryReq req);
/**
* 获取项目进度占比
*
* @return 项目进度占比
*/
List<ProjectProgressCapacityVo> getProjectProgressCapacity();
} }

View File

@ -8,8 +8,6 @@ import org.dromara.bigscreen.service.EnterpriseBigScreenService;
import org.dromara.common.core.enums.BusinessStatusEnum; import org.dromara.common.core.enums.BusinessStatusEnum;
import org.dromara.common.core.utils.DateUtils; import org.dromara.common.core.utils.DateUtils;
import org.dromara.common.utils.BigDecimalUtil; import org.dromara.common.utils.BigDecimalUtil;
import org.dromara.ctr.domain.CtrExpensesContract;
import org.dromara.ctr.domain.CtrIncomeContract;
import org.dromara.ctr.service.ICtrExpensesContractService; import org.dromara.ctr.service.ICtrExpensesContractService;
import org.dromara.ctr.service.ICtrIncomeContractService; import org.dromara.ctr.service.ICtrIncomeContractService;
import org.dromara.manager.weathermanager.WeatherConstant; import org.dromara.manager.weathermanager.WeatherConstant;
@ -24,7 +22,6 @@ import org.dromara.out.service.IOutConstructionValueService;
import org.dromara.out.service.IOutMonthPlanAuditService; import org.dromara.out.service.IOutMonthPlanAuditService;
import org.dromara.out.service.IOutValueAllocationService; import org.dromara.out.service.IOutValueAllocationService;
import org.dromara.progress.domain.PgsProgressCategory; import org.dromara.progress.domain.PgsProgressCategory;
import org.dromara.progress.domain.PgsProgressPlanDetail;
import org.dromara.progress.service.IPgsProgressCategoryService; import org.dromara.progress.service.IPgsProgressCategoryService;
import org.dromara.progress.service.IPgsProgressPlanDetailService; import org.dromara.progress.service.IPgsProgressPlanDetailService;
import org.dromara.project.domain.BusProject; import org.dromara.project.domain.BusProject;
@ -39,7 +36,6 @@ import org.springframework.stereotype.Service;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.time.LocalDate;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -102,36 +98,32 @@ public class EnterpriseBigScreenServiceImpl implements EnterpriseBigScreenServic
.eq(BusProject::getStatus, 0) .eq(BusProject::getStatus, 0)
.eq(BusProject::getPId, 0) .eq(BusProject::getPId, 0)
.list(); .list();
// 总容量 // 光伏项目
BigDecimal totalCapacity = projectList.stream().map(BusProject::getActual) int photovoltaicCount = projectList.stream()
.filter(s -> s.getProjectType().equals("1"))
.toList()
.size();
BigDecimal photovoltaicTotalCapacity = projectList.stream()
.filter(s -> s.getProjectType().equals("1"))
.map(BusProject::getActual)
.filter(s -> s != null && !s.isBlank()) // 过滤掉空值 .filter(s -> s != null && !s.isBlank()) // 过滤掉空值
.map(BigDecimal::new) // 转成 BigDecimal .map(BigDecimal::new) // 转成 BigDecimal
.reduce(BigDecimal.ZERO, BigDecimal::add); .reduce(BigDecimal.ZERO, BigDecimal::add);
// 总合同金额 // 风电项目
List<CtrIncomeContract> incomeContractList = incomeContractService.lambdaQuery() int windElectricityCount = projectList.stream()
.select(CtrIncomeContract::getAmount) .filter(s -> s.getProjectType().equals("2"))
.list(); .toList()
BigDecimal totalIncomeAmount = incomeContractList.stream() .size();
.map(CtrIncomeContract::getAmount) BigDecimal windElectricityTotalCapacity = projectList.stream()
.filter(Objects::nonNull) .filter(s -> s.getProjectType().equals("2"))
.map(BusProject::getActual)
.filter(s -> s != null && !s.isBlank()) // 过滤掉空值
.map(BigDecimal::new) // 转成 BigDecimal
.reduce(BigDecimal.ZERO, BigDecimal::add); .reduce(BigDecimal.ZERO, BigDecimal::add);
List<CtrExpensesContract> expensesContractList = expensesContractService.lambdaQuery() vo.setPhotovoltaicCount(photovoltaicCount);
.select(CtrExpensesContract::getAmount) vo.setWindElectricityCount(windElectricityCount);
.list(); vo.setPhotovoltaicTotalCapacity(photovoltaicTotalCapacity);
BigDecimal totalExpensesAmount = expensesContractList.stream() vo.setWindElectricityTotalCapacity(windElectricityTotalCapacity);
.map(CtrExpensesContract::getAmount)
.filter(Objects::nonNull)
.reduce(BigDecimal.ZERO, BigDecimal::add);
// 今日施工项目数量
Long todayProject = progressPlanDetailService.lambdaQuery()
.select(PgsProgressPlanDetail::getProjectId)
.eq(PgsProgressPlanDetail::getDate, LocalDate.now())
.list()
.stream().map(PgsProgressPlanDetail::getProjectId).distinct().count();
vo.setOngoingProject((long) projectList.size());
vo.setTotalCapacity(totalCapacity);
vo.setTotalContractAmount(totalIncomeAmount.add(totalExpensesAmount).longValue());
vo.setTodayProject(todayProject);
return vo; return vo;
} }
@ -380,4 +372,69 @@ public class EnterpriseBigScreenServiceImpl implements EnterpriseBigScreenServic
public List<WeatherVo> getWeather3DaysList(WeatherQueryReq req) { public List<WeatherVo> getWeather3DaysList(WeatherQueryReq req) {
return weatherManager.getWeatherListVo(req.getLng(), req.getLat(), WeatherConstant.THREE_DAYS_WEATHER_PATH); return weatherManager.getWeatherListVo(req.getLng(), req.getLat(), WeatherConstant.THREE_DAYS_WEATHER_PATH);
} }
/**
* 获取项目进度占比
*
* @return 项目进度占比
*/
@Override
public List<ProjectProgressCapacityVo> getProjectProgressCapacity() {
// 1. 查询顶级项目
List<BusProject> projectList = projectService.lambdaQuery()
.select(BusProject::getId, BusProject::getProjectName, BusProject::getActual, BusProject::getPlan)
.eq(BusProject::getStatus, 0)
.eq(BusProject::getPId, 0)
.list();
if (CollUtil.isEmpty(projectList)) {
return List.of();
}
// 2. 拿到顶级项目 id
List<Long> projectIds = projectList.stream()
.map(BusProject::getId)
.distinct()
.toList();
// 3. 查询子项目pId 在顶级项目id里
List<BusProject> subProject = projectService.lambdaQuery()
.select(BusProject::getId, BusProject::getPId)
.in(BusProject::getPId, projectIds)
.list();
// 4. 按父项目id分组子项目
Map<Long, List<BusProject>> subProjectMap = subProject.stream()
.collect(Collectors.groupingBy(BusProject::getPId));
// 5. 查询所有子项目的进度分类
List<PgsProgressCategory> progressCategoryList = progressCategoryService.lambdaQuery()
.select(PgsProgressCategory::getId,
PgsProgressCategory::getProjectId,
PgsProgressCategory::getCompleted,
PgsProgressCategory::getTotal)
.in(CollUtil.isNotEmpty(subProject),
PgsProgressCategory::getProjectId,
subProject.stream().map(BusProject::getId).toList())
.list();
// 6. 按子项目id分组进度分类
Map<Long, List<PgsProgressCategory>> progressCategoryMap = progressCategoryList.stream()
.collect(Collectors.groupingBy(PgsProgressCategory::getProjectId));
return projectList.stream().map(project -> {
ProjectProgressCapacityVo detailVo = new ProjectProgressCapacityVo();
detailVo.setProjectId(project.getId());
detailVo.setProjectName(project.getProjectName());
detailVo.setPlannedCapacity(new BigDecimal(project.getPlan()));
List<BusProject> children = subProjectMap.getOrDefault(project.getId(), List.of());
List<PgsProgressCategory> categoryList = new ArrayList<>();
for (BusProject child : children) {
categoryList.addAll(progressCategoryMap.getOrDefault(child.getId(), List.of()));
}
if (CollUtil.isNotEmpty(categoryList)) {
BigDecimal completed = categoryList.stream().map(PgsProgressCategory::getCompleted)
.filter(Objects::nonNull)
.reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal total = categoryList.stream().map(PgsProgressCategory::getTotal)
.filter(Objects::nonNull)
.reduce(BigDecimal.ZERO, BigDecimal::add);
detailVo.setProgressPercentage(BigDecimalUtil.toPercentage(completed, total));
}
return detailVo;
}).toList();
}
} }

View File

@ -13,7 +13,7 @@ import org.springframework.stereotype.Component;
* @date 2025/5/29 9:38 * @date 2025/5/29 9:38
*/ */
@Slf4j @Slf4j
@Component //@Component
public class IncSyncValidProgressPlanIsDelay { public class IncSyncValidProgressPlanIsDelay {
@Resource @Resource

View File

@ -9,6 +9,8 @@ import org.dromara.common.core.xss.Xss;
import org.dromara.common.mybatis.core.domain.BaseEntity; import org.dromara.common.mybatis.core.domain.BaseEntity;
import org.dromara.system.domain.SysNotice; import org.dromara.system.domain.SysNotice;
import java.io.Serial;
/** /**
* 通知公告业务对象 sys_notice * 通知公告业务对象 sys_notice
* *
@ -20,6 +22,9 @@ import org.dromara.system.domain.SysNotice;
@AutoMapper(target = SysNotice.class, reverseConvertGenerate = false) @AutoMapper(target = SysNotice.class, reverseConvertGenerate = false)
public class SysNoticeBo extends BaseEntity { public class SysNoticeBo extends BaseEntity {
@Serial
private static final long serialVersionUID = -6718628284877138550L;
/** /**
* 公告ID * 公告ID
*/ */

View File

@ -416,8 +416,8 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
insertUserRole(user, true); insertUserRole(user, true);
// 新增用户与岗位管理 // 新增用户与岗位管理
insertUserPost(user, true); insertUserPost(user, true);
// 获取旧的系统用户 /* // 获取旧的系统用户
SysUser oldUser = baseMapper.selectById(user.getUserId()); SysUser oldUser = baseMapper.selectById(user.getUserId());*/
SysUser sysUser = MapstructUtils.convert(user, SysUser.class); SysUser sysUser = MapstructUtils.convert(user, SysUser.class);
// 防止错误更新后导致的数据误删除 // 防止错误更新后导致的数据误删除
int flag = baseMapper.updateById(sysUser); int flag = baseMapper.updateById(sysUser);