1.运行管理追加分页;

2.新增终端在线率统计接口;
3.移植运行状态接口
This commit is contained in:
njcn_dhj
2022-08-12 13:55:05 +08:00
parent 49140e026b
commit a178d230e9
33 changed files with 638 additions and 286 deletions

View File

@@ -3,6 +3,7 @@ package com.njcn.device.api;
import com.njcn.common.pojo.constant.ServerInfo;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.device.api.fallback.DeptLineFeignClientFallbackFactory;
import io.lettuce.core.dynamic.annotation.Param;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
@@ -22,4 +23,7 @@ public interface DeptLineFeignClient {
@PostMapping("/selectDeptBindLines")
HttpResult<Boolean> selectDeptBindLines(@RequestParam("ids") List<String> ids);
@PostMapping("removeBind")
Integer removeBind(@RequestParam("id") String id);
}

View File

@@ -43,6 +43,12 @@ public class DeptLineFeignClientFallbackFactory implements FallbackFactory<DeptL
log.error("{}异常,降级处理,异常为:{}", "部门Ids集合查询是否绑定", throwable.toString());
throw new BusinessException(finalExceptionEnum);
}
@Override
public Integer removeBind(String id) {
log.error("{}异常,降级处理,异常为:{}", "部门解除绑定", throwable.toString());
throw new BusinessException(finalExceptionEnum);
}
};
}
}

View File

@@ -0,0 +1,30 @@
package com.njcn.device.pojo.param;
import com.njcn.common.pojo.constant.PatternRegex;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.web.bind.annotation.RequestParam;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
/**
* @author denghuajun
* @date 2022/2/28
*
*/
@Data
public class PulicTimeParam {
@ApiModelProperty("监测点id")
private String id;
@ApiModelProperty("开始时间")
@Pattern(regexp = PatternRegex.TIME_FORMAT, message = "时间格式错误")
private String searchBeginTime;
@ApiModelProperty("结束时间")
@Pattern(regexp = PatternRegex.TIME_FORMAT, message = "时间格式错误")
private String searchEndTime;
}

View File

@@ -0,0 +1,23 @@
package com.njcn.device.pojo.param;
import com.njcn.common.pojo.constant.PatternRegex;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.Pattern;
/**
* @author denghuajun
* @date 2022/3/1
*
*/
@Data
public class PulicTimeStatisParam extends PulicTimeParam {
@ApiModelProperty("比较开始时间")
@Pattern(regexp = PatternRegex.TIME_FORMAT, message = "时间格式错误")
private String periodBeginTime;
@ApiModelProperty("比较结束时间")
@Pattern(regexp = PatternRegex.TIME_FORMAT, message = "时间格式错误")
private String periodEndTime;
}

View File

@@ -2,9 +2,11 @@ package com.njcn.device.pojo.param;
import com.njcn.common.pojo.dto.SimpleDTO;
import com.njcn.web.constant.ValidMessage;
import com.njcn.web.pojo.param.BaseParam;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Range;
@@ -18,10 +20,14 @@ import java.util.List;
* @version 1.0.0
* @date 2022/3/30
*/
/**
* 分页查询实体
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel
@NoArgsConstructor
public class RunManageParam implements Serializable {
public class RunManageParam extends BaseParam implements Serializable {
@ApiModelProperty(name = "statisticalType", value = "统计类型")
@NotNull(message = "统计类型不可为空")
@@ -31,6 +37,9 @@ public class RunManageParam implements Serializable {
@NotBlank(message = "部门索引不可为空")
private String deptIndex;
@ApiModelProperty(name = "serverName", value = "服务名称")
private String serverName;
@ApiModelProperty(name = "scale", value = "电压等级")
private List<SimpleDTO> scale;
@@ -54,12 +63,15 @@ public class RunManageParam implements Serializable {
* 1-非电网侧
*/
@ApiModelProperty("电网侧标识")
@Range(min = 0, max = 1, message = "电网侧标识" + ValidMessage.PARAM_FORMAT_ERROR)
@Range(min = 0, max = 2, message = "电网侧标识" + ValidMessage.PARAM_FORMAT_ERROR)
private int powerFlag;
@ApiModelProperty(name = "comFlag", value = "通讯状态")
@NotNull(message = "通讯状态不可为空")
private List<Integer> comFlag;
@ApiModelProperty(name = "runFlag", value = "终端状态")
@NotNull(message = "终端状态不可为空")
private List<Integer> runFlag;
}

View File

@@ -0,0 +1,21 @@
package com.njcn.device.pojo.vo;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @author denghuajun
* @date 2022/2/28
*
*/
@Data
public class CommunicateStatisticsVO implements Serializable {
private static final long serialVersionUID = 1L;
private List<Float> onlineRateData;
private List<Float> integrityData;
}

View File

@@ -0,0 +1,26 @@
package com.njcn.device.pojo.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* @version 1.0.0
* @author denghuajun
* @date 2022/05/26 18:41
*/
@Data
public class DeviceOnlineDataVO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty("")
private String year;
@ApiModelProperty("")
private String month;
@ApiModelProperty("在线率")
private Float onlineRate;
}

View File

@@ -18,6 +18,9 @@ public class RunTimeVO implements Serializable {
@ApiModelProperty(name = "runNo",value = "序号")
private Integer runNo;
@ApiModelProperty(name = "id",value = "终端id")
private String id;
@ApiModelProperty(name = "areaName",value = "工程名称")
private String areaName;

View File

@@ -0,0 +1,43 @@
package com.njcn.device.utils;
import java.text.SimpleDateFormat;
import java.util.Calendar;
public class PublicDateUtil {
/**
* 获取某年某月的第一天
*/
public static String getFisrtDayOfMonth(int year,int month){
Calendar cal = Calendar.getInstance();
//设置年份
cal.set(Calendar.YEAR,year);
//设置月份
cal.set(Calendar.MONTH, month-1);
//获取某月最小天数
int firstDay = cal.getActualMinimum(Calendar.DAY_OF_MONTH);
//设置日历中月份的最小天数
cal.set(Calendar.DAY_OF_MONTH, firstDay);
//格式化日期
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
return sdf.format(cal.getTime());
}
/**
* 获取某月的最后一天
*/
public static String getLastDayOfMonth(int year,int month)
{
Calendar cal = Calendar.getInstance();
//设置年份
cal.set(Calendar.YEAR,year);
//设置月份
cal.set(Calendar.MONTH, month-1);
//获取某月最大天数
int lastDay = cal.getActualMaximum(Calendar.DAY_OF_MONTH);
//设置日历中月份的最大天数
cal.set(Calendar.DAY_OF_MONTH, lastDay);
//格式化日期
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
return sdf.format(cal.getTime());
}
}