Compare commits
42 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ce861e1804 | ||
| 35d44dcc08 | |||
| c3d87eca34 | |||
| 86c6c95777 | |||
| f9d696faad | |||
| c325301a8f | |||
|
|
014370062a | ||
|
|
ada65fd40d | ||
|
|
a940d3961a | ||
|
|
4b7a60190c | ||
| c0be7629dd | |||
|
|
5f82f65b8f | ||
| 4e0b4b6b90 | |||
|
|
ca9193b861 | ||
|
|
469a4ba63e | ||
|
|
4316e72521 | ||
|
|
f942be74f1 | ||
| b750064b16 | |||
| b7c9cd2ee0 | |||
|
|
6cca1cc74d | ||
|
|
a83ab8b141 | ||
|
|
edc2453da2 | ||
| cbc301da5f | |||
| 4142de1fcf | |||
| 78b9a98ab8 | |||
|
|
5169669b2b | ||
|
|
10e0e96b65 | ||
| cd35e67007 | |||
| eb7a1d9beb | |||
|
|
3059f5ac75 | ||
|
|
346afef6d0 | ||
|
|
2cf47ec3b3 | ||
| 83199f07b6 | |||
|
|
8295801f16 | ||
| 306b426573 | |||
|
|
3a60a05ea2 | ||
| 86108004d5 | |||
| 5ef232a485 | |||
| 05112b5262 | |||
|
|
2ca4ee702b | ||
| c95c1271c2 | |||
|
|
105a5314cb |
@@ -112,7 +112,7 @@
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>pqs-influx</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.njcn.csdevice.api.fallback.CsLineClientFallbackFactory;
|
||||
import com.njcn.csdevice.pojo.param.CsLineParam;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
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.RequestBody;
|
||||
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")
|
||||
public interface CsLineFeignClient {
|
||||
|
||||
|
||||
@PostMapping("/queryLineById")
|
||||
HttpResult<List<CsLinePO>> queryLineById(@RequestParam("ids") List<String> ids );
|
||||
|
||||
@@ -36,4 +36,10 @@ public interface CsLineFeignClient {
|
||||
|
||||
@PostMapping("/updateLine")
|
||||
HttpResult<String> updateLine(@RequestBody CsLineParam csLineParam);
|
||||
|
||||
@PostMapping("/updateIds")
|
||||
HttpResult<Boolean> updateIds(@RequestBody @Validated CsLineParam csLineParam);
|
||||
|
||||
@PostMapping("/getById")
|
||||
HttpResult<CsLinePO> getById(@RequestParam("lineId") String lineId);
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.csdevice.api.fallback.DataArrayFeignClientFallbackFactory;
|
||||
import com.njcn.csdevice.pojo.param.DataArrayParam;
|
||||
import com.njcn.csdevice.pojo.po.CsDataArray;
|
||||
import com.njcn.csdevice.pojo.po.CsDataSet;
|
||||
import com.njcn.csdevice.pojo.vo.DataArrayTreeVO;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
@@ -22,13 +21,14 @@ import java.util.List;
|
||||
public interface DataArrayFeignClient {
|
||||
|
||||
@PostMapping("/getArrayBySet")
|
||||
HttpResult<List<CsDataArray>> getArrayBySet(@RequestBody List<CsDataSet> setList);
|
||||
HttpResult<List<CsDataArray>> getArrayBySet(@RequestParam("dataSet") String dataSet);
|
||||
|
||||
@PostMapping("/getDataArray")
|
||||
HttpResult<List<DataArrayTreeVO>> getDataArray(@RequestBody List<String> dataSetList);
|
||||
|
||||
@PostMapping("/getDataArrayById")
|
||||
HttpResult<List<CsDataArray>> getDataArrayById(@RequestParam("pid") String pid, @RequestParam("name") String name);
|
||||
|
||||
@PostMapping("/getDataArrayByIds")
|
||||
HttpResult<List<CsDataArray>> getDataArrayByIds(@RequestParam("ids") List<String> ids);
|
||||
|
||||
|
||||
@@ -1,10 +1,17 @@
|
||||
package com.njcn.csdevice.api;
|
||||
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.csdevice.api.fallback.DataSetFeignClientFallbackFactory;
|
||||
import com.njcn.csdevice.pojo.po.CsDataSet;
|
||||
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.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
@@ -31,5 +38,13 @@ public interface DataSetFeignClient {
|
||||
@PostMapping("/getDataSetBySetIds")
|
||||
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);
|
||||
|
||||
}
|
||||
|
||||
@@ -58,4 +58,7 @@ public interface EquipmentFeignClient {
|
||||
|
||||
@PostMapping("/getAll")
|
||||
HttpResult<List<CsEquipmentDeliveryPO>> getAll();
|
||||
|
||||
@PostMapping("/judgeDevModel")
|
||||
HttpResult<Boolean> judgeDevModel(@RequestParam("nDid") String nDid);
|
||||
}
|
||||
|
||||
@@ -7,8 +7,10 @@ import com.njcn.csdevice.pojo.param.WlRecordParam;
|
||||
import com.njcn.csdevice.pojo.po.WlRecord;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -41,4 +43,8 @@ public interface WlRecordFeignClient {
|
||||
|
||||
@PostMapping("/updateTestRecord")
|
||||
HttpResult<Boolean> updateTestRecord(@RequestBody @Validated WlRecordParam.UpdateRecord record);
|
||||
|
||||
|
||||
@GetMapping("/dayDealNoEndTimeEvent")
|
||||
void dayDealNoEndTimeEvent(@RequestParam("date") String date);
|
||||
}
|
||||
|
||||
@@ -28,7 +28,6 @@ public class CsLineClientFallbackFactory implements FallbackFactory<CsLineFeignC
|
||||
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||
return new CsLineFeignClient() {
|
||||
|
||||
|
||||
@Override
|
||||
public HttpResult<List<CsLinePO>> queryLineById(List<String> ids) {
|
||||
log.error("{}异常,降级处理,异常为:{}","查询监测点详情异常",cause.toString());
|
||||
@@ -63,6 +62,18 @@ public class CsLineClientFallbackFactory implements FallbackFactory<CsLineFeignC
|
||||
log.error("{}异常,降级处理,异常为:{}","更新监测点信息",cause.toString());
|
||||
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);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.csdevice.api.DataArrayFeignClient;
|
||||
import com.njcn.csdevice.pojo.param.DataArrayParam;
|
||||
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.utils.CsDeviceEnumUtil;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
@@ -36,7 +35,7 @@ public class DataArrayFeignClientFallbackFactory implements FallbackFactory<Data
|
||||
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||
return new DataArrayFeignClient() {
|
||||
@Override
|
||||
public HttpResult<List<CsDataArray>> getArrayBySet(List<CsDataSet> setList) {
|
||||
public HttpResult<List<CsDataArray>> getArrayBySet(String dataSet) {
|
||||
log.error("{}异常,降级处理,异常为:{}","根据数据集获取详细数据失败",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@@ -56,6 +56,24 @@ public class DataSetFeignClientFallbackFactory implements FallbackFactory<DataSe
|
||||
log.error("{}异常,降级处理,异常为:{}","根据数据集ids获取数据集",cause.toString());
|
||||
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);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,6 +77,12 @@ public class EquipmentFeignClientFallbackFactory implements FallbackFactory<Equi
|
||||
log.error("{}异常,降级处理,异常为:{}","获取所有装置",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<Boolean> judgeDevModel(String nDid) {
|
||||
log.error("{}异常,降级处理,异常为:{}","判断设备型号",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,6 +51,12 @@ public class WlRecordClientFallbackFactory implements FallbackFactory<WlRecordFe
|
||||
log.error("{}异常,降级处理,异常为:{}","修改测试项",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dayDealNoEndTimeEvent(String date) {
|
||||
log.error("{}异常,降级处理,异常为:{}","每日处理没有结束时间的测试基础数据",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,8 +48,16 @@ public interface DataParam {
|
||||
|
||||
String portableDev = "便携式设备";
|
||||
|
||||
String PORTABLE_SYSTEM = "便携式系统";
|
||||
|
||||
String WIRELESS_PROJECT = "无线项目";
|
||||
|
||||
String WIRELESS_PROJECT_ID = "WIRELESS_PROJECT_ID";
|
||||
|
||||
String governmentDev = "治理设备";
|
||||
|
||||
String GOVERNANCE_SYSTEM = "治理系统";
|
||||
|
||||
String EvtParamPhase = "Evt_Param_Phase";
|
||||
|
||||
String EvtParamDepth = "Evt_Param_VVaDepth";
|
||||
|
||||
@@ -47,6 +47,7 @@ public enum AlgorithmResponseEnum {
|
||||
FILE_BUSY("A00516","正在进行其他文件操作,请稍后重试"),
|
||||
RECORD_FILE_LOST("A00516","record.bin文件缺失,请检查上传文件夹"),
|
||||
LINE_NUM_MISMATCH("A00516","上传文件的监测点序号和选择的监测点不匹配,请检查"),
|
||||
DEV_OFFLINE("A00516","装置未连接MQTT服务器"),
|
||||
;
|
||||
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,9 +1,12 @@
|
||||
package com.njcn.csdevice.pojo.param;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -36,8 +39,9 @@ public class CsDevModelAddParm {
|
||||
/**
|
||||
* 版本日期
|
||||
*/
|
||||
@ApiModelProperty(value = "版本日期")
|
||||
private String time;
|
||||
@TableField(value = "version_date")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
|
||||
private Date versionDate;
|
||||
|
||||
/**
|
||||
* 装置模板文件路径
|
||||
|
||||
@@ -38,4 +38,14 @@ public class CsLineParam extends BaseEntity {
|
||||
*/
|
||||
private Integer conType;
|
||||
|
||||
/**
|
||||
* 模板id
|
||||
*/
|
||||
private String modelId;
|
||||
|
||||
/**
|
||||
* 数据集id
|
||||
*/
|
||||
private String dataSetId;
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.njcn.csdevice.pojo.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.njcn.db.bo.BaseEntity;
|
||||
import lombok.Getter;
|
||||
@@ -21,6 +22,8 @@ public class PortableOfflLog extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String logsIndex;
|
||||
@TableField( value = "log_main_id")
|
||||
private String logMainId;
|
||||
|
||||
/**
|
||||
* 文件名称
|
||||
@@ -38,7 +41,7 @@ public class PortableOfflLog extends BaseEntity {
|
||||
private String dataPath;
|
||||
|
||||
/**
|
||||
* 0-未解析 1-解析成功 2-解析失败 3-文件不存在
|
||||
* 0-无需解析解析 1-解析成功 2-解析失败 3-文件不存在
|
||||
*/
|
||||
private Integer state;
|
||||
|
||||
|
||||
@@ -45,6 +45,9 @@ public class CsLedgerVO implements Serializable {
|
||||
@ApiModelProperty(name = "nDid",value = "nDid")
|
||||
private String nDId;
|
||||
|
||||
@ApiModelProperty(name = "type",value = "类型 项目 工程 装置 监测点")
|
||||
private String type;
|
||||
|
||||
@ApiModelProperty(name = "children",value = "子节点")
|
||||
private List<CsLedgerVO> children = new ArrayList<>();
|
||||
|
||||
|
||||
@@ -53,4 +53,7 @@ public class DataGroupEventVO {
|
||||
@ApiModelProperty("暂降幅值")
|
||||
private Float featureAmplitude;
|
||||
|
||||
@ApiModelProperty("波形路径")
|
||||
private String wavePath;
|
||||
|
||||
}
|
||||
|
||||
@@ -66,6 +66,9 @@ public class RecordVo {
|
||||
@ApiModelProperty("电压接线方式")
|
||||
private String volConType;
|
||||
|
||||
@ApiModelProperty("基础数据集合ID")
|
||||
private List<String> list;
|
||||
|
||||
@Data
|
||||
public static class RecordItemVo{
|
||||
|
||||
|
||||
@@ -83,5 +83,45 @@ public class CsDataSetController extends BaseController {
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -56,9 +56,10 @@ public class CsLogController extends BaseController {
|
||||
@ApiOperation("查询日志")
|
||||
@ApiImplicitParam(name = "baseParam", value = "查询日志参数", required = true)
|
||||
public HttpResult<IPage<CsLogsPO>> queryLog(@RequestBody BaseParam baseParam){
|
||||
IPage<CsLogsPO> list = csLogsPOService.queryPage(baseParam);
|
||||
String methodDescribe = getMethodDescribe("queryLog");
|
||||
|
||||
IPage<CsLogsPO> list = csLogsPOService.queryPage(baseParam);
|
||||
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.njcn.csdevice.controller.equipment;
|
||||
|
||||
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.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
@@ -38,6 +39,7 @@ public class DeviceFtpController extends BaseController {
|
||||
|
||||
private final DeviceFtpService deviceFtpService;
|
||||
private final RedisUtil redisUtil;
|
||||
private final MqttPublisher publisher;
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@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){
|
||||
String methodDescribe = getMethodDescribe("downloadFile");
|
||||
String result = deviceFtpService.downloadFile(nDid,name,size,fileCheck);
|
||||
redisUtil.delete("downloadFilePath:"+name);
|
||||
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);
|
||||
}
|
||||
deviceFtpService.downloadFile(nDid,name,size,fileCheck);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, "文件下载中,请稍等");
|
||||
}
|
||||
|
||||
@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)
|
||||
|
||||
@@ -306,4 +306,13 @@ public class EquipmentDeliveryController extends BaseController {
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -9,10 +9,12 @@ import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.csdevice.pojo.param.WlRecordTemplete;
|
||||
import com.njcn.csdevice.pojo.po.PortableOffMainLog;
|
||||
import com.njcn.csdevice.pojo.po.PortableOfflLog;
|
||||
import com.njcn.csdevice.service.IPortableOfflLogService;
|
||||
import com.njcn.csdevice.utils.ExcelStyleUtil;
|
||||
import com.njcn.csdevice.param.UploadDataParam;
|
||||
import com.njcn.minioss.config.MinIossProperties;
|
||||
import com.njcn.oss.utils.FileStorageUtil;
|
||||
import com.njcn.poi.excel.ExcelUtil;
|
||||
import com.njcn.poi.util.PoiUtil;
|
||||
@@ -55,7 +57,7 @@ public class PortableOfflLogController extends BaseController {
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
|
||||
private final FileStorageUtil fileStorageUtil;
|
||||
|
||||
private final MinIossProperties minIossProperties;
|
||||
@ResponseBody
|
||||
@ApiOperation("导出设备基础数据模板")
|
||||
@GetMapping(value = "getExcelTemplate")
|
||||
@@ -80,6 +82,15 @@ public class PortableOfflLogController extends BaseController {
|
||||
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)
|
||||
@ApiOperation("离线数据导入")
|
||||
@PostMapping(value = "importEquipment")
|
||||
@@ -110,7 +121,7 @@ public class PortableOfflLogController extends BaseController {
|
||||
|
||||
List<MultipartFile> excelreport = null;
|
||||
try {
|
||||
excelreport = fileStorageUtil.getAllFile("excelreport", path);
|
||||
excelreport = fileStorageUtil.getAllFile(minIossProperties.getBucket(), path);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
@@ -67,6 +67,15 @@ public class CsLedgerController extends BaseController {
|
||||
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)
|
||||
@PostMapping("/add")
|
||||
@ApiOperation("新增台账信息")
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
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.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.csdevice.mapper.CsLinePOMapper;
|
||||
import com.njcn.csdevice.mapper.OverlimitMapper;
|
||||
import com.njcn.csdevice.pojo.param.CsLineParam;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
@@ -41,6 +43,7 @@ public class CslineController extends BaseController {
|
||||
private final CsLinePOService csLinePOService;
|
||||
|
||||
private final OverlimitMapper overlimitMapper;
|
||||
private final CsLinePOMapper csLinePOMapper;
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/queryLineById")
|
||||
@@ -121,4 +124,38 @@ public class CslineController extends BaseController {
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -203,9 +203,9 @@ public class WlRecordController extends BaseController {
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||
@PostMapping("/dayDealNoEndTimeEvent")
|
||||
@ApiOperation("每日处理没有结束时间的测试基础数据")
|
||||
public void dayDealNoEndTimeEvent() {
|
||||
public void dayDealNoEndTimeEvent(@RequestParam("date") String date) {
|
||||
String methodDescribe = getMethodDescribe("dayDealNoEndTimeEvent");
|
||||
wlRecordService.dayDealNoEndTimeEvent();
|
||||
wlRecordService.dayDealNoEndTimeEvent(date);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,8 +1,10 @@
|
||||
package com.njcn.csdevice.mapper;
|
||||
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
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
|
||||
* @since 2022-01-04
|
||||
*/
|
||||
@DS("sjzx")
|
||||
@Mapper
|
||||
public interface OverlimitMapper extends BaseMapper<Overlimit> {
|
||||
|
||||
}
|
||||
|
||||
@@ -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> {
|
||||
}
|
||||
@@ -105,6 +105,7 @@
|
||||
t0.ndid = #{param.id}
|
||||
and t1.did = #{param.did}
|
||||
and t3.cl_dev = #{param.cldId}
|
||||
and (t3.data_type = 'Stat' or t3.data_type is NULL)
|
||||
and t4.stat_method = #{param.statMethod}
|
||||
order by t4.sort
|
||||
</select>
|
||||
|
||||
@@ -12,7 +12,9 @@
|
||||
from
|
||||
cs_data_set
|
||||
where
|
||||
pid = #{modelId} and cl_dev = #{clDev}
|
||||
pid = #{modelId}
|
||||
and cl_dev = #{clDev}
|
||||
and data_type in ('Stat',NULL)
|
||||
order by type,cl_dev
|
||||
</select>
|
||||
|
||||
|
||||
@@ -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>
|
||||
@@ -64,6 +64,7 @@
|
||||
</if>
|
||||
exists
|
||||
(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 id="getAll" resultType="com.njcn.csdevice.pojo.vo.CsLedgerVO">
|
||||
|
||||
@@ -20,6 +20,12 @@ import com.njcn.csdevice.pojo.vo.CsDevModelPageVO;
|
||||
*/
|
||||
public interface CsDevModelService extends IService<CsDevModelPO>{
|
||||
|
||||
/**
|
||||
* 初始化缓存模板信息
|
||||
* 想缓存模板,发现数据量太大,先按照之前的逻辑处理
|
||||
*/
|
||||
void refreshDevModelCache();
|
||||
|
||||
/**
|
||||
* @Description: addDevModel
|
||||
* @Param: [csDevModelAddParm]
|
||||
|
||||
@@ -27,6 +27,11 @@ import java.util.List;
|
||||
*/
|
||||
public interface CsEquipmentDeliveryService extends IService<CsEquipmentDeliveryPO>{
|
||||
|
||||
/**
|
||||
* 初始化缓存设备池
|
||||
*/
|
||||
void refreshDeviceDataCache();
|
||||
|
||||
/**
|
||||
* @Description: save
|
||||
* @Param: [csEquipmentDeliveryAddParm]
|
||||
@@ -123,4 +128,9 @@ public interface CsEquipmentDeliveryService extends IService<CsEquipmentDelivery
|
||||
* @return
|
||||
*/
|
||||
List<CsEquipmentDeliveryPO> getAll();
|
||||
|
||||
/**
|
||||
* 判断设备型号
|
||||
*/
|
||||
boolean judgeDevModel(String nDid);
|
||||
}
|
||||
|
||||
@@ -40,4 +40,9 @@ public interface CsLinePOService extends IService<CsLinePO>{
|
||||
*/
|
||||
void updateLine(CsLineParam csLineParam);
|
||||
|
||||
/**
|
||||
* 修改监测点的数据集id和模板id
|
||||
* @param csLineParam
|
||||
*/
|
||||
void updateIds(CsLineParam csLineParam);
|
||||
}
|
||||
|
||||
@@ -10,7 +10,9 @@ public interface DeviceFtpService {
|
||||
|
||||
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);
|
||||
|
||||
|
||||
@@ -50,4 +50,9 @@ public interface ICsDataArrayService extends IService<CsDataArray> {
|
||||
* @return
|
||||
*/
|
||||
List<CsDataArray> findListByParam(DataArrayParam param);
|
||||
|
||||
/**
|
||||
* 根据数据集id获取指标数据
|
||||
*/
|
||||
List<CsDataArray> getDataArrayByDataSetIds(List<String> dataSetIds);
|
||||
}
|
||||
|
||||
@@ -52,4 +52,21 @@ public interface ICsDataSetService extends IService<CsDataSet> {
|
||||
* @return
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -74,4 +74,6 @@ public interface ICsLedgerService extends IService<CsLedger> {
|
||||
List<CsLedger> queryLine(LineParamDTO lineParamdto);
|
||||
|
||||
DevDetailDTO queryDevDetail(String devId);
|
||||
|
||||
List<CsLedgerVO> getztProjectTree();
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.njcn.csdevice.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
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.param.UploadDataParam;
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
@@ -19,4 +20,6 @@ public interface IPortableOfflLogService extends IService<PortableOfflLog> {
|
||||
Page<PortableOfflLog> queryPage(BaseParam baseParam);
|
||||
|
||||
void importEquipment(UploadDataParam uploadDataParam);
|
||||
|
||||
Page<PortableOffMainLog> queryMainLogPage(BaseParam baseParam);
|
||||
}
|
||||
|
||||
@@ -106,6 +106,6 @@ public interface IWlRecordService extends IService<WlRecord> {
|
||||
/**
|
||||
* 每日处理没有结束时间的测试基础数据
|
||||
*/
|
||||
void dayDealNoEndTimeEvent();
|
||||
void dayDealNoEndTimeEvent(String date);
|
||||
|
||||
}
|
||||
|
||||
@@ -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{
|
||||
|
||||
}
|
||||
@@ -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>{
|
||||
|
||||
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import com.njcn.csdevice.mapper.CsDataArrayMapper;
|
||||
import com.njcn.csdevice.pojo.dto.DataArrayDTO;
|
||||
import com.njcn.csdevice.pojo.param.DataArrayParam;
|
||||
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.DeviceManagerDetailVO;
|
||||
import com.njcn.csdevice.service.ICsDataArrayService;
|
||||
@@ -174,4 +175,11 @@ public class CsDataArrayServiceImpl extends ServiceImpl<CsDataArrayMapper, CsDat
|
||||
public List<CsDataArray> findListByParam(DataArrayParam param) {
|
||||
return this.baseMapper.findListByParam(param);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CsDataArray> getDataArrayByDataSetIds(List<String> dataSetIds) {
|
||||
return this.lambdaQuery()
|
||||
.in(CsDataArray::getPid,dataSetIds)
|
||||
.list();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.njcn.csdevice.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.csdevice.mapper.CsDataSetMapper;
|
||||
import com.njcn.csdevice.pojo.po.CsDataSet;
|
||||
@@ -9,6 +10,7 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -24,12 +26,22 @@ public class CsDataSetServiceImpl extends ServiceImpl<CsDataSetMapper, CsDataSet
|
||||
|
||||
@Override
|
||||
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
|
||||
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
|
||||
@@ -47,4 +59,46 @@ public class CsDataSetServiceImpl extends ServiceImpl<CsDataSetMapper, CsDataSet
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,22 +1,37 @@
|
||||
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.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
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.CsDevModelAuditParm;
|
||||
import com.njcn.csdevice.pojo.param.CsDevModelQueryListParm;
|
||||
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.vo.CsDevModelPageVO;
|
||||
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.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
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
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
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
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public CsDevModelPO addDevModel(CsDevModelAddParm csDevModelAddParm) {
|
||||
CsDevModelPO csDevModelPO = new CsDevModelPO ();
|
||||
BeanUtils.copyProperties (csDevModelAddParm, csDevModelPO);
|
||||
csDevModelPO.setStatus ("1");
|
||||
csDevModelPO.setVersionDate(Date.valueOf(csDevModelAddParm.getTime()));
|
||||
this.save (csDevModelPO);
|
||||
return csDevModelPO;
|
||||
}
|
||||
@@ -46,8 +122,7 @@ public class CsDevModelServiceImpl extends ServiceImpl<CsDevModelMapper, CsDevMo
|
||||
public Boolean AuditDevModel(CsDevModelAuditParm csDevModelAuditParm) {
|
||||
CsDevModelPO csDevModelPO = new CsDevModelPO ();
|
||||
BeanUtils.copyProperties (csDevModelAuditParm, csDevModelPO);
|
||||
boolean b = this.updateById (csDevModelPO);
|
||||
return b;
|
||||
return this.updateById (csDevModelPO);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -61,8 +136,7 @@ public class CsDevModelServiceImpl extends ServiceImpl<CsDevModelMapper, CsDevMo
|
||||
@Override
|
||||
public CsDevModelPageVO queryDevModelOne(CsDevModelQueryListParm csDevModelQueryListParm) {
|
||||
|
||||
CsDevModelPageVO result = this.getBaseMapper ().queryOne(csDevModelQueryListParm);
|
||||
return result;
|
||||
return this.getBaseMapper ().queryOne(csDevModelQueryListParm);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -39,6 +39,7 @@ import com.njcn.redis.utils.RedisUtil;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.api.DictTreeFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.system.enums.DicTreeEnum;
|
||||
import com.njcn.system.pojo.vo.DictTreeVO;
|
||||
import com.njcn.web.factory.PageFactory;
|
||||
import com.njcn.web.utils.RequestUtil;
|
||||
@@ -90,9 +91,18 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
private final RedisUtil redisUtil;
|
||||
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
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public Boolean save(CsEquipmentDeliveryAddParm csEquipmentDeliveryAddParm) {
|
||||
boolean result;
|
||||
CsEquipmentDeliveryPO po = this.queryEquipmentPOByndid (csEquipmentDeliveryAddParm.getNdid());
|
||||
if(!Objects.isNull (po)){
|
||||
throw new BusinessException (AlgorithmResponseEnum.NDID_ERROR);
|
||||
@@ -121,7 +131,11 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
csEquipmentProcess.setStatus (1);
|
||||
|
||||
csEquipmentProcessPOService.save(csEquipmentProcess);
|
||||
return this.save (csEquipmentDeliveryPo);
|
||||
result = this.save (csEquipmentDeliveryPo);
|
||||
if (result) {
|
||||
refreshDeviceDataCache();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -161,6 +175,9 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
|
||||
|
||||
csDevModelRelationService.lambdaUpdate().eq(CsDevModelRelationPO::getDevId,id).set(CsDevModelRelationPO::getStatus,0).update();
|
||||
if (update) {
|
||||
refreshDeviceDataCache();
|
||||
}
|
||||
return update;
|
||||
}
|
||||
|
||||
@@ -199,6 +216,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
|
||||
@Override
|
||||
public Boolean updateEquipmentDelivery(CsEquipmentDeliveryAuditParm csEquipmentDeliveryAuditParm) {
|
||||
boolean result;
|
||||
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getNdid,csEquipmentDeliveryAuditParm.getNdid())
|
||||
.in(CsEquipmentDeliveryPO::getStatus,Arrays.asList(1,2,3))
|
||||
@@ -210,14 +228,22 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
}
|
||||
CsEquipmentDeliveryPO csEquipmentDeliveryPo = new CsEquipmentDeliveryPO();
|
||||
BeanUtils.copyProperties (csEquipmentDeliveryAuditParm, csEquipmentDeliveryPo);
|
||||
return this.updateById (csEquipmentDeliveryPo);
|
||||
result = this.updateById(csEquipmentDeliveryPo);
|
||||
if (result) {
|
||||
refreshDeviceDataCache();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateStatusBynDid(String nDId,Integer status) {
|
||||
boolean result;
|
||||
LambdaUpdateWrapper<CsEquipmentDeliveryPO> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
||||
lambdaUpdateWrapper.set(CsEquipmentDeliveryPO::getStatus,status).eq(CsEquipmentDeliveryPO::getNdid,nDId);
|
||||
this.update(lambdaUpdateWrapper);
|
||||
result = this.update(lambdaUpdateWrapper);
|
||||
if (result) {
|
||||
refreshDeviceDataCache();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -363,7 +389,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
//趋势数据tab
|
||||
DeviceManagerVO.DataSetVO dataSetVo3 = new DeviceManagerVO.DataSetVO();
|
||||
dataSetVo3.setId(item.getId());
|
||||
dataSetVo3.setName("历史趋势数据");
|
||||
dataSetVo3.setName("历史趋势");
|
||||
dataSetVo3.setType("trenddata");
|
||||
dataSetList.add(dataSetVo3);
|
||||
//实时数据tab
|
||||
@@ -391,9 +417,13 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
|
||||
@Override
|
||||
public void updateSoftInfoBynDid(String nDid, String id, Integer module) {
|
||||
boolean result;
|
||||
LambdaUpdateWrapper<CsEquipmentDeliveryPO> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
||||
lambdaUpdateWrapper.set(CsEquipmentDeliveryPO::getSoftinfoId,id).set(CsEquipmentDeliveryPO::getModuleNumber,module).eq(CsEquipmentDeliveryPO::getNdid,nDid);
|
||||
this.update(lambdaUpdateWrapper);
|
||||
result = this.update(lambdaUpdateWrapper);
|
||||
if (result) {
|
||||
refreshDeviceDataCache();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -541,6 +571,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
appLineTopologyDiagramPOQueryWrapper.in("line_id",collect);
|
||||
appLineTopologyDiagramService.remove(appLineTopologyDiagramPOQueryWrapper);
|
||||
}
|
||||
refreshDeviceDataCache();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -585,20 +616,28 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
|
||||
@Override
|
||||
public void updateSoftInfo(String nDid, String id) {
|
||||
boolean result;
|
||||
LambdaUpdateWrapper<CsEquipmentDeliveryPO> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
||||
lambdaUpdateWrapper.eq(CsEquipmentDeliveryPO::getNdid,nDid)
|
||||
.ne(CsEquipmentDeliveryPO::getRunStatus,0)
|
||||
.set(CsEquipmentDeliveryPO::getSoftinfoId,id);
|
||||
this.update(lambdaUpdateWrapper);
|
||||
result = this.update(lambdaUpdateWrapper);
|
||||
if (result) {
|
||||
refreshDeviceDataCache();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateModuleNumber(String nDid, Integer number) {
|
||||
boolean result;
|
||||
LambdaUpdateWrapper<CsEquipmentDeliveryPO> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
||||
lambdaUpdateWrapper.eq(CsEquipmentDeliveryPO::getNdid,nDid)
|
||||
.ne(CsEquipmentDeliveryPO::getRunStatus,0)
|
||||
.set(CsEquipmentDeliveryPO::getModuleNumber,number);
|
||||
this.update(lambdaUpdateWrapper);
|
||||
result = this.update(lambdaUpdateWrapper);
|
||||
if (result) {
|
||||
refreshDeviceDataCache();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -608,9 +647,12 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
askDeviceDataFeignClient.rebootDevice(nDid);
|
||||
Thread.sleep(3000);
|
||||
String key = AppRedisKey.CONTROL + nDid;
|
||||
String value = redisUtil.getObjectByKey(key).toString();
|
||||
if (Objects.equals(value,"success")) {
|
||||
result = true;
|
||||
Object object = redisUtil.getObjectByKey(key);
|
||||
if (Objects.nonNull(object)) {
|
||||
String value = object.toString();
|
||||
if (Objects.equals(value,"success")) {
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
@@ -623,6 +665,19 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
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生成二维码
|
||||
* @param ndid
|
||||
|
||||
@@ -10,9 +10,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
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.utils.PubUtils;
|
||||
import com.njcn.csdevice.api.CsLineFeignClient;
|
||||
import com.njcn.csdevice.api.EquipmentFeignClient;
|
||||
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.DataGroupTemplateVO;
|
||||
import com.njcn.csdevice.pojo.vo.EnergyTemplateVO;
|
||||
import com.njcn.csdevice.service.CsDevModelRelationService;
|
||||
import com.njcn.csdevice.service.ICsDataArrayService;
|
||||
import com.njcn.csdevice.service.ICsGroupService;
|
||||
import com.njcn.csdevice.service.ICsLedgerService;
|
||||
import com.njcn.csdevice.util.InfluxDbParamUtil;
|
||||
import com.njcn.csdevice.utils.DataChangeUtil;
|
||||
import com.njcn.csharmonic.api.EventFeignClient;
|
||||
import com.njcn.csharmonic.constant.HarmonicConstant;
|
||||
import com.njcn.csharmonic.param.CommonStatisticalQueryParam;
|
||||
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.ThdDataVO;
|
||||
import com.njcn.device.biz.pojo.po.Overlimit;
|
||||
|
||||
import com.njcn.influx.pojo.bo.CommonQueryParam;
|
||||
import com.njcn.influx.pojo.dto.EventDataSetDTO;
|
||||
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.EleEpdPqdListVO;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -80,48 +78,24 @@ import java.util.stream.Stream;
|
||||
public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> implements ICsGroupService {
|
||||
|
||||
private final ICsDataArrayService csDataArrayService;
|
||||
|
||||
private final CsGroArrMapper csGroArrMapper;
|
||||
|
||||
private final CsGroupMapper csGroupMapper;
|
||||
|
||||
private final CsDataArrayMapper csDataArrayMapper;
|
||||
|
||||
private final CommonService commonService;
|
||||
|
||||
private final EpdFeignClient epdFeignClient;
|
||||
|
||||
private final CsLineFeignClient csLineFeignClient;
|
||||
|
||||
private final ICsLedgerService iCsLedgerService;
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
|
||||
private final EquipmentFeignClient equipmentFeignClient;
|
||||
|
||||
private final CsStatisticalSetFeignClient csStatisticalSetFeignClient;
|
||||
|
||||
private final EvtDataService evtDataService;
|
||||
|
||||
private final DecimalFormat df = new DecimalFormat("#0.00");
|
||||
|
||||
private final EleEvtFeignClient eleEvtFeignClient;
|
||||
|
||||
private final OverlimitMapper overlimitMapper;
|
||||
|
||||
private final CsDataSetMapper csDataSetMapper;
|
||||
|
||||
private final EventFeignClient eventFeignClient;
|
||||
|
||||
private final InfluxDbParamUtil influxDbParamUtil;
|
||||
|
||||
private final Set<String> POWER_LIST = new HashSet<>(Arrays.asList(
|
||||
"电网有功功率", "电网无功功率", "电网视在功率", "负载有功功率",
|
||||
"负载无功功率", "负载视在功率", "有功功率", "无功功率",
|
||||
"视在功率", "基波有功功率", "基波无功功率",
|
||||
"基波视在功率", "三相总有功功率", "三相总无功功率",
|
||||
"三相总视在功率"
|
||||
));
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public List<CsGroupVO> getGroupData(String dataSet) {
|
||||
@@ -176,13 +150,13 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
}else {
|
||||
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())));
|
||||
} else {
|
||||
vo.setDataValue(Double.valueOf(df.format(BigDecimal.valueOf(re).setScale(2, RoundingMode.HALF_UP).doubleValue())));
|
||||
}
|
||||
} 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())));
|
||||
} else {
|
||||
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相")) {
|
||||
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);
|
||||
}
|
||||
@@ -319,6 +295,12 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
List<ThdDataVO> result = new ArrayList();
|
||||
List<CsEquipmentDeliveryDTO> data1 = equipmentFeignClient.queryDeviceById(Stream.of(commonStatisticalQueryParam.getDevId()).collect(Collectors.toList())).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())){
|
||||
for (CommonStatisticalQueryParam param : commonStatisticalQueryParam.getList()){
|
||||
|
||||
@@ -328,7 +310,7 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
CommonQueryParam commonQueryParam = new CommonQueryParam();
|
||||
commonQueryParam.setLineId(temp.getLineId());
|
||||
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.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;
|
||||
}).collect(Collectors.toList());
|
||||
List<StatisticalDataDTO> deviceRtData = commonService.getDeviceRtDataByTime(commonQueryParams);
|
||||
//List<StatisticalDataDTO> deviceRtData = commonService.getDeviceRtData(commonQueryParams);
|
||||
List<ThdDataVO> collect1 = deviceRtData.stream().map(temp -> {
|
||||
ThdDataVO vo = new ThdDataVO();
|
||||
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();
|
||||
vo.setPosition(position);
|
||||
vo.setTime(temp.getTime());
|
||||
vo.setStatMethod(temp.getValueType());
|
||||
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
||||
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());
|
||||
} 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.setUnit(epdPqd.getUnit());
|
||||
vo.setStatisticalName(epdPqd.getName());
|
||||
vo.setAnotherName(epdPqd.getShowName());
|
||||
return vo;
|
||||
@@ -393,7 +406,7 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
List<ThdDataVO> collect1 = deviceRtData.stream().map(temp -> {
|
||||
ThdDataVO vo = new ThdDataVO();
|
||||
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();
|
||||
vo.setPosition(position);
|
||||
vo.setTime(temp.getTime());
|
||||
@@ -421,9 +434,12 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
csEventVOPage.getRecords().forEach(temp->{
|
||||
//事件描述、相别、暂降幅值,需要特殊处理赋值
|
||||
//事件描述
|
||||
CsLedger dataById = iCsLedgerService.findDataById(temp.getLineId());
|
||||
temp.setLineName(dataById.getName());
|
||||
EleEpdPqd ele = epdFeignClient.findByName(temp.getTag()).getData();
|
||||
if(ele!=null){
|
||||
temp.setShowName(ele.getShowName());
|
||||
|
||||
//相别
|
||||
List<EleEvtParm> data1 = eleEvtFeignClient.queryByPid(ele.getId()).getData();
|
||||
List<EventDataSetDTO> eventDataSetDTOS = new ArrayList<>();
|
||||
@@ -532,7 +548,7 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
List<ThdDataVO> collect1 = deviceRtData.stream().map(temp -> {
|
||||
ThdDataVO vo = new ThdDataVO();
|
||||
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();
|
||||
vo.setPosition(position);
|
||||
vo.setTime(temp.getTime());
|
||||
@@ -632,7 +648,7 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
List<ThdDataVO> collect1 = deviceRtData.stream().map(temp -> {
|
||||
ThdDataVO vo = new ThdDataVO();
|
||||
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();
|
||||
vo.setPosition(position);
|
||||
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) {
|
||||
List<String> pList = Arrays.asList("电网有功功率", "电网无功功率", "电网视在功率","负载有功功率","负载无功功率","负载视在功率"
|
||||
,"有功功率","无功功率","视在功率","基波有功功率","基波无功功率","基波视在功率","三相总有功功率","三相总无功功率","三相总视在功率");
|
||||
// 使用Map来存储EleEpdPqd的ID和Unit,以便快速查找
|
||||
Map<String, String> unitMap = new HashMap<>();
|
||||
for (EleEpdPqd item : eleEpdPqds) {
|
||||
@@ -790,7 +804,7 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
for (DataGroupTemplateVO dataGroupTemplate : dataGroupTemplates) {
|
||||
EnergyTemplateVO energyTemplate = energyTemplateMap.get(dataGroupTemplate.getId());
|
||||
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() + ")");
|
||||
} else {
|
||||
dataGroupTemplate.setName(dataGroupTemplate.getName() + "(" + energyTemplate.getUnit() + ")");
|
||||
@@ -800,9 +814,12 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
}
|
||||
}
|
||||
|
||||
//判断功率是否需要转换
|
||||
//判断指标是否需要转换
|
||||
public boolean changePower(String name) {
|
||||
return POWER_LIST.stream()
|
||||
if(name.contains("相角")) {
|
||||
return false;
|
||||
}
|
||||
return HarmonicConstant.POWER_LIST.stream()
|
||||
.anyMatch(name::contains);
|
||||
}
|
||||
|
||||
|
||||
@@ -78,15 +78,20 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
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())).
|
||||
List<CsLedgerVO> deviceList = allList.stream().filter(item -> device.contains(item.getId()) && !Objects.equals(item.getPid(),"0")).
|
||||
peek(
|
||||
temp->{
|
||||
CsEquipmentDeliveryPO csEquipmentDeliveryPO = csEquipmentDeliveryMapper.selectById(temp.getId());
|
||||
temp.setComFlag(csEquipmentDeliveryPO.getRunStatus());
|
||||
temp.setType("device");
|
||||
}
|
||||
).
|
||||
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);
|
||||
deviceList.forEach(dev -> dev.setChildren(getChildren(dev, finalLineList)));
|
||||
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());
|
||||
c.setComFlag(po.getRunStatus());
|
||||
c.setNDId(po.getNdid());
|
||||
c.setType("device");
|
||||
}
|
||||
portables.forEach(dev -> dev.setChildren(getChildren(dev, finalLineList)));
|
||||
checkDevSetData(portables);
|
||||
@@ -115,8 +121,12 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
government.setId(IdUtil.simpleUUID());
|
||||
government.setChildren(engineeringList);
|
||||
List<CsLedgerVO> tree = new ArrayList<>();
|
||||
tree.add(portable);
|
||||
tree.add(government);
|
||||
if (CollUtil.isNotEmpty(portables)) {
|
||||
tree.add(portable);
|
||||
}
|
||||
if (CollUtil.isNotEmpty(deviceList)) {
|
||||
tree.add(government);
|
||||
}
|
||||
return tree;
|
||||
}
|
||||
//剔除未接入的设备(根据status判断不太稳,所有这里直接判断该设备有没有对应的模板指标)
|
||||
@@ -157,15 +167,17 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
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())).
|
||||
List<CsLedgerVO> deviceList = allList.stream().filter(item -> device.contains(item.getId()) && !Objects.equals(item.getPid(),"0")).
|
||||
peek(
|
||||
temp->{
|
||||
CsEquipmentDeliveryPO csEquipmentDeliveryPO = csEquipmentDeliveryMapper.selectById(temp.getId());
|
||||
temp.setComFlag(csEquipmentDeliveryPO.getRunStatus());
|
||||
temp.setNDId(csEquipmentDeliveryPO.getNdid());
|
||||
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());
|
||||
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)));
|
||||
@@ -183,6 +195,7 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
CsEquipmentDeliveryPO po = csEquipmentDeliveryMapper.selectById(c.getId());
|
||||
c.setComFlag(po.getRunStatus());
|
||||
c.setNDId(po.getNdid());
|
||||
c.setType("device");
|
||||
}
|
||||
portable.setChildren(portables);
|
||||
|
||||
@@ -193,8 +206,12 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
government.setId(IdUtil.simpleUUID());
|
||||
government.setChildren(engineeringList);
|
||||
List<CsLedgerVO> tree = new ArrayList<>();
|
||||
tree.add(portable);
|
||||
tree.add(government);
|
||||
if (CollUtil.isNotEmpty(portables)) {
|
||||
tree.add(portable);
|
||||
}
|
||||
if (CollUtil.isNotEmpty(deviceList)) {
|
||||
tree.add(government);
|
||||
}
|
||||
return tree;
|
||||
}
|
||||
|
||||
@@ -287,18 +304,105 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
public DevDetailDTO queryDevDetail(String devId) {
|
||||
DevDetailDTO device = new DevDetailDTO();
|
||||
CsLedger dev = this.findDataById(devId);
|
||||
device.setEquipmentName(dev.getName());
|
||||
device.setEquipmentId(devId);
|
||||
CsLedger project = this.findDataById(dev.getPid());
|
||||
device.setProjectId(project.getId());
|
||||
device.setProjectName(project.getName());
|
||||
CsLedger engineer = this.findDataById(project.getPid());
|
||||
device.setEngineeringid(engineer.getId());
|
||||
device.setEngineeringName(engineer.getName());
|
||||
//如果是便携式设备,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.setEquipmentId(devId);
|
||||
CsLedger project = this.findDataById(dev.getPid());
|
||||
device.setProjectId(project.getId());
|
||||
device.setProjectName(project.getName());
|
||||
CsLedger engineer = this.findDataById(project.getPid());
|
||||
device.setEngineeringid(engineer.getId());
|
||||
device.setEngineeringName(engineer.getName());
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取子节点
|
||||
*/
|
||||
|
||||
@@ -71,6 +71,16 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
||||
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)
|
||||
// *
|
||||
|
||||
@@ -46,8 +46,9 @@ public class CsLogsPOServiceImpl extends ServiceImpl<CsLogsPOMapper, CsLogsPO> i
|
||||
String userRole = RequestUtil.getUserRole();
|
||||
List<String> strings = JSONArray.parseArray(userRole, String.class);
|
||||
QueryWrapper<CsLogsPO> csLogsPOQueryWrapper = new QueryWrapper<>();
|
||||
csLogsPOQueryWrapper.lambda().eq(!strings.contains(AppRoleEnum.OPERATION_MANAGER.getCode()),CsLogsPO::getUserName, username).
|
||||
ge(StringUtils.isNotBlank(baseParam.getSearchBeginTime()),CsLogsPO::getCreateTime,baseParam.getSearchBeginTime()).
|
||||
csLogsPOQueryWrapper.lambda()
|
||||
// .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);
|
||||
IPage<CsLogsPO> list = this.getBaseMapper().selectPage(returnpage,csLogsPOQueryWrapper);
|
||||
return list;
|
||||
|
||||
@@ -14,6 +14,7 @@ import com.njcn.oss.utils.FileStorageUtil;
|
||||
import com.njcn.redis.pojo.enums.AppRedisKey;
|
||||
import com.njcn.redis.utils.RedisUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.Instant;
|
||||
@@ -86,8 +87,8 @@ public class DeviceFtpServiceImpl implements DeviceFtpService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String downloadFile(String nDid, String name, Integer size, String fileCheck) {
|
||||
String result = null;
|
||||
@Async
|
||||
public void downloadFile(String nDid, String name, Integer size, String fileCheck) {
|
||||
judgeClientOnline(nDid);
|
||||
Object task = redisUtil.getObjectByKey("fileDowning:"+nDid);
|
||||
if (Objects.nonNull(task)) {
|
||||
@@ -98,25 +99,26 @@ public class DeviceFtpServiceImpl implements DeviceFtpService {
|
||||
throw new BusinessException(AlgorithmResponseEnum.FILE_BUSY);
|
||||
}
|
||||
try {
|
||||
redisUtil.delete("downloadFilePath:"+name);
|
||||
boolean file = 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);
|
||||
}
|
||||
redisUtil.delete("downloadFilePath:"+ nDid + name);
|
||||
askDeviceDataFeignClient.downloadFile(nDid,name,size,fileCheck).getData();
|
||||
} catch (Exception e) {
|
||||
redisUtil.delete("fileDowning:"+nDid);
|
||||
redisUtil.delete("fileCheck"+name);
|
||||
redisUtil.delete("fileCheck"+nDid+name);
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -173,6 +175,13 @@ public class DeviceFtpServiceImpl implements DeviceFtpService {
|
||||
vo.setPrjDataPath(item.getName());
|
||||
vo.setType(item.getType());
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -180,7 +189,7 @@ public class DeviceFtpServiceImpl implements DeviceFtpService {
|
||||
MakeUpVo vo = new MakeUpVo();
|
||||
vo.setPrjDataPath(fileInfo.getName());
|
||||
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);
|
||||
vo.setStartTime(formattedDate);
|
||||
vo.setSize(fileInfo.getFileSize());
|
||||
|
||||
@@ -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>{
|
||||
|
||||
|
||||
}
|
||||
@@ -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{
|
||||
|
||||
}
|
||||
@@ -1,17 +1,22 @@
|
||||
package com.njcn.csdevice.service.impl;
|
||||
|
||||
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.github.tocrhz.mqtt.publisher.MqttPublisher;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.csdevice.api.EquipmentFeignClient;
|
||||
import com.njcn.csdevice.constant.DataParam;
|
||||
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
||||
import com.njcn.csdevice.mapper.PortableOfflLogMapper;
|
||||
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.service.IPortableOfflLogService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.csdevice.param.UploadDataParam;
|
||||
import com.njcn.csdevice.service.PortableOffMainLogService;
|
||||
import com.njcn.csdevice.util.InfluxDbParamUtil;
|
||||
import com.njcn.csharmonic.api.EventFeignClient;
|
||||
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.vo.Response;
|
||||
import com.njcn.csharmonic.pojo.po.CsEventPO;
|
||||
import com.njcn.influx.imapper.CommonMapper;
|
||||
import com.njcn.influx.imapper.EvtDataMapper;
|
||||
import com.njcn.influx.imapper.PqdDataMapper;
|
||||
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 lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.ListUtils;
|
||||
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.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
@@ -45,6 +52,7 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
import java.io.*;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
@@ -83,6 +91,9 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
||||
|
||||
private final EvtDataMapper evtDataMapper;
|
||||
|
||||
private final MqttPublisher publisher;
|
||||
private final PortableOffMainLogService portableOffMainLogService;
|
||||
|
||||
@Override
|
||||
public Page<PortableOfflLog> queryPage(BaseParam baseParam) {
|
||||
Page<PortableOfflLog> returnpage = new Page<> (baseParam.getPageNum(), baseParam.getPageSize ());
|
||||
@@ -238,10 +249,24 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
||||
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()){
|
||||
|
||||
//初始上传日志基本信息
|
||||
PortableOfflLog portableOfflLog = new PortableOfflLog();
|
||||
portableOfflLog.setLogMainId(portableOffMainLog.getId());
|
||||
portableOfflLog.setName(file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("/")+1));
|
||||
portableOfflLog.setPath(file.getOriginalFilename());
|
||||
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());
|
||||
if(minFlag){
|
||||
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结果集解析入库后就不需要在解析了
|
||||
minFlag = false;
|
||||
}
|
||||
@@ -433,8 +462,36 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
||||
}
|
||||
}
|
||||
}
|
||||
this.baseMapper.insert(portableOfflLog);
|
||||
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);
|
||||
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");
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,26 +2,29 @@ package com.njcn.csdevice.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
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.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.csdevice.api.CsLineFeignClient;
|
||||
import com.njcn.csdevice.api.EquipmentFeignClient;
|
||||
import com.njcn.csdevice.constant.DataParam;
|
||||
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.CsLinePOMapper;
|
||||
import com.njcn.csdevice.mapper.WlRecordMapper;
|
||||
import com.njcn.csdevice.param.WlRecordPageParam;
|
||||
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.po.CsEquipmentDeliveryPO;
|
||||
import com.njcn.csdevice.pojo.po.CsDataSet;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import com.njcn.csdevice.pojo.po.WlRecord;
|
||||
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.service.IWlRecordService;
|
||||
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.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.pojo.bo.CommonQueryParam;
|
||||
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.service.CommonService;
|
||||
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 lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.sf.cglib.core.Local;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
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.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@@ -77,16 +87,20 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
||||
|
||||
private final CommonMapper commonMapper;
|
||||
|
||||
private final CsDataSetMapper csDataSetMapper;
|
||||
|
||||
private final InfluxDbParamUtil influxDbParamUtil;
|
||||
|
||||
private final CsLinePOMapper csLinePOMapper;
|
||||
|
||||
private final CsEquipmentDeliveryMapper csEquipmentDeliveryMapper;
|
||||
private final OverlimitService overlimitService;
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
|
||||
private final DecimalFormat df = new DecimalFormat(DataParam.DecimalFormatStr);
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
// @Transactional(rollbackFor = Exception.class)
|
||||
public void addRecord(WlRecordParam.AddRecord records) {
|
||||
//整理的方案下测试项集合(可能添加多个测试项)
|
||||
List<WlRecord> insertList = new ArrayList<>();
|
||||
@@ -113,6 +127,17 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
||||
updateRecord.setId(record.getId());
|
||||
updateRecord.setList(item.getList());
|
||||
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);
|
||||
}
|
||||
@@ -128,7 +153,7 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
// @Transactional(rollbackFor = Exception.class)
|
||||
public void updateTestRecord(WlRecordParam.UpdateRecord record) {
|
||||
WlRecord wlRecord = new WlRecord();
|
||||
BeanUtils.copyProperties(record, wlRecord);
|
||||
@@ -136,6 +161,17 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
||||
wlRecord.setEndTime(record.getProEndTime());
|
||||
this.updateById(wlRecord);
|
||||
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
|
||||
@@ -179,6 +215,7 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
||||
wlRecord.setStartTime(getFirstTimeById(wlRecord.getId()));
|
||||
wlRecord.setEndTime(getLastTimeById(wlRecord.getId()));
|
||||
BeanUtils.copyProperties(wlRecord, recordVo);
|
||||
recordVo.setList(this.baseMapper.getDataRecordBytestId(wlRecord.getId()));
|
||||
recordVoList.add(recordVo);
|
||||
}else{
|
||||
//反之则是方案ID 则返回该方案下所有的测试项信息
|
||||
@@ -192,6 +229,7 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
||||
wl.setStartTime(getFirstTimeById(wl.getId()));
|
||||
wl.setEndTime(getLastTimeById(wl.getId()));
|
||||
BeanUtils.copyProperties(wl, recordVo);
|
||||
recordVo.setList(this.baseMapper.getDataRecordBytestId(wl.getId()));
|
||||
recordVoList.add(recordVo);
|
||||
}
|
||||
}
|
||||
@@ -298,7 +336,7 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
// @Transactional(rollbackFor = Exception.class)
|
||||
public void deleteRecord(String id) {
|
||||
LambdaQueryWrapper<WlRecord> qw = new LambdaQueryWrapper();
|
||||
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){
|
||||
//方案关联的设备基础数据也删除
|
||||
this.baseMapper.deleteDataRecord(id,null);
|
||||
overlimitService.removeById(id);
|
||||
}else{
|
||||
//如果删除的是方案 那么连带方案下的所有测试项也要删除
|
||||
qw = new LambdaQueryWrapper();
|
||||
@@ -356,7 +395,8 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
||||
List<WlRecord> data = new ArrayList<>();
|
||||
if(wlRecord.getPId() == null){
|
||||
//如果查询的是方案 则查询该方案下所有的测试项关联的设备基础数据
|
||||
data = this.baseMapper.getDataRecordByTestId(wlRecord.getId(),1);
|
||||
return null;
|
||||
// data = this.baseMapper.getDataRecordByTestId(wlRecord.getId(),1);
|
||||
}else{
|
||||
//如果查询的是测试项 则查询该测试项下所有的关联的设备基础数据
|
||||
data = this.baseMapper.getDataRecordByTestId(wlRecord.getId(),0);
|
||||
@@ -367,7 +407,7 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
||||
}
|
||||
//格式化前端参数
|
||||
formatQueryParamList(commonStatisticalQueryParam);
|
||||
if(commonStatisticalQueryParam.getList() != null && commonStatisticalQueryParam.getList().size() > 0){
|
||||
if(commonStatisticalQueryParam.getList() != null && !commonStatisticalQueryParam.getList().isEmpty()){
|
||||
for (CommonStatisticalQueryParam param : commonStatisticalQueryParam.getList()){
|
||||
if(param.getStatisticalId() == null){
|
||||
continue;
|
||||
@@ -375,6 +415,13 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
||||
List<EleEpdPqd> eleEpdPqds = csStatisticalSetFeignClient.queryStatisticalSelect(param.getStatisticalId()).getData();
|
||||
for(WlRecord wl : data){
|
||||
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();
|
||||
eleEpdPqds.forEach(epdPqd->{
|
||||
List<CommonQueryParam> commonQueryParams = finalCsLinePOList.stream().map(temp -> {
|
||||
@@ -391,17 +438,52 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
||||
return commonQueryParam;
|
||||
}).collect(Collectors.toList());
|
||||
List<StatisticalDataDTO> deviceRtData = commonService.getDeviceRtDataByTime(commonQueryParams);
|
||||
//此处设空时为了有多段时将线条断开前端显示
|
||||
if(!CollectionUtils.isEmpty(deviceRtData)){
|
||||
deviceRtData.get(deviceRtData.size()-1).setValue(null);
|
||||
}
|
||||
List<ThdDataVO> collect1 = deviceRtData.stream().map(temp -> {
|
||||
ThdDataVO vo = new ThdDataVO();
|
||||
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();
|
||||
vo.setPosition(position);
|
||||
vo.setTime(temp.getTime());
|
||||
vo.setStatMethod(temp.getValueType());
|
||||
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
||||
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());
|
||||
} 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.setUnit(epdPqd.getUnit());
|
||||
vo.setStatisticalName(epdPqd.getName());
|
||||
vo.setAnotherName(epdPqd.getShowName());
|
||||
return vo;
|
||||
@@ -427,9 +509,13 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
||||
}
|
||||
|
||||
@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.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);
|
||||
if(CollUtil.isNotEmpty(wlRecordList)){
|
||||
|
||||
@@ -508,8 +594,7 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
||||
});
|
||||
|
||||
if(CollUtil.isNotEmpty(poList)){
|
||||
System.out.println("444");
|
||||
//
|
||||
this.updateBatchById(poList);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>pqs-influx</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<version>1.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
||||
@@ -73,12 +73,11 @@ public interface HarmonicConstant {
|
||||
|
||||
String CTRL_DATA = "ctrl_data";
|
||||
|
||||
|
||||
Set<String> POWER_LIST = new HashSet<>(Arrays.asList(
|
||||
"电网有功功率", "电网无功功率", "电网视在功率", "负载有功功率",
|
||||
"负载无功功率", "负载视在功率", "有功功率", "无功功率",
|
||||
"视在功率", "基波有功功率", "基波无功功率",
|
||||
"基波视在功率", "三相总有功功率", "三相总无功功率",
|
||||
"三相总视在功率"
|
||||
"三相总视在功率","相电压总有效值","线电压总有效值","相电压基波有效值","线电压基波有效值","电压正序分量"
|
||||
));
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ public enum CsHarmonicResponseEnum {
|
||||
CS_DEVICE_COMMON_ERROR("A00600","治理稳态模块异常"),
|
||||
BIND_TARGET_ERROR("A00601","指标参数绑定异常"),
|
||||
MAKE_UP_ERROR("A00602","补招失败"),
|
||||
RECORD_MISSING("A00602","record.bin文件缺失,补召失败")
|
||||
|
||||
;
|
||||
|
||||
|
||||
@@ -117,7 +117,7 @@ public class AnalyseComtradeCfg {
|
||||
hashMapA.put("pq_RmsU",rms[0]);
|
||||
hashMapB.put("pq_RmsU",rms[1]);
|
||||
hashMapC.put("pq_RmsU",rms[2]);
|
||||
hashMapA.put("pq_RmsU",rms[3]);
|
||||
hashMapA.put("pq_RmsI",rms[3]);
|
||||
hashMapB.put("pq_RmsI",rms[4]);
|
||||
hashMapC.put("pq_RmsI",rms[5]);
|
||||
hashMapA.put("pq_RmsLU",rms[6]);
|
||||
@@ -197,37 +197,37 @@ public class AnalyseComtradeCfg {
|
||||
Float[][][] harmPower = min.getHarm_Power();
|
||||
for (int i = 0; i < 49; i++) {
|
||||
//电压含有率
|
||||
hashMapA.put("pq_HarmU_"+(i+2),harmContain[0][i]);
|
||||
hashMapB.put("pq_HarmU_"+(i+2),harmContain[1][i]);
|
||||
hashMapC.put("pq_HarmU_"+(i+2),harmContain[2][i]);
|
||||
hashMapA.put("pq_HarmU_"+(i+2),harmContain[0][i+1]);
|
||||
hashMapB.put("pq_HarmU_"+(i+2),harmContain[1][i+1]);
|
||||
hashMapC.put("pq_HarmU_"+(i+2),harmContain[2][i+1]);
|
||||
|
||||
//谐波相角
|
||||
hashMapA.put("pq_HarmUAng_"+(i+2),fuHarmPhase[0][i]);
|
||||
hashMapB.put("pq_HarmUAng_"+(i+2),fuHarmPhase[1][i]);
|
||||
hashMapC.put("pq_HarmUAng_"+(i+2),fuHarmPhase[2][i]);
|
||||
hashMapA.put("pq_HarmUAng_"+(i+2),fuHarmPhase[0][i+1]);
|
||||
hashMapB.put("pq_HarmUAng_"+(i+2),fuHarmPhase[1][i+1]);
|
||||
hashMapC.put("pq_HarmUAng_"+(i+2),fuHarmPhase[2][i+1]);
|
||||
|
||||
hashMapA.put("pq_HarmIAng_"+(i+2),fuHarmPhase[3][i]);
|
||||
hashMapB.put("pq_HarmIAng_"+(i+2),fuHarmPhase[4][i]);
|
||||
hashMapC.put("pq_HarmIAng_"+(i+2),fuHarmPhase[5][i]);
|
||||
hashMapA.put("pq_HarmIAng_"+(i+2),fuHarmPhase[3][i+1]);
|
||||
hashMapB.put("pq_HarmIAng_"+(i+2),fuHarmPhase[4][i+1]);
|
||||
hashMapC.put("pq_HarmIAng_"+(i+2),fuHarmPhase[5][i+1]);
|
||||
|
||||
//电流幅值
|
||||
hashMapA.put("pq_HarmI_"+(i+2),fuHarm[3][i]);
|
||||
hashMapB.put("pq_HarmI_"+(i+2),fuHarm[4][i]);
|
||||
hashMapC.put("pq_HarmI_"+(i+2),fuHarm[5][i]);
|
||||
hashMapA.put("pq_HarmI_"+(i+2),fuHarm[3][i+1]);
|
||||
hashMapB.put("pq_HarmI_"+(i+2),fuHarm[4][i+1]);
|
||||
hashMapC.put("pq_HarmI_"+(i+2),fuHarm[5][i+1]);
|
||||
|
||||
|
||||
//谐波功率
|
||||
hashMapA.put("pq_HarmP_"+(i+2),harmPower[0][i][0]);
|
||||
hashMapA.put("pq_HarmQ_"+(i+2),harmPower[0][i][1]);
|
||||
hashMapA.put("pq_HarmS_"+(i+2),harmPower[0][i][2]);
|
||||
hashMapA.put("pq_HarmP_"+(i+2),harmPower[0][i+1][0]);
|
||||
hashMapA.put("pq_HarmQ_"+(i+2),harmPower[0][i+1][1]);
|
||||
hashMapA.put("pq_HarmS_"+(i+2),harmPower[0][i+1][2]);
|
||||
|
||||
hashMapB.put("pq_HarmP_"+(i+2),harmPower[1][i][0]);
|
||||
hashMapB.put("pq_HarmQ_"+(i+2),harmPower[1][i][1]);
|
||||
hashMapB.put("pq_HarmS_"+(i+2),harmPower[1][i][2]);
|
||||
hashMapB.put("pq_HarmP_"+(i+2),harmPower[1][i+1][0]);
|
||||
hashMapB.put("pq_HarmQ_"+(i+2),harmPower[1][i+1][1]);
|
||||
hashMapB.put("pq_HarmS_"+(i+2),harmPower[1][i+1][2]);
|
||||
|
||||
hashMapC.put("pq_HarmP_"+(i+2),harmPower[2][i][0]);
|
||||
hashMapC.put("pq_HarmQ_"+(i+2),harmPower[2][i][1]);
|
||||
hashMapC.put("pq_HarmS_"+(i+2),harmPower[2][i][2]);
|
||||
hashMapC.put("pq_HarmP_"+(i+2),harmPower[2][i+1][0]);
|
||||
hashMapC.put("pq_HarmQ_"+(i+2),harmPower[2][i+1][1]);
|
||||
hashMapC.put("pq_HarmS_"+(i+2),harmPower[2][i+1][2]);
|
||||
//M相目前没有
|
||||
// hashMapT.put("pq_HarmP_"+(i+2),harmPower[3][i][0]);
|
||||
// hashMapT.put("pq_HarmQ_"+(i+2),harmPower[3][i][1]);
|
||||
@@ -679,7 +679,7 @@ public class AnalyseComtradeCfg {
|
||||
|
||||
strFileLine = sr.readLine(); // ⑩
|
||||
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());
|
||||
|
||||
sr.close();
|
||||
|
||||
@@ -23,6 +23,10 @@ public class CommonStatisticalQueryParam {
|
||||
private String statisticalId;
|
||||
@ApiModelProperty(value = "取值类型(Max,Min,cp95,avg)")
|
||||
private String valueType;
|
||||
|
||||
@ApiModelProperty(value = "一次值:Primary;二次值:Secondary")
|
||||
private String dataLevel;
|
||||
|
||||
@ApiModelProperty(value = "频次2-50")
|
||||
private String frequency;
|
||||
|
||||
|
||||
@@ -29,6 +29,10 @@ public class CsEventUserQueryPage extends CsEventUserQueryParam{
|
||||
@ApiModelProperty(value = "显示条数",name = "pageSize",dataType ="Integer",required = true)
|
||||
private Integer pageSize;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "设备类型名称(便携式,治理)")
|
||||
private String deviceTypeName;
|
||||
|
||||
@ApiModelProperty(value = "工程id")
|
||||
private String engineeringid;
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@@ -83,6 +84,16 @@ public class CsEventController extends BaseController {
|
||||
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)
|
||||
@PostMapping("/saveBatchEventList")
|
||||
@ApiOperation("批量新增事件")
|
||||
|
||||
@@ -59,13 +59,22 @@ public class EventUserController extends BaseController {
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/queryEventpage")
|
||||
@ApiOperation("事件消息")
|
||||
@ApiOperation("事件消息(app)")
|
||||
@ApiImplicitParam(name = "csEventUserQueryPage", value = "暂降事件查询参数", required = true)
|
||||
public HttpResult<Page<EventDetailVO>> queryEventpage(@RequestBody CsEventUserQueryPage csEventUserQueryPage) {
|
||||
String methodDescribe = getMethodDescribe("queryEventpage");
|
||||
Page<EventDetailVO> list = csEventUserPOService.queryEventpage(csEventUserQueryPage);
|
||||
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)
|
||||
@PostMapping("/updateStatus")
|
||||
|
||||
@@ -1,10 +1,21 @@
|
||||
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 io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
@@ -21,9 +32,37 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
@AllArgsConstructor
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
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);
|
||||
}
|
||||
@@ -117,4 +117,36 @@
|
||||
</if>
|
||||
order by b.start_time desc
|
||||
</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) <= DATE(#{csEventUserQueryPage.endTime})
|
||||
</if>
|
||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.startTime != null and csEventUserQueryPage.startTime !=''">
|
||||
AND DATE(b.start_time) >= 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>
|
||||
@@ -10,6 +10,7 @@ import com.njcn.csharmonic.pojo.vo.CsEventVO;
|
||||
import com.njcn.csharmonic.pojo.vo.EventDetailVO;
|
||||
import com.njcn.event.file.pojo.dto.WaveDataDTO;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -46,4 +47,6 @@ public interface CsEventPOService extends IService<CsEventPO>{
|
||||
Page<DataGroupEventVO> pageQueryByLineId(CsEventUserQueryPage csEventUserQueryPage);
|
||||
|
||||
void saveBatchEventList(List<CsEventPO> csEventPOS);
|
||||
|
||||
void getFileZip(String eventId,HttpServletResponse response);
|
||||
}
|
||||
|
||||
@@ -27,4 +27,6 @@ public interface CsEventUserPOService extends IService<CsEventUserPO>{
|
||||
void updateStatus(CsEventUserQueryParam csEventUserQueryParam);
|
||||
|
||||
Page<EventDetailVO> queryEventpage(CsEventUserQueryPage csEventUserQueryPage);
|
||||
|
||||
Page<EventDetailVO> queryEventPageWeb(CsEventUserQueryPage csEventUserQueryPage);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.csdevice.api.RoleEngineerDevFeignClient;
|
||||
import com.njcn.csdevice.constant.DataParam;
|
||||
import com.njcn.csharmonic.constant.HarmonicConstant;
|
||||
import com.njcn.csharmonic.mapper.CsConfigurationMapper;
|
||||
import com.njcn.csharmonic.param.CsConfigurationParm;
|
||||
@@ -116,6 +117,8 @@ public class CsConfigurationServiceImpl extends ServiceImpl<CsConfigurationMappe
|
||||
if(CollectionUtils.isEmpty(data1)){
|
||||
return returnpage;
|
||||
}
|
||||
//+无线项目id
|
||||
data1.add(DataParam.WIRELESS_PROJECT_ID);
|
||||
Page<CsConfigurationPO> csConfigurationPOPage = this.getBaseMapper().queryPage(temppage,csConfigurationQueryParam,data1);
|
||||
// QueryWrapper<CsConfigurationPO> query = new QueryWrapper<>();
|
||||
// query.like(StringUtils.isNotBlank(csConfigurationQueryParam.getSearchValue()),CsConfigurationPO.COL_NAME,csConfigurationQueryParam.getSearchValue()).
|
||||
|
||||
@@ -7,6 +7,7 @@ import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.core.util.ZipUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
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.influx.pojo.dto.EventDataSetDTO;
|
||||
import com.njcn.influx.service.EvtDataService;
|
||||
import com.njcn.minioss.config.MinIossProperties;
|
||||
import com.njcn.oss.constant.GeneralConstant;
|
||||
import com.njcn.oss.utils.FileStorageUtil;
|
||||
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 lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
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.service.CsEventPOService;
|
||||
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.*;
|
||||
|
||||
|
||||
@@ -82,6 +89,7 @@ public class CsEventPOServiceImpl extends ServiceImpl<CsEventPOMapper, CsEventPO
|
||||
private final EleEvtFeignClient eleEvtFeignClient;
|
||||
|
||||
private final WavePicComponent wavePicComponent;
|
||||
private final MinIossProperties minIossProperties;
|
||||
|
||||
@Override
|
||||
public List<EventDetailVO> queryEventList(CsEventUserQueryParam csEventUserQueryParam) {
|
||||
@@ -157,6 +165,47 @@ public class CsEventPOServiceImpl extends ServiceImpl<CsEventPOMapper, CsEventPO
|
||||
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
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONArray;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.pojo.constant.LogInfo;
|
||||
import com.njcn.csdevice.api.CsLedgerFeignClient;
|
||||
import com.njcn.csdevice.constant.DataParam;
|
||||
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -127,8 +127,11 @@ public class DeviceDataTrendServiceImpl implements DeviceDataTrendService {
|
||||
|
||||
|
||||
|
||||
//判断功率是否需要转换
|
||||
//判断指标是否需要转换
|
||||
public boolean changePower(String name) {
|
||||
if(name.contains("相角")) {
|
||||
return false;
|
||||
}
|
||||
return POWER_LIST.stream()
|
||||
.anyMatch(name::contains);
|
||||
}
|
||||
|
||||
@@ -15,7 +15,9 @@ import com.njcn.access.utils.MqttUtil;
|
||||
import com.njcn.common.config.GeneralInfo;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.csdevice.api.DeviceFtpFeignClient;
|
||||
import com.njcn.csdevice.api.EquipmentFeignClient;
|
||||
import com.njcn.csdevice.api.PortableOffLogFeignClient;
|
||||
import com.njcn.csdevice.pojo.vo.CsEquipmentDeliveryVO;
|
||||
import com.njcn.csharmonic.enums.CsHarmonicResponseEnum;
|
||||
import com.njcn.csharmonic.offline.constant.OfflineConstant;
|
||||
import com.njcn.csharmonic.offline.log.Log;
|
||||
@@ -74,6 +76,7 @@ public class OfflineDataUploadServiceImpl implements OfflineDataUploadService {
|
||||
private final FileStorageUtil fileStorageUtil;
|
||||
private final GeneralInfo generalInfo;
|
||||
private final PortableOffLogFeignClient portableOffLogFeignClient;
|
||||
private final EquipmentFeignClient equipmentFeignClient;
|
||||
|
||||
|
||||
@Override
|
||||
@@ -154,13 +157,13 @@ public class OfflineDataUploadServiceImpl implements OfflineDataUploadService {
|
||||
BeanUtils.copyProperties(item,vo);
|
||||
long startTime = item.getPrjTimeStart();
|
||||
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);
|
||||
vo.setStartTime(formattedDate);
|
||||
}
|
||||
long endTime = item.getPrjTimeEnd();
|
||||
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);
|
||||
vo.setEndTime(formattedDate);
|
||||
}
|
||||
@@ -182,7 +185,7 @@ public class OfflineDataUploadServiceImpl implements OfflineDataUploadService {
|
||||
if (Objects.equals("dir",fileType)) {
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
askProjectInfo(null,nDid, Integer.parseInt(TypeEnum.TYPE_8.getCode()),path,"DevFileCmd");
|
||||
Thread.sleep(2000);
|
||||
Thread.sleep(5000);
|
||||
String key = AppRedisKey.PROJECT_INFO + nDid;
|
||||
Object object = redisUtil.getObjectByKey(key);
|
||||
if (!Objects.isNull(object)) {
|
||||
@@ -258,10 +261,15 @@ public class OfflineDataUploadServiceImpl implements OfflineDataUploadService {
|
||||
}
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(fileList)) {
|
||||
//添加record.bin文件
|
||||
fileList.add(s + "/record.bin");
|
||||
map.put(s,fileList);
|
||||
}
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(map)) {
|
||||
List<String> keyList = new ArrayList<>();
|
||||
//获取装置信息
|
||||
CsEquipmentDeliveryVO vo = equipmentFeignClient.queryEquipmentByndid(param.getNDid()).getData();
|
||||
map.forEach((k,v)->{
|
||||
String proName = k.replace("/bd0/cmn/",OssPath.DEV_MAKE_UP_PATH + param.getNDid() + "/");
|
||||
String key = AppRedisKey.PROJECT_INFO + param.getNDid();
|
||||
@@ -273,7 +281,7 @@ public class OfflineDataUploadServiceImpl implements OfflineDataUploadService {
|
||||
}
|
||||
askFileInfo(param.getNDid(),mid,item);
|
||||
try {
|
||||
Thread.sleep(5000);
|
||||
Thread.sleep(10000);
|
||||
FileDto.FileInfo info = channelObjectUtil.objectToSingleObject(redisUtil.getObjectByKey(key),FileDto.FileInfo.class);
|
||||
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];
|
||||
@@ -285,12 +293,17 @@ public class OfflineDataUploadServiceImpl implements OfflineDataUploadService {
|
||||
}
|
||||
//删除下载文件
|
||||
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) {
|
||||
throw new BusinessException(CsHarmonicResponseEnum.MAKE_UP_ERROR);
|
||||
}
|
||||
});
|
||||
//下载完成,调用解析接口
|
||||
portableOffLogFeignClient.dataOnlineRecruitment(param.getNDid(),param.getLineId(),proName);
|
||||
portableOffLogFeignClient.dataOnlineRecruitment(vo.getId(),param.getLineId(),proName);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -32,6 +32,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
@@ -71,10 +72,12 @@ public class TestController {
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@GetMapping("/test")
|
||||
@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);
|
||||
// 获取前一天的开始时间(00:00:00)
|
||||
@@ -122,7 +125,9 @@ public class TestController {
|
||||
collect.forEach((tempPhase,byNameMap)->{
|
||||
//最小值
|
||||
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) -> {
|
||||
@@ -151,7 +156,9 @@ public class TestController {
|
||||
|
||||
//最大值
|
||||
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) -> {
|
||||
@@ -163,10 +170,10 @@ public class TestController {
|
||||
tempEleEpdPqd.setHarmEnd(tempEleEpdPqd.getHarmEnd()+1);
|
||||
}
|
||||
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 {
|
||||
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);
|
||||
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) -> {
|
||||
EleEpdPqd tempEleEpdPqd = eleEpdPqdList.get(0);
|
||||
@@ -207,7 +216,9 @@ public class TestController {
|
||||
|
||||
//CP95
|
||||
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) -> {
|
||||
EleEpdPqd tempEleEpdPqd = eleEpdPqdList.get(0);
|
||||
@@ -221,7 +232,7 @@ public class TestController {
|
||||
influxQueryWrapperCp95.percentile(tempEleEpdPqd.getName() + "_" + i, tempEleEpdPqd.getOtherName() + "_" + i, 95);
|
||||
}
|
||||
} else {
|
||||
influxQueryWrapperCp95.mean(tempEleEpdPqd.getName(), tempEleEpdPqd.getOtherName());
|
||||
influxQueryWrapperCp95.percentile(tempEleEpdPqd.getName(), tempEleEpdPqd.getOtherName(),95);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
@@ -162,10 +162,10 @@ public class ReportCovertJob {
|
||||
tempEleEpdPqd.setHarmEnd(tempEleEpdPqd.getHarmEnd()+1);
|
||||
}
|
||||
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 {
|
||||
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);
|
||||
}
|
||||
} else {
|
||||
influxQueryWrapperCp95.mean(tempEleEpdPqd.getName(), tempEleEpdPqd.getOtherName());
|
||||
influxQueryWrapperCp95.percentile(tempEleEpdPqd.getName(), tempEleEpdPqd.getOtherName(),95);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
@@ -5,6 +5,7 @@ import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
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")
|
||||
@EnableFeignClients(basePackages = "com.njcn")
|
||||
@SpringBootApplication(scanBasePackages = "com.njcn")
|
||||
@DependsOn("proxyMapperRegister")
|
||||
public class CsSystemBootApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
Reference in New Issue
Block a user