1.灿能云接口代码调整
This commit is contained in:
@@ -0,0 +1,108 @@
|
|||||||
|
package com.njcn.cloud.enums.app;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 指标编码
|
||||||
|
* @Author: wr
|
||||||
|
* @Date: 2023/11/3 13:57
|
||||||
|
*/
|
||||||
|
public enum RateCodeEnum{
|
||||||
|
FLICKET_ALLTIME("flickerAllTime", "Flicket_AllTime"),
|
||||||
|
FREQ_DEV_OVERTIME("freqDevOvertime", "频率偏差越限"),
|
||||||
|
VOLTAGE_DEV_OVERTIME("voltageDevOvertime", "电压偏差越限"),
|
||||||
|
UBALANCE_OVERTIME("ubalanceOvertime" ,"电压不平衡越限"),
|
||||||
|
FLICKER_OVERTIME("flickerOvertime", "闪变越限"),
|
||||||
|
UABERRANCE_OVERTIME("uaberranceOvertime", "电压谐波畸变率越限"),
|
||||||
|
UHARM_2_OVERTIME("uharm2Overtime", "2次电压谐波含有率越限"),
|
||||||
|
UHARM_3_OVERTIME("uharm3Overtime", "3次电压谐波含有率越限"),
|
||||||
|
UHARM_4_OVERTIME("uharm4Overtime", "4次电压谐波含有率越限"),
|
||||||
|
UHARM_5_OVERTIME("uharm5Overtime", "5次电压谐波含有率越限"),
|
||||||
|
UHARM_6_OVERTIME("uharm6Overtime", "6次电压谐波含有率越限"),
|
||||||
|
UHARM_7_OVERTIME("uharm7Overtime", "7次电压谐波含有率越限"),
|
||||||
|
UHARM_8_OVERTIME("uharm8Overtime", "8次电压谐波含有率越限"),
|
||||||
|
UHARM_9_OVERTIME("uharm9Overtime", "9次电压谐波含有率越限"),
|
||||||
|
UHARM_10_OVERTIME("uharm10Overtime", "10次电压谐波含有率越限"),
|
||||||
|
UHARM_11_OVERTIME("uharm11Overtime", "11次电压谐波含有率越限"),
|
||||||
|
UHARM_12_OVERTIME("uharm12Overtime", "12次电压谐波含有率越限"),
|
||||||
|
UHARM_13_OVERTIME("uharm13Overtime", "13次电压谐波含有率越限"),
|
||||||
|
UHARM_14_OVERTIME("uharm14Overtime", "14次电压谐波含有率越限"),
|
||||||
|
UHARM_15_OVERTIME("uharm15Overtime", "15次电压谐波含有率越限"),
|
||||||
|
UHARM_16_OVERTIME("uharm16Overtime", "16次电压谐波含有率越限"),
|
||||||
|
UHARM_17_OVERTIME("uharm17Overtime", "17次电压谐波含有率越限"),
|
||||||
|
UHARM_18_OVERTIME("uharm18Overtime", "18次电压谐波含有率越限"),
|
||||||
|
UHARM_19_OVERTIME("uharm19Overtime", "19次电压谐波含有率越限"),
|
||||||
|
UHARM_20_OVERTIME("uharm20Overtime", "20次电压谐波含有率越限"),
|
||||||
|
UHARM_21_OVERTIME("uharm21Overtime", "21次电压谐波含有率越限"),
|
||||||
|
UHARM_22_OVERTIME("uharm22Overtime", "22次电压谐波含有率越限"),
|
||||||
|
UHARM_23_OVERTIME("uharm23Overtime", "23次电压谐波含有率越限"),
|
||||||
|
UHARM_24_OVERTIME("uharm24Overtime", "24次电压谐波含有率越限"),
|
||||||
|
UHARM_25_OVERTIME("uharm25Overtime", "25次电压谐波含有率越限"),
|
||||||
|
IHARM_2_OVERTIME("iharm2Overtime", "2次电流谐波幅值越限"),
|
||||||
|
IHARM_3_OVERTIME("iharm3Overtime", "3次电流谐波幅值越限"),
|
||||||
|
IHARM_4_OVERTIME("iharm4Overtime", "4次电流谐波幅值越限"),
|
||||||
|
IHARM_5_OVERTIME("iharm5Overtime", "5次电流谐波幅值越限"),
|
||||||
|
IHARM_6_OVERTIME("iharm6Overtime", "6次电流谐波幅值越限"),
|
||||||
|
IHARM_7_OVERTIME("iharm7Overtime", "7次电流谐波幅值越限"),
|
||||||
|
IHARM_8_OVERTIME("iharm8Overtime", "8次电流谐波幅值越限"),
|
||||||
|
IHARM_9_OVERTIME("iharm9Overtime", "9次电流谐波幅值越限"),
|
||||||
|
IHARM_10_OVERTIME("iharm10Overtime", "10次电流谐波幅值越限"),
|
||||||
|
IHARM_11_OVERTIME("iharm11Overtime", "11次电流谐波幅值越限"),
|
||||||
|
IHARM_12_OVERTIME("iharm12Overtime", "12次电流谐波幅值越限"),
|
||||||
|
IHARM_13_OVERTIME("iharm13Overtime", "13次电流谐波幅值越限"),
|
||||||
|
IHARM_14_OVERTIME("iharm14Overtime", "14次电流谐波幅值越限"),
|
||||||
|
IHARM_15_OVERTIME("iharm15Overtime", "15次电流谐波幅值越限"),
|
||||||
|
IHARM_16_OVERTIME("iharm16Overtime", "16次电流谐波幅值越限"),
|
||||||
|
IHARM_17_OVERTIME("iharm17Overtime", "17次电流谐波幅值越限"),
|
||||||
|
IHARM_18_OVERTIME("iharm18Overtime", "18次电流谐波幅值越限"),
|
||||||
|
IHARM_19_OVERTIME("iharm19Overtime", "19次电流谐波幅值越限"),
|
||||||
|
IHARM_20_OVERTIME("iharm20Overtime", "20次电流谐波幅值越限"),
|
||||||
|
IHARM_21_OVERTIME("iharm21Overtime", "21次电流谐波幅值越限"),
|
||||||
|
IHARM_22_OVERTIME("iharm22Overtime", "22次电流谐波幅值越限"),
|
||||||
|
IHARM_23_OVERTIME("iharm23Overtime", "23次电流谐波幅值越限"),
|
||||||
|
IHARM_24_OVERTIME("iharm24Overtime", "24次电流谐波幅值越限"),
|
||||||
|
IHARM_25_OVERTIME("iharm25Overtime", "25次电流谐波幅值越限");
|
||||||
|
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
RateCodeEnum(String code, String type){
|
||||||
|
this.code = code;
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCode(String code) {
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getMsgByCode(String code){
|
||||||
|
for (RateCodeEnum typeCodeEnum : RateCodeEnum.values()) {
|
||||||
|
if (typeCodeEnum.code==code) {
|
||||||
|
return typeCodeEnum.type;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getCodeByMsg(String type){
|
||||||
|
for (RateCodeEnum typeCodeEnum : RateCodeEnum.values()) {
|
||||||
|
if (typeCodeEnum.type.equals(type)) {
|
||||||
|
return typeCodeEnum.code;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,203 @@
|
|||||||
|
package com.njcn.cloud.pojo.dto;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.github.jeffreyning.mybatisplus.anno.MppMultiId;
|
||||||
|
import com.njcn.db.bo.BaseEntity;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 统计消息
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author wr
|
||||||
|
* @since 2024-01-03
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@TableName("app_statistics")
|
||||||
|
public class AppStatistics extends BaseEntity {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 监测点id
|
||||||
|
*/
|
||||||
|
@MppMultiId("Line_Index")
|
||||||
|
private String lineIndex;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 统计时间
|
||||||
|
*/
|
||||||
|
@MppMultiId("Time_Id")
|
||||||
|
private LocalDateTime timeId;
|
||||||
|
|
||||||
|
@TableField("Event_Count")
|
||||||
|
private Boolean eventCount;
|
||||||
|
|
||||||
|
@TableField("Freq_Dev_Rate")
|
||||||
|
private Float freqDevRate;
|
||||||
|
|
||||||
|
@TableField("Voltage_Dev_Rate")
|
||||||
|
private Float voltageDevRate;
|
||||||
|
|
||||||
|
@TableField("Ubalance_Rate")
|
||||||
|
private Float ubalanceRate;
|
||||||
|
|
||||||
|
@TableField("FLICKER_Rate")
|
||||||
|
private Float flickerRate;
|
||||||
|
|
||||||
|
@TableField("UABERRANCE_Rate")
|
||||||
|
private Float uaberranceRate;
|
||||||
|
|
||||||
|
@TableField("Uharm_2_Rate")
|
||||||
|
private Float uharm2Rate;
|
||||||
|
|
||||||
|
@TableField("Uharm_3_Rate")
|
||||||
|
private Float uharm3Rate;
|
||||||
|
|
||||||
|
@TableField("Uharm_4_Rate")
|
||||||
|
private Float uharm4Rate;
|
||||||
|
|
||||||
|
@TableField("Uharm_5_Rate")
|
||||||
|
private Float uharm5Rate;
|
||||||
|
|
||||||
|
@TableField("Uharm_6_Rate")
|
||||||
|
private Float uharm6Rate;
|
||||||
|
|
||||||
|
@TableField("Uharm_7_Rate")
|
||||||
|
private Float uharm7Rate;
|
||||||
|
|
||||||
|
@TableField("Uharm_8_Rate")
|
||||||
|
private Float uharm8Rate;
|
||||||
|
|
||||||
|
@TableField("Uharm_9_Rate")
|
||||||
|
private Float uharm9Rate;
|
||||||
|
|
||||||
|
@TableField("Uharm_10_Rate")
|
||||||
|
private Float uharm10Rate;
|
||||||
|
|
||||||
|
@TableField("Uharm_11_Rate")
|
||||||
|
private Float uharm11Rate;
|
||||||
|
|
||||||
|
@TableField("Uharm_12_Rate")
|
||||||
|
private Float uharm12Rate;
|
||||||
|
|
||||||
|
@TableField("Uharm_13_Rate")
|
||||||
|
private Float uharm13Rate;
|
||||||
|
|
||||||
|
@TableField("Uharm_14_Rate")
|
||||||
|
private Float uharm14Rate;
|
||||||
|
|
||||||
|
@TableField("Uharm_15_Rate")
|
||||||
|
private Float uharm15Rate;
|
||||||
|
|
||||||
|
@TableField("Uharm_16_Rate")
|
||||||
|
private Float uharm16Rate;
|
||||||
|
|
||||||
|
@TableField("Uharm_17_Rate")
|
||||||
|
private Float uharm17Rate;
|
||||||
|
|
||||||
|
@TableField("Uharm_18_Rate")
|
||||||
|
private Float uharm18Rate;
|
||||||
|
|
||||||
|
@TableField("Uharm_19_Rate")
|
||||||
|
private Float uharm19Rate;
|
||||||
|
|
||||||
|
@TableField("Uharm_20_Rate")
|
||||||
|
private Float uharm20Rate;
|
||||||
|
|
||||||
|
@TableField("Uharm_21_Rate")
|
||||||
|
private Float uharm21Rate;
|
||||||
|
|
||||||
|
@TableField("Uharm_22_Rate")
|
||||||
|
private Float uharm22Rate;
|
||||||
|
|
||||||
|
@TableField("Uharm_23_Rate")
|
||||||
|
private Float uharm23Rate;
|
||||||
|
|
||||||
|
@TableField("Uharm_24_Rate")
|
||||||
|
private Float uharm24Rate;
|
||||||
|
|
||||||
|
@TableField("Uharm_25_Rate")
|
||||||
|
private Float uharm25Rate;
|
||||||
|
|
||||||
|
@TableField("Iharm_2_Rate")
|
||||||
|
private Float iharm2Rate;
|
||||||
|
|
||||||
|
@TableField("Iharm_3_Rate")
|
||||||
|
private Float iharm3Rate;
|
||||||
|
|
||||||
|
@TableField("Iharm_4_Rate")
|
||||||
|
private Float iharm4Rate;
|
||||||
|
|
||||||
|
@TableField("Iharm_5_Rate")
|
||||||
|
private Float iharm5Rate;
|
||||||
|
|
||||||
|
@TableField("Iharm_6_Rate")
|
||||||
|
private Float iharm6Rate;
|
||||||
|
|
||||||
|
@TableField("Iharm_7_Rate")
|
||||||
|
private Float iharm7Rate;
|
||||||
|
|
||||||
|
@TableField("Iharm_8_Rate")
|
||||||
|
private Float iharm8Rate;
|
||||||
|
|
||||||
|
@TableField("Iharm_9_Rate")
|
||||||
|
private Float iharm9Rate;
|
||||||
|
|
||||||
|
@TableField("Iharm_10_Rate")
|
||||||
|
private Float iharm10Rate;
|
||||||
|
|
||||||
|
@TableField("Iharm_11_Rate")
|
||||||
|
private Float iharm11Rate;
|
||||||
|
|
||||||
|
@TableField("Iharm_12_Rate")
|
||||||
|
private Float iharm12Rate;
|
||||||
|
|
||||||
|
@TableField("Iharm_13_Rate")
|
||||||
|
private Float iharm13Rate;
|
||||||
|
|
||||||
|
@TableField("Iharm_14_Rate")
|
||||||
|
private Float iharm14Rate;
|
||||||
|
|
||||||
|
@TableField("Iharm_15_Rate")
|
||||||
|
private Float iharm15Rate;
|
||||||
|
|
||||||
|
@TableField("Iharm_16_Rate")
|
||||||
|
private Float iharm16Rate;
|
||||||
|
|
||||||
|
@TableField("Iharm_17_Rate")
|
||||||
|
private Float iharm17Rate;
|
||||||
|
|
||||||
|
@TableField("Iharm_18_Rate")
|
||||||
|
private Float iharm18Rate;
|
||||||
|
|
||||||
|
@TableField("Iharm_19_Rate")
|
||||||
|
private Float iharm19Rate;
|
||||||
|
|
||||||
|
@TableField("Iharm_20_Rate")
|
||||||
|
private Float iharm20Rate;
|
||||||
|
|
||||||
|
@TableField("Iharm_21_Rate")
|
||||||
|
private Float iharm21Rate;
|
||||||
|
|
||||||
|
@TableField("Iharm_22_Rate")
|
||||||
|
private Float iharm22Rate;
|
||||||
|
|
||||||
|
@TableField("Iharm_23_Rate")
|
||||||
|
private Float iharm23Rate;
|
||||||
|
|
||||||
|
@TableField("Iharm_24_Rate")
|
||||||
|
private Float iharm24Rate;
|
||||||
|
|
||||||
|
@TableField("Iharm_25_Rate")
|
||||||
|
private Float iharm25Rate;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package com.njcn.cloud.pojo.param;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author wr
|
||||||
|
* @description
|
||||||
|
* @date 2024/1/3 15:43
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class AppParam {
|
||||||
|
|
||||||
|
@ApiModelProperty("监测点ID")
|
||||||
|
private String lineIndex;
|
||||||
|
|
||||||
|
@ApiModelProperty("当前页")
|
||||||
|
private Integer page;
|
||||||
|
|
||||||
|
@ApiModelProperty("每页数量")
|
||||||
|
private Integer num;
|
||||||
|
|
||||||
|
@ApiModelProperty("查询的开始时间")
|
||||||
|
private String startTime;
|
||||||
|
|
||||||
|
@ApiModelProperty("查询的结束时间")
|
||||||
|
private String endTime;
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package com.njcn.cloud.pojo.param;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author wr
|
||||||
|
* @description
|
||||||
|
* @date 2023/12/21 15:27
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class AppReportParam extends AppParam {
|
||||||
|
|
||||||
|
@ApiModelProperty("用户ID")
|
||||||
|
private String userId;
|
||||||
|
|
||||||
|
@ApiModelProperty("系统类型,1-暂态,2-稳态")
|
||||||
|
private Integer systemType;
|
||||||
|
|
||||||
|
@ApiModelProperty("报告类型,1-周报,2-月报,3-季报,4-年报,5-自定义报告")
|
||||||
|
private Integer reportType;
|
||||||
|
|
||||||
|
@ApiModelProperty("年份")
|
||||||
|
private Integer year;
|
||||||
|
|
||||||
|
@ApiModelProperty("季度")
|
||||||
|
private Integer quarter;
|
||||||
|
}
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
package com.njcn.cloud.pojo.vo;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author wr
|
||||||
|
* @description
|
||||||
|
* @date 2023/12/21 15:33
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ReportVO {
|
||||||
|
|
||||||
|
@ApiModelProperty("报告表Guid")
|
||||||
|
private String reportIndex;
|
||||||
|
|
||||||
|
@ApiModelProperty("报告名称")
|
||||||
|
private String reportName;
|
||||||
|
|
||||||
|
@ApiModelProperty("(关联Pq_Line的Line_Index)")
|
||||||
|
private String lineIndex;
|
||||||
|
|
||||||
|
@ApiModelProperty("(关联app_user表User_Index)自定义报表时填值")
|
||||||
|
private String userIndex;
|
||||||
|
|
||||||
|
@ApiModelProperty("报告生成时间")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
@ApiModelProperty("报告内容的起始时间")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime startTime;
|
||||||
|
|
||||||
|
@ApiModelProperty("报告内容的结束时间")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime endTime;
|
||||||
|
|
||||||
|
@ApiModelProperty("系统类型(1-暂态,2-稳态)")
|
||||||
|
private Integer systemType;
|
||||||
|
|
||||||
|
@ApiModelProperty("报告类型(1-周报,2-月报,5-自定义)")
|
||||||
|
private Integer reportType;
|
||||||
|
|
||||||
|
@ApiModelProperty("报告的资源路径")
|
||||||
|
private String reportPath;
|
||||||
|
|
||||||
|
@ApiModelProperty("报告状态(1-成功,2-失败,3-待审核,4-删除)")
|
||||||
|
private Integer state;
|
||||||
|
|
||||||
|
@ApiModelProperty("记录报告生成失败次数")
|
||||||
|
private Integer errorCount;
|
||||||
|
|
||||||
|
@ApiModelProperty("暂态报告部门guid")
|
||||||
|
private String deptsIndex;
|
||||||
|
|
||||||
|
@ApiModelProperty("暂态发生的次数")
|
||||||
|
private Integer total;
|
||||||
|
|
||||||
|
@ApiModelProperty("测量间隔(1-10分钟)")
|
||||||
|
private Integer tinterval;
|
||||||
|
|
||||||
|
@ApiModelProperty("监测点名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@ApiModelProperty("稳态系统越限统计")
|
||||||
|
private List<String> listResult;
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package com.njcn.cloud.pojo.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author gbl
|
||||||
|
* @description:统计数据
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class StatisticsData {
|
||||||
|
private String lineName;
|
||||||
|
private Long time;
|
||||||
|
private String eventDescribe;
|
||||||
|
private String steadyDescribe;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package com.njcn.cloud.pojo.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author gbl
|
||||||
|
* @description:统计数据详细信息
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class StatisticsDetail {
|
||||||
|
private String name;
|
||||||
|
private String steadyInfo;
|
||||||
|
private List<StatisticsEvent> eventInfo;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package com.njcn.cloud.pojo.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author gbl
|
||||||
|
* @description:统计数据暂降信息
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class StatisticsEvent {
|
||||||
|
public String describe;
|
||||||
|
public String eventDetail_index;
|
||||||
|
};
|
||||||
@@ -1,8 +1,6 @@
|
|||||||
package com.njcn.cloud.controller.RealTimeInfo;
|
package com.njcn.cloud.controller.RealTimeInfo;
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import com.njcn.cloud.service.RealTimeInfoService;
|
||||||
import com.njcn.cloud.enums.app.UserCodeEnum;
|
|
||||||
import com.njcn.cloud.service.user.RealTimeInfoService;
|
|
||||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.common.utils.HttpResultUtil;
|
import com.njcn.common.utils.HttpResultUtil;
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ import com.njcn.cloud.pojo.dto.AppDevMsg;
|
|||||||
import com.njcn.cloud.pojo.dto.AppEventMsg;
|
import com.njcn.cloud.pojo.dto.AppEventMsg;
|
||||||
import com.njcn.cloud.pojo.dto.AppSteadyMsg;
|
import com.njcn.cloud.pojo.dto.AppSteadyMsg;
|
||||||
import com.njcn.cloud.pojo.vo.MsgInfo;
|
import com.njcn.cloud.pojo.vo.MsgInfo;
|
||||||
import com.njcn.cloud.service.user.IAppDevMsgService;
|
import com.njcn.cloud.service.IAppDevMsgService;
|
||||||
import com.njcn.cloud.service.user.IAppEventMsgService;
|
import com.njcn.cloud.service.IAppEventMsgService;
|
||||||
import com.njcn.cloud.service.user.IAppSteadyMsgService;
|
import com.njcn.cloud.service.IAppSteadyMsgService;
|
||||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.common.utils.HttpResultUtil;
|
import com.njcn.common.utils.HttpResultUtil;
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
package com.njcn.cloud.controller.information;
|
package com.njcn.cloud.controller.information;
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import com.njcn.cloud.enums.app.EventMsgCodeEnum;
|
import com.njcn.cloud.enums.app.EventMsgCodeEnum;
|
||||||
import com.njcn.cloud.pojo.vo.DevComTJ;
|
import com.njcn.cloud.pojo.vo.DevComTJ;
|
||||||
import com.njcn.cloud.pojo.vo.DevMsgDetailInfo;
|
import com.njcn.cloud.pojo.vo.DevMsgDetailInfo;
|
||||||
import com.njcn.cloud.service.user.IAppDevMsgService;
|
import com.njcn.cloud.service.IAppDevMsgService;
|
||||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
|
|||||||
@@ -1,14 +1,13 @@
|
|||||||
package com.njcn.cloud.controller.information;
|
package com.njcn.cloud.controller.information;
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import com.njcn.cloud.enums.app.EventMsgCodeEnum;
|
import com.njcn.cloud.enums.app.EventMsgCodeEnum;
|
||||||
import com.njcn.cloud.pojo.vo.EventEigDetailVO;
|
import com.njcn.cloud.pojo.vo.EventEigDetailVO;
|
||||||
import com.njcn.cloud.pojo.vo.EventInfoDetailVO;
|
import com.njcn.cloud.pojo.vo.EventInfoDetailVO;
|
||||||
import com.njcn.cloud.pojo.vo.EventMsgDetailVO;
|
import com.njcn.cloud.pojo.vo.EventMsgDetailVO;
|
||||||
import com.njcn.cloud.pojo.vo.EventWaveDetailVO;
|
import com.njcn.cloud.pojo.vo.EventWaveDetailVO;
|
||||||
import com.njcn.cloud.service.user.IAppEventInfoService;
|
import com.njcn.cloud.service.IAppEventInfoService;
|
||||||
import com.njcn.cloud.service.user.IAppEventMsgService;
|
import com.njcn.cloud.service.IAppEventMsgService;
|
||||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import com.njcn.cloud.pojo.dto.AppSteadyUrl;
|
|||||||
import com.njcn.cloud.pojo.vo.AppSteadyMsgVO;
|
import com.njcn.cloud.pojo.vo.AppSteadyMsgVO;
|
||||||
import com.njcn.cloud.pojo.vo.SteadyMsgDetailVO;
|
import com.njcn.cloud.pojo.vo.SteadyMsgDetailVO;
|
||||||
import com.njcn.cloud.pojo.vo.SteadyTargetVO;
|
import com.njcn.cloud.pojo.vo.SteadyTargetVO;
|
||||||
import com.njcn.cloud.service.user.IAppSteadyMsgService;
|
import com.njcn.cloud.service.IAppSteadyMsgService;
|
||||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package com.njcn.cloud.controller.message;
|
|||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.njcn.cloud.enums.app.UserCodeEnum;
|
import com.njcn.cloud.enums.app.UserCodeEnum;
|
||||||
import com.njcn.cloud.service.user.MsgService;
|
import com.njcn.cloud.service.MsgService;
|
||||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
|
|||||||
@@ -1,9 +1,14 @@
|
|||||||
package com.njcn.cloud.controller.report;
|
package com.njcn.cloud.controller.report;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateTime;
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.njcn.cloud.enums.app.EventMsgCodeEnum;
|
import com.njcn.cloud.enums.app.EventMsgCodeEnum;
|
||||||
import com.njcn.cloud.pojo.dto.AppEventInfo;
|
import com.njcn.cloud.pojo.dto.AppEventInfo;
|
||||||
import com.njcn.cloud.service.user.IAppReportService;
|
import com.njcn.cloud.pojo.param.AppReportParam;
|
||||||
|
import com.njcn.cloud.pojo.vo.ReportVO;
|
||||||
|
import com.njcn.cloud.service.IAppReportService;
|
||||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
@@ -14,10 +19,9 @@ import io.swagger.annotations.ApiImplicitParam;
|
|||||||
import io.swagger.annotations.ApiImplicitParams;
|
import io.swagger.annotations.ApiImplicitParams;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import java.text.SimpleDateFormat;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@@ -27,6 +31,40 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
public class ShiningReportController extends BaseController {
|
public class ShiningReportController extends BaseController {
|
||||||
private final IAppReportService shiningReportService;
|
private final IAppReportService shiningReportService;
|
||||||
|
|
||||||
|
@PostMapping("/reportList")
|
||||||
|
@ApiOperation(value = "获取报告入口", notes = "获取报告列表")
|
||||||
|
public HttpResult<Page> reportList(@RequestBody AppReportParam param) {
|
||||||
|
String methodDescribe = getMethodDescribe("reportList");
|
||||||
|
/********************************************************************************
|
||||||
|
默认:
|
||||||
|
月报,查前三个月;周报,查当前月;所有监测点
|
||||||
|
自定义:
|
||||||
|
没有监测点,查询符合条件所有监测点信息
|
||||||
|
没有时间按默认的时间段查询
|
||||||
|
开始时间或者结束时间落在报告起止时间内的都列举出来
|
||||||
|
*******************************************************************************/
|
||||||
|
Page<ReportVO> list = shiningReportService.reportList(param);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/customReport")
|
||||||
|
@ApiOperation(value = "自定义时间报告申请入口", notes = "自定义报告申请")
|
||||||
|
public HttpResult<Integer> customReport(@RequestBody AppReportParam param) {
|
||||||
|
String methodDescribe = getMethodDescribe("customReport");
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
DateTime startTime = DateUtil.parse(param.getStartTime());
|
||||||
|
DateTime endTime = DateUtil.parse(param.getEndTime());
|
||||||
|
if (param.getQuarter() != null) {
|
||||||
|
param.setStartTime(sdf.format(DateUtil.beginOfQuarter(startTime)));
|
||||||
|
param.setEndTime(sdf.format(DateUtil.endOfQuarter(endTime)));
|
||||||
|
} else {
|
||||||
|
param.setStartTime(sdf.format(DateUtil.beginOfYear(startTime)));
|
||||||
|
param.setEndTime(sdf.format(DateUtil.endOfQuarter(endTime)));
|
||||||
|
}
|
||||||
|
int i = shiningReportService.customReport(param);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, i, methodDescribe);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@PostMapping("/eventDetailReportApply")
|
@PostMapping("/eventDetailReportApply")
|
||||||
@ApiImplicitParams({@ApiImplicitParam(name = "userId", value = "用户ID", required = true, paramType = "query")
|
@ApiImplicitParams({@ApiImplicitParam(name = "userId", value = "用户ID", required = true, paramType = "query")
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package com.njcn.cloud.controller.statistics;
|
||||||
|
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import com.njcn.web.controller.BaseController;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 统计消息 前端控制器
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author wr
|
||||||
|
* @since 2024-01-03
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/appStatistics")
|
||||||
|
public class StatisticsController extends BaseController {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@@ -10,7 +10,10 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||||||
import com.njcn.cloud.pojo.dto.AppDevMsg;
|
import com.njcn.cloud.pojo.dto.AppDevMsg;
|
||||||
import com.njcn.cloud.pojo.dto.AppSteadyAss;
|
import com.njcn.cloud.pojo.dto.AppSteadyAss;
|
||||||
import com.njcn.cloud.pojo.dto.AppSteadyUrl;
|
import com.njcn.cloud.pojo.dto.AppSteadyUrl;
|
||||||
import com.njcn.cloud.service.user.*;
|
import com.njcn.cloud.service.IAppDevMsgService;
|
||||||
|
import com.njcn.cloud.service.IAppSteadyAssService;
|
||||||
|
import com.njcn.cloud.service.IAppSteadyUrlService;
|
||||||
|
import com.njcn.cloud.service.MsgService;
|
||||||
import com.njcn.device.pq.api.GeneralDeviceInfoClient;
|
import com.njcn.device.pq.api.GeneralDeviceInfoClient;
|
||||||
import com.njcn.device.pq.pojo.param.OnlineRateParam;
|
import com.njcn.device.pq.pojo.param.OnlineRateParam;
|
||||||
import com.njcn.device.pq.pojo.po.TopMsgPO;
|
import com.njcn.device.pq.pojo.po.TopMsgPO;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package com.njcn.cloud.controller.user;
|
|||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.njcn.cloud.enums.app.UserCodeEnum;
|
import com.njcn.cloud.enums.app.UserCodeEnum;
|
||||||
import com.njcn.cloud.pojo.vo.UserVO;
|
import com.njcn.cloud.pojo.vo.UserVO;
|
||||||
import com.njcn.cloud.service.user.IAppUserService;
|
import com.njcn.cloud.service.IAppUserService;
|
||||||
import com.njcn.cloud.utils.AESUtil;
|
import com.njcn.cloud.utils.AESUtil;
|
||||||
import com.njcn.cloud.utils.RedisDB;
|
import com.njcn.cloud.utils.RedisDB;
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.njcn.cloud.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.njcn.cloud.pojo.dto.AppStatistics;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 统计消息 Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author wr
|
||||||
|
* @since 2024-01-03
|
||||||
|
*/
|
||||||
|
public interface AppStatisticsMapper extends BaseMapper<AppStatistics> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.njcn.cloud.mapper.AppStatisticsMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.njcn.cloud.service.user;
|
package com.njcn.cloud.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.njcn.cloud.service.user;
|
package com.njcn.cloud.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.njcn.cloud.pojo.dto.AppEventInfo;
|
import com.njcn.cloud.pojo.dto.AppEventInfo;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.njcn.cloud.service.user;
|
package com.njcn.cloud.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.njcn.cloud.service.user;
|
package com.njcn.cloud.service;
|
||||||
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
package com.njcn.cloud.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.njcn.cloud.pojo.dto.AppEventInfo;
|
||||||
|
import com.njcn.cloud.pojo.dto.AppReport;
|
||||||
|
import com.njcn.cloud.pojo.param.AppReportParam;
|
||||||
|
import com.njcn.cloud.pojo.vo.ReportVO;
|
||||||
|
|
||||||
|
import javax.servlet.ServletException;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 报告信息 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author wr
|
||||||
|
* @since 2023-11-02
|
||||||
|
*/
|
||||||
|
public interface IAppReportService extends IService<AppReport> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param userId
|
||||||
|
* @param eventDetailIndex
|
||||||
|
* @Description: 报告申请
|
||||||
|
* @return: int
|
||||||
|
* @Author: wr
|
||||||
|
* @Date: 2023/11/2 14:38
|
||||||
|
*/
|
||||||
|
String eventDetailReportApply(String userId, String eventDetailIndex) throws Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param userId
|
||||||
|
* @param eventDetailIndex
|
||||||
|
* @Description: 报告下载入口
|
||||||
|
* @return: com.njcn.cloud.pojo.dto.AppEventInfo
|
||||||
|
* @Author: wr
|
||||||
|
* @Date: 2023/11/3 8:53
|
||||||
|
*/
|
||||||
|
AppEventInfo getDownLoadPath(String userId, String eventDetailIndex);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param param
|
||||||
|
* @Description: 获取报告列表
|
||||||
|
* @return: com.baomidou.mybatisplus.extension.plugins.pagination.Page<com.njcn.cloud.pojo.vo.ReportVO>
|
||||||
|
* @Author: wr
|
||||||
|
* @Date: 2023/12/21 15:34
|
||||||
|
*/
|
||||||
|
Page<ReportVO> reportList(AppReportParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param param
|
||||||
|
* @Description: 生成自定义报告
|
||||||
|
* @return: int
|
||||||
|
* @Author: wr
|
||||||
|
* @Date: 2023/12/22 11:08
|
||||||
|
*/
|
||||||
|
int customReport(AppReportParam param);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.njcn.cloud.service.user;
|
package com.njcn.cloud.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.njcn.cloud.pojo.dto.AppSendMsg;
|
import com.njcn.cloud.pojo.dto.AppSendMsg;
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package com.njcn.cloud.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.njcn.cloud.pojo.dto.AppStatistics;
|
||||||
|
import com.njcn.cloud.pojo.vo.StatisticsData;
|
||||||
|
import com.njcn.cloud.pojo.vo.StatisticsDetail;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 统计消息 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author wr
|
||||||
|
* @since 2024-01-03
|
||||||
|
*/
|
||||||
|
public interface IAppStatisticsService extends IService<AppStatistics> {
|
||||||
|
|
||||||
|
List<StatisticsData> queryData(String lineIndex, String startTime, String endTime, int page, int num);
|
||||||
|
|
||||||
|
StatisticsDetail queryDetail(String lineIndex, String timeID);
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.njcn.cloud.service.user;
|
package com.njcn.cloud.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.njcn.cloud.pojo.dto.AppSteadyAss;
|
import com.njcn.cloud.pojo.dto.AppSteadyAss;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.njcn.cloud.service.user;
|
package com.njcn.cloud.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.njcn.cloud.pojo.dto.AppSteadyMsg;
|
import com.njcn.cloud.pojo.dto.AppSteadyMsg;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.njcn.cloud.service.user;
|
package com.njcn.cloud.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.njcn.cloud.pojo.dto.AppSteadyUrl;
|
import com.njcn.cloud.pojo.dto.AppSteadyUrl;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.njcn.cloud.service.user;
|
package com.njcn.cloud.service;
|
||||||
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.njcn.cloud.service.user;
|
package com.njcn.cloud.service;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.njcn.cloud.service.user;
|
package com.njcn.cloud.service;
|
||||||
|
|
||||||
|
|
||||||
import com.njcn.device.pq.pojo.vo.LineDetailVO;
|
import com.njcn.device.pq.pojo.vo.LineDetailVO;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.njcn.cloud.service.impl.user;
|
package com.njcn.cloud.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
@@ -12,9 +12,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||||||
import com.njcn.cloud.pojo.dto.AppDevMsg;
|
import com.njcn.cloud.pojo.dto.AppDevMsg;
|
||||||
import com.njcn.cloud.pojo.vo.DevComTJ;
|
import com.njcn.cloud.pojo.vo.DevComTJ;
|
||||||
import com.njcn.cloud.pojo.vo.DevMsgDetailInfo;
|
import com.njcn.cloud.pojo.vo.DevMsgDetailInfo;
|
||||||
import com.njcn.cloud.service.user.IAppDevMsgService;
|
import com.njcn.cloud.service.IAppDevMsgService;
|
||||||
import com.njcn.device.pq.api.GeneralDeviceInfoClient;
|
import com.njcn.device.pq.api.GeneralDeviceInfoClient;
|
||||||
import com.njcn.device.pq.api.LineFeignClient;
|
|
||||||
import com.njcn.device.pq.pojo.param.OnlineRateParam;
|
import com.njcn.device.pq.pojo.param.OnlineRateParam;
|
||||||
import com.njcn.device.pq.pojo.po.TopMsgPO;
|
import com.njcn.device.pq.pojo.po.TopMsgPO;
|
||||||
import com.njcn.device.pq.pojo.vo.DevDetail;
|
import com.njcn.device.pq.pojo.vo.DevDetail;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.njcn.cloud.service.impl.user;
|
package com.njcn.cloud.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
@@ -10,7 +10,7 @@ import com.njcn.cloud.pojo.dto.AppEventInfo;
|
|||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.njcn.cloud.pojo.vo.EventEigDetailVO;
|
import com.njcn.cloud.pojo.vo.EventEigDetailVO;
|
||||||
import com.njcn.cloud.pojo.vo.EventWaveDetailVO;
|
import com.njcn.cloud.pojo.vo.EventWaveDetailVO;
|
||||||
import com.njcn.cloud.service.user.IAppEventInfoService;
|
import com.njcn.cloud.service.IAppEventInfoService;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.common.utils.PubUtils;
|
import com.njcn.common.utils.PubUtils;
|
||||||
import com.njcn.device.pq.api.LineFeignClient;
|
import com.njcn.device.pq.api.LineFeignClient;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.njcn.cloud.service.impl.user;
|
package com.njcn.cloud.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
@@ -11,7 +11,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||||||
import com.njcn.cloud.pojo.dto.AppEventMsg;
|
import com.njcn.cloud.pojo.dto.AppEventMsg;
|
||||||
import com.njcn.cloud.pojo.vo.EventInfoDetailVO;
|
import com.njcn.cloud.pojo.vo.EventInfoDetailVO;
|
||||||
import com.njcn.cloud.pojo.vo.EventMsgDetailVO;
|
import com.njcn.cloud.pojo.vo.EventMsgDetailVO;
|
||||||
import com.njcn.cloud.service.user.IAppEventMsgService;
|
import com.njcn.cloud.service.IAppEventMsgService;
|
||||||
import com.njcn.cloud.utils.PubUtil;
|
import com.njcn.cloud.utils.PubUtil;
|
||||||
import com.njcn.device.pq.api.LineFeignClient;
|
import com.njcn.device.pq.api.LineFeignClient;
|
||||||
import com.njcn.device.pq.pojo.vo.LineDetailVO;
|
import com.njcn.device.pq.pojo.vo.LineDetailVO;
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
package com.njcn.cloud.service.impl.user;
|
package com.njcn.cloud.service.impl;
|
||||||
|
|
||||||
import com.njcn.cloud.mapper.AppInfoSetMapper;
|
import com.njcn.cloud.mapper.AppInfoSetMapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.njcn.cloud.pojo.dto.AppInfoSet;
|
import com.njcn.cloud.pojo.dto.AppInfoSet;
|
||||||
import com.njcn.cloud.service.user.IAppInfoSetService;
|
import com.njcn.cloud.service.IAppInfoSetService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -0,0 +1,468 @@
|
|||||||
|
package com.njcn.cloud.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.codec.Base64;
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.date.DatePattern;
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.njcn.cloud.enums.app.EventMsgCodeEnum;
|
||||||
|
import com.njcn.cloud.enums.app.RateCodeEnum;
|
||||||
|
import com.njcn.cloud.mapper.AppReportMapper;
|
||||||
|
import com.njcn.cloud.pojo.dto.AppEventInfo;
|
||||||
|
import com.njcn.cloud.pojo.dto.AppReport;
|
||||||
|
import com.njcn.cloud.pojo.param.AppReportParam;
|
||||||
|
import com.njcn.cloud.pojo.vo.EventEigDetailVO;
|
||||||
|
import com.njcn.cloud.pojo.vo.EventInfoDetailVO;
|
||||||
|
import com.njcn.cloud.pojo.vo.ReportVO;
|
||||||
|
import com.njcn.cloud.service.IAppEventInfoService;
|
||||||
|
import com.njcn.cloud.service.IAppReportService;
|
||||||
|
import com.njcn.cloud.utils.PubUtil;
|
||||||
|
import com.njcn.cloud.utils.WordUtil;
|
||||||
|
import com.njcn.common.pojo.dto.SimpleDTO;
|
||||||
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
|
import com.njcn.common.utils.FileUtil;
|
||||||
|
import com.njcn.device.pq.api.GeneralDeviceInfoClient;
|
||||||
|
import com.njcn.device.pq.api.LineFeignClient;
|
||||||
|
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
|
||||||
|
import com.njcn.device.pq.pojo.vo.LineDetailVO;
|
||||||
|
import com.njcn.event.api.EventDetailFeignClient;
|
||||||
|
import com.njcn.event.api.ReportFeignClient;
|
||||||
|
import com.njcn.event.file.component.WavePicComponent;
|
||||||
|
import com.njcn.event.file.pojo.bo.WaveDataDetail;
|
||||||
|
import com.njcn.event.file.pojo.dto.WaveDataDTO;
|
||||||
|
import com.njcn.event.file.utils.WaveUtil;
|
||||||
|
import com.njcn.event.pojo.param.EventCountParam;
|
||||||
|
import com.njcn.event.pojo.po.RmpEventDetailPO;
|
||||||
|
import com.njcn.harmonic.api.HarmDataFeignClient;
|
||||||
|
import com.njcn.harmonic.pojo.param.StatSubstationBizBaseParam;
|
||||||
|
import com.njcn.harmonic.pojo.po.day.RStatLimitRateDPO;
|
||||||
|
import com.njcn.oss.constant.OssPath;
|
||||||
|
import com.njcn.oss.utils.FileStorageUtil;
|
||||||
|
import com.njcn.system.pojo.enums.StatisticsEnum;
|
||||||
|
import com.njcn.user.api.DeptFeignClient;
|
||||||
|
import com.njcn.user.api.UserFeignClient;
|
||||||
|
import com.njcn.user.pojo.po.Dept;
|
||||||
|
import com.njcn.user.pojo.po.User;
|
||||||
|
|
||||||
|
import java.io.*;
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 报告信息 服务实现类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author wr
|
||||||
|
* @since 2023-11-02
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class AppReportServiceImpl extends ServiceImpl<AppReportMapper, AppReport> implements IAppReportService {
|
||||||
|
|
||||||
|
private final IAppEventInfoService appEventInfoService;
|
||||||
|
private final WavePicComponent wavePicComponent;
|
||||||
|
private final FileStorageUtil fileStorageUtil;
|
||||||
|
private final EventDetailFeignClient eventDetailFeignClient;
|
||||||
|
private final LineFeignClient lineFeignClient;
|
||||||
|
private final UserFeignClient userFeignClient;
|
||||||
|
private final GeneralDeviceInfoClient generalDeviceInfoClient;
|
||||||
|
private final HarmDataFeignClient harmDataFeignClient;
|
||||||
|
private final DeptFeignClient deptFeignClient;
|
||||||
|
private final ReportFeignClient reportFeignClient;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = {Exception.class})
|
||||||
|
public String eventDetailReportApply(String userId, String eventDetailIndex) {
|
||||||
|
AppEventInfo info = new AppEventInfo();
|
||||||
|
info.setEventdetailIndex(eventDetailIndex);
|
||||||
|
info.setEvaluate(0);
|
||||||
|
info.setUserIndex(userId);
|
||||||
|
info.setUpdateTime(LocalDateTime.now());
|
||||||
|
|
||||||
|
AppEventInfo one = appEventInfoService.getOne(new LambdaUpdateWrapper<AppEventInfo>()
|
||||||
|
.eq(AppEventInfo::getEventdetailIndex, eventDetailIndex)
|
||||||
|
.ne(AppEventInfo::getReportState, 4)
|
||||||
|
);
|
||||||
|
if (ObjectUtil.isNull(one) || one.getReportState() != 1) {
|
||||||
|
try {
|
||||||
|
Map<String, String> map = this.createEventDetailReport(eventDetailIndex, one);
|
||||||
|
if (map.containsKey("noData")) {
|
||||||
|
return map.get("noData");
|
||||||
|
}
|
||||||
|
info.setInstantwavePath(map.get("instantPath"));
|
||||||
|
info.setRmswavePath(map.get("rmsPath"));
|
||||||
|
info.setReportState(1);
|
||||||
|
info.setReportPath(map.get("reportPath"));
|
||||||
|
appEventInfoService.saveOrUpdate(info);
|
||||||
|
return "0";
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
info.setReportState(2);
|
||||||
|
appEventInfoService.saveOrUpdate(info);
|
||||||
|
return "1";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "0";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AppEventInfo getDownLoadPath(String userId, String eventDetailIndex) {
|
||||||
|
AppEventInfo one = appEventInfoService.getOne(new LambdaQueryWrapper<AppEventInfo>()
|
||||||
|
.eq(AppEventInfo::getUserIndex, userId)
|
||||||
|
.eq(AppEventInfo::getEventdetailIndex, eventDetailIndex)
|
||||||
|
);
|
||||||
|
if (ObjectUtil.isNull(one)) {
|
||||||
|
throw new BusinessException(EventMsgCodeEnum.EVENTDETAILREPORTDOWNLOAD_NOT_FAIL.getMsg());
|
||||||
|
}
|
||||||
|
if (one.getReportState() == 3) {
|
||||||
|
throw new BusinessException(EventMsgCodeEnum.EVENTDETAILREPORTDOWNLOAD_ERROR.getMsg());
|
||||||
|
}
|
||||||
|
return one;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Page<ReportVO> reportList(AppReportParam param) {
|
||||||
|
Page<ReportVO> page = new Page<>();
|
||||||
|
List<ReportVO> info = new ArrayList<>();
|
||||||
|
//先获取用户部门,在根据部门信息获取监测点信息
|
||||||
|
List<User> users = userFeignClient.getUserByIdList(Collections.singletonList(param.getUserId())).getData();
|
||||||
|
if (CollUtil.isNotEmpty(users)) {
|
||||||
|
User user = users.get(0);
|
||||||
|
//获取所有监测点id
|
||||||
|
List<String> lineIds = generalDeviceInfoClient.deptGetRunLine(user.getDeptId()).getData();
|
||||||
|
Page<AppReport> page1 = this.page(new Page<>(param.getPage(), param.getNum()), new LambdaQueryWrapper<AppReport>()
|
||||||
|
.in(param.getSystemType() == 2, AppReport::getLineIndex, lineIds)
|
||||||
|
.eq(param.getSystemType() == 1, AppReport::getDeptsIndex, user.getDeptId())
|
||||||
|
.eq(param.getSystemType() != null, AppReport::getSystemType, param.getSystemType())
|
||||||
|
.eq(param.getReportType() != null, AppReport::getReportType, param.getReportType())
|
||||||
|
.ne(AppReport::getState, 4)
|
||||||
|
.eq(AppReport::getUserIndex, param.getUserId())
|
||||||
|
.ge(StrUtil.isNotBlank(param.getStartTime()), AppReport::getStartTime, DateUtil.beginOfDay(DateUtil.parse(param.getStartTime())))
|
||||||
|
.le(StrUtil.isNotBlank(param.getEndTime()), AppReport::getStartTime, DateUtil.endOfDay(DateUtil.parse(param.getEndTime())))
|
||||||
|
.orderByDesc(AppReport::getUpdateTime)
|
||||||
|
);
|
||||||
|
//数据组装
|
||||||
|
BeanUtil.copyProperties(page1, page);
|
||||||
|
List<AppReport> records = page1.getRecords();
|
||||||
|
if (EventMsgCodeEnum.STEADY_TYPE.getCode() == param.getSystemType()) {
|
||||||
|
if (CollUtil.isNotEmpty(records)) {
|
||||||
|
rateAdd(param, info, records);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (EventMsgCodeEnum.TRANSIENT_TYPE.getCode() == param.getSystemType()) {
|
||||||
|
if (CollUtil.isNotEmpty(records)) {
|
||||||
|
Dept dept = deptFeignClient.getDeptById(user.getDeptId()).getData();
|
||||||
|
//获取分页报告监测点id
|
||||||
|
EventCountParam lineParam;
|
||||||
|
ReportVO vo;
|
||||||
|
for (AppReport record : records) {
|
||||||
|
lineParam = new EventCountParam();
|
||||||
|
lineParam.setIds(lineIds);
|
||||||
|
lineParam.setStartTime(LocalDateTimeUtil.format(record.getStartTime(), DatePattern.NORM_DATETIME_PATTERN));
|
||||||
|
lineParam.setEndTime(LocalDateTimeUtil.format(record.getEndTime(), DatePattern.NORM_DATETIME_PATTERN));
|
||||||
|
Integer count = eventDetailFeignClient.getEventDetailByLineCount(lineParam).getData();
|
||||||
|
vo = BeanUtil.copyProperties(record, ReportVO.class);
|
||||||
|
vo.setTotal(count);
|
||||||
|
vo.setListResult(new ArrayList<String>() {{
|
||||||
|
add("共发生" + count + "次暂降事件");
|
||||||
|
}});
|
||||||
|
vo.setName(dept.getName() + "报告");
|
||||||
|
info.add(vo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
page.setRecords(info);
|
||||||
|
return page;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int customReport(AppReportParam param) {
|
||||||
|
//查询报告是否存在
|
||||||
|
LambdaQueryWrapper<AppReport> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
lambdaQueryWrapper.eq(AppReport::getStartTime, param.getStartTime());
|
||||||
|
lambdaQueryWrapper.eq(AppReport::getEndTime, param.getEndTime());
|
||||||
|
lambdaQueryWrapper.eq(AppReport::getReportType, param.getReportType());
|
||||||
|
String name = getFileName(param.getLineIndex(), param.getStartTime(), param.getEndTime());
|
||||||
|
String deptId = "";
|
||||||
|
if (param.getSystemType() == 1) {
|
||||||
|
List<User> users = userFeignClient.getUserByIdList(Collections.singletonList(param.getUserId())).getData();
|
||||||
|
deptId = users.get(0).getDeptId();
|
||||||
|
lambdaQueryWrapper.eq(AppReport::getDeptsIndex, deptId);
|
||||||
|
name = getFileName(param.getUserId(), param.getStartTime(), param.getEndTime());
|
||||||
|
}
|
||||||
|
AppReport reportData = this.getOne(lambdaQueryWrapper);
|
||||||
|
String path = createReport(deptId, param.getSystemType(), param.getLineIndex(), param.getStartTime(), param.getEndTime());
|
||||||
|
// String path = "";
|
||||||
|
if (reportData == null) {
|
||||||
|
String userId = param.getReportType() == 5 ? param.getUserId() : "";
|
||||||
|
AppReport appReport = new AppReport();
|
||||||
|
appReport.setReportName(name);
|
||||||
|
appReport.setLineIndex(param.getLineIndex());
|
||||||
|
appReport.setUserIndex(userId);
|
||||||
|
appReport.setUpdateTime(LocalDateTime.now());
|
||||||
|
appReport.setStartTime(LocalDateTimeUtil.parse(param.getStartTime(), DatePattern.NORM_DATETIME_PATTERN));
|
||||||
|
appReport.setEndTime(LocalDateTimeUtil.parse(param.getEndTime(), DatePattern.NORM_DATETIME_PATTERN));
|
||||||
|
appReport.setSystemType(param.getSystemType());
|
||||||
|
appReport.setReportType(param.getReportType());
|
||||||
|
appReport.setReportPath(path);
|
||||||
|
appReport.setDeptsIndex(deptId);
|
||||||
|
if (StrUtil.isBlank(path)) {
|
||||||
|
appReport.setState(2);
|
||||||
|
appReport.setErrorCount(1);
|
||||||
|
} else {
|
||||||
|
appReport.setState(param.getReportType() == 5 ? 3 : 1);
|
||||||
|
appReport.setErrorCount(0);
|
||||||
|
}
|
||||||
|
this.save(appReport);
|
||||||
|
} else if (reportData.getState() == 2) {
|
||||||
|
if (reportData.getErrorCount() < 2) {
|
||||||
|
if (reportData.getUserIndex().equals(param.getUserId())) {
|
||||||
|
if (path.equals("")) {
|
||||||
|
this.update(new LambdaUpdateWrapper<AppReport>()
|
||||||
|
.set(AppReport::getUpdateTime, LocalDateTime.now())
|
||||||
|
.set(AppReport::getErrorCount, reportData.getErrorCount() + 1)
|
||||||
|
.set(AppReport::getState, reportData.getState())
|
||||||
|
.eq(AppReport::getReportIndex, reportData.getReportIndex())
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
this.update(new LambdaUpdateWrapper<AppReport>()
|
||||||
|
.set(AppReport::getUpdateTime, LocalDateTime.now())
|
||||||
|
.set(AppReport::getErrorCount, 0)
|
||||||
|
.set(AppReport::getState, param.getReportType() == 5 ? 3 : 1)
|
||||||
|
.set(AppReport::getReportPath, path)
|
||||||
|
.eq(AppReport::getReportIndex, reportData.getReportIndex())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
String userId = param.getReportType() == 5 ? param.getUserId() : "";
|
||||||
|
AppReport appReport = new AppReport();
|
||||||
|
appReport.setReportName(name);
|
||||||
|
appReport.setLineIndex(param.getLineIndex());
|
||||||
|
appReport.setUserIndex(userId);
|
||||||
|
appReport.setUpdateTime(LocalDateTime.now());
|
||||||
|
appReport.setStartTime(LocalDateTimeUtil.parse(param.getStartTime(), DatePattern.NORM_DATETIME_PATTERN));
|
||||||
|
appReport.setEndTime(LocalDateTimeUtil.parse(param.getEndTime(), DatePattern.NORM_DATETIME_PATTERN));
|
||||||
|
appReport.setSystemType(param.getSystemType());
|
||||||
|
appReport.setReportType(param.getReportType());
|
||||||
|
appReport.setReportPath(path);
|
||||||
|
appReport.setDeptsIndex(deptId);
|
||||||
|
if (StrUtil.isBlank(path)) {
|
||||||
|
appReport.setState(2);
|
||||||
|
appReport.setErrorCount(1);
|
||||||
|
} else {
|
||||||
|
appReport.setState(param.getReportType() == 5 ? 3 : 1);
|
||||||
|
appReport.setErrorCount(0);
|
||||||
|
}
|
||||||
|
this.save(appReport);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param deptId 部门id
|
||||||
|
* @param type 区分是稳态还暂态
|
||||||
|
* @param lineId 监测点ia
|
||||||
|
* @param startTime 开始时间
|
||||||
|
* @param endTime 结束时间
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private String createReport(String deptId, Integer type, String lineId, String startTime, String endTime) {
|
||||||
|
//稳态系统
|
||||||
|
if (type == 2) {
|
||||||
|
|
||||||
|
}
|
||||||
|
//暂态系统(周报)
|
||||||
|
if (type == 1) {
|
||||||
|
DeviceInfoParam.BusinessParam param = new DeviceInfoParam.BusinessParam();
|
||||||
|
param.setDeptIndex(deptId);
|
||||||
|
param.setSearchBeginTime(startTime.substring(0,10));
|
||||||
|
param.setSearchEndTime(endTime.substring(0,10));
|
||||||
|
param.setServerName("event-boot");
|
||||||
|
//统计类型
|
||||||
|
SimpleDTO simpleDTO = new SimpleDTO();
|
||||||
|
simpleDTO.setCode(String.valueOf(StatisticsEnum.POWER_NETWORK));
|
||||||
|
param.setStatisticalType(simpleDTO);
|
||||||
|
return reportFeignClient.appEventExport(param).getData();
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private String getFileName(String lineId, String startTime, String endTime) {
|
||||||
|
String start = startTime.substring(0, 10);
|
||||||
|
String end = endTime.substring(0, 10);
|
||||||
|
return lineId + "_" + start + "_" + end + ".xlsx";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 谐波数据组装
|
||||||
|
*
|
||||||
|
* @param param
|
||||||
|
* @param info
|
||||||
|
* @param records
|
||||||
|
*/
|
||||||
|
private void rateAdd(AppReportParam param, List<ReportVO> info, List<AppReport> records) {
|
||||||
|
//获取分页报告监测点id
|
||||||
|
List<String> lineReportIds = records.stream().map(AppReport::getLineIndex).distinct().collect(Collectors.toList());
|
||||||
|
StatSubstationBizBaseParam rateLine = new StatSubstationBizBaseParam();
|
||||||
|
rateLine.setIds(lineReportIds);
|
||||||
|
rateLine.setStartTime(param.getStartTime());
|
||||||
|
rateLine.setEndTime(param.getEndTime());
|
||||||
|
//获取越线信息
|
||||||
|
List<RStatLimitRateDPO> limitRates = harmDataFeignClient.getLinesRate(rateLine).getData();
|
||||||
|
Map<String, RStatLimitRateDPO> limitRateMap = limitRates.stream()
|
||||||
|
.collect(Collectors.toMap(RStatLimitRateDPO::getLineId, Function.identity()));
|
||||||
|
//获取监测点信息
|
||||||
|
List<LineDetailVO.Detail> lineDetails = lineFeignClient.getLineDetailByIds(lineReportIds).getData();
|
||||||
|
Map<String, LineDetailVO.Detail> lineDetailMap = lineDetails.stream()
|
||||||
|
.collect(Collectors.toMap(LineDetailVO.Detail::getLineId, Function.identity()));
|
||||||
|
ReportVO vo;
|
||||||
|
List<String> listResult;
|
||||||
|
for (AppReport record : records) {
|
||||||
|
vo = BeanUtil.copyProperties(record, ReportVO.class);
|
||||||
|
if (lineDetailMap.containsKey(record.getLineIndex())) {
|
||||||
|
vo.setName(lineDetailMap.get(record.getLineIndex()).getLineName());
|
||||||
|
vo.setTinterval(lineDetailMap.get(record.getLineIndex()).getTimeInterval());
|
||||||
|
}
|
||||||
|
listResult = new ArrayList<>();
|
||||||
|
if (limitRateMap.containsKey(record.getLineIndex())) {
|
||||||
|
RStatLimitRateDPO rStatLimitRateDPO = limitRateMap.get(record.getLineIndex());
|
||||||
|
vo.setListResult(RateList(listResult, rStatLimitRateDPO, vo.getTinterval()));
|
||||||
|
} else {
|
||||||
|
listResult.add("该监测点暂无指标越限");
|
||||||
|
vo.setListResult(listResult);
|
||||||
|
}
|
||||||
|
info.add(vo);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<String> RateList(List<String> info, RStatLimitRateDPO rateDPO, Integer timeInterval) {
|
||||||
|
//反射获取所有属性
|
||||||
|
Field[] declaredFields = rateDPO.getClass().getDeclaredFields();
|
||||||
|
String s;
|
||||||
|
for (Field item : declaredFields) {
|
||||||
|
item.setAccessible(true);
|
||||||
|
String name = item.getName(); // 获取对象属性名
|
||||||
|
try {
|
||||||
|
String codeByMsg = RateCodeEnum.getMsgByCode(name);
|
||||||
|
if (StrUtil.isNotBlank(codeByMsg)) {
|
||||||
|
Integer o = Integer.valueOf(item.get(rateDPO).toString());
|
||||||
|
if (codeByMsg.equals("闪变越限")) {
|
||||||
|
s = codeByMsg + o * 120 + "分钟";
|
||||||
|
info.add(s);
|
||||||
|
} else {
|
||||||
|
s = codeByMsg + o * timeInterval + "分钟";
|
||||||
|
info.add(s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (IllegalAccessException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param eventIndex
|
||||||
|
* @Description: 生成报告
|
||||||
|
* @return: java.lang.String
|
||||||
|
* @Author: wr
|
||||||
|
* @Date: 2023/11/2 14:44
|
||||||
|
*/
|
||||||
|
private Map<String, String> createEventDetailReport(String eventIndex, AppEventInfo appEventInfo) throws Exception {
|
||||||
|
Map<String, String> map = new HashMap<>();
|
||||||
|
WaveDataDTO waveData = appEventInfoService.analyseWave(eventIndex, 2);
|
||||||
|
|
||||||
|
if (waveData.getListWaveData().size() == 0) {
|
||||||
|
map.put("noData", "2");
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
//数据筛选,如果是双路电压的话,会存在2个波形数据
|
||||||
|
List<WaveDataDetail> waveDataDetails = WaveUtil.filterWaveData(waveData);
|
||||||
|
WordUtil wordUtil = new WordUtil();
|
||||||
|
//获取瞬时波形
|
||||||
|
String instantPath;
|
||||||
|
if (ObjectUtil.isNotNull(appEventInfo) && StrUtil.isNotBlank(appEventInfo.getInstantwavePath())) {
|
||||||
|
instantPath = appEventInfo.getInstantwavePath();
|
||||||
|
} else {
|
||||||
|
instantPath = wavePicComponent.generateImageShun(waveData, waveDataDetails);
|
||||||
|
}
|
||||||
|
InputStream instantStream = fileStorageUtil.getFileStream(instantPath);
|
||||||
|
String imageShun64 = Base64.encode(instantStream);
|
||||||
|
//获取rms波形
|
||||||
|
String rmsPath;
|
||||||
|
if (ObjectUtil.isNotNull(appEventInfo) && StrUtil.isNotBlank(appEventInfo.getRmswavePath())) {
|
||||||
|
rmsPath = appEventInfo.getRmswavePath();
|
||||||
|
} else {
|
||||||
|
rmsPath = wavePicComponent.generateImageRms(waveData, waveDataDetails);
|
||||||
|
|
||||||
|
}
|
||||||
|
InputStream rmsStream = fileStorageUtil.getFileStream(rmsPath);
|
||||||
|
String rmsShun64 = Base64.encode(rmsStream);
|
||||||
|
|
||||||
|
wordUtil.translate(imageShun64, rmsShun64);
|
||||||
|
List<EventEigDetailVO> eventDetailEigenvalue = new ArrayList<>();
|
||||||
|
List<String> tmpWaveTitle = waveData.getWaveTitle();
|
||||||
|
int picCounts = (tmpWaveTitle.size() - 1) / waveData.getIPhasic();
|
||||||
|
if (picCounts == 3) {
|
||||||
|
eventDetailEigenvalue = appEventInfoService.eventDetailEigenvalue(eventIndex).getList();
|
||||||
|
|
||||||
|
}
|
||||||
|
wordUtil.setEventDetailEigenvalue(eventDetailEigenvalue);
|
||||||
|
EventInfoDetailVO eventInfoList = new EventInfoDetailVO();
|
||||||
|
List<RmpEventDetailPO> eventDetails = eventDetailFeignClient.getEventDetailByIdsList(Arrays.asList(eventIndex)).getData();
|
||||||
|
List<String> linedIds = eventDetails.stream().map(RmpEventDetailPO::getLineId).distinct().collect(Collectors.toList());
|
||||||
|
List<LineDetailVO.Detail> lineDetail = lineFeignClient.getLineDetailByIds(linedIds).getData();
|
||||||
|
RmpEventDetailPO detail = eventDetails.get(0);
|
||||||
|
LineDetailVO.Detail line = lineDetail.get(0);
|
||||||
|
eventInfoList.setLineName(PubUtil.lineName(detail.getSagsource(), line.getLineName()));
|
||||||
|
eventInfoList.setGdName(line.getGdName());
|
||||||
|
eventInfoList.setBdzName(line.getSubName());
|
||||||
|
eventInfoList.setDevName(line.getDevName());
|
||||||
|
eventInfoList.setScale(line.getVoltageLevel());
|
||||||
|
eventInfoList.setIp(line.getIp());
|
||||||
|
eventInfoList.setEventDetailIndex(detail.getEventId());
|
||||||
|
eventInfoList.setTimeID(detail.getStartTime());
|
||||||
|
eventInfoList.setPersistTime(detail.getDuration());
|
||||||
|
eventInfoList.setMs(detail.getFirstMs());
|
||||||
|
eventInfoList.setEventValue(detail.getFeatureAmplitude());
|
||||||
|
wordUtil.setEventInfoList(eventInfoList);
|
||||||
|
wordUtil.createReport();
|
||||||
|
|
||||||
|
//临时缓冲区
|
||||||
|
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||||
|
//创建临时文件
|
||||||
|
wordUtil.getDocument().write(out);
|
||||||
|
byte[] bookByteAry = out.toByteArray();
|
||||||
|
InputStream in = new ByteArrayInputStream(bookByteAry);
|
||||||
|
String reportPath = fileStorageUtil.uploadStream(in, OssPath.RESPONSIBILITY_APP_REPORT,
|
||||||
|
FileUtil.generateFileName("docx")
|
||||||
|
);
|
||||||
|
map.put("instantPath", instantPath);
|
||||||
|
map.put("rmsPath", rmsPath);
|
||||||
|
map.put("reportPath", reportPath);
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
package com.njcn.cloud.service.impl.user;
|
package com.njcn.cloud.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.njcn.cloud.mapper.AppSendMsgMapper;
|
import com.njcn.cloud.mapper.AppSendMsgMapper;
|
||||||
import com.njcn.cloud.pojo.dto.AppSendMsg;
|
import com.njcn.cloud.pojo.dto.AppSendMsg;
|
||||||
import com.njcn.cloud.service.user.IAppSendMsgService;
|
import com.njcn.cloud.service.IAppSendMsgService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package com.njcn.cloud.service.impl;
|
||||||
|
|
||||||
|
import com.njcn.cloud.mapper.AppStatisticsMapper;
|
||||||
|
import com.njcn.cloud.pojo.dto.AppStatistics;
|
||||||
|
import com.njcn.cloud.pojo.vo.StatisticsData;
|
||||||
|
import com.njcn.cloud.pojo.vo.StatisticsDetail;
|
||||||
|
import com.njcn.cloud.service.IAppStatisticsService;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 统计消息 服务实现类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author wr
|
||||||
|
* @since 2024-01-03
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class AppStatisticsServiceImpl extends ServiceImpl<AppStatisticsMapper, AppStatistics> implements IAppStatisticsService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<StatisticsData> queryData(String lineIndex, String startTime, String endTime, int page, int num) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public StatisticsDetail queryDetail(String lineIndex, String timeID) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
package com.njcn.cloud.service.impl.user;
|
package com.njcn.cloud.service.impl;
|
||||||
|
|
||||||
import com.njcn.cloud.mapper.AppSteadyAssMapper;
|
import com.njcn.cloud.mapper.AppSteadyAssMapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.njcn.cloud.pojo.dto.AppSteadyAss;
|
import com.njcn.cloud.pojo.dto.AppSteadyAss;
|
||||||
import com.njcn.cloud.service.user.IAppSteadyAssService;
|
import com.njcn.cloud.service.IAppSteadyAssService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.njcn.cloud.service.impl.user;
|
package com.njcn.cloud.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.date.DatePattern;
|
import cn.hutool.core.date.DatePattern;
|
||||||
@@ -19,9 +19,9 @@ import com.njcn.cloud.pojo.vo.AppSteadyMsgVO;
|
|||||||
import com.njcn.cloud.pojo.vo.SteadyMsgDetailVO;
|
import com.njcn.cloud.pojo.vo.SteadyMsgDetailVO;
|
||||||
import com.njcn.cloud.pojo.vo.SteadyTargetVO;
|
import com.njcn.cloud.pojo.vo.SteadyTargetVO;
|
||||||
import com.njcn.cloud.pojo.vo.SteadyUrlData;
|
import com.njcn.cloud.pojo.vo.SteadyUrlData;
|
||||||
import com.njcn.cloud.service.user.IAppSteadyAssService;
|
import com.njcn.cloud.service.IAppSteadyAssService;
|
||||||
import com.njcn.cloud.service.user.IAppSteadyMsgService;
|
import com.njcn.cloud.service.IAppSteadyMsgService;
|
||||||
import com.njcn.cloud.service.user.IAppSteadyUrlService;
|
import com.njcn.cloud.service.IAppSteadyUrlService;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.device.biz.pojo.po.Overlimit;
|
import com.njcn.device.biz.pojo.po.Overlimit;
|
||||||
import com.njcn.device.pq.api.LineFeignClient;
|
import com.njcn.device.pq.api.LineFeignClient;
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
package com.njcn.cloud.service.impl.user;
|
package com.njcn.cloud.service.impl;
|
||||||
|
|
||||||
import com.njcn.cloud.mapper.AppSteadyUrlMapper;
|
import com.njcn.cloud.mapper.AppSteadyUrlMapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.njcn.cloud.pojo.dto.AppSteadyUrl;
|
import com.njcn.cloud.pojo.dto.AppSteadyUrl;
|
||||||
import com.njcn.cloud.service.user.IAppSteadyUrlService;
|
import com.njcn.cloud.service.IAppSteadyUrlService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.njcn.cloud.service.impl.user;
|
package com.njcn.cloud.service.impl;
|
||||||
|
|
||||||
import com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse;
|
import com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
@@ -6,8 +6,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||||||
import com.njcn.cloud.mapper.AppUserMapper;
|
import com.njcn.cloud.mapper.AppUserMapper;
|
||||||
import com.njcn.cloud.enums.app.UserCodeEnum;
|
import com.njcn.cloud.enums.app.UserCodeEnum;
|
||||||
import com.njcn.cloud.pojo.dto.AppSendMsg;
|
import com.njcn.cloud.pojo.dto.AppSendMsg;
|
||||||
import com.njcn.cloud.service.user.IAppSendMsgService;
|
import com.njcn.cloud.service.IAppSendMsgService;
|
||||||
import com.njcn.cloud.service.user.IAppUserService;
|
import com.njcn.cloud.service.IAppUserService;
|
||||||
import com.njcn.cloud.utils.SmsUtil;
|
import com.njcn.cloud.utils.SmsUtil;
|
||||||
import com.njcn.common.pojo.constant.PatternRegex;
|
import com.njcn.common.pojo.constant.PatternRegex;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.njcn.cloud.service.impl.user;
|
package com.njcn.cloud.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.date.DatePattern;
|
import cn.hutool.core.date.DatePattern;
|
||||||
@@ -10,7 +10,7 @@ import cn.hutool.core.util.StrUtil;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.njcn.cloud.enums.app.UserCodeEnum;
|
import com.njcn.cloud.enums.app.UserCodeEnum;
|
||||||
import com.njcn.cloud.pojo.dto.*;
|
import com.njcn.cloud.pojo.dto.*;
|
||||||
import com.njcn.cloud.service.user.*;
|
import com.njcn.cloud.service.*;
|
||||||
import com.njcn.cloud.utils.RedisDB;
|
import com.njcn.cloud.utils.RedisDB;
|
||||||
import com.njcn.cloud.utils.SmsUtil;
|
import com.njcn.cloud.utils.SmsUtil;
|
||||||
import com.njcn.common.pojo.dto.LogInfoDTO;
|
import com.njcn.common.pojo.dto.LogInfoDTO;
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
package com.njcn.cloud.service.impl.user;
|
package com.njcn.cloud.service.impl;
|
||||||
|
|
||||||
import com.njcn.cloud.service.user.RealTimeInfoService;
|
import com.njcn.cloud.service.RealTimeInfoService;
|
||||||
import com.njcn.device.pq.api.LineFeignClient;
|
import com.njcn.device.pq.api.LineFeignClient;
|
||||||
import com.njcn.device.pq.pojo.vo.LineDetailVO;
|
import com.njcn.device.pq.pojo.vo.LineDetailVO;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@@ -1,190 +0,0 @@
|
|||||||
package com.njcn.cloud.service.impl.user;
|
|
||||||
|
|
||||||
import cn.hutool.core.codec.Base64;
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
||||||
import com.njcn.cloud.enums.app.EventMsgCodeEnum;
|
|
||||||
import com.njcn.cloud.mapper.AppReportMapper;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import com.njcn.cloud.pojo.dto.AppEventInfo;
|
|
||||||
import com.njcn.cloud.pojo.dto.AppReport;
|
|
||||||
import com.njcn.cloud.pojo.vo.EventEigDetailVO;
|
|
||||||
import com.njcn.cloud.pojo.vo.EventInfoDetailVO;
|
|
||||||
import com.njcn.cloud.service.user.IAppEventInfoService;
|
|
||||||
import com.njcn.cloud.service.user.IAppReportService;
|
|
||||||
import com.njcn.cloud.utils.PubUtil;
|
|
||||||
import com.njcn.cloud.utils.WordUtil;
|
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
|
||||||
import com.njcn.common.utils.FileUtil;
|
|
||||||
import com.njcn.device.pq.api.LineFeignClient;
|
|
||||||
import com.njcn.device.pq.pojo.vo.LineDetailVO;
|
|
||||||
import com.njcn.event.api.EventDetailFeignClient;
|
|
||||||
import com.njcn.event.file.component.WavePicComponent;
|
|
||||||
import com.njcn.event.file.pojo.bo.WaveDataDetail;
|
|
||||||
import com.njcn.event.file.pojo.dto.WaveDataDTO;
|
|
||||||
import com.njcn.event.file.utils.WaveUtil;
|
|
||||||
import com.njcn.event.pojo.po.RmpEventDetailPO;
|
|
||||||
import com.njcn.oss.constant.OssPath;
|
|
||||||
import com.njcn.oss.utils.FileStorageUtil;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import java.io.*;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* 报告信息 服务实现类
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @author wr
|
|
||||||
* @since 2023-11-02
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class AppReportServiceImpl extends ServiceImpl<AppReportMapper, AppReport> implements IAppReportService {
|
|
||||||
|
|
||||||
private final IAppEventInfoService appEventInfoService;
|
|
||||||
private final WavePicComponent wavePicComponent;
|
|
||||||
private final FileStorageUtil fileStorageUtil;
|
|
||||||
private final EventDetailFeignClient eventDetailFeignClient;
|
|
||||||
private final LineFeignClient lineFeignClient;
|
|
||||||
@Override
|
|
||||||
@Transactional(rollbackFor = {Exception.class})
|
|
||||||
public String eventDetailReportApply(String userId, String eventDetailIndex) {
|
|
||||||
AppEventInfo info=new AppEventInfo();
|
|
||||||
info.setEventdetailIndex(eventDetailIndex);
|
|
||||||
info.setEvaluate(0);
|
|
||||||
info.setUserIndex(userId);
|
|
||||||
info.setUpdateTime(LocalDateTime.now());
|
|
||||||
|
|
||||||
AppEventInfo one = appEventInfoService.getOne(new LambdaUpdateWrapper<AppEventInfo>()
|
|
||||||
.eq(AppEventInfo::getEventdetailIndex, eventDetailIndex)
|
|
||||||
.ne(AppEventInfo::getReportState, 4)
|
|
||||||
);
|
|
||||||
if (ObjectUtil.isNull(one)||one.getReportState() != 1) {
|
|
||||||
try {
|
|
||||||
Map<String, String> map = this.createEventDetailReport(eventDetailIndex,one);
|
|
||||||
if (map.containsKey("noData")) {
|
|
||||||
return map.get("noData");
|
|
||||||
}
|
|
||||||
info.setInstantwavePath(map.get("instantPath"));
|
|
||||||
info.setRmswavePath(map.get("rmsPath"));
|
|
||||||
info.setReportState(1);
|
|
||||||
info.setReportPath(map.get("reportPath"));
|
|
||||||
appEventInfoService.saveOrUpdate(info);
|
|
||||||
return "0";
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
info.setReportState(2);
|
|
||||||
appEventInfoService.saveOrUpdate(info);
|
|
||||||
return "1";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return "0";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public AppEventInfo getDownLoadPath(String userId, String eventDetailIndex) {
|
|
||||||
AppEventInfo one = appEventInfoService.getOne(new LambdaQueryWrapper<AppEventInfo>()
|
|
||||||
.eq(AppEventInfo::getUserIndex, userId)
|
|
||||||
.eq(AppEventInfo::getEventdetailIndex, eventDetailIndex)
|
|
||||||
);
|
|
||||||
if(ObjectUtil.isNull(one)){
|
|
||||||
throw new BusinessException(EventMsgCodeEnum.EVENTDETAILREPORTDOWNLOAD_NOT_FAIL.getMsg());
|
|
||||||
}
|
|
||||||
if(one.getReportState() == 3){
|
|
||||||
throw new BusinessException(EventMsgCodeEnum.EVENTDETAILREPORTDOWNLOAD_ERROR.getMsg());
|
|
||||||
}
|
|
||||||
return one;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Description: 生成报告
|
|
||||||
* @param eventIndex
|
|
||||||
* @return: java.lang.String
|
|
||||||
* @Author: wr
|
|
||||||
* @Date: 2023/11/2 14:44
|
|
||||||
*/
|
|
||||||
private Map<String,String> createEventDetailReport(String eventIndex,AppEventInfo appEventInfo) throws Exception {
|
|
||||||
Map<String,String> map=new HashMap<>();
|
|
||||||
WaveDataDTO waveData = appEventInfoService.analyseWave(eventIndex, 2);
|
|
||||||
|
|
||||||
if (waveData.getListWaveData().size() == 0) {
|
|
||||||
map.put("noData","2");
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
//数据筛选,如果是双路电压的话,会存在2个波形数据
|
|
||||||
List<WaveDataDetail> waveDataDetails = WaveUtil.filterWaveData(waveData);
|
|
||||||
WordUtil wordUtil = new WordUtil();
|
|
||||||
//获取瞬时波形
|
|
||||||
String instantPath;
|
|
||||||
if(ObjectUtil.isNotNull(appEventInfo)&&StrUtil.isNotBlank(appEventInfo.getInstantwavePath())){
|
|
||||||
instantPath=appEventInfo.getInstantwavePath();
|
|
||||||
}else{
|
|
||||||
instantPath = wavePicComponent.generateImageShun(waveData,waveDataDetails);
|
|
||||||
}
|
|
||||||
InputStream instantStream = fileStorageUtil.getFileStream(instantPath);
|
|
||||||
String imageShun64 = Base64.encode(instantStream);
|
|
||||||
//获取rms波形
|
|
||||||
String rmsPath;
|
|
||||||
if(ObjectUtil.isNotNull(appEventInfo)&&StrUtil.isNotBlank(appEventInfo.getRmswavePath())){
|
|
||||||
rmsPath =appEventInfo.getRmswavePath();
|
|
||||||
}else{
|
|
||||||
rmsPath = wavePicComponent.generateImageRms(waveData,waveDataDetails);
|
|
||||||
|
|
||||||
}
|
|
||||||
InputStream rmsStream = fileStorageUtil.getFileStream(rmsPath);
|
|
||||||
String rmsShun64 = Base64.encode(rmsStream);
|
|
||||||
|
|
||||||
wordUtil.translate(imageShun64,rmsShun64);
|
|
||||||
List<EventEigDetailVO> eventDetailEigenvalue =new ArrayList<>();
|
|
||||||
List<String> tmpWaveTitle = waveData.getWaveTitle();
|
|
||||||
int picCounts =(tmpWaveTitle.size()-1)/waveData.getIPhasic();
|
|
||||||
if(picCounts == 3){
|
|
||||||
eventDetailEigenvalue = appEventInfoService.eventDetailEigenvalue(eventIndex).getList();
|
|
||||||
|
|
||||||
}
|
|
||||||
wordUtil.setEventDetailEigenvalue(eventDetailEigenvalue);
|
|
||||||
EventInfoDetailVO eventInfoList = new EventInfoDetailVO();
|
|
||||||
List<RmpEventDetailPO> eventDetails = eventDetailFeignClient.getEventDetailByIdsList(Arrays.asList(eventIndex)).getData();
|
|
||||||
List<String> linedIds = eventDetails.stream().map(RmpEventDetailPO::getLineId).distinct().collect(Collectors.toList());
|
|
||||||
List<LineDetailVO.Detail> lineDetail = lineFeignClient.getLineDetailByIds(linedIds).getData();
|
|
||||||
RmpEventDetailPO detail = eventDetails.get(0);
|
|
||||||
LineDetailVO.Detail line = lineDetail.get(0);
|
|
||||||
eventInfoList.setLineName(PubUtil.lineName(detail.getSagsource(),line.getLineName()));
|
|
||||||
eventInfoList.setGdName(line.getGdName());
|
|
||||||
eventInfoList.setBdzName(line.getSubName());
|
|
||||||
eventInfoList.setDevName(line.getDevName());
|
|
||||||
eventInfoList.setScale(line.getVoltageLevel());
|
|
||||||
eventInfoList.setIp(line.getIp());
|
|
||||||
eventInfoList.setEventDetailIndex(detail.getEventId());
|
|
||||||
eventInfoList.setTimeID(detail.getStartTime());
|
|
||||||
eventInfoList.setPersistTime(detail.getDuration());
|
|
||||||
eventInfoList.setMs(detail.getFirstMs());
|
|
||||||
eventInfoList.setEventValue(detail.getFeatureAmplitude());
|
|
||||||
wordUtil.setEventInfoList(eventInfoList);
|
|
||||||
wordUtil.createReport();
|
|
||||||
|
|
||||||
//临时缓冲区
|
|
||||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
|
||||||
//创建临时文件
|
|
||||||
wordUtil.getDocument().write(out);
|
|
||||||
byte[] bookByteAry = out.toByteArray();
|
|
||||||
InputStream in = new ByteArrayInputStream(bookByteAry);
|
|
||||||
String reportPath = fileStorageUtil.uploadStream(in, OssPath.RESPONSIBILITY_APP_REPORT,
|
|
||||||
FileUtil.generateFileName("docx")
|
|
||||||
);
|
|
||||||
map.put("instantPath",instantPath);
|
|
||||||
map.put("rmsPath",rmsPath);
|
|
||||||
map.put("reportPath",reportPath);
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
package com.njcn.cloud.service.user;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
|
||||||
import com.njcn.cloud.pojo.dto.AppEventInfo;
|
|
||||||
import com.njcn.cloud.pojo.dto.AppReport;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* 报告信息 服务类
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @author wr
|
|
||||||
* @since 2023-11-02
|
|
||||||
*/
|
|
||||||
public interface IAppReportService extends IService<AppReport> {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Description: 报告申请
|
|
||||||
* @param userId
|
|
||||||
* @param eventDetailIndex
|
|
||||||
* @return: int
|
|
||||||
* @Author: wr
|
|
||||||
* @Date: 2023/11/2 14:38
|
|
||||||
*/
|
|
||||||
String eventDetailReportApply(String userId, String eventDetailIndex) throws Exception;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Description: 报告下载入口
|
|
||||||
* @param userId
|
|
||||||
* @param eventDetailIndex
|
|
||||||
* @return: com.njcn.cloud.pojo.dto.AppEventInfo
|
|
||||||
* @Author: wr
|
|
||||||
* @Date: 2023/11/3 8:53
|
|
||||||
*/
|
|
||||||
AppEventInfo getDownLoadPath(String userId, String eventDetailIndex);
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user