1.新增数据清洗相关实体
2.兼容便携式设备接入
This commit is contained in:
@@ -0,0 +1,100 @@
|
||||
package com.njcn.csdevice.pojo.param;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2024/4/1 19:18
|
||||
*/
|
||||
@Data
|
||||
public class WlRecordParam {
|
||||
|
||||
@ApiModelProperty("方案、测试项名称")
|
||||
@NotBlank(message = "名称不可为空")
|
||||
private String itemName;
|
||||
|
||||
@ApiModelProperty("描述")
|
||||
private String describe;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class Record extends WlRecordParam {
|
||||
|
||||
@ApiModelProperty("工程名称")
|
||||
private String gcName;
|
||||
|
||||
@ApiModelProperty("统计间隔")
|
||||
@NotNull(message = "统计间隔不可为空")
|
||||
private Integer statisticalInterval;
|
||||
|
||||
@ApiModelProperty("电压等级")
|
||||
@NotNull(message = "电压等级不可为空")
|
||||
private String voltageLevel;
|
||||
|
||||
@ApiModelProperty("电压接线方式(星型、角型、V型)")
|
||||
@NotNull(message = "电压接线方式不可为空")
|
||||
private String volConType;
|
||||
|
||||
@ApiModelProperty("电流接线方式(正常、合成IB、合成IC)")
|
||||
@NotNull(message = "电流接线方式不可为空")
|
||||
private String curConSel;
|
||||
|
||||
@ApiModelProperty("基准短路容量(MVA)")
|
||||
@NotNull(message = "基准短路容量不可为空")
|
||||
private Float capacitySscb;
|
||||
|
||||
@ApiModelProperty("最小短路容量(MVA)")
|
||||
@NotNull(message = "最小短路容量不可为空")
|
||||
private Float capacitySscmin;
|
||||
|
||||
@ApiModelProperty("供电设备容量(MVA)")
|
||||
@NotNull(message = "供电设备容量不可为空")
|
||||
private Float capacitySt;
|
||||
|
||||
@ApiModelProperty("用户协议容量(MVA)")
|
||||
@NotNull(message = "用户协议容量不可为空")
|
||||
private Float capacitySi;
|
||||
|
||||
@ApiModelProperty("PT变比")
|
||||
@NotNull(message = "PT变比不可为空")
|
||||
private Integer pt;
|
||||
|
||||
@ApiModelProperty("CT变比")
|
||||
@NotNull(message = "CT变比不可为空")
|
||||
private Integer ct;
|
||||
|
||||
@ApiModelProperty("测试项监测位置")
|
||||
@NotNull(message = "测试项监测位置不可为空")
|
||||
private String location;
|
||||
|
||||
@ApiModelProperty("数据类型(0:方案 1:测试项)")
|
||||
@NotNull(message = "数据类型不可为空")
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty("状态(0:删除 1:正常)")
|
||||
@NotNull(message = "状态不可为空")
|
||||
private Integer state;
|
||||
|
||||
@ApiModelProperty("测试项集合ID")
|
||||
private List<String> list;
|
||||
}
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class UpdateRecord extends Record {
|
||||
|
||||
@ApiModelProperty("id")
|
||||
@NotNull(message = "id")
|
||||
private String id;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -81,4 +81,6 @@ public class CsLinePO extends BaseEntity {
|
||||
@TableField(value = "clDid")
|
||||
private Integer clDid;
|
||||
|
||||
@TableField(value = "device_id")
|
||||
private String deviceId;
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
package com.njcn.csdevice.pojo.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.njcn.db.bo.BaseEntity;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 方案、测试项表
|
||||
* </p>
|
||||
*
|
||||
* @author xuyang
|
||||
* @since 2024-04-01
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@TableName("wl_record")
|
||||
public class WlRecord extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* uuid
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 方案id
|
||||
*/
|
||||
private String pId;
|
||||
|
||||
/**
|
||||
* 方案、测试项名称
|
||||
*/
|
||||
private String itemName;
|
||||
|
||||
/**
|
||||
* 工程名称
|
||||
*/
|
||||
private String gcName;
|
||||
|
||||
/**
|
||||
* 装置id
|
||||
*/
|
||||
private String devId;
|
||||
|
||||
/**
|
||||
* 监测点id
|
||||
*/
|
||||
private String lineId;
|
||||
|
||||
/**
|
||||
* 统计间隔
|
||||
*/
|
||||
private Integer statisticalInterval;
|
||||
|
||||
/**
|
||||
* PT变比
|
||||
*/
|
||||
private Integer pt;
|
||||
|
||||
/**
|
||||
* CT变比
|
||||
*/
|
||||
private Integer ct;
|
||||
|
||||
/**
|
||||
* 电压等级
|
||||
*/
|
||||
private String voltageLevel;
|
||||
|
||||
/**
|
||||
* 基准短路容量(MVA)
|
||||
*/
|
||||
private Float capacitySscb;
|
||||
|
||||
/**
|
||||
* 最小短路容量(MVA)
|
||||
*/
|
||||
private Float capacitySscmin;
|
||||
|
||||
/**
|
||||
* 供电设备容量(MVA)
|
||||
*/
|
||||
private Float capacitySt;
|
||||
|
||||
/**
|
||||
* 用户协议容量(MVA)
|
||||
*/
|
||||
private Float capacitySi;
|
||||
|
||||
/**
|
||||
* 电压接线方式(星型、角型、V型)
|
||||
*/
|
||||
private String volConType;
|
||||
|
||||
/**
|
||||
* 电流接线方式(正常、合成IB、合成IC)
|
||||
*/
|
||||
private String curConSel;
|
||||
|
||||
/**
|
||||
* 测试起始时间
|
||||
*/
|
||||
private LocalDateTime startTime;
|
||||
|
||||
/**
|
||||
* 测试结束时间
|
||||
*/
|
||||
private LocalDateTime endTime;
|
||||
|
||||
/**
|
||||
* 测试项监测位置
|
||||
*/
|
||||
private String location;
|
||||
|
||||
/**
|
||||
* 数据类型(0:方案 1:测试项)
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 状态(0:删除 1:正常)
|
||||
*/
|
||||
private Integer state;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String describe;
|
||||
|
||||
/**
|
||||
* 创建用户
|
||||
*/
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新用户
|
||||
*/
|
||||
private String updateBy;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.njcn.csdevice.pojo.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 类的介绍:方案树、测试项树
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2024/4/2 10:23
|
||||
*/
|
||||
@Data
|
||||
public class RecordTreeVo {
|
||||
|
||||
@ApiModelProperty("方案id")
|
||||
private String schemeId;
|
||||
|
||||
@ApiModelProperty("方案名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("下层数据")
|
||||
private List<Children> children;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class Children extends RecordTreeVo {
|
||||
|
||||
@ApiModelProperty("id")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty("名称")
|
||||
private String recordName;
|
||||
|
||||
@ApiModelProperty("设备MAC")
|
||||
private String devMac;
|
||||
|
||||
@ApiModelProperty("监测点名称")
|
||||
private String lineName;
|
||||
|
||||
@ApiModelProperty("测试项开始时间")
|
||||
private LocalDateTime startTime;
|
||||
|
||||
@ApiModelProperty("测试项结束时间")
|
||||
private LocalDateTime endTime;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package com.njcn.csdevice.pojo.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 类的介绍: 测试项详情表
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2024/4/1 20:10
|
||||
*/
|
||||
@Data
|
||||
public class RecordVo {
|
||||
|
||||
@ApiModelProperty("测试项id")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty("测试项名称")
|
||||
private String recordName;
|
||||
|
||||
@ApiModelProperty("设备名称")
|
||||
private String devName;
|
||||
|
||||
@ApiModelProperty("设备MAC")
|
||||
private String devMac;
|
||||
|
||||
@ApiModelProperty("监测点名称")
|
||||
private String lineName;
|
||||
|
||||
@ApiModelProperty("数据起始时间")
|
||||
private LocalDateTime startTime;
|
||||
|
||||
@ApiModelProperty("数据结束时间")
|
||||
private LocalDateTime endTime;
|
||||
|
||||
@ApiModelProperty("测试位置")
|
||||
private String location;
|
||||
|
||||
@ApiModelProperty("数据类型")
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty("统计间隔")
|
||||
private Integer statisticalInterval;
|
||||
|
||||
@ApiModelProperty("PT变比")
|
||||
private Integer pt;
|
||||
|
||||
@ApiModelProperty("CT变比")
|
||||
private Integer ct;
|
||||
|
||||
@ApiModelProperty("CT变比")
|
||||
private String voltageLevel;
|
||||
|
||||
@ApiModelProperty("基准短路容量")
|
||||
private Float capacitySscb;
|
||||
|
||||
@ApiModelProperty("最小短路容量")
|
||||
private Float capacitySscmin;
|
||||
|
||||
@ApiModelProperty("供电设备容量")
|
||||
private Float capacitySt;
|
||||
|
||||
@ApiModelProperty("用户协议容量")
|
||||
private Float capacitySi;
|
||||
|
||||
@ApiModelProperty("电压接线方式")
|
||||
private String volConType;
|
||||
|
||||
@ApiModelProperty("电流接线方式")
|
||||
private String curConSel;
|
||||
}
|
||||
@@ -0,0 +1,171 @@
|
||||
package com.njcn.csdevice.controller.scheme;
|
||||
|
||||
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.constant.OperateType;
|
||||
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.common.utils.LogUtil;
|
||||
import com.njcn.csdevice.pojo.param.WlRecordParam;
|
||||
import com.njcn.csdevice.pojo.po.WlRecord;
|
||||
import com.njcn.csdevice.pojo.vo.RecordTreeVo;
|
||||
import com.njcn.csdevice.pojo.vo.RecordVo;
|
||||
import com.njcn.csdevice.service.IWlRecordService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 方案、测试项表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author xuyang
|
||||
* @since 2024-04-01
|
||||
*/
|
||||
@Validated
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/wlRecord")
|
||||
@Api(tags = "方案测试项管理")
|
||||
@AllArgsConstructor
|
||||
public class WlRecordController extends BaseController {
|
||||
|
||||
private final IWlRecordService wlRecordService;
|
||||
|
||||
/**
|
||||
* 新增方案、测试项
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.ADD)
|
||||
@PostMapping("/add")
|
||||
@ApiOperation("新增方案或测试项")
|
||||
@ApiImplicitParam(name = "list", value = "测试项集合", required = true)
|
||||
public HttpResult<Boolean> add(@RequestBody @Validated List<WlRecordParam.Record> list) {
|
||||
String methodDescribe = getMethodDescribe("add");
|
||||
try {
|
||||
LogUtil.njcnDebug(log, "{},新增的测试项集合为:{}", methodDescribe, list);
|
||||
wlRecordService.add(list);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||
} catch (Exception e) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改方案
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.ADD)
|
||||
@PostMapping("/update")
|
||||
@ApiOperation("修改方案")
|
||||
@ApiImplicitParam(name = "list", value = "测试项集合", required = true)
|
||||
public HttpResult<Boolean> update(@RequestBody @Validated List<WlRecordParam.UpdateRecord> list) {
|
||||
String methodDescribe = getMethodDescribe("update");
|
||||
try {
|
||||
LogUtil.njcnDebug(log, "{},修改的测试项集合为:{}", methodDescribe, list);
|
||||
wlRecordService.update(list);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||
} catch (Exception e) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据方案查询测试项信息
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.ADD)
|
||||
@PostMapping("/getRecordById")
|
||||
@ApiOperation("通过方案id查询所属测试项")
|
||||
@ApiImplicitParam(name = "id", value = "用户id", required = true)
|
||||
public HttpResult<List<RecordVo>> getRecordById(@RequestParam @Validated String id) {
|
||||
String methodDescribe = getMethodDescribe("getRecordById");
|
||||
try {
|
||||
LogUtil.njcnDebug(log, "{},测试项id为:{}", methodDescribe, id);
|
||||
List<RecordVo> result = wlRecordService.getRecordById(id);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
} catch (Exception e) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有测试项信息
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.ADD)
|
||||
@PostMapping("/listRecord")
|
||||
@ApiOperation("查询所有测试项信息")
|
||||
public HttpResult<List<RecordTreeVo>> listRecord() {
|
||||
String methodDescribe = getMethodDescribe("listRecord");
|
||||
try {
|
||||
LogUtil.njcnDebug(log, "{}", methodDescribe);
|
||||
List<RecordTreeVo> result = wlRecordService.getRecordTree();
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
} catch (Exception e) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 两层方案树
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.ADD)
|
||||
@PostMapping("/schemeTree")
|
||||
@ApiOperation("两层方案树")
|
||||
public HttpResult<List<RecordTreeVo>> getSchemeTree() {
|
||||
String methodDescribe = getMethodDescribe("getSchemeTree");
|
||||
try {
|
||||
LogUtil.njcnDebug(log, "{}", methodDescribe);
|
||||
List<RecordTreeVo> result = wlRecordService.getSchemeTree();
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
} catch (Exception e) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除方案
|
||||
* @param id 方案、测试项id
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.DELETE)
|
||||
@DeleteMapping("/delete")
|
||||
@ApiOperation("删除方案")
|
||||
@ApiImplicitParam(name = "id", value = "方案id", required = true)
|
||||
public HttpResult<Boolean> delete(@RequestParam @Validated String id) {
|
||||
String methodDescribe = getMethodDescribe("delete");
|
||||
try {
|
||||
LogUtil.njcnDebug(log, "{},方案id为:{}", methodDescribe, id);
|
||||
wlRecordService.delete(id);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||
} catch (Exception e) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据测试项id查询测试项详细信息
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.DELETE)
|
||||
@DeleteMapping("/detailById")
|
||||
@ApiOperation("根据id获取测试项详情")
|
||||
@ApiImplicitParam(name = "id", value = "测试项id", required = true)
|
||||
public HttpResult<WlRecord> getDetailById(@RequestParam @Validated String id) {
|
||||
String methodDescribe = getMethodDescribe("getRecordById");
|
||||
try {
|
||||
LogUtil.njcnDebug(log, "{},测试项id为:{}", methodDescribe, id);
|
||||
WlRecord wlRecord = wlRecordService.getDataById(id);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, wlRecord, methodDescribe);
|
||||
} catch (Exception e) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.njcn.csdevice.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.csdevice.pojo.po.WlRecord;
|
||||
import com.njcn.csdevice.pojo.vo.RecordVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 方案、测试项表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author xuyang
|
||||
* @since 2024-04-01
|
||||
*/
|
||||
public interface WlRecordMapper extends BaseMapper<WlRecord> {
|
||||
|
||||
/**
|
||||
* 根据方案id查询所属的测试项
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
List<RecordVo> listRecord(@Param("id") String id);
|
||||
|
||||
/**
|
||||
* 查询所有的测试项
|
||||
* @return
|
||||
*/
|
||||
List<RecordVo> getAllRecord();
|
||||
|
||||
/**
|
||||
* 查询所有的方案和测试项
|
||||
* @return
|
||||
*/
|
||||
List<RecordVo> getAll();
|
||||
|
||||
|
||||
}
|
||||
@@ -25,14 +25,11 @@
|
||||
|
||||
<select id="findByNdid" resultType="CsLinePO">
|
||||
select
|
||||
t3.*
|
||||
t1.*
|
||||
from
|
||||
cs_equipment_delivery t0
|
||||
left join cs_ledger t1 on
|
||||
t0.id = t1.Id and t1.State = 1
|
||||
left join cs_ledger t2 on
|
||||
t1.Id = t2.Pid and t2.State = 1
|
||||
left join cs_line t3 on t2.Id = t3.line_id and t3.status = 1
|
||||
left join cs_line t1 on
|
||||
t0.id = t1.device_id
|
||||
where
|
||||
t0.ndid = #{id}
|
||||
</select>
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
<?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.WlRecordMapper">
|
||||
|
||||
<select id="listRecord" resultType="com.njcn.csdevice.pojo.vo.RecordVo">
|
||||
select
|
||||
a.id,
|
||||
a.item_name recordName,
|
||||
b.name devName,
|
||||
b.mac devMac,
|
||||
c.name lineName,
|
||||
a.start_time startTime,
|
||||
a.end_time endTime,
|
||||
a.location
|
||||
from
|
||||
wl_record a
|
||||
left join cs_equipment_delivery b on a.dev_id = b.id
|
||||
left join cs_line c on a.line_id = c.line_id
|
||||
where a.p_id = #{id} and a.state = 1
|
||||
</select>
|
||||
|
||||
<select id="getAllRecord" resultType="com.njcn.csdevice.pojo.vo.RecordVo">
|
||||
select
|
||||
a.id,
|
||||
a.item_name recordName,
|
||||
b.name devName,
|
||||
b.mac devMac,
|
||||
c.name lineName,
|
||||
a.start_time startTime,
|
||||
a.end_time endTime,
|
||||
a.location
|
||||
from
|
||||
wl_record a
|
||||
left join cs_equipment_delivery b on a.dev_id = b.id
|
||||
left join cs_line c on a.line_id = c.line_id
|
||||
where a.`type` = 1 and a.state = 1
|
||||
</select>
|
||||
|
||||
<select id="getAll" resultType="com.njcn.csdevice.pojo.vo.RecordVo">
|
||||
select
|
||||
a.id,
|
||||
a.item_name recordName,
|
||||
b.name devName,
|
||||
b.mac devMac,
|
||||
c.name lineName,
|
||||
a.start_time startTime,
|
||||
a.end_time endTime,
|
||||
a.location,
|
||||
a.type
|
||||
from
|
||||
wl_record a
|
||||
left join cs_equipment_delivery b on a.dev_id = b.id
|
||||
left join cs_line c on a.line_id = c.line_id
|
||||
where a.state = 1
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.njcn.csdevice.service;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.csdevice.pojo.param.WlRecordParam;
|
||||
import com.njcn.csdevice.pojo.po.WlRecord;
|
||||
import com.njcn.csdevice.pojo.vo.RecordTreeVo;
|
||||
import com.njcn.csdevice.pojo.vo.RecordVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 方案、测试项表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author xuyang
|
||||
* @since 2024-04-01
|
||||
*/
|
||||
public interface IWlRecordService extends IService<WlRecord> {
|
||||
|
||||
/**
|
||||
* 批量新增方案或测试项
|
||||
* @param list
|
||||
* @return
|
||||
*/
|
||||
void add(List<WlRecordParam.Record> list);
|
||||
|
||||
/**
|
||||
* 批量修改方案信息
|
||||
* @param list
|
||||
* @return
|
||||
*/
|
||||
void update(List<WlRecordParam.UpdateRecord> list);
|
||||
|
||||
/**
|
||||
* 根据方案查询测试项信息
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
List<RecordVo> getRecordById(String id);
|
||||
|
||||
/**
|
||||
* 查询所有测试项信息,用于方案添加测试项
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
List<RecordTreeVo> getRecordTree();
|
||||
|
||||
/**
|
||||
* 获取方案树
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
List<RecordTreeVo> getSchemeTree();
|
||||
|
||||
/**
|
||||
* 删除方案
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
void delete(String id);
|
||||
|
||||
/**
|
||||
* 根据测试项id查询测试项详情
|
||||
* @return
|
||||
*/
|
||||
WlRecord getDataById(String id);
|
||||
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.nacos.client.naming.utils.CollectionUtils;
|
||||
import com.alibaba.nacos.shaded.com.google.gson.Gson;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
@@ -31,6 +32,7 @@ import com.njcn.csdevice.utils.ExcelStyleUtil;
|
||||
import com.njcn.db.constant.DbConstant;
|
||||
import com.njcn.oss.constant.OssPath;
|
||||
import com.njcn.oss.utils.FileStorageUtil;
|
||||
import com.njcn.redis.pojo.enums.AppRedisKey;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.api.DictTreeFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
@@ -104,7 +106,12 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
BeanUtils.copyProperties (csEquipmentDeliveryAddParm,csEquipmentDeliveryPo);
|
||||
csEquipmentDeliveryPo.setStatus ("1");
|
||||
csEquipmentDeliveryPo.setRunStatus(1);
|
||||
String code = dictTreeFeignClient.queryById(po.getDevType()).getData().getCode();
|
||||
if (Objects.equals(DicDataEnum.PORTABLE.getCode(),code)) {
|
||||
csEquipmentDeliveryPo.setProcess(4);
|
||||
} else if (Objects.equals(DicDataEnum.CONNECT_DEV.getCode(),code)) {
|
||||
csEquipmentDeliveryPo.setProcess(2);
|
||||
}
|
||||
//生成二维码文件
|
||||
String qr = this.createQr(csEquipmentDeliveryAddParm.getNdid());
|
||||
csEquipmentDeliveryPo.setQrPath(qr);
|
||||
|
||||
@@ -0,0 +1,154 @@
|
||||
package com.njcn.csdevice.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.csdevice.mapper.WlRecordMapper;
|
||||
import com.njcn.csdevice.pojo.param.WlRecordParam;
|
||||
import com.njcn.csdevice.pojo.po.WlRecord;
|
||||
import com.njcn.csdevice.pojo.vo.RecordTreeVo;
|
||||
import com.njcn.csdevice.pojo.vo.RecordVo;
|
||||
import com.njcn.csdevice.service.IWlRecordService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 方案、测试项表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author xuyang
|
||||
* @since 2024-04-01
|
||||
*/
|
||||
@Service
|
||||
public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> implements IWlRecordService {
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void add(List<WlRecordParam.Record> list) {
|
||||
List<WlRecord> insertList = new ArrayList<>();
|
||||
list.forEach(item->{
|
||||
String id = IdUtil.simpleUUID();
|
||||
WlRecord wlRecord = new WlRecord();
|
||||
BeanUtils.copyProperties(item, wlRecord);
|
||||
wlRecord.setId(id);
|
||||
insertList.add(wlRecord);
|
||||
if (CollUtil.isNotEmpty(item.getList())){
|
||||
LambdaUpdateWrapper<WlRecord> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
||||
lambdaUpdateWrapper.set(WlRecord::getPId, id)
|
||||
.in(WlRecord::getId,item.getList());
|
||||
this.update(lambdaUpdateWrapper);
|
||||
}
|
||||
});
|
||||
this.saveBatch(insertList);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(List<WlRecordParam.UpdateRecord> list) {
|
||||
List<WlRecord> updateList = new ArrayList<>();
|
||||
list.forEach(item->{
|
||||
WlRecord wlRecord = new WlRecord();
|
||||
BeanUtils.copyProperties(item, wlRecord);
|
||||
updateList.add(wlRecord);
|
||||
if (CollUtil.isNotEmpty(item.getList())){
|
||||
//先将方案绑定的测试项去除,然后再根据传递的数据绑定
|
||||
LambdaUpdateWrapper<WlRecord> lambdaUpdateWrapper1 = new LambdaUpdateWrapper<>();
|
||||
lambdaUpdateWrapper1.set(WlRecord::getPId, null)
|
||||
.in(WlRecord::getId,item.getList());
|
||||
this.update(lambdaUpdateWrapper1);
|
||||
LambdaUpdateWrapper<WlRecord> lambdaUpdateWrapper2 = new LambdaUpdateWrapper<>();
|
||||
lambdaUpdateWrapper2.set(WlRecord::getPId, item.getId())
|
||||
.in(WlRecord::getId,item.getList());
|
||||
this.update(lambdaUpdateWrapper2);
|
||||
}
|
||||
});
|
||||
this.updateBatchById(updateList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RecordVo> getRecordById(String id) {
|
||||
return this.baseMapper.listRecord(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RecordTreeVo> getRecordTree() {
|
||||
List<RecordTreeVo> result = new ArrayList<>();
|
||||
Optional.ofNullable(this.baseMapper.getAllRecord())
|
||||
.ifPresent(list -> list.stream()
|
||||
.collect(Collectors.groupingBy(RecordVo::getDevName))
|
||||
.forEach((devName, records) -> {
|
||||
List<RecordTreeVo.Children> childrenList = records.stream()
|
||||
.map(this::mapToChildren)
|
||||
.collect(Collectors.toList());
|
||||
RecordTreeVo vo = new RecordTreeVo();
|
||||
vo.setName(devName);
|
||||
vo.setChildren(childrenList);
|
||||
result.add(vo);
|
||||
}));
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RecordTreeVo> getSchemeTree() {
|
||||
List<RecordTreeVo> result = new ArrayList<>();
|
||||
List<RecordVo> list = this.baseMapper.getAll();
|
||||
// 过滤出方案数据和测试项数据
|
||||
List<RecordVo> schemes = list.stream().filter(item -> item.getType() == 0).collect(Collectors.toList());
|
||||
List<RecordVo> testItems = list.stream().filter(item -> item.getType() == 1).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(schemes)){
|
||||
// 遍历方案数据
|
||||
for (RecordVo scheme : schemes) {
|
||||
RecordTreeVo vo = new RecordTreeVo();
|
||||
vo.setSchemeId(scheme.getId());
|
||||
vo.setName(scheme.getRecordName());
|
||||
if (CollUtil.isNotEmpty(testItems)){
|
||||
// 将测试项数据映射为子节点列表
|
||||
List<RecordTreeVo.Children> childrenList = testItems.stream()
|
||||
.map(item -> {
|
||||
RecordTreeVo.Children children = new RecordTreeVo.Children();
|
||||
children.setId(item.getId());
|
||||
String name = item.getDevName() + "-" + item.getLocation() + "(" + item.getStartTime() + "~" + item.getEndTime() + ")";
|
||||
children.setRecordName(name);
|
||||
return children;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
vo.setChildren(childrenList);
|
||||
result.add(vo);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(String id) {
|
||||
LambdaUpdateWrapper<WlRecord> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
||||
lambdaUpdateWrapper.set(WlRecord::getState,0)
|
||||
.eq(WlRecord::getId, id)
|
||||
.eq(WlRecord::getType, 0);
|
||||
this.update(lambdaUpdateWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WlRecord getDataById(String id) {
|
||||
return lambdaQuery().eq(WlRecord::getId, id)
|
||||
.eq(WlRecord::getType,1)
|
||||
.eq(WlRecord::getState, 1)
|
||||
.one();
|
||||
}
|
||||
|
||||
private RecordTreeVo.Children mapToChildren(RecordVo record) {
|
||||
RecordTreeVo.Children children = new RecordTreeVo.Children();
|
||||
BeanUtils.copyProperties(record, children);
|
||||
return children;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.njcn.csharmonic.param;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2024/4/3 14:06
|
||||
*/
|
||||
@Data
|
||||
public class AbnormalDataParam {
|
||||
|
||||
@ApiModelProperty("指标名称")
|
||||
private String targetName;
|
||||
|
||||
@ApiModelProperty("起始时间")
|
||||
private String startTime;
|
||||
|
||||
@ApiModelProperty("结束时间")
|
||||
private String endTime;
|
||||
|
||||
@ApiModelProperty("模糊搜索内容")
|
||||
private String content;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.njcn.csharmonic.pojo.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 类的介绍:数据清洗功能展示类
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2024/4/3 14:15
|
||||
*/
|
||||
@Data
|
||||
public class AnomalousDataVo {
|
||||
|
||||
@ApiModelProperty("设备名称")
|
||||
private String devName;
|
||||
|
||||
@ApiModelProperty("方案名称")
|
||||
private String planName;
|
||||
|
||||
@ApiModelProperty("测试项名称")
|
||||
private String itemName;
|
||||
|
||||
@ApiModelProperty("设备MAC")
|
||||
private String devMac;
|
||||
|
||||
@ApiModelProperty("监测点名称")
|
||||
private String lineName;
|
||||
|
||||
@ApiModelProperty("指标名称")
|
||||
private String targetName;
|
||||
|
||||
@ApiModelProperty("相别")
|
||||
private String phasicType;
|
||||
|
||||
@ApiModelProperty("数据类型")
|
||||
private String valueType;
|
||||
|
||||
@ApiModelProperty("数据时间")
|
||||
private LocalDateTime dataTime;
|
||||
|
||||
@ApiModelProperty("指标数据")
|
||||
private Double data;
|
||||
|
||||
@ApiModelProperty("正常范围")
|
||||
private String normalRange;
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
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.param.AbnormalDataParam;
|
||||
import com.njcn.csharmonic.pojo.vo.AnomalousDataVo;
|
||||
import com.njcn.csharmonic.service.AnomalousDataService;
|
||||
import com.njcn.event.file.pojo.dto.WaveDataDTO;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
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.util.List;
|
||||
|
||||
/**
|
||||
* 类的介绍:数据清洗控制层
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2024/4/3 13:56
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/clean")
|
||||
@Api(tags = "数据清洗")
|
||||
@AllArgsConstructor
|
||||
public class AnomalousDataController extends BaseController {
|
||||
|
||||
private final AnomalousDataService anomalousDataService;
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@GetMapping("/getAbnormalData")
|
||||
@ApiOperation("查询装置异常指标数据")
|
||||
@ApiImplicitParam(name = "param", value = "参数实体", required = true)
|
||||
public HttpResult<List<AnomalousDataVo>> getAbnormalData(@RequestParam AbnormalDataParam param) {
|
||||
String methodDescribe = getMethodDescribe("getAbnormalData");
|
||||
List<AnomalousDataVo> result = anomalousDataService.getAbnormalData(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.njcn.csharmonic.service;
|
||||
|
||||
import com.njcn.csharmonic.param.AbnormalDataParam;
|
||||
import com.njcn.csharmonic.pojo.vo.AnomalousDataVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface AnomalousDataService {
|
||||
|
||||
List<AnomalousDataVo> getAbnormalData(AbnormalDataParam param);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.njcn.csharmonic.service.impl;
|
||||
|
||||
import com.njcn.csharmonic.param.AbnormalDataParam;
|
||||
import com.njcn.csharmonic.pojo.vo.AnomalousDataVo;
|
||||
import com.njcn.csharmonic.service.AnomalousDataService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2024/4/3 14:15
|
||||
*/
|
||||
@Service
|
||||
public class AnomalousDataServiceImpl implements AnomalousDataService {
|
||||
|
||||
@Override
|
||||
public List<AnomalousDataVo> getAbnormalData(AbnormalDataParam param) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user