From 151b8c418046a9b42614c8e719711c5518070f74 Mon Sep 17 00:00:00 2001 From: liwen Date: Tue, 23 Apr 2024 16:14:02 +0800 Subject: [PATCH 1/6] =?UTF-8?q?fix:=20=E5=8D=AB=E7=94=9F=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=95=B0=E6=8D=AE=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hnac/hzims/safeproduct/mapper/HygienePlanMapper.java | 7 +++++-- .../hnac/hzims/safeproduct/mapper/HygienePlanMapper.xml | 4 ++-- .../hnac/hzims/safeproduct/mapper/HygieneRecordMapper.java | 14 ++++++++++++-- .../hnac/hzims/safeproduct/mapper/HygieneRecordMapper.xml | 14 +++++++++++++- .../hnac/hzims/safeproduct/mapper/HygieneZoneMapper.java | 4 ++-- .../safeproduct/service/impl/HygieneRecordServiceImpl.java | 5 +---- 6 files changed, 35 insertions(+), 13 deletions(-) diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygienePlanMapper.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygienePlanMapper.java index 324d14f..946d92b 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygienePlanMapper.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygienePlanMapper.java @@ -1,10 +1,11 @@ package com.hnac.hzims.safeproduct.mapper; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.hnac.hzims.safeproduct.entity.HygienePlanEntity; import com.hnac.hzims.safeproduct.vo.HygieneMonthVO; import org.apache.ibatis.annotations.Mapper; +import org.springblade.core.datascope.annotation.UserDataAuth; +import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; /** @@ -14,7 +15,7 @@ import org.apache.ibatis.annotations.Mapper; * @date 2023-12-27 */ @Mapper -public interface HygienePlanMapper extends BaseMapper { +public interface HygienePlanMapper extends UserDataScopeBaseMapper { /** * 查询当月各单位的卫生自查总数 @@ -23,6 +24,7 @@ public interface HygienePlanMapper extends BaseMapper { * @param month 月份 * @return 当月的卫生自查总数据 */ + @UserDataAuth IPage selectByMonth(IPage page, String unit, String month); /** @@ -32,5 +34,6 @@ public interface HygienePlanMapper extends BaseMapper { * @param month 月份 * @return 当月的已完成数据 */ + @UserDataAuth IPage selectFinishedDataByMonth(IPage page, String unit, String month); } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygienePlanMapper.xml b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygienePlanMapper.xml index 39919c0..6e7b224 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygienePlanMapper.xml +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygienePlanMapper.xml @@ -3,7 +3,7 @@ SELECT - unit, count(1) as finished_check_num + unit, count(1) as finished_check_num, create_user, create_dept FROM hzims_hygiene_plan WHERE diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygieneRecordMapper.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygieneRecordMapper.java index b888c54..d8095f6 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygieneRecordMapper.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygieneRecordMapper.java @@ -1,12 +1,14 @@ package com.hnac.hzims.safeproduct.mapper; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.hnac.hzims.safeproduct.entity.HygieneRecordEntity; import com.hnac.hzims.safeproduct.vo.HygieneRecordDetailVO; import com.hnac.hzims.safeproduct.vo.HygieneRecordPageVO; import org.apache.ibatis.annotations.Mapper; +import org.springblade.core.datascope.annotation.UserDataAuth; +import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; +import java.util.List; import java.util.Map; /** @@ -16,7 +18,7 @@ import java.util.Map; * @date 2023-12-27 */ @Mapper -public interface HygieneRecordMapper extends BaseMapper { +public interface HygieneRecordMapper extends UserDataScopeBaseMapper { /** * 查询卫生自查记录详情 @@ -31,5 +33,13 @@ public interface HygieneRecordMapper extends BaseMapper { * @param page 分页类 * @return 记录数据页 */ + @UserDataAuth IPage recordPage(IPage page, Map param); + + /** + * 查询当月卫生自查记录 + * @param month 当月 + * @return 当月卫生自查数据表 + */ + List selectHygieneByMonth(String month); } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygieneRecordMapper.xml b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygieneRecordMapper.xml index e7953b6..d012ec4 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygieneRecordMapper.xml +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygieneRecordMapper.xml @@ -14,7 +14,7 @@ + + \ No newline at end of file diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygieneZoneMapper.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygieneZoneMapper.java index 6614aff..50d9e76 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygieneZoneMapper.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygieneZoneMapper.java @@ -1,8 +1,8 @@ package com.hnac.hzims.safeproduct.mapper; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.hnac.hzims.safeproduct.entity.HygieneZoneEntity; import org.apache.ibatis.annotations.Mapper; +import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; /** * 卫生自查责任区Mapper类 @@ -11,6 +11,6 @@ import org.apache.ibatis.annotations.Mapper; * @date 2024-01-02 */ @Mapper -public interface HygieneZoneMapper extends BaseMapper { +public interface HygieneZoneMapper extends UserDataScopeBaseMapper { } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneRecordServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneRecordServiceImpl.java index aab7037..24d3a9f 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneRecordServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneRecordServiceImpl.java @@ -218,10 +218,7 @@ public class HygieneRecordServiceImpl extends ServiceImpl getHygieneByMonth(String month) { - QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.lambda().like(HygieneRecordEntity::getCreateTime, month) - .orderByDesc(HygieneRecordEntity::getCode); - return this.list(queryWrapper); + return baseMapper.selectHygieneByMonth(month); } /** From d347fa6f9db1f83eb2d274d0eddc0b87cd934a11 Mon Sep 17 00:00:00 2001 From: liwen Date: Tue, 23 Apr 2024 16:23:32 +0800 Subject: [PATCH 2/6] =?UTF-8?q?fix:=20=E7=89=B9=E7=A7=8D=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E6=B7=BB=E5=8A=A0=E6=95=B0=E6=8D=AE=E6=9D=83?= =?UTF-8?q?=E9=99=90=EF=BC=9B=E9=A1=B5=E9=9D=A2=E6=B7=BB=E5=8A=A0=E5=8D=95?= =?UTF-8?q?=E4=BD=8D=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/hnac/hzims/safeproduct/entity/SpecialDeviceEntity.java | 6 ++++++ .../hzims/safeproduct/mapper/SpecialDeviceInspectionMapper.java | 6 ++++-- .../java/com/hnac/hzims/safeproduct/mapper/SpecialDeviceMapper.java | 4 ++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/SpecialDeviceEntity.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/SpecialDeviceEntity.java index 5c12f90..8b3722b 100644 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/SpecialDeviceEntity.java +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/SpecialDeviceEntity.java @@ -7,6 +7,7 @@ import lombok.Data; import lombok.EqualsAndHashCode; import org.springblade.core.mp.base.BaseEntity; +import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; import java.util.Date; @@ -20,6 +21,11 @@ import java.util.Date; @ApiModel(value = "特种设备实体类") public class SpecialDeviceEntity extends BaseEntity { + @NotNull + @Size(max = 50, message = "设备所属机构字段长度不能超过50") + @ApiModelProperty("设备所属机构") + private String unit; + @Size(max = 50, message = "设备名称长度不能超过50") @ApiModelProperty("设备名称") private String name; diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/SpecialDeviceInspectionMapper.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/SpecialDeviceInspectionMapper.java index 4bbe2e9..39132ff 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/SpecialDeviceInspectionMapper.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/SpecialDeviceInspectionMapper.java @@ -1,9 +1,10 @@ package com.hnac.hzims.safeproduct.mapper; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.hnac.hzims.safeproduct.entity.SpecialDeviceInspectionEntity; import org.apache.ibatis.annotations.Mapper; +import org.springblade.core.datascope.annotation.UserDataAuth; +import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; import java.util.List; import java.util.Map; @@ -15,7 +16,7 @@ import java.util.Map; * @date 2024-01-22 */ @Mapper -public interface SpecialDeviceInspectionMapper extends BaseMapper { +public interface SpecialDeviceInspectionMapper extends UserDataScopeBaseMapper { /** * 设备检验记录分页 @@ -23,6 +24,7 @@ public interface SpecialDeviceInspectionMapper extends BaseMapper getInspectionPage(IPage page, Map param); /** diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/SpecialDeviceMapper.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/SpecialDeviceMapper.java index 1c2ace4..5fa5b96 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/SpecialDeviceMapper.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/SpecialDeviceMapper.java @@ -1,8 +1,8 @@ package com.hnac.hzims.safeproduct.mapper; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.hnac.hzims.safeproduct.entity.SpecialDeviceEntity; import org.apache.ibatis.annotations.Mapper; +import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; /** * 特种设备Mapper类 @@ -11,6 +11,6 @@ import org.apache.ibatis.annotations.Mapper; * @date 2024-01-12 */ @Mapper -public interface SpecialDeviceMapper extends BaseMapper { +public interface SpecialDeviceMapper extends UserDataScopeBaseMapper { } From faa5305f7fcf642adad516928c8379afb058cbeb Mon Sep 17 00:00:00 2001 From: liwen Date: Tue, 23 Apr 2024 16:26:43 +0800 Subject: [PATCH 3/6] =?UTF-8?q?fix:=20=E7=89=B9=E7=A7=8D=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E6=B7=BB=E5=8A=A0=E6=95=B0=E6=8D=AE=E6=9D=83?= =?UTF-8?q?=E9=99=90=EF=BC=9B=E9=A1=B5=E9=9D=A2=E6=B7=BB=E5=8A=A0=E5=8D=95?= =?UTF-8?q?=E4=BD=8D=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hzims-service/safeproduct/src/main/resources/db/2.0.1.sql | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hzims-service/safeproduct/src/main/resources/db/2.0.1.sql b/hzims-service/safeproduct/src/main/resources/db/2.0.1.sql index d66265a..9ac560e 100644 --- a/hzims-service/safeproduct/src/main/resources/db/2.0.1.sql +++ b/hzims-service/safeproduct/src/main/resources/db/2.0.1.sql @@ -7,3 +7,7 @@ ALTER TABLE hzims_conference_plan ALTER TABLE hzims_rehearsal_plan MODIFY COLUMN scheduled_start_time datetime NOT NULL COMMENT '演练计划开始时间', MODIFY COLUMN scheduled_end_time datetime NOT NULL COMMENT '演练计划结束时间'; + +-- 特种设备表:添加单位字段 +ALTER TABLE hzims_device + ADD COLUMN unit varchar(50) NOT NULL COMMENT '单位'; \ No newline at end of file From 8b0b6e244f4df834abe86a7c4b3a1248240a147d Mon Sep 17 00:00:00 2001 From: liwen Date: Tue, 23 Apr 2024 16:41:04 +0800 Subject: [PATCH 4/6] =?UTF-8?q?fix:=20=E5=9F=B9=E8=AE=AD=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=9D=83=E9=99=90=E9=80=BB=E8=BE=91=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hnac/hzims/safeproduct/mapper/RehearsalRecordMapper.xml | 2 +- .../java/com/hnac/hzims/safeproduct/mapper/TestMapper.java | 11 +++++++++-- .../java/com/hnac/hzims/safeproduct/mapper/TestMapper.xml | 12 ++++++++++++ .../com/hnac/hzims/safeproduct/mapper/TestScoreMapper.java | 4 ++-- .../com/hnac/hzims/safeproduct/mapper/TrainPlanMapper.java | 4 ++-- .../com/hnac/hzims/safeproduct/mapper/TrainRecordMapper.java | 11 +++++++++-- .../com/hnac/hzims/safeproduct/mapper/TrainRecordMapper.xml | 12 ++++++++++++ .../hnac/hzims/safeproduct/service/impl/TestServiceImpl.java | 5 +---- .../safeproduct/service/impl/TrainRecordServiceImpl.java | 5 +---- 9 files changed, 49 insertions(+), 17 deletions(-) diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/RehearsalRecordMapper.xml b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/RehearsalRecordMapper.xml index 2130923..c1d3077 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/RehearsalRecordMapper.xml +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/RehearsalRecordMapper.xml @@ -49,6 +49,6 @@ is_deleted = 0 AND create_time like concat(#{month}, '%') ORDER BY - create_time DESC + code DESC \ No newline at end of file diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TestMapper.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TestMapper.java index 906f6b2..0817af7 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TestMapper.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TestMapper.java @@ -1,11 +1,11 @@ package com.hnac.hzims.safeproduct.mapper; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.hnac.hzims.safeproduct.dto.TestDTO; import com.hnac.hzims.safeproduct.entity.TestEntity; import org.apache.ibatis.annotations.Mapper; import org.springblade.core.datascope.annotation.UserDataAuth; +import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; import java.util.List; import java.util.Map; @@ -17,7 +17,7 @@ import java.util.Map; * @date 2023-12-25 */ @Mapper -public interface TestMapper extends BaseMapper { +public interface TestMapper extends UserDataScopeBaseMapper { /** * 查询考试记录名称列表 @@ -35,4 +35,11 @@ public interface TestMapper extends BaseMapper { */ @UserDataAuth IPage testPage(IPage page, Map param); + + /** + * 查询当月考试记录 + * @param month 当月 + * @return 当月考试记录 + */ + List selectTestByMonth(String month); } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TestMapper.xml b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TestMapper.xml index 626bbad..18d8ea1 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TestMapper.xml +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TestMapper.xml @@ -38,4 +38,16 @@ ORDER BY create_time DESC + + \ No newline at end of file diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TestScoreMapper.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TestScoreMapper.java index 23290b8..061d4a5 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TestScoreMapper.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TestScoreMapper.java @@ -1,9 +1,9 @@ package com.hnac.hzims.safeproduct.mapper; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.hnac.hzims.safeproduct.entity.TestScoreEntity; import com.hnac.hzims.safeproduct.vo.TestScoreVO; import org.apache.ibatis.annotations.Mapper; +import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; import java.util.List; @@ -14,7 +14,7 @@ import java.util.List; * @date 2023-12-25 */ @Mapper -public interface TestScoreMapper extends BaseMapper { +public interface TestScoreMapper extends UserDataScopeBaseMapper { /** * 查询考试成绩列表 diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TrainPlanMapper.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TrainPlanMapper.java index 4a63a61..bbb1960 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TrainPlanMapper.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TrainPlanMapper.java @@ -1,6 +1,5 @@ package com.hnac.hzims.safeproduct.mapper; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.hnac.hzims.safeproduct.dto.AnalysisYearDTO; import com.hnac.hzims.safeproduct.entity.TrainPlanEntity; @@ -8,6 +7,7 @@ import com.hnac.hzims.safeproduct.vo.TrainMonthVO; import com.hnac.hzims.safeproduct.vo.TrainYearVO; import org.apache.ibatis.annotations.Mapper; import org.springblade.core.datascope.annotation.UserDataAuth; +import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; import java.util.List; import java.util.Map; @@ -19,7 +19,7 @@ import java.util.Map; * @date 2023-12-25 */ @Mapper -public interface TrainPlanMapper extends BaseMapper { +public interface TrainPlanMapper extends UserDataScopeBaseMapper { /** * 查询当月各单位的培训计划总数 diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TrainRecordMapper.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TrainRecordMapper.java index a4dd083..a7265c8 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TrainRecordMapper.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TrainRecordMapper.java @@ -1,6 +1,5 @@ package com.hnac.hzims.safeproduct.mapper; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.hnac.hzims.safeproduct.dto.TrainRecordDTO; import com.hnac.hzims.safeproduct.entity.TrainRecordEntity; @@ -8,6 +7,7 @@ import com.hnac.hzims.safeproduct.vo.TrainRecordDetailVO; import com.hnac.hzims.safeproduct.vo.TrainRecordVO; import org.apache.ibatis.annotations.Mapper; import org.springblade.core.datascope.annotation.UserDataAuth; +import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; import java.util.List; import java.util.Map; @@ -19,7 +19,7 @@ import java.util.Map; * @date 2023-12-25 */ @Mapper -public interface TrainRecordMapper extends BaseMapper { +public interface TrainRecordMapper extends UserDataScopeBaseMapper { /** * 查询培训记录名称列表 @@ -44,4 +44,11 @@ public interface TrainRecordMapper extends BaseMapper { */ @UserDataAuth IPage trainRecordPage(IPage page, Map param); + + /** + * 查询当月培训记录 + * @param month 当月 + * @return 当月培训记录 + */ + List selectTrainByMonth(String month); } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TrainRecordMapper.xml b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TrainRecordMapper.xml index a719263..cf36041 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TrainRecordMapper.xml +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TrainRecordMapper.xml @@ -53,4 +53,16 @@ ORDER BY t1.create_time DESC + + \ No newline at end of file diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestServiceImpl.java index 2645f06..8e75d9c 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestServiceImpl.java @@ -246,9 +246,6 @@ public class TestServiceImpl extends ServiceImpl impleme * @return 当月考试记录 */ public List getTestByMonth(String month) { - QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.lambda().like(TestEntity::getCreateTime, month) - .orderByDesc(TestEntity::getCode); - return this.list(queryWrapper); + return baseMapper.selectTestByMonth(month); } } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TrainRecordServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TrainRecordServiceImpl.java index 9a79a53..9a04c57 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TrainRecordServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TrainRecordServiceImpl.java @@ -219,9 +219,6 @@ public class TrainRecordServiceImpl extends ServiceImpl getTrainByMonth(String month) { - QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.lambda().like(TrainRecordEntity::getCreateTime, month) - .orderByDesc(TrainRecordEntity::getCode); - return this.list(queryWrapper); + return baseMapper.selectTrainByMonth(month); } } From b3af6b43e83e249faa6cc8f133c58efb7bd4e0b9 Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Tue, 23 Apr 2024 16:47:42 +0800 Subject: [PATCH 5/6] =?UTF-8?q?#=E6=8E=A8=E9=80=81=E9=80=9A=E8=AE=AF?= =?UTF-8?q?=E4=B8=AD=E6=96=ADmqtt=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../constants/InterruptionConstants.java | 2 + .../monitor/service/impl/AlarmSaveServiceImpl.java | 7 +++- .../service/alarm/impl/AlarmServiceImpl.java | 44 +++++++++++++++++++--- .../operation/monitor/impl/MonitorServiceImpl.java | 2 +- .../data/service/impl/HzimsDataServiceImpl.java | 7 +++- 5 files changed, 54 insertions(+), 8 deletions(-) diff --git a/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/business/interruption/constants/InterruptionConstants.java b/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/business/interruption/constants/InterruptionConstants.java index 6a93515..8a51d44 100644 --- a/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/business/interruption/constants/InterruptionConstants.java +++ b/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/business/interruption/constants/InterruptionConstants.java @@ -8,6 +8,8 @@ import java.util.List; */ public interface InterruptionConstants { + String HZ3000_TOPIC_PREFIX = "iot/sync/hz3000soe/"; + List INTERRUPTION_TYPE = Arrays.asList("13","14"); /**通讯恢复*/ diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/monitor/service/impl/AlarmSaveServiceImpl.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/monitor/service/impl/AlarmSaveServiceImpl.java index 7c66f3a..15564c3 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/monitor/service/impl/AlarmSaveServiceImpl.java +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/monitor/service/impl/AlarmSaveServiceImpl.java @@ -2,6 +2,7 @@ package com.hnac.hzims.alarm.monitor.service.impl; import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; +import com.hnac.hzims.alarm.config.constants.AlarmConstants; import com.hnac.hzims.alarm.config.service.AlarmConfigService; import com.hnac.hzims.alarm.config.entity.AlarmEntity; import com.hnac.hzims.alarm.monitor.service.AlarmSaveService; @@ -60,13 +61,17 @@ public class AlarmSaveServiceImpl implements AlarmSaveService { if(CollectionUtil.isEmpty(stations)){ return; } - //根据最近5分钟的数据,做去重 + // 根据最近5分钟的数据,做去重 for (String key : keys) { String value = stringRedisTemplate.opsForValue().get(key); if (value.equals(stations.get(0).getName()+alarm.getAlarmContext())){ return; } } + // fpd告警拼接 + if(AlarmConstants.EARLY_WARNING.equals(alarm.getAlarmSource())){ + alarm.setAlarmContext(stations.get(0).getName() + "." + alarm.getAlarmContext()); + } // 步骤3.站点参数设置 alarm.setCreateDept(stations.get(0).getCreateDept()); alarm.setStationName(stations.get(0).getName()); diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/AlarmServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/AlarmServiceImpl.java index dba937a..331a697 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/AlarmServiceImpl.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/AlarmServiceImpl.java @@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.hnac.hzims.alarm.config.constants.AlarmConstants; import com.hnac.hzims.alarm.config.entity.AlarmDefaultConfigEntity; import com.hnac.hzims.alarm.config.entity.AlarmEntity; +import com.hnac.hzims.alarm.config.vo.SystemAlarmVo; import com.hnac.hzims.business.interruption.constants.InterruptionConstants; import com.hnac.hzims.business.interruption.entity.InterruptionEntity; import com.hnac.hzims.operational.main.constant.HomePageConstant; @@ -21,10 +22,12 @@ import com.hnac.hzinfo.sdk.core.response.HzPage; import com.hnac.hzinfo.sdk.core.response.Result; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.springblade.core.tool.jackson.JsonUtil; import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.ObjectUtil; +import org.springblade.mqtt.producer.IMqttSender; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; @@ -52,6 +55,8 @@ public class AlarmServiceImpl implements AlarmService { private final RedisTemplate redisTemplate; + private final IMqttSender mqttSender; + private final static String start_stop_cache_final = "hzims:operation:start:stop:key"; private final static String load_hydropower_unit_real_key = "hzims:operation:loadhydropowerunit:real:key"; @@ -151,12 +156,12 @@ public class AlarmServiceImpl implements AlarmService { alarm.setDeviceCode(real.getDeviceCode()); alarm.setDeviceName(real.getDeviceName()); alarm.setAlarmId(station.getCode() + "_" + Func.randomUUID()); - alarm.setAlarmContext(station.getName() + "_" + real.getDeviceName() + "_关机"); + alarm.setAlarmContext(station.getName() + "." + real.getDeviceName() + "_关机"); alarm.setAlarmSource(AlarmConstants.START_STOP_WARNING); alarm.setAlarmType(AlarmConstants.STOP); if(state == 1){ alarm.setAlarmType(AlarmConstants.START); - alarm.setAlarmContext(station.getName() + "_" + real.getDeviceName() + "_开机"); + alarm.setAlarmContext(station.getName() + "." + real.getDeviceName() + "_开机"); } alarm.setStatus(0); alarm.setAlarmTime(new Date()); @@ -221,8 +226,7 @@ public class AlarmServiceImpl implements AlarmService { List soes = result.getData().getRecords(); // 查询当天数据中断告警记录 List saves = this.saveInterruptions(stations.stream().map(StationEntity::getCode).collect(Collectors.toList())); - // 批量保存中断告警数据 - this.interruptionAlarmService.saveBatch(soes.stream().filter(o-> CollectionUtil.isEmpty(saves) || !saves.stream().map(InterruptionEntity::getAlarmId).collect(Collectors.toList()).contains(o.getId())).map(soe->{ + List entities = soes.stream().filter(o-> CollectionUtil.isEmpty(saves) || !saves.stream().map(InterruptionEntity::getAlarmId).collect(Collectors.toList()).contains(o.getId())).map(soe->{ InterruptionEntity entity = new InterruptionEntity(); List soeStations = stations.stream().filter(o->o.getCode().equals(soe.getStation())).collect(Collectors.toList()); if(!CollectionUtil.isEmpty(soeStations)){ @@ -243,7 +247,37 @@ public class AlarmServiceImpl implements AlarmService { entity.setStatus(1); } return entity; - }).collect(Collectors.toList())); + }).collect(Collectors.toList()); + if(CollectionUtil.isEmpty(entities)){ + return; + } + // 批量保存中断告警数据 + this.interruptionAlarmService.saveBatch(entities); + // FIXME 发送HZ3000中通讯告警 + this.sendInterruptionMsg(entities); + } + + /** + * 发送HZ3000中通讯告警 + * @param entities + */ + private void sendInterruptionMsg(List entities) { + entities.forEach(entity->{ + SystemAlarmVo alarm = new SystemAlarmVo(); + if(ObjectUtil.isEmpty(entity.getId())){ + alarm.setId(DateUtil.format(new Date(),DateUtil.PATTERN_DATETIME_MINI)); + }else{ + alarm.setId(String.valueOf(entity.getId())); + } + alarm.setTs(entity.getAlarmTime().getTime()); + alarm.setType(Integer.parseInt(entity.getType())); + alarm.setStation(entity.getStationId()); + alarm.setRealId(entity.getRealId()); + alarm.setContext(entity.getSoeExplain()); + alarm.setState(entity.getStatus()); + log.error("send_interruption_msg : {}",JsonUtil.toJson(alarm)); + mqttSender.sendToMqtt(InterruptionConstants.HZ3000_TOPIC_PREFIX + entity.getStationId(), JsonUtil.toJson(alarm)); + }); } diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/impl/MonitorServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/impl/MonitorServiceImpl.java index b2131d8..00e220b 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/impl/MonitorServiceImpl.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/impl/MonitorServiceImpl.java @@ -720,7 +720,7 @@ public class MonitorServiceImpl implements MonitorService { if(!CollectionUtil.isEmpty(powers)){ for(RealAttributeVo attr : powers){ if(!"-".equals(attr.getValue())){ - if(Double.parseDouble(attr.getValue()) > 0){ + if(attr.getQuality() == 0 && Double.parseDouble(attr.getValue()) > 0){ station.setStatus(0); return; } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/data/service/impl/HzimsDataServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/data/service/impl/HzimsDataServiceImpl.java index beede99..59b40ab 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/data/service/impl/HzimsDataServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/data/service/impl/HzimsDataServiceImpl.java @@ -281,7 +281,12 @@ public class HzimsDataServiceImpl implements HzimsDataService { ActivePowerVo activePower = new ActivePowerVo(); activePower.setHour(entry.getKey()); activePower.setStrHour(entry.getValue().get(0).getStrHour()); - activePower.setActivePower(String.valueOf(entry.getValue().stream().mapToDouble(o->Double.parseDouble(o.getActivePower())).sum())); + List powers = entry.getValue().stream().filter(o->StringUtil.isNotBlank(o.getActivePower())).collect(Collectors.toList()); + if(CollectionUtil.isNotEmpty(powers)){ + activePower.setActivePower(String.valueOf(powers.stream().mapToDouble(o->Double.parseDouble(o.getActivePower())).sum())); + }else { + activePower.setActivePower(null); + } return activePower; }).sorted(Comparator.comparing(ActivePowerVo::getStrHour)).collect(Collectors.toList()); } From ea03dab7d242178616bfcf6c10c1755b6cb47bf8 Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Tue, 23 Apr 2024 17:00:02 +0800 Subject: [PATCH 6/6] =?UTF-8?q?#=E9=9B=86=E4=B8=AD=E7=9B=91=E6=8E=A7?= =?UTF-8?q?=E5=85=B3=E8=81=94=E6=95=B0=E6=8D=AE=E5=88=86=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hzims/operational/config/service/impl/CentralMonitorServiceImpl.java | 1 + 1 file changed, 1 insertion(+) diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/CentralMonitorServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/CentralMonitorServiceImpl.java index 911834c..991720d 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/CentralMonitorServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/CentralMonitorServiceImpl.java @@ -98,6 +98,7 @@ public class CentralMonitorServiceImpl implements CentralMonitorService { OriginalDataQuery originalDataQuery = new OriginalDataQuery(); originalDataQuery.setRealId(roleId); originalDataQuery.setLimit(size); + originalDataQuery.setPage(page); // 当日 if(ObjectUtil.isEmpty(start) && ObjectUtil.isEmpty(end)){ Calendar calendar = Calendar.getInstance();