模板导入功能
This commit is contained in:
@@ -24,7 +24,7 @@ public class AlmDto implements Serializable {
|
|||||||
@NotNull(message = "告警事件名称,不为空")
|
@NotNull(message = "告警事件名称,不为空")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@SerializedName("IDX")
|
@SerializedName("Idx")
|
||||||
@NotNull(message = "告警事件编号,不为空")
|
@NotNull(message = "告警事件编号,不为空")
|
||||||
private Integer idx;
|
private Integer idx;
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ public class BmdDto implements Serializable {
|
|||||||
@NotNull(message = "数据名称,不为空")
|
@NotNull(message = "数据名称,不为空")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@SerializedName("IDX")
|
@SerializedName("Idx")
|
||||||
@NotNull(message = "数据编号,不为空")
|
@NotNull(message = "数据编号,不为空")
|
||||||
private Integer idx;
|
private Integer idx;
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ public class CtrlDto implements Serializable {
|
|||||||
@NotNull(message = "控制名称,不为空")
|
@NotNull(message = "控制名称,不为空")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@SerializedName("IDX")
|
@SerializedName("Idx")
|
||||||
@NotNull(message = "控制编号,不为空")
|
@NotNull(message = "控制编号,不为空")
|
||||||
private Integer idx;
|
private Integer idx;
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public class DoDto implements Serializable {
|
|||||||
@NotNull(message = "开出信号名称,不为空")
|
@NotNull(message = "开出信号名称,不为空")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@SerializedName("IDX")
|
@SerializedName("Idx")
|
||||||
@NotNull(message = "DO编号,不为空")
|
@NotNull(message = "DO编号,不为空")
|
||||||
private Integer idx;
|
private Integer idx;
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ public class EpdPqdDto implements Serializable {
|
|||||||
@NotNull(message = "数据名称,不为空")
|
@NotNull(message = "数据名称,不为空")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@SerializedName("IDX")
|
@SerializedName("Idx")
|
||||||
@NotNull(message = "数据编号,不为空")
|
@NotNull(message = "数据编号,不为空")
|
||||||
private Integer idx;
|
private Integer idx;
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ public class EvtDto implements Serializable {
|
|||||||
@NotNull(message = "事件信息名称,不为空")
|
@NotNull(message = "事件信息名称,不为空")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@SerializedName("IDX")
|
@SerializedName("Idx")
|
||||||
@NotNull(message = "事件编号,不为空")
|
@NotNull(message = "事件编号,不为空")
|
||||||
private Integer idx;
|
private Integer idx;
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ public class ParmDto implements Serializable {
|
|||||||
@NotNull(message = "参数名称,不为空")
|
@NotNull(message = "参数名称,不为空")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@SerializedName("IDX")
|
@SerializedName("Idx")
|
||||||
@NotNull(message = "参数编号,不为空")
|
@NotNull(message = "参数编号,不为空")
|
||||||
private Integer idx;
|
private Integer idx;
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ public class SetDto implements Serializable {
|
|||||||
@NotNull(message = "参数名称,不为空")
|
@NotNull(message = "参数名称,不为空")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@SerializedName("IDX")
|
@SerializedName("Idx")
|
||||||
@NotNull(message = "参数编号,不为空")
|
@NotNull(message = "参数编号,不为空")
|
||||||
private Integer idx;
|
private Integer idx;
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ public class StsDto implements Serializable {
|
|||||||
@NotNull(message = "状态名称,不为空")
|
@NotNull(message = "状态名称,不为空")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@SerializedName("IDX")
|
@SerializedName("Idx")
|
||||||
@NotNull(message = "状态编号,不为空")
|
@NotNull(message = "状态编号,不为空")
|
||||||
private Integer idx;
|
private Integer idx;
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ public class ApfDto implements Serializable {
|
|||||||
@NotNull(message = "数据名称,不为空")
|
@NotNull(message = "数据名称,不为空")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@SerializedName("IDX")
|
@SerializedName("Idx")
|
||||||
@NotNull(message = "数据编号,不为空")
|
@NotNull(message = "数据编号,不为空")
|
||||||
private Integer idx;
|
private Integer idx;
|
||||||
|
|
||||||
|
|||||||
@@ -43,14 +43,6 @@ public class TemplateDto implements Serializable {
|
|||||||
@ApiModelProperty(value = "逻辑子设备序列")
|
@ApiModelProperty(value = "逻辑子设备序列")
|
||||||
private List<ClDevDto> clDevDtoList;
|
private List<ClDevDto> clDevDtoList;
|
||||||
|
|
||||||
@SerializedName("SoftInfo")
|
|
||||||
@NotEmpty(message = "软件信息,不可为空")
|
|
||||||
private List<SoftInfoDto> softInfoDto;
|
|
||||||
|
|
||||||
@SerializedName("LdevInfo")
|
|
||||||
@NotEmpty(message = "设备信息,不可为空")
|
|
||||||
private List<LDevInfoDto> lDevInfoDto;
|
|
||||||
|
|
||||||
@SerializedName("Apf")
|
@SerializedName("Apf")
|
||||||
@NotEmpty(message = "谐波治理设备Apf,不可为空")
|
@NotEmpty(message = "谐波治理设备Apf,不可为空")
|
||||||
private List<ApfDto> apfDto;
|
private List<ApfDto> apfDto;
|
||||||
|
|||||||
12
iot-access/access-boot/Dockerfile
Normal file
12
iot-access/access-boot/Dockerfile
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
FROM eclipse-temurin:8-jdk-centos7
|
||||||
|
MAINTAINER hongawen_13914774158@163.com
|
||||||
|
ENV JAVA_OPTS="-Xms1024m -Xmx1024m"
|
||||||
|
# 挂载时区的目录
|
||||||
|
VOLUME /usr/share/zoneinfo
|
||||||
|
# 设置时区为上海
|
||||||
|
ENV TZ=Asia/Shanghai
|
||||||
|
# 设置时区信息
|
||||||
|
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
||||||
|
ADD target/accessboot.jar accessboot.jar
|
||||||
|
ENTRYPOINT java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar /accessboot.jar
|
||||||
|
EXPOSE 10301
|
||||||
@@ -87,7 +87,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>com.spotify</groupId>
|
<groupId>com.spotify</groupId>
|
||||||
<artifactId>docker-maven-plugin</artifactId>
|
<artifactId>docker-maven-plugin</artifactId>
|
||||||
<version>1.0.0</version>
|
<version>1.2.2</version>
|
||||||
<executions>
|
<executions>
|
||||||
<!--执行mvn package,即执行 mvn clean package docker:build-->
|
<!--执行mvn package,即执行 mvn clean package docker:build-->
|
||||||
<execution>
|
<execution>
|
||||||
|
|||||||
@@ -14,10 +14,8 @@ import io.swagger.annotations.ApiOperation;
|
|||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 类的介绍:
|
* 类的介绍:
|
||||||
@@ -38,10 +36,9 @@ public class CsDevModelController extends BaseController {
|
|||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/addModel")
|
@PostMapping("/addModel")
|
||||||
@ApiOperation("新增设备模板")
|
@ApiOperation("新增设备模板")
|
||||||
@ApiImplicitParam(name = "devModelParam", value = "设备模板参数", required = true)
|
public HttpResult<String> addModel(@RequestPart("file") @Validated MultipartFile file){
|
||||||
public HttpResult<String> addModel(@RequestBody @Validated DevModelParam devModelParam){
|
|
||||||
String methodDescribe = getMethodDescribe("addModel");
|
String methodDescribe = getMethodDescribe("addModel");
|
||||||
csDevModelService.addModel(devModelParam);
|
csDevModelService.addModel(file);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package com.njcn.access.service;
|
package com.njcn.access.service;
|
||||||
|
|
||||||
import com.njcn.access.pojo.param.DevModelParam;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 类的介绍:
|
* 类的介绍:
|
||||||
@@ -14,8 +14,8 @@ public interface ICsDevModelService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 解析模板文件->入库
|
* 解析模板文件->入库
|
||||||
* @param devModelParam
|
* @param file
|
||||||
*/
|
*/
|
||||||
void addModel(DevModelParam devModelParam);
|
void addModel(MultipartFile file);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,15 +2,22 @@ package com.njcn.access.service.impl;
|
|||||||
|
|
||||||
import com.alibaba.nacos.shaded.com.google.gson.Gson;
|
import com.alibaba.nacos.shaded.com.google.gson.Gson;
|
||||||
import com.njcn.access.pojo.dto.devModel.TemplateDto;
|
import com.njcn.access.pojo.dto.devModel.TemplateDto;
|
||||||
import com.njcn.access.pojo.param.DevModelParam;
|
|
||||||
import com.njcn.access.service.ICsDevModelService;
|
import com.njcn.access.service.ICsDevModelService;
|
||||||
import com.njcn.access.utils.JsonUtil;
|
import com.njcn.access.utils.JsonUtil;
|
||||||
import com.njcn.oss.constant.OssPath;
|
import com.njcn.csdevice.api.DevModelFeignClient;
|
||||||
|
import com.njcn.csdevice.pojo.param.CsDevModelAddParm;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsDevModelPO;
|
||||||
import com.njcn.oss.utils.FileStorageUtil;
|
import com.njcn.oss.utils.FileStorageUtil;
|
||||||
|
import com.njcn.system.api.DictTreeFeignClient;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.sql.Date;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 类的介绍:
|
* 类的介绍:
|
||||||
@@ -25,20 +32,44 @@ public class CsDevModelServiceImpl implements ICsDevModelService {
|
|||||||
|
|
||||||
private final FileStorageUtil fileStorageUtil;
|
private final FileStorageUtil fileStorageUtil;
|
||||||
|
|
||||||
|
private final DevModelFeignClient devModelFeignClient;
|
||||||
|
|
||||||
|
private final DictTreeFeignClient dictTreeFeignClient;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addModel(DevModelParam devModelParam) {
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void addModel(MultipartFile file) {
|
||||||
String json = null;
|
String json = null;
|
||||||
try {
|
try {
|
||||||
json = JsonUtil.convertStreamToString(devModelParam.getFile().getInputStream());
|
json = JsonUtil.convertStreamToString(file.getInputStream());
|
||||||
Gson gson = new Gson();
|
Gson gson = new Gson();
|
||||||
TemplateDto templateDto = gson.fromJson(json, TemplateDto.class);
|
TemplateDto templateDto = gson.fromJson(json, TemplateDto.class);
|
||||||
//模板文件存入文件服务器
|
//模板文件存入文件服务器
|
||||||
//String filePath = fileStorageUtil.uploadMultipart(devModelParam.getFile(), OssPath.DEV_MODEL + devModelParam.getDevType() + "_");
|
//String filePath = fileStorageUtil.uploadMultipart(devModelParam.getFile(), OssPath.DEV_MODEL + devModelParam.getDevType() + "_");
|
||||||
String filePath = "";
|
String filePath = "";
|
||||||
System.out.println("templateDto==:" + templateDto);
|
//1.录入cs_dev_model表,记录装置型号和模板记录
|
||||||
|
addCsDevModel(templateDto,filePath);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增cs_dev_model数据
|
||||||
|
*/
|
||||||
|
private CsDevModelPO addCsDevModel(TemplateDto templateDto, String filePath){
|
||||||
|
CsDevModelAddParm csDevModelAddParm = new CsDevModelAddParm();
|
||||||
|
csDevModelAddParm.setDevTypeName(templateDto.getDevType());
|
||||||
|
csDevModelAddParm.setName(templateDto.getDevType());
|
||||||
|
csDevModelAddParm.setVersionNo(templateDto.getVersion());
|
||||||
|
csDevModelAddParm.setTime(templateDto.getTime());
|
||||||
|
csDevModelAddParm.setFilePath(filePath);
|
||||||
|
CsDevModelPO csDevModel = devModelFeignClient.addDevModel(csDevModelAddParm).getData();
|
||||||
|
return csDevModel;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ public class CsDeviceServiceImpl implements ICsDeviceService {
|
|||||||
}
|
}
|
||||||
//3.判断客户端是否在线
|
//3.判断客户端是否在线
|
||||||
//mqttUtil.judgeClientOnline(nDid);
|
//mqttUtil.judgeClientOnline(nDid);
|
||||||
boolean mqttClient = mqttUtil.judgeClientOnline("access-boot123456");
|
boolean mqttClient = mqttUtil.judgeClientOnline("access-boot1234567");
|
||||||
if (!mqttClient){
|
if (!mqttClient){
|
||||||
throw new BusinessException(AccessResponseEnum.MISSING_CLIENT);
|
throw new BusinessException(AccessResponseEnum.MISSING_CLIENT);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,8 +33,6 @@ spring:
|
|||||||
refresh: true
|
refresh: true
|
||||||
- data-Id: algorithm-config.yaml
|
- data-Id: algorithm-config.yaml
|
||||||
refresh: true
|
refresh: true
|
||||||
- data-Id: kafka-config.yaml
|
|
||||||
refresh: true
|
|
||||||
main:
|
main:
|
||||||
allow-bean-definition-overriding: true
|
allow-bean-definition-overriding: true
|
||||||
|
|
||||||
@@ -52,4 +50,4 @@ mybatis-plus:
|
|||||||
|
|
||||||
|
|
||||||
mqtt:
|
mqtt:
|
||||||
client-id: access-boot123456
|
client-id: access-boot1234567
|
||||||
3
pom.xml
3
pom.xml
@@ -36,11 +36,12 @@
|
|||||||
<!--微服务模块发布地址-->
|
<!--微服务模块发布地址-->
|
||||||
<service.server.url>192.168.1.139</service.server.url>
|
<service.server.url>192.168.1.139</service.server.url>
|
||||||
<!--docker仓库地址-->
|
<!--docker仓库地址-->
|
||||||
<docker.server.url>192.168.1.31</docker.server.url>
|
<docker.server.url>192.168.1.13</docker.server.url>
|
||||||
<!--nacos的ip:port-->
|
<!--nacos的ip:port-->
|
||||||
<nacos.url>${middle.server.url}:18848</nacos.url>
|
<nacos.url>${middle.server.url}:18848</nacos.url>
|
||||||
<!--服务器发布内容为空-->
|
<!--服务器发布内容为空-->
|
||||||
<nacos.namespace>415a1c87-33aa-47bd-8e25-13cc456c87ed</nacos.namespace>
|
<nacos.namespace>415a1c87-33aa-47bd-8e25-13cc456c87ed</nacos.namespace>
|
||||||
|
<!-- <nacos.namespace>3eaa4bd1-bfb6-497b-aba2-47edda305427</nacos.namespace>-->
|
||||||
<!--sentinel:port-->
|
<!--sentinel:port-->
|
||||||
<sentinel.url>${middle.server.url}:8080</sentinel.url>
|
<sentinel.url>${middle.server.url}:8080</sentinel.url>
|
||||||
<!--网关地址,主要用于配置swagger中认证token-->
|
<!--网关地址,主要用于配置swagger中认证token-->
|
||||||
|
|||||||
Reference in New Issue
Block a user