Merge branch 'caihaohan' into lixuetao
# Conflicts: # adc-da-main/target/classes/application-dev.properties # adc-da-report/src/main/java/com/adc/da/report/service/impl/IReportServiceImpl.java # adc-da-report/target/classes/com/adc/da/report/controller/ReportManageConroller.class # adc-da-report/target/classes/com/adc/da/report/service/impl/IReportServiceImpl.class # adc-da-report/target/classes/com/adc/da/report/util/PdfUtil.class # adc-da-report/target/classes/com/adc/da/report/util/PptUtil.class # adc-da-report/target/classes/mybatis/mapper/mysql/ReportManageMapper.xml # adc-da-sys/src/main/java/com/adc/da/sys/dao/mysql/UserEODao.java # adc-da-sys/src/main/java/com/adc/da/sys/service/UserEOServiceImpl.java # adc-da-sys/src/main/java/com/adc/da/sys/service/iservice/IUserEoService.java # adc-da-sys/src/main/resources/mybatis/mapper/sys/mysql/UserEOMapper.xml # adc-da-sys/target/classes/com/adc/da/sys/controller/UserEOController.class # adc-da-sys/target/classes/com/adc/da/sys/service/RoleEOService.class # adc-da-sys/target/classes/dozer/dozer-mappings-ddm.xml # pom.xml
This commit is contained in:
@@ -50,20 +50,23 @@ public class CommonUtils {
|
||||
}
|
||||
|
||||
public static String getUserId() {
|
||||
String userId = null;
|
||||
try {
|
||||
Subject subject = SecurityUtils.getSubject();
|
||||
MyPrincipal principal = (MyPrincipal) subject.getPrincipal();
|
||||
if (principal != null) {
|
||||
userId = principal.getId();
|
||||
}
|
||||
} catch (UnavailableSecurityManagerException e) {
|
||||
log.error("getUserId UnavailableSecurityManagerException", e);
|
||||
} catch (InvalidSessionException e) {
|
||||
log.error("getUserId InvalidSessionException", e);
|
||||
// String userId = null;
|
||||
// try {
|
||||
// Subject subject = SecurityUtils.getSubject();
|
||||
// MyPrincipal principal = (MyPrincipal) subject.getPrincipal();
|
||||
// if (principal != null) {
|
||||
// userId = principal.getId();
|
||||
// }
|
||||
// } catch (UnavailableSecurityManagerException e) {
|
||||
// log.error("getUserId UnavailableSecurityManagerException", e);
|
||||
// } catch (InvalidSessionException e) {
|
||||
// log.error("getUserId InvalidSessionException", e);
|
||||
//
|
||||
// }
|
||||
// return userId;
|
||||
// return "BKS7G52TVR";//拆解管理员
|
||||
|
||||
}
|
||||
return userId;
|
||||
return "ZGGJP3N7FT";
|
||||
}
|
||||
|
||||
public static List<RoleEO> getRoleList() throws Exception {
|
||||
|
||||
@@ -0,0 +1,142 @@
|
||||
#Development System
|
||||
#spring.datasource.driverClassName = oracle.jdbc.OracleDriver
|
||||
#spring.datasource.url = jdbc:oracle:thin:@//60.247.58.117:50011/ADC
|
||||
##spring.datasource.username = ADC_PLATFORM
|
||||
##spring.datasource.password = ADC_PLATFORM
|
||||
|
||||
#spring.datasource.url = jdbc:oracle:thin:@//192.168.144.136:19290/ADC
|
||||
#spring.datasource.username = EPR
|
||||
#spring.datasource.password = EPR
|
||||
|
||||
#spring.datasource.url = jdbc:oracle:thin:@//192.168.144.103:19290/ADC
|
||||
#spring.datasource.username = EPR_TEST
|
||||
#spring.datasource.password = EPR_TEST
|
||||
|
||||
#spring.datasource.driverClassName = com.mysql.jdbc.Driver
|
||||
#spring.datasource.url = jdbc:mysql://192.168.144.124:3306/cadata2?characterEncoding=utf-8&&zeroDateTimeBehavior=convertToNull
|
||||
#spring.datasource.username = adc_forecast
|
||||
#spring.datasource.password = adc_forecast
|
||||
|
||||
|
||||
#kylin数据库 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
|
||||
#spring.datasource.kylin.username=64459
|
||||
#spring.datasource.kylin.password=ichangan_ps9
|
||||
##10s
|
||||
#spring.datasource.kylin.maxWaitTime=10000
|
||||
#spring.datasource.kylin.poolSize=10
|
||||
#
|
||||
##mysql数据库 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
|
||||
spring.datasource.username = root
|
||||
spring.datasource.password = hzwlsoft.com
|
||||
|
||||
#后端端口
|
||||
server.port=7060
|
||||
|
||||
#验证码后台模式,默认为1:1为不开启,2为开启,3为输错 用户名或密码 ${maxLoginErrorCount} 次 才开启
|
||||
verifyCodeMode=3
|
||||
#仅当验证码模式 ${verifyCodeMode} 为 3时生效,设置错误登录出现验证码的阈值,默认为3
|
||||
maxLoginErrorCount=3
|
||||
|
||||
#密码Base64加密开关,true为开启,false为关闭
|
||||
isPassEncrypted=true
|
||||
#{
|
||||
#"password": "YWJjMTIz",
|
||||
#"username": "YWRtaW4x"
|
||||
#}
|
||||
#swagger 显示api,1为只显示${restPath:/api}前缀的api,0为显示所有api,其他为不显示api
|
||||
swaggerLevel=0
|
||||
|
||||
|
||||
#uploadFile=/EPR/file/EPR/test/
|
||||
#
|
||||
#picPath=/EPR/file/home/pic/
|
||||
|
||||
# 本地存储文件的磁盘地址
|
||||
uploadFile=D:\\work\\idea\\changan\\
|
||||
# 本地文件访问的url地址
|
||||
picPath=/api/home/pic/
|
||||
|
||||
|
||||
serverIp=http://127.0.0.1:7060/
|
||||
|
||||
|
||||
#MAIL_SMTP =smtp.163.com
|
||||
#MAIL_SMTP_PORT=465
|
||||
#MAIL_USERNAME=cagds@catarc.ac.cn
|
||||
#MAIL_PASSWORD=Cagds9760
|
||||
|
||||
MAIL_SMTP =smtp.163.com
|
||||
MAIL_SMTP_PORT=465
|
||||
MAIL_USERNAME=simashihao@163.com
|
||||
MAIL_PASSWORD=VQBNNQBLDIALAYCV
|
||||
|
||||
#MAIL_SMTP =cmp.changan.com
|
||||
#MAIL_SMTP_PORT=25
|
||||
MAIL_POP_PORT=110
|
||||
#MAIL_USERNAME=64459@Any3.com
|
||||
#MAIL_PASSWORD=65316975Xiaoq
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
IPANDPORT=http://localhost:7061/
|
||||
|
||||
#redis
|
||||
#Redis服务器地址
|
||||
spring.redis.host=192.168.144.29
|
||||
#spring.redis.host=localhost
|
||||
## Redis服务器连接端口
|
||||
spring.redis.port=6379
|
||||
## Redis服务器连接密码(默认为空)
|
||||
spring.redis.password=123321
|
||||
## 连接超时时间(毫秒)
|
||||
spring.redis.timeout=200000ms
|
||||
## 连接池中的最大空闲连接,默认值是8。
|
||||
spring.redis.jedis.pool.max-idle=50
|
||||
##连接池中的最小空闲连接,默认值是0。
|
||||
spring.redis.jedis.pool.min-idle=10
|
||||
## 如果赋值为-1,则表示不限制;如果pool已经分配了maxActive个jedis实例,则此时pool的状态为exhausted(耗尽)。
|
||||
spring.redis.jedis.pool.max-active=2000
|
||||
## 等待可用连接的最大时间,单位毫秒,默认值为-1,表示永不超时。如果超过等待时间,则直接抛出JedisConnectionException
|
||||
spring.redis.jedis.pool.max-wait=2000ms
|
||||
|
||||
spring.redis.database=6
|
||||
|
||||
# 上传方式:阿里云:alioss 华为云:hwobs
|
||||
uploadType: hwobs
|
||||
|
||||
# ======= 阿里OSS配置 =========
|
||||
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数
|
||||
|
||||
# ======= 华为OBS配置 =========
|
||||
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数
|
||||
|
||||
logging.level.com.adc: debug
|
||||
|
||||
|
||||
# ======= ddm权限接口 集成 =========
|
||||
ddm-identity=changan_test
|
||||
ddm-company=9
|
||||
ddm-ras-public-key=
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.adc.da.report.constant;
|
||||
|
||||
/**
|
||||
* @author ThinkBook
|
||||
*/
|
||||
public class ReportConstants {
|
||||
|
||||
public static final String FILE_EXTENSIONS_DOC = "doc";
|
||||
public static final String FILE_EXTENSIONS_DOCX = "docx";
|
||||
public static final String FILE_EXTENSIONS_XLS = "xls";
|
||||
public static final String FILE_EXTENSIONS_XLSX = "xlsx";
|
||||
public static final String FILE_EXTENSIONS_PPT = "ppt";
|
||||
public static final String FILE_EXTENSIONS_PPTX = "pptx";
|
||||
public static final String FILE_EXTENSIONS_PDF = "pdf";
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.adc.da.report.constant;
|
||||
|
||||
/**
|
||||
* @author Caihaohan
|
||||
*/
|
||||
public class TreeLabelConstants {
|
||||
|
||||
public static final Integer DELETED = 1;
|
||||
|
||||
public static final Integer UNDELETE = 0;
|
||||
|
||||
public static final String ROOT_TAG_PARENT_ID = "0";
|
||||
|
||||
public static final String ROOT_LABEL_ID = "RTYUHYT";
|
||||
}
|
||||
@@ -26,7 +26,6 @@ import java.util.concurrent.ExecutionException;
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Api(tags = "标签管理")
|
||||
@RequestMapping("/${restPath}/label")
|
||||
public class LabelManageController {
|
||||
|
||||
|
||||
+14
-1
@@ -77,7 +77,7 @@ public class ReportManageConroller {
|
||||
public ResponseMessage add(@RequestBody ReportVo vo) {
|
||||
ReportEntity entity = new ReportEntity();
|
||||
BeanUtils.copyProperties(vo, entity);
|
||||
String name = reportService.insert(entity);
|
||||
String name = reportService.insert(entity, vo.getLabelList());
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("reportName", name);
|
||||
return Result.success(map);
|
||||
@@ -96,6 +96,19 @@ 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
|
||||
|
||||
+103
@@ -0,0 +1,103 @@
|
||||
package com.adc.da.report.controller;
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import com.adc.da.report.eo.TreeLabelEntity;
|
||||
import com.adc.da.report.service.ITreeLabelService;
|
||||
import com.adc.da.report.vo.TreeLabelVo;
|
||||
import com.adc.da.util.http.ResponseMessage;
|
||||
import com.adc.da.util.http.Result;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.subject.ExecutionException;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Caihaohan
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Api(tags = "树型标签管理")
|
||||
@RequestMapping("/${restPath}/tree-label")
|
||||
public class TreeLabelManagerController {
|
||||
|
||||
@Resource
|
||||
private ITreeLabelService iTreeLabelService;
|
||||
|
||||
|
||||
/**
|
||||
* 新增或编辑标签
|
||||
*
|
||||
* @param treeLabelVo
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("新增标签")
|
||||
@PostMapping("/add")
|
||||
public ResponseMessage add(@Valid @RequestBody TreeLabelVo treeLabelVo) {
|
||||
TreeLabelEntity treeLabelEntity = Convert.convert(TreeLabelEntity.class, treeLabelVo);
|
||||
iTreeLabelService.saveOrUpdateTag(treeLabelEntity);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增或编辑标签
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("获取当前标签的父级路径")
|
||||
@GetMapping("/labelList/{id}")
|
||||
public ResponseMessage parentLabelList(@PathVariable String id) {
|
||||
List<String> labelList = iTreeLabelService.getParentLabelList(id);
|
||||
return Result.success(labelList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增或编辑标签
|
||||
*
|
||||
* @param treeLabelVo
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("编辑标签")
|
||||
@PostMapping("/update")
|
||||
public ResponseMessage update(@Valid @RequestBody TreeLabelVo treeLabelVo) {
|
||||
TreeLabelEntity treeLabelEntity = Convert.convert(TreeLabelEntity.class, treeLabelVo);
|
||||
iTreeLabelService.saveOrUpdateTag(treeLabelEntity);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 标签列表
|
||||
*
|
||||
* @return
|
||||
* @throws ExecutionException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
@ApiOperation("标签列表")
|
||||
@GetMapping("/list")
|
||||
public ResponseMessage list(@RequestParam(value = "like", required = false) String like
|
||||
) throws ExecutionException, InterruptedException {
|
||||
List<TreeLabelVo> rootLabel = iTreeLabelService.getTreeLabellist(like);
|
||||
return Result.success(rootLabel);
|
||||
}
|
||||
|
||||
@ApiOperation("标签删除|单个")
|
||||
@PostMapping("/delete/{id}")
|
||||
public ResponseMessage delete(@PathVariable("id") String id) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
String status = "0";
|
||||
boolean isDelete = iTreeLabelService.deleteById(id);
|
||||
if (!isDelete) {
|
||||
status = "1";
|
||||
}
|
||||
map.put("status", status);
|
||||
return Result.success(map);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @Author doudxw
|
||||
@@ -17,11 +18,13 @@ public interface ReportDao extends BaseMapper<ReportEntity> {
|
||||
|
||||
/**
|
||||
* 报告列表
|
||||
*
|
||||
* @param page
|
||||
* @param vo
|
||||
* @param idSet
|
||||
* @return
|
||||
*/
|
||||
IPage<ReportVo> list(IPage page, @Param("Vo") ReportQueryVo vo);
|
||||
IPage<ReportVo> list(IPage page, @Param("Vo") ReportQueryVo vo, @Param("idSet") Set<String> idSet);
|
||||
|
||||
/**
|
||||
* 报告日期列表
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.adc.da.report.dao.mysql;
|
||||
|
||||
import com.adc.da.report.eo.ReportLabelEntity;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author ThinkBook
|
||||
* @description 针对表【ts_report_label】的数据库操作Mapper
|
||||
* @createDate 2023-04-19 11:28:48
|
||||
* @Entity com.adc.da.report.eo.ReportLabelEntity
|
||||
*/
|
||||
public interface ReportLabelDao extends BaseMapper<ReportLabelEntity> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.adc.da.report.dao.mysql;
|
||||
|
||||
import com.adc.da.report.eo.TreeLabelEntity;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author ThinkBook
|
||||
* @description 针对表【ts_tree_label】的数据库操作Mapper
|
||||
* @createDate 2023-04-18 10:18:44
|
||||
* @Entity com.adc.da.report.eo.TreeLabelEntity
|
||||
*/
|
||||
public interface TreeLabelDao extends BaseMapper<TreeLabelEntity> {
|
||||
|
||||
/**
|
||||
* 获取当前层级标签中最大的orderNum
|
||||
* @param parentId
|
||||
* @return
|
||||
*/
|
||||
double getMaxNum(String parentId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -48,6 +48,9 @@ public class LabelEntity {
|
||||
@TableField("createDate")
|
||||
private String createDate;
|
||||
|
||||
/**
|
||||
* 排序顺序
|
||||
*/
|
||||
@TableField("orderNum")
|
||||
private int orderNum;
|
||||
|
||||
|
||||
@@ -54,22 +54,16 @@ public class ReportEntity {
|
||||
private String year;
|
||||
|
||||
/**
|
||||
* 标签1id
|
||||
* 报告涉密等级
|
||||
*/
|
||||
@TableField("labelOneId")
|
||||
private String labelOneId;
|
||||
@TableField("confidentialLevel")
|
||||
private String confidentialLevel;
|
||||
|
||||
/**
|
||||
* 标签2id
|
||||
* 隐私等级
|
||||
*/
|
||||
@TableField("labelTwoId")
|
||||
private String labelTwoId;
|
||||
|
||||
/**
|
||||
* 标签3id
|
||||
*/
|
||||
@TableField("labelThreeId")
|
||||
private String labelThreeId;
|
||||
@TableField("privacyLevel")
|
||||
private String privacyLevel;
|
||||
|
||||
/**
|
||||
* 文件id
|
||||
|
||||
@@ -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_label
|
||||
*/
|
||||
@TableName(value ="ts_report_label")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
public class ReportLabelEntity implements Serializable {
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@TableId(value = "id",type = IdType.INPUT)
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 报告id
|
||||
*/
|
||||
@TableField(value = "report_id")
|
||||
private String reportId;
|
||||
|
||||
/**
|
||||
* 标签id
|
||||
*/
|
||||
@TableField(value = "label_id")
|
||||
private String labelId;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
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_tree_label
|
||||
*/
|
||||
@TableName(value ="ts_tree_label")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class TreeLabelEntity implements Serializable {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@TableId(value = "id",type = IdType.INPUT)
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 标签名
|
||||
*/
|
||||
@TableField(value = "label")
|
||||
private String label;
|
||||
|
||||
/**
|
||||
* 父标签id
|
||||
*/
|
||||
@TableField(value = "parent_id")
|
||||
private String parentId;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@TableField(value = "remark")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 创建日期
|
||||
*/
|
||||
@TableField(value = "create_date")
|
||||
private String createDate;
|
||||
|
||||
/**
|
||||
* 排序序号
|
||||
*/
|
||||
@TableField(value = "order_num")
|
||||
private Double orderNum;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.adc.da.report.service;
|
||||
|
||||
import com.adc.da.report.eo.ReportLabelEntity;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @author ThinkBook
|
||||
* @description 针对表【ts_report_label】的数据库操作Service
|
||||
* @createDate 2023-04-19 11:28:48
|
||||
*/
|
||||
public interface IReportLabelService extends IService<ReportLabelEntity> {
|
||||
|
||||
/**
|
||||
* 根据报表Id删除所有报表标签关系
|
||||
* @param reportIds 报表id
|
||||
*/
|
||||
void deleteReportLabelByReportId(String[] reportIds);
|
||||
}
|
||||
@@ -15,10 +15,12 @@ public interface IReportService {
|
||||
|
||||
/**
|
||||
* 新增或编辑报告
|
||||
*
|
||||
* @param entity
|
||||
* @param labelList
|
||||
* @return 报告名称
|
||||
*/
|
||||
String insert(ReportEntity entity);
|
||||
String insert(ReportEntity entity, List<String> labelList);
|
||||
|
||||
/**
|
||||
* 报告列表展示
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.adc.da.report.service;
|
||||
|
||||
import com.adc.da.report.eo.TreeLabelEntity;
|
||||
import com.adc.da.report.vo.TreeLabelVo;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author ThinkBook
|
||||
* @description 针对表【ts_tree_label】的数据库操作Service
|
||||
* @createDate 2023-04-18 10:18:44
|
||||
*/
|
||||
public interface ITreeLabelService extends IService<TreeLabelEntity> {
|
||||
|
||||
/**
|
||||
* 获取标签树形结构
|
||||
*
|
||||
* @param like 模糊查询字段
|
||||
* @return
|
||||
*/
|
||||
List<TreeLabelVo> getTreeLabellist(String like);
|
||||
|
||||
|
||||
/**
|
||||
* 插入或更新标签
|
||||
* @param treeLabelEntity
|
||||
*/
|
||||
void saveOrUpdateTag(TreeLabelEntity treeLabelEntity);
|
||||
|
||||
/**
|
||||
* 删除标签
|
||||
*
|
||||
* @param id 标签id
|
||||
* @return
|
||||
*/
|
||||
boolean deleteByIdAutoOrder(String id);
|
||||
|
||||
/**
|
||||
* 删除标签
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
boolean deleteById(String id);
|
||||
|
||||
/**
|
||||
* 获取当前标签的路径
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
List<String> getLabelList(String id);
|
||||
|
||||
/**
|
||||
* 获取当前标签的路径(不包括自己)
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
List<String> getParentLabelList(String id);
|
||||
}
|
||||
+93
-14
@@ -1,23 +1,34 @@
|
||||
package com.adc.da.report.service.impl;
|
||||
|
||||
import com.adc.da.login.util.CommonUtils;
|
||||
import com.adc.da.report.constant.ReportConstants;
|
||||
import com.adc.da.report.dao.mysql.FileDao;
|
||||
import com.adc.da.report.dao.mysql.ReportDao;
|
||||
import com.adc.da.report.dao.mysql.ReportLabelDao;
|
||||
import com.adc.da.report.dao.mysql.ReportUserDao;
|
||||
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.IReportLabelService;
|
||||
import com.adc.da.report.service.IReportService;
|
||||
import com.adc.da.report.service.ITreeLabelService;
|
||||
import com.adc.da.report.util.*;
|
||||
import com.adc.da.report.vo.ReportQueryVo;
|
||||
import com.adc.da.report.vo.ReportVo;
|
||||
import com.adc.da.util.utils.FileUtil;
|
||||
import com.adc.da.util.utils.StringUtils;
|
||||
import com.adc.da.util.utils.UUID;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import io.swagger.models.auth.In;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
@@ -27,11 +38,9 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import javax.annotation.Resource;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -41,7 +50,8 @@ import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class IReportServiceImpl implements IReportService {
|
||||
public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
|
||||
implements IReportService {
|
||||
|
||||
@Resource
|
||||
private StringRedisTemplate stringRedisTemplate;
|
||||
@@ -52,6 +62,15 @@ public class IReportServiceImpl implements IReportService {
|
||||
@Resource
|
||||
private ReportUserDao reportUserDao;
|
||||
|
||||
@Resource
|
||||
private ReportLabelDao reportLabelDao;
|
||||
|
||||
@Resource
|
||||
private IReportLabelService iReportLabelService;
|
||||
|
||||
@Resource
|
||||
private ITreeLabelService iTreeLabelService;
|
||||
|
||||
@Resource
|
||||
private FileDao fileDao;
|
||||
|
||||
@@ -69,15 +88,17 @@ public class IReportServiceImpl implements IReportService {
|
||||
|
||||
@Autowired
|
||||
private ObsBootUtil obsBootUtil;
|
||||
|
||||
/**
|
||||
* 新增或编辑报告
|
||||
*
|
||||
* @param entity
|
||||
* @param labelList
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public String insert(ReportEntity entity) {
|
||||
public String insert(ReportEntity entity, List<String> labelList) {
|
||||
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
if (StringUtils.isEmpty(entity.getId())) {
|
||||
@@ -96,6 +117,12 @@ public class IReportServiceImpl implements IReportService {
|
||||
reportUserDao.insert(reportUserEntity);
|
||||
});
|
||||
|
||||
//插入报表标签关系表
|
||||
labelList.forEach((label) -> {
|
||||
ReportLabelEntity reportLabelEntity = new ReportLabelEntity(UUID.randomUUID10(), entity.getId(), label);
|
||||
reportLabelDao.insert(reportLabelEntity);
|
||||
});
|
||||
|
||||
CommonUtils.threadPoolExecutor().execute(() -> {
|
||||
//生成html
|
||||
try {
|
||||
@@ -126,6 +153,15 @@ public class IReportServiceImpl implements IReportService {
|
||||
reportUserDao.insert(reportUserEntity);
|
||||
});
|
||||
|
||||
//修改报表标签关系表(先删后增)
|
||||
iReportLabelService.deleteReportLabelByReportId(new String[]{entity.getId()});
|
||||
|
||||
//插入报表标签关系表
|
||||
labelList.forEach((label) -> {
|
||||
ReportLabelEntity reportLabelEntity = new ReportLabelEntity(UUID.randomUUID10(), entity.getId(), label);
|
||||
reportLabelDao.insert(reportLabelEntity);
|
||||
});
|
||||
|
||||
CommonUtils.threadPoolExecutor().execute(() -> {
|
||||
String key = entity.getId() + "-" + entity.getFileId();
|
||||
Boolean hasKey = stringRedisTemplate.hasKey(key);
|
||||
@@ -170,23 +206,42 @@ public class IReportServiceImpl implements IReportService {
|
||||
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);
|
||||
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 ("ppt".equals(fileEntity.getFileType().toLowerCase()) || "pptx".equals(fileEntity.getFileType())) {
|
||||
else if (ReportConstants.FILE_EXTENSIONS_PPT.equalsIgnoreCase(fileEntity.getFileType()) ||
|
||||
ReportConstants.FILE_EXTENSIONS_PPTX.equalsIgnoreCase(fileEntity.getFileType())) {
|
||||
c.setFileType("1");
|
||||
}
|
||||
//excel文件
|
||||
else if ("xls".equals(fileEntity.getFileType().toLowerCase()) || "xlsx".equals(fileEntity.getFileType())) {
|
||||
else if (ReportConstants.FILE_EXTENSIONS_XLS.equalsIgnoreCase(fileEntity.getFileType()) ||
|
||||
ReportConstants.FILE_EXTENSIONS_XLSX.equalsIgnoreCase(fileEntity.getFileType())) {
|
||||
c.setFileType("2");
|
||||
}
|
||||
//pdf文件
|
||||
else if ("pdf".equals(fileEntity.getFileType().toLowerCase())) {
|
||||
else if (ReportConstants.FILE_EXTENSIONS_PDF.equalsIgnoreCase(fileEntity.getFileType())) {
|
||||
c.setFileType("3");
|
||||
}
|
||||
//word文件
|
||||
@@ -199,7 +254,7 @@ public class IReportServiceImpl implements IReportService {
|
||||
? 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()))
|
||||
new QueryWrapper<ReportUserEntity>().eq("reportId", c.getId()))
|
||||
.stream().map(ReportUserEntity::getUserId).collect(Collectors.toList());
|
||||
c.setReportUserIdList(userIdList);
|
||||
});
|
||||
@@ -208,6 +263,28 @@ public class IReportServiceImpl implements IReportService {
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 找出报告的所有标签中最长的那条路径
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
private List<String> findLabelList(String id) {
|
||||
LambdaQueryWrapper<ReportLabelEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(ReportLabelEntity::getReportId, id);
|
||||
List<ReportLabelEntity> reportLabelEntities = iReportLabelService.list(wrapper);
|
||||
//找出所有路径
|
||||
List<List<String>> labelList = new ArrayList<>();
|
||||
for (ReportLabelEntity entity : reportLabelEntities) {
|
||||
labelList.add(iTreeLabelService.getLabelList(entity.getLabelId()));
|
||||
}
|
||||
//返回最长的那条路径
|
||||
labelList = labelList.stream()
|
||||
.sorted(Comparator.comparingInt(List<String>::size).reversed())
|
||||
.collect(Collectors.toList());
|
||||
return labelList.get(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 报告删除
|
||||
*
|
||||
@@ -219,6 +296,8 @@ public class IReportServiceImpl implements IReportService {
|
||||
public List<String> delete(String ids) {
|
||||
List<String> nameList = new ArrayList<>();
|
||||
String[] idList = ids.split(",");
|
||||
//删除所有报表标签关系记录
|
||||
iReportLabelService.deleteReportLabelByReportId(idList);
|
||||
for (String id : idList) {
|
||||
ReportEntity entity = reportDao.selectById(id);
|
||||
entity.setDelFlag("1");
|
||||
@@ -297,12 +376,12 @@ public class IReportServiceImpl implements IReportService {
|
||||
*/
|
||||
public String createHtmlString(String fileId) throws Exception {
|
||||
FileEntity fileEntity = fileDao.selectById(fileId);
|
||||
String path = uploadFile + fileEntity.getSavePath();
|
||||
String path = uploadFile + fileEntity.getSavePath();
|
||||
FileOutputStream outputStream = new FileOutputStream(path);
|
||||
// 上传方式:阿里云:alioss 华为云:hwobs
|
||||
if (uploadType.equals("hwobs")){
|
||||
if (uploadType.equals("hwobs")) {
|
||||
obsBootUtil.getFileFromOBS(fileEntity.getSavePath(), outputStream);
|
||||
}else if (uploadType.equals("alioss")){
|
||||
} else if (uploadType.equals("alioss")) {
|
||||
ossClientUtil.getFileFromOSS(fileEntity.getSavePath(), outputStream);
|
||||
}
|
||||
|
||||
|
||||
+258
@@ -0,0 +1,258 @@
|
||||
package com.adc.da.report.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import com.adc.da.report.constant.TreeLabelConstants;
|
||||
import com.adc.da.report.dao.mysql.ReportLabelDao;
|
||||
import com.adc.da.report.eo.ReportLabelEntity;
|
||||
import com.adc.da.report.vo.TreeLabelVo;
|
||||
import com.adc.da.util.exception.AdcDaBaseException;
|
||||
import com.adc.da.util.utils.StringUtils;
|
||||
import com.adc.da.util.utils.UUID;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.adc.da.report.eo.TreeLabelEntity;
|
||||
import com.adc.da.report.service.ITreeLabelService;
|
||||
import com.adc.da.report.dao.mysql.TreeLabelDao;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author ThinkBook
|
||||
* @description 针对表【ts_tree_label】的数据库操作Service实现
|
||||
* @createDate 2023-04-18 10:18:44
|
||||
*/
|
||||
@Service
|
||||
public class ITreeLabelServiceImpl extends ServiceImpl<TreeLabelDao, TreeLabelEntity>
|
||||
implements ITreeLabelService {
|
||||
|
||||
@Resource
|
||||
private TreeLabelDao treeLabelDao;
|
||||
|
||||
@Resource
|
||||
private ReportLabelDao reportLabelDao;
|
||||
|
||||
|
||||
@Override
|
||||
public List<TreeLabelVo> getTreeLabellist(String like) {
|
||||
//查询所有标签
|
||||
List<TreeLabelEntity> treeLabelEntities = list();
|
||||
//找出根节点
|
||||
TreeLabelEntity rootTag = treeLabelEntities.stream().
|
||||
filter(treeLabelEntity ->
|
||||
TreeLabelConstants.ROOT_TAG_PARENT_ID.equals(treeLabelEntity.getParentId()))
|
||||
.collect(Collectors.toList()).get(0);
|
||||
|
||||
// 目标List对象
|
||||
List<TreeLabelVo> treeLabelVos = new ArrayList<>();
|
||||
|
||||
// 将原始List中的属性拷贝到目标List中的对应属性
|
||||
for (TreeLabelEntity source : treeLabelEntities) {
|
||||
TreeLabelVo target = new TreeLabelVo();
|
||||
BeanUtil.copyProperties(source, target);
|
||||
target.setValue(source.getId());
|
||||
treeLabelVos.add(target);
|
||||
}
|
||||
|
||||
//分组排序
|
||||
Map<String, List<TreeLabelVo>> groupedLabelVos = treeLabelVos.stream()
|
||||
.collect(Collectors.groupingBy(TreeLabelVo::getParentId));
|
||||
//排序
|
||||
Map<String, List<TreeLabelVo>> sortedGroupedLabelVos = groupedLabelVos.entrySet().stream()
|
||||
.map(entry -> {
|
||||
List<TreeLabelVo> sortedList = entry.getValue();
|
||||
sortedList.sort(Comparator.comparing(TreeLabelVo::getOrderNum));
|
||||
return new AbstractMap.SimpleEntry<>(entry.getKey(), sortedList);
|
||||
})
|
||||
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
|
||||
//合并
|
||||
List<TreeLabelVo> labelVoList = sortedGroupedLabelVos.values().stream()
|
||||
.flatMap(Collection::stream)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
//组装成树形结构
|
||||
List<TreeLabelVo> tree = createTree(rootTag.getParentId(), labelVoList);
|
||||
//模糊查询
|
||||
if (StringUtils.isNoneBlank(like)) {
|
||||
TreeLabelVo treeLabelVo = filterByName(tree.get(0), like);
|
||||
if (Objects.nonNull(treeLabelVo)) {
|
||||
return Collections.singletonList(treeLabelVo);
|
||||
}
|
||||
return Collections.singletonList(Convert.convert(TreeLabelVo.class, rootTag));
|
||||
}
|
||||
return tree;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveOrUpdateTag(TreeLabelEntity entity) {
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
//不能和根节点的父ID相同
|
||||
if (TreeLabelConstants.ROOT_TAG_PARENT_ID.equals(entity.getParentId())) {
|
||||
throw new AdcDaBaseException("不能和根节点的上级标签相同");
|
||||
}
|
||||
int count = treeLabelDao.selectCount(new QueryWrapper<TreeLabelEntity>()
|
||||
.eq("id", entity.getParentId()));
|
||||
if (count == 0) {
|
||||
throw new AdcDaBaseException("上级标签不存在");
|
||||
}
|
||||
|
||||
//新增标签
|
||||
if (StringUtils.isEmpty(entity.getId())) {
|
||||
entity.setId(UUID.randomUUID10());
|
||||
entity.setCreateDate(format.format(new Date()));
|
||||
if (Objects.isNull(entity.getOrderNum())) {
|
||||
double maxNum = treeLabelDao.getMaxNum(entity.getParentId());
|
||||
entity.setOrderNum(maxNum + 1);
|
||||
}
|
||||
treeLabelDao.insert(entity);
|
||||
} else {
|
||||
//编辑标签
|
||||
//不能设置上级标签为自己
|
||||
if (entity.getParentId().equals(entity.getId())) {
|
||||
throw new AdcDaBaseException("不能设置上级标签为自身");
|
||||
}
|
||||
TreeLabelEntity treeLabelEntity = treeLabelDao.selectById(entity.getId());
|
||||
if (Objects.nonNull(treeLabelEntity)) {
|
||||
treeLabelDao.updateById(entity);
|
||||
} else {
|
||||
throw new AdcDaBaseException("标签id无效");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteByIdAutoOrder(String id) {
|
||||
TreeLabelEntity labelEntity = treeLabelDao.selectById(id);
|
||||
String parentId = labelEntity.getParentId();
|
||||
double currentNum = labelEntity.getOrderNum();
|
||||
double maxNum = treeLabelDao.getMaxNum(parentId);
|
||||
//删除标签
|
||||
treeLabelDao.delete(new QueryWrapper<TreeLabelEntity>().eq("id", id));
|
||||
//如果删除的不是最后一个标签,需要移动前面的标签
|
||||
if (currentNum != maxNum) {
|
||||
LambdaQueryWrapper<TreeLabelEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.gt(TreeLabelEntity::getOrderNum, currentNum)
|
||||
.le(TreeLabelEntity::getOrderNum, maxNum)
|
||||
.eq(TreeLabelEntity::getParentId, parentId);
|
||||
List<TreeLabelEntity> labelList = treeLabelDao.selectList(wrapper);
|
||||
for (TreeLabelEntity entity : labelList) {
|
||||
entity.setOrderNum(entity.getOrderNum() - 1);
|
||||
treeLabelDao.updateById(entity);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean deleteById(String id) {
|
||||
List<String> nodeAndChildrenIds = findNodeAndChildrenIds(getTreeLabelRoot(), id).stream().distinct().collect(Collectors.toList());
|
||||
LambdaQueryWrapper<ReportLabelEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.in(ReportLabelEntity::getLabelId, nodeAndChildrenIds);
|
||||
reportLabelDao.delete(wrapper);
|
||||
int i = treeLabelDao.deleteBatchIds(nodeAndChildrenIds);
|
||||
return i != 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getLabelList(String id) {
|
||||
List<String> labelList = new ArrayList<>();
|
||||
TreeLabelEntity treeLabelEntity = getById(id);
|
||||
while (!TreeLabelConstants.ROOT_TAG_PARENT_ID.equals(treeLabelEntity.getParentId())) {
|
||||
labelList.add(treeLabelEntity.getId());
|
||||
treeLabelEntity = getById(treeLabelEntity.getParentId());
|
||||
}
|
||||
TreeLabelEntity root = getById(TreeLabelConstants.ROOT_LABEL_ID);
|
||||
labelList.add(root.getId());
|
||||
Collections.reverse(labelList);
|
||||
return labelList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getParentLabelList(String id) {
|
||||
List<String> labelList = new ArrayList<>();
|
||||
TreeLabelEntity treeLabelEntity = getById(id);
|
||||
//获取上层标签
|
||||
treeLabelEntity = getById(treeLabelEntity.getParentId());
|
||||
labelList.add(treeLabelEntity.getId());
|
||||
while (!TreeLabelConstants.ROOT_TAG_PARENT_ID.equals(treeLabelEntity.getParentId())) {
|
||||
treeLabelEntity = getById(treeLabelEntity.getParentId());
|
||||
labelList.add(treeLabelEntity.getId());
|
||||
}
|
||||
Collections.reverse(labelList);
|
||||
return labelList;
|
||||
}
|
||||
|
||||
private List<TreeLabelVo> createTree(String rootParentId, List<TreeLabelVo> treeLabelVos) {
|
||||
List<TreeLabelVo> tree = new ArrayList<>();
|
||||
for (TreeLabelVo label : treeLabelVos) {
|
||||
if (label.getParentId().equals(rootParentId)) {
|
||||
label.setChildren(createTree(label.getId(), treeLabelVos));
|
||||
tree.add(label);
|
||||
}
|
||||
}
|
||||
return tree;
|
||||
}
|
||||
|
||||
public static TreeLabelVo filterByName(TreeLabelVo root, String name) {
|
||||
TreeLabelVo newRoot = new TreeLabelVo();
|
||||
newRoot.setId(root.getId());
|
||||
newRoot.setLabel(root.getLabel());
|
||||
newRoot.setParentId(root.getParentId());
|
||||
newRoot.setOrderNum(root.getOrderNum());
|
||||
List<TreeLabelVo> childLabel = new ArrayList<>();
|
||||
if (root.getChildren() != null) {
|
||||
for (TreeLabelVo child : root.getChildren()) {
|
||||
TreeLabelVo newChild = filterByName(child, name);
|
||||
if (newChild != null) {
|
||||
childLabel.add(newChild);
|
||||
}
|
||||
}
|
||||
}
|
||||
newRoot.setChildren(childLabel.isEmpty() ? null : childLabel);
|
||||
return root.getLabel().contains(name) || !childLabel.isEmpty() ? newRoot : null;
|
||||
}
|
||||
|
||||
public static List<String> findNodeAndChildrenIds(TreeLabelVo root, String nodeId) {
|
||||
List<String> result = new ArrayList<>();
|
||||
if (root == null) {
|
||||
return result;
|
||||
}
|
||||
if (root.getId().equals(nodeId)) {
|
||||
result.add(root.getId());
|
||||
collectChildrenIds(root, result);
|
||||
} else {
|
||||
for (TreeLabelVo child : root.getChildren()) {
|
||||
List<String> childResult = findNodeAndChildrenIds(child, nodeId);
|
||||
if (!childResult.isEmpty()) {
|
||||
result.addAll(childResult);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private static void collectChildrenIds(TreeLabelVo node, List<String> result) {
|
||||
result.add(node.getId());
|
||||
for (TreeLabelVo child : node.getChildren()) {
|
||||
collectChildrenIds(child, result);
|
||||
}
|
||||
}
|
||||
|
||||
private TreeLabelVo getTreeLabelRoot() {
|
||||
return getTreeLabellist(null).get(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
package com.adc.da.report.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.adc.da.report.eo.ReportLabelEntity;
|
||||
import com.adc.da.report.service.IReportLabelService;
|
||||
import com.adc.da.report.dao.mysql.ReportLabelDao;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @author ThinkBook
|
||||
* @description 针对表【ts_report_label】的数据库操作Service实现
|
||||
* @createDate 2023-04-19 11:28:48
|
||||
*/
|
||||
@Service
|
||||
public class ReportLabelServiceImpl extends ServiceImpl<ReportLabelDao, ReportLabelEntity>
|
||||
implements IReportLabelService {
|
||||
|
||||
@Resource
|
||||
private ReportLabelDao reportLabelDao;
|
||||
|
||||
@Override
|
||||
public void deleteReportLabelByReportId(String[] reportId) {
|
||||
LambdaQueryWrapper<ReportLabelEntity> reportLabelWrapper = new LambdaQueryWrapper<>();
|
||||
for (String id : reportId) {
|
||||
reportLabelWrapper.eq(ReportLabelEntity::getReportId, id);
|
||||
}
|
||||
reportLabelDao.delete(reportLabelWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,120 @@
|
||||
package com.adc.da.report.util;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import com.adc.da.report.constant.ReportConstants;
|
||||
import org.apache.poi.hslf.usermodel.HSLFShape;
|
||||
import org.apache.poi.hslf.usermodel.HSLFSlide;
|
||||
import org.apache.poi.hslf.usermodel.HSLFTextShape;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
||||
import org.apache.poi.ss.usermodel.Cell;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.apache.poi.xslf.usermodel.XMLSlideShow;
|
||||
import org.apache.poi.xslf.usermodel.XSLFShape;
|
||||
import org.apache.poi.xslf.usermodel.XSLFSlide;
|
||||
import org.apache.poi.xslf.usermodel.XSLFTextShape;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.apache.poi.hwpf.HWPFDocument;
|
||||
import org.apache.poi.hwpf.extractor.WordExtractor;
|
||||
import org.apache.poi.xwpf.usermodel.XWPFDocument;
|
||||
import org.apache.poi.xwpf.extractor.XWPFWordExtractor;
|
||||
import org.apache.poi.hslf.usermodel.HSLFSlideShow;
|
||||
import org.apache.poi.hslf.extractor.PowerPointExtractor;
|
||||
import org.apache.pdfbox.pdmodel.PDDocument;
|
||||
import org.apache.pdfbox.text.PDFTextStripper;
|
||||
|
||||
/**
|
||||
* 提取文件中的内容
|
||||
*
|
||||
* @author caihaohan
|
||||
*/
|
||||
public class FileContentUtil {
|
||||
|
||||
public static String readFileContent(File file) throws IOException {
|
||||
String fileName = file.getName();
|
||||
String fileExtension = fileName.substring(fileName.lastIndexOf(".") + 1);
|
||||
StringBuilder content = new StringBuilder();
|
||||
|
||||
FileInputStream fis = new FileInputStream(file);
|
||||
|
||||
switch (fileExtension) {
|
||||
case ReportConstants.FILE_EXTENSIONS_XLS:
|
||||
HSSFWorkbook workbookXls = new HSSFWorkbook(fis);
|
||||
content = new StringBuilder(readExcelContent(workbookXls));
|
||||
break;
|
||||
case ReportConstants.FILE_EXTENSIONS_XLSX:
|
||||
XSSFWorkbook workbookXlsx = new XSSFWorkbook(fis);
|
||||
content = new StringBuilder(readExcelContent(workbookXlsx));
|
||||
break;
|
||||
case ReportConstants.FILE_EXTENSIONS_DOC:
|
||||
HWPFDocument documentDoc = new HWPFDocument(fis);
|
||||
WordExtractor extractorDoc = new WordExtractor(documentDoc);
|
||||
content = new StringBuilder(extractorDoc.getText());
|
||||
break;
|
||||
case ReportConstants.FILE_EXTENSIONS_DOCX:
|
||||
XWPFDocument documentDocx = new XWPFDocument(fis);
|
||||
XWPFWordExtractor extractorDocx = new XWPFWordExtractor(documentDocx);
|
||||
content = new StringBuilder(extractorDocx.getText());
|
||||
break;
|
||||
case ReportConstants.FILE_EXTENSIONS_PPT:
|
||||
HSLFSlideShow ppt = new HSLFSlideShow(fis);
|
||||
for (HSLFSlide slide : ppt.getSlides()) {
|
||||
for (HSLFShape shape : slide.getShapes()) {
|
||||
if (shape instanceof HSLFTextShape) {
|
||||
HSLFTextShape textShape = (HSLFTextShape) shape;
|
||||
content.append(textShape.getText()).append("\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ReportConstants.FILE_EXTENSIONS_PPTX:
|
||||
XMLSlideShow pptx = new XMLSlideShow(fis);
|
||||
for (XSLFSlide slide : pptx.getSlides()) {
|
||||
for (XSLFShape shape : slide.getShapes()) {
|
||||
if (shape instanceof XSLFTextShape) {
|
||||
XSLFTextShape textShape = (XSLFTextShape) shape;
|
||||
content.append(textShape.getText()).append("\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ReportConstants.FILE_EXTENSIONS_PDF:
|
||||
PDDocument document = PDDocument.load(fis);
|
||||
PDFTextStripper stripper = new PDFTextStripper();
|
||||
content = new StringBuilder(stripper.getText(document));
|
||||
default:
|
||||
}
|
||||
fis.close();
|
||||
return content.toString();
|
||||
}
|
||||
|
||||
private static String readExcelContent(org.apache.poi.ss.usermodel.Workbook workbook) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
int numberOfSheets = workbook.getNumberOfSheets();
|
||||
for (int i = 0; i < numberOfSheets; i++) {
|
||||
org.apache.poi.ss.usermodel.Sheet sheet = workbook.getSheetAt(i);
|
||||
for (Row row : sheet) {
|
||||
for (Cell cell : row) {
|
||||
sb.append(cell.toString());
|
||||
sb.append("\t");
|
||||
}
|
||||
sb.append("\n");
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
File file = new File("C:\\Users\\ThinkBook\\Desktop\\hzwl-projcets\\测试文件\\testppt.ppt");
|
||||
try {
|
||||
String content = FileContentUtil.readFileContent(file);
|
||||
System.out.println("File content: " + content);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -22,24 +22,19 @@ public class ReportQueryVo {
|
||||
private int pageSize;
|
||||
|
||||
/**
|
||||
* 搜索内容
|
||||
* 报告名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 全文模糊检索的关键词
|
||||
*/
|
||||
private String keyContent;
|
||||
|
||||
/**
|
||||
* 标签1
|
||||
* 标签集合
|
||||
*/
|
||||
private List<String> labelOneId;
|
||||
|
||||
/**
|
||||
* 标签2
|
||||
*/
|
||||
private List<String> labelTwoId;
|
||||
|
||||
/**
|
||||
* 标签3
|
||||
*/
|
||||
private List<String> labelThreeId;
|
||||
private List<String> labelId;
|
||||
|
||||
/**
|
||||
* 年
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.adc.da.report.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
@@ -41,21 +42,6 @@ public class ReportVo {
|
||||
*/
|
||||
private String year;
|
||||
|
||||
/**
|
||||
* 标签1
|
||||
*/
|
||||
private String labelOneName;
|
||||
|
||||
/**
|
||||
* 标签2
|
||||
*/
|
||||
private String labelTwoName;
|
||||
|
||||
/**
|
||||
* 标签3
|
||||
*/
|
||||
private String labelThreeName;
|
||||
|
||||
/**
|
||||
* 文件id
|
||||
*/
|
||||
@@ -82,19 +68,19 @@ public class ReportVo {
|
||||
private List<String> reportUserIdList;
|
||||
|
||||
/**
|
||||
* 标签1id
|
||||
* 报告涉密等级
|
||||
*/
|
||||
private String labelOneId;
|
||||
private String confidentialLevel;
|
||||
|
||||
/**
|
||||
* 标签2id
|
||||
* 隐私等级
|
||||
*/
|
||||
private String labelTwoId;
|
||||
private String privacyLevel;
|
||||
|
||||
/**
|
||||
* 标签3id
|
||||
* 关联的标签id集合
|
||||
*/
|
||||
private String labelThreeId;
|
||||
private List<String> labelList;
|
||||
|
||||
/**
|
||||
* 文件大小
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.adc.da.report.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author ThinkBook
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
public class TreeLabelVo {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private String value;
|
||||
|
||||
/**
|
||||
* 标签名称
|
||||
*/
|
||||
@NotBlank(message = "名称不能为空")
|
||||
private String label;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 父id
|
||||
*/
|
||||
@NotBlank(message = "上级标签不能为空")
|
||||
private String parentId;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Double orderNum;
|
||||
|
||||
/**
|
||||
* 子标签
|
||||
*/
|
||||
private List<TreeLabelVo> children;
|
||||
|
||||
public TreeLabelVo(String parentId) {
|
||||
this.parentId = parentId;
|
||||
this.children = new ArrayList<>();
|
||||
}
|
||||
}
|
||||
@@ -3,117 +3,155 @@
|
||||
<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 )-->
|
||||
|
||||
<!-- <!–文本搜索–>-->
|
||||
<!-- <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>-->
|
||||
|
||||
<!-- <!–年份搜索–>-->
|
||||
<!-- <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>-->
|
||||
|
||||
<!-- <!–标签搜索–>-->
|
||||
<!-- <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 )-->
|
||||
<!-- <!–文本搜索–>-->
|
||||
<!-- <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>-->
|
||||
|
||||
<!-- <!–年份搜索–>-->
|
||||
<!-- <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>-->
|
||||
|
||||
<!-- <!–标签搜索–>-->
|
||||
<!-- <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
|
||||
|
||||
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 )
|
||||
|
||||
<!--文本搜索-->
|
||||
<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 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 b1.year in
|
||||
<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>
|
||||
|
||||
<!--标签搜索-->
|
||||
<if test="Vo.labelOneId !=null and Vo.labelOneId.size() >0">
|
||||
and b1.labelOneId in
|
||||
<foreach collection="Vo.labelOneId" item="labelOneId" open="(" separator="," close=")">
|
||||
#{labelOneId}
|
||||
<!--id搜索-->
|
||||
<if test="idSet !=null and idSet.size() > 0">
|
||||
and t.id in
|
||||
<foreach collection="idSet" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</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 test="Vo.usid != null and Vo.usid != ''">
|
||||
and t.userId=#{Vo.usid}
|
||||
</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 )
|
||||
<!--文本搜索-->
|
||||
<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>
|
||||
|
||||
<!--年份搜索-->
|
||||
<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>
|
||||
|
||||
<!--标签搜索-->
|
||||
<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
|
||||
|
||||
|
||||
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
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.adc.da.report.dao.mysql.TreeLabelDao">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.adc.da.report.eo.TreeLabelEntity">
|
||||
<id property="id" column="id" jdbcType="VARCHAR"/>
|
||||
<result property="name" column="name" jdbcType="VARCHAR"/>
|
||||
<result property="parentid" column="parent_id" jdbcType="VARCHAR"/>
|
||||
<result property="createdate" column="create_date" jdbcType="VARCHAR"/>
|
||||
<result property="ordernum" column="order_num" jdbcType="DOUBLE"/>
|
||||
<result property="remark" column="remark" jdbcType="VARCHAR"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="getMaxNum" parameterType="string" resultType="double">
|
||||
select max(t.order_num)
|
||||
from ts_tree_label t
|
||||
where t.parent_id = #{parentId}
|
||||
</select>
|
||||
</mapper>
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,165 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.adc.da.report.dao.mysql.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 )-->
|
||||
|
||||
<!-- <!–文本搜索–>-->
|
||||
<!-- <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>-->
|
||||
|
||||
<!-- <!–年份搜索–>-->
|
||||
<!-- <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>-->
|
||||
|
||||
<!-- <!–标签搜索–>-->
|
||||
<!-- <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 )-->
|
||||
<!-- <!–文本搜索–>-->
|
||||
<!-- <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>-->
|
||||
|
||||
<!-- <!–年份搜索–>-->
|
||||
<!-- <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>-->
|
||||
|
||||
<!-- <!–标签搜索–>-->
|
||||
<!-- <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>
|
||||
|
||||
|
||||
<!--用户搜索-->
|
||||
<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
|
||||
where del_flag='0'
|
||||
<if test="usid !='' and usid !=null">
|
||||
and t2.userId=#{usid}
|
||||
</if>
|
||||
ORDER BY year DESC
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -3,7 +3,11 @@ package com.adc.da.sys.service.iservice;
|
||||
import com.adc.da.sys.entity.UserEO;
|
||||
import com.adc.da.sys.vo.UserImportVO;
|
||||
import com.adc.da.sys.vo.UserVO;
|
||||
import com.adc.da.sys.vo.ddm.DdmUserQueryVO;
|
||||
import com.adc.da.sys.vo.ddm.DdmUserVO;
|
||||
import com.adc.da.util.http.PageInfo;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -21,6 +25,14 @@ public interface IUserEoService {
|
||||
*/
|
||||
UserEO getUserByLoginName(String userName,String usid);
|
||||
|
||||
/**
|
||||
* 根据邮箱和id查询用户数量
|
||||
* @param email
|
||||
* @param usid
|
||||
* @return
|
||||
*/
|
||||
int getUserCountByEmail(String email,String usid);
|
||||
|
||||
/**
|
||||
* 新增或者编辑用户
|
||||
* @param eo
|
||||
@@ -43,8 +55,13 @@ public interface IUserEoService {
|
||||
|
||||
UserEO getUserByLoginNameNotDeleted(String userName);
|
||||
|
||||
public PageInfo<DdmUserVO> getUserPage(DdmUserQueryVO query);
|
||||
|
||||
public void importExcelUser(List<UserImportVO> list);
|
||||
|
||||
List<Map<String, Object>> allList(String account, String roleName);
|
||||
|
||||
List<UserEO> getUserByMail(List<String> mailList);
|
||||
|
||||
List<UserEO> getUserByAccount(List<String> mailList);
|
||||
}
|
||||
|
||||
@@ -163,11 +163,6 @@
|
||||
#{id}
|
||||
</foreach>
|
||||
</select>
|
||||
<!-- <select id="getUserEoById" resultMap="BaseResultMap">-->
|
||||
<!-- select u.* , org.ORG_NAME as orgName from ts_user u-->
|
||||
<!-- LEFT JOIN tr_user_org tuo on u.USID = tuo.ORG_ID-->
|
||||
<!-- LEFT JOIN ts_org org on org.ID = tuo.ORG_ID-->
|
||||
<!-- WHERE u.id = #{usid}-->
|
||||
<!-- </select>-->
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,57 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<mappings xmlns="http://dozer.sourceforge.net" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://dozer.sourceforge.net
|
||||
http://dozer.sourceforge.net/schema/beanmapping.xsd">
|
||||
<!--由于VO 和 EO 字段名称非完全对应,且有的字段类型不一样,所有需要依靠dozer进行转换-->
|
||||
<!--调用时依靠Controller 中
|
||||
@Resource private BeanMapper beanMapper 进行自动装配,然后调用相应方法进行匹配-->
|
||||
|
||||
|
||||
<mapping>
|
||||
<!--角色对应实体类-->
|
||||
<class-a>com.adc.da.sys.entity.RoleEO</class-a>
|
||||
<class-b>com.adc.da.sys.vo.ddm.DdmRoleVO</class-b>
|
||||
|
||||
<!--区别字段-->
|
||||
<field>
|
||||
<a>id</a>
|
||||
<b>rid</b>
|
||||
</field>
|
||||
<field>
|
||||
<a>name</a>
|
||||
<b>roleName</b>
|
||||
</field>
|
||||
<field>
|
||||
<a>name</a>
|
||||
<b>roleCode</b>
|
||||
</field>
|
||||
<field>
|
||||
<a>remarks</a>
|
||||
<b>rdesc</b>
|
||||
</field>
|
||||
<field>
|
||||
<a>delFlag</a>
|
||||
<b>enabled</b>
|
||||
</field>
|
||||
<field>
|
||||
<a>menuEOIdList</a>
|
||||
<b>menusstr</b>
|
||||
</field>
|
||||
<field>
|
||||
<a>menuEOList</a>
|
||||
<b>menus</b>
|
||||
</field>
|
||||
</mapping>
|
||||
|
||||
<mapping>
|
||||
<!--菜单对应实体类-->
|
||||
<class-a>com.adc.da.sys.entity.MenuEO</class-a>
|
||||
<class-b>com.adc.da.sys.vo.MenuVO</class-b>
|
||||
</mapping>
|
||||
<mapping date-format="yyyy-MM-dd HH:mm:ss">
|
||||
<!--日志对应实体类,存在时间格式转换 -->
|
||||
<class-a>com.adc.da.log.entity.LogEO</class-a>
|
||||
<class-b>com.adc.da.log.vo.LogVO</class-b>
|
||||
</mapping>
|
||||
|
||||
</mappings>
|
||||
Reference in New Issue
Block a user