This commit is contained in:
ls
2025-02-22 14:15:03 +08:00
parent 91612af842
commit e2e67752c3

View File

@@ -15,6 +15,7 @@ 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.util.JwtUtil; import org.jeecg.common.system.util.JwtUtil;
import org.jeecg.modules.database.constant.ExperimentStatus; import org.jeecg.modules.database.constant.ExperimentStatus;
import org.jeecg.modules.database.dto.NasaDataRecordPage;
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;
@@ -64,6 +65,8 @@ public class ExperimentController extends JeecgController<Experiment, IExperimen
private IExperimentIrradiationBoardService experimentIrradiationBoardService; private IExperimentIrradiationBoardService experimentIrradiationBoardService;
@Autowired @Autowired
private IExperimentFileService experimentFileService; private IExperimentFileService experimentFileService;
@Autowired
private INasaDataRecordService nasaDataRecordService;
/** /**
* 分页列表查询 * 分页列表查询
@@ -150,8 +153,8 @@ public class ExperimentController extends JeecgController<Experiment, IExperimen
} }
if (StringUtils.isNotBlank(experiment.getId())) { if (StringUtils.isNotBlank(experiment.getId())) {
Experiment dbExp = experimentService.getById(experiment.getId()); Experiment dbExp = experimentService.getById(experiment.getId());
if (!StringUtils.equals(dbExp.getStatus(), ExperimentStatus.STAGING) if (!StringUtils.equals(dbExp.getStatus(), ExperimentStatus.STAGING) || !StringUtils.equals(dbExp.getStatus(),
|| !StringUtils.equals(dbExp.getStatus(), ExperimentStatus.PRE_TEST)) { ExperimentStatus.PRE_TEST)) {
return Result.error("实验状态不正确!"); return Result.error("实验状态不正确!");
} }
} }
@@ -348,4 +351,26 @@ public class ExperimentController extends JeecgController<Experiment, IExperimen
return super.importExcel(request, response, Experiment.class); return super.importExcel(request, response, Experiment.class);
} }
@GetMapping(value = "/statistics")
public Result<NasaDataRecordPage> queryPageList(NasaDataRecord nasaDataRecord) {
NasaDataRecordPage result = new NasaDataRecordPage();
List<NasaDataRecord> list = nasaDataRecordService.list();
long totalCountLhs = list.stream().filter(Objects::nonNull).mapToLong(NasaDataRecord::getTotalCountLhs).filter(Objects::nonNull)
.sum();
long totalCountXhy = list.stream().filter(Objects::nonNull).mapToLong(NasaDataRecord::getTotalCountNasa).filter(Objects::nonNull)
.sum();
List<Experiment> experimentList = experimentService.list();
long experimentLhs = experimentList.stream().filter(Objects::nonNull).mapToLong(Experiment::getTotalCountLhs).filter(
Objects::nonNull).sum();
long experimentXhy = experimentList.stream().filter(Objects::nonNull).mapToLong(Experiment::getTotalCountXhy).filter(
Objects::nonNull).sum();
result.setLhsCount(experimentLhs);
result.setLhsTotal(totalCountLhs + experimentLhs);
result.setXhyCount(experimentXhy);
result.setXyhTotal(totalCountXhy + experimentXhy);
return Result.OK(result);
}
} }