diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/constants/AbnormalAlarmConstant.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/constants/AbnormalAlarmConstant.java index 1bdcfb6..8a194ab 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/constants/AbnormalAlarmConstant.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/constants/AbnormalAlarmConstant.java @@ -13,6 +13,13 @@ public interface AbnormalAlarmConstant { /**通讯恢复*/ String ABNORMAL_STATUS = "1"; + /**事故**/ + String FAULT = "2"; + + String WEBSOCKET_FAULT = "0"; + + List ALARM_WARN_TYPES = Arrays.asList("0","1","2"); + String[] TYPE_NAMES = {"默认", "系统", "告警", "故障", "用户操作", "遥测越限", "遥信变位", "注册信息", "信息提示", "设备巡检", "遥控操作", "遥测越限恢复","未定义","通讯中断","数据异常"}; /**处理、延后、误报*/ @@ -22,4 +29,5 @@ public interface AbnormalAlarmConstant { * 2-告警,3-故障,5-遥测越限,13-通讯异常,14-数据异常 */ List SOE_TYPE_LIST = Arrays.asList(2,3,5,13,14); + } diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/entity/HistoryAbnormalAlarmEntity.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/entity/HistoryAbnormalAlarmEntity.java index 9768788..8dc40fd 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/entity/HistoryAbnormalAlarmEntity.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/entity/HistoryAbnormalAlarmEntity.java @@ -9,6 +9,9 @@ import org.springblade.core.mp.base.BaseEntity; import java.util.Date; +/** + * @author ysj + */ @Data @TableName("hzims_history_abnormal_alarm") @EqualsAndHashCode(callSuper = false) @@ -24,6 +27,9 @@ public class HistoryAbnormalAlarmEntity extends BaseEntity { @ApiModelProperty("站点名称") private String stationName; + @ApiModelProperty("告警编码") + private Long alarmId; + @ApiModelProperty("检查点") private String realId; diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/AlarmDataVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/AlarmDataVo.java index 99f5235..ecc5e1c 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/AlarmDataVo.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/AlarmDataVo.java @@ -3,12 +3,14 @@ package com.hnac.hzims.operational.alert.vo; import com.hnac.hzinfo.datasearch.soe.domian.SoeData; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import lombok.EqualsAndHashCode; /** * @author ysj * @date 2023/03/23 14:06:27 * @version 4.0.0 */ +@EqualsAndHashCode(callSuper = true) @Data public class AlarmDataVo extends SoeData { diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/AlarmMergeVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/AlarmMergeVo.java new file mode 100644 index 0000000..1cc360a --- /dev/null +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/AlarmMergeVo.java @@ -0,0 +1,36 @@ +package com.hnac.hzims.operational.alert.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; + +/** + * @author ysj + * @date 2023/03/17 10:02:33 + * @version 4.0.0 + */ +@Data +public class AlarmMergeVo{ + + @ApiModelProperty("站点编号") + private String stationCode; + + @ApiModelProperty("站点名称") + private String stationName; + + @ApiModelProperty("检测点位") + private String realId; + + @ApiModelProperty("告警编号") + private String alarmCode; + + @ApiModelProperty("告警类型: 0 - 事故 、 1 - 一级告警、 2 - 二级告警") + private String type; + + @ApiModelProperty("告警内容: 0 - 事故 、 1 - 一级告警、 2 - 二级告警") + private String content; + + @ApiModelProperty("告警时间") + private Date date; +} diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/entity/OperDefectEntity.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/entity/OperDefectEntity.java index 7a5cbe2..c4b174c 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/entity/OperDefectEntity.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/entity/OperDefectEntity.java @@ -104,11 +104,13 @@ public class OperDefectEntity extends TenantEntity { /** * 区域Id */ + @ApiModelProperty(value = "区域Id") @TableField(exist = false) private String areaId; /** * 年月 */ + @ApiModelProperty(value = "年月") @TableField(exist = false) private YearMonth yearMonth; } diff --git a/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/areamonthly/vo/TaskListQuery.java b/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/areamonthly/vo/TaskListQuery.java index 12321b7..a8e08e5 100644 --- a/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/areamonthly/vo/TaskListQuery.java +++ b/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/areamonthly/vo/TaskListQuery.java @@ -126,11 +126,13 @@ public class TaskListQuery implements Serializable { /** * 月份 */ + @ApiModelProperty("月份") private YearMonth yearmonth; /** * 区域Id */ + @ApiModelProperty("区域Id") private String areaId; diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CheckMonthEntity.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CheckMonthEntity.java index c91da19..de8ae87 100644 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CheckMonthEntity.java +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CheckMonthEntity.java @@ -47,6 +47,7 @@ public class CheckMonthEntity extends TenantEntity implements Serializable { * 年月 */ @TableField(exist = false) + @ApiModelProperty("月份") private YearMonth yearMonth; @@ -55,6 +56,4 @@ public class CheckMonthEntity extends TenantEntity implements Serializable { private String itemName; - - } diff --git a/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/areamonthly/vo/MaintenanceTaskWithAreaVo.java b/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/areamonthly/vo/MaintenanceTaskWithAreaVo.java index e3c7288..6118c75 100644 --- a/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/areamonthly/vo/MaintenanceTaskWithAreaVo.java +++ b/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/areamonthly/vo/MaintenanceTaskWithAreaVo.java @@ -1,5 +1,6 @@ package com.hnac.hzims.ticket.areamonthly.vo; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.time.YearMonth; @@ -17,33 +18,39 @@ public class MaintenanceTaskWithAreaVo { /** * 区域编号 */ + @ApiModelProperty("区域编号") private String areaId; /** * 月份 */ + @ApiModelProperty("月份") private java.time.YearMonth YearMonth; /** * 项目名称 */ + @ApiModelProperty("项目名称") private String title; /** * 维护内容 */ + @ApiModelProperty("维护内容") private String content; /** * 执行状态 */ + @ApiModelProperty("执行状态") private Integer status; /** * 任务类型 */ + @ApiModelProperty("执行状态") private String taskType; } diff --git a/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/areamonthly/vo/StandardTicketVo.java b/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/areamonthly/vo/StandardTicketVo.java index 8a2abe6..9e8e9b0 100644 --- a/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/areamonthly/vo/StandardTicketVo.java +++ b/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/areamonthly/vo/StandardTicketVo.java @@ -1,5 +1,6 @@ package com.hnac.hzims.ticket.areamonthly.vo; +import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; @@ -18,6 +19,7 @@ import java.util.Date; */ @EqualsAndHashCode @Data +@ApiModel("操作票对象") public class StandardTicketVo implements Serializable { private static final long serialVersionUID = -8870464581684939369L; @@ -26,91 +28,109 @@ public class StandardTicketVo implements Serializable { /** * 编号 */ + @ApiModelProperty("编号") private Long id; /** * 开票种类 */ + @ApiModelProperty("开票种类") private String ticketType; /** * 单位 */ + @ApiModelProperty("单位") private String company; /** * 编号 */ + @ApiModelProperty("编号") private String code; /** * 开票来源 */ + @ApiModelProperty("开票来源") private String taskType; /** * 开票来源名称 */ + @ApiModelProperty("开票来源名称") private String taskTypeName; /** * 开票任务来源 */ + @ApiModelProperty("开票任务来源") private String taskName; /** * 发令人 */ + @ApiModelProperty("发令人") private Long issueOrderPerson; /** * 发令人名称 */ + @ApiModelProperty("发令人名称") private String issueOrderPersonName; /** * 受令人 */ + @ApiModelProperty("受令人") private Long accessOrderPerson; /** * 受令人名称 */ + @ApiModelProperty("受令人名称") private String accessOrderPersonName; /** * 监护人 */ + @ApiModelProperty("监护人") private Long guardian; /** * 监护人名称 */ + @ApiModelProperty("监护人名称") private String guardianName; /** * 值班负责人 */ + @ApiModelProperty("值班负责人") private Long principal; /** * 值班负责人 */ + @ApiModelProperty("值班负责人名称") private String principalName; /** * 开票时间 */ + @ApiModelProperty("开票时间") private Date createTime; /** * 状态 */ + @ApiModelProperty("状态") private Integer status; /** * 是否评价 */ + @ApiModelProperty("是否评价") private Integer isEvaluate; } diff --git a/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/areamonthly/vo/StandardTicketWithAreaVo.java b/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/areamonthly/vo/StandardTicketWithAreaVo.java index 3ebd967..9b278bf 100644 --- a/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/areamonthly/vo/StandardTicketWithAreaVo.java +++ b/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/areamonthly/vo/StandardTicketWithAreaVo.java @@ -21,34 +21,40 @@ public class StandardTicketWithAreaVo { /** * 区域编号 */ + @ApiModelProperty("区域编号") private String areaId; /** * 月份 */ - private YearMonth YearMonth; + @ApiModelProperty("月份") + private YearMonth yearMonth; /** * 开票种类 */ + @ApiModelProperty("开票种类") private String ticketType; /** * 编号 */ + @ApiModelProperty("编号") private String code; /** * 开票来源 */ + @ApiModelProperty("开票来源") private String taskType; /** * 状态 */ + @ApiModelProperty("状态") private Integer status; diff --git a/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/areamonthly/vo/StandardWorkVo.java b/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/areamonthly/vo/StandardWorkVo.java index 14cff7c..545edb5 100644 --- a/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/areamonthly/vo/StandardWorkVo.java +++ b/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/areamonthly/vo/StandardWorkVo.java @@ -1,5 +1,6 @@ package com.hnac.hzims.ticket.areamonthly.vo; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; @@ -22,45 +23,54 @@ public class StandardWorkVo implements Serializable { /** * 编号 */ + @ApiModelProperty("编号") private Long id; /** * 开票种类 */ + @ApiModelProperty("开票种类") private String type; /** * 单位 */ + @ApiModelProperty("单位") private String company; /** * 编号 */ + @ApiModelProperty("编号") private String code; /** * 开票来源 */ + @ApiModelProperty("开票来源") private String taskType; /** * 开票任务来源 */ + @ApiModelProperty("开票任务来源") private String taskName; /** * 开票时间 */ + @ApiModelProperty("开票时间") private Date createTime; /** * 状态 */ + @ApiModelProperty("状态") private Integer status; /** * 是否评价 */ + @ApiModelProperty("是否评价") private Integer isEvaluate; } diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/MiddleApplication.java b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/MiddleApplication.java index 4b48c6c..f678c01 100644 --- a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/MiddleApplication.java +++ b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/MiddleApplication.java @@ -13,9 +13,15 @@ import org.springframework.context.annotation.ComponentScan; @MapperScan("com.hnac.hzims.*.**.mapper.**") @ComponentScan(basePackages = {"com.hnac.*"}) public class MiddleApplication { + static { + System.setProperty("spring.cloud.nacos.discovery.server-addr", "http://175.6.40.67:10042"); + System.setProperty("spring.cloud.nacos.config.server-addr", "http://175.6.40.67:10042"); + System.setProperty("spring.cloud.nacos.username", "nacos"); + System.setProperty("spring.cloud.nacos.password", "nacos"); + } - public static void main(String[] args) { - BladeApplication.run("hzims-middle", MiddleApplication.class, args); - } + public static void main(String[] args) { + BladeApplication.run("hzims-middle", MiddleApplication.class, args); + } } diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/config/SysLogConfig.java b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/config/SysLogConfig.java index 5c99a58..b9f6fdc 100644 --- a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/config/SysLogConfig.java +++ b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/config/SysLogConfig.java @@ -7,6 +7,7 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import java.util.Timer; +import java.util.TimerTask; /** * @Author WL @@ -28,7 +29,7 @@ public class SysLogConfig { SyslogTimerTask myTimeTask = new SyslogTimerTask(statisticsService); //3.通过timer定时定频率调用SyslogTimerTask的业务逻辑 // 即 第一次执行是在当前时间的两秒之后,之后每隔60分钟执行一次 - timer.schedule(myTimeTask,2000L,60000L); + timer.schedule(myTimeTask, 2000L, (60L * 1000L)); } } diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/service/impl/StatisticsServiceImpl.java b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/service/impl/StatisticsServiceImpl.java index a551ab5..78c135e 100644 --- a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/service/impl/StatisticsServiceImpl.java +++ b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/service/impl/StatisticsServiceImpl.java @@ -54,10 +54,16 @@ public class StatisticsServiceImpl extends ServiceImpl UTF-8 1.0.3 + 1.9.6 @@ -214,6 +215,18 @@ com.hnac.hzinfo.data hzinfo-data-sdk + + + + + + com.github.xiaoymin + swagger-bootstrap-ui + ${swagger-bootstrap-ui.version} + + + + diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/OperationApplication.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/OperationApplication.java index 42143c2..cad2e11 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/OperationApplication.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/OperationApplication.java @@ -41,14 +41,12 @@ import javax.annotation.Resource; public class OperationApplication extends SpringBootServletInitializer { static{ - System.setProperty("--spring.cloud.nacos.discovery.server-addr", "http://175.6.40.67:10042"); - System.setProperty("--spring.cloud.nacos.config.server-addr", "http://175.6.40.67:10042"); - System.setProperty("--spring.cloud.nacos.username", "nacos"); - System.setProperty("--spring.cloud.nacos.password", "nacos"); + System.setProperty("spring.cloud.nacos.discovery.server-addr", "http://175.6.40.67:10042"); + System.setProperty("spring.cloud.nacos.config.server-addr", "http://175.6.40.67:10042"); + System.setProperty("spring.cloud.nacos.username", "nacos"); + System.setProperty("spring.cloud.nacos.password", "nacos"); } - - public static void main(String[] args) { BladeApplication.run(OperationalConstants.APP_NAME, OperationApplication.class, args); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/dto/OperAccessStatisticsDTO.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/dto/OperAccessStatisticsDTO.java index 0091f31..0d1dd0c 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/dto/OperAccessStatisticsDTO.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/dto/OperAccessStatisticsDTO.java @@ -27,14 +27,15 @@ public class OperAccessStatisticsDTO extends OperAccessStatisticsEntity { private List deptIds; /** - * 年月 + * 月份 */ - private YearMonth yearMonth; - + @ApiModelProperty("月份") + private YearMonth yearmonth; /** * 区域Id */ + @ApiModelProperty("区域Id") private String areaId; diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/AlarmMergeService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/AlarmMergeService.java new file mode 100644 index 0000000..4cb0260 --- /dev/null +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/AlarmMergeService.java @@ -0,0 +1,15 @@ +package com.hnac.hzims.operational.alert.service; + +import com.hnac.hzims.operational.config.vo.MessageParamVo; +import org.springframework.web.socket.TextMessage; + +/** + * @author ysj + * @date 2023/03/09 09:19:13 + * @version 4.0.0 + */ +public interface AlarmMergeService { + + // 获取发送消息 + TextMessage getSendMessage(MessageParamVo param); +} diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/LevelAlarmService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/LevelAlarmService.java new file mode 100644 index 0000000..0c6c0be --- /dev/null +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/LevelAlarmService.java @@ -0,0 +1,10 @@ +package com.hnac.hzims.operational.alert.service; + +/** + * 告警处理接口 + * @author ysj + */ +public interface LevelAlarmService { + + +} diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AlertDefectServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AlertDefectServiceImpl.java index f665a67..bff16bb 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AlertDefectServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AlertDefectServiceImpl.java @@ -27,6 +27,7 @@ import java.util.stream.Collectors; /** * 告警缺陷处理实现类 + * @author ysj */ @Slf4j @Service diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AlertMerageServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AlertMerageServiceImpl.java new file mode 100644 index 0000000..5398e76 --- /dev/null +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AlertMerageServiceImpl.java @@ -0,0 +1,106 @@ +package com.hnac.hzims.operational.alert.service.impl; + +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.hnac.hzims.operational.alert.constants.AbnormalAlarmConstant; +import com.hnac.hzims.operational.alert.entity.AlarmHandleEntity; +import com.hnac.hzims.operational.alert.entity.HistoryAbnormalAlarmEntity; +import com.hnac.hzims.operational.alert.service.AlarmHandleService; +import com.hnac.hzims.operational.alert.service.AlarmMergeService; +import com.hnac.hzims.operational.alert.service.HistoryAbnormalAlarmService; +import com.hnac.hzims.operational.alert.service.LevelAlarmService; +import com.hnac.hzims.operational.alert.vo.AlarmMergeVo; +import com.hnac.hzims.operational.config.vo.MessageParamVo; +import com.hnac.hzims.operational.main.constant.HomePageConstant; +import com.hnac.hzims.operational.station.entity.StationEntity; +import com.hnac.hzims.operational.station.service.IStationService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.tool.utils.CollectionUtil; +import org.springblade.core.tool.utils.DateUtil; +import org.springblade.core.tool.utils.ObjectUtil; +import org.springframework.stereotype.Service; +import org.springframework.web.socket.TextMessage; + +import java.util.ArrayList; +import java.util.Comparator; +import java.util.Date; +import java.util.List; +import java.util.stream.Collectors; + +/** + * 告警合并处理实现类 + * @author ysj + */ +@Slf4j +@Service +@RequiredArgsConstructor +public class AlertMerageServiceImpl implements AlarmMergeService { + + private final IStationService stationService; + + private final LevelAlarmService levelAlarmService; + + private final AlarmHandleService alarmHandleService; + + private final HistoryAbnormalAlarmService faultAlarmService; + + /** + * 根据用户获取hz3000事故告警、平台一级告警、二级告警 + * @param param + * @return + */ + @Override + public TextMessage getSendMessage(MessageParamVo param) { + // 查询用户 + if(ObjectUtil.isEmpty(param)){ + return null; + } + List depts = param.getDeptIds(); + if(CollectionUtil.isEmpty(depts)){ + return null; + } + // 查询站点 + List stations = stationService.list(Wrappers.lambdaQuery() + .in(StationEntity::getRefDept,depts) + .eq(StationEntity::getServeType, HomePageConstant.HYDROPOWER_SERVETYPE) + ); + if(CollectionUtil.isEmpty(stations)){ + return null; + } + String start = DateUtil.format(new Date(),DateUtil.PATTERN_DATE) + " 00:00:00"; + String end = DateUtil.format(new Date(),DateUtil.PATTERN_DATE) + " 23:59:59"; + + // hz3000事故告警 + List faults = faultAlarmService.list(Wrappers.lambdaQuery() + .in(HistoryAbnormalAlarmEntity::getStationId,stations.stream().map(StationEntity::getCode).collect(Collectors.toList())) + .eq(HistoryAbnormalAlarmEntity::getType, AbnormalAlarmConstant.FAULT) + .between(HistoryAbnormalAlarmEntity::getStartTime,start,end) + ); + // 处理告警记录 + List handles = alarmHandleService.list(Wrappers.lambdaQuery() + .in(AlarmHandleEntity::getStationCode,stations.stream().map(StationEntity::getCode).collect(Collectors.toList())) + .in(AlarmHandleEntity::getAlarmType, AbnormalAlarmConstant.ALARM_WARN_TYPES) + .between(AlarmHandleEntity::getCreateTime,start,end) + ); + List alarms = new ArrayList<>(); + if(CollectionUtil.isNotEmpty(faults)){ + alarms.addAll(faults.stream().filter(o -> CollectionUtil.isEmpty(handles) + || handles.stream().map(AlarmHandleEntity::getAlarmId).collect(Collectors.toList()).contains(o.getAlarmId())). + map(fault->{ + AlarmMergeVo alarm = new AlarmMergeVo(); + alarm.setStationCode(fault.getStationId()); + alarm.setStationName(fault.getStationName()); + alarm.setContent(fault.getSoeExplain()); + alarm.setDate(fault.getStartTime()); + alarm.setRealId(fault.getRealId()); + alarm.setType(AbnormalAlarmConstant.WEBSOCKET_FAULT); + return alarm; + }).collect(Collectors.toList())); + } + // hz3000事故告警 + // faultAlarmService.list(); + + return new TextMessage(JSONObject.toJSONString(alarms.stream().sorted(Comparator.comparing(AlarmMergeVo::getDate)).collect(Collectors.toList()))); + } +} diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryAbnormalAlarmServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryAbnormalAlarmServiceImpl.java index 8d1cb2a..87a7fc8 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryAbnormalAlarmServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryAbnormalAlarmServiceImpl.java @@ -49,6 +49,7 @@ import java.util.stream.Collectors; /** * 历史告警实现类 + * @author ysj */ @Slf4j @Service diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/LevelAlarmServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/LevelAlarmServiceImpl.java new file mode 100644 index 0000000..1883ff4 --- /dev/null +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/LevelAlarmServiceImpl.java @@ -0,0 +1,18 @@ +package com.hnac.hzims.operational.alert.service.impl; + +import com.hnac.hzims.operational.alert.service.LevelAlarmService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +/** + * 等级告警实现类 + * @author ysj + */ +@Slf4j +@Service +@RequiredArgsConstructor +public class LevelAlarmServiceImpl implements LevelAlarmService { + + +} diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/Swagger2Config.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/Swagger2Config.java new file mode 100644 index 0000000..18d9559 --- /dev/null +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/Swagger2Config.java @@ -0,0 +1,60 @@ +package com.hnac.hzims.operational.config; + +import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j; +import com.google.common.base.Predicates; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; +import springfox.documentation.builders.ApiInfoBuilder; +import springfox.documentation.builders.PathSelectors; +import springfox.documentation.service.ApiInfo; +import springfox.documentation.service.Contact; +import springfox.documentation.spi.DocumentationType; +import springfox.documentation.spring.web.plugins.Docket; +import springfox.documentation.swagger2.annotations.EnableSwagger2; + +/** + * @Author WL + * @Version v1.0 + * @Serial 1.0 + * @Date 2023/4/13 13:40 + */ +@Configuration +@EnableSwagger2 +public class Swagger2Config implements WebMvcConfigurer { + + + @Override + public void addResourceHandlers(ResourceHandlerRegistry registry) { + registry.addResourceHandler("/**") + .addResourceLocations("classpath:/static/"); + registry.addResourceHandler("doc.html") + .addResourceLocations("classpath:/META-INF/resources/"); + registry.addResourceHandler("/webjars/**") + .addResourceLocations("classpath:/META-INF/resources/webjars/"); + } + + + + @Bean + public Docket webApiConfig(){ + return new Docket(DocumentationType.SWAGGER_2) + .groupName("operationApplication") + .apiInfo(webApiInfo()) + .select() + //只显示api路径下的页面 + .paths(Predicates.and(PathSelectors.regex("/areaMonthlyDetails/.*"))) + .build(); + + } + + private ApiInfo webApiInfo() { + return new ApiInfoBuilder() + .title("网站-API文档") + .description("本文档描述了网站微服务接口定义") + .version("1.0") + .contact(new Contact("WL", "http://localhost:8501/", "55317332@qq.com")) + .build(); + } +} diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/config/WebSocketConfig.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/config/WebSocketConfig.java index 0fca3b6..eab3f8d 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/config/WebSocketConfig.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/config/WebSocketConfig.java @@ -1,10 +1,8 @@ package com.hnac.hzims.operational.config.config; +import com.hnac.hzims.operational.config.ws.AlarmHandler; import com.hnac.hzims.operational.config.ws.MessageHandler; -import com.hnac.hzims.operational.vRView.service.IHzImsRealDataService; -import com.hnac.hzims.operational.vRView.ws.HzWebSocketServer; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.web.socket.WebSocketHandler; @@ -13,27 +11,32 @@ import org.springframework.web.socket.config.annotation.WebSocketConfigurer; import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry; import org.springframework.web.socket.server.standard.ServerEndpointExporter; +/** + * @author ysj + */ @Configuration @EnableWebSocket public class WebSocketConfig implements WebSocketConfigurer{ @Override public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) { - registry.addHandler(myHandler(), "/comprehensiveD/{uid}") - .setAllowedOrigins("*"); + // 集中监控处理器 + registry.addHandler(monitorHandler(), "/comprehensiveD/{uid}").setAllowedOrigins("*"); + // 告警处理器 + registry.addHandler(alarmHandler(), "/alarmHandler/{uid}").setAllowedOrigins("*"); } @Bean - public WebSocketHandler myHandler() { + public WebSocketHandler monitorHandler() { return new MessageHandler(); } @Bean - public ServerEndpointExporter serverEndpointExporter() { - return new ServerEndpointExporter(); + public WebSocketHandler alarmHandler() { + return new AlarmHandler(); } - @Autowired - public void hzImsRealDataService(IHzImsRealDataService realDataService) { - HzWebSocketServer.hzImsRealDataService = realDataService; + @Bean + public ServerEndpointExporter serverEndpointExporter() { + return new ServerEndpointExporter(); } } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/ws/AlarmHandler.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/ws/AlarmHandler.java new file mode 100644 index 0000000..39d317d --- /dev/null +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/ws/AlarmHandler.java @@ -0,0 +1,79 @@ +package com.hnac.hzims.operational.config.ws; + +import com.alibaba.fastjson.JSONObject; +import com.hnac.hzims.operational.alert.service.AlarmHandleService; +import com.hnac.hzims.operational.alert.service.AlarmMergeService; +import com.hnac.hzims.operational.config.vo.MessageParamVo; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.tool.utils.ObjectUtil; +import org.springblade.core.tool.utils.StringUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.socket.CloseStatus; +import org.springframework.web.socket.TextMessage; +import org.springframework.web.socket.WebSocketSession; +import org.springframework.web.socket.handler.TextWebSocketHandler; + +import java.io.IOException; + +/** + * @author ysj + */ +@Slf4j +public class AlarmHandler extends TextWebSocketHandler { + + private final Long defaultRealDataRefreshTime = 20000L; + + @Autowired + private AlarmMergeService alarmMergeService; + + + //WebSocket连接建立成功之后调用 + @Override + public void afterConnectionEstablished(WebSocketSession session) { + String[] split = session.getUri().toString().split("/"); + String uid = split[split.length - 1]; + // session 参数设置用户进行标识 + session.getAttributes().put("userId", uid); + AlarmSessionManager.add(uid, session); + SocketPool.alarm_pool.put(session.getId(), this); + } + + // 连接关闭时调用 + @Override + public void afterConnectionClosed(WebSocketSession session, CloseStatus status) { + // 移除会话 + AlarmSessionManager.removeAndClose(session.getId()); + // map移除用户 + SocketPool.alarm_pool.remove(session.getId()); + } + + // 消息传输错误触发 + @Override + public void handleTransportError(WebSocketSession session, Throwable exception) { + // 移除会话 + SessionManager.removeAndClose(session.getId()); + // map移除用户 + SocketPool.pool.remove(session.getId()); + } + + + // 接收消息触发 + @Override + protected void handleTextMessage(WebSocketSession session, TextMessage textMessage) throws IOException { + // 获取会话用户编号 + String userId = (String) session.getAttributes().get("userId"); + String message = textMessage.getPayload(); + if(StringUtil.isBlank(message)){ + return; + } + MessageParamVo depts = JSONObject.parseObject(message, MessageParamVo.class); + if(ObjectUtil.isEmpty(depts)){ + return; + } + TextMessage sendMessage = alarmMergeService.getSendMessage(depts); + if(ObjectUtil.isEmpty(sendMessage)){ + return; + } + session.sendMessage(sendMessage); + } +} diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/ws/AlarmSessionManager.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/ws/AlarmSessionManager.java new file mode 100644 index 0000000..33fbd36 --- /dev/null +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/ws/AlarmSessionManager.java @@ -0,0 +1,58 @@ +package com.hnac.hzims.operational.config.ws; + +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.socket.WebSocketSession; + +import java.io.IOException; +import java.util.concurrent.ConcurrentHashMap; + + +/** + * @author Lch + */ +@Slf4j +public class AlarmSessionManager { + + public static ConcurrentHashMap SESSION_POOL = new ConcurrentHashMap<>(); + + /** + * 添加会话 + * @param uid 用户 + * @param session 会话对象 + */ + public static void add(String uid, WebSocketSession session) { + if (SESSION_POOL.containsKey(uid)) { + AlarmSessionManager.removeAndClose(uid); + } + SESSION_POOL.put(uid, session); + log.info("添加 WebSocketSession 会话成功,uid=" + uid); + } + + + /** + * 获取会话 + * @param uid 用户 + * @return + */ + public static WebSocketSession get(String uid) { + return SESSION_POOL.get(uid); + } + + /** + * 移除会话并关闭会话 + * @param uid 用户 + */ + public static void removeAndClose(String uid) { + WebSocketSession session = SESSION_POOL.get(uid); + if (session != null) { + try { + //关闭连接 + session.close(); + } catch (IOException ex) { + throw new RuntimeException("关闭ws会话失败!", ex); + } + } + + SESSION_POOL.remove(uid); + } +} diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/ws/MessageHandler.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/ws/MessageHandler.java index ff4bab4..7160f5a 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/ws/MessageHandler.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/ws/MessageHandler.java @@ -3,7 +3,6 @@ package com.hnac.hzims.operational.config.ws; import com.alibaba.fastjson.JSONObject; import com.hnac.hzims.operational.config.vo.MessageParamVo; import com.hnac.hzims.operational.station.service.IRealMonitorService; -import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; import org.springblade.core.tool.utils.ObjectUtil; import org.springblade.core.tool.utils.StringUtil; @@ -14,25 +13,20 @@ import org.springframework.web.socket.WebSocketSession; import org.springframework.web.socket.handler.TextWebSocketHandler; import java.io.IOException; -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.TimeUnit; +/** + * @author ysj + */ @Slf4j public class MessageHandler extends TextWebSocketHandler { - private ScheduledExecutorService service = Executors.newSingleThreadScheduledExecutor(); - - private Long defaultRealDataRefreshTime = 20000L; + private final Long defaultRealDataRefreshTime = 20000L; @Autowired private IRealMonitorService monitorService; - private WebSocketSession session; - @Override public void afterConnectionEstablished(WebSocketSession session) { - this.session = session; String[] split = session.getUri().toString().split("/"); String uid = split[split.length - 1]; SessionManager.add(uid, session); @@ -45,20 +39,16 @@ public class MessageHandler extends TextWebSocketHandler { @Override public void afterConnectionClosed(WebSocketSession session, CloseStatus status) { SessionManager.removeAndClose(session.getId()); - if (SocketPool.pool.containsKey(session.getId())) { - SocketPool.pool.remove(session.getId()); - } + SocketPool.pool.remove(session.getId()); log.info("sessionId: " + session.getId()); log.info("uri: " + session.getUri()); log.info("session closed successful!"); } @Override - public void handleTransportError(WebSocketSession session, Throwable exception) throws Exception { + public void handleTransportError(WebSocketSession session, Throwable exception) { SessionManager.removeAndClose(session.getId()); - if (SocketPool.pool.containsKey(session.getId())) { - SocketPool.pool.remove(session.getId()); - } + SocketPool.pool.remove(session.getId()); } @Override diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/ws/MyInterceptor.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/ws/MyInterceptor.java index d2f755d..5f4c58d 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/ws/MyInterceptor.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/ws/MyInterceptor.java @@ -8,37 +8,34 @@ import org.springframework.stereotype.Component; import org.springframework.web.socket.WebSocketHandler; import org.springframework.web.socket.server.HandshakeInterceptor; -import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; import java.util.HashMap; import java.util.Map; +/** + * @author ysj + */ @Component public class MyInterceptor implements HandshakeInterceptor { /** * 握手前 - * * @param request * @param response * @param wsHandler * @param attributes * @return - * @throws Exception */ @Override - public boolean beforeHandshake(ServerHttpRequest request, ServerHttpResponse response, WebSocketHandler wsHandler, Map attributes) throws Exception { - System.out.println("握手开始"); + public boolean beforeHandshake(ServerHttpRequest request, ServerHttpResponse response, WebSocketHandler wsHandler, Map attributes) { // 获得请求参数 - - HashMap paramMap = (HashMap) HttpUtil.decodeParamMap(request.getURI().getQuery(), Charset.forName("utf-8")); + HashMap paramMap = (HashMap) HttpUtil.decodeParamMap(request.getURI().getQuery(), StandardCharsets.UTF_8); String uid = paramMap.get("token"); if (StrUtil.isNotBlank(uid)) { // 放入属性域 attributes.put("token", uid); - System.out.println("用户 token " + uid + " 握手成功!"); return true; } - System.out.println("用户登录已失效"); return false; } @@ -52,7 +49,6 @@ public class MyInterceptor implements HandshakeInterceptor { */ @Override public void afterHandshake(ServerHttpRequest request, ServerHttpResponse response, WebSocketHandler wsHandler, Exception exception) { - System.out.println("握手完成"); } } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/ws/SocketPool.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/ws/SocketPool.java index f0d2668..a38b27c 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/ws/SocketPool.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/ws/SocketPool.java @@ -3,8 +3,13 @@ package com.hnac.hzims.operational.config.ws; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; +/** + * @author ysj + */ public class SocketPool { - public static Map pool = new ConcurrentHashMap(); + public static Map pool = new ConcurrentHashMap<>(); + + public static Map alarm_pool = new ConcurrentHashMap<>(); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/ws/WebsocketRun.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/ws/WebsocketRun.java deleted file mode 100644 index 15b3a80..0000000 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/ws/WebsocketRun.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.hnac.hzims.operational.config.ws; - - - -public class WebsocketRun extends Thread{ - - - - @Override - public void run() { - super.run(); - } -} diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/mapper/ImsDutyMainPersonMapper.xml b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/mapper/ImsDutyMainPersonMapper.xml index a544f90..d97abfe 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/mapper/ImsDutyMainPersonMapper.xml +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/mapper/ImsDutyMainPersonMapper.xml @@ -10,7 +10,7 @@ - + diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyMainServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyMainServiceImpl.java index 8bb0812..77a676b 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyMainServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyMainServiceImpl.java @@ -31,6 +31,7 @@ import org.springblade.core.tool.utils.*; import org.springblade.system.user.cache.UserCache; import org.springblade.system.user.entity.User; import org.springblade.system.user.feign.IUserClient; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -518,6 +519,8 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl ids = imsDutyMainEntities.stream().map(ImsDutyMainEntity::getId).collect(Collectors.toList()); + List mainIds = imsDutyMainEntities.stream().map(ImsDutyMainEntity::getId).collect(Collectors.toList()); List personEntityList = imsDutyMainPersonMapper.selectList(new LambdaQueryWrapper() {{ - in(ImsDutyMainPersonEntity::getDutyMainId, ids); + in(ImsDutyMainPersonEntity::getDutyMainId, mainIds); }}); if (CollectionUtil.isEmpty(personEntityList)) { //如果人员计划表中,无值,需要填充对应信息(只有排班-班组,人员计划表才有可能无值) + //对上一个版本做兼容 for (ImsDutyMainEntity imsDutyMainEntity : imsDutyMainEntities) { String[] dutyPersonIds = imsDutyMainEntity.getDutyPersonIds().split("\\^"); List personIdlist = Arrays.asList(dutyPersonIds); @@ -1262,23 +1267,20 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl personId = changeDutyMainVo.getPersonId(); HashSet manageIds=new HashSet<>(); HashSet personHashSet=new HashSet<>(); - imsDutyMainEntities.stream().map(s->{ - if (s.getDutyGroupId()!=null){ - ImsDutyGroupEntity imsDutyGroupEntity = dutyGroupMapper.selectById(s.getDutyGroupId()); + for (ImsDutyMainEntity imsDutyMainEntity : imsDutyMainEntities) { + if (imsDutyMainEntity.getDutyGroupId()!=null){ + ImsDutyGroupEntity imsDutyGroupEntity = dutyGroupMapper.selectById(imsDutyMainEntity.getDutyGroupId()); manageIds.add(imsDutyGroupEntity.getManagerId().toString()); } - return s; - }); - for (ImsDutyMainEntity imsDutyMainEntity : imsDutyMainEntities) { String[] dutyMainPersonIds = imsDutyMainEntity.getDutyPersonIds().split("\\^"); List personIdlist = new ArrayList<>(Arrays.asList(dutyMainPersonIds)); personHashSet.addAll(personIdlist); - } + //调入调出,对人员做重复判断 for (String s : personId) { if (1==changeDutyMainVo.getType()) { if (personHashSet.contains(s)) { @@ -1290,7 +1292,7 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl dutyChargePersonIds = personEntityList.stream().filter(s -> s.getDutyChargePerson()!=null) .map(s -> s.getDutyChargePerson().toString()).collect(Collectors.toList()); manageIds.addAll(dutyChargePersonIds); @@ -1303,17 +1305,6 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl addPersonEntityList = new ArrayList<>(); - List updatePersonEntityList= personEntityList.stream().map(sig -> { - if (sig.getDutyGroupId() != null) { - ImsDutyGroupEntity imsDutyGroupEntity = dutyGroupMapper.selectById(sig.getDutyGroupId()); - sig.setDutyGroupName(imsDutyGroupEntity.getGroupName()); - sig.setDutyGroupId(null); - } - long id = IdWorker.getId(sig); - sig.setId(id); - return sig; - }).collect(Collectors.toList()); - List longList=new ArrayList<>(); List updateDutyMainEntities = imsDutyMainEntities.stream().map(s -> { String[] dutyMainPersonIds = s.getDutyPersonIds().split("\\^"); List personIdlist = new ArrayList<>(Arrays.asList(dutyMainPersonIds)); @@ -1324,54 +1315,51 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl updatePersonEntityList= personEntityList.stream().map(sig -> { + if (sig.getDutyGroupId() != null) { + ImsDutyGroupEntity imsDutyGroupEntity = dutyGroupMapper.selectById(sig.getDutyGroupId()); + sig.setDutyGroupName(imsDutyGroupEntity.getGroupName()); + sig.setDutyGroupId(null); + } + long id = IdWorker.getId(sig); + sig.setId(id); + return sig; + }).collect(Collectors.toList()); + //如果是添加,填充对应人员的排版人员表 + if(1 == changeDutyMainVo.getType()) { + for (String addId : personId) { + for (Long mainId : mainIds) { + //copy修改后的数据, + List collect = updatePersonEntityList.stream().filter(s -> mainId.equals(s.getDutyMainId())).collect(Collectors.toList()); + ImsDutyMainPersonEntity imsDutyMainPersonEntity=collect.get(0); + ImsDutyMainPersonEntity addEntity = new ImsDutyMainPersonEntity(); + BeanUtil.copy(imsDutyMainPersonEntity, addEntity); + addEntity.setDutyPerson(Long.valueOf(addId)); + long id1 = IdWorker.getId(imsDutyMainPersonEntity); + addEntity.setId(id1); + addPersonEntityList.add(addEntity); + } + } + updatePersonEntityList.addAll(addPersonEntityList); + } if (2 == changeDutyMainVo.getType()) { for (String s : personId) { updatePersonEntityList=updatePersonEntityList.stream().filter( sig -> !sig.getDutyPerson().equals(s)) .collect(Collectors.toList()); } - } else { - updatePersonEntityList.addAll(addPersonEntityList); } - this.deleteLogic(ids); + //更新排班-班组表,删除排班人员表,再添加排班班组人员表 + this.updateBatchById(updateDutyMainEntities); List list = personEntityList.stream().map(s -> Long.valueOf(s.getId())).collect(Collectors.toList()); iImsDutyMainPersonService.deleteLogic(list); - this.saveBatch(updateDutyMainEntities); iImsDutyMainPersonService.saveBatch(updatePersonEntityList); return R.success("修改成功"); } @@ -1594,6 +1582,7 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl standardTicketInfoVoIPage = areaMonthlyDetailsService.areaMonthlyWithOperation(page, size, areaMonthly); return R.data(standardTicketInfoVoIPage); } @@ -82,6 +89,7 @@ public class AreaMonthlyDetailsController { * * @return */ + @ApiOperation("操作票 根据月份,区域 获取操作详情数据") @GetMapping("/areaMonthlyWithOperation/detail/{id}") public R areaMonthlyWithOperationDetail(@PathVariable("id") Long id) { StandardTicketInfoVO standardTicketInfoVoIPage = areaMonthlyDetailsService.areaMonthlyWithOperationDetail(id); @@ -92,6 +100,7 @@ public class AreaMonthlyDetailsController { /** * 查询工作票评论 */ + @ApiOperation("查询工作票评论") @GetMapping("/areaMonthlyWithOperation/workTicketCommentList") public R> workTicketCommentList(TicketInfoEvaluateEntity req) { List ticketInfoEvaluateVOS = areaMonthlyDetailsService.workTicketCommentList(req); @@ -102,16 +111,21 @@ public class AreaMonthlyDetailsController { /** * 保存评论信息 */ + @ApiOperation("保存评论信息") @PostMapping("/saveComment") public R saveComment(@RequestBody TicketInfoEvaluateDto req) { return R.data(areaMonthlyDetailsService.saveComment(req)); } /** - * 根据月份和区域查询工作票列表详情 + * 根据月份和区域查询工作票分页列表数据 */ + @ApiOperation("根据月份和区域查询工作票分页列表数据") @GetMapping("/workTicketListByMonthAndArea/{page}/{size}") - R> workTicketListByMonthAndArea(@PathVariable Long page, @PathVariable Long size, @SpringQueryMap StandardTicketWithAreaVo areaMonthlyVo) { + R> workTicketListByMonthAndArea( + @ApiParam(name = "page", value = "当前页", required = true) @PathVariable("page") Long page, + @ApiParam(name = "size", value = "每页记录数", required = true) @PathVariable("size") Long size, + @SpringQueryMap StandardTicketWithAreaVo areaMonthlyVo) { BladePage standardWorkVoIPage = areaMonthlyDetailsService.workTicketListByMonthAndArea(page, size, areaMonthlyVo); return R.data(standardWorkVoIPage); } @@ -121,9 +135,12 @@ public class AreaMonthlyDetailsController { * 根据区域和月份分页查询日志维护列表 */ @ApiOperationSupport(order = 100) - @ApiOperation(value = "日志维护列表分页查询") + @ApiOperation(value = "根据区域和月份分页查询日志维护列表") @GetMapping("/queryLogMaintenancePageList/{page}/{size}") - public R> queryLogMaintenancePageList(@PathVariable Long page, @PathVariable Long size, MaintenanceTaskWithAreaVo maintenanceTaskVo) { + public R> queryLogMaintenancePageList( + @ApiParam(name = "page", value = "当前页", required = true) @PathVariable("page") Long page, + @ApiParam(name = "size", value = "每页记录数", required = true) @PathVariable("size") Long size, + MaintenanceTaskWithAreaVo maintenanceTaskVo) { Page pageParam = new Page<>(page, size); IPage taskList = taskService.queryLogMaintenancePageList(pageParam, maintenanceTaskVo); return R.data(taskList); @@ -135,7 +152,7 @@ public class AreaMonthlyDetailsController { */ @GetMapping("/queryLogMaintenancePageList/detail/{id}") @ApiOperationSupport(order = 40) - @ApiOperation(value = "详情") + @ApiOperation(value = "根据区域和月份分页查询日志维护 根据id获取详情") public R detail(@PathVariable Long id) { return taskService.detail(id); } @@ -145,7 +162,7 @@ public class AreaMonthlyDetailsController { * 根据区域和月份分页查询巡检任务 */ @ApiOperationSupport(order = 50) - @ApiOperation(value = "分页查询") + @ApiOperation(value = "根据区域和月份分页查询巡检任务") @GetMapping("/queryCheckTaskPageList") public R> queryCheckTaskPageList(TaskListQuery task, Query query) { BladePage taskVoIPage = areaMonthlyDetailsService.queryCheckTaskPageList(task, query); @@ -156,9 +173,9 @@ public class AreaMonthlyDetailsController { /** * 根据id查询巡检任务 */ + @ApiOperation(value = "根据id查询巡检任务") @GetMapping("/queryCheckTaskById/{id}") @ApiOperationSupport(order = 60) - @ApiOperation(value = "详情") public R queryCheckTaskById(@PathVariable Long id) { TaskEntity task = areaMonthlyDetailsService.queryCheckTaskById(id); return R.data(task); @@ -169,11 +186,11 @@ public class AreaMonthlyDetailsController { * 根据区域和月份分页查询缺陷库 */ @ApiOperationSupport(order = 70) - @ApiOperation(value = "分页查询") + @ApiOperation(value = "根据区域和月份分页查询缺陷库") @GetMapping("/queryDefectPageList/{page}/{size}") public R> queryDefectPageList( - @PathVariable Long page, - @PathVariable Long size, + @ApiParam(name = "page", value = "当前页", required = true) @PathVariable("page") Long page, + @ApiParam(name = "size", value = "每页记录数", required = true) @PathVariable("size") Long size, OperDefectEntity defect) { Page operDefectEntityPage = new Page<>(page, size); IPage pages = defectService.selectPage(operDefectEntityPage, defect); @@ -187,7 +204,7 @@ public class AreaMonthlyDetailsController { */ @GetMapping("queryDefectPageDetail/detail") @ApiOperationSupport(order = 1) - @ApiOperation(value = "详情", notes = "传入defect") + @ApiOperation(value = "根据区域和月份分页查询缺陷库 详情", notes = "传入defect") public R queryDefectPageDetail(OperDefectEntity defect) { return defectService.detail(defect); } @@ -200,7 +217,8 @@ public class AreaMonthlyDetailsController { @ApiOperation(value = "根据区域和月份分页查询检修任务") @GetMapping("/queryReconditionPageList/{page}/{size}") public R> queryReconditionPageList( - @PathVariable Long page, @PathVariable Long size, + @ApiParam(name = "page", value = "当前页", required = true) @PathVariable("page") Long page, + @ApiParam(name = "size", value = "每页记录数", required = true) @PathVariable("size") Long size, OperAccessStatisticsDTO result) { Page dbPage = new Page<>(page, size); R> r = accessStatisticsService.list(result, dbPage); @@ -226,8 +244,10 @@ public class AreaMonthlyDetailsController { @GetMapping("/queryProduceNumByAreaCode/{page}/{size}") @ApiOperationSupport(order = 90) @ApiOperation(value = "根据区域编号查询安全生产会议次数") - public R> queryProduceNumByAreaCode(@PathVariable Long page, @PathVariable Long size, - CheckMonthEntity req) { + public R> queryProduceNumByAreaCode( + @ApiParam(name = "page", value = "当前页", required = true) @PathVariable("page") Long page, + @ApiParam(name = "size", value = "每页记录数", required = true) @PathVariable("size") Long size, + CheckMonthEntity req) { req.setItemName("现场每月1次安全生产会议"); BladePage checkMonthVoBladePage = areaMonthlyDetailsService.queryProduceByAreaCode(page, size, req); @@ -240,7 +260,10 @@ public class AreaMonthlyDetailsController { @GetMapping("/querySkillByAreaCode/{page}/{size}") @ApiOperationSupport(order = 100) @ApiOperation(value = "根据区域编号查询技能培训") - public R> querySkillByAreaCode(@PathVariable Long page, @PathVariable Long size, CheckMonthEntity req) { + public R> querySkillByAreaCode( + @ApiParam(name = "page", value = "当前页", required = true) @PathVariable("page") Long page, + @ApiParam(name = "size", value = "每页记录数", required = true) @PathVariable("size") Long size, + CheckMonthEntity req) { req.setItemName("每月开展1次技能培训"); BladePage checkMonthVoBladePage = areaMonthlyDetailsService.queryProduceByAreaCode(page, size, req); @@ -254,21 +277,23 @@ public class AreaMonthlyDetailsController { @GetMapping("/queryProduceByAreaCode/{page}/{size}") @ApiOperationSupport(order = 100) @ApiOperation(value = "根据区域编号查询技能培训") - public R> queryProduceByAreaCode(@PathVariable Long page, @PathVariable Long size, CheckMonthEntity req) { + public R> queryProduceByAreaCode( + @ApiParam(name = "page", value = "当前页", required = true) @PathVariable("page") Long page, + @ApiParam(name = "size", value = "每页记录数", required = true) @PathVariable("size") Long size, + CheckMonthEntity req) { BladePage checkMonthVoBladePage = areaMonthlyDetailsService.queryProduceByAreaCode(page, size, req); return R.data(checkMonthVoBladePage); } - /** * 根据区域编号查询 月度自查 技能培训 安全生产会议次数 */ @GetMapping("/queryProduceByAreaCodeDetail/detail/{id}") @ApiOperationSupport(order = 40) - @ApiOperation(value = "详情", notes = "传入id") - public R queryProduceByAreaCodeDetail(@PathVariable Long id){ + @ApiOperation(value = "根据区域编号查询 月度自查 技能培训 安全生产会议次数", notes = "传入id") + public R queryProduceByAreaCodeDetail(@PathVariable Long id) { CheckMonthVo checkMonthVo = areaMonthlyDetailsService.queryProduceByAreaCodeDetail(id); return R.data(checkMonthVo); } @@ -280,9 +305,10 @@ public class AreaMonthlyDetailsController { @GetMapping("/querySecurityAreaCode/{page}/{size}") @ApiOperationSupport(order = 100) @ApiOperation(value = "根据区域编号查询安全检查") - public R> querySecurityAreaCode(@PathVariable Long page, - @PathVariable Long size, - CheckCompanyEntity req) { + public R> querySecurityAreaCode( + @ApiParam(name = "page", value = "当前页", required = true) @PathVariable("page") Long page, + @ApiParam(name = "size", value = "每页记录数", required = true) @PathVariable("size") Long size, + CheckCompanyEntity req) { BladePage checkMonthVoBladePage = areaMonthlyDetailsService.querySecurityAreaCode(page, size, req); return R.data(checkMonthVoBladePage); @@ -301,7 +327,6 @@ public class AreaMonthlyDetailsController { } - /** * 根据区域编号查询设备试验 */ @@ -309,11 +334,11 @@ public class AreaMonthlyDetailsController { @ApiOperationSupport(order = 100) @ApiOperation(value = "根据区域编号查询设备试验") public R> queryEquipmentAreaCode( - @PathVariable Long page, - @PathVariable Long size, + @ApiParam(name = "page",value = "当前页",required = true) @PathVariable("page") Long page, + @ApiParam(name = "size",value = "每页记录数",required = true) @PathVariable("size") Long size, SafeEquipmentTrialDTO safeEquipmentTrialDTO) { BladePage checkMonthVoBladePage = areaMonthlyDetailsService.queryEquipmentAreaCode(page - ,size,safeEquipmentTrialDTO); + , size, safeEquipmentTrialDTO); return R.data(checkMonthVoBladePage); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java index 84646b7..62bc750 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java @@ -143,6 +143,8 @@ public class StationServiceImpl extends BaseServiceImpl getOperateTicketReportStatistic(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("deptIdList") List deptIdList); + + + /** + * 分页查询 + * @param searchPage + * @param queryWrapper + * @return + */ + Page selectPages(Page searchPage, + @Param(Constants.WRAPPER) QueryWrapper queryWrapper); } diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/mapper/xml/StandardTicketInfoMapper.xml b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/mapper/xml/StandardTicketInfoMapper.xml index dc58a4d..6996bd2 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/mapper/xml/StandardTicketInfoMapper.xml +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/mapper/xml/StandardTicketInfoMapper.xml @@ -76,4 +76,10 @@ + + diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/StandardTicketInfoServiceImpl.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/StandardTicketInfoServiceImpl.java index fb7f139..92b7aec 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/StandardTicketInfoServiceImpl.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/StandardTicketInfoServiceImpl.java @@ -331,23 +331,26 @@ public class StandardTicketInfoServiceImpl extends BaseServiceImpl queryWrapper = new QueryWrapper<>(); //开票来源 - queryWrapper.lambda().eq(Func.isNotEmpty(areaVo.getTaskType()), StandardTicketInfoEntity::getTaskType, + queryWrapper.eq(Func.isNotEmpty(areaVo.getTaskType()), "sti.task_type", areaVo.getTaskType()); //编号 - queryWrapper.lambda().like(Func.isNotEmpty(areaVo.getCode()), StandardTicketInfoEntity::getCode, areaVo.getCode()); + queryWrapper.like(Func.isNotEmpty(areaVo.getCode()),"sti.code" , areaVo.getCode()); //状态 - queryWrapper.lambda().eq(Func.isNotEmpty(areaVo.getStatus()), StandardTicketInfoEntity::getStatus, + queryWrapper.eq(Func.isNotEmpty(areaVo.getStatus()), "sti.status", areaVo.getStatus()); //开始时间 - queryWrapper.lambda().lt(Func.isNotEmpty(areaVo.getStartTime()), StandardTicketInfoEntity::getCreateTime, + queryWrapper.lt(Func.isNotEmpty(areaVo.getStartTime()), "sti.create_time", areaVo.getStartTime()); //结束时间 - queryWrapper.lambda().le(Func.isNotEmpty(areaVo.getEndTime()), StandardTicketInfoEntity::getCreateTime, + queryWrapper.le(Func.isNotEmpty(areaVo.getEndTime()), "sti.create_time", areaVo.getEndTime()); - queryWrapper.eq("CREATE_DEPT", areaVo.getAreaId()); + + queryWrapper.eq("sti.CREATE_DEPT", areaVo.getAreaId()); queryWrapper.eq(areaVo.getYearMonth() != null, - "date_format(create_time,'%Y-%m')", areaVo.getYearMonth()); - Page standardTicketInfoEntityPage = baseMapper.selectPage(searchPage, queryWrapper); + "date_format(sti.create_time,'%Y-%m')", areaVo.getYearMonth()); + queryWrapper.eq("tie.status",1); + Page standardTicketInfoEntityPage = baseMapper.selectPages(searchPage, queryWrapper); + //数据转换StandardTicketInfoEntity ==> StandardTicketVo List standardTicketInfoVOList = new ArrayList<>(); if (CollectionUtil.isNotEmpty(standardTicketInfoEntityPage.getRecords())) { @@ -364,10 +367,11 @@ public class StandardTicketInfoServiceImpl extends BaseServiceImpl DictCache.getValue(DictConstants.TICKET_SOURCE_TYPE,t)).orElse(null)); + standardTicketVo.setTaskTypeName(Optional.ofNullable(item.getTaskType()).map(t -> DictCache.getValue(DictConstants.TICKET_SOURCE_TYPE, t)).orElse(null)); return standardTicketVo; }).collect(Collectors.toList()); } + Page page = new Page<>(); page.setSize(standardTicketInfoEntityPage.getSize()); page.setCurrent(standardTicketInfoEntityPage.getCurrent()); @@ -379,6 +383,21 @@ public class StandardTicketInfoServiceImpl extends BaseServiceImpl ticketInfoEvaluateEntityLambdaQueryWrapper = new LambdaQueryWrapper<>(); + ticketInfoEvaluateEntityLambdaQueryWrapper.eq(TicketInfoEvaluateEntity::getTicketId, item.getId()); + ticketInfoEvaluateEntityLambdaQueryWrapper.eq(TicketInfoEvaluateEntity::getStatus, + TicketConstants.TicketQualifiedEnum.Qualified.getCode()); + int count = ticketInfoEvaluateService.count(ticketInfoEvaluateEntityLambdaQueryWrapper); + return count > 0; + } + /** * 首页-当月操作票获取 * diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/mapper/WorkTicketInfoMapper.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/mapper/WorkTicketInfoMapper.java index aec3ad2..bdee63c 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/mapper/WorkTicketInfoMapper.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/mapper/WorkTicketInfoMapper.java @@ -1,5 +1,8 @@ package com.hnac.hzims.ticket.workTicket.mapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Constants; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.hnac.hzims.ticket.workTicket.entity.WorkTicketInfoEntity; import com.hnac.hzims.ticket.workTicket.vo.WorkTicketReportStatisticVO; import com.hnac.hzims.vo.SafeCheckStatisticVO; @@ -22,30 +25,43 @@ import java.util.Map; @Mapper public interface WorkTicketInfoMapper extends UserDataScopeBaseMapper { - int countByMap(Map map); - - int qualifiedCount(Integer type,int year,int month); - - /** - * 获取安全检查项工作票项统计 - * @param startDate 开始时间 - * @param endDate 结束时间 - * @param dept 机构 - * @return - */ - SafeCheckStatisticVO getWorkTicketStatistic(@Param("startDate") String startDate, - @Param("endDate") String endDate, - @Param("dept") Long dept); - - /** - * 获取站点统计报表 - 工作票 - * @param startDate 开始时间 - * @param endDate 结束时间 - * @param dept 机构ID - * @return - */ - @UserDataAuth - List getWorkTicketReportStatistic(@Param("startDate") String startDate, - @Param("endDate") String endDate, - @Param("deptIdList") List dept); + int countByMap(Map map); + + int qualifiedCount(Integer type, int year, int month); + + /** + * 获取安全检查项工作票项统计 + * + * @param startDate 开始时间 + * @param endDate 结束时间 + * @param dept 机构 + * @return + */ + SafeCheckStatisticVO getWorkTicketStatistic(@Param("startDate") String startDate, + @Param("endDate") String endDate, + @Param("dept") Long dept); + + /** + * 获取站点统计报表 - 工作票 + * + * @param startDate 开始时间 + * @param endDate 结束时间 + * @param dept 机构ID + * @return + */ + @UserDataAuth + List getWorkTicketReportStatistic(@Param("startDate") String startDate, + @Param("endDate") String endDate, + @Param("deptIdList") List dept); + + + /** + * 分页查询 + * + * @param pageEntity + * @param queryWrapper + * @return + */ + Page selectPages(Page pageEntity, + @Param(Constants.WRAPPER) QueryWrapper queryWrapper); } diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/mapper/xml/WorkTicketInfoMapper.xml b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/mapper/xml/WorkTicketInfoMapper.xml index 6c1ec1f..2daaf81 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/mapper/xml/WorkTicketInfoMapper.xml +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/mapper/xml/WorkTicketInfoMapper.xml @@ -79,4 +79,10 @@ + + diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketInfoServiceImpl.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketInfoServiceImpl.java index 60b5d45..f569ab3 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketInfoServiceImpl.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketInfoServiceImpl.java @@ -14,6 +14,8 @@ import com.hnac.hzims.operational.access.entity.OperAccessTaskEntity; import com.hnac.hzims.operational.access.feign.IOperAccessTaskClient; import com.hnac.hzims.operational.maintenance.dto.OperMaintenanceTaskDTO; import com.hnac.hzims.operational.maintenance.feign.ITaskClient; +import com.hnac.hzims.ticket.allTicket.entity.TicketInfoEvaluateEntity; +import com.hnac.hzims.ticket.allTicket.service.TicketInfoEvaluateService; import com.hnac.hzims.ticket.areamonthly.vo.AreaMonthlyVo; import com.hnac.hzims.ticket.areamonthly.vo.StandardTicketWithAreaVo; import com.hnac.hzims.ticket.areamonthly.vo.StandardWorkVo; @@ -93,6 +95,7 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl queryWrapper = new QueryWrapper<>(); //开票来源 - queryWrapper.lambda().eq(Func.isNotEmpty(areaVo.getTaskType()), WorkTicketInfoEntity::getTaskType, + queryWrapper.eq(Func.isNotEmpty(areaVo.getTaskType()), "sti.task_type", areaVo.getTaskType()); //编号 - queryWrapper.lambda().like(Func.isNotEmpty(areaVo.getCode()), WorkTicketInfoEntity::getCode, areaVo.getCode()); + queryWrapper.like(Func.isNotEmpty(areaVo.getCode()), "sti.code", areaVo.getCode()); //状态 - queryWrapper.lambda().eq(Func.isNotEmpty(areaVo.getStatus()), WorkTicketInfoEntity::getStatus, + queryWrapper.eq(Func.isNotEmpty(areaVo.getStatus()), "sti.status", areaVo.getStatus()); //开始时间 - queryWrapper.lambda().lt(Func.isNotEmpty(areaVo.getStartTime()), WorkTicketInfoEntity::getCreateTime, + queryWrapper.lt(Func.isNotEmpty(areaVo.getStartTime()), "sti.create_time", areaVo.getStartTime()); //结束时间 - queryWrapper.lambda().le(Func.isNotEmpty(areaVo.getEndTime()), WorkTicketInfoEntity::getCreateTime, + queryWrapper.le(Func.isNotEmpty(areaVo.getEndTime()), "sti.create_time", areaVo.getEndTime()); - queryWrapper.eq("create_dept", areaVo.getAreaId()); - queryWrapper.eq(areaVo.getYearMonth() != null, "date_format(create_time,'%Y-%m')", + queryWrapper.eq("sti.create_dept", areaVo.getAreaId()); + queryWrapper.eq(areaVo.getYearMonth() != null, "date_format(sti.create_time,'%Y-%m')", areaVo.getYearMonth()); - Page workTicketInfoEntityPage = baseMapper.selectPage(pageEntity, queryWrapper); + //如果为1为合格 + queryWrapper.eq("tie.status",1); + Page workTicketInfoEntityPage = baseMapper.selectPages(pageEntity, queryWrapper); //数据转换 List standardWorkList = new ArrayList<>(); if (CollectionUtil.isNotEmpty(workTicketInfoEntityPage.getRecords())) { @@ -918,4 +923,21 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl bladePage = BladePage.of(page); return bladePage; } + + + /** + * 判断是否存在合格率 如果存在返回true 否则为false + * + * @param item + * @return + */ + private boolean isTicketPercentById(WorkTicketInfoEntity item) { + LambdaQueryWrapper ticketInfoEvaluateEntityLambdaQueryWrapper = new LambdaQueryWrapper<>(); + ticketInfoEvaluateEntityLambdaQueryWrapper.eq(TicketInfoEvaluateEntity::getTicketId, item.getId()); + ticketInfoEvaluateEntityLambdaQueryWrapper.eq(TicketInfoEvaluateEntity::getStatus, + TicketConstants.TicketQualifiedEnum.Qualified.getCode()); + // 查询合格评价 + int count = ticketInfoEvaluateService.count(ticketInfoEvaluateEntityLambdaQueryWrapper); + return count > 0; + } }