feat(ed-data): 新增ED数据管理和设备版本功能
- 重命名crcInfo字段为crc - 添加findByCondition和addEdDataFirst接口方法 - 在CsEdDataController中实现新接口 - 在CsEdDataFeignClient中添加对应feign接口 - 实现CsEdDataQueryParm参数类并添加相关字段 - 扩展CsEdDataService服务接口 - 实现CsEdDataServiceImpl中的业务逻辑 - 修改CsEquipmentDeliveryServiceImpl增强设备管理功能 - 更新CsEquipmentDeliveryVO添加前置进程号字段 - 优化CsUpgradeLogs数据结构和相关接口 - 重构DataTaskServiceImpl中的通知消息内容 - 调整DevVersionVO中的版本日期格式和添加crc字段
This commit is contained in:
@@ -1,14 +1,23 @@
|
||||
package com.njcn.csdevice.api;
|
||||
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
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.utils.HttpResultUtil;
|
||||
import com.njcn.csdevice.api.fallback.CsEdDataFeignClientFallbackFactory;
|
||||
import com.njcn.csdevice.pojo.param.CsEdDataAddParm;
|
||||
import com.njcn.csdevice.pojo.param.CsEdDataQueryParm;
|
||||
import com.njcn.csdevice.pojo.po.CsEdDataPO;
|
||||
import com.njcn.csdevice.pojo.vo.CsEdDataVO;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
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;
|
||||
@@ -27,4 +36,12 @@ public interface CsEdDataFeignClient {
|
||||
|
||||
@GetMapping("/getById")
|
||||
HttpResult<CsEdDataPO> getById(@RequestParam("id") String id);
|
||||
|
||||
@GetMapping("/addEdDataFirst")
|
||||
@ApiOperation("首次录入版本信息")
|
||||
HttpResult<CsEdDataPO> addEdDataFirst(@RequestBody CsEdDataAddParm param);
|
||||
|
||||
@GetMapping("/findByCondition")
|
||||
@ApiOperation("根据条件查询是否存在数据")
|
||||
HttpResult<CsEdDataPO> findByCondition(@RequestBody CsEdDataQueryParm param);
|
||||
}
|
||||
|
||||
@@ -4,19 +4,23 @@ import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.csdevice.api.fallback.CsUpgradeLogsClientFallbackFactory;
|
||||
import com.njcn.csdevice.pojo.po.CsUpgradeLogs;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @data 2026-04-23
|
||||
*/
|
||||
@FeignClient(value = ServerInfo.CS_DEVICE_BOOT, path = "/csUpgradeLogs", fallbackFactory = CsUpgradeLogsClientFallbackFactory.class,contextId = "csSoftInfo")
|
||||
@FeignClient(value = ServerInfo.CS_DEVICE_BOOT, path = "/csUpgradeLogs", fallbackFactory = CsUpgradeLogsClientFallbackFactory.class,contextId = "csUpgradeLogs")
|
||||
public interface CsUpgradeLogsFeignClient {
|
||||
@PostMapping("/add")
|
||||
HttpResult add(@RequestBody CsUpgradeLogs csUpgradeLogs);
|
||||
|
||||
@PostMapping("/update")
|
||||
@ApiOperation("修改升级日志")
|
||||
HttpResult<Boolean> update(@RequestParam("devId") String devId, @RequestParam("code") String code, @RequestParam("result") Integer result);
|
||||
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@ 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.csdevice.api.CsEdDataFeignClient;
|
||||
import com.njcn.csdevice.pojo.param.CsEdDataAddParm;
|
||||
import com.njcn.csdevice.pojo.param.CsEdDataQueryParm;
|
||||
import com.njcn.csdevice.pojo.po.CsEdDataPO;
|
||||
import com.njcn.csdevice.pojo.vo.CsEdDataVO;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
@@ -45,6 +47,18 @@ public class CsEdDataFeignClientFallbackFactory implements FallbackFactory<CsEdD
|
||||
log.error("{}异常,降级处理,异常为:{}","根据id获取装置类型",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<CsEdDataPO> addEdDataFirst(CsEdDataAddParm param) {
|
||||
log.error("{}异常,降级处理,异常为:{}","首次录入版本信息",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<CsEdDataPO> findByCondition(CsEdDataQueryParm param) {
|
||||
log.error("{}异常,降级处理,异常为:{}","根据条件查询是否存在数据",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,12 @@ public class CsUpgradeLogsClientFallbackFactory implements FallbackFactory<CsUpg
|
||||
log.error("{}异常,降级处理,异常为:{}", "新增升级日志异常", cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<Boolean> update(String devId, String code, Integer result) {
|
||||
log.error("{}异常,降级处理,异常为:{}", "修改升级日志", cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ public class CsEdDataAddParm {
|
||||
private String versionType;
|
||||
|
||||
@ApiModelProperty(value = "crc信息")
|
||||
private String crcInfo;
|
||||
private String crc;
|
||||
|
||||
@ApiModelProperty(value = ".bin文件")
|
||||
@NotNull(message="文件不能为空!")
|
||||
|
||||
@@ -7,6 +7,7 @@ import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.time.LocalDate;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -52,7 +53,17 @@ public class CsEdDataQueryParm {
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
||||
private String versionendDate;
|
||||
|
||||
@ApiModelProperty(value = "版本号")
|
||||
private String versionNo;
|
||||
|
||||
@ApiModelProperty(value = "协议版本号")
|
||||
private String versionAgreement;
|
||||
|
||||
@ApiModelProperty(value = "版本日期")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
private LocalDate versionDate;
|
||||
|
||||
@ApiModelProperty(value = "校验码")
|
||||
private String crc;
|
||||
|
||||
}
|
||||
@@ -30,7 +30,18 @@ public class CsUpgradeLogs {
|
||||
private String versionNo;
|
||||
|
||||
/**
|
||||
* 升级结果(0:失败 1:成功)
|
||||
* 前置返回的code编码,如果升级失败,能知道是什么原因
|
||||
*/
|
||||
@TableField(value = "code")
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 当前状态
|
||||
* (0:失败
|
||||
* 1:成功
|
||||
* 2:升级中
|
||||
* 3:升级指令下发但是没有收到前置响应
|
||||
* )
|
||||
*/
|
||||
private Integer result;
|
||||
|
||||
|
||||
@@ -94,6 +94,9 @@ public class CsEquipmentDeliveryVO extends BaseEntity {
|
||||
@ApiModelProperty(value="前置服务器id")
|
||||
private String nodeId ;
|
||||
|
||||
@ApiModelProperty(value="前置进程号")
|
||||
private Integer nodeProcess ;
|
||||
|
||||
@ApiModelProperty(value="所属工程id")
|
||||
private String associatedEngineering;
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ public class DevVersionVO {
|
||||
/**
|
||||
* 版本日期
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDateTime versionDate;
|
||||
|
||||
/**
|
||||
@@ -51,6 +51,11 @@ public class DevVersionVO {
|
||||
*/
|
||||
private String icd;
|
||||
|
||||
/**
|
||||
* crc校验码
|
||||
*/
|
||||
private String crc;
|
||||
|
||||
|
||||
/**
|
||||
* 所属工程
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.njcn.web.controller.BaseController;
|
||||
import com.njcn.web.utils.RequestUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -44,6 +45,22 @@ public class CsUpgradeLogsController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(csUpgradeLogsService.save(csUpgradeLogs) ? CommonResponseEnum.SUCCESS : CommonResponseEnum.FAIL, null, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.ADD)
|
||||
@PostMapping("/update")
|
||||
@ApiOperation("修改升级日志")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "devId", value = "设备id", required = true),
|
||||
@ApiImplicitParam(name = "code", value = "响应码", required = true),
|
||||
@ApiImplicitParam(name = "result", value = "结果", required = true)
|
||||
})
|
||||
public HttpResult<Boolean> update(@RequestParam("devId") String devId, @RequestParam("code") String code, @RequestParam("result") Integer result) {
|
||||
String methodDescribe = getMethodDescribe("update");
|
||||
boolean re = csUpgradeLogsService.updateLogs(devId,code,result);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, re, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.ADD)
|
||||
@GetMapping("/getByDevId")
|
||||
@ApiOperation("查询指定devId的所有升级日志")
|
||||
|
||||
@@ -90,4 +90,24 @@ public class CsEdDataController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, dataPO, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@GetMapping("/findByCondition")
|
||||
@ApiOperation("根据条件查询是否存在数据")
|
||||
@ApiImplicitParam(name = "param", value = "param", required = true)
|
||||
public HttpResult<CsEdDataPO> findByCondition(@RequestBody CsEdDataQueryParm param){
|
||||
String methodDescribe = getMethodDescribe("findByCondition");
|
||||
CsEdDataPO po = csEdDataService.findByCondition(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, po, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@GetMapping("/addEdDataFirst")
|
||||
@ApiOperation("首次录入版本信息")
|
||||
@ApiImplicitParam(name = "param", value = "param", required = true)
|
||||
public HttpResult<CsEdDataPO> addEdDataFirst(@RequestBody CsEdDataAddParm param){
|
||||
String methodDescribe = getMethodDescribe("addEdDataFirst");
|
||||
csEdDataService.addEdDataFirst(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -56,5 +56,14 @@ public interface CsEdDataService extends IService<CsEdDataPO> {
|
||||
* @return
|
||||
*/
|
||||
CsEdDataPO findByDevTypeIdAndVersionNo(String devTypeId, String versionNo);
|
||||
|
||||
/**
|
||||
* @Description: 根据条件查询是否存在数据
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
CsEdDataPO findByCondition(CsEdDataQueryParm param);
|
||||
|
||||
void addEdDataFirst(CsEdDataAddParm param);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,4 +8,7 @@ import com.njcn.csdevice.pojo.po.CsUpgradeLogs;
|
||||
* @data 2026-04-23
|
||||
*/
|
||||
public interface CsUpgradeLogsService extends IService<CsUpgradeLogs> {
|
||||
|
||||
boolean updateLogs(String devId, String code, Integer result);
|
||||
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.time.ZoneId;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -45,11 +46,13 @@ public class CsEdDataServiceImpl extends ServiceImpl<CsEdDataMapper, CsEdDataPO>
|
||||
BeanUtils.copyProperties(csEdDataAddParm, csEdDataPO);
|
||||
String remoteDir = StrUtil.SLASH + OssPath.EDDATA + csEdDataAddParm.getDevTypeName() + StrUtil.SLASH + csEdDataAddParm.getVersionNo() + StrUtil.SLASH;
|
||||
String filePath = fileStorageUtil.uploadMultipart(csEdDataAddParm.getFile(), remoteDir, true);
|
||||
csEdDataPO.setCrc(csEdDataAddParm.getCrcInfo());
|
||||
csEdDataPO.setCrc(csEdDataAddParm.getCrc());
|
||||
csEdDataPO.setFilePath(filePath);
|
||||
csEdDataPO.setStatus("1");
|
||||
boolean save = this.save(csEdDataPO);
|
||||
return save;
|
||||
csEdDataPO.setVersionDate(csEdDataAddParm.getVersionDate().toInstant()
|
||||
.atZone(ZoneId.systemDefault())
|
||||
.toLocalDateTime());
|
||||
return this.save(csEdDataPO);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -93,5 +96,28 @@ public class CsEdDataServiceImpl extends ServiceImpl<CsEdDataMapper, CsEdDataPO>
|
||||
.eq(CsEdDataPO::getVersionNo, versionNo)
|
||||
.eq(CsEdDataPO::getStatus, 1).one();
|
||||
}
|
||||
|
||||
@Override
|
||||
public CsEdDataPO findByCondition(CsEdDataQueryParm param) {
|
||||
return this.lambdaQuery()
|
||||
.eq(CsEdDataPO::getDevType, param.getDevType())
|
||||
.eq(CsEdDataPO::getVersionNo, param.getVersionNo())
|
||||
.eq(CsEdDataPO::getVersionAgreement, param.getVersionAgreement())
|
||||
.eq(CsEdDataPO::getVersionDate, param.getVersionDate())
|
||||
.eq(CsEdDataPO::getStatus, 1)
|
||||
.one();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addEdDataFirst(CsEdDataAddParm param) {
|
||||
CsEdDataPO csEdDataPO = new CsEdDataPO();
|
||||
BeanUtils.copyProperties(param, csEdDataPO);
|
||||
csEdDataPO.setCrc(param.getCrc());
|
||||
csEdDataPO.setStatus("1");
|
||||
csEdDataPO.setVersionDate(param.getVersionDate().toInstant()
|
||||
.atZone(ZoneId.systemDefault())
|
||||
.toLocalDateTime());
|
||||
this.save(csEdDataPO);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.text.StrPool;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
@@ -36,10 +37,7 @@ import com.njcn.csdevice.pojo.dto.DevDetailDTO;
|
||||
import com.njcn.csdevice.pojo.dto.PqsCommunicateDto;
|
||||
import com.njcn.csdevice.pojo.param.*;
|
||||
import com.njcn.csdevice.pojo.po.*;
|
||||
import com.njcn.csdevice.pojo.vo.CsEquipmentDeliveryVO;
|
||||
import com.njcn.csdevice.pojo.vo.DevVersionVO;
|
||||
import com.njcn.csdevice.pojo.vo.DeviceManagerVO;
|
||||
import com.njcn.csdevice.pojo.vo.ProjectEquipmentVO;
|
||||
import com.njcn.csdevice.pojo.vo.*;
|
||||
import com.njcn.csdevice.service.*;
|
||||
import com.njcn.csdevice.util.QRCodeUtil;
|
||||
import com.njcn.csdevice.utils.ExcelStyleUtil;
|
||||
@@ -49,6 +47,8 @@ import com.njcn.csharmonic.api.EventUserFeignClient;
|
||||
import com.njcn.csharmonic.param.CsEventUserQueryParam;
|
||||
import com.njcn.csharmonic.pojo.po.CsEventPO;
|
||||
import com.njcn.device.biz.mapper.OverLimitWlMapper;
|
||||
import com.njcn.mq.message.CloudTopicMessage;
|
||||
import com.njcn.mq.template.CloudTopicMessageTemplate;
|
||||
import com.njcn.oss.constant.OssPath;
|
||||
import com.njcn.oss.utils.FileStorageUtil;
|
||||
import com.njcn.redis.pojo.enums.AppRedisKey;
|
||||
@@ -133,6 +133,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
private final CsHarmonicPlanLineFeignClient csHarmonicPlanLineFeignClient;
|
||||
private final ICsDeviceRegistryService csDeviceRegistryService;
|
||||
private final StringRedisTemplate stringRedisTemplate;
|
||||
private final CloudTopicMessageTemplate cloudTopicMessageTemplate;
|
||||
|
||||
@Override
|
||||
public void refreshDeviceDataCache() {
|
||||
@@ -172,6 +173,8 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
csEquipmentDeliveryPo.setQrPath(qr);
|
||||
String path = this.createPath(csEquipmentDeliveryAddParm.getNdid());
|
||||
csEquipmentDeliveryPo.setMac(path);
|
||||
//PQCOM默认都支持升级
|
||||
csEquipmentDeliveryPo.setUpgrade(1);
|
||||
//记录设备调试日志表
|
||||
CsEquipmentProcessPO csEquipmentProcess = new CsEquipmentProcessPO();
|
||||
csEquipmentProcess.setDevId(csEquipmentDeliveryAddParm.getNdid());
|
||||
@@ -194,7 +197,6 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
refreshDeviceDataCache();
|
||||
}
|
||||
}
|
||||
|
||||
return csEquipmentDeliveryPo;
|
||||
}
|
||||
|
||||
@@ -1275,6 +1277,17 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
//修改设备的运行状态,则录入influxdb表数据
|
||||
int communicateType = status == 2 ? 1 : 0;
|
||||
insertPqsCommunicateRecord(time, po.getNdid(), communicateType);
|
||||
//如果是设备上线,则询问设备的版本信息
|
||||
CloudTopicMessage message = new CloudTopicMessage();
|
||||
message.setGuid(IdUtil.simpleUUID());
|
||||
message.setDevId(po.getId());
|
||||
message.setFrontId(po.getNodeId());
|
||||
message.setNode(po.getNodeProcess());
|
||||
CloudTopicMessage.Detail detail = new CloudTopicMessage.Detail();
|
||||
detail.setType(1112);
|
||||
detail.setMsg(new ArrayList<>());
|
||||
message.setDetail(detail);
|
||||
cloudTopicMessageTemplate.sendMember(message, po.getNodeId());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1317,6 +1330,10 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
|
||||
@Override
|
||||
public IPage<DevVersionVO> versionPage(CsEquipmentDeliveryQueryParm baseParam) {
|
||||
//获取台账信息
|
||||
List<CsLedgerVO> allList = csLedgerMapper.getAll();
|
||||
Map<String, CsLedgerVO> csLedgerMap = CollUtil.isEmpty(allList) ? Collections.emptyMap() : allList.stream().collect(Collectors.toMap(CsLedgerVO::getId, item -> item));
|
||||
|
||||
LambdaQueryWrapper<CsEquipmentDeliveryPO> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.ne(CsEquipmentDeliveryPO::getRunStatus, 0)
|
||||
.eq(StrUtil.isNotBlank(baseParam.getDevModel()), CsEquipmentDeliveryPO::getDevModel, baseParam.getDevModel())
|
||||
@@ -1335,16 +1352,15 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
}
|
||||
if (StrUtil.isNotBlank(item.getSoftinfoId())) {
|
||||
CsSoftInfoPO softInfoPO = csSoftInfoService.getById(item.getSoftinfoId());
|
||||
|
||||
if (ObjectUtil.isNotNull(softInfoPO)) {
|
||||
devVersionVO.setVersion(softInfoPO.getAppVersion());
|
||||
devVersionVO.setVersionDate(softInfoPO.getAppDate());
|
||||
devVersionVO.setCrc(softInfoPO.getAppCheck());
|
||||
CsEdDataPO csEdDataPO = csEdDataService.findByDevTypeIdAndVersionNo(item.getDevModel(), softInfoPO.getAppVersion());
|
||||
if (ObjectUtil.isNotNull(csEdDataPO)) {
|
||||
devVersionVO.setVersion(csEdDataPO.getVersionNo());
|
||||
devVersionVO.setProtocolVersion(csEdDataPO.getVersionAgreement());
|
||||
devVersionVO.setVersionDate(csEdDataPO.getVersionDate());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
devVersionVO.setStatus(item.getUsageStatus());
|
||||
devVersionVO.setIcd(item.getIcd());
|
||||
@@ -1354,18 +1370,19 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
devVersionVO.setDevModelName(sysDicTreePO.getName());
|
||||
}
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(item.getAssociatedEngineering())) {
|
||||
devVersionVO.setAssociatedEngineering(csEngineeringService.getById(item.getAssociatedEngineering()).getName());
|
||||
//获取工程名称和项目名称
|
||||
CsLedgerVO devVo = csLedgerMap.get(item.getId());
|
||||
if (!Objects.isNull(devVo)) {
|
||||
//项目
|
||||
CsLedgerVO proVo = csLedgerMap.get(devVo.getPid());
|
||||
devVersionVO.setAssociatedProject(proVo.getName());
|
||||
//工程
|
||||
CsLedgerVO engineeringVo = csLedgerMap.get(proVo.getPid());
|
||||
devVersionVO.setAssociatedEngineering(engineeringVo.getName());
|
||||
}
|
||||
if (StrUtil.isNotBlank(item.getAssociatedProject())) {
|
||||
devVersionVO.setAssociatedProject(appProjectService.getById(item.getAssociatedProject()).getName());
|
||||
}
|
||||
|
||||
//判断装置是否已经连接上mqtt服务器
|
||||
String clientName = "NJCN-" + item.getNdid().substring(item.getNdid().length() - 6);
|
||||
boolean mqttClient = mqttUtil.judgeClientOnline(clientName);
|
||||
if (mqttClient) {
|
||||
//设备通讯状态
|
||||
Integer runStatus = item.getRunStatus();
|
||||
if (!Objects.isNull(runStatus) && runStatus == 2) {
|
||||
devVersionVO.setConnectStatus(1);
|
||||
} else {
|
||||
devVersionVO.setConnectStatus(0);
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
package com.njcn.csdevice.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.csdevice.mapper.CsUpgradeLogsMapper;
|
||||
import com.njcn.csdevice.pojo.po.CsUpgradeLogs;
|
||||
import com.njcn.csdevice.service.CsEquipmentDeliveryService;
|
||||
import com.njcn.csdevice.service.CsUpgradeLogsService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
@@ -11,5 +15,26 @@ import org.springframework.stereotype.Service;
|
||||
* @data 2026-04-23
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class CsUpgradeLogsServiceImpl extends ServiceImpl<CsUpgradeLogsMapper, CsUpgradeLogs> implements CsUpgradeLogsService {
|
||||
|
||||
private final CsEquipmentDeliveryService csEquipmentDeliveryService;
|
||||
|
||||
@Override
|
||||
public boolean updateLogs(String devId, String code, Integer result) {
|
||||
CsUpgradeLogs latestLog = this.baseMapper.selectOne(
|
||||
new LambdaQueryWrapper<CsUpgradeLogs>()
|
||||
.eq(CsUpgradeLogs::getDevId, devId)
|
||||
.orderByDesc(CsUpgradeLogs::getCreateTime)
|
||||
.last("LIMIT 1")
|
||||
);
|
||||
if (latestLog != null) {
|
||||
LambdaUpdateWrapper<CsUpgradeLogs> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.set(CsUpgradeLogs::getCode, code)
|
||||
.set(CsUpgradeLogs::getResult, result)
|
||||
.eq(CsUpgradeLogs::getId, latestLog.getId());
|
||||
return this.update(null, updateWrapper);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -501,7 +501,7 @@ public class DataTaskServiceImpl implements IDataTaskService {
|
||||
NoticeUserDto.Payload payload = new NoticeUserDto.Payload();
|
||||
noticeUserDto.setPushClientId(harmonicDevCodes);
|
||||
noticeUserDto.setTitle("稳态事件");
|
||||
noticeUserDto.setContent(time + "发生稳态事件"+harmonicList.size()+"次,点击查看详情");
|
||||
noticeUserDto.setContent(time + "发生稳态事件,点击查看详情");
|
||||
payload.setType(1);
|
||||
payload.setPath("/pages/index/message1?type="+payload.getType());
|
||||
noticeUserDto.setPayload(payload);
|
||||
@@ -512,7 +512,7 @@ public class DataTaskServiceImpl implements IDataTaskService {
|
||||
NoticeUserDto.Payload payload = new NoticeUserDto.Payload();
|
||||
noticeUserDto.setPushClientId(alarmDevCodes);
|
||||
noticeUserDto.setTitle("告警事件");
|
||||
noticeUserDto.setContent(time + "发生告警事件"+alarmList.size()+"次,点击查看详情");
|
||||
noticeUserDto.setContent(time + "发生告警事件,点击查看详情");
|
||||
payload.setType(2);
|
||||
payload.setPath("/pages/index/message1?type="+payload.getType());
|
||||
noticeUserDto.setPayload(payload);
|
||||
@@ -571,7 +571,7 @@ public class DataTaskServiceImpl implements IDataTaskService {
|
||||
NoticeUserDto.Payload payload = new NoticeUserDto.Payload();
|
||||
noticeUserDto.setPushClientId(Collections.singletonList(item.getDevCode()));
|
||||
noticeUserDto.setTitle("稳态事件");
|
||||
noticeUserDto.setContent(time + "发生稳态事件"+harmonicData.size()+"次,点击查看详情");
|
||||
noticeUserDto.setContent(time + "发生稳态事件,点击查看详情");
|
||||
payload.setType(1);
|
||||
payload.setPath("/pages/index/message1?type="+payload.getType());
|
||||
noticeUserDto.setPayload(payload);
|
||||
@@ -579,7 +579,7 @@ public class DataTaskServiceImpl implements IDataTaskService {
|
||||
}
|
||||
});
|
||||
}
|
||||
//普通用户不为空,推送暂态消息
|
||||
//普通用户不为空,推送告警消息
|
||||
if (CollectionUtil.isNotEmpty(alarmUser) && CollectionUtil.isNotEmpty(alarmList)) {
|
||||
alarmUser.forEach(item->{
|
||||
//根据用户获取设备
|
||||
@@ -592,7 +592,7 @@ public class DataTaskServiceImpl implements IDataTaskService {
|
||||
NoticeUserDto.Payload payload = new NoticeUserDto.Payload();
|
||||
noticeUserDto.setPushClientId(Collections.singletonList(item.getDevCode()));
|
||||
noticeUserDto.setTitle("告警事件");
|
||||
noticeUserDto.setContent(time + "发生告警事件"+alarmList.size()+"次,点击查看详情");
|
||||
noticeUserDto.setContent(time + "发生告警事件,点击查看详情");
|
||||
payload.setType(2);
|
||||
payload.setPath("/pages/index/message1?type="+payload.getType());
|
||||
noticeUserDto.setPayload(payload);
|
||||
|
||||
Reference in New Issue
Block a user