From c8519c9cf3575cd9b32e5afb8ec3e6b16b2953c1 Mon Sep 17 00:00:00 2001 From: qiaoqinzheng <qiaoqinzheng> Date: Thu, 25 May 2023 14:09:29 +0800 Subject: [PATCH 1/5] 1 --- jeecg-module-log-manage/a.xml | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 jeecg-module-log-manage/a.xml diff --git a/jeecg-module-log-manage/a.xml b/jeecg-module-log-manage/a.xml new file mode 100644 index 00000000..e69de29b From d93d24e00358614a6df06cf78fe3446d79896d32 Mon Sep 17 00:00:00 2001 From: qiaoqinzheng <qiaoqinzheng> Date: Thu, 25 May 2023 14:10:32 +0800 Subject: [PATCH 2/5] 1 --- jeecg-module-log-manage/a.xml | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 jeecg-module-log-manage/a.xml diff --git a/jeecg-module-log-manage/a.xml b/jeecg-module-log-manage/a.xml deleted file mode 100644 index e69de29b..00000000 From f45fee5d62b2a8a017e2dd4777a513e5f1251968 Mon Sep 17 00:00:00 2001 From: qiaoqinzheng <qiaoqinzheng> Date: Fri, 26 May 2023 14:54:12 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E5=8F=B0=E7=AB=99=E8=BF=90=E8=A1=8C?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E9=A1=B5=E9=9D=A2=E6=9F=A5=E8=AF=A2=E5=8F=B0?= =?UTF-8?q?=E7=AB=99=E5=8F=8A=E6=A0=B8=E8=AE=BE=E6=96=BD=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=20=E5=8F=B0=E7=AB=99=E8=BF=90=E8=A1=8C?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E6=9F=A5=E8=AF=A2=E5=85=B3=E6=B3=A8=E5=8F=B0?= =?UTF-8?q?=E7=AB=99=E4=BF=A1=E6=81=AF=E6=8E=A5=E5=8F=A3=20=E5=8F=B0?= =?UTF-8?q?=E7=AB=99=E8=BF=90=E8=A1=8C=E6=96=B0=E5=A2=9E=E5=85=B3=E6=B3=A8?= =?UTF-8?q?=E5=8F=B0=E7=AB=99=E4=BF=A1=E6=81=AF=20=E5=8F=B0=E7=AB=99?= =?UTF-8?q?=E8=BF=90=E8=A1=8C=E7=A7=BB=E9=99=A4=E5=85=B3=E6=B3=A8=E5=8F=B0?= =?UTF-8?q?=E7=AB=99=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/jeecg/config/valid/InsertGroup.java | 0 .../org/jeecg/config/valid/UpdateGroup.java | 0 jeecg-module-station-operation/pom.xml | 21 +++++ .../StationOperationController.java | 30 +++++++ .../SysUserFocusStationController.java | 35 ++++++++ .../modules/entity/GardsNuclearfacility.java | 81 ++++++++++++++++++ .../jeecg/modules/entity/GardsStations.java | 57 +++++++++++++ .../modules/entity/StationOperation.java | 26 ++++++ .../org/jeecg/modules/entity/SysUser.java | 33 ++++++++ .../modules/entity/SysUserFocusStation.java | 42 ++++++++++ .../mapper/GardsNuclearfacilityMapper.java | 7 ++ .../modules/mapper/GardsStationsMapper.java | 7 ++ .../mapper/StationOperationMapper.java | 7 ++ .../mapper/SysUserFocusStationMapper.java | 7 ++ .../jeecg/modules/mapper/SysUserMapper.java | 7 ++ .../service/IStationOperationService.java | 13 +++ .../service/ISysUserFocusStationService.java | 28 +++++++ .../impl/StationOperationServiceImpl.java | 83 +++++++++++++++++++ .../impl/SysUserFocusStationServiceImpl.java | 81 ++++++++++++++++++ .../modules/system/entity/GardsDetectors.java | 1 - .../jeecg-station-operation-start/pom.xml | 42 ++++++++++ .../JeecgStationOperationApplication.java | 47 +++++++++++ .../src/main/resources/application.yml | 18 ++++ .../resources/jeecg/jeecg_config.properties | 29 +++++++ .../resources/jeecg/jeecg_database.properties | 27 ++++++ .../src/main/resources/logback-spring.xml | 77 +++++++++++++++++ jeecg-server-cloud/pom.xml | 1 + pom.xml | 9 +- 28 files changed, 814 insertions(+), 2 deletions(-) rename {jeecg-module-system/jeecg-system-biz => jeecg-boot-base-core}/src/main/java/org/jeecg/config/valid/InsertGroup.java (100%) rename {jeecg-module-system/jeecg-system-biz => jeecg-boot-base-core}/src/main/java/org/jeecg/config/valid/UpdateGroup.java (100%) create mode 100644 jeecg-module-station-operation/pom.xml create mode 100644 jeecg-module-station-operation/src/main/java/org/jeecg/modules/controller/StationOperationController.java create mode 100644 jeecg-module-station-operation/src/main/java/org/jeecg/modules/controller/SysUserFocusStationController.java create mode 100644 jeecg-module-station-operation/src/main/java/org/jeecg/modules/entity/GardsNuclearfacility.java create mode 100644 jeecg-module-station-operation/src/main/java/org/jeecg/modules/entity/GardsStations.java create mode 100644 jeecg-module-station-operation/src/main/java/org/jeecg/modules/entity/StationOperation.java create mode 100644 jeecg-module-station-operation/src/main/java/org/jeecg/modules/entity/SysUser.java create mode 100644 jeecg-module-station-operation/src/main/java/org/jeecg/modules/entity/SysUserFocusStation.java create mode 100644 jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/GardsNuclearfacilityMapper.java create mode 100644 jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/GardsStationsMapper.java create mode 100644 jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/StationOperationMapper.java create mode 100644 jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/SysUserFocusStationMapper.java create mode 100644 jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/SysUserMapper.java create mode 100644 jeecg-module-station-operation/src/main/java/org/jeecg/modules/service/IStationOperationService.java create mode 100644 jeecg-module-station-operation/src/main/java/org/jeecg/modules/service/ISysUserFocusStationService.java create mode 100644 jeecg-module-station-operation/src/main/java/org/jeecg/modules/service/impl/StationOperationServiceImpl.java create mode 100644 jeecg-module-station-operation/src/main/java/org/jeecg/modules/service/impl/SysUserFocusStationServiceImpl.java create mode 100644 jeecg-server-cloud/jeecg-station-operation-start/pom.xml create mode 100644 jeecg-server-cloud/jeecg-station-operation-start/src/main/java/org/jeecg/JeecgStationOperationApplication.java create mode 100644 jeecg-server-cloud/jeecg-station-operation-start/src/main/resources/application.yml create mode 100644 jeecg-server-cloud/jeecg-station-operation-start/src/main/resources/jeecg/jeecg_config.properties create mode 100644 jeecg-server-cloud/jeecg-station-operation-start/src/main/resources/jeecg/jeecg_database.properties create mode 100644 jeecg-server-cloud/jeecg-station-operation-start/src/main/resources/logback-spring.xml diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/config/valid/InsertGroup.java b/jeecg-boot-base-core/src/main/java/org/jeecg/config/valid/InsertGroup.java similarity index 100% rename from jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/config/valid/InsertGroup.java rename to jeecg-boot-base-core/src/main/java/org/jeecg/config/valid/InsertGroup.java diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/config/valid/UpdateGroup.java b/jeecg-boot-base-core/src/main/java/org/jeecg/config/valid/UpdateGroup.java similarity index 100% rename from jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/config/valid/UpdateGroup.java rename to jeecg-boot-base-core/src/main/java/org/jeecg/config/valid/UpdateGroup.java diff --git a/jeecg-module-station-operation/pom.xml b/jeecg-module-station-operation/pom.xml new file mode 100644 index 00000000..c0637971 --- /dev/null +++ b/jeecg-module-station-operation/pom.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.jeecgframework.boot</groupId> + <artifactId>jeecg-boot-parent</artifactId> + <version>3.5.1</version> + </parent> + + <artifactId>jeecg-module-station-operation</artifactId> + + <dependencies> + <dependency> + <groupId>org.jeecgframework.boot</groupId> + <artifactId>jeecg-boot-base-core</artifactId> + </dependency> + </dependencies> + +</project> \ No newline at end of file diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/controller/StationOperationController.java b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/controller/StationOperationController.java new file mode 100644 index 00000000..9908f657 --- /dev/null +++ b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/controller/StationOperationController.java @@ -0,0 +1,30 @@ +package org.jeecg.modules.controller; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.jeecg.modules.entity.StationOperation; +import org.jeecg.modules.service.IStationOperationService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +@RestController +@RequestMapping("stationOperation") +@Api(value = "台站运行管理", tags = "台站运行管理") +public class StationOperationController { + + @Autowired + private IStationOperationService stationOperationService; + + @GetMapping("findList") + @ApiOperation(value = "查询所有台站,核设施信息", notes = "查询所有台站,核设施信息") + public List<StationOperation> findList(String status){ + List<StationOperation> result = stationOperationService.findList(status); + return result; + } + + +} diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/controller/SysUserFocusStationController.java b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/controller/SysUserFocusStationController.java new file mode 100644 index 00000000..c2c1af45 --- /dev/null +++ b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/controller/SysUserFocusStationController.java @@ -0,0 +1,35 @@ +package org.jeecg.modules.controller; + +import org.jeecg.config.valid.InsertGroup; +import org.jeecg.modules.entity.SysUserFocusStation; +import org.jeecg.modules.service.ISysUserFocusStationService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +@RestController +@RequestMapping("sysUserFocusStation") +public class SysUserFocusStationController { + + @Autowired + private ISysUserFocusStationService sysUserFocusStationService; + + @GetMapping("findList") + public List<SysUserFocusStation> findList(){ + List<SysUserFocusStation> result = sysUserFocusStationService.findList(); + return result; + } + + @PostMapping("create") + public void create(@RequestBody @Validated(value = InsertGroup.class) SysUserFocusStation sysUserFocusStation){ + sysUserFocusStationService.create(sysUserFocusStation); + } + + @DeleteMapping("deleteById") + public void deleteById(String stationId){ + sysUserFocusStationService.deleteById(stationId); + } + +} diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/entity/GardsNuclearfacility.java b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/entity/GardsNuclearfacility.java new file mode 100644 index 00000000..69fe25bc --- /dev/null +++ b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/entity/GardsNuclearfacility.java @@ -0,0 +1,81 @@ +package org.jeecg.modules.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.util.Date; + +@Data +@TableName("GARDS_NUCLEARFACILITY") +public class GardsNuclearfacility implements Serializable { + + @TableField(value = "FACILITY_ID") + private Integer facilityId; + + @TableField(value = "FACILITY_NAME") + private String facilityName; + + @TableField(value = "TYPE") + private String type; + + @TableField(value = "LOCATION") + private String location; + + @TableField(value = "LONGITUDE") + private String longitude; + + @TableField(value = "LATITUDE") + private String latitude; + + @TableField(value = "STATUS") + private String status; + + @TableField(value = "BUILDDATE") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date buildDate; + + @TableField(value = "CRITICALITYDATE") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date criticalityDate; + + @TableField(value = "RETIREDATE") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date retireDate; + + @TableField(value = "GRIDCONEETIONDATE") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date gridconeetionDate; + + @TableField(value = "VENDOR") + private String vendor; + + @TableField(value = "OWNER") + private String owner; + + @TableField(value = "OPERARTOR") + private String operartor; + + @TableField(value = "CAPACITYGROSS") + private Integer capacitygross; + + @TableField(value = "CAPACITYNET") + private Integer capacitynet; + + @TableField(value = "CAPACITYTHERMAL") + private Integer capacitythermal; + + @TableField(value = "ACTIVITY_DAY") + private Integer activityDay; + + @TableField(value = "ACTIVITY_YEAR") + private Integer activityYear; + +} diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/entity/GardsStations.java b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/entity/GardsStations.java new file mode 100644 index 00000000..f9ee9213 --- /dev/null +++ b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/entity/GardsStations.java @@ -0,0 +1,57 @@ +package org.jeecg.modules.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.util.Date; + +@Data +@TableName(value = "GARDS_STATIONS") +public class GardsStations implements Serializable { + + @TableField(value = "STATION_ID") + private Integer stationId; + + @TableField(value = "STATION_CODE") + private String stationCode; + + @TableField(value = "COUNTRY_CODE") + private String countryCode; + + @TableField(value = "TYPE") + private String type; + + @TableField(value = "LON") + private Double lon; + + @TableField(value = "LAT") + private Double lat; + + @TableField(value = "ELEVATION") + private Double elevation; + + @TableField(value = "DESCRIPTION") + private String description; + + @TableField(value = "DATE_BEGIN") + @DateTimeFormat(pattern = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd") + private Date dateBegin; + + @TableField(value = "DATE_END") + @DateTimeFormat(pattern = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd") + private Date dateEnd; + + @TableField(value = "STATUS") + private String status; + + @TableField(value = "MODDATE") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date moddate; + +} diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/entity/StationOperation.java b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/entity/StationOperation.java new file mode 100644 index 00000000..9e1a0764 --- /dev/null +++ b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/entity/StationOperation.java @@ -0,0 +1,26 @@ +package org.jeecg.modules.entity; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class StationOperation implements Serializable { + + private Integer stationId; + + private String stationName; + + private String stationType; + + private String altitude; + + private String lon; + + private String lat; + + private String status; + + private String signal; + +} diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/entity/SysUser.java b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/entity/SysUser.java new file mode 100644 index 00000000..ca223594 --- /dev/null +++ b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/entity/SysUser.java @@ -0,0 +1,33 @@ +package org.jeecg.modules.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import org.jeecgframework.poi.excel.annotation.Excel; + +import java.io.Serializable; + +@Data +@TableName("sys_user") +public class SysUser implements Serializable { + + /** + * id + */ + @TableId(type = IdType.ASSIGN_ID) + private String id; + + /** + * 登录账号 + */ + @Excel(name = "登录账号", width = 15) + private String username; + + /** + * 真实姓名 + */ + @Excel(name = "真实姓名", width = 15) + private String realname; + +} diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/entity/SysUserFocusStation.java b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/entity/SysUserFocusStation.java new file mode 100644 index 00000000..76a1fe07 --- /dev/null +++ b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/entity/SysUserFocusStation.java @@ -0,0 +1,42 @@ +package org.jeecg.modules.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import org.jeecg.config.valid.InsertGroup; +import org.jeecg.config.valid.UpdateGroup; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.Date; + +@Data +@TableName("sys_user_focus_station") +public class SysUserFocusStation implements Serializable { + + @TableId(value = "id", type = IdType.ASSIGN_ID) + @NotNull(message = "不能为空", groups = {InsertGroup.class, UpdateGroup.class}) + private Integer id; + + @TableField(value = "user_id") + @NotBlank(message = "不能为空", groups = {InsertGroup.class, UpdateGroup.class}) + private String userId; + + @TableField(value = "station_id") + @NotBlank(message = "不能为空", groups = {InsertGroup.class, UpdateGroup.class}) + private String stationId; + + @TableField(value = "type") + @NotBlank(message = "不能为空", groups = {InsertGroup.class, UpdateGroup.class}) + private String type; + + @TableField(value = "create_time") + private Date createTime; + + @TableField(value = "create_by") + private String createBy; + +} diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/GardsNuclearfacilityMapper.java b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/GardsNuclearfacilityMapper.java new file mode 100644 index 00000000..1760bd15 --- /dev/null +++ b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/GardsNuclearfacilityMapper.java @@ -0,0 +1,7 @@ +package org.jeecg.modules.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.entity.GardsNuclearfacility; + +public interface GardsNuclearfacilityMapper extends BaseMapper<GardsNuclearfacility> { +} diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/GardsStationsMapper.java b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/GardsStationsMapper.java new file mode 100644 index 00000000..c62547f0 --- /dev/null +++ b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/GardsStationsMapper.java @@ -0,0 +1,7 @@ +package org.jeecg.modules.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.entity.GardsStations; + +public interface GardsStationsMapper extends BaseMapper<GardsStations> { +} diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/StationOperationMapper.java b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/StationOperationMapper.java new file mode 100644 index 00000000..6dc31b25 --- /dev/null +++ b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/StationOperationMapper.java @@ -0,0 +1,7 @@ +package org.jeecg.modules.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.entity.StationOperation; + +public interface StationOperationMapper extends BaseMapper<StationOperation> { +} diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/SysUserFocusStationMapper.java b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/SysUserFocusStationMapper.java new file mode 100644 index 00000000..5996afbf --- /dev/null +++ b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/SysUserFocusStationMapper.java @@ -0,0 +1,7 @@ +package org.jeecg.modules.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.entity.SysUserFocusStation; + +public interface SysUserFocusStationMapper extends BaseMapper<SysUserFocusStation> { +} diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/SysUserMapper.java b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/SysUserMapper.java new file mode 100644 index 00000000..9c11087e --- /dev/null +++ b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/SysUserMapper.java @@ -0,0 +1,7 @@ +package org.jeecg.modules.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.entity.SysUser; + +public interface SysUserMapper extends BaseMapper<SysUser> { +} diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/service/IStationOperationService.java b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/service/IStationOperationService.java new file mode 100644 index 00000000..9f06b2c1 --- /dev/null +++ b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/service/IStationOperationService.java @@ -0,0 +1,13 @@ +package org.jeecg.modules.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.entity.StationOperation; + +import java.util.List; + +public interface IStationOperationService extends IService<StationOperation> { + + List<StationOperation> findList(String status); + + +} diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/service/ISysUserFocusStationService.java b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/service/ISysUserFocusStationService.java new file mode 100644 index 00000000..2dc91cc2 --- /dev/null +++ b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/service/ISysUserFocusStationService.java @@ -0,0 +1,28 @@ +package org.jeecg.modules.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.entity.SysUserFocusStation; + +import java.util.List; + +public interface ISysUserFocusStationService extends IService<SysUserFocusStation> { + + /** + * 查询当前用户的全部关注台站,核设施信息 + * @return + */ + List<SysUserFocusStation> findList(); + + /** + * 新增关注的台站,核设施信息 + * @param sysUserFocusStation + */ + void create(SysUserFocusStation sysUserFocusStation); + + /** + * 取消关注 + * @param stationId + */ + void deleteById(String stationId); + +} diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/service/impl/StationOperationServiceImpl.java b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/service/impl/StationOperationServiceImpl.java new file mode 100644 index 00000000..3559dd2c --- /dev/null +++ b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/service/impl/StationOperationServiceImpl.java @@ -0,0 +1,83 @@ +package org.jeecg.modules.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.apache.commons.lang3.StringUtils; +import org.jeecg.modules.entity.GardsNuclearfacility; +import org.jeecg.modules.entity.GardsStations; +import org.jeecg.modules.entity.StationOperation; +import org.jeecg.modules.mapper.GardsNuclearfacilityMapper; +import org.jeecg.modules.mapper.GardsStationsMapper; +import org.jeecg.modules.mapper.StationOperationMapper; +import org.jeecg.modules.service.IStationOperationService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.LinkedList; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +@Service("stationOperationService") +@DS("ora") +public class StationOperationServiceImpl extends ServiceImpl<StationOperationMapper, StationOperation> implements IStationOperationService { + @Autowired + private GardsStationsMapper gardsStationsMapper; + @Autowired + private GardsNuclearfacilityMapper gardsNuclearfacilityMapper; + + @Override + public List<StationOperation> findList(String status) { + //声明结果集合 + List<StationOperation> result = new LinkedList<>(); + //查询全部台站信息 + List<GardsStations> stations = this.findStations(); + for (GardsStations gardsStation:stations) { + StationOperation stationOperation = new StationOperation(); + stationOperation.setStationId(gardsStation.getStationId()); + stationOperation.setStationName(gardsStation.getStationCode()); + stationOperation.setStationType("IMS STATION"); + stationOperation.setAltitude(Objects.isNull(gardsStation.getElevation())?"":gardsStation.getElevation()+"米"); + stationOperation.setLon(String.valueOf(gardsStation.getLon())); + stationOperation.setLat(String.valueOf(gardsStation.getLat())); + stationOperation.setStatus(gardsStation.getStatus()); + result.add(stationOperation); + } + //查询全部核设施信息 + List<GardsNuclearfacility> nuclearfacilities = this.findNuclearfacilities(); + for (GardsNuclearfacility nuclearfacility:nuclearfacilities) { + StationOperation stationOperation = new StationOperation(); + stationOperation.setStationId(nuclearfacility.getFacilityId()); + stationOperation.setStationName(nuclearfacility.getFacilityName()); + stationOperation.setStationType("Nuclear Facility"); + stationOperation.setAltitude("--"); + stationOperation.setLon(nuclearfacility.getLongitude()); + stationOperation.setLat(nuclearfacility.getLatitude()); + stationOperation.setStatus(nuclearfacility.getStatus()); + result.add(stationOperation); + } + //如果状态不为空 + if (StringUtils.isNotBlank(status)){ + result = result.stream().filter(item-> item.getStatus().equals(status)).collect(Collectors.toList()); + } + return result; + } + + /** + * 查询全部台站信息 + * @return + */ + private List<GardsStations> findStations(){ + LambdaQueryWrapper<GardsStations> queryWrapper = new LambdaQueryWrapper<>(); + List<GardsStations> gardsStations = gardsStationsMapper.selectList(queryWrapper); + return gardsStations; + } + + private List<GardsNuclearfacility> findNuclearfacilities(){ + LambdaQueryWrapper<GardsNuclearfacility> queryWrapper = new LambdaQueryWrapper<>(); + List<GardsNuclearfacility> gardsNuclearfacilities = gardsNuclearfacilityMapper.selectList(queryWrapper); + return gardsNuclearfacilities; + } + +} diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/service/impl/SysUserFocusStationServiceImpl.java b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/service/impl/SysUserFocusStationServiceImpl.java new file mode 100644 index 00000000..5d328442 --- /dev/null +++ b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/service/impl/SysUserFocusStationServiceImpl.java @@ -0,0 +1,81 @@ +package org.jeecg.modules.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; +import com.baomidou.mybatisplus.core.toolkit.IdWorker; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.common.system.util.JwtUtil; +import org.jeecg.common.util.SpringContextUtils; +import org.jeecg.modules.entity.SysUser; +import org.jeecg.modules.entity.SysUserFocusStation; +import org.jeecg.modules.mapper.SysUserFocusStationMapper; +import org.jeecg.modules.mapper.SysUserMapper; +import org.jeecg.modules.service.ISysUserFocusStationService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.servlet.http.HttpServletRequest; +import java.util.Collections; +import java.util.Date; +import java.util.List; +import java.util.Objects; + +@Service("sysUserFocusStationService") +public class SysUserFocusStationServiceImpl extends ServiceImpl<SysUserFocusStationMapper, SysUserFocusStation> implements ISysUserFocusStationService { + + @Autowired + private SysUserMapper sysUserMapper; + + @Override + public List<SysUserFocusStation> findList() { + List<SysUserFocusStation> sysUserFocusStations = this.baseMapper.selectList(new LambdaQueryWrapper<>()); + if (CollectionUtils.isNotEmpty(sysUserFocusStations)){ + return sysUserFocusStations; + } + return Collections.emptyList(); + } + + @Override + @Transactional + public void create(SysUserFocusStation sysUserFocusStation) { + //获取request + HttpServletRequest request = SpringContextUtils.getHttpServletRequest(); + //获取当前操作人用户名 + String username = JwtUtil.getUserNameByToken(request); + //根据用户名称查询对应的用户信息 + LambdaQueryWrapper<SysUser> userQueryWrapper = new LambdaQueryWrapper<>(); + userQueryWrapper.eq(SysUser::getUsername, username); + SysUser sysUser = sysUserMapper.selectOne(userQueryWrapper); + if (Objects.isNull(sysUser)){ + throw new RuntimeException("当前用户不存在!"); + } + Long id = IdWorker.getId(); + sysUserFocusStation.setId(Integer.valueOf(id.toString())); + sysUserFocusStation.setUserId(sysUser.getId()); + sysUserFocusStation.setCreateTime(new Date()); + sysUserFocusStation.setCreateBy(username); + this.baseMapper.insert(sysUserFocusStation); + } + + @Override + @Transactional + public void deleteById(String stationId) { + //获取request + HttpServletRequest request = SpringContextUtils.getHttpServletRequest(); + //获取当前操作人用户名 + String username = JwtUtil.getUserNameByToken(request); + //根据用户名称查询对应的用户信息 + LambdaQueryWrapper<SysUser> userQueryWrapper = new LambdaQueryWrapper<>(); + userQueryWrapper.eq(SysUser::getUsername, username); + SysUser sysUser = sysUserMapper.selectOne(userQueryWrapper); + if (Objects.isNull(sysUser)){ + throw new RuntimeException("当前用户不存在!"); + } + LambdaQueryWrapper<SysUserFocusStation> queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(SysUserFocusStation::getUserId, sysUser.getId()); + queryWrapper.eq(SysUserFocusStation::getStationId, stationId); + this.baseMapper.delete(queryWrapper); + } + +} diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/entity/GardsDetectors.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/entity/GardsDetectors.java index a1432f54..21a9d819 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/entity/GardsDetectors.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/entity/GardsDetectors.java @@ -10,7 +10,6 @@ import org.springframework.format.annotation.DateTimeFormat; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; -import javax.validation.constraints.Null; import java.io.Serializable; import java.util.Date; diff --git a/jeecg-server-cloud/jeecg-station-operation-start/pom.xml b/jeecg-server-cloud/jeecg-station-operation-start/pom.xml new file mode 100644 index 00000000..eabb4b15 --- /dev/null +++ b/jeecg-server-cloud/jeecg-station-operation-start/pom.xml @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.jeecgframework.boot</groupId> + <artifactId>jeecg-server-cloud</artifactId> + <version>3.5.1</version> + </parent> + + <artifactId>jeecg-station-operation-start</artifactId> + + <dependencies> + <!-- 引入jeecg-boot-starter-cloud依赖 --> + <dependency> + <groupId>org.jeecgframework.boot</groupId> + <artifactId>jeecg-boot-starter-cloud</artifactId> + </dependency> + + <dependency> + <groupId>org.jeecgframework.boot</groupId> + <artifactId>jeecg-boot-base-core</artifactId> + </dependency> + + <dependency> + <groupId>org.jeecgframework.boot</groupId> + <artifactId>jeecg-module-station-operation</artifactId> + <version>3.5.1</version> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-maven-plugin</artifactId> + </plugin> + </plugins> + </build> + +</project> \ No newline at end of file diff --git a/jeecg-server-cloud/jeecg-station-operation-start/src/main/java/org/jeecg/JeecgStationOperationApplication.java b/jeecg-server-cloud/jeecg-station-operation-start/src/main/java/org/jeecg/JeecgStationOperationApplication.java new file mode 100644 index 00000000..a158b8da --- /dev/null +++ b/jeecg-server-cloud/jeecg-station-operation-start/src/main/java/org/jeecg/JeecgStationOperationApplication.java @@ -0,0 +1,47 @@ +package org.jeecg; + +import lombok.extern.slf4j.Slf4j; +import org.jeecg.common.util.oConvertUtils; +import org.springframework.boot.CommandLineRunner; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; +import org.springframework.cloud.openfeign.EnableFeignClients; +import org.springframework.context.ConfigurableApplicationContext; +import org.springframework.core.env.Environment; +import org.springframework.scheduling.annotation.EnableScheduling; + +import java.net.InetAddress; +import java.net.UnknownHostException; + +@Slf4j +@SpringBootApplication +@EnableFeignClients(basePackages = {"org.jeecg"}) +@EnableScheduling +public class JeecgStationOperationApplication extends SpringBootServletInitializer implements CommandLineRunner { + + @Override + protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { + return application.sources(JeecgStationOperationApplication.class); + } + + public static void main(String[] args) throws UnknownHostException { + ConfigurableApplicationContext application = SpringApplication.run(JeecgStationOperationApplication.class, args); + Environment env = application.getEnvironment(); + String ip = InetAddress.getLocalHost().getHostAddress(); + String port = env.getProperty("server.port"); + String path = oConvertUtils.getString(env.getProperty("server.servlet.context-path")); + log.info("\n----------------------------------------------------------\n\t" + + "Application Jeecg-Boot is running! Access URLs:\n\t" + + "Local: \t\thttp://localhost:" + port + path + "/doc.html\n" + + "External: \thttp://" + ip + ":" + port + path + "/doc.html\n" + + "Swagger文档: \thttp://" + ip + ":" + port + path + "/doc.html\n" + + "----------------------------------------------------------"); + } + + @Override + public void run(String... args) throws Exception { + + } +} \ No newline at end of file diff --git a/jeecg-server-cloud/jeecg-station-operation-start/src/main/resources/application.yml b/jeecg-server-cloud/jeecg-station-operation-start/src/main/resources/application.yml new file mode 100644 index 00000000..8a462b69 --- /dev/null +++ b/jeecg-server-cloud/jeecg-station-operation-start/src/main/resources/application.yml @@ -0,0 +1,18 @@ +server: + port: 7002 + +spring: + application: + name: jeecg-station-operation + cloud: + nacos: + config: + server-addr: @config.server-addr@ + group: @config.group@ + namespace: @config.namespace@ + discovery: + server-addr: ${spring.cloud.nacos.config.server-addr} + config: + import: + - optional:nacos:jeecg.yaml + - optional:nacos:jeecg-station-operation-@profile.name@.yaml \ No newline at end of file diff --git a/jeecg-server-cloud/jeecg-station-operation-start/src/main/resources/jeecg/jeecg_config.properties b/jeecg-server-cloud/jeecg-station-operation-start/src/main/resources/jeecg/jeecg_config.properties new file mode 100644 index 00000000..44618ab8 --- /dev/null +++ b/jeecg-server-cloud/jeecg-station-operation-start/src/main/resources/jeecg/jeecg_config.properties @@ -0,0 +1,29 @@ +#code_generate_project_path +project_path=E:\\workspace\\jeecg-boot +#bussi_package[User defined] +bussi_package=org.jeecg.modules.demo + + +#default code path +#source_root_package=src +#webroot_package=WebRoot + +#maven code path +source_root_package=src.main.java +webroot_package=src.main.webapp + +#ftl resource url +templatepath=/jeecg/code-template +system_encoding=utf-8 + +#db Table id [User defined] +db_table_id=id + +#db convert flag[true/false] +db_filed_convert=true + +#page Search Field num [User defined] +page_search_filed_num=1 +#page_filter_fields +page_filter_fields=create_time,create_by,update_time,update_by +exclude_table=act_,ext_act_,design_,onl_,sys_,qrtz_ diff --git a/jeecg-server-cloud/jeecg-station-operation-start/src/main/resources/jeecg/jeecg_database.properties b/jeecg-server-cloud/jeecg-station-operation-start/src/main/resources/jeecg/jeecg_database.properties new file mode 100644 index 00000000..45b49f60 --- /dev/null +++ b/jeecg-server-cloud/jeecg-station-operation-start/src/main/resources/jeecg/jeecg_database.properties @@ -0,0 +1,27 @@ +#mysql +diver_name=com.mysql.jdbc.Driver +url=jdbc:mysql://localhost:3306/jeecg-boot?useUnicode=true&characterEncoding=UTF-8 +username=root +password=root +database_name=jeecg-boot + +#oracle +#diver_name=oracle.jdbc.driver.OracleDriver +#url=jdbc:oracle:thin:@192.168.1.200:1521:ORCL +#username=scott +#password=tiger +#database_name=ORCL + +#postgre +#diver_name=org.postgresql.Driver +#url=jdbc:postgresql://localhost:5432/jeecg +#username=postgres +#password=postgres +#database_name=jeecg + +#SQLServer2005\u4ee5\u4e0a +#diver_name=org.hibernate.dialect.SQLServerDialect +#url=jdbc:sqlserver://192.168.1.200:1433;DatabaseName=jeecg +#username=sa +#password=SA +#database_name=jeecg \ No newline at end of file diff --git a/jeecg-server-cloud/jeecg-station-operation-start/src/main/resources/logback-spring.xml b/jeecg-server-cloud/jeecg-station-operation-start/src/main/resources/logback-spring.xml new file mode 100644 index 00000000..60d4c7df --- /dev/null +++ b/jeecg-server-cloud/jeecg-station-operation-start/src/main/resources/logback-spring.xml @@ -0,0 +1,77 @@ +<?xml version="1.0" encoding="UTF-8"?> +<configuration debug="false"> + <!--定义日志文件的存储地址 --> + <property name="LOG_HOME" value="../logs" /> + + <!--<property name="COLOR_PATTERN" value="%black(%contextName-) %red(%d{yyyy-MM-dd HH:mm:ss}) %green([%thread]) %highlight(%-5level) %boldMagenta( %replace(%caller{1}){'\t|Caller.{1}0|\r\n', ''})- %gray(%msg%xEx%n)" />--> + <!-- 控制台输出 --> + <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> + <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> + <!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 + <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50}:%L - %msg%n</pattern>--> + <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %highlight(%-5level) %cyan(%logger{50}:%L) - %msg%n</pattern> + </encoder> + </appender> + + <!-- 按照每天生成日志文件 --> + <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> + <!--日志文件输出的文件名 --> + <FileNamePattern>${LOG_HOME}/jeecg-system-%d{yyyy-MM-dd}.%i.log</FileNamePattern> + <!--日志文件保留天数 --> + <MaxHistory>30</MaxHistory> + <maxFileSize>10MB</maxFileSize> + </rollingPolicy> + <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> + <!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 --> + <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50}:%L - %msg%n</pattern> + </encoder> + </appender> + + <!-- 生成 error html格式日志开始 --> + <appender name="HTML" class="ch.qos.logback.core.FileAppender"> + <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> + <!--设置日志级别,过滤掉info日志,只输入error日志--> + <level>ERROR</level> + </filter> + <encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder"> + <layout class="ch.qos.logback.classic.html.HTMLLayout"> + <pattern>%p%d%msg%M%F{32}%L</pattern> + </layout> + </encoder> + <file>${LOG_HOME}/error-log.html</file> + </appender> + <!-- 生成 error html格式日志结束 --> + + <!-- 每天生成一个html格式的日志开始 --> + <appender name="FILE_HTML" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> + <!--日志文件输出的文件名 --> + <FileNamePattern>${LOG_HOME}/jeecg-system-%d{yyyy-MM-dd}.%i.html</FileNamePattern> + <!--日志文件保留天数 --> + <MaxHistory>30</MaxHistory> + <MaxFileSize>10MB</MaxFileSize> + </rollingPolicy> + <encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder"> + <layout class="ch.qos.logback.classic.html.HTMLLayout"> + <pattern>%p%d%msg%M%F{32}%L</pattern> + </layout> + </encoder> + </appender> + <!-- 每天生成一个html格式的日志结束 --> + + <!--myibatis log configure --> + <logger name="com.apache.ibatis" level="TRACE" /> + <logger name="java.sql.Connection" level="DEBUG" /> + <logger name="java.sql.Statement" level="DEBUG" /> + <logger name="java.sql.PreparedStatement" level="DEBUG" /> + + <!-- 日志输出级别 --> + <root level="INFO"> + <appender-ref ref="STDOUT" /> + <appender-ref ref="FILE" /> + <appender-ref ref="HTML" /> + <appender-ref ref="FILE_HTML" /> + </root> + +</configuration> \ No newline at end of file diff --git a/jeecg-server-cloud/pom.xml b/jeecg-server-cloud/pom.xml index 5930e2c7..5c1c53e3 100644 --- a/jeecg-server-cloud/pom.xml +++ b/jeecg-server-cloud/pom.xml @@ -21,6 +21,7 @@ <!-- 监控和测试例子 --> <module>jeecg-visual</module> + <module>jeecg-station-operation-start</module> </modules> </project> \ No newline at end of file diff --git a/pom.xml b/pom.xml index 180f7b47..96dd5396 100644 --- a/pom.xml +++ b/pom.xml @@ -79,7 +79,8 @@ <module>jeecg-module-demo</module> <module>jeecg-module-system</module> <module>jeecg-module-log-manage</module> - </modules> + <module>jeecg-module-station-operation</module> + </modules> <repositories> <repository> @@ -172,6 +173,12 @@ <artifactId>jeecg-module-log-manage</artifactId> <version>${jeecgboot.version}</version> </dependency> + <!-- station-operation 模块--> + <dependency> + <groupId>org.jeecgframework.boot</groupId> + <artifactId>jeecg-module-station-operation</artifactId> + <version>${jeecgboot.version}</version> + </dependency> <!-- jeecg tools --> <dependency> <groupId>org.jeecgframework.boot</groupId> From 9d5196d431ed1fe6efdb4851a0b86b49a3c63a7e Mon Sep 17 00:00:00 2001 From: qiaoqinzheng <qiaoqinzheng> Date: Fri, 26 May 2023 15:58:58 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E6=8E=92=E7=8F=AD=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E7=9A=84=E5=AF=BC=E5=85=A5=E5=AF=BC=E5=87=BA=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=B3=A8=E8=A7=A3=20=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E6=97=B6=E5=A2=9E=E5=8A=A0=E5=88=A4=E6=96=AD?= =?UTF-8?q?=E6=8E=92=E7=8F=AD=E4=BB=BB=E5=8A=A1=E4=BF=A1=E6=81=AF=E5=86=85?= =?UTF-8?q?=E5=AE=B9=20=E6=96=B0=E5=A2=9E=E5=BC=BA=E5=88=B6=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E7=94=A8=E6=88=B7=E7=9A=84=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/controller/SysTaskController.java | 3 ++ .../system/controller/SysUserController.java | 20 +++++-- .../system/service/ISysUserService.java | 14 +++-- .../service/impl/SysUserServiceImpl.java | 53 +++++++++++++++++-- 4 files changed, 81 insertions(+), 9 deletions(-) diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/SysTaskController.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/SysTaskController.java index 9629a0af..f385df6c 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/SysTaskController.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/SysTaskController.java @@ -84,16 +84,19 @@ public class SysTaskController { } @PostMapping("exportExcel") + @ApiOperation(value = "导出排班任务", notes = "导出排班任务") public void exportExcel(@DateTimeFormat(pattern = "yyyy-MM") Date yearMonth, HttpServletRequest request, HttpServletResponse response){ sysTaskService.exportExcel(yearMonth, request, response); } @GetMapping("exportImportTemplate") + @ApiOperation(value = "导出排班任务导入模板", notes = "导出排班任务导入模板") public void exportImportTemplate(HttpServletRequest request, HttpServletResponse response){ sysTaskService.exportImportTemplate(request, response); } @PostMapping("importExcel") + @ApiOperation(value = "导入排班任务", notes = "导入排班任务") public ImportViewVo importExcel(MultipartFile file){ try { int headerRow = 1; diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/SysUserController.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/SysUserController.java index 5cfc0fbc..8d87a97a 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/SysUserController.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/SysUserController.java @@ -49,6 +49,7 @@ import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; +import java.text.ParseException; import java.util.*; import java.util.stream.Collectors; @@ -223,9 +224,22 @@ public class SysUserController { @RequestMapping(value = "/delete", method = RequestMethod.DELETE) public Result<?> delete(@RequestParam(name="id",required=true) String id) { baseCommonService.addLog("删除用户,id: " +id ,CommonConstant.LOG_TYPE_2, 3); - this.sysUserService.deleteUser(id); - return Result.ok("删除用户成功"); - } + try { + return this.sysUserService.deleteUser(id); + } catch (ParseException e) { + throw new RuntimeException(e); + } + } + + /** + * 删除用户 + */ + //@RequiresPermissions("system:user:delete") + @RequestMapping(value = "/deleteById", method = RequestMethod.DELETE) + public Result<?> deleteById(@RequestParam(name="id",required=true) String id) { + baseCommonService.addLog("删除用户,id: " +id ,CommonConstant.LOG_TYPE_2, 3); + return this.sysUserService.deleteById(id); + } /** * 批量删除用户 diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/ISysUserService.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/ISysUserService.java index 34a427f2..860aa539 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/ISysUserService.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/ISysUserService.java @@ -17,6 +17,7 @@ import org.jeecg.modules.system.vo.lowapp.UpdateDepartInfo; import org.springframework.transaction.annotation.Transactional; import javax.servlet.http.HttpServletRequest; +import java.text.ParseException; import java.util.Collection; import java.util.List; import java.util.Map; @@ -34,7 +35,7 @@ public interface ISysUserService extends IService<SysUser> { /** * 查询用户数据列表 - * + * * @param req * @param queryWrapper * @param pageSize @@ -42,7 +43,7 @@ public interface ISysUserService extends IService<SysUser> { * @return */ Result<IPage<SysUser>> queryPageList(HttpServletRequest req, LambdaQueryWrapper<SysUser> queryWrapper, Integer pageSize, Integer pageNo); - + /** * 重置密码 * @@ -67,7 +68,14 @@ public interface ISysUserService extends IService<SysUser> { * @param userId * @return */ - public boolean deleteUser(String userId); + public Result deleteUser(String userId) throws ParseException; + + /** + * 删除用户 + * @param userId + * @return + */ + public Result deleteById(String userId); /** * 批量删除用户 diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysUserServiceImpl.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysUserServiceImpl.java index 1f186baf..6933b6b2 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysUserServiceImpl.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysUserServiceImpl.java @@ -50,6 +50,7 @@ import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; +import java.text.ParseException; import java.util.*; import java.util.stream.Collectors; @@ -97,6 +98,10 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl private SysUserTenantMapper relationMapper; @Autowired private SysUserTenantMapper userTenantMapper; + @Autowired + private SysTaskMapper sysTaskMapper; + @Autowired + private SysTaskStationMapper sysTaskStationMapper; @Value("${system.auth.defaultPassword}") private String defaultPassword; @@ -220,10 +225,52 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl @Override @CacheEvict(value={CacheConstant.SYS_USERS_CACHE}, allEntries=true) @Transactional(rollbackFor = Exception.class) - public boolean deleteUser(String userId) { + public Result deleteUser(String userId) throws ParseException { + //判断当前用户是否有排班任务,如果有就不让删除 + LambdaQueryWrapper<SysTask> taskQueryWrapper = new LambdaQueryWrapper<>(); + taskQueryWrapper.eq(SysTask::getUserId, userId); + taskQueryWrapper.ge(SysTask::getSchedulingDate, DateUtils.parseDate(DateUtils.formatDate(new Date()) ,"yyyy-MM-dd")); + List<SysTask> sysTasks = sysTaskMapper.selectList(taskQueryWrapper); + if (CollectionUtils.isNotEmpty(sysTasks)){ + return Result.error("删除失败, 当前用户存在排班任务信息!"); + } + //删除用户关联的权限信息 + LambdaQueryWrapper<SysUserRole> userRoleQueryWrapper = new LambdaQueryWrapper<>(); + userRoleQueryWrapper.eq(SysUserRole::getUserId, userId); + sysUserRoleMapper.delete(userRoleQueryWrapper); //1.删除用户 - this.removeById(userId); - return false; + this.baseMapper.deleteById(userId); + List<String> userIds = new ArrayList<>(); + userIds.add(userId); + this.baseMapper.deleteLogicDeleted(userIds); + return Result.ok("删除用户成功"); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Result deleteById(String userId) { + //根据用户id删除排班任务信息 + LambdaQueryWrapper<SysTask> taskQueryWrapper = new LambdaQueryWrapper<>(); + taskQueryWrapper.eq(SysTask::getUserId, userId); + List<SysTask> sysTasks = sysTaskMapper.selectList(taskQueryWrapper); + //如果排班任务信息不为空,删除排班任务相关台站信息 + if (CollectionUtils.isNotEmpty(sysTasks)){ + List<String> taskIds = sysTasks.stream().map(SysTask::getId).collect(Collectors.toList()); + LambdaQueryWrapper<SysTaskStation> taskStationQueryWrapper = new LambdaQueryWrapper<>(); + taskStationQueryWrapper.in(SysTaskStation::getTaskId, taskIds); + sysTaskStationMapper.delete(taskStationQueryWrapper); + } + sysTaskMapper.delete(taskQueryWrapper); + //删除用户关联的权限信息 + LambdaQueryWrapper<SysUserRole> userRoleQueryWrapper = new LambdaQueryWrapper<>(); + userRoleQueryWrapper.eq(SysUserRole::getUserId, userId); + sysUserRoleMapper.delete(userRoleQueryWrapper); + //1.删除用户 + this.baseMapper.deleteById(userId); + List<String> userIds = new ArrayList<>(); + userIds.add(userId); + this.baseMapper.deleteLogicDeleted(userIds); + return Result.ok("删除用户成功"); } @Override From 1c232a645ea2d07925c553f483e7359452cf5329 Mon Sep 17 00:00:00 2001 From: qiaoqinzheng <qiaoqinzheng> Date: Mon, 29 May 2023 09:53:00 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E5=85=B3=E6=B3=A8=E5=8F=B0=E7=AB=99?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=A2=9E=E5=8A=A0=E6=8E=A5=E5=8F=A3=E6=B3=A8?= =?UTF-8?q?=E8=A7=A3=20=E6=96=B0=E5=A2=9E=E5=8F=B0=E7=AB=99=E5=85=B3?= =?UTF-8?q?=E6=B3=A8=E4=BF=A1=E6=81=AF=E6=8E=A5=E5=8F=A3=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=E5=86=85=E5=AE=B9=20=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E5=8F=B0=E7=AB=99=E5=85=B3=E6=B3=A8=E4=BF=A1=E6=81=AF=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E5=A2=9E=E5=8A=A0=E8=BF=94=E5=9B=9E=E5=86=85=E5=AE=B9?= =?UTF-8?q?=20=E5=AF=BC=E5=87=BA=E5=AF=BC=E5=85=A5=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=A2=9E=E5=8A=A0=E6=95=B0=E6=8D=AE=E7=A4=BA?= =?UTF-8?q?=E4=BE=8B=20=E5=AF=BC=E5=87=BA=E6=8E=A5=E5=8F=A3=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E5=8F=B0=E7=AB=99=E5=90=8D=E7=A7=B0=E5=88=97=E5=AE=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SysUserFocusStationController.java | 15 ++++++++++---- .../modules/entity/SysUserFocusStation.java | 6 +++--- .../service/ISysUserFocusStationService.java | 5 +++-- .../impl/SysUserFocusStationServiceImpl.java | 20 ++++++++++++++----- .../system/entity/vo/SysTaskExportVo.java | 2 +- .../impl/GardsDetectorsServiceImpl.java | 9 ++++++--- .../impl/GardsNuclearfacilityServiceImpl.java | 9 ++++++--- .../impl/GardsStationsServiceImpl.java | 9 ++++++--- .../service/impl/SysTaskServiceImpl.java | 18 +++++++++++++++-- 9 files changed, 67 insertions(+), 26 deletions(-) diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/controller/SysUserFocusStationController.java b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/controller/SysUserFocusStationController.java index c2c1af45..871c7653 100644 --- a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/controller/SysUserFocusStationController.java +++ b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/controller/SysUserFocusStationController.java @@ -1,5 +1,8 @@ package org.jeecg.modules.controller; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.jeecg.common.api.vo.Result; import org.jeecg.config.valid.InsertGroup; import org.jeecg.modules.entity.SysUserFocusStation; import org.jeecg.modules.service.ISysUserFocusStationService; @@ -11,25 +14,29 @@ import java.util.List; @RestController @RequestMapping("sysUserFocusStation") +@Api(value = "关注台站管理", tags = "关注台站管理") public class SysUserFocusStationController { @Autowired private ISysUserFocusStationService sysUserFocusStationService; @GetMapping("findList") + @ApiOperation(value = "查询关注台站列表", notes = "查询关注台站列表") public List<SysUserFocusStation> findList(){ List<SysUserFocusStation> result = sysUserFocusStationService.findList(); return result; } @PostMapping("create") - public void create(@RequestBody @Validated(value = InsertGroup.class) SysUserFocusStation sysUserFocusStation){ - sysUserFocusStationService.create(sysUserFocusStation); + @ApiOperation(value = "新增关注", notes = "新增关注") + public Result create(@RequestBody @Validated(value = InsertGroup.class) SysUserFocusStation sysUserFocusStation){ + return sysUserFocusStationService.create(sysUserFocusStation); } @DeleteMapping("deleteById") - public void deleteById(String stationId){ - sysUserFocusStationService.deleteById(stationId); + @ApiOperation(value = "取消关注", notes = "取消关注") + public Result deleteById(String stationId){ + return sysUserFocusStationService.deleteById(stationId); } } diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/entity/SysUserFocusStation.java b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/entity/SysUserFocusStation.java index 76a1fe07..0b20e647 100644 --- a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/entity/SysUserFocusStation.java +++ b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/entity/SysUserFocusStation.java @@ -10,6 +10,7 @@ import org.jeecg.config.valid.UpdateGroup; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; +import javax.validation.constraints.Null; import java.io.Serializable; import java.util.Date; @@ -18,11 +19,10 @@ import java.util.Date; public class SysUserFocusStation implements Serializable { @TableId(value = "id", type = IdType.ASSIGN_ID) - @NotNull(message = "不能为空", groups = {InsertGroup.class, UpdateGroup.class}) - private Integer id; + @NotBlank(message = "不能为空", groups = UpdateGroup.class) + private String id; @TableField(value = "user_id") - @NotBlank(message = "不能为空", groups = {InsertGroup.class, UpdateGroup.class}) private String userId; @TableField(value = "station_id") diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/service/ISysUserFocusStationService.java b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/service/ISysUserFocusStationService.java index 2dc91cc2..1d6a289c 100644 --- a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/service/ISysUserFocusStationService.java +++ b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/service/ISysUserFocusStationService.java @@ -1,6 +1,7 @@ package org.jeecg.modules.service; import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.common.api.vo.Result; import org.jeecg.modules.entity.SysUserFocusStation; import java.util.List; @@ -17,12 +18,12 @@ public interface ISysUserFocusStationService extends IService<SysUserFocusStatio * 新增关注的台站,核设施信息 * @param sysUserFocusStation */ - void create(SysUserFocusStation sysUserFocusStation); + Result create(SysUserFocusStation sysUserFocusStation); /** * 取消关注 * @param stationId */ - void deleteById(String stationId); + Result deleteById(String stationId); } diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/service/impl/SysUserFocusStationServiceImpl.java b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/service/impl/SysUserFocusStationServiceImpl.java index 5d328442..d59eef98 100644 --- a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/service/impl/SysUserFocusStationServiceImpl.java +++ b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/service/impl/SysUserFocusStationServiceImpl.java @@ -4,8 +4,10 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.core.toolkit.IdWorker; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.common.api.vo.Result; import org.jeecg.common.system.util.JwtUtil; import org.jeecg.common.util.SpringContextUtils; +import org.jeecg.modules.entity.GardsStations; import org.jeecg.modules.entity.SysUser; import org.jeecg.modules.entity.SysUserFocusStation; import org.jeecg.modules.mapper.SysUserFocusStationMapper; @@ -38,7 +40,8 @@ public class SysUserFocusStationServiceImpl extends ServiceImpl<SysUserFocusStat @Override @Transactional - public void create(SysUserFocusStation sysUserFocusStation) { + public Result create(SysUserFocusStation sysUserFocusStation) { + Result result = new Result(); //获取request HttpServletRequest request = SpringContextUtils.getHttpServletRequest(); //获取当前操作人用户名 @@ -48,19 +51,23 @@ public class SysUserFocusStationServiceImpl extends ServiceImpl<SysUserFocusStat userQueryWrapper.eq(SysUser::getUsername, username); SysUser sysUser = sysUserMapper.selectOne(userQueryWrapper); if (Objects.isNull(sysUser)){ - throw new RuntimeException("当前用户不存在!"); + result.error500("当前用户不存在!"); + return result; } Long id = IdWorker.getId(); - sysUserFocusStation.setId(Integer.valueOf(id.toString())); + sysUserFocusStation.setId(String.valueOf(id)); sysUserFocusStation.setUserId(sysUser.getId()); sysUserFocusStation.setCreateTime(new Date()); sysUserFocusStation.setCreateBy(username); this.baseMapper.insert(sysUserFocusStation); + result.success("新增成功"); + return result; } @Override @Transactional - public void deleteById(String stationId) { + public Result deleteById(String stationId) { + Result result = new Result<>(); //获取request HttpServletRequest request = SpringContextUtils.getHttpServletRequest(); //获取当前操作人用户名 @@ -70,12 +77,15 @@ public class SysUserFocusStationServiceImpl extends ServiceImpl<SysUserFocusStat userQueryWrapper.eq(SysUser::getUsername, username); SysUser sysUser = sysUserMapper.selectOne(userQueryWrapper); if (Objects.isNull(sysUser)){ - throw new RuntimeException("当前用户不存在!"); + result.error500("当前用户不存在!"); + return result; } LambdaQueryWrapper<SysUserFocusStation> queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(SysUserFocusStation::getUserId, sysUser.getId()); queryWrapper.eq(SysUserFocusStation::getStationId, stationId); this.baseMapper.delete(queryWrapper); + result.success("删除成功"); + return result; } } diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/entity/vo/SysTaskExportVo.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/entity/vo/SysTaskExportVo.java index a1e158e9..fa1aeb9c 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/entity/vo/SysTaskExportVo.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/entity/vo/SysTaskExportVo.java @@ -12,7 +12,7 @@ public class SysTaskExportVo { @ExcelField(title = "用户名称", width = 15, sort = 2) private String userName; - @ExcelField(title = "台站名称", width = 15, sort = 3) + @ExcelField(title = "台站名称", width = 90, sort = 3) private String stationName; } diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/GardsDetectorsServiceImpl.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/GardsDetectorsServiceImpl.java index 5b6bec28..a104bdc1 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/GardsDetectorsServiceImpl.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/GardsDetectorsServiceImpl.java @@ -92,7 +92,8 @@ public class GardsDetectorsServiceImpl extends ServiceImpl<GardsDetectorsMapper, queryWrapper.eq(GardsDetectors::getDetectorCode, gardsDetectors.getDetectorCode()); GardsDetectors detectors = this.baseMapper.selectOne(queryWrapper); if (Objects.nonNull(detectors)) { - throw new RuntimeException("当前数据已存在,新增失败!"); + result.error500("当前数据已存在,新增失败!"); + return result; } } this.baseMapper.insert(gardsDetectors); @@ -107,14 +108,16 @@ public class GardsDetectorsServiceImpl extends ServiceImpl<GardsDetectorsMapper, wrapper.eq(GardsDetectors::getDetectorId, gardsDetectors.getDetectorId()); GardsDetectors stations = this.baseMapper.selectOne(wrapper); if (Objects.isNull(stations)) { - throw new RuntimeException("当前数据不存在,修改失败"); + result.error500("当前数据不存在,修改失败"); + return result; } if (StringUtils.isNotBlank(gardsDetectors.getDetectorCode())){ LambdaQueryWrapper<GardsDetectors> queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(GardsDetectors::getDetectorCode, gardsDetectors.getDetectorCode()); GardsDetectors detectors = this.baseMapper.selectOne(queryWrapper); if (Objects.nonNull(detectors) && !detectors.getDetectorId().equals(gardsDetectors.getDetectorId())) { - throw new RuntimeException("当前数据"+gardsDetectors.getDetectorCode()+"已存在,修改失败!"); + result.error500("当前数据"+gardsDetectors.getDetectorCode()+"已存在,修改失败!"); + return result; } } LambdaQueryWrapper<GardsDetectors> detectorsQueryWrapper = new LambdaQueryWrapper<>(); diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/GardsNuclearfacilityServiceImpl.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/GardsNuclearfacilityServiceImpl.java index 335b82f3..ad191c68 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/GardsNuclearfacilityServiceImpl.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/GardsNuclearfacilityServiceImpl.java @@ -70,7 +70,8 @@ public class GardsNuclearfacilityServiceImpl extends ServiceImpl<GardsNuclearfac queryWrapper.eq(GardsNuclearfacility::getFacilityName, gardsNuclearfacility.getFacilityName()); GardsNuclearfacility nuclearfacility = this.baseMapper.selectOne(queryWrapper); if (Objects.nonNull(nuclearfacility)){ - throw new RuntimeException("当前同名称的核设施已存在,新增失败"); + result.error500("当前同名称的核设施已存在,新增失败"); + return result; } } this.baseMapper.insert(gardsNuclearfacility); @@ -86,14 +87,16 @@ public class GardsNuclearfacilityServiceImpl extends ServiceImpl<GardsNuclearfac wrapper.eq(GardsNuclearfacility::getFacilityId,gardsNuclearfacility.getFacilityId()); GardsNuclearfacility stations = this.baseMapper.selectOne(wrapper); if (Objects.isNull(stations)){ - throw new RuntimeException("修改失败,当前数据不存在!"); + result.error500("修改失败,当前数据不存在!"); + return result; } if (StringUtils.isNotBlank(gardsNuclearfacility.getFacilityName())){ LambdaQueryWrapper<GardsNuclearfacility> queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(GardsNuclearfacility::getFacilityName, gardsNuclearfacility.getFacilityName()); GardsNuclearfacility nuclearfacility = this.baseMapper.selectOne(queryWrapper); if (Objects.nonNull(nuclearfacility) && !nuclearfacility.getFacilityId().equals(gardsNuclearfacility.getFacilityId())){ - throw new RuntimeException("当前核设施"+gardsNuclearfacility.getFacilityName()+"已存在,修改失败"); + result.error500("当前核设施"+gardsNuclearfacility.getFacilityName()+"已存在,修改失败"); + return result; } } LambdaQueryWrapper<GardsNuclearfacility> nuclearfacilityQueryWrapper = new LambdaQueryWrapper<>(); diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/GardsStationsServiceImpl.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/GardsStationsServiceImpl.java index 31c6d7ba..7d749187 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/GardsStationsServiceImpl.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/GardsStationsServiceImpl.java @@ -93,7 +93,8 @@ public class GardsStationsServiceImpl extends ServiceImpl<GardsStationsMapper, G GardsStations stations = this.baseMapper.selectOne(queryWrapper); //如果数据不为空 if (Objects.nonNull(stations)) { - throw new RuntimeException("当前台站信息已存在,新增失败"); + result.error500("当前台站信息已存在,新增失败"); + return result; } } this.baseMapper.insert(gardsStations); @@ -114,7 +115,8 @@ public class GardsStationsServiceImpl extends ServiceImpl<GardsStationsMapper, G wrapper.eq(GardsStations::getStationId,gardsStations.getStationId()); GardsStations stations = this.baseMapper.selectOne(wrapper); if (Objects.isNull(stations)){ - throw new RuntimeException("修改失败,当前数据不存在!"); + result.error500("修改失败,当前数据不存在!"); + return result; } if (StringUtils.isNotBlank(gardsStations.getStationCode())){ //根据传递的台站编码查询 @@ -122,7 +124,8 @@ public class GardsStationsServiceImpl extends ServiceImpl<GardsStationsMapper, G queryWrapper.eq(GardsStations::getStationCode,gardsStations.getStationCode()); GardsStations oldStations = this.baseMapper.selectOne(queryWrapper); if (Objects.nonNull(oldStations) && !oldStations.getStationId().equals(gardsStations.getStationId())) { - throw new RuntimeException("当前台站信息"+gardsStations.getStationCode()+"已存在,修改失败"); + result.error500("当前台站信息"+gardsStations.getStationCode()+"已存在,修改失败"); + return result; } } LambdaQueryWrapper<GardsStations> stationsQueryWrapper = new LambdaQueryWrapper<>(); diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysTaskServiceImpl.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysTaskServiceImpl.java index 0e5474d9..88dacac8 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysTaskServiceImpl.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysTaskServiceImpl.java @@ -332,7 +332,7 @@ public class SysTaskServiceImpl extends ServiceImpl<SysTaskMapper, SysTask> impl String username = sysTaskVo.getUsername(); String stationNames = ""; for (SysTaskStation sysTaskStation:sysTaskVo.getStationList()) { - stationNames+=sysTaskStation.getStationName()+","; + stationNames+=sysTaskStation.getStationName()+StringPool.COMMA; } stationNames = stationNames.substring(0,stationNames.length()-1); if (StringUtils.isNotBlank(stationNames)){ @@ -355,6 +355,7 @@ public class SysTaskServiceImpl extends ServiceImpl<SysTaskMapper, SysTask> impl @Override public void exportImportTemplate(HttpServletRequest request, HttpServletResponse response) { String fileName = "排班任务导入模板"; + List<SysTaskExportVo> list = this.createList(); try { //处理需要导出的列 List<Object[]> annotationList = Lists.newArrayList(); @@ -365,13 +366,26 @@ public class SysTaskServiceImpl extends ServiceImpl<SysTaskMapper, SysTask> impl annotationList.add(new Object[] {ef,field}); } } - new ExportExcel().createXlsxExcel("排班任务信息", annotationList, 2, false).writeToXlsx(request, response, fileName); + new ExportExcel().createXlsxExcel("排班任务信息", annotationList, 2, false) + .setDataList(list).writeToXlsx(request, response, fileName); } catch (IOException e) { e.printStackTrace(); throw new BusinessException("模板导出失败"); } } + private List<SysTaskExportVo> createList(){ + List<SysTaskExportVo> list = new ArrayList<>(); + for(int i=1;i<=2;i++){ + SysTaskExportVo vo = new SysTaskExportVo(); + vo.setSchedulingDate("1997-01-01"); + vo.setStationName("AAA"+StringPool.COMMA+"BBB"); + vo.setUserName("sample"+i); + list.add(vo); + } + return list; + } + @Override @Transactional public ImportViewVo importExcel(List<SysTaskExportVo> dataList, int headRow) {