From 5fff260a9aec02e348e4a5b6bd032447dadbd0a4 Mon Sep 17 00:00:00 2001 From: duwenyuan <15600000461@163.com> Date: Wed, 10 Dec 2025 09:07:02 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=BB=BC=E5=90=88?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E5=BA=93=E7=9B=B8=E5=85=B3=E5=AE=9E=E4=BD=93?= =?UTF-8?q?=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../configuration/GardsAccelerator.java | 129 ++++++++++ .../configuration/GardsCorrectionFactor.java | 84 +++++++ .../GardsNuclearFuelFacilities.java | 117 +++++++++ .../configuration/GardsNuclearReactors.java | 235 ++++++++++++++++++ .../GardsNuclearReleaseRecords.java | 99 ++++++++ .../GardsNuclearTestingPlant.java | 73 ++++++ .../configuration/GardsResearchReactors.java | 125 ++++++++++ .../entity/configuration/GardsStations.java | 20 +- .../base/mapper/GardsAcceleratorMapper.java | 8 + .../mapper/GardsCorrectionFactorMapper.java | 8 + .../GardsNuclearFuelFacilitiesMapper.java | 8 + .../mapper/GardsNuclearReactorsMapper.java | 8 + .../GardsNuclearReleaseRecordsMapper.java | 8 + .../GardsNuclearTestingPlantMapper.java | 8 + .../mapper/GardsResearchReactorsMapper.java | 8 + .../base/mapper/GardsStationsMapper.java | 3 +- 16 files changed, 939 insertions(+), 2 deletions(-) create mode 100644 jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/configuration/GardsAccelerator.java create mode 100644 jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/configuration/GardsCorrectionFactor.java create mode 100644 jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/configuration/GardsNuclearFuelFacilities.java create mode 100644 jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/configuration/GardsNuclearReactors.java create mode 100644 jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/configuration/GardsNuclearReleaseRecords.java create mode 100644 jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/configuration/GardsNuclearTestingPlant.java create mode 100644 jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/configuration/GardsResearchReactors.java create mode 100644 jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/mapper/GardsAcceleratorMapper.java create mode 100644 jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/mapper/GardsCorrectionFactorMapper.java create mode 100644 jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/mapper/GardsNuclearFuelFacilitiesMapper.java create mode 100644 jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/mapper/GardsNuclearReactorsMapper.java create mode 100644 jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/mapper/GardsNuclearReleaseRecordsMapper.java create mode 100644 jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/mapper/GardsNuclearTestingPlantMapper.java create mode 100644 jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/mapper/GardsResearchReactorsMapper.java diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/configuration/GardsAccelerator.java b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/configuration/GardsAccelerator.java new file mode 100644 index 0000000..823f7ca --- /dev/null +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/configuration/GardsAccelerator.java @@ -0,0 +1,129 @@ +package org.jeecg.modules.base.entity.configuration; + +import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import org.apache.ibatis.type.JdbcType; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.Date; + +/** + * 研究设施信息实体类 + * 对应数据库表结构 + */ +@Data +@TableName("CONFIGURATION.GARDS_ACCELERATOR") +public class GardsAccelerator implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键ID + */ + @TableId(value = "ID", type = IdType.AUTO) + private Integer id; + + /** + * 分类 + */ + @Excel(name = "分类", width = 20, height = 20, orderNum = "0") + @TableField(value = "CATEGORY") + private String category; + + /** + * 国家 + */ + @Excel(name = "国家", width = 20, height = 20, orderNum = "1") + @TableField(value = "COUNTRY") + private String country; + + /** + * 设施代码 + */ + @Excel(name = "设施代码", width = 20, height = 20, orderNum = "2") + @TableField(value = "FACILITY_CODE") + private String facilityCode; + + /** + * 设施名称 + */ + @Excel(name = "设施名称", width = 20, height = 20, orderNum = "3") + @TableField(value = "FACILITY_NAME") + private String facilityName; + + /** + * 最大电流(A) + */ + @Excel(name = "最大电流(A)", width = 20, height = 20, orderNum = "6") + @TableField(value = "MAX_CURRENT_A") + private String maxCurrentA; + + /** + * 最大中子能量(MEV) + */ + @Excel(name = "最大中子能量(MEV)", width = 20, height = 20, orderNum = "7") + @TableField(value = "MAX_NEUTRON_ENERGY_MEV") + private String maxNeutronEnergyMev; + + /** + * 靶标 + */ + @Excel(name = "靶标", width = 20, height = 20, orderNum = "8") + @TableField(value = "TARGET") + private String target; + + /** + * 类型 + */ + @Excel(name = "类型", width = 20, height = 20, orderNum = "9") + @TableField(value = "TYPE") + private String type; + + /** + * 网站 + */ + @Excel(name = "网站", width = 20, height = 20, orderNum = "10") + @TableField(value = "WEBSITE") + private String website; + + /** + * 纬度 + */ + @Excel(name = "纬度", width = 20, height = 20, orderNum = "4") + @TableField(value = "LATITUDE") + private Double latitude; + + /** + * 经度 + */ + @Excel(name = "热容量(MW)", width = 20, height = 20, orderNum = "5") + @TableField(value = "LONGITUDE") + private Double longitude; + + /** + * 是否运行中(0-否,1-是) + */ + @Excel(name = "是否运行中", width = 20, height = 20, orderNum = "11") + @TableField(value = "IS_OPERATIONAL") + private Integer isOperational; + + + /** + * 备注信息 + */ + @TableField(value = "REMARKS") + private String remarks; + + + /** + * 修改时间 + */ + @TableField(value = "MODDATE", fill = FieldFill.INSERT_UPDATE) + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date moddate; +} \ No newline at end of file diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/configuration/GardsCorrectionFactor.java b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/configuration/GardsCorrectionFactor.java new file mode 100644 index 0000000..7cd1c2f --- /dev/null +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/configuration/GardsCorrectionFactor.java @@ -0,0 +1,84 @@ +package org.jeecg.modules.base.entity.configuration; + +import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.util.Date; + +/** + * 校正因子实体类 + * 对应数据库表 GARDS_CORRECTION_FACTOR + */ +@Data +@TableName("CONFIGURATION.GARDS_CORRECTION_FACTOR") +public class GardsCorrectionFactor implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键ID + */ + @TableId(value = "ID", type = IdType.AUTO) + private Integer id; + + /** + * 站点代码 + */ + @Excel(name = "站点代码", width = 20,height = 20,orderNum="0") + @TableField(value = "STATION_CODE") + private String stationCode; + + /** + * 探测器代码 + */ + @Excel(name = "探测器代码", width = 20,height = 20,orderNum="1") + @TableField(value = "DETECTOR_CODE") + private String detectorCode; + + /** + * 峰效率 + */ + @Excel(name = "峰效率", width = 20,height = 20,orderNum="2") + @TableField(value = "PEAK_EFFICIENCY") + private Double peakEfficiency; + + /** + * 总效率 + */ + @Excel(name = "总效率", width = 20,height = 20,orderNum="3") + @TableField(value = "TOTAL_EFFICIENCY") + private Double totalEfficiency; + + /** + * 校正因子 + */ + @Excel(name = "校正因子", width = 20,height = 20,orderNum="4") + @TableField(value = "CORRECTION_FACTOR") + private Double correctionFactor; + + /** + * 制造商 + */ + @Excel(name = "制造商", width = 20,height = 20,orderNum="5") + @TableField(value = "MANUFACTURER") + private String manufacturer; + + /** + * 型号 + */ + @Excel(name = "型号", width = 20,height = 20,orderNum="6") + @TableField(value = "MODEL") + private String model; + + /** + * 修改时间 + */ + @TableField(value = "MODDATE", fill = FieldFill.INSERT_UPDATE) + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date moddate; +} \ No newline at end of file diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/configuration/GardsNuclearFuelFacilities.java b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/configuration/GardsNuclearFuelFacilities.java new file mode 100644 index 0000000..0279c2a --- /dev/null +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/configuration/GardsNuclearFuelFacilities.java @@ -0,0 +1,117 @@ +package org.jeecg.modules.base.entity.configuration; + +import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import org.apache.ibatis.type.JdbcType; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.Date; + +/** + * 设施基础信息实体类 + * 对应数据库表结构 + */ +@Data +@TableName("CONFIGURATION.gards_nuclear_fuel_facilities") +public class GardsNuclearFuelFacilities implements Serializable { + + + private static final long serialVersionUID = 1L; + + /** + * 主键ID + */ + @TableId(value = "ID", type = IdType.AUTO) + private Integer id; + + /** + * 设施名称 + */ + @Excel(name = "设施名称", width = 20,height = 20,orderNum="0") + @TableField(value = "FACILITY_NAME") + private String facilityName; + /** + * 国家 + */ + @Excel(name = "国家", width = 20,height = 20,orderNum="1") + @TableField(value = "COUNTRY") + private String country; + + /** + * 纬度 + */ + @Excel(name = "纬度", width = 20,height = 20,orderNum="2") + @TableField(value = "LATITUDE") + private Double latitude; + + /** + * 经度 + */ + @Excel(name = "经度", width = 20,height = 20,orderNum="3") + @TableField(value = "LONGITUDE") + private Double longitude; + + /** + * 设施类型 + */ + @Excel(name = "设施类型", width = 20,height = 20,orderNum="4") + @TableField(value = "FACILITY_TYPE") + private String facilityType; + + /** + * 燃料类型 + */ + @Excel(name = "燃料类型", width = 20,height = 20,orderNum="5") + @TableField(value = "FUEL_TYPE") + private String fuelType; + + /** + * 设施状态 + */ + @Excel(name = "设施状态", width = 20,height = 20,orderNum="6") + @TableField(value = "FACILITY_STATUS") + private String facilityStatus; + + /** + * 规模 + */ + @Excel(name = "规模", width = 20,height = 20,orderNum="7") + @TableField(value = "SCALE") + private String scale; + + /** + * 设计容量 + */ + @Excel(name = "设计容量", width = 20,height = 20,orderNum="8") + @TableField(value = "DESIGN_CAPACITY") + private String designCapacity; + + /** + * 开始运营年份 + */ + @Excel(name = "开始运营年份", width = 20,height = 20,orderNum="9") + @TableField(value = "START_OF_OPERATION") + private Integer startOfOperation; + + /** + * 结束运营年份 + */ + @Excel(name = "结束运营年份", width = 20,height = 20,orderNum="10") + @TableField(value = "END_OF_OPERATION") + private Integer endOfOperation; + + /** + * 修改时间 + */ + @TableField(value = "MODDATE", fill = FieldFill.INSERT_UPDATE) + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date moddate; + + + +} diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/configuration/GardsNuclearReactors.java b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/configuration/GardsNuclearReactors.java new file mode 100644 index 0000000..c71b98f --- /dev/null +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/configuration/GardsNuclearReactors.java @@ -0,0 +1,235 @@ +package org.jeecg.modules.base.entity.configuration; + +import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonFormat; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; +import org.apache.ibatis.type.JdbcType; +import org.jeecg.common.validgroup.InsertGroup; +import org.jeecg.common.validgroup.UpdateGroup; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.Date; + +/** + * 核反应堆机组 + * 使用 Lombok + */ +@Data + +@TableName("CONFIGURATION.GARDS_NUCLEAR_REACTORS") +public class GardsNuclearReactors implements Serializable { + + + private static final long serialVersionUID = 1L; + + /** + * 主键ID + */ + @TableId(value = "ID", type = IdType.AUTO) + private Integer id; + + /** + * 单位名称 + */ + @NotBlank(message = "名称不能为空", groups = {InsertGroup.class, UpdateGroup.class}) + @Excel(name = "名称", width = 20, height = 20, orderNum = "0") + @TableField(value = "UNIT_NAME") + private String unitName; + + /** + * 国家 + */ + @Excel(name = "国家", width = 20, height = 20, orderNum = "1") + @TableField(value = "COUNTRY") + private String country; + + /** + * 纬度 + */ + @Excel(name = "纬度", width = 20, height = 20, orderNum = "2") + @TableField(value = "LATITUDE") + private Double latitude; + + /** + * 经度 + */ + @Excel(name = "经度", width = 20, height = 20, orderNum = "3") + @TableField(value = "LONGITUDE") + private Double longitude; + + /** + * 反应堆状态 + */ + @Excel(name = "反应堆状态", width = 20, height = 20, orderNum = "4") + @TableField(value = "REACTOR_STATUS") + private String reactorStatus; + + /** + * 反应堆类型 + */ + @Excel(name = "反应堆类型", width = 20, height = 20, orderNum = "5") + @TableField(value = "REACTOR_TYPE") + private String reactorType; + + /** + * 型号 + */ + @Excel(name = "型号", width = 20, height = 20, orderNum = "6") + @TableField(value = "MODEL") + private String model; + + /** + * 所有者 + */ + @Excel(name = "所有者", width = 20, height = 20, orderNum = "7") + @TableField(value = "OWNER") + private String owner; + + /** + * 运营商 + */ + @Excel(name = "运营商", width = 20, height = 20, orderNum = "8") + @TableField(value = "OPERATOR") + private String operator; + + /** + * 参考单位功率(MWE) + */ + @Excel(name = "参考单位功率(MWE)", width = 20, height = 20, orderNum = "9") + @TableField(value = "REFERENCE_UNIT_POWER_MWE") + private String referenceUnitPowerMwe; + + /** + * 设计净容量(MWE) + */ + @Excel(name = "设计净容量(MWE)", width = 20, height = 20, orderNum = "10") + @TableField(value = "DESIGN_NET_CAPACITY_MWE") + private String designNetCapacityMwe; + + /** + * 总容量(MWE) + */ + @Excel(name = "总容量(MWE)", width = 20, height = 20, orderNum = "11") + @TableField(value = "GROSS_CAPACITY_MWE") + private String grossCapacityMwe; + + /** + * 热容量(MWT) + */ + @Excel(name = "热容量(MWT)", width = 20, height = 20, orderNum = "12") + @TableField(value = "THERMAL_CAPACITY_MWT") + private String thermalCapacityMwt; + + /** + * 净容量(MW) + */ + @Excel(name = "净容量(MW)", width = 20, height = 20, orderNum = "13") + @TableField(value = "NET_CAPACITY_MW") + private Double netCapacityMw; + + /** + * 设计净容量(MW) + */ + @Excel(name = "设计净容量(MW)", width = 20, height = 20, orderNum = "14") + @TableField(value = "DESIGN_NET_MW") + private Double designNetMw; + + /** + * 总容量(MW) + */ + @Excel(name = "总容量(MW)", width = 20, height = 20, orderNum = "15") + @TableField(value = "GROSS_MW") + private Double grossMw; + + /** + * 热容量(MW) + */ + @Excel(name = "热容量(MW)", width = 20, height = 20, orderNum = "16") + @TableField(value = "THERMAL_MW") + private Double thermalMw; + + /** + * 建设开始日期 + */ + @Excel(name = "建设开始日期", width = 20, height = 20, orderNum = "17") + @TableField(value = "CONSTRUCTION_START_DATE") + @DateTimeFormat(pattern = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + private Date constructionStartDate; + + /** + * 首次临界日期 + */ + @Excel(name = "首次临界日期", width = 20, height = 20, orderNum = "18") + @TableField(value = "FIRST_CRITICALITY_DATE") + @DateTimeFormat(pattern = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + private Date firstCriticalityDate; + + /** + * 首次电网连接日期 + */ + @Excel(name = "首次电网连接日期", width = 20, height = 20, orderNum = "19") + @TableField(value = "FIRST_GRID_CONNECTION_DATE") + @DateTimeFormat(pattern = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + private Date firstGridConnectionDate; + + /** + * 商业运营日期 + */ + @Excel(name = "商业运营日期", width = 20, height = 20, orderNum = "20") + @TableField(value = "COMMERCIAL_OPERATION_DATE") + @DateTimeFormat(pattern = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + private Date commercialOperationDate; + + /** + * 供电量(TWH) + */ + @Excel(name = "供电量(TWH", width = 20, height = 20, orderNum = "21") + @TableField(value = "ELECTRICITY_SUPPLIED_TWH") + private Double electricitySuppliedTwh; + + /** + * 能源可用因子 + */ + @Excel(name = "能源可用因子", width = 20, height = 20, orderNum = "22") + @TableField(value = "ENERGY_AVAILABILITY_FACTOR") + private Double energyAvailabilityFactor; + + /** + * 运行因子 + */ + @Excel(name = "运行因子", width = 20, height = 20, orderNum = "23") + @TableField(value = "OPERATION_FACTOR") + private Double operationFactor; + + /** + * 能源不可用因子 + */ + @Excel(name = "能源不可用因子", width = 20, height = 20, orderNum = "24") + @TableField(value = "ENERGY_UNAVAILABILITY_FACTOR") + private Double energyUnavailabilityFactor; + + /** + * 负载因子 + */ + @Excel(name = "负载因子", width = 20, height = 20, orderNum = "25") + @TableField(value = "LOAD_FACTOR") + private Double loadFactor; + /** + * 修改时间 + */ + @TableField(value = "MODDATE", fill = FieldFill.INSERT_UPDATE) + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date moddate; + +} + + diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/configuration/GardsNuclearReleaseRecords.java b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/configuration/GardsNuclearReleaseRecords.java new file mode 100644 index 0000000..a6bd31f --- /dev/null +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/configuration/GardsNuclearReleaseRecords.java @@ -0,0 +1,99 @@ +package org.jeecg.modules.base.entity.configuration; + +import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import org.apache.ibatis.type.JdbcType; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.Date; + +/** + * 核素释放记录实体类 + * 对应数据库表结构 + */ +@Data +@TableName("CONFIGURATION.GARDS_NUCLEAR_RELEASE_RECORDS") +public class GardsNuclearReleaseRecords implements Serializable { + + + private static final long serialVersionUID = 1L; + + /** + * 主键ID + */ + @TableId(value = "ID", type = IdType.AUTO) + private Integer id; + + /** + * 释放年份 + */ + @Excel(name = "释放年份", width = 20,height = 20,orderNum="0") + @TableField(value = "RELEASE_DATE") + private Integer releaseDate; + + /** + * 释放类型 + */ + @Excel(name = "释放类型", width = 20,height = 20,orderNum="1") + @TableField(value = "RELEASE_TYPE") + private String releaseType; + + /** + * 地点名称 + */ + @Excel(name = "地点名称", width = 20,height = 20,orderNum="2") + @TableField(value = "SITE_NAME") + private String siteName; + + /** + * 装置/设施 + */ + @Excel(name = "装置/设施", width = 20,height = 20,orderNum="3") + @TableField(value = "INSTALLATION") + private String installation; + + /** + * 核素类型 + */ + @Excel(name = "核素类型", width = 20,height = 20,orderNum="4") + @TableField(value = "NUCLIDE_TYPE") + private String nuclideType; + + /** + * 具体核素 + */ + @Excel(name = "具体核素", width = 20,height = 20,orderNum="5") + @TableField(value = "NUCLIDE") + private String nuclide; + + /** + * 活度/活动性 + */ + @Excel(name = "活度/活动性", width = 20,height = 20,orderNum="6") + @TableField(value = "ACTIVITY") + private String activity; + + /** + *数据来源 + */ + @TableField(value = "DATA_SOURCE") + private Integer dataSource; + /* + 优先级 + */ + @TableField(value = "PRIORITY_LEVEL") + private Integer priorityLevel; + + + /** + * 修改时间 + */ + @TableField(value = "MODDATE", fill = FieldFill.INSERT_UPDATE) + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date moddate; +} \ No newline at end of file diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/configuration/GardsNuclearTestingPlant.java b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/configuration/GardsNuclearTestingPlant.java new file mode 100644 index 0000000..e0b5202 --- /dev/null +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/configuration/GardsNuclearTestingPlant.java @@ -0,0 +1,73 @@ +package org.jeecg.modules.base.entity.configuration; + +import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import org.apache.ibatis.type.ClobTypeHandler; +import org.apache.ibatis.type.JdbcType; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.Date; + +/** + * 设施信息实体类 + * 对应数据库表结构 + */ +@Data +@TableName("CONFIGURATION.GARDS_NUCLEAR_TESTING_PLANT") +public class GardsNuclearTestingPlant implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键ID + */ + @TableId(value = "ID", type = IdType.AUTO) + private Integer id; + + /** + * 名称 + */ + @Excel(name = "名称", width = 20,height = 20,orderNum="0") + @TableField(value = "NAME") + private String name; + + /** + * 纬度 + */ + @Excel(name = "纬度", width = 20,height = 20,orderNum="1") + @TableField(value = "LATITUDE") + private Double latitude; + + /** + * 经度 + */ + @Excel(name = "经度", width = 20,height = 20,orderNum="2") + @TableField(value = "LONGITUDE") + private Double longitude; + + /** + * 类型 + */ + @Excel(name = "类型", width = 20,height = 20,orderNum="3") + @TableField(value = "TYPE") + private String type; + + /** + * 详细信息(大文本字段) + */ + @Excel(name = "详细信息", width = 150,height = 20,orderNum="4") + @TableField(value = "INFO",typeHandler = ClobTypeHandler.class) + private String info; + + /** + * 修改时间 + */ + @TableField(value = "MODDATE", fill = FieldFill.INSERT_UPDATE) + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date moddate; +} \ No newline at end of file diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/configuration/GardsResearchReactors.java b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/configuration/GardsResearchReactors.java new file mode 100644 index 0000000..5534192 --- /dev/null +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/configuration/GardsResearchReactors.java @@ -0,0 +1,125 @@ +package org.jeecg.modules.base.entity.configuration; + +import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import org.apache.ibatis.type.JdbcType; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.Date; + +/** + * 核设施基础信息实体类 + * 对应数据库表结构 + */ +@Data +@TableName("CONFIGURATION.GARDS_RESEARCH_REACTORS") +public class GardsResearchReactors implements Serializable { + + + private static final long serialVersionUID = 1L; + + /** + * 主键ID + */ + @TableId(value = "ID", type = IdType.AUTO) + private Integer id; + + /** + * 设施名称 + */ + @Excel(name = "设施名称", width = 20,height = 20,orderNum="0") + @TableField(value = "FACILITY_NAME") + private String facilityName; + + /** + * 纬度 + */ + @Excel(name = "纬度", width = 20,height = 20,orderNum="1") + @TableField(value = "LATITUDE") + private Double latitude; + + /** + * 经度 + */ + @Excel(name = "经度", width = 20,height = 20,orderNum="2") + @TableField(value = "LONGITUDE") + private Double longitude; + + /** + * 国家 + */ + @Excel(name = "国家", width = 20,height = 20,orderNum="3") + @TableField(value = "COUNTRY") + private String country; + + /** + * 城市 + */ + @Excel(name = "城市", width = 20,height = 20,orderNum="4") + @TableField(value = "CITY") + private String city; + + /** + * 反应堆类型 + */ + @Excel(name = "反应堆类型", width = 20,height = 20,orderNum="5") + @TableField(value = "REACTOR_TYPE") + private String reactorType; + + /** + * 热功率 + */ + @Excel(name = "热功率", width = 20,height = 20,orderNum="6") + @TableField(value = "THERMAL_POWER") + private Double thermalPower; + + /** + * 状态 + */ + @Excel(name = "状态", width = 20,height = 20,orderNum="7") + @TableField(value = "STATUS") + private String status; + + /** + * 首次临界日期 + */ + @Excel(name = "首次临界日期", width = 20,height = 20,orderNum="8") + @TableField(value = "FIRST_CRITICALITY_DATE") + @DateTimeFormat(pattern = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + private Date firstCriticalityDate; + + /** + * 区域 + */ + @Excel(name = "区域", width = 20,height = 20,orderNum="9") + @TableField(value = "REGION") + private String region; + + /** + * 是否同位素生产(0-否,1-是) + */ + @Excel(name = "是否同位素生产(0-否,1-是)",dicCode = "IS_ISOTOPE_PRODUCTION", width = 20,height = 20,orderNum="10") + @TableField(value = "IS_ISOTOPE_PRODUCTION") + private Integer isIsotopeProduction; + + /** + * 备注信息 + */ + @Excel(name = "备注信息", width = 20,height = 20,orderNum="11") + @TableField(value = "REMARKS") + private String remarks; + + /** + * 修改时间 + */ + @TableField(value = "MODDATE", fill = FieldFill.INSERT_UPDATE) + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date moddate; +} + diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/configuration/GardsStations.java b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/configuration/GardsStations.java index f98391c..b13e739 100644 --- a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/configuration/GardsStations.java +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/configuration/GardsStations.java @@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; +import org.jeecgframework.poi.excel.annotation.Excel; import org.springframework.format.annotation.DateTimeFormat; import java.io.Serializable; @@ -18,54 +19,63 @@ public class GardsStations implements Serializable { /** * 台站id */ - @TableId(type = IdType.INPUT) + @Excel(name = "台站ID", width = 20, height = 20, orderNum = "0") + @TableId(value = "STATION_ID",type = IdType.INPUT) private Integer stationId; /** * 台站编码 */ + @Excel(name = "台站编码", width = 20, height = 20, orderNum = "1") @TableField(value = "STATION_CODE") private String stationCode; /** * 城市编码 */ + @Excel(name = "城市编码", width = 20, height = 20, orderNum = "2") @TableField(value = "COUNTRY_CODE") private String countryCode; /** * 台站类型 */ + @Excel(name = "台站类型", width = 20, height = 20, orderNum = "3") @TableField(value = "TYPE") private String type; /** * 经度 */ + @Excel(name = "经度", width = 20, height = 20, orderNum = "4") @TableField(value = "LON") private Double lon; /** * 纬度 */ + @Excel(name = "纬度", width = 20, height = 20, orderNum = "5") @TableField(value = "LAT") private Double lat; /** * 海拔 */ + @Excel(name = "海拔", width = 20, height = 20, orderNum = "6") @TableField(value = "ELEVATION") private Double elevation; /** * 描述 */ + @Excel(name = "描述", width = 20, height = 20, orderNum = "7") @TableField(value = "DESCRIPTION") private String description; /** * 开始运行日期 */ + @Excel(name = "开始运行日期", width = 20, height = 20, orderNum = "8") @TableField(value = "DATE_BEGIN") @DateTimeFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") @@ -74,6 +84,7 @@ public class GardsStations implements Serializable { /** * 运行终止日期 */ + @Excel(name = "运行终止日期", width = 20, height = 20, orderNum = "9") @TableField(value = "DATE_END") @DateTimeFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") @@ -82,22 +93,29 @@ public class GardsStations implements Serializable { /** * 运行状态 */ + @Excel(name = "运行状态", width = 20, height = 20, orderNum = "10") @TableField(value = "STATUS") private String status; /** * 操作时间 */ + @Excel(name = "操作时间", width = 20, height = 20, orderNum = "11") @TableField(value = "MODDATE") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private Date moddate; + /** + * 分类 + */ + @Excel(name = "分类", width = 20, height = 20, orderNum = "12") @TableField(value = "CATEGORY") private Integer category; /** * 有效率计算类型 */ + @Excel(name = "有效率计算类型", width = 20, height = 20, orderNum = "13") @TableField(value = "EFFIC_CALCUL_TYPE") private String efficCalculType; } diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/mapper/GardsAcceleratorMapper.java b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/mapper/GardsAcceleratorMapper.java new file mode 100644 index 0000000..15ae91f --- /dev/null +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/mapper/GardsAcceleratorMapper.java @@ -0,0 +1,8 @@ +package org.jeecg.modules.base.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; +import org.jeecg.modules.base.entity.configuration.GardsAccelerator; +@Mapper +public interface GardsAcceleratorMapper extends BaseMapper { +} diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/mapper/GardsCorrectionFactorMapper.java b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/mapper/GardsCorrectionFactorMapper.java new file mode 100644 index 0000000..0703c67 --- /dev/null +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/mapper/GardsCorrectionFactorMapper.java @@ -0,0 +1,8 @@ +package org.jeecg.modules.base.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; +import org.jeecg.modules.base.entity.configuration.GardsCorrectionFactor; +@Mapper +public interface GardsCorrectionFactorMapper extends BaseMapper { +} diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/mapper/GardsNuclearFuelFacilitiesMapper.java b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/mapper/GardsNuclearFuelFacilitiesMapper.java new file mode 100644 index 0000000..e1ddda8 --- /dev/null +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/mapper/GardsNuclearFuelFacilitiesMapper.java @@ -0,0 +1,8 @@ +package org.jeecg.modules.base.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; +import org.jeecg.modules.base.entity.configuration.GardsNuclearFuelFacilities; +@Mapper +public interface GardsNuclearFuelFacilitiesMapper extends BaseMapper { +} diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/mapper/GardsNuclearReactorsMapper.java b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/mapper/GardsNuclearReactorsMapper.java new file mode 100644 index 0000000..a25ef8d --- /dev/null +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/mapper/GardsNuclearReactorsMapper.java @@ -0,0 +1,8 @@ +package org.jeecg.modules.base.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; +import org.jeecg.modules.base.entity.configuration.GardsNuclearReactors; +@Mapper +public interface GardsNuclearReactorsMapper extends BaseMapper { +} diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/mapper/GardsNuclearReleaseRecordsMapper.java b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/mapper/GardsNuclearReleaseRecordsMapper.java new file mode 100644 index 0000000..217d553 --- /dev/null +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/mapper/GardsNuclearReleaseRecordsMapper.java @@ -0,0 +1,8 @@ +package org.jeecg.modules.base.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; +import org.jeecg.modules.base.entity.configuration.GardsNuclearReleaseRecords; +@Mapper +public interface GardsNuclearReleaseRecordsMapper extends BaseMapper { +} diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/mapper/GardsNuclearTestingPlantMapper.java b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/mapper/GardsNuclearTestingPlantMapper.java new file mode 100644 index 0000000..7d2c2e3 --- /dev/null +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/mapper/GardsNuclearTestingPlantMapper.java @@ -0,0 +1,8 @@ +package org.jeecg.modules.base.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; +import org.jeecg.modules.base.entity.configuration.GardsNuclearTestingPlant; +@Mapper +public interface GardsNuclearTestingPlantMapper extends BaseMapper { +} diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/mapper/GardsResearchReactorsMapper.java b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/mapper/GardsResearchReactorsMapper.java new file mode 100644 index 0000000..1642d41 --- /dev/null +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/mapper/GardsResearchReactorsMapper.java @@ -0,0 +1,8 @@ +package org.jeecg.modules.base.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; +import org.jeecg.modules.base.entity.configuration.GardsResearchReactors; +@Mapper +public interface GardsResearchReactorsMapper extends BaseMapper { +} diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/mapper/GardsStationsMapper.java b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/mapper/GardsStationsMapper.java index 2dca928..b57b076 100644 --- a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/mapper/GardsStationsMapper.java +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/mapper/GardsStationsMapper.java @@ -1,7 +1,8 @@ package org.jeecg.modules.base.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; import org.jeecg.modules.base.entity.configuration.GardsStations; - +@Mapper public interface GardsStationsMapper extends BaseMapper { } From 154c3ad2069e15d8f2fbae0f065c86ad82afdc1c Mon Sep 17 00:00:00 2001 From: duwenyuan <15600000461@163.com> Date: Wed, 10 Dec 2025 09:11:29 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=BB=BC=E5=90=88?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E5=BA=93=E7=9B=B8=E5=85=B3=E6=9C=8D=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../GardsAcceleratorController.java | 329 ++++++++++++++++ .../GardsCorrectionFactorController.java | 358 ++++++++++++++++++ .../GardsNuclearFuelFacilityController.java | 285 ++++++++++++++ .../GardsNuclearReactorsController.java | 307 +++++++++++++++ .../GardsNuclearReleaseController.java | 260 +++++++++++++ .../GardsNuclearTestingPlantController.java | 268 +++++++++++++ .../GardsResearchReactorsController.java | 256 +++++++++++++ .../controller/GardsStationsController.java | 252 ++++++++++++ .../service/GardsAcceleratorService.java | 35 ++ .../service/GardsCorrectionFactorService.java | 47 +++ .../GardsNuclearFuelFacilityService.java | 30 ++ .../service/GardsNuclearReactorsService.java | 21 + .../service/GardsNuclearReleaseService.java | 21 + .../GardsNuclearTestingPlantService.java | 20 + .../service/GardsResearchReactorsService.java | 19 + .../jeecg/service/GardsStationsService.java | 17 + .../impl/GardsAcceleratorServiceImpl.java | 52 +++ .../GardsCorrectionFactorServiceImpl.java | 79 ++++ .../GardsNuclearFuelFacilityServiceImpl.java | 56 +++ .../impl/GardsNuclearReactorsServiceImpl.java | 39 ++ .../impl/GardsNuclearReleaseServiceImpl.java | 34 ++ .../GardsNuclearTestingPlantServiceImpl.java | 29 ++ .../GardsResearchReactorsServiceImpl.java | 34 ++ .../impl/GardsStationsServiceImpl.java | 37 ++ .../java/org/jeecg/util/BizUpsertUtil.java | 170 +++++++++ .../org/jeecg/util/DbMetaObjectHandler.java | 23 ++ 26 files changed, 3078 insertions(+) create mode 100644 jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsAcceleratorController.java create mode 100644 jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsCorrectionFactorController.java create mode 100644 jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsNuclearFuelFacilityController.java create mode 100644 jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsNuclearReactorsController.java create mode 100644 jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsNuclearReleaseController.java create mode 100644 jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsNuclearTestingPlantController.java create mode 100644 jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsResearchReactorsController.java create mode 100644 jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsStationsController.java create mode 100644 jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsAcceleratorService.java create mode 100644 jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsCorrectionFactorService.java create mode 100644 jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsNuclearFuelFacilityService.java create mode 100644 jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsNuclearReactorsService.java create mode 100644 jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsNuclearReleaseService.java create mode 100644 jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsNuclearTestingPlantService.java create mode 100644 jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsResearchReactorsService.java create mode 100644 jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsStationsService.java create mode 100644 jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsAcceleratorServiceImpl.java create mode 100644 jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsCorrectionFactorServiceImpl.java create mode 100644 jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsNuclearFuelFacilityServiceImpl.java create mode 100644 jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsNuclearReactorsServiceImpl.java create mode 100644 jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsNuclearReleaseServiceImpl.java create mode 100644 jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsNuclearTestingPlantServiceImpl.java create mode 100644 jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsResearchReactorsServiceImpl.java create mode 100644 jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsStationsServiceImpl.java create mode 100644 jeecg-module-monitor-info-database/src/main/java/org/jeecg/util/BizUpsertUtil.java create mode 100644 jeecg-module-monitor-info-database/src/main/java/org/jeecg/util/DbMetaObjectHandler.java diff --git a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsAcceleratorController.java b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsAcceleratorController.java new file mode 100644 index 0000000..2b2ed21 --- /dev/null +++ b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsAcceleratorController.java @@ -0,0 +1,329 @@ +package org.jeecg.controller; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +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.SourceRebuildMonitoringData; +import org.jeecg.modules.base.entity.configuration.GardsAccelerator; +import org.jeecg.modules.base.entity.configuration.GardsCorrectionFactor; +import org.jeecg.service.GardsAcceleratorService; +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.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +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; + +@Slf4j +@RestController +@RequestMapping("/gards-accelerator") +public class GardsAcceleratorController { + + @Autowired + private GardsAcceleratorService gardsAcceleratorService; + + /** + * 新增 加速器信息 + */ + @AutoLog(value = "新增加速器信息") + @Operation(summary = "新增加速器信息") + @PostMapping("create") + public Result create(@RequestBody GardsAccelerator gardsAccelerator) { + try { + boolean success = gardsAcceleratorService.save(gardsAccelerator); + if (success) { + return Result.OK("添加成功",gardsAccelerator); + } else { + return Result.error("设施信息添加失败"); + } + } catch (Exception e) { + log.error(e.getMessage()); + return Result.error("操作失败"); + } + } + + /** + * 根据ID删除设施信息 + */ + @AutoLog(value = "删除加速器信息") + @Operation(summary = "删除加速器信息") + @DeleteMapping("/delete") + public Result delete(@RequestParam Integer id) { + try { + boolean success = gardsAcceleratorService.removeById(id); + if (success) { + return Result.ok("删除成功"); + } else { + return Result.error("设施信息删除失败,可能该记录不存在"); + } + } catch (Exception e) { + log.error(e.getMessage()); + return Result.error("操作失败"); + } + } + + /** + * 更新设施信息 + */ + @Operation(summary = "更新加速器信息") + @PutMapping("/update") + public Result update(@RequestBody GardsAccelerator gardsAccelerator) { + try { + boolean success = gardsAcceleratorService.updateById(gardsAccelerator); + if (success) { + return Result.OK("设施信息更新成功",gardsAccelerator); + } else { + return Result.error("设施信息更新失败,可能该记录不存在"); + } + } catch (Exception e) { + log.error(e.getMessage()); + return Result.error("操作失败"); + } + } + + /** + * 根据ID查询设施详情 + */ + @Operation(summary = "查询加速器信息") + @GetMapping("/queryById") + public Result getById(@RequestParam Integer id) { + try { + GardsAccelerator facility = gardsAcceleratorService.getById(id); + if (facility != null) { + return Result.ok(facility); + } else { + return Result.error("未找到对应的设施信息"); + } + } catch (Exception e) { + log.error(e.getMessage()); + return Result.error("查询失败"); + } + } + + /** + * 分页查询设施列表 + */ + @Operation(summary = "加速器信息分页查询") + @GetMapping("/page") + public Result> page( + @RequestParam(defaultValue = "1") Integer pageNum, + @RequestParam(defaultValue = "10") Integer pageSize, + @RequestParam(required = false) String country, + @RequestParam(required = false) String facilityName + ) { + try { + Page page = new Page<>(pageNum, pageSize); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + + if (facilityName != null && !facilityName.trim().isEmpty()) { + wrapper.eq(GardsAccelerator::getFacilityName, facilityName); + } + if (country != null && !country.trim().isEmpty()) { + wrapper.eq(GardsAccelerator::getCountry, country); + } + IPage pageResult = gardsAcceleratorService.page(page,wrapper); + return Result.ok(pageResult); + } catch (Exception e) { + log.error("分页查询失败: " + e.getMessage()); + return Result.error("分页查询失败"); + } + } + + /** + * 查询所有设施列表 + */ + @Operation(summary = "查询加速器所有信息") + @GetMapping("/list") + public Result> list() { + try { + List list = gardsAcceleratorService.list(); + return Result.ok(list); + } catch (Exception e) { + log.error("查询失败: " + e.getMessage()); + return Result.error("查询失败"); + } + } + + /** + * 根据设施代码查询 + */ + @Operation(summary = "根据加速器代码查询") + @GetMapping("/by-facility-code") + public Result getByFacilityCode(@RequestParam String facilityCode) { + try { + GardsAccelerator facility = gardsAcceleratorService.getByFacilityCode(facilityCode); + if (facility != null) { + return Result.ok(facility); + } else { + return Result.error("未找到设施代码为 " + facilityCode + " 的设施"); + } + } catch (Exception e) { + log.error("查询失败: " + e.getMessage()); + return Result.error("查询失败"); + } + } + + /** + * 根据国家查询 + */ + @Operation(summary = "根据加速器国家查询") + @GetMapping("/by-country") + public Result> getByCountry(@RequestParam String country) { + try { + List list = gardsAcceleratorService.getByCountry(country); + return Result.ok(list); + } catch (Exception e) { + log.error("查询失败: " + e.getMessage()); + return Result.error("查询失败" ); + } + } + + /** + * 根据运行状态查询 + */ + @Operation(summary = "根据加速器运行状态查询") + @GetMapping("/by-status") + public Result> getByOperationalStatus(@RequestParam Integer isOperational) { + try { + List list = gardsAcceleratorService.getByOperationalStatus(isOperational); + return Result.ok(list); + } catch (Exception e) { + log.error("查询失败: " + e.getMessage()); + return Result.error("查询失败"); + } + } + + /** + * 条件组合查询 + */ + @GetMapping("/search") + @Operation(summary = "条件组合查询") + public Result> search( + @RequestParam(required = false) String country, + @RequestParam(required = false) String category, + @RequestParam(required = false) Integer isOperational) { + try { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + + if (country != null && !country.isEmpty()) { + wrapper.eq(GardsAccelerator::getCountry, country); + } + if (category != null && !category.isEmpty()) { + wrapper.eq(GardsAccelerator::getCategory, category); + } + if (isOperational != null) { + wrapper.eq(GardsAccelerator::getIsOperational, isOperational); + } + + List list = gardsAcceleratorService.list(wrapper); + return Result.ok(list); + } catch (Exception e) { + log.error("条件查询失败: " + e.getMessage()); + return Result.error("条件查询失败"); + } + } + + @AutoLog(value = "导出模版") + @Operation(summary = "加速器信息导出模版") + @GetMapping("/exportTemplate") + public void exportTemplate(HttpServletResponse response) throws IOException { + ExportParams params = new ExportParams(); + params.setTitle("加速器信息"); + params.setFixedTitle(true); + params.setTitleHeight((short) 8); + params.setType(ExcelType.XSSF); + ExcelExportUtil.exportExcel(params, GardsAccelerator.class, new ArrayList<>()).write(response.getOutputStream()); + } + + @AutoLog(value = "导出数据") + @Operation(summary = "加速器信息导出数据") + @GetMapping("/exportExcel") + public void exportExcel(HttpServletResponse response, + @RequestParam(required = false) String country, + @RequestParam(required = false) String facilityName, + @RequestParam(required = false) String category) throws IOException { + ExportParams params = new ExportParams(); + params.setTitle("加速器信息"); + params.setFixedTitle(true); + params.setTitleHeight((short) 8); + params.setType(ExcelType.XSSF); + + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + + if (country != null && !country.isEmpty()) { + wrapper.eq(GardsAccelerator::getCountry, country); + } + if (category != null && !category.isEmpty()) { + wrapper.eq(GardsAccelerator::getCategory, category); + } + if (facilityName != null && !facilityName.isEmpty()) { + wrapper.eq(GardsAccelerator::getFacilityName, facilityName); + } + List list = gardsAcceleratorService.list(wrapper); + ExcelExportUtil.exportExcel(params, GardsAccelerator.class, list).write(response.getOutputStream()); + } + + + /** + * 通过excel导入数据 + * + * @param request + * @return + */ + @AutoLog(value = "导入GardsAccelerator数据") + @Operation(summary = "导入加速器数据") + @PostMapping(value = "/importExcel") + public Result importExcel(HttpServletRequest request) { + // 1. 获取上传文件 + MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; + Map fileMap = multipartRequest.getFileMap(); + + // 2. 遍历文件进行处理 + for (Map.Entry 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 list = ExcelImportUtil.importExcel(file.getInputStream(), GardsAccelerator.class, params); + + // 4. 批量保存数据到数据库 + gardsAcceleratorService.saveBatch(list); + + 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("文件导入失败!"); + } + + +} diff --git a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsCorrectionFactorController.java b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsCorrectionFactorController.java new file mode 100644 index 0000000..a5dcb87 --- /dev/null +++ b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsCorrectionFactorController.java @@ -0,0 +1,358 @@ +package org.jeecg.controller; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.StringUtils; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +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.GardsAccelerator; +import org.jeecg.modules.base.entity.configuration.GardsCorrectionFactor; +import org.jeecg.service.GardsCorrectionFactorService; +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.factory.annotation.Autowired; +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; + +@Slf4j +@RestController +@RequestMapping("/gardsCorrectionFactor") +public class GardsCorrectionFactorController { + + @Autowired + private GardsCorrectionFactorService gardsCorrectionFactorService; + + /** + * 新增校正因子 + */ + @PostMapping("/create") + @Operation(summary = "新增校正因子") + public Result create(@RequestBody GardsCorrectionFactor gardsCorrectionFactor) { + try { + boolean success = gardsCorrectionFactorService.save(gardsCorrectionFactor); + if (success) { + return Result.OK("校正因子添加成功", gardsCorrectionFactor); + } else { + return Result.error("校正因子添加失败"); + } + } catch (Exception e) { + log.error("操作失败: " + e.getMessage()); + return Result.error("操作失败"); + } + } + + /** + * 根据ID删除校正因子 + */ + @DeleteMapping("/delete") + @Operation(summary = "根据ID删除校正因子") + public Result delete(@RequestParam(name="id") Integer id) { + try { + boolean success = gardsCorrectionFactorService.removeById(id); + if (success) { + return Result.ok("校正因子删除成功"); + } else { + return Result.error("校正因子删除失败,可能该记录不存在"); + } + } catch (Exception e) { + log.error("操作失败: " + e.getMessage()); + return Result.error("操作失败"); + } + } + + /** + * 更新校正因子信息 + */ + @PutMapping("/update") + @Operation(summary = "更新校正因子信息") + public Result update(@RequestBody GardsCorrectionFactor gardsCorrectionFactor) { + try { + boolean success = gardsCorrectionFactorService.updateById(gardsCorrectionFactor); + if (success) { + return Result.OK("校正因子更新成功", gardsCorrectionFactor); + } else { + return Result.error("校正因子更新失败,可能该记录不存在"); + } + } catch (Exception e) { + log.error("操作失败: " + e.getMessage()); + return Result.error("操作失败"); + } + } + + /** + * 根据ID查询校正因子详情 + */ + @GetMapping("/queryById") + @Operation(summary = "根据ID查询校正因子详情") + public Result getById(@RequestParam(name="id") Integer id) { + try { + GardsCorrectionFactor factor = gardsCorrectionFactorService.getById(id); + if (factor != null) { + return Result.OK("查询成功", factor); + } else { + return Result.error("未找到对应的校正因子信息"); + } + } catch (Exception e) { + log.error("操作失败: " + e.getMessage()); + return Result.error("查询失败"); + } + } + + /** + * 分页查询校正因子列表 + */ + @GetMapping("/page") + @Operation(summary = "分页查询校正因子列表") + public Result> page( + @RequestParam(defaultValue = "1") Integer pageNum, + @RequestParam(defaultValue = "10") Integer pageSize, + @RequestParam(required = false) String stationCode, + @RequestParam(required = false) String detectorCode) { + try { + Page page = new Page<>(pageNum, pageSize); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + + if (stationCode != null && !stationCode.trim().isEmpty()) { + wrapper.eq(GardsCorrectionFactor::getStationCode, stationCode); + } + if (detectorCode != null && !detectorCode.trim().isEmpty()) { + wrapper.eq(GardsCorrectionFactor::getDetectorCode, detectorCode); + } + + IPage pageResult = gardsCorrectionFactorService.page(page, wrapper); + return Result.OK ("分页查询成功", pageResult); + } catch (Exception e) { + log.error("分页查询失败: " + e.getMessage()); + return Result.error("分页查询失败"); + } + } + + /** + * 查询所有校正因子列表 + */ + @GetMapping("/list") + @Operation(summary = "查询所有校正因子列表") + public Result> list() { + try { + List list = gardsCorrectionFactorService.list(); + return Result.OK ("查询成功", list); + } catch (Exception e) { + log.error("查询失败: " + e.getMessage()); + return Result.error("查询失败" ); + } + } + + /** + * 根据站点代码查询 + */ + @GetMapping("/by-station") + @Operation(summary = "根据站点代码查询") + public Result> getByStationCode(@RequestParam(name = "stationCode") String stationCode) { + try { + List list = gardsCorrectionFactorService.getByStationCode(stationCode); + return Result.OK ("查询成功", list); + } catch (Exception e) { + log.error("查询失败: " + e.getMessage()); + return Result.error("查询失败"); + } + } + + /** + * 根据探测器代码查询 + */ + @GetMapping("/by-detector") + @Operation(summary = "查询所有校正因子库数据") + public Result> getByDetectorCode(@RequestParam(name="detectorCode") String detectorCode) { + try { + List list = gardsCorrectionFactorService.getByDetectorCode(detectorCode); + return Result.OK ("查询成功", list); + } catch (Exception e) { + log.error("查询失败: " + e.getMessage()); + return Result.error("查询失败"); + } + } + + /** + * 根据站点和探测器代码组合查询 + */ + @GetMapping("/by-station-detector") + @Operation(summary = "根据站点和探测器代码组合查询") + public Result> getByStationAndDetector( + @RequestParam String stationCode, + @RequestParam String detectorCode) { + try { + List factor = gardsCorrectionFactorService.getByStationAndDetector(stationCode, detectorCode); + if (factor != null) { + return Result.OK("查询成功", factor); + } else { + return Result.error("未找到对应的校正因子"); + } + } catch (Exception e) { + log.error("查询失败: " + e.getMessage()); + return Result.error("查询失败"); + } + } + + /** + * 根据制造商查询 + */ + @GetMapping("/by-manufacturer") + @Operation(summary = "根据制造商查询") + public Result> getByManufacturer(@RequestParam String manufacturer) { + try { + List list = gardsCorrectionFactorService.getByManufacturer(manufacturer); + return Result.OK("查询成功", list); + } catch (Exception e) { + log.error("查询失败: " + e.getMessage()); + return Result.error("查询失败"); + } + } + + /** + * 根据型号查询 + */ + @GetMapping("/by-model") + @Operation(summary = "根据型号查询") + public Result> getByModel(@RequestParam String model) { + try { + List list = gardsCorrectionFactorService.getByModel(model); + return Result.OK ("查询成功", list); + } catch (Exception e) { + log.error("查询失败: " + e.getMessage()); + return Result.error("查询失败"); + } + } + + /** + * 多条件组合查询 + */ + @GetMapping("/search") + @Operation(summary = "校正因子多条件组合查询") + public Result> search( + @RequestParam(required = false) String stationCode, + @RequestParam(required = false) String detectorCode, + @RequestParam(required = false) String manufacturer, + @RequestParam(required = false) String model) { + try { + List list = gardsCorrectionFactorService.getByConditions( + stationCode, detectorCode, manufacturer, model); + return Result.OK ("查询成功", list); + } catch (Exception e) { + log.error("条件查询失败: " + e.getMessage()); + return Result.error("条件查询失败"); + } + } + + /** + * 批量更新校正因子 + */ + @PutMapping("/batch") + @Operation(summary = "校正因子批量更新") + public Result updateBatch(@RequestBody List factors) { + try { + boolean success = gardsCorrectionFactorService.updateBatchCorrectionFactors(factors); + if (success) { + return Result.ok("批量更新成功"); + } else { + return Result.error("批量更新失败"); + } + } catch (Exception e) { + log.error("批量操作失败: " + e.getMessage()); + return Result.error("批量操作失败"); + } + } + + @AutoLog(value = "导出模版") + @Operation(summary = "导出模版") + @GetMapping("/exportTemplate") + public void exportTemplate(HttpServletResponse response) throws IOException { + ExportParams params = new ExportParams(); + params.setTitle("探测器模拟及联符合校正因子信息"); + params.setFixedTitle(true); + params.setTitleHeight((short) 8); + params.setType(ExcelType.XSSF); + ExcelExportUtil.exportExcel(params, GardsCorrectionFactor.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 manufacturer, + @RequestParam(required = false) String model) throws IOException { + ExportParams params = new ExportParams(); + params.setTitle("探测器模拟及联符合校正因子信息"); + params.setFixedTitle(true); + params.setTitleHeight((short) 8); + params.setType(ExcelType.XSSF); + + List list = gardsCorrectionFactorService.getByConditions( + stationCode, detectorCode, manufacturer, model); + + 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 fileMap = multipartRequest.getFileMap(); + + // 2. 遍历文件进行处理 + for (Map.Entry 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 list = ExcelImportUtil.importExcel(file.getInputStream(), GardsCorrectionFactor.class, params); + + // 4. 批量保存数据到数据库 + gardsCorrectionFactorService.saveBatch(list); + + 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("文件导入失败!"); + } + + + +} diff --git a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsNuclearFuelFacilityController.java b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsNuclearFuelFacilityController.java new file mode 100644 index 0000000..ff89551 --- /dev/null +++ b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsNuclearFuelFacilityController.java @@ -0,0 +1,285 @@ +package org.jeecg.controller; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +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.GardsNuclearFuelFacilities; +import org.jeecg.service.GardsNuclearFuelFacilityService; +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.factory.annotation.Autowired; +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; + +@Slf4j +@RestController +@RequestMapping("/gardsNuclearFuelFacility") +public class GardsNuclearFuelFacilityController { + + @Autowired + private GardsNuclearFuelFacilityService nuclearFuelFacilitiesService; + + /** + * 新增核燃料设施信息 + */ + @PostMapping("/create") + @Operation(summary = "新增核燃料设施信息") + public Result create(@RequestBody GardsNuclearFuelFacilities facility) { + try { + boolean success = nuclearFuelFacilitiesService.save(facility); + if (success) { + return Result.OK("核燃料设施信息添加成功", facility); + } else { + return Result.error("核燃料设施信息添加失败"); + } + } catch (Exception e) { + log.error("操作失败: " + e.getMessage()); + return Result.error("操作失败"); + } + } + + /** + * 根据ID删除核燃料设施信息 + */ + @DeleteMapping("/delete") + @Operation(summary = "根据ID删除核燃料设施信息") + public Result delete(@RequestParam Integer id) { + try { + boolean success = nuclearFuelFacilitiesService.removeById(id); + if (success) { + return Result.ok("核燃料设施信息删除成功"); + } else { + return Result.error("核燃料设施信息删除失败,可能该记录不存在"); + } + } catch (Exception e) { + log.error("操作失败: " + e.getMessage()); + return Result.error("操作失败 "); + } + } + + /** + * 更新核燃料设施信息 + */ + @PutMapping("/update") + @Operation(summary = "更新核燃料设施信息") + public Result update(@RequestBody GardsNuclearFuelFacilities facility) { + try { + boolean success = nuclearFuelFacilitiesService.updateById(facility); + if (success) { + return Result.OK("核燃料设施信息更新成功", facility); + } else { + return Result.error("核燃料设施信息更新失败,可能该记录不存在"); + } + } catch (Exception e) { + log.error("操作失败: " + e.getMessage()); + return Result.error("操作失败"); + } + } + + /** + * 根据ID查询核燃料设施详情 + */ + @GetMapping("/getById") + @Operation(summary = "根据ID查询核燃料设施详情") + public Result getById(@RequestParam Integer id) { + try { + GardsNuclearFuelFacilities facility = nuclearFuelFacilitiesService.getById(id); + if (facility != null) { + return Result.ok(facility); + } else { + return Result.error("未找到对应的核燃料设施信息"); + } + } catch (Exception e) { + log.error("操作失败: " + e.getMessage()); + return Result.error("查询失败"); + } + } + + /** + * 分页查询核燃料设施列表 + */ + @GetMapping("/page") + @Operation(summary = "分页查询核燃料设施列表") + public Result> page( + @RequestParam(defaultValue = "1") Integer pageNum, + @RequestParam(defaultValue = "10") Integer pageSize, + @RequestParam(required = false) String facilityType, + @RequestParam(required = false) String facilityStatus, + @RequestParam(required = false) String facilityName, + @RequestParam(required = false) String country) { + try { + Page page = new Page<>(pageNum, pageSize); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + + if (facilityType != null && !facilityType.trim().isEmpty()) { + wrapper.eq(GardsNuclearFuelFacilities::getFacilityType, facilityType); + } + if (facilityStatus != null && !facilityStatus.trim().isEmpty()) { + wrapper.eq(GardsNuclearFuelFacilities::getFacilityStatus, facilityStatus); + } + if (facilityName != null && !facilityName.trim().isEmpty()) { + wrapper.eq(GardsNuclearFuelFacilities::getFacilityName, facilityName); + } + if (country != null && !country.trim().isEmpty()) { + wrapper.eq(GardsNuclearFuelFacilities::getCountry, country); + } + + IPage pageResult = nuclearFuelFacilitiesService.page(page, wrapper); + return Result.OK("分页查询成功", pageResult); + } catch (Exception e) { + log.error("操作失败: " + e.getMessage()); + return Result.error("分页查询失败"); + } + } + + /** + * 查询所有核燃料设施列表 + */ + @GetMapping("/list") + @Operation(summary = "查询所有核燃料设施列表") + public Result> list() { + try { + List list = nuclearFuelFacilitiesService.list(); + return Result.OK("查询成功", list); + } catch (Exception e) { + log.error("操作失败: " + e.getMessage()); + return Result.error("查询失败"); + } + } + + /** + * 根据设施名称模糊查询 + */ + @GetMapping("/by-name") + @Operation(summary = "根据设施名称模糊查询") + public Result> getByFacilityNameLike(@RequestParam String facilityName) { + try { + List list = nuclearFuelFacilitiesService.getByFacilityNameLike(facilityName); + return Result.OK("查询成功", list); + } catch (Exception e) { + log.error("操作失败: " + e.getMessage()); + return Result.error("查询失败"); + } + } + + + /** + * 多条件组合查询 + */ + @GetMapping("/search") + @Operation(summary = "多条件组合查询") + public Result> search( + @RequestParam(required = false) String facilityType, + @RequestParam(required = false) String facilityStatus, + @RequestParam(required = false) String country, + @RequestParam(required = false) String facilityName, + @RequestParam(required = false) String fuelType) { + try { + List list = nuclearFuelFacilitiesService.getByConditions( + facilityType, facilityStatus, country, facilityName, fuelType); + return Result.OK("查询成功", list); + } catch (Exception e) { + log.error("操作失败: " + e.getMessage()); + return Result.error("条件查询失败"); + } + } + + @AutoLog(value = "导出模版") + @Operation(summary = "导出模版") + @GetMapping("/exportTemplate") + public void exportTemplate(HttpServletResponse response) throws IOException { + ExportParams params = new ExportParams(); + params.setTitle("后处理厂设施信息"); + params.setFixedTitle(true); + params.setTitleHeight((short) 8); + params.setType(ExcelType.XSSF); + ExcelExportUtil.exportExcel(params, GardsNuclearFuelFacilities.class, new ArrayList<>()).write(response.getOutputStream()); + } + + @AutoLog(value = "导出Excel") + @Operation(summary = "导出Excel") + @GetMapping("/exportExcel") + public void exportExcel(HttpServletResponse response, @RequestParam(required = false) String facilityType, + @RequestParam(required = false) String facilityStatus, + @RequestParam(required = false) String country, + @RequestParam(required = false) String facilityName, + @RequestParam(required = false) String fuelType) throws IOException { + ExportParams params = new ExportParams(); + params.setTitle("后处理厂设施信息"); + params.setFixedTitle(true); + params.setTitleHeight((short) 8); + params.setType(ExcelType.XSSF); + List list = nuclearFuelFacilitiesService.getByConditions( + facilityType, facilityStatus, country, facilityName, fuelType); + ExcelExportUtil.exportExcel(params, GardsNuclearFuelFacilities.class, list).write(response.getOutputStream()); + } + + + /** + * 通过excel导入数据 + * + * @param request + * @param response + * @return + */ + @AutoLog(value = "导入GardsAccelerator数据") + @PostMapping(value = "/importExcel") + public Result importExcel(HttpServletRequest request, HttpServletResponse response) { + // 1. 获取上传文件 + MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; + Map fileMap = multipartRequest.getFileMap(); + + // 2. 遍历文件进行处理 + for (Map.Entry 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 list = ExcelImportUtil.importExcel(file.getInputStream(), GardsNuclearFuelFacilities.class, params); + + // 4. 批量保存数据到数据库 + boolean success = nuclearFuelFacilitiesService.saveBatch(list, 500); + if (success) { + return Result.OK("文件导入成功!数据行数:" + list.size()); + } else { + return Result.error("文件导入失败"); + } + + } catch (Exception e) { + return Result.error("文件导入失败:" + e.getMessage()); + } finally { + try { + file.getInputStream().close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + return Result.error("文件导入失败!"); + } + + +} diff --git a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsNuclearReactorsController.java b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsNuclearReactorsController.java new file mode 100644 index 0000000..4fbeb76 --- /dev/null +++ b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsNuclearReactorsController.java @@ -0,0 +1,307 @@ +package org.jeecg.controller; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import io.swagger.v3.oas.annotations.Operation; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import lombok.extern.log4j.Log4j; +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.GardsNuclearFuelFacilities; +import org.jeecg.modules.base.entity.configuration.GardsNuclearReactors; +import org.jeecg.modules.base.mapper.GardsNuclearReactorsMapper; +import org.jeecg.service.GardsNuclearReactorsService; +import org.jeecg.util.BizUpsertUtil; +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.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; + +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +@Slf4j +@RestController +@RequestMapping("/gardsNuclearReactors") +public class GardsNuclearReactorsController { + + @Autowired + private GardsNuclearReactorsService gardsNuclearReactorsService; + + /** + * 新增 核设施信息 + * + * @param gardsNuclearReactors + * @return + */ + @PostMapping("/create") + @Operation(summary = "新增核设施信息") + public Result create(@RequestBody GardsNuclearReactors gardsNuclearReactors) { + + try { + boolean success = gardsNuclearReactorsService.save(gardsNuclearReactors); + if (success) { + return Result.OK("添加核设施信息成功", gardsNuclearReactors); + } else { + return Result.error("添加核设施信息失败"); + } + } catch (Exception e) { + log.error("新增操作失败: " + e.getMessage()); + return Result.error("操作失败"); + } + } + + /** + * 删除反应堆数据 + * + * @param id + * @return + */ + @DeleteMapping("/delete") + @Operation(summary = "删除核设施信息数据") + public Result delete(@RequestParam Integer id) { + try { + boolean success = gardsNuclearReactorsService.removeById(id); + if (success) { + return Result.ok("核设施信息删除成功"); + } + return Result.error("删除核设施信息失败,可能该记录不存在"); + + } catch (Exception e) { + log.error("操作失败: " + e.getMessage()); + return Result.error("操作失败"); + } + } + + /** + * 更新反应堆数据 + * + * @param gardsNuclearReactors + * @return + */ + @PutMapping("/update") + @Operation(summary = "更新核设施数据") + public Result update(@RequestBody GardsNuclearReactors gardsNuclearReactors) { + try { + boolean success = gardsNuclearReactorsService.updateById(gardsNuclearReactors); + if (success) { + return Result.OK("更新成功", gardsNuclearReactors); + } else { + return Result.error("更新失败,或者记录不存在"); + + } + } catch (Exception e) { + log.error("操作失败: " + e.getMessage()); + return Result.error("操作失败"); + } + } + + /** + * 根据Id查询反应堆数据 + * + * @param id + * @return + */ + @GetMapping("/getById") + @Operation(summary = "根据Id查询反应堆数据") + public Result getById(@RequestParam Integer id) { + try { + GardsNuclearReactors nuclearReactors = gardsNuclearReactorsService.getById(id); + if (nuclearReactors != null) { + return Result.OK(nuclearReactors); + } else { + return Result.error("未找到核设施信息数据"); + } + } catch (Exception e) { + log.error("操作失败: " + e.getMessage()); + return Result.error("查询失败"); + } + + } + + /** + * 分页查询反应堆数据 + * + * @param pageNum 页码 + * @param pageSize 分页大小 + * @param unitName 单位名称 + * @param country 国家 + * @return + */ + @GetMapping("/page") + @Operation(summary = "分页查询核设施信息数据") + public Result> page( + @RequestParam(defaultValue = "1") Integer pageNum, + @RequestParam(defaultValue = "10") Integer pageSize, + @RequestParam(required = false) String unitName, + @RequestParam(required = false) String country) { + + try { + Page page = new Page<>(pageNum, pageSize); + + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + + if (unitName != null && !unitName.trim().isEmpty()) { + wrapper.eq(GardsNuclearReactors::getUnitName, unitName); + } + if (country != null && !country.trim().isEmpty()) { + wrapper.eq(GardsNuclearReactors::getCountry, country); + } + IPage pageResult = gardsNuclearReactorsService.page(page, wrapper); + + return Result.OK(pageResult); + } catch (Exception e) { + log.error("查询失败: " + e.getMessage()); + return Result.error("查询失败"); + } + + + } + + /** + * 组合条件查询 + * + * @param unitName 名称 + * @param country 国家 + * @param reactorType reactorType + * @param reactorStatus reactorStatus + * @return list + */ + @GetMapping("/search") + @Operation(summary = "核设施信息组合条件查询") + public Result> search(@RequestParam(required = false) String unitName, + @RequestParam(required = false) String country, + @RequestParam(required = false) String reactorType, + @RequestParam(required = false) String reactorStatus) { + + try { + List list = gardsNuclearReactorsService.getByConditions(unitName, country, reactorType, reactorStatus); + return Result.OK(list); + } catch (Exception e) { + log.error("条件查询失败: " + e.getMessage()); + return Result.error("条件查询失败"); + } + + + } + + + @AutoLog(value = "导出模版") + @Operation(summary = "核设施信息导出模版") + @GetMapping("/exportTemplate") + public void exportTemplate(HttpServletResponse response) throws IOException { + ExportParams params = new ExportParams(); + params.setTitle("核设施信息"); + params.setFixedTitle(true); + params.setTitleHeight((short) 8); + params.setType(ExcelType.XSSF); + ExcelExportUtil.exportExcel(params, GardsNuclearReactors.class, new ArrayList<>()).write(response.getOutputStream()); + } + + @AutoLog(value = "导出Excel") + @Operation(summary = "核设施信息导出Excel") + @GetMapping("/exportExcel") + public void exportExcel(HttpServletResponse response, + @RequestParam(required = false) String unitName, + @RequestParam(required = false) String country, + @RequestParam(required = false) String reactorType, + @RequestParam(required = false) String reactorStatus) throws IOException { + ExportParams params = new ExportParams(); + params.setTitle("核设施信息"); + params.setFixedTitle(true); + params.setTitleHeight((short) 8); + params.setType(ExcelType.XSSF); + List list = gardsNuclearReactorsService.getByConditions(unitName, country, reactorType, reactorStatus); + ExcelExportUtil.exportExcel(params, GardsNuclearReactors.class, list).write(response.getOutputStream()); + } + + + /** + * 通过excel导入数据 + * + * @param request + * @param + * @return + */ + @AutoLog(value = "GardsNuclearReactors") + @Operation(summary = "核设施信息导入数据") + @PostMapping(value = "/importExcel") + public Result importExcel(HttpServletRequest request) { + + + // 1. 【关键修复】检查请求是否为 multipart 请求 + // 如果前端没有使用 form-data 格式提交,或者 Content-Type 不对,这里会拦截 + if (!(request instanceof MultipartHttpServletRequest)) { + return Result.error("请求不是文件上传格式,请检查 Content-Type 是否为 multipart/form-data"); + } + + // 2. 安全转换为 MultipartHttpServletRequest + MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; + Map fileMap = multipartRequest.getFileMap(); + + // 3. 检查是否有文件 + if (fileMap == null || fileMap.isEmpty()) { + return Result.error("未检测到上传的文件"); + } + + // 4. 遍历文件进行处理 + for (Map.Entry entity : fileMap.entrySet()) { + // 获取上传文件对象 + MultipartFile file = entity.getValue(); + + // 过滤空文件 + if (file == null || file.isEmpty()) { + continue; + } + + ImportParams params = new ImportParams(); + // 设置标题行行数(通常为1,如果没有标题填0) + params.setTitleRows(1); + // 设置表头行数(通常为1) + params.setHeadRows(1); + params.setNeedSave(true); + + // 5.使用 try-with-resources 自动关闭流 + try (InputStream inputStream = file.getInputStream()) { + + // 使用 AutoPoi 工具类解析 Excel + List list = ExcelImportUtil.importExcel(inputStream, GardsNuclearReactors.class, params); + + // 简单的校验,防止空列表报错 + if (list == null || list.isEmpty()) { + return Result.error("导入失败:文件中没有数据"); + } + + // 批量保存数据到数据库 + boolean success = BizUpsertUtil.upsert(gardsNuclearReactorsService, list, GardsNuclearReactors::getUnitName); + //gardsNuclearReactorsService.saveBatch(list); + if (success) { + return Result.OK("文件导入成功!数据行数:" + list.size()); + } else { + Result.error("文件导入失败"); + } + + } catch (Exception e) { + return Result.error("文件导入失败: " + e.getMessage()); + } + + } + + return Result.error("文件导入失败,未找到有效文件!"); + + + } + + +} diff --git a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsNuclearReleaseController.java b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsNuclearReleaseController.java new file mode 100644 index 0000000..548b345 --- /dev/null +++ b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsNuclearReleaseController.java @@ -0,0 +1,260 @@ +package org.jeecg.controller; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +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.GardsNuclearReactors; +import org.jeecg.modules.base.entity.configuration.GardsNuclearReleaseRecords; +import org.jeecg.service.GardsNuclearReleaseService; +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.factory.annotation.Autowired; +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; +@Slf4j +@RestController +@RequestMapping("/gardsNuclearReleaseRecords") +public class GardsNuclearReleaseController { + + @Autowired + private GardsNuclearReleaseService gardsNuclearReleaseService; + + /** + * 新增加核设施放射性排放记录信息 + */ + @PostMapping("/create") + @Operation(summary = "新增加核设施放射性排放记录信息") + public Result create(@RequestBody GardsNuclearReleaseRecords gardsNuclearReleaseRecords) { + try { + boolean success = gardsNuclearReleaseService.save(gardsNuclearReleaseRecords); + if (success) { + return Result.OK("添加成功", gardsNuclearReleaseRecords); + } else { + return Result.error("添加失败"); + } + } catch (Exception e) { + log.error("create: " + e.getMessage()); + return Result.error("添加失败"); + } + } + + /** + * 删除核设施放射性排放记录信息 + */ + @DeleteMapping("/delete") + @Operation(summary = "删除核设施放射性排放记录信息") + public Result deleteById(@RequestParam Integer id) { + try { + boolean success = gardsNuclearReleaseService.removeById(id); + if (success) { + return Result.OK("删除成功"); + } else { + return Result.error("删除失败,可能数据不存在"); + + } + } catch (Exception e) { + log.error("deleteById: " + e.getMessage()); + return Result.error("操作失败"); + } + } + + /** + * 更新核设施放射性排放记录信息 + */ + @PutMapping("/update") + @Operation(summary = "更新核设施放射性排放记录信息") + public Result update(@RequestBody GardsNuclearReleaseRecords gardsNuclearReleaseRecords) { + try { + boolean success = gardsNuclearReleaseService.updateById(gardsNuclearReleaseRecords); + if (success) { + return Result.OK("数据更新成功", gardsNuclearReleaseRecords); + } else { + return Result.error("数据更新失败"); + + } + } catch (Exception e) { + log.error("update: " + e.getMessage()); + return Result.error("操作失败"); + } + } + + /** + * 查询核设施放射性排放记录信息 + */ + @GetMapping("/queryById") + @Operation(summary = "查询核设施放射性排放记录信息") + public Result getById(@RequestParam Integer id) { + try { + GardsNuclearReleaseRecords nuclearReactors = gardsNuclearReleaseService.getById(id); + if (nuclearReactors != null) { + return Result.OK(nuclearReactors); + } else { + return Result.error("未找到数据"); + } + } catch (Exception e) { + log.error("getById: " + e.getMessage()); + return Result.error("查询失败"); + } + } + + /** + * 分页查询 + * + * @param pageNum + * @param pageSize + * @param siteName + * @param nuclide + * @return + */ + @GetMapping("/page") + @Operation(summary = "核设施放射性排放记录分页查询") + public Result> page( + @RequestParam(defaultValue = "1") Integer pageNum, + @RequestParam(defaultValue = "10") Integer pageSize, + @RequestParam(required = false) String siteName, + @RequestParam(required = false) String nuclide) { + + try { + Page page = new Page<>(pageNum, pageSize); + + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + + if (siteName != null && !siteName.trim().isEmpty()) { + wrapper.eq(GardsNuclearReleaseRecords::getSiteName, siteName); + } + if (nuclide != null && !nuclide.trim().isEmpty()) { + wrapper.eq(GardsNuclearReleaseRecords::getNuclide, nuclide); + } + IPage pageResult = gardsNuclearReleaseService.page(page, wrapper); + + return Result.OK(pageResult); + } catch (Exception e) { + log.error("page: " + e.getMessage()); + return Result.error("查询失败:"); + } + + + } + + /** + * 组合条件查询 + * + * @param siteName 地点名称 + * @param nuclide 具体核素 + * @param nuclideType 核素类型 + * @param releaseType 释放类型 + * @return + */ + @GetMapping("/search") + @Operation(summary = "核设施放射性排放记录组合条件查询") + public Result> search( + @RequestParam(required = false) String siteName, + @RequestParam(required = false) String nuclide, + @RequestParam(required = false) String nuclideType, + @RequestParam(required = false) String releaseType) { + + try { + List list = gardsNuclearReleaseService.getByConditions(siteName, nuclide, nuclideType, releaseType); + return Result.OK(list); + } catch (Exception e) { + log.error("条件查询失败: " + e.getMessage()); + return Result.error("查询失败"); + } + + } + + @AutoLog(value = "导出模版") + @Operation(summary = "核设施放射性排放记录导出模版") + @GetMapping("/exportTemplate") + public void exportTemplate(HttpServletResponse response) throws IOException { + ExportParams params = new ExportParams(); + params.setTitle("核设施放射性排放记录信息"); + params.setFixedTitle(true); + params.setTitleHeight((short) 8); + params.setType(ExcelType.XSSF); + ExcelExportUtil.exportExcel(params, GardsNuclearReleaseRecords.class, new ArrayList<>()).write(response.getOutputStream()); + } + + + @AutoLog(value = "导出Excel") + @Operation(summary = "核设施放射性排放记录导出Excel") + @GetMapping("/exportExcel") + public void exportExcel(HttpServletResponse response, + @RequestParam(required = false) String siteName, + @RequestParam(required = false) String nuclide, + @RequestParam(required = false) String nuclideType, + @RequestParam(required = false) String releaseType) throws IOException { + ExportParams params = new ExportParams(); + params.setTitle("核设施放射性排放记录信息"); + params.setFixedTitle(true); + params.setTitleHeight((short) 8); + params.setType(ExcelType.XSSF); + List list = gardsNuclearReleaseService.getByConditions(siteName, nuclide, nuclideType, releaseType); + ExcelExportUtil.exportExcel(params, GardsNuclearReleaseRecords.class, list).write(response.getOutputStream()); + } + + + /** + * 通过excel导入数据 + * + * @param request + * @param response + * @return + */ + @AutoLog(value = "GardsNuclearReleaseRecords") + @Operation(summary = "导入核设施放射性排放记录数据") + @PostMapping(value = "/importExcel") + public Result importExcel(HttpServletRequest request, HttpServletResponse response) { + // 1. 获取上传文件 + MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; + Map fileMap = multipartRequest.getFileMap(); + + // 2. 遍历文件进行处理 + for (Map.Entry 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 list = ExcelImportUtil.importExcel(file.getInputStream(), GardsNuclearReleaseRecords.class, params); + + // 4. 批量保存数据到数据库 + gardsNuclearReleaseService.saveBatch(list); + + 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("文件导入失败!"); + } + + +} diff --git a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsNuclearTestingPlantController.java b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsNuclearTestingPlantController.java new file mode 100644 index 0000000..f14a36f --- /dev/null +++ b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsNuclearTestingPlantController.java @@ -0,0 +1,268 @@ +package org.jeecg.controller; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.StringUtils; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +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.GardsNuclearReleaseRecords; +import org.jeecg.modules.base.entity.configuration.GardsNuclearTestingPlant; +import org.jeecg.service.GardsNuclearReleaseService; +import org.jeecg.service.GardsNuclearTestingPlantService; +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.factory.annotation.Autowired; +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; +@Slf4j +@RestController +@RequestMapping("/gardsNuclearTestingPlant") +public class GardsNuclearTestingPlantController { + + @Autowired + private GardsNuclearTestingPlantService gardsNuclearTestingPlantService; + + /** + * 新增 核试验信息 + */ + @PostMapping("/create") + @Operation(summary = "新增核试验信息") + public Result create(@RequestBody GardsNuclearTestingPlant gardsNuclearTestingPlant) { + try { + boolean success = gardsNuclearTestingPlantService.save(gardsNuclearTestingPlant); + if (success) { + return Result.OK("添加成功", gardsNuclearTestingPlant); + } else { + return Result.error("添加失败"); + } + } catch (Exception e) { + log.error("create: " + e.getMessage()); + return Result.error("添加失败"); + } + } + + /** + * 删除核设施放射性排放记录信息 + */ + @DeleteMapping("/delete") + @Operation(summary = "删除核试验信息") + public Result deleteById(@RequestParam Integer id) { + try { + boolean success = gardsNuclearTestingPlantService.removeById(id); + if (success) { + return Result.OK("删除成功"); + } else { + return Result.error("删除失败,可能数据不存在"); + + } + } catch (Exception e) { + log.error("deleteById: " + e.getMessage()); + return Result.error("操作失败:"); + } + } + + /** + * 更新核设施放射性排放记录信息 + */ + @PutMapping("/update") + @Operation(summary = "更新核试验信息") + public Result update(@RequestBody GardsNuclearTestingPlant gardsNuclearTestingPlant) { + try { + boolean success = gardsNuclearTestingPlantService.updateById(gardsNuclearTestingPlant); + if (success) { + return Result.OK("数据更新成功", gardsNuclearTestingPlant); + } else { + return Result.error("数据更新失败"); + + } + } catch (Exception e) { + log.error("update: " + e.getMessage()); + return Result.error("操作失败"); + } + } + + /** + * 查询核设施放射性排放记录信息 + */ + @GetMapping("/queryById") + @Operation(summary = "查询核试验信息") + public Result getById(@RequestParam Integer id) { + try { + GardsNuclearTestingPlant nuclearReactors = gardsNuclearTestingPlantService.getById(id); + if (nuclearReactors != null) { + return Result.OK(nuclearReactors); + } else { + return Result.error("未找到数据"); + } + } catch (Exception e) { + log.error("getById: " + e.getMessage()); + return Result.error("查询失败:" + e.getMessage()); + } + } + + /** + * 分页查询 + * + * @param pageNum + * @param pageSize + * @param name + * @param type + * @return + */ + @GetMapping("/page") + @Operation(summary = "核试验信息分页查询") + public Result> page( + @RequestParam(defaultValue = "1") Integer pageNum, + @RequestParam(defaultValue = "10") Integer pageSize, + @RequestParam(required = false) String name, + @RequestParam(required = false) String type) { + + try { + Page page = new Page<>(pageNum, pageSize); + + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + + if (name != null && !name.trim().isEmpty()) { + wrapper.eq(GardsNuclearTestingPlant::getName, name); + } + if (type != null && !type.trim().isEmpty()) { + wrapper.eq(GardsNuclearTestingPlant::getType, type); + } + IPage pageResult = gardsNuclearTestingPlantService.page(page, wrapper); + + return Result.OK(pageResult); + } catch (Exception e) { + log.error("page: " + e.getMessage()); + return Result.error("查询失败:" + e.getMessage()); + } + + + } + + /** + * 组合条件查询 + * + * @param name 地点名称 + * @param type 具体核素 + * @return + */ + @GetMapping("/search") + @Operation(summary = "核试验信息组合条件查询") + public Result> search( + @RequestParam(required = false) String name, + @RequestParam(required = false) String type) { + + try { + List list = gardsNuclearTestingPlantService.getByConditions(name, type); + return Result.OK(list); + } catch (Exception e) { + log.error("search: " + e.getMessage()); + return Result.error("查询失败"); + } + + } + + + @AutoLog(value = "导出模版") + @Operation(summary = "核试验信息导出模版") + @GetMapping("/exportTemplate") + public void exportTemplate(HttpServletResponse response) throws IOException { + ExportParams params = new ExportParams(); + params.setTitle("核试验信息"); + params.setFixedTitle(true); + params.setTitleHeight((short) 8); + params.setType(ExcelType.XSSF); + ExcelExportUtil.exportExcel(params, GardsNuclearTestingPlant.class, new ArrayList<>()).write(response.getOutputStream()); + } + + @AutoLog(value = "导出Excel") + @Operation(summary = "核试验信息导出Excel") + @GetMapping("/exportExcel") + public void exportExcel(HttpServletResponse response, + @RequestParam(required = false) String name, + @RequestParam(required = false) String type) throws IOException { + ExportParams params = new ExportParams(); + params.setTitle("核试验信息"); + params.setFixedTitle(true); + params.setTitleHeight((short) 8); + params.setType(ExcelType.XSSF); + List list = gardsNuclearTestingPlantService.getByConditions(name, type); + ExcelExportUtil.exportExcel(params, GardsNuclearTestingPlant.class, list).write(response.getOutputStream()); + } + + + /** + * 通过excel导入数据 + * + * @param request + * @return + */ + @AutoLog(value = "GardsNuclearTestingPlant") + @Operation(summary = "核试验信息导入数据") + @PostMapping(value = "/importExcel") + public Result importExcel(HttpServletRequest request) { + // 1. 获取上传文件 + MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; + Map fileMap = multipartRequest.getFileMap(); + + // 2. 遍历文件进行处理 + for (Map.Entry 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 list = ExcelImportUtil.importExcel(file.getInputStream(), GardsNuclearTestingPlant.class, params); + + list.forEach(testingPlant -> { + if (StringUtils.isNotBlank(testingPlant.getInfo())) { + testingPlant.setInfo(testingPlant.getInfo() + .replace("&", "&") + .replace("<", "<") + .replace(">", ">") + .replace("\"", """) + .replace("'", "'") + .replaceAll("(?i)\\bmegatons?\\b", "Mt") + .replaceAll("(?i)\\bkilotons?\\b", "kt") + ); + } + }); + // 4. 批量保存数据到数据库 + gardsNuclearTestingPlantService.saveBatch(list,5); + + 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("文件导入失败!"); + } + + +} diff --git a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsResearchReactorsController.java b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsResearchReactorsController.java new file mode 100644 index 0000000..0ed2a88 --- /dev/null +++ b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsResearchReactorsController.java @@ -0,0 +1,256 @@ +package org.jeecg.controller; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +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.GardsNuclearTestingPlant; +import org.jeecg.modules.base.entity.configuration.GardsResearchReactors; +import org.jeecg.modules.base.entity.configuration.GardsResearchReactors; +import org.jeecg.service.GardsResearchReactorsService; +import org.jeecg.service.GardsResearchReactorsService; +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.factory.annotation.Autowired; +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; +@Slf4j +@RestController +@RequestMapping("/gardsResearchReactors")//C17ZNRJDMD6N +public class GardsResearchReactorsController { + @Autowired + private GardsResearchReactorsService gardsResearchReactorsService; + + /** + * 新增信息 + */ + @PostMapping("/create") + @Operation(summary = "新增反应堆信息") + public Result create(@RequestBody GardsResearchReactors gardsResearchReactors) { + try { + boolean success = gardsResearchReactorsService.save(gardsResearchReactors); + if (success) { + return Result.OK("反应堆信息添加成功", gardsResearchReactors); + } else { + return Result.error("反应堆信息添加失败"); + } + } catch (Exception e) { + log.error("create: " + e.getMessage()); + return Result.error("添加失败"); + } + } + + /** + * 删除信息 + */ + @DeleteMapping("/delete") + @Operation(summary = "删除反应堆信息") + public Result deleteById(@RequestParam Integer id) { + try { + boolean success = gardsResearchReactorsService.removeById(id); + if (success) { + return Result.OK("删除成功"); + } else { + return Result.error("删除失败,可能数据不存在"); + + } + } catch (Exception e) { + log.error("deleteById: " + e.getMessage()); + return Result.error("操作失败"); + } + } + + /** + * 更新反应堆信息 + */ + @PutMapping("/update") + @Operation(summary = "更新反应堆信息") + public Result update(@RequestBody GardsResearchReactors gardsResearchReactors) { + try { + boolean success = gardsResearchReactorsService.updateById(gardsResearchReactors); + if (success) { + return Result.OK("数据更新成功", gardsResearchReactors); + } else { + return Result.error("数据更新失败"); + + } + } catch (Exception e) { + log.error("update: " + e.getMessage()); + return Result.error("操作失败"); + } + } + + /** + * 查询信息 + */ + @GetMapping("/queryById") + @Operation(summary = "查询反应堆信息") + public Result getById(@RequestParam Integer id) { + try { + GardsResearchReactors nuclearReactors = gardsResearchReactorsService.getById(id); + if (nuclearReactors != null) { + return Result.OK(nuclearReactors); + } else { + return Result.error("未找到数据"); + } + } catch (Exception e) { + log.error("getById: " + e.getMessage()); + return Result.error("查询失败"); + } + } + + /** + * 分页查询 + * + * @param pageNum + * @param pageSize + * @param facilityName + * @param country + * @return + */ + @GetMapping("/page") + @Operation(summary = "反应堆信息分页查询") + public Result> page( + @RequestParam(defaultValue = "1") Integer pageNum, + @RequestParam(defaultValue = "10") Integer pageSize, + @RequestParam(required = false) String facilityName, + @RequestParam(required = false) String country) { + + try { + Page page = new Page<>(pageNum, pageSize); + + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + + if (facilityName != null && !facilityName.trim().isEmpty()) { + wrapper.eq(GardsResearchReactors::getFacilityName, facilityName); + } + if (country != null && !country.trim().isEmpty()) { + wrapper.eq(GardsResearchReactors::getCountry, country); + } + IPage pageResult = gardsResearchReactorsService.page(page, wrapper); + + return Result.OK(pageResult); + } catch (Exception e) { + log.error("page: " + e.getMessage()); + return Result.error("查询失败" ); + } + + + } + + /** + * 组合条件查询 + * + * @param facilityName 地点名称 + * @param country 具体核素 + * @return + */ + @GetMapping("/search") + @Operation(summary = "反应堆信息组合条件查询") + public Result> search(@RequestParam(required = false) String facilityName, + @RequestParam(required = false) String country, + @RequestParam(required = false) String reactorType, + @RequestParam(required = false) String status) { + + try { + List list = gardsResearchReactorsService.getByConditions(facilityName, country, reactorType, status); + return Result.OK(list); + } catch (Exception e) { + log.error("search: " + e.getMessage()); + return Result.error("查询失败"); + } + + } + + @AutoLog(value = "导出模版") + @Operation(summary = "反应堆信息导出模版") + @GetMapping("/exportTemplate") + public void exportTemplate(HttpServletResponse response) throws IOException { + ExportParams params = new ExportParams(); + params.setTitle("反应堆信息"); + params.setFixedTitle(true); + params.setTitleHeight((short) 8); + params.setType(ExcelType.XSSF); + ExcelExportUtil.exportExcel(params, GardsResearchReactors.class, new ArrayList<>()).write(response.getOutputStream()); + } + + @AutoLog(value = "导出Excel") + @Operation(summary = "反应堆信息导出Excel") + @GetMapping("/exportExcel") + public void exportExcel(HttpServletResponse response, + @RequestParam(required = false) String facilityName, + @RequestParam(required = false) String country, + @RequestParam(required = false) String reactorType, + @RequestParam(required = false) String status) throws IOException { + ExportParams params = new ExportParams(); + params.setTitle("反应堆信息"); + params.setFixedTitle(true); + params.setTitleHeight((short) 8); + params.setType(ExcelType.XSSF); + List list = gardsResearchReactorsService.getByConditions(facilityName, country, reactorType, status); + ExcelExportUtil.exportExcel(params, GardsResearchReactors.class, list).write(response.getOutputStream()); + } + + + /** + * 通过excel导入数据 + * + * @param request + * @return + */ + @AutoLog(value = "GardsResearchReactors") + @Operation(summary = "反应堆信息导入数据") + @PostMapping(value = "/importExcel") + public Result importExcel(HttpServletRequest request) { + // 1. 获取上传文件 + MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; + Map fileMap = multipartRequest.getFileMap(); + + // 2. 遍历文件进行处理 + for (Map.Entry 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 list = ExcelImportUtil.importExcel(file.getInputStream(), GardsResearchReactors.class, params); + + // 4. 批量保存数据到数据库 + gardsResearchReactorsService.saveBatch(list); + + 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("文件导入失败!"); + } + + +} diff --git a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsStationsController.java b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsStationsController.java new file mode 100644 index 0000000..ef9c8d4 --- /dev/null +++ b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsStationsController.java @@ -0,0 +1,252 @@ +package org.jeecg.controller; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +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.GardsResearchReactors; +import org.jeecg.modules.base.entity.configuration.GardsStations; +import org.jeecg.service.GardsResearchReactorsService; +import org.jeecg.service.GardsStationsService; +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.factory.annotation.Autowired; +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; +@Slf4j +@RestController +@RequestMapping("/gardsStations") +public class GardsStationsController { + @Autowired + private GardsStationsService gardsStationsService; + + /** + * 新增信息 + */ + @PostMapping("/create") + @Operation(summary = "新增台站信息") + public Result create(@RequestBody GardsStations gardsStations) { + try { + boolean success = gardsStationsService.save(gardsStations); + if (success) { + return Result.OK("添加成功", gardsStations); + } else { + return Result.error("添加失败"); + } + } catch (Exception e) { + log.error("create: " + e.getMessage()); + return Result.error("添加失败"); + } + } + + /** + * 删除信息 + */ + @DeleteMapping("/delete") + @Operation(summary = "删除台站信息") + public Result deleteById(@RequestParam Integer stationId) { + try { + boolean success = gardsStationsService.removeById(stationId); + if (success) { + return Result.OK("删除成功"); + } else { + return Result.error("删除失败,可能数据不存在"); + + } + } catch (Exception e) { + log.error("deleteById: " + e.getMessage()); + return Result.error("操作失败"); + } + } + + /** + * 更新信息 + */ + @PutMapping("/update") + @Operation(summary = "更新台站信息") + public Result update(@RequestBody GardsStations gardsStations) { + try { + boolean success = gardsStationsService.updateById(gardsStations); + if (success) { + return Result.OK("数据更新成功", gardsStations); + } else { + return Result.error("数据更新失败"); + + } + } catch (Exception e) { + log.error("update: " + e.getMessage()); + return Result.error("操作失败"); + } + } + + /** + * 查询信息 + */ + @GetMapping("/queryById") + @Operation(summary = "查询台站信息") + public Result getById(@RequestParam Integer stationId) { + try { + GardsStations nuclearReactors = gardsStationsService.getById(stationId); + if (nuclearReactors != null) { + return Result.OK(nuclearReactors); + } else { + return Result.error("未找到数据"); + } + } catch (Exception e) { + log.error("getById: " + e.getMessage()); + return Result.error("查询失败" ); + } + } + + /** + * 分页查询 + * + * @param pageNum + * @param pageSize + * @param stationCode + * @param countryCode + * @return + */ + @GetMapping("/page") + @Operation(summary = "台站分页查询") + public Result> page( + @RequestParam(defaultValue = "1") Integer pageNum, + @RequestParam(defaultValue = "10") Integer pageSize, + @RequestParam(required = false) String stationCode, + @RequestParam(required = false) String countryCode) { + + try { + Page page = new Page<>(pageNum, pageSize); + + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + + if (stationCode != null && !stationCode.trim().isEmpty()) { + wrapper.eq(GardsStations::getStationCode, stationCode); + } + if (countryCode != null && !countryCode.trim().isEmpty()) { + wrapper.eq(GardsStations::getCountryCode, countryCode); + } + IPage pageResult = gardsStationsService.page(page, wrapper); + + return Result.OK(pageResult); + } catch (Exception e) { + log.error("page: " + e.getMessage()); + return Result.error("查询失败"); + } + } + + /** + * 组合条件查询 + * + * @param stationCode 地点名称 + * @param type 类型 + * @return + */ + @GetMapping("/search") + @Operation(summary = "台站组合条件查询") + public Result> search(@RequestParam(required = false) String stationCode, + @RequestParam(required = false) String type, + @RequestParam(required = false) String status, + @RequestParam(required = false) String countryCode) { + + try { + List list = gardsStationsService.getByConditions(stationCode, type, status, countryCode); + return Result.OK(list); + } catch (Exception e) { + log.error("search: " + e.getMessage()); + return Result.error("查询失败"); + } + + } + + @AutoLog(value = "导出模版") + @Operation(summary = "台站导出模版") + @GetMapping("/exportTemplate") + public void exportTemplate(HttpServletResponse response) throws IOException { + ExportParams params = new ExportParams(); + params.setTitle("台站信息"); + params.setFixedTitle(true); + params.setTitleHeight((short) 8); + params.setType(ExcelType.XSSF); + ExcelExportUtil.exportExcel(params, GardsStations.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 type, + @RequestParam(required = false) String status, + @RequestParam(required = false) String countryCode) throws IOException { + ExportParams params = new ExportParams(); + params.setTitle("台站信息"); + params.setFixedTitle(true); + params.setTitleHeight((short) 8); + params.setType(ExcelType.XSSF); + List list = gardsStationsService.getByConditions(stationCode, type, status, countryCode); + ExcelExportUtil.exportExcel(params, GardsStations.class, list).write(response.getOutputStream()); + } + + /** + * 通过excel导入数据 + * + * @param request + * @return + */ + @AutoLog(value = "GardsStations") + @Operation(summary = "导入台站数据") + @PostMapping(value = "/importExcel") + public Result importExcel(HttpServletRequest request) { + // 1. 获取上传文件 + MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; + Map fileMap = multipartRequest.getFileMap(); + + // 2. 遍历文件进行处理 + for (Map.Entry 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 list = ExcelImportUtil.importExcel(file.getInputStream(), GardsStations.class, params); + + // 4. 批量保存数据到数据库 + gardsStationsService.saveBatch(list); + + 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("文件导入失败!"); + } + + +} diff --git a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsAcceleratorService.java b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsAcceleratorService.java new file mode 100644 index 0000000..ae334b9 --- /dev/null +++ b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsAcceleratorService.java @@ -0,0 +1,35 @@ +package org.jeecg.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.base.entity.configuration.GardsAccelerator; + +import java.util.List; + +public interface GardsAcceleratorService extends IService { + + /** + * 根据设施代码查询设施信息 + */ + GardsAccelerator getByFacilityCode(String facilityCode); + + /** + * 根据国家查询设施列表 + */ + List getByCountry(String country); + + /** + * 根据运行状态查询设施列表 + */ + List getByOperationalStatus(Integer isOperational); + + /** + * 根据分类查询设施列表 + */ + List getByCategory(String category); + + /** + * 条件查询:国家 + 运行状态 + */ + List getByCountryAndStatus(String country, Integer isOperational); + +} \ No newline at end of file diff --git a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsCorrectionFactorService.java b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsCorrectionFactorService.java new file mode 100644 index 0000000..4fd9f80 --- /dev/null +++ b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsCorrectionFactorService.java @@ -0,0 +1,47 @@ +package org.jeecg.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.base.entity.configuration.GardsCorrectionFactor; + +import java.util.List; + +public interface GardsCorrectionFactorService extends IService { + + + /** + * 根据站点代码查询校正因子列表 + */ + List getByStationCode(String stationCode); + + /** + * 根据探测器代码查询校正因子列表 + */ + List getByDetectorCode(String detectorCode); + + /** + * 根据站点和探测器代码查询校正因子 + */ + List getByStationAndDetector(String stationCode, String detectorCode); + + /** + * 根据制造商查询校正因子列表 + */ + List getByManufacturer(String manufacturer); + + /** + * 根据型号查询校正因子列表 + */ + List getByModel(String model); + + /** + * 条件组合查询 + */ + List getByConditions(String stationCode, String detectorCode, + String manufacturer, String model); + + /** + * 批量更新校正因子 + */ + boolean updateBatchCorrectionFactors(List factors); + +} diff --git a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsNuclearFuelFacilityService.java b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsNuclearFuelFacilityService.java new file mode 100644 index 0000000..8f16b00 --- /dev/null +++ b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsNuclearFuelFacilityService.java @@ -0,0 +1,30 @@ +package org.jeecg.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.base.entity.configuration.GardsNuclearFuelFacilities; + +import java.util.List; + +/** + * 核燃料设施信息 + */ +public interface GardsNuclearFuelFacilityService extends IService { + + /** + * 根据设施名称模糊查询 + */ + List getByFacilityNameLike(String facilityName); + + /** + * 多条件组合查询 + */ + List getByConditions(String facilityType, String facilityStatus, String country,String facilityName, String fuelType); + + /** + * 批量更新设施状态 + */ + boolean updateBatchFacilityStatus(List ids, String status); + + + +} diff --git a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsNuclearReactorsService.java b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsNuclearReactorsService.java new file mode 100644 index 0000000..bd7f2ae --- /dev/null +++ b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsNuclearReactorsService.java @@ -0,0 +1,21 @@ +package org.jeecg.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.base.entity.configuration.GardsNuclearReactors; +import org.jeecg.modules.base.mapper.GardsNuclearReactorsMapper; + +import java.util.List; + +public interface GardsNuclearReactorsService extends IService { + + /** + * 多条件组合查询 + * @return List + */ + List getByConditions(String unitName,String country,String reactorType,String reactorStatus); + + void saveOrUpdateBatchByUniqueFields(List list); + + + +} diff --git a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsNuclearReleaseService.java b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsNuclearReleaseService.java new file mode 100644 index 0000000..56959c0 --- /dev/null +++ b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsNuclearReleaseService.java @@ -0,0 +1,21 @@ +package org.jeecg.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.base.entity.configuration.GardsNuclearReactors; +import org.jeecg.modules.base.entity.configuration.GardsNuclearReleaseRecords; + +import java.util.List; + +public interface GardsNuclearReleaseService extends IService { + /** + * 多条件组合查询 + * @param siteName 站点/电厂名称 + * @param nuclide 具体核素 + * @param nuclideType 核素类别 + * @param releaseType 排放类型 + * @return List + */ + List getByConditions(String siteName, String nuclide, String nuclideType, String releaseType); + + +} diff --git a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsNuclearTestingPlantService.java b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsNuclearTestingPlantService.java new file mode 100644 index 0000000..8e92373 --- /dev/null +++ b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsNuclearTestingPlantService.java @@ -0,0 +1,20 @@ +package org.jeecg.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.base.entity.configuration.GardsNuclearReleaseRecords; +import org.jeecg.modules.base.entity.configuration.GardsNuclearTestingPlant; + +import java.util.List; + +public interface GardsNuclearTestingPlantService extends IService { + + + /** + * 多条件组合查询 + * @param name 名称 + * @param type 类型 + * @return List + */ + List getByConditions(String name, String type); + +} diff --git a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsResearchReactorsService.java b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsResearchReactorsService.java new file mode 100644 index 0000000..bbe8ef0 --- /dev/null +++ b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsResearchReactorsService.java @@ -0,0 +1,19 @@ +package org.jeecg.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.base.entity.configuration.GardsNuclearTestingPlant; +import org.jeecg.modules.base.entity.configuration.GardsResearchReactors; + +import java.util.List; + +public interface GardsResearchReactorsService extends IService { + + + /** + * 多条件组合查询 + * @param facilityName 名称 + * @param country 类型 + * @return List + */ + List getByConditions(String facilityName, String country,String reactorType,String status); +} diff --git a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsStationsService.java b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsStationsService.java new file mode 100644 index 0000000..a19cb65 --- /dev/null +++ b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsStationsService.java @@ -0,0 +1,17 @@ +package org.jeecg.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.base.entity.configuration.GardsResearchReactors; +import org.jeecg.modules.base.entity.configuration.GardsStations; + +import java.util.List; + +public interface GardsStationsService extends IService { + /** + * 多条件组合查询 + * @param stationCode 名称 + * @param type 类型 + * @return List + */ + List getByConditions(String stationCode, String type, String status,String countryCode); +} diff --git a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsAcceleratorServiceImpl.java b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsAcceleratorServiceImpl.java new file mode 100644 index 0000000..c396a6d --- /dev/null +++ b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsAcceleratorServiceImpl.java @@ -0,0 +1,52 @@ +package org.jeecg.service.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.modules.base.entity.configuration.GardsAccelerator; +import org.jeecg.modules.base.mapper.GardsAcceleratorMapper; +import org.jeecg.service.GardsAcceleratorService; +import org.springframework.stereotype.Service; + +import java.util.List; +@Service +@DS("ora") +public class GardsAcceleratorServiceImpl extends ServiceImpl implements GardsAcceleratorService { + + + @Override + public GardsAccelerator getByFacilityCode(String facilityCode) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(GardsAccelerator::getFacilityCode, facilityCode); + return this.getOne(wrapper); + } + + @Override + public List getByCountry(String country) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(GardsAccelerator::getCountry, country); + return this.list(wrapper); + } + + @Override + public List getByOperationalStatus(Integer isOperational) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(GardsAccelerator::getIsOperational, isOperational); + return this.list(wrapper); + } + + @Override + public List getByCategory(String category) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(GardsAccelerator::getCategory, category); + return this.list(wrapper); + } + + @Override + public List getByCountryAndStatus(String country, Integer isOperational) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(GardsAccelerator::getCountry, country) + .eq(GardsAccelerator::getIsOperational, isOperational); + return this.list(wrapper); + } +} diff --git a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsCorrectionFactorServiceImpl.java b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsCorrectionFactorServiceImpl.java new file mode 100644 index 0000000..d0f8e0e --- /dev/null +++ b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsCorrectionFactorServiceImpl.java @@ -0,0 +1,79 @@ +package org.jeecg.service.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.modules.base.entity.configuration.GardsCorrectionFactor; +import org.jeecg.modules.base.mapper.GardsCorrectionFactorMapper; +import org.jeecg.service.GardsCorrectionFactorService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +@DS("ora") +public class GardsCorrectionFactorServiceImpl extends ServiceImpl implements GardsCorrectionFactorService { + + @Override + public List getByStationCode(String stationCode) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(GardsCorrectionFactor::getStationCode, stationCode); + return this.list(wrapper); + } + + @Override + public List getByDetectorCode(String detectorCode) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(GardsCorrectionFactor::getDetectorCode, detectorCode); + return this.list(wrapper); + } + + @Override + public List getByStationAndDetector(String stationCode, String detectorCode) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(GardsCorrectionFactor::getStationCode, stationCode) + .eq(GardsCorrectionFactor::getDetectorCode, detectorCode); + return this.list(wrapper); + } + + @Override + public List getByManufacturer(String manufacturer) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(GardsCorrectionFactor::getManufacturer, manufacturer); + return this.list(wrapper); + } + + @Override + public List getByModel(String model) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(GardsCorrectionFactor::getModel, model); + return this.list(wrapper); + } + + @Override + public List getByConditions(String stationCode, String detectorCode, + String manufacturer, String model) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + + if (stationCode != null && !stationCode.trim().isEmpty()) { + wrapper.eq(GardsCorrectionFactor::getStationCode, stationCode); + } + if (detectorCode != null && !detectorCode.trim().isEmpty()) { + wrapper.eq(GardsCorrectionFactor::getDetectorCode, detectorCode); + } + if (manufacturer != null && !manufacturer.trim().isEmpty()) { + wrapper.eq(GardsCorrectionFactor::getManufacturer, manufacturer); + } + if (model != null && !model.trim().isEmpty()) { + wrapper.eq(GardsCorrectionFactor::getModel, model); + } + + return this.list(wrapper); + } + + @Override + public boolean updateBatchCorrectionFactors(List factors) { + return this.updateBatchById(factors); + } +} diff --git a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsNuclearFuelFacilityServiceImpl.java b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsNuclearFuelFacilityServiceImpl.java new file mode 100644 index 0000000..485b7ca --- /dev/null +++ b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsNuclearFuelFacilityServiceImpl.java @@ -0,0 +1,56 @@ +package org.jeecg.service.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.modules.base.entity.configuration.GardsNuclearFuelFacilities; +import org.jeecg.modules.base.mapper.GardsNuclearFuelFacilitiesMapper; +import org.jeecg.service.GardsNuclearFuelFacilityService; +import org.springframework.stereotype.Service; + +import java.util.List; +@Service +@DS("ora") +public class GardsNuclearFuelFacilityServiceImpl extends ServiceImpl implements GardsNuclearFuelFacilityService { + + + @Override + public List getByFacilityNameLike(String facilityName) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.like(GardsNuclearFuelFacilities::getFacilityName, facilityName); + return this.list(wrapper); + } + + @Override + public List getByConditions(String facilityType, String facilityStatus, String country,String facilityName, String fuelType) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + + if (facilityType != null && !facilityType.trim().isEmpty()) { + wrapper.eq(GardsNuclearFuelFacilities::getFacilityType, facilityType); + } + if (facilityStatus != null && !facilityStatus.trim().isEmpty()) { + wrapper.eq(GardsNuclearFuelFacilities::getFacilityStatus, facilityStatus); + } + if (country != null && !country.trim().isEmpty()) { + wrapper.eq(GardsNuclearFuelFacilities::getCountry, country); + } + if (facilityName != null && !facilityName.trim().isEmpty()) { + wrapper.eq(GardsNuclearFuelFacilities::getFacilityName, facilityName); + } + if (fuelType != null && !fuelType.trim().isEmpty()) { + wrapper.eq(GardsNuclearFuelFacilities::getFuelType, fuelType); + } + + return this.list(wrapper); + } + + @Override + public boolean updateBatchFacilityStatus(List ids, String status) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.in(GardsNuclearFuelFacilities::getId, ids); + + GardsNuclearFuelFacilities updateEntity = new GardsNuclearFuelFacilities(); + + return this.update(updateEntity, wrapper); + } +} diff --git a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsNuclearReactorsServiceImpl.java b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsNuclearReactorsServiceImpl.java new file mode 100644 index 0000000..4b6247f --- /dev/null +++ b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsNuclearReactorsServiceImpl.java @@ -0,0 +1,39 @@ +package org.jeecg.service.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.modules.base.entity.configuration.GardsNuclearReactors; +import org.jeecg.modules.base.mapper.GardsNuclearReactorsMapper; +import org.jeecg.service.GardsNuclearReactorsService; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; +@Service +@DS("ora") +public class GardsNuclearReactorsServiceImpl extends ServiceImpl implements GardsNuclearReactorsService { + @Override + public List getByConditions(String unitName, String country, String reactorType, String reactorStatus) { + + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + if (unitName != null && !unitName.trim().isEmpty()) { + wrapper.eq(GardsNuclearReactors::getUnitName, unitName); + } + if (country != null && !country.trim().isEmpty()) { + wrapper.eq(GardsNuclearReactors::getCountry, country); + } + if (reactorType != null && !reactorType.trim().isEmpty()) { + wrapper.eq(GardsNuclearReactors::getReactorType, reactorType); + } + if (reactorStatus != null && !reactorStatus.trim().isEmpty()) { + wrapper.eq(GardsNuclearReactors::getReactorStatus, reactorStatus); + } + return this.list(wrapper); + } + @Transactional(rollbackFor = Exception.class) + @Override + public void saveOrUpdateBatchByUniqueFields(List list) { +this.saveOrUpdateBatch(list); + } +} diff --git a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsNuclearReleaseServiceImpl.java b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsNuclearReleaseServiceImpl.java new file mode 100644 index 0000000..9c0855b --- /dev/null +++ b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsNuclearReleaseServiceImpl.java @@ -0,0 +1,34 @@ +package org.jeecg.service.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.modules.base.entity.configuration.GardsNuclearReactors; +import org.jeecg.modules.base.entity.configuration.GardsNuclearReleaseRecords; +import org.jeecg.modules.base.mapper.GardsNuclearReleaseRecordsMapper; +import org.jeecg.service.GardsNuclearReleaseService; +import org.springframework.stereotype.Service; + +import java.util.List; +@Service +@DS("ora") +public class GardsNuclearReleaseServiceImpl extends ServiceImpl implements GardsNuclearReleaseService { + @Override + public List getByConditions(String siteName, String nuclide, String nuclideType, String releaseType) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + + if (siteName != null && !siteName.trim().isEmpty()) { + queryWrapper.eq(GardsNuclearReleaseRecords::getSiteName, siteName); + } + if (nuclide != null && !nuclide.trim().isEmpty()) { + queryWrapper.eq(GardsNuclearReleaseRecords::getNuclide, nuclide); + } + if (nuclideType != null && !nuclideType.trim().isEmpty()) { + queryWrapper.eq(GardsNuclearReleaseRecords::getNuclideType, nuclideType); + } + if (releaseType != null && !releaseType.trim().isEmpty()) { + queryWrapper.eq(GardsNuclearReleaseRecords::getReleaseType, releaseType); + } + return this.list(queryWrapper); + } +} diff --git a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsNuclearTestingPlantServiceImpl.java b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsNuclearTestingPlantServiceImpl.java new file mode 100644 index 0000000..5243572 --- /dev/null +++ b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsNuclearTestingPlantServiceImpl.java @@ -0,0 +1,29 @@ +package org.jeecg.service.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.modules.base.entity.configuration.GardsNuclearTestingPlant; +import org.jeecg.modules.base.mapper.GardsNuclearTestingPlantMapper; +import org.jeecg.service.GardsNuclearTestingPlantService; +import org.springframework.stereotype.Service; + +import java.util.List; +@Service +@DS("ora") +public class GardsNuclearTestingPlantServiceImpl extends ServiceImpl implements GardsNuclearTestingPlantService { + + @Override + public List getByConditions(String name, String type) { + + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + + if (name != null&&!name.trim().isEmpty()) { + query.eq(GardsNuclearTestingPlant::getName, name); + } + if (type != null&&!type.trim().isEmpty()) { + query.eq(GardsNuclearTestingPlant::getType, type); + } + return this.list(query); + } +} diff --git a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsResearchReactorsServiceImpl.java b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsResearchReactorsServiceImpl.java new file mode 100644 index 0000000..368eb79 --- /dev/null +++ b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsResearchReactorsServiceImpl.java @@ -0,0 +1,34 @@ +package org.jeecg.service.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.modules.base.entity.configuration.GardsNuclearTestingPlant; +import org.jeecg.modules.base.entity.configuration.GardsResearchReactors; +import org.jeecg.modules.base.mapper.GardsResearchReactorsMapper; +import org.jeecg.service.GardsResearchReactorsService; +import org.springframework.stereotype.Service; + +import java.util.List; +@Service +@DS("ora") +public class GardsResearchReactorsServiceImpl extends ServiceImpl implements GardsResearchReactorsService { + @Override + public List getByConditions(String facilityName, String country,String reactorType,String status) { + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + + if (facilityName != null&&!facilityName.trim().isEmpty()) { + query.eq(GardsResearchReactors::getFacilityName, facilityName); + } + if (country != null&&!country.trim().isEmpty()) { + query.eq(GardsResearchReactors::getCountry, country); + } + if (reactorType != null&&!reactorType.trim().isEmpty()) { + query.eq(GardsResearchReactors::getReactorType, reactorType); + } + if (status != null&&!status.trim().isEmpty()) { + query.eq(GardsResearchReactors::getStatus, status); + } + return this.list(query); + } +} diff --git a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsStationsServiceImpl.java b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsStationsServiceImpl.java new file mode 100644 index 0000000..1b0cfd0 --- /dev/null +++ b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsStationsServiceImpl.java @@ -0,0 +1,37 @@ +package org.jeecg.service.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.modules.base.entity.configuration.GardsResearchReactors; +import org.jeecg.modules.base.entity.configuration.GardsStations; +import org.jeecg.modules.base.mapper.GardsStationsMapper; +import org.jeecg.service.GardsStationsService; +import org.springframework.stereotype.Service; + +import java.util.List; +@Service +@DS("ora") +public class GardsStationsServiceImpl extends ServiceImpl implements GardsStationsService { + + + @Override + public List getByConditions(String stationCode, String type, String status,String countryCode) { + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + + if (stationCode != null&&!stationCode.trim().isEmpty()) { + query.eq(GardsStations::getStationCode, stationCode); + } + if (type != null&&!type.trim().isEmpty()) { + query.eq(GardsStations::getType, type); + } + if (status != null&&!status.trim().isEmpty()) { + query.eq(GardsStations::getStatus, status); + } + if (countryCode != null&&!countryCode.trim().isEmpty()) { + query.eq(GardsStations::getCountryCode, countryCode); + } + + return this.list(query); + } +} diff --git a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/util/BizUpsertUtil.java b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/util/BizUpsertUtil.java new file mode 100644 index 0000000..a2c44d9 --- /dev/null +++ b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/util/BizUpsertUtil.java @@ -0,0 +1,170 @@ +package org.jeecg.util; + + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.StringUtils; +import com.baomidou.mybatisplus.core.toolkit.support.SFunction; +import com.baomidou.mybatisplus.extension.service.IService; + +import java.lang.reflect.Field; +import java.util.*; +import java.util.function.Function; +import java.util.stream.Collectors; + +public class BizUpsertUtil { + + @SafeVarargs + public static boolean upsert(IService service, List list, + SFunction... uniqueColumns) { + return upsert(service, list, Arrays.asList(uniqueColumns)); + } + + // + public static boolean upsertByColumnNames(IService service, List list, + String... uniqueColumnNames) { + if (list.isEmpty()) return true; + + String firstCol = uniqueColumnNames[0]; + + // 提取第一个字段的值用于 IN 查询(反射取值) + List firstValues = list.stream() + .map(entity -> getFieldValue(entity, firstCol)) + .filter(Objects::nonNull) + .distinct() + .toList(); + + // 用 QueryWrapper,完全不涉及 SFunction + List existList = service.list(new QueryWrapper() + .in(firstCol, firstValues) + .select(uniqueColumnNames) // 可选:只查需要的字段 + ); + + Map existMap = existList.stream() + .collect(Collectors.toMap( + e -> buildKey(e, uniqueColumnNames), + e -> e + )); + + List insert = new ArrayList<>(); + List update = new ArrayList<>(); + + for (T entity : list) { + String key = buildKey(entity, uniqueColumnNames); + T db = existMap.get(key); + if (db == null) { + insert.add(entity); + } else { + copyId(db, entity); + update.add(entity); + } + } + + boolean ok1 = insert.isEmpty() || service.saveBatch(insert, 1000); + boolean ok2 = update.isEmpty() || service.updateBatchById(update, 1000); + + System.out.println("插入:" + insert.size() + " 更新:" + update.size()); + return ok1 && ok2; + } + + // 反射取字段值(支持驼峰转下划线) + private static Object getFieldValue(T entity, String fieldName) { + try { + Field field = entity.getClass().getDeclaredField(fieldName); + field.setAccessible(true); + return field.get(entity); + } catch (Exception e) { + // 如果字段名是 username,但数据库是 user_name,可以自动转换 + String dbColumn = StringUtils.camelToUnderline(fieldName); + try { + Field field = entity.getClass().getDeclaredField(dbColumn); + field.setAccessible(true); + return field.get(entity); + } catch (Exception ex) { + return null; + } + } + } + + // 构建 key + private static String buildKey(T entity, String[] columnNames) { + return Arrays.stream(columnNames) + .map(col -> Objects.toString(getFieldValue(entity, col), "NULL")) + .collect(Collectors.joining("::")); + } + public static boolean upsert(IService service, List list, + List> uniqueColumns) { + if (list == null || list.isEmpty()) return true; + + // 1. 提取所有业务唯一键(用于匹配) + Map keyToEntity = new HashMap<>(); + for (T entity : list) { + String key = buildKey(entity, uniqueColumns); + keyToEntity.put(key, entity); + } + + // 2. 用第一个字段去数据库查已存在的记录(关键修复!) + SFunction firstCol = uniqueColumns.get(0); + + List firstColumnValues = list.stream() + .map(firstCol) + .filter(Objects::nonNull) + .distinct() + .toList(); + + List existList = service.list( + (new LambdaQueryWrapper()).in( firstCol, firstColumnValues) + ); + + // 3. 构建已存在记录的 key 映射 + Map existMap = existList.stream() + .collect(Collectors.toMap( + e -> buildKey(e, uniqueColumns), + e -> e + )); + + List insertList = new ArrayList<>(); + List updateList = new ArrayList<>(); + + for (T entity : list) { + String key = buildKey(entity, uniqueColumns); + T dbEntity = existMap.get(key); + if (dbEntity == null) { + insertList.add(entity); + } else { + // 把数据库的主键 ID 复制回来(最简单方式) + copyId(dbEntity, entity); + updateList.add(entity); + } + } + + boolean ok1 = insertList.isEmpty() || service.saveBatch(insertList, 1000); + boolean ok2 = updateList.isEmpty() || service.updateBatchById(updateList, 1000); + + System.out.println("插入: " + insertList.size() + ", 更新: " + updateList.size()); + return ok1 && ok2; + } + + // 拼接 key:value1::value2 + private static String buildKey(T entity, List> columns) { + return columns.stream() + .map(col -> { + Object v = col.apply(entity); + return v == null ? "NULL" : v.toString(); + }) + .collect(Collectors.joining("::")); + } + + // 复制主键(假设主键字段叫 id,改成你的就行) + private static void copyId(T from, T to) { + try { + var fromId = from.getClass().getMethod("getId").invoke(from); + if (fromId != null) { + var setId = to.getClass().getMethod("setId", fromId.getClass()); + setId.invoke(to, fromId); + } + } catch (Exception ignored) { + // 如果没有 getId/setId 方法,就忽略(或者你改成自己的主键名) + } + } +} \ No newline at end of file diff --git a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/util/DbMetaObjectHandler.java b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/util/DbMetaObjectHandler.java new file mode 100644 index 0000000..83bc51e --- /dev/null +++ b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/util/DbMetaObjectHandler.java @@ -0,0 +1,23 @@ +package org.jeecg.util; + +import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler; +import org.apache.ibatis.reflection.MetaObject; +import org.springframework.stereotype.Component; + +import java.time.LocalDateTime; +import java.util.Date; +@Component +public class DbMetaObjectHandler implements MetaObjectHandler { + @Override + public void insertFill(MetaObject metaObject) { + + this.strictInsertFill(metaObject, "moddate", java.util.Date.class, new Date()); + //this.strictInsertFill(metaObject, "updatedAt", java.util.Date.class, new Date()); + } + + @Override + public void updateFill(MetaObject metaObject) { + LocalDateTime now = LocalDateTime.now(); + this.strictUpdateFill(metaObject, "moddate", java.util.Date.class, new Date()); + } +}