{
+
+}
diff --git a/iot-access/access-boot/src/main/java/com/njcn/access/mapper/mapping/CsEpdPqdMapper.xml b/iot-access/access-boot/src/main/java/com/njcn/access/mapper/mapping/CsEpdPqdMapper.xml
new file mode 100644
index 0000000..2f88bd5
--- /dev/null
+++ b/iot-access/access-boot/src/main/java/com/njcn/access/mapper/mapping/CsEpdPqdMapper.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/iot-access/access-boot/src/main/java/com/njcn/access/service/IAccessService.java b/iot-access/access-boot/src/main/java/com/njcn/access/service/IAccessService.java
index d4e59e6..7ccdbc8 100644
--- a/iot-access/access-boot/src/main/java/com/njcn/access/service/IAccessService.java
+++ b/iot-access/access-boot/src/main/java/com/njcn/access/service/IAccessService.java
@@ -12,5 +12,5 @@ public interface IAccessService {
* 3.装置响应则修改装置状态;3分钟未响应则生成告警信息
* @param nDid 网关识别码
*/
- Boolean add(String nDid);
+ void add(String nDid);
}
diff --git a/iot-access/access-boot/src/main/java/com/njcn/access/service/ICsEpdPqdService.java b/iot-access/access-boot/src/main/java/com/njcn/access/service/ICsEpdPqdService.java
index 688aacf..0eaf52c 100644
--- a/iot-access/access-boot/src/main/java/com/njcn/access/service/ICsEpdPqdService.java
+++ b/iot-access/access-boot/src/main/java/com/njcn/access/service/ICsEpdPqdService.java
@@ -1,8 +1,11 @@
package com.njcn.access.service;
import com.baomidou.mybatisplus.extension.service.IService;
+import com.github.jeffreyning.mybatisplus.service.IMppService;
import com.njcn.access.pojo.po.CsEpdPqdPO;
+import java.util.List;
+
/**
*
* 服务类
@@ -11,6 +14,7 @@ import com.njcn.access.pojo.po.CsEpdPqdPO;
* @author xuyang
* @since 2023-05-11
*/
-public interface ICsEpdPqdService extends IService {
+public interface ICsEpdPqdService {
+ void saveData(List list);
}
diff --git a/iot-access/access-boot/src/main/java/com/njcn/access/service/ICsNetDevService.java b/iot-access/access-boot/src/main/java/com/njcn/access/service/ICsNetDevService.java
new file mode 100644
index 0000000..a45038d
--- /dev/null
+++ b/iot-access/access-boot/src/main/java/com/njcn/access/service/ICsNetDevService.java
@@ -0,0 +1,17 @@
+package com.njcn.access.service;
+
+import com.njcn.access.pojo.po.CsNetDevPO;
+
+/**
+ *
+ * 联网设备表 服务类
+ *
+ *
+ * @author xuyang
+ * @since 2023-05-17
+ */
+public interface ICsNetDevService {
+
+ boolean saveData(CsNetDevPO csNetDevPo);
+
+}
diff --git a/iot-access/access-boot/src/main/java/com/njcn/access/service/ICsPrjInfoService.java b/iot-access/access-boot/src/main/java/com/njcn/access/service/ICsPrjInfoService.java
new file mode 100644
index 0000000..f16296a
--- /dev/null
+++ b/iot-access/access-boot/src/main/java/com/njcn/access/service/ICsPrjInfoService.java
@@ -0,0 +1,18 @@
+package com.njcn.access.service;
+
+import com.njcn.access.pojo.po.CsPrjInfoPO;
+import com.njcn.access.pojo.po.CsSoftInfoPO;
+
+/**
+ *
+ * 工程信息表 服务类
+ *
+ *
+ * @author xuyang
+ * @since 2023-05-17
+ */
+public interface ICsPrjInfoService {
+
+ CsPrjInfoPO saveData(CsPrjInfoPO csPrjInfoPO);
+
+}
diff --git a/iot-access/access-boot/src/main/java/com/njcn/access/service/ICsSoftInfoService.java b/iot-access/access-boot/src/main/java/com/njcn/access/service/ICsSoftInfoService.java
new file mode 100644
index 0000000..e05bfe2
--- /dev/null
+++ b/iot-access/access-boot/src/main/java/com/njcn/access/service/ICsSoftInfoService.java
@@ -0,0 +1,17 @@
+package com.njcn.access.service;
+
+import com.njcn.access.pojo.po.CsSoftInfoPO;
+
+/**
+ *
+ * 系统软件表 服务类
+ *
+ *
+ * @author xuyang
+ * @since 2023-05-17
+ */
+public interface ICsSoftInfoService {
+
+ CsSoftInfoPO saveData(CsSoftInfoPO csSoftInfoPo);
+
+}
diff --git a/iot-access/access-boot/src/main/java/com/njcn/access/service/IDevModelService.java b/iot-access/access-boot/src/main/java/com/njcn/access/service/IDevModelService.java
index 283a972..a8e8cae 100644
--- a/iot-access/access-boot/src/main/java/com/njcn/access/service/IDevModelService.java
+++ b/iot-access/access-boot/src/main/java/com/njcn/access/service/IDevModelService.java
@@ -14,5 +14,5 @@ public interface IDevModelService {
* 2.将文件上传至文件服务器保存起来,先以装置型号-版本号-时间作为名称名称
* @param devModelParam 模板文件参数
*/
- HttpResult add(DevModelParam devModelParam);
+ void add(DevModelParam devModelParam);
}
diff --git a/iot-access/access-boot/src/main/java/com/njcn/access/service/serviceImpl/AccessServiceImpl.java b/iot-access/access-boot/src/main/java/com/njcn/access/service/serviceImpl/AccessServiceImpl.java
index df42c4e..7b2e520 100644
--- a/iot-access/access-boot/src/main/java/com/njcn/access/service/serviceImpl/AccessServiceImpl.java
+++ b/iot-access/access-boot/src/main/java/com/njcn/access/service/serviceImpl/AccessServiceImpl.java
@@ -1,18 +1,26 @@
package com.njcn.access.service.serviceImpl;
+import com.alibaba.csp.sentinel.util.TimeUtil;
import com.github.tocrhz.mqtt.publisher.MqttPublisher;
import com.njcn.access.enums.AccessEnum;
+import com.njcn.access.enums.AccessResponseEnum;
import com.njcn.access.enums.TypeEnum;
+import com.njcn.access.handler.MqttMessageHandler;
import com.njcn.access.pojo.dto.AccessDto;
import com.njcn.access.pojo.param.ReqAndResParam;
import com.njcn.access.service.IAccessService;
import com.njcn.algorithm.api.CsEdDataFeignClient;
import com.njcn.algorithm.api.EquipmentFeignClient;
-import com.njcn.algorithm.pojo.po.CsEdDataPO;
import com.njcn.algorithm.pojo.vo.CsEdDataVO;
import com.njcn.algorithm.pojo.vo.CsEquipmentDeliveryVO;
+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.common.utils.HttpResultUtil;
import com.njcn.common.utils.PubUtils;
+import com.njcn.redis.utils.RedisUtil;
+import com.njcn.system.api.DicDataFeignClient;
+import com.njcn.system.enums.DicDataEnum;
import lombok.AllArgsConstructor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -39,18 +47,49 @@ public class AccessServiceImpl implements IAccessService {
private final CsEdDataFeignClient csEdDataFeignClient;
+ private final DicDataFeignClient dicDataFeignClient;
+
+ private final RedisUtil redisUtil;
+
@Override
- public Boolean add(String nDid) {
+ public void add(String nDid) {
CsEquipmentDeliveryVO vo = equipmentFeignClient.queryEquipmentByndid(nDid).getData();
- System.out.println("vo==:" + vo);
if (Objects.isNull(vo.getNdid())){
logger.error("平台侧无此网关信息,请先录入!");
- return false;
+ throw new BusinessException(AccessResponseEnum.NDID_NO_FIND);
} else {
HttpResult result = csEdDataFeignClient.findByDevTypeId(vo.getDevModel());
- System.out.println("result==:" + result);
+ String typeId = result.getData().getType();
+ if(Objects.isNull(typeId)) {
+ logger.error("平台侧无此装置类型,请先录入!");
+ throw new BusinessException(AccessResponseEnum.DEV_TYPE_NOT_FIND);
+ } else {
+ String type = dicDataFeignClient.getDicDataById(typeId).getData().getCode();
+ if (Objects.equals(DicDataEnum.GATEWAY_DEV.getCode(),type)) {
+ //处理网关设备
+ System.out.println("网关");
+ } else if (Objects.equals(DicDataEnum.CONNECT_DEV.getCode(),type)) {
+ //处理直连设备
+ zhiLianRegister(nDid,vo.getDevModel());
+ } else {
+ logger.error("请求注册的装置类型错误(不是网关或者直连设备),请核查!");
+ throw new BusinessException(AccessResponseEnum.DEV_TYPE_ERROR);
+ }
+ }
}
+ try {
+ Thread.sleep(2000);
+ //这边使用redis缓存来判断装置是否连接MQTT
+ if(Objects.isNull(redisUtil.getObjectByKey(nDid))) {
+ logger.error("未收到装置注册响应,请核查!");
+ throw new BusinessException(AccessResponseEnum.NO_RECEIVE_FROM_DEV);
+ }
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ public void zhiLianRegister(String nDid,String devType) {
ReqAndResParam.Req reqAndResParam = new ReqAndResParam.Req();
reqAndResParam.setMid(1);
reqAndResParam.setDid("0");
@@ -59,9 +98,8 @@ public class AccessServiceImpl implements IAccessService {
reqAndResParam.setExpire(-1);
AccessDto accessDto = new AccessDto();
accessDto.setNDid(nDid);
- accessDto.setDevType(vo.getDevModel());
+ accessDto.setDevType(devType);
reqAndResParam.setMsg(accessDto);
publisher.send("/platform/register/"+nDid, PubUtils.obj2json(reqAndResParam),1,false);
- return true;
}
}
diff --git a/iot-access/access-boot/src/main/java/com/njcn/access/service/serviceImpl/CsEpdPqdServiceImpl.java b/iot-access/access-boot/src/main/java/com/njcn/access/service/serviceImpl/CsEpdPqdServiceImpl.java
index 4c1cdf6..b7bc748 100644
--- a/iot-access/access-boot/src/main/java/com/njcn/access/service/serviceImpl/CsEpdPqdServiceImpl.java
+++ b/iot-access/access-boot/src/main/java/com/njcn/access/service/serviceImpl/CsEpdPqdServiceImpl.java
@@ -1,11 +1,13 @@
package com.njcn.access.service.serviceImpl;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
import com.njcn.access.mapper.CsEpdPqdMapper;
import com.njcn.access.pojo.po.CsEpdPqdPO;
import com.njcn.access.service.ICsEpdPqdService;
import org.springframework.stereotype.Service;
+import java.util.List;
+
/**
*
* 服务实现类
@@ -15,6 +17,10 @@ import org.springframework.stereotype.Service;
* @since 2023-05-11
*/
@Service
-public class CsEpdPqdServiceImpl extends ServiceImpl implements ICsEpdPqdService {
+public class CsEpdPqdServiceImpl extends MppServiceImpl implements ICsEpdPqdService {
+ @Override
+ public void saveData(List list) {
+ this.saveOrUpdateBatchByMultiId(list,100);
+ }
}
diff --git a/iot-access/access-boot/src/main/java/com/njcn/access/service/serviceImpl/CsNetDevServiceImpl.java b/iot-access/access-boot/src/main/java/com/njcn/access/service/serviceImpl/CsNetDevServiceImpl.java
new file mode 100644
index 0000000..21391f5
--- /dev/null
+++ b/iot-access/access-boot/src/main/java/com/njcn/access/service/serviceImpl/CsNetDevServiceImpl.java
@@ -0,0 +1,39 @@
+package com.njcn.access.service.serviceImpl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.njcn.access.enums.AccessResponseEnum;
+import com.njcn.access.mapper.CsNetDevMapper;
+import com.njcn.access.pojo.po.CsNetDevPO;
+import com.njcn.access.service.ICsNetDevService;
+import com.njcn.common.pojo.exception.BusinessException;
+import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
+
+import java.util.Objects;
+
+/**
+ *
+ * 联网设备表 服务实现类
+ *
+ *
+ * @author xuyang
+ * @since 2023-05-17
+ */
+@Service
+public class CsNetDevServiceImpl extends ServiceImpl implements ICsNetDevService {
+
+ @Override
+ public boolean saveData(CsNetDevPO csNetDevPo) {
+ LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper();
+ lambdaQueryWrapper.eq(CsNetDevPO::getDevType,csNetDevPo.getDevType())
+ .eq(CsNetDevPO::getTime,csNetDevPo.getTime())
+ .eq(CsNetDevPO::getVersion,csNetDevPo.getVersion())
+ .eq(CsNetDevPO::getStatus,1);
+ CsNetDevPO po = this.baseMapper.selectOne(lambdaQueryWrapper);
+ if (!Objects.isNull(po)){
+ throw new BusinessException(AccessResponseEnum.MODEL_REPEAT);
+ }
+ return this.save(csNetDevPo);
+ }
+}
diff --git a/iot-access/access-boot/src/main/java/com/njcn/access/service/serviceImpl/CsPrjInfoServiceImpl.java b/iot-access/access-boot/src/main/java/com/njcn/access/service/serviceImpl/CsPrjInfoServiceImpl.java
new file mode 100644
index 0000000..280f1d3
--- /dev/null
+++ b/iot-access/access-boot/src/main/java/com/njcn/access/service/serviceImpl/CsPrjInfoServiceImpl.java
@@ -0,0 +1,25 @@
+package com.njcn.access.service.serviceImpl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.njcn.access.mapper.CsPrjInfoMapper;
+import com.njcn.access.pojo.po.CsPrjInfoPO;
+import com.njcn.access.service.ICsPrjInfoService;
+import org.springframework.stereotype.Service;
+
+/**
+ *
+ * 工程信息表 服务实现类
+ *
+ *
+ * @author xuyang
+ * @since 2023-05-17
+ */
+@Service
+public class CsPrjInfoServiceImpl extends ServiceImpl implements ICsPrjInfoService {
+
+ @Override
+ public CsPrjInfoPO saveData(CsPrjInfoPO csPrjInfoPo) {
+ this.save(csPrjInfoPo);
+ return csPrjInfoPo;
+ }
+}
diff --git a/iot-access/access-boot/src/main/java/com/njcn/access/service/serviceImpl/CsSoftInfoServiceImpl.java b/iot-access/access-boot/src/main/java/com/njcn/access/service/serviceImpl/CsSoftInfoServiceImpl.java
new file mode 100644
index 0000000..f83b24e
--- /dev/null
+++ b/iot-access/access-boot/src/main/java/com/njcn/access/service/serviceImpl/CsSoftInfoServiceImpl.java
@@ -0,0 +1,25 @@
+package com.njcn.access.service.serviceImpl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.njcn.access.mapper.CsSoftInfoMapper;
+import com.njcn.access.pojo.po.CsSoftInfoPO;
+import com.njcn.access.service.ICsSoftInfoService;
+import org.springframework.stereotype.Service;
+
+/**
+ *
+ * 系统软件表 服务实现类
+ *
+ *
+ * @author xuyang
+ * @since 2023-05-17
+ */
+@Service
+public class CsSoftInfoServiceImpl extends ServiceImpl implements ICsSoftInfoService {
+
+ @Override
+ public CsSoftInfoPO saveData(CsSoftInfoPO entity) {
+ this.save(entity);
+ return entity;
+ }
+}
diff --git a/iot-access/access-boot/src/main/java/com/njcn/access/service/serviceImpl/DevModelServiceImpl.java b/iot-access/access-boot/src/main/java/com/njcn/access/service/serviceImpl/DevModelServiceImpl.java
index f7dd889..3fb89cd 100644
--- a/iot-access/access-boot/src/main/java/com/njcn/access/service/serviceImpl/DevModelServiceImpl.java
+++ b/iot-access/access-boot/src/main/java/com/njcn/access/service/serviceImpl/DevModelServiceImpl.java
@@ -1,33 +1,37 @@
package com.njcn.access.service.serviceImpl;
+import cn.hutool.core.date.DatePattern;
import com.alibaba.nacos.shaded.com.google.gson.Gson;
import com.njcn.access.enums.AccessResponseEnum;
+import com.njcn.access.pojo.dto.data.BmdDto;
+import com.njcn.access.pojo.dto.data.EpdPqdDto;
import com.njcn.access.pojo.dto.devModel.*;
import com.njcn.access.pojo.param.DevModelParam;
-import com.njcn.access.service.IDevModelService;
+import com.njcn.access.pojo.po.*;
+import com.njcn.access.service.*;
import com.njcn.access.utils.JsonUtil;
+import com.njcn.algorithm.api.CsDictFeignClient;
import com.njcn.algorithm.api.DevModelFeignClient;
+import com.njcn.algorithm.pojo.dto.CsDictDTO;
import com.njcn.algorithm.pojo.param.CsDevModelAddParm;
-import com.njcn.algorithm.pojo.param.CsDevModelQueryListParm;
import com.njcn.algorithm.pojo.po.CsDevModelPO;
-import com.njcn.algorithm.pojo.vo.CsDevModelPageVO;
-import com.njcn.common.pojo.enums.response.CommonResponseEnum;
-import com.njcn.common.pojo.response.HttpResult;
-import com.njcn.common.utils.HttpResultUtil;
-import com.njcn.oss.constant.OssPath;
+import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.oss.utils.FileStorageUtil;
import com.njcn.system.api.DicDataFeignClient;
-import com.njcn.system.pojo.po.DictData;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
import java.io.IOException;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.Objects;
+import java.util.stream.Collectors;
/**
* 类的介绍:
@@ -47,71 +51,37 @@ public class DevModelServiceImpl implements IDevModelService {
private final DicDataFeignClient dicDataFeignClient;
+ private final CsDictFeignClient csDictFeignClient;
+
+ private final ICsNetDevService csNetDevService;
+
+ private final ICsSoftInfoService csSoftInfoService;
+
+ private final ICsPrjInfoService csPrjInfoService;
+
+ private final ICsEpdPqdService csEpdPqdService;
+
@Override
@Transactional(rollbackFor = Exception.class)
- public HttpResult add(DevModelParam devModelParam) {
+ public void add(DevModelParam devModelParam) {
String json = null;
try {
json = JsonUtil.convertStreamToString(devModelParam.getFile().getInputStream());
Gson gson = new Gson();
TemplateDto templateDto = gson.fromJson(json, TemplateDto.class);
+ //新增网关信息描述表
+// insertNetDevMod(templateDto.getNetDevModDto());
+ //模板文件存入文件服务器
+ //String filePath = fileStorageUtil.uploadMultipart(devModelParam.getFile(), OssPath.DEV_MODEL + devModelParam.getDevType() + "_");
+ String filePath = "";
+ //新增设备数据模板
+ insertDevMod(templateDto.getDevModDto(),filePath);
-// ParamDto pojo = templateDto.getParam();
-// //网关模板
-// NetDevModDto po1 = pojo.getDataArray().get(0).getTemplate().getNetDevModDto();
-// //装置信息模板
-// DevCfgDetailDto po2 = pojo.getDataArray().get(0).getTemplate().getDevCfgDetailDto();
-// //装置数据模板
-// List po3 = pojo.getDataArray().get(0).getTemplate().getDevModDetailDto();
-//
-// String name = po3.get(0).getName();
-// String version = po3.get(0).getVersion();
-// String time = po3.get(0).getTime();
-// String devType = po3.get(0).getDevType();
-// String devTypeId = "";
-//
-// DictData dicData = dicDataFeignClient.getDicDataByCode(devType).getData();
-// if (Objects.isNull(dicData)) {
-// log.info("新增模板失败,获取装置类型字典数据为空,请先录入装置类型!");
-// return HttpResultUtil.assembleResult(CommonResponseEnum.NO_DATA.getCode(), null, "获取装置类型字典数据为空!");
-// } else {
-// devTypeId = dicData.getId();
-// }
-// CsDevModelQueryListParm csDevModelQueryListParm = new CsDevModelQueryListParm();
-// csDevModelQueryListParm.setDevType(devTypeId);
-// csDevModelQueryListParm.setVersionNo(version);
-// csDevModelQueryListParm.setVersionDate(time);
-// csDevModelQueryListParm.setName(name);
-// CsDevModelPageVO vo = devModelFeignClient.queryDevModelOne(csDevModelQueryListParm).getData();
-// if (!Objects.isNull(vo)){
-// log.info("新增模板失败,新增的模板在库中存在!");
-// return HttpResultUtil.assembleResult(AccessResponseEnum.MODEL_REPEAT.getCode(), null, AccessResponseEnum.MODEL_REPEAT.getMessage());
-// } else {
-// CsDevModelAddParm csDevModelAddParm = new CsDevModelAddParm();
-// csDevModelAddParm.setName(name);
-// csDevModelAddParm.setDevType(devTypeId);
-// csDevModelAddParm.setVersionNo(version);
-// csDevModelAddParm.setVersionDate(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(time));
-// String filePath = fileStorageUtil.uploadMultipart(devModelParam.getFile(), OssPath.DEV_MODEL + devModelParam.getDevType() + "_");
-// log.info("文件路径为:" + filePath);
-// csDevModelAddParm.setFilePath(filePath);
-// //新增cs_dev_model表数据
-// CsDevModelPO csDevModelPO = devModelFeignClient.addDevModel(csDevModelAddParm).getData();
-// //新增cs_data_set
-//
-// //新增cs_data_array
-//
-// }
} catch (IOException e) {
log.error("文件转成json出现异常");
e.getMessage();
}
-// catch (ParseException e) {
-// log.error("时间转换出现异常");
-// e.getMessage();
-// }
- return HttpResultUtil.assembleResult(CommonResponseEnum.SUCCESS.getCode(), null, CommonResponseEnum.SUCCESS.getMessage());
}
/**
@@ -126,4 +96,115 @@ public class DevModelServiceImpl implements IDevModelService {
// });
// }
+ /**
+ * 新增直连设备、网关模板信息
+ */
+ public void insertNetDevMod(NetDevModDto netDevModDto) {
+ SoftInfoDto softInfoDto = netDevModDto.getDataList().get(0).getSoftInfoDto();
+ PrjInfoDto prjInfoDto = netDevModDto.getDataList().get(0).getPrjInfoDto();
+ CsNetDevPO csNetDevPo = new CsNetDevPO();
+ BeanUtils.copyProperties(netDevModDto,csNetDevPo);
+ csNetDevPo.setTime(LocalDate.parse(netDevModDto.getTime(), DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN)));
+ csNetDevPo.setStatus(1);
+ if (!Objects.isNull(softInfoDto)){
+ CsSoftInfoPO csSoftInfoPo = new CsSoftInfoPO();
+ BeanUtils.copyProperties(softInfoDto,csSoftInfoPo);
+ csSoftInfoPo.setAppDate(LocalDateTime.parse(softInfoDto.getAppDate(), DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN)));
+ String softInfoId = csSoftInfoService.saveData(csSoftInfoPo).getId();
+ csNetDevPo.setSoftInfoId(softInfoId);
+ }
+ if (!Objects.isNull(prjInfoDto)){
+ CsPrjInfoPO csPrjInfoPo = new CsPrjInfoPO();
+ BeanUtils.copyProperties(prjInfoDto,csPrjInfoPo);
+ String prjInfoId = csPrjInfoService.saveData(csPrjInfoPo).getId();
+ csNetDevPo.setPrjInfoId(prjInfoId);
+ }
+ csNetDevService.saveData(csNetDevPo);
+ }
+
+ /**
+ * 新增数据模板(装置类型分类)
+ */
+ public void insertDevMod(DevModDto devModDto,String filePath) {
+// String devType = devModDto.getDevType();
+// String version = devModDto.getVersion();
+// String time = devModDto.getTime();
+// CsDevModelPO csDevModelPo = devModelFeignClient.findModel(devType,version,time).getData();
+// if (!Objects.isNull(csDevModelPo)){
+// throw new BusinessException(AccessResponseEnum.MODEL_REPEAT);
+// }
+// //录入基础模板数据
+// CsDevModelAddParm csDevModelAddParm = new CsDevModelAddParm();
+// csDevModelAddParm.setDevType(devType);
+// csDevModelAddParm.setName(devType);
+// csDevModelAddParm.setVersionNo(version);
+// csDevModelAddParm.setVersionDate(LocalDateTime.parse(time, DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN)));
+// csDevModelAddParm.setFilePath(filePath);
+// SoftInfoDto softInfoDto = devModDto.getDataList().get(0).getSoftInfoDto();
+// //录入系统软件表
+// if (!Objects.isNull(softInfoDto)){
+// CsSoftInfoPO csSoftInfoPo = new CsSoftInfoPO();
+// BeanUtils.copyProperties(softInfoDto,csSoftInfoPo);
+// csSoftInfoPo.setAppDate(LocalDateTime.parse(softInfoDto.getAppDate(), DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN)));
+// String softInfoId = csSoftInfoService.saveData(csSoftInfoPo).getId();
+// csDevModelAddParm.setSoftInfoId(softInfoId);
+// }
+// devModelFeignClient.addDevModel(csDevModelAddParm);
+ //录入字典数据
+ //录入EPD
+ List epdDto = devModDto.getDataList().get(0).getEpdDto();
+ if (!CollectionUtils.isEmpty(epdDto)){
+ insertEpdPqd(epdDto);
+ }
+ //录入PQD
+ List pqdDto = devModDto.getDataList().get(0).getPqdDto();
+ if (!CollectionUtils.isEmpty(pqdDto)){
+ insertEpdPqd(pqdDto);
+ }
+ //录入Bmd
+ List bmdDto = devModDto.getDataList().get(0).getBmdDto();
+ if (!CollectionUtils.isEmpty(bmdDto)){
+ insertEpdPqd(pqdDto);
+ }
+
+
+
+ }
+
+ /**
+ * EPD、PQD字典录入
+ */
+ public void insertEpdPqd(List epdPqdDto) {
+ List list = epdPqdDto.stream().map(item->{
+ CsEpdPqdPO csEpdPqdPo = new CsEpdPqdPO();
+ BeanUtils.copyProperties(item,csEpdPqdPo);
+ CsDictDTO csDictDTO = csDictFeignClient.getOwnAndFatherData(item.getName()).getData();
+ if (Objects.isNull(item.getPhase())){
+ csEpdPqdPo.setPhase("M");
+ }
+ if (!CollectionUtils.isEmpty(item.getStatMethod())){
+ csEpdPqdPo.setStatMethod(item.getStatMethod().stream().map(String::valueOf).collect(Collectors.joining(",")));
+ }
+ csEpdPqdPo.setAnotherName(csDictDTO.getName());
+ csEpdPqdPo.setClassId(csDictDTO.getFatherName());
+ return csEpdPqdPo;
+ }).collect(Collectors.toList());
+ csEpdPqdService.saveData(list);
+ }
+
+ /**
+ * Bmd字典录入
+ */
+ public void insertBmd(List bmdDto) {
+ List list = bmdDto.stream().map(item->{
+ CsBmdPO csBmdPo = new CsBmdPO();
+ BeanUtils.copyProperties(item,csBmdPo);
+ CsDictDTO csDictDTO = csDictFeignClient.getOwnAndFatherData(item.getName()).getData();
+
+ return csBmdPo;
+ }).collect(Collectors.toList());
+ }
+
+
+
}
diff --git a/iot-access/pom.xml b/iot-access/pom.xml
index 3b1076f..a3c1748 100644
--- a/iot-access/pom.xml
+++ b/iot-access/pom.xml
@@ -54,6 +54,60 @@
velocity-engine-core
${velocity.version}
+
+ com.njcn
+ common-db
+ ${project.version}
+
+
+ com.njcn
+ common-web
+ ${project.version}
+
+
+ com.njcn
+ common-oss
+ ${project.version}
+
+
+ com.njcn
+ common-core
+ ${project.version}
+
+
+ com.njcn
+ common-redis
+ 1.0.0
+ compile
+
+
+ org.projectlombok
+ lombok
+
+
+ com.google.code.gson
+ gson
+ 2.8.9
+
+
+ org.springframework
+ spring-web
+
+
+ com.njcn
+ common-swagger
+ ${project.version}
+
+
+ com.alibaba.nacos
+ nacos-client
+
+
+
+ org.springframework.kafka
+ spring-kafka
+ ${kafka.version}
+