Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 08d83c8c1e | |||
| dbfd6e2b52 | |||
| a07a0fe6ed | |||
| 4e7a10f46e | |||
| b265e95bdf | |||
| f185fa4706 |
@@ -1,14 +1,23 @@
|
|||||||
package com.njcn.csdevice.api;
|
package com.njcn.csdevice.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.csdevice.api.fallback.CsEdDataFeignClientFallbackFactory;
|
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.po.CsEdDataPO;
|
||||||
import com.njcn.csdevice.pojo.vo.CsEdDataVO;
|
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.cloud.openfeign.FeignClient;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
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.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -27,4 +36,12 @@ public interface CsEdDataFeignClient {
|
|||||||
|
|
||||||
@GetMapping("/getById")
|
@GetMapping("/getById")
|
||||||
HttpResult<CsEdDataPO> getById(@RequestParam("id") String id);
|
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.common.pojo.response.HttpResult;
|
||||||
import com.njcn.csdevice.api.fallback.CsUpgradeLogsClientFallbackFactory;
|
import com.njcn.csdevice.api.fallback.CsUpgradeLogsClientFallbackFactory;
|
||||||
import com.njcn.csdevice.pojo.po.CsUpgradeLogs;
|
import com.njcn.csdevice.pojo.po.CsUpgradeLogs;
|
||||||
import io.swagger.annotations.ApiImplicitParam;
|
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author caozehui
|
* @author caozehui
|
||||||
* @data 2026-04-23
|
* @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 {
|
public interface CsUpgradeLogsFeignClient {
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
HttpResult add(@RequestBody CsUpgradeLogs csUpgradeLogs);
|
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.exception.BusinessException;
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.csdevice.api.CsEdDataFeignClient;
|
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.po.CsEdDataPO;
|
||||||
import com.njcn.csdevice.pojo.vo.CsEdDataVO;
|
import com.njcn.csdevice.pojo.vo.CsEdDataVO;
|
||||||
import feign.hystrix.FallbackFactory;
|
import feign.hystrix.FallbackFactory;
|
||||||
@@ -45,6 +47,18 @@ public class CsEdDataFeignClientFallbackFactory implements FallbackFactory<CsEdD
|
|||||||
log.error("{}异常,降级处理,异常为:{}","根据id获取装置类型",cause.toString());
|
log.error("{}异常,降级处理,异常为:{}","根据id获取装置类型",cause.toString());
|
||||||
throw new BusinessException(finalExceptionEnum);
|
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());
|
log.error("{}异常,降级处理,异常为:{}", "新增升级日志异常", cause.toString());
|
||||||
throw new BusinessException(finalExceptionEnum);
|
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;
|
private String versionType;
|
||||||
|
|
||||||
@ApiModelProperty(value = "crc信息")
|
@ApiModelProperty(value = "crc信息")
|
||||||
private String crcInfo;
|
private String crc;
|
||||||
|
|
||||||
@ApiModelProperty(value = ".bin文件")
|
@ApiModelProperty(value = ".bin文件")
|
||||||
@NotNull(message="文件不能为空!")
|
@NotNull(message="文件不能为空!")
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import org.springframework.format.annotation.DateTimeFormat;
|
|||||||
|
|
||||||
import javax.validation.constraints.Min;
|
import javax.validation.constraints.Min;
|
||||||
import javax.validation.constraints.NotNull;
|
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")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
||||||
private String versionendDate;
|
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;
|
private String versionNo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 升级结果(0:失败 1:成功)
|
* 前置返回的code编码,如果升级失败,能知道是什么原因
|
||||||
|
*/
|
||||||
|
@TableField(value = "code")
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当前状态
|
||||||
|
* (0:失败
|
||||||
|
* 1:成功
|
||||||
|
* 2:升级中
|
||||||
|
* 3:升级指令下发但是没有收到前置响应
|
||||||
|
* )
|
||||||
*/
|
*/
|
||||||
private Integer result;
|
private Integer result;
|
||||||
|
|
||||||
|
|||||||
@@ -94,6 +94,9 @@ public class CsEquipmentDeliveryVO extends BaseEntity {
|
|||||||
@ApiModelProperty(value="前置服务器id")
|
@ApiModelProperty(value="前置服务器id")
|
||||||
private String nodeId ;
|
private String nodeId ;
|
||||||
|
|
||||||
|
@ApiModelProperty(value="前置进程号")
|
||||||
|
private Integer nodeProcess ;
|
||||||
|
|
||||||
@ApiModelProperty(value="所属工程id")
|
@ApiModelProperty(value="所属工程id")
|
||||||
private String associatedEngineering;
|
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;
|
private LocalDateTime versionDate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -51,6 +51,20 @@ public class DevVersionVO {
|
|||||||
*/
|
*/
|
||||||
private String icd;
|
private String icd;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* crc校验码
|
||||||
|
*/
|
||||||
|
private String crc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备通讯协议
|
||||||
|
*/
|
||||||
|
private String accessMethod;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* nDid
|
||||||
|
*/
|
||||||
|
private String nDid;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 所属工程
|
* 所属工程
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import com.njcn.web.controller.BaseController;
|
|||||||
import com.njcn.web.utils.RequestUtil;
|
import com.njcn.web.utils.RequestUtil;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiImplicitParam;
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
|
import io.swagger.annotations.ApiImplicitParams;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -44,6 +45,20 @@ public class CsUpgradeLogsController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(csUpgradeLogsService.save(csUpgradeLogs) ? CommonResponseEnum.SUCCESS : CommonResponseEnum.FAIL, null, methodDescribe);
|
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)
|
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.ADD)
|
||||||
@GetMapping("/getByDevId")
|
@GetMapping("/getByDevId")
|
||||||
@ApiOperation("查询指定devId的所有升级日志")
|
@ApiOperation("查询指定devId的所有升级日志")
|
||||||
|
|||||||
@@ -90,4 +90,24 @@ public class CsEdDataController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, dataPO, methodDescribe);
|
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
|
* @return
|
||||||
*/
|
*/
|
||||||
CsEdDataPO findByDevTypeIdAndVersionNo(String devTypeId, String versionNo);
|
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
|
* @data 2026-04-23
|
||||||
*/
|
*/
|
||||||
public interface CsUpgradeLogsService extends IService<CsUpgradeLogs> {
|
public interface CsUpgradeLogsService extends IService<CsUpgradeLogs> {
|
||||||
|
|
||||||
|
boolean updateLogs(String devId, String code, Integer result);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ public class CsDeviceUserPOServiceImpl extends ServiceImpl<CsDeviceUserPOMapper,
|
|||||||
private final UserFeignClient userFeignClient;
|
private final UserFeignClient userFeignClient;
|
||||||
private final IMqttUserService mqttUserService;
|
private final IMqttUserService mqttUserService;
|
||||||
private final CsCommTerminalFeignClient commTerminalService;
|
private final CsCommTerminalFeignClient commTerminalService;
|
||||||
|
private final AppProjectService appProjectService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
@@ -272,9 +273,15 @@ public class CsDeviceUserPOServiceImpl extends ServiceImpl<CsDeviceUserPOMapper,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//获取项目数量
|
//获取项目数量 这边可能项目下没有挂载设备,这边项目数量直接从接口获取
|
||||||
if (CollectionUtil.isNotEmpty(currentProjectIds)) {
|
// if (CollectionUtil.isNotEmpty(currentProjectIds)) {
|
||||||
vo.setCurrentProjectCount(currentProjectIds.size());
|
// vo.setCurrentProjectCount(currentProjectIds.size());
|
||||||
|
// }
|
||||||
|
List<AppProjectPO> projectInfoList = appProjectService.getProjectByEngineering(Collections.singletonList(id));
|
||||||
|
if (CollectionUtil.isNotEmpty(projectInfoList)) {
|
||||||
|
vo.setCurrentProjectCount(projectInfoList.size());
|
||||||
|
} else {
|
||||||
|
vo.setCurrentProjectCount(0);
|
||||||
}
|
}
|
||||||
//获取设备总数、在线设备、离线设备
|
//获取设备总数、在线设备、离线设备
|
||||||
if (CollectionUtil.isNotEmpty(currentDevIds)) {
|
if (CollectionUtil.isNotEmpty(currentDevIds)) {
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
|
import java.time.ZoneId;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@@ -45,11 +46,13 @@ public class CsEdDataServiceImpl extends ServiceImpl<CsEdDataMapper, CsEdDataPO>
|
|||||||
BeanUtils.copyProperties(csEdDataAddParm, csEdDataPO);
|
BeanUtils.copyProperties(csEdDataAddParm, csEdDataPO);
|
||||||
String remoteDir = StrUtil.SLASH + OssPath.EDDATA + csEdDataAddParm.getDevTypeName() + StrUtil.SLASH + csEdDataAddParm.getVersionNo() + StrUtil.SLASH;
|
String remoteDir = StrUtil.SLASH + OssPath.EDDATA + csEdDataAddParm.getDevTypeName() + StrUtil.SLASH + csEdDataAddParm.getVersionNo() + StrUtil.SLASH;
|
||||||
String filePath = fileStorageUtil.uploadMultipart(csEdDataAddParm.getFile(), remoteDir, true);
|
String filePath = fileStorageUtil.uploadMultipart(csEdDataAddParm.getFile(), remoteDir, true);
|
||||||
csEdDataPO.setCrc(csEdDataAddParm.getCrcInfo());
|
csEdDataPO.setCrc(csEdDataAddParm.getCrc());
|
||||||
csEdDataPO.setFilePath(filePath);
|
csEdDataPO.setFilePath(filePath);
|
||||||
csEdDataPO.setStatus("1");
|
csEdDataPO.setStatus("1");
|
||||||
boolean save = this.save(csEdDataPO);
|
csEdDataPO.setVersionDate(csEdDataAddParm.getVersionDate().toInstant()
|
||||||
return save;
|
.atZone(ZoneId.systemDefault())
|
||||||
|
.toLocalDateTime());
|
||||||
|
return this.save(csEdDataPO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -93,5 +96,28 @@ public class CsEdDataServiceImpl extends ServiceImpl<CsEdDataMapper, CsEdDataPO>
|
|||||||
.eq(CsEdDataPO::getVersionNo, versionNo)
|
.eq(CsEdDataPO::getVersionNo, versionNo)
|
||||||
.eq(CsEdDataPO::getStatus, 1).one();
|
.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.collection.CollectionUtil;
|
||||||
import cn.hutool.core.date.DatePattern;
|
import cn.hutool.core.date.DatePattern;
|
||||||
import cn.hutool.core.text.StrPool;
|
import cn.hutool.core.text.StrPool;
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
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.dto.PqsCommunicateDto;
|
||||||
import com.njcn.csdevice.pojo.param.*;
|
import com.njcn.csdevice.pojo.param.*;
|
||||||
import com.njcn.csdevice.pojo.po.*;
|
import com.njcn.csdevice.pojo.po.*;
|
||||||
import com.njcn.csdevice.pojo.vo.CsEquipmentDeliveryVO;
|
import com.njcn.csdevice.pojo.vo.*;
|
||||||
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.service.*;
|
import com.njcn.csdevice.service.*;
|
||||||
import com.njcn.csdevice.util.QRCodeUtil;
|
import com.njcn.csdevice.util.QRCodeUtil;
|
||||||
import com.njcn.csdevice.utils.ExcelStyleUtil;
|
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.param.CsEventUserQueryParam;
|
||||||
import com.njcn.csharmonic.pojo.po.CsEventPO;
|
import com.njcn.csharmonic.pojo.po.CsEventPO;
|
||||||
import com.njcn.device.biz.mapper.OverLimitWlMapper;
|
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.constant.OssPath;
|
||||||
import com.njcn.oss.utils.FileStorageUtil;
|
import com.njcn.oss.utils.FileStorageUtil;
|
||||||
import com.njcn.redis.pojo.enums.AppRedisKey;
|
import com.njcn.redis.pojo.enums.AppRedisKey;
|
||||||
@@ -133,6 +133,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
private final CsHarmonicPlanLineFeignClient csHarmonicPlanLineFeignClient;
|
private final CsHarmonicPlanLineFeignClient csHarmonicPlanLineFeignClient;
|
||||||
private final ICsDeviceRegistryService csDeviceRegistryService;
|
private final ICsDeviceRegistryService csDeviceRegistryService;
|
||||||
private final StringRedisTemplate stringRedisTemplate;
|
private final StringRedisTemplate stringRedisTemplate;
|
||||||
|
private final CloudTopicMessageTemplate cloudTopicMessageTemplate;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void refreshDeviceDataCache() {
|
public void refreshDeviceDataCache() {
|
||||||
@@ -172,6 +173,8 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
csEquipmentDeliveryPo.setQrPath(qr);
|
csEquipmentDeliveryPo.setQrPath(qr);
|
||||||
String path = this.createPath(csEquipmentDeliveryAddParm.getNdid());
|
String path = this.createPath(csEquipmentDeliveryAddParm.getNdid());
|
||||||
csEquipmentDeliveryPo.setMac(path);
|
csEquipmentDeliveryPo.setMac(path);
|
||||||
|
//PQCOM默认都支持升级
|
||||||
|
csEquipmentDeliveryPo.setUpgrade(1);
|
||||||
//记录设备调试日志表
|
//记录设备调试日志表
|
||||||
CsEquipmentProcessPO csEquipmentProcess = new CsEquipmentProcessPO();
|
CsEquipmentProcessPO csEquipmentProcess = new CsEquipmentProcessPO();
|
||||||
csEquipmentProcess.setDevId(csEquipmentDeliveryAddParm.getNdid());
|
csEquipmentProcess.setDevId(csEquipmentDeliveryAddParm.getNdid());
|
||||||
@@ -194,7 +197,6 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
refreshDeviceDataCache();
|
refreshDeviceDataCache();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return csEquipmentDeliveryPo;
|
return csEquipmentDeliveryPo;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1275,6 +1277,17 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
//修改设备的运行状态,则录入influxdb表数据
|
//修改设备的运行状态,则录入influxdb表数据
|
||||||
int communicateType = status == 2 ? 1 : 0;
|
int communicateType = status == 2 ? 1 : 0;
|
||||||
insertPqsCommunicateRecord(time, po.getNdid(), communicateType);
|
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
|
@Override
|
||||||
public IPage<DevVersionVO> versionPage(CsEquipmentDeliveryQueryParm baseParam) {
|
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<>();
|
LambdaQueryWrapper<CsEquipmentDeliveryPO> wrapper = new LambdaQueryWrapper<>();
|
||||||
wrapper.ne(CsEquipmentDeliveryPO::getRunStatus, 0)
|
wrapper.ne(CsEquipmentDeliveryPO::getRunStatus, 0)
|
||||||
.eq(StrUtil.isNotBlank(baseParam.getDevModel()), CsEquipmentDeliveryPO::getDevModel, baseParam.getDevModel())
|
.eq(StrUtil.isNotBlank(baseParam.getDevModel()), CsEquipmentDeliveryPO::getDevModel, baseParam.getDevModel())
|
||||||
@@ -1335,16 +1352,17 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
}
|
}
|
||||||
if (StrUtil.isNotBlank(item.getSoftinfoId())) {
|
if (StrUtil.isNotBlank(item.getSoftinfoId())) {
|
||||||
CsSoftInfoPO softInfoPO = csSoftInfoService.getById(item.getSoftinfoId());
|
CsSoftInfoPO softInfoPO = csSoftInfoService.getById(item.getSoftinfoId());
|
||||||
|
|
||||||
if (ObjectUtil.isNotNull(softInfoPO)) {
|
if (ObjectUtil.isNotNull(softInfoPO)) {
|
||||||
|
devVersionVO.setVersion(softInfoPO.getAppVersion());
|
||||||
|
devVersionVO.setVersionDate(softInfoPO.getAppDate());
|
||||||
|
devVersionVO.setCrc(softInfoPO.getAppCheck());
|
||||||
|
devVersionVO.setAccessMethod(item.getDevAccessMethod());
|
||||||
|
devVersionVO.setNDid(item.getNdid());
|
||||||
CsEdDataPO csEdDataPO = csEdDataService.findByDevTypeIdAndVersionNo(item.getDevModel(), softInfoPO.getAppVersion());
|
CsEdDataPO csEdDataPO = csEdDataService.findByDevTypeIdAndVersionNo(item.getDevModel(), softInfoPO.getAppVersion());
|
||||||
if (ObjectUtil.isNotNull(csEdDataPO)) {
|
if (ObjectUtil.isNotNull(csEdDataPO)) {
|
||||||
devVersionVO.setVersion(csEdDataPO.getVersionNo());
|
|
||||||
devVersionVO.setProtocolVersion(csEdDataPO.getVersionAgreement());
|
devVersionVO.setProtocolVersion(csEdDataPO.getVersionAgreement());
|
||||||
devVersionVO.setVersionDate(csEdDataPO.getVersionDate());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
devVersionVO.setStatus(item.getUsageStatus());
|
devVersionVO.setStatus(item.getUsageStatus());
|
||||||
devVersionVO.setIcd(item.getIcd());
|
devVersionVO.setIcd(item.getIcd());
|
||||||
@@ -1354,18 +1372,19 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
devVersionVO.setDevModelName(sysDicTreePO.getName());
|
devVersionVO.setDevModelName(sysDicTreePO.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//获取工程名称和项目名称
|
||||||
if (StrUtil.isNotBlank(item.getAssociatedEngineering())) {
|
CsLedgerVO devVo = csLedgerMap.get(item.getId());
|
||||||
devVersionVO.setAssociatedEngineering(csEngineeringService.getById(item.getAssociatedEngineering()).getName());
|
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());
|
Integer runStatus = item.getRunStatus();
|
||||||
}
|
if (!Objects.isNull(runStatus) && runStatus == 2) {
|
||||||
|
|
||||||
//判断装置是否已经连接上mqtt服务器
|
|
||||||
String clientName = "NJCN-" + item.getNdid().substring(item.getNdid().length() - 6);
|
|
||||||
boolean mqttClient = mqttUtil.judgeClientOnline(clientName);
|
|
||||||
if (mqttClient) {
|
|
||||||
devVersionVO.setConnectStatus(1);
|
devVersionVO.setConnectStatus(1);
|
||||||
} else {
|
} else {
|
||||||
devVersionVO.setConnectStatus(0);
|
devVersionVO.setConnectStatus(0);
|
||||||
|
|||||||
@@ -300,7 +300,7 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
List<CsLedgerVO> portables = ledger.stream()
|
List<CsLedgerVO> portables = ledger.stream()
|
||||||
.peek(c -> {
|
.peek(c -> {
|
||||||
CsEquipmentDeliveryPO po = poMap2.get(c.getId());
|
CsEquipmentDeliveryPO po = poMap2.get(c.getId());
|
||||||
c.setPid(portable.getId());
|
c.setPid("2");
|
||||||
c.setComFlag(po.getRunStatus());
|
c.setComFlag(po.getRunStatus());
|
||||||
c.setNDId(po.getNdid());
|
c.setNDId(po.getNdid());
|
||||||
c.setType("device");
|
c.setType("device");
|
||||||
@@ -365,13 +365,13 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
portable1.setLevel(0);
|
portable1.setLevel(0);
|
||||||
portable1.setName("便携式工程");
|
portable1.setName("便携式工程");
|
||||||
portable1.setPid("0");
|
portable1.setPid("0");
|
||||||
portable1.setId(id);
|
portable1.setId("1");
|
||||||
|
|
||||||
CsLedgerVO portable2 = new CsLedgerVO();
|
CsLedgerVO portable2 = new CsLedgerVO();
|
||||||
portable2.setLevel(1);
|
portable2.setLevel(1);
|
||||||
portable2.setName("便携式项目");
|
portable2.setName("便携式项目");
|
||||||
portable2.setPid(id);
|
portable2.setPid("1");
|
||||||
portable2.setId(IdUtil.simpleUUID());
|
portable2.setId("2");
|
||||||
portable2.setChildren(portables);
|
portable2.setChildren(portables);
|
||||||
|
|
||||||
portable1.setChildren(Collections.singletonList(portable2));
|
portable1.setChildren(Collections.singletonList(portable2));
|
||||||
@@ -719,7 +719,7 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
List<CsLedgerVO> portables = ledger.stream()
|
List<CsLedgerVO> portables = ledger.stream()
|
||||||
.peek(c -> {
|
.peek(c -> {
|
||||||
CsEquipmentDeliveryPO po = poMap2.get(c.getId());
|
CsEquipmentDeliveryPO po = poMap2.get(c.getId());
|
||||||
c.setPid(portable.getId());
|
c.setPid("2");
|
||||||
c.setComFlag(po.getRunStatus());
|
c.setComFlag(po.getRunStatus());
|
||||||
c.setNDId(po.getNdid());
|
c.setNDId(po.getNdid());
|
||||||
c.setType("device");
|
c.setType("device");
|
||||||
@@ -776,18 +776,17 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
tree.addAll(new ArrayList<>(engineeringMap.values()));
|
tree.addAll(new ArrayList<>(engineeringMap.values()));
|
||||||
|
|
||||||
if (CollUtil.isNotEmpty(portables)) {
|
if (CollUtil.isNotEmpty(portables)) {
|
||||||
String id = IdUtil.simpleUUID();
|
|
||||||
CsLedgerVO portable1 = new CsLedgerVO();
|
CsLedgerVO portable1 = new CsLedgerVO();
|
||||||
portable1.setLevel(0);
|
portable1.setLevel(0);
|
||||||
portable1.setName("便携式工程");
|
portable1.setName("便携式工程");
|
||||||
portable1.setPid("0");
|
portable1.setPid("0");
|
||||||
portable1.setId(id);
|
portable1.setId("1");
|
||||||
|
|
||||||
CsLedgerVO portable2 = new CsLedgerVO();
|
CsLedgerVO portable2 = new CsLedgerVO();
|
||||||
portable2.setLevel(1);
|
portable2.setLevel(1);
|
||||||
portable2.setName("便携式项目");
|
portable2.setName("便携式项目");
|
||||||
portable2.setPid(id);
|
portable2.setPid("1");
|
||||||
portable2.setId(IdUtil.simpleUUID());
|
portable2.setId("2");
|
||||||
portable2.setChildren(portables);
|
portable2.setChildren(portables);
|
||||||
|
|
||||||
List<CsLedgerVO> portable2List = new ArrayList<>();
|
List<CsLedgerVO> portable2List = new ArrayList<>();
|
||||||
|
|||||||
@@ -1,9 +1,13 @@
|
|||||||
package com.njcn.csdevice.service.impl;
|
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.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.njcn.csdevice.mapper.CsUpgradeLogsMapper;
|
import com.njcn.csdevice.mapper.CsUpgradeLogsMapper;
|
||||||
import com.njcn.csdevice.pojo.po.CsUpgradeLogs;
|
import com.njcn.csdevice.pojo.po.CsUpgradeLogs;
|
||||||
|
import com.njcn.csdevice.service.CsEquipmentDeliveryService;
|
||||||
import com.njcn.csdevice.service.CsUpgradeLogsService;
|
import com.njcn.csdevice.service.CsUpgradeLogsService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -11,5 +15,26 @@ import org.springframework.stereotype.Service;
|
|||||||
* @data 2026-04-23
|
* @data 2026-04-23
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
public class CsUpgradeLogsServiceImpl extends ServiceImpl<CsUpgradeLogsMapper, CsUpgradeLogs> implements CsUpgradeLogsService {
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -628,6 +628,9 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
|||||||
} else {
|
} else {
|
||||||
rmpEventDetailPo.setDealFlag(0);
|
rmpEventDetailPo.setDealFlag(0);
|
||||||
}
|
}
|
||||||
|
if (!Objects.isNull(item.getSagSource())) {
|
||||||
|
rmpEventDetailPo.setSagsource(item.getSagSource());
|
||||||
|
}
|
||||||
wlRmpEventDetailMapper.insert(rmpEventDetailPo);
|
wlRmpEventDetailMapper.insert(rmpEventDetailPo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import org.hibernate.validator.constraints.Range;
|
|||||||
|
|
||||||
import javax.validation.constraints.Min;
|
import javax.validation.constraints.Min;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -81,4 +82,6 @@ public class CsEventUserQueryPage extends CsEventUserQueryParam{
|
|||||||
|
|
||||||
@ApiModelProperty(value = "是否是dvr治理效果 0:否 1:是")
|
@ApiModelProperty(value = "是否是dvr治理效果 0:否 1:是")
|
||||||
private Integer isDvr;
|
private Integer isDvr;
|
||||||
|
|
||||||
|
private List<String> epdTagList;
|
||||||
}
|
}
|
||||||
@@ -36,7 +36,7 @@ public interface CsEventUserPOMapper extends BaseMapper<CsEventUserPO> {
|
|||||||
Page<EventDetailVO> queryEventpage(Page<EventDetailVO> returnpage, @Param("csEventUserQueryPage") CsEventUserQueryPage csEventUserQueryPage, @Param("devIds") List<String> devIds);
|
Page<EventDetailVO> queryEventpage(Page<EventDetailVO> returnpage, @Param("csEventUserQueryPage") CsEventUserQueryPage csEventUserQueryPage, @Param("devIds") List<String> devIds);
|
||||||
|
|
||||||
|
|
||||||
Page<EventDetailVO> queryEventPageWeb(Page<EventDetailVO> returnpage,@Param("csEventUserQueryPage") CsEventUserQueryPage csEventUserQueryPage,@Param("devIds") List<String> collect);
|
Page<EventDetailVO> queryEventPageWeb(Page<EventDetailVO> returnpage,@Param("csEventUserQueryPage") CsEventUserQueryPage csEventUserQueryPage,@Param("devIds") List<String> collect,@Param("lineIds") List<String> collect2);
|
||||||
|
|
||||||
Page<EventDetailVO> queryEventPageWebDvr(Page<EventDetailVO> returnpage,@Param("csEventUserQueryPage") CsEventUserQueryPage csEventUserQueryPage,@Param("lineIds") List<String> collect);
|
Page<EventDetailVO> queryEventPageWebDvr(Page<EventDetailVO> returnpage,@Param("csEventUserQueryPage") CsEventUserQueryPage csEventUserQueryPage,@Param("lineIds") List<String> collect);
|
||||||
|
|
||||||
|
|||||||
@@ -224,12 +224,24 @@
|
|||||||
AND b.severity < #{csEventUserQueryPage.severityMax}
|
AND b.severity < #{csEventUserQueryPage.severityMax}
|
||||||
</if>
|
</if>
|
||||||
<if test="csEventUserQueryPage != null and csEventUserQueryPage.searchValue != null and csEventUserQueryPage.searchValue != ''">
|
<if test="csEventUserQueryPage != null and csEventUserQueryPage.searchValue != null and csEventUserQueryPage.searchValue != ''">
|
||||||
<if test="csEventUserQueryPage.type != null and csEventUserQueryPage.type !='' and csEventUserQueryPage.type == 3 ">
|
AND (
|
||||||
AND e.name like concat('%',#{csEventUserQueryPage.searchValue},'%')
|
<!-- 名称匹配(根据type区分线路名/设备名) -->
|
||||||
</if>
|
<choose>
|
||||||
<if test="csEventUserQueryPage.type != null and csEventUserQueryPage.type !='' and csEventUserQueryPage.type != 3 ">
|
<when test="csEventUserQueryPage.type != null and csEventUserQueryPage.type == 3">
|
||||||
AND d.name like concat('%',#{csEventUserQueryPage.searchValue},'%')
|
(e.name LIKE CONCAT('%', #{csEventUserQueryPage.searchValue}, '%') OR b.code LIKE CONCAT('%', #{csEventUserQueryPage.searchValue}, '%'))
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
d.name LIKE CONCAT('%', #{csEventUserQueryPage.searchValue}, '%')
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
|
<!-- OR tag匹配:当epdTagList不为空时,加入tag IN条件 -->
|
||||||
|
<if test="csEventUserQueryPage.epdTagList != null and csEventUserQueryPage.epdTagList.size() > 0">
|
||||||
|
OR b.tag IN
|
||||||
|
<foreach collection="csEventUserQueryPage.epdTagList" item="tagItem" open="(" separator="," close=")">
|
||||||
|
#{tagItem}
|
||||||
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
|
)
|
||||||
</if>
|
</if>
|
||||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.fileFlag != null">
|
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.fileFlag != null">
|
||||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.fileFlag == 0 ">
|
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.fileFlag == 0 ">
|
||||||
@@ -255,6 +267,12 @@
|
|||||||
<foreach collection="devIds" index="index" item="item" open="(" separator="," close=")">
|
<foreach collection="devIds" index="index" item="item" open="(" separator="," close=")">
|
||||||
#{item}
|
#{item}
|
||||||
</foreach>
|
</foreach>
|
||||||
|
<if test="lineIds != null and lineIds.size() > 0">
|
||||||
|
AND b.line_id IN
|
||||||
|
<foreach collection="lineIds" item="item" open="(" separator="," close=")">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.type != null and csEventUserQueryPage.type !=''">
|
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.type != null and csEventUserQueryPage.type !=''">
|
||||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.type == 3 ">
|
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.type == 3 ">
|
||||||
AND b.type in (2,3) and b.level in (1,2,3,6,7)
|
AND b.type in (2,3) and b.level in (1,2,3,6,7)
|
||||||
@@ -320,7 +338,8 @@
|
|||||||
</if>
|
</if>
|
||||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.searchValue != null and csEventUserQueryPage.searchValue !=''">
|
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.searchValue != null and csEventUserQueryPage.searchValue !=''">
|
||||||
<if test="csEventUserQueryPage.type != null and csEventUserQueryPage.type !='' and csEventUserQueryPage.type == 3 ">
|
<if test="csEventUserQueryPage.type != null and csEventUserQueryPage.type !='' and csEventUserQueryPage.type == 3 ">
|
||||||
AND e.name like concat('%',#{csEventUserQueryPage.searchValue},'%')
|
-- AND e.name like concat('%',#{csEventUserQueryPage.searchValue},'%')
|
||||||
|
AND (e.name LIKE CONCAT('%', #{csEventUserQueryPage.searchValue}, '%') OR b.code LIKE CONCAT('%', #{csEventUserQueryPage.searchValue}, '%'))
|
||||||
</if>
|
</if>
|
||||||
<if test="csEventUserQueryPage.type != null and csEventUserQueryPage.type !='' and csEventUserQueryPage.type != 3 ">
|
<if test="csEventUserQueryPage.type != null and csEventUserQueryPage.type !='' and csEventUserQueryPage.type != 3 ">
|
||||||
AND d.name like concat('%',#{csEventUserQueryPage.searchValue},'%')
|
AND d.name like concat('%',#{csEventUserQueryPage.searchValue},'%')
|
||||||
|
|||||||
@@ -185,9 +185,7 @@ public class CsAlarmServiceImpl extends ServiceImpl<CsAlarmMapper, CsAlarm> impl
|
|||||||
for (int i = 0; i < devIds.length; i++) {
|
for (int i = 0; i < devIds.length; i++) {
|
||||||
for (int i1 = 0; i1 < param.getDevList().size(); i1++) {
|
for (int i1 = 0; i1 < param.getDevList().size(); i1++) {
|
||||||
if (Objects.equals(devIds[i], param.getDevList().get(i1))) {
|
if (Objects.equals(devIds[i], param.getDevList().get(i1))) {
|
||||||
|
|
||||||
CsLedgerVO csLedgerVO = ledgerMap.get(devIds[i]);
|
CsLedgerVO csLedgerVO = ledgerMap.get(devIds[i]);
|
||||||
|
|
||||||
AlarmVO.AlarmDetail alarmDetail = new AlarmVO.AlarmDetail();
|
AlarmVO.AlarmDetail alarmDetail = new AlarmVO.AlarmDetail();
|
||||||
alarmDetail.setEngineeringName(ledgerMap.get(csLedgerVO.getPids().split(",")[1]).getName());
|
alarmDetail.setEngineeringName(ledgerMap.get(csLedgerVO.getPids().split(",")[1]).getName());
|
||||||
alarmDetail.setProjectName(ledgerMap.get(csLedgerVO.getPids().split(",")[2]).getName());
|
alarmDetail.setProjectName(ledgerMap.get(csLedgerVO.getPids().split(",")[2]).getName());
|
||||||
@@ -243,6 +241,36 @@ public class CsAlarmServiceImpl extends ServiceImpl<CsAlarmMapper, CsAlarm> impl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//特殊处理,如果完整性和在线率没有告警,需要特殊处理下,模拟数据
|
||||||
|
if (CollectionUtil.isNotEmpty(result)) {
|
||||||
|
result.forEach(item->{
|
||||||
|
if (Objects.isNull(item.getDataDetails())) {
|
||||||
|
item.setDataDetails(buildDefaultAlarmData(item.getDevName()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构建默认的告警数据详情
|
||||||
|
* @param deviceId 设备ID
|
||||||
|
* @return 默认结构的 CsAlarmData
|
||||||
|
*/
|
||||||
|
private CsAlarmData buildDefaultAlarmData(String deviceId) {
|
||||||
|
CsAlarmData defaultData = new CsAlarmData();
|
||||||
|
defaultData.setDeviceId(deviceId);
|
||||||
|
// 构建 onlineRate 默认结构
|
||||||
|
CsAlarmData.OnlineRateAlarm onlineRate = new CsAlarmData.OnlineRateAlarm();
|
||||||
|
onlineRate.setValue(0.0);
|
||||||
|
onlineRate.setThreshold(0.0);
|
||||||
|
onlineRate.setIsAbnormal(false);
|
||||||
|
defaultData.setOnlineRate(onlineRate);
|
||||||
|
// 构建 integrity 默认结构
|
||||||
|
CsAlarmData.IntegrityAlarm integrity = new CsAlarmData.IntegrityAlarm();
|
||||||
|
integrity.setThreshold(0.0);
|
||||||
|
integrity.setMonitorPoints(new ArrayList<>());
|
||||||
|
defaultData.setIntegrity(integrity);
|
||||||
|
return defaultData;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -479,7 +479,7 @@ public class CsEventPOServiceImpl extends ServiceImpl<CsEventPOMapper, CsEventPO
|
|||||||
influxDbUtils.batchInsert(influxDbUtils.getDbName(), "", InfluxDB.ConsistencyLevel.ALL, TimeUnit.MILLISECONDS, records);
|
influxDbUtils.batchInsert(influxDbUtils.getDbName(), "", InfluxDB.ConsistencyLevel.ALL, TimeUnit.MILLISECONDS, records);
|
||||||
}
|
}
|
||||||
//同步数据到 r_mp_event_detail
|
//同步数据到 r_mp_event_detail
|
||||||
insertEvent(uuid, param, time, eventPo.getSeverity());
|
insertEvent(uuid, param, time, eventPo.getSeverity(),eventPo.getSagSource());
|
||||||
|
|
||||||
//获取台账信息
|
//获取台账信息
|
||||||
DevDetailDTO devDetailDto = csLedgerFeignclient.queryDevDetail(po.getDeviceId()).getData();
|
DevDetailDTO devDetailDto = csLedgerFeignclient.queryDevDetail(po.getDeviceId()).getData();
|
||||||
@@ -577,7 +577,7 @@ public class CsEventPOServiceImpl extends ServiceImpl<CsEventPOMapper, CsEventPO
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void insertEvent(String uuid, CldEventParam param, LocalDateTime time, Double severity) {
|
public void insertEvent(String uuid, CldEventParam param, LocalDateTime time, Double severity, String sagSource) {
|
||||||
RmpEventDetailPO rmpEventDetailPO = new RmpEventDetailPO();
|
RmpEventDetailPO rmpEventDetailPO = new RmpEventDetailPO();
|
||||||
rmpEventDetailPO.setEventId(uuid);
|
rmpEventDetailPO.setEventId(uuid);
|
||||||
rmpEventDetailPO.setMeasurementPointId(param.getMonitorId());
|
rmpEventDetailPO.setMeasurementPointId(param.getMonitorId());
|
||||||
@@ -590,6 +590,7 @@ public class CsEventPOServiceImpl extends ServiceImpl<CsEventPOMapper, CsEventPO
|
|||||||
rmpEventDetailPO.setDealFlag(0);
|
rmpEventDetailPO.setDealFlag(0);
|
||||||
rmpEventDetailPO.setFileFlag(0);
|
rmpEventDetailPO.setFileFlag(0);
|
||||||
rmpEventDetailPO.setSeverity(severity);
|
rmpEventDetailPO.setSeverity(severity);
|
||||||
|
rmpEventDetailPO.setSagsource(sagSource);
|
||||||
wlRmpEventDetailMapper.insert(rmpEventDetailPO);
|
wlRmpEventDetailMapper.insert(rmpEventDetailPO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil;
|
|||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.alibaba.csp.sentinel.util.StringUtil;
|
import com.alibaba.csp.sentinel.util.StringUtil;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
@@ -414,11 +415,16 @@ public class CsEventUserPOServiceImpl extends ServiceImpl<CsEventUserPOMapper, C
|
|||||||
cldDevTree = cldDevTree.get(0).getChildren();
|
cldDevTree = cldDevTree.get(0).getChildren();
|
||||||
}
|
}
|
||||||
if (ObjectUtil.isNull(csEventUserQueryPage.getDeviceId()) || StringUtils.isEmpty(csEventUserQueryPage.getDeviceId())) {
|
if (ObjectUtil.isNull(csEventUserQueryPage.getDeviceId()) || StringUtils.isEmpty(csEventUserQueryPage.getDeviceId())) {
|
||||||
//便携式就1层下边就是设备
|
//便携式就1层下边就是设备 这边给便携式设备添加了假的工程和项目,id是写死的
|
||||||
List<String> portableDevIds = portableDevTree.stream().filter(
|
List<String> portableDevIds = new ArrayList<>();
|
||||||
temp -> StringUtils.isEmpty(csEventUserQueryPage.getDeviceId()) ||
|
if (Objects.equals(csEventUserQueryPage.getEngineeringid(),"1")
|
||||||
Objects.equals(temp.getId(), csEventUserQueryPage.getDeviceId())
|
|| Objects.equals(csEventUserQueryPage.getProjectId(),"2")
|
||||||
).map(CsLedgerVO::getId).collect(Collectors.toList());
|
|| (!ObjectUtil.isNull(csEventUserQueryPage.getLineId()) && !StringUtils.isEmpty(csEventUserQueryPage.getLineId()))) {
|
||||||
|
portableDevIds = portableDevTree.stream().map(CsLedgerVO::getId).filter(
|
||||||
|
id -> StringUtils.isEmpty(csEventUserQueryPage.getDeviceId()) ||
|
||||||
|
Objects.equals(id, csEventUserQueryPage.getDeviceId())
|
||||||
|
).collect(Collectors.toList());
|
||||||
|
}
|
||||||
List<String> governmentDevIds = governmentDevTree.stream().filter(temp->StringUtils.isEmpty(csEventUserQueryPage.getEngineeringid())||
|
List<String> governmentDevIds = governmentDevTree.stream().filter(temp->StringUtils.isEmpty(csEventUserQueryPage.getEngineeringid())||
|
||||||
Objects.equals(temp.getId(), csEventUserQueryPage.getEngineeringid()))
|
Objects.equals(temp.getId(), csEventUserQueryPage.getEngineeringid()))
|
||||||
.map(CsLedgerVO::getChildren).flatMap(Collection::stream).filter(
|
.map(CsLedgerVO::getChildren).flatMap(Collection::stream).filter(
|
||||||
@@ -453,6 +459,9 @@ public class CsEventUserPOServiceImpl extends ServiceImpl<CsEventUserPOMapper, C
|
|||||||
if (CollectionUtils.isEmpty(devIds)){
|
if (CollectionUtils.isEmpty(devIds)){
|
||||||
return returnpage;
|
return returnpage;
|
||||||
}
|
}
|
||||||
|
if (!ObjectUtil.isNull(csEventUserQueryPage.getLineId()) && !StringUtils.isEmpty(csEventUserQueryPage.getLineId())) {
|
||||||
|
lineIds.add(csEventUserQueryPage.getLineId());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//获取tag
|
//获取tag
|
||||||
if (Objects.equals(csEventUserQueryPage.getType(), "0")) {
|
if (Objects.equals(csEventUserQueryPage.getType(), "0")) {
|
||||||
@@ -461,13 +470,24 @@ public class CsEventUserPOServiceImpl extends ServiceImpl<CsEventUserPOMapper, C
|
|||||||
csEventUserQueryPage.setTarget(tag);
|
csEventUserQueryPage.setTarget(tag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//获取告警码
|
||||||
|
String searchValue = csEventUserQueryPage.getSearchValue();
|
||||||
|
if (StrUtil.isNotBlank(searchValue)) {
|
||||||
|
List<EleEpdPqd> epdList = epdFeignClient.findListByCode(searchValue).getData();
|
||||||
|
if (CollUtil.isNotEmpty(epdList)) {
|
||||||
|
List<String> epdTagList = epdList.stream()
|
||||||
|
.map(EleEpdPqd::getName)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
csEventUserQueryPage.setEpdTagList(epdTagList);
|
||||||
|
}
|
||||||
|
}
|
||||||
//获取监测点电压等级
|
//获取监测点电压等级
|
||||||
List<CsLineDTO> list = csLineFeignClient.getAllLineDetail().getData();
|
List<CsLineDTO> list = csLineFeignClient.getAllLineDetail().getData();
|
||||||
Map<String, CsLineDTO> map = list.stream().collect(Collectors.toMap(CsLineDTO::getLineId, temp -> temp));
|
Map<String, CsLineDTO> map = list.stream().collect(Collectors.toMap(CsLineDTO::getLineId, temp -> temp));
|
||||||
if (!Objects.isNull(csEventUserQueryPage.getIsDvr()) && csEventUserQueryPage.getIsDvr() == 1) {
|
if (!Objects.isNull(csEventUserQueryPage.getIsDvr()) && csEventUserQueryPage.getIsDvr() == 1) {
|
||||||
returnpage = this.getBaseMapper().queryEventPageWebDvr(returnpage,csEventUserQueryPage,lineIds);
|
returnpage = this.getBaseMapper().queryEventPageWebDvr(returnpage,csEventUserQueryPage,lineIds);
|
||||||
} else {
|
} else {
|
||||||
returnpage = this.getBaseMapper().queryEventPageWeb(returnpage,csEventUserQueryPage,devIds);
|
returnpage = this.getBaseMapper().queryEventPageWeb(returnpage,csEventUserQueryPage,devIds,lineIds);
|
||||||
}
|
}
|
||||||
returnpage.getRecords().forEach(temp->{
|
returnpage.getRecords().forEach(temp->{
|
||||||
CsLineDTO dto = map.get(temp.getLineId());
|
CsLineDTO dto = map.get(temp.getLineId());
|
||||||
@@ -559,65 +579,172 @@ public class CsEventUserPOServiceImpl extends ServiceImpl<CsEventUserPOMapper, C
|
|||||||
@Override
|
@Override
|
||||||
public Page<FrontWarnVo> getFrontWarnInfo(CldWarnParam baseParam) {
|
public Page<FrontWarnVo> getFrontWarnInfo(CldWarnParam baseParam) {
|
||||||
Page<FrontWarnVo> result = new Page<>(baseParam.getPageNum(), baseParam.getPageSize());
|
Page<FrontWarnVo> result = new Page<>(baseParam.getPageNum(), baseParam.getPageSize());
|
||||||
Page<CsEventPO> page = new Page<>(baseParam.getPageNum(), baseParam.getPageSize());
|
|
||||||
List<Node> nodeList = nodeFeignClient.nodeAllList().getData();
|
|
||||||
Map<String, Node> nodeMap = new HashMap<>();
|
|
||||||
|
|
||||||
if (CollectionUtil.isNotEmpty(nodeList)) {
|
// 1. 获取全量节点并构建映射(始终保留全量map用于后续VO转换)
|
||||||
nodeMap = nodeList.stream().collect(Collectors.toMap(Node::getId, Function.identity()));
|
List<Node> nodeList = nodeFeignClient.nodeAllList().getData();
|
||||||
if (ObjectUtil.isNotNull(baseParam.getSearchValue()) || StringUtil.isNotBlank(baseParam.getSearchValue())) {
|
if (CollectionUtil.isEmpty(nodeList)) {
|
||||||
nodeList = nodeList.stream().filter(item-> item.getName().contains(baseParam.getSearchValue()) || item.getIp().contains(baseParam.getSearchValue())).collect(Collectors.toList());
|
return result;
|
||||||
}
|
}
|
||||||
if (CollectionUtil.isNotEmpty(nodeList)) {
|
Map<String, Node> nodeMap = nodeList.stream()
|
||||||
List<String> nodeIds = nodeList.stream().map(Node::getId).collect(Collectors.toList());
|
.collect(Collectors.toMap(Node::getId, Function.identity(), (a, b) -> a));
|
||||||
|
|
||||||
|
// 2. 提取搜索关键词,避免重复调用getter
|
||||||
|
String searchValue = baseParam.getSearchValue();
|
||||||
|
boolean hasSearchValue = StrUtil.isNotBlank(searchValue);
|
||||||
|
// 3. 根据搜索词筛选出"名称/IP匹配"的节点ID(仅作为OR条件的一部分)
|
||||||
|
List<String> matchedNodeIds;
|
||||||
|
if (hasSearchValue) {
|
||||||
|
matchedNodeIds = nodeList.stream()
|
||||||
|
.filter(item -> item.getName().contains(searchValue)
|
||||||
|
|
||||||
|
|| item.getIp().contains(searchValue))
|
||||||
|
.map(Node::getId)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
} else {
|
||||||
|
matchedNodeIds = Collections.emptyList();
|
||||||
|
}
|
||||||
|
// 4. 全量节点ID(用于限定查询总范围,防止code LIKE查到无关设备)
|
||||||
|
List<String> allNodeIds = nodeList.stream()
|
||||||
|
.map(Node::getId)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
// 5. 构建查询条件
|
||||||
LambdaQueryWrapper<CsEventPO> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<CsEventPO> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
queryWrapper.in(CsEventPO::getDeviceId, nodeIds)
|
// 搜索条件下 deviceId 与 code 改为 OR 关系
|
||||||
.between(CsEventPO::getStartTime,
|
if (hasSearchValue) {
|
||||||
|
if (CollectionUtil.isNotEmpty(matchedNodeIds)) {
|
||||||
|
// 有匹配节点:(deviceId IN 匹配节点 OR code LIKE) AND deviceId IN 全部节点
|
||||||
|
queryWrapper.in(CsEventPO::getDeviceId, allNodeIds)
|
||||||
|
.and(w -> w
|
||||||
|
.in(CsEventPO::getDeviceId, matchedNodeIds)
|
||||||
|
.or()
|
||||||
|
.like(CsEventPO::getCode, searchValue)
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
// 无匹配节点:仅靠 code LIKE,但仍限定在全部节点范围内
|
||||||
|
queryWrapper.in(CsEventPO::getDeviceId, allNodeIds)
|
||||||
|
.and(w -> w.like(CsEventPO::getCode, searchValue));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 无搜索词:正常按全部节点查询
|
||||||
|
queryWrapper.in(CsEventPO::getDeviceId, allNodeIds);
|
||||||
|
}
|
||||||
|
// 时间范围 & 类型固定条件
|
||||||
|
queryWrapper.between(CsEventPO::getStartTime,
|
||||||
DateUtil.beginOfDay(DateUtil.parse(baseParam.getSearchBeginTime())).toString(),
|
DateUtil.beginOfDay(DateUtil.parse(baseParam.getSearchBeginTime())).toString(),
|
||||||
DateUtil.endOfDay(DateUtil.parse(baseParam.getSearchEndTime())).toString())
|
DateUtil.endOfDay(DateUtil.parse(baseParam.getSearchEndTime())).toString())
|
||||||
.eq(CsEventPO::getType, 4)
|
.eq(CsEventPO::getType, 4)
|
||||||
.orderByDesc(CsEventPO::getStartTime);
|
.orderByDesc(CsEventPO::getStartTime);
|
||||||
if (ObjectUtil.isNotNull(baseParam.getLevel()) && StringUtil.isNotBlank(baseParam.getLevel())) {
|
// 等级筛选
|
||||||
|
if (StrUtil.isNotBlank(baseParam.getLevel())) {
|
||||||
List<Integer> levelList = Arrays.stream(baseParam.getLevel().split(","))
|
List<Integer> levelList = Arrays.stream(baseParam.getLevel().split(","))
|
||||||
.map(String::trim)
|
.map(String::trim)
|
||||||
.filter(s -> !s.isEmpty())
|
.filter(s -> !s.isEmpty())
|
||||||
.map(Integer::parseInt)
|
.map(Integer::parseInt)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
if (CollectionUtil.isNotEmpty(levelList)) {
|
||||||
queryWrapper.in(CsEventPO::getLevel, levelList);
|
queryWrapper.in(CsEventPO::getLevel, levelList);
|
||||||
}
|
}
|
||||||
page = csEventPOMapper.selectPage(page, queryWrapper);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 6. 执行分页查询
|
||||||
|
Page<CsEventPO> page = csEventPOMapper.selectPage(
|
||||||
|
new Page<>(baseParam.getPageNum(), baseParam.getPageSize()), queryWrapper);
|
||||||
|
// 7. 结果转换
|
||||||
List<CsEventPO> records = page.getRecords();
|
List<CsEventPO> records = page.getRecords();
|
||||||
if (CollUtil.isNotEmpty(records)) {
|
if (CollUtil.isEmpty(records)) {
|
||||||
List<FrontWarnVo> frontWarnVos = new ArrayList<>();
|
return result;
|
||||||
Map<String, Node> finalNodeMap = nodeMap;
|
}
|
||||||
page.getRecords().forEach(item->{
|
List<FrontWarnVo> frontWarnVos = records.stream().map(item -> {
|
||||||
FrontWarnVo vo = new FrontWarnVo();
|
FrontWarnVo vo = new FrontWarnVo();
|
||||||
//这边将前置名称放进lineId字段;将前置IP放进wavePath字段;进程号使用clDid
|
// 填充节点信息(使用全量nodeMap,而非过滤后的列表)
|
||||||
Node node = finalNodeMap.get(item.getDeviceId());
|
Node node = nodeMap.get(item.getDeviceId());
|
||||||
item.setLineId(Objects.isNull(node) ? null : node.getName());
|
item.setLineId(node != null ? node.getName() : null);
|
||||||
item.setWavePath(Objects.isNull(node) ? null : node.getIp());
|
item.setWavePath(node != null ? node.getIp() : null);
|
||||||
//事件等级(1:Ⅰ级||ERROR 2:Ⅱ级||WARN 3:Ⅲ级||(DEBUG&&NORMAL))
|
// 事件等级映射: 4,5→3(DEBUG/NORMAL) | 6→2(WARN) | 7→1(ERROR)
|
||||||
if (item.getLevel() == 4 || item.getLevel() == 5) {
|
Integer level = item.getLevel();
|
||||||
|
if (level == 4 || level == 5) {
|
||||||
item.setLevel(3);
|
item.setLevel(3);
|
||||||
} else if (item.getLevel() == 6) {
|
} else if (level == 6) {
|
||||||
item.setLevel(2);
|
item.setLevel(2);
|
||||||
} else if (item.getLevel() == 7) {
|
} else if (level == 7) {
|
||||||
item.setLevel(1);
|
item.setLevel(1);
|
||||||
}
|
}
|
||||||
BeanUtils.copyProperties(item, vo);
|
BeanUtils.copyProperties(item, vo);
|
||||||
frontWarnVos.add(vo);
|
return vo;
|
||||||
});
|
}).collect(Collectors.toList());
|
||||||
|
|
||||||
result.setRecords(frontWarnVos);
|
result.setRecords(frontWarnVos);
|
||||||
result.setTotal(page.getTotal());
|
result.setTotal(page.getTotal());
|
||||||
result.setPages(page.getPages());
|
result.setPages(page.getPages());
|
||||||
result.setCurrent(page.getCurrent());
|
result.setCurrent(page.getCurrent());
|
||||||
result.setSize(page.getSize());
|
result.setSize(page.getSize());
|
||||||
}
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Override
|
||||||
|
// public Page<FrontWarnVo> getFrontWarnInfo(CldWarnParam baseParam) {
|
||||||
|
// Page<FrontWarnVo> result = new Page<>(baseParam.getPageNum(), baseParam.getPageSize());
|
||||||
|
// Page<CsEventPO> page = new Page<>(baseParam.getPageNum(), baseParam.getPageSize());
|
||||||
|
// List<Node> nodeList = nodeFeignClient.nodeAllList().getData();
|
||||||
|
// Map<String, Node> nodeMap = new HashMap<>();
|
||||||
|
//
|
||||||
|
// if (CollectionUtil.isNotEmpty(nodeList)) {
|
||||||
|
// nodeMap = nodeList.stream().collect(Collectors.toMap(Node::getId, Function.identity()));
|
||||||
|
// if (ObjectUtil.isNotNull(baseParam.getSearchValue()) || StringUtil.isNotBlank(baseParam.getSearchValue())) {
|
||||||
|
// nodeList = nodeList.stream().filter(item-> item.getName().contains(baseParam.getSearchValue()) || item.getIp().contains(baseParam.getSearchValue())).collect(Collectors.toList());
|
||||||
|
// }
|
||||||
|
// if (CollectionUtil.isNotEmpty(nodeList)) {
|
||||||
|
// List<String> nodeIds = nodeList.stream().map(Node::getId).collect(Collectors.toList());
|
||||||
|
// LambdaQueryWrapper<CsEventPO> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
// queryWrapper.in(CsEventPO::getDeviceId, nodeIds)
|
||||||
|
// .between(CsEventPO::getStartTime,
|
||||||
|
// DateUtil.beginOfDay(DateUtil.parse(baseParam.getSearchBeginTime())).toString(),
|
||||||
|
// DateUtil.endOfDay(DateUtil.parse(baseParam.getSearchEndTime())).toString())
|
||||||
|
// .eq(CsEventPO::getType, 4)
|
||||||
|
// .like(StrUtil.isNotBlank(baseParam.getSearchValue()), CsEventPO::getCode, baseParam.getSearchValue())
|
||||||
|
// .orderByDesc(CsEventPO::getStartTime);
|
||||||
|
// if (ObjectUtil.isNotNull(baseParam.getLevel()) && StringUtil.isNotBlank(baseParam.getLevel())) {
|
||||||
|
// List<Integer> levelList = Arrays.stream(baseParam.getLevel().split(","))
|
||||||
|
// .map(String::trim)
|
||||||
|
// .filter(s -> !s.isEmpty())
|
||||||
|
// .map(Integer::parseInt)
|
||||||
|
// .collect(Collectors.toList());
|
||||||
|
// queryWrapper.in(CsEventPO::getLevel, levelList);
|
||||||
|
// }
|
||||||
|
// page = csEventPOMapper.selectPage(page, queryWrapper);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// List<CsEventPO> records = page.getRecords();
|
||||||
|
// if (CollUtil.isNotEmpty(records)) {
|
||||||
|
// List<FrontWarnVo> frontWarnVos = new ArrayList<>();
|
||||||
|
// Map<String, Node> finalNodeMap = nodeMap;
|
||||||
|
// page.getRecords().forEach(item->{
|
||||||
|
// FrontWarnVo vo = new FrontWarnVo();
|
||||||
|
// //这边将前置名称放进lineId字段;将前置IP放进wavePath字段;进程号使用clDid
|
||||||
|
// Node node = finalNodeMap.get(item.getDeviceId());
|
||||||
|
// item.setLineId(Objects.isNull(node) ? null : node.getName());
|
||||||
|
// item.setWavePath(Objects.isNull(node) ? null : node.getIp());
|
||||||
|
// //事件等级(1:Ⅰ级||ERROR 2:Ⅱ级||WARN 3:Ⅲ级||(DEBUG&&NORMAL))
|
||||||
|
// if (item.getLevel() == 4 || item.getLevel() == 5) {
|
||||||
|
// item.setLevel(3);
|
||||||
|
// } else if (item.getLevel() == 6) {
|
||||||
|
// item.setLevel(2);
|
||||||
|
// } else if (item.getLevel() == 7) {
|
||||||
|
// item.setLevel(1);
|
||||||
|
// }
|
||||||
|
// BeanUtils.copyProperties(item, vo);
|
||||||
|
// frontWarnVos.add(vo);
|
||||||
|
// });
|
||||||
|
// result.setRecords(frontWarnVos);
|
||||||
|
// result.setTotal(page.getTotal());
|
||||||
|
// result.setPages(page.getPages());
|
||||||
|
// result.setCurrent(page.getCurrent());
|
||||||
|
// result.setSize(page.getSize());
|
||||||
|
// }
|
||||||
|
// return result;
|
||||||
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<CsEventUserPO> queryEventListByUserId(String userIndex, List<String> eventList) {
|
public List<CsEventUserPO> queryEventListByUserId(String userIndex, List<String> eventList) {
|
||||||
LambdaQueryWrapper<CsEventUserPO> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<CsEventUserPO> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
|||||||
@@ -1757,7 +1757,7 @@ public class DataServiceImpl implements IDataService {
|
|||||||
if (CollUtil.isNotEmpty(result)) {
|
if (CollUtil.isNotEmpty(result)) {
|
||||||
result.sort(Comparator.comparing(AppLineDetailVo::getProjectName)
|
result.sort(Comparator.comparing(AppLineDetailVo::getProjectName)
|
||||||
.thenComparing(AppLineDetailVo::getDeviceName)
|
.thenComparing(AppLineDetailVo::getDeviceName)
|
||||||
.thenComparing(AppLineDetailVo::getPointId));
|
.thenComparing(AppLineDetailVo::getPointName));
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -2042,7 +2042,7 @@ public class DataServiceImpl implements IDataService {
|
|||||||
children2.sort(Comparator.comparingInt(AppLineDetailVo.targetDetail::getSort));
|
children2.sort(Comparator.comparingInt(AppLineDetailVo.targetDetail::getSort));
|
||||||
children2.forEach(item2->{
|
children2.forEach(item2->{
|
||||||
if (Objects.isNull(item2.getData())) {
|
if (Objects.isNull(item2.getData())) {
|
||||||
item2.setData(3.15159);
|
item2.setData(3.14159);
|
||||||
}
|
}
|
||||||
if (!Objects.equals(item2.getData(),NULL_DATA)) {
|
if (!Objects.equals(item2.getData(),NULL_DATA)) {
|
||||||
item2.setData(BigDecimal.valueOf(item2.getData()).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
item2.setData(BigDecimal.valueOf(item2.getData()).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||||
|
|||||||
@@ -501,7 +501,7 @@ public class DataTaskServiceImpl implements IDataTaskService {
|
|||||||
NoticeUserDto.Payload payload = new NoticeUserDto.Payload();
|
NoticeUserDto.Payload payload = new NoticeUserDto.Payload();
|
||||||
noticeUserDto.setPushClientId(harmonicDevCodes);
|
noticeUserDto.setPushClientId(harmonicDevCodes);
|
||||||
noticeUserDto.setTitle("稳态事件");
|
noticeUserDto.setTitle("稳态事件");
|
||||||
noticeUserDto.setContent(time + "发生稳态事件"+harmonicList.size()+"次,点击查看详情");
|
noticeUserDto.setContent(time + "发生稳态事件,点击查看详情");
|
||||||
payload.setType(1);
|
payload.setType(1);
|
||||||
payload.setPath("/pages/index/message1?type="+payload.getType());
|
payload.setPath("/pages/index/message1?type="+payload.getType());
|
||||||
noticeUserDto.setPayload(payload);
|
noticeUserDto.setPayload(payload);
|
||||||
@@ -512,7 +512,7 @@ public class DataTaskServiceImpl implements IDataTaskService {
|
|||||||
NoticeUserDto.Payload payload = new NoticeUserDto.Payload();
|
NoticeUserDto.Payload payload = new NoticeUserDto.Payload();
|
||||||
noticeUserDto.setPushClientId(alarmDevCodes);
|
noticeUserDto.setPushClientId(alarmDevCodes);
|
||||||
noticeUserDto.setTitle("告警事件");
|
noticeUserDto.setTitle("告警事件");
|
||||||
noticeUserDto.setContent(time + "发生告警事件"+alarmList.size()+"次,点击查看详情");
|
noticeUserDto.setContent(time + "发生告警事件,点击查看详情");
|
||||||
payload.setType(2);
|
payload.setType(2);
|
||||||
payload.setPath("/pages/index/message1?type="+payload.getType());
|
payload.setPath("/pages/index/message1?type="+payload.getType());
|
||||||
noticeUserDto.setPayload(payload);
|
noticeUserDto.setPayload(payload);
|
||||||
@@ -571,7 +571,7 @@ public class DataTaskServiceImpl implements IDataTaskService {
|
|||||||
NoticeUserDto.Payload payload = new NoticeUserDto.Payload();
|
NoticeUserDto.Payload payload = new NoticeUserDto.Payload();
|
||||||
noticeUserDto.setPushClientId(Collections.singletonList(item.getDevCode()));
|
noticeUserDto.setPushClientId(Collections.singletonList(item.getDevCode()));
|
||||||
noticeUserDto.setTitle("稳态事件");
|
noticeUserDto.setTitle("稳态事件");
|
||||||
noticeUserDto.setContent(time + "发生稳态事件"+harmonicData.size()+"次,点击查看详情");
|
noticeUserDto.setContent(time + "发生稳态事件,点击查看详情");
|
||||||
payload.setType(1);
|
payload.setType(1);
|
||||||
payload.setPath("/pages/index/message1?type="+payload.getType());
|
payload.setPath("/pages/index/message1?type="+payload.getType());
|
||||||
noticeUserDto.setPayload(payload);
|
noticeUserDto.setPayload(payload);
|
||||||
@@ -579,7 +579,7 @@ public class DataTaskServiceImpl implements IDataTaskService {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
//普通用户不为空,推送暂态消息
|
//普通用户不为空,推送告警消息
|
||||||
if (CollectionUtil.isNotEmpty(alarmUser) && CollectionUtil.isNotEmpty(alarmList)) {
|
if (CollectionUtil.isNotEmpty(alarmUser) && CollectionUtil.isNotEmpty(alarmList)) {
|
||||||
alarmUser.forEach(item->{
|
alarmUser.forEach(item->{
|
||||||
//根据用户获取设备
|
//根据用户获取设备
|
||||||
@@ -592,7 +592,7 @@ public class DataTaskServiceImpl implements IDataTaskService {
|
|||||||
NoticeUserDto.Payload payload = new NoticeUserDto.Payload();
|
NoticeUserDto.Payload payload = new NoticeUserDto.Payload();
|
||||||
noticeUserDto.setPushClientId(Collections.singletonList(item.getDevCode()));
|
noticeUserDto.setPushClientId(Collections.singletonList(item.getDevCode()));
|
||||||
noticeUserDto.setTitle("告警事件");
|
noticeUserDto.setTitle("告警事件");
|
||||||
noticeUserDto.setContent(time + "发生告警事件"+alarmList.size()+"次,点击查看详情");
|
noticeUserDto.setContent(time + "发生告警事件,点击查看详情");
|
||||||
payload.setType(2);
|
payload.setType(2);
|
||||||
payload.setPath("/pages/index/message1?type="+payload.getType());
|
payload.setPath("/pages/index/message1?type="+payload.getType());
|
||||||
noticeUserDto.setPayload(payload);
|
noticeUserDto.setPayload(payload);
|
||||||
|
|||||||
Reference in New Issue
Block a user