Compare commits
123 Commits
flowUpdate
...
dev
| Author | SHA1 | Date | |
|---|---|---|---|
| 1263b4812d | |||
| dbe8556741 | |||
| 844b3addf3 | |||
| 77532caf47 | |||
| 46ac312ddf | |||
| c45d98856e | |||
| f2c0932e2e | |||
| b8334c7764 | |||
| 48338278f0 | |||
| f5cea23daa | |||
| a29c9c8d4d | |||
| 511bf33914 | |||
| 4450f82717 | |||
| f62c542684 | |||
| bb8c951651 | |||
| 9f5b3918d0 | |||
| 84d9291763 | |||
| fcbc5a30c4 | |||
| 6f4eb21deb | |||
| 6819eb5f80 | |||
| 0f1ad34342 | |||
| 35d1cfc668 | |||
| a6dc40760d | |||
| 2486bb4c6e | |||
| a59a452f89 | |||
| 930bff6cba | |||
| 70c9997c82 | |||
| 0db70d3d73 | |||
| 2884699ff2 | |||
| 849eb802bc | |||
| 4ce8ea6a3a | |||
| 7e1db73fb0 | |||
| 46299e5732 | |||
| 6032869417 | |||
| 955d7e39e6 | |||
| ecc0595ec3 | |||
| 6b22ed8b0a | |||
| 9b7db3214e | |||
| 71b3c77028 | |||
| c7bd709240 | |||
| a80c38f87f | |||
| 7b91443532 | |||
| a9b9e12732 | |||
| 99ecb29f3c | |||
| 4fe7a435c6 | |||
| 18be0f00a3 | |||
| 9dfea176b3 | |||
| 09d3b06e7a | |||
| 8b60d13c0a | |||
| 188172692b | |||
| 556f3b6535 | |||
| 0b81a8dc63 | |||
| 982ec18490 | |||
| 0c38c42bfe | |||
| 2f0b323680 | |||
| 35d2a10c0e | |||
| 9c7f9ad980 | |||
| 79a2dbfcd3 | |||
| b5b7324f7c | |||
| b171ec6af0 | |||
| 85c7ded162 | |||
| b39aa7be71 | |||
| 8ae5614ce9 | |||
| 03cf7ebac7 | |||
| 3efa899a97 | |||
| f0802432ed | |||
| 45702ef838 | |||
| 4e3faa7a23 | |||
| 40559d4d73 | |||
| 7816fec7aa | |||
| 37c95ab0bd | |||
| 3e38cf9abb | |||
| 4aaf384ce8 | |||
| 6a06d8596d | |||
| be89a6fe9e | |||
| 40b51e5e9d | |||
| 4b14ea5c7f | |||
| 07b921d630 | |||
| 13d33e9d53 | |||
| a868c7b5cb | |||
| ebd88a999c | |||
| 97079abdef | |||
| 1e01c53c52 | |||
| 8a27da9975 | |||
| e160cc5ff3 | |||
| c9c81bb761 | |||
| b51a3ccf28 | |||
| 5e9d36400c | |||
| 03177f58f2 | |||
| bfe74bdb4c | |||
| df08eb3dd6 | |||
| 8c292850c2 | |||
| 12d3924e8a | |||
| 9eecf67374 | |||
| d7fd7d6cc4 | |||
| aac6efc568 | |||
| 209e624fc2 | |||
| fe79bf282c | |||
| 6b59d264b4 | |||
| 74785a768e | |||
| 32aafaa2db | |||
| 06617d94a7 | |||
| c0fef2521f | |||
| 04430d8853 | |||
| 875b436eea | |||
| 765490b51c | |||
| e2892b460b | |||
| 15d86526ac | |||
| cdf5f8bf5b | |||
| 9bb41d903e | |||
| d5f1c22bd4 | |||
| d2dcf656df | |||
| 7191a60841 | |||
| 3f21d39653 | |||
| b520ea6afe | |||
| e6283bee1c | |||
| f6e1d0c73e | |||
| c7e06ade6d | |||
| 3d85b10475 | |||
| e26dfc098a | |||
| c3ab46c8c8 | |||
| e37d118d0c | |||
| a6c92e8ba9 |
1
xinnengyuan/.gitignore
vendored
1
xinnengyuan/.gitignore
vendored
@ -54,3 +54,4 @@ docs
|
|||||||
/file
|
/file
|
||||||
.idea/
|
.idea/
|
||||||
chat-memory/
|
chat-memory/
|
||||||
|
queries/
|
||||||
|
|||||||
@ -18,7 +18,7 @@
|
|||||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
<java.version>21</java.version>
|
<java.version>21</java.version>
|
||||||
<mybatis.version>3.5.16</mybatis.version>
|
<mybatis.version>3.5.16</mybatis.version>
|
||||||
<springdoc.version>2.8.4</springdoc.version>
|
<springdoc.version>2.3.0</springdoc.version>
|
||||||
<therapi-javadoc.version>0.15.0</therapi-javadoc.version>
|
<therapi-javadoc.version>0.15.0</therapi-javadoc.version>
|
||||||
<easyexcel.version>4.0.3</easyexcel.version>
|
<easyexcel.version>4.0.3</easyexcel.version>
|
||||||
<velocity.version>2.3</velocity.version>
|
<velocity.version>2.3</velocity.version>
|
||||||
@ -86,6 +86,15 @@
|
|||||||
<activeByDefault>true</activeByDefault>
|
<activeByDefault>true</activeByDefault>
|
||||||
</activation>
|
</activation>
|
||||||
</profile>
|
</profile>
|
||||||
|
<profile>
|
||||||
|
<id>menu</id>
|
||||||
|
<properties>
|
||||||
|
<profiles.active>menu</profiles.active>
|
||||||
|
<logging.level>info</logging.level>
|
||||||
|
<monitor.username>ruoyi</monitor.username>
|
||||||
|
<monitor.password>123456</monitor.password>
|
||||||
|
</properties>
|
||||||
|
</profile>
|
||||||
<profile>
|
<profile>
|
||||||
<id>prod</id>
|
<id>prod</id>
|
||||||
<properties>
|
<properties>
|
||||||
|
|||||||
@ -5,6 +5,8 @@ import cn.hutool.captcha.AbstractCaptcha;
|
|||||||
import cn.hutool.captcha.generator.CodeGenerator;
|
import cn.hutool.captcha.generator.CodeGenerator;
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
import cn.hutool.core.util.RandomUtil;
|
import cn.hutool.core.util.RandomUtil;
|
||||||
|
import cn.hutool.json.JSONObject;
|
||||||
|
import cn.hutool.json.JSONUtil;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@ -76,7 +78,7 @@ public class CaptchaController {
|
|||||||
SmsResponse smsResponse = smsBlend.sendMessage(phonenumber, map);
|
SmsResponse smsResponse = smsBlend.sendMessage(phonenumber, map);
|
||||||
if (!smsResponse.isSuccess()) {
|
if (!smsResponse.isSuccess()) {
|
||||||
log.error("验证码短信发送异常 => {}", smsResponse);
|
log.error("验证码短信发送异常 => {}", smsResponse);
|
||||||
return R.fail(smsResponse.getData().toString());
|
return R.fail(parseData(smsResponse));
|
||||||
}
|
}
|
||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
@ -140,4 +142,35 @@ public class CaptchaController {
|
|||||||
return R.ok(captchaVo);
|
return R.ok(captchaVo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static String parseData(SmsResponse smsResponse ) {
|
||||||
|
try {
|
||||||
|
JSONObject json = JSONUtil.parseObj(smsResponse.getData());
|
||||||
|
// 核心:用 JsonUtil 解析 data,通过键路径 "Response.SendStatusSet[0].Code" 提取字段
|
||||||
|
// 键路径规则:层级用 "." 分隔,列表索引用 "[0]" 表示(第 1 个元素)
|
||||||
|
String code = json.getByPath("Response.SendStatusSet[0].Code", String.class);
|
||||||
|
System.out.println("错误码:" + code); // 输出:FailedOperation.InsufficientBalanceInSmsPackage
|
||||||
|
return convert(code);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return "短信发送未知错误";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static String convert(String code) {
|
||||||
|
return switch (code) {
|
||||||
|
case "FailedOperation.InsufficientBalanceInSmsPackage" -> "套餐包余量不足,请购买套餐包";
|
||||||
|
case "InternalError.SendAndRecvFail" -> "短信收发超时,请检查您的网络是否有波动";
|
||||||
|
case "InvalidParameterValue.IncorrectPhoneNumber" -> "手机号格式错误";
|
||||||
|
case "LimitExceeded.AppCountryOrRegionDailyLimit" -> "业务短信国家/地区日下发条数超过设定的上限";
|
||||||
|
case "LimitExceeded.AppDailyLimit" -> "业务短信日下发条数超过设定的上限";
|
||||||
|
case "LimitExceeded.PhoneNumberDailyLimit" -> "单个手机号日下发短信条数超过设定的上限";
|
||||||
|
case "UnauthorizedOperation.ServiceSuspendDueToArrears" -> "欠费被停止服务";
|
||||||
|
case "UnsupportedOperation.UnsupportedRegion" -> "不支持该地区短信下发";
|
||||||
|
default -> "短信发送未知错误";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -41,7 +41,7 @@ spring:
|
|||||||
api-key: sk-8d8df92fcbac4bd2922edba30b0bb8fa
|
api-key: sk-8d8df92fcbac4bd2922edba30b0bb8fa
|
||||||
chat:
|
chat:
|
||||||
options:
|
options:
|
||||||
model: qwen-plus
|
model: qwen3-max
|
||||||
datasource:
|
datasource:
|
||||||
type: com.zaxxer.hikari.HikariDataSource
|
type: com.zaxxer.hikari.HikariDataSource
|
||||||
# 动态数据源文档 https://www.kancloud.cn/tracy5546/dynamic-datasource/content
|
# 动态数据源文档 https://www.kancloud.cn/tracy5546/dynamic-datasource/content
|
||||||
@ -66,7 +66,7 @@ spring:
|
|||||||
# username: xinnengyuan
|
# username: xinnengyuan
|
||||||
# password: mEZPC5Sdf3r2HENi
|
# password: mEZPC5Sdf3r2HENi
|
||||||
# 从库数据源
|
# 从库数据源
|
||||||
# slave:
|
# slave:
|
||||||
# lazy: true
|
# lazy: true
|
||||||
# type: ${spring.datasource.type}
|
# type: ${spring.datasource.type}
|
||||||
# driverClassName: com.mysql.cj.jdbc.Driver
|
# driverClassName: com.mysql.cj.jdbc.Driver
|
||||||
@ -368,3 +368,14 @@ drone:
|
|||||||
chat:
|
chat:
|
||||||
server:
|
server:
|
||||||
port: 19099
|
port: 19099
|
||||||
|
# rabbitmq 配置
|
||||||
|
rabbitmq:
|
||||||
|
exchange-name: dev-normal-exchange
|
||||||
|
queue-name: dev-normal-queue
|
||||||
|
routing-key: dev.normal.routing.key
|
||||||
|
delay-exchange-name: dev-delay-queue
|
||||||
|
delay-queue-name: dev-delay-exchange
|
||||||
|
delay-routing-key: dev.delay.routing.key
|
||||||
|
dead-letter-exchange: dev-dlx-exchange
|
||||||
|
dead-letter-queue: dev-dlx-queue
|
||||||
|
dead-letter-routing-key: dev.dlx.routing.key
|
||||||
|
|||||||
@ -41,10 +41,10 @@ snail-job:
|
|||||||
spring:
|
spring:
|
||||||
ai:
|
ai:
|
||||||
dashscope:
|
dashscope:
|
||||||
api-key: xxx
|
api-key: sk-8d8df92fcbac4bd2922edba30b0bb8fa
|
||||||
chat:
|
chat:
|
||||||
options:
|
options:
|
||||||
model: qwen-plus
|
model: qwen3-max
|
||||||
datasource:
|
datasource:
|
||||||
type: com.zaxxer.hikari.HikariDataSource
|
type: com.zaxxer.hikari.HikariDataSource
|
||||||
# 动态数据源文档 https://www.kancloud.cn/tracy5546/dynamic-datasource/content
|
# 动态数据源文档 https://www.kancloud.cn/tracy5546/dynamic-datasource/content
|
||||||
@ -343,3 +343,14 @@ drone:
|
|||||||
chat:
|
chat:
|
||||||
server:
|
server:
|
||||||
port: 18088
|
port: 18088
|
||||||
|
# rabbitmq 配置
|
||||||
|
rabbitmq:
|
||||||
|
exchange-name: local-normal-exchange
|
||||||
|
queue-name: local-normal-queue
|
||||||
|
routing-key: local.normal.routing.key
|
||||||
|
delay-exchange-name: local-delay-queue
|
||||||
|
delay-queue-name: local-delay-exchange
|
||||||
|
delay-routing-key: local.delay.routing.key
|
||||||
|
dead-letter-exchange: local-dlx-exchange
|
||||||
|
dead-letter-queue: local-dlx-queue
|
||||||
|
dead-letter-routing-key: local.dlx.routing.key
|
||||||
|
|||||||
356
xinnengyuan/ruoyi-admin/src/main/resources/application-menu.yml
Normal file
356
xinnengyuan/ruoyi-admin/src/main/resources/application-menu.yml
Normal file
@ -0,0 +1,356 @@
|
|||||||
|
# 开发环境配置
|
||||||
|
server:
|
||||||
|
# 服务器的HTTP端口,默认为8080
|
||||||
|
port: 9528
|
||||||
|
--- # 临时文件存储位置 避免临时文件被系统清理报错
|
||||||
|
spring.servlet.multipart.location: /ruoyi/server/temp
|
||||||
|
|
||||||
|
--- # 监控中心配置
|
||||||
|
spring.boot.admin.client:
|
||||||
|
# 增加客户端开关
|
||||||
|
enabled: false
|
||||||
|
url: http://localhost:9090/admin
|
||||||
|
instance:
|
||||||
|
service-host-type: IP
|
||||||
|
metadata:
|
||||||
|
username: ${spring.boot.admin.client.username}
|
||||||
|
userpassword: ${spring.boot.admin.client.password}
|
||||||
|
username: @monitor.username@
|
||||||
|
password: @monitor.password@
|
||||||
|
|
||||||
|
--- # snail-job 配置
|
||||||
|
snail-job:
|
||||||
|
enabled: false
|
||||||
|
# 需要在 SnailJob 后台组管理创建对应名称的组,然后创建任务的时候选择对应的组,才能正确分派任务
|
||||||
|
group: "ruoyi_group"
|
||||||
|
# SnailJob 接入验证令牌 详见 script/sql/ry_job.sql `sj_group_config`表
|
||||||
|
token: "SJ_cKqBTPzCsWA3VyuCfFoccmuIEGXjr5KT"
|
||||||
|
server:
|
||||||
|
host: 127.0.0.1
|
||||||
|
port: 17888
|
||||||
|
# 命名空间UUID 详见 script/sql/ry_job.sql `sj_namespace`表`unique_id`字段
|
||||||
|
namespace: ${spring.profiles.active}
|
||||||
|
# 随主应用端口漂移
|
||||||
|
port: 2${server.port}
|
||||||
|
# 客户端ip指定
|
||||||
|
host:
|
||||||
|
# RPC类型: netty, grpc
|
||||||
|
rpc-type: grpc
|
||||||
|
|
||||||
|
--- # 数据源配置
|
||||||
|
spring:
|
||||||
|
ai:
|
||||||
|
dashscope:
|
||||||
|
api-key: sk-8d8df92fcbac4bd2922edba30b0bb8fa
|
||||||
|
chat:
|
||||||
|
options:
|
||||||
|
model: qwen3-max
|
||||||
|
datasource:
|
||||||
|
type: com.zaxxer.hikari.HikariDataSource
|
||||||
|
# 动态数据源文档 https://www.kancloud.cn/tracy5546/dynamic-datasource/content
|
||||||
|
dynamic:
|
||||||
|
# 性能分析插件(有性能损耗 不建议生产环境使用)
|
||||||
|
p6spy: false
|
||||||
|
# 设置默认的数据源或者数据源组,默认值即为 master
|
||||||
|
primary: master
|
||||||
|
# 严格模式 匹配不到数据源则报错
|
||||||
|
strict: true
|
||||||
|
datasource:
|
||||||
|
# 主库数据源
|
||||||
|
master:
|
||||||
|
type: ${spring.datasource.type}
|
||||||
|
driverClassName: com.mysql.cj.jdbc.Driver
|
||||||
|
# jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562
|
||||||
|
# rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题)
|
||||||
|
url: jdbc:mysql://192.168.110.2:13386/xinnengyuanmenu?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
|
||||||
|
username: xinnengyuanmenu
|
||||||
|
password: 2RkXFG8ZE6r5LL7B
|
||||||
|
# # 从库数据源
|
||||||
|
# slave:
|
||||||
|
# lazy: true
|
||||||
|
# type: ${spring.datasource.type}
|
||||||
|
# driverClassName: com.mysql.cj.jdbc.Driver
|
||||||
|
# url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
|
||||||
|
# username:
|
||||||
|
# password:
|
||||||
|
# oracle:
|
||||||
|
# type: ${spring.datasource.type}
|
||||||
|
# driverClassName: oracle.jdbc.OracleDriver
|
||||||
|
# url: jdbc:oracle:thin:@//localhost:1521/XE
|
||||||
|
# username: ROOT
|
||||||
|
# password: root
|
||||||
|
# postgres:
|
||||||
|
# type: ${spring.datasource.type}
|
||||||
|
# driverClassName: org.postgresql.Driver
|
||||||
|
# url: jdbc:postgresql://localhost:5432/postgres?useUnicode=true&characterEncoding=utf8&useSSL=true&autoReconnect=true&reWriteBatchedInserts=true
|
||||||
|
# username: root
|
||||||
|
# password: root
|
||||||
|
# sqlserver:
|
||||||
|
# type: ${spring.datasource.type}
|
||||||
|
# driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver
|
||||||
|
# url: jdbc:sqlserver://localhost:1433;DatabaseName=tempdb;SelectMethod=cursor;encrypt=false;rewriteBatchedStatements=true
|
||||||
|
# username: SA
|
||||||
|
# password: root
|
||||||
|
hikari:
|
||||||
|
# 最大连接池数量
|
||||||
|
maxPoolSize: 20
|
||||||
|
# 最小空闲线程数量
|
||||||
|
minIdle: 10
|
||||||
|
# 配置获取连接等待超时的时间
|
||||||
|
connectionTimeout: 30000
|
||||||
|
# 校验超时时间
|
||||||
|
validationTimeout: 5000
|
||||||
|
# 空闲连接存活最大时间,默认10分钟
|
||||||
|
idleTimeout: 600000
|
||||||
|
# 此属性控制池中连接的最长生命周期,值0表示无限生命周期,默认30分钟
|
||||||
|
maxLifetime: 1800000
|
||||||
|
# 多久检查一次连接的活性
|
||||||
|
keepaliveTime: 30000
|
||||||
|
|
||||||
|
--- # redis 单机配置(单机与集群只能开启一个另一个需要注释掉)
|
||||||
|
spring.data:
|
||||||
|
redis:
|
||||||
|
# 地址
|
||||||
|
host: 192.168.110.2
|
||||||
|
# 端口,默认为6379
|
||||||
|
port: 9287
|
||||||
|
# 数据库索引
|
||||||
|
database: 21
|
||||||
|
# redis 密码必须配置
|
||||||
|
password: syar23rdsaagdrsa
|
||||||
|
# 连接超时时间
|
||||||
|
timeout: 10s
|
||||||
|
# 是否开启ssl
|
||||||
|
ssl.enabled: false
|
||||||
|
|
||||||
|
# redisson 配置
|
||||||
|
redisson:
|
||||||
|
# redis key前缀
|
||||||
|
keyPrefix:
|
||||||
|
# 线程池数量
|
||||||
|
threads: 16
|
||||||
|
# Netty线程池数量
|
||||||
|
nettyThreads: 32
|
||||||
|
# 单节点配置
|
||||||
|
singleServerConfig:
|
||||||
|
# 客户端名称
|
||||||
|
clientName: ${ruoyi.name}
|
||||||
|
# 最小空闲连接数
|
||||||
|
connectionMinimumIdleSize: 32
|
||||||
|
# 连接池大小
|
||||||
|
connectionPoolSize: 64
|
||||||
|
# 连接空闲超时,单位:毫秒
|
||||||
|
idleConnectionTimeout: 10000
|
||||||
|
# 命令等待超时,单位:毫秒
|
||||||
|
timeout: 3000
|
||||||
|
# 发布和订阅连接池大小
|
||||||
|
subscriptionConnectionPoolSize: 50
|
||||||
|
|
||||||
|
--- # mail 邮件发送
|
||||||
|
mail:
|
||||||
|
enabled: false
|
||||||
|
host: smtp.163.com
|
||||||
|
port: 465
|
||||||
|
# 是否需要用户名密码验证
|
||||||
|
auth: true
|
||||||
|
# 发送方,遵循RFC-822标准
|
||||||
|
from: xxx@163.com
|
||||||
|
# 用户名(注意:如果使用foxmail邮箱,此处user为qq号)
|
||||||
|
user: xxx@163.com
|
||||||
|
# 密码(注意,某些邮箱需要为SMTP服务单独设置密码,详情查看相关帮助)
|
||||||
|
pass: xxxxxxxxxx
|
||||||
|
# 使用 STARTTLS安全连接,STARTTLS是对纯文本通信协议的扩展。
|
||||||
|
starttlsEnable: true
|
||||||
|
# 使用SSL安全连接
|
||||||
|
sslEnable: true
|
||||||
|
# SMTP超时时长,单位毫秒,缺省值不超时
|
||||||
|
timeout: 0
|
||||||
|
# Socket连接超时值,单位毫秒,缺省值不超时
|
||||||
|
connectionTimeout: 0
|
||||||
|
|
||||||
|
--- # sms 短信 支持 阿里云 腾讯云 云片 等等各式各样的短信服务商
|
||||||
|
# https://sms4j.com/doc3/ 差异配置文档地址 支持单厂商多配置,可以配置多个同时使用
|
||||||
|
sms:
|
||||||
|
# 配置源类型用于标定配置来源(interface,yaml)
|
||||||
|
config-type: yaml
|
||||||
|
# 用于标定yml中的配置是否开启短信拦截,接口配置不受此限制
|
||||||
|
restricted: false
|
||||||
|
# 短信拦截限制单手机号每分钟最大发送,只对开启了拦截的配置有效
|
||||||
|
minute-max: 1
|
||||||
|
# 短信拦截限制单手机号每日最大发送量,只对开启了拦截的配置有效
|
||||||
|
account-max: 30
|
||||||
|
# 以下配置来自于 org.dromara.sms4j.provider.config.BaseConfig类中
|
||||||
|
blends:
|
||||||
|
# 唯一ID 用于发送短信寻找具体配置 随便定义别用中文即可
|
||||||
|
# 可以同时存在两个相同厂商 例如: ali1 ali2 两个不同的阿里短信账号 也可用于区分租户
|
||||||
|
config1:
|
||||||
|
# 框架定义的厂商名称标识,标定此配置是哪个厂商,详细请看厂商标识介绍部分
|
||||||
|
supplier: alibaba
|
||||||
|
# 有些称为accessKey有些称之为apiKey,也有称为sdkKey或者appId。
|
||||||
|
access-key-id: 您的accessKey
|
||||||
|
# 称为accessSecret有些称之为apiSecret
|
||||||
|
access-key-secret: 您的accessKeySecret
|
||||||
|
signature: 您的短信签名
|
||||||
|
sdk-app-id: 您的sdkAppId
|
||||||
|
config2:
|
||||||
|
# 登录
|
||||||
|
supplier: tencent
|
||||||
|
access-key-id: AKIDb3JK5dx4wa0DCxWqvxlKejvysZ3ITVJv
|
||||||
|
access-key-secret: c5LPFsJI8k7GDxTkoeFj4A1ukQr66rPi
|
||||||
|
signature: 重庆远界大数据研究院
|
||||||
|
sdk-app-id: 1401018866
|
||||||
|
template-id: 2491779
|
||||||
|
config3:
|
||||||
|
# 注册
|
||||||
|
supplier: tencent
|
||||||
|
access-key-id: AKIDb3JK5dx4wa0DCxWqvxlKejvysZ3ITVJv
|
||||||
|
access-key-secret: c5LPFsJI8k7GDxTkoeFj4A1ukQr66rPi
|
||||||
|
signature: 重庆远界大数据研究院
|
||||||
|
sdk-app-id: 1401018866
|
||||||
|
template-id: 2491776
|
||||||
|
config4:
|
||||||
|
# 质量工单逾期
|
||||||
|
supplier: tencent
|
||||||
|
access-key-id: AKIDb3JK5dx4wa0DCxWqvxlKejvysZ3ITVJv
|
||||||
|
access-key-secret: c5LPFsJI8k7GDxTkoeFj4A1ukQr66rPi
|
||||||
|
signature: 重庆远界大数据研究院
|
||||||
|
sdk-app-id: 1401018866
|
||||||
|
template-id: 2534747
|
||||||
|
config5:
|
||||||
|
# 设计图纸
|
||||||
|
supplier: tencent
|
||||||
|
access-key-id: AKIDb3JK5dx4wa0DCxWqvxlKejvysZ3ITVJv
|
||||||
|
access-key-secret: c5LPFsJI8k7GDxTkoeFj4A1ukQr66rPi
|
||||||
|
signature: 重庆远界大数据研究院
|
||||||
|
sdk-app-id: 1401018866
|
||||||
|
template-id: 2534750
|
||||||
|
config6:
|
||||||
|
# 安全工单
|
||||||
|
supplier: tencent
|
||||||
|
access-key-id: AKIDb3JK5dx4wa0DCxWqvxlKejvysZ3ITVJv
|
||||||
|
access-key-secret: c5LPFsJI8k7GDxTkoeFj4A1ukQr66rPi
|
||||||
|
signature: 重庆远界大数据研究院
|
||||||
|
sdk-app-id: 1401018866
|
||||||
|
template-id: 2534848
|
||||||
|
|
||||||
|
--- # 三方授权
|
||||||
|
justauth:
|
||||||
|
# 前端外网访问地址
|
||||||
|
address: http://localhost:80
|
||||||
|
type:
|
||||||
|
maxkey:
|
||||||
|
# maxkey 服务器地址
|
||||||
|
# 注意 如下均配置均不需要修改 maxkey 已经内置好了数据
|
||||||
|
server-url: http://sso.maxkey.top
|
||||||
|
client-id: 876892492581044224
|
||||||
|
client-secret: x1Y5MTMwNzIwMjMxNTM4NDc3Mzche8
|
||||||
|
redirect-uri: ${justauth.address}/social-callback?source=maxkey
|
||||||
|
topiam:
|
||||||
|
# topiam 服务器地址
|
||||||
|
server-url: http://127.0.0.1:1989/api/v1/authorize/y0q************spq***********8ol
|
||||||
|
client-id: 449c4*********937************759
|
||||||
|
client-secret: ac7***********1e0************28d
|
||||||
|
redirect-uri: ${justauth.address}/social-callback?source=topiam
|
||||||
|
scopes: [ openid, email, phone, profile ]
|
||||||
|
qq:
|
||||||
|
client-id: 10**********6
|
||||||
|
client-secret: 1f7d08**********5b7**********29e
|
||||||
|
redirect-uri: ${justauth.address}/social-callback?source=qq
|
||||||
|
union-id: false
|
||||||
|
weibo:
|
||||||
|
client-id: 10**********6
|
||||||
|
client-secret: 1f7d08**********5b7**********29e
|
||||||
|
redirect-uri: ${justauth.address}/social-callback?source=weibo
|
||||||
|
gitee:
|
||||||
|
client-id: 91436b7940090d09c72c7daf85b959cfd5f215d67eea73acbf61b6b590751a98
|
||||||
|
client-secret: 02c6fcfd70342980cd8dd2f2c06c1a350645d76c754d7a264c4e125f9ba915ac
|
||||||
|
redirect-uri: ${justauth.address}/social-callback?source=gitee
|
||||||
|
dingtalk:
|
||||||
|
client-id: 10**********6
|
||||||
|
client-secret: 1f7d08**********5b7**********29e
|
||||||
|
redirect-uri: ${justauth.address}/social-callback?source=dingtalk
|
||||||
|
baidu:
|
||||||
|
client-id: 10**********6
|
||||||
|
client-secret: 1f7d08**********5b7**********29e
|
||||||
|
redirect-uri: ${justauth.address}/social-callback?source=baidu
|
||||||
|
csdn:
|
||||||
|
client-id: 10**********6
|
||||||
|
client-secret: 1f7d08**********5b7**********29e
|
||||||
|
redirect-uri: ${justauth.address}/social-callback?source=csdn
|
||||||
|
coding:
|
||||||
|
client-id: 10**********6
|
||||||
|
client-secret: 1f7d08**********5b7**********29e
|
||||||
|
redirect-uri: ${justauth.address}/social-callback?source=coding
|
||||||
|
coding-group-name: xx
|
||||||
|
oschina:
|
||||||
|
client-id: 10**********6
|
||||||
|
client-secret: 1f7d08**********5b7**********29e
|
||||||
|
redirect-uri: ${justauth.address}/social-callback?source=oschina
|
||||||
|
alipay_wallet:
|
||||||
|
client-id: 10**********6
|
||||||
|
client-secret: 1f7d08**********5b7**********29e
|
||||||
|
redirect-uri: ${justauth.address}/social-callback?source=alipay_wallet
|
||||||
|
alipay-public-key: MIIB**************DAQAB
|
||||||
|
wechat_open:
|
||||||
|
client-id: 10**********6
|
||||||
|
client-secret: 1f7d08**********5b7**********29e
|
||||||
|
redirect-uri: ${justauth.address}/social-callback?source=wechat_open
|
||||||
|
wechat_mp:
|
||||||
|
client-id: 10**********6
|
||||||
|
client-secret: 1f7d08**********5b7**********29e
|
||||||
|
redirect-uri: ${justauth.address}/social-callback?source=wechat_mp
|
||||||
|
wechat_enterprise:
|
||||||
|
client-id: 10**********6
|
||||||
|
client-secret: 1f7d08**********5b7**********29e
|
||||||
|
redirect-uri: ${justauth.address}/social-callback?source=wechat_enterprise
|
||||||
|
agent-id: 1000002
|
||||||
|
gitlab:
|
||||||
|
client-id: 10**********6
|
||||||
|
client-secret: 1f7d08**********5b7**********29e
|
||||||
|
redirect-uri: ${justauth.address}/social-callback?source=gitlab
|
||||||
|
# 和风天气 https://dev.qweather.com/
|
||||||
|
weather:
|
||||||
|
key-id: T65EAABUXC
|
||||||
|
project-id: 2JTHPUQ5YY
|
||||||
|
private-key: MC4CAQAwBQYDK2VwBCIEIMAglX7IsxYiTeM+FXXnvCUsIggajeP4s8gAllewm6BN
|
||||||
|
api-host: n35rk53njv.re.qweatherapi.com
|
||||||
|
# dxf转 geojson 执行文件名
|
||||||
|
dxf2GeoJson:
|
||||||
|
file-name: main
|
||||||
|
ys7:
|
||||||
|
app-key: xxx
|
||||||
|
app-secret: xxx
|
||||||
|
job:
|
||||||
|
capture-enabled: false # 控制是否启用萤石抓拍任务
|
||||||
|
device-sync-enabled: false # 控制是否同步萤石设备
|
||||||
|
# 斯巴达算法
|
||||||
|
sparta:
|
||||||
|
url: http://119.3.204.120:8040
|
||||||
|
client-id: test
|
||||||
|
client-secret: 115fcb08fa6742a1b086d9bb80a6ad59
|
||||||
|
# 身份证加密密钥(32 位)
|
||||||
|
id-card:
|
||||||
|
encrypt-key: 7ae260d150a14027d2238a1cf80a48ef
|
||||||
|
recognizer:
|
||||||
|
url: http://192.168.110.5:50071
|
||||||
|
|
||||||
|
qrCode:
|
||||||
|
url: http://xny.yj-3d.com:7788
|
||||||
|
# 无人机大图
|
||||||
|
drone:
|
||||||
|
url: http://192.168.110.2:9512
|
||||||
|
# 聊天服务
|
||||||
|
chat:
|
||||||
|
server:
|
||||||
|
port: 18088
|
||||||
|
# rabbitmq 配置
|
||||||
|
rabbitmq:
|
||||||
|
exchange-name: local-normal-exchange
|
||||||
|
queue-name: local-normal-queue
|
||||||
|
routing-key: local.normal.routing.key
|
||||||
|
delay-exchange-name: local-delay-queue
|
||||||
|
delay-queue-name: local-delay-exchange
|
||||||
|
delay-routing-key: local.delay.routing.key
|
||||||
|
dead-letter-exchange: local-dlx-exchange
|
||||||
|
dead-letter-queue: local-dlx-queue
|
||||||
|
dead-letter-routing-key: local.dlx.routing.key
|
||||||
@ -358,3 +358,14 @@ drone:
|
|||||||
chat:
|
chat:
|
||||||
server:
|
server:
|
||||||
port: 19099
|
port: 19099
|
||||||
|
# rabbitmq 配置
|
||||||
|
rabbitmq:
|
||||||
|
exchange-name: prod-normal-exchange
|
||||||
|
queue-name: prod-normal-queue
|
||||||
|
routing-key: prod.normal.routing.key
|
||||||
|
delay-exchange-name: prod-delay-queue
|
||||||
|
delay-queue-name: prod-delay-exchange
|
||||||
|
delay-routing-key: prod.delay.routing.key
|
||||||
|
dead-letter-exchange: prod-dlx-exchange
|
||||||
|
dead-letter-queue: prod-dlx-queue
|
||||||
|
dead-letter-routing-key: prod.dlx.routing.key
|
||||||
|
|||||||
@ -76,9 +76,9 @@ spring:
|
|||||||
servlet:
|
servlet:
|
||||||
multipart:
|
multipart:
|
||||||
# 单个文件大小
|
# 单个文件大小
|
||||||
max-file-size: 200MB
|
max-file-size: 1024MB
|
||||||
# 设置总上传的文件大小
|
# 设置总上传的文件大小
|
||||||
max-request-size: 200MB
|
max-request-size: 1024MB
|
||||||
mvc:
|
mvc:
|
||||||
# 设置静态资源路径 防止所有请求都去查静态资源
|
# 设置静态资源路径 防止所有请求都去查静态资源
|
||||||
static-path-pattern: /static/**
|
static-path-pattern: /static/**
|
||||||
@ -95,7 +95,13 @@ spring:
|
|||||||
deserialization:
|
deserialization:
|
||||||
# 允许对象忽略json中不存在的属性
|
# 允许对象忽略json中不存在的属性
|
||||||
fail_on_unknown_properties: false
|
fail_on_unknown_properties: false
|
||||||
|
rabbitmq:
|
||||||
|
host: 192.168.110.2
|
||||||
|
port: 5672
|
||||||
|
username: admin
|
||||||
|
password: yuanjiexny
|
||||||
|
publisher-returns: true
|
||||||
|
publisher-confirm-type: correlated
|
||||||
# Sa-Token配置
|
# Sa-Token配置
|
||||||
sa-token:
|
sa-token:
|
||||||
# token名称 (同时也是cookie名称)
|
# token名称 (同时也是cookie名称)
|
||||||
@ -109,7 +115,7 @@ sa-token:
|
|||||||
# token有效期,单位s 默认30天, -1代表永不过期
|
# token有效期,单位s 默认30天, -1代表永不过期
|
||||||
timeout: 2592000
|
timeout: 2592000
|
||||||
# token临时有效期 (指定时间内无操作就视为token过期) 单位: 秒
|
# token临时有效期 (指定时间内无操作就视为token过期) 单位: 秒
|
||||||
active-timeout: 86400
|
active-timeout: 2592000
|
||||||
# 同一账号最大登录数量,-1代表不限
|
# 同一账号最大登录数量,-1代表不限
|
||||||
max-login-count: -1
|
max-login-count: -1
|
||||||
|
|
||||||
@ -176,7 +182,7 @@ mybatis-plus:
|
|||||||
# 数据加密
|
# 数据加密
|
||||||
mybatis-encryptor:
|
mybatis-encryptor:
|
||||||
# 是否开启加密
|
# 是否开启加密
|
||||||
enable: false
|
enable: true
|
||||||
# 默认加密算法
|
# 默认加密算法
|
||||||
algorithm: BASE64
|
algorithm: BASE64
|
||||||
# 编码方式 BASE64/HEX。默认BASE64
|
# 编码方式 BASE64/HEX。默认BASE64
|
||||||
@ -305,6 +311,12 @@ springdoc:
|
|||||||
packages-to-scan: org.dromara.ai
|
packages-to-scan: org.dromara.ai
|
||||||
- group: 31.投标管理模块
|
- group: 31.投标管理模块
|
||||||
packages-to-scan: org.dromara.bidding
|
packages-to-scan: org.dromara.bidding
|
||||||
|
- group: 32.设备模块
|
||||||
|
packages-to-scan: org.dromara.device
|
||||||
|
- group: 33.摄像头模块
|
||||||
|
packages-to-scan: org.dromara.other
|
||||||
|
- group: 34.机械模块
|
||||||
|
packages-to-scan: org.dromara.mechanical
|
||||||
# knife4j的增强配置,不需要增强可以不配
|
# knife4j的增强配置,不需要增强可以不配
|
||||||
knife4j:
|
knife4j:
|
||||||
enable: true
|
enable: true
|
||||||
|
|||||||
@ -1,14 +1,23 @@
|
|||||||
package org.dromara.test;
|
package org.dromara.test;
|
||||||
|
|
||||||
|
import cn.hutool.json.JSONUtil;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.dromara.common.core.utils.StringUtils;
|
||||||
import org.dromara.manager.recognizermanager.RecognizerManager;
|
import org.dromara.manager.recognizermanager.RecognizerManager;
|
||||||
import org.dromara.manager.recognizermanager.enums.RecognizerTypeEnum;
|
import org.dromara.manager.recognizermanager.enums.RecognizerTypeEnum;
|
||||||
import org.dromara.manager.recognizermanager.vo.RecognizeVo;
|
import org.dromara.manager.recognizermanager.vo.RecognizeVo;
|
||||||
|
import org.dromara.progress.domain.PgsProgressPlanDetail;
|
||||||
|
import org.dromara.progress.domain.vo.progressplandetail.PgsProgressPlanDetailFinishedVo;
|
||||||
|
import org.dromara.progress.service.IPgsProgressPlanDetailService;
|
||||||
|
import org.dromara.progress.service.IPgsProgressPlanService;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author lilemy
|
* @author lilemy
|
||||||
@ -21,6 +30,12 @@ public class RecognizerTest {
|
|||||||
@Resource
|
@Resource
|
||||||
private RecognizerManager recognizerManager;
|
private RecognizerManager recognizerManager;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IPgsProgressPlanDetailService progressPlanDetailService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IPgsProgressPlanService progressPlanService;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void test() {
|
void test() {
|
||||||
RecognizeVo recognize = recognizerManager.recognize("http://xny.yj-3d.com:7363/file/tif/20250625160218orthophoto.png", List.of(RecognizerTypeEnum.PANEL));
|
RecognizeVo recognize = recognizerManager.recognize("http://xny.yj-3d.com:7363/file/tif/20250625160218orthophoto.png", List.of(RecognizerTypeEnum.PANEL));
|
||||||
@ -31,4 +46,39 @@ public class RecognizerTest {
|
|||||||
void testChange() {
|
void testChange() {
|
||||||
recognizerManager.convertCoordinate("http://xny.yj-3d.com:9000/xinnengyuan-dev/2025/11/11/d48767a62bc04867a552e06ba6712004.tif", List.of());
|
recognizerManager.convertCoordinate("http://xny.yj-3d.com:9000/xinnengyuan-dev/2025/11/11/d48767a62bc04867a552e06ba6712004.tif", List.of());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void checkNumber() {
|
||||||
|
List<PgsProgressPlanDetail> detailList = progressPlanDetailService.list();
|
||||||
|
List<PgsProgressPlanDetail> planDetailList = detailList.stream()
|
||||||
|
.filter(detail -> StringUtils.isNotBlank(detail.getFinishedDetail()))
|
||||||
|
.toList();
|
||||||
|
Map<String, List<PgsProgressPlanDetail>> collect = planDetailList.stream()
|
||||||
|
.collect(Collectors.groupingBy(PgsProgressPlanDetail::getFinishedDetail));
|
||||||
|
// 遍历分组结果,输出重复项
|
||||||
|
for (Map.Entry<String, List<PgsProgressPlanDetail>> entry : collect.entrySet()) {
|
||||||
|
String fieldValue = entry.getKey();
|
||||||
|
List<PgsProgressPlanDetail> duplicates = entry.getValue();
|
||||||
|
if (duplicates.size() > 1) { // 筛选出有重复的字段值
|
||||||
|
PgsProgressPlanDetail first = duplicates.getFirst();
|
||||||
|
Long id = first.getId();
|
||||||
|
Long planId = first.getProgressPlanId();
|
||||||
|
progressPlanService.removeById(planId);
|
||||||
|
progressPlanDetailService.removeById(id);
|
||||||
|
System.out.println("重复对象的对象:" + duplicates.stream().map(PgsProgressPlanDetail::getId).toList());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (PgsProgressPlanDetail detail : detailList) {
|
||||||
|
BigDecimal aiFill = detail.getFinishedNumber();
|
||||||
|
String finishedDetail = detail.getFinishedDetail();
|
||||||
|
if (StringUtils.isBlank(finishedDetail)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// log.info("id: {}, finishedDetail: {}", detail.getId(), finishedDetail);
|
||||||
|
List<PgsProgressPlanDetailFinishedVo> finishedVos = JSONUtil.toList(finishedDetail, PgsProgressPlanDetailFinishedVo.class);
|
||||||
|
if (aiFill.compareTo(BigDecimal.valueOf(finishedVos.size())) != 0) {
|
||||||
|
log.info("数量异常:{}:{}", detail.getId(), detail.getProgressCategoryId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -59,6 +59,18 @@ public class AsyncConfig implements AsyncConfigurer {
|
|||||||
return executor;
|
return executor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 解压线程池(大文件操作,不需要太多线程)
|
||||||
|
@Bean("unzipExecutor")
|
||||||
|
public Executor unzipExecutor() {
|
||||||
|
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||||
|
executor.setCorePoolSize(2);
|
||||||
|
executor.setMaxPoolSize(4);
|
||||||
|
executor.setQueueCapacity(10);
|
||||||
|
executor.setThreadNamePrefix("unzip-");
|
||||||
|
executor.initialize();
|
||||||
|
return executor;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 异步执行异常处理
|
* 异步执行异常处理
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -0,0 +1,6 @@
|
|||||||
|
package org.dromara.common.core.service;
|
||||||
|
|
||||||
|
public interface XzdSjContractInfoService {
|
||||||
|
|
||||||
|
String selectNameByIds(String ids);
|
||||||
|
}
|
||||||
@ -0,0 +1,146 @@
|
|||||||
|
package org.dromara.common.core.utils;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DatePattern;
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.TimeZone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 时间戳转换工具类(包含时分秒提取)
|
||||||
|
*/
|
||||||
|
public class TimestampUtils {
|
||||||
|
|
||||||
|
// 默认时区(东八区)
|
||||||
|
private static final TimeZone DEFAULT_TIME_ZONE = TimeZone.getTimeZone("GMT+8");
|
||||||
|
|
||||||
|
// 完整日期格式
|
||||||
|
private static final String FULL_DATE_FORMAT = "yyyy-MM-dd HH:mm:ss";
|
||||||
|
|
||||||
|
// 时分秒格式
|
||||||
|
private static final String TIME_FORMAT = "HH:mm:ss";
|
||||||
|
|
||||||
|
// 日期格式
|
||||||
|
private static final String DATE_FORMAT = "yyyy-MM-dd";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将日期字符串转为秒级时间戳(优化版)
|
||||||
|
* 支持格式:"2025-12-03 23:59:59"、"2025-12-03"等
|
||||||
|
* @param dateStr 日期字符串
|
||||||
|
* @return 秒级时间戳
|
||||||
|
*/
|
||||||
|
public static Long parseDateToTimestamp(String dateStr) {
|
||||||
|
if (StrUtil.isBlank(dateStr)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 使用Hutool的DateUtil进行智能解析(推荐)
|
||||||
|
try {
|
||||||
|
Date date = DateUtil.parse(dateStr);
|
||||||
|
return date.getTime() / 1000L; // 转为秒级时间戳
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new IllegalArgumentException(
|
||||||
|
String.format("日期格式错误:%s,支持格式:yyyy-MM-dd HH:mm:ss、yyyy-MM-dd等", dateStr)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将时间戳转换为完整日期格式(yyyy-MM-dd HH:mm:ss)
|
||||||
|
*/
|
||||||
|
public static String formatTimestamp(Object timestamp) {
|
||||||
|
if (timestamp == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
String timestampStr = timestamp.toString().trim();
|
||||||
|
if (StrUtil.isBlank(timestampStr)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Long time = parseToMilliseconds(timestampStr);
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat(FULL_DATE_FORMAT);
|
||||||
|
sdf.setTimeZone(DEFAULT_TIME_ZONE);
|
||||||
|
return sdf.format(new Date(time));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提取时间戳中的时分秒部分(HH:mm:ss)
|
||||||
|
*/
|
||||||
|
public static String extractTime(Object timestamp) {
|
||||||
|
if (timestamp == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
String timestampStr = timestamp.toString().trim();
|
||||||
|
if (StrUtil.isBlank(timestampStr)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Long time = parseToMilliseconds(timestampStr);
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat(TIME_FORMAT);
|
||||||
|
sdf.setTimeZone(DEFAULT_TIME_ZONE);
|
||||||
|
return sdf.format(new Date(time));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提取时间戳中的日期部分(yyyy-MM-dd)
|
||||||
|
*/
|
||||||
|
public static String extractDate(Object timestamp) {
|
||||||
|
if (timestamp == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
String timestampStr = timestamp.toString().trim();
|
||||||
|
if (StrUtil.isBlank(timestampStr)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Long time = parseToMilliseconds(timestampStr);
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
|
||||||
|
sdf.setTimeZone(DEFAULT_TIME_ZONE);
|
||||||
|
return sdf.format(new Date(time));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 解析时间戳字符串为毫秒级时间戳
|
||||||
|
*/
|
||||||
|
private static Long parseToMilliseconds(String timestampStr) {
|
||||||
|
try {
|
||||||
|
Long time = Long.parseLong(timestampStr);
|
||||||
|
// 10位秒级时间戳转为13位毫秒级
|
||||||
|
if (timestampStr.length() == 10) {
|
||||||
|
time = time * 1000;
|
||||||
|
}
|
||||||
|
return time;
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
throw new IllegalArgumentException("时间戳格式错误:" + timestampStr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取时间戳对应的小时
|
||||||
|
*/
|
||||||
|
public static int getHour(Object timestamp) {
|
||||||
|
String timeStr = extractTime(timestamp);
|
||||||
|
return Integer.parseInt(timeStr.split(":")[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取时间戳对应的分钟
|
||||||
|
*/
|
||||||
|
public static int getMinute(Object timestamp) {
|
||||||
|
String timeStr = extractTime(timestamp);
|
||||||
|
return Integer.parseInt(timeStr.split(":")[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取时间戳对应的秒
|
||||||
|
*/
|
||||||
|
public static int getSecond(Object timestamp) {
|
||||||
|
String timeStr = extractTime(timestamp);
|
||||||
|
return Integer.parseInt(timeStr.split(":")[2]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -45,6 +45,16 @@
|
|||||||
<groupId>com.github.xiaoymin</groupId>
|
<groupId>com.github.xiaoymin</groupId>
|
||||||
<artifactId>knife4j-openapi3-jakarta-spring-boot-starter</artifactId>
|
<artifactId>knife4j-openapi3-jakarta-spring-boot-starter</artifactId>
|
||||||
<version>4.5.0</version>
|
<version>4.5.0</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.springdoc</groupId>
|
||||||
|
<artifactId>springdoc-openapi-starter-webmvc-api</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.springdoc</groupId>
|
||||||
|
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|||||||
@ -110,15 +110,6 @@ public class SpringDocConfig {
|
|||||||
}
|
}
|
||||||
PlusPaths newPaths = new PlusPaths();
|
PlusPaths newPaths = new PlusPaths();
|
||||||
oldPaths.forEach((k, v) -> newPaths.addPathItem(finalContextPath + k, v));
|
oldPaths.forEach((k, v) -> newPaths.addPathItem(finalContextPath + k, v));
|
||||||
newPaths.forEach((s, pathItem) -> {
|
|
||||||
// 为所有接口添加鉴权
|
|
||||||
pathItem.readOperations().forEach(operation -> {
|
|
||||||
operation.addSecurityItem(new SecurityRequirement()
|
|
||||||
.addList(HttpHeaders.AUTHORIZATION)
|
|
||||||
.addList("Clientid")
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
openApi.setPaths(newPaths);
|
openApi.setPaths(newPaths);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -91,7 +91,7 @@ public class PlusDataPermissionHandler {
|
|||||||
DataPermissionHelper.setVariable("user", currentUser);
|
DataPermissionHelper.setVariable("user", currentUser);
|
||||||
}
|
}
|
||||||
// 如果是超级管理员或租户管理员,则不过滤数据
|
// 如果是超级管理员或租户管理员,则不过滤数据
|
||||||
if (LoginHelper.isSuperAdmin() || LoginHelper.isTenantAdmin()) {
|
if (LoginHelper.isSuperAdmin()) {
|
||||||
return where;
|
return where;
|
||||||
}
|
}
|
||||||
// 构造数据过滤条件的 SQL 片段
|
// 构造数据过滤条件的 SQL 片段
|
||||||
|
|||||||
@ -82,5 +82,10 @@ public interface TransConstant {
|
|||||||
*/
|
*/
|
||||||
String XZD_CBYS_ZJHCB_ID_TO_NAME = "xzd_cbys_zjhcb_id_to_name";
|
String XZD_CBYS_ZJHCB_ID_TO_NAME = "xzd_cbys_zjhcb_id_to_name";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新中大-设计合同信息id转name
|
||||||
|
*/
|
||||||
|
String XZD_SJ_CONTRACT_INFO_ID_TO_NAME = "xzd_sj_contract_info_id_to_name";
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,24 @@
|
|||||||
|
package org.dromara.common.translation.core.impl;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import org.dromara.common.core.service.XzdSjContractInfoService;
|
||||||
|
import org.dromara.common.core.service.XzdSupplierOpenBankService;
|
||||||
|
import org.dromara.common.translation.annotation.TranslationType;
|
||||||
|
import org.dromara.common.translation.constant.TransConstant;
|
||||||
|
import org.dromara.common.translation.core.TranslationInterface;
|
||||||
|
|
||||||
|
@AllArgsConstructor
|
||||||
|
@TranslationType(type = TransConstant.XZD_SJ_CONTRACT_INFO_ID_TO_NAME)
|
||||||
|
public class XzdSjContractInfoImpl implements TranslationInterface<String> {
|
||||||
|
|
||||||
|
private final XzdSjContractInfoService xzdSjContractInfoService;
|
||||||
|
@Override
|
||||||
|
public String translation(Object key, String other) {
|
||||||
|
if (key instanceof String ids) {
|
||||||
|
return xzdSjContractInfoService.selectNameByIds(ids);
|
||||||
|
} else if (key instanceof Long id) {
|
||||||
|
return xzdSjContractInfoService.selectNameByIds(id.toString());
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -14,3 +14,4 @@ org.dromara.common.translation.core.impl.XzdSupplierOpenBankImpl
|
|||||||
org.dromara.common.translation.core.impl.XzdProjectManagerApprovalImpl
|
org.dromara.common.translation.core.impl.XzdProjectManagerApprovalImpl
|
||||||
org.dromara.common.translation.core.impl.XzdCbysZjhcbImpl
|
org.dromara.common.translation.core.impl.XzdCbysZjhcbImpl
|
||||||
org.dromara.common.translation.core.impl.XzdJXHTTranslation
|
org.dromara.common.translation.core.impl.XzdJXHTTranslation
|
||||||
|
org.dromara.common.translation.core.impl.XzdSjContractInfoImpl
|
||||||
|
|||||||
@ -29,6 +29,10 @@
|
|||||||
|
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-amqp</artifactId>
|
||||||
|
</dependency>
|
||||||
<!-- TwelveMonkeys ImageIO 扩展 -->
|
<!-- TwelveMonkeys ImageIO 扩展 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.twelvemonkeys.imageio</groupId>
|
<groupId>com.twelvemonkeys.imageio</groupId>
|
||||||
|
|||||||
@ -25,7 +25,7 @@ import java.util.concurrent.CompletableFuture;
|
|||||||
public class DashScopeChat {
|
public class DashScopeChat {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private SimpleChat simpleChat;
|
private DashScopeSimpleChat dashScopeSimpleChat;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private IAIChatMemoryService chatMemoryService;
|
private IAIChatMemoryService chatMemoryService;
|
||||||
@ -66,10 +66,8 @@ public class DashScopeChat {
|
|||||||
.collectList()
|
.collectList()
|
||||||
.flatMapMany(tokens -> {
|
.flatMapMany(tokens -> {
|
||||||
String aiResponse = String.join("", tokens);
|
String aiResponse = String.join("", tokens);
|
||||||
if (isFirst) {
|
// 异步生成标题
|
||||||
// 异步生成标题
|
generateChatTitleAsync(chatId, message, aiResponse, userId);
|
||||||
generateChatTitleAsync(chatId, message, aiResponse, userId);
|
|
||||||
}
|
|
||||||
// 返回完整的流结果
|
// 返回完整的流结果
|
||||||
return Flux.fromIterable(tokens);
|
return Flux.fromIterable(tokens);
|
||||||
});
|
});
|
||||||
@ -100,7 +98,7 @@ public class DashScopeChat {
|
|||||||
用户:%s
|
用户:%s
|
||||||
AI:%s
|
AI:%s
|
||||||
""", userMessage, aiResponse);
|
""", userMessage, aiResponse);
|
||||||
String title = simpleChat.doChat(prompt);
|
String title = dashScopeSimpleChat.doChat(prompt);
|
||||||
log.info("用户:{} 生成标题成功:{} -> {}", userId, chatId, title);
|
log.info("用户:{} 生成标题成功:{} -> {}", userId, chatId, title);
|
||||||
// 保存对话数据
|
// 保存对话数据
|
||||||
AIChatMemory memory = new AIChatMemory();
|
AIChatMemory memory = new AIChatMemory();
|
||||||
|
|||||||
@ -9,11 +9,11 @@ import org.springframework.stereotype.Component;
|
|||||||
* @date 2025-11-04 15:26
|
* @date 2025-11-04 15:26
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
public class SimpleChat {
|
public class DashScopeSimpleChat {
|
||||||
|
|
||||||
private final ChatClient dashScopeChatClient;
|
private final ChatClient dashScopeChatClient;
|
||||||
|
|
||||||
public SimpleChat(ChatClient.Builder chatClientBuilder) {
|
public DashScopeSimpleChat(ChatClient.Builder chatClientBuilder) {
|
||||||
this.dashScopeChatClient = chatClientBuilder
|
this.dashScopeChatClient = chatClientBuilder
|
||||||
// 设置 ChatClient 中 ChatModel 的 Options 参数
|
// 设置 ChatClient 中 ChatModel 的 Options 参数
|
||||||
.defaultOptions(
|
.defaultOptions(
|
||||||
@ -41,7 +41,6 @@ import org.dromara.patch.service.IPdMasterService;
|
|||||||
import org.dromara.project.service.IBusProjectService;
|
import org.dromara.project.service.IBusProjectService;
|
||||||
import org.dromara.system.domain.SysMenu;
|
import org.dromara.system.domain.SysMenu;
|
||||||
import org.dromara.system.domain.vo.RouterVo;
|
import org.dromara.system.domain.vo.RouterVo;
|
||||||
import org.dromara.system.mapper.SysRoleMapper;
|
|
||||||
import org.dromara.system.service.impl.SysMenuServiceImpl;
|
import org.dromara.system.service.impl.SysMenuServiceImpl;
|
||||||
import org.dromara.system.service.impl.SysUserServiceImpl;
|
import org.dromara.system.service.impl.SysUserServiceImpl;
|
||||||
import org.dromara.warm.flow.core.FlowEngine;
|
import org.dromara.warm.flow.core.FlowEngine;
|
||||||
@ -97,8 +96,7 @@ public class PersonalHomeController extends BaseController {
|
|||||||
@Resource
|
@Resource
|
||||||
private IBusProjectService projectService;
|
private IBusProjectService projectService;
|
||||||
|
|
||||||
private final SysRoleMapper roleMapper;
|
private final SysMenuServiceImpl sysMenuService;
|
||||||
private final SysMenuServiceImpl sysMenuService;
|
|
||||||
|
|
||||||
// region AI 模块
|
// region AI 模块
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,39 @@
|
|||||||
|
package org.dromara.bigscreen.controller;
|
||||||
|
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.dromara.bigscreen.domain.vo.ProjectPeopleVo;
|
||||||
|
import org.dromara.bigscreen.service.ProjectBigScreenService;
|
||||||
|
import org.dromara.common.core.domain.R;
|
||||||
|
import org.dromara.project.domain.vo.project.BusProjectVo;
|
||||||
|
import org.dromara.project.service.IBusProjectService;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* UE大屏
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-11-04
|
||||||
|
*/
|
||||||
|
@Validated
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/UE/screen")
|
||||||
|
public class UEController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IBusProjectService projectService;
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/projectInfo/{projectId}")
|
||||||
|
public R<BusProjectVo> getProjectPeople(@NotNull(message = "主键不能为空")
|
||||||
|
@PathVariable Long projectId) {
|
||||||
|
return R.ok(projectService.selectById(projectId));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -1,6 +1,7 @@
|
|||||||
package org.dromara.cailiaoshebei.service.impl;
|
package org.dromara.cailiaoshebei.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import com.alibaba.excel.EasyExcel;
|
import com.alibaba.excel.EasyExcel;
|
||||||
import com.alibaba.excel.ExcelReader;
|
import com.alibaba.excel.ExcelReader;
|
||||||
import com.alibaba.excel.read.metadata.ReadSheet;
|
import com.alibaba.excel.read.metadata.ReadSheet;
|
||||||
@ -104,7 +105,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(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());
|
||||||
@ -239,7 +240,14 @@ public class BusTotalsupplyplanServiceImpl extends ServiceImpl<BusTotalsupplypla
|
|||||||
}
|
}
|
||||||
// 关闭读取器
|
// 关闭读取器
|
||||||
excelReader.finish();
|
excelReader.finish();
|
||||||
if (allData.isEmpty()) {
|
if (CollUtil.isEmpty(allData)) {
|
||||||
|
throw new ServiceException("未读取到有效数据", HttpStatus.BAD_REQUEST);
|
||||||
|
}
|
||||||
|
// 过滤 id 为空的数据
|
||||||
|
allData = allData.stream()
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.filter(data -> data.getId() != null).toList();
|
||||||
|
if (CollUtil.isEmpty(allData)) {
|
||||||
throw new ServiceException("未读取到有效数据", HttpStatus.BAD_REQUEST);
|
throw new ServiceException("未读取到有效数据", HttpStatus.BAD_REQUEST);
|
||||||
}
|
}
|
||||||
// 处理导入的数据
|
// 处理导入的数据
|
||||||
@ -248,7 +256,7 @@ public class BusTotalsupplyplanServiceImpl extends ServiceImpl<BusTotalsupplypla
|
|||||||
return this.updateBatchById(list);
|
return this.updateBatchById(list);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("物资供货总计划,导入Excel文件失败", e);
|
log.error("物资供货总计划,导入Excel文件失败", e);
|
||||||
throw new ServiceException("导入失败: " + e.getMessage(), HttpStatus.ERROR);
|
throw new ServiceException("导入失败, " + e.getMessage(), HttpStatus.ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package org.dromara.common.utils;
|
package org.dromara.common.utils;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.dromara.common.core.utils.MessageUtils;
|
import org.dromara.common.core.utils.MessageUtils;
|
||||||
@ -9,6 +10,8 @@ import org.dromara.contractor.domain.SubConstructionUser;
|
|||||||
import org.dromara.mobileAttendanceMachine.DeviceMessageSender;
|
import org.dromara.mobileAttendanceMachine.DeviceMessageSender;
|
||||||
import org.dromara.mobileAttendanceMachine.KqjEntity;
|
import org.dromara.mobileAttendanceMachine.KqjEntity;
|
||||||
import org.dromara.project.domain.BusAttendanceMachine;
|
import org.dromara.project.domain.BusAttendanceMachine;
|
||||||
|
import org.dromara.project.domain.BusAttendanceMachineRepeat;
|
||||||
|
import org.dromara.project.service.IBusAttendanceMachineRepeatService;
|
||||||
import org.dromara.project.service.IBusAttendanceMachineService;
|
import org.dromara.project.service.IBusAttendanceMachineService;
|
||||||
import org.dromara.sms4j.api.SmsBlend;
|
import org.dromara.sms4j.api.SmsBlend;
|
||||||
import org.dromara.sms4j.api.entity.SmsResponse;
|
import org.dromara.sms4j.api.entity.SmsResponse;
|
||||||
@ -19,6 +22,7 @@ import org.springframework.context.annotation.Lazy;
|
|||||||
import org.springframework.scheduling.annotation.Async;
|
import org.springframework.scheduling.annotation.Async;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -36,6 +40,9 @@ public class AsyncUtil {
|
|||||||
@Lazy
|
@Lazy
|
||||||
private IBusAttendanceMachineService attendanceMachineService;
|
private IBusAttendanceMachineService attendanceMachineService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IBusAttendanceMachineRepeatService busAttendanceMachineRepeatService;
|
||||||
|
|
||||||
//发送短信
|
//发送短信
|
||||||
@Async
|
@Async
|
||||||
public void sendSms(List<String> mobileList, String config) {
|
public void sendSms(List<String> mobileList, String config) {
|
||||||
@ -63,22 +70,107 @@ public class AsyncUtil {
|
|||||||
public void sendPersonnel(Long teamId, SubConstructionUser constructionUser) {
|
public void sendPersonnel(Long teamId, SubConstructionUser constructionUser) {
|
||||||
SysOssVo byId = ossService.getById(Long.valueOf(constructionUser.getFacePic()));
|
SysOssVo byId = ossService.getById(Long.valueOf(constructionUser.getFacePic()));
|
||||||
List<BusAttendanceMachine> list = attendanceMachineService.lambdaQuery().apply("FIND_IN_SET({0}, teams)", teamId).list();
|
List<BusAttendanceMachine> list = attendanceMachineService.lambdaQuery().apply("FIND_IN_SET({0}, teams)", teamId).list();
|
||||||
|
|
||||||
|
ArrayList<BusAttendanceMachineRepeat> repeats = new ArrayList<>();
|
||||||
for (BusAttendanceMachine machine : list) {
|
for (BusAttendanceMachine machine : list) {
|
||||||
deviceMessageSender.sendPersonnelInformation(machine.getSn(), constructionUser.getSysUserId().toString(), constructionUser.getUserName(), byId.getUrl());
|
Boolean b = deviceMessageSender.sendPersonnelInformation(machine.getSn(),
|
||||||
|
constructionUser.getSysUserId().toString(), constructionUser.getUserName(), byId.getUrl());
|
||||||
|
if (!b) {
|
||||||
|
//记录下来重连时下发
|
||||||
|
BusAttendanceMachineRepeat repeat = new BusAttendanceMachineRepeat();
|
||||||
|
repeat.setSn(machine.getSn());
|
||||||
|
repeat.setUserId(constructionUser.getSysUserId().toString());
|
||||||
|
repeat.setUserName(constructionUser.getUserName());
|
||||||
|
repeat.setUrl(byId.getUrl());
|
||||||
|
repeat.setType("1");
|
||||||
|
repeats.add(repeat);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (CollectionUtil.isNotEmpty(repeats)) {
|
||||||
|
busAttendanceMachineRepeatService.saveBatch(repeats);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//删除考勤人员
|
//删除考勤人员
|
||||||
@Async
|
@Async
|
||||||
public void deletePersonnel(SubConstructionUser constructionUser) {
|
public void deletePersonnel(SubConstructionUser constructionUser) {
|
||||||
|
ArrayList<BusAttendanceMachineRepeat> repeats = new ArrayList<>();
|
||||||
List<BusAttendanceMachine> list = attendanceMachineService.lambdaQuery().apply("FIND_IN_SET({0}, teams)", constructionUser.getTeamId()).list();
|
List<BusAttendanceMachine> list = attendanceMachineService.lambdaQuery().apply("FIND_IN_SET({0}, teams)", constructionUser.getTeamId()).list();
|
||||||
for (BusAttendanceMachine machine : list) {
|
for (BusAttendanceMachine machine : list) {
|
||||||
try {
|
try {
|
||||||
deviceMessageSender.deleteUser(machine.getSn(), constructionUser.getSysUserId().toString());
|
KqjEntity.CommonResponse commonResponse = deviceMessageSender.deleteUser(machine.getSn(), constructionUser.getSysUserId().toString());
|
||||||
|
int code = commonResponse.getData().getCode();
|
||||||
|
if (code != 0) {
|
||||||
|
//记录下来重连时下发
|
||||||
|
BusAttendanceMachineRepeat repeat = new BusAttendanceMachineRepeat();
|
||||||
|
repeat.setSn(machine.getSn());
|
||||||
|
repeat.setUserId(constructionUser.getSysUserId().toString());
|
||||||
|
repeat.setUserName(constructionUser.getUserName());
|
||||||
|
repeat.setUrl(null);
|
||||||
|
repeat.setType("2");
|
||||||
|
repeats.add(repeat);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("删除考勤人员异常", e);
|
||||||
|
BusAttendanceMachineRepeat repeat = new BusAttendanceMachineRepeat();
|
||||||
|
repeat.setSn(machine.getSn());
|
||||||
|
repeat.setUserId(constructionUser.getSysUserId().toString());
|
||||||
|
repeat.setUserName(constructionUser.getUserName());
|
||||||
|
repeat.setUrl(null);
|
||||||
|
repeat.setType("2");
|
||||||
|
repeats.add(repeat);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (CollectionUtil.isNotEmpty(repeats)) {
|
||||||
|
busAttendanceMachineRepeatService.saveBatch(repeats);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//重新下发人员
|
||||||
|
@Async
|
||||||
|
public void repeatSend(String sn) {
|
||||||
|
List<BusAttendanceMachineRepeat> list = busAttendanceMachineRepeatService.lambdaQuery()
|
||||||
|
.eq(BusAttendanceMachineRepeat::getSn, sn)
|
||||||
|
.eq(BusAttendanceMachineRepeat::getType, "1")
|
||||||
|
.list();
|
||||||
|
List<Long> repeatIds = new ArrayList<>();
|
||||||
|
for (BusAttendanceMachineRepeat repeat : list) {
|
||||||
|
Boolean b = deviceMessageSender.sendPersonnelInformation(repeat.getSn(), repeat.getUserId(), repeat.getUserName(), repeat.getUrl());
|
||||||
|
if (b) {
|
||||||
|
//成功删除记录
|
||||||
|
repeatIds.add(repeat.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (CollectionUtil.isNotEmpty(repeatIds)) {
|
||||||
|
busAttendanceMachineRepeatService.removeByIds(repeatIds);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//重新删除人员
|
||||||
|
@Async
|
||||||
|
public void repeatDelete(String sn) {
|
||||||
|
List<BusAttendanceMachineRepeat> list = busAttendanceMachineRepeatService.lambdaQuery()
|
||||||
|
.eq(BusAttendanceMachineRepeat::getSn, sn)
|
||||||
|
.eq(BusAttendanceMachineRepeat::getType, "2")
|
||||||
|
.list();
|
||||||
|
List<Long> repeatIds = new ArrayList<>();
|
||||||
|
for (BusAttendanceMachineRepeat repeat : list) {
|
||||||
|
try {
|
||||||
|
KqjEntity.CommonResponse commonResponse = deviceMessageSender.deleteUser(repeat.getSn(), repeat.getUserId());
|
||||||
|
int code = commonResponse.getData().getCode();
|
||||||
|
if (code == 0) {
|
||||||
|
//成功删除记录
|
||||||
|
repeatIds.add(repeat.getId());
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("删除考勤人员异常", e);
|
log.error("删除考勤人员异常", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (CollectionUtil.isNotEmpty(repeatIds)) {
|
||||||
|
busAttendanceMachineRepeatService.removeByIds(repeatIds);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import org.dromara.common.constant.GeoJsonConstant;
|
|||||||
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.domain.GeoPoint;
|
import org.dromara.common.domain.GeoPoint;
|
||||||
|
import org.dromara.facility.domain.FacMatrix;
|
||||||
import org.dromara.facility.domain.FacPhotovoltaicPanel;
|
import org.dromara.facility.domain.FacPhotovoltaicPanel;
|
||||||
import org.dromara.facility.domain.dto.geojson.FacFeatureByPlane;
|
import org.dromara.facility.domain.dto.geojson.FacFeatureByPlane;
|
||||||
import org.dromara.facility.domain.dto.geojson.FacFeatureByPoint;
|
import org.dromara.facility.domain.dto.geojson.FacFeatureByPoint;
|
||||||
@ -338,6 +339,29 @@ public class JSTUtil {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 匹配最近方阵,获取该方阵的信息
|
||||||
|
*
|
||||||
|
* @param pointEntity 点位
|
||||||
|
* @param matrices 方阵列表
|
||||||
|
* @return 最近方阵的信息
|
||||||
|
*/
|
||||||
|
public static FacMatrix findContainingMatrix(
|
||||||
|
RecognizeConvertCoordinateResult pointEntity,
|
||||||
|
List<FacMatrix> matrices
|
||||||
|
) {
|
||||||
|
double lng = Double.parseDouble(pointEntity.getLng());
|
||||||
|
double lat = Double.parseDouble(pointEntity.getLat());
|
||||||
|
Point point = geometryFactory.createPoint(new Coordinate(lng, lat));
|
||||||
|
for (FacMatrix matrix : matrices) {
|
||||||
|
Polygon polygon = parsePolygon(matrix.getPositions());
|
||||||
|
if (polygon.covers(point)) { // covers 包含边界}
|
||||||
|
return matrix;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 将 FacPhotovoltaicPanel.positions 转成 Polygon
|
* 将 FacPhotovoltaicPanel.positions 转成 Polygon
|
||||||
*/
|
*/
|
||||||
@ -376,7 +400,7 @@ public class JSTUtil {
|
|||||||
List<String> list = new ArrayList<>();
|
List<String> list = new ArrayList<>();
|
||||||
list.add(s);
|
list.add(s);
|
||||||
List<GeoPoint> matchingRange = findMatchingRange("30.247348", "105.729797", list);
|
List<GeoPoint> matchingRange = findMatchingRange("30.247348", "105.729797", list);
|
||||||
System.out.println(matchingRange==null);
|
System.out.println(matchingRange == null);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,106 @@
|
|||||||
|
package org.dromara.complaintBox.app.controller;
|
||||||
|
|
||||||
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.dromara.common.core.domain.R;
|
||||||
|
import org.dromara.common.core.domain.model.LoginUser;
|
||||||
|
import org.dromara.common.core.validate.AddGroup;
|
||||||
|
import org.dromara.common.core.validate.EditGroup;
|
||||||
|
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||||
|
import org.dromara.common.log.annotation.Log;
|
||||||
|
import org.dromara.common.log.enums.BusinessType;
|
||||||
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
|
import org.dromara.common.satoken.utils.LoginHelper;
|
||||||
|
import org.dromara.common.web.core.BaseController;
|
||||||
|
import org.dromara.complaintBox.app.domain.vo.AppDetailsOfTheOpinionVo;
|
||||||
|
import org.dromara.complaintBox.domain.bo.BusComplaintBoxBo;
|
||||||
|
import org.dromara.complaintBox.domain.bo.BusComplaintBoxMessageLoggingBo;
|
||||||
|
import org.dromara.complaintBox.domain.vo.BusComplaintBoxVo;
|
||||||
|
import org.dromara.complaintBox.service.IBusComplaintBoxMessageLoggingService;
|
||||||
|
import org.dromara.complaintBox.service.IBusComplaintBoxService;
|
||||||
|
import org.springframework.context.annotation.Lazy;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 意见箱
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-11-29
|
||||||
|
*/
|
||||||
|
@Validated
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/app/complaintBox/complaintBox")
|
||||||
|
public class AppBusComplaintBoxController extends BaseController {
|
||||||
|
|
||||||
|
@Lazy
|
||||||
|
private final IBusComplaintBoxService busComplaintBoxService;
|
||||||
|
@Lazy
|
||||||
|
private final IBusComplaintBoxMessageLoggingService busComplaintBoxMessageLoggingService;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询意见箱列表
|
||||||
|
*/
|
||||||
|
// @SaCheckPermission("appComplaintBox:complaintBox:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo<BusComplaintBoxVo> list(BusComplaintBoxBo bo, PageQuery pageQuery) {
|
||||||
|
LoginUser loginUser = LoginHelper.getLoginUser();
|
||||||
|
if (loginUser != null) {
|
||||||
|
bo.setUserId(loginUser.getUserId());
|
||||||
|
}
|
||||||
|
return busComplaintBoxService.appQueryPageList(bo, pageQuery);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取意见箱详细信息
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
*/
|
||||||
|
// @SaCheckPermission("appComplaintBox:complaintBox:query")
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public R<AppDetailsOfTheOpinionVo> getInfo(@NotNull(message = "主键不能为空")
|
||||||
|
@PathVariable Long id) {
|
||||||
|
return R.ok(busComplaintBoxService.appQueryById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增意见箱
|
||||||
|
*/
|
||||||
|
// @SaCheckPermission("appComplaintBox:complaintBox:add")
|
||||||
|
@Log(title = "意见箱", businessType = BusinessType.INSERT)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PostMapping()
|
||||||
|
public R<Void> add(@Validated(AddGroup.class) @RequestBody BusComplaintBoxBo bo) {
|
||||||
|
return toAjax(busComplaintBoxService.insertByBo(bo));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增意见回复
|
||||||
|
*/
|
||||||
|
// @SaCheckPermission("appComplaintBox:complaintBox:add")
|
||||||
|
@Log(title = "意见箱", businessType = BusinessType.INSERT)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PostMapping("/postAReply")
|
||||||
|
public R<Void> postAReply(@Validated(AddGroup.class) @RequestBody BusComplaintBoxMessageLoggingBo bo) {
|
||||||
|
return toAjax(busComplaintBoxMessageLoggingService.insertAppByBo(bo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改意见阅读状态
|
||||||
|
*/
|
||||||
|
// @SaCheckPermission("appComplaintBox:complaintBox:edit")
|
||||||
|
@Log(title = "意见箱", businessType = BusinessType.UPDATE)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PutMapping("/editCheckStatus")
|
||||||
|
public R<Void> editCheckStatus(@Validated(EditGroup.class) @RequestBody BusComplaintBoxBo bo) {
|
||||||
|
return toAjax(busComplaintBoxService.editCheckStatus(bo));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,16 @@
|
|||||||
|
package org.dromara.complaintBox.app.domain.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.dromara.complaintBox.domain.vo.BusComplaintBoxMessageLoggingVo;
|
||||||
|
import org.dromara.complaintBox.domain.vo.BusComplaintBoxVo;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class AppDetailsOfTheOpinionVo implements Serializable {
|
||||||
|
|
||||||
|
private BusComplaintBoxVo busComplaintBoxVo;
|
||||||
|
|
||||||
|
private List<BusComplaintBoxMessageLoggingVo> messageLoggingVos;
|
||||||
|
}
|
||||||
@ -0,0 +1,124 @@
|
|||||||
|
package org.dromara.complaintBox.controller;
|
||||||
|
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import jakarta.validation.constraints.*;
|
||||||
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
|
import org.dromara.complaintBox.domain.bo.BusComplaintBoxDisposeLoggingBo;
|
||||||
|
import org.dromara.complaintBox.domain.bo.BusComplaintBoxMessageLoggingBo;
|
||||||
|
import org.dromara.complaintBox.domain.vo.BusComplaintBoxDisposeLoggingVo;
|
||||||
|
import org.dromara.complaintBox.domain.vo.ComplaintBoxCountVo;
|
||||||
|
import org.dromara.complaintBox.domain.vo.DetailsOfTheOpinionVo;
|
||||||
|
import org.dromara.complaintBox.service.IBusComplaintBoxDisposeLoggingService;
|
||||||
|
import org.dromara.complaintBox.service.IBusComplaintBoxMessageLoggingService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Lazy;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||||
|
import org.dromara.common.log.annotation.Log;
|
||||||
|
import org.dromara.common.web.core.BaseController;
|
||||||
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
|
import org.dromara.common.core.domain.R;
|
||||||
|
import org.dromara.common.core.validate.AddGroup;
|
||||||
|
import org.dromara.common.core.validate.EditGroup;
|
||||||
|
import org.dromara.common.log.enums.BusinessType;
|
||||||
|
import org.dromara.complaintBox.domain.vo.BusComplaintBoxVo;
|
||||||
|
import org.dromara.complaintBox.domain.bo.BusComplaintBoxBo;
|
||||||
|
import org.dromara.complaintBox.service.IBusComplaintBoxService;
|
||||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 意见箱
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-11-29
|
||||||
|
*/
|
||||||
|
@Validated
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/complaintBox/complaintBox")
|
||||||
|
public class BusComplaintBoxController extends BaseController {
|
||||||
|
|
||||||
|
private final IBusComplaintBoxService busComplaintBoxService;
|
||||||
|
@Lazy
|
||||||
|
@Autowired
|
||||||
|
private IBusComplaintBoxMessageLoggingService busComplaintBoxMessageLoggingService;
|
||||||
|
@Lazy
|
||||||
|
@Autowired
|
||||||
|
private IBusComplaintBoxDisposeLoggingService disposeLoggingService;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询意见箱列表
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("complaintBox:complaintBox:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo<BusComplaintBoxVo> list(BusComplaintBoxBo bo, PageQuery pageQuery) {
|
||||||
|
return busComplaintBoxService.queryPageList(bo, pageQuery);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 查询意见处理记录列表
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("complaintBox:complaintBox:list")
|
||||||
|
@GetMapping("/getDisposeLogList")
|
||||||
|
public TableDataInfo<BusComplaintBoxDisposeLoggingVo> getDisposeLogList(BusComplaintBoxDisposeLoggingBo bo, PageQuery pageQuery) {
|
||||||
|
return disposeLoggingService.queryPageList(bo, pageQuery);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* web获取各个处理状态数量
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("complaintBox:complaintBox:list")
|
||||||
|
@GetMapping("/getCount")
|
||||||
|
public R<List<ComplaintBoxCountVo>> getCount(BusComplaintBoxBo bo) {
|
||||||
|
return R.ok(busComplaintBoxService.getCount(bo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取意见箱详细信息
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
*/
|
||||||
|
// @SaCheckPermission("complaintBox:complaintBox:query")
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public R<DetailsOfTheOpinionVo> getInfo(@NotNull(message = "主键不能为空")
|
||||||
|
@PathVariable Long id) {
|
||||||
|
return R.ok(busComplaintBoxService.getInfo(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增意见回复
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("complaintBox:complaintBox:add")
|
||||||
|
@Log(title = "意见箱", businessType = BusinessType.INSERT)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PostMapping("/postAReply")
|
||||||
|
public R<Void> postAReply(@Validated(AddGroup.class) @RequestBody BusComplaintBoxMessageLoggingBo bo) {
|
||||||
|
return toAjax(busComplaintBoxMessageLoggingService.insertWebByBo(bo));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改意见阅读状态
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("complaintBox:complaintBox:edit")
|
||||||
|
@Log(title = "意见箱", businessType = BusinessType.UPDATE)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PutMapping("/editCheckStatus")
|
||||||
|
public R<Void> editCheckStatus(@Validated(EditGroup.class) @RequestBody BusComplaintBoxBo bo) {
|
||||||
|
return toAjax(busComplaintBoxService.editCheckStatus(bo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改意见阅读状态
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("complaintBox:complaintBox:edit")
|
||||||
|
@Log(title = "意见箱", businessType = BusinessType.UPDATE)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PutMapping("/editStatus")
|
||||||
|
public R<Void> editStatus(@Validated(EditGroup.class) @RequestBody BusComplaintBoxBo bo) {
|
||||||
|
return toAjax(busComplaintBoxService.editStatus(bo));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,91 @@
|
|||||||
|
package org.dromara.complaintBox.domain;
|
||||||
|
|
||||||
|
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 意见箱对象 bus_complaint_box
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-11-29
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("bus_complaint_box")
|
||||||
|
public class BusComplaintBox extends BaseEntity {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键ID
|
||||||
|
*/
|
||||||
|
@TableId(value = "id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公司id(当前登录人的顶层下一级部门id)
|
||||||
|
*/
|
||||||
|
private Long companyId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目id
|
||||||
|
*/
|
||||||
|
private Long projectId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户id
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户名
|
||||||
|
*/
|
||||||
|
private String userName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 头像地址
|
||||||
|
*/
|
||||||
|
private Long avatar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标题
|
||||||
|
*/
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 意见类型(1、功能建议,2、Bug反馈,3、体验问题,4其他意见)
|
||||||
|
*/
|
||||||
|
private String opinionType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 详细描述
|
||||||
|
*/
|
||||||
|
private String detail;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上传图片(id,id之间使用','分割)
|
||||||
|
*/
|
||||||
|
private String fileId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否匿名提交(0、否,1、是)
|
||||||
|
*/
|
||||||
|
private String isCryptonym;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理状态(0、待处理,5、处理中,9、已解决,10、退回,14、不予解决())
|
||||||
|
*/
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当前处理人id
|
||||||
|
*/
|
||||||
|
private Long currentDisposeUserId;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,61 @@
|
|||||||
|
package org.dromara.complaintBox.domain;
|
||||||
|
|
||||||
|
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 意见箱-意见处理记录对象 bus_complaint_box_dispose_logging
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-11-29
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("bus_complaint_box_dispose_logging")
|
||||||
|
public class BusComplaintBoxDisposeLogging extends BaseEntity {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键ID
|
||||||
|
*/
|
||||||
|
@TableId(value = "id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 意见id
|
||||||
|
*/
|
||||||
|
private Long complaintId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户id
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户名
|
||||||
|
*/
|
||||||
|
private String userName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 头像地址
|
||||||
|
*/
|
||||||
|
private Long avatar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否退回(0、否,1、是)
|
||||||
|
*/
|
||||||
|
private String isRefund;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退回原因
|
||||||
|
*/
|
||||||
|
private String cause;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,76 @@
|
|||||||
|
package org.dromara.complaintBox.domain;
|
||||||
|
|
||||||
|
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 意见箱-意见沟通记录对象 bus_complaint_box_message_logging
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-11-29
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("bus_complaint_box_message_logging")
|
||||||
|
public class BusComplaintBoxMessageLogging extends BaseEntity {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键ID
|
||||||
|
*/
|
||||||
|
@TableId(value = "id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 意见id
|
||||||
|
*/
|
||||||
|
private Long complaintId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 回复用户id
|
||||||
|
*/
|
||||||
|
private Long replyUserId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 回复用户名
|
||||||
|
*/
|
||||||
|
private String replyUserName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 回复用户头像地址
|
||||||
|
*/
|
||||||
|
private Long replyAvatar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 被回复用户id
|
||||||
|
*/
|
||||||
|
private Long repliedUserId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 被回复用户名
|
||||||
|
*/
|
||||||
|
private String repliedUserName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 被回复用户头像地址
|
||||||
|
*/
|
||||||
|
private Long repliedAvatar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 消息内容
|
||||||
|
*/
|
||||||
|
private String details;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理状态(0、未读,1、已读)
|
||||||
|
*/
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,95 @@
|
|||||||
|
package org.dromara.complaintBox.domain.bo;
|
||||||
|
|
||||||
|
import org.dromara.complaintBox.domain.BusComplaintBox;
|
||||||
|
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||||
|
import org.dromara.common.core.validate.AddGroup;
|
||||||
|
import org.dromara.common.core.validate.EditGroup;
|
||||||
|
import io.github.linpeilie.annotations.AutoMapper;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import jakarta.validation.constraints.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 意见箱业务对象 bus_complaint_box
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-11-29
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@AutoMapper(target = BusComplaintBox.class, reverseConvertGenerate = false)
|
||||||
|
public class BusComplaintBoxBo extends BaseEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键ID
|
||||||
|
*/
|
||||||
|
@NotNull(message = "主键ID不能为空", groups = { EditGroup.class })
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公司id(当前登录人的顶层下一级部门id)
|
||||||
|
*/
|
||||||
|
private Long companyId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目id
|
||||||
|
*/
|
||||||
|
private Long projectId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户id
|
||||||
|
*/
|
||||||
|
@NotNull(message = "主键ID不能为空", groups = { AddGroup.class })
|
||||||
|
private Long userId;
|
||||||
|
/**
|
||||||
|
* 当前处理人id
|
||||||
|
*/
|
||||||
|
private Long currentDisposeUserId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户名
|
||||||
|
*/
|
||||||
|
private String userName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 头像地址
|
||||||
|
*/
|
||||||
|
private Long avatar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标题
|
||||||
|
*/
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 意见类型(1、功能建议,2、Bug反馈,3、体验问题,4其他意见)
|
||||||
|
*/
|
||||||
|
private String opinionType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 详细描述
|
||||||
|
*/
|
||||||
|
private String detail;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上传图片(id,id之间使用','分割)
|
||||||
|
*/
|
||||||
|
private String fileId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否匿名提交(0、否,1、是)
|
||||||
|
*/
|
||||||
|
private String isCryptonym;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理状态(0、待处理,5、处理中,9、已解决,14、关闭)
|
||||||
|
*/
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退回原因
|
||||||
|
*/
|
||||||
|
private String cause;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,60 @@
|
|||||||
|
package org.dromara.complaintBox.domain.bo;
|
||||||
|
|
||||||
|
import org.dromara.complaintBox.domain.BusComplaintBoxDisposeLogging;
|
||||||
|
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||||
|
import org.dromara.common.core.validate.AddGroup;
|
||||||
|
import org.dromara.common.core.validate.EditGroup;
|
||||||
|
import io.github.linpeilie.annotations.AutoMapper;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import jakarta.validation.constraints.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 意见箱-意见处理记录业务对象 bus_complaint_box_dispose_logging
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-11-29
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@AutoMapper(target = BusComplaintBoxDisposeLogging.class, reverseConvertGenerate = false)
|
||||||
|
public class BusComplaintBoxDisposeLoggingBo extends BaseEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键ID
|
||||||
|
*/
|
||||||
|
@NotNull(message = "主键ID不能为空", groups = { EditGroup.class })
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 意见id
|
||||||
|
*/
|
||||||
|
private Long complaintId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户id
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户名
|
||||||
|
*/
|
||||||
|
private String userName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 头像地址
|
||||||
|
*/
|
||||||
|
private Long avatar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否退回(0、否,1、是)
|
||||||
|
*/
|
||||||
|
private String isRefund;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退回原因
|
||||||
|
*/
|
||||||
|
private String cause;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,80 @@
|
|||||||
|
package org.dromara.complaintBox.domain.bo;
|
||||||
|
|
||||||
|
import org.dromara.complaintBox.domain.BusComplaintBoxMessageLogging;
|
||||||
|
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||||
|
import org.dromara.common.core.validate.AddGroup;
|
||||||
|
import org.dromara.common.core.validate.EditGroup;
|
||||||
|
import io.github.linpeilie.annotations.AutoMapper;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import jakarta.validation.constraints.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 意见箱-意见沟通记录业务对象 bus_complaint_box_message_logging
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-11-29
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@AutoMapper(target = BusComplaintBoxMessageLogging.class, reverseConvertGenerate = false)
|
||||||
|
public class BusComplaintBoxMessageLoggingBo extends BaseEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键ID
|
||||||
|
*/
|
||||||
|
@NotNull(message = "主键ID不能为空", groups = { EditGroup.class })
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 意见id
|
||||||
|
*/
|
||||||
|
private Long complaintId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 回复用户id
|
||||||
|
*/
|
||||||
|
private Long replyUserId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 回复用户名
|
||||||
|
*/
|
||||||
|
private String replyUserName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 回复用户头像地址
|
||||||
|
*/
|
||||||
|
private Long replyAvatar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 被回复用户id
|
||||||
|
*/
|
||||||
|
private Long repliedUserId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 被回复用户名
|
||||||
|
*/
|
||||||
|
private String repliedUserName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 被回复用户头像地址
|
||||||
|
*/
|
||||||
|
private Long repliedAvatar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 消息内容
|
||||||
|
*/
|
||||||
|
private String details;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理状态(0、未读,1、已读)
|
||||||
|
*/
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上一条沟通记录id
|
||||||
|
*/
|
||||||
|
private Long oldId;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,82 @@
|
|||||||
|
package org.dromara.complaintBox.domain.vo;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import org.dromara.complaintBox.domain.BusComplaintBoxDisposeLogging;
|
||||||
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
import org.dromara.common.excel.annotation.ExcelDictFormat;
|
||||||
|
import org.dromara.common.excel.convert.ExcelDictConvert;
|
||||||
|
import io.github.linpeilie.annotations.AutoMapper;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 意见箱-意见处理记录视图对象 bus_complaint_box_dispose_logging
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-11-29
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
@AutoMapper(target = BusComplaintBoxDisposeLogging.class)
|
||||||
|
public class BusComplaintBoxDisposeLoggingVo implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键ID
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "主键ID")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 意见id
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "意见id")
|
||||||
|
private Long complaintId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户id
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "用户id")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户名
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "用户名")
|
||||||
|
private String userName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 头像地址
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "头像地址")
|
||||||
|
private Long avatar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否退回(0、否,1、是)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "是否退回", converter = ExcelDictConvert.class)
|
||||||
|
@ExcelDictFormat(readConverterExp = "0=、否,1、是")
|
||||||
|
private String isRefund;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退回原因
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "退回原因")
|
||||||
|
private String cause;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,99 @@
|
|||||||
|
package org.dromara.complaintBox.domain.vo;
|
||||||
|
|
||||||
|
import org.dromara.complaintBox.domain.BusComplaintBoxMessageLogging;
|
||||||
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
import org.dromara.common.excel.annotation.ExcelDictFormat;
|
||||||
|
import org.dromara.common.excel.convert.ExcelDictConvert;
|
||||||
|
import io.github.linpeilie.annotations.AutoMapper;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 意见箱-意见沟通记录视图对象 bus_complaint_box_message_logging
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-11-29
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
@AutoMapper(target = BusComplaintBoxMessageLogging.class)
|
||||||
|
public class BusComplaintBoxMessageLoggingVo implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键ID
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "主键ID")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 意见id
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "意见id")
|
||||||
|
private Long complaintId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 回复用户id
|
||||||
|
*/
|
||||||
|
private Long replyUserId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 回复用户名
|
||||||
|
*/
|
||||||
|
private String replyUserName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 回复用户头像地址
|
||||||
|
*/
|
||||||
|
private Long replyAvatar;
|
||||||
|
private String replyAvatarUrl;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 被回复用户id
|
||||||
|
*/
|
||||||
|
private Long repliedUserId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 被回复用户名
|
||||||
|
*/
|
||||||
|
private String repliedUserName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 被回复用户头像地址
|
||||||
|
*/
|
||||||
|
private Long repliedAvatar;
|
||||||
|
private String repliedAvatarUrl;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 消息内容
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "消息内容")
|
||||||
|
private String details;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理状态(0、未读,1、已读)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "处理状态", converter = ExcelDictConvert.class)
|
||||||
|
@ExcelDictFormat(readConverterExp = "0=、未读,1、已读")
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发起人类型(0、发起人,1、处理人)
|
||||||
|
*/
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,125 @@
|
|||||||
|
package org.dromara.complaintBox.domain.vo;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import org.dromara.complaintBox.domain.BusComplaintBox;
|
||||||
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
import org.dromara.common.excel.annotation.ExcelDictFormat;
|
||||||
|
import org.dromara.common.excel.convert.ExcelDictConvert;
|
||||||
|
import io.github.linpeilie.annotations.AutoMapper;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 意见箱视图对象 bus_complaint_box
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-11-29
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
@AutoMapper(target = BusComplaintBox.class)
|
||||||
|
public class BusComplaintBoxVo implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键ID
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "主键ID")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公司id(当前登录人的顶层下一级部门id)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "公司id", converter = ExcelDictConvert.class)
|
||||||
|
@ExcelDictFormat(readConverterExp = "当=前登录人的顶层下一级部门id")
|
||||||
|
private Long companyId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目id
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "项目id")
|
||||||
|
private Long projectId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户id
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "用户id")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户名
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "用户名")
|
||||||
|
private String userName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 头像地址
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "头像地址")
|
||||||
|
private Long avatar;
|
||||||
|
private String avatarUrl;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标题
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "标题")
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 意见类型(1、功能建议,2、Bug反馈,3、体验问题,4其他意见)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "意见类型", converter = ExcelDictConvert.class)
|
||||||
|
@ExcelDictFormat(readConverterExp = "1=、功能建议,2、Bug反馈,3、体验问题,4其他意见")
|
||||||
|
private String opinionType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 详细描述
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "详细描述")
|
||||||
|
private String detail;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上传图片(id,id之间使用','分割)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "上传图片", converter = ExcelDictConvert.class)
|
||||||
|
@ExcelDictFormat(readConverterExp = "i=d,id之间使用','分割")
|
||||||
|
private String fileId;
|
||||||
|
private List<String> fileUrls;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否匿名提交(0、否,1、是)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "是否匿名提交", converter = ExcelDictConvert.class)
|
||||||
|
@ExcelDictFormat(readConverterExp = "0=、否,1、是")
|
||||||
|
private String isCryptonym;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理状态(0、待处理,5、处理中,9、已解决,14、关闭)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "处理状态", converter = ExcelDictConvert.class)
|
||||||
|
@ExcelDictFormat(readConverterExp = "0=、待处理,5、处理中,9、已解决,14、关闭")
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当前处理人id
|
||||||
|
*/
|
||||||
|
private Long currentDisposeUserId;
|
||||||
|
|
||||||
|
private Integer count;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,18 @@
|
|||||||
|
package org.dromara.complaintBox.domain.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.dromara.common.translation.annotation.Translation;
|
||||||
|
import org.dromara.common.translation.constant.TransConstant;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ComplaintBoxCountVo implements Serializable {
|
||||||
|
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
// @Translation(type = TransConstant.DICT_TYPE_TO_LABEL, mapper = "type",other = "opinion_processing_status")
|
||||||
|
private String typeName;
|
||||||
|
|
||||||
|
private Integer count;
|
||||||
|
}
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
package org.dromara.complaintBox.domain.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class DetailsOfTheOpinionVo implements Serializable {
|
||||||
|
|
||||||
|
private BusComplaintBoxVo busComplaintBoxVo;
|
||||||
|
|
||||||
|
private List<BusComplaintBoxMessageLoggingVo> messageLoggingVos;
|
||||||
|
}
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
package org.dromara.complaintBox.mapper;
|
||||||
|
|
||||||
|
import org.dromara.complaintBox.domain.BusComplaintBoxDisposeLogging;
|
||||||
|
import org.dromara.complaintBox.domain.vo.BusComplaintBoxDisposeLoggingVo;
|
||||||
|
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 意见箱-意见处理记录Mapper接口
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-11-29
|
||||||
|
*/
|
||||||
|
public interface BusComplaintBoxDisposeLoggingMapper extends BaseMapperPlus<BusComplaintBoxDisposeLogging, BusComplaintBoxDisposeLoggingVo> {
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,26 @@
|
|||||||
|
package org.dromara.complaintBox.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.dromara.complaintBox.domain.BusComplaintBox;
|
||||||
|
import org.dromara.complaintBox.domain.bo.BusComplaintBoxBo;
|
||||||
|
import org.dromara.complaintBox.domain.vo.BusComplaintBoxVo;
|
||||||
|
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||||
|
import org.dromara.complaintBox.domain.vo.ComplaintBoxCountVo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 意见箱Mapper接口
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-11-29
|
||||||
|
*/
|
||||||
|
public interface BusComplaintBoxMapper extends BaseMapperPlus<BusComplaintBox, BusComplaintBoxVo> {
|
||||||
|
|
||||||
|
Page<BusComplaintBoxVo> selectVoPageList(@Param("page") Page<BusComplaintBoxVo> page, @Param("bo") BusComplaintBoxBo bo);
|
||||||
|
|
||||||
|
Page<BusComplaintBoxVo> selectVoPageWebList(@Param("page") Page<BusComplaintBoxVo> page, @Param("bo") BusComplaintBoxBo bo);
|
||||||
|
|
||||||
|
List<ComplaintBoxCountVo> getCount(@Param("bo") BusComplaintBoxBo bo);
|
||||||
|
}
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
package org.dromara.complaintBox.mapper;
|
||||||
|
|
||||||
|
import org.dromara.complaintBox.domain.BusComplaintBoxMessageLogging;
|
||||||
|
import org.dromara.complaintBox.domain.vo.BusComplaintBoxMessageLoggingVo;
|
||||||
|
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 意见箱-意见沟通记录Mapper接口
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-11-29
|
||||||
|
*/
|
||||||
|
public interface BusComplaintBoxMessageLoggingMapper extends BaseMapperPlus<BusComplaintBoxMessageLogging, BusComplaintBoxMessageLoggingVo> {
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,70 @@
|
|||||||
|
package org.dromara.complaintBox.service;
|
||||||
|
|
||||||
|
import org.dromara.complaintBox.domain.vo.BusComplaintBoxDisposeLoggingVo;
|
||||||
|
import org.dromara.complaintBox.domain.bo.BusComplaintBoxDisposeLoggingBo;
|
||||||
|
import org.dromara.complaintBox.domain.BusComplaintBoxDisposeLogging;
|
||||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 意见箱-意见处理记录Service接口
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-11-29
|
||||||
|
*/
|
||||||
|
public interface IBusComplaintBoxDisposeLoggingService extends IService<BusComplaintBoxDisposeLogging>{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询意见箱-意见处理记录
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 意见箱-意见处理记录
|
||||||
|
*/
|
||||||
|
BusComplaintBoxDisposeLoggingVo queryById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询意见箱-意见处理记录列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @param pageQuery 分页参数
|
||||||
|
* @return 意见箱-意见处理记录分页列表
|
||||||
|
*/
|
||||||
|
TableDataInfo<BusComplaintBoxDisposeLoggingVo> queryPageList(BusComplaintBoxDisposeLoggingBo bo, PageQuery pageQuery);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询符合条件的意见箱-意见处理记录列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @return 意见箱-意见处理记录列表
|
||||||
|
*/
|
||||||
|
List<BusComplaintBoxDisposeLoggingVo> queryList(BusComplaintBoxDisposeLoggingBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增意见箱-意见处理记录
|
||||||
|
*
|
||||||
|
* @param bo 意见箱-意见处理记录
|
||||||
|
* @return 是否新增成功
|
||||||
|
*/
|
||||||
|
Boolean insertByBo(BusComplaintBoxDisposeLoggingBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改意见箱-意见处理记录
|
||||||
|
*
|
||||||
|
* @param bo 意见箱-意见处理记录
|
||||||
|
* @return 是否修改成功
|
||||||
|
*/
|
||||||
|
Boolean updateByBo(BusComplaintBoxDisposeLoggingBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验并批量删除意见箱-意见处理记录信息
|
||||||
|
*
|
||||||
|
* @param ids 待删除的主键集合
|
||||||
|
* @param isValid 是否进行有效性校验
|
||||||
|
* @return 是否删除成功
|
||||||
|
*/
|
||||||
|
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||||
|
}
|
||||||
@ -0,0 +1,84 @@
|
|||||||
|
package org.dromara.complaintBox.service;
|
||||||
|
|
||||||
|
import org.dromara.complaintBox.domain.vo.BusComplaintBoxMessageLoggingVo;
|
||||||
|
import org.dromara.complaintBox.domain.bo.BusComplaintBoxMessageLoggingBo;
|
||||||
|
import org.dromara.complaintBox.domain.BusComplaintBoxMessageLogging;
|
||||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 意见箱-意见沟通记录Service接口
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-11-29
|
||||||
|
*/
|
||||||
|
public interface IBusComplaintBoxMessageLoggingService extends IService<BusComplaintBoxMessageLogging>{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询意见箱-意见沟通记录
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 意见箱-意见沟通记录
|
||||||
|
*/
|
||||||
|
BusComplaintBoxMessageLoggingVo queryById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询意见箱-意见沟通记录列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @param pageQuery 分页参数
|
||||||
|
* @return 意见箱-意见沟通记录分页列表
|
||||||
|
*/
|
||||||
|
TableDataInfo<BusComplaintBoxMessageLoggingVo> queryPageList(BusComplaintBoxMessageLoggingBo bo, PageQuery pageQuery);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询符合条件的意见箱-意见沟通记录列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @return 意见箱-意见沟通记录列表
|
||||||
|
*/
|
||||||
|
List<BusComplaintBoxMessageLoggingVo> queryList(BusComplaintBoxMessageLoggingBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增意见箱-意见沟通记录
|
||||||
|
*
|
||||||
|
* @param bo 意见箱-意见沟通记录
|
||||||
|
* @return 是否新增成功
|
||||||
|
*/
|
||||||
|
Boolean insertAppByBo(BusComplaintBoxMessageLoggingBo bo);
|
||||||
|
/**
|
||||||
|
* 新增意见箱-意见沟通记录
|
||||||
|
*
|
||||||
|
* @param bo 意见箱-意见沟通记录
|
||||||
|
* @return 是否新增成功
|
||||||
|
*/
|
||||||
|
Boolean insertWebByBo(BusComplaintBoxMessageLoggingBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改意见箱-意见沟通记录
|
||||||
|
*
|
||||||
|
* @param bo 意见箱-意见沟通记录
|
||||||
|
* @return 是否修改成功
|
||||||
|
*/
|
||||||
|
Boolean updateByBo(BusComplaintBoxMessageLoggingBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验并批量删除意见箱-意见沟通记录信息
|
||||||
|
*
|
||||||
|
* @param ids 待删除的主键集合
|
||||||
|
* @param isValid 是否进行有效性校验
|
||||||
|
* @return 是否删除成功
|
||||||
|
*/
|
||||||
|
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过意见id获取沟通记录
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<BusComplaintBoxMessageLoggingVo> getMessageLogListByComplaintId(Long id);
|
||||||
|
}
|
||||||
@ -0,0 +1,117 @@
|
|||||||
|
package org.dromara.complaintBox.service;
|
||||||
|
|
||||||
|
import org.dromara.complaintBox.app.domain.vo.AppDetailsOfTheOpinionVo;
|
||||||
|
import org.dromara.complaintBox.domain.vo.BusComplaintBoxVo;
|
||||||
|
import org.dromara.complaintBox.domain.bo.BusComplaintBoxBo;
|
||||||
|
import org.dromara.complaintBox.domain.BusComplaintBox;
|
||||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import org.dromara.complaintBox.domain.vo.ComplaintBoxCountVo;
|
||||||
|
import org.dromara.complaintBox.domain.vo.DetailsOfTheOpinionVo;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 意见箱Service接口
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-11-29
|
||||||
|
*/
|
||||||
|
public interface IBusComplaintBoxService extends IService<BusComplaintBox>{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询意见箱
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 意见箱
|
||||||
|
*/
|
||||||
|
BusComplaintBoxVo queryById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询意见箱列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @param pageQuery 分页参数
|
||||||
|
* @return 意见箱分页列表
|
||||||
|
*/
|
||||||
|
TableDataInfo<BusComplaintBoxVo> queryPageList(BusComplaintBoxBo bo, PageQuery pageQuery);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询符合条件的意见箱列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @return 意见箱列表
|
||||||
|
*/
|
||||||
|
List<BusComplaintBoxVo> queryList(BusComplaintBoxBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增意见箱
|
||||||
|
*
|
||||||
|
* @param bo 意见箱
|
||||||
|
* @return 是否新增成功
|
||||||
|
*/
|
||||||
|
Boolean insertByBo(BusComplaintBoxBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改意见箱
|
||||||
|
*
|
||||||
|
* @param bo 意见箱
|
||||||
|
* @return 是否修改成功
|
||||||
|
*/
|
||||||
|
Boolean updateByBo(BusComplaintBoxBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验并批量删除意见箱信息
|
||||||
|
*
|
||||||
|
* @param ids 待删除的主键集合
|
||||||
|
* @param isValid 是否进行有效性校验
|
||||||
|
* @return 是否删除成功
|
||||||
|
*/
|
||||||
|
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* app获取当前用户提出意见列表
|
||||||
|
* @param bo
|
||||||
|
* @param pageQuery
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
TableDataInfo<BusComplaintBoxVo> appQueryPageList(BusComplaintBoxBo bo, PageQuery pageQuery);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* APP获取当前意见详情
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
AppDetailsOfTheOpinionVo appQueryById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取当前意见详情
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
DetailsOfTheOpinionVo getInfo(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改沟通记录阅读状态
|
||||||
|
* @param bo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int editCheckStatus(BusComplaintBoxBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* web获取各个处理状态数量
|
||||||
|
* @param bo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<ComplaintBoxCountVo> getCount(BusComplaintBoxBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改意见状态
|
||||||
|
* @param bo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int editStatus(BusComplaintBoxBo bo);
|
||||||
|
}
|
||||||
@ -0,0 +1,134 @@
|
|||||||
|
package org.dromara.complaintBox.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.dromara.common.core.utils.MapstructUtils;
|
||||||
|
import org.dromara.common.core.utils.StringUtils;
|
||||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.dromara.complaintBox.domain.bo.BusComplaintBoxDisposeLoggingBo;
|
||||||
|
import org.dromara.complaintBox.domain.vo.BusComplaintBoxDisposeLoggingVo;
|
||||||
|
import org.dromara.complaintBox.domain.BusComplaintBoxDisposeLogging;
|
||||||
|
import org.dromara.complaintBox.mapper.BusComplaintBoxDisposeLoggingMapper;
|
||||||
|
import org.dromara.complaintBox.service.IBusComplaintBoxDisposeLoggingService;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 意见箱-意见处理记录Service业务层处理
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-11-29
|
||||||
|
*/
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Service
|
||||||
|
public class BusComplaintBoxDisposeLoggingServiceImpl extends ServiceImpl<BusComplaintBoxDisposeLoggingMapper, BusComplaintBoxDisposeLogging> implements IBusComplaintBoxDisposeLoggingService {
|
||||||
|
|
||||||
|
private final BusComplaintBoxDisposeLoggingMapper baseMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询意见箱-意见处理记录
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 意见箱-意见处理记录
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public BusComplaintBoxDisposeLoggingVo queryById(Long id){
|
||||||
|
return baseMapper.selectVoById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询意见箱-意见处理记录列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @param pageQuery 分页参数
|
||||||
|
* @return 意见箱-意见处理记录分页列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public TableDataInfo<BusComplaintBoxDisposeLoggingVo> queryPageList(BusComplaintBoxDisposeLoggingBo bo, PageQuery pageQuery) {
|
||||||
|
LambdaQueryWrapper<BusComplaintBoxDisposeLogging> lqw = buildQueryWrapper(bo);
|
||||||
|
Page<BusComplaintBoxDisposeLoggingVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||||
|
return TableDataInfo.build(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询符合条件的意见箱-意见处理记录列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @return 意见箱-意见处理记录列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<BusComplaintBoxDisposeLoggingVo> queryList(BusComplaintBoxDisposeLoggingBo bo) {
|
||||||
|
LambdaQueryWrapper<BusComplaintBoxDisposeLogging> lqw = buildQueryWrapper(bo);
|
||||||
|
return baseMapper.selectVoList(lqw);
|
||||||
|
}
|
||||||
|
|
||||||
|
private LambdaQueryWrapper<BusComplaintBoxDisposeLogging> buildQueryWrapper(BusComplaintBoxDisposeLoggingBo bo) {
|
||||||
|
Map<String, Object> params = bo.getParams();
|
||||||
|
LambdaQueryWrapper<BusComplaintBoxDisposeLogging> lqw = Wrappers.lambdaQuery();
|
||||||
|
lqw.orderByDesc(BusComplaintBoxDisposeLogging::getCreateTime);
|
||||||
|
lqw.eq(bo.getComplaintId() != null, BusComplaintBoxDisposeLogging::getComplaintId, bo.getComplaintId());
|
||||||
|
lqw.eq(bo.getUserId() != null, BusComplaintBoxDisposeLogging::getUserId, bo.getUserId());
|
||||||
|
lqw.like(StringUtils.isNotBlank(bo.getUserName()), BusComplaintBoxDisposeLogging::getUserName, bo.getUserName());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getIsRefund()), BusComplaintBoxDisposeLogging::getIsRefund, bo.getIsRefund());
|
||||||
|
return lqw;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增意见箱-意见处理记录
|
||||||
|
*
|
||||||
|
* @param bo 意见箱-意见处理记录
|
||||||
|
* @return 是否新增成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean insertByBo(BusComplaintBoxDisposeLoggingBo bo) {
|
||||||
|
BusComplaintBoxDisposeLogging add = MapstructUtils.convert(bo, BusComplaintBoxDisposeLogging.class);
|
||||||
|
validEntityBeforeSave(add);
|
||||||
|
boolean flag = baseMapper.insert(add) > 0;
|
||||||
|
if (flag) {
|
||||||
|
bo.setId(add.getId());
|
||||||
|
}
|
||||||
|
return flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改意见箱-意见处理记录
|
||||||
|
*
|
||||||
|
* @param bo 意见箱-意见处理记录
|
||||||
|
* @return 是否修改成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean updateByBo(BusComplaintBoxDisposeLoggingBo bo) {
|
||||||
|
BusComplaintBoxDisposeLogging update = MapstructUtils.convert(bo, BusComplaintBoxDisposeLogging.class);
|
||||||
|
validEntityBeforeSave(update);
|
||||||
|
return baseMapper.updateById(update) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存前的数据校验
|
||||||
|
*/
|
||||||
|
private void validEntityBeforeSave(BusComplaintBoxDisposeLogging entity){
|
||||||
|
//TODO 做一些数据校验,如唯一约束
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验并批量删除意见箱-意见处理记录信息
|
||||||
|
*
|
||||||
|
* @param ids 待删除的主键集合
|
||||||
|
* @param isValid 是否进行有效性校验
|
||||||
|
* @return 是否删除成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||||
|
if(isValid){
|
||||||
|
//TODO 做一些业务上的校验,判断是否需要校验
|
||||||
|
}
|
||||||
|
return baseMapper.deleteByIds(ids) > 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,223 @@
|
|||||||
|
package org.dromara.complaintBox.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.dromara.common.core.domain.model.LoginUser;
|
||||||
|
import org.dromara.common.core.exception.ServiceException;
|
||||||
|
import org.dromara.common.core.utils.MapstructUtils;
|
||||||
|
import org.dromara.common.core.utils.StringUtils;
|
||||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.dromara.common.satoken.utils.LoginHelper;
|
||||||
|
import org.dromara.complaintBox.domain.BusComplaintBox;
|
||||||
|
import org.dromara.complaintBox.mapper.BusComplaintBoxMapper;
|
||||||
|
import org.dromara.complaintBox.service.IBusComplaintBoxService;
|
||||||
|
import org.dromara.system.domain.vo.SysUserVo;
|
||||||
|
import org.dromara.system.service.ISysUserService;
|
||||||
|
import org.springframework.context.annotation.Lazy;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.dromara.complaintBox.domain.bo.BusComplaintBoxMessageLoggingBo;
|
||||||
|
import org.dromara.complaintBox.domain.vo.BusComplaintBoxMessageLoggingVo;
|
||||||
|
import org.dromara.complaintBox.domain.BusComplaintBoxMessageLogging;
|
||||||
|
import org.dromara.complaintBox.mapper.BusComplaintBoxMessageLoggingMapper;
|
||||||
|
import org.dromara.complaintBox.service.IBusComplaintBoxMessageLoggingService;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 意见箱-意见沟通记录Service业务层处理
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-11-29
|
||||||
|
*/
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Service
|
||||||
|
public class BusComplaintBoxMessageLoggingServiceImpl extends ServiceImpl<BusComplaintBoxMessageLoggingMapper, BusComplaintBoxMessageLogging> implements IBusComplaintBoxMessageLoggingService {
|
||||||
|
|
||||||
|
private final BusComplaintBoxMessageLoggingMapper baseMapper;
|
||||||
|
@Lazy
|
||||||
|
private final ISysUserService sysUserService;
|
||||||
|
// @Lazy
|
||||||
|
private final BusComplaintBoxMapper busComplaintBoxMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询意见箱-意见沟通记录
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 意见箱-意见沟通记录
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public BusComplaintBoxMessageLoggingVo queryById(Long id){
|
||||||
|
return baseMapper.selectVoById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询意见箱-意见沟通记录列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @param pageQuery 分页参数
|
||||||
|
* @return 意见箱-意见沟通记录分页列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public TableDataInfo<BusComplaintBoxMessageLoggingVo> queryPageList(BusComplaintBoxMessageLoggingBo bo, PageQuery pageQuery) {
|
||||||
|
LambdaQueryWrapper<BusComplaintBoxMessageLogging> lqw = buildQueryWrapper(bo);
|
||||||
|
Page<BusComplaintBoxMessageLoggingVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||||
|
return TableDataInfo.build(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询符合条件的意见箱-意见沟通记录列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @return 意见箱-意见沟通记录列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<BusComplaintBoxMessageLoggingVo> queryList(BusComplaintBoxMessageLoggingBo bo) {
|
||||||
|
LambdaQueryWrapper<BusComplaintBoxMessageLogging> lqw = buildQueryWrapper(bo);
|
||||||
|
return baseMapper.selectVoList(lqw);
|
||||||
|
}
|
||||||
|
|
||||||
|
private LambdaQueryWrapper<BusComplaintBoxMessageLogging> buildQueryWrapper(BusComplaintBoxMessageLoggingBo bo) {
|
||||||
|
Map<String, Object> params = bo.getParams();
|
||||||
|
LambdaQueryWrapper<BusComplaintBoxMessageLogging> lqw = Wrappers.lambdaQuery();
|
||||||
|
lqw.orderByDesc(BusComplaintBoxMessageLogging::getId);
|
||||||
|
lqw.eq(bo.getComplaintId() != null, BusComplaintBoxMessageLogging::getComplaintId, bo.getComplaintId());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getDetails()), BusComplaintBoxMessageLogging::getDetails, bo.getDetails());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getStatus()), BusComplaintBoxMessageLogging::getStatus, bo.getStatus());
|
||||||
|
return lqw;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增意见箱-意见沟通记录
|
||||||
|
*
|
||||||
|
* @param bo 意见箱-意见沟通记录
|
||||||
|
* @return 是否新增成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean insertAppByBo(BusComplaintBoxMessageLoggingBo bo) {
|
||||||
|
LoginUser loginUser = LoginHelper.getLoginUser();
|
||||||
|
if (loginUser == null) {
|
||||||
|
throw new ServiceException("登录信息出错,请重新登录!!!");
|
||||||
|
}
|
||||||
|
BusComplaintBox busComplaintBox = busComplaintBoxMapper.selectById(bo.getComplaintId());
|
||||||
|
if (busComplaintBox == null) {
|
||||||
|
throw new ServiceException("意见信息找不到!!!");
|
||||||
|
}
|
||||||
|
if ("14".equals(busComplaintBox.getStatus()) || "9".equals(busComplaintBox.getStatus())) {
|
||||||
|
throw new ServiceException("意见已关闭!!!");
|
||||||
|
}
|
||||||
|
SysUserVo sysUserVo = sysUserService.selectUserById(loginUser.getUserId());
|
||||||
|
bo.setReplyUserId(sysUserVo.getUserId());
|
||||||
|
bo.setReplyUserName(sysUserVo.getNickName());
|
||||||
|
bo.setReplyAvatar(sysUserVo.getAvatar());
|
||||||
|
BusComplaintBoxMessageLogging add = MapstructUtils.convert(bo, BusComplaintBoxMessageLogging.class);
|
||||||
|
if (busComplaintBox.getCurrentDisposeUserId() != null) {
|
||||||
|
SysUserVo userVo = sysUserService.selectUserById(busComplaintBox.getCurrentDisposeUserId());
|
||||||
|
if (userVo != null) {
|
||||||
|
add.setRepliedUserId(userVo.getUserId());
|
||||||
|
add.setRepliedUserName(userVo.getUserName());
|
||||||
|
add.setRepliedAvatar(userVo.getAvatar());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
validEntityBeforeSave(add);
|
||||||
|
boolean flag = baseMapper.insert(add) > 0;
|
||||||
|
if (flag) {
|
||||||
|
bo.setId(add.getId());
|
||||||
|
}
|
||||||
|
return flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public Boolean insertWebByBo(BusComplaintBoxMessageLoggingBo bo) {
|
||||||
|
LoginUser loginUser = LoginHelper.getLoginUser();
|
||||||
|
if (loginUser == null) {
|
||||||
|
throw new ServiceException("登录信息出错,请重新登录!!!");
|
||||||
|
}
|
||||||
|
BusComplaintBox busComplaintBox = busComplaintBoxMapper.selectById(bo.getComplaintId());
|
||||||
|
if (busComplaintBox == null) {
|
||||||
|
throw new ServiceException("意见信息找不到!!!");
|
||||||
|
}
|
||||||
|
if (busComplaintBox.getCurrentDisposeUserId()!= null && !loginUser.getUserId().equals(busComplaintBox.getCurrentDisposeUserId())) {
|
||||||
|
throw new ServiceException("处理人异常");
|
||||||
|
}
|
||||||
|
if ("0".equals(busComplaintBox.getStatus())){
|
||||||
|
throw new ServiceException("意见未处理,不能发布信息");
|
||||||
|
}
|
||||||
|
if ("14".equals(busComplaintBox.getStatus()) || "9".equals(busComplaintBox.getStatus())) {
|
||||||
|
throw new ServiceException("意见已关闭!!!");
|
||||||
|
}
|
||||||
|
SysUserVo sysUserVo = sysUserService.selectUserById(loginUser.getUserId());
|
||||||
|
bo.setReplyUserId(sysUserVo.getUserId());
|
||||||
|
bo.setReplyUserName(sysUserVo.getNickName());
|
||||||
|
bo.setReplyAvatar(sysUserVo.getAvatar());
|
||||||
|
BusComplaintBoxMessageLogging add = MapstructUtils.convert(bo, BusComplaintBoxMessageLogging.class);
|
||||||
|
add.setRepliedUserId(busComplaintBox.getUserId());
|
||||||
|
add.setRepliedUserName(busComplaintBox.getUserName());
|
||||||
|
add.setRepliedAvatar(busComplaintBox.getAvatar());
|
||||||
|
|
||||||
|
validEntityBeforeSave(add);
|
||||||
|
boolean flag = baseMapper.insert(add) > 0;
|
||||||
|
// if ("0".equals(busComplaintBox.getStatus())){
|
||||||
|
// busComplaintBox.setStatus("5");
|
||||||
|
// busComplaintBox.setCurrentDisposeUserId(sysUserVo.getUserId());
|
||||||
|
// busComplaintBoxMapper.updateById(busComplaintBox);
|
||||||
|
// }
|
||||||
|
if (flag) {
|
||||||
|
bo.setId(add.getId());
|
||||||
|
}
|
||||||
|
return flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改意见箱-意见沟通记录
|
||||||
|
*
|
||||||
|
* @param bo 意见箱-意见沟通记录
|
||||||
|
* @return 是否修改成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean updateByBo(BusComplaintBoxMessageLoggingBo bo) {
|
||||||
|
BusComplaintBoxMessageLogging update = MapstructUtils.convert(bo, BusComplaintBoxMessageLogging.class);
|
||||||
|
validEntityBeforeSave(update);
|
||||||
|
return baseMapper.updateById(update) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存前的数据校验
|
||||||
|
*/
|
||||||
|
private void validEntityBeforeSave(BusComplaintBoxMessageLogging entity){
|
||||||
|
//TODO 做一些数据校验,如唯一约束
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验并批量删除意见箱-意见沟通记录信息
|
||||||
|
*
|
||||||
|
* @param ids 待删除的主键集合
|
||||||
|
* @param isValid 是否进行有效性校验
|
||||||
|
* @return 是否删除成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||||
|
if(isValid){
|
||||||
|
//TODO 做一些业务上的校验,判断是否需要校验
|
||||||
|
}
|
||||||
|
return baseMapper.deleteByIds(ids) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据意见id获取沟通记录
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<BusComplaintBoxMessageLoggingVo> getMessageLogListByComplaintId(Long id) {
|
||||||
|
return baseMapper.selectVoList(new LambdaQueryWrapper<BusComplaintBoxMessageLogging>().eq(BusComplaintBoxMessageLogging::getComplaintId, id));
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,380 @@
|
|||||||
|
package org.dromara.complaintBox.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.dromara.common.core.domain.model.LoginUser;
|
||||||
|
import org.dromara.common.core.exception.ServiceException;
|
||||||
|
import org.dromara.common.core.utils.MapstructUtils;
|
||||||
|
import org.dromara.common.core.utils.StringUtils;
|
||||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.dromara.common.satoken.utils.LoginHelper;
|
||||||
|
import org.dromara.complaintBox.app.domain.vo.AppDetailsOfTheOpinionVo;
|
||||||
|
import org.dromara.complaintBox.domain.BusComplaintBoxDisposeLogging;
|
||||||
|
import org.dromara.complaintBox.domain.BusComplaintBoxMessageLogging;
|
||||||
|
import org.dromara.complaintBox.domain.vo.BusComplaintBoxMessageLoggingVo;
|
||||||
|
import org.dromara.complaintBox.domain.vo.ComplaintBoxCountVo;
|
||||||
|
import org.dromara.complaintBox.domain.vo.DetailsOfTheOpinionVo;
|
||||||
|
import org.dromara.complaintBox.mapper.BusComplaintBoxMessageLoggingMapper;
|
||||||
|
import org.dromara.complaintBox.service.IBusComplaintBoxDisposeLoggingService;
|
||||||
|
import org.dromara.complaintBox.service.IBusComplaintBoxMessageLoggingService;
|
||||||
|
import org.dromara.system.domain.vo.SysDeptVo;
|
||||||
|
import org.dromara.system.domain.vo.SysOssVo;
|
||||||
|
import org.dromara.system.domain.vo.SysUserVo;
|
||||||
|
import org.dromara.system.service.ISysDeptService;
|
||||||
|
import org.dromara.system.service.ISysOssService;
|
||||||
|
import org.dromara.system.service.ISysUserService;
|
||||||
|
import org.springframework.context.annotation.Lazy;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.dromara.complaintBox.domain.bo.BusComplaintBoxBo;
|
||||||
|
import org.dromara.complaintBox.domain.vo.BusComplaintBoxVo;
|
||||||
|
import org.dromara.complaintBox.domain.BusComplaintBox;
|
||||||
|
import org.dromara.complaintBox.mapper.BusComplaintBoxMapper;
|
||||||
|
import org.dromara.complaintBox.service.IBusComplaintBoxService;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 意见箱Service业务层处理
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-11-29
|
||||||
|
*/
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Service
|
||||||
|
public class BusComplaintBoxServiceImpl extends ServiceImpl<BusComplaintBoxMapper, BusComplaintBox> implements IBusComplaintBoxService {
|
||||||
|
|
||||||
|
private final BusComplaintBoxMapper baseMapper;
|
||||||
|
// @Lazy
|
||||||
|
private final BusComplaintBoxMessageLoggingMapper messageLoggingMapper;
|
||||||
|
@Lazy
|
||||||
|
@Resource
|
||||||
|
private ISysUserService sysUserService;
|
||||||
|
@Lazy
|
||||||
|
@Resource
|
||||||
|
private ISysDeptService sysDeptService;
|
||||||
|
@Lazy
|
||||||
|
@Resource
|
||||||
|
private ISysOssService sysOssService;
|
||||||
|
@Lazy
|
||||||
|
@Resource
|
||||||
|
private IBusComplaintBoxDisposeLoggingService disposeLoggingService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询意见箱
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 意见箱
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public BusComplaintBoxVo queryById(Long id){
|
||||||
|
return baseMapper.selectVoById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询意见箱列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @param pageQuery 分页参数
|
||||||
|
* @return 意见箱分页列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public TableDataInfo<BusComplaintBoxVo> queryPageList(BusComplaintBoxBo bo, PageQuery pageQuery) {
|
||||||
|
Page<BusComplaintBoxVo> result = baseMapper.selectVoPageWebList(pageQuery.build(), bo);
|
||||||
|
return TableDataInfo.build(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询符合条件的意见箱列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @return 意见箱列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<BusComplaintBoxVo> queryList(BusComplaintBoxBo bo) {
|
||||||
|
LambdaQueryWrapper<BusComplaintBox> lqw = buildQueryWrapper(bo);
|
||||||
|
return baseMapper.selectVoList(lqw);
|
||||||
|
}
|
||||||
|
|
||||||
|
private LambdaQueryWrapper<BusComplaintBox> buildQueryWrapper(BusComplaintBoxBo bo) {
|
||||||
|
Map<String, Object> params = bo.getParams();
|
||||||
|
LambdaQueryWrapper<BusComplaintBox> lqw = Wrappers.lambdaQuery();
|
||||||
|
lqw.orderByDesc(BusComplaintBox::getId);
|
||||||
|
lqw.eq(bo.getCompanyId() != null, BusComplaintBox::getCompanyId, bo.getCompanyId());
|
||||||
|
lqw.eq(bo.getProjectId() != null, BusComplaintBox::getProjectId, bo.getProjectId());
|
||||||
|
lqw.eq(bo.getUserId() != null, BusComplaintBox::getUserId, bo.getUserId());
|
||||||
|
lqw.eq(bo.getCurrentDisposeUserId() != null,
|
||||||
|
BusComplaintBox::getCurrentDisposeUserId, bo.getCurrentDisposeUserId())
|
||||||
|
.or()
|
||||||
|
.isNull(BusComplaintBox::getCurrentDisposeUserId);
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getTitle()), BusComplaintBox::getTitle, bo.getTitle());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getOpinionType()), BusComplaintBox::getOpinionType, bo.getOpinionType());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getDetail()), BusComplaintBox::getDetail, bo.getDetail());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getFileId()), BusComplaintBox::getFileId, bo.getFileId());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getIsCryptonym()), BusComplaintBox::getIsCryptonym, bo.getIsCryptonym());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getStatus()), BusComplaintBox::getStatus, bo.getStatus());
|
||||||
|
return lqw;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增意见箱
|
||||||
|
*
|
||||||
|
* @param bo 意见箱
|
||||||
|
* @return 是否新增成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean insertByBo(BusComplaintBoxBo bo) {
|
||||||
|
BusComplaintBox add = MapstructUtils.convert(bo, BusComplaintBox.class);
|
||||||
|
//获取用户信息进行填充
|
||||||
|
SysUserVo sysUserVo = sysUserService.selectUserById(add.getUserId());
|
||||||
|
add.setAvatar(sysUserVo.getAvatar());
|
||||||
|
add.setUserName(sysUserVo.getNickName());
|
||||||
|
//获取部门信息
|
||||||
|
SysDeptVo sysDeptVo =sysDeptService.selectDeptById(sysUserVo.getDeptId());
|
||||||
|
if (sysDeptVo != null) {
|
||||||
|
String[] split = sysDeptVo.getAncestors().split(",");
|
||||||
|
if (split.length > 0) {
|
||||||
|
//当祖级列表长度大于3时取第2个作为公司id
|
||||||
|
if (split.length > 1) {
|
||||||
|
add.setCompanyId(Long.parseLong(split[1]));
|
||||||
|
}else {
|
||||||
|
add.setCompanyId(Long.parseLong(split[0]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
validEntityBeforeSave(add);
|
||||||
|
boolean flag = baseMapper.insert(add) > 0;
|
||||||
|
if (flag) {
|
||||||
|
bo.setId(add.getId());
|
||||||
|
}
|
||||||
|
return flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改意见箱
|
||||||
|
*
|
||||||
|
* @param bo 意见箱
|
||||||
|
* @return 是否修改成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean updateByBo(BusComplaintBoxBo bo) {
|
||||||
|
BusComplaintBox update = MapstructUtils.convert(bo, BusComplaintBox.class);
|
||||||
|
validEntityBeforeSave(update);
|
||||||
|
return baseMapper.updateById(update) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存前的数据校验
|
||||||
|
*/
|
||||||
|
private void validEntityBeforeSave(BusComplaintBox entity){
|
||||||
|
//TODO 做一些数据校验,如唯一约束
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验并批量删除意见箱信息
|
||||||
|
*
|
||||||
|
* @param ids 待删除的主键集合
|
||||||
|
* @param isValid 是否进行有效性校验
|
||||||
|
* @return 是否删除成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||||
|
if(isValid){
|
||||||
|
//TODO 做一些业务上的校验,判断是否需要校验
|
||||||
|
}
|
||||||
|
return baseMapper.deleteByIds(ids) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* app获取当前用户提出意见列表
|
||||||
|
* @param bo
|
||||||
|
* @param pageQuery
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public TableDataInfo<BusComplaintBoxVo> appQueryPageList(BusComplaintBoxBo bo, PageQuery pageQuery) {
|
||||||
|
Page<BusComplaintBoxVo> result = baseMapper.selectVoPageList(pageQuery.build(), bo);
|
||||||
|
return TableDataInfo.build(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* app获取当前意见详情
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public AppDetailsOfTheOpinionVo appQueryById(Long id) {
|
||||||
|
AppDetailsOfTheOpinionVo vo = new AppDetailsOfTheOpinionVo();
|
||||||
|
BusComplaintBoxVo busComplaintBoxVo = baseMapper.selectVoById(id);
|
||||||
|
if(busComplaintBoxVo == null){
|
||||||
|
throw new ServiceException("找不到意见信息!!!");
|
||||||
|
}
|
||||||
|
if (busComplaintBoxVo.getAvatar() != null){
|
||||||
|
SysOssVo ossVo = sysOssService.getById(busComplaintBoxVo.getAvatar());
|
||||||
|
if (ossVo != null){
|
||||||
|
busComplaintBoxVo.setAvatarUrl(ossVo.getUrl());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (busComplaintBoxVo.getFileId() != null){
|
||||||
|
String[] split = busComplaintBoxVo.getFileId().split(",");
|
||||||
|
List<Long> fileIds = Arrays.stream(split)
|
||||||
|
.filter(str -> str != null && !str.trim().isEmpty()) // 过滤空值和空白字符串
|
||||||
|
.map(str -> {
|
||||||
|
try {
|
||||||
|
return Long.valueOf(str.trim());
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
// 转换失败时可返回null,后续再过滤
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.filter(Objects::nonNull) // 过滤转换失败的null值
|
||||||
|
.toList();
|
||||||
|
List<SysOssVo> sysOssVos = sysOssService.listByIds(fileIds);
|
||||||
|
List<String> urls = new ArrayList<>();
|
||||||
|
sysOssVos.forEach(sysOssVo -> {
|
||||||
|
if (sysOssVo != null){
|
||||||
|
urls.add(sysOssVo.getUrl());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
busComplaintBoxVo.setFileUrls(urls);
|
||||||
|
}
|
||||||
|
vo.setBusComplaintBoxVo(busComplaintBoxVo);
|
||||||
|
List<BusComplaintBoxMessageLoggingVo> messageLoggingVos = messageLoggingMapper.selectVoList(new LambdaQueryWrapper<BusComplaintBoxMessageLogging>().eq(BusComplaintBoxMessageLogging::getComplaintId, id));
|
||||||
|
if(CollectionUtils.isNotEmpty(messageLoggingVos)){
|
||||||
|
messageLoggingVos.forEach(mvo->{
|
||||||
|
if (mvo.getReplyAvatar() != null){
|
||||||
|
SysOssVo ossVo = sysOssService.getById(mvo.getReplyAvatar());
|
||||||
|
if (ossVo != null){
|
||||||
|
mvo.setReplyAvatarUrl(ossVo.getUrl());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (mvo.getRepliedAvatar() != null){
|
||||||
|
SysOssVo ossVo = sysOssService.getById(mvo.getRepliedAvatar());
|
||||||
|
if (ossVo != null){
|
||||||
|
mvo.setRepliedAvatarUrl(ossVo.getUrl());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
vo.setMessageLoggingVos(messageLoggingVos);
|
||||||
|
}
|
||||||
|
return vo;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DetailsOfTheOpinionVo getInfo(Long id) {
|
||||||
|
DetailsOfTheOpinionVo vo = new DetailsOfTheOpinionVo();
|
||||||
|
BusComplaintBoxVo busComplaintBoxVo = baseMapper.selectVoById(id);
|
||||||
|
if(busComplaintBoxVo == null){
|
||||||
|
throw new ServiceException("找不到意见信息!!!");
|
||||||
|
}
|
||||||
|
vo.setBusComplaintBoxVo(busComplaintBoxVo);
|
||||||
|
List<BusComplaintBoxMessageLoggingVo> messageLoggingVos = messageLoggingMapper.selectVoList(new LambdaQueryWrapper<BusComplaintBoxMessageLogging>().eq(BusComplaintBoxMessageLogging::getComplaintId, id));
|
||||||
|
if(CollectionUtils.isNotEmpty(messageLoggingVos)){
|
||||||
|
messageLoggingVos.forEach(messageLoggingVo->{
|
||||||
|
messageLoggingVo.setType(messageLoggingVo.getReplyUserId().equals(busComplaintBoxVo.getUserId()) ? 0 : 1);
|
||||||
|
if (messageLoggingVo.getReplyAvatar() != null){
|
||||||
|
SysOssVo ossVo = sysOssService.getById(messageLoggingVo.getReplyAvatar());
|
||||||
|
if (ossVo != null){
|
||||||
|
messageLoggingVo.setReplyAvatarUrl(ossVo.getUrl());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (messageLoggingVo.getRepliedAvatar() != null){
|
||||||
|
SysOssVo ossVo = sysOssService.getById(messageLoggingVo.getRepliedAvatar());
|
||||||
|
if (ossVo != null){
|
||||||
|
messageLoggingVo.setRepliedAvatarUrl(ossVo.getUrl());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
vo.setMessageLoggingVos(messageLoggingVos);
|
||||||
|
}
|
||||||
|
return vo;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* app修改沟通记录阅读状态
|
||||||
|
* @param bo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int editCheckStatus(BusComplaintBoxBo bo) {
|
||||||
|
if (bo.getId() == null || bo.getUserId() == null) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
Long count = messageLoggingMapper.selectCount(new LambdaQueryWrapper<BusComplaintBoxMessageLogging>()
|
||||||
|
.eq(BusComplaintBoxMessageLogging::getStatus,"0")
|
||||||
|
.eq(BusComplaintBoxMessageLogging::getComplaintId, bo.getId())
|
||||||
|
.eq(BusComplaintBoxMessageLogging::getRepliedUserId, bo.getUserId()));
|
||||||
|
if (count == 0) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return messageLoggingMapper.update(new LambdaUpdateWrapper<BusComplaintBoxMessageLogging>()
|
||||||
|
.set(BusComplaintBoxMessageLogging::getStatus,"1")
|
||||||
|
.eq(BusComplaintBoxMessageLogging::getComplaintId,bo.getId())
|
||||||
|
.eq(BusComplaintBoxMessageLogging::getRepliedUserId,bo.getUserId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ComplaintBoxCountVo> getCount(BusComplaintBoxBo bo) {
|
||||||
|
|
||||||
|
return baseMapper.getCount(bo);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public int editStatus(BusComplaintBoxBo bo) {
|
||||||
|
if (bo.getStatus() == null){
|
||||||
|
throw new ServiceException("意见状态不能为空");
|
||||||
|
}
|
||||||
|
BusComplaintBoxVo busComplaintBoxVo = baseMapper.selectVoById(bo.getId());
|
||||||
|
if (busComplaintBoxVo == null){
|
||||||
|
throw new ServiceException("找不到意见!!");
|
||||||
|
}
|
||||||
|
if ("14".equals(busComplaintBoxVo.getStatus())){
|
||||||
|
throw new ServiceException("该意见已经关闭,不允许再修改状态");
|
||||||
|
}
|
||||||
|
LambdaUpdateWrapper<BusComplaintBox> lqw = new LambdaUpdateWrapper<BusComplaintBox>();
|
||||||
|
lqw.set(BusComplaintBox::getStatus, bo.getStatus());
|
||||||
|
lqw.eq(BusComplaintBox::getId, bo.getId());
|
||||||
|
if ("5".equals(bo.getStatus())){
|
||||||
|
BusComplaintBoxDisposeLogging logging = new BusComplaintBoxDisposeLogging();
|
||||||
|
logging.setComplaintId(bo.getId());
|
||||||
|
LoginUser loginUser = LoginHelper.getLoginUser();
|
||||||
|
SysUserVo sysUserVo = sysUserService.selectUserById(loginUser.getUserId());
|
||||||
|
if (sysUserVo == null){
|
||||||
|
throw new ServiceException("找不到当前登录用户信息!");
|
||||||
|
}
|
||||||
|
lqw.set(BusComplaintBox::getCurrentDisposeUserId, loginUser.getUserId());
|
||||||
|
logging.setUserId(loginUser.getUserId());
|
||||||
|
logging.setUserName(sysUserVo.getNickName());
|
||||||
|
logging.setAvatar(sysUserVo.getAvatar());
|
||||||
|
disposeLoggingService.save(logging);
|
||||||
|
}
|
||||||
|
if ("0".equals(bo.getStatus())){
|
||||||
|
lqw.set(BusComplaintBox::getCurrentDisposeUserId, null);
|
||||||
|
BusComplaintBoxDisposeLogging logging = disposeLoggingService.getBaseMapper()
|
||||||
|
.selectOne(new LambdaQueryWrapper<BusComplaintBoxDisposeLogging>()
|
||||||
|
.eq(BusComplaintBoxDisposeLogging::getComplaintId, bo.getId())
|
||||||
|
.eq(BusComplaintBoxDisposeLogging::getUserId, busComplaintBoxVo.getCurrentDisposeUserId())
|
||||||
|
.eq(BusComplaintBoxDisposeLogging::getIsRefund, "0"));
|
||||||
|
if (logging == null){
|
||||||
|
throw new ServiceException("找不到处理人记录");
|
||||||
|
}
|
||||||
|
logging.setIsRefund("1");
|
||||||
|
logging.setCause(bo.getCause());
|
||||||
|
disposeLoggingService.updateById(logging);
|
||||||
|
}
|
||||||
|
return baseMapper.update(lqw);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,65 @@
|
|||||||
|
package org.dromara.contractor.controller;
|
||||||
|
|
||||||
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.dromara.common.core.domain.R;
|
||||||
|
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||||
|
import org.dromara.common.log.annotation.Log;
|
||||||
|
import org.dromara.common.log.enums.BusinessType;
|
||||||
|
import org.dromara.common.web.core.BaseController;
|
||||||
|
import org.dromara.contractor.domain.dto.attendancemachineuser.SubAttendanceMachineSendInfoUserReq;
|
||||||
|
import org.dromara.contractor.domain.dto.attendancemachineuser.SubAttendanceMachineUserQueryReq;
|
||||||
|
import org.dromara.contractor.domain.dto.attendancemachineuser.SubAttendanceMachineUserRemoveReq;
|
||||||
|
import org.dromara.contractor.domain.vo.SubAttendanceMachineUserVo;
|
||||||
|
import org.dromara.contractor.service.ISubAttendanceMachineUserService;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分包考勤机用户
|
||||||
|
*
|
||||||
|
* @author lilemy
|
||||||
|
* @date 2025-11-21 15:38
|
||||||
|
*/
|
||||||
|
@Validated
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/contractor/attendanceMachineUser")
|
||||||
|
public class SubAttendanceMachineUserController extends BaseController {
|
||||||
|
|
||||||
|
private final ISubAttendanceMachineUserService subAttendanceMachineUserService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询考勤机用户列表
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("contractor:attendanceMachineUser:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public R<List<SubAttendanceMachineUserVo>> list(SubAttendanceMachineUserQueryReq req) {
|
||||||
|
return R.ok(subAttendanceMachineUserService.queryList(req));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 下发用户到考勤机中
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("contractor:attendanceMachineUser:add")
|
||||||
|
@Log(title = "分包考勤机用户", businessType = BusinessType.INSERT)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PostMapping("/send")
|
||||||
|
public R<String> sendPersonInfo(@Validated @RequestBody SubAttendanceMachineSendInfoUserReq req) {
|
||||||
|
return R.ok(subAttendanceMachineUserService.sendPersonInfo(req));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除考勤机用户
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("contractor:attendanceMachineUser:remove")
|
||||||
|
@Log(title = "分包考勤机用户", businessType = BusinessType.DELETE)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@DeleteMapping()
|
||||||
|
public R<Void> remove(@Validated @RequestBody SubAttendanceMachineUserRemoveReq req) {
|
||||||
|
return toAjax(subAttendanceMachineUserService.remove(req));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -140,7 +140,7 @@ public class SubConstructionUserController extends BaseController {
|
|||||||
*
|
*
|
||||||
* @param id 主键
|
* @param id 主键
|
||||||
*/
|
*/
|
||||||
@SaCheckPermission("contractor:constructionUser:query")
|
// @SaCheckPermission("contractor:constructionUser:query")
|
||||||
@GetMapping("/{id}")
|
@GetMapping("/{id}")
|
||||||
public R<SubConstructionUserVo> getInfo(@NotNull(message = "主键不能为空")
|
public R<SubConstructionUserVo> getInfo(@NotNull(message = "主键不能为空")
|
||||||
@PathVariable Long id) {
|
@PathVariable Long id) {
|
||||||
@ -397,6 +397,7 @@ public class SubConstructionUserController extends BaseController {
|
|||||||
vo.setUploadFile("部分上传");
|
vo.setUploadFile("部分上传");
|
||||||
}
|
}
|
||||||
dataList.add(vo);
|
dataList.add(vo);
|
||||||
|
order++;
|
||||||
}
|
}
|
||||||
// 写入当前Sheet的数据
|
// 写入当前Sheet的数据
|
||||||
excelWriter.write(dataList, writeSheet);
|
excelWriter.write(dataList, writeSheet);
|
||||||
@ -441,7 +442,9 @@ public class SubConstructionUserController extends BaseController {
|
|||||||
} else {
|
} else {
|
||||||
vo.setUploadFile("部分上传");
|
vo.setUploadFile("部分上传");
|
||||||
}
|
}
|
||||||
|
vo.setTeamName(null);
|
||||||
dataList.add(vo);
|
dataList.add(vo);
|
||||||
|
order++;
|
||||||
}
|
}
|
||||||
// 写入当前Sheet的数据
|
// 写入当前Sheet的数据
|
||||||
excelWriter.write(dataList, writeSheet);
|
excelWriter.write(dataList, writeSheet);
|
||||||
|
|||||||
@ -21,6 +21,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 施工人员文件存储
|
* 施工人员文件存储
|
||||||
@ -45,6 +46,21 @@ public class SubConstructionUserFileController extends BaseController {
|
|||||||
return R.ok(constructionUserFileService.queryList(req));
|
return R.ok(constructionUserFileService.queryList(req));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 下载用户文件的ZIP(按类型分文件夹)
|
||||||
|
* @param userId 用户ID
|
||||||
|
*/
|
||||||
|
@GetMapping("/downloadFiles")
|
||||||
|
public void downloadUserFilesByType(Long userId,String type, HttpServletResponse response) {
|
||||||
|
try {
|
||||||
|
constructionUserFileService.generateTypeGroupZip(userId,type, response);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出施工人员文件存储列表
|
* 导出施工人员文件存储列表
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
package org.dromara.contractor.controller;
|
package org.dromara.contractor.controller;
|
||||||
|
|
||||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
|
import cn.dev33.satoken.annotation.SaMode;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import jakarta.validation.constraints.NotEmpty;
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
@ -38,9 +39,9 @@ public class SubSubcontractController extends BaseController {
|
|||||||
private ISubSubcontractService subcontractService;
|
private ISubSubcontractService subcontractService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询分包合同列表
|
* 查询分包合同列表 project:projectTeam:addTeam
|
||||||
*/
|
*/
|
||||||
@SaCheckPermission("contractor:subcontract:list")
|
@SaCheckPermission(value = {"contractor:subcontract:list", "project:projectTeam:addTeam"}, mode = SaMode.OR)
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public TableDataInfo<SubSubcontractVo> list(SubSubcontractQueryReq req, PageQuery pageQuery) {
|
public TableDataInfo<SubSubcontractVo> list(SubSubcontractQueryReq req, PageQuery pageQuery) {
|
||||||
return subcontractService.queryPageList(req, pageQuery);
|
return subcontractService.queryPageList(req, pageQuery);
|
||||||
|
|||||||
@ -0,0 +1,32 @@
|
|||||||
|
package org.dromara.contractor.domain.dto.attendancemachineuser;
|
||||||
|
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author lilemy
|
||||||
|
* @date 2025-11-21 15:36
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class SubAttendanceMachineSendInfoUserReq implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = -6517799483848691652L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 考勤机主键ID
|
||||||
|
*/
|
||||||
|
@NotNull(message = "考勤机不能为空")
|
||||||
|
private Long machineId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户ID列表
|
||||||
|
*/
|
||||||
|
@NotNull(message = "用户列表不能为空")
|
||||||
|
private List<Long> userIds;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,46 @@
|
|||||||
|
package org.dromara.contractor.domain.dto.attendancemachineuser;
|
||||||
|
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author lilemy
|
||||||
|
* @date 2025-11-21 15:36
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class SubAttendanceMachineUserQueryReq implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = -1629819732452840391L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 考勤机主键ID
|
||||||
|
*/
|
||||||
|
@NotNull(message = "考勤机不能为空")
|
||||||
|
private Long machineId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目ID
|
||||||
|
*/
|
||||||
|
@NotNull(message = "项目不能为空")
|
||||||
|
private Long projectId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分包ID
|
||||||
|
*/
|
||||||
|
@NotNull(message = "分包不能为空")
|
||||||
|
private Long contractorId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户名称
|
||||||
|
*/
|
||||||
|
private String userName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标识(是否下发)
|
||||||
|
*/
|
||||||
|
private Integer identifying;
|
||||||
|
}
|
||||||
@ -0,0 +1,31 @@
|
|||||||
|
package org.dromara.contractor.domain.dto.attendancemachineuser;
|
||||||
|
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author lilemy
|
||||||
|
* @date 2025-11-21 15:36
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class SubAttendanceMachineUserRemoveReq implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = -8880884070612972760L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 考勤机主键ID
|
||||||
|
*/
|
||||||
|
@NotNull(message = "考勤机不能为空")
|
||||||
|
private Long machineId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户ID列表
|
||||||
|
*/
|
||||||
|
@NotNull(message = "用户列表不能为空")
|
||||||
|
private List<Long> userIds;
|
||||||
|
}
|
||||||
@ -34,4 +34,11 @@ public class SubConstructionUserChangeProjectReq implements Serializable {
|
|||||||
*/
|
*/
|
||||||
@NotNull(message = "分包公司id不能为空")
|
@NotNull(message = "分包公司id不能为空")
|
||||||
private Long contractorId;
|
private Long contractorId;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工种
|
||||||
|
*/
|
||||||
|
private String typeOfWork;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,28 +1,23 @@
|
|||||||
package org.dromara.project.domain;
|
package org.dromara.contractor.domain.vo;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 考勤机用户对象 bus_attendance_machine_user
|
* 考勤机用户视图对象
|
||||||
*
|
*
|
||||||
* @author lilemy
|
* @author lilemy
|
||||||
* @date 2025-10-15
|
* @date 2025-11-21
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class BusAttendanceMachineUser implements Serializable {
|
public class SubAttendanceMachineUserVo implements Serializable {
|
||||||
|
|
||||||
@Serial
|
@Serial
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**
|
|
||||||
* 主键ID
|
|
||||||
*/
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 考勤机主键ID
|
* 考勤机主键ID
|
||||||
*/
|
*/
|
||||||
@ -31,26 +26,21 @@ public class BusAttendanceMachineUser implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 班组ID
|
* 班组ID
|
||||||
*/
|
*/
|
||||||
private Long teamId;
|
private Long contractorId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户ID
|
* 用户ID
|
||||||
*/
|
*/
|
||||||
private Long userId;
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户名称
|
||||||
|
*/
|
||||||
|
private String userName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 标识(是否下发)
|
* 标识(是否下发)
|
||||||
*/
|
*/
|
||||||
private Integer identifying;
|
private Integer identifying;
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建时间
|
|
||||||
*/
|
|
||||||
private Date createTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新时间
|
|
||||||
*/
|
|
||||||
private Date updateTime;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -9,12 +9,15 @@ import org.dromara.common.excel.convert.ExcelDictConvert;
|
|||||||
import org.dromara.common.translation.annotation.Translation;
|
import org.dromara.common.translation.annotation.Translation;
|
||||||
import org.dromara.common.translation.constant.TransConstant;
|
import org.dromara.common.translation.constant.TransConstant;
|
||||||
import org.dromara.contractor.domain.SubConstructionUser;
|
import org.dromara.contractor.domain.SubConstructionUser;
|
||||||
|
import org.dromara.contractor.domain.vo.constructionuserfile.SubConstructionUserFileVo;
|
||||||
|
import org.dromara.project.domain.vo.constructionuserexit.BusConstructionUserExitVo;
|
||||||
|
|
||||||
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;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -295,5 +298,29 @@ public class SubConstructionUserVo implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private Long sysUserId;
|
private Long sysUserId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 岗位(默认为0普通员工,1组长)
|
||||||
|
*/
|
||||||
private String postId;
|
private String postId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分包管理人员ID
|
||||||
|
*/
|
||||||
|
private String fbId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分包管理人员名称
|
||||||
|
*/
|
||||||
|
@Translation(type = TransConstant.USER_ID_TO_NICKNAME, mapper = "fbId")
|
||||||
|
private String fbName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件
|
||||||
|
*/
|
||||||
|
List<SubConstructionUserFileVo> subConstructionUserFileVos;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 记录
|
||||||
|
*/
|
||||||
|
List<BusConstructionUserExitVo> busConstructionUserExitVos;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,41 @@
|
|||||||
|
package org.dromara.contractor.service;
|
||||||
|
|
||||||
|
import org.dromara.contractor.domain.dto.attendancemachineuser.SubAttendanceMachineSendInfoUserReq;
|
||||||
|
import org.dromara.contractor.domain.dto.attendancemachineuser.SubAttendanceMachineUserQueryReq;
|
||||||
|
import org.dromara.contractor.domain.dto.attendancemachineuser.SubAttendanceMachineUserRemoveReq;
|
||||||
|
import org.dromara.contractor.domain.vo.SubAttendanceMachineUserVo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分包考勤机用户Service接口
|
||||||
|
*
|
||||||
|
* @author lilemy
|
||||||
|
* @date 2025-11-21 15:33
|
||||||
|
*/
|
||||||
|
public interface ISubAttendanceMachineUserService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询符合条件的考勤机用户列表
|
||||||
|
*
|
||||||
|
* @param req 查询条件
|
||||||
|
* @return 考勤机用户列表
|
||||||
|
*/
|
||||||
|
List<SubAttendanceMachineUserVo> queryList(SubAttendanceMachineUserQueryReq req);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 下发用户到考勤机中
|
||||||
|
*
|
||||||
|
* @param req 下发用户参数
|
||||||
|
* @return 下发结果
|
||||||
|
*/
|
||||||
|
String sendPersonInfo(SubAttendanceMachineSendInfoUserReq req);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除考勤机用户
|
||||||
|
*
|
||||||
|
* @param req 删除参数
|
||||||
|
* @return 删除结果
|
||||||
|
*/
|
||||||
|
Boolean remove(SubAttendanceMachineUserRemoveReq req);
|
||||||
|
}
|
||||||
@ -9,6 +9,7 @@ import org.dromara.contractor.domain.dto.constructionuserfile.SubConstructionUse
|
|||||||
import org.dromara.contractor.domain.dto.constructionuserfile.SubConstructionUserFileSaveReq;
|
import org.dromara.contractor.domain.dto.constructionuserfile.SubConstructionUserFileSaveReq;
|
||||||
import org.dromara.contractor.domain.dto.constructionuserfile.SubConstructionUserFileTemplateReq;
|
import org.dromara.contractor.domain.dto.constructionuserfile.SubConstructionUserFileTemplateReq;
|
||||||
import org.dromara.contractor.domain.vo.constructionuserfile.SubConstructionUserFileVo;
|
import org.dromara.contractor.domain.vo.constructionuserfile.SubConstructionUserFileVo;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -82,4 +83,12 @@ public interface ISubConstructionUserFileService extends IService<SubConstructio
|
|||||||
|
|
||||||
|
|
||||||
Map<String,String> getFileByUserId(Long userId);
|
Map<String,String> getFileByUserId(Long userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取施工人员文件列表
|
||||||
|
*/
|
||||||
|
Map<String,List<SubConstructionUserFileVo>> fileList(Long userId);
|
||||||
|
|
||||||
|
|
||||||
|
void generateTypeGroupZip(Long userId,String type, HttpServletResponse response) throws Exception;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,182 @@
|
|||||||
|
package org.dromara.contractor.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.dromara.common.core.constant.HttpStatus;
|
||||||
|
import org.dromara.common.core.exception.ServiceException;
|
||||||
|
import org.dromara.common.core.utils.StringUtils;
|
||||||
|
import org.dromara.contractor.domain.SubConstructionUser;
|
||||||
|
import org.dromara.contractor.domain.dto.attendancemachineuser.SubAttendanceMachineSendInfoUserReq;
|
||||||
|
import org.dromara.contractor.domain.dto.attendancemachineuser.SubAttendanceMachineUserQueryReq;
|
||||||
|
import org.dromara.contractor.domain.dto.attendancemachineuser.SubAttendanceMachineUserRemoveReq;
|
||||||
|
import org.dromara.contractor.domain.vo.SubAttendanceMachineUserVo;
|
||||||
|
import org.dromara.contractor.service.ISubAttendanceMachineUserService;
|
||||||
|
import org.dromara.contractor.service.ISubConstructionUserService;
|
||||||
|
import org.dromara.mobileAttendanceMachine.DeviceMessageSender;
|
||||||
|
import org.dromara.mobileAttendanceMachine.KqjEntity;
|
||||||
|
import org.dromara.project.domain.BusAttendanceMachine;
|
||||||
|
import org.dromara.project.service.IBusAttendanceMachineService;
|
||||||
|
import org.dromara.system.domain.vo.SysOssVo;
|
||||||
|
import org.dromara.system.domain.vo.SysUserVo;
|
||||||
|
import org.dromara.system.service.ISysOssService;
|
||||||
|
import org.dromara.system.service.ISysUserService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分包考勤机用户Service业务层处理
|
||||||
|
*
|
||||||
|
* @author lilemy
|
||||||
|
* @date 2025-11-21 15:35
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Service
|
||||||
|
public class SubAttendanceMachineUserServiceImpl implements ISubAttendanceMachineUserService {
|
||||||
|
|
||||||
|
private final IBusAttendanceMachineService attendanceMachineService;
|
||||||
|
|
||||||
|
private final DeviceMessageSender deviceMessageSender;
|
||||||
|
|
||||||
|
private final ISubConstructionUserService constructionUserService;
|
||||||
|
|
||||||
|
private final ISysUserService userService;
|
||||||
|
|
||||||
|
private final ISysOssService ossService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询符合条件的考勤机用户列表
|
||||||
|
*
|
||||||
|
* @param req 查询条件
|
||||||
|
* @return 考勤机用户列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<SubAttendanceMachineUserVo> queryList(SubAttendanceMachineUserQueryReq req) {
|
||||||
|
List<SysUserVo> userVoList = userService.selectFbUserList(req.getProjectId(), List.of(req.getContractorId()), req.getUserName());
|
||||||
|
if (CollUtil.isEmpty(userVoList)) {
|
||||||
|
return CollUtil.newArrayList();
|
||||||
|
}
|
||||||
|
BusAttendanceMachine machine = attendanceMachineService.getById(req.getMachineId());
|
||||||
|
if (machine == null) {
|
||||||
|
throw new ServiceException("考勤机不存在", HttpStatus.NOT_FOUND);
|
||||||
|
}
|
||||||
|
// 判断选择分包和考勤机是否一致
|
||||||
|
if (StringUtils.isBlank(machine.getContractors())) {
|
||||||
|
throw new ServiceException("考勤机未绑定分包", HttpStatus.NOT_FOUND);
|
||||||
|
}
|
||||||
|
if (!Arrays.stream(machine.getContractors().split(","))
|
||||||
|
.map(Long::parseLong)
|
||||||
|
.collect(Collectors.toSet()).contains(req.getContractorId())) {
|
||||||
|
throw new ServiceException("所选分包与考勤机不匹配", HttpStatus.NOT_FOUND);
|
||||||
|
}
|
||||||
|
// 获取考勤机里的用户
|
||||||
|
Set<String> userIdList = new HashSet<>();
|
||||||
|
try {
|
||||||
|
KqjEntity.CommonResponse response = deviceMessageSender.getAllUsers(machine.getSn());
|
||||||
|
int code = response.getData().getCode();
|
||||||
|
if (code == 0 || code == 200) {
|
||||||
|
log.info("获取考勤机数据成功:{}", response.getData());
|
||||||
|
String[] userIds = response.getData().getUserIds();
|
||||||
|
userIdList = Arrays.stream(userIds).collect(Collectors.toSet());
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("获取考勤机用户失败,sn:{}", machine.getSn(), e);
|
||||||
|
throw new ServiceException("获取考勤机用户失败", HttpStatus.ERROR);
|
||||||
|
}
|
||||||
|
Set<String> finalUserIdList = userIdList;
|
||||||
|
return userVoList.stream().map(userVo -> {
|
||||||
|
SubAttendanceMachineUserVo vo = new SubAttendanceMachineUserVo();
|
||||||
|
vo.setMachineId(req.getMachineId());
|
||||||
|
vo.setContractorId(req.getContractorId());
|
||||||
|
vo.setUserId(userVo.getUserId());
|
||||||
|
vo.setUserName(userVo.getNickName());
|
||||||
|
if (CollUtil.isEmpty(finalUserIdList)) {
|
||||||
|
vo.setIdentifying(0);
|
||||||
|
} else if (finalUserIdList.contains(userVo.getUserId().toString())) {
|
||||||
|
vo.setIdentifying(1);
|
||||||
|
} else {
|
||||||
|
vo.setIdentifying(0);
|
||||||
|
}
|
||||||
|
return vo;
|
||||||
|
}).toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 下发用户到考勤机中
|
||||||
|
*
|
||||||
|
* @param req 下发用户参数
|
||||||
|
* @return 下发结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String sendPersonInfo(SubAttendanceMachineSendInfoUserReq req) {
|
||||||
|
Long machineId = req.getMachineId();
|
||||||
|
List<Long> userIds = req.getUserIds();
|
||||||
|
BusAttendanceMachine machine = attendanceMachineService.getById(machineId);
|
||||||
|
if (machine == null) {
|
||||||
|
throw new ServiceException("考勤机不存在");
|
||||||
|
}
|
||||||
|
List<SubConstructionUser> userList = constructionUserService.lambdaQuery()
|
||||||
|
.in(SubConstructionUser::getSysUserId, userIds)
|
||||||
|
.list();
|
||||||
|
// 获取用户人脸照信息
|
||||||
|
List<Long> faceIds = userList.stream().map(SubConstructionUser::getFacePic).map(Long::parseLong).distinct().toList();
|
||||||
|
List<SysOssVo> ossVos = ossService.listByIds(faceIds);
|
||||||
|
Map<Long, SysOssVo> ossVoMap = ossVos.stream()
|
||||||
|
.collect(Collectors.toMap(SysOssVo::getOssId, v -> v));
|
||||||
|
// 返回数据
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append("用户:[");
|
||||||
|
int count = 0;
|
||||||
|
for (SubConstructionUser user : userList) {
|
||||||
|
String facePic = user.getFacePic();
|
||||||
|
if (StringUtils.isBlank(facePic)) {
|
||||||
|
sb.append(user.getUserName()).append(" ");
|
||||||
|
count++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
SysOssVo ossVo = ossVoMap.get(Long.parseLong(facePic));
|
||||||
|
if (ossVo == null) {
|
||||||
|
sb.append(user.getUserName()).append(" ");
|
||||||
|
count++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
Boolean result = deviceMessageSender.sendPersonnelInformation(machine.getSn(),
|
||||||
|
user.getSysUserId().toString(), user.getUserName(), ossVo.getUrl());
|
||||||
|
log.info("考勤机 Sn:{} ,用户:{} 下发成功", machine.getSn(), user.getUserName());
|
||||||
|
if (!result) {
|
||||||
|
sb.append(user.getUserName()).append(" ");
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sb.append("] 下发失败");
|
||||||
|
return count == 0 ? "下发成功" : sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除考勤机用户
|
||||||
|
*
|
||||||
|
* @param req 删除参数
|
||||||
|
* @return 删除结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean remove(SubAttendanceMachineUserRemoveReq req) {
|
||||||
|
Long machineId = req.getMachineId();
|
||||||
|
List<Long> userIds = req.getUserIds();
|
||||||
|
BusAttendanceMachine machine = attendanceMachineService.getById(machineId);
|
||||||
|
if (machine == null) {
|
||||||
|
throw new ServiceException("考勤机不存在", HttpStatus.NOT_FOUND);
|
||||||
|
}
|
||||||
|
String[] userIdArray = userIds.stream()
|
||||||
|
.map(String::valueOf) // 将 Long 转成 String
|
||||||
|
.toArray(String[]::new);
|
||||||
|
try {
|
||||||
|
KqjEntity.CommonResponse response = deviceMessageSender.batchDeleteUsers(machine.getSn(), userIdArray);
|
||||||
|
return response.getData().getCode() == 0 || response.getData().getCode() == 200;
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new ServiceException("删除考勤机用户失败", HttpStatus.ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -45,6 +45,9 @@ import org.springframework.web.multipart.MultipartFile;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.net.HttpURLConnection;
|
||||||
|
import java.net.URL;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@ -231,7 +234,7 @@ public class SubConstructionUserFileServiceImpl extends ServiceImpl<SubConstruct
|
|||||||
.select(SubConstructionUser::getId, SubConstructionUser::getSysUserId,
|
.select(SubConstructionUser::getId, SubConstructionUser::getSysUserId,
|
||||||
SubConstructionUser::getUserName, SubConstructionUser::getSfzNumber)
|
SubConstructionUser::getUserName, SubConstructionUser::getSfzNumber)
|
||||||
.eq(SubConstructionUser::getProjectId, projectId)
|
.eq(SubConstructionUser::getProjectId, projectId)
|
||||||
.eq( SubConstructionUser::getUserRole, "0")
|
.eq(SubConstructionUser::getUserRole, "0")
|
||||||
.list();
|
.list();
|
||||||
if (CollUtil.isEmpty(allUserList)) {
|
if (CollUtil.isEmpty(allUserList)) {
|
||||||
throw new ServiceException("项目下无施工人员");
|
throw new ServiceException("项目下无施工人员");
|
||||||
@ -271,7 +274,7 @@ public class SubConstructionUserFileServiceImpl extends ServiceImpl<SubConstruct
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (CollUtil.isEmpty(constructionUserFileList)) {
|
if (CollUtil.isEmpty(constructionUserFileList)) {
|
||||||
return true;
|
throw new ServiceException("未找到施工人员文件");
|
||||||
}
|
}
|
||||||
// 9. 判断是否已经存在
|
// 9. 判断是否已经存在
|
||||||
List<Long> userIdList = constructionUserFileList.stream().map(SubConstructionUserFile::getUserId).toList();
|
List<Long> userIdList = constructionUserFileList.stream().map(SubConstructionUserFile::getUserId).toList();
|
||||||
@ -470,6 +473,94 @@ public class SubConstructionUserFileServiceImpl extends ServiceImpl<SubConstruct
|
|||||||
return resultMap;
|
return resultMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, List<SubConstructionUserFileVo>> fileList(Long userId) {
|
||||||
|
|
||||||
|
List<SubConstructionUserFileVo> subConstructionUserFileVos = baseMapper.selectVoList(Wrappers.<SubConstructionUserFile>lambdaQuery()
|
||||||
|
.eq(SubConstructionUserFile::getUserId, userId));
|
||||||
|
Map<String, List<SubConstructionUserFileVo>> resultMap = subConstructionUserFileVos.stream().collect(Collectors.groupingBy(SubConstructionUserFileVo::getFileType));
|
||||||
|
return resultMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void generateTypeGroupZip(Long userId,String type, HttpServletResponse response) throws Exception {
|
||||||
|
|
||||||
|
// 1. 查询该用户的所有文件
|
||||||
|
List<SubConstructionUserFile> list = lambdaQuery()
|
||||||
|
.eq(SubConstructionUserFile::getUserId, userId)
|
||||||
|
.eq(StrUtil.isNotBlank(type),SubConstructionUserFile::getFileType, type)
|
||||||
|
.list();
|
||||||
|
if (list.isEmpty()) {
|
||||||
|
throw new ServiceException("该用户没有文件");
|
||||||
|
}
|
||||||
|
List<SysDictDataVo> userFileType = dictTypeService.selectDictDataByType("user_file_type");
|
||||||
|
Map<String, String> collect = userFileType.stream().collect(Collectors.toMap(SysDictDataVo::getDictValue, SysDictDataVo::getDictLabel));
|
||||||
|
|
||||||
|
// 3. 设置响应头(ZIP文件下载)
|
||||||
|
response.setContentType("application/zip");
|
||||||
|
response.setHeader("Content-Disposition", "attachment; filename=\"user_files.zip\"");
|
||||||
|
|
||||||
|
// 4. 压缩流直接写入响应(无临时文件)
|
||||||
|
try (ZipOutputStream zipOut = new ZipOutputStream(response.getOutputStream())) {
|
||||||
|
// 遍历每个文件类型分组
|
||||||
|
for (SubConstructionUserFile entry : list) {
|
||||||
|
String fileType = entry.getFileType(); // 文件夹名称:文件类型(如"01")
|
||||||
|
|
||||||
|
String fileTypeName = collect.get(fileType);
|
||||||
|
|
||||||
|
String fileUrl = entry.getPath();
|
||||||
|
if (StringUtils.isBlank(fileUrl)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
String[] split = fileUrl.split(",");
|
||||||
|
List<Long> ossIds = Arrays.stream(split).map(Long::valueOf).toList();
|
||||||
|
List<SysOssVo> sysOssVos = ossService.listByIds(ossIds);
|
||||||
|
for (SysOssVo sysOssVo : sysOssVos) {
|
||||||
|
String ossVoUrl = sysOssVo.getUrl();
|
||||||
|
if (StringUtils.isBlank(ossVoUrl)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
String zipEntryName = fileTypeName + "/" + sysOssVo.getOriginalName();
|
||||||
|
ZipEntry zipEntry = new ZipEntry(zipEntryName);
|
||||||
|
zipOut.putNextEntry(zipEntry);
|
||||||
|
// 下载远程文件并写入ZIP
|
||||||
|
URL url = new URL(ossVoUrl);
|
||||||
|
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
|
||||||
|
connection.setRequestMethod("GET");
|
||||||
|
connection.setConnectTimeout(5000);
|
||||||
|
connection.setReadTimeout(10000);
|
||||||
|
|
||||||
|
try (InputStream in = connection.getInputStream()) {
|
||||||
|
byte[] buffer = new byte[1024 * 8];
|
||||||
|
int len;
|
||||||
|
while ((len = in.read(buffer)) != -1) {
|
||||||
|
zipOut.write(buffer, 0, len);
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
connection.disconnect();
|
||||||
|
zipOut.closeEntry(); // 关闭当前条目
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 递归扫描指定目录,找到 “姓名-Id” 格式的文件夹并解析
|
* 递归扫描指定目录,找到 “姓名-Id” 格式的文件夹并解析
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.dromara.common.core.constant.DateConstant;
|
import org.dromara.common.core.constant.DateConstant;
|
||||||
import org.dromara.common.core.constant.HttpStatus;
|
import org.dromara.common.core.constant.HttpStatus;
|
||||||
import org.dromara.common.core.enums.UserType;
|
import org.dromara.common.core.enums.UserType;
|
||||||
@ -37,9 +38,11 @@ import org.dromara.contractor.domain.SubConstructionUser;
|
|||||||
import org.dromara.contractor.domain.SubConstructionUserFile;
|
import org.dromara.contractor.domain.SubConstructionUserFile;
|
||||||
import org.dromara.contractor.domain.SubContractor;
|
import org.dromara.contractor.domain.SubContractor;
|
||||||
import org.dromara.contractor.domain.dto.constructionuser.*;
|
import org.dromara.contractor.domain.dto.constructionuser.*;
|
||||||
|
import org.dromara.contractor.domain.dto.constructionuserfile.SubConstructionUserFileQueryReq;
|
||||||
import org.dromara.contractor.domain.enums.SubConstructionUserFileStatusEnum;
|
import org.dromara.contractor.domain.enums.SubConstructionUserFileStatusEnum;
|
||||||
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.contractor.domain.vo.constructionuserfile.SubConstructionUserFileVo;
|
||||||
import org.dromara.contractor.domain.vo.contractor.SubContractorVo;
|
import org.dromara.contractor.domain.vo.contractor.SubContractorVo;
|
||||||
import org.dromara.contractor.mapper.SubConstructionUserMapper;
|
import org.dromara.contractor.mapper.SubConstructionUserMapper;
|
||||||
import org.dromara.contractor.service.ISubConstructionUserFileService;
|
import org.dromara.contractor.service.ISubConstructionUserFileService;
|
||||||
@ -47,11 +50,12 @@ import org.dromara.contractor.service.ISubConstructionUserService;
|
|||||||
import org.dromara.contractor.service.ISubContractorService;
|
import org.dromara.contractor.service.ISubContractorService;
|
||||||
import org.dromara.project.domain.*;
|
import org.dromara.project.domain.*;
|
||||||
import org.dromara.project.domain.dto.attendance.TodayUserDto;
|
import org.dromara.project.domain.dto.attendance.TodayUserDto;
|
||||||
import org.dromara.project.domain.dto.attendance.TwoWeekDto;
|
import org.dromara.project.domain.dto.constructionuserexit.BusConstructionUserExitQueryReq;
|
||||||
import org.dromara.project.domain.enums.BusAttendanceClockStatusEnum;
|
import org.dromara.project.domain.enums.BusAttendanceClockStatusEnum;
|
||||||
import org.dromara.project.domain.enums.BusAttendanceCommuterEnum;
|
import org.dromara.project.domain.enums.BusAttendanceCommuterEnum;
|
||||||
import org.dromara.project.domain.enums.BusConstructionUserAttendanceStatusEnum;
|
import org.dromara.project.domain.enums.BusConstructionUserAttendanceStatusEnum;
|
||||||
import org.dromara.project.domain.vo.attendance.AttendanceTodayUserVo;
|
import org.dromara.project.domain.vo.attendance.AttendanceTodayUserVo;
|
||||||
|
import org.dromara.project.domain.vo.constructionuserexit.BusConstructionUserExitVo;
|
||||||
import org.dromara.project.domain.vo.projectteam.BusProjectTeamAppVo;
|
import org.dromara.project.domain.vo.projectteam.BusProjectTeamAppVo;
|
||||||
import org.dromara.project.service.*;
|
import org.dromara.project.service.*;
|
||||||
import org.dromara.system.domain.SysUser;
|
import org.dromara.system.domain.SysUser;
|
||||||
@ -87,6 +91,7 @@ import static org.dromara.project.domain.enums.BusAttendanceClockStatusEnum.ATTE
|
|||||||
* @author lilemy
|
* @author lilemy
|
||||||
* @date 2025-03-07
|
* @date 2025-03-07
|
||||||
*/
|
*/
|
||||||
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
public class SubConstructionUserServiceImpl extends ServiceImpl<SubConstructionUserMapper, SubConstructionUser>
|
public class SubConstructionUserServiceImpl extends ServiceImpl<SubConstructionUserMapper, SubConstructionUser>
|
||||||
implements ISubConstructionUserService {
|
implements ISubConstructionUserService {
|
||||||
@ -156,6 +161,10 @@ public class SubConstructionUserServiceImpl extends ServiceImpl<SubConstructionU
|
|||||||
@Resource
|
@Resource
|
||||||
private AsyncUtil asyncUtil;
|
private AsyncUtil asyncUtil;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
@Lazy
|
||||||
|
private IBusConstructionUserExitService busConstructionUserExitService;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询施工人员
|
* 查询施工人员
|
||||||
@ -170,7 +179,16 @@ public class SubConstructionUserServiceImpl extends ServiceImpl<SubConstructionU
|
|||||||
if (constructionUser == null) {
|
if (constructionUser == null) {
|
||||||
throw new ServiceException("施工人员信息不存在", HttpStatus.NOT_FOUND);
|
throw new ServiceException("施工人员信息不存在", HttpStatus.NOT_FOUND);
|
||||||
}
|
}
|
||||||
return this.getVo(constructionUser, isHidden);
|
SubConstructionUserVo vo = this.getVo(constructionUser, isHidden);
|
||||||
|
SubConstructionUserFileQueryReq req = new SubConstructionUserFileQueryReq();
|
||||||
|
req.setUserId(constructionUser.getSysUserId());
|
||||||
|
List<SubConstructionUserFileVo> subConstructionUserFileVos = constructionUserFileService.queryList(req);
|
||||||
|
vo.setSubConstructionUserFileVos(subConstructionUserFileVos);
|
||||||
|
BusConstructionUserExitQueryReq busConstructionUserExitQueryReq = new BusConstructionUserExitQueryReq();
|
||||||
|
busConstructionUserExitQueryReq.setUserId(constructionUser.getSysUserId());
|
||||||
|
List<BusConstructionUserExitVo> busConstructionUserExitVos = busConstructionUserExitService.queryList(busConstructionUserExitQueryReq);
|
||||||
|
vo.setBusConstructionUserExitVos(busConstructionUserExitVos);
|
||||||
|
return vo;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -229,7 +247,7 @@ public class SubConstructionUserServiceImpl extends ServiceImpl<SubConstructionU
|
|||||||
try {
|
try {
|
||||||
decrypt = idCardEncryptorUtil.decrypt(decrypt);
|
decrypt = idCardEncryptorUtil.decrypt(decrypt);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.warn("身份证解密失败");
|
log.warn("身份证解密失败:{}", vo.getUserName(), e);
|
||||||
}
|
}
|
||||||
subConstructionUserVo.setSfzNumber(decrypt);
|
subConstructionUserVo.setSfzNumber(decrypt);
|
||||||
return subConstructionUserVo;
|
return subConstructionUserVo;
|
||||||
@ -256,6 +274,7 @@ public class SubConstructionUserServiceImpl extends ServiceImpl<SubConstructionU
|
|||||||
constructionUser.setTypeOfWork(dto.getTypeOfWork());
|
constructionUser.setTypeOfWork(dto.getTypeOfWork());
|
||||||
constructionUser.setEntryDate(new Date());
|
constructionUser.setEntryDate(new Date());
|
||||||
constructionUser.setFirstDate(LocalDate.now());
|
constructionUser.setFirstDate(LocalDate.now());
|
||||||
|
constructionUser.setStatus("0");
|
||||||
|
|
||||||
int i = baseMapper.updateById(constructionUser);
|
int i = baseMapper.updateById(constructionUser);
|
||||||
|
|
||||||
@ -617,7 +636,7 @@ public class SubConstructionUserServiceImpl extends ServiceImpl<SubConstructionU
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean updateClockBatch(updateClockBatchDto dto) {
|
public Boolean updateClockBatch(updateClockBatchDto dto) {
|
||||||
this.lambdaUpdate().set(SubConstructionUser::getClock, dto.getClock())
|
this.lambdaUpdate().set(SubConstructionUser::getClock, dto.getClock())
|
||||||
.eq(SubConstructionUser::getProjectId, dto.getProjectId())
|
.eq(SubConstructionUser::getProjectId, dto.getProjectId())
|
||||||
.in(CollectionUtil.isNotEmpty(dto.getSysUserIds()), SubConstructionUser::getSysUserId, dto.getSysUserIds())
|
.in(CollectionUtil.isNotEmpty(dto.getSysUserIds()), SubConstructionUser::getSysUserId, dto.getSysUserIds())
|
||||||
.update();
|
.update();
|
||||||
@ -659,7 +678,14 @@ public class SubConstructionUserServiceImpl extends ServiceImpl<SubConstructionU
|
|||||||
LambdaUpdateWrapper<SubConstructionUser> lambdaUpdate = Wrappers.lambdaUpdate(SubConstructionUser.class)
|
LambdaUpdateWrapper<SubConstructionUser> lambdaUpdate = Wrappers.lambdaUpdate(SubConstructionUser.class)
|
||||||
.eq(SubConstructionUser::getId, id)
|
.eq(SubConstructionUser::getId, id)
|
||||||
.set(SubConstructionUser::getProjectId, req.getProjectId())
|
.set(SubConstructionUser::getProjectId, req.getProjectId())
|
||||||
.set(SubConstructionUser::getContractorId, req.getContractorId());
|
.set(SubConstructionUser::getContractorId, req.getContractorId())
|
||||||
|
.set(SubConstructionUser::getTypeOfWork, req.getTypeOfWork())
|
||||||
|
;
|
||||||
|
|
||||||
|
userProjectRelevancyService.deleteByUserId(constructionUser.getSysUserId());
|
||||||
|
|
||||||
|
roleService.deleteRoleByUserIdAndProjectId(constructionUser.getSysUserId(), req.getProjectId());
|
||||||
|
|
||||||
return this.update(lambdaUpdate);
|
return this.update(lambdaUpdate);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -888,6 +914,22 @@ public class SubConstructionUserServiceImpl extends ServiceImpl<SubConstructionU
|
|||||||
Integer age = Math.max(Period.between(sfzBirth, LocalDate.now()).getYears(), 0);
|
Integer age = Math.max(Period.between(sfzBirth, LocalDate.now()).getYears(), 0);
|
||||||
constructionUserVo.setAge(age);
|
constructionUserVo.setAge(age);
|
||||||
}
|
}
|
||||||
|
//班组信息
|
||||||
|
if (constructionUser.getTeamId() != null) {
|
||||||
|
BusProjectTeam byId = projectTeamService.getById(constructionUser.getTeamId());
|
||||||
|
if (byId != null) {
|
||||||
|
constructionUserVo.setTeamId(byId.getId());
|
||||||
|
constructionUserVo.setTeamName(byId.getTeamName());
|
||||||
|
constructionUserVo.setFbId(byId.getUserId());
|
||||||
|
BusProjectTeamMember one = projectTeamMemberService.getOne(Wrappers.<BusProjectTeamMember>lambdaQuery()
|
||||||
|
.eq(BusProjectTeamMember::getTeamId, constructionUser.getTeamId())
|
||||||
|
.last("limit 1")
|
||||||
|
);
|
||||||
|
if (one != null) {
|
||||||
|
constructionUserVo.setPostId(one.getPostId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return constructionUserVo;
|
return constructionUserVo;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1017,7 +1059,7 @@ public class SubConstructionUserServiceImpl extends ServiceImpl<SubConstructionU
|
|||||||
));
|
));
|
||||||
int fileTypeSize = dictTypeService.selectDictDataByType(SubConstructionUserConstant.USER_FILE_TYPE).size();
|
int fileTypeSize = dictTypeService.selectDictDataByType(SubConstructionUserConstant.USER_FILE_TYPE).size();
|
||||||
// 获取用户上传文件数量信息
|
// 获取用户上传文件数量信息
|
||||||
List<Long> userIdList = constructionUserList.stream().map(SubConstructionUser::getId).toList();
|
List<Long> userIdList = constructionUserList.stream().map(SubConstructionUser::getSysUserId).toList();
|
||||||
List<SubConstructionUserFile> fileList = constructionUserFileService.lambdaQuery()
|
List<SubConstructionUserFile> fileList = constructionUserFileService.lambdaQuery()
|
||||||
.select(SubConstructionUserFile::getId, SubConstructionUserFile::getUserId)
|
.select(SubConstructionUserFile::getId, SubConstructionUserFile::getUserId)
|
||||||
.in(SubConstructionUserFile::getUserId, userIdList)
|
.in(SubConstructionUserFile::getUserId, userIdList)
|
||||||
@ -1046,12 +1088,12 @@ public class SubConstructionUserServiceImpl extends ServiceImpl<SubConstructionU
|
|||||||
constructionUserVo.setStandardSalary(workWageMap.get(key));
|
constructionUserVo.setStandardSalary(workWageMap.get(key));
|
||||||
}
|
}
|
||||||
// 关联施工人员文件上传状态
|
// 关联施工人员文件上传状态
|
||||||
long count = fileCountMap.getOrDefault(constructionUser.getId(), 0L);
|
long count = fileCountMap.getOrDefault(constructionUser.getSysUserId(), 0L);
|
||||||
if (count <= 0) {
|
if (count <= 0) {
|
||||||
constructionUserVo.setFileUploadStatus(SubConstructionUserFileStatusEnum.NOUPLOAD.getValue());
|
constructionUserVo.setFileUploadStatus(SubConstructionUserFileStatusEnum.NOUPLOAD.getValue());
|
||||||
} else if (count < fileTypeSize) {
|
} else if (count < fileTypeSize) {
|
||||||
constructionUserVo.setFileUploadStatus(SubConstructionUserFileStatusEnum.PARTUPLOAD.getValue());
|
constructionUserVo.setFileUploadStatus(SubConstructionUserFileStatusEnum.PARTUPLOAD.getValue());
|
||||||
} else if (count == fileTypeSize) {
|
} else if (count >= fileTypeSize) {
|
||||||
constructionUserVo.setFileUploadStatus(SubConstructionUserFileStatusEnum.UPLOAD.getValue());
|
constructionUserVo.setFileUploadStatus(SubConstructionUserFileStatusEnum.UPLOAD.getValue());
|
||||||
}
|
}
|
||||||
// 解密身份证号码
|
// 解密身份证号码
|
||||||
@ -1253,7 +1295,7 @@ public class SubConstructionUserServiceImpl extends ServiceImpl<SubConstructionU
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(attendanceUserIdList.contains(id)){
|
if (attendanceUserIdList.contains(id)) {
|
||||||
constructionUserAttendanceTotalResp.setClockToday(true);
|
constructionUserAttendanceTotalResp.setClockToday(true);
|
||||||
}
|
}
|
||||||
constructionUserAttendanceTotalResp.setAttendanceDays(attendanceDays);
|
constructionUserAttendanceTotalResp.setAttendanceDays(attendanceDays);
|
||||||
@ -1456,7 +1498,7 @@ public class SubConstructionUserServiceImpl extends ServiceImpl<SubConstructionU
|
|||||||
* 人脸识别
|
* 人脸识别
|
||||||
*
|
*
|
||||||
* @param file 图片文件
|
* @param file 图片文件
|
||||||
* @param userId
|
* @param userId 用户id
|
||||||
* @return 是否匹配成功
|
* @return 是否匹配成功
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@ -1464,8 +1506,8 @@ public class SubConstructionUserServiceImpl extends ServiceImpl<SubConstructionU
|
|||||||
String reqBase64 = this.getPicBase64(file);
|
String reqBase64 = this.getPicBase64(file);
|
||||||
HumanFaceReq request = new HumanFaceReq();
|
HumanFaceReq request = new HumanFaceReq();
|
||||||
request.setImage(reqBase64);
|
request.setImage(reqBase64);
|
||||||
if(userId == null){
|
if (userId == null) {
|
||||||
userId = LoginHelper.getUserId();
|
userId = LoginHelper.getUserId();
|
||||||
}
|
}
|
||||||
SubConstructionUser constructionUser = this.getBySysUserId(userId);
|
SubConstructionUser constructionUser = this.getBySysUserId(userId);
|
||||||
if (constructionUser == null || StringUtils.isBlank(constructionUser.getFacePic())) {
|
if (constructionUser == null || StringUtils.isBlank(constructionUser.getFacePic())) {
|
||||||
@ -1610,16 +1652,16 @@ public class SubConstructionUserServiceImpl extends ServiceImpl<SubConstructionU
|
|||||||
.eq(StrUtil.isNotBlank(dto.getTypeOfWork()), SubConstructionUser::getTypeOfWork, dto.getTypeOfWork())
|
.eq(StrUtil.isNotBlank(dto.getTypeOfWork()), SubConstructionUser::getTypeOfWork, dto.getTypeOfWork())
|
||||||
.like(StrUtil.isNotBlank(dto.getUserName()), SubConstructionUser::getUserName, dto.getUserName())
|
.like(StrUtil.isNotBlank(dto.getUserName()), SubConstructionUser::getUserName, dto.getUserName())
|
||||||
.isNotNull(SubConstructionUser::getTeamId);
|
.isNotNull(SubConstructionUser::getTeamId);
|
||||||
if("1".equals(dto.getType())){
|
if ("1".equals(dto.getType())) {
|
||||||
wrapper.in(SubConstructionUser::getSysUserId, dto.getUserIds());
|
wrapper.in(SubConstructionUser::getSysUserId, dto.getUserIds());
|
||||||
}else if("2".equals(dto.getType())){
|
} else if ("2".equals(dto.getType())) {
|
||||||
if(dto.getIsToday()){
|
if (dto.getIsToday()) {
|
||||||
wrapper.notIn(CollectionUtil.isNotEmpty(dto.getUserIds()),SubConstructionUser::getSysUserId, dto.getUserIds());
|
wrapper.notIn(CollectionUtil.isNotEmpty(dto.getUserIds()), SubConstructionUser::getSysUserId, dto.getUserIds());
|
||||||
}else {
|
} else {
|
||||||
wrapper.in(SubConstructionUser::getSysUserId, dto.getUserIds());
|
wrapper.in(SubConstructionUser::getSysUserId, dto.getUserIds());
|
||||||
}
|
}
|
||||||
|
|
||||||
}else{
|
} else {
|
||||||
wrapper.in(SubConstructionUser::getSysUserId, dto.getUserIds());
|
wrapper.in(SubConstructionUser::getSysUserId, dto.getUserIds());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1654,16 +1696,16 @@ public class SubConstructionUserServiceImpl extends ServiceImpl<SubConstructionU
|
|||||||
.eq(StrUtil.isNotBlank(dto.getTypeOfWork()), SubConstructionUser::getTypeOfWork, dto.getTypeOfWork())
|
.eq(StrUtil.isNotBlank(dto.getTypeOfWork()), SubConstructionUser::getTypeOfWork, dto.getTypeOfWork())
|
||||||
.like(StrUtil.isNotBlank(dto.getUserName()), SubConstructionUser::getUserName, dto.getUserName())
|
.like(StrUtil.isNotBlank(dto.getUserName()), SubConstructionUser::getUserName, dto.getUserName())
|
||||||
.isNotNull(SubConstructionUser::getTeamId);
|
.isNotNull(SubConstructionUser::getTeamId);
|
||||||
if("1".equals(dto.getType())){
|
if ("1".equals(dto.getType())) {
|
||||||
wrapper.in(SubConstructionUser::getSysUserId, dto.getUserIds());
|
wrapper.in(SubConstructionUser::getSysUserId, dto.getUserIds());
|
||||||
}else if("2".equals(dto.getType())){
|
} else if ("2".equals(dto.getType())) {
|
||||||
if(dto.getIsToday()){
|
if (dto.getIsToday()) {
|
||||||
wrapper.notIn(CollectionUtil.isNotEmpty(dto.getUserIds()),SubConstructionUser::getSysUserId, dto.getUserIds());
|
wrapper.notIn(CollectionUtil.isNotEmpty(dto.getUserIds()), SubConstructionUser::getSysUserId, dto.getUserIds());
|
||||||
}else {
|
} else {
|
||||||
wrapper.in(SubConstructionUser::getSysUserId, dto.getUserIds());
|
wrapper.in(SubConstructionUser::getSysUserId, dto.getUserIds());
|
||||||
}
|
}
|
||||||
|
|
||||||
}else{
|
} else {
|
||||||
wrapper.in(SubConstructionUser::getSysUserId, dto.getUserIds());
|
wrapper.in(SubConstructionUser::getSysUserId, dto.getUserIds());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -26,6 +26,7 @@ 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.CopyUserVo;
|
import org.dromara.design.domain.vo.CopyUserVo;
|
||||||
|
import org.dromara.design.domain.vo.DelayContVo;
|
||||||
import org.dromara.design.domain.vo.DesUserVo;
|
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.domain.vo.volumefile.DesVolumeFileVo;
|
import org.dromara.design.domain.vo.volumefile.DesVolumeFileVo;
|
||||||
@ -45,10 +46,7 @@ import java.io.IOException;
|
|||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -131,6 +129,16 @@ public class DesVolumeCatalogController extends BaseController {
|
|||||||
return toAjax(desVolumeCatalogService.viewerFile(id));
|
return toAjax(desVolumeCatalogService.viewerFile(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计划过期统计
|
||||||
|
*/
|
||||||
|
@GetMapping("/delayCont/{projectId}")
|
||||||
|
public R<DelayContVo> delayCont(@PathVariable Long projectId) {
|
||||||
|
return R.ok(desVolumeCatalogService.delayCont(projectId));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增卷册目录
|
* 新增卷册目录
|
||||||
*/
|
*/
|
||||||
@ -167,6 +175,9 @@ public class DesVolumeCatalogController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 收资清单模板导出
|
* 收资清单模板导出
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -46,4 +46,9 @@ public class DesVolumeCatalogQueryReq implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private String designSubitem;
|
private String designSubitem;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 0-不延期,1-延期
|
||||||
|
*/
|
||||||
|
private String delay;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,23 @@
|
|||||||
|
package org.dromara.design.domain.vo;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class DelayContVo {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 总数
|
||||||
|
*/
|
||||||
|
private Integer total;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 延迟数
|
||||||
|
*/
|
||||||
|
private Integer delay;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 今日数
|
||||||
|
*/
|
||||||
|
private Integer today;
|
||||||
|
}
|
||||||
@ -11,7 +11,9 @@ import org.dromara.design.domain.DesVolumeFile;
|
|||||||
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.DelayContVo;
|
||||||
import org.dromara.design.domain.vo.volumecatalog.DesVolumeCatalogVo;
|
import org.dromara.design.domain.vo.volumecatalog.DesVolumeCatalogVo;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -130,4 +132,9 @@ public interface IDesVolumeCatalogService extends IService<DesVolumeCatalog> {
|
|||||||
* @return 设计子项列表
|
* @return 设计子项列表
|
||||||
*/
|
*/
|
||||||
List<String> listDesignSubitem(Long projectId);
|
List<String> listDesignSubitem(Long projectId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 统计
|
||||||
|
*/
|
||||||
|
DelayContVo delayCont(Long projectId);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -100,4 +100,7 @@ public interface IDesVolumeFileService extends IService<DesVolumeFile> {
|
|||||||
TableDataInfo<DesVolumeFileAppVo> queryAppPageList(DesVolumeFileAppPageDto dto, PageQuery pageQuery);
|
TableDataInfo<DesVolumeFileAppVo> queryAppPageList(DesVolumeFileAppPageDto dto, PageQuery pageQuery);
|
||||||
|
|
||||||
AuditFileVo auditFile(AuditFileDto dto);
|
AuditFileVo auditFile(AuditFileDto dto);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,6 +28,7 @@ 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.DelayContVo;
|
||||||
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.*;
|
||||||
@ -43,6 +44,8 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@ -236,6 +239,17 @@ public class DesVolumeCatalogServiceImpl extends ServiceImpl<DesVolumeCatalogMap
|
|||||||
return list.stream().map(DesVolumeCatalog::getDesignSubitem).toList();
|
return list.stream().map(DesVolumeCatalog::getDesignSubitem).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DelayContVo delayCont(Long projectId) {
|
||||||
|
List<DesVolumeCatalog> list = this.lambdaQuery()
|
||||||
|
.eq(DesVolumeCatalog::getProjectId, projectId).list();
|
||||||
|
DelayContVo delayContVo = new DelayContVo();
|
||||||
|
delayContVo.setTotal(list.size());
|
||||||
|
delayContVo.setDelay((int)list.stream().filter(item -> item.getPlannedCompletion().isBefore(LocalDate.now()) && item.getDesignState().equals("2")).count());
|
||||||
|
delayContVo.setToday((int)list.stream().filter(item -> item.getPlannedCompletion().isEqual(LocalDate.now())).count());
|
||||||
|
return delayContVo;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改卷册目录
|
* 修改卷册目录
|
||||||
*
|
*
|
||||||
@ -353,6 +367,7 @@ public class DesVolumeCatalogServiceImpl extends ServiceImpl<DesVolumeCatalogMap
|
|||||||
String auditStatus = req.getAuditStatus();
|
String auditStatus = req.getAuditStatus();
|
||||||
String isUpload = req.getIsUpload();
|
String isUpload = req.getIsUpload();
|
||||||
String designSubitem = req.getDesignSubitem();
|
String designSubitem = req.getDesignSubitem();
|
||||||
|
String delay = req.getDelay();
|
||||||
// lqw.orderByDesc(DesVolumeCatalog::getCreateTime);
|
// lqw.orderByDesc(DesVolumeCatalog::getCreateTime);
|
||||||
lqw.orderByAsc(DesVolumeCatalog::getSerialNumber);
|
lqw.orderByAsc(DesVolumeCatalog::getSerialNumber);
|
||||||
lqw.like(StringUtils.isNotBlank(documentName), DesVolumeCatalog::getDocumentName, documentName);
|
lqw.like(StringUtils.isNotBlank(documentName), DesVolumeCatalog::getDocumentName, documentName);
|
||||||
@ -363,6 +378,16 @@ public class DesVolumeCatalogServiceImpl extends ServiceImpl<DesVolumeCatalogMap
|
|||||||
lqw.exists("1".equals(isUpload), "SELECT 1 FROM des_volume_file WHERE volume_catalog_id = des_volume_catalog.design");
|
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");
|
lqw.notExists("0".equals(isUpload), "SELECT 1 FROM des_volume_file WHERE volume_catalog_id = des_volume_catalog.design");
|
||||||
|
|
||||||
|
if("1".equals(delay)){
|
||||||
|
lqw.lt(DesVolumeCatalog::getPlannedCompletion, LocalDateTime.now());
|
||||||
|
lqw.eq(DesVolumeCatalog::getDesignState, "2");
|
||||||
|
}
|
||||||
|
if("0".equals(delay)){
|
||||||
|
lqw.and(wrapper -> wrapper.gt(DesVolumeCatalog::getPlannedCompletion, LocalDateTime.now())
|
||||||
|
.or()
|
||||||
|
.eq(DesVolumeCatalog::getDesignState, "1")
|
||||||
|
);
|
||||||
|
}
|
||||||
return lqw;
|
return lqw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,123 @@
|
|||||||
|
package org.dromara.device.controller;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
import jakarta.validation.constraints.*;
|
||||||
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
|
import org.dromara.project.domain.BusProject;
|
||||||
|
import org.dromara.project.service.IBusProjectService;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||||
|
import org.dromara.common.log.annotation.Log;
|
||||||
|
import org.dromara.common.web.core.BaseController;
|
||||||
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
|
import org.dromara.common.core.domain.R;
|
||||||
|
import org.dromara.common.core.validate.AddGroup;
|
||||||
|
import org.dromara.common.core.validate.EditGroup;
|
||||||
|
import org.dromara.common.log.enums.BusinessType;
|
||||||
|
import org.dromara.common.excel.utils.ExcelUtil;
|
||||||
|
import org.dromara.device.domain.vo.DeviceAccessRecordVo;
|
||||||
|
import org.dromara.device.domain.bo.DeviceAccessRecordBo;
|
||||||
|
import org.dromara.device.service.IDeviceAccessRecordService;
|
||||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备进出场记录
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-12-01
|
||||||
|
*/
|
||||||
|
@Validated
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/device/accessRecord")
|
||||||
|
public class DeviceAccessRecordController extends BaseController {
|
||||||
|
|
||||||
|
private final IDeviceAccessRecordService deviceAccessRecordService;
|
||||||
|
|
||||||
|
private final IBusProjectService projectService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询设备进出场记录列表
|
||||||
|
*/
|
||||||
|
// @SaCheckPermission("device:accessRecord:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo<DeviceAccessRecordVo> list(DeviceAccessRecordBo bo, PageQuery pageQuery) {
|
||||||
|
return deviceAccessRecordService.queryPageList(bo, pageQuery);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出设备进出场记录列表
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("device:accessRecord:export")
|
||||||
|
@Log(title = "设备进出场记录", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(DeviceAccessRecordBo bo, HttpServletResponse response) {
|
||||||
|
List<DeviceAccessRecordVo> list = deviceAccessRecordService.queryList(bo);
|
||||||
|
ExcelUtil.exportExcel(list, "设备进出场记录", DeviceAccessRecordVo.class, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取设备进出场记录详细信息
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
*/
|
||||||
|
// @SaCheckPermission("device:accessRecord:query")
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public R<DeviceAccessRecordVo> getInfo(@NotNull(message = "主键不能为空")
|
||||||
|
@PathVariable Long id) {
|
||||||
|
return R.ok(deviceAccessRecordService.queryById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 子项目列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/childProjectList/{projectId}")
|
||||||
|
public R<List<BusProject>> childProjectId(@PathVariable Long projectId) {
|
||||||
|
List<BusProject> list = projectService.lambdaQuery()
|
||||||
|
.select(BusProject::getId, BusProject::getProjectName)
|
||||||
|
.eq(BusProject::getPId, projectId).list();
|
||||||
|
return R.ok(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增设备进出场记录
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("device:accessRecord:add")
|
||||||
|
@Log(title = "设备进出场记录", businessType = BusinessType.INSERT)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PostMapping()
|
||||||
|
public R<Void> add(@Validated(AddGroup.class) @RequestBody DeviceAccessRecordBo bo) {
|
||||||
|
return toAjax(deviceAccessRecordService.insertByBo(bo));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改设备进出场记录
|
||||||
|
*/
|
||||||
|
// @SaCheckPermission("device:accessRecord:edit")
|
||||||
|
@Log(title = "设备进出场记录", businessType = BusinessType.UPDATE)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PutMapping()
|
||||||
|
public R<Void> edit(@Validated(EditGroup.class) @RequestBody DeviceAccessRecordBo bo) {
|
||||||
|
return toAjax(deviceAccessRecordService.updateByBo(bo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除设备进出场记录
|
||||||
|
*
|
||||||
|
* @param ids 主键串
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("device:accessRecord:remove")
|
||||||
|
@Log(title = "设备进出场记录", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||||
|
@PathVariable Long[] ids) {
|
||||||
|
return toAjax(deviceAccessRecordService.deleteWithValidByIds(List.of(ids), true));
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,150 @@
|
|||||||
|
package org.dromara.device.controller;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
import jakarta.validation.constraints.*;
|
||||||
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
|
import org.dromara.device.domain.bo.DeviceAccessRecordBo;
|
||||||
|
import org.dromara.device.domain.vo.DeviceAccessRecordVo;
|
||||||
|
import org.dromara.device.domain.vo.DeviceInfoCountVo;
|
||||||
|
import org.dromara.device.service.IDeviceAccessRecordService;
|
||||||
|
import org.redisson.api.RList;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||||
|
import org.dromara.common.log.annotation.Log;
|
||||||
|
import org.dromara.common.web.core.BaseController;
|
||||||
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
|
import org.dromara.common.core.domain.R;
|
||||||
|
import org.dromara.common.core.validate.AddGroup;
|
||||||
|
import org.dromara.common.core.validate.EditGroup;
|
||||||
|
import org.dromara.common.log.enums.BusinessType;
|
||||||
|
import org.dromara.common.excel.utils.ExcelUtil;
|
||||||
|
import org.dromara.device.domain.vo.DeviceInfoVo;
|
||||||
|
import org.dromara.device.domain.bo.DeviceInfoBo;
|
||||||
|
import org.dromara.device.service.IDeviceInfoService;
|
||||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备信息
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-12-01
|
||||||
|
*/
|
||||||
|
@Validated
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/device/info")
|
||||||
|
public class DeviceInfoController extends BaseController {
|
||||||
|
|
||||||
|
private final IDeviceInfoService deviceInfoService;
|
||||||
|
|
||||||
|
private final IDeviceAccessRecordService deviceAccessRecordService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询设备信息列表
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("device:info:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo<DeviceInfoVo> list(DeviceInfoBo bo, PageQuery pageQuery) {
|
||||||
|
return deviceInfoService.queryPageList(bo, pageQuery);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出设备信息列表
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("device:info:export")
|
||||||
|
@Log(title = "设备信息", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(DeviceInfoBo bo, HttpServletResponse response) {
|
||||||
|
List<DeviceInfoVo> list = deviceInfoService.queryList(bo);
|
||||||
|
ExcelUtil.exportExcel(list, "设备信息", DeviceInfoVo.class, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取设备信息详细信息
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
*/
|
||||||
|
// @SaCheckPermission("device:info:query")
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public R<DeviceInfoVo> getInfo(@NotNull(message = "主键不能为空")
|
||||||
|
@PathVariable Long id) {
|
||||||
|
return R.ok(deviceInfoService.queryById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 进出场纪录
|
||||||
|
*/
|
||||||
|
@GetMapping("/recordList")
|
||||||
|
public R<List<DeviceAccessRecordVo>> recordList(DeviceAccessRecordBo bo) {
|
||||||
|
List<DeviceAccessRecordVo> list = deviceAccessRecordService.queryList(bo);
|
||||||
|
return R.ok(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备信息统计
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("device:info:list")
|
||||||
|
@GetMapping("/count/{projectId}")
|
||||||
|
public R<Map<String, Integer>> count(@PathVariable Long projectId) {
|
||||||
|
return R.ok(deviceInfoService.count(projectId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型统计
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("device:info:list")
|
||||||
|
@GetMapping("/typeCount/{projectId}")
|
||||||
|
public R<Map<String, Integer>> typeCount(@PathVariable Long projectId) {
|
||||||
|
return R.ok(deviceInfoService.typeCount(projectId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增设备信息
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("device:info:add")
|
||||||
|
@Log(title = "设备信息", businessType = BusinessType.INSERT)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PostMapping()
|
||||||
|
public R<Void> add(@Validated(AddGroup.class) @RequestBody DeviceInfoBo bo) {
|
||||||
|
return toAjax(deviceInfoService.insertByBo(bo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改设备信息
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("device:info:edit")
|
||||||
|
@Log(title = "设备信息", businessType = BusinessType.UPDATE)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PutMapping()
|
||||||
|
public R<Void> edit(@Validated(EditGroup.class) @RequestBody DeviceInfoBo bo) {
|
||||||
|
return toAjax(deviceInfoService.updateByBo(bo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除设备信息
|
||||||
|
*
|
||||||
|
* @param ids 主键串
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("device:info:remove")
|
||||||
|
@Log(title = "设备信息", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||||
|
@PathVariable Long[] ids) {
|
||||||
|
return toAjax(deviceInfoService.deleteWithValidByIds(List.of(ids), true));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备信息列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/deviceList")
|
||||||
|
public R<List<DeviceInfoVo>> deviceList(DeviceInfoBo bo) {
|
||||||
|
List<DeviceInfoVo> list = deviceInfoService.queryList(bo);
|
||||||
|
return R.ok(list);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,188 @@
|
|||||||
|
package org.dromara.device.controller;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
import jakarta.validation.constraints.*;
|
||||||
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||||
|
import org.dromara.common.log.annotation.Log;
|
||||||
|
import org.dromara.common.web.core.BaseController;
|
||||||
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
|
import org.dromara.common.core.domain.R;
|
||||||
|
import org.dromara.common.core.validate.AddGroup;
|
||||||
|
import org.dromara.common.core.validate.EditGroup;
|
||||||
|
import org.dromara.common.log.enums.BusinessType;
|
||||||
|
import org.dromara.common.excel.utils.ExcelUtil;
|
||||||
|
import org.dromara.device.domain.vo.DeviceTypeVo;
|
||||||
|
import org.dromara.device.domain.bo.DeviceTypeBo;
|
||||||
|
import org.dromara.device.service.IDeviceTypeService;
|
||||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-12-01
|
||||||
|
*/
|
||||||
|
@Validated
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/device/type")
|
||||||
|
public class DeviceTypeController extends BaseController {
|
||||||
|
|
||||||
|
private final IDeviceTypeService deviceTypeService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询设备类型列表
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("device:type:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo<DeviceTypeVo> list(DeviceTypeBo bo, PageQuery pageQuery) {
|
||||||
|
return deviceTypeService.queryPageList(bo, pageQuery);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备树状列表
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("device:type:list")
|
||||||
|
@GetMapping("/treeList")
|
||||||
|
public R<List<DeviceTypeVo>> treeList(DeviceTypeBo bo) {
|
||||||
|
List<DeviceTypeVo> list = deviceTypeService.queryList(bo);
|
||||||
|
List<DeviceTypeVo> deviceTypeVos = buildTreeWithAutoRoot(list);
|
||||||
|
return R.ok(deviceTypeVos);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static List<DeviceTypeVo> buildTreeWithAutoRoot(List<DeviceTypeVo> list) {
|
||||||
|
// 1. 用 Map 缓存所有节点(key=节点ID,value=节点对象)
|
||||||
|
// 防御性判断:空列表直接返回,避免空指针
|
||||||
|
if (list == null || list.isEmpty()) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 1. 提取所有有效节点ID(用于判断父ID是否存在)
|
||||||
|
Set<Long> validNodeIds = list.stream()
|
||||||
|
.map(DeviceTypeVo::getId)
|
||||||
|
.collect(Collectors.toSet());
|
||||||
|
|
||||||
|
// 2. 用Map缓存所有节点(key=节点ID,value=节点对象),O(1)查找
|
||||||
|
Map<Long, DeviceTypeVo> nodeMap = list.stream()
|
||||||
|
.collect(Collectors.toMap(DeviceTypeVo::getId, node -> node));
|
||||||
|
|
||||||
|
List<DeviceTypeVo> rootNodes = new ArrayList<>();
|
||||||
|
List<DeviceTypeVo> orphanNodes = new ArrayList<>();
|
||||||
|
|
||||||
|
for (DeviceTypeVo node : list) {
|
||||||
|
Long parentId = node.getParentId();
|
||||||
|
boolean isRoot = false;
|
||||||
|
|
||||||
|
// 判定是否为顶级节点(满足以下任一条件)
|
||||||
|
if (parentId == null || parentId == 0) {
|
||||||
|
// 条件1:parentId为0或NULL(设计约定的顶级节点)
|
||||||
|
isRoot = true;
|
||||||
|
} else if (!validNodeIds.contains(parentId)) {
|
||||||
|
// 条件2:parentId不在有效节点ID中(孤儿节点,视为顶级)
|
||||||
|
isRoot = true;
|
||||||
|
orphanNodes.add(node);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isRoot) {
|
||||||
|
// 顶级节点直接加入根列表,无需挂载
|
||||||
|
rootNodes.add(node);
|
||||||
|
} else {
|
||||||
|
// 非顶级节点:挂载到父节点的children中
|
||||||
|
DeviceTypeVo parentNode = nodeMap.get(parentId);
|
||||||
|
if (parentNode != null) {
|
||||||
|
if (parentNode.getChildren() == null) {
|
||||||
|
parentNode.setChildren(new ArrayList<>());
|
||||||
|
}
|
||||||
|
// 关键:避免重复挂载(判断子节点中是否已存在当前节点)
|
||||||
|
boolean isAlreadyMounted = parentNode.getChildren().stream()
|
||||||
|
.anyMatch(child -> child.getId().equals(node.getId()));
|
||||||
|
if (!isAlreadyMounted) {
|
||||||
|
parentNode.getChildren().add(node);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 打印孤儿节点日志(便于排查数据问题)
|
||||||
|
if (!orphanNodes.isEmpty()) {
|
||||||
|
String orphanIds = orphanNodes.stream()
|
||||||
|
.map(DeviceTypeVo::getId)
|
||||||
|
.map(String::valueOf)
|
||||||
|
.collect(Collectors.joining(","));
|
||||||
|
System.out.println("警告:存在孤儿节点(父节点不存在),节点ID:" + orphanIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
return rootNodes;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出设备类型列表
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("device:type:export")
|
||||||
|
@Log(title = "设备类型", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(DeviceTypeBo bo, HttpServletResponse response) {
|
||||||
|
List<DeviceTypeVo> list = deviceTypeService.queryList(bo);
|
||||||
|
ExcelUtil.exportExcel(list, "设备类型", DeviceTypeVo.class, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取设备类型详细信息
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
*/
|
||||||
|
// @SaCheckPermission("device:type:query")
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public R<DeviceTypeVo> getInfo(@NotNull(message = "主键不能为空")
|
||||||
|
@PathVariable Long id) {
|
||||||
|
return R.ok(deviceTypeService.queryById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增设备类型
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("device:type:add")
|
||||||
|
@Log(title = "设备类型", businessType = BusinessType.INSERT)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PostMapping()
|
||||||
|
public R<Void> add(@Validated(AddGroup.class) @RequestBody DeviceTypeBo bo) {
|
||||||
|
return toAjax(deviceTypeService.insertByBo(bo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改设备类型
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("device:type:edit")
|
||||||
|
@Log(title = "设备类型", businessType = BusinessType.UPDATE)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PutMapping()
|
||||||
|
public R<Void> edit(@Validated(EditGroup.class) @RequestBody DeviceTypeBo bo) {
|
||||||
|
return toAjax(deviceTypeService.updateByBo(bo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除设备类型
|
||||||
|
*
|
||||||
|
* @param ids 主键串
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("device:type:remove")
|
||||||
|
@Log(title = "设备类型", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||||
|
@PathVariable Long[] ids) {
|
||||||
|
return toAjax(deviceTypeService.deleteWithValidByIds(List.of(ids), true));
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,85 @@
|
|||||||
|
package org.dromara.device.domain;
|
||||||
|
|
||||||
|
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备进出场记录对象 device_access_record
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-12-01
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("device_access_record")
|
||||||
|
public class DeviceAccessRecord extends BaseEntity {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@TableId(value = "id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 记录编号(唯一标识,如:RC-2024-0012)
|
||||||
|
*/
|
||||||
|
private String recordNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备ID(关联设备表device的id)
|
||||||
|
*/
|
||||||
|
private Long deviceId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备名
|
||||||
|
*/
|
||||||
|
private String deviceName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态(1-进场,2-出场,可扩展其他状态)
|
||||||
|
*/
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作时间(记录发生的时间,如:2024-03-15 09:30:25)
|
||||||
|
*/
|
||||||
|
private LocalDateTime operateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 子项目名字
|
||||||
|
*/
|
||||||
|
private String location;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作人ID(关联用户表user的id)
|
||||||
|
*/
|
||||||
|
private Long operatorId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作人姓名(冗余存储,如:张三)
|
||||||
|
*/
|
||||||
|
private String operatorName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 原因(如:安装使用、设备调拨、入库存储)
|
||||||
|
*/
|
||||||
|
private String reason;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 详细说明(查看详情时展示的补充信息,可选)
|
||||||
|
*/
|
||||||
|
private String details;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 子项目ID
|
||||||
|
*/
|
||||||
|
private Long childProjectId;
|
||||||
|
}
|
||||||
@ -0,0 +1,104 @@
|
|||||||
|
package org.dromara.device.domain;
|
||||||
|
|
||||||
|
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import org.dromara.common.translation.annotation.Translation;
|
||||||
|
import org.dromara.common.translation.constant.TransConstant;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备信息对象 device_info
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-12-01
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("device_info")
|
||||||
|
public class DeviceInfo extends BaseEntity {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@TableId(value = "id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目Id
|
||||||
|
*/
|
||||||
|
private Long projectId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备编号
|
||||||
|
*/
|
||||||
|
private String deviceCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备名称
|
||||||
|
*/
|
||||||
|
private String deviceName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 型号规格
|
||||||
|
*/
|
||||||
|
private String modelSpec;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型ID(关联设备类型表device_type的id)
|
||||||
|
*/
|
||||||
|
private Long typeId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生产厂家
|
||||||
|
*/
|
||||||
|
private String manufacturer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 出厂日期(yyyy-mm-dd)
|
||||||
|
*/
|
||||||
|
private LocalDate productionDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保修日期(yyyy-mm-dd)
|
||||||
|
*/
|
||||||
|
private LocalDate warrantyDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备状态(0-闲置,1-使用中,2-维修中,3-报废)
|
||||||
|
*/
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 负责人姓名
|
||||||
|
*/
|
||||||
|
private String responsiblePerson;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 联系电话(支持固定电话和手机号)
|
||||||
|
*/
|
||||||
|
private String contactPhone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备描述(详细说明)
|
||||||
|
*/
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 图片
|
||||||
|
*/
|
||||||
|
private String image;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 附件
|
||||||
|
*/
|
||||||
|
private String file;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,61 @@
|
|||||||
|
package org.dromara.device.domain;
|
||||||
|
|
||||||
|
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型对象 device_type
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-12-01
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("device_type")
|
||||||
|
public class DeviceType extends BaseEntity {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@TableId(value = "id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型编码
|
||||||
|
*/
|
||||||
|
private String typeCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型名称
|
||||||
|
*/
|
||||||
|
private String typeName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 父类型ID
|
||||||
|
*/
|
||||||
|
private Long parentId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 层级(1=顶级,2=二级,3=三级...,最大支持255级)
|
||||||
|
*/
|
||||||
|
private Integer level;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 祖级列表
|
||||||
|
*/
|
||||||
|
private String ancestors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型描述
|
||||||
|
*/
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,86 @@
|
|||||||
|
package org.dromara.device.domain.bo;
|
||||||
|
|
||||||
|
import org.dromara.device.domain.DeviceAccessRecord;
|
||||||
|
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||||
|
import org.dromara.common.core.validate.AddGroup;
|
||||||
|
import org.dromara.common.core.validate.EditGroup;
|
||||||
|
import io.github.linpeilie.annotations.AutoMapper;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import jakarta.validation.constraints.*;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备进出场记录业务对象 device_access_record
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-12-01
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@AutoMapper(target = DeviceAccessRecord.class, reverseConvertGenerate = false)
|
||||||
|
public class DeviceAccessRecordBo extends BaseEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@NotNull(message = "id不能为空", groups = { EditGroup.class })
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 记录编号(唯一标识,如:RC-2024-0012)
|
||||||
|
*/
|
||||||
|
private String recordNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备ID(关联设备表device的id)
|
||||||
|
*/
|
||||||
|
private Long deviceId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备名
|
||||||
|
*/
|
||||||
|
private String deviceName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态(1-进场,2-出场,可扩展其他状态)
|
||||||
|
*/
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作时间(记录发生的时间,如:2024-03-15 09:30:25)
|
||||||
|
*/
|
||||||
|
private LocalDateTime operateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 位置/目的地(如:A区-1号电站、B区仓库→A区电站)
|
||||||
|
*/
|
||||||
|
private String location;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作人ID(关联用户表user的id)
|
||||||
|
*/
|
||||||
|
private Long operatorId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作人姓名(冗余存储,如:张三)
|
||||||
|
*/
|
||||||
|
private String operatorName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 原因(如:安装使用、设备调拨、入库存储)
|
||||||
|
*/
|
||||||
|
private String reason;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 详细说明(查看详情时展示的补充信息,可选)
|
||||||
|
*/
|
||||||
|
private String details;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 子项目ID
|
||||||
|
*/
|
||||||
|
private Long childProjectId;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,104 @@
|
|||||||
|
package org.dromara.device.domain.bo;
|
||||||
|
|
||||||
|
import org.dromara.device.domain.DeviceInfo;
|
||||||
|
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||||
|
import org.dromara.common.core.validate.AddGroup;
|
||||||
|
import org.dromara.common.core.validate.EditGroup;
|
||||||
|
import io.github.linpeilie.annotations.AutoMapper;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import jakarta.validation.constraints.*;
|
||||||
|
import org.dromara.common.translation.annotation.Translation;
|
||||||
|
import org.dromara.common.translation.constant.TransConstant;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备信息业务对象 device_info
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-12-01
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@AutoMapper(target = DeviceInfo.class, reverseConvertGenerate = false)
|
||||||
|
public class DeviceInfoBo extends BaseEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@NotNull(message = "id不能为空", groups = { EditGroup.class })
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目Id
|
||||||
|
*/
|
||||||
|
private Long projectId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备编号
|
||||||
|
*/
|
||||||
|
private String deviceCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备名称
|
||||||
|
*/
|
||||||
|
private String deviceName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 型号规格
|
||||||
|
*/
|
||||||
|
private String modelSpec;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型ID(关联设备类型表device_type的id)
|
||||||
|
*/
|
||||||
|
private Long typeId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生产厂家
|
||||||
|
*/
|
||||||
|
private String manufacturer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 出厂日期(yyyy-mm-dd)
|
||||||
|
*/
|
||||||
|
private LocalDate productionDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保修日期(yyyy-mm-dd)
|
||||||
|
*/
|
||||||
|
private LocalDate warrantyDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备状态(0-闲置,1-使用中,2-维修中,3-报废)
|
||||||
|
*/
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 负责人姓名
|
||||||
|
*/
|
||||||
|
private String responsiblePerson;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 联系电话(支持固定电话和手机号)
|
||||||
|
*/
|
||||||
|
private String contactPhone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备描述(详细说明)
|
||||||
|
*/
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 图片
|
||||||
|
*/
|
||||||
|
private String image;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 附件
|
||||||
|
*/
|
||||||
|
private String file;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,53 @@
|
|||||||
|
package org.dromara.device.domain.bo;
|
||||||
|
|
||||||
|
import org.dromara.device.domain.DeviceType;
|
||||||
|
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||||
|
import org.dromara.common.core.validate.AddGroup;
|
||||||
|
import org.dromara.common.core.validate.EditGroup;
|
||||||
|
import io.github.linpeilie.annotations.AutoMapper;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import jakarta.validation.constraints.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型业务对象 device_type
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-12-01
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@AutoMapper(target = DeviceType.class, reverseConvertGenerate = false)
|
||||||
|
public class DeviceTypeBo extends BaseEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@NotNull(message = "id不能为空", groups = { EditGroup.class })
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
private String typeCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型名称
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "设备类型名称不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
|
private String typeName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 父类型ID
|
||||||
|
*/
|
||||||
|
private Long parentId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 层级(1=顶级,2=二级,3=三级...,最大支持255级)
|
||||||
|
*/
|
||||||
|
private Integer level;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型描述
|
||||||
|
*/
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,104 @@
|
|||||||
|
package org.dromara.device.domain.vo;
|
||||||
|
|
||||||
|
import org.dromara.device.domain.DeviceAccessRecord;
|
||||||
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
import org.dromara.common.excel.annotation.ExcelDictFormat;
|
||||||
|
import org.dromara.common.excel.convert.ExcelDictConvert;
|
||||||
|
import io.github.linpeilie.annotations.AutoMapper;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备进出场记录视图对象 device_access_record
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-12-01
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
@AutoMapper(target = DeviceAccessRecord.class)
|
||||||
|
public class DeviceAccessRecordVo implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 记录编号(唯一标识,如:RC-2024-0012)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "记录编号", converter = ExcelDictConvert.class)
|
||||||
|
private String recordNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备ID(关联设备表device的id)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "设备ID", converter = ExcelDictConvert.class)
|
||||||
|
private Long deviceId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备名
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "设备名")
|
||||||
|
private String deviceName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态(1-进场,2-出场,可扩展其他状态)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "状态", converter = ExcelDictConvert.class)
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作时间(记录发生的时间,如:2024-03-15 09:30:25)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "操作时间", converter = ExcelDictConvert.class)
|
||||||
|
private LocalDateTime operateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 位置/目的地(如:A区-1号电站、B区仓库→A区电站)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "位置/目的地", converter = ExcelDictConvert.class)
|
||||||
|
private String location;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作人ID(关联用户表user的id)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "操作人ID", converter = ExcelDictConvert.class)
|
||||||
|
private Long operatorId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作人姓名(冗余存储,如:张三)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "操作人姓名", converter = ExcelDictConvert.class)
|
||||||
|
private String operatorName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 原因(如:安装使用、设备调拨、入库存储)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "原因", converter = ExcelDictConvert.class)
|
||||||
|
private String reason;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 详细说明(查看详情时展示的补充信息,可选)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "详细说明", converter = ExcelDictConvert.class)
|
||||||
|
private String details;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,27 @@
|
|||||||
|
package org.dromara.device.domain.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class DeviceInfoCountVo {
|
||||||
|
/**
|
||||||
|
* 总数
|
||||||
|
*/
|
||||||
|
private Integer total;
|
||||||
|
/**
|
||||||
|
* 使用
|
||||||
|
*/
|
||||||
|
private Integer use;
|
||||||
|
/**
|
||||||
|
* 维护
|
||||||
|
*/
|
||||||
|
private Integer maintain;
|
||||||
|
/**
|
||||||
|
* 闲置
|
||||||
|
*/
|
||||||
|
private Integer idle;
|
||||||
|
/**
|
||||||
|
* 报废
|
||||||
|
*/
|
||||||
|
private Integer broken;
|
||||||
|
}
|
||||||
@ -0,0 +1,137 @@
|
|||||||
|
package org.dromara.device.domain.vo;
|
||||||
|
|
||||||
|
import org.dromara.common.translation.annotation.Translation;
|
||||||
|
import org.dromara.common.translation.constant.TransConstant;
|
||||||
|
import org.dromara.device.domain.DeviceInfo;
|
||||||
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
import org.dromara.common.excel.annotation.ExcelDictFormat;
|
||||||
|
import org.dromara.common.excel.convert.ExcelDictConvert;
|
||||||
|
import io.github.linpeilie.annotations.AutoMapper;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备信息视图对象 device_info
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-12-01
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
@AutoMapper(target = DeviceInfo.class)
|
||||||
|
public class DeviceInfoVo implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目Id
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "项目Id")
|
||||||
|
private Long projectId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备编号
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "设备编号")
|
||||||
|
private String deviceCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备名称
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "设备名称")
|
||||||
|
private String deviceName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 型号规格
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "型号规格")
|
||||||
|
private String modelSpec;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型ID(关联设备类型表device_type的id)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "设备类型ID", converter = ExcelDictConvert.class)
|
||||||
|
private Long typeId;
|
||||||
|
|
||||||
|
private String typeName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生产厂家
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "生产厂家")
|
||||||
|
private String manufacturer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 出厂日期(yyyy-mm-dd)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "出厂日期", converter = ExcelDictConvert.class)
|
||||||
|
@ExcelDictFormat(readConverterExp = "y=yyy-mm-dd")
|
||||||
|
private LocalDate productionDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保修日期(yyyy-mm-dd)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "保修日期", converter = ExcelDictConvert.class)
|
||||||
|
@ExcelDictFormat(readConverterExp = "y=yyy-mm-dd")
|
||||||
|
private LocalDate warrantyDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备状态(0-闲置,1-使用中,2-维修中,3-报废)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "设备状态", converter = ExcelDictConvert.class)
|
||||||
|
@ExcelDictFormat(readConverterExp = "0=-闲置,1-使用中,2-维修中,3-报废")
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 负责人姓名
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "负责人姓名")
|
||||||
|
private String responsiblePerson;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 联系电话(支持固定电话和手机号)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "联系电话", converter = ExcelDictConvert.class)
|
||||||
|
@ExcelDictFormat(readConverterExp = "支=持固定电话和手机号")
|
||||||
|
private String contactPhone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备描述(详细说明)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "设备描述", converter = ExcelDictConvert.class)
|
||||||
|
@ExcelDictFormat(readConverterExp = "详=细说明")
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 图片
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "图片")
|
||||||
|
private String image;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 图片Url
|
||||||
|
*/
|
||||||
|
@Translation(type = TransConstant.OSS_ID_TO_URL, mapper = "image")
|
||||||
|
private String imageUrl;
|
||||||
|
/**
|
||||||
|
* 附件
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "附件")
|
||||||
|
private String file;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,78 @@
|
|||||||
|
package org.dromara.device.domain.vo;
|
||||||
|
|
||||||
|
import org.dromara.device.domain.DeviceType;
|
||||||
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
import org.dromara.common.excel.annotation.ExcelDictFormat;
|
||||||
|
import org.dromara.common.excel.convert.ExcelDictConvert;
|
||||||
|
import io.github.linpeilie.annotations.AutoMapper;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型视图对象 device_type
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-12-01
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
@AutoMapper(target = DeviceType.class)
|
||||||
|
public class DeviceTypeVo implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型编码
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "设备类型编码")
|
||||||
|
private String typeCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型名称
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "设备类型名称")
|
||||||
|
private String typeName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 父类型ID
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "父类型ID")
|
||||||
|
private Long parentId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 层级(1=顶级,2=二级,3=三级...,最大支持255级)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "层级", converter = ExcelDictConvert.class)
|
||||||
|
@ExcelDictFormat(readConverterExp = "1==顶级,2=二级,3=三级...,最大支持255级")
|
||||||
|
private Integer level;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 祖级列表
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "祖级列表")
|
||||||
|
private String ancestors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型描述
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "设备类型描述")
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
|
||||||
|
private List<DeviceTypeVo> children;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
package org.dromara.device.mapper;
|
||||||
|
|
||||||
|
import org.dromara.device.domain.DeviceAccessRecord;
|
||||||
|
import org.dromara.device.domain.vo.DeviceAccessRecordVo;
|
||||||
|
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备进出场记录Mapper接口
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-12-01
|
||||||
|
*/
|
||||||
|
public interface DeviceAccessRecordMapper extends BaseMapperPlus<DeviceAccessRecord, DeviceAccessRecordVo> {
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
package org.dromara.device.mapper;
|
||||||
|
|
||||||
|
import org.dromara.device.domain.DeviceInfo;
|
||||||
|
import org.dromara.device.domain.vo.DeviceInfoVo;
|
||||||
|
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备信息Mapper接口
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-12-01
|
||||||
|
*/
|
||||||
|
public interface DeviceInfoMapper extends BaseMapperPlus<DeviceInfo, DeviceInfoVo> {
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
package org.dromara.device.mapper;
|
||||||
|
|
||||||
|
import org.dromara.device.domain.DeviceType;
|
||||||
|
import org.dromara.device.domain.vo.DeviceTypeVo;
|
||||||
|
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型Mapper接口
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-12-01
|
||||||
|
*/
|
||||||
|
public interface DeviceTypeMapper extends BaseMapperPlus<DeviceType, DeviceTypeVo> {
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,70 @@
|
|||||||
|
package org.dromara.device.service;
|
||||||
|
|
||||||
|
import org.dromara.device.domain.vo.DeviceAccessRecordVo;
|
||||||
|
import org.dromara.device.domain.bo.DeviceAccessRecordBo;
|
||||||
|
import org.dromara.device.domain.DeviceAccessRecord;
|
||||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备进出场记录Service接口
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-12-01
|
||||||
|
*/
|
||||||
|
public interface IDeviceAccessRecordService extends IService<DeviceAccessRecord>{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询设备进出场记录
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 设备进出场记录
|
||||||
|
*/
|
||||||
|
DeviceAccessRecordVo queryById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询设备进出场记录列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @param pageQuery 分页参数
|
||||||
|
* @return 设备进出场记录分页列表
|
||||||
|
*/
|
||||||
|
TableDataInfo<DeviceAccessRecordVo> queryPageList(DeviceAccessRecordBo bo, PageQuery pageQuery);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询符合条件的设备进出场记录列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @return 设备进出场记录列表
|
||||||
|
*/
|
||||||
|
List<DeviceAccessRecordVo> queryList(DeviceAccessRecordBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增设备进出场记录
|
||||||
|
*
|
||||||
|
* @param bo 设备进出场记录
|
||||||
|
* @return 是否新增成功
|
||||||
|
*/
|
||||||
|
Boolean insertByBo(DeviceAccessRecordBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改设备进出场记录
|
||||||
|
*
|
||||||
|
* @param bo 设备进出场记录
|
||||||
|
* @return 是否修改成功
|
||||||
|
*/
|
||||||
|
Boolean updateByBo(DeviceAccessRecordBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验并批量删除设备进出场记录信息
|
||||||
|
*
|
||||||
|
* @param ids 待删除的主键集合
|
||||||
|
* @param isValid 是否进行有效性校验
|
||||||
|
* @return 是否删除成功
|
||||||
|
*/
|
||||||
|
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||||
|
}
|
||||||
@ -0,0 +1,83 @@
|
|||||||
|
package org.dromara.device.service;
|
||||||
|
|
||||||
|
import org.dromara.device.domain.vo.DeviceInfoVo;
|
||||||
|
import org.dromara.device.domain.bo.DeviceInfoBo;
|
||||||
|
import org.dromara.device.domain.DeviceInfo;
|
||||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备信息Service接口
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-12-01
|
||||||
|
*/
|
||||||
|
public interface IDeviceInfoService extends IService<DeviceInfo>{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询设备信息
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 设备信息
|
||||||
|
*/
|
||||||
|
DeviceInfoVo queryById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询设备信息列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @param pageQuery 分页参数
|
||||||
|
* @return 设备信息分页列表
|
||||||
|
*/
|
||||||
|
TableDataInfo<DeviceInfoVo> queryPageList(DeviceInfoBo bo, PageQuery pageQuery);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询符合条件的设备信息列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @return 设备信息列表
|
||||||
|
*/
|
||||||
|
List<DeviceInfoVo> queryList(DeviceInfoBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增设备信息
|
||||||
|
*
|
||||||
|
* @param bo 设备信息
|
||||||
|
* @return 是否新增成功
|
||||||
|
*/
|
||||||
|
Boolean insertByBo(DeviceInfoBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改设备信息
|
||||||
|
*
|
||||||
|
* @param bo 设备信息
|
||||||
|
* @return 是否修改成功
|
||||||
|
*/
|
||||||
|
Boolean updateByBo(DeviceInfoBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验并批量删除设备信息信息
|
||||||
|
*
|
||||||
|
* @param ids 待删除的主键集合
|
||||||
|
* @param isValid 是否进行有效性校验
|
||||||
|
* @return 是否删除成功
|
||||||
|
*/
|
||||||
|
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备数量统计
|
||||||
|
*/
|
||||||
|
Map<String, Integer> count(Long projectId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型统计
|
||||||
|
*/
|
||||||
|
Map<String, Integer> typeCount(Long projectId);
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,70 @@
|
|||||||
|
package org.dromara.device.service;
|
||||||
|
|
||||||
|
import org.dromara.device.domain.vo.DeviceTypeVo;
|
||||||
|
import org.dromara.device.domain.bo.DeviceTypeBo;
|
||||||
|
import org.dromara.device.domain.DeviceType;
|
||||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型Service接口
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-12-01
|
||||||
|
*/
|
||||||
|
public interface IDeviceTypeService extends IService<DeviceType>{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询设备类型
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 设备类型
|
||||||
|
*/
|
||||||
|
DeviceTypeVo queryById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询设备类型列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @param pageQuery 分页参数
|
||||||
|
* @return 设备类型分页列表
|
||||||
|
*/
|
||||||
|
TableDataInfo<DeviceTypeVo> queryPageList(DeviceTypeBo bo, PageQuery pageQuery);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询符合条件的设备类型列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @return 设备类型列表
|
||||||
|
*/
|
||||||
|
List<DeviceTypeVo> queryList(DeviceTypeBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增设备类型
|
||||||
|
*
|
||||||
|
* @param bo 设备类型
|
||||||
|
* @return 是否新增成功
|
||||||
|
*/
|
||||||
|
Boolean insertByBo(DeviceTypeBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改设备类型
|
||||||
|
*
|
||||||
|
* @param bo 设备类型
|
||||||
|
* @return 是否修改成功
|
||||||
|
*/
|
||||||
|
Boolean updateByBo(DeviceTypeBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验并批量删除设备类型信息
|
||||||
|
*
|
||||||
|
* @param ids 待删除的主键集合
|
||||||
|
* @param isValid 是否进行有效性校验
|
||||||
|
* @return 是否删除成功
|
||||||
|
*/
|
||||||
|
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||||
|
}
|
||||||
@ -0,0 +1,151 @@
|
|||||||
|
package org.dromara.device.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.dromara.common.core.utils.MapstructUtils;
|
||||||
|
import org.dromara.common.core.utils.StringUtils;
|
||||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.dromara.device.domain.bo.DeviceAccessRecordBo;
|
||||||
|
import org.dromara.device.domain.vo.DeviceAccessRecordVo;
|
||||||
|
import org.dromara.device.domain.DeviceAccessRecord;
|
||||||
|
import org.dromara.device.mapper.DeviceAccessRecordMapper;
|
||||||
|
import org.dromara.device.service.IDeviceAccessRecordService;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备进出场记录Service业务层处理
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-12-01
|
||||||
|
*/
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Service
|
||||||
|
public class DeviceAccessRecordServiceImpl extends ServiceImpl<DeviceAccessRecordMapper, DeviceAccessRecord> implements IDeviceAccessRecordService {
|
||||||
|
|
||||||
|
private final DeviceAccessRecordMapper baseMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询设备进出场记录
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 设备进出场记录
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public DeviceAccessRecordVo queryById(Long id){
|
||||||
|
return baseMapper.selectVoById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询设备进出场记录列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @param pageQuery 分页参数
|
||||||
|
* @return 设备进出场记录分页列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public TableDataInfo<DeviceAccessRecordVo> queryPageList(DeviceAccessRecordBo bo, PageQuery pageQuery) {
|
||||||
|
LambdaQueryWrapper<DeviceAccessRecord> lqw = buildQueryWrapper(bo);
|
||||||
|
Page<DeviceAccessRecordVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||||
|
return TableDataInfo.build(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询符合条件的设备进出场记录列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @return 设备进出场记录列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<DeviceAccessRecordVo> queryList(DeviceAccessRecordBo bo) {
|
||||||
|
LambdaQueryWrapper<DeviceAccessRecord> lqw = buildQueryWrapper(bo);
|
||||||
|
return baseMapper.selectVoList(lqw);
|
||||||
|
}
|
||||||
|
|
||||||
|
private LambdaQueryWrapper<DeviceAccessRecord> buildQueryWrapper(DeviceAccessRecordBo bo) {
|
||||||
|
Map<String, Object> params = bo.getParams();
|
||||||
|
LambdaQueryWrapper<DeviceAccessRecord> lqw = Wrappers.lambdaQuery();
|
||||||
|
lqw.orderByDesc(DeviceAccessRecord::getId);
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getRecordNo()), DeviceAccessRecord::getRecordNo, bo.getRecordNo());
|
||||||
|
lqw.eq(bo.getDeviceId() != null, DeviceAccessRecord::getDeviceId, bo.getDeviceId());
|
||||||
|
lqw.like(StringUtils.isNotBlank(bo.getDeviceName()), DeviceAccessRecord::getDeviceName, bo.getDeviceName());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getStatus()), DeviceAccessRecord::getStatus, bo.getStatus());
|
||||||
|
|
||||||
|
if(bo.getOperateTime() != null){
|
||||||
|
LocalDateTime operateTime = bo.getOperateTime();
|
||||||
|
//一天的开始
|
||||||
|
LocalDateTime startTime = operateTime.withHour(0).withMinute(0).withSecond(0);
|
||||||
|
//一天的结束
|
||||||
|
LocalDateTime endTime = operateTime.withHour(23).withMinute(59).withSecond(59);
|
||||||
|
lqw.between(DeviceAccessRecord::getOperateTime,startTime,endTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
lqw.eq(bo.getOperateTime() != null, DeviceAccessRecord::getOperateTime, bo.getOperateTime());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getLocation()), DeviceAccessRecord::getLocation, bo.getLocation());
|
||||||
|
lqw.eq(bo.getOperatorId() != null, DeviceAccessRecord::getOperatorId, bo.getOperatorId());
|
||||||
|
lqw.like(StringUtils.isNotBlank(bo.getOperatorName()), DeviceAccessRecord::getOperatorName, bo.getOperatorName());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getReason()), DeviceAccessRecord::getReason, bo.getReason());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getDetails()), DeviceAccessRecord::getDetails, bo.getDetails());
|
||||||
|
return lqw;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增设备进出场记录
|
||||||
|
*
|
||||||
|
* @param bo 设备进出场记录
|
||||||
|
* @return 是否新增成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean insertByBo(DeviceAccessRecordBo bo) {
|
||||||
|
DeviceAccessRecord add = MapstructUtils.convert(bo, DeviceAccessRecord.class);
|
||||||
|
validEntityBeforeSave(add);
|
||||||
|
boolean flag = baseMapper.insert(add) > 0;
|
||||||
|
if (flag) {
|
||||||
|
bo.setId(add.getId());
|
||||||
|
}
|
||||||
|
return flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改设备进出场记录
|
||||||
|
*
|
||||||
|
* @param bo 设备进出场记录
|
||||||
|
* @return 是否修改成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean updateByBo(DeviceAccessRecordBo bo) {
|
||||||
|
DeviceAccessRecord update = MapstructUtils.convert(bo, DeviceAccessRecord.class);
|
||||||
|
validEntityBeforeSave(update);
|
||||||
|
return baseMapper.updateById(update) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存前的数据校验
|
||||||
|
*/
|
||||||
|
private void validEntityBeforeSave(DeviceAccessRecord entity){
|
||||||
|
//TODO 做一些数据校验,如唯一约束
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验并批量删除设备进出场记录信息
|
||||||
|
*
|
||||||
|
* @param ids 待删除的主键集合
|
||||||
|
* @param isValid 是否进行有效性校验
|
||||||
|
* @return 是否删除成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||||
|
if(isValid){
|
||||||
|
//TODO 做一些业务上的校验,判断是否需要校验
|
||||||
|
}
|
||||||
|
return baseMapper.deleteByIds(ids) > 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,219 @@
|
|||||||
|
package org.dromara.device.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.dromara.common.core.exception.ServiceException;
|
||||||
|
import org.dromara.common.core.utils.MapstructUtils;
|
||||||
|
import org.dromara.common.core.utils.StringUtils;
|
||||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.dromara.device.domain.DeviceAccessRecord;
|
||||||
|
import org.dromara.device.domain.DeviceType;
|
||||||
|
import org.dromara.device.domain.vo.DeviceInfoCountVo;
|
||||||
|
import org.dromara.device.service.IDeviceAccessRecordService;
|
||||||
|
import org.dromara.device.service.IDeviceTypeService;
|
||||||
|
import org.dromara.system.domain.vo.SysDictDataVo;
|
||||||
|
import org.dromara.system.service.ISysDictDataService;
|
||||||
|
import org.dromara.system.service.ISysDictTypeService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.dromara.device.domain.bo.DeviceInfoBo;
|
||||||
|
import org.dromara.device.domain.vo.DeviceInfoVo;
|
||||||
|
import org.dromara.device.domain.DeviceInfo;
|
||||||
|
import org.dromara.device.mapper.DeviceInfoMapper;
|
||||||
|
import org.dromara.device.service.IDeviceInfoService;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备信息Service业务层处理
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-12-01
|
||||||
|
*/
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Service
|
||||||
|
public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceInfo> implements IDeviceInfoService {
|
||||||
|
|
||||||
|
private final DeviceInfoMapper baseMapper;
|
||||||
|
|
||||||
|
private final IDeviceTypeService deviceTypeService;
|
||||||
|
|
||||||
|
private final IDeviceAccessRecordService deviceAccessRecordService;
|
||||||
|
|
||||||
|
private final ISysDictTypeService dictTypeService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询设备信息
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 设备信息
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public DeviceInfoVo queryById(Long id){
|
||||||
|
DeviceInfoVo deviceInfoVo = baseMapper.selectVoById(id);
|
||||||
|
DeviceType byId = deviceTypeService.getById(deviceInfoVo.getTypeId());
|
||||||
|
deviceInfoVo.setTypeName(byId.getTypeName());
|
||||||
|
return deviceInfoVo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询设备信息列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @param pageQuery 分页参数
|
||||||
|
* @return 设备信息分页列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public TableDataInfo<DeviceInfoVo> queryPageList(DeviceInfoBo bo, PageQuery pageQuery) {
|
||||||
|
LambdaQueryWrapper<DeviceInfo> lqw = buildQueryWrapper(bo);
|
||||||
|
Page<DeviceInfoVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||||
|
List<DeviceInfoVo> records = result.getRecords();
|
||||||
|
Set<Long> collect = records.stream().map(DeviceInfoVo::getTypeId).collect(Collectors.toSet());
|
||||||
|
if(CollectionUtil.isEmpty(collect)){
|
||||||
|
return TableDataInfo.build(result);
|
||||||
|
}
|
||||||
|
List<DeviceType> deviceTypes = deviceTypeService.listByIds(collect);
|
||||||
|
Map<Long, String> deviceTypeMap = deviceTypes.stream().collect(Collectors.toMap(DeviceType::getId, DeviceType::getTypeName));
|
||||||
|
result.getRecords().forEach(deviceInfoVo -> {
|
||||||
|
deviceInfoVo.setTypeName(deviceTypeMap.get(deviceInfoVo.getTypeId()));
|
||||||
|
});
|
||||||
|
return TableDataInfo.build(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询符合条件的设备信息列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @return 设备信息列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<DeviceInfoVo> queryList(DeviceInfoBo bo) {
|
||||||
|
LambdaQueryWrapper<DeviceInfo> lqw = buildQueryWrapper(bo);
|
||||||
|
return baseMapper.selectVoList(lqw);
|
||||||
|
}
|
||||||
|
|
||||||
|
private LambdaQueryWrapper<DeviceInfo> buildQueryWrapper(DeviceInfoBo bo) {
|
||||||
|
Map<String, Object> params = bo.getParams();
|
||||||
|
LambdaQueryWrapper<DeviceInfo> lqw = Wrappers.lambdaQuery();
|
||||||
|
lqw.orderByDesc(DeviceInfo::getId);
|
||||||
|
lqw.eq(bo.getProjectId() != null, DeviceInfo::getProjectId, bo.getProjectId());
|
||||||
|
lqw.like(StringUtils.isNotBlank(bo.getDeviceCode()), DeviceInfo::getDeviceCode, bo.getDeviceCode());
|
||||||
|
lqw.like(StringUtils.isNotBlank(bo.getDeviceName()), DeviceInfo::getDeviceName, bo.getDeviceName());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getModelSpec()), DeviceInfo::getModelSpec, bo.getModelSpec());
|
||||||
|
lqw.eq(bo.getTypeId() != null, DeviceInfo::getTypeId, bo.getTypeId());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getManufacturer()), DeviceInfo::getManufacturer, bo.getManufacturer());
|
||||||
|
lqw.eq(bo.getProductionDate() != null, DeviceInfo::getProductionDate, bo.getProductionDate());
|
||||||
|
lqw.eq(bo.getWarrantyDate() != null, DeviceInfo::getWarrantyDate, bo.getWarrantyDate());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getStatus()), DeviceInfo::getStatus, bo.getStatus());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getResponsiblePerson()), DeviceInfo::getResponsiblePerson, bo.getResponsiblePerson());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getContactPhone()), DeviceInfo::getContactPhone, bo.getContactPhone());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getDescription()), DeviceInfo::getDescription, bo.getDescription());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getImage()), DeviceInfo::getImage, bo.getImage());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getFile()), DeviceInfo::getFile, bo.getFile());
|
||||||
|
return lqw;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增设备信息
|
||||||
|
*
|
||||||
|
* @param bo 设备信息
|
||||||
|
* @return 是否新增成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean insertByBo(DeviceInfoBo bo) {
|
||||||
|
DeviceInfo add = MapstructUtils.convert(bo, DeviceInfo.class);
|
||||||
|
validEntityBeforeSave(add);
|
||||||
|
boolean flag = baseMapper.insert(add) > 0;
|
||||||
|
if (flag) {
|
||||||
|
bo.setId(add.getId());
|
||||||
|
}
|
||||||
|
return flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改设备信息
|
||||||
|
*
|
||||||
|
* @param bo 设备信息
|
||||||
|
* @return 是否修改成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean updateByBo(DeviceInfoBo bo) {
|
||||||
|
DeviceInfo update = MapstructUtils.convert(bo, DeviceInfo.class);
|
||||||
|
validEntityBeforeSave(update);
|
||||||
|
return baseMapper.updateById(update) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存前的数据校验
|
||||||
|
*/
|
||||||
|
private void validEntityBeforeSave(DeviceInfo entity){
|
||||||
|
boolean exists = this.lambdaQuery().eq(DeviceInfo::getDeviceCode, entity.getDeviceCode())
|
||||||
|
.ne(entity.getId() != null, DeviceInfo::getId, entity.getId()).exists();
|
||||||
|
if (exists) {
|
||||||
|
throw new ServiceException("设备编码已存在");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验并批量删除设备信息信息
|
||||||
|
*
|
||||||
|
* @param ids 待删除的主键集合
|
||||||
|
* @param isValid 是否进行有效性校验
|
||||||
|
* @return 是否删除成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||||
|
if(isValid){
|
||||||
|
List<DeviceAccessRecord> list = deviceAccessRecordService.lambdaQuery().in(DeviceAccessRecord::getDeviceId, ids).list();
|
||||||
|
if(CollectionUtil.isNotEmpty(list)){
|
||||||
|
throw new ServiceException("设备存在进出场记录,不能删除");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return baseMapper.deleteByIds(ids) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Integer> count(Long projectId) {
|
||||||
|
|
||||||
|
Map<String, Integer> map = new LinkedHashMap<>();
|
||||||
|
List<SysDictDataVo> deviceStatus = dictTypeService.selectDictDataByType("device_status");
|
||||||
|
|
||||||
|
List<DeviceInfo> list = this.lambdaQuery().eq(DeviceInfo::getProjectId, projectId).list();
|
||||||
|
for (SysDictDataVo status : deviceStatus) {
|
||||||
|
map.put(status.getDictLabel(), (int)list.stream().filter(deviceInfo -> status.getDictValue().equals(deviceInfo.getStatus())).count());
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Integer> typeCount(Long projectId) {
|
||||||
|
Map<String, Integer> map = new LinkedHashMap<>();
|
||||||
|
|
||||||
|
List<DeviceInfo> list = this.lambdaQuery().eq(DeviceInfo::getProjectId, projectId).list();
|
||||||
|
Set<Long> collect = list.stream().map(DeviceInfo::getTypeId).collect(Collectors.toSet());
|
||||||
|
List<DeviceType> deviceTypes;
|
||||||
|
if(CollectionUtil.isEmpty(collect)){
|
||||||
|
deviceTypes = new ArrayList<>();
|
||||||
|
}else{
|
||||||
|
deviceTypes = deviceTypeService.listByIds(collect);
|
||||||
|
}
|
||||||
|
List<DeviceType> list1 = deviceTypeService.lambdaQuery().eq(DeviceType::getParentId, 0L).list();
|
||||||
|
for (DeviceType deviceType : list1) {
|
||||||
|
Long id = deviceType.getId();
|
||||||
|
long count = deviceTypes.stream()
|
||||||
|
.filter(vo -> vo.getAncestors().contains(StringUtils.SEPARATOR + id) ||vo.getId().equals(id))
|
||||||
|
.count();
|
||||||
|
map.put(deviceType.getTypeName(), (int)count);
|
||||||
|
}
|
||||||
|
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,176 @@
|
|||||||
|
package org.dromara.device.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.dromara.common.core.exception.ServiceException;
|
||||||
|
import org.dromara.common.core.utils.MapstructUtils;
|
||||||
|
import org.dromara.common.core.utils.StringUtils;
|
||||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.dromara.device.domain.DeviceInfo;
|
||||||
|
import org.dromara.device.service.IDeviceInfoService;
|
||||||
|
import org.springframework.context.annotation.Lazy;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.dromara.device.domain.bo.DeviceTypeBo;
|
||||||
|
import org.dromara.device.domain.vo.DeviceTypeVo;
|
||||||
|
import org.dromara.device.domain.DeviceType;
|
||||||
|
import org.dromara.device.mapper.DeviceTypeMapper;
|
||||||
|
import org.dromara.device.service.IDeviceTypeService;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型Service业务层处理
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-12-01
|
||||||
|
*/
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Service
|
||||||
|
public class DeviceTypeServiceImpl extends ServiceImpl<DeviceTypeMapper, DeviceType> implements IDeviceTypeService {
|
||||||
|
|
||||||
|
private final DeviceTypeMapper baseMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
@Lazy
|
||||||
|
private IDeviceInfoService deviceInfoService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询设备类型
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 设备类型
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public DeviceTypeVo queryById(Long id){
|
||||||
|
return baseMapper.selectVoById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询设备类型列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @param pageQuery 分页参数
|
||||||
|
* @return 设备类型分页列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public TableDataInfo<DeviceTypeVo> queryPageList(DeviceTypeBo bo, PageQuery pageQuery) {
|
||||||
|
LambdaQueryWrapper<DeviceType> lqw = buildQueryWrapper(bo);
|
||||||
|
Page<DeviceTypeVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||||
|
return TableDataInfo.build(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询符合条件的设备类型列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @return 设备类型列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<DeviceTypeVo> queryList(DeviceTypeBo bo) {
|
||||||
|
LambdaQueryWrapper<DeviceType> lqw = buildQueryWrapper(bo);
|
||||||
|
return baseMapper.selectVoList(lqw);
|
||||||
|
}
|
||||||
|
|
||||||
|
private LambdaQueryWrapper<DeviceType> buildQueryWrapper(DeviceTypeBo bo) {
|
||||||
|
Map<String, Object> params = bo.getParams();
|
||||||
|
LambdaQueryWrapper<DeviceType> lqw = Wrappers.lambdaQuery();
|
||||||
|
lqw.orderByDesc(DeviceType::getId);
|
||||||
|
lqw.like(StringUtils.isNotBlank(bo.getTypeCode()), DeviceType::getTypeCode, bo.getTypeCode());
|
||||||
|
lqw.like(StringUtils.isNotBlank(bo.getTypeName()), DeviceType::getTypeName, bo.getTypeName());
|
||||||
|
lqw.eq(bo.getParentId() != null, DeviceType::getParentId, bo.getParentId());
|
||||||
|
lqw.eq(bo.getLevel() != null, DeviceType::getLevel, bo.getLevel());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getDescription()), DeviceType::getDescription, bo.getDescription());
|
||||||
|
return lqw;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增设备类型
|
||||||
|
*
|
||||||
|
* @param bo 设备类型
|
||||||
|
* @return 是否新增成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean insertByBo(DeviceTypeBo bo) {
|
||||||
|
DeviceType add = MapstructUtils.convert(bo, DeviceType.class);
|
||||||
|
validEntityBeforeSave(add);
|
||||||
|
handleLevelAndAncestors(add);
|
||||||
|
boolean flag = baseMapper.insert(add) > 0;
|
||||||
|
if (flag) {
|
||||||
|
bo.setId(add.getId());
|
||||||
|
}
|
||||||
|
return flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改设备类型
|
||||||
|
*
|
||||||
|
* @param bo 设备类型
|
||||||
|
* @return 是否修改成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean updateByBo(DeviceTypeBo bo) {
|
||||||
|
DeviceType update = MapstructUtils.convert(bo, DeviceType.class);
|
||||||
|
validEntityBeforeSave(update);
|
||||||
|
handleLevelAndAncestors(update);
|
||||||
|
return baseMapper.updateById(update) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void handleLevelAndAncestors(DeviceType deviceType) {
|
||||||
|
if(deviceType.getParentId() == 0L){
|
||||||
|
deviceType.setAncestors("0");
|
||||||
|
deviceType.setLevel(1);
|
||||||
|
}else {
|
||||||
|
DeviceType parent = baseMapper.selectById(deviceType.getParentId());
|
||||||
|
deviceType.setAncestors(parent.getAncestors() + StringUtils.SEPARATOR + parent.getId());
|
||||||
|
deviceType.setLevel(parent.getLevel() + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存前的数据校验
|
||||||
|
*/
|
||||||
|
private void validEntityBeforeSave(DeviceType entity){
|
||||||
|
//TODO 做一些数据校验,如唯一约束
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验并批量删除设备类型信息
|
||||||
|
*
|
||||||
|
* @param ids 待删除的主键集合
|
||||||
|
* @param isValid 是否进行有效性校验
|
||||||
|
* @return 是否删除成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||||
|
List<Long> checkIds = new ArrayList<>();
|
||||||
|
if(isValid){
|
||||||
|
for (Long id : ids) {
|
||||||
|
DeviceType deviceType = baseMapper.selectById(id);
|
||||||
|
if(deviceType == null){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
String prefix = deviceType.getAncestors() + "," + deviceType.getId();
|
||||||
|
LambdaQueryWrapper<DeviceType> queryWrapper = new LambdaQueryWrapper<DeviceType>()
|
||||||
|
.like(DeviceType::getAncestors, prefix)
|
||||||
|
.orderByAsc(DeviceType::getLevel, DeviceType::getId);
|
||||||
|
List<DeviceType> list = baseMapper.selectList(queryWrapper);
|
||||||
|
checkIds.addAll(list.stream().map(DeviceType::getId).toList());
|
||||||
|
}
|
||||||
|
checkIds.addAll(ids);
|
||||||
|
List<DeviceInfo> list = deviceInfoService.lambdaQuery().in(DeviceInfo::getTypeId, checkIds).list();
|
||||||
|
if(CollectionUtil.isNotEmpty(list)){
|
||||||
|
throw new ServiceException("当前类型或子级类型存在设备");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return baseMapper.deleteByIds(checkIds) > 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -20,6 +20,7 @@ import org.dromara.drone.domain.vo.DroDroneBigPictureVo;
|
|||||||
import org.dromara.drone.service.IDroDroneBigPictureService;
|
import org.dromara.drone.service.IDroDroneBigPictureService;
|
||||||
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;
|
||||||
|
|
||||||
@ -57,6 +58,16 @@ public class DroDroneBigPictureController extends BaseController {
|
|||||||
ExcelUtil.exportExcel(list, "无人机大图信息", DroDroneBigPictureVo.class, response);
|
ExcelUtil.exportExcel(list, "无人机大图信息", DroDroneBigPictureVo.class, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上传zip文件
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("drone:droneBigPicture:add")
|
||||||
|
@Log(title = "无人机大图信息", businessType = BusinessType.IMPORT)
|
||||||
|
@PostMapping("/uploadZip")
|
||||||
|
public R<Boolean> uploadZip(@RequestPart("file") MultipartFile file, @Validated(AddGroup.class) DroDroneBigPictureBo bo) {
|
||||||
|
return R.ok(droDroneBigPictureService.uploadZip(file, bo));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取无人机大图信息详细信息
|
* 获取无人机大图信息详细信息
|
||||||
*
|
*
|
||||||
@ -77,7 +88,7 @@ public class DroDroneBigPictureController extends BaseController {
|
|||||||
@RepeatSubmit()
|
@RepeatSubmit()
|
||||||
@PostMapping()
|
@PostMapping()
|
||||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody DroDroneBigPictureBo bo) {
|
public R<Void> add(@Validated(AddGroup.class) @RequestBody DroDroneBigPictureBo bo) {
|
||||||
return toAjax(droDroneBigPictureService.insertByBo(bo));
|
return toAjax(droDroneBigPictureService.insertByBo(bo, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -73,6 +73,11 @@ public class DroDroneBigPicture extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
private String tifFile;
|
private String tifFile;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 来源类型
|
||||||
|
*/
|
||||||
|
private String sourceType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 状态
|
* 状态
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -74,6 +74,11 @@ public class DroDroneBigPictureBo extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
private String tifFile;
|
private String tifFile;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 来源类型
|
||||||
|
*/
|
||||||
|
private String sourceType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 状态
|
* 状态
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -91,12 +91,23 @@ public class DroDroneBigPictureVo implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private String recognizeResult;
|
private String recognizeResult;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 识别结果列表
|
||||||
|
*/
|
||||||
|
private String recognizeResultStr;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* tif文件
|
* tif文件
|
||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "tif文件")
|
@ExcelProperty(value = "tif文件")
|
||||||
private String tifFile;
|
private String tifFile;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 来源类型
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "来源类型")
|
||||||
|
private String sourceType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 状态
|
* 状态
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -7,7 +7,9 @@ import org.dromara.drone.domain.DroDroneBigPicture;
|
|||||||
import org.dromara.drone.domain.bo.DroDroneBigPictureBo;
|
import org.dromara.drone.domain.bo.DroDroneBigPictureBo;
|
||||||
import org.dromara.drone.domain.bo.DroDroneBigPictureProgressVo;
|
import org.dromara.drone.domain.bo.DroDroneBigPictureProgressVo;
|
||||||
import org.dromara.drone.domain.vo.DroDroneBigPictureVo;
|
import org.dromara.drone.domain.vo.DroDroneBigPictureVo;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
@ -48,10 +50,11 @@ public interface IDroDroneBigPictureService extends IService<DroDroneBigPicture>
|
|||||||
/**
|
/**
|
||||||
* 新增无人机大图信息
|
* 新增无人机大图信息
|
||||||
*
|
*
|
||||||
* @param bo 无人机大图信息
|
* @param bo 无人机大图信息
|
||||||
|
* @param isNew 是否创建新记录
|
||||||
* @return 是否新增成功
|
* @return 是否新增成功
|
||||||
*/
|
*/
|
||||||
Boolean insertByBo(DroDroneBigPictureBo bo);
|
Boolean insertByBo(DroDroneBigPictureBo bo, Boolean isNew);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改无人机大图信息
|
* 修改无人机大图信息
|
||||||
@ -100,6 +103,15 @@ public interface IDroDroneBigPictureService extends IService<DroDroneBigPicture>
|
|||||||
*/
|
*/
|
||||||
Boolean compressPicture(String ossIds, List<Long> compressPicIds);
|
Boolean compressPicture(String ossIds, List<Long> compressPicIds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 异步合成大图
|
||||||
|
*
|
||||||
|
* @param businessName 业务名称
|
||||||
|
* @param imageUrls 图片URL列表
|
||||||
|
* @return 任务id
|
||||||
|
*/
|
||||||
|
CompletableFuture<String> asyncAddBigPicture(String businessName, List<String> imageUrls);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 异步添加压缩图片
|
* 异步添加压缩图片
|
||||||
*
|
*
|
||||||
@ -116,4 +128,22 @@ public interface IDroDroneBigPictureService extends IService<DroDroneBigPicture>
|
|||||||
* @return 是否成功
|
* @return 是否成功
|
||||||
*/
|
*/
|
||||||
CompletableFuture<Boolean> asyncUpdateCompressPicture(DroDroneBigPicture pic, DroDroneBigPicture oldPic);
|
CompletableFuture<Boolean> asyncUpdateCompressPicture(DroDroneBigPicture pic, DroDroneBigPicture oldPic);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上传zip文件
|
||||||
|
*
|
||||||
|
* @param file zip文件
|
||||||
|
* @param bo 无人机大图信息
|
||||||
|
* @return 是否成功
|
||||||
|
*/
|
||||||
|
Boolean uploadZip(MultipartFile file, DroDroneBigPictureBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 解压zip文件
|
||||||
|
*
|
||||||
|
* @param zipFile zip文件
|
||||||
|
* @param tempDir 临时目录
|
||||||
|
* @return 解压后的文件的对象存储Ids
|
||||||
|
*/
|
||||||
|
CompletableFuture<List<Long>> unzipAsync(File zipFile, File tempDir);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,10 @@ package org.dromara.drone.service.impl;
|
|||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.convert.Convert;
|
import cn.hutool.core.convert.Convert;
|
||||||
|
import cn.hutool.core.io.FileTypeUtil;
|
||||||
|
import cn.hutool.core.io.FileUtil;
|
||||||
|
import cn.hutool.core.util.ZipUtil;
|
||||||
|
import cn.hutool.json.JSONUtil;
|
||||||
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 com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
@ -27,7 +31,9 @@ import org.dromara.drone.service.IDroDroneBigPictureService;
|
|||||||
import org.dromara.manager.dronemanager.DroneManager;
|
import org.dromara.manager.dronemanager.DroneManager;
|
||||||
import org.dromara.manager.dronemanager.vo.DroneImgMergeProgressVo;
|
import org.dromara.manager.dronemanager.vo.DroneImgMergeProgressVo;
|
||||||
import org.dromara.manager.dronemanager.vo.DroneImgMergeUrlVo;
|
import org.dromara.manager.dronemanager.vo.DroneImgMergeUrlVo;
|
||||||
|
import org.dromara.manager.recognizermanager.enums.RecognizerTypeEnum;
|
||||||
import org.dromara.progress.domain.dto.progressplandetail.PgsProgressPlanDetailAINumberReq;
|
import org.dromara.progress.domain.dto.progressplandetail.PgsProgressPlanDetailAINumberReq;
|
||||||
|
import org.dromara.progress.domain.vo.progressplandetail.PgsProgressPlanDetailRecognizerVo;
|
||||||
import org.dromara.progress.service.IPgsProgressPlanDetailService;
|
import org.dromara.progress.service.IPgsProgressPlanDetailService;
|
||||||
import org.dromara.system.domain.vo.SysOssVo;
|
import org.dromara.system.domain.vo.SysOssVo;
|
||||||
import org.dromara.system.service.ISysOssService;
|
import org.dromara.system.service.ISysOssService;
|
||||||
@ -36,7 +42,9 @@ import org.springframework.context.annotation.Lazy;
|
|||||||
import org.springframework.scheduling.annotation.Async;
|
import org.springframework.scheduling.annotation.Async;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
@ -54,7 +62,8 @@ import java.util.stream.Collectors;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@Service
|
@Service
|
||||||
public class DroDroneBigPictureServiceImpl extends ServiceImpl<DroDroneBigPictureMapper, DroDroneBigPicture>
|
public
|
||||||
|
class DroDroneBigPictureServiceImpl extends ServiceImpl<DroDroneBigPictureMapper, DroDroneBigPicture>
|
||||||
implements IDroDroneBigPictureService {
|
implements IDroDroneBigPictureService {
|
||||||
|
|
||||||
@Lazy
|
@Lazy
|
||||||
@ -90,11 +99,34 @@ public class DroDroneBigPictureServiceImpl extends ServiceImpl<DroDroneBigPictur
|
|||||||
BigDecimal p = progressVo.getProgress()
|
BigDecimal p = progressVo.getProgress()
|
||||||
.multiply(new BigDecimal("100"));
|
.multiply(new BigDecimal("100"));
|
||||||
pictureVo.setProgress(p.compareTo(BigDecimal.valueOf(100)) == 0 ?
|
pictureVo.setProgress(p.compareTo(BigDecimal.valueOf(100)) == 0 ?
|
||||||
BigDecimal.valueOf(100) : p.setScale(4, RoundingMode.HALF_UP));
|
BigDecimal.valueOf(100) : p.setScale(2, RoundingMode.HALF_UP));
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("查询图片合成进度异常", e);
|
log.error("查询图片合成进度异常", e);
|
||||||
}
|
}
|
||||||
|
if (StringUtils.isNotBlank(pictureVo.getRecognizeResult())) {
|
||||||
|
List<PgsProgressPlanDetailRecognizerVo> recognizerList =
|
||||||
|
JSONUtil.toList(pictureVo.getRecognizeResult(), PgsProgressPlanDetailRecognizerVo.class);
|
||||||
|
if (CollUtil.isNotEmpty(recognizerList)) {
|
||||||
|
// 1. 按类型名称分组
|
||||||
|
Map<String, List<PgsProgressPlanDetailRecognizerVo>> groupMap = recognizerList.stream()
|
||||||
|
.collect(Collectors.groupingBy(r -> {
|
||||||
|
RecognizerTypeEnum typeEnum = RecognizerTypeEnum.fromValue(r.getType());
|
||||||
|
return typeEnum != null ? typeEnum.getText() : "未知类型";
|
||||||
|
}));
|
||||||
|
// 2. 将每组转换为 “类型:name1, name2”
|
||||||
|
String recognizerStr = groupMap.entrySet().stream()
|
||||||
|
.map(entry -> {
|
||||||
|
String type = entry.getKey();
|
||||||
|
String names = entry.getValue().stream()
|
||||||
|
.map(PgsProgressPlanDetailRecognizerVo::getName)
|
||||||
|
.collect(Collectors.joining(", "));
|
||||||
|
return type + ":" + names;
|
||||||
|
})
|
||||||
|
.collect(Collectors.joining(";")); // 组之间用分号分隔
|
||||||
|
pictureVo.setRecognizeResultStr(recognizerStr);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return pictureVo;
|
return pictureVo;
|
||||||
}
|
}
|
||||||
@ -123,13 +155,36 @@ public class DroDroneBigPictureServiceImpl extends ServiceImpl<DroDroneBigPictur
|
|||||||
BigDecimal p = progressVo.getProgress()
|
BigDecimal p = progressVo.getProgress()
|
||||||
.multiply(new BigDecimal("100"));
|
.multiply(new BigDecimal("100"));
|
||||||
pictureVo.setProgress(p.compareTo(BigDecimal.valueOf(100)) == 0 ?
|
pictureVo.setProgress(p.compareTo(BigDecimal.valueOf(100)) == 0 ?
|
||||||
BigDecimal.valueOf(100) : p.setScale(4, RoundingMode.HALF_UP));
|
BigDecimal.valueOf(100) : p.setScale(2, RoundingMode.HALF_UP));
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
pictureVo.setStatus("4");
|
pictureVo.setStatus("4");
|
||||||
pictureVo.setRemark(e.getMessage());
|
pictureVo.setRemark(e.getMessage());
|
||||||
log.error("查询图片合成进度异常", e);
|
log.error("查询图片合成进度异常", e);
|
||||||
}
|
}
|
||||||
|
if (StringUtils.isNotBlank(pictureVo.getRecognizeResult())) {
|
||||||
|
List<PgsProgressPlanDetailRecognizerVo> recognizerList =
|
||||||
|
JSONUtil.toList(pictureVo.getRecognizeResult(), PgsProgressPlanDetailRecognizerVo.class);
|
||||||
|
if (CollUtil.isNotEmpty(recognizerList)) {
|
||||||
|
// 1. 按类型名称分组
|
||||||
|
Map<String, List<PgsProgressPlanDetailRecognizerVo>> groupMap = recognizerList.stream()
|
||||||
|
.collect(Collectors.groupingBy(r -> {
|
||||||
|
RecognizerTypeEnum typeEnum = RecognizerTypeEnum.fromValue(r.getType());
|
||||||
|
return typeEnum != null ? typeEnum.getText() : "未知类型";
|
||||||
|
}));
|
||||||
|
// 2. 将每组转换为 “类型:name1, name2”
|
||||||
|
String recognizerStr = groupMap.entrySet().stream()
|
||||||
|
.map(entry -> {
|
||||||
|
String type = entry.getKey();
|
||||||
|
String names = entry.getValue().stream()
|
||||||
|
.map(PgsProgressPlanDetailRecognizerVo::getName)
|
||||||
|
.collect(Collectors.joining(", "));
|
||||||
|
return type + ":" + names;
|
||||||
|
})
|
||||||
|
.collect(Collectors.joining(";")); // 组之间用分号分隔
|
||||||
|
pictureVo.setRecognizeResultStr(recognizerStr);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
result.setRecords(records);
|
result.setRecords(records);
|
||||||
@ -157,6 +212,7 @@ public class DroDroneBigPictureServiceImpl extends ServiceImpl<DroDroneBigPictur
|
|||||||
lqw.eq(StringUtils.isNotBlank(bo.getBigPic()), DroDroneBigPicture::getBigPic, bo.getBigPic());
|
lqw.eq(StringUtils.isNotBlank(bo.getBigPic()), DroDroneBigPicture::getBigPic, bo.getBigPic());
|
||||||
lqw.eq(bo.getRecognizePic() != null, DroDroneBigPicture::getRecognizePic, bo.getRecognizePic());
|
lqw.eq(bo.getRecognizePic() != null, DroDroneBigPicture::getRecognizePic, bo.getRecognizePic());
|
||||||
lqw.eq(StringUtils.isNotBlank(bo.getTifFile()), DroDroneBigPicture::getTifFile, bo.getTifFile());
|
lqw.eq(StringUtils.isNotBlank(bo.getTifFile()), DroDroneBigPicture::getTifFile, bo.getTifFile());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getSourceType()), DroDroneBigPicture::getSourceType, bo.getSourceType());
|
||||||
lqw.eq(StringUtils.isNotBlank(bo.getStatus()), DroDroneBigPicture::getStatus, bo.getStatus());
|
lqw.eq(StringUtils.isNotBlank(bo.getStatus()), DroDroneBigPicture::getStatus, bo.getStatus());
|
||||||
return lqw;
|
return lqw;
|
||||||
}
|
}
|
||||||
@ -164,19 +220,27 @@ public class DroDroneBigPictureServiceImpl extends ServiceImpl<DroDroneBigPictur
|
|||||||
/**
|
/**
|
||||||
* 新增无人机大图信息
|
* 新增无人机大图信息
|
||||||
*
|
*
|
||||||
* @param bo 无人机大图信息
|
* @param bo 无人机大图信息
|
||||||
|
* @param isNew 是否创建新记录
|
||||||
* @return 是否新增成功
|
* @return 是否新增成功
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Boolean insertByBo(DroDroneBigPictureBo bo) {
|
public Boolean insertByBo(DroDroneBigPictureBo bo, Boolean isNew) {
|
||||||
DroDroneBigPicture add = MapstructUtils.convert(bo, DroDroneBigPicture.class);
|
DroDroneBigPicture add = MapstructUtils.convert(bo, DroDroneBigPicture.class);
|
||||||
if (add == null) {
|
if (add == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
boolean save = this.save(add);
|
if (isNew) {
|
||||||
if (!save) {
|
if (StringUtils.isNotBlank(add.getBigPic()) && StringUtils.isNotBlank(add.getTifFile())) {
|
||||||
throw new ServiceException("新增无人机大图信息失败");
|
add.setStatus("3");
|
||||||
|
}
|
||||||
|
add.setSourceType("1");
|
||||||
|
boolean save = this.save(add);
|
||||||
|
if (!save) {
|
||||||
|
throw new ServiceException("新增无人机大图信息失败");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Long id = add.getId();
|
||||||
// 压缩图片
|
// 压缩图片
|
||||||
String smallPic = add.getSmallPic();
|
String smallPic = add.getSmallPic();
|
||||||
if (StringUtils.isNotBlank(smallPic)) {
|
if (StringUtils.isNotBlank(smallPic)) {
|
||||||
@ -188,7 +252,7 @@ public class DroDroneBigPictureServiceImpl extends ServiceImpl<DroDroneBigPictur
|
|||||||
.map(String::valueOf)
|
.map(String::valueOf)
|
||||||
.collect(Collectors.joining(","));
|
.collect(Collectors.joining(","));
|
||||||
DroDroneBigPicture update = new DroDroneBigPicture();
|
DroDroneBigPicture update = new DroDroneBigPicture();
|
||||||
update.setId(add.getId());
|
update.setId(id);
|
||||||
update.setCompressPic(ossIds);
|
update.setCompressPic(ossIds);
|
||||||
this.updateById(update);
|
this.updateById(update);
|
||||||
}).exceptionally(ex -> {
|
}).exceptionally(ex -> {
|
||||||
@ -196,6 +260,30 @@ public class DroDroneBigPictureServiceImpl extends ServiceImpl<DroDroneBigPictur
|
|||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if (StringUtils.isNotBlank(smallPic) && StringUtils.isBlank(add.getBigPic())) {
|
||||||
|
List<Long> picIds = StringUtils.splitTo(smallPic, Convert::toLong);
|
||||||
|
List<SysOssVo> ossVos = ossService.listByIds(picIds);
|
||||||
|
List<String> picUrls = ossVos.stream().map(SysOssVo::getUrl).toList();
|
||||||
|
// 异步执行大图合并
|
||||||
|
self.asyncAddBigPicture(add.getTaskName(), picUrls)
|
||||||
|
.thenAccept(result -> {
|
||||||
|
DroDroneBigPicture update = new DroDroneBigPicture();
|
||||||
|
update.setId(id);
|
||||||
|
update.setStatus("2");
|
||||||
|
update.setTaskId(result);
|
||||||
|
this.updateById(update);
|
||||||
|
}).exceptionally(ex -> {
|
||||||
|
log.error("无人机大图信息[{}]异步执行合成图片失败", add.getTaskName(), ex);
|
||||||
|
DroDroneBigPicture update = new DroDroneBigPicture();
|
||||||
|
update.setId(id);
|
||||||
|
update.setStatus("4");
|
||||||
|
this.updateById(update);
|
||||||
|
return null;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(add.getBigPic()) && StringUtils.isNotBlank(add.getTifFile())) {
|
||||||
|
return this.createProgressRecognize(id);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -254,8 +342,26 @@ public class DroDroneBigPictureServiceImpl extends ServiceImpl<DroDroneBigPictur
|
|||||||
fileUrl = mergeUrlVo.getPngUrl();
|
fileUrl = mergeUrlVo.getPngUrl();
|
||||||
tifUrl = mergeUrlVo.getTifUrl();
|
tifUrl = mergeUrlVo.getTifUrl();
|
||||||
} else {
|
} else {
|
||||||
fileUrl = bigPicture.getBigPic();
|
String bigPic = bigPicture.getBigPic();
|
||||||
tifUrl = bigPicture.getTifFile();
|
if (isLong(bigPic)) {
|
||||||
|
SysOssVo ossVo = ossService.getById(Long.parseLong(bigPic));
|
||||||
|
if (ossVo != null) {
|
||||||
|
bigPic = ossVo.getUrl();
|
||||||
|
} else {
|
||||||
|
throw new ServiceException("图片不存在");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fileUrl = bigPic;
|
||||||
|
String tifFile = bigPicture.getTifFile();
|
||||||
|
if (isLong(tifFile)) {
|
||||||
|
SysOssVo ossVo = ossService.getById(Long.parseLong(tifFile));
|
||||||
|
if (ossVo != null) {
|
||||||
|
tifFile = ossVo.getUrl();
|
||||||
|
} else {
|
||||||
|
throw new ServiceException("TIF文件不存在");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tifUrl = tifFile;
|
||||||
}
|
}
|
||||||
// 创建进度识别
|
// 创建进度识别
|
||||||
PgsProgressPlanDetailAINumberReq ai = new PgsProgressPlanDetailAINumberReq();
|
PgsProgressPlanDetailAINumberReq ai = new PgsProgressPlanDetailAINumberReq();
|
||||||
@ -317,6 +423,32 @@ public class DroDroneBigPictureServiceImpl extends ServiceImpl<DroDroneBigPictur
|
|||||||
throw new ServiceException("图片删除异常");
|
throw new ServiceException("图片删除异常");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for (DroDroneBigPicture picture : list) {
|
||||||
|
String bigPic = picture.getBigPic();
|
||||||
|
if (StringUtils.isNotBlank(bigPic)) {
|
||||||
|
if (isLong(bigPic)) {
|
||||||
|
SysOssVo ossVo = ossService.getById(Long.parseLong(bigPic));
|
||||||
|
if (ossVo != null) {
|
||||||
|
ossService.deleteWithValidByIds(Collections.singleton(ossVo.getOssId()), false);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
OssClient storage = OssFactory.instance();
|
||||||
|
storage.delete(bigPic);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
String tifFile = picture.getTifFile();
|
||||||
|
if (StringUtils.isNotBlank(tifFile)) {
|
||||||
|
if (isLong(tifFile)) {
|
||||||
|
SysOssVo ossVo = ossService.getById(Long.parseLong(tifFile));
|
||||||
|
if (ossVo != null) {
|
||||||
|
ossService.deleteWithValidByIds(Collections.singleton(ossVo.getOssId()), false);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
OssClient storage = OssFactory.instance();
|
||||||
|
storage.delete(tifFile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return this.removeBatchByIds(ids);
|
return this.removeBatchByIds(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -342,7 +474,12 @@ public class DroDroneBigPictureServiceImpl extends ServiceImpl<DroDroneBigPictur
|
|||||||
if (!status.equals("2")) {
|
if (!status.equals("2")) {
|
||||||
return vo;
|
return vo;
|
||||||
}
|
}
|
||||||
DroneImgMergeProgressVo imgMergeProgress = droneManager.getImgMergeProgress(taskId);
|
DroneImgMergeProgressVo imgMergeProgress = null;
|
||||||
|
try {
|
||||||
|
imgMergeProgress = droneManager.getImgMergeProgress(taskId);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("获取图片合并进度失败:{}", e.getMessage());
|
||||||
|
}
|
||||||
if (imgMergeProgress == null) {
|
if (imgMergeProgress == null) {
|
||||||
return vo;
|
return vo;
|
||||||
}
|
}
|
||||||
@ -354,6 +491,7 @@ public class DroDroneBigPictureServiceImpl extends ServiceImpl<DroDroneBigPictur
|
|||||||
} else if (msg != null && msg.compareTo(BigDecimal.ZERO) >= 0 && msg.compareTo(BigDecimal.ONE) < 0) {
|
} else if (msg != null && msg.compareTo(BigDecimal.ZERO) >= 0 && msg.compareTo(BigDecimal.ONE) < 0) {
|
||||||
return vo;
|
return vo;
|
||||||
} else {
|
} else {
|
||||||
|
vo.setProgress(BigDecimal.ZERO);
|
||||||
newStatus = "4";
|
newStatus = "4";
|
||||||
picture.setStatus(newStatus);
|
picture.setStatus(newStatus);
|
||||||
}
|
}
|
||||||
@ -413,6 +551,19 @@ public class DroDroneBigPictureServiceImpl extends ServiceImpl<DroDroneBigPictur
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 异步合成大图
|
||||||
|
*
|
||||||
|
* @param businessName 业务名称
|
||||||
|
* @param imageUrls 图片URL列表
|
||||||
|
* @return 任务id
|
||||||
|
*/
|
||||||
|
@Async
|
||||||
|
@Override
|
||||||
|
public CompletableFuture<String> asyncAddBigPicture(String businessName, List<String> imageUrls) {
|
||||||
|
return CompletableFuture.completedFuture(droneManager.createImageMergeTask(businessName, imageUrls));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 异步添加压缩图片
|
* 异步添加压缩图片
|
||||||
*
|
*
|
||||||
@ -498,6 +649,136 @@ public class DroDroneBigPictureServiceImpl extends ServiceImpl<DroDroneBigPictur
|
|||||||
return CompletableFuture.completedFuture(b);
|
return CompletableFuture.completedFuture(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上传zip文件
|
||||||
|
*
|
||||||
|
* @param file zip文件
|
||||||
|
* @param bo 无人机大图信息
|
||||||
|
* @return 是否成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean uploadZip(MultipartFile file, DroDroneBigPictureBo bo) {
|
||||||
|
if (file == null) {
|
||||||
|
throw new ServiceException("请选择文件");
|
||||||
|
}
|
||||||
|
String zipName = file.getOriginalFilename();
|
||||||
|
if (StringUtils.isBlank(zipName)) {
|
||||||
|
throw new ServiceException("请选择文件");
|
||||||
|
}
|
||||||
|
File tempDir = new File(System.getProperty("java.io.tmpdir"), "zip_" + System.currentTimeMillis());
|
||||||
|
if (!tempDir.exists()) {
|
||||||
|
boolean mkdirs = tempDir.mkdirs();
|
||||||
|
if (!mkdirs) {
|
||||||
|
throw new RuntimeException("创建临时目录失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 主线程保存 ZIP 文件(必须提前保存!)
|
||||||
|
File zipFile = new File(tempDir, zipName);
|
||||||
|
try {
|
||||||
|
file.transferTo(zipFile);
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new ServiceException("ZIP 文件保存失败");
|
||||||
|
}
|
||||||
|
// 保存数据
|
||||||
|
bo.setStatus("9");
|
||||||
|
DroDroneBigPicture picture = new DroDroneBigPicture();
|
||||||
|
BeanUtils.copyProperties(bo, picture);
|
||||||
|
picture.setSourceType("1");
|
||||||
|
boolean save = this.save(picture);
|
||||||
|
if (!save) {
|
||||||
|
throw new ServiceException("保存数据失败");
|
||||||
|
}
|
||||||
|
Long id = picture.getId();
|
||||||
|
// 异步解压
|
||||||
|
self.unzipAsync(zipFile, tempDir)
|
||||||
|
.thenAccept(result -> {
|
||||||
|
String fileStr = result.stream()
|
||||||
|
.map(String::valueOf)
|
||||||
|
.collect(Collectors.joining(","));
|
||||||
|
bo.setId(id);
|
||||||
|
bo.setSmallPic(fileStr);
|
||||||
|
this.insertByBo(bo, false);
|
||||||
|
})
|
||||||
|
.exceptionally(ex -> {
|
||||||
|
// 统一处理解压失败(包括 ZipUtil 等异常)
|
||||||
|
log.error("压缩包处理失败: {}", ex.getMessage(), ex);
|
||||||
|
// 保存数据
|
||||||
|
DroDroneBigPicture update = new DroDroneBigPicture();
|
||||||
|
update.setId(id);
|
||||||
|
update.setStatus("8");
|
||||||
|
update.setRemark(ex.getMessage());
|
||||||
|
this.updateById(picture);
|
||||||
|
return null;
|
||||||
|
}).whenComplete((r, ex) -> {
|
||||||
|
// 不管成功失败,都删除临时文件
|
||||||
|
FileUtil.del(tempDir);
|
||||||
|
});
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 解压zip文件
|
||||||
|
*
|
||||||
|
* @param zipFile zip文件
|
||||||
|
* @param tempDir 临时目录
|
||||||
|
* @return 解压后的文件的对象存储Ids
|
||||||
|
*/
|
||||||
|
@Async("unzipExecutor")
|
||||||
|
@Override
|
||||||
|
public CompletableFuture<List<Long>> unzipAsync(File zipFile, File tempDir) {
|
||||||
|
File unzipDir;
|
||||||
|
try {
|
||||||
|
unzipDir = ZipUtil.unzip(zipFile);
|
||||||
|
} catch (Exception e) {
|
||||||
|
// 记录错误日志
|
||||||
|
log.error("解压失败:{}", zipFile.getAbsolutePath(), e);
|
||||||
|
// 抛出异常到上层 thenCompose,便于处理
|
||||||
|
CompletableFuture<List<Long>> future = new CompletableFuture<>();
|
||||||
|
future.completeExceptionally(new ServiceException("压缩包解压失败"));
|
||||||
|
return future;
|
||||||
|
}
|
||||||
|
// 找图片
|
||||||
|
List<File> imageFiles = FileUtil.loopFiles(unzipDir).stream()
|
||||||
|
.filter(this::isImage)
|
||||||
|
.toList();
|
||||||
|
if (CollUtil.isEmpty(imageFiles)) {
|
||||||
|
// 抛出异常到上层 thenCompose,便于处理
|
||||||
|
CompletableFuture<List<Long>> future = new CompletableFuture<>();
|
||||||
|
future.completeExceptionally(new ServiceException("压缩包中没有图片"));
|
||||||
|
return future;
|
||||||
|
}
|
||||||
|
// 异步上传任务
|
||||||
|
List<CompletableFuture<Long>> uploadFutures = new ArrayList<>();
|
||||||
|
for (File img : imageFiles) {
|
||||||
|
SysOssVo upload = ossService.upload(img);
|
||||||
|
uploadFutures.add(CompletableFuture.completedFuture(upload.getOssId()));
|
||||||
|
}
|
||||||
|
return CompletableFuture.allOf(uploadFutures.toArray(new CompletableFuture[0]))
|
||||||
|
.thenApply(v -> uploadFutures.stream()
|
||||||
|
.map(CompletableFuture::join)
|
||||||
|
.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断文件是否是图片
|
||||||
|
*
|
||||||
|
* @param file 文件
|
||||||
|
* @return 是否是图片
|
||||||
|
*/
|
||||||
|
private boolean isImage(File file) {
|
||||||
|
// 方式 1:判断扩展名
|
||||||
|
String ext = FileUtil.extName(file).toLowerCase();
|
||||||
|
List<String> imageExt = Arrays.asList("jpg", "jpeg", "png", "bmp", "gif", "webp");
|
||||||
|
if (imageExt.contains(ext)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 方式 2:判断真实文件类型(更安全)
|
||||||
|
String type = FileTypeUtil.getType(file);
|
||||||
|
return type != null && (type.equals("jpg") || type.equals("png")
|
||||||
|
|| type.equals("jpeg") || type.equals("gif") || type.equals("bmp"));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 判断两个Ids是否相同
|
* 判断两个Ids是否相同
|
||||||
*
|
*
|
||||||
@ -516,4 +797,19 @@ public class DroDroneBigPictureServiceImpl extends ServiceImpl<DroDroneBigPictur
|
|||||||
.collect(Collectors.toSet());
|
.collect(Collectors.toSet());
|
||||||
return set1.equals(set2);
|
return set1.equals(set2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断字符串是否为Long
|
||||||
|
*
|
||||||
|
* @param str 字符串
|
||||||
|
* @return 是否为Long
|
||||||
|
*/
|
||||||
|
private static boolean isLong(String str) {
|
||||||
|
try {
|
||||||
|
Long.parseLong(str);
|
||||||
|
return true;
|
||||||
|
} catch (Exception e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,6 +17,8 @@ import org.dromara.drone.domain.bo.DroProjectDroneBo;
|
|||||||
import org.dromara.drone.domain.vo.DroProjectDroneVo;
|
import org.dromara.drone.domain.vo.DroProjectDroneVo;
|
||||||
import org.dromara.drone.mapper.DroProjectDroneMapper;
|
import org.dromara.drone.mapper.DroProjectDroneMapper;
|
||||||
import org.dromara.drone.service.IDroProjectDroneService;
|
import org.dromara.drone.service.IDroProjectDroneService;
|
||||||
|
import org.dromara.facility.domain.FacRedLine;
|
||||||
|
import org.dromara.facility.service.IFacRedLineService;
|
||||||
import org.dromara.manager.dronemanager.DroneManager;
|
import org.dromara.manager.dronemanager.DroneManager;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@ -37,6 +39,9 @@ public class DroProjectDroneServiceImpl extends ServiceImpl<DroProjectDroneMappe
|
|||||||
@Resource
|
@Resource
|
||||||
private DroneManager droneManager;
|
private DroneManager droneManager;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IFacRedLineService facRedLineService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询项目无人机信息
|
* 查询项目无人机信息
|
||||||
*
|
*
|
||||||
@ -153,7 +158,18 @@ public class DroProjectDroneServiceImpl extends ServiceImpl<DroProjectDroneMappe
|
|||||||
.eq(DroProjectDrone::getProjectId, projectId)
|
.eq(DroProjectDrone::getProjectId, projectId)
|
||||||
.list();
|
.list();
|
||||||
if (CollUtil.isNotEmpty(list)) {
|
if (CollUtil.isNotEmpty(list)) {
|
||||||
droneManager.addAirportInfoByProject(list.stream().map(DroProjectDrone::getDroneSn).toList(), projectId);
|
List<String> gatewayList = list.stream().map(DroProjectDrone::getDroneSn).toList();
|
||||||
|
// 获取项目红线信息
|
||||||
|
FacRedLine redLine = facRedLineService.lambdaQuery()
|
||||||
|
.eq(FacRedLine::getProjectId, projectId)
|
||||||
|
.last("limit 1")
|
||||||
|
.one();
|
||||||
|
String positionStr = null;
|
||||||
|
if (redLine != null) {
|
||||||
|
positionStr = redLine.getPositions();
|
||||||
|
}
|
||||||
|
// 添加机场信息
|
||||||
|
droneManager.addAirportInfoByProject(gatewayList, positionStr, projectId);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -773,11 +773,11 @@ public class FacPhotovoltaicPanelServiceImpl extends ServiceImpl<FacPhotovoltaic
|
|||||||
// 获取项目下的所有未完成的光伏板
|
// 获取项目下的所有未完成的光伏板
|
||||||
List<FacPhotovoltaicPanel> panelList = this.lambdaQuery()
|
List<FacPhotovoltaicPanel> panelList = this.lambdaQuery()
|
||||||
.in(FacPhotovoltaicPanel::getProjectId, projectIds)
|
.in(FacPhotovoltaicPanel::getProjectId, projectIds)
|
||||||
.ne(FacPhotovoltaicPanel::getStatus, FacFinishStatusEnum.FINISH.getValue())
|
|
||||||
.eq(type.equals(RecognizerTypeEnum.BRACKET.getValue()), FacPhotovoltaicPanel::getProgressCategoryName, "支架安装")
|
.eq(type.equals(RecognizerTypeEnum.BRACKET.getValue()), FacPhotovoltaicPanel::getProgressCategoryName, "支架安装")
|
||||||
.eq(type.equals(RecognizerTypeEnum.PANEL.getValue()), FacPhotovoltaicPanel::getProgressCategoryName, "组件安装")
|
.eq(type.equals(RecognizerTypeEnum.PANEL.getValue()), FacPhotovoltaicPanel::getProgressCategoryName, "组件安装")
|
||||||
.list();
|
.list();
|
||||||
if (CollUtil.isEmpty(panelList)) {
|
if (CollUtil.isEmpty(panelList)) {
|
||||||
|
log.info("没有需要更新的光伏板");
|
||||||
return recognizeVoList;
|
return recognizeVoList;
|
||||||
}
|
}
|
||||||
// 判断识别出来的坐标是否包含在某个面内
|
// 判断识别出来的坐标是否包含在某个面内
|
||||||
@ -792,7 +792,9 @@ public class FacPhotovoltaicPanelServiceImpl extends ServiceImpl<FacPhotovoltaic
|
|||||||
vo.setName(containingPanel.getName());
|
vo.setName(containingPanel.getName());
|
||||||
vo.setType(type);
|
vo.setType(type);
|
||||||
recognizeVoList.add(vo);
|
recognizeVoList.add(vo);
|
||||||
finishPanelList.add(containingPanel);
|
if (!containingPanel.getStatus().equals(FacFinishStatusEnum.FINISH.getValue())) {
|
||||||
|
finishPanelList.add(containingPanel);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (CollUtil.isNotEmpty(finishPanelList)) {
|
if (CollUtil.isNotEmpty(finishPanelList)) {
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user