Merge remote-tracking branch 'origin/lixuetao' into lixuetao

This commit is contained in:
xuetao.li
2023-05-06 09:27:36 +08:00
63 changed files with 2233 additions and 501 deletions
@@ -120,8 +120,11 @@ public class ShiroFilterConfiguration {
filterChainDefinitionMap.put(restPath + "/updateUserInfo", ANON); filterChainDefinitionMap.put(restPath + "/updateUserInfo", ANON);
filterChainDefinitionMap.put(restPath + "/updatePassword", ANON); filterChainDefinitionMap.put(restPath + "/updatePassword", ANON);
filterChainDefinitionMap.put(restPath + "/user/supplierRegistry/*", ANON); filterChainDefinitionMap.put(restPath + "/user/supplierRegistry/*", ANON);
/* 流程需要 */
filterChainDefinitionMap.put(restPath + "/service/model/**", ANON);
filterChainDefinitionMap.put(restPath + "/service/editor/stencilset", ANON);
// filterChainDefinitionMap.put(restPath + "/**", AUTHC); filterChainDefinitionMap.put(restPath + "/**", AUTHC);
/* static 不需登录 */ /* static 不需登录 */
filterChainDefinitionMap.put("/static/**", ANON); filterChainDefinitionMap.put("/static/**", ANON);
@@ -130,9 +133,8 @@ public class ShiroFilterConfiguration {
filterChainDefinitionMap.put("/userfiles/**", ANON); filterChainDefinitionMap.put("/userfiles/**", ANON);
filterChainDefinitionMap.put(adminPath + LOGIN, AUTHC); filterChainDefinitionMap.put(adminPath + LOGIN, AUTHC);
filterChainDefinitionMap.put(adminPath + "/logout", "logout"); filterChainDefinitionMap.put(adminPath + "/logout", "logout");
// filterChainDefinitionMap.put(restPath + "/**", "logout");
filterChainDefinitionMap.put("/swagger-ui.html", ANON); filterChainDefinitionMap.put("/swagger-ui.html", ANON);
/* 流程需要 */
filterChainDefinitionMap.put(restPath + "/service/model/**", ANON);
// filterChainDefinitionMap.put("/swagger-ui.html", "jwtFilter"); // filterChainDefinitionMap.put("/swagger-ui.html", "jwtFilter");
/* 全api一般需要登录才能使用 */ /* 全api一般需要登录才能使用 */
@@ -1,11 +1,8 @@
package com.adc.da.login.security; package com.adc.da.login.security;
import com.adc.da.util.exception.AdcDaBaseException;
import com.adc.da.util.http.ResponseMessage;
import org.apache.shiro.authc.AuthenticationToken; import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.subject.Subject; import org.apache.shiro.subject.Subject;
import org.apache.shiro.util.ThreadContext; import org.apache.shiro.util.ThreadContext;
import org.apache.shiro.web.servlet.ShiroHttpServletResponse;
import org.apache.shiro.web.subject.WebSubject; import org.apache.shiro.web.subject.WebSubject;
import org.apache.shiro.web.util.WebUtils; import org.apache.shiro.web.util.WebUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -56,6 +53,7 @@ public class AdcFormAuthenticationFilter extends org.apache.shiro.web.filter.aut
return new UsernamePasswordToken(username, record.toCharArray(), rememberMe, host, captcha); return new UsernamePasswordToken(username, record.toCharArray(), rememberMe, host, captcha);
} }
@Override
protected boolean onAccessDenied(ServletRequest request, ServletResponse response) throws Exception { protected boolean onAccessDenied(ServletRequest request, ServletResponse response) throws Exception {
Subject subject = this.getSubject(request, response); Subject subject = this.getSubject(request, response);
@@ -21,7 +21,7 @@ public class WebMvcConfig implements WebMvcConfigurer {
@Override @Override
public void addResourceHandlers(ResourceHandlerRegistry registry) { public void addResourceHandlers(ResourceHandlerRegistry registry) {
// /home/file/**为前端URL访问路径 后面 file:xxxx为本地磁盘映射 // /home/file/**为前端URL访问路径 后面 file:xxxx为本地磁盘映射
registry.addResourceHandler(picPath+"**").addResourceLocations("file://"+uploadFile); registry.addResourceHandler(picPath + "**").addResourceLocations("file:" + uploadFile);
} }
} }
@@ -18,7 +18,7 @@
#spring.datasource.password = adc_forecast #spring.datasource.password = adc_forecast
#kylin数据库 ds1 #kylin\u6570\u636E\u5E93 ds1
#spring.datasource.kylin.name=PROJECT_MI #spring.datasource.kylin.name=PROJECT_MI
#spring.datasource.kylin.driverClassName=org.apache.kylin.jdbc.Driver #spring.datasource.kylin.driverClassName=org.apache.kylin.jdbc.Driver
#spring.datasource.kylin.url=jdbc:kylin://10.64.23.8:7070/PROJECT_MI #spring.datasource.kylin.url=jdbc:kylin://10.64.23.8:7070/PROJECT_MI
@@ -28,32 +28,32 @@
#spring.datasource.kylin.maxWaitTime=10000 #spring.datasource.kylin.maxWaitTime=10000
#spring.datasource.kylin.poolSize=10 #spring.datasource.kylin.poolSize=10
# #
##mysql数据库 ds2 ##mysql\u6570\u636E\u5E93 ds2
#spring.datasource.mysql.driverClassName = com.mysql.jdbc.Driver #spring.datasource.mysql.driverClassName = com.mysql.jdbc.Driver
#spring.datasource.mysql.url = jdbc:mysql://192.168.144.80:3306/cadata?characterEncoding=utf-8&&zeroDateTimeBehavior=convertToNull #spring.datasource.mysql.url = jdbc:mysql://192.168.144.80:3306/cadata?characterEncoding=utf-8&&zeroDateTimeBehavior=convertToNull
#spring.datasource.mysql.username = root #spring.datasource.mysql.username = root
#spring.datasource.mysql.password = root #spring.datasource.mysql.password = root
spring.datasource.driverClassName = com.mysql.cj.jdbc.Driver spring.datasource.driverClassName = com.mysql.cj.jdbc.Driver
spring.datasource.url = jdbc:mysql://121.36.69.172:3307/report-library?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true spring.datasource.url = jdbc:mysql://121.36.69.172:3307/report-library?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
spring.datasource.username = root spring.datasource.username = root
spring.datasource.password = hzwlsoft.com spring.datasource.password = hzwlsoft.com
#后端端口 #\u540E\u7AEF\u7AEF\u53E3
server.port=7060 server.port=7060
#验证码后台模式,默认为1:1为不开启,2为开启,3为输错 用户名或密码 ${maxLoginErrorCount} 次 才开启 #\u9A8C\u8BC1\u7801\u540E\u53F0\u6A21\u5F0F\uFF0C\u9ED8\u8BA4\u4E3A1\uFF1A1\u4E3A\u4E0D\u5F00\u542F\uFF0C2\u4E3A\u5F00\u542F\uFF0C3\u4E3A\u8F93\u9519 \u7528\u6237\u540D\u6216\u5BC6\u7801 ${maxLoginErrorCount} \u6B21 \u624D\u5F00\u542F
verifyCodeMode=3 verifyCodeMode=3
#仅当验证码模式 ${verifyCodeMode} 为 3时生效,设置错误登录出现验证码的阈值,默认为3 #\u4EC5\u5F53\u9A8C\u8BC1\u7801\u6A21\u5F0F ${verifyCodeMode} \u4E3A 3\u65F6\u751F\u6548\uFF0C\u8BBE\u7F6E\u9519\u8BEF\u767B\u5F55\u51FA\u73B0\u9A8C\u8BC1\u7801\u7684\u9608\u503C\uFF0C\u9ED8\u8BA4\u4E3A3
maxLoginErrorCount=3 maxLoginErrorCount=3
#密码Base64加密开关,true为开启,false为关闭 #\u5BC6\u7801Base64\u52A0\u5BC6\u5F00\u5173,true\u4E3A\u5F00\u542F,false\u4E3A\u5173\u95ED
isPassEncrypted=true isPassEncrypted=true
#{ #{
#"password": "YWJjMTIz", #"password": "YWJjMTIz",
#"username": "YWRtaW4x" #"username": "YWRtaW4x"
#} #}
#swagger 显示api,1为只显示${restPath:/api}前缀的api,0为显示所有api,其他为不显示api #swagger \u663E\u793Aapi\uFF0C1\u4E3A\u53EA\u663E\u793A${restPath:/api}\u524D\u7F00\u7684api,0\u4E3A\u663E\u793A\u6240\u6709api\uFF0C\u5176\u4ED6\u4E3A\u4E0D\u663E\u793Aapi
swaggerLevel=0 swaggerLevel=0
@@ -61,12 +61,13 @@ swaggerLevel=0
# #
#picPath=/EPR/file/home/pic/ #picPath=/EPR/file/home/pic/
# 本地存储文件的磁盘地址 # \u672C\u5730\u5B58\u50A8\u6587\u4EF6\u7684\u78C1\u76D8\u5730\u5740
uploadFile=D:\\work\\idea\\changan\\ #uploadFile=D:\\work\\idea\\changan\\
# 本地文件访问的url地址 #uploadFile=D:\\uploadfile\\tmp\\
uploadFile=/data/DeploymentPackage/report_library/uploadfile/
# \u672C\u5730\u6587\u4EF6\u8BBF\u95EE\u7684url\u5730\u5740
picPath=/api/home/pic/ picPath=/api/home/pic/
serverIp=http://127.0.0.1:7060/ serverIp=http://127.0.0.1:7060/
@@ -86,50 +87,52 @@ MAIL_POP_PORT=110
#MAIL_USERNAME=64459@Any3.com #MAIL_USERNAME=64459@Any3.com
#MAIL_PASSWORD=65316975Xiaoq #MAIL_PASSWORD=65316975Xiaoq
IPANDPORT=http://localhost:7061/ # \u4FEE\u6539\u6210\u540E\u7AEF\u670D\u52A1\u5668\u5730\u5740
IPANDPORT=http://localhost:7060/
#redis #redis
#Redis服务器地址 #Redis\u670D\u52A1\u5668\u5730\u5740
spring.redis.host=192.168.144.29 spring.redis.host=10.10.10.44
#spring.redis.host=localhost ## Redis\u670D\u52A1\u5668\u8FDE\u63A5\u7AEF\u53E3
## Redis服务器连接端口
spring.redis.port=6379 spring.redis.port=6379
## Redis服务器连接密码(默认为空) ## Redis\u670D\u52A1\u5668\u8FDE\u63A5\u5BC6\u7801\uFF08\u9ED8\u8BA4\u4E3A\u7A7A\uFF09
spring.redis.password=123321 spring.redis.password=123456
## 连接超时时间(毫秒) ## \u8FDE\u63A5\u8D85\u65F6\u65F6\u95F4\uFF08\u6BEB\u79D2\uFF09
spring.redis.timeout=200000ms spring.redis.timeout=200000ms
## 连接池中的最大空闲连接,默认值是8。 ## \u8FDE\u63A5\u6C60\u4E2D\u7684\u6700\u5927\u7A7A\u95F2\u8FDE\u63A5\uFF0C\u9ED8\u8BA4\u503C\u662F8\u3002
spring.redis.jedis.pool.max-idle=50 spring.redis.jedis.pool.max-idle=50
##连接池中的最小空闲连接,默认值是0。 ##\u8FDE\u63A5\u6C60\u4E2D\u7684\u6700\u5C0F\u7A7A\u95F2\u8FDE\u63A5\uFF0C\u9ED8\u8BA4\u503C\u662F0\u3002
spring.redis.jedis.pool.min-idle=10 spring.redis.jedis.pool.min-idle=10
## 如果赋值为-1,则表示不限制;如果pool已经分配了maxActive个jedis实例,则此时pool的状态为exhausted(耗尽)。 ## \u5982\u679C\u8D4B\u503C\u4E3A-1\uFF0C\u5219\u8868\u793A\u4E0D\u9650\u5236\uFF1B\u5982\u679Cpool\u5DF2\u7ECF\u5206\u914D\u4E86maxActive\u4E2Ajedis\u5B9E\u4F8B\uFF0C\u5219\u6B64\u65F6pool\u7684\u72B6\u6001\u4E3Aexhausted(\u8017\u5C3D)\u3002
spring.redis.jedis.pool.max-active=2000 spring.redis.jedis.pool.max-active=2000
## 等待可用连接的最大时间,单位毫秒,默认值为-1,表示永不超时。如果超过等待时间,则直接抛出JedisConnectionException ## \u7B49\u5F85\u53EF\u7528\u8FDE\u63A5\u7684\u6700\u5927\u65F6\u95F4\uFF0C\u5355\u4F4D\u6BEB\u79D2\uFF0C\u9ED8\u8BA4\u503C\u4E3A-1\uFF0C\u8868\u793A\u6C38\u4E0D\u8D85\u65F6\u3002\u5982\u679C\u8D85\u8FC7\u7B49\u5F85\u65F6\u95F4\uFF0C\u5219\u76F4\u63A5\u629B\u51FAJedisConnectionException
spring.redis.jedis.pool.max-wait=2000ms spring.redis.jedis.pool.max-wait=2000ms
spring.redis.database=6 spring.redis.database=2
# 上传方式:阿里云:alioss 华为云:hwobs # \u4E0A\u4F20\u65B9\u5F0F\uFF1A\u963F\u91CC\u4E91\uFF1Aalioss \u534E\u4E3A\u4E91\uFF1Ahwobs \u672C\u5730\uFF1Alocal
uploadType: hwobs uploadType: hwobs
# ======= 阿里OSS配置 ========= # \u672C\u5730\u6587\u4EF6\u5B58\u50A8\u5730\u5740
localFilePath=D:\\uploadfile\\
# ======= \u963F\u91CCOSS\u914D\u7F6E =========
aliyun.OSS.endpoint=https://oss-cn-hangzhou.aliyuncs.com aliyun.OSS.endpoint=https://oss-cn-hangzhou.aliyuncs.com
aliyun.OSS.accessKeyId= LTAI5tBmUfVF6Z8R6sHTdTG7 aliyun.OSS.accessKeyId= LTAI5tBmUfVF6Z8R6sHTdTG7
aliyun.OSS.accessKeySecret= mY6UvWv20Tg2R46ORe6uV5gL6TQloC aliyun.OSS.accessKeySecret= mY6UvWv20Tg2R46ORe6uV5gL6TQloC
aliyun.OSS.bucketName=qqxexamplebucket aliyun.OSS.bucketName=qqxexamplebucket
aliyun.OSS.fileMaxSize=10 #文件上传最大M数 aliyun.OSS.fileMaxSize=10 #\u6587\u4EF6\u4E0A\u4F20\u6700\u5927M\u6570
# ======= 华为OBS配置 ========= # ======= \u534E\u4E3AOBS\u914D\u7F6E =========
huawei.OBS.endPoint=https://obs.cn-north-4.myhuaweicloud.com huawei.OBS.endPoint=https://obs.cn-north-4.myhuaweicloud.com
huawei.OBS.accessKey=EEMAGYTHP9KKPF18TZCL huawei.OBS.accessKey=EEMAGYTHP9KKPF18TZCL
huawei.OBS.secretKey=3NmFNf1uX3EV1LbCEzgw6gDv0tZ6WAVwG37BGq1p huawei.OBS.secretKey=3NmFNf1uX3EV1LbCEzgw6gDv0tZ6WAVwG37BGq1p
huawei.OBS.bucketName=gcpa huawei.OBS.bucketName=gcpa
huawei.OBS.fileMaxSize=10 #文件上传最大M数 huawei.OBS.fileMaxSize=10 #\u6587\u4EF6\u4E0A\u4F20\u6700\u5927M\u6570
logging.level.com.adc: debug logging.level.com.adc: debug
# ==== IAM???? # ==== IAM????
iam.url=https://iamuat.faw-vw.com/ iam.url=https://iamuat.faw-vw.com/
iam.appkey=xxxx iam.appkey=xxxx
iam.appSecret=xxx iam.appSecret=xxx
@@ -18,7 +18,7 @@
#spring.datasource.password = adc_forecast #spring.datasource.password = adc_forecast
#kylin数据库 ds1 #kylin\u6570\u636E\u5E93 ds1
#spring.datasource.kylin.name=PROJECT_MI #spring.datasource.kylin.name=PROJECT_MI
#spring.datasource.kylin.driverClassName=org.apache.kylin.jdbc.Driver #spring.datasource.kylin.driverClassName=org.apache.kylin.jdbc.Driver
#spring.datasource.kylin.url=jdbc:kylin://10.64.23.8:7070/PROJECT_MI #spring.datasource.kylin.url=jdbc:kylin://10.64.23.8:7070/PROJECT_MI
@@ -28,7 +28,7 @@
#spring.datasource.kylin.maxWaitTime=10000 #spring.datasource.kylin.maxWaitTime=10000
#spring.datasource.kylin.poolSize=10 #spring.datasource.kylin.poolSize=10
# #
##mysql数据库 ds2 ##mysql\u6570\u636E\u5E93 ds2
#spring.datasource.mysql.driverClassName = com.mysql.jdbc.Driver #spring.datasource.mysql.driverClassName = com.mysql.jdbc.Driver
#spring.datasource.mysql.url = jdbc:mysql://192.168.144.80:3306/cadata?characterEncoding=utf-8&&zeroDateTimeBehavior=convertToNull #spring.datasource.mysql.url = jdbc:mysql://192.168.144.80:3306/cadata?characterEncoding=utf-8&&zeroDateTimeBehavior=convertToNull
#spring.datasource.mysql.username = root #spring.datasource.mysql.username = root
@@ -39,21 +39,21 @@ spring.datasource.url = jdbc:mysql://121.36.69.172:3307/report-library?character
spring.datasource.username = root spring.datasource.username = root
spring.datasource.password = hzwlsoft.com spring.datasource.password = hzwlsoft.com
#后端端口 #\u540E\u7AEF\u7AEF\u53E3
server.port=7060 server.port=7060
#验证码后台模式,默认为1:1为不开启,2为开启,3为输错 用户名或密码 ${maxLoginErrorCount} 次 才开启 #\u9A8C\u8BC1\u7801\u540E\u53F0\u6A21\u5F0F\uFF0C\u9ED8\u8BA4\u4E3A1\uFF1A1\u4E3A\u4E0D\u5F00\u542F\uFF0C2\u4E3A\u5F00\u542F\uFF0C3\u4E3A\u8F93\u9519 \u7528\u6237\u540D\u6216\u5BC6\u7801 ${maxLoginErrorCount} \u6B21 \u624D\u5F00\u542F
verifyCodeMode=3 verifyCodeMode=3
#仅当验证码模式 ${verifyCodeMode} 为 3时生效,设置错误登录出现验证码的阈值,默认为3 #\u4EC5\u5F53\u9A8C\u8BC1\u7801\u6A21\u5F0F ${verifyCodeMode} \u4E3A 3\u65F6\u751F\u6548\uFF0C\u8BBE\u7F6E\u9519\u8BEF\u767B\u5F55\u51FA\u73B0\u9A8C\u8BC1\u7801\u7684\u9608\u503C\uFF0C\u9ED8\u8BA4\u4E3A3
maxLoginErrorCount=3 maxLoginErrorCount=3
#密码Base64加密开关,true为开启,false为关闭 #\u5BC6\u7801Base64\u52A0\u5BC6\u5F00\u5173,true\u4E3A\u5F00\u542F,false\u4E3A\u5173\u95ED
isPassEncrypted=true isPassEncrypted=true
#{ #{
#"password": "YWJjMTIz", #"password": "YWJjMTIz",
#"username": "YWRtaW4x" #"username": "YWRtaW4x"
#} #}
#swagger 显示api,1为只显示${restPath:/api}前缀的api,0为显示所有api,其他为不显示api #swagger \u663E\u793Aapi\uFF0C1\u4E3A\u53EA\u663E\u793A${restPath:/api}\u524D\u7F00\u7684api,0\u4E3A\u663E\u793A\u6240\u6709api\uFF0C\u5176\u4ED6\u4E3A\u4E0D\u663E\u793Aapi
swaggerLevel=0 swaggerLevel=0
@@ -61,9 +61,14 @@ swaggerLevel=0
# #
#picPath=/EPR/file/home/pic/ #picPath=/EPR/file/home/pic/
# 本地存储文件的磁盘地址 # \u672C\u5730\u6587\u4EF6\u5B58\u50A8\u8DEF\u5F84\u65B9\u5F0F jar\u5305\u8DEF\u5F84\uFF1Ajar \u5DE5\u4F5C\u76EE\u5F55\uFF1Auserdir \u56FA\u5B9A\u76EE\u5F55\uFF1Asettled
uploadFile=D:\\work\\idea\\changan\\ localSaveFileType=settled
# 本地文件访问的url地址 #localSaveFileType=userdir
# \u672C\u5730\u5B58\u50A8\u6587\u4EF6\u7684\u78C1\u76D8\u5730\u5740
#uploadFile=D:\\work\\idea\\changan\\
uploadFile=/data/DeploymentPackage/report_library/uploadfile
# \u672C\u5730\u6587\u4EF6\u8BBF\u95EE\u7684url\u5730\u5740
picPath=/api/home/pic/ picPath=/api/home/pic/
@@ -89,42 +94,42 @@ MAIL_POP_PORT=110
IPANDPORT=http://localhost:7061/ IPANDPORT=http://localhost:7061/
#redis #redis
#Redis服务器地址 #Redis\u670D\u52A1\u5668\u5730\u5740
spring.redis.host=192.168.144.29 spring.redis.host=192.168.144.29
#spring.redis.host=localhost #spring.redis.host=localhost
## Redis服务器连接端口 ## Redis\u670D\u52A1\u5668\u8FDE\u63A5\u7AEF\u53E3
spring.redis.port=6379 spring.redis.port=6379
## Redis服务器连接密码(默认为空) ## Redis\u670D\u52A1\u5668\u8FDE\u63A5\u5BC6\u7801\uFF08\u9ED8\u8BA4\u4E3A\u7A7A\uFF09
spring.redis.password=123321 spring.redis.password=123321
## 连接超时时间(毫秒) ## \u8FDE\u63A5\u8D85\u65F6\u65F6\u95F4\uFF08\u6BEB\u79D2\uFF09
spring.redis.timeout=200000ms spring.redis.timeout=200000ms
## 连接池中的最大空闲连接,默认值是8。 ## \u8FDE\u63A5\u6C60\u4E2D\u7684\u6700\u5927\u7A7A\u95F2\u8FDE\u63A5\uFF0C\u9ED8\u8BA4\u503C\u662F8\u3002
spring.redis.jedis.pool.max-idle=50 spring.redis.jedis.pool.max-idle=50
##连接池中的最小空闲连接,默认值是0。 ##\u8FDE\u63A5\u6C60\u4E2D\u7684\u6700\u5C0F\u7A7A\u95F2\u8FDE\u63A5\uFF0C\u9ED8\u8BA4\u503C\u662F0\u3002
spring.redis.jedis.pool.min-idle=10 spring.redis.jedis.pool.min-idle=10
## 如果赋值为-1,则表示不限制;如果pool已经分配了maxActive个jedis实例,则此时pool的状态为exhausted(耗尽)。 ## \u5982\u679C\u8D4B\u503C\u4E3A-1\uFF0C\u5219\u8868\u793A\u4E0D\u9650\u5236\uFF1B\u5982\u679Cpool\u5DF2\u7ECF\u5206\u914D\u4E86maxActive\u4E2Ajedis\u5B9E\u4F8B\uFF0C\u5219\u6B64\u65F6pool\u7684\u72B6\u6001\u4E3Aexhausted(\u8017\u5C3D)\u3002
spring.redis.jedis.pool.max-active=2000 spring.redis.jedis.pool.max-active=2000
## 等待可用连接的最大时间,单位毫秒,默认值为-1,表示永不超时。如果超过等待时间,则直接抛出JedisConnectionException ## \u7B49\u5F85\u53EF\u7528\u8FDE\u63A5\u7684\u6700\u5927\u65F6\u95F4\uFF0C\u5355\u4F4D\u6BEB\u79D2\uFF0C\u9ED8\u8BA4\u503C\u4E3A-1\uFF0C\u8868\u793A\u6C38\u4E0D\u8D85\u65F6\u3002\u5982\u679C\u8D85\u8FC7\u7B49\u5F85\u65F6\u95F4\uFF0C\u5219\u76F4\u63A5\u629B\u51FAJedisConnectionException
spring.redis.jedis.pool.max-wait=2000ms spring.redis.jedis.pool.max-wait=2000ms
spring.redis.database=6 spring.redis.database=6
# 上传方式:阿里云:alioss 华为云:hwobs # \u4E0A\u4F20\u65B9\u5F0F\uFF1A\u963F\u91CC\u4E91\uFF1Aalioss \u534E\u4E3A\u4E91\uFF1Ahwobs \u672C\u5730\uFF1Alocal
uploadType: hwobs uploadType: hwobs
# ======= 阿里OSS配置 ========= # ======= \u963F\u91CCOSS\u914D\u7F6E =========
aliyun.OSS.endpoint=https://oss-cn-hangzhou.aliyuncs.com aliyun.OSS.endpoint=https://oss-cn-hangzhou.aliyuncs.com
aliyun.OSS.accessKeyId= LTAI5tBmUfVF6Z8R6sHTdTG7 aliyun.OSS.accessKeyId= LTAI5tBmUfVF6Z8R6sHTdTG7
aliyun.OSS.accessKeySecret= mY6UvWv20Tg2R46ORe6uV5gL6TQloC aliyun.OSS.accessKeySecret= mY6UvWv20Tg2R46ORe6uV5gL6TQloC
aliyun.OSS.bucketName=qqxexamplebucket aliyun.OSS.bucketName=qqxexamplebucket
aliyun.OSS.fileMaxSize=10 #文件上传最大M数 aliyun.OSS.fileMaxSize=10 #\u6587\u4EF6\u4E0A\u4F20\u6700\u5927M\u6570
# ======= 华为OBS配置 ========= # ======= \u534E\u4E3AOBS\u914D\u7F6E =========
huawei.OBS.endPoint=https://obs.cn-north-4.myhuaweicloud.com huawei.OBS.endPoint=https://obs.cn-north-4.myhuaweicloud.com
huawei.OBS.accessKey=EEMAGYTHP9KKPF18TZCL huawei.OBS.accessKey=EEMAGYTHP9KKPF18TZCL
huawei.OBS.secretKey=3NmFNf1uX3EV1LbCEzgw6gDv0tZ6WAVwG37BGq1p huawei.OBS.secretKey=3NmFNf1uX3EV1LbCEzgw6gDv0tZ6WAVwG37BGq1p
huawei.OBS.bucketName=gcpa huawei.OBS.bucketName=gcpa
huawei.OBS.fileMaxSize=10 #文件上传最大M数 huawei.OBS.fileMaxSize=10 #\u6587\u4EF6\u4E0A\u4F20\u6700\u5927M\u6570
logging.level.com.adc: debug logging.level.com.adc: debug
-1
View File
@@ -118,7 +118,6 @@
<artifactId>spring-boot-starter-data-redis</artifactId> <artifactId>spring-boot-starter-data-redis</artifactId>
</dependency> </dependency>
</dependencies> </dependencies>
@@ -2,8 +2,10 @@ package com.adc.da.report.controller;
import com.adc.da.report.eo.PowerApply; import com.adc.da.report.eo.PowerApply;
import com.adc.da.report.service.IPowerApplyActService;
import com.adc.da.report.service.IPowerApplyService; import com.adc.da.report.service.IPowerApplyService;
import com.adc.da.report.vo.DeleteParamRequestVO; import com.adc.da.report.vo.DeleteParamRequestVO;
import com.adc.da.report.vo.PowerApplyActPageVO;
import com.adc.da.report.vo.PowerApplyPageVO; import com.adc.da.report.vo.PowerApplyPageVO;
import com.adc.da.util.http.ResponseMessage; import com.adc.da.util.http.ResponseMessage;
import com.adc.da.util.http.Result; import com.adc.da.util.http.Result;
@@ -32,6 +34,9 @@ public class PowerApplyController {
@Autowired @Autowired
private IPowerApplyService powerApplyService; private IPowerApplyService powerApplyService;
@Autowired
private IPowerApplyActService iPowerApplyActService;
/** /**
* @param powerApplyPageVO * @param powerApplyPageVO
* @return com.adc.da.util.http.ResponseMessage * @return com.adc.da.util.http.ResponseMessage
@@ -107,7 +112,7 @@ public class PowerApplyController {
* @date 2023-04-23 * @date 2023-04-23
* @description 根据id或id数组进行删除 * @description 根据id或id数组进行删除
*/ */
@DeleteMapping("/delete") @PostMapping("/delete")
@ApiOperation(value = "单条/批量删除数据") @ApiOperation(value = "单条/批量删除数据")
public ResponseMessage delete(@RequestBody DeleteParamRequestVO deleteParamRequestVO){ public ResponseMessage delete(@RequestBody DeleteParamRequestVO deleteParamRequestVO){
@@ -115,4 +120,20 @@ public class PowerApplyController {
powerApplyService.deleteById(deleteParamRequestVO); powerApplyService.deleteById(deleteParamRequestVO);
return Result.success(); return Result.success();
} }
/**
* @param deleteParamRequestVO
* @return com.adc.da.util.http.ResponseMessage
* @author bu
* @date 2023-04-23
* @description 根据id或id数组进行删除
*/
@PostMapping("/deleteAct")
@ApiOperation(value = "单条/批量删除数据")
public ResponseMessage deleteAct(@RequestBody PowerApplyActPageVO powerApplyActPageVO){
//单条/批量删除数据
iPowerApplyActService.deleteByListPower(powerApplyActPageVO);
return Result.success();
}
} }
@@ -1,10 +1,12 @@
package com.adc.da.report.controller; package com.adc.da.report.controller;
import com.adc.da.report.annotation.ReportLog; import com.adc.da.report.annotation.ReportLog;
import com.adc.da.report.dao.mysql.ReportDao;
import com.adc.da.report.eo.FileEntity; import com.adc.da.report.eo.FileEntity;
import com.adc.da.report.eo.ReportEntity; import com.adc.da.report.eo.ReportEntity;
import com.adc.da.report.service.IFileService; import com.adc.da.report.service.IFileService;
import com.adc.da.report.service.IReportService; import com.adc.da.report.service.IReportService;
import com.adc.da.report.util.LocalFileUtil;
import com.adc.da.report.util.OSSClientUtil; import com.adc.da.report.util.OSSClientUtil;
import com.adc.da.report.util.ObsBootUtil; import com.adc.da.report.util.ObsBootUtil;
import com.adc.da.report.vo.ReportQueryVo; import com.adc.da.report.vo.ReportQueryVo;
@@ -26,6 +28,7 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.*; import java.io.*;
import java.net.URISyntaxException;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
@@ -62,9 +65,14 @@ public class ReportManageConroller {
@Autowired @Autowired
private ObsBootUtil obsBootUtil; private ObsBootUtil obsBootUtil;
@Autowired
private LocalFileUtil localFileUtil;
@Value("${uploadType}") @Value("${uploadType}")
private String uploadType; private String uploadType;
@Autowired
private ReportDao reportDao;
/** /**
* 新增或编辑报告 * 新增或编辑报告
@@ -74,15 +82,37 @@ public class ReportManageConroller {
@ApiOperation("新增或编辑报告") @ApiOperation("新增或编辑报告")
@PostMapping("/add") @PostMapping("/add")
@ReportLog(description = "新增或编辑") @ReportLog(description = "新增或编辑")
public ResponseMessage add(@RequestBody ReportVo vo) { public ResponseMessage add(@RequestBody ReportVo vo) throws IOException {
Map<String, Object> map = new HashMap<>();
ReportEntity entity = new ReportEntity(); ReportEntity entity = new ReportEntity();
BeanUtils.copyProperties(vo, entity); BeanUtils.copyProperties(vo, entity);
/**
* 名称不能重复
*/
long count = reportDao.selectByidAndName(entity);
if (count>0){
return Result.error("报告名称已存在");
}
String name = reportService.insert(entity, vo.getLabelList()); String name = reportService.insert(entity, vo.getLabelList());
Map<String, Object> map = new HashMap<>();
map.put("reportName", name); map.put("reportName", name);
return Result.success(map); return Result.success(map);
} }
/**
* 报告管理列表
* @param vo
* @return
* @throws Exception
*/
@ApiOperation("报告管理列表")
@PostMapping("/reportManagerPage")
public ResponseMessage reportManagerPage(@RequestBody ReportQueryVo vo) throws Exception {
IPage<ReportVo> list = reportService.reportManagerPage(vo);
return Result.success(list);
}
/** /**
* 报告列表 * 报告列表
* @param vo * @param vo
@@ -90,22 +120,9 @@ public class ReportManageConroller {
* @throws Exception * @throws Exception
*/ */
@ApiOperation("报告列表") @ApiOperation("报告列表")
@PostMapping("/list") @PostMapping("/page")
public ResponseMessage list(@RequestBody ReportQueryVo vo) throws Exception { public ResponseMessage page(@RequestBody ReportQueryVo vo) throws Exception {
IPage<ReportVo> list = reportService.list(vo); IPage<ReportVo> list = reportService.page(vo);
return Result.success(list);
}
/**
* 报告列表(带权限验证)
* @param vo
* @return
* @throws Exception
*/
@ApiOperation("报告列表(带权限)")
@PostMapping("/list-auth")
public ResponseMessage listWithAuth(@RequestBody ReportQueryVo vo) throws Exception {
IPage<ReportVo> list = reportService.list(vo);
return Result.success(list); return Result.success(list);
} }
@@ -161,7 +178,17 @@ public class ReportManageConroller {
stringRedisTemplate.boundValueOps("1121212").set("1212"); stringRedisTemplate.boundValueOps("1121212").set("1212");
} }
@ApiOperation("testPath")
@GetMapping("/testPath")
@Deprecated
public ResponseMessage testPath() throws URISyntaxException {
HashMap<String, String> pathMap = new HashMap<>();
String jarPath = new File(getClass().getProtectionDomain().getCodeSource().getLocation().toURI().getPath()).getParentFile().getPath();
String property = System.getProperty("user.dir");
pathMap.put("jarpath", jarPath);
pathMap.put("propertyPath", property);
return Result.success(pathMap);
}
/** /**
* 上传文件 * 上传文件
@@ -196,10 +223,12 @@ public class ReportManageConroller {
try{ try{
String result=""; String result="";
// 上传方式:阿里云:alioss 华为云:hwobs // 上传方式:阿里云:alioss 华为云:hwobs
if (uploadType.equals("hwobs")){ if ("hwobs".equals(uploadType)){
result = obsBootUtil.upload(file, fileName); result = obsBootUtil.upload(file, fileName);
}else if (uploadType.equals("alioss")){ }else if ("alioss".equals(uploadType)) {
result = ossClientUtil.uploadFile2OSS(file.getInputStream(),fileName); result = ossClientUtil.uploadFile2OSS(file.getInputStream(),fileName);
}else if ("local".equals(uploadType)) {
localFileUtil.saveFile(file.getInputStream(), fileName);
} }
resultMap.put("key", date + num); resultMap.put("key", date + num);
resultMap.put("value", path + "//" + fileName); resultMap.put("value", path + "//" + fileName);
@@ -311,10 +340,12 @@ public class ReportManageConroller {
response.setContentType("application/x-download"); response.setContentType("application/x-download");
// File file = new File(uploadFile, entity.getSavePath()); // File file = new File(uploadFile, entity.getSavePath());
// 上传方式:阿里云:alioss 华为云:hwobs // 上传方式:阿里云:alioss 华为云:hwobs
if (uploadType.equals("hwobs")){ if ("hwobs".equals(uploadType)){
obsBootUtil.downFile(entity.getSavePath(), response); obsBootUtil.downFile(entity.getSavePath(), response);
}else if (uploadType.equals("alioss")){ }else if ("alioss".equals(uploadType)){
ossClientUtil.downloadFileFromOSS(entity.getSavePath(),response); ossClientUtil.downloadFileFromOSS(entity.getSavePath(),response);
}else if ("local".equals(uploadType)){
localFileUtil.downFile(entity.getSavePath(), response);
} }
} catch (Exception ex) { } catch (Exception ex) {
@@ -335,4 +366,16 @@ public class ReportManageConroller {
return Result.success(reportVoIPage); return Result.success(reportVoIPage);
} }
/**
* 判断报告是否在流程中
* @return
* @throws ParseException
*/
@ApiOperation("判断报告是否在流程中")
@PostMapping("/isAct")
public ResponseMessage isAct(@RequestBody ReportQueryVo vo) throws Exception {
List<String> act = reportService.isAct(vo);
return Result.success(act);
}
} }
@@ -0,0 +1,116 @@
package com.adc.da.report.controller;
import com.adc.da.report.eo.TtReportManageAct;
import com.adc.da.report.service.impl.ITtReportManageActServiceImpl;
import com.adc.da.report.vo.DeleteParamRequestVO;
import com.adc.da.report.vo.TtReportManageActPageVO;
import com.adc.da.util.http.ResponseMessage;
import com.adc.da.util.http.Result;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @author bu
* @version 1.0
* @description 前端控制器
* @date 2023-05-04
*/
@Slf4j
@RestController
@RequestMapping("/${restPath}/report/ttReportManageAct")
@Api(tags = "report|")
public class TtReportManageActController {
@Autowired
private ITtReportManageActServiceImpl ttReportManageActService;
/**
* @param ttReportManageActPageVO
* @return com.adc.da.util.http.ResponseMessage
* @author bu
* @date 2023-05-04
* @description 分页查询
*/
@PostMapping(value = "/page")
@ApiOperation(value = "分页查询")
@ApiImplicitParam(name = "ttReportManageActPageVO", value = "查询条件VO", dataType = "TtReportManageActPageVO")
public ResponseMessage<Page<TtReportManageAct>> page(@RequestBody TtReportManageActPageVO ttReportManageActPageVO){
//分页查询
Page<TtReportManageAct> ttReportManageActIPage = ttReportManageActService.selectPage(ttReportManageActPageVO);
return Result.success(ttReportManageActIPage);
}
/**
* @param ttReportManageActPageVO
* @return com.adc.da.util.http.ResponseMessage
* @author bu
* @date 2023-05-04
* @description 列表查询
*/
@PostMapping("/list")
@ApiOperation(value = "列表查询")
@ApiImplicitParam(name = "ttReportManageActPageVO", value = "查询条件VO", dataType = "TtReportManageActPageVO")
public ResponseMessage<List<TtReportManageAct>> list(@RequestBody TtReportManageActPageVO ttReportManageActPageVO) {
//列表查询
List<TtReportManageAct> ttReportManageActList = ttReportManageActService.selectList(ttReportManageActPageVO);
return Result.success(ttReportManageActList);
}
/**
* @param id
* @return com.adc.da.util.http.ResponseMessage
* @author bu
* @date 2023-05-04
* @description 根据id查询
*/
@GetMapping("/info/{id}")
@ApiOperation(value = "根据id查询")
@ApiImplicitParam(name = "id", value = "主键ID", dataType = "String")
public ResponseMessage<TtReportManageAct> info(@PathVariable("id") String id){
//根据id查询
TtReportManageAct ttReportManageAct = ttReportManageActService.selectById(id);
return Result.success(ttReportManageAct);
}
/**
* @param ttReportManageAct
* @return com.adc.da.util.http.ResponseMessage
* @author bu
* @date 2023-05-04
* @description 单条数据新增/更改
*/
@PostMapping("/saveOrUpdate")
@ApiOperation(value = "单条数据新增/更改")
@ApiImplicitParam(name = "ttReportManageAct", value = " TtReportManageAct实体", dataType = "TtReportManageAct")
public ResponseMessage<String> saveOrUpdate(@RequestBody TtReportManageAct ttReportManageAct){
//单条数据新增/更改
ttReportManageActService.saveOrUpdateSingle(ttReportManageAct);
return Result.success(ttReportManageAct.getId());
}
/**
* @param deleteParamRequestVO
* @return com.adc.da.util.http.ResponseMessage
* @author bu
* @date 2023-05-04
* @description 根据id或id数组进行删除
*/
@DeleteMapping("/delete")
@ApiOperation(value = "单条/批量删除数据")
public ResponseMessage delete(@RequestBody DeleteParamRequestVO deleteParamRequestVO){
//单条/批量删除数据
ttReportManageActService.deleteById(deleteParamRequestVO);
return Result.success();
}
}
@@ -46,4 +46,10 @@ public interface PowerApplyActDao extends BaseMapper<PowerApplyAct> {
int batchInsert(@Param("list")List<PowerApplyAct> powerApplyActs); int batchInsert(@Param("list")List<PowerApplyAct> powerApplyActs);
List<PowerApplyActPageVO> selectListBydataId(@Param("dataId")String dataId); List<PowerApplyActPageVO> selectListBydataId(@Param("dataId")String dataId);
List<PowerApplyActPageVO> selectListBydataIdNodel(@Param("dataId")String dataId);
List<PowerApplyAct> selectActListBydataId(@Param("dataId")String dataId);
int batchDel(@Param("ids") List<String> ids);
} }
@@ -0,0 +1,18 @@
package com.adc.da.report.dao.mysql;
import com.adc.da.report.eo.ReportContentEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @author ThinkBook
* @description 针对表【ts_report_content】的数据库操作Mapper
* @createDate 2023-04-27 11:48:22
* @Entity com.adc.da.report.eo.ReportContentEntity
*/
public interface ReportContentDao extends BaseMapper<ReportContentEntity> {
}
@@ -1,6 +1,7 @@
package com.adc.da.report.dao.mysql; package com.adc.da.report.dao.mysql;
import com.adc.da.report.eo.ReportEntity; import com.adc.da.report.eo.ReportEntity;
import com.adc.da.report.eo.TtReportManageAct;
import com.adc.da.report.vo.ReportQueryVo; import com.adc.da.report.vo.ReportQueryVo;
import com.adc.da.report.vo.ReportVo; import com.adc.da.report.vo.ReportVo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
@@ -24,14 +25,41 @@ public interface ReportDao extends BaseMapper<ReportEntity> {
* @param idSet * @param idSet
* @return * @return
*/ */
IPage<ReportVo> list(IPage page, @Param("Vo") ReportQueryVo vo, @Param("idSet") Set<String> idSet); IPage<ReportVo> list(IPage<ReportEntity> page, @Param("Vo") ReportQueryVo vo, @Param("idSet") Set<String> idSet);
/** /**
* 报告日期列表 * 报告日期列表
*
* @param usid * @param usid
* @return * @return
*/ */
List<String> getReportDateList(@Param("usid")String usid); List<String> getReportDateList(@Param("usid") String usid);
IPage<ReportVo> getAddReportPage(IPage<ReportEntity> page, @Param("pageVO") ReportQueryVo vo); IPage<ReportVo> getAddReportPage(IPage<ReportEntity> page, @Param("pageVO") ReportQueryVo vo);
/**
* 报告列表
*
* @param page
* @param vo
* @param idSet
* @return
*/
IPage<ReportVo> page(IPage<ReportEntity> page, @Param("pageVO") ReportQueryVo vo, @Param("idSet") Set<String> idSet);
/**
* 报告列表
*
* @param page
* @param vo
* @param idSet
* @return
*/
IPage<ReportVo> reportManagerPage(IPage<ReportEntity> page, @Param("Vo") ReportQueryVo vo, @Param("idSet") Set<String> idSet);
List<String> isAct(@Param("Vo") ReportQueryVo vo);
long selectByidAndName(@Param("Vo")ReportEntity entity);
void saveReportAct(@Param("Vo") TtReportManageAct ttReportManageAct);
} }
@@ -0,0 +1,48 @@
package com.adc.da.report.dao.mysql;
import com.adc.da.report.eo.TtReportManageAct;
import com.adc.da.report.vo.TtReportManageActPageVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @author bu
* @version 1.0
* @description Mapper接口
* @date 2023-05-04
*/
public interface TtReportManageActDao extends BaseMapper<TtReportManageAct> {
/**
* @param ttReportManageActPageVO
* @param page
* @author bu
* @date 2023-05-04
* @description 使用分页插件进行查询
*/
List<TtReportManageAct> selectPage(Page<TtReportManageAct> page, @Param("pageVO") TtReportManageActPageVO ttReportManageActPageVO);
/**
* @param ttReportManageActPageVO
* @param page
* @author bu
* @date 2023-05-04
* @description 使用分页插件进行查询总数
*/
Long selectPageCount(@Param("pageVO") TtReportManageActPageVO ttReportManageActPageVO);
/**
* @param ttReportManageActPageVO
* @return java.util.List
* @author bu
* @date 2023-05-04
* @description 列表查询
*/
List<TtReportManageAct> queryList(@Param("pageVO") TtReportManageActPageVO ttReportManageActPageVO);
TtReportManageActPageVO selectByDataId(String dataId);
}
@@ -0,0 +1,46 @@
package com.adc.da.report.eo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
/**
*
* @author Caihaohan
* @TableName ts_report_content
*/
@TableName(value ="ts_report_content")
@Data
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
public class ReportContentEntity implements Serializable {
/**
* 主键id
*/
@TableId(value = "id",type = IdType.INPUT)
private String id;
/**
* 报告id
*/
@TableField(value = "report_id")
private String reportId;
/**
* 文件内容
*/
@TableField(value = "report_content")
private String reportContent;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
}
@@ -0,0 +1,122 @@
package com.adc.da.report.eo;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* @author bu
* @version 1.0
* @description
* @date 2023-05-04
*/
@Data
@TableName("tt_report_manage_act")
public class TtReportManageAct {
@TableField(exist = false)
private String id;
/**
* 任务id
*/
@TableField("task_id")
private String taskId;
/**
* 流程id
*/
@TableField("prc_id")
private String prcId;
/**
* 数据id
*/
@TableField("data_id")
private String dataId;
/**
* 报告名
*/
@TableField("name")
private String name;
/**
* 关键字
*/
@TableField("keycontent")
private String keyContent;
/**
* 主要内容
*/
@TableField("maincontent")
private String mainContent;
/**
* 部门
*/
@TableField("department")
private String department;
/**
* 年
*/
@TableField("year")
private String year;
/**
* 报告涉密等级
*/
@TableField("confidentialLevel")
private String confidentialLevel;
/**
* 隐私等级
*/
@TableField("privacyLevel")
private String privacyLevel;
/**
* 文件id
*/
@TableField("fileId")
private String fileId;
/**
*
*/
private String createUserId;
/**
*
*/
private Date createDate;
/**
*
*/
private Date updateDate = new Date();
/**
*
*/
@TableField("del_flag")
private Integer delFlag;
/**
* 创建人id
*/
@TableField("update_user_id")
private String updateUserId;
/**
* 权限设置
*/
private List<PowerApplyAct> powerList;
}
@@ -1,7 +1,6 @@
package com.adc.da.report.service; package com.adc.da.report.service;
import com.adc.da.report.eo.PowerApplyAct; import com.adc.da.report.eo.PowerApplyAct;
import com.adc.da.report.vo.DeleteParamRequestVO;
import com.adc.da.report.vo.PowerApplyActPageVO; import com.adc.da.report.vo.PowerApplyActPageVO;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -48,11 +47,11 @@ public interface IPowerApplyActService {
/** /**
* @param deleteParamVO * @param powerApplyActPageVO
* @return void * @return void
* @author bu * @author bu
* @date 2023-04-23 * @date 2023-04-23
* @description 根据id或id数组进行删除 * @description 根据id或id数组进行删除
*/ */
public void deleteById(DeleteParamRequestVO deleteParamVO); public void deleteByListPower(PowerApplyActPageVO powerApplyActPageVO);
} }
@@ -1,6 +1,7 @@
package com.adc.da.report.service; package com.adc.da.report.service;
import com.adc.da.report.eo.PowerApply; import com.adc.da.report.eo.PowerApply;
import com.adc.da.report.eo.PowerApplyAct;
import com.adc.da.report.vo.DeleteParamRequestVO; import com.adc.da.report.vo.DeleteParamRequestVO;
import com.adc.da.report.vo.PowerApplyPageVO; import com.adc.da.report.vo.PowerApplyPageVO;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -55,4 +56,6 @@ public interface IPowerApplyService {
* @description 根据id或id数组进行删除 * @description 根据id或id数组进行删除
*/ */
public void deleteById(DeleteParamRequestVO deleteParamVO); public void deleteById(DeleteParamRequestVO deleteParamVO);
void saveBatch(List<PowerApplyAct> powerApplyActs);
} }
@@ -0,0 +1,24 @@
package com.adc.da.report.service;
import com.adc.da.report.eo.ReportContentEntity;
import com.baomidou.mybatisplus.extension.service.IService;
import java.io.FileNotFoundException;
import java.io.IOException;
/**
* @author ThinkBook
* @description 针对表【ts_report_content】的数据库操作Service
* @createDate 2023-04-27 11:48:22
*/
public interface IReportContentService extends IService<ReportContentEntity> {
/**
* 插入报告内容表
*
* @param reportId 报告id
* @param fileId 文件id
*/
void insertReportContent(String reportId, String fileId) throws IOException;
}
@@ -5,6 +5,7 @@ import com.adc.da.report.vo.ReportQueryVo;
import com.adc.da.report.vo.ReportVo; import com.adc.da.report.vo.ReportVo;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import java.io.IOException;
import java.util.List; import java.util.List;
/** /**
@@ -20,14 +21,7 @@ public interface IReportService {
* @param labelList * @param labelList
* @return 报告名称 * @return 报告名称
*/ */
String insert(ReportEntity entity, List<String> labelList); String insert(ReportEntity entity, List<String> labelList) throws IOException;
/**
* 报告列表展示
* @param vo
* @return
*/
IPage<ReportVo> list(ReportQueryVo vo) throws Exception;
/** /**
* 删除报告 * 删除报告
@@ -49,4 +43,10 @@ public interface IReportService {
String reportHtml(String id); String reportHtml(String id);
IPage<ReportVo> addReportPage(ReportQueryVo vo) throws Exception; IPage<ReportVo> addReportPage(ReportQueryVo vo) throws Exception;
IPage<ReportVo> page(ReportQueryVo vo);
IPage<ReportVo> reportManagerPage(ReportQueryVo vo);
List<String> isAct(ReportQueryVo vo);
} }
@@ -0,0 +1,23 @@
package com.adc.da.report.service;
import com.adc.da.report.eo.TtReportManageAct;
import com.adc.da.report.vo.DeleteParamRequestVO;
import com.adc.da.report.vo.TtReportManageActPageVO;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.List;
public interface ITtReportManageActService {
Page<TtReportManageAct> selectPage(TtReportManageActPageVO ttReportManageActPageVO);
List<TtReportManageAct> selectList(TtReportManageActPageVO ttReportManageActPageVO);
TtReportManageAct selectById(String id);
void saveOrUpdateSingle(TtReportManageAct ttReportManageAct);
void deleteById(DeleteParamRequestVO deleteParamVO);
void saveReport(TtReportManageAct ttReportManageAct);
}
@@ -0,0 +1,82 @@
package com.adc.da.report.service.impl;
import com.adc.da.report.dao.mysql.FileDao;
import com.adc.da.report.eo.FileEntity;
import com.adc.da.report.util.FileContentUtil;
import com.adc.da.report.util.LocalFileUtil;
import com.adc.da.report.util.OSSClientUtil;
import com.adc.da.report.util.ObsBootUtil;
import com.adc.da.util.utils.FileUtil;
import com.adc.da.util.utils.UUID;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.adc.da.report.eo.ReportContentEntity;
import com.adc.da.report.service.IReportContentService;
import com.adc.da.report.dao.mysql.ReportContentDao;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
/**
* @author Caihaohan
* @description 针对表【ts_report_content】的数据库操作Service实现
* @createDate 2023-04-27 11:48:22
*/
@Service
@Slf4j
public class IReportContentServiceImpl extends ServiceImpl<ReportContentDao, ReportContentEntity>
implements IReportContentService {
@Value("${uploadFile}")
private String uploadFile;
@Value("${uploadType}")
private String uploadType;
@Resource
private OSSClientUtil ossClientUtil;
@Resource
private ObsBootUtil obsBootUtil;
@Resource
private LocalFileUtil localFileUtil;
@Resource
private FileDao fileDao;
@Override
@Transactional(rollbackFor = Exception.class)
public void insertReportContent(String reportId, String fileId) throws IOException {
//获取文件
FileEntity fileEntity = fileDao.selectById(fileId);
String path = uploadFile + fileEntity.getSavePath();
FileOutputStream outputStream = new FileOutputStream(path);
// 上传方式:阿里云:alioss 华为云:hwobs
if ("hwobs".equals(uploadType)) {
obsBootUtil.getFileFromOBS(fileEntity.getSavePath(), outputStream);
} else if ("alioss".equals(uploadType)) {
ossClientUtil.getFileFromOSS(fileEntity.getSavePath(), outputStream);
} else if ("local".equals(uploadType)) {
localFileUtil.getFileFromLocal(fileEntity.getSavePath(), outputStream);
}
File file = new File(path);
//解析出内容
String content = FileContentUtil.readFileContent(file);
//将内容存入
ReportContentEntity reportContentEntity = new ReportContentEntity(UUID.randomUUID10(), reportId, content);
save(reportContentEntity);
//将文件删除
FileUtil.deleteFile(path);
}
}
@@ -11,6 +11,7 @@ import com.adc.da.report.eo.FileEntity;
import com.adc.da.report.eo.ReportEntity; import com.adc.da.report.eo.ReportEntity;
import com.adc.da.report.eo.ReportLabelEntity; import com.adc.da.report.eo.ReportLabelEntity;
import com.adc.da.report.eo.ReportUserEntity; import com.adc.da.report.eo.ReportUserEntity;
import com.adc.da.report.service.IReportContentService;
import com.adc.da.report.service.IReportLabelService; import com.adc.da.report.service.IReportLabelService;
import com.adc.da.report.service.IReportService; import com.adc.da.report.service.IReportService;
import com.adc.da.report.service.ITreeLabelService; import com.adc.da.report.service.ITreeLabelService;
@@ -37,6 +38,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@@ -90,6 +92,12 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
@Autowired @Autowired
private RoleEODao roleEODao; private RoleEODao roleEODao;
@Resource
private IReportContentService iReportContentService;
@Autowired
private LocalFileUtil localFileUtil;
/** /**
* 新增或编辑报告 * 新增或编辑报告
* *
@@ -99,13 +107,13 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public String insert(ReportEntity entity, List<String> labelList) { public String insert(ReportEntity entity, List<String> labelList) throws IOException {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
if (StringUtils.isEmpty(entity.getId())) { if (StringUtils.isEmpty(entity.getId())) {
entity.setId(UUID.randomUUID10()); entity.setId(UUID.randomUUID10());
entity.setCreateDate(format.format(new Date())); entity.setCreateDate(format.format(new Date()));
entity.setCreateUserId(CommonUtils.getUserId()); entity.setCreateUserId(UserUtils.getUserId());
entity.setDelFlag("0"); entity.setDelFlag("0");
entity.setUpdateDate(format.format(new Date())); entity.setUpdateDate(format.format(new Date()));
reportDao.insert(entity); reportDao.insert(entity);
@@ -124,6 +132,9 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
reportLabelDao.insert(reportLabelEntity); reportLabelDao.insert(reportLabelEntity);
}); });
//插入报表内容表
iReportContentService.insertReportContent(entity.getId() ,entity.getFileId());
CommonUtils.threadPoolExecutor().execute(() -> { CommonUtils.threadPoolExecutor().execute(() -> {
//生成html //生成html
try { try {
@@ -185,85 +196,6 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
return entity.getName(); return entity.getName();
} }
/**
* 报告列表
*
* @param vo
* @return
* @throws Exception
*/
@Override
public IPage<ReportVo> list(ReportQueryVo vo) throws Exception {
IPage<ReportEntity> page = new Page<>();
page.setCurrent(vo.getPageNo());
page.setSize(vo.getPageSize());
//判断是不是管理员
boolean admin = CommonUtils.isAdmin();
if (admin) {
vo.setUsid(null);
} else {
vo.setUsid(CommonUtils.getUserId());
}
//按照labelId筛选
Set<String> idSet = new HashSet<>();
if (Objects.nonNull(vo.getLabelId()) && !vo.getLabelId().isEmpty()) {
LambdaQueryWrapper<ReportLabelEntity> reportLabelEntityWrapper = new LambdaQueryWrapper<>();
reportLabelEntityWrapper.eq(ReportLabelEntity::getLabelId, vo.getLabelId().get(vo.getLabelId().size() - 1));
List<ReportLabelEntity> reportLabelEntities = reportLabelDao.selectList(reportLabelEntityWrapper);
reportLabelEntities.forEach(reportLabelEntity -> {
idSet.add(reportLabelEntity.getReportId());
});
}
// TODO ES模糊查询
IPage<ReportVo> list = reportDao.list(page, vo, idSet);
//获取所有报告的labelId
list.getRecords().forEach((reportVo) -> {
reportVo.setLabelList(findLabelList(reportVo.getId()));
});
list.getRecords().forEach(c -> {
FileEntity fileEntity = Optional.ofNullable(fileDao.selectById(c.getFileId())).orElse(new FileEntity());
if (StringUtils.isEmpty(fileEntity.getFileType())) {
c.setFileType(null);
}
//ppt文件
else if (ReportConstants.FILE_EXTENSIONS_PPT.equalsIgnoreCase(fileEntity.getFileType()) ||
ReportConstants.FILE_EXTENSIONS_PPTX.equalsIgnoreCase(fileEntity.getFileType())) {
c.setFileType("1");
}
//excel文件
else if (ReportConstants.FILE_EXTENSIONS_XLS.equalsIgnoreCase(fileEntity.getFileType()) ||
ReportConstants.FILE_EXTENSIONS_XLSX.equalsIgnoreCase(fileEntity.getFileType())) {
c.setFileType("2");
}
//pdf文件
else if (ReportConstants.FILE_EXTENSIONS_PDF.equalsIgnoreCase(fileEntity.getFileType())) {
c.setFileType("3");
}
//word文件
else {
c.setFileType("4");
}
//文件大小
c.setFileSize(StringUtils.isNotEmpty(fileEntity.getFileSize())
? String.valueOf(Integer.parseInt(fileEntity.getFileSize()) / 1024) + "kb" : "0kb");
c.setFileName(fileEntity.getFileName());
List<String> userIdList = reportUserDao.selectList(
new QueryWrapper<ReportUserEntity>().eq("reportId", c.getId()))
.stream().map(ReportUserEntity::getUserId).collect(Collectors.toList());
c.setReportUserIdList(userIdList);
});
return list;
}
/** /**
* 找出报告的所有标签中最长的那条路径 * 找出报告的所有标签中最长的那条路径
* *
@@ -283,6 +215,9 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
labelList = labelList.stream() labelList = labelList.stream()
.sorted(Comparator.comparingInt(List<String>::size).reversed()) .sorted(Comparator.comparingInt(List<String>::size).reversed())
.collect(Collectors.toList()); .collect(Collectors.toList());
if (labelList.size() == 0){
return null;
}
return labelList.get(0); return labelList.get(0);
} }
@@ -372,6 +307,173 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
return list; return list;
} }
@Override
public IPage<ReportVo> page(ReportQueryVo vo) {
IPage<ReportEntity> page = new Page<>();
page.setCurrent(vo.getPageNo());
page.setSize(vo.getPageSize());
//判断是不是管理员
boolean admin = false;
List<RoleEO> roleEOList = roleEODao.selectByuserId(UserUtils.getUserId());
for (RoleEO roleEO : roleEOList) {
if ("管理员".equals(roleEO.getName())){
admin= !admin;
}
}
if (admin) {
vo.setUsid(null);
} else {
vo.setUsid(UserUtils.getUserId());
}
//按照labelId筛选
Set<String> idSet = new HashSet<>();
if (Objects.nonNull(vo.getLabelId()) && !vo.getLabelId().isEmpty()) {
LambdaQueryWrapper<ReportLabelEntity> reportLabelEntityWrapper = new LambdaQueryWrapper<>();
reportLabelEntityWrapper.in(ReportLabelEntity::getLabelId, vo.getLabelId());
List<ReportLabelEntity> reportLabelEntities = reportLabelDao.selectList(reportLabelEntityWrapper);
reportLabelEntities.forEach(reportLabelEntity -> {
idSet.add(reportLabelEntity.getReportId());
});
idSet.add("1");
}
IPage<ReportVo> list = reportDao.page(page, vo,idSet);
//获取所有报告的labelId
list.getRecords().forEach((reportVo) -> {
reportVo.setLabelList(findLabelList(reportVo.getId()));
});
list.getRecords().forEach(c -> {
FileEntity fileEntity = Optional.ofNullable(fileDao.selectById(c.getFileId())).orElse(new FileEntity());
if (StringUtils.isEmpty(fileEntity.getFileType())) {
c.setFileType(null);
}
//ppt文件
else if (ReportConstants.FILE_EXTENSIONS_PPT.equalsIgnoreCase(fileEntity.getFileType()) ||
ReportConstants.FILE_EXTENSIONS_PPTX.equalsIgnoreCase(fileEntity.getFileType())) {
c.setFileType("1");
}
//excel文件
else if (ReportConstants.FILE_EXTENSIONS_XLS.equalsIgnoreCase(fileEntity.getFileType()) ||
ReportConstants.FILE_EXTENSIONS_XLSX.equalsIgnoreCase(fileEntity.getFileType())) {
c.setFileType("2");
}
//pdf文件
else if (ReportConstants.FILE_EXTENSIONS_PDF.equalsIgnoreCase(fileEntity.getFileType())) {
c.setFileType("3");
}
//word文件
else {
c.setFileType("4");
}
//文件大小
c.setFileSize(StringUtils.isNotEmpty(fileEntity.getFileSize())
? String.valueOf(Integer.parseInt(fileEntity.getFileSize()) / 1024) + "kb" : "0kb");
c.setFileName(fileEntity.getFileName());
List<String> userIdList = reportUserDao.selectList(
new QueryWrapper<ReportUserEntity>().eq("reportId", c.getId()))
.stream().map(ReportUserEntity::getUserId).collect(Collectors.toList());
c.setReportUserIdList(userIdList);
});
return list;
}
@Override
public IPage<ReportVo> reportManagerPage(ReportQueryVo vo) {
IPage<ReportEntity> page = new Page<>();
page.setCurrent(vo.getPageNo());
page.setSize(vo.getPageSize());
//判断是不是管理员
boolean admin = false;
List<RoleEO> roleEOList = roleEODao.selectByuserId(UserUtils.getUserId());
for (RoleEO roleEO : roleEOList) {
if ("管理员".equals(roleEO.getName())){
admin= !admin;
}
}
if (admin) {
vo.setUsid(null);
} else {
vo.setUsid(UserUtils.getUserId());
}
//按照labelId筛选
Set<String> idSet = new HashSet<>();
if (Objects.nonNull(vo.getLabelId()) && !vo.getLabelId().isEmpty()) {
LambdaQueryWrapper<ReportLabelEntity> reportLabelEntityWrapper = new LambdaQueryWrapper<>();
reportLabelEntityWrapper.in(ReportLabelEntity::getLabelId, vo.getLabelId());
List<ReportLabelEntity> reportLabelEntities = reportLabelDao.selectList(reportLabelEntityWrapper);
reportLabelEntities.forEach(reportLabelEntity -> {
idSet.add(reportLabelEntity.getReportId());
});
idSet.add("1");
}
IPage<ReportVo> list = reportDao.reportManagerPage(page, vo, idSet);
//获取所有报告的labelId
list.getRecords().forEach((reportVo) -> {
reportVo.setLabelList(findLabelList(reportVo.getId()));
});
list.getRecords().forEach(c -> {
FileEntity fileEntity = Optional.ofNullable(fileDao.selectById(c.getFileId())).orElse(new FileEntity());
if (StringUtils.isEmpty(fileEntity.getFileType())) {
c.setFileType(null);
}
//ppt文件
else if (ReportConstants.FILE_EXTENSIONS_PPT.equalsIgnoreCase(fileEntity.getFileType()) ||
ReportConstants.FILE_EXTENSIONS_PPTX.equalsIgnoreCase(fileEntity.getFileType())) {
c.setFileType("1");
}
//excel文件
else if (ReportConstants.FILE_EXTENSIONS_XLS.equalsIgnoreCase(fileEntity.getFileType()) ||
ReportConstants.FILE_EXTENSIONS_XLSX.equalsIgnoreCase(fileEntity.getFileType())) {
c.setFileType("2");
}
//pdf文件
else if (ReportConstants.FILE_EXTENSIONS_PDF.equalsIgnoreCase(fileEntity.getFileType())) {
c.setFileType("3");
}
//word文件
else {
c.setFileType("4");
}
//文件大小
c.setFileSize(StringUtils.isNotEmpty(fileEntity.getFileSize())
? String.valueOf(Integer.parseInt(fileEntity.getFileSize()) / 1024) + "kb" : "0kb");
c.setFileName(fileEntity.getFileName());
List<String> userIdList = reportUserDao.selectList(
new QueryWrapper<ReportUserEntity>().eq("reportId", c.getId()))
.stream().map(ReportUserEntity::getUserId).collect(Collectors.toList());
c.setReportUserIdList(userIdList);
});
return list;
}
@Override
public List<String> isAct(ReportQueryVo vo) {
boolean flag = false;
//判断是不是管理员
boolean admin = false;
List<RoleEO> roleEOList = roleEODao.selectByuserId(UserUtils.getUserId());
for (RoleEO roleEO : roleEOList) {
if ("管理员".equals(roleEO.getName())){
admin= !admin;
}
}
if (admin) {
vo.setUsid(null);
} else {
vo.setUsid(UserUtils.getUserId());
}
List<String> act = baseMapper.isAct(vo);
return act;
}
/** /**
* 创建htmlstring * 创建htmlstring
* *
@@ -384,44 +486,30 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
String path = uploadFile + fileEntity.getSavePath(); String path = uploadFile + fileEntity.getSavePath();
FileOutputStream outputStream = new FileOutputStream(path); FileOutputStream outputStream = new FileOutputStream(path);
// 上传方式:阿里云:alioss 华为云:hwobs // 上传方式:阿里云:alioss 华为云:hwobs
if (uploadType.equals("hwobs")) { if ("hwobs".equals(uploadType)) {
obsBootUtil.getFileFromOBS(fileEntity.getSavePath(), outputStream); obsBootUtil.getFileFromOBS(fileEntity.getSavePath(), outputStream);
} else if (uploadType.equals("alioss")) { } else if ("alioss".equals(uploadType)) {
ossClientUtil.getFileFromOSS(fileEntity.getSavePath(), outputStream); ossClientUtil.getFileFromOSS(fileEntity.getSavePath(), outputStream);
} else if ("local".equals(uploadType)) {
localFileUtil.getFileFromLocal(fileEntity.getSavePath(), outputStream);
} }
String html = null; String html = null;
switch (fileEntity.getFileType()) {
//03excel if (ReportConstants.FILE_EXTENSIONS_XLS.equalsIgnoreCase(fileEntity.getFileType())) {
case "xls": html = ExcelUtil.excel03Html(new FileInputStream(path));
html = ExcelUtil.excel03Html(new FileInputStream(path)); } else if (ReportConstants.FILE_EXTENSIONS_XLSX.equalsIgnoreCase(fileEntity.getFileType())) {
break; html = ExcelUtil.excel07Html(new FileInputStream(path));
//07excel } else if (ReportConstants.FILE_EXTENSIONS_DOC.equalsIgnoreCase(fileEntity.getFileType())) {
case "xlsx": html = WordUtil.doc2pdf(new FileInputStream(path), uploadFile, ipAddress);
html = ExcelUtil.excel07Html(new FileInputStream(path)); } else if (ReportConstants.FILE_EXTENSIONS_DOCX.equalsIgnoreCase(fileEntity.getFileType())) {
break; html = WordUtil.doc2pdf(new FileInputStream(path), uploadFile, ipAddress);
//03word } else if (ReportConstants.FILE_EXTENSIONS_PPT.equalsIgnoreCase(fileEntity.getFileType())) {
case "doc": html = PptUtil.doPpt2003toImage(new FileInputStream(path), uploadFile, ipAddress);
html = WordUtil.doc2pdf(new FileInputStream(path), uploadFile, ipAddress); } else if (ReportConstants.FILE_EXTENSIONS_PPTX.equalsIgnoreCase(fileEntity.getFileType())) {
break; html = PptUtil.doPpt2007toImage(new FileInputStream(path), uploadFile, ipAddress);
//07word } else if (ReportConstants.FILE_EXTENSIONS_PDF.equalsIgnoreCase(fileEntity.getFileType())) {
case "docx": html = PdfUtil.pdfStreamToPng(new FileInputStream(path), uploadFile, ipAddress);
html = WordUtil.doc2pdf(new FileInputStream(path), uploadFile, ipAddress);
break;
//03ppt
case "ppt":
html = PptUtil.doPpt2003toImage(new FileInputStream(path), uploadFile, ipAddress);
break;
//07ppt
case "pptx":
html = PptUtil.doPpt2007toImage(new FileInputStream(path), uploadFile, ipAddress);
break;
//pdf
case "pdf":
html = PdfUtil.pdfStreamToPng(new FileInputStream(path), uploadFile, ipAddress);
break;
default:
break;
} }
FileUtil.deleteFile(path); FileUtil.deleteFile(path);
return html; return html;
@@ -0,0 +1,130 @@
package com.adc.da.report.service.impl;
import com.adc.da.report.dao.mysql.PowerApplyDao;
import com.adc.da.report.dao.mysql.ReportDao;
import com.adc.da.report.dao.mysql.TtReportManageActDao;
import com.adc.da.report.eo.PowerApplyAct;
import com.adc.da.report.eo.TtReportManageAct;
import com.adc.da.report.service.ITtReportManageActService;
import com.adc.da.report.vo.DeleteParamRequestVO;
import com.adc.da.report.vo.TtReportManageActPageVO;
import com.adc.da.util.utils.StringUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import java.util.ArrayList;
import java.util.List;
/**
* @author bu
* @version 1.0
* @description 服务实现类
* @date 2023-05-04
*/
@Slf4j
@Service
public class ITtReportManageActServiceImpl extends ServiceImpl<TtReportManageActDao, TtReportManageAct> implements ITtReportManageActService {
@Autowired
ReportDao reportDao;
@Autowired
PowerApplyDao powerApplyDao;
/**
* @param ttReportManageActPageVO
* @return <com.adc.da.report.entity.TtReportManageAct>
* @author bu
* @date 2023-05-04
* @description 分页查询
*/
public Page<TtReportManageAct> selectPage(TtReportManageActPageVO ttReportManageActPageVO){
Page<TtReportManageAct> page = new Page<>(ttReportManageActPageVO.getCurrent(),
ttReportManageActPageVO.getSize());
page.setRecords(baseMapper.selectPage(page, ttReportManageActPageVO));
Long total = baseMapper.selectPageCount(ttReportManageActPageVO);
page.setTotal(total);
return page;
}
/**
* @param ttReportManageActPageVO
* @return java.util.List<com.adc.da.report.entity.TtReportManageAct>
* @author bu
* @date 2023-05-04
* @description 列表查询
*/
public List<TtReportManageAct> selectList(TtReportManageActPageVO ttReportManageActPageVO) {
return baseMapper.queryList(ttReportManageActPageVO);
}
/**
* @param id
* @return com.adc.da.report.entity.TtReportManageAct
* @author bu
* @date 2023-05-04
* @description 根据id查询
*/
public TtReportManageAct selectById(String id) {
return baseMapper.selectById(id);
}
/**
* @param ttReportManageAct
* @return boolean
* @author bu
* @date 2023-05-04
* @description 单条数据新增/更改
*/
public void saveOrUpdateSingle(TtReportManageAct ttReportManageAct) {
if (StringUtils.isEmpty(ttReportManageAct.getId())) {
baseMapper.insert(ttReportManageAct);
} else {
baseMapper.updateById(ttReportManageAct);
}
}
/**
* @param deleteParamVO
* @return void
* @author bu
* @date 2023-05-04
* @description 根据id或id数组进行删除
*/
public void deleteById(DeleteParamRequestVO deleteParamVO) {
if (ObjectUtils.isEmpty(deleteParamVO)) {
return;
}
List<String> ids = new ArrayList<>();
if (!ObjectUtils.isEmpty(deleteParamVO.getId())) {
ids.add(deleteParamVO.getId());
}
if (!ObjectUtils.isEmpty(deleteParamVO.getIds())) {
ids.addAll(deleteParamVO.getIds());
}
if (ObjectUtils.isEmpty(deleteParamVO)) {
return;
}
QueryWrapper<TtReportManageAct> wrapper = new QueryWrapper();
wrapper.in("id",ids);
TtReportManageAct ttReportManageAct = new TtReportManageAct();
ttReportManageAct.setDelFlag(1);
baseMapper.update(ttReportManageAct,wrapper);
}
@Override
public void saveReport(TtReportManageAct ttReportManageAct) {
//保存报告
reportDao.saveReportAct(ttReportManageAct);
//保存报告权限数据
List<PowerApplyAct> powerList = ttReportManageAct.getPowerList();
powerApplyDao.saveBatch(powerList);
}
}
@@ -4,7 +4,6 @@ package com.adc.da.report.service.impl;
import com.adc.da.report.dao.mysql.PowerApplyActDao; import com.adc.da.report.dao.mysql.PowerApplyActDao;
import com.adc.da.report.eo.PowerApplyAct; import com.adc.da.report.eo.PowerApplyAct;
import com.adc.da.report.service.IPowerApplyActService; import com.adc.da.report.service.IPowerApplyActService;
import com.adc.da.report.vo.DeleteParamRequestVO;
import com.adc.da.report.vo.PowerApplyActPageVO; import com.adc.da.report.vo.PowerApplyActPageVO;
import com.adc.da.util.utils.StringUtils; import com.adc.da.util.utils.StringUtils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -12,9 +11,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
@@ -81,32 +78,21 @@ public class IpowerApplyActServiceImpl extends ServiceImpl<PowerApplyActDao, Pow
} }
/** /**
* @param deleteParamVO * @param powerApplyActPageVO
* @return void * @return void
* @author bu * @author bu
* @date 2023-04-23 * @date 2023-04-23
* @description 根据id或id数组进行删除 * @description 根据id或id数组进行删除
*/ */
public void deleteById(DeleteParamRequestVO deleteParamVO) { public void deleteByListPower(PowerApplyActPageVO powerApplyActPageVO) {
if (ObjectUtils.isEmpty(deleteParamVO)) { List<PowerApplyAct> powerApplyList = powerApplyActPageVO.getPowerApplyList();
return; for (PowerApplyAct powerApplyAct : powerApplyList) {
} LambdaQueryWrapper<PowerApplyAct> wrapper = new LambdaQueryWrapper<>();
List<String> ids = new ArrayList<>(); wrapper.eq(PowerApplyAct::getPrcId,powerApplyAct.getPrcId());
wrapper.eq(PowerApplyAct::getReportId,powerApplyAct.getReportId());
if (!ObjectUtils.isEmpty(deleteParamVO.getId())) { powerApplyAct.setDelFlag(1);
ids.add(deleteParamVO.getId()); baseMapper.update(powerApplyAct,wrapper);
} }
if (!ObjectUtils.isEmpty(deleteParamVO.getIds())) {
ids.addAll(deleteParamVO.getIds());
}
if (ObjectUtils.isEmpty(deleteParamVO)) {
return;
}
LambdaQueryWrapper<PowerApplyAct> wrapper = new LambdaQueryWrapper<>();
wrapper.in(PowerApplyAct::getId,ids);
PowerApplyAct powerApplyAct = new PowerApplyAct();
powerApplyAct.setDelFlag(1);
baseMapper.update(powerApplyAct,wrapper);
} }
@@ -1,8 +1,10 @@
package com.adc.da.report.service.impl; package com.adc.da.report.service.impl;
import com.adc.da.report.dao.mysql.PowerApplyActDao;
import com.adc.da.report.dao.mysql.PowerApplyDao; import com.adc.da.report.dao.mysql.PowerApplyDao;
import com.adc.da.report.eo.PowerApply; import com.adc.da.report.eo.PowerApply;
import com.adc.da.report.eo.PowerApplyAct;
import com.adc.da.report.service.IPowerApplyService; import com.adc.da.report.service.IPowerApplyService;
import com.adc.da.report.vo.DeleteParamRequestVO; import com.adc.da.report.vo.DeleteParamRequestVO;
import com.adc.da.report.vo.PowerApplyPageVO; import com.adc.da.report.vo.PowerApplyPageVO;
@@ -11,11 +13,13 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
/** /**
* @author bu * @author bu
@@ -27,6 +31,10 @@ import java.util.List;
@Service @Service
public class IpowerApplyServiceImpl extends ServiceImpl<PowerApplyDao, PowerApply> implements IPowerApplyService { public class IpowerApplyServiceImpl extends ServiceImpl<PowerApplyDao, PowerApply> implements IPowerApplyService {
@Autowired
private PowerApplyActDao powerApplyActDao;
/** /**
* @param powerApplyPageVO * @param powerApplyPageVO
* @return <com.adc.da.report.entity.PowerApply> * @return <com.adc.da.report.entity.PowerApply>
@@ -109,5 +117,12 @@ public class IpowerApplyServiceImpl extends ServiceImpl<PowerApplyDao, PowerAppl
baseMapper.update(powerApply,wrapper); baseMapper.update(powerApply,wrapper);
} }
@Override
public void saveBatch(List<PowerApplyAct> powerApplyActs) {
baseMapper.saveBatch(powerApplyActs);
List<String> ids = powerApplyActs.stream().map(a -> a.getId()).collect(Collectors.toList());
powerApplyActDao.batchDel(ids);
}
} }
@@ -0,0 +1,86 @@
package com.adc.da.report.util;
import com.adc.da.util.exception.AdcDaBaseException;
import com.obs.services.exception.ObsException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.nio.file.Files;
import java.nio.file.Paths;
/**
* @author Caihaohan
*/
@Slf4j
@Component
public class LocalFileUtil {
@Value("${uploadFile}")
private String uploadFile;
@Value("${localFilePath}")
private String localFilePath;
public void saveFile(InputStream fileInputStream, String fileName) throws IOException {
String path = localFilePath + fileName;
FileOutputStream fileOutputStream = new FileOutputStream(path);
byte[] buffer = new byte[1024];
int length;
while ((length = fileInputStream.read(buffer)) > 0) {
fileOutputStream.write(buffer, 0, length);
}
fileInputStream.close();
fileOutputStream.close();
}
public void getFileFromLocal(String savePath, FileOutputStream outputStream) throws IOException {
// 创建源文件对象
File sourceFile = new File(localFilePath, savePath);
// 如果源文件不存在,则抛出异常
if (!sourceFile.exists()) {
throw new IOException("Source file does not exist.");
}
// 创建输入流
FileInputStream inputStream = new FileInputStream(sourceFile);
// 创建缓冲区
byte[] buffer = new byte[1024];
int bytesRead;
// 从输入流读取数据,并写入输出流
while ((bytesRead = inputStream.read(buffer)) != -1) {
outputStream.write(buffer, 0, bytesRead);
}
// 关闭输入流和输出流
inputStream.close();
outputStream.close();
}
public void downFile(String savePath, HttpServletResponse response) throws IOException {
String filePath = uploadFile + savePath;
//复制到本地
FileOutputStream fileOutputStream = new FileOutputStream(filePath);
getFileFromLocal(savePath, fileOutputStream);
//将文件写到response中
try (InputStream objectContent = Files.newInputStream(Paths.get(filePath))) {
byte[] bt = new byte[1024 * 1024];
int len = 0;
while ((len = objectContent.read(bt)) != -1) {
response.getOutputStream().write(bt, 0, len);
}
} catch (ObsException | IOException oe) {
throw new AdcDaBaseException("获取本地文件失败");
} finally {
// 数据读取完成后,获取的流必须关闭,否则会造成连接泄漏,导致请求无连接可用,程序无法正常工作。
response.getOutputStream().close();
}
}
}
@@ -0,0 +1,72 @@
package com.adc.da.report.util;
import java.util.ArrayList;
import java.util.List;
/**
* 分页工具类
*
* @author 程序员小强
*/
public class PageUtils {
/**
* 默认第一页
*/
private static final int PAGE = 1;
/**
* 默认一页10条
*/
private static final int PAGE_SIZE = 10;
public static Integer getStartRow(Integer pageNo, Integer pageSize) {
if (null == pageNo) {
pageNo = PAGE;
}
if (null == pageSize) {
pageSize = PAGE_SIZE;
}
return pageSize * (pageNo - 1);
}
public static Integer getOffset(Integer pageSize) {
if (null == pageSize) {
pageSize = PAGE_SIZE;
}
return pageSize;
}
/**
* list分页
*
* @param list
* @param pageNo
* @param pageSize
*/
public static <T> List<T> listPage(List<T> list, Integer pageNo, Integer pageSize) {
if (null == list || list.isEmpty()) {
return list;
}
if (null == pageNo) {
pageNo = PAGE;
}
if (null == pageSize) {
pageSize = PAGE_SIZE;
}
int totalCount = list.size();
pageNo = pageNo - 1;
int fromIndex = pageNo * pageSize;
if (fromIndex > totalCount) {
return new ArrayList<>(0);
}
int toIndex = ((pageNo + 1) * pageSize);
if (toIndex > totalCount) {
toIndex = totalCount;
}
return list.subList(fromIndex, toIndex);
}
}
@@ -4,6 +4,8 @@ import com.adc.da.util.utils.UUID;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.rendering.PDFRenderer; import org.apache.pdfbox.rendering.PDFRenderer;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import sun.misc.BASE64Encoder; import sun.misc.BASE64Encoder;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
@@ -14,28 +16,37 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
@Slf4j @Slf4j
@Component
public class PdfUtil { public class PdfUtil {
private PdfUtil(){ private static String uploadType;
throw new IllegalStateException("Utility class");
@Value("${uploadType}")
public void setUploadType(String uploadType) {
PdfUtil.uploadType = uploadType;
}
private PdfUtil() {
} }
/** /**
* 截取pdf成图片 * 截取pdf成图片
*
* @param inputStream * @param inputStream
* @param targetPath * @param targetPath
* @param ipAddress * @param ipAddress
* @return * @return
*/ */
public static String pdfStreamToPng( InputStream inputStream,String targetPath,String ipAddress) { public static String pdfStreamToPng(InputStream inputStream, String targetPath, String ipAddress) {
try(PDDocument doc=PDDocument.load( inputStream)) { try (PDDocument doc = PDDocument.load(inputStream)) {
PDFRenderer renderer = new PDFRenderer(doc); PDFRenderer renderer = new PDFRenderer(doc);
List<String> list=new ArrayList<>(); List<String> list = new ArrayList<>();
int pageCount = doc.getNumberOfPages(); int pageCount = doc.getNumberOfPages();
BufferedImage image = null; BufferedImage image = null;
log.info("开始时间"+System.currentTimeMillis()); log.info("开始时间" + System.currentTimeMillis());
String fileName = UUID.randomUUID10(); String fileName = UUID.randomUUID10();
for (int i = 0; i < pageCount; i++) { for (int i = 0; i < pageCount; i++) {
image = renderer.renderImage(i, 2.0f); image = renderer.renderImage(i, 2.0f);
@@ -46,32 +57,31 @@ public class PdfUtil {
imOut = ImageIO.createImageOutputStream(bs); imOut = ImageIO.createImageOutputStream(bs);
ImageIO.write(image, "png", imOut); ImageIO.write(image, "png", imOut);
try(ByteArrayInputStream byteInputStream = new ByteArrayInputStream(bs.toByteArray());){ try (ByteArrayInputStream byteInputStream = new ByteArrayInputStream(bs.toByteArray());) {
File ff=new File(targetPath+"/"+fileName); File ff = new File(targetPath + "/" + fileName);
if(!ff.exists()){ if (!ff.exists()) {
ff.mkdirs(); ff.mkdirs();
} }
File uploadFile = new File(targetPath+"/"+fileName+"/"+i+".png"); File uploadFile = new File(targetPath + "/" + fileName + "/" + i + ".png");
try(FileOutputStream fops = new FileOutputStream(uploadFile);){ try (FileOutputStream fops = new FileOutputStream(uploadFile);) {
fops.write(readInputStream(byteInputStream)); fops.write(readInputStream(byteInputStream));
} } catch (Exception e) {
catch (Exception e){ log.error(e.getMessage(), e);
log.error(e.getMessage(),e);
} }
list.add(ipAddress+"api/home/pic"+"/"+fileName+"/"+i+".png"); list.add(ipAddress + "api/home/pic" + "/" + fileName + "/" + i + ".png");
}
catch (Exception e){ } catch (Exception e) {
} }
} }
log.info("结束时间"+System.currentTimeMillis()); log.info("结束时间" + System.currentTimeMillis());
String htmlByBase64 = createHtmlByImg(list); String htmlByBase64 = createHtmlByImg(list);
return htmlByBase64; return htmlByBase64;
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(),e); log.error(e.getMessage(), e);
return ""; return "";
} }
} }
@@ -88,15 +98,15 @@ public class PdfUtil {
buffer.append("<style>\r\n"); buffer.append("<style>\r\n");
buffer.append(".preview-img {background-color:#fff; text-align:center; width:100%; max-width:100%;margin-top:6px;}\r\n"); buffer.append(".preview-img {background-color:#fff; text-align:center; width:100%; max-width:100%;margin-top:6px;}\r\n");
buffer.append("</style>\r\n"); buffer.append("</style>\r\n");
for(int i=0;i<baseList.size();i++){ for (int i = 0; i < baseList.size(); i++) {
buffer.append("<img class ='preview-img' src="+baseList.get(i)+" />"); buffer.append("<img class ='preview-img' src=" + baseList.get(i) + " />");
} }
buffer.append("</body></html>"); buffer.append("</body></html>");
try { try {
return buffer.toString(); return buffer.toString();
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(),e); log.error(e.getMessage(), e);
return ""; return "";
} }
@@ -109,7 +119,7 @@ public class PdfUtil {
public static byte[] readInputStream(InputStream inStream) throws Exception { public static byte[] readInputStream(InputStream inStream) throws Exception {
ByteArrayOutputStream outStream = new ByteArrayOutputStream(); ByteArrayOutputStream outStream = new ByteArrayOutputStream();
byte[] buffer = new byte[1024*1024]; byte[] buffer = new byte[1024 * 1024];
int len = 0; int len = 0;
while ((len = inStream.read(buffer)) != -1) { while ((len = inStream.read(buffer)) != -1) {
outStream.write(buffer, 0, len); outStream.write(buffer, 0, len);
@@ -1,5 +1,6 @@
package com.adc.da.report.vo; package com.adc.da.report.vo;
import com.adc.da.report.eo.PowerApplyAct;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
@@ -16,6 +17,7 @@ import java.util.List;
public class PowerApplyActPageVO extends BasePageVO { public class PowerApplyActPageVO extends BasePageVO {
private String id;
/** /**
* 流程id * 流程id
*/ */
@@ -137,4 +139,6 @@ public class PowerApplyActPageVO extends BasePageVO {
private String fileSize; private String fileSize;
private String name; private String name;
private List<PowerApplyAct> powerApplyList;
} }
@@ -47,6 +47,7 @@ public class ReportQueryVo {
private String usid; private String usid;
private List<String> ids; private List<String> ids;
// //
// private List<String> noIds; // private List<String> noIds;
@@ -1,6 +1,5 @@
package com.adc.da.report.vo; package com.adc.da.report.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data; import lombok.Data;
import java.util.List; import java.util.List;
@@ -27,6 +26,10 @@ public class ReportVo {
*/ */
private String keyContent; private String keyContent;
/**
* 权限
*/
private Integer power;
/** /**
* 主要内容 * 主要内容
*/ */
@@ -0,0 +1,96 @@
package com.adc.da.report.vo;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
import java.util.List;
/**
* @author bu
* @version 1.0
* @description 查询条件VO
* @date 2023-05-04
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class TtReportManageActPageVO extends BasePageVO {
/**
* 任务id
*/
private String taskId;
/**
* 流程id
*/
private String prcId;
/**
* 数据id
*/
private String dataId;
/**
*
*/
private String name;
/**
*
*/
private String keycontent;
/**
*
*/
private String maincontent;
/**
*
*/
private String department;
/**
*
*/
private String year;
/**
*
*/
private String fileId;
/**
*
*/
private String confidentialLevel;
/**
*
*/
private String privacyLevel;
/**
*
*/
private String createUserId;
/**
*
*/
private Date createDate;
/**
*
*/
private Date updateDate;
/**
*
*/
private Integer delFlag;
private List<PowerApplyActPageVO> powerList;
}
@@ -60,6 +60,13 @@
(#{item.id}, #{item.prcId}, #{item.taskId}, #{item.dataId}, #{item.reportId}, #{item.power}, #{item.applyReason}, #{item.userId}, #{item.createUserId}, #{item.createDate}, #{item.updateDate}, #{item.updateUserId}, #{item.delFlag}) (#{item.id}, #{item.prcId}, #{item.taskId}, #{item.dataId}, #{item.reportId}, #{item.power}, #{item.applyReason}, #{item.userId}, #{item.createUserId}, #{item.createDate}, #{item.updateDate}, #{item.updateUserId}, #{item.delFlag})
</foreach> </foreach>
</insert> </insert>
<update id="batchDel">
UPDATE power_apply_act set del_flag = 1
where id in
<foreach collection="ids" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</update>
<!-- 根据查询VO进行分页查询 --> <!-- 根据查询VO进行分页查询 -->
@@ -97,6 +104,18 @@
rep.name,rep.keycontent,rep.maincontent,rep.DEPARTMENT,rep.year,rep.fileid,rep.confidentialLevel,rep.privacyLevel rep.name,rep.keycontent,rep.maincontent,rep.DEPARTMENT,rep.year,rep.fileid,rep.confidentialLevel,rep.privacyLevel
from <include refid="TableName"/> a from <include refid="TableName"/> a
left join TT_REPORT_MANAGE rep on a.report_id = rep.id left join TT_REPORT_MANAGE rep on a.report_id = rep.id
where a.data_id = #{dataId} and a.del_flag = 0
</select>
<select id="selectListBydataIdNodel" resultType="com.adc.da.report.vo.PowerApplyActPageVO">
select a.*,
rep.name,rep.keycontent,rep.maincontent,rep.DEPARTMENT,rep.year,rep.fileid,rep.confidentialLevel,rep.privacyLevel
from <include refid="TableName"/> a
left join TT_REPORT_MANAGE rep on a.report_id = rep.id
where a.data_id = #{dataId} where a.data_id = #{dataId}
</select> </select>
<select id="selectActListBydataId" resultType="com.adc.da.report.eo.PowerApplyAct">
select a.*
from <include refid="TableName"/> a
where a.data_id = #{dataId} and a.del_flag = 0
</select>
</mapper> </mapper>
@@ -2,161 +2,24 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.adc.da.report.dao.mysql.ReportDao"> <mapper namespace="com.adc.da.report.dao.mysql.ReportDao">
<!-- 通用查询结果列 -->
<sql id="BaseColumnList">
id,
data_id, name, keycontent, maincontent, department, year, fileId, confidentialLevel, privacyLevel, createUserId, createDate, updateDate, del_flag
</sql>
<!-- <select id="list" parameterType="com.adc.da.report.vo.ReportQueryVo" resultType="com.adc.da.report.vo.ReportVo">--> <sql id="BaseColumnValue">
#{Vo.id},
<!-- select t1.id,t1.labelOneId,t1.labelTwoId,t1.labelThreeId,t1.labelOneName,t1.labelTwoName,t1.labelThreeName,t1.name,t1.year,t1.keyContent,t1.mainContent--> #{Vo.dataId},#{Vo.name},#{Vo.keycontent},#{Vo.maincontent},#{Vo.department},#{Vo.year},#{Vo.fileId},
<!-- ,t1.department,date_format(t1.updateDate,'%Y-%m-%d') createDate,t1.fileId--> #{Vo.confidentialLevel},#{Vo.privacyLevel},
<!-- from(--> #{Vo.createUserId},
#{Vo.createDate},#{Vo.updateDate},#{Vo.del_flag}
<!-- (--> </sql>
<!-- select distinct b1.*,(case when b3.name is null then '-' else b3.name end) labelOneName-->
<!-- ,(case when b4.name is null then '-' else b4.name end) labelTwoName-->
<!-- ,(case when b5.name is null then '-' else b5.name end) labelThreeName from-->
<!-- (select * from TT_REPORT_MANAGE )b1-->
<!-- left join TR_REPORT_USER b2 on b1.id=b2.reportId-->
<!-- left join TS_LABEL b3 on b1.labelOneId=b3.id-->
<!-- left join TS_LABEL b4 on b1.labelTwoId=b4.id-->
<!-- left join TS_LABEL b5 on b1.labelThreeId=b5.id-->
<!-- where b1.del_flag='0' and(b3.name is null or b4.name is null or b5.name is null )-->
<!-- &lt;!&ndash;文本搜索&ndash;&gt;-->
<!-- <if test="Vo.keyContent !=null and Vo.keyContent !=''">-->
<!-- and (b1.name like "%"#{Vo.keyContent}"%" or b1.keycontent like "%"#{Vo.keyContent}"%"-->
<!-- or b1.maincontent like "%"#{Vo.keyContent}"%" or b1.department like "%"#{Vo.keyContent}"%")-->
<!-- </if>-->
<!-- &lt;!&ndash;年份搜索&ndash;&gt;-->
<!-- <if test="Vo.year !=null and Vo.year.size() >0">-->
<!-- and b1.year in-->
<!-- <foreach collection="Vo.year" item="year" open="(" separator="," close=")">-->
<!-- #{year}-->
<!-- </foreach>-->
<!-- </if>-->
<!-- &lt;!&ndash;标签搜索&ndash;&gt;-->
<!-- <if test="Vo.labelOneId !=null and Vo.labelOneId.size() >0">-->
<!-- and b1.labelOneId in-->
<!-- <foreach collection="Vo.labelOneId" item="labelOneId" open="(" separator="," close=")">-->
<!-- #{labelOneId}-->
<!-- </foreach>-->
<!-- </if>-->
<!-- <if test="Vo.labelTwoId !=null and Vo.labelTwoId.size() >0">-->
<!-- and b1.labelTwoId in-->
<!-- <foreach collection="Vo.labelTwoId" item="labelTwoId" open="(" separator="," close=")">-->
<!-- #{labelTwoId}-->
<!-- </foreach>-->
<!-- </if>-->
<!-- <if test="Vo.labelThreeId !=null and Vo.labelThreeId.size() >0">-->
<!-- and b1.labelThreeId in-->
<!-- <foreach collection="Vo.labelThreeId" item="labelThreeId" open="(" separator="," close=")">-->
<!-- #{labelThreeId}-->
<!-- </foreach>-->
<!-- </if>-->
<!-- <if test="Vo.usid !=null and Vo.usid !=''">-->
<!-- and b2.userId=#{Vo.usid}-->
<!-- </if>-->
<!-- ORDER BY updateDate desc limit 999999999-->
<!-- )-->
<!-- UNION ALL-->
<!-- (select distinct a1.* ,a3.name labelOneName,a4.name labelTwoName,a5.name labelThreeName from(select * from TT_REPORT_MANAGE ) a1-->
<!-- left join TR_REPORT_USER a2 on a1.id=a2.reportId-->
<!-- left join TS_LABEL a3 on a1.labelOneId=a3.id-->
<!-- left join TS_LABEL a4 on a1.labelTwoId=a4.id-->
<!-- left join TS_LABEL a5 on a1.labelThreeId=a5.id-->
<!-- where a1.del_flag='0' and (a3.name is not null and a4.name is not null and a5.name is not null )-->
<!-- &lt;!&ndash;文本搜索&ndash;&gt;-->
<!-- <if test="Vo.keyContent !=null and Vo.keyContent !=''">-->
<!-- and (a1.name like "%"#{Vo.keyContent}"%" or a1.keycontent like "%"#{Vo.keyContent}"%"-->
<!-- or a1.maincontent like "%"#{Vo.keyContent}"%" or a1.department like "%"#{Vo.keyContent}"%" )-->
<!-- </if>-->
<!-- &lt;!&ndash;年份搜索&ndash;&gt;-->
<!-- <if test="Vo.year !=null and Vo.year.size >0">-->
<!-- and a1.year in-->
<!-- <foreach collection="Vo.year" item="year" open="(" separator="," close=")">-->
<!-- #{year}-->
<!-- </foreach>-->
<!-- </if>-->
<!-- &lt;!&ndash;标签搜索&ndash;&gt;-->
<!-- <if test="Vo.labelOneId !=null and Vo.labelOneId.size() >0">-->
<!-- and a1.labelOneId in-->
<!-- <foreach collection="Vo.labelOneId" item="labelOneId" open="(" separator="," close=")">-->
<!-- #{labelOneId}-->
<!-- </foreach>-->
<!-- </if>-->
<!-- <if test="Vo.labelTwoId !=null and Vo.labelTwoId.size() >0">-->
<!-- and a1.labelTwoId in-->
<!-- <foreach collection="Vo.labelTwoId" item="labelTwoId" open="(" separator="," close=")">-->
<!-- #{labelTwoId}-->
<!-- </foreach>-->
<!-- </if>-->
<!-- <if test="Vo.labelThreeId !=null and Vo.labelThreeId.size() >0">-->
<!-- and a1.labelThreeId in-->
<!-- <foreach collection="Vo.labelThreeId" item="labelThreeId" open="(" separator="," close=")">-->
<!-- #{labelThreeId}-->
<!-- </foreach>-->
<!-- </if>-->
<!-- <if test="Vo.usid !=null and Vo.usid !=''">-->
<!-- and a2.userId=#{Vo.usid}-->
<!-- </if>-->
<!-- ORDER BY updateDate desc limit 999999999)-->
<!-- )t1-->
<!-- </select>-->
<select id="list" parameterType="com.adc.da.report.vo.ReportQueryVo" resultType="com.adc.da.report.vo.ReportVo">
SELECT DISTINCT t.id, t.year, t.name, t.keycontent, t.fileId, t.createDate, t.department, t.maincontent,
t.confidentialLevel, t.privacyLevel
FROM `tt_report_manage` AS t
INNER JOIN ts_report_label AS trl ON t.id = trl.report_id
WHERE 1 = 1
<!--报表名称搜索-->
<if test="Vo.name != null and Vo.name != ''">
and t.name like "%"#{Vo.name}"%"
</if>
<!--年份搜索-->
<if test="Vo.year != null and Vo.year.size() > 0">
and t.year in
<foreach collection="Vo.year" item="year" open="(" separator="," close=")">
#{year}
</foreach>
</if>
<!--id搜索-->
<if test="idSet !=null and idSet.size() > 0">
and t.id in
<foreach collection="idSet" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
<!--id搜索-->
<if test="Vo.ids !=null and Vo.ids.size() > 0">
and Vo.ids in
<foreach collection="Vo.ids" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
<!--用户搜索-->
<if test="Vo.usid != null and Vo.usid != ''">
and t.userId=#{Vo.usid}
</if>
ORDER BY updateDate desc
</select>
<insert id="saveReportAct">
insert into TT_REPORT_MANAGE (<include refid="BaseColumnList"/>)
value (<include refid="BaseColumnValue"/>)
</insert>
<select id="getReportDateList" parameterType="string" resultType="string"> <select id="getReportDateList" parameterType="string" resultType="string">
select distinct year from TT_REPORT_MANAGE t1 select distinct year from TT_REPORT_MANAGE t1
@@ -190,12 +53,10 @@
WHERE WHERE
eo.DEL_FLAG = 0 eo.DEL_FLAG = 0
<if test="pageVO.usid !='' and pageVO.usid != null"> <if test="pageVO.usid !='' and pageVO.usid != null">
and ru.userId != #{pageVO.usid} AND eo.id NOT IN ( SELECT ru.reportId FROM tr_report_user ru WHERE ru.userId = #{pageVO.usid} )
</if> AND eo.id NOT IN ( SELECT tt.report_id FROM power_apply tt WHERE tt.user_id = #{pageVO.usid} )
<if test="pageVO.usid !='' and pageVO.usid != null"> AND eo.id NOT IN (SELECT tt.report_id FROM power_apply_act tt LEFT JOIN bus_process_name pro on tt.prc_id = pro.PRC_ID WHERE tt.user_id = #{pageVO.usid} and
and eo.id not in ( del_flag != 1 and pro.SUBMIT_STATUS = 1)
SELECT tt.report_id from power_apply tt WHERE tt.user_id = #{pageVO.usid}
)
</if> </if>
<if test="pageVO.name !='' and pageVO.name != null"> <if test="pageVO.name !='' and pageVO.name != null">
and name like CONCAT(CONCAT('%',#{pageVO.name}),'%') and name like CONCAT(CONCAT('%',#{pageVO.name}),'%')
@@ -225,4 +86,142 @@
</select> </select>
<select id="page" resultType="com.adc.da.report.vo.ReportVo">
SELECT
eo.id,
eo.NAME,
eo.keycontent,
eo.maincontent,
eo.DEPARTMENT,
eo.YEAR,
eo.fileid,
eo.confidentialLevel,
eo.privacyLevel,
pa.report_id,
pa.user_id,
pa.power
FROM
TT_REPORT_MANAGE eo
INNER JOIN ts_report_label AS trl ON eo.id = trl.report_id
LEFT JOIN tr_report_user ru ON eo.id = ru.reportId
LEFT JOIN power_apply pa ON pa.report_id = eo.id
WHERE
eo.DEL_FLAG = 0
<if test="pageVO.usid !='' and pageVO.usid != null">
and (ru.userId = #{pageVO.usid}
or eo.id in (
SELECT tt.report_id from power_apply tt WHERE tt.user_id = #{pageVO.usid})
)
</if>
<if test="pageVO.name !='' and pageVO.name != null">
and name like CONCAT(CONCAT('%',#{pageVO.name}),'%')
</if>
<if test="pageVO.keyContent !='' and pageVO.keyContent != null">
and keycontent like CONCAT(CONCAT('%',#{pageVO.keyContent}),'%')
</if>
<!--年份搜索-->
<if test="pageVO.year != null and pageVO.year.size() > 0">
and year in
<foreach collection="pageVO.year" item="year" open="(" separator="," close=")">
#{year}
</foreach>
</if>
<if test="pageVO.ids != null and pageVO.ids.size() > 0">
and eo.id in
<foreach collection="pageVO.ids" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
<!--id搜索-->
<if test="idSet !=null and idSet.size() > 0">
and eo.id in
<foreach collection="idSet" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
GROUP BY
eo.id
ORDER BY
eo.updateDate DESC
</select>
<select id="reportManagerPage" parameterType="com.adc.da.report.vo.ReportQueryVo" resultType="com.adc.da.report.vo.ReportVo">
SELECT DISTINCT
trl.report_id AS id,
t.year,
t.name,
t.keycontent,
t.fileId,
t.createDate,
t.department,
t.maincontent,
t.confidentialLevel,
t.privacyLevel
FROM `tt_report_manage` AS t
INNER JOIN ts_report_label AS trl ON t.id = trl.report_id
WHERE t.del_flag = 0
<!--报表名称搜索-->
<if test="Vo.name != null and Vo.name != ''">
and t.name like CONCAT(CONCAT('%',#{Vo.name}),'%')
</if>
<!--年份搜索-->
<if test="Vo.year != null and Vo.year.size() > 0">
and t.year in
<foreach collection="Vo.year" item="year" open="(" separator="," close=")">
#{year}
</foreach>
</if>
<!--id搜索-->
<if test="idSet !=null and idSet.size() > 0">
and t.id in
<foreach collection="idSet" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
<!--id搜索-->
<if test="Vo.ids !=null and Vo.ids.size() > 0">
and t.id in
<foreach collection="Vo.ids" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
<!--用户搜索-->
<if test="Vo.usid != null and Vo.usid != ''">
and t.createUserId=#{Vo.usid}
</if>
ORDER BY updateDate desc
</select>
<select id="isAct" resultType="java.lang.String">
SELECT rep.name FROM power_apply_act tt
LEFT JOIN bus_process_name pro on tt.prc_id = pro.PRC_ID
LEFT JOIN tt_report_manage rep on tt.report_id = rep.id
WHERE tt.user_id = #{Vo.usid} and tt.del_flag != 1 and
pro.SUBMIT_STATUS = 1
and tt.report_id in
<foreach collection="Vo.ids" item="id" open="(" separator="," close=")">
#{id}
</foreach>
GROUP BY rep.id;
</select>
<select id="selectByidAndName" resultType="java.lang.Long">
select count(1) from tt_report_manage rep
<where>
rep.Name = #{Vo.name}
and rep.del_flag = 0
<if test="Vo.id != null and Vo.id != ''">
and rep.id != #{Vo.id}
</if>
</where>
</select>
</mapper> </mapper>
@@ -0,0 +1,128 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.adc.da.report.dao.mysql.TtReportManageActDao">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.adc.da.report.eo.TtReportManageAct">
<result column="id" property="id" />
<result column="task_id" property="taskId" />
<result column="prc_id" property="prcId" />
<result column="data_id" property="dataId" />
<result column="name" property="name" />
<result column="keycontent" property="keyContent" />
<result column="maincontent" property="mainContent" />
<result column="department" property="department" />
<result column="year" property="year" />
<result column="fileId" property="fileId" />
<result column="confidentialLevel" property="confidentialLevel" />
<result column="privacyLevel" property="privacyLevel" />
<result column="createUserId" property="createUserId" />
<result column="createDate" property="createDate" />
<result column="updateDate" property="updateDate" />
<result column="del_flag" property="delFlag" />
</resultMap>
<!--表名信息-->
<sql id="TableName">
tt_report_manage_act
</sql>
<!-- 通用查询结果列 -->
<sql id="BaseColumnList">
id,
task_id, prc_id, data_id, name, keycontent, maincontent, department, year, fileId, confidentialLevel, privacyLevel, createUserId, createDate, updateDate, del_flag
</sql>
<!-- 查询条件 -->
<sql id="BaseQuerySql">
<where>
AND del = '${@com.adc.da.sys.constant.YesOrNoEnum@NO.value}'
<if test="pageVO != null">
<if test="pageVO.taskId !=null and pageVO.taskId !=''">
AND task_id LIKE CONCAT(CONCAT('%',#{pageVO.taskId}),'%')
</if>
<if test="pageVO.prcId !=null and pageVO.prcId !=''">
AND prc_id LIKE CONCAT(CONCAT('%',#{pageVO.prcId}),'%')
</if>
<if test="pageVO.dataId !=null and pageVO.dataId !=''">
AND data_id LIKE CONCAT(CONCAT('%',#{pageVO.dataId}),'%')
</if>
<if test="pageVO.name !=null and pageVO.name !=''">
AND name LIKE CONCAT(CONCAT('%',#{pageVO.name}),'%')
</if>
<if test="pageVO.keyContent !=null and pageVO.keyContent !=''">
AND keycontent LIKE CONCAT(CONCAT('%',#{pageVO.keyContent}),'%')
</if>
<if test="pageVO.mainContent !=null and pageVO.mainContent !=''">
AND maincontent LIKE CONCAT(CONCAT('%',#{pageVO.mainContent}),'%')
</if>
<if test="pageVO.department !=null and pageVO.department !=''">
AND department LIKE CONCAT(CONCAT('%',#{pageVO.department}),'%')
</if>
<if test="pageVO.year !=null and pageVO.year !=''">
AND year LIKE CONCAT(CONCAT('%',#{pageVO.year}),'%')
</if>
<if test="pageVO.fileId !=null and pageVO.fileId !=''">
AND fileId LIKE CONCAT(CONCAT('%',#{pageVO.fileId}),'%')
</if>
<if test="pageVO.confidentialLevel !=null and pageVO.confidentialLevel !=''">
AND confidentialLevel LIKE CONCAT(CONCAT('%',#{pageVO.confidentialLevel}),'%')
</if>
<if test="pageVO.privacyLevel !=null and pageVO.privacyLevel !=''">
AND privacyLevel LIKE CONCAT(CONCAT('%',#{pageVO.privacyLevel}),'%')
</if>
<if test="pageVO.createUserId !=null and pageVO.createUserId !=''">
AND createUserId LIKE CONCAT(CONCAT('%',#{pageVO.createUserId}),'%')
</if>
<if test="pageVO.createDate !=null">
AND createDate = #{pageVO.createDate}
</if>
<if test="pageVO.updateDate !=null">
AND updateDate = #{pageVO.updateDate}
</if>
<if test="pageVO.delFlag !=null">
AND del_flag = #{pageVO.delFlag}
</if>
</if>
</where>
</sql>
<!-- 根据查询VO进行分页查询 -->
<select id="selectPage" resultMap="BaseResultMap">
SELECT
<include refid="BaseColumnList"/>
FROM <include refid="TableName"/>
<include refid="BaseQuerySql"/>
ORDER BY create_time DESC
</select>
<!-- 根据查询VO进行分页查询总数 -->
<select id="selectPageCount" resultType="java.lang.Long">
SELECT
COUNT(1)
FROM (
SELECT
<include refid="BaseColumnList"/>
FROM <include refid="TableName"/>
<include refid="BaseQuerySql"/>
)a
</select>
<!-- 根据查询VO进行列表查询 -->
<select id="queryList" resultMap="BaseResultMap">
SELECT
<include refid="BaseColumnList"/>
FROM <include refid="TableName"/>
<include refid="BaseQuerySql"/>
ORDER BY create_time DESC
</select>
<select id="selectByDataId" resultType="com.adc.da.report.vo.TtReportManageActPageVO">
SELECT
<include refid="BaseColumnList"/>
FROM <include refid="TableName"/>
<where>
data_id = #{dataId}
</where>
</select>
</mapper>
@@ -3,8 +3,6 @@ package com.adc.da.sys.controller;
import com.adc.da.base.web.BaseController; import com.adc.da.base.web.BaseController;
import com.adc.da.excel.poi.excel.ExcelImportUtil; import com.adc.da.excel.poi.excel.ExcelImportUtil;
import com.adc.da.excel.poi.excel.entity.ImportParams; import com.adc.da.excel.poi.excel.entity.ImportParams;
import com.adc.da.excel.poi.excel.entity.result.ExcelImportResult;
import com.adc.da.excel.poi.excel.entity.result.ExcelVerifyHanlderErrorResult;
import com.adc.da.sys.constant.SysConstants; import com.adc.da.sys.constant.SysConstants;
import com.adc.da.sys.entity.UserEO; import com.adc.da.sys.entity.UserEO;
import com.adc.da.sys.service.iservice.IUserEoService; import com.adc.da.sys.service.iservice.IUserEoService;
@@ -12,7 +10,6 @@ import com.adc.da.sys.util.EncryptUtil;
import com.adc.da.sys.util.RSAUtil; import com.adc.da.sys.util.RSAUtil;
import com.adc.da.sys.vo.UserImportVO; import com.adc.da.sys.vo.UserImportVO;
import com.adc.da.sys.vo.UserVO; import com.adc.da.sys.vo.UserVO;
import com.adc.da.util.exception.AdcDaBaseException;
import com.adc.da.util.http.ResponseMessage; import com.adc.da.util.http.ResponseMessage;
import com.adc.da.util.http.Result; import com.adc.da.util.http.Result;
import com.adc.da.util.utils.FileUtil; import com.adc.da.util.utils.FileUtil;
@@ -25,31 +22,22 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.codec.binary.Base64; import org.apache.commons.codec.binary.Base64;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.BeanUtils;
import javax.annotation.Resource;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.*; import java.io.BufferedOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import static org.aspectj.weaver.tools.cache.SimpleCacheFactory.path;
@RestController @RestController
@RequestMapping("/${restPath}/sys/user") @RequestMapping("/${restPath}/sys/user")
@Api(tags = {"Sys-用户管理"}) @Api(tags = {"Sys-用户管理"})
@@ -33,6 +33,7 @@ public interface UserEODao extends BaseMapper<UserEO> {
List<UserVO> getUserByIdList(@Param("userIdList") List<String> userIdList); List<UserVO> getUserByIdList(@Param("userIdList") List<String> userIdList);
List<UserVO> getUserByIdListNodel(@Param("userIdList") List<String> userIdList);
// 根据account获取未逻辑删除的UserEO // 根据account获取未逻辑删除的UserEO
UserEO getUserEOByAccountNotDeleted(String account); UserEO getUserEOByAccountNotDeleted(String account);
@@ -41,4 +42,6 @@ public interface UserEODao extends BaseMapper<UserEO> {
List<Map<String, Object>> allList( @Param("account") String account, @Param("roleName") String roleName); List<Map<String, Object>> allList( @Param("account") String account, @Param("roleName") String roleName);
UserEO getUserEoById(@Param("usid") String usid); UserEO getUserEoById(@Param("usid") String usid);
UserEO selectUserByIdNodel(String userId);
} }
@@ -144,6 +144,11 @@ public class UserEOServiceImpl implements IUserEoService {
return dao.getUserByIdList(userIdList); return dao.getUserByIdList(userIdList);
} }
@Override
public List<UserVO> getUserByIdListNodel(List<String> userIdList){
return dao.getUserByIdListNodel(userIdList);
}
@Override @Override
public IPage<Map<String, Object>> list(int pageNo, int pageSize, String account, String roleName) { public IPage<Map<String, Object>> list(int pageNo, int pageSize, String account, String roleName) {
IPage page = new Page(); IPage page = new Page();
@@ -271,6 +276,11 @@ public class UserEOServiceImpl implements IUserEoService {
return dao.allList(account,roleName); return dao.allList(account,roleName);
} }
@Override
public UserEO getUserByIdNodel(String userId) {
return dao.selectUserByIdNodel(userId);
}
void checkExcel(List<UserImportVO> list) { void checkExcel(List<UserImportVO> list) {
if (CollectionUtils.isEmpty(list)) { if (CollectionUtils.isEmpty(list)) {
throw new AdcDaBaseException("数据不能为空"); throw new AdcDaBaseException("数据不能为空");
@@ -43,6 +43,14 @@ public interface IUserEoService {
List<UserVO> getUserByIdList(List<String> userIdList); List<UserVO> getUserByIdList(List<String> userIdList);
/**
* 不考虑 删除的情况
* 因流程中 人员被删除,但是审批历史中人要 回显正确
* @param userIdList
* @return
*/
List<UserVO> getUserByIdListNodel(List<String> userIdList);
IPage<Map<String, Object>> list(int pageNo, int pageSize, String account, String roleName); IPage<Map<String, Object>> list(int pageNo, int pageSize, String account, String roleName);
void delete(String ids); void delete(String ids);
@@ -56,5 +64,11 @@ public interface IUserEoService {
public void importExcelUser(List<UserImportVO> list); public void importExcelUser(List<UserImportVO> list);
List<Map<String, Object>> allList(String account, String roleName); List<Map<String, Object>> allList(String account, String roleName);
/**
* 不考虑 删除的情况
* 因流程中 人员被删除,但是审批历史中人要 回显正确
* @param userId
* @return
*/
UserEO getUserByIdNodel(String userId);
} }
@@ -186,6 +186,55 @@
where users.del_flag != 1 where users.del_flag != 1
and users.usid=#{usid} and users.usid=#{usid}
</select> </select>
<select id="selectUserByIdNodel" resultType="com.adc.da.sys.entity.UserEO">
select
users.usid,
users.usname,
users.account,
r.id as r_id,
r.data_scope as r_data_scope,
r.del_flag as r_delFlag,
r.is_default as r_is_default,
r.name as r_name,
o.id as o_id,
o.org_code as o_org_code,
o.org_name as o_org_name,
o.sup_org_code as o_sup_org_code,
o.bmdm_14 as o_bmdm14
from TS_USER users
left join TR_USER_ROLE ur on users.usid = ur.user_id
left join TS_ROLE r on ur.role_id = r.id
left join TR_USER_ORG uo on users.usid = uo.user_id
left join TS_ORG o on uo.org_id = o.id
where users.usid=#{usid}
</select>
<select id="getUserByIdListNodel" resultType="com.adc.da.sys.vo.UserVO">
select
users.usid,
users.usname,
users.account,
r.id as r_id,
r.data_scope as r_data_scope,
r.del_flag as r_delFlag,
r.is_default as r_is_default,
r.name as r_name,
o.id as o_id,
o.org_code as o_org_code,
o.org_name as o_org_name,
o.sup_org_code as o_sup_org_code,
o.bmdm_14 as o_bmdm14
from TS_USER users
left join TR_USER_ROLE ur on users.usid = ur.user_id
left join TS_ROLE r on ur.role_id = r.id
left join TR_USER_ORG uo on users.usid = uo.user_id
left join TS_ORG o on uo.org_id = o.id
where users.usid in
<foreach collection="userIdList" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</select>
</mapper> </mapper>
Binary file not shown.
+8 -6
View File
@@ -35,7 +35,7 @@
<commons-io.version>2.5</commons-io.version> <commons-io.version>2.5</commons-io.version>
<commons-codec.version>1.10</commons-codec.version> <commons-codec.version>1.10</commons-codec.version>
<commons-configuration.version>1.10</commons-configuration.version> <commons-configuration.version>1.10</commons-configuration.version>
<elasticsearch.version>2.4.6</elasticsearch.version> <!-- <elasticsearch.version>2.4.6</elasticsearch.version>-->
<shiro.version>1.4.0-RC2</shiro.version> <shiro.version>1.4.0-RC2</shiro.version>
<tomcat.version>8.5.37</tomcat.version> <tomcat.version>8.5.37</tomcat.version>
<poi.version>3.16</poi.version> <poi.version>3.16</poi.version>
@@ -332,11 +332,11 @@
<version>${aspectj.version}</version> <version>${aspectj.version}</version>
</dependency> </dependency>
<dependency> <!-- <dependency>-->
<groupId>org.elasticsearch</groupId> <!-- <groupId>org.elasticsearch</groupId>-->
<artifactId>elasticsearch</artifactId> <!-- <artifactId>elasticsearch</artifactId>-->
<version>${elasticsearch.version}</version> <!-- <version>${elasticsearch.version}</version>-->
</dependency> <!-- </dependency>-->
<dependency> <dependency>
<groupId>org.jdom</groupId> <groupId>org.jdom</groupId>
@@ -520,6 +520,8 @@
<groupId>cn.hutool</groupId> <groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId> <artifactId>hutool-all</artifactId>
<version>4.5.11</version> <version>4.5.11</version>
<!-- <scope>system</scope>-->
<!-- <systemPath>${project.basedir}/libs/hutool-all-4.5.11.jar</systemPath>-->
</dependency> </dependency>
<dependency> <dependency>
@@ -5,7 +5,6 @@ import com.adc.da.login.util.UserUtils;
import com.adc.da.sys.entity.UserEO; import com.adc.da.sys.entity.UserEO;
import com.adc.da.sys.service.iservice.IUserEoService; import com.adc.da.sys.service.iservice.IUserEoService;
import com.adc.da.wkflow.business_activiti.service.ActivitDefineService; import com.adc.da.wkflow.business_activiti.service.ActivitDefineService;
import com.adc.da.wkflow.business_main.entity.BusProcessApprove;
import com.adc.da.wkflow.business_main.entity.BusProcessName; import com.adc.da.wkflow.business_main.entity.BusProcessName;
import com.adc.da.wkflow.business_main.service.IBusProcessApproveService; import com.adc.da.wkflow.business_main.service.IBusProcessApproveService;
import com.adc.da.wkflow.business_main.service.IBusProcessNameService; import com.adc.da.wkflow.business_main.service.IBusProcessNameService;
@@ -217,13 +216,13 @@ public class ActivitDefineController {
ibusprocessnameService.save(one); ibusprocessnameService.save(one);
} }
BusProcessApprove busProcessApprove = new BusProcessApprove(); // BusProcessApprove busProcessApprove = new BusProcessApprove();
busProcessApprove.setFromValsJson(JSON.toJSONString(approveData)); // busProcessApprove.setFromValsJson(JSON.toJSONString(approveData));
busProcessApprove.setTaskId(task.getId()); // busProcessApprove.setTaskId(task.getId());
busProcessApprove.setCreateDate(new Date()); // busProcessApprove.setCreateDate(new Date());
busProcessApprove.setPrcId(pi.getId()); // busProcessApprove.setPrcId(pi.getId());
busProcessApprove.setCreateUserId(UserUtils.getUserId()); // busProcessApprove.setCreateUserId(UserUtils.getUserId());
ibusProcessApproveService.save(busProcessApprove); // ibusProcessApproveService.save(busProcessApprove);
log.info("启动流程实例,获取id-->{},实例名称-->{}", pi.getId(), pd.getName()); log.info("启动流程实例,获取id-->{},实例名称-->{}", pi.getId(), pd.getName());
return WrapMapper.ok(task.getId()); return WrapMapper.ok(task.getId());
} }
@@ -1,14 +1,19 @@
package com.adc.da.wkflow.business_activiti.service; package com.adc.da.wkflow.business_activiti.service;
import com.adc.da.report.dao.mysql.PowerApplyActDao; import com.adc.da.report.dao.mysql.PowerApplyActDao;
import com.adc.da.report.dao.mysql.TtReportManageActDao;
import com.adc.da.report.eo.PowerApplyAct; import com.adc.da.report.eo.PowerApplyAct;
import com.adc.da.report.eo.TtReportManageAct;
import com.adc.da.report.service.IPowerApplyActService; import com.adc.da.report.service.IPowerApplyActService;
import com.adc.da.report.service.ITtReportManageActService;
import com.adc.da.util.utils.StringUtils;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
@@ -23,14 +28,18 @@ public class ActivitDefineService {
@Autowired @Autowired
PowerApplyActDao powerApplyActDao; PowerApplyActDao powerApplyActDao;
@Autowired
TtReportManageActDao ttReportManageActDao;
@Autowired
ITtReportManageActService ttReportManageActService;
//保存data数据 //保存data数据
public String saveOrUpdateDate(String prcType, String dataJson,String taskId,String prcId) { public String saveOrUpdateDate(String prcType, String dataJson,String taskId,String prcId) {
String dataId = UUID.randomUUID().toString().replaceAll("-",""); String dataId = UUID.randomUUID().toString().replaceAll("-","");
if ("1".equals(prcType)){ if ("1".equals(prcType)){
List<PowerApplyAct> powerApplyActs = JSONObject.parseArray(dataJson, PowerApplyAct.class); List<PowerApplyAct> powerApplyActs = JSONObject.parseArray(dataJson, PowerApplyAct.class);
// LambdaQueryWrapper<PowerApplyAct> powerWrapper = new LambdaQueryWrapper<>();
// powerWrapper.eq(PowerApplyAct::getPrcId,prcId);
// powerApplyActDao.delete(powerWrapper);
for (PowerApplyAct powerApplyAct : powerApplyActs) { for (PowerApplyAct powerApplyAct : powerApplyActs) {
powerApplyAct.setId(UUID.randomUUID().toString().replaceAll("-","")); powerApplyAct.setId(UUID.randomUUID().toString().replaceAll("-",""));
powerApplyAct.setDataId(dataId); powerApplyAct.setDataId(dataId);
@@ -40,6 +49,29 @@ public class ActivitDefineService {
powerApplyAct.setCreateDate(new Date()); powerApplyAct.setCreateDate(new Date());
} }
powerApplyActDao.batchInsert(powerApplyActs); powerApplyActDao.batchInsert(powerApplyActs);
}else if ("2".equals(prcType)){
TtReportManageAct ttReportManageAct = JSONObject.parseObject(dataJson, TtReportManageAct.class);
ttReportManageAct.setDataId(dataId);
ttReportManageAct.setTaskId(taskId);
ttReportManageAct.setPrcId(prcId);
ttReportManageAct.setDelFlag(0);
ttReportManageAct.setCreateDate(new Date());
ttReportManageActService.saveOrUpdateSingle(ttReportManageAct);
//权限
List<PowerApplyAct> powerApplyActs = new ArrayList<>();
List<PowerApplyAct> powerList = ttReportManageAct.getPowerList();
for (PowerApplyAct powerApplyAct : powerList) {
if (StringUtils.isNotEmpty(powerApplyAct.getId())){
powerApplyAct.setId(UUID.randomUUID().toString().replaceAll("-",""));
powerApplyAct.setDataId(dataId);
powerApplyAct.setTaskId(taskId);
powerApplyAct.setPrcId(prcId);
powerApplyAct.setDelFlag(0);
powerApplyAct.setCreateDate(new Date());
powerApplyActs.add(powerApplyAct);
}
}
powerApplyActDao.batchInsert(powerApplyActs);
} }
return dataId; return dataId;
} }
@@ -28,10 +28,13 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.Duration;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.*; import java.util.*;
import static com.adc.da.wkflow.util.date.DateTools.disposeApprovalTime;
@Api(tags = "流程明细管理") @Api(tags = "流程明细管理")
@RestController @RestController
@RequestMapping("/${restPath}/task") @RequestMapping("/${restPath}/task")
@@ -58,7 +61,7 @@ public class TaskController {
@ApiOperation(value = "流程实例明细列表") @ApiOperation(value = "流程实例明细列表")
@ApiImplicitParam(name = "prcNum", value = "流程实例id") @ApiImplicitParam(name = "prcNum", value = "流程实例id")
@GetMapping("/get_list_by_instance") @GetMapping("/get_list_by_instance")
public List<Map<String, Object>> get_list_by_instance(String prcNum,String sortWord,String shunxu) { public List<Map<String, Object>> get_list_by_instance(String prcNum,String sortWord,String shunxu) throws ParseException {
QueryWrapper queryWrapper = new QueryWrapper(); QueryWrapper queryWrapper = new QueryWrapper();
queryWrapper.eq("PRC_NUM",prcNum); queryWrapper.eq("PRC_NUM",prcNum);
BusProcessName one = iBusProcessNameService.getOne(queryWrapper); BusProcessName one = iBusProcessNameService.getOne(queryWrapper);
@@ -80,7 +83,7 @@ public class TaskController {
BusProcessNew processNew = iBusProcessNewService.getOne(processNewQueryWrapper); BusProcessNew processNew = iBusProcessNewService.getOne(processNewQueryWrapper);
if(processNew!=null){ if(processNew!=null){
UserEO assignee = userEoService.getUserById(processNew.getUserId()); UserEO assignee = userEoService.getUserByIdNodel(processNew.getUserId());
if(assignee != null){ if(assignee != null){
historicTaskInstance.put("assignee", assignee.getUsname()); historicTaskInstance.put("assignee", assignee.getUsname());
historicTaskInstance.put("assigneeId", assignee.getUsid()); historicTaskInstance.put("assigneeId", assignee.getUsid());
@@ -88,7 +91,7 @@ public class TaskController {
} }
}else{ }else{
String assigneeId = historicTaskInstance.get("assignee").toString(); String assigneeId = historicTaskInstance.get("assignee").toString();
List<UserVO> userByIdList = userEoService.getUserByIdList(Arrays.asList(assigneeId)); List<UserVO> userByIdList = userEoService.getUserByIdListNodel(Arrays.asList(assigneeId));
if(userByIdList.size()>0){ if(userByIdList.size()>0){
UserVO assignee = userByIdList.get(0); UserVO assignee = userByIdList.get(0);
historicTaskInstance.put("assignee", assignee.getUsname()); historicTaskInstance.put("assignee", assignee.getUsname());
@@ -130,11 +133,17 @@ public class TaskController {
historicTaskInstance.put("approvalResult",formValsJsonMap.get("flag")!=null ? formValsJsonMap.get("flag"):""); historicTaskInstance.put("approvalResult",formValsJsonMap.get("flag")!=null ? formValsJsonMap.get("flag"):"");
historicTaskInstance.put("approvalFile",formValsJsonMap.get("approvalFile")!=null ? formValsJsonMap.get("approvalFile"):""); historicTaskInstance.put("approvalFile",formValsJsonMap.get("approvalFile")!=null ? formValsJsonMap.get("approvalFile"):"");
} }
Date createTime = (Date) historicTaskInstance.get("createTime"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date endTime = (Date) historicTaskInstance.get("endTime"); Date createTime = sdf.parse((String)historicTaskInstance.get("createTime"));
if(endTime!=null){ Object endTime1 = historicTaskInstance.get("endTime");
long approvalTime = disposeApprovalTime(createTime,endTime); if(endTime1!=null){
historicTaskInstance.put("approvalTime",approvalTime + "小时"); Date endTime = sdf.parse((String)endTime1);
// long approvalTime = disposeApprovalTime(createTime,endTime);
LocalDateTime startDateTime = LocalDateTime.ofInstant(createTime.toInstant(), ZoneId.systemDefault());
LocalDateTime endDateTime = LocalDateTime.ofInstant(endTime.toInstant(), ZoneId.systemDefault());
long days = Duration.between(startDateTime.toLocalDate().atStartOfDay(), endDateTime.toLocalDate().atStartOfDay()).toDays() + 1;
historicTaskInstance.put("approvalTime",days + "天");
} }
} }
if(StringUtils.isNotBlank(sortWord)){ if(StringUtils.isNotBlank(sortWord)){
@@ -3,7 +3,9 @@ package com.adc.da.wkflow.business_activiti.task;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.adc.da.login.util.UserUtils; import com.adc.da.login.util.UserUtils;
import com.adc.da.report.dao.mysql.PowerApplyActDao; import com.adc.da.report.dao.mysql.PowerApplyActDao;
import com.adc.da.report.dao.mysql.TtReportManageActDao;
import com.adc.da.report.vo.PowerApplyActPageVO; import com.adc.da.report.vo.PowerApplyActPageVO;
import com.adc.da.report.vo.TtReportManageActPageVO;
import com.adc.da.sys.service.iservice.IUserEoService; import com.adc.da.sys.service.iservice.IUserEoService;
import com.adc.da.sys.vo.UserVO; import com.adc.da.sys.vo.UserVO;
import com.adc.da.util.exception.AdcDaBaseException; import com.adc.da.util.exception.AdcDaBaseException;
@@ -95,7 +97,7 @@ public class TodoTaskController {
private IBusProcessEntrustService iBusProcessEntrustService; private IBusProcessEntrustService iBusProcessEntrustService;
@Resource @Resource
private IBusProcessApproveService iBusProcessApproveService; private IBusProcessApproveService ibusProcessApproveService;
@Resource @Resource
private BusProcessApproveMapper busProcessApproveMapper; private BusProcessApproveMapper busProcessApproveMapper;
@@ -109,6 +111,9 @@ public class TodoTaskController {
@Autowired @Autowired
private PowerApplyActDao powerApplyActDao; private PowerApplyActDao powerApplyActDao;
@Autowired
private TtReportManageActDao ttReportManageActDao;
@ApiOperation(value = "我的待办任务列表") @ApiOperation(value = "我的待办任务列表")
@ApiImplicitParams({@ApiImplicitParam(name = "name", value = "名称"), @ApiImplicitParams({@ApiImplicitParam(name = "name", value = "名称"),
@ApiImplicitParam(name = "current", value = "当前页"), @ApiImplicitParam(name = "current", value = "当前页"),
@@ -204,12 +209,21 @@ public class TodoTaskController {
return WrapMapper.ok("改派成功"); return WrapMapper.ok("改派成功");
} }
/**
* 转办
* @param taskId
* @param assignee
* @param userId
* @param pId
* @return
*/
@ApiOperation(value = "新改派任务") @ApiOperation(value = "新改派任务")
@ApiImplicitParams({@ApiImplicitParam(name = "taskId", value = "任务id"), @ApiImplicitParams({@ApiImplicitParam(name = "taskId", value = "任务id"),
@ApiImplicitParam(name = "assignee", value = "被改派人员"), @ApiImplicitParam(name = "userId", value = "改派人员"), @ApiImplicitParam(name = "assignee", value = "被改派人员"), @ApiImplicitParam(name = "userId", value = "改派人员"),
@ApiImplicitParam(name = "pId", value = "流程实例ID")}) @ApiImplicitParam(name = "pId", value = "流程实例ID")})
@GetMapping("/changeAssigneeNew") @GetMapping("/changeAssigneeNew")
public Wrapper<String> changeAssigneeNew(String taskId, String assignee, String userId, String pId) { public Wrapper<String> changeAssigneeNew(String taskId, String assignee, String userId, String pId,
@RequestParam(required = false,value = "replaceMap")String replaceMap) {
List<String> list = Arrays.asList(taskId.split(",")); List<String> list = Arrays.asList(taskId.split(","));
for (String str : list) { for (String str : list) {
@@ -230,21 +244,36 @@ public class TodoTaskController {
iBusProcessNewService.saveOrUpdate(busProcessNew); iBusProcessNewService.saveOrUpdate(busProcessNew);
} }
} }
if (replaceMap == null) {
BusProcessEntrust busProcessEntrust = new BusProcessEntrust(); BusProcessEntrust busProcessEntrust = new BusProcessEntrust();
busProcessEntrust.setEnUserId(assignee); busProcessEntrust.setEnUserId(assignee);
busProcessEntrust.setUserId(userId); busProcessEntrust.setUserId(userId);
busProcessEntrust.setValidFlag("0"); busProcessEntrust.setValidFlag("0");
busProcessEntrust.setPrcId(pId); busProcessEntrust.setPrcId(pId);
busProcessEntrust.setPrcName(one.getPrcName()); busProcessEntrust.setPrcName(one.getPrcName());
busProcessEntrust.setTaskId(str); busProcessEntrust.setTaskId(str);
iBusProcessEntrustService.save(busProcessEntrust); iBusProcessEntrustService.save(busProcessEntrust);
}
} }
} }
//监控流程中 变更处理人为永久变更
if (replaceMap != null){
ibusProcessApproveService.changeAssignee(replaceMap,pId);
}
log.info("task {} find " + taskId); log.info("task {} find " + taskId);
return WrapMapper.ok("改派成功"); return WrapMapper.ok("改派成功");
} }
@ApiOperation(value = "查询当前任务", notes = "查询当前任务")
@ApiImplicitParams(@ApiImplicitParam(name = "taskId", value = "任务id"))
@GetMapping("/selectTask")
public ResponseMessage completeTaskByUserId(String taskId) {
Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
HashMap<String, String> reMap = new HashMap<>();
reMap.put("taskId",task.getId());
reMap.put("assignee",task.getAssignee());
return Result.success(reMap);
}
@ApiOperation(value = "完成任务", notes = "流程单个节点任务,直接完成任务") @ApiOperation(value = "完成任务", notes = "流程单个节点任务,直接完成任务")
@ApiImplicitParams({@ApiImplicitParam(name = "taskId", value = "任务id"), @ApiImplicitParams({@ApiImplicitParam(name = "taskId", value = "任务id"),
@@ -265,7 +294,7 @@ public class TodoTaskController {
busProcessApprove.setPrcId(task.getProcessInstanceId()); busProcessApprove.setPrcId(task.getProcessInstanceId());
busProcessApprove.setCreateDate(new Date()); busProcessApprove.setCreateDate(new Date());
busProcessApprove.setFromValsJson(busMes.getSubmitJson()); busProcessApprove.setFromValsJson(busMes.getSubmitJson());
iBusProcessApproveService.save(busProcessApprove); ibusProcessApproveService.save(busProcessApprove);
if (StringUtils.isNotEmpty(dataJson)){ if (StringUtils.isNotEmpty(dataJson)){
//根据业务情况 对业务数据进行saveOrupdate //根据业务情况 对业务数据进行saveOrupdate
activitDefineService.saveOrUpdateDate(busMes.getPrcType(),dataJson, task.getId(),task.getProcessInstanceId()); activitDefineService.saveOrUpdateDate(busMes.getPrcType(),dataJson, task.getId(),task.getProcessInstanceId());
@@ -367,14 +396,15 @@ public class TodoTaskController {
*/ */
@ApiOperation(value = "详情") @ApiOperation(value = "详情")
@GetMapping("/queryDetail") @GetMapping("/queryDetail")
public ResponseMessage queryDetail(@RequestParam("prcId") String prcId,@RequestParam("prcType")String prcType) { public ResponseMessage queryDetail(@RequestParam("prcId") String prcId, @RequestParam("prcType")String prcType,
@RequestParam("tag") Integer tag) {
List<BusProcessNew> busProcessNews = iBusProcessNewService.selectEOByTaskId(prcId); List<BusProcessNew> busProcessNews = iBusProcessNewService.selectEOByTaskId(prcId);
if (busProcessNews.size() == 0) { if (busProcessNews.size() == 0) {
return null; return null;
} }
BusProcessNew busProcessNew = busProcessNews.get(0); BusProcessNew busProcessNew = busProcessNews.get(0);
// 查找详细业务数据 // 查找详细业务数据
BusProcessNewVO busProcessNewVO = this.queryDetailDate(busProcessNew, prcType); BusProcessNewVO busProcessNewVO = this.queryDetailDate(busProcessNew, prcType,tag);
//审批数据 //审批数据
List<BusProcessApprove> busProcessApproves = List<BusProcessApprove> busProcessApproves =
busProcessApproveMapper.selectEoByPrcIdAndTask(busProcessNewVO.getPId()); busProcessApproveMapper.selectEoByPrcIdAndTask(busProcessNewVO.getPId());
@@ -384,15 +414,69 @@ public class TodoTaskController {
return Result.success(busProcessNewVO); return Result.success(busProcessNewVO);
} }
private BusProcessNewVO queryDetailDate(BusProcessNew busProcessNew, String prcType) { /**
* @param dataId
* @param prcType
*/
@ApiOperation(value = "草稿详情")
@GetMapping("/queryDetailByDataId")
public ResponseMessage queryDetailByDataId(@RequestParam("dataId") String dataId,
@RequestParam("prcType")String prcType,
@RequestParam(value = "prcId",required = false)String prcId) {
// 查找详细业务数据
BusProcessNewVO busProcessNewVO = this.queryDetailDateByDataId(dataId, prcType);
//审批数据
BusProcessApprove busProcessApprove = new BusProcessApprove();
if(StringUtils.isNotEmpty(prcId)){
List<BusProcessApprove> busProcessApproves = busProcessApproveMapper.selectEoByPrcIdAndTask(prcId);
busProcessApprove = busProcessApproves.get(0);
}else {
busProcessApprove = busProcessApproveMapper.selectEoByDataId(dataId);
}
busProcessNewVO.setSubmitJson(busProcessApprove.getFromValsJson());
return Result.success(busProcessNewVO);
}
private BusProcessNewVO queryDetailDateByDataId(String dataId, String prcType) {
BusProcessNewVO busProcessNewVO = new BusProcessNewVO();
if ("1".equals(prcType)){
List<PowerApplyActPageVO> powerApplyActs = powerApplyActDao.selectListBydataId(dataId);
String string = JSONArray.toJSONString(powerApplyActs);
//去对应的 数据表查数据
busProcessNewVO.setDataJson(string);
}else if ("2".equals(prcType)){
TtReportManageActPageVO ttReportManageActPageVO = ttReportManageActDao.selectByDataId(dataId);
List<PowerApplyActPageVO> powerApplyActs = powerApplyActDao.selectListBydataId(dataId);
ttReportManageActPageVO.setPowerList(powerApplyActs);
String string = JSONArray.toJSONString(ttReportManageActPageVO);
//去对应的 数据表查数据
busProcessNewVO.setDataJson(string);
}
return busProcessNewVO;
}
private BusProcessNewVO queryDetailDate(BusProcessNew busProcessNew, String prcType, Integer tag) {
BusProcessNewVO busProcessNewVO = new BusProcessNewVO(); BusProcessNewVO busProcessNewVO = new BusProcessNewVO();
BeanUtils.copyProperties(busProcessNew,busProcessNewVO); BeanUtils.copyProperties(busProcessNew,busProcessNewVO);
String dataId = busProcessNew.getDataId(); String dataId = busProcessNew.getDataId();
if ("1".equals(prcType)){ if ("1".equals(prcType)){
List<PowerApplyActPageVO> powerApplyActs = powerApplyActDao.selectListBydataId(dataId); List<PowerApplyActPageVO> powerApplyActs = new ArrayList<>();
if (tag == 1){
//代办查看详情
powerApplyActs = powerApplyActDao.selectListBydataIdNodel(dataId);
}else {
powerApplyActs = powerApplyActDao.selectListBydataId(dataId);
}
String string = JSONArray.toJSONString(powerApplyActs); String string = JSONArray.toJSONString(powerApplyActs);
//去对应的 数据表查数据 //去对应的 数据表查数据
busProcessNewVO.setDataJson(string); busProcessNewVO.setDataJson(string);
}else if("2".equals(prcType)){
TtReportManageActPageVO ttReportManageActPageVO = ttReportManageActDao.selectByDataId(dataId);
List<PowerApplyActPageVO> powerApplyActs = powerApplyActDao.selectListBydataId(dataId);
ttReportManageActPageVO.setPowerList(powerApplyActs);
String string = JSONArray.toJSONString(ttReportManageActPageVO);
//去对应的 数据表查数据
busProcessNewVO.setDataJson(string);
} }
return busProcessNewVO; return busProcessNewVO;
@@ -406,7 +490,9 @@ public class TodoTaskController {
@PostMapping("/saveTaskFirst") @PostMapping("/saveTaskFirst")
public Wrapper<String> saveTaskFirst(@RequestBody ApproveDataVO approveDataVO) { public Wrapper<String> saveTaskFirst(@RequestBody ApproveDataVO approveDataVO) {
String dataJson = approveDataVO.getDataJson(); String dataJson = approveDataVO.getDataJson();
String submitJson = approveDataVO.getSubmitJson();
String saveId = null; String saveId = null;
String dataId = null;
if (approveDataVO.getId() != null && !approveDataVO.getId().equals("")) { if (approveDataVO.getId() != null && !approveDataVO.getId().equals("")) {
saveId = approveDataVO.getId(); saveId = approveDataVO.getId();
@@ -418,8 +504,14 @@ public class TodoTaskController {
List<BusProcessName> list = iBusProcessNameService.list(queryWrapper); List<BusProcessName> list = iBusProcessNameService.list(queryWrapper);
if (list != null && list.size() > 0) { if (list != null && list.size() > 0) {
BusProcessName busProcessName = list.get(0); BusProcessName busProcessName = list.get(0);
busProcessName.setPrcName(approveDataVO.getPrcName());
busProcessName.setSubmitStatus(SubmitStatusEnum.DRAFT.getValue()); busProcessName.setSubmitStatus(SubmitStatusEnum.DRAFT.getValue());
if (StringUtils.isNotEmpty(dataJson)){
//根据业务情况 对业务数据进行saveOrupdate
dataId = activitDefineService.saveOrUpdateDate(approveDataVO.getPrcType(), dataJson, null,
null);
busProcessName.setDataId(dataId);
}
iBusProcessNameService.saveOrUpdate(busProcessName); iBusProcessNameService.saveOrUpdate(busProcessName);
} }
} else { } else {
@@ -428,11 +520,12 @@ public class TodoTaskController {
BusProcessName busProcessName = new BusProcessName(); BusProcessName busProcessName = new BusProcessName();
if (StringUtils.isNotEmpty(dataJson)) { if (StringUtils.isNotEmpty(dataJson)) {
//根据业务情况 对业务数据进行saveOrupdate //根据业务情况 对业务数据进行saveOrupdate
String dataId = activitDefineService.saveOrUpdateDate(approveDataVO.getPrcType(), dataJson, dataId = activitDefineService.saveOrUpdateDate(approveDataVO.getPrcType(), dataJson,
approveDataVO.getTaskId(),""); approveDataVO.getTaskId(),"");
busProcessName.setDataId(dataId); busProcessName.setDataId(dataId);
} }
busProcessName.setPrcType(approveDataVO.getPrcType()); busProcessName.setPrcType(approveDataVO.getPrcType());
busProcessName.setPrcName(approveDataVO.getPrcName());
busProcessName.setCreatUser(approveDataVO.getCreateUser()); busProcessName.setCreatUser(approveDataVO.getCreateUser());
busProcessName.setCreatTime(time); busProcessName.setCreatTime(time);
busProcessName.setCreatUserName(approveDataVO.getCreateUserName()); busProcessName.setCreatUserName(approveDataVO.getCreateUserName());
@@ -444,10 +537,21 @@ public class TodoTaskController {
queryWrapper.eq("PRC_TYPE", approveDataVO.getPrcType()); queryWrapper.eq("PRC_TYPE", approveDataVO.getPrcType());
queryWrapper.eq("CREAT_USER", approveDataVO.getCreateUser()); queryWrapper.eq("CREAT_USER", approveDataVO.getCreateUser());
BusProcessName one = iBusProcessNameService.getOne(queryWrapper); BusProcessName one = iBusProcessNameService.getOne(queryWrapper);
saveId = one.getId(); saveId = one.getId();
} }
//存储审批数据
if (StringUtils.isNotEmpty(submitJson)){
BusProcessApprove busProcessApprove = busProcessApproveMapper.selectEoByDataId(dataId);
if (busProcessApprove == null){
busProcessApprove = new BusProcessApprove();
busProcessApprove.setDataId(dataId);
busProcessApprove.setCreateDate(new Date());
busProcessApprove.setCreateUserId(approveDataVO.getCreateUser());
}
busProcessApprove.setFromValsJson(submitJson);
ibusProcessApproveService.saveOrUpdate(busProcessApprove);
}
return WrapMapper.ok(saveId); return WrapMapper.ok(saveId);
} }
@@ -476,7 +580,7 @@ public class TodoTaskController {
*/ */
@ApiOperation(value = "查询草稿") @ApiOperation(value = "查询草稿")
@PostMapping("/queryTaskDraft") @PostMapping("/queryTaskDraft")
public List<BusProcessName> queryTaskDraft(@RequestBody TaskCommonQuery taskCommonQuery) { public ResponseMessage queryTaskDraft(@RequestBody TaskCommonQuery taskCommonQuery) {
QueryWrapper<BusProcessName> queryWrapper = new QueryWrapper<>(); QueryWrapper<BusProcessName> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("CREAT_USER", taskCommonQuery.getUserId()); queryWrapper.eq("CREAT_USER", taskCommonQuery.getUserId());
if (taskCommonQuery.getPrcNum() != null && !taskCommonQuery.getPrcNum().equals("")) { if (taskCommonQuery.getPrcNum() != null && !taskCommonQuery.getPrcNum().equals("")) {
@@ -493,8 +597,14 @@ public class TodoTaskController {
queryWrapper.lambda().eq(BusProcessName::getSubmitStatus,SubmitStatusEnum.DRAFT.getValue()); queryWrapper.lambda().eq(BusProcessName::getSubmitStatus,SubmitStatusEnum.DRAFT.getValue());
queryWrapper.orderByDesc("CREAT_TIME"); queryWrapper.orderByDesc("CREAT_TIME");
Page page = new Page();
List<BusProcessName> list = iBusProcessNameService.list(queryWrapper); List<BusProcessName> list = iBusProcessNameService.list(queryWrapper);
return list; List<BusProcessName> reList = this.startPage(list, taskCommonQuery.getCurrent(), taskCommonQuery.getSize());
page.setList(reList);
page.setPageNo(taskCommonQuery.getCurrent());
page.setPageSize(taskCommonQuery.getSize());
page.setCount((long) list.size());
return Result.success(page);
} }
@ApiOperation(value = "查询流程是否结束", notes = "查询流程是否结束") @ApiOperation(value = "查询流程是否结束", notes = "查询流程是否结束")
@@ -44,4 +44,7 @@ public class BusProcessApprove {
@TableField("FROM_VALS_JSON") @TableField("FROM_VALS_JSON")
private String fromValsJson; private String fromValsJson;
@TableField("DATA_ID")
private String dataId;
} }
@@ -19,4 +19,7 @@ public interface BusProcessApproveMapper extends BaseMapper<BusProcessApprove> {
List<BusProcessApprove> selectEoByPrcIdAndTask(@Param("prcId") String prcId); List<BusProcessApprove> selectEoByPrcIdAndTask(@Param("prcId") String prcId);
BusProcessApprove selectEoByDataId(@Param("dataId") String dataId);
BusProcessApprove selectEoByTask(@Param("taskId")String taskId);
} }
@@ -4,6 +4,7 @@ import com.adc.da.wkflow.business_main.entity.BusProcessApprove;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List; import java.util.List;
/** /**
* 审批历史业务类 * 审批历史业务类
* 用于审批历史的查询的存取 * 用于审批历史的查询的存取
@@ -12,4 +13,10 @@ public interface IBusProcessApproveService extends IService<BusProcessApprove> {
List<BusProcessApprove> selectEoByPrcIdAndTask(String prcId); List<BusProcessApprove> selectEoByPrcIdAndTask(String prcId);
/**
* 监控流程中 变更处理人为永久变更
* @param replaceMap
* @param pId
*/
void changeAssignee(String replaceMap,String pId);
} }
@@ -3,6 +3,8 @@ package com.adc.da.wkflow.business_main.service.impl;
import com.adc.da.wkflow.business_main.entity.BusProcessApprove; import com.adc.da.wkflow.business_main.entity.BusProcessApprove;
import com.adc.da.wkflow.business_main.mapper.BusProcessApproveMapper; import com.adc.da.wkflow.business_main.mapper.BusProcessApproveMapper;
import com.adc.da.wkflow.business_main.service.IBusProcessApproveService; import com.adc.da.wkflow.business_main.service.IBusProcessApproveService;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -26,4 +28,19 @@ public class BusProcessApproveServiceImpl extends ServiceImpl<BusProcessApproveM
return baseMapper.selectEoByPrcIdAndTask(prcId); return baseMapper.selectEoByPrcIdAndTask(prcId);
} }
@Override
public void changeAssignee(String replaceMap,String prcId) {
List<BusProcessApprove> busProcessApproves = baseMapper.selectEoByPrcIdAndTask(prcId);
BusProcessApprove busProcessApprove = busProcessApproves.get(0);
String fromValsJson = busProcessApprove.getFromValsJson();
JSONObject jsonObject = JSON.parseObject(fromValsJson);
String[] split = replaceMap.split(",");
String[] split1 = split[0].split(":");
String[] split2 = split[1].split(":");
jsonObject.replace(split1[0],split1[1]);
jsonObject.replace(split2[0],split2[1]);
busProcessApprove.setFromValsJson(jsonObject.toJSONString());
baseMapper.updateById(busProcessApprove);
}
} }
@@ -32,4 +32,6 @@ public class ApproveDataVO {
private String dept; private String dept;
private String prcName;
} }
@@ -1,13 +1,12 @@
package com.adc.da.wkflow.enums; package com.adc.da.wkflow.enums;
import org.apache.commons.codec.binary.StringUtils;
/** /**
* 流程类型枚举类 * 流程类型枚举类
*/ */
public enum FlowTypeEnum { public enum FlowTypeEnum {
BGQXSQLC("1","报告权限申请流程","QXSQ","报告权限申请流程",""), BGQXSQLC("1","报告权限申请流程","QXSQ","报告权限申请流程",""),
SCBGLC("2","上传报告流程","SCBG","上传报告流程",""),
; ;
private String value; private String value;
@@ -0,0 +1,57 @@
package com.adc.da.wkflow.listener.SCBG;
import com.adc.da.login.util.UserUtils;
import com.adc.da.report.dao.mysql.TtReportManageActDao;
import com.adc.da.report.eo.TtReportManageAct;
import com.adc.da.wkflow.business_main.entity.BusProcessApprove;
import com.adc.da.wkflow.business_main.entity.BusProcessNew;
import com.adc.da.wkflow.business_main.service.IBusProcessApproveService;
import com.adc.da.wkflow.business_main.service.IBusProcessNewService;
import com.adc.da.wkflow.listener.FlagEnum;
import com.adc.da.wkflow.util.SpringContextUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.activiti.engine.delegate.DelegateTask;
import org.activiti.engine.delegate.TaskListener;
import java.util.List;
/**
* 上传报告 发起流程
*/
public class oneApplyAfter implements TaskListener {
@Override
public void notify(DelegateTask delegateTask) {
TtReportManageActDao ttReportManageActDao = SpringContextUtil.getBean(TtReportManageActDao.class);
IBusProcessNewService busBean = SpringContextUtil.getBean(IBusProcessNewService.class);
IBusProcessApproveService approveService = SpringContextUtil.getBean(IBusProcessApproveService.class);
//查询task任务
LambdaQueryWrapper<TtReportManageAct> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(TtReportManageAct::getTaskId, delegateTask.getId());
List<TtReportManageAct> ttReportManageActs = ttReportManageActDao.selectList(queryWrapper);
TtReportManageAct ttReportManageAct = new TtReportManageAct();
if (ttReportManageActs.size()>0){
ttReportManageAct = ttReportManageActs.get(0);
}
//构建工作流代办
BusProcessNew busProcessNew = new BusProcessNew();
busProcessNew.setUserId(UserUtils.getUserId());
busProcessNew.setPId(delegateTask.getProcessInstanceId());
busProcessNew.setTaskInfo(delegateTask.getEventName());
busProcessNew.setTaskId(delegateTask.getId());
busProcessNew.setDataId(ttReportManageAct.getDataId());
busBean.save(busProcessNew);
//审批结果
LambdaQueryWrapper<BusProcessApprove> approveWrapper = new LambdaQueryWrapper<>();
approveWrapper.eq(BusProcessApprove::getTaskId, delegateTask.getId());
List<BusProcessApprove> list = approveService.list(approveWrapper);
String fromValsJson = list.get(0).getFromValsJson();
JSONObject object = JSONObject.parseObject(fromValsJson);
String s = object.getString("flag") == "" || object.getString("flag") == null ? FlagEnum.AGREE.getValue() : object.getString("flag");
// 1: 同意 2:退回
delegateTask.setVariable("flag",s);
}
}
@@ -0,0 +1,55 @@
package com.adc.da.wkflow.listener.SCBG;
import com.adc.da.login.util.UserUtils;
import com.adc.da.report.dao.mysql.TtReportManageActDao;
import com.adc.da.report.eo.TtReportManageAct;
import com.adc.da.wkflow.business_main.entity.BusProcessApprove;
import com.adc.da.wkflow.business_main.entity.BusProcessNew;
import com.adc.da.wkflow.business_main.service.IBusProcessApproveService;
import com.adc.da.wkflow.business_main.service.IBusProcessNewService;
import com.adc.da.wkflow.util.SpringContextUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.activiti.engine.delegate.DelegateTask;
import org.activiti.engine.delegate.TaskListener;
import java.util.List;
/**
* 上传报告 发起流程
*/
public class reEditAfter implements TaskListener {
@Override
public void notify(DelegateTask delegateTask) {
TtReportManageActDao ttReportManageActDao = SpringContextUtil.getBean(TtReportManageActDao.class);
IBusProcessNewService busBean = SpringContextUtil.getBean(IBusProcessNewService.class);
IBusProcessApproveService approveService = SpringContextUtil.getBean(IBusProcessApproveService.class);
//查询task任务
LambdaQueryWrapper<TtReportManageAct> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(TtReportManageAct::getTaskId, delegateTask.getId());
List<TtReportManageAct> ttReportManageActs = ttReportManageActDao.selectList(queryWrapper);
TtReportManageAct ttReportManageAct = new TtReportManageAct();
if (ttReportManageActs.size()>0){
ttReportManageAct = ttReportManageActs.get(0);
}
//构建工作流代办
BusProcessNew busProcessNew = new BusProcessNew();
busProcessNew.setUserId(UserUtils.getUserId());
busProcessNew.setPId(delegateTask.getProcessInstanceId());
busProcessNew.setTaskInfo(delegateTask.getEventName());
busProcessNew.setTaskId(delegateTask.getId());
busProcessNew.setDataId(ttReportManageAct.getDataId());
busBean.save(busProcessNew);
//审批结果
LambdaQueryWrapper<BusProcessApprove> approveWrapper = new LambdaQueryWrapper<>();
approveWrapper.eq(BusProcessApprove::getTaskId, delegateTask.getId());
List<BusProcessApprove> list = approveService.list(approveWrapper);
String fromValsJson = list.get(0).getFromValsJson();
JSONObject object = JSONObject.parseObject(fromValsJson);
delegateTask.setVariable("oneApprove",object.getString("oneApprove"));
delegateTask.setVariable("twoApprove",object.getString("twoApprove"));
}
}
@@ -0,0 +1,57 @@
package com.adc.da.wkflow.listener.SCBG;
import com.adc.da.login.util.UserUtils;
import com.adc.da.report.dao.mysql.TtReportManageActDao;
import com.adc.da.report.eo.TtReportManageAct;
import com.adc.da.wkflow.business_main.entity.BusProcessApprove;
import com.adc.da.wkflow.business_main.entity.BusProcessNew;
import com.adc.da.wkflow.business_main.service.IBusProcessApproveService;
import com.adc.da.wkflow.business_main.service.IBusProcessNewService;
import com.adc.da.wkflow.util.SpringContextUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.activiti.engine.delegate.DelegateTask;
import org.activiti.engine.delegate.TaskListener;
import java.util.List;
/**
* 上传报告 发起流程
*/
public class startAfter implements TaskListener {
@Override
public void notify(DelegateTask delegateTask) {
TtReportManageActDao ttReportManageActDao = SpringContextUtil.getBean(TtReportManageActDao.class);
IBusProcessNewService busBean = SpringContextUtil.getBean(IBusProcessNewService.class);
IBusProcessApproveService approveService = SpringContextUtil.getBean(IBusProcessApproveService.class);
//查询task任务
LambdaQueryWrapper<TtReportManageAct> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(TtReportManageAct::getTaskId, delegateTask.getId());
List<TtReportManageAct> ttReportManageActs = ttReportManageActDao.selectList(queryWrapper);
TtReportManageAct ttReportManageAct = new TtReportManageAct();
if (ttReportManageActs.size()>0){
ttReportManageAct = ttReportManageActs.get(0);
}
//构建工作流代办
BusProcessNew busProcessNew = new BusProcessNew();
busProcessNew.setUserId(UserUtils.getUserId());
busProcessNew.setPId(delegateTask.getProcessInstanceId());
busProcessNew.setTaskInfo(delegateTask.getEventName());
busProcessNew.setTaskId(delegateTask.getId());
busProcessNew.setDataId(ttReportManageAct.getDataId());
busBean.save(busProcessNew);
//审批结果
LambdaQueryWrapper<BusProcessApprove> approveWrapper = new LambdaQueryWrapper<>();
approveWrapper.eq(BusProcessApprove::getTaskId, delegateTask.getId());
List<BusProcessApprove> list = approveService.list(approveWrapper);
String fromValsJson = list.get(0).getFromValsJson();
JSONObject object = JSONObject.parseObject(fromValsJson);
//审批人
delegateTask.setVariable("oneApprove",object.getString("oneApprove"));
delegateTask.setVariable("twoApprove",object.getString("twoApprove"));
//发起人
delegateTask.setVariable("userId",object.getString("userId"));
}
}
@@ -0,0 +1,70 @@
package com.adc.da.wkflow.listener.SCBG;
import com.adc.da.login.util.UserUtils;
import com.adc.da.report.dao.mysql.PowerApplyActDao;
import com.adc.da.report.dao.mysql.TtReportManageActDao;
import com.adc.da.report.eo.PowerApplyAct;
import com.adc.da.report.eo.TtReportManageAct;
import com.adc.da.report.service.ITtReportManageActService;
import com.adc.da.wkflow.business_main.entity.BusProcessApprove;
import com.adc.da.wkflow.business_main.entity.BusProcessNew;
import com.adc.da.wkflow.business_main.service.IBusProcessApproveService;
import com.adc.da.wkflow.business_main.service.IBusProcessNewService;
import com.adc.da.wkflow.listener.FlagEnum;
import com.adc.da.wkflow.util.SpringContextUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.activiti.engine.delegate.DelegateTask;
import org.activiti.engine.delegate.TaskListener;
import java.util.List;
/**
* 上传报告 发起流程
*/
public class twoApplyAfter implements TaskListener {
@Override
public void notify(DelegateTask delegateTask) {
PowerApplyActDao powerApplyActDao = SpringContextUtil.getBean(PowerApplyActDao.class);
TtReportManageActDao ttReportManageActDao = SpringContextUtil.getBean(TtReportManageActDao.class);
ITtReportManageActService ttReportManageActService = SpringContextUtil.getBean(ITtReportManageActService.class);
IBusProcessNewService busBean = SpringContextUtil.getBean(IBusProcessNewService.class);
IBusProcessApproveService approveService = SpringContextUtil.getBean(IBusProcessApproveService.class);
//查询task任务
LambdaQueryWrapper<TtReportManageAct> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(TtReportManageAct::getTaskId, delegateTask.getId());
List<TtReportManageAct> ttReportManageActs = ttReportManageActDao.selectList(queryWrapper);
TtReportManageAct ttReportManageAct = new TtReportManageAct();
if (ttReportManageActs.size()>0){
ttReportManageAct = ttReportManageActs.get(0);
List<PowerApplyAct> powerApplyActs = powerApplyActDao.selectActListBydataId(ttReportManageAct.getCreateUserId());
for (PowerApplyAct powerApplyAct : powerApplyActs) {
powerApplyAct.setReportId(ttReportManageAct.getId());
}
ttReportManageAct.setPowerList(powerApplyActs);
}
//构建工作流代办
BusProcessNew busProcessNew = new BusProcessNew();
busProcessNew.setUserId(UserUtils.getUserId());
busProcessNew.setPId(delegateTask.getProcessInstanceId());
busProcessNew.setTaskInfo(delegateTask.getEventName());
busProcessNew.setTaskId(delegateTask.getId());
busProcessNew.setDataId(ttReportManageAct.getDataId());
busBean.save(busProcessNew);
//审批结果
LambdaQueryWrapper<BusProcessApprove> approveWrapper = new LambdaQueryWrapper<>();
approveWrapper.eq(BusProcessApprove::getTaskId, delegateTask.getId());
List<BusProcessApprove> list = approveService.list(approveWrapper);
String fromValsJson = list.get(0).getFromValsJson();
JSONObject object = JSONObject.parseObject(fromValsJson);
String s = object.getString("flag") == "" || object.getString("flag") == null ? FlagEnum.AGREE.getValue() : object.getString("flag");
// 1: 同意 2:退回
delegateTask.setVariable("flag",s);
if ("1".equals(s)){
ttReportManageActService.saveReport(ttReportManageAct);
}
}
}
@@ -19,7 +19,7 @@ import java.util.List;
/** /**
* 权限申请流程 发起流程 * 权限申请流程 发起流程
*/ */
public class aid2 implements TaskListener { public class oneApplyAfter implements TaskListener {
@Override @Override
public void notify(DelegateTask delegateTask) { public void notify(DelegateTask delegateTask) {
@@ -29,6 +29,7 @@ public class aid2 implements TaskListener {
//查询task任务 //查询task任务
LambdaQueryWrapper<PowerApplyAct> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<PowerApplyAct> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(PowerApplyAct::getTaskId, delegateTask.getId()); queryWrapper.eq(PowerApplyAct::getTaskId, delegateTask.getId());
queryWrapper.eq(PowerApplyAct::getDelFlag, 0);
List<PowerApplyAct> powerApplyActs = powerApplyActDao.selectList(queryWrapper); List<PowerApplyAct> powerApplyActs = powerApplyActDao.selectList(queryWrapper);
PowerApplyAct powerApplyAct = new PowerApplyAct(); PowerApplyAct powerApplyAct = new PowerApplyAct();
if (powerApplyActs.size()>0){ if (powerApplyActs.size()>0){
@@ -54,5 +55,8 @@ public class aid2 implements TaskListener {
String s = object.getString("flag") == "" || object.getString("flag") == null ? FlagEnum.AGREE.getValue() : object.getString("flag"); String s = object.getString("flag") == "" || object.getString("flag") == null ? FlagEnum.AGREE.getValue() : object.getString("flag");
// 1: 同意 2:退回 // 1: 同意 2:退回
delegateTask.setVariable("flag",s); delegateTask.setVariable("flag",s);
//审批人
delegateTask.setVariable("oneApprove",object.getString("oneApprove"));
delegateTask.setVariable("twoApprove",object.getString("twoApprove"));
} }
} }
@@ -2,8 +2,8 @@ package com.adc.da.wkflow.listener.powerApply;
import com.adc.da.login.util.UserUtils; import com.adc.da.login.util.UserUtils;
import com.adc.da.report.dao.mysql.PowerApplyActDao; import com.adc.da.report.dao.mysql.PowerApplyActDao;
import com.adc.da.report.dao.mysql.PowerApplyDao;
import com.adc.da.report.eo.PowerApplyAct; import com.adc.da.report.eo.PowerApplyAct;
import com.adc.da.report.service.IPowerApplyService;
import com.adc.da.wkflow.business_main.entity.BusProcessApprove; import com.adc.da.wkflow.business_main.entity.BusProcessApprove;
import com.adc.da.wkflow.business_main.entity.BusProcessNew; import com.adc.da.wkflow.business_main.entity.BusProcessNew;
import com.adc.da.wkflow.business_main.service.IBusProcessApproveService; import com.adc.da.wkflow.business_main.service.IBusProcessApproveService;
@@ -20,17 +20,18 @@ import java.util.List;
/** /**
* 权限申请流程 发起流程 * 权限申请流程 发起流程
*/ */
public class aid3 implements TaskListener { public class reEditAfter implements TaskListener {
@Override @Override
public void notify(DelegateTask delegateTask) { public void notify(DelegateTask delegateTask) {
PowerApplyActDao powerApplyActDao = SpringContextUtil.getBean(PowerApplyActDao.class); PowerApplyActDao powerApplyActDao = SpringContextUtil.getBean(PowerApplyActDao.class);
PowerApplyDao powerApplyDao = SpringContextUtil.getBean(PowerApplyDao.class); IPowerApplyService iPowerApplyService = SpringContextUtil.getBean(IPowerApplyService.class);
IBusProcessNewService busBean = SpringContextUtil.getBean(IBusProcessNewService.class); IBusProcessNewService busBean = SpringContextUtil.getBean(IBusProcessNewService.class);
IBusProcessApproveService approveService = SpringContextUtil.getBean(IBusProcessApproveService.class); IBusProcessApproveService approveService = SpringContextUtil.getBean(IBusProcessApproveService.class);
//查询task任务 //查询task任务
LambdaQueryWrapper<PowerApplyAct> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<PowerApplyAct> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(PowerApplyAct::getTaskId, delegateTask.getId()); queryWrapper.eq(PowerApplyAct::getTaskId, delegateTask.getId());
queryWrapper.eq(PowerApplyAct::getDelFlag, 0);
List<PowerApplyAct> powerApplyActs = powerApplyActDao.selectList(queryWrapper); List<PowerApplyAct> powerApplyActs = powerApplyActDao.selectList(queryWrapper);
PowerApplyAct powerApplyAct = new PowerApplyAct(); PowerApplyAct powerApplyAct = new PowerApplyAct();
if (powerApplyActs.size()>0){ if (powerApplyActs.size()>0){
@@ -54,10 +55,13 @@ public class aid3 implements TaskListener {
String fromValsJson = list.get(0).getFromValsJson(); String fromValsJson = list.get(0).getFromValsJson();
JSONObject object = JSONObject.parseObject(fromValsJson); JSONObject object = JSONObject.parseObject(fromValsJson);
String s = object.getString("flag") == "" || object.getString("flag") == null ? FlagEnum.AGREE.getValue() : object.getString("flag"); String s = object.getString("flag") == "" || object.getString("flag") == null ? FlagEnum.AGREE.getValue() : object.getString("flag");
//审批人
delegateTask.setVariable("oneApprove",object.getString("oneApprove"));
delegateTask.setVariable("twoApprove",object.getString("twoApprove"));
// 1: 同意 2:退回 // 1: 同意 2:退回
delegateTask.setVariable("flag",s); delegateTask.setVariable("flag",s);
if ("1".equals(s)){ if ("1".equals(s)){
powerApplyDao.saveBatch(powerApplyActs); iPowerApplyService.saveBatch(powerApplyActs);
} }
} }
@@ -18,7 +18,7 @@ import java.util.List;
/** /**
* 权限申请流程 发起流程 * 权限申请流程 发起流程
*/ */
public class aid1 implements TaskListener { public class startAfter implements TaskListener {
@Override @Override
public void notify(DelegateTask delegateTask) { public void notify(DelegateTask delegateTask) {
@@ -28,6 +28,7 @@ public class aid1 implements TaskListener {
//查询task任务 //查询task任务
LambdaQueryWrapper<PowerApplyAct> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<PowerApplyAct> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(PowerApplyAct::getTaskId, delegateTask.getId()); queryWrapper.eq(PowerApplyAct::getTaskId, delegateTask.getId());
queryWrapper.eq(PowerApplyAct::getDelFlag, 0);
List<PowerApplyAct> powerApplyActs = powerApplyActDao.selectList(queryWrapper); List<PowerApplyAct> powerApplyActs = powerApplyActDao.selectList(queryWrapper);
PowerApplyAct powerApplyAct = new PowerApplyAct(); PowerApplyAct powerApplyAct = new PowerApplyAct();
if (powerApplyActs.size()>0){ if (powerApplyActs.size()>0){
@@ -35,12 +36,10 @@ public class aid1 implements TaskListener {
} }
//构建工作流代办 //构建工作流代办
BusProcessNew busProcessNew = new BusProcessNew(); BusProcessNew busProcessNew = new BusProcessNew();
// busProcessNew.setUserId(powerApplyAct.getUpdateUserId());
busProcessNew.setUserId(UserUtils.getUserId()); busProcessNew.setUserId(UserUtils.getUserId());
busProcessNew.setPId(delegateTask.getProcessInstanceId()); busProcessNew.setPId(delegateTask.getProcessInstanceId());
busProcessNew.setTaskInfo(delegateTask.getEventName()); busProcessNew.setTaskInfo(delegateTask.getEventName());
busProcessNew.setTaskId(delegateTask.getId()); busProcessNew.setTaskId(delegateTask.getId());
// busProcessNew.set(FlowTypeEnum.BGQXSQLC.getValue());
busProcessNew.setDataId(powerApplyAct.getDataId()); busProcessNew.setDataId(powerApplyAct.getDataId());
busBean.save(busProcessNew); busBean.save(busProcessNew);
@@ -18,7 +18,7 @@ import java.util.List;
/** /**
* 权限申请流程 发起流程 * 权限申请流程 发起流程
*/ */
public class aid4 implements TaskListener { public class twoApplyAfter implements TaskListener {
@Override @Override
public void notify(DelegateTask delegateTask) { public void notify(DelegateTask delegateTask) {
@@ -10,6 +10,9 @@ import org.activiti.engine.repository.ProcessDefinition;
import org.activiti.engine.runtime.ProcessInstance; import org.activiti.engine.runtime.ProcessInstance;
import org.activiti.engine.task.Task; import org.activiti.engine.task.Task;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@@ -177,12 +180,19 @@ public class ActivitiTools {
map.put("assignee", model.getAssignee()); map.put("assignee", model.getAssignee());
map.put("category", model.getCategory()); map.put("category", model.getCategory());
map.put("claimTime", model.getClaimTime()); map.put("claimTime", model.getClaimTime());
map.put("createTime", model.getCreateTime()); LocalDateTime dt = LocalDateTime.ofInstant(model.getCreateTime().toInstant(), ZoneId.systemDefault());
String createTime = dt.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
map.put("createTime",createTime);
map.put("deleteReason", model.getDeleteReason()); map.put("deleteReason", model.getDeleteReason());
map.put("description", model.getDescription()); map.put("description", model.getDescription());
map.put("dueDate", model.getDueDate()); map.put("dueDate", model.getDueDate());
map.put("drationInMillis", model.getDurationInMillis()); map.put("drationInMillis", model.getDurationInMillis());
map.put("endTime", model.getEndTime()); String endTime = null;
if (model.getEndTime() != null){
LocalDateTime end = LocalDateTime.ofInstant(model.getEndTime().toInstant(), ZoneId.systemDefault());
endTime = end.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
}
map.put("endTime", endTime);
map.put("executionId", model.getExecutionId()); map.put("executionId", model.getExecutionId());
map.put("formKey", model.getFormKey()); map.put("formKey", model.getFormKey());
map.put("id", model.getId()); map.put("id", model.getId());
@@ -6,4 +6,10 @@
select * from bus_process_approve where prc_id = #{prcId} select * from bus_process_approve where prc_id = #{prcId}
Order by CREATE_DATE desc Order by CREATE_DATE desc
</select> </select>
<select id="selectEoByDataId" resultType="com.adc.da.wkflow.business_main.entity.BusProcessApprove">
select * from bus_process_approve where data_id =#{dataId}
</select>
<select id="selectEoByTask" resultType="com.adc.da.wkflow.business_main.entity.BusProcessApprove">
select * from bus_process_approve where task_id =#{taskId}
</select>
</mapper> </mapper>