This commit is contained in:
ls
2024-11-25 15:39:11 +08:00
parent b63759488e
commit 9bf7033292
12 changed files with 126 additions and 58 deletions

View File

@@ -1,4 +1,4 @@
#FROM bellsoft/liberica-openjdk-debian:17 #FROM bellsoft/liberica-openjdk-debian:17 AS build
FROM registry.cn-shanghai.aliyuncs.com/physical/maven:3.9.8-eclipse-temurin-17 AS build FROM registry.cn-shanghai.aliyuncs.com/physical/maven:3.9.8-eclipse-temurin-17 AS build
WORKDIR /app WORKDIR /app
@@ -11,10 +11,11 @@ COPY settings.xml /root/.m2/settings.xml
ADD . /app ADD . /app
#RUN mvn dependency:go-offline #RUN mvn dependency:go-offline
# RUN mvn package -DskipTests=true clean install
RUN --mount=type=cache,target=/root/.m2 mvn package -DskipTests=true clean install RUN --mount=type=cache,target=/root/.m2 mvn package -DskipTests=true clean install
#FROM bellsoft/liberica-openjdk-debian:17
FROM registry.cn-shanghai.aliyuncs.com/physical/liberica-openjdk-debian:17 FROM registry.cn-shanghai.aliyuncs.com/physical/liberica-openjdk-debian:17
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

View File

@@ -65,15 +65,15 @@ services:
- "28080:8080" - "28080:8080"
networks: networks:
- physical-boot - physical-boot
physical-kkfileview: # physical-kkfileview:
restart: on-failure # restart: on-failure
container_name: physical-kkfileview # container_name: physical-kkfileview
image: registry.cn-shanghai.aliyuncs.com/physical/kkfileview # image: registry.cn-shanghai.aliyuncs.com/physical/kkfileview
hostname: physical-kkfileview # hostname: physical-kkfileview
ports: # ports:
- "8099:8012" # - "81:8012"
networks: # networks:
- physical-boot # - physical-boot
physical-web: physical-web:
container_name: physical-web container_name: physical-web

View File

@@ -65,15 +65,15 @@ services:
- 28080:8080 - 28080:8080
networks: networks:
- physical-boot - physical-boot
physical-kkfileview: # physical-kkfileview:
restart: on-failure # restart: on-failure
container_name: physical-kkfileview # container_name: physical-kkfileview
image: registry.cn-shanghai.aliyuncs.com/physical/kkfileview # image: registry.cn-shanghai.aliyuncs.com/physical/kkfileview
hostname: physical-kkfileview # hostname: physical-kkfileview
ports: # ports:
- 8099:8012 # - 81:8012
networks: # networks:
- physical-boot # - physical-boot
physical-web: physical-web:
container_name: physical-web container_name: physical-web

View File

@@ -0,0 +1,10 @@
package org.jeecg.modules.database.constant;
public interface ExperimentReportStatus {
String INIT = "待校对";
String PROOFREAD_PASS = "待审核";
String AUDIT_PASS = "待批准";
String REJECT = "不通过";
String PASSED = "通过";
}

View File

@@ -84,6 +84,7 @@ public class ExperimentAnnealProcessController extends JeecgController<Experimen
@PostMapping(value = "/add") @PostMapping(value = "/add")
public Result<String> add(@RequestBody ExperimentAnnealProcess experimentAnnealProcess, HttpServletRequest request) { public Result<String> add(@RequestBody ExperimentAnnealProcess experimentAnnealProcess, HttpServletRequest request) {
String experimentId = experimentAnnealProcess.getExperimentId(); String experimentId = experimentAnnealProcess.getExperimentId();
experimentAnnealProcess.setId(null);
if (StringUtils.isBlank(experimentId)) { if (StringUtils.isBlank(experimentId)) {
return Result.error("试验数据不存在!"); return Result.error("试验数据不存在!");
} }

View File

@@ -163,6 +163,9 @@ public class ExperimentController extends JeecgController<Experiment, IExperimen
} }
experimentUserService.saveBatch(userList); experimentUserService.saveBatch(userList);
} }
if (StringUtils.containsAny(experiment.getStatus(), ExperimentStatus.COMPLETED, ExperimentStatus.REPORT_AUDITING)) {
return Result.error("试验状态:[" + experiment.getStatus() + "]不能进行修改!");
}
experimentService.updateById(experiment); experimentService.updateById(experiment);
ExperimentLog experimentLog = new ExperimentLog(); ExperimentLog experimentLog = new ExperimentLog();
experimentLog.setExperimentId(experiment.getId()); experimentLog.setExperimentId(experiment.getId());

View File

@@ -95,6 +95,7 @@ public class ExperimentRadiationProcessController extends JeecgController<Experi
if (StringUtils.containsAny(dbExperiment.getStatus(), ExperimentStatus.COMPLETED, ExperimentStatus.REPORT_AUDITING)) { if (StringUtils.containsAny(dbExperiment.getStatus(), ExperimentStatus.COMPLETED, ExperimentStatus.REPORT_AUDITING)) {
return Result.error("试验状态:[" + dbExperiment.getStatus() + "]不能进行修改!"); return Result.error("试验状态:[" + dbExperiment.getStatus() + "]不能进行修改!");
} }
experimentRadiationProcess.setId(null);
Experiment experiment = new Experiment(); Experiment experiment = new Experiment();
experiment.setId(experimentId); experiment.setId(experimentId);

View File

@@ -1,5 +1,6 @@
package org.jeecg.modules.database.controller; package org.jeecg.modules.database.controller;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjUtil; import cn.hutool.core.util.ObjUtil;
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;
@@ -17,8 +18,7 @@ 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.common.system.util.JwtUtil; import org.jeecg.common.system.util.JwtUtil;
import org.jeecg.common.util.oConvertUtils; import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.database.constant.ExperimentDocType; import org.jeecg.modules.database.constant.*;
import org.jeecg.modules.database.constant.ExperimentStatus;
import org.jeecg.modules.database.entity.*; import org.jeecg.modules.database.entity.*;
import org.jeecg.modules.database.service.*; import org.jeecg.modules.database.service.*;
import org.jeecg.modules.system.entity.SysUser; import org.jeecg.modules.system.entity.SysUser;
@@ -27,8 +27,7 @@ import org.springframework.beans.factory.annotation.Autowired;
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.util.*;
import java.util.Optional;
/** /**
* @Description: 试验报告 * @Description: 试验报告
@@ -97,10 +96,10 @@ public class ExperimentReportController extends JeecgController<ExperimentReport
if (ObjUtil.isNull(experiment)) { if (ObjUtil.isNull(experiment)) {
return Result.error("试验数据不存在!"); return Result.error("试验数据不存在!");
} }
ExperimentReport report = experimentReportService.getByExperimentId(experimentId); //ExperimentReport report = experimentReportService.getByExperimentId(experimentId);
if (ObjUtil.isNotNull(report)) { //if (ObjUtil.isNotNull(report)) {
return Result.error("试验试验报告已存在!"); // return Result.error("试验试验报告已存在!");
} //}
experimentReport.setReportName(experiment.getName() + "-试验报告"); experimentReport.setReportName(experiment.getName() + "-试验报告");
experimentReportService.save(experimentReport); experimentReportService.save(experimentReport);
return Result.OK("添加成功!"); return Result.OK("添加成功!");
@@ -191,15 +190,17 @@ 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> getByExperimentId( public Result<List<ExperimentReport>> getByExperimentId(
@RequestParam(name = "experimentId", required = true) String experimentId) { @RequestParam(name = "experimentId", required = true) String experimentId) {
ExperimentReport experimentReport = experimentReportService.getByExperimentId(experimentId); List<ExperimentReport> experimentReport = experimentReportService.getByExperimentId(experimentId);
if (experimentReport == null) { if (CollUtil.isEmpty(experimentReport)) {
return Result.error("试验报告不存在!"); return Result.ok();
} }
experimentReport.forEach(v -> {
ExperimentDoc experimentDoc = experimentDocService.getByExperimentId(experimentId, ExperimentDocType.sybg.getType());
v.setFileUrl(Optional.ofNullable(experimentDoc).map(ExperimentDoc::getFilePath).orElse(null));
});
ExperimentDoc experimentDoc = experimentDocService.getByExperimentId(experimentId, ExperimentDocType.sybg.getType());
experimentReport.setFileUrl(Optional.ofNullable(experimentDoc).map(ExperimentDoc::getFilePath).orElse(null));
return Result.OK(experimentReport); return Result.OK(experimentReport);
} }
@@ -249,33 +250,33 @@ public class ExperimentReportController extends JeecgController<ExperimentReport
//校对员 //校对员
String requestStatus = experimentReport.getStatus(); String requestStatus = experimentReport.getStatus();
//待校对 //待校对
if (StringUtils.equals(report.getStatus(), "INIT")) { if (StringUtils.equals(report.getStatus(), ExperimentReportStatus.INIT)) {
if (!StringUtils.equals(report.getProofreader(), sysUser.getId())) { if (!StringUtils.equals(report.getProofreader(), sysUser.getId())) {
return Result.error("您无权进行校对!"); return Result.error("您无权进行校对!");
} }
if (!StringUtils.equals(requestStatus, "PROOFREAD_PASS")) { if (!StringUtils.equals(requestStatus, ExperimentReportStatus.PROOFREAD_PASS)) {
report.setStatus("REJECT"); report.setStatus(ExperimentReportStatus.REJECT);
} }
report.setStatus(requestStatus); report.setStatus(requestStatus);
} }
//待审核 //待审核
else if (StringUtils.equals(report.getStatus(), "PROOFREAD_PASS")) { else if (StringUtils.equals(report.getStatus(), ExperimentReportStatus.PROOFREAD_PASS)) {
if (!StringUtils.equals(report.getAuditor(), sysUser.getId())) { if (!StringUtils.equals(report.getAuditor(), sysUser.getId())) {
return Result.error("您无权进行审核!"); return Result.error("您无权进行审核!");
} }
if (!StringUtils.equals(requestStatus, "AUDIT_PASS")) { if (!StringUtils.equals(requestStatus, ExperimentReportStatus.AUDIT_PASS)) {
report.setStatus("REJECT"); report.setStatus(ExperimentReportStatus.REJECT);
} }
report.setStatus(requestStatus); report.setStatus(requestStatus);
} }
//待批准 //待批准
else if (StringUtils.equals(report.getStatus(), "AUDIT_PASS")) { else if (StringUtils.equals(report.getStatus(), ExperimentReportStatus.AUDIT_PASS)) {
if (!StringUtils.equals(report.getConfirmer(), sysUser.getId())) { if (!StringUtils.equals(report.getConfirmer(), sysUser.getId())) {
return Result.error("您无权进行批准!"); return Result.error("您无权进行批准!");
} }
if (!StringUtils.equals(requestStatus, "PASSED")) { if (!StringUtils.equals(requestStatus, ExperimentReportStatus.PASSED)) {
report.setStatus("REJECT"); report.setStatus(ExperimentReportStatus.REJECT);
} }
report.setStatus(requestStatus); report.setStatus(requestStatus);
} else { } else {
@@ -285,10 +286,10 @@ public class ExperimentReportController extends JeecgController<ExperimentReport
experimentReportService.updateById(report); experimentReportService.updateById(report);
Experiment experiment = new Experiment(); Experiment experiment = new Experiment();
experiment.setId(report.getExperimentId()); experiment.setId(report.getExperimentId());
if (StringUtils.equals(report.getStatus(), "PASSED")) { if (StringUtils.equals(report.getStatus(), ExperimentReportStatus.PASSED)) {
experiment.setStatus(ExperimentStatus.COMPLETED); experiment.setStatus(ExperimentStatus.COMPLETED);
experimentDocService.generate(report.getExperimentId(), ExperimentDocType.sybg.getType()); experimentDocService.generate(report.getExperimentId(), ExperimentDocType.sybg.getType());
} else if (StringUtils.equals(report.getStatus(), "REJECT")) { } else if (StringUtils.equals(report.getStatus(), ExperimentReportStatus.REJECT)) {
experiment.setStatus(ExperimentStatus.PROGRESSING); experiment.setStatus(ExperimentStatus.PROGRESSING);
} else { } else {
experiment.setStatus(ExperimentStatus.REPORT_AUDITING); experiment.setStatus(ExperimentStatus.REPORT_AUDITING);

View File

@@ -94,6 +94,8 @@ public class ExperimentTestProcessController extends JeecgController<ExperimentT
if (StringUtils.containsAny(dbExperiment.getStatus(), ExperimentStatus.COMPLETED, ExperimentStatus.REPORT_AUDITING)) { if (StringUtils.containsAny(dbExperiment.getStatus(), ExperimentStatus.COMPLETED, ExperimentStatus.REPORT_AUDITING)) {
return Result.error("试验状态:[" + dbExperiment.getStatus() + "]不能进行修改!"); return Result.error("试验状态:[" + dbExperiment.getStatus() + "]不能进行修改!");
} }
experimentTestProcess.setId(null);
Experiment experiment = new Experiment(); Experiment experiment = new Experiment();
experiment.setId(experimentId); experiment.setId(experimentId);
experiment.setStatus(ExperimentStatus.PROGRESSING); experiment.setStatus(ExperimentStatus.PROGRESSING);

View File

@@ -13,6 +13,7 @@ import java.util.List;
* @Version: V1.0 * @Version: V1.0
*/ */
public interface IExperimentReportService extends IService<ExperimentReport> { public interface IExperimentReportService extends IService<ExperimentReport> {
ExperimentReport getByExperimentId(String experimentId); List<ExperimentReport> getByExperimentId(String experimentId);
ExperimentReport getLatestReport(String experimentId);
} }

View File

@@ -9,11 +9,9 @@ import com.deepoove.poi.XWPFTemplate;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.jeecg.common.util.MinioUtil; import org.jeecg.common.util.MinioUtil;
import org.jeecg.modules.database.entity.Experiment; import org.jeecg.modules.database.entity.*;
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.*;
import org.jeecg.modules.database.service.IExperimentService;
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.stereotype.Service; import org.springframework.stereotype.Service;
@@ -33,11 +31,12 @@ import java.util.*;
public class ExperimentDocServiceImpl extends ServiceImpl<ExperimentDocMapper, ExperimentDoc> implements IExperimentDocService { public class ExperimentDocServiceImpl extends ServiceImpl<ExperimentDocMapper, ExperimentDoc> implements IExperimentDocService {
@Value("${jeecg.template.path}") @Value("${jeecg.template.path}")
private String templatePath; private String templatePath;
@Autowired @Autowired
private IExperimentService experimentService; private IExperimentService experimentService;
@Autowired
static Map<String, String> docTempalteMap = new HashMap<>(); private IExperimentReportService experimentReportService;
static Map<String, String> docTempalteMap = new HashMap<>();
static { static {
//辐照试验计划表 //辐照试验计划表
@@ -72,7 +71,7 @@ public class ExperimentDocServiceImpl extends ServiceImpl<ExperimentDocMapper, E
FileUtil.del(outputFile); FileUtil.del(outputFile);
} }
log.info("output file path: " + outputFile); log.info("output file path: " + outputFile);
Map<String, Object> params = new HashMap(); Map<String, Object> params = assembleParams(experimentId, fileName);
XWPFTemplate.compile(absolutePath).render(params).writeToFile(outputFile); XWPFTemplate.compile(absolutePath).render(params).writeToFile(outputFile);
String path = MinioUtil.upload(FileUtil.getInputStream(outputFile), String path = MinioUtil.upload(FileUtil.getInputStream(outputFile),
"experiment_doc/" + experimentId + "/" + version + "/" + experiment.getName() + "-" + fileName + ".docx"); "experiment_doc/" + experimentId + "/" + version + "/" + experiment.getName() + "-" + fileName + ".docx");
@@ -83,6 +82,44 @@ public class ExperimentDocServiceImpl extends ServiceImpl<ExperimentDocMapper, E
} }
} }
private Map<String, Object> assembleParams(String experimentId, String type) {
switch (type) {
case "辐照试验计划表":
return assembleFzsyjhb(experimentId);
case "试验报告评审表":
return assembleSybgpsb(experimentId);
case "设备使用记录表":
return assembleSbsyjlb(experimentId);
case "试验报告":
return assembleSybg(experimentId);
case "辐照试验总结单":
return assembleFzsyzjd(experimentId);
}
return new HashMap<>();
}
private Map<String, Object> assembleFzsyzjd(String experimentId) {
return new HashMap<>();
}
private Map<String, Object> assembleSybg(String experimentId) {
Experiment experiment = experimentService.getById(experimentId);
ExperimentReport latestReport = experimentReportService.getLatestReport(experimentId);
return new HashMap<>();
}
private Map<String, Object> assembleSbsyjlb(String experimentId) {
return new HashMap<>();
}
private Map<String, Object> assembleSybgpsb(String experimentId) {
return new HashMap<>();
}
private Map<String, Object> assembleFzsyjhb(String experimentId) {
return new HashMap<>();
}
@Override @Override
public ExperimentDoc generate(String experimentId, String type) { public ExperimentDoc generate(String experimentId, String type) {
String version = DateUtil.format(new Date(), DatePattern.PURE_DATETIME_PATTERN); String version = DateUtil.format(new Date(), DatePattern.PURE_DATETIME_PATTERN);

View File

@@ -2,12 +2,14 @@ package org.jeecg.modules.database.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 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 org.jeecg.modules.database.entity.ExperimentRadiationProcess; import org.jeecg.modules.database.constant.ExperimentReportStatus;
import org.jeecg.modules.database.entity.ExperimentReport; import org.jeecg.modules.database.entity.ExperimentReport;
import org.jeecg.modules.database.mapper.ExperimentReportMapper; import org.jeecg.modules.database.mapper.ExperimentReportMapper;
import org.jeecg.modules.database.service.IExperimentReportService; import org.jeecg.modules.database.service.IExperimentReportService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
/** /**
* @Description: 试验报告 * @Description: 试验报告
* @Author: jeecg-boot * @Author: jeecg-boot
@@ -18,7 +20,16 @@ import org.springframework.stereotype.Service;
public class ExperimentReportServiceImpl extends ServiceImpl<ExperimentReportMapper, ExperimentReport> implements IExperimentReportService { public class ExperimentReportServiceImpl extends ServiceImpl<ExperimentReportMapper, ExperimentReport> implements IExperimentReportService {
@Override @Override
public ExperimentReport getByExperimentId(String experimentId) { public List<ExperimentReport> getByExperimentId(String experimentId) {
return getOne(new LambdaQueryWrapper<ExperimentReport>().eq(ExperimentReport::getExperimentId, experimentId),false); return list(new LambdaQueryWrapper<ExperimentReport>().eq(ExperimentReport::getExperimentId, experimentId));
}
@Override
public ExperimentReport getLatestReport(String experimentId) {
LambdaQueryWrapper<ExperimentReport> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(ExperimentReport::getExperimentId, experimentId)
.eq(ExperimentReport::getStatus, ExperimentReportStatus.PASSED);
queryWrapper.orderByDesc(ExperimentReport::getCreateTime);
return getOne(queryWrapper, false);
} }
} }