42 Commits

Author SHA1 Message Date
hzj
ce861e1804 bug修改 2024-11-01 14:41:46 +08:00
xy
35d44dcc08 代码优化
1.公共方法提取
2.装置类型判断
2024-11-01 11:20:09 +08:00
xy
c3d87eca34 bug调整 2024-10-31 15:44:14 +08:00
xy
86c6c95777 bug调整 2024-10-31 14:07:52 +08:00
xy
f9d696faad bug调整 2024-10-31 13:42:53 +08:00
xy
c325301a8f bug调整 2024-10-30 16:09:20 +08:00
hzj
014370062a 波形下载接口开发 2024-10-30 11:28:41 +08:00
hzj
ada65fd40d 离线数据上传bug 2024-10-29 16:27:40 +08:00
hzj
a940d3961a 离线数据上传bug 2024-10-29 16:01:04 +08:00
hzj
4b7a60190c 历史趋势图添加二次值 2024-10-24 20:00:55 +08:00
xy
c0be7629dd 数据显示优化 2024-10-24 16:38:41 +08:00
hzj
5f82f65b8f 趋势图bug修改 2024-10-23 20:10:00 +08:00
xy
4e0b4b6b90 添加文件时间 2024-10-23 18:43:22 +08:00
hzj
ca9193b861 修改报表 2024-10-23 10:25:19 +08:00
hzj
469a4ba63e 组态bug修改 2024-10-23 08:48:33 +08:00
hzj
4316e72521 组态bug修改 2024-10-22 20:45:19 +08:00
hzj
f942be74f1 测试项限值生成 2024-10-22 18:11:34 +08:00
xy
b750064b16 微调 2024-10-22 10:39:55 +08:00
xy
b7c9cd2ee0 补召优化 2024-10-21 19:59:13 +08:00
hzj
6cca1cc74d 修改bug 2024-10-21 15:33:31 +08:00
hzj
a83ab8b141 修改bug 2024-10-21 11:40:33 +08:00
hzj
edc2453da2 修改bug 2024-10-17 13:53:06 +08:00
xy
cbc301da5f pom文件提交 2024-10-17 13:45:15 +08:00
xy
4142de1fcf 设备树调整 2024-10-17 10:10:23 +08:00
xy
78b9a98ab8 模板数据、设备信息初始化至内存 2024-10-16 18:53:19 +08:00
hzj
5169669b2b Merge remote-tracking branch 'origin/master' 2024-10-16 10:51:26 +08:00
hzj
10e0e96b65 修改bug 2024-10-16 10:50:58 +08:00
xy
cd35e67007 设备树显示调整 2024-10-16 10:32:40 +08:00
xy
eb7a1d9beb 优化 2024-10-15 18:30:27 +08:00
hzj
3059f5ac75 修改bug 2024-10-15 15:04:28 +08:00
hzj
346afef6d0 修改bug 2024-10-15 14:24:05 +08:00
hzj
2cf47ec3b3 修改bug 2024-10-15 12:30:59 +08:00
xy
83199f07b6 无线系统补召功能调整 2024-10-15 11:12:05 +08:00
hzj
8295801f16 修改bug 2024-10-11 19:19:57 +08:00
xy
306b426573 无线系统实时数据功能 2024-10-11 18:17:38 +08:00
hzj
3a60a05ea2 修改告警展示页面 2024-10-10 10:40:59 +08:00
xy
86108004d5 解决启动报错 2024-10-09 16:06:20 +08:00
xy
5ef232a485 模板适配调整 2024-10-09 14:57:29 +08:00
05112b5262 1.数据方案修改 2024-10-09 11:38:02 +08:00
hzj
2ca4ee702b 添加波形路径用于判断是否展示波形 2024-10-09 09:28:17 +08:00
xy
c95c1271c2 模板调整适配 2024-10-09 09:25:41 +08:00
hzj
105a5314cb 离线数据上传 2024-10-08 20:51:58 +08:00
83 changed files with 1703 additions and 196 deletions

View File

@@ -112,7 +112,7 @@
<dependency> <dependency>
<groupId>com.njcn</groupId> <groupId>com.njcn</groupId>
<artifactId>pqs-influx</artifactId> <artifactId>pqs-influx</artifactId>
<version>0.0.1-SNAPSHOT</version> <version>1.0.0</version>
</dependency> </dependency>
</dependencies> </dependencies>
<build> <build>

View File

@@ -6,6 +6,7 @@ import com.njcn.csdevice.api.fallback.CsLineClientFallbackFactory;
import com.njcn.csdevice.pojo.param.CsLineParam; import com.njcn.csdevice.pojo.param.CsLineParam;
import com.njcn.csdevice.pojo.po.CsLinePO; import com.njcn.csdevice.pojo.po.CsLinePO;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
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; import org.springframework.web.bind.annotation.RequestParam;
@@ -18,7 +19,6 @@ import java.util.List;
@FeignClient(value = ServerInfo.CS_DEVICE_BOOT, path = "/csline", fallbackFactory = CsLineClientFallbackFactory.class,contextId = "csline") @FeignClient(value = ServerInfo.CS_DEVICE_BOOT, path = "/csline", fallbackFactory = CsLineClientFallbackFactory.class,contextId = "csline")
public interface CsLineFeignClient { public interface CsLineFeignClient {
@PostMapping("/queryLineById") @PostMapping("/queryLineById")
HttpResult<List<CsLinePO>> queryLineById(@RequestParam("ids") List<String> ids ); HttpResult<List<CsLinePO>> queryLineById(@RequestParam("ids") List<String> ids );
@@ -36,4 +36,10 @@ public interface CsLineFeignClient {
@PostMapping("/updateLine") @PostMapping("/updateLine")
HttpResult<String> updateLine(@RequestBody CsLineParam csLineParam); HttpResult<String> updateLine(@RequestBody CsLineParam csLineParam);
@PostMapping("/updateIds")
HttpResult<Boolean> updateIds(@RequestBody @Validated CsLineParam csLineParam);
@PostMapping("/getById")
HttpResult<CsLinePO> getById(@RequestParam("lineId") String lineId);
} }

View File

@@ -5,7 +5,6 @@ import com.njcn.common.pojo.response.HttpResult;
import com.njcn.csdevice.api.fallback.DataArrayFeignClientFallbackFactory; import com.njcn.csdevice.api.fallback.DataArrayFeignClientFallbackFactory;
import com.njcn.csdevice.pojo.param.DataArrayParam; import com.njcn.csdevice.pojo.param.DataArrayParam;
import com.njcn.csdevice.pojo.po.CsDataArray; import com.njcn.csdevice.pojo.po.CsDataArray;
import com.njcn.csdevice.pojo.po.CsDataSet;
import com.njcn.csdevice.pojo.vo.DataArrayTreeVO; import com.njcn.csdevice.pojo.vo.DataArrayTreeVO;
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;
@@ -22,13 +21,14 @@ import java.util.List;
public interface DataArrayFeignClient { public interface DataArrayFeignClient {
@PostMapping("/getArrayBySet") @PostMapping("/getArrayBySet")
HttpResult<List<CsDataArray>> getArrayBySet(@RequestBody List<CsDataSet> setList); HttpResult<List<CsDataArray>> getArrayBySet(@RequestParam("dataSet") String dataSet);
@PostMapping("/getDataArray") @PostMapping("/getDataArray")
HttpResult<List<DataArrayTreeVO>> getDataArray(@RequestBody List<String> dataSetList); HttpResult<List<DataArrayTreeVO>> getDataArray(@RequestBody List<String> dataSetList);
@PostMapping("/getDataArrayById") @PostMapping("/getDataArrayById")
HttpResult<List<CsDataArray>> getDataArrayById(@RequestParam("pid") String pid, @RequestParam("name") String name); HttpResult<List<CsDataArray>> getDataArrayById(@RequestParam("pid") String pid, @RequestParam("name") String name);
@PostMapping("/getDataArrayByIds") @PostMapping("/getDataArrayByIds")
HttpResult<List<CsDataArray>> getDataArrayByIds(@RequestParam("ids") List<String> ids); HttpResult<List<CsDataArray>> getDataArrayByIds(@RequestParam("ids") List<String> ids);

View File

@@ -1,10 +1,17 @@
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.DataSetFeignClientFallbackFactory; import com.njcn.csdevice.api.fallback.DataSetFeignClientFallbackFactory;
import com.njcn.csdevice.pojo.po.CsDataSet; import com.njcn.csdevice.pojo.po.CsDataSet;
import com.njcn.csdevice.pojo.vo.LineTargetVO; import com.njcn.csdevice.pojo.vo.LineTargetVO;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
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;
@@ -31,5 +38,13 @@ public interface DataSetFeignClient {
@PostMapping("/getDataSetBySetIds") @PostMapping("/getDataSetBySetIds")
HttpResult<List<CsDataSet>> getDataSetBySetIds(@RequestBody List<String> lineIds); HttpResult<List<CsDataSet>> getDataSetBySetIds(@RequestBody List<String> lineIds);
@PostMapping("/getBaseDataSet")
HttpResult<CsDataSet> getBaseDataSet(@RequestParam("modelId") String modelId,@RequestParam("clDev") Integer clDev);
@PostMapping("/getHarmonicDataSet")
HttpResult<CsDataSet> getHarmonicDataSet(@RequestParam("modelId") String modelId,@RequestParam("clDev") Integer clDev,@RequestParam("target") Integer target);
@PostMapping("/getDataSetByIdx")
HttpResult<CsDataSet> getDataSetByIdx(@RequestParam("modelId") String modelId,@RequestParam("idx") Integer idx);
} }

View File

@@ -58,4 +58,7 @@ public interface EquipmentFeignClient {
@PostMapping("/getAll") @PostMapping("/getAll")
HttpResult<List<CsEquipmentDeliveryPO>> getAll(); HttpResult<List<CsEquipmentDeliveryPO>> getAll();
@PostMapping("/judgeDevModel")
HttpResult<Boolean> judgeDevModel(@RequestParam("nDid") String nDid);
} }

View File

@@ -7,8 +7,10 @@ import com.njcn.csdevice.pojo.param.WlRecordParam;
import com.njcn.csdevice.pojo.po.WlRecord; import com.njcn.csdevice.pojo.po.WlRecord;
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.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;
import java.util.List; import java.util.List;
@@ -41,4 +43,8 @@ public interface WlRecordFeignClient {
@PostMapping("/updateTestRecord") @PostMapping("/updateTestRecord")
HttpResult<Boolean> updateTestRecord(@RequestBody @Validated WlRecordParam.UpdateRecord record); HttpResult<Boolean> updateTestRecord(@RequestBody @Validated WlRecordParam.UpdateRecord record);
@GetMapping("/dayDealNoEndTimeEvent")
void dayDealNoEndTimeEvent(@RequestParam("date") String date);
} }

View File

@@ -28,7 +28,6 @@ public class CsLineClientFallbackFactory implements FallbackFactory<CsLineFeignC
Enum<?> finalExceptionEnum = exceptionEnum; Enum<?> finalExceptionEnum = exceptionEnum;
return new CsLineFeignClient() { return new CsLineFeignClient() {
@Override @Override
public HttpResult<List<CsLinePO>> queryLineById(List<String> ids) { public HttpResult<List<CsLinePO>> queryLineById(List<String> ids) {
log.error("{}异常,降级处理,异常为:{}","查询监测点详情异常",cause.toString()); log.error("{}异常,降级处理,异常为:{}","查询监测点详情异常",cause.toString());
@@ -63,6 +62,18 @@ public class CsLineClientFallbackFactory implements FallbackFactory<CsLineFeignC
log.error("{}异常,降级处理,异常为:{}","更新监测点信息",cause.toString()); log.error("{}异常,降级处理,异常为:{}","更新监测点信息",cause.toString());
throw new BusinessException(finalExceptionEnum); throw new BusinessException(finalExceptionEnum);
} }
@Override
public HttpResult<Boolean> updateIds(CsLineParam csLineParam) {
log.error("{}异常,降级处理,异常为:{}","修改监测点模板id和数据集id",cause.toString());
throw new BusinessException(finalExceptionEnum);
}
@Override
public HttpResult<CsLinePO> getById(String lineId) {
log.error("{}异常,降级处理,异常为:{}","根据监测点id获取监测点详情",cause.toString());
throw new BusinessException(finalExceptionEnum);
}
}; };
} }
} }

View File

@@ -6,7 +6,6 @@ import com.njcn.common.pojo.response.HttpResult;
import com.njcn.csdevice.api.DataArrayFeignClient; import com.njcn.csdevice.api.DataArrayFeignClient;
import com.njcn.csdevice.pojo.param.DataArrayParam; import com.njcn.csdevice.pojo.param.DataArrayParam;
import com.njcn.csdevice.pojo.po.CsDataArray; import com.njcn.csdevice.pojo.po.CsDataArray;
import com.njcn.csdevice.pojo.po.CsDataSet;
import com.njcn.csdevice.pojo.vo.DataArrayTreeVO; import com.njcn.csdevice.pojo.vo.DataArrayTreeVO;
import com.njcn.csdevice.utils.CsDeviceEnumUtil; import com.njcn.csdevice.utils.CsDeviceEnumUtil;
import feign.hystrix.FallbackFactory; import feign.hystrix.FallbackFactory;
@@ -36,7 +35,7 @@ public class DataArrayFeignClientFallbackFactory implements FallbackFactory<Data
Enum<?> finalExceptionEnum = exceptionEnum; Enum<?> finalExceptionEnum = exceptionEnum;
return new DataArrayFeignClient() { return new DataArrayFeignClient() {
@Override @Override
public HttpResult<List<CsDataArray>> getArrayBySet(List<CsDataSet> setList) { public HttpResult<List<CsDataArray>> getArrayBySet(String dataSet) {
log.error("{}异常,降级处理,异常为:{}","根据数据集获取详细数据失败",cause.toString()); log.error("{}异常,降级处理,异常为:{}","根据数据集获取详细数据失败",cause.toString());
throw new BusinessException(finalExceptionEnum); throw new BusinessException(finalExceptionEnum);
} }

View File

@@ -56,6 +56,24 @@ public class DataSetFeignClientFallbackFactory implements FallbackFactory<DataSe
log.error("{}异常,降级处理,异常为:{}","根据数据集ids获取数据集",cause.toString()); log.error("{}异常,降级处理,异常为:{}","根据数据集ids获取数据集",cause.toString());
throw new BusinessException(finalExceptionEnum); throw new BusinessException(finalExceptionEnum);
} }
@Override
public HttpResult<CsDataSet> getBaseDataSet(String modelId, Integer clDev) {
log.error("{}异常,降级处理,异常为:{}","获取实时数据-基础数据集",cause.toString());
throw new BusinessException(finalExceptionEnum);
}
@Override
public HttpResult<CsDataSet> getHarmonicDataSet(String modelId, Integer clDev, Integer target) {
log.error("{}异常,降级处理,异常为:{}","获取实时数据-谐波数据集",cause.toString());
throw new BusinessException(finalExceptionEnum);
}
@Override
public HttpResult<CsDataSet> getDataSetByIdx(String modelId, Integer idx) {
log.error("{}异常,降级处理,异常为:{}","根据idx获取数据集数据",cause.toString());
throw new BusinessException(finalExceptionEnum);
}
}; };
} }
} }

View File

@@ -77,6 +77,12 @@ public class EquipmentFeignClientFallbackFactory implements FallbackFactory<Equi
log.error("{}异常,降级处理,异常为:{}","获取所有装置",cause.toString()); log.error("{}异常,降级处理,异常为:{}","获取所有装置",cause.toString());
throw new BusinessException(finalExceptionEnum); throw new BusinessException(finalExceptionEnum);
} }
@Override
public HttpResult<Boolean> judgeDevModel(String nDid) {
log.error("{}异常,降级处理,异常为:{}","判断设备型号",cause.toString());
throw new BusinessException(finalExceptionEnum);
}
}; };
} }
} }

View File

@@ -51,6 +51,12 @@ public class WlRecordClientFallbackFactory implements FallbackFactory<WlRecordFe
log.error("{}异常,降级处理,异常为:{}","修改测试项",cause.toString()); log.error("{}异常,降级处理,异常为:{}","修改测试项",cause.toString());
throw new BusinessException(finalExceptionEnum); throw new BusinessException(finalExceptionEnum);
} }
@Override
public void dayDealNoEndTimeEvent(String date) {
log.error("{}异常,降级处理,异常为:{}","每日处理没有结束时间的测试基础数据",cause.toString());
throw new BusinessException(finalExceptionEnum);
}
}; };
} }
} }

View File

@@ -48,8 +48,16 @@ public interface DataParam {
String portableDev = "便携式设备"; String portableDev = "便携式设备";
String PORTABLE_SYSTEM = "便携式系统";
String WIRELESS_PROJECT = "无线项目";
String WIRELESS_PROJECT_ID = "WIRELESS_PROJECT_ID";
String governmentDev = "治理设备"; String governmentDev = "治理设备";
String GOVERNANCE_SYSTEM = "治理系统";
String EvtParamPhase = "Evt_Param_Phase"; String EvtParamPhase = "Evt_Param_Phase";
String EvtParamDepth = "Evt_Param_VVaDepth"; String EvtParamDepth = "Evt_Param_VVaDepth";

View File

@@ -47,6 +47,7 @@ public enum AlgorithmResponseEnum {
FILE_BUSY("A00516","正在进行其他文件操作,请稍后重试"), FILE_BUSY("A00516","正在进行其他文件操作,请稍后重试"),
RECORD_FILE_LOST("A00516","record.bin文件缺失请检查上传文件夹"), RECORD_FILE_LOST("A00516","record.bin文件缺失请检查上传文件夹"),
LINE_NUM_MISMATCH("A00516","上传文件的监测点序号和选择的监测点不匹配,请检查"), LINE_NUM_MISMATCH("A00516","上传文件的监测点序号和选择的监测点不匹配,请检查"),
DEV_OFFLINE("A00516","装置未连接MQTT服务器"),
; ;

View File

@@ -0,0 +1,118 @@
package com.njcn.csdevice.pojo.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* 初始化模板实体
* @author xy
*/
@Data
public class CsDevModelDto implements Serializable {
@ApiModelProperty("模板id")
private String id;
@ApiModelProperty("版本号")
private String versionNo;
@TableField("版本日期")
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
private Date versionDate;
@ApiModelProperty("模板名称")
private String name;
@ApiModelProperty("设备类型名称")
private String devTypeName;
@ApiModelProperty("模板存储路径")
private String filePath;
@ApiModelProperty("模板类型(0:治理类型 1:电能质量类型)")
private Integer type;
@ApiModelProperty("数据集")
private List<CsDataSet> dataSets;
@Data
public static class CsDataSet implements Serializable {
@ApiModelProperty("数据集id")
private String id;
@ApiModelProperty("模板id")
private String pid;
@ApiModelProperty("数据集名称")
private String name;
@ApiModelProperty("数据集别名")
private String anotherName;
@ApiModelProperty("数据集编号")
private Integer idx;
@ApiModelProperty("数据集类型")
private String dataType;
@ApiModelProperty("统计周期")
private Integer period;
@ApiModelProperty("是否存储 0:不存储 1:存储")
private Integer storeFlag;
@ApiModelProperty("逻辑子设备")
private Integer clDev;
@ApiModelProperty("数据集类型(0:主设备 1:子模块 2:监测设备)")
private Integer type;
@ApiModelProperty("数据类型(Primary:一次值 Secondary:二次值)")
private String dataLevel;
@ApiModelProperty("数据类型")
private List<CsDataArray> dataArrays;
}
@Data
public static class CsDataArray implements Serializable {
@ApiModelProperty("指标id")
private String id;
@ApiModelProperty("数据集id")
private String pid;
@ApiModelProperty("字典表id")
private String dataId;
@ApiModelProperty("数据集名称")
private String name;
@ApiModelProperty("数据集别名")
private String anotherName;
@ApiModelProperty("数据集编号")
private Integer idx;
@ApiModelProperty("数据统计方法(max、min、avg、cp95)")
private String statMethod;
@ApiModelProperty("数据类型")
private String dataType;
@ApiModelProperty("相别")
private String phase;
@ApiModelProperty("排序")
private Integer sort;
}
}

View File

@@ -1,9 +1,12 @@
package com.njcn.csdevice.pojo.param; package com.njcn.csdevice.pojo.param;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import java.util.Date;
/** /**
* *
@@ -36,8 +39,9 @@ public class CsDevModelAddParm {
/** /**
* 版本日期 * 版本日期
*/ */
@ApiModelProperty(value = "版本日期") @TableField(value = "version_date")
private String time; @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
private Date versionDate;
/** /**
* 装置模板文件路径 * 装置模板文件路径

View File

@@ -38,4 +38,14 @@ public class CsLineParam extends BaseEntity {
*/ */
private Integer conType; private Integer conType;
/**
* 模板id
*/
private String modelId;
/**
* 数据集id
*/
private String dataSetId;
} }

View File

@@ -0,0 +1,72 @@
package com.njcn.csdevice.pojo.po;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.time.LocalDateTime;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.njcn.db.bo.BaseEntity;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
*
* Description:
* Date: 2024/10/15 10:43【需求编号】
*
* @author clam
* @version V1.0.0
*/
@Data
@NoArgsConstructor
@TableName(value = "portable_off_main_log")
public class PortableOffMainLog extends BaseEntity {
/**
* 批次id
*/
@TableId(value = "id", type = IdType.INPUT)
private String id;
/**
* 导入开始时间
*/
@TableField(value = "start_time")
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss"
)
private LocalDateTime startTime;
/**
* 工程名称
*/
@TableField(value = "project_name")
private String projectName;
/**
* 导入结束时间
*/
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss"
)
@TableField(value = "end_time")
private LocalDateTime endTime;
/**
* 成功解析数
*/
@TableField(value = "success_count")
private Integer successCount;
/**
* 状态(0删除 1正常)
*/
@TableField(value = "status")
private String status;
@TableField(exist = false)
private List<PortableOfflLog> portableOfflLogList;
}

View File

@@ -1,5 +1,6 @@
package com.njcn.csdevice.pojo.po; package com.njcn.csdevice.pojo.po;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.njcn.db.bo.BaseEntity; import com.njcn.db.bo.BaseEntity;
import lombok.Getter; import lombok.Getter;
@@ -21,6 +22,8 @@ public class PortableOfflLog extends BaseEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private String logsIndex; private String logsIndex;
@TableField( value = "log_main_id")
private String logMainId;
/** /**
* 文件名称 * 文件名称
@@ -38,7 +41,7 @@ public class PortableOfflLog extends BaseEntity {
private String dataPath; private String dataPath;
/** /**
* 0-解析 1-解析成功 2-解析失败 3-文件不存在 * 0-无需解析解析 1-解析成功 2-解析失败 3-文件不存在
*/ */
private Integer state; private Integer state;

View File

@@ -45,6 +45,9 @@ public class CsLedgerVO implements Serializable {
@ApiModelProperty(name = "nDid",value = "nDid") @ApiModelProperty(name = "nDid",value = "nDid")
private String nDId; private String nDId;
@ApiModelProperty(name = "type",value = "类型 项目 工程 装置 监测点")
private String type;
@ApiModelProperty(name = "children",value = "子节点") @ApiModelProperty(name = "children",value = "子节点")
private List<CsLedgerVO> children = new ArrayList<>(); private List<CsLedgerVO> children = new ArrayList<>();

View File

@@ -53,4 +53,7 @@ public class DataGroupEventVO {
@ApiModelProperty("暂降幅值") @ApiModelProperty("暂降幅值")
private Float featureAmplitude; private Float featureAmplitude;
@ApiModelProperty("波形路径")
private String wavePath;
} }

View File

@@ -66,6 +66,9 @@ public class RecordVo {
@ApiModelProperty("电压接线方式") @ApiModelProperty("电压接线方式")
private String volConType; private String volConType;
@ApiModelProperty("基础数据集合ID")
private List<String> list;
@Data @Data
public static class RecordItemVo{ public static class RecordItemVo{

View File

@@ -83,5 +83,45 @@ public class CsDataSetController extends BaseController {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
} }
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/getBaseDataSet")
@ApiOperation("获取实时数据-基础数据集")
@ApiImplicitParams({
@ApiImplicitParam(name = "modelId", value = "模板id", required = true),
@ApiImplicitParam(name = "clDev", value = "逻辑子设备标识", required = true)
})
public HttpResult<CsDataSet> getBaseDataSet(@RequestParam("modelId") String modelId,@RequestParam("clDev") Integer clDev){
String methodDescribe = getMethodDescribe("getBaseDataSet");
CsDataSet dataSet = csDataSetService.getBaseDataSet(modelId,clDev);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, dataSet, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/getHarmonicDataSet")
@ApiOperation("获取实时数据-谐波数据集")
@ApiImplicitParams({
@ApiImplicitParam(name = "modelId", value = "模板id", required = true),
@ApiImplicitParam(name = "clDev", value = "逻辑子设备标识", required = true),
@ApiImplicitParam(name = "target", value = "指标序号", required = true),
})
public HttpResult<CsDataSet> getHarmonicDataSet(@RequestParam("modelId") String modelId,@RequestParam("clDev") Integer clDev,@RequestParam("target") Integer target){
String methodDescribe = getMethodDescribe("getHarmonicDataSet");
CsDataSet dataSet = csDataSetService.getHarmonicDataSet(modelId,clDev,target);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, dataSet, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/getDataSetByIdx")
@ApiOperation("根据idx获取数据集数据")
@ApiImplicitParams({
@ApiImplicitParam(name = "modelId", value = "模板id", required = true),
@ApiImplicitParam(name = "idx", value = "数据集序号", required = true)
})
public HttpResult<CsDataSet> getDataSetByIdx(@RequestParam("modelId") String modelId,@RequestParam("idx") Integer idx){
String methodDescribe = getMethodDescribe("getDataSetByIdx");
CsDataSet csDataSet = csDataSetService.getDataSetByIdx(modelId,idx);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, csDataSet, methodDescribe);
}
} }

View File

@@ -56,9 +56,10 @@ public class CsLogController extends BaseController {
@ApiOperation("查询日志") @ApiOperation("查询日志")
@ApiImplicitParam(name = "baseParam", value = "查询日志参数", required = true) @ApiImplicitParam(name = "baseParam", value = "查询日志参数", required = true)
public HttpResult<IPage<CsLogsPO>> queryLog(@RequestBody BaseParam baseParam){ public HttpResult<IPage<CsLogsPO>> queryLog(@RequestBody BaseParam baseParam){
IPage<CsLogsPO> list = csLogsPOService.queryPage(baseParam);
String methodDescribe = getMethodDescribe("queryLog"); String methodDescribe = getMethodDescribe("queryLog");
IPage<CsLogsPO> list = csLogsPOService.queryPage(baseParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
} }

View File

@@ -1,6 +1,7 @@
package com.njcn.csdevice.controller.equipment; package com.njcn.csdevice.controller.equipment;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import com.github.tocrhz.mqtt.publisher.MqttPublisher;
import com.njcn.common.pojo.annotation.OperateInfo; import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.enums.common.LogEnum; import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum; import com.njcn.common.pojo.enums.response.CommonResponseEnum;
@@ -38,6 +39,7 @@ public class DeviceFtpController extends BaseController {
private final DeviceFtpService deviceFtpService; private final DeviceFtpService deviceFtpService;
private final RedisUtil redisUtil; private final RedisUtil redisUtil;
private final MqttPublisher publisher;
@OperateInfo(info = LogEnum.BUSINESS_COMMON) @OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/askDeviceRootPath") @PostMapping("/askDeviceRootPath")
@@ -78,15 +80,21 @@ public class DeviceFtpController extends BaseController {
}) })
public HttpResult<String> downloadFile(@RequestParam("nDid") String nDid, @RequestParam("name") String name, @RequestParam("size") Integer size, @RequestParam("fileCheck") String fileCheck){ public HttpResult<String> downloadFile(@RequestParam("nDid") String nDid, @RequestParam("name") String name, @RequestParam("size") Integer size, @RequestParam("fileCheck") String fileCheck){
String methodDescribe = getMethodDescribe("downloadFile"); String methodDescribe = getMethodDescribe("downloadFile");
String result = deviceFtpService.downloadFile(nDid,name,size,fileCheck); deviceFtpService.downloadFile(nDid,name,size,fileCheck);
redisUtil.delete("downloadFilePath:"+name); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, "文件下载中,请稍等");
redisUtil.delete("fileCheck"+name);
redisUtil.delete("fileDowning:"+nDid);
if (Objects.isNull(result)) {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
} else {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
} }
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/getDownloadFilePath")
@ApiOperation("获取文件下载路径")
@ApiImplicitParams({
@ApiImplicitParam(name = "nDid", value = "nDid", required = true),
@ApiImplicitParam(name = "name", value = "文件路径名", required = true)
})
public HttpResult<String> getDownloadFilePath(@RequestParam("nDid") String nDid, @RequestParam("name") String name){
String methodDescribe = getMethodDescribe("getDownloadFilePath");
String result = deviceFtpService.getDownloadFilePath(nDid,name);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
} }
@OperateInfo(info = LogEnum.BUSINESS_COMMON) @OperateInfo(info = LogEnum.BUSINESS_COMMON)

View File

@@ -306,4 +306,13 @@ public class EquipmentDeliveryController extends BaseController {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
} }
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/judgeDevModel")
@ApiOperation("判断设备型号")
public HttpResult<Boolean> judgeDevModel(@RequestParam("nDid") String nDid){
String methodDescribe = getMethodDescribe("judgeDevModel");
boolean result = csEquipmentDeliveryService.judgeDevModel(nDid);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}
} }

View File

@@ -9,10 +9,12 @@ 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.common.utils.HttpResultUtil;
import com.njcn.csdevice.pojo.param.WlRecordTemplete; import com.njcn.csdevice.pojo.param.WlRecordTemplete;
import com.njcn.csdevice.pojo.po.PortableOffMainLog;
import com.njcn.csdevice.pojo.po.PortableOfflLog; import com.njcn.csdevice.pojo.po.PortableOfflLog;
import com.njcn.csdevice.service.IPortableOfflLogService; import com.njcn.csdevice.service.IPortableOfflLogService;
import com.njcn.csdevice.utils.ExcelStyleUtil; import com.njcn.csdevice.utils.ExcelStyleUtil;
import com.njcn.csdevice.param.UploadDataParam; import com.njcn.csdevice.param.UploadDataParam;
import com.njcn.minioss.config.MinIossProperties;
import com.njcn.oss.utils.FileStorageUtil; import com.njcn.oss.utils.FileStorageUtil;
import com.njcn.poi.excel.ExcelUtil; import com.njcn.poi.excel.ExcelUtil;
import com.njcn.poi.util.PoiUtil; import com.njcn.poi.util.PoiUtil;
@@ -55,7 +57,7 @@ public class PortableOfflLogController extends BaseController {
private final DicDataFeignClient dicDataFeignClient; private final DicDataFeignClient dicDataFeignClient;
private final FileStorageUtil fileStorageUtil; private final FileStorageUtil fileStorageUtil;
private final MinIossProperties minIossProperties;
@ResponseBody @ResponseBody
@ApiOperation("导出设备基础数据模板") @ApiOperation("导出设备基础数据模板")
@GetMapping(value = "getExcelTemplate") @GetMapping(value = "getExcelTemplate")
@@ -80,6 +82,15 @@ public class PortableOfflLogController extends BaseController {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
} }
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/queryMainLogPage")
@ApiOperation("便携式设备解析日志")
public HttpResult<Page<PortableOffMainLog>> queryMainLogPage(@RequestBody BaseParam baseParam){
String methodDescribe = getMethodDescribe("queryMainLogPage");
Page<PortableOffMainLog> list = iPortableOfflLogService.queryMainLogPage(baseParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON) @OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("离线数据导入") @ApiOperation("离线数据导入")
@PostMapping(value = "importEquipment") @PostMapping(value = "importEquipment")
@@ -110,7 +121,7 @@ public class PortableOfflLogController extends BaseController {
List<MultipartFile> excelreport = null; List<MultipartFile> excelreport = null;
try { try {
excelreport = fileStorageUtil.getAllFile("excelreport", path); excelreport = fileStorageUtil.getAllFile(minIossProperties.getBucket(), path);
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }

View File

@@ -67,6 +67,15 @@ public class CsLedgerController extends BaseController {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
} }
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/getztProjectTree")
@ApiOperation("三层设备树(项目层根节点为治理系统和便携式系统组态)")
public HttpResult<List<CsLedgerVO>> getztProjectTree(){
String methodDescribe = getMethodDescribe("getProjectTree");
List<CsLedgerVO> list = csLedgerService.getztProjectTree();
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON) @OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/add") @PostMapping("/add")
@ApiOperation("新增台账信息") @ApiOperation("新增台账信息")

View File

@@ -1,10 +1,12 @@
package com.njcn.csdevice.controller.line; package com.njcn.csdevice.controller.line;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.njcn.common.pojo.annotation.OperateInfo; import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.enums.common.LogEnum; import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum; 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.common.utils.HttpResultUtil;
import com.njcn.csdevice.mapper.CsLinePOMapper;
import com.njcn.csdevice.mapper.OverlimitMapper; import com.njcn.csdevice.mapper.OverlimitMapper;
import com.njcn.csdevice.pojo.param.CsLineParam; import com.njcn.csdevice.pojo.param.CsLineParam;
import com.njcn.csdevice.pojo.po.CsLinePO; import com.njcn.csdevice.pojo.po.CsLinePO;
@@ -41,6 +43,7 @@ public class CslineController extends BaseController {
private final CsLinePOService csLinePOService; private final CsLinePOService csLinePOService;
private final OverlimitMapper overlimitMapper; private final OverlimitMapper overlimitMapper;
private final CsLinePOMapper csLinePOMapper;
@OperateInfo(info = LogEnum.BUSINESS_COMMON) @OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/queryLineById") @PostMapping("/queryLineById")
@@ -121,4 +124,38 @@ public class CslineController extends BaseController {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
} }
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/updateIds")
@ApiOperation("修改监测点模板id和数据集id")
@ApiImplicitParam(name = "csLineParam", value = "监测点信息", required = true)
@ApiIgnore
public HttpResult<Boolean> updateIds(@RequestBody @Validated CsLineParam csLineParam) {
String methodDescribe = getMethodDescribe("updateIds");
csLinePOService.updateIds(csLineParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/getById")
@ApiOperation("根据监测点id获取监测点详情")
@ApiImplicitParam(name = "lineId", value = "监测点id", required = true)
@ApiIgnore
public HttpResult<CsLinePO> getById(@RequestParam String lineId) {
String methodDescribe = getMethodDescribe("getById");
LambdaQueryWrapper<CsLinePO> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(CsLinePO::getLineId,lineId).eq(CsLinePO::getStatus,1);
CsLinePO po = csLinePOService.getOne(queryWrapper);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, po, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/getOverLimitData")
@ApiOperation("根据监测点id获取国标限值")
@ApiImplicitParam(name = "id", value = "监测点id", required = true)
public HttpResult<Overlimit> getOverLimitData(@RequestParam("id") String id) {
String methodDescribe = getMethodDescribe("getOverLimitData");
Overlimit result = overlimitMapper.selectById(id);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}
} }

View File

@@ -203,9 +203,9 @@ public class WlRecordController extends BaseController {
@OperateInfo(info = LogEnum.SYSTEM_COMMON) @OperateInfo(info = LogEnum.SYSTEM_COMMON)
@PostMapping("/dayDealNoEndTimeEvent") @PostMapping("/dayDealNoEndTimeEvent")
@ApiOperation("每日处理没有结束时间的测试基础数据") @ApiOperation("每日处理没有结束时间的测试基础数据")
public void dayDealNoEndTimeEvent() { public void dayDealNoEndTimeEvent(@RequestParam("date") String date) {
String methodDescribe = getMethodDescribe("dayDealNoEndTimeEvent"); String methodDescribe = getMethodDescribe("dayDealNoEndTimeEvent");
wlRecordService.dayDealNoEndTimeEvent(); wlRecordService.dayDealNoEndTimeEvent(date);
} }
} }

View File

@@ -0,0 +1,28 @@
package com.njcn.csdevice.init;
import com.njcn.csdevice.service.CsDevModelService;
import com.njcn.csdevice.service.CsEquipmentDeliveryService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;
/**
* 项目初始化缓存设备池,后续从缓存中获取设备数据
* @author xy
*/
@Slf4j
@Component
@AllArgsConstructor
public class InitData implements CommandLineRunner {
private final CsEquipmentDeliveryService csEquipmentDeliveryService;
private final CsDevModelService csDevModelService;
@Override
public void run(String... args) {
csEquipmentDeliveryService.refreshDeviceDataCache();
csDevModelService.refreshDevModelCache();
}
}

View File

@@ -1,8 +1,10 @@
package com.njcn.csdevice.mapper; package com.njcn.csdevice.mapper;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.device.biz.pojo.po.Overlimit; import com.njcn.device.biz.pojo.po.Overlimit;
import org.apache.ibatis.annotations.Mapper;
/** /**
@@ -13,6 +15,8 @@ import com.njcn.device.biz.pojo.po.Overlimit;
* @author cdf * @author cdf
* @since 2022-01-04 * @since 2022-01-04
*/ */
@DS("sjzx")
@Mapper
public interface OverlimitMapper extends BaseMapper<Overlimit> { public interface OverlimitMapper extends BaseMapper<Overlimit> {
} }

View File

@@ -0,0 +1,15 @@
package com.njcn.csdevice.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.csdevice.pojo.po.PortableOffMainLog;
/**
*
* Description:
* Date: 2024/10/15 10:43【需求编号】
*
* @author clam
* @version V1.0.0
*/
public interface PortableOffMainLogMapper extends BaseMapper<PortableOffMainLog> {
}

View File

@@ -105,6 +105,7 @@
t0.ndid = #{param.id} t0.ndid = #{param.id}
and t1.did = #{param.did} and t1.did = #{param.did}
and t3.cl_dev = #{param.cldId} and t3.cl_dev = #{param.cldId}
and (t3.data_type = 'Stat' or t3.data_type is NULL)
and t4.stat_method = #{param.statMethod} and t4.stat_method = #{param.statMethod}
order by t4.sort order by t4.sort
</select> </select>

View File

@@ -12,7 +12,9 @@
from from
cs_data_set cs_data_set
where where
pid = #{modelId} and cl_dev = #{clDev} pid = #{modelId}
and cl_dev = #{clDev}
and data_type in ('Stat',NULL)
order by type,cl_dev order by type,cl_dev
</select> </select>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.csdevice.mapper.PortableOffMainLogMapper">
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, start_time, project_name, end_time, success_count, create_by, create_time, update_by,
update_time
</sql>
</mapper>

View File

@@ -64,6 +64,7 @@
</if> </if>
exists exists
(select 1 from wl_record_test_data wd where wd.test_item_id = #{wlRecordPageParam.id} and wd.data_id = a.id) (select 1 from wl_record_test_data wd where wd.test_item_id = #{wlRecordPageParam.id} and wd.data_id = a.id)
order by a.start_time asc
</select> </select>
<select id="getAll" resultType="com.njcn.csdevice.pojo.vo.CsLedgerVO"> <select id="getAll" resultType="com.njcn.csdevice.pojo.vo.CsLedgerVO">

View File

@@ -20,6 +20,12 @@ import com.njcn.csdevice.pojo.vo.CsDevModelPageVO;
*/ */
public interface CsDevModelService extends IService<CsDevModelPO>{ public interface CsDevModelService extends IService<CsDevModelPO>{
/**
* 初始化缓存模板信息
* 想缓存模板,发现数据量太大,先按照之前的逻辑处理
*/
void refreshDevModelCache();
/** /**
* @Description: addDevModel * @Description: addDevModel
* @Param: [csDevModelAddParm] * @Param: [csDevModelAddParm]

View File

@@ -27,6 +27,11 @@ import java.util.List;
*/ */
public interface CsEquipmentDeliveryService extends IService<CsEquipmentDeliveryPO>{ public interface CsEquipmentDeliveryService extends IService<CsEquipmentDeliveryPO>{
/**
* 初始化缓存设备池
*/
void refreshDeviceDataCache();
/** /**
* @Description: save * @Description: save
* @Param: [csEquipmentDeliveryAddParm] * @Param: [csEquipmentDeliveryAddParm]
@@ -123,4 +128,9 @@ public interface CsEquipmentDeliveryService extends IService<CsEquipmentDelivery
* @return * @return
*/ */
List<CsEquipmentDeliveryPO> getAll(); List<CsEquipmentDeliveryPO> getAll();
/**
* 判断设备型号
*/
boolean judgeDevModel(String nDid);
} }

View File

@@ -40,4 +40,9 @@ public interface CsLinePOService extends IService<CsLinePO>{
*/ */
void updateLine(CsLineParam csLineParam); void updateLine(CsLineParam csLineParam);
/**
* 修改监测点的数据集id和模板id
* @param csLineParam
*/
void updateIds(CsLineParam csLineParam);
} }

View File

@@ -10,7 +10,9 @@ public interface DeviceFtpService {
List<MakeUpVo> askDeviceFileOrDir(String nDid, String name, String type); List<MakeUpVo> askDeviceFileOrDir(String nDid, String name, String type);
String downloadFile(String nDid, String name, Integer size, String fileCheck); void downloadFile(String nDid, String name, Integer size, String fileCheck);
String getDownloadFilePath(String nDid, String name);
boolean createFile(String nDid, String path); boolean createFile(String nDid, String path);

View File

@@ -50,4 +50,9 @@ public interface ICsDataArrayService extends IService<CsDataArray> {
* @return * @return
*/ */
List<CsDataArray> findListByParam(DataArrayParam param); List<CsDataArray> findListByParam(DataArrayParam param);
/**
* 根据数据集id获取指标数据
*/
List<CsDataArray> getDataArrayByDataSetIds(List<String> dataSetIds);
} }

View File

@@ -52,4 +52,21 @@ public interface ICsDataSetService extends IService<CsDataSet> {
* @return * @return
*/ */
List<CsDataSet> getDataSetBySetIds(List<String> setIds); List<CsDataSet> getDataSetBySetIds(List<String> setIds);
CsDataSet getBaseDataSet(String modelId,Integer clDev);
CsDataSet getHarmonicDataSet(String modelId,Integer clDev,Integer target);
/**
* 根据模板和idx获取数据集数据
* @param modelId
* @param idx
* @return
*/
CsDataSet getDataSetByIdx(String modelId, Integer idx);
/**
* 根据模板id获取所有数据集
*/
List<CsDataSet> getDataSetByModelId(List<String> modelList);
} }

View File

@@ -74,4 +74,6 @@ public interface ICsLedgerService extends IService<CsLedger> {
List<CsLedger> queryLine(LineParamDTO lineParamdto); List<CsLedger> queryLine(LineParamDTO lineParamdto);
DevDetailDTO queryDevDetail(String devId); DevDetailDTO queryDevDetail(String devId);
List<CsLedgerVO> getztProjectTree();
} }

View File

@@ -2,6 +2,7 @@ package com.njcn.csdevice.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.csdevice.pojo.po.PortableOffMainLog;
import com.njcn.csdevice.pojo.po.PortableOfflLog; import com.njcn.csdevice.pojo.po.PortableOfflLog;
import com.njcn.csdevice.param.UploadDataParam; import com.njcn.csdevice.param.UploadDataParam;
import com.njcn.web.pojo.param.BaseParam; import com.njcn.web.pojo.param.BaseParam;
@@ -19,4 +20,6 @@ public interface IPortableOfflLogService extends IService<PortableOfflLog> {
Page<PortableOfflLog> queryPage(BaseParam baseParam); Page<PortableOfflLog> queryPage(BaseParam baseParam);
void importEquipment(UploadDataParam uploadDataParam); void importEquipment(UploadDataParam uploadDataParam);
Page<PortableOffMainLog> queryMainLogPage(BaseParam baseParam);
} }

View File

@@ -106,6 +106,6 @@ public interface IWlRecordService extends IService<WlRecord> {
/** /**
* 每日处理没有结束时间的测试基础数据 * 每日处理没有结束时间的测试基础数据
*/ */
void dayDealNoEndTimeEvent(); void dayDealNoEndTimeEvent(String date);
} }

View File

@@ -0,0 +1,21 @@
package com.njcn.csdevice.service;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.njcn.device.biz.pojo.po.Overlimit;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.csdevice.mapper.OverlimitMapper;
import com.njcn.csdevice.service.impl.OverlimitService;
/**
*
* Description:
* Date: 2024/10/22 14:14【需求编号】
*
* @author clam
* @version V1.0.0
*/
@Service
@DS("sjzx")
public class OverlimitServiceImpl extends ServiceImpl<OverlimitMapper, Overlimit> implements OverlimitService{
}

View File

@@ -0,0 +1,16 @@
package com.njcn.csdevice.service;
import com.njcn.csdevice.pojo.po.PortableOffMainLog;
import com.baomidou.mybatisplus.extension.service.IService;
/**
*
* Description:
* Date: 2024/10/15 10:43【需求编号】
*
* @author clam
* @version V1.0.0
*/
public interface PortableOffMainLogService extends IService<PortableOffMainLog>{
}

View File

@@ -6,6 +6,7 @@ import com.njcn.csdevice.mapper.CsDataArrayMapper;
import com.njcn.csdevice.pojo.dto.DataArrayDTO; import com.njcn.csdevice.pojo.dto.DataArrayDTO;
import com.njcn.csdevice.pojo.param.DataArrayParam; import com.njcn.csdevice.pojo.param.DataArrayParam;
import com.njcn.csdevice.pojo.po.CsDataArray; import com.njcn.csdevice.pojo.po.CsDataArray;
import com.njcn.csdevice.pojo.po.CsDataSet;
import com.njcn.csdevice.pojo.vo.DataArrayTreeVO; import com.njcn.csdevice.pojo.vo.DataArrayTreeVO;
import com.njcn.csdevice.pojo.vo.DeviceManagerDetailVO; import com.njcn.csdevice.pojo.vo.DeviceManagerDetailVO;
import com.njcn.csdevice.service.ICsDataArrayService; import com.njcn.csdevice.service.ICsDataArrayService;
@@ -174,4 +175,11 @@ public class CsDataArrayServiceImpl extends ServiceImpl<CsDataArrayMapper, CsDat
public List<CsDataArray> findListByParam(DataArrayParam param) { public List<CsDataArray> findListByParam(DataArrayParam param) {
return this.baseMapper.findListByParam(param); return this.baseMapper.findListByParam(param);
} }
@Override
public List<CsDataArray> getDataArrayByDataSetIds(List<String> dataSetIds) {
return this.lambdaQuery()
.in(CsDataArray::getPid,dataSetIds)
.list();
}
} }

View File

@@ -1,5 +1,6 @@
package com.njcn.csdevice.service.impl; package com.njcn.csdevice.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.csdevice.mapper.CsDataSetMapper; import com.njcn.csdevice.mapper.CsDataSetMapper;
import com.njcn.csdevice.pojo.po.CsDataSet; import com.njcn.csdevice.pojo.po.CsDataSet;
@@ -9,6 +10,7 @@ import org.springframework.stereotype.Service;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator;
import java.util.List; import java.util.List;
/** /**
@@ -24,12 +26,22 @@ public class CsDataSetServiceImpl extends ServiceImpl<CsDataSetMapper, CsDataSet
@Override @Override
public List<CsDataSet> findDataSetByModelId(String modelId, Integer clDev) { public List<CsDataSet> findDataSetByModelId(String modelId, Integer clDev) {
return this.lambdaQuery().eq(CsDataSet::getPid,modelId).eq(CsDataSet::getClDev,clDev).list(); return this.lambdaQuery()
.eq(CsDataSet::getPid,modelId)
.eq(CsDataSet::getClDev,clDev)
.and(i->i.eq(CsDataSet::getDataType,"Stat").or().isNull(CsDataSet::getDataType))
.list();
} }
@Override @Override
public List<CsDataSet> findDataSetByModelId(String modelId) { public List<CsDataSet> findDataSetByModelId(String modelId) {
return this.lambdaQuery().eq(CsDataSet::getPid,modelId).in(CsDataSet::getType, Arrays.asList(0,2)).orderByAsc(CsDataSet::getType,CsDataSet::getClDev).list(); return this.lambdaQuery()
.eq(CsDataSet::getPid,modelId)
.in(CsDataSet::getType, Arrays.asList(0,2))
.eq(CsDataSet::getStoreFlag,1)
.and(i->i.eq(CsDataSet::getDataType,"Stat").or().isNull(CsDataSet::getDataType))
.orderByAsc(CsDataSet::getType,CsDataSet::getClDev)
.list();
} }
@Override @Override
@@ -47,4 +59,46 @@ public class CsDataSetServiceImpl extends ServiceImpl<CsDataSetMapper, CsDataSet
return this.lambdaQuery().in(CsDataSet::getId,setIds).list(); return this.lambdaQuery().in(CsDataSet::getId,setIds).list();
} }
@Override
public CsDataSet getBaseDataSet(String modelId, Integer clDev) {
List<CsDataSet> list = this.lambdaQuery()
.eq(CsDataSet::getPid,modelId)
.eq(CsDataSet::getClDev,clDev)
.and(i->i.eq(CsDataSet::getDataType,"Rt").or().isNull(CsDataSet::getDataType))
.list();
return list.stream().min(Comparator.comparingInt(CsDataSet::getIdx)).get();
}
@Override
public CsDataSet getHarmonicDataSet(String modelId, Integer clDev,Integer target) {
LambdaQueryWrapper<CsDataSet> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(CsDataSet::getPid,modelId)
.eq(CsDataSet::getClDev,clDev)
.and(i->i.eq(CsDataSet::getDataType,"Rt").or().isNull(CsDataSet::getDataType));
//谐波电压含有率
if (target == 0) {
wrapper.eq(CsDataSet::getName,"Ds$Pqd$Rt$HarmV$01");
} else if (target == 1) {
wrapper.eq(CsDataSet::getName,"Ds$Pqd$Rt$HarmI$01");
} else if (target == 2) {
wrapper.eq(CsDataSet::getName,"Ds$Pqd$Rt$InHarmV$01");
}
return this.baseMapper.selectOne(wrapper);
}
@Override
public CsDataSet getDataSetByIdx(String modelId, Integer idx) {
return this.lambdaQuery()
.eq(CsDataSet::getPid,modelId)
.in(CsDataSet::getIdx, idx)
.one();
}
@Override
public List<CsDataSet> getDataSetByModelId(List<String> modelList) {
return this.lambdaQuery()
.in(CsDataSet::getPid,modelList)
.list();
}
} }

View File

@@ -1,22 +1,37 @@
package com.njcn.csdevice.service.impl; package com.njcn.csdevice.service.impl;
import cn.hutool.core.collection.CollUtil;
import com.alibaba.nacos.shaded.com.google.gson.Gson;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.csdevice.mapper.CsDevModelMapper; import com.njcn.csdevice.mapper.CsDevModelMapper;
import com.njcn.csdevice.pojo.dto.CsDevModelDto;
import com.njcn.csdevice.pojo.param.CsDevModelAddParm; import com.njcn.csdevice.pojo.param.CsDevModelAddParm;
import com.njcn.csdevice.pojo.param.CsDevModelAuditParm; import com.njcn.csdevice.pojo.param.CsDevModelAuditParm;
import com.njcn.csdevice.pojo.param.CsDevModelQueryListParm; import com.njcn.csdevice.pojo.param.CsDevModelQueryListParm;
import com.njcn.csdevice.pojo.param.CsDevModelQueryParm; import com.njcn.csdevice.pojo.param.CsDevModelQueryParm;
import com.njcn.csdevice.pojo.po.CsDataArray;
import com.njcn.csdevice.pojo.po.CsDataSet;
import com.njcn.csdevice.pojo.po.CsDevModelPO; import com.njcn.csdevice.pojo.po.CsDevModelPO;
import com.njcn.csdevice.pojo.vo.CsDevModelPageVO; import com.njcn.csdevice.pojo.vo.CsDevModelPageVO;
import com.njcn.csdevice.service.CsDevModelService; import com.njcn.csdevice.service.CsDevModelService;
import com.njcn.csdevice.service.ICsDataArrayService;
import com.njcn.csdevice.service.ICsDataSetService;
import com.njcn.redis.pojo.enums.AppRedisKey;
import com.njcn.redis.utils.RedisUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.sql.Date; import java.sql.Date;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/** /**
* *
@@ -27,16 +42,77 @@ import java.sql.Date;
* @author clam * @author clam
* @version V1.0.0 * @version V1.0.0
*/ */
@Slf4j
@Service @Service
@RequiredArgsConstructor
public class CsDevModelServiceImpl extends ServiceImpl<CsDevModelMapper, CsDevModelPO> implements CsDevModelService{ public class CsDevModelServiceImpl extends ServiceImpl<CsDevModelMapper, CsDevModelPO> implements CsDevModelService{
private final ICsDataSetService csDataSetService;
private final ICsDataArrayService csDataArrayService;
private final RedisUtil redisUtil;
@Override
public void refreshDevModelCache() {
// List<CsDevModelDto> csDevModelDtoList = new ArrayList<>();
// List<CsDevModelDto.CsDataSet> csDataSetList = new ArrayList<>();
// List<CsDevModelDto.CsDataArray> csDataArrayList = new ArrayList<>();
// //获取系统所有模板
// LambdaQueryWrapper<CsDevModelPO> queryWrapper = new LambdaQueryWrapper<>();
// queryWrapper.eq(CsDevModelPO::getStatus,1);
// List<CsDevModelPO> list = this.list(queryWrapper);
// //根据模板ids获取数据集
// if (CollUtil.isNotEmpty(list)) {
// List<String> modelIds = list.stream().map(CsDevModelPO::getId).collect(Collectors.toList());
// List<CsDataSet> csDataSets = csDataSetService.getDataSetByModelId(modelIds);
// //根据数据集获取具体指标
// List<String> dataSetList = csDataSets.stream().map(CsDataSet::getId).collect(Collectors.toList());
// List<CsDataArray> csDataArrays = csDataArrayService.getDataArrayByDataSetIds(dataSetList);
//
// list.forEach(item->{
// CsDevModelDto dto = new CsDevModelDto();
// BeanUtils.copyProperties(item,dto);
// csDevModelDtoList.add(dto);
// });
// csDataSets.forEach(item->{
// CsDevModelDto.CsDataSet dto = new CsDevModelDto.CsDataSet();
// BeanUtils.copyProperties(item,dto);
// csDataSetList.add(dto);
// });
// csDataArrays.forEach(item->{
// CsDevModelDto.CsDataArray dto = new CsDevModelDto.CsDataArray();
// BeanUtils.copyProperties(item,dto);
// csDataArrayList.add(dto);
// });
//
// for (CsDevModelDto.CsDataSet item1 : csDataSetList) {
// List<CsDevModelDto.CsDataArray> list1 = new ArrayList<>();
// for (CsDevModelDto.CsDataArray item2 : csDataArrayList) {
// if (Objects.equals(item1.getId(),item2.getPid())) {
// list1.add(item2);
// }
// }
// item1.setDataArrays(list1);
// }
//
// for (CsDevModelDto item1 : csDevModelDtoList) {
// List<CsDevModelDto.CsDataSet> list1 = new ArrayList<>();
// for (CsDevModelDto.CsDataSet item2 : csDataSetList) {
// if (Objects.equals(item1.getId(),item2.getPid())) {
// list1.add(item2);
// }
// }
// item1.setDataSets(list1);
// redisUtil.saveByKey(AppRedisKey.DEV_MODEL.concat(item1.getId()),item1);
// }
// }
}
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public CsDevModelPO addDevModel(CsDevModelAddParm csDevModelAddParm) { public CsDevModelPO addDevModel(CsDevModelAddParm csDevModelAddParm) {
CsDevModelPO csDevModelPO = new CsDevModelPO (); CsDevModelPO csDevModelPO = new CsDevModelPO ();
BeanUtils.copyProperties (csDevModelAddParm, csDevModelPO); BeanUtils.copyProperties (csDevModelAddParm, csDevModelPO);
csDevModelPO.setStatus ("1"); csDevModelPO.setStatus ("1");
csDevModelPO.setVersionDate(Date.valueOf(csDevModelAddParm.getTime()));
this.save (csDevModelPO); this.save (csDevModelPO);
return csDevModelPO; return csDevModelPO;
} }
@@ -46,8 +122,7 @@ public class CsDevModelServiceImpl extends ServiceImpl<CsDevModelMapper, CsDevMo
public Boolean AuditDevModel(CsDevModelAuditParm csDevModelAuditParm) { public Boolean AuditDevModel(CsDevModelAuditParm csDevModelAuditParm) {
CsDevModelPO csDevModelPO = new CsDevModelPO (); CsDevModelPO csDevModelPO = new CsDevModelPO ();
BeanUtils.copyProperties (csDevModelAuditParm, csDevModelPO); BeanUtils.copyProperties (csDevModelAuditParm, csDevModelPO);
boolean b = this.updateById (csDevModelPO); return this.updateById (csDevModelPO);
return b;
} }
@Override @Override
@@ -61,8 +136,7 @@ public class CsDevModelServiceImpl extends ServiceImpl<CsDevModelMapper, CsDevMo
@Override @Override
public CsDevModelPageVO queryDevModelOne(CsDevModelQueryListParm csDevModelQueryListParm) { public CsDevModelPageVO queryDevModelOne(CsDevModelQueryListParm csDevModelQueryListParm) {
CsDevModelPageVO result = this.getBaseMapper ().queryOne(csDevModelQueryListParm); return this.getBaseMapper ().queryOne(csDevModelQueryListParm);
return result;
} }
@Override @Override

View File

@@ -39,6 +39,7 @@ import com.njcn.redis.utils.RedisUtil;
import com.njcn.system.api.DicDataFeignClient; import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.api.DictTreeFeignClient; import com.njcn.system.api.DictTreeFeignClient;
import com.njcn.system.enums.DicDataEnum; import com.njcn.system.enums.DicDataEnum;
import com.njcn.system.enums.DicTreeEnum;
import com.njcn.system.pojo.vo.DictTreeVO; import com.njcn.system.pojo.vo.DictTreeVO;
import com.njcn.web.factory.PageFactory; import com.njcn.web.factory.PageFactory;
import com.njcn.web.utils.RequestUtil; import com.njcn.web.utils.RequestUtil;
@@ -90,9 +91,18 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
private final RedisUtil redisUtil; private final RedisUtil redisUtil;
private final CsSoftInfoMapper csSoftInfoMapper; private final CsSoftInfoMapper csSoftInfoMapper;
@Override
public void refreshDeviceDataCache() {
LambdaQueryWrapper<CsEquipmentDeliveryPO> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.ne(CsEquipmentDeliveryPO::getRunStatus,0);
List<CsEquipmentDeliveryPO> deliveryPOS = this.list(queryWrapper);
redisUtil.saveByKey(AppRedisKey.DEVICE_LIST,deliveryPOS);
}
@Override @Override
@Transactional(rollbackFor = {Exception.class}) @Transactional(rollbackFor = {Exception.class})
public Boolean save(CsEquipmentDeliveryAddParm csEquipmentDeliveryAddParm) { public Boolean save(CsEquipmentDeliveryAddParm csEquipmentDeliveryAddParm) {
boolean result;
CsEquipmentDeliveryPO po = this.queryEquipmentPOByndid (csEquipmentDeliveryAddParm.getNdid()); CsEquipmentDeliveryPO po = this.queryEquipmentPOByndid (csEquipmentDeliveryAddParm.getNdid());
if(!Objects.isNull (po)){ if(!Objects.isNull (po)){
throw new BusinessException (AlgorithmResponseEnum.NDID_ERROR); throw new BusinessException (AlgorithmResponseEnum.NDID_ERROR);
@@ -121,7 +131,11 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
csEquipmentProcess.setStatus (1); csEquipmentProcess.setStatus (1);
csEquipmentProcessPOService.save(csEquipmentProcess); csEquipmentProcessPOService.save(csEquipmentProcess);
return this.save (csEquipmentDeliveryPo); result = this.save (csEquipmentDeliveryPo);
if (result) {
refreshDeviceDataCache();
}
return result;
} }
@Override @Override
@@ -161,6 +175,9 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
csDevModelRelationService.lambdaUpdate().eq(CsDevModelRelationPO::getDevId,id).set(CsDevModelRelationPO::getStatus,0).update(); csDevModelRelationService.lambdaUpdate().eq(CsDevModelRelationPO::getDevId,id).set(CsDevModelRelationPO::getStatus,0).update();
if (update) {
refreshDeviceDataCache();
}
return update; return update;
} }
@@ -199,6 +216,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
@Override @Override
public Boolean updateEquipmentDelivery(CsEquipmentDeliveryAuditParm csEquipmentDeliveryAuditParm) { public Boolean updateEquipmentDelivery(CsEquipmentDeliveryAuditParm csEquipmentDeliveryAuditParm) {
boolean result;
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getNdid,csEquipmentDeliveryAuditParm.getNdid()) lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getNdid,csEquipmentDeliveryAuditParm.getNdid())
.in(CsEquipmentDeliveryPO::getStatus,Arrays.asList(1,2,3)) .in(CsEquipmentDeliveryPO::getStatus,Arrays.asList(1,2,3))
@@ -210,14 +228,22 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
} }
CsEquipmentDeliveryPO csEquipmentDeliveryPo = new CsEquipmentDeliveryPO(); CsEquipmentDeliveryPO csEquipmentDeliveryPo = new CsEquipmentDeliveryPO();
BeanUtils.copyProperties (csEquipmentDeliveryAuditParm, csEquipmentDeliveryPo); BeanUtils.copyProperties (csEquipmentDeliveryAuditParm, csEquipmentDeliveryPo);
return this.updateById (csEquipmentDeliveryPo); result = this.updateById(csEquipmentDeliveryPo);
if (result) {
refreshDeviceDataCache();
}
return result;
} }
@Override @Override
public void updateStatusBynDid(String nDId,Integer status) { public void updateStatusBynDid(String nDId,Integer status) {
boolean result;
LambdaUpdateWrapper<CsEquipmentDeliveryPO> lambdaUpdateWrapper = new LambdaUpdateWrapper<>(); LambdaUpdateWrapper<CsEquipmentDeliveryPO> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
lambdaUpdateWrapper.set(CsEquipmentDeliveryPO::getStatus,status).eq(CsEquipmentDeliveryPO::getNdid,nDId); lambdaUpdateWrapper.set(CsEquipmentDeliveryPO::getStatus,status).eq(CsEquipmentDeliveryPO::getNdid,nDId);
this.update(lambdaUpdateWrapper); result = this.update(lambdaUpdateWrapper);
if (result) {
refreshDeviceDataCache();
}
} }
@Override @Override
@@ -363,7 +389,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
//趋势数据tab //趋势数据tab
DeviceManagerVO.DataSetVO dataSetVo3 = new DeviceManagerVO.DataSetVO(); DeviceManagerVO.DataSetVO dataSetVo3 = new DeviceManagerVO.DataSetVO();
dataSetVo3.setId(item.getId()); dataSetVo3.setId(item.getId());
dataSetVo3.setName("历史趋势数据"); dataSetVo3.setName("历史趋势");
dataSetVo3.setType("trenddata"); dataSetVo3.setType("trenddata");
dataSetList.add(dataSetVo3); dataSetList.add(dataSetVo3);
//实时数据tab //实时数据tab
@@ -391,9 +417,13 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
@Override @Override
public void updateSoftInfoBynDid(String nDid, String id, Integer module) { public void updateSoftInfoBynDid(String nDid, String id, Integer module) {
boolean result;
LambdaUpdateWrapper<CsEquipmentDeliveryPO> lambdaUpdateWrapper = new LambdaUpdateWrapper<>(); LambdaUpdateWrapper<CsEquipmentDeliveryPO> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
lambdaUpdateWrapper.set(CsEquipmentDeliveryPO::getSoftinfoId,id).set(CsEquipmentDeliveryPO::getModuleNumber,module).eq(CsEquipmentDeliveryPO::getNdid,nDid); lambdaUpdateWrapper.set(CsEquipmentDeliveryPO::getSoftinfoId,id).set(CsEquipmentDeliveryPO::getModuleNumber,module).eq(CsEquipmentDeliveryPO::getNdid,nDid);
this.update(lambdaUpdateWrapper); result = this.update(lambdaUpdateWrapper);
if (result) {
refreshDeviceDataCache();
}
} }
@Override @Override
@@ -541,6 +571,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
appLineTopologyDiagramPOQueryWrapper.in("line_id",collect); appLineTopologyDiagramPOQueryWrapper.in("line_id",collect);
appLineTopologyDiagramService.remove(appLineTopologyDiagramPOQueryWrapper); appLineTopologyDiagramService.remove(appLineTopologyDiagramPOQueryWrapper);
} }
refreshDeviceDataCache();
} }
@Override @Override
@@ -585,20 +616,28 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
@Override @Override
public void updateSoftInfo(String nDid, String id) { public void updateSoftInfo(String nDid, String id) {
boolean result;
LambdaUpdateWrapper<CsEquipmentDeliveryPO> lambdaUpdateWrapper = new LambdaUpdateWrapper<>(); LambdaUpdateWrapper<CsEquipmentDeliveryPO> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
lambdaUpdateWrapper.eq(CsEquipmentDeliveryPO::getNdid,nDid) lambdaUpdateWrapper.eq(CsEquipmentDeliveryPO::getNdid,nDid)
.ne(CsEquipmentDeliveryPO::getRunStatus,0) .ne(CsEquipmentDeliveryPO::getRunStatus,0)
.set(CsEquipmentDeliveryPO::getSoftinfoId,id); .set(CsEquipmentDeliveryPO::getSoftinfoId,id);
this.update(lambdaUpdateWrapper); result = this.update(lambdaUpdateWrapper);
if (result) {
refreshDeviceDataCache();
}
} }
@Override @Override
public void updateModuleNumber(String nDid, Integer number) { public void updateModuleNumber(String nDid, Integer number) {
boolean result;
LambdaUpdateWrapper<CsEquipmentDeliveryPO> lambdaUpdateWrapper = new LambdaUpdateWrapper<>(); LambdaUpdateWrapper<CsEquipmentDeliveryPO> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
lambdaUpdateWrapper.eq(CsEquipmentDeliveryPO::getNdid,nDid) lambdaUpdateWrapper.eq(CsEquipmentDeliveryPO::getNdid,nDid)
.ne(CsEquipmentDeliveryPO::getRunStatus,0) .ne(CsEquipmentDeliveryPO::getRunStatus,0)
.set(CsEquipmentDeliveryPO::getModuleNumber,number); .set(CsEquipmentDeliveryPO::getModuleNumber,number);
this.update(lambdaUpdateWrapper); result = this.update(lambdaUpdateWrapper);
if (result) {
refreshDeviceDataCache();
}
} }
@Override @Override
@@ -608,10 +647,13 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
askDeviceDataFeignClient.rebootDevice(nDid); askDeviceDataFeignClient.rebootDevice(nDid);
Thread.sleep(3000); Thread.sleep(3000);
String key = AppRedisKey.CONTROL + nDid; String key = AppRedisKey.CONTROL + nDid;
String value = redisUtil.getObjectByKey(key).toString(); Object object = redisUtil.getObjectByKey(key);
if (Objects.nonNull(object)) {
String value = object.toString();
if (Objects.equals(value,"success")) { if (Objects.equals(value,"success")) {
result = true; result = true;
} }
}
} catch (InterruptedException e) { } catch (InterruptedException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
@@ -623,6 +665,19 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
return this.lambdaQuery().ne(CsEquipmentDeliveryPO::getRunStatus,0).list(); return this.lambdaQuery().ne(CsEquipmentDeliveryPO::getRunStatus,0).list();
} }
@Override
public boolean judgeDevModel(String nDid) {
boolean result = false;
//获取装置id
CsEquipmentDeliveryPO po = findDevByNDid(nDid);
//设备型号
String code = dictTreeFeignClient.queryById(po.getDevModel()).getData().getCode();
if (Objects.equals(DicTreeEnum.PQ_COM.getCode(),code)) {
result = true;
}
return result;
}
/** /**
* 根据ndid生成二维码 * 根据ndid生成二维码
* @param ndid * @param ndid

View File

@@ -10,9 +10,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.common.pojo.enums.common.DataStateEnum;
import com.njcn.common.pojo.exception.BusinessException; import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.common.utils.PubUtils;
import com.njcn.csdevice.api.CsLineFeignClient; import com.njcn.csdevice.api.CsLineFeignClient;
import com.njcn.csdevice.api.EquipmentFeignClient; import com.njcn.csdevice.api.EquipmentFeignClient;
import com.njcn.csdevice.constant.DataParam; import com.njcn.csdevice.constant.DataParam;
@@ -26,19 +24,18 @@ import com.njcn.csdevice.pojo.vo.CsGroupVO;
import com.njcn.csdevice.pojo.vo.DataGroupEventVO; import com.njcn.csdevice.pojo.vo.DataGroupEventVO;
import com.njcn.csdevice.pojo.vo.DataGroupTemplateVO; import com.njcn.csdevice.pojo.vo.DataGroupTemplateVO;
import com.njcn.csdevice.pojo.vo.EnergyTemplateVO; import com.njcn.csdevice.pojo.vo.EnergyTemplateVO;
import com.njcn.csdevice.service.CsDevModelRelationService;
import com.njcn.csdevice.service.ICsDataArrayService; import com.njcn.csdevice.service.ICsDataArrayService;
import com.njcn.csdevice.service.ICsGroupService; import com.njcn.csdevice.service.ICsGroupService;
import com.njcn.csdevice.service.ICsLedgerService;
import com.njcn.csdevice.util.InfluxDbParamUtil; import com.njcn.csdevice.util.InfluxDbParamUtil;
import com.njcn.csdevice.utils.DataChangeUtil; import com.njcn.csdevice.utils.DataChangeUtil;
import com.njcn.csharmonic.api.EventFeignClient; import com.njcn.csharmonic.api.EventFeignClient;
import com.njcn.csharmonic.constant.HarmonicConstant;
import com.njcn.csharmonic.param.CommonStatisticalQueryParam; import com.njcn.csharmonic.param.CommonStatisticalQueryParam;
import com.njcn.csharmonic.param.CsEventUserQueryPage; import com.njcn.csharmonic.param.CsEventUserQueryPage;
import com.njcn.csharmonic.pojo.vo.CsEventVO;
import com.njcn.csharmonic.pojo.vo.ThdDataTdVO; import com.njcn.csharmonic.pojo.vo.ThdDataTdVO;
import com.njcn.csharmonic.pojo.vo.ThdDataVO; import com.njcn.csharmonic.pojo.vo.ThdDataVO;
import com.njcn.device.biz.pojo.po.Overlimit; import com.njcn.device.biz.pojo.po.Overlimit;
import com.njcn.influx.pojo.bo.CommonQueryParam; import com.njcn.influx.pojo.bo.CommonQueryParam;
import com.njcn.influx.pojo.dto.EventDataSetDTO; import com.njcn.influx.pojo.dto.EventDataSetDTO;
import com.njcn.influx.pojo.dto.StatisticalDataDTO; import com.njcn.influx.pojo.dto.StatisticalDataDTO;
@@ -53,6 +50,7 @@ import com.njcn.system.pojo.po.EleEvtParm;
import com.njcn.system.pojo.vo.CsStatisticalSetVO; import com.njcn.system.pojo.vo.CsStatisticalSetVO;
import com.njcn.system.pojo.vo.EleEpdPqdListVO; import com.njcn.system.pojo.vo.EleEpdPqdListVO;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@@ -80,48 +78,24 @@ import java.util.stream.Stream;
public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> implements ICsGroupService { public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> implements ICsGroupService {
private final ICsDataArrayService csDataArrayService; private final ICsDataArrayService csDataArrayService;
private final CsGroArrMapper csGroArrMapper; private final CsGroArrMapper csGroArrMapper;
private final CsGroupMapper csGroupMapper; private final CsGroupMapper csGroupMapper;
private final CsDataArrayMapper csDataArrayMapper; private final CsDataArrayMapper csDataArrayMapper;
private final CommonService commonService; private final CommonService commonService;
private final EpdFeignClient epdFeignClient; private final EpdFeignClient epdFeignClient;
private final CsLineFeignClient csLineFeignClient; private final CsLineFeignClient csLineFeignClient;
private final ICsLedgerService iCsLedgerService;
private final DicDataFeignClient dicDataFeignClient; private final DicDataFeignClient dicDataFeignClient;
private final EquipmentFeignClient equipmentFeignClient; private final EquipmentFeignClient equipmentFeignClient;
private final CsStatisticalSetFeignClient csStatisticalSetFeignClient; private final CsStatisticalSetFeignClient csStatisticalSetFeignClient;
private final EvtDataService evtDataService; private final EvtDataService evtDataService;
private final DecimalFormat df = new DecimalFormat("#0.00"); private final DecimalFormat df = new DecimalFormat("#0.00");
private final EleEvtFeignClient eleEvtFeignClient; private final EleEvtFeignClient eleEvtFeignClient;
private final OverlimitMapper overlimitMapper; private final OverlimitMapper overlimitMapper;
private final CsDataSetMapper csDataSetMapper; private final CsDataSetMapper csDataSetMapper;
private final EventFeignClient eventFeignClient; private final EventFeignClient eventFeignClient;
private final InfluxDbParamUtil influxDbParamUtil; private final InfluxDbParamUtil influxDbParamUtil;
private final Set<String> POWER_LIST = new HashSet<>(Arrays.asList(
"电网有功功率", "电网无功功率", "电网视在功率", "负载有功功率",
"负载无功功率", "负载视在功率", "有功功率", "无功功率",
"视在功率", "基波有功功率", "基波无功功率",
"基波视在功率", "三相总有功功率", "三相总无功功率",
"三相总视在功率"
));
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public List<CsGroupVO> getGroupData(String dataSet) { public List<CsGroupVO> getGroupData(String dataSet) {
@@ -176,13 +150,13 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
}else { }else {
re = DataChangeUtil.secondaryToPrimary(eleEpdPqd.getPrimaryFormula(), statisticalDataDTO.getValue(), csLinePO.getPtRatio(), csLinePO.getCtRatio()); re = DataChangeUtil.secondaryToPrimary(eleEpdPqd.getPrimaryFormula(), statisticalDataDTO.getValue(), csLinePO.getPtRatio(), csLinePO.getCtRatio());
} }
if (changePower(vo.getAnotherName())) { if (changePower(vo.getAnotherName()) && Objects.equals(dataLevel,"Primary")) {
vo.setDataValue(Double.valueOf(df.format(BigDecimal.valueOf(re / 1000).setScale(2, RoundingMode.HALF_UP).doubleValue()))); vo.setDataValue(Double.valueOf(df.format(BigDecimal.valueOf(re / 1000).setScale(2, RoundingMode.HALF_UP).doubleValue())));
} else { } else {
vo.setDataValue(Double.valueOf(df.format(BigDecimal.valueOf(re).setScale(2, RoundingMode.HALF_UP).doubleValue()))); vo.setDataValue(Double.valueOf(df.format(BigDecimal.valueOf(re).setScale(2, RoundingMode.HALF_UP).doubleValue())));
} }
} else { } else {
if (changePower(vo.getAnotherName())) { if (changePower(vo.getAnotherName()) && Objects.equals(dataLevel,"Primary")) {
vo.setDataValue(Double.valueOf(df.format(BigDecimal.valueOf(statisticalDataDTO.getValue()/1000).setScale(2, RoundingMode.HALF_UP).doubleValue()))); vo.setDataValue(Double.valueOf(df.format(BigDecimal.valueOf(statisticalDataDTO.getValue()/1000).setScale(2, RoundingMode.HALF_UP).doubleValue())));
} else { } else {
vo.setDataValue(Double.valueOf(df.format(BigDecimal.valueOf(statisticalDataDTO.getValue()).setScale(2, RoundingMode.HALF_UP).doubleValue()))); vo.setDataValue(Double.valueOf(df.format(BigDecimal.valueOf(statisticalDataDTO.getValue()).setScale(2, RoundingMode.HALF_UP).doubleValue())));
@@ -193,6 +167,8 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
} }
if (vo.getAnotherName().contains("A相") || vo.getAnotherName().contains("B相") || vo.getAnotherName().contains("C相")) { if (vo.getAnotherName().contains("A相") || vo.getAnotherName().contains("B相") || vo.getAnotherName().contains("C相")) {
vo.setAnotherName(vo.getAnotherName().substring(0,2)); vo.setAnotherName(vo.getAnotherName().substring(0,2));
} else if (vo.getAnotherName().contains("AB") || vo.getAnotherName().contains("BC") || vo.getAnotherName().contains("CA")) {
vo.setAnotherName(vo.getAnotherName().substring(0,2).concat(""));
} }
arrayList.add(vo); arrayList.add(vo);
} }
@@ -319,6 +295,12 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
List<ThdDataVO> result = new ArrayList(); List<ThdDataVO> result = new ArrayList();
List<CsEquipmentDeliveryDTO> data1 = equipmentFeignClient.queryDeviceById(Stream.of(commonStatisticalQueryParam.getDevId()).collect(Collectors.toList())).getData(); List<CsEquipmentDeliveryDTO> data1 = equipmentFeignClient.queryDeviceById(Stream.of(commonStatisticalQueryParam.getDevId()).collect(Collectors.toList())).getData();
List<CsLinePO> finalCsLinePOList = csLineFeignClient.queryLineById(Arrays.asList(commonStatisticalQueryParam.getLineId())).getData(); List<CsLinePO> finalCsLinePOList = csLineFeignClient.queryLineById(Arrays.asList(commonStatisticalQueryParam.getLineId())).getData();
CsDataSet csDataSet = csDataSetMapper.selectOne(new LambdaQueryWrapper<CsDataSet>().eq(CsDataSet::getId,finalCsLinePOList.get(0).getDataSetId()));
if(Objects.isNull(csDataSet) || StrUtil.isBlank(csDataSet.getDataLevel())){
throw new BusinessException("当前测点数据集主要信息缺失,请联系管理员排查(测点表里面数据集id缺失)");
}
Double ct = finalCsLinePOList.get(0).getCtRatio();
Double pt = finalCsLinePOList.get(0).getPtRatio();
if(CollectionUtil.isNotEmpty(commonStatisticalQueryParam.getList())){ if(CollectionUtil.isNotEmpty(commonStatisticalQueryParam.getList())){
for (CommonStatisticalQueryParam param : commonStatisticalQueryParam.getList()){ for (CommonStatisticalQueryParam param : commonStatisticalQueryParam.getList()){
@@ -328,7 +310,7 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
CommonQueryParam commonQueryParam = new CommonQueryParam(); CommonQueryParam commonQueryParam = new CommonQueryParam();
commonQueryParam.setLineId(temp.getLineId()); commonQueryParam.setLineId(temp.getLineId());
commonQueryParam.setTableName(influxDbParamUtil.getTableNameByClassId(epdPqd.getClassId())); commonQueryParam.setTableName(influxDbParamUtil.getTableNameByClassId(epdPqd.getClassId()));
commonQueryParam.setColumnName(epdPqd.getName()+ (param.getFrequency() == null ? "":"_"+param.getFrequency())); commonQueryParam.setColumnName(epdPqd.getName()+ (StringUtils.isEmpty(param.getFrequency()) ? "":"_"+param.getFrequency()));
commonQueryParam.setPhasic(epdPqd.getPhase()); commonQueryParam.setPhasic(epdPqd.getPhase());
commonQueryParam.setStartTime(DateUtil.format(DateUtil.parse(commonStatisticalQueryParam.getStartTime(),DatePattern.NORM_DATE_PATTERN), DatePattern.NORM_DATETIME_PATTERN)); commonQueryParam.setStartTime(DateUtil.format(DateUtil.parse(commonStatisticalQueryParam.getStartTime(),DatePattern.NORM_DATE_PATTERN), DatePattern.NORM_DATETIME_PATTERN));
@@ -340,18 +322,49 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
return commonQueryParam; return commonQueryParam;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
List<StatisticalDataDTO> deviceRtData = commonService.getDeviceRtDataByTime(commonQueryParams); List<StatisticalDataDTO> deviceRtData = commonService.getDeviceRtDataByTime(commonQueryParams);
//List<StatisticalDataDTO> deviceRtData = commonService.getDeviceRtData(commonQueryParams);
List<ThdDataVO> collect1 = deviceRtData.stream().map(temp -> { List<ThdDataVO> collect1 = deviceRtData.stream().map(temp -> {
ThdDataVO vo = new ThdDataVO(); ThdDataVO vo = new ThdDataVO();
vo.setLineId(temp.getLineId()); vo.setLineId(temp.getLineId());
vo.setPhase(temp.getPhaseType()); vo.setPhase(Objects.equals("M",temp.getPhaseType())?null:temp.getPhaseType());
String position = finalCsLinePOList.stream().filter(csLinePO -> Objects.equals(csLinePO.getLineId(), vo.getLineId())).collect(Collectors.toList()).get(0).getPosition(); String position = finalCsLinePOList.stream().filter(csLinePO -> Objects.equals(csLinePO.getLineId(), vo.getLineId())).collect(Collectors.toList()).get(0).getPosition();
vo.setPosition(position); vo.setPosition(position);
vo.setTime(temp.getTime()); vo.setTime(temp.getTime());
vo.setStatMethod(temp.getValueType()); vo.setStatMethod(temp.getValueType());
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue()))); vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
vo.setStatisticalIndex(epdPqd.getId()); if(temp.getValue()!=null) {
double re;
if (Objects.equals("Primary",commonStatisticalQueryParam.getDataLevel())) {
if (Objects.equals("Primary",csDataSet.getDataLevel())) {
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
vo.setUnit(epdPqd.getUnit()); vo.setUnit(epdPqd.getUnit());
} else {
if (HarmonicConstant.POWER_LIST.contains(epdPqd.getShowName())) {
re = DataChangeUtil.secondaryToPrimary(epdPqd.getPrimaryFormula(), temp.getValue(), pt, ct) / 1000;
vo.setStatisticalData(Double.valueOf(df.format(re)));
vo.setUnit("k" + epdPqd.getUnit());
} else {
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
vo.setUnit(epdPqd.getUnit());
}
}
} else {
if (Objects.equals("Primary",csDataSet.getDataLevel())) {
if (HarmonicConstant.POWER_LIST.contains(epdPqd.getShowName())) {
re = DataChangeUtil.primaryToSecondary(epdPqd.getPrimaryFormula(), temp.getValue(), pt, ct);
vo.setStatisticalData(Double.valueOf(df.format(re)));
} else {
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
vo.setUnit(epdPqd.getUnit());
}
} else {
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
}
vo.setUnit(epdPqd.getUnit());
}
} else {
vo.setStatisticalData(null);
}
vo.setStatisticalIndex(epdPqd.getId());
vo.setStatisticalName(epdPqd.getName()); vo.setStatisticalName(epdPqd.getName());
vo.setAnotherName(epdPqd.getShowName()); vo.setAnotherName(epdPqd.getShowName());
return vo; return vo;
@@ -393,7 +406,7 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
List<ThdDataVO> collect1 = deviceRtData.stream().map(temp -> { List<ThdDataVO> collect1 = deviceRtData.stream().map(temp -> {
ThdDataVO vo = new ThdDataVO(); ThdDataVO vo = new ThdDataVO();
vo.setLineId(temp.getLineId()); vo.setLineId(temp.getLineId());
vo.setPhase(temp.getPhaseType()); vo.setPhase(Objects.equals("M",temp.getPhaseType())?null:temp.getPhaseType());
String position = finalCsLinePOList.stream().filter(csLinePO -> Objects.equals(csLinePO.getLineId(), vo.getLineId())).collect(Collectors.toList()).get(0).getPosition(); String position = finalCsLinePOList.stream().filter(csLinePO -> Objects.equals(csLinePO.getLineId(), vo.getLineId())).collect(Collectors.toList()).get(0).getPosition();
vo.setPosition(position); vo.setPosition(position);
vo.setTime(temp.getTime()); vo.setTime(temp.getTime());
@@ -421,9 +434,12 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
csEventVOPage.getRecords().forEach(temp->{ csEventVOPage.getRecords().forEach(temp->{
//事件描述、相别、暂降幅值,需要特殊处理赋值 //事件描述、相别、暂降幅值,需要特殊处理赋值
//事件描述 //事件描述
CsLedger dataById = iCsLedgerService.findDataById(temp.getLineId());
temp.setLineName(dataById.getName());
EleEpdPqd ele = epdFeignClient.findByName(temp.getTag()).getData(); EleEpdPqd ele = epdFeignClient.findByName(temp.getTag()).getData();
if(ele!=null){ if(ele!=null){
temp.setShowName(ele.getShowName()); temp.setShowName(ele.getShowName());
//相别 //相别
List<EleEvtParm> data1 = eleEvtFeignClient.queryByPid(ele.getId()).getData(); List<EleEvtParm> data1 = eleEvtFeignClient.queryByPid(ele.getId()).getData();
List<EventDataSetDTO> eventDataSetDTOS = new ArrayList<>(); List<EventDataSetDTO> eventDataSetDTOS = new ArrayList<>();
@@ -532,7 +548,7 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
List<ThdDataVO> collect1 = deviceRtData.stream().map(temp -> { List<ThdDataVO> collect1 = deviceRtData.stream().map(temp -> {
ThdDataVO vo = new ThdDataVO(); ThdDataVO vo = new ThdDataVO();
vo.setLineId(temp.getLineId()); vo.setLineId(temp.getLineId());
vo.setPhase(temp.getPhaseType()); vo.setPhase(Objects.equals("M",temp.getPhaseType())?null:temp.getPhaseType());
String position = finalCsLinePOList.stream().filter(csLinePO -> Objects.equals(csLinePO.getLineId(), vo.getLineId())).collect(Collectors.toList()).get(0).getPosition(); String position = finalCsLinePOList.stream().filter(csLinePO -> Objects.equals(csLinePO.getLineId(), vo.getLineId())).collect(Collectors.toList()).get(0).getPosition();
vo.setPosition(position); vo.setPosition(position);
vo.setTime(temp.getTime()); vo.setTime(temp.getTime());
@@ -632,7 +648,7 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
List<ThdDataVO> collect1 = deviceRtData.stream().map(temp -> { List<ThdDataVO> collect1 = deviceRtData.stream().map(temp -> {
ThdDataVO vo = new ThdDataVO(); ThdDataVO vo = new ThdDataVO();
vo.setLineId(temp.getLineId()); vo.setLineId(temp.getLineId());
vo.setPhase(temp.getPhaseType()); vo.setPhase(Objects.equals("M",temp.getPhaseType())?null:temp.getPhaseType());
String position = finalCsLinePOList.stream().filter(csLinePO -> Objects.equals(csLinePO.getLineId(), vo.getLineId())).collect(Collectors.toList()).get(0).getPosition(); String position = finalCsLinePOList.stream().filter(csLinePO -> Objects.equals(csLinePO.getLineId(), vo.getLineId())).collect(Collectors.toList()).get(0).getPosition();
vo.setPosition(position); vo.setPosition(position);
vo.setTime(temp.getTime()); vo.setTime(temp.getTime());
@@ -764,8 +780,6 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
//单位处理 //单位处理
public void getUnit(List<EnergyTemplateVO> energyTemplates, List<EleEpdPqd> eleEpdPqds, List<DataGroupTemplateVO> dataGroupTemplates, String type) { public void getUnit(List<EnergyTemplateVO> energyTemplates, List<EleEpdPqd> eleEpdPqds, List<DataGroupTemplateVO> dataGroupTemplates, String type) {
List<String> pList = Arrays.asList("电网有功功率", "电网无功功率", "电网视在功率","负载有功功率","负载无功功率","负载视在功率"
,"有功功率","无功功率","视在功率","基波有功功率","基波无功功率","基波视在功率","三相总有功功率","三相总无功功率","三相总视在功率");
// 使用Map来存储EleEpdPqd的ID和Unit以便快速查找 // 使用Map来存储EleEpdPqd的ID和Unit以便快速查找
Map<String, String> unitMap = new HashMap<>(); Map<String, String> unitMap = new HashMap<>();
for (EleEpdPqd item : eleEpdPqds) { for (EleEpdPqd item : eleEpdPqds) {
@@ -790,7 +804,7 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
for (DataGroupTemplateVO dataGroupTemplate : dataGroupTemplates) { for (DataGroupTemplateVO dataGroupTemplate : dataGroupTemplates) {
EnergyTemplateVO energyTemplate = energyTemplateMap.get(dataGroupTemplate.getId()); EnergyTemplateVO energyTemplate = energyTemplateMap.get(dataGroupTemplate.getId());
if (energyTemplate != null && energyTemplate.getUnit() != null) { if (energyTemplate != null && energyTemplate.getUnit() != null) {
if (changePower(dataGroupTemplate.getName())) { if (changePower(dataGroupTemplate.getName()) && Objects.equals("Primary",type)) {
dataGroupTemplate.setName(dataGroupTemplate.getName() + "(k" + energyTemplate.getUnit() + ")"); dataGroupTemplate.setName(dataGroupTemplate.getName() + "(k" + energyTemplate.getUnit() + ")");
} else { } else {
dataGroupTemplate.setName(dataGroupTemplate.getName() + "(" + energyTemplate.getUnit() + ")"); dataGroupTemplate.setName(dataGroupTemplate.getName() + "(" + energyTemplate.getUnit() + ")");
@@ -800,9 +814,12 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
} }
} }
//判断功率是否需要转换 //判断指标是否需要转换
public boolean changePower(String name) { public boolean changePower(String name) {
return POWER_LIST.stream() if(name.contains("相角")) {
return false;
}
return HarmonicConstant.POWER_LIST.stream()
.anyMatch(name::contains); .anyMatch(name::contains);
} }

View File

@@ -78,15 +78,20 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
engineeringList = allList.stream().filter(item->roleengineer.contains(item.getId())).collect(Collectors.toList()); engineeringList = allList.stream().filter(item->roleengineer.contains(item.getId())).collect(Collectors.toList());
List<CsLedgerVO> projectList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.PROJECT_LEVEL.getCode())).sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList()); List<CsLedgerVO> projectList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.PROJECT_LEVEL.getCode())).sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
List<CsLedgerVO> deviceList = allList.stream().filter(item -> device.contains(item.getId())). List<CsLedgerVO> deviceList = allList.stream().filter(item -> device.contains(item.getId()) && !Objects.equals(item.getPid(),"0")).
peek( peek(
temp->{ temp->{
CsEquipmentDeliveryPO csEquipmentDeliveryPO = csEquipmentDeliveryMapper.selectById(temp.getId()); CsEquipmentDeliveryPO csEquipmentDeliveryPO = csEquipmentDeliveryMapper.selectById(temp.getId());
temp.setComFlag(csEquipmentDeliveryPO.getRunStatus()); temp.setComFlag(csEquipmentDeliveryPO.getRunStatus());
temp.setType("device");
} }
). ).
sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList()); sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
List<CsLedgerVO> finalLineList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.LINE_LEVEL.getCode())).sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList()); List<CsLedgerVO> finalLineList = allList.stream()
.filter(item -> item.getLevel().equals(LineBaseEnum.LINE_LEVEL.getCode()))
.sorted(Comparator.comparing(CsLedgerVO::getSort))
.peek(item -> item.setType("line"))
.collect(Collectors.toList());
checkDevSetData(deviceList); checkDevSetData(deviceList);
deviceList.forEach(dev -> dev.setChildren(getChildren(dev, finalLineList))); deviceList.forEach(dev -> dev.setChildren(getChildren(dev, finalLineList)));
projectList.forEach(pro -> pro.setChildren(getChildren(pro, deviceList))); projectList.forEach(pro -> pro.setChildren(getChildren(pro, deviceList)));
@@ -103,6 +108,7 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
CsEquipmentDeliveryPO po = csEquipmentDeliveryMapper.selectById(c.getId()); CsEquipmentDeliveryPO po = csEquipmentDeliveryMapper.selectById(c.getId());
c.setComFlag(po.getRunStatus()); c.setComFlag(po.getRunStatus());
c.setNDId(po.getNdid()); c.setNDId(po.getNdid());
c.setType("device");
} }
portables.forEach(dev -> dev.setChildren(getChildren(dev, finalLineList))); portables.forEach(dev -> dev.setChildren(getChildren(dev, finalLineList)));
checkDevSetData(portables); checkDevSetData(portables);
@@ -115,8 +121,12 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
government.setId(IdUtil.simpleUUID()); government.setId(IdUtil.simpleUUID());
government.setChildren(engineeringList); government.setChildren(engineeringList);
List<CsLedgerVO> tree = new ArrayList<>(); List<CsLedgerVO> tree = new ArrayList<>();
if (CollUtil.isNotEmpty(portables)) {
tree.add(portable); tree.add(portable);
}
if (CollUtil.isNotEmpty(deviceList)) {
tree.add(government); tree.add(government);
}
return tree; return tree;
} }
//剔除未接入的设备(根据status判断不太稳,所有这里直接判断该设备有没有对应的模板指标) //剔除未接入的设备(根据status判断不太稳,所有这里直接判断该设备有没有对应的模板指标)
@@ -157,15 +167,17 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
List<String> device = roleEngineerDevService.getDevice(); List<String> device = roleEngineerDevService.getDevice();
engineeringList = allList.stream().filter(item->roleengineer.contains(item.getId())).collect(Collectors.toList()); engineeringList = allList.stream().filter(item->roleengineer.contains(item.getId())).collect(Collectors.toList());
List<CsLedgerVO> projectList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.PROJECT_LEVEL.getCode())).sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList()); List<CsLedgerVO> projectList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.PROJECT_LEVEL.getCode())).sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
List<CsLedgerVO> deviceList = allList.stream().filter(item -> device.contains(item.getId())). List<CsLedgerVO> deviceList = allList.stream().filter(item -> device.contains(item.getId()) && !Objects.equals(item.getPid(),"0")).
peek( peek(
temp->{ temp->{
CsEquipmentDeliveryPO csEquipmentDeliveryPO = csEquipmentDeliveryMapper.selectById(temp.getId()); CsEquipmentDeliveryPO po = csEquipmentDeliveryMapper.selectById(temp.getId());
temp.setComFlag(csEquipmentDeliveryPO.getRunStatus()); temp.setComFlag(po.getRunStatus());
temp.setNDId(csEquipmentDeliveryPO.getNdid()); temp.setNDId(po.getNdid());
temp.setType("device");
} }
). ).
sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList()); sorted(Comparator.comparing(CsLedgerVO::getSort))
.collect(Collectors.toList());
checkDevSetData(deviceList); checkDevSetData(deviceList);
projectList.forEach(pro -> pro.setChildren(getChildren(pro, deviceList))); projectList.forEach(pro -> pro.setChildren(getChildren(pro, deviceList)));
engineeringList.forEach(eng -> eng.setChildren(getChildren(eng, projectList))); engineeringList.forEach(eng -> eng.setChildren(getChildren(eng, projectList)));
@@ -183,6 +195,7 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
CsEquipmentDeliveryPO po = csEquipmentDeliveryMapper.selectById(c.getId()); CsEquipmentDeliveryPO po = csEquipmentDeliveryMapper.selectById(c.getId());
c.setComFlag(po.getRunStatus()); c.setComFlag(po.getRunStatus());
c.setNDId(po.getNdid()); c.setNDId(po.getNdid());
c.setType("device");
} }
portable.setChildren(portables); portable.setChildren(portables);
@@ -193,8 +206,12 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
government.setId(IdUtil.simpleUUID()); government.setId(IdUtil.simpleUUID());
government.setChildren(engineeringList); government.setChildren(engineeringList);
List<CsLedgerVO> tree = new ArrayList<>(); List<CsLedgerVO> tree = new ArrayList<>();
if (CollUtil.isNotEmpty(portables)) {
tree.add(portable); tree.add(portable);
}
if (CollUtil.isNotEmpty(deviceList)) {
tree.add(government); tree.add(government);
}
return tree; return tree;
} }
@@ -287,6 +304,15 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
public DevDetailDTO queryDevDetail(String devId) { public DevDetailDTO queryDevDetail(String devId) {
DevDetailDTO device = new DevDetailDTO(); DevDetailDTO device = new DevDetailDTO();
CsLedger dev = this.findDataById(devId); CsLedger dev = this.findDataById(devId);
//如果是便携式设备pid为0,项目,工程都设置为/
if(Objects.equals(dev.getPid(),"0")){
device.setEquipmentName(dev.getName());
device.setEquipmentId(devId);
device.setProjectId("/");
device.setProjectName("/");
device.setEngineeringid("/");
device.setEngineeringName("/");
}else {
device.setEquipmentName(dev.getName()); device.setEquipmentName(dev.getName());
device.setEquipmentId(devId); device.setEquipmentId(devId);
CsLedger project = this.findDataById(dev.getPid()); CsLedger project = this.findDataById(dev.getPid());
@@ -295,10 +321,88 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
CsLedger engineer = this.findDataById(project.getPid()); CsLedger engineer = this.findDataById(project.getPid());
device.setEngineeringid(engineer.getId()); device.setEngineeringid(engineer.getId());
device.setEngineeringName(engineer.getName()); device.setEngineeringName(engineer.getName());
}
return device; return device;
} }
@Override
public List<CsLedgerVO> getztProjectTree() {
List<CsLedgerVO> engineeringList;
List<CsLedgerVO> allList = this.baseMapper.getAll();
/*获取用户工程,设备信息过滤*/
List<String> roleengineer = roleEngineerDevService.getRoleengineer();
List<String> device = roleEngineerDevService.getDevice();
engineeringList = allList.stream().filter(item->roleengineer.contains(item.getId())).collect(Collectors.toList());
List<CsLedgerVO> projectList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.PROJECT_LEVEL.getCode())).sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
List<CsLedgerVO> deviceList = allList.stream().filter(item -> device.contains(item.getId()) && !Objects.equals(item.getPid(),"0")).
peek(
temp->{
CsEquipmentDeliveryPO po = csEquipmentDeliveryMapper.selectById(temp.getId());
temp.setComFlag(po.getRunStatus());
temp.setNDId(po.getNdid());
temp.setType("device");
}
).
sorted(Comparator.comparing(CsLedgerVO::getSort))
.collect(Collectors.toList());
checkDevSetData(deviceList);
projectList.forEach(pro -> pro.setChildren(getChildren(pro, deviceList)));
engineeringList.forEach(eng -> eng.setChildren(getChildren(eng, projectList)));
//获取便携式项目数
CsLedgerVO portable = new CsLedgerVO();
portable.setLevel(0);
portable.setName(DataParam.PORTABLE_SYSTEM);
portable.setPid("0");
portable.setId(IdUtil.simpleUUID());
CsLedgerVO project = new CsLedgerVO();
project.setLevel(1);
project.setName(DataParam.WIRELESS_PROJECT);
project.setPid("0");
project.setId(DataParam.WIRELESS_PROJECT_ID);
List<CsLedgerVO> portables = allList.stream().filter(item->Objects.equals(item.getLevel(),2) && Objects.equals(item.getPid(),"0")).collect(Collectors.toList());
checkDevSetData(portables);
for(CsLedgerVO c : portables){
c.setPid(project.getId());
CsEquipmentDeliveryPO po = csEquipmentDeliveryMapper.selectById(c.getId());
c.setComFlag(po.getRunStatus());
c.setNDId(po.getNdid());
c.setType("device");
}
project.setChildren(portables);
List<CsLedgerVO> wxProjectList = new ArrayList<>();
wxProjectList.add(project);
portable.setChildren(wxProjectList);
CsLedgerVO government = new CsLedgerVO();
government.setLevel(0);
government.setName(DataParam.GOVERNANCE_SYSTEM);
government.setPid("0");
government.setId(IdUtil.simpleUUID());
government.setChildren(engineeringList);
List<CsLedgerVO> tree = new ArrayList<>();
if (CollUtil.isNotEmpty(portables)) {
tree.add(portable);
}
if (CollUtil.isNotEmpty(deviceList)) {
tree.add(government);
}
return tree;
}
/** /**
* 获取子节点 * 获取子节点
*/ */

View File

@@ -71,6 +71,16 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
this.update(lambdaUpdateWrapper); this.update(lambdaUpdateWrapper);
} }
@Override
public void updateIds(CsLineParam csLineParam) {
LambdaUpdateWrapper<CsLinePO> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
lambdaUpdateWrapper.eq(CsLinePO::getLineId,csLineParam.getLineId())
.eq(CsLinePO::getStatus,1)
.set(CsLinePO::getDataSetId,csLineParam.getDataSetId())
.set(CsLinePO::getDataModelId,csLineParam.getModelId());
this.update(lambdaUpdateWrapper);
}
// /** // /**
// * 1.平台端默认配置拓扑图模板,包含拓扑图信息(cs_topology_diagram_template)和拓扑图上监测点的点位信息(cs_line_topology_template) // * 1.平台端默认配置拓扑图模板,包含拓扑图信息(cs_topology_diagram_template)和拓扑图上监测点的点位信息(cs_line_topology_template)
// * // *

View File

@@ -46,8 +46,9 @@ public class CsLogsPOServiceImpl extends ServiceImpl<CsLogsPOMapper, CsLogsPO> i
String userRole = RequestUtil.getUserRole(); String userRole = RequestUtil.getUserRole();
List<String> strings = JSONArray.parseArray(userRole, String.class); List<String> strings = JSONArray.parseArray(userRole, String.class);
QueryWrapper<CsLogsPO> csLogsPOQueryWrapper = new QueryWrapper<>(); QueryWrapper<CsLogsPO> csLogsPOQueryWrapper = new QueryWrapper<>();
csLogsPOQueryWrapper.lambda().eq(!strings.contains(AppRoleEnum.OPERATION_MANAGER.getCode()),CsLogsPO::getUserName, username). csLogsPOQueryWrapper.lambda()
ge(StringUtils.isNotBlank(baseParam.getSearchBeginTime()),CsLogsPO::getCreateTime,baseParam.getSearchBeginTime()). // .eq(!strings.contains(AppRoleEnum.OPERATION_MANAGER.getCode()),CsLogsPO::getUserName, username)
.ge(StringUtils.isNotBlank(baseParam.getSearchBeginTime()),CsLogsPO::getCreateTime,baseParam.getSearchBeginTime()).
le(StringUtils.isNotBlank(baseParam.getSearchEndTime()),CsLogsPO::getCreateTime,baseParam.getSearchEndTime()).orderByDesc(CsLogsPO::getCreateTime); le(StringUtils.isNotBlank(baseParam.getSearchEndTime()),CsLogsPO::getCreateTime,baseParam.getSearchEndTime()).orderByDesc(CsLogsPO::getCreateTime);
IPage<CsLogsPO> list = this.getBaseMapper().selectPage(returnpage,csLogsPOQueryWrapper); IPage<CsLogsPO> list = this.getBaseMapper().selectPage(returnpage,csLogsPOQueryWrapper);
return list; return list;

View File

@@ -14,6 +14,7 @@ import com.njcn.oss.utils.FileStorageUtil;
import com.njcn.redis.pojo.enums.AppRedisKey; import com.njcn.redis.pojo.enums.AppRedisKey;
import com.njcn.redis.utils.RedisUtil; import com.njcn.redis.utils.RedisUtil;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.time.Instant; import java.time.Instant;
@@ -86,8 +87,8 @@ public class DeviceFtpServiceImpl implements DeviceFtpService {
} }
@Override @Override
public String downloadFile(String nDid, String name, Integer size, String fileCheck) { @Async
String result = null; public void downloadFile(String nDid, String name, Integer size, String fileCheck) {
judgeClientOnline(nDid); judgeClientOnline(nDid);
Object task = redisUtil.getObjectByKey("fileDowning:"+nDid); Object task = redisUtil.getObjectByKey("fileDowning:"+nDid);
if (Objects.nonNull(task)) { if (Objects.nonNull(task)) {
@@ -98,25 +99,26 @@ public class DeviceFtpServiceImpl implements DeviceFtpService {
throw new BusinessException(AlgorithmResponseEnum.FILE_BUSY); throw new BusinessException(AlgorithmResponseEnum.FILE_BUSY);
} }
try { try {
redisUtil.delete("downloadFilePath:"+name); redisUtil.delete("downloadFilePath:"+ nDid + name);
boolean file = askDeviceDataFeignClient.downloadFile(nDid,name,size,fileCheck).getData(); askDeviceDataFeignClient.downloadFile(nDid,name,size,fileCheck).getData();
if (!file) {
redisUtil.delete("fileDowning:"+nDid);
redisUtil.delete("fileCheck"+name);
throw new BusinessException(AlgorithmResponseEnum.FILE_DOWNLOAD_ERROR);
}
Object object = redisUtil.getObjectByKey("downloadFilePath:"+name);
if (Objects.nonNull(object)) {
result = (String) object;
redisUtil.delete("downloadFilePath:"+name);
redisUtil.delete("fileCheck"+name);
redisUtil.delete("fileDowning:"+nDid);
}
} catch (Exception e) { } catch (Exception e) {
redisUtil.delete("fileDowning:"+nDid); redisUtil.delete("fileDowning:"+nDid);
redisUtil.delete("fileCheck"+name); redisUtil.delete("fileCheck"+nDid+name);
throw new BusinessException(AlgorithmResponseEnum.FILE_DOWNLOADING); throw new BusinessException(AlgorithmResponseEnum.FILE_DOWNLOADING);
} }
}
@Override
public String getDownloadFilePath(String nDid, String name) {
String result = null;
Object object = redisUtil.getObjectByKey("downloadFilePath:" + nDid + name);
if (Objects.nonNull(object)) {
result = (String) object;
redisUtil.delete("downloadFilePath:" + nDid + name);
}
redisUtil.delete("fileCheck"+nDid+name);
redisUtil.delete("fileDowning:"+nDid);
redisUtil.delete(AppRedisKey.FILE_PART.concat(name));
return result; return result;
} }
@@ -173,6 +175,13 @@ public class DeviceFtpServiceImpl implements DeviceFtpService {
vo.setPrjDataPath(item.getName()); vo.setPrjDataPath(item.getName());
vo.setType(item.getType()); vo.setType(item.getType());
vo.setSize(item.getSize()); vo.setSize(item.getSize());
if (item.getTime() == 0) {
vo.setStartTime("/");
} else {
LocalDateTime dateTime = Instant.ofEpochMilli((item.getTime()-8*3600)*1000).atZone(ZoneId.systemDefault()).toLocalDateTime();
String formattedDate = dateTime.format(formatter);
vo.setStartTime(formattedDate);
}
return vo; return vo;
} }
@@ -180,7 +189,7 @@ public class DeviceFtpServiceImpl implements DeviceFtpService {
MakeUpVo vo = new MakeUpVo(); MakeUpVo vo = new MakeUpVo();
vo.setPrjDataPath(fileInfo.getName()); vo.setPrjDataPath(fileInfo.getName());
if (fileInfo.getFileTime() != 0) { if (fileInfo.getFileTime() != 0) {
LocalDateTime dateTime = Instant.ofEpochMilli((fileInfo.getFileTime() - 3600*8) * 1000).atZone(ZoneId.systemDefault()).toLocalDateTime(); LocalDateTime dateTime = Instant.ofEpochMilli((fileInfo.getFileTime() - 8*3600) * 1000).atZone(ZoneId.systemDefault()).toLocalDateTime();
String formattedDate = dateTime.format(formatter); String formattedDate = dateTime.format(formatter);
vo.setStartTime(formattedDate); vo.setStartTime(formattedDate);
vo.setSize(fileInfo.getFileSize()); vo.setSize(fileInfo.getFileSize());

View File

@@ -0,0 +1,17 @@
package com.njcn.csdevice.service.impl;
import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.device.biz.pojo.po.Overlimit;
/**
*
* Description:
* Date: 2024/10/22 14:14【需求编号】
*
* @author clam
* @version V1.0.0
*/
public interface OverlimitService extends IService<Overlimit>{
}

View File

@@ -0,0 +1,19 @@
package com.njcn.csdevice.service.impl;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.csdevice.pojo.po.PortableOffMainLog;
import com.njcn.csdevice.mapper.PortableOffMainLogMapper;
import com.njcn.csdevice.service.PortableOffMainLogService;
/**
*
* Description:
* Date: 2024/10/15 10:43【需求编号】
*
* @author clam
* @version V1.0.0
*/
@Service
public class PortableOffMainLogServiceImpl extends ServiceImpl<PortableOffMainLogMapper, PortableOffMainLog> implements PortableOffMainLogService{
}

View File

@@ -1,17 +1,22 @@
package com.njcn.csdevice.service.impl; package com.njcn.csdevice.service.impl;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.IdUtil;
import com.alibaba.nacos.shaded.com.google.gson.Gson;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.tocrhz.mqtt.publisher.MqttPublisher;
import com.njcn.common.pojo.exception.BusinessException; import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.csdevice.api.EquipmentFeignClient; import com.njcn.csdevice.api.EquipmentFeignClient;
import com.njcn.csdevice.constant.DataParam; import com.njcn.csdevice.constant.DataParam;
import com.njcn.csdevice.enums.AlgorithmResponseEnum; import com.njcn.csdevice.enums.AlgorithmResponseEnum;
import com.njcn.csdevice.mapper.PortableOfflLogMapper; import com.njcn.csdevice.mapper.PortableOfflLogMapper;
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO; import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
import com.njcn.csdevice.pojo.po.PortableOffMainLog;
import com.njcn.csdevice.pojo.po.PortableOfflLog; import com.njcn.csdevice.pojo.po.PortableOfflLog;
import com.njcn.csdevice.service.IPortableOfflLogService; import com.njcn.csdevice.service.IPortableOfflLogService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.csdevice.param.UploadDataParam; import com.njcn.csdevice.param.UploadDataParam;
import com.njcn.csdevice.service.PortableOffMainLogService;
import com.njcn.csdevice.util.InfluxDbParamUtil; import com.njcn.csdevice.util.InfluxDbParamUtil;
import com.njcn.csharmonic.api.EventFeignClient; import com.njcn.csharmonic.api.EventFeignClient;
import com.njcn.csharmonic.api.OfflineDataUploadFeignClient; import com.njcn.csharmonic.api.OfflineDataUploadFeignClient;
@@ -25,7 +30,6 @@ import com.njcn.csharmonic.offline.mincfg.AnalyseComtradeCfg;
import com.njcn.csharmonic.offline.mincfg.vo.CmnModeCfg; import com.njcn.csharmonic.offline.mincfg.vo.CmnModeCfg;
import com.njcn.csharmonic.offline.vo.Response; import com.njcn.csharmonic.offline.vo.Response;
import com.njcn.csharmonic.pojo.po.CsEventPO; import com.njcn.csharmonic.pojo.po.CsEventPO;
import com.njcn.influx.imapper.CommonMapper;
import com.njcn.influx.imapper.EvtDataMapper; import com.njcn.influx.imapper.EvtDataMapper;
import com.njcn.influx.imapper.PqdDataMapper; import com.njcn.influx.imapper.PqdDataMapper;
import com.njcn.influx.pojo.po.cs.EntData; import com.njcn.influx.pojo.po.cs.EntData;
@@ -37,7 +41,10 @@ import com.njcn.system.pojo.po.DictData;
import com.njcn.web.pojo.param.BaseParam; import com.njcn.web.pojo.param.BaseParam;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.ListUtils;
import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.FilenameUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.stereotype.Service; 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;
@@ -45,6 +52,7 @@ import org.springframework.web.multipart.MultipartFile;
import java.io.*; import java.io.*;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
@@ -83,6 +91,9 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
private final EvtDataMapper evtDataMapper; private final EvtDataMapper evtDataMapper;
private final MqttPublisher publisher;
private final PortableOffMainLogService portableOffMainLogService;
@Override @Override
public Page<PortableOfflLog> queryPage(BaseParam baseParam) { public Page<PortableOfflLog> queryPage(BaseParam baseParam) {
Page<PortableOfflLog> returnpage = new Page<> (baseParam.getPageNum(), baseParam.getPageSize ()); Page<PortableOfflLog> returnpage = new Page<> (baseParam.getPageNum(), baseParam.getPageSize ());
@@ -238,10 +249,24 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
boolean minFlag = true; boolean minFlag = true;
//开始上传文件、记录上传日志、解析的文件结果入库 //开始上传文件、记录上传日志、解析的文件结果入库
//最外层便利所有文件确保所有文件都上传及记录上传日志 //最外层便利所有文件确保所有文件都上传及记录上传日志
int nowStep = uploadDataParam.getFiles().size();
PortableOffMainLog portableOffMainLog = new PortableOffMainLog();
portableOffMainLog.setId(IdUtil.fastSimpleUUID());
portableOffMainLog.setStartTime(LocalDateTime.now());
String paths = uploadDataParam.getFiles().stream().map(MultipartFile::getOriginalFilename)
.reduce((s1, s2) -> getCommonPrefix(s1, s2))
.orElse(null);
String[] split = paths.split("/");
portableOffMainLog.setProjectName(split.length>0?split[split.length-1]:"/");
int successcCount = 0;
portableOffMainLog.setStatus("1");
for(MultipartFile file : uploadDataParam.getFiles()){ for(MultipartFile file : uploadDataParam.getFiles()){
//初始上传日志基本信息 //初始上传日志基本信息
PortableOfflLog portableOfflLog = new PortableOfflLog(); PortableOfflLog portableOfflLog = new PortableOfflLog();
portableOfflLog.setLogMainId(portableOffMainLog.getId());
portableOfflLog.setName(file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("/")+1)); portableOfflLog.setName(file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("/")+1));
portableOfflLog.setPath(file.getOriginalFilename()); portableOfflLog.setPath(file.getOriginalFilename());
portableOfflLog.setDataPath(fileStorageUtil.uploadMultipart(file, DataParam.wlRecordPath+uploadDataParam.getDevId()+"/"+uploadDataParam.getLineId()+"/"+getFolderName()+"/")); portableOfflLog.setDataPath(fileStorageUtil.uploadMultipart(file, DataParam.wlRecordPath+uploadDataParam.getDevId()+"/"+uploadDataParam.getLineId()+"/"+getFolderName()+"/"));
@@ -273,7 +298,11 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
portableOfflLog.setRealCount(pqdData.size()); portableOfflLog.setRealCount(pqdData.size());
if(minFlag){ if(minFlag){
log.info("类型min,插入infulxDb的pqdData"); log.info("类型min,插入infulxDb的pqdData");
pqdDataMapper.insertBatch(pqdData); List<List<PqdData>> partition = ListUtils.partition(pqdData, 1500);
for (List<PqdData> sliceList : partition) {
List<PqdData> sublistAsOriginalListType = new ArrayList<>(sliceList);
pqdDataMapper.insertBatch(sublistAsOriginalListType);
}
//min结果集解析入库后就不需要在解析了 //min结果集解析入库后就不需要在解析了
minFlag = false; minFlag = false;
} }
@@ -433,8 +462,36 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
} }
} }
} }
nowStep++;
String json = "{allStep:"+uploadDataParam.getFiles().size()*2+",nowStep:"+nowStep+"}";
publisher.send("/dataOnlineRecruitment/Progress/" + uploadDataParam.getLineId(), new Gson().toJson(json), 1, false);
//无需解析的不需要记录
if(portableOfflLog.getState()!=0){
this.baseMapper.insert(portableOfflLog); this.baseMapper.insert(portableOfflLog);
successcCount++;
} }
}
portableOffMainLog.setEndTime(LocalDateTime.now());
portableOffMainLog.setSuccessCount(successcCount);
portableOffMainLogService.save(portableOffMainLog);
}
@Override
public Page<PortableOffMainLog> queryMainLogPage(BaseParam baseParam) {
Page<PortableOffMainLog> returnpage = new Page<> (baseParam.getPageNum(), baseParam.getPageSize ());
QueryWrapper<PortableOffMainLog> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda()
.ge(StringUtils.isNotBlank(baseParam.getSearchBeginTime()), PortableOffMainLog::getCreateTime,baseParam.getSearchBeginTime()+" 00:00:00")
.le(StringUtils.isNotBlank(baseParam.getSearchEndTime()),PortableOffMainLog::getCreateTime,baseParam.getSearchEndTime()+" 23:59:59").orderByDesc(PortableOffMainLog::getCreateTime);
Page<PortableOffMainLog> portableOffMainLogPage = portableOffMainLogService.getBaseMapper().selectPage(returnpage, queryWrapper);
portableOffMainLogPage.getRecords().forEach(temp->{
List<PortableOfflLog> list = this.lambdaQuery().eq(PortableOfflLog::getLogMainId, temp.getId()).list();
temp.setPortableOfflLogList(list);
});
return returnpage;
} }
//根据文件全路径(包含文件夹)解析文件的分类 //根据文件全路径(包含文件夹)解析文件的分类
@@ -451,4 +508,13 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd_HHmmss"); SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd_HHmmss");
return sdf.format(calendar.getTime()); return sdf.format(calendar.getTime());
} }
private static String getCommonPrefix(String s1, String s2) {
for (int i = 0; i <= s1.length() && i <= s2.length(); i++) {
if (i == s1.length() || i == s2.length() || s1.charAt(i) != s2.charAt(i)) {
return s1.substring(0, i);
}
}
return s1;
}
} }

View File

@@ -2,26 +2,29 @@ package com.njcn.csdevice.service.impl;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DatePattern; import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.date.LocalDateTimeUtil; import cn.hutool.core.date.LocalDateTimeUtil;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; 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.common.pojo.enums.common.DataStateEnum; import com.njcn.common.pojo.enums.common.DataStateEnum;
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.csdevice.api.CsLineFeignClient; import com.njcn.csdevice.api.CsLineFeignClient;
import com.njcn.csdevice.api.EquipmentFeignClient; import com.njcn.csdevice.api.EquipmentFeignClient;
import com.njcn.csdevice.constant.DataParam; import com.njcn.csdevice.constant.DataParam;
import com.njcn.csdevice.enums.LineBaseEnum; import com.njcn.csdevice.enums.LineBaseEnum;
import com.njcn.csdevice.mapper.CsDeviceUserPOMapper; import com.njcn.csdevice.mapper.CsDataSetMapper;
import com.njcn.csdevice.mapper.CsEquipmentDeliveryMapper; import com.njcn.csdevice.mapper.CsEquipmentDeliveryMapper;
import com.njcn.csdevice.mapper.CsLinePOMapper; import com.njcn.csdevice.mapper.CsLinePOMapper;
import com.njcn.csdevice.mapper.WlRecordMapper; import com.njcn.csdevice.mapper.WlRecordMapper;
import com.njcn.csdevice.param.WlRecordPageParam; import com.njcn.csdevice.param.WlRecordPageParam;
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO; import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
import com.njcn.csdevice.pojo.dto.CsEquipmentProcessDTO;
import com.njcn.csdevice.pojo.param.WlRecordParam; import com.njcn.csdevice.pojo.param.WlRecordParam;
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO; import com.njcn.csdevice.pojo.po.CsDataSet;
import com.njcn.csdevice.pojo.po.CsLinePO; import com.njcn.csdevice.pojo.po.CsLinePO;
import com.njcn.csdevice.pojo.po.WlRecord; import com.njcn.csdevice.pojo.po.WlRecord;
import com.njcn.csdevice.pojo.vo.RecordAllDevTreeVo; import com.njcn.csdevice.pojo.vo.RecordAllDevTreeVo;
@@ -29,8 +32,12 @@ import com.njcn.csdevice.pojo.vo.RecordTreeVo;
import com.njcn.csdevice.pojo.vo.RecordVo; import com.njcn.csdevice.pojo.vo.RecordVo;
import com.njcn.csdevice.service.IWlRecordService; import com.njcn.csdevice.service.IWlRecordService;
import com.njcn.csdevice.util.InfluxDbParamUtil; import com.njcn.csdevice.util.InfluxDbParamUtil;
import com.njcn.csdevice.utils.DataChangeUtil;
import com.njcn.csharmonic.constant.HarmonicConstant;
import com.njcn.csharmonic.param.CommonStatisticalQueryParam; import com.njcn.csharmonic.param.CommonStatisticalQueryParam;
import com.njcn.csharmonic.pojo.vo.ThdDataVO; import com.njcn.csharmonic.pojo.vo.ThdDataVO;
import com.njcn.device.biz.pojo.po.Overlimit;
import com.njcn.device.biz.utils.COverlimitUtil;
import com.njcn.influx.imapper.CommonMapper; import com.njcn.influx.imapper.CommonMapper;
import com.njcn.influx.pojo.bo.CommonQueryParam; import com.njcn.influx.pojo.bo.CommonQueryParam;
import com.njcn.influx.pojo.constant.InfluxDBTableConstant; import com.njcn.influx.pojo.constant.InfluxDBTableConstant;
@@ -38,19 +45,22 @@ import com.njcn.influx.pojo.dto.StatisticalDataDTO;
import com.njcn.influx.query.InfluxQueryWrapper; import com.njcn.influx.query.InfluxQueryWrapper;
import com.njcn.influx.service.CommonService; import com.njcn.influx.service.CommonService;
import com.njcn.system.api.CsStatisticalSetFeignClient; import com.njcn.system.api.CsStatisticalSetFeignClient;
import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.pojo.po.DictData;
import com.njcn.system.pojo.po.EleEpdPqd; import com.njcn.system.pojo.po.EleEpdPqd;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.sf.cglib.core.Local;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.time.*; import java.time.Duration;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
@@ -77,16 +87,20 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
private final CommonMapper commonMapper; private final CommonMapper commonMapper;
private final CsDataSetMapper csDataSetMapper;
private final InfluxDbParamUtil influxDbParamUtil; private final InfluxDbParamUtil influxDbParamUtil;
private final CsLinePOMapper csLinePOMapper; private final CsLinePOMapper csLinePOMapper;
private final CsEquipmentDeliveryMapper csEquipmentDeliveryMapper; private final CsEquipmentDeliveryMapper csEquipmentDeliveryMapper;
private final OverlimitService overlimitService;
private final DicDataFeignClient dicDataFeignClient;
private final DecimalFormat df = new DecimalFormat(DataParam.DecimalFormatStr); private final DecimalFormat df = new DecimalFormat(DataParam.DecimalFormatStr);
@Override @Override
@Transactional(rollbackFor = Exception.class) // @Transactional(rollbackFor = Exception.class)
public void addRecord(WlRecordParam.AddRecord records) { public void addRecord(WlRecordParam.AddRecord records) {
//整理的方案下测试项集合(可能添加多个测试项) //整理的方案下测试项集合(可能添加多个测试项)
List<WlRecord> insertList = new ArrayList<>(); List<WlRecord> insertList = new ArrayList<>();
@@ -113,6 +127,17 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
updateRecord.setId(record.getId()); updateRecord.setId(record.getId());
updateRecord.setList(item.getList()); updateRecord.setList(item.getList());
saveDataRecord(updateRecord); saveDataRecord(updateRecord);
//生成测试项限值,用于报表
DictData scaleResult = dicDataFeignClient.getDicDataById(record.getVoltageLevel()).getData();
if (Objects.isNull(scaleResult)) {
throw new BusinessException(CommonResponseEnum.DIC_DATA);
}
float voltageLevel = Float.parseFloat(scaleResult.getValue());
Overlimit overlimit = COverlimitUtil.globalAssemble(voltageLevel, record.getCapacitySi(), record.getCapacitySt(), record.getCapacitySscmin(), 1, 0);
overlimit.setId(id);
overlimitService.saveOrUpdate(overlimit);
}); });
this.saveBatch(insertList); this.saveBatch(insertList);
} }
@@ -128,7 +153,7 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
} }
@Override @Override
@Transactional(rollbackFor = Exception.class) // @Transactional(rollbackFor = Exception.class)
public void updateTestRecord(WlRecordParam.UpdateRecord record) { public void updateTestRecord(WlRecordParam.UpdateRecord record) {
WlRecord wlRecord = new WlRecord(); WlRecord wlRecord = new WlRecord();
BeanUtils.copyProperties(record, wlRecord); BeanUtils.copyProperties(record, wlRecord);
@@ -136,6 +161,17 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
wlRecord.setEndTime(record.getProEndTime()); wlRecord.setEndTime(record.getProEndTime());
this.updateById(wlRecord); this.updateById(wlRecord);
saveDataRecord(record); saveDataRecord(record);
//修改测试项限值,用于报表
DictData scaleResult = dicDataFeignClient.getDicDataById(record.getVoltageLevel()).getData();
if (Objects.isNull(scaleResult)) {
throw new BusinessException(CommonResponseEnum.DIC_DATA);
}
float voltageLevel = Float.parseFloat(scaleResult.getValue());
Overlimit overlimit = COverlimitUtil.globalAssemble(voltageLevel, record.getCapacitySi(), record.getCapacitySt(), record.getCapacitySscmin(), 1, 0);
overlimit.setId(record.getId());
overlimitService.saveOrUpdate(overlimit);
} }
@Override @Override
@@ -179,6 +215,7 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
wlRecord.setStartTime(getFirstTimeById(wlRecord.getId())); wlRecord.setStartTime(getFirstTimeById(wlRecord.getId()));
wlRecord.setEndTime(getLastTimeById(wlRecord.getId())); wlRecord.setEndTime(getLastTimeById(wlRecord.getId()));
BeanUtils.copyProperties(wlRecord, recordVo); BeanUtils.copyProperties(wlRecord, recordVo);
recordVo.setList(this.baseMapper.getDataRecordBytestId(wlRecord.getId()));
recordVoList.add(recordVo); recordVoList.add(recordVo);
}else{ }else{
//反之则是方案ID 则返回该方案下所有的测试项信息 //反之则是方案ID 则返回该方案下所有的测试项信息
@@ -192,6 +229,7 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
wl.setStartTime(getFirstTimeById(wl.getId())); wl.setStartTime(getFirstTimeById(wl.getId()));
wl.setEndTime(getLastTimeById(wl.getId())); wl.setEndTime(getLastTimeById(wl.getId()));
BeanUtils.copyProperties(wl, recordVo); BeanUtils.copyProperties(wl, recordVo);
recordVo.setList(this.baseMapper.getDataRecordBytestId(wl.getId()));
recordVoList.add(recordVo); recordVoList.add(recordVo);
} }
} }
@@ -298,7 +336,7 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
} }
@Override @Override
@Transactional(rollbackFor = Exception.class) // @Transactional(rollbackFor = Exception.class)
public void deleteRecord(String id) { public void deleteRecord(String id) {
LambdaQueryWrapper<WlRecord> qw = new LambdaQueryWrapper(); LambdaQueryWrapper<WlRecord> qw = new LambdaQueryWrapper();
qw.eq(WlRecord::getId,id).eq(WlRecord::getState,"1").eq(WlRecord::getType,"0"); qw.eq(WlRecord::getId,id).eq(WlRecord::getState,"1").eq(WlRecord::getType,"0");
@@ -315,6 +353,7 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
if(wlRecord.getPId() != null){ if(wlRecord.getPId() != null){
//方案关联的设备基础数据也删除 //方案关联的设备基础数据也删除
this.baseMapper.deleteDataRecord(id,null); this.baseMapper.deleteDataRecord(id,null);
overlimitService.removeById(id);
}else{ }else{
//如果删除的是方案 那么连带方案下的所有测试项也要删除 //如果删除的是方案 那么连带方案下的所有测试项也要删除
qw = new LambdaQueryWrapper(); qw = new LambdaQueryWrapper();
@@ -356,7 +395,8 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
List<WlRecord> data = new ArrayList<>(); List<WlRecord> data = new ArrayList<>();
if(wlRecord.getPId() == null){ if(wlRecord.getPId() == null){
//如果查询的是方案 则查询该方案下所有的测试项关联的设备基础数据 //如果查询的是方案 则查询该方案下所有的测试项关联的设备基础数据
data = this.baseMapper.getDataRecordByTestId(wlRecord.getId(),1); return null;
// data = this.baseMapper.getDataRecordByTestId(wlRecord.getId(),1);
}else{ }else{
//如果查询的是测试项 则查询该测试项下所有的关联的设备基础数据 //如果查询的是测试项 则查询该测试项下所有的关联的设备基础数据
data = this.baseMapper.getDataRecordByTestId(wlRecord.getId(),0); data = this.baseMapper.getDataRecordByTestId(wlRecord.getId(),0);
@@ -367,7 +407,7 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
} }
//格式化前端参数 //格式化前端参数
formatQueryParamList(commonStatisticalQueryParam); formatQueryParamList(commonStatisticalQueryParam);
if(commonStatisticalQueryParam.getList() != null && commonStatisticalQueryParam.getList().size() > 0){ if(commonStatisticalQueryParam.getList() != null && !commonStatisticalQueryParam.getList().isEmpty()){
for (CommonStatisticalQueryParam param : commonStatisticalQueryParam.getList()){ for (CommonStatisticalQueryParam param : commonStatisticalQueryParam.getList()){
if(param.getStatisticalId() == null){ if(param.getStatisticalId() == null){
continue; continue;
@@ -375,6 +415,13 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
List<EleEpdPqd> eleEpdPqds = csStatisticalSetFeignClient.queryStatisticalSelect(param.getStatisticalId()).getData(); List<EleEpdPqd> eleEpdPqds = csStatisticalSetFeignClient.queryStatisticalSelect(param.getStatisticalId()).getData();
for(WlRecord wl : data){ for(WlRecord wl : data){
List<CsLinePO> finalCsLinePOList = csLineFeignClient.queryLineById(Arrays.asList(wl.getLineId())).getData(); List<CsLinePO> finalCsLinePOList = csLineFeignClient.queryLineById(Arrays.asList(wl.getLineId())).getData();
CsDataSet csDataSet = csDataSetMapper.selectOne(new LambdaQueryWrapper<CsDataSet>().eq(CsDataSet::getId,finalCsLinePOList.get(0).getDataSetId()));
if(StrUtil.isBlank(csDataSet.getDataLevel())){
throw new BusinessException("当前测点数据集主要信息缺失,请联系管理员排查(测点表里面数据集id缺失)");
}
Double ct = Double.valueOf(wlRecord.getCt())/wlRecord.getCt1();
Double pt =Double.valueOf(wlRecord.getPt())/wlRecord.getPt1();
List<CsEquipmentDeliveryDTO> data1 = equipmentFeignClient.queryDeviceById(Stream.of(wl.getDevId()).collect(Collectors.toList())).getData(); List<CsEquipmentDeliveryDTO> data1 = equipmentFeignClient.queryDeviceById(Stream.of(wl.getDevId()).collect(Collectors.toList())).getData();
eleEpdPqds.forEach(epdPqd->{ eleEpdPqds.forEach(epdPqd->{
List<CommonQueryParam> commonQueryParams = finalCsLinePOList.stream().map(temp -> { List<CommonQueryParam> commonQueryParams = finalCsLinePOList.stream().map(temp -> {
@@ -391,17 +438,52 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
return commonQueryParam; return commonQueryParam;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
List<StatisticalDataDTO> deviceRtData = commonService.getDeviceRtDataByTime(commonQueryParams); List<StatisticalDataDTO> deviceRtData = commonService.getDeviceRtDataByTime(commonQueryParams);
//此处设空时为了有多段时将线条断开前端显示
if(!CollectionUtils.isEmpty(deviceRtData)){
deviceRtData.get(deviceRtData.size()-1).setValue(null);
}
List<ThdDataVO> collect1 = deviceRtData.stream().map(temp -> { List<ThdDataVO> collect1 = deviceRtData.stream().map(temp -> {
ThdDataVO vo = new ThdDataVO(); ThdDataVO vo = new ThdDataVO();
vo.setLineId(temp.getLineId()); vo.setLineId(temp.getLineId());
vo.setPhase(temp.getPhaseType()); vo.setPhase(Objects.equals("M",temp.getPhaseType())?null:temp.getPhaseType());
String position = finalCsLinePOList.stream().filter(csLinePO -> Objects.equals(csLinePO.getLineId(), vo.getLineId())).collect(Collectors.toList()).get(0).getPosition(); String position = finalCsLinePOList.stream().filter(csLinePO -> Objects.equals(csLinePO.getLineId(), vo.getLineId())).collect(Collectors.toList()).get(0).getPosition();
vo.setPosition(position); vo.setPosition(position);
vo.setTime(temp.getTime()); vo.setTime(temp.getTime());
vo.setStatMethod(temp.getValueType()); vo.setStatMethod(temp.getValueType());
if(temp.getValue()!=null) {
double re;
if (Objects.equals("Primary",commonStatisticalQueryParam.getDataLevel())) {
if (Objects.equals("Primary",csDataSet.getDataLevel())) {
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue()))); vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
vo.setStatisticalIndex(epdPqd.getId());
vo.setUnit(epdPqd.getUnit()); vo.setUnit(epdPqd.getUnit());
} else {
if (HarmonicConstant.POWER_LIST.contains(epdPqd.getShowName())) {
re = DataChangeUtil.secondaryToPrimary(epdPqd.getPrimaryFormula(), temp.getValue(), pt, ct) / 1000;
vo.setStatisticalData(Double.valueOf(df.format(re)));
vo.setUnit("k" + epdPqd.getUnit());
} else {
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
vo.setUnit(epdPqd.getUnit());
}
}
} else {
if (Objects.equals("Primary",csDataSet.getDataLevel())) {
if (HarmonicConstant.POWER_LIST.contains(epdPqd.getShowName())) {
re = DataChangeUtil.primaryToSecondary(epdPqd.getPrimaryFormula(), temp.getValue(), pt, ct);
vo.setStatisticalData(Double.valueOf(df.format(re)));
} else {
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
vo.setUnit(epdPqd.getUnit());
}
} else {
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
}
vo.setUnit(epdPqd.getUnit());
}
} else {
vo.setStatisticalData(null);
}
vo.setStatisticalIndex(epdPqd.getId());
vo.setStatisticalName(epdPqd.getName()); vo.setStatisticalName(epdPqd.getName());
vo.setAnotherName(epdPqd.getShowName()); vo.setAnotherName(epdPqd.getShowName());
return vo; return vo;
@@ -427,9 +509,13 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
} }
@Override @Override
public void dayDealNoEndTimeEvent() { @Transactional(rollbackFor = Exception.class)
public void dayDealNoEndTimeEvent(String date) {
DateTime dateEnd = DateUtil.parse(date,DatePattern.NORM_DATE_PATTERN);
DateTime dateStart = DateUtil.offsetDay(dateEnd,-30);
System.out.println("进入定时任务");
LambdaQueryWrapper<WlRecord> lambdaQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<WlRecord> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(WlRecord::getType,1).eq(WlRecord::getState,DataStateEnum.ENABLE.getCode()); lambdaQueryWrapper.between(WlRecord::getStartTime,dateStart,dateEnd).eq(WlRecord::getType,1).eq(WlRecord::getState,DataStateEnum.ENABLE.getCode());
List<WlRecord> wlRecordList = this.list(lambdaQueryWrapper); List<WlRecord> wlRecordList = this.list(lambdaQueryWrapper);
if(CollUtil.isNotEmpty(wlRecordList)){ if(CollUtil.isNotEmpty(wlRecordList)){
@@ -508,8 +594,7 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
}); });
if(CollUtil.isNotEmpty(poList)){ if(CollUtil.isNotEmpty(poList)){
System.out.println("444"); this.updateBatchById(poList);
//
} }
} }

View File

@@ -36,7 +36,7 @@
<dependency> <dependency>
<groupId>com.njcn</groupId> <groupId>com.njcn</groupId>
<artifactId>pqs-influx</artifactId> <artifactId>pqs-influx</artifactId>
<version>0.0.1-SNAPSHOT</version> <version>1.0.0</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>

View File

@@ -73,12 +73,11 @@ public interface HarmonicConstant {
String CTRL_DATA = "ctrl_data"; String CTRL_DATA = "ctrl_data";
Set<String> POWER_LIST = new HashSet<>(Arrays.asList( Set<String> POWER_LIST = new HashSet<>(Arrays.asList(
"电网有功功率", "电网无功功率", "电网视在功率", "负载有功功率", "电网有功功率", "电网无功功率", "电网视在功率", "负载有功功率",
"负载无功功率", "负载视在功率", "有功功率", "无功功率", "负载无功功率", "负载视在功率", "有功功率", "无功功率",
"视在功率", "基波有功功率", "基波无功功率", "视在功率", "基波有功功率", "基波无功功率",
"基波视在功率", "三相总有功功率", "三相总无功功率", "基波视在功率", "三相总有功功率", "三相总无功功率",
"三相总视在功率" "三相总视在功率","相电压总有效值","线电压总有效值","相电压基波有效值","线电压基波有效值","电压正序分量"
)); ));
} }

View File

@@ -17,6 +17,7 @@ public enum CsHarmonicResponseEnum {
CS_DEVICE_COMMON_ERROR("A00600","治理稳态模块异常"), CS_DEVICE_COMMON_ERROR("A00600","治理稳态模块异常"),
BIND_TARGET_ERROR("A00601","指标参数绑定异常"), BIND_TARGET_ERROR("A00601","指标参数绑定异常"),
MAKE_UP_ERROR("A00602","补招失败"), MAKE_UP_ERROR("A00602","补招失败"),
RECORD_MISSING("A00602","record.bin文件缺失,补召失败")
; ;

View File

@@ -117,7 +117,7 @@ public class AnalyseComtradeCfg {
hashMapA.put("pq_RmsU",rms[0]); hashMapA.put("pq_RmsU",rms[0]);
hashMapB.put("pq_RmsU",rms[1]); hashMapB.put("pq_RmsU",rms[1]);
hashMapC.put("pq_RmsU",rms[2]); hashMapC.put("pq_RmsU",rms[2]);
hashMapA.put("pq_RmsU",rms[3]); hashMapA.put("pq_RmsI",rms[3]);
hashMapB.put("pq_RmsI",rms[4]); hashMapB.put("pq_RmsI",rms[4]);
hashMapC.put("pq_RmsI",rms[5]); hashMapC.put("pq_RmsI",rms[5]);
hashMapA.put("pq_RmsLU",rms[6]); hashMapA.put("pq_RmsLU",rms[6]);
@@ -197,37 +197,37 @@ public class AnalyseComtradeCfg {
Float[][][] harmPower = min.getHarm_Power(); Float[][][] harmPower = min.getHarm_Power();
for (int i = 0; i < 49; i++) { for (int i = 0; i < 49; i++) {
//电压含有率 //电压含有率
hashMapA.put("pq_HarmU_"+(i+2),harmContain[0][i]); hashMapA.put("pq_HarmU_"+(i+2),harmContain[0][i+1]);
hashMapB.put("pq_HarmU_"+(i+2),harmContain[1][i]); hashMapB.put("pq_HarmU_"+(i+2),harmContain[1][i+1]);
hashMapC.put("pq_HarmU_"+(i+2),harmContain[2][i]); hashMapC.put("pq_HarmU_"+(i+2),harmContain[2][i+1]);
//谐波相角 //谐波相角
hashMapA.put("pq_HarmUAng_"+(i+2),fuHarmPhase[0][i]); hashMapA.put("pq_HarmUAng_"+(i+2),fuHarmPhase[0][i+1]);
hashMapB.put("pq_HarmUAng_"+(i+2),fuHarmPhase[1][i]); hashMapB.put("pq_HarmUAng_"+(i+2),fuHarmPhase[1][i+1]);
hashMapC.put("pq_HarmUAng_"+(i+2),fuHarmPhase[2][i]); hashMapC.put("pq_HarmUAng_"+(i+2),fuHarmPhase[2][i+1]);
hashMapA.put("pq_HarmIAng_"+(i+2),fuHarmPhase[3][i]); hashMapA.put("pq_HarmIAng_"+(i+2),fuHarmPhase[3][i+1]);
hashMapB.put("pq_HarmIAng_"+(i+2),fuHarmPhase[4][i]); hashMapB.put("pq_HarmIAng_"+(i+2),fuHarmPhase[4][i+1]);
hashMapC.put("pq_HarmIAng_"+(i+2),fuHarmPhase[5][i]); hashMapC.put("pq_HarmIAng_"+(i+2),fuHarmPhase[5][i+1]);
//电流幅值 //电流幅值
hashMapA.put("pq_HarmI_"+(i+2),fuHarm[3][i]); hashMapA.put("pq_HarmI_"+(i+2),fuHarm[3][i+1]);
hashMapB.put("pq_HarmI_"+(i+2),fuHarm[4][i]); hashMapB.put("pq_HarmI_"+(i+2),fuHarm[4][i+1]);
hashMapC.put("pq_HarmI_"+(i+2),fuHarm[5][i]); hashMapC.put("pq_HarmI_"+(i+2),fuHarm[5][i+1]);
//谐波功率 //谐波功率
hashMapA.put("pq_HarmP_"+(i+2),harmPower[0][i][0]); hashMapA.put("pq_HarmP_"+(i+2),harmPower[0][i+1][0]);
hashMapA.put("pq_HarmQ_"+(i+2),harmPower[0][i][1]); hashMapA.put("pq_HarmQ_"+(i+2),harmPower[0][i+1][1]);
hashMapA.put("pq_HarmS_"+(i+2),harmPower[0][i][2]); hashMapA.put("pq_HarmS_"+(i+2),harmPower[0][i+1][2]);
hashMapB.put("pq_HarmP_"+(i+2),harmPower[1][i][0]); hashMapB.put("pq_HarmP_"+(i+2),harmPower[1][i+1][0]);
hashMapB.put("pq_HarmQ_"+(i+2),harmPower[1][i][1]); hashMapB.put("pq_HarmQ_"+(i+2),harmPower[1][i+1][1]);
hashMapB.put("pq_HarmS_"+(i+2),harmPower[1][i][2]); hashMapB.put("pq_HarmS_"+(i+2),harmPower[1][i+1][2]);
hashMapC.put("pq_HarmP_"+(i+2),harmPower[2][i][0]); hashMapC.put("pq_HarmP_"+(i+2),harmPower[2][i+1][0]);
hashMapC.put("pq_HarmQ_"+(i+2),harmPower[2][i][1]); hashMapC.put("pq_HarmQ_"+(i+2),harmPower[2][i+1][1]);
hashMapC.put("pq_HarmS_"+(i+2),harmPower[2][i][2]); hashMapC.put("pq_HarmS_"+(i+2),harmPower[2][i+1][2]);
//M相目前没有 //M相目前没有
// hashMapT.put("pq_HarmP_"+(i+2),harmPower[3][i][0]); // hashMapT.put("pq_HarmP_"+(i+2),harmPower[3][i][0]);
// hashMapT.put("pq_HarmQ_"+(i+2),harmPower[3][i][1]); // hashMapT.put("pq_HarmQ_"+(i+2),harmPower[3][i][1]);
@@ -679,7 +679,7 @@ public class AnalyseComtradeCfg {
strFileLine = sr.readLine(); // ⑩ strFileLine = sr.readLine(); // ⑩
comtradeCfg.setTimeStart(LocalDateTime.parse(strFileLine, sdf)); comtradeCfg.setTimeStart(LocalDateTime.parse(strFileLine, sdf));
comtradeCfg.setTimeEnd(comtradeCfg.getTimeStart().plusSeconds(nMSTotal/1000L));; comtradeCfg.setTimeEnd(LocalDateTime.parse(strFileLine, sdf).plusNanos(nMSTotal * 1000000));;
comtradeCfg.setPath(file.getOriginalFilename()); comtradeCfg.setPath(file.getOriginalFilename());
sr.close(); sr.close();

View File

@@ -23,6 +23,10 @@ public class CommonStatisticalQueryParam {
private String statisticalId; private String statisticalId;
@ApiModelProperty(value = "取值类型MaxMincp95avg") @ApiModelProperty(value = "取值类型MaxMincp95avg")
private String valueType; private String valueType;
@ApiModelProperty(value = "一次值Primary;二次值Secondary")
private String dataLevel;
@ApiModelProperty(value = "频次2-50") @ApiModelProperty(value = "频次2-50")
private String frequency; private String frequency;

View File

@@ -29,6 +29,10 @@ public class CsEventUserQueryPage extends CsEventUserQueryParam{
@ApiModelProperty(value = "显示条数",name = "pageSize",dataType ="Integer",required = true) @ApiModelProperty(value = "显示条数",name = "pageSize",dataType ="Integer",required = true)
private Integer pageSize; private Integer pageSize;
@ApiModelProperty(value = "设备类型名称(便携式,治理)")
private String deviceTypeName;
@ApiModelProperty(value = "工程id") @ApiModelProperty(value = "工程id")
private String engineeringid; private String engineeringid;

View File

@@ -22,6 +22,7 @@ import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List; import java.util.List;
@@ -83,6 +84,16 @@ public class CsEventController extends BaseController {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, eventVO, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, eventVO, methodDescribe);
} }
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@GetMapping("/getFileZip")
@ApiOperation("下载事件原始文件压缩包")
@ApiImplicitParam(name = "eventId", value = "暂态事件索引", required = true)
public void getFileZip(String eventId, HttpServletResponse response) {
String methodDescribe = getMethodDescribe("getFileZip");
csEventPOService.getFileZip(eventId,response);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON) @OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/saveBatchEventList") @PostMapping("/saveBatchEventList")
@ApiOperation("批量新增事件") @ApiOperation("批量新增事件")

View File

@@ -59,13 +59,22 @@ public class EventUserController extends BaseController {
@OperateInfo(info = LogEnum.BUSINESS_COMMON) @OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/queryEventpage") @PostMapping("/queryEventpage")
@ApiOperation("事件消息") @ApiOperation("事件消息(app)")
@ApiImplicitParam(name = "csEventUserQueryPage", value = "暂降事件查询参数", required = true) @ApiImplicitParam(name = "csEventUserQueryPage", value = "暂降事件查询参数", required = true)
public HttpResult<Page<EventDetailVO>> queryEventpage(@RequestBody CsEventUserQueryPage csEventUserQueryPage) { public HttpResult<Page<EventDetailVO>> queryEventpage(@RequestBody CsEventUserQueryPage csEventUserQueryPage) {
String methodDescribe = getMethodDescribe("queryEventpage"); String methodDescribe = getMethodDescribe("queryEventpage");
Page<EventDetailVO> list = csEventUserPOService.queryEventpage(csEventUserQueryPage); Page<EventDetailVO> list = csEventUserPOService.queryEventpage(csEventUserQueryPage);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
} }
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/queryEventpageWeb")
@ApiOperation("事件消息(web)")
@ApiImplicitParam(name = "csEventUserQueryPage", value = "暂降事件查询参数", required = true)
public HttpResult<Page<EventDetailVO>> queryEventpageWeb(@RequestBody CsEventUserQueryPage csEventUserQueryPage) {
String methodDescribe = getMethodDescribe("queryEventpageWeb");
Page<EventDetailVO> list = csEventUserPOService.queryEventPageWeb(csEventUserQueryPage);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON) @OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/updateStatus") @PostMapping("/updateStatus")

View File

@@ -1,10 +1,21 @@
package com.njcn.csharmonic.controller; package com.njcn.csharmonic.controller;
import com.njcn.common.pojo.annotation.OperateInfo;
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.csharmonic.service.RealDataService;
import com.njcn.web.controller.BaseController; import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api; 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.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
/** /**
@@ -21,9 +32,37 @@ import org.springframework.web.bind.annotation.RestController;
@AllArgsConstructor @AllArgsConstructor
public class RealDataController extends BaseController { public class RealDataController extends BaseController {
private final RealDataService realDataService;
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/getBaseRealData")
@ApiOperation("获取基础实时数据")
@ApiImplicitParam(name = "lineId", value = "监测点id")
public HttpResult<Boolean> getRealData(@RequestParam("lineId") String lineId) {
String methodDescribe = getMethodDescribe("getRealData");
boolean result = realDataService.getBaseRealData(lineId);
if (result) {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
} else {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
}
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/getHarmRealData")
@ApiOperation("获取谐波实时数据")
@ApiImplicitParams({
@ApiImplicitParam(name = "lineId", value = "监测点id"),
@ApiImplicitParam(name = "target", value = "指标名称 0:谐波电压含有率 1:谐波电流幅值 2:间谐波电压含有率"),
})
public HttpResult<Boolean> getHarmRealData(@RequestParam("lineId") String lineId, @RequestParam("target") Integer target) {
String methodDescribe = getMethodDescribe("getHarmRealData");
boolean result = realDataService.getHarmRealData(lineId,target);
if (result) {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
} else {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
}
}
} }

View File

@@ -24,4 +24,6 @@ public interface CsEventUserPOMapper extends BaseMapper<CsEventUserPO> {
List<EventDetailVO> queryUserEventList(@Param("csEventUserQueryParam") CsEventUserQueryParam csEventUserQueryParam, @Param("devIds") List<String> devIds, @Param("flag") Boolean flag); List<EventDetailVO> queryUserEventList(@Param("csEventUserQueryParam") CsEventUserQueryParam csEventUserQueryParam, @Param("devIds") List<String> devIds, @Param("flag") Boolean flag);
Page<EventDetailVO> queryEventpage(Page<EventDetailVO> returnpage, @Param("csEventUserQueryPage") CsEventUserQueryPage csEventUserQueryPage, @Param("devIds") List<String> devIds, @Param("flag") Boolean flag); Page<EventDetailVO> queryEventpage(Page<EventDetailVO> returnpage, @Param("csEventUserQueryPage") CsEventUserQueryPage csEventUserQueryPage, @Param("devIds") List<String> devIds, @Param("flag") Boolean flag);
Page<EventDetailVO> queryEventPageWeb(Page<EventDetailVO> returnpage,@Param("csEventUserQueryPage") CsEventUserQueryPage csEventUserQueryPage,@Param("devIds") List<String> collect);
} }

View File

@@ -117,4 +117,36 @@
</if> </if>
order by b.start_time desc order by b.start_time desc
</select> </select>
<select id="queryEventPageWeb" resultType="com.njcn.csharmonic.pojo.vo.EventDetailVO">
select DISTINCT b.id id,
b.device_id deviceId,b.line_id lineId,b.code code,
b.start_time startTime,b.tag tag ,b.wave_path wavePath,b.instant_pics,b.rms_pics , b.type type,b.level level,b.location location,d.name lineName
from cs_event b inner join cs_equipment_delivery c on b.device_id=c.id inner join cs_line d on d.device_id=b.device_id and d.clDid=b.cl_did where 1=1
and b.process=c.process
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.endTime != null and csEventUserQueryPage.endTime !=''">
AND DATE(b.start_time) &lt;= DATE(#{csEventUserQueryPage.endTime})
</if>
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.startTime != null and csEventUserQueryPage.startTime !=''">
AND DATE(b.start_time) &gt;= DATE(#{csEventUserQueryPage.startTime})
</if>
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.target != null and csEventUserQueryPage.target.size()>0">
and b.tag in
<foreach collection="csEventUserQueryPage.target" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
and b.device_id in
<foreach collection="devIds" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.type != null and csEventUserQueryPage.type !=''">
AND b.type =#{ csEventUserQueryPage.type}
</if>
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.level != null and csEventUserQueryPage.level !=''">
AND b.level =#{ csEventUserQueryPage.level}
</if>
order by b.start_time desc
</select>
</mapper> </mapper>

View File

@@ -10,6 +10,7 @@ import com.njcn.csharmonic.pojo.vo.CsEventVO;
import com.njcn.csharmonic.pojo.vo.EventDetailVO; import com.njcn.csharmonic.pojo.vo.EventDetailVO;
import com.njcn.event.file.pojo.dto.WaveDataDTO; import com.njcn.event.file.pojo.dto.WaveDataDTO;
import javax.servlet.http.HttpServletResponse;
import java.util.List; import java.util.List;
/** /**
@@ -46,4 +47,6 @@ public interface CsEventPOService extends IService<CsEventPO>{
Page<DataGroupEventVO> pageQueryByLineId(CsEventUserQueryPage csEventUserQueryPage); Page<DataGroupEventVO> pageQueryByLineId(CsEventUserQueryPage csEventUserQueryPage);
void saveBatchEventList(List<CsEventPO> csEventPOS); void saveBatchEventList(List<CsEventPO> csEventPOS);
void getFileZip(String eventId,HttpServletResponse response);
} }

View File

@@ -27,4 +27,6 @@ public interface CsEventUserPOService extends IService<CsEventUserPO>{
void updateStatus(CsEventUserQueryParam csEventUserQueryParam); void updateStatus(CsEventUserQueryParam csEventUserQueryParam);
Page<EventDetailVO> queryEventpage(CsEventUserQueryPage csEventUserQueryPage); Page<EventDetailVO> queryEventpage(CsEventUserQueryPage csEventUserQueryPage);
Page<EventDetailVO> queryEventPageWeb(CsEventUserQueryPage csEventUserQueryPage);
} }

View File

@@ -0,0 +1,20 @@
package com.njcn.csharmonic.service;
/**
* @author xuyang
*/
public interface RealDataService {
/**
* 获取装置基础实时数据
* @param lineId
*/
boolean getBaseRealData(String lineId);
/**
* 获取装置谐波实时数据
* @param lineId
*/
boolean getHarmRealData(String lineId,Integer target);
}

View File

@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.common.pojo.exception.BusinessException; import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.csdevice.api.RoleEngineerDevFeignClient; import com.njcn.csdevice.api.RoleEngineerDevFeignClient;
import com.njcn.csdevice.constant.DataParam;
import com.njcn.csharmonic.constant.HarmonicConstant; import com.njcn.csharmonic.constant.HarmonicConstant;
import com.njcn.csharmonic.mapper.CsConfigurationMapper; import com.njcn.csharmonic.mapper.CsConfigurationMapper;
import com.njcn.csharmonic.param.CsConfigurationParm; import com.njcn.csharmonic.param.CsConfigurationParm;
@@ -116,6 +117,8 @@ public class CsConfigurationServiceImpl extends ServiceImpl<CsConfigurationMappe
if(CollectionUtils.isEmpty(data1)){ if(CollectionUtils.isEmpty(data1)){
return returnpage; return returnpage;
} }
//+无线项目id
data1.add(DataParam.WIRELESS_PROJECT_ID);
Page<CsConfigurationPO> csConfigurationPOPage = this.getBaseMapper().queryPage(temppage,csConfigurationQueryParam,data1); Page<CsConfigurationPO> csConfigurationPOPage = this.getBaseMapper().queryPage(temppage,csConfigurationQueryParam,data1);
// QueryWrapper<CsConfigurationPO> query = new QueryWrapper<>(); // QueryWrapper<CsConfigurationPO> query = new QueryWrapper<>();
// query.like(StringUtils.isNotBlank(csConfigurationQueryParam.getSearchValue()),CsConfigurationPO.COL_NAME,csConfigurationQueryParam.getSearchValue()). // query.like(StringUtils.isNotBlank(csConfigurationQueryParam.getSearchValue()),CsConfigurationPO.COL_NAME,csConfigurationQueryParam.getSearchValue()).

View File

@@ -7,6 +7,7 @@ import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateTime; import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.core.util.ZipUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.common.pojo.exception.BusinessException; import com.njcn.common.pojo.exception.BusinessException;
@@ -29,6 +30,7 @@ import com.njcn.event.file.pojo.enums.WaveFileResponseEnum;
import com.njcn.event.file.utils.WaveUtil; import com.njcn.event.file.utils.WaveUtil;
import com.njcn.influx.pojo.dto.EventDataSetDTO; import com.njcn.influx.pojo.dto.EventDataSetDTO;
import com.njcn.influx.service.EvtDataService; import com.njcn.influx.service.EvtDataService;
import com.njcn.minioss.config.MinIossProperties;
import com.njcn.oss.constant.GeneralConstant; import com.njcn.oss.constant.GeneralConstant;
import com.njcn.oss.utils.FileStorageUtil; import com.njcn.oss.utils.FileStorageUtil;
import com.njcn.system.api.EleEvtFeignClient; import com.njcn.system.api.EleEvtFeignClient;
@@ -37,6 +39,7 @@ import com.njcn.system.pojo.po.EleEpdPqd;
import com.njcn.system.pojo.po.EleEvtParm; import com.njcn.system.pojo.po.EleEvtParm;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -45,7 +48,11 @@ import com.njcn.csharmonic.mapper.CsEventPOMapper;
import com.njcn.csharmonic.pojo.po.CsEventPO; import com.njcn.csharmonic.pojo.po.CsEventPO;
import com.njcn.csharmonic.service.CsEventPOService; import com.njcn.csharmonic.service.CsEventPOService;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.*; import java.util.*;
@@ -82,6 +89,7 @@ public class CsEventPOServiceImpl extends ServiceImpl<CsEventPOMapper, CsEventPO
private final EleEvtFeignClient eleEvtFeignClient; private final EleEvtFeignClient eleEvtFeignClient;
private final WavePicComponent wavePicComponent; private final WavePicComponent wavePicComponent;
private final MinIossProperties minIossProperties;
@Override @Override
public List<EventDetailVO> queryEventList(CsEventUserQueryParam csEventUserQueryParam) { public List<EventDetailVO> queryEventList(CsEventUserQueryParam csEventUserQueryParam) {
@@ -157,6 +165,47 @@ public class CsEventPOServiceImpl extends ServiceImpl<CsEventPOMapper, CsEventPO
this.saveBatch(csEventPOS); this.saveBatch(csEventPOS);
} }
@Override
public void getFileZip(String eventId, HttpServletResponse response) {
CsEventPO eventDetail = this.baseMapper.selectById(eventId);
String waveName = eventDetail.getWavePath();
if (StrUtil.isBlank(waveName)) {
throw new BusinessException(WaveFileResponseEnum.ANALYSE_WAVE_NOT_FOUND);
}
int i = 0;
String baseName="";
try {
List<MultipartFile> excelreport = fileStorageUtil.getAllFile(minIossProperties.getBucket(), waveName);
//被压缩文件流集合
InputStream[] srcFiles = new InputStream[excelreport.size()];
//被压缩文件名称
String[] srcFileNames = new String[excelreport.size()];
for (MultipartFile entity : excelreport) {
//以下代码为获取图片inputStream
InputStream ins = entity.getInputStream();
if (ins == null) {
continue;
}
//塞入流数组中
srcFiles[i] = ins;
int lastIndex = entity.getOriginalFilename().lastIndexOf('/');
String fileName = entity.getOriginalFilename().substring(lastIndex + 1);
baseName = FilenameUtils.getBaseName(fileName);
srcFileNames[i] = fileName;
i++;
}
response.setCharacterEncoding("UTF-8");
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(baseName+".zip", "UTF-8"));
//多个文件压缩成压缩包返回
ZipUtil.zip(response.getOutputStream(), srcFileNames, srcFiles);
} catch (IOException e) {
e.printStackTrace();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
/** /**
* @return WaveDataDTO * @return WaveDataDTO

View File

@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.common.pojo.constant.LogInfo; import com.njcn.common.pojo.constant.LogInfo;
import com.njcn.csdevice.api.CsLedgerFeignClient; import com.njcn.csdevice.api.CsLedgerFeignClient;
import com.njcn.csdevice.constant.DataParam;
import com.njcn.csdevice.pojo.dto.DevDetailDTO; import com.njcn.csdevice.pojo.dto.DevDetailDTO;
import com.njcn.csdevice.pojo.vo.CsLedgerVO; import com.njcn.csdevice.pojo.vo.CsLedgerVO;
@@ -362,6 +363,146 @@ public class CsEventUserPOServiceImpl extends ServiceImpl<CsEventUserPOMapper, C
return returnpage;
}
@Override
public Page<EventDetailVO> queryEventPageWeb(CsEventUserQueryPage csEventUserQueryPage) {
Page<EventDetailVO> returnpage = new Page<> (csEventUserQueryPage.getPageNum ( ), csEventUserQueryPage.getPageSize ( ));
List<CsLedgerVO> data = csLedgerFeignClient.getDeviceTree().getData();
List<String> devIds = new ArrayList<>();
data = data.stream().filter(temp -> StringUtils.isEmpty(csEventUserQueryPage.getDeviceTypeName() )||
Objects.equals(temp.getName(), csEventUserQueryPage.getDeviceTypeName())).collect(Collectors.toList());
//便携式设备和治理设备拆分
List<CsLedgerVO> portableDevTree = data.stream().filter(temp -> Objects.equals(temp.getName(), DataParam.portableDev)).collect(Collectors.toList());
if(!CollectionUtils.isEmpty(portableDevTree)){
portableDevTree = portableDevTree.get(0).getChildren();
}
List<CsLedgerVO> governmentDevTree = data.stream().filter(temp -> Objects.equals(temp.getName(), DataParam.governmentDev)).collect(Collectors.toList());
if(!CollectionUtils.isEmpty(governmentDevTree)){
governmentDevTree = governmentDevTree.get(0).getChildren();
}
//便携式就1层下边就是设备
List<String> portableDevIds = portableDevTree.stream().filter(
temp -> StringUtils.isEmpty(csEventUserQueryPage.getDeviceId()) ||
Objects.equals(temp.getId(), csEventUserQueryPage.getDeviceId())
).map(CsLedgerVO::getId).collect(Collectors.toList());
List<String> governmentDevIds = governmentDevTree.stream().filter(temp->StringUtils.isEmpty(csEventUserQueryPage.getEngineeringid())||
Objects.equals(temp.getId(), csEventUserQueryPage.getEngineeringid()))
.map(CsLedgerVO::getChildren).flatMap(Collection::stream).filter(
temp->StringUtils.isEmpty(csEventUserQueryPage.getProjectId())||
Objects.equals(temp.getId(), csEventUserQueryPage.getProjectId())
).
map(CsLedgerVO::getChildren).flatMap(Collection::stream).filter(
temp->StringUtils.isEmpty(csEventUserQueryPage.getDeviceId())||
Objects.equals(temp.getId(), csEventUserQueryPage.getDeviceId())
).
map(CsLedgerVO::getId).
collect(Collectors.toList());
devIds.addAll(portableDevIds);
devIds.addAll(governmentDevIds);
if (CollectionUtils.isEmpty(devIds)){
return returnpage;
}
returnpage = this.getBaseMapper().queryEventPageWeb(returnpage,csEventUserQueryPage,devIds);
returnpage.getRecords().forEach(temp->{
DevDetailDTO devDetail = csLedgerFeignClient.queryDevDetail(temp.getDeviceId()).getData();
temp.setEquipmentName(devDetail.getEquipmentName());
temp.setProjectId(devDetail.getProjectId());
temp.setProjectName(devDetail.getProjectName());
temp.setEngineeringid(devDetail.getEngineeringid());
temp.setEngineeringName(devDetail.getEngineeringName());
EleEpdPqd ele = epdFeignClient.findByName(temp.getTag()).getData();
temp.setShowName(ele.getShowName());
temp.setCode(ele.getDefaultValue());
if(Objects.equals(csEventUserQueryPage.getType(),"0")){
List<EleEvtParm> data1 = eleEvtFeignClient.queryByPid(ele.getId()).getData();
List<EventDataSetDTO> eventDataSetDTOS = new ArrayList<>();
for (EleEvtParm eleEvtParm : data1) {
EventDataSetDTO eventDataSetDTO = new EventDataSetDTO();
BeanUtils.copyProperties(eleEvtParm,eventDataSetDTO);
if (Objects.equals(eventDataSetDTO.getName(),"Evt_Param_Position")) {
continue;
// eventDataSetDTO.setValue(Objects.equals(temp.getLocation(),"grid")?"电网侧":"负载侧");
}
EventDataSetDTO evtData = evtDataService.getEventDataSet("evt_data", temp.getId(), eleEvtParm.getName());
if (evtData == null) {
eventDataSetDTO.setValue("-");
}else {
eventDataSetDTO.setValue(Optional.ofNullable(evtData.getValue()).orElse("-"));
}
// if (Objects.equals(eventDataSetDTO.getName(),"Evt_Param_Position")) {
// eventDataSetDTO.setValue(Objects.equals(temp.getLocation(),"grid")?"电网侧":"负载侧");
// }
eventDataSetDTOS.add(eventDataSetDTO);
}
temp.setDataSet(eventDataSetDTOS);
List<EventDataSetDTO> evtParamVVaDepth = eventDataSetDTOS.stream().
filter(dataSetDTO -> Objects.equals(dataSetDTO.getName(), "Evt_Param_VVaDepth")).
collect(Collectors.toList());
if(CollectionUtil.isEmpty(evtParamVVaDepth)){
temp.setEvtParamVVaDepth("-");
}else {
temp.setEvtParamVVaDepth(evtParamVVaDepth.get(0).getValue()+(Objects.isNull(evtParamVVaDepth.get(0).getUnit())?"":evtParamVVaDepth.get(0).getUnit()));
}
List<EventDataSetDTO> evtParamPosition = eventDataSetDTOS.stream().
filter(dataSetDTO -> Objects.equals(dataSetDTO.getName(), "Evt_Param_Position")).
collect(Collectors.toList());
if(CollectionUtil.isEmpty(evtParamPosition)){
temp.setEvtParamPosition("-");
}else {
//temp.setEvtParamPosition(evtParamPosition.get(0).getValue()+(Objects.isNull(evtParamPosition.get(0).getUnit())?"":evtParamPosition.get(0).getUnit()));
temp.setEvtParamPosition(evtParamPosition.get(0).getValue());
}
if (Objects.equals(temp.getEvtParamPosition(),"-")) {
if (!Objects.isNull(temp.getLocation())) {
temp.setEvtParamPosition(Objects.equals(temp.getLocation(),"grid")?"电网侧":"负载侧");
}
}
List<EventDataSetDTO> evtParamTm = eventDataSetDTOS.stream().
filter(dataSetDTO -> Objects.equals(dataSetDTO.getName(), "Evt_Param_Tm")).
collect(Collectors.toList());
if(CollectionUtil.isEmpty(evtParamTm)){
temp.setEvtParamTm("-");
}else {
temp.setEvtParamTm(evtParamTm.get(0).getValue()+(Objects.isNull(evtParamTm.get(0).getUnit())?"":evtParamTm.get(0).getUnit()));
}
List<EventDataSetDTO> evtParamPhase = eventDataSetDTOS.stream().
filter(dataSetDTO -> Objects.equals(dataSetDTO.getName(), "Evt_Param_Phase")).
collect(Collectors.toList());
if(CollectionUtil.isEmpty(evtParamPhase)){
temp.setEvtParamPhase("-");
}else {
temp.setEvtParamPhase(evtParamPhase.get(0).getValue()+(Objects.isNull(evtParamPhase.get(0).getUnit())?"":evtParamPhase.get(0).getUnit()));
}
}
});
return returnpage; return returnpage;
} }

View File

@@ -127,8 +127,11 @@ public class DeviceDataTrendServiceImpl implements DeviceDataTrendService {
//判断功率是否需要转换 //判断指标是否需要转换
public boolean changePower(String name) { public boolean changePower(String name) {
if(name.contains("相角")) {
return false;
}
return POWER_LIST.stream() return POWER_LIST.stream()
.anyMatch(name::contains); .anyMatch(name::contains);
} }

View File

@@ -15,7 +15,9 @@ import com.njcn.access.utils.MqttUtil;
import com.njcn.common.config.GeneralInfo; import com.njcn.common.config.GeneralInfo;
import com.njcn.common.pojo.exception.BusinessException; import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.csdevice.api.DeviceFtpFeignClient; import com.njcn.csdevice.api.DeviceFtpFeignClient;
import com.njcn.csdevice.api.EquipmentFeignClient;
import com.njcn.csdevice.api.PortableOffLogFeignClient; import com.njcn.csdevice.api.PortableOffLogFeignClient;
import com.njcn.csdevice.pojo.vo.CsEquipmentDeliveryVO;
import com.njcn.csharmonic.enums.CsHarmonicResponseEnum; import com.njcn.csharmonic.enums.CsHarmonicResponseEnum;
import com.njcn.csharmonic.offline.constant.OfflineConstant; import com.njcn.csharmonic.offline.constant.OfflineConstant;
import com.njcn.csharmonic.offline.log.Log; import com.njcn.csharmonic.offline.log.Log;
@@ -74,6 +76,7 @@ public class OfflineDataUploadServiceImpl implements OfflineDataUploadService {
private final FileStorageUtil fileStorageUtil; private final FileStorageUtil fileStorageUtil;
private final GeneralInfo generalInfo; private final GeneralInfo generalInfo;
private final PortableOffLogFeignClient portableOffLogFeignClient; private final PortableOffLogFeignClient portableOffLogFeignClient;
private final EquipmentFeignClient equipmentFeignClient;
@Override @Override
@@ -154,13 +157,13 @@ public class OfflineDataUploadServiceImpl implements OfflineDataUploadService {
BeanUtils.copyProperties(item,vo); BeanUtils.copyProperties(item,vo);
long startTime = item.getPrjTimeStart(); long startTime = item.getPrjTimeStart();
if (startTime != 0) { if (startTime != 0) {
LocalDateTime dateTime = Instant.ofEpochMilli(startTime*1000).atZone(ZoneId.systemDefault()).toLocalDateTime(); LocalDateTime dateTime = Instant.ofEpochMilli((startTime-8*3600)*1000).atZone(ZoneId.systemDefault()).toLocalDateTime();
String formattedDate = dateTime.format(formatter); String formattedDate = dateTime.format(formatter);
vo.setStartTime(formattedDate); vo.setStartTime(formattedDate);
} }
long endTime = item.getPrjTimeEnd(); long endTime = item.getPrjTimeEnd();
if (endTime != -1) { if (endTime != -1) {
LocalDateTime dateTime = Instant.ofEpochMilli(endTime*1000).atZone(ZoneId.systemDefault()).toLocalDateTime(); LocalDateTime dateTime = Instant.ofEpochMilli((endTime-8*3600)*1000).atZone(ZoneId.systemDefault()).toLocalDateTime();
String formattedDate = dateTime.format(formatter); String formattedDate = dateTime.format(formatter);
vo.setEndTime(formattedDate); vo.setEndTime(formattedDate);
} }
@@ -182,7 +185,7 @@ public class OfflineDataUploadServiceImpl implements OfflineDataUploadService {
if (Objects.equals("dir",fileType)) { if (Objects.equals("dir",fileType)) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
askProjectInfo(null,nDid, Integer.parseInt(TypeEnum.TYPE_8.getCode()),path,"DevFileCmd"); askProjectInfo(null,nDid, Integer.parseInt(TypeEnum.TYPE_8.getCode()),path,"DevFileCmd");
Thread.sleep(2000); Thread.sleep(5000);
String key = AppRedisKey.PROJECT_INFO + nDid; String key = AppRedisKey.PROJECT_INFO + nDid;
Object object = redisUtil.getObjectByKey(key); Object object = redisUtil.getObjectByKey(key);
if (!Objects.isNull(object)) { if (!Objects.isNull(object)) {
@@ -258,10 +261,15 @@ public class OfflineDataUploadServiceImpl implements OfflineDataUploadService {
} }
} }
if (CollectionUtil.isNotEmpty(fileList)) { if (CollectionUtil.isNotEmpty(fileList)) {
//添加record.bin文件
fileList.add(s + "/record.bin");
map.put(s,fileList); map.put(s,fileList);
} }
} }
if (CollectionUtil.isNotEmpty(map)) { if (CollectionUtil.isNotEmpty(map)) {
List<String> keyList = new ArrayList<>();
//获取装置信息
CsEquipmentDeliveryVO vo = equipmentFeignClient.queryEquipmentByndid(param.getNDid()).getData();
map.forEach((k,v)->{ map.forEach((k,v)->{
String proName = k.replace("/bd0/cmn/",OssPath.DEV_MAKE_UP_PATH + param.getNDid() + "/"); String proName = k.replace("/bd0/cmn/",OssPath.DEV_MAKE_UP_PATH + param.getNDid() + "/");
String key = AppRedisKey.PROJECT_INFO + param.getNDid(); String key = AppRedisKey.PROJECT_INFO + param.getNDid();
@@ -273,7 +281,7 @@ public class OfflineDataUploadServiceImpl implements OfflineDataUploadService {
} }
askFileInfo(param.getNDid(),mid,item); askFileInfo(param.getNDid(),mid,item);
try { try {
Thread.sleep(5000); Thread.sleep(10000);
FileDto.FileInfo info = channelObjectUtil.objectToSingleObject(redisUtil.getObjectByKey(key),FileDto.FileInfo.class); FileDto.FileInfo info = channelObjectUtil.objectToSingleObject(redisUtil.getObjectByKey(key),FileDto.FileInfo.class);
String path = deviceFtpFeignClient.downloadFile(param.getNDid(),item,info.getFileSize(),info.getFileCheck()).getData(); String path = deviceFtpFeignClient.downloadFile(param.getNDid(),item,info.getFileSize(),info.getFileCheck()).getData();
String lsFile = generalInfo.getBusinessTempPath() + File.separator + item.split(StrUtil.SLASH)[item.split(StrUtil.SLASH).length - 1]; String lsFile = generalInfo.getBusinessTempPath() + File.separator + item.split(StrUtil.SLASH)[item.split(StrUtil.SLASH).length - 1];
@@ -285,12 +293,17 @@ public class OfflineDataUploadServiceImpl implements OfflineDataUploadService {
} }
//删除下载文件 //删除下载文件
fileStorageUtil.deleteFile(path); fileStorageUtil.deleteFile(path);
//存储下载
keyList.add(item);
//推送下载进度
String json = "{allStep:" + fileList.size() * 2 + ",nowStep:" + keyList.size() + "}";
publisher.send("/dataOnlineRecruitment/Progress/" + param.getLineId(), new Gson().toJson(json), 1, false);
} catch (Exception e) { } catch (Exception e) {
throw new BusinessException(CsHarmonicResponseEnum.MAKE_UP_ERROR); throw new BusinessException(CsHarmonicResponseEnum.MAKE_UP_ERROR);
} }
}); });
//下载完成,调用解析接口 //下载完成,调用解析接口
portableOffLogFeignClient.dataOnlineRecruitment(param.getNDid(),param.getLineId(),proName); portableOffLogFeignClient.dataOnlineRecruitment(vo.getId(),param.getLineId(),proName);
}); });
} }
} }

View File

@@ -0,0 +1,83 @@
package com.njcn.csharmonic.service.impl;
import com.njcn.access.api.AskDeviceDataFeignClient;
import com.njcn.csdevice.api.CsLineFeignClient;
import com.njcn.csdevice.api.DataSetFeignClient;
import com.njcn.csdevice.pojo.po.CsDataSet;
import com.njcn.csdevice.pojo.po.CsLinePO;
import com.njcn.csharmonic.service.RealDataService;
import com.njcn.redis.utils.RedisUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.Objects;
/**
* @author xuyang
*/
@Service
@RequiredArgsConstructor
public class RealDataServiceImpl implements RealDataService {
private final CsLineFeignClient csLineFeignClient;
private final DataSetFeignClient dataSetFeignClient;
private final AskDeviceDataFeignClient askDeviceDataFeignClient;
private final RedisUtil redisUtil;
@Override
public boolean getBaseRealData(String lineId) {
boolean result = true;
try {
String nDid = lineId.substring(0, lineId.length() - 1);
Integer clDid = Integer.parseInt(lineId.substring(lineId.length() - 1));
//获取装置所用模板
CsLinePO po = csLineFeignClient.getById(lineId).getData();
String modelId = po.getDataModelId();
CsDataSet csDataSet = dataSetFeignClient.getBaseDataSet(modelId,clDid).getData();
askDeviceDataFeignClient.askRealData(nDid,csDataSet.getIdx(),clDid);
//等待装置响应,获取询问结果
Thread.sleep(2000);
Object object = redisUtil.getObjectByKey("devResponse");
if (Objects.isNull(object)) {
result = false;
} else {
int code = (Integer) object;
if (code != 200) {
result = false;
}
}
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
return result;
}
@Override
public boolean getHarmRealData(String lineId, Integer target) {
boolean result = true;
try {
String nDid = lineId.substring(0, lineId.length() - 1);
Integer clDid = Integer.parseInt(lineId.substring(lineId.length() - 1));
//获取装置所用模板
CsLinePO po = csLineFeignClient.getById(lineId).getData();
String modelId = po.getDataModelId();
//根据指标来获取不同的数据集
CsDataSet csDataSet = dataSetFeignClient.getHarmonicDataSet(modelId,clDid,target).getData();
askDeviceDataFeignClient.askRealData(nDid,csDataSet.getIdx(),clDid);
//等待装置响应,获取询问结果
Thread.sleep(2000);
Object object = redisUtil.getObjectByKey("devResponse");
if (Objects.isNull(object)) {
result = false;
} else {
int code = (Integer) object;
if (code != 200) {
result = false;
}
}
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
return result;
}
}

View File

@@ -32,6 +32,7 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.lang.reflect.Field; import java.lang.reflect.Field;
@@ -71,10 +72,12 @@ public class TestController {
@OperateInfo(info = LogEnum.BUSINESS_COMMON) @OperateInfo(info = LogEnum.BUSINESS_COMMON)
@GetMapping("/test") @GetMapping("/test")
@ApiOperation("报表测试") @ApiOperation("报表测试")
public HttpResult<Integer> queryEvent() throws ClassNotFoundException { public HttpResult<Integer> test(@RequestParam("dateTime") String dateTime) throws ClassNotFoundException {
DateTimeFormatter formatter1 = DateTimeFormatter.ISO_DATE;
// 获取当前日期 // 获取当前日期
LocalDate today = LocalDate.now().minusDays(3); LocalDate today = LocalDate.parse(dateTime, formatter1);
// 计算前一天的日期 // 计算前一天的日期
LocalDate yesterday = today.minusDays(1); LocalDate yesterday = today.minusDays(1);
// 获取前一天的开始时间00:00:00 // 获取前一天的开始时间00:00:00
@@ -122,7 +125,9 @@ public class TestController {
collect.forEach((tempPhase,byNameMap)->{ collect.forEach((tempPhase,byNameMap)->{
//最小值 //最小值
InfluxQueryWrapper influxQueryWrapperMin = new InfluxQueryWrapper(PqdData.class, clazz); InfluxQueryWrapper influxQueryWrapperMin = new InfluxQueryWrapper(PqdData.class, clazz);
influxQueryWrapperMin.regular(PqdData::getLineId, lineIndex).eq(InfluxDBTableConstant.VALUE_TYPE, "min").eq(InfluxDBTableConstant.PHASIC_TYPE,tempPhase).eq(InfluxDBTableConstant.IS_ABNORMAL, 0); influxQueryWrapperMin.regular(PqdData::getLineId, lineIndex).eq(InfluxDBTableConstant.VALUE_TYPE, "min")
.eq(InfluxDBTableConstant.PHASIC_TYPE,tempPhase);
// .eq(InfluxDBTableConstant.IS_ABNORMAL, 0);
byNameMap.forEach((name, eleEpdPqdList) -> { byNameMap.forEach((name, eleEpdPqdList) -> {
@@ -151,7 +156,9 @@ public class TestController {
//最大值 //最大值
InfluxQueryWrapper influxQueryWrapperMax = new InfluxQueryWrapper(PqdData.class, clazz); InfluxQueryWrapper influxQueryWrapperMax = new InfluxQueryWrapper(PqdData.class, clazz);
influxQueryWrapperMax.regular(PqdData::getLineId, lineIndex).eq(InfluxDBTableConstant.VALUE_TYPE, "max").eq(InfluxDBTableConstant.PHASIC_TYPE,tempPhase).eq(InfluxDBTableConstant.IS_ABNORMAL, 0); influxQueryWrapperMax.regular(PqdData::getLineId, lineIndex).eq(InfluxDBTableConstant.VALUE_TYPE, "max")
.eq(InfluxDBTableConstant.PHASIC_TYPE,tempPhase);
// .eq(InfluxDBTableConstant.IS_ABNORMAL, 0);
byNameMap.forEach((name, eleEpdPqdList) -> { byNameMap.forEach((name, eleEpdPqdList) -> {
@@ -163,10 +170,10 @@ public class TestController {
tempEleEpdPqd.setHarmEnd(tempEleEpdPqd.getHarmEnd()+1); tempEleEpdPqd.setHarmEnd(tempEleEpdPqd.getHarmEnd()+1);
} }
for (int i = tempEleEpdPqd.getHarmStart(); i < tempEleEpdPqd.getHarmEnd() + 1; i++) { for (int i = tempEleEpdPqd.getHarmStart(); i < tempEleEpdPqd.getHarmEnd() + 1; i++) {
influxQueryWrapperMax.min(tempEleEpdPqd.getName() + "_" + i, tempEleEpdPqd.getOtherName() + "_" + i); influxQueryWrapperMax.max(tempEleEpdPqd.getName() + "_" + i, tempEleEpdPqd.getOtherName() + "_" + i);
} }
} else { } else {
influxQueryWrapperMax.min(tempEleEpdPqd.getName(), tempEleEpdPqd.getOtherName()); influxQueryWrapperMax.max(tempEleEpdPqd.getName(), tempEleEpdPqd.getOtherName());
} }
}); });
@@ -179,7 +186,9 @@ public class TestController {
//平均值 //平均值
InfluxQueryWrapper influxQueryWrapperAvg = new InfluxQueryWrapper(PqdData.class, clazz); InfluxQueryWrapper influxQueryWrapperAvg = new InfluxQueryWrapper(PqdData.class, clazz);
influxQueryWrapperAvg.regular(PqdData::getLineId, lineIndex).eq(InfluxDBTableConstant.VALUE_TYPE, "avg").eq(InfluxDBTableConstant.PHASIC_TYPE,tempPhase).eq(InfluxDBTableConstant.IS_ABNORMAL, 0); influxQueryWrapperAvg.regular(PqdData::getLineId, lineIndex).eq(InfluxDBTableConstant.VALUE_TYPE, "avg")
.eq(InfluxDBTableConstant.PHASIC_TYPE,tempPhase);
// .eq(InfluxDBTableConstant.IS_ABNORMAL, 0);
byNameMap.forEach((name, eleEpdPqdList) -> { byNameMap.forEach((name, eleEpdPqdList) -> {
EleEpdPqd tempEleEpdPqd = eleEpdPqdList.get(0); EleEpdPqd tempEleEpdPqd = eleEpdPqdList.get(0);
@@ -207,7 +216,9 @@ public class TestController {
//CP95 //CP95
InfluxQueryWrapper influxQueryWrapperCp95 = new InfluxQueryWrapper(PqdData.class, clazz); InfluxQueryWrapper influxQueryWrapperCp95 = new InfluxQueryWrapper(PqdData.class, clazz);
influxQueryWrapperCp95.regular(PqdData::getLineId, lineIndex).eq(InfluxDBTableConstant.VALUE_TYPE, "avg").eq(InfluxDBTableConstant.PHASIC_TYPE,tempPhase).eq(InfluxDBTableConstant.IS_ABNORMAL, 0); influxQueryWrapperCp95.regular(PqdData::getLineId, lineIndex).eq(InfluxDBTableConstant.VALUE_TYPE, "avg")
.eq(InfluxDBTableConstant.PHASIC_TYPE,tempPhase);
// .eq(InfluxDBTableConstant.IS_ABNORMAL, 0);
byNameMap.forEach((name, eleEpdPqdList) -> { byNameMap.forEach((name, eleEpdPqdList) -> {
EleEpdPqd tempEleEpdPqd = eleEpdPqdList.get(0); EleEpdPqd tempEleEpdPqd = eleEpdPqdList.get(0);
@@ -221,7 +232,7 @@ public class TestController {
influxQueryWrapperCp95.percentile(tempEleEpdPqd.getName() + "_" + i, tempEleEpdPqd.getOtherName() + "_" + i, 95); influxQueryWrapperCp95.percentile(tempEleEpdPqd.getName() + "_" + i, tempEleEpdPqd.getOtherName() + "_" + i, 95);
} }
} else { } else {
influxQueryWrapperCp95.mean(tempEleEpdPqd.getName(), tempEleEpdPqd.getOtherName()); influxQueryWrapperCp95.percentile(tempEleEpdPqd.getName(), tempEleEpdPqd.getOtherName(),95);
} }
}); });

View File

@@ -162,10 +162,10 @@ public class ReportCovertJob {
tempEleEpdPqd.setHarmEnd(tempEleEpdPqd.getHarmEnd()+1); tempEleEpdPqd.setHarmEnd(tempEleEpdPqd.getHarmEnd()+1);
} }
for (int i = tempEleEpdPqd.getHarmStart(); i < tempEleEpdPqd.getHarmEnd() + 1; i++) { for (int i = tempEleEpdPqd.getHarmStart(); i < tempEleEpdPqd.getHarmEnd() + 1; i++) {
influxQueryWrapperMax.min(tempEleEpdPqd.getName() + "_" + i, tempEleEpdPqd.getOtherName() + "_" + i); influxQueryWrapperMax.max(tempEleEpdPqd.getName() + "_" + i, tempEleEpdPqd.getOtherName() + "_" + i);
} }
} else { } else {
influxQueryWrapperMax.min(tempEleEpdPqd.getName(), tempEleEpdPqd.getOtherName()); influxQueryWrapperMax.max(tempEleEpdPqd.getName(), tempEleEpdPqd.getOtherName());
} }
}); });
@@ -220,7 +220,7 @@ public class ReportCovertJob {
influxQueryWrapperCp95.percentile(tempEleEpdPqd.getName() + "_" + i, tempEleEpdPqd.getOtherName() + "_" + i, 95); influxQueryWrapperCp95.percentile(tempEleEpdPqd.getName() + "_" + i, tempEleEpdPqd.getOtherName() + "_" + i, 95);
} }
} else { } else {
influxQueryWrapperCp95.mean(tempEleEpdPqd.getName(), tempEleEpdPqd.getOtherName()); influxQueryWrapperCp95.percentile(tempEleEpdPqd.getName(), tempEleEpdPqd.getOtherName(),95);
} }
}); });

View File

@@ -5,6 +5,7 @@ import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients; import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.DependsOn;
/** /**
@@ -16,6 +17,7 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
@MapperScan("com.njcn.**.mapper") @MapperScan("com.njcn.**.mapper")
@EnableFeignClients(basePackages = "com.njcn") @EnableFeignClients(basePackages = "com.njcn")
@SpringBootApplication(scanBasePackages = "com.njcn") @SpringBootApplication(scanBasePackages = "com.njcn")
@DependsOn("proxyMapperRegister")
public class CsSystemBootApplication { public class CsSystemBootApplication {
public static void main(String[] args) { public static void main(String[] args) {