diff --git a/adc-da-login/src/main/java/com/adc/da/login/util/CommonUtils.java b/adc-da-login/src/main/java/com/adc/da/login/util/CommonUtils.java index 7cd4cfa..e834ff7 100644 --- a/adc-da-login/src/main/java/com/adc/da/login/util/CommonUtils.java +++ b/adc-da-login/src/main/java/com/adc/da/login/util/CommonUtils.java @@ -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 getRoleList() throws Exception { diff --git a/adc-da-main/target/classes/application-dev.properties b/adc-da-main/target/classes/application-dev.properties new file mode 100644 index 0000000..b53670e --- /dev/null +++ b/adc-da-main/target/classes/application-dev.properties @@ -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= + + diff --git a/adc-da-report/src/main/java/com/adc/da/report/constant/ReportConstants.java b/adc-da-report/src/main/java/com/adc/da/report/constant/ReportConstants.java new file mode 100644 index 0000000..d1a2e3b --- /dev/null +++ b/adc-da-report/src/main/java/com/adc/da/report/constant/ReportConstants.java @@ -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"; + +} diff --git a/adc-da-report/src/main/java/com/adc/da/report/constant/TreeLabelConstants.java b/adc-da-report/src/main/java/com/adc/da/report/constant/TreeLabelConstants.java new file mode 100644 index 0000000..facc2a1 --- /dev/null +++ b/adc-da-report/src/main/java/com/adc/da/report/constant/TreeLabelConstants.java @@ -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"; +} diff --git a/adc-da-report/src/main/java/com/adc/da/report/controller/LabelManageController.java b/adc-da-report/src/main/java/com/adc/da/report/controller/LabelManageController.java index 8516866..5f65b0e 100644 --- a/adc-da-report/src/main/java/com/adc/da/report/controller/LabelManageController.java +++ b/adc-da-report/src/main/java/com/adc/da/report/controller/LabelManageController.java @@ -26,7 +26,6 @@ import java.util.concurrent.ExecutionException; */ @Slf4j @RestController -@Api(tags = "标签管理") @RequestMapping("/${restPath}/label") public class LabelManageController { diff --git a/adc-da-report/src/main/java/com/adc/da/report/controller/ReportManageConroller.java b/adc-da-report/src/main/java/com/adc/da/report/controller/ReportManageConroller.java index a22c1fb..4dafd1b 100644 --- a/adc-da-report/src/main/java/com/adc/da/report/controller/ReportManageConroller.java +++ b/adc-da-report/src/main/java/com/adc/da/report/controller/ReportManageConroller.java @@ -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 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 list = reportService.list(vo); + return Result.success(list); + } + /** * 删除报告 * @param ids id diff --git a/adc-da-report/src/main/java/com/adc/da/report/controller/TreeLabelManagerController.java b/adc-da-report/src/main/java/com/adc/da/report/controller/TreeLabelManagerController.java new file mode 100644 index 0000000..28716d6 --- /dev/null +++ b/adc-da-report/src/main/java/com/adc/da/report/controller/TreeLabelManagerController.java @@ -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 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 rootLabel = iTreeLabelService.getTreeLabellist(like); + return Result.success(rootLabel); + } + + @ApiOperation("标签删除|单个") + @PostMapping("/delete/{id}") + public ResponseMessage delete(@PathVariable("id") String id) { + Map map = new HashMap<>(); + String status = "0"; + boolean isDelete = iTreeLabelService.deleteById(id); + if (!isDelete) { + status = "1"; + } + map.put("status", status); + return Result.success(map); + } + +} diff --git a/adc-da-report/src/main/java/com/adc/da/report/dao/mysql/ReportDao.java b/adc-da-report/src/main/java/com/adc/da/report/dao/mysql/ReportDao.java index 7efae2a..90a0d73 100644 --- a/adc-da-report/src/main/java/com/adc/da/report/dao/mysql/ReportDao.java +++ b/adc-da-report/src/main/java/com/adc/da/report/dao/mysql/ReportDao.java @@ -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 { /** * 报告列表 + * * @param page * @param vo + * @param idSet * @return */ - IPage list(IPage page, @Param("Vo") ReportQueryVo vo); + IPage list(IPage page, @Param("Vo") ReportQueryVo vo, @Param("idSet") Set idSet); /** * 报告日期列表 diff --git a/adc-da-report/src/main/java/com/adc/da/report/dao/mysql/ReportLabelDao.java b/adc-da-report/src/main/java/com/adc/da/report/dao/mysql/ReportLabelDao.java new file mode 100644 index 0000000..59ffc96 --- /dev/null +++ b/adc-da-report/src/main/java/com/adc/da/report/dao/mysql/ReportLabelDao.java @@ -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 { + +} + + + + diff --git a/adc-da-report/src/main/java/com/adc/da/report/dao/mysql/TreeLabelDao.java b/adc-da-report/src/main/java/com/adc/da/report/dao/mysql/TreeLabelDao.java new file mode 100644 index 0000000..d4cdcfc --- /dev/null +++ b/adc-da-report/src/main/java/com/adc/da/report/dao/mysql/TreeLabelDao.java @@ -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 { + + /** + * 获取当前层级标签中最大的orderNum + * @param parentId + * @return + */ + double getMaxNum(String parentId); +} + + + + diff --git a/adc-da-report/src/main/java/com/adc/da/report/eo/LabelEntity.java b/adc-da-report/src/main/java/com/adc/da/report/eo/LabelEntity.java index ba067b7..2258463 100644 --- a/adc-da-report/src/main/java/com/adc/da/report/eo/LabelEntity.java +++ b/adc-da-report/src/main/java/com/adc/da/report/eo/LabelEntity.java @@ -48,6 +48,9 @@ public class LabelEntity { @TableField("createDate") private String createDate; + /** + * 排序顺序 + */ @TableField("orderNum") private int orderNum; diff --git a/adc-da-report/src/main/java/com/adc/da/report/eo/ReportEntity.java b/adc-da-report/src/main/java/com/adc/da/report/eo/ReportEntity.java index fbdae99..c73c660 100644 --- a/adc-da-report/src/main/java/com/adc/da/report/eo/ReportEntity.java +++ b/adc-da-report/src/main/java/com/adc/da/report/eo/ReportEntity.java @@ -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 diff --git a/adc-da-report/src/main/java/com/adc/da/report/eo/ReportLabelEntity.java b/adc-da-report/src/main/java/com/adc/da/report/eo/ReportLabelEntity.java new file mode 100644 index 0000000..30ebb29 --- /dev/null +++ b/adc-da-report/src/main/java/com/adc/da/report/eo/ReportLabelEntity.java @@ -0,0 +1,46 @@ +package com.adc.da.report.eo; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; + +/** + * @author Caihaohan + * @TableName ts_report_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; + +} \ No newline at end of file diff --git a/adc-da-report/src/main/java/com/adc/da/report/eo/TreeLabelEntity.java b/adc-da-report/src/main/java/com/adc/da/report/eo/TreeLabelEntity.java new file mode 100644 index 0000000..3c96c87 --- /dev/null +++ b/adc-da-report/src/main/java/com/adc/da/report/eo/TreeLabelEntity.java @@ -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; + +} \ No newline at end of file diff --git a/adc-da-report/src/main/java/com/adc/da/report/service/IReportLabelService.java b/adc-da-report/src/main/java/com/adc/da/report/service/IReportLabelService.java new file mode 100644 index 0000000..50b1347 --- /dev/null +++ b/adc-da-report/src/main/java/com/adc/da/report/service/IReportLabelService.java @@ -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 { + + /** + * 根据报表Id删除所有报表标签关系 + * @param reportIds 报表id + */ + void deleteReportLabelByReportId(String[] reportIds); +} diff --git a/adc-da-report/src/main/java/com/adc/da/report/service/IReportService.java b/adc-da-report/src/main/java/com/adc/da/report/service/IReportService.java index 2f0c296..83d2904 100644 --- a/adc-da-report/src/main/java/com/adc/da/report/service/IReportService.java +++ b/adc-da-report/src/main/java/com/adc/da/report/service/IReportService.java @@ -15,10 +15,12 @@ public interface IReportService { /** * 新增或编辑报告 + * * @param entity + * @param labelList * @return 报告名称 */ - String insert(ReportEntity entity); + String insert(ReportEntity entity, List labelList); /** * 报告列表展示 diff --git a/adc-da-report/src/main/java/com/adc/da/report/service/ITreeLabelService.java b/adc-da-report/src/main/java/com/adc/da/report/service/ITreeLabelService.java new file mode 100644 index 0000000..d56ec1f --- /dev/null +++ b/adc-da-report/src/main/java/com/adc/da/report/service/ITreeLabelService.java @@ -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 { + + /** + * 获取标签树形结构 + * + * @param like 模糊查询字段 + * @return + */ + List 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 getLabelList(String id); + + /** + * 获取当前标签的路径(不包括自己) + * + * @param id + * @return + */ + List getParentLabelList(String id); +} diff --git a/adc-da-report/src/main/java/com/adc/da/report/service/impl/IReportServiceImpl.java b/adc-da-report/src/main/java/com/adc/da/report/service/impl/IReportServiceImpl.java index 5ff4337..986122f 100644 --- a/adc-da-report/src/main/java/com/adc/da/report/service/impl/IReportServiceImpl.java +++ b/adc-da-report/src/main/java/com/adc/da/report/service/impl/IReportServiceImpl.java @@ -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 + 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 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 idSet = new HashSet<>(); + if (Objects.nonNull(vo.getLabelId()) && !vo.getLabelId().isEmpty()) { + LambdaQueryWrapper reportLabelEntityWrapper = new LambdaQueryWrapper<>(); + reportLabelEntityWrapper.eq(ReportLabelEntity::getLabelId, vo.getLabelId().get(vo.getLabelId().size() - 1)); + List reportLabelEntities = reportLabelDao.selectList(reportLabelEntityWrapper); + reportLabelEntities.forEach(reportLabelEntity -> { + idSet.add(reportLabelEntity.getReportId()); + }); + } + // TODO ES模糊查询 - IPage list = reportDao.list(page, vo); + IPage list = reportDao.list(page, vo, idSet); + + + //获取所有报告的labelId + list.getRecords().forEach((reportVo) -> { + reportVo.setLabelList(findLabelList(reportVo.getId())); + }); list.getRecords().forEach(c -> { FileEntity fileEntity = Optional.ofNullable(fileDao.selectById(c.getFileId())).orElse(new FileEntity()); if (StringUtils.isEmpty(fileEntity.getFileType())) { c.setFileType(null); } //ppt文件 - else if ("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 userIdList = reportUserDao.selectList( - new QueryWrapper().eq("reportId", c.getId())) + new QueryWrapper().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 findLabelList(String id) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(ReportLabelEntity::getReportId, id); + List reportLabelEntities = iReportLabelService.list(wrapper); + //找出所有路径 + List> labelList = new ArrayList<>(); + for (ReportLabelEntity entity : reportLabelEntities) { + labelList.add(iTreeLabelService.getLabelList(entity.getLabelId())); + } + //返回最长的那条路径 + labelList = labelList.stream() + .sorted(Comparator.comparingInt(List::size).reversed()) + .collect(Collectors.toList()); + return labelList.get(0); + } + /** * 报告删除 * @@ -219,6 +296,8 @@ public class IReportServiceImpl implements IReportService { public List delete(String ids) { List 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); } diff --git a/adc-da-report/src/main/java/com/adc/da/report/service/impl/ITreeLabelServiceImpl.java b/adc-da-report/src/main/java/com/adc/da/report/service/impl/ITreeLabelServiceImpl.java new file mode 100644 index 0000000..ae7473f --- /dev/null +++ b/adc-da-report/src/main/java/com/adc/da/report/service/impl/ITreeLabelServiceImpl.java @@ -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 + implements ITreeLabelService { + + @Resource + private TreeLabelDao treeLabelDao; + + @Resource + private ReportLabelDao reportLabelDao; + + + @Override + public List getTreeLabellist(String like) { + //查询所有标签 + List treeLabelEntities = list(); + //找出根节点 + TreeLabelEntity rootTag = treeLabelEntities.stream(). + filter(treeLabelEntity -> + TreeLabelConstants.ROOT_TAG_PARENT_ID.equals(treeLabelEntity.getParentId())) + .collect(Collectors.toList()).get(0); + + // 目标List对象 + List 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> groupedLabelVos = treeLabelVos.stream() + .collect(Collectors.groupingBy(TreeLabelVo::getParentId)); + //排序 + Map> sortedGroupedLabelVos = groupedLabelVos.entrySet().stream() + .map(entry -> { + List 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 labelVoList = sortedGroupedLabelVos.values().stream() + .flatMap(Collection::stream) + .collect(Collectors.toList()); + + //组装成树形结构 + List 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() + .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().eq("id", id)); + //如果删除的不是最后一个标签,需要移动前面的标签 + if (currentNum != maxNum) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.gt(TreeLabelEntity::getOrderNum, currentNum) + .le(TreeLabelEntity::getOrderNum, maxNum) + .eq(TreeLabelEntity::getParentId, parentId); + List 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 nodeAndChildrenIds = findNodeAndChildrenIds(getTreeLabelRoot(), id).stream().distinct().collect(Collectors.toList()); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.in(ReportLabelEntity::getLabelId, nodeAndChildrenIds); + reportLabelDao.delete(wrapper); + int i = treeLabelDao.deleteBatchIds(nodeAndChildrenIds); + return i != 0; + } + + @Override + public List getLabelList(String id) { + List 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 getParentLabelList(String id) { + List 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 createTree(String rootParentId, List treeLabelVos) { + List 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 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 findNodeAndChildrenIds(TreeLabelVo root, String nodeId) { + List 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 childResult = findNodeAndChildrenIds(child, nodeId); + if (!childResult.isEmpty()) { + result.addAll(childResult); + break; + } + } + } + return result; + } + + private static void collectChildrenIds(TreeLabelVo node, List result) { + result.add(node.getId()); + for (TreeLabelVo child : node.getChildren()) { + collectChildrenIds(child, result); + } + } + + private TreeLabelVo getTreeLabelRoot() { + return getTreeLabellist(null).get(0); + } +} + + + + diff --git a/adc-da-report/src/main/java/com/adc/da/report/service/impl/ReportLabelServiceImpl.java b/adc-da-report/src/main/java/com/adc/da/report/service/impl/ReportLabelServiceImpl.java new file mode 100644 index 0000000..3795cc3 --- /dev/null +++ b/adc-da-report/src/main/java/com/adc/da/report/service/impl/ReportLabelServiceImpl.java @@ -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 + implements IReportLabelService { + + @Resource + private ReportLabelDao reportLabelDao; + + @Override + public void deleteReportLabelByReportId(String[] reportId) { + LambdaQueryWrapper reportLabelWrapper = new LambdaQueryWrapper<>(); + for (String id : reportId) { + reportLabelWrapper.eq(ReportLabelEntity::getReportId, id); + } + reportLabelDao.delete(reportLabelWrapper); + } +} + + + + diff --git a/adc-da-report/src/main/java/com/adc/da/report/util/FileContentUtil.java b/adc-da-report/src/main/java/com/adc/da/report/util/FileContentUtil.java new file mode 100644 index 0000000..1ba8074 --- /dev/null +++ b/adc-da-report/src/main/java/com/adc/da/report/util/FileContentUtil.java @@ -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(); + } + } + +} diff --git a/adc-da-report/src/main/java/com/adc/da/report/vo/ReportQueryVo.java b/adc-da-report/src/main/java/com/adc/da/report/vo/ReportQueryVo.java index 6a185fb..c2dbda4 100644 --- a/adc-da-report/src/main/java/com/adc/da/report/vo/ReportQueryVo.java +++ b/adc-da-report/src/main/java/com/adc/da/report/vo/ReportQueryVo.java @@ -22,24 +22,19 @@ public class ReportQueryVo { private int pageSize; /** - * 搜索内容 + * 报告名称 + */ + private String name; + + /** + * 全文模糊检索的关键词 */ private String keyContent; /** - * 标签1 + * 标签集合 */ - private List labelOneId; - - /** - * 标签2 - */ - private List labelTwoId; - - /** - * 标签3 - */ - private List labelThreeId; + private List labelId; /** * 年 diff --git a/adc-da-report/src/main/java/com/adc/da/report/vo/ReportVo.java b/adc-da-report/src/main/java/com/adc/da/report/vo/ReportVo.java index 2634a30..66cfeb7 100644 --- a/adc-da-report/src/main/java/com/adc/da/report/vo/ReportVo.java +++ b/adc-da-report/src/main/java/com/adc/da/report/vo/ReportVo.java @@ -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 reportUserIdList; /** - * 标签1id + * 报告涉密等级 */ - private String labelOneId; + private String confidentialLevel; /** - * 标签2id + * 隐私等级 */ - private String labelTwoId; + private String privacyLevel; /** - * 标签3id + * 关联的标签id集合 */ - private String labelThreeId; + private List labelList; /** * 文件大小 diff --git a/adc-da-report/src/main/java/com/adc/da/report/vo/TreeLabelVo.java b/adc-da-report/src/main/java/com/adc/da/report/vo/TreeLabelVo.java new file mode 100644 index 0000000..f62f52d --- /dev/null +++ b/adc-da-report/src/main/java/com/adc/da/report/vo/TreeLabelVo.java @@ -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 children; + + public TreeLabelVo(String parentId) { + this.parentId = parentId; + this.children = new ArrayList<>(); + } +} diff --git a/adc-da-report/src/main/resources/mybatis/mapper/mysql/ReportManageMapper.xml b/adc-da-report/src/main/resources/mybatis/mapper/mysql/ReportManageMapper.xml index 4d24a20..20c9ba3 100644 --- a/adc-da-report/src/main/resources/mybatis/mapper/mysql/ReportManageMapper.xml +++ b/adc-da-report/src/main/resources/mybatis/mapper/mysql/ReportManageMapper.xml @@ -3,117 +3,155 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select max(t.order_num) + from ts_tree_label t + where t.parent_id = #{parentId} + + diff --git a/adc-da-report/target/classes/com/adc/da/report/controller/ReportManageConroller.class b/adc-da-report/target/classes/com/adc/da/report/controller/ReportManageConroller.class new file mode 100644 index 0000000..a36de78 Binary files /dev/null and b/adc-da-report/target/classes/com/adc/da/report/controller/ReportManageConroller.class differ diff --git a/adc-da-report/target/classes/com/adc/da/report/service/impl/IReportServiceImpl.class b/adc-da-report/target/classes/com/adc/da/report/service/impl/IReportServiceImpl.class new file mode 100644 index 0000000..3f65627 Binary files /dev/null and b/adc-da-report/target/classes/com/adc/da/report/service/impl/IReportServiceImpl.class differ diff --git a/adc-da-report/target/classes/com/adc/da/report/util/PdfUtil.class b/adc-da-report/target/classes/com/adc/da/report/util/PdfUtil.class new file mode 100644 index 0000000..fafc618 Binary files /dev/null and b/adc-da-report/target/classes/com/adc/da/report/util/PdfUtil.class differ diff --git a/adc-da-report/target/classes/com/adc/da/report/util/PptUtil.class b/adc-da-report/target/classes/com/adc/da/report/util/PptUtil.class new file mode 100644 index 0000000..595c61b Binary files /dev/null and b/adc-da-report/target/classes/com/adc/da/report/util/PptUtil.class differ diff --git a/adc-da-report/target/classes/mybatis/mapper/mysql/ReportManageMapper.xml b/adc-da-report/target/classes/mybatis/mapper/mysql/ReportManageMapper.xml new file mode 100644 index 0000000..00363a0 --- /dev/null +++ b/adc-da-report/target/classes/mybatis/mapper/mysql/ReportManageMapper.xml @@ -0,0 +1,165 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/adc-da-sys/src/main/java/com/adc/da/sys/service/iservice/IUserEoService.java b/adc-da-sys/src/main/java/com/adc/da/sys/service/iservice/IUserEoService.java index c881337..719f31a 100644 --- a/adc-da-sys/src/main/java/com/adc/da/sys/service/iservice/IUserEoService.java +++ b/adc-da-sys/src/main/java/com/adc/da/sys/service/iservice/IUserEoService.java @@ -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 getUserPage(DdmUserQueryVO query); + public void importExcelUser(List list); List> allList(String account, String roleName); + List getUserByMail(List mailList); + + List getUserByAccount(List mailList); } diff --git a/adc-da-sys/src/main/resources/mybatis/mapper/sys/mysql/UserEOMapper.xml b/adc-da-sys/src/main/resources/mybatis/mapper/sys/mysql/UserEOMapper.xml index 352b7d3..9ccfa7a 100644 --- a/adc-da-sys/src/main/resources/mybatis/mapper/sys/mysql/UserEOMapper.xml +++ b/adc-da-sys/src/main/resources/mybatis/mapper/sys/mysql/UserEOMapper.xml @@ -163,11 +163,6 @@ #{id} - - - - - - + diff --git a/adc-da-sys/target/classes/com/adc/da/sys/controller/UserEOController.class b/adc-da-sys/target/classes/com/adc/da/sys/controller/UserEOController.class new file mode 100644 index 0000000..f73f130 Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/controller/UserEOController.class differ diff --git a/adc-da-sys/target/classes/com/adc/da/sys/service/RoleEOService.class b/adc-da-sys/target/classes/com/adc/da/sys/service/RoleEOService.class new file mode 100644 index 0000000..b10b21c Binary files /dev/null and b/adc-da-sys/target/classes/com/adc/da/sys/service/RoleEOService.class differ diff --git a/adc-da-sys/target/classes/dozer/dozer-mappings-ddm.xml b/adc-da-sys/target/classes/dozer/dozer-mappings-ddm.xml new file mode 100644 index 0000000..02aee34 --- /dev/null +++ b/adc-da-sys/target/classes/dozer/dozer-mappings-ddm.xml @@ -0,0 +1,57 @@ + + + + + + + + + com.adc.da.sys.entity.RoleEO + com.adc.da.sys.vo.ddm.DdmRoleVO + + + + id + rid + + + name + roleName + + + name + roleCode + + + remarks + rdesc + + + delFlag + enabled + + + menuEOIdList + menusstr + + + menuEOList + menus + + + + + + com.adc.da.sys.entity.MenuEO + com.adc.da.sys.vo.MenuVO + + + + com.adc.da.log.entity.LogEO + com.adc.da.log.vo.LogVO + + +