Compare commits
51 Commits
4e61a4afe9
...
dev
Author | SHA1 | Date | |
---|---|---|---|
a8cb16ab3f | |||
2c45762c66 | |||
056b28af31 | |||
7dd6d97a3e | |||
697beb67c4 | |||
4d627af3a1 | |||
ab332c462f | |||
0f3d1e38be | |||
4392a287cc | |||
f38538be33 | |||
ede1e501b4 | |||
4a2b62cf92 | |||
325f392e8f | |||
5b991396c2 | |||
c75563b46a | |||
724ebf8dbd | |||
a52b9078a0 | |||
9d682a3290 | |||
abad289c2b | |||
820188863e | |||
113b5debc9 | |||
6b4cd4ae0d | |||
261dd0b643 | |||
71f3810e51 | |||
fa835684d4 | |||
e19ef3003a | |||
8a18223d06 | |||
c90828f98e | |||
2ecb0063bf | |||
998547e63f | |||
78829ef5e7 | |||
da0dd8f78f | |||
96d0406931 | |||
d7616960c6 | |||
66e8495859 | |||
95c2858a64 | |||
5cbb0c630b | |||
e0cc521291 | |||
ff9f49b1d9 | |||
b738bb821d | |||
2cea57646d | |||
ab5cd491d6 | |||
3f3e20a64b | |||
f5d9cb7fc1 | |||
5b05d2eb40 | |||
fbffc18a9f | |||
490820d080 | |||
8e9b7c9b14 | |||
ae3738c098 | |||
127059e934 | |||
742e67af23 |
@ -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>
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
@ -193,6 +196,12 @@ public class AuthController {
|
|||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/app/register")
|
||||||
|
public R<Void> appRegister(@Validated @RequestBody RegisterBody user) {
|
||||||
|
registerService.appRegister(user);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 登录页面租户下拉框
|
* 登录页面租户下拉框
|
||||||
*
|
*
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -77,6 +77,46 @@ public class SysRegisterService {
|
|||||||
recordLogininfor(tenantId, username, Constants.REGISTER, MessageUtils.message("user.register.success"));
|
recordLogininfor(tenantId, username, Constants.REGISTER, MessageUtils.message("user.register.success"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 注册
|
||||||
|
*/
|
||||||
|
public void appRegister(RegisterBody registerBody) {
|
||||||
|
String tenantId = registerBody.getTenantId();
|
||||||
|
String username = registerBody.getPhonenumber();
|
||||||
|
String password = registerBody.getPassword();
|
||||||
|
// 校验用户类型是否存在
|
||||||
|
String userType = UserType.getUserType(registerBody.getUserType()).getUserType();
|
||||||
|
// 校验密码是否符合要求
|
||||||
|
String pattern = "^(?!.*\\s)(?!^[a-zA-Z]+$)(?!^[0-9]+$)(?!^[^a-zA-Z0-9]+$)(?!^[a-zA-Z0-9]+$).{8,18}$";
|
||||||
|
boolean isValid = password.matches(pattern);
|
||||||
|
if (!isValid) {
|
||||||
|
throw new UserException("注册失败,密码需满足8–18位,包含大小写字母、数字、特殊字符中的至少三种组合");
|
||||||
|
}
|
||||||
|
// 验证码开关
|
||||||
|
SysUserBo sysUser = new SysUserBo();
|
||||||
|
sysUser.setUserName(username);
|
||||||
|
sysUser.setNickName(username);
|
||||||
|
sysUser.setPhonenumber(username);
|
||||||
|
sysUser.setPassword(BCrypt.hashpw(password));
|
||||||
|
sysUser.setUserType(userType);
|
||||||
|
sysUser.setEmail(registerBody.getEmail());
|
||||||
|
|
||||||
|
boolean exist = TenantHelper.dynamic(tenantId, () -> {
|
||||||
|
return userMapper.exists(new LambdaQueryWrapper<SysUser>()
|
||||||
|
.eq(SysUser::getPhonenumber, sysUser.getPhonenumber()));
|
||||||
|
});
|
||||||
|
if (exist) {
|
||||||
|
throw new UserException("user.register.save.error", username);
|
||||||
|
}
|
||||||
|
boolean regFlag = userService.registerUser(sysUser, tenantId);
|
||||||
|
if (!regFlag) {
|
||||||
|
throw new UserException("user.register.error");
|
||||||
|
}
|
||||||
|
|
||||||
|
recordLogininfor(tenantId, username, Constants.REGISTER, MessageUtils.message("user.register.success"));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验验证码
|
* 校验验证码
|
||||||
*
|
*
|
||||||
|
@ -13,7 +13,7 @@ spring.boot.admin.client:
|
|||||||
|
|
||||||
--- # snail-job 配置
|
--- # snail-job 配置
|
||||||
snail-job:
|
snail-job:
|
||||||
enabled: false
|
enabled: true
|
||||||
# 需要在 SnailJob 后台组管理创建对应名称的组,然后创建任务的时候选择对应的组,才能正确分派任务
|
# 需要在 SnailJob 后台组管理创建对应名称的组,然后创建任务的时候选择对应的组,才能正确分派任务
|
||||||
group: "ruoyi_group"
|
group: "ruoyi_group"
|
||||||
# SnailJob 接入验证令牌 详见 script/sql/ry_job.sql `sj_group_config` 表
|
# SnailJob 接入验证令牌 详见 script/sql/ry_job.sql `sj_group_config` 表
|
||||||
|
@ -250,8 +250,8 @@ springdoc:
|
|||||||
packages-to-scan: org.dromara.design
|
packages-to-scan: org.dromara.design
|
||||||
- group: 13.工作流模块
|
- group: 13.工作流模块
|
||||||
packages-to-scan: org.dromara.workflow
|
packages-to-scan: org.dromara.workflow
|
||||||
- group: 14.罗成模块
|
# - group: 14.罗成模块
|
||||||
packages-to-scan: org.dromara.cory
|
# packages-to-scan: org.dromara.cory
|
||||||
- group: 15.无人机模块
|
- group: 15.无人机模块
|
||||||
packages-to-scan: org.dromara.drone
|
packages-to-scan: org.dromara.drone
|
||||||
- group: 20.代码生成模块
|
- group: 20.代码生成模块
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package org.dromara.test;
|
package org.dromara.test;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.io.FileUtil;
|
import cn.hutool.core.io.FileUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
@ -7,6 +8,7 @@ import jakarta.annotation.Resource;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
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.contractor.service.ISubUserSalaryDetailService;
|
||||||
import org.dromara.design.service.IDesTechnicalStandardService;
|
import org.dromara.design.service.IDesTechnicalStandardService;
|
||||||
import org.dromara.facility.domain.FacMatrix;
|
import org.dromara.facility.domain.FacMatrix;
|
||||||
import org.dromara.facility.service.IFacMatrixService;
|
import org.dromara.facility.service.IFacMatrixService;
|
||||||
@ -20,6 +22,7 @@ import org.junit.jupiter.api.Test;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -57,6 +60,9 @@ public class DemoTest {
|
|||||||
@Resource
|
@Resource
|
||||||
private ISubConstructionUserService constructionUserService;
|
private ISubConstructionUserService constructionUserService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ISubUserSalaryDetailService userSalaryDetailService;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void test() {
|
void test() {
|
||||||
Boolean result = photovoltaicPanelPartsService
|
Boolean result = photovoltaicPanelPartsService
|
||||||
@ -120,4 +126,18 @@ public class DemoTest {
|
|||||||
constructionUserService.update(constructionUserLuw);
|
constructionUserService.update(constructionUserLuw);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testSalary() {
|
||||||
|
List<SubConstructionUser> list = constructionUserService.lambdaQuery()
|
||||||
|
.eq(SubConstructionUser::getProjectId, 1897160897167638529L)
|
||||||
|
.list();
|
||||||
|
if (CollUtil.isNotEmpty(list)) {
|
||||||
|
for (SubConstructionUser user : list) {
|
||||||
|
for (int i = 1; i < 7; i++) {
|
||||||
|
userSalaryDetailService.insertByAttendance(user.getSysUserId(), LocalDate.now().minusDays(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -80,4 +80,9 @@ public interface CacheNames {
|
|||||||
*/
|
*/
|
||||||
String ONLINE_TOKEN = "online_tokens";
|
String ONLINE_TOKEN = "online_tokens";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目名称
|
||||||
|
*/
|
||||||
|
String PROJECT_NAME = "project_name#30d";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -30,4 +30,12 @@ public class RegisterBody extends LoginBody {
|
|||||||
|
|
||||||
private String userType;
|
private String userType;
|
||||||
|
|
||||||
|
private Long projectId;
|
||||||
|
|
||||||
|
private String email;
|
||||||
|
|
||||||
|
private String phonenumber;
|
||||||
|
|
||||||
|
private Long deptId;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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);
|
||||||
|
|
||||||
|
}
|
@ -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";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
@ -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
|
||||||
|
@ -12,6 +12,8 @@ public interface WebSocketConstants {
|
|||||||
*/
|
*/
|
||||||
String LOGIN_USER_KEY = "loginUser";
|
String LOGIN_USER_KEY = "loginUser";
|
||||||
|
|
||||||
|
String PROJECT_ID = "projectId";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订阅的频道
|
* 订阅的频道
|
||||||
*/
|
*/
|
||||||
|
@ -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());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -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());
|
||||||
|
@ -88,8 +88,16 @@
|
|||||||
<artifactId>layout</artifactId>
|
<artifactId>layout</artifactId>
|
||||||
<version>7.2.5</version>
|
<version>7.2.5</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!-- iText 7 核心模块(必须,layout依赖此模块) -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.itextpdf</groupId>
|
||||||
|
<artifactId>kernel</artifactId>
|
||||||
|
<version>7.2.5</version> <!-- 与layout版本严格一致 -->
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- 支持中文字体 -->
|
|
||||||
|
|
||||||
|
<!-- 支持中文字体 -->
|
||||||
<!-- <dependency>-->
|
<!-- <dependency>-->
|
||||||
<!-- <groupId>com.itextpdf</groupId>-->
|
<!-- <groupId>com.itextpdf</groupId>-->
|
||||||
<!-- <artifactId>itext-asian</artifactId>-->
|
<!-- <artifactId>itext-asian</artifactId>-->
|
||||||
@ -244,6 +252,11 @@
|
|||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.netty</groupId>
|
||||||
|
<artifactId>netty-all</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
@ -107,8 +107,8 @@ public class BusBiddingLimitListController extends BaseController {
|
|||||||
@Log(title = "成本-投标", businessType = BusinessType.INSERT)
|
@Log(title = "成本-投标", businessType = BusinessType.INSERT)
|
||||||
@RepeatSubmit()
|
@RepeatSubmit()
|
||||||
@PostMapping("/importExcelFile")
|
@PostMapping("/importExcelFile")
|
||||||
public R<Void> importExcelFile(Long projectId, @RequestParam("file") MultipartFile file) {
|
public R<Void> importExcelFile(BusBiddingLimitListBo bo, @RequestParam("file") MultipartFile file) {
|
||||||
return toAjax(busBiddingLimitListService.importExcelFile(projectId, file));
|
return toAjax(busBiddingLimitListService.importExcelFile(bo, file));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -42,6 +42,14 @@ public class BusBiddingLimitVersions extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
private String versions;
|
private String versions;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 版本号名称
|
||||||
|
*/
|
||||||
|
private String versionsName;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* excel文件
|
* excel文件
|
||||||
*/
|
*/
|
||||||
|
@ -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文件
|
||||||
*/
|
*/
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package org.dromara.bidding.domain.vo;
|
package org.dromara.bidding.domain.vo;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.write.style.ColumnWidth;
|
||||||
import org.dromara.bidding.domain.BusBiddingLimitList;
|
import org.dromara.bidding.domain.BusBiddingLimitList;
|
||||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
import com.alibaba.excel.annotation.ExcelProperty;
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
@ -77,6 +78,7 @@ public class BusBiddingLimitListVo implements Serializable {
|
|||||||
* 名称
|
* 名称
|
||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "名称")
|
@ExcelProperty(value = "名称")
|
||||||
|
@ColumnWidth(50)
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -52,6 +52,14 @@ public class BusBiddingLimitVersionsVo implements Serializable {
|
|||||||
@ExcelProperty(value = "版本号")
|
@ExcelProperty(value = "版本号")
|
||||||
private String versions;
|
private String versions;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 版本号名称
|
||||||
|
*/
|
||||||
|
private String versionsName;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* excel文件
|
* excel文件
|
||||||
*/
|
*/
|
||||||
|
@ -79,7 +79,7 @@ public interface IBusBiddingLimitListService extends IService<BusBiddingLimitLis
|
|||||||
*/
|
*/
|
||||||
List<BusBiddingLimitListVo> getTree(BusBiddingLimitListBo bo);
|
List<BusBiddingLimitListVo> getTree(BusBiddingLimitListBo bo);
|
||||||
|
|
||||||
Boolean importExcelFile(Long projectId, MultipartFile file);
|
Boolean importExcelFile(BusBiddingLimitListBo projectId, MultipartFile file);
|
||||||
|
|
||||||
List<BusBiddingLimitVersionsVo> obtainAllVersionNumbers(BiddingAllVersionNumbersReq bo);
|
List<BusBiddingLimitVersionsVo> obtainAllVersionNumbers(BiddingAllVersionNumbersReq bo);
|
||||||
|
|
||||||
|
@ -71,4 +71,6 @@ public interface IBusBiddingLimitVersionsService extends IService<BusBiddingLimi
|
|||||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||||
|
|
||||||
BusBiddingLimitVersions queryByProjectId( String versions, Long projectId);
|
BusBiddingLimitVersions queryByProjectId( String versions, Long projectId);
|
||||||
|
|
||||||
|
BusBiddingLimitVersions getByProjectIdVersions(Long projectId, String versions);
|
||||||
}
|
}
|
||||||
|
@ -25,8 +25,6 @@ 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.utils.excel.ExcelDynamicReader;
|
import org.dromara.common.utils.excel.ExcelDynamicReader;
|
||||||
import org.dromara.tender.domain.BusBillofquantitiesLimitList;
|
|
||||||
import org.dromara.tender.domain.bo.BusBillofquantitiesLimitListBo;
|
|
||||||
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;
|
||||||
@ -191,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));
|
||||||
});
|
});
|
||||||
|
|
||||||
//构建父子映射
|
//构建父子映射
|
||||||
@ -232,14 +230,22 @@ 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Boolean importExcelFile(Long projectId, MultipartFile file) {
|
public Boolean importExcelFile(BusBiddingLimitListBo bo, MultipartFile file) {
|
||||||
|
BusBiddingLimitVersions biddingLimitVersions = busBiddingLimitVersionsService.getByProjectIdVersions(bo.getProjectId(),bo.getVersions());
|
||||||
|
|
||||||
|
if (biddingLimitVersions == null) {
|
||||||
|
throw new ServiceException("版本号不存在!!!");
|
||||||
|
}
|
||||||
|
if (BusinessStatusEnum.FINISH.getStatus().equals(biddingLimitVersions.getStatus())) {
|
||||||
|
throw new ServiceException("数据已审核完成,不允许修改!!!");
|
||||||
|
}
|
||||||
|
|
||||||
// 跳过1行(表头),读取0到6列(共7列),映射到ExcelData实体类
|
// 跳过1行(表头),读取0到6列(共7列),映射到ExcelData实体类
|
||||||
List<BusBiddingLimitListBo> dataList = null;
|
List<BusBiddingLimitListBo> dataList = null;
|
||||||
@ -271,7 +277,6 @@ public class BusBiddingLimitListServiceImpl extends ServiceImpl<BusBiddingLimitL
|
|||||||
busBillofquantities.add(limitList);
|
busBillofquantities.add(limitList);
|
||||||
});
|
});
|
||||||
log.info(busBillofquantities.toString());
|
log.info(busBillofquantities.toString());
|
||||||
|
|
||||||
return this.updateBatchById(busBillofquantities);
|
return this.updateBatchById(busBillofquantities);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,6 +145,13 @@ public class BusBiddingLimitVersionsServiceImpl extends ServiceImpl<BusBiddingLi
|
|||||||
.eq(BusBiddingLimitVersions::getVersions, versions));
|
.eq(BusBiddingLimitVersions::getVersions, versions));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BusBiddingLimitVersions getByProjectIdVersions(Long projectId, String versions) {
|
||||||
|
return baseMapper.selectOne(new LambdaQueryWrapper<BusBiddingLimitVersions>()
|
||||||
|
.eq(BusBiddingLimitVersions::getProjectId, projectId)
|
||||||
|
.eq(BusBiddingLimitVersions::getVersions, versions));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 总体流程监听(例如: 草稿,撤销,退回,作废,终止,已完成,单任务完成等)
|
* 总体流程监听(例如: 草稿,撤销,退回,作废,终止,已完成,单任务完成等)
|
||||||
|
@ -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);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -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;
|
||||||
@ -114,7 +114,7 @@ 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));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -169,7 +169,7 @@ 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()).divide(HUNDRED));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -243,7 +243,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,7 +350,7 @@ 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()).divide(HUNDRED));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -380,7 +380,7 @@ 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()).divide(HUNDRED));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -448,7 +448,7 @@ 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()).divide(HUNDRED));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -478,7 +478,7 @@ 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()).divide(HUNDRED));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -511,7 +511,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 +526,6 @@ public class MoneyBigScreenController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取当前月份的开始时间和结束时间
|
* 获取当前月份的开始时间和结束时间
|
||||||
*
|
*
|
||||||
@ -548,8 +546,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));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,21 +11,27 @@ import org.dromara.bigscreen.domain.vo.ProjectPeopleVo;
|
|||||||
import org.dromara.bigscreen.domain.vo.ProjectSafetyInspectionVo;
|
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.idempotent.annotation.RepeatSubmit;
|
||||||
|
import org.dromara.common.log.annotation.Log;
|
||||||
|
import org.dromara.common.log.enums.BusinessType;
|
||||||
|
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.other.domain.OthYs7Device;
|
||||||
|
import org.dromara.other.service.IOthYs7DeviceService;
|
||||||
|
import org.dromara.manager.weathermanager.vo.WeatherVo;
|
||||||
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.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.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 +55,10 @@ public class ProjectBigScreenController {
|
|||||||
|
|
||||||
private final IBusLandBlockService busLandBlockService;
|
private final IBusLandBlockService busLandBlockService;
|
||||||
|
|
||||||
|
private final IGpsEquipmentService gpsEquipmentService;
|
||||||
|
|
||||||
|
private final IOthYs7DeviceService othYs7DeviceService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询项目土地统计
|
* 查询项目土地统计
|
||||||
*/
|
*/
|
||||||
@ -103,8 +113,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));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -167,4 +177,179 @@ public class ProjectBigScreenController {
|
|||||||
@PathVariable Long projectId) {
|
@PathVariable Long projectId) {
|
||||||
return R.ok(projectBigScreenService.getProjectGeneralize(projectId));
|
return R.ok(projectBigScreenService.getProjectGeneralize(projectId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询设备列表
|
||||||
|
*/
|
||||||
|
@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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
}
|
@ -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 BigDecimal totalContractAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 总容量
|
||||||
|
*/
|
||||||
|
private BigDecimal totalCapacity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 今日施工项目数量
|
||||||
|
*/
|
||||||
|
private Long todayProject;
|
||||||
|
}
|
@ -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;
|
||||||
|
}
|
@ -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;
|
||||||
|
}
|
@ -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;
|
||||||
|
}
|
@ -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;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -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;
|
||||||
|
}
|
@ -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;
|
||||||
|
|
||||||
|
}
|
@ -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;
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
package org.dromara.bigscreen.domain.vo;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class TodayAttendanceCountVo {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 考勤人员数量
|
||||||
|
*/
|
||||||
|
private Long attendanceCount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 出勤率
|
||||||
|
*/
|
||||||
|
private Double attendanceRate;
|
||||||
|
|
||||||
|
}
|
@ -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);
|
||||||
|
}
|
@ -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);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取项目安全天数
|
* 获取项目安全天数
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
|
@ -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())
|
||||||
|
.groupBy(PgsProgressPlanDetail::getProjectId)
|
||||||
|
.count();
|
||||||
|
vo.setOngoingProject((long) projectList.size());
|
||||||
|
vo.setTotalCapacity(totalCapacity);
|
||||||
|
vo.setTotalContractAmount(totalIncomeAmount.add(totalExpensesAmount));
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
@ -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);
|
||||||
}
|
}
|
||||||
|
@ -1,8 +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.core.util.NumberUtil;
|
import cn.hutool.json.JSONArray;
|
||||||
import cn.hutool.core.util.RandomUtil;
|
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;
|
||||||
@ -11,14 +11,19 @@ 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.enums.PgsProgressUnitTypeEnum;
|
||||||
|
import org.dromara.progress.service.IPgsProgressCategoryService;
|
||||||
import org.dromara.project.domain.BusProject;
|
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;
|
||||||
@ -27,11 +32,9 @@ import org.springframework.beans.BeanUtils;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -62,6 +65,9 @@ public class ProjectBigScreenServiceImpl implements ProjectBigScreenService {
|
|||||||
@Resource
|
@Resource
|
||||||
private IBusProjectTeamMemberService projectTeamMemberService;
|
private IBusProjectTeamMemberService projectTeamMemberService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IPgsProgressCategoryService progressCategoryService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取项目天气
|
* 获取项目天气
|
||||||
*
|
*
|
||||||
@ -69,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);
|
||||||
}
|
}
|
||||||
@ -203,50 +209,130 @@ public class ProjectBigScreenServiceImpl implements ProjectBigScreenService {
|
|||||||
@Override
|
@Override
|
||||||
public ProjectImageProgressVo getProjectImageProgress(Long projectId) {
|
public ProjectImageProgressVo getProjectImageProgress(Long projectId) {
|
||||||
checkProject(projectId);
|
checkProject(projectId);
|
||||||
// 生成 0 ~ 100 的随机 double
|
|
||||||
double random = RandomUtil.randomDouble(0, 100);
|
|
||||||
|
|
||||||
// 保留两位小数(四舍五入)
|
|
||||||
double result = NumberUtil.round(random, 2).doubleValue();
|
|
||||||
ProjectImageProgressVo vo = new ProjectImageProgressVo();
|
ProjectImageProgressVo vo = new ProjectImageProgressVo();
|
||||||
vo.setAreaPercentage(BigDecimal.valueOf(result));
|
// 获取所有子项目列表
|
||||||
// 生成 0 ~ 100 的随机 double
|
List<BusProject> subProjectList = projectService.lambdaQuery()
|
||||||
double random1 = RandomUtil.randomDouble(0, 100);
|
.eq(BusProject::getPId, projectId)
|
||||||
|
.list();
|
||||||
// 保留两位小数(四舍五入)
|
if (CollUtil.isEmpty(subProjectList)) {
|
||||||
double result1 = NumberUtil.round(random1, 2).doubleValue();
|
return vo;
|
||||||
vo.setRoadPercentage(BigDecimal.valueOf(result1));
|
}
|
||||||
// 生成 0 ~ 100 的随机 double
|
// 子项目id列表
|
||||||
double random2 = RandomUtil.randomDouble(0, 100);
|
List<Long> subProjectIds = subProjectList.stream().map(BusProject::getId).toList();
|
||||||
|
// 计算集电线路
|
||||||
// 保留两位小数(四舍五入)
|
vo.setCollectorLinePercentage(BigDecimal.valueOf(0.00));
|
||||||
double result2 = NumberUtil.round(random2, 2).doubleValue();
|
// 计算送出线路
|
||||||
vo.setCollectorLinePercentage(BigDecimal.valueOf(result2));
|
vo.setExportLinePercentage(BigDecimal.valueOf(0.00));
|
||||||
// 生成 0 ~ 100 的随机 double
|
// 计算升压站
|
||||||
double random3 = RandomUtil.randomDouble(0, 100);
|
vo.setSubstationPercentage(BigDecimal.valueOf(0.00));
|
||||||
|
// 计算光伏场区
|
||||||
// 保留两位小数(四舍五入)
|
vo.setAreaPercentage(BigDecimal.valueOf(0.00));
|
||||||
double result3 = NumberUtil.round(random3, 2).doubleValue();
|
// 计算道路
|
||||||
vo.setExportLinePercentage(BigDecimal.valueOf(result3));
|
vo.setRoadPercentage(BigDecimal.valueOf(0.00));
|
||||||
// 生成 0 ~ 100 的随机 double
|
// 计算箱变
|
||||||
double random4 = RandomUtil.randomDouble(0, 100);
|
vo.setBoxTransformerPercentage(BigDecimal.ZERO);
|
||||||
|
// 获取集电线路、送出线路、升压站数据
|
||||||
// 保留两位小数(四舍五入)
|
List<PgsProgressCategory> progressCategoryList = progressCategoryService.lambdaQuery()
|
||||||
double result4 = NumberUtil.round(random4, 2).doubleValue();
|
.in(PgsProgressCategory::getProjectId, subProjectIds)
|
||||||
vo.setSubstationPercentage(BigDecimal.valueOf(result4));
|
.in(PgsProgressCategory::getName, "集电线路", "送出线路", "升压站", "光伏场区")
|
||||||
// 生成 0 ~ 100 的随机 double
|
.eq(PgsProgressCategory::getParentId, 0L)
|
||||||
double random5 = RandomUtil.randomDouble(0, 100);
|
.list();
|
||||||
|
if (CollUtil.isNotEmpty(progressCategoryList)) {
|
||||||
// 保留两位小数(四舍五入)
|
List<Long> categoryIds = progressCategoryList.stream().map(PgsProgressCategory::getId).distinct().toList();
|
||||||
double result5 = NumberUtil.round(random5, 2).doubleValue();
|
List<PgsProgressCategory> leafNodesByTopIds = progressCategoryService.getLeafNodesByTopIds(categoryIds);
|
||||||
vo.setBoxTransformerPercentage(BigDecimal.valueOf(result5));
|
Map<String, List<PgsProgressCategory>> categoryMap = progressCategoryList.stream()
|
||||||
|
.collect(Collectors.groupingBy(PgsProgressCategory::getName));
|
||||||
// 生成 0 ~ 100 的随机 double
|
// 计算集电线路
|
||||||
double random6 = RandomUtil.randomDouble(0, 100);
|
if (categoryMap.containsKey("集电线路")) {
|
||||||
|
List<PgsProgressCategory> categoryList = categoryMap.get("集电线路");
|
||||||
// 保留两位小数(四舍五入)
|
List<Long> ids = categoryList.stream().map(PgsProgressCategory::getId).distinct().toList();
|
||||||
double result6 = NumberUtil.round(random6, 2).doubleValue();
|
List<PgsProgressCategory> list = leafNodesByTopIds.stream()
|
||||||
vo.setTotalPercentage(BigDecimal.valueOf(result6));
|
.filter(node -> {
|
||||||
|
Set<Long> ancestorSet = Arrays.stream(node.getAncestors().split(",")).map(Long::parseLong).collect(Collectors.toSet());
|
||||||
|
return ids.stream().anyMatch(ancestorSet::contains);
|
||||||
|
}).toList();
|
||||||
|
BigDecimal percentage = progressCategoryService.getCompletedPercentage(list);
|
||||||
|
if (percentage.compareTo(BigDecimal.ZERO) > 0) {
|
||||||
|
vo.setCollectorLinePercentage(percentage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 计算送出线路
|
||||||
|
if (categoryMap.containsKey("送出线路")) {
|
||||||
|
List<PgsProgressCategory> categoryList = categoryMap.get("送出线路");
|
||||||
|
List<Long> ids = categoryList.stream().map(PgsProgressCategory::getId).distinct().toList();
|
||||||
|
List<PgsProgressCategory> list = leafNodesByTopIds.stream()
|
||||||
|
.filter(node -> {
|
||||||
|
Set<Long> ancestorSet = Arrays.stream(node.getAncestors().split(",")).map(Long::parseLong).collect(Collectors.toSet());
|
||||||
|
return ids.stream().anyMatch(ancestorSet::contains);
|
||||||
|
}).toList();
|
||||||
|
BigDecimal percentage = progressCategoryService.getCompletedPercentage(list);
|
||||||
|
if (percentage.compareTo(BigDecimal.ZERO) > 0) {
|
||||||
|
vo.setExportLinePercentage(percentage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 计算升压站
|
||||||
|
if (categoryMap.containsKey("升压站")) {
|
||||||
|
List<PgsProgressCategory> categoryList = categoryMap.get("升压站");
|
||||||
|
List<Long> ids = categoryList.stream().map(PgsProgressCategory::getId).distinct().toList();
|
||||||
|
List<PgsProgressCategory> list = leafNodesByTopIds.stream()
|
||||||
|
.filter(node -> {
|
||||||
|
Set<Long> ancestorSet = Arrays.stream(node.getAncestors().split(",")).map(Long::parseLong).collect(Collectors.toSet());
|
||||||
|
return ids.stream().anyMatch(ancestorSet::contains);
|
||||||
|
}).toList();
|
||||||
|
BigDecimal percentage = progressCategoryService.getCompletedPercentage(list);
|
||||||
|
if (percentage.compareTo(BigDecimal.ZERO) > 0) {
|
||||||
|
vo.setSubstationPercentage(percentage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 计算光伏场区
|
||||||
|
if (categoryMap.containsKey("光伏场区")) {
|
||||||
|
List<PgsProgressCategory> categoryList = categoryMap.get("光伏场区");
|
||||||
|
List<Long> ids = categoryList.stream().map(PgsProgressCategory::getId).distinct().toList();
|
||||||
|
List<PgsProgressCategory> list = leafNodesByTopIds.stream()
|
||||||
|
.filter(node -> {
|
||||||
|
Set<Long> ancestorSet = Arrays.stream(node.getAncestors().split(",")).map(Long::parseLong).collect(Collectors.toSet());
|
||||||
|
return ids.stream().anyMatch(ancestorSet::contains);
|
||||||
|
}).toList();
|
||||||
|
BigDecimal percentage = progressCategoryService.getCompletedPercentage(list);
|
||||||
|
if (percentage.compareTo(BigDecimal.ZERO) > 0) {
|
||||||
|
vo.setAreaPercentage(percentage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 计算道路
|
||||||
|
List<PgsProgressCategory> roadCategoryList = progressCategoryService.lambdaQuery()
|
||||||
|
.in(PgsProgressCategory::getProjectId, subProjectIds)
|
||||||
|
.like(PgsProgressCategory::getName, "道路")
|
||||||
|
.ne(PgsProgressCategory::getUnitType, PgsProgressUnitTypeEnum.NULL.getValue())
|
||||||
|
.list();
|
||||||
|
if (CollUtil.isNotEmpty(roadCategoryList)) {
|
||||||
|
BigDecimal percentage = progressCategoryService.getCompletedPercentage(roadCategoryList);
|
||||||
|
if (percentage.compareTo(BigDecimal.ZERO) > 0) {
|
||||||
|
vo.setRoadPercentage(percentage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 计算箱变
|
||||||
|
List<PgsProgressCategory> boxTransformerCategoryList = progressCategoryService.lambdaQuery()
|
||||||
|
.in(PgsProgressCategory::getProjectId, subProjectIds)
|
||||||
|
.like(PgsProgressCategory::getName, "箱变")
|
||||||
|
.ne(PgsProgressCategory::getUnitType, PgsProgressUnitTypeEnum.NULL.getValue())
|
||||||
|
.list();
|
||||||
|
if (CollUtil.isNotEmpty(boxTransformerCategoryList)) {
|
||||||
|
BigDecimal percentage = progressCategoryService.getCompletedPercentage(boxTransformerCategoryList);
|
||||||
|
if (percentage.compareTo(BigDecimal.ZERO) > 0) {
|
||||||
|
vo.setBoxTransformerPercentage(percentage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 计算总进度
|
||||||
|
vo.setTotalPercentage(
|
||||||
|
vo.getCollectorLinePercentage()
|
||||||
|
.add(vo.getExportLinePercentage())
|
||||||
|
.add(vo.getSubstationPercentage())
|
||||||
|
.add(vo.getAreaPercentage())
|
||||||
|
.add(vo.getRoadPercentage())
|
||||||
|
.add(vo.getBoxTransformerPercentage())
|
||||||
|
.divide(BigDecimal.valueOf(6), 2, RoundingMode.HALF_UP) // 保留两位小数
|
||||||
|
);
|
||||||
return vo;
|
return vo;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -276,4 +362,26 @@ public class ProjectBigScreenServiceImpl implements ProjectBigScreenService {
|
|||||||
throw new ServiceException("项目不存在", HttpStatus.NOT_FOUND);
|
throw new ServiceException("项目不存在", HttpStatus.NOT_FOUND);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@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());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package org.dromara.cailiaoshebei.controller;
|
package org.dromara.cailiaoshebei.controller;
|
||||||
|
|
||||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import jakarta.validation.constraints.NotEmpty;
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
@ -33,8 +34,12 @@ import org.dromara.design.service.IBusBillofquantitiesVersionsService;
|
|||||||
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.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 物资-采购联系单
|
* 物资-采购联系单
|
||||||
@ -67,6 +72,8 @@ public class BusPurchaseDocController extends BaseController {
|
|||||||
return busPurchaseDocService.queryPageList(bo, pageQuery);
|
return busPurchaseDocService.queryPageList(bo, pageQuery);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出物资-采购联系单列表
|
* 导出物资-采购联系单列表
|
||||||
*/
|
*/
|
||||||
@ -157,13 +164,23 @@ public class BusPurchaseDocController extends BaseController {
|
|||||||
@PathVariable("id") Long id) {
|
@PathVariable("id") Long id) {
|
||||||
List<BusPlanDocAssociation> list = planDocAssociationService.list(Wrappers.lambdaQuery(BusPlanDocAssociation.class)
|
List<BusPlanDocAssociation> list = planDocAssociationService.list(Wrappers.lambdaQuery(BusPlanDocAssociation.class)
|
||||||
.eq(BusPlanDocAssociation::getDocId, id));
|
.eq(BusPlanDocAssociation::getDocId, id));
|
||||||
List<Long> list1 = list.stream().map(BusPlanDocAssociation::getPlanId).toList();
|
if (CollectionUtil.isEmpty(list)) {
|
||||||
if (list1.isEmpty()) {
|
|
||||||
return R.ok(new ArrayList<>());
|
return R.ok(new ArrayList<>());
|
||||||
}
|
}
|
||||||
|
Map<Long, BigDecimal> collect = list.stream()
|
||||||
|
.filter(Objects::nonNull) // 过滤空对象
|
||||||
|
.collect(Collectors.toMap(
|
||||||
|
BusPlanDocAssociation::getPlanId,
|
||||||
|
BusPlanDocAssociation::getDemandQuantity,
|
||||||
|
(existing, replacement) -> existing // 保留第一个遇到的重复键
|
||||||
|
));
|
||||||
BusMaterialbatchdemandplanBo bo = new BusMaterialbatchdemandplanBo();
|
BusMaterialbatchdemandplanBo bo = new BusMaterialbatchdemandplanBo();
|
||||||
bo.setIds(list1);
|
bo.setIds(new ArrayList<>(collect.keySet()));
|
||||||
return R.ok(materialbatchdemandplanService.queryList(bo));
|
List<BusMaterialbatchdemandplanVo> busMaterialbatchdemandplanVos = materialbatchdemandplanService.queryList(bo);
|
||||||
|
for (BusMaterialbatchdemandplanVo busMaterialbatchdemandplanVo : busMaterialbatchdemandplanVos) {
|
||||||
|
busMaterialbatchdemandplanVo.setDemandQuantity(collect.get(busMaterialbatchdemandplanVo.getId()).longValue());
|
||||||
|
}
|
||||||
|
return R.ok(busMaterialbatchdemandplanVos);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -6,6 +6,7 @@ import lombok.Data;
|
|||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 物资-批次需求计划与采购单关联对象 bus_plan_doc_association
|
* 物资-批次需求计划与采购单关联对象 bus_plan_doc_association
|
||||||
@ -37,6 +38,11 @@ public class BusPlanDocAssociation extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
private Long planId;
|
private Long planId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 需求数量
|
||||||
|
*/
|
||||||
|
private BigDecimal demandQuantity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 采购联系单id
|
* 采购联系单id
|
||||||
*/
|
*/
|
||||||
|
@ -114,4 +114,10 @@ public class BusMaterialbatchdemandplanBo extends BaseEntity {
|
|||||||
* 主键集合
|
* 主键集合
|
||||||
*/
|
*/
|
||||||
private List<Long> ids;
|
private List<Long> ids;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 供应商id
|
||||||
|
*/
|
||||||
|
private Long supplierId;
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,8 @@ import lombok.Data;
|
|||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import jakarta.validation.constraints.*;
|
import jakarta.validation.constraints.*;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 物资-批次需求计划与采购单关联业务对象 bus_plan_doc_association
|
* 物资-批次需求计划与采购单关联业务对象 bus_plan_doc_association
|
||||||
*
|
*
|
||||||
@ -41,5 +43,8 @@ public class BusPlanDocAssociationBo extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
private Long docId;
|
private Long docId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 需求数量
|
||||||
|
*/
|
||||||
|
private BigDecimal demandQuantity;
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,11 @@ public class BusTotalsupplyplanBo extends BaseEntity {
|
|||||||
@NotNull(message = "主键ID不能为空", groups = { EditGroup.class })
|
@NotNull(message = "主键ID不能为空", groups = { EditGroup.class })
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目Id
|
||||||
|
*/
|
||||||
|
private Long projectId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批次号
|
* 批次号
|
||||||
*/
|
*/
|
||||||
|
@ -10,6 +10,7 @@ import lombok.Data;
|
|||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
|
||||||
@ -52,5 +53,8 @@ public class BusPlanDocAssociationVo implements Serializable {
|
|||||||
@ExcelProperty(value = "采购联系单id")
|
@ExcelProperty(value = "采购联系单id")
|
||||||
private Long docId;
|
private Long docId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 需求数量
|
||||||
|
*/
|
||||||
|
private BigDecimal demandQuantity;
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,11 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||||||
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.core.toolkit.Wrappers;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.dromara.tender.domain.bo.BusBiddingPlanBo;
|
||||||
|
import org.dromara.tender.domain.vo.BusBiddingPlanVo;
|
||||||
|
import org.dromara.tender.domain.vo.BusBillofquantitiesLimitListVo;
|
||||||
|
import org.dromara.tender.service.IBusBiddingPlanService;
|
||||||
|
import org.dromara.tender.service.ITenderSupplierInputService;
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
@ -34,9 +39,7 @@ import org.dromara.cailiaoshebei.mapper.BusMaterialbatchdemandplanMapper;
|
|||||||
import org.dromara.cailiaoshebei.service.IBusMaterialbatchdemandplanService;
|
import org.dromara.cailiaoshebei.service.IBusMaterialbatchdemandplanService;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.*;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 物资-批次需求计划Service业务层处理
|
* 物资-批次需求计划Service业务层处理
|
||||||
@ -60,6 +63,10 @@ public class BusMaterialbatchdemandplanServiceImpl extends ServiceImpl<BusMateri
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IBusMaterialsorderService busMaterialsorderService;
|
private IBusMaterialsorderService busMaterialsorderService;
|
||||||
|
|
||||||
|
@Lazy
|
||||||
|
@Autowired
|
||||||
|
private IBusBiddingPlanService busBiddingPlanService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询物资-批次需求计划
|
* 查询物资-批次需求计划
|
||||||
*
|
*
|
||||||
@ -82,6 +89,25 @@ public class BusMaterialbatchdemandplanServiceImpl extends ServiceImpl<BusMateri
|
|||||||
public TableDataInfo<BusMaterialbatchdemandplanVo> queryPageList(BusMaterialbatchdemandplanBo bo, PageQuery pageQuery) {
|
public TableDataInfo<BusMaterialbatchdemandplanVo> queryPageList(BusMaterialbatchdemandplanBo bo, PageQuery pageQuery) {
|
||||||
LambdaQueryWrapper<BusMaterialbatchdemandplan> lqw = buildQueryWrapper(bo);
|
LambdaQueryWrapper<BusMaterialbatchdemandplan> lqw = buildQueryWrapper(bo);
|
||||||
Page<BusMaterialbatchdemandplanVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
Page<BusMaterialbatchdemandplanVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||||
|
if (bo.getSupplierId()!=null){
|
||||||
|
BusBiddingPlanBo bo1 = new BusBiddingPlanBo();
|
||||||
|
bo1.setProjectId(bo.getProjectId());
|
||||||
|
bo1.setType("2");
|
||||||
|
bo1.setWinningBidderId(bo.getSupplierId());
|
||||||
|
List<BusBillofquantitiesLimitListVo> busBiddingPlanVos = busBiddingPlanService.getBillofquantitiesLimitListVo(bo1);
|
||||||
|
if (busBiddingPlanVos == null || busBiddingPlanVos.isEmpty()) {
|
||||||
|
throw new ServiceException("该供应商暂无材料");
|
||||||
|
}
|
||||||
|
Set<String> hashSet = new HashSet<>();
|
||||||
|
busBiddingPlanVos.stream().forEach(vo -> {
|
||||||
|
hashSet.add(vo.getName()+"+"+vo.getSpecification());
|
||||||
|
});
|
||||||
|
List<BusMaterialbatchdemandplanVo> list = result.getRecords().stream().filter(vo -> {
|
||||||
|
String key = vo.getName() + "+" + vo.getSpecification(); // 拼接字符串(需与 Set 中格式一致)
|
||||||
|
return hashSet.contains(key); // 仅保留 Set 中存在的数据
|
||||||
|
}).toList();
|
||||||
|
result.setRecords(list);
|
||||||
|
}
|
||||||
return TableDataInfo.build(result);
|
return TableDataInfo.build(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,6 +57,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
import java.net.FileNameMap;
|
import java.net.FileNameMap;
|
||||||
import java.net.URLConnection;
|
import java.net.URLConnection;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
@ -69,6 +70,7 @@ import java.time.LocalDate;
|
|||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 物资-采购联系单Service业务层处理
|
* 物资-采购联系单Service业务层处理
|
||||||
@ -184,6 +186,7 @@ public class BusPurchaseDocServiceImpl extends ServiceImpl<BusPurchaseDocMapper,
|
|||||||
|
|
||||||
BusPurchaseDoc add = MapstructUtils.convert(bo, BusPurchaseDoc.class);
|
BusPurchaseDoc add = MapstructUtils.convert(bo, BusPurchaseDoc.class);
|
||||||
validEntityBeforeSave(add);
|
validEntityBeforeSave(add);
|
||||||
|
validNum(bo.getAssociationList());
|
||||||
boolean flag = baseMapper.insert(add) > 0;
|
boolean flag = baseMapper.insert(add) > 0;
|
||||||
if (flag) {
|
if (flag) {
|
||||||
bo.setId(add.getId());
|
bo.setId(add.getId());
|
||||||
@ -199,6 +202,30 @@ public class BusPurchaseDocServiceImpl extends ServiceImpl<BusPurchaseDocMapper,
|
|||||||
return flag;
|
return flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void validNum(List<BusPlanDocAssociationBo> associationList){
|
||||||
|
|
||||||
|
for (BusPlanDocAssociationBo association : associationList) {
|
||||||
|
|
||||||
|
BusMaterialbatchdemandplan byId = materialbatchdemandplanService.getById(association.getPlanId());
|
||||||
|
|
||||||
|
List<BusPlanDocAssociation> list = planDocAssociationService.list(Wrappers.lambdaQuery(BusPlanDocAssociation.class)
|
||||||
|
.eq(BusPlanDocAssociation::getPlanId, association.getPlanId()));
|
||||||
|
BigDecimal total = list.stream()
|
||||||
|
.map(BusPlanDocAssociation::getDemandQuantity)
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
|
|
||||||
|
if(total.add(association.getDemandQuantity()).compareTo(byId.getDemandQuantity()) > 0){
|
||||||
|
throw new ServiceException("材料:" + byId.getName() + "已超出计划单的物料批次需求计划数量");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改物资-采购联系单
|
* 修改物资-采购联系单
|
||||||
*
|
*
|
||||||
@ -320,8 +347,9 @@ public class BusPurchaseDocServiceImpl extends ServiceImpl<BusPurchaseDocMapper,
|
|||||||
.eq(BusPlanDocAssociation::getDocId, purchaseDoc.getId())
|
.eq(BusPlanDocAssociation::getDocId, purchaseDoc.getId())
|
||||||
.list();
|
.list();
|
||||||
if (CollUtil.isNotEmpty(planDocAssociationList)) {
|
if (CollUtil.isNotEmpty(planDocAssociationList)) {
|
||||||
List<Long> planIds = planDocAssociationList.stream().map(BusPlanDocAssociation::getPlanId).toList();
|
Map<Long, BigDecimal> map = planDocAssociationList.stream().collect(Collectors.toMap(BusPlanDocAssociation::getPlanId, BusPlanDocAssociation::getDemandQuantity));
|
||||||
items = materialbatchdemandplanService.listByIds(planIds);
|
items = materialbatchdemandplanService.listByIds(map.keySet());
|
||||||
|
items.forEach(item -> item.setDemandQuantity(map.get(item.getId())));
|
||||||
}
|
}
|
||||||
BusPurchaseDocWordDto data = this.getReplacementDto(purchaseDoc, items);
|
BusPurchaseDocWordDto data = this.getReplacementDto(purchaseDoc, items);
|
||||||
Path newTargetDir = Paths.get(System.getProperty("user.dir"), constant.getBusPurchaseDocFileUrl(purchaseDoc, now));
|
Path newTargetDir = Paths.get(System.getProperty("user.dir"), constant.getBusPurchaseDocFileUrl(purchaseDoc, now));
|
||||||
|
@ -104,6 +104,7 @@ public class BusTotalsupplyplanServiceImpl extends ServiceImpl<BusTotalsupplypla
|
|||||||
private LambdaQueryWrapper<BusTotalsupplyplan> buildQueryWrapper(BusTotalsupplyplanBo bo) {
|
private LambdaQueryWrapper<BusTotalsupplyplan> buildQueryWrapper(BusTotalsupplyplanBo bo) {
|
||||||
Map<String, Object> params = bo.getParams();
|
Map<String, Object> params = bo.getParams();
|
||||||
LambdaQueryWrapper<BusTotalsupplyplan> lqw = Wrappers.lambdaQuery();
|
LambdaQueryWrapper<BusTotalsupplyplan> lqw = Wrappers.lambdaQuery();
|
||||||
|
lqw.eq(bo.getProjectId() != null ,BusTotalsupplyplan::getProjectId,bo.getProjectId());
|
||||||
lqw.eq(StringUtils.isNotBlank(bo.getTexture()), BusTotalsupplyplan::getTexture, bo.getTexture());
|
lqw.eq(StringUtils.isNotBlank(bo.getTexture()), BusTotalsupplyplan::getTexture, bo.getTexture());
|
||||||
lqw.eq(StringUtils.isNotBlank(bo.getBrand()), BusTotalsupplyplan::getBrand, bo.getBrand());
|
lqw.eq(StringUtils.isNotBlank(bo.getBrand()), BusTotalsupplyplan::getBrand, bo.getBrand());
|
||||||
lqw.eq(StringUtils.isNotBlank(bo.getQualityStandard()), BusTotalsupplyplan::getQualityStandard, bo.getQualityStandard());
|
lqw.eq(StringUtils.isNotBlank(bo.getQualityStandard()), BusTotalsupplyplan::getQualityStandard, bo.getQualityStandard());
|
||||||
|
@ -18,9 +18,11 @@ public class BigDecimalUtil {
|
|||||||
*/
|
*/
|
||||||
public static BigDecimal toPercentage(BigDecimal dividend, BigDecimal divisor) {
|
public static BigDecimal toPercentage(BigDecimal dividend, BigDecimal divisor) {
|
||||||
if (dividend == null || divisor == null || divisor.compareTo(BigDecimal.ZERO) == 0) {
|
if (dividend == null || divisor == null || divisor.compareTo(BigDecimal.ZERO) == 0) {
|
||||||
return BigDecimal.ZERO;
|
return BigDecimal.valueOf(0.00);
|
||||||
}
|
}
|
||||||
return dividend.divide(divisor, 2, RoundingMode.HALF_UP).multiply(new BigDecimal("100"));
|
return dividend
|
||||||
|
.multiply(new BigDecimal("100"))
|
||||||
|
.divide(divisor, 2, RoundingMode.HALF_UP);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -111,12 +111,139 @@ public class PdfBoxQrCodeGenerator {
|
|||||||
/**
|
/**
|
||||||
* 在PDF每一页的指定位置添加二维码并返回数据流(根据页面方向自动调整位置)
|
* 在PDF每一页的指定位置添加二维码并返回数据流(根据页面方向自动调整位置)
|
||||||
*/
|
*/
|
||||||
|
// public static ByteArrayOutputStream addQRCodeToPDFOnAllPages(String srcPdf, byte[] qrCodeBytes, boolean isChangeFile)
|
||||||
|
// throws IOException {
|
||||||
|
//
|
||||||
|
// PdfReader reader;
|
||||||
|
// if (srcPdf.startsWith("http://") || srcPdf.startsWith("https://")) {
|
||||||
|
// // 网络地址 PDF
|
||||||
|
// URL url = new URL(srcPdf);
|
||||||
|
// HttpURLConnection connection = (HttpURLConnection) url.openConnection();
|
||||||
|
// connection.setConnectTimeout(10000);
|
||||||
|
// connection.setReadTimeout(30000);
|
||||||
|
// connection.setRequestMethod("GET");
|
||||||
|
//
|
||||||
|
// int responseCode = connection.getResponseCode();
|
||||||
|
// if (responseCode != HttpURLConnection.HTTP_OK) {
|
||||||
|
// throw new IOException("无法获取 PDF 文件,HTTP响应码: " + responseCode);
|
||||||
|
// }
|
||||||
|
// InputStream inputStream = connection.getInputStream();
|
||||||
|
// reader = new PdfReader(inputStream);
|
||||||
|
// } else {
|
||||||
|
// // 本地文件 PDF
|
||||||
|
// File srcFile = new File(srcPdf);
|
||||||
|
// if (!srcFile.exists()) {
|
||||||
|
// throw new IOException("源PDF文件不存在: " + srcPdf);
|
||||||
|
// }
|
||||||
|
// reader = new PdfReader(srcPdf);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// ByteArrayOutputStream pdfOut = new ByteArrayOutputStream();
|
||||||
|
// PdfWriter writer = new PdfWriter(pdfOut);
|
||||||
|
// PdfDocument pdfDoc = new PdfDocument(reader, writer);
|
||||||
|
//
|
||||||
|
// int numberOfPages = pdfDoc.getNumberOfPages();
|
||||||
|
//
|
||||||
|
// for (int pageNum = 1; pageNum <= numberOfPages; pageNum++) {
|
||||||
|
// PdfPage page = pdfDoc.getPage(pageNum);
|
||||||
|
// Rectangle pageSize = page.getPageSize();
|
||||||
|
//
|
||||||
|
// float pageWidth = pageSize.getWidth();
|
||||||
|
// float pageHeight = pageSize.getHeight();
|
||||||
|
//
|
||||||
|
// float qrX, qrY;
|
||||||
|
// float newWidth, newHeight;
|
||||||
|
//
|
||||||
|
// if (isChangeFile && pageNum == 1) {
|
||||||
|
// qrX = pageWidth - 143;
|
||||||
|
// qrY = pageHeight - 213;
|
||||||
|
// newWidth = 67;
|
||||||
|
// newHeight = 80;
|
||||||
|
// } else {
|
||||||
|
// if (pageWidth > pageHeight) {
|
||||||
|
// // 横版
|
||||||
|
// qrX = pageWidth - 90;
|
||||||
|
// qrY = 24;
|
||||||
|
// newWidth = 67;
|
||||||
|
// newHeight = 79;
|
||||||
|
// } else {
|
||||||
|
// // 竖版
|
||||||
|
// qrX = 226;
|
||||||
|
// qrY = pageHeight - 185;
|
||||||
|
// newWidth = 69;
|
||||||
|
// newHeight = 80;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// PdfCanvas pdfCanvas = new PdfCanvas(page.newContentStreamAfter(), page.getResources(), pdfDoc);
|
||||||
|
// try (Canvas canvas = new Canvas(pdfCanvas, page.getPageSize())) {
|
||||||
|
// ImageData imageData = ImageDataFactory.create(qrCodeBytes);
|
||||||
|
// Image image = new Image(imageData)
|
||||||
|
// .scaleAbsolute(newWidth, newHeight)
|
||||||
|
// .setFixedPosition(qrX, qrY);
|
||||||
|
// canvas.add(image);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// pdfDoc.close();
|
||||||
|
// return pdfOut;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// public static void main(String[] args) {
|
||||||
|
// String path = "C:\\Users\\YuanJie\\Desktop\\test.pdf";
|
||||||
|
// String outputPath = "C:\\Users\\YuanJie\\Desktop\\test1.pdf";
|
||||||
|
//
|
||||||
|
// String params = "http://192.168.110.151:7788/codeDetail?id=" + "1957649652924448769";
|
||||||
|
// byte[] bytes = PdfBoxQrCodeGenerator.generateQRCodeBytes(params);
|
||||||
|
//
|
||||||
|
// try {
|
||||||
|
// System.out.println("二维码字节大小: " + bytes.length + " 字节");
|
||||||
|
//
|
||||||
|
// // 在每一页添加二维码
|
||||||
|
// ByteArrayOutputStream byteArrayOutputStream =
|
||||||
|
// PdfBoxQrCodeGenerator.addQRCodeToPDFOnAllPages(path, bytes, false);
|
||||||
|
//
|
||||||
|
// try (FileOutputStream fileOut = new FileOutputStream(outputPath)) {
|
||||||
|
// byteArrayOutputStream.writeTo(fileOut);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// System.out.println("PDF文件已成功生成到: " + outputPath);
|
||||||
|
// System.out.println("生成的PDF大小: " + new File(outputPath).length() + " 字节");
|
||||||
|
//
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// e.printStackTrace();
|
||||||
|
// System.out.println("图纸管理 => 审核结束,向文件添加二维码失败");
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 固定的边距(点)
|
||||||
|
private static final float MARGIN = 10.0f;
|
||||||
|
// 二维码大小比例(页面宽高中较小值的20%)
|
||||||
|
private static final float QR_SIZE_RATIO = 0.2f;
|
||||||
|
|
||||||
|
// 二维码大小比例(页面宽高中较小值的20%)
|
||||||
|
private static final float QR_SIZE = 60.0f;
|
||||||
|
|
||||||
|
// 竖坐标
|
||||||
|
private static final float V_QR_X = 232.0f;
|
||||||
|
|
||||||
|
// 竖坐标
|
||||||
|
private static final float V_QR_Y = 679.5f;
|
||||||
|
|
||||||
|
// 横坐标
|
||||||
|
private static final float H_QR_X = 1116.5f;
|
||||||
|
|
||||||
|
// 横坐标
|
||||||
|
private static final float H_QR_Y = 34.0f;
|
||||||
|
|
||||||
public static ByteArrayOutputStream addQRCodeToPDFOnAllPages(String srcPdf, byte[] qrCodeBytes, boolean isChangeFile)
|
public static ByteArrayOutputStream addQRCodeToPDFOnAllPages(String srcPdf, byte[] qrCodeBytes, boolean isChangeFile)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
|
|
||||||
PdfReader reader;
|
PdfReader reader;
|
||||||
if (srcPdf.startsWith("http://") || srcPdf.startsWith("https://")) {
|
if (srcPdf.startsWith("http://") || srcPdf.startsWith("https://")) {
|
||||||
// 网络地址 PDF
|
|
||||||
URL url = new URL(srcPdf);
|
URL url = new URL(srcPdf);
|
||||||
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
|
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
|
||||||
connection.setConnectTimeout(10000);
|
connection.setConnectTimeout(10000);
|
||||||
@ -130,7 +257,6 @@ public class PdfBoxQrCodeGenerator {
|
|||||||
InputStream inputStream = connection.getInputStream();
|
InputStream inputStream = connection.getInputStream();
|
||||||
reader = new PdfReader(inputStream);
|
reader = new PdfReader(inputStream);
|
||||||
} else {
|
} else {
|
||||||
// 本地文件 PDF
|
|
||||||
File srcFile = new File(srcPdf);
|
File srcFile = new File(srcPdf);
|
||||||
if (!srcFile.exists()) {
|
if (!srcFile.exists()) {
|
||||||
throw new IOException("源PDF文件不存在: " + srcPdf);
|
throw new IOException("源PDF文件不存在: " + srcPdf);
|
||||||
@ -145,43 +271,51 @@ public class PdfBoxQrCodeGenerator {
|
|||||||
int numberOfPages = pdfDoc.getNumberOfPages();
|
int numberOfPages = pdfDoc.getNumberOfPages();
|
||||||
|
|
||||||
for (int pageNum = 1; pageNum <= numberOfPages; pageNum++) {
|
for (int pageNum = 1; pageNum <= numberOfPages; pageNum++) {
|
||||||
PdfPage page = pdfDoc.getPage(pageNum);
|
if (pageNum == 1 && isChangeFile) {
|
||||||
Rectangle pageSize = page.getPageSize();
|
continue;
|
||||||
|
|
||||||
float pageWidth = pageSize.getWidth();
|
|
||||||
float pageHeight = pageSize.getHeight();
|
|
||||||
|
|
||||||
float qrX, qrY;
|
|
||||||
float newWidth, newHeight;
|
|
||||||
|
|
||||||
if (isChangeFile && pageNum == 1) {
|
|
||||||
qrX = pageWidth - 143;
|
|
||||||
qrY = pageHeight - 213;
|
|
||||||
newWidth = 67;
|
|
||||||
newHeight = 80;
|
|
||||||
} else {
|
|
||||||
if (pageWidth > pageHeight) {
|
|
||||||
// 横版
|
|
||||||
qrX = pageWidth - 90;
|
|
||||||
qrY = 24;
|
|
||||||
newWidth = 67;
|
|
||||||
newHeight = 79;
|
|
||||||
} else {
|
|
||||||
// 竖版
|
|
||||||
qrX = 226;
|
|
||||||
qrY = pageHeight - 185;
|
|
||||||
newWidth = 69;
|
|
||||||
newHeight = 80;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PdfCanvas pdfCanvas = new PdfCanvas(page.newContentStreamAfter(), page.getResources(), pdfDoc);
|
PdfPage page = pdfDoc.getPage(pageNum);
|
||||||
try (Canvas canvas = new Canvas(pdfCanvas, page.getPageSize())) {
|
|
||||||
ImageData imageData = ImageDataFactory.create(qrCodeBytes);
|
// 获取页面的所有边界框信息
|
||||||
Image image = new Image(imageData)
|
Rectangle mediaBox = page.getMediaBox();
|
||||||
.scaleAbsolute(newWidth, newHeight)
|
Rectangle cropBox = page.getCropBox();
|
||||||
.setFixedPosition(qrX, qrY);
|
|
||||||
canvas.add(image);
|
// 使用CropBox作为主要参考,因为它定义了页面的可见区域
|
||||||
|
Rectangle visibleArea = (cropBox != null) ? cropBox : mediaBox;
|
||||||
|
|
||||||
|
// 计算页面宽高中较小的值
|
||||||
|
// float minDimension = Math.min(visibleArea.getWidth(), visibleArea.getHeight());
|
||||||
|
|
||||||
|
// 动态计算二维码大小(页面宽高中较小值的20%)
|
||||||
|
// float qrSize = minDimension * QR_SIZE_RATIO;
|
||||||
|
|
||||||
|
// 输出页面尺寸信息
|
||||||
|
// System.out.println("页面 " + pageNum + " 尺寸: " + visibleArea.getWidth() + "x" + visibleArea.getHeight());
|
||||||
|
// System.out.println("页面 " + pageNum + " 二维码大小 (点): " + qrSize);
|
||||||
|
|
||||||
|
// 计算左上角的位置(PDF坐标系:原点在左下角)
|
||||||
|
// float qrX = visibleArea.getLeft() + MARGIN;
|
||||||
|
// float qrY = visibleArea.getTop() - qrSize - MARGIN;
|
||||||
|
|
||||||
|
// 打印二维码位置信息
|
||||||
|
// System.out.println("页面 " + pageNum + " 左上角二维码位置: x=" + qrX + ", y=" + qrY);
|
||||||
|
float qrX;
|
||||||
|
float qrY;
|
||||||
|
if (visibleArea.getWidth() > visibleArea.getHeight()) {
|
||||||
|
qrX = H_QR_X;
|
||||||
|
qrY = H_QR_Y;
|
||||||
|
} else {
|
||||||
|
qrX = V_QR_X;
|
||||||
|
qrY = V_QR_Y;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
// 使用Canvas API添加左上角二维码
|
||||||
|
addQRCodeWithCanvas(pdfDoc, page, qrCodeBytes, qrX, qrY, QR_SIZE);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.err.println("在页面 " + pageNum + " 添加二维码时出错: " + e.getMessage());
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -189,32 +323,106 @@ public class PdfBoxQrCodeGenerator {
|
|||||||
return pdfOut;
|
return pdfOut;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 使用Canvas API添加图像
|
||||||
|
private static void addQRCodeWithCanvas(PdfDocument pdfDoc, PdfPage page,
|
||||||
|
byte[] qrCodeBytes, float x, float y, float size) throws IOException {
|
||||||
|
|
||||||
|
// 创建Canvas对象 - 使用PdfPage和Rectangle构造函数
|
||||||
|
Canvas canvas = new Canvas(page, page.getPageSize());
|
||||||
|
|
||||||
|
// 创建图像数据
|
||||||
|
ImageData imageData = ImageDataFactory.create(qrCodeBytes);
|
||||||
|
|
||||||
|
// 创建Image对象
|
||||||
|
Image image = new Image(imageData);
|
||||||
|
|
||||||
|
// 设置图像位置和大小
|
||||||
|
image.setFixedPosition(x, y);
|
||||||
|
image.setWidth(size);
|
||||||
|
image.setHeight(size);
|
||||||
|
|
||||||
|
// 添加图像到Canvas
|
||||||
|
canvas.add(image);
|
||||||
|
|
||||||
|
// 关闭Canvas
|
||||||
|
canvas.close();
|
||||||
|
|
||||||
|
System.out.println("Canvas方法设置位置: x=" + x + ", y=" + y);
|
||||||
|
}
|
||||||
|
|
||||||
|
// main方法示例
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|
||||||
String path = "C:\\Users\\YuanJie\\Desktop\\test.pdf";
|
String path = "C:\\Users\\YuanJie\\Desktop\\test.pdf";
|
||||||
String outputPath = "C:\\Users\\YuanJie\\Desktop\\test1.pdf";
|
String outputPath = "C:\\Users\\YuanJie\\Desktop\\test1.pdf";
|
||||||
|
|
||||||
String params = "http://192.168.110.151:7788/codeDetail?id=" + "1957649652924448769";
|
String params = "http://192.168.110.151:7788/codeDetail?id=" + "1957649652924448769";
|
||||||
byte[] bytes = PdfBoxQrCodeGenerator.generateQRCodeBytes(params);
|
BufferedImage image = QrCodeUtil.generate(params, 200, 200);
|
||||||
|
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||||
|
ImgUtil.write(image, ImgUtil.IMAGE_TYPE_PNG, out);
|
||||||
|
byte[] bytes = out.toByteArray();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
System.out.println("二维码字节大小: " + bytes.length + " 字节");
|
System.out.println("二维码字节大小: " + bytes.length + " 字节");
|
||||||
|
|
||||||
|
// 先保存二维码图片用于验证
|
||||||
|
try (FileOutputStream qrOut = new FileOutputStream("C:\\Users\\YuanJie\\Desktop\\qrcode.png")) {
|
||||||
|
qrOut.write(bytes);
|
||||||
|
System.out.println("二维码图片已保存到桌面,用于验证二维码是否生成正确");
|
||||||
|
}
|
||||||
|
|
||||||
// 在每一页添加二维码
|
// 在每一页添加二维码
|
||||||
ByteArrayOutputStream byteArrayOutputStream =
|
ByteArrayOutputStream byteArrayOutputStream = addQRCodeToPDFOnAllPages(path, bytes, false);
|
||||||
PdfBoxQrCodeGenerator.addQRCodeToPDFOnAllPages(path, bytes, false);
|
|
||||||
|
|
||||||
try (FileOutputStream fileOut = new FileOutputStream(outputPath)) {
|
try (FileOutputStream fileOut = new FileOutputStream(outputPath)) {
|
||||||
byteArrayOutputStream.writeTo(fileOut);
|
byteArrayOutputStream.writeTo(fileOut);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
File outputFile = new File(outputPath);
|
||||||
System.out.println("PDF文件已成功生成到: " + outputPath);
|
System.out.println("PDF文件已成功生成到: " + outputPath);
|
||||||
System.out.println("生成的PDF大小: " + new File(outputPath).length() + " 字节");
|
System.out.println("生成的PDF大小: " + outputFile.length() + " 字节");
|
||||||
|
|
||||||
|
if (outputFile.length() == new File(path).length()) {
|
||||||
|
System.out.println("警告:输出文件大小与原文件相同,可能二维码未正确添加");
|
||||||
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
System.out.println("图纸管理 => 审核结束,向文件添加二维码失败");
|
System.out.println("图纸管理 => 审核结束,向文件添加二维码失败");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -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. 验证人脸信息(无人脸时抛出异常)
|
||||||
|
@ -17,13 +17,20 @@ 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.projectteam.BusProjectTeamQueryReq;
|
||||||
|
import org.dromara.project.domain.dto.projectteammember.BusProjectTeamMemberCreateReq;
|
||||||
|
import org.dromara.project.domain.vo.project.BusProjectVo;
|
||||||
|
import org.dromara.project.domain.vo.projectteam.BusProjectTeamVo;
|
||||||
|
import org.dromara.project.service.IBusProjectService;
|
||||||
|
import org.dromara.project.service.IBusProjectTeamMemberService;
|
||||||
|
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;
|
||||||
|
|
||||||
@ -41,6 +48,12 @@ public class SubConstructionUserController extends BaseController {
|
|||||||
|
|
||||||
private final ISubConstructionUserService constructionUserService;
|
private final ISubConstructionUserService constructionUserService;
|
||||||
|
|
||||||
|
private final IBusProjectTeamService busProjectTeamService;
|
||||||
|
|
||||||
|
private final IBusProjectTeamMemberService busProjectTeamMemberService;
|
||||||
|
|
||||||
|
private final IBusProjectService projectService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询施工人员列表
|
* 查询施工人员列表
|
||||||
*/
|
*/
|
||||||
@ -190,4 +203,63 @@ public class SubConstructionUserController extends BaseController {
|
|||||||
@PathVariable Long[] ids) {
|
@PathVariable Long[] ids) {
|
||||||
return toAjax(constructionUserService.deleteWithValidByIds(List.of(ids), true));
|
return toAjax(constructionUserService.deleteWithValidByIds(List.of(ids), true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询项目班组列表
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("project:projectTeam:addTeam")
|
||||||
|
@GetMapping("/projectList")
|
||||||
|
public TableDataInfo<BusProjectVo> list(BusProjectQueryReq req, PageQuery pageQuery) {
|
||||||
|
return projectService.queryPageList(req, pageQuery);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询项目班组列表
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("project:projectTeam:addTeam")
|
||||||
|
@GetMapping("/teamList")
|
||||||
|
public TableDataInfo<BusProjectTeamVo> teamList(BusProjectTeamQueryReq req, PageQuery pageQuery) {
|
||||||
|
return busProjectTeamService.queryPageList(req, pageQuery);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加项目班组
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("project:projectTeam:addTeam")
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PostMapping("/addTeam")
|
||||||
|
public R<Long> add(@Validated(AddGroup.class) @RequestBody BusProjectTeamMemberCreateReq 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));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询施工人员列表
|
* 查询施工人员列表
|
||||||
*/
|
*/
|
||||||
@ -50,6 +60,18 @@ public class SubConstructionUserAppController {
|
|||||||
return R.ok(constructionUserService.getVo(constructionUser, false));
|
return R.ok(constructionUserService.getVo(constructionUser, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取当前登录用户实名信息
|
||||||
|
*/
|
||||||
|
@GetMapping("/isReal")
|
||||||
|
public R<SubConstructionUserVo> isReal() {
|
||||||
|
SubConstructionUser constructionUser = constructionUserService.lambdaQuery()
|
||||||
|
.eq(SubConstructionUser::getSysUserId, LoginHelper.getUserId())
|
||||||
|
.last("limit 1")
|
||||||
|
.one();
|
||||||
|
return R.ok(constructionUserService.getVo(constructionUser, false));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据用户id查询施工人员信息
|
* 根据用户id查询施工人员信息
|
||||||
*/
|
*/
|
||||||
@ -99,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));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 施工人员人脸比对
|
* 施工人员人脸比对
|
||||||
*/
|
*/
|
||||||
@ -108,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));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,20 +1,24 @@
|
|||||||
package org.dromara.contractor.controller.app;
|
package org.dromara.contractor.controller.app;
|
||||||
|
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
import org.dromara.common.core.domain.R;
|
import org.dromara.common.core.domain.R;
|
||||||
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;
|
||||||
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.TableDataInfo;
|
||||||
import org.dromara.common.web.core.BaseController;
|
import org.dromara.common.web.core.BaseController;
|
||||||
import org.dromara.contractor.domain.dto.salaryperiod.SubSalaryPeriodCreateReq;
|
import org.dromara.contractor.domain.dto.salaryperiod.SubSalaryPeriodCreateReq;
|
||||||
|
import org.dromara.contractor.domain.dto.salaryperiod.SubSalaryPeriodQueryReq;
|
||||||
|
import org.dromara.contractor.domain.vo.salaryperiod.SubSalaryPeriodVo;
|
||||||
import org.dromara.contractor.service.ISubSalaryPeriodService;
|
import org.dromara.contractor.service.ISubSalaryPeriodService;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* 工资结算周期 app 接口
|
||||||
|
*
|
||||||
* @author lilemy
|
* @author lilemy
|
||||||
* @date 2025-09-04 14:13
|
* @date 2025-09-04 14:13
|
||||||
*/
|
*/
|
||||||
@ -26,6 +30,25 @@ public class SubSalaryPeriodAppController extends BaseController {
|
|||||||
@Resource
|
@Resource
|
||||||
private ISubSalaryPeriodService salaryPeriodService;
|
private ISubSalaryPeriodService salaryPeriodService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询工资结算周期列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo<SubSalaryPeriodVo> list(SubSalaryPeriodQueryReq req, PageQuery pageQuery) {
|
||||||
|
return salaryPeriodService.queryPageList(req, pageQuery);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取工资结算周期详细信息
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
*/
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public R<SubSalaryPeriodVo> getInfo(@NotNull(message = "主键不能为空")
|
||||||
|
@PathVariable Long id) {
|
||||||
|
return R.ok(salaryPeriodService.queryById(id));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增工资结算周期
|
* 新增工资结算周期
|
||||||
*/
|
*/
|
||||||
|
@ -60,6 +60,11 @@ public class SubSalaryPeriod extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
private BigDecimal totalWage;
|
private BigDecimal totalWage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 总人数
|
||||||
|
*/
|
||||||
|
private Integer totalPeople;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 状态 0-未开始 1-进行中 2-已完成
|
* 状态 0-未开始 1-进行中 2-已完成
|
||||||
*/
|
*/
|
||||||
|
@ -95,4 +95,10 @@ public class SubConstructionUserQueryReq implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private String workStatus;
|
private String workStatus;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人
|
||||||
|
*/
|
||||||
|
private String userId;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
|
}
|
@ -289,4 +289,8 @@ public class SubConstructionUserVo implements Serializable {
|
|||||||
@ExcelProperty(value = "创建时间")
|
@ExcelProperty(value = "创建时间")
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户Id
|
||||||
|
*/
|
||||||
|
private Long sysUserId;
|
||||||
}
|
}
|
||||||
|
@ -4,12 +4,15 @@ 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.contractor.domain.SubSalaryPeriod;
|
import org.dromara.contractor.domain.SubSalaryPeriod;
|
||||||
|
|
||||||
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.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -44,6 +47,11 @@ public class SubSalaryPeriodVo implements Serializable {
|
|||||||
@ExcelProperty(value = "班组id")
|
@ExcelProperty(value = "班组id")
|
||||||
private Long teamId;
|
private Long teamId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 班组名称
|
||||||
|
*/
|
||||||
|
private String teamName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 开始日期
|
* 开始日期
|
||||||
*/
|
*/
|
||||||
@ -68,6 +76,11 @@ public class SubSalaryPeriodVo implements Serializable {
|
|||||||
@ExcelProperty(value = "总工资")
|
@ExcelProperty(value = "总工资")
|
||||||
private BigDecimal totalWage;
|
private BigDecimal totalWage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 总人数
|
||||||
|
*/
|
||||||
|
private Integer totalPeople;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 状态 0-未开始 1-进行中 2-已完成
|
* 状态 0-未开始 1-进行中 2-已完成
|
||||||
*/
|
*/
|
||||||
@ -80,4 +93,21 @@ public class SubSalaryPeriodVo implements Serializable {
|
|||||||
@ExcelProperty(value = "备注")
|
@ExcelProperty(value = "备注")
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "创建时间")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人
|
||||||
|
*/
|
||||||
|
private Long createBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人名称
|
||||||
|
*/
|
||||||
|
@Translation(type = TransConstant.USER_ID_TO_NICKNAME, mapper = "createBy")
|
||||||
|
private String createByName;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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();
|
||||||
|
@ -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());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,8 @@ import org.dromara.contractor.mapper.SubSalaryPeriodMapper;
|
|||||||
import org.dromara.contractor.service.ISubSalaryPeriodService;
|
import org.dromara.contractor.service.ISubSalaryPeriodService;
|
||||||
import org.dromara.contractor.service.ISubUserSalaryDetailService;
|
import org.dromara.contractor.service.ISubUserSalaryDetailService;
|
||||||
import org.dromara.contractor.service.ISubUserSalaryPeriodService;
|
import org.dromara.contractor.service.ISubUserSalaryPeriodService;
|
||||||
|
import org.dromara.project.domain.BusProjectTeam;
|
||||||
|
import org.dromara.project.service.IBusProjectTeamService;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
@ -28,10 +30,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.temporal.ChronoUnit;
|
import java.time.temporal.ChronoUnit;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -50,6 +49,9 @@ public class SubSalaryPeriodServiceImpl extends ServiceImpl<SubSalaryPeriodMappe
|
|||||||
@Resource
|
@Resource
|
||||||
private ISubUserSalaryPeriodService userSalaryPeriodService;
|
private ISubUserSalaryPeriodService userSalaryPeriodService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IBusProjectTeamService projectTeamService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询工资结算周期
|
* 查询工资结算周期
|
||||||
*
|
*
|
||||||
@ -128,6 +130,7 @@ public class SubSalaryPeriodServiceImpl extends ServiceImpl<SubSalaryPeriodMappe
|
|||||||
.le(SubUserSalaryDetail::getReportDate, endDate)
|
.le(SubUserSalaryDetail::getReportDate, endDate)
|
||||||
.list();
|
.list();
|
||||||
BigDecimal totalWage = BigDecimal.ZERO;
|
BigDecimal totalWage = BigDecimal.ZERO;
|
||||||
|
int totalPeople = 0;
|
||||||
List<SubUserSalaryPeriod> periodList = new ArrayList<>();
|
List<SubUserSalaryPeriod> periodList = new ArrayList<>();
|
||||||
if (CollUtil.isNotEmpty(detailList)) {
|
if (CollUtil.isNotEmpty(detailList)) {
|
||||||
Map<Long, List<SubUserSalaryDetail>> userDetailMap = detailList.stream()
|
Map<Long, List<SubUserSalaryDetail>> userDetailMap = detailList.stream()
|
||||||
@ -147,6 +150,7 @@ public class SubSalaryPeriodServiceImpl extends ServiceImpl<SubSalaryPeriodMappe
|
|||||||
// 汇总
|
// 汇总
|
||||||
totalWage = totalWage.add(total);
|
totalWage = totalWage.add(total);
|
||||||
periodList.add(period);
|
periodList.add(period);
|
||||||
|
totalPeople++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 封装新增数据
|
// 封装新增数据
|
||||||
@ -157,6 +161,7 @@ public class SubSalaryPeriodServiceImpl extends ServiceImpl<SubSalaryPeriodMappe
|
|||||||
salaryPeriod.setEndDate(endDate);
|
salaryPeriod.setEndDate(endDate);
|
||||||
salaryPeriod.setTotalDays(days);
|
salaryPeriod.setTotalDays(days);
|
||||||
salaryPeriod.setTotalWage(totalWage);
|
salaryPeriod.setTotalWage(totalWage);
|
||||||
|
salaryPeriod.setTotalPeople(totalPeople);
|
||||||
// 新增
|
// 新增
|
||||||
boolean save = this.save(salaryPeriod);
|
boolean save = this.save(salaryPeriod);
|
||||||
if (!save) {
|
if (!save) {
|
||||||
@ -187,6 +192,14 @@ public class SubSalaryPeriodServiceImpl extends ServiceImpl<SubSalaryPeriodMappe
|
|||||||
return salaryPeriodVo;
|
return salaryPeriodVo;
|
||||||
}
|
}
|
||||||
BeanUtils.copyProperties(salaryPeriod, salaryPeriodVo);
|
BeanUtils.copyProperties(salaryPeriod, salaryPeriodVo);
|
||||||
|
// 获取班组名称
|
||||||
|
Long teamId = salaryPeriod.getTeamId();
|
||||||
|
if (teamId != null) {
|
||||||
|
BusProjectTeam team = projectTeamService.getById(teamId);
|
||||||
|
if (team != null) {
|
||||||
|
salaryPeriodVo.setTeamName(team.getTeamName());
|
||||||
|
}
|
||||||
|
}
|
||||||
return salaryPeriodVo;
|
return salaryPeriodVo;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -238,9 +251,17 @@ public class SubSalaryPeriodServiceImpl extends ServiceImpl<SubSalaryPeriodMappe
|
|||||||
if (CollUtil.isEmpty(salaryPeriodList)) {
|
if (CollUtil.isEmpty(salaryPeriodList)) {
|
||||||
return salaryPeriodVoPage;
|
return salaryPeriodVoPage;
|
||||||
}
|
}
|
||||||
|
// 获取班组
|
||||||
|
Set<Long> teamIdList = salaryPeriodList.stream().map(SubSalaryPeriod::getTeamId).collect(Collectors.toSet());
|
||||||
|
List<BusProjectTeam> teamList = projectTeamService.listByIds(teamIdList);
|
||||||
|
Map<Long, BusProjectTeam> teamMap = teamList.stream().collect(Collectors.toMap(BusProjectTeam::getId, team -> team));
|
||||||
List<SubSalaryPeriodVo> salaryPeriodVoList = salaryPeriodList.stream().map(entity -> {
|
List<SubSalaryPeriodVo> salaryPeriodVoList = salaryPeriodList.stream().map(entity -> {
|
||||||
SubSalaryPeriodVo salaryPeriodVo = new SubSalaryPeriodVo();
|
SubSalaryPeriodVo salaryPeriodVo = new SubSalaryPeriodVo();
|
||||||
BeanUtils.copyProperties(entity, salaryPeriodVo);
|
BeanUtils.copyProperties(entity, salaryPeriodVo);
|
||||||
|
// 获取班组名称
|
||||||
|
if (teamMap.containsKey(entity.getTeamId())) {
|
||||||
|
salaryPeriodVo.setTeamName(teamMap.get(entity.getTeamId()).getTeamName());
|
||||||
|
}
|
||||||
return salaryPeriodVo;
|
return salaryPeriodVo;
|
||||||
}).toList();
|
}).toList();
|
||||||
salaryPeriodVoPage.setRecords(salaryPeriodVoList);
|
salaryPeriodVoPage.setRecords(salaryPeriodVoList);
|
||||||
|
@ -159,7 +159,7 @@ public class DesVolumeCatalogController extends BaseController {
|
|||||||
/**
|
/**
|
||||||
* 收资清单模板导出
|
* 收资清单模板导出
|
||||||
*/
|
*/
|
||||||
@SaCheckPermission("design:collect:exportExcel")
|
@SaCheckPermission("design:volumeCatalog:exportExcel")
|
||||||
@Log(title = "收资清单", businessType = BusinessType.EXPORT)
|
@Log(title = "收资清单", businessType = BusinessType.EXPORT)
|
||||||
@PostMapping("/exportExcel")
|
@PostMapping("/exportExcel")
|
||||||
public void exportExcelByProjectId(@RequestParam("projectId") Long projectId, HttpServletResponse response){
|
public void exportExcelByProjectId(@RequestParam("projectId") Long projectId, HttpServletResponse response){
|
||||||
@ -181,11 +181,14 @@ public class DesVolumeCatalogController extends BaseController {
|
|||||||
List<ExcelData> dataList = readExcel(file);
|
List<ExcelData> dataList = readExcel(file);
|
||||||
List<DesVolumeCatalogCreateReq> desVolumeCatalogCreateReqs = BeanUtil.copyToList(dataList, DesVolumeCatalogCreateReq.class);
|
List<DesVolumeCatalogCreateReq> desVolumeCatalogCreateReqs = BeanUtil.copyToList(dataList, DesVolumeCatalogCreateReq.class);
|
||||||
Collections.reverse(desVolumeCatalogCreateReqs);
|
Collections.reverse(desVolumeCatalogCreateReqs);
|
||||||
|
List<DesVolumeCatalogCreateReq> list = new ArrayList<>();
|
||||||
for (DesVolumeCatalogCreateReq desVolumeCatalogCreateReq : desVolumeCatalogCreateReqs) {
|
for (DesVolumeCatalogCreateReq desVolumeCatalogCreateReq : desVolumeCatalogCreateReqs) {
|
||||||
desVolumeCatalogCreateReq.setProjectId(projectId);
|
desVolumeCatalogCreateReq.setProjectId(projectId);
|
||||||
desVolumeCatalogCreateReq.setDesignState("2");
|
desVolumeCatalogCreateReq.setDesignState("2");
|
||||||
desVolumeCatalogService.insertByBo(desVolumeCatalogCreateReq);
|
list.add(desVolumeCatalogCreateReq);
|
||||||
|
// desVolumeCatalogService.insertByBo(desVolumeCatalogCreateReq);
|
||||||
}
|
}
|
||||||
|
desVolumeCatalogService.insertBatchByBo(list);
|
||||||
return toAjax(true);
|
return toAjax(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -235,17 +238,18 @@ public class DesVolumeCatalogController extends BaseController {
|
|||||||
// 从第二行(index=1)开始读取数据,跳过表头
|
// 从第二行(index=1)开始读取数据,跳过表头
|
||||||
for (int rowIndex = 1; rowIndex <= sheet.getLastRowNum(); rowIndex++) {
|
for (int rowIndex = 1; rowIndex <= sheet.getLastRowNum(); rowIndex++) {
|
||||||
Row row = sheet.getRow(rowIndex);
|
Row row = sheet.getRow(rowIndex);
|
||||||
if (row != null) {
|
if (hasValidData(row)) {
|
||||||
String designSubitem = getCellValue(row.getCell(0));
|
String designSubitem = getCellValue(row.getCell(0));
|
||||||
// String designState = getCellValue(row.getCell(1));
|
String specialty = getCellValue(row.getCell(1));
|
||||||
// String specialty = getCellValue(row.getCell(2));
|
String specialtyId = getCellValue(row.getCell(2));
|
||||||
// String principal = getCellValue(row.getCell(3));
|
String principal = getCellValue(row.getCell(3));
|
||||||
String volumeNumber = getCellValue(row.getCell(1));
|
String principalId = getCellValue(row.getCell(4));
|
||||||
String documentName = getCellValue(row.getCell(2));
|
String volumeNumber = getCellValue(row.getCell(5));
|
||||||
LocalDate plannedCompletion = getLocalDateValue(row.getCell(3));
|
String documentName = getCellValue(row.getCell(6));
|
||||||
|
LocalDate plannedCompletion = getLocalDateValue(row.getCell(7));
|
||||||
|
|
||||||
ExcelData excelData = new ExcelData(
|
ExcelData excelData = new ExcelData(
|
||||||
designSubitem, volumeNumber, documentName,
|
designSubitem,specialtyId,principalId, volumeNumber, documentName,
|
||||||
plannedCompletion
|
plannedCompletion
|
||||||
);
|
);
|
||||||
dataList.add(excelData);
|
dataList.add(excelData);
|
||||||
@ -255,6 +259,19 @@ public class DesVolumeCatalogController extends BaseController {
|
|||||||
|
|
||||||
return dataList;
|
return dataList;
|
||||||
}
|
}
|
||||||
|
private static boolean hasValidData(Row row) {
|
||||||
|
// 遍历行中的所有单元格
|
||||||
|
for (int cellIndex = 0; cellIndex < row.getLastCellNum(); cellIndex++) {
|
||||||
|
Cell cell = row.getCell(cellIndex, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK);
|
||||||
|
String cellValue = getCellValue(cell).trim();
|
||||||
|
|
||||||
|
// 只要有一个单元格有非空值,就认为是有效行
|
||||||
|
if (!cellValue.isEmpty()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
private static String getCellValue(Cell cell) {
|
private static String getCellValue(Cell cell) {
|
||||||
if (cell == null) {
|
if (cell == null) {
|
||||||
|
@ -40,6 +40,11 @@ public class BusBillofquantitiesVersions extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
private String versions;
|
private String versions;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 版本号名称
|
||||||
|
*/
|
||||||
|
private String versionsName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* exlce文件
|
* exlce文件
|
||||||
*/
|
*/
|
||||||
|
@ -29,6 +29,11 @@ public class DesVolumeCatalog extends BaseEntity {
|
|||||||
@TableId(value = "design")
|
@TableId(value = "design")
|
||||||
private Long design;
|
private Long design;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 序号
|
||||||
|
*/
|
||||||
|
private Long serialNumber;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 项目ID
|
* 项目ID
|
||||||
*/
|
*/
|
||||||
|
@ -39,4 +39,11 @@ public class BusBillofquantitiesVersionsBo extends BaseEntity {
|
|||||||
private String versions;
|
private String versions;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 版本号名称
|
||||||
|
*/
|
||||||
|
private String versionsName;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package org.dromara.design.domain.dto;
|
package org.dromara.design.domain.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -7,34 +9,37 @@ import java.time.LocalDate;
|
|||||||
* @Date 2025/8/12 22:53
|
* @Date 2025/8/12 22:53
|
||||||
* @Version 1.0
|
* @Version 1.0
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
public class ExcelData {
|
public class ExcelData {
|
||||||
private String designSubitem;
|
private String designSubitem;
|
||||||
// private String designState;
|
private String specialty;
|
||||||
// private String specialty;
|
// private String specialtyId;
|
||||||
// private String principal;
|
private String principal;
|
||||||
|
// private Long principalId;
|
||||||
private String volumeNumber;
|
private String volumeNumber;
|
||||||
private String documentName;
|
private String documentName;
|
||||||
private LocalDate plannedCompletion;
|
private LocalDate plannedCompletion;
|
||||||
|
|
||||||
// 构造函数
|
// 构造函数
|
||||||
public ExcelData(String designSubitem, String volumeNumber, String documentName, LocalDate plannedCompletion) {
|
public ExcelData(String designSubitem, String specialty, String principal, String volumeNumber, String documentName, LocalDate plannedCompletion) {
|
||||||
this.designSubitem = designSubitem;
|
this.designSubitem = designSubitem;
|
||||||
// this.designState = designState;
|
this.specialty = specialty;
|
||||||
// this.specialty = specialty;
|
// this.specialtyId = specialtyId;
|
||||||
// this.principal = principal;
|
this.principal = principal;
|
||||||
|
// this.principalId = principalId;
|
||||||
this.volumeNumber = volumeNumber;
|
this.volumeNumber = volumeNumber;
|
||||||
this.documentName = documentName;
|
this.documentName = documentName;
|
||||||
this.plannedCompletion = plannedCompletion;
|
this.plannedCompletion = plannedCompletion;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Getter和Setter方法
|
// Getter和Setter方法
|
||||||
public String getDesignSubitem() {
|
// public String getDesignSubitem() {
|
||||||
return designSubitem;
|
// return designSubitem;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public void setDesignSubitem(String designSubitem) {
|
// public void setDesignSubitem(String designSubitem) {
|
||||||
this.designSubitem = designSubitem;
|
// this.designSubitem = designSubitem;
|
||||||
}
|
// }
|
||||||
|
|
||||||
// public String getDesignState() {
|
// public String getDesignState() {
|
||||||
// return designState;
|
// return designState;
|
||||||
@ -60,27 +65,27 @@ public class ExcelData {
|
|||||||
// this.principal = principal;
|
// this.principal = principal;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
public String getVolumeNumber() {
|
// public String getVolumeNumber() {
|
||||||
return volumeNumber;
|
// return volumeNumber;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public void setVolumeNumber(String volumeNumber) {
|
// public void setVolumeNumber(String volumeNumber) {
|
||||||
this.volumeNumber = volumeNumber;
|
// this.volumeNumber = volumeNumber;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public String getDocumentName() {
|
// public String getDocumentName() {
|
||||||
return documentName;
|
// return documentName;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public void setDocumentName(String documentName) {
|
// public void setDocumentName(String documentName) {
|
||||||
this.documentName = documentName;
|
// this.documentName = documentName;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public LocalDate getPlannedCompletion() {
|
// public LocalDate getPlannedCompletion() {
|
||||||
return plannedCompletion;
|
// return plannedCompletion;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public void setPlannedCompletion(LocalDate plannedCompletion) {
|
// public void setPlannedCompletion(LocalDate plannedCompletion) {
|
||||||
this.plannedCompletion = plannedCompletion;
|
// this.plannedCompletion = plannedCompletion;
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
@ -40,4 +40,7 @@ public class DesVolumeCatalogQueryReq implements Serializable {
|
|||||||
|
|
||||||
private String type;
|
private String type;
|
||||||
|
|
||||||
|
|
||||||
|
private String isUpload;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -48,6 +48,13 @@ public class BusBillofquantitiesVersionsVo implements Serializable {
|
|||||||
private String versions;
|
private String versions;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 版本号名称
|
||||||
|
*/
|
||||||
|
private String versionsName;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Excel文件
|
* Excel文件
|
||||||
*/
|
*/
|
||||||
|
@ -34,6 +34,11 @@ public class DesVolumeCatalogVo implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private Long design;
|
private Long design;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 序号
|
||||||
|
*/
|
||||||
|
private Long serialNumber;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 项目ID
|
* 项目ID
|
||||||
*/
|
*/
|
||||||
@ -124,4 +129,9 @@ public class DesVolumeCatalogVo implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private String opinion;
|
private String opinion;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件数量
|
||||||
|
*/
|
||||||
|
private Long fileCount;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,8 @@ import org.dromara.design.domain.DesVolumeFile;
|
|||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -80,4 +82,7 @@ public class DesVolumeFileCodeVo implements Serializable {
|
|||||||
* 是否最新
|
* 是否最新
|
||||||
*/
|
*/
|
||||||
private Boolean isLatest;
|
private Boolean isLatest;
|
||||||
|
|
||||||
|
|
||||||
|
private Date createTime;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package org.dromara.design.service;
|
package org.dromara.design.service;
|
||||||
|
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
import org.dromara.design.domain.dto.desUser.DesUserBatchDto;
|
import org.dromara.design.domain.dto.desUser.DesUserBatchDto;
|
||||||
import org.dromara.design.domain.vo.DesUserVo;
|
import org.dromara.design.domain.vo.DesUserVo;
|
||||||
import org.dromara.design.domain.bo.DesUserBo;
|
import org.dromara.design.domain.bo.DesUserBo;
|
||||||
@ -8,10 +9,10 @@ import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|||||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设计人员Service接口
|
* 设计人员Service接口
|
||||||
@ -84,4 +85,15 @@ public interface IDesUserService extends IService<DesUser>{
|
|||||||
* 查询用户对应专业
|
* 查询用户对应专业
|
||||||
*/
|
*/
|
||||||
List<String> selectUserMajors(Long userId);
|
List<String> selectUserMajors(Long userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询专业和专业名
|
||||||
|
* @param desUserBo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Map<String, String> getUserMajor(DesUserBo desUserBo);
|
||||||
|
|
||||||
|
Map<String, String> getUserList(DesUserBo desUserBo);
|
||||||
|
|
||||||
|
Long getCount(String principal, String specialty, Long projectId);
|
||||||
}
|
}
|
||||||
|
@ -122,4 +122,6 @@ public interface IDesVolumeCatalogService extends IService<DesVolumeCatalog> {
|
|||||||
List<DesVolumeCatalogVo> catalogList(Long projectId);
|
List<DesVolumeCatalogVo> catalogList(Long projectId);
|
||||||
|
|
||||||
void exportExcelByProjectId(Long projectId, HttpServletResponse response);
|
void exportExcelByProjectId(Long projectId, HttpServletResponse response);
|
||||||
|
|
||||||
|
void insertBatchByBo(List<DesVolumeCatalogCreateReq> list);
|
||||||
}
|
}
|
||||||
|
@ -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()));
|
||||||
|
@ -649,7 +649,8 @@ public class DesDesignChangeServiceImpl extends ServiceImpl<DesDesignChangeMappe
|
|||||||
|
|
||||||
//查询蓝图最大版本号
|
//查询蓝图最大版本号
|
||||||
List<DesVolumeFile> list = volumeFileService.list(Wrappers.lambdaQuery(DesVolumeFile.class)
|
List<DesVolumeFile> list = volumeFileService.list(Wrappers.lambdaQuery(DesVolumeFile.class)
|
||||||
.eq(DesVolumeFile::getType, DesVolumeFile.BLUEPRINT)
|
.in(DesVolumeFile::getType, Arrays.asList(DesVolumeFile.BLUEPRINT, DesVolumeFile.WASTE))
|
||||||
|
.eq(DesVolumeFile::getVolumeCatalogId, volumeCatalog.getDesign())
|
||||||
.orderByDesc(DesVolumeFile::getVersion)
|
.orderByDesc(DesVolumeFile::getVersion)
|
||||||
);
|
);
|
||||||
String version = "1.0";
|
String version = "1.0";
|
||||||
|
@ -48,6 +48,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.FileNameMap;
|
import java.net.FileNameMap;
|
||||||
import java.net.URLConnection;
|
import java.net.URLConnection;
|
||||||
@ -446,6 +447,11 @@ public class DesDrawingServiceImpl extends ServiceImpl<DesDrawingMapper, DesDraw
|
|||||||
byte[] bytes = PdfBoxQrCodeGenerator.generateQRCodeBytes(params);
|
byte[] bytes = PdfBoxQrCodeGenerator.generateQRCodeBytes(params);
|
||||||
try {
|
try {
|
||||||
ByteArrayOutputStream baos = PdfBoxQrCodeGenerator.addQRCodeToPDFOnAllPages(ossVo.getUrl(), bytes,isChangeFile);
|
ByteArrayOutputStream baos = PdfBoxQrCodeGenerator.addQRCodeToPDFOnAllPages(ossVo.getUrl(), bytes,isChangeFile);
|
||||||
|
|
||||||
|
try (FileOutputStream fileOut = new FileOutputStream("C:\\Users\\YuanJie\\Desktop\\test1.pdf")) {
|
||||||
|
baos.writeTo(fileOut);
|
||||||
|
}
|
||||||
|
|
||||||
FileNameMap fileNameMap = URLConnection.getFileNameMap();
|
FileNameMap fileNameMap = URLConnection.getFileNameMap();
|
||||||
String originalName = ossVo.getOriginalName();
|
String originalName = ossVo.getOriginalName();
|
||||||
String contentType = fileNameMap.getContentTypeFor(originalName);
|
String contentType = fileNameMap.getContentTypeFor(originalName);
|
||||||
|
@ -10,6 +10,8 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.dromara.design.domain.dto.desUser.DesUserBatchDto;
|
import org.dromara.design.domain.dto.desUser.DesUserBatchDto;
|
||||||
|
import org.dromara.system.domain.vo.SysDictDataVo;
|
||||||
|
import org.dromara.system.service.ISysDictDataService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.dromara.design.domain.bo.DesUserBo;
|
import org.dromara.design.domain.bo.DesUserBo;
|
||||||
import org.dromara.design.domain.vo.DesUserVo;
|
import org.dromara.design.domain.vo.DesUserVo;
|
||||||
@ -17,9 +19,8 @@ import org.dromara.design.domain.DesUser;
|
|||||||
import org.dromara.design.mapper.DesUserMapper;
|
import org.dromara.design.mapper.DesUserMapper;
|
||||||
import org.dromara.design.service.IDesUserService;
|
import org.dromara.design.service.IDesUserService;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.*;
|
||||||
import java.util.Map;
|
import java.util.stream.Collectors;
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设计人员Service业务层处理
|
* 设计人员Service业务层处理
|
||||||
@ -33,6 +34,8 @@ public class DesUserServiceImpl extends ServiceImpl<DesUserMapper, DesUser> impl
|
|||||||
|
|
||||||
private final DesUserMapper baseMapper;
|
private final DesUserMapper baseMapper;
|
||||||
|
|
||||||
|
private final ISysDictDataService sysDictDataService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询设计人员
|
* 查询设计人员
|
||||||
*
|
*
|
||||||
@ -146,4 +149,41 @@ public class DesUserServiceImpl extends ServiceImpl<DesUserMapper, DesUser> impl
|
|||||||
public List<String> selectUserMajors(Long userId){
|
public List<String> selectUserMajors(Long userId){
|
||||||
return baseMapper.selectUserMajors(userId);
|
return baseMapper.selectUserMajors(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, String> getUserMajor(DesUserBo desUserBo) {
|
||||||
|
List<DesUserVo> desUserVos = baseMapper.selectVoList(new LambdaQueryWrapper<DesUser>()
|
||||||
|
.eq(DesUser::getProjectId, desUserBo.getProjectId())
|
||||||
|
.groupBy(DesUser::getUserMajor));
|
||||||
|
List<SysDictDataVo> list = sysDictDataService.selectByDictType("des_user_major");
|
||||||
|
Map<String, String> dictMap = list.stream().filter(Objects::nonNull).collect(Collectors
|
||||||
|
.toMap(SysDictDataVo::getDictValue, SysDictDataVo::getDictLabel, (existing, existing1) -> existing));
|
||||||
|
Map<String, String> map = new HashMap<>();
|
||||||
|
for (DesUserVo desUserVo : desUserVos) {
|
||||||
|
if (desUserVo !=null){
|
||||||
|
map.put(desUserVo.getUserMajor(), dictMap.get(desUserVo.getUserMajor()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, String> getUserList(DesUserBo desUserBo) {
|
||||||
|
List<DesUserVo> desUserVos = baseMapper.selectVoList(new LambdaQueryWrapper<DesUser>()
|
||||||
|
.eq(DesUser::getProjectId, desUserBo.getProjectId())
|
||||||
|
.groupBy(DesUser::getUserId));
|
||||||
|
Map<String, String> map = new HashMap<>();
|
||||||
|
for (DesUserVo desUserVo : desUserVos) {
|
||||||
|
map.put(desUserVo.getUserId().toString(), desUserVo.getUserName());
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long getCount(String principal, String specialty, Long projectId) {
|
||||||
|
return baseMapper.selectCount(new LambdaQueryWrapper<DesUser>()
|
||||||
|
.eq(DesUser::getProjectId, projectId)
|
||||||
|
.eq(DesUser::getUserId, Long.valueOf(principal))
|
||||||
|
.eq(DesUser::getUserMajor, specialty));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,9 +11,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.apache.poi.ss.usermodel.*;
|
import org.apache.poi.ss.usermodel.*;
|
||||||
import org.apache.poi.ss.util.CellRangeAddressList;
|
import org.apache.poi.ss.util.CellRangeAddressList;
|
||||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||||
import org.dromara.cailiaoshebei.domain.BusCailiaoshebeiPici;
|
|
||||||
import org.dromara.common.core.constant.HttpStatus;
|
import org.dromara.common.core.constant.HttpStatus;
|
||||||
import org.dromara.common.core.domain.R;
|
|
||||||
import org.dromara.common.core.domain.event.ProcessDeleteEvent;
|
import org.dromara.common.core.domain.event.ProcessDeleteEvent;
|
||||||
import org.dromara.common.core.domain.event.ProcessEvent;
|
import org.dromara.common.core.domain.event.ProcessEvent;
|
||||||
import org.dromara.common.core.domain.event.ProcessTaskEvent;
|
import org.dromara.common.core.domain.event.ProcessTaskEvent;
|
||||||
@ -23,18 +21,17 @@ import org.dromara.common.core.utils.ObjectUtils;
|
|||||||
import org.dromara.common.core.utils.StringUtils;
|
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.redis.utils.RedisUtils;
|
||||||
import org.dromara.common.satoken.utils.LoginHelper;
|
import org.dromara.common.satoken.utils.LoginHelper;
|
||||||
import org.dromara.design.domain.*;
|
import org.dromara.design.domain.*;
|
||||||
import org.dromara.design.domain.bo.DesUserBo;
|
import org.dromara.design.domain.bo.DesUserBo;
|
||||||
import org.dromara.design.domain.dto.volumecatalog.DesVolumeCatalogCreateReq;
|
import org.dromara.design.domain.dto.volumecatalog.DesVolumeCatalogCreateReq;
|
||||||
import org.dromara.design.domain.dto.volumecatalog.DesVolumeCatalogQueryReq;
|
import org.dromara.design.domain.dto.volumecatalog.DesVolumeCatalogQueryReq;
|
||||||
import org.dromara.design.domain.dto.volumecatalog.DesVolumeCatalogUpdateReq;
|
import org.dromara.design.domain.dto.volumecatalog.DesVolumeCatalogUpdateReq;
|
||||||
import org.dromara.design.domain.vo.DesUserVo;
|
|
||||||
import org.dromara.design.domain.vo.volumecatalog.DesVolumeCatalogVo;
|
import org.dromara.design.domain.vo.volumecatalog.DesVolumeCatalogVo;
|
||||||
import org.dromara.design.mapper.DesVolumeCatalogMapper;
|
import org.dromara.design.mapper.DesVolumeCatalogMapper;
|
||||||
import org.dromara.design.service.*;
|
import org.dromara.design.service.*;
|
||||||
import org.dromara.project.service.IBusProjectService;
|
import org.dromara.project.service.IBusProjectService;
|
||||||
import org.dromara.system.domain.SysUser;
|
|
||||||
import org.dromara.system.domain.vo.SysUserVo;
|
import org.dromara.system.domain.vo.SysUserVo;
|
||||||
import org.dromara.system.service.ISysUserService;
|
import org.dromara.system.service.ISysUserService;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
@ -92,12 +89,12 @@ public class DesVolumeCatalogServiceImpl extends ServiceImpl<DesVolumeCatalogMap
|
|||||||
* @return 卷册目录
|
* @return 卷册目录
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public DesVolumeCatalogVo queryById(Long id,String type) {
|
public DesVolumeCatalogVo queryById(Long id, String type) {
|
||||||
DesVolumeCatalog volumeCatalog = this.getById(id);
|
DesVolumeCatalog volumeCatalog = this.getById(id);
|
||||||
if (volumeCatalog == null) {
|
if (volumeCatalog == null) {
|
||||||
throw new ServiceException("卷册目录信息不存在", HttpStatus.NOT_FOUND);
|
throw new ServiceException("卷册目录信息不存在", HttpStatus.NOT_FOUND);
|
||||||
}
|
}
|
||||||
return this.getVo(volumeCatalog,type);
|
return this.getVo(volumeCatalog, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -121,7 +118,7 @@ public class DesVolumeCatalogServiceImpl extends ServiceImpl<DesVolumeCatalogMap
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<DesVolumeCatalogVo> queryList(DesVolumeCatalogQueryReq req) {
|
public List<DesVolumeCatalogVo> queryList(DesVolumeCatalogQueryReq req) {
|
||||||
return this.list(this.buildQueryWrapper(req)).stream().map(vo-> this.getVo(vo,req.getType())).toList();
|
return this.list(this.buildQueryWrapper(req)).stream().map(vo -> this.getVo(vo, req.getType())).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -131,10 +128,10 @@ public class DesVolumeCatalogServiceImpl extends ServiceImpl<DesVolumeCatalogMap
|
|||||||
* @return 卷册目录文件列表
|
* @return 卷册目录文件列表
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<DesVolumeFile> queryFileListById(Long id,String type) {
|
public List<DesVolumeFile> queryFileListById(Long id, String type) {
|
||||||
return volumeFileService.lambdaQuery()
|
return volumeFileService.lambdaQuery()
|
||||||
.eq(DesVolumeFile::getVolumeCatalogId, id)
|
.eq(DesVolumeFile::getVolumeCatalogId, id)
|
||||||
.eq(StringUtils.isNotBlank(type),DesVolumeFile::getType, type)
|
.eq(StringUtils.isNotBlank(type), DesVolumeFile::getType, type)
|
||||||
.orderByAsc(DesVolumeFile::getStatus)
|
.orderByAsc(DesVolumeFile::getStatus)
|
||||||
.orderByDesc(DesVolumeFile::getCreateDept)
|
.orderByDesc(DesVolumeFile::getCreateDept)
|
||||||
.list();
|
.list();
|
||||||
@ -148,6 +145,11 @@ public class DesVolumeCatalogServiceImpl extends ServiceImpl<DesVolumeCatalogMap
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Boolean insertByBo(DesVolumeCatalogCreateReq req) {
|
public Boolean insertByBo(DesVolumeCatalogCreateReq req) {
|
||||||
|
Object object = RedisUtils.getCacheObject("DesVolumeCatalog:serialNumber");
|
||||||
|
long serialNumber = 0L;
|
||||||
|
if (ObjectUtils.isNotEmpty(object)) {
|
||||||
|
serialNumber = ((Integer) object).longValue();
|
||||||
|
}
|
||||||
Long projectId = req.getProjectId();
|
Long projectId = req.getProjectId();
|
||||||
if (projectService.getById(projectId) == null) {
|
if (projectService.getById(projectId) == null) {
|
||||||
throw new ServiceException("对应项目不存在", HttpStatus.NOT_FOUND);
|
throw new ServiceException("对应项目不存在", HttpStatus.NOT_FOUND);
|
||||||
@ -163,15 +165,61 @@ public class DesVolumeCatalogServiceImpl extends ServiceImpl<DesVolumeCatalogMap
|
|||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
throw new ServiceException("卷册目录已存在", HttpStatus.BAD_REQUEST);
|
throw new ServiceException("卷册目录已存在", HttpStatus.BAD_REQUEST);
|
||||||
}
|
}
|
||||||
|
long count1 = desUserService.count(new LambdaQueryWrapper<DesUser>()
|
||||||
|
.eq(DesUser::getUserMajor, req.getSpecialty())
|
||||||
|
.eq(DesUser::getUserId, req.getPrincipal()));
|
||||||
|
if (count1 == 0) {
|
||||||
|
throw new ServiceException("所选专业不包含该人员");
|
||||||
|
}
|
||||||
DesVolumeCatalog volumeCatalog = new DesVolumeCatalog();
|
DesVolumeCatalog volumeCatalog = new DesVolumeCatalog();
|
||||||
BeanUtils.copyProperties(req, volumeCatalog);
|
BeanUtils.copyProperties(req, volumeCatalog);
|
||||||
|
volumeCatalog.setSerialNumber(serialNumber);
|
||||||
boolean save = this.save(volumeCatalog);
|
boolean save = this.save(volumeCatalog);
|
||||||
if (!save) {
|
if (!save) {
|
||||||
|
RedisUtils.setCacheObject("DesVolumeCatalog:serialNumber", serialNumber);
|
||||||
throw new ServiceException("卷册目录新增失败", HttpStatus.ERROR);
|
throw new ServiceException("卷册目录新增失败", HttpStatus.ERROR);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void insertBatchByBo(List<DesVolumeCatalogCreateReq> list) {
|
||||||
|
Object object = RedisUtils.getCacheObject("DesVolumeCatalog:serialNumber");
|
||||||
|
long serialNumber = 0L;
|
||||||
|
if (ObjectUtils.isNotEmpty(object)) {
|
||||||
|
serialNumber = ((Integer) object).longValue();
|
||||||
|
}
|
||||||
|
List<DesVolumeCatalog> desVolumeCatalogs = new ArrayList<>();
|
||||||
|
for (DesVolumeCatalogCreateReq req : list) {
|
||||||
|
Long projectId = req.getProjectId();
|
||||||
|
if (projectService.getById(projectId) == null) {
|
||||||
|
throw new ServiceException("对应项目不存在", HttpStatus.NOT_FOUND);
|
||||||
|
}
|
||||||
|
// 判断是否重名
|
||||||
|
Long count = this.lambdaQuery()
|
||||||
|
.eq(DesVolumeCatalog::getProjectId, projectId)
|
||||||
|
.and(lqw -> lqw
|
||||||
|
.eq(DesVolumeCatalog::getVolumeNumber, req.getVolumeNumber())
|
||||||
|
.or()
|
||||||
|
.eq(DesVolumeCatalog::getDocumentName, req.getDocumentName()))
|
||||||
|
.count();
|
||||||
|
if (count > 0) {
|
||||||
|
throw new ServiceException("卷册目录已存在", HttpStatus.BAD_REQUEST);
|
||||||
|
}
|
||||||
|
Long count1 = desUserService.getCount(req.getPrincipal(), req.getSpecialty(), req.getProjectId());
|
||||||
|
if (count1 == 0) {
|
||||||
|
throw new ServiceException("所选专业不包含该人员");
|
||||||
|
}
|
||||||
|
DesVolumeCatalog volumeCatalog = new DesVolumeCatalog();
|
||||||
|
BeanUtils.copyProperties(req, volumeCatalog);
|
||||||
|
volumeCatalog.setSerialNumber(serialNumber++);
|
||||||
|
desVolumeCatalogs.add(volumeCatalog);
|
||||||
|
}
|
||||||
|
baseMapper.insertBatch(desVolumeCatalogs);
|
||||||
|
RedisUtils.setCacheObject("DesVolumeCatalog:serialNumber", serialNumber);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改卷册目录
|
* 修改卷册目录
|
||||||
*
|
*
|
||||||
@ -240,14 +288,14 @@ public class DesVolumeCatalogServiceImpl extends ServiceImpl<DesVolumeCatalogMap
|
|||||||
* @return 卷册目录封装对象
|
* @return 卷册目录封装对象
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public DesVolumeCatalogVo getVo(DesVolumeCatalog volumeCatalog,String type) {
|
public DesVolumeCatalogVo getVo(DesVolumeCatalog volumeCatalog, String type) {
|
||||||
DesVolumeCatalogVo vo = new DesVolumeCatalogVo();
|
DesVolumeCatalogVo vo = new DesVolumeCatalogVo();
|
||||||
if (volumeCatalog == null) {
|
if (volumeCatalog == null) {
|
||||||
return vo;
|
return vo;
|
||||||
}
|
}
|
||||||
BeanUtils.copyProperties(volumeCatalog, vo);
|
BeanUtils.copyProperties(volumeCatalog, vo);
|
||||||
// 关联文件信息
|
// 关联文件信息
|
||||||
List<DesVolumeFile> volumeFiles = this.queryFileListById(volumeCatalog.getDesign(),type);
|
List<DesVolumeFile> volumeFiles = this.queryFileListById(volumeCatalog.getDesign(), type);
|
||||||
vo.setFileVoList(volumeFileService.getVoList(volumeFiles));
|
vo.setFileVoList(volumeFileService.getVoList(volumeFiles));
|
||||||
// 关联查阅人信息
|
// 关联查阅人信息
|
||||||
List<DesVolumeFileViewer> allViewerList = volumeFileViewerService.lambdaQuery()
|
List<DesVolumeFileViewer> allViewerList = volumeFileViewerService.lambdaQuery()
|
||||||
@ -286,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();
|
||||||
lqw.orderByDesc(DesVolumeCatalog::getCreateTime);
|
String isUpload = req.getIsUpload();
|
||||||
lqw.orderByAsc(DesVolumeCatalog::getVolumeNumber);
|
// lqw.orderByDesc(DesVolumeCatalog::getCreateTime);
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -311,7 +364,21 @@ public class DesVolumeCatalogServiceImpl extends ServiceImpl<DesVolumeCatalogMap
|
|||||||
if (CollUtil.isEmpty(volumeCatalogList)) {
|
if (CollUtil.isEmpty(volumeCatalogList)) {
|
||||||
return volumeCatalogVoPage;
|
return volumeCatalogVoPage;
|
||||||
}
|
}
|
||||||
List<DesVolumeCatalogVo> volumeCatalogVoList = volumeCatalogList.stream().map(vo-> getVo(vo,null)).toList();
|
List<DesVolumeCatalogVo> volumeCatalogVoList = volumeCatalogList.stream().map(vo -> getVo(vo, null)).toList();
|
||||||
|
|
||||||
|
// 查询文件数量
|
||||||
|
LambdaQueryWrapper<DesVolumeFile> fileQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
for (DesVolumeCatalogVo desVolumeCatalogVo : volumeCatalogVoList) {
|
||||||
|
fileQueryWrapper.clear();
|
||||||
|
fileQueryWrapper.eq(DesVolumeFile::getVolumeCatalogId, desVolumeCatalogVo.getDesign());
|
||||||
|
List<DesVolumeFile> list = volumeFileService.list(fileQueryWrapper);
|
||||||
|
if (list != null && !list.isEmpty()) {
|
||||||
|
desVolumeCatalogVo.setFileCount((long) list.size());
|
||||||
|
} else {
|
||||||
|
desVolumeCatalogVo.setFileCount(0L);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
return volumeCatalogVoPage.setRecords(volumeCatalogVoList);
|
return volumeCatalogVoPage.setRecords(volumeCatalogVoList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -352,12 +419,12 @@ public class DesVolumeCatalogServiceImpl extends ServiceImpl<DesVolumeCatalogMap
|
|||||||
.orderByDesc(DesVolumeFile::getCreateTime)
|
.orderByDesc(DesVolumeFile::getCreateTime)
|
||||||
|
|
||||||
);
|
);
|
||||||
if(list.isEmpty()){
|
if (list.isEmpty()) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
List<Long> list1 = list.stream().map(DesVolumeFile::getVolumeCatalogId).distinct().toList();
|
List<Long> list1 = list.stream().map(DesVolumeFile::getVolumeCatalogId).distinct().toList();
|
||||||
|
|
||||||
return baseMapper.selectVoList(Wrappers.lambdaQuery(DesVolumeCatalog.class)
|
return baseMapper.selectVoList(Wrappers.lambdaQuery(DesVolumeCatalog.class)
|
||||||
.eq(DesVolumeCatalog::getProjectId, projectId)
|
.eq(DesVolumeCatalog::getProjectId, projectId)
|
||||||
.in(DesVolumeCatalog::getDesign, list1)
|
.in(DesVolumeCatalog::getDesign, list1)
|
||||||
.orderByDesc(DesVolumeCatalog::getCreateTime)
|
.orderByDesc(DesVolumeCatalog::getCreateTime)
|
||||||
@ -368,78 +435,127 @@ public class DesVolumeCatalogServiceImpl extends ServiceImpl<DesVolumeCatalogMap
|
|||||||
public void exportExcelByProjectId(Long projectId, HttpServletResponse response) {
|
public void exportExcelByProjectId(Long projectId, HttpServletResponse response) {
|
||||||
DesUserBo desUserBo = new DesUserBo();
|
DesUserBo desUserBo = new DesUserBo();
|
||||||
desUserBo.setProjectId(projectId);
|
desUserBo.setProjectId(projectId);
|
||||||
Map<String, List<String>> majorToNames = new HashMap<>();
|
Map<String, String> uniqueMajors = desUserService.getUserMajor(desUserBo);
|
||||||
List<DesUserVo> desUserVos = desUserService.queryList(desUserBo);
|
Map<String, String> userList = desUserService.getUserList(desUserBo);
|
||||||
List<DesUserVo> uniqueMajors = new ArrayList<>(desUserVos.stream()
|
|
||||||
.collect(Collectors.toMap(
|
|
||||||
DesUserVo::getUserMajor,
|
|
||||||
user -> user,
|
|
||||||
(existing, replacement) -> existing
|
|
||||||
))
|
|
||||||
.values());
|
|
||||||
uniqueMajors.forEach(desUserVo -> {
|
|
||||||
desUserBo.setUserMajor(desUserVo.getUserMajor());
|
|
||||||
List<DesUserVo> desUserVos1 = desUserService.queryList(desUserBo);
|
|
||||||
List<String> names = desUserVos1.stream()
|
|
||||||
.map(DesUserVo::getUserName)
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
majorToNames.put(desUserVo.getUserMajorName(), names);
|
|
||||||
});
|
|
||||||
//TODO 数据绑定下拉
|
|
||||||
// String[] namesArray = names.toArray(String[]::new);
|
|
||||||
|
|
||||||
|
|
||||||
// 2. 设置响应头
|
// 2. 设置响应头
|
||||||
// 设置响应头,指定Excel格式和下载文件名
|
// 设置响应头,指定Excel格式和下载文件名
|
||||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||||
response.setCharacterEncoding("utf-8");
|
response.setCharacterEncoding("utf-8");
|
||||||
response.setHeader("Content-Disposition", "attachment; filename="+ URLEncoder.encode("收资清单模板.xlsx", StandardCharsets.UTF_8));
|
response.setHeader("Content-Disposition", "attachment; filename=" + URLEncoder.encode("卷册目录模板.xlsx", StandardCharsets.UTF_8));
|
||||||
|
|
||||||
Workbook workbook = new XSSFWorkbook();
|
Workbook workbook = new XSSFWorkbook();
|
||||||
// 创建主 Sheet 和隐藏 Sheet
|
// 创建主 Sheet 和隐藏 Sheet
|
||||||
Sheet mainSheet = workbook.createSheet("收资清单模板");
|
Sheet mainSheet = workbook.createSheet("卷册目录模板");
|
||||||
Sheet dropdownSheet = workbook.createSheet("DropdownData");
|
Sheet dataSheet = workbook.createSheet("DropdownData");
|
||||||
workbook.setSheetHidden(workbook.getSheetIndex(dropdownSheet), true);
|
workbook.setSheetHidden(workbook.getSheetIndex(dataSheet), true);
|
||||||
|
|
||||||
|
// 3. 创建单元格样式
|
||||||
|
|
||||||
//设置下拉列表数据
|
CellStyle editableStyle = createEditableCellStyle(workbook); // 可编辑单元格样式
|
||||||
// for (int i = 0; i < namesArray.length; i++) {
|
CellStyle protectedStyle = createProtectedCellStyle(workbook); // 受保护单元格样式(ID列用
|
||||||
// dropdownSheet.createRow(i).createCell(1).setCellValue(namesArray[i]); // 存到B列
|
|
||||||
// }
|
//填充隐藏数据Sheet
|
||||||
// int rowIdx = 0;
|
int rowIndex = 0;
|
||||||
// for (Map.Entry<Long, String> entry : userIdToNameMapByDept.entrySet()) {
|
|
||||||
// Row row = dropdownSheet.createRow(rowIdx++);
|
// 填充专业和专业ID(A列和B列)
|
||||||
// row.createCell(0).setCellValue(entry.getKey().toString());
|
for (Map.Entry<String, String> entry : uniqueMajors.entrySet()) {
|
||||||
// row.createCell(1).setCellValue(entry.getValue());
|
Row row = dataSheet.createRow(rowIndex++);
|
||||||
// }
|
row.createCell(0).setCellValue(entry.getValue()); // A列:专业ID
|
||||||
|
row.createCell(1).setCellValue(entry.getKey()); // B列:专业名称
|
||||||
|
}
|
||||||
|
|
||||||
|
// 重置行索引,填充人员和人员ID(C列和D列)
|
||||||
|
rowIndex = 0;
|
||||||
|
for (Map.Entry<String, String> entry : userList.entrySet()) {
|
||||||
|
Row row = dataSheet.getRow(rowIndex);
|
||||||
|
if (row == null) {
|
||||||
|
row = dataSheet.createRow(rowIndex);
|
||||||
|
}
|
||||||
|
row.createCell(2).setCellValue(entry.getValue()); // C列:人员ID
|
||||||
|
row.createCell(3).setCellValue(entry.getKey()); // D列:人员名称
|
||||||
|
rowIndex++;
|
||||||
|
}
|
||||||
|
|
||||||
// 主 Sheet 设置表头
|
// 主 Sheet 设置表头
|
||||||
Row sheetRow = mainSheet.createRow(0);
|
Row sheetRow = mainSheet.createRow(0);
|
||||||
sheetRow.createCell(0).setCellValue("子项名称");
|
String[] headers = {"子项名称", "专业", "专业编码",
|
||||||
sheetRow.createCell(1).setCellValue("卷册号");
|
"人员", "人员编码", "卷册号", "资料名称", "计划出图时间"};
|
||||||
sheetRow.createCell(2).setCellValue("资料名称");
|
for (int i = 0; i < headers.length; i++) {
|
||||||
sheetRow.createCell(3).setCellValue("计划出图时间");
|
Cell cell = sheetRow.createCell(i);
|
||||||
sheetRow.createCell(4).setCellValue("专业");
|
cell.setCellValue(headers[i]);
|
||||||
sheetRow.createCell(5).setCellValue("人员");
|
}
|
||||||
|
|
||||||
|
// 6. 设置专业下拉列表(第二列)
|
||||||
|
setMajorDropdown(mainSheet, uniqueMajors.size());
|
||||||
|
|
||||||
|
|
||||||
|
// 8. 设置人员下拉列表(第四列)
|
||||||
|
setPersonDropdown(mainSheet, userList.size());
|
||||||
|
|
||||||
|
String formulaTemplate = "IFERROR(INDEX(DropdownData!$B$1:$B$" + uniqueMajors.size() + ", MATCH(B{rowNum}, DropdownData!$A$1:$A$" + uniqueMajors.size() + ", 0)),\"\")";
|
||||||
|
|
||||||
|
String formulaTemplate1 = "IFERROR(INDEX(DropdownData!$D$1:$D$" + userList.size() + ", MATCH(D{rowNum}, DropdownData!$C$1:$C$" + userList.size() + ", 0)),\"\")";
|
||||||
|
|
||||||
|
|
||||||
|
for (int i = 1; i <= 100; i++) { // 从第2行到101行
|
||||||
|
Row row = mainSheet.createRow(i);
|
||||||
|
int currentRowNum = i + 1; // Excel行号从1开始
|
||||||
|
String formula = formulaTemplate.replace("{rowNum}", String.valueOf(currentRowNum));
|
||||||
|
|
||||||
|
Cell cell = row.createCell(1);
|
||||||
|
cell.setCellStyle(editableStyle); //专业不锁定
|
||||||
|
|
||||||
|
Cell idCell = row.createCell(2);
|
||||||
|
idCell.setCellFormula(formula);
|
||||||
|
idCell.setCellStyle(protectedStyle); // 应用隐藏公式样式
|
||||||
|
|
||||||
|
String formula1 = formulaTemplate1.replace("{rowNum}", String.valueOf(currentRowNum));
|
||||||
|
|
||||||
|
Cell cell2 = row.createCell(3);
|
||||||
|
cell2.setCellStyle(editableStyle);
|
||||||
|
|
||||||
|
Cell idCell2 = row.createCell(4);
|
||||||
|
idCell2.setCellFormula(formula1);
|
||||||
|
idCell2.setCellStyle(protectedStyle);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
for (int i = 1; i <= 100; i++) {
|
||||||
|
Row row = mainSheet.getRow(i);
|
||||||
|
if (row == null) {
|
||||||
|
row = mainSheet.createRow(i);
|
||||||
|
}
|
||||||
|
Cell cell = row.createCell(0);
|
||||||
|
cell.setCellStyle(editableStyle);
|
||||||
|
|
||||||
|
Cell cell1 = row.createCell(5);
|
||||||
|
cell1.setCellStyle(editableStyle);
|
||||||
|
|
||||||
|
Cell cell2 = row.createCell(6);
|
||||||
|
cell2.setCellStyle(editableStyle);
|
||||||
|
|
||||||
|
Cell cell3 = row.createCell(7);
|
||||||
|
cell3.setCellStyle(editableStyle);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 保护工作表,仅允许编辑未锁定的单元格
|
||||||
|
mainSheet.protectSheet("123456"); // 空密码
|
||||||
|
|
||||||
// 核心:锁定表头(第1行)和前1列(包含ID列)
|
// 核心:锁定表头(第1行)和前1列(包含ID列)
|
||||||
mainSheet.createFreezePane(0, 1, 0, 0);
|
mainSheet.createFreezePane(0, 1, 0, 1);
|
||||||
|
|
||||||
// 绑定下拉列表(关联隐藏 Sheet)
|
|
||||||
DataValidationHelper helper = mainSheet.getDataValidationHelper(); //为主Sheet第二列设置下拉列表(关联隐藏Sheet的B列)
|
|
||||||
// String range = "DropdownData!$B$1:$B$" + namesArray.length; //引用隐藏Sheet的B列数据范围:DropdownData!$B$1:$B$
|
|
||||||
// DataValidationConstraint constraint = helper.createFormulaListConstraint(range); //创建下拉约束
|
|
||||||
CellRangeAddressList addressList = new CellRangeAddressList(1, 300, 1, 1); // 支持100行数据
|
|
||||||
//添加验证规则
|
|
||||||
// DataValidation validation = helper.createValidation(constraint, addressList);
|
|
||||||
// validation.setShowErrorBox(true);
|
|
||||||
// mainSheet.addValidationData(validation);
|
|
||||||
|
|
||||||
// 调整列宽
|
// 调整列宽
|
||||||
mainSheet.setColumnWidth(0, 20 * 256);
|
mainSheet.setColumnWidth(0, 20 * 256);
|
||||||
mainSheet.setColumnWidth(1, 20 * 100);
|
mainSheet.setColumnWidth(1, 20 * 200);
|
||||||
mainSheet.setColumnWidth(2, 20 * 200);
|
mainSheet.setColumnWidth(2, 20 * 200);
|
||||||
mainSheet.setColumnWidth(3, 20 * 200);
|
mainSheet.setColumnWidth(3, 20 * 200);
|
||||||
|
mainSheet.setColumnWidth(4, 20 * 200);
|
||||||
|
mainSheet.setColumnWidth(5, 20 * 200);
|
||||||
|
mainSheet.setColumnWidth(6, 20 * 200);
|
||||||
|
mainSheet.setColumnWidth(7, 20 * 200);
|
||||||
|
|
||||||
// 直接写入响应输出流
|
// 直接写入响应输出流
|
||||||
try {
|
try {
|
||||||
@ -451,6 +567,69 @@ public class DesVolumeCatalogServiceImpl extends ServiceImpl<DesVolumeCatalogMap
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建可编辑单元格样式
|
||||||
|
*/
|
||||||
|
private CellStyle createEditableCellStyle(Workbook workbook) {
|
||||||
|
CellStyle style = workbook.createCellStyle();
|
||||||
|
style.setLocked(false); // 关键:允许编辑
|
||||||
|
return style;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建受保护单元格样式(用于ID列)
|
||||||
|
*/
|
||||||
|
private CellStyle createProtectedCellStyle(Workbook workbook) {
|
||||||
|
CellStyle style = workbook.createCellStyle();
|
||||||
|
DataFormat dataFormat = workbook.createDataFormat();
|
||||||
|
short formatIndex = dataFormat.getFormat("0"); // 匹配“自定义→0”格式
|
||||||
|
style.setDataFormat(formatIndex);
|
||||||
|
style.setHidden(true); // 隐藏公式
|
||||||
|
style.setLocked(true);
|
||||||
|
return style;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置专业下拉列表(第二列,索引1)
|
||||||
|
*/
|
||||||
|
private void setMajorDropdown(Sheet mainSheet, int majorCount) {
|
||||||
|
DataValidationHelper helper = mainSheet.getDataValidationHelper();
|
||||||
|
|
||||||
|
// 专业数据范围:数据Sheet的A列(从第1行到专业数量行)
|
||||||
|
String majorRange = "DropdownData!$A$1:$A$" + majorCount;
|
||||||
|
|
||||||
|
DataValidationConstraint constraint = helper.createFormulaListConstraint(majorRange);
|
||||||
|
// 作用范围:第2行到100行,第二列
|
||||||
|
CellRangeAddressList addressList = new CellRangeAddressList(1, 100, 1, 1);
|
||||||
|
|
||||||
|
DataValidation validation = helper.createValidation(constraint, addressList);
|
||||||
|
validation.setShowErrorBox(true);
|
||||||
|
mainSheet.addValidationData(validation);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置人员下拉列表(第四列,索引3)
|
||||||
|
*/
|
||||||
|
private void setPersonDropdown(Sheet mainSheet, int personCount) {
|
||||||
|
DataValidationHelper helper = mainSheet.getDataValidationHelper();
|
||||||
|
|
||||||
|
// 人员数据范围:数据Sheet的C列(从第1行到人员数量行)
|
||||||
|
String personRange = "DropdownData!$C$1:$C$" + personCount;
|
||||||
|
|
||||||
|
DataValidationConstraint constraint = helper.createFormulaListConstraint(personRange);
|
||||||
|
// 作用范围:第2行到100行,第四列
|
||||||
|
CellRangeAddressList addressList = new CellRangeAddressList(1, 100, 3, 3);
|
||||||
|
|
||||||
|
DataValidation validation = helper.createValidation(constraint, addressList);
|
||||||
|
validation.setShowErrorBox(true);
|
||||||
|
mainSheet.addValidationData(validation);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 总体流程监听(例如: 草稿,撤销,退回,作废,终止,已完成,单任务完成等)
|
* 总体流程监听(例如: 草稿,撤销,退回,作废,终止,已完成,单任务完成等)
|
||||||
* 正常使用只需#processEvent.flowCode=='leave1'
|
* 正常使用只需#processEvent.flowCode=='leave1'
|
||||||
@ -469,11 +648,11 @@ public class DesVolumeCatalogServiceImpl extends ServiceImpl<DesVolumeCatalogMap
|
|||||||
}
|
}
|
||||||
desVolumeCatalog.setAuditStatus(processEvent.getStatus());
|
desVolumeCatalog.setAuditStatus(processEvent.getStatus());
|
||||||
//如果完成,变更状态为已完成
|
//如果完成,变更状态为已完成
|
||||||
if (processEvent.getStatus().equals("finish")){
|
if (processEvent.getStatus().equals("finish")) {
|
||||||
desVolumeCatalog.setDesignState("1");
|
desVolumeCatalog.setDesignState("1");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(BusinessStatusEnum.FINISH.getStatus().equals(processEvent.getStatus())){
|
if (BusinessStatusEnum.FINISH.getStatus().equals(processEvent.getStatus())) {
|
||||||
ArrayList<DesDrawing> desDrawings = new ArrayList<>();
|
ArrayList<DesDrawing> desDrawings = new ArrayList<>();
|
||||||
|
|
||||||
List<DesVolumeFile> list = volumeFileService.lambdaQuery().eq(DesVolumeFile::getVolumeCatalogId, id).list();
|
List<DesVolumeFile> list = volumeFileService.lambdaQuery().eq(DesVolumeFile::getVolumeCatalogId, id).list();
|
||||||
@ -486,7 +665,7 @@ public class DesVolumeCatalogServiceImpl extends ServiceImpl<DesVolumeCatalogMap
|
|||||||
|
|
||||||
desDrawings.add(desDrawing);
|
desDrawings.add(desDrawing);
|
||||||
//异步处理二维码
|
//异步处理二维码
|
||||||
self.addQRCodeToPDF(desVolumeFile.getId(),false)
|
self.addQRCodeToPDF(desVolumeFile.getId(), false)
|
||||||
.thenAccept(result -> log.info("图纸[{}-{} ]添加二维码成功", desVolumeFile.getFileName(), desVolumeFile.getId()))
|
.thenAccept(result -> log.info("图纸[{}-{} ]添加二维码成功", desVolumeFile.getFileName(), desVolumeFile.getId()))
|
||||||
.exceptionally(ex -> {
|
.exceptionally(ex -> {
|
||||||
log.error("图纸[{}-{}]添加二维码失败", desVolumeFile.getFileName(), desVolumeFile.getId(), ex);
|
log.error("图纸[{}-{}]添加二维码失败", desVolumeFile.getFileName(), desVolumeFile.getId(), ex);
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
@ -117,7 +119,9 @@ public class DesVolumeFileServiceImpl extends ServiceImpl<DesVolumeFileMapper, D
|
|||||||
Page<DesVolumeFileJoinVo> page = baseMapper.queryJoinPageList(pageQuery.build(), bo);
|
Page<DesVolumeFileJoinVo> page = baseMapper.queryJoinPageList(pageQuery.build(), bo);
|
||||||
for (DesVolumeFileJoinVo vo : page.getRecords()) {
|
for (DesVolumeFileJoinVo vo : page.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(page);
|
return TableDataInfo.build(page);
|
||||||
}
|
}
|
||||||
@ -267,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("文件尚未审核完成,请勿重复上传");
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -309,8 +313,10 @@ public class DesVolumeFileServiceImpl extends ServiceImpl<DesVolumeFileMapper, D
|
|||||||
|
|
||||||
// 根据文件类型和文件名判断是否存在文件,存在则版本号往上增
|
// 根据文件类型和文件名判断是否存在文件,存在则版本号往上增
|
||||||
List<DesVolumeFile> existingFiles = baseMapper.selectList(new LambdaQueryWrapper<DesVolumeFile>()
|
List<DesVolumeFile> existingFiles = baseMapper.selectList(new LambdaQueryWrapper<DesVolumeFile>()
|
||||||
.eq(DesVolumeFile::getType, type)
|
.eq(DesVolumeFile.PROCESS.equals(type),DesVolumeFile::getType, type)
|
||||||
.eq(DesVolumeFile::getFileName, fileName)
|
.in(DesVolumeFile.BLUEPRINT.equals(type),DesVolumeFile::getType, Arrays.asList(DesVolumeFile.BLUEPRINT, DesVolumeFile.WASTE))
|
||||||
|
.eq(DesVolumeFile::getVolumeCatalogId, file.getVolumeCatalogId())
|
||||||
|
// .eq(DesVolumeFile::getFileName, fileName)
|
||||||
.orderByDesc(DesVolumeFile::getVersion));
|
.orderByDesc(DesVolumeFile::getVersion));
|
||||||
|
|
||||||
String versionStr = "1.0"; // 默认版本号
|
String versionStr = "1.0"; // 默认版本号
|
||||||
@ -326,11 +332,12 @@ public class DesVolumeFileServiceImpl extends ServiceImpl<DesVolumeFileMapper, D
|
|||||||
// 过程图纸:基于蓝图版本号,如蓝图是1.0,则过程图为1.1, 1.2...1.9, 1.10
|
// 过程图纸:基于蓝图版本号,如蓝图是1.0,则过程图为1.1, 1.2...1.9, 1.10
|
||||||
// 先查找对应的蓝图文件最新版本
|
// 先查找对应的蓝图文件最新版本
|
||||||
List<DesVolumeFile> blueprintFiles = baseMapper.selectList(new LambdaQueryWrapper<DesVolumeFile>()
|
List<DesVolumeFile> blueprintFiles = baseMapper.selectList(new LambdaQueryWrapper<DesVolumeFile>()
|
||||||
.eq(DesVolumeFile::getType, DesVolumeFile.BLUEPRINT) // 蓝图类型
|
.in(DesVolumeFile::getType, Arrays.asList(DesVolumeFile.BLUEPRINT, DesVolumeFile.WASTE)) // 蓝图类型
|
||||||
|
.eq(DesVolumeFile::getVolumeCatalogId, file.getVolumeCatalogId())
|
||||||
// .eq(DesVolumeFile::getFileName, fileName)
|
// .eq(DesVolumeFile::getFileName, fileName)
|
||||||
.orderByDesc(DesVolumeFile::getVersion));
|
.orderByDesc(DesVolumeFile::getVersion));
|
||||||
|
|
||||||
String blueprintVersion = "1.0"; // 默认蓝图版本
|
String blueprintVersion = "0.0"; // 默认蓝图版本
|
||||||
if (CollectionUtil.isNotEmpty(blueprintFiles)) {
|
if (CollectionUtil.isNotEmpty(blueprintFiles)) {
|
||||||
blueprintVersion = blueprintFiles.getFirst().getVersion();
|
blueprintVersion = blueprintFiles.getFirst().getVersion();
|
||||||
}
|
}
|
||||||
@ -479,6 +486,7 @@ public class DesVolumeFileServiceImpl extends ServiceImpl<DesVolumeFileMapper, D
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
desVolumeFile.setAuditStatus(processEvent.getStatus());
|
desVolumeFile.setAuditStatus(processEvent.getStatus());
|
||||||
|
this.updateById(desVolumeFile);
|
||||||
//如果完成,以前的图纸类型变为作废图纸,状态改为作废 暂定
|
//如果完成,以前的图纸类型变为作废图纸,状态改为作废 暂定
|
||||||
if (processEvent.getStatus().equals("finish")) {
|
if (processEvent.getStatus().equals("finish")) {
|
||||||
// this.lambdaUpdate().set(DesVolumeFile::getStatus, "2")
|
// this.lambdaUpdate().set(DesVolumeFile::getStatus, "2")
|
||||||
@ -495,8 +503,7 @@ public class DesVolumeFileServiceImpl extends ServiceImpl<DesVolumeFileMapper, D
|
|||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
desVolumeFile.setFileId(null);
|
|
||||||
this.updateById(desVolumeFile);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -544,6 +551,7 @@ public class DesVolumeFileServiceImpl extends ServiceImpl<DesVolumeFileMapper, D
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
desVolumeFile.setAuditStatus(processEvent.getStatus());
|
desVolumeFile.setAuditStatus(processEvent.getStatus());
|
||||||
|
this.updateById(desVolumeFile);
|
||||||
if (processEvent.getStatus().equals("finish")) {
|
if (processEvent.getStatus().equals("finish")) {
|
||||||
//修改目录状态
|
//修改目录状态
|
||||||
volumeCatalogService.update(Wrappers.<DesVolumeCatalog>lambdaUpdate()
|
volumeCatalogService.update(Wrappers.<DesVolumeCatalog>lambdaUpdate()
|
||||||
@ -558,8 +566,7 @@ public class DesVolumeFileServiceImpl extends ServiceImpl<DesVolumeFileMapper, D
|
|||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
desVolumeFile.setFileId(null);
|
|
||||||
this.updateById(desVolumeFile);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -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 ->
|
||||||
|
@ -277,7 +277,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);
|
||||||
|
@ -114,6 +114,11 @@ public class BusFormalitiesAreConsolidatedVo implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private Date createPTime;
|
private Date createPTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件数量
|
||||||
|
*/
|
||||||
|
private Long fileCount;
|
||||||
|
|
||||||
|
|
||||||
private List<BusFormalitiesAreConsolidatedVo> children = new ArrayList<>();
|
private List<BusFormalitiesAreConsolidatedVo> children = new ArrayList<>();
|
||||||
|
|
||||||
|
@ -90,6 +90,18 @@ public class BusFormalitiesAreConsolidatedServiceImpl extends ServiceImpl<BusFor
|
|||||||
@Override
|
@Override
|
||||||
public List<BusFormalitiesAreConsolidatedVo> getTree(BusFormalitiesAreConsolidatedBo bo) {
|
public List<BusFormalitiesAreConsolidatedVo> getTree(BusFormalitiesAreConsolidatedBo bo) {
|
||||||
List<BusFormalitiesAreConsolidatedVo> voList = queryList(bo);
|
List<BusFormalitiesAreConsolidatedVo> voList = queryList(bo);
|
||||||
|
//寻找对应文件数量
|
||||||
|
LambdaQueryWrapper<BusFormalitiesAnnex> lqw = new LambdaQueryWrapper<>();
|
||||||
|
for (BusFormalitiesAreConsolidatedVo busFormalitiesAreConsolidatedVo : voList) {
|
||||||
|
lqw.clear();
|
||||||
|
lqw.eq(BusFormalitiesAnnex::getFormalitiesId, busFormalitiesAreConsolidatedVo.getId());
|
||||||
|
List<BusFormalitiesAnnex> list = busFormalitiesAnnexService.list(lqw);
|
||||||
|
if (list != null && !list.isEmpty()){
|
||||||
|
busFormalitiesAreConsolidatedVo.setFileCount((long) list.size());
|
||||||
|
}else {
|
||||||
|
busFormalitiesAreConsolidatedVo.setFileCount(0L);
|
||||||
|
}
|
||||||
|
}
|
||||||
return TreeUtil.buildTree1(voList);
|
return TreeUtil.buildTree1(voList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,13 +1,26 @@
|
|||||||
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 com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import jakarta.validation.constraints.*;
|
import jakarta.validation.constraints.*;
|
||||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.dromara.gps.domain.vo.GpsUserVo;
|
import org.dromara.common.core.exception.ServiceException;
|
||||||
|
import org.dromara.contractor.domain.SubConstructionUser;
|
||||||
|
import org.dromara.contractor.domain.dto.constructionuser.SubConstructionUserQueryReq;
|
||||||
|
import org.dromara.contractor.domain.exportvo.BusConstructionUserExportVo;
|
||||||
|
import org.dromara.contractor.domain.vo.constructionuser.SubConstructionUserVo;
|
||||||
|
import org.dromara.contractor.service.ISubConstructionUserService;
|
||||||
|
import org.dromara.gps.domain.vo.*;
|
||||||
|
import org.dromara.project.service.IBusProjectService;
|
||||||
|
import org.dromara.system.domain.SysUser;
|
||||||
|
import org.dromara.system.domain.vo.SysUserVo;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||||
@ -19,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;
|
||||||
@ -39,6 +51,25 @@ public class GpsEquipmentController extends BaseController {
|
|||||||
|
|
||||||
private final IGpsEquipmentService gpsEquipmentService;
|
private final IGpsEquipmentService gpsEquipmentService;
|
||||||
|
|
||||||
|
private final ISubConstructionUserService constructionUserService;
|
||||||
|
|
||||||
|
|
||||||
|
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
|
||||||
@ -64,7 +95,7 @@ public class GpsEquipmentController extends BaseController {
|
|||||||
/**
|
/**
|
||||||
* 查询GPS设备用户列表
|
* 查询GPS设备用户列表
|
||||||
*/
|
*/
|
||||||
@SaCheckPermission("gps:equipment:list")
|
@SaCheckPermission("gps:equipment:getUserList")
|
||||||
@GetMapping("/getUserList")
|
@GetMapping("/getUserList")
|
||||||
public R<List<GpsUserVo>> getUserList(GpsEquipmentBo bo) {
|
public R<List<GpsUserVo>> getUserList(GpsEquipmentBo bo) {
|
||||||
return R.ok(gpsEquipmentService.getUserList(bo));
|
return R.ok(gpsEquipmentService.getUserList(bo));
|
||||||
@ -115,6 +146,17 @@ public class GpsEquipmentController extends BaseController {
|
|||||||
return toAjax(gpsEquipmentService.updateByBo(bo));
|
return toAjax(gpsEquipmentService.updateByBo(bo));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目列表
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("gps:equipment:getProjectList")
|
||||||
|
@GetMapping("/getProjectList")
|
||||||
|
public R<List<GpsProjectVo>> getProjectList() {
|
||||||
|
return R.ok(gpsEquipmentService.getProjectList());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GPS人机关联绑定
|
* GPS人机关联绑定
|
||||||
*/
|
*/
|
||||||
@ -123,8 +165,26 @@ public class GpsEquipmentController extends BaseController {
|
|||||||
@RepeatSubmit()
|
@RepeatSubmit()
|
||||||
@PostMapping("/bindManmachine")
|
@PostMapping("/bindManmachine")
|
||||||
public R<Void> bindManmachine(@RequestBody GpsEquipmentBo bo) {
|
public R<Void> bindManmachine(@RequestBody GpsEquipmentBo bo) {
|
||||||
|
if (bo.getClientId() == null) {
|
||||||
|
throw new ServiceException("设备id不能为空!!!");
|
||||||
|
}
|
||||||
return toAjax(gpsEquipmentService.bindManmachine(bo));
|
return toAjax(gpsEquipmentService.bindManmachine(bo));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询施工人员列表
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("gps:equipment:userList")
|
||||||
|
@GetMapping("/userList")
|
||||||
|
public R<List<ConstructionUser>> list(SubConstructionUserQueryReq req) {
|
||||||
|
List<SubConstructionUser> list = constructionUserService.list(Wrappers.<SubConstructionUser>lambdaQuery()
|
||||||
|
.eq(SubConstructionUser::getProjectId, req.getProjectId())
|
||||||
|
);
|
||||||
|
return R.ok(BeanUtil.copyToList(list,ConstructionUser.class ));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GPS人机关联解绑
|
* GPS人机关联解绑
|
||||||
*/
|
*/
|
||||||
@ -133,6 +193,9 @@ public class GpsEquipmentController extends BaseController {
|
|||||||
@RepeatSubmit()
|
@RepeatSubmit()
|
||||||
@PostMapping("/unbindManmachine")
|
@PostMapping("/unbindManmachine")
|
||||||
public R<Void> unbindManmachine(@RequestBody GpsEquipmentBo bo) {
|
public R<Void> unbindManmachine(@RequestBody GpsEquipmentBo bo) {
|
||||||
|
if (bo.getClientId() == null) {
|
||||||
|
throw new ServiceException("设备id不能为空!!!");
|
||||||
|
}
|
||||||
return toAjax(gpsEquipmentService.unbindManmachine(bo));
|
return toAjax(gpsEquipmentService.unbindManmachine(bo));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,6 +45,15 @@ public class GpsEquipmentSonController extends BaseController {
|
|||||||
return gpsEquipmentSonService.queryPageList(bo, pageQuery);
|
return gpsEquipmentSonService.queryPageList(bo, pageQuery);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询GPS设备定位信息列表
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("gps:equipmentSon:getList")
|
||||||
|
@GetMapping("/getList")
|
||||||
|
public R<List<GpsEquipmentSonVo>> getList(GpsEquipmentSonBo bo) {
|
||||||
|
return R.ok(gpsEquipmentSonService.queryList(bo));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出GPS设备定位信息列表
|
* 导出GPS设备定位信息列表
|
||||||
*/
|
*/
|
||||||
|
@ -78,5 +78,10 @@ public class GpsEquipment extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 存活状态 0-离线 1-在线
|
||||||
|
*/
|
||||||
|
private String alive;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -114,4 +114,5 @@ public class GpsEquipmentSon extends BaseEntity {
|
|||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
|
|
||||||
|
private Long projectId;
|
||||||
}
|
}
|
||||||
|
@ -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
|
||||||
*
|
*
|
||||||
@ -76,5 +78,8 @@ public class GpsEquipmentBo extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
private List<String> idList;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -114,4 +114,6 @@ public class GpsEquipmentSonBo extends BaseEntity {
|
|||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
|
|
||||||
|
private Long projectId;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,18 @@
|
|||||||
|
package org.dromara.gps.domain.vo;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ConstructionUser {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 人员姓名
|
||||||
|
*/
|
||||||
|
private String userName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系统用户id
|
||||||
|
*/
|
||||||
|
private Long sysUserId;
|
||||||
|
}
|
@ -47,6 +47,8 @@ public class GpsEquipmentSonVo implements Serializable {
|
|||||||
@ExcelProperty(value = "设备标识")
|
@ExcelProperty(value = "设备标识")
|
||||||
private String clientId;
|
private String clientId;
|
||||||
|
|
||||||
|
private Long projectId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设备名称
|
* 设备名称
|
||||||
*/
|
*/
|
||||||
|
@ -40,12 +40,16 @@ public class GpsEquipmentVo implements Serializable {
|
|||||||
@ExcelProperty(value = "项目ID")
|
@ExcelProperty(value = "项目ID")
|
||||||
private Long projectId;
|
private Long projectId;
|
||||||
|
|
||||||
|
private String projectName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户id
|
* 用户id
|
||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "用户id")
|
@ExcelProperty(value = "用户id")
|
||||||
private Long userId;
|
private Long userId;
|
||||||
|
|
||||||
|
private String userName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设备标识
|
* 设备标识
|
||||||
*/
|
*/
|
||||||
@ -96,4 +100,7 @@ public class GpsEquipmentVo implements Serializable {
|
|||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
|
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,30 @@
|
|||||||
|
package org.dromara.gps.domain.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GPS人机关联视图对象 gps_manmachine
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-08-28
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class GpsProjectVo implements Serializable {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
// @ExcelProperty(value = "")
|
||||||
|
private Long projectId;
|
||||||
|
/**
|
||||||
|
* 用户名
|
||||||
|
*/
|
||||||
|
private String projectName;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user