1.治理App版本信息添加

2.准实时数据接口调整
3.设备登记调整
4.设备接入调整
This commit is contained in:
xy
2024-11-28 08:43:54 +08:00
parent d0c7edff8a
commit b6c2675311
27 changed files with 790 additions and 55 deletions

View File

@@ -5,6 +5,7 @@ import com.njcn.common.pojo.response.HttpResult;
import com.njcn.csdevice.api.fallback.WlRecordClientFallbackFactory;
import com.njcn.csdevice.pojo.param.WlRecordParam;
import com.njcn.csdevice.pojo.po.WlRecord;
import com.njcn.csdevice.pojo.vo.RecordVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
@@ -50,4 +51,7 @@ public interface WlRecordFeignClient {
@GetMapping("/getWlAssByWlId")
HttpResult<List<WlRecord>> getWlAssByWlId(@RequestParam("wlId")String wlId);
@PostMapping("/findDevBaseDataByLineId")
HttpResult<List<RecordVo>> findDevBaseDataByLineId(@RequestBody @Validated WlRecordParam.lineRecord param);
}

View File

@@ -6,6 +6,7 @@ import com.njcn.common.pojo.response.HttpResult;
import com.njcn.csdevice.api.WlRecordFeignClient;
import com.njcn.csdevice.pojo.param.WlRecordParam;
import com.njcn.csdevice.pojo.po.WlRecord;
import com.njcn.csdevice.pojo.vo.RecordVo;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
@@ -63,6 +64,12 @@ public class WlRecordClientFallbackFactory implements FallbackFactory<WlRecordFe
log.error("{}异常,降级处理,异常为:{}","根据测试项id获取测试项详细条目",cause.toString());
throw new BusinessException(finalExceptionEnum);
}
@Override
public HttpResult<List<RecordVo>> findDevBaseDataByLineId(WlRecordParam.lineRecord param) {
log.error("{}异常,降级处理,异常为:{}","根据监测点id查询装置基础数据",cause.toString());
throw new BusinessException(finalExceptionEnum);
}
};
}
}

View File

@@ -1,12 +1,10 @@
package com.njcn.csdevice.pojo.param;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.util.Date;
/**
*
@@ -60,51 +58,12 @@ public class CsEquipmentDeliveryAuditParm {
@ApiModelProperty(value="装置接入方式")
private String devAccessMethod;
// /**
// * 装置程序版本
// */
// @ApiModelProperty(value="装置程序版本")
// private String programVersion;
// /**
// * 调试人员
// */
// @ApiModelProperty(value="调试人员")
// private String debugPerson;
//
// /**
// * 出厂日期
// */
// @ApiModelProperty(value="出厂日期")
// @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
// private Date producteTime;
//
// /**
// * 检修日期
// */
// @ApiModelProperty(value="检修日期")
// @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
// private Date checkTime;
//
// /**
// * 调试日期
// */
// @ApiModelProperty(value="调试日期")
// @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
// private Date debugTime;
/**
* 合同号
*/
@ApiModelProperty(value="合同号")
private String cntractNo;
// /**
// * 营销经理
// */
// @ApiModelProperty(value="营销经理")
// private String salesManager;
/**
* 状态
*/
@@ -128,4 +87,7 @@ public class CsEquipmentDeliveryAuditParm {
*/
@ApiModelProperty(value="模块个数")
private Integer modelNumber;
@ApiModelProperty(value="装置使用状态(0:停用 1:启用)")
private Integer usageStatus;
}

View File

@@ -99,4 +99,19 @@ public class WlRecordParam {
private String id;
}
@Data
@EqualsAndHashCode(callSuper = true)
public static class lineRecord extends WlRecordParam {
@ApiModelProperty("监测点id")
private String lineId;
@ApiModelProperty("测试项起始时间")
private String itemStartTime;
@ApiModelProperty("测试项结束时间")
private String itemEndTime;
}
}

View File

@@ -108,4 +108,10 @@ public class CsEquipmentDeliveryPO extends BaseEntity {
@TableField(value = "process")
private Integer process;
/**
* 装置使用状态(0:停用 1:启用)
*/
@TableField(value = "usage_status")
private Integer usageStatus;
}

View File

@@ -83,4 +83,7 @@ public class CsEquipmentDeliveryVO extends BaseEntity {
@ApiModelProperty(value="设备当前流程状态")
private Integer process ;
@ApiModelProperty(value="装置使用状态(0:停用 1:启用)")
private Integer usageStatus ;
}

View File

@@ -48,6 +48,9 @@ public class CsLedgerVO implements Serializable {
@ApiModelProperty(name = "type",value = "类型 项目 工程 装置 监测点")
private String type;
@ApiModelProperty(name = "lineType",value = "监测点类型 0:治理监测点 1:电能质量监测点")
private Integer lineType;
@ApiModelProperty(name = "children",value = "子节点")
private List<CsLedgerVO> children = new ArrayList<>();

View File

@@ -38,6 +38,7 @@ import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -66,10 +67,10 @@ public class EquipmentDeliveryController extends BaseController {
@ApiOperation("新增出厂设备")
@ApiImplicitParam(name = "csEquipmentDeliveryAddParm", value = "新增项目参数", required = true)
@DeviceLog(operateType = DeviceOperate.ADD)
public HttpResult<Boolean> addEquipmentDelivery(@RequestBody @Validated CsEquipmentDeliveryAddParm csEquipmentDeliveryAddParm){
public HttpResult<CsEquipmentDeliveryPO> addEquipmentDelivery(@RequestBody @Validated CsEquipmentDeliveryAddParm csEquipmentDeliveryAddParm){
String methodDescribe = getMethodDescribe("addEquipmentDelivery");
Boolean flag = csEquipmentDeliveryService.save(csEquipmentDeliveryAddParm);
if (flag){
CsEquipmentDeliveryPO po = csEquipmentDeliveryService.save(csEquipmentDeliveryAddParm);
if (Objects.nonNull(po)){
//查询mqtt用户名和密码是否存在
boolean result = mqttUserService.findMqttUser(csEquipmentDeliveryAddParm.getNdid());
if (result){
@@ -77,7 +78,7 @@ public class EquipmentDeliveryController extends BaseController {
mqttUserService.insertMqttUser(csEquipmentDeliveryAddParm.getNdid());
}
}
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, po, methodDescribe);
}

View File

@@ -168,6 +168,20 @@ public class WlRecordController extends BaseController {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
/**
* 删除装置测试项
*/
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.UPDATE)
@PostMapping("/deleteItem")
@ApiOperation("删除装置测试项")
@ApiImplicitParam(name = "id", value = "装置测试项Id", required = true)
public HttpResult<Boolean> deleteItem(@RequestParam @Validated String id) {
String methodDescribe = getMethodDescribe("deleteItem");
LogUtil.njcnDebug(log, "{}装置测试项Id为{}", methodDescribe, id);
wlRecordService.deleteItem(id);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
/**
* 查询测试项时间段实时数据
*/
@@ -195,6 +209,19 @@ public class WlRecordController extends BaseController {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, record, methodDescribe);
}
/**
* 根据监测点id查询装置基础数据
*/
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.QUERY)
@PostMapping("/findDevBaseDataByLineId")
@ApiOperation("根据监测点id查询装置基础数据")
@ApiImplicitParam(name = "param", value = "查询条件", required = true)
public HttpResult<List<RecordVo>> findDevBaseDataByLineId(@RequestBody @Validated WlRecordParam.lineRecord param) {
String methodDescribe = getMethodDescribe("findDevBaseDataByLineId");
LogUtil.njcnDebug(log, "{},查询对象为:{}", methodDescribe, param);
List<RecordVo> record = wlRecordService.findDevBaseDataByLineId(param);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, record, methodDescribe);
}
/**

View File

@@ -39,7 +39,7 @@ public interface CsEquipmentDeliveryService extends IService<CsEquipmentDelivery
* @Author: clam
* @Date: 2023/3/31
*/
Boolean save(CsEquipmentDeliveryAddParm csEquipmentDeliveryAddParm);
CsEquipmentDeliveryPO save(CsEquipmentDeliveryAddParm csEquipmentDeliveryAddParm);
/**
* @Description: AuditEquipmentDelivery
* @Param: [id]

View File

@@ -102,6 +102,7 @@ public interface IWlRecordService extends IService<WlRecord> {
*/
WlRecord findDevBaseData(WlRecordParam.Record param);
List<RecordVo> findDevBaseDataByLineId(WlRecordParam.lineRecord param);
/**
* 每日处理没有结束时间的测试基础数据
@@ -110,4 +111,5 @@ public interface IWlRecordService extends IService<WlRecord> {
List<WlRecord> getWlAssByWlId(String wlId);
void deleteItem(String id);
}

View File

@@ -40,6 +40,7 @@ import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.api.DictTreeFeignClient;
import com.njcn.system.enums.DicDataEnum;
import com.njcn.system.enums.DicTreeEnum;
import com.njcn.system.pojo.po.SysDicTreePO;
import com.njcn.system.pojo.vo.DictTreeVO;
import com.njcn.web.factory.PageFactory;
import com.njcn.web.utils.RequestUtil;
@@ -101,7 +102,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
@Override
@Transactional(rollbackFor = {Exception.class})
public Boolean save(CsEquipmentDeliveryAddParm csEquipmentDeliveryAddParm) {
public CsEquipmentDeliveryPO save(CsEquipmentDeliveryAddParm csEquipmentDeliveryAddParm) {
boolean result;
CsEquipmentDeliveryPO po = this.queryEquipmentPOByndid (csEquipmentDeliveryAddParm.getNdid());
if(!Objects.isNull (po)){
@@ -111,6 +112,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
BeanUtils.copyProperties (csEquipmentDeliveryAddParm,csEquipmentDeliveryPo);
csEquipmentDeliveryPo.setStatus (1);
csEquipmentDeliveryPo.setRunStatus(1);
csEquipmentDeliveryPo.setUsageStatus(1);
String code = dictTreeFeignClient.queryById(csEquipmentDeliveryAddParm.getDevType()).getData().getCode();
if (Objects.equals(DicDataEnum.PORTABLE.getCode(),code)) {
csEquipmentDeliveryPo.setProcess(4);
@@ -135,7 +137,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
if (result) {
refreshDeviceDataCache();
}
return result;
return csEquipmentDeliveryPo;
}
@Override
@@ -370,6 +372,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
BeanUtils.copyProperties(csEquipmentDeliveryPo, deviceManagerVo);
if (CollUtil.isNotEmpty(dataSet)) {
for (CsDataSet item : dataSet) {
//准实时数据
DeviceManagerVO.DataSetVO dataSetVO = new DeviceManagerVO.DataSetVO();
dataSetVO.setId(item.getId());
dataSetVO.setName("history".equals(type) ? "准实时数据":item.getAnotherName());
@@ -384,14 +387,14 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
dataSetVo2.setType("history");
dataSetList.add(dataSetVo2);
deviceManagerVo.setDataLevel(item.getDataLevel());
//趋势数据tab
DeviceManagerVO.DataSetVO dataSetVo3 = new DeviceManagerVO.DataSetVO();
dataSetVo3.setId(item.getId());
dataSetVo3.setName("历史趋势");
dataSetVo3.setType("trenddata");
dataSetList.add(dataSetVo3);
//下面这些tab仅仅只限于设备监控的便携式设备才会有
if(DataParam.portableDevType.equals(csEquipmentDeliveryPo.getDevType())){
//趋势数据tab
DeviceManagerVO.DataSetVO dataSetVo3 = new DeviceManagerVO.DataSetVO();
dataSetVo3.setId(item.getId());
dataSetVo3.setName("历史趋势");
dataSetVo3.setType("trenddata");
dataSetList.add(dataSetVo3);
//实时数据tab
DeviceManagerVO.DataSetVO dataSetVo4 = new DeviceManagerVO.DataSetVO();
dataSetVo4.setId(item.getId());
@@ -404,6 +407,12 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
dataSetVo5.setName("暂态事件");
dataSetVo5.setType("event");
dataSetList.add(dataSetVo5);
//测试项tab
DeviceManagerVO.DataSetVO dataSetVo6 = new DeviceManagerVO.DataSetVO();
dataSetVo6.setId(item.getId());
dataSetVo6.setName("测试项记录");
dataSetVo6.setType("items");
dataSetList.add(dataSetVo6);
}
}
}

View File

@@ -90,7 +90,17 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
List<CsLedgerVO> finalLineList = allList.stream()
.filter(item -> item.getLevel().equals(LineBaseEnum.LINE_LEVEL.getCode()))
.sorted(Comparator.comparing(CsLedgerVO::getSort))
.peek(item -> item.setType("line"))
.peek(
item -> {
item.setType("line");
String index = item.getId().substring(item.getId().length()-1);
if (Objects.equals(index,"0")) {
item.setLineType(0);
} else {
item.setLineType(1);
}
}
)
.collect(Collectors.toList());
checkDevSetData(deviceList);
deviceList.forEach(dev -> dev.setChildren(getChildren(dev, finalLineList)));

View File

@@ -522,6 +522,25 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
return this.getOne(lambdaQueryWrapper);
}
@Override
public List<RecordVo> findDevBaseDataByLineId(WlRecordParam.lineRecord param) {
List<RecordVo> result = new ArrayList<>();
LambdaQueryWrapper<WlRecord> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(WlRecord::getLineId,param.getLineId())
.between(WlRecord::getStartTime,param.getItemStartTime(),param.getItemEndTime())
.eq(WlRecord::getType,1)
.eq(WlRecord::getState,1).orderByDesc(WlRecord::getStartTime);
List<WlRecord> list = this.list(lambdaQueryWrapper);
if (CollUtil.isNotEmpty(list)) {
list.forEach(item->{
RecordVo vo = new RecordVo();
BeanUtils.copyProperties(item,vo);
result.add(vo);
});
}
return result;
}
@Override
@Transactional(rollbackFor = Exception.class)
public void dayDealNoEndTimeEvent(String date) {
@@ -620,6 +639,13 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
return this.baseMapper.getDataRecordByTestId(wlId,0);
}
@Override
public void deleteItem(String id) {
LambdaUpdateWrapper<WlRecord> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
lambdaUpdateWrapper.eq(WlRecord::getId,id).set(WlRecord::getState,0);
this.update(lambdaUpdateWrapper);
}
/**
* 数据项内的时间进行覆盖:解决多个数据项的startTime及endTime之间存在时间冲突
* @param data 数据项