Compare commits

..

30 Commits

Author SHA1 Message Date
542c4e91ac 09-10-netty优化系统房间的创建 2025-09-11 17:24:55 +08:00
47b0a4b087 09-10-netty优化,将系统消息存储为JSON 2025-09-11 17:18:51 +08:00
6ace8b0dc2 09-10-netty优化,序号修复,新增移除审核 2025-09-11 16:04:01 +08:00
1e33027d4f 修改金额精度问题 2025-09-11 15:26:07 +08:00
9fbc9dbc45 09-10-netty优化已读返回 2025-09-11 15:21:19 +08:00
8bf12d04cd 09-10-netty优化已读返回 2025-09-11 15:18:53 +08:00
00dcc00b05 09-10-netty优化 2025-09-11 11:17:55 +08:00
0b29401112 09-10-netty发送时添加name字段 2025-09-11 11:14:22 +08:00
lcj
e8c78865cb 接go数据 2025-09-11 09:23:39 +08:00
zt
a8cb16ab3f 通知 2025-09-10 20:21:01 +08:00
2c45762c66 09-10-netty优化 2025-09-10 19:41:11 +08:00
056b28af31 我的任务优化、工程量清单优化、gps消息websocket连接、物资管理:物资验收入库添加附件 2025-09-10 19:38:10 +08:00
lcj
7dd6d97a3e 进度管理app 2025-09-10 19:18:30 +08:00
zt
697beb67c4 通知 2025-09-10 17:34:49 +08:00
lcj
4d627af3a1 进度管理app、注解翻译项目名称 2025-09-10 16:43:49 +08:00
ab332c462f 09-10-netty设置系统消息type为2 2025-09-10 16:11:30 +08:00
0f3d1e38be 09-10-netty优化 2025-09-10 16:00:43 +08:00
lcj
4392a287cc 修改bug 2025-09-10 10:03:53 +08:00
lcj
f38538be33 修改进度管理 2025-09-10 00:15:55 +08:00
lcj
ede1e501b4 企业级大屏 2025-09-09 23:42:24 +08:00
4a2b62cf92 我的任务bug修改 2025-09-09 21:52:49 +08:00
zt
325f392e8f 大屏,消息 2025-09-09 20:39:00 +08:00
lcj
5b991396c2 企业级大屏 2025-09-09 19:49:14 +08:00
c75563b46a 09-09-修改 2025-09-09 18:53:28 +08:00
724ebf8dbd 09-09-netty完善修改 2025-09-09 18:47:48 +08:00
a52b9078a0 gps定位接口 2025-09-09 17:47:49 +08:00
9d682a3290 09-09-netty发送系统消息 2025-09-09 17:08:39 +08:00
lcj
abad289c2b 进度管理,企业级大屏,修改bug 2025-09-09 15:42:00 +08:00
820188863e 修改一览表单价精度 2025-09-09 15:24:17 +08:00
113b5debc9 供应商bug修改 2025-09-09 10:40:17 +08:00
150 changed files with 4101 additions and 514 deletions

View File

@ -307,7 +307,6 @@
<artifactId>snail-job-client-job-core</artifactId> <artifactId>snail-job-client-job-core</artifactId>
<version>${snailjob.version}</version> <version>${snailjob.version}</version>
</dependency> </dependency>
<!-- 加密包引入 --> <!-- 加密包引入 -->
<dependency> <dependency>
<groupId>org.bouncycastle</groupId> <groupId>org.bouncycastle</groupId>

View File

@ -6,6 +6,7 @@ import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.codec.Base64; import cn.hutool.core.codec.Base64;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONObject;
import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -41,16 +42,20 @@ import org.dromara.web.domain.vo.TenantListVo;
import org.dromara.web.service.IAuthStrategy; import org.dromara.web.service.IAuthStrategy;
import org.dromara.web.service.SysLoginService; import org.dromara.web.service.SysLoginService;
import org.dromara.web.service.SysRegisterService; import org.dromara.web.service.SysRegisterService;
import org.dromara.websocket.domain.ChatGroup;
import org.dromara.websocket.service.Impl.ChatGroupServiceImpl;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.net.URL; import java.net.URL;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/** /**
* 认证 * 认证
@ -72,6 +77,7 @@ public class AuthController {
private final ISysSocialService socialUserService; private final ISysSocialService socialUserService;
private final ISysClientService clientService; private final ISysClientService clientService;
private final ScheduledExecutorService scheduledExecutorService; private final ScheduledExecutorService scheduledExecutorService;
private final ChatGroupServiceImpl chatGroupService;
/** /**
@ -103,10 +109,7 @@ public class AuthController {
// Long userId = LoginHelper.getUserId(); // Long userId = LoginHelper.getUserId();
// scheduledExecutorService.schedule(() -> { // scheduledExecutorService.schedule(() -> {
// SseMessageDto dto = new SseMessageDto(); // chatGroupService.createSystem(userId,client.getClientKey());
// dto.setMessage("欢迎登录新能源项目管理系统");
// dto.setUserIds(List.of(userId));
// SseMessageUtils.publishMessage(dto);
// }, 5, TimeUnit.SECONDS); // }, 5, TimeUnit.SECONDS);
return R.ok(loginVo); return R.ok(loginVo);
} }

View File

@ -55,7 +55,8 @@ public class UserActionListener implements SaTokenListener {
String username = (String) loginModel.getExtra(LoginHelper.USER_NAME_KEY); String username = (String) loginModel.getExtra(LoginHelper.USER_NAME_KEY);
String tenantId = (String) loginModel.getExtra(LoginHelper.TENANT_KEY); String tenantId = (String) loginModel.getExtra(LoginHelper.TENANT_KEY);
dto.setUserName(username); dto.setUserName(username);
dto.setClientKey((String) loginModel.getExtra(LoginHelper.CLIENT_KEY)); String clientId = (String) loginModel.getExtra(LoginHelper.CLIENT_KEY);
dto.setClientKey(clientId);
dto.setDeviceType(loginModel.getDevice()); dto.setDeviceType(loginModel.getDevice());
dto.setDeptName((String) loginModel.getExtra(LoginHelper.DEPT_NAME_KEY)); dto.setDeptName((String) loginModel.getExtra(LoginHelper.DEPT_NAME_KEY));
TenantHelper.dynamic(tenantId, () -> { TenantHelper.dynamic(tenantId, () -> {
@ -75,7 +76,7 @@ public class UserActionListener implements SaTokenListener {
SpringUtils.context().publishEvent(logininforEvent); SpringUtils.context().publishEvent(logininforEvent);
// 更新登录信息 // 更新登录信息
loginService.recordLoginInfo((Long) loginModel.getExtra(LoginHelper.USER_KEY), ip); loginService.recordLoginInfo((Long) loginModel.getExtra(LoginHelper.USER_KEY), ip);
log.info("user doLogin, userId:{}, token:{}", loginId, tokenValue); log.info("user doLogin, userId:{}, token:{}, clientid{}", loginId, tokenValue, clientId);
} }
/** /**

View File

@ -53,13 +53,13 @@ spring:
username: xinnengyuandev username: xinnengyuandev
password: StRWCZdZirysNSs2 password: StRWCZdZirysNSs2
# 从库数据源 # 从库数据源
# slave: slave:
# lazy: true lazy: true
# type: ${spring.datasource.type} type: ${spring.datasource.type}
# driverClassName: com.mysql.cj.jdbc.Driver driverClassName: com.mysql.cj.jdbc.Driver
# url: jdbc:mysql://192.168.110.2:13386/zmkgdev?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/zmkgdev?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
# username: zmkgdev username: zmkgdev
# password: JhYxREf25AXdy3h8 password: JhYxREf25AXdy3h8
# oracle: # oracle:
# type: ${spring.datasource.type} # type: ${spring.datasource.type}
# driverClassName: oracle.jdbc.OracleDriver # driverClassName: oracle.jdbc.OracleDriver
@ -287,7 +287,7 @@ sparta:
id-card: id-card:
encrypt-key: 7ae260d150a14027d2238a1cf80a48ef encrypt-key: 7ae260d150a14027d2238a1cf80a48ef
recognizer: recognizer:
url: http://192.168.110.5:50070 url: http://192.168.110.5:50071
qrCode: qrCode:
url: http://192.168.110.151:7788 url: http://192.168.110.151:7788

View File

@ -273,7 +273,7 @@ weather:
api-host: n35rk53njv.re.qweatherapi.com api-host: n35rk53njv.re.qweatherapi.com
# dxf转 geojson 执行文件名 # dxf转 geojson 执行文件名
dxf2GeoJson: dxf2GeoJson:
file-name: main.exe file-name: main
ys7: ys7:
app-key: 3acf9f1a43dc4209841e0893003db0a2 app-key: 3acf9f1a43dc4209841e0893003db0a2
app-secret: 4bbf3e9394f55d3af6e3af27b2d3db36 app-secret: 4bbf3e9394f55d3af6e3af27b2d3db36
@ -286,7 +286,7 @@ sparta:
id-card: id-card:
encrypt-key: 7ae260d150a14027d2238a1cf80a48ef encrypt-key: 7ae260d150a14027d2238a1cf80a48ef
recognizer: recognizer:
url: http://192.168.110.5:50070 url: http://192.168.110.5:50071
qrCode: qrCode:
url: http://xny.yj-3d.com:7788 url: http://xny.yj-3d.com:7788

View File

@ -80,4 +80,9 @@ public interface CacheNames {
*/ */
String ONLINE_TOKEN = "online_tokens"; String ONLINE_TOKEN = "online_tokens";
/**
* 项目名称
*/
String PROJECT_NAME = "project_name#30d";
} }

View File

@ -0,0 +1,17 @@
package org.dromara.common.core.service;
/**
* @author lilemy
* @date 2025-09-10 16:15
*/
public interface ProjectService {
/**
* 通过项目ID查询项目名称
*
* @param projectId 项目ID
* @return 项目名称
*/
String selectProjectNameById(Long projectId);
}

View File

@ -32,4 +32,9 @@ public interface TransConstant {
*/ */
String OSS_ID_TO_URL = "oss_id_to_url"; String OSS_ID_TO_URL = "oss_id_to_url";
/**
* 项目id转名称
*/
String PROJECT_ID_TO_NAME = "project_id_to_name";
} }

View File

@ -0,0 +1,35 @@
package org.dromara.common.translation.core.impl;
import jakarta.annotation.Resource;
import lombok.AllArgsConstructor;
import org.dromara.common.core.service.ProjectService;
import org.dromara.common.translation.annotation.TranslationType;
import org.dromara.common.translation.constant.TransConstant;
import org.dromara.common.translation.core.TranslationInterface;
/**
* @author lilemy
* @date 2025-09-10 16:13
*/
@AllArgsConstructor
@TranslationType(type = TransConstant.PROJECT_ID_TO_NAME)
public class ProjectNameTranslationImpl implements TranslationInterface<String> {
@Resource
private ProjectService projectService;
/**
* 翻译
*
* @param key 需要被翻译的键(不为空)
* @param other 其他参数
* @return 返回键对应的值
*/
@Override
public String translation(Object key, String other) {
if (key instanceof Long id) {
return projectService.selectProjectNameById(id);
}
return null;
}
}

View File

@ -4,3 +4,4 @@ org.dromara.common.translation.core.impl.DictTypeTranslationImpl
org.dromara.common.translation.core.impl.OssUrlTranslationImpl org.dromara.common.translation.core.impl.OssUrlTranslationImpl
org.dromara.common.translation.core.impl.UserNameTranslationImpl org.dromara.common.translation.core.impl.UserNameTranslationImpl
org.dromara.common.translation.core.impl.NicknameTranslationImpl org.dromara.common.translation.core.impl.NicknameTranslationImpl
org.dromara.common.translation.core.impl.ProjectNameTranslationImpl

View File

@ -12,6 +12,8 @@ public interface WebSocketConstants {
*/ */
String LOGIN_USER_KEY = "loginUser"; String LOGIN_USER_KEY = "loginUser";
String PROJECT_ID = "projectId";
/** /**
* 订阅的频道 * 订阅的频道
*/ */

View File

@ -13,6 +13,7 @@ import java.io.IOException;
import java.util.List; import java.util.List;
import static org.dromara.common.websocket.constant.WebSocketConstants.LOGIN_USER_KEY; import static org.dromara.common.websocket.constant.WebSocketConstants.LOGIN_USER_KEY;
import static org.dromara.common.websocket.constant.WebSocketConstants.PROJECT_ID;
/** /**
* WebSocketHandler 实现类 * WebSocketHandler 实现类
@ -27,14 +28,17 @@ public class PlusWebSocketHandler extends AbstractWebSocketHandler {
*/ */
@Override @Override
public void afterConnectionEstablished(WebSocketSession session) throws IOException { public void afterConnectionEstablished(WebSocketSession session) throws IOException {
LoginUser loginUser = (LoginUser) session.getAttributes().get(LOGIN_USER_KEY); // LoginUser loginUser = (LoginUser) session.getAttributes().get(LOGIN_USER_KEY);
if (ObjectUtil.isNull(loginUser)) { Long loginUser = (Long) session.getAttributes().get(PROJECT_ID);
// if (ObjectUtil.isNull(loginUser) ) {
if (loginUser == null ) {
session.close(CloseStatus.BAD_DATA); session.close(CloseStatus.BAD_DATA);
log.info("[connect] invalid token received. sessionId: {}", session.getId()); log.info("[connect] invalid token received. sessionId: {}", session.getId());
return; return;
} }
WebSocketSessionHolder.addSession(loginUser.getUserId(), session); WebSocketSessionHolder.addSession(loginUser, session);
log.info("[connect] sessionId: {},userId:{},userType:{}", session.getId(), loginUser.getUserId(), loginUser.getUserType()); // WebSocketSessionHolder.addSession(loginUser.getUserId(), session);
// log.info("[connect] sessionId: {},userId:{},userType:{}", session.getId(), loginUser.getUserId(), loginUser.getUserType());
} }
/** /**
@ -47,11 +51,13 @@ public class PlusWebSocketHandler extends AbstractWebSocketHandler {
@Override @Override
protected void handleTextMessage(WebSocketSession session, TextMessage message) throws Exception { protected void handleTextMessage(WebSocketSession session, TextMessage message) throws Exception {
// 从WebSocket会话中获取登录用户信息 // 从WebSocket会话中获取登录用户信息
LoginUser loginUser = (LoginUser) session.getAttributes().get(LOGIN_USER_KEY); // LoginUser loginUser = (LoginUser) session.getAttributes().get(LOGIN_USER_KEY);
Long loginUser = (Long) session.getAttributes().get(PROJECT_ID);
// 创建WebSocket消息DTO对象 // 创建WebSocket消息DTO对象
WebSocketMessageDto webSocketMessageDto = new WebSocketMessageDto(); WebSocketMessageDto webSocketMessageDto = new WebSocketMessageDto();
webSocketMessageDto.setSessionKeys(List.of(loginUser.getUserId())); // webSocketMessageDto.setSessionKeys(List.of(loginUser.getUserId()));
webSocketMessageDto.setSessionKeys(List.of(loginUser));
webSocketMessageDto.setMessage(message.getPayload()); webSocketMessageDto.setMessage(message.getPayload());
WebSocketUtils.publishMessage(webSocketMessageDto); WebSocketUtils.publishMessage(webSocketMessageDto);
} }
@ -100,13 +106,16 @@ public class PlusWebSocketHandler extends AbstractWebSocketHandler {
*/ */
@Override @Override
public void afterConnectionClosed(WebSocketSession session, CloseStatus status) { public void afterConnectionClosed(WebSocketSession session, CloseStatus status) {
LoginUser loginUser = (LoginUser) session.getAttributes().get(LOGIN_USER_KEY); // LoginUser loginUser = (LoginUser) session.getAttributes().get(LOGIN_USER_KEY);
if (ObjectUtil.isNull(loginUser)) { Long loginUser = (Long) session.getAttributes().get(PROJECT_ID);
// if (ObjectUtil.isNull(loginUser)) {
if (loginUser != null ) {
log.info("[disconnect] invalid token received. sessionId: {}", session.getId()); log.info("[disconnect] invalid token received. sessionId: {}", session.getId());
return; return;
} }
WebSocketSessionHolder.removeSession(loginUser.getUserId()); // WebSocketSessionHolder.removeSession(loginUser.getUserId());
log.info("[disconnect] sessionId: {},userId:{},userType:{}", session.getId(), loginUser.getUserId(), loginUser.getUserType()); WebSocketSessionHolder.removeSession(loginUser);
// log.info("[disconnect] sessionId: {},userId:{},userType:{}", session.getId(), loginUser.getUserId(), loginUser.getUserType());
} }
/** /**

View File

@ -15,6 +15,7 @@ import org.springframework.web.socket.server.HandshakeInterceptor;
import java.util.Map; import java.util.Map;
import static org.dromara.common.websocket.constant.WebSocketConstants.LOGIN_USER_KEY; import static org.dromara.common.websocket.constant.WebSocketConstants.LOGIN_USER_KEY;
import static org.dromara.common.websocket.constant.WebSocketConstants.PROJECT_ID;
/** /**
* WebSocket握手请求的拦截器 * WebSocket握手请求的拦截器
@ -44,6 +45,8 @@ public class PlusWebSocketInterceptor implements HandshakeInterceptor {
String headerCid = ServletUtils.getRequest().getHeader(LoginHelper.CLIENT_KEY); String headerCid = ServletUtils.getRequest().getHeader(LoginHelper.CLIENT_KEY);
String paramCid = ServletUtils.getParameter(LoginHelper.CLIENT_KEY); String paramCid = ServletUtils.getParameter(LoginHelper.CLIENT_KEY);
String clientId = StpUtil.getExtra(LoginHelper.CLIENT_KEY).toString(); String clientId = StpUtil.getExtra(LoginHelper.CLIENT_KEY).toString();
String projectIdStr = ServletUtils.getRequest().getParameter("projectId");
Long projectId = Long.parseLong(projectIdStr);
if (!StringUtils.equalsAny(clientId, headerCid, paramCid)) { if (!StringUtils.equalsAny(clientId, headerCid, paramCid)) {
// token 无效 // token 无效
throw NotLoginException.newInstance(StpUtil.getLoginType(), throw NotLoginException.newInstance(StpUtil.getLoginType(),
@ -52,6 +55,7 @@ public class PlusWebSocketInterceptor implements HandshakeInterceptor {
} }
attributes.put(LOGIN_USER_KEY, loginUser); attributes.put(LOGIN_USER_KEY, loginUser);
attributes.put(PROJECT_ID,projectId);
return true; return true;
} catch (NotLoginException e) { } catch (NotLoginException e) {
log.error("WebSocket 认证失败'{}',无法访问系统资源", e.getMessage()); log.error("WebSocket 认证失败'{}',无法访问系统资源", e.getMessage());

View File

@ -42,6 +42,14 @@ public class BusBiddingLimitVersions extends BaseEntity {
*/ */
private String versions; private String versions;
/**
* 版本号名称
*/
private String versionsName;
/** /**
* excel文件 * excel文件
*/ */

View File

@ -44,6 +44,14 @@ public class BusBiddingLimitVersionsBo extends BaseEntity {
@NotBlank(message = "版本号不能为空", groups = { AddGroup.class, EditGroup.class }) @NotBlank(message = "版本号不能为空", groups = { AddGroup.class, EditGroup.class })
private String versions; private String versions;
/**
* 版本号名称
*/
private String versionsName;
/** /**
* excel文件 * excel文件
*/ */

View File

@ -52,6 +52,14 @@ public class BusBiddingLimitVersionsVo implements Serializable {
@ExcelProperty(value = "版本号") @ExcelProperty(value = "版本号")
private String versions; private String versions;
/**
* 版本号名称
*/
private String versionsName;
/** /**
* excel文件 * excel文件
*/ */

View File

@ -189,7 +189,7 @@ public class BusBiddingLimitListServiceImpl extends ServiceImpl<BusBiddingLimitL
listVoList.stream().filter(vo -> vo.getUnitPrice() != null && vo.getUnitPrice().compareTo(BigDecimal.ZERO) != 0) listVoList.stream().filter(vo -> vo.getUnitPrice() != null && vo.getUnitPrice().compareTo(BigDecimal.ZERO) != 0)
.filter(vo -> vo.getQuantity() != null && vo.getQuantity().compareTo(BigDecimal.ZERO) != 0) .filter(vo -> vo.getQuantity() != null && vo.getQuantity().compareTo(BigDecimal.ZERO) != 0)
.forEach(item -> { .forEach(item -> {
item.setPrice(item.getUnitPrice().multiply(item.getQuantity()).setScale(2, RoundingMode.HALF_UP)); item.setPrice(item.getUnitPrice().multiply(item.getQuantity()).setScale(4, RoundingMode.HALF_UP));
}); });
//构建父子映射 //构建父子映射
@ -221,7 +221,7 @@ public class BusBiddingLimitListServiceImpl extends ServiceImpl<BusBiddingLimitL
// 如果是叶子节点,计算 price = quantity * unitPrice // 如果是叶子节点,计算 price = quantity * unitPrice
if (node.getChildren().isEmpty()) { if (node.getChildren().isEmpty()) {
if (node.getQuantity() != null && node.getUnitPrice() != null) { if (node.getQuantity() != null && node.getUnitPrice() != null) {
node.setPrice(node.getQuantity().multiply(node.getUnitPrice())); node.setPrice(node.getQuantity().multiply(node.getUnitPrice()).setScale(4, RoundingMode.HALF_UP));
} else { } else {
node.setPrice(BigDecimal.ZERO); // 默认值 node.setPrice(BigDecimal.ZERO); // 默认值
} }
@ -230,7 +230,7 @@ public class BusBiddingLimitListServiceImpl extends ServiceImpl<BusBiddingLimitL
BigDecimal totalPrice = node.getChildren().stream() BigDecimal totalPrice = node.getChildren().stream()
.map(BusBiddingLimitListVo::getPrice) .map(BusBiddingLimitListVo::getPrice)
.reduce(BigDecimal.ZERO, BigDecimal::add) .reduce(BigDecimal.ZERO, BigDecimal::add)
.setScale(2, RoundingMode.HALF_UP); .setScale(4, RoundingMode.HALF_UP);
node.setPrice(totalPrice); node.setPrice(totalPrice);
} }
} }

View File

@ -0,0 +1,220 @@
package org.dromara.bigscreen.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import jakarta.annotation.Resource;
import org.dromara.bigscreen.domain.dto.WeatherQueryReq;
import org.dromara.bigscreen.domain.vo.*;
import org.dromara.bigscreen.service.EnterpriseBigScreenService;
import org.dromara.common.core.domain.R;
import org.dromara.manager.weathermanager.vo.WeatherVo;
import org.dromara.project.domain.BusAttendance;
import org.dromara.project.domain.BusProject;
import org.dromara.project.domain.BusUserProjectRelevancy;
import org.dromara.project.service.IBusAttendanceService;
import org.dromara.project.service.IBusProjectService;
import org.dromara.project.service.IBusUserProjectRelevancyService;
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.RestController;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDate;
import java.time.temporal.ChronoUnit;
import java.util.*;
import java.util.stream.Collectors;
/**
* 企业级大屏
*
* @author lilemy
* @date 2025-09-09 14:55
*/
@Validated
@RestController
@RequestMapping("/enterprise/big/screen")
public class EnterpriseBigScreenController {
@Resource
private EnterpriseBigScreenService enterpriseBigScreenService;
@Resource
private IBusUserProjectRelevancyService userProjectRelevancyService;
@Resource
private IBusAttendanceService attendanceService;
@Resource
private IBusProjectService projectService;
/**
* 获取关键指标
*/
@SaCheckPermission("enterprise:bigScreen:keyIndex")
@GetMapping("/keyIndex")
public R<EnterpriseKeyIndexVo> getEnterpriseKeyIndex() {
return R.ok(enterpriseBigScreenService.getEnterpriseKeyIndex());
}
/**
* 项目进度分析
*/
@SaCheckPermission("enterprise:bigScreen:projectProgress")
@GetMapping("/projectProgress")
public R<ProjectProgressAnalysisVo> getProjectProgress() {
return R.ok(enterpriseBigScreenService.getProjectProgressAnalysis());
}
/**
* 项目产值对比
*/
@SaCheckPermission("enterprise:bigScreen:projectOutputValueComparison")
@GetMapping("/projectOutputValueComparison")
public R<List<OutputValueComparisonVo>> getProjectOutputValueComparison() {
return R.ok(enterpriseBigScreenService.getProjectOutputValueComparison());
}
/**
* 风险预警
*/
@SaCheckPermission("enterprise:bigScreen:riskEarlyWarning")
@GetMapping("/riskEarlyWarning")
public R<List<RiskEarlyWarningVo>> getRiskEarlyWarning() {
return R.ok(enterpriseBigScreenService.getRiskEarlyWarning());
}
/**
* 查询天气
*/
@SaCheckPermission("enterprise:bigScreen:weather")
@GetMapping("/weather")
public R<List<WeatherVo>> getProjectWeather(WeatherQueryReq req) {
return R.ok(enterpriseBigScreenService.getWeather3DaysList(req));
}
/**
* 查询安全天数
*/
@SaCheckPermission("enterprise:bigScreen:safetyDay")
@GetMapping("/safetyDay")
public R<Long> getProjectSafetyDay() {
LocalDate date = LocalDate.of(2023, 1, 1);
LocalDate now = LocalDate.now();
long days = Math.abs(ChronoUnit.DAYS.between(date, now));
return R.ok(days);
}
/**
* 人数统计
*/
@SaCheckPermission("enterprise:bigScreen:peopleCount")
@GetMapping("/peopleCount")
public R<PeopleCountVo> getProjectPeopleCount() {
PeopleCountVo peopleCountVo = new PeopleCountVo();
List<BusUserProjectRelevancy> list = userProjectRelevancyService.list();
//0系统管理员 1普通人员 2项目管理员 3分包人员
peopleCountVo.setConstructionPersonnelCount(list.stream().filter(item -> "1".equals(item.getUserType()))
.map(BusUserProjectRelevancy::getUserId)
.distinct().count());
peopleCountVo.setManagersCount(list.stream().filter(item -> "2".equals(item.getUserType()))
.map(BusUserProjectRelevancy::getUserId)
.distinct().count());
peopleCountVo.setSubcontractorsCount(list.stream().filter(item -> "3".equals(item.getUserType()))
.map(BusUserProjectRelevancy::getUserId)
.distinct().count());
return R.ok(peopleCountVo);
}
/**
* 出勤人数统计
*/
@SaCheckPermission("enterprise:bigScreen:allAttendanceCount")
@GetMapping("/allAttendanceCount")
public R<TodayAttendanceCountVo> getAllAttendanceCount() {
TodayAttendanceCountVo todayAttendanceCountVo = new TodayAttendanceCountVo();
List<BusAttendance> list = attendanceService.list(Wrappers.<BusAttendance>lambdaQuery()
.eq(BusAttendance::getClockDate, LocalDate.now())
.in(BusAttendance::getClockStatus, Arrays.asList("1", "2", "3"))
);
long attendanceCount = list.stream().map(BusAttendance::getUserId).distinct().count();
todayAttendanceCountVo.setAttendanceCount(attendanceCount);
// 查询总人数
List<BusUserProjectRelevancy> relevancyList = userProjectRelevancyService.list();
long totalUserCount = relevancyList.stream().map(BusUserProjectRelevancy::getUserId).distinct().count();
// 计算考勤率(保留一位小数)
if (totalUserCount > 0) {
BigDecimal rate = new BigDecimal(attendanceCount * 100)
.divide(new BigDecimal(totalUserCount), 1, RoundingMode.HALF_UP);
todayAttendanceCountVo.setAttendanceRate(rate.doubleValue());
} else {
todayAttendanceCountVo.setAttendanceRate(0.0);
}
return R.ok(todayAttendanceCountVo);
}
/**
* 每个项目的出勤人数
*/
@SaCheckPermission("enterprise:bigScreen:projectAttendanceCount")
@GetMapping("/projectAttendanceCount")
public R<List<ProjectAttendanceCountVo>> getProjectAttendanceCount() {
ArrayList<ProjectAttendanceCountVo> projectAttendanceCountVos = new ArrayList<>();
List<BusAttendance> list = attendanceService.list(Wrappers.<BusAttendance>lambdaQuery()
.eq(BusAttendance::getClockDate, LocalDate.now())
.in(BusAttendance::getClockStatus, Arrays.asList("1", "2", "3"))
);
List<BusUserProjectRelevancy> relevancyList = userProjectRelevancyService.list();
// 转换为 Map<projectId, 去重后的 userId 数量>
Map<Long, Integer> projectUserCountMap = relevancyList.stream()
.collect(Collectors.groupingBy(
BusUserProjectRelevancy::getProjectId,
Collectors.mapping(
BusUserProjectRelevancy::getUserId,
Collectors.collectingAndThen(
Collectors.toSet(),
Set::size
)
)
));
for (Long projectId : projectUserCountMap.keySet()) {
ProjectAttendanceCountVo projectAttendanceCountVo = new ProjectAttendanceCountVo();
BusProject byId = projectService.getById(projectId);
if (byId == null) {
continue;
}
projectAttendanceCountVo.setProjectName(byId.getProjectName());
long count = list.stream().filter(item -> item.getProjectId().equals(projectId))
.map(BusAttendance::getUserId)
.distinct()
.count();
Integer i = projectUserCountMap.get(projectId);
BigDecimal rate = new BigDecimal("0.0");
if (i > 0) {
rate = new BigDecimal(count * 100)
.divide(new BigDecimal(projectUserCountMap.get(projectId)), 1, RoundingMode.HALF_UP);
}
projectAttendanceCountVo.setAttendanceRate(rate.doubleValue());
projectAttendanceCountVos.add(projectAttendanceCountVo);
}
return R.ok(projectAttendanceCountVos);
}
}

View File

@ -11,13 +11,13 @@ import org.dromara.ctr.domain.CtrExpensesContract;
import org.dromara.ctr.domain.CtrIncomeContract; 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.vo.WeatherVo;
import org.dromara.out.domain.OutSettlementValueOwner; import org.dromara.out.domain.OutSettlementValueOwner;
import org.dromara.out.domain.OutSettlementValueSubcontract; import org.dromara.out.domain.OutSettlementValueSubcontract;
import org.dromara.out.service.IOutSettlementValueOwnerService; import org.dromara.out.service.IOutSettlementValueOwnerService;
import org.dromara.out.service.IOutSettlementValueSubcontractService; import org.dromara.out.service.IOutSettlementValueSubcontractService;
import org.dromara.project.domain.vo.project.BusProjectGisVo; import org.dromara.project.domain.vo.project.BusProjectGisVo;
import org.dromara.project.domain.vo.project.BusProjectSafetyDayVo; import org.dromara.project.domain.vo.project.BusProjectSafetyDayVo;
import org.dromara.project.domain.vo.project.BusProjectWeatherVo;
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.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
@ -25,6 +25,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.YearMonth; import java.time.YearMonth;
import java.time.temporal.TemporalAdjusters; import java.time.temporal.TemporalAdjusters;
@ -114,8 +115,8 @@ public class MoneyBigScreenController {
.eq(CtrIncomeContract::getProjectId, projectId) .eq(CtrIncomeContract::getProjectId, projectId)
.last("limit 1") .last("limit 1")
); );
if (contract != null && contract.getPayRatio()!= null) { if (contract != null && contract.getPayRatio() != null) {
actualAmount = actualAmount.add(projectMonthlyAmountMap.get(projectId).multiply(contract.getPayRatio()).divide(HUNDRED)); actualAmount = actualAmount.add(projectMonthlyAmountMap.get(projectId).multiply(contract.getPayRatio()).divide(HUNDRED).setScale(4, RoundingMode.HALF_UP));
} }
} }
@ -169,8 +170,8 @@ public class MoneyBigScreenController {
.last("limit 1") .last("limit 1")
); );
if (contract != null && contract.getPayRatio()!= null) { if (contract != null && contract.getPayRatio() != null) {
actualAmount = actualAmount.add(projectAmountMap.get(contractCode).multiply(contract.getPayRatio()).divide(HUNDRED)); actualAmount = actualAmount.add(projectAmountMap.get(contractCode).multiply(contract.getPayRatio()).setScale(4, RoundingMode.HALF_UP).divide(HUNDRED));
} }
} }
@ -243,7 +244,7 @@ public class MoneyBigScreenController {
.filter(contract -> contract.getAmount() != null && contract.getAmount().compareTo(THIRD_PHASE) >= 0) .filter(contract -> contract.getAmount() != null && contract.getAmount().compareTo(THIRD_PHASE) >= 0)
.count(); .count();
return R.ok(new MoneyContractCountVo(4, 4, 6, 6)); return R.ok(new MoneyContractCountVo(4, 4, 6, 6));
// return R.ok(new MoneyContractCountVo(lessThan1M, between1MAnd5M, between5MAnd10M, greaterThanOrEqualTo10M)); // return R.ok(new MoneyContractCountVo(lessThan1M, between1MAnd5M, between5MAnd10M, greaterThanOrEqualTo10M));
} }
@ -350,8 +351,8 @@ public class MoneyBigScreenController {
.eq(CtrIncomeContract::getProjectId, projectId) .eq(CtrIncomeContract::getProjectId, projectId)
.last("limit 1") .last("limit 1")
); );
if (contract != null && contract.getPayRatio()!= null) { if (contract != null && contract.getPayRatio() != null) {
incomeAmount = incomeAmount.add(incomeGroupedByProject.get(projectId).multiply(contract.getPayRatio()).divide(HUNDRED)); incomeAmount = incomeAmount.add(incomeGroupedByProject.get(projectId).multiply(contract.getPayRatio()).setScale(4, RoundingMode.HALF_UP).divide(HUNDRED));
} }
} }
@ -380,8 +381,8 @@ public class MoneyBigScreenController {
.last("limit 1") .last("limit 1")
); );
if (contract != null && contract.getPayRatio()!= null) { if (contract != null && contract.getPayRatio() != null) {
expensesAmount = expensesAmount.add(expenseGroupedByContract.get(contractCode).multiply(contract.getPayRatio()).divide(HUNDRED)); expensesAmount = expensesAmount.add(expenseGroupedByContract.get(contractCode).multiply(contract.getPayRatio()).setScale(4, RoundingMode.HALF_UP).divide(HUNDRED));
} }
} }
@ -448,8 +449,8 @@ public class MoneyBigScreenController {
.eq(CtrIncomeContract::getProjectId, projectId) .eq(CtrIncomeContract::getProjectId, projectId)
.last("limit 1") .last("limit 1")
); );
if (contract != null && contract.getPayRatio()!= null) { if (contract != null && contract.getPayRatio() != null) {
incomeAmount = incomeAmount.add(incomeGroupedByProject.get(projectId).multiply(contract.getPayRatio()).divide(HUNDRED)); incomeAmount = incomeAmount.add(incomeGroupedByProject.get(projectId).multiply(contract.getPayRatio()).setScale(4, RoundingMode.HALF_UP).divide(HUNDRED));
} }
} }
@ -478,8 +479,8 @@ public class MoneyBigScreenController {
.last("limit 1") .last("limit 1")
); );
if (contract != null && contract.getPayRatio()!= null) { if (contract != null && contract.getPayRatio() != null) {
expensesAmount = expensesAmount.add(expenseGroupedByContract.get(contractCode).multiply(contract.getPayRatio()).divide(HUNDRED)); expensesAmount = expensesAmount.add(expenseGroupedByContract.get(contractCode).multiply(contract.getPayRatio()).setScale(4, RoundingMode.HALF_UP).divide(HUNDRED));
} }
} }
@ -511,7 +512,7 @@ public class MoneyBigScreenController {
.filter(java.util.Objects::nonNull) // 过滤掉 null 值 .filter(java.util.Objects::nonNull) // 过滤掉 null 值
.reduce(BigDecimal.ZERO, BigDecimal::add); .reduce(BigDecimal.ZERO, BigDecimal::add);
List<OutSettlementValueSubcontract> subcontractList = settlementValueSubcontractService.list(); List<OutSettlementValueSubcontract> subcontractList = settlementValueSubcontractService.list();
BigDecimal expensesCash = subcontractList.stream() BigDecimal expensesCash = subcontractList.stream()
.map(OutSettlementValueSubcontract::getSettlementValue) .map(OutSettlementValueSubcontract::getSettlementValue)
@ -526,8 +527,6 @@ public class MoneyBigScreenController {
} }
/** /**
* 获取当前月份的开始时间和结束时间 * 获取当前月份的开始时间和结束时间
* *
@ -548,8 +547,8 @@ public class MoneyBigScreenController {
*/ */
@SaCheckPermission("project:bigScreen:weather") @SaCheckPermission("project:bigScreen:weather")
@GetMapping("/weather/{projectId}") @GetMapping("/weather/{projectId}")
public R<List<BusProjectWeatherVo>> getProjectWeather(@NotNull(message = "主键不能为空") public R<List<WeatherVo>> getProjectWeather(@NotNull(message = "主键不能为空")
@PathVariable Long projectId) { @PathVariable Long projectId) {
return R.ok(moneyBigScreenService.getProjectWeather(projectId)); return R.ok(moneyBigScreenService.getProjectWeather(projectId));
} }

View File

@ -1,31 +1,41 @@
package org.dromara.bigscreen.controller; package org.dromara.bigscreen.controller;
import cn.dev33.satoken.annotation.SaCheckPermission; import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.dromara.bigscreen.domain.vo.ProjectImageProgressVo; import org.dromara.bigscreen.domain.*;
import org.dromara.bigscreen.domain.vo.ProjectLandVo; import org.dromara.bigscreen.domain.vo.*;
import org.dromara.bigscreen.domain.vo.ProjectPeopleVo; import org.dromara.bigscreen.mapper.ProjectBigScreenMapper;
import org.dromara.bigscreen.domain.vo.ProjectSafetyInspectionVo;
import org.dromara.bigscreen.service.ProjectBigScreenService; import org.dromara.bigscreen.service.ProjectBigScreenService;
import org.dromara.common.core.domain.R; import org.dromara.common.core.domain.R;
import org.dromara.common.core.utils.DateUtils;
import org.dromara.common.idempotent.annotation.RepeatSubmit;
import org.dromara.common.log.annotation.Log;
import org.dromara.common.log.enums.BusinessType;
import org.dromara.common.utils.BigDecimalUtil;
import org.dromara.gps.domain.bo.GpsEquipmentBo;
import org.dromara.gps.domain.vo.GpsEquipmentSonVo;
import org.dromara.gps.service.IGpsEquipmentService;
import org.dromara.land.domain.BusLandBlock; import org.dromara.land.domain.BusLandBlock;
import org.dromara.land.domain.BusLandTransferLedger; import org.dromara.land.domain.BusLandTransferLedger;
import org.dromara.land.service.IBusLandBlockService; import org.dromara.land.service.IBusLandBlockService;
import org.dromara.land.service.IBusLandTransferLedgerService; import org.dromara.land.service.IBusLandTransferLedgerService;
import org.dromara.manager.weathermanager.vo.WeatherVo;
import org.dromara.other.service.IOthYs7DeviceService;
import org.dromara.project.domain.BusProject;
import org.dromara.project.domain.vo.project.BusProjectSafetyDayVo; import org.dromara.project.domain.vo.project.BusProjectSafetyDayVo;
import org.dromara.project.domain.vo.project.BusProjectWeatherVo;
import org.dromara.project.domain.vo.projectnews.BusProjectNewsVo; import org.dromara.project.domain.vo.projectnews.BusProjectNewsVo;
import org.dromara.project.service.IBusProjectService;
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.*;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -49,6 +59,14 @@ public class ProjectBigScreenController {
private final IBusLandBlockService busLandBlockService; private final IBusLandBlockService busLandBlockService;
private final IGpsEquipmentService gpsEquipmentService;
private final IOthYs7DeviceService othYs7DeviceService;
private final ProjectBigScreenMapper projectBigScreenMapper;
private final IBusProjectService projectService;
/** /**
* 查询项目土地统计 * 查询项目土地统计
*/ */
@ -103,8 +121,8 @@ public class ProjectBigScreenController {
*/ */
@SaCheckPermission("project:bigScreen:weather") @SaCheckPermission("project:bigScreen:weather")
@GetMapping("/weather/{projectId}") @GetMapping("/weather/{projectId}")
public R<List<BusProjectWeatherVo>> getProjectWeather(@NotNull(message = "主键不能为空") public R<List<WeatherVo>> getProjectWeather(@NotNull(message = "主键不能为空")
@PathVariable Long projectId) { @PathVariable Long projectId) {
return R.ok(projectBigScreenService.getProjectWeather(projectId)); return R.ok(projectBigScreenService.getProjectWeather(projectId));
} }
@ -125,7 +143,14 @@ public class ProjectBigScreenController {
@GetMapping("/news/{projectId}") @GetMapping("/news/{projectId}")
public R<List<BusProjectNewsVo>> getProjectNews(@NotNull(message = "主键不能为空") public R<List<BusProjectNewsVo>> getProjectNews(@NotNull(message = "主键不能为空")
@PathVariable Long projectId) { @PathVariable Long projectId) {
return R.ok(projectBigScreenService.getProjectNews(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());
} }
/** /**
@ -135,7 +160,23 @@ public class ProjectBigScreenController {
@GetMapping("/safetyInspection/{projectId}") @GetMapping("/safetyInspection/{projectId}")
public R<List<ProjectSafetyInspectionVo>> getProjectSafetyInspection(@NotNull(message = "主键不能为空") public R<List<ProjectSafetyInspectionVo>> getProjectSafetyInspection(@NotNull(message = "主键不能为空")
@PathVariable Long projectId) { @PathVariable Long projectId) {
return R.ok(projectBigScreenService.getProjectSafetyInspection(projectId)); BusProject project = projectService.getById(projectId);
projectId = project.getGoId();
String pic;
if (projectId == 60) {
pic = "http://xny.yj-3d.com:7363/";
} else {
pic = "http://xny.yj-3d.com:7464/";
}
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());
} }
/** /**
@ -145,7 +186,52 @@ public class ProjectBigScreenController {
@GetMapping("/people/{projectId}") @GetMapping("/people/{projectId}")
public R<ProjectPeopleVo> getProjectPeople(@NotNull(message = "主键不能为空") public R<ProjectPeopleVo> getProjectPeople(@NotNull(message = "主键不能为空")
@PathVariable Long projectId) { @PathVariable Long projectId) {
return R.ok(projectBigScreenService.getProjectPeople(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));
} }
/** /**
@ -165,6 +251,189 @@ public class ProjectBigScreenController {
@GetMapping("/generalize/{projectId}") @GetMapping("/generalize/{projectId}")
public R<String> getProjectGeneralize(@NotNull(message = "主键不能为空") public R<String> getProjectGeneralize(@NotNull(message = "主键不能为空")
@PathVariable Long projectId) { @PathVariable Long projectId) {
return R.ok(projectBigScreenService.getProjectGeneralize(projectId)); BusProject project = projectService.getById(projectId);
if (project != null) {
Long goId = project.getGoId();
if (goId != null) {
List<SysProjectIntroduce> sysProjectIntroduces = projectBigScreenMapper.selectByProjectId(goId);
return R.ok(sysProjectIntroduces.getFirst().getRichText());
}
}
// return R.ok(projectBigScreenService.getProjectGeneralize(projectId));
return R.ok();
}
/**
* 查询设备列表
*/
@SaCheckPermission("project:bigScreen:getClientList")
@GetMapping("/getClientList/{projectId}")
public R<List<Map<String, Object>>> getClientList(@NotNull(message = "主键不能为空")
@PathVariable Long projectId) {
List<GpsEquipmentSonVo> voList = gpsEquipmentService.getClientList(projectId);
// List<OthYs7Device> othYs7DeviceList = othYs7DeviceService.lambdaQuery()
// .eq(OthYs7Device::getProjectId, projectId)
// .list();
List<Map<String, Object>> maps = new ArrayList<>();
Map<String, Object> gpsMap = new HashMap<>();
Map<String, Object> wrjMap = new HashMap<>();
Map<String, Object> sxtMap = new HashMap<>();
List<Map<String, Object>> gpsChildrenMap = new ArrayList<>();
// List<Map<String, Object>> wrjChildrenMap = new ArrayList<>();
// List<Map<String, Object>> sxtChildrenMap = new ArrayList<>();
if (voList != null && !voList.isEmpty()) {
for (GpsEquipmentSonVo item : voList) {
Map<String, Object> gps = new HashMap<>();
gps.put("id", item.getClientId());
gps.put("label", item.getClientId());
gps.put("name", item.getDeviceName());
gps.put("type", "positioningDevice");
gps.put("lat", item.getLocLatitude());
gps.put("lng", item.getLocLongitude());
gps.put("alt", item.getLocAltitude());
gpsChildrenMap.add(gps);
}
}
// if (othYs7DeviceList != null && !othYs7DeviceList.isEmpty()) {
// for (OthYs7Device item : othYs7DeviceList) {
// Map<String, Object> sxt = new HashMap<>();
// sxt.put("id", item.getDeviceSerial());
// sxt.put("label", item.getDeviceSerial());
// sxt.put("name", item.getDeviceName());
// sxt.put("type", "shexiangtou");
//// sxt.put("lat", item.getLocLatitude());
//// sxt.put("lng", item.getLocLongitude());
//// sxt.put("alt", item.getLocAltitude());
// sxtChildrenMap.add(sxt);
// }
// }
List<Map<String, Object>> maps1 = setSxt();
List<Map<String, Object>> maps2 = setWrj();
gpsMap.put("id", 1);
gpsMap.put("label", "定位设备");
gpsMap.put("children", gpsChildrenMap);
sxtMap.put("id", 2);
sxtMap.put("label", "摄像头");
// sxtMap.put("children",sxtChildrenMap);
sxtMap.put("children", maps1);
wrjMap.put("id", 3);
wrjMap.put("label", "无人机");
// wrjMap.put("children",wrjChildrenMap);
wrjMap.put("children", maps2);
maps.add(gpsMap);
maps.add(wrjMap);
maps.add(sxtMap);
return R.ok(maps);
}
/**
* 查询GPS设备用户列表
*/
@SaCheckPermission("project:bigScreen:getList")
@GetMapping("/getList")
public R<List<String>> getList(Long projectId) {
return R.ok(projectBigScreenService.getList(projectId));
}
/**
* 新增GPS设备详细
*/
@SaCheckPermission("project:bigScreen:setList")
@Log(title = "GPS设备详细", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping("/setList")
public void setList(@RequestBody GpsEquipmentBo bo) {
projectBigScreenService.setList(bo);
}
public List<Map<String, Object>> setSxt() {
List<Map<String, Object>> sxtChildrenMap = new ArrayList<>();
HashMap<String, Object> map1 = new HashMap<>();
map1.put("id", "55");
map1.put("label", "1222222");
map1.put("name", "22");
map1.put("type", "camera");
map1.put("lng", 106.48349615411811);
map1.put("lat", 29.54856374364732);
map1.put("alt", 0);
HashMap<String, Object> map2 = new HashMap<>();
map2.put("id", "56");
map2.put("label", "1222223");
map2.put("name", "23");
map2.put("type", "camera");
map2.put("lng", 106.48442273257676);
map2.put("lat", 29.53841670498476);
map2.put("alt", 0);
HashMap<String, Object> map3 = new HashMap<>();
map3.put("id", "57");
map3.put("label", "1222224");
map3.put("name", "24");
map3.put("type", "camera");
map3.put("lng", 106.49197896482423);
map3.put("lat", 29.52931974282576);
map3.put("alt", 0);
HashMap<String, Object> map4 = new HashMap<>();
map4.put("id", "58");
map4.put("label", "1222225");
map4.put("name", "25");
map4.put("type", "camera");
map4.put("lng", 106.50293584930655);
map4.put("lat", 29.533025743929034);
map4.put("alt", 0);
sxtChildrenMap.add(map1);
sxtChildrenMap.add(map2);
sxtChildrenMap.add(map3);
sxtChildrenMap.add(map4);
return sxtChildrenMap;
}
public List<Map<String, Object>> setWrj() {
List<Map<String, Object>> sxtChildrenMap = new ArrayList<>();
HashMap<String, Object> map1 = new HashMap<>();
map1.put("id", "65");
map1.put("label", "6222222");
map1.put("name", "32");
map1.put("type", "drone");
map1.put("lng", 106.49556855602525);
map1.put("lat", 29.534393226355515);
map1.put("alt", 0);
HashMap<String, Object> map2 = new HashMap<>();
map2.put("id", "66");
map2.put("label", "2222223");
map2.put("name", "33");
map2.put("type", "drone");
map2.put("lng", 106.49142431645038);
map2.put("lat", 29.534472802500083);
map2.put("alt", 0);
HashMap<String, Object> map3 = new HashMap<>();
map3.put("id", "67");
map3.put("label", "2222224");
map3.put("name", "34");
map3.put("type", "drone");
map3.put("lng", 106.49142125177437);
map3.put("lat", 29.541881138875755);
map3.put("alt", 0);
HashMap<String, Object> map4 = new HashMap<>();
map4.put("id", "68");
map4.put("label", "2222225");
map4.put("name", "35");
map4.put("type", "drone");
map4.put("lng", 106.50256649933792);
map4.put("lat", 29.54260793685717);
map4.put("alt", 0);
sxtChildrenMap.add(map1);
sxtChildrenMap.add(map2);
sxtChildrenMap.add(map3);
sxtChildrenMap.add(map4);
return sxtChildrenMap;
} }
} }

View File

@ -0,0 +1,58 @@
package org.dromara.bigscreen.domain;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
@Data
public class BusAttendanceByGo {
private Long id; // 主键ID
private String userName; // 人员姓名
private String pacePhoto; // 人脸照
private Long projectId; // 项目id
private String createBy; // 创建者
private String updateBy; // 更新者
private LocalDateTime createdAt; // 创建时间
private LocalDateTime updatedAt; // 更新时间
private LocalDateTime deletedAt; // 删除时间
private String clockOn; // 上午打卡
private String clockOff; // 下午打卡
private String printingDate; // 年月日打卡时间
private String isPinch; // 1正常,2迟到,3早退,4缺勤,5补卡
private String openid; // 微信id
private String pinchOpenId; // 代打id
private String clockRecord; // 多次打卡时间记录
private String pinchUserName; // 代打人姓名
private String commuter; // 上下班1上班 2下班
private String punchRange; // 打卡范围
private BigDecimal dailyWage; // 日薪
private String lng; // 经度
private String lat; // 纬度
private String location; // 逆编码地址信息
private LocalDateTime missing; // 缺卡统一处理时间
}

View File

@ -0,0 +1,91 @@
package org.dromara.bigscreen.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
@Data
@TableName("bus_construction_user")
public class BusConstructionUser {
@TableId(type = IdType.AUTO)
private Long id; // 主键ID
private String openid; // 微信id
private String nickName; // 微信名称
private Long teamId; // 班组id
private String headIcon; // 登陆照片
private String pacePhoto; // 人脸照
private String userName; // 人员姓名
private Long projectId; // 项目id
private String status; // 状态0在职 1离职-字典position_status
private String isPinch; // 是否代打
private String ifManagement; // 是否班组管理
private String createBy; // 创建者
private String updateBy; // 更新者
private LocalDateTime createdAt; // 创建时间
private LocalDateTime updatedAt; // 更新时间
private LocalDateTime deletedAt; // 删除时间
private String phone; // 电话
private String sex; // 1:男,2女,3保密
private String sfzNation; // 身份证民族
private String sfzNumber; // 身份证号码
private String sfzStart; // 身份证有效开始期
private String sfzEnd; // 身份证有效结束期
private String sfzSite; // 身份证地址
private String sfzBirth; // 身份证出生日期
private String nativePlace; // 籍贯
private String yhkNumber; // 银行卡号
private String yhkOpeningBank; // 开户行
private String yhkCardholder; // 持卡人
private String typeOfWork; // 工种(字典)
private String clock; // 打卡(1启用打卡 2禁止打卡)
private Long labourserviceId; // 劳务公司id
private String entryDate; // 入场时间
private String leaveDate; // 离场时间
private BigDecimal salary; // 薪水为0表示无效
private String projectRecord; // 是否开启项目备案1开启 2不开启
private String wxOrPc; // 哪添加的1表示pc 2表示小程序
private String subscription; // 消息订阅状态1订阅 2无订阅
private String devNum; // 安全帽设备标识
}

View File

@ -0,0 +1,52 @@
package org.dromara.bigscreen.domain;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import java.time.LocalDateTime;
/**
* 企业大事记
*/
@Data
@TableName("bus_corporate_events")
public class BusCorporateEvents {
@TableId(type = IdType.AUTO)
private Long id;
/**
* 标题
*/
private String headline;
/**
* 内容
*/
private String content;
/**
* 创建人
*/
private Long createdBy;
/**
* 更新人
*/
private Long updatedBy;
/**
* 创建时间
*/
private LocalDateTime createdAt;
/**
* 更新时间
*/
private LocalDateTime updatedAt;
/**
* 删除时间(软删除标记)
*/
private LocalDateTime deletedAt;
}

View File

@ -0,0 +1,31 @@
package org.dromara.bigscreen.domain;
import lombok.Data;
import java.time.LocalDateTime;
@Data
public class BusProjectTeamByGo {
private Long id; // 主键id
private Long projectId; // 项目id
private String name; // 班组名称
private String isClockIn; // 范围内打卡0范围内打卡 1任何地点打卡
private String punchRange; // 打卡范围(id串)
private String remark; // 备注
private String createBy; // 创建者
private String updateBy; // 更新者
private Long createDept; // 创建部门
private LocalDateTime createTime; // 创建时间
private LocalDateTime updateTime; // 更新时间
}

View File

@ -0,0 +1,25 @@
package org.dromara.bigscreen.domain;
import lombok.Data;
import java.time.LocalDateTime;
@Data
public class BusProjectTeamMemberByGo {
private Long id; // 主键id
private Long teamId; // 班组id
private Long projectId; // 项目id
private Long memberId; // 施工人员id
private String postId; // 岗位0普通员工1组长
private String remark; // 备注
private LocalDateTime createTime; // 创建时间
private LocalDateTime updateTime; // 更新时间
}

View File

@ -0,0 +1,35 @@
package org.dromara.bigscreen.domain;
import lombok.Data;
import java.util.Date;
@Data
public class BusTour {
private Long id; // 主键ID
private Long projectId; // 项目id
private String tourCategory; // 类别字典(如:无人机识别、监控拍摄)
private String tourType; // 类型字典(如:安全帽、安全带)
private String picture; // 图片路径
private Integer num; // 违规数量
private String describe; // 故障描述
private Date createdAt; // 创建时间
private Date updatedAt; // 更新时间
private Date deletedAt; // 删除时间
private String tableName; // 表名
private Long tableId; // 表id
private String sxtName; // 摄像头名称
}

View File

@ -0,0 +1,34 @@
package org.dromara.bigscreen.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.time.LocalDateTime;
@Data
@TableName("sys_project_introduce")
public class SysProjectIntroduce {
@TableId(type = IdType.AUTO)
private Long id; // 主键id
private Long projectId; // 项目id
private String headline; // 标题
private String richText; // 富文本
private String createdBy; // 创建人
private String updatedBy; // 更新人
private LocalDateTime createdAt; // 创建时间
private LocalDateTime updatedAt; // 更新时间
private LocalDateTime deletedAt; // 删除时间
private String files; // 附件
}

View File

@ -0,0 +1,31 @@
package org.dromara.bigscreen.domain.dto;
import jakarta.validation.constraints.NotBlank;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
/**
* @author lilemy
* @date 2025-09-09 15:16
*/
@Data
public class WeatherQueryReq implements Serializable {
@Serial
private static final long serialVersionUID = -2550570761981859666L;
/**
* 经度
*/
@NotBlank(message = "经度不能为空")
private String lng;
/**
* 纬度
*/
@NotBlank(message = "纬度不能为空")
private String lat;
}

View File

@ -0,0 +1,38 @@
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-09 15:59
*/
@Data
public class EnterpriseKeyIndexVo implements Serializable {
@Serial
private static final long serialVersionUID = -3987781906203623727L;
/**
* 在建项目数量
*/
private Long ongoingProject;
/**
* 合同总额(单位:亿元)
*/
private Long totalContractAmount;
/**
* 总容量
*/
private BigDecimal totalCapacity;
/**
* 今日施工项目数量
*/
private Long todayProject;
}

View File

@ -0,0 +1,38 @@
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-09 19:12
*/
@Data
public class OutputValueComparisonVo implements Serializable {
@Serial
private static final long serialVersionUID = -6902563869975528076L;
/**
* 项目id
*/
private Long projectId;
/**
* 项目名称
*/
private String projectName;
/**
* 计划产值
*/
private BigDecimal planValue;
/**
* 实际产值
*/
private BigDecimal actualValue;
}

View File

@ -0,0 +1,22 @@
package org.dromara.bigscreen.domain.vo;
import lombok.Data;
@Data
public class PeopleCountVo {
/**
* 施工人员
*/
private Long constructionPersonnelCount;
/**
* 分包人员
*/
private Long SubcontractorsCount;
/**
* 管理人员
*/
private Long managersCount;
}

View File

@ -0,0 +1,33 @@
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-09 16:04
*/
@Data
public class PeopleOverviewVo implements Serializable {
@Serial
private static final long serialVersionUID = -4353811031023888101L;
/**
* 出勤人数
*/
private Long attendanceNumber;
/**
* 出勤率
*/
private BigDecimal attendanceRate;
/**
* 施工人员数量
*/
private Long constructorNumber;
}

View File

@ -0,0 +1,29 @@
package org.dromara.bigscreen.domain.vo;
import lombok.Data;
@Data
public class ProjectAttendanceCountVo {
/**
* 项目id
*/
private Long projectId;
/**
* 项目名称
*/
private String projectName;
/**
* 考勤人数
*/
private Long attendanceCount;
/**
* 考勤率
*/
private Double attendanceRate;
}

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;
import java.util.List;
/**
* @author lilemy
* @date 2025-09-09 16:51
*/
@Data
public class ProjectProgressAnalysisVo implements Serializable {
@Serial
private static final long serialVersionUID = -2170524608375159201L;
/**
* 并网总容量 (MW)
*/
private BigDecimal gridConnectedCapacity;
/**
* 计划总容量 (MW)
*/
private BigDecimal plannedCapacity;
/**
* 延期项目数量
*/
private Integer delayedProjectCount;
/**
* 项目进度详情
*/
List<ProjectProgressDetailVo> projectProgressDetailList;
}

View File

@ -0,0 +1,33 @@
package org.dromara.bigscreen.domain.vo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
/**
* @author lilemy
* @date 2025-09-09 16:55
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ProjectProgressDetailVo {
/**
* 项目名称
*/
private String projectName;
/**
* 项目容量
*/
private BigDecimal projectCapacity;
/**
* 施工进度百分比 (0~100)
*/
private BigDecimal completionRate;
}

View File

@ -0,0 +1,48 @@
package org.dromara.bigscreen.domain.vo;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDate;
/**
* @author lilemy
* @date 2025-09-09 20:04
*/
@Data
public class RiskEarlyWarningVo implements Serializable {
@Serial
private static final long serialVersionUID = 5250172770638676715L;
/**
* 时间
*/
private LocalDate date;
/**
* 风险类型
*/
private String riskType;
/**
* 报警内容
*/
private String alarmContent;
/**
* 威胁等级
*/
private String dangerLevel;
/**
* 来源
*/
private String source;
/**
* 告警等级
*/
private String alarmLevel;
}

View File

@ -0,0 +1,19 @@
package org.dromara.bigscreen.domain.vo;
import lombok.Data;
@Data
public class TodayAttendanceCountVo {
/**
* 考勤人员数量
*/
private Long attendanceCount;
/**
* 出勤率
*/
private Double attendanceRate;
}

View File

@ -0,0 +1,56 @@
package org.dromara.bigscreen.mapper;
import com.baomidou.dynamic.datasource.annotation.DS;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.dromara.bigscreen.domain.*;
import java.time.LocalDate;
import java.util.List;
/**
* @author lilemy
* @date 2025-09-10 19:32
*/
@DS("slave")
@Mapper
public interface ProjectBigScreenMapper {
@Select("select * from bus_corporate_events limit 10")
List<BusCorporateEvents> getBusCorporateEvents();
@Select("select * from sys_project_introduce where project_id = #{projectId}")
List<SysProjectIntroduce> selectByProjectId(@Param("projectId") Long projectId);
@Select("select count(*) from bus_construction_user where project_id = #{projectId} && deleted_at is NULL")
Integer getProjectUserCount(@Param("projectId") Long projectId);
@Select("select count(*) from bus_attendance where project_id = #{projectId} && printing_date = #{printingDate} && commuter = '1'")
Integer getAttendanceCount(@Param("projectId") Long projectId,
@Param("printingDate") String printingDate);
@Select("SELECT * FROM sys_project_team WHERE project_id = #{projectId} && deleted_at is NULL")
List<BusProjectTeamByGo> getTeamList(@Param("projectId") Long projectId);
@Select("SELECT * FROM bus_construction_user WHERE project_id = #{projectId} && deleted_at is NULL")
List<BusConstructionUser> getProjectUserList(@Param("projectId") Long projectId);
@Select({
"<script>",
"SELECT count(*) ",
"FROM bus_attendance ",
"WHERE openid IN ",
"<foreach collection='openIds' item='id' open='(' separator=',' close=')'>",
" #{id}",
"</foreach>",
"AND printing_date = #{printingDate} ",
"AND commuter = '1'",
"</script>"
})
Integer getAttendanceCountByOpenIds(@Param("openIds") List<String> openIds,
@Param("printingDate") LocalDate printingDate);
@Select("SELECT * FROM bus_tour WHERE project_id = #{projectId} AND deleted_at IS NULL LIMIT 10")
List<BusTour> selectTourByProjectId(@Param("projectId") Long projectId);
}

View File

@ -0,0 +1,53 @@
package org.dromara.bigscreen.service;
import org.dromara.bigscreen.domain.dto.WeatherQueryReq;
import org.dromara.bigscreen.domain.vo.EnterpriseKeyIndexVo;
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 java.util.List;
/**
* @author lilemy
* @date 2025-09-09 15:31
*/
public interface EnterpriseBigScreenService {
/**
* 获取关键指标
*
* @return 关键指标
*/
EnterpriseKeyIndexVo getEnterpriseKeyIndex();
/**
* 获取项目进度分析
*
* @return 项目进度分析
*/
ProjectProgressAnalysisVo getProjectProgressAnalysis();
/**
* 获取项目产值对比
*
* @return 项目产值对比
*/
List<OutputValueComparisonVo> getProjectOutputValueComparison();
/**
* 获取风险预警
*
* @return 风险预警
*/
List<RiskEarlyWarningVo> getRiskEarlyWarning();
/**
* 获取3天的天气列表
*
* @param req 查询参数
* @return 天气列表
*/
List<WeatherVo> getWeather3DaysList(WeatherQueryReq req);
}

View File

@ -1,8 +1,8 @@
package org.dromara.bigscreen.service; package org.dromara.bigscreen.service;
import org.dromara.manager.weathermanager.vo.WeatherVo;
import org.dromara.project.domain.vo.project.BusProjectGisVo; import org.dromara.project.domain.vo.project.BusProjectGisVo;
import org.dromara.project.domain.vo.project.BusProjectSafetyDayVo; import org.dromara.project.domain.vo.project.BusProjectSafetyDayVo;
import org.dromara.project.domain.vo.project.BusProjectWeatherVo;
import java.util.List; import java.util.List;
@ -25,7 +25,7 @@ public interface MoneyBigScreenService {
* @param projectId 项目id * @param projectId 项目id
* @return 项目天气 * @return 项目天气
*/ */
List<BusProjectWeatherVo> getProjectWeather(Long projectId); List<WeatherVo> getProjectWeather(Long projectId);
/** /**
* 获取项目安全天数 * 获取项目安全天数

View File

@ -3,8 +3,9 @@ package org.dromara.bigscreen.service;
import org.dromara.bigscreen.domain.vo.ProjectImageProgressVo; import org.dromara.bigscreen.domain.vo.ProjectImageProgressVo;
import org.dromara.bigscreen.domain.vo.ProjectPeopleVo; import org.dromara.bigscreen.domain.vo.ProjectPeopleVo;
import org.dromara.bigscreen.domain.vo.ProjectSafetyInspectionVo; import org.dromara.bigscreen.domain.vo.ProjectSafetyInspectionVo;
import org.dromara.manager.weathermanager.vo.WeatherVo;
import org.dromara.gps.domain.bo.GpsEquipmentBo;
import org.dromara.project.domain.vo.project.BusProjectSafetyDayVo; import org.dromara.project.domain.vo.project.BusProjectSafetyDayVo;
import org.dromara.project.domain.vo.project.BusProjectWeatherVo;
import org.dromara.project.domain.vo.projectnews.BusProjectNewsVo; import org.dromara.project.domain.vo.projectnews.BusProjectNewsVo;
import java.util.List; import java.util.List;
@ -21,7 +22,7 @@ public interface ProjectBigScreenService {
* @param projectId 项目id * @param projectId 项目id
* @return 项目天气 * @return 项目天气
*/ */
List<BusProjectWeatherVo> getProjectWeather(Long projectId); List<WeatherVo> getProjectWeather(Long projectId);
/** /**
* 获取项目安全天数 * 获取项目安全天数
@ -70,4 +71,8 @@ public interface ProjectBigScreenService {
* @return 项目概括 * @return 项目概括
*/ */
String getProjectGeneralize(Long projectId); String getProjectGeneralize(Long projectId);
List<String> getList(Long projectId);
void setList(GpsEquipmentBo bo);
} }

View File

@ -0,0 +1,383 @@
package org.dromara.bigscreen.service.impl;
import cn.hutool.core.collection.CollUtil;
import jakarta.annotation.Resource;
import org.dromara.bigscreen.domain.dto.WeatherQueryReq;
import org.dromara.bigscreen.domain.vo.*;
import org.dromara.bigscreen.service.EnterpriseBigScreenService;
import org.dromara.common.core.enums.BusinessStatusEnum;
import org.dromara.common.core.utils.DateUtils;
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.ICtrIncomeContractService;
import org.dromara.manager.weathermanager.WeatherConstant;
import org.dromara.manager.weathermanager.WeatherManager;
import org.dromara.manager.weathermanager.vo.WeatherVo;
import org.dromara.out.domain.BusProcurement;
import org.dromara.out.domain.OutConstructionValue;
import org.dromara.out.domain.OutMonthPlanAudit;
import org.dromara.out.domain.OutValueAllocation;
import org.dromara.out.service.IBusProcurementService;
import org.dromara.out.service.IOutConstructionValueService;
import org.dromara.out.service.IOutMonthPlanAuditService;
import org.dromara.out.service.IOutValueAllocationService;
import org.dromara.progress.domain.PgsProgressCategory;
import org.dromara.progress.domain.PgsProgressPlanDetail;
import org.dromara.progress.service.IPgsProgressCategoryService;
import org.dromara.progress.service.IPgsProgressPlanDetailService;
import org.dromara.project.domain.BusProject;
import org.dromara.project.service.IBusProjectService;
import org.dromara.safety.domain.HseRecognizeRecord;
import org.dromara.safety.domain.HseViolationLevel;
import org.dromara.safety.domain.HseViolationRecord;
import org.dromara.safety.service.IHseRecognizeRecordService;
import org.dromara.safety.service.IHseViolationLevelService;
import org.dromara.safety.service.IHseViolationRecordService;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDate;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author lilemy
* @date 2025-09-09 15:32
*/
@Service
public class EnterpriseBigScreenServiceImpl implements EnterpriseBigScreenService {
@Resource
private WeatherManager weatherManager;
@Resource
private IBusProjectService projectService;
@Resource
private IPgsProgressCategoryService progressCategoryService;
@Resource
private IPgsProgressPlanDetailService progressPlanDetailService;
@Resource
private ICtrIncomeContractService incomeContractService;
@Resource
private ICtrExpensesContractService expensesContractService;
@Resource
private IOutValueAllocationService outValueAllocationService;
@Resource
private IOutMonthPlanAuditService outMonthPlanAuditService;
@Resource
private IOutConstructionValueService outConstructionValueService;
@Resource
private IHseViolationRecordService hseViolationRecordService;
@Resource
private IHseViolationLevelService hseViolationLevelService;
@Resource
private IBusProcurementService busProcurementService;
@Resource
private IHseRecognizeRecordService hseRecognizeRecordService;
/**
* 获取关键指标
*
* @return 关键指标
*/
@Override
public EnterpriseKeyIndexVo getEnterpriseKeyIndex() {
EnterpriseKeyIndexVo vo = new EnterpriseKeyIndexVo();
// 在建项目
List<BusProject> projectList = projectService.lambdaQuery()
.eq(BusProject::getStatus, 0)
.eq(BusProject::getPId, 0)
.list();
// 总容量
BigDecimal totalCapacity = projectList.stream().map(BusProject::getActual)
.filter(s -> s != null && !s.isBlank()) // 过滤掉空值
.map(BigDecimal::new) // 转成 BigDecimal
.reduce(BigDecimal.ZERO, BigDecimal::add);
// 总合同金额
List<CtrIncomeContract> incomeContractList = incomeContractService.lambdaQuery()
.select(CtrIncomeContract::getAmount)
.list();
BigDecimal totalIncomeAmount = incomeContractList.stream()
.map(CtrIncomeContract::getAmount)
.filter(Objects::nonNull)
.reduce(BigDecimal.ZERO, BigDecimal::add);
List<CtrExpensesContract> expensesContractList = expensesContractService.lambdaQuery()
.select(CtrExpensesContract::getAmount)
.list();
BigDecimal totalExpensesAmount = expensesContractList.stream()
.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 项目进度分析
*/
@Override
public ProjectProgressAnalysisVo getProjectProgressAnalysis() {
ProjectProgressAnalysisVo vo = new ProjectProgressAnalysisVo();
// 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 vo;
}
// 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));
// 并网容量 =(完工产值/计划总产值)* 计划容量
List<OutputValueComparisonVo> list = getProjectOutputValueComparison();
BigDecimal actualValue = list.stream()
.map(OutputValueComparisonVo::getActualValue)
.filter(Objects::nonNull)
.reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal planValue = list.stream()
.map(OutputValueComparisonVo::getPlanValue)
.filter(Objects::nonNull)
.reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal plannedCapacity = projectList.stream().map(BusProject::getPlan)
.filter(s -> s != null && !s.isBlank()) // 过滤掉空值
.map(BigDecimal::new) // 转成 BigDecimal
.reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal gridConnectedCapacity = BigDecimal.ZERO;
if (planValue.compareTo(BigDecimal.ZERO) != 0) {
gridConnectedCapacity = plannedCapacity.multiply(actualValue.divide(planValue, 2, RoundingMode.HALF_UP));
}
vo.setGridConnectedCapacity(gridConnectedCapacity);
List<ProjectProgressDetailVo> detailVoList = projectList.stream().map(project -> {
ProjectProgressDetailVo detailVo = new ProjectProgressDetailVo();
detailVo.setProjectName(project.getProjectName());
detailVo.setProjectCapacity(new BigDecimal(project.getActual()));
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.setCompletionRate(BigDecimalUtil.toPercentage(completed, total));
}
return detailVo;
}).toList();
vo.setGridConnectedCapacity(gridConnectedCapacity);
vo.setPlannedCapacity(plannedCapacity);
// todo 获取延迟项目数
vo.setDelayedProjectCount(0);
vo.setProjectProgressDetailList(detailVoList);
return vo;
}
/**
* 获取项目产值对比
*
* @return 项目产值对比
*/
@Override
public List<OutputValueComparisonVo> getProjectOutputValueComparison() {
// 查询顶级项目
List<BusProject> projectList = projectService.lambdaQuery()
.select(BusProject::getId, BusProject::getProjectName, BusProject::getActual, BusProject::getPlan)
.eq(BusProject::getStatus, 0)
.eq(BusProject::getPId, 0)
.list();
// 计划产值
List<OutValueAllocation> planList = outValueAllocationService.lambdaQuery()
.select(OutValueAllocation::getProjectId, OutValueAllocation::getOwnerTotalValue)
.list();
Map<Long, BigDecimal> planMap = planList.stream()
.collect(Collectors.toMap(OutValueAllocation::getProjectId, OutValueAllocation::getOwnerTotalValue));
// 实际产值
// 施工产值
List<OutConstructionValue> constructionValueList = outConstructionValueService.lambdaQuery()
.select(OutConstructionValue::getProjectId, OutConstructionValue::getOwnerValue)
.eq(OutConstructionValue::getAuditStatus, BusinessStatusEnum.FINISH.getStatus())
.list();
// 采购产值
List<BusProcurement> purchaseValueList = busProcurementService.lambdaQuery()
.select(BusProcurement::getProjectId, BusProcurement::getAcceptedQuantity, BusProcurement::getUnitPrice)
.list();
// 设计产值
List<OutMonthPlanAudit> designValueList = outMonthPlanAuditService.lambdaQuery()
.select(OutMonthPlanAudit::getProjectId, OutMonthPlanAudit::getDesignValue)
.eq(OutMonthPlanAudit::getType, "1")
.list();
// 封装数据
return projectList.stream().map(project -> {
OutputValueComparisonVo vo = new OutputValueComparisonVo();
vo.setProjectId(project.getId());
vo.setProjectName(project.getProjectName());
vo.setPlanValue(planMap.getOrDefault(project.getId(), BigDecimal.ZERO));
BigDecimal actualValue = BigDecimal.ZERO;
// 设计产值
List<OutMonthPlanAudit> designValue = designValueList.stream()
.filter(design -> design.getProjectId().equals(project.getId()))
.toList();
if (CollUtil.isNotEmpty(designValue)) {
BigDecimal dValue = designValue.stream()
.filter(Objects::nonNull)
.map(OutMonthPlanAudit::getDesignValue)
.reduce(BigDecimal.ZERO, BigDecimal::add);
actualValue = actualValue.add(dValue);
}
// 施工产值
List<OutConstructionValue> constructionValue = constructionValueList.stream()
.filter(construction -> construction.getProjectId().equals(project.getId()))
.toList();
if (CollUtil.isNotEmpty(constructionValue)) {
BigDecimal cValue = constructionValue.stream()
.filter(Objects::nonNull)
.map(OutConstructionValue::getOwnerValue)
.reduce(BigDecimal.ZERO, BigDecimal::add);
actualValue = actualValue.add(cValue);
}
// 采购产值
List<BusProcurement> purchaseValue = purchaseValueList.stream()
.filter(purchase -> purchase.getProjectId().equals(project.getId()))
.toList();
if (CollUtil.isNotEmpty(purchaseValue)) {
BigDecimal pValue = purchaseValue.stream()
.filter(Objects::nonNull)
.filter(purchase -> purchase.getAcceptedQuantity() != null && purchase.getUnitPrice() != null)
.map(purchase -> purchase.getAcceptedQuantity().multiply(purchase.getUnitPrice()))
.reduce(BigDecimal.ZERO, BigDecimal::add);
actualValue = actualValue.add(pValue);
}
vo.setActualValue(actualValue);
return vo;
}).filter(vo -> vo.getActualValue().compareTo(BigDecimal.ZERO) > 0)
.toList();
}
/**
* 获取风险预警
*
* @return 风险预警
*/
@Override
public List<RiskEarlyWarningVo> getRiskEarlyWarning() {
List<HseViolationRecord> recordList = hseViolationRecordService.lambdaQuery()
.last("limit 10")
.list();
recordList = recordList.stream()
.filter(record -> record.getReviewType() == null || record.getReviewType().equals("2"))
.toList();
if (CollUtil.isEmpty(recordList)) {
return Collections.emptyList();
}
// 项目映射
Set<Long> projectIds = recordList.stream()
.map(HseViolationRecord::getProjectId)
.collect(Collectors.toSet());
List<BusProject> projectList = projectService.lambdaQuery()
.select(BusProject::getId, BusProject::getProjectName)
.in(BusProject::getId, projectIds)
.list();
Map<Long, String> projectMap = projectList.stream()
.collect(Collectors.toMap(BusProject::getId, BusProject::getProjectName));
// 风险映射
Set<Long> levelIds = recordList.stream()
.map(HseViolationRecord::getLevelId)
.collect(Collectors.toSet());
List<HseViolationLevel> levelList = hseViolationLevelService.lambdaQuery()
.select(HseViolationLevel::getId, HseViolationLevel::getRiskType, HseViolationLevel::getViolationLevel)
.in(HseViolationLevel::getId, levelIds)
.list();
Map<Long, HseViolationLevel> levelMap = levelList.stream()
.collect(Collectors.toMap(HseViolationLevel::getId, level -> level));
// 识别记录映射
Set<Long> recognizeIds = recordList.stream()
.map(HseViolationRecord::getRecognizeId)
.collect(Collectors.toSet());
List<HseRecognizeRecord> recognizeRecordList = hseRecognizeRecordService.lambdaQuery()
.in(HseRecognizeRecord::getId, recognizeIds)
.list();
Map<Long, HseRecognizeRecord> recognizeRecordMap = recognizeRecordList.stream()
.collect(Collectors.toMap(HseRecognizeRecord::getId, recognize -> recognize));
return recordList.stream().map(record -> {
RiskEarlyWarningVo vo = new RiskEarlyWarningVo();
Date violationTime = record.getViolationTime() != null ? record.getViolationTime() : record.getCreateTime();
vo.setDate(DateUtils.toLocalDate(violationTime));
vo.setSource(projectMap.getOrDefault(record.getProjectId(), "未知项目"));
vo.setRiskType(record.getViolationType());
if (levelMap.containsKey(record.getLevelId())) {
HseViolationLevel level = levelMap.get(record.getLevelId());
vo.setAlarmLevel(level.getRiskType());
vo.setDangerLevel(level.getViolationLevel());
}
if (recognizeRecordMap.containsKey(record.getRecognizeId())) {
HseRecognizeRecord hseRecognizeRecord = recognizeRecordMap.get(record.getRecognizeId());
vo.setAlarmContent(hseRecognizeRecord.getDescription());
}
return vo;
}).toList();
}
/**
* 获取3天的天气列表
*
* @param req 查询参数
* @return 天气列表
*/
@Override
public List<WeatherVo> getWeather3DaysList(WeatherQueryReq req) {
return weatherManager.getWeatherListVo(req.getLng(), req.getLat(), WeatherConstant.THREE_DAYS_WEATHER_PATH);
}
}

View File

@ -4,10 +4,10 @@ import jakarta.annotation.Resource;
import org.dromara.bigscreen.service.MoneyBigScreenService; import org.dromara.bigscreen.service.MoneyBigScreenService;
import org.dromara.common.core.constant.HttpStatus; import org.dromara.common.core.constant.HttpStatus;
import org.dromara.common.core.exception.ServiceException; import org.dromara.common.core.exception.ServiceException;
import org.dromara.manager.weathermanager.vo.WeatherVo;
import org.dromara.project.domain.BusProject; import org.dromara.project.domain.BusProject;
import org.dromara.project.domain.vo.project.BusProjectGisVo; import org.dromara.project.domain.vo.project.BusProjectGisVo;
import org.dromara.project.domain.vo.project.BusProjectSafetyDayVo; import org.dromara.project.domain.vo.project.BusProjectSafetyDayVo;
import org.dromara.project.domain.vo.project.BusProjectWeatherVo;
import org.dromara.project.service.IBusProjectService; import org.dromara.project.service.IBusProjectService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -40,7 +40,7 @@ public class MoneyBigScreenServiceImpl implements MoneyBigScreenService {
* @return 项目天气 * @return 项目天气
*/ */
@Override @Override
public List<BusProjectWeatherVo> getProjectWeather(Long projectId) { public List<WeatherVo> getProjectWeather(Long projectId) {
checkProject(projectId); checkProject(projectId);
return projectService.getWeather(projectId); return projectService.getWeather(projectId);
} }

View File

@ -1,6 +1,8 @@
package org.dromara.bigscreen.service.impl; package org.dromara.bigscreen.service.impl;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONUtil;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import org.dromara.bigscreen.domain.vo.ProjectImageProgressVo; import org.dromara.bigscreen.domain.vo.ProjectImageProgressVo;
import org.dromara.bigscreen.domain.vo.ProjectPeopleVo; import org.dromara.bigscreen.domain.vo.ProjectPeopleVo;
@ -9,9 +11,12 @@ import org.dromara.bigscreen.domain.vo.ProjectTeamAttendanceVo;
import org.dromara.bigscreen.service.ProjectBigScreenService; import org.dromara.bigscreen.service.ProjectBigScreenService;
import org.dromara.common.core.constant.HttpStatus; import org.dromara.common.core.constant.HttpStatus;
import org.dromara.common.core.exception.ServiceException; import org.dromara.common.core.exception.ServiceException;
import org.dromara.common.redis.utils.RedisUtils;
import org.dromara.common.utils.BigDecimalUtil; import org.dromara.common.utils.BigDecimalUtil;
import org.dromara.contractor.domain.SubConstructionUser; import org.dromara.contractor.domain.SubConstructionUser;
import org.dromara.contractor.service.ISubConstructionUserService; import org.dromara.contractor.service.ISubConstructionUserService;
import org.dromara.gps.domain.bo.GpsEquipmentBo;
import org.dromara.manager.weathermanager.vo.WeatherVo;
import org.dromara.progress.domain.PgsProgressCategory; import org.dromara.progress.domain.PgsProgressCategory;
import org.dromara.progress.domain.enums.PgsProgressUnitTypeEnum; import org.dromara.progress.domain.enums.PgsProgressUnitTypeEnum;
import org.dromara.progress.service.IPgsProgressCategoryService; import org.dromara.progress.service.IPgsProgressCategoryService;
@ -19,7 +24,6 @@ import org.dromara.project.domain.BusProject;
import org.dromara.project.domain.BusProjectTeam; import org.dromara.project.domain.BusProjectTeam;
import org.dromara.project.domain.BusProjectTeamMember; import org.dromara.project.domain.BusProjectTeamMember;
import org.dromara.project.domain.vo.project.BusProjectSafetyDayVo; import org.dromara.project.domain.vo.project.BusProjectSafetyDayVo;
import org.dromara.project.domain.vo.project.BusProjectWeatherVo;
import org.dromara.project.domain.vo.projectnews.BusProjectNewsVo; import org.dromara.project.domain.vo.projectnews.BusProjectNewsVo;
import org.dromara.project.service.*; import org.dromara.project.service.*;
import org.dromara.safety.domain.HseRecognizeRecord; import org.dromara.safety.domain.HseRecognizeRecord;
@ -71,7 +75,7 @@ public class ProjectBigScreenServiceImpl implements ProjectBigScreenService {
* @return 项目天气 * @return 项目天气
*/ */
@Override @Override
public List<BusProjectWeatherVo> getProjectWeather(Long projectId) { public List<WeatherVo> getProjectWeather(Long projectId) {
checkProject(projectId); checkProject(projectId);
return projectService.getWeather(projectId); return projectService.getWeather(projectId);
} }
@ -359,4 +363,25 @@ public class ProjectBigScreenServiceImpl implements ProjectBigScreenService {
} }
} }
@Override
public List<String> getList(Long projectId) {
if (projectId == null){
throw new ServiceException("项目id不能为空");
}
Object object = RedisUtils.getCacheObject("xmjdp:" + projectId);
if (object == null) {
return null;
}
JSONArray objects = JSONUtil.parseArray(object);
return objects.toList(String.class);
}
@Override
public void setList(GpsEquipmentBo bo) {
if (bo.getProjectId() == null){
throw new ServiceException("项目id不能为空");
}
RedisUtils.setCacheObject("xmjdp:"+bo.getProjectId(), bo.getIdList());
}
} }

View File

@ -19,6 +19,7 @@ public class constant {
public static final String PURCHASE_DOC_FILE_URL = "docs/purchase/doc/"; // 采购联系单文件路径 public static final String PURCHASE_DOC_FILE_URL = "docs/purchase/doc/"; // 采购联系单文件路径
public static final String PURCHASE_DOC_TEMPLATE_PATH = "template/物资采购联系单模版.docx"; // 采购联系单文件路径 public static final String PURCHASE_DOC_TEMPLATE_PATH = "template/物资采购联系单模版.docx"; // 采购联系单文件路径
public static final String SUPPLIER_INPUT = "supplierInput";//供应商入库 public static final String SUPPLIER_INPUT = "supplierInput";//供应商入库
public static final String BusFormalitiesAreConsolidatedMoveOut = "ConsolidatedMoveOut";
/** /**
* 获取物资采购联系单文件名 * 获取物资采购联系单文件名

View File

@ -2,6 +2,7 @@ package org.dromara.common.utils.baiduUtil;
import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j;
import org.dromara.common.utils.baiduUtil.entity.face.ComparisonRes; import org.dromara.common.utils.baiduUtil.entity.face.ComparisonRes;
import org.dromara.common.utils.baiduUtil.entity.face.HumanFaceReq; import org.dromara.common.utils.baiduUtil.entity.face.HumanFaceReq;
import org.dromara.common.utils.baiduUtil.entity.face.HumanFaceRes; import org.dromara.common.utils.baiduUtil.entity.face.HumanFaceRes;
@ -23,6 +24,7 @@ import java.util.List;
* @Version 1.0 * @Version 1.0
* 处理百度人脸相关逻辑:人脸检测、人脸对比 * 处理百度人脸相关逻辑:人脸检测、人脸对比
*/ */
@Slf4j
@Service @Service
public class BaiDuFace { public class BaiDuFace {
@ -92,7 +94,8 @@ public class BaiDuFace {
// 7. 处理API返回错误 // 7. 处理API返回错误
if (faceRep.getErrorCode() != 0) { if (faceRep.getErrorCode() != 0) {
throw new RuntimeException("错误码说明:" + faceRep.getErrorMsg()); log.warn("百度人脸API返回错误码{}", faceRep.getErrorCode());
throw new RuntimeException("未检测到有效人脸信息");
} }
// 8. 验证人脸信息(无人脸时抛出异常) // 8. 验证人脸信息(无人脸时抛出异常)

View File

@ -17,10 +17,7 @@ import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.web.core.BaseController; import org.dromara.common.web.core.BaseController;
import org.dromara.contractor.domain.dto.constructionuser.*; import org.dromara.contractor.domain.dto.constructionuser.*;
import org.dromara.contractor.domain.exportvo.BusConstructionUserExportVo; import org.dromara.contractor.domain.exportvo.BusConstructionUserExportVo;
import org.dromara.contractor.domain.vo.constructionuser.SubConstructionUserAttendanceMonthVo; import org.dromara.contractor.domain.vo.constructionuser.*;
import org.dromara.contractor.domain.vo.constructionuser.SubConstructionUserAttendanceTotalVo;
import org.dromara.contractor.domain.vo.constructionuser.SubConstructionUserGisVo;
import org.dromara.contractor.domain.vo.constructionuser.SubConstructionUserVo;
import org.dromara.contractor.service.ISubConstructionUserService; import org.dromara.contractor.service.ISubConstructionUserService;
import org.dromara.project.domain.dto.project.BusProjectQueryReq; import org.dromara.project.domain.dto.project.BusProjectQueryReq;
import org.dromara.project.domain.dto.projectteam.BusProjectTeamQueryReq; import org.dromara.project.domain.dto.projectteam.BusProjectTeamQueryReq;
@ -30,8 +27,10 @@ import org.dromara.project.domain.vo.projectteam.BusProjectTeamVo;
import org.dromara.project.service.IBusProjectService; import org.dromara.project.service.IBusProjectService;
import org.dromara.project.service.IBusProjectTeamMemberService; import org.dromara.project.service.IBusProjectTeamMemberService;
import org.dromara.project.service.IBusProjectTeamService; import org.dromara.project.service.IBusProjectTeamService;
import org.dromara.system.domain.vo.SysOssVo;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.List; import java.util.List;
@ -233,7 +232,34 @@ public class SubConstructionUserController extends BaseController {
return R.ok(busProjectTeamMemberService.insertByBo(req)); return R.ok(busProjectTeamMemberService.insertByBo(req));
} }
/**
* 根据身份证图片获取身份证信息
*/
@SaCheckPermission("contractor:constructionUser:add")
@Log(title = "施工人员", businessType = BusinessType.OTHER)
@PostMapping("/idCard")
public R<SubConstructionUserOrcIdCardVo> getIdCardMessage(@RequestParam("file") MultipartFile file, String idCardSide) {
return R.ok(constructionUserService.getIdCardMessageByPic(file, idCardSide));
}
/**
* 根据银行卡图片获取银行卡信息
*/
@SaCheckPermission("contractor:constructionUser:add")
@Log(title = "施工人员", businessType = BusinessType.OTHER)
@PostMapping("/bankCard")
public R<SubConstructionUserOrcBankVo> getBankCardMessage(@RequestParam("file") MultipartFile file) {
return R.ok(constructionUserService.getBankCardMessageByPic(file));
}
/**
* 人脸识别
*/
@SaCheckPermission("contractor:constructionUser:add")
@Log(title = "施工人员", businessType = BusinessType.OTHER)
@PostMapping("/face/recognize")
public R<SysOssVo> faceRecognize(@RequestParam("file") MultipartFile file) {
return R.ok(constructionUserService.faceRecognize(file));
}
} }

View File

@ -1,8 +1,11 @@
package org.dromara.contractor.controller.app; package org.dromara.contractor.controller.app;
import cn.dev33.satoken.annotation.SaCheckPermission;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import org.dromara.common.core.domain.R; import org.dromara.common.core.domain.R;
import org.dromara.common.core.validate.AddGroup;
import org.dromara.common.idempotent.annotation.RepeatSubmit;
import org.dromara.common.log.annotation.Log; import org.dromara.common.log.annotation.Log;
import org.dromara.common.log.enums.BusinessType; import org.dromara.common.log.enums.BusinessType;
import org.dromara.common.mybatis.core.page.PageQuery; import org.dromara.common.mybatis.core.page.PageQuery;
@ -11,10 +14,14 @@ import org.dromara.common.satoken.utils.LoginHelper;
import org.dromara.contractor.domain.SubConstructionUser; import org.dromara.contractor.domain.SubConstructionUser;
import org.dromara.contractor.domain.dto.constructionuser.SubConstructionUserAuthenticationReq; import org.dromara.contractor.domain.dto.constructionuser.SubConstructionUserAuthenticationReq;
import org.dromara.contractor.domain.dto.constructionuser.SubConstructionUserQueryReq; import org.dromara.contractor.domain.dto.constructionuser.SubConstructionUserQueryReq;
import org.dromara.contractor.domain.vo.constructionuser.SubConstructionUserAppVo;
import org.dromara.contractor.domain.vo.constructionuser.SubConstructionUserOrcBankVo; import org.dromara.contractor.domain.vo.constructionuser.SubConstructionUserOrcBankVo;
import org.dromara.contractor.domain.vo.constructionuser.SubConstructionUserOrcIdCardVo; import org.dromara.contractor.domain.vo.constructionuser.SubConstructionUserOrcIdCardVo;
import org.dromara.contractor.domain.vo.constructionuser.SubConstructionUserVo; import org.dromara.contractor.domain.vo.constructionuser.SubConstructionUserVo;
import org.dromara.contractor.service.ISubConstructionUserService; import org.dromara.contractor.service.ISubConstructionUserService;
import org.dromara.project.domain.dto.projectteammember.BusProjectTeamMemberCreateReq;
import org.dromara.project.service.IBusProjectTeamMemberService;
import org.dromara.system.domain.vo.SysOssVo;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
@ -33,6 +40,9 @@ public class SubConstructionUserAppController {
@Resource @Resource
private ISubConstructionUserService constructionUserService; private ISubConstructionUserService constructionUserService;
@Resource
private IBusProjectTeamMemberService busProjectTeamMemberService;
/** /**
* 查询施工人员列表 * 查询施工人员列表
*/ */
@ -111,6 +121,15 @@ public class SubConstructionUserAppController {
return R.ok(constructionUserService.insertByAuthentication(req)); return R.ok(constructionUserService.insertByAuthentication(req));
} }
/**
* 人脸识别
*/
@Log(title = "施工人员", businessType = BusinessType.OTHER)
@PostMapping("/face/recognize")
public R<SysOssVo> faceRecognize(@RequestParam("file") MultipartFile file) {
return R.ok(constructionUserService.faceRecognize(file));
}
/** /**
* 施工人员人脸比对 * 施工人员人脸比对
*/ */
@ -120,4 +139,21 @@ public class SubConstructionUserAppController {
return R.ok(constructionUserService.faceComparison(file)); return R.ok(constructionUserService.faceComparison(file));
} }
/**
* 查询未分配施工人员列表
*/
@GetMapping("/undistributedList")
public TableDataInfo<SubConstructionUserAppVo> queryUndistributedList(SubConstructionUserQueryReq req, PageQuery pageQuery) {
return constructionUserService.queryUndistributedList(req, pageQuery);
}
/**
* 添加项目班组
*/
@RepeatSubmit()
@PostMapping("/addTeam")
public R<Long> add(@Validated(AddGroup.class) @RequestBody BusProjectTeamMemberCreateReq req) {
return R.ok(busProjectTeamMemberService.insertByBo(req));
}
} }

View File

@ -0,0 +1,85 @@
package org.dromara.contractor.domain.vo.constructionuser;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import org.dromara.common.excel.annotation.ExcelDictFormat;
import org.dromara.common.excel.convert.ExcelDictConvert;
import org.dromara.common.translation.annotation.Translation;
import org.dromara.common.translation.constant.TransConstant;
import org.dromara.contractor.domain.SubConstructionUser;
import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.Date;
/**
* 施工人员视图对象 bus_construction_user
*
* @author lilemy
* @date 2025-03-07
*/
@Data
@ExcelIgnoreUnannotated
@AutoMapper(target = SubConstructionUser.class)
public class SubConstructionUserAppVo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
@ExcelProperty(value = "主键id")
private Long id;
/**
* 人员姓名
*/
@ExcelProperty(value = "人员姓名")
private String userName;
/**
* 联系电话
*/
@ExcelProperty(value = "联系电话")
private String phone;
/**
* 工种
*/
@ExcelProperty(value = "工种", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "type_of_work")
private String typeOfWork;
/**
* 工种名
*/
@Translation(type = TransConstant.DICT_TYPE_TO_LABEL, mapper = "typeOfWork",other = "type_of_work")
private String typeOfWorkName;
/**
* 用户Id
*/
private Long sysUserId;
/**
* 用户头像
*/
private String avatar;
/**
* 入驻天数
*/
private Long days;
/**
* 用户性别0男 1女 2未知
*/
private String sex;
}

View File

@ -9,6 +9,7 @@ import org.dromara.contractor.domain.SubConstructionUser;
import org.dromara.contractor.domain.dto.constructionuser.*; import org.dromara.contractor.domain.dto.constructionuser.*;
import org.dromara.contractor.domain.exportvo.BusConstructionUserExportVo; import org.dromara.contractor.domain.exportvo.BusConstructionUserExportVo;
import org.dromara.contractor.domain.vo.constructionuser.*; import org.dromara.contractor.domain.vo.constructionuser.*;
import org.dromara.system.domain.vo.SysOssVo;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.util.Collection; import java.util.Collection;
@ -198,6 +199,14 @@ public interface ISubConstructionUserService extends IService<SubConstructionUse
*/ */
Long insertByAuthentication(SubConstructionUserAuthenticationReq req); Long insertByAuthentication(SubConstructionUserAuthenticationReq req);
/**
* 人脸识别
*
* @param file 图片文件
* @return 人脸识别结果
*/
SysOssVo faceRecognize(MultipartFile file);
/** /**
* 人脸识别 * 人脸识别
* *
@ -214,4 +223,7 @@ public interface ISubConstructionUserService extends IService<SubConstructionUse
*/ */
SubConstructionUser getBySysUserId(Long sysUserId); SubConstructionUser getBySysUserId(Long sysUserId);
TableDataInfo<SubConstructionUserAppVo> queryUndistributedList(SubConstructionUserQueryReq req, PageQuery pageQuery);
} }

View File

@ -6,7 +6,6 @@ import cn.hutool.core.util.RandomUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.core.util.ZipUtil; import cn.hutool.core.util.ZipUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
@ -320,8 +319,6 @@ public class SubConstructionUserFileServiceImpl extends ServiceImpl<SubConstruct
throw new ServiceException("施工人员不存在", HttpStatus.NOT_FOUND); throw new ServiceException("施工人员不存在", HttpStatus.NOT_FOUND);
} }
// 2. 查询当前用户的所有文件记录(一次性查询,避免多次访问数据库) // 2. 查询当前用户的所有文件记录(一次性查询,避免多次访问数据库)
LambdaQueryWrapper<SubConstructionUserFile> lqw = Wrappers.lambdaQuery(SubConstructionUserFile.class)
.eq(SubConstructionUserFile::getUserId, userId);
List<SubConstructionUserFile> constructionUserFileList = this.lambdaQuery() List<SubConstructionUserFile> constructionUserFileList = this.lambdaQuery()
.eq(SubConstructionUserFile::getUserId, userId) .eq(SubConstructionUserFile::getUserId, userId)
.list(); .list();

View File

@ -66,10 +66,8 @@ import org.springframework.web.multipart.MultipartFile;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDate; import java.time.*;
import java.time.LocalDateTime; import java.time.temporal.ChronoUnit;
import java.time.Period;
import java.time.YearMonth;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -645,9 +643,12 @@ public class SubConstructionUserServiceImpl extends ServiceImpl<SubConstructionU
// 批量删除施工人员下的文件信息 // 批量删除施工人员下的文件信息
LambdaQueryWrapper<SubConstructionUserFile> constructionUserFileLqw = Wrappers.lambdaQuery(SubConstructionUserFile.class) LambdaQueryWrapper<SubConstructionUserFile> constructionUserFileLqw = Wrappers.lambdaQuery(SubConstructionUserFile.class)
.in(SubConstructionUserFile::getUserId, ids); .in(SubConstructionUserFile::getUserId, ids);
boolean removeFile = constructionUserFileService.remove(constructionUserFileLqw); List<SubConstructionUserFile> fileList = constructionUserFileService.list(constructionUserFileLqw);
if (!removeFile) { if (CollUtil.isNotEmpty(fileList)) {
throw new ServiceException("删除施工人员信息失败,施工人员文件信息删除失败", HttpStatus.ERROR); boolean removeFile = constructionUserFileService.remove(constructionUserFileLqw);
if (!removeFile) {
throw new ServiceException("删除施工人员信息失败,施工人员文件信息删除失败", HttpStatus.ERROR);
}
} }
// 批量删除施工人员信息 // 批量删除施工人员信息
return this.removeBatchByIds(ids); return this.removeBatchByIds(ids);
@ -676,7 +677,10 @@ public class SubConstructionUserServiceImpl extends ServiceImpl<SubConstructionU
// 关联查询分包公司信息信息 // 关联查询分包公司信息信息
Long contractorId = constructionUser.getContractorId(); Long contractorId = constructionUser.getContractorId();
if (contractorId != null) { if (contractorId != null) {
constructionUserVo.setContractorName(contractorService.getById(contractorId).getName()); SubContractor contractor = contractorService.getById(contractorId);
if (contractor != null) {
constructionUserVo.setContractorName(contractor.getName());
}
} }
// 关联查询用户头像url // 关联查询用户头像url
String facePic = constructionUser.getFacePic(); String facePic = constructionUser.getFacePic();
@ -1195,6 +1199,22 @@ public class SubConstructionUserServiceImpl extends ServiceImpl<SubConstructionU
return user.getId(); return user.getId();
} }
/**
* 人脸识别
*
* @param file 图片文件
* @return 人脸识别结果
*/
@Override
public SysOssVo faceRecognize(MultipartFile file) {
String reqBase64 = this.getPicBase64(file);
HumanFaceReq faceReq = new HumanFaceReq();
faceReq.setImage(reqBase64);
// 调用人脸识别接口
baiDuFace.humanFace(faceReq);
return ossService.upload(file);
}
/** /**
* 人脸识别 * 人脸识别
* *
@ -1203,18 +1223,7 @@ public class SubConstructionUserServiceImpl extends ServiceImpl<SubConstructionU
*/ */
@Override @Override
public Boolean faceComparison(MultipartFile file) { public Boolean faceComparison(MultipartFile file) {
if (file == null) { String reqBase64 = this.getPicBase64(file);
throw new ServiceException("请上传图片", HttpStatus.BAD_REQUEST);
}
String reqBase64;
try {
// 获取文件字节数组
byte[] bytes = file.getBytes();
// Base64 编码
reqBase64 = Base64.getEncoder().encodeToString(bytes);
} catch (IOException e) {
throw new ServiceException("图片转换失败,请重新上传");
}
HumanFaceReq request = new HumanFaceReq(); HumanFaceReq request = new HumanFaceReq();
request.setImage(reqBase64); request.setImage(reqBase64);
Long userId = LoginHelper.getUserId(); Long userId = LoginHelper.getUserId();
@ -1264,4 +1273,64 @@ public class SubConstructionUserServiceImpl extends ServiceImpl<SubConstructionU
return constructionUser; return constructionUser;
} }
/**
* 获取图片的Base64编码
*
* @param file 图片文件
* @return 图片的Base64编码
*/
private String getPicBase64(MultipartFile file) {
if (file == null) {
throw new ServiceException("请上传图片", HttpStatus.BAD_REQUEST);
}
String reqBase64;
try {
// 获取文件字节数组
byte[] bytes = file.getBytes();
// Base64 编码
reqBase64 = Base64.getEncoder().encodeToString(bytes);
} catch (IOException e) {
throw new ServiceException("图片转换失败,请重新上传");
}
return reqBase64;
}
@Override
public TableDataInfo<SubConstructionUserAppVo> queryUndistributedList(SubConstructionUserQueryReq req, PageQuery pageQuery) {
LambdaQueryWrapper<SubConstructionUser> lqw = Wrappers.lambdaQuery();
String userName = req.getUserName();
String typeOfWork = req.getTypeOfWork();
lqw.like(StringUtils.isNotBlank(userName), SubConstructionUser::getUserName, userName);
lqw.eq(ObjectUtils.isNotEmpty(typeOfWork), SubConstructionUser::getTypeOfWork, typeOfWork);
lqw.isNull(SubConstructionUser::getProjectId);
lqw.isNull(SubConstructionUser::getTeamId);
Page<SubConstructionUser> result = this.page(pageQuery.build(), lqw);
ArrayList<SubConstructionUserAppVo> list = new ArrayList<>();
for ( SubConstructionUser constructionUser : result.getRecords()){
SubConstructionUserAppVo subConstructionUserAppVo = new SubConstructionUserAppVo();
BeanUtils.copyProperties(constructionUser, subConstructionUserAppVo);
SysUserVo sysUserVo = userService.selectUserById(subConstructionUserAppVo.getSysUserId());
if(sysUserVo.getAvatar() != null)
subConstructionUserAppVo.setAvatar(ossService.getById(sysUserVo.getAvatar()).getUrl());
//计算日期
Date createTime = sysUserVo.getCreateTime();
Instant createInstant = createTime.toInstant();
Instant nowInstant = Instant.now();
long days = ChronoUnit.DAYS.between(
createInstant.atZone(ZoneId.systemDefault()).toLocalDateTime(),
nowInstant.atZone(ZoneId.systemDefault()).toLocalDateTime()
);
subConstructionUserAppVo.setDays(days);
subConstructionUserAppVo.setSex(sysUserVo.getSex());
list.add(subConstructionUserAppVo);
}
return new TableDataInfo<>(list,result.getTotal());
}
} }

View File

@ -40,6 +40,11 @@ public class BusBillofquantitiesVersions extends BaseEntity {
*/ */
private String versions; private String versions;
/**
* 版本号名称
*/
private String versionsName;
/** /**
* exlce文件 * exlce文件
*/ */

View File

@ -39,4 +39,11 @@ public class BusBillofquantitiesVersionsBo extends BaseEntity {
private String versions; private String versions;
/**
* 版本号名称
*/
private String versionsName;
} }

View File

@ -40,4 +40,7 @@ public class DesVolumeCatalogQueryReq implements Serializable {
private String type; private String type;
private String isUpload;
} }

View File

@ -48,6 +48,13 @@ public class BusBillofquantitiesVersionsVo implements Serializable {
private String versions; private String versions;
/**
* 版本号名称
*/
private String versionsName;
/** /**
* Excel文件 * Excel文件
*/ */

View File

@ -191,8 +191,22 @@ public class BusBillofquantitiesVersionsServiceImpl extends ServiceImpl<BusBillo
throw new ServiceException("上传文件失败"); throw new ServiceException("上传文件失败");
} }
String banBen = BatchNumberGenerator.generateBatchNumber("GCLBB-"); String banBen = BatchNumberGenerator.generateBatchNumber("GCLBB-");
String[] split = StringUtils.split(wordEntity.getFileName(),".xlsx");
String vName = "";
switch (bo.getWorkOrderType()){
case "0":
vName = "投标工程量清单-"+split[0];
case "1":
vName = "限价工程量清单-"+split[0];
case "2":
vName = "招采工程量清单-"+split[0];
case "3":
vName = "物资设备清单-"+split[0];
}
int insert = baseMapper.insert(new BusBillofquantitiesVersions(). int insert = baseMapper.insert(new BusBillofquantitiesVersions().
setWorkOrderType(bo.getWorkOrderType()). setWorkOrderType(bo.getWorkOrderType()).
setVersionsName(vName).
setVersions(banBen). setVersions(banBen).
setProjectId(bo.getProjectId()). setProjectId(bo.getProjectId()).
setExcelFile(wordEntity.getUrl())); setExcelFile(wordEntity.getUrl()));

View File

@ -334,12 +334,17 @@ public class DesVolumeCatalogServiceImpl extends ServiceImpl<DesVolumeCatalogMap
String volumeNumber = req.getVolumeNumber(); String volumeNumber = req.getVolumeNumber();
String documentName = req.getDocumentName(); String documentName = req.getDocumentName();
String auditStatus = req.getAuditStatus(); String auditStatus = req.getAuditStatus();
String isUpload = req.getIsUpload();
// lqw.orderByDesc(DesVolumeCatalog::getCreateTime); // lqw.orderByDesc(DesVolumeCatalog::getCreateTime);
lqw.orderByAsc(DesVolumeCatalog::getSerialNumber); lqw.orderByAsc(DesVolumeCatalog::getSerialNumber);
lqw.like(StringUtils.isNotBlank(documentName), DesVolumeCatalog::getDocumentName, documentName); lqw.like(StringUtils.isNotBlank(documentName), DesVolumeCatalog::getDocumentName, documentName);
lqw.eq(StringUtils.isNotBlank(volumeNumber), DesVolumeCatalog::getVolumeNumber, volumeNumber); lqw.eq(StringUtils.isNotBlank(volumeNumber), DesVolumeCatalog::getVolumeNumber, volumeNumber);
lqw.eq(ObjectUtils.isNotEmpty(projectId), DesVolumeCatalog::getProjectId, projectId); lqw.eq(ObjectUtils.isNotEmpty(projectId), DesVolumeCatalog::getProjectId, projectId);
lqw.eq(StringUtils.isNotBlank(auditStatus), DesVolumeCatalog::getAuditStatus, auditStatus); lqw.eq(StringUtils.isNotBlank(auditStatus), DesVolumeCatalog::getAuditStatus, auditStatus);
lqw.exists("1".equals(isUpload),"SELECT 1 FROM des_volume_file WHERE volume_catalog_id = des_volume_catalog.design");
lqw.notExists("0".equals(isUpload),"SELECT 1 FROM des_volume_file WHERE volume_catalog_id = des_volume_catalog.design");
return lqw; return lqw;
} }

View File

@ -94,7 +94,9 @@ public class DesVolumeFileServiceImpl extends ServiceImpl<DesVolumeFileMapper, D
Page<DesVolumeFileVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw); Page<DesVolumeFileVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
for (DesVolumeFileVo vo : result.getRecords()) { for (DesVolumeFileVo vo : result.getRecords()) {
SysOssVo ossVo = ossService.getById(vo.getFileId()); SysOssVo ossVo = ossService.getById(vo.getFileId());
vo.setFileUrl(ossVo.getUrl()); if (ossVo != null) {
vo.setFileUrl(ossVo.getUrl());
}
} }
return TableDataInfo.build(result); return TableDataInfo.build(result);
} }
@ -269,18 +271,18 @@ public class DesVolumeFileServiceImpl extends ServiceImpl<DesVolumeFileMapper, D
} }
} }
// 过程文件 // 过程文件
if (CollectionUtil.isNotEmpty(req.getCancellationIds())) { // if (CollectionUtil.isNotEmpty(req.getCancellationIds())) {
List<DesVolumeFile> existingFiles = baseMapper.selectList(new LambdaQueryWrapper<DesVolumeFile>() // List<DesVolumeFile> existingFiles = baseMapper.selectList(new LambdaQueryWrapper<DesVolumeFile>()
.eq(DesVolumeFile::getVolumeCatalogId, req.getVolumeCatalogId()) // .eq(DesVolumeFile::getVolumeCatalogId, req.getVolumeCatalogId())
.eq(DesVolumeFile::getType, DesVolumeFile.PROCESS) // .eq(DesVolumeFile::getType, DesVolumeFile.PROCESS)
.orderByDesc(DesVolumeFile::getVersion)); // .orderByDesc(DesVolumeFile::getVersion));
if (!existingFiles.isEmpty()) { // if (!existingFiles.isEmpty()) {
DesVolumeFile first = existingFiles.getFirst(); // DesVolumeFile first = existingFiles.getFirst();
if (!BusinessStatusEnum.FINISH.getStatus().equals(first.getAuditStatus())) { // if (!BusinessStatusEnum.FINISH.getStatus().equals(first.getAuditStatus())) {
throw new ServiceException("文件尚未审核完成,请勿重复上传"); // throw new ServiceException("文件尚未审核完成,请勿重复上传");
} // }
} // }
} // }
} }

View File

@ -36,6 +36,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*; import java.util.*;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -248,10 +249,10 @@ public class FacBoxTransformerServiceImpl extends ServiceImpl<FacBoxTransformerM
progressCategory.setTotal(BigDecimal.valueOf(total)); progressCategory.setTotal(BigDecimal.valueOf(total));
// 如果单价不为 0 则计算产值 // 如果单价不为 0 则计算产值
if (ownerPrice.compareTo(BigDecimal.ZERO) != 0) { if (ownerPrice.compareTo(BigDecimal.ZERO) != 0) {
progressCategory.setOwnerOutputValue(ownerPrice.multiply(BigDecimal.valueOf(total))); progressCategory.setOwnerOutputValue(ownerPrice.multiply(BigDecimal.valueOf(total)).setScale(4, RoundingMode.HALF_UP));
} }
if (constructionPrice.compareTo(BigDecimal.ZERO) != 0) { if (constructionPrice.compareTo(BigDecimal.ZERO) != 0) {
progressCategory.setOwnerOutputValue(constructionPrice.multiply(BigDecimal.valueOf(total))); progressCategory.setOwnerOutputValue(constructionPrice.multiply(BigDecimal.valueOf(total)).setScale(4, RoundingMode.HALF_UP));
} }
} }
boolean result = progressCategoryService.updateBatchById(progressCategoryList); boolean result = progressCategoryService.updateBatchById(progressCategoryList);
@ -309,11 +310,11 @@ public class FacBoxTransformerServiceImpl extends ServiceImpl<FacBoxTransformerM
progressCategory.setOwnerOutputValue(total.multiply( progressCategory.setOwnerOutputValue(total.multiply(
Optional.ofNullable(progressCategory.getOwnerPrice()) Optional.ofNullable(progressCategory.getOwnerPrice())
.orElse(BigDecimal.ZERO) .orElse(BigDecimal.ZERO)
)); ).setScale(4, RoundingMode.HALF_UP));
progressCategory.setConstructionOutputValue(total.multiply( progressCategory.setConstructionOutputValue(total.multiply(
Optional.ofNullable(progressCategory.getConstructionPrice()) Optional.ofNullable(progressCategory.getConstructionPrice())
.orElse(BigDecimal.ZERO) .orElse(BigDecimal.ZERO)
)); ).setScale(4, RoundingMode.HALF_UP));
boolean result = progressCategoryService.updateById(progressCategory); boolean result = progressCategoryService.updateById(progressCategory);
if (!result) { if (!result) {
throw new ServiceException("更新进度失败,数据库异常", HttpStatus.ERROR); throw new ServiceException("更新进度失败,数据库异常", HttpStatus.ERROR);

View File

@ -36,6 +36,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*; import java.util.*;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -248,10 +249,10 @@ public class FacInverterServiceImpl extends ServiceImpl<FacInverterMapper, FacIn
progressCategory.setTotal(BigDecimal.valueOf(total)); progressCategory.setTotal(BigDecimal.valueOf(total));
// 如果单价不为 0 则计算产值 // 如果单价不为 0 则计算产值
if (ownerPrice.compareTo(BigDecimal.ZERO) != 0) { if (ownerPrice.compareTo(BigDecimal.ZERO) != 0) {
progressCategory.setOwnerOutputValue(ownerPrice.multiply(BigDecimal.valueOf(total))); progressCategory.setOwnerOutputValue(ownerPrice.multiply(BigDecimal.valueOf(total)).setScale(4, RoundingMode.HALF_UP));
} }
if (constructionPrice.compareTo(BigDecimal.ZERO) != 0) { if (constructionPrice.compareTo(BigDecimal.ZERO) != 0) {
progressCategory.setConstructionOutputValue(constructionPrice.multiply(BigDecimal.valueOf(total))); progressCategory.setConstructionOutputValue(constructionPrice.multiply(BigDecimal.valueOf(total)).setScale(4, RoundingMode.HALF_UP));
} }
} }
boolean result = progressCategoryService.updateBatchById(progressCategoryList); boolean result = progressCategoryService.updateBatchById(progressCategoryList);
@ -309,11 +310,11 @@ public class FacInverterServiceImpl extends ServiceImpl<FacInverterMapper, FacIn
progressCategory.setOwnerOutputValue(total.multiply( progressCategory.setOwnerOutputValue(total.multiply(
Optional.ofNullable(progressCategory.getOwnerPrice()) Optional.ofNullable(progressCategory.getOwnerPrice())
.orElse(BigDecimal.ZERO) .orElse(BigDecimal.ZERO)
)); ).setScale(4, RoundingMode.HALF_UP));
progressCategory.setConstructionOutputValue(total.multiply( progressCategory.setConstructionOutputValue(total.multiply(
Optional.ofNullable(progressCategory.getConstructionPrice()) Optional.ofNullable(progressCategory.getConstructionPrice())
.orElse(BigDecimal.ZERO) .orElse(BigDecimal.ZERO)
)); ).setScale(4, RoundingMode.HALF_UP));
boolean result = progressCategoryService.updateById(progressCategory); boolean result = progressCategoryService.updateById(progressCategory);
if (!result) { if (!result) {
throw new ServiceException("更新进度失败,数据库异常", HttpStatus.ERROR); throw new ServiceException("更新进度失败,数据库异常", HttpStatus.ERROR);

View File

@ -13,6 +13,7 @@ import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.mybatis.core.page.PageQuery; 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.common.satoken.utils.LoginHelper; import org.dromara.common.satoken.utils.LoginHelper;
import org.dromara.common.utils.JSTUtil;
import org.dromara.facility.constant.FacRedisKeyConstant; import org.dromara.facility.constant.FacRedisKeyConstant;
import org.dromara.facility.domain.*; import org.dromara.facility.domain.*;
import org.dromara.facility.domain.dto.geojson.*; import org.dromara.facility.domain.dto.geojson.*;
@ -27,7 +28,6 @@ import org.dromara.facility.service.*;
import org.dromara.progress.service.IPgsProgressCategoryService; import org.dromara.progress.service.IPgsProgressCategoryService;
import org.dromara.project.domain.BusProject; import org.dromara.project.domain.BusProject;
import org.dromara.project.service.IBusProjectService; import org.dromara.project.service.IBusProjectService;
import org.dromara.common.utils.JSTUtil;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
@ -659,7 +659,7 @@ public class FacMatrixServiceImpl extends ServiceImpl<FacMatrixMapper, FacMatrix
FacPhotovoltaicPanel::getStatus FacPhotovoltaicPanel::getStatus
) )
.eq(FacPhotovoltaicPanel::getProjectId, projectId) .eq(FacPhotovoltaicPanel::getProjectId, projectId)
.eq(FacPhotovoltaicPanel::getProgressCategoryName, "光伏板") .eq(FacPhotovoltaicPanel::getProgressCategoryName, "组件安装")
.in(CollUtil.isNotEmpty(matrixIdList), FacPhotovoltaicPanel::getMatrixId, matrixIdList) .in(CollUtil.isNotEmpty(matrixIdList), FacPhotovoltaicPanel::getMatrixId, matrixIdList)
.list(); .list();
List<FacFacilityPositionGisVo> panelVoList = panelList.stream().map(obj -> List<FacFacilityPositionGisVo> panelVoList = panelList.stream().map(obj ->

View File

@ -33,6 +33,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -178,11 +179,11 @@ public class FacPhotovoltaicPanelColumnServiceImpl extends ServiceImpl<FacPhotov
progressCategory.setOwnerOutputValue(total.multiply( progressCategory.setOwnerOutputValue(total.multiply(
Optional.ofNullable(progressCategory.getOwnerPrice()) Optional.ofNullable(progressCategory.getOwnerPrice())
.orElse(BigDecimal.ZERO) .orElse(BigDecimal.ZERO)
)); ).setScale(4, RoundingMode.HALF_UP));
progressCategory.setConstructionOutputValue(total.multiply( progressCategory.setConstructionOutputValue(total.multiply(
Optional.ofNullable(progressCategory.getConstructionPrice()) Optional.ofNullable(progressCategory.getConstructionPrice())
.orElse(BigDecimal.ZERO) .orElse(BigDecimal.ZERO)
)); ).setScale(4, RoundingMode.HALF_UP));
boolean result = progressCategoryService.updateById(progressCategory); boolean result = progressCategoryService.updateById(progressCategory);
if (!result) { if (!result) {
throw new ServiceException("更新进度失败,数据库异常", HttpStatus.ERROR); throw new ServiceException("更新进度失败,数据库异常", HttpStatus.ERROR);

View File

@ -43,6 +43,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*; import java.util.*;
import java.util.concurrent.*; import java.util.concurrent.*;
import java.util.function.Function; import java.util.function.Function;
@ -494,10 +495,10 @@ public class FacPhotovoltaicPanelPartsServiceImpl implements IFacPhotovoltaicPan
progressCategory.setTotal(BigDecimal.valueOf(total)); progressCategory.setTotal(BigDecimal.valueOf(total));
// 如果单价不为 0 则计算产值 // 如果单价不为 0 则计算产值
if (ownerPrice != null && ownerPrice.compareTo(BigDecimal.ZERO) != 0) { if (ownerPrice != null && ownerPrice.compareTo(BigDecimal.ZERO) != 0) {
progressCategory.setOwnerOutputValue(ownerPrice.multiply(BigDecimal.valueOf(total))); progressCategory.setOwnerOutputValue(ownerPrice.multiply(BigDecimal.valueOf(total)).setScale(4, RoundingMode.HALF_UP));
} }
if (constructionPrice != null && constructionPrice.compareTo(BigDecimal.ZERO) != 0) { if (constructionPrice != null && constructionPrice.compareTo(BigDecimal.ZERO) != 0) {
progressCategory.setConstructionOutputValue(constructionPrice.multiply(BigDecimal.valueOf(total))); progressCategory.setConstructionOutputValue(constructionPrice.multiply(BigDecimal.valueOf(total)).setScale(4, RoundingMode.HALF_UP));
} }
} }
boolean result = progressCategoryService.updateBatchById(progressCategoryList); boolean result = progressCategoryService.updateBatchById(progressCategoryList);

View File

@ -33,6 +33,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -178,11 +179,11 @@ public class FacPhotovoltaicPanelPointServiceImpl extends ServiceImpl<FacPhotovo
progressCategory.setOwnerOutputValue(total.multiply( progressCategory.setOwnerOutputValue(total.multiply(
Optional.ofNullable(progressCategory.getOwnerPrice()) Optional.ofNullable(progressCategory.getOwnerPrice())
.orElse(BigDecimal.ZERO) .orElse(BigDecimal.ZERO)
)); ).setScale(4, RoundingMode.HALF_UP));
progressCategory.setConstructionOutputValue(total.multiply( progressCategory.setConstructionOutputValue(total.multiply(
Optional.ofNullable(progressCategory.getConstructionPrice()) Optional.ofNullable(progressCategory.getConstructionPrice())
.orElse(BigDecimal.ZERO) .orElse(BigDecimal.ZERO)
)); ).setScale(4, RoundingMode.HALF_UP));
boolean result = progressCategoryService.updateById(progressCategory); boolean result = progressCategoryService.updateById(progressCategory);
if (!result) { if (!result) {
throw new ServiceException("更新进度失败,数据库异常", HttpStatus.ERROR); throw new ServiceException("更新进度失败,数据库异常", HttpStatus.ERROR);

View File

@ -46,6 +46,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*; import java.util.*;
import java.util.concurrent.*; import java.util.concurrent.*;
import java.util.function.Function; import java.util.function.Function;
@ -277,7 +278,7 @@ public class FacPhotovoltaicPanelServiceImpl extends ServiceImpl<FacPhotovoltaic
String name = nameProperties.getText(); String name = nameProperties.getText();
// ① 获取名称 // ① 获取名称
if (StringUtils.isBlank(name)) return Collections.emptyList(); if (StringUtils.isBlank(name)) return Collections.emptyList();
if (!name.startsWith("G")) return Collections.emptyList(); // if (!name.startsWith("G")) return Collections.emptyList();
List<FacPhotovoltaicPanel> panelList = new ArrayList<>(); List<FacPhotovoltaicPanel> panelList = new ArrayList<>();
// ② 找到该点对应的 polygon优先包含否则最近 // ② 找到该点对应的 polygon优先包含否则最近
FacFeatureByPlane matchedPolygon = JSTUtil.findNearestOrContainingPolygon(nameFeature, locationFeatures); FacFeatureByPlane matchedPolygon = JSTUtil.findNearestOrContainingPolygon(nameFeature, locationFeatures);
@ -387,10 +388,10 @@ public class FacPhotovoltaicPanelServiceImpl extends ServiceImpl<FacPhotovoltaic
progressCategory.setTotal(BigDecimal.valueOf(total)); progressCategory.setTotal(BigDecimal.valueOf(total));
// 如果单价不为 0 则计算产值 // 如果单价不为 0 则计算产值
if (ownerPrice.compareTo(BigDecimal.ZERO) != 0) { if (ownerPrice.compareTo(BigDecimal.ZERO) != 0) {
progressCategory.setOwnerOutputValue(ownerPrice.multiply(BigDecimal.valueOf(total))); progressCategory.setOwnerOutputValue(ownerPrice.multiply(BigDecimal.valueOf(total)).setScale(4, RoundingMode.HALF_UP));
} }
if (constructionPrice.compareTo(BigDecimal.ZERO) != 0) { if (constructionPrice.compareTo(BigDecimal.ZERO) != 0) {
progressCategory.setConstructionOutputValue(constructionPrice.multiply(BigDecimal.valueOf(total))); progressCategory.setConstructionOutputValue(constructionPrice.multiply(BigDecimal.valueOf(total)).setScale(4, RoundingMode.HALF_UP));
} }
} }
boolean result = progressCategoryService.updateBatchById(progressCategoryList); boolean result = progressCategoryService.updateBatchById(progressCategoryList);
@ -525,11 +526,11 @@ public class FacPhotovoltaicPanelServiceImpl extends ServiceImpl<FacPhotovoltaic
progressCategory.setOwnerOutputValue(total.multiply( progressCategory.setOwnerOutputValue(total.multiply(
Optional.ofNullable(progressCategory.getOwnerPrice()) Optional.ofNullable(progressCategory.getOwnerPrice())
.orElse(BigDecimal.ZERO) .orElse(BigDecimal.ZERO)
)); ).setScale(4, RoundingMode.HALF_UP));
progressCategory.setConstructionOutputValue(total.multiply( progressCategory.setConstructionOutputValue(total.multiply(
Optional.ofNullable(progressCategory.getConstructionPrice()) Optional.ofNullable(progressCategory.getConstructionPrice())
.orElse(BigDecimal.ZERO) .orElse(BigDecimal.ZERO)
)); ).setScale(4, RoundingMode.HALF_UP));
boolean result = progressCategoryService.updateById(progressCategory); boolean result = progressCategoryService.updateById(progressCategory);
if (!result) { if (!result) {
throw new ServiceException("更新进度失败,数据库异常", HttpStatus.ERROR); throw new ServiceException("更新进度失败,数据库异常", HttpStatus.ERROR);

View File

@ -33,6 +33,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -178,11 +179,11 @@ public class FacPhotovoltaicPanelSupportServiceImpl extends ServiceImpl<FacPhoto
progressCategory.setOwnerOutputValue(total.multiply( progressCategory.setOwnerOutputValue(total.multiply(
Optional.ofNullable(progressCategory.getOwnerPrice()) Optional.ofNullable(progressCategory.getOwnerPrice())
.orElse(BigDecimal.ZERO) .orElse(BigDecimal.ZERO)
)); ).setScale(4, RoundingMode.HALF_UP));
progressCategory.setConstructionOutputValue(total.multiply( progressCategory.setConstructionOutputValue(total.multiply(
Optional.ofNullable(progressCategory.getConstructionPrice()) Optional.ofNullable(progressCategory.getConstructionPrice())
.orElse(BigDecimal.ZERO) .orElse(BigDecimal.ZERO)
)); ).setScale(4, RoundingMode.HALF_UP));
boolean result = progressCategoryService.updateById(progressCategory); boolean result = progressCategoryService.updateById(progressCategory);
if (!result) { if (!result) {
throw new ServiceException("更新进度失败,数据库异常", HttpStatus.ERROR); throw new ServiceException("更新进度失败,数据库异常", HttpStatus.ERROR);

View File

@ -5,9 +5,14 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.dromara.cailiaoshebei.controller.constant;
import org.dromara.common.core.domain.event.ProcessEvent;
import org.dromara.common.core.enums.BusinessStatusEnum;
import org.dromara.common.core.exception.ServiceException; import org.dromara.common.core.exception.ServiceException;
import org.dromara.common.core.utils.MapstructUtils; import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.common.core.utils.StringUtils; import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.log.enums.BusinessStatus;
import org.dromara.common.mybatis.core.page.PageQuery; 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.formalities.domain.BusFormalitiesAnnex; import org.dromara.formalities.domain.BusFormalitiesAnnex;
@ -24,6 +29,7 @@ import org.dromara.formalities.service.IBusFormalitiesAnnexService;
import org.dromara.formalities.service.IBusFormalitiesAreConsolidatedService; import org.dromara.formalities.service.IBusFormalitiesAreConsolidatedService;
import org.dromara.formalities.service.IBusListOfFormalitiesService; import org.dromara.formalities.service.IBusListOfFormalitiesService;
import org.dromara.formalities.utils.TreeUtil; import org.dromara.formalities.utils.TreeUtil;
import org.dromara.tender.domain.TenderSupplierInput;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -36,6 +42,7 @@ import java.util.*;
* @author Lion Li * @author Lion Li
* @date 2025-08-14 * @date 2025-08-14
*/ */
@Slf4j
@RequiredArgsConstructor @RequiredArgsConstructor
@Service @Service
public class BusFormalitiesAreConsolidatedServiceImpl extends ServiceImpl<BusFormalitiesAreConsolidatedMapper, BusFormalitiesAreConsolidated> implements IBusFormalitiesAreConsolidatedService { public class BusFormalitiesAreConsolidatedServiceImpl extends ServiceImpl<BusFormalitiesAreConsolidatedMapper, BusFormalitiesAreConsolidated> implements IBusFormalitiesAreConsolidatedService {
@ -303,4 +310,28 @@ public class BusFormalitiesAreConsolidatedServiceImpl extends ServiceImpl<BusFor
Long count = baseMapper.selectCount(new LambdaQueryWrapper<BusFormalitiesAreConsolidated>().eq(BusFormalitiesAreConsolidated::getProjectId, bo.getProjectId())); Long count = baseMapper.selectCount(new LambdaQueryWrapper<BusFormalitiesAreConsolidated>().eq(BusFormalitiesAreConsolidated::getProjectId, bo.getProjectId()));
return count > 0; return count > 0;
} }
/**
* 移除审核
*/
/**
* 总体流程监听(例如: 草稿,撤销,退回,作废,终止,已完成,单任务完成等)
* 正常使用只需#processEvent.flowCode=='leave1'
* 示例为了方便则使用startsWith匹配了全部示例key
*
* @param processEvent 参数
*/
@org.springframework.context.event.EventListener(condition = "#processEvent.flowCode.endsWith('"+ constant.BusFormalitiesAreConsolidatedMoveOut+"')")
public void processPlansHandler(ProcessEvent processEvent) {
log.info("合规性手续移除审核任务执行了{}", processEvent.toString());
BusFormalitiesAreConsolidated byId = getById(processEvent.getBusinessId());
if (processEvent.getStatus().equals("finish")){
//如果等于 则说明通过 执行移除
boolean b = removeById(byId.getId());
if (!b){
log.error("移除合规性手续数据:{}失败",byId.getId());
}
}
}
} }

View File

@ -1,6 +1,7 @@
package org.dromara.gps.controller; package org.dromara.gps.controller;
import java.util.List; import java.util.List;
import java.util.Map;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@ -16,9 +17,7 @@ import org.dromara.contractor.domain.dto.constructionuser.SubConstructionUserQue
import org.dromara.contractor.domain.exportvo.BusConstructionUserExportVo; import org.dromara.contractor.domain.exportvo.BusConstructionUserExportVo;
import org.dromara.contractor.domain.vo.constructionuser.SubConstructionUserVo; import org.dromara.contractor.domain.vo.constructionuser.SubConstructionUserVo;
import org.dromara.contractor.service.ISubConstructionUserService; import org.dromara.contractor.service.ISubConstructionUserService;
import org.dromara.gps.domain.vo.ConstructionUser; import org.dromara.gps.domain.vo.*;
import org.dromara.gps.domain.vo.GpsProjectVo;
import org.dromara.gps.domain.vo.GpsUserVo;
import org.dromara.project.service.IBusProjectService; import org.dromara.project.service.IBusProjectService;
import org.dromara.system.domain.SysUser; import org.dromara.system.domain.SysUser;
import org.dromara.system.domain.vo.SysUserVo; import org.dromara.system.domain.vo.SysUserVo;
@ -33,7 +32,6 @@ import org.dromara.common.core.validate.AddGroup;
import org.dromara.common.core.validate.EditGroup; import org.dromara.common.core.validate.EditGroup;
import org.dromara.common.log.enums.BusinessType; import org.dromara.common.log.enums.BusinessType;
import org.dromara.common.excel.utils.ExcelUtil; import org.dromara.common.excel.utils.ExcelUtil;
import org.dromara.gps.domain.vo.GpsEquipmentVo;
import org.dromara.gps.domain.bo.GpsEquipmentBo; import org.dromara.gps.domain.bo.GpsEquipmentBo;
import org.dromara.gps.service.IGpsEquipmentService; import org.dromara.gps.service.IGpsEquipmentService;
import org.dromara.common.mybatis.core.page.TableDataInfo; import org.dromara.common.mybatis.core.page.TableDataInfo;
@ -59,6 +57,19 @@ public class GpsEquipmentController extends BaseController {
private final IBusProjectService projectService; private final IBusProjectService projectService;
/**
* 接收设备数据
* @param jsonData
* @return
*/
@PostMapping("/setData")
public R<Void> setData(@RequestBody String jsonData) {
log.info("接收设备数据:{}", jsonData);
gpsEquipmentService.setData(jsonData);
return toAjax(true);
}
/** /**
* 接收设备数据 * 接收设备数据
* @param jsonData * @param jsonData

View File

@ -9,6 +9,8 @@ import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import jakarta.validation.constraints.*; import jakarta.validation.constraints.*;
import java.util.List;
/** /**
* GPS设备详细业务对象 gps_equipment * GPS设备详细业务对象 gps_equipment
* *
@ -78,4 +80,6 @@ public class GpsEquipmentBo extends BaseEntity {
private Integer type; private Integer type;
private List<String> idList;
} }

View File

@ -1,9 +1,13 @@
package org.dromara.gps.mapper; package org.dromara.gps.mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.dromara.gps.domain.GpsEquipmentSon; import org.dromara.gps.domain.GpsEquipmentSon;
import org.dromara.gps.domain.vo.GpsEquipmentSonVo; import org.dromara.gps.domain.vo.GpsEquipmentSonVo;
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
import java.util.List;
/** /**
* GPS设备定位信息Mapper接口 * GPS设备定位信息Mapper接口
* *
@ -12,4 +16,20 @@ import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
*/ */
public interface GpsEquipmentSonMapper extends BaseMapperPlus<GpsEquipmentSon, GpsEquipmentSonVo> { public interface GpsEquipmentSonMapper extends BaseMapperPlus<GpsEquipmentSon, GpsEquipmentSonVo> {
@Select("WITH RankedData AS (\n" +
" SELECT\n" +
" *,\n" +
" ROW_NUMBER() OVER (PARTITION BY client_id ORDER BY create_time DESC) AS rn\n" +
" FROM\n" +
" gps_equipment_son \n" +
"WHERE \n" +
"project_id = #{projectId}\n" +
")\n" +
"SELECT\n" +
" *\n" +
"FROM\n" +
" RankedData\n" +
"WHERE\n" +
" rn = 1;")
List<GpsEquipmentSonVo> getClientList(@Param("projectId") Long projectId);
} }

View File

@ -1,5 +1,6 @@
package org.dromara.gps.service; package org.dromara.gps.service;
import org.dromara.gps.domain.vo.GpsEquipmentSonVo;
import org.dromara.gps.domain.vo.GpsEquipmentVo; import org.dromara.gps.domain.vo.GpsEquipmentVo;
import org.dromara.gps.domain.bo.GpsEquipmentBo; import org.dromara.gps.domain.bo.GpsEquipmentBo;
import org.dromara.gps.domain.GpsEquipment; import org.dromara.gps.domain.GpsEquipment;
@ -94,4 +95,8 @@ public interface IGpsEquipmentService extends IService<GpsEquipment>{
List<GpsUserVo> getUserList(GpsEquipmentBo bo); List<GpsUserVo> getUserList(GpsEquipmentBo bo);
List<GpsProjectVo> getProjectList(); List<GpsProjectVo> getProjectList();
List<GpsEquipmentSonVo> getClientList(Long projectId);
void setData(String jsonData);
} }

View File

@ -67,4 +67,6 @@ public interface IGpsEquipmentSonService extends IService<GpsEquipmentSon>{
* @return 是否删除成功 * @return 是否删除成功
*/ */
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid); Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
List<GpsEquipmentSonVo> getClientList(Long projectId);
} }

View File

@ -1,6 +1,7 @@
package org.dromara.gps.service.impl; package org.dromara.gps.service.impl;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject; import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
@ -20,6 +21,7 @@ import org.dromara.common.websocket.dto.WebSocketMessageDto;
import org.dromara.common.websocket.utils.WebSocketUtils; import org.dromara.common.websocket.utils.WebSocketUtils;
import org.dromara.gps.domain.GpsManmachine; import org.dromara.gps.domain.GpsManmachine;
import org.dromara.gps.domain.bo.GpsEquipmentSonBo; import org.dromara.gps.domain.bo.GpsEquipmentSonBo;
import org.dromara.gps.domain.vo.GpsEquipmentSonVo;
import org.dromara.gps.domain.vo.GpsProjectVo; import org.dromara.gps.domain.vo.GpsProjectVo;
import org.dromara.gps.domain.vo.GpsUserVo; import org.dromara.gps.domain.vo.GpsUserVo;
import org.dromara.gps.mapper.GpsManmachineMapper; import org.dromara.gps.mapper.GpsManmachineMapper;
@ -44,7 +46,6 @@ import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.time.Duration; import java.time.Duration;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
/** /**
* GPS设备详细Service业务层处理 * GPS设备详细Service业务层处理
@ -246,11 +247,11 @@ public class GpsEquipmentServiceImpl extends ServiceImpl<GpsEquipmentMapper, Gps
// WebSocketUtils.publishAll(pushContent); // WebSocketUtils.publishAll(pushContent);
// 2. 发布消息根据是否有用户ID决定发送给指定用户或广播 // 2. 发布消息根据是否有用户ID决定发送给指定用户或广播
if (equipment != null && equipment.getUserId() != null) { if (equipment != null && equipment.getProjectId() != null) {
// 发送给指定用户equipment.getUserId() // 发送给指定用户equipment.getUserId()
WebSocketMessageDto messageDto = new WebSocketMessageDto(); WebSocketMessageDto messageDto = new WebSocketMessageDto();
messageDto.setMessage(pushContent); messageDto.setMessage(pushContent);
messageDto.setSessionKeys(Collections.singletonList(equipment.getUserId())); messageDto.setSessionKeys(Collections.singletonList(equipment.getProjectId()));
WebSocketUtils.publishMessage(messageDto); WebSocketUtils.publishMessage(messageDto);
} else { } else {
// 无用户ID则广播给所有在线客户端 // 无用户ID则广播给所有在线客户端
@ -427,4 +428,24 @@ public class GpsEquipmentServiceImpl extends ServiceImpl<GpsEquipmentMapper, Gps
}); });
return list; return list;
} }
@Override
public List<GpsEquipmentSonVo> getClientList(Long projectId) {
return gpsEquipmentSonService.getClientList(projectId);
}
@Override
public void setData(String jsonData) {
// 发送给指定用户equipment.getUserId()
WebSocketMessageDto messageDto = new WebSocketMessageDto();
messageDto.setMessage(jsonData);
messageDto.setSessionKeys(Collections.singletonList(1897160897167638522L));
WebSocketUtils.publishMessage(messageDto);
// WebSocketUtils.publishAll(jsonData);
}
} }

View File

@ -130,4 +130,9 @@ public class GpsEquipmentSonServiceImpl extends ServiceImpl<GpsEquipmentSonMappe
} }
return baseMapper.deleteByIds(ids) > 0; return baseMapper.deleteByIds(ids) > 0;
} }
@Override
public List<GpsEquipmentSonVo> getClientList(Long projectId) {
return baseMapper.getClientList(projectId);
}
} }

View File

@ -0,0 +1,182 @@
package org.dromara.job.attendance;
import com.aizuda.snailjob.client.job.core.enums.AllocationAlgorithmEnum;
import com.aizuda.snailjob.client.job.core.enums.TriggerTypeEnum;
import com.aizuda.snailjob.client.job.core.openapi.SnailJobOpenApi;
import com.aizuda.snailjob.common.core.enums.BlockStrategyEnum;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.dromara.project.domain.BusAttendanceRule;
import org.dromara.project.domain.BusProject;
import org.dromara.project.service.IBusAttendanceRuleService;
import org.dromara.project.service.IBusProjectService;
import org.springframework.context.annotation.Lazy;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import java.time.LocalTime;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@Slf4j
@Component
public class AttendanceJobUtil {
public static final String CLOCK_IN_REMINDER = "clockInReminder";
public static final String CLOCK_OUT_REMINDER = "clockOutReminder";
@Resource
private IBusProjectService projectService;
@Resource
@Lazy
private IBusAttendanceRuleService attendanceRuleService;
@Async
public void addClusterJob(BusAttendanceRule rule) {
BusProject project = projectService.getById(rule.getProjectId());
String projectName = project.getProjectName();
String jobName1 = projectName + "上班打卡提醒";
LocalTime clockInTime = rule.getClockInTime();
//提前10分钟
LocalTime clockInReminderTime = clockInTime.minusMinutes(10);
String dailyCron1 = toDailyCron(clockInReminderTime);
Long execute1 = SnailJobOpenApi.addClusterJob()
.setRouteKey(AllocationAlgorithmEnum.RANDOM)
.setJobName(jobName1)
.setExecutorInfo(CLOCK_IN_REMINDER)
.setExecutorTimeout(30)
.setDescription("add")
.setBlockStrategy(BlockStrategyEnum.DISCARD)
.setMaxRetryTimes(1)
.setTriggerType(TriggerTypeEnum.CRON)
.setTriggerInterval(dailyCron1)
.addArgsStr("projectId", rule.getProjectId())
.setRetryInterval(3)
.execute();
rule.setClockInJobId(execute1);
String jobName2 = projectName + "下班打卡提醒";
LocalTime clockOutTime = rule.getClockOutTime();
//后延10分钟
LocalTime clockOutReminderTime = clockOutTime.plusMinutes(10);
String dailyCron2 = toDailyCron(clockOutReminderTime);
Long execute = SnailJobOpenApi.addClusterJob()
.setRouteKey(AllocationAlgorithmEnum.RANDOM)
.setJobName(jobName2)
.setExecutorInfo(CLOCK_OUT_REMINDER)
.setExecutorTimeout(30)
.setDescription("add")
.setBlockStrategy(BlockStrategyEnum.DISCARD)
.setMaxRetryTimes(1)
.setTriggerType(TriggerTypeEnum.CRON)
.setTriggerInterval(dailyCron2)
.addArgsStr("projectId", rule.getProjectId())
.setRetryInterval(3)
.execute();
rule.setClockOutJobId(execute);
attendanceRuleService.updateById(rule);
}
@Async
public void updateClusterJob(Long id) {
BusAttendanceRule rule = attendanceRuleService.getById(id);
BusProject project = projectService.getById(rule.getProjectId());
String projectName = project.getProjectName();
LocalTime clockInTime = rule.getClockInTime();
//提前10分钟
LocalTime clockInReminderTime = clockInTime.minusMinutes(10);
String dailyCron1 = toDailyCron(clockInReminderTime);
if (rule.getClockInJobId() != null) {
SnailJobOpenApi.updateClusterJob(rule.getClockInJobId())
.setTriggerType(TriggerTypeEnum.CRON)
.setTriggerInterval(dailyCron1)
.execute();
} else {
String jobName1 = projectName + "上班打卡提醒";
Long execute = SnailJobOpenApi.addClusterJob()
.setRouteKey(AllocationAlgorithmEnum.RANDOM)
.setJobName(jobName1)
.setExecutorInfo(CLOCK_IN_REMINDER)
.setExecutorTimeout(30)
.setDescription("add")
.setBlockStrategy(BlockStrategyEnum.DISCARD)
.setMaxRetryTimes(1)
.setTriggerType(TriggerTypeEnum.CRON)
.setTriggerInterval(dailyCron1)
.addArgsStr("projectId", rule.getProjectId())
.setRetryInterval(3)
.execute();
rule.setClockInJobId(execute);
}
LocalTime clockOutTime = rule.getClockOutTime();
//后延10分钟
LocalTime clockOutReminderTime = clockOutTime.plusMinutes(10);
String dailyCron2 = toDailyCron(clockOutReminderTime);
if (rule.getClockOutJobId() != null) {
SnailJobOpenApi.updateClusterJob(rule.getClockOutJobId())
.setTriggerType(TriggerTypeEnum.CRON)
.setTriggerInterval(dailyCron2)
.execute();
} else {
String jobName2 = projectName + "下班打卡提醒";
Long execute = SnailJobOpenApi.addClusterJob()
.setRouteKey(AllocationAlgorithmEnum.RANDOM)
.setJobName(jobName2)
.setExecutorInfo(CLOCK_OUT_REMINDER)
.setExecutorTimeout(30)
.setDescription("add")
.setBlockStrategy(BlockStrategyEnum.DISCARD)
.setMaxRetryTimes(1)
.setTriggerType(TriggerTypeEnum.CRON)
.setTriggerInterval(dailyCron2)
.addArgsStr("projectId", rule.getProjectId())
.setRetryInterval(3)
.execute();
rule.setClockOutJobId(execute);
}
attendanceRuleService.updateById(rule);
}
@Async
public void deleteClusterJob(List<BusAttendanceRule> rules) {
Set<Long> jobIds = rules.stream()
.flatMap(rule -> Stream.of(rule.getClockInJobId(), rule.getClockOutJobId())) // 提取两个 JobId
.filter(Objects::nonNull) // 过滤掉 null 值
.collect(Collectors.toSet()); // 收集
rules.stream().map(BusAttendanceRule::getClockInJobId).filter(Objects::nonNull).forEach(jobIds::add);
SnailJobOpenApi.deleteJob(jobIds).execute();
}
/**
* 将LocalTime转换为每天执行的Cron表达式
*
* @param time 时间
* @return 每天在指定时间执行的Cron表达式
*/
public String toDailyCron(LocalTime time) {
int hour = time.getHour();
int minute = time.getMinute();
// Cron格式: 秒 分 时 日 月 周 年(可选)
return String.format("0 %d %d * * ?", minute, hour);
}
}

View File

@ -0,0 +1,109 @@
package org.dromara.job.attendance;
import cn.hutool.json.JSONUtil;
import com.aizuda.snailjob.client.job.core.annotation.JobExecutor;
import com.aizuda.snailjob.client.job.core.dto.JobArgs;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.dromara.contractor.domain.SubConstructionUser;
import org.dromara.contractor.service.ISubConstructionUserService;
import org.dromara.project.domain.BusAttendanceRule;
import org.dromara.project.domain.BusProject;
import org.dromara.project.domain.BusUserProjectRelevancy;
import org.dromara.project.service.IBusAttendanceRuleService;
import org.dromara.project.service.IBusProjectService;
import org.dromara.project.service.IBusUserProjectRelevancyService;
import org.dromara.websocket.ChatServerHandler;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
@Slf4j
@Component
public class AttendanceReminderJob {
@Resource
private IBusUserProjectRelevancyService userProjectRelevancyService;
@Resource
private ChatServerHandler chatServerHandler;
@Resource
private IBusProjectService projectService;
@Resource
private IBusAttendanceRuleService attendanceRuleService;
@Resource
private ISubConstructionUserService constructionUserService;
@JobExecutor(name = "clockInReminder")
public void clockInReminder(JobArgs jobArgs) {
Long projectId = JSONUtil.parseObj(jobArgs.getJobParams()).getLong("projectId");
log.info("项目ID:{},开始执行打卡提醒任务", projectId);
BusProject project = projectService.getById(projectId);
BusAttendanceRule rule = attendanceRuleService.getOne(Wrappers.<BusAttendanceRule>lambdaQuery()
.eq(BusAttendanceRule::getProjectId, projectId)
.last("limit 1")
);
if (rule == null || project == null) {
return;
}
//查询项目下的关联人员
List<BusUserProjectRelevancy> relevancyList = userProjectRelevancyService.list(Wrappers.lambdaQuery(BusUserProjectRelevancy.class)
.eq(BusUserProjectRelevancy::getProjectId, projectId));
String message = String.format("【%s项目】上班打卡提醒请在 %s 前完成打卡。",
project.getProjectName(), rule.getClockInTime().toString());
Set<Long> collect = relevancyList.stream().map(BusUserProjectRelevancy::getUserId).collect(Collectors.toSet());
List<SubConstructionUser> list = constructionUserService.list(Wrappers.lambdaQuery(SubConstructionUser.class)
.in(SubConstructionUser::getSysUserId, collect));
Set<Long> list1 = list.stream().map(SubConstructionUser::getSysUserId).collect(Collectors.toSet());
for (Long userId : list1) {
chatServerHandler.sendSystemMessageToUser(userId, message);
}
}
@JobExecutor(name = "clockOutReminder")
public void clockOutReminder(JobArgs jobArgs) {
Long projectId = JSONUtil.parseObj(jobArgs.getJobParams()).getLong("projectId");
log.info("项目ID:{},开始执行打卡提醒任务", projectId);
BusProject project = projectService.getById(projectId);
BusAttendanceRule rule = attendanceRuleService.getOne(Wrappers.<BusAttendanceRule>lambdaQuery()
.eq(BusAttendanceRule::getProjectId, projectId)
.last("limit 1")
);
if (rule == null || project == null) {
return;
}
//查询项目下的关联人员
List<BusUserProjectRelevancy> relevancyList = userProjectRelevancyService.list(Wrappers.lambdaQuery(BusUserProjectRelevancy.class)
.eq(BusUserProjectRelevancy::getProjectId, projectId));
String message = String.format("【%s项目】下班打卡提醒请记得完成打卡。",
project.getProjectName());
Set<Long> collect = relevancyList.stream().map(BusUserProjectRelevancy::getUserId).collect(Collectors.toSet());
List<SubConstructionUser> list = constructionUserService.list(Wrappers.lambdaQuery(SubConstructionUser.class)
.in(SubConstructionUser::getSysUserId, collect));
Set<Long> list1 = list.stream().map(SubConstructionUser::getSysUserId).collect(Collectors.toSet());
for (Long userId : list1) {
chatServerHandler.sendSystemMessageToUser(userId, message);
}
}
}

View File

@ -1,11 +1,17 @@
package org.dromara.manager.weathermanager; package org.dromara.manager.weathermanager;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.http.HttpRequest; import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse; import cn.hutool.http.HttpResponse;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.dromara.common.core.constant.HttpStatus; import org.dromara.common.core.constant.HttpStatus;
import org.dromara.common.core.exception.ServiceException; import org.dromara.common.core.exception.ServiceException;
import org.dromara.manager.weathermanager.vo.WeatherVo;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.math.BigDecimal; import java.math.BigDecimal;
@ -16,7 +22,10 @@ import java.security.spec.InvalidKeySpecException;
import java.security.spec.PKCS8EncodedKeySpec; import java.security.spec.PKCS8EncodedKeySpec;
import java.time.ZoneOffset; import java.time.ZoneOffset;
import java.time.ZonedDateTime; import java.time.ZonedDateTime;
import java.util.ArrayList;
import java.util.Base64; import java.util.Base64;
import java.util.List;
import java.util.Map;
/** /**
* @author lilemy * @author lilemy
@ -58,6 +67,67 @@ public class WeatherManager {
return body; return body;
} }
/**
* 获取天气
*
* @param lng 经度
* @param lat 纬度
* @param weatherPath 天气请求路径
* @return 天气信息
*/
public List<WeatherVo> getWeatherListVo(String lng, String lat, String weatherPath) {
String weather = this.getWeather(lng, lat, weatherPath);
// 解析为 JSONObject
JSONObject weatherJson = JSONUtil.parseObj(weather);
// 获取 daily 数组
JSONArray dailyArray = weatherJson.getJSONArray(WeatherConstant.DAILY);
// 循环遍历,封装项目天气信息
List<WeatherVo> weatherList = new ArrayList<>();
for (int i = 0; i < dailyArray.size(); i++) {
JSONObject day = dailyArray.getJSONObject(i);
WeatherVo weatherVo = new WeatherVo();
// 获取星期
String dateStr = day.getStr(WeatherConstant.FX_DATE);
DateTime date = DateUtil.parse(dateStr, "yyyy-MM-dd");
String week = DateUtil.format(date, "EEE");
// 获取天气图标
String textDay = day.getStr(WeatherConstant.TEXT_DAY);
String textNight = day.getStr(WeatherConstant.TEXT_NIGHT);
Map<String, List<String>> weatherStatusMap = WeatherConstant.getWeatherStatusMap();
String dayStatus = this.getWeatherCategory(textDay, weatherStatusMap);
String nightStatus = this.getWeatherCategory(textNight, weatherStatusMap);
// 封装数据
weatherVo.setDate(dateStr);
weatherVo.setWeek(week);
weatherVo.setTempMax(day.getStr(WeatherConstant.TEMP_MAX));
weatherVo.setTempMin(day.getStr(WeatherConstant.TEMP_MIN));
weatherVo.setSunRise(day.getStr(WeatherConstant.SUN_RISE));
weatherVo.setSunSet(day.getStr(WeatherConstant.SUN_SET));
weatherVo.setDayStatus(textDay);
weatherVo.setNightStatus(textNight);
weatherVo.setDayIcon(dayStatus);
weatherVo.setNightIcon(nightStatus);
weatherList.add(weatherVo);
}
return weatherList;
}
/**
* 根据天气图标获取天气类别
*
* @param icon 天气图标
* @param map 天气图标与天气类别的映射关系
* @return 天气类别
*/
public String getWeatherCategory(String icon, Map<String, List<String>> map) {
for (Map.Entry<String, List<String>> entry : map.entrySet()) {
if (entry.getValue().contains(icon)) {
return entry.getKey();
}
}
return "cloudy";
}
/** /**
* 获取天气预报 Url * 获取天气预报 Url
* *

View File

@ -1,4 +1,4 @@
package org.dromara.project.domain.vo.project; package org.dromara.manager.weathermanager.vo;
import lombok.Data; import lombok.Data;
@ -7,13 +7,13 @@ import java.io.Serializable;
/** /**
* @author lilemy * @author lilemy
* @date 2025/5/13 9:29 * @date 2025-09-09 15:14
*/ */
@Data @Data
public class BusProjectWeatherVo implements Serializable { public class WeatherVo implements Serializable {
@Serial @Serial
private static final long serialVersionUID = 4173514725591666698L; private static final long serialVersionUID = 6518020416043269221L;
/** /**
* 日期 * 日期
@ -64,5 +64,4 @@ public class BusProjectWeatherVo implements Serializable {
* 晚上天气图标 * 晚上天气图标
*/ */
private String nightIcon; private String nightIcon;
} }

View File

@ -123,6 +123,16 @@ public class MatMaterialReceive extends BaseEntity {
*/ */
private String licenseCountFileId; private String licenseCountFileId;
/**
* 附件地址
*/
private String attachmentUrl;
/**
* 附件名称
*/
private String attachmentName;
/** /**
* 设备材料入库/移交 * 设备材料入库/移交
*/ */

View File

@ -94,6 +94,16 @@ public class MatMaterialReceiveCreateReq implements Serializable {
*/ */
private String licenseCountFileId; private String licenseCountFileId;
private String attachmentId;
/**
* 附件地址
*/
private String attachmentUrl;
/**
* 附件名称
*/
private String attachmentName;
/** /**
* 设备材料入库/移交 * 设备材料入库/移交
*/ */

View File

@ -87,6 +87,10 @@ public class MatMaterialReceiveUpdateReq implements Serializable {
*/ */
private String licenseCountFileId; private String licenseCountFileId;
/**
* 附件id
*/
private String attachmentId;
/** /**
* 设备材料入库/移交 * 设备材料入库/移交
*/ */

View File

@ -134,6 +134,15 @@ public class MatMaterialReceiveVo implements Serializable {
*/ */
private List<SysOssVo> licenseCountFile; private List<SysOssVo> licenseCountFile;
/**
* 附件地址
*/
private String attachmentUrl;
/**
* 附件名称
*/
private String attachmentName;
/** /**
* 设备材料入库/移交 * 设备材料入库/移交
*/ */

View File

@ -241,7 +241,8 @@ public class MatMaterialReceiveServiceImpl extends ServiceImpl<MatMaterialReceiv
req.getLicenseCountFileId(), req.getLicenseCountFileId(),
req.getReportCountFileId(), req.getReportCountFileId(),
req.getTechDocCountFileId(), req.getTechDocCountFileId(),
req.getCertCountFileId()); req.getCertCountFileId(),
req.getAttachmentId());
boolean save = this.save(materialReceive); boolean save = this.save(materialReceive);
if (!save) { if (!save) {
throw new ServiceException("物料接收单新增失败", HttpStatus.ERROR); throw new ServiceException("物料接收单新增失败", HttpStatus.ERROR);
@ -305,7 +306,8 @@ public class MatMaterialReceiveServiceImpl extends ServiceImpl<MatMaterialReceiv
req.getLicenseCountFileId(), req.getLicenseCountFileId(),
req.getReportCountFileId(), req.getReportCountFileId(),
req.getTechDocCountFileId(), req.getTechDocCountFileId(),
req.getCertCountFileId()); req.getCertCountFileId(),
req.getAttachmentId());
boolean update = this.updateById(materialReceive); boolean update = this.updateById(materialReceive);
if (!update) { if (!update) {
throw new ServiceException("物料接收单修改失败", HttpStatus.ERROR); throw new ServiceException("物料接收单修改失败", HttpStatus.ERROR);
@ -482,9 +484,10 @@ public class MatMaterialReceiveServiceImpl extends ServiceImpl<MatMaterialReceiv
* @param reportCountFileId 报表文件id * @param reportCountFileId 报表文件id
* @param techDocCountFileId 技术文档文件id * @param techDocCountFileId 技术文档文件id
* @param certCountFileId 证书文件id * @param certCountFileId 证书文件id
* @param attachmentId
*/ */
private void getFileSize(MatMaterialReceive materialReceive, String licenseCountFileId, private void getFileSize(MatMaterialReceive materialReceive, String licenseCountFileId,
String reportCountFileId, String techDocCountFileId, String certCountFileId) { String reportCountFileId, String techDocCountFileId, String certCountFileId, String attachmentId) {
if (StringUtils.isNotBlank(licenseCountFileId)) { if (StringUtils.isNotBlank(licenseCountFileId)) {
int size = Arrays.stream(licenseCountFileId.split(",")).map(Long::parseLong).toList().size(); int size = Arrays.stream(licenseCountFileId.split(",")).map(Long::parseLong).toList().size();
materialReceive.setLicenseCount(size); materialReceive.setLicenseCount(size);
@ -501,6 +504,11 @@ public class MatMaterialReceiveServiceImpl extends ServiceImpl<MatMaterialReceiv
int size = Arrays.stream(certCountFileId.split(",")).map(Long::parseLong).toList().size(); int size = Arrays.stream(certCountFileId.split(",")).map(Long::parseLong).toList().size();
materialReceive.setCertCount(size); materialReceive.setCertCount(size);
} }
if (StringUtils.isNotBlank(attachmentId)) {
SysOssVo ossVo = ossService.getById(Long.valueOf(attachmentId));
materialReceive.setAttachmentUrl(ossVo.getUrl());
materialReceive.setAttachmentName(ossVo.getOriginalName());
}
} }
/** /**

View File

@ -4,6 +4,8 @@ import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import io.github.linpeilie.annotations.AutoMapper; import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data; import lombok.Data;
import org.dromara.common.translation.annotation.Translation;
import org.dromara.common.translation.constant.TransConstant;
import org.dromara.other.domain.OthYs7Device; import org.dromara.other.domain.OthYs7Device;
import java.io.Serial; import java.io.Serial;
@ -40,6 +42,7 @@ public class OthYs7DeviceVo implements Serializable {
/** /**
* 项目名称 * 项目名称
*/ */
@Translation(type = TransConstant.PROJECT_ID_TO_NAME, mapper = "projectId")
private String projectName; private String projectName;
/** /**

View File

@ -262,11 +262,6 @@ public class OthYs7DeviceServiceImpl extends ServiceImpl<OthYs7DeviceMapper, Oth
return ys7DeviceVo; return ys7DeviceVo;
} }
BeanUtils.copyProperties(ys7Device, ys7DeviceVo); BeanUtils.copyProperties(ys7Device, ys7DeviceVo);
Long projectId = ys7Device.getProjectId();
if (projectId != null && !projectId.equals(0L)) {
BusProject project = projectService.getById(projectId);
ys7DeviceVo.setProjectName(project.getProjectName());
}
return ys7DeviceVo; return ys7DeviceVo;
} }
@ -315,22 +310,10 @@ public class OthYs7DeviceServiceImpl extends ServiceImpl<OthYs7DeviceMapper, Oth
if (CollUtil.isEmpty(ys7DeviceList)) { if (CollUtil.isEmpty(ys7DeviceList)) {
return ys7DeviceVoPage; return ys7DeviceVoPage;
} }
// 获取项目列表
Set<Long> projectIdList = ys7DeviceList.stream().map(OthYs7Device::getProjectId).collect(Collectors.toSet());
List<BusProject> projectList = projectService.lambdaQuery()
.select(BusProject::getId, BusProject::getProjectName)
.in(BusProject::getId, projectIdList)
.list();
Map<Long, BusProject> projectMap = projectList.stream().collect(Collectors.toMap(BusProject::getId, project -> project));
// 对象列表 => 封装对象列表 // 对象列表 => 封装对象列表
List<OthYs7DeviceVo> ys7DeviceVoList = ys7DeviceList.stream().map(ys7Device -> { List<OthYs7DeviceVo> ys7DeviceVoList = ys7DeviceList.stream().map(ys7Device -> {
OthYs7DeviceVo ys7DeviceVo = new OthYs7DeviceVo(); OthYs7DeviceVo ys7DeviceVo = new OthYs7DeviceVo();
BeanUtils.copyProperties(ys7Device, ys7DeviceVo); BeanUtils.copyProperties(ys7Device, ys7DeviceVo);
Long projectId = ys7Device.getProjectId();
if (projectId != null && !projectId.equals(0L)) {
BusProject project = projectMap.get(projectId);
ys7DeviceVo.setProjectName(project.getProjectName());
}
return ys7DeviceVo; return ys7DeviceVo;
}).toList(); }).toList();
ys7DeviceVoPage.setRecords(ys7DeviceVoList); ys7DeviceVoPage.setRecords(ys7DeviceVoList);

View File

@ -25,6 +25,7 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.YearMonth; import java.time.YearMonth;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
@ -258,7 +259,7 @@ public class OutTableController extends BaseController {
BigDecimal purchaseValue = BigDecimal.ZERO; BigDecimal purchaseValue = BigDecimal.ZERO;
for (BusProcurement busProcurement : busProcurements) { for (BusProcurement busProcurement : busProcurements) {
if(busProcurement != null && busProcurement.getAcceptedQuantity() != null && busProcurement.getUnitPrice() != null){ if(busProcurement != null && busProcurement.getAcceptedQuantity() != null && busProcurement.getUnitPrice() != null){
purchaseValue = purchaseValue.add(busProcurement.getAcceptedQuantity().multiply(busProcurement.getUnitPrice())); purchaseValue = purchaseValue.add(busProcurement.getAcceptedQuantity().multiply(busProcurement.getUnitPrice()).setScale(4, RoundingMode.HALF_UP));
} }
} }
@ -330,7 +331,7 @@ public class OutTableController extends BaseController {
BigDecimal purchaseValue = BigDecimal.ZERO; BigDecimal purchaseValue = BigDecimal.ZERO;
for (BusProcurement busProcurement : busProcurements) { for (BusProcurement busProcurement : busProcurements) {
if(busProcurement != null && busProcurement.getAcceptedQuantity() != null && busProcurement.getUnitPrice() != null){ if(busProcurement != null && busProcurement.getAcceptedQuantity() != null && busProcurement.getUnitPrice() != null){
purchaseValue = purchaseValue.add(busProcurement.getAcceptedQuantity().multiply(busProcurement.getUnitPrice())); purchaseValue = purchaseValue.add(busProcurement.getAcceptedQuantity().multiply(busProcurement.getUnitPrice()).setScale(4, RoundingMode.HALF_UP));
} }
} }
@ -439,7 +440,7 @@ public class OutTableController extends BaseController {
BigDecimal accumulatedCompletionValue = BigDecimal.ZERO; BigDecimal accumulatedCompletionValue = BigDecimal.ZERO;
for (BusProcurement busProcurement : busProcurements) { for (BusProcurement busProcurement : busProcurements) {
if(busProcurement != null && busProcurement.getAcceptedQuantity() != null && busProcurement.getUnitPrice() != null){ if(busProcurement != null && busProcurement.getAcceptedQuantity() != null && busProcurement.getUnitPrice() != null){
accumulatedCompletionValue = accumulatedCompletionValue.add(busProcurement.getAcceptedQuantity().multiply(busProcurement.getUnitPrice())); accumulatedCompletionValue = accumulatedCompletionValue.add(busProcurement.getAcceptedQuantity().multiply(busProcurement.getUnitPrice()).setScale(4, RoundingMode.HALF_UP));
} }
} }
@ -453,7 +454,7 @@ public class OutTableController extends BaseController {
BigDecimal monthCompletionValue = BigDecimal.ZERO; BigDecimal monthCompletionValue = BigDecimal.ZERO;
for (BusProcurement busProcurement : busProcurements1) { for (BusProcurement busProcurement : busProcurements1) {
monthCompletionValue = monthCompletionValue.add(busProcurement.getAcceptedQuantity().multiply(busProcurement.getUnitPrice())); monthCompletionValue = monthCompletionValue.add(busProcurement.getAcceptedQuantity().multiply(busProcurement.getUnitPrice()).setScale(4, RoundingMode.HALF_UP));
} }
vo.setMonthCompletionValue(monthCompletionValue); vo.setMonthCompletionValue(monthCompletionValue);
@ -547,7 +548,7 @@ public class OutTableController extends BaseController {
BigDecimal purchaseValue = BigDecimal.ZERO; BigDecimal purchaseValue = BigDecimal.ZERO;
for (BusProcurement busProcurement : busProcurements) { for (BusProcurement busProcurement : busProcurements) {
if(busProcurement != null && busProcurement.getAcceptedQuantity() != null && busProcurement.getUnitPrice() != null){ if(busProcurement != null && busProcurement.getAcceptedQuantity() != null && busProcurement.getUnitPrice() != null){
purchaseValue = purchaseValue.add(busProcurement.getAcceptedQuantity().multiply(busProcurement.getUnitPrice())); purchaseValue = purchaseValue.add(busProcurement.getAcceptedQuantity().multiply(busProcurement.getUnitPrice()).setScale(4, RoundingMode.HALF_UP));
} }
} }
@ -563,7 +564,7 @@ public class OutTableController extends BaseController {
BigDecimal subPurchaseValue = BigDecimal.ZERO; BigDecimal subPurchaseValue = BigDecimal.ZERO;
for (BusProcurement busProcurement : busProcurements1) { for (BusProcurement busProcurement : busProcurements1) {
if(busProcurement != null && busProcurement.getAcceptedQuantity() != null && busProcurement.getUnitPrice() != null){ if(busProcurement != null && busProcurement.getAcceptedQuantity() != null && busProcurement.getUnitPrice() != null){
subPurchaseValue = subPurchaseValue.add(busProcurement.getAcceptedQuantity().multiply(busProcurement.getUnitPrice())); subPurchaseValue = subPurchaseValue.add(busProcurement.getAcceptedQuantity().multiply(busProcurement.getUnitPrice()).setScale(4, RoundingMode.HALF_UP));
} }
} }

View File

@ -33,6 +33,7 @@ import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
@ -145,11 +146,11 @@ public class OutConstructionValueServiceImpl extends ServiceImpl<OutConstruction
PgsProgressCategory progressCategory = pgsProgressCategoryService.getById(bo.getProgressCategoryId()); PgsProgressCategory progressCategory = pgsProgressCategoryService.getById(bo.getProgressCategoryId());
if (progressCategory != null) { if (progressCategory != null) {
if ("1".equals(progressCategory.getUnitType())) { if ("1".equals(progressCategory.getUnitType())) {
add.setOutValue(progressCategory.getConstructionPrice().multiply(BigDecimal.valueOf(bo.getArtificialNum()))); add.setOutValue(progressCategory.getConstructionPrice().multiply(BigDecimal.valueOf(bo.getArtificialNum())).setScale(4, RoundingMode.HALF_UP));
add.setOwnerValue(progressCategory.getOwnerPrice().multiply(BigDecimal.valueOf(bo.getArtificialNum()))); add.setOwnerValue(progressCategory.getOwnerPrice().multiply(BigDecimal.valueOf(bo.getArtificialNum())).setScale(4, RoundingMode.HALF_UP));
} else if ("2".equals(progressCategory.getUnitType())) { } else if ("2".equals(progressCategory.getUnitType())) {
add.setOwnerValue(progressCategory.getOwnerPrice().multiply(BigDecimal.valueOf(bo.getUavNum()).divide(new BigDecimal("100")))); add.setOwnerValue(progressCategory.getOwnerPrice().multiply(BigDecimal.valueOf(bo.getUavNum()).divide(new BigDecimal("100"))).setScale(4, RoundingMode.HALF_UP));
add.setOutValue(progressCategory.getConstructionPrice().multiply(BigDecimal.valueOf(bo.getUavNum()).divide(new BigDecimal("100")))); add.setOutValue(progressCategory.getConstructionPrice().multiply(BigDecimal.valueOf(bo.getUavNum()).divide(new BigDecimal("100"))).setScale(4, RoundingMode.HALF_UP));
} }
} }

View File

@ -38,6 +38,7 @@ import org.dromara.out.mapper.OutMonthPlanMapper;
import org.dromara.out.service.IOutMonthPlanService; import org.dromara.out.service.IOutMonthPlanService;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.temporal.TemporalAdjusters; import java.time.temporal.TemporalAdjusters;
import java.util.*; import java.util.*;
@ -377,7 +378,7 @@ public class OutMonthPlanServiceImpl extends ServiceImpl<OutMonthPlanMapper, Out
BigDecimal purchaseValue = BigDecimal.ZERO; BigDecimal purchaseValue = BigDecimal.ZERO;
for (BusProcurement busProcurement : busProcurements) { for (BusProcurement busProcurement : busProcurements) {
if (busProcurement != null && busProcurement.getAcceptedQuantity() != null && busProcurement.getUnitPrice() != null) { if (busProcurement != null && busProcurement.getAcceptedQuantity() != null && busProcurement.getUnitPrice() != null) {
purchaseValue = purchaseValue.add(busProcurement.getAcceptedQuantity().multiply(busProcurement.getUnitPrice())); purchaseValue = purchaseValue.add(busProcurement.getAcceptedQuantity().multiply(busProcurement.getUnitPrice()).setScale(4, RoundingMode.HALF_UP));
} }
} }

View File

@ -19,10 +19,7 @@ import org.dromara.common.log.annotation.Log;
import org.dromara.common.log.enums.BusinessType; import org.dromara.common.log.enums.BusinessType;
import org.dromara.common.web.core.BaseController; import org.dromara.common.web.core.BaseController;
import org.dromara.progress.domain.PgsProgressCategory; import org.dromara.progress.domain.PgsProgressCategory;
import org.dromara.progress.domain.dto.progresscategory.PgsProgressCategoryCreatePriceReq; import org.dromara.progress.domain.dto.progresscategory.*;
import org.dromara.progress.domain.dto.progresscategory.PgsProgressCategoryCreateReq;
import org.dromara.progress.domain.dto.progresscategory.PgsProgressCategoryQueryReq;
import org.dromara.progress.domain.dto.progresscategory.PgsProgressCategoryUpdateReq;
import org.dromara.progress.domain.vo.progresscategory.*; import org.dromara.progress.domain.vo.progresscategory.*;
import org.dromara.progress.service.IPgsProgressCategoryService; import org.dromara.progress.service.IPgsProgressCategoryService;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -32,6 +29,7 @@ import org.springframework.web.multipart.MultipartFile;
import java.io.IOException; import java.io.IOException;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -65,10 +63,9 @@ public class PgsProgressCategoryController extends BaseController {
* 根据进度父级查询进度类别列表 * 根据进度父级查询进度类别列表
*/ */
@SaCheckPermission("progress:progressCategory:listByParent") @SaCheckPermission("progress:progressCategory:listByParent")
@GetMapping("/listByParent/{parentId}") @GetMapping("/listByParent")
public R<List<PgsProgressCategoryVo>> listByParent(@NotNull(message = "项目id不能为空") public R<List<PgsProgressCategoryVo>> listByParent(PgsProgressCategoryQueryByParentReq req) {
@PathVariable Long parentId) { List<PgsProgressCategoryVo> list = pgsProgressCategoryService.queryListByParent(req);
List<PgsProgressCategoryVo> list = pgsProgressCategoryService.queryListByParent(parentId);
return R.ok(list); return R.ok(list);
} }
@ -226,10 +223,10 @@ public class PgsProgressCategoryController extends BaseController {
BigDecimal total = pgsProgressCategory.getTotal(); BigDecimal total = pgsProgressCategory.getTotal();
if (total != null && total.compareTo(BigDecimal.ZERO) != 0) { if (total != null && total.compareTo(BigDecimal.ZERO) != 0) {
if (ownerPrice != null && ownerPrice.compareTo(BigDecimal.ZERO) != 0) { if (ownerPrice != null && ownerPrice.compareTo(BigDecimal.ZERO) != 0) {
pgsProgressCategory.setOwnerOutputValue(ownerPrice.multiply(total)); pgsProgressCategory.setOwnerOutputValue(ownerPrice.multiply(total).setScale(4, RoundingMode.HALF_UP));
} }
if (constructionPrice != null && constructionPrice.compareTo(BigDecimal.ZERO) != 0) { if (constructionPrice != null && constructionPrice.compareTo(BigDecimal.ZERO) != 0) {
pgsProgressCategory.setConstructionOutputValue(constructionPrice.multiply(total)); pgsProgressCategory.setConstructionOutputValue(constructionPrice.multiply(total).setScale(4, RoundingMode.HALF_UP));
} }
} }

View File

@ -14,6 +14,7 @@ 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.common.web.core.BaseController; import org.dromara.common.web.core.BaseController;
import org.dromara.progress.domain.dto.progresscategorytemplate.PgsProgressCategoryTemplateCreateReq; import org.dromara.progress.domain.dto.progresscategorytemplate.PgsProgressCategoryTemplateCreateReq;
import org.dromara.progress.domain.dto.progresscategorytemplate.PgsProgressCategoryTemplateQueryByParentReq;
import org.dromara.progress.domain.dto.progresscategorytemplate.PgsProgressCategoryTemplateQueryReq; import org.dromara.progress.domain.dto.progresscategorytemplate.PgsProgressCategoryTemplateQueryReq;
import org.dromara.progress.domain.dto.progresscategorytemplate.PgsProgressCategoryTemplateUpdateReq; import org.dromara.progress.domain.dto.progresscategorytemplate.PgsProgressCategoryTemplateUpdateReq;
import org.dromara.progress.domain.vo.progresscategorytemplate.PgsProgressCategoryTemplateVo; import org.dromara.progress.domain.vo.progresscategorytemplate.PgsProgressCategoryTemplateVo;
@ -60,10 +61,9 @@ public class PgsProgressCategoryTemplateController extends BaseController {
* 根据进度父级查询进度类别模版列表 * 根据进度父级查询进度类别模版列表
*/ */
@SaCheckPermission("progress:progressCategoryTemplate:listByParent") @SaCheckPermission("progress:progressCategoryTemplate:listByParent")
@GetMapping("/listByParent/{parentId}") @GetMapping("/listByParent")
public R<List<PgsProgressCategoryTemplateVo>> listByParent(@NotNull(message = "父级类别主键不能为空") public R<List<PgsProgressCategoryTemplateVo>> listByParent(PgsProgressCategoryTemplateQueryByParentReq req) {
@PathVariable Long parentId) { List<PgsProgressCategoryTemplateVo> list = pgsProgressCategoryTemplateService.queryListByParent(req);
List<PgsProgressCategoryTemplateVo> list = pgsProgressCategoryTemplateService.queryListByParent(parentId);
return R.ok(list); return R.ok(list);
} }

View File

@ -6,7 +6,6 @@ import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import org.dromara.common.core.domain.R; import org.dromara.common.core.domain.R;
import org.dromara.common.core.validate.AddGroup;
import org.dromara.common.excel.utils.ExcelUtil; import org.dromara.common.excel.utils.ExcelUtil;
import org.dromara.common.idempotent.annotation.RepeatSubmit; import org.dromara.common.idempotent.annotation.RepeatSubmit;
import org.dromara.common.log.annotation.Log; import org.dromara.common.log.annotation.Log;
@ -76,20 +75,20 @@ public class PgsProgressPlanController extends BaseController {
@Log(title = "进度计划", businessType = BusinessType.INSERT) @Log(title = "进度计划", businessType = BusinessType.INSERT)
@RepeatSubmit() @RepeatSubmit()
@PostMapping() @PostMapping()
public R<Long> add(@Validated(AddGroup.class) @RequestBody PgsProgressPlanCreateReq req) { public R<Long> add(@Validated @RequestBody PgsProgressPlanCreateReq req) {
return R.ok(pgsProgressPlanService.insertByBo(req)); return R.ok(pgsProgressPlanService.insertByBo(req));
} }
/** /**
* 删除进度计划 * 删除进度计划
* *
* @param id 主键 * @param ids 主键
*/ */
@SaCheckPermission("progress:progressPlan:remove") @SaCheckPermission("progress:progressPlan:remove")
@Log(title = "进度计划", businessType = BusinessType.DELETE) @Log(title = "进度计划", businessType = BusinessType.DELETE)
@DeleteMapping("/{id}") @DeleteMapping("/{ids}")
public R<Void> remove(@NotEmpty(message = "主键不能为空") public R<Void> remove(@NotEmpty(message = "主键不能为空")
@PathVariable Long id) { @PathVariable Long[] ids) {
return toAjax(pgsProgressPlanService.deleteById(id)); return toAjax(pgsProgressPlanService.deleteByIds(List.of(ids)));
} }
} }

View File

@ -8,10 +8,7 @@ import org.dromara.common.idempotent.annotation.RepeatSubmit;
import org.dromara.common.mybatis.core.page.PageQuery; 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.common.web.core.BaseController; import org.dromara.common.web.core.BaseController;
import org.dromara.progress.domain.dto.progressplandetail.PgsProgressPlanDetailFinishedCreateReq; import org.dromara.progress.domain.dto.progressplandetail.*;
import org.dromara.progress.domain.dto.progressplandetail.PgsProgressPlanDetailPercentageCreateReq;
import org.dromara.progress.domain.dto.progressplandetail.PgsProgressPlanDetailQueryReq;
import org.dromara.progress.domain.dto.progressplandetail.PgsProgressPlanDetailRemoveReq;
import org.dromara.progress.domain.vo.progressplandetail.PgsProgressPlanDetailFinishedVo; import org.dromara.progress.domain.vo.progressplandetail.PgsProgressPlanDetailFinishedVo;
import org.dromara.progress.domain.vo.progressplandetail.PgsProgressPlanDetailUnFinishVo; import org.dromara.progress.domain.vo.progressplandetail.PgsProgressPlanDetailUnFinishVo;
import org.dromara.progress.domain.vo.progressplandetail.PgsProgressPlanDetailVo; import org.dromara.progress.domain.vo.progressplandetail.PgsProgressPlanDetailVo;
@ -58,10 +55,20 @@ public class PgsProgressPlanDetailController extends BaseController {
@SaCheckPermission("progress:progressPlanDetail:insertPercentage") @SaCheckPermission("progress:progressPlanDetail:insertPercentage")
@RepeatSubmit() @RepeatSubmit()
@PostMapping("/insert/percentage") @PostMapping("/insert/percentage")
public R<Void> insertPercentageDetail(@Validated @RequestBody PgsProgressPlanDetailPercentageCreateReq req) { public R<Void> insertPercentageDetail(@Validated @RequestBody PgsProgressPlanDetailCreateReq req) {
return toAjax(pgsProgressPlanDetailService.insertPercentageDetail(req)); return toAjax(pgsProgressPlanDetailService.insertPercentageNumberDetail(req));
} }
/**
* 新增进度计划详情(数量设施)
*/
/* @SaCheckPermission("progress:progressPlanDetail:insertNumber")
@RepeatSubmit()
@PostMapping("/insert/number")
public R<Void> insertNumberDetail(@Validated @RequestBody PgsProgressPlanDetailNumberCreateReq req) {
return toAjax(pgsProgressPlanDetailService.insertNumberDetail(req));
}*/
/** /**
* 获取进度计划详情已完成设施详细信息 * 获取进度计划详情已完成设施详细信息
* *

View File

@ -4,7 +4,10 @@ import jakarta.annotation.Resource;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.dromara.common.core.domain.R; import org.dromara.common.core.domain.R;
import org.dromara.progress.domain.dto.progresscategory.PgsProgressCategoryQueryByParentReq;
import org.dromara.progress.domain.vo.progresscategory.PgsProgressCategoryLastTimeVo;
import org.dromara.progress.domain.vo.progresscategory.PgsProgressCategoryTopVo; import org.dromara.progress.domain.vo.progresscategory.PgsProgressCategoryTopVo;
import org.dromara.progress.domain.vo.progresscategory.PgsProgressCategoryVo;
import org.dromara.progress.service.IPgsProgressCategoryService; import org.dromara.progress.service.IPgsProgressCategoryService;
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;
@ -12,6 +15,7 @@ import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.math.BigDecimal;
import java.util.List; import java.util.List;
/** /**
@ -39,4 +43,35 @@ public class PgsProgressCategoryAppController {
return R.ok(list); return R.ok(list);
} }
/**
* 根据进度父级查询进度类别列表
*/
@GetMapping("/listByParent")
public R<List<PgsProgressCategoryVo>> listByParent(PgsProgressCategoryQueryByParentReq req) {
List<PgsProgressCategoryVo> list = progressCategoryService.queryListByParent(req);
return R.ok(list);
}
/**
* 获取进度类别最后一次进度信息
*
* @param id 主键
*/
@GetMapping("/lastTime/{id}")
public R<PgsProgressCategoryLastTimeVo> getLastTimeInfo(@NotNull(message = "主键不能为空")
@PathVariable Long id) {
return R.ok(progressCategoryService.queryLastTimeById(id));
}
/**
* 获取进度类别未完成数量
*
* @param id 主键
*/
@GetMapping("/unfinishNumber/{id}")
public R<BigDecimal> getUnFinishNumber(@NotNull(message = "主键不能为空")
@PathVariable Long id) {
return R.ok(progressCategoryService.getUnFinishNumber(id));
}
} }

View File

@ -1,9 +1,23 @@
package org.dromara.progress.controller.app; package org.dromara.progress.controller.app;
import jakarta.annotation.Resource;
import jakarta.validation.constraints.NotNull;
import org.dromara.common.core.domain.R;
import org.dromara.common.idempotent.annotation.RepeatSubmit;
import org.dromara.common.log.annotation.Log;
import org.dromara.common.log.enums.BusinessType;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.web.core.BaseController; import org.dromara.common.web.core.BaseController;
import org.dromara.progress.domain.dto.progressplan.PgsProgressPlanCreateReq;
import org.dromara.progress.domain.dto.progressplan.PgsProgressPlanQueryReq;
import org.dromara.progress.domain.dto.progressplan.PgsProgressPlanRemoveReq;
import org.dromara.progress.domain.vo.progressplan.PgsProgressPlanVo;
import org.dromara.progress.service.IPgsProgressPlanService;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/** /**
* 进度计划 app 接口 * 进度计划 app 接口
@ -15,4 +29,47 @@ import org.springframework.web.bind.annotation.RestController;
@RestController @RestController
@RequestMapping("/app/progress/progressPlan") @RequestMapping("/app/progress/progressPlan")
public class PgsProgressPlanAppController extends BaseController { public class PgsProgressPlanAppController extends BaseController {
@Resource
private IPgsProgressPlanService progressPlanService;
/**
* 查询进度计划列表
*/
@GetMapping("/list")
public TableDataInfo<PgsProgressPlanVo> list(PgsProgressPlanQueryReq req, PageQuery pageQuery) {
return progressPlanService.queryPageList(req, pageQuery);
}
/**
* 获取进度计划详细信息
*
* @param id 主键
*/
@GetMapping("/{id}")
public R<PgsProgressPlanVo> getInfo(@NotNull(message = "主键不能为空")
@PathVariable Long id) {
return R.ok(progressPlanService.queryById(id));
}
/**
* 新增进度计划
*/
@Log(title = "进度计划", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping()
public R<Long> add(@Validated @RequestBody PgsProgressPlanCreateReq req) {
return R.ok(progressPlanService.insertByBo(req));
}
/**
* 删除进度计划
*/
@Log(title = "进度计划", businessType = BusinessType.DELETE)
@PostMapping("/remove")
public R<Void> remove(@Validated @RequestBody PgsProgressPlanRemoveReq req) {
List<Long> ids = req.getIds();
return toAjax(progressPlanService.deleteByIds(ids));
}
} }

View File

@ -1,9 +1,24 @@
package org.dromara.progress.controller.app; package org.dromara.progress.controller.app;
import jakarta.annotation.Resource;
import jakarta.validation.constraints.NotNull;
import org.dromara.common.core.domain.R;
import org.dromara.common.idempotent.annotation.RepeatSubmit;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.web.core.BaseController; import org.dromara.common.web.core.BaseController;
import org.dromara.progress.domain.dto.progressplandetail.PgsProgressPlanDetailCreateReq;
import org.dromara.progress.domain.dto.progressplandetail.PgsProgressPlanDetailFinishedCreateReq;
import org.dromara.progress.domain.dto.progressplandetail.PgsProgressPlanDetailQueryReq;
import org.dromara.progress.domain.dto.progressplandetail.PgsProgressPlanDetailRemoveReq;
import org.dromara.progress.domain.vo.progressplandetail.PgsProgressPlanDetailFinishedVo;
import org.dromara.progress.domain.vo.progressplandetail.PgsProgressPlanDetailNumVo;
import org.dromara.progress.domain.vo.progressplandetail.PgsProgressPlanDetailUnFinishVo;
import org.dromara.progress.service.IPgsProgressPlanDetailService;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/** /**
* 进度计划详情 app 接口 * 进度计划详情 app 接口
@ -15,4 +30,67 @@ import org.springframework.web.bind.annotation.RestController;
@RestController @RestController
@RequestMapping("/app/progress/progressPlanDetail") @RequestMapping("/app/progress/progressPlanDetail")
public class PgsProgressPlanDetailAppController extends BaseController { public class PgsProgressPlanDetailAppController extends BaseController {
@Resource
private IPgsProgressPlanDetailService progressPlanDetailService;
/**
* 查询进度计划详情列表
*/
@GetMapping("/list")
public R<List<PgsProgressPlanDetailNumVo>> list(PgsProgressPlanDetailQueryReq req) {
return R.ok(progressPlanDetailService.queryNumberList(req));
}
/**
* 新增进度计划详情(普通设施)
*/
@RepeatSubmit()
@PostMapping("/insert/detail")
public R<Void> insertFinishedDetail(@Validated @RequestBody PgsProgressPlanDetailFinishedCreateReq req) {
return toAjax(progressPlanDetailService.insertFinishedDetail(req));
}
/**
* 新增进度计划详情(百分比、数量设施)
*/
@RepeatSubmit()
@PostMapping("/insert")
public R<Void> insertDetail(@Validated @RequestBody PgsProgressPlanDetailCreateReq req) {
return toAjax(progressPlanDetailService.insertPercentageNumberDetail(req));
}
/**
* 获取进度计划详情已完成设施详细信息
*
* @param id 主键
*/
@GetMapping("/detail/finished/{id}")
public TableDataInfo<PgsProgressPlanDetailFinishedVo> getFinishedDetail(@NotNull(message = "主键不能为空")
@PathVariable Long id,
PageQuery pageQuery) {
return progressPlanDetailService.queryFinishedById(id, pageQuery);
}
/**
* 获取进度计划详情未完成设施详细信息
*
* @param id 主键
*/
@GetMapping("/detail/unFinish/{id}")
public TableDataInfo<PgsProgressPlanDetailUnFinishVo> getUnFinishDetail(@NotNull(message = "主键不能为空")
@PathVariable Long id,
PageQuery pageQuery) {
return progressPlanDetailService.queryUnFinishById(id, pageQuery);
}
/**
* 删除进度计划详情
*/
@RepeatSubmit()
@DeleteMapping("/remove/detail")
public R<Void> removeDetail(@Validated PgsProgressPlanDetailRemoveReq req) {
return toAjax(progressPlanDetailService.removeDetail(req));
}
} }

View File

@ -8,7 +8,7 @@ import org.dromara.common.mybatis.core.domain.BaseEntity;
import java.io.Serial; import java.io.Serial;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.time.LocalDate;
/** /**
* 进度计划对象 pgs_progress_plan * 进度计划对象 pgs_progress_plan
@ -58,12 +58,12 @@ public class PgsProgressPlan extends BaseEntity {
/** /**
* 计划开始时间 * 计划开始时间
*/ */
private Date startDate; private LocalDate startDate;
/** /**
* 计划结束时间 * 计划结束时间
*/ */
private Date endDate; private LocalDate endDate;
/** /**
* 计划数量/百分比 * 计划数量/百分比

View File

@ -0,0 +1,27 @@
package org.dromara.progress.domain.dto.progresscategory;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
/**
* @author lilemy
* @date 2025-09-08 16:14
*/
@Data
public class PgsProgressCategoryQueryByParentReq implements Serializable {
@Serial
private static final long serialVersionUID = 9086069361042762679L;
/**
* 父级id
*/
private Long parentId;
/**
* 类别名称
*/
private String name;
}

View File

@ -0,0 +1,27 @@
package org.dromara.progress.domain.dto.progresscategorytemplate;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
/**
* @author lilemy
* @date 2025-09-08 16:21
*/
@Data
public class PgsProgressCategoryTemplateQueryByParentReq implements Serializable {
@Serial
private static final long serialVersionUID = -8113409205840032942L;
/**
* 父类别id
*/
private Long parentId;
/**
* 类别名称
*/
private String name;
}

View File

@ -1,13 +1,13 @@
package org.dromara.progress.domain.dto.progressplan; package org.dromara.progress.domain.dto.progressplan;
import com.fasterxml.jackson.annotation.JsonFormat; import jakarta.validation.constraints.NotNull;
import lombok.Data; import lombok.Data;
import org.dromara.progress.domain.dto.progressplandetail.PgsProgressPlanDetailCreateDto; import org.dromara.progress.domain.dto.progressplandetail.PgsProgressPlanDetailCreateDto;
import java.io.Serial; import java.io.Serial;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.time.LocalDate;
import java.util.List; import java.util.List;
/** /**
@ -23,6 +23,7 @@ public class PgsProgressPlanCreateReq implements Serializable {
/** /**
* 项目id * 项目id
*/ */
@NotNull(message = "项目id不能为空")
private Long projectId; private Long projectId;
/** /**
@ -33,28 +34,31 @@ public class PgsProgressPlanCreateReq implements Serializable {
/** /**
* 进度类型id * 进度类型id
*/ */
@NotNull(message = "进度类型id不能为空")
private Long progressCategoryId; private Long progressCategoryId;
/** /**
* 计划开始时间 * 计划开始时间
*/ */
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd") @NotNull(message = "计划开始时间不能为空")
private Date startDate; private LocalDate startDate;
/** /**
* 计划结束时间 * 计划结束时间
*/ */
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd") @NotNull(message = "计划结束时间不能为空")
private Date endDate; private LocalDate endDate;
/** /**
* 计划数量/百分比 * 计划数量/百分比
*/ */
@NotNull(message = "计划数量/百分比不能为空")
private BigDecimal planNumber; private BigDecimal planNumber;
/** /**
* 计划详情列表 * 计划详情列表
*/ */
@NotNull(message = "计划详情列表不能为空")
List<PgsProgressPlanDetailCreateDto> detailList; List<PgsProgressPlanDetailCreateDto> detailList;
} }

Some files were not shown because too many files have changed in this diff Show More