Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -115,6 +115,9 @@ public class ShiroFilterConfiguration {
|
|||||||
/* 用户信息不用认证 */
|
/* 用户信息不用认证 */
|
||||||
filterChainDefinitionMap.put(restPath + "/userInfo", ANON);
|
filterChainDefinitionMap.put(restPath + "/userInfo", ANON);
|
||||||
|
|
||||||
|
/* 用户信息不用认证 */
|
||||||
|
filterChainDefinitionMap.put(restPath + "/report/refreshReportContent", ANON);
|
||||||
|
|
||||||
/* 在线用户列表不用验证 */
|
/* 在线用户列表不用验证 */
|
||||||
filterChainDefinitionMap.put(restPath + "/onlineUser", ANON);
|
filterChainDefinitionMap.put(restPath + "/onlineUser", ANON);
|
||||||
|
|
||||||
|
|||||||
@@ -36,9 +36,6 @@
|
|||||||
|
|
||||||
spring.datasource.driverClassName = com.mysql.cj.jdbc.Driver
|
spring.datasource.driverClassName = com.mysql.cj.jdbc.Driver
|
||||||
spring.datasource.url = jdbc:mysql://121.36.69.172:3307/report-library?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
|
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.url = jdbc:mysql://121.36.69\
|
|
||||||
# .172:3307/report-library_test?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false\
|
|
||||||
# &allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
|
|
||||||
spring.datasource.username = root
|
spring.datasource.username = root
|
||||||
spring.datasource.password = hzwlsoft.com
|
spring.datasource.password = hzwlsoft.com
|
||||||
|
|
||||||
@@ -67,7 +64,7 @@ swaggerLevel=0
|
|||||||
# \u672C\u5730\u5B58\u50A8\u6587\u4EF6\u7684\u78C1\u76D8\u5730\u5740
|
# \u672C\u5730\u5B58\u50A8\u6587\u4EF6\u7684\u78C1\u76D8\u5730\u5740
|
||||||
#uploadFile=D:\\work\\idea\\changan\\
|
#uploadFile=D:\\work\\idea\\changan\\
|
||||||
#uploadFile=D:\\uploadfile\\tmp\\
|
#uploadFile=D:\\uploadfile\\tmp\\
|
||||||
uploadFile=D:\\desktop\\dazhong\\uploadfile
|
uploadFile=/data/DeploymentPackage/report_library/uploadfile/
|
||||||
# \u672C\u5730\u6587\u4EF6\u8BBF\u95EE\u7684url\u5730\u5740
|
# \u672C\u5730\u6587\u4EF6\u8BBF\u95EE\u7684url\u5730\u5740
|
||||||
picPath=/api/home/pic/
|
picPath=/api/home/pic/
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,164 @@
|
|||||||
|
package com.adc.da;
|
||||||
|
|
||||||
|
import java.math.BigInteger;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
import java.sql.*;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import org.apache.poi.xwpf.usermodel.*;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTblWidth;
|
||||||
|
import org.openxmlformats.schemas.wordprocessingml.x2006.main.STTblWidth;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
|
||||||
|
@RunWith(SpringRunner.class)
|
||||||
|
@SpringBootTest
|
||||||
|
public class DataDictionaryGenerator {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成数据字典Word
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void generate() throws Exception {
|
||||||
|
// Connect to the database
|
||||||
|
String url = "jdbc:mysql://localhost:3306/report_library?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai";
|
||||||
|
String username = "root";
|
||||||
|
String password = "rootroot";
|
||||||
|
Connection connection = DriverManager.getConnection(url, username, password);
|
||||||
|
|
||||||
|
// Get metadata
|
||||||
|
DatabaseMetaData metaData = connection.getMetaData();
|
||||||
|
// Specify the database name
|
||||||
|
String databaseName = "report_library"; // Replace "report_library" with the actual database name
|
||||||
|
|
||||||
|
// Get tables in the specified database
|
||||||
|
ResultSet tables = metaData.getTables(databaseName, null, "%", null);
|
||||||
|
|
||||||
|
// Create a new Word document
|
||||||
|
XWPFDocument document = new XWPFDocument();
|
||||||
|
|
||||||
|
int tableCounter = 1;
|
||||||
|
|
||||||
|
// Iterate over the tables
|
||||||
|
while (tables.next()) {
|
||||||
|
String tableName = tables.getString(3);
|
||||||
|
|
||||||
|
// Add the table name to the document
|
||||||
|
XWPFParagraph tableNameParagraph = document.createParagraph();
|
||||||
|
XWPFRun run = tableNameParagraph.createRun();
|
||||||
|
|
||||||
|
// Set table name as "Table 1: 表名"
|
||||||
|
String tableNumber = tableCounter + ": ";
|
||||||
|
String tableNameText = tableNumber + tableName;
|
||||||
|
run.setText(tableNameText);
|
||||||
|
run.setBold(true);
|
||||||
|
|
||||||
|
// Set font size
|
||||||
|
run.setFontSize(12); // 12 points for font size (equivalent to three号字号)
|
||||||
|
|
||||||
|
// Increment table counter
|
||||||
|
tableCounter++;
|
||||||
|
|
||||||
|
// Create table
|
||||||
|
XWPFTable table = document.createTable();
|
||||||
|
CTTblWidth tableWidth = table.getCTTbl().addNewTblPr().addNewTblW();
|
||||||
|
tableWidth.setType(STTblWidth.PCT);
|
||||||
|
tableWidth.setW(BigInteger.valueOf(5000)); // Set the table width (10000 = 100%)
|
||||||
|
|
||||||
|
// create header row
|
||||||
|
XWPFTableRow headerRow = table.getRow(0);
|
||||||
|
headerRow.getCell(0).setText("列名");
|
||||||
|
headerRow.addNewTableCell().setText("中文含义");
|
||||||
|
headerRow.addNewTableCell().setText("数据类型");
|
||||||
|
headerRow.addNewTableCell().setText("主键");
|
||||||
|
headerRow.addNewTableCell().setText("外键");
|
||||||
|
headerRow.addNewTableCell().setText("不为空");
|
||||||
|
headerRow.addNewTableCell().setText("备注");
|
||||||
|
|
||||||
|
// Get columns
|
||||||
|
ResultSet columns = metaData.getColumns(null, null, tableName, "%");
|
||||||
|
|
||||||
|
// get primary keys
|
||||||
|
ResultSet primaryKeys = metaData.getPrimaryKeys(null, null, tableName);
|
||||||
|
Set<String> primaryKeySet = new HashSet<>();
|
||||||
|
while (primaryKeys.next()) {
|
||||||
|
primaryKeySet.add(primaryKeys.getString("COLUMN_NAME"));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pattern for matching remarks
|
||||||
|
Pattern pattern = Pattern.compile("([^((]+)[((]([^))]+)[))]");
|
||||||
|
|
||||||
|
// Iterate over the columns
|
||||||
|
while (columns.next()) {
|
||||||
|
String columnName = columns.getString(4);
|
||||||
|
int columnSize = columns.getInt("COLUMN_SIZE");
|
||||||
|
String columnType = columns.getString(6) + "(" + columnSize + ")";
|
||||||
|
String isNullable = columns.getString(18);
|
||||||
|
boolean isNotNull = isNullable.equals("NO");
|
||||||
|
|
||||||
|
// Check if column is primary key
|
||||||
|
String isPrimaryKey = primaryKeySet.contains(columnName) ? "是" : "否";
|
||||||
|
|
||||||
|
String isForeignKey = "否";
|
||||||
|
|
||||||
|
// Extracting Chinese meaning and remarks from the remarks column
|
||||||
|
String fullRemarks = columns.getString("REMARKS");
|
||||||
|
Matcher matcher = pattern.matcher(fullRemarks);
|
||||||
|
|
||||||
|
String chineseMeaning = "";
|
||||||
|
String remarks = "";
|
||||||
|
if (matcher.find()) {
|
||||||
|
chineseMeaning = matcher.group(1);
|
||||||
|
remarks = matcher.group(2);
|
||||||
|
} else {
|
||||||
|
chineseMeaning = fullRemarks;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add the column details to the table
|
||||||
|
XWPFTableRow row = table.createRow();
|
||||||
|
XWPFRun cellRun = row.getCell(0).getParagraphs().get(0).createRun();
|
||||||
|
cellRun.setFontSize(10);
|
||||||
|
cellRun.setText(columnName);
|
||||||
|
|
||||||
|
cellRun = row.getCell(1).getParagraphs().get(0).createRun();
|
||||||
|
cellRun.setFontSize(10);
|
||||||
|
cellRun.setText(chineseMeaning);
|
||||||
|
|
||||||
|
cellRun = row.getCell(2).getParagraphs().get(0).createRun();
|
||||||
|
cellRun.setFontSize(10);
|
||||||
|
cellRun.setText(columnType);
|
||||||
|
|
||||||
|
cellRun = row.getCell(3).getParagraphs().get(0).createRun();
|
||||||
|
cellRun.setFontSize(10);
|
||||||
|
cellRun.setText(isPrimaryKey);
|
||||||
|
|
||||||
|
cellRun = row.getCell(4).getParagraphs().get(0).createRun();
|
||||||
|
cellRun.setFontSize(10);
|
||||||
|
cellRun.setText(isForeignKey);
|
||||||
|
|
||||||
|
cellRun = row.getCell(5).getParagraphs().get(0).createRun();
|
||||||
|
cellRun.setFontSize(10);
|
||||||
|
cellRun.setText(isNotNull ? "是" : "否");
|
||||||
|
|
||||||
|
cellRun = row.getCell(6).getParagraphs().get(0).createRun();
|
||||||
|
cellRun.setFontSize(10);
|
||||||
|
cellRun.setText(remarks);
|
||||||
|
}
|
||||||
|
// Create an empty paragraph
|
||||||
|
XWPFParagraph emptyParagraph = document.createParagraph();
|
||||||
|
emptyParagraph.setSpacingAfter(200); // Set the spacing after the paragraph (adjust the value as needed)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save the document
|
||||||
|
document.write(Files.newOutputStream(Paths.get("DataDictionary.docx")));
|
||||||
|
|
||||||
|
// Close the document
|
||||||
|
document.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
package com.adc.da.report;
|
||||||
|
|
||||||
|
import com.adc.da.report.constant.MessageTypeEnum;
|
||||||
|
import com.adc.da.report.eo.MessageEntity;
|
||||||
|
import com.adc.da.report.service.IMessageService;
|
||||||
|
import com.adc.da.util.utils.UUID;
|
||||||
|
import io.github.swagger2markup.GroupBy;
|
||||||
|
import io.github.swagger2markup.Language;
|
||||||
|
import io.github.swagger2markup.Swagger2MarkupConfig;
|
||||||
|
import io.github.swagger2markup.Swagger2MarkupConverter;
|
||||||
|
import io.github.swagger2markup.builder.Swagger2MarkupConfigBuilder;
|
||||||
|
import io.github.swagger2markup.markup.builder.MarkupLanguage;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RunWith(SpringRunner.class)
|
||||||
|
@SpringBootTest
|
||||||
|
public class TestMessage {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IMessageService messageService;
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testMessagePublish() {
|
||||||
|
for (int i = 0; i < 20; i++) {
|
||||||
|
MessageEntity messageEntity = new MessageEntity();
|
||||||
|
messageEntity.setMessageTitle("测试发送标题" + java.util.UUID.randomUUID())
|
||||||
|
.setMessageType(MessageTypeEnum.SYSTEM_MESSAGE.getValue())
|
||||||
|
.setId(UUID.randomUUID10())
|
||||||
|
.setContent("测试测试站内信内容" + java.util.UUID.randomUUID())
|
||||||
|
.setDelFlag(0)
|
||||||
|
.setCreateUser("ZGGJP3N7FT")
|
||||||
|
.setCreateDate(new Date());
|
||||||
|
List<String> userIds = new ArrayList<>();
|
||||||
|
userIds.add("ZGGJP3N7FT");
|
||||||
|
messageService.publishMessage(messageEntity, false, userIds);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -29,9 +29,9 @@ public class secrecyDDLTimer {
|
|||||||
@Autowired
|
@Autowired
|
||||||
IReportServiceImpl iReportService;
|
IReportServiceImpl iReportService;
|
||||||
|
|
||||||
// @Scheduled(cron="0 0 0 * * *")
|
|
||||||
// @Scheduled(cron="0 0/1 * * * ?")
|
// @Scheduled(cron="0 0/1 * * * ?")
|
||||||
@Scheduled(cron="0 0/10 * * * ?")
|
// @Scheduled(cron="0 0/10 * * * ?")
|
||||||
|
@Scheduled(cron="0 1 0 * * *") //每晚1点执行
|
||||||
public void timingOpen() {
|
public void timingOpen() {
|
||||||
log.info("**********************保密到期定时任务开始**********************");
|
log.info("**********************保密到期定时任务开始**********************");
|
||||||
List<ReportEntity> entity = reportDao.selectDDL();
|
List<ReportEntity> entity = reportDao.selectDDL();
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package com.adc.da.report.constant;
|
||||||
|
|
||||||
|
import io.swagger.models.auth.In;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author: CaiHaohan
|
||||||
|
* @Date: 2023/5/23 15:17
|
||||||
|
* @Description:
|
||||||
|
*/
|
||||||
|
public class MessageConstants {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 消息状态 未读
|
||||||
|
*/
|
||||||
|
public static final Integer UNREAD = 0;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 消息状态 已读
|
||||||
|
*/
|
||||||
|
public static final Integer READ = 1;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package com.adc.da.report.constant;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.EnumValue;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonValue;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author: CaiHaohan
|
||||||
|
* @Date: 2023/5/24 10:44
|
||||||
|
* @Description:
|
||||||
|
*/
|
||||||
|
public enum MessageTypeEnum {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系统消息
|
||||||
|
*/
|
||||||
|
SYSTEM_MESSAGE(0, "系统消息");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 对应值
|
||||||
|
*/
|
||||||
|
private Integer code;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 描述
|
||||||
|
*/
|
||||||
|
private String desc;
|
||||||
|
|
||||||
|
MessageTypeEnum(Integer code, String desc) {
|
||||||
|
this.code = code;
|
||||||
|
this.desc = desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getValue() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDesc() {
|
||||||
|
return desc;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -23,6 +23,15 @@ public class ReportConstants {
|
|||||||
*/
|
*/
|
||||||
public static final String NO_USER_PRIVACY_INVOLVED = "不涉及用户隐私";
|
public static final String NO_USER_PRIVACY_INVOLVED = "不涉及用户隐私";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 流程中
|
||||||
|
*/
|
||||||
|
public static final Integer IN_PROCESS = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 不在流程中
|
||||||
|
*/
|
||||||
|
public static final Integer NOT_IN_PROCESS = 2;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,59 @@
|
|||||||
|
package com.adc.da.report.controller;
|
||||||
|
|
||||||
|
import com.adc.da.report.service.IMessageService;
|
||||||
|
import com.adc.da.report.vo.MessageQueryVo;
|
||||||
|
import com.adc.da.report.vo.MessageVo;
|
||||||
|
import com.adc.da.util.http.ResponseMessage;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.validation.Valid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author caihaohan
|
||||||
|
* @Date 2021/11/9 13:46
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Api(tags = "站内信")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/${restPath}/message")
|
||||||
|
public class MessageController {
|
||||||
|
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IMessageService messageEntityService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 站内信消息列表
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@ApiOperation("站内信消息列表")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public ResponseMessage list(@Valid MessageQueryVo messageQueryVo) {
|
||||||
|
return messageEntityService.listByCurrentUser(messageQueryVo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 全部已读
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@ApiOperation("全部已读接口")
|
||||||
|
@GetMapping("/allRead")
|
||||||
|
public ResponseMessage allRead() {
|
||||||
|
return messageEntityService.allRead();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 已读
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@ApiOperation("单条已读")
|
||||||
|
@GetMapping("/read/{id}")
|
||||||
|
public ResponseMessage readMessage(@PathVariable String id) {
|
||||||
|
return messageEntityService.readMessage(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+17
-1
@@ -133,7 +133,7 @@ public class ReportLogBookController {
|
|||||||
* @return com.adc.da.util.http.ResponseMessage
|
* @return com.adc.da.util.http.ResponseMessage
|
||||||
* @author bu
|
* @author bu
|
||||||
* @date 2023-05-08
|
* @date 2023-05-08
|
||||||
* @description 根据报告id和当前登录用户id获取点赞数
|
* @description 根据报告id和当前登录用户id点赞或取消点赞
|
||||||
*/
|
*/
|
||||||
@GetMapping("/thumbUpOrDown")
|
@GetMapping("/thumbUpOrDown")
|
||||||
@ApiOperation(value = "点赞或者取消点赞")
|
@ApiOperation(value = "点赞或者取消点赞")
|
||||||
@@ -144,4 +144,20 @@ public class ReportLogBookController {
|
|||||||
return Result.success(result);
|
return Result.success(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param reportId
|
||||||
|
* @return com.adc.da.util.http.ResponseMessage
|
||||||
|
* @author bu
|
||||||
|
* @date 2023-05-08
|
||||||
|
* @description 根据报告id和当前登录用户id点赞或取消点赞
|
||||||
|
*/
|
||||||
|
@GetMapping("/collectOrCancelCollect")
|
||||||
|
@ApiOperation(value = "收藏或取消收藏")
|
||||||
|
public ResponseMessage collectOrCancelCollect(String reportId){
|
||||||
|
|
||||||
|
//根据报告id和当前登录用户id获取点赞数
|
||||||
|
return reportLogBookService.collectOrCancelCollect(reportId);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+384
-157
@@ -3,12 +3,10 @@ package com.adc.da.report.controller;
|
|||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.adc.da.login.util.UserUtils;
|
import com.adc.da.login.util.UserUtils;
|
||||||
import com.adc.da.report.annotation.ReportLog;
|
import com.adc.da.report.annotation.ReportLog;
|
||||||
|
import com.adc.da.report.constant.ReportConstants;
|
||||||
import com.adc.da.report.dao.mysql.ReportDao;
|
import com.adc.da.report.dao.mysql.ReportDao;
|
||||||
import com.adc.da.report.dao.mysql.ReportLogBookDao;
|
import com.adc.da.report.dao.mysql.ReportLogBookDao;
|
||||||
import com.adc.da.report.eo.FileEntity;
|
import com.adc.da.report.eo.*;
|
||||||
import com.adc.da.report.eo.LogEntity;
|
|
||||||
import com.adc.da.report.eo.ReportEntity;
|
|
||||||
import com.adc.da.report.eo.ReportLogBook;
|
|
||||||
import com.adc.da.report.service.IFileService;
|
import com.adc.da.report.service.IFileService;
|
||||||
import com.adc.da.report.service.ILogService;
|
import com.adc.da.report.service.ILogService;
|
||||||
import com.adc.da.report.service.IReportService;
|
import com.adc.da.report.service.IReportService;
|
||||||
@@ -16,17 +14,21 @@ import com.adc.da.report.util.LocalFileUtil;
|
|||||||
import com.adc.da.report.util.OSSClientUtil;
|
import com.adc.da.report.util.OSSClientUtil;
|
||||||
import com.adc.da.report.util.ObsBootUtil;
|
import com.adc.da.report.util.ObsBootUtil;
|
||||||
import com.adc.da.report.util.WaterMarkUtil;
|
import com.adc.da.report.util.WaterMarkUtil;
|
||||||
|
import com.adc.da.report.vo.ChangeUploaderVo;
|
||||||
|
import com.adc.da.report.vo.ReportFilePageVO;
|
||||||
import com.adc.da.report.vo.ReportQueryVo;
|
import com.adc.da.report.vo.ReportQueryVo;
|
||||||
import com.adc.da.report.vo.ReportVo;
|
import com.adc.da.report.vo.ReportVo;
|
||||||
import com.adc.da.util.exception.AdcDaBaseException;
|
import com.adc.da.util.exception.AdcDaBaseException;
|
||||||
import com.adc.da.util.http.ResponseMessage;
|
import com.adc.da.util.http.ResponseMessage;
|
||||||
import com.adc.da.util.http.Result;
|
import com.adc.da.util.http.Result;
|
||||||
|
import com.adc.da.util.utils.CollectionUtils;
|
||||||
import com.adc.da.util.utils.FileUtil;
|
import com.adc.da.util.utils.FileUtil;
|
||||||
import com.adc.da.util.utils.StringUtils;
|
import com.adc.da.util.utils.StringUtils;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import io.swagger.annotations.ApiParam;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -38,12 +40,14 @@ import org.springframework.web.multipart.MultipartFile;
|
|||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import javax.validation.Valid;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.net.URISyntaxException;
|
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.zip.ZipEntry;
|
||||||
|
import java.util.zip.ZipOutputStream;
|
||||||
|
|
||||||
import static com.adc.da.report.constant.ReportConstants.FILE_EXTENSIONS_PDF;
|
import static com.adc.da.report.constant.ReportConstants.FILE_EXTENSIONS_PDF;
|
||||||
|
|
||||||
@@ -186,6 +190,30 @@ public class ReportManageConroller {
|
|||||||
return Result.success(list);
|
return Result.success(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改上传人
|
||||||
|
* @param changeUploaderVo
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
@ApiOperation("修改上传人")
|
||||||
|
@PostMapping("/changeUploader")
|
||||||
|
public ResponseMessage changeUploader(@Valid @RequestBody ChangeUploaderVo changeUploaderVo) {
|
||||||
|
return reportService.changeUploader(changeUploaderVo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报告管理列表
|
||||||
|
* @param vo
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
@ApiOperation("报告管理列表")
|
||||||
|
@PostMapping("/myCollectPage")
|
||||||
|
public ResponseMessage myCollectPage(@RequestBody ReportQueryVo vo) throws Exception {
|
||||||
|
IPage<ReportVo> list = reportService.myCollectPage(vo);
|
||||||
|
return Result.success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -231,19 +259,27 @@ public class ReportManageConroller {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取报告预览
|
* 获取报告预览
|
||||||
* @param id
|
* @param reportId
|
||||||
|
* @param fileId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ApiOperation("获取报告预览")
|
@ApiOperation("获取报告预览")
|
||||||
@GetMapping("/getReportHtml/{id}")
|
@GetMapping("/getReportHtml")
|
||||||
public ResponseMessage getReportHtml(@PathVariable("id") String id) {
|
public ResponseMessage getReportHtml(@RequestParam String reportId, @RequestParam String fileId) {
|
||||||
String html = reportService.reportHtml(id);
|
//判断要预览的是不是excel文件
|
||||||
|
FileEntity file = fileService.getFile(fileId);
|
||||||
|
String fileType = file.getFileType();
|
||||||
|
if (ReportConstants.FILE_EXTENSIONS_XLS.equalsIgnoreCase(fileType) || ReportConstants.FILE_EXTENSIONS_XLSX.equalsIgnoreCase(fileType)) {
|
||||||
|
return Result.error("无法预览excel文件");
|
||||||
|
}
|
||||||
|
|
||||||
|
String html = reportService.reportHtml(reportId, fileId);
|
||||||
Map<String, Object> map = new HashMap<>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
map.put("content", html);
|
map.put("content", html);
|
||||||
|
|
||||||
ReportLogBook reportLog = new ReportLogBook();
|
ReportLogBook reportLog = new ReportLogBook();
|
||||||
reportLog.setId(UUID.randomUUID().toString().replaceAll("-",""));
|
reportLog.setId(UUID.randomUUID().toString().replaceAll("-",""));
|
||||||
reportLog.setReportId(id);
|
reportLog.setReportId(reportId);
|
||||||
reportLog.setType(1);
|
reportLog.setType(1);
|
||||||
reportLog.setUpdateTime(new Date());
|
reportLog.setUpdateTime(new Date());
|
||||||
reportLog.setUserId(UserUtils.getUserId());
|
reportLog.setUserId(UserUtils.getUserId());
|
||||||
@@ -284,31 +320,6 @@ public class ReportManageConroller {
|
|||||||
return Result.success();
|
return Result.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO 测试完不需要的代码请删掉,然后再把这个TODO也删掉
|
|
||||||
/**
|
|
||||||
* 测试
|
|
||||||
*/
|
|
||||||
@ApiOperation("testtest")
|
|
||||||
@GetMapping("/test")
|
|
||||||
@Deprecated
|
|
||||||
public void ttt() {
|
|
||||||
stringRedisTemplate.boundValueOps("1121212").set("1212");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO 测试完不需要的代码请删掉,然后再把这个TODO也删掉
|
|
||||||
@ApiOperation("testPath")
|
|
||||||
@GetMapping("/testPath")
|
|
||||||
@Deprecated
|
|
||||||
public ResponseMessage testPath() throws URISyntaxException {
|
|
||||||
HashMap<String, String> pathMap = new HashMap<>();
|
|
||||||
String jarPath = new File(getClass().getProtectionDomain().getCodeSource().getLocation().toURI().getPath()).getParentFile().getPath();
|
|
||||||
String property = System.getProperty("user.dir");
|
|
||||||
pathMap.put("jarpath", jarPath);
|
|
||||||
pathMap.put("propertyPath", property);
|
|
||||||
return Result.success(pathMap);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取文件名
|
* 获取文件名
|
||||||
* @param fileId
|
* @param fileId
|
||||||
@@ -330,57 +341,24 @@ public class ReportManageConroller {
|
|||||||
@ApiOperation(value = "详情||上传文件")
|
@ApiOperation(value = "详情||上传文件")
|
||||||
@PostMapping("/uploadFile")
|
@PostMapping("/uploadFile")
|
||||||
public ResponseMessage<Map<String, Object>> uploadFile(MultipartFile file) throws IOException {
|
public ResponseMessage<Map<String, Object>> uploadFile(MultipartFile file) throws IOException {
|
||||||
Map<String, Object> resultMap = new HashMap();
|
Map<String, Object> resultMap = fileService.uploadFile(file);
|
||||||
//上传路径
|
|
||||||
//此路径映射到localhost
|
|
||||||
String path = uploadFile;
|
|
||||||
String realName = file.getOriginalFilename();
|
|
||||||
Date now = new Date();
|
|
||||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
|
|
||||||
String date = dateFormat.format(now);
|
|
||||||
Random r = new Random();
|
|
||||||
String num = "";
|
|
||||||
for (int i = 0; i < 3; i++) {
|
|
||||||
int s = r.nextInt(10);
|
|
||||||
num += String.valueOf(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
//获取上传文件名
|
|
||||||
String fileName = file.getOriginalFilename();
|
|
||||||
String contentType = file.getContentType();
|
|
||||||
String ext = fileName.substring(fileName.lastIndexOf(".") + 1);
|
|
||||||
fileName = fileName.substring(0, fileName.lastIndexOf("."))+date + num + "." + ext;
|
|
||||||
log.info("fileName>>" + fileName);
|
|
||||||
try{
|
|
||||||
String result="";
|
|
||||||
// 上传方式:阿里云:alioss 华为云:hwobs
|
|
||||||
if ("hwobs".equals(uploadType)){
|
|
||||||
result = obsBootUtil.upload(file, fileName);
|
|
||||||
}else if ("alioss".equals(uploadType)) {
|
|
||||||
result = ossClientUtil.uploadFile2OSS(file.getInputStream(),fileName);
|
|
||||||
}else if ("local".equals(uploadType)) {
|
|
||||||
localFileUtil.saveFile(file.getInputStream(), fileName);
|
|
||||||
}
|
|
||||||
resultMap.put("key", date + num);
|
|
||||||
resultMap.put("value", path + "//" + fileName);
|
|
||||||
resultMap.put("name", realName);
|
|
||||||
}
|
|
||||||
catch (Exception e){
|
|
||||||
log.error(e.getMessage(),e);
|
|
||||||
}
|
|
||||||
FileEntity entity = new FileEntity();
|
|
||||||
entity.setContentType(contentType);
|
|
||||||
entity.setCreateTime(new Date());
|
|
||||||
entity.setFileName(realName);
|
|
||||||
entity.setFileType(ext);
|
|
||||||
entity.setFileSize(String.valueOf(file.getSize()));
|
|
||||||
entity.setFileId(date + num);
|
|
||||||
entity.setSavePath(fileName);
|
|
||||||
fileService.addFile(entity);
|
|
||||||
return Result.success(resultMap);
|
return Result.success(resultMap);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量上传文件
|
||||||
|
* @param files
|
||||||
|
* @return
|
||||||
|
* @throws IOException
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "批量上传文件")
|
||||||
|
@PostMapping("/batchUploadFile")
|
||||||
|
public ResponseMessage<List<Map<String, Object>>> batchUploadFile(@RequestParam("files") @ApiParam(value="上传文件",required=true) MultipartFile[] files) throws IOException {
|
||||||
|
List<Map<String, Object>> uploadFile = fileService.batchUploadFile(files);
|
||||||
|
return Result.success(uploadFile);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 上传图片
|
* 上传图片
|
||||||
* @param file
|
* @param file
|
||||||
@@ -452,105 +430,319 @@ public class ReportManageConroller {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// /**
|
|
||||||
// * 下载文件
|
|
||||||
// * @param response
|
|
||||||
// * @param fileId
|
|
||||||
// * @throws IOException
|
|
||||||
// */
|
|
||||||
// @ApiOperation(value = "|下载文件")
|
|
||||||
// @GetMapping("/download")
|
|
||||||
// public void downloadPic(HttpServletResponse response, String fileId) throws IOException {
|
|
||||||
//
|
|
||||||
// try {
|
|
||||||
// FileEntity entity = fileService.getFile(fileId);
|
|
||||||
// String fileName = entity.getFileName();
|
|
||||||
// String filename = URLEncoder.encode(fileName, "UTF-8");
|
|
||||||
// response.setHeader("Content-Disposition", "attachment;filename=" + filename);
|
|
||||||
// response.setContentType("application/x-download");
|
|
||||||
//// File file = new File(uploadFile, entity.getSavePath());
|
|
||||||
// // 上传方式:阿里云:alioss 华为云:hwobs
|
|
||||||
// if ("hwobs".equals(uploadType)){
|
|
||||||
// obsBootUtil.downFile(entity.getSavePath(), response);
|
|
||||||
// }else if ("alioss".equals(uploadType)){
|
|
||||||
// ossClientUtil.downloadFileFromOSS(entity.getSavePath(),response);
|
|
||||||
// }else if ("local".equals(uploadType)){
|
|
||||||
// localFileUtil.downFile(entity.getSavePath(), response);
|
|
||||||
// }
|
|
||||||
// if (FILE_EXTENSIONS_PDF.equalsIgnoreCase(FileUtil.getFileExtension(fileName))) {
|
|
||||||
// String text = "text";
|
|
||||||
// PdfUtil.addWatermarkToPdf(response, text);
|
|
||||||
// }
|
|
||||||
// } catch (Exception ex) {
|
|
||||||
// log.info(ex.getMessage(),ex);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 下载文件
|
* 下载文件(禁止下载Excel)
|
||||||
* @param response
|
* @param response
|
||||||
* @param fileId
|
* @param fileIds
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
@ApiOperation(value = "|下载文件")
|
@ApiOperation(value = "下载文件(禁止下载Excel)")
|
||||||
@GetMapping("/download")
|
@GetMapping("/download")
|
||||||
public void downloadPic(HttpServletResponse response, String fileId,String repostId) throws IOException {
|
public void download(HttpServletResponse response, String[] fileIds, String reportId) throws IOException {
|
||||||
|
List<String> fileIdList = new ArrayList<>();
|
||||||
|
if (CollectionUtils.isNotEmpty(fileIds)) {
|
||||||
|
fileIdList = Arrays.asList(fileIds);
|
||||||
|
}
|
||||||
|
|
||||||
if (StrUtil.isNotBlank(repostId)) {
|
if (StrUtil.isBlank(reportId)) {
|
||||||
|
throw new AdcDaBaseException("缺少报告id");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (StrUtil.isNotBlank(reportId)) {
|
||||||
//校验权限
|
//校验权限
|
||||||
if (!reportService.isAllowDownload(UserUtils.getUserId(), repostId)) {
|
if (!reportService.isAllowDownload(UserUtils.getUserId(), reportId)) {
|
||||||
throw new AdcDaBaseException("无此报告下载权限");
|
throw new AdcDaBaseException("无此报告下载权限");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
//待下载的文件id List
|
||||||
FileEntity entity = fileService.getFile(fileId);
|
List<String> downLoadFileIds;
|
||||||
String fileName = entity.getFileName();
|
String reportName = reportDao.selectById(reportId).getName();
|
||||||
String filename = URLEncoder.encode(fileName, "UTF-8");
|
String folderName = reportName + ".zip";
|
||||||
response.setHeader("Content-Disposition", "attachment;filename=" + filename);
|
// 获取编码后的文件名
|
||||||
response.setContentType("application/x-download");
|
String encodedZipName = URLEncoder.encode(folderName, "UTF-8");
|
||||||
|
|
||||||
//PDF文件需要加水印
|
//判断是从列表页面下载 还是预览页面下载
|
||||||
if (FILE_EXTENSIONS_PDF.equalsIgnoreCase(FileUtil.getFileExtension(fileName))) {
|
if (CollectionUtils.isEmpty(fileIdList)) {
|
||||||
String path = uploadFile + entity.getSavePath();
|
//列表点击下载按钮
|
||||||
FileOutputStream outputStream = new FileOutputStream(path);
|
downLoadFileIds = fileService.getDownloadFileIdsWithoutExcel(reportId);
|
||||||
// 上传方式:阿里云:alioss 华为云:hwobs
|
if (CollectionUtils.isEmpty(downLoadFileIds)) {
|
||||||
if ("hwobs".equals(uploadType)) {
|
log.info("无法下载,原因可能是无可下载文件(xls/xlsx文件无法下载)");
|
||||||
obsBootUtil.getFileFromOBS(entity.getSavePath(), outputStream);
|
try {
|
||||||
} else if ("alioss".equals(uploadType)) {
|
// 设置响应头信息
|
||||||
ossClientUtil.getFileFromOSS(entity.getSavePath(), outputStream);
|
response.setContentType("application/zip");
|
||||||
} else if ("local".equals(uploadType)) {
|
response.setHeader("Content-Disposition", "attachment; filename=" + encodedZipName);
|
||||||
localFileUtil.getFileFromLocal(entity.getSavePath(), outputStream);
|
response.setHeader("Content-Transfer-Encoding", "binary");
|
||||||
}
|
response.setHeader("Pragma", "public");
|
||||||
//给文件添加水印
|
response.setHeader("Cache-Control", "no-store");
|
||||||
waterMarkUtil.addWatermarkToPdf(new FileInputStream(path), response);
|
response.setHeader("Expires", "0");
|
||||||
|
|
||||||
} else {
|
// 创建空的ZipOutputStream
|
||||||
// 上传方式:阿里云:alioss 华为云:hwobs 本地:local
|
ZipOutputStream zipOutputStream = new ZipOutputStream(response.getOutputStream());
|
||||||
if ("hwobs".equals(uploadType)){
|
// 添加空文件夹条目
|
||||||
obsBootUtil.downFile(entity.getSavePath(), response);
|
ZipEntry emptyDirectoryEntry = new ZipEntry(reportName + "/");
|
||||||
}else if ("alioss".equals(uploadType)){
|
zipOutputStream.putNextEntry(emptyDirectoryEntry);
|
||||||
ossClientUtil.downloadFileFromOSS(entity.getSavePath(),response);
|
zipOutputStream.close();
|
||||||
}else if ("local".equals(uploadType)){
|
return;
|
||||||
localFileUtil.downFile(entity.getSavePath(), response);
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
} catch (Exception ex) {
|
//检测是否要下载Excel文件
|
||||||
log.info(ex.getMessage(),ex);
|
if (fileService.hasExcelFileId(fileIdList)) {
|
||||||
|
throw new AdcDaBaseException("不可以下载Excel文件");
|
||||||
|
}
|
||||||
|
//预览点击下载按钮
|
||||||
|
downLoadFileIds = fileIdList;
|
||||||
}
|
}
|
||||||
if (StringUtils.isNotEmpty(repostId)){
|
|
||||||
|
//如果只下载一个文件,则不压缩
|
||||||
|
if (downLoadFileIds.size() == 1) {
|
||||||
|
String fileId = downLoadFileIds.get(0);
|
||||||
|
try {
|
||||||
|
FileEntity entity = fileService.getFile(fileId);
|
||||||
|
String fileName = entity.getFileName();
|
||||||
|
// 获取编码后的文件名
|
||||||
|
String encodedFileName = URLEncoder.encode(fileName, "UTF-8");
|
||||||
|
response.setHeader("Content-Disposition", "attachment;filename=" + encodedFileName);
|
||||||
|
|
||||||
|
//PDF文件需要加水印
|
||||||
|
if (FILE_EXTENSIONS_PDF.equalsIgnoreCase(FileUtil.getFileExtension(fileName))) {
|
||||||
|
String path = uploadFile + entity.getSavePath();
|
||||||
|
FileOutputStream outputStream = new FileOutputStream(path);
|
||||||
|
// 上传方式:阿里云:alioss 华为云:hwobs
|
||||||
|
if ("hwobs".equals(uploadType)) {
|
||||||
|
obsBootUtil.getFileFromOBS(entity.getSavePath(), outputStream);
|
||||||
|
} else if ("alioss".equals(uploadType)) {
|
||||||
|
ossClientUtil.getFileFromOSS(entity.getSavePath(), outputStream);
|
||||||
|
} else if ("local".equals(uploadType)) {
|
||||||
|
localFileUtil.getFileFromLocal(entity.getSavePath(), outputStream);
|
||||||
|
}
|
||||||
|
//给文件添加水印
|
||||||
|
waterMarkUtil.addWatermarkToPdfAndWriteToResponse(new FileInputStream(path), response);
|
||||||
|
outputStream.close();
|
||||||
|
} else {
|
||||||
|
// 上传方式:阿里云:alioss 华为云:hwobs 本地:local
|
||||||
|
if ("hwobs".equals(uploadType)){
|
||||||
|
obsBootUtil.downFile(entity.getSavePath(), response);
|
||||||
|
}else if ("alioss".equals(uploadType)){
|
||||||
|
ossClientUtil.downloadFileFromOSS(entity.getSavePath(),response);
|
||||||
|
}else if ("local".equals(uploadType)){
|
||||||
|
localFileUtil.downFile(entity.getSavePath(), response);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.info(ex.getMessage(),ex);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
List<String> filePaths = new ArrayList<>();
|
||||||
|
// 设置响应头信息
|
||||||
|
response.setContentType("application/zip");
|
||||||
|
response.setHeader("Content-Disposition", "attachment; filename=" + encodedZipName);
|
||||||
|
response.setHeader("Content-Transfer-Encoding", "binary");
|
||||||
|
response.setHeader("Pragma", "public");
|
||||||
|
response.setHeader("Cache-Control", "no-store");
|
||||||
|
response.setHeader("Expires", "0");
|
||||||
|
|
||||||
|
for (String fileId : downLoadFileIds) {
|
||||||
|
try {
|
||||||
|
FileEntity entity = fileService.getFile(fileId);
|
||||||
|
String fileName = entity.getFileName();
|
||||||
|
|
||||||
|
String path = uploadFile + entity.getSavePath();
|
||||||
|
FileOutputStream outputStream = new FileOutputStream(path);
|
||||||
|
filePaths.add(path);
|
||||||
|
|
||||||
|
// 上传方式:阿里云:alioss 华为云:hwobs
|
||||||
|
if ("hwobs".equals(uploadType)) {
|
||||||
|
obsBootUtil.getFileFromOBS(entity.getSavePath(), outputStream);
|
||||||
|
} else if ("alioss".equals(uploadType)) {
|
||||||
|
ossClientUtil.getFileFromOSS(entity.getSavePath(), outputStream);
|
||||||
|
} else if ("local".equals(uploadType)) {
|
||||||
|
localFileUtil.getFileFromLocal(entity.getSavePath(), outputStream);
|
||||||
|
}
|
||||||
|
//PDF文件需要加水印
|
||||||
|
if (FILE_EXTENSIONS_PDF.equalsIgnoreCase(FileUtil.getFileExtension(fileName))) {
|
||||||
|
waterMarkUtil.savePdfToFile(new FileInputStream(path), path);
|
||||||
|
}
|
||||||
|
outputStream.close();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.info(ex.getMessage(),ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//将文件压缩 写入Response
|
||||||
|
localFileUtil.compressFiles(filePaths, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (StringUtils.isNotEmpty(reportId)){
|
||||||
ReportLogBook reportLog = new ReportLogBook();
|
ReportLogBook reportLog = new ReportLogBook();
|
||||||
reportLog.setId(UUID.randomUUID().toString().replaceAll("-",""));
|
reportLog.setId(UUID.randomUUID().toString().replaceAll("-",""));
|
||||||
reportLog.setReportId(repostId);
|
reportLog.setReportId(reportId);
|
||||||
reportLog.setType(2);
|
reportLog.setType(2);
|
||||||
reportLog.setUpdateTime(new Date());
|
reportLog.setUpdateTime(new Date());
|
||||||
reportLog.setUserId(UserUtils.getUserId());
|
reportLog.setUserId(UserUtils.getUserId());
|
||||||
reportLogBookDao.insert(reportLog);
|
reportLogBookDao.insert(reportLog);
|
||||||
|
|
||||||
//报告日志管理
|
//报告日志管理
|
||||||
ReportEntity reportEntity = reportDao.selectById(repostId);
|
ReportEntity reportEntity = reportDao.selectById(reportId);
|
||||||
|
reportLog(reportEntity.getName(),"下载");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 下载文件
|
||||||
|
* @param response
|
||||||
|
* @param fileIds
|
||||||
|
* @throws IOException
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "下载文件")
|
||||||
|
@GetMapping("/downloadAll")
|
||||||
|
public void downloadAll(HttpServletResponse response, String[] fileIds, String reportId) throws IOException {
|
||||||
|
List<String> fileIdList = new ArrayList<>();
|
||||||
|
if (CollectionUtils.isNotEmpty(fileIds)) {
|
||||||
|
fileIdList = Arrays.asList(fileIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (StrUtil.isBlank(reportId)) {
|
||||||
|
throw new AdcDaBaseException("缺少报告id");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (StrUtil.isNotBlank(reportId)) {
|
||||||
|
//校验权限
|
||||||
|
if (!reportService.isAllowDownload(UserUtils.getUserId(), reportId)) {
|
||||||
|
throw new AdcDaBaseException("无此报告下载权限");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//待下载的文件id List
|
||||||
|
List<String> downLoadFileIds;
|
||||||
|
String reportName = reportDao.selectById(reportId).getName();
|
||||||
|
String folderName = reportName + ".zip";
|
||||||
|
// 获取编码后的文件名
|
||||||
|
String encodedZipName = URLEncoder.encode(folderName, "UTF-8");
|
||||||
|
|
||||||
|
//判断是从列表页面下载 还是预览页面下载
|
||||||
|
if (CollectionUtils.isEmpty(fileIdList)) {
|
||||||
|
//列表点击下载按钮
|
||||||
|
downLoadFileIds = fileService.getDownloadFileIds(reportId);
|
||||||
|
if (CollectionUtils.isEmpty(downLoadFileIds)) {
|
||||||
|
try {
|
||||||
|
// 设置响应头信息
|
||||||
|
response.setContentType("application/zip");
|
||||||
|
response.setHeader("Content-Disposition", "attachment; filename=" + encodedZipName);
|
||||||
|
response.setHeader("Content-Transfer-Encoding", "binary");
|
||||||
|
response.setHeader("Pragma", "public");
|
||||||
|
response.setHeader("Cache-Control", "no-store");
|
||||||
|
response.setHeader("Expires", "0");
|
||||||
|
|
||||||
|
// 创建空的ZipOutputStream
|
||||||
|
ZipOutputStream zipOutputStream = new ZipOutputStream(response.getOutputStream());
|
||||||
|
// 添加空文件夹条目
|
||||||
|
ZipEntry emptyDirectoryEntry = new ZipEntry(reportName + "/");
|
||||||
|
zipOutputStream.putNextEntry(emptyDirectoryEntry);
|
||||||
|
zipOutputStream.close();
|
||||||
|
return;
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
//预览点击下载按钮
|
||||||
|
downLoadFileIds = fileIdList;
|
||||||
|
}
|
||||||
|
|
||||||
|
//如果只下载一个文件,则不压缩
|
||||||
|
if (downLoadFileIds.size() == 1) {
|
||||||
|
String fileId = downLoadFileIds.get(0);
|
||||||
|
try {
|
||||||
|
FileEntity entity = fileService.getFile(fileId);
|
||||||
|
String fileName = entity.getFileName();
|
||||||
|
// 获取编码后的文件名
|
||||||
|
String encodedFileName = URLEncoder.encode(fileName, "UTF-8");
|
||||||
|
response.setHeader("Content-Disposition", "attachment;filename=" + encodedFileName);
|
||||||
|
|
||||||
|
//PDF文件需要加水印
|
||||||
|
if (FILE_EXTENSIONS_PDF.equalsIgnoreCase(FileUtil.getFileExtension(fileName))) {
|
||||||
|
String path = uploadFile + entity.getSavePath();
|
||||||
|
FileOutputStream outputStream = new FileOutputStream(path);
|
||||||
|
// 上传方式:阿里云:alioss 华为云:hwobs
|
||||||
|
if ("hwobs".equals(uploadType)) {
|
||||||
|
obsBootUtil.getFileFromOBS(entity.getSavePath(), outputStream);
|
||||||
|
} else if ("alioss".equals(uploadType)) {
|
||||||
|
ossClientUtil.getFileFromOSS(entity.getSavePath(), outputStream);
|
||||||
|
} else if ("local".equals(uploadType)) {
|
||||||
|
localFileUtil.getFileFromLocal(entity.getSavePath(), outputStream);
|
||||||
|
}
|
||||||
|
//给文件添加水印
|
||||||
|
waterMarkUtil.addWatermarkToPdfAndWriteToResponse(new FileInputStream(path), response);
|
||||||
|
outputStream.close();
|
||||||
|
} else {
|
||||||
|
// 上传方式:阿里云:alioss 华为云:hwobs 本地:local
|
||||||
|
if ("hwobs".equals(uploadType)){
|
||||||
|
obsBootUtil.downFile(entity.getSavePath(), response);
|
||||||
|
}else if ("alioss".equals(uploadType)){
|
||||||
|
ossClientUtil.downloadFileFromOSS(entity.getSavePath(),response);
|
||||||
|
}else if ("local".equals(uploadType)){
|
||||||
|
localFileUtil.downFile(entity.getSavePath(), response);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.info(ex.getMessage(),ex);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
List<String> filePaths = new ArrayList<>();
|
||||||
|
// 设置响应头信息
|
||||||
|
response.setContentType("application/zip");
|
||||||
|
response.setHeader("Content-Disposition", "attachment; filename=" + encodedZipName);
|
||||||
|
response.setHeader("Content-Transfer-Encoding", "binary");
|
||||||
|
response.setHeader("Pragma", "public");
|
||||||
|
response.setHeader("Cache-Control", "no-store");
|
||||||
|
response.setHeader("Expires", "0");
|
||||||
|
|
||||||
|
for (String fileId : downLoadFileIds) {
|
||||||
|
try {
|
||||||
|
FileEntity entity = fileService.getFile(fileId);
|
||||||
|
String fileName = entity.getFileName();
|
||||||
|
|
||||||
|
String path = uploadFile + entity.getSavePath();
|
||||||
|
FileOutputStream outputStream = new FileOutputStream(path);
|
||||||
|
filePaths.add(path);
|
||||||
|
|
||||||
|
// 上传方式:阿里云:alioss 华为云:hwobs
|
||||||
|
if ("hwobs".equals(uploadType)) {
|
||||||
|
obsBootUtil.getFileFromOBS(entity.getSavePath(), outputStream);
|
||||||
|
} else if ("alioss".equals(uploadType)) {
|
||||||
|
ossClientUtil.getFileFromOSS(entity.getSavePath(), outputStream);
|
||||||
|
} else if ("local".equals(uploadType)) {
|
||||||
|
localFileUtil.getFileFromLocal(entity.getSavePath(), outputStream);
|
||||||
|
}
|
||||||
|
//PDF文件需要加水印
|
||||||
|
if (FILE_EXTENSIONS_PDF.equalsIgnoreCase(FileUtil.getFileExtension(fileName))) {
|
||||||
|
waterMarkUtil.savePdfToFile(new FileInputStream(path), path);
|
||||||
|
}
|
||||||
|
outputStream.close();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.info(ex.getMessage(),ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//将文件压缩 写入Response
|
||||||
|
localFileUtil.compressFiles(filePaths, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (StringUtils.isNotEmpty(reportId)){
|
||||||
|
ReportLogBook reportLog = new ReportLogBook();
|
||||||
|
reportLog.setId(UUID.randomUUID().toString().replaceAll("-",""));
|
||||||
|
reportLog.setReportId(reportId);
|
||||||
|
reportLog.setType(2);
|
||||||
|
reportLog.setUpdateTime(new Date());
|
||||||
|
reportLog.setUserId(UserUtils.getUserId());
|
||||||
|
reportLogBookDao.insert(reportLog);
|
||||||
|
|
||||||
|
//报告日志管理
|
||||||
|
ReportEntity reportEntity = reportDao.selectById(reportId);
|
||||||
reportLog(reportEntity.getName(),"下载");
|
reportLog(reportEntity.getName(),"下载");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -593,4 +785,39 @@ public class ReportManageConroller {
|
|||||||
return Result.success(act);
|
return Result.success(act);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除文件
|
||||||
|
* @return
|
||||||
|
* @throws ParseException
|
||||||
|
*/
|
||||||
|
@ApiOperation("删除文件")
|
||||||
|
@PostMapping("/delFile")
|
||||||
|
public ResponseMessage delFile(@RequestBody ReportFile reportFile) throws Exception {
|
||||||
|
reportService.delFile(reportFile);
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件分页查询
|
||||||
|
* @return
|
||||||
|
* @throws ParseException
|
||||||
|
*/
|
||||||
|
@ApiOperation("文件分页查询")
|
||||||
|
@PostMapping("/filePage")
|
||||||
|
public ResponseMessage filePage(@RequestBody ReportFilePageVO reportFilePageVO) throws Exception {
|
||||||
|
IPage<ReportFile> reportFileIPage = reportService.filePage(reportFilePageVO);
|
||||||
|
return Result.success(reportFileIPage);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 刷新报告内容表,对比报告内容和报告表的差异,找到没有抽取过内容的报告,生成其内容放入报告内容表中
|
||||||
|
* @return
|
||||||
|
* @throws ParseException
|
||||||
|
*/
|
||||||
|
@ApiOperation("刷新报告内容表")
|
||||||
|
@GetMapping("/refreshReportContent")
|
||||||
|
public ResponseMessage refreshReportContent() {
|
||||||
|
return reportService.refreshReportContent();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,9 +3,15 @@ package com.adc.da.report.dao.mysql;
|
|||||||
import com.adc.da.report.eo.FileEntity;
|
import com.adc.da.report.eo.FileEntity;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author doudxw
|
* @Author doudxw
|
||||||
* @Date 2021/6/28 15:19
|
* @Date 2021/6/28 15:19
|
||||||
*/
|
*/
|
||||||
public interface FileDao extends BaseMapper<FileEntity> {
|
public interface FileDao extends BaseMapper<FileEntity> {
|
||||||
|
|
||||||
|
List<String> getDownloadFileIdsWithoutExcel(String reportId);
|
||||||
|
|
||||||
|
List<String> getDownloadFileIds(String reportId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package com.adc.da.report.dao.mysql;
|
||||||
|
|
||||||
|
import com.adc.da.report.eo.MessageEntity;
|
||||||
|
import com.adc.da.report.vo.MessageQueryVo;
|
||||||
|
import com.adc.da.report.vo.MessageVo;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author ThinkBook
|
||||||
|
* @description 针对表【ts_message】的数据库操作Mapper
|
||||||
|
* @createDate 2023-05-23 11:22:15
|
||||||
|
* @Entity com.adc.da.report.eo.MessageEntityEntity
|
||||||
|
*/
|
||||||
|
public interface MessageDao extends BaseMapper<MessageEntity> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据当前用户展示站内信列表
|
||||||
|
* @param page
|
||||||
|
* @param messageVo
|
||||||
|
* @param userId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
IPage<MessageVo> listByUser(IPage<MessageVo> page, @Param("vo") MessageQueryVo messageVo, @Param("userId") String userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -48,6 +48,8 @@ public interface ReportDao extends BaseMapper<ReportEntity> {
|
|||||||
*/
|
*/
|
||||||
IPage<ReportVo> page(IPage<ReportEntity> page, @Param("pageVO") ReportQueryVo vo, @Param("idSet") Set<String> idSet);
|
IPage<ReportVo> page(IPage<ReportEntity> page, @Param("pageVO") ReportQueryVo vo, @Param("idSet") Set<String> idSet);
|
||||||
|
|
||||||
|
IPage<ReportVo> myCollectPage(IPage<ReportEntity> page, @Param("pageVO") ReportQueryVo vo, @Param("idSet") Set<String> idSet, @Param("collectReportIds") List<String> collectReportIds);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 报告列表
|
* 报告列表
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package com.adc.da.report.dao.mysql;
|
||||||
|
|
||||||
|
import com.adc.da.report.eo.ReportFile;
|
||||||
|
import com.adc.da.report.vo.ReportFilePageVO;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface ReportFileDao extends BaseMapper<ReportFile> {
|
||||||
|
|
||||||
|
void delByReportId(@Param("pageVO") ReportFile reportFile);
|
||||||
|
|
||||||
|
void actEndDelReport(@Param("reportId")String reportId);
|
||||||
|
|
||||||
|
void updateState(@Param("reportId")String dataId);
|
||||||
|
|
||||||
|
List<ReportFile> selectByReport(@Param("pageVO")ReportFile reportFile);
|
||||||
|
|
||||||
|
IPage<ReportFile> filePage(IPage<ReportFilePageVO> page,@Param("pageVO") ReportFilePageVO reportFilePageVO);
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@ package com.adc.da.report.dao.mysql;
|
|||||||
|
|
||||||
import com.adc.da.report.eo.ReportLabelEntity;
|
import com.adc.da.report.eo.ReportLabelEntity;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author ThinkBook
|
* @author ThinkBook
|
||||||
@@ -11,6 +12,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|||||||
*/
|
*/
|
||||||
public interface ReportLabelDao extends BaseMapper<ReportLabelEntity> {
|
public interface ReportLabelDao extends BaseMapper<ReportLabelEntity> {
|
||||||
|
|
||||||
|
void actEndDelReport(@Param("reportId")String dataId);
|
||||||
|
|
||||||
|
void updateState(@Param("reportId")String dataId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.adc.da.report.dao.mysql;
|
|||||||
|
|
||||||
import com.adc.da.report.eo.TreeLabelEntity;
|
import com.adc.da.report.eo.TreeLabelEntity;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -20,7 +21,7 @@ public interface TreeLabelDao extends BaseMapper<TreeLabelEntity> {
|
|||||||
*/
|
*/
|
||||||
double getMaxNum(String parentId);
|
double getMaxNum(String parentId);
|
||||||
|
|
||||||
List<String> selectIdByReport(String reportId);
|
List<String> selectIdByReport(@Param("reportId") String reportId,@Param("state") Integer state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package com.adc.da.report.dao.mysql;
|
||||||
|
|
||||||
|
import com.adc.da.report.eo.UserMessageEntity;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author ThinkBook
|
||||||
|
* @description 针对表【ts_user_message】的数据库操作Mapper
|
||||||
|
* @createDate 2023-05-23 11:30:04
|
||||||
|
* @Entity com.adc.da.report.eo.UserMessage
|
||||||
|
*/
|
||||||
|
public interface UserMessageDao extends BaseMapper<UserMessageEntity> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
package com.adc.da.report.eo;
|
||||||
|
|
||||||
|
import com.adc.da.report.constant.MessageTypeEnum;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Caihaohan
|
||||||
|
* @TableName ts_message
|
||||||
|
*/
|
||||||
|
@TableName(value ="ts_message")
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class MessageEntity implements Serializable {
|
||||||
|
/**
|
||||||
|
* 主键id
|
||||||
|
*/
|
||||||
|
@TableId(value = "id")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标题
|
||||||
|
*/
|
||||||
|
@TableField(value = "message_title")
|
||||||
|
private String messageTitle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 内容
|
||||||
|
*/
|
||||||
|
@TableField(value = "content")
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 消息类型
|
||||||
|
*/
|
||||||
|
@TableField(value = "message_type")
|
||||||
|
private Integer messageType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发布人
|
||||||
|
*/
|
||||||
|
@TableField(value = "createUser")
|
||||||
|
private String createUser;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发布时间
|
||||||
|
*/
|
||||||
|
@TableField(value = "createDate")
|
||||||
|
private Date createDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除标记(0未删除 1已删除)
|
||||||
|
*/
|
||||||
|
@TableField(value = "del_flag")
|
||||||
|
private Integer delFlag;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private static final long serialVersionUID = 1314298673425876932L;
|
||||||
|
}
|
||||||
@@ -35,6 +35,12 @@ public class ReportContentEntity implements Serializable {
|
|||||||
@TableField(value = "report_id")
|
@TableField(value = "report_id")
|
||||||
private String reportId;
|
private String reportId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报告id
|
||||||
|
*/
|
||||||
|
@TableField(value = "file_ids")
|
||||||
|
private String fileIds;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文件内容
|
* 文件内容
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ public class ReportEntity {
|
|||||||
/**
|
/**
|
||||||
* 文件id
|
* 文件id
|
||||||
*/
|
*/
|
||||||
@TableField("fileId")
|
@TableField(exist = false)
|
||||||
private String fileId;
|
private String fileId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -109,4 +109,7 @@ public class ReportEntity {
|
|||||||
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private List<List<String>> labelList;
|
private List<List<String>> labelList;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private List<ReportFile> fileList;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,52 @@
|
|||||||
|
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 lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@TableName("TS_REPORT_FILE")
|
||||||
|
public class ReportFile {
|
||||||
|
|
||||||
|
@TableId(value = "id",type = IdType.INPUT)
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@TableField("report_id")
|
||||||
|
private String reportId;
|
||||||
|
|
||||||
|
@TableField("file_id")
|
||||||
|
private String fileId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态 1 流程中 ,2 非流程中
|
||||||
|
*/
|
||||||
|
@TableField("state")
|
||||||
|
private Integer state;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private List<String> rfIdList;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String fileName;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public ReportFile(String reportId){
|
||||||
|
this.reportId = reportId;
|
||||||
|
}
|
||||||
|
public ReportFile(String reportId,Integer state){
|
||||||
|
this.reportId = reportId;
|
||||||
|
this.state = state;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ReportFile(){
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,13 +4,13 @@ import com.baomidou.mybatisplus.annotation.IdType;
|
|||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Caihaohan
|
* @author Caihaohan
|
||||||
* @TableName ts_report_label
|
* @TableName ts_report_label
|
||||||
@@ -46,12 +46,19 @@ public class ReportLabelEntity implements Serializable {
|
|||||||
@TableField(value = "last_label")
|
@TableField(value = "last_label")
|
||||||
private String lastLabel;
|
private String lastLabel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态 1 流程中 ,2 非流程中
|
||||||
|
*/
|
||||||
|
@TableField("state")
|
||||||
|
private Integer state;
|
||||||
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private static final long serialVersionUID = 121348721347890417L;
|
private static final long serialVersionUID = 121348721347890417L;
|
||||||
|
|
||||||
public ReportLabelEntity(String id, String reportId, String labelId) {
|
public ReportLabelEntity(String id, String reportId, String labelId,Integer state) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.reportId = reportId;
|
this.reportId = reportId;
|
||||||
this.labelId = labelId;
|
this.labelId = labelId;
|
||||||
|
this.state = state;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -94,7 +94,7 @@ public class TtReportManageAct {
|
|||||||
/**
|
/**
|
||||||
* 文件id
|
* 文件id
|
||||||
*/
|
*/
|
||||||
@TableField("fileId")
|
@TableField(exist = false)
|
||||||
private String fileId;
|
private String fileId;
|
||||||
|
|
||||||
|
|
||||||
@@ -128,10 +128,16 @@ public class TtReportManageAct {
|
|||||||
@TableField("secrecy_last")
|
@TableField("secrecy_last")
|
||||||
private Date secrecyLast;
|
private Date secrecyLast;
|
||||||
|
|
||||||
@TableField("file_name")
|
@TableField(exist = false)
|
||||||
|
private String rfId;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
private String fileName;
|
private String fileName;
|
||||||
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private List<String> labelList;
|
private List<String> labelList;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private List<ReportFile> fileList;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,56 @@
|
|||||||
|
package com.adc.da.report.eo;
|
||||||
|
|
||||||
|
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 ThinkBook
|
||||||
|
* @TableName ts_user_message
|
||||||
|
*/
|
||||||
|
@TableName(value ="ts_user_message")
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class UserMessageEntity implements Serializable {
|
||||||
|
/**
|
||||||
|
* 主键id
|
||||||
|
*/
|
||||||
|
@TableId(value = "id")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户id
|
||||||
|
*/
|
||||||
|
@TableField(value = "user_id")
|
||||||
|
private String userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 站内信id
|
||||||
|
*/
|
||||||
|
@TableField(value = "message_id")
|
||||||
|
private String messageId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 阅读状态(0代表未读,1代表已读)
|
||||||
|
*/
|
||||||
|
@TableField(value = "read_type")
|
||||||
|
private Integer readType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除标记(0未删除 1已删除)
|
||||||
|
*/
|
||||||
|
@TableField(value = "del_flag")
|
||||||
|
private Integer delFlag;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
}
|
||||||
@@ -2,6 +2,10 @@ package com.adc.da.report.service;
|
|||||||
|
|
||||||
|
|
||||||
import com.adc.da.report.eo.FileEntity;
|
import com.adc.da.report.eo.FileEntity;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author doudxw
|
* @Author doudxw
|
||||||
@@ -22,4 +26,26 @@ public interface IFileService {
|
|||||||
*/
|
*/
|
||||||
FileEntity getFile(String fileId);
|
FileEntity getFile(String fileId);
|
||||||
|
|
||||||
|
List<Map<String, Object>> batchUploadFile(MultipartFile[] files);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断传进来的fileIds里有没有Excel的fileId
|
||||||
|
* @param fileIds
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
boolean hasExcelFileId(List<String> fileIds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据报告id返回所有可以下载的文件id(不要excel的)
|
||||||
|
*/
|
||||||
|
List<String> getDownloadFileIdsWithoutExcel(String reportId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据报告id返回所有可以下载的文件id
|
||||||
|
* @param reportId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<String> getDownloadFileIds(String reportId);
|
||||||
|
|
||||||
|
Map<String, Object> uploadFile(MultipartFile file);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package com.adc.da.report.service;
|
||||||
|
|
||||||
|
import com.adc.da.report.eo.MessageEntity;
|
||||||
|
import com.adc.da.report.vo.MessageQueryVo;
|
||||||
|
import com.adc.da.util.http.ResponseMessage;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author ThinkBook
|
||||||
|
* @description 针对表【ts_message】的数据库操作Service
|
||||||
|
* @createDate 2023-05-23 11:22:15
|
||||||
|
*/
|
||||||
|
public interface IMessageService extends IService<MessageEntity> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回当前用户的消息列表
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
ResponseMessage listByCurrentUser(MessageQueryVo messageVo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 全部已读接口
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
ResponseMessage allRead();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发布站内信(当用户数过多的时候谨慎使用发送给全部用户)
|
||||||
|
* @param message
|
||||||
|
* @param toAllUser
|
||||||
|
* @param userIds
|
||||||
|
*/
|
||||||
|
void publishMessage(MessageEntity message, boolean toAllUser, List<String> userIds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查看站内信设置为已读
|
||||||
|
* @param messageId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
ResponseMessage readMessage(String messageId);
|
||||||
|
}
|
||||||
@@ -3,7 +3,6 @@ package com.adc.da.report.service;
|
|||||||
import com.adc.da.report.eo.ReportContentEntity;
|
import com.adc.da.report.eo.ReportContentEntity;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -18,7 +17,12 @@ public interface IReportContentService extends IService<ReportContentEntity> {
|
|||||||
* 插入报告内容表
|
* 插入报告内容表
|
||||||
*
|
*
|
||||||
* @param reportId 报告id
|
* @param reportId 报告id
|
||||||
* @param fileId 文件id
|
|
||||||
*/
|
*/
|
||||||
void insertReportContent(String reportId, String fileId) throws IOException;
|
void insertReportContent(String reportId) throws IOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据报告id删除记录
|
||||||
|
* @param reportId
|
||||||
|
*/
|
||||||
|
void removeByReportId(String reportId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package com.adc.da.report.service;
|
||||||
|
|
||||||
|
|
||||||
|
import com.adc.da.report.eo.ReportFile;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
public interface IReportFileService extends IService<ReportFile> {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -4,6 +4,7 @@ import com.adc.da.report.eo.ReportLogBook;
|
|||||||
import com.adc.da.report.vo.DeleteParamRequestVO;
|
import com.adc.da.report.vo.DeleteParamRequestVO;
|
||||||
import com.adc.da.report.vo.ReportDetailThumbUpVo;
|
import com.adc.da.report.vo.ReportDetailThumbUpVo;
|
||||||
import com.adc.da.report.vo.ReportLogPageVO;
|
import com.adc.da.report.vo.ReportLogPageVO;
|
||||||
|
import com.adc.da.util.http.ResponseMessage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -64,6 +65,13 @@ public interface IReportLogBookService {
|
|||||||
*/
|
*/
|
||||||
Integer getPreviewCount(String reportId);
|
Integer getPreviewCount(String reportId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取收藏量
|
||||||
|
* @param reportId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Integer getCollectCount(String reportId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取点赞量
|
* 获取点赞量
|
||||||
* @param reportId
|
* @param reportId
|
||||||
@@ -71,4 +79,17 @@ public interface IReportLogBookService {
|
|||||||
*/
|
*/
|
||||||
Integer getThumbUpCount(String reportId);
|
Integer getThumbUpCount(String reportId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 收藏或取消收藏
|
||||||
|
* @param reportId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
ResponseMessage collectOrCancelCollect(String reportId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据用户id获取所有报告id
|
||||||
|
* @param userId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<String> getCollectReportIdByUser(String userId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
package com.adc.da.report.service;
|
package com.adc.da.report.service;
|
||||||
|
|
||||||
import com.adc.da.report.eo.ReportEntity;
|
import com.adc.da.report.eo.ReportEntity;
|
||||||
|
import com.adc.da.report.eo.ReportFile;
|
||||||
|
import com.adc.da.report.vo.ChangeUploaderVo;
|
||||||
|
import com.adc.da.report.vo.ReportFilePageVO;
|
||||||
import com.adc.da.report.vo.ReportQueryVo;
|
import com.adc.da.report.vo.ReportQueryVo;
|
||||||
import com.adc.da.report.vo.ReportVo;
|
import com.adc.da.report.vo.ReportVo;
|
||||||
import com.adc.da.util.http.ResponseMessage;
|
import com.adc.da.util.http.ResponseMessage;
|
||||||
@@ -40,15 +43,33 @@ public interface IReportService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取报告htmlString
|
* 获取报告htmlString
|
||||||
* @param id
|
* @param reportId
|
||||||
|
* @param fileId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
String reportHtml(String id);
|
String reportHtml(String reportId, String fileId);
|
||||||
|
|
||||||
IPage<ReportVo> addReportPage(ReportQueryVo vo) throws Exception;
|
IPage<ReportVo> addReportPage(ReportQueryVo vo) throws Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报告查询页面列表接口
|
||||||
|
* @param vo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
IPage<ReportVo> page(ReportQueryVo vo);
|
IPage<ReportVo> page(ReportQueryVo vo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 我的收藏页面列表接口
|
||||||
|
* @param vo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
IPage<ReportVo> myCollectPage(ReportQueryVo vo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报告管理页面列表接口
|
||||||
|
* @param vo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
IPage<ReportVo> reportManagerPage(ReportQueryVo vo);
|
IPage<ReportVo> reportManagerPage(ReportQueryVo vo);
|
||||||
|
|
||||||
List<String> isAct(ReportQueryVo vo);
|
List<String> isAct(ReportQueryVo vo);
|
||||||
@@ -78,5 +99,30 @@ public interface IReportService {
|
|||||||
*/
|
*/
|
||||||
Boolean isAllowDownload(String userId, String repostId);
|
Boolean isAllowDownload(String userId, String repostId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断用户是否允许修改上传人
|
||||||
|
*
|
||||||
|
* @param userId 用户id
|
||||||
|
* @return 是否有修改上传人的权限
|
||||||
|
*/
|
||||||
|
Boolean isAllowChangeUploader(String userId);
|
||||||
|
|
||||||
void addOrUpdate(ReportEntity reportEntity);
|
void addOrUpdate(ReportEntity reportEntity);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更改上传人
|
||||||
|
* @param changeUploaderVo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
ResponseMessage changeUploader(ChangeUploaderVo changeUploaderVo);
|
||||||
|
|
||||||
|
void delFile(ReportFile reportFile);
|
||||||
|
|
||||||
|
IPage<ReportFile> filePage(ReportFilePageVO ReportFilePageVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 刷新报告内容
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
ResponseMessage refreshReportContent();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package com.adc.da.report.service;
|
||||||
|
|
||||||
|
import com.adc.da.report.eo.UserMessageEntity;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author ThinkBook
|
||||||
|
* @description 针对表【ts_user_message】的数据库操作Service
|
||||||
|
* @createDate 2023-05-23 11:30:04
|
||||||
|
*/
|
||||||
|
public interface IUserMessageService extends IService<UserMessageEntity> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,21 +1,53 @@
|
|||||||
package com.adc.da.report.service.impl;
|
package com.adc.da.report.service.impl;
|
||||||
|
|
||||||
|
import com.adc.da.report.constant.ReportConstants;
|
||||||
import com.adc.da.report.dao.mysql.FileDao;
|
import com.adc.da.report.dao.mysql.FileDao;
|
||||||
import com.adc.da.report.eo.FileEntity;
|
import com.adc.da.report.eo.FileEntity;
|
||||||
import com.adc.da.report.service.IFileService;
|
import com.adc.da.report.service.IFileService;
|
||||||
import javax.annotation.Resource;
|
import com.adc.da.report.util.LocalFileUtil;
|
||||||
|
import com.adc.da.report.util.OSSClientUtil;
|
||||||
|
import com.adc.da.report.util.ObsBootUtil;
|
||||||
|
import com.adc.da.util.utils.CollectionUtils;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import lombok.Synchronized;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author doudxw
|
* @Author doudxw
|
||||||
* @Date 2021/11/8 15:00
|
* @Date 2021/11/8 15:00
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
|
@Slf4j
|
||||||
public class IFileServiceImpl implements IFileService {
|
public class IFileServiceImpl implements IFileService {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private FileDao fileDao;
|
private FileDao fileDao;
|
||||||
|
|
||||||
|
@Value("${uploadFile}")
|
||||||
|
private String uploadFile;
|
||||||
|
|
||||||
|
@Value("${picPath}")
|
||||||
|
private String picPath;
|
||||||
|
@Value("${uploadType}")
|
||||||
|
private String uploadType;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ObsBootUtil obsBootUtil;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private LocalFileUtil localFileUtil;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private OSSClientUtil ossClientUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加文件
|
* 添加文件
|
||||||
@@ -36,4 +68,142 @@ public class IFileServiceImpl implements IFileService {
|
|||||||
FileEntity fileEntity = fileDao.selectById(fileId);
|
FileEntity fileEntity = fileDao.selectById(fileId);
|
||||||
return fileEntity;
|
return fileEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public List<Map<String, Object>> batchUploadFile(MultipartFile[] files) {
|
||||||
|
List<Map<String, Object>> resultList = new ArrayList<>();
|
||||||
|
for (MultipartFile file : files) {
|
||||||
|
Map<String, Object> resultMap = new HashMap();
|
||||||
|
//上传路径
|
||||||
|
//此路径映射到localhost
|
||||||
|
String path = uploadFile;
|
||||||
|
String realName = file.getOriginalFilename();
|
||||||
|
Date now = new Date();
|
||||||
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||||
|
String date = dateFormat.format(now);
|
||||||
|
Random r = new Random();
|
||||||
|
String num = "";
|
||||||
|
for (int i = 0; i < 3; i++) {
|
||||||
|
int s = r.nextInt(10);
|
||||||
|
num += String.valueOf(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取上传文件名
|
||||||
|
String fileName = file.getOriginalFilename();
|
||||||
|
String contentType = file.getContentType();
|
||||||
|
String ext = fileName.substring(fileName.lastIndexOf(".") + 1);
|
||||||
|
fileName = fileName.substring(0, fileName.lastIndexOf("."))+date + num + "." + ext;
|
||||||
|
log.info("fileName>>" + fileName);
|
||||||
|
try{
|
||||||
|
String result="";
|
||||||
|
// 上传方式:阿里云:alioss 华为云:hwobs
|
||||||
|
if ("hwobs".equals(uploadType)){
|
||||||
|
result = obsBootUtil.upload(file, fileName);
|
||||||
|
}else if ("alioss".equals(uploadType)) {
|
||||||
|
result = ossClientUtil.uploadFile2OSS(file.getInputStream(),fileName);
|
||||||
|
}else if ("local".equals(uploadType)) {
|
||||||
|
localFileUtil.saveFile(file.getInputStream(), fileName);
|
||||||
|
}
|
||||||
|
resultMap.put("key", date + num);
|
||||||
|
resultMap.put("value", path + "//" + fileName);
|
||||||
|
resultMap.put("name", realName);
|
||||||
|
resultList.add(resultMap);
|
||||||
|
}
|
||||||
|
catch (Exception e){
|
||||||
|
log.error(e.getMessage(),e);
|
||||||
|
}
|
||||||
|
FileEntity entity = new FileEntity();
|
||||||
|
entity.setContentType(contentType);
|
||||||
|
entity.setCreateTime(new Date());
|
||||||
|
entity.setFileName(realName);
|
||||||
|
entity.setFileType(ext);
|
||||||
|
entity.setFileSize(String.valueOf(file.getSize()));
|
||||||
|
entity.setFileId(date + num);
|
||||||
|
entity.setSavePath(fileName);
|
||||||
|
this.addFile(entity);
|
||||||
|
}
|
||||||
|
return resultList;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Synchronized
|
||||||
|
public Map<String, Object> uploadFile(MultipartFile file) {
|
||||||
|
Map<String, Object> resultMap = new HashMap();
|
||||||
|
//上传路径
|
||||||
|
//此路径映射到localhost
|
||||||
|
String path = uploadFile;
|
||||||
|
String realName = file.getOriginalFilename();
|
||||||
|
Date now = new Date();
|
||||||
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||||
|
String date = dateFormat.format(now);
|
||||||
|
Random r = new Random();
|
||||||
|
String num = "";
|
||||||
|
for (int i = 0; i < 3; i++) {
|
||||||
|
int s = r.nextInt(10);
|
||||||
|
num += String.valueOf(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取上传文件名
|
||||||
|
String fileName = file.getOriginalFilename();
|
||||||
|
String contentType = file.getContentType();
|
||||||
|
String ext = fileName.substring(fileName.lastIndexOf(".") + 1);
|
||||||
|
fileName = fileName.substring(0, fileName.lastIndexOf("."))+date + num + "." + ext;
|
||||||
|
log.info("fileName>>" + fileName);
|
||||||
|
try{
|
||||||
|
String result="";
|
||||||
|
// 上传方式:阿里云:alioss 华为云:hwobs
|
||||||
|
if ("hwobs".equals(uploadType)){
|
||||||
|
result = obsBootUtil.upload(file, fileName);
|
||||||
|
}else if ("alioss".equals(uploadType)) {
|
||||||
|
result = ossClientUtil.uploadFile2OSS(file.getInputStream(),fileName);
|
||||||
|
}else if ("local".equals(uploadType)) {
|
||||||
|
localFileUtil.saveFile(file.getInputStream(), fileName);
|
||||||
|
}
|
||||||
|
resultMap.put("id", date + num);
|
||||||
|
resultMap.put("value", path + "//" + fileName);
|
||||||
|
resultMap.put("name", realName);
|
||||||
|
}
|
||||||
|
catch (Exception e){
|
||||||
|
log.error(e.getMessage(),e);
|
||||||
|
}
|
||||||
|
FileEntity entity = new FileEntity();
|
||||||
|
entity.setContentType(contentType);
|
||||||
|
entity.setCreateTime(new Date());
|
||||||
|
entity.setFileName(realName);
|
||||||
|
entity.setFileType(ext);
|
||||||
|
entity.setFileSize(String.valueOf(file.getSize()));
|
||||||
|
entity.setFileId(date + num);
|
||||||
|
entity.setSavePath(fileName);
|
||||||
|
this.addFile(entity);
|
||||||
|
return resultMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasExcelFileId(List<String> fileIds) {
|
||||||
|
boolean hasExcelFileId = false;
|
||||||
|
LambdaQueryWrapper<FileEntity> fileEntityLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
fileEntityLambdaQueryWrapper.in(FileEntity::getFileId, fileIds);
|
||||||
|
List<FileEntity> fileEntities = fileDao.selectList(fileEntityLambdaQueryWrapper);
|
||||||
|
if (CollectionUtils.isNotEmpty(fileEntities)) {
|
||||||
|
for (FileEntity fileEntity : fileEntities) {
|
||||||
|
if (ReportConstants.FILE_EXTENSIONS_XLS.equals(fileEntity.getFileType()) ||
|
||||||
|
ReportConstants.FILE_EXTENSIONS_XLSX.equals(fileEntity.getFileType())) {
|
||||||
|
hasExcelFileId = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return hasExcelFileId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> getDownloadFileIdsWithoutExcel(String reportId) {
|
||||||
|
return fileDao.getDownloadFileIdsWithoutExcel(reportId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> getDownloadFileIds(String reportId) {
|
||||||
|
return fileDao.getDownloadFileIds(reportId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,9 +9,9 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import javax.annotation.Resource;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@@ -72,6 +72,11 @@ public class ILogServiceImpl implements ILogService {
|
|||||||
wrapper.and(c -> c.like("DESCRIPTION", doList[0]).or()
|
wrapper.and(c -> c.like("DESCRIPTION", doList[0]).or()
|
||||||
.like("DESCRIPTION", doList[1]).or().like("DESCRIPTION", doList[2]));
|
.like("DESCRIPTION", doList[1]).or().like("DESCRIPTION", doList[2]));
|
||||||
break;
|
break;
|
||||||
|
case 4:
|
||||||
|
wrapper.and(c -> c.like("DESCRIPTION", doList[0]).or()
|
||||||
|
.like("DESCRIPTION", doList[1]).or().like("DESCRIPTION", doList[2])
|
||||||
|
.or().like("DESCRIPTION", doList[3]));
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,119 @@
|
|||||||
|
package com.adc.da.report.service.impl;
|
||||||
|
|
||||||
|
import com.adc.da.login.util.UserUtils;
|
||||||
|
import com.adc.da.report.constant.MessageConstants;
|
||||||
|
import com.adc.da.report.constant.MessageTypeEnum;
|
||||||
|
import com.adc.da.report.constant.ReportConstants;
|
||||||
|
import com.adc.da.report.dao.mysql.UserMessageDao;
|
||||||
|
import com.adc.da.report.eo.UserMessageEntity;
|
||||||
|
import com.adc.da.report.service.IUserMessageService;
|
||||||
|
import com.adc.da.report.vo.MessageQueryVo;
|
||||||
|
import com.adc.da.report.vo.MessageVo;
|
||||||
|
import com.adc.da.sys.dao.mysql.UserEODao;
|
||||||
|
import com.adc.da.sys.entity.UserEO;
|
||||||
|
import com.adc.da.sys.service.iservice.IUserEoService;
|
||||||
|
import com.adc.da.util.exception.AdcDaBaseException;
|
||||||
|
import com.adc.da.util.http.ResponseMessage;
|
||||||
|
import com.adc.da.util.http.Result;
|
||||||
|
import com.adc.da.util.utils.UUID;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.adc.da.report.eo.MessageEntity;
|
||||||
|
import com.adc.da.report.service.IMessageService;
|
||||||
|
import com.adc.da.report.dao.mysql.MessageDao;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import static com.adc.da.report.constant.MessageConstants.READ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author ThinkBook
|
||||||
|
* @description 针对表【ts_message】的数据库操作Service实现
|
||||||
|
* @createDate 2023-05-23 11:22:15
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class IMessageServiceImpl extends ServiceImpl<MessageDao, MessageEntity>
|
||||||
|
implements IMessageService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MessageDao messageDao;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IUserMessageService userMessageService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private UserEODao userEODao;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResponseMessage listByCurrentUser(MessageQueryVo messageVo) {
|
||||||
|
IPage<MessageVo> page = new Page<>();
|
||||||
|
page.setCurrent(messageVo.getPageNo());
|
||||||
|
page.setSize(messageVo.getPageSize());
|
||||||
|
IPage<MessageVo> list = messageDao.listByUser(page, messageVo, UserUtils.getUserId());
|
||||||
|
return Result.success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResponseMessage allRead() {
|
||||||
|
LambdaUpdateWrapper<UserMessageEntity> wrapper = new LambdaUpdateWrapper<>();
|
||||||
|
wrapper.eq(UserMessageEntity::getReadType, MessageConstants.UNREAD);
|
||||||
|
wrapper.eq(UserMessageEntity::getUserId, UserUtils.getUserId());
|
||||||
|
wrapper.set(UserMessageEntity::getReadType, READ);
|
||||||
|
userMessageService.update(wrapper);
|
||||||
|
return Result.success("全部已读");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void publishMessage(MessageEntity message, boolean toAllUser, List<String> userIds) {
|
||||||
|
List<String> userEoIds = new ArrayList<>();
|
||||||
|
if (toAllUser) {
|
||||||
|
LambdaQueryWrapper<UserEO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
lambdaQueryWrapper.eq(UserEO::getDelFlag, 0);
|
||||||
|
List<UserEO> userEOS = userEODao.selectList(lambdaQueryWrapper);
|
||||||
|
if (userEOS != null) {
|
||||||
|
userEoIds = userEOS.stream().map(UserEO::getUsid).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
userEoIds = userIds;
|
||||||
|
if (userEoIds.isEmpty()) {
|
||||||
|
throw new AdcDaBaseException("无指定发送的用户,无法发送站内信");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//保存消息信息
|
||||||
|
save(message);
|
||||||
|
List<UserMessageEntity> userMessageEntities = new ArrayList<>();
|
||||||
|
userEoIds.forEach(userId -> {
|
||||||
|
UserMessageEntity userMessageEntity = new UserMessageEntity();
|
||||||
|
userMessageEntity.setId(UUID.randomUUID10())
|
||||||
|
.setUserId(userId)
|
||||||
|
.setMessageId(message.getId())
|
||||||
|
.setReadType(MessageConstants.UNREAD)
|
||||||
|
.setDelFlag(0);
|
||||||
|
userMessageEntities.add(userMessageEntity);
|
||||||
|
});
|
||||||
|
userMessageService.saveBatch(userMessageEntities);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResponseMessage readMessage(String id) {
|
||||||
|
LambdaUpdateWrapper<UserMessageEntity> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
||||||
|
lambdaUpdateWrapper.eq(UserMessageEntity::getId, id);
|
||||||
|
lambdaUpdateWrapper.set(UserMessageEntity::getReadType, READ);
|
||||||
|
userMessageService.update(lambdaUpdateWrapper);
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
+62
-21
@@ -1,19 +1,23 @@
|
|||||||
package com.adc.da.report.service.impl;
|
package com.adc.da.report.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.json.JSONUtil;
|
||||||
import com.adc.da.report.dao.mysql.FileDao;
|
import com.adc.da.report.dao.mysql.FileDao;
|
||||||
|
import com.adc.da.report.dao.mysql.ReportFileDao;
|
||||||
import com.adc.da.report.eo.FileEntity;
|
import com.adc.da.report.eo.FileEntity;
|
||||||
|
import com.adc.da.report.eo.ReportFile;
|
||||||
import com.adc.da.report.util.FileContentUtil;
|
import com.adc.da.report.util.FileContentUtil;
|
||||||
import com.adc.da.report.util.LocalFileUtil;
|
import com.adc.da.report.util.LocalFileUtil;
|
||||||
import com.adc.da.report.util.OSSClientUtil;
|
import com.adc.da.report.util.OSSClientUtil;
|
||||||
import com.adc.da.report.util.ObsBootUtil;
|
import com.adc.da.report.util.ObsBootUtil;
|
||||||
|
import com.adc.da.util.utils.CollectionUtils;
|
||||||
import com.adc.da.util.utils.FileUtil;
|
import com.adc.da.util.utils.FileUtil;
|
||||||
import com.adc.da.util.utils.UUID;
|
import com.adc.da.util.utils.UUID;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.adc.da.report.eo.ReportContentEntity;
|
import com.adc.da.report.eo.ReportContentEntity;
|
||||||
import com.adc.da.report.service.IReportContentService;
|
import com.adc.da.report.service.IReportContentService;
|
||||||
import com.adc.da.report.dao.mysql.ReportContentDao;
|
import com.adc.da.report.dao.mysql.ReportContentDao;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
@@ -22,6 +26,9 @@ import javax.annotation.Resource;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Caihaohan
|
* @author Caihaohan
|
||||||
@@ -51,36 +58,70 @@ public class IReportContentServiceImpl extends ServiceImpl<ReportContentDao, Rep
|
|||||||
@Resource
|
@Resource
|
||||||
private FileDao fileDao;
|
private FileDao fileDao;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ReportFileDao reportFileDao;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void insertReportContent(String reportId, String fileId) throws IOException {
|
public void insertReportContent(String reportId) throws IOException {
|
||||||
//获取文件
|
LambdaQueryWrapper<ReportFile> reportFileLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
FileEntity fileEntity = fileDao.selectById(fileId);
|
reportFileLambdaQueryWrapper.eq(ReportFile::getReportId, reportId);
|
||||||
String path = uploadFile + fileEntity.getSavePath();
|
reportFileLambdaQueryWrapper.eq(ReportFile::getState, 2);
|
||||||
FileOutputStream outputStream = new FileOutputStream(path);
|
List<ReportFile> reportFiles = reportFileDao.selectList(reportFileLambdaQueryWrapper);
|
||||||
// 上传方式:阿里云:alioss 华为云:hwobs
|
List<String> fileIds = new ArrayList<>();
|
||||||
if ("hwobs".equals(uploadType)) {
|
if (CollectionUtils.isNotEmpty(reportFiles)) {
|
||||||
obsBootUtil.getFileFromOBS(fileEntity.getSavePath(), outputStream);
|
fileIds = reportFiles.stream().map(ReportFile::getFileId).collect(Collectors.toList());
|
||||||
} else if ("alioss".equals(uploadType)) {
|
}
|
||||||
ossClientUtil.getFileFromOSS(fileEntity.getSavePath(), outputStream);
|
StringBuilder content = new StringBuilder();
|
||||||
} else if ("local".equals(uploadType)) {
|
List<String> reportContentFileIdList = new ArrayList<>();
|
||||||
localFileUtil.getFileFromLocal(fileEntity.getSavePath(), outputStream);
|
for (String fileId : fileIds) {
|
||||||
|
//获取文件
|
||||||
|
FileEntity fileEntity = fileDao.selectById(fileId);
|
||||||
|
String path = uploadFile + fileEntity.getSavePath();
|
||||||
|
FileOutputStream outputStream = new FileOutputStream(path);
|
||||||
|
// 上传方式:阿里云:alioss 华为云:hwobs
|
||||||
|
if ("hwobs".equals(uploadType)) {
|
||||||
|
obsBootUtil.getFileFromOBS(fileEntity.getSavePath(), outputStream);
|
||||||
|
} else if ("alioss".equals(uploadType)) {
|
||||||
|
ossClientUtil.getFileFromOSS(fileEntity.getSavePath(), outputStream);
|
||||||
|
} else if ("local".equals(uploadType)) {
|
||||||
|
localFileUtil.getFileFromLocal(fileEntity.getSavePath(), outputStream);
|
||||||
|
}
|
||||||
|
File file = new File(path);
|
||||||
|
//解析出内容
|
||||||
|
try {
|
||||||
|
String fileContent = FileContentUtil.readFileContent(file);
|
||||||
|
content.append(fileContent);
|
||||||
|
reportContentFileIdList.add(fileId);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("抽取文件内容发生错误,请检查", e);
|
||||||
|
}
|
||||||
|
|
||||||
|
//将文件删除
|
||||||
|
outputStream.close();
|
||||||
|
FileUtil.deleteFile(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
String reportContentFileIds = "";
|
||||||
|
if (CollectionUtils.isNotEmpty(reportContentFileIdList)) {
|
||||||
|
reportContentFileIds = JSONUtil.toJsonStr(reportContentFileIdList);
|
||||||
}
|
}
|
||||||
File file = new File(path);
|
|
||||||
//解析出内容
|
|
||||||
String content = FileContentUtil.readFileContent(file);
|
|
||||||
//将内容存入
|
//将内容存入
|
||||||
ReportContentEntity reportContent = query().eq("report_id", reportId).one();
|
ReportContentEntity reportContent = query().eq("report_id", reportId).one();
|
||||||
if (reportContent == null) {
|
if (reportContent == null) {
|
||||||
ReportContentEntity reportContentEntity = new ReportContentEntity(UUID.randomUUID10(), reportId, content);
|
ReportContentEntity reportContentEntity = new ReportContentEntity(UUID.randomUUID10(), reportId, reportContentFileIds, content.toString());
|
||||||
save(reportContentEntity);
|
save(reportContentEntity);
|
||||||
} else {
|
} else {
|
||||||
reportContent.setReportContent(content);
|
reportContent.setReportContent(content.toString());
|
||||||
saveOrUpdate(reportContent);
|
saveOrUpdate(reportContent);
|
||||||
}
|
}
|
||||||
//将文件删除
|
}
|
||||||
outputStream.close();
|
|
||||||
FileUtil.deleteFile(path);
|
@Override
|
||||||
|
public void removeByReportId(String reportId) {
|
||||||
|
LambdaQueryWrapper<ReportContentEntity> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
lambdaQueryWrapper.eq(ReportContentEntity::getReportId, reportId);
|
||||||
|
remove(lambdaQueryWrapper);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+16
@@ -0,0 +1,16 @@
|
|||||||
|
package com.adc.da.report.service.impl;
|
||||||
|
|
||||||
|
import com.adc.da.report.dao.mysql.ReportFileDao;
|
||||||
|
import com.adc.da.report.eo.ReportFile;
|
||||||
|
import com.adc.da.report.service.IReportFileService;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class IReportFileServiceImpl extends ServiceImpl<ReportFileDao, ReportFile>
|
||||||
|
implements IReportFileService {
|
||||||
|
|
||||||
|
}
|
||||||
+72
@@ -8,6 +8,8 @@ import com.adc.da.report.service.IReportLogBookService;
|
|||||||
import com.adc.da.report.vo.DeleteParamRequestVO;
|
import com.adc.da.report.vo.DeleteParamRequestVO;
|
||||||
import com.adc.da.report.vo.ReportDetailThumbUpVo;
|
import com.adc.da.report.vo.ReportDetailThumbUpVo;
|
||||||
import com.adc.da.report.vo.ReportLogPageVO;
|
import com.adc.da.report.vo.ReportLogPageVO;
|
||||||
|
import com.adc.da.util.http.ResponseMessage;
|
||||||
|
import com.adc.da.util.http.Result;
|
||||||
import com.adc.da.util.utils.StringUtils;
|
import com.adc.da.util.utils.StringUtils;
|
||||||
import com.adc.da.util.utils.UUID;
|
import com.adc.da.util.utils.UUID;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
@@ -20,6 +22,7 @@ import org.springframework.util.ObjectUtils;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author bu
|
* @author bu
|
||||||
@@ -145,18 +148,35 @@ public class IReportLogBookServiceImpl extends ServiceImpl<ReportLogBookDao, Rep
|
|||||||
.eq("type", 1).count();
|
.eq("type", 1).count();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer getCollectCount(String reportId) {
|
||||||
|
return query().eq("report_id", reportId)
|
||||||
|
.eq("type", 4).count();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer getThumbUpCount(String reportId) {
|
public Integer getThumbUpCount(String reportId) {
|
||||||
return query().eq("report_id", reportId)
|
return query().eq("report_id", reportId)
|
||||||
.eq("type", 3).count();
|
.eq("type", 3).count();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ReportLogBook findCollectLog(String reportId) {
|
||||||
|
return query().eq("report_id", reportId)
|
||||||
|
.eq("user_id", UserUtils.getUserId())
|
||||||
|
.eq("type", 4).one();
|
||||||
|
}
|
||||||
|
|
||||||
private ReportLogBook findThumbUpLog(String reportId) {
|
private ReportLogBook findThumbUpLog(String reportId) {
|
||||||
return query().eq("report_id", reportId)
|
return query().eq("report_id", reportId)
|
||||||
.eq("user_id", UserUtils.getUserId())
|
.eq("user_id", UserUtils.getUserId())
|
||||||
.eq("type", 3).one();
|
.eq("type", 3).one();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 点赞
|
||||||
|
* @param reportId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
private String thumbUp(String reportId) {
|
private String thumbUp(String reportId) {
|
||||||
ReportLogBook reportLogBook = new ReportLogBook();
|
ReportLogBook reportLogBook = new ReportLogBook();
|
||||||
reportLogBook.setReportId(reportId)
|
reportLogBook.setReportId(reportId)
|
||||||
@@ -168,6 +188,10 @@ public class IReportLogBookServiceImpl extends ServiceImpl<ReportLogBookDao, Rep
|
|||||||
return reportLogBook.getId();
|
return reportLogBook.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取消点赞
|
||||||
|
* @param reportId
|
||||||
|
*/
|
||||||
private void thumbDown(String reportId) {
|
private void thumbDown(String reportId) {
|
||||||
LambdaQueryWrapper<ReportLogBook> reportLogBookLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<ReportLogBook> reportLogBookLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
reportLogBookLambdaQueryWrapper.eq(ReportLogBook::getReportId, reportId);
|
reportLogBookLambdaQueryWrapper.eq(ReportLogBook::getReportId, reportId);
|
||||||
@@ -176,6 +200,34 @@ public class IReportLogBookServiceImpl extends ServiceImpl<ReportLogBookDao, Rep
|
|||||||
remove(reportLogBookLambdaQueryWrapper);
|
remove(reportLogBookLambdaQueryWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 收藏
|
||||||
|
* @param reportId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private String collect(String reportId) {
|
||||||
|
ReportLogBook reportLogBook = new ReportLogBook();
|
||||||
|
reportLogBook.setReportId(reportId)
|
||||||
|
.setId(UUID.randomUUID10())
|
||||||
|
.setType(4)
|
||||||
|
.setUserId(UserUtils.getUserId())
|
||||||
|
.setUpdateTime(new Date());
|
||||||
|
save(reportLogBook);
|
||||||
|
return reportLogBook.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取消收藏
|
||||||
|
* @param reportId
|
||||||
|
*/
|
||||||
|
private void cancelCollect(String reportId) {
|
||||||
|
LambdaQueryWrapper<ReportLogBook> reportLogBookLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
reportLogBookLambdaQueryWrapper.eq(ReportLogBook::getReportId, reportId);
|
||||||
|
reportLogBookLambdaQueryWrapper.eq(ReportLogBook::getType, 4);
|
||||||
|
reportLogBookLambdaQueryWrapper.eq(ReportLogBook::getUserId, UserUtils.getUserId());
|
||||||
|
remove(reportLogBookLambdaQueryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ReportDetailThumbUpVo thumbUpOrDown(String reportId) {
|
public ReportDetailThumbUpVo thumbUpOrDown(String reportId) {
|
||||||
ReportLogBook entity = findThumbUpLog(reportId);
|
ReportLogBook entity = findThumbUpLog(reportId);
|
||||||
@@ -191,4 +243,24 @@ public class IReportLogBookServiceImpl extends ServiceImpl<ReportLogBookDao, Rep
|
|||||||
reportDetailThumbUpVo.setThumbUpCount(count);
|
reportDetailThumbUpVo.setThumbUpCount(count);
|
||||||
return reportDetailThumbUpVo;
|
return reportDetailThumbUpVo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResponseMessage collectOrCancelCollect(String reportId) {
|
||||||
|
ReportLogBook entity = findCollectLog(reportId);
|
||||||
|
if (entity == null) {
|
||||||
|
collect(reportId);
|
||||||
|
} else {
|
||||||
|
cancelCollect(reportId);
|
||||||
|
}
|
||||||
|
return Result.success("操作成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> getCollectReportIdByUser(String userId) {
|
||||||
|
LambdaQueryWrapper<ReportLogBook> collectWrapper = new LambdaQueryWrapper<>();
|
||||||
|
collectWrapper.eq(ReportLogBook::getType, 4);
|
||||||
|
collectWrapper.eq(ReportLogBook::getUserId, userId);
|
||||||
|
List<String> list = list(collectWrapper).stream().map(ReportLogBook::getReportId).collect(Collectors.toList());
|
||||||
|
return list;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+302
-91
@@ -1,25 +1,28 @@
|
|||||||
package com.adc.da.report.service.impl;
|
package com.adc.da.report.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import cn.hutool.json.JSONArray;
|
||||||
|
import cn.hutool.json.JSONUtil;
|
||||||
import com.adc.da.login.util.CommonUtils;
|
import com.adc.da.login.util.CommonUtils;
|
||||||
import com.adc.da.login.util.UserUtils;
|
import com.adc.da.login.util.UserUtils;
|
||||||
import com.adc.da.report.constant.ReportConstants;
|
import com.adc.da.report.constant.ReportConstants;
|
||||||
import com.adc.da.report.dao.mysql.FileDao;
|
import com.adc.da.report.dao.mysql.FileDao;
|
||||||
import com.adc.da.report.dao.mysql.ReportDao;
|
import com.adc.da.report.dao.mysql.ReportDao;
|
||||||
|
import com.adc.da.report.dao.mysql.ReportFileDao;
|
||||||
import com.adc.da.report.dao.mysql.ReportLabelDao;
|
import com.adc.da.report.dao.mysql.ReportLabelDao;
|
||||||
import com.adc.da.report.dao.mysql.ReportUserDao;
|
|
||||||
import com.adc.da.report.eo.*;
|
import com.adc.da.report.eo.*;
|
||||||
import com.adc.da.report.service.*;
|
import com.adc.da.report.service.*;
|
||||||
import com.adc.da.report.util.*;
|
import com.adc.da.report.util.*;
|
||||||
import com.adc.da.report.vo.ReportDetailVo;
|
import com.adc.da.report.vo.*;
|
||||||
import com.adc.da.report.vo.ReportQueryVo;
|
|
||||||
import com.adc.da.report.vo.ReportVo;
|
|
||||||
import com.adc.da.sys.dao.mysql.RoleEODao;
|
import com.adc.da.sys.dao.mysql.RoleEODao;
|
||||||
import com.adc.da.sys.dao.mysql.UserEODao;
|
import com.adc.da.sys.dao.mysql.UserEODao;
|
||||||
|
import com.adc.da.sys.entity.MenuEO;
|
||||||
import com.adc.da.sys.entity.OrgEO;
|
import com.adc.da.sys.entity.OrgEO;
|
||||||
import com.adc.da.sys.entity.RoleEO;
|
import com.adc.da.sys.entity.RoleEO;
|
||||||
import com.adc.da.sys.entity.UserEO;
|
import com.adc.da.sys.entity.UserEO;
|
||||||
|
import com.adc.da.sys.service.MenuEOService;
|
||||||
import com.adc.da.sys.service.OrgEOService;
|
import com.adc.da.sys.service.OrgEOService;
|
||||||
|
import com.adc.da.sys.util.BeanCopyUtils;
|
||||||
import com.adc.da.util.http.ResponseMessage;
|
import com.adc.da.util.http.ResponseMessage;
|
||||||
import com.adc.da.util.http.Result;
|
import com.adc.da.util.http.Result;
|
||||||
import com.adc.da.util.utils.CollectionUtils;
|
import com.adc.da.util.utils.CollectionUtils;
|
||||||
@@ -28,11 +31,12 @@ import com.adc.da.util.utils.StringUtils;
|
|||||||
import com.adc.da.util.utils.UUID;
|
import com.adc.da.util.utils.UUID;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.poi.poifs.filesystem.OfficeXmlFileException;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
@@ -41,6 +45,7 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -68,9 +73,6 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
|
|||||||
@Resource
|
@Resource
|
||||||
private ReportDao reportDao;
|
private ReportDao reportDao;
|
||||||
|
|
||||||
@Resource
|
|
||||||
private ReportUserDao reportUserDao;
|
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private ReportLabelDao reportLabelDao;
|
private ReportLabelDao reportLabelDao;
|
||||||
|
|
||||||
@@ -122,9 +124,18 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
|
|||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private OrgEOService orgEOService;
|
private OrgEOService orgEOService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private ILogService logService;
|
private ILogService logService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MenuEOService menuEOService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IReportFileService iReportFileService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ReportFileDao reportFileDao;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addOrUpdate(ReportEntity reportEntity) {
|
public void addOrUpdate(ReportEntity reportEntity) {
|
||||||
@@ -141,6 +152,17 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
|
|||||||
reportDao.insert(reportEntity);
|
reportDao.insert(reportEntity);
|
||||||
}
|
}
|
||||||
String reportId = reportEntity.getId();
|
String reportId = reportEntity.getId();
|
||||||
|
//文件
|
||||||
|
reportFileDao.delByReportId(new ReportFile(reportId,2));
|
||||||
|
List<ReportFile> reportFiles = new ArrayList<>();
|
||||||
|
for (ReportFile reportFile : reportEntity.getFileList()) {
|
||||||
|
reportFile.setId(UUID.randomUUID().replace("-",""));
|
||||||
|
reportFile.setReportId(reportId);
|
||||||
|
// reportFile.setFileId(s);
|
||||||
|
reportFile.setState(2);
|
||||||
|
reportFiles.add(reportFile);
|
||||||
|
}
|
||||||
|
iReportFileService.saveBatch(reportFiles);
|
||||||
//插入报表标签关系表
|
//插入报表标签关系表
|
||||||
//修改报表标签关系表(先删后增)
|
//修改报表标签关系表(先删后增)
|
||||||
iReportLabelService.deleteReportLabelByReportId(new String[]{reportId});
|
iReportLabelService.deleteReportLabelByReportId(new String[]{reportId});
|
||||||
@@ -150,19 +172,115 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
|
|||||||
for (List<String> list : reportEntity.getLabelList()) {
|
for (List<String> list : reportEntity.getLabelList()) {
|
||||||
String lastLabel = list.get(list.size() - 1);
|
String lastLabel = list.get(list.size() - 1);
|
||||||
ReportLabelEntity reportLabelEntity = new ReportLabelEntity(com.adc.da.util.utils.UUID.randomUUID10()
|
ReportLabelEntity reportLabelEntity = new ReportLabelEntity(com.adc.da.util.utils.UUID.randomUUID10()
|
||||||
,reportId, JSON.toJSONString(list),lastLabel);
|
,reportId, JSON.toJSONString(list),lastLabel,1);
|
||||||
labelList.add(reportLabelEntity);
|
labelList.add(reportLabelEntity);
|
||||||
}
|
}
|
||||||
iReportLabelService.saveBatch(labelList);
|
iReportLabelService.saveBatch(labelList);
|
||||||
//插入报表内容表
|
}
|
||||||
try {
|
//修改报表内容表(先删后增)
|
||||||
iReportContentService.insertReportContent(reportId, reportEntity.getFileId());
|
iReportContentService.removeByReportId(reportId);
|
||||||
log.info("抽取报告内容");
|
try {
|
||||||
} catch (IOException e) {
|
iReportContentService.insertReportContent(reportId);
|
||||||
log.error("获取报告内容失败", e);
|
log.info("抽取报告内容");
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.error("获取报告内容失败", e);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResponseMessage changeUploader(ChangeUploaderVo changeUploaderVo) {
|
||||||
|
//判断当前登陆人是否有权限更改上传人
|
||||||
|
if (!this.isAllowChangeUploader(UserUtils.getUserId())) {
|
||||||
|
return Result.error("无权限更改上传人");
|
||||||
|
}
|
||||||
|
//更改上传人
|
||||||
|
LambdaUpdateWrapper<ReportEntity> wrapper = new LambdaUpdateWrapper<>();
|
||||||
|
wrapper.in(ReportEntity::getId, changeUploaderVo.getReportIds());
|
||||||
|
wrapper.set(ReportEntity::getCreateUserId, changeUploaderVo.getUserId());
|
||||||
|
update(wrapper);
|
||||||
|
return Result.success("修改成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void delFile(ReportFile reportFile) {
|
||||||
|
reportFileDao.deleteBatchIds(reportFile.getRfIdList());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IPage<ReportFile> filePage(ReportFilePageVO reportFilePageVO) {
|
||||||
|
IPage<ReportFilePageVO> page = new Page<>();
|
||||||
|
page.setCurrent(reportFilePageVO.getCurrent());
|
||||||
|
page.setSize(reportFilePageVO.getSize());
|
||||||
|
|
||||||
|
return reportFileDao.filePage(page,reportFilePageVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResponseMessage refreshReportContent() {
|
||||||
|
//找出所有能生成内容的报告id
|
||||||
|
LambdaQueryWrapper<ReportFile> reportFileLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
|
||||||
|
//只找不在流程中的报告
|
||||||
|
reportFileLambdaQueryWrapper.ne(ReportFile::getState, 1);
|
||||||
|
List<ReportFile> reportFileList = iReportFileService.list(reportFileLambdaQueryWrapper);
|
||||||
|
//所有报告的id
|
||||||
|
Set<String> allReportIdSet = reportFileList.stream().map(ReportFile::getReportId).collect(Collectors.toSet());
|
||||||
|
//所有文件的id
|
||||||
|
Set<String> allFileIdSet = reportFileList.stream().map(ReportFile::getFileId).collect(Collectors.toSet());
|
||||||
|
|
||||||
|
List<ReportContentEntity> reportContentList = iReportContentService.list();
|
||||||
|
//找出已经生成过的报告id
|
||||||
|
Set<String> generatedReportIdSet = reportContentList.stream().map(ReportContentEntity::getReportId).collect(Collectors.toSet());
|
||||||
|
//找出已经生成过的报告的fileId
|
||||||
|
List<String> generatedFileIds = reportContentList.stream().map(ReportContentEntity::getFileIds).collect(Collectors.toList());
|
||||||
|
Set<String> generatedFileIdSet = new HashSet<>();
|
||||||
|
for (String fileIds : generatedFileIds) {
|
||||||
|
// 将JSONArray转换为List
|
||||||
|
// 解析JSON字符串为JSONArray
|
||||||
|
if (StrUtil.isNotBlank(fileIds)) {
|
||||||
|
JSONArray jsonArray = JSONUtil.parseArray(fileIds);
|
||||||
|
List<String> fileIdList = jsonArray.toList(String.class);
|
||||||
|
generatedFileIdSet.addAll(fileIdList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//获取缺失的文件id
|
||||||
|
allFileIdSet.removeAll(generatedFileIdSet);
|
||||||
|
allReportIdSet.removeAll(generatedReportIdSet);
|
||||||
|
|
||||||
|
//需要生成的文件的数量
|
||||||
|
int needGenerateFileCount = allFileIdSet.size();
|
||||||
|
int needGenerateReportCount = allReportIdSet.size();
|
||||||
|
log.info("发现缺少" + needGenerateFileCount + "个文件的内容");
|
||||||
|
log.info("有" + needGenerateReportCount + "个报告需要重新生成");
|
||||||
|
//实际生成的数量
|
||||||
|
int count = 0;
|
||||||
|
List<String> failGenerateReportId = new ArrayList<>();
|
||||||
|
//生成报告内容
|
||||||
|
for (String reportId : allReportIdSet) {
|
||||||
|
//修改报表内容表(先删后增)
|
||||||
|
iReportContentService.removeByReportId(reportId);
|
||||||
|
try {
|
||||||
|
log.info("抽取reportId为{}报告内容", reportId);
|
||||||
|
iReportContentService.insertReportContent(reportId);
|
||||||
|
count++;
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.error("获取reportId为{}的报告内容失败", reportId);
|
||||||
|
failGenerateReportId.add(reportId);
|
||||||
|
log.error(String.valueOf(e));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
log.info("实际生成" + count + "条报告的内容");
|
||||||
|
if (needGenerateReportCount == count) {
|
||||||
|
if (needGenerateReportCount == 0) {
|
||||||
|
return Result.success("未发现缺失报告内容,无需生成");
|
||||||
|
}
|
||||||
|
return Result.success("成功,全部生成完毕,共" + count + "条");
|
||||||
|
} else {
|
||||||
|
int missing = needGenerateReportCount - count;
|
||||||
|
return Result.success("失败," + missing + "条报告的内容生成失败,请检查其是否有空文件或其余问题,失败的报告id为" + failGenerateReportId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -174,6 +292,7 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
@Deprecated
|
||||||
public String insert(ReportEntity entity, List<String> labelList,
|
public String insert(ReportEntity entity, List<String> labelList,
|
||||||
List<String> reportPreviewUserIdList,
|
List<String> reportPreviewUserIdList,
|
||||||
List<String> reportPreviewAndDownloadUserIdList) throws IOException {
|
List<String> reportPreviewAndDownloadUserIdList) throws IOException {
|
||||||
@@ -236,22 +355,21 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
|
|||||||
});
|
});
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
entity.setUpdateDate(format.format(new Date()));
|
// entity.setUpdateDate(format.format(new Date()));
|
||||||
reportDao.updateById(entity);
|
// reportDao.updateById(entity);
|
||||||
reportUserDao.delete(new QueryWrapper<ReportUserEntity>()
|
// reportUserDao.delete(new QueryWrapper<ReportUserEntity>()
|
||||||
.eq("reportId", entity.getId()));
|
// .eq("reportId", entity.getId()));
|
||||||
|
|
||||||
//修改报表标签关系表(先删后增)
|
//修改报表标签关系表(先删后增)
|
||||||
iReportLabelService.deleteReportLabelByReportId(new String[]{entity.getId()});
|
iReportLabelService.deleteReportLabelByReportId(new String[]{entity.getId()});
|
||||||
|
|
||||||
//插入报表标签关系表
|
//插入报表标签关系表
|
||||||
labelList.forEach((label) -> {
|
labelList.forEach((label) -> {
|
||||||
ReportLabelEntity reportLabelEntity = new ReportLabelEntity(UUID.randomUUID10(), entity.getId(), label);
|
ReportLabelEntity reportLabelEntity = new ReportLabelEntity(UUID.randomUUID10(), entity.getId(),
|
||||||
|
label,2);
|
||||||
reportLabelDao.insert(reportLabelEntity);
|
reportLabelDao.insert(reportLabelEntity);
|
||||||
});
|
});
|
||||||
|
|
||||||
//TODO 插入报表内容表(先删后增)
|
|
||||||
|
|
||||||
//删除power_apply表中的对应权限
|
//删除power_apply表中的对应权限
|
||||||
iPowerApplyService.deleteByReportId(entity.getId());
|
iPowerApplyService.deleteByReportId(entity.getId());
|
||||||
|
|
||||||
@@ -360,6 +478,10 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
|
|||||||
LambdaQueryWrapper<ReportContentEntity> wrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<ReportContentEntity> wrapper = new LambdaQueryWrapper<>();
|
||||||
wrapper.in(ReportContentEntity::getReportId, idList);
|
wrapper.in(ReportContentEntity::getReportId, idList);
|
||||||
iReportContentService.remove(wrapper);
|
iReportContentService.remove(wrapper);
|
||||||
|
//删除文件关联
|
||||||
|
LambdaQueryWrapper<ReportFile> reportFileLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
reportFileLambdaQueryWrapper.in(ReportFile::getReportId, idList);
|
||||||
|
iReportFileService.remove(reportFileLambdaQueryWrapper);
|
||||||
return nameList;
|
return nameList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -383,18 +505,18 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
|
|||||||
/**
|
/**
|
||||||
* 报告html
|
* 报告html
|
||||||
*
|
*
|
||||||
* @param id
|
* @param reportId
|
||||||
|
* @param fileId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String reportHtml(String id) {
|
public String reportHtml(String reportId, String fileId) {
|
||||||
try {
|
try {
|
||||||
ReportEntity entity = reportDao.selectById(id);
|
String key = reportId + "-" + fileId;
|
||||||
String key = entity.getId() + "-" + entity.getFileId();
|
|
||||||
String html = stringRedisTemplate.boundValueOps(key).get();
|
String html = stringRedisTemplate.boundValueOps(key).get();
|
||||||
//没有的话就生成
|
//没有的话就生成
|
||||||
if (StrUtil.isBlank(html)) {
|
if (StrUtil.isBlank(html)) {
|
||||||
html = createHtmlString(entity.getFileId());
|
html = createHtmlString(fileId);
|
||||||
|
|
||||||
log.info("执行完成html" + html);
|
log.info("执行完成html" + html);
|
||||||
|
|
||||||
@@ -511,39 +633,93 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
list.getRecords().forEach(c -> {
|
@Override
|
||||||
FileEntity fileEntity = Optional.ofNullable(fileDao.selectById(c.getFileId())).orElse(new FileEntity());
|
public IPage<ReportVo> myCollectPage(ReportQueryVo vo) {
|
||||||
if (StringUtils.isEmpty(fileEntity.getFileType())) {
|
IPage<ReportEntity> page = new Page<>();
|
||||||
c.setFileType(null);
|
page.setCurrent(vo.getPageNo());
|
||||||
}
|
page.setSize(vo.getPageSize());
|
||||||
//ppt文件
|
|
||||||
else if (ReportConstants.FILE_EXTENSIONS_PPT.equalsIgnoreCase(fileEntity.getFileType()) ||
|
|
||||||
ReportConstants.FILE_EXTENSIONS_PPTX.equalsIgnoreCase(fileEntity.getFileType())) {
|
|
||||||
c.setFileType("1");
|
|
||||||
}
|
|
||||||
//excel文件
|
|
||||||
else if (ReportConstants.FILE_EXTENSIONS_XLS.equalsIgnoreCase(fileEntity.getFileType()) ||
|
|
||||||
ReportConstants.FILE_EXTENSIONS_XLSX.equalsIgnoreCase(fileEntity.getFileType())) {
|
|
||||||
c.setFileType("2");
|
|
||||||
}
|
|
||||||
//pdf文件
|
|
||||||
else if (ReportConstants.FILE_EXTENSIONS_PDF.equalsIgnoreCase(fileEntity.getFileType())) {
|
|
||||||
c.setFileType("3");
|
|
||||||
}
|
|
||||||
//word文件
|
|
||||||
else {
|
|
||||||
c.setFileType("4");
|
|
||||||
}
|
|
||||||
|
|
||||||
//文件大小
|
//按照labelId筛选
|
||||||
c.setFileSize(StringUtils.isNotEmpty(fileEntity.getFileSize())
|
Set<String> idSet = new HashSet<>();
|
||||||
? String.valueOf(Integer.parseInt(fileEntity.getFileSize()) / 1024) + "kb" : "0kb");
|
if (CollectionUtils.isNotEmpty(vo.getLabelId())) {
|
||||||
c.setFileName(fileEntity.getFileName());
|
LambdaQueryWrapper<ReportLabelEntity> reportLabelEntityWrapper = new LambdaQueryWrapper<>();
|
||||||
List<String> userIdList = reportUserDao.selectList(
|
reportLabelEntityWrapper.in(ReportLabelEntity::getLastLabel, vo.getLabelId());
|
||||||
new QueryWrapper<ReportUserEntity>().eq("reportId", c.getId()))
|
List<ReportLabelEntity> reportLabelEntities = reportLabelDao.selectList(reportLabelEntityWrapper);
|
||||||
.stream().map(ReportUserEntity::getUserId).collect(Collectors.toList());
|
reportLabelEntities.forEach(reportLabelEntity -> {
|
||||||
});
|
idSet.add(reportLabelEntity.getReportId());
|
||||||
|
});
|
||||||
|
if (CollectionUtils.isEmpty(idSet)) {
|
||||||
|
idSet.add("默认搜索条件");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//找到当前用户收藏的reportId
|
||||||
|
List<String> collectReportIds = reportLogBookService.getCollectReportIdByUser(UserUtils.getUserId());
|
||||||
|
if (CollectionUtils.isEmpty(collectReportIds)) {
|
||||||
|
collectReportIds.add("默认搜索条件");
|
||||||
|
}
|
||||||
|
|
||||||
|
vo.setUsid(UserUtils.getUserId());
|
||||||
|
IPage<ReportVo> list = reportDao.myCollectPage(page, vo, idSet, collectReportIds);
|
||||||
|
|
||||||
|
//设置权限
|
||||||
|
UserEO userEo = userEODao.selectById(UserUtils.getUserId());
|
||||||
|
String levelId = StringUtils.isEmpty(userEo.getLevelId()) ? "0.8" : userEo.getLevelId();
|
||||||
|
String employeeTypeId = StringUtils.isEmpty(userEo.getEmployeeTypeId()) ? "0.8" : userEo.getEmployeeTypeId();
|
||||||
|
//用户级别
|
||||||
|
double level = Double.parseDouble(levelId);
|
||||||
|
double employeeType = Double.parseDouble(employeeTypeId);
|
||||||
|
//总监拥有全部报告的预览和下载权力
|
||||||
|
if ((level == SPECIAL_LEVEL_ONE || level == SPECIAL_LEVEL_TWO ||
|
||||||
|
level == SPECIAL_LEVEL_THREE || level == SPECIAL_LEVEL_FOUL) &&
|
||||||
|
(employeeType == EMPLOYEE_TYPE_ID_ONE)) {
|
||||||
|
list.getRecords().forEach(reportVo -> {
|
||||||
|
reportVo.setPower(PREVIEW_DOWNLOAD);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
//其余员工
|
||||||
|
//用户自己申请的权限
|
||||||
|
List<Integer> powerList = new ArrayList<>();
|
||||||
|
powerList.add(PREVIEW_DOWNLOAD);
|
||||||
|
powerList.add(PREVIEW);
|
||||||
|
powerList.add(DOWNLOAD);
|
||||||
|
LambdaQueryWrapper<PowerApply> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.in(CollectionUtils.isNotEmpty(list.getRecords()) ,PowerApply::getReportId, list.getRecords().stream().map(ReportVo::getId).collect(Collectors.toList()));
|
||||||
|
wrapper.in(PowerApply::getPower, powerList);
|
||||||
|
wrapper.eq(PowerApply::getUserId, UserUtils.getUserId());
|
||||||
|
wrapper.eq(PowerApply::getDelFlag, 0);
|
||||||
|
List<PowerApply> powerApplyList = iPowerApplyService.list(wrapper).stream().distinct().collect(Collectors.toList());
|
||||||
|
|
||||||
|
Map<String, List<PowerApply>> reportPowerMap = powerApplyList.stream()
|
||||||
|
.collect(Collectors.groupingBy(PowerApply::getReportId));
|
||||||
|
|
||||||
|
//设置权限
|
||||||
|
list.getRecords().forEach(reportVo -> {
|
||||||
|
//无权限要求的报告自带预览权限
|
||||||
|
if (reportVo.getConfidentialLevel().equals(PUBLIC_REPORT) &&
|
||||||
|
reportVo.getPrivacyLevel().equals(NO_USER_PRIVACY_INVOLVED)) {
|
||||||
|
reportVo.setPower(PREVIEW);
|
||||||
|
} else {
|
||||||
|
reportVo.setPower(NONE);
|
||||||
|
}
|
||||||
|
List<PowerApply> powerApplies = reportPowerMap.get(reportVo.getId());
|
||||||
|
if (powerApplies != null) {
|
||||||
|
//只有当PA表只有一条申请的权限且并不是公开表的时候才给权限
|
||||||
|
if (powerApplies.size() == 1 && reportVo.getPower().equals(NONE)) {
|
||||||
|
reportVo.setPower(powerApplies.get(0).getPower());
|
||||||
|
} else {
|
||||||
|
reportVo.setPower(PREVIEW_DOWNLOAD);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//如果上传人是自己也有预览下载权限
|
||||||
|
if (UserUtils.getUserId().equals(reportVo.getCreateUserId())) {
|
||||||
|
reportVo.setPower(PREVIEW_DOWNLOAD);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -595,41 +771,53 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
list.getRecords().forEach(c -> {
|
// list.getRecords().forEach(c -> {
|
||||||
FileEntity fileEntity = Optional.ofNullable(fileDao.selectById(c.getFileId())).orElse(new FileEntity());
|
// FileEntity fileEntity = Optional.ofNullable(fileDao.selectById(c.getFileId())).orElse(new FileEntity());
|
||||||
if (StringUtils.isEmpty(fileEntity.getFileType())) {
|
// if (StringUtils.isEmpty(fileEntity.getFileType())) {
|
||||||
c.setFileType(null);
|
// c.setFileType(null);
|
||||||
}
|
// }
|
||||||
//ppt文件
|
// //ppt文件
|
||||||
else if (ReportConstants.FILE_EXTENSIONS_PPT.equalsIgnoreCase(fileEntity.getFileType()) ||
|
// else if (ReportConstants.FILE_EXTENSIONS_PPT.equalsIgnoreCase(fileEntity.getFileType()) ||
|
||||||
ReportConstants.FILE_EXTENSIONS_PPTX.equalsIgnoreCase(fileEntity.getFileType())) {
|
// ReportConstants.FILE_EXTENSIONS_PPTX.equalsIgnoreCase(fileEntity.getFileType())) {
|
||||||
c.setFileType("1");
|
// c.setFileType("1");
|
||||||
}
|
// }
|
||||||
//excel文件
|
// //excel文件
|
||||||
else if (ReportConstants.FILE_EXTENSIONS_XLS.equalsIgnoreCase(fileEntity.getFileType()) ||
|
// else if (ReportConstants.FILE_EXTENSIONS_XLS.equalsIgnoreCase(fileEntity.getFileType()) ||
|
||||||
ReportConstants.FILE_EXTENSIONS_XLSX.equalsIgnoreCase(fileEntity.getFileType())) {
|
// ReportConstants.FILE_EXTENSIONS_XLSX.equalsIgnoreCase(fileEntity.getFileType())) {
|
||||||
c.setFileType("2");
|
// c.setFileType("2");
|
||||||
}
|
// }
|
||||||
//pdf文件
|
// //pdf文件
|
||||||
else if (ReportConstants.FILE_EXTENSIONS_PDF.equalsIgnoreCase(fileEntity.getFileType())) {
|
// else if (ReportConstants.FILE_EXTENSIONS_PDF.equalsIgnoreCase(fileEntity.getFileType())) {
|
||||||
c.setFileType("3");
|
// c.setFileType("3");
|
||||||
}
|
// }
|
||||||
//word文件
|
// //word文件
|
||||||
else {
|
// else {
|
||||||
c.setFileType("4");
|
// c.setFileType("4");
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
//文件大小
|
// //文件大小
|
||||||
c.setFileSize(StringUtils.isNotEmpty(fileEntity.getFileSize())
|
// c.setFileSize(StringUtils.isNotEmpty(fileEntity.getFileSize())
|
||||||
? String.valueOf(Integer.parseInt(fileEntity.getFileSize()) / 1024) + "kb" : "0kb");
|
// ? String.valueOf(Integer.parseInt(fileEntity.getFileSize()) / 1024) + "kb" : "0kb");
|
||||||
c.setFileName(fileEntity.getFileName());
|
// c.setFileName(fileEntity.getFileName());
|
||||||
List<String> userIdList = reportUserDao.selectList(
|
// 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());
|
// .stream().map(ReportUserEntity::getUserId).collect(Collectors.toList());
|
||||||
});
|
// });
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean isAllowChangeUploader(String userId) {
|
||||||
|
//找出对应的权限id
|
||||||
|
List<MenuEO> menuEOS = menuEOService.listMenuEOByUserId(userId);
|
||||||
|
for (MenuEO menuEO : menuEOS) {
|
||||||
|
if ("修改上传人".equals(menuEO.getName())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean isAllowDownload(String userId, String reportId) {
|
public Boolean isAllowDownload(String userId, String reportId) {
|
||||||
//校验权限
|
//校验权限
|
||||||
@@ -687,6 +875,22 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
|
|||||||
@Override
|
@Override
|
||||||
public ResponseMessage reportDetail(String reportId) {
|
public ResponseMessage reportDetail(String reportId) {
|
||||||
ReportDetailVo reportDetailVo = reportDao.reportDetail(reportId);
|
ReportDetailVo reportDetailVo = reportDao.reportDetail(reportId);
|
||||||
|
//设置文件信息
|
||||||
|
LambdaQueryWrapper<ReportFile> reportFileLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
reportFileLambdaQueryWrapper.eq(ReportFile::getReportId, reportDetailVo.getId());
|
||||||
|
reportFileLambdaQueryWrapper.eq(ReportFile::getState, ReportConstants.NOT_IN_PROCESS);
|
||||||
|
List<ReportFile> reportFiles = reportFileDao.selectList(reportFileLambdaQueryWrapper);
|
||||||
|
List<String> fileIds = new ArrayList<>();
|
||||||
|
if (reportFiles != null) {
|
||||||
|
fileIds = reportFiles.stream().map(ReportFile::getFileId).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CollectionUtils.isNotEmpty(fileIds)) {
|
||||||
|
List<FileEntity> fileEntities = fileDao.selectBatchIds(fileIds);
|
||||||
|
List<ReportFile> fileVos = BeanCopyUtils.copyBeanList(fileEntities, ReportFile.class);
|
||||||
|
reportDetailVo.setFileList(fileVos);
|
||||||
|
}
|
||||||
|
|
||||||
//设置部门名称
|
//设置部门名称
|
||||||
String department = reportDetailVo.getDepartment();
|
String department = reportDetailVo.getDepartment();
|
||||||
if (StrUtil.isNotBlank(department)) {
|
if (StrUtil.isNotBlank(department)) {
|
||||||
@@ -701,6 +905,7 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
|
|||||||
//设置标签列表
|
//设置标签列表
|
||||||
LambdaQueryWrapper<ReportLabelEntity> wrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<ReportLabelEntity> wrapper = new LambdaQueryWrapper<>();
|
||||||
wrapper.eq(ReportLabelEntity::getReportId, reportId);
|
wrapper.eq(ReportLabelEntity::getReportId, reportId);
|
||||||
|
wrapper.eq(ReportLabelEntity::getState, 2);
|
||||||
List<ReportLabelEntity> reportLabelEntities = reportLabelDao.selectList(wrapper);
|
List<ReportLabelEntity> reportLabelEntities = reportLabelDao.selectList(wrapper);
|
||||||
if (CollectionUtils.isNotEmpty(reportLabelEntities)) {
|
if (CollectionUtils.isNotEmpty(reportLabelEntities)) {
|
||||||
List<String> reportLabelIds = reportLabelEntities.stream().map(ReportLabelEntity::getLabelId).collect(Collectors.toList());
|
List<String> reportLabelIds = reportLabelEntities.stream().map(ReportLabelEntity::getLabelId).collect(Collectors.toList());
|
||||||
@@ -766,7 +971,13 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
|
|||||||
} else if (ReportConstants.FILE_EXTENSIONS_DOCX.equalsIgnoreCase(fileEntity.getFileType())) {
|
} else if (ReportConstants.FILE_EXTENSIONS_DOCX.equalsIgnoreCase(fileEntity.getFileType())) {
|
||||||
html = WordUtil.doc2pdf(new FileInputStream(path), uploadFile, ipAddress);
|
html = WordUtil.doc2pdf(new FileInputStream(path), uploadFile, ipAddress);
|
||||||
} else if (ReportConstants.FILE_EXTENSIONS_PPT.equalsIgnoreCase(fileEntity.getFileType())) {
|
} else if (ReportConstants.FILE_EXTENSIONS_PPT.equalsIgnoreCase(fileEntity.getFileType())) {
|
||||||
html = PptUtil.doPpt2003toImage(new FileInputStream(path), uploadFile, ipAddress);
|
try {
|
||||||
|
html = PptUtil.doPpt2003toImage(new FileInputStream(path), uploadFile, ipAddress);
|
||||||
|
} catch (OfficeXmlFileException e) {
|
||||||
|
String newPath = path + "x";
|
||||||
|
cn.hutool.core.io.FileUtil.rename(new File(path), newPath, false, false);
|
||||||
|
html = PptUtil.doPpt2007toImage(new FileInputStream(newPath), uploadFile, ipAddress);
|
||||||
|
}
|
||||||
} else if (ReportConstants.FILE_EXTENSIONS_PPTX.equalsIgnoreCase(fileEntity.getFileType())) {
|
} else if (ReportConstants.FILE_EXTENSIONS_PPTX.equalsIgnoreCase(fileEntity.getFileType())) {
|
||||||
html = PptUtil.doPpt2007toImage(new FileInputStream(path), uploadFile, ipAddress);
|
html = PptUtil.doPpt2007toImage(new FileInputStream(path), uploadFile, ipAddress);
|
||||||
} else if (ReportConstants.FILE_EXTENSIONS_PDF.equalsIgnoreCase(fileEntity.getFileType())) {
|
} else if (ReportConstants.FILE_EXTENSIONS_PDF.equalsIgnoreCase(fileEntity.getFileType())) {
|
||||||
|
|||||||
+20
-5
@@ -3,14 +3,13 @@ package com.adc.da.report.service.impl;
|
|||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import com.adc.da.login.util.UserUtils;
|
import com.adc.da.login.util.UserUtils;
|
||||||
import com.adc.da.report.dao.mysql.PowerApplyDao;
|
import com.adc.da.report.dao.mysql.*;
|
||||||
import com.adc.da.report.dao.mysql.ReportDao;
|
|
||||||
import com.adc.da.report.dao.mysql.TtReportManageActDao;
|
|
||||||
import com.adc.da.report.eo.LogEntity;
|
import com.adc.da.report.eo.LogEntity;
|
||||||
import com.adc.da.report.eo.ReportEntity;
|
import com.adc.da.report.eo.ReportEntity;
|
||||||
import com.adc.da.report.eo.TtReportManageAct;
|
import com.adc.da.report.eo.TtReportManageAct;
|
||||||
import com.adc.da.report.service.ILogService;
|
import com.adc.da.report.service.ILogService;
|
||||||
import com.adc.da.report.service.IReportContentService;
|
import com.adc.da.report.service.IReportContentService;
|
||||||
|
import com.adc.da.report.service.IReportFileService;
|
||||||
import com.adc.da.report.service.ITtReportManageActService;
|
import com.adc.da.report.service.ITtReportManageActService;
|
||||||
import com.adc.da.report.vo.DeleteParamRequestVO;
|
import com.adc.da.report.vo.DeleteParamRequestVO;
|
||||||
import com.adc.da.report.vo.TtReportManageActPageVO;
|
import com.adc.da.report.vo.TtReportManageActPageVO;
|
||||||
@@ -51,7 +50,14 @@ public class ITtReportManageActServiceImpl extends ServiceImpl<TtReportManageAct
|
|||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private IReportContentService iReportContentService;
|
private IReportContentService iReportContentService;
|
||||||
|
@Autowired
|
||||||
|
private IReportFileService iReportFileService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ReportFileDao reportFileDao;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ReportLabelDao reportLabelDao;
|
||||||
/**
|
/**
|
||||||
* @param ttReportManageActPageVO
|
* @param ttReportManageActPageVO
|
||||||
* @return <com.adc.da.report.entity.TtReportManageAct>
|
* @return <com.adc.da.report.entity.TtReportManageAct>
|
||||||
@@ -150,10 +156,19 @@ public class ITtReportManageActServiceImpl extends ServiceImpl<TtReportManageAct
|
|||||||
reportEntity1.setCreateDate(sdf.format(ttReportManageAct.getCreateDate()));
|
reportEntity1.setCreateDate(sdf.format(ttReportManageAct.getCreateDate()));
|
||||||
reportEntity1.setUpdateDate(sdf.format(ttReportManageAct.getUpdateDate()));
|
reportEntity1.setUpdateDate(sdf.format(ttReportManageAct.getUpdateDate()));
|
||||||
reportDao.updateById(reportEntity1);
|
reportDao.updateById(reportEntity1);
|
||||||
reportLog(reportEntity.getName(),"修改");
|
reportLog(reportEntity.getName(),"编辑");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 文件
|
||||||
|
reportFileDao.actEndDelReport(ttReportManageAct.getDataId());
|
||||||
|
reportFileDao.updateState(ttReportManageAct.getDataId());
|
||||||
|
//标签
|
||||||
|
reportLabelDao.actEndDelReport(ttReportManageAct.getDataId());
|
||||||
|
reportLabelDao.updateState(ttReportManageAct.getDataId());
|
||||||
|
//修改报表内容表(先删后增)
|
||||||
|
iReportContentService.removeByReportId(ttReportManageAct.getDataId());
|
||||||
try {
|
try {
|
||||||
iReportContentService.insertReportContent(ttReportManageAct.getDataId(), ttReportManageAct.getFileId());
|
iReportContentService.insertReportContent(ttReportManageAct.getDataId());
|
||||||
log.info("抽取报告内容");
|
log.info("抽取报告内容");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error("获取报告内容失败", e);
|
log.error("获取报告内容失败", e);
|
||||||
|
|||||||
+22
@@ -0,0 +1,22 @@
|
|||||||
|
package com.adc.da.report.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.adc.da.report.eo.UserMessageEntity;
|
||||||
|
import com.adc.da.report.service.IUserMessageService;
|
||||||
|
import com.adc.da.report.dao.mysql.UserMessageDao;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author ThinkBook
|
||||||
|
* @description 针对表【ts_user_message】的数据库操作Service实现
|
||||||
|
* @createDate 2023-05-23 11:30:04
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class IUserMessageServiceImpl extends ServiceImpl<UserMessageDao, UserMessageEntity>
|
||||||
|
implements IUserMessageService {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -3,13 +3,16 @@ package com.adc.da.report.util;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.nio.charset.CharsetEncoder;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|
||||||
import com.adc.da.report.constant.ReportConstants;
|
import com.adc.da.report.constant.ReportConstants;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.poi.hslf.usermodel.HSLFShape;
|
import org.apache.poi.hslf.usermodel.HSLFShape;
|
||||||
import org.apache.poi.hslf.usermodel.HSLFSlide;
|
import org.apache.poi.hslf.usermodel.HSLFSlide;
|
||||||
import org.apache.poi.hslf.usermodel.HSLFTextShape;
|
import org.apache.poi.hslf.usermodel.HSLFTextShape;
|
||||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||||
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
import org.apache.poi.openxml4j.exceptions.NotOfficeXmlFileException;
|
||||||
import org.apache.poi.ss.usermodel.Cell;
|
import org.apache.poi.ss.usermodel.Cell;
|
||||||
import org.apache.poi.ss.usermodel.Row;
|
import org.apache.poi.ss.usermodel.Row;
|
||||||
import org.apache.poi.xslf.usermodel.XMLSlideShow;
|
import org.apache.poi.xslf.usermodel.XMLSlideShow;
|
||||||
@@ -22,7 +25,6 @@ import org.apache.poi.hwpf.extractor.WordExtractor;
|
|||||||
import org.apache.poi.xwpf.usermodel.XWPFDocument;
|
import org.apache.poi.xwpf.usermodel.XWPFDocument;
|
||||||
import org.apache.poi.xwpf.extractor.XWPFWordExtractor;
|
import org.apache.poi.xwpf.extractor.XWPFWordExtractor;
|
||||||
import org.apache.poi.hslf.usermodel.HSLFSlideShow;
|
import org.apache.poi.hslf.usermodel.HSLFSlideShow;
|
||||||
import org.apache.poi.hslf.extractor.PowerPointExtractor;
|
|
||||||
import org.apache.pdfbox.pdmodel.PDDocument;
|
import org.apache.pdfbox.pdmodel.PDDocument;
|
||||||
import org.apache.pdfbox.text.PDFTextStripper;
|
import org.apache.pdfbox.text.PDFTextStripper;
|
||||||
|
|
||||||
@@ -31,6 +33,7 @@ import org.apache.pdfbox.text.PDFTextStripper;
|
|||||||
*
|
*
|
||||||
* @author caihaohan
|
* @author caihaohan
|
||||||
*/
|
*/
|
||||||
|
@Slf4j
|
||||||
public class FileContentUtil {
|
public class FileContentUtil {
|
||||||
|
|
||||||
public static String readFileContent(File file) throws IOException {
|
public static String readFileContent(File file) throws IOException {
|
||||||
@@ -39,58 +42,73 @@ public class FileContentUtil {
|
|||||||
StringBuilder content = new StringBuilder();
|
StringBuilder content = new StringBuilder();
|
||||||
|
|
||||||
FileInputStream fis = new FileInputStream(file);
|
FileInputStream fis = new FileInputStream(file);
|
||||||
|
try {
|
||||||
switch (fileExtension) {
|
switch (fileExtension) {
|
||||||
case ReportConstants.FILE_EXTENSIONS_XLS:
|
case ReportConstants.FILE_EXTENSIONS_XLS:
|
||||||
HSSFWorkbook workbookXls = new HSSFWorkbook(fis);
|
HSSFWorkbook workbookXls = new HSSFWorkbook(fis);
|
||||||
content = new StringBuilder(readExcelContent(workbookXls));
|
content = new StringBuilder(readExcelContent(workbookXls));
|
||||||
break;
|
break;
|
||||||
case ReportConstants.FILE_EXTENSIONS_XLSX:
|
case ReportConstants.FILE_EXTENSIONS_XLSX:
|
||||||
XSSFWorkbook workbookXlsx = new XSSFWorkbook(fis);
|
XSSFWorkbook workbookXlsx = new XSSFWorkbook(fis);
|
||||||
content = new StringBuilder(readExcelContent(workbookXlsx));
|
content = new StringBuilder(readExcelContent(workbookXlsx));
|
||||||
break;
|
break;
|
||||||
case ReportConstants.FILE_EXTENSIONS_DOC:
|
case ReportConstants.FILE_EXTENSIONS_DOC:
|
||||||
HWPFDocument documentDoc = new HWPFDocument(fis);
|
HWPFDocument documentDoc = new HWPFDocument(fis);
|
||||||
WordExtractor extractorDoc = new WordExtractor(documentDoc);
|
WordExtractor extractorDoc = new WordExtractor(documentDoc);
|
||||||
content = new StringBuilder(extractorDoc.getText());
|
content = new StringBuilder(extractorDoc.getText());
|
||||||
break;
|
break;
|
||||||
case ReportConstants.FILE_EXTENSIONS_DOCX:
|
case ReportConstants.FILE_EXTENSIONS_DOCX:
|
||||||
XWPFDocument documentDocx = new XWPFDocument(fis);
|
XWPFDocument documentDocx = new XWPFDocument(fis);
|
||||||
XWPFWordExtractor extractorDocx = new XWPFWordExtractor(documentDocx);
|
XWPFWordExtractor extractorDocx = new XWPFWordExtractor(documentDocx);
|
||||||
content = new StringBuilder(extractorDocx.getText());
|
content = new StringBuilder(extractorDocx.getText());
|
||||||
break;
|
break;
|
||||||
case ReportConstants.FILE_EXTENSIONS_PPT:
|
case ReportConstants.FILE_EXTENSIONS_PPT:
|
||||||
HSLFSlideShow ppt = new HSLFSlideShow(fis);
|
HSLFSlideShow ppt = new HSLFSlideShow(fis);
|
||||||
for (HSLFSlide slide : ppt.getSlides()) {
|
for (HSLFSlide slide : ppt.getSlides()) {
|
||||||
for (HSLFShape shape : slide.getShapes()) {
|
for (HSLFShape shape : slide.getShapes()) {
|
||||||
if (shape instanceof HSLFTextShape) {
|
if (shape instanceof HSLFTextShape) {
|
||||||
HSLFTextShape textShape = (HSLFTextShape) shape;
|
HSLFTextShape textShape = (HSLFTextShape) shape;
|
||||||
content.append(textShape.getText()).append("\n");
|
content.append(textShape.getText()).append("\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
break;
|
case ReportConstants.FILE_EXTENSIONS_PPTX:
|
||||||
case ReportConstants.FILE_EXTENSIONS_PPTX:
|
XMLSlideShow pptx = new XMLSlideShow(fis);
|
||||||
XMLSlideShow pptx = new XMLSlideShow(fis);
|
for (XSLFSlide slide : pptx.getSlides()) {
|
||||||
for (XSLFSlide slide : pptx.getSlides()) {
|
for (XSLFShape shape : slide.getShapes()) {
|
||||||
for (XSLFShape shape : slide.getShapes()) {
|
if (shape instanceof XSLFTextShape) {
|
||||||
if (shape instanceof XSLFTextShape) {
|
XSLFTextShape textShape = (XSLFTextShape) shape;
|
||||||
XSLFTextShape textShape = (XSLFTextShape) shape;
|
content.append(textShape.getText()).append("\n");
|
||||||
content.append(textShape.getText()).append("\n");
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
break;
|
case ReportConstants.FILE_EXTENSIONS_PDF:
|
||||||
case ReportConstants.FILE_EXTENSIONS_PDF:
|
PDDocument document = PDDocument.load(fis);
|
||||||
PDDocument document = PDDocument.load(fis);
|
PDFTextStripper stripper = new PDFTextStripper();
|
||||||
PDFTextStripper stripper = new PDFTextStripper();
|
content = new StringBuilder(stripper.getText(document));
|
||||||
content = new StringBuilder(stripper.getText(document));
|
default:
|
||||||
default:
|
}
|
||||||
|
} catch (NotOfficeXmlFileException e) {
|
||||||
|
fis.close();
|
||||||
|
log.info("文件内容抽取失败,原因可能是上传的文件为空文件");
|
||||||
}
|
}
|
||||||
fis.close();
|
return cleanInvalidCharacters(content.toString());
|
||||||
return content.toString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String cleanInvalidCharacters(String input) {
|
||||||
|
StringBuilder stringBuilder = new StringBuilder();
|
||||||
|
CharsetEncoder encoder = StandardCharsets.UTF_8.newEncoder();
|
||||||
|
for (char ch : input.toCharArray()) {
|
||||||
|
if (encoder.canEncode(ch)) {
|
||||||
|
stringBuilder.append(ch);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return stringBuilder.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private static String readExcelContent(org.apache.poi.ss.usermodel.Workbook workbook) {
|
private static String readExcelContent(org.apache.poi.ss.usermodel.Workbook workbook) {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
int numberOfSheets = workbook.getNumberOfSheets();
|
int numberOfSheets = workbook.getNumberOfSheets();
|
||||||
|
|||||||
@@ -10,6 +10,9 @@ import javax.servlet.http.HttpServletResponse;
|
|||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.zip.ZipEntry;
|
||||||
|
import java.util.zip.ZipOutputStream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Caihaohan
|
* @author Caihaohan
|
||||||
@@ -24,6 +27,39 @@ public class LocalFileUtil {
|
|||||||
@Value("${localFilePath}")
|
@Value("${localFilePath}")
|
||||||
private String localFilePath;
|
private String localFilePath;
|
||||||
|
|
||||||
|
public void compressFiles(List<String> filePaths, HttpServletResponse response) {
|
||||||
|
try {
|
||||||
|
// 创建输出流
|
||||||
|
OutputStream outputStream = response.getOutputStream();
|
||||||
|
ZipOutputStream zipOutputStream = new ZipOutputStream(outputStream);
|
||||||
|
|
||||||
|
byte[] buffer = new byte[1024];
|
||||||
|
|
||||||
|
for (String filePath : filePaths) {
|
||||||
|
File sourceFile = new File(filePath);
|
||||||
|
|
||||||
|
ZipEntry zipEntry = new ZipEntry(sourceFile.getName());
|
||||||
|
zipOutputStream.putNextEntry(zipEntry);
|
||||||
|
|
||||||
|
FileInputStream fileInputStream = new FileInputStream(sourceFile);
|
||||||
|
|
||||||
|
int len;
|
||||||
|
while ((len = fileInputStream.read(buffer)) > 0) {
|
||||||
|
zipOutputStream.write(buffer, 0, len);
|
||||||
|
}
|
||||||
|
|
||||||
|
fileInputStream.close();
|
||||||
|
zipOutputStream.closeEntry();
|
||||||
|
}
|
||||||
|
|
||||||
|
zipOutputStream.close();
|
||||||
|
|
||||||
|
System.out.println("文件成功压缩成ZIP格式并写入 HttpServletResponse!");
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void saveFile(InputStream fileInputStream, String fileName) throws IOException {
|
public void saveFile(InputStream fileInputStream, String fileName) throws IOException {
|
||||||
String path = localFilePath + fileName;
|
String path = localFilePath + fileName;
|
||||||
FileOutputStream fileOutputStream = new FileOutputStream(path);
|
FileOutputStream fileOutputStream = new FileOutputStream(path);
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import javax.annotation.Resource;
|
|||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
@@ -52,49 +53,62 @@ public class WaterMarkUtil {
|
|||||||
return configValue + " " + userName + " " + formattedDate;
|
return configValue + " " + userName + " " + formattedDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addWatermarkToPdf(FileInputStream inputStream, HttpServletResponse response) throws IOException {
|
public PDDocument addWatermarkToPdf(FileInputStream inputStream) throws IOException {
|
||||||
String watermarkText = getWaterMarkConfig();
|
String watermarkText = getWaterMarkConfig();
|
||||||
// 加载PDF文档
|
PDDocument document = PDDocument.load(inputStream);
|
||||||
try (PDDocument document = PDDocument.load(inputStream)) {
|
|
||||||
// 设置水印字体、字体大小、颜色和透明度
|
|
||||||
ClassPathResource fontResource = new ClassPathResource("fonts/SourceHanSerif-VF.ttf");
|
|
||||||
PDType0Font font = PDType0Font.load(document, fontResource.getInputStream());
|
|
||||||
float fontSize = 13.0f;
|
|
||||||
Color color = new Color(100, 100, 100, 0);
|
|
||||||
PDExtendedGraphicsState graphicsState = new PDExtendedGraphicsState();
|
|
||||||
graphicsState.setNonStrokingAlphaConstant(0.4f);
|
|
||||||
graphicsState.setStrokingAlphaConstant(0.4f);
|
|
||||||
|
|
||||||
// 遍历每一页并添加水印
|
// 设置水印字体、字体大小、颜色和透明度
|
||||||
for (PDPage page : document.getPages()) {
|
ClassPathResource fontResource = new ClassPathResource("fonts/SourceHanSerif-VF.ttf");
|
||||||
// 获取页面尺寸以计算水印位置
|
PDType0Font font = PDType0Font.load(document, fontResource.getInputStream());
|
||||||
PDRectangle pageSize = page.getMediaBox();
|
float fontSize = 13.0f;
|
||||||
float xStep = pageSize.getWidth() / 4;
|
Color color = new Color(100, 100, 100, 0);
|
||||||
float yStep = pageSize.getHeight() / 4;
|
PDExtendedGraphicsState graphicsState = new PDExtendedGraphicsState();
|
||||||
float rotationInRadians = (float) Math.toRadians(20);
|
graphicsState.setNonStrokingAlphaConstant(0.4f);
|
||||||
|
graphicsState.setStrokingAlphaConstant(0.4f);
|
||||||
|
|
||||||
for (float xPosition = pageSize.getLowerLeftX(); xPosition <= pageSize.getWidth(); xPosition += xStep) {
|
// 遍历每一页并添加水印
|
||||||
for (float yPosition = pageSize.getLowerLeftY(); yPosition <= pageSize.getHeight(); yPosition += yStep) {
|
for (PDPage page : document.getPages()) {
|
||||||
// 创建内容流并设置图形状态参数
|
// 获取页面尺寸以计算水印位置
|
||||||
try (PDPageContentStream contentStream = new PDPageContentStream(document, page, PDPageContentStream.AppendMode.APPEND, true, true)) {
|
PDRectangle pageSize = page.getMediaBox();
|
||||||
contentStream.setGraphicsStateParameters(graphicsState);
|
float xStep = pageSize.getWidth() / 4;
|
||||||
contentStream.setFont(font, fontSize);
|
float yStep = pageSize.getHeight() / 4;
|
||||||
contentStream.setNonStrokingColor(color);
|
float rotationInRadians = (float) Math.toRadians(20);
|
||||||
contentStream.beginText();
|
|
||||||
contentStream.setRenderingMode(RenderingMode.FILL);
|
for (float xPosition = pageSize.getLowerLeftX(); xPosition <= pageSize.getWidth(); xPosition += xStep) {
|
||||||
// 设置水印文本的旋转和位置
|
for (float yPosition = pageSize.getLowerLeftY(); yPosition <= pageSize.getHeight(); yPosition += yStep) {
|
||||||
contentStream.setTextMatrix(Matrix.getRotateInstance(rotationInRadians, xPosition, yPosition));
|
// 创建内容流并设置图形状态参数
|
||||||
contentStream.showText(watermarkText);
|
try (PDPageContentStream contentStream = new PDPageContentStream(document, page, PDPageContentStream.AppendMode.APPEND, true, true)) {
|
||||||
contentStream.endText();
|
contentStream.setGraphicsStateParameters(graphicsState);
|
||||||
}
|
contentStream.setFont(font, fontSize);
|
||||||
|
contentStream.setNonStrokingColor(color);
|
||||||
|
contentStream.beginText();
|
||||||
|
contentStream.setRenderingMode(RenderingMode.FILL);
|
||||||
|
// 设置水印文本的旋转和位置
|
||||||
|
contentStream.setTextMatrix(Matrix.getRotateInstance(rotationInRadians, xPosition, yPosition));
|
||||||
|
contentStream.showText(watermarkText);
|
||||||
|
contentStream.endText();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
return document;
|
||||||
|
}
|
||||||
|
|
||||||
// 将处理后的PDF写入HTTP响应
|
|
||||||
try (OutputStream outputStream = response.getOutputStream()) {
|
public void savePdfToFile(FileInputStream inputStream, String outputPath) throws IOException {
|
||||||
document.save(outputStream);
|
PDDocument pdDocument = addWatermarkToPdf(inputStream);
|
||||||
}
|
try (FileOutputStream outputStream = new FileOutputStream(outputPath)) {
|
||||||
|
pdDocument.save(outputStream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void addWatermarkToPdfAndWriteToResponse(FileInputStream inputStream, HttpServletResponse response) throws IOException {
|
||||||
|
PDDocument document = addWatermarkToPdf(inputStream);
|
||||||
|
try (OutputStream outputStream = response.getOutputStream()) {
|
||||||
|
document.save(outputStream);
|
||||||
|
}
|
||||||
|
document.close();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
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 javax.validation.constraints.NotEmpty;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author: CaiHaohan
|
||||||
|
* @Date: 2023/5/22 11:03
|
||||||
|
* @Description:
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class ChangeUploaderVo {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报告ids
|
||||||
|
*/
|
||||||
|
@NotEmpty
|
||||||
|
private List<String> reportIds;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户id
|
||||||
|
*/
|
||||||
|
@NotBlank
|
||||||
|
private String userId;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.adc.da.report.vo;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class FileVo {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件主键id
|
||||||
|
*/
|
||||||
|
private String fileId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件名
|
||||||
|
*/
|
||||||
|
private String fileName;
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package com.adc.da.report.vo;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import javax.validation.constraints.Min;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author: CaiHaohan
|
||||||
|
* @Date: 2023/5/23 14:14
|
||||||
|
* @Description:
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class MessageQueryVo {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标题
|
||||||
|
*/
|
||||||
|
private String messageTitle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发布人姓名
|
||||||
|
*/
|
||||||
|
private String createUserName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页数
|
||||||
|
*/
|
||||||
|
@Min(1)
|
||||||
|
private int pageNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 每页数量
|
||||||
|
*/
|
||||||
|
@NotNull
|
||||||
|
private int pageSize;
|
||||||
|
}
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
package com.adc.da.report.vo;
|
||||||
|
|
||||||
|
import com.adc.da.report.constant.MessageTypeEnum;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author: CaiHaohan
|
||||||
|
* @Date: 2023/5/23 11:54
|
||||||
|
* @Description:
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class MessageVo {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关系表的id
|
||||||
|
*/
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标题
|
||||||
|
*/
|
||||||
|
private String messageTitle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 内容
|
||||||
|
*/
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 消息类型
|
||||||
|
*/
|
||||||
|
private Integer messageType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 消息类型
|
||||||
|
*/
|
||||||
|
private String messageTypeDesc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发布时间
|
||||||
|
*/
|
||||||
|
private Date createDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建用户id
|
||||||
|
*/
|
||||||
|
private String createUser;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 消息id
|
||||||
|
*/
|
||||||
|
private String messageId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 阅读状态(0未读 1已读)
|
||||||
|
*/
|
||||||
|
private Integer readType;
|
||||||
|
|
||||||
|
public void setMessageType(Integer messageType) {
|
||||||
|
this.messageType = messageType;
|
||||||
|
switch (messageType) {
|
||||||
|
case 0:
|
||||||
|
this.messageTypeDesc = MessageTypeEnum.SYSTEM_MESSAGE.getDesc();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
this.messageTypeDesc = "未知";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
package com.adc.da.report.vo;
|
package com.adc.da.report.vo;
|
||||||
|
|
||||||
|
import com.adc.da.report.eo.ReportFile;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
@@ -65,13 +67,6 @@ public class ReportDetailVo {
|
|||||||
*/
|
*/
|
||||||
private String privacyLevel;
|
private String privacyLevel;
|
||||||
|
|
||||||
/**
|
|
||||||
* 文件id
|
|
||||||
*/
|
|
||||||
private String fileId;
|
|
||||||
|
|
||||||
private String fileName;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建人id
|
* 创建人id
|
||||||
*/
|
*/
|
||||||
@@ -111,4 +106,9 @@ public class ReportDetailVo {
|
|||||||
* 保密到期日期
|
* 保密到期日期
|
||||||
*/
|
*/
|
||||||
private Date secrecyLast;
|
private Date secrecyLast;
|
||||||
|
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private List<ReportFile> fileList;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package com.adc.da.report.vo;
|
||||||
|
|
||||||
|
public class ReportFilePageVO extends BasePageVO{
|
||||||
|
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
private String reportId;
|
||||||
|
|
||||||
|
private String fileId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态 1 流程中 ,2 非流程中
|
||||||
|
*/
|
||||||
|
private Integer state;
|
||||||
|
}
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
package com.adc.da.report.vo;
|
package com.adc.da.report.vo;
|
||||||
|
|
||||||
|
import com.adc.da.report.eo.ReportFile;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -46,16 +48,6 @@ public class ReportVo {
|
|||||||
*/
|
*/
|
||||||
private String year;
|
private String year;
|
||||||
|
|
||||||
/**
|
|
||||||
* 文件id
|
|
||||||
*/
|
|
||||||
private String fileId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 文件名称
|
|
||||||
*/
|
|
||||||
private String fileName;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文件类型
|
* 文件类型
|
||||||
*/
|
*/
|
||||||
@@ -116,6 +108,11 @@ public class ReportVo {
|
|||||||
*/
|
*/
|
||||||
private Integer download;
|
private Integer download;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 受否收藏
|
||||||
|
*/
|
||||||
|
private Integer collect;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建人id
|
* 创建人id
|
||||||
*/
|
*/
|
||||||
@@ -135,5 +132,6 @@ public class ReportVo {
|
|||||||
private Integer isAct;
|
private Integer isAct;
|
||||||
|
|
||||||
private String prcType;
|
private String prcType;
|
||||||
|
@TableField(exist = false)
|
||||||
|
private List<ReportFile> fileList;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
<?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.FileDao">
|
||||||
|
|
||||||
|
<select id="getDownloadFileIdsWithoutExcel" resultType="string">
|
||||||
|
SELECT
|
||||||
|
f.FILE_ID
|
||||||
|
FROM
|
||||||
|
`ts_file` AS f
|
||||||
|
LEFT JOIN ts_report_file AS rf ON f.FILE_ID = rf.file_id
|
||||||
|
WHERE
|
||||||
|
rf.report_id = #{reportId}
|
||||||
|
AND
|
||||||
|
f.FILE_TYPE != "xls"
|
||||||
|
AND
|
||||||
|
f.FILE_TYPE != "xlsx"
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getDownloadFileIds" resultType="string">
|
||||||
|
SELECT
|
||||||
|
f.FILE_ID
|
||||||
|
FROM
|
||||||
|
`ts_file` AS f
|
||||||
|
LEFT JOIN ts_report_file AS rf ON f.FILE_ID = rf.file_id
|
||||||
|
WHERE
|
||||||
|
rf.report_id = #{reportId}
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
<?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.MessageDao">
|
||||||
|
|
||||||
|
<resultMap id="BaseResultMap" type="com.adc.da.report.eo.MessageEntity">
|
||||||
|
<id property="id" column="id" jdbcType="VARCHAR"/>
|
||||||
|
<result property="content" column="content" jdbcType="VARCHAR"/>
|
||||||
|
<result property="messageType" column="message_type" jdbcType="TINYINT"/>
|
||||||
|
<result property="createDate" column="createDate" jdbcType="TIMESTAMP"/>
|
||||||
|
<result property="delFlag" column="del_flag" jdbcType="TINYINT"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
id,content,message_type,
|
||||||
|
createDate,del_flag
|
||||||
|
</sql>
|
||||||
|
<select id="listByUser" resultType="com.adc.da.report.vo.MessageVo">
|
||||||
|
SELECT
|
||||||
|
um.id AS Id,
|
||||||
|
um.user_id AS userId,
|
||||||
|
um.message_id AS messageId,
|
||||||
|
um.read_type AS readType,
|
||||||
|
m.message_title AS messageTitle,
|
||||||
|
m.content AS content,
|
||||||
|
m.message_type AS messageType,
|
||||||
|
m.createDate AS createDate,
|
||||||
|
m.createUser AS createUser
|
||||||
|
FROM
|
||||||
|
ts_user_message AS um
|
||||||
|
LEFT JOIN ts_message AS m ON um.message_id = m.id
|
||||||
|
LEFT JOIN ts_user AS u ON m.createUser = u.USID
|
||||||
|
WHERE
|
||||||
|
um.del_flag = 0
|
||||||
|
AND
|
||||||
|
um.user_id = #{userId}
|
||||||
|
<!--全文模糊搜索-->
|
||||||
|
<if test="vo.messageTitle !='' and vo.messageTitle != null">
|
||||||
|
AND m.message_title like CONCAT(CONCAT('%', #{vo.messageTitle}), '%')
|
||||||
|
</if>
|
||||||
|
<if test="vo.createUserName !='' and vo.createUserName != null">
|
||||||
|
AND u.USNAME like CONCAT(CONCAT('%', #{vo.createUserName}), '%')
|
||||||
|
</if>
|
||||||
|
ORDER BY
|
||||||
|
um.read_type ASC, m.createDate DESC
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
@@ -105,21 +105,21 @@
|
|||||||
</select>
|
</select>
|
||||||
<select id="selectListBydataId" resultType="com.adc.da.report.vo.PowerApplyActPageVO">
|
<select id="selectListBydataId" resultType="com.adc.da.report.vo.PowerApplyActPageVO">
|
||||||
select a.*,
|
select a.*,
|
||||||
rep.name,rep.keycontent,rep.maincontent,rep.DEPARTMENT,rep.year,rep.fileid,rep.confidentialLevel,rep.privacyLevel
|
rep.name,rep.keycontent,rep.maincontent,rep.DEPARTMENT,rep.year,rep.confidentialLevel,rep.privacyLevel
|
||||||
from <include refid="TableName"/> a
|
from <include refid="TableName"/> a
|
||||||
left join TT_REPORT_MANAGE rep on a.report_id = rep.id
|
left join TT_REPORT_MANAGE rep on a.report_id = rep.id
|
||||||
where a.data_id = #{dataId} and a.del_flag = 0
|
where a.data_id = #{dataId} and a.del_flag = 0
|
||||||
</select>
|
</select>
|
||||||
<select id="selectListBydataIdNodel" resultType="com.adc.da.report.vo.PowerApplyActPageVO">
|
<select id="selectListBydataIdNodel" resultType="com.adc.da.report.vo.PowerApplyActPageVO">
|
||||||
select a.*,
|
select a.*,
|
||||||
rep.name,rep.keycontent,rep.maincontent,rep.DEPARTMENT,rep.year,rep.fileid,rep.confidentialLevel,rep.privacyLevel
|
rep.name,rep.keycontent,rep.maincontent,rep.DEPARTMENT,rep.year,rep.confidentialLevel,rep.privacyLevel
|
||||||
from <include refid="TableName"/> a
|
from <include refid="TableName"/> a
|
||||||
left join TT_REPORT_MANAGE rep on a.report_id = rep.id
|
left join TT_REPORT_MANAGE rep on a.report_id = rep.id
|
||||||
where a.data_id = #{dataId}
|
where a.data_id = #{dataId}
|
||||||
</select>
|
</select>
|
||||||
<select id="selectActListBydataId" resultType="com.adc.da.report.eo.PowerApplyAct">
|
<select id="selectActListBydataId" resultType="com.adc.da.report.eo.PowerApplyAct">
|
||||||
select a.*,
|
select a.*,
|
||||||
rep.name,rep.keycontent,rep.maincontent,rep.DEPARTMENT,rep.year,rep.fileid,rep.confidentialLevel,rep.privacyLevel,
|
rep.name,rep.keycontent,rep.maincontent,rep.DEPARTMENT,rep.year,rep.confidentialLevel,rep.privacyLevel,
|
||||||
rep.createUserId , u.usname as createUserName
|
rep.createUserId , u.usname as createUserName
|
||||||
from <include refid="TableName"/> a
|
from <include refid="TableName"/> a
|
||||||
left join TT_REPORT_MANAGE rep on a.report_id = rep.id
|
left join TT_REPORT_MANAGE rep on a.report_id = rep.id
|
||||||
@@ -128,7 +128,7 @@
|
|||||||
</select>
|
</select>
|
||||||
<select id="selectListByPrcId" resultType="com.adc.da.report.vo.PowerApplyActPageVO">
|
<select id="selectListByPrcId" resultType="com.adc.da.report.vo.PowerApplyActPageVO">
|
||||||
select a.*,
|
select a.*,
|
||||||
rep.name,rep.keycontent,rep.maincontent,rep.DEPARTMENT,rep.year,rep.fileid,rep.confidentialLevel,rep.privacyLevel,
|
rep.name,rep.keycontent,rep.maincontent,rep.DEPARTMENT,rep.year,rep.confidentialLevel,rep.privacyLevel,
|
||||||
rep.createUserId , u.usname as createUserName
|
rep.createUserId , u.usname as createUserName
|
||||||
from <include refid="TableName"/> a
|
from <include refid="TableName"/> a
|
||||||
left join TT_REPORT_MANAGE rep on a.report_id = rep.id
|
left join TT_REPORT_MANAGE rep on a.report_id = rep.id
|
||||||
|
|||||||
@@ -0,0 +1,53 @@
|
|||||||
|
<?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.ReportFileDao">
|
||||||
|
<update id="updateState">
|
||||||
|
update ts_report_file set state = 2
|
||||||
|
where report_id = #{reportId}
|
||||||
|
</update>
|
||||||
|
<delete id="actEndDelReport">
|
||||||
|
delete from ts_report_file
|
||||||
|
<where>
|
||||||
|
report_id = #{reportId}
|
||||||
|
and state = 2
|
||||||
|
</where>
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
|
||||||
|
<delete id="delByReportId">
|
||||||
|
delete from ts_report_file
|
||||||
|
<where>
|
||||||
|
<if test="pageVO.reportId !=null and pageVO.reportId !=''">
|
||||||
|
AND report_id = #{pageVO.reportId}
|
||||||
|
</if>
|
||||||
|
<if test="pageVO.state !=null">
|
||||||
|
AND state = #{pageVO.state}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
|
||||||
|
</delete>
|
||||||
|
<select id="selectByReport" resultType="com.adc.da.report.eo.ReportFile">
|
||||||
|
select rf.*,f.file_name as fileName from ts_report_file rf
|
||||||
|
LEFT JOIN ts_file f on f.FILE_ID = rf.file_id
|
||||||
|
<where>
|
||||||
|
<if test="pageVO.reportId !=null and pageVO.reportId !=''">
|
||||||
|
AND report_id = #{pageVO.reportId}
|
||||||
|
</if>
|
||||||
|
<if test="pageVO.state !=null">
|
||||||
|
AND state = #{pageVO.state}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
<select id="filePage" resultType="com.adc.da.report.eo.ReportFile">
|
||||||
|
select rf.*,f.file_name as fileName from ts_report_file rf
|
||||||
|
LEFT JOIN ts_file f on f.FILE_ID = rf.file_id
|
||||||
|
<where>
|
||||||
|
<if test="pageVO.reportId !=null and pageVO.reportId !=''">
|
||||||
|
AND report_id = #{pageVO.reportId}
|
||||||
|
</if>
|
||||||
|
<if test="pageVO.state !=null">
|
||||||
|
AND state = #{pageVO.state}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
<?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.ReportLabelDao">
|
||||||
|
<update id="updateState">
|
||||||
|
update ts_report_label set state = 2
|
||||||
|
where report_id = #{reportId}
|
||||||
|
</update>
|
||||||
|
<delete id="actEndDelReport">
|
||||||
|
delete from ts_report_label
|
||||||
|
<where>
|
||||||
|
report_id = #{reportId}
|
||||||
|
and state = 2
|
||||||
|
</where>
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@@ -1,15 +1,62 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?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">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.adc.da.report.dao.mysql.ReportDao">
|
<mapper namespace="com.adc.da.report.dao.mysql.ReportDao">
|
||||||
|
<!-- 通用查询映射结果 -->
|
||||||
|
<resultMap id="BaseResultMap" type="com.adc.da.report.vo.ReportDetailVo">
|
||||||
|
<result column="id" property="id" />
|
||||||
|
<result column="name" property="name" />
|
||||||
|
<result column="uploaderName" property="uploaderName" />
|
||||||
|
<result column="keycontent" property="keyContent" />
|
||||||
|
<result column="maincontent" property="mainContent" />
|
||||||
|
<result column="department" property="department" />
|
||||||
|
<result column="departmentName" property="departmentName" />
|
||||||
|
<result column="year" property="year" />
|
||||||
|
<result column="confidentialLevel" property="confidentialLevel" />
|
||||||
|
<result column="privacyLevel" property="privacyLevel" />
|
||||||
|
<result column="createUserId" property="createUserId" />
|
||||||
|
<result column="secrecy_last" property="secrecyLast" />
|
||||||
|
<collection property="fileList" ofType="com.adc.da.report.eo.ReportFile">
|
||||||
|
<result column="fileId" property="fileId" />
|
||||||
|
<result column="fileName" property="fileName" />
|
||||||
|
<result column="rfId" property="id" />
|
||||||
|
</collection>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- 通用查询映射结果 -->
|
||||||
|
<resultMap id="BaseResultReportVoMap" type="com.adc.da.report.vo.ReportVo">
|
||||||
|
<result column="id" property="id" />
|
||||||
|
<result column="name" property="name" />
|
||||||
|
<result column="keycontent" property="keyContent" />
|
||||||
|
<result column="maincontent" property="mainContent" />
|
||||||
|
<result column="department" property="department" />
|
||||||
|
<result column="year" property="year" />
|
||||||
|
<result column="confidentialLevel" property="confidentialLevel" />
|
||||||
|
<result column="privacyLevel" property="privacyLevel" />
|
||||||
|
<result column="createUserId" property="createUserId" />
|
||||||
|
<result column="uploader" property="uploader" />
|
||||||
|
<result column="createDate" property="createDate" />
|
||||||
|
<result column="thumbUp" property="thumbUp" />
|
||||||
|
<result column="clicks" property="clicks" />
|
||||||
|
<result column="download" property="download" />
|
||||||
|
<result column="collect" property="collect" />
|
||||||
|
<result column="reportRating" property="reportRating" />
|
||||||
|
<result column="isAct" property="isAct" />
|
||||||
|
<collection property="fileList" ofType="com.adc.da.report.eo.ReportFile">
|
||||||
|
<result column="fileId" property="fileId" />
|
||||||
|
<result column="fileName" property="fileName" />
|
||||||
|
<result column="rfId" property="id" />
|
||||||
|
</collection>
|
||||||
|
</resultMap>
|
||||||
<!-- 通用查询结果列 -->
|
<!-- 通用查询结果列 -->
|
||||||
<sql id="BaseColumnList">
|
<sql id="BaseColumnList">
|
||||||
id, name, keycontent, maincontent, department, year, fileId, confidentialLevel, privacyLevel,
|
id, name, keycontent, maincontent, department, year, confidentialLevel, privacyLevel,
|
||||||
createUserId, createDate, updateDate, del_flag,secrecy_last
|
createUserId, createDate, updateDate, del_flag,secrecy_last
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<sql id="BaseColumnValue">
|
<sql id="BaseColumnValue">
|
||||||
#{Vo.id},#{Vo.name},#{Vo.keycontent},#{Vo.maincontent},#{Vo.department},#{Vo.year},#{Vo.fileId},
|
#{Vo.id},#{Vo.name},#{Vo.keycontent},#{Vo.maincontent},#{Vo.department},#{Vo.year},
|
||||||
#{Vo.confidentialLevel},#{Vo.privacyLevel},
|
#{Vo.confidentialLevel},#{Vo.privacyLevel},
|
||||||
#{Vo.createUserId},
|
#{Vo.createUserId},
|
||||||
#{Vo.createDate},#{Vo.updateDate},#{Vo.del_flag},
|
#{Vo.createDate},#{Vo.updateDate},#{Vo.del_flag},
|
||||||
@@ -19,7 +66,7 @@
|
|||||||
<insert id="saveReportAct">
|
<insert id="saveReportAct">
|
||||||
insert into TT_REPORT_MANAGE (<include refid="BaseColumnList"/>)
|
insert into TT_REPORT_MANAGE (<include refid="BaseColumnList"/>)
|
||||||
value (
|
value (
|
||||||
#{Vo.dataId},#{Vo.name},#{Vo.keyContent},#{Vo.mainContent},#{Vo.department},#{Vo.year},#{Vo.fileId},
|
#{Vo.dataId},#{Vo.name},#{Vo.keyContent},#{Vo.mainContent},#{Vo.department},#{Vo.year},
|
||||||
#{Vo.confidentialLevel},#{Vo.privacyLevel},
|
#{Vo.confidentialLevel},#{Vo.privacyLevel},
|
||||||
#{Vo.createUserId},
|
#{Vo.createUserId},
|
||||||
#{Vo.createDate},#{Vo.updateDate},#{Vo.delFlag},
|
#{Vo.createDate},#{Vo.updateDate},#{Vo.delFlag},
|
||||||
@@ -28,7 +75,6 @@
|
|||||||
|
|
||||||
<select id="getReportDateList" parameterType="string" resultType="string">
|
<select id="getReportDateList" parameterType="string" resultType="string">
|
||||||
select distinct year from TT_REPORT_MANAGE t1
|
select distinct year from TT_REPORT_MANAGE t1
|
||||||
left join TR_REPORT_USER t2 on t1.id=t2.reportId
|
|
||||||
where del_flag='0'
|
where del_flag='0'
|
||||||
<if test="usid !='' and usid !=null">
|
<if test="usid !='' and usid !=null">
|
||||||
and t2.userId=#{usid}
|
and t2.userId=#{usid}
|
||||||
@@ -46,7 +92,6 @@
|
|||||||
eo.maincontent,
|
eo.maincontent,
|
||||||
eo.DEPARTMENT,
|
eo.DEPARTMENT,
|
||||||
eo.YEAR,
|
eo.YEAR,
|
||||||
eo.fileid,
|
|
||||||
eo.confidentialLevel,
|
eo.confidentialLevel,
|
||||||
eo.privacyLevel,
|
eo.privacyLevel,
|
||||||
eo.createUserId,
|
eo.createUserId,
|
||||||
@@ -55,13 +100,11 @@
|
|||||||
pa.user_id
|
pa.user_id
|
||||||
FROM
|
FROM
|
||||||
TT_REPORT_MANAGE eo
|
TT_REPORT_MANAGE eo
|
||||||
LEFT JOIN tr_report_user ru ON eo.id = ru.reportId
|
|
||||||
LEFT JOIN power_apply pa ON pa.report_id = eo.id
|
LEFT JOIN power_apply pa ON pa.report_id = eo.id
|
||||||
LEFT JOIN ts_user u on u.USID = eo.createUserId
|
LEFT JOIN ts_user u on u.USID = eo.createUserId
|
||||||
WHERE
|
WHERE
|
||||||
eo.DEL_FLAG = 0
|
eo.DEL_FLAG = 0
|
||||||
<if test="pageVO.usid !='' and pageVO.usid != null">
|
<if test="pageVO.usid !='' and pageVO.usid != null">
|
||||||
AND eo.id NOT IN ( SELECT ru.reportId FROM tr_report_user ru WHERE ru.userId = #{pageVO.usid} )
|
|
||||||
AND eo.id NOT IN ( SELECT tt.report_id FROM power_apply tt WHERE tt.user_id = #{pageVO.usid} )
|
AND eo.id NOT IN ( SELECT tt.report_id FROM power_apply tt WHERE tt.user_id = #{pageVO.usid} )
|
||||||
AND eo.id NOT IN (SELECT tt.report_id FROM power_apply_act tt LEFT JOIN bus_process_name pro on tt.prc_id = pro.PRC_ID WHERE tt.user_id = #{pageVO.usid} and
|
AND eo.id NOT IN (SELECT tt.report_id FROM power_apply_act tt LEFT JOIN bus_process_name pro on tt.prc_id = pro.PRC_ID WHERE tt.user_id = #{pageVO.usid} and
|
||||||
del_flag != 1 and pro.SUBMIT_STATUS = 1)
|
del_flag != 1 and pro.SUBMIT_STATUS = 1)
|
||||||
@@ -94,7 +137,7 @@
|
|||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="page" resultType="com.adc.da.report.vo.ReportVo">
|
<select id="page" resultMap="BaseResultReportVoMap">
|
||||||
|
|
||||||
SELECT
|
SELECT
|
||||||
eo.id AS id,
|
eo.id AS id,
|
||||||
@@ -103,7 +146,6 @@
|
|||||||
eo.maincontent AS mainContent,
|
eo.maincontent AS mainContent,
|
||||||
eo.DEPARTMENT AS department,
|
eo.DEPARTMENT AS department,
|
||||||
eo.`YEAR` AS `year`,
|
eo.`YEAR` AS `year`,
|
||||||
eo.fileid AS fileId,
|
|
||||||
eo.confidentialLevel AS confidentialLevel,
|
eo.confidentialLevel AS confidentialLevel,
|
||||||
eo.privacyLevel AS privacyLevel,
|
eo.privacyLevel AS privacyLevel,
|
||||||
eo.createUserId AS createUserId,
|
eo.createUserId AS createUserId,
|
||||||
@@ -113,19 +155,24 @@
|
|||||||
clicksCount.clicks AS clicks,
|
clicksCount.clicks AS clicks,
|
||||||
downloadCount.download AS download,
|
downloadCount.download AS download,
|
||||||
AVG( trur.user_rating ) AS reportRating,
|
AVG( trur.user_rating ) AS reportRating,
|
||||||
|
IF(rlb.type = 4, 1, 0) AS collect,
|
||||||
IF(bpn.id is null,1,
|
IF(bpn.id is null,1,
|
||||||
IF(bpn.SUBMIT_STATUS = 1 and bpn.CREAT_USER = #{pageVO.usid} ,0,1)
|
IF(bpn.SUBMIT_STATUS = 1 and bpn.CREAT_USER = #{pageVO.usid} ,0,1)
|
||||||
) as isAct
|
) as isAct
|
||||||
|
,
|
||||||
|
f.FILE_ID as fileId, f.file_name as fileName ,rf.id as rfId
|
||||||
FROM
|
FROM
|
||||||
TT_REPORT_MANAGE eo
|
TT_REPORT_MANAGE eo
|
||||||
LEFT JOIN ts_report_content rc ON eo.id = rc.report_id
|
LEFT JOIN ts_report_content rc ON eo.id = rc.report_id
|
||||||
LEFT JOIN ts_user tu ON tu.USID = eo.createUserId
|
LEFT JOIN ts_user tu ON tu.USID = eo.createUserId
|
||||||
LEFT JOIN tr_report_user ru ON eo.id = ru.reportId
|
|
||||||
LEFT JOIN (SELECT report_id, COUNT(id) AS thumbUp FROM report_log_book WHERE type = 3 GROUP BY report_id) AS thumbUpCount ON eo.id = thumbUpCount.report_id
|
LEFT JOIN (SELECT report_id, COUNT(id) AS thumbUp FROM report_log_book WHERE type = 3 GROUP BY report_id) AS thumbUpCount ON eo.id = thumbUpCount.report_id
|
||||||
LEFT JOIN (SELECT report_id, COUNT(id) AS clicks FROM report_log_book WHERE type = 1 GROUP BY report_id) AS clicksCount ON eo.id = clicksCount.report_id
|
LEFT JOIN (SELECT report_id, COUNT(id) AS clicks FROM report_log_book WHERE type = 1 GROUP BY report_id) AS clicksCount ON eo.id = clicksCount.report_id
|
||||||
LEFT JOIN (SELECT report_id, COUNT(id) AS download FROM report_log_book WHERE type = 2 GROUP BY report_id) AS downloadCount ON eo.id = downloadCount.report_id
|
LEFT JOIN (SELECT report_id, COUNT(id) AS download FROM report_log_book WHERE type = 2 GROUP BY report_id) AS downloadCount ON eo.id = downloadCount.report_id
|
||||||
LEFT JOIN ts_report_user_rating AS trur ON eo.id = trur.report_id
|
LEFT JOIN ts_report_user_rating AS trur ON eo.id = trur.report_id
|
||||||
LEFT JOIN bus_process_name as bpn on bpn.data_id = eo.id and bpn.prc_type != '5'
|
LEFT JOIN bus_process_name as bpn on bpn.data_id = eo.id and bpn.prc_type != '5'
|
||||||
|
LEFT JOIN ts_report_file rf on rf.report_id = eo.id and rf.state = 2
|
||||||
|
LEFT JOIN ts_file f on f.FILE_ID = rf.file_id
|
||||||
|
LEFT JOIN report_log_book AS rlb ON rlb.user_id = #{pageVO.usid} AND rlb.report_id = eo.id AND rlb.type = 4
|
||||||
WHERE
|
WHERE
|
||||||
eo.DEL_FLAG = 0
|
eo.DEL_FLAG = 0
|
||||||
<!--全文模糊搜索-->
|
<!--全文模糊搜索-->
|
||||||
@@ -173,23 +220,113 @@
|
|||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="myCollectPage" resultMap="BaseResultReportVoMap">
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
eo.id AS id,
|
||||||
|
eo.`NAME` AS NAME,
|
||||||
|
eo.keycontent AS keyContent,
|
||||||
|
eo.maincontent AS mainContent,
|
||||||
|
eo.DEPARTMENT AS department,
|
||||||
|
eo.`YEAR` AS `year`,
|
||||||
|
eo.confidentialLevel AS confidentialLevel,
|
||||||
|
eo.privacyLevel AS privacyLevel,
|
||||||
|
eo.createUserId AS createUserId,
|
||||||
|
tu.USNAME AS uploader,
|
||||||
|
eo.createDate AS createDate,
|
||||||
|
thumbUpCount.thumbUp AS thumbUp,
|
||||||
|
clicksCount.clicks AS clicks,
|
||||||
|
downloadCount.download AS download,
|
||||||
|
AVG( trur.user_rating ) AS reportRating,
|
||||||
|
IF(bpn.id is null,1,
|
||||||
|
IF(bpn.SUBMIT_STATUS = 1 and bpn.CREAT_USER = #{pageVO.usid} ,0,1)
|
||||||
|
) as isAct
|
||||||
|
,
|
||||||
|
f.FILE_ID as fileId, f.file_name as fileName ,rf.id as rfId
|
||||||
|
FROM
|
||||||
|
TT_REPORT_MANAGE eo
|
||||||
|
LEFT JOIN ts_report_content rc ON eo.id = rc.report_id
|
||||||
|
LEFT JOIN ts_user tu ON tu.USID = eo.createUserId
|
||||||
|
LEFT JOIN (SELECT report_id, COUNT(id) AS thumbUp FROM report_log_book WHERE type = 3 GROUP BY report_id) AS thumbUpCount ON eo.id = thumbUpCount.report_id
|
||||||
|
LEFT JOIN (SELECT report_id, COUNT(id) AS clicks FROM report_log_book WHERE type = 1 GROUP BY report_id) AS clicksCount ON eo.id = clicksCount.report_id
|
||||||
|
LEFT JOIN (SELECT report_id, COUNT(id) AS download FROM report_log_book WHERE type = 2 GROUP BY report_id) AS downloadCount ON eo.id = downloadCount.report_id
|
||||||
|
LEFT JOIN ts_report_user_rating AS trur ON eo.id = trur.report_id
|
||||||
|
LEFT JOIN bus_process_name as bpn on bpn.data_id = eo.id and bpn.prc_type != '5'
|
||||||
|
LEFT JOIN ts_report_file rf on rf.report_id = eo.id and rf.state = 2
|
||||||
|
LEFT JOIN ts_file f on f.FILE_ID = rf.file_id
|
||||||
|
WHERE
|
||||||
|
eo.DEL_FLAG = 0
|
||||||
|
<!--全文模糊搜索-->
|
||||||
|
<if test="pageVO.keyContent !='' and pageVO.keyContent != null">
|
||||||
|
and rc.report_content like CONCAT(CONCAT('%',#{pageVO.keyContent}),'%')
|
||||||
|
</if>
|
||||||
|
<if test="pageVO.name !='' and pageVO.name != null">
|
||||||
|
and name like CONCAT(CONCAT('%',#{pageVO.name}),'%')
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<!--年份搜索-->
|
||||||
|
<if test="pageVO.year != null and pageVO.year.size() > 0">
|
||||||
|
and year in
|
||||||
|
<foreach collection="pageVO.year" item="year" open="(" separator="," close=")">
|
||||||
|
#{year}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<if test="pageVO.ids != null and pageVO.ids.size() > 0">
|
||||||
|
and eo.id in
|
||||||
|
<foreach collection="pageVO.ids" item="id" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
<!--id搜索-->
|
||||||
|
<if test="idSet !=null and idSet.size() > 0">
|
||||||
|
and eo.id in
|
||||||
|
<foreach collection="idSet" item="id" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
<!--collectReportIds搜索-->
|
||||||
|
<if test="collectReportIds !=null and collectReportIds.size() > 0">
|
||||||
|
and eo.id in
|
||||||
|
<foreach collection="collectReportIds" item="id" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
GROUP BY
|
||||||
|
eo.id
|
||||||
|
<if test="pageVO.orderByTime == 1">
|
||||||
|
ORDER BY
|
||||||
|
eo.createDate DESC
|
||||||
|
</if>
|
||||||
|
<if test="pageVO.orderByClicks == 1">
|
||||||
|
ORDER BY
|
||||||
|
clicksCount.clicks DESC
|
||||||
|
</if>
|
||||||
|
<if test="pageVO.orderByDownload == 1">
|
||||||
|
ORDER BY
|
||||||
|
downloadCount.download DESC
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
<select id="reportManagerPage" parameterType="com.adc.da.report.vo.ReportQueryVo" resultType="com.adc.da.report.vo.ReportVo">
|
<select id="reportManagerPage" parameterType="com.adc.da.report.vo.ReportQueryVo" resultType="com.adc.da.report.vo.ReportVo">
|
||||||
SELECT DISTINCT
|
SELECT DISTINCT
|
||||||
t.id,
|
t.id,
|
||||||
t.year,
|
t.year,
|
||||||
t.name,
|
t.name,
|
||||||
t.keycontent,
|
t.keycontent,
|
||||||
t.fileId,
|
|
||||||
t.createDate,
|
t.createDate,
|
||||||
t.department,
|
t.department,
|
||||||
t.maincontent,
|
t.maincontent,
|
||||||
t.confidentialLevel,
|
t.confidentialLevel,
|
||||||
t.privacyLevel,
|
t.privacyLevel,
|
||||||
|
t.createUserId,
|
||||||
|
tu.USNAME AS createUserName,
|
||||||
IF(bpn.id is null,1,
|
IF(bpn.id is null,1,
|
||||||
IF(bpn.SUBMIT_STATUS = 1,0,1)
|
IF(bpn.SUBMIT_STATUS = 1,0,1)
|
||||||
) as isAct
|
) as isAct
|
||||||
FROM `tt_report_manage` AS t
|
FROM `tt_report_manage` AS t
|
||||||
LEFT JOIN bus_process_name as bpn on bpn.data_id = t.id and bpn.prc_type = '5'
|
LEFT JOIN bus_process_name as bpn on bpn.data_id = t.id and bpn.prc_type = '5'
|
||||||
|
LEFT JOIN ts_user as tu ON tu.USID = t.createUserId
|
||||||
WHERE t.del_flag = 0
|
WHERE t.del_flag = 0
|
||||||
<!--报表名称搜索-->
|
<!--报表名称搜索-->
|
||||||
<if test="Vo.name != null and Vo.name != ''">
|
<if test="Vo.name != null and Vo.name != ''">
|
||||||
@@ -275,7 +412,7 @@
|
|||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="reportDetail" resultType="com.adc.da.report.vo.ReportDetailVo">
|
<select id="reportDetail" resultMap="BaseResultMap">
|
||||||
SELECT
|
SELECT
|
||||||
rm.id AS id,
|
rm.id AS id,
|
||||||
rm.name AS `name`,
|
rm.name AS `name`,
|
||||||
@@ -285,18 +422,19 @@
|
|||||||
rm.maincontent AS maincontent,
|
rm.maincontent AS maincontent,
|
||||||
rm.department AS department,
|
rm.department AS department,
|
||||||
rm.`year` AS `year`,
|
rm.`year` AS `year`,
|
||||||
rm.fileId AS fileId,
|
|
||||||
f.file_name as fileName,
|
|
||||||
rm.confidentialLevel AS confidentialLevel,
|
rm.confidentialLevel AS confidentialLevel,
|
||||||
rm.privacyLevel AS privacyLevel,
|
rm.privacyLevel AS privacyLevel,
|
||||||
rm.secrecy_last AS secrecyLast
|
rm.secrecy_last AS secrecyLast,
|
||||||
|
f.FILE_ID as fileId, f.file_name as fileName ,rf.id as rfId
|
||||||
FROM `tt_report_manage` AS rm
|
FROM `tt_report_manage` AS rm
|
||||||
LEFT JOIN ts_user AS u ON u.USID = rm.createUserId
|
LEFT JOIN ts_user AS u ON u.USID = rm.createUserId
|
||||||
LEFT JOIN ts_org as org on org.id = rm.department
|
LEFT JOIN ts_org as org on org.id = rm.department
|
||||||
LEFT JOIN ts_file as f on rm.fileId=f.file_id
|
LEFT JOIN ts_report_file rf on rf.report_id = rm.id and rf.state = 2
|
||||||
|
LEFT JOIN ts_file f on f.FILE_ID = rf.file_id
|
||||||
WHERE rm.id = #{reportId}
|
WHERE rm.id = #{reportId}
|
||||||
AND rm.del_flag = 0
|
AND rm.del_flag = 0
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectDDL" resultType="com.adc.da.report.eo.ReportEntity">
|
<select id="selectDDL" resultType="com.adc.da.report.eo.ReportEntity">
|
||||||
SELECT * FROM tt_report_manage WHERE secrecy_last <= NOW()
|
SELECT * FROM tt_report_manage WHERE secrecy_last <= NOW()
|
||||||
</select>
|
</select>
|
||||||
|
|||||||
@@ -21,6 +21,6 @@
|
|||||||
<select id="selectIdByReport" resultType="java.lang.String">
|
<select id="selectIdByReport" resultType="java.lang.String">
|
||||||
select rl.label_id from
|
select rl.label_id from
|
||||||
ts_report_label rl
|
ts_report_label rl
|
||||||
where rl.report_id = #{reportId}
|
where rl.report_id = #{reportId} and rl.state =#{state}
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
<result column="department" property="department" />
|
<result column="department" property="department" />
|
||||||
<result column="departmentName" property="departmentName" />
|
<result column="departmentName" property="departmentName" />
|
||||||
<result column="year" property="year" />
|
<result column="year" property="year" />
|
||||||
<result column="fileId" property="fileId" />
|
|
||||||
<result column="confidentialLevel" property="confidentialLevel" />
|
<result column="confidentialLevel" property="confidentialLevel" />
|
||||||
<result column="privacyLevel" property="privacyLevel" />
|
<result column="privacyLevel" property="privacyLevel" />
|
||||||
<result column="createUserId" property="createUserId" />
|
<result column="createUserId" property="createUserId" />
|
||||||
@@ -23,7 +22,11 @@
|
|||||||
<result column="updateDate" property="updateDate" />
|
<result column="updateDate" property="updateDate" />
|
||||||
<result column="del_flag" property="delFlag" />
|
<result column="del_flag" property="delFlag" />
|
||||||
<result column="secrecy_last" property="secrecyLast" />
|
<result column="secrecy_last" property="secrecyLast" />
|
||||||
<result column="file_name" property="fileName" />
|
<collection property="fileList" ofType="com.adc.da.report.eo.ReportFile">
|
||||||
|
<result column="fileId" property="fileId" />
|
||||||
|
<result column="fileName" property="fileName" />
|
||||||
|
<result column="rfId" property="id" />
|
||||||
|
</collection>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<!--表名信息-->
|
<!--表名信息-->
|
||||||
@@ -34,9 +37,9 @@
|
|||||||
<!-- 通用查询结果列 -->
|
<!-- 通用查询结果列 -->
|
||||||
<sql id="BaseColumnList">
|
<sql id="BaseColumnList">
|
||||||
id,
|
id,
|
||||||
task_id, prc_id, data_id,report_id ,name, keycontent, maincontent, department, year, fileId, confidentialLevel,
|
task_id, prc_id, data_id,report_id ,name, keycontent, maincontent, department, year, confidentialLevel,
|
||||||
privacyLevel, createUserId, createDate, updateDate, del_flag
|
privacyLevel, createUserId, createDate, updateDate, del_flag
|
||||||
,secrecy_last,file_name
|
,secrecy_last
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<!-- 查询条件 -->
|
<!-- 查询条件 -->
|
||||||
@@ -71,9 +74,6 @@
|
|||||||
<if test="pageVO.year !=null and pageVO.year !=''">
|
<if test="pageVO.year !=null and pageVO.year !=''">
|
||||||
AND year LIKE CONCAT(CONCAT('%',#{pageVO.year}),'%')
|
AND year LIKE CONCAT(CONCAT('%',#{pageVO.year}),'%')
|
||||||
</if>
|
</if>
|
||||||
<if test="pageVO.fileId !=null and pageVO.fileId !=''">
|
|
||||||
AND fileId LIKE CONCAT(CONCAT('%',#{pageVO.fileId}),'%')
|
|
||||||
</if>
|
|
||||||
<if test="pageVO.confidentialLevel !=null and pageVO.confidentialLevel !=''">
|
<if test="pageVO.confidentialLevel !=null and pageVO.confidentialLevel !=''">
|
||||||
AND confidentialLevel LIKE CONCAT(CONCAT('%',#{pageVO.confidentialLevel}),'%')
|
AND confidentialLevel LIKE CONCAT(CONCAT('%',#{pageVO.confidentialLevel}),'%')
|
||||||
</if>
|
</if>
|
||||||
@@ -133,12 +133,16 @@
|
|||||||
<select id="selectByDataId" resultMap="BaseResultMap">
|
<select id="selectByDataId" resultMap="BaseResultMap">
|
||||||
SELECT
|
SELECT
|
||||||
a.id,
|
a.id,
|
||||||
task_id, prc_id, data_id,report_id, name, keycontent, maincontent, department,
|
task_id, prc_id, data_id,a.report_id, name, keycontent, maincontent, department,
|
||||||
org.LONG_NAME as departmentName,
|
org.LONG_NAME as departmentName,
|
||||||
year, fileId, confidentialLevel, privacyLevel, createUserId, createDate, updateDate, del_flag
|
year,f.FILE_ID as fileId, f.file_name as fileName ,rf.id as rfId, confidentialLevel, privacyLevel, createUserId,
|
||||||
,secrecy_last,file_name
|
createDate,
|
||||||
|
updateDate, a.del_flag
|
||||||
|
,secrecy_last
|
||||||
FROM <include refid="TableName"/> a
|
FROM <include refid="TableName"/> a
|
||||||
LEFT JOIN ts_org org on a.department = org.id
|
LEFT JOIN ts_org org on a.department = org.id
|
||||||
|
LEFT JOIN ts_report_file rf on rf.report_id = a.data_id and rf.state = 1
|
||||||
|
LEFT JOIN ts_file f on f.FILE_ID = rf.file_id
|
||||||
<where>
|
<where>
|
||||||
data_id = #{dataId}
|
data_id = #{dataId}
|
||||||
</where>
|
</where>
|
||||||
@@ -146,12 +150,16 @@
|
|||||||
<select id="selectByPrcId" resultMap="BaseResultMap">
|
<select id="selectByPrcId" resultMap="BaseResultMap">
|
||||||
SELECT
|
SELECT
|
||||||
a.id,
|
a.id,
|
||||||
task_id, prc_id, data_id,report_id, name, keycontent, maincontent, department,
|
task_id, prc_id, data_id,a.report_id, name, keycontent, maincontent, department,
|
||||||
org.LONG_NAME as departmentName,
|
org.LONG_NAME as departmentName,
|
||||||
year, fileId, confidentialLevel, privacyLevel, createUserId, createDate, updateDate, del_flag
|
year,f.FILE_ID as fileId, f.file_name as fileName ,rf.id as rfId ,confidentialLevel, privacyLevel, createUserId,
|
||||||
,secrecy_last,file_name
|
createDate,
|
||||||
|
updateDate, a.del_flag
|
||||||
|
,secrecy_last
|
||||||
FROM <include refid="TableName"/> a
|
FROM <include refid="TableName"/> a
|
||||||
LEFT JOIN ts_org org on a.department = org.id
|
LEFT JOIN ts_org org on a.department = org.id
|
||||||
|
LEFT JOIN ts_report_file rf on rf.report_id = a.data_id and rf.state = 1
|
||||||
|
LEFT JOIN ts_file f on f.FILE_ID = rf.file_id
|
||||||
<where>
|
<where>
|
||||||
prc_id = #{prcId}
|
prc_id = #{prcId}
|
||||||
</where>
|
</where>
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ public class DictItemController {
|
|||||||
*/
|
*/
|
||||||
@ApiOperation(value = "修改数据字典记录")
|
@ApiOperation(value = "修改数据字典记录")
|
||||||
@PutMapping("/edit")
|
@PutMapping("/edit")
|
||||||
public ResponseMessage edit(@RequestBody DictItemVo dictItemVo) {
|
public ResponseMessage edit(@Valid @RequestBody DictItemVo dictItemVo) {
|
||||||
return dictItemService.edit(dictItemVo);
|
return dictItemService.edit(dictItemVo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,7 +66,7 @@ public class DictItemController {
|
|||||||
*/
|
*/
|
||||||
@ApiOperation(value = "新增数据字典记录")
|
@ApiOperation(value = "新增数据字典记录")
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
public ResponseMessage add(@RequestBody DictItemVo dictItemVo) {
|
public ResponseMessage add(@Valid @RequestBody DictItemVo dictItemVo) {
|
||||||
return dictItemService.add(dictItemVo);
|
return dictItemService.add(dictItemVo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,4 +17,6 @@ public interface OrgEODao extends BaseMapper<OrgEO> {
|
|||||||
IPage<OrgEO> selectPageByVO(Page<OrgEO> page,@Param("pageVO")OrgEOPage orgEOPage);
|
IPage<OrgEO> selectPageByVO(Page<OrgEO> page,@Param("pageVO")OrgEOPage orgEOPage);
|
||||||
|
|
||||||
long selectCountByOrgCode(@Param("pageVO")OrgEO orgEO);
|
long selectCountByOrgCode(@Param("pageVO")OrgEO orgEO);
|
||||||
|
|
||||||
|
List<OrgEO> selectNameAll(OrgEO orgEO);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,4 +50,7 @@ public interface UserEODao extends BaseMapper<UserEO> {
|
|||||||
List<UserEO> getOwnLeader(@Param("Vo") List<OrgEO> orgEOList);
|
List<UserEO> getOwnLeader(@Param("Vo") List<OrgEO> orgEOList);
|
||||||
|
|
||||||
long listCount(@Param("account") String account, @Param("roleName") String roleName);
|
long listCount(@Param("account") String account, @Param("roleName") String roleName);
|
||||||
|
|
||||||
|
List<String> selectAccout();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,6 +46,12 @@ public class OrgEO extends BaseEntity implements Serializable {
|
|||||||
@TableField("PARENT_ID")
|
@TableField("PARENT_ID")
|
||||||
private String ParentID;
|
private String ParentID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 父部门 编码
|
||||||
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String ParentCode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 部门路径
|
* 部门路径
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -62,6 +62,11 @@ public class DictItemServiceImpl extends ServiceImpl<DictItemDao, DictItemEntity
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseMessage edit(DictItemVo dictItemVo) {
|
public ResponseMessage edit(DictItemVo dictItemVo) {
|
||||||
|
//判断传入的选项名是否重复
|
||||||
|
if (dictItemNameDuplicate(dictItemVo.getItemName())) {
|
||||||
|
return Result.error("重复选项名");
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
DictItemEntity dictItemEntity = new DictItemEntity();
|
DictItemEntity dictItemEntity = new DictItemEntity();
|
||||||
BeanUtil.copyProperties(dictItemVo, dictItemEntity);
|
BeanUtil.copyProperties(dictItemVo, dictItemEntity);
|
||||||
@@ -89,6 +94,11 @@ public class DictItemServiceImpl extends ServiceImpl<DictItemDao, DictItemEntity
|
|||||||
return Result.success("删除成功");
|
return Result.success("删除成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean dictItemNameDuplicate(String dictItemName) {
|
||||||
|
List<DictItemEntity> item = query().like("item_name", dictItemName).list();
|
||||||
|
return item.size() > 0;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseMessage add(DictItemVo dictItemVo) {
|
public ResponseMessage add(DictItemVo dictItemVo) {
|
||||||
//判断上级字典id是否存在
|
//判断上级字典id是否存在
|
||||||
@@ -100,7 +110,10 @@ public class DictItemServiceImpl extends ServiceImpl<DictItemDao, DictItemEntity
|
|||||||
if (dictEntity == null) {
|
if (dictEntity == null) {
|
||||||
return Result.error("上级字典id无效");
|
return Result.error("上级字典id无效");
|
||||||
}
|
}
|
||||||
|
//判断传入的选项名是否重复
|
||||||
|
if (dictItemNameDuplicate(dictItemVo.getItemName())) {
|
||||||
|
return Result.error("重复选项名");
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
DictItemEntity dictItemEntity = BeanCopyUtils.copyBean(dictItemVo, DictItemEntity.class);
|
DictItemEntity dictItemEntity = BeanCopyUtils.copyBean(dictItemVo, DictItemEntity.class);
|
||||||
dictItemEntity.setId(UUID.randomUUID10())
|
dictItemEntity.setId(UUID.randomUUID10())
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import cn.hutool.json.JSONUtil;
|
|||||||
import com.adc.da.sys.constant.SsoConstants;
|
import com.adc.da.sys.constant.SsoConstants;
|
||||||
import com.adc.da.sys.constant.SysConstants;
|
import com.adc.da.sys.constant.SysConstants;
|
||||||
import com.adc.da.sys.constant.UserBelongEnum;
|
import com.adc.da.sys.constant.UserBelongEnum;
|
||||||
|
import com.adc.da.sys.dao.mysql.OrgEODao;
|
||||||
import com.adc.da.sys.dao.mysql.UserEODao;
|
import com.adc.da.sys.dao.mysql.UserEODao;
|
||||||
import com.adc.da.sys.dao.mysql.UserOrgEODao;
|
import com.adc.da.sys.dao.mysql.UserOrgEODao;
|
||||||
import com.adc.da.sys.dao.mysql.UserRoleEODao;
|
import com.adc.da.sys.dao.mysql.UserRoleEODao;
|
||||||
@@ -29,6 +30,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.apache.ibatis.binding.MapperMethod;
|
import org.apache.ibatis.binding.MapperMethod;
|
||||||
import org.apache.ibatis.session.SqlSession;
|
import org.apache.ibatis.session.SqlSession;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
@@ -67,6 +69,9 @@ public class UserEOServiceImpl implements IUserEoService {
|
|||||||
@Resource
|
@Resource
|
||||||
private UserOrgEODao userOrgEODao;
|
private UserOrgEODao userOrgEODao;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private OrgEODao orgEODao;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private RoleEOService roleEOService;
|
private RoleEOService roleEOService;
|
||||||
|
|
||||||
@@ -366,9 +371,11 @@ public class UserEOServiceImpl implements IUserEoService {
|
|||||||
List<UserImportVO> userEOArrayList = dataMap.get(key);
|
List<UserImportVO> userEOArrayList = dataMap.get(key);
|
||||||
ArrayList<UserEO> addList = new ArrayList<>();
|
ArrayList<UserEO> addList = new ArrayList<>();
|
||||||
ArrayList<UserRoleEO> addRoleList = new ArrayList<>();
|
ArrayList<UserRoleEO> addRoleList = new ArrayList<>();
|
||||||
|
ArrayList<UserOrgEO> addOrgList = new ArrayList<>();
|
||||||
userEOArrayList.forEach(userImportVO -> {
|
userEOArrayList.forEach(userImportVO -> {
|
||||||
UserEO userEO = new UserEO();
|
UserEO userEO = new UserEO();
|
||||||
BeanUtils.copyProperties(userImportVO, userEO);
|
BeanUtils.copyProperties(userImportVO, userEO);
|
||||||
|
userEO.setUsid(UUID.randomUUID().toString().replace("-",""));
|
||||||
userEO.setDelFlag(0);
|
userEO.setDelFlag(0);
|
||||||
userEO.setIsSelf(UserBelongEnum.LOCAL.getValue());
|
userEO.setIsSelf(UserBelongEnum.LOCAL.getValue());
|
||||||
userEO.setUsid(com.adc.da.util.utils.UUID.randomUUID10());
|
userEO.setUsid(com.adc.da.util.utils.UUID.randomUUID10());
|
||||||
@@ -379,7 +386,16 @@ public class UserEOServiceImpl implements IUserEoService {
|
|||||||
userEO.setUpdateTime(simpleDateFormat.format(date));
|
userEO.setUpdateTime(simpleDateFormat.format(date));
|
||||||
userEO.setRoleId(userImportVO.getRoleId());
|
userEO.setRoleId(userImportVO.getRoleId());
|
||||||
addList.add(userEO);
|
addList.add(userEO);
|
||||||
|
//部门
|
||||||
|
if (StringUtils.isNotEmpty(userImportVO.getOrgId())){
|
||||||
|
String[] split = userImportVO.getOrgId().split(",");
|
||||||
|
for (String s : split) {
|
||||||
|
UserOrgEO userOrgEO = new UserOrgEO();
|
||||||
|
userOrgEO.setUserId(userEO.getUsid());
|
||||||
|
userOrgEO.setOrgId(s);
|
||||||
|
addOrgList.add(userOrgEO);
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
saveBatch(addList);
|
saveBatch(addList);
|
||||||
//添加角色
|
//添加角色
|
||||||
@@ -391,6 +407,9 @@ public class UserEOServiceImpl implements IUserEoService {
|
|||||||
addRoleList.add(userRoleEO);
|
addRoleList.add(userRoleEO);
|
||||||
});
|
});
|
||||||
userRoleEODao.insertBatch(addRoleList);
|
userRoleEODao.insertBatch(addRoleList);
|
||||||
|
if (addOrgList.size()>0){
|
||||||
|
userOrgEODao.insertBatch(addOrgList);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
//更新
|
//更新
|
||||||
@@ -398,6 +417,7 @@ public class UserEOServiceImpl implements IUserEoService {
|
|||||||
List<UserImportVO> userEOArrayList = dataMap.get(key);
|
List<UserImportVO> userEOArrayList = dataMap.get(key);
|
||||||
ArrayList<String> userIDList = new ArrayList<>();
|
ArrayList<String> userIDList = new ArrayList<>();
|
||||||
ArrayList<UserRoleEO> userRoleList = new ArrayList<>();
|
ArrayList<UserRoleEO> userRoleList = new ArrayList<>();
|
||||||
|
ArrayList<UserOrgEO> addOrgList = new ArrayList<>();
|
||||||
userEOArrayList.forEach(userImportVO -> {
|
userEOArrayList.forEach(userImportVO -> {
|
||||||
QueryWrapper<UserEO> queryWrapper = new QueryWrapper();
|
QueryWrapper<UserEO> queryWrapper = new QueryWrapper();
|
||||||
queryWrapper.eq("ACCOUNT", userImportVO.getAccount());
|
queryWrapper.eq("ACCOUNT", userImportVO.getAccount());
|
||||||
@@ -414,12 +434,28 @@ public class UserEOServiceImpl implements IUserEoService {
|
|||||||
userRoleEO.setUserId(userEO.getUsid());
|
userRoleEO.setUserId(userEO.getUsid());
|
||||||
userRoleEO.setRoleId(userImportVO.getRoleId());
|
userRoleEO.setRoleId(userImportVO.getRoleId());
|
||||||
userRoleList.add(userRoleEO);
|
userRoleList.add(userRoleEO);
|
||||||
|
|
||||||
|
if (StringUtils.isNotEmpty(userImportVO.getOrgId())){
|
||||||
|
String[] split = userImportVO.getOrgId().split(",");
|
||||||
|
for (String s : split) {
|
||||||
|
UserOrgEO userOrgEO = new UserOrgEO();
|
||||||
|
userOrgEO.setUserId(userEO.getUsid());
|
||||||
|
userOrgEO.setOrgId(s);
|
||||||
|
addOrgList.add(userOrgEO);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
QueryWrapper<UserRoleEO> deleteWapper = new QueryWrapper<>();
|
QueryWrapper<UserRoleEO> deleteWapper = new QueryWrapper<>();
|
||||||
deleteWapper.in("user_id", userIDList);
|
deleteWapper.in("user_id", userIDList);
|
||||||
userRoleEODao.delete(deleteWapper);
|
userRoleEODao.delete(deleteWapper);
|
||||||
userRoleEODao.insertBatch(userRoleList);
|
userRoleEODao.insertBatch(userRoleList);
|
||||||
|
|
||||||
|
//保存用户部门关系表
|
||||||
|
userOrgEODao.deleteBatchByUserIds(userIDList);
|
||||||
|
if (addOrgList.size()>0){
|
||||||
|
userOrgEODao.insertBatch(addOrgList);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -503,6 +539,8 @@ public class UserEOServiceImpl implements IUserEoService {
|
|||||||
return user.getAccount();
|
return user.getAccount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void checkExcel(List<UserImportVO> list) {
|
void checkExcel(List<UserImportVO> list) {
|
||||||
if (CollectionUtils.isEmpty(list)) {
|
if (CollectionUtils.isEmpty(list)) {
|
||||||
throw new AdcDaBaseException("数据不能为空");
|
throw new AdcDaBaseException("数据不能为空");
|
||||||
@@ -516,25 +554,27 @@ public class UserEOServiceImpl implements IUserEoService {
|
|||||||
//所有用户
|
//所有用户
|
||||||
List<String> existUserAccounts = new ArrayList<>();
|
List<String> existUserAccounts = new ArrayList<>();
|
||||||
List<String> existUserAccountsUpdate = new ArrayList<>();
|
List<String> existUserAccountsUpdate = new ArrayList<>();
|
||||||
QueryWrapper<UserEO> queryWrapper = new QueryWrapper<>();
|
List<String> accoutList = dao.selectAccout();
|
||||||
queryWrapper.eq("del_flag", 0);
|
existUserAccounts = accoutList;
|
||||||
List<UserEO> allUsers = dao.selectList(queryWrapper);
|
existUserAccountsUpdate = accoutList;
|
||||||
for (UserEO userEO : allUsers) {
|
//所有部门
|
||||||
existUserAccounts.add(userEO.getAccount());
|
List<OrgEO> orgEOList = orgEODao.selectNameAll(new OrgEO());
|
||||||
existUserAccountsUpdate.add(userEO.getAccount());
|
Map<String, OrgEO> orgEOMap = orgEOList.stream().collect(Collectors.toMap(OrgEO::getLongName, e -> e,
|
||||||
}
|
(k1,k2)->k1));
|
||||||
|
|
||||||
|
|
||||||
for (int i = 0; i < list.size(); i++) {
|
for (int i = 0; i < list.size(); i++) {
|
||||||
UserImportVO userImportVO = list.get(i);
|
UserImportVO userImportVO = list.get(i);
|
||||||
if (StringUtils.isEmpty(userImportVO.getAccount())) {
|
if (StringUtils.isEmpty(userImportVO.getAccount())) {
|
||||||
throw new AdcDaBaseException("第"+(i+1)+"行"+"用户名不能为空");
|
throw new AdcDaBaseException("第"+(i+1)+"行"+"用户名不能为空");
|
||||||
}
|
}
|
||||||
|
if (userImportVO.getAccount().length() > 20) {
|
||||||
|
throw new AdcDaBaseException("第"+(i+1)+"行"+"用户名不能超过20字符");
|
||||||
|
}
|
||||||
if (StringUtils.isEmpty(userImportVO.getUsname())) {
|
if (StringUtils.isEmpty(userImportVO.getUsname())) {
|
||||||
throw new AdcDaBaseException("第"+(i+1)+"行"+"姓名不能为空");
|
throw new AdcDaBaseException("第"+(i+1)+"行"+"姓名不能为空");
|
||||||
}
|
}
|
||||||
if (userImportVO.getUsname().length() > 20) {
|
if (userImportVO.getUsname().length() > 20) {
|
||||||
throw new AdcDaBaseException("第"+(i+1)+"行"+"姓名不超过20字符");
|
throw new AdcDaBaseException("第"+(i+1)+"行"+"姓名不能超过20字符");
|
||||||
}
|
}
|
||||||
if ("admin".equals(userImportVO.getAccount()) ||
|
if ("admin".equals(userImportVO.getAccount()) ||
|
||||||
"root".equals(userImportVO.getAccount()) ||
|
"root".equals(userImportVO.getAccount()) ||
|
||||||
@@ -544,11 +584,31 @@ public class UserEOServiceImpl implements IUserEoService {
|
|||||||
throw new AdcDaBaseException("第"+(i+1)+"行"+"用户名不符合规则");
|
throw new AdcDaBaseException("第"+(i+1)+"行"+"用户名不符合规则");
|
||||||
}
|
}
|
||||||
if (StringUtils.isNotBlank(userImportVO.getEmail())) {
|
if (StringUtils.isNotBlank(userImportVO.getEmail())) {
|
||||||
|
if (userImportVO.getEmail().length() > 50 ) {
|
||||||
|
throw new AdcDaBaseException("第"+(i+1)+"行"+"邮箱长度不能超过50");
|
||||||
|
}
|
||||||
|
if (!(userImportVO.getEmail().matches("^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\\.[a-zA-Z0-9_-]+)+$"))) {
|
||||||
|
throw new AdcDaBaseException("第"+(i+1)+"行"+"邮箱不符合规则!");
|
||||||
|
}
|
||||||
userImportVO.setEmail(userImportVO.getEmail().replace("amp;", ""));
|
userImportVO.setEmail(userImportVO.getEmail().replace("amp;", ""));
|
||||||
}
|
}
|
||||||
if (StringUtils.isNotBlank(userImportVO.getCellPhoneNumber())) {
|
if (StringUtils.isNotBlank(userImportVO.getCellPhoneNumber())) {
|
||||||
if (!userImportVO.getCellPhoneNumber().matches("^[1][3,4,5,7,8,9][0-9]{9}$")) {
|
if (!(userImportVO.getCellPhoneNumber().matches("^(?:\\+86)?-(1[3456789]\\d)\\d{8}$") ||
|
||||||
throw new AdcDaBaseException("第"+(i+1)+"行"+"手机号不符合规则");
|
userImportVO.getCellPhoneNumber().matches("^1(3\\d|4[5-9]|5[0-35-9]|6[56]|7[0135678]|8\\d|9[89])\\d{8}$"))) {
|
||||||
|
throw new AdcDaBaseException("第"+(i+1)+"行"+"手机号不符合规则!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotEmpty(userImportVO.getOrgName())) {
|
||||||
|
userImportVO.setOrgName(userImportVO.getOrgName().replace(",", ","));
|
||||||
|
String[] split = userImportVO.getOrgName().split(",");
|
||||||
|
for (String s : split) {
|
||||||
|
OrgEO orgEO = orgEOMap.get(s);
|
||||||
|
if (orgEO == null){
|
||||||
|
throw new AdcDaBaseException("第"+(i+1)+"行"+s+"部门不存在");
|
||||||
|
}else {
|
||||||
|
userImportVO.setOrgId(StringUtils.isEmpty(userImportVO.getOrgId()) ? orgEO.getId()
|
||||||
|
:userImportVO.getOrgId() + "," + orgEO.getId());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (StringUtils.isEmpty(userImportVO.getOperation())) {
|
if (StringUtils.isEmpty(userImportVO.getOperation())) {
|
||||||
@@ -557,9 +617,15 @@ public class UserEOServiceImpl implements IUserEoService {
|
|||||||
// if (StringUtils.isEmpty(userImportVO.getIsUse())) {
|
// if (StringUtils.isEmpty(userImportVO.getIsUse())) {
|
||||||
// throw new AdcDaBaseException("第"+(i+1)+"行"+"是否启用不能为空");
|
// throw new AdcDaBaseException("第"+(i+1)+"行"+"是否启用不能为空");
|
||||||
// }
|
// }
|
||||||
|
if (StringUtils.isEmpty(userImportVO.getRoleName())){
|
||||||
|
throw new AdcDaBaseException("第"+(i+1)+"行"+"角色:不能为空");
|
||||||
|
}
|
||||||
if (!roleEOMap.keySet().contains(userImportVO.getRoleName())) {
|
if (!roleEOMap.keySet().contains(userImportVO.getRoleName())) {
|
||||||
throw new AdcDaBaseException("第"+(i+1)+"行"+"角色:" + userImportVO.getRoleName() + "不存在,请检查");
|
throw new AdcDaBaseException("第"+(i+1)+"行"+"角色:" + userImportVO.getRoleName() + "不存在,请检查");
|
||||||
}
|
}
|
||||||
|
if(StringUtils.isNotEmpty(userImportVO.getOperation()) && !"add".equals(userImportVO.getOperation()) && !"full".equals(userImportVO.getOperation())){
|
||||||
|
throw new AdcDaBaseException("第"+(i+1)+"行"+"操作(add添加、full覆盖角色)只能填写add和full");
|
||||||
|
}
|
||||||
if ("add".equals(userImportVO.getOperation())) {
|
if ("add".equals(userImportVO.getOperation())) {
|
||||||
if (existUserAccounts.contains(userImportVO.getAccount())) {
|
if (existUserAccounts.contains(userImportVO.getAccount())) {
|
||||||
throw new AdcDaBaseException("第"+(i+1)+"行"+"用户名:" + userImportVO.getAccount() + "已存在,请检查");
|
throw new AdcDaBaseException("第"+(i+1)+"行"+"用户名:" + userImportVO.getAccount() + "已存在,请检查");
|
||||||
@@ -573,8 +639,6 @@ public class UserEOServiceImpl implements IUserEoService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
userImportVO.setRoleId(roleEOMap.get(userImportVO.getRoleName()).getId());
|
userImportVO.setRoleId(roleEOMap.get(userImportVO.getRoleName()).getId());
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ import lombok.AllArgsConstructor;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author CaiHaohan
|
* @author CaiHaohan
|
||||||
*/
|
*/
|
||||||
@@ -40,6 +42,7 @@ public class DictItemVo {
|
|||||||
/**
|
/**
|
||||||
* 排序
|
* 排序
|
||||||
*/
|
*/
|
||||||
|
@NotNull(message = "缺少排序字段")
|
||||||
private Double itemOrder;
|
private Double itemOrder;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,6 +37,14 @@ public class UserImportVO {
|
|||||||
@Excel(name = "邮箱", width = 20)
|
@Excel(name = "邮箱", width = 20)
|
||||||
private String email;
|
private String email;
|
||||||
|
|
||||||
|
|
||||||
|
private String orgId;
|
||||||
|
/**
|
||||||
|
* 部门
|
||||||
|
*/
|
||||||
|
@Excel(name = "部门", width = 20)
|
||||||
|
private String orgName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建时间
|
* 创建时间
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -32,9 +32,27 @@
|
|||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
<select id="selectPageByVO" resultType="com.adc.da.sys.entity.OrgEO">
|
<select id="selectPageByVO" resultType="com.adc.da.sys.entity.OrgEO">
|
||||||
select * from TS_ORG
|
select org.* , forg.DEPARTMENT_CODE as ParentCode from TS_ORG org
|
||||||
|
LEFT JOIN TS_ORG forg on org.PARENT_ID = forg.id
|
||||||
<where>
|
<where>
|
||||||
<include refid="Base_Where_Clause"/>
|
<if test="pageVO.departmentCode != null and pageVO.DepartmentCode !=''">
|
||||||
|
and org.DEPARTMENT_CODE LIKE CONCAT(CONCAT('%',#{pageVO.departmentCode}),'%')
|
||||||
|
</if>
|
||||||
|
<if test="pageVO.longName != null and pageVO.longName != ''">
|
||||||
|
and org.LONG_NAME LIKE CONCAT(CONCAT('%',#{pageVO.longName}) ,'%')
|
||||||
|
</if>
|
||||||
|
<if test="pageVO.level != null">
|
||||||
|
and org.LEVEL = #{pageVO.level}
|
||||||
|
</if>
|
||||||
|
<if test="pageVO.parentId != null and pageVO.parentId !=''">
|
||||||
|
and org.PARENT_ID = #{pageVO.parentId}
|
||||||
|
</if>
|
||||||
|
<if test="pageVO.attribution != null and pageVO.attribution != ''">
|
||||||
|
and org.ATTRIBUTION = #{pageVO.attribution}
|
||||||
|
</if>
|
||||||
|
<if test="pageVO.bmdm14 != null and pageVO.bmdm14 != ''">
|
||||||
|
and org.BMDM_14 = #{pageVO.bmdm14}
|
||||||
|
</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
<select id="selectCountByOrgCode" resultType="java.lang.Long">
|
<select id="selectCountByOrgCode" resultType="java.lang.Long">
|
||||||
@@ -48,4 +66,7 @@
|
|||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
<select id="selectNameAll" resultType="com.adc.da.sys.entity.OrgEO">
|
||||||
|
select ID as id,LONG_NAME as LongName from TS_ORG
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -290,6 +290,10 @@
|
|||||||
and u.del_flag = 0
|
and u.del_flag = 0
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
<select id="selectAccout" resultType="java.lang.String">
|
||||||
|
select ACCOUNT as account from ts_user
|
||||||
|
where del_flag = 0
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
Binary file not shown.
+35
-3
@@ -1,12 +1,15 @@
|
|||||||
package com.adc.da.wkflow.business_activiti.service;
|
package com.adc.da.wkflow.business_activiti.service;
|
||||||
|
|
||||||
import com.adc.da.report.dao.mysql.PowerApplyActDao;
|
import com.adc.da.report.dao.mysql.PowerApplyActDao;
|
||||||
|
import com.adc.da.report.dao.mysql.ReportFileDao;
|
||||||
import com.adc.da.report.dao.mysql.ReportLabelDao;
|
import com.adc.da.report.dao.mysql.ReportLabelDao;
|
||||||
import com.adc.da.report.dao.mysql.TtReportManageActDao;
|
import com.adc.da.report.dao.mysql.TtReportManageActDao;
|
||||||
import com.adc.da.report.eo.PowerApplyAct;
|
import com.adc.da.report.eo.PowerApplyAct;
|
||||||
|
import com.adc.da.report.eo.ReportFile;
|
||||||
import com.adc.da.report.eo.ReportLabelEntity;
|
import com.adc.da.report.eo.ReportLabelEntity;
|
||||||
import com.adc.da.report.eo.TtReportManageAct;
|
import com.adc.da.report.eo.TtReportManageAct;
|
||||||
import com.adc.da.report.service.IPowerApplyActService;
|
import com.adc.da.report.service.IPowerApplyActService;
|
||||||
|
import com.adc.da.report.service.IReportFileService;
|
||||||
import com.adc.da.report.service.IReportLabelService;
|
import com.adc.da.report.service.IReportLabelService;
|
||||||
import com.adc.da.report.service.ITtReportManageActService;
|
import com.adc.da.report.service.ITtReportManageActService;
|
||||||
import com.adc.da.util.exception.AdcDaBaseException;
|
import com.adc.da.util.exception.AdcDaBaseException;
|
||||||
@@ -19,7 +22,10 @@ import org.slf4j.LoggerFactory;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class ActivitDefineService {
|
public class ActivitDefineService {
|
||||||
@@ -42,7 +48,11 @@ public class ActivitDefineService {
|
|||||||
private ReportLabelDao reportLabelDao;
|
private ReportLabelDao reportLabelDao;
|
||||||
@Autowired
|
@Autowired
|
||||||
private IReportLabelService iReportLabelService;
|
private IReportLabelService iReportLabelService;
|
||||||
|
@Autowired
|
||||||
|
private IReportFileService iReportFileService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ReportFileDao reportFileDao;
|
||||||
//保存data数据
|
//保存data数据
|
||||||
public String saveOrUpdateDate(String prcType, String dataJson,String taskId,String prcId,String reportId) {
|
public String saveOrUpdateDate(String prcType, String dataJson,String taskId,String prcId,String reportId) {
|
||||||
if (StringUtils.isBlank(reportId)){
|
if (StringUtils.isBlank(reportId)){
|
||||||
@@ -110,11 +120,22 @@ public class ActivitDefineService {
|
|||||||
JSONArray objects = JSONObject.parseArray(label);
|
JSONArray objects = JSONObject.parseArray(label);
|
||||||
String lastLabel =(String)objects.get(objects.size()-1);
|
String lastLabel =(String)objects.get(objects.size()-1);
|
||||||
ReportLabelEntity reportLabelEntity = new ReportLabelEntity(com.adc.da.util.utils.UUID.randomUUID10()
|
ReportLabelEntity reportLabelEntity = new ReportLabelEntity(com.adc.da.util.utils.UUID.randomUUID10()
|
||||||
,ttReportManageAct.getDataId(), label,lastLabel);
|
,ttReportManageAct.getDataId(), label,lastLabel,1);
|
||||||
labelList.add(reportLabelEntity);
|
labelList.add(reportLabelEntity);
|
||||||
}
|
}
|
||||||
iReportLabelService.saveBatch(labelList);
|
iReportLabelService.saveBatch(labelList);
|
||||||
}
|
}
|
||||||
|
// 文件
|
||||||
|
reportFileDao.delByReportId(new ReportFile(reportId,1));
|
||||||
|
List<ReportFile> reportFiles = new ArrayList<>();
|
||||||
|
for (ReportFile reportFile : ttReportManageAct.getFileList()) {
|
||||||
|
reportFile.setId(UUID.randomUUID().toString().replace("-",""));
|
||||||
|
reportFile.setReportId(ttReportManageAct.getDataId());
|
||||||
|
// reportFile.setFileId(s);
|
||||||
|
reportFile.setState(1);
|
||||||
|
reportFiles.add(reportFile);
|
||||||
|
}
|
||||||
|
iReportFileService.saveBatch(reportFiles);
|
||||||
}else if ("5".equals(prcType)){
|
}else if ("5".equals(prcType)){
|
||||||
// 编辑
|
// 编辑
|
||||||
TtReportManageAct ttReportManageAct = JSONObject.parseObject(dataJson, TtReportManageAct.class);
|
TtReportManageAct ttReportManageAct = JSONObject.parseObject(dataJson, TtReportManageAct.class);
|
||||||
@@ -133,11 +154,22 @@ public class ActivitDefineService {
|
|||||||
JSONArray objects = JSONObject.parseArray(label);
|
JSONArray objects = JSONObject.parseArray(label);
|
||||||
String lastLabel =(String)objects.get(objects.size()-1);
|
String lastLabel =(String)objects.get(objects.size()-1);
|
||||||
ReportLabelEntity reportLabelEntity = new ReportLabelEntity(com.adc.da.util.utils.UUID.randomUUID10()
|
ReportLabelEntity reportLabelEntity = new ReportLabelEntity(com.adc.da.util.utils.UUID.randomUUID10()
|
||||||
,ttReportManageAct.getDataId(), label,lastLabel);
|
,ttReportManageAct.getDataId(), label,lastLabel,1);
|
||||||
labelList.add(reportLabelEntity);
|
labelList.add(reportLabelEntity);
|
||||||
}
|
}
|
||||||
iReportLabelService.saveBatch(labelList);
|
iReportLabelService.saveBatch(labelList);
|
||||||
}
|
}
|
||||||
|
// 文件
|
||||||
|
reportFileDao.delByReportId(new ReportFile(reportId,1));
|
||||||
|
List<ReportFile> reportFiles = new ArrayList<>();
|
||||||
|
for (ReportFile reportFile : ttReportManageAct.getFileList()) {
|
||||||
|
reportFile.setId(UUID.randomUUID().toString().replace("-",""));
|
||||||
|
reportFile.setReportId(ttReportManageAct.getDataId());
|
||||||
|
// reportFile.setFileId(s);
|
||||||
|
reportFile.setState(1);
|
||||||
|
reportFiles.add(reportFile);
|
||||||
|
}
|
||||||
|
iReportFileService.saveBatch(reportFiles);
|
||||||
}else {
|
}else {
|
||||||
throw new AdcDaBaseException("没有流程类型"+prcType);
|
throw new AdcDaBaseException("没有流程类型"+prcType);
|
||||||
}
|
}
|
||||||
|
|||||||
+39
-10
@@ -2,11 +2,9 @@ package com.adc.da.wkflow.business_activiti.task;
|
|||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.adc.da.login.util.UserUtils;
|
import com.adc.da.login.util.UserUtils;
|
||||||
import com.adc.da.report.dao.mysql.PowerApplyActDao;
|
import com.adc.da.report.dao.mysql.*;
|
||||||
import com.adc.da.report.dao.mysql.ReportDao;
|
|
||||||
import com.adc.da.report.dao.mysql.TreeLabelDao;
|
|
||||||
import com.adc.da.report.dao.mysql.TtReportManageActDao;
|
|
||||||
import com.adc.da.report.eo.ReportEntity;
|
import com.adc.da.report.eo.ReportEntity;
|
||||||
|
import com.adc.da.report.eo.ReportFile;
|
||||||
import com.adc.da.report.eo.TtReportManageAct;
|
import com.adc.da.report.eo.TtReportManageAct;
|
||||||
import com.adc.da.report.vo.PowerApplyActPageVO;
|
import com.adc.da.report.vo.PowerApplyActPageVO;
|
||||||
import com.adc.da.sys.service.iservice.IUserEoService;
|
import com.adc.da.sys.service.iservice.IUserEoService;
|
||||||
@@ -87,6 +85,9 @@ public class TodoTaskController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private TtReportManageActDao ttReportManageActDao;
|
private TtReportManageActDao ttReportManageActDao;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ReportFileDao reportFileDao;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ReportDao reportDao;
|
private ReportDao reportDao;
|
||||||
|
|
||||||
@@ -209,8 +210,10 @@ public class TodoTaskController {
|
|||||||
String taskId = entry.getValue().get(0).get("id").toString();
|
String taskId = entry.getValue().get(0).get("id").toString();
|
||||||
if (busProcessName != null) {
|
if (busProcessName != null) {
|
||||||
ReportEntity reportEntity = this.selectReport(busProcessName.getPrcType(),busProcessName.getDataId());
|
ReportEntity reportEntity = this.selectReport(busProcessName.getPrcType(),busProcessName.getDataId());
|
||||||
busProcessName.setConfidentialLevel(reportEntity.getConfidentialLevel());
|
if(reportEntity != null){
|
||||||
busProcessName.setPrivacyLevel(reportEntity.getPrivacyLevel());
|
busProcessName.setConfidentialLevel(reportEntity.getConfidentialLevel());
|
||||||
|
busProcessName.setPrivacyLevel(reportEntity.getPrivacyLevel());
|
||||||
|
}
|
||||||
busProcessName.setTaskId(taskId);
|
busProcessName.setTaskId(taskId);
|
||||||
busProcessName.setTaskInfo(entry.getValue().get(0).get("name").toString());
|
busProcessName.setTaskInfo(entry.getValue().get(0).get("name").toString());
|
||||||
busProcessName.setTaskDefinitionKey(entry.getValue().get(0).get("taskDefinitionKey").toString());
|
busProcessName.setTaskDefinitionKey(entry.getValue().get(0).get("taskDefinitionKey").toString());
|
||||||
@@ -619,8 +622,21 @@ public class TodoTaskController {
|
|||||||
}else {
|
}else {
|
||||||
ttReportManageAct = ttReportManageActDao.selectByPrcId(pId);
|
ttReportManageAct = ttReportManageActDao.selectByPrcId(pId);
|
||||||
}
|
}
|
||||||
List<String> labelList = treeLableDao.selectIdByReport(ttReportManageAct.getDataId());
|
// 为空说明流程已经结束
|
||||||
ttReportManageAct.setLabelList(labelList);
|
if (ttReportManageAct.getFileList().size() == 0){
|
||||||
|
List<ReportFile> reportFiles =
|
||||||
|
reportFileDao.selectByReport(new ReportFile(ttReportManageAct.getDataId(),2));
|
||||||
|
ttReportManageAct.setFileList(reportFiles);
|
||||||
|
}
|
||||||
|
List<String> labelList = treeLableDao.selectIdByReport(ttReportManageAct.getDataId(),1);
|
||||||
|
if (labelList.size()>0){
|
||||||
|
//流程未结束
|
||||||
|
ttReportManageAct.setLabelList(labelList);
|
||||||
|
}else {
|
||||||
|
//流程已结束
|
||||||
|
labelList = treeLableDao.selectIdByReport(ttReportManageAct.getDataId(),2);
|
||||||
|
ttReportManageAct.setLabelList(labelList);
|
||||||
|
}
|
||||||
String string = JSONArray.toJSONString(ttReportManageAct);
|
String string = JSONArray.toJSONString(ttReportManageAct);
|
||||||
//去对应的 数据表查数据
|
//去对应的 数据表查数据
|
||||||
busProcessNewVO.setDataJson(string);
|
busProcessNewVO.setDataJson(string);
|
||||||
@@ -633,8 +649,21 @@ public class TodoTaskController {
|
|||||||
}else {
|
}else {
|
||||||
ttReportManageAct = ttReportManageActDao.selectByPrcId(pId);
|
ttReportManageAct = ttReportManageActDao.selectByPrcId(pId);
|
||||||
}
|
}
|
||||||
List<String> labelList = treeLableDao.selectIdByReport(ttReportManageAct.getDataId());
|
// 为空说明流程已经结束
|
||||||
ttReportManageAct.setLabelList(labelList);
|
if (ttReportManageAct.getFileList().size() == 0){
|
||||||
|
List<ReportFile> reportFiles =
|
||||||
|
reportFileDao.selectByReport(new ReportFile(ttReportManageAct.getDataId(),2));
|
||||||
|
ttReportManageAct.setFileList(reportFiles);
|
||||||
|
}
|
||||||
|
List<String> labelList = treeLableDao.selectIdByReport(ttReportManageAct.getDataId(),1);
|
||||||
|
if (labelList.size()>0){
|
||||||
|
//流程未结束
|
||||||
|
ttReportManageAct.setLabelList(labelList);
|
||||||
|
}else {
|
||||||
|
//流程已结束
|
||||||
|
labelList = treeLableDao.selectIdByReport(ttReportManageAct.getDataId(),2);
|
||||||
|
ttReportManageAct.setLabelList(labelList);
|
||||||
|
}
|
||||||
String string = JSONArray.toJSONString(ttReportManageAct);
|
String string = JSONArray.toJSONString(ttReportManageAct);
|
||||||
//去对应的 数据表查数据
|
//去对应的 数据表查数据
|
||||||
busProcessNewVO.setDataJson(string);
|
busProcessNewVO.setDataJson(string);
|
||||||
|
|||||||
Reference in New Issue
Block a user