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
WORKDIR /app
@@ -11,10 +11,11 @@ COPY settings.xml /root/.m2/settings.xml
ADD . /app
#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
#FROM bellsoft/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

View File

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

View File

@@ -65,15 +65,15 @@ services:
- 28080:8080
networks:
- physical-boot
physical-kkfileview:
restart: on-failure
container_name: physical-kkfileview
image: registry.cn-shanghai.aliyuncs.com/physical/kkfileview
hostname: physical-kkfileview
ports:
- 8099:8012
networks:
- physical-boot
# physical-kkfileview:
# restart: on-failure
# container_name: physical-kkfileview
# image: registry.cn-shanghai.aliyuncs.com/physical/kkfileview
# hostname: physical-kkfileview
# ports:
# - 81:8012
# networks:
# - physical-boot
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")
public Result<String> add(@RequestBody ExperimentAnnealProcess experimentAnnealProcess, HttpServletRequest request) {
String experimentId = experimentAnnealProcess.getExperimentId();
experimentAnnealProcess.setId(null);
if (StringUtils.isBlank(experimentId)) {
return Result.error("试验数据不存在!");
}

View File

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

View File

@@ -1,5 +1,6 @@
package org.jeecg.modules.database.controller;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
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.util.JwtUtil;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.database.constant.ExperimentDocType;
import org.jeecg.modules.database.constant.ExperimentStatus;
import org.jeecg.modules.database.constant.*;
import org.jeecg.modules.database.entity.*;
import org.jeecg.modules.database.service.*;
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.servlet.ModelAndView;
import java.util.Arrays;
import java.util.Optional;
import java.util.*;
/**
* @Description: 试验报告
@@ -97,10 +96,10 @@ public class ExperimentReportController extends JeecgController<ExperimentReport
if (ObjUtil.isNull(experiment)) {
return Result.error("试验数据不存在!");
}
ExperimentReport report = experimentReportService.getByExperimentId(experimentId);
if (ObjUtil.isNotNull(report)) {
return Result.error("试验试验报告已存在!");
}
//ExperimentReport report = experimentReportService.getByExperimentId(experimentId);
//if (ObjUtil.isNotNull(report)) {
// return Result.error("试验试验报告已存在!");
//}
experimentReport.setReportName(experiment.getName() + "-试验报告");
experimentReportService.save(experimentReport);
return Result.OK("添加成功!");
@@ -191,15 +190,17 @@ public class ExperimentReportController extends JeecgController<ExperimentReport
//@AutoLog(value = "试验评定-通过id查询")
@Operation(summary = "试验报告-通过实验ID查询")
@GetMapping(value = "/queryByExperimentId")
public Result<ExperimentReport> getByExperimentId(
public Result<List<ExperimentReport>> getByExperimentId(
@RequestParam(name = "experimentId", required = true) String experimentId) {
ExperimentReport experimentReport = experimentReportService.getByExperimentId(experimentId);
if (experimentReport == null) {
return Result.error("试验报告不存在!");
List<ExperimentReport> experimentReport = experimentReportService.getByExperimentId(experimentId);
if (CollUtil.isEmpty(experimentReport)) {
return Result.ok();
}
experimentReport.forEach(v -> {
ExperimentDoc experimentDoc = experimentDocService.getByExperimentId(experimentId, ExperimentDocType.sybg.getType());
experimentReport.setFileUrl(Optional.ofNullable(experimentDoc).map(ExperimentDoc::getFilePath).orElse(null));
v.setFileUrl(Optional.ofNullable(experimentDoc).map(ExperimentDoc::getFilePath).orElse(null));
});
return Result.OK(experimentReport);
}
@@ -249,33 +250,33 @@ public class ExperimentReportController extends JeecgController<ExperimentReport
//校对员
String requestStatus = experimentReport.getStatus();
//待校对
if (StringUtils.equals(report.getStatus(), "INIT")) {
if (StringUtils.equals(report.getStatus(), ExperimentReportStatus.INIT)) {
if (!StringUtils.equals(report.getProofreader(), sysUser.getId())) {
return Result.error("您无权进行校对!");
}
if (!StringUtils.equals(requestStatus, "PROOFREAD_PASS")) {
report.setStatus("REJECT");
if (!StringUtils.equals(requestStatus, ExperimentReportStatus.PROOFREAD_PASS)) {
report.setStatus(ExperimentReportStatus.REJECT);
}
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())) {
return Result.error("您无权进行审核!");
}
if (!StringUtils.equals(requestStatus, "AUDIT_PASS")) {
report.setStatus("REJECT");
if (!StringUtils.equals(requestStatus, ExperimentReportStatus.AUDIT_PASS)) {
report.setStatus(ExperimentReportStatus.REJECT);
}
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())) {
return Result.error("您无权进行批准!");
}
if (!StringUtils.equals(requestStatus, "PASSED")) {
report.setStatus("REJECT");
if (!StringUtils.equals(requestStatus, ExperimentReportStatus.PASSED)) {
report.setStatus(ExperimentReportStatus.REJECT);
}
report.setStatus(requestStatus);
} else {
@@ -285,10 +286,10 @@ public class ExperimentReportController extends JeecgController<ExperimentReport
experimentReportService.updateById(report);
Experiment experiment = new Experiment();
experiment.setId(report.getExperimentId());
if (StringUtils.equals(report.getStatus(), "PASSED")) {
if (StringUtils.equals(report.getStatus(), ExperimentReportStatus.PASSED)) {
experiment.setStatus(ExperimentStatus.COMPLETED);
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);
} else {
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)) {
return Result.error("试验状态:[" + dbExperiment.getStatus() + "]不能进行修改!");
}
experimentTestProcess.setId(null);
Experiment experiment = new Experiment();
experiment.setId(experimentId);
experiment.setStatus(ExperimentStatus.PROGRESSING);

View File

@@ -13,6 +13,7 @@ import java.util.List;
* @Version: V1.0
*/
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 org.apache.commons.lang3.StringUtils;
import org.jeecg.common.util.MinioUtil;
import org.jeecg.modules.database.entity.Experiment;
import org.jeecg.modules.database.entity.ExperimentDoc;
import org.jeecg.modules.database.entity.*;
import org.jeecg.modules.database.mapper.ExperimentDocMapper;
import org.jeecg.modules.database.service.IExperimentDocService;
import org.jeecg.modules.database.service.IExperimentService;
import org.jeecg.modules.database.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
@@ -36,7 +34,8 @@ public class ExperimentDocServiceImpl extends ServiceImpl<ExperimentDocMapper, E
private String templatePath;
@Autowired
private IExperimentService experimentService;
@Autowired
private IExperimentReportService experimentReportService;
static Map<String, String> docTempalteMap = new HashMap<>();
static {
@@ -72,7 +71,7 @@ public class ExperimentDocServiceImpl extends ServiceImpl<ExperimentDocMapper, E
FileUtil.del(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);
String path = MinioUtil.upload(FileUtil.getInputStream(outputFile),
"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
public ExperimentDoc generate(String experimentId, String type) {
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.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.mapper.ExperimentReportMapper;
import org.jeecg.modules.database.service.IExperimentReportService;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @Description: 试验报告
* @Author: jeecg-boot
@@ -18,7 +20,16 @@ import org.springframework.stereotype.Service;
public class ExperimentReportServiceImpl extends ServiceImpl<ExperimentReportMapper, ExperimentReport> implements IExperimentReportService {
@Override
public ExperimentReport getByExperimentId(String experimentId) {
return getOne(new LambdaQueryWrapper<ExperimentReport>().eq(ExperimentReport::getExperimentId, experimentId),false);
public List<ExperimentReport> getByExperimentId(String experimentId) {
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);
}
}