修改文件模版位置
This commit is contained in:
@ -226,7 +226,8 @@ public class EqpMachineryDetailServiceImpl extends ServiceImpl<EqpMachineryDetai
|
||||
* @return 机械详情视图对象
|
||||
*/
|
||||
@Override
|
||||
public EqpMachineryDetailVo getVo(EqpMachineryDetail machineryDetail) {// 对象转封装类
|
||||
public EqpMachineryDetailVo getVo(EqpMachineryDetail machineryDetail) {
|
||||
// 对象转封装类
|
||||
EqpMachineryDetailVo machineryDetailVo = new EqpMachineryDetailVo();
|
||||
if (machineryDetail == null) {
|
||||
return machineryDetailVo;
|
||||
|
@ -40,4 +40,6 @@ public class MatMaterialsGisVo implements Serializable {
|
||||
*/
|
||||
private Long outCount;
|
||||
|
||||
private Integer value;
|
||||
|
||||
}
|
||||
|
@ -23,8 +23,8 @@ import org.dromara.materials.domain.req.materials.MatMaterialsCreateReq;
|
||||
import org.dromara.materials.domain.req.materials.MatMaterialsGisReq;
|
||||
import org.dromara.materials.domain.req.materials.MatMaterialsQueryReq;
|
||||
import org.dromara.materials.domain.req.materials.MatMaterialsUpdateReq;
|
||||
import org.dromara.materials.domain.vo.materials.MatMaterialsVo;
|
||||
import org.dromara.materials.domain.vo.materials.MatMaterialsGisVo;
|
||||
import org.dromara.materials.domain.vo.materials.MatMaterialsVo;
|
||||
import org.dromara.materials.mapper.MatMaterialsMapper;
|
||||
import org.dromara.materials.service.IMatCompanyService;
|
||||
import org.dromara.materials.service.IMatMaterialsInventoryService;
|
||||
@ -124,6 +124,7 @@ public class MatMaterialsServiceImpl extends ServiceImpl<MatMaterialsMapper, Mat
|
||||
.eq(MatMaterialsInventory::getProjectId, projectId).list();
|
||||
Map<Long, List<MatMaterialsInventory>> inventoryMap = materialsInventoryList.stream()
|
||||
.collect(Collectors.groupingBy(MatMaterialsInventory::getMaterialsId));
|
||||
final int[] value = {1};
|
||||
return materialsList.stream().map(materials -> {
|
||||
MatMaterialsGisVo materialsGisVo = new MatMaterialsGisVo();
|
||||
BeanUtils.copyProperties(materials, materialsGisVo);
|
||||
@ -142,6 +143,8 @@ public class MatMaterialsServiceImpl extends ServiceImpl<MatMaterialsMapper, Mat
|
||||
}
|
||||
materialsGisVo.setPutCount(putCount);
|
||||
materialsGisVo.setOutCount(outCount);
|
||||
materialsGisVo.setValue(value[0]);
|
||||
value[0] += 1;
|
||||
return materialsGisVo;
|
||||
}).toList();
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ public interface QltQualityConstant {
|
||||
|
||||
String QUALITY_INSPECTION_STATUS_TYPE = "quality_inspection_status_type";
|
||||
|
||||
String QUALITY_CONSTRUCTION_LOG_TEMPLATE_PATH = "docs/template/施工日志模版.docx";
|
||||
String QUALITY_CONSTRUCTION_LOG_TEMPLATE_PATH = "template/施工日志模版.docx";
|
||||
|
||||
String QUALITY_CONSTRUCTION_LOG_FILE_URL = "docs/quality/constructionLog/";
|
||||
|
||||
@ -30,7 +30,7 @@ public interface QltQualityConstant {
|
||||
return String.format("施工日志(%s).docx", createDate);
|
||||
}
|
||||
|
||||
String QUALITY_INSPECTION_TEMPLATE_PATH = "docs/template/整改通知单模版.docx";
|
||||
String QUALITY_INSPECTION_TEMPLATE_PATH = "template/整改通知单模版.docx";
|
||||
|
||||
String QUALITY_INSPECTION_FILE_URL = "docs/quality/inspection/";
|
||||
|
||||
|
@ -20,6 +20,7 @@ import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.oss.core.OssClient;
|
||||
import org.dromara.common.oss.exception.OssException;
|
||||
import org.dromara.common.oss.factory.OssFactory;
|
||||
import org.dromara.common.satoken.utils.LoginHelper;
|
||||
import org.dromara.project.domain.BusProject;
|
||||
import org.dromara.project.service.IBusProjectService;
|
||||
import org.dromara.quality.constant.QltQualityConstant;
|
||||
@ -40,9 +41,9 @@ import org.springframework.http.MediaType;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
@ -180,8 +181,12 @@ public class QltQualityConstructionLogServiceImpl extends ServiceImpl<QltQuality
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
Long userId = LoginHelper.getUserId();
|
||||
List<QltQualityConstructionLog> qualityConstructionLogList = this.listByIds(ids);
|
||||
if (isValid) {
|
||||
// TODO 做一些业务上的校验,判断是否需要校验
|
||||
List<Long> projectId = qualityConstructionLogList.stream().map(QltQualityConstructionLog::getProjectId).toList();
|
||||
projectService.validAuth(projectId, userId);
|
||||
}
|
||||
return this.removeBatchByIds(ids);
|
||||
}
|
||||
@ -329,36 +334,42 @@ public class QltQualityConstructionLogServiceImpl extends ServiceImpl<QltQuality
|
||||
String baseUrl = QltQualityConstant.QUALITY_CONSTRUCTION_LOG_FILE_URL + qualityConstructionLog.getId();
|
||||
try {
|
||||
Path dirPath = Paths.get(baseUrl);
|
||||
FileUtils.deleteDirectory(dirPath);
|
||||
if (Files.exists(dirPath)) {
|
||||
FileUtils.deleteDirectory(dirPath);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.error("文件目录:{},清理失败", baseUrl, e);
|
||||
}
|
||||
// 生成文件
|
||||
try (FileInputStream fis = new FileInputStream(QltQualityConstant.QUALITY_CONSTRUCTION_LOG_TEMPLATE_PATH);
|
||||
XWPFDocument document = new XWPFDocument(fis)) {
|
||||
// 替换段落中的文本
|
||||
for (XWPFParagraph paragraph : document.getParagraphs()) {
|
||||
replaceInParagraph(paragraph, replacementMap, document, qualityConstructionLog);
|
||||
try (InputStream is = getClass().getClassLoader().getResourceAsStream(QltQualityConstant.QUALITY_CONSTRUCTION_LOG_TEMPLATE_PATH)) {
|
||||
if (is == null) {
|
||||
throw new ServiceException("模板文件不存在");
|
||||
}
|
||||
// 替换表格中的文本(如果模板中有表格)
|
||||
for (XWPFTable table : document.getTables()) {
|
||||
for (XWPFTableRow row : table.getRows()) {
|
||||
for (XWPFTableCell cell : row.getTableCells()) {
|
||||
for (XWPFParagraph paragraph : cell.getParagraphs()) {
|
||||
replaceInParagraph(paragraph, replacementMap, document, qualityConstructionLog);
|
||||
try (XWPFDocument document = new XWPFDocument(is)) {
|
||||
// 替换段落中的文本
|
||||
for (XWPFParagraph paragraph : document.getParagraphs()) {
|
||||
replaceInParagraph(paragraph, replacementMap, document, qualityConstructionLog);
|
||||
}
|
||||
// 替换表格中的文本(如果模板中有表格)
|
||||
for (XWPFTable table : document.getTables()) {
|
||||
for (XWPFTableRow row : table.getRows()) {
|
||||
for (XWPFTableCell cell : row.getTableCells()) {
|
||||
for (XWPFParagraph paragraph : cell.getParagraphs()) {
|
||||
replaceInParagraph(paragraph, replacementMap, document, qualityConstructionLog);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 创建目标目录
|
||||
if (!Files.exists(targetDir)) {
|
||||
Files.createDirectories(targetDir);
|
||||
}
|
||||
// 组合目标文件名
|
||||
String fileName = QltQualityConstant.getQualityConstructionLogFileName(qualityConstructionLog);
|
||||
// 保存修改后的文件
|
||||
try (FileOutputStream fos = new FileOutputStream(targetDir.resolve(fileName).toFile())) {
|
||||
document.write(fos);
|
||||
// 创建目标目录
|
||||
if (!Files.exists(targetDir)) {
|
||||
Files.createDirectories(targetDir);
|
||||
}
|
||||
// 组合目标文件名
|
||||
String fileName = QltQualityConstant.getQualityConstructionLogFileName(qualityConstructionLog);
|
||||
// 保存修改后的文件
|
||||
try (FileOutputStream fos = new FileOutputStream(targetDir.resolve(fileName).toFile())) {
|
||||
document.write(fos);
|
||||
}
|
||||
}
|
||||
} catch (IOException | InvalidFormatException e) {
|
||||
throw new OssException("生成Word文件失败,错误信息: " + e.getMessage());
|
||||
|
@ -33,9 +33,9 @@ import org.dromara.quality.domain.req.qualityinspection.QltQualityInspectionCrea
|
||||
import org.dromara.quality.domain.req.qualityinspection.QltQualityInspectionGisReq;
|
||||
import org.dromara.quality.domain.req.qualityinspection.QltQualityInspectionQueryReq;
|
||||
import org.dromara.quality.domain.req.qualityinspection.QltQualityInspectionUpdateReq;
|
||||
import org.dromara.quality.domain.vo.qualityinspection.QltQualityInspectionVo;
|
||||
import org.dromara.quality.domain.vo.qualityinspection.QltQualityInspectionGis;
|
||||
import org.dromara.quality.domain.vo.qualityinspection.QltQualityInspectionListGisVo;
|
||||
import org.dromara.quality.domain.vo.qualityinspection.QltQualityInspectionVo;
|
||||
import org.dromara.quality.mapper.QltQualityInspectionMapper;
|
||||
import org.dromara.quality.service.IQltQualityInspectionService;
|
||||
import org.dromara.system.domain.vo.SysOssVo;
|
||||
@ -49,9 +49,9 @@ import org.springframework.http.MediaType;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
@ -433,36 +433,42 @@ public class QltQualityInspectionServiceImpl extends ServiceImpl<QltQualityInspe
|
||||
String baseUrl = QltQualityConstant.QUALITY_INSPECTION_FILE_URL + qualityInspection.getId();
|
||||
try {
|
||||
Path dirPath = Paths.get(baseUrl);
|
||||
FileUtils.deleteDirectory(dirPath);
|
||||
if (Files.exists(dirPath)) {
|
||||
FileUtils.deleteDirectory(dirPath);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.error("文件目录:{},清理失败", baseUrl, e);
|
||||
}
|
||||
// 生成文件
|
||||
try (FileInputStream fis = new FileInputStream(QltQualityConstant.QUALITY_INSPECTION_TEMPLATE_PATH);
|
||||
XWPFDocument document = new XWPFDocument(fis)) {
|
||||
// 替换段落中的文本
|
||||
for (XWPFParagraph paragraph : document.getParagraphs()) {
|
||||
replaceInParagraph(paragraph, replacementMap, document, qualityInspection);
|
||||
try (InputStream is = getClass().getClassLoader().getResourceAsStream(QltQualityConstant.QUALITY_INSPECTION_TEMPLATE_PATH)) {
|
||||
if (is == null) {
|
||||
throw new ServiceException("模板文件不存在");
|
||||
}
|
||||
// 替换表格中的文本(如果模板中有表格)
|
||||
for (XWPFTable table : document.getTables()) {
|
||||
for (XWPFTableRow row : table.getRows()) {
|
||||
for (XWPFTableCell cell : row.getTableCells()) {
|
||||
for (XWPFParagraph paragraph : cell.getParagraphs()) {
|
||||
replaceInParagraph(paragraph, replacementMap, document, qualityInspection);
|
||||
try (XWPFDocument document = new XWPFDocument(is)) {
|
||||
// 替换段落中的文本
|
||||
for (XWPFParagraph paragraph : document.getParagraphs()) {
|
||||
replaceInParagraph(paragraph, replacementMap, document, qualityInspection);
|
||||
}
|
||||
// 替换表格中的文本(如果模板中有表格)
|
||||
for (XWPFTable table : document.getTables()) {
|
||||
for (XWPFTableRow row : table.getRows()) {
|
||||
for (XWPFTableCell cell : row.getTableCells()) {
|
||||
for (XWPFParagraph paragraph : cell.getParagraphs()) {
|
||||
replaceInParagraph(paragraph, replacementMap, document, qualityInspection);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 创建目标目录
|
||||
if (!Files.exists(targetDir)) {
|
||||
Files.createDirectories(targetDir);
|
||||
}
|
||||
// 组合目标文件名
|
||||
String fileName = QltQualityConstant.getQualityInspectionFileName(qualityInspection);
|
||||
// 保存修改后的文件
|
||||
try (FileOutputStream fos = new FileOutputStream(targetDir.resolve(fileName).toFile())) {
|
||||
document.write(fos);
|
||||
// 创建目标目录
|
||||
if (!Files.exists(targetDir)) {
|
||||
Files.createDirectories(targetDir);
|
||||
}
|
||||
// 组合目标文件名
|
||||
String fileName = QltQualityConstant.getQualityInspectionFileName(qualityInspection);
|
||||
// 保存修改后的文件
|
||||
try (FileOutputStream fos = new FileOutputStream(targetDir.resolve(fileName).toFile())) {
|
||||
document.write(fos);
|
||||
}
|
||||
}
|
||||
} catch (IOException | InvalidFormatException e) {
|
||||
throw new OssException("生成Word文件失败,错误信息: " + e.getMessage());
|
||||
|
@ -19,7 +19,7 @@ public interface HseSafetyConstant {
|
||||
|
||||
String SAFETY_INSPECTION_FILE_URL = "docs/safety/inspection/";
|
||||
|
||||
String SAFETY_INSPECTION_TEMPLATE_PATH = "docs/template/安全生产监督检查通知书模版.docx";
|
||||
String SAFETY_INSPECTION_TEMPLATE_PATH = "template/安全生产监督检查通知书模版.docx";
|
||||
|
||||
static String getSafetyInspectionFileUrl(HseSafetyInspection safetyInspection) {
|
||||
String timestamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(safetyInspection.getUpdateTime());
|
||||
|
@ -35,8 +35,8 @@ import org.dromara.safety.domain.req.safetyinspection.HseSafetyInspectionCreateR
|
||||
import org.dromara.safety.domain.req.safetyinspection.HseSafetyInspectionGisReq;
|
||||
import org.dromara.safety.domain.req.safetyinspection.HseSafetyInspectionQueryReq;
|
||||
import org.dromara.safety.domain.req.safetyinspection.HseSafetyInspectionUpdateReq;
|
||||
import org.dromara.safety.domain.vo.safetyinspection.HseSafetyInspectionVo;
|
||||
import org.dromara.safety.domain.vo.safetyinspection.HseSafetyInspectionListGisVo;
|
||||
import org.dromara.safety.domain.vo.safetyinspection.HseSafetyInspectionVo;
|
||||
import org.dromara.safety.domain.vo.teammeeting.HseTeamMeetingGis;
|
||||
import org.dromara.safety.mapper.HseSafetyInspectionMapper;
|
||||
import org.dromara.safety.service.IHseSafetyInspectionService;
|
||||
@ -52,9 +52,9 @@ import org.springframework.http.MediaType;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
@ -401,36 +401,42 @@ public class HseSafetyInspectionServiceImpl extends ServiceImpl<HseSafetyInspect
|
||||
String baseUrl = HseSafetyConstant.SAFETY_INSPECTION_FILE_URL + safetyInspection.getId();
|
||||
try {
|
||||
Path dirPath = Paths.get(baseUrl);
|
||||
FileUtils.deleteDirectory(dirPath);
|
||||
if (Files.exists(dirPath)) {
|
||||
FileUtils.deleteDirectory(dirPath);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.error("文件目录:{},清理失败", baseUrl, e);
|
||||
}
|
||||
// 生成文件
|
||||
try (FileInputStream fis = new FileInputStream(HseSafetyConstant.SAFETY_INSPECTION_TEMPLATE_PATH);
|
||||
XWPFDocument document = new XWPFDocument(fis)) {
|
||||
// 替换段落中的文本
|
||||
for (XWPFParagraph paragraph : document.getParagraphs()) {
|
||||
replaceInParagraph(paragraph, replacementMap, document, safetyInspection);
|
||||
try (InputStream is = getClass().getClassLoader().getResourceAsStream(HseSafetyConstant.SAFETY_INSPECTION_TEMPLATE_PATH)) {
|
||||
if (is == null) {
|
||||
throw new ServiceException("模板文件不存在");
|
||||
}
|
||||
// 替换表格中的文本(如果模板中有表格)
|
||||
for (XWPFTable table : document.getTables()) {
|
||||
for (XWPFTableRow row : table.getRows()) {
|
||||
for (XWPFTableCell cell : row.getTableCells()) {
|
||||
for (XWPFParagraph paragraph : cell.getParagraphs()) {
|
||||
replaceInParagraph(paragraph, replacementMap, document, safetyInspection);
|
||||
try (XWPFDocument document = new XWPFDocument(is)) {
|
||||
// 替换段落中的文本
|
||||
for (XWPFParagraph paragraph : document.getParagraphs()) {
|
||||
replaceInParagraph(paragraph, replacementMap, document, safetyInspection);
|
||||
}
|
||||
// 替换表格中的文本(如果模板中有表格)
|
||||
for (XWPFTable table : document.getTables()) {
|
||||
for (XWPFTableRow row : table.getRows()) {
|
||||
for (XWPFTableCell cell : row.getTableCells()) {
|
||||
for (XWPFParagraph paragraph : cell.getParagraphs()) {
|
||||
replaceInParagraph(paragraph, replacementMap, document, safetyInspection);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 创建目标目录
|
||||
if (!Files.exists(targetDir)) {
|
||||
Files.createDirectories(targetDir);
|
||||
}
|
||||
// 组合目标文件名
|
||||
String fileName = HseSafetyConstant.getSafetyInspectionFileName(safetyInspection);
|
||||
// 保存修改后的文件
|
||||
try (FileOutputStream fos = new FileOutputStream(targetDir.resolve(fileName).toFile())) {
|
||||
document.write(fos);
|
||||
// 创建目标目录
|
||||
if (!Files.exists(targetDir)) {
|
||||
Files.createDirectories(targetDir);
|
||||
}
|
||||
// 组合目标文件名
|
||||
String fileName = HseSafetyConstant.getSafetyInspectionFileName(safetyInspection);
|
||||
// 保存修改后的文件
|
||||
try (FileOutputStream fos = new FileOutputStream(targetDir.resolve(fileName).toFile())) {
|
||||
document.write(fos);
|
||||
}
|
||||
}
|
||||
} catch (IOException | InvalidFormatException e) {
|
||||
throw new OssException("生成Word文件失败,错误信息: " + e.getMessage());
|
||||
|
Reference in New Issue
Block a user