用能空调代码提交 终端相关代码修改
This commit is contained in:
@@ -21,6 +21,7 @@ spring:
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
ip: @server.url@
|
||||
server-addr: @nacos.url@
|
||||
namespace: @nacos.namespace@
|
||||
config:
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.njcn.influxdb.utils;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* pqs
|
||||
*
|
||||
* @author cdf
|
||||
* @date 2022/7/1
|
||||
*/
|
||||
@Component
|
||||
public class InfluxDBCommUtils {
|
||||
|
||||
/**
|
||||
* 组装为influxdb监测点参数
|
||||
*
|
||||
* @param lineIds 监测点参数
|
||||
* @return StringBuilder
|
||||
*/
|
||||
public static StringBuilder assToInfluxParam(List<String> lineIds){
|
||||
StringBuilder lineIdsStr = new StringBuilder("(");
|
||||
for (int i = 0; i < lineIds.size(); i++) {
|
||||
if (lineIds.size() - i != 1) {
|
||||
lineIdsStr.append("line_id ='").append(lineIds.get(i)).append("' or ");
|
||||
} else {
|
||||
lineIdsStr.append("line_id ='").append(lineIds.get(i)).append("') ");
|
||||
}
|
||||
}
|
||||
return lineIdsStr;
|
||||
}
|
||||
}
|
||||
@@ -172,4 +172,21 @@ public interface LineFeignClient {
|
||||
*/
|
||||
@PostMapping("getOverLimitByList")
|
||||
HttpResult<List<Overlimit>> getOverLimitByList(@RequestBody PollutionParamDTO pollutionParamDTO);
|
||||
|
||||
|
||||
/**
|
||||
* 区域监测点以及上级一些信息
|
||||
* @param list 监测点id集合
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("getBaseLineAreaInfo")
|
||||
HttpResult<List<AreaLineInfoVO>> getBaseLineAreaInfo(@RequestBody List<String> list);
|
||||
|
||||
/**
|
||||
* 获取监测点基本信息
|
||||
* @param list 监测点id集合
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("getBaseLineList")
|
||||
HttpResult<List<Line>> getBaseLineList(@RequestBody List<String> list);
|
||||
}
|
||||
|
||||
@@ -5,10 +5,14 @@ import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.device.api.fallback.GeneralDeviceInfoClientFallbackFactory;
|
||||
import com.njcn.device.api.fallback.TerminalBaseClientFallbackFactory;
|
||||
import com.njcn.device.pojo.dto.GeneralDeviceDTO;
|
||||
import com.njcn.device.pojo.po.Device;
|
||||
import com.njcn.device.pojo.po.Line;
|
||||
import com.njcn.device.pojo.vo.AreaLineInfoVO;
|
||||
import com.njcn.device.pojo.vo.TerminalBaseVO;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
@@ -33,4 +37,13 @@ public interface TerminalBaseClient {
|
||||
@GetMapping("/getSubstationById")
|
||||
HttpResult<List<Line>> getSubstationById(@RequestParam("list") List<String> list);
|
||||
|
||||
|
||||
/**
|
||||
* 获取监测点限值
|
||||
* @param list 设备id集合
|
||||
* @return 监测点限值信息
|
||||
*/
|
||||
@PostMapping("getDevInfoByIds")
|
||||
HttpResult<List<TerminalBaseVO>> getDeviceByIdOnOrOff(@RequestBody List<String> list);
|
||||
|
||||
}
|
||||
|
||||
@@ -135,6 +135,21 @@ public class LineFeignClientFallbackFactory implements FallbackFactory<LineFeign
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<AreaLineInfoVO>> getBaseLineAreaInfo(List<String> list) {
|
||||
log.error("{}异常,降级处理,异常为:{}", "获取监测点详情 ", throwable.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<Line>> getBaseLineList(List<String> list) {
|
||||
log.error("{}异常,降级处理,异常为:{}", "获取监测点详情 ", throwable.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,9 @@ import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.device.api.GeneralDeviceInfoClient;
|
||||
import com.njcn.device.api.TerminalBaseClient;
|
||||
import com.njcn.device.pojo.dto.GeneralDeviceDTO;
|
||||
import com.njcn.device.pojo.po.Device;
|
||||
import com.njcn.device.pojo.po.Line;
|
||||
import com.njcn.device.pojo.vo.TerminalBaseVO;
|
||||
import com.njcn.device.utils.DeviceEnumUtil;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -38,6 +40,12 @@ public class TerminalBaseClientFallbackFactory implements FallbackFactory<Termin
|
||||
log.error("{}异常,降级处理,异常为:{}", "根据变电站id获取变电站详情", throwable.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<TerminalBaseVO>> getDeviceByIdOnOrOff(List<String> list) {
|
||||
log.error("{}异常,降级处理,异常为:{}", "根据设备ids获取设备详情", throwable.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
package com.njcn.device.pojo.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 监测点详细信息
|
||||
* @author cdf
|
||||
* @date 2022/6/29
|
||||
*/
|
||||
@Data
|
||||
public class AreaLineInfoVO implements Serializable {
|
||||
|
||||
@ApiModelProperty(name = "lineId",value = "监测点id")
|
||||
private String lineId;
|
||||
|
||||
@ApiModelProperty(name = "lineName",value = "监测点名称")
|
||||
private String lineName;
|
||||
|
||||
@ApiModelProperty(name = "subId",value = "变电站id")
|
||||
private String subId;
|
||||
|
||||
@ApiModelProperty(name = "subName",value = "变电站名称")
|
||||
private String subName;
|
||||
|
||||
@ApiModelProperty(name = "gdId",value = "供电公司id")
|
||||
private String gdId;
|
||||
|
||||
@ApiModelProperty(name = "gdName",value = "供电公司名称")
|
||||
private String gdName;
|
||||
|
||||
@ApiModelProperty(name = "voltageId",value = "母线id")
|
||||
private String voltageId;
|
||||
|
||||
@ApiModelProperty(name = "voltageName",value = "母线名称")
|
||||
private String voltageName;
|
||||
|
||||
@ApiModelProperty(name = "noDealCount",value = "未处理暂降事件")
|
||||
private Integer noDealCount;
|
||||
|
||||
@ApiModelProperty(name = "ct1",value = "ct1")
|
||||
private Integer ct1;
|
||||
|
||||
@ApiModelProperty(name = "ct2",value = "ct2")
|
||||
private Integer ct2;
|
||||
|
||||
@ApiModelProperty(name = "pt1",value = "pt1")
|
||||
private Integer pt1;
|
||||
|
||||
@ApiModelProperty(name = "pt2",value = "pt2")
|
||||
private Integer pt2;
|
||||
|
||||
@ApiModelProperty(name = "runFlag",value = "运行状态")
|
||||
private Integer runFlag;
|
||||
|
||||
@ApiModelProperty(name = "comFlag",value = "通讯状态")
|
||||
private Integer comFlag;
|
||||
|
||||
@ApiModelProperty(name = "ip",value = "装置ip")
|
||||
private String ip;
|
||||
|
||||
@ApiModelProperty(name = "lat",value = "维度")
|
||||
private BigDecimal lat;
|
||||
|
||||
@ApiModelProperty(name = "lng",value = "经度")
|
||||
private BigDecimal lng;
|
||||
|
||||
@ApiModelProperty(name = "manufacturer",value = "供应商名称")
|
||||
private String manufacturer;
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
@@ -18,7 +19,7 @@ import java.util.List;
|
||||
* @date 2021/6/23
|
||||
*/
|
||||
@Data
|
||||
public class DeviceVO {
|
||||
public class DeviceVO implements Serializable {
|
||||
|
||||
private String devIndex;
|
||||
|
||||
|
||||
@@ -5,6 +5,8 @@ import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* pqs
|
||||
*
|
||||
@@ -13,7 +15,7 @@ import lombok.NoArgsConstructor;
|
||||
*/
|
||||
@Data
|
||||
@ApiModel
|
||||
public class LineMarkVO {
|
||||
public class LineMarkVO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
@ApiModelProperty(name = "省份")
|
||||
private String province;
|
||||
|
||||
@@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
@@ -15,7 +16,7 @@ import java.util.Date;
|
||||
*/
|
||||
@Data
|
||||
@ApiModel
|
||||
public class LineVO {
|
||||
public class LineVO implements Serializable {
|
||||
|
||||
@ApiModelProperty(name = "id",value = "监测点索引")
|
||||
private String lineIndex;
|
||||
|
||||
@@ -6,6 +6,7 @@ import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
/**
|
||||
@@ -16,7 +17,7 @@ import javax.validation.constraints.NotNull;
|
||||
*/
|
||||
@Data
|
||||
@ApiModel
|
||||
public class ProjectVO {
|
||||
public class ProjectVO implements Serializable {
|
||||
|
||||
/**
|
||||
* 表Id
|
||||
|
||||
@@ -11,6 +11,7 @@ import lombok.EqualsAndHashCode;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Pattern;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* pqs
|
||||
@@ -20,7 +21,7 @@ import javax.validation.constraints.Pattern;
|
||||
*/
|
||||
@Data
|
||||
@ApiModel
|
||||
public class ProvinceVO {
|
||||
public class ProvinceVO implements Serializable {
|
||||
|
||||
/**
|
||||
* 表Id
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.njcn.device.pojo.vo;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
@@ -12,7 +13,7 @@ import java.math.BigDecimal;
|
||||
* @date 2021/7/20
|
||||
*/
|
||||
@Data
|
||||
public class SubStationVO {
|
||||
public class SubStationVO implements Serializable {
|
||||
@ApiModelProperty(name ="subIndex",value = "变电站索引")
|
||||
private String subIndex;
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -14,7 +15,7 @@ import java.util.List;
|
||||
*/
|
||||
@Data
|
||||
@ApiModel
|
||||
public class SubVoltageVO {
|
||||
public class SubVoltageVO implements Serializable {
|
||||
|
||||
@ApiModelProperty(name = "subIndex",value = "母线索引")
|
||||
private String subvIndex;
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
@@ -16,7 +17,7 @@ import java.time.LocalDateTime;
|
||||
*/
|
||||
@Data
|
||||
@ApiModel
|
||||
public class TerminalAlarmVO {
|
||||
public class TerminalAlarmVO implements Serializable {
|
||||
|
||||
|
||||
private String subName;
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.njcn.device.pojo.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* pqs
|
||||
*
|
||||
* @author cdf
|
||||
* @date 2022/6/30
|
||||
*/
|
||||
@Data
|
||||
public class TerminalBaseVO {
|
||||
|
||||
@ApiModelProperty("监测点名称")
|
||||
private String lineName;
|
||||
|
||||
@ApiModelProperty("监测点id")
|
||||
private String lineId;
|
||||
|
||||
@ApiModelProperty("母线名称")
|
||||
private String voltage;
|
||||
|
||||
@ApiModelProperty("母线id")
|
||||
private String voltageId;
|
||||
|
||||
@ApiModelProperty("设备名称")
|
||||
private String devName;
|
||||
|
||||
@ApiModelProperty("设备id")
|
||||
private String devId;
|
||||
|
||||
@ApiModelProperty("变电站名称")
|
||||
private String subName;
|
||||
|
||||
@ApiModelProperty("变电站id")
|
||||
private String subId;
|
||||
|
||||
@ApiModelProperty("供电名称")
|
||||
private String gdName;
|
||||
|
||||
@ApiModelProperty("供电id")
|
||||
private String gdId;
|
||||
|
||||
@ApiModelProperty("装置ip")
|
||||
private String ip;
|
||||
|
||||
@ApiModelProperty("数据更新时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private String updateTime;
|
||||
|
||||
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -14,7 +15,7 @@ import java.util.List;
|
||||
*/
|
||||
@Data
|
||||
@ApiModel
|
||||
public class TerminalLedgerVO {
|
||||
public class TerminalLedgerVO implements Serializable {
|
||||
|
||||
@ApiModelProperty(name = "areaIndex",value = "区域索引")
|
||||
private String areaIndex;
|
||||
|
||||
@@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -14,7 +15,7 @@ import java.util.List;
|
||||
*/
|
||||
@Data
|
||||
@ApiModel
|
||||
public class TerminalMaintainVO {
|
||||
public class TerminalMaintainVO implements Serializable {
|
||||
@ApiModelProperty(name="序号")
|
||||
private Integer index;
|
||||
@ApiModelProperty(name = "拓扑名称")
|
||||
|
||||
@@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -15,7 +16,7 @@ import java.util.List;
|
||||
*/
|
||||
@ApiModel
|
||||
@Data
|
||||
public class TerminalTree {
|
||||
public class TerminalTree implements Serializable {
|
||||
private String id;
|
||||
@ApiModelProperty(name = "parentId",value = "父id")
|
||||
private String pid;
|
||||
|
||||
@@ -6,6 +6,7 @@ import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -16,7 +17,7 @@ import java.util.List;
|
||||
*/
|
||||
@Data
|
||||
@ApiModel
|
||||
public class TerminalVO {
|
||||
public class TerminalVO implements Serializable {
|
||||
@ApiModelProperty(name = "projectVO",value = "项目实体")
|
||||
private ProjectVO projectVO;
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -15,7 +16,7 @@ import java.util.List;
|
||||
*/
|
||||
@Data
|
||||
@ApiModel
|
||||
public class TerminalVersionVO {
|
||||
public class TerminalVersionVO implements Serializable {
|
||||
@ApiModelProperty(name="序号")
|
||||
private Integer index;
|
||||
@ApiModelProperty(name = "拓扑名称")
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.njcn.device.mapper.DeviceMapper;
|
||||
import com.njcn.device.mapper.LineMapper;
|
||||
import com.njcn.device.pojo.dto.*;
|
||||
import com.njcn.device.pojo.po.Device;
|
||||
import com.njcn.device.pojo.po.Line;
|
||||
import com.njcn.device.pojo.po.Overlimit;
|
||||
import com.njcn.device.pojo.vo.*;
|
||||
import com.njcn.device.service.LineService;
|
||||
@@ -227,4 +228,32 @@ public class LineController extends BaseController {
|
||||
List<Overlimit> result = lineService.getOverLimitByList(pollutionParamDTO);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取监测点及以上层的基础信息(含区域信息)
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getBaseLineAreaInfo")
|
||||
@ApiOperation("获取监测点及以上层的基础信息(含区域信息)")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "lineIndex", value = "监测点集合", required = true)
|
||||
})
|
||||
public HttpResult<List<AreaLineInfoVO>> getBaseLineAreaInfo(@RequestBody List<String> lineIndex) {
|
||||
String methodDescribe = getMethodDescribe("getBaseLineAreaInfo");
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, lineService.getBaseLineAreaInfo(lineIndex), methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据监测点ids获取监测点基本信息
|
||||
* @author cdf
|
||||
* @date 2022/6/30
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getBaseLineList")
|
||||
@ApiOperation("根据监测点ids获取监测点基本信息")
|
||||
@ApiImplicitParam(name = "lineIndex", value = "监测点集合", required = true)
|
||||
public HttpResult<List<Line>> getBaseLineList(@RequestBody List<String> lineIndex) {
|
||||
String methodDescribe = getMethodDescribe("getBaseLineList");
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, lineService.getBaseLineList(lineIndex), methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,17 +12,19 @@ import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.common.utils.LogUtil;
|
||||
import com.njcn.device.enums.DeviceResponseEnum;
|
||||
import com.njcn.device.pojo.bo.DeviceType;
|
||||
import com.njcn.device.pojo.bo.excel.TerminalBaseExcel;
|
||||
import com.njcn.device.pojo.param.*;
|
||||
import com.njcn.device.pojo.po.Device;
|
||||
import com.njcn.device.pojo.po.Line;
|
||||
import com.njcn.device.pojo.vo.AreaLineInfoVO;
|
||||
import com.njcn.device.pojo.vo.TerminalBaseVO;
|
||||
import com.njcn.device.pojo.vo.TerminalVO;
|
||||
import com.njcn.device.service.TerminalBaseService;
|
||||
import com.njcn.poi.excel.ExcelUtil;
|
||||
import com.njcn.poi.util.PoiUtil;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import io.swagger.annotations.*;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
@@ -32,6 +34,7 @@ import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -178,6 +181,23 @@ public class TerminalBaseController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, subList, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据设备id集获取设备集信息
|
||||
* @param list 设备集合
|
||||
* @author cdf
|
||||
* @date 2022/6/29
|
||||
*/
|
||||
@ApiOperation("获取装置信息")
|
||||
@OperateInfo
|
||||
@PostMapping("/getDevInfoByIds")
|
||||
public HttpResult<List<TerminalBaseVO>> getDevInfoByIds(@RequestBody List<String> list) {
|
||||
String methodDescribe = getMethodDescribe("getDevInfoByIds");
|
||||
LogUtil.njcnDebug(log, "{},设备集合为:{}", methodDescribe, list);
|
||||
List<TerminalBaseVO> devList = terminalBaseService.getDeviceByIdOnOrOff(list,new DeviceType(),0);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, devList, methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量导入oracle中的原始数据
|
||||
*
|
||||
@@ -223,16 +243,15 @@ public class TerminalBaseController extends BaseController {
|
||||
* @author cdf
|
||||
* @date 2022/5/17
|
||||
*/
|
||||
@ApiOperation("下载台账信息")
|
||||
@GetMapping(value = "downTerminalBase")
|
||||
public void downTerminalBase(HttpServletResponse response) {
|
||||
String fileName = "台账信息.xls";
|
||||
/*
|
||||
ExportParams exportExcel = new ExportParams("批量导入模板(请严格按照模板标准填入数据)","台账信息");
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(exportExcel,TerminalBaseExcel.class, baseExcelList);
|
||||
PoiUtil.exportFileByWorkbook(workbook,fileName,response);*/
|
||||
|
||||
|
||||
@ApiOperation("导出台账模板")
|
||||
@GetMapping(value = "downTerminalTemplate")
|
||||
public void downTerminalTemplate(HttpServletResponse response) {
|
||||
ExportParams exportExcel = new ExportParams("批量导入模板(请严格按照模板标准填入数据)","台账信息");
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(exportExcel,TerminalBaseExcel.class,new ArrayList<TerminalBaseExcel>());
|
||||
//这里是自己加的 带下拉框的代码
|
||||
ExcelUtil.selectList(workbook, 4, 4, new String[]{"斤","两","个","袋","份"});
|
||||
ExcelUtil.selectList(workbook, 0, 0, new String[]{"蔬菜","水果","主食","熟食","调料"});
|
||||
PoiUtil.exportFileByWorkbook(workbook, "菜品管理", response);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -248,4 +267,6 @@ public class TerminalBaseController extends BaseController {
|
||||
terminalBaseService.importTerminalBase(file,response);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -81,62 +81,6 @@ public interface LineMapper extends BaseMapper<Line> {
|
||||
*/
|
||||
List<TerminalTree> getProvinceList(@Param("pids") List<String> pids, @Param("type") Integer type);
|
||||
|
||||
/**
|
||||
* 通过id集合获取终端信息
|
||||
*
|
||||
* @param ids
|
||||
* @author cdf
|
||||
* @date 2022/2/28
|
||||
*/
|
||||
List<TerminalTree> getInfoByIdList(@Param("ids") List<String> ids);
|
||||
|
||||
|
||||
/**
|
||||
* 通过id集合获取终端信息
|
||||
*
|
||||
* @param pids
|
||||
* @author cdf
|
||||
* @date 2022/2/28
|
||||
*/
|
||||
List<TerminalTree> getInfoByPidList(@Param("pids") List<String> pids);
|
||||
|
||||
|
||||
/**
|
||||
* 获取指定id集的设备
|
||||
*
|
||||
* @return TerminalTree 终端树数据
|
||||
* @author cdf
|
||||
* @date 2022/2/25
|
||||
*/
|
||||
List<TerminalTree> getAllDeviceList(@Param("ids") List<String> ids);
|
||||
|
||||
/**
|
||||
* 获取所有id集的母线
|
||||
*
|
||||
* @return TerminalTree 终端树数据
|
||||
* @author cdf
|
||||
* @date 2022/2/25
|
||||
*/
|
||||
List<TerminalTree> getAllVolList(@Param("ids") List<String> ids);
|
||||
|
||||
/**
|
||||
* 获取所有id集的监测点
|
||||
*
|
||||
* @return TerminalTree 终端树数据
|
||||
* @author cdf
|
||||
* @date 2022/2/25
|
||||
*/
|
||||
List<TerminalTree> getAllLineList(@Param("ids") List<String> ids);
|
||||
|
||||
|
||||
/**
|
||||
* 通过监测点集合获取所有母线
|
||||
*
|
||||
* @author cdf
|
||||
* @date 2022/2/28
|
||||
*/
|
||||
List<TerminalTree> getVoltageListByLineIds(@Param("ids") List<String> ids);
|
||||
|
||||
|
||||
/**
|
||||
* 返回未绑定的监测点
|
||||
@@ -165,6 +109,9 @@ public interface LineMapper extends BaseMapper<Line> {
|
||||
List<Line> getDeviceById(@Param("devIds") List<String> devIds, @Param("deviceType") DeviceType deviceType);
|
||||
|
||||
|
||||
List<TerminalBaseVO> getDeviceByIdOnOrOff(@Param("devIds") List<String> devIds, @Param("deviceType") DeviceType deviceType,@Param("comFlag")Integer comFlag);
|
||||
|
||||
|
||||
List<LineDataVO> getLineDetail(@Param("ids") List<String> ids);
|
||||
|
||||
/**
|
||||
@@ -233,6 +180,14 @@ public interface LineMapper extends BaseMapper<Line> {
|
||||
*/
|
||||
List<BaseLineInfo> getBaseLineInfo(@Param("list")List<String> lineIndex);
|
||||
|
||||
|
||||
/**
|
||||
* 获取监测点区域详细信息(原基础上添加监测点区域经纬度信息)
|
||||
* @param lineIndex 监测点结合
|
||||
* @date 2022/6/29
|
||||
*/
|
||||
List<AreaLineInfoVO> getBaseLineAreaInfo(@Param("list")List<String> lineIndex);
|
||||
|
||||
/**
|
||||
* 返回监测点信息及通讯状态
|
||||
* @param lineIndex 监测点集合
|
||||
|
||||
@@ -87,7 +87,7 @@
|
||||
order by sort
|
||||
</select>
|
||||
|
||||
<select id="getInfoByPidList">
|
||||
<select id="getInfoByPidList" resultType="TerminalTree">
|
||||
select a.id,a.pid,a.name,a.level,a.sort from pq_line
|
||||
where pid in
|
||||
<foreach collection="list" item="item" open="(" close=")" separator=",">
|
||||
@@ -266,6 +266,48 @@
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getDeviceByIdOnOrOff" resultType="TerminalBaseVO">
|
||||
SELECT
|
||||
t1.name devName,t2.ip,t2.update_time,sub.name subName,gd.name gdName
|
||||
FROM
|
||||
pq_line t1,
|
||||
pq_device t2,
|
||||
pq_line sub,
|
||||
pq_line gd
|
||||
WHERE
|
||||
t1.id = t2.id
|
||||
and t1.pid = sub.id
|
||||
and sub.pid = gd.id
|
||||
<if test="deviceType.devModel!=null">
|
||||
AND t2.Dev_Model in
|
||||
<foreach collection="deviceType.devModel" open="(" close=")" item="item" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="deviceType.runFlag!=null">
|
||||
AND t2.Run_Flag in
|
||||
<foreach collection="deviceType.runFlag" open="(" close=")" item="item" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="deviceType.dataType!=null">
|
||||
AND t2.Dev_Data_Type in
|
||||
<foreach collection="deviceType.dataType" open="(" close=")" item="item" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
AND t1.id IN
|
||||
<foreach collection="devIds" open="(" close=")" item="item" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
<if test="comFlag!=null">
|
||||
and t2.com_flag = #{comFlag}
|
||||
</if>
|
||||
order by update_time desc
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getLineDetail" resultType="com.njcn.web.pojo.vo.LineDataVO">
|
||||
SELECT line.*
|
||||
FROM PQ_LINE line
|
||||
@@ -488,6 +530,60 @@
|
||||
GROUP BY line.id
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getBaseLineAreaInfo" resultType="AreaLineInfoVO">
|
||||
SELECT
|
||||
line.Id lineId,
|
||||
line.`Name` lineName,
|
||||
gd.`Name` gdName,
|
||||
substation.id subId,
|
||||
substation.`Name` subName,
|
||||
pqdevice.IP ip,
|
||||
pqdevice.Com_Flag comFlag,
|
||||
factory.`Name` manufacturer,
|
||||
voltage.`Name` voltageName,
|
||||
scale.`Name` voltageScale,
|
||||
pqdevice.run_flag,
|
||||
pqdevice.com_flag,
|
||||
pqsubstation.Lng,
|
||||
pqsubstation.lat,
|
||||
detail.ct1,
|
||||
detail.ct2,
|
||||
detail.pt1,
|
||||
detail.pt2
|
||||
FROM
|
||||
pq_line line,
|
||||
pq_line_detail detail,
|
||||
pq_line voltage,
|
||||
pq_voltage pqvoltage,
|
||||
pq_line device,
|
||||
pq_device pqdevice,
|
||||
pq_line substation,
|
||||
pq_substation pqsubstation,
|
||||
pq_line gd,
|
||||
sys_dict_data scale,
|
||||
sys_dict_data factory,
|
||||
sys_dict_data loadtype,
|
||||
sys_dict_data subscale
|
||||
WHERE
|
||||
line.id = detail.id
|
||||
AND line.pid = voltage.id
|
||||
AND voltage.id = pqvoltage.id
|
||||
AND pqvoltage.Scale = scale.id
|
||||
AND voltage.pid = device.id
|
||||
AND voltage.pid = pqdevice.id
|
||||
AND pqdevice.Manufacturer = factory.id
|
||||
AND device.pid = substation.id
|
||||
AND substation.id = pqsubstation.id
|
||||
AND pqsubstation.Scale = subscale.id
|
||||
AND substation.pid = gd.id
|
||||
AND line.Id IN
|
||||
<foreach item="item" collection="list" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
GROUP BY line.id
|
||||
</select>
|
||||
|
||||
<select id="getLineDeviceStateVO" resultType="com.njcn.device.pojo.vo.LineDeviceStateVO">
|
||||
SELECT
|
||||
t.id id,
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.njcn.device.pojo.dto.PollutionLineDTO;
|
||||
import com.njcn.device.pojo.dto.PollutionParamDTO;
|
||||
import com.njcn.device.pojo.dto.PollutionSubstationDTO;
|
||||
import com.njcn.device.pojo.param.DeviceInfoParam;
|
||||
import com.njcn.device.pojo.po.Line;
|
||||
import com.njcn.device.pojo.po.Overlimit;
|
||||
import com.njcn.device.pojo.vo.*;
|
||||
|
||||
@@ -125,4 +126,20 @@ public interface LineService {
|
||||
* @return 结果
|
||||
*/
|
||||
List<Overlimit> getOverLimitByList(PollutionParamDTO pollutionParamDTO);
|
||||
|
||||
/**
|
||||
* 获取监测点区域详细信息(原基础上添加监测点区域经纬度信息)
|
||||
* @param lineIndex 监测点结合
|
||||
* @date 2022/6/29
|
||||
*/
|
||||
List<AreaLineInfoVO> getBaseLineAreaInfo(List<String> lineIndex);
|
||||
|
||||
/**
|
||||
* 获取监测点基本信息
|
||||
* @param lineIndex 监测点结合
|
||||
* @date 2022/6/29
|
||||
*/
|
||||
List<Line> getBaseLineList(List<String> lineIndex);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -7,7 +7,10 @@ import com.njcn.device.pojo.bo.excel.TerminalBaseExcel;
|
||||
import com.njcn.device.pojo.param.AddTerminalParam;
|
||||
import com.njcn.device.pojo.param.DeviceInfoParam;
|
||||
import com.njcn.device.pojo.param.UpdateTerminalParam;
|
||||
import com.njcn.device.pojo.po.Device;
|
||||
import com.njcn.device.pojo.po.Line;
|
||||
import com.njcn.device.pojo.vo.AreaLineInfoVO;
|
||||
import com.njcn.device.pojo.vo.TerminalBaseVO;
|
||||
import com.njcn.device.pojo.vo.TerminalVO;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
@@ -40,7 +43,7 @@ public interface TerminalBaseService {
|
||||
|
||||
/**
|
||||
* 终端查询操作
|
||||
*
|
||||
* @param id 设备id
|
||||
* @author cdf
|
||||
* @date 2021/7/19
|
||||
*/
|
||||
@@ -48,7 +51,7 @@ public interface TerminalBaseService {
|
||||
|
||||
/**
|
||||
* 终端删除操作
|
||||
*
|
||||
* @param id 设备id
|
||||
* @author cdf
|
||||
* @date 2021/7/21
|
||||
*/
|
||||
@@ -88,6 +91,16 @@ public interface TerminalBaseService {
|
||||
*/
|
||||
List<Line> getDeviceById(List<String> devIds, DeviceType deviceType);
|
||||
|
||||
/**
|
||||
* 根据终端id,获取所有对应终端
|
||||
*
|
||||
* @param devIds 终端id
|
||||
* @param deviceType 终端条件筛选
|
||||
* @param comFlag 是否中断标志
|
||||
* @return 终端数据
|
||||
*/
|
||||
List<TerminalBaseVO> getDeviceByIdOnOrOff(List<String> devIds, DeviceType deviceType, Integer comFlag);
|
||||
|
||||
/**
|
||||
* 功能描述: 根据id查询变电站信息
|
||||
*
|
||||
|
||||
@@ -4,8 +4,10 @@ import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.common.pojo.enums.common.ServerEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.utils.EnumUtils;
|
||||
@@ -657,4 +659,17 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
||||
return communicateList;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<AreaLineInfoVO> getBaseLineAreaInfo(List<String> lineIndex) {
|
||||
return this.baseMapper.getBaseLineAreaInfo(lineIndex);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Line> getBaseLineList(List<String> lineIndex) {
|
||||
LambdaQueryWrapper<Line> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(Line::getState, DataStateEnum.ENABLE.getCode()).in(Line::getId,lineIndex);
|
||||
return this.list(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1254,6 +1254,11 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
||||
return this.baseMapper.getDeviceById(devIds, deviceType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TerminalBaseVO> getDeviceByIdOnOrOff(List<String> devIds, DeviceType deviceType,Integer comFlag){
|
||||
return this.baseMapper.getDeviceByIdOnOrOff(devIds, deviceType,comFlag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Line> getSubstationById(List<String> list) {
|
||||
return this.lambdaQuery().in(Line::getId, list).list();
|
||||
@@ -1294,6 +1299,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
||||
return this.baseMapper.getBaseLineInfo(lineIndex);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void importOracleTerminalData(MultipartFile file, HttpServletResponse response) {
|
||||
|
||||
@@ -21,6 +21,7 @@ spring:
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
ip: @server.url@
|
||||
server-addr: @nacos.url@
|
||||
namespace: @nacos.namespace@
|
||||
config:
|
||||
|
||||
@@ -16,6 +16,7 @@ public class AirStrategyDTO {
|
||||
private Integer expire;
|
||||
private String type;
|
||||
private Param param;
|
||||
private String userId;
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.njcn.energy.handler;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.alibaba.nacos.shaded.com.google.gson.Gson;
|
||||
import com.github.tocrhz.mqtt.annotation.MqttSubscribe;
|
||||
import com.github.tocrhz.mqtt.annotation.NamedValue;
|
||||
@@ -15,11 +16,15 @@ import com.njcn.energy.pojo.po.EleLogs;
|
||||
import com.njcn.energy.service.IEleLogsService;
|
||||
import com.njcn.energy.service.IModelService;
|
||||
import com.njcn.redis.utils.RedisUtil;
|
||||
import io.swagger.models.auth.In;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.sf.json.JSON;
|
||||
import org.eclipse.paho.client.mqttv3.MqttMessage;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
@@ -37,7 +42,7 @@ import java.util.concurrent.TimeUnit;
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
@RequiredArgsConstructor
|
||||
public class MqttMessageHandler {
|
||||
|
||||
private final MqttPublisher publisher;
|
||||
@@ -48,6 +53,18 @@ public class MqttMessageHandler {
|
||||
|
||||
private final IEleLogsService eleLogsService;
|
||||
|
||||
@Value("${mqtt.client-id}")
|
||||
private String clientId;
|
||||
|
||||
/**
|
||||
* 用于记录错误指令发送次数,默认发送三次停止
|
||||
* @author cdf
|
||||
* @date 2022/6/28
|
||||
*/
|
||||
private Integer mqttSendCount = 0;
|
||||
private String mqttJsonMsg;
|
||||
private String mqttSendTopic;
|
||||
|
||||
// /**
|
||||
// * 设备注册
|
||||
// */
|
||||
@@ -179,11 +196,8 @@ public class MqttMessageHandler {
|
||||
// }
|
||||
|
||||
|
||||
@MqttSubscribe(value = "/platform/devack/#",qos = 1)
|
||||
public void airOperation(String topic, MqttMessage message, @Payload String payload){
|
||||
System.out.println(message.toString());
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import cn.hutool.core.util.CharUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.alibaba.nacos.shaded.com.google.gson.Gson;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
@@ -13,12 +14,15 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.tocrhz.mqtt.annotation.MqttSubscribe;
|
||||
import com.github.tocrhz.mqtt.annotation.Payload;
|
||||
import com.github.tocrhz.mqtt.publisher.MqttPublisher;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.db.constant.DbConstant;
|
||||
import com.njcn.energy.handler.MqttMessageHandler;
|
||||
import com.njcn.energy.mapper.AirSetMapper;
|
||||
import com.njcn.energy.mapper.AirStrategyMapper;
|
||||
import com.njcn.energy.mapper.LogicAccessMapper;
|
||||
@@ -43,7 +47,9 @@ import com.xxl.job.core.biz.model.ReturnT;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.eclipse.paho.client.mqttv3.MqttMessage;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@@ -74,6 +80,13 @@ public class EleAirStrategyServiceImpl extends ServiceImpl<AirStrategyMapper, Ai
|
||||
|
||||
private final AirStrategyMapper airStrategyMapper;
|
||||
|
||||
private final MqttMessageHandler mqttMessageHandler;
|
||||
|
||||
@Value("${mqtt.client-id}")
|
||||
private String clientId;
|
||||
|
||||
private Integer xxlGroup = 5;
|
||||
|
||||
|
||||
@Override
|
||||
public Page<AirStrategy> listAirStrategy(AirStrategyParam.AirStrategyQueryParam queryParam) {
|
||||
@@ -148,7 +161,7 @@ public class EleAirStrategyServiceImpl extends ServiceImpl<AirStrategyMapper, Ai
|
||||
*/
|
||||
XxlJobInfo xxlJobInfo = new XxlJobInfo();
|
||||
//执行器ID,手动指定,此处设置为3,对应xxl_job_group中的executor--测试执行器
|
||||
xxlJobInfo.setJobGroup(5);
|
||||
xxlJobInfo.setJobGroup(xxlGroup);
|
||||
//任务描述
|
||||
xxlJobInfo.setJobDesc("开启空调");
|
||||
xxlJobInfo.setAuthor("cdf");
|
||||
@@ -175,7 +188,7 @@ public class EleAirStrategyServiceImpl extends ServiceImpl<AirStrategyMapper, Ai
|
||||
*/
|
||||
XxlJobInfo xxlJobInfoEnd = new XxlJobInfo();
|
||||
//执行器ID,手动指定,此处设置为3,对应xxl_job_group中的executor--测试执行器
|
||||
xxlJobInfoEnd.setJobGroup(5);
|
||||
xxlJobInfoEnd.setJobGroup(xxlGroup);
|
||||
//任务描述
|
||||
xxlJobInfoEnd.setJobDesc("关闭空调");
|
||||
xxlJobInfoEnd.setAuthor("cdf");
|
||||
@@ -236,7 +249,7 @@ public class EleAirStrategyServiceImpl extends ServiceImpl<AirStrategyMapper, Ai
|
||||
XxlJobInfo xxlJobInfo = new XxlJobInfo();
|
||||
//执行器ID,手动指定,此处设置为3,对应xxl_job_group中的executor--测试执行器
|
||||
xxlJobInfo.setId(Integer.parseInt(jobIds[0]));
|
||||
xxlJobInfo.setJobGroup(5);
|
||||
xxlJobInfo.setJobGroup(xxlGroup);
|
||||
//任务描述
|
||||
xxlJobInfo.setJobDesc("开启空调");
|
||||
xxlJobInfo.setAuthor("cdf");
|
||||
@@ -264,7 +277,7 @@ public class EleAirStrategyServiceImpl extends ServiceImpl<AirStrategyMapper, Ai
|
||||
XxlJobInfo xxlJobInfoEnd = new XxlJobInfo();
|
||||
xxlJobInfoEnd.setId(Integer.parseInt(jobIds[1]));
|
||||
//执行器ID,手动指定,此处设置为3,对应xxl_job_group中的executor--测试执行器
|
||||
xxlJobInfoEnd.setJobGroup(5);
|
||||
xxlJobInfoEnd.setJobGroup(xxlGroup);
|
||||
//任务描述
|
||||
xxlJobInfoEnd.setJobDesc("关闭空调");
|
||||
xxlJobInfoEnd.setAuthor("cdf");
|
||||
@@ -418,6 +431,7 @@ public class EleAirStrategyServiceImpl extends ServiceImpl<AirStrategyMapper, Ai
|
||||
AirStrategyDTO airStrategyDTO = new AirStrategyDTO();
|
||||
airStrategyDTO.setMid(1);
|
||||
airStrategyDTO.setDeviceId(netAndDevByLineDTO.getDevId());
|
||||
airStrategyDTO.setUserId(clientId);
|
||||
airStrategyDTO.setTimestamp(Calendar.getInstance().getTimeInMillis());
|
||||
airStrategyDTO.setExpire(-1);
|
||||
airStrategyDTO.setType("CMD_DEV_CTRL");
|
||||
@@ -430,12 +444,24 @@ public class EleAirStrategyServiceImpl extends ServiceImpl<AirStrategyMapper, Ai
|
||||
System.out.println(json);
|
||||
String topic = "/platform/devcmd/v1/" + netAndDevByLineDTO.getNdid();
|
||||
publisher.send(topic, json, 1, false);
|
||||
try {
|
||||
Thread.sleep(10000);
|
||||
System.out.println("睡了10s");
|
||||
|
||||
|
||||
//mqttMessageHandler.setMqttParam(0,topic,json);
|
||||
this.mqttSendCount = 0;
|
||||
this.mqttJsonMsg = json;
|
||||
this.mqttSendTopic = topic;
|
||||
|
||||
flag = true;
|
||||
while(flag){
|
||||
|
||||
}
|
||||
/* try {
|
||||
Thread.sleep(2000);
|
||||
System.out.println("切换命令睡了1s");
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
*/
|
||||
}
|
||||
} else {
|
||||
//关闭空调
|
||||
@@ -443,6 +469,7 @@ public class EleAirStrategyServiceImpl extends ServiceImpl<AirStrategyMapper, Ai
|
||||
AirStrategyDTO airStrategyDTO = new AirStrategyDTO();
|
||||
airStrategyDTO.setMid(1);
|
||||
airStrategyDTO.setDeviceId(netAndDevByLineDTO.getDevId());
|
||||
airStrategyDTO.setUserId(clientId);
|
||||
airStrategyDTO.setTimestamp(Calendar.getInstance().getTimeInMillis());
|
||||
airStrategyDTO.setExpire(-1);
|
||||
airStrategyDTO.setType("CMD_DEV_CTRL");
|
||||
@@ -455,12 +482,22 @@ public class EleAirStrategyServiceImpl extends ServiceImpl<AirStrategyMapper, Ai
|
||||
System.out.println(json);
|
||||
String topic = "/platform/devcmd/v1/" + netAndDevByLineDTO.getNdid();
|
||||
publisher.send(topic, json, 1, false);
|
||||
try {
|
||||
Thread.sleep(10000);
|
||||
System.out.println("切换监测点睡了10s");
|
||||
this.mqttSendCount = 0;
|
||||
this.mqttJsonMsg = json;
|
||||
this.mqttSendTopic = topic;
|
||||
flag = true;
|
||||
while(flag){
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*try {
|
||||
Thread.sleep(2000);
|
||||
System.out.println("切换监测点睡了1s");
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}*/
|
||||
|
||||
}
|
||||
|
||||
@@ -485,6 +522,37 @@ public class EleAirStrategyServiceImpl extends ServiceImpl<AirStrategyMapper, Ai
|
||||
}
|
||||
|
||||
|
||||
private Boolean flag = false;
|
||||
private Integer mqttSendCount = 0;
|
||||
private String mqttJsonMsg;
|
||||
private String mqttSendTopic;
|
||||
@MqttSubscribe(value = "/platform/devack/#",qos = 1)
|
||||
public void airOperation(String topic, MqttMessage message, @Payload String payload){
|
||||
System.out.println(message.toString());
|
||||
JSONObject jsonObject = new JSONObject(message.toString());
|
||||
String str = jsonObject.getStr("userId");
|
||||
|
||||
if(str.equals(clientId)){
|
||||
|
||||
if(!jsonObject.getStr("code").equals("200")){
|
||||
mqttSendCount++;
|
||||
if(mqttSendCount < 3){
|
||||
System.out.println("进入错误重发++++++");
|
||||
System.out.println("错误重发详情"+mqttJsonMsg);
|
||||
publisher.send(mqttSendTopic, mqttJsonMsg, 1, false);
|
||||
}else{
|
||||
flag = false;
|
||||
}
|
||||
}else{
|
||||
flag = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 校验参数,检查是否存在相同名称的空调策略
|
||||
*/
|
||||
|
||||
@@ -47,8 +47,8 @@ mybatis-plus:
|
||||
#别名扫描
|
||||
type-aliases-package: com.njcn.energy.pojo
|
||||
|
||||
#mqtt:
|
||||
# uri: tcp://192.168.1.14:1883
|
||||
# client-id: energy_online
|
||||
# username: t_user
|
||||
# password: njcnpqs
|
||||
mqtt:
|
||||
uri: tcp://192.168.1.14:1883
|
||||
client-id: energy_cdf
|
||||
username: t_user
|
||||
password: njcnpqs
|
||||
|
||||
@@ -18,6 +18,7 @@ spring:
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
ip: @server.url@
|
||||
server-addr: @nacos.url@
|
||||
namespace: @nacos.namespace@
|
||||
config:
|
||||
|
||||
@@ -46,7 +46,7 @@ xxl:
|
||||
accessToken:
|
||||
executor:
|
||||
#执行器AppName [选填]:执行器心跳注册分组依据;为空则关闭自动注册
|
||||
appname: executor
|
||||
appname: executorCdf
|
||||
#执行器注册 [选填]:优先使用该配置作为注册地址,为空时使用内嵌服务 ”IP:PORT“ 作为注册地址。从而更灵活的支持容器类型执行器动态IP和动态映射端口问题。
|
||||
address:
|
||||
#执行器IP [选填]:默认为空表示自动获取IP,多网卡时可手动设置指定IP,该IP不会绑定Host仅作为通讯实用;地址信息用于 "执行器注册" 和 "调度中心请求并触发任务";
|
||||
|
||||
@@ -20,6 +20,7 @@ spring:
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
ip: @server.url@
|
||||
server-addr: @nacos.url@
|
||||
namespace: @nacos.namespace@
|
||||
config:
|
||||
|
||||
@@ -21,6 +21,7 @@ spring:
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
ip: @server.url@
|
||||
server-addr: @nacos.url@
|
||||
namespace: @nacos.namespace@
|
||||
config:
|
||||
|
||||
Reference in New Issue
Block a user