|
@@ -16,9 +16,9 @@ import com.example.opc_common.util.Result;
|
|
|
import com.example.opc_common.util.XlsxToPdfUtil;
|
|
|
import com.example.opc_da.annotation.WebLog;
|
|
|
import com.example.opc_da.base.BaseController;
|
|
|
+import com.example.opc_da.config.FilePathConfig;
|
|
|
import com.example.opc_da.service.ReportTableService;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
-import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
@@ -34,11 +34,8 @@ import java.util.Map;
|
|
|
@Slf4j
|
|
|
public class ReportTableController extends BaseController {
|
|
|
|
|
|
- @Value("${file.path}")
|
|
|
- private String filePath;
|
|
|
-
|
|
|
- @Value("${file.pdf-delete-days:1}")
|
|
|
- private Integer pdfDeleteDays;
|
|
|
+ @Resource
|
|
|
+ private FilePathConfig filePathConfig;
|
|
|
|
|
|
@Resource
|
|
|
private ReportTableService reportTableService;
|
|
@@ -186,7 +183,7 @@ public class ReportTableController extends BaseController {
|
|
|
TableTemplate tableTemplateEntity = reportTableService.getTableTemplateEntityById(id);
|
|
|
Result result = reportTableService.delTableTemplateById(id, isDelete);
|
|
|
// 记录业务操作日志
|
|
|
- insertOperationLog(ModelEnum.TABLETEMPLATE,OperationEnum.DELETE,tableTemplateEntity.getTemplateName() + "@" + id, result.getCode());
|
|
|
+ insertOperationLog(ModelEnum.TABLETEMPLATE, OperationEnum.DELETE, tableTemplateEntity.getTemplateName() + "@" + id, result.getCode());
|
|
|
return result;
|
|
|
}
|
|
|
|
|
@@ -266,7 +263,7 @@ public class ReportTableController extends BaseController {
|
|
|
ReportTable reportTableNoDataEntity = reportTableService.getReportTableNoDataEntityById(id);
|
|
|
Result result = reportTableService.delReportTableById(id);
|
|
|
// 记录业务操作日志
|
|
|
- insertOperationLog(ModelEnum.RUNSETUP,OperationEnum.DELETE,reportTableNoDataEntity.getReportTableName() + "@" + id, result.getCode());
|
|
|
+ insertOperationLog(ModelEnum.RUNSETUP, OperationEnum.DELETE, reportTableNoDataEntity.getReportTableName() + "@" + id, result.getCode());
|
|
|
return result;
|
|
|
}
|
|
|
|
|
@@ -288,14 +285,14 @@ public class ReportTableController extends BaseController {
|
|
|
List<ReportTable> reportTableNoDataEntityList = reportTableService.getReportTableNoDataEntityByIds(idList);
|
|
|
Result result = reportTableService.delChReportTableList(idList);
|
|
|
String content = "";
|
|
|
- for (ReportTable reportTable: reportTableNoDataEntityList) {
|
|
|
+ for (ReportTable reportTable : reportTableNoDataEntityList) {
|
|
|
content += ";" + reportTable.getReportTableName() + "@" + reportTable.getId();
|
|
|
}
|
|
|
- if(content.length() > 0){
|
|
|
+ if (content.length() > 0) {
|
|
|
content = content.substring(1);
|
|
|
}
|
|
|
// 记录业务操作日志
|
|
|
- insertOperationLog(ModelEnum.RUNSETUP,OperationEnum.DELETE, content, result.getCode());
|
|
|
+ insertOperationLog(ModelEnum.RUNSETUP, OperationEnum.DELETE, content, result.getCode());
|
|
|
return result;
|
|
|
}
|
|
|
|
|
@@ -330,12 +327,12 @@ public class ReportTableController extends BaseController {
|
|
|
setBeginTime();
|
|
|
// 刷新采集器
|
|
|
Result result = reportTableService.runAutoTableById(id, 1);
|
|
|
- if(StrUtil.isEmpty(reportTableName)){
|
|
|
+ if (StrUtil.isEmpty(reportTableName)) {
|
|
|
ReportTable reportTableNoDataEntity = reportTableService.getReportTableNoDataEntityById(id);
|
|
|
reportTableName = reportTableNoDataEntity.getReportTableName();
|
|
|
}
|
|
|
// 记录业务操作日志
|
|
|
- insertOperationLog(ModelEnum.RUNSETUP,OperationEnum.RUN,reportTableName + "@" + id, result.getCode());
|
|
|
+ insertOperationLog(ModelEnum.RUNSETUP, OperationEnum.RUN, reportTableName + "@" + id, result.getCode());
|
|
|
return result;
|
|
|
}
|
|
|
|
|
@@ -355,12 +352,12 @@ public class ReportTableController extends BaseController {
|
|
|
setBeginTime();
|
|
|
// 刷新采集器
|
|
|
Result result = reportTableService.runAutoTableById(id, 0);
|
|
|
- if(StrUtil.isEmpty(reportTableName)){
|
|
|
+ if (StrUtil.isEmpty(reportTableName)) {
|
|
|
ReportTable reportTableNoDataEntity = reportTableService.getReportTableNoDataEntityById(id);
|
|
|
reportTableName = reportTableNoDataEntity.getReportTableName();
|
|
|
}
|
|
|
// 记录业务操作日志
|
|
|
- insertOperationLog(ModelEnum.RUNSETUP,OperationEnum.STOPIT,reportTableName + "@" + id, result.getCode());
|
|
|
+ insertOperationLog(ModelEnum.RUNSETUP, OperationEnum.STOPIT, reportTableName + "@" + id, result.getCode());
|
|
|
return result;
|
|
|
}
|
|
|
|
|
@@ -475,10 +472,12 @@ public class ReportTableController extends BaseController {
|
|
|
@PostMapping("/xlsToPdf")
|
|
|
@WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.RUNSETUP, OperationEnum = OperationEnum.UPLOAD)
|
|
|
public Result xlsToPdf(PageSetupEntity pageSetupEntity) {
|
|
|
+ String filePath = filePathConfig.getFilePathAddRootPath();
|
|
|
+ Integer pdfDeleteDays = filePathConfig.getPdfDeleteDays();
|
|
|
String fileName = XlsxToPdfUtil.convert(pageSetupEntity, filePath);
|
|
|
try {
|
|
|
XlsxToPdfUtil.deleteFileDate(FileUtil.file(filePath + fileName).getParentFile(), pdfDeleteDays);
|
|
|
- }catch (Exception e){
|
|
|
+ } catch (Exception e) {
|
|
|
log.error("清理" + pdfDeleteDays + "天前的pdf打印临时文件失败", e);
|
|
|
}
|
|
|
return Result.ok(fileName);
|
|
@@ -501,12 +500,13 @@ public class ReportTableController extends BaseController {
|
|
|
|
|
|
/**
|
|
|
* 通过报表id获取报表、用户组、用户关系(分享功能)
|
|
|
+ *
|
|
|
* @param reportTableId 报表id
|
|
|
* @return
|
|
|
*/
|
|
|
@GetMapping("/getTableUserGroupUserList")
|
|
|
@WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.RUNSETUP, OperationEnum = OperationEnum.SELECT)
|
|
|
- public Result getTableUserGroupUserList(String reportTableId){
|
|
|
+ public Result getTableUserGroupUserList(String reportTableId) {
|
|
|
if (Blank.isEmpty(reportTableId)) {
|
|
|
return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "reportTableId不能为空");
|
|
|
}
|