1.新增字典功能
2.RocketMQ新增治理消息模板
This commit is contained in:
@@ -38,6 +38,9 @@ public interface ServerInfo {
|
|||||||
String CS_HARMONIC_BOOT = "cs-harmonic-boot";
|
String CS_HARMONIC_BOOT = "cs-harmonic-boot";
|
||||||
|
|
||||||
String CS_REPORT_BOOT = "cs-report-boot";
|
String CS_REPORT_BOOT = "cs-report-boot";
|
||||||
|
String CS_STAT_BOOT = "stat-boot";
|
||||||
|
String CS_RT_BOOT = "rt-boot";
|
||||||
|
String CS_ZL_EVENT_BOOT = "zl-event-boot";
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -473,5 +473,56 @@ public class PubUtils {
|
|||||||
return new String(result);
|
return new String(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将字节数组转成Float数组
|
||||||
|
* @param bytes
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static List<Float> byteArrayToFloatList(byte[] bytes){
|
||||||
|
List<Float> d = new ArrayList<>(bytes.length/8);
|
||||||
|
byte[] doubleBuffer = new byte[4];
|
||||||
|
for(int j = 0; j < bytes.length; j += 4) {
|
||||||
|
System.arraycopy(bytes, j, doubleBuffer, 0, doubleBuffer.length);
|
||||||
|
d.add(bytes2Float(doubleBuffer));
|
||||||
|
}
|
||||||
|
return d;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static float bytes2Float(byte[] arr) {
|
||||||
|
int accum = 0;
|
||||||
|
accum = accum|(arr[0] & 0xff);
|
||||||
|
accum = accum|(arr[1] & 0xff) << 8;
|
||||||
|
accum = accum|(arr[2] & 0xff) << 16;
|
||||||
|
accum = accum|(arr[3] & 0xff) << 24;
|
||||||
|
return Float.intBitsToFloat(accum);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将字节数组转成Double数组
|
||||||
|
* @param arr
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static List<Double> byteArrayToDoubleList(byte[] arr){
|
||||||
|
List<Double> d = new ArrayList<>(arr.length/8);
|
||||||
|
byte[] doubleBuffer = new byte[8];
|
||||||
|
for(int j = 0; j < arr.length; j += 8) {
|
||||||
|
System.arraycopy(arr, j, doubleBuffer, 0, doubleBuffer.length);
|
||||||
|
d.add(bytes2Double(doubleBuffer));
|
||||||
|
}
|
||||||
|
return d;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将byte转换成double
|
||||||
|
* @param arr
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static double bytes2Double(byte[] arr) {
|
||||||
|
long value = 0;
|
||||||
|
for (int i = 0; i < 8; i++) {
|
||||||
|
value |= ((long) (arr[i] & 0xff)) << (8 * i);
|
||||||
|
}
|
||||||
|
return Double.longBitsToDouble(value);
|
||||||
|
}
|
||||||
//***************************************************添加结束********************************************************
|
//***************************************************添加结束********************************************************
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,4 +12,13 @@ public interface BusinessTopic {
|
|||||||
*/
|
*/
|
||||||
String NJCJ_USER_TOPIC = "njcnUserTopic";
|
String NJCJ_USER_TOPIC = "njcnUserTopic";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 治理主送推送数据接收主题
|
||||||
|
*/
|
||||||
|
String NJCJ_APP_AUTO_DATA_TOPIC = "njcnAppAutoDataTopic";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 治理事件接收主题
|
||||||
|
*/
|
||||||
|
String NJCJ_APP_EVENT_TOPIC = "njcnAppEventTopic";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,71 @@
|
|||||||
|
package com.njcn.mq.message;
|
||||||
|
|
||||||
|
import com.njcn.middle.rocket.domain.BaseMessage;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类的介绍:
|
||||||
|
*
|
||||||
|
* @author xuyang
|
||||||
|
* @version 1.0.0
|
||||||
|
* @createTime 2023/8/11 15:06
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class AppAutoDataMessage extends BaseMessage {
|
||||||
|
|
||||||
|
@ApiModelProperty("网络设备码")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
private Integer mid;
|
||||||
|
|
||||||
|
@ApiModelProperty("逻辑设备 治理逻辑设备为1 电能质量设备为2")
|
||||||
|
private Integer did;
|
||||||
|
|
||||||
|
private Integer pri;
|
||||||
|
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
private Msg msg;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class Msg{
|
||||||
|
|
||||||
|
@ApiModelProperty("逻辑子设备 治理逻辑设备为0 电能质量设备为1、2")
|
||||||
|
private Integer clDid;
|
||||||
|
|
||||||
|
private Integer dataType;
|
||||||
|
|
||||||
|
@ApiModelProperty("数据属性:无-0、实时-1、统计-2")
|
||||||
|
private Integer dataAttr;
|
||||||
|
|
||||||
|
private Integer dsNameIdx;
|
||||||
|
|
||||||
|
private List<DataArray> dataArray;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class DataArray{
|
||||||
|
|
||||||
|
@ApiModelProperty("数据属性 1-Max 2-Min 3-Avg 4-Cp95")
|
||||||
|
private Integer dataAttr;
|
||||||
|
|
||||||
|
private Long dataTimeSec;
|
||||||
|
|
||||||
|
private Integer dataTimeUSec;
|
||||||
|
|
||||||
|
@ApiModelProperty("数据是否参与合格率统计")
|
||||||
|
private Integer dataTag;
|
||||||
|
|
||||||
|
private String data;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package com.njcn.mq.template;
|
||||||
|
|
||||||
|
import com.njcn.middle.rocket.template.RocketMQEnhanceTemplate;
|
||||||
|
import com.njcn.mq.constant.BusinessTopic;
|
||||||
|
import com.njcn.mq.message.AppAutoDataMessage;
|
||||||
|
import org.apache.rocketmq.client.producer.SendResult;
|
||||||
|
import org.apache.rocketmq.spring.core.RocketMQTemplate;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类的介绍:
|
||||||
|
*
|
||||||
|
* @author xuyang
|
||||||
|
* @version 1.0.0
|
||||||
|
* @createTime 2023/8/11 15:28
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class AppAutoDataMessageTemplate extends RocketMQEnhanceTemplate {
|
||||||
|
|
||||||
|
public AppAutoDataMessageTemplate(RocketMQTemplate template) {
|
||||||
|
super(template);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SendResult sendMember(AppAutoDataMessage appAutoDataMessage) {
|
||||||
|
return send(BusinessTopic.NJCJ_APP_AUTO_DATA_TOPIC, "CREATE", appAutoDataMessage);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -151,4 +151,9 @@ public interface InfluxDBTableConstant {
|
|||||||
*/
|
*/
|
||||||
String END_TIME = " 23:59:59";
|
String END_TIME = " 23:59:59";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据是否异常
|
||||||
|
*/
|
||||||
|
String IS_ABNORMAL = "is_abnormal";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,20 +1,12 @@
|
|||||||
package com.njcn.system.api;
|
package com.njcn.system.api;
|
||||||
|
|
||||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
|
||||||
import com.njcn.common.pojo.constant.ServerInfo;
|
import com.njcn.common.pojo.constant.ServerInfo;
|
||||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
|
||||||
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.LogUtil;
|
|
||||||
import com.njcn.system.api.fallback.EpdFeignClientFallbackFactory;
|
import com.njcn.system.api.fallback.EpdFeignClientFallbackFactory;
|
||||||
|
import com.njcn.system.pojo.dto.EpdDTO;
|
||||||
import com.njcn.system.pojo.param.EleEpdPqdParam;
|
import com.njcn.system.pojo.param.EleEpdPqdParam;
|
||||||
import com.njcn.system.pojo.po.EleEpdPqd;
|
import com.njcn.system.pojo.po.EleEpdPqd;
|
||||||
import io.swagger.annotations.ApiImplicitParam;
|
|
||||||
import io.swagger.annotations.ApiImplicitParams;
|
|
||||||
import io.swagger.annotations.ApiOperation;
|
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
@@ -53,4 +45,7 @@ public interface EpdFeignClient {
|
|||||||
|
|
||||||
@PostMapping("/findByParam")
|
@PostMapping("/findByParam")
|
||||||
HttpResult<EleEpdPqd> findByParam(@RequestParam("name") String name, @RequestParam("dataType") String dataType, @RequestParam("phase") String phase);
|
HttpResult<EleEpdPqd> findByParam(@RequestParam("name") String name, @RequestParam("dataType") String dataType, @RequestParam("phase") String phase);
|
||||||
|
|
||||||
|
@PostMapping("/findAll")
|
||||||
|
HttpResult<List<EpdDTO>> findAll();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ 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;
|
||||||
import com.njcn.system.api.EpdFeignClient;
|
import com.njcn.system.api.EpdFeignClient;
|
||||||
|
import com.njcn.system.pojo.dto.EpdDTO;
|
||||||
import com.njcn.system.pojo.param.EleEpdPqdParam;
|
import com.njcn.system.pojo.param.EleEpdPqdParam;
|
||||||
import com.njcn.system.pojo.po.EleEpdPqd;
|
import com.njcn.system.pojo.po.EleEpdPqd;
|
||||||
import com.njcn.system.utils.SystemEnumUtil;
|
import com.njcn.system.utils.SystemEnumUtil;
|
||||||
@@ -81,6 +82,12 @@ public class EpdFeignClientFallbackFactory implements FallbackFactory<EpdFeignCl
|
|||||||
log.error("{}异常,降级处理,异常为:{}","根据条件查询字典数据",cause.toString());
|
log.error("{}异常,降级处理,异常为:{}","根据条件查询字典数据",cause.toString());
|
||||||
throw new BusinessException(finalExceptionEnum);
|
throw new BusinessException(finalExceptionEnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpResult<List<EpdDTO>> findAll() {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}","查询所有字典数据",cause.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package com.njcn.system.pojo.dto;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类的介绍:
|
||||||
|
*
|
||||||
|
* @author xuyang
|
||||||
|
* @version 1.0.0
|
||||||
|
* @createTime 2023/8/14 20:28
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class EpdDTO {
|
||||||
|
|
||||||
|
@ApiModelProperty("指标名称")
|
||||||
|
private String dictName;
|
||||||
|
|
||||||
|
@ApiModelProperty("inflxuDB表名")
|
||||||
|
private String tableName;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -8,6 +8,7 @@ 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;
|
||||||
import com.njcn.common.utils.LogUtil;
|
import com.njcn.common.utils.LogUtil;
|
||||||
|
import com.njcn.system.pojo.dto.EpdDTO;
|
||||||
import com.njcn.system.pojo.param.EleEpdPqdParam;
|
import com.njcn.system.pojo.param.EleEpdPqdParam;
|
||||||
import com.njcn.system.pojo.po.EleEpdPqd;
|
import com.njcn.system.pojo.po.EleEpdPqd;
|
||||||
import com.njcn.system.pojo.vo.EleEpdPqdListVO;
|
import com.njcn.system.pojo.vo.EleEpdPqdListVO;
|
||||||
@@ -192,5 +193,15 @@ public class EleEpdPqdController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, eleEpdPqd, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, eleEpdPqd, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/findAll")
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@ApiOperation("查询所有字典数据")
|
||||||
|
@ApiIgnore
|
||||||
|
public HttpResult<List<EpdDTO>> findAll(){
|
||||||
|
String methodDescribe = getMethodDescribe("findAll");
|
||||||
|
List<EpdDTO> list = eleEpdPqdService.findAll();
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,10 +3,13 @@ package com.njcn.system.mapper;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.njcn.system.pojo.dto.EpdDTO;
|
||||||
import com.njcn.system.pojo.po.EleEpdPqd;
|
import com.njcn.system.pojo.po.EleEpdPqd;
|
||||||
import com.njcn.system.pojo.vo.EleEpdPqdVO;
|
import com.njcn.system.pojo.vo.EleEpdPqdVO;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* Mapper 接口
|
* Mapper 接口
|
||||||
@@ -19,4 +22,6 @@ public interface EleEpdPqdMapper extends BaseMapper<EleEpdPqd> {
|
|||||||
|
|
||||||
Page<EleEpdPqdVO> page(@Param("page")Page<EleEpdPqdVO> page, @Param("ew") QueryWrapper<EleEpdPqdVO> queryWrapper);
|
Page<EleEpdPqdVO> page(@Param("page")Page<EleEpdPqdVO> page, @Param("ew") QueryWrapper<EleEpdPqdVO> queryWrapper);
|
||||||
|
|
||||||
|
List<EpdDTO> findAll();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,4 +44,15 @@
|
|||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="findAll" resultType="EpdDTO">
|
||||||
|
select
|
||||||
|
t0.Name dictName,
|
||||||
|
t1.Name tableName
|
||||||
|
from
|
||||||
|
ele_epd_pqd t0
|
||||||
|
left join sys_dict_data t1 on
|
||||||
|
t0.Class_Id = t1.Id
|
||||||
|
where t0.status = 1
|
||||||
|
group by t0.Name,t1.Name
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.njcn.system.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;
|
||||||
|
import com.njcn.system.pojo.dto.EpdDTO;
|
||||||
import com.njcn.system.pojo.param.EleEpdPqdParam;
|
import com.njcn.system.pojo.param.EleEpdPqdParam;
|
||||||
import com.njcn.system.pojo.po.EleEpdPqd;
|
import com.njcn.system.pojo.po.EleEpdPqd;
|
||||||
import com.njcn.system.pojo.vo.EleEpdPqdListVO;
|
import com.njcn.system.pojo.vo.EleEpdPqdListVO;
|
||||||
@@ -103,4 +104,10 @@ public interface IEleEpdPqdService extends IService<EleEpdPqd> {
|
|||||||
*/
|
*/
|
||||||
EleEpdPqd findByParam(String name, String dataType, String phase);
|
EleEpdPqd findByParam(String name, String dataType, String phase);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询指标和influxDB表关系
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<EpdDTO> findAll();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import com.njcn.common.pojo.exception.BusinessException;
|
|||||||
import com.njcn.db.constant.DbConstant;
|
import com.njcn.db.constant.DbConstant;
|
||||||
import com.njcn.system.enums.SystemResponseEnum;
|
import com.njcn.system.enums.SystemResponseEnum;
|
||||||
import com.njcn.system.mapper.EleEpdPqdMapper;
|
import com.njcn.system.mapper.EleEpdPqdMapper;
|
||||||
|
import com.njcn.system.pojo.dto.EpdDTO;
|
||||||
import com.njcn.system.pojo.param.EleEpdPqdParam;
|
import com.njcn.system.pojo.param.EleEpdPqdParam;
|
||||||
import com.njcn.system.pojo.po.DictData;
|
import com.njcn.system.pojo.po.DictData;
|
||||||
import com.njcn.system.pojo.po.EleEpdPqd;
|
import com.njcn.system.pojo.po.EleEpdPqd;
|
||||||
@@ -206,6 +207,11 @@ public class EleEpdPqdServiceImpl extends ServiceImpl<EleEpdPqdMapper, EleEpdPqd
|
|||||||
return this.baseMapper.selectOne(lambdaQueryWrapper);
|
return this.baseMapper.selectOne(lambdaQueryWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<EpdDTO> findAll() {
|
||||||
|
return this.baseMapper.findAll();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验参数,
|
* 校验参数,
|
||||||
* 1.检查是否存在相同名称的菜单
|
* 1.检查是否存在相同名称的菜单
|
||||||
|
|||||||
Reference in New Issue
Block a user