合并装置模块和检测计划模块
This commit is contained in:
@@ -1,20 +1,17 @@
|
||||
package com.njcn.gather.detection.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.gather.detection.pojo.param.PreDetectionParam;
|
||||
import com.njcn.gather.detection.pojo.po.DevData;
|
||||
import com.njcn.gather.detection.service.PreDetectionService;
|
||||
import com.njcn.gather.detection.service.impl.DetectionServiceImpl;
|
||||
import com.njcn.gather.detection.util.socket.MsgUtil;
|
||||
import com.njcn.gather.device.device.pojo.vo.PreDetection;
|
||||
import com.njcn.gather.device.device.service.IPqDevService;
|
||||
import com.njcn.gather.device.script.pojo.param.PqScriptIssueParam;
|
||||
import com.njcn.gather.device.script.pojo.po.SourceIssue;
|
||||
import com.njcn.gather.device.script.service.IPqScriptDtlsService;
|
||||
import com.njcn.gather.system.dictionary.pojo.enums.DictDataEnum;
|
||||
import com.njcn.gather.device.pojo.vo.PreDetection;
|
||||
import com.njcn.gather.device.service.IPqDevService;
|
||||
import com.njcn.gather.script.pojo.param.PqScriptIssueParam;
|
||||
import com.njcn.gather.script.pojo.po.SourceIssue;
|
||||
import com.njcn.gather.script.service.IPqScriptDtlsService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import com.njcn.web.utils.HttpResultUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
@@ -24,7 +21,6 @@ import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -15,14 +15,14 @@ import com.njcn.gather.detection.pojo.po.SourceCompareDev;
|
||||
import com.njcn.gather.detection.pojo.vo.*;
|
||||
import com.njcn.gather.detection.service.impl.DetectionServiceImpl;
|
||||
import com.njcn.gather.detection.util.socket.*;
|
||||
import com.njcn.gather.device.device.pojo.po.PqDev;
|
||||
import com.njcn.gather.device.device.pojo.vo.PreDetection;
|
||||
import com.njcn.gather.device.device.service.IPqDevService;
|
||||
import com.njcn.gather.device.script.pojo.param.PqScriptCheckDataParam;
|
||||
import com.njcn.gather.device.script.pojo.param.PqScriptIssueParam;
|
||||
import com.njcn.gather.device.script.pojo.po.SourceIssue;
|
||||
import com.njcn.gather.device.script.service.IPqScriptCheckDataService;
|
||||
import com.njcn.gather.device.script.service.IPqScriptDtlsService;
|
||||
import com.njcn.gather.device.pojo.po.PqDev;
|
||||
import com.njcn.gather.device.pojo.vo.PreDetection;
|
||||
import com.njcn.gather.device.service.IPqDevService;
|
||||
import com.njcn.gather.script.pojo.param.PqScriptCheckDataParam;
|
||||
import com.njcn.gather.script.pojo.param.PqScriptIssueParam;
|
||||
import com.njcn.gather.script.pojo.po.SourceIssue;
|
||||
import com.njcn.gather.script.service.IPqScriptCheckDataService;
|
||||
import com.njcn.gather.script.service.IPqScriptDtlsService;
|
||||
import com.njcn.gather.plan.service.IAdPlanService;
|
||||
import com.njcn.gather.storage.pojo.param.StorageParam;
|
||||
import com.njcn.gather.storage.pojo.po.AdHarmonicResult;
|
||||
@@ -46,7 +46,6 @@ import java.time.ZonedDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.format.DateTimeParseException;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -16,10 +16,9 @@ import com.njcn.gather.detection.util.socket.SocketManager;
|
||||
import com.njcn.gather.detection.util.socket.WebServiceManager;
|
||||
import com.njcn.gather.detection.util.socket.cilent.NettyClient;
|
||||
import com.njcn.gather.detection.util.socket.cilent.NettyDevClientHandler;
|
||||
import com.njcn.gather.detection.util.socket.web.WebSocketHandler;
|
||||
import com.njcn.gather.device.device.pojo.vo.PreDetection;
|
||||
import com.njcn.gather.device.device.service.IPqDevService;
|
||||
import com.njcn.gather.device.script.pojo.po.SourceIssue;
|
||||
import com.njcn.gather.device.pojo.vo.PreDetection;
|
||||
import com.njcn.gather.device.service.IPqDevService;
|
||||
import com.njcn.gather.script.pojo.po.SourceIssue;
|
||||
import com.njcn.gather.system.pojo.enums.DicDataEnum;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
|
||||
@@ -11,13 +11,13 @@ import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.njcn.gather.detection.pojo.param.PreDetectionParam;
|
||||
import com.njcn.gather.detection.pojo.po.DevData;
|
||||
import com.njcn.gather.detection.pojo.vo.DetectionData;
|
||||
import com.njcn.gather.device.err.pojo.param.PqErrSysParam;
|
||||
import com.njcn.gather.device.err.pojo.po.PqErrSysDtls;
|
||||
import com.njcn.gather.device.err.pojo.vo.ErrDtlsCheckDataVO;
|
||||
import com.njcn.gather.device.err.service.IPqErrSysDtlsService;
|
||||
import com.njcn.gather.device.script.pojo.po.PqScriptCheckData;
|
||||
import com.njcn.gather.device.script.pojo.po.SourceIssue;
|
||||
import com.njcn.gather.device.script.service.IPqScriptCheckDataService;
|
||||
import com.njcn.gather.err.pojo.param.PqErrSysParam;
|
||||
import com.njcn.gather.err.pojo.po.PqErrSysDtls;
|
||||
import com.njcn.gather.err.pojo.vo.ErrDtlsCheckDataVO;
|
||||
import com.njcn.gather.err.service.IPqErrSysDtlsService;
|
||||
import com.njcn.gather.script.pojo.po.PqScriptCheckData;
|
||||
import com.njcn.gather.script.pojo.po.SourceIssue;
|
||||
import com.njcn.gather.script.service.IPqScriptCheckDataService;
|
||||
import com.njcn.gather.storage.pojo.po.AdHarmonicResult;
|
||||
import com.njcn.gather.storage.pojo.po.AdNonHarmonicResult;
|
||||
import com.njcn.gather.storage.service.DetectionDataDealService;
|
||||
|
||||
@@ -3,50 +3,36 @@ package com.njcn.gather.detection.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.njcn.common.bean.CustomCacheUtil;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.gather.detection.handler.SocketDevResponseService;
|
||||
import com.njcn.gather.detection.handler.SocketSourceResponseService;
|
||||
import com.njcn.gather.detection.pojo.enums.DetectionResponseEnum;
|
||||
import com.njcn.gather.detection.pojo.enums.SourceOperateCodeEnum;
|
||||
import com.njcn.gather.detection.pojo.param.PreDetectionParam;
|
||||
import com.njcn.gather.detection.pojo.vo.SocketDataMsg;
|
||||
import com.njcn.gather.detection.pojo.vo.SocketMsg;
|
||||
import com.njcn.gather.detection.service.PreDetectionService;
|
||||
|
||||
import com.njcn.gather.detection.util.socket.CnSocketUtil;
|
||||
import com.njcn.gather.detection.util.socket.FormalTestManager;
|
||||
import com.njcn.gather.detection.util.socket.MsgUtil;
|
||||
import com.njcn.gather.detection.util.socket.SocketManager;
|
||||
import com.njcn.gather.detection.util.socket.cilent.NettyClient;
|
||||
import com.njcn.gather.detection.util.socket.cilent.NettySourceClientHandler;
|
||||
import com.njcn.gather.device.device.service.IPqDevService;
|
||||
import com.njcn.gather.device.script.pojo.param.PqScriptCheckDataParam;
|
||||
import com.njcn.gather.device.script.pojo.param.PqScriptIssueParam;
|
||||
import com.njcn.gather.device.script.pojo.po.PqScriptCheckData;
|
||||
import com.njcn.gather.device.script.pojo.po.PqScriptDtls;
|
||||
import com.njcn.gather.device.script.pojo.po.SourceIssue;
|
||||
import com.njcn.gather.device.script.service.IPqScriptCheckDataService;
|
||||
import com.njcn.gather.device.script.service.IPqScriptDtlsService;
|
||||
import com.njcn.gather.device.source.pojo.po.PqSource;
|
||||
import com.njcn.gather.device.source.pojo.po.SourceInitialize;
|
||||
import com.njcn.gather.device.source.service.IPqSourceService;
|
||||
import com.njcn.gather.device.service.IPqDevService;
|
||||
import com.njcn.gather.script.pojo.param.PqScriptCheckDataParam;
|
||||
import com.njcn.gather.script.pojo.po.SourceIssue;
|
||||
import com.njcn.gather.script.service.IPqScriptCheckDataService;
|
||||
import com.njcn.gather.script.service.IPqScriptDtlsService;
|
||||
import com.njcn.gather.source.pojo.po.SourceInitialize;
|
||||
import com.njcn.gather.source.service.IPqSourceService;
|
||||
import com.njcn.gather.plan.pojo.po.AdPlan;
|
||||
import com.njcn.gather.plan.pojo.po.AdPlanSource;
|
||||
import com.njcn.gather.plan.service.IAdPlanService;
|
||||
import com.njcn.gather.plan.service.IAdPlanSourceService;
|
||||
import com.njcn.gather.storage.pojo.param.StorageParam;
|
||||
import com.njcn.gather.storage.service.AdHarmonicService;
|
||||
import com.njcn.gather.system.dictionary.pojo.enums.DictDataEnum;
|
||||
import com.njcn.gather.system.dictionary.pojo.po.DictTree;
|
||||
import com.njcn.gather.system.dictionary.service.IDictDataService;
|
||||
import io.netty.channel.Channel;
|
||||
import io.netty.channel.ChannelFutureListener;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -4,13 +4,8 @@ import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.njcn.gather.detection.pojo.enums.SourceOperateCodeEnum;
|
||||
import com.njcn.gather.detection.pojo.param.PreDetectionParam;
|
||||
import com.njcn.gather.detection.pojo.vo.CoefficientVO;
|
||||
import com.njcn.gather.detection.pojo.vo.SocketMsg;
|
||||
import com.njcn.gather.detection.pojo.vo.WebSocketVO;
|
||||
import com.njcn.gather.detection.util.socket.web.WebSocketHandler;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @Author: cdf
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.njcn.gather.detection.util.socket;
|
||||
|
||||
import com.njcn.gather.detection.pojo.vo.DevLineTestResult;
|
||||
import com.njcn.gather.device.device.pojo.vo.PreDetection;
|
||||
import com.njcn.gather.device.pojo.vo.PreDetection;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
package com.njcn.gather.detection.util.socket;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.njcn.gather.detection.pojo.dto.DevXiNumData;
|
||||
import com.njcn.gather.device.device.pojo.vo.PreDetection;
|
||||
import com.njcn.gather.device.script.pojo.po.SourceIssue;
|
||||
import com.njcn.gather.device.pojo.vo.PreDetection;
|
||||
import com.njcn.gather.script.pojo.po.SourceIssue;
|
||||
import io.netty.channel.Channel;
|
||||
import io.netty.channel.nio.NioEventLoopGroup;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.njcn.gather.detection.util.socket;
|
||||
|
||||
import com.njcn.gather.detection.pojo.dto.DevXiNumData;
|
||||
import com.njcn.gather.detection.pojo.vo.CoefficientVO;
|
||||
import com.njcn.gather.device.script.pojo.po.SourceIssue;
|
||||
import com.njcn.gather.script.pojo.po.SourceIssue;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -6,7 +6,6 @@ import com.alibaba.fastjson.JSON;
|
||||
import com.njcn.gather.detection.pojo.enums.SourceResponseCodeEnum;
|
||||
import com.njcn.gather.detection.pojo.param.PreDetectionParam;
|
||||
import com.njcn.gather.detection.pojo.vo.SocketDataMsg;
|
||||
import com.njcn.gather.detection.pojo.vo.WebSocketVO;
|
||||
import com.njcn.gather.detection.util.socket.CnSocketUtil;
|
||||
import com.njcn.gather.detection.util.socket.SocketManager;
|
||||
import com.njcn.gather.detection.util.socket.WebServiceManager;
|
||||
|
||||
@@ -6,11 +6,10 @@ import com.njcn.gather.detection.handler.SocketDevResponseService;
|
||||
import com.njcn.gather.detection.pojo.enums.SourceOperateCodeEnum;
|
||||
import com.njcn.gather.detection.pojo.param.PreDetectionParam;
|
||||
import com.njcn.gather.detection.pojo.vo.DevLineTestResult;
|
||||
import com.njcn.gather.detection.pojo.vo.SocketMsg;
|
||||
import com.njcn.gather.detection.pojo.vo.WebSocketVO;
|
||||
import com.njcn.gather.detection.util.socket.*;
|
||||
import com.njcn.gather.device.device.pojo.vo.PreDetection;
|
||||
import com.njcn.gather.device.script.pojo.po.SourceIssue;
|
||||
import com.njcn.gather.device.pojo.vo.PreDetection;
|
||||
import com.njcn.gather.script.pojo.po.SourceIssue;
|
||||
import com.njcn.gather.system.pojo.enums.DicDataEnum;
|
||||
import io.netty.channel.Channel;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.njcn.gather.detection.util.socket.service;
|
||||
|
||||
import io.netty.channel.ChannelHandler;
|
||||
import io.netty.channel.ChannelInitializer;
|
||||
import io.netty.channel.socket.nio.NioSocketChannel;
|
||||
import io.netty.handler.codec.string.StringDecoder;
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.njcn.gather.detection.util.socket.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.netty.channel.Channel;
|
||||
import io.netty.channel.ChannelHandler;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import io.netty.channel.SimpleChannelInboundHandler;
|
||||
|
||||
|
||||
@@ -11,8 +11,6 @@ import io.netty.handler.codec.http.HttpServerCodec;
|
||||
import io.netty.handler.codec.http.websocketx.WebSocketServerProtocolHandler;
|
||||
import io.netty.handler.stream.ChunkedWriteHandler;
|
||||
import io.netty.handler.timeout.IdleStateHandler;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
|
||||
@@ -0,0 +1,324 @@
|
||||
package com.njcn.gather.device.controller;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelImportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ImportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
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.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.LogUtil;
|
||||
import com.njcn.gather.device.pojo.param.PqDevParam;
|
||||
import com.njcn.gather.device.pojo.po.PqDev;
|
||||
import com.njcn.gather.device.pojo.vo.CNDevExcel;
|
||||
import com.njcn.gather.device.pojo.vo.PqDevExcel;
|
||||
import com.njcn.gather.device.pojo.vo.PqDevVO;
|
||||
import com.njcn.gather.device.pojo.vo.PreDetection;
|
||||
import com.njcn.gather.device.service.IPqDevService;
|
||||
import com.njcn.gather.device.pojo.enums.DevResponseEnum;
|
||||
import com.njcn.gather.device.pojo.enums.PatternEnum;
|
||||
import com.njcn.gather.system.dictionary.pojo.po.DictData;
|
||||
import com.njcn.gather.system.dictionary.service.IDictDataService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import com.njcn.web.utils.ExcelUtil;
|
||||
import com.njcn.web.utils.FileUtil;
|
||||
import com.njcn.web.utils.HttpResultUtil;
|
||||
import com.njcn.web.utils.PoiUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @date 2024/11/06
|
||||
*/
|
||||
@Slf4j
|
||||
@Api(tags = "被检设备")
|
||||
@RestController
|
||||
@RequestMapping("/pqDev")
|
||||
@RequiredArgsConstructor
|
||||
public class PqDevController extends BaseController {
|
||||
|
||||
private final IPqDevService pqDevService;
|
||||
private final IDictDataService dictDataService;
|
||||
|
||||
|
||||
@OperateInfo
|
||||
@GetMapping("/aaa")
|
||||
@ApiOperation("分页查询被检设备")
|
||||
@ApiImplicitParam(name = "queryParam", value = "查询参数", required = true)
|
||||
public HttpResult<List<PreDetection>> aaa() {
|
||||
String methodDescribe = getMethodDescribe("list");
|
||||
List<PreDetection> devInfo = pqDevService.getDevInfo(Arrays.asList("578c142b7e4e4978a35bd6225aa62a23", "393504f55f1f79bce255bfc195cfdb56"));
|
||||
Map<String, List<PreDetection>> map = new HashMap();
|
||||
map.put("deviceList", devInfo);
|
||||
String jsonString = JSON.toJSONString(map);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, devInfo, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@OperateInfo
|
||||
@PostMapping("/list")
|
||||
@ApiOperation("分页查询被检设备")
|
||||
@ApiImplicitParam(name = "queryParam", value = "查询参数", required = true)
|
||||
public HttpResult<Page<PqDev>> list(@RequestBody @Validated PqDevParam.QueryParam queryParam) {
|
||||
String methodDescribe = getMethodDescribe("list");
|
||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, queryParam);
|
||||
Page<PqDev> result = pqDevService.listPqDevs(queryParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo
|
||||
@GetMapping("/getById")
|
||||
@ApiOperation("根据id查询被检设备")
|
||||
@ApiImplicitParam(name = "id", value = "被检设备id", required = true)
|
||||
public HttpResult<PqDevVO> getById(@RequestParam("id") String id) {
|
||||
String methodDescribe = getMethodDescribe("getById");
|
||||
LogUtil.njcnDebug(log, "{},查询ID为:{}", methodDescribe, id);
|
||||
PqDevVO result = pqDevService.getPqDevById(id);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(operateType = OperateType.ADD)
|
||||
@PostMapping("/add")
|
||||
@ApiOperation("新增被检设备")
|
||||
@ApiImplicitParam(name = "pqDevParam", value = "被检设备", required = true)
|
||||
public HttpResult<Object> add(@RequestBody @Validated PqDevParam pqDevParam) {
|
||||
String methodDescribe = getMethodDescribe("add");
|
||||
LogUtil.njcnDebug(log, "{},新增数据为:{}", methodDescribe, pqDevParam);
|
||||
boolean result = pqDevService.addPqDev(pqDevParam);
|
||||
if (result) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
@OperateInfo(operateType = OperateType.UPDATE)
|
||||
@PostMapping("/update")
|
||||
@ApiOperation("修改被检设备")
|
||||
@ApiImplicitParam(name = "updateParam", value = "被检设备", required = true)
|
||||
public HttpResult<Object> update(@RequestBody @Validated PqDevParam.UpdateParam updateParam) {
|
||||
String methodDescribe = getMethodDescribe("update");
|
||||
LogUtil.njcnDebug(log, "{},修改数据为:{}", methodDescribe, updateParam);
|
||||
boolean result = pqDevService.updatePqDev(updateParam);
|
||||
if (result) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
@OperateInfo(operateType = OperateType.DELETE)
|
||||
@PostMapping("/delete")
|
||||
@ApiOperation("删除被检设备")
|
||||
@ApiImplicitParam(name = "ids", value = "被检设备id", required = true)
|
||||
public HttpResult<Object> delete(@RequestBody @Validated PqDevParam.DeleteParam param) {
|
||||
String methodDescribe = getMethodDescribe("delete");
|
||||
LogUtil.njcnDebug(log, "{},删除ID数据为:{}", methodDescribe, String.join(StrUtil.COMMA, param.getIds()));
|
||||
boolean result = pqDevService.deletePqDev(param);
|
||||
if (result) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.DOWNLOAD)
|
||||
@PostMapping("/export")
|
||||
@ApiOperation("导出被检设备数据")
|
||||
@ApiImplicitParam(name = "queryParam", value = "查询参数", required = true)
|
||||
public void export(@RequestBody @Validated PqDevParam.QueryParam queryParam) {
|
||||
String methodDescribe = getMethodDescribe("export");
|
||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, queryParam);
|
||||
DictData dictData = dictDataService.getDictDataById(queryParam.getPattern());
|
||||
if (ObjectUtil.isNotNull(dictData)) {
|
||||
if (PatternEnum.CONTRAST.getValue().equals(dictData.getCode())) {
|
||||
List<PqDevExcel.ContrastExportData> data = pqDevService.getContrastExportData(queryParam);
|
||||
ExcelUtil.exportExcel("被检设备导出数据.xlsx", PqDevExcel.ContrastExportData.class, data);
|
||||
} else {
|
||||
List<PqDevExcel.SimulateOrDigitalExportData> data = pqDevService.getSimulateOrDigitExportData(queryParam);
|
||||
ExcelUtil.exportExcel("被检设备导出数据.xlsx", PqDevExcel.SimulateOrDigitalExportData.class, data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.DOWNLOAD)
|
||||
@PostMapping("/downloadTemplate")
|
||||
@ApiOperation("下载被检设备导入文件模板")
|
||||
public void downloadTemplate() {
|
||||
pqDevService.downloadTemplate();
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.UPLOAD)
|
||||
@PostMapping(value = "/importContrast")
|
||||
@ApiOperation("批量导入被检设备数据")
|
||||
@ApiImplicitParam(name = "file", value = "被检设备数据文件", required = true)
|
||||
public HttpResult<Object> importContrastData(@RequestParam("file") MultipartFile file, HttpServletResponse response) {
|
||||
String methodDescribe = getMethodDescribe("importContrastData");
|
||||
LogUtil.njcnDebug(log, "{},上传文件为:{}", methodDescribe, file.getOriginalFilename());
|
||||
ImportParams params = new ImportParams();
|
||||
params.setHeadRows(2);
|
||||
params.setNeedVerify(true);
|
||||
params.setStartSheetIndex(0);
|
||||
params.setSheetNum(1);
|
||||
try {
|
||||
ExcelImportResult<PqDevExcel.ContrastImportData> excelImportResult = ExcelImportUtil.importExcelMore(file.getInputStream(), PqDevExcel.ContrastImportData.class, params);
|
||||
//如果存在非法数据,将不合格的数据导出
|
||||
if (excelImportResult.isVerifyFail()) {
|
||||
// 此处前端要做特殊处理,具体可以参考技术监督的数据导入
|
||||
Workbook failWorkbook = excelImportResult.getFailWorkbook();
|
||||
PoiUtil.exportFileByWorkbook(failWorkbook, "非法被检设备数据.xlsx", response);
|
||||
} else {
|
||||
//批量录入数据
|
||||
List<PqDevExcel.ContrastImportData> list = excelImportResult.getList();
|
||||
pqDevService.importContrastData(list);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new BusinessException(DevResponseEnum.IMPORT_DATA_FAIL);
|
||||
}
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出灿能二楼设备
|
||||
*
|
||||
* @param queryParam
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.DOWNLOAD)
|
||||
@PostMapping("/exportCNDev")
|
||||
@ApiOperation("导出被检设备数据")
|
||||
@ApiImplicitParam(name = "queryParam", value = "查询参数", required = true)
|
||||
public void exportCNDev(@RequestBody @Validated PqDevParam.QueryParam queryParam) {
|
||||
String methodDescribe = getMethodDescribe("exportCNDev");
|
||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, queryParam);
|
||||
|
||||
pqDevService.exportCNDev(queryParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载灿能二楼设备导入文件模板
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.DOWNLOAD)
|
||||
@PostMapping("/downloadCNDevTemplate")
|
||||
@ApiOperation("下载被检设备导入文件模板")
|
||||
public void downloadCNDevTemplate() {
|
||||
pqDevService.downloadCNDevTemplate();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导入灿能二楼设备
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.UPLOAD)
|
||||
@PostMapping(value = "/importCNDev")
|
||||
@ApiOperation("批量导入设备数据")
|
||||
@ApiImplicitParam(name = "file", value = "被检设备数据文件", required = true)
|
||||
public HttpResult<String> importCNDev(@RequestParam("file") MultipartFile file, String patternId, HttpServletResponse response) {
|
||||
String methodDescribe = getMethodDescribe("importCNDev");
|
||||
LogUtil.njcnDebug(log, "{},上传文件为:{}", methodDescribe, file.getOriginalFilename());
|
||||
|
||||
boolean fileType = FileUtil.judgeFileIsExcel(file.getOriginalFilename());
|
||||
if (!fileType) {
|
||||
throw new BusinessException(CommonResponseEnum.FILE_XLSX_ERROR);
|
||||
}
|
||||
|
||||
ImportParams params = new ImportParams();
|
||||
params.setStartSheetIndex(0);
|
||||
params.setSheetNum(1);
|
||||
params.setHeadRows(1);
|
||||
params.setNeedVerify(true);
|
||||
|
||||
List<CNDevExcel> cnDevExcelList;
|
||||
try {
|
||||
ExcelImportResult<CNDevExcel> excelImportResult = ExcelImportUtil.importExcelMore(file.getInputStream(), CNDevExcel.class, params);
|
||||
if (excelImportResult.isVerifyFail()) {
|
||||
// 此处前端要做特殊处理,具体可以参考技术监督的数据导入
|
||||
Workbook failWorkbook = excelImportResult.getFailWorkbook();
|
||||
PoiUtil.exportFileByWorkbook(failWorkbook, "非法被检设备数据.xlsx", response);
|
||||
// throw new BusinessException(DevResponseEnum.IMPORT_DATA_FORMAT_FAIL);
|
||||
return null;
|
||||
} else {
|
||||
cnDevExcelList = excelImportResult.getList();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new BusinessException(DevResponseEnum.IMPORT_DATA_FAIL);
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(cnDevExcelList)) {
|
||||
pqDevService.importCNDev(cnDevExcelList, patternId);
|
||||
}
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@GetMapping("/listUnbound")
|
||||
@ApiOperation("获取指定模式下所有未绑定的设备")
|
||||
@ApiImplicitParam(name = "pattern", value = "模式id", required = true)
|
||||
public HttpResult<List<Map<String, Object>>> listUnbound(@RequestParam("pattern") String pattern) {
|
||||
String methodDescribe = getMethodDescribe("listUnbound");
|
||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, pattern);
|
||||
List<Map<String, Object>> result = pqDevService.listUnbound(pattern);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/listByPlanId")
|
||||
@ApiOperation("根据查询参数查询出所有已绑定的设备")
|
||||
@ApiImplicitParam(name = "planId", value = "计划id", required = true)
|
||||
public HttpResult<List<PqDev>> listByPlanId(@RequestBody @Validated PqDevParam.QueryParam param) {
|
||||
String methodDescribe = getMethodDescribe("listByPlanId");
|
||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, param);
|
||||
List<PqDev> result = pqDevService.listByPlanId(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.UPDATE)
|
||||
@PostMapping("/documented")
|
||||
@ApiOperation("设备归档")
|
||||
@ApiImplicitParam(name = "id", value = "设备id", required = true)
|
||||
public HttpResult<List<PqDev>> documented(@RequestBody List<String> ids) {
|
||||
String methodDescribe = getMethodDescribe("documented");
|
||||
LogUtil.njcnDebug(log, "{},设备id为:{}", methodDescribe, ids);
|
||||
boolean result = pqDevService.documented(ids);
|
||||
if (result) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
// @OperateInfo(operateType = OperateType.UPDATE)
|
||||
// @PostMapping("/bindDev")
|
||||
// @ApiOperation("检测计划绑定设备")
|
||||
// @ApiImplicitParam(name = "bindPlanParam", value = "绑定参数", required = true)
|
||||
// public HttpResult<Object> bindDev(@RequestBody @Validated PqDevParam.BindPlanParam bindPlanParam) {
|
||||
// String methodDescribe = getMethodDescribe("bindDev");
|
||||
// LogUtil.njcnDebug(log, "{},绑定计划数据为:planId={}, pqDevIds={}", methodDescribe, bindPlanParam.getPlanId(), String.join(StrUtil.COMMA, bindPlanParam.getPqDevIds()));
|
||||
// boolean result = pqDevService.bind(bindPlanParam.getPlanId(), bindPlanParam.getPqDevIds());
|
||||
// if (result) {
|
||||
// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
// } else {
|
||||
// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.njcn.gather.device.mapper;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.njcn.gather.device.pojo.po.PqDev;
|
||||
import com.njcn.gather.device.pojo.vo.PreDetection;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @date 2024-11-06
|
||||
*/
|
||||
public interface PqDevMapper extends MPJBaseMapper<PqDev> {
|
||||
|
||||
/**
|
||||
* 根据装置id集合获取装置信息
|
||||
* @param devIds 装置id
|
||||
* @return: java.util.List<com.njcn.gather.device.pojo.vo.PreDetection>
|
||||
* @Author: wr
|
||||
* @Date: 2024/12/12 11:46
|
||||
*/
|
||||
List<PreDetection> selectDevInfo(@Param("devIds") List<String> devIds);
|
||||
|
||||
void finishPlan(@Param("planId")String planId);
|
||||
|
||||
void updateReportState(@Param("id")String id);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
<?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.gather.device.mapper.PqDevMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="DevResultMap" type="com.njcn.gather.device.pojo.vo.PreDetection">
|
||||
<id column="Id" property="devId" />
|
||||
<id column="Name" property="devName" />
|
||||
<id column="IP" property="devIP" />
|
||||
<result column="Port" property="port" />
|
||||
<result column="Dev_Type" property="devType" />
|
||||
<result column="" property="icdType" />
|
||||
<result column="Series" property="devCode" />
|
||||
<result column="Dev_Key" property="devKey" />
|
||||
<result column="icdType" property="icdType" />
|
||||
<result column="Dev_Volt" property="devVolt" />
|
||||
<result column="Dev_Curr" property="devCurr" />
|
||||
|
||||
<collection
|
||||
property="monitorList"
|
||||
column="{ devId = Id}"
|
||||
select="com.njcn.gather.monitor.mapper.PqMonitorMapper.selectMonitorInfo"
|
||||
>
|
||||
</collection>
|
||||
</resultMap>
|
||||
<select id="selectDevInfo" resultMap="DevResultMap">
|
||||
SELECT
|
||||
d.Id,
|
||||
d.Name,
|
||||
d.IP,
|
||||
( select name from pq_dev_type sd where d.Dev_Type= sd.id) as Dev_Type,
|
||||
d.Port,
|
||||
d.Dev_Chns as devChns,
|
||||
d.Series,
|
||||
d.Dev_Key,
|
||||
d.Dev_Volt,
|
||||
d.Dev_Curr,
|
||||
p.name icdType
|
||||
FROM
|
||||
pq_dev d
|
||||
inner join pq_icd_path p on d.Icd_Id = p.id
|
||||
<where>
|
||||
<if test="devIds !=null and devIds.size()!=0">
|
||||
AND d.Id in
|
||||
<foreach collection="devIds" open="(" close=")" item="item" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<update id="finishPlan" >
|
||||
update ad_plan set Test_State = 2 where id = #{planId}
|
||||
</update>
|
||||
|
||||
<update id="updateReportState" >
|
||||
update pq_dev set Report_State = 1 where id = #{id}
|
||||
</update>
|
||||
</mapper>
|
||||
|
||||
@@ -0,0 +1,210 @@
|
||||
package com.njcn.gather.device.pojo.constant;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @date 2024/11/06
|
||||
*/
|
||||
public interface DevValidMessage {
|
||||
|
||||
String ID_NOT_BLANK = "id不能为空,请检查id参数";
|
||||
|
||||
String ID_FORMAT_ERROR = "id格式错误,请检查id参数";
|
||||
|
||||
String PORT_RANGE_ERROR = "端口号范围错误,请检查port参数";
|
||||
|
||||
String NAME_NOT_BLANK = "名称不能为空,请检查name参数";
|
||||
|
||||
String NAME_FORMAT_ERROR = "名称格式错误,请检查name参数";
|
||||
|
||||
String PATTERN_NOT_BLANK = "模式不能为空,请检查pattern参数";
|
||||
|
||||
String DEV_TYPE_NOT_BLANK = "设备类型不能为空,请检查devType参数";
|
||||
|
||||
String DEV_CHNS_NOT_NULL = "设备通道系数不能为空,请检查devChns参数";
|
||||
|
||||
String DEV_VOLT_NOT_NULL = "额定电压不能为空,请检查devVolt参数";
|
||||
|
||||
String DEV_CURR_NOT_NULL = "额定电流不能为空,请检查devCurr参数";
|
||||
|
||||
String MANUFACTURER_NOT_BLANK = "设备厂家不能为空,请检查manufacturer参数";
|
||||
|
||||
String CREATEDATETIME_NOT_NULL = "出厂日期不能为空,请检查producedDate参数";
|
||||
|
||||
String CREATEDATETIME_FORMAT_ERROR = "出厂日期格式错误,请检查createDateTime参数";
|
||||
|
||||
String FACTORYNO_NOT_BLANK = "出厂编号不能为空,请检查factoryNo参数";
|
||||
|
||||
String FIRMWARE_NOT_BLANK = "固件版本不能为空,请检查firmware参数";
|
||||
|
||||
String SOFTWARE_NOT_BLANK = "软件版本不能为空,请检查software参数";
|
||||
|
||||
String PROTOCOL_NOT_BLANK = "通讯协议不能为空,请检查protocol参数";
|
||||
|
||||
String IP_NOT_BLANK = "IP地址不能为空,请检查ip参数";
|
||||
|
||||
String IP_FORMAT_ERROR = "IP地址格式错误,请检查ip参数";
|
||||
|
||||
String PORT_NOT_NULL = "端口号不能为空,请检查port参数";
|
||||
|
||||
String ENCRYPTION_NOT_NULL = "是否为加密版本不能为空,请检查encryption参数";
|
||||
|
||||
String RECHECK_NUM_NOT_NULL = "检测次数不能为空,请检查reCheckNum参数";
|
||||
|
||||
String PLAN_ID_NOT_NULL = "检测计划ID不能为空,请检查planId参数";
|
||||
|
||||
String PQ_DEV_IDS_NOT_NULL = "设备ID集合不能为null,请检查pqDevIds参数";
|
||||
|
||||
String ARRIVE_DATE_FORMAT_ERROR = "送样日期格式错误,请检查arrivedDateTime参数";
|
||||
|
||||
String ENCRYPTION_FLAG_FORMAT_ERROR = "是否为加密版本格式错误,请检查encryptionFlag参数";
|
||||
|
||||
String RECHECK_NUM_FORMAT_ERROR = "检测次数格式错误,请检查recheckNum参数";
|
||||
|
||||
String PATTERN_FORMAT_ERROR = "模式格式错误,请检查pattern参数";
|
||||
|
||||
String SOURCE_IDS_NOT_EMPTY = "检测源ID不能为空,请检查sourceIds参数";
|
||||
|
||||
String SOURCE_ID_FORMAT_ERROR = "检测源ID格式错误,请检查sourceIds参数";
|
||||
|
||||
String DEV_TYPE_FORMAT_ERROR = "设备类型格式错误,请检查devType参数";
|
||||
|
||||
String DEV_CHNS_RANGE_ERROR = "设备通道系数错误,请检查devChns参数";
|
||||
|
||||
String MANUFACTURER_FORMAT_ERROR = "设备厂家格式错误,请检查manufacturer参数";
|
||||
|
||||
String PROTOCOL_FORMAT_ERROR = "通讯协议格式错误,请检查protocol参数";
|
||||
|
||||
String PLAN_ID_FORMAT_ERROR = "检测计划ID格式错误,请检查planId参数";
|
||||
|
||||
String STANDARD_TIME_FORMAT_ERROR = "标准推行时间格式错误,请检查standardTime参数";
|
||||
|
||||
String SCRIPT_TYPE_NOT_BLANK = "检测脚本类型不能为空,请检查scriptType参数";
|
||||
|
||||
String STANDARD_NAME_NOT_BLANK = "参照标准名称不能为空,请检查standardName参数";
|
||||
|
||||
String STANDARD_NAME_FORMAT_ERROR = "参照标准名称格式错误,请检查standardName参数";
|
||||
|
||||
String STANDARD_TIME_NOT_BLANK = "标准推行时间不能为空,请检查standardTime参数";
|
||||
|
||||
String SCRIPT_TYPE_FORMAT_ERROR = "检测脚本类型格式错误,请检查scriptType参数";
|
||||
|
||||
String DEV_LEVEL_NOT_BLANK = "设备等级不能为空,请检查devLevel参数";
|
||||
|
||||
String DEV_LEVEL_FORMAT_ERROR = "设备等级格式错误,请检查devLevel参数";
|
||||
|
||||
String ENABLE_FORMAT_ERROR = "是否启用格式错误,请检查enable参数";
|
||||
|
||||
String ERR_SYS_ID_NOT_BLANK = "误差体系ID不能为空,请检查errSysId参数";
|
||||
|
||||
String ERR_SYS_DTLS_ERROR_TYPE_NOT_BLANK = "误差项类型不能为空,请检查errorType参数";
|
||||
|
||||
String ERR_SYS_DTLS_ERROR_TYPE_FORMAT_ERROR = "误差项类型格式错误,请检查errorType参数";
|
||||
|
||||
String ERR_SYS_DTLS_SCRIPT_TYPE_NOT_BLANK = "脚本项类型不能为空,请检查scriptType参数";
|
||||
|
||||
String ERR_SYS_DTLS_SCRIPT_TYPE_FORMAT_ERROR = "脚本项类型格式错误,请检查scriptType参数";
|
||||
|
||||
String START_VALUE_NOT_NULL = "起始值不能为空,请检查startValue参数";
|
||||
|
||||
String START_FLAG_NOT_NULL = "是否包含起始值不能为空,请检查startFlag参数";
|
||||
|
||||
String END_VALUE_NOT_NULL = "结束值不能为空,请检查endValue参数";
|
||||
|
||||
String END_FLAG_NOT_NULL = "是否包含结束值不能为空,请检查endFlag参数";
|
||||
|
||||
String CONDITION_TYPE_NOT_BLANK = "判断条件类型不能为空,请检查conditionType参数";
|
||||
|
||||
String ERROR_VALUE_FORMAT_ERROR = "误差值格式错误,请检查errorValue参数";
|
||||
|
||||
String MAX_ERROR_VALUE_NOT_NULL = "最大误差值不能为空,请检查maxErrorValue参数";
|
||||
|
||||
String ERROR_VALUE_TYPE_NOT_BLANK = "误差值类型不能为空,请检查errorValueType参数";
|
||||
|
||||
String PQ_SOURCE_TYPE_NOT_BLANK = "检测源类型不能为空,请检查pqSourceType参数";
|
||||
|
||||
String PQ_SOURCE_TYPE_FORMAT_ERROR = "检测源类型格式错误,请检查pqSourceType参数";
|
||||
|
||||
String ENABLE_NOT_NULL = "状态不能为空,请检查enable参数";
|
||||
|
||||
String PQ_SOURCE_NAME_FORMAT_ERROR = "检测源名称格式错误,请检查pqSourceName参数";
|
||||
|
||||
String PQ_SOURCE_PARAMETER_ID_NOT_BLANK = "检测源参数ID不能为空,请检查pqSourceParameterId参数";
|
||||
|
||||
String PQ_SOURCE_PARAMETER_PID_NOT_BLANK = "检测源参数PID不能为空,请检查pqSourceParameterId参数";
|
||||
|
||||
String PQ_SOURCE_PARAMETER_TYPE_NOT_BLANK = "检测源参数类型不能为空,请检查pqSourceParameterType参数";
|
||||
|
||||
String PQ_SOURCE_PARAMETER_REMARK_NOT_BLANK = "检测源参数描述不能为空,请检查pqSourceParameterRemark参数";
|
||||
|
||||
String PQ_SOURCE_PARAMETER_VALUE_NOT_BLANK = "参数值不能为空,请检查pqSourceParameterValue参数";
|
||||
|
||||
String DEV_ID_NOT_BLANK = "设备ID不能为空";
|
||||
|
||||
String DEV_ID_FORMAT_ERROR = "设备ID格式错误";
|
||||
|
||||
String BELONG_LINE_NOT_BLANK = "所属母线不能为空";
|
||||
|
||||
String PT_NOT_NULL = "PT变比不能为空";
|
||||
|
||||
String CT_NOT_NULL = "CT变比不能为空";
|
||||
|
||||
String WIRING_TYPE_NOT_BLANK = "接线方式不能为空";
|
||||
|
||||
String WIRING_TYPE_FORMAT_ERROR = "接线方式格式错误";
|
||||
|
||||
String DATASOURCE_ID_NOT_EMPTY = "数据源ID不能为空";
|
||||
|
||||
String SCRIPT_ID_NOT_BLANK = "检测脚本ID不能为空";
|
||||
|
||||
String SCRIPT_ID_FORMAT_ERROR = "检测脚本ID格式错误";
|
||||
|
||||
String ERROR_SYS_ID_NOT_BLANK = "误差体系ID不能为空";
|
||||
|
||||
String ERROR_SYS_ID_FORMAT_ERROR = "误差体系ID格式错误";
|
||||
|
||||
String TIME_CHECK_NOT_NULL = "守时检测不能为空";
|
||||
|
||||
String TIME_CHECK_FORMAT_ERROR = "守时检测格式错误";
|
||||
|
||||
String TEST_STATE_NOT_NULL = "检测状态不能为空";
|
||||
|
||||
String TEST_STATE_FORMAT_ERROR = "检测状态格式错误";
|
||||
|
||||
String REPORT_STATE_NOT_NULL = "报告生成状态不能为空";
|
||||
|
||||
String REPORT_STATE_FORMAT_ERROR = "报告生成状态格式错误";
|
||||
|
||||
String CHECK_RESULT_STATE_NOT_NULL = "检测结果不能为空";
|
||||
|
||||
String CHECK_RESULT_STATE_FORMAT_ERROR = "检测结果格式错误";
|
||||
|
||||
String CHECK_STATE_FORMAT_ERROR = "检测状态格式错误";
|
||||
|
||||
String CHECK_RESULT_FORMAT_ERROR = "检测结果格式错误";
|
||||
|
||||
String DOCUMENT_STATE_FORMAT_ERROR = "归档状态格式错误";
|
||||
|
||||
String MONITOR_CODE_FORMAT_ERROR = "监测点编码格式错误";
|
||||
|
||||
String MONITOR_NUM_NOT_NULL = "监测点序号不能为空";
|
||||
|
||||
String FACTOR_FLAG_FORMAT_ERROR = "是否支持系数校准格式错误";
|
||||
|
||||
String MONITOR_NUM_FORMAT_ERROR = "监测点序号格式错误";
|
||||
|
||||
String SOURC_NOT_BLANK = "检测源不能为空";
|
||||
|
||||
String DATASOURCE_NOT_BLANK = "数据源不能为空";
|
||||
|
||||
String SCRIPT_NOT_BLANK = "检测脚本不能为空";
|
||||
|
||||
String ERRORSYS_NOT_BLANK = "误差体系不能为空";
|
||||
|
||||
String TIMECHECK_NOT_BLANK = "是否做守时检测不能为空";
|
||||
|
||||
String FACTOR_FLAG_NOT_BLANK = "是否支持系数校准不能为空";
|
||||
|
||||
String CONDITION_TYPE_FORMAT_ERROR = "判断条件类型格式错误,请检查conditionType参数";
|
||||
|
||||
String SORT_NOT_NULL = "排序不能为空";
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.njcn.gather.device.pojo.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @data 2024-12-12
|
||||
*/
|
||||
@Getter
|
||||
public enum CheckResultEnum {
|
||||
NOT_ACCORD("不符合", 0),
|
||||
ACCORD("符合", 1),
|
||||
UNCHECKED("未检", 2);
|
||||
|
||||
private final Integer value;
|
||||
private final String msg;
|
||||
|
||||
CheckResultEnum(String msg, Integer value) {
|
||||
this.msg = msg;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public static String getMsgByValue(Integer value) {
|
||||
for (CheckStateEnum state : CheckStateEnum.values()) {
|
||||
if (state.getValue().equals(value)) {
|
||||
return state.getMsg();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.njcn.gather.device.pojo.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @data 2024-12-12
|
||||
*/
|
||||
@Getter
|
||||
public enum CheckStateEnum {
|
||||
UNCHECKED("未检", 0),
|
||||
CHECKING("检测中", 1),
|
||||
CHECKED("检测完成", 2),
|
||||
/**
|
||||
* 检测计划没有该状态,只有未检、检测中、检测完成三种状态。被检设备有这种状态
|
||||
*/
|
||||
DOCUMENTED("归档", 3);
|
||||
|
||||
private final Integer value;
|
||||
private final String msg;
|
||||
|
||||
CheckStateEnum(String msg, Integer value) {
|
||||
this.msg = msg;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public static String getMsgByValue(Integer value) {
|
||||
for (CheckStateEnum state : CheckStateEnum.values()) {
|
||||
if (state.getValue().equals(value)) {
|
||||
return state.getMsg();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.njcn.gather.device.pojo.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @data 2024-12-13
|
||||
*/
|
||||
@Getter
|
||||
public enum CommonEnum {
|
||||
FATHER_ID("0", "无"),
|
||||
|
||||
NO("0", "否"),
|
||||
YES("1", "是"),
|
||||
|
||||
|
||||
COEFFICIENT_TEST("0","系数校验"),
|
||||
PRE_TEST("1","预检测"),
|
||||
FORMAL_TEST("2","正式检测"),
|
||||
TIME_TEST("3","守时检测"),
|
||||
PHASE_TEST("4","相序检测"),
|
||||
;
|
||||
|
||||
private String value;
|
||||
private String msg;
|
||||
|
||||
CommonEnum(String value, String msg) {
|
||||
this.value = value;
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.njcn.gather.device.pojo.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @data 2024-12-12
|
||||
*/
|
||||
@Getter
|
||||
public enum DevDocumentStateEnum {
|
||||
UNDOCUMENTED("未归档", 0),
|
||||
DOCUMENTED("归档", 1);
|
||||
|
||||
private final Integer value;
|
||||
private final String msg;
|
||||
|
||||
DevDocumentStateEnum(String msg, Integer value) {
|
||||
this.msg = msg;
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.njcn.gather.device.pojo.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @data 2024-12-12
|
||||
*/
|
||||
@Getter
|
||||
public enum DevReportStateEnum {
|
||||
NOT_GENERATED("未生成", 0),
|
||||
GENERATED("已生成", 1),
|
||||
UNCHECKED("未检", 2);
|
||||
|
||||
private final Integer value;
|
||||
private final String msg;
|
||||
|
||||
DevReportStateEnum(String msg, Integer value) {
|
||||
this.msg = msg;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public static String getMsgByValue(Integer value) {
|
||||
for (CheckStateEnum state : CheckStateEnum.values()) {
|
||||
if (state.getValue().equals(value)) {
|
||||
return state.getMsg();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.njcn.gather.device.pojo.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public enum DevResponseEnum {
|
||||
//NAME_REPEAT("A001001", "名称重复"),
|
||||
|
||||
IMPORT_DATA_FAIL("A001002", "导入数据失败"),
|
||||
SERIES_AND_DEVKEY_NOT_BLANK("A001003", "加密设备的序列号和设备密钥不能为空"),
|
||||
PQ_SOURCE_GEN_NAME_ERROR("A001004", "检测源生成名称出错"),
|
||||
ERR_SOURCE_GEN_NAME_ERROR("A001005", "误差体系生成名称出错"),
|
||||
PQ_ERRSYS_GEN_NAME_ERROR("A001005", "误差体系生成名称出错"),
|
||||
PLAN_HAS_DEVICE_BIND("A001006", "检测计划下已绑定设备,请先解绑设备"),
|
||||
PQ_DEV_REPEAT("A001007", "重复的被检设备"),
|
||||
PQ_DEV_HAS_MONITOR("A001008", "该设备下关联有监测点,请先移除监测点"),
|
||||
HAS_NOT_UNCHECKED_DEVICE("A001009", "设备在检测中或已被检测过,请勿解除绑定"),
|
||||
IMPORT_PLAN_DATA_FAIL("A001010", "导入的检测计划为空"),
|
||||
IMPORT_DATA_FORMAT_FAIL("A001011", "导入数据格式错误"),
|
||||
IMPORT_SOURCE_ERROR("A001012","当前模式下一个检测计划只能有一个检测源" ),
|
||||
IMPORT_DATASOURCE_ERROR("A001013","当前模式下一个检测计划只能有一个数据源" ),
|
||||
DEV_UN_CHECKED("A001013","装置还未检测完成!" ),
|
||||
DEV_UN_REPORT("A001013","装置报告未生成!" ),
|
||||
DEVICE_DIS_ERROR("A001014","装置配置异常" ),
|
||||
DEVICE_DELETE("A001015","设备无法删除,已绑定计划! " )
|
||||
|
||||
;
|
||||
|
||||
private final String message;
|
||||
private final String code;
|
||||
|
||||
|
||||
DevResponseEnum(String code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.njcn.gather.device.pojo.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @data 2024-12-14
|
||||
*/
|
||||
@Getter
|
||||
public enum FactorCheckResultEnum {
|
||||
NOT_QUALIFY(0, "不合格"),
|
||||
QUALIFY(1, "合格"),
|
||||
UNKNOWN(2, "/");
|
||||
|
||||
private final Integer value;
|
||||
private final String msg;
|
||||
|
||||
FactorCheckResultEnum(Integer value, String msg) {
|
||||
this.value = value;
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public static String getMsgByValue(Integer value) {
|
||||
for (FactorCheckResultEnum e : FactorCheckResultEnum.values()) {
|
||||
if (e.getValue().equals(value)) {
|
||||
return e.getMsg();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.njcn.gather.device.pojo.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @data 2024-12-12
|
||||
*/
|
||||
@Getter
|
||||
public enum PatternEnum {
|
||||
SIMULATE("Simulate", "模拟式"),
|
||||
DIGITAL("Digital", "数字式"),
|
||||
CONTRAST("Contrast", "比对式");
|
||||
|
||||
private String value;
|
||||
private String msg;
|
||||
|
||||
PatternEnum(String value, String msg) {
|
||||
this.value = value;
|
||||
this.msg = msg;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.njcn.gather.device.pojo.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @data 2024-12-12
|
||||
*/
|
||||
@Getter
|
||||
public enum PlanReportStateEnum {
|
||||
REPORT_STATE_NOT_GENERATED("未生成", 0),
|
||||
REPORT_STATE_PARTIALLY_GENERATED("部分生成", 1),
|
||||
REPORT_STATE_ALL_GENERATED("全部生成", 2);
|
||||
|
||||
private final Integer value;
|
||||
private final String msg;
|
||||
|
||||
PlanReportStateEnum(String msg, Integer value) {
|
||||
this.msg = msg;
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.njcn.gather.device.pojo.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @data 2024-12-14
|
||||
*/
|
||||
@Getter
|
||||
public enum TimeCheckResultEnum {
|
||||
NOT_QUALIFY(0, "不合格"),
|
||||
QUALIFY(1, "合格"),
|
||||
UNKNOWN(2, "/");
|
||||
|
||||
private final Integer value;
|
||||
private final String msg;
|
||||
|
||||
TimeCheckResultEnum(Integer value, String msg) {
|
||||
this.value = value;
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public static String getMsgByValue(Integer value) {
|
||||
for (TimeCheckResultEnum e : TimeCheckResultEnum.values()) {
|
||||
if (e.getValue().equals(value)) {
|
||||
return e.getMsg();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,238 @@
|
||||
package com.njcn.gather.device.pojo.param;
|
||||
|
||||
import com.njcn.common.pojo.constant.PatternRegex;
|
||||
import com.njcn.gather.monitor.pojo.param.PqMonitorParam;
|
||||
import com.njcn.gather.device.pojo.constant.DevValidMessage;
|
||||
import com.njcn.web.pojo.annotation.DateTimeStrValid;
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.hibernate.validator.constraints.Range;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.*;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @date 2024/11/06
|
||||
*/
|
||||
@Data
|
||||
public class PqDevParam {
|
||||
|
||||
@ApiModelProperty(value = "名称", required = true)
|
||||
//@NotBlank(message = DevValidMessage.NAME_NOT_BLANK)
|
||||
//@Pattern(regexp = PatternRegex.DEV_NAME_REGEX, message = DevValidMessage.NAME_FORMAT_ERROR)
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "设备模式,字典表(数字、模拟、比对)", required = true)
|
||||
@NotBlank(message = DevValidMessage.PATTERN_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.PATTERN_FORMAT_ERROR)
|
||||
private String pattern;
|
||||
|
||||
@ApiModelProperty(value = "设备类型,字典表", required = true)
|
||||
@NotBlank(message = DevValidMessage.DEV_TYPE_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.DEV_TYPE_FORMAT_ERROR)
|
||||
private String devType;
|
||||
|
||||
@ApiModelProperty(value = "设备通道数", required = true)
|
||||
@NotNull(message = DevValidMessage.DEV_CHNS_NOT_NULL)
|
||||
@Min(value = 1, message = DevValidMessage.DEV_CHNS_RANGE_ERROR)
|
||||
private Integer devChns;
|
||||
|
||||
@ApiModelProperty(value = "额定电压(V)", required = true)
|
||||
@NotNull(message = DevValidMessage.DEV_VOLT_NOT_NULL)
|
||||
private Float devVolt;
|
||||
|
||||
@ApiModelProperty(value = "额定电流(A)", required = true)
|
||||
@NotNull(message = DevValidMessage.DEV_CURR_NOT_NULL)
|
||||
private Float devCurr;
|
||||
|
||||
@ApiModelProperty(value = "设备厂家,字典表", required = true)
|
||||
//@NotBlank(message = DevValidMessage.MANUFACTURER_NOT_BLANK)
|
||||
//@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.MANUFACTURER_FORMAT_ERROR)
|
||||
private String manufacturer;
|
||||
|
||||
@ApiModelProperty(value = "出厂日期", required = true)
|
||||
//@NotBlank(message = DevValidMessage.CREATEDATETIME_NOT_NULL)
|
||||
//@DateTimeStrValid(format = "yyyy-MM-dd", message = DevValidMessage.CREATEDATETIME_FORMAT_ERROR)
|
||||
private String createDate;
|
||||
|
||||
@ApiModelProperty(value = "设备序列号", required = true)
|
||||
@NotBlank(message = DevValidMessage.FACTORYNO_NOT_BLANK)
|
||||
private String createId;
|
||||
|
||||
@ApiModelProperty(value = "固件版本", required = true)
|
||||
//@NotBlank(message = DevValidMessage.FIRMWARE_NOT_BLANK)
|
||||
private String hardwareVersion;
|
||||
|
||||
@ApiModelProperty(value = "软件版本", required = true)
|
||||
//@NotBlank(message = DevValidMessage.SOFTWARE_NOT_BLANK)
|
||||
private String softwareVersion;
|
||||
|
||||
@ApiModelProperty(value = "通讯协议", required = true)
|
||||
@NotBlank(message = DevValidMessage.PROTOCOL_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.PROTOCOL_FORMAT_ERROR)
|
||||
private String protocol;
|
||||
|
||||
@ApiModelProperty(value = "IP地址", required = true)
|
||||
@NotBlank(message = DevValidMessage.IP_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.IP_REGEX, message = DevValidMessage.IP_FORMAT_ERROR)
|
||||
private String ip;
|
||||
|
||||
@ApiModelProperty(value = "端口号", required = true)
|
||||
@NotNull(message = DevValidMessage.PORT_NOT_NULL)
|
||||
@Range(min = 1, max = 65535, message = DevValidMessage.PORT_RANGE_ERROR)
|
||||
private Integer port;
|
||||
|
||||
@ApiModelProperty(value = "装置是否为加密版本", required = true)
|
||||
@NotNull(message = DevValidMessage.ENCRYPTION_NOT_NULL)
|
||||
@Min(value = 0, message = DevValidMessage.ENCRYPTION_FLAG_FORMAT_ERROR)
|
||||
@Max(value = 1, message = DevValidMessage.ENCRYPTION_FLAG_FORMAT_ERROR)
|
||||
private Integer encryptionFlag;
|
||||
|
||||
@ApiModelProperty("装置识别码(3ds加密)")
|
||||
private String series;
|
||||
|
||||
@ApiModelProperty("装置秘钥(3ds加密)")
|
||||
private String devKey;
|
||||
|
||||
@ApiModelProperty("样品编号")
|
||||
private String sampleId;
|
||||
|
||||
@ApiModelProperty(value = "送样日期")
|
||||
@DateTimeStrValid(message = DevValidMessage.ARRIVE_DATE_FORMAT_ERROR)
|
||||
private String arrivedDate;
|
||||
|
||||
@ApiModelProperty("所属地市名称")
|
||||
private String cityName;
|
||||
|
||||
@ApiModelProperty("所属供电公司名称")
|
||||
private String gdName;
|
||||
|
||||
@ApiModelProperty("所属电站名称")
|
||||
private String subName;
|
||||
|
||||
@ApiModelProperty("报告路径")
|
||||
private String reportPath;
|
||||
|
||||
@ApiModelProperty("设备关键信息二维码")
|
||||
private String qrCode;
|
||||
|
||||
@ApiModelProperty(value = "检测次数,默认为0", required = true)
|
||||
@NotNull(message = DevValidMessage.RECHECK_NUM_NOT_NULL)
|
||||
@Min(value = 0, message = DevValidMessage.RECHECK_NUM_FORMAT_ERROR)
|
||||
private Integer reCheckNum;
|
||||
|
||||
@ApiModelProperty("是否支持系数校准")
|
||||
@Min(value = 0, message = DevValidMessage.FACTOR_FLAG_FORMAT_ERROR)
|
||||
@Max(value = 1, message = DevValidMessage.FACTOR_FLAG_FORMAT_ERROR)
|
||||
private String factorFlag;
|
||||
|
||||
@ApiModelProperty("监测点台账列表")
|
||||
@Valid
|
||||
private List<PqMonitorParam> monitorList;
|
||||
|
||||
@ApiModelProperty("icdId")
|
||||
private String icdId;
|
||||
//
|
||||
// @ApiModelProperty("power")
|
||||
// private String power;
|
||||
|
||||
@ApiModelProperty("预投计划")
|
||||
private String preinvestmentPlan;
|
||||
|
||||
/**
|
||||
* 更新操作实体
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class UpdateParam extends PqDevParam {
|
||||
|
||||
@ApiModelProperty(value = "id", required = true)
|
||||
@NotBlank(message = DevValidMessage.ID_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.ID_FORMAT_ERROR)
|
||||
private String id;
|
||||
|
||||
// @ApiModelProperty("检测状态")
|
||||
// @Min(value = 0, message = DevValidMessage.CHECK_STATE_FORMAT_ERROR)
|
||||
// @Max(value = 3, message = DevValidMessage.CHECK_STATE_FORMAT_ERROR)
|
||||
// private Integer checkState;
|
||||
//
|
||||
// @ApiModelProperty("检测结果")
|
||||
// @Min(value = 0, message = DevValidMessage.CHECK_RESULT_FORMAT_ERROR)
|
||||
// @Max(value = 2, message = DevValidMessage.CHECK_RESULT_FORMAT_ERROR)
|
||||
// private Integer checkResult;
|
||||
//
|
||||
// @ApiModelProperty("报告状态")
|
||||
// @Min(value = 0, message = DevValidMessage.REPORT_STATE_FORMAT_ERROR)
|
||||
// @Max(value = 2, message = DevValidMessage.REPORT_STATE_FORMAT_ERROR)
|
||||
// private Integer reportState;
|
||||
//
|
||||
// @ApiModelProperty("归档状态")
|
||||
// @Min(value = 0, message = DevValidMessage.DOCUMENT_STATE_FORMAT_ERROR)
|
||||
// @Max(value = 1, message = DevValidMessage.DOCUMENT_STATE_FORMAT_ERROR)
|
||||
// private Integer documentState;
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询实体
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class QueryParam extends BaseParam {
|
||||
@ApiModelProperty("名称")
|
||||
// @Pattern(regexp = PatternRegex.DEV_NAME_REGEX, message = DevValidMessage.NAME_FORMAT_ERROR)
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "设备模式,字典表(数字、模拟、比对)")
|
||||
private String pattern;
|
||||
|
||||
@ApiModelProperty("设备厂家")
|
||||
private String manufacturer;
|
||||
|
||||
@ApiModelProperty("检测计划ID")
|
||||
//@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.PLAN_ID_FORMAT_ERROR)
|
||||
private String planId;
|
||||
|
||||
@ApiModelProperty("检测状态列表")
|
||||
private List<
|
||||
@Min(value = 0, message = DevValidMessage.CHECK_STATE_FORMAT_ERROR)
|
||||
@Max(value = 3, message = DevValidMessage.CHECK_STATE_FORMAT_ERROR) Integer> checkStateList;
|
||||
|
||||
@ApiModelProperty("检测结果")
|
||||
@Min(value = 0, message = DevValidMessage.CHECK_RESULT_FORMAT_ERROR)
|
||||
@Max(value = 2, message = DevValidMessage.CHECK_RESULT_FORMAT_ERROR)
|
||||
private Integer checkResult;
|
||||
|
||||
@ApiModelProperty("报告状态")
|
||||
@Min(value = 0, message = DevValidMessage.REPORT_STATE_FORMAT_ERROR)
|
||||
@Max(value = 2, message = DevValidMessage.REPORT_STATE_FORMAT_ERROR)
|
||||
private Integer reportState;
|
||||
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class DeleteParam {
|
||||
@ApiModelProperty(value = "ids")
|
||||
private List<@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.ID_FORMAT_ERROR) String> ids;
|
||||
|
||||
@ApiModelProperty(value = "设备模式,字典表(数字、模拟、比对)", required = true)
|
||||
@NotBlank(message = DevValidMessage.PATTERN_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.PATTERN_FORMAT_ERROR)
|
||||
private String pattern;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class BindPlanParam {
|
||||
@ApiModelProperty("检测计划ID")
|
||||
@NotNull(message = DevValidMessage.PLAN_ID_NOT_NULL)
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.PLAN_ID_FORMAT_ERROR)
|
||||
private String planId;
|
||||
|
||||
@ApiModelProperty("被检设备ID列表")
|
||||
@NotNull(message = DevValidMessage.PQ_DEV_IDS_NOT_NULL)
|
||||
private List<String> pqDevIds;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,219 @@
|
||||
package com.njcn.gather.device.pojo.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.FieldStrategy;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
|
||||
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
|
||||
import com.njcn.db.mybatisplus.bo.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @date 2024/11/06
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("pq_dev")
|
||||
public class PqDev extends BaseEntity implements Serializable {
|
||||
private static final long serialVersionUID = -45763424394344208L;
|
||||
|
||||
/**
|
||||
* 主键装置序号ID
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 设备名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 设备模式,字典表(数字、模拟、比对)
|
||||
*/
|
||||
private String pattern;
|
||||
|
||||
/**
|
||||
* 设备类型,字典表
|
||||
*/
|
||||
private String devType;
|
||||
|
||||
/**
|
||||
* 设备通道数
|
||||
*/
|
||||
private Integer devChns;
|
||||
|
||||
/**
|
||||
* 额定电压(V)
|
||||
*/
|
||||
private Double devVolt;
|
||||
|
||||
/**
|
||||
* 额定电流(A)
|
||||
*/
|
||||
private Double devCurr;
|
||||
|
||||
/**
|
||||
* 设备厂家,字典表
|
||||
*/
|
||||
private String manufacturer;
|
||||
|
||||
/**
|
||||
* 出厂日期
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
@JsonSerialize(using = LocalDateSerializer.class)
|
||||
private LocalDate createDate;
|
||||
|
||||
/**
|
||||
* 设备序列号
|
||||
*/
|
||||
private String createId;
|
||||
|
||||
/**
|
||||
* 固件版本
|
||||
*/
|
||||
private String hardwareVersion;
|
||||
|
||||
/**
|
||||
* 软件版本
|
||||
*/
|
||||
private String softwareVersion;
|
||||
|
||||
/**
|
||||
* 通讯协议,字典表(MMS、PODIF)
|
||||
*/
|
||||
private String protocol;
|
||||
|
||||
/**
|
||||
* IP地址
|
||||
*/
|
||||
private String ip;
|
||||
|
||||
/**
|
||||
* 端口号
|
||||
*/
|
||||
private Integer port;
|
||||
|
||||
/**
|
||||
* 装置是否为加密版本
|
||||
*/
|
||||
private Integer encryptionFlag;
|
||||
|
||||
/**
|
||||
* 装置识别码(3ds加密)
|
||||
*/
|
||||
@TableField(fill = FieldFill.UPDATE)
|
||||
private String series;
|
||||
|
||||
/**
|
||||
* 装置秘钥(3ds加密)
|
||||
*/
|
||||
@TableField(fill = FieldFill.UPDATE)
|
||||
private String devKey;
|
||||
|
||||
/**
|
||||
* 样品编号
|
||||
*/
|
||||
private String sampleId;
|
||||
|
||||
/**
|
||||
* 送样日期
|
||||
*/
|
||||
@TableField(updateStrategy = FieldStrategy.IGNORED)
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
@JsonSerialize(using = LocalDateSerializer.class)
|
||||
private LocalDate arrivedDate;
|
||||
|
||||
/**
|
||||
* 所属地市名称
|
||||
*/
|
||||
private String cityName;
|
||||
|
||||
/**
|
||||
* 所属供电公司名称
|
||||
*/
|
||||
private String gdName;
|
||||
|
||||
/**
|
||||
* 所属电站名称
|
||||
*/
|
||||
private String subName;
|
||||
|
||||
/**
|
||||
* 检测状态
|
||||
*/
|
||||
private Integer checkState;
|
||||
|
||||
/**
|
||||
* 检测结果
|
||||
*/
|
||||
private Integer checkResult;
|
||||
|
||||
/**
|
||||
* 报告状态
|
||||
*/
|
||||
private Integer reportState;
|
||||
|
||||
/**
|
||||
* 报告路径
|
||||
*/
|
||||
private String reportPath;
|
||||
|
||||
/**
|
||||
* 设备关键信息二维码
|
||||
*/
|
||||
private String qrCode;
|
||||
|
||||
/**
|
||||
* 检测次数,默认为0
|
||||
*/
|
||||
@TableField(value = "ReCheck_Num")
|
||||
private Integer reCheckNum;
|
||||
|
||||
/**
|
||||
* 状态:0-删除 1-正常
|
||||
*/
|
||||
private Integer state;
|
||||
|
||||
/**
|
||||
* 检测计划id
|
||||
*/
|
||||
private String planId;
|
||||
|
||||
/**
|
||||
* 守时检测结果(0:不合格, 1:合格)
|
||||
*/
|
||||
private Integer timeCheckResult;
|
||||
|
||||
/**
|
||||
* 是否支持系数校准(0:不支持,1:支持)
|
||||
*/
|
||||
private Integer factorFlag;
|
||||
|
||||
/**
|
||||
* 系数校准结果(0:不合格,1:合格)
|
||||
*/
|
||||
private Integer factorCheckResult;
|
||||
|
||||
private String icdId;
|
||||
|
||||
@TableField("Check_Time")
|
||||
private LocalDateTime checkTime;
|
||||
|
||||
@TableField("Preinvestment_Plan")
|
||||
private String preinvestmentPlan;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.njcn.gather.device.pojo.vo;
|
||||
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import com.njcn.common.pojo.constant.PatternRegex;
|
||||
import com.njcn.gather.device.pojo.constant.DevValidMessage;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.hibernate.validator.constraints.Range;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Pattern;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @data 2025-01-15
|
||||
*/
|
||||
@Data
|
||||
public class CNDevExcel {
|
||||
|
||||
@Excel(name = "预投计划*", width = 20, orderNum = "1")
|
||||
private String preinvestmentPlan;
|
||||
|
||||
@Excel(name = "设备编号*", width = 20, orderNum = "2")
|
||||
@NotBlank(message = DevValidMessage.NAME_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.DEV_NAME_REGEX, message = DevValidMessage.NAME_FORMAT_ERROR)
|
||||
private String name;
|
||||
|
||||
@Excel(name = "设备类型*", width = 20, orderNum = "3")
|
||||
@NotBlank(message = DevValidMessage.DEV_TYPE_NOT_BLANK)
|
||||
private String devType;
|
||||
|
||||
@Excel(name = "通讯协议*", width = 15, orderNum = "4")
|
||||
@NotBlank(message = DevValidMessage.PROTOCOL_NOT_BLANK)
|
||||
private String protocol;
|
||||
|
||||
@Excel(name = "是否加密*", width = 20, replace = {"否_0", "是_1"}, orderNum = "5")
|
||||
@NotNull(message = DevValidMessage.ENCRYPTION_NOT_NULL)
|
||||
private Integer encryptionFlag;
|
||||
|
||||
@Excel(name = "识别码", width = 30, orderNum = "6")
|
||||
private String series;
|
||||
|
||||
@Excel(name = "秘钥", width = 30, orderNum = "7")
|
||||
private String devKey;
|
||||
|
||||
@Excel(name = "是否支持系数校准*", width = 25, replace = {"否_0", "是_1"}, orderNum = "8")
|
||||
private Integer factorFlag;
|
||||
|
||||
@Excel(name = "IP地址*", width = 20, replace = {"否_0", "是_1"}, orderNum = "9")
|
||||
@NotBlank(message = DevValidMessage.IP_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.IP_REGEX, message = DevValidMessage.IP_FORMAT_ERROR)
|
||||
private String ip;
|
||||
|
||||
@Excel(name = "端口号*", width = 15, orderNum = "10")
|
||||
@NotNull(message = DevValidMessage.PORT_NOT_NULL)
|
||||
@Range(min = 1, max = 65535, message = DevValidMessage.PORT_RANGE_ERROR)
|
||||
private Integer port;
|
||||
}
|
||||
@@ -0,0 +1,211 @@
|
||||
package com.njcn.gather.device.pojo.vo;
|
||||
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import cn.afterturn.easypoi.excel.annotation.ExcelCollection;
|
||||
import com.njcn.common.pojo.constant.PatternRegex;
|
||||
import com.njcn.gather.monitor.pojo.vo.PqMonitorExcel;
|
||||
import com.njcn.gather.device.pojo.constant.DevValidMessage;
|
||||
import com.njcn.web.pojo.annotation.DateTimeStrValid;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.hibernate.validator.constraints.Range;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Pattern;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @data 2024/11/7
|
||||
*/
|
||||
@Data
|
||||
public class PqDevExcel implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Excel(name = "名称", width = 20, needMerge = true)
|
||||
@NotBlank(message = DevValidMessage.NAME_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.DEV_NAME_REGEX, message = DevValidMessage.NAME_FORMAT_ERROR)
|
||||
private String name;
|
||||
|
||||
@Excel(name = "设备类型", width = 20, orderNum = "2", needMerge = true)
|
||||
@NotBlank(message = DevValidMessage.DEV_TYPE_NOT_BLANK)
|
||||
private String devType;
|
||||
|
||||
@Excel(name = "设备通道数", width = 20, orderNum = "3", needMerge = true)
|
||||
@NotNull(message = DevValidMessage.DEV_CHNS_NOT_NULL)
|
||||
private Integer devChns;
|
||||
|
||||
@Excel(name = "额定电压(V)", width = 15, orderNum = "4", needMerge = true)
|
||||
@NotNull(message = DevValidMessage.DEV_VOLT_NOT_NULL)
|
||||
private Float devVolt;
|
||||
|
||||
@Excel(name = "额定电流(A)", width = 15, orderNum = "5", needMerge = true)
|
||||
@NotNull(message = DevValidMessage.DEV_CURR_NOT_NULL)
|
||||
private Float devCurr;
|
||||
|
||||
@Excel(name = "设备厂家", width = 20, orderNum = "6", needMerge = true)
|
||||
@NotBlank(message = DevValidMessage.MANUFACTURER_NOT_BLANK)
|
||||
private String manufacturer;
|
||||
|
||||
@Excel(name = "设备序列号", width = 40, orderNum = "8", needMerge = true)
|
||||
@NotBlank(message = DevValidMessage.FACTORYNO_NOT_BLANK)
|
||||
private String createId;
|
||||
|
||||
@Excel(name = "固件版本", width = 15, orderNum = "9", needMerge = true)
|
||||
@NotBlank(message = DevValidMessage.FIRMWARE_NOT_BLANK)
|
||||
private String hardwareVersion;
|
||||
|
||||
@Excel(name = "软件版本", width = 15, orderNum = "10", needMerge = true)
|
||||
@NotBlank(message = DevValidMessage.SOFTWARE_NOT_BLANK)
|
||||
private String softwareVersion;
|
||||
|
||||
@Excel(name = "通讯协议", width = 15, orderNum = "11", needMerge = true)
|
||||
@NotBlank(message = DevValidMessage.PROTOCOL_NOT_BLANK)
|
||||
private String protocol;
|
||||
|
||||
@Excel(name = "IP地址", width = 20, orderNum = "12", needMerge = true)
|
||||
@NotBlank(message = DevValidMessage.IP_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.IP_REGEX, message = DevValidMessage.IP_FORMAT_ERROR)
|
||||
private String ip;
|
||||
|
||||
@Excel(name = "端口号", orderNum = "13", needMerge = true)
|
||||
@NotNull(message = DevValidMessage.PORT_NOT_NULL)
|
||||
@Range(min = 1, max = 65535, message = DevValidMessage.PORT_RANGE_ERROR)
|
||||
private Integer port;
|
||||
|
||||
@Excel(name = "是否为加密版本(否\\是)", width = 20, replace = {"否_0", "是_1"}, orderNum = "14", needMerge = true)
|
||||
@NotNull(message = DevValidMessage.ENCRYPTION_NOT_NULL)
|
||||
private Integer encryptionFlag;
|
||||
|
||||
@Excel(name = "识别码(当为加密版本时必填)", width = 30, orderNum = "15", needMerge = true)
|
||||
private String series;
|
||||
|
||||
@Excel(name = "秘钥(当为加密版本时必填)", width = 30, orderNum = "16", needMerge = true)
|
||||
private String devKey;
|
||||
|
||||
@Excel(name = "所属地市名称", width = 20, orderNum = "19", needMerge = true)
|
||||
private String cityName;
|
||||
|
||||
@Excel(name = "所属供电公司名称", width = 20, orderNum = "20", needMerge = true)
|
||||
private String gdName;
|
||||
|
||||
@Excel(name = "所属电站名称", width = 20, orderNum = "21", needMerge = true)
|
||||
private String subName;
|
||||
|
||||
@Excel(name = "关键信息二维码", width = 20, orderNum = "30", needMerge = true)
|
||||
private String qrCode;
|
||||
|
||||
@Excel(name = "检测次数", width = 15, orderNum = "31", needMerge = true)
|
||||
@NotNull(message = DevValidMessage.RECHECK_NUM_NOT_NULL)
|
||||
private Integer reCheckNum;
|
||||
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class ExportData extends PqDevExcel {
|
||||
|
||||
@Excel(name = "设备模式", width = 20, orderNum = "1", needMerge = true)
|
||||
@NotBlank(message = DevValidMessage.PATTERN_NOT_BLANK)
|
||||
private String pattern;
|
||||
|
||||
@Excel(name = "出厂日期(yyyy-MM-dd)", width = 25, format = "yyyy-MM-dd", orderNum = "7", needMerge = true)
|
||||
@NotNull(message = DevValidMessage.CREATEDATETIME_NOT_NULL)
|
||||
private LocalDate createDate;
|
||||
|
||||
@Excel(name = "是否支持系数校准(否\\是)", width = 15, replace = {"否_0", "是_1"}, orderNum = "22", needMerge = true)
|
||||
private Integer factorFlag;
|
||||
|
||||
@Excel(name = "守时检测结果(不合格\\合格\\/)", replace = {"不合格_0", "合格_1", "/_2"}, width = 15, orderNum = "23", needMerge = true)
|
||||
private Integer timeCheckResult;
|
||||
|
||||
@Excel(name = "系数校准结果(不合格\\合格\\/)", width = 15, replace = {"不合格_0", "合格_1", "/_2"}, orderNum = "24", needMerge = true)
|
||||
private Integer factorCheckResult;
|
||||
|
||||
@Excel(name = "检测状态(未检\\检测中\\检测完成\\归档)", width = 15, replace = {"未检_0", "检测中_1", "检测完成_2", "归档_3"}, orderNum = "25", needMerge = true)
|
||||
private Integer checkState;
|
||||
|
||||
@Excel(name = "检测结果(不符合\\符合\\未检)", width = 15, replace = {"不符合_0", "符合_1", "未检_2"}, orderNum = "26", needMerge = true)
|
||||
private Integer checkResult;
|
||||
|
||||
@Excel(name = "报告状态(未生成\\已生成\\未检)", width = 15, replace = {"未生成_0", "已生成_1", "未检_2"}, orderNum = "27", needMerge = true)
|
||||
private Integer reportState;
|
||||
|
||||
// @Excel(name = "归档状态(未归档\\归档)", width = 15, replace = {"未归档_0", "归档_1"}, orderNum = "28", needMerge = true)
|
||||
// private Integer documentState;
|
||||
|
||||
@Excel(name = "报告路径", width = 20, orderNum = "29", needMerge = true)
|
||||
private String reportPath;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 模拟式和比对式设备导出数据
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class SimulateOrDigitalExportData extends ExportData {
|
||||
@Excel(name = "样品编号", width = 40, orderNum = "17", needMerge = true)
|
||||
private String sampleId;
|
||||
|
||||
@Excel(name = "送样日期(yyyy-MM-dd)", width = 25, format = "yyyy-MM-dd", orderNum = "18", needMerge = true)
|
||||
private LocalDate arrivedDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* 比对式设备导出数据
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class ContrastExportData extends ExportData {
|
||||
@ExcelCollection(name = "检测点台账", orderNum = "32")
|
||||
List<PqMonitorExcel.ExportData> monitorList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 被检设备导入数据
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class ImportData extends PqDevExcel {
|
||||
|
||||
@Excel(name = "出厂日期(yyyy-MM-dd)", width = 25, format = "yyyy-MM-dd", orderNum = "7", needMerge = true)
|
||||
@NotNull(message = DevValidMessage.CREATEDATETIME_NOT_NULL)
|
||||
@DateTimeStrValid(message = DevValidMessage.CREATEDATETIME_FORMAT_ERROR)
|
||||
private String createDate;
|
||||
|
||||
|
||||
@Excel(name = "是否支持系数校准(否\\是)", width = 15, replace = {"否_0", "是_1"}, orderNum = "22", needMerge = true)
|
||||
@NotBlank(message = DevValidMessage.FACTOR_FLAG_NOT_BLANK)
|
||||
private String factorFlag;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 模拟式和比对式设备导入数据
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class SimulateOrDigitalImportData extends ImportData {
|
||||
@Excel(name = "样品编号", width = 40, orderNum = "17", needMerge = true)
|
||||
private String sampleId;
|
||||
|
||||
@Excel(name = "送样日期(yyyy-MM-dd)", width = 25, format = "yyyy-MM-dd", orderNum = "18", needMerge = true)
|
||||
@DateTimeStrValid(message = DevValidMessage.ARRIVE_DATE_FORMAT_ERROR)
|
||||
private String arrivedDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* 对比式设备导入数据
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class ContrastImportData extends ImportData {
|
||||
@ExcelCollection(name = "检测点台账", orderNum = "32")
|
||||
List<PqMonitorExcel.ImportData> monitorList;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
package com.njcn.gather.device.pojo.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
|
||||
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
|
||||
import com.njcn.gather.monitor.pojo.po.PqMonitor;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @data 2024-12-13
|
||||
*/
|
||||
@Data
|
||||
public class PqDevVO {
|
||||
|
||||
private String id;
|
||||
|
||||
private String name;
|
||||
|
||||
private String pattern;
|
||||
|
||||
private String devType;
|
||||
|
||||
private Integer devChns;
|
||||
|
||||
private Float devVolt;
|
||||
|
||||
private Float devCurr;
|
||||
|
||||
private String manufacturer;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
@JsonSerialize(using = LocalDateSerializer.class)
|
||||
private LocalDate createDate;
|
||||
|
||||
private String createId;
|
||||
|
||||
private String hardwareVersion;
|
||||
|
||||
private String softwareVersion;
|
||||
|
||||
private String protocol;
|
||||
|
||||
private String ip;
|
||||
|
||||
private Integer port;
|
||||
|
||||
private Integer encryptionFlag;
|
||||
|
||||
private String series;
|
||||
|
||||
private String devKey;
|
||||
|
||||
private String sampleId;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
@JsonSerialize(using = LocalDateSerializer.class)
|
||||
private LocalDate arrivedDate;
|
||||
|
||||
private String cityName;
|
||||
|
||||
private String gdName;
|
||||
|
||||
private String subName;
|
||||
|
||||
private Integer checkState;
|
||||
|
||||
private Integer checkResult;
|
||||
|
||||
private Integer reportState;
|
||||
|
||||
// private Integer documentState;
|
||||
|
||||
private String reportPath;
|
||||
|
||||
private String qrCode;
|
||||
|
||||
private Integer reCheckNum;
|
||||
|
||||
private List<PqMonitor> monitorList;
|
||||
|
||||
private LocalDateTime checkTime;
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
package com.njcn.gather.device.pojo.vo;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.njcn.gather.util.DeviceUtil;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author wr
|
||||
* @description 预检测装置报文初始化
|
||||
* @date 2024/12/12 11:21
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
public class PreDetection {
|
||||
|
||||
/**
|
||||
* 装置ip
|
||||
*/
|
||||
@JSONField(serialize = false)
|
||||
private String devId;
|
||||
|
||||
/**
|
||||
* 装置ip
|
||||
*/
|
||||
@JSONField(serialize = false)
|
||||
private String devName;
|
||||
|
||||
|
||||
/**
|
||||
* 装置ip
|
||||
*/
|
||||
@JSONField(name = "devIP")
|
||||
private String devIP;
|
||||
|
||||
/**
|
||||
* 装置端口
|
||||
*/
|
||||
@JSONField(name = "port")
|
||||
private Integer port;
|
||||
|
||||
/**
|
||||
* 设备类型,字典表
|
||||
*/
|
||||
@JSONField(name = "devType")
|
||||
private String devType;
|
||||
|
||||
/**
|
||||
* icd设备类型
|
||||
*/
|
||||
@JSONField(name = "icdType")
|
||||
private String icdType;
|
||||
|
||||
/**
|
||||
* 装置识别码(3ds加密)
|
||||
*/
|
||||
@JSONField(name = "devCode")
|
||||
private String devCode;
|
||||
|
||||
/**
|
||||
* 装置秘钥(3ds加密)
|
||||
*/
|
||||
@JSONField(name = "devKey")
|
||||
private String devKey;
|
||||
|
||||
@JSONField(serialize = false)
|
||||
private Integer devChns;
|
||||
|
||||
private Double devVolt;
|
||||
|
||||
private Double devCurr;
|
||||
/**
|
||||
* 监测点信息
|
||||
*/
|
||||
@JSONField(name = "monitorList")
|
||||
private List<MonitorListDTO> monitorList;
|
||||
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
public static class MonitorListDTO {
|
||||
/**
|
||||
* 监测点id
|
||||
*/
|
||||
@JSONField(name = "lineId")
|
||||
private String lineId;
|
||||
|
||||
/**
|
||||
* 监测点线路号
|
||||
*/
|
||||
@JSONField(name = "line")
|
||||
private Integer line;
|
||||
|
||||
/**
|
||||
* 监测点线路号
|
||||
*/
|
||||
@JSONField(name = "pt")
|
||||
private Integer pt;
|
||||
|
||||
/**
|
||||
* 监测点线路号
|
||||
*/
|
||||
@JSONField(name = "pt")
|
||||
private Integer ct;
|
||||
}
|
||||
|
||||
public String getDevKey() {
|
||||
if (StrUtil.isNotBlank(devKey)) {
|
||||
String key = DeviceUtil.decoderString(1, devKey);
|
||||
if (StrUtil.isNotBlank(key)) {
|
||||
return key;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getDevCode() {
|
||||
if (StrUtil.isNotBlank(devCode)) {
|
||||
String code = DeviceUtil.decoderString(1, devCode);
|
||||
if (StrUtil.isNotBlank(code)) {
|
||||
return code;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,210 @@
|
||||
package com.njcn.gather.device.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.gather.device.pojo.enums.TimeCheckResultEnum;
|
||||
import com.njcn.gather.device.pojo.param.PqDevParam;
|
||||
import com.njcn.gather.device.pojo.po.PqDev;
|
||||
import com.njcn.gather.device.pojo.vo.CNDevExcel;
|
||||
import com.njcn.gather.device.pojo.vo.PqDevExcel;
|
||||
import com.njcn.gather.device.pojo.vo.PqDevVO;
|
||||
import com.njcn.gather.device.pojo.vo.PreDetection;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @date 2024/11/06
|
||||
*/
|
||||
public interface IPqDevService extends IService<PqDev> {
|
||||
|
||||
/**
|
||||
* 分页查询被检设备列表
|
||||
*
|
||||
* @param queryParam 查询参数
|
||||
* @return 分页数据,包含被检设备列表
|
||||
*/
|
||||
Page<PqDev> listPqDevs(PqDevParam.QueryParam queryParam);
|
||||
|
||||
/**
|
||||
* 新增被检设备信息
|
||||
*
|
||||
* @param pqDevParam 被检设备信息
|
||||
* @return 新增成功返回true,否则返回false
|
||||
*/
|
||||
boolean addPqDev(PqDevParam pqDevParam);
|
||||
|
||||
/**
|
||||
* 修改被检设备信息
|
||||
*
|
||||
* @param updateParam 被检设备信息
|
||||
* @return 修改成功返回true,否则返回false
|
||||
*/
|
||||
boolean updatePqDev(PqDevParam.UpdateParam updateParam);
|
||||
|
||||
/**
|
||||
* 删除被检设备信息
|
||||
*
|
||||
* @param param 被检设备信息
|
||||
* @return 删除成功返回true,否则返回false
|
||||
*/
|
||||
boolean deletePqDev(PqDevParam.DeleteParam param);
|
||||
|
||||
/**
|
||||
* 批量更新被检设备守时检测结果
|
||||
*
|
||||
* @param ids 被检设备id列表
|
||||
* @param result 守时检测结果
|
||||
* @return 更新成功返回true,否则返回false
|
||||
*/
|
||||
boolean updatePqDevTimeCheckResult(List<String> ids, TimeCheckResultEnum result);
|
||||
|
||||
/**
|
||||
* 获取模拟式||数字式设备导出时所需的数据
|
||||
*
|
||||
* @param queryParam 查询参数
|
||||
* @return
|
||||
*/
|
||||
List<PqDevExcel.SimulateOrDigitalExportData> getSimulateOrDigitExportData(PqDevParam.QueryParam queryParam);
|
||||
|
||||
/**
|
||||
* 获取比对式设备导出时所需的数据
|
||||
*
|
||||
* @param queryParam 查询参数
|
||||
* @return 比对式设备导出时所需的数据
|
||||
*/
|
||||
List<PqDevExcel.ContrastExportData> getContrastExportData(PqDevParam.QueryParam queryParam);
|
||||
|
||||
/**
|
||||
* 下载模板文件
|
||||
*/
|
||||
void downloadTemplate();
|
||||
|
||||
/**
|
||||
* 批量导入被检设备信息
|
||||
*
|
||||
* @param sgEventExcels 批量导入的数据
|
||||
*/
|
||||
void importContrastData(List<PqDevExcel.ContrastImportData> sgEventExcels);
|
||||
|
||||
/**
|
||||
* 批量导入被检设备信息
|
||||
*
|
||||
* @param sgEventExcels 批量导入的数据
|
||||
*/
|
||||
void importSimulateAndDigitalData(List<PqDevExcel.SimulateOrDigitalImportData> sgEventExcels);
|
||||
|
||||
/**
|
||||
* 获取所有未绑定的设备
|
||||
*
|
||||
* @param pattern 模式Id
|
||||
* @return 未绑定的设备列表
|
||||
*/
|
||||
List<Map<String, Object>> listUnbound(String pattern);
|
||||
|
||||
/**
|
||||
* 根据计划id获取绑定的设备
|
||||
*
|
||||
* @param param 计划id
|
||||
* @return 绑定的设备列表
|
||||
*/
|
||||
List<PqDev> listByPlanId(PqDevParam.QueryParam param);
|
||||
|
||||
/**
|
||||
* 绑定计划
|
||||
*
|
||||
* @param planId 计划id
|
||||
* @param devIds 设备id列表
|
||||
* @return 绑定成功返回true,否则返回false
|
||||
*/
|
||||
Integer bind(String planId, List<String> devIds);
|
||||
|
||||
/**
|
||||
* 获取饼图数据
|
||||
*
|
||||
* @param planId 检测计划id
|
||||
* @return 饼图数据
|
||||
*/
|
||||
//List<List<Map<String, Object>>> getPieData(String planId);
|
||||
|
||||
/**
|
||||
* 根据id获取被检设备信息
|
||||
*
|
||||
* @param id 被检设备id
|
||||
* @return
|
||||
*/
|
||||
PqDevVO getPqDevById(String id);
|
||||
|
||||
/**
|
||||
* 获取所有非未检测状态的设备
|
||||
*
|
||||
* @return 所有非未检测状态的设备列表
|
||||
*/
|
||||
List<PqDev> listUnchecked();
|
||||
|
||||
/**
|
||||
* 可视化,各种id回显字典值,解码等操作
|
||||
*
|
||||
* @param sourceList
|
||||
*/
|
||||
void visualize(List<PqDev> sourceList);
|
||||
|
||||
/**
|
||||
* 逆向可视化
|
||||
*/
|
||||
void reverseVisualize(List<PqDev> sourceList);
|
||||
|
||||
/**
|
||||
* 获取装置信息和装置下监测点信息
|
||||
*
|
||||
* @param devIds
|
||||
* @return: java.util.List<com.njcn.gather.device.pojo.vo.PreDetection>
|
||||
* @Author: wr
|
||||
* @Date: 2024/12/12 15:50
|
||||
*/
|
||||
List<PreDetection> getDevInfo(@Param("devIds") List<String> devIds);
|
||||
|
||||
/**
|
||||
* 设备归档操作
|
||||
* @param id 设备id
|
||||
* @return 归档成功返回true,否则返回false
|
||||
*/
|
||||
boolean documented(List<String> id);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 正式监测完成,修改中断状态
|
||||
* @param ids
|
||||
* @param valueType
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
boolean updateResult(List<String> ids,List<String> valueType ,String code);
|
||||
|
||||
void updatePqDevReportState(String devId, int i);
|
||||
|
||||
int countUnReportDev(String planId);
|
||||
|
||||
/**
|
||||
* 导出灿能二楼设备数据
|
||||
*
|
||||
* @param queryParam
|
||||
*/
|
||||
void exportCNDev(PqDevParam.QueryParam queryParam);
|
||||
|
||||
/**
|
||||
* 下载灿能二楼设备模板文件
|
||||
*/
|
||||
void downloadCNDevTemplate();
|
||||
|
||||
/**
|
||||
* 导入灿能二楼设备数据
|
||||
*
|
||||
* @param cnDevExcelList 灿能二楼设备数据列表
|
||||
* @param patternId 模式Id
|
||||
*/
|
||||
void importCNDev(List<CNDevExcel> cnDevExcelList, String patternId);
|
||||
}
|
||||
@@ -0,0 +1,877 @@
|
||||
package com.njcn.gather.device.service.impl;
|
||||
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.poi.PullDown;
|
||||
import com.njcn.db.mybatisplus.constant.DbConstant;
|
||||
import com.njcn.gather.device.mapper.PqDevMapper;
|
||||
import com.njcn.gather.device.pojo.enums.TimeCheckResultEnum;
|
||||
import com.njcn.gather.device.pojo.param.PqDevParam;
|
||||
import com.njcn.gather.device.pojo.po.PqDev;
|
||||
import com.njcn.gather.device.pojo.vo.CNDevExcel;
|
||||
import com.njcn.gather.device.pojo.vo.PqDevExcel;
|
||||
import com.njcn.gather.device.pojo.vo.PqDevVO;
|
||||
import com.njcn.gather.device.pojo.vo.PreDetection;
|
||||
import com.njcn.gather.device.service.IPqDevService;
|
||||
import com.njcn.gather.monitor.pojo.po.PqMonitor;
|
||||
import com.njcn.gather.monitor.pojo.vo.PqMonitorExcel;
|
||||
import com.njcn.gather.monitor.service.IPqMonitorService;
|
||||
import com.njcn.gather.device.pojo.enums.*;
|
||||
import com.njcn.gather.type.entity.DevType;
|
||||
import com.njcn.gather.type.service.IDevTypeService;
|
||||
import com.njcn.gather.storage.service.DetectionDataDealService;
|
||||
import com.njcn.gather.system.config.pojo.po.SysTestConfig;
|
||||
import com.njcn.gather.system.config.service.ISysTestConfigService;
|
||||
import com.njcn.gather.system.dictionary.pojo.po.DictData;
|
||||
import com.njcn.gather.system.dictionary.pojo.po.DictType;
|
||||
import com.njcn.gather.system.dictionary.service.IDictDataService;
|
||||
import com.njcn.gather.system.dictionary.service.IDictTypeService;
|
||||
import com.njcn.gather.util.DeviceUtil;
|
||||
import com.njcn.web.factory.PageFactory;
|
||||
import com.njcn.web.utils.ExcelUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @date 2024/11/06
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements IPqDevService {
|
||||
|
||||
private final IDictDataService dictDataService;
|
||||
private final IPqMonitorService pqMonitorService;
|
||||
private final DetectionDataDealService detectionDataDealService;
|
||||
private final IDevTypeService devTypeService;
|
||||
private final ISysTestConfigService sysTestConfigService;
|
||||
private final IDictTypeService dictTypeService;
|
||||
|
||||
|
||||
@Override
|
||||
public Page<PqDev> listPqDevs(PqDevParam.QueryParam queryParam) {
|
||||
Page<PqDev> page = this.page(new Page<>(PageFactory.getPageNum(queryParam), PageFactory.getPageSize(queryParam)), this.getQueryWrapper(queryParam));
|
||||
page.getRecords().forEach(p -> {
|
||||
if (ObjectUtil.isNotNull(p.getSeries())) {
|
||||
p.setSeries(DeviceUtil.decoderString(1, p.getSeries()));
|
||||
}
|
||||
if (ObjectUtil.isNotNull(p.getDevKey())) {
|
||||
p.setDevKey(DeviceUtil.decoderString(1, p.getDevKey()));
|
||||
}
|
||||
});
|
||||
return page;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public boolean addPqDev(PqDevParam pqDevParam) {
|
||||
this.checkRepeat(pqDevParam, false);
|
||||
|
||||
PqDev pqDev = new PqDev();
|
||||
BeanUtil.copyProperties(pqDevParam, pqDev);
|
||||
if (pqDevParam.getEncryptionFlag() == 1) {
|
||||
if (StrUtil.isNotBlank(pqDevParam.getSeries()) && StrUtil.isNotBlank(pqDevParam.getDevKey())) {
|
||||
pqDev.setSeries(DeviceUtil.encodeString(1, pqDev.getSeries()));
|
||||
pqDev.setDevKey(DeviceUtil.encodeString(1, pqDev.getDevKey()));
|
||||
} else {
|
||||
throw new BusinessException(DevResponseEnum.SERIES_AND_DEVKEY_NOT_BLANK);
|
||||
}
|
||||
}
|
||||
// 新增时默认设置
|
||||
pqDev.setTimeCheckResult(TimeCheckResultEnum.UNKNOWN.getValue());
|
||||
pqDev.setFactorCheckResult(FactorCheckResultEnum.UNKNOWN.getValue());
|
||||
pqDev.setCheckState(CheckStateEnum.UNCHECKED.getValue());
|
||||
pqDev.setReportState(DevReportStateEnum.UNCHECKED.getValue());
|
||||
// pqDev.setDocumentState(DevDocumentStateEnum.UNDOCUMENTED.getValue());
|
||||
pqDev.setCheckResult(CheckResultEnum.UNCHECKED.getValue());
|
||||
String id = UUID.randomUUID().toString().replaceAll("-", "");
|
||||
pqDev.setId(id);
|
||||
// 比对式设备添加监测点
|
||||
if (PatternEnum.CONTRAST.getValue().equals(dictDataService.getDictDataById(pqDevParam.getPattern()).getCode())) {
|
||||
if (ObjectUtil.isNotEmpty(pqDevParam.getMonitorList())) {
|
||||
pqMonitorService.addPqMonitorByDevId(id, pqDevParam.getMonitorList());
|
||||
}
|
||||
}
|
||||
pqDev.setState(DataStateEnum.ENABLE.getCode());
|
||||
return this.save(pqDev);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public boolean updatePqDev(PqDevParam.UpdateParam updateParam) {
|
||||
this.checkRepeat(updateParam, true);
|
||||
|
||||
PqDev pqDev = new PqDev();
|
||||
BeanUtil.copyProperties(updateParam, pqDev);
|
||||
if (pqDev.getEncryptionFlag() == 1) {
|
||||
if (StrUtil.isNotBlank(pqDev.getSeries()) && StrUtil.isNotBlank(pqDev.getDevKey())) {
|
||||
pqDev.setSeries(DeviceUtil.encodeString(1, pqDev.getSeries()));
|
||||
pqDev.setDevKey(DeviceUtil.encodeString(1, pqDev.getDevKey()));
|
||||
} else {
|
||||
throw new BusinessException(DevResponseEnum.SERIES_AND_DEVKEY_NOT_BLANK);
|
||||
}
|
||||
}
|
||||
// 比对式设备修改监测点
|
||||
if (PatternEnum.CONTRAST.getValue().equals(dictDataService.getDictDataById(updateParam.getPattern()).getCode())) {
|
||||
if (ObjectUtil.isNotEmpty(updateParam.getMonitorList())) {
|
||||
pqMonitorService.updatePqMonitorByDevId(updateParam.getId(), updateParam.getMonitorList());
|
||||
}
|
||||
}
|
||||
return this.updateById(pqDev);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public boolean deletePqDev(PqDevParam.DeleteParam param) {
|
||||
if (PatternEnum.CONTRAST.getValue().equals(dictDataService.getDictDataById(param.getPattern()).getCode())) {
|
||||
for (String id : param.getIds()) {
|
||||
if (ObjectUtils.isEmpty(pqMonitorService.listPqMonitorByDevId(id))) {
|
||||
throw new BusinessException(DevResponseEnum.PQ_DEV_HAS_MONITOR);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (CollUtil.isNotEmpty(param.getIds())) {
|
||||
MPJLambdaWrapper<PqDev> queryWrapper = new MPJLambdaWrapper<>();
|
||||
queryWrapper.selectAll(PqDev.class)
|
||||
.selectAs("t1.Name", PqDev::getPlanId)
|
||||
.leftJoin("ad_plan t1 on t1.Id = t.Plan_Id")
|
||||
.in(PqDev::getId, param.getIds())
|
||||
.eq(PqDev::getState, DataStateEnum.ENABLE.getCode());
|
||||
List<PqDev> devList = this.baseMapper.selectJoinList(PqDev.class, queryWrapper);
|
||||
Map<String, List<PqDev>> collect = devList.stream().filter(x -> StrUtil.isNotBlank(x.getPlanId())).collect(Collectors.groupingBy(PqDev::getPlanId));
|
||||
StringBuffer str;
|
||||
if (CollUtil.isNotEmpty(collect)) {
|
||||
str = new StringBuffer();
|
||||
collect.forEach((k, v) -> {
|
||||
str.append(k + ": ");
|
||||
for (int i = 0; i < v.size(); i++) {
|
||||
if ( i==v.size()-1) {
|
||||
str.append(v.get(i).getName());
|
||||
} else {
|
||||
str.append(v.get(i).getName() + ",");
|
||||
}
|
||||
}
|
||||
str.append(" &&");
|
||||
});
|
||||
} else {
|
||||
str = null;
|
||||
}
|
||||
if (ObjectUtil.isNotNull(str)) {
|
||||
throw new BusinessException(DevResponseEnum.DEVICE_DELETE, str.toString());
|
||||
}
|
||||
return this.lambdaUpdate().set(PqDev::getState, DataStateEnum.DELETED.getCode()).in(PqDev::getId, param.getIds()).update();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public boolean updatePqDevTimeCheckResult(List<String> ids, TimeCheckResultEnum result) {
|
||||
return this.lambdaUpdate().set(PqDev::getTimeCheckResult, result.getValue()).in(PqDev::getId, ids).update();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PqDevExcel.SimulateOrDigitalExportData> getSimulateOrDigitExportData(PqDevParam.QueryParam queryParam) {
|
||||
List<PqDev> pqDevs = this.list(this.getQueryWrapper(queryParam));
|
||||
if (ObjectUtil.isNotNull(pqDevs)) {
|
||||
this.visualize(pqDevs);
|
||||
List<PqDevExcel.SimulateOrDigitalExportData> pqDevExcels = BeanUtil.copyToList(pqDevs, PqDevExcel.SimulateOrDigitalExportData.class);
|
||||
return pqDevExcels;
|
||||
} else {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PqDevExcel.ContrastExportData> getContrastExportData(PqDevParam.QueryParam queryParam) {
|
||||
List<PqDev> pqDevs = this.list(this.getQueryWrapper(queryParam));
|
||||
if (ObjectUtil.isNotEmpty(pqDevs)) {
|
||||
this.visualize(pqDevs);
|
||||
List<PqDevExcel.ContrastExportData> pqDevExcels = BeanUtil.copyToList(pqDevs, PqDevExcel.ContrastExportData.class);
|
||||
for (int i = 0; i < pqDevs.size(); i++) {
|
||||
List<PqMonitorExcel.ExportData> monitorExportList = BeanUtil.copyToList(pqMonitorService.listPqMonitorByDevId(pqDevs.get(i).getId()), PqMonitorExcel.ExportData.class);
|
||||
monitorExportList.forEach(monitor -> {
|
||||
monitor.setPtType(dictDataService.getDictDataById(monitor.getPtType()).getName());
|
||||
});
|
||||
pqDevExcels.get(i).setMonitorList(monitorExportList);
|
||||
}
|
||||
return pqDevExcels;
|
||||
} else {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void downloadTemplate() {
|
||||
ExcelUtil.exportExcel("被检设备模板.xlsx", PqDevExcel.ContrastImportData.class, Collections.emptyList());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public void importContrastData(List<PqDevExcel.ContrastImportData> pqDevExcelList) {
|
||||
List<PqDev> devList = new ArrayList<>();
|
||||
List<PqMonitor> monitorList = new ArrayList<>();
|
||||
String patternId = dictDataService.getDictDataByName(PatternEnum.CONTRAST.getMsg()).getId();
|
||||
pqDevExcelList.forEach(pqDevExcel -> {
|
||||
PqDev pqDev = new PqDev();
|
||||
BeanUtil.copyProperties(pqDevExcel, pqDev);
|
||||
pqDev.setId(UUID.randomUUID().toString().replaceAll("-", ""));
|
||||
pqDev.setPattern(patternId);
|
||||
// pqDev.setTimeCheckResult(TimeCheckResultEnum.UNKNOWN.getValue());
|
||||
// pqDev.setFactorCheckResult(FactorCheckResultEnum.UNKNOWN.getValue());
|
||||
// pqDev.setCheckState(CheckStateEnum.UNCHECKED.getValue());
|
||||
// pqDev.setReportState(DevReportStateEnum.UNCHECKED.getValue());
|
||||
// pqDev.setDocumentState(DevDocumentStateEnum.UNDOCUMENTED.getValue());
|
||||
// pqDev.setCheckResult(CheckResultEnum.UNCHECKED.getValue());
|
||||
devList.add(pqDev);
|
||||
|
||||
// 新增与被检设备绑定的监测点
|
||||
List<PqMonitor> monitors = pqDevExcel.getMonitorList().stream()
|
||||
.map(monitor -> {
|
||||
PqMonitor monitorPo = new PqMonitor();
|
||||
BeanUtil.copyProperties(monitor, monitorPo);
|
||||
monitorPo.setId(UUID.randomUUID().toString().replaceAll("-", ""));
|
||||
monitorPo.setDevId(pqDev.getId());
|
||||
monitorPo.setPtType(dictDataService.getDictDataByName(monitor.getPtType()).getId());
|
||||
return monitorPo;
|
||||
}).collect(Collectors.toList());
|
||||
monitorList.addAll(monitors);
|
||||
});
|
||||
|
||||
//逆向可视化
|
||||
this.reverseVisualize(devList);
|
||||
this.saveBatch(devList);
|
||||
|
||||
pqMonitorService.saveBatch(monitorList);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public void importSimulateAndDigitalData(List<PqDevExcel.SimulateOrDigitalImportData> pqDevExcelList) {
|
||||
List<PqDev> pqDevList = BeanUtil.copyToList(pqDevExcelList, PqDev.class);
|
||||
//逆向可视化
|
||||
this.reverseVisualize(pqDevList);
|
||||
this.saveBatch(pqDevList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> listUnbound(String pattern) {
|
||||
List<PqDev> pqDevList = this.lambdaQuery()
|
||||
.eq(PqDev::getPattern, pattern)
|
||||
.eq(PqDev::getState, DataStateEnum.ENABLE.getCode())
|
||||
.isNull(PqDev::getPlanId)
|
||||
.orderByAsc(PqDev::getCreateTime).list();
|
||||
List<Map<String, Object>> result = pqDevList.stream().map(pqDev -> {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("id", pqDev.getId());
|
||||
map.put("name", pqDev.getName());
|
||||
return map;
|
||||
}).collect(Collectors.toList());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PqDev> listByPlanId(PqDevParam.QueryParam param) {
|
||||
if (StrUtil.isBlank(param.getPlanId())) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<PqDev> pqDevList = this.lambdaQuery()
|
||||
.eq(PqDev::getPlanId, param.getPlanId())
|
||||
.like(StrUtil.isNotBlank(param.getName()), PqDev::getName, param.getName())
|
||||
.in(ObjectUtil.isNotEmpty(param.getCheckStateList()), PqDev::getCheckState, param.getCheckStateList())
|
||||
.eq(ObjectUtil.isNotNull(param.getCheckResult()), PqDev::getCheckResult, param.getCheckResult())
|
||||
.eq(ObjectUtil.isNotNull(param.getCheckResult()), PqDev::getCheckResult, param.getCheckResult())
|
||||
.eq(ObjectUtil.isNotNull(param.getReportState()), PqDev::getReportState, param.getReportState())
|
||||
.eq(PqDev::getState, DataStateEnum.ENABLE.getCode())
|
||||
.orderByAsc(PqDev::getCreateTime)
|
||||
.list();
|
||||
// List<Map<String, Object>> result = pqDevList.stream().map(pqDev -> {
|
||||
// Map<String, Object> map = new HashMap<>();
|
||||
// map.put("id", pqDev.getId());
|
||||
// map.put("name", pqDev.getName());
|
||||
// return map;
|
||||
// }).collect(Collectors.toList());
|
||||
return pqDevList;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public Integer bind(String planId, List<String> devIds) {
|
||||
//先将这个绑定的计划全部剔除掉
|
||||
this.lambdaUpdate().set(PqDev::getPlanId, null).eq(PqDev::getPlanId, planId).update();
|
||||
//然后进行状态绑定
|
||||
if (ObjectUtil.isNotEmpty(devIds)) {
|
||||
this.lambdaUpdate().set(PqDev::getPlanId, planId).in(PqDev::getId, devIds).update();
|
||||
List<PqDev> list = this.list(new LambdaQueryWrapper<PqDev>().in(PqDev::getId, devIds));
|
||||
//判断是否有处了未检的其他设备
|
||||
List<Integer> notUnchecked = list.stream().map(PqDev::getCheckState).filter(x -> !x.equals(CheckStateEnum.UNCHECKED.getValue())).distinct().collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(notUnchecked)) {
|
||||
List<Integer> unchecked = list.stream().map(PqDev::getCheckState).filter(x -> x.equals(CheckStateEnum.UNCHECKED.getValue())).distinct().collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(unchecked)) {
|
||||
return CheckStateEnum.CHECKING.getValue();
|
||||
}
|
||||
List<Integer> checking = list.stream().map(PqDev::getCheckState).filter(x -> x.equals(CheckStateEnum.CHECKING.getValue())).distinct().collect(Collectors.toList());
|
||||
if (checking.size() == notUnchecked.size()) {
|
||||
return CheckStateEnum.CHECKING.getValue();
|
||||
}
|
||||
List<Integer> checked = list.stream().map(PqDev::getCheckState).filter(x -> x.equals(CheckStateEnum.CHECKED.getValue()) ||
|
||||
x.equals(CheckStateEnum.DOCUMENTED.getValue())
|
||||
).distinct().collect(Collectors.toList());
|
||||
if (checked.size() == notUnchecked.size()) {
|
||||
return CheckStateEnum.CHECKED.getValue();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return CheckStateEnum.UNCHECKED.getValue();
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public List getPieData(String planId) {
|
||||
// List<PqDev> pqDevList = this.lambdaQuery().eq(PqDev::getPlanId, planId).eq(PqDev::getState, DataStateEnum.ENABLE.getCode()).list();
|
||||
// Map<Integer, Long> checkStateMap = pqDevList.stream().collect(Collectors.groupingBy(PqDev::getCheckState, Collectors.counting()));
|
||||
// Map<Integer, Long> checkResultMap = pqDevList.stream().collect(Collectors.groupingBy(PqDev::getCheckResult, Collectors.counting()));
|
||||
// Map<Integer, Long> reportStateMap = pqDevList.stream().collect(Collectors.groupingBy(PqDev::getReportState, Collectors.counting()));
|
||||
//
|
||||
// List<Map<String, Object>> checkStateData = getCheckStatePieData(checkStateMap);
|
||||
// List<Map<String, Object>> checkResultData = getCheckResultPieData(checkResultMap);
|
||||
// List<Map<String, Object>> reportStateData = getReportStatePieData(reportStateMap);
|
||||
//
|
||||
// List<List<Map<String, Object>>> result = new ArrayList<>();
|
||||
// result.add(checkStateData);
|
||||
// result.add(checkResultData);
|
||||
// result.add(reportStateData);
|
||||
// return result;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public PqDevVO getPqDevById(String id) {
|
||||
PqDev pqDev = this.getById(id);
|
||||
PqDevVO pqDevVO = new PqDevVO();
|
||||
BeanUtil.copyProperties(pqDev, pqDevVO);
|
||||
List<PqMonitor> monitorList = pqMonitorService.listPqMonitorByDevId(id);
|
||||
if (ObjectUtil.isNotEmpty(monitorList)) {
|
||||
pqDevVO.setMonitorList(monitorList);
|
||||
}
|
||||
return pqDevVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PqDev> listUnchecked() {
|
||||
return this.lambdaQuery()
|
||||
.eq(PqDev::getCheckState, CheckStateEnum.UNCHECKED.getValue())
|
||||
.eq(PqDev::getState, DataStateEnum.ENABLE.getCode())
|
||||
.orderByAsc(PqDev::getCreateTime).list();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visualize(List<PqDev> sourceList) {
|
||||
sourceList.forEach(pqDev -> {
|
||||
if (StrUtil.isNotBlank(pqDev.getPattern())) {
|
||||
DictData dictData = dictDataService.getDictDataById(pqDev.getPattern());
|
||||
if (ObjectUtil.isNotNull(dictData)) {
|
||||
pqDev.setPattern(dictData.getName());
|
||||
}
|
||||
}
|
||||
if (StrUtil.isNotBlank(pqDev.getDevType())) {
|
||||
DevType devType = devTypeService.getById(pqDev.getDevType());
|
||||
if (ObjectUtil.isNotNull(devType)) {
|
||||
pqDev.setDevType(devType.getName());
|
||||
}
|
||||
}
|
||||
if (StrUtil.isNotBlank(pqDev.getManufacturer())) {
|
||||
DictData dictData = dictDataService.getDictDataById(pqDev.getManufacturer());
|
||||
if (ObjectUtil.isNotNull(dictData)) {
|
||||
pqDev.setManufacturer(dictData.getName());
|
||||
}
|
||||
}
|
||||
if (StrUtil.isNotBlank(pqDev.getProtocol())) {
|
||||
DictData dictData = dictDataService.getDictDataById(pqDev.getProtocol());
|
||||
if (ObjectUtil.isNotNull(dictData)) {
|
||||
pqDev.setProtocol(dictData.getName());
|
||||
}
|
||||
}
|
||||
if (StrUtil.isNotBlank(pqDev.getSeries())) {
|
||||
pqDev.setSeries(DeviceUtil.decoderString(1, pqDev.getSeries()));
|
||||
}
|
||||
if (StrUtil.isNotBlank(pqDev.getDevKey())) {
|
||||
pqDev.setDevKey(DeviceUtil.decoderString(1, pqDev.getDevKey()));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reverseVisualize(List<PqDev> sourceList) {
|
||||
sourceList.forEach(pqDev -> {
|
||||
// if (StrUtil.isNotBlank(pqDev.getPattern())) {
|
||||
// DictData dictData = dictDataService.getDictDataByName(pqDev.getPattern());
|
||||
// if (ObjectUtil.isNotNull(dictData)) {
|
||||
// pqDev.setPattern(dictData.getId());
|
||||
// }
|
||||
// }
|
||||
if (StrUtil.isNotBlank(pqDev.getDevType())) {
|
||||
DevType devType = devTypeService.getById(pqDev.getDevType());
|
||||
if (ObjectUtil.isNotNull(devType)) {
|
||||
pqDev.setDevType(devType.getName());
|
||||
}
|
||||
}
|
||||
if (StrUtil.isNotBlank(pqDev.getManufacturer())) {
|
||||
DictData dictData = dictDataService.getDictDataByName(pqDev.getManufacturer());
|
||||
if (ObjectUtil.isNotNull(dictData)) {
|
||||
pqDev.setManufacturer(dictData.getId());
|
||||
}
|
||||
}
|
||||
if (StrUtil.isNotBlank(pqDev.getProtocol())) {
|
||||
DictData dictData = dictDataService.getDictDataByName(pqDev.getProtocol());
|
||||
if (ObjectUtil.isNotNull(dictData)) {
|
||||
pqDev.setProtocol(dictData.getId());
|
||||
}
|
||||
}
|
||||
if (StrUtil.isNotBlank(pqDev.getSeries())) {
|
||||
pqDev.setSeries(DeviceUtil.encodeString(1, pqDev.getSeries()));
|
||||
}
|
||||
if (StrUtil.isNotBlank(pqDev.getDevKey())) {
|
||||
pqDev.setDevKey(DeviceUtil.encodeString(1, pqDev.getDevKey()));
|
||||
}
|
||||
pqDev.setState(DataStateEnum.ENABLE.getCode());
|
||||
pqDev.setTimeCheckResult(TimeCheckResultEnum.UNKNOWN.getValue());
|
||||
pqDev.setFactorCheckResult(FactorCheckResultEnum.UNKNOWN.getValue());
|
||||
pqDev.setCheckState(CheckStateEnum.UNCHECKED.getValue());
|
||||
pqDev.setReportState(DevReportStateEnum.UNCHECKED.getValue());
|
||||
// pqDev.setDocumentState(DevDocumentStateEnum.UNDOCUMENTED.getValue());
|
||||
pqDev.setCheckResult(CheckResultEnum.UNCHECKED.getValue());
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取查询条件wrapper
|
||||
*
|
||||
* @param queryParam 查询条件
|
||||
* @return
|
||||
*/
|
||||
private Wrapper getQueryWrapper(PqDevParam.QueryParam queryParam) {
|
||||
QueryWrapper<PqDev> queryWrapper = new QueryWrapper<>();
|
||||
if (ObjectUtil.isNotNull(queryParam)) {
|
||||
queryWrapper
|
||||
.like(StrUtil.isNotBlank(queryParam.getName()), "pq_dev.name", queryParam.getName())
|
||||
.eq(StrUtil.isNotBlank(queryParam.getPattern()), "pq_dev.pattern", queryParam.getPattern())
|
||||
.eq(StrUtil.isNotBlank(queryParam.getManufacturer()), "pq_dev.manufacturer", queryParam.getManufacturer())
|
||||
.between(ObjectUtil.isAllNotEmpty(queryParam.getSearchBeginTime(), queryParam.getSearchEndTime()), "pq_dev.Create_Date", queryParam.getSearchBeginTime(), queryParam.getSearchEndTime());
|
||||
//排序
|
||||
if (ObjectUtil.isAllNotEmpty(queryParam.getSortBy(), queryParam.getOrderBy())) {
|
||||
queryWrapper.orderBy(true, queryParam.getOrderBy().equals(DbConstant.ASC), StrUtil.toUnderlineCase(queryParam.getSortBy()));
|
||||
}
|
||||
}
|
||||
queryWrapper.eq("pq_dev.state", DataStateEnum.ENABLE.getCode()).orderBy(true, true, "pq_dev.Create_Time");
|
||||
return queryWrapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PreDetection> getDevInfo(List<String> devIds) {
|
||||
List<PreDetection> preDetections = this.baseMapper.selectDevInfo(devIds);
|
||||
if (devIds.size() != preDetections.size()) {
|
||||
throw new BusinessException(DevResponseEnum.DEVICE_DIS_ERROR);
|
||||
}
|
||||
|
||||
for (PreDetection preDetection : preDetections) {
|
||||
List<PreDetection.MonitorListDTO> monitorList = preDetection.getMonitorList();
|
||||
if (CollUtil.isEmpty(monitorList)) {
|
||||
PreDetection.MonitorListDTO monitorListDTO;
|
||||
for (int i = 1; i <= preDetection.getDevChns(); i++) {
|
||||
monitorListDTO = new PreDetection.MonitorListDTO();
|
||||
monitorListDTO.setLineId(preDetection.getDevIP() + "_" + i);
|
||||
monitorListDTO.setLine(i);
|
||||
monitorListDTO.setPt(1);
|
||||
monitorListDTO.setCt(1);
|
||||
monitorList.add(monitorListDTO);
|
||||
}
|
||||
preDetection.setMonitorList(monitorList);
|
||||
}
|
||||
}
|
||||
return preDetections;
|
||||
}
|
||||
|
||||
@Override
|
||||
// @Transactional(rollbackFor = {Exception.class})
|
||||
public boolean documented(List<String> ids) {
|
||||
if (CollUtil.isNotEmpty(ids)) {
|
||||
for (String id : ids) {
|
||||
// 只有检测完成的设备才可以进行归档
|
||||
PqDev pqDev = this.getById(id);
|
||||
if (ObjectUtil.isNotNull(pqDev)) {
|
||||
if (!pqDev.getCheckState().equals(CheckStateEnum.CHECKED.getValue())) {
|
||||
throw new BusinessException(DevResponseEnum.DEV_UN_CHECKED);
|
||||
}
|
||||
if (!pqDev.getReportState().equals(DevReportStateEnum.GENERATED.getValue())) {
|
||||
throw new BusinessException(DevResponseEnum.DEV_UN_REPORT);
|
||||
}
|
||||
boolean update = this.lambdaUpdate()
|
||||
.set(PqDev::getCheckState, CheckStateEnum.DOCUMENTED.getValue())
|
||||
.eq(PqDev::getId, id)
|
||||
.update();
|
||||
if (update) {
|
||||
// 判断计划下所有设备是否都已归档,如果是则将计划改为已完成
|
||||
// 查询该计划下所有设备的检测状态,是否有不为归档的
|
||||
LambdaQueryWrapper<PqDev> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(PqDev::getPlanId, pqDev.getPlanId())
|
||||
.eq(PqDev::getState, DataStateEnum.ENABLE.getCode())
|
||||
.ne(PqDev::getCheckState, CheckStateEnum.DOCUMENTED.getValue());
|
||||
int count = this.count(queryWrapper);
|
||||
if (count == 0) {
|
||||
// 如果非归档状态的设备数量为0,则更新计划已完成
|
||||
this.baseMapper.finishPlan(pqDev.getPlanId());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw new BusinessException(DevResponseEnum.DEV_UN_CHECKED);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean updateResult(List<String> ids, List<String> valueType, String code) {
|
||||
if (CollUtil.isNotEmpty(ids)) {
|
||||
SysTestConfig config = sysTestConfigService.getOneConfig();
|
||||
Map<String, Integer> result = detectionDataDealService.devResult(ids, valueType, code);
|
||||
List<PqDev> list = this.list(new LambdaQueryWrapper<PqDev>().in(PqDev::getId, ids));
|
||||
for (PqDev pqDev : list) {
|
||||
if (result.containsKey(pqDev.getId())) {
|
||||
Integer checkState;
|
||||
if (pqDev.getReCheckNum() >= config.getMaxTime()) {
|
||||
// 装置报告生成 todo...
|
||||
this.baseMapper.updateReportState(pqDev.getId());
|
||||
// 装置归档
|
||||
checkState = CheckStateEnum.DOCUMENTED.getValue();
|
||||
} else {
|
||||
checkState = CheckStateEnum.CHECKED.getValue();
|
||||
}
|
||||
this.update(new LambdaUpdateWrapper<PqDev>()
|
||||
.set(PqDev::getReCheckNum, pqDev.getReCheckNum() + 1)
|
||||
.set(PqDev::getCheckState, checkState)
|
||||
.set(PqDev::getCheckResult, result.get(pqDev.getId()))
|
||||
.set(PqDev::getCheckTime, LocalDateTime.now())
|
||||
.set(PqDev::getReportState, DevReportStateEnum.NOT_GENERATED.getValue())
|
||||
.eq(PqDev::getId, pqDev.getId()));
|
||||
|
||||
if (pqDev.getCheckState().equals(CheckStateEnum.DOCUMENTED.getValue())) {
|
||||
// 判断计划下所有设备是否都已归档,如果是则将计划改为已完成
|
||||
// 查询该计划下所有设备的检测状态,是否有不为归档的
|
||||
LambdaQueryWrapper<PqDev> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(PqDev::getPlanId, pqDev.getPlanId())
|
||||
.eq(PqDev::getState, DataStateEnum.ENABLE.getCode())
|
||||
.ne(PqDev::getCheckState, CheckStateEnum.DOCUMENTED.getValue());
|
||||
int count = this.count(queryWrapper);
|
||||
if (count == 0) {
|
||||
// 如果非归档状态的设备数量为0,则更新计划已完成
|
||||
this.baseMapper.finishPlan(pqDev.getPlanId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updatePqDevReportState(String devId, int reportState) {
|
||||
LambdaUpdateWrapper<PqDev> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.eq(PqDev::getId, devId)
|
||||
.set(PqDev::getReportState, reportState);
|
||||
this.update(updateWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int countUnReportDev(String planId) {
|
||||
// 查询该计划下所有设备的检测状态,是否有未生成的
|
||||
LambdaQueryWrapper<PqDev> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(PqDev::getPlanId, planId)
|
||||
.eq(PqDev::getState, DataStateEnum.ENABLE.getCode())
|
||||
.ne(PqDev::getReportState, DevReportStateEnum.GENERATED.getValue());
|
||||
return this.count(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exportCNDev(PqDevParam.QueryParam queryParam) {
|
||||
List<PqDev> pqDevs = this.list(this.getQueryWrapper(queryParam));
|
||||
List<CNDevExcel> pqDevExcels = null;
|
||||
if (ObjectUtil.isNotEmpty(pqDevs)) {
|
||||
this.visualizeCNDev(pqDevs);
|
||||
pqDevExcels = BeanUtil.copyToList(pqDevs, CNDevExcel.class);
|
||||
}
|
||||
|
||||
ExcelUtil.exportExcelPullDown(new ExportParams(), "被检设备导出数据.xlsx", this.getCNDevPullDownList(), CNDevExcel.class, ObjectUtil.isEmpty(pqDevExcels) ? new ArrayList<>() : pqDevExcels);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void downloadCNDevTemplate() {
|
||||
ExcelUtil.exportExcelPullDown(new ExportParams(), "被检设备模板.xlsx", this.getCNDevPullDownList(), CNDevExcel.class, new ArrayList<>());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void importCNDev(List<CNDevExcel> cnDevExcelList, String patternId) {
|
||||
List<PqDev> oldDevList = BeanUtil.copyToList(cnDevExcelList, PqDev.class);
|
||||
//逆向可视化
|
||||
this.reverseVisualizeCNDev(oldDevList);
|
||||
|
||||
List<PqDev> newDevList = new ArrayList<>();
|
||||
PqDevParam param = new PqDevParam.UpdateParam();
|
||||
oldDevList.forEach(pqDev -> {
|
||||
|
||||
pqDev.setCreateId(pqDev.getName());
|
||||
pqDev.setTimeCheckResult(TimeCheckResultEnum.UNKNOWN.getValue());
|
||||
pqDev.setFactorCheckResult(FactorCheckResultEnum.UNKNOWN.getValue());
|
||||
pqDev.setCheckState(CheckStateEnum.UNCHECKED.getValue());
|
||||
pqDev.setReportState(DevReportStateEnum.UNCHECKED.getValue());
|
||||
pqDev.setCheckResult(CheckResultEnum.UNCHECKED.getValue());
|
||||
pqDev.setPattern(patternId);
|
||||
pqDev.setState(DataStateEnum.ENABLE.getCode());
|
||||
|
||||
if (pqDev.getEncryptionFlag() == 1) {
|
||||
if (StrUtil.isNotBlank(pqDev.getSeries()) && StrUtil.isNotBlank(pqDev.getDevKey())) {
|
||||
pqDev.setSeries(DeviceUtil.encodeString(1, pqDev.getSeries()));
|
||||
pqDev.setDevKey(DeviceUtil.encodeString(1, pqDev.getDevKey()));
|
||||
} else {
|
||||
throw new BusinessException(DevResponseEnum.SERIES_AND_DEVKEY_NOT_BLANK);
|
||||
}
|
||||
}
|
||||
|
||||
String name = pqDev.getName();
|
||||
if (name.contains("-")) {
|
||||
String[] split = name.split("-");
|
||||
if (split.length == 2) {
|
||||
long start = Long.parseLong(split[0]);
|
||||
long end = Long.parseLong(split[1]);
|
||||
// 避免起始大于结束
|
||||
if (start > end) {
|
||||
long temp = start;
|
||||
start = end;
|
||||
end = temp;
|
||||
}
|
||||
for (long i = start; i <= end; i++) {
|
||||
PqDev dev = new PqDev();
|
||||
BeanUtil.copyProperties(pqDev, dev);
|
||||
dev.setName(String.valueOf(i));
|
||||
dev.setCreateId(String.valueOf(i));
|
||||
|
||||
param.setName(dev.getName());
|
||||
param.setCreateId(dev.getName());
|
||||
param.setDevType(dev.getDevType());
|
||||
this.checkRepeat(param, false);
|
||||
|
||||
long count = newDevList.stream().filter(d -> d.getName().equals(dev.getName())).count();
|
||||
if (count == 0) {
|
||||
newDevList.add(dev);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw new BusinessException(DevResponseEnum.IMPORT_DATA_FORMAT_FAIL);
|
||||
}
|
||||
} else {
|
||||
|
||||
param.setName(pqDev.getName());
|
||||
param.setCreateId(pqDev.getCreateId());
|
||||
param.setDevType(pqDev.getDevType());
|
||||
this.checkRepeat(param, false);
|
||||
|
||||
long count = newDevList.stream().filter(dev -> dev.getName().equals(pqDev.getName())).count();
|
||||
if (count == 0) {
|
||||
newDevList.add(pqDev);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
this.saveBatch(newDevList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取检测状态饼状图数据
|
||||
*
|
||||
* @param map 检测状态分组map
|
||||
* @return 检测状态饼状图数据
|
||||
*/
|
||||
// private List<Map<String, Object>> getCheckStatePieData(Map<Integer, Long> map) {
|
||||
// List<Map<String, Object>> result = new ArrayList<>();
|
||||
// for (CheckStateEnum e : CheckStateEnum.values()) {
|
||||
// Map<String, Object> temp = new HashMap<>();
|
||||
// temp.put("name", e.getMsg());
|
||||
// temp.put("value", map.getOrDefault(e.getValue(), 0L));
|
||||
// result.add(temp);
|
||||
// }
|
||||
// return result;
|
||||
// }
|
||||
|
||||
/**
|
||||
* 获取检测结果饼状图数据
|
||||
*
|
||||
* @param map 检测结果分组map
|
||||
* @return 检测结果饼状图数据
|
||||
*/
|
||||
// private List<Map<String, Object>> getCheckResultPieData(Map<Integer, Long> map) {
|
||||
// List<Map<String, Object>> result = new ArrayList<>();
|
||||
// for (CheckResultEnum e : CheckResultEnum.values()) {
|
||||
// Map<String, Object> temp = new HashMap<>();
|
||||
// temp.put("name", e.getMsg());
|
||||
// temp.put("value", map.getOrDefault(e.getValue(), 0L));
|
||||
// result.add(temp);
|
||||
// }
|
||||
// return result;
|
||||
// }
|
||||
|
||||
/**
|
||||
* 获取报告状态饼状图数据
|
||||
*
|
||||
* @param map 报告状态分组map
|
||||
* @return 报告状态饼状图数据
|
||||
*/
|
||||
// private List<Map<String, Object>> getReportStatePieData(Map<Integer, Long> map) {
|
||||
// List<Map<String, Object>> result = new ArrayList<>();
|
||||
// for (DevReportStateEnum e : DevReportStateEnum.values()) {
|
||||
// Map<String, Object> temp = new HashMap<>();
|
||||
// temp.put("name", e.getMsg());
|
||||
// temp.put("value", map.getOrDefault(e.getValue(), 0L));
|
||||
// result.add(temp);
|
||||
// }
|
||||
// return result;
|
||||
// }
|
||||
|
||||
/**
|
||||
* 检查设备是否重复
|
||||
*
|
||||
* @param param 设备参数
|
||||
* @param isExcludeSelf 是否排除自己
|
||||
*/
|
||||
private void checkRepeat(PqDevParam param, boolean isExcludeSelf) {
|
||||
QueryWrapper<PqDev> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper
|
||||
.eq("state", DataStateEnum.ENABLE.getCode())
|
||||
.eq("Dev_Type", param.getDevType())
|
||||
.and(q -> q.eq("name", param.getName()).or()
|
||||
.eq("Create_Id", param.getCreateId())); //设备序列号重复
|
||||
// .eq("pattern", param.getPattern())
|
||||
// .eq("manufacturer", param.getManufacturer())
|
||||
// .eq("Dev_Type", param.getDevType()).or()
|
||||
if (isExcludeSelf) {
|
||||
if (param instanceof PqDevParam.UpdateParam) {
|
||||
queryWrapper.ne("id", ((PqDevParam.UpdateParam) param).getId());
|
||||
}
|
||||
}
|
||||
int count = this.count(queryWrapper);
|
||||
if (count > 0) {
|
||||
throw new BusinessException(DevResponseEnum.PQ_DEV_REPEAT);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private List<PullDown> getCNDevPullDownList() {
|
||||
List<PullDown> pullDowns = new ArrayList<>();
|
||||
// 预投计划
|
||||
List<DictData> dictDataList = null;
|
||||
PullDown pullDown = null;
|
||||
|
||||
DictType dictType = dictTypeService.getByCode("Preinvestment_Plan");
|
||||
if (ObjectUtil.isNotNull(dictType)) {
|
||||
dictDataList = dictDataService.getDictDataByTypeId(dictType.getId());
|
||||
|
||||
pullDown = new PullDown();
|
||||
pullDown.setFirstCol(0);
|
||||
pullDown.setLastCol(0);
|
||||
pullDown.setStrings(dictDataList.stream().map(DictData::getName).collect(Collectors.toList()));
|
||||
pullDowns.add(pullDown);
|
||||
}
|
||||
|
||||
// 设备类型
|
||||
List<DevType> devTypeList = devTypeService.listAll();
|
||||
pullDown = new PullDown();
|
||||
pullDown.setFirstCol(2);
|
||||
pullDown.setLastCol(2);
|
||||
pullDown.setStrings(devTypeList.stream().map(DevType::getName).collect(Collectors.toList()));
|
||||
pullDowns.add(pullDown);
|
||||
|
||||
|
||||
// 通讯协议
|
||||
dictType = dictTypeService.getByCode("Protocol");
|
||||
if (ObjectUtil.isNotNull(dictType)) {
|
||||
dictDataList = dictDataService.getDictDataByTypeId(dictType.getId());
|
||||
|
||||
pullDown = new PullDown();
|
||||
pullDown.setFirstCol(3);
|
||||
pullDown.setLastCol(3);
|
||||
pullDown.setStrings(dictDataList.stream().map(DictData::getName).collect(Collectors.toList()));
|
||||
pullDowns.add(pullDown);
|
||||
}
|
||||
|
||||
// 是否加密
|
||||
pullDown = new PullDown();
|
||||
pullDown.setFirstCol(4);
|
||||
pullDown.setLastCol(4);
|
||||
pullDown.setStrings(Arrays.asList("是", "否"));
|
||||
pullDowns.add(pullDown);
|
||||
|
||||
|
||||
// 是否支持系数校准
|
||||
pullDown = new PullDown();
|
||||
pullDown.setFirstCol(7);
|
||||
pullDown.setLastCol(7);
|
||||
pullDown.setStrings(Arrays.asList("是", "否"));
|
||||
pullDowns.add(pullDown);
|
||||
|
||||
return pullDowns;
|
||||
}
|
||||
|
||||
/**
|
||||
* 可视化-灿能二楼设备
|
||||
*
|
||||
* @param pqDevs
|
||||
*/
|
||||
private void visualizeCNDev(List<PqDev> pqDevs) {
|
||||
pqDevs.forEach(pqDev -> {
|
||||
pqDev.setPreinvestmentPlan(dictDataService.getDictDataById(pqDev.getPreinvestmentPlan()).getName());
|
||||
pqDev.setDevType(devTypeService.getById(pqDev.getDevType()).getName());
|
||||
pqDev.setProtocol(dictDataService.getDictDataById(pqDev.getProtocol()).getName());
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 逆向可视化-灿能二楼设备
|
||||
*
|
||||
* @param pqDevs
|
||||
*/
|
||||
public void reverseVisualizeCNDev(List<PqDev> pqDevs) {
|
||||
pqDevs.forEach(pqDev -> {
|
||||
pqDev.setPreinvestmentPlan(dictDataService.getDictDataByName(pqDev.getPreinvestmentPlan()).getId());
|
||||
DevType devType = devTypeService.getByName(pqDev.getDevType());
|
||||
pqDev.setDevType(devType.getId());
|
||||
pqDev.setIcdId(devType.getIcd());
|
||||
pqDev.setDevVolt(devType.getDevVolt());
|
||||
pqDev.setDevCurr(devType.getDevCurr());
|
||||
pqDev.setDevChns(devType.getDevChns());
|
||||
pqDev.setProtocol(dictDataService.getDictDataByName(pqDev.getProtocol()).getId());
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,143 @@
|
||||
package com.njcn.gather.err.controller;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.constant.OperateType;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.LogUtil;
|
||||
import com.njcn.gather.err.pojo.param.PqErrSysParam;
|
||||
import com.njcn.gather.err.pojo.po.PqErrSys;
|
||||
import com.njcn.gather.err.pojo.vo.PqErrSysDtlsVO;
|
||||
import com.njcn.gather.err.service.IPqErrSysService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import com.njcn.web.utils.HttpResultUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @date 2024-11-27
|
||||
*/
|
||||
@Slf4j
|
||||
@Api(tags = "误差体系管理")
|
||||
@RestController
|
||||
@RequestMapping("/pqErrSys")
|
||||
@RequiredArgsConstructor
|
||||
public class PqErrSysController extends BaseController {
|
||||
private final IPqErrSysService pqErrSysService;
|
||||
|
||||
@OperateInfo
|
||||
@PostMapping("/list")
|
||||
@ApiOperation("分页查询误差体系")
|
||||
@ApiImplicitParam(name = "param", value = "查询参数", required = true)
|
||||
public HttpResult<Page<PqErrSys>> list(@RequestBody @Validated PqErrSysParam.QueryParam param) {
|
||||
String methodDescribe = getMethodDescribe("list");
|
||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, param);
|
||||
Page<PqErrSys> result = pqErrSysService.listPqErrSys(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo
|
||||
@GetMapping("/getById")
|
||||
@ApiOperation("根据id查询误差体系")
|
||||
@ApiImplicitParam(name = "id", value = "查询参数", required = true)
|
||||
public HttpResult<PqErrSys> getPqErrSysById(@RequestParam("id") String id) {
|
||||
String methodDescribe = getMethodDescribe("getById");
|
||||
LogUtil.njcnDebug(log, "{},查询ID为:{}", methodDescribe, id);
|
||||
PqErrSys result = pqErrSysService.getPqErrSysById(id);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(operateType = OperateType.ADD)
|
||||
@PostMapping("/add")
|
||||
@ApiOperation("新增误差体系")
|
||||
@ApiImplicitParam(name = "param", value = "误差体系", required = true)
|
||||
public HttpResult<Object> add(@RequestBody @Validated PqErrSysParam param) {
|
||||
String methodDescribe = getMethodDescribe("add");
|
||||
LogUtil.njcnDebug(log, "{},新增数据为:{}", methodDescribe, param);
|
||||
boolean result = pqErrSysService.addPqErrSys(param);
|
||||
if (result) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
@OperateInfo(operateType = OperateType.UPDATE)
|
||||
@PostMapping("/update")
|
||||
@ApiOperation("修改误差体系")
|
||||
@ApiImplicitParam(name = "param", value = "误差体系", required = true)
|
||||
public HttpResult<Object> update(@RequestBody @Validated PqErrSysParam.UpdateParam param) {
|
||||
String methodDescribe = getMethodDescribe("update");
|
||||
LogUtil.njcnDebug(log, "{},修改数据为:{}", methodDescribe, param);
|
||||
boolean result = pqErrSysService.updatePqErrSys(param);
|
||||
if (result) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
@OperateInfo(operateType = OperateType.DELETE)
|
||||
@PostMapping("/delete")
|
||||
@ApiOperation("删除误差体系")
|
||||
@ApiImplicitParam(name = "ids", value = "误差体系id", required = true)
|
||||
public HttpResult<Object> delete(@RequestBody List<String> ids) {
|
||||
String methodDescribe = getMethodDescribe("delete");
|
||||
LogUtil.njcnDebug(log, "{},删除ID数据为:{}", methodDescribe, String.join(StrUtil.COMMA, ids));
|
||||
boolean result = pqErrSysService.deletePqErrSys(ids);
|
||||
if (result) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
@OperateInfo()
|
||||
@GetMapping("/getDetail")
|
||||
@ApiOperation("查看误差体系项详情")
|
||||
@ApiImplicitParam(name = "id", value = "误差体系id", required = true)
|
||||
public HttpResult<List<PqErrSysDtlsVO>> getDetail(@RequestParam("id") String id) {
|
||||
String methodDescribe = getMethodDescribe("getDetail");
|
||||
LogUtil.njcnDebug(log, "{},查看ID为:{}", methodDescribe, id);
|
||||
List<PqErrSysDtlsVO> result = pqErrSysService.getDetail(id);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo
|
||||
@GetMapping("/getAll")
|
||||
@ApiOperation("获取所有误差体系")
|
||||
public HttpResult<List<Map<String, Object>>> getAllPqErrSys() {
|
||||
String methodDescribe = getMethodDescribe("getAllPqErrSys");
|
||||
LogUtil.njcnDebug(log, "{}", methodDescribe);
|
||||
List<Map<String, Object>> result = pqErrSysService.listAllPqErrSys();
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
// @OperateInfo(operateType = OperateType.ADD)
|
||||
// @GetMapping("/copy")
|
||||
// @ApiOperation("复制误差体系")
|
||||
// @ApiImplicitParam(name = "id", value = "误差体系id", required = true)
|
||||
// public HttpResult<Object> copy(@RequestParam("id") String id) {
|
||||
// String methodDescribe = getMethodDescribe("copy");
|
||||
// LogUtil.njcnDebug(log, "{},复制ID为:{}", methodDescribe, id);
|
||||
// boolean result = pqErrSysService.copyPqErrSys(id);
|
||||
// if (result) {
|
||||
// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
// } else {
|
||||
// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.njcn.gather.err.mapper;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.njcn.gather.err.pojo.po.PqErrSysDtls;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @date 2024-11-27
|
||||
*/
|
||||
public interface PqErrSysDtlsMapper extends MPJBaseMapper<PqErrSysDtls> {
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.njcn.gather.err.mapper;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.njcn.gather.err.pojo.po.PqErrSys;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @date 2024-11-27
|
||||
*/
|
||||
public interface PqErrSysMapper extends MPJBaseMapper<PqErrSys> {
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
<?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.gather.err.mapper.PqErrSysDtlsMapper">
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
<?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.gather.err.mapper.PqErrSysMapper">
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.njcn.gather.err.pojo.param;
|
||||
|
||||
import com.njcn.common.pojo.constant.PatternRegex;
|
||||
import com.njcn.gather.device.pojo.constant.DevValidMessage;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Pattern;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @data 2024-11-21
|
||||
*/
|
||||
@Data
|
||||
public class PqErrSysDtlsParam {
|
||||
|
||||
@ApiModelProperty(value = "误差项类型", required = true)
|
||||
@NotBlank(message = DevValidMessage.ERR_SYS_DTLS_ERROR_TYPE_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.ERR_SYS_DTLS_ERROR_TYPE_FORMAT_ERROR)
|
||||
private String errorType;
|
||||
|
||||
@ApiModelProperty(value = "脚本项类型", required = true)
|
||||
@NotBlank(message = DevValidMessage.ERR_SYS_DTLS_SCRIPT_TYPE_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.ERR_SYS_DTLS_SCRIPT_TYPE_FORMAT_ERROR)
|
||||
private String scriptType;
|
||||
|
||||
@ApiModelProperty(value = "误差判断起始值", required = true)
|
||||
private Double startValue;
|
||||
|
||||
@ApiModelProperty(value = "是否包含起始值", required = true)
|
||||
private Integer startFlag;
|
||||
|
||||
@ApiModelProperty(value = "误差判断结束值", required = true)
|
||||
private Double endValue;
|
||||
|
||||
@ApiModelProperty(value = "是否包含结束值", required = true)
|
||||
private Integer endFlag;
|
||||
|
||||
// @ApiModelProperty(value = "单位", required = true)
|
||||
// @NotBlank(message = DeviceValidMessage.UNIT_NOT_BLANK)
|
||||
// @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DeviceValidMessage.UNIT_FORMAT_ERROR)
|
||||
// private String unit;
|
||||
|
||||
@ApiModelProperty(value = "判断条件值类型", required = true)
|
||||
private Integer conditionType;
|
||||
|
||||
@ApiModelProperty(value = "最大值误差", required = true)
|
||||
@NotNull(message = DevValidMessage.MAX_ERROR_VALUE_NOT_NULL)
|
||||
private Double maxErrorValue;
|
||||
|
||||
@ApiModelProperty(value = "误差值类型", required = true)
|
||||
@NotNull(message = DevValidMessage.ERROR_VALUE_TYPE_NOT_BLANK)
|
||||
private Integer errorValueType;
|
||||
|
||||
@ApiModelProperty("排序")
|
||||
@NotNull(message = DevValidMessage.SORT_NOT_NULL)
|
||||
private Integer sort;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package com.njcn.gather.err.pojo.param;
|
||||
|
||||
import com.njcn.common.pojo.constant.PatternRegex;
|
||||
import com.njcn.gather.device.pojo.constant.DevValidMessage;
|
||||
import com.njcn.web.pojo.annotation.DateTimeStrValid;
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.*;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @data 2024-11-27
|
||||
*/
|
||||
@Data
|
||||
public class PqErrSysParam {
|
||||
|
||||
@ApiModelProperty(value = "参照标准名称", required = true)
|
||||
@NotBlank(message = DevValidMessage.STANDARD_NAME_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.ERR_SYS_NAME, message = DevValidMessage.STANDARD_NAME_FORMAT_ERROR)
|
||||
private String standardName;
|
||||
|
||||
@ApiModelProperty(value = "标准实施年份", required = true)
|
||||
@NotBlank(message = DevValidMessage.STANDARD_TIME_NOT_BLANK)
|
||||
@DateTimeStrValid(format = "yyyy", message = DevValidMessage.STANDARD_TIME_FORMAT_ERROR)
|
||||
private String standardTime;
|
||||
|
||||
@ApiModelProperty(value = "设备等级", required = true)
|
||||
@NotBlank(message = DevValidMessage.DEV_LEVEL_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.DEV_LEVEL_FORMAT_ERROR)
|
||||
private String devLevel;
|
||||
|
||||
@ApiModelProperty("状态")
|
||||
@NotNull(message = DevValidMessage.ENABLE_NOT_NULL)
|
||||
@Min(value = 0, message = DevValidMessage.ENABLE_FORMAT_ERROR)
|
||||
@Max(value = 1, message = DevValidMessage.ENABLE_FORMAT_ERROR)
|
||||
private Integer enable;
|
||||
|
||||
@ApiModelProperty(value = "误差详情列表", required = true)
|
||||
@Valid
|
||||
private List<PqErrSysDtlsParam> pqErrSysDtlsList;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public static class QueryParam extends BaseParam {
|
||||
@ApiModelProperty("标准实施年份")
|
||||
@DateTimeStrValid(format = "yyyy", message = DevValidMessage.STANDARD_TIME_FORMAT_ERROR)
|
||||
private String standardTime;
|
||||
|
||||
@ApiModelProperty("设备等级")
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.DEV_LEVEL_FORMAT_ERROR)
|
||||
private String devLevel;
|
||||
}
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public static class UpdateParam extends PqErrSysParam {
|
||||
@ApiModelProperty("id")
|
||||
@NotBlank(message = DevValidMessage.ID_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.ID_FORMAT_ERROR)
|
||||
private String id;
|
||||
}
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public static class DetectionParam{
|
||||
@ApiModelProperty("所属误差体系ID")
|
||||
private String errorSysId;
|
||||
|
||||
@ApiModelProperty("总检测脚本中的测试项序号")
|
||||
private Integer index;
|
||||
|
||||
@ApiModelProperty("所属检测脚本")
|
||||
private String scriptId;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.njcn.gather.err.pojo.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
|
||||
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
|
||||
import com.njcn.db.mybatisplus.bo.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @date 2024-11-27
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("pq_err_sys")
|
||||
public class PqErrSys extends BaseEntity implements Serializable {
|
||||
private static final long serialVersionUID = -90836093088362651L;
|
||||
/**
|
||||
* 误差体系ID
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 误差体系名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 参照标准名称
|
||||
*/
|
||||
private String standardName;
|
||||
|
||||
/**
|
||||
* 标准推行时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
@JsonSerialize(using = LocalDateSerializer.class)
|
||||
private LocalDate standardTime;
|
||||
|
||||
/**
|
||||
* 设备等级,字典表
|
||||
*/
|
||||
private String devLevel;
|
||||
|
||||
/**
|
||||
* 状态:0-不启用 1-启用
|
||||
*/
|
||||
private Integer enable;
|
||||
|
||||
/**
|
||||
* 状态:0-删除 1-正常
|
||||
*/
|
||||
private Integer state;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<PqErrSysDtls> pqErrSysDtlsList;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
package com.njcn.gather.err.pojo.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @date 2024-11-27
|
||||
*/
|
||||
@Data
|
||||
@TableName("pq_err_sys_dtls")
|
||||
public class PqErrSysDtls implements Serializable {
|
||||
private static final long serialVersionUID = -52777336589097027L;
|
||||
/**
|
||||
* 误差体系子表ID
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 所属误差体系ID
|
||||
*/
|
||||
private String errorSysId;
|
||||
|
||||
/**
|
||||
* 误差项类型
|
||||
*/
|
||||
private String errorType;
|
||||
|
||||
/**
|
||||
* 脚本项类型
|
||||
*/
|
||||
private String scriptType;
|
||||
|
||||
/**
|
||||
* 脚本项类型Code
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String scriptCode;
|
||||
|
||||
/**
|
||||
* 误差判断起始值
|
||||
*/
|
||||
private Double startValue;
|
||||
|
||||
/**
|
||||
* 是否包含起始值(0> 1>= 2无)
|
||||
*/
|
||||
private Integer startFlag;
|
||||
|
||||
/**
|
||||
* 误差判断结束值
|
||||
*/
|
||||
private Double endValue;
|
||||
|
||||
/**
|
||||
* 是否包含结束值
|
||||
*/
|
||||
private Integer endFlag;
|
||||
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
// private String unit;
|
||||
|
||||
/**
|
||||
* 判断条件值类型(包括值类型,绝对值、相对值)
|
||||
*/
|
||||
private Integer conditionType;
|
||||
|
||||
/**
|
||||
* 误差最大值
|
||||
*/
|
||||
@TableField("Max_Error_Value")
|
||||
private Double maxErrorValue;
|
||||
|
||||
/**
|
||||
* 误差值类型
|
||||
*/
|
||||
private Integer errorValueType;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.njcn.gather.err.pojo.vo;
|
||||
|
||||
import com.njcn.gather.err.pojo.po.PqErrSysDtls;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @date 2024-11-27
|
||||
*/
|
||||
@Data
|
||||
public class ErrDtlsCheckDataVO implements Serializable {
|
||||
|
||||
/**
|
||||
* Id
|
||||
*/
|
||||
private String checkDataId;
|
||||
|
||||
|
||||
private String valueType;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private String valueTypeCode;
|
||||
|
||||
/**
|
||||
* 值
|
||||
*/
|
||||
private Double value;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private List<PqErrSysDtls> errSysDtls;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.njcn.gather.err.pojo.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @data 2024-12-02
|
||||
*/
|
||||
@Data
|
||||
public class PqErrSysDtlsVO {
|
||||
/**
|
||||
* 列1
|
||||
*/
|
||||
private String col1;
|
||||
|
||||
/**
|
||||
* 列2
|
||||
*/
|
||||
private String col2;
|
||||
|
||||
/**
|
||||
* 装置等级
|
||||
*/
|
||||
private String devLevel;
|
||||
|
||||
/**
|
||||
* 测量类型
|
||||
*/
|
||||
private String testType;
|
||||
|
||||
/**
|
||||
* 测量条件 & 最大误差
|
||||
*/
|
||||
private List<Map<String, Object>> info;
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.njcn.gather.err.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.gather.err.pojo.param.PqErrSysDtlsParam;
|
||||
import com.njcn.gather.err.pojo.param.PqErrSysParam;
|
||||
import com.njcn.gather.err.pojo.po.PqErrSysDtls;
|
||||
import com.njcn.gather.err.pojo.vo.ErrDtlsCheckDataVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @date 2024-11-27
|
||||
*/
|
||||
public interface IPqErrSysDtlsService extends IService<PqErrSysDtls> {
|
||||
|
||||
/**
|
||||
* 根据误差体系id查询误差详情
|
||||
* @param pqErrSysId 误差体系id
|
||||
* @return
|
||||
*/
|
||||
List<PqErrSysDtls> listPqErrSysDtlsByPqErrSysId(String pqErrSysId);
|
||||
|
||||
/**
|
||||
* 新增误差详情
|
||||
* @param pqErrSysId 误差体系id
|
||||
* @param list 新增参数
|
||||
* @return 成功返回true,失败返回false
|
||||
*/
|
||||
boolean addPqErrSysDtls(String pqErrSysId, List<PqErrSysDtlsParam> list);
|
||||
|
||||
/**
|
||||
* 更新误差详情
|
||||
* @param pqErrSysId 误差体系id
|
||||
* @param list 更新参数
|
||||
* @return 成功返回true,失败返回false
|
||||
*/
|
||||
boolean updatePqErrSysDtls(String pqErrSysId, List<PqErrSysDtlsParam> list);
|
||||
|
||||
/**
|
||||
* 根据误差体系id删除误差详情
|
||||
* @param pqErrSysIds
|
||||
* @return 成功返回true,失败返回false
|
||||
*/
|
||||
boolean deletePqErrSysDtlsByPqErrSysId(List<String> pqErrSysIds);
|
||||
|
||||
/**
|
||||
* 根据误差体系id查询误差详情
|
||||
* @param param 误差体系id
|
||||
* @return
|
||||
*/
|
||||
List<PqErrSysDtls> listPqErrSysDtlsByPqErrSysIdAndTypes(PqErrSysParam.DetectionParam param);
|
||||
|
||||
/**
|
||||
* 根据查询误差体系
|
||||
* @param param 误差体系id
|
||||
* @return
|
||||
*/
|
||||
List<ErrDtlsCheckDataVO> listByPqErrSysIdAndTypes(PqErrSysParam.DetectionParam param);
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package com.njcn.gather.err.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.gather.err.pojo.param.PqErrSysParam;
|
||||
import com.njcn.gather.err.pojo.po.PqErrSys;
|
||||
import com.njcn.gather.err.pojo.vo.PqErrSysDtlsVO;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @date 2024-11-27
|
||||
*/
|
||||
public interface IPqErrSysService extends IService<PqErrSys> {
|
||||
|
||||
/**
|
||||
* 分页查询误差体系列表
|
||||
*
|
||||
* @param param 分页查询参数
|
||||
* @return 分页查询结果
|
||||
*/
|
||||
Page<PqErrSys> listPqErrSys(PqErrSysParam.QueryParam param);
|
||||
|
||||
/**
|
||||
* 根据id查询误差体系
|
||||
*
|
||||
* @param id id
|
||||
* @return 误差体系
|
||||
*/
|
||||
PqErrSys getPqErrSysById(String id);
|
||||
|
||||
/**
|
||||
* 新增误差体系
|
||||
*
|
||||
* @param param 新增参数
|
||||
* @return 成功返回true,失败返回false
|
||||
*/
|
||||
boolean addPqErrSys(PqErrSysParam param);
|
||||
|
||||
/**
|
||||
* 更新误差体系
|
||||
*
|
||||
* @param param 更新参数
|
||||
* @return 成功返回true,失败返回false
|
||||
*/
|
||||
boolean updatePqErrSys(PqErrSysParam.UpdateParam param);
|
||||
|
||||
/**
|
||||
* 删除误差体系
|
||||
*
|
||||
* @param ids id列表
|
||||
* @return 成功返回true,失败返回false
|
||||
*/
|
||||
boolean deletePqErrSys(List<String> ids);
|
||||
|
||||
List<PqErrSysDtlsVO> getDetail(String id);
|
||||
|
||||
/**
|
||||
* 获取所有误差体系
|
||||
*
|
||||
* @return 误差体系列表
|
||||
*/
|
||||
List<Map<String, Object>> listAllPqErrSys();
|
||||
|
||||
/**
|
||||
* 根据误差体系名称查询误差体系
|
||||
*
|
||||
* @param name 误差体系名称
|
||||
* @return 误差体系
|
||||
*/
|
||||
PqErrSys getPqErrSysByName(String name);
|
||||
|
||||
/**
|
||||
* 复制误差体系
|
||||
*
|
||||
* @param id 误差体系id
|
||||
* @return 成功返回true,失败返回false
|
||||
*/
|
||||
//boolean copyPqErrSys(String id);
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
package com.njcn.gather.err.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.njcn.gather.err.mapper.PqErrSysDtlsMapper;
|
||||
import com.njcn.gather.err.pojo.param.PqErrSysDtlsParam;
|
||||
import com.njcn.gather.err.pojo.param.PqErrSysParam;
|
||||
import com.njcn.gather.err.pojo.po.PqErrSysDtls;
|
||||
import com.njcn.gather.err.pojo.vo.ErrDtlsCheckDataVO;
|
||||
import com.njcn.gather.err.service.IPqErrSysDtlsService;
|
||||
import com.njcn.gather.script.pojo.param.PqScriptCheckDataParam;
|
||||
import com.njcn.gather.script.pojo.po.PqScriptCheckData;
|
||||
import com.njcn.gather.script.service.IPqScriptCheckDataService;
|
||||
import com.njcn.gather.system.dictionary.pojo.po.DictTree;
|
||||
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.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @date 2024-11-27
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class PqErrSysDtlsServiceImpl extends ServiceImpl<PqErrSysDtlsMapper, PqErrSysDtls> implements IPqErrSysDtlsService {
|
||||
|
||||
private final IPqScriptCheckDataService pqScriptCheckDataService;
|
||||
|
||||
|
||||
@Override
|
||||
public List<PqErrSysDtls> listPqErrSysDtlsByPqErrSysId(String pqErrSysId) {
|
||||
return this.lambdaQuery().eq(PqErrSysDtls::getErrorSysId, pqErrSysId).orderBy(true, true, PqErrSysDtls::getSort).list();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public boolean addPqErrSysDtls(String pqErrSysId, List<PqErrSysDtlsParam> list) {
|
||||
List<PqErrSysDtls> data = new ArrayList<>();
|
||||
for (PqErrSysDtlsParam param : list) {
|
||||
PqErrSysDtls pqErrSysDtls = new PqErrSysDtls();
|
||||
BeanUtils.copyProperties(param, pqErrSysDtls);
|
||||
pqErrSysDtls.setErrorSysId(pqErrSysId);
|
||||
data.add(pqErrSysDtls);
|
||||
}
|
||||
return this.saveBatch(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public boolean updatePqErrSysDtls(String pqErrSysId, List<PqErrSysDtlsParam> list) {
|
||||
//先按照pqErrSysId全部删除
|
||||
this.deletePqErrSysDtlsByPqErrSysId(Collections.singletonList(pqErrSysId));
|
||||
//再重新插入
|
||||
this.addPqErrSysDtls(pqErrSysId, list);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public boolean deletePqErrSysDtlsByPqErrSysId(List<String> pqErrSysIds) {
|
||||
QueryWrapper<PqErrSysDtls> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.in("pq_err_sys_dtls.Error_Sys_Id", pqErrSysIds);
|
||||
return this.remove(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PqErrSysDtls> listPqErrSysDtlsByPqErrSysIdAndTypes(PqErrSysParam.DetectionParam param) {
|
||||
PqScriptCheckDataParam script = new PqScriptCheckDataParam();
|
||||
script.setScriptId(param.getScriptId());
|
||||
script.setIndex(param.getIndex());
|
||||
script.setIsValueTypeName(false);
|
||||
List<String> valueType = pqScriptCheckDataService.getValueType(script);
|
||||
//根据检测脚本id和检测序号,查询出检测子项目
|
||||
return this.list(new MPJLambdaWrapper<PqErrSysDtls>().selectAll(PqErrSysDtls.class)
|
||||
.selectAll(PqErrSysDtls.class)
|
||||
.selectAs(DictTree::getCode, PqErrSysDtls::getScriptCode)
|
||||
.leftJoin(DictTree.class, DictTree::getId, PqErrSysDtls::getScriptType)
|
||||
.eq(PqErrSysDtls::getErrorSysId, param.getErrorSysId())
|
||||
.in(PqErrSysDtls::getScriptType, valueType)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ErrDtlsCheckDataVO> listByPqErrSysIdAndTypes(PqErrSysParam.DetectionParam param) {
|
||||
List<ErrDtlsCheckDataVO> info=new ArrayList<>();
|
||||
PqScriptCheckDataParam checkDataParam = new PqScriptCheckDataParam();
|
||||
checkDataParam.setScriptId(param.getScriptId());
|
||||
checkDataParam.setIndex(param.getIndex());
|
||||
List<PqScriptCheckData> list = pqScriptCheckDataService.listCheckDataCode(checkDataParam);
|
||||
|
||||
List<String> valueType = list.stream().filter(x->x.getErrorFlag()!=0).map(PqScriptCheckData::getValueType).collect(Collectors.toList());
|
||||
Map<String, List<PqErrSysDtls>> errMap =new HashMap<>(3);
|
||||
if(CollUtil.isNotEmpty(valueType)){
|
||||
List<PqErrSysDtls> errSysDtls = this.list(new MPJLambdaWrapper<PqErrSysDtls>().selectAll(PqErrSysDtls.class)
|
||||
.selectAll(PqErrSysDtls.class)
|
||||
.selectAs(DictTree::getCode, PqErrSysDtls::getScriptCode)
|
||||
.leftJoin(DictTree.class, DictTree::getId, PqErrSysDtls::getScriptType)
|
||||
.eq(PqErrSysDtls::getErrorSysId, param.getErrorSysId())
|
||||
.in(PqErrSysDtls::getScriptType, valueType)
|
||||
);
|
||||
errMap= errSysDtls.stream().collect(Collectors.groupingBy(PqErrSysDtls::getScriptType));
|
||||
}
|
||||
ErrDtlsCheckDataVO dataVO;
|
||||
for (PqScriptCheckData script : list) {
|
||||
dataVO=new ErrDtlsCheckDataVO();
|
||||
dataVO.setCheckDataId(script.getScriptId());
|
||||
dataVO.setValueTypeCode(script.getValueTypeCode());
|
||||
dataVO.setValueType(script.getValueType());
|
||||
dataVO.setValue(script.getValue());
|
||||
if(errMap.containsKey(script.getValueType())){
|
||||
dataVO.setErrSysDtls(errMap.get(script.getValueType()));
|
||||
}
|
||||
info.add(dataVO);
|
||||
}
|
||||
return info;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,210 @@
|
||||
package com.njcn.gather.err.service.impl;
|
||||
|
||||
import cn.hutool.core.text.StrPool;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
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.gather.err.mapper.PqErrSysMapper;
|
||||
import com.njcn.gather.err.pojo.param.PqErrSysParam;
|
||||
import com.njcn.gather.err.pojo.po.PqErrSys;
|
||||
import com.njcn.gather.err.pojo.po.PqErrSysDtls;
|
||||
import com.njcn.gather.err.pojo.vo.PqErrSysDtlsVO;
|
||||
import com.njcn.gather.err.service.IPqErrSysDtlsService;
|
||||
import com.njcn.gather.err.service.IPqErrSysService;
|
||||
import com.njcn.gather.device.pojo.enums.DevResponseEnum;
|
||||
import com.njcn.gather.system.dictionary.pojo.po.DictData;
|
||||
import com.njcn.gather.system.dictionary.pojo.po.DictTree;
|
||||
import com.njcn.gather.system.dictionary.service.IDictDataService;
|
||||
import com.njcn.gather.system.dictionary.service.IDictTreeService;
|
||||
import com.njcn.web.factory.PageFactory;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @date 2024-11-27
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class PqErrSysServiceImpl extends ServiceImpl<PqErrSysMapper, PqErrSys> implements IPqErrSysService {
|
||||
|
||||
private final IPqErrSysDtlsService pqErrSysDtlsService;
|
||||
private final IDictTreeService dictTreeService;
|
||||
private final IDictDataService dictDataService;
|
||||
|
||||
@Override
|
||||
public Page<PqErrSys> listPqErrSys(PqErrSysParam.QueryParam param) {
|
||||
QueryWrapper<PqErrSys> queryWrapper = new QueryWrapper<>();
|
||||
if (ObjectUtil.isNotNull(param)) {
|
||||
queryWrapper.between(ObjectUtil.isNotEmpty(param.getStandardTime()), "pq_err_sys.Standard_Time", param.getStandardTime() + "-01-01", param.getStandardTime() + "-12-31").eq(ObjectUtil.isNotEmpty(param.getDevLevel()), "pq_err_sys.Dev_Level", param.getDevLevel());
|
||||
}
|
||||
queryWrapper.eq("pq_err_sys.state", DataStateEnum.ENABLE.getCode());
|
||||
return this.page(new Page<>(PageFactory.getPageNum(param), PageFactory.getPageSize(param)), queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PqErrSys getPqErrSysById(String id) {
|
||||
PqErrSys pqErrSys = this.lambdaQuery().eq(PqErrSys::getId, id).eq(PqErrSys::getState, DataStateEnum.ENABLE.getCode()).one();
|
||||
if (ObjectUtil.isNotNull(pqErrSys)) {
|
||||
pqErrSys.setPqErrSysDtlsList(pqErrSysDtlsService.listPqErrSysDtlsByPqErrSysId(id));
|
||||
}
|
||||
return pqErrSys;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public boolean addPqErrSys(PqErrSysParam param) {
|
||||
PqErrSys pqErrSys = new PqErrSys();
|
||||
BeanUtils.copyProperties(param, pqErrSys);
|
||||
String id = UUID.randomUUID().toString().replaceAll("-", "");
|
||||
pqErrSys.setId(id);
|
||||
pqErrSys.setName(generateErrSysName(param));
|
||||
pqErrSys.setStandardTime(LocalDate.of(Integer.parseInt(param.getStandardTime()), 1, 1));
|
||||
pqErrSys.setState(DataStateEnum.ENABLE.getCode());
|
||||
boolean result1 = this.save(pqErrSys);
|
||||
boolean result2 = pqErrSysDtlsService.updatePqErrSysDtls(id, param.getPqErrSysDtlsList());
|
||||
return result1 && result2;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public boolean updatePqErrSys(PqErrSysParam.UpdateParam param) {
|
||||
PqErrSys pqErrSys = new PqErrSys();
|
||||
BeanUtils.copyProperties(param, pqErrSys);
|
||||
pqErrSys.setName(generateErrSysName(param));
|
||||
pqErrSys.setStandardTime(LocalDate.of(Integer.parseInt(param.getStandardTime()), 1, 1));
|
||||
boolean result1 = this.updateById(pqErrSys);
|
||||
boolean result2 = pqErrSysDtlsService.updatePqErrSysDtls(param.getId(), param.getPqErrSysDtlsList());
|
||||
return result1 && result2;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public boolean deletePqErrSys(List<String> ids) {
|
||||
pqErrSysDtlsService.deletePqErrSysDtlsByPqErrSysId(ids);
|
||||
this.lambdaUpdate().in(PqErrSys::getId, ids).set(PqErrSys::getState, DataStateEnum.DELETED.getCode()).update();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PqErrSysDtlsVO> getDetail(String id) {
|
||||
List<PqErrSysDtlsVO> result = new ArrayList<>();
|
||||
List<PqErrSysDtls> pqErrSysDtls = pqErrSysDtlsService.listPqErrSysDtlsByPqErrSysId(id);
|
||||
if (ObjectUtil.isNotEmpty(pqErrSysDtls)) {
|
||||
PqErrSysDtlsVO temp = new PqErrSysDtlsVO();
|
||||
temp.setDevLevel(this.getById(id).getDevLevel());
|
||||
//按照测量项分组
|
||||
Map<String, List<PqErrSysDtls>> map = pqErrSysDtls.stream().collect(Collectors.groupingBy(PqErrSysDtls::getErrorType));
|
||||
map.forEach((key, value) -> {
|
||||
this.visualize(value, temp);
|
||||
result.add(temp);
|
||||
});
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public List<Map<String, Object>> listAllPqErrSys() {
|
||||
List<PqErrSys> pqErrSysList = this.lambdaQuery().eq(PqErrSys::getState, DataStateEnum.ENABLE.getCode()).list();
|
||||
List<Map<String, Object>> result = pqErrSysList.stream().map(pqErrSys -> {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("id", pqErrSys.getId());
|
||||
map.put("name", pqErrSys.getName());
|
||||
return map;
|
||||
}).collect(Collectors.toList());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PqErrSys getPqErrSysByName(String name) {
|
||||
return this.lambdaQuery().eq(PqErrSys::getName, name).eq(PqErrSys::getState, DataStateEnum.ENABLE.getCode()).one();
|
||||
}
|
||||
|
||||
/**
|
||||
* 将检测项可视化
|
||||
*
|
||||
* @param list
|
||||
* @param temp
|
||||
*/
|
||||
private void visualize(List<PqErrSysDtls> list, PqErrSysDtlsVO temp) {
|
||||
if (ObjectUtil.isNotEmpty(list)) {
|
||||
String type = list.get(0).getErrorType();
|
||||
DictTree dictTree = dictTreeService.queryById(type);
|
||||
if (ObjectUtil.isNotNull(dictTree)) {
|
||||
String[] pids = dictTree.getPids().split(StrPool.COMMA);
|
||||
temp.setTestType(dictTree.getName());
|
||||
temp.setCol1(dictTreeService.queryById(pids[1]).getName());
|
||||
if (pids.length == 3) {
|
||||
temp.setCol2(dictTreeService.queryById(pids[2]).getName());
|
||||
}
|
||||
// if (pids.length == 2) {
|
||||
// temp.setCol2(dictTreeService.queryById(pids[1]).getName());
|
||||
// }
|
||||
}
|
||||
|
||||
list.forEach(pqErrSysDtls -> {
|
||||
if (ObjectUtil.isNull(temp.getInfo())) {
|
||||
temp.setInfo(new ArrayList<>());
|
||||
}
|
||||
Map<String, Object> map1 = new HashMap();
|
||||
map1.put("startValue", pqErrSysDtls.getStartValue());
|
||||
map1.put("startFlag", pqErrSysDtls.getStartFlag());
|
||||
map1.put("endValue", pqErrSysDtls.getEndValue());
|
||||
map1.put("endFlag", pqErrSysDtls.getEndFlag());
|
||||
map1.put("conditionType", pqErrSysDtls.getConditionType());
|
||||
map1.put("maxErrorValue", pqErrSysDtls.getMaxErrorValue());
|
||||
map1.put("errorValueType", pqErrSysDtls.getErrorValueType());
|
||||
temp.getInfo().add(map1);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成误差体系名称(标准号+年份+设备等级)
|
||||
*
|
||||
* @return 误差体系名称
|
||||
*/
|
||||
private String generateErrSysName(PqErrSysParam param) {
|
||||
DictData devLevelDictData = dictDataService.getDictDataById(param.getDevLevel());
|
||||
if (ObjectUtil.isNotNull(devLevelDictData)) {
|
||||
return param.getStandardName() + "-" + param.getStandardTime() + "-" + devLevelDictData.getName();
|
||||
}
|
||||
throw new BusinessException(DevResponseEnum.PQ_ERRSYS_GEN_NAME_ERROR);
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public boolean copyPqErrSys(String id) {
|
||||
// PqErrSys pqErrSys = this.getPqErrSysById(id);
|
||||
// pqErrSys.setId(UUID.randomUUID().toString().replaceAll("-", ""));
|
||||
// pqErrSys.setName(pqErrSys.getName() + "_副本");
|
||||
// pqErrSys.setStandardTime(LocalDate.of(pqErrSys.getStandardTime().getYear(), 1, 1));
|
||||
// pqErrSys.getPqErrSysDtlsList().forEach(pqErrSysDtls -> pqErrSysDtls.setId(UUID.randomUUID().toString().replaceAll("-", "")));
|
||||
// return this.save(pqErrSys);
|
||||
// }
|
||||
|
||||
/**
|
||||
* 生成误差体系名称(标准号+年份+设备等级)
|
||||
*
|
||||
* @return 检测源名称
|
||||
*/
|
||||
private String generatePqSourceName(PqErrSysParam param) {
|
||||
DictData devLevel = dictDataService.getDictDataById(param.getDevLevel());
|
||||
if (ObjectUtils.allNotNull(param.getStandardName(), param.getStandardTime(), devLevel)) {
|
||||
return param.getStandardName() + "-" + param.getStandardTime() + "-" + devLevel.getName();
|
||||
}
|
||||
throw new BusinessException(DevResponseEnum.ERR_SOURCE_GEN_NAME_ERROR);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.njcn.gather.monitor.controller;
|
||||
|
||||
import com.njcn.gather.monitor.service.IPqMonitorService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @date 2024-12-12
|
||||
*/
|
||||
@Slf4j
|
||||
@Api(tags = "监测点管理")
|
||||
@RestController
|
||||
@RequestMapping("/pqMonitor")
|
||||
@RequiredArgsConstructor
|
||||
public class PqMonitorController extends BaseController {
|
||||
private final IPqMonitorService pqMonitorService;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.njcn.gather.monitor.mapper;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.njcn.gather.device.pojo.vo.PreDetection;
|
||||
import com.njcn.gather.monitor.pojo.po.PqMonitor;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @date 2024-12-12
|
||||
*/
|
||||
public interface PqMonitorMapper extends MPJBaseMapper<PqMonitor> {
|
||||
|
||||
/**
|
||||
* 根据终端id获取监测点集合
|
||||
* @param devId
|
||||
* @return: java.util.List<com.njcn.gather.device.pojo.vo.PreDetection.MonitorListDTO>
|
||||
* @Author: wr
|
||||
* @Date: 2024/12/12 13:15
|
||||
*/
|
||||
List<PreDetection.MonitorListDTO> selectMonitorInfo(@Param("devId") String devId);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
<?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.gather.monitor.mapper.PqMonitorMapper">
|
||||
|
||||
<select id="selectMonitorInfo"
|
||||
resultType="com.njcn.gather.device.pojo.vo.PreDetection$MonitorListDTO">
|
||||
SELECT
|
||||
Id as lineId,
|
||||
Num as line,
|
||||
pt as pt,
|
||||
ct as ct
|
||||
FROM
|
||||
pq_monitor
|
||||
WHERE
|
||||
dev_id = #{devId}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.njcn.gather.monitor.pojo.param;
|
||||
|
||||
import com.njcn.common.pojo.constant.PatternRegex;
|
||||
import com.njcn.gather.device.pojo.constant.DevValidMessage;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Pattern;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @data 2024-12-12
|
||||
*/
|
||||
@Data
|
||||
public class PqMonitorParam {
|
||||
|
||||
@ApiModelProperty(value = "谐波系统监测点ID")
|
||||
private String code;
|
||||
|
||||
@ApiModelProperty(value = "所属母线")
|
||||
@NotBlank(message = DevValidMessage.BELONG_LINE_NOT_BLANK)
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "监测点序号")
|
||||
@NotNull(message = DevValidMessage.MONITOR_NUM_NOT_NULL)
|
||||
private Integer num;
|
||||
|
||||
@ApiModelProperty(value = "PT变比")
|
||||
@NotNull(message = DevValidMessage.PT_NOT_NULL)
|
||||
private Float pt;
|
||||
|
||||
@ApiModelProperty(value = "CT变比")
|
||||
@NotNull(message = DevValidMessage.CT_NOT_NULL)
|
||||
private Float ct;
|
||||
|
||||
@ApiModelProperty(value = "接线方式")
|
||||
@NotBlank(message = DevValidMessage.WIRING_TYPE_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.WIRING_TYPE_FORMAT_ERROR)
|
||||
private String ptType;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.njcn.gather.monitor.pojo.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.njcn.db.mybatisplus.bo.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @date 2024-12-12
|
||||
*/
|
||||
@Data
|
||||
@TableName("pq_monitor")
|
||||
public class PqMonitor implements Serializable {
|
||||
private static final long serialVersionUID = -97606920356561872L;
|
||||
/**
|
||||
* 监测点ID
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 默认与谐波系统监测点ID相同
|
||||
*/
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 所属设备ID
|
||||
*/
|
||||
private String devId;
|
||||
|
||||
/**
|
||||
* 所属母线
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 监测点序号
|
||||
*/
|
||||
private Integer num;
|
||||
|
||||
/**
|
||||
* PT变比
|
||||
*/
|
||||
private Float pt;
|
||||
|
||||
/**
|
||||
* CT变比
|
||||
*/
|
||||
private Float ct;
|
||||
|
||||
/**
|
||||
* 接线方式,字典表
|
||||
*/
|
||||
private String ptType;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.njcn.gather.monitor.pojo.vo;
|
||||
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import com.njcn.common.pojo.constant.PatternRegex;
|
||||
import com.njcn.gather.device.pojo.constant.DevValidMessage;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Pattern;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @data 2024-12-09
|
||||
*/
|
||||
@Data
|
||||
public class PqMonitorExcel {
|
||||
|
||||
@Excel(name = "监测点序号", width = 20, orderNum = "1")
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.MONITOR_NUM_FORMAT_ERROR)
|
||||
private Integer num;
|
||||
|
||||
@Excel(name = "所属母线", width = 20, orderNum = "2")
|
||||
@NotBlank(message = DevValidMessage.BELONG_LINE_NOT_BLANK)
|
||||
private String name;
|
||||
|
||||
@Excel(name = "PT变比", width = 20, orderNum = "3")
|
||||
@NotNull(message = DevValidMessage.PT_NOT_NULL)
|
||||
private Float pt;
|
||||
|
||||
@Excel(name = "CT变比", width = 20, orderNum = "4")
|
||||
@NotNull(message = DevValidMessage.CT_NOT_NULL)
|
||||
private Float ct;
|
||||
|
||||
@Excel(name = "接线方式", width = 20, orderNum = "5")
|
||||
@NotBlank(message = DevValidMessage.WIRING_TYPE_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.WIRING_TYPE_FORMAT_ERROR)
|
||||
private String ptType;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class ImportData extends PqMonitorExcel {
|
||||
|
||||
}
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class ExportData extends PqMonitorExcel {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.njcn.gather.monitor.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.gather.device.pojo.po.PqDev;
|
||||
import com.njcn.gather.monitor.pojo.param.PqMonitorParam;
|
||||
import com.njcn.gather.monitor.pojo.po.PqMonitor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @date 2024-12-12
|
||||
*/
|
||||
public interface IPqMonitorService extends IService<PqMonitor> {
|
||||
|
||||
/**
|
||||
* 根据设备id获取所有监测点信息
|
||||
*
|
||||
* @param devId 被检设备id
|
||||
* @return 监测点信息列表
|
||||
*/
|
||||
List<PqMonitor> listPqMonitorByDevId(String devId);
|
||||
|
||||
/**
|
||||
* 批量新增监测点信息
|
||||
*
|
||||
* @param devId 被检设备id
|
||||
* @param pqMonitorParamList 监测点信息列表
|
||||
* @return 新增成功返回true,否则返回false
|
||||
*/
|
||||
boolean addPqMonitorByDevId(String devId, List<PqMonitorParam> pqMonitorParamList);
|
||||
|
||||
/**
|
||||
* 批量删除监测点信息
|
||||
*
|
||||
* @param devId 被检设备id
|
||||
* @return 删除成功返回true,否则返回false
|
||||
*/
|
||||
boolean deletePqMonitorByDevId(String devId);
|
||||
|
||||
/**
|
||||
* 修改监测点信息
|
||||
*
|
||||
* @param devId 被检设备id
|
||||
* @param paramList 监测点信息
|
||||
* @return 修改成功返回true,否则返回false
|
||||
*/
|
||||
boolean updatePqMonitorByDevId(String devId, List<PqMonitorParam> paramList);
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.njcn.gather.monitor.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.gather.device.pojo.po.PqDev;
|
||||
import com.njcn.gather.monitor.mapper.PqMonitorMapper;
|
||||
import com.njcn.gather.monitor.pojo.param.PqMonitorParam;
|
||||
import com.njcn.gather.monitor.pojo.po.PqMonitor;
|
||||
import com.njcn.gather.monitor.service.IPqMonitorService;
|
||||
import com.njcn.gather.system.dictionary.service.IDictDataService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @date 2024-12-12
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class PqMonitorServiceImpl extends ServiceImpl<PqMonitorMapper, PqMonitor> implements IPqMonitorService {
|
||||
|
||||
private final IDictDataService dictDataService;
|
||||
|
||||
@Override
|
||||
public List<PqMonitor> listPqMonitorByDevId(String devId) {
|
||||
return this.lambdaQuery().eq(PqMonitor::getDevId, devId).list();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public boolean addPqMonitorByDevId(String devId, List<PqMonitorParam> pqMonitorParamList) {
|
||||
List<PqMonitor> pqMonitorList = BeanUtil.copyToList(pqMonitorParamList, PqMonitor.class);
|
||||
pqMonitorList.forEach(pqMonitor -> pqMonitor.setDevId(devId));
|
||||
return this.saveBatch(pqMonitorList);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public boolean deletePqMonitorByDevId(String devId) {
|
||||
QueryWrapper<PqMonitor> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("pq_monitor.Dev_Id", devId);
|
||||
return this.remove(wrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public boolean updatePqMonitorByDevId(String devId, List<PqMonitorParam> paramList) {
|
||||
// 先删除原有数据
|
||||
this.deletePqMonitorByDevId(devId);
|
||||
// 再添加新数据
|
||||
List<PqMonitor> pqMonitorList = BeanUtil.copyToList(paramList, PqMonitor.class);
|
||||
pqMonitorList.forEach(pqMonitor -> pqMonitor.setDevId(devId));
|
||||
return this.saveBatch(pqMonitorList);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -13,14 +13,12 @@ import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.LogUtil;
|
||||
import com.njcn.gather.device.device.service.IPqDevService;
|
||||
import com.njcn.gather.device.service.IPqDevService;
|
||||
import com.njcn.gather.device.pojo.enums.DevResponseEnum;
|
||||
import com.njcn.gather.device.pojo.enums.PatternEnum;
|
||||
import com.njcn.gather.plan.pojo.param.AdPlanParam;
|
||||
import com.njcn.gather.plan.pojo.vo.AdPlanExcel;
|
||||
import com.njcn.gather.plan.pojo.vo.AdPlanVO;
|
||||
import com.njcn.gather.plan.service.IAdPlanService;
|
||||
import com.njcn.gather.system.dictionary.service.IDictDataService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import com.njcn.web.utils.ExcelUtil;
|
||||
import com.njcn.web.utils.HttpResultUtil;
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.njcn.gather.plan.mapper;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.njcn.gather.plan.pojo.po.AdPlanSource;
|
||||
import com.njcn.gather.device.source.pojo.po.PqSource;
|
||||
import com.njcn.gather.source.pojo.po.PqSource;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<mapper namespace="com.njcn.gather.plan.mapper.AdPlanSourceMapper">
|
||||
|
||||
|
||||
<select id="selectPqSourceByPlanId" resultType="com.njcn.gather.device.source.pojo.po.PqSource">
|
||||
<select id="selectPqSourceByPlanId" resultType="com.njcn.gather.source.pojo.po.PqSource">
|
||||
SELECT pq_source.*
|
||||
FROM pq_source,
|
||||
ad_plan_source
|
||||
|
||||
@@ -68,7 +68,7 @@ public class AdPlanExcel {
|
||||
// private Integer code;
|
||||
|
||||
@ExcelCollection(name = "绑定的设备", orderNum = "9")
|
||||
private List<AdPlanExcel.BoundExportData> devices;
|
||||
private List<BoundExportData> devices;
|
||||
}
|
||||
|
||||
@Data
|
||||
@@ -91,7 +91,7 @@ public class AdPlanExcel {
|
||||
private String result;
|
||||
|
||||
@ExcelCollection(name = "绑定的设备", orderNum = "9")
|
||||
private List<AdPlanExcel.BoundImportData> devices;
|
||||
private List<BoundImportData> devices;
|
||||
}
|
||||
|
||||
@Data
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.njcn.gather.plan.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.gather.plan.pojo.po.AdPlanSource;
|
||||
import com.njcn.gather.device.source.pojo.po.PqSource;
|
||||
import com.njcn.gather.source.pojo.po.PqSource;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -12,17 +12,17 @@ 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.gather.device.device.pojo.enums.TimeCheckResultEnum;
|
||||
import com.njcn.gather.device.device.pojo.param.PqDevParam;
|
||||
import com.njcn.gather.device.device.pojo.po.PqDev;
|
||||
import com.njcn.gather.device.device.service.IPqDevService;
|
||||
import com.njcn.gather.device.err.service.IPqErrSysService;
|
||||
import com.njcn.gather.device.pojo.enums.TimeCheckResultEnum;
|
||||
import com.njcn.gather.device.pojo.param.PqDevParam;
|
||||
import com.njcn.gather.device.pojo.po.PqDev;
|
||||
import com.njcn.gather.device.service.IPqDevService;
|
||||
import com.njcn.gather.err.service.IPqErrSysService;
|
||||
import com.njcn.gather.device.pojo.enums.*;
|
||||
import com.njcn.gather.device.script.pojo.po.PqScriptDtls;
|
||||
import com.njcn.gather.device.script.service.IPqScriptDtlsService;
|
||||
import com.njcn.gather.device.script.service.IPqScriptService;
|
||||
import com.njcn.gather.device.source.pojo.po.PqSource;
|
||||
import com.njcn.gather.device.source.service.IPqSourceService;
|
||||
import com.njcn.gather.script.pojo.po.PqScriptDtls;
|
||||
import com.njcn.gather.script.service.IPqScriptDtlsService;
|
||||
import com.njcn.gather.script.service.IPqScriptService;
|
||||
import com.njcn.gather.source.pojo.po.PqSource;
|
||||
import com.njcn.gather.source.service.IPqSourceService;
|
||||
import com.njcn.gather.plan.mapper.AdPlanMapper;
|
||||
import com.njcn.gather.plan.pojo.enums.DataSourceEnum;
|
||||
import com.njcn.gather.plan.pojo.enums.PlanResponseEnum;
|
||||
|
||||
@@ -5,7 +5,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.gather.plan.mapper.AdPlanSourceMapper;
|
||||
import com.njcn.gather.plan.pojo.po.AdPlanSource;
|
||||
import com.njcn.gather.plan.service.IAdPlanSourceService;
|
||||
import com.njcn.gather.device.source.pojo.po.PqSource;
|
||||
import com.njcn.gather.source.pojo.po.PqSource;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -9,15 +9,15 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.gather.detection.pojo.vo.DetectionData;
|
||||
import com.njcn.gather.device.device.pojo.vo.PqDevVO;
|
||||
import com.njcn.gather.device.device.service.IPqDevService;
|
||||
import com.njcn.gather.device.pojo.vo.PqDevVO;
|
||||
import com.njcn.gather.device.service.IPqDevService;
|
||||
import com.njcn.gather.device.pojo.enums.DevReportStateEnum;
|
||||
import com.njcn.gather.device.script.pojo.po.PqScriptCheckData;
|
||||
import com.njcn.gather.device.script.pojo.po.PqScriptDtls;
|
||||
import com.njcn.gather.device.script.service.IPqScriptCheckDataService;
|
||||
import com.njcn.gather.device.script.service.IPqScriptDtlsService;
|
||||
import com.njcn.gather.device.type.entity.DevType;
|
||||
import com.njcn.gather.device.type.service.IDevTypeService;
|
||||
import com.njcn.gather.script.pojo.po.PqScriptCheckData;
|
||||
import com.njcn.gather.script.pojo.po.PqScriptDtls;
|
||||
import com.njcn.gather.script.service.IPqScriptCheckDataService;
|
||||
import com.njcn.gather.script.service.IPqScriptDtlsService;
|
||||
import com.njcn.gather.type.entity.DevType;
|
||||
import com.njcn.gather.type.service.IDevTypeService;
|
||||
import com.njcn.gather.plan.pojo.po.AdPlan;
|
||||
import com.njcn.gather.plan.service.IAdPlanService;
|
||||
import com.njcn.gather.report.pojo.DevReportParam;
|
||||
|
||||
@@ -6,7 +6,7 @@ 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.LogUtil;
|
||||
import com.njcn.gather.device.device.pojo.param.PqDevParam;
|
||||
import com.njcn.gather.device.pojo.param.PqDevParam;
|
||||
import com.njcn.gather.result.pojo.param.ResultParam;
|
||||
import com.njcn.gather.result.pojo.vo.FormContentVO;
|
||||
import com.njcn.gather.result.pojo.vo.ResultVO;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.njcn.gather.result.pojo.vo;
|
||||
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import com.njcn.gather.device.device.pojo.vo.PqDevExcel;
|
||||
import com.njcn.gather.device.pojo.vo.PqDevExcel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.njcn.gather.result.service.impl;
|
||||
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
@@ -8,15 +7,14 @@ import cn.hutool.core.util.StrUtil;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.gather.device.device.service.IPqDevService;
|
||||
import com.njcn.gather.device.script.mapper.PqScriptMapper;
|
||||
import com.njcn.gather.device.script.pojo.po.PqScriptCheckData;
|
||||
import com.njcn.gather.device.script.pojo.po.PqScriptDtls;
|
||||
import com.njcn.gather.device.script.service.IPqScriptCheckDataService;
|
||||
import com.njcn.gather.device.script.service.IPqScriptDtlsService;
|
||||
import com.njcn.gather.device.script.util.ScriptDtlsDesc;
|
||||
import com.njcn.gather.device.service.IPqDevService;
|
||||
import com.njcn.gather.script.mapper.PqScriptMapper;
|
||||
import com.njcn.gather.script.pojo.po.PqScriptCheckData;
|
||||
import com.njcn.gather.script.pojo.po.PqScriptDtls;
|
||||
import com.njcn.gather.script.service.IPqScriptCheckDataService;
|
||||
import com.njcn.gather.script.service.IPqScriptDtlsService;
|
||||
import com.njcn.gather.script.util.ScriptDtlsDesc;
|
||||
import com.njcn.gather.plan.pojo.po.AdPlan;
|
||||
import com.njcn.gather.plan.pojo.vo.AdPlanExcel;
|
||||
import com.njcn.gather.plan.service.IAdPlanService;
|
||||
import com.njcn.gather.result.pojo.enums.ResultResponseEnum;
|
||||
import com.njcn.gather.result.pojo.enums.ResultUnitEnum;
|
||||
|
||||
@@ -0,0 +1,157 @@
|
||||
package com.njcn.gather.script.controller;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.serializer.SerializerFeature;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.constant.OperateType;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.LogUtil;
|
||||
import com.njcn.gather.script.pojo.param.PqScriptIssueParam;
|
||||
import com.njcn.gather.script.pojo.param.PqScriptParam;
|
||||
import com.njcn.gather.script.pojo.po.PqScript;
|
||||
import com.njcn.gather.script.pojo.po.PqScriptDtls;
|
||||
import com.njcn.gather.script.pojo.po.SourceIssue;
|
||||
import com.njcn.gather.script.service.IPqScriptDtlsService;
|
||||
import com.njcn.gather.script.service.IPqScriptService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import com.njcn.web.utils.HttpResultUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @date 2024-11-18
|
||||
*/
|
||||
@Slf4j
|
||||
@Api(tags = "检测脚本管理")
|
||||
@RestController
|
||||
@RequestMapping("/pqScript")
|
||||
@RequiredArgsConstructor
|
||||
public class PqScriptController extends BaseController {
|
||||
private final IPqScriptService pqScriptService;
|
||||
private final IPqScriptDtlsService pqScriptDtlsService;
|
||||
|
||||
@OperateInfo
|
||||
@PostMapping("/list")
|
||||
@ApiOperation("分页查询检测脚本")
|
||||
@ApiImplicitParam(name = "queryParam", value = "查询参数", required = true)
|
||||
public HttpResult<Page<PqScript>> list(@RequestBody @Validated PqScriptParam.QueryParam param) {
|
||||
String methodDescribe = getMethodDescribe("list");
|
||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, param);
|
||||
Page<PqScript> result = pqScriptService.listPqScript(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(operateType = OperateType.ADD)
|
||||
@PostMapping("/add")
|
||||
@ApiOperation("新增检测脚本")
|
||||
@ApiImplicitParam(name = "pqDevParam", value = "检测脚本", required = true)
|
||||
public HttpResult<Object> add(@RequestBody @Validated PqScriptParam param) {
|
||||
String methodDescribe = getMethodDescribe("add");
|
||||
LogUtil.njcnDebug(log, "{},新增数据为:{}", methodDescribe, param);
|
||||
boolean result = pqScriptService.addPqScript(param);
|
||||
if (result) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
@OperateInfo(operateType = OperateType.UPDATE)
|
||||
@PostMapping("/update")
|
||||
@ApiOperation("修改检测脚本")
|
||||
@ApiImplicitParam(name = "updateParam", value = "检测脚本", required = true)
|
||||
public HttpResult<Object> update(@RequestBody @Validated PqScriptParam.UpdateParam param) {
|
||||
String methodDescribe = getMethodDescribe("update");
|
||||
LogUtil.njcnDebug(log, "{},修改数据为:{}", methodDescribe, param);
|
||||
boolean result = pqScriptService.updatePqScript(param);
|
||||
if (result) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
@OperateInfo(operateType = OperateType.DELETE)
|
||||
@PostMapping("/delete")
|
||||
@ApiOperation("删除检测脚本")
|
||||
@ApiImplicitParam(name = "ids", value = "检测脚本id", required = true)
|
||||
public HttpResult<Object> delete(@RequestBody List<String> ids) {
|
||||
String methodDescribe = getMethodDescribe("delete");
|
||||
LogUtil.njcnDebug(log, "{},删除ID数据为:{}", methodDescribe, String.join(StrUtil.COMMA, ids));
|
||||
boolean result = pqScriptService.deletePqScript(ids);
|
||||
if (result) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
@OperateInfo
|
||||
@GetMapping("getScriptDtlsByScriptId")
|
||||
@ApiOperation("根据脚本id查询检测脚本详情")
|
||||
@ApiImplicitParam(name = "id", value = "检测脚本id", required = true)
|
||||
public HttpResult<List<PqScriptDtls>> getScriptDtlsByScriptId(@RequestParam("id") String id) {
|
||||
String methodDescribe = getMethodDescribe("list");
|
||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, id);
|
||||
List<PqScriptDtls> result = pqScriptDtlsService.listPqScriptDtlByScriptId(id);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(operateType = OperateType.UPDATE)
|
||||
@GetMapping("/upgradeToTemplate")
|
||||
@ApiOperation("升级为模板")
|
||||
@ApiImplicitParam(name = "id", value = "检测脚本id", required = true)
|
||||
public HttpResult<Object> upgradeToTemplate(@RequestParam("id") String id, HttpServletRequest request) {
|
||||
String methodDescribe = getMethodDescribe("upgradeToTemplate");
|
||||
LogUtil.njcnDebug(log, "{},升级ID数据为:{}", methodDescribe, id);
|
||||
boolean result = pqScriptService.upgradeToTemplate(id);
|
||||
if (result) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
@OperateInfo
|
||||
@GetMapping("/getAll")
|
||||
@ApiOperation("获取指定模式下的所有检测脚本")
|
||||
@ApiImplicitParam(name = "patternId", value = "模式Id", required = true)
|
||||
public HttpResult<List<Map<String, Object>>> getAllPqScript(@RequestParam("patternId") String patternId) {
|
||||
String methodDescribe = getMethodDescribe("getAllPqScript");
|
||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, patternId);
|
||||
List<Map<String, Object>> result = pqScriptService.listAllPqScript(patternId);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@OperateInfo
|
||||
@PostMapping("dls")
|
||||
@ApiOperation("根据脚本id查询检测脚本详情")
|
||||
@ApiImplicitParam(name = "id", value = "检测脚本id", required = true)
|
||||
public HttpResult<List<SourceIssue>> dls(@RequestBody PqScriptIssueParam param) {
|
||||
String methodDescribe = getMethodDescribe("list");
|
||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, param);
|
||||
List<SourceIssue> sourceIssues = pqScriptDtlsService.listSourceIssue(param);
|
||||
for (SourceIssue sourceIssue : sourceIssues) {
|
||||
String jsonString = JSON.toJSONString(sourceIssue,SerializerFeature.WriteNullStringAsEmpty);
|
||||
System.out.println();
|
||||
}
|
||||
String jsonString =sourceIssues.get(0).toString();
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, sourceIssues, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.njcn.gather.script.mapper;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.njcn.gather.script.pojo.po.PqScriptCheckData;
|
||||
|
||||
/**
|
||||
* @Description:
|
||||
* @Author: wr
|
||||
* @Date: 2024/12/27 9:29
|
||||
*/
|
||||
public interface PqScriptCheckDataMapper extends MPJBaseMapper<PqScriptCheckData> {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.njcn.gather.script.mapper;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.njcn.gather.script.pojo.po.PqScriptDtls;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @date 2024-11-18
|
||||
*/
|
||||
public interface PqScriptDtlsMapper extends MPJBaseMapper<PqScriptDtls> {
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.njcn.gather.script.mapper;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.njcn.gather.script.pojo.po.PqScript;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @date 2024-11-18
|
||||
*/
|
||||
public interface PqScriptMapper extends MPJBaseMapper<PqScript> {
|
||||
|
||||
/**
|
||||
* 获取检测脚本信息(先获取检测脚本类型是否相对值 true相对值 false绝对值(相对值要乘额定值,绝对值不需要处理))
|
||||
* @param scriptId
|
||||
* @return: com.njcn.gather.device.script.pojo.po.PqScript
|
||||
* @Author: wr
|
||||
* @Date: 2024/12/16 18:08
|
||||
*/
|
||||
Boolean selectScriptIsValueType(@Param("scriptId") String scriptId);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
<?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.gather.script.mapper.PqScriptCheckDataMapper">
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
<?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.gather.script.mapper.PqScriptDtlsMapper">
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
<?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.gather.script.mapper.PqScriptMapper">
|
||||
|
||||
|
||||
<select id="selectScriptIsValueType" resultType="java.lang.Boolean">
|
||||
SELECT
|
||||
IF((SELECT CODE FROM sys_dict_data WHERE id = Value_Type) = 'Ratio', 'true', 'false')
|
||||
FROM
|
||||
pq_script
|
||||
where
|
||||
State=1
|
||||
and Id = #{scriptId}
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.njcn.gather.script.pojo.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @data 2024/11/9
|
||||
*/
|
||||
@Getter
|
||||
public enum ResultUnitEnum {
|
||||
|
||||
FREQ_UNIT("Hz", "频率"),
|
||||
V_RELATIVE_UNIT("%Un", "电压"),
|
||||
V_ABSOLUTELY_UNIT("V", "电压"),
|
||||
I_RELATIVE_UNIT("%In", "电流"),
|
||||
I_ABSOLUTELY_UNIT("A", "电流"),
|
||||
HV_UNIT("%", "谐波电压"),
|
||||
HI_UNIT("%", "谐波电流"),
|
||||
HP_UNIT("W", "谐波有功功率"),
|
||||
HSV_UNIT("%", "间谐波电压"),
|
||||
HSI_UNIT("%", "间谐波电流"),
|
||||
VOLTAGE_MAG_UNIT("周波", "暂态持续时间"),
|
||||
VOLTAGE_DUR_UNIT("%", "暂态深度"),
|
||||
IMBV_UNIT("%", "电压不平衡度"),
|
||||
IMBA_UNIT("%", "电流不平衡度"),
|
||||
|
||||
;
|
||||
|
||||
private String unit;
|
||||
private String name;
|
||||
|
||||
ResultUnitEnum(String unit, String name) {
|
||||
this.unit = unit;
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.njcn.gather.script.pojo.param;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
@Data
|
||||
public class PqScriptCheckDataParam {
|
||||
|
||||
|
||||
@ApiModelProperty("检测脚本ID")
|
||||
private String scriptId;
|
||||
|
||||
@ApiModelProperty("总检测脚本中的测试项序号")
|
||||
private Integer index;
|
||||
|
||||
@ApiModelProperty("检测指标类型(true:code(I$real) ,false展示id ,默认false)")
|
||||
private Boolean isValueTypeName=false;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.njcn.gather.script.pojo.param;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @Description:
|
||||
* @Author: wr
|
||||
* @Date: 2024/12/16 16:00
|
||||
*/
|
||||
@Data
|
||||
public class PqScriptIssueParam {
|
||||
|
||||
@ApiModelProperty("检测脚本Id")
|
||||
private String scriptId;
|
||||
|
||||
@ApiModelProperty("检测计划id")
|
||||
private String planId;
|
||||
|
||||
@ApiModelProperty("终端id集合")
|
||||
private List<String> devIds;
|
||||
|
||||
@ApiModelProperty()
|
||||
private String isPhaseSequence;
|
||||
|
||||
@ApiModelProperty("源id")
|
||||
private String sourceId;
|
||||
|
||||
private List<Integer> indexList;
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package com.njcn.gather.script.pojo.param;
|
||||
|
||||
import com.njcn.common.pojo.constant.PatternRegex;
|
||||
import com.njcn.gather.device.pojo.constant.DevValidMessage;
|
||||
import com.njcn.gather.system.pojo.constant.SystemValidMessage;
|
||||
import com.njcn.web.pojo.annotation.DateTimeStrValid;
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @data 2024/11/18
|
||||
*/
|
||||
@Data
|
||||
public class PqScriptParam {
|
||||
|
||||
@ApiModelProperty("名称")
|
||||
@NotBlank(message = DevValidMessage.NAME_NOT_BLANK)
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("类型")
|
||||
@NotNull(message = DevValidMessage.SCRIPT_TYPE_NOT_BLANK)
|
||||
@Min(value = 0, message = DevValidMessage.SCRIPT_TYPE_FORMAT_ERROR)
|
||||
@Max(value = 1, message = DevValidMessage.SCRIPT_TYPE_FORMAT_ERROR)
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 检测脚本模式,字典表(数字、模拟、比对)
|
||||
*/
|
||||
@ApiModelProperty("模式")
|
||||
@NotBlank(message = DevValidMessage.PATTERN_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.PATTERN_FORMAT_ERROR)
|
||||
private String pattern;
|
||||
|
||||
/**
|
||||
* 检测脚本值类型(在非比对模式情况下,分为相对值检测脚本和绝对值检测脚本)
|
||||
*/
|
||||
@ApiModelProperty("值类型")
|
||||
private String valueType;
|
||||
|
||||
@ApiModelProperty("参照标准名称")
|
||||
@NotBlank(message = DevValidMessage.STANDARD_NAME_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.ERR_SYS_NAME, message = DevValidMessage.STANDARD_NAME_FORMAT_ERROR)
|
||||
private String standardName;
|
||||
|
||||
|
||||
@ApiModelProperty("标准推行时间")
|
||||
@NotBlank(message = DevValidMessage.STANDARD_TIME_NOT_BLANK)
|
||||
@DateTimeStrValid(format = "yyyy", message = DevValidMessage.STANDARD_TIME_FORMAT_ERROR)
|
||||
private String standardTime;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class QueryParam extends BaseParam {
|
||||
@ApiModelProperty("名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("类型")
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty("值类型")
|
||||
private String valueType;
|
||||
|
||||
@ApiModelProperty("模式")
|
||||
@NotBlank(message = DevValidMessage.PATTERN_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.PATTERN_FORMAT_ERROR)
|
||||
private String pattern;
|
||||
}
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class UpdateParam extends PqScriptParam {
|
||||
@ApiModelProperty("检测脚本ID")
|
||||
@NotBlank(message = DevValidMessage.ID_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = SystemValidMessage.ID_FORMAT_ERROR)
|
||||
private String id;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.njcn.gather.script.pojo.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
|
||||
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
|
||||
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
|
||||
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
|
||||
import com.njcn.db.mybatisplus.bo.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @date 2024-11-18
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("pq_script")
|
||||
public class PqScript extends BaseEntity implements Serializable {
|
||||
private static final long serialVersionUID = -61550003510158595L;
|
||||
/**
|
||||
* 检测脚本ID
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 检测脚本名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 检测脚本类型,字典表(脚本还是模板)
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 检测脚本模式,字典表(数字、模拟、比对)
|
||||
*/
|
||||
private String pattern;
|
||||
|
||||
/**
|
||||
* 检测脚本值类型(在非比对模式情况下,分为相对值检测脚本和绝对值检测脚本)
|
||||
*/
|
||||
private String valueType;
|
||||
|
||||
/**
|
||||
* 参照标准名称
|
||||
*/
|
||||
private String standardName;
|
||||
|
||||
/**
|
||||
* 标准推行时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
@JsonSerialize(using = LocalDateSerializer.class)
|
||||
private LocalDate standardTime;
|
||||
|
||||
/**
|
||||
* 状态:0-删除 1-正常
|
||||
*/
|
||||
private Integer state;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
package com.njcn.gather.script.pojo.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@TableName(value = "pq_script_checkdata")
|
||||
public class PqScriptCheckData implements Serializable {
|
||||
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
/**
|
||||
* 检测脚本参考设定值ID
|
||||
*/
|
||||
@TableId
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 检测脚本ID
|
||||
*/
|
||||
private String scriptId;
|
||||
|
||||
/**
|
||||
* 总检测脚本中的测试项序号
|
||||
*/
|
||||
private Integer index;
|
||||
|
||||
/**
|
||||
* 检测指标类型,与数据字典关联(例如电压有效值、谐波电压含有率等)
|
||||
*/
|
||||
private String valueType;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String valueTypeCode;
|
||||
|
||||
/**
|
||||
* 数据类型,来源于字典表,包括实时数据(3s)、分钟统计数据(1min/3min/5min/10min)等
|
||||
*/
|
||||
private String dataType;
|
||||
|
||||
/**
|
||||
* 相别,字典表
|
||||
*/
|
||||
private String phase;
|
||||
|
||||
/**
|
||||
* 值
|
||||
*/
|
||||
private Double value;
|
||||
|
||||
/**
|
||||
* (间)谐波次数
|
||||
*/
|
||||
@TableField("HarmNum")
|
||||
private Double harmNum;
|
||||
|
||||
/**
|
||||
* 状态:0-不启用 1-启用
|
||||
*/
|
||||
private Integer enable;
|
||||
|
||||
/**
|
||||
* 是否参与误差比较:0-不参与 1-参与
|
||||
*/
|
||||
@TableField("Error_Flag")
|
||||
private Integer errorFlag;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
package com.njcn.gather.script.pojo.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @date 2024-11-18
|
||||
*/
|
||||
@Data
|
||||
@TableName("pq_script_dtls")
|
||||
public class PqScriptDtls implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 111579281505485316L;
|
||||
/**
|
||||
* 检测脚本子表ID
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 检测脚本ID
|
||||
*/
|
||||
@TableField("Script_Id")
|
||||
private String scriptId;
|
||||
|
||||
/**
|
||||
* 总检测脚本中的测试项序号
|
||||
*/
|
||||
@TableField("Index")
|
||||
private Integer index;
|
||||
|
||||
/**
|
||||
* 检测脚本类型
|
||||
*/
|
||||
@TableField("Script_Type")
|
||||
private String scriptType;
|
||||
|
||||
/**
|
||||
* 检测脚本类型
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String scriptCode;
|
||||
|
||||
/**
|
||||
* 表明指标类型(例如:Freq频率下的影响、Base额定下的影响、VOL电压下的影响)
|
||||
*/
|
||||
@TableField("Script_SubType")
|
||||
private String scriptSubType;
|
||||
|
||||
/**
|
||||
* 表明指标类型(例如:VOL电压、CUR电流、Freq频率...)
|
||||
*/
|
||||
@TableField("Value_Type")
|
||||
private String valueType;
|
||||
|
||||
/**
|
||||
* 相别,字典表
|
||||
*/
|
||||
private String phase;
|
||||
|
||||
/**
|
||||
* 值
|
||||
*/
|
||||
private Double value;
|
||||
|
||||
/**
|
||||
* 相角
|
||||
*/
|
||||
private Double angle;
|
||||
|
||||
/**
|
||||
* (间)谐波次数
|
||||
*/
|
||||
@TableField("HarmNum")
|
||||
private Double harmNum;
|
||||
|
||||
/**
|
||||
* 暂态幅度(%)
|
||||
*/
|
||||
@TableField("TransValue")
|
||||
private Double transValue;
|
||||
|
||||
/**
|
||||
* 持续时间(周波)
|
||||
*/
|
||||
@TableField("RetainTime")
|
||||
private Double retainTime;
|
||||
|
||||
/**
|
||||
* 变动频度(次/min)
|
||||
*/
|
||||
@TableField("ChagFre")
|
||||
private Double chagFre;
|
||||
|
||||
/**
|
||||
* 变动量(%)
|
||||
*/
|
||||
@TableField("ChagValue")
|
||||
private Double chagValue;
|
||||
|
||||
/**
|
||||
* 状态:0-不启用 1-启用
|
||||
*/
|
||||
@TableField("Enable")
|
||||
private Integer enable;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,305 @@
|
||||
package com.njcn.gather.script.pojo.po;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author wr
|
||||
* @description
|
||||
* @date 2024/12/16 11:24
|
||||
*/
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public class SourceIssue {
|
||||
|
||||
/**
|
||||
* 检测小项dtls Id
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 源ID
|
||||
*/
|
||||
@JSONField(name = "sourceId", ordinal = 1)
|
||||
private String sourceId;
|
||||
|
||||
/**
|
||||
* 检测脚本
|
||||
*/
|
||||
@JSONField(serialize = false)
|
||||
private String scriptId;
|
||||
|
||||
/**
|
||||
* 总检测下的检测脚本序号
|
||||
*/
|
||||
@JSONField(serialize = false)
|
||||
private Integer index;
|
||||
|
||||
/**
|
||||
* 装置下发参数
|
||||
*/
|
||||
@JSONField(serialize = false)
|
||||
private List<String> devValueTypeList;
|
||||
|
||||
|
||||
@JSONField(serialize = false)
|
||||
private String desc;
|
||||
|
||||
|
||||
/**
|
||||
* 检测类型
|
||||
*/
|
||||
@JSONField(name = "type", ordinal = 2)
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 多量响量
|
||||
*/
|
||||
@JSONField(name = "subType", ordinal = 3)
|
||||
private String subType;
|
||||
|
||||
/**
|
||||
* 被检设备额定电压
|
||||
*/
|
||||
@JSONField(name = "fUn", ordinal = 4)
|
||||
private Double fUn;
|
||||
|
||||
/**
|
||||
* 被检设备额定电流
|
||||
*/
|
||||
@JSONField(name = "fIn", ordinal = 5)
|
||||
private Double fIn;
|
||||
|
||||
/**
|
||||
* 频率
|
||||
*/
|
||||
@JSONField(name = "fFreq", ordinal = 6)
|
||||
private Double fFreq;
|
||||
|
||||
/**
|
||||
* 通道信息
|
||||
*/
|
||||
@JSONField(name = "channelList", ordinal = 7)
|
||||
private List<ChannelListDTO> channelList;
|
||||
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public static class ChannelListDTO {
|
||||
|
||||
/**
|
||||
* 通道使能标志
|
||||
*/
|
||||
@JSONField(name = "channelFlag", ordinal = 1)
|
||||
private Boolean channelFlag;
|
||||
|
||||
/**
|
||||
* 谐波使能标志
|
||||
*/
|
||||
@JSONField(name = "harmFlag", ordinal = 2)
|
||||
private Boolean harmFlag;
|
||||
|
||||
/**
|
||||
* 间谐波使能标志
|
||||
*/
|
||||
@JSONField(name = "inHarmFlag", ordinal = 3)
|
||||
private Boolean inHarmFlag;
|
||||
|
||||
/**
|
||||
* 暂态使能标志
|
||||
*/
|
||||
@JSONField(name = "dipFlag", ordinal = 4)
|
||||
private Boolean dipFlag;
|
||||
|
||||
/**
|
||||
* 闪变使能标志
|
||||
*/
|
||||
@JSONField(name = "flickerFlag", ordinal = 5)
|
||||
private Boolean flickerFlag;
|
||||
|
||||
/**
|
||||
* 通道信息 枚举类型,包括{Ua, Ub, Uc, Ux, Ia, Ib, Ic, Ix ,NULL}
|
||||
*/
|
||||
@JSONField(name = "channelType", ordinal = 6)
|
||||
private String channelType;
|
||||
|
||||
/**
|
||||
* 幅值
|
||||
*/
|
||||
@JSONField(name = "fAmp", ordinal = 7)
|
||||
private Double fAmp;
|
||||
|
||||
/**
|
||||
* 相角
|
||||
*/
|
||||
@JSONField(name = "fPhase", ordinal = 8)
|
||||
private Double fPhase;
|
||||
|
||||
/**
|
||||
* 谐波叠加列表
|
||||
*/
|
||||
@JSONField(name = "harmList", ordinal = 9)
|
||||
private List<HarmModel> harmList;
|
||||
|
||||
/**
|
||||
* 间谐波叠加列表
|
||||
*/
|
||||
@JSONField(name = "inharmList", ordinal = 10)
|
||||
private List<InharmModel> inharmList;
|
||||
|
||||
/**
|
||||
* 暂态数据
|
||||
*/
|
||||
@JSONField(name = "dipData", ordinal = 11)
|
||||
private DipDataDTO dipData;
|
||||
|
||||
/**
|
||||
* 闪变数据
|
||||
*/
|
||||
@JSONField(name = "flickerData", ordinal = 12)
|
||||
private FlickerDataDTO flickerData;
|
||||
|
||||
|
||||
/**
|
||||
* 谐波叠加列表
|
||||
*/
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public static class HarmModel {
|
||||
|
||||
/**
|
||||
* 谐波次数
|
||||
*/
|
||||
@JSONField(name = "harm", ordinal = 1)
|
||||
private Double harm;
|
||||
|
||||
/**
|
||||
* 谐波含有率
|
||||
*/
|
||||
@JSONField(name = "fAmp", ordinal = 2)
|
||||
private Double fAmp;
|
||||
|
||||
/**
|
||||
* 谐波相角
|
||||
*/
|
||||
@JSONField(name = "fPhase", ordinal = 3)
|
||||
private Double fPhase;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 间谐波叠加列表
|
||||
*/
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public static class InharmModel {
|
||||
|
||||
/**
|
||||
* 间谐波次数
|
||||
*/
|
||||
@JSONField(name = "inharm", ordinal = 1)
|
||||
private Double inharm;
|
||||
|
||||
/**
|
||||
* 间谐波含有率
|
||||
*/
|
||||
@JSONField(name = "fAmp", ordinal = 2)
|
||||
private Double fAmp;
|
||||
|
||||
/**
|
||||
* 间谐波相角
|
||||
*/
|
||||
@JSONField(name = "fPhase", ordinal = 3)
|
||||
private Double fPhase;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 暂态数据
|
||||
*/
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public static class DipDataDTO {
|
||||
|
||||
/**
|
||||
* 暂态幅值(%)
|
||||
*/
|
||||
@JSONField(name = "fTransValue", ordinal = 1)
|
||||
private Double fTransValue;
|
||||
|
||||
/**
|
||||
* 暂态前时间(s)
|
||||
*/
|
||||
@JSONField(name = "fPreTime", ordinal = 2)
|
||||
private Double fPreTime;
|
||||
|
||||
/**
|
||||
* 写入时间(s)
|
||||
*/
|
||||
@JSONField(name = "fRampIn", ordinal = 3)
|
||||
private Double fRampIn;
|
||||
|
||||
/**
|
||||
* 暂态持续时间(s)
|
||||
*/
|
||||
@JSONField(name = "fRetainTime", ordinal = 4)
|
||||
private Double fRetainTime;
|
||||
|
||||
@JSONField(serialize = false)
|
||||
private Double retainTime;
|
||||
|
||||
/**
|
||||
* 写出时间(s)
|
||||
*/
|
||||
@JSONField(name = "fRampOut", ordinal = 5)
|
||||
private Double fRampOut;
|
||||
|
||||
/**
|
||||
* 暂态后时间(s)
|
||||
*/
|
||||
@JSONField(name = "fAfterTime", ordinal = 6)
|
||||
private Double fAfterTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* 闪变数据
|
||||
*/
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public static class FlickerDataDTO {
|
||||
|
||||
/**
|
||||
* 波动类型
|
||||
*/
|
||||
@JSONField(name = "waveFluType", ordinal = 1)
|
||||
private Object waveFluType;
|
||||
|
||||
/**
|
||||
* 闪变调制波形类型
|
||||
*/
|
||||
@JSONField(name = "waveType", ordinal = 2)
|
||||
private Object waveType;
|
||||
|
||||
/**
|
||||
* 占空比
|
||||
*/
|
||||
@JSONField(name = "fDutyCycle", ordinal = 3)
|
||||
private Double fDutyCycle;
|
||||
|
||||
/**
|
||||
* 变动次数
|
||||
*/
|
||||
@JSONField(name = "fChagFre", ordinal = 4)
|
||||
private Double fChagFre;
|
||||
|
||||
/**
|
||||
* 变动量
|
||||
*/
|
||||
@JSONField(name = "fChagValue", ordinal = 5)
|
||||
private Double fChagValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.njcn.gather.script.pojo.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class PqScriptCheckDataVO implements Serializable {
|
||||
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 总检测脚本中的测试项序号
|
||||
*/
|
||||
private String valueTypeId;
|
||||
|
||||
/**
|
||||
* 检测指标类型,与数据字典关联(例如电压有效值、谐波电压含有率等)
|
||||
*/
|
||||
private String valueTypeCode;
|
||||
|
||||
/**
|
||||
* 数据类型,来源于字典表,包括实时数据(3s)、分钟统计数据(1min/3min/5min/10min)等
|
||||
*/
|
||||
private String dataType;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.njcn.gather.script.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.gather.script.pojo.param.PqScriptCheckDataParam;
|
||||
import com.njcn.gather.script.pojo.po.PqScriptCheckData;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* @Description:
|
||||
* @Author: wr
|
||||
* @Date: 2024/12/27 9:29
|
||||
*/
|
||||
public interface IPqScriptCheckDataService extends IService<PqScriptCheckData> {
|
||||
|
||||
|
||||
/**
|
||||
* 获取检测指标类型
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
List<String> getValueType(PqScriptCheckDataParam param);
|
||||
|
||||
|
||||
|
||||
Map<String,String> getValueTypeMap(String scriptId);
|
||||
|
||||
/**
|
||||
* 获取监测脚本code
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
List<PqScriptCheckData> listCheckDataCode(PqScriptCheckDataParam param);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package com.njcn.gather.script.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.gather.script.pojo.param.PqScriptIssueParam;
|
||||
import com.njcn.gather.script.pojo.po.PqScriptDtls;
|
||||
import com.njcn.gather.script.pojo.po.SourceIssue;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @date 2024-11-18
|
||||
*/
|
||||
public interface IPqScriptDtlsService extends IService<PqScriptDtls> {
|
||||
|
||||
/**
|
||||
* 保存脚本详情
|
||||
*
|
||||
* @param pqScriptDtls 脚本详情
|
||||
* @return 成功返回true,失败返回false
|
||||
*/
|
||||
boolean savePqScriptDtls(PqScriptDtls pqScriptDtls);
|
||||
|
||||
/**
|
||||
* 根据id删除脚本详情
|
||||
*
|
||||
* @param ids 脚本详情ids
|
||||
* @return 成功返回true,失败返回false
|
||||
*/
|
||||
boolean deletePqScriptDtlsByIds(List<String> ids);
|
||||
|
||||
/**
|
||||
* 根据脚本id删除脚本详情
|
||||
*
|
||||
* @param scriptIds 脚本id
|
||||
* @return 成功返回true,失败返回false
|
||||
*/
|
||||
boolean deletePqScriptDtlsByScriptId(List<String> scriptIds);
|
||||
|
||||
/**
|
||||
* 修改脚本详情
|
||||
*
|
||||
* @param pqScriptDtls 脚本详情
|
||||
* @return 成功返回true,失败返回false
|
||||
*/
|
||||
boolean updatePqScriptDtls(PqScriptDtls pqScriptDtls);
|
||||
|
||||
/**
|
||||
* 根据脚本id查询脚本详情
|
||||
*
|
||||
* @param scriptId 脚本id
|
||||
* @return 脚本详情列表
|
||||
*/
|
||||
List<PqScriptDtls> listPqScriptDtlByScriptId(String scriptId);
|
||||
|
||||
/**
|
||||
* 根据计划绑定检测脚本id获取全部检测脚本
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
List<SourceIssue> listSourceIssue(PqScriptIssueParam param);
|
||||
|
||||
/**
|
||||
* 根据脚本类型、脚本id获取index列表
|
||||
*
|
||||
* @param scriptType 脚本类型
|
||||
* @param scriptId 脚本id
|
||||
* @return index列表
|
||||
*/
|
||||
List<Integer> getIndexList(String scriptType, String scriptId);
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package com.njcn.gather.script.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.gather.script.pojo.param.PqScriptParam;
|
||||
import com.njcn.gather.script.pojo.po.PqScript;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @date 2024-11-18
|
||||
*/
|
||||
public interface IPqScriptService extends IService<PqScript> {
|
||||
|
||||
/**
|
||||
* 分页查询检测脚本
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return
|
||||
*/
|
||||
Page<PqScript> listPqScript(PqScriptParam.QueryParam param);
|
||||
|
||||
/**
|
||||
* 根据检测脚本id获取检测脚本
|
||||
*
|
||||
* @param id 检测脚本id
|
||||
* @return 检测脚本
|
||||
*/
|
||||
PqScript getPqScriptById(String id);
|
||||
|
||||
/**
|
||||
* 新增检测脚本
|
||||
*
|
||||
* @param param 检测脚本
|
||||
* @return 成功返回true, 失败返回false
|
||||
*/
|
||||
boolean addPqScript(PqScriptParam param);
|
||||
|
||||
/**
|
||||
* 删除检测脚本
|
||||
*
|
||||
* @param param 检测脚本id
|
||||
* @return 成功返回true, 失败返回false
|
||||
*/
|
||||
boolean updatePqScript(PqScriptParam.UpdateParam param);
|
||||
|
||||
/**
|
||||
* 批量删除检测脚本
|
||||
*
|
||||
* @param ids 检测脚本id列表
|
||||
* @return 成功返回true, 失败返回false
|
||||
*/
|
||||
boolean deletePqScript(List<String> ids);
|
||||
|
||||
/**
|
||||
* 将脚本升级为模板
|
||||
*
|
||||
* @param id 脚本id
|
||||
* @return 成功返回true, 失败返回false
|
||||
*/
|
||||
boolean upgradeToTemplate(String id);
|
||||
|
||||
/**
|
||||
* 获取指定模式下所有检测脚本
|
||||
*
|
||||
* @param patternId 模式id
|
||||
* @return 检测脚本列表
|
||||
*/
|
||||
List<Map<String, Object>> listAllPqScript(String patternId);
|
||||
|
||||
/**
|
||||
* 根据脚本名称查询脚本
|
||||
*
|
||||
* @param name 脚本名称
|
||||
* @return 脚本列表
|
||||
*/
|
||||
PqScript getPqScriptByName(String name);
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
package com.njcn.gather.script.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.gather.script.mapper.PqScriptCheckDataMapper;
|
||||
import com.njcn.gather.script.pojo.param.PqScriptCheckDataParam;
|
||||
import com.njcn.gather.script.pojo.po.PqScriptCheckData;
|
||||
import com.njcn.gather.script.service.IPqScriptCheckDataService;
|
||||
import com.njcn.gather.system.dictionary.mapper.DictTreeMapper;
|
||||
import com.njcn.gather.system.dictionary.pojo.po.DictTree;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
* @Description:
|
||||
* @Author: wr
|
||||
* @Date: 2024/12/27 9:29
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class PqScriptCheckDataServiceImpl extends ServiceImpl<PqScriptCheckDataMapper, PqScriptCheckData> implements IPqScriptCheckDataService {
|
||||
|
||||
private final String V="real$V2-50";
|
||||
private final String SV="real$SV_1-49";
|
||||
private final String I="real$I2-50";
|
||||
private final String IV="real$SI_1-49";
|
||||
|
||||
private final DictTreeMapper dictTreeMapper;
|
||||
|
||||
@Override
|
||||
public List<String> getValueType(PqScriptCheckDataParam param) {
|
||||
MPJLambdaWrapper<PqScriptCheckData> queryWrapper = new MPJLambdaWrapper<>();
|
||||
queryWrapper.selectAll(PqScriptCheckData.class)
|
||||
.leftJoin(DictTree.class, DictTree::getId, PqScriptCheckData::getValueType)
|
||||
.eq(PqScriptCheckData::getScriptId, param.getScriptId())
|
||||
.eq(ObjectUtil.isNotNull(param.getIndex()),PqScriptCheckData::getIndex, param.getIndex())
|
||||
.eq(PqScriptCheckData::getEnable, DataStateEnum.ENABLE.getCode());
|
||||
if (param.getIsValueTypeName()) {
|
||||
queryWrapper.selectAs(DictTree::getCode, PqScriptCheckData::getValueType);
|
||||
}
|
||||
List<PqScriptCheckData> pqScriptCheckData = this.getBaseMapper().selectJoinList(PqScriptCheckData.class, queryWrapper);
|
||||
if(CollUtil.isNotEmpty(pqScriptCheckData)){
|
||||
if (param.getIsValueTypeName()) {
|
||||
List<String> checkData = pqScriptCheckData.stream().map(x -> x.getDataType() + "$" + x.getValueType()).distinct().collect(Collectors.toList());
|
||||
if(!checkData.contains("real$U1")){
|
||||
if(checkData.contains(V)||checkData.contains(SV)){
|
||||
checkData.add("real$U1");
|
||||
}
|
||||
}
|
||||
if(!checkData.contains("real$I1")){
|
||||
if(checkData.contains(I)||checkData.contains(IV)){
|
||||
checkData.add("real$I1");
|
||||
}
|
||||
}
|
||||
return checkData;
|
||||
} else {
|
||||
return pqScriptCheckData.stream().map(PqScriptCheckData::getValueType).distinct().collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String,String> getValueTypeMap(String scriptId) {
|
||||
LambdaQueryWrapper<PqScriptCheckData> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.select(PqScriptCheckData::getValueType)
|
||||
.eq(PqScriptCheckData::getScriptId, scriptId)
|
||||
.eq(PqScriptCheckData::getEnable, DataStateEnum.ENABLE.getCode());
|
||||
List<PqScriptCheckData> pqScriptCheckData = this.baseMapper.selectList(queryWrapper);
|
||||
List<String> valueTypeList = pqScriptCheckData.stream().map(PqScriptCheckData::getValueType).distinct().collect(Collectors.toList());
|
||||
LambdaQueryWrapper<DictTree> dictTreeLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
dictTreeLambdaQueryWrapper.in(DictTree::getId,valueTypeList).eq(DictTree::getState,DataStateEnum.DELETED.getCode());
|
||||
List<DictTree> dictTreeList = dictTreeMapper.selectList(dictTreeLambdaQueryWrapper);
|
||||
Map<String,String> map = dictTreeList.stream().collect(Collectors.toMap(DictTree::getCode,DictTree::getId));
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PqScriptCheckData> listCheckDataCode(PqScriptCheckDataParam param) {
|
||||
MPJLambdaWrapper<PqScriptCheckData> queryWrapper = new MPJLambdaWrapper<>();
|
||||
queryWrapper.selectAll(PqScriptCheckData.class)
|
||||
.leftJoin(DictTree.class, DictTree::getId, PqScriptCheckData::getValueType)
|
||||
.selectAs(DictTree::getCode, PqScriptCheckData::getValueTypeCode)
|
||||
.eq(PqScriptCheckData::getScriptId, param.getScriptId())
|
||||
.eq(PqScriptCheckData::getIndex, param.getIndex())
|
||||
.eq(PqScriptCheckData::getEnable, DataStateEnum.ENABLE.getCode());
|
||||
return this.getBaseMapper().selectJoinList(PqScriptCheckData.class, queryWrapper);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,406 @@
|
||||
package com.njcn.gather.script.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.gather.device.pojo.po.PqDev;
|
||||
import com.njcn.gather.device.service.IPqDevService;
|
||||
import com.njcn.gather.device.pojo.enums.CommonEnum;
|
||||
import com.njcn.gather.script.mapper.PqScriptDtlsMapper;
|
||||
import com.njcn.gather.script.mapper.PqScriptMapper;
|
||||
import com.njcn.gather.script.pojo.param.PqScriptCheckDataParam;
|
||||
import com.njcn.gather.script.pojo.param.PqScriptIssueParam;
|
||||
import com.njcn.gather.script.pojo.po.PqScript;
|
||||
import com.njcn.gather.script.pojo.po.PqScriptCheckData;
|
||||
import com.njcn.gather.script.pojo.po.PqScriptDtls;
|
||||
import com.njcn.gather.script.pojo.po.SourceIssue;
|
||||
import com.njcn.gather.script.service.IPqScriptCheckDataService;
|
||||
import com.njcn.gather.script.service.IPqScriptDtlsService;
|
||||
import com.njcn.gather.script.util.ScriptDtlsDesc;
|
||||
import com.njcn.gather.system.dictionary.pojo.po.DictTree;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @date 2024-11-18
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqScriptDtls> implements IPqScriptDtlsService {
|
||||
|
||||
private final static String FREQ = "Freq";
|
||||
private final static String VOL = "VOL";
|
||||
private final static String CUR = "CUR";
|
||||
private final static String HARM_V = "Harm_V";
|
||||
private final static String HARM_I = "Harm_I";
|
||||
private final static String INHARM_V = "InHarm_V";
|
||||
private final static String INHARM_I = "InHarm_I";
|
||||
private final static String DIP = "Dip";
|
||||
private final static String FLICKER = "Flicker";
|
||||
@Value("${Dip.fPreTime}")
|
||||
private Double fPreTime;
|
||||
@Value("${Dip.fRampIn}")
|
||||
private Double fRampIn;
|
||||
@Value("${Dip.fRampOut}")
|
||||
private Double fRampOut;
|
||||
@Value("${Dip.fAfterTime}")
|
||||
private Double fAfterTime;
|
||||
@Value("${Flicker.waveFluType}")
|
||||
private String waveFluType;
|
||||
@Value("${Flicker.waveType}")
|
||||
private String waveType;
|
||||
@Value("${Flicker.fDutyCycle}")
|
||||
private Double fDutyCycle;
|
||||
|
||||
|
||||
private final IPqDevService pqDevService;
|
||||
private final PqScriptMapper pqScriptMapper;
|
||||
private final IPqScriptCheckDataService pqScriptCheckDataService;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public boolean savePqScriptDtls(PqScriptDtls pqScriptDtls) {
|
||||
return this.save(pqScriptDtls);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public boolean deletePqScriptDtlsByIds(List<String> ids) {
|
||||
LambdaQueryWrapper<PqScriptDtls> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.in(PqScriptDtls::getId, ids);
|
||||
return this.remove(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public boolean deletePqScriptDtlsByScriptId(List<String> scriptIds) {
|
||||
LambdaQueryWrapper<PqScriptDtls> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.in(PqScriptDtls::getScriptId, scriptIds);
|
||||
return this.remove(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public boolean updatePqScriptDtls(PqScriptDtls pqScriptDtls) {
|
||||
return this.updateById(pqScriptDtls);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PqScriptDtls> listPqScriptDtlByScriptId(String scriptId) {
|
||||
MPJLambdaWrapper<PqScriptDtls> queryWrapper = new MPJLambdaWrapper<>();
|
||||
queryWrapper.selectAll(PqScriptDtls.class)
|
||||
.leftJoin(PqScript.class, PqScript::getId, PqScriptDtls::getScriptId)
|
||||
.eq(PqScript::getState, DataStateEnum.ENABLE.getCode())
|
||||
.eq(StrUtil.isNotBlank(scriptId), PqScriptDtls::getScriptId, scriptId);
|
||||
return this.getBaseMapper().selectJoinList(PqScriptDtls.class, queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SourceIssue> listSourceIssue(PqScriptIssueParam param) {
|
||||
List<SourceIssue> sourceIssues = new ArrayList<>();
|
||||
//校验终端额定电压电流是否相同
|
||||
List<PqDev> list = pqDevService.list(new LambdaQueryWrapper<PqDev>()
|
||||
.eq(PqDev::getPlanId, param.getPlanId())
|
||||
.in(PqDev::getId, param.getDevIds())
|
||||
.eq(PqDev::getState, DataStateEnum.ENABLE.getCode())
|
||||
);
|
||||
//额定电压信息
|
||||
Set<Double> voltSet = list.stream().map(PqDev::getDevVolt).collect(Collectors.toSet());
|
||||
//额定电流信息
|
||||
Set<Double> currSet = list.stream().map(PqDev::getDevCurr).collect(Collectors.toSet());
|
||||
if (voltSet.size() == 1 && currSet.size() == 1) {
|
||||
Double volt = voltSet.stream().collect(Collectors.toList()).stream().findFirst().get();
|
||||
Double curr = currSet.stream().collect(Collectors.toList()).stream().findFirst().get();
|
||||
List<PqScriptDtls> pqScriptDtls = this.pqScriptDtls(param.getScriptId(), param.getIsPhaseSequence(), volt, curr, param.getIndexList());
|
||||
Boolean isValueType = pqScriptMapper.selectScriptIsValueType(param.getScriptId());
|
||||
if (CollUtil.isNotEmpty(pqScriptDtls)) {
|
||||
/**
|
||||
* 1.获取全部检测点脚本
|
||||
* 2.根据检测脚本Index,进行分组来确定是第几行数据,理论上基本数据只有七条
|
||||
* 3.根据见树形字典在区分大类下面有多少小类
|
||||
* 3.组装所有检测格式
|
||||
*/
|
||||
Map<Integer, List<PqScriptDtls>> scriptDtlsMap = pqScriptDtls.stream()
|
||||
.sorted(Comparator.comparing(PqScriptDtls::getIndex))
|
||||
.collect(Collectors.groupingBy(PqScriptDtls::getIndex, LinkedHashMap::new, Collectors.toList()));
|
||||
scriptDtlsMap.forEach((key, value) -> {
|
||||
/**
|
||||
* 分组获取有多少小类
|
||||
* VOL-Base:额定工作条件下的检测
|
||||
* VOL-Freq:频率对电压测量的影响
|
||||
* VOL-Harm:谐波对电压测量的影响
|
||||
*/
|
||||
List<PqScriptDtls> freq = value.stream().filter(x -> FREQ.equals(x.getValueType())).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(freq)) {
|
||||
PqScriptDtls freqDtls = freq.get(0);
|
||||
SourceIssue issue = new SourceIssue();
|
||||
issue.setId(freqDtls.getId());
|
||||
issue.setSourceId(param.getSourceId());
|
||||
issue.setType(freqDtls.getScriptCode());
|
||||
issue.setIndex(freqDtls.getIndex());
|
||||
String scriptSubType = freqDtls.getScriptSubType();
|
||||
issue.setSubType(StrUtil.isBlank(scriptSubType) ? scriptSubType : scriptSubType.replace("Base", "NULL"));
|
||||
PqScriptCheckDataParam checkDataParam = new PqScriptCheckDataParam();
|
||||
checkDataParam.setScriptId(freqDtls.getScriptId());
|
||||
checkDataParam.setIndex(freqDtls.getIndex());
|
||||
checkDataParam.setIsValueTypeName(true);
|
||||
issue.setDevValueTypeList(pqScriptCheckDataService.getValueType(checkDataParam));
|
||||
issue.setDesc(ScriptDtlsDesc.getStringBuffer(value, isValueType).toString());
|
||||
issue.setScriptId(freqDtls.getScriptId());
|
||||
issue.setFUn(volt);
|
||||
issue.setFIn(curr);
|
||||
issue.setFFreq(freqDtls.getValue());
|
||||
List<SourceIssue.ChannelListDTO> channelListDTOS = new ArrayList<>();
|
||||
|
||||
//1.通道电压(ABC)
|
||||
List<PqScriptDtls> volList = value.stream().filter(x -> VOL.equals(x.getValueType()))
|
||||
.sorted(Comparator.comparing(PqScriptDtls::getPhase))
|
||||
.collect(Collectors.toList());
|
||||
//谐波电压,间谐波
|
||||
List<PqScriptDtls> dtlsVList = value.stream().filter(x -> HARM_V.equals(x.getValueType()) ||
|
||||
INHARM_V.equals(x.getValueType()) ||
|
||||
DIP.equals(x.getValueType()) ||
|
||||
FLICKER.equals(x.getValueType())
|
||||
)
|
||||
.sorted(Comparator.comparing(PqScriptDtls::getPhase))
|
||||
.collect(Collectors.toList());
|
||||
issueAdd(volList, dtlsVList, HARM_V, INHARM_V, freqDtls.getValue(), "U", channelListDTOS);
|
||||
|
||||
//2.通道电流(ABC)
|
||||
List<PqScriptDtls> curList = value.stream().filter(x -> CUR.equals(x.getValueType()))
|
||||
.sorted(Comparator.comparing(PqScriptDtls::getPhase))
|
||||
.collect(Collectors.toList());
|
||||
//谐波电流,间谐波电流
|
||||
List<PqScriptDtls> dtlsIList = value.stream().filter(x -> HARM_I.equals(x.getValueType()) ||
|
||||
INHARM_I.equals(x.getValueType())
|
||||
)
|
||||
.sorted(Comparator.comparing(PqScriptDtls::getPhase))
|
||||
.collect(Collectors.toList());
|
||||
issueAdd(curList, dtlsIList, HARM_I, INHARM_I, freqDtls.getValue(), "I", channelListDTOS);
|
||||
|
||||
issue.setChannelList(channelListDTOS);
|
||||
sourceIssues.add(issue);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return sourceIssues;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<Integer> getIndexList(String scriptType, String scriptId) {
|
||||
MPJLambdaWrapper<PqScriptDtls> wrapper = new MPJLambdaWrapper<>();
|
||||
wrapper.select(PqScriptDtls::getIndex)
|
||||
.distinct()
|
||||
.eq(PqScriptDtls::getScriptType, scriptType)
|
||||
.eq(PqScriptDtls::getScriptId, scriptId);
|
||||
return this.getBaseMapper().selectJoinList(PqScriptDtls.class, wrapper).stream().map(PqScriptDtls::getIndex).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public List<PqScriptDtls> pqScriptDtls(String scriptId, String isPhaseSequence, Double volt, Double curr, List<Integer> indexList) {
|
||||
List<PqScriptDtls> pqScriptDtls;
|
||||
MPJLambdaWrapper<PqScriptDtls> queryWrapper = new MPJLambdaWrapper<>();
|
||||
queryWrapper.selectAll(PqScriptDtls.class)
|
||||
.selectAs(DictTree::getCode, PqScriptDtls::getScriptCode)
|
||||
.leftJoin(DictTree.class, DictTree::getId, PqScriptDtls::getScriptType)
|
||||
// .eq(PqScriptDtls::getIndex, 1)
|
||||
// .le(PqScriptDtls::getIndex, 30)
|
||||
// .in(PqScriptDtls::getIndex, Arrays.asList(1,7))
|
||||
|
||||
.eq(PqScriptCheckData::getEnable, DataStateEnum.ENABLE.getCode());
|
||||
if (isPhaseSequence.equals(CommonEnum.PHASE_TEST.getValue())) {
|
||||
//相序
|
||||
queryWrapper.eq(PqScriptDtls::getIndex, -1)
|
||||
.eq(PqScriptDtls::getEnable, 1);
|
||||
pqScriptDtls = this.list(queryWrapper);
|
||||
} else if (isPhaseSequence.equals(CommonEnum.COEFFICIENT_TEST.getValue())) {
|
||||
//系数
|
||||
queryWrapper.in(PqScriptDtls::getIndex, indexList)
|
||||
.eq(PqScriptDtls::getEnable, 1);
|
||||
pqScriptDtls = this.list(queryWrapper);
|
||||
} else {
|
||||
//先获取检测脚本类型是否相对值 true相对值 false绝对值(相对值要乘额定值,绝对值不需要处理)
|
||||
Boolean isValueType = pqScriptMapper.selectScriptIsValueType(scriptId);
|
||||
queryWrapper.eq(PqScriptDtls::getScriptId, scriptId);
|
||||
pqScriptDtls = this.getBaseMapper().selectJoinList(PqScriptDtls.class, queryWrapper);
|
||||
if (isValueType) {
|
||||
for (PqScriptDtls pqScriptDtl : pqScriptDtls) {
|
||||
if (VOL.equals(pqScriptDtl.getValueType())) {
|
||||
BigDecimal volValue = new BigDecimal(pqScriptDtl.getValue());
|
||||
BigDecimal result = volValue.divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP)
|
||||
.multiply(new BigDecimal(volt.toString()));
|
||||
pqScriptDtl.setValue(result.doubleValue());
|
||||
}
|
||||
if (CUR.equals(pqScriptDtl.getValueType())) {
|
||||
BigDecimal volValue = new BigDecimal(pqScriptDtl.getValue());
|
||||
BigDecimal result = volValue.divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP)
|
||||
.multiply(new BigDecimal(curr.toString()));
|
||||
pqScriptDtl.setValue(result.doubleValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return pqScriptDtls;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param dtlsList 检测集合
|
||||
* @param dtlsList 其他类型检测集合(谐波,间谐波等)
|
||||
* @param harm 谐波
|
||||
* @param inHarm 间谐波
|
||||
* @param fFreq 频率
|
||||
* @param code U,I
|
||||
* @param channelListDTOS 通道信息
|
||||
* @param channelListDTOS 通道信息
|
||||
* @Description: 通道信息组装
|
||||
* @Author: wr
|
||||
* @Date: 2024/12/16 15:51
|
||||
*/
|
||||
private void issueAdd(List<PqScriptDtls> dtlsList,
|
||||
List<PqScriptDtls> dtlsOtherList,
|
||||
String harm,
|
||||
String inHarm,
|
||||
Double fFreq,
|
||||
String code,
|
||||
List<SourceIssue.ChannelListDTO> channelListDTOS) {
|
||||
for (PqScriptDtls dtls : dtlsList) {
|
||||
SourceIssue.ChannelListDTO channelListDTO = new SourceIssue.ChannelListDTO();
|
||||
channelListDTO.setChannelFlag(true);
|
||||
channelListDTO.setHarmFlag(false);
|
||||
channelListDTO.setInHarmFlag(false);
|
||||
channelListDTO.setDipFlag(false);
|
||||
channelListDTO.setFlickerFlag(false);
|
||||
channelListDTO.setChannelType(code + dtls.getPhase().toLowerCase());
|
||||
channelListDTO.setFAmp(dtls.getValue());
|
||||
channelListDTO.setFPhase(dtls.getAngle());
|
||||
channelListDTO.setHarmList(new ArrayList<>());
|
||||
channelListDTO.setInharmList(new ArrayList<>());
|
||||
//暂态数据
|
||||
SourceIssue.ChannelListDTO.DipDataDTO dipDataDTO = new SourceIssue.ChannelListDTO.DipDataDTO();
|
||||
dipDataDTO.setFTransValue(0.0);
|
||||
dipDataDTO.setFRetainTime(0.0);
|
||||
|
||||
dipDataDTO.setFPreTime(fPreTime);
|
||||
dipDataDTO.setFRampIn(fRampIn);
|
||||
dipDataDTO.setFRampOut(fRampOut);
|
||||
dipDataDTO.setFAfterTime(fAfterTime);
|
||||
|
||||
|
||||
channelListDTO.setDipData(dipDataDTO);
|
||||
//闪变数据
|
||||
SourceIssue.ChannelListDTO.FlickerDataDTO flickerDataDTO = new SourceIssue.ChannelListDTO.FlickerDataDTO();
|
||||
flickerDataDTO.setWaveFluType(waveFluType);
|
||||
flickerDataDTO.setWaveType(waveType);
|
||||
flickerDataDTO.setFDutyCycle(fDutyCycle);
|
||||
|
||||
flickerDataDTO.setFChagFre(0.0);
|
||||
flickerDataDTO.setFChagValue(0.0);
|
||||
channelListDTO.setFlickerData(flickerDataDTO);
|
||||
|
||||
|
||||
if (CollUtil.isNotEmpty(dtlsOtherList)) {
|
||||
List<PqScriptDtls> phaseList = dtlsOtherList.stream().filter(x -> dtls.getPhase().equals(x.getPhase()))
|
||||
.sorted(Comparator.comparing(PqScriptDtls::getHarmNum))
|
||||
.collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(phaseList)) {
|
||||
//处理谐波类型
|
||||
List<PqScriptDtls> harmList = phaseList.stream().filter(x -> harm.equals(x.getValueType()))
|
||||
.collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(harmList)) {
|
||||
channelListDTO.setHarmList(getHarmModels(harmList));
|
||||
channelListDTO.setHarmFlag(true);
|
||||
}
|
||||
//处理间谐波类型
|
||||
List<PqScriptDtls> inHarmList = phaseList.stream().filter(x -> inHarm.equals(x.getValueType()))
|
||||
.collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(inHarmList)) {
|
||||
channelListDTO.setInharmList(getInHarmModels(inHarmList));
|
||||
channelListDTO.setInHarmFlag(true);
|
||||
}
|
||||
//处理暂态数据
|
||||
List<PqScriptDtls> dipList = phaseList.stream().filter(x -> DIP.equals(x.getValueType()))
|
||||
.collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(dipList)) {
|
||||
PqScriptDtls dip = dipList.get(0);
|
||||
dipDataDTO.setFTransValue(dip.getTransValue());
|
||||
// 1.0/频率*持续时间(周波)= 暂态持续时间(s)
|
||||
dipDataDTO.setFRetainTime(NumberUtil.round(1.0 / fFreq * dip.getRetainTime(), 3).doubleValue());
|
||||
dipDataDTO.setRetainTime(dip.getRetainTime());
|
||||
channelListDTO.setDipFlag(true);
|
||||
channelListDTO.setDipData(dipDataDTO);
|
||||
}
|
||||
//处理闪变数据
|
||||
List<PqScriptDtls> flickeRList = phaseList.stream().filter(x -> FLICKER.equals(x.getValueType()))
|
||||
.collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(flickeRList)) {
|
||||
PqScriptDtls flicker = flickeRList.get(0);
|
||||
|
||||
flickerDataDTO.setFChagFre(flicker.getChagFre());
|
||||
flickerDataDTO.setFChagValue(flicker.getChagValue());
|
||||
|
||||
channelListDTO.setFlickerFlag(true);
|
||||
channelListDTO.setFlickerData(flickerDataDTO);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
channelListDTOS.add(channelListDTO);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理谐波信息
|
||||
*
|
||||
* @param phaseHarmVList
|
||||
* @return
|
||||
*/
|
||||
private List<SourceIssue.ChannelListDTO.HarmModel> getHarmModels(List<PqScriptDtls> phaseHarmVList) {
|
||||
List<SourceIssue.ChannelListDTO.HarmModel> info = new ArrayList<>();
|
||||
SourceIssue.ChannelListDTO.HarmModel harmModel;
|
||||
for (PqScriptDtls pqScriptDtls : phaseHarmVList) {
|
||||
harmModel = new SourceIssue.ChannelListDTO.HarmModel();
|
||||
harmModel.setHarm(pqScriptDtls.getHarmNum().doubleValue());
|
||||
harmModel.setFAmp(pqScriptDtls.getValue());
|
||||
harmModel.setFPhase(pqScriptDtls.getAngle());
|
||||
info.add(harmModel);
|
||||
}
|
||||
return info;
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理间谐波谐波信息
|
||||
*
|
||||
* @param phaseHarmVList
|
||||
* @return
|
||||
*/
|
||||
private List<SourceIssue.ChannelListDTO.InharmModel> getInHarmModels(List<PqScriptDtls> phaseHarmVList) {
|
||||
List<SourceIssue.ChannelListDTO.InharmModel> info = new ArrayList<>();
|
||||
SourceIssue.ChannelListDTO.InharmModel inHarmModel;
|
||||
for (PqScriptDtls pqScriptDtls : phaseHarmVList) {
|
||||
inHarmModel = new SourceIssue.ChannelListDTO.InharmModel();
|
||||
inHarmModel.setInharm(pqScriptDtls.getHarmNum());
|
||||
inHarmModel.setFAmp(pqScriptDtls.getValue());
|
||||
inHarmModel.setFPhase(pqScriptDtls.getAngle());
|
||||
info.add(inHarmModel);
|
||||
}
|
||||
return info;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
package com.njcn.gather.script.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
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.gather.script.mapper.PqScriptMapper;
|
||||
import com.njcn.gather.script.pojo.param.PqScriptParam;
|
||||
import com.njcn.gather.script.pojo.po.PqScript;
|
||||
import com.njcn.gather.script.service.IPqScriptDtlsService;
|
||||
import com.njcn.gather.script.service.IPqScriptService;
|
||||
import com.njcn.web.factory.PageFactory;
|
||||
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.time.LocalDate;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @date 2024-11-18
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class PqScriptServiceImpl extends ServiceImpl<PqScriptMapper, PqScript> implements IPqScriptService {
|
||||
|
||||
private final IPqScriptDtlsService pqScriptDtlsService;
|
||||
|
||||
@Override
|
||||
public Page<PqScript> listPqScript(PqScriptParam.QueryParam param) {
|
||||
QueryWrapper<PqScript> queryWrapper = new QueryWrapper<>();
|
||||
if (ObjectUtil.isNotEmpty(param)) {
|
||||
queryWrapper.like(StrUtil.isNotBlank(param.getName()), "pq_script.name", param.getName())
|
||||
.eq(ObjectUtil.isNotNull(param.getType()), "pq_script.type", param.getType())
|
||||
.eq(StrUtil.isNotBlank(param.getValueType()), "pq_script.Value_Type", param.getValueType())
|
||||
.eq(StrUtil.isNotBlank(param.getPattern()), "pq_script.pattern", param.getPattern());
|
||||
}
|
||||
queryWrapper.eq("pq_script.state", DataStateEnum.ENABLE.getCode()).orderByAsc("pq_script.create_time");
|
||||
return this.page(new Page<>(PageFactory.getPageNum(param), PageFactory.getPageSize(param)), queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PqScript getPqScriptById(String id) {
|
||||
return this.lambdaQuery().eq(PqScript::getId, id).eq(PqScript::getState, DataStateEnum.ENABLE.getCode()).one();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public boolean addPqScript(PqScriptParam param) {
|
||||
PqScript pqScript = new PqScript();
|
||||
BeanUtils.copyProperties(param, pqScript);
|
||||
pqScript.setStandardTime(LocalDate.of(Integer.parseInt(param.getStandardTime()), 1, 1));
|
||||
pqScript.setState(DataStateEnum.ENABLE.getCode());
|
||||
return this.save(pqScript);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public boolean updatePqScript(PqScriptParam.UpdateParam param) {
|
||||
PqScript pqScript = new PqScript();
|
||||
BeanUtils.copyProperties(param, pqScript);
|
||||
pqScript.setState(DataStateEnum.ENABLE.getCode());
|
||||
return this.updateById(pqScript);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public boolean deletePqScript(List<String> ids) {
|
||||
//删除对应的脚本详情
|
||||
pqScriptDtlsService.deletePqScriptDtlsByScriptId(ids);
|
||||
LambdaUpdateWrapper<PqScript> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.set(PqScript::getState, DataStateEnum.DELETED.getCode())
|
||||
.in(PqScript::getId, ids);
|
||||
return this.update(updateWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public boolean upgradeToTemplate(String id) {
|
||||
PqScript pqScript = this.lambdaQuery().eq(PqScript::getId, id).one();
|
||||
if (pqScript != null) {
|
||||
pqScript.setType(1);
|
||||
return this.updateById(pqScript);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> listAllPqScript(String patternId) {
|
||||
List<PqScript> pqScriptList = this.lambdaQuery().eq(PqScript::getPattern, patternId).eq(PqScript::getState, DataStateEnum.ENABLE.getCode()).list();
|
||||
List<Map<String, Object>> result = pqScriptList.stream().map(pqScript -> {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("id", pqScript.getId());
|
||||
map.put("name", pqScript.getName());
|
||||
return map;
|
||||
}).collect(Collectors.toList());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PqScript getPqScriptByName(String name) {
|
||||
return this.lambdaQuery().eq(PqScript::getName, name).eq(PqScript::getState, DataStateEnum.ENABLE.getCode()).one();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
package com.njcn.gather.script.util;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.njcn.gather.script.pojo.enums.ResultUnitEnum;
|
||||
import com.njcn.gather.script.pojo.po.PqScriptDtls;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author wr
|
||||
* @description
|
||||
* @date 2025/1/13 22:05
|
||||
*/
|
||||
public class ScriptDtlsDesc {
|
||||
public static StringBuffer getStringBuffer(List<PqScriptDtls> scriptDtlIndex, Boolean isValueType) {
|
||||
if (ObjectUtil.isNull(isValueType)) {
|
||||
isValueType = false;
|
||||
}
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
buffer.append("输入:");
|
||||
appendValue(scriptDtlIndex, buffer, "Freq", "频率", ResultUnitEnum.FREQ_UNIT.getUnit(), null);
|
||||
appendValue(scriptDtlIndex, buffer, "VOL", "U", isValueType ? ResultUnitEnum.V_RELATIVE_UNIT.getUnit() : ResultUnitEnum.V_ABSOLUTELY_UNIT.getUnit(), "相角=");
|
||||
appendValue(scriptDtlIndex, buffer, "CUR", "I", isValueType ? ResultUnitEnum.I_RELATIVE_UNIT.getUnit() : ResultUnitEnum.I_ABSOLUTELY_UNIT.getUnit(), "相角=");
|
||||
dtlsSetBuffer(scriptDtlIndex, buffer, "Harm_V", "h", ResultUnitEnum.HV_UNIT.getUnit(), true);
|
||||
dtlsSetBuffer(scriptDtlIndex, buffer, "Harm_I", "h", ResultUnitEnum.HI_UNIT.getUnit(), true);
|
||||
dtlsSetBuffer(scriptDtlIndex, buffer, "InHarm_V", "i", ResultUnitEnum.HSV_UNIT.getUnit(), false);
|
||||
dtlsSetBuffer(scriptDtlIndex, buffer, "InHarm_I", "i", ResultUnitEnum.HSI_UNIT.getUnit(), false);
|
||||
dtlsSetBufferDip(scriptDtlIndex, buffer, "Dip", "暂态", ResultUnitEnum.HSI_UNIT.getUnit());
|
||||
dtlsSetBufferFlicker(scriptDtlIndex, buffer, "Flicker", "闪变");
|
||||
return buffer;
|
||||
}
|
||||
|
||||
public static void appendValue(List<PqScriptDtls> scriptDtlIndex, StringBuffer buffer, String valueType, String prefix, String unit, String suffix) {
|
||||
List<PqScriptDtls> values = scriptDtlIndex.stream()
|
||||
.filter(x -> valueType.equals(x.getValueType()))
|
||||
.sorted(Comparator.comparing(PqScriptDtls::getPhase))
|
||||
.collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(values)) {
|
||||
for (PqScriptDtls dtls : values) {
|
||||
if ("Freq".equals(valueType)) {
|
||||
buffer.append(prefix + "=" + dtls.getValue() + unit);
|
||||
} else {
|
||||
buffer.append(prefix + dtls.getPhase().toLowerCase() + "=" + dtls.getValue() + unit);
|
||||
}
|
||||
if (suffix != null) {
|
||||
buffer.append("," + suffix + dtls.getAngle() + "° ");
|
||||
} else {
|
||||
buffer.append(" ");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void dtlsSetBuffer(List<PqScriptDtls> scriptDtlIndex, StringBuffer buffer, String valueType, String name, String unit, Boolean fly) {
|
||||
LinkedHashMap<Double, List<PqScriptDtls>> harmNumMap = scriptDtlIndex.stream()
|
||||
.filter(x -> valueType.equals(x.getValueType()))
|
||||
.sorted(Comparator.comparing(PqScriptDtls::getHarmNum))
|
||||
.collect(Collectors.groupingBy(PqScriptDtls::getHarmNum, LinkedHashMap::new, Collectors.toList()));
|
||||
harmNumMap.forEach((harmNum, value) -> {
|
||||
if (fly) {
|
||||
buffer.append(name + String.format("%.0f", harmNum) + "(");
|
||||
} else {
|
||||
buffer.append(name + harmNum + "(");
|
||||
}
|
||||
appendValues(buffer, value, unit);
|
||||
});
|
||||
}
|
||||
|
||||
private static void dtlsSetBufferDip(List<PqScriptDtls> scriptDtlIndex, StringBuffer buffer, String valueType, String name, String unit) {
|
||||
List<PqScriptDtls> list = scriptDtlIndex.stream().filter(x -> valueType.equals(x.getValueType()))
|
||||
.sorted(Comparator.comparing(PqScriptDtls::getPhase))
|
||||
.collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(list)) {
|
||||
buffer.append(name + " ");
|
||||
for (PqScriptDtls dtls : list) {
|
||||
buffer.append(dtls.getPhase() + "相(暂态深度=" + dtls.getTransValue() + ResultUnitEnum.VOLTAGE_DUR_UNIT.getUnit()
|
||||
+ ",暂态持续时间=" + dtls.getRetainTime().intValue() + ResultUnitEnum.VOLTAGE_MAG_UNIT.getUnit() + ") ");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void dtlsSetBufferFlicker(List<PqScriptDtls> scriptDtlIndex, StringBuffer buffer, String valueType, String name) {
|
||||
List<PqScriptDtls> list = scriptDtlIndex.stream().filter(x -> valueType.equals(x.getValueType()))
|
||||
.sorted(Comparator.comparing(PqScriptDtls::getPhase))
|
||||
.collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(list)) {
|
||||
buffer.append(name + " ");
|
||||
for (PqScriptDtls dtls : list) {
|
||||
buffer.append(dtls.getPhase() + "相(变动频度=" + dtls.getChagFre()
|
||||
+ "次/min,变动量=" + dtls.getChagValue() + ResultUnitEnum.VOLTAGE_DUR_UNIT.getUnit() + ") ");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void appendValues(StringBuffer buffer, List<PqScriptDtls> values, String unit) {
|
||||
if (CollUtil.isNotEmpty(values)) {
|
||||
for (PqScriptDtls dtls : values) {
|
||||
buffer.append(dtls.getPhase() + "相=" + dtls.getValue() + unit);
|
||||
}
|
||||
buffer.append(") ");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,143 @@
|
||||
package com.njcn.gather.source.controller;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.constant.OperateType;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.LogUtil;
|
||||
import com.njcn.gather.source.pojo.param.PqSourceParam;
|
||||
import com.njcn.gather.source.pojo.po.PqSource;
|
||||
import com.njcn.gather.source.pojo.po.SourceInitialize;
|
||||
import com.njcn.gather.source.pojo.po.SourceParam;
|
||||
import com.njcn.gather.source.service.IPqSourceService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import com.njcn.web.utils.HttpResultUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @date 2024-11-28
|
||||
*/
|
||||
@Slf4j
|
||||
@Api(tags = "检测源管理")
|
||||
@RestController
|
||||
@RequestMapping("/pqSource")
|
||||
@RequiredArgsConstructor
|
||||
public class PqSourceController extends BaseController {
|
||||
private final IPqSourceService pqSourceService;
|
||||
|
||||
@OperateInfo
|
||||
@PostMapping("/list")
|
||||
@ApiOperation("分页查询检测源")
|
||||
@ApiImplicitParam(name = "param", value = "查询参数", required = true)
|
||||
public HttpResult<Page<PqSource>> list(@RequestBody @Validated PqSourceParam.QueryParam param) {
|
||||
String methodDescribe = getMethodDescribe("list");
|
||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, param);
|
||||
Page<PqSource> result = pqSourceService.listPqSource(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo
|
||||
@GetMapping("/getById")
|
||||
@ApiOperation("根据id查询检测源")
|
||||
@ApiImplicitParam(name = "id", value = "查询参数", required = true)
|
||||
public HttpResult<PqSource> getPqSourceById(@RequestParam("id") String id) {
|
||||
String methodDescribe = getMethodDescribe("getById");
|
||||
LogUtil.njcnDebug(log, "{},查询ID为:{}", methodDescribe, id);
|
||||
PqSource result = pqSourceService.getPqSourceById(id);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(operateType = OperateType.ADD)
|
||||
@PostMapping("/add")
|
||||
@ApiOperation("新增检测源")
|
||||
@ApiImplicitParam(name = "param", value = "检测源", required = true)
|
||||
public HttpResult<Object> add(@RequestBody @Validated PqSourceParam param) {
|
||||
String methodDescribe = getMethodDescribe("add");
|
||||
LogUtil.njcnDebug(log, "{},新增数据为:{}", methodDescribe, param);
|
||||
boolean result = pqSourceService.addPqSource(param);
|
||||
if (result) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
@OperateInfo(operateType = OperateType.UPDATE)
|
||||
@PostMapping("/update")
|
||||
@ApiOperation("修改检测源")
|
||||
@ApiImplicitParam(name = "param", value = "检测源", required = true)
|
||||
public HttpResult<Object> update(@RequestBody @Validated PqSourceParam.UpdateParam param) {
|
||||
String methodDescribe = getMethodDescribe("update");
|
||||
LogUtil.njcnDebug(log, "{},修改数据为:{}", methodDescribe, param);
|
||||
boolean result = pqSourceService.updatePqSource(param);
|
||||
if (result) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
@OperateInfo(operateType = OperateType.DELETE)
|
||||
@PostMapping("/delete")
|
||||
@ApiOperation("删除检测源")
|
||||
@ApiImplicitParam(name = "ids", value = "检测源id", required = true)
|
||||
public HttpResult<Object> delete(@RequestBody List<String> ids) {
|
||||
String methodDescribe = getMethodDescribe("delete");
|
||||
LogUtil.njcnDebug(log, "{},删除ID数据为:{}", methodDescribe, String.join(StrUtil.COMMA, ids));
|
||||
boolean result = pqSourceService.deletePqSource(ids);
|
||||
if (result) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
@OperateInfo
|
||||
@GetMapping("/getAll")
|
||||
@ApiOperation("获取指定模式下的所有检测源")
|
||||
@ApiImplicitParam(name = "patternId", value = "模式Id", required = true)
|
||||
public HttpResult<List<Map<String, Object>>> getAllPqSource(@RequestParam("patternId") String patternId) {
|
||||
String methodDescribe = getMethodDescribe("getAllPqSource");
|
||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, patternId);
|
||||
List<Map<String, Object>> result = pqSourceService.listAllPqSource(patternId);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo
|
||||
@GetMapping("/getSourceParam")
|
||||
@ApiOperation("按照检测源ID获取源参数")
|
||||
@ApiImplicitParam(name = "pqSourceId", value = "检测源ID", required = true)
|
||||
public HttpResult<List<SourceParam>> getSourceParam(@RequestParam("sourceId") String sourceId) {
|
||||
String methodDescribe = getMethodDescribe("getParam");
|
||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, sourceId);
|
||||
List<SourceParam> result = pqSourceService.getSourceParam(sourceId);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo
|
||||
@GetMapping("/aa")
|
||||
@ApiOperation("按照检测源ID获取源参数")
|
||||
@ApiImplicitParam(name = "pqSourceId", value = "检测源ID", required = true)
|
||||
public HttpResult<SourceInitialize> aa(@RequestParam("sourceId") String sourceId) {
|
||||
String methodDescribe = getMethodDescribe("getParam");
|
||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, sourceId);
|
||||
SourceInitialize sourceInitializeParam = pqSourceService.getSourceInitializeParam(sourceId);
|
||||
String jsonString = JSON.toJSONString(sourceInitializeParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, sourceInitializeParam, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.njcn.gather.source.mapper;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.njcn.gather.source.pojo.po.PqSource;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @date 2024-11-28
|
||||
*/
|
||||
public interface PqSourceMapper extends MPJBaseMapper<PqSource> {
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
<?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.gather.source.mapper.PqSourceMapper">
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
package com.njcn.gather.source.pojo.param;
|
||||
|
||||
import com.njcn.common.pojo.constant.PatternRegex;
|
||||
import com.njcn.gather.device.pojo.constant.DevValidMessage;
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Pattern;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @data 2024-11-28
|
||||
*/
|
||||
@Data
|
||||
public class PqSourceParam {
|
||||
|
||||
/**
|
||||
* 检测源名称(检测源类型 + 设备类型 + 数字自动生成)
|
||||
*/
|
||||
// @ApiModelProperty(value = "检测源名称", required = true)
|
||||
// @NotBlank(message = DeviceValidMessage.NAME_NOT_BLANK)
|
||||
// @Pattern(regexp = PatternRegex.PQ_SOURCE_NAME, message = DeviceValidMessage.PQ_SOURCE_NAME_FORMAT_ERROR)
|
||||
// private String name;
|
||||
|
||||
/**
|
||||
* 检测模式,字典表
|
||||
*/
|
||||
@NotBlank(message = DevValidMessage.PATTERN_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.PATTERN_FORMAT_ERROR)
|
||||
private String pattern;
|
||||
|
||||
/**
|
||||
* 检测源类型,字典表
|
||||
*/
|
||||
@ApiModelProperty(value = "检测源类型", required = true)
|
||||
@NotBlank(message = DevValidMessage.PQ_SOURCE_TYPE_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.PQ_SOURCE_TYPE_FORMAT_ERROR)
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 设备类型,字典表
|
||||
*/
|
||||
@ApiModelProperty(value = "设备类型", required = true)
|
||||
@NotBlank(message = DevValidMessage.DEV_TYPE_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.DEV_TYPE_FORMAT_ERROR)
|
||||
private String devType;
|
||||
|
||||
@ApiModelProperty("源参数")
|
||||
private String parameter;
|
||||
|
||||
// @ApiModelProperty("源参数")
|
||||
// private List<PqSourceParameterParam> parameterList;
|
||||
|
||||
@Data
|
||||
public static class QueryParam extends BaseParam {
|
||||
@ApiModelProperty(value = "检测源名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("模式")
|
||||
@NotBlank(message = DevValidMessage.PATTERN_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.PATTERN_FORMAT_ERROR)
|
||||
private String pattern;
|
||||
|
||||
@ApiModelProperty(value = "检测源类型")
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.PQ_SOURCE_TYPE_FORMAT_ERROR)
|
||||
private String type;
|
||||
|
||||
@ApiModelProperty(value = "设备类型")
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.DEV_TYPE_FORMAT_ERROR)
|
||||
private String devType;
|
||||
}
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class UpdateParam extends PqSourceParam {
|
||||
@ApiModelProperty(value = "检测源ID", required = true)
|
||||
@NotBlank(message = DevValidMessage.ID_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.ID_FORMAT_ERROR)
|
||||
private String id;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.njcn.gather.source.pojo.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.njcn.db.mybatisplus.bo.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @date 2024-11-28
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("pq_source")
|
||||
public class PqSource extends BaseEntity implements Serializable {
|
||||
private static final long serialVersionUID = -80375393371680137L;
|
||||
/**
|
||||
* 检测源ID
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 检测源名称(检测源类型 + 设备类型 + 数字自动生成)
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 检测模式,字典表
|
||||
*/
|
||||
private String pattern;
|
||||
|
||||
/**
|
||||
* 检测源类型,字典表
|
||||
*/
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 设备类型,字典表
|
||||
*/
|
||||
private String devType;
|
||||
|
||||
/**
|
||||
* 源参数
|
||||
*/
|
||||
private String parameter;
|
||||
|
||||
/**
|
||||
* 状态:0-删除 1-正常
|
||||
*/
|
||||
private Integer state;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.njcn.gather.source.pojo.po;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @data 2024-12-09
|
||||
*/
|
||||
@Data
|
||||
public class SourceInitialize {
|
||||
|
||||
@JSONField(ordinal = 1)
|
||||
private String sourceId;
|
||||
|
||||
@JSONField(ordinal = 2)
|
||||
private String sourceType;
|
||||
|
||||
@JSONField(ordinal = 4)
|
||||
private String sourceDesc;
|
||||
|
||||
@JSONField(ordinal = 3)
|
||||
private List<Initialize> sourceParamList;
|
||||
|
||||
@Data
|
||||
public static class Initialize {
|
||||
|
||||
@JSONField(serialize = false)
|
||||
private String id;
|
||||
|
||||
@JSONField(serialize = false)
|
||||
private String pId;
|
||||
|
||||
@JSONField(ordinal = 1)
|
||||
private String type;
|
||||
|
||||
@JSONField(ordinal = 2)
|
||||
private String desc;
|
||||
|
||||
|
||||
@JSONField(ordinal =4)
|
||||
private String value;
|
||||
|
||||
@JSONField(serialize = false)
|
||||
private Integer sort;
|
||||
|
||||
@JSONField(ordinal = 3)
|
||||
private List<Initialize> children;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.njcn.gather.source.pojo.po;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @data 2024-12-09
|
||||
*/
|
||||
@Data
|
||||
public class SourceParam {
|
||||
private String id;
|
||||
|
||||
private String pId;
|
||||
|
||||
private String type;
|
||||
|
||||
private String desc;
|
||||
|
||||
private String value;
|
||||
|
||||
private Integer sort;
|
||||
|
||||
private List<SourceParam> children;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user