添加级联符合校正因子库
This commit is contained in:
parent
7f3b639bf3
commit
3a1c57b161
|
|
@ -23,5 +23,11 @@
|
|||
<artifactId>jeecg-boot-base-core</artifactId>
|
||||
<version>${jeecgboot.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
<version>1.6.6</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,217 @@
|
|||
package org.jeecg.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.jeecg.modules.base.entity.configuration.GardsCorrectionFactor;
|
||||
import org.jeecg.modules.base.entity.configuration.GardsCorrectionFactorDetail;
|
||||
import org.jeecg.modules.base.entity.configuration.GardsCorrectionFactorEff;
|
||||
import org.jeecg.modules.base.vo.DetectorMapDTO;
|
||||
import org.jeecg.modules.base.vo.GardsCorrectionFactorDetailVO;
|
||||
import org.jeecg.modules.base.vo.GardsCorrectionFactorEffVO;
|
||||
import org.jeecg.service.GardsCorrectionFactorDetailService;
|
||||
import org.jeecg.service.GardsCorrectionFactorEffService;
|
||||
import org.jeecgframework.poi.excel.ExcelExportUtil;
|
||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||
import org.jeecgframework.poi.excel.entity.enmus.ExcelType;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 级联符合校正因子库--校正因子
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/gardsCorrectionFactorDetail")
|
||||
public class GardsCorrectionFactorDetailController {
|
||||
final short titleHeight = 8;
|
||||
@Autowired
|
||||
private GardsCorrectionFactorDetailService detailService;
|
||||
@Autowired
|
||||
private GardsCorrectionFactorEffService effService;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "分页查询")
|
||||
public Result<IPage<GardsCorrectionFactorDetailVO>> list(
|
||||
@RequestParam(defaultValue = "1") int pageNum,
|
||||
@RequestParam(defaultValue = "10") int size,
|
||||
@RequestParam(required = false)String stationCode,
|
||||
@RequestParam(required = false)String detectorCode,
|
||||
@RequestParam(required = false)String nuclideName) {
|
||||
return Result.ok(
|
||||
detailService.findPage(pageNum, size, stationCode, detectorCode, nuclideName));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param detail
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/add")
|
||||
@Operation(summary = "添加")
|
||||
public Result<?> add(@RequestBody GardsCorrectionFactorDetail detail) {
|
||||
return Result.ok(detailService.save(detail));
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param detail
|
||||
* @return
|
||||
*/
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新")
|
||||
public Result<?> update(@RequestBody GardsCorrectionFactorDetail detail) {
|
||||
return Result.ok(detailService.updateById(detail));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除")
|
||||
public Result<?> delete(@RequestParam(name = "id") Integer id) {
|
||||
return Result.ok(detailService.removeById(id));
|
||||
}
|
||||
|
||||
@AutoLog(value = "导出模版")
|
||||
@Operation(summary = "导出模版")
|
||||
@GetMapping("/exportTemplate")
|
||||
public void exportTemplate(HttpServletResponse response) throws IOException {
|
||||
ExportParams params = new ExportParams();
|
||||
params.setTitle("探测器模拟及联符合校正因子信息");
|
||||
params.setFixedTitle(true);
|
||||
params.setTitleHeight(titleHeight);
|
||||
params.setType(ExcelType.XSSF);
|
||||
ExcelExportUtil.exportExcel(params, GardsCorrectionFactorDetailVO.class, new ArrayList<>())
|
||||
.write(response.getOutputStream());
|
||||
}
|
||||
|
||||
@AutoLog(value = "导出Excel")
|
||||
@Operation(summary = "导出校正因子Excel")
|
||||
@GetMapping("/exportExcel")
|
||||
public void exportExcel(HttpServletResponse response,
|
||||
@RequestParam(required = false) String stationCode,
|
||||
@RequestParam(required = false) String detectorCode,
|
||||
@RequestParam(required = false) String nuclideName)
|
||||
throws IOException {
|
||||
ExportParams params = new ExportParams();
|
||||
params.setTitle("探测器模拟及联符合校正因子信息");
|
||||
params.setFixedTitle(true);
|
||||
params.setTitleHeight(titleHeight);
|
||||
params.setType(ExcelType.XSSF);
|
||||
|
||||
List<GardsCorrectionFactorDetailVO> list = detailService.findList(
|
||||
stationCode, detectorCode, nuclideName);
|
||||
ExcelExportUtil.exportExcel(params, GardsCorrectionFactorDetailVO.class, list)
|
||||
.write(response.getOutputStream());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "导入GardsAccelerator数据")
|
||||
@PostMapping(value = "/importExcel")
|
||||
public Result<?> importExcel(HttpServletRequest request) {
|
||||
// 1. 获取上传文件
|
||||
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
||||
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
|
||||
|
||||
// 2. 遍历文件进行处理
|
||||
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
|
||||
// 获取上传文件对象
|
||||
MultipartFile file = entity.getValue();
|
||||
ImportParams params = new ImportParams();
|
||||
// 设置标题行行数(通常为1,如果没有标题填0)
|
||||
params.setTitleRows(1);
|
||||
// 设置表头行数(通常为1)
|
||||
params.setHeadRows(1);
|
||||
params.setNeedSave(true);
|
||||
|
||||
try {
|
||||
// 3. 使用 AutoPoi 工具类解析 Excel
|
||||
List<GardsCorrectionFactorDetailVO> list =
|
||||
ExcelImportUtil.importExcel(file.getInputStream(),
|
||||
GardsCorrectionFactorDetailVO.class, params);
|
||||
|
||||
// 预加载映射关系 (Key: Code, Value: DTO)
|
||||
// SQL: SELECT DETECTOR_ID, DETECTOR_CODE, STATION_ID FROM GARDS_DETECTORS
|
||||
Map<String, DetectorMapDTO> refMap = effService.queryAllDetectorRef().stream()
|
||||
.collect(Collectors.toMap(DetectorMapDTO::getDetectorCode, d -> d,
|
||||
(k1, k2) -> k1));
|
||||
|
||||
// 转换GardsCorrectionFactorDetail并保存
|
||||
List<GardsCorrectionFactorDetail> entityList = new ArrayList<>();
|
||||
|
||||
for (GardsCorrectionFactorDetailVO vo : list) {
|
||||
if (StringUtils.isEmpty(vo.getDetectorCode())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// 根据 Excel 里的探测器代码获取数据库 ID
|
||||
DetectorMapDTO ref = refMap.get(vo.getDetectorCode().trim());
|
||||
|
||||
if (ref == null) {
|
||||
return Result.error(
|
||||
"导入中止:系统中不存在探测器代码 [" + vo.getDetectorCode() + "]");
|
||||
}
|
||||
GardsCorrectionFactorDetail effEntity = new GardsCorrectionFactorDetail();
|
||||
BeanUtils.copyProperties(vo, effEntity);
|
||||
// 填充两个关联 ID
|
||||
effEntity.setDetectorId(ref.getDetectorId());
|
||||
effEntity.setStationId(ref.getStationId());
|
||||
entityList.add(effEntity);
|
||||
}
|
||||
|
||||
// 4. 批量保存数据到数据库
|
||||
if (!CollectionUtils.isEmpty(entityList)) {
|
||||
|
||||
//detailService.saveBatch(entityList);
|
||||
|
||||
|
||||
entityList.forEach(item -> detailService.save(item));
|
||||
}
|
||||
return Result.OK("文件导入成功!数据行数:" + list.size());
|
||||
} catch (Exception e) {
|
||||
return Result.error("文件导入失败:" + e.getMessage());
|
||||
} finally {
|
||||
try {
|
||||
file.getInputStream().close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
return Result.error("文件导入失败!");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,234 @@
|
|||
package org.jeecg.controller;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.jeecg.modules.base.entity.configuration.GardsCorrectionFactor;
|
||||
import org.jeecg.modules.base.entity.configuration.GardsCorrectionFactorEff;
|
||||
import org.jeecg.modules.base.vo.DetectorMapDTO;
|
||||
import org.jeecg.modules.base.vo.DetectorOptionVO;
|
||||
import org.jeecg.modules.base.vo.GardsCorrectionFactorEffVO;
|
||||
import org.jeecg.modules.base.vo.StationOptionVO;
|
||||
import org.jeecg.service.GardsCorrectionFactorEffService;
|
||||
import org.jeecgframework.poi.excel.ExcelExportUtil;
|
||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||
import org.jeecgframework.poi.excel.entity.enmus.ExcelType;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 级联符合校正因子库--峰效率
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/gardsCorrectionFactorEff")
|
||||
public class GardsCorrectionFactorEffController {
|
||||
private final short titleHeight = 8;
|
||||
@Autowired
|
||||
private GardsCorrectionFactorEffService effService;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "分页查询")
|
||||
public Result<?> list(@RequestParam(defaultValue = "1") int pageNum,
|
||||
@RequestParam(defaultValue = "10") int size,
|
||||
@RequestParam(required = false) String stationCode,
|
||||
@RequestParam(required = false) String detectorCode) {
|
||||
return Result.OK(effService.findPage(pageNum, size, stationCode, detectorCode));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param eff 实体
|
||||
* @return Result
|
||||
*/
|
||||
@PostMapping("/add")
|
||||
@Operation(summary = "添加")
|
||||
public Result<?> add(@RequestBody GardsCorrectionFactorEff eff) {
|
||||
|
||||
return Result.OK(effService.add(eff));
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param eff 实体
|
||||
* @return Result
|
||||
*/
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新")
|
||||
public Result<?> update(@RequestBody GardsCorrectionFactorEff eff) {
|
||||
return Result.OK(effService.update(eff));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @param id 主键ID
|
||||
* @return Result
|
||||
*/
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除")
|
||||
public Result<?> delete(@RequestParam(name = "id") Integer id) {
|
||||
effService.delete(id);
|
||||
return Result.OK();
|
||||
}
|
||||
|
||||
|
||||
@AutoLog(value = "导出模版")
|
||||
@Operation(summary = "导出模版")
|
||||
@GetMapping("/exportTemplate")
|
||||
public void exportTemplate(HttpServletResponse response) throws IOException {
|
||||
ExportParams params = new ExportParams();
|
||||
params.setTitle("探测器模拟及联符合校正因子信息");
|
||||
params.setFixedTitle(true);
|
||||
params.setTitleHeight(titleHeight);
|
||||
params.setType(ExcelType.XSSF);
|
||||
ExcelExportUtil.exportExcel(params, GardsCorrectionFactorEffVO.class, new ArrayList<>())
|
||||
.write(response.getOutputStream());
|
||||
}
|
||||
|
||||
@AutoLog(value = "导出Excel")
|
||||
@Operation(summary = "导出校正因子Excel")
|
||||
@GetMapping("/exportExcel")
|
||||
public void exportExcel(HttpServletResponse response,
|
||||
@RequestParam(required = false) String stationCode,
|
||||
@RequestParam(required = false) String detectorCode)
|
||||
throws IOException {
|
||||
ExportParams params = new ExportParams();
|
||||
params.setTitle("探测器模拟及联符合校正因子效率信息");
|
||||
params.setFixedTitle(true);
|
||||
params.setTitleHeight(titleHeight);
|
||||
params.setType(ExcelType.XSSF);
|
||||
|
||||
List<GardsCorrectionFactorEffVO> list = effService.selectVOList(
|
||||
stationCode, detectorCode);
|
||||
ExcelExportUtil.exportExcel(params, GardsCorrectionFactor.class, list)
|
||||
.write(response.getOutputStream());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "导入GardsAccelerator数据")
|
||||
@PostMapping(value = "/importExcel")
|
||||
public Result<?> importExcel(HttpServletRequest request) {
|
||||
// 1. 获取上传文件
|
||||
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
||||
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
|
||||
|
||||
// 2. 遍历文件进行处理
|
||||
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
|
||||
// 获取上传文件对象
|
||||
MultipartFile file = entity.getValue();
|
||||
ImportParams params = new ImportParams();
|
||||
// 设置标题行行数(通常为1,如果没有标题填0)
|
||||
params.setTitleRows(1);
|
||||
// 设置表头行数(通常为1)
|
||||
params.setHeadRows(1);
|
||||
params.setNeedSave(true);
|
||||
|
||||
try {
|
||||
// 使用 AutoPoi 工具类解析 Excel
|
||||
List<GardsCorrectionFactorEffVO> voList =
|
||||
ExcelImportUtil.importExcel(file.getInputStream(),
|
||||
GardsCorrectionFactorEffVO.class, params);
|
||||
|
||||
if (!CollectionUtils.isEmpty(voList)) {
|
||||
|
||||
// 预加载映射关系 (Key: Code, Value: DTO)
|
||||
// SQL: SELECT DETECTOR_ID, DETECTOR_CODE, STATION_ID FROM GARDS_DETECTORS
|
||||
Map<String, DetectorMapDTO> refMap = effService.queryAllDetectorRef().stream()
|
||||
.collect(Collectors.toMap(DetectorMapDTO::getDetectorCode, d -> d,
|
||||
(k1, k2) -> k1));
|
||||
|
||||
// 转换GardsCorrectionFactorEff并保存
|
||||
List<GardsCorrectionFactorEff> entityList = new ArrayList<>();
|
||||
|
||||
for (GardsCorrectionFactorEffVO vo : voList) {
|
||||
if (StringUtils.isEmpty(vo.getDetectorCode())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// 根据 Excel 里的探测器代码获取数据库 ID
|
||||
DetectorMapDTO ref = refMap.get(vo.getDetectorCode().trim());
|
||||
|
||||
if (ref == null) {
|
||||
return Result.error(
|
||||
"导入中止:系统中不存在探测器代码 [" + vo.getDetectorCode() +
|
||||
"]");
|
||||
}
|
||||
GardsCorrectionFactorEff effEntity = new GardsCorrectionFactorEff();
|
||||
BeanUtils.copyProperties(vo, effEntity);
|
||||
// 填充两个关联 ID
|
||||
effEntity.setDetectorId(ref.getDetectorId());
|
||||
effEntity.setStationId(ref.getStationId());
|
||||
entityList.add(effEntity);
|
||||
}
|
||||
// 4. 批量保存数据到数据库
|
||||
if (!CollectionUtils.isEmpty(entityList)) {
|
||||
entityList.forEach(item -> effService.save(item));
|
||||
|
||||
//effService.saveBatch(entityList);
|
||||
}
|
||||
return Result.OK("文件导入成功!数据行数:" + entityList.size());
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
return Result.error("文件导入失败:" + e.getMessage());
|
||||
} finally {
|
||||
try {
|
||||
file.getInputStream().close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
return Result.error("文件导入失败!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "获取站点列表")
|
||||
|
||||
|
||||
// 下拉框:站点
|
||||
@GetMapping("/stations")
|
||||
public List<StationOptionVO> getStations() {
|
||||
return effService.getStationOptions();
|
||||
}
|
||||
|
||||
// 根据站点 ID 过滤探测器
|
||||
@AutoLog(value = "获取探测器")
|
||||
@GetMapping("/detectors")
|
||||
public List<DetectorOptionVO> getDetectors(@RequestParam(value = "stationId",required = false) Long stationId) {
|
||||
if (stationId == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return effService.getDetectorOptions(stationId);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
package org.jeecg.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.jeecg.modules.base.entity.configuration.GardsCorrectionFactor;
|
||||
import org.jeecg.modules.base.entity.configuration.GardsCorrectionFactorDetail;
|
||||
import org.jeecg.modules.base.vo.GardsCorrectionFactorDetailVO;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface GardsCorrectionFactorDetailService extends IService<GardsCorrectionFactorDetail> {
|
||||
|
||||
IPage<GardsCorrectionFactorDetailVO> findPage(Integer pageNum, Integer pageSize,
|
||||
String stationCode, String detectorCode, String nuclideName);
|
||||
|
||||
List<GardsCorrectionFactorDetailVO> findList(String stationCode, String detectorCode, String nuclideName);
|
||||
|
||||
|
||||
List<Map<String, Object>>selectStations();
|
||||
|
||||
List<Map<String, Object>>selectdetectors();
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
package org.jeecg.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.modules.base.entity.configuration.GardsCorrectionFactorEff;
|
||||
import org.jeecg.modules.base.vo.*;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public interface GardsCorrectionFactorEffService extends IService<GardsCorrectionFactorEff> {
|
||||
IPage<GardsCorrectionFactorEffVO> findPage(Integer pageNum, Integer pageSize,
|
||||
String stationCode, String detectorCode);
|
||||
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*/
|
||||
|
||||
boolean add(GardsCorrectionFactorEff entity);
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
boolean update(GardsCorrectionFactorEff entity);
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @param id 主键ID
|
||||
* @return
|
||||
*/
|
||||
boolean delete(Integer id);
|
||||
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
*
|
||||
* @param stationCode 台站编码
|
||||
* @param detectorCode 探测器编码
|
||||
* @return List<GardsCorrectionFactorEffVO>
|
||||
*/
|
||||
List<GardsCorrectionFactorEffVO> selectVOList(String stationCode, String detectorCode);
|
||||
|
||||
List<DetectorMapDTO> queryAllDetectorRef();
|
||||
|
||||
|
||||
// 获取所有站点
|
||||
List<StationOptionVO> getStationOptions();
|
||||
|
||||
// 根据站点联动获取探测器
|
||||
List<DetectorOptionVO> getDetectorOptions(Long stationId);
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
package org.jeecg.service.impl;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.jeecg.modules.base.entity.configuration.GardsCorrectionFactor;
|
||||
import org.jeecg.modules.base.entity.configuration.GardsCorrectionFactorDetail;
|
||||
import org.jeecg.modules.base.mapper.GardsCorrectionFactorDetailMapper;
|
||||
import org.jeecg.modules.base.mapper.GardsCorrectionFactorMapper;
|
||||
import org.jeecg.service.GardsCorrectionFactorDetailService;
|
||||
import org.jeecg.modules.base.vo.GardsCorrectionFactorDetailVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
@DS("ora")
|
||||
public class GardsCorrectionFactorDetailServiceImpl
|
||||
extends ServiceImpl<GardsCorrectionFactorDetailMapper, GardsCorrectionFactorDetail>
|
||||
implements GardsCorrectionFactorDetailService {
|
||||
@Autowired
|
||||
private GardsCorrectionFactorMapper factorMapper;
|
||||
|
||||
@Override
|
||||
public IPage<GardsCorrectionFactorDetailVO> findPage(Integer pageNum, Integer pageSize,
|
||||
String stationCode, String detectorCode, String nuclideName) {
|
||||
Page<GardsCorrectionFactorDetailVO> page = new Page<>(pageNum, pageSize);
|
||||
// 对应界面顶部的搜索框逻辑
|
||||
|
||||
return baseMapper.selectCombinedPage(page, stationCode,detectorCode,nuclideName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GardsCorrectionFactorDetailVO> findList(String stationCode, String detectorCode, String nuclideName) {
|
||||
|
||||
return baseMapper.findList(stationCode,detectorCode,nuclideName);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> selectStations() {
|
||||
List<Map<String, Object>> stations= baseMapper.selectStations();
|
||||
return stations;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> selectdetectors() {
|
||||
List<Map<String, Object>> detectors= baseMapper.selectdetectors();
|
||||
return detectors;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,87 @@
|
|||
package org.jeecg.service.impl;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.jeecg.modules.base.entity.configuration.GardsCorrectionFactorDetail;
|
||||
import org.jeecg.modules.base.entity.configuration.GardsCorrectionFactorEff;
|
||||
import org.jeecg.modules.base.mapper.GardsCorrectionFactorEffMapper;
|
||||
import org.jeecg.modules.base.vo.*;
|
||||
import org.jeecg.service.GardsCorrectionFactorEffService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@DS("ora")
|
||||
public class GardsCorrectionFactorEffServiceImpl
|
||||
extends ServiceImpl<GardsCorrectionFactorEffMapper, GardsCorrectionFactorEff>
|
||||
implements GardsCorrectionFactorEffService {
|
||||
|
||||
@Override
|
||||
public IPage<GardsCorrectionFactorEffVO> findPage(Integer pageNum, Integer pageSize,
|
||||
String stationCode, String detectorCode) {
|
||||
Page<GardsCorrectionFactorEffVO> page = new Page<>(pageNum, pageSize);
|
||||
|
||||
return baseMapper.selectCombinedPage(page, stationCode, detectorCode);
|
||||
}
|
||||
|
||||
|
||||
// 增加 (增)
|
||||
@Transactional
|
||||
public boolean add(GardsCorrectionFactorEff entity) {
|
||||
return this.save(entity);
|
||||
}
|
||||
|
||||
// 修改 (改)
|
||||
@Transactional
|
||||
public boolean update(GardsCorrectionFactorEff entity) {
|
||||
return this.updateById(entity);
|
||||
}
|
||||
|
||||
// 删除 (删)
|
||||
@Transactional
|
||||
public boolean delete(Integer id) {
|
||||
return this.removeById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
* @param stationCode 台站编码
|
||||
* @param detectorCode 探测器编码
|
||||
* @return List<GardsCorrectionFactorEffVO>
|
||||
*/
|
||||
public List<GardsCorrectionFactorEffVO> selectVOList(String stationCode, String detectorCode) {
|
||||
return baseMapper.selectVOList(stationCode, detectorCode);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DetectorMapDTO> queryAllDetectorRef() {
|
||||
return baseMapper.queryAllDetectorRef();
|
||||
}
|
||||
|
||||
|
||||
// 获取所有站点
|
||||
public List<StationOptionVO> getStationOptions() {
|
||||
return baseMapper.getStationOptions().stream()
|
||||
.map(s -> new StationOptionVO(s.getStationId(), s.getStationCode()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
// 根据站点联动获取探测器
|
||||
public List<DetectorOptionVO> getDetectorOptions(Long stationId) {
|
||||
return baseMapper.getDetectorOptions(stationId).stream()
|
||||
.map(d -> new DetectorOptionVO(d.getDetectorId(), d.getDetectorCode()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user