MQTT通讯功能联调
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
package com.njcn.access.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.csdevice.pojo.po.AppLineTopologyDiagramPO;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||
* Date: 2023/3/27 10:18【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public interface IAppLineTopologyDiagramService extends IService<AppLineTopologyDiagramPO> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.njcn.access.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.csdevice.pojo.param.CsDevModelRelationAddParm;
|
||||
import com.njcn.csdevice.pojo.param.CsDevModelRelationAuidtParm;
|
||||
import com.njcn.csdevice.pojo.param.CsDevModelRelationQueryParm;
|
||||
import com.njcn.csdevice.pojo.po.CsDevModelRelationPO;
|
||||
import com.njcn.csdevice.pojo.vo.CsDevModelRelationVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||
* Date: 2023/4/18 13:49【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public interface ICsDevModelRelationService extends IService<CsDevModelRelationPO>{
|
||||
|
||||
/**
|
||||
* 新增装置和模板的关系表
|
||||
* @param addParm
|
||||
* @return
|
||||
*/
|
||||
CsDevModelRelationPO addDevModelRelation(CsDevModelRelationAddParm addParm);
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.njcn.access.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.csdevice.pojo.po.CsDeviceUserPO;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* Date: 2023/6/27 9:40【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public interface ICsDeviceUserService extends IService<CsDeviceUserPO>{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.njcn.access.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.csdevice.pojo.param.CsEquipmentDeliveryAddParm;
|
||||
import com.njcn.csdevice.pojo.param.CsEquipmentDeliveryAuditParm;
|
||||
import com.njcn.csdevice.pojo.param.CsEquipmentDeliveryQueryParm;
|
||||
import com.njcn.csdevice.pojo.param.ProjectEquipmentQueryParm;
|
||||
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||
import com.njcn.csdevice.pojo.vo.CsEquipmentDeliveryVO;
|
||||
import com.njcn.csdevice.pojo.vo.DeviceManagerVO;
|
||||
import com.njcn.csdevice.pojo.vo.ProjectEquipmentVO;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||
* Date: 2023/3/30 16:23【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public interface ICsEquipmentDeliveryService extends IService<CsEquipmentDeliveryPO>{
|
||||
|
||||
/**
|
||||
* 根据网关id修改装置的状态
|
||||
* @param nDid 网关id
|
||||
*/
|
||||
void updateStatusBynDid(String nDid,Integer status);
|
||||
|
||||
/**
|
||||
* 根据网关id修改软件信息
|
||||
* @param nDid 网关id
|
||||
*/
|
||||
void updateSoftInfoBynDid(String nDid,String id);
|
||||
|
||||
/**
|
||||
* 根据网关id修改设备运行状态
|
||||
* @param nDid 网关id
|
||||
*/
|
||||
void updateRunStatusBynDid(String nDid,Integer id);
|
||||
|
||||
/**
|
||||
* 根据ndid查询装置信息
|
||||
* @param ndid
|
||||
* @return
|
||||
*/
|
||||
CsEquipmentDeliveryVO queryEquipmentByndid(String ndid);
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.njcn.access.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.csdevice.pojo.dto.LineParamDTO;
|
||||
import com.njcn.csdevice.pojo.param.CsLedgerParam;
|
||||
import com.njcn.csdevice.pojo.po.CsLedger;
|
||||
import com.njcn.csdevice.pojo.vo.CsLedgerVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 台账表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author xuyang
|
||||
* @since 2023-05-31
|
||||
*/
|
||||
public interface ICsLedgerService extends IService<CsLedger> {
|
||||
|
||||
/**
|
||||
* 新增台账数据
|
||||
* @param csLedgerParam
|
||||
*/
|
||||
CsLedger addLedgerTree(CsLedgerParam csLedgerParam);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.njcn.access.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* Date: 2023/5/18 14:01【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public interface ICsLineService extends IService<CsLinePO>{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.njcn.access.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.access.mapper.AppLineTopologyDiagramMapper;
|
||||
import com.njcn.access.service.IAppLineTopologyDiagramService;
|
||||
import com.njcn.csdevice.pojo.po.AppLineTopologyDiagramPO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||
* Date: 2023/3/27 10:18【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class AppLineTopologyDiagramServiceImpl extends ServiceImpl<AppLineTopologyDiagramMapper, AppLineTopologyDiagramPO> implements IAppLineTopologyDiagramService {
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.njcn.access.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.access.mapper.CsDevModelRelationMapper;
|
||||
import com.njcn.access.service.ICsDevModelRelationService;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
||||
import com.njcn.csdevice.pojo.param.CsDevModelRelationAddParm;
|
||||
import com.njcn.csdevice.pojo.param.CsDevModelRelationQueryParm;
|
||||
import com.njcn.csdevice.pojo.po.CsDevModelRelationPO;
|
||||
import com.njcn.csdevice.pojo.vo.CsDevModelRelationVO;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||
* Date: 2023/4/18 13:49【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Service
|
||||
public class CsDevModelRelationServiceImpl extends ServiceImpl<CsDevModelRelationMapper, CsDevModelRelationPO> implements ICsDevModelRelationService {
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public CsDevModelRelationPO addDevModelRelation(CsDevModelRelationAddParm addParm) {
|
||||
CsDevModelRelationQueryParm queryParm = new CsDevModelRelationQueryParm();
|
||||
queryParm.setDevId (addParm.getDevId ());
|
||||
queryParm.setModelId (addParm.getModelId ());
|
||||
queryParm.setStatus ("1");
|
||||
List<CsDevModelRelationVO> csDevModelRelationVOS = this.queryDevModelRelation (queryParm);
|
||||
if(csDevModelRelationVOS.size ()>0){
|
||||
throw new BusinessException (AlgorithmResponseEnum.DATA_ERROR);
|
||||
}
|
||||
CsDevModelRelationPO csDevModelRelationPO = new CsDevModelRelationPO();
|
||||
BeanUtils.copyProperties (addParm, csDevModelRelationPO);
|
||||
csDevModelRelationPO.setStatus ("1");
|
||||
this.save (csDevModelRelationPO);
|
||||
return csDevModelRelationPO;
|
||||
}
|
||||
|
||||
public List<CsDevModelRelationVO> queryDevModelRelation(CsDevModelRelationQueryParm queryParm) {
|
||||
QueryWrapper<CsDevModelRelationPO> queryWrapper = new QueryWrapper<> ();
|
||||
queryWrapper.eq (StringUtils.isNotBlank (queryParm.getId ()),"id",queryParm.getId ()).
|
||||
eq (StringUtils.isNotBlank (queryParm.getModelId ()),"model_id",queryParm.getModelId ()).
|
||||
eq (StringUtils.isNotBlank (queryParm.getDevId ()),"dev_id",queryParm.getDevId ()).
|
||||
eq (StringUtils.isNotBlank (queryParm.getStatus ()),"status",queryParm.getStatus ());
|
||||
|
||||
List<CsDevModelRelationPO> csDevModelRelationPOS = this.getBaseMapper ( ).selectList (queryWrapper);
|
||||
List<CsDevModelRelationVO> collect = csDevModelRelationPOS.stream ( ).map (temp -> {
|
||||
CsDevModelRelationVO vo = new CsDevModelRelationVO ( );
|
||||
BeanUtils.copyProperties (temp, vo);
|
||||
return vo;
|
||||
}).collect (Collectors.toList ( ));
|
||||
return collect;
|
||||
}
|
||||
}
|
||||
@@ -378,8 +378,13 @@ public class CsDevModelServiceImpl implements ICsDevModelService {
|
||||
eleEpdPqdParam.setPhase(epd.getPhase());
|
||||
}
|
||||
eleEpdPqdParam.setUnit(epd.getUnit());
|
||||
eleEpdPqdParam.setHarmStart(epd.getHarmStart());
|
||||
eleEpdPqdParam.setHarmEnd(epd.getHarmEnd());
|
||||
if (Objects.equals(epd.getHarmStart(),0.5) && Objects.equals(epd.getHarmEnd(),49.5)){
|
||||
eleEpdPqdParam.setHarmStart((int)(epd.getHarmStart()+0.5));
|
||||
eleEpdPqdParam.setHarmEnd((int)(epd.getHarmStart()+49.5));
|
||||
} else {
|
||||
eleEpdPqdParam.setHarmStart((int)(epd.getHarmStart()*1.0));
|
||||
eleEpdPqdParam.setHarmEnd((int)(epd.getHarmStart()*1.0));
|
||||
}
|
||||
eleEpdPqdParam.setStatMethod(epd.getStatMethod());
|
||||
eleEpdPqdParam.setDataType(id);
|
||||
eleEpdPqdParam.setClassId(classId);
|
||||
@@ -407,8 +412,13 @@ public class CsDevModelServiceImpl implements ICsDevModelService {
|
||||
eleEpdPqdParam.setPhase(pqd.getPhase());
|
||||
}
|
||||
eleEpdPqdParam.setUnit(pqd.getUnit());
|
||||
eleEpdPqdParam.setHarmStart(pqd.getHarmStart());
|
||||
eleEpdPqdParam.setHarmEnd(pqd.getHarmEnd());
|
||||
if (Objects.equals(pqd.getHarmStart(),0.5) && Objects.equals(pqd.getHarmEnd(),49.5)){
|
||||
eleEpdPqdParam.setHarmStart((int)(pqd.getHarmStart()+0.5));
|
||||
eleEpdPqdParam.setHarmEnd((int)(pqd.getHarmStart()+49.5));
|
||||
} else {
|
||||
eleEpdPqdParam.setHarmStart((int)(pqd.getHarmStart()*1.0));
|
||||
eleEpdPqdParam.setHarmEnd((int)(pqd.getHarmStart()*1.0));
|
||||
}
|
||||
eleEpdPqdParam.setDataType(id);
|
||||
eleEpdPqdParam.setClassId(classId);
|
||||
result.add(eleEpdPqdParam);
|
||||
@@ -763,6 +773,7 @@ public class CsDevModelServiceImpl implements ICsDevModelService {
|
||||
}
|
||||
EleEpdPqd eleEpdPqd = epdFeignClient.findByParam(name,id,phase).getData();
|
||||
if (Objects.isNull(eleEpdPqd)){
|
||||
log.info("指标名称:"+name+",数据类型:"+id+",相别:"+phase);
|
||||
throw new BusinessException(AccessResponseEnum.DICT_MISSING);
|
||||
}
|
||||
// M 代表没有数据,因为influxDB要录入数据,此字段是主键,给个默认值
|
||||
|
||||
@@ -14,9 +14,7 @@ import com.njcn.access.pojo.dto.AskDataDto;
|
||||
import com.njcn.access.pojo.dto.CsModelDto;
|
||||
import com.njcn.access.pojo.dto.ReqAndResDto;
|
||||
import com.njcn.access.pojo.po.CsSoftInfoPO;
|
||||
import com.njcn.access.service.ICsDeviceService;
|
||||
import com.njcn.access.service.ICsSoftInfoService;
|
||||
import com.njcn.access.service.ICsTopicService;
|
||||
import com.njcn.access.service.*;
|
||||
import com.njcn.access.utils.MqttUtil;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
@@ -41,6 +39,7 @@ import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@@ -61,17 +60,19 @@ public class CsDeviceServiceImpl implements ICsDeviceService {
|
||||
|
||||
private final EquipmentFeignClient equipmentFeignClient;
|
||||
|
||||
private final ICsEquipmentDeliveryService csEquipmentDeliveryService;
|
||||
|
||||
private final DictTreeFeignClient dictTreeFeignClient;
|
||||
|
||||
private final CsLedgerFeignClient csLedgerFeignClient;
|
||||
private final ICsLedgerService csLedgerService;
|
||||
|
||||
private final CsLineFeignClient csLineFeignClient;
|
||||
private final ICsDevModelRelationService csDevModelRelationService;
|
||||
|
||||
private final CsLineTopologyFeignClient csLineTopologyFeignClient;
|
||||
private final ICsLineService csLineService;
|
||||
|
||||
private final DevModelRelationFeignClient devModelRelationFeignClient;
|
||||
private final IAppLineTopologyDiagramService appLineTopologyDiagramService;
|
||||
|
||||
private final CsDeviceUserFeignClient csDeviceUserFeignClient;
|
||||
private final ICsDeviceUserService csDeviceUserService;
|
||||
|
||||
private final MqttPublisher publisher;
|
||||
|
||||
@@ -125,7 +126,7 @@ public class CsDeviceServiceImpl implements ICsDeviceService {
|
||||
public Object getModel(String nDid) {
|
||||
Object model = null;
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
Thread.sleep(1500);
|
||||
String key = "LINE" + nDid;
|
||||
model = redisUtil.getObjectByKey(key);
|
||||
if (Objects.isNull(model)){
|
||||
@@ -152,7 +153,7 @@ public class CsDeviceServiceImpl implements ICsDeviceService {
|
||||
csLedgerParam.setName(vo.getName());
|
||||
csLedgerParam.setLevel(2);
|
||||
csLedgerParam.setSort(0);
|
||||
csLedgerFeignClient.add(csLedgerParam);
|
||||
csLedgerService.addLedgerTree(csLedgerParam);
|
||||
List<CsModelDto> modelId = objectToList(redisUtil.getObjectByKey("MODEL" + devAccessParam.getNDid()));
|
||||
Integer clDid = null;
|
||||
//2.新增装置-模板关系、获取电能质量的逻辑设备id
|
||||
@@ -161,7 +162,7 @@ public class CsDeviceServiceImpl implements ICsDeviceService {
|
||||
csDevModelRelationAddParm.setDevId(vo.getId());
|
||||
csDevModelRelationAddParm.setModelId(item.getModelId());
|
||||
csDevModelRelationAddParm.setDid(item.getDid());
|
||||
devModelRelationFeignClient.addDevModelRelation(csDevModelRelationAddParm);
|
||||
csDevModelRelationService.addDevModelRelation(csDevModelRelationAddParm);
|
||||
if (Objects.equals(item.getType(),1)){
|
||||
clDid = item.getDid();
|
||||
}
|
||||
@@ -171,15 +172,12 @@ public class CsDeviceServiceImpl implements ICsDeviceService {
|
||||
}
|
||||
askDevData(devAccessParam.getNDid(),AccessEnum.L_DEV_INFO.getCode(),version,clDid);
|
||||
List<RspDataDto.LdevInfo> list = new ArrayList<>();
|
||||
try {
|
||||
Thread.sleep(500);
|
||||
String key = "LINEDATA" + devAccessParam.getNDid();
|
||||
list = objectToList2(redisUtil.getObjectByKey(key));
|
||||
if (CollectionUtils.isEmpty(list)){
|
||||
throw new BusinessException(AccessResponseEnum.LDEVINFO_IS_NULL);
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
//等待mqtt数据
|
||||
Thread.sleep(500);
|
||||
String key = "LINEDATA" + devAccessParam.getNDid();
|
||||
list = objectToList2(redisUtil.getObjectByKey(key));
|
||||
if (CollectionUtils.isEmpty(list)){
|
||||
throw new BusinessException(AccessResponseEnum.LDEVINFO_IS_NULL);
|
||||
}
|
||||
//3.监测点表录入关系
|
||||
for (DevAccessParam.LineParam item : devAccessParam.getList()) {
|
||||
@@ -210,7 +208,7 @@ public class CsDeviceServiceImpl implements ICsDeviceService {
|
||||
param.setName(item.getName());
|
||||
param.setLevel(3);
|
||||
param.setSort(0);
|
||||
csLedgerFeignClient.add(param).getData();
|
||||
csLedgerService.addLedgerTree(param);
|
||||
AppLineTopologyDiagramPO appLineTopologyDiagramPo = new AppLineTopologyDiagramPO();
|
||||
appLineTopologyDiagramPo.setId(devAccessParam.getTopologyDiagram());
|
||||
appLineTopologyDiagramPo.setLineId(id);
|
||||
@@ -219,47 +217,41 @@ public class CsDeviceServiceImpl implements ICsDeviceService {
|
||||
appLineTopologyDiagramPo.setStatus("1");
|
||||
appLineTopologyDiagramPoList.add(appLineTopologyDiagramPo);
|
||||
}
|
||||
csLineFeignClient.addLineList(csLinePoList);
|
||||
csLineService.saveBatch(csLinePoList);
|
||||
//4.监测点拓扑图表录入关系
|
||||
csLineTopologyFeignClient.addList(appLineTopologyDiagramPoList);
|
||||
//5.修改装置状态
|
||||
equipmentFeignClient.updateStatusBynDid(devAccessParam.getNDid(), AccessEnum.REGISTERED.getCode());
|
||||
//6.绑定装置和人的关系
|
||||
appLineTopologyDiagramService.saveBatch(appLineTopologyDiagramPoList);
|
||||
//5.绑定装置和人的关系
|
||||
CsDeviceUserPO po = new CsDeviceUserPO();
|
||||
po.setPrimaryUserId(RequestUtil.getUserIndex());
|
||||
po.setStatus("1");
|
||||
po.setSubUserId(RequestUtil.getUserIndex());
|
||||
po.setDeviceId(vo.getId());
|
||||
csDeviceUserFeignClient.add(Collections.singletonList(po));
|
||||
//todo 录入软件信息 SoftInfo
|
||||
csDeviceUserService.saveBatch(Collections.singletonList(po));
|
||||
//6.录入软件信息 SoftInfo
|
||||
askDevData(devAccessParam.getNDid(),AccessEnum.SOFT_INFO.getCode(),version,0);
|
||||
try {
|
||||
Thread.sleep(500);
|
||||
String key = "SOFTINFO" + devAccessParam.getNDid();
|
||||
RspDataDto.SoftInfo softInfo = JSON.parseObject(JSON.toJSONString(redisUtil.getObjectByKey(key)), RspDataDto.SoftInfo.class);
|
||||
if (Objects.isNull(softInfo)){
|
||||
throw new BusinessException(AccessResponseEnum.SOFTINFO_IS_NULL);
|
||||
}
|
||||
//记录设备软件信息
|
||||
CsSoftInfoPO csSoftInfoPo = new CsSoftInfoPO();
|
||||
BeanUtils.copyProperties(softInfo,csSoftInfoPo);
|
||||
csSoftInfoService.save(csSoftInfoPo);
|
||||
//更新设备表软件信息
|
||||
equipmentFeignClient.updateSoftInfoBynDid(devAccessParam.getNDid(),csSoftInfoPo.getId());
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
//等待mqtt数据
|
||||
Thread.sleep(500);
|
||||
String key2 = "SOFTINFO" + devAccessParam.getNDid();
|
||||
RspDataDto.SoftInfo softInfo = JSON.parseObject(JSON.toJSONString(redisUtil.getObjectByKey(key2)), RspDataDto.SoftInfo.class);
|
||||
if (Objects.isNull(softInfo)){
|
||||
throw new BusinessException(AccessResponseEnum.SOFTINFO_IS_NULL);
|
||||
}
|
||||
//todo 9.记录注册日志
|
||||
|
||||
//删除redis监测点模板信息
|
||||
//记录设备软件信息
|
||||
CsSoftInfoPO csSoftInfoPo = new CsSoftInfoPO();
|
||||
BeanUtils.copyProperties(softInfo,csSoftInfoPo);
|
||||
csSoftInfoPo.setAppDate(new SimpleDateFormat("yyyy-MM-dd").parse(softInfo.getAppDate()));
|
||||
csSoftInfoService.save(csSoftInfoPo);
|
||||
//更新设备表软件信息
|
||||
csEquipmentDeliveryService.updateSoftInfoBynDid(devAccessParam.getNDid(),csSoftInfoPo.getId());
|
||||
//修改装置状态
|
||||
csEquipmentDeliveryService.updateStatusBynDid(devAccessParam.getNDid(), AccessEnum.REGISTERED.getCode());
|
||||
//7.发起自动接入请求
|
||||
devAccess(devAccessParam.getNDid(),version);
|
||||
//8.删除redis监测点模板信息
|
||||
redisUtil.delete("MODEL" + devAccessParam.getNDid());
|
||||
redisUtil.delete("LINE" + devAccessParam.getNDid());
|
||||
redisUtil.delete("LINEDATA" + devAccessParam.getNDid());
|
||||
redisUtil.delete("SOFTINFO" + devAccessParam.getNDid());
|
||||
//发起自动接入请求
|
||||
//devAccess(devAccessParam.getNDid(),version);
|
||||
//todo 10.记录接入日志
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new BusinessException(CommonResponseEnum.FAIL);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.njcn.access.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.access.mapper.CsDeviceUserMapper;
|
||||
import com.njcn.access.service.ICsDeviceUserService;
|
||||
import com.njcn.csdevice.pojo.po.CsDeviceUserPO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* Date: 2023/6/27 9:40【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class CsDeviceUserServiceImpl extends ServiceImpl<CsDeviceUserMapper, CsDeviceUserPO> implements ICsDeviceUserService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.njcn.access.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.access.mapper.CsEquipmentDeliveryMapper;
|
||||
import com.njcn.access.service.ICsEquipmentDeliveryService;
|
||||
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||
import com.njcn.csdevice.pojo.vo.CsEquipmentDeliveryVO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||
* Date: 2023/3/30 16:23【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliveryMapper, CsEquipmentDeliveryPO> implements ICsEquipmentDeliveryService {
|
||||
|
||||
@Override
|
||||
public void updateStatusBynDid(String nDId,Integer status) {
|
||||
LambdaUpdateWrapper<CsEquipmentDeliveryPO> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
||||
lambdaUpdateWrapper.set(CsEquipmentDeliveryPO::getStatus,status).eq(CsEquipmentDeliveryPO::getNdid,nDId);
|
||||
this.update(lambdaUpdateWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateSoftInfoBynDid(String nDid, String id) {
|
||||
LambdaUpdateWrapper<CsEquipmentDeliveryPO> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
||||
lambdaUpdateWrapper.set(CsEquipmentDeliveryPO::getSoftinfoId,id).eq(CsEquipmentDeliveryPO::getNdid,nDid);
|
||||
this.update(lambdaUpdateWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateRunStatusBynDid(String nDid, Integer id) {
|
||||
LambdaUpdateWrapper<CsEquipmentDeliveryPO> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
||||
lambdaUpdateWrapper.set(CsEquipmentDeliveryPO::getRunStatus,id).eq(CsEquipmentDeliveryPO::getNdid,nDid);
|
||||
this.update(lambdaUpdateWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CsEquipmentDeliveryVO queryEquipmentByndid(String ndid) {
|
||||
CsEquipmentDeliveryVO result = new CsEquipmentDeliveryVO();
|
||||
CsEquipmentDeliveryPO csEquipmentDeliveryPo = lambdaQuery().eq(CsEquipmentDeliveryPO::getNdid,ndid).ne(CsEquipmentDeliveryPO::getRunStatus,0).one();
|
||||
if(Objects.isNull (csEquipmentDeliveryPo)){
|
||||
return result;
|
||||
}
|
||||
BeanUtils.copyProperties(csEquipmentDeliveryPo,result);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.njcn.access.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.access.mapper.CsLedgerMapper;
|
||||
import com.njcn.access.service.ICsLedgerService;
|
||||
import com.njcn.csdevice.pojo.param.CsLedgerParam;
|
||||
import com.njcn.csdevice.pojo.po.CsLedger;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 台账表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author xuyang
|
||||
* @since 2023-05-31
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> implements ICsLedgerService {
|
||||
|
||||
@Override
|
||||
public CsLedger addLedgerTree(CsLedgerParam csLedgerParam) {
|
||||
CsLedger fatherCsLedger = this.lambdaQuery().eq(CsLedger::getId,csLedgerParam.getPid()).one();
|
||||
CsLedger csLedger = new CsLedger();
|
||||
BeanUtils.copyProperties(csLedgerParam,csLedger);
|
||||
csLedger.setState(1);
|
||||
if (Objects.equals(csLedgerParam.getPid(),"9999999")){
|
||||
csLedger.setPid("0");
|
||||
csLedger.setPids("0");
|
||||
} else {
|
||||
csLedger.setPids(fatherCsLedger.getPids() + "," + csLedgerParam.getPid());
|
||||
}
|
||||
this.save(csLedger);
|
||||
return csLedger;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.njcn.access.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.access.mapper.CsLineMapper;
|
||||
import com.njcn.access.service.ICsLineService;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* Date: 2023/5/18 14:01【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class CsLineServiceImpl extends ServiceImpl<CsLineMapper, CsLinePO> implements ICsLineService {
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user