Merge branch 'master' into lixuetao

# Conflicts:
#	adc-da-report/src/main/java/com/adc/da/report/dao/mysql/PowerApplyActDao.java
This commit is contained in:
bupengxiang
2023-05-04 16:34:39 +08:00
47 changed files with 1119 additions and 487 deletions
@@ -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);
@@ -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);
@@ -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);
}
}
@@ -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 显示api1为只显示${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
@@ -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 显示api1为只显示${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
-1
View File
@@ -118,7 +118,6 @@
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
</dependencies>
@@ -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();
}
}
@@ -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<String, Object> 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<String, Object> 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<ReportVo> list = reportService.list(vo);
@ApiOperation("报告管理列表")
@PostMapping("/reportManagerPage")
public ResponseMessage reportManagerPage(@RequestBody ReportQueryVo vo) throws Exception {
IPage<ReportVo> 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<ReportVo> 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<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);
}
/**
* 上传文件
@@ -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<String> act = reportService.isAct(vo);
return Result.success(act);
}
}
@@ -47,4 +47,7 @@ public interface PowerApplyActDao extends BaseMapper<PowerApplyAct> {
List<PowerApplyActPageVO> selectListBydataId(@Param("dataId")String dataId);
List<PowerApplyActPageVO> selectListBydataIdNodel(@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> {
}
@@ -24,16 +24,39 @@ public interface ReportDao extends BaseMapper<ReportEntity> {
* @param idSet
* @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
* @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> page(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);
}
@@ -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;
}
@@ -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);
}
@@ -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<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.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<String> labelList);
/**
* 报告列表展示
* @param vo
* @return
*/
IPage<ReportVo> list(ReportQueryVo vo) throws Exception;
String insert(ReportEntity entity, List<String> labelList) throws IOException;
/**
* 删除报告
@@ -51,4 +45,8 @@ public interface IReportService {
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,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.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<ReportDao, ReportEntity>
@Autowired
private RoleEODao roleEODao;
@Resource
private IReportContentService iReportContentService;
@Autowired
private LocalFileUtil localFileUtil;
/**
* 新增或编辑报告
*
@@ -99,13 +107,13 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
*/
@Override
@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");
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<ReportDao, ReportEntity>
reportLabelDao.insert(reportLabelEntity);
});
//插入报表内容表
iReportContentService.insertReportContent(entity.getId() ,entity.getFileId());
CommonUtils.threadPoolExecutor().execute(() -> {
//生成html
try {
@@ -185,85 +196,6 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
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()
.sorted(Comparator.comparingInt(List<String>::size).reversed())
.collect(Collectors.toList());
if (labelList.size() == 0){
return null;
}
return labelList.get(0);
}
@@ -391,11 +326,154 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
vo.setUsid(UserUtils.getUserId());
}
IPage<ReportVo> list = reportDao.page(page, vo);
//按照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
*
@@ -408,44 +486,30 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
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;
@@ -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<PowerApplyActDao, Pow
}
/**
* @param deleteParamVO
* @param powerApplyActPageVO
* @return void
* @author bu
* @date 2023-04-23
* @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;
}
LambdaQueryWrapper<PowerApplyAct> 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<PowerApplyAct> powerApplyList = powerApplyActPageVO.getPowerApplyList();
for (PowerApplyAct powerApplyAct : powerApplyList) {
LambdaQueryWrapper<PowerApplyAct> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(PowerApplyAct::getPrcId,powerApplyAct.getPrcId());
wrapper.eq(PowerApplyAct::getReportId,powerApplyAct.getReportId());
powerApplyAct.setDelFlag(1);
baseMapper.update(powerApplyAct,wrapper);
}
}
@@ -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<PowerApplyDao, PowerApply> implements IPowerApplyService {
@Autowired
private PowerApplyActDao powerApplyActDao;
/**
* @param powerApplyPageVO
* @return <com.adc.da.report.entity.PowerApply>
@@ -109,5 +117,12 @@ public class IpowerApplyServiceImpl extends ServiceImpl<PowerApplyDao, PowerAppl
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 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<String> list=new ArrayList<>();
List<String> 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("<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("</style>\r\n");
for(int i=0;i<baseList.size();i++){
buffer.append("<img class ='preview-img' src="+baseList.get(i)+" />");
for (int i = 0; i < baseList.size(); i++) {
buffer.append("<img class ='preview-img' src=" + baseList.get(i) + " />");
}
buffer.append("</body></html>");
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);
@@ -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<PowerApplyAct> powerApplyList;
}
@@ -47,6 +47,7 @@ public class ReportQueryVo {
private String usid;
private List<String> ids;
//
// private List<String> noIds;
@@ -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})
</foreach>
</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进行分页查询 -->
@@ -97,6 +104,13 @@
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} 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}
</select>
</mapper>
@@ -2,162 +2,6 @@
<!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">
<!-- <select id="list" parameterType="com.adc.da.report.vo.ReportQueryVo" resultType="com.adc.da.report.vo.ReportVo">-->
<!-- select t1.id,t1.labelOneId,t1.labelTwoId,t1.labelThreeId,t1.labelOneName,t1.labelTwoName,t1.labelThreeName,t1.name,t1.year,t1.keyContent,t1.mainContent-->
<!-- ,t1.department,date_format(t1.updateDate,'%Y-%m-%d') createDate,t1.fileId-->
<!-- from(-->
<!-- (-->
<!-- 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>
<select id="getReportDateList" parameterType="string" resultType="string">
select distinct year from TT_REPORT_MANAGE t1
left join TR_REPORT_USER t2 on t1.id=t2.reportId
@@ -190,12 +34,10 @@
WHERE
eo.DEL_FLAG = 0
<if test="pageVO.usid !='' and pageVO.usid != null">
and ru.userId != #{pageVO.usid}
</if>
<if test="pageVO.usid !='' and pageVO.usid != null">
and eo.id not in (
SELECT tt.report_id from power_apply tt WHERE tt.user_id = #{pageVO.usid}
)
AND eo.id NOT IN ( SELECT ru.reportId FROM tr_report_user ru WHERE ru.userId = #{pageVO.usid} )
AND eo.id NOT IN ( SELECT tt.report_id FROM power_apply tt WHERE tt.user_id = #{pageVO.usid} )
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
del_flag != 1 and pro.SUBMIT_STATUS = 1)
</if>
<if test="pageVO.name !='' and pageVO.name != null">
and name like CONCAT(CONCAT('%',#{pageVO.name}),'%')
@@ -224,6 +66,7 @@
</select>
<select id="page" resultType="com.adc.da.report.vo.ReportVo">
SELECT
@@ -241,6 +84,7 @@
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
@@ -250,9 +94,6 @@
or eo.id in (
SELECT tt.report_id from power_apply tt WHERE tt.user_id = #{pageVO.usid})
)
</if>
<if test="pageVO.usid !='' and pageVO.usid != null">
</if>
<if test="pageVO.name !='' and pageVO.name != null">
and name like CONCAT(CONCAT('%',#{pageVO.name}),'%')
@@ -274,6 +115,13 @@
#{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
@@ -281,4 +129,80 @@
</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>
@@ -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-用户管理"})
@@ -33,6 +33,7 @@ public interface UserEODao extends BaseMapper<UserEO> {
List<UserVO> getUserByIdList(@Param("userIdList") List<String> userIdList);
List<UserVO> getUserByIdListNodel(@Param("userIdList") List<String> userIdList);
// 根据account获取未逻辑删除的UserEO
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);
UserEO getUserEoById(@Param("usid") String usid);
UserEO selectUserByIdNodel(String userId);
}
@@ -144,6 +144,11 @@ public class UserEOServiceImpl implements IUserEoService {
return dao.getUserByIdList(userIdList);
}
@Override
public List<UserVO> getUserByIdListNodel(List<String> userIdList){
return dao.getUserByIdListNodel(userIdList);
}
@Override
public IPage<Map<String, Object>> 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<UserImportVO> list) {
if (CollectionUtils.isEmpty(list)) {
throw new AdcDaBaseException("数据不能为空");
@@ -43,6 +43,14 @@ public interface IUserEoService {
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);
void delete(String ids);
@@ -56,5 +64,11 @@ public interface IUserEoService {
public void importExcelUser(List<UserImportVO> list);
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
and users.usid=#{usid}
</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>
Binary file not shown.
+8 -6
View File
@@ -35,7 +35,7 @@
<commons-io.version>2.5</commons-io.version>
<commons-codec.version>1.10</commons-codec.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>
<tomcat.version>8.5.37</tomcat.version>
<poi.version>3.16</poi.version>
@@ -332,11 +332,11 @@
<version>${aspectj.version}</version>
</dependency>
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
<version>${elasticsearch.version}</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.elasticsearch</groupId>-->
<!-- <artifactId>elasticsearch</artifactId>-->
<!-- <version>${elasticsearch.version}</version>-->
<!-- </dependency>-->
<dependency>
<groupId>org.jdom</groupId>
@@ -520,6 +520,8 @@
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>4.5.11</version>
<!-- <scope>system</scope>-->
<!-- <systemPath>${project.basedir}/libs/hutool-all-4.5.11.jar</systemPath>-->
</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.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());
}
@@ -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<UserVO> userByIdList = userEoService.getUserByIdList(Arrays.asList(assigneeId));
List<UserVO> userByIdList = userEoService.getUserByIdListNodel(Arrays.asList(assigneeId));
if(userByIdList.size()>0){
UserVO assignee = userByIdList.get(0);
historicTaskInstance.put("assignee", assignee.getUsname());
@@ -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<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(","));
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<String, String> 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<BusProcessNew> 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<BusProcessApprove> 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<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);
}
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<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);
//去对应的 数据表查数据
busProcessNewVO.setDataJson(string);
@@ -418,7 +483,9 @@ public class TodoTaskController {
@PostMapping("/saveTaskFirst")
public Wrapper<String> 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<BusProcessName> 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<BusProcessName> queryTaskDraft(@RequestBody TaskCommonQuery taskCommonQuery) {
public ResponseMessage queryTaskDraft(@RequestBody TaskCommonQuery taskCommonQuery) {
QueryWrapper<BusProcessName> 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<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 = "查询流程是否结束")
@@ -44,4 +44,7 @@ public class BusProcessApprove {
@TableField("FROM_VALS_JSON")
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);
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 java.util.List;
/**
* 审批历史业务类
* 用于审批历史的查询的存取
@@ -12,4 +13,10 @@ public interface IBusProcessApproveService extends IService<BusProcessApprove> {
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.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<BusProcessApproveM
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 prcName;
}
@@ -29,6 +29,7 @@ public class aid1 implements TaskListener {
//查询task任务
LambdaQueryWrapper<PowerApplyAct> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(PowerApplyAct::getTaskId, delegateTask.getId());
queryWrapper.eq(PowerApplyAct::getDelFlag, 0);
List<PowerApplyAct> powerApplyActs = powerApplyActDao.selectList(queryWrapper);
PowerApplyAct powerApplyAct = new PowerApplyAct();
if (powerApplyActs.size()>0){
@@ -29,6 +29,7 @@ public class aid2 implements TaskListener {
//查询task任务
LambdaQueryWrapper<PowerApplyAct> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(PowerApplyAct::getTaskId, delegateTask.getId());
queryWrapper.eq(PowerApplyAct::getDelFlag, 0);
List<PowerApplyAct> 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"));
}
}
@@ -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<PowerApplyAct> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(PowerApplyAct::getTaskId, delegateTask.getId());
queryWrapper.eq(PowerApplyAct::getDelFlag, 0);
List<PowerApplyAct> 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);
}
}
@@ -6,4 +6,10 @@
select * from bus_process_approve where prc_id = #{prcId}
Order by CREATE_DATE desc
</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>