This commit is contained in:
ls
2025-02-22 14:13:47 +08:00
parent 847831c58f
commit 91612af842
2 changed files with 29 additions and 8 deletions

View File

@@ -17,7 +17,9 @@ import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.modules.database.dto.NasaDataRecordPage;
import org.jeecg.modules.database.entity.Experiment;
import org.jeecg.modules.database.entity.NasaDataRecord;
import org.jeecg.modules.database.service.IExperimentService;
import org.jeecg.modules.database.service.INasaDataRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@@ -38,6 +40,8 @@ import java.util.*;
public class NasaDataRecordController extends JeecgController<NasaDataRecord, INasaDataRecordService> {
@Autowired
private INasaDataRecordService nasaDataRecordService;
@Autowired
private IExperimentService experimentService;
/**
* 分页列表查询
@@ -75,18 +79,21 @@ public class NasaDataRecordController extends JeecgController<NasaDataRecord, IN
public Result<NasaDataRecordPage> queryPageList(NasaDataRecord nasaDataRecord) {
NasaDataRecordPage result = new NasaDataRecordPage();
List<NasaDataRecord> list = nasaDataRecordService.list();
long totalCountLhs = list.stream().filter(Objects::nonNull) // 排除 null 对象
.mapToLong(NasaDataRecord::getTotalCountLhs) // 将对象映射为 long 字段
.filter(Objects::nonNull) // 排除 myField 为 null 的情况
long totalCountLhs = list.stream().filter(Objects::nonNull).mapToLong(NasaDataRecord::getTotalCountLhs).filter(Objects::nonNull)
.sum();
long totalCountXhy = list.stream().filter(Objects::nonNull) // 排除 null 对象
.mapToLong(NasaDataRecord::getTotalCountNasa) // 将对象映射为 long 字段
.filter(Objects::nonNull) // 排除 myField 为 null 的情况
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(totalCountLhs);
result.setLhsTotal(totalCountLhs);
result.setLhsTotal(totalCountLhs + experimentLhs);
result.setXhyCount(totalCountXhy);
result.setXyhTotal(totalCountXhy);
result.setXyhTotal(totalCountXhy + experimentXhy);
return Result.OK(result);
}

View File

@@ -190,6 +190,20 @@ public class Experiment implements Serializable {
@TableField(exist = false)
private List<ExperimentUser> experimentUserList;
/**
* 西核院统计
*/
@Excel(name = "西核院统计", width = 15)
@Schema(description = "西核院统计")
private long totalCountXhy;
/**
* 理化所统计
*/
@Excel(name = "理化所统计", width = 15)
@Schema(description = "理化所统计")
private long totalCountLhs;
@TableField(exist = false)
private String sampleType;
@TableField(exist = false)