update
This commit is contained in:
@@ -227,7 +227,7 @@ jeecg:
|
|||||||
#webapp文件路径
|
#webapp文件路径
|
||||||
webapp: /opt/webapp
|
webapp: /opt/webapp
|
||||||
shiro:
|
shiro:
|
||||||
excludeUrls: /sys/common/upload,/sys/user/**,/test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**,/bigscreen/category/**,/bigscreen/visual/**,/bigscreen/map/**,/jmreport/bigscreen2/**
|
excludeUrls: /database/experimentDoc/**,/sys/common/upload,/sys/user/**,/test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**,/bigscreen/category/**,/bigscreen/visual/**,/bigscreen/map/**,/jmreport/bigscreen2/**
|
||||||
#阿里云oss存储和大鱼短信秘钥配置
|
#阿里云oss存储和大鱼短信秘钥配置
|
||||||
oss:
|
oss:
|
||||||
accessKey: ??
|
accessKey: ??
|
||||||
|
|||||||
@@ -1,25 +1,35 @@
|
|||||||
package org.jeecg.modules.database.controller;
|
package org.jeecg.modules.database.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.io.FileUtil;
|
||||||
|
import cn.hutool.http.HttpUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
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 io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.media.ExampleObject;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.jeecg.common.api.vo.Result;
|
import org.jeecg.common.api.vo.Result;
|
||||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||||
import org.jeecg.common.system.base.controller.JeecgController;
|
import org.jeecg.common.system.base.controller.JeecgController;
|
||||||
import org.jeecg.common.system.query.QueryGenerator;
|
import org.jeecg.common.system.query.QueryGenerator;
|
||||||
import org.jeecg.modules.database.entity.ExperimentDoc;
|
import org.jeecg.modules.database.entity.ExperimentDoc;
|
||||||
|
import org.jeecg.modules.database.entity.ExperimentReport;
|
||||||
import org.jeecg.modules.database.service.IExperimentDocService;
|
import org.jeecg.modules.database.service.IExperimentDocService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.util.FileCopyUtils;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.io.*;
|
||||||
|
import java.net.URLDecoder;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: 试验文档
|
* @Description: 试验文档
|
||||||
@@ -134,6 +144,74 @@ public class ExperimentDocController extends JeecgController<ExperimentDoc, IExp
|
|||||||
return Result.OK(experimentDoc);
|
return Result.OK(experimentDoc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过实验id查询
|
||||||
|
*
|
||||||
|
* @param experimentalId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
//@AutoLog(value = "试验评定-通过id查询")
|
||||||
|
@Operation(summary = "试验报告-通过实验ID查询")
|
||||||
|
@GetMapping(value = "/queryByExperimentId")
|
||||||
|
public Result<List<ExperimentDoc>> queryByExperimentalId(@RequestParam(name = "experimentId", required = true) String experimentalId) {
|
||||||
|
LambdaQueryWrapper<ExperimentDoc> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(ExperimentDoc::getExperimentId, experimentalId);
|
||||||
|
List<ExperimentDoc> experimentReview = experimentDocService.list(queryWrapper);
|
||||||
|
if (experimentReview == null) {
|
||||||
|
return Result.error("未找到对应数据");
|
||||||
|
}
|
||||||
|
return Result.OK(experimentReview);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 试验文档下载
|
||||||
|
*
|
||||||
|
* @param experimentId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
//@AutoLog(value = "试验评定-通过id查询")
|
||||||
|
@Operation(summary = "试验文档下载", parameters = {
|
||||||
|
@Parameter(name = "experimentId", description = "实验id", required = true),
|
||||||
|
@Parameter(name = "type", description = "文档类型(辐照试验计划表,试验报告评审表,设备使用记录表,试验报告,辐照试验总结单)",
|
||||||
|
required = true),
|
||||||
|
})
|
||||||
|
@GetMapping(value = "/download")
|
||||||
|
public Result<ExperimentDoc> download(@RequestParam(name = "experimentId", required = true) String experimentId,
|
||||||
|
@RequestParam(name = "type", required = true) String type, HttpServletResponse response) {
|
||||||
|
LambdaQueryWrapper<ExperimentDoc> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(ExperimentDoc::getExperimentId, experimentId);
|
||||||
|
queryWrapper.eq(ExperimentDoc::getDocType, type);
|
||||||
|
ExperimentDoc doc = experimentDocService.getOne(queryWrapper);
|
||||||
|
if (Objects.isNull(doc)) {
|
||||||
|
doc = experimentDocService.generate(experimentId, type);
|
||||||
|
}
|
||||||
|
if (Objects.isNull(doc)) {
|
||||||
|
return Result.error("试验文档生成失败");
|
||||||
|
}
|
||||||
|
return Result.OK(doc);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重新生成试验文档
|
||||||
|
*
|
||||||
|
* @param experimentId
|
||||||
|
* @param type
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Operation(summary = "重新生成试验文档", parameters = {
|
||||||
|
@Parameter(name = "experimentId", description = "实验id", required = true),
|
||||||
|
@Parameter(name = "type", description = "文档类型", required = true),
|
||||||
|
})
|
||||||
|
@GetMapping(value = "/generate")
|
||||||
|
public Result<ExperimentDoc> generate(@RequestParam(name = "experimentId", required = true) String experimentId,
|
||||||
|
@RequestParam(name = "type", required = true) String type) {
|
||||||
|
ExperimentDoc experimentReview = experimentDocService.generate(experimentId, type);
|
||||||
|
if (Objects.isNull(experimentReview)) {
|
||||||
|
return Result.error("试验文档生成失败");
|
||||||
|
}
|
||||||
|
return Result.OK(experimentReview);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出excel
|
* 导出excel
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
import org.springframework.web.servlet.ModelAndView;
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: 试验报告
|
* @Description: 试验报告
|
||||||
@@ -161,15 +162,16 @@ public class ExperimentReportController extends JeecgController<ExperimentReport
|
|||||||
//@AutoLog(value = "试验评定-通过id查询")
|
//@AutoLog(value = "试验评定-通过id查询")
|
||||||
@Operation(summary = "试验报告-通过实验ID查询")
|
@Operation(summary = "试验报告-通过实验ID查询")
|
||||||
@GetMapping(value = "/queryByExperimentId")
|
@GetMapping(value = "/queryByExperimentId")
|
||||||
public Result<ExperimentReport> queryByExperimentalId(@RequestParam(name = "experimentId", required = true) String experimentalId) {
|
public Result<List<ExperimentReport>> queryByExperimentalId(@RequestParam(name = "experimentId", required = true) String experimentalId) {
|
||||||
LambdaQueryWrapper<ExperimentReport> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<ExperimentReport> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
queryWrapper.eq(ExperimentReport::getExperimentId, experimentalId);
|
queryWrapper.eq(ExperimentReport::getExperimentId, experimentalId);
|
||||||
ExperimentReport experimentReview = experimentReportService.getOne(queryWrapper);
|
List<ExperimentReport> experimentReview = experimentReportService.list(queryWrapper);
|
||||||
if (experimentReview == null) {
|
if (experimentReview == null) {
|
||||||
return Result.error("未找到对应数据");
|
return Result.error("未找到对应数据");
|
||||||
}
|
}
|
||||||
return Result.OK(experimentReview);
|
return Result.OK(experimentReview);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出excel
|
* 导出excel
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ public class ExperimentDoc implements Serializable {
|
|||||||
* 文档类型
|
* 文档类型
|
||||||
*/
|
*/
|
||||||
@Excel(name = "文档类型", width = 15)
|
@Excel(name = "文档类型", width = 15)
|
||||||
@Schema(description = "文档类型")
|
@Schema(description = "文档类型", allowableValues = "辐照试验计划表,试验报告评审表,设备使用记录表,试验报告,辐照试验总结单")
|
||||||
private String docType;
|
private String docType;
|
||||||
/**
|
/**
|
||||||
* 文件地址
|
* 文件地址
|
||||||
|
|||||||
@@ -11,4 +11,6 @@ import org.jeecg.modules.database.entity.ExperimentDoc;
|
|||||||
*/
|
*/
|
||||||
public interface IExperimentDocService extends IService<ExperimentDoc> {
|
public interface IExperimentDocService extends IService<ExperimentDoc> {
|
||||||
|
|
||||||
|
ExperimentDoc generate(String experimentId, String type);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ import cn.hutool.core.io.FileUtil;
|
|||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.deepoove.poi.XWPFTemplate;
|
import com.deepoove.poi.XWPFTemplate;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.jeecg.common.util.MinioUtil;
|
||||||
import org.jeecg.modules.database.entity.ExperimentDoc;
|
import org.jeecg.modules.database.entity.ExperimentDoc;
|
||||||
import org.jeecg.modules.database.mapper.ExperimentDocMapper;
|
import org.jeecg.modules.database.mapper.ExperimentDocMapper;
|
||||||
import org.jeecg.modules.database.service.IExperimentDocService;
|
import org.jeecg.modules.database.service.IExperimentDocService;
|
||||||
@@ -43,7 +45,7 @@ public class ExperimentDocServiceImpl extends ServiceImpl<ExperimentDocMapper, E
|
|||||||
generateExperimentDoc("20241028号实验", "辐照试验计划表", maps);
|
generateExperimentDoc("20241028号实验", "辐照试验计划表", maps);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void generateExperimentDoc(String experimentId, String fileName, Map<String, Object> params) {
|
public static String generateExperimentDoc(String experimentId, String fileName, Map<String, Object> params) {
|
||||||
URL resourceUrl = ExperimentDocServiceImpl.class.getClassLoader().getResource("templates/doc/" + docTempalteMap.get(fileName));
|
URL resourceUrl = ExperimentDocServiceImpl.class.getClassLoader().getResource("templates/doc/" + docTempalteMap.get(fileName));
|
||||||
if (Objects.isNull(resourceUrl)) {
|
if (Objects.isNull(resourceUrl)) {
|
||||||
throw new RuntimeException("模板文件不存在!");
|
throw new RuntimeException("模板文件不存在!");
|
||||||
@@ -60,8 +62,26 @@ public class ExperimentDocServiceImpl extends ServiceImpl<ExperimentDocMapper, E
|
|||||||
log.info("output file path: " + outputFile);
|
log.info("output file path: " + outputFile);
|
||||||
|
|
||||||
XWPFTemplate.compile(absolutePath).render(params).writeToFile(outputFile);
|
XWPFTemplate.compile(absolutePath).render(params).writeToFile(outputFile);
|
||||||
} catch (IOException e) {
|
String path = MinioUtil.upload(FileUtil.getInputStream(outputFile),
|
||||||
throw new RuntimeException(e);
|
"experiment_doc/" + experimentId + "/" + fileName + ".docx");
|
||||||
|
return path;
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(e.getMessage());
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ExperimentDoc generate(String experimentalId, String type) {
|
||||||
|
String filePath = generateExperimentDoc(experimentalId, type, new HashMap<>());
|
||||||
|
if (StringUtils.isNotBlank(filePath)) {
|
||||||
|
ExperimentDoc experimentDoc = new ExperimentDoc();
|
||||||
|
experimentDoc.setExperimentId(experimentalId);
|
||||||
|
experimentDoc.setDocType(type);
|
||||||
|
experimentDoc.setFilePath(filePath);
|
||||||
|
this.save(experimentDoc);
|
||||||
|
return experimentDoc;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
2316
scripts/nasa_data_record.sql
Normal file
2316
scripts/nasa_data_record.sql
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user