diff --git a/adc-da-login/src/main/java/com/adc/da/login/config/ShiroFilterConfiguration.java b/adc-da-login/src/main/java/com/adc/da/login/config/ShiroFilterConfiguration.java index 2b3493c..03f89b2 100644 --- a/adc-da-login/src/main/java/com/adc/da/login/config/ShiroFilterConfiguration.java +++ b/adc-da-login/src/main/java/com/adc/da/login/config/ShiroFilterConfiguration.java @@ -121,7 +121,7 @@ public class ShiroFilterConfiguration { filterChainDefinitionMap.put(restPath + "/updatePassword", ANON); filterChainDefinitionMap.put(restPath + "/user/supplierRegistry/*", ANON); -// filterChainDefinitionMap.put(restPath + "/**", AUTHC); + filterChainDefinitionMap.put(restPath + "/**", AUTHC); /* static 不需登录 */ filterChainDefinitionMap.put("/static/**", ANON); @@ -130,6 +130,7 @@ public class ShiroFilterConfiguration { filterChainDefinitionMap.put("/userfiles/**", ANON); filterChainDefinitionMap.put(adminPath + LOGIN, AUTHC); filterChainDefinitionMap.put(adminPath + "/logout", "logout"); +// filterChainDefinitionMap.put(restPath + "/**", "logout"); filterChainDefinitionMap.put("/swagger-ui.html", ANON); /* 流程需要 */ filterChainDefinitionMap.put(restPath + "/service/model/**", ANON); diff --git a/adc-da-login/src/main/java/com/adc/da/login/security/AdcFormAuthenticationFilter.java b/adc-da-login/src/main/java/com/adc/da/login/security/AdcFormAuthenticationFilter.java index eb3a027..8e440b5 100644 --- a/adc-da-login/src/main/java/com/adc/da/login/security/AdcFormAuthenticationFilter.java +++ b/adc-da-login/src/main/java/com/adc/da/login/security/AdcFormAuthenticationFilter.java @@ -1,11 +1,8 @@ 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.subject.Subject; 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.util.WebUtils; 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); } + @Override protected boolean onAccessDenied(ServletRequest request, ServletResponse response) throws Exception { Subject subject = this.getSubject(request, response); diff --git a/adc-da-main/src/main/java/com/adc/da/main/config/WebMvcConfig.java b/adc-da-main/src/main/java/com/adc/da/main/config/WebMvcConfig.java index da045a1..968ab09 100644 --- a/adc-da-main/src/main/java/com/adc/da/main/config/WebMvcConfig.java +++ b/adc-da-main/src/main/java/com/adc/da/main/config/WebMvcConfig.java @@ -21,7 +21,7 @@ public class WebMvcConfig implements WebMvcConfigurer { @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { // /home/file/**为前端URL访问路径 后面 file:xxxx为本地磁盘映射 - registry.addResourceHandler(picPath+"**").addResourceLocations("file://"+uploadFile); + registry.addResourceHandler(picPath + "**").addResourceLocations("file:" + uploadFile); } } diff --git a/adc-da-main/src/main/resources/application-dev.properties b/adc-da-main/src/main/resources/application-dev.properties index 4231dbe..aa2e423 100644 --- a/adc-da-main/src/main/resources/application-dev.properties +++ b/adc-da-main/src/main/resources/application-dev.properties @@ -18,7 +18,7 @@ #spring.datasource.password = adc_forecast -#kylin数据库 ds1 +#kylin\u6570\u636E\u5E93 ds1 #spring.datasource.kylin.name=PROJECT_MI #spring.datasource.kylin.driverClassName=org.apache.kylin.jdbc.Driver #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.poolSize=10 # -##mysql数据库 ds2 +##mysql\u6570\u636E\u5E93 ds2 #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.username = root #spring.datasource.mysql.password = root 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.password = hzwlsoft.com -#后端端口 +#\u540E\u7AEF\u7AEF\u53E3 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时生效,设置错误登录出现验证码的阈值,默认为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 -#密码Base64加密开关,true为开启,false为关闭 +#\u5BC6\u7801Base64\u52A0\u5BC6\u5F00\u5173,true\u4E3A\u5F00\u542F,false\u4E3A\u5173\u95ED isPassEncrypted=true #{ #"password": "YWJjMTIz", #"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 @@ -61,12 +61,13 @@ swaggerLevel=0 # #picPath=/EPR/file/home/pic/ -# 本地存储文件的磁盘地址 -uploadFile=D:\\work\\idea\\changan\\ -# 本地文件访问的url地址 +# \u672C\u5730\u5B58\u50A8\u6587\u4EF6\u7684\u78C1\u76D8\u5730\u5740 +#uploadFile=D:\\work\\idea\\changan\\ +#uploadFile=D:\\uploadfile\\tmp\\ +uploadFile=/data/DeploymentPackage/report_library/uploadfile/ +# \u672C\u5730\u6587\u4EF6\u8BBF\u95EE\u7684url\u5730\u5740 picPath=/api/home/pic/ - serverIp=http://127.0.0.1:7060/ @@ -86,50 +87,52 @@ MAIL_POP_PORT=110 #MAIL_USERNAME=64459@Any3.com #MAIL_PASSWORD=65316975Xiaoq -IPANDPORT=http://localhost:7061/ +# \u4FEE\u6539\u6210\u540E\u7AEF\u670D\u52A1\u5668\u5730\u5740 +IPANDPORT=http://localhost:7060/ #redis -#Redis服务器地址 -spring.redis.host=192.168.144.29 -#spring.redis.host=localhost -## Redis服务器连接端口 +#Redis\u670D\u52A1\u5668\u5730\u5740 +spring.redis.host=10.10.10.44 +## Redis\u670D\u52A1\u5668\u8FDE\u63A5\u7AEF\u53E3 spring.redis.port=6379 -## Redis服务器连接密码(默认为空) -spring.redis.password=123321 -## 连接超时时间(毫秒) +## Redis\u670D\u52A1\u5668\u8FDE\u63A5\u5BC6\u7801\uFF08\u9ED8\u8BA4\u4E3A\u7A7A\uFF09 +spring.redis.password=123456 +## \u8FDE\u63A5\u8D85\u65F6\u65F6\u95F4\uFF08\u6BEB\u79D2\uFF09 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 -##连接池中的最小空闲连接,默认值是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 -## 如果赋值为-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 -## 等待可用连接的最大时间,单位毫秒,默认值为-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.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 -# ======= 阿里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.accessKeyId= LTAI5tBmUfVF6Z8R6sHTdTG7 aliyun.OSS.accessKeySecret= mY6UvWv20Tg2R46ORe6uV5gL6TQloC 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.accessKey=EEMAGYTHP9KKPF18TZCL huawei.OBS.secretKey=3NmFNf1uX3EV1LbCEzgw6gDv0tZ6WAVwG37BGq1p 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 # ==== IAM???? iam.url=https://iamuat.faw-vw.com/ iam.appkey=xxxx -iam.appSecret=xxx - +iam.appSecret=xxx \ No newline at end of file diff --git a/adc-da-main/target/classes/application-dev.properties b/adc-da-main/target/classes/application-dev.properties index 4231dbe..1d60734 100644 --- a/adc-da-main/target/classes/application-dev.properties +++ b/adc-da-main/target/classes/application-dev.properties @@ -18,7 +18,7 @@ #spring.datasource.password = adc_forecast -#kylin数据库 ds1 +#kylin\u6570\u636E\u5E93 ds1 #spring.datasource.kylin.name=PROJECT_MI #spring.datasource.kylin.driverClassName=org.apache.kylin.jdbc.Driver #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.poolSize=10 # -##mysql数据库 ds2 +##mysql\u6570\u636E\u5E93 ds2 #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.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.password = hzwlsoft.com -#后端端口 +#\u540E\u7AEF\u7AEF\u53E3 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时生效,设置错误登录出现验证码的阈值,默认为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 -#密码Base64加密开关,true为开启,false为关闭 +#\u5BC6\u7801Base64\u52A0\u5BC6\u5F00\u5173,true\u4E3A\u5F00\u542F,false\u4E3A\u5173\u95ED isPassEncrypted=true #{ #"password": "YWJjMTIz", #"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 @@ -61,9 +61,14 @@ swaggerLevel=0 # #picPath=/EPR/file/home/pic/ -# 本地存储文件的磁盘地址 -uploadFile=D:\\work\\idea\\changan\\ -# 本地文件访问的url地址 +# \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 +localSaveFileType=settled +#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/ @@ -89,42 +94,42 @@ MAIL_POP_PORT=110 IPANDPORT=http://localhost:7061/ #redis -#Redis服务器地址 +#Redis\u670D\u52A1\u5668\u5730\u5740 spring.redis.host=192.168.144.29 #spring.redis.host=localhost -## Redis服务器连接端口 +## Redis\u670D\u52A1\u5668\u8FDE\u63A5\u7AEF\u53E3 spring.redis.port=6379 -## Redis服务器连接密码(默认为空) +## Redis\u670D\u52A1\u5668\u8FDE\u63A5\u5BC6\u7801\uFF08\u9ED8\u8BA4\u4E3A\u7A7A\uFF09 spring.redis.password=123321 -## 连接超时时间(毫秒) +## \u8FDE\u63A5\u8D85\u65F6\u65F6\u95F4\uFF08\u6BEB\u79D2\uFF09 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 -##连接池中的最小空闲连接,默认值是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 -## 如果赋值为-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 -## 等待可用连接的最大时间,单位毫秒,默认值为-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.database=6 -# 上传方式:阿里云:alioss 华为云:hwobs +# \u4E0A\u4F20\u65B9\u5F0F\uFF1A\u963F\u91CC\u4E91\uFF1Aalioss \u534E\u4E3A\u4E91\uFF1Ahwobs \u672C\u5730\uFF1Alocal uploadType: hwobs -# ======= 阿里OSS配置 ========= +# ======= \u963F\u91CCOSS\u914D\u7F6E ========= aliyun.OSS.endpoint=https://oss-cn-hangzhou.aliyuncs.com aliyun.OSS.accessKeyId= LTAI5tBmUfVF6Z8R6sHTdTG7 aliyun.OSS.accessKeySecret= mY6UvWv20Tg2R46ORe6uV5gL6TQloC 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.accessKey=EEMAGYTHP9KKPF18TZCL huawei.OBS.secretKey=3NmFNf1uX3EV1LbCEzgw6gDv0tZ6WAVwG37BGq1p 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 diff --git a/adc-da-report/pom.xml b/adc-da-report/pom.xml index acde4b8..e38e5bf 100644 --- a/adc-da-report/pom.xml +++ b/adc-da-report/pom.xml @@ -118,7 +118,6 @@ spring-boot-starter-data-redis - diff --git a/adc-da-report/src/main/java/com/adc/da/report/controller/PowerApplyController.java b/adc-da-report/src/main/java/com/adc/da/report/controller/PowerApplyController.java index dc8edcd..6e71427 100644 --- a/adc-da-report/src/main/java/com/adc/da/report/controller/PowerApplyController.java +++ b/adc-da-report/src/main/java/com/adc/da/report/controller/PowerApplyController.java @@ -2,8 +2,10 @@ package com.adc.da.report.controller; 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.vo.DeleteParamRequestVO; +import com.adc.da.report.vo.PowerApplyActPageVO; import com.adc.da.report.vo.PowerApplyPageVO; import com.adc.da.util.http.ResponseMessage; import com.adc.da.util.http.Result; @@ -32,6 +34,9 @@ public class PowerApplyController { @Autowired private IPowerApplyService powerApplyService; + @Autowired + private IPowerApplyActService iPowerApplyActService; + /** * @param powerApplyPageVO * @return com.adc.da.util.http.ResponseMessage @@ -107,7 +112,7 @@ public class PowerApplyController { * @date 2023-04-23 * @description 根据id或id数组进行删除 */ - @DeleteMapping("/delete") + @PostMapping("/delete") @ApiOperation(value = "单条/批量删除数据") public ResponseMessage delete(@RequestBody DeleteParamRequestVO deleteParamRequestVO){ @@ -115,4 +120,20 @@ public class PowerApplyController { powerApplyService.deleteById(deleteParamRequestVO); 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(); + } } diff --git a/adc-da-report/src/main/java/com/adc/da/report/controller/ReportManageConroller.java b/adc-da-report/src/main/java/com/adc/da/report/controller/ReportManageConroller.java index 0910740..2916ee5 100644 --- a/adc-da-report/src/main/java/com/adc/da/report/controller/ReportManageConroller.java +++ b/adc-da-report/src/main/java/com/adc/da/report/controller/ReportManageConroller.java @@ -1,10 +1,12 @@ package com.adc.da.report.controller; 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.ReportEntity; import com.adc.da.report.service.IFileService; 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.ObsBootUtil; import com.adc.da.report.vo.ReportQueryVo; @@ -26,6 +28,7 @@ import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.*; +import java.net.URISyntaxException; import java.net.URLEncoder; import java.text.ParseException; import java.text.SimpleDateFormat; @@ -62,9 +65,14 @@ public class ReportManageConroller { @Autowired private ObsBootUtil obsBootUtil; + @Autowired + private LocalFileUtil localFileUtil; + @Value("${uploadType}") private String uploadType; + @Autowired + private ReportDao reportDao; /** * 新增或编辑报告 @@ -74,28 +82,37 @@ public class ReportManageConroller { @ApiOperation("新增或编辑报告") @PostMapping("/add") @ReportLog(description = "新增或编辑") - public ResponseMessage add(@RequestBody ReportVo vo) { + public ResponseMessage add(@RequestBody ReportVo vo) throws IOException { + Map map = new HashMap<>(); ReportEntity entity = new ReportEntity(); BeanUtils.copyProperties(vo, entity); + /** + * 名称不能重复 + */ + long count = reportDao.selectByidAndName(entity); + if (count>0){ + return Result.error("报告名称已存在"); + } String name = reportService.insert(entity, vo.getLabelList()); - Map map = new HashMap<>(); map.put("reportName", name); return Result.success(map); } /** - * 报告列表 + * 报告管理列表 * @param vo * @return * @throws Exception */ - @ApiOperation("报告列表") - @PostMapping("/list") - public ResponseMessage list(@RequestBody ReportQueryVo vo) throws Exception { - IPage list = reportService.list(vo); + @ApiOperation("报告管理列表") + @PostMapping("/reportManagerPage") + public ResponseMessage reportManagerPage(@RequestBody ReportQueryVo vo) throws Exception { + IPage list = reportService.reportManagerPage(vo); return Result.success(list); } + + /** * 报告列表 * @param vo @@ -109,19 +126,6 @@ public class ReportManageConroller { return Result.success(list); } - /** - * 报告列表(带权限验证) - * @param vo - * @return - * @throws Exception - */ - @ApiOperation("报告列表(带权限)") - @PostMapping("/list-auth") - public ResponseMessage listWithAuth(@RequestBody ReportQueryVo vo) throws Exception { - IPage list = reportService.list(vo); - return Result.success(list); - } - /** * 删除报告 * @param ids id @@ -174,7 +178,17 @@ public class ReportManageConroller { stringRedisTemplate.boundValueOps("1121212").set("1212"); } - + @ApiOperation("testPath") + @GetMapping("/testPath") + @Deprecated + public ResponseMessage testPath() throws URISyntaxException { + HashMap 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); + } /** * 上传文件 @@ -209,10 +223,12 @@ public class ReportManageConroller { try{ String result=""; // 上传方式:阿里云:alioss 华为云:hwobs - if (uploadType.equals("hwobs")){ + if ("hwobs".equals(uploadType)){ result = obsBootUtil.upload(file, fileName); - }else if (uploadType.equals("alioss")){ + }else if ("alioss".equals(uploadType)) { result = ossClientUtil.uploadFile2OSS(file.getInputStream(),fileName); + }else if ("local".equals(uploadType)) { + localFileUtil.saveFile(file.getInputStream(), fileName); } resultMap.put("key", date + num); resultMap.put("value", path + "//" + fileName); @@ -324,10 +340,12 @@ public class ReportManageConroller { response.setContentType("application/x-download"); // File file = new File(uploadFile, entity.getSavePath()); // 上传方式:阿里云:alioss 华为云:hwobs - if (uploadType.equals("hwobs")){ + if ("hwobs".equals(uploadType)){ obsBootUtil.downFile(entity.getSavePath(), response); - }else if (uploadType.equals("alioss")){ + }else if ("alioss".equals(uploadType)){ ossClientUtil.downloadFileFromOSS(entity.getSavePath(),response); + }else if ("local".equals(uploadType)){ + localFileUtil.downFile(entity.getSavePath(), response); } } catch (Exception ex) { @@ -348,4 +366,16 @@ public class ReportManageConroller { return Result.success(reportVoIPage); } + /** + * 判断报告是否在流程中 + * @return + * @throws ParseException + */ + @ApiOperation("判断报告是否在流程中") + @PostMapping("/isAct") + public ResponseMessage isAct(@RequestBody ReportQueryVo vo) throws Exception { + List act = reportService.isAct(vo); + return Result.success(act); + } + } diff --git a/adc-da-report/src/main/java/com/adc/da/report/dao/mysql/PowerApplyActDao.java b/adc-da-report/src/main/java/com/adc/da/report/dao/mysql/PowerApplyActDao.java index dd79f6f..eda274f 100644 --- a/adc-da-report/src/main/java/com/adc/da/report/dao/mysql/PowerApplyActDao.java +++ b/adc-da-report/src/main/java/com/adc/da/report/dao/mysql/PowerApplyActDao.java @@ -47,4 +47,7 @@ public interface PowerApplyActDao extends BaseMapper { List selectListBydataId(@Param("dataId")String dataId); + List selectListBydataIdNodel(@Param("dataId")String dataId); + + int batchDel(@Param("ids") List ids); } diff --git a/adc-da-report/src/main/java/com/adc/da/report/dao/mysql/ReportContentDao.java b/adc-da-report/src/main/java/com/adc/da/report/dao/mysql/ReportContentDao.java new file mode 100644 index 0000000..5ff3602 --- /dev/null +++ b/adc-da-report/src/main/java/com/adc/da/report/dao/mysql/ReportContentDao.java @@ -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 { + +} + + + + diff --git a/adc-da-report/src/main/java/com/adc/da/report/dao/mysql/ReportDao.java b/adc-da-report/src/main/java/com/adc/da/report/dao/mysql/ReportDao.java index 1d9fc2b..65b48c8 100644 --- a/adc-da-report/src/main/java/com/adc/da/report/dao/mysql/ReportDao.java +++ b/adc-da-report/src/main/java/com/adc/da/report/dao/mysql/ReportDao.java @@ -24,16 +24,39 @@ public interface ReportDao extends BaseMapper { * @param idSet * @return */ - IPage list(IPage page, @Param("Vo") ReportQueryVo vo, @Param("idSet") Set idSet); + IPage list(IPage page, @Param("Vo") ReportQueryVo vo, @Param("idSet") Set idSet); /** * 报告日期列表 + * * @param usid * @return */ - List getReportDateList(@Param("usid")String usid); + List getReportDateList(@Param("usid") String usid); IPage getAddReportPage(IPage page, @Param("pageVO") ReportQueryVo vo); - IPage page(IPage page,@Param("pageVO") ReportQueryVo vo); + /** + * 报告列表 + * + * @param page + * @param vo + * @param idSet + * @return + */ + IPage page(IPage page, @Param("pageVO") ReportQueryVo vo, @Param("idSet") Set idSet); + + /** + * 报告列表 + * + * @param page + * @param vo + * @param idSet + * @return + */ + IPage reportManagerPage(IPage page, @Param("Vo") ReportQueryVo vo, @Param("idSet") Set idSet); + + List isAct(@Param("Vo") ReportQueryVo vo); + + long selectByidAndName(@Param("Vo")ReportEntity entity); } diff --git a/adc-da-report/src/main/java/com/adc/da/report/eo/ReportContentEntity.java b/adc-da-report/src/main/java/com/adc/da/report/eo/ReportContentEntity.java new file mode 100644 index 0000000..86feeb8 --- /dev/null +++ b/adc-da-report/src/main/java/com/adc/da/report/eo/ReportContentEntity.java @@ -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; +} \ No newline at end of file diff --git a/adc-da-report/src/main/java/com/adc/da/report/service/IPowerApplyActService.java b/adc-da-report/src/main/java/com/adc/da/report/service/IPowerApplyActService.java index 5636464..855e458 100644 --- a/adc-da-report/src/main/java/com/adc/da/report/service/IPowerApplyActService.java +++ b/adc-da-report/src/main/java/com/adc/da/report/service/IPowerApplyActService.java @@ -1,7 +1,6 @@ package com.adc.da.report.service; import com.adc.da.report.eo.PowerApplyAct; -import com.adc.da.report.vo.DeleteParamRequestVO; import com.adc.da.report.vo.PowerApplyActPageVO; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; @@ -48,11 +47,11 @@ public interface IPowerApplyActService { /** - * @param deleteParamVO + * @param powerApplyActPageVO * @return void * @author bu * @date 2023-04-23 * @description 根据id或id数组进行删除 */ - public void deleteById(DeleteParamRequestVO deleteParamVO); + public void deleteByListPower(PowerApplyActPageVO powerApplyActPageVO); } diff --git a/adc-da-report/src/main/java/com/adc/da/report/service/IPowerApplyService.java b/adc-da-report/src/main/java/com/adc/da/report/service/IPowerApplyService.java index 1f146f8..0e273a0 100644 --- a/adc-da-report/src/main/java/com/adc/da/report/service/IPowerApplyService.java +++ b/adc-da-report/src/main/java/com/adc/da/report/service/IPowerApplyService.java @@ -1,6 +1,7 @@ package com.adc.da.report.service; 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.PowerApplyPageVO; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; @@ -55,4 +56,6 @@ public interface IPowerApplyService { * @description 根据id或id数组进行删除 */ public void deleteById(DeleteParamRequestVO deleteParamVO); + + void saveBatch(List powerApplyActs); } diff --git a/adc-da-report/src/main/java/com/adc/da/report/service/IReportContentService.java b/adc-da-report/src/main/java/com/adc/da/report/service/IReportContentService.java new file mode 100644 index 0000000..37ce02d --- /dev/null +++ b/adc-da-report/src/main/java/com/adc/da/report/service/IReportContentService.java @@ -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 { + + + /** + * 插入报告内容表 + * + * @param reportId 报告id + * @param fileId 文件id + */ + void insertReportContent(String reportId, String fileId) throws IOException; +} diff --git a/adc-da-report/src/main/java/com/adc/da/report/service/IReportService.java b/adc-da-report/src/main/java/com/adc/da/report/service/IReportService.java index 11da10c..b253118 100644 --- a/adc-da-report/src/main/java/com/adc/da/report/service/IReportService.java +++ b/adc-da-report/src/main/java/com/adc/da/report/service/IReportService.java @@ -5,6 +5,7 @@ import com.adc.da.report.vo.ReportQueryVo; import com.adc.da.report.vo.ReportVo; import com.baomidou.mybatisplus.core.metadata.IPage; +import java.io.IOException; import java.util.List; /** @@ -20,14 +21,7 @@ public interface IReportService { * @param labelList * @return 报告名称 */ - String insert(ReportEntity entity, List labelList); - - /** - * 报告列表展示 - * @param vo - * @return - */ - IPage list(ReportQueryVo vo) throws Exception; + String insert(ReportEntity entity, List labelList) throws IOException; /** * 删除报告 @@ -51,4 +45,8 @@ public interface IReportService { IPage addReportPage(ReportQueryVo vo) throws Exception; IPage page(ReportQueryVo vo); + + IPage reportManagerPage(ReportQueryVo vo); + + List isAct(ReportQueryVo vo); } diff --git a/adc-da-report/src/main/java/com/adc/da/report/service/impl/IReportContentServiceImpl.java b/adc-da-report/src/main/java/com/adc/da/report/service/impl/IReportContentServiceImpl.java new file mode 100644 index 0000000..d0a545e --- /dev/null +++ b/adc-da-report/src/main/java/com/adc/da/report/service/impl/IReportContentServiceImpl.java @@ -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 + 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); + } +} + + + + diff --git a/adc-da-report/src/main/java/com/adc/da/report/service/impl/IReportServiceImpl.java b/adc-da-report/src/main/java/com/adc/da/report/service/impl/IReportServiceImpl.java index 36a8088..1270449 100644 --- a/adc-da-report/src/main/java/com/adc/da/report/service/impl/IReportServiceImpl.java +++ b/adc-da-report/src/main/java/com/adc/da/report/service/impl/IReportServiceImpl.java @@ -11,6 +11,7 @@ import com.adc.da.report.eo.FileEntity; import com.adc.da.report.eo.ReportEntity; import com.adc.da.report.eo.ReportLabelEntity; 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.IReportService; import com.adc.da.report.service.ITreeLabelService; @@ -37,6 +38,7 @@ import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.io.FileInputStream; import java.io.FileOutputStream; +import java.io.IOException; import java.text.SimpleDateFormat; import java.util.*; import java.util.stream.Collectors; @@ -90,6 +92,12 @@ public class IReportServiceImpl extends ServiceImpl @Autowired private RoleEODao roleEODao; + @Resource + private IReportContentService iReportContentService; + + @Autowired + private LocalFileUtil localFileUtil; + /** * 新增或编辑报告 * @@ -99,13 +107,13 @@ public class IReportServiceImpl extends ServiceImpl */ @Override @Transactional(rollbackFor = Exception.class) - public String insert(ReportEntity entity, List labelList) { + public String insert(ReportEntity entity, List labelList) throws IOException { SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); if (StringUtils.isEmpty(entity.getId())) { entity.setId(UUID.randomUUID10()); entity.setCreateDate(format.format(new Date())); - entity.setCreateUserId(CommonUtils.getUserId()); + entity.setCreateUserId(UserUtils.getUserId()); entity.setDelFlag("0"); entity.setUpdateDate(format.format(new Date())); reportDao.insert(entity); @@ -124,6 +132,9 @@ public class IReportServiceImpl extends ServiceImpl reportLabelDao.insert(reportLabelEntity); }); + //插入报表内容表 + iReportContentService.insertReportContent(entity.getId() ,entity.getFileId()); + CommonUtils.threadPoolExecutor().execute(() -> { //生成html try { @@ -185,85 +196,6 @@ public class IReportServiceImpl extends ServiceImpl return entity.getName(); } - /** - * 报告列表 - * - * @param vo - * @return - * @throws Exception - */ - @Override - public IPage list(ReportQueryVo vo) throws Exception { - - IPage 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 idSet = new HashSet<>(); - if (Objects.nonNull(vo.getLabelId()) && !vo.getLabelId().isEmpty()) { - LambdaQueryWrapper reportLabelEntityWrapper = new LambdaQueryWrapper<>(); - reportLabelEntityWrapper.eq(ReportLabelEntity::getLabelId, vo.getLabelId().get(vo.getLabelId().size() - 1)); - List reportLabelEntities = reportLabelDao.selectList(reportLabelEntityWrapper); - reportLabelEntities.forEach(reportLabelEntity -> { - idSet.add(reportLabelEntity.getReportId()); - }); - } - // TODO ES模糊查询 - - IPage 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 userIdList = reportUserDao.selectList( - new QueryWrapper().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 labelList = labelList.stream() .sorted(Comparator.comparingInt(List::size).reversed()) .collect(Collectors.toList()); + if (labelList.size() == 0){ + return null; + } return labelList.get(0); } @@ -391,11 +326,154 @@ public class IReportServiceImpl extends ServiceImpl vo.setUsid(UserUtils.getUserId()); } - IPage list = reportDao.page(page, vo); + //按照labelId筛选 + Set idSet = new HashSet<>(); + if (Objects.nonNull(vo.getLabelId()) && !vo.getLabelId().isEmpty()) { + LambdaQueryWrapper reportLabelEntityWrapper = new LambdaQueryWrapper<>(); + reportLabelEntityWrapper.in(ReportLabelEntity::getLabelId, vo.getLabelId()); + List reportLabelEntities = reportLabelDao.selectList(reportLabelEntityWrapper); + reportLabelEntities.forEach(reportLabelEntity -> { + idSet.add(reportLabelEntity.getReportId()); + }); + idSet.add("1"); + } + + IPage 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 userIdList = reportUserDao.selectList( + new QueryWrapper().eq("reportId", c.getId())) + .stream().map(ReportUserEntity::getUserId).collect(Collectors.toList()); + c.setReportUserIdList(userIdList); + }); return list; } + @Override + public IPage reportManagerPage(ReportQueryVo vo) { + IPage page = new Page<>(); + page.setCurrent(vo.getPageNo()); + page.setSize(vo.getPageSize()); + //判断是不是管理员 + boolean admin = false; + List 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 idSet = new HashSet<>(); + if (Objects.nonNull(vo.getLabelId()) && !vo.getLabelId().isEmpty()) { + LambdaQueryWrapper reportLabelEntityWrapper = new LambdaQueryWrapper<>(); + reportLabelEntityWrapper.in(ReportLabelEntity::getLabelId, vo.getLabelId()); + List reportLabelEntities = reportLabelDao.selectList(reportLabelEntityWrapper); + reportLabelEntities.forEach(reportLabelEntity -> { + idSet.add(reportLabelEntity.getReportId()); + }); + idSet.add("1"); + } + + IPage 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 userIdList = reportUserDao.selectList( + new QueryWrapper().eq("reportId", c.getId())) + .stream().map(ReportUserEntity::getUserId).collect(Collectors.toList()); + c.setReportUserIdList(userIdList); + }); + return list; + } + + @Override + public List isAct(ReportQueryVo vo) { + boolean flag = false; + //判断是不是管理员 + boolean admin = false; + List 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 act = baseMapper.isAct(vo); + return act; + } + /** * 创建htmlstring * @@ -408,44 +486,30 @@ public class IReportServiceImpl extends ServiceImpl String path = uploadFile + fileEntity.getSavePath(); FileOutputStream outputStream = new FileOutputStream(path); // 上传方式:阿里云:alioss 华为云:hwobs - if (uploadType.equals("hwobs")) { + if ("hwobs".equals(uploadType)) { obsBootUtil.getFileFromOBS(fileEntity.getSavePath(), outputStream); - } else if (uploadType.equals("alioss")) { + } else if ("alioss".equals(uploadType)) { ossClientUtil.getFileFromOSS(fileEntity.getSavePath(), outputStream); + } else if ("local".equals(uploadType)) { + localFileUtil.getFileFromLocal(fileEntity.getSavePath(), outputStream); } String html = null; - switch (fileEntity.getFileType()) { - //03excel - case "xls": - html = ExcelUtil.excel03Html(new FileInputStream(path)); - break; - //07excel - case "xlsx": - html = ExcelUtil.excel07Html(new FileInputStream(path)); - break; - //03word - case "doc": - html = WordUtil.doc2pdf(new FileInputStream(path), uploadFile, ipAddress); - break; - //07word - case "docx": - 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; + + if (ReportConstants.FILE_EXTENSIONS_XLS.equalsIgnoreCase(fileEntity.getFileType())) { + html = ExcelUtil.excel03Html(new FileInputStream(path)); + } else if (ReportConstants.FILE_EXTENSIONS_XLSX.equalsIgnoreCase(fileEntity.getFileType())) { + html = ExcelUtil.excel07Html(new FileInputStream(path)); + } else if (ReportConstants.FILE_EXTENSIONS_DOC.equalsIgnoreCase(fileEntity.getFileType())) { + html = WordUtil.doc2pdf(new FileInputStream(path), uploadFile, ipAddress); + } else if (ReportConstants.FILE_EXTENSIONS_DOCX.equalsIgnoreCase(fileEntity.getFileType())) { + html = WordUtil.doc2pdf(new FileInputStream(path), uploadFile, ipAddress); + } else if (ReportConstants.FILE_EXTENSIONS_PPT.equalsIgnoreCase(fileEntity.getFileType())) { + html = PptUtil.doPpt2003toImage(new FileInputStream(path), uploadFile, ipAddress); + } else if (ReportConstants.FILE_EXTENSIONS_PPTX.equalsIgnoreCase(fileEntity.getFileType())) { + html = PptUtil.doPpt2007toImage(new FileInputStream(path), uploadFile, ipAddress); + } else if (ReportConstants.FILE_EXTENSIONS_PDF.equalsIgnoreCase(fileEntity.getFileType())) { + html = PdfUtil.pdfStreamToPng(new FileInputStream(path), uploadFile, ipAddress); } FileUtil.deleteFile(path); return html; diff --git a/adc-da-report/src/main/java/com/adc/da/report/service/impl/IpowerApplyActServiceImpl.java b/adc-da-report/src/main/java/com/adc/da/report/service/impl/IpowerApplyActServiceImpl.java index 99c5250..56ff25a 100644 --- a/adc-da-report/src/main/java/com/adc/da/report/service/impl/IpowerApplyActServiceImpl.java +++ b/adc-da-report/src/main/java/com/adc/da/report/service/impl/IpowerApplyActServiceImpl.java @@ -4,7 +4,6 @@ package com.adc.da.report.service.impl; import com.adc.da.report.dao.mysql.PowerApplyActDao; import com.adc.da.report.eo.PowerApplyAct; 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.util.utils.StringUtils; 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 lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; -import org.springframework.util.ObjectUtils; -import java.util.ArrayList; import java.util.List; /** @@ -81,32 +78,21 @@ public class IpowerApplyActServiceImpl extends ServiceImpl 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; - } - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.in(PowerApplyAct::getId,ids); - PowerApplyAct powerApplyAct = new PowerApplyAct(); - powerApplyAct.setDelFlag(1); - baseMapper.update(powerApplyAct,wrapper); + public void deleteByListPower(PowerApplyActPageVO powerApplyActPageVO) { + List powerApplyList = powerApplyActPageVO.getPowerApplyList(); + for (PowerApplyAct powerApplyAct : powerApplyList) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(PowerApplyAct::getPrcId,powerApplyAct.getPrcId()); + wrapper.eq(PowerApplyAct::getReportId,powerApplyAct.getReportId()); + powerApplyAct.setDelFlag(1); + baseMapper.update(powerApplyAct,wrapper); + } } diff --git a/adc-da-report/src/main/java/com/adc/da/report/service/impl/IpowerApplyServiceImpl.java b/adc-da-report/src/main/java/com/adc/da/report/service/impl/IpowerApplyServiceImpl.java index b5b1a52..9f038eb 100644 --- a/adc-da-report/src/main/java/com/adc/da/report/service/impl/IpowerApplyServiceImpl.java +++ b/adc-da-report/src/main/java/com/adc/da/report/service/impl/IpowerApplyServiceImpl.java @@ -1,8 +1,10 @@ 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.eo.PowerApply; +import com.adc.da.report.eo.PowerApplyAct; import com.adc.da.report.service.IPowerApplyService; import com.adc.da.report.vo.DeleteParamRequestVO; 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.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; +import java.util.stream.Collectors; /** * @author bu @@ -27,6 +31,10 @@ import java.util.List; @Service public class IpowerApplyServiceImpl extends ServiceImpl implements IPowerApplyService { + @Autowired + private PowerApplyActDao powerApplyActDao; + + /** * @param powerApplyPageVO * @return @@ -109,5 +117,12 @@ public class IpowerApplyServiceImpl extends ServiceImpl powerApplyActs) { + baseMapper.saveBatch(powerApplyActs); + List ids = powerApplyActs.stream().map(a -> a.getId()).collect(Collectors.toList()); + powerApplyActDao.batchDel(ids); + } + } diff --git a/adc-da-report/src/main/java/com/adc/da/report/util/LocalFileUtil.java b/adc-da-report/src/main/java/com/adc/da/report/util/LocalFileUtil.java new file mode 100644 index 0000000..6204671 --- /dev/null +++ b/adc-da-report/src/main/java/com/adc/da/report/util/LocalFileUtil.java @@ -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(); + } + } +} \ No newline at end of file diff --git a/adc-da-report/src/main/java/com/adc/da/report/util/PageUtils.java b/adc-da-report/src/main/java/com/adc/da/report/util/PageUtils.java new file mode 100644 index 0000000..9c9f964 --- /dev/null +++ b/adc-da-report/src/main/java/com/adc/da/report/util/PageUtils.java @@ -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 List listPage(List 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); + } + +} diff --git a/adc-da-report/src/main/java/com/adc/da/report/util/PdfUtil.java b/adc-da-report/src/main/java/com/adc/da/report/util/PdfUtil.java index 93b699a..9fb2c15 100644 --- a/adc-da-report/src/main/java/com/adc/da/report/util/PdfUtil.java +++ b/adc-da-report/src/main/java/com/adc/da/report/util/PdfUtil.java @@ -4,6 +4,8 @@ import com.adc.da.util.utils.UUID; import lombok.extern.slf4j.Slf4j; import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.pdfbox.rendering.PDFRenderer; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; import sun.misc.BASE64Encoder; import javax.imageio.ImageIO; @@ -14,28 +16,37 @@ import java.util.ArrayList; import java.util.List; @Slf4j +@Component public class PdfUtil { - private PdfUtil(){ - throw new IllegalStateException("Utility class"); + private static String uploadType; + + @Value("${uploadType}") + public void setUploadType(String uploadType) { + PdfUtil.uploadType = uploadType; + } + + private PdfUtil() { + } /** * 截取pdf成图片 + * * @param inputStream * @param targetPath * @param ipAddress * @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); - List list=new ArrayList<>(); + List list = new ArrayList<>(); int pageCount = doc.getNumberOfPages(); BufferedImage image = null; - log.info("开始时间"+System.currentTimeMillis()); + log.info("开始时间" + System.currentTimeMillis()); String fileName = UUID.randomUUID10(); for (int i = 0; i < pageCount; i++) { image = renderer.renderImage(i, 2.0f); @@ -46,32 +57,31 @@ public class PdfUtil { imOut = ImageIO.createImageOutputStream(bs); ImageIO.write(image, "png", imOut); - try(ByteArrayInputStream byteInputStream = new ByteArrayInputStream(bs.toByteArray());){ - File ff=new File(targetPath+"/"+fileName); - if(!ff.exists()){ + try (ByteArrayInputStream byteInputStream = new ByteArrayInputStream(bs.toByteArray());) { + File ff = new File(targetPath + "/" + fileName); + if (!ff.exists()) { ff.mkdirs(); } - File uploadFile = new File(targetPath+"/"+fileName+"/"+i+".png"); - try(FileOutputStream fops = new FileOutputStream(uploadFile);){ + File uploadFile = new File(targetPath + "/" + fileName + "/" + i + ".png"); + try (FileOutputStream fops = new FileOutputStream(uploadFile);) { fops.write(readInputStream(byteInputStream)); - } - catch (Exception e){ - log.error(e.getMessage(),e); + } catch (Exception e) { + log.error(e.getMessage(), e); } - list.add(ipAddress+"api/home/pic"+"/"+fileName+"/"+i+".png"); - } - catch (Exception e){ + list.add(ipAddress + "api/home/pic" + "/" + fileName + "/" + i + ".png"); + + } catch (Exception e) { } } - log.info("结束时间"+System.currentTimeMillis()); + log.info("结束时间" + System.currentTimeMillis()); - String htmlByBase64 = createHtmlByImg(list); + String htmlByBase64 = createHtmlByImg(list); return htmlByBase64; } catch (Exception e) { - log.error(e.getMessage(),e); + log.error(e.getMessage(), e); return ""; } } @@ -88,15 +98,15 @@ public class PdfUtil { buffer.append("\r\n"); - for(int i=0;i"); + for (int i = 0; i < baseList.size(); i++) { + buffer.append(""); } buffer.append(""); try { return buffer.toString(); } catch (Exception e) { - log.error(e.getMessage(),e); + log.error(e.getMessage(), e); return ""; } @@ -109,7 +119,7 @@ public class PdfUtil { public static byte[] readInputStream(InputStream inStream) throws Exception { ByteArrayOutputStream outStream = new ByteArrayOutputStream(); - byte[] buffer = new byte[1024*1024]; + byte[] buffer = new byte[1024 * 1024]; int len = 0; while ((len = inStream.read(buffer)) != -1) { outStream.write(buffer, 0, len); diff --git a/adc-da-report/src/main/java/com/adc/da/report/vo/PowerApplyActPageVO.java b/adc-da-report/src/main/java/com/adc/da/report/vo/PowerApplyActPageVO.java index e460e29..3e625e6 100644 --- a/adc-da-report/src/main/java/com/adc/da/report/vo/PowerApplyActPageVO.java +++ b/adc-da-report/src/main/java/com/adc/da/report/vo/PowerApplyActPageVO.java @@ -1,5 +1,6 @@ package com.adc.da.report.vo; +import com.adc.da.report.eo.PowerApplyAct; import lombok.Data; import lombok.EqualsAndHashCode; @@ -16,6 +17,7 @@ import java.util.List; public class PowerApplyActPageVO extends BasePageVO { + private String id; /** * 流程id */ @@ -137,4 +139,6 @@ public class PowerApplyActPageVO extends BasePageVO { private String fileSize; private String name; + + private List powerApplyList; } diff --git a/adc-da-report/src/main/java/com/adc/da/report/vo/ReportQueryVo.java b/adc-da-report/src/main/java/com/adc/da/report/vo/ReportQueryVo.java index 18d359f..9bd774c 100644 --- a/adc-da-report/src/main/java/com/adc/da/report/vo/ReportQueryVo.java +++ b/adc-da-report/src/main/java/com/adc/da/report/vo/ReportQueryVo.java @@ -47,6 +47,7 @@ public class ReportQueryVo { private String usid; private List ids; + // // private List noIds; diff --git a/adc-da-report/src/main/resources/mybatis/mapper/mysql/PowerApplyActMapper.xml b/adc-da-report/src/main/resources/mybatis/mapper/mysql/PowerApplyActMapper.xml index 90d99dc..7a9a0ff 100644 --- a/adc-da-report/src/main/resources/mybatis/mapper/mysql/PowerApplyActMapper.xml +++ b/adc-da-report/src/main/resources/mybatis/mapper/mysql/PowerApplyActMapper.xml @@ -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}) + + UPDATE power_apply_act set del_flag = 1 + where id in + + #{id} + + @@ -97,6 +104,13 @@ rep.name,rep.keycontent,rep.maincontent,rep.DEPARTMENT,rep.year,rep.fileid,rep.confidentialLevel,rep.privacyLevel from a left join TT_REPORT_MANAGE rep on a.report_id = rep.id + where a.data_id = #{dataId} and a.del_flag = 0 + + diff --git a/adc-da-report/src/main/resources/mybatis/mapper/mysql/ReportManageMapper.xml b/adc-da-report/src/main/resources/mybatis/mapper/mysql/ReportManageMapper.xml index c455718..3d3a78e 100644 --- a/adc-da-report/src/main/resources/mybatis/mapper/mysql/ReportManageMapper.xml +++ b/adc-da-report/src/main/resources/mybatis/mapper/mysql/ReportManageMapper.xml @@ -2,162 +2,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/controller/UserEOController.java b/adc-da-sys/src/main/java/com/adc/da/sys/controller/UserEOController.java index d46b74f..a6fb932 100644 --- a/adc-da-sys/src/main/java/com/adc/da/sys/controller/UserEOController.java +++ b/adc-da-sys/src/main/java/com/adc/da/sys/controller/UserEOController.java @@ -3,8 +3,6 @@ package com.adc.da.sys.controller; import com.adc.da.base.web.BaseController; 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.result.ExcelImportResult; -import com.adc.da.excel.poi.excel.entity.result.ExcelVerifyHanlderErrorResult; import com.adc.da.sys.constant.SysConstants; import com.adc.da.sys.entity.UserEO; 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.vo.UserImportVO; 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.Result; import com.adc.da.util.utils.FileUtil; @@ -25,31 +22,22 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; 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.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; +import javax.annotation.Resource; 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.nio.charset.StandardCharsets; -import java.text.ParseException; -import java.util.ArrayList; -import java.util.Date; import java.util.List; import java.util.Map; -import static org.aspectj.weaver.tools.cache.SimpleCacheFactory.path; - @RestController @RequestMapping("/${restPath}/sys/user") @Api(tags = {"Sys-用户管理"}) diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/dao/mysql/UserEODao.java b/adc-da-sys/src/main/java/com/adc/da/sys/dao/mysql/UserEODao.java index c9932ad..03fab73 100644 --- a/adc-da-sys/src/main/java/com/adc/da/sys/dao/mysql/UserEODao.java +++ b/adc-da-sys/src/main/java/com/adc/da/sys/dao/mysql/UserEODao.java @@ -33,6 +33,7 @@ public interface UserEODao extends BaseMapper { List getUserByIdList(@Param("userIdList") List userIdList); + List getUserByIdListNodel(@Param("userIdList") List userIdList); // 根据account获取未逻辑删除的UserEO UserEO getUserEOByAccountNotDeleted(String account); @@ -41,4 +42,6 @@ public interface UserEODao extends BaseMapper { List> allList( @Param("account") String account, @Param("roleName") String roleName); UserEO getUserEoById(@Param("usid") String usid); + + UserEO selectUserByIdNodel(String userId); } diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/service/UserEOServiceImpl.java b/adc-da-sys/src/main/java/com/adc/da/sys/service/UserEOServiceImpl.java index d589317..32e0bd0 100644 --- a/adc-da-sys/src/main/java/com/adc/da/sys/service/UserEOServiceImpl.java +++ b/adc-da-sys/src/main/java/com/adc/da/sys/service/UserEOServiceImpl.java @@ -144,6 +144,11 @@ public class UserEOServiceImpl implements IUserEoService { return dao.getUserByIdList(userIdList); } + @Override + public List getUserByIdListNodel(List userIdList){ + return dao.getUserByIdListNodel(userIdList); + } + @Override public IPage> list(int pageNo, int pageSize, String account, String roleName) { IPage page = new Page(); @@ -271,6 +276,11 @@ public class UserEOServiceImpl implements IUserEoService { return dao.allList(account,roleName); } + @Override + public UserEO getUserByIdNodel(String userId) { + return dao.selectUserByIdNodel(userId); + } + void checkExcel(List list) { if (CollectionUtils.isEmpty(list)) { throw new AdcDaBaseException("数据不能为空"); diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/service/iservice/IUserEoService.java b/adc-da-sys/src/main/java/com/adc/da/sys/service/iservice/IUserEoService.java index 8ad346f..84394ad 100644 --- a/adc-da-sys/src/main/java/com/adc/da/sys/service/iservice/IUserEoService.java +++ b/adc-da-sys/src/main/java/com/adc/da/sys/service/iservice/IUserEoService.java @@ -43,6 +43,14 @@ public interface IUserEoService { List getUserByIdList(List userIdList); + /** + * 不考虑 删除的情况 + * 因流程中 人员被删除,但是审批历史中人要 回显正确 + * @param userIdList + * @return + */ + List getUserByIdListNodel(List userIdList); + IPage> list(int pageNo, int pageSize, String account, String roleName); void delete(String ids); @@ -56,5 +64,11 @@ public interface IUserEoService { public void importExcelUser(List list); List> allList(String account, String roleName); - + /** + * 不考虑 删除的情况 + * 因流程中 人员被删除,但是审批历史中人要 回显正确 + * @param userId + * @return + */ + UserEO getUserByIdNodel(String userId); } diff --git a/adc-da-sys/src/main/resources/mybatis/mapper/sys/mysql/UserEOMapper.xml b/adc-da-sys/src/main/resources/mybatis/mapper/sys/mysql/UserEOMapper.xml index efb3ee0..0cd18df 100644 --- a/adc-da-sys/src/main/resources/mybatis/mapper/sys/mysql/UserEOMapper.xml +++ b/adc-da-sys/src/main/resources/mybatis/mapper/sys/mysql/UserEOMapper.xml @@ -186,6 +186,55 @@ where users.del_flag != 1 and users.usid=#{usid} + + + diff --git a/adc-da-sys/target/classes/com/adc/da/sys/controller/UserEOController.class b/adc-da-sys/target/classes/com/adc/da/sys/controller/UserEOController.class index 1423e56..be220f3 100644 Binary files a/adc-da-sys/target/classes/com/adc/da/sys/controller/UserEOController.class and b/adc-da-sys/target/classes/com/adc/da/sys/controller/UserEOController.class differ diff --git a/libs/hutool-all-4.5.11.jar b/libs/hutool-all-4.5.11.jar new file mode 100644 index 0000000..6c7e44f Binary files /dev/null and b/libs/hutool-all-4.5.11.jar differ diff --git a/pom.xml b/pom.xml index 882e300..7681dd4 100644 --- a/pom.xml +++ b/pom.xml @@ -35,7 +35,7 @@ 2.5 1.10 1.10 - 2.4.6 + 1.4.0-RC2 8.5.37 3.16 @@ -332,11 +332,11 @@ ${aspectj.version} - - org.elasticsearch - elasticsearch - ${elasticsearch.version} - + + + + + org.jdom @@ -520,6 +520,8 @@ cn.hutool hutool-all 4.5.11 + + diff --git a/report-activity/src/main/java/com/adc/da/wkflow/business_activiti/define/ActivitDefineController.java b/report-activity/src/main/java/com/adc/da/wkflow/business_activiti/define/ActivitDefineController.java index a92fb55..f9e4f4b 100644 --- a/report-activity/src/main/java/com/adc/da/wkflow/business_activiti/define/ActivitDefineController.java +++ b/report-activity/src/main/java/com/adc/da/wkflow/business_activiti/define/ActivitDefineController.java @@ -5,7 +5,6 @@ import com.adc.da.login.util.UserUtils; import com.adc.da.sys.entity.UserEO; import com.adc.da.sys.service.iservice.IUserEoService; 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.service.IBusProcessApproveService; import com.adc.da.wkflow.business_main.service.IBusProcessNameService; @@ -217,13 +216,13 @@ public class ActivitDefineController { ibusprocessnameService.save(one); } - BusProcessApprove busProcessApprove = new BusProcessApprove(); - busProcessApprove.setFromValsJson(JSON.toJSONString(approveData)); - busProcessApprove.setTaskId(task.getId()); - busProcessApprove.setCreateDate(new Date()); - busProcessApprove.setPrcId(pi.getId()); - busProcessApprove.setCreateUserId(UserUtils.getUserId()); - ibusProcessApproveService.save(busProcessApprove); +// BusProcessApprove busProcessApprove = new BusProcessApprove(); +// busProcessApprove.setFromValsJson(JSON.toJSONString(approveData)); +// busProcessApprove.setTaskId(task.getId()); +// busProcessApprove.setCreateDate(new Date()); +// busProcessApprove.setPrcId(pi.getId()); +// busProcessApprove.setCreateUserId(UserUtils.getUserId()); +// ibusProcessApproveService.save(busProcessApprove); log.info("启动流程实例,获取id-->{},实例名称-->{}", pi.getId(), pd.getName()); return WrapMapper.ok(task.getId()); } diff --git a/report-activity/src/main/java/com/adc/da/wkflow/business_activiti/task/TaskController.java b/report-activity/src/main/java/com/adc/da/wkflow/business_activiti/task/TaskController.java index c718409..0dfc08e 100644 --- a/report-activity/src/main/java/com/adc/da/wkflow/business_activiti/task/TaskController.java +++ b/report-activity/src/main/java/com/adc/da/wkflow/business_activiti/task/TaskController.java @@ -83,7 +83,7 @@ public class TaskController { BusProcessNew processNew = iBusProcessNewService.getOne(processNewQueryWrapper); if(processNew!=null){ - UserEO assignee = userEoService.getUserById(processNew.getUserId()); + UserEO assignee = userEoService.getUserByIdNodel(processNew.getUserId()); if(assignee != null){ historicTaskInstance.put("assignee", assignee.getUsname()); historicTaskInstance.put("assigneeId", assignee.getUsid()); @@ -91,7 +91,7 @@ public class TaskController { } }else{ String assigneeId = historicTaskInstance.get("assignee").toString(); - List userByIdList = userEoService.getUserByIdList(Arrays.asList(assigneeId)); + List userByIdList = userEoService.getUserByIdListNodel(Arrays.asList(assigneeId)); if(userByIdList.size()>0){ UserVO assignee = userByIdList.get(0); historicTaskInstance.put("assignee", assignee.getUsname()); diff --git a/report-activity/src/main/java/com/adc/da/wkflow/business_activiti/task/TodoTaskController.java b/report-activity/src/main/java/com/adc/da/wkflow/business_activiti/task/TodoTaskController.java index b62c383..222c485 100644 --- a/report-activity/src/main/java/com/adc/da/wkflow/business_activiti/task/TodoTaskController.java +++ b/report-activity/src/main/java/com/adc/da/wkflow/business_activiti/task/TodoTaskController.java @@ -97,7 +97,7 @@ public class TodoTaskController { private IBusProcessEntrustService iBusProcessEntrustService; @Resource - private IBusProcessApproveService iBusProcessApproveService; + private IBusProcessApproveService ibusProcessApproveService; @Resource private BusProcessApproveMapper busProcessApproveMapper; @@ -209,12 +209,21 @@ public class TodoTaskController { return WrapMapper.ok("改派成功"); } + /** + * 转办 + * @param taskId + * @param assignee + * @param userId + * @param pId + * @return + */ @ApiOperation(value = "新改派任务") @ApiImplicitParams({@ApiImplicitParam(name = "taskId", value = "任务id"), @ApiImplicitParam(name = "assignee", value = "被改派人员"), @ApiImplicitParam(name = "userId", value = "改派人员"), @ApiImplicitParam(name = "pId", value = "流程实例ID")}) @GetMapping("/changeAssigneeNew") - public Wrapper changeAssigneeNew(String taskId, String assignee, String userId, String pId) { + public Wrapper changeAssigneeNew(String taskId, String assignee, String userId, String pId, + @RequestParam(required = false,value = "replaceMap")String replaceMap) { List list = Arrays.asList(taskId.split(",")); for (String str : list) { @@ -235,21 +244,36 @@ public class TodoTaskController { iBusProcessNewService.saveOrUpdate(busProcessNew); } } - - BusProcessEntrust busProcessEntrust = new BusProcessEntrust(); - busProcessEntrust.setEnUserId(assignee); - busProcessEntrust.setUserId(userId); - busProcessEntrust.setValidFlag("0"); - busProcessEntrust.setPrcId(pId); - busProcessEntrust.setPrcName(one.getPrcName()); - busProcessEntrust.setTaskId(str); - iBusProcessEntrustService.save(busProcessEntrust); + if (replaceMap == null) { + BusProcessEntrust busProcessEntrust = new BusProcessEntrust(); + busProcessEntrust.setEnUserId(assignee); + busProcessEntrust.setUserId(userId); + busProcessEntrust.setValidFlag("0"); + busProcessEntrust.setPrcId(pId); + busProcessEntrust.setPrcName(one.getPrcName()); + busProcessEntrust.setTaskId(str); + iBusProcessEntrustService.save(busProcessEntrust); + } } } + //监控流程中 变更处理人为永久变更 + if (replaceMap != null){ + ibusProcessApproveService.changeAssignee(replaceMap,pId); + } log.info("task {} find " + taskId); 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 reMap = new HashMap<>(); + reMap.put("taskId",task.getId()); + reMap.put("assignee",task.getAssignee()); + return Result.success(reMap); + } @ApiOperation(value = "完成任务", notes = "流程单个节点任务,直接完成任务") @ApiImplicitParams({@ApiImplicitParam(name = "taskId", value = "任务id"), @@ -270,7 +294,7 @@ public class TodoTaskController { busProcessApprove.setPrcId(task.getProcessInstanceId()); busProcessApprove.setCreateDate(new Date()); busProcessApprove.setFromValsJson(busMes.getSubmitJson()); - iBusProcessApproveService.save(busProcessApprove); + ibusProcessApproveService.save(busProcessApprove); if (StringUtils.isNotEmpty(dataJson)){ //根据业务情况 对业务数据进行saveOrupdate activitDefineService.saveOrUpdateDate(busMes.getPrcType(),dataJson, task.getId(),task.getProcessInstanceId()); @@ -372,14 +396,15 @@ public class TodoTaskController { */ @ApiOperation(value = "详情") @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 busProcessNews = iBusProcessNewService.selectEOByTaskId(prcId); if (busProcessNews.size() == 0) { return null; } BusProcessNew busProcessNew = busProcessNews.get(0); // 查找详细业务数据 - BusProcessNewVO busProcessNewVO = this.queryDetailDate(busProcessNew, prcType); + BusProcessNewVO busProcessNewVO = this.queryDetailDate(busProcessNew, prcType,tag); //审批数据 List busProcessApproves = busProcessApproveMapper.selectEoByPrcIdAndTask(busProcessNewVO.getPId()); @@ -389,12 +414,52 @@ public class TodoTaskController { 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 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 powerApplyActs = powerApplyActDao.selectListBydataId(dataId); + String string = JSONArray.toJSONString(powerApplyActs); + //去对应的 数据表查数据 + busProcessNewVO.setDataJson(string); + } + return busProcessNewVO; + } + + private BusProcessNewVO queryDetailDate(BusProcessNew busProcessNew, String prcType, Integer tag) { BusProcessNewVO busProcessNewVO = new BusProcessNewVO(); BeanUtils.copyProperties(busProcessNew,busProcessNewVO); String dataId = busProcessNew.getDataId(); if ("1".equals(prcType)){ - List powerApplyActs = powerApplyActDao.selectListBydataId(dataId); + List powerApplyActs = new ArrayList<>(); + if (tag == 1){ + //代办查看详情 + powerApplyActs = powerApplyActDao.selectListBydataIdNodel(dataId); + }else { + powerApplyActs = powerApplyActDao.selectListBydataId(dataId); + } String string = JSONArray.toJSONString(powerApplyActs); //去对应的 数据表查数据 busProcessNewVO.setDataJson(string); @@ -418,7 +483,9 @@ public class TodoTaskController { @PostMapping("/saveTaskFirst") public Wrapper saveTaskFirst(@RequestBody ApproveDataVO approveDataVO) { String dataJson = approveDataVO.getDataJson(); + String submitJson = approveDataVO.getSubmitJson(); String saveId = null; + String dataId = null; if (approveDataVO.getId() != null && !approveDataVO.getId().equals("")) { saveId = approveDataVO.getId(); @@ -430,8 +497,14 @@ public class TodoTaskController { List list = iBusProcessNameService.list(queryWrapper); if (list != null && list.size() > 0) { BusProcessName busProcessName = list.get(0); - + busProcessName.setPrcName(approveDataVO.getPrcName()); busProcessName.setSubmitStatus(SubmitStatusEnum.DRAFT.getValue()); + if (StringUtils.isNotEmpty(dataJson)){ + //根据业务情况 对业务数据进行saveOrupdate + dataId = activitDefineService.saveOrUpdateDate(approveDataVO.getPrcType(), dataJson, null, + null); + busProcessName.setDataId(dataId); + } iBusProcessNameService.saveOrUpdate(busProcessName); } } else { @@ -440,11 +513,12 @@ public class TodoTaskController { BusProcessName busProcessName = new BusProcessName(); if (StringUtils.isNotEmpty(dataJson)) { //根据业务情况 对业务数据进行saveOrupdate - String dataId = activitDefineService.saveOrUpdateDate(approveDataVO.getPrcType(), dataJson, + dataId = activitDefineService.saveOrUpdateDate(approveDataVO.getPrcType(), dataJson, approveDataVO.getTaskId(),""); busProcessName.setDataId(dataId); } busProcessName.setPrcType(approveDataVO.getPrcType()); + busProcessName.setPrcName(approveDataVO.getPrcName()); busProcessName.setCreatUser(approveDataVO.getCreateUser()); busProcessName.setCreatTime(time); busProcessName.setCreatUserName(approveDataVO.getCreateUserName()); @@ -456,10 +530,21 @@ public class TodoTaskController { queryWrapper.eq("PRC_TYPE", approveDataVO.getPrcType()); queryWrapper.eq("CREAT_USER", approveDataVO.getCreateUser()); BusProcessName one = iBusProcessNameService.getOne(queryWrapper); - 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); } @@ -488,7 +573,7 @@ public class TodoTaskController { */ @ApiOperation(value = "查询草稿") @PostMapping("/queryTaskDraft") - public List queryTaskDraft(@RequestBody TaskCommonQuery taskCommonQuery) { + public ResponseMessage queryTaskDraft(@RequestBody TaskCommonQuery taskCommonQuery) { QueryWrapper queryWrapper = new QueryWrapper<>(); queryWrapper.eq("CREAT_USER", taskCommonQuery.getUserId()); if (taskCommonQuery.getPrcNum() != null && !taskCommonQuery.getPrcNum().equals("")) { @@ -505,8 +590,14 @@ public class TodoTaskController { queryWrapper.lambda().eq(BusProcessName::getSubmitStatus,SubmitStatusEnum.DRAFT.getValue()); queryWrapper.orderByDesc("CREAT_TIME"); + Page page = new Page(); List list = iBusProcessNameService.list(queryWrapper); - return list; + List 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 = "查询流程是否结束") diff --git a/report-activity/src/main/java/com/adc/da/wkflow/business_main/entity/BusProcessApprove.java b/report-activity/src/main/java/com/adc/da/wkflow/business_main/entity/BusProcessApprove.java index 635c427..ad54a4f 100644 --- a/report-activity/src/main/java/com/adc/da/wkflow/business_main/entity/BusProcessApprove.java +++ b/report-activity/src/main/java/com/adc/da/wkflow/business_main/entity/BusProcessApprove.java @@ -44,4 +44,7 @@ public class BusProcessApprove { @TableField("FROM_VALS_JSON") private String fromValsJson; + @TableField("DATA_ID") + private String dataId; + } diff --git a/report-activity/src/main/java/com/adc/da/wkflow/business_main/mapper/BusProcessApproveMapper.java b/report-activity/src/main/java/com/adc/da/wkflow/business_main/mapper/BusProcessApproveMapper.java index 442102d..724ff02 100644 --- a/report-activity/src/main/java/com/adc/da/wkflow/business_main/mapper/BusProcessApproveMapper.java +++ b/report-activity/src/main/java/com/adc/da/wkflow/business_main/mapper/BusProcessApproveMapper.java @@ -19,4 +19,7 @@ public interface BusProcessApproveMapper extends BaseMapper { List selectEoByPrcIdAndTask(@Param("prcId") String prcId); + BusProcessApprove selectEoByDataId(@Param("dataId") String dataId); + + BusProcessApprove selectEoByTask(@Param("taskId")String taskId); } diff --git a/report-activity/src/main/java/com/adc/da/wkflow/business_main/service/IBusProcessApproveService.java b/report-activity/src/main/java/com/adc/da/wkflow/business_main/service/IBusProcessApproveService.java index 41b06fe..6452804 100644 --- a/report-activity/src/main/java/com/adc/da/wkflow/business_main/service/IBusProcessApproveService.java +++ b/report-activity/src/main/java/com/adc/da/wkflow/business_main/service/IBusProcessApproveService.java @@ -4,6 +4,7 @@ import com.adc.da.wkflow.business_main.entity.BusProcessApprove; import com.baomidou.mybatisplus.extension.service.IService; import java.util.List; + /** * 审批历史业务类 * 用于审批历史的查询的存取 @@ -12,4 +13,10 @@ public interface IBusProcessApproveService extends IService { List selectEoByPrcIdAndTask(String prcId); + /** + * 监控流程中 变更处理人为永久变更 + * @param replaceMap + * @param pId + */ + void changeAssignee(String replaceMap,String pId); } diff --git a/report-activity/src/main/java/com/adc/da/wkflow/business_main/service/impl/BusProcessApproveServiceImpl.java b/report-activity/src/main/java/com/adc/da/wkflow/business_main/service/impl/BusProcessApproveServiceImpl.java index e7afbe8..3f8a87e 100644 --- a/report-activity/src/main/java/com/adc/da/wkflow/business_main/service/impl/BusProcessApproveServiceImpl.java +++ b/report-activity/src/main/java/com/adc/da/wkflow/business_main/service/impl/BusProcessApproveServiceImpl.java @@ -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.mapper.BusProcessApproveMapper; 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 org.springframework.stereotype.Service; @@ -26,4 +28,19 @@ public class BusProcessApproveServiceImpl extends ServiceImpl 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); + } } diff --git a/report-activity/src/main/java/com/adc/da/wkflow/business_main/vo/ApproveDataVO.java b/report-activity/src/main/java/com/adc/da/wkflow/business_main/vo/ApproveDataVO.java index fed2888..6a998d8 100644 --- a/report-activity/src/main/java/com/adc/da/wkflow/business_main/vo/ApproveDataVO.java +++ b/report-activity/src/main/java/com/adc/da/wkflow/business_main/vo/ApproveDataVO.java @@ -32,4 +32,6 @@ public class ApproveDataVO { private String dept; + private String prcName; + } diff --git a/report-activity/src/main/java/com/adc/da/wkflow/listener/powerApply/aid1.java b/report-activity/src/main/java/com/adc/da/wkflow/listener/powerApply/aid1.java index b92648c..9c10a7c 100644 --- a/report-activity/src/main/java/com/adc/da/wkflow/listener/powerApply/aid1.java +++ b/report-activity/src/main/java/com/adc/da/wkflow/listener/powerApply/aid1.java @@ -29,6 +29,7 @@ public class aid1 implements TaskListener { //查询task任务 LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(PowerApplyAct::getTaskId, delegateTask.getId()); + queryWrapper.eq(PowerApplyAct::getDelFlag, 0); List powerApplyActs = powerApplyActDao.selectList(queryWrapper); PowerApplyAct powerApplyAct = new PowerApplyAct(); if (powerApplyActs.size()>0){ diff --git a/report-activity/src/main/java/com/adc/da/wkflow/listener/powerApply/aid2.java b/report-activity/src/main/java/com/adc/da/wkflow/listener/powerApply/aid2.java index c2ecee3..6baef86 100644 --- a/report-activity/src/main/java/com/adc/da/wkflow/listener/powerApply/aid2.java +++ b/report-activity/src/main/java/com/adc/da/wkflow/listener/powerApply/aid2.java @@ -29,6 +29,7 @@ public class aid2 implements TaskListener { //查询task任务 LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(PowerApplyAct::getTaskId, delegateTask.getId()); + queryWrapper.eq(PowerApplyAct::getDelFlag, 0); List powerApplyActs = powerApplyActDao.selectList(queryWrapper); PowerApplyAct powerApplyAct = new PowerApplyAct(); 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"); // 1: 同意 2:退回 delegateTask.setVariable("flag",s); + //审批人 + delegateTask.setVariable("oneApprove",object.getString("oneApprove")); + delegateTask.setVariable("twoApprove",object.getString("twoApprove")); } } diff --git a/report-activity/src/main/java/com/adc/da/wkflow/listener/powerApply/aid3.java b/report-activity/src/main/java/com/adc/da/wkflow/listener/powerApply/aid3.java index e567043..f777612 100644 --- a/report-activity/src/main/java/com/adc/da/wkflow/listener/powerApply/aid3.java +++ b/report-activity/src/main/java/com/adc/da/wkflow/listener/powerApply/aid3.java @@ -2,8 +2,8 @@ package com.adc.da.wkflow.listener.powerApply; import com.adc.da.login.util.UserUtils; 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.service.IPowerApplyService; 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; @@ -25,12 +25,13 @@ public class aid3 implements TaskListener { @Override public void notify(DelegateTask delegateTask) { PowerApplyActDao powerApplyActDao = SpringContextUtil.getBean(PowerApplyActDao.class); - PowerApplyDao powerApplyDao = SpringContextUtil.getBean(PowerApplyDao.class); + IPowerApplyService iPowerApplyService = SpringContextUtil.getBean(IPowerApplyService.class); IBusProcessNewService busBean = SpringContextUtil.getBean(IBusProcessNewService.class); IBusProcessApproveService approveService = SpringContextUtil.getBean(IBusProcessApproveService.class); //查询task任务 LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(PowerApplyAct::getTaskId, delegateTask.getId()); + queryWrapper.eq(PowerApplyAct::getDelFlag, 0); List powerApplyActs = powerApplyActDao.selectList(queryWrapper); PowerApplyAct powerApplyAct = new PowerApplyAct(); if (powerApplyActs.size()>0){ @@ -54,10 +55,13 @@ public class aid3 implements TaskListener { 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"); + //审批人 + delegateTask.setVariable("oneApprove",object.getString("oneApprove")); + delegateTask.setVariable("twoApprove",object.getString("twoApprove")); // 1: 同意 2:退回 delegateTask.setVariable("flag",s); if ("1".equals(s)){ - powerApplyDao.saveBatch(powerApplyActs); + iPowerApplyService.saveBatch(powerApplyActs); } } diff --git a/report-activity/src/main/resources/mybatis/mapper/mysql/BusProcessApproveMapper.xml b/report-activity/src/main/resources/mybatis/mapper/mysql/BusProcessApproveMapper.xml index f4d9a4f..f5db867 100644 --- a/report-activity/src/main/resources/mybatis/mapper/mysql/BusProcessApproveMapper.xml +++ b/report-activity/src/main/resources/mybatis/mapper/mysql/BusProcessApproveMapper.xml @@ -6,4 +6,10 @@ select * from bus_process_approve where prc_id = #{prcId} Order by CREATE_DATE desc + +