比对式标准设备、被检设备、监测点功能
This commit is contained in:
@@ -19,9 +19,10 @@ 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.pojo.enums.CommonEnum;
|
||||
import com.njcn.gather.device.pojo.po.PqDev;
|
||||
import com.njcn.gather.device.pojo.po.PqDevSub;
|
||||
import com.njcn.gather.device.pojo.vo.PreDetection;
|
||||
import com.njcn.gather.device.service.IPqDevService;
|
||||
import com.njcn.gather.device.service.IPqDevSubService;
|
||||
import com.njcn.gather.plan.pojo.po.AdPlan;
|
||||
import com.njcn.gather.plan.service.IAdPlanService;
|
||||
import com.njcn.gather.script.pojo.param.PqScriptCheckDataParam;
|
||||
@@ -83,6 +84,7 @@ public class SocketDevResponseService {
|
||||
|
||||
|
||||
private final IPqDevService iPqDevService;
|
||||
private final IPqDevSubService iPqDevSubService;
|
||||
private final IPqScriptDtlsService scriptDtlsService;
|
||||
private final IPqScriptDtlsService pqScriptDtlsService;
|
||||
private final DetectionServiceImpl detectionServiceImpl;
|
||||
@@ -474,14 +476,14 @@ public class SocketDevResponseService {
|
||||
//修改设备表Factor_Check_Result字段
|
||||
XiNumberManager.devXiNumDataMap.forEach((key, val) -> {
|
||||
DevXiNumData small = XiNumberManager.smallDevXiNumDataMap.get(key);
|
||||
LambdaUpdateWrapper<PqDev> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.eq(PqDev::getId, FormalTestManager.devIdMapComm.get(key));
|
||||
LambdaUpdateWrapper<PqDevSub> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.eq(PqDevSub::getDevId, FormalTestManager.devIdMapComm.get(key));
|
||||
if (val.getResultFlag() == 0 || small.getResultFlag() == 0) {
|
||||
updateWrapper.set(PqDev::getFactorCheckResult, 0);
|
||||
updateWrapper.set(PqDevSub::getFactorCheckResult, 0);
|
||||
} else {
|
||||
updateWrapper.set(PqDev::getFactorCheckResult, 1);
|
||||
updateWrapper.set(PqDevSub::getFactorCheckResult, 1);
|
||||
}
|
||||
iPqDevService.update(updateWrapper);
|
||||
iPqDevSubService.update(updateWrapper);
|
||||
updateWrapper.clear();
|
||||
});
|
||||
}
|
||||
@@ -1647,14 +1649,15 @@ public class SocketDevResponseService {
|
||||
/**
|
||||
* 相须校验-从幅值、相角两个维度判断是否合格
|
||||
*
|
||||
* @param channelListDTO
|
||||
* @param devData
|
||||
* @param devPhase
|
||||
* @param channelListDTO 源下发的脚本
|
||||
* @param devData 装置返回幅值数据
|
||||
* @param devPhase 装置返回相角数据
|
||||
* @return
|
||||
*/
|
||||
private Boolean getaBoolean(SourceIssue.ChannelListDTO channelListDTO, Double devData, Double devPhase) {
|
||||
Boolean isDev = false;
|
||||
Boolean isPhase = false;
|
||||
|
||||
if (ObjectUtil.isNotNull(devData)) {
|
||||
isDev = NumberUtil.isIn(BigDecimal.valueOf(devData),
|
||||
BigDecimal.valueOf(channelListDTO.getFAmp() * 0.95),
|
||||
|
||||
@@ -18,6 +18,9 @@ public class DevData {
|
||||
@JSONField(name = "Time", ordinal = 1)
|
||||
private String time;
|
||||
|
||||
/**
|
||||
* 设备ip_通道号 这种形式
|
||||
*/
|
||||
@JSONField(name = "ID", ordinal = 2)
|
||||
private String id;
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ public class PreDetectionServiceImpl implements PreDetectionService {
|
||||
@Value("${socket.source.port:61000}")
|
||||
private Integer port;
|
||||
|
||||
private final SocketSourceResponseService sourceResponseService;
|
||||
//private final SocketSourceResponseService sourceResponseService;
|
||||
|
||||
|
||||
@Override
|
||||
@@ -126,7 +126,8 @@ public class PreDetectionServiceImpl implements PreDetectionService {
|
||||
msg.setOperateCode(SourceOperateCodeEnum.INIT_GATHER.getValue());
|
||||
msg.setData(JSON.toJSONString(sourceParam));
|
||||
param.setSourceId(sourceParam.getSourceId());
|
||||
NettyClient.socketClient(ip, port, param, JSON.toJSONString(msg), new NettySourceClientHandler(param, sourceResponseService));
|
||||
// NettyClient.socketClient(ip, port, param, JSON.toJSONString(msg), new NettySourceClientHandler(param, sourceResponseService));
|
||||
NettyClient.socketClient(ip, port, param, JSON.toJSONString(msg), new NettySourceClientHandler(param, socketSourceResponseService));
|
||||
} else {
|
||||
throw new BusinessException(DetectionResponseEnum.SOURCE_INFO_NOT);
|
||||
}
|
||||
@@ -152,7 +153,8 @@ public class PreDetectionServiceImpl implements PreDetectionService {
|
||||
socketMsg.setOperateCode(SourceOperateCodeEnum.INIT_GATHER.getValue());
|
||||
socketMsg.setData(JSON.toJSONString(sourceParam));
|
||||
//建立与源控程序的socket连接,
|
||||
NettyClient.socketClient(ip, port, param, JSON.toJSONString(socketMsg), new NettySourceClientHandler(param, sourceResponseService));
|
||||
// NettyClient.socketClient(ip, port, param, JSON.toJSONString(socketMsg), new NettySourceClientHandler(param, sourceResponseService));
|
||||
NettyClient.socketClient(ip, port, param, JSON.toJSONString(socketMsg), new NettySourceClientHandler(param, socketSourceResponseService));
|
||||
} else {
|
||||
throw new BusinessException(DetectionResponseEnum.SOURCE_INFO_NOT);
|
||||
}
|
||||
@@ -170,7 +172,7 @@ public class PreDetectionServiceImpl implements PreDetectionService {
|
||||
socketMsg.setRequestId(SourceOperateCodeEnum.YJC_YTXJY.getValue());
|
||||
socketMsg.setOperateCode(SourceOperateCodeEnum.INIT_GATHER.getValue());
|
||||
socketMsg.setData(JSON.toJSONString(sourceParam));
|
||||
NettyClient.socketClient(ip, port, param, JSON.toJSONString(socketMsg), new NettySourceClientHandler(param, sourceResponseService));
|
||||
NettyClient.socketClient(ip, port, param, JSON.toJSONString(socketMsg), new NettySourceClientHandler(param, socketSourceResponseService));
|
||||
} else {
|
||||
throw new BusinessException(DetectionResponseEnum.SOURCE_INFO_NOT);
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ public class HeartbeatHandler extends SimpleChannelInboundHandler<String> {
|
||||
super.channelInactive(ctx);
|
||||
}
|
||||
|
||||
// 每30秒发送一次心跳
|
||||
// 每10秒发送一次心跳
|
||||
private void scheduleHeartbeat(ChannelHandlerContext ctx) {
|
||||
heartbeatExecutor.scheduleAtFixedRate(() -> {
|
||||
if (ctx.channel().isActive()) {
|
||||
|
||||
@@ -63,6 +63,9 @@ public class NettyClient {
|
||||
.addLast(new StringEncoder(CharsetUtil.UTF_8))
|
||||
.addLast(new HeartbeatHandler(param, dev))
|
||||
//空闲状态的handler
|
||||
//readerIdleTimeSeconds:在指定的秒数内如果没有读取到任何数据,则触发IdleState.READER_IDLE事件。
|
||||
//writerIdleTimeSeconds:在指定的秒数内如果没有写入任何数据,则触发IdleState.WRITER_IDLE事件。
|
||||
//allIdleTimeSeconds:在指定的秒数内如果没有发生任何读取或写入操作,则触发IdleState.ALL_IDLE事件。
|
||||
.addLast(new IdleStateHandler(60, 0, 0, TimeUnit.SECONDS))
|
||||
.addLast(handler);
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ public class NettyDevClientHandler extends SimpleChannelInboundHandler<String> {
|
||||
@Override
|
||||
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) {
|
||||
Boolean fly = false;
|
||||
if (evt instanceof IdleStateEvent) {
|
||||
if (evt instanceof IdleStateEvent) { //IdleState.在一段时间内没有收到任何消息时,会触发该事件
|
||||
if (((IdleStateEvent) evt).state() == IdleState.READER_IDLE) {
|
||||
System.out.println(LocalDateTime.now() + "devHandler触发读超时函数**************************************");
|
||||
if (!FormalTestManager.hasStopFlag) {
|
||||
|
||||
@@ -1,16 +1,10 @@
|
||||
package com.njcn.gather.detection.util.socket.cilent;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.njcn.gather.detection.handler.SocketSourceResponseService;
|
||||
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.pojo.vo.WebSocketVO;
|
||||
import com.njcn.gather.detection.util.socket.CnSocketUtil;
|
||||
import com.njcn.gather.detection.util.socket.MsgUtil;
|
||||
import com.njcn.gather.detection.util.socket.SocketManager;
|
||||
import io.netty.channel.Channel;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import io.netty.channel.SimpleChannelInboundHandler;
|
||||
import io.netty.handler.timeout.IdleState;
|
||||
@@ -21,7 +15,6 @@ import lombok.RequiredArgsConstructor;
|
||||
import java.io.IOException;
|
||||
import java.net.ConnectException;
|
||||
import java.net.ProtocolException;
|
||||
import java.util.Objects;
|
||||
|
||||
|
||||
/**
|
||||
@@ -71,10 +64,10 @@ public class NettySourceClientHandler extends SimpleChannelInboundHandler<String
|
||||
* @param ctx
|
||||
*/
|
||||
@Override
|
||||
public void channelInactive(ChannelHandlerContext ctx) throws Exception{
|
||||
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
|
||||
System.out.println("源通讯客户端断线");
|
||||
ctx.close();
|
||||
SocketManager.removeUser(webUser.getUserPageId()+sourceTag);
|
||||
SocketManager.removeUser(webUser.getUserPageId() + sourceTag);
|
||||
// System.out.println("断线了......" + ctx.channel());
|
||||
// ctx.channel().eventLoop().schedule(() -> {
|
||||
// System.out.println("断线重连......");
|
||||
@@ -125,7 +118,7 @@ public class NettySourceClientHandler extends SimpleChannelInboundHandler<String
|
||||
|
||||
} else if (cause instanceof IOException) {
|
||||
// 处理I/O异常,例如读写错误
|
||||
CnSocketUtil.sendToWebSocket(webUser.getUserPageId(),SourceOperateCodeEnum.SERVER_ERROR.getValue(),SourceOperateCodeEnum.SERVER_ERROR.getValue(),SourceOperateCodeEnum.SERVER_ERROR.getMsg(),null );
|
||||
CnSocketUtil.sendToWebSocket(webUser.getUserPageId(), SourceOperateCodeEnum.SERVER_ERROR.getValue(), SourceOperateCodeEnum.SERVER_ERROR.getValue(), SourceOperateCodeEnum.SERVER_ERROR.getMsg(), null);
|
||||
|
||||
// 例如,可以记录更详细的I/O错误信息
|
||||
} else if (cause instanceof TimeoutException) {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.njcn.gather.device.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@@ -12,7 +11,6 @@ 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.PqDevVO;
|
||||
import com.njcn.gather.device.service.IPqDevService;
|
||||
import com.njcn.gather.type.pojo.po.DevType;
|
||||
@@ -129,8 +127,8 @@ public class PqDevController extends BaseController {
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.DOWNLOAD)
|
||||
@PostMapping("/downloadTemplate")
|
||||
@ApiOperation("下载被检设备导入文件模板")
|
||||
public void downloadTemplate() {
|
||||
pqDevService.downloadTemplate();
|
||||
public void downloadTemplate(@RequestBody PqDevParam pqDevParam) {
|
||||
pqDevService.downloadTemplate(pqDevParam.getPattern());
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.UPLOAD)
|
||||
@@ -140,15 +138,19 @@ public class PqDevController extends BaseController {
|
||||
@ApiImplicitParam(name = "file", value = "被检设备数据文件", required = true),
|
||||
@ApiImplicitParam(name = "patternId", value = "模式id", required = true)
|
||||
})
|
||||
public HttpResult<Object> importDev(@RequestParam("file") MultipartFile file, @RequestParam("patternId") String patternId, HttpServletResponse response) {
|
||||
public HttpResult<Boolean> importDev(@RequestParam("file") MultipartFile file, @RequestParam("patternId") String patternId, HttpServletResponse response) {
|
||||
String methodDescribe = getMethodDescribe("importDev");
|
||||
LogUtil.njcnDebug(log, "{},上传文件为:{}", methodDescribe, file.getOriginalFilename());
|
||||
boolean fileType = FileUtil.judgeFileIsExcel(file.getOriginalFilename());
|
||||
if (!fileType) {
|
||||
throw new BusinessException(CommonResponseEnum.FILE_XLSX_ERROR);
|
||||
}
|
||||
pqDevService.importDev(file, patternId, null, response);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
Boolean result = pqDevService.importDev(file, patternId, null, response);
|
||||
if (result) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@@ -169,17 +171,14 @@ public class PqDevController extends BaseController {
|
||||
public HttpResult<List<PqDevVO>> listByPlanId(@RequestBody @Validated PqDevParam.QueryParam param) {
|
||||
String methodDescribe = getMethodDescribe("listByPlanId");
|
||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, param);
|
||||
List<PqDev> pqDevList = pqDevService.listByPlanId(param);
|
||||
List<PqDevVO> pqDevVOList = pqDevService.listByPlanId(param);
|
||||
|
||||
List<PqDevVO> result = BeanUtil.copyToList(pqDevList, PqDevVO.class);
|
||||
result.forEach(pqDevVO -> {
|
||||
pqDevVOList.forEach(pqDevVO -> {
|
||||
DevType devType = devTypeService.getById(pqDevVO.getDevType());
|
||||
if (ObjectUtil.isNotNull(devType)) {
|
||||
pqDevVO.setDevChns(devType.getDevChns());
|
||||
pqDevVO.setDevVolt(devType.getDevVolt());
|
||||
pqDevVO.setDevCurr(devType.getDevCurr());
|
||||
}
|
||||
});
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, pqDevVOList, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,142 @@
|
||||
package com.njcn.gather.device.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.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.PqStandardDevParam;
|
||||
import com.njcn.gather.device.pojo.po.PqStandardDev;
|
||||
import com.njcn.gather.device.service.IPqStandardDevService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import com.njcn.web.utils.FileUtil;
|
||||
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 org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @date 2025-07-02
|
||||
*/
|
||||
@Slf4j
|
||||
@Api(tags = "标准设备管理")
|
||||
@RestController
|
||||
@RequestMapping("/pqStandardDev")
|
||||
@RequiredArgsConstructor
|
||||
public class PqStandardDevController extends BaseController {
|
||||
private final IPqStandardDevService pqStandardDevService;
|
||||
|
||||
@OperateInfo
|
||||
@PostMapping("/list")
|
||||
@ApiOperation("分页查询标准设备")
|
||||
@ApiImplicitParam(name = "queryParam", value = "查询参数", required = true)
|
||||
public HttpResult<Page<PqStandardDev>> list(@RequestBody PqStandardDevParam.QueryParam queryParam) {
|
||||
String methodDescribe = getMethodDescribe("list");
|
||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, queryParam);
|
||||
Page<PqStandardDev> result = pqStandardDevService.listPqStandardDevs(queryParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo
|
||||
@GetMapping("/getById")
|
||||
@ApiOperation("根据id查询标准设备")
|
||||
@ApiImplicitParam(name = "id", value = "标准设备id", required = true)
|
||||
public HttpResult<PqStandardDev> getById(@RequestParam("id") String id) {
|
||||
String methodDescribe = getMethodDescribe("getById");
|
||||
LogUtil.njcnDebug(log, "{},查询ID为:{}", methodDescribe, id);
|
||||
PqStandardDev result = pqStandardDevService.getPqStandardDevById(id);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(operateType = OperateType.ADD)
|
||||
@PostMapping("/add")
|
||||
@ApiOperation("新增标准设备")
|
||||
@ApiImplicitParam(name = "param", value = "标准设备", required = true)
|
||||
public HttpResult<Boolean> add(@RequestBody @Validated PqStandardDevParam param) {
|
||||
String methodDescribe = getMethodDescribe("add");
|
||||
LogUtil.njcnDebug(log, "{},新增数据为:{}", methodDescribe, param);
|
||||
boolean result = pqStandardDevService.addPqStandardDev(param);
|
||||
if (result) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
@OperateInfo(operateType = OperateType.UPDATE)
|
||||
@PostMapping("/update")
|
||||
@ApiOperation("修改标准设备")
|
||||
@ApiImplicitParam(name = "param", value = "标准设备", required = true)
|
||||
public HttpResult<Boolean> update(@RequestBody @Validated PqStandardDevParam.UpdateParam param) {
|
||||
String methodDescribe = getMethodDescribe("update");
|
||||
LogUtil.njcnDebug(log, "{},修改数据为:{}", methodDescribe, param);
|
||||
boolean result = pqStandardDevService.updatePqStandardDev(param);
|
||||
if (result) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
@OperateInfo(operateType = OperateType.DELETE)
|
||||
@PostMapping("/delete")
|
||||
@ApiOperation("删除标准设备")
|
||||
@ApiImplicitParam(name = "ids", value = "标准设备id", required = true)
|
||||
public HttpResult<Boolean> delete(@RequestBody List<String> ids) {
|
||||
String methodDescribe = getMethodDescribe("delete");
|
||||
LogUtil.njcnDebug(log, "{},删除ID数据为:{}", methodDescribe, String.join(StrUtil.COMMA, ids));
|
||||
boolean result = pqStandardDevService.deletePqStandardDevs(ids);
|
||||
if (result) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.DOWNLOAD)
|
||||
@PostMapping("/export")
|
||||
@ApiOperation("批量导出标准设备")
|
||||
@ApiImplicitParam(name = "queryParam", value = "查询参数", required = true)
|
||||
public void export(@RequestBody PqStandardDevParam.QueryParam queryParam) {
|
||||
String methodDescribe = getMethodDescribe("export");
|
||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, queryParam);
|
||||
pqStandardDevService.export(queryParam);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.DOWNLOAD)
|
||||
@PostMapping("/downloadTemplate")
|
||||
@ApiOperation("下载标准设备导入文件模板")
|
||||
public void downloadTemplate() {
|
||||
pqStandardDevService.downloadTemplate();
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.UPLOAD)
|
||||
@PostMapping("/import")
|
||||
@ApiOperation("导入标准设备")
|
||||
@ApiImplicitParam(name = "file", value = "导入文件", required = true)
|
||||
public HttpResult<Object> importData(@RequestParam("file") MultipartFile file, HttpServletResponse response) {
|
||||
String methodDescribe = getMethodDescribe("importData");
|
||||
LogUtil.njcnDebug(log, "{},导入文件为:{}", methodDescribe, file.getOriginalFilename());
|
||||
boolean fileType = FileUtil.judgeFileIsExcel(file.getOriginalFilename());
|
||||
if (!fileType) {
|
||||
throw new BusinessException(CommonResponseEnum.FILE_XLSX_ERROR);
|
||||
}
|
||||
pqStandardDevService.importData(file, response);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package com.njcn.gather.device.mapper;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.njcn.gather.device.pojo.param.PqDevParam;
|
||||
import com.njcn.gather.device.pojo.po.PqDev;
|
||||
import com.njcn.gather.device.pojo.vo.PqDevVO;
|
||||
import com.njcn.gather.device.pojo.vo.PreDetection;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@@ -47,6 +49,12 @@ public interface PqDevMapper extends MPJBaseMapper<PqDev> {
|
||||
*
|
||||
* @param planId
|
||||
*/
|
||||
String getScriptIdByPlanId(String planId);
|
||||
String getScriptIdByPlanId(@Param("planId")String planId);
|
||||
|
||||
List<PqDevVO> selectByQueryParam(PqDevParam.QueryParam param);
|
||||
|
||||
PqDevVO selectByDevId(@Param("devId") String devId);
|
||||
|
||||
List<PqDevVO> listByDevIds(@Param("devIds") List<String> devIds);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.njcn.gather.device.mapper;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.njcn.gather.device.pojo.po.PqDevSub;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @date 2025-07-02
|
||||
*/
|
||||
public interface PqDevSubMapper extends MPJBaseMapper<PqDevSub> {
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.njcn.gather.device.mapper;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.njcn.gather.device.pojo.po.PqStandardDev;
|
||||
|
||||
/**
|
||||
* @author makejava
|
||||
* @date 2025-05-09
|
||||
*/
|
||||
public interface PqStandardDevMapper extends MPJBaseMapper<PqStandardDev> {
|
||||
|
||||
}
|
||||
|
||||
@@ -4,17 +4,17 @@
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<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="Series" property="devCode" />
|
||||
<result column="Dev_Key" property="devKey" />
|
||||
<result column="icdType" property="icdType" />
|
||||
<result column="Dev_Chns" property="devChns" />
|
||||
<result column="Dev_Volt" property="devVolt" />
|
||||
<result column="Dev_Curr" property="devCurr" />
|
||||
<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="Series" property="devCode"/>
|
||||
<result column="Dev_Key" property="devKey"/>
|
||||
<result column="icdType" property="icdType"/>
|
||||
<result column="Dev_Chns" property="devChns"/>
|
||||
<result column="Dev_Volt" property="devVolt"/>
|
||||
<result column="Dev_Curr" property="devCurr"/>
|
||||
|
||||
<collection
|
||||
property="monitorList"
|
||||
@@ -50,24 +50,81 @@
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<update id="finishPlan" >
|
||||
update ad_plan set Test_State = 2 where id = #{planId}
|
||||
<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 id="updateReportState">
|
||||
update pq_dev
|
||||
set Report_State = 1
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="updatePlanCheckResult">
|
||||
update ad_plan set Result = #{checkResult} where id = #{planId}
|
||||
update ad_plan
|
||||
set Result = #{checkResult}
|
||||
where id = #{planId}
|
||||
</update>
|
||||
|
||||
<update id="updatePlanTestState">
|
||||
update ad_plan set Test_State = #{testState} where id = #{planId}
|
||||
update ad_plan
|
||||
set Test_State = #{testState}
|
||||
where id = #{planId}
|
||||
</update>
|
||||
|
||||
<select id="getScriptIdByPlanId" resultType="java.lang.String">
|
||||
SELECT Script_Id FROM ad_plan WHERE id = #{planId}
|
||||
SELECT Script_Id
|
||||
FROM ad_plan
|
||||
WHERE id = #{planId}
|
||||
</select>
|
||||
|
||||
<select id="selectByQueryParam" resultType="com.njcn.gather.device.pojo.vo.PqDevVO">
|
||||
SELECT dev.*,dev_sub.* FROM pq_dev dev
|
||||
left JOIN pq_dev_sub dev_sub ON dev.Id = dev_sub.Dev_Id
|
||||
<where>
|
||||
dev.state = 1
|
||||
<if test="planId!= null and planId!= ''">
|
||||
AND dev.Plan_Id = #{planId}
|
||||
</if>
|
||||
<if test="name!= null and name!= ''">
|
||||
AND dev.Name LIKE CONCAT('%',#{name},'%')
|
||||
</if>
|
||||
<if test="checkStateList!= null and checkStateList.size()!= 0 ">
|
||||
AND dev_sub.Check_State in
|
||||
<foreach collection="checkStateList" open="(" close=")" item="item" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="checkResult!= null">
|
||||
AND dev_sub.Check_Result = #{checkResult}
|
||||
</if>
|
||||
<if test="reportState!= null">
|
||||
AND dev_sub.Report_State = #{reportState}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY dev.Create_Time DESC,dev.Name
|
||||
</select>
|
||||
|
||||
<select id="selectByDevId" resultType="com.njcn.gather.device.pojo.vo.PqDevVO">
|
||||
SELECT dev.*, dev_sub.*
|
||||
FROM pq_dev dev
|
||||
left JOIN pq_dev_sub dev_sub ON dev.Id = dev_sub.Dev_Id
|
||||
WHERE dev.Id = #{devId}
|
||||
</select>
|
||||
|
||||
<select id="listByDevIds" resultType="com.njcn.gather.device.pojo.vo.PqDevVO">
|
||||
SELECT dev.*, dev_sub.*
|
||||
FROM pq_dev dev
|
||||
left JOIN pq_dev_sub dev_sub ON dev.Id = dev_sub.Dev_Id
|
||||
WHERE dev.state = 1
|
||||
<if test="devIds!= null and devIds.size() != 0">
|
||||
AND dev.Id in
|
||||
<foreach collection="devIds" open="(" close=")" item="item" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
</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.device.mapper.PqDevSubMapper">
|
||||
|
||||
|
||||
</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.device.mapper.PqStandardDevMapper">
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -6,12 +6,14 @@ import com.njcn.gather.pojo.constant.DetectionValidMessage;
|
||||
import com.njcn.web.pojo.annotation.DateTimeStrValid;
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.models.auth.In;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.hibernate.validator.constraints.Range;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.*;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -30,7 +32,7 @@ public class PqDevParam {
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.PATTERN_FORMAT_ERROR)
|
||||
private String pattern;
|
||||
|
||||
@ApiModelProperty(value = "设备类型,字典表", required = true)
|
||||
@ApiModelProperty(value = "设备类型", required = true)
|
||||
@NotBlank(message = DetectionValidMessage.DEV_TYPE_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.DEV_TYPE_FORMAT_ERROR)
|
||||
private String devType;
|
||||
@@ -98,13 +100,13 @@ public class PqDevParam {
|
||||
@ApiModelProperty("报告路径")
|
||||
private String reportPath;
|
||||
|
||||
@ApiModelProperty("设备关键信息二维码")
|
||||
private String qrCode;
|
||||
// @ApiModelProperty("设备关键信息二维码")
|
||||
// private String qrCode;
|
||||
|
||||
@ApiModelProperty(value = "检测次数,默认为0", required = true)
|
||||
@NotNull(message = DetectionValidMessage.RECHECK_NUM_NOT_NULL)
|
||||
@Min(value = 0, message = DetectionValidMessage.RECHECK_NUM_FORMAT_ERROR)
|
||||
private Integer reCheckNum;
|
||||
// @ApiModelProperty(value = "检测次数,默认为0", required = true)
|
||||
// @NotNull(message = DetectionValidMessage.RECHECK_NUM_NOT_NULL)
|
||||
// @Min(value = 0, message = DetectionValidMessage.RECHECK_NUM_FORMAT_ERROR)
|
||||
// private Integer reCheckNum;
|
||||
|
||||
@ApiModelProperty("是否支持系数校准")
|
||||
private Integer factorFlag;
|
||||
@@ -122,6 +124,19 @@ public class PqDevParam {
|
||||
@ApiModelProperty("委托方")
|
||||
private String delegate;
|
||||
|
||||
@ApiModelProperty("被检通道")
|
||||
private String inspectChannel;
|
||||
|
||||
@ApiModelProperty("投运日期")
|
||||
@DateTimeStrValid(message = DetectionValidMessage.OPERATION_DATE_FORMAT_ERROR)
|
||||
private String operationDate;
|
||||
|
||||
@ApiModelProperty("定验日期")
|
||||
@DateTimeStrValid(message = DetectionValidMessage.INSPECT_DATE_FORMAT_ERROR)
|
||||
private String inspectDate;
|
||||
|
||||
@ApiModelProperty("是否为导入设备")
|
||||
private Integer importFlag;
|
||||
/**
|
||||
* 更新操作实体
|
||||
*/
|
||||
@@ -168,6 +183,14 @@ public class PqDevParam {
|
||||
@Max(value = 2, message = DetectionValidMessage.REPORT_STATE_FORMAT_ERROR)
|
||||
private Integer reportState;
|
||||
|
||||
@ApiModelProperty("所属地市名称")
|
||||
private String cityName;
|
||||
|
||||
@ApiModelProperty("所属供电公司名称")
|
||||
private String gdName;
|
||||
|
||||
@ApiModelProperty("所属电站名称")
|
||||
private String subName;
|
||||
}
|
||||
|
||||
@Data
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
package com.njcn.gather.device.pojo.param;
|
||||
|
||||
import com.njcn.common.pojo.constant.PatternRegex;
|
||||
import com.njcn.gather.pojo.constant.DetectionValidMessage;
|
||||
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.constraints.*;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @data 2025-05-09
|
||||
*/
|
||||
@Data
|
||||
public class PqStandardDevParam {
|
||||
@ApiModelProperty(value = "名称", required = true)
|
||||
@NotBlank(message = DetectionValidMessage.NAME_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.DEV_NAME_REGEX, message = DetectionValidMessage.NAME_FORMAT_ERROR)
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "设备类型", required = true)
|
||||
@NotBlank(message = DetectionValidMessage.DEV_TYPE_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.DEV_TYPE_FORMAT_ERROR)
|
||||
private String devType;
|
||||
|
||||
@ApiModelProperty(value = "设备厂家", required = true)
|
||||
@NotBlank(message = DetectionValidMessage.MANUFACTURER_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.MANUFACTURER_FORMAT_ERROR)
|
||||
private String manufacturer;
|
||||
|
||||
@ApiModelProperty(value = "通信协议", required = true)
|
||||
@NotBlank(message = DetectionValidMessage.PROTOCOL_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.PROTOCOL_FORMAT_ERROR)
|
||||
private String protocol;
|
||||
|
||||
@ApiModelProperty(value = "ip地址", required = true)
|
||||
@NotBlank(message = DetectionValidMessage.IP_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.IP_REGEX, message = DetectionValidMessage.IP_FORMAT_ERROR)
|
||||
private String ip;
|
||||
|
||||
@ApiModelProperty(value = "端口", required = true)
|
||||
@NotNull(message = DetectionValidMessage.PORT_NOT_NULL)
|
||||
@Range(min = 1, max = 65535, message = DetectionValidMessage.PORT_RANGE_ERROR)
|
||||
private Integer port;
|
||||
|
||||
@ApiModelProperty(value = "装置是否为加密版本", required = true)
|
||||
@NotNull(message = DetectionValidMessage.ENCRYPTION_NOT_NULL)
|
||||
@Min(value = 0, message = DetectionValidMessage.ENCRYPTION_FLAG_FORMAT_ERROR)
|
||||
@Max(value = 1, message = DetectionValidMessage.ENCRYPTION_FLAG_FORMAT_ERROR)
|
||||
private Integer encryptionFlag;
|
||||
|
||||
@ApiModelProperty("识别码(3ds加密)")
|
||||
private String series;
|
||||
|
||||
@ApiModelProperty("秘钥(3ds加密)")
|
||||
private String devKey;
|
||||
|
||||
@ApiModelProperty(value = "可检通道", required = true)
|
||||
private String inspectChannel;
|
||||
|
||||
/**
|
||||
* 分页查询实体
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class QueryParam extends BaseParam {
|
||||
@ApiModelProperty(value = "名称", required = true)
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "设备厂家", required = true)
|
||||
private String manufacturer;
|
||||
|
||||
@ApiModelProperty(value = "设备类型", required = true)
|
||||
private String devType;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新操作实体
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class UpdateParam extends PqStandardDevParam {
|
||||
@ApiModelProperty(value = "标准设备id", required = true)
|
||||
@NotBlank(message = DetectionValidMessage.ID_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.ID_FORMAT_ERROR)
|
||||
private String id;
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
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;
|
||||
@@ -15,7 +14,6 @@ import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
@@ -115,7 +113,6 @@ public class PqDev extends BaseEntity implements Serializable {
|
||||
/**
|
||||
* 送样日期
|
||||
*/
|
||||
@TableField(updateStrategy = FieldStrategy.IGNORED)
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
@JsonSerialize(using = LocalDateSerializer.class)
|
||||
@@ -136,84 +133,58 @@ public class PqDev extends BaseEntity implements Serializable {
|
||||
*/
|
||||
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;
|
||||
|
||||
@TableField("Check_Time")
|
||||
private LocalDateTime checkTime;
|
||||
|
||||
@TableField("Check_By")
|
||||
private String checkBy;
|
||||
|
||||
@TableField("Preinvestment_Plan")
|
||||
private String preinvestmentPlan;
|
||||
|
||||
/**
|
||||
* 温度
|
||||
*/
|
||||
private Float temperature;
|
||||
|
||||
/**
|
||||
* 相对湿度
|
||||
*/
|
||||
private Float humidity;
|
||||
|
||||
/**
|
||||
* 委托方
|
||||
*/
|
||||
private String delegate;
|
||||
|
||||
/**
|
||||
* 可检通道
|
||||
*/
|
||||
private String inspectChannel;
|
||||
|
||||
/**
|
||||
* 定检日期
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
@JsonSerialize(using = LocalDateSerializer.class)
|
||||
private LocalDate inspectDate;
|
||||
|
||||
/**
|
||||
* 谐波系统设备id
|
||||
*/
|
||||
private String harmSysId;
|
||||
|
||||
/**
|
||||
* 是否为导入设备(比对式使用) 0-否 1-是
|
||||
*/
|
||||
private Integer importFlag;
|
||||
|
||||
/**
|
||||
* 状态:0-删除 1-正常
|
||||
*/
|
||||
private Integer state;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
package com.njcn.gather.device.pojo.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @date 2025-07-04
|
||||
*/
|
||||
@Data
|
||||
@TableName("pq_dev_sub")
|
||||
public class PqDevSub {
|
||||
private static final long serialVersionUID = -93146063424890267L;
|
||||
/**
|
||||
* 关联pq_dev表的id字段
|
||||
*/
|
||||
private String devId;
|
||||
|
||||
/**
|
||||
* 检测状态 0-未检、1检测中、2检测完成、3归档
|
||||
*/
|
||||
private Integer checkState;
|
||||
|
||||
/**
|
||||
* 检测结果 0不符合、1符合、2未检
|
||||
*/
|
||||
private Integer checkResult;
|
||||
|
||||
/**
|
||||
* 报告生成状态 0未生成、1已生成、2未检
|
||||
*/
|
||||
private Integer reportState;
|
||||
|
||||
/**
|
||||
* 检测次数
|
||||
*/
|
||||
@TableField(value = "ReCheck_Num")
|
||||
private Integer recheckNum;
|
||||
|
||||
/**
|
||||
* 守时检测结果 0:不合格, 1:合格,2:/表示没有做守时检测
|
||||
*/
|
||||
private Integer timeCheckResult;
|
||||
|
||||
/**
|
||||
* 系数校准结果 0:不合格,1:合格,2:/表示没有做系数校准
|
||||
*/
|
||||
private Integer factorCheckResult;
|
||||
|
||||
/**
|
||||
* 实时数据结果 0:不合格,1:合格,2:未检
|
||||
*/
|
||||
private Integer realtimeResult;
|
||||
|
||||
/**
|
||||
* 统计数据结果 0:不合格,1:合格,2:未检
|
||||
*/
|
||||
private Integer statisticsResult;
|
||||
|
||||
/**
|
||||
* 录波数据结果 0:不合格,1:合格,2:未检
|
||||
*/
|
||||
private Integer recordedResult;
|
||||
|
||||
/**
|
||||
* 检测人
|
||||
*/
|
||||
private String checkBy;
|
||||
|
||||
/**
|
||||
* 检测时间
|
||||
*/
|
||||
@TableField("Check_Time")
|
||||
private LocalDateTime checkTime;
|
||||
|
||||
/**
|
||||
* 预检测耗时
|
||||
*/
|
||||
private Integer preDetectTime;
|
||||
|
||||
/**
|
||||
* 系数校准耗时
|
||||
*/
|
||||
private Integer coefficientTime;
|
||||
|
||||
/**
|
||||
* 正式检测耗时
|
||||
*/
|
||||
private Integer formalCheckTime;
|
||||
|
||||
/**
|
||||
* 温度
|
||||
*/
|
||||
private Float temperature;
|
||||
|
||||
/**
|
||||
* 相对湿度
|
||||
*/
|
||||
private Float humidity;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.njcn.gather.device.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 makejava
|
||||
* @date 2025-05-09
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("pq_standard_dev")
|
||||
public class PqStandardDev extends BaseEntity implements Serializable {
|
||||
private static final long serialVersionUID = 932459726326242984L;
|
||||
/**
|
||||
* 标准设备id
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 标准设备-名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 标准设备-设备类型
|
||||
*/
|
||||
private String devType;
|
||||
|
||||
/**
|
||||
* 标准设备-设备厂家
|
||||
*/
|
||||
private String manufacturer;
|
||||
|
||||
/**
|
||||
* 可检通道(可多选,中间使用英文逗号隔开)
|
||||
*/
|
||||
private String inspectChannel;
|
||||
|
||||
/**
|
||||
* 通信协议
|
||||
*/
|
||||
private String protocol;
|
||||
|
||||
/**
|
||||
* IP地址
|
||||
*/
|
||||
private String ip;
|
||||
|
||||
/**
|
||||
* 端口号
|
||||
*/
|
||||
private Integer port;
|
||||
|
||||
/**
|
||||
* 是否加密(0否、1是)
|
||||
*/
|
||||
private Integer encryptionFlag;
|
||||
|
||||
/**
|
||||
* 识别码
|
||||
*/
|
||||
private String series;
|
||||
|
||||
/**
|
||||
* 密钥
|
||||
*/
|
||||
private String devKey;
|
||||
|
||||
private Integer state;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,108 @@
|
||||
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.pojo.constant.DetectionValidMessage;
|
||||
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 2025-05-07
|
||||
*/
|
||||
@Data
|
||||
public class ContrastDevExcel implements Serializable {
|
||||
|
||||
@Excel(name = "所属地市*", width = 30, orderNum = "1")
|
||||
private String cityName;
|
||||
|
||||
@Excel(name = "所属供电公司*", width = 30, orderNum = "2")
|
||||
private String gdName;
|
||||
|
||||
@Excel(name = "所属电站*", width = 30, orderNum = "3")
|
||||
private String subName;
|
||||
|
||||
@Excel(name = "设备名称*", width = 20, orderNum = "4")
|
||||
@NotBlank(message = DetectionValidMessage.NAME_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.DEV_NAME_REGEX, message = DetectionValidMessage.NAME_FORMAT_ERROR)
|
||||
private String name;
|
||||
|
||||
@Excel(name = "设备类型*", width = 20, orderNum = "6")
|
||||
@NotBlank(message = DetectionValidMessage.DEV_TYPE_NOT_BLANK)
|
||||
private String devType;
|
||||
|
||||
@Excel(name = "设备厂家*", width = 20, orderNum = "7")
|
||||
@NotBlank(message = DetectionValidMessage.MANUFACTURER_NOT_BLANK)
|
||||
private String manufacturer;
|
||||
|
||||
@Excel(name = "通讯协议*", width = 15, orderNum = "11")
|
||||
@NotBlank(message = DetectionValidMessage.PROTOCOL_NOT_BLANK)
|
||||
private String protocol;
|
||||
|
||||
@Excel(name = "是否加密*", width = 20, replace = {"否_0", "是_1"}, orderNum = "12")
|
||||
@NotNull(message = DetectionValidMessage.ENCRYPTION_NOT_NULL)
|
||||
private Integer encryptionFlag;
|
||||
|
||||
@Excel(name = "识别码(当加密时必填)", width = 30, orderNum = "13")
|
||||
private String series;
|
||||
|
||||
@Excel(name = "秘钥(当加密时必填)", width = 30, orderNum = "14")
|
||||
private String devKey;
|
||||
|
||||
@Excel(name = "IP地址*", width = 20, orderNum = "15")
|
||||
@NotBlank(message = DetectionValidMessage.IP_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.IP_REGEX, message = DetectionValidMessage.IP_FORMAT_ERROR)
|
||||
private String ip;
|
||||
|
||||
@Excel(name = "端口号*", width = 15, orderNum = "16")
|
||||
@NotNull(message = DetectionValidMessage.PORT_NOT_NULL)
|
||||
@Range(min = 1, max = 65535, message = DetectionValidMessage.PORT_RANGE_ERROR)
|
||||
private Integer port;
|
||||
|
||||
@Excel(name = "投运日期(yyyy-MM-dd)*", width = 30, orderNum = "17", format = "yyyy-MM-dd")
|
||||
@NotNull(message = DetectionValidMessage.CREATE_DATE_NOT_NULL)
|
||||
private LocalDate createDate;
|
||||
|
||||
@Excel(name = "定检日期(yyyy-MM-dd)*", width = 30, orderNum = "18", format = "yyyy-MM-dd")
|
||||
@NotNull(message = DetectionValidMessage.INSPECT_DATE_NOT_NULL)
|
||||
private LocalDate inspectDate;
|
||||
|
||||
@Excel(name = "谐波系统设备id*", width = 30, orderNum = "19")
|
||||
@NotBlank(message = DetectionValidMessage.HARM_SYS_ID_NOT_BLANK)
|
||||
private String harmSysId;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class ImportExcel extends ContrastDevExcel {
|
||||
|
||||
@ExcelCollection(name = "监测点信息", orderNum = "22")
|
||||
private List<PqMonitorExcel> pqMonitorExcelList;
|
||||
}
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class ExportExcel extends ContrastDevExcel {
|
||||
@Excel(name = "设备序列号*", width = 20, orderNum = "5")
|
||||
@NotBlank(message = DetectionValidMessage.FACTORYNO_NOT_BLANK)
|
||||
private String createId;
|
||||
|
||||
@Excel(name = "被检通道", width = 20, orderNum = "8")
|
||||
private String inspectChannel;
|
||||
|
||||
@Excel(name = "固件版本", width = 15, orderNum = "9")
|
||||
private String hardwareVersion;
|
||||
|
||||
@Excel(name = "软件版本", width = 15, orderNum = "10")
|
||||
private String softwareVersion;
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,9 @@
|
||||
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.device.pojo.po.PqDev;
|
||||
import com.njcn.gather.monitor.pojo.po.PqMonitor;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@@ -27,4 +21,84 @@ public class PqDevVO extends PqDev {
|
||||
private Double devCurr;
|
||||
|
||||
private List<PqMonitor> monitorList;
|
||||
|
||||
/**
|
||||
* 检测状态 0-未检、1检测中、2检测完成、3归档
|
||||
*/
|
||||
private Integer checkState;
|
||||
|
||||
/**
|
||||
* 检测结果 0不符合、1符合、2未检
|
||||
*/
|
||||
private Integer checkResult;
|
||||
|
||||
/**
|
||||
* 报告生成状态 0未生成、1已生成、2未检
|
||||
*/
|
||||
private Integer reportState;
|
||||
|
||||
/**
|
||||
* 检测次数
|
||||
*/
|
||||
private Integer recheckNum;
|
||||
|
||||
/**
|
||||
* 守时检测结果 0:不合格, 1:合格,2:/表示没有做守时检测
|
||||
*/
|
||||
private Integer timeCheckResult;
|
||||
|
||||
/**
|
||||
* 系数校准结果 0:不合格,1:合格,2:/表示没有做系数校准
|
||||
*/
|
||||
private Integer factorCheckResult;
|
||||
|
||||
/**
|
||||
* 实时数据结果 0:不合格,1:合格,2:未检
|
||||
*/
|
||||
private Integer realtimeResult;
|
||||
|
||||
/**
|
||||
* 统计数据结果 0:不合格,1:合格,2:未检
|
||||
*/
|
||||
private Integer statisticsResult;
|
||||
|
||||
/**
|
||||
* 录波数据结果 0:不合格,1:合格,2:未检
|
||||
*/
|
||||
private Integer recordedResult;
|
||||
|
||||
/**
|
||||
* 检测人
|
||||
*/
|
||||
private String checkBy;
|
||||
|
||||
/**
|
||||
* 检测时间
|
||||
*/
|
||||
private LocalDateTime checkTime;
|
||||
|
||||
/**
|
||||
* 预检测耗时
|
||||
*/
|
||||
private Integer preDetectTime;
|
||||
|
||||
/**
|
||||
* 系数校准耗时
|
||||
*/
|
||||
private Integer coefficientTime;
|
||||
|
||||
/**
|
||||
* 正式检测耗时
|
||||
*/
|
||||
private Integer formalCheckTime;
|
||||
|
||||
/**
|
||||
* 温度
|
||||
*/
|
||||
private Float temperature;
|
||||
|
||||
/**
|
||||
* 相对湿度
|
||||
*/
|
||||
private Float humidity;
|
||||
}
|
||||
|
||||
@@ -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.pojo.constant.DetectionValidMessage;
|
||||
import lombok.Data;
|
||||
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-07-01
|
||||
*/
|
||||
@Data
|
||||
public class PqStandardDevExcel {
|
||||
|
||||
@Excel(name = "名称*", width = 20, orderNum = "1")
|
||||
@NotBlank(message = DetectionValidMessage.NAME_NOT_BLANK)
|
||||
private String name;
|
||||
|
||||
@Excel(name = "设备类型*", width = 25, orderNum = "2")
|
||||
@NotBlank(message = DetectionValidMessage.DEV_TYPE_NOT_BLANK)
|
||||
private String devType;
|
||||
|
||||
@Excel(name = "设备厂家*", width = 25, orderNum = "3")
|
||||
@NotBlank(message = DetectionValidMessage.MANUFACTURER_NOT_BLANK)
|
||||
private String manufacturer;
|
||||
|
||||
@Excel(name = "可检通道*", width = 25, orderNum = "4")
|
||||
@NotBlank(message = DetectionValidMessage.INSPECT_CHANNEL_NOT_BLANK)
|
||||
private String inspectChannel;
|
||||
|
||||
@Excel(name = "通信协议*", width = 25, orderNum = "5")
|
||||
@NotBlank(message = DetectionValidMessage.PROTOCOL_NOT_BLANK)
|
||||
private String protocol;
|
||||
|
||||
@Excel(name = "IP地址*", width = 25, orderNum = "6")
|
||||
@NotBlank(message = DetectionValidMessage.IP_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.IP_REGEX, message = DetectionValidMessage.IP_FORMAT_ERROR)
|
||||
private String ip;
|
||||
|
||||
@Excel(name = "端口号*", width = 15, orderNum = "7")
|
||||
@NotNull(message = DetectionValidMessage.PORT_NOT_NULL)
|
||||
@Range(min = 1, max = 65535, message = DetectionValidMessage.PORT_RANGE_ERROR)
|
||||
private Integer port;
|
||||
|
||||
@Excel(name = "是否加密*", width = 20, replace = {"否_0", "是_1"}, orderNum = "8")
|
||||
@NotNull(message = DetectionValidMessage.ENCRYPTION_NOT_NULL)
|
||||
private Integer encryptionFlag;
|
||||
|
||||
@Excel(name = "识别码(当加密时必填)", width = 30, orderNum = "9")
|
||||
private String series;
|
||||
|
||||
@Excel(name = "秘钥(当加密时必填)", width = 30, orderNum = "10")
|
||||
private String devKey;
|
||||
}
|
||||
@@ -6,10 +6,7 @@ import com.njcn.common.pojo.poi.PullDown;
|
||||
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.PqDevVO;
|
||||
import com.njcn.gather.device.pojo.vo.PreDetection;
|
||||
import com.njcn.gather.device.pojo.vo.ProvinceDevExcel;
|
||||
import com.njcn.gather.device.pojo.vo.*;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
@@ -64,36 +61,6 @@ public interface IPqDevService extends IService<PqDev> {
|
||||
*/
|
||||
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);
|
||||
|
||||
/**
|
||||
* 批量导入被检设备信息
|
||||
*
|
||||
* @param sgEventExcels 批量导入的数据
|
||||
*/
|
||||
//void importContrastData(List<PqDevExcel.ContrastImportData> sgEventExcels);
|
||||
|
||||
/**
|
||||
* 批量导入被检设备信息
|
||||
*
|
||||
* @param sgEventExcels 批量导入的数据
|
||||
*/
|
||||
//void importSimulateAndDigitalData(List<PqDevExcel.SimulateOrDigitalImportData> sgEventExcels);
|
||||
|
||||
/**
|
||||
* 获取所有未绑定的设备
|
||||
*
|
||||
@@ -108,7 +75,7 @@ public interface IPqDevService extends IService<PqDev> {
|
||||
* @param param 计划id
|
||||
* @return 绑定的设备列表
|
||||
*/
|
||||
List<PqDev> listByPlanId(PqDevParam.QueryParam param);
|
||||
List<PqDevVO> listByPlanId(PqDevParam.QueryParam param);
|
||||
|
||||
/**
|
||||
* 绑定计划
|
||||
@@ -153,7 +120,7 @@ public interface IPqDevService extends IService<PqDev> {
|
||||
|
||||
void updatePqDevReportState(String devId, int i);
|
||||
|
||||
int countUnReportDev(String planId);
|
||||
long countUnReportDev(String planId);
|
||||
|
||||
/**
|
||||
* 根据计划id列表获取设备列表
|
||||
@@ -172,8 +139,10 @@ public interface IPqDevService extends IService<PqDev> {
|
||||
|
||||
/**
|
||||
* 下载模板文件
|
||||
*
|
||||
* @param patternId 模式Id
|
||||
*/
|
||||
void downloadTemplate();
|
||||
void downloadTemplate(String patternId);
|
||||
|
||||
/**
|
||||
* 导入设备数据
|
||||
@@ -183,7 +152,7 @@ public interface IPqDevService extends IService<PqDev> {
|
||||
* @param planId 计划Id
|
||||
* @param response 响应
|
||||
*/
|
||||
void importDev(MultipartFile file, String patternId, String planId, HttpServletResponse response);
|
||||
boolean importDev(MultipartFile file, String patternId, String planId, HttpServletResponse response);
|
||||
|
||||
/**
|
||||
* 导入灿能二楼设备数据
|
||||
@@ -193,7 +162,7 @@ public interface IPqDevService extends IService<PqDev> {
|
||||
* @param planId 计划Id
|
||||
* @param response 响应
|
||||
*/
|
||||
void importCNDev(MultipartFile file, String patternId, String planId, HttpServletResponse response);
|
||||
boolean importCNDev(MultipartFile file, String patternId, String planId, HttpServletResponse response);
|
||||
|
||||
/**
|
||||
* 导入灿能二楼设备数据
|
||||
@@ -202,14 +171,14 @@ public interface IPqDevService extends IService<PqDev> {
|
||||
* @param patternId
|
||||
* @param planId
|
||||
*/
|
||||
void importCNDev(List<CNDevExcel> cnDevExcelList, String patternId, String planId);
|
||||
boolean importCNDev(List<CNDevExcel> cnDevExcelList, String patternId, String planId);
|
||||
|
||||
/**
|
||||
* 可视化-灿能二楼设备
|
||||
*
|
||||
* @param pqDevs
|
||||
*/
|
||||
void visualizeCNDev(List<PqDev> pqDevs);
|
||||
void visualizeCNDev(List<PqDevVO> pqDevs);
|
||||
|
||||
/**
|
||||
* 逆向可视化-灿能二楼设备
|
||||
@@ -227,7 +196,7 @@ public interface IPqDevService extends IService<PqDev> {
|
||||
* @param planId 计划Id
|
||||
* @param response 响应
|
||||
*/
|
||||
void importProvinceDev(MultipartFile file, String patternId, String planId, HttpServletResponse response);
|
||||
boolean importProvinceDev(MultipartFile file, String patternId, String planId, HttpServletResponse response);
|
||||
|
||||
/**
|
||||
* 导入省级平台设备数据
|
||||
@@ -236,14 +205,14 @@ public interface IPqDevService extends IService<PqDev> {
|
||||
* @param patternId
|
||||
* @param planId
|
||||
*/
|
||||
void importProvinceDev(List<ProvinceDevExcel> proviceDevExcelList, String patternId, String planId);
|
||||
boolean importProvinceDev(List<ProvinceDevExcel> proviceDevExcelList, String patternId, String planId);
|
||||
|
||||
/**
|
||||
* 可视化-省级平台设备
|
||||
*
|
||||
* @param pqDevs
|
||||
*/
|
||||
void visualizeProvinceDev(List<PqDev> pqDevs);
|
||||
void visualizeProvinceDev(List<PqDevVO> pqDevs);
|
||||
|
||||
/**
|
||||
* 逆向可视化-省级平台设备
|
||||
@@ -256,6 +225,7 @@ public interface IPqDevService extends IService<PqDev> {
|
||||
/**
|
||||
* 获取省级平台设备导出、导出文件模板的下拉列表
|
||||
*
|
||||
* @param startCol 开始列
|
||||
* @return
|
||||
*/
|
||||
List<PullDown> getProvinceDevPullDownList(int startCol);
|
||||
@@ -267,4 +237,31 @@ public interface IPqDevService extends IService<PqDev> {
|
||||
* @return
|
||||
*/
|
||||
List<PullDown> getCNDevPullDownList(int startCol);
|
||||
|
||||
/**
|
||||
* 导入比对式设备数据
|
||||
*
|
||||
* @param file 上传的文件
|
||||
* @param patternId 模式Id
|
||||
* @param planId 计划Id
|
||||
* @param response 响应
|
||||
*/
|
||||
boolean importContrastDev(MultipartFile file, String patternId, String planId, HttpServletResponse response);
|
||||
|
||||
/**
|
||||
* 导入比对式设备数据
|
||||
*
|
||||
* @param contrastDevExcelList
|
||||
* @param patternId
|
||||
*/
|
||||
boolean importContrastDev(List<ContrastDevExcel.ImportExcel> contrastDevExcelList, String patternId);
|
||||
|
||||
/**
|
||||
* 获取比对式设备导出、导出文件模板的下拉列表
|
||||
*
|
||||
* @param startCol
|
||||
* @param isExport 是否是导出模板
|
||||
* @return
|
||||
*/
|
||||
List<PullDown> getContrastDevPullDownList(int startCol, boolean isExport);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.njcn.gather.device.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.gather.device.pojo.po.PqDevSub;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @date 2025-07-04
|
||||
*/
|
||||
public interface IPqDevSubService extends IService<PqDevSub> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
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.param.PqStandardDevParam;
|
||||
import com.njcn.gather.device.pojo.po.PqStandardDev;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @date 2025-07-02
|
||||
*/
|
||||
public interface IPqStandardDevService extends IService<PqStandardDev> {
|
||||
|
||||
/**
|
||||
* 分页查询标准设备列表
|
||||
*
|
||||
* @param queryParam 分页查询参数
|
||||
* @return
|
||||
*/
|
||||
Page<PqStandardDev> listPqStandardDevs(PqStandardDevParam.QueryParam queryParam);
|
||||
|
||||
/**
|
||||
* 根据id查询标准设备
|
||||
*
|
||||
* @param id 设备id
|
||||
* @return 设备对象
|
||||
*/
|
||||
PqStandardDev getPqStandardDevById(String id);
|
||||
|
||||
/**
|
||||
* 新增标准设备
|
||||
*
|
||||
* @param param 新增参数
|
||||
* @return 新增成功返回true,失败返回false
|
||||
*/
|
||||
boolean addPqStandardDev(PqStandardDevParam param);
|
||||
|
||||
/**
|
||||
* 修改标准设备
|
||||
*
|
||||
* @param param 修改参数
|
||||
* @return 修改成功返回true,失败返回false
|
||||
*/
|
||||
boolean updatePqStandardDev(PqStandardDevParam.UpdateParam param);
|
||||
|
||||
/**
|
||||
* 批量删除标准设备
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
boolean deletePqStandardDevs(List<String> ids);
|
||||
|
||||
/**
|
||||
* 导出标准设备
|
||||
*
|
||||
* @param queryParam
|
||||
*/
|
||||
void export(PqStandardDevParam.QueryParam queryParam);
|
||||
|
||||
/**
|
||||
* 下装标准设备导入模板
|
||||
*/
|
||||
void downloadTemplate();
|
||||
|
||||
/**
|
||||
* 导入标准设备数据
|
||||
*
|
||||
* @param file
|
||||
* @return
|
||||
*/
|
||||
void importData(MultipartFile file, HttpServletResponse response);
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,20 @@
|
||||
package com.njcn.gather.device.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.gather.device.pojo.po.PqDevSub;
|
||||
import com.njcn.gather.device.mapper.PqDevSubMapper;
|
||||
import com.njcn.gather.device.service.IPqDevSubService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @date 2025-07-04
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class PqDevSubServiceImpl extends ServiceImpl<PqDevSubMapper, PqDevSub> implements IPqDevSubService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,287 @@
|
||||
package com.njcn.gather.device.service.impl;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelImportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.ImportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
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.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.poi.PullDown;
|
||||
import com.njcn.common.utils.EncryptionUtil;
|
||||
import com.njcn.gather.device.mapper.PqStandardDevMapper;
|
||||
import com.njcn.gather.device.pojo.param.PqStandardDevParam;
|
||||
import com.njcn.gather.device.pojo.po.PqStandardDev;
|
||||
import com.njcn.gather.device.pojo.vo.PqStandardDevExcel;
|
||||
import com.njcn.gather.device.service.IPqStandardDevService;
|
||||
import com.njcn.gather.pojo.enums.DetectionResponseEnum;
|
||||
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.type.service.IDevTypeService;
|
||||
import com.njcn.web.factory.PageFactory;
|
||||
import com.njcn.web.utils.ExcelUtil;
|
||||
import com.njcn.web.utils.PoiUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author 曹泽辉
|
||||
* @date 2025-07-02
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class PqStandardDevServiceImpl extends ServiceImpl<PqStandardDevMapper, PqStandardDev> implements IPqStandardDevService {
|
||||
private final IDevTypeService devTypeService;
|
||||
private final IDictDataService dictDataService;
|
||||
private final IDictTypeService dictTypeService;
|
||||
|
||||
@Override
|
||||
public Page<PqStandardDev> listPqStandardDevs(PqStandardDevParam.QueryParam queryParam) {
|
||||
QueryWrapper<PqStandardDev> wrapper = new QueryWrapper<>();
|
||||
wrapper.like(StrUtil.isNotBlank(queryParam.getName()), "name", queryParam.getName())
|
||||
.eq(StrUtil.isNotBlank(queryParam.getManufacturer()), "manufacturer", queryParam.getManufacturer())
|
||||
.eq(StrUtil.isNotBlank(queryParam.getDevType()), "dev_type", queryParam.getDevType())
|
||||
.eq("state", DataStateEnum.ENABLE.getCode());
|
||||
return this.page(new Page<>(PageFactory.getPageNum(queryParam), PageFactory.getPageSize(queryParam)), wrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PqStandardDev getPqStandardDevById(String id) {
|
||||
PqStandardDev standardDev = this.getById(id);
|
||||
if (standardDev.getEncryptionFlag() == 1) {
|
||||
standardDev.setSeries(EncryptionUtil.decoderString(1, standardDev.getSeries()));
|
||||
standardDev.setDevKey(EncryptionUtil.decoderString(1, standardDev.getDevKey()));
|
||||
}
|
||||
return standardDev;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean addPqStandardDev(PqStandardDevParam param) {
|
||||
this.checkRepeat(param, false);
|
||||
PqStandardDev pqStandardDev = BeanUtil.copyProperties(param, PqStandardDev.class);
|
||||
pqStandardDev.setState(DataStateEnum.ENABLE.getCode());
|
||||
this.checkEncryption(pqStandardDev);
|
||||
return this.save(pqStandardDev);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean updatePqStandardDev(PqStandardDevParam.UpdateParam param) {
|
||||
this.checkRepeat(param, true);
|
||||
PqStandardDev pqStandardDev = BeanUtil.copyProperties(param, PqStandardDev.class);
|
||||
this.checkEncryption(pqStandardDev);
|
||||
return this.updateById(pqStandardDev);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean deletePqStandardDevs(List<String> ids) {
|
||||
LambdaUpdateWrapper<PqStandardDev> wrapper = new LambdaUpdateWrapper();
|
||||
wrapper.set(PqStandardDev::getState, DataStateEnum.DELETED.getCode())
|
||||
.in(PqStandardDev::getId, ids);
|
||||
return this.update(wrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void export(PqStandardDevParam.QueryParam queryParam) {
|
||||
QueryWrapper<PqStandardDev> wrapper = new QueryWrapper<>();
|
||||
wrapper.like(StrUtil.isNotBlank(queryParam.getName()), "name", queryParam.getName())
|
||||
.eq(StrUtil.isNotBlank(queryParam.getManufacturer()), "manufacturer", queryParam.getManufacturer())
|
||||
.eq(StrUtil.isNotBlank(queryParam.getDevType()), "dev_type", queryParam.getDevType())
|
||||
.eq("state", DataStateEnum.ENABLE.getCode());
|
||||
List<PqStandardDev> pqStandardDevs = this.list(wrapper);
|
||||
this.visualizeStandardDev(pqStandardDevs);
|
||||
List<PqStandardDevExcel> pqStandardDevExcels = BeanUtil.copyToList(pqStandardDevs, PqStandardDevExcel.class);
|
||||
ExcelUtil.exportExcelPullDown(new ExportParams(), "标准设备导出数据.xlsx", 1, this.getStandardDevPullDownList(), PqStandardDevExcel.class, pqStandardDevExcels);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void downloadTemplate() {
|
||||
ExcelUtil.exportExcelPullDown(new ExportParams(), "标准设备导入模板.xlsx", 1, this.getStandardDevPullDownList(), PqStandardDevExcel.class, Collections.emptyList());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void importData(MultipartFile file, HttpServletResponse response) {
|
||||
ImportParams params = new ImportParams();
|
||||
params.setStartSheetIndex(0);
|
||||
params.setSheetNum(1);
|
||||
params.setNeedVerify(true);
|
||||
params.setHeadRows(1);
|
||||
|
||||
List<PqStandardDevExcel> contrastDevExcelList = null;
|
||||
try {
|
||||
ExcelImportResult<PqStandardDevExcel> excelImportResult = ExcelImportUtil.importExcelMore(file.getInputStream(), PqStandardDevExcel.class, params);
|
||||
if (excelImportResult.isVerifyFail()) {
|
||||
// 此处前端要做特殊处理,具体可以参考技术监督的数据导入
|
||||
Workbook failWorkbook = excelImportResult.getFailWorkbook();
|
||||
PoiUtil.exportFileByWorkbook(failWorkbook, "非法被检设备数据.xlsx", response);
|
||||
} else {
|
||||
contrastDevExcelList = excelImportResult.getList();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new BusinessException(DetectionResponseEnum.IMPORT_DATA_FAIL);
|
||||
}
|
||||
this.importData(contrastDevExcelList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
*
|
||||
* @param contrastDevExcelList
|
||||
* @return
|
||||
*/
|
||||
private void importData(List<PqStandardDevExcel> contrastDevExcelList) {
|
||||
if (CollectionUtil.isNotEmpty(contrastDevExcelList)) {
|
||||
List<PqStandardDev> contrastDevs = BeanUtil.copyToList(contrastDevExcelList, PqStandardDev.class);
|
||||
this.reverseVisualizeStandardDev(contrastDevs);
|
||||
this.saveBatch(contrastDevs);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取标准设备导出文件下拉列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private List<PullDown> getStandardDevPullDownList() {
|
||||
List<PullDown> pullDownList = new ArrayList<>();
|
||||
|
||||
PullDown pullDown = new PullDown();
|
||||
|
||||
// 设备类型
|
||||
pullDown.setFirstCol(1);
|
||||
pullDown.setLastCol(1);
|
||||
pullDown.setStrings(devTypeService.listAll().stream().map(devType -> devType.getName()).collect(Collectors.toList()));
|
||||
pullDownList.add(pullDown);
|
||||
|
||||
|
||||
List<DictData> dictDataList = null;
|
||||
// 设备厂家
|
||||
DictType dictType = dictTypeService.getByCode("Dev_Manufacturers");
|
||||
if (ObjectUtil.isNotNull(dictType)) {
|
||||
dictDataList = dictDataService.getDictDataByTypeId(dictType.getId());
|
||||
|
||||
pullDown = new PullDown();
|
||||
pullDown.setFirstCol(2);
|
||||
pullDown.setLastCol(2);
|
||||
pullDown.setStrings(dictDataList.stream().map(DictData::getName).collect(Collectors.toList()));
|
||||
pullDownList.add(pullDown);
|
||||
}
|
||||
|
||||
// 通讯协议
|
||||
dictType = dictTypeService.getByCode("Protocol");
|
||||
if (ObjectUtil.isNotNull(dictType)) {
|
||||
dictDataList = dictDataService.getDictDataByTypeId(dictType.getId());
|
||||
|
||||
pullDown = new PullDown();
|
||||
pullDown.setFirstCol(4);
|
||||
pullDown.setLastCol(4);
|
||||
pullDown.setStrings(dictDataList.stream().map(DictData::getName).collect(Collectors.toList()));
|
||||
pullDownList.add(pullDown);
|
||||
}
|
||||
|
||||
// 是否加密
|
||||
pullDown = new PullDown();
|
||||
pullDown.setFirstCol(7);
|
||||
pullDown.setLastCol(7);
|
||||
pullDown.setStrings(Arrays.asList("否", "是"));
|
||||
pullDownList.add(pullDown);
|
||||
|
||||
return pullDownList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 可视化标准设备
|
||||
*
|
||||
* @param pqStandardDevs
|
||||
*/
|
||||
private void visualizeStandardDev(List<PqStandardDev> pqStandardDevs) {
|
||||
pqStandardDevs.forEach(pqStandardDev -> {
|
||||
pqStandardDev.setDevType(devTypeService.getById(pqStandardDev.getDevType()).getName());
|
||||
pqStandardDev.setManufacturer(dictDataService.getDictDataById(pqStandardDev.getManufacturer()).getName());
|
||||
pqStandardDev.setProtocol(dictDataService.getDictDataById(pqStandardDev.getProtocol()).getName());
|
||||
if (pqStandardDev.getEncryptionFlag() == 1) {
|
||||
pqStandardDev.setSeries(EncryptionUtil.decoderString(1, pqStandardDev.getSeries()));
|
||||
pqStandardDev.setDevKey(EncryptionUtil.decoderString(1, pqStandardDev.getDevKey()));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 逆向可视化标准设备
|
||||
*
|
||||
* @param pqStandardDevs
|
||||
*/
|
||||
private void reverseVisualizeStandardDev(List<PqStandardDev> pqStandardDevs) {
|
||||
pqStandardDevs.forEach(pqStandardDev -> {
|
||||
PqStandardDevParam pqStandardDevParam = BeanUtil.copyProperties(pqStandardDev, PqStandardDevParam.class);
|
||||
this.checkRepeat(pqStandardDevParam, false);
|
||||
this.checkEncryption(pqStandardDev);
|
||||
pqStandardDev.setDevType(devTypeService.getByName(pqStandardDev.getDevType()).getId());
|
||||
pqStandardDev.setManufacturer(dictDataService.getDictDataByName(pqStandardDev.getManufacturer()).getId());
|
||||
pqStandardDev.setProtocol(dictDataService.getDictDataByName(pqStandardDev.getProtocol()).getId());
|
||||
pqStandardDev.setState(DataStateEnum.ENABLE.getCode());
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查是否重复
|
||||
*
|
||||
* @param pqStandardDevParam
|
||||
* @param isExcludeSelf
|
||||
*/
|
||||
private void checkRepeat(PqStandardDevParam pqStandardDevParam, boolean isExcludeSelf) {
|
||||
QueryWrapper<PqStandardDev> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("pq_standard_dev.Name", pqStandardDevParam.getName())
|
||||
.eq("pq_standard_dev.State", DataStateEnum.ENABLE.getCode());
|
||||
if (isExcludeSelf) {
|
||||
if (pqStandardDevParam instanceof PqStandardDevParam.UpdateParam) {
|
||||
wrapper.ne("pq_standard_dev.Id", ((PqStandardDevParam.UpdateParam) pqStandardDevParam).getId());
|
||||
}
|
||||
}
|
||||
int count = this.count(wrapper);
|
||||
if (count > 0) {
|
||||
throw new BusinessException(DetectionResponseEnum.PQ_STANDARD_DEV_REPEAT);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查加密情况
|
||||
*
|
||||
* @param pqStandardDev
|
||||
*/
|
||||
private void checkEncryption(PqStandardDev pqStandardDev) {
|
||||
if (pqStandardDev.getEncryptionFlag() == 1) {
|
||||
if (StrUtil.isNotBlank(pqStandardDev.getSeries()) && StrUtil.isNotBlank(pqStandardDev.getDevKey())) {
|
||||
pqStandardDev.setSeries(EncryptionUtil.encodeString(1, pqStandardDev.getSeries()));
|
||||
pqStandardDev.setDevKey(EncryptionUtil.encodeString(1, pqStandardDev.getDevKey()));
|
||||
} else {
|
||||
throw new BusinessException(DetectionResponseEnum.SERIES_AND_DEVKEY_NOT_BLANK);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -139,5 +139,16 @@ public class PqErrSysController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
@OperateInfo
|
||||
@GetMapping("/getTestItems")
|
||||
@ApiOperation("根据误差体系id获取测试项")
|
||||
@ApiImplicitParam(name = "id", value = "误差体系id", required = true)
|
||||
public HttpResult<List<Map<String, String>>> getTestItems(@RequestParam("id") String id) {
|
||||
String methodDescribe = getMethodDescribe("getTestItems");
|
||||
LogUtil.njcnDebug(log, "{},获取测试项ID为:{}", methodDescribe, id);
|
||||
List<Map<String, String>> result = pqErrSysService.getTestItems(id);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -79,4 +79,12 @@ public interface IPqErrSysService extends IService<PqErrSys> {
|
||||
* @return 成功返回true,失败返回false
|
||||
*/
|
||||
boolean copyPqErrSys(String id);
|
||||
|
||||
/**
|
||||
* 根据id获取测试项列表
|
||||
*
|
||||
* @param id 误差体系id
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, String>> getTestItems(String id);
|
||||
}
|
||||
|
||||
@@ -208,6 +208,11 @@ public class PqErrSysServiceImpl extends ServiceImpl<PqErrSysMapper, PqErrSys> i
|
||||
return this.save(pqErrSys);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, String>> getTestItems(String id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查重复
|
||||
*
|
||||
|
||||
@@ -1,13 +1,26 @@
|
||||
package com.njcn.gather.monitor.controller;
|
||||
|
||||
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.common.utils.LogUtil;
|
||||
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.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.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
@@ -21,5 +34,15 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
public class PqMonitorController extends BaseController {
|
||||
private final IPqMonitorService pqMonitorService;
|
||||
|
||||
@OperateInfo
|
||||
@PostMapping("/list")
|
||||
@ApiOperation("查询监测点")
|
||||
@ApiImplicitParam(name = "queryParam", value = "查询参数", required = true)
|
||||
public HttpResult<List<PqMonitor>> list(@RequestBody PqMonitorParam.QueryParam queryParam) {
|
||||
String methodDescribe = getMethodDescribe("list");
|
||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, queryParam);
|
||||
List<PqMonitor> result = pqMonitorService.listPqMonitorByDevId(queryParam.getDevId());
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.njcn.common.pojo.constant.PatternRegex;
|
||||
import com.njcn.gather.pojo.constant.DetectionValidMessage;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
@@ -16,28 +17,63 @@ import javax.validation.constraints.Pattern;
|
||||
@Data
|
||||
public class PqMonitorParam {
|
||||
|
||||
@ApiModelProperty(value = "谐波系统监测点ID")
|
||||
private String code;
|
||||
@ApiModelProperty(value = "所属设备id")
|
||||
@NotBlank(message = DetectionValidMessage.DEVICE_ID_NOT_BLANK)
|
||||
private String devId;
|
||||
|
||||
@ApiModelProperty(value = "所属母线")
|
||||
@NotBlank(message = DetectionValidMessage.BELONG_LINE_NOT_BLANK)
|
||||
private String busbar;
|
||||
|
||||
@ApiModelProperty(value = "监测点名称")
|
||||
@NotBlank(message = DetectionValidMessage.MONITOR_NAME_NOT_BLANK)
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "监测点序号")
|
||||
@ApiModelProperty(value = "线路号(监测点序号)")
|
||||
@NotNull(message = DetectionValidMessage.MONITOR_NUM_NOT_NULL)
|
||||
private Integer num;
|
||||
|
||||
@ApiModelProperty(value = "PT变比")
|
||||
@NotNull(message = DetectionValidMessage.PT_NOT_NULL)
|
||||
private Float pt;
|
||||
@NotBlank(message = DetectionValidMessage.PT_NOT_BLANK)
|
||||
private String pt;
|
||||
|
||||
@ApiModelProperty(value = "CT变比")
|
||||
@NotNull(message = DetectionValidMessage.CT_NOT_NULL)
|
||||
private Float ct;
|
||||
@NotBlank(message = DetectionValidMessage.CT_NOT_BLANK)
|
||||
private String ct;
|
||||
|
||||
@ApiModelProperty(value = "接线方式")
|
||||
@NotBlank(message = DetectionValidMessage.WIRING_TYPE_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.WIRING_TYPE_FORMAT_ERROR)
|
||||
private String ptType;
|
||||
@NotBlank(message = DetectionValidMessage.CONNECTION_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.CONNECTION_FORMAT_ERROR)
|
||||
private String connection;
|
||||
|
||||
@ApiModelProperty(value = "统计间隔")
|
||||
@NotNull(message = DetectionValidMessage.STAT_INTERVAL_NOT_NULL)
|
||||
private Integer statInterval;
|
||||
|
||||
@ApiModelProperty(value = "谐波系统监测点id")
|
||||
@NotBlank(message = DetectionValidMessage.MONITOR_ID_NOT_BLANK)
|
||||
private String harmSysId;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询实体
|
||||
*/
|
||||
@Data
|
||||
public static class QueryParam {
|
||||
@ApiModelProperty(value = "所属设备id")
|
||||
@NotBlank(message = DetectionValidMessage.DEVICE_ID_NOT_BLANK)
|
||||
private String devId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改实体
|
||||
*/
|
||||
// @Data
|
||||
// @EqualsAndHashCode(callSuper = true)
|
||||
// public static class UpdateParam extends PqMonitorParam {
|
||||
// @ApiModelProperty(value = "监测点id", required = true)
|
||||
// @NotBlank(message = DetectionValidMessage.ID_NOT_BLANK)
|
||||
// @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.ID_FORMAT_ERROR)
|
||||
// private String id;
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
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;
|
||||
|
||||
@@ -20,40 +18,49 @@ public class PqMonitor implements Serializable {
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 默认与谐波系统监测点ID相同
|
||||
*/
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 所属设备ID
|
||||
*/
|
||||
private String devId;
|
||||
|
||||
/**
|
||||
* 所属母线
|
||||
* 监测点名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 监测点序号
|
||||
* 所属母线
|
||||
*/
|
||||
private String busbar;
|
||||
|
||||
/**
|
||||
* 线路号(监测点序号)
|
||||
*/
|
||||
private Integer num;
|
||||
|
||||
/**
|
||||
* PT变比
|
||||
*/
|
||||
private Float pt;
|
||||
private String pt;
|
||||
|
||||
/**
|
||||
* CT变比
|
||||
*/
|
||||
private Float ct;
|
||||
private String ct;
|
||||
|
||||
/**
|
||||
* 统计间隔
|
||||
*/
|
||||
private Integer statInterval;
|
||||
|
||||
/**
|
||||
* 接线方式,字典表
|
||||
*/
|
||||
private String ptType;
|
||||
private String connection;
|
||||
|
||||
/**
|
||||
* 谐波系统监测点id
|
||||
*/
|
||||
private String harmSysId;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
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.pojo.constant.DetectionValidMessage;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Pattern;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
@@ -17,36 +14,47 @@ import javax.validation.constraints.Pattern;
|
||||
@Data
|
||||
public class PqMonitorExcel {
|
||||
|
||||
@Excel(name = "监测点序号", width = 20, orderNum = "1")
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.MONITOR_NUM_FORMAT_ERROR)
|
||||
private Integer num;
|
||||
@Excel(name = "谐波系统监测点ID*", width = 20, orderNum = "1")
|
||||
@NotBlank(message = DetectionValidMessage.MONITOR_ID_NOT_BLANK)
|
||||
private String harmSysId;
|
||||
|
||||
@Excel(name = "所属母线", width = 20, orderNum = "2")
|
||||
@Excel(name = "所属母线*", width = 20, orderNum = "2")
|
||||
@NotBlank(message = DetectionValidMessage.BELONG_LINE_NOT_BLANK)
|
||||
private String busbar;
|
||||
|
||||
@Excel(name = "监测点名称*", width = 20, orderNum = "3")
|
||||
@NotBlank(message = DetectionValidMessage.MONITOR_NAME_NOT_BLANK)
|
||||
private String name;
|
||||
|
||||
@Excel(name = "PT变比", width = 20, orderNum = "3")
|
||||
@NotNull(message = DetectionValidMessage.PT_NOT_NULL)
|
||||
private Float pt;
|
||||
@Excel(name = "线路号(监测点序号)*", width = 20, orderNum = "4")
|
||||
@NotNull(message = DetectionValidMessage.MONITOR_NUM_NOT_NULL)
|
||||
private Integer num;
|
||||
|
||||
@Excel(name = "CT变比", width = 20, orderNum = "4")
|
||||
@NotNull(message = DetectionValidMessage.CT_NOT_NULL)
|
||||
private Float ct;
|
||||
@Excel(name = "PT变比*", width = 20, orderNum = "5")
|
||||
@NotBlank(message = DetectionValidMessage.PT_NOT_BLANK)
|
||||
private String pt;
|
||||
|
||||
@Excel(name = "接线方式", width = 20, orderNum = "5")
|
||||
@NotBlank(message = DetectionValidMessage.WIRING_TYPE_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.WIRING_TYPE_FORMAT_ERROR)
|
||||
private String ptType;
|
||||
@Excel(name = "CT变比*", width = 20, orderNum = "6")
|
||||
@NotBlank(message = DetectionValidMessage.CT_NOT_BLANK)
|
||||
private String ct;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class ImportData extends PqMonitorExcel {
|
||||
@Excel(name = "接线方式*", width = 20, orderNum = "7")
|
||||
@NotBlank(message = DetectionValidMessage.CONNECTION_NOT_BLANK)
|
||||
private String connection;
|
||||
|
||||
}
|
||||
@Excel(name = "统计间隔*", width = 10, orderNum = "8")
|
||||
@NotNull(message = DetectionValidMessage.STAT_INTERVAL_NOT_NULL)
|
||||
private Integer statInterval;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class ExportData extends PqMonitorExcel {
|
||||
|
||||
}
|
||||
// @Data
|
||||
// @EqualsAndHashCode(callSuper = true)
|
||||
// public static class ImportData extends PqMonitorExcel {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Data
|
||||
// @EqualsAndHashCode(callSuper = true)
|
||||
// public static class ExportData extends PqMonitorExcel {
|
||||
//
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.njcn.gather.monitor.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
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;
|
||||
|
||||
@@ -13,6 +13,8 @@ import java.util.List;
|
||||
*/
|
||||
public interface IPqMonitorService extends IService<PqMonitor> {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 根据设备id获取所有监测点信息
|
||||
*
|
||||
@@ -22,28 +24,30 @@ public interface IPqMonitorService extends IService<PqMonitor> {
|
||||
List<PqMonitor> listPqMonitorByDevId(String devId);
|
||||
|
||||
/**
|
||||
* 批量新增监测点信息
|
||||
* 根据设备id批量新增监测点信息
|
||||
*
|
||||
* @param devId 被检设备id
|
||||
* @param pqMonitorParamList 监测点信息列表
|
||||
* @return 新增成功返回true,否则返回false
|
||||
* @param devId
|
||||
* @param monitorList
|
||||
* @return
|
||||
*/
|
||||
boolean addPqMonitorByDevId(String devId, List<PqMonitorParam> pqMonitorParamList);
|
||||
boolean addPqMonitorByDevId(String devId, List<PqMonitorParam> monitorList);
|
||||
|
||||
/**
|
||||
* 批量删除监测点信息
|
||||
* 根据设备id批量修改监测点信息
|
||||
*
|
||||
* @param devId 被检设备id
|
||||
* @return 删除成功返回true,否则返回false
|
||||
* @param devId
|
||||
* @param paramList
|
||||
* @return
|
||||
*/
|
||||
boolean updatePqMonitorByDevId(String devId, List<PqMonitorParam> paramList);
|
||||
|
||||
/**
|
||||
* 根据设备id删除监测点信息
|
||||
*
|
||||
* @param devId
|
||||
* @return
|
||||
*/
|
||||
boolean deletePqMonitorByDevId(String devId);
|
||||
|
||||
/**
|
||||
* 修改监测点信息
|
||||
*
|
||||
* @param devId 被检设备id
|
||||
* @param paramList 监测点信息
|
||||
* @return 修改成功返回true,否则返回false
|
||||
*/
|
||||
boolean updatePqMonitorByDevId(String devId, List<PqMonitorParam> paramList);
|
||||
|
||||
}
|
||||
|
||||
@@ -2,12 +2,13 @@ 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.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
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 com.njcn.web.factory.PageFactory;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -24,7 +25,6 @@ import java.util.List;
|
||||
@RequiredArgsConstructor
|
||||
public class PqMonitorServiceImpl extends ServiceImpl<PqMonitorMapper, PqMonitor> implements IPqMonitorService {
|
||||
|
||||
private final IDictDataService dictDataService;
|
||||
|
||||
@Override
|
||||
public List<PqMonitor> listPqMonitorByDevId(String devId) {
|
||||
@@ -32,21 +32,12 @@ public class PqMonitorServiceImpl extends ServiceImpl<PqMonitorMapper, PqMonitor
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public boolean addPqMonitorByDevId(String devId, List<PqMonitorParam> pqMonitorParamList) {
|
||||
List<PqMonitor> pqMonitorList = BeanUtil.copyToList(pqMonitorParamList, PqMonitor.class);
|
||||
public boolean addPqMonitorByDevId(String devId, List<PqMonitorParam> monitorList) {
|
||||
List<PqMonitor> pqMonitorList = BeanUtil.copyToList(monitorList, PqMonitor.class);
|
||||
pqMonitorList.forEach(pqMonitor -> pqMonitor.setDevId(devId));
|
||||
return this.saveBatch(pqMonitorList);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public boolean deletePqMonitorByDevId(String devId) {
|
||||
QueryWrapper<PqMonitor> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("pq_monitor.Dev_Id", devId);
|
||||
return this.remove(wrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public boolean updatePqMonitorByDevId(String devId, List<PqMonitorParam> paramList) {
|
||||
@@ -58,4 +49,33 @@ public class PqMonitorServiceImpl extends ServiceImpl<PqMonitorMapper, PqMonitor
|
||||
return this.saveBatch(pqMonitorList);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public boolean deletePqMonitorByDevId(String devId) {
|
||||
QueryWrapper<PqMonitor> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("pq_monitor.Dev_Id", devId);
|
||||
return this.remove(wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查是否重复
|
||||
*
|
||||
* @param pqMonitorParam
|
||||
* @param isExcludeSelf
|
||||
*/
|
||||
// private void checkRepeat(PqMonitorParam pqMonitorParam, boolean isExcludeSelf) {
|
||||
// QueryWrapper<PqMonitor> wrapper = new QueryWrapper<>();
|
||||
// wrapper.eq("pq_monitor.Dev_Id", pqMonitorParam.getDevId())
|
||||
// .eq("pq_monitor.Busbar", pqMonitorParam.getName())
|
||||
// .eq("pq_monitor.Name", pqMonitorParam.getName());
|
||||
// if (isExcludeSelf) {
|
||||
// if (pqMonitorParam instanceof PqMonitorParam.UpdateParam) {
|
||||
// wrapper.ne("pq_monitor.Id", ((PqMonitorParam.UpdateParam) pqMonitorParam).getId());
|
||||
// }
|
||||
// }
|
||||
// int count = this.count(wrapper);
|
||||
// if (count > 0) {
|
||||
// throw new BusinessException(DetectionResponseEnum.MONITOR_REPEAT);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -99,7 +99,6 @@ public class AdPlanController extends BaseController {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@GetMapping("/listByPattern")
|
||||
@ApiOperation("按照模式查询检测计划")
|
||||
@@ -125,8 +124,8 @@ public class AdPlanController extends BaseController {
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.DOWNLOAD)
|
||||
@PostMapping("/downloadTemplate")
|
||||
@ApiOperation("下载检测计划导出模板")
|
||||
public void downloadTemplate(@RequestBody AdPlanParam.QueryParam queryParam) {
|
||||
adPlanService.downloadTemplate(queryParam.getPatternId());
|
||||
public void downloadTemplate(@RequestBody AdPlanParam param) {
|
||||
adPlanService.downloadTemplate(param.getPattern());
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.UPLOAD)
|
||||
@@ -136,7 +135,7 @@ public class AdPlanController extends BaseController {
|
||||
@ApiImplicitParam(name = "file", value = "检测计划数据文件", required = true),
|
||||
@ApiImplicitParam(name = "pattern", value = "模式Id", required = true)
|
||||
})
|
||||
public HttpResult<Object> importPlan(@RequestParam("file") MultipartFile file, @RequestParam("patternId") String patternId, HttpServletResponse response) {
|
||||
public HttpResult<Boolean> importPlan(@RequestParam("file") MultipartFile file, @RequestParam("patternId") String patternId, HttpServletResponse response) {
|
||||
String methodDescribe = getMethodDescribe("importCNPlan");
|
||||
LogUtil.njcnDebug(log, "{},上传文件为:{}", methodDescribe, file.getOriginalFilename());
|
||||
|
||||
@@ -144,8 +143,12 @@ public class AdPlanController extends BaseController {
|
||||
if (!fileType) {
|
||||
throw new BusinessException(CommonResponseEnum.FILE_XLSX_ERROR);
|
||||
}
|
||||
adPlanService.importPlan(file, patternId, response);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
boolean result = adPlanService.importPlan(file, patternId, response);
|
||||
if (result) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||
}else{
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@@ -168,5 +171,20 @@ public class AdPlanController extends BaseController {
|
||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, String.join(StrUtil.COMMA, ids));
|
||||
adPlanService.analyse(ids);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/splitPlan")
|
||||
@ApiOperation("拆分检测计划")
|
||||
@ApiImplicitParam(name = "param", value = "检测计划", required = true)
|
||||
public HttpResult<Boolean> splitPlan(@RequestBody @Validated AdPlanParam.SplitParam param) {
|
||||
String methodDescribe = getMethodDescribe("splitPlan");
|
||||
LogUtil.njcnDebug(log, "{},拆分数据为:{}", methodDescribe, param);
|
||||
boolean result = adPlanService.splitPlan(param);
|
||||
if (result) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -117,4 +117,15 @@ public class AdPlanParam {
|
||||
private String planId;
|
||||
private List<String> devIds;
|
||||
}
|
||||
|
||||
@Data
|
||||
public class SplitParam {
|
||||
@ApiModelProperty(value = "id", required = true)
|
||||
@NotBlank(message = DetectionValidMessage.ID_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.PID_FORMAT_ERROR)
|
||||
private String pId;
|
||||
|
||||
@ApiModelProperty(value = "拆分后的计划", required = true)
|
||||
private List<AdPlanParam> splitPlans;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,5 +109,13 @@ public class AdPlanVO {
|
||||
*/
|
||||
private String reportTemplateName;
|
||||
|
||||
/**
|
||||
* 数据处理原则
|
||||
*/
|
||||
private String dataRule;
|
||||
|
||||
/**
|
||||
* 检测进度
|
||||
*/
|
||||
private Float progress;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.njcn.gather.plan.pojo.vo;
|
||||
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import cn.afterturn.easypoi.excel.annotation.ExcelCollection;
|
||||
import com.njcn.gather.device.pojo.vo.ProvinceDevExcel;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -82,7 +82,7 @@ public interface IAdPlanService extends IService<AdPlan> {
|
||||
* @param devIds
|
||||
* @return
|
||||
*/
|
||||
boolean updateTestState(String planId, List<String> devIds);
|
||||
//boolean updateTestState(String planId, List<String> devIds);
|
||||
|
||||
/**
|
||||
* 数据状态回退
|
||||
@@ -123,5 +123,13 @@ public interface IAdPlanService extends IService<AdPlan> {
|
||||
* @param patternId
|
||||
* @param response
|
||||
*/
|
||||
void importPlan(MultipartFile file, String patternId, HttpServletResponse response);
|
||||
boolean importPlan(MultipartFile file, String patternId, HttpServletResponse response);
|
||||
|
||||
/**
|
||||
* 拆分计划
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
boolean splitPlan(AdPlanParam.SplitParam param);
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ import cn.hutool.core.util.CharsetUtil;
|
||||
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;
|
||||
@@ -18,12 +17,16 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.poi.PullDown;
|
||||
import com.njcn.gather.device.mapper.PqDevMapper;
|
||||
import com.njcn.gather.device.pojo.enums.*;
|
||||
import com.njcn.gather.device.pojo.param.PqDevParam;
|
||||
import com.njcn.gather.device.pojo.po.PqDev;
|
||||
import com.njcn.gather.device.pojo.po.PqDevSub;
|
||||
import com.njcn.gather.device.pojo.vo.CNDevExcel;
|
||||
import com.njcn.gather.device.pojo.vo.PqDevVO;
|
||||
import com.njcn.gather.device.pojo.vo.ProvinceDevExcel;
|
||||
import com.njcn.gather.device.service.IPqDevService;
|
||||
import com.njcn.gather.device.service.IPqDevSubService;
|
||||
import com.njcn.gather.err.pojo.po.PqErrSys;
|
||||
import com.njcn.gather.err.service.IPqErrSysService;
|
||||
import com.njcn.gather.plan.mapper.AdPlanMapper;
|
||||
@@ -104,6 +107,8 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
||||
private final IDevTypeService devTypeService;
|
||||
private final IDictTypeService dictTypeService;
|
||||
private final AdHarmonicService adHarmonicService;
|
||||
private final PqDevMapper pqDevMapper;
|
||||
private final IPqDevSubService pqDevSubService;
|
||||
|
||||
@Override
|
||||
public Page<AdPlanVO> listAdPlan(AdPlanParam.QueryParam queryParam) {
|
||||
@@ -118,16 +123,25 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
||||
PqReport report = this.baseMapper.getPqReportById(adPlan.getReportTemplateId());
|
||||
adPlanVO.setReportTemplateName(report.getName() + "_" + report.getVersion());
|
||||
}
|
||||
return adPlanVO;
|
||||
}).collect(Collectors.toList());
|
||||
adPlanVOList.forEach(adPlanVO -> {
|
||||
adPlanVO.setScriptName(pqScriptService.getPqScriptById(adPlanVO.getScriptId()).getName());
|
||||
adPlanVO.setErrorSysName(pqErrSysService.getPqErrSysById(adPlanVO.getErrorSysId()).getName());
|
||||
|
||||
List<PqSource> pqSourceList = adPlanSourceService.listPqSourceByPlanId(adPlanVO.getId());
|
||||
adPlanVO.setSourceIds(pqSourceList.stream().map(PqSource::getId).collect(Collectors.toList()));
|
||||
adPlanVO.setSourceName(pqSourceList.stream().map(PqSource::getName).collect(Collectors.toList()));
|
||||
});
|
||||
|
||||
PqDevParam.QueryParam queryParam1 = new PqDevParam.QueryParam();
|
||||
queryParam1.setPlanId(adPlanVO.getId());
|
||||
List<PqDevVO> pqDevVOList = pqDevMapper.selectByQueryParam(queryParam1);
|
||||
if (CollUtil.isNotEmpty(pqDevVOList)) {
|
||||
long count = pqDevVOList.stream().filter(pqDev -> CheckStateEnum.CHECKED.getValue().equals(pqDev.getCheckState())).count();
|
||||
adPlanVO.setProgress((float) count / pqDevVOList.size());
|
||||
} else {
|
||||
adPlanVO.setProgress(0.0f);
|
||||
}
|
||||
|
||||
return adPlanVO;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
Page<AdPlanVO> page2 = new Page<>(PageFactory.getPageNum(queryParam), PageFactory.getPageSize(queryParam));
|
||||
page2.setTotal(page1.getTotal());
|
||||
@@ -372,42 +386,47 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateTestState(String planId, List<String> devIds) {
|
||||
if (CollUtil.isNotEmpty(devIds)) {
|
||||
pqDevService.update(new LambdaUpdateWrapper<PqDev>()
|
||||
.set(PqDev::getCheckState, CheckStateEnum.CHECKING.getValue())
|
||||
.in(PqDev::getId, devIds));
|
||||
return this.update(new LambdaUpdateWrapper<AdPlan>()
|
||||
.set(AdPlan::getTestState, CheckStateEnum.CHECKING.getValue())
|
||||
.eq(AdPlan::getId, planId));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
// @Override
|
||||
// public boolean updateTestState(String planId, List<String> devIds) {
|
||||
// if (CollUtil.isNotEmpty(devIds)) {
|
||||
// pqDevService.update(new LambdaUpdateWrapper<PqDev>()
|
||||
// .set(PqDev::getCheckState, CheckStateEnum.CHECKING.getValue())
|
||||
// .in(PqDev::getId, devIds));
|
||||
// return this.update(new LambdaUpdateWrapper<AdPlan>()
|
||||
// .set(AdPlan::getTestState, CheckStateEnum.CHECKING.getValue())
|
||||
// .eq(AdPlan::getId, planId));
|
||||
// }
|
||||
// return true;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public boolean updateBackTestState(String planId, List<String> devIds) {
|
||||
//当前如果第二次进行测试,则需要将判断之前状态是否不是非检测状态
|
||||
List<PqDev> devList = pqDevService.list(new LambdaQueryWrapper<PqDev>().in(PqDev::getId, devIds));
|
||||
if (CollUtil.isNotEmpty(devList)) {
|
||||
for (PqDev pqDev : devList) {
|
||||
if (!pqDev.getCheckResult().equals(CheckResultEnum.UNCHECKED.getValue())) {
|
||||
pqDevService.update(new LambdaUpdateWrapper<PqDev>()
|
||||
.set(PqDev::getCheckState, CheckStateEnum.CHECKED.getValue())
|
||||
.in(PqDev::getId, devIds));
|
||||
} else {
|
||||
pqDevService.update(new LambdaUpdateWrapper<PqDev>()
|
||||
.set(PqDev::getCheckState, CheckStateEnum.UNCHECKED.getValue())
|
||||
.in(PqDev::getId, devIds));
|
||||
if (CollUtil.isNotEmpty(devIds)) {
|
||||
//当前如果第二次进行测试,则需要将判断之前状态是否不是非检测状态
|
||||
List<PqDevVO> pqDevVOList = pqDevMapper.listByDevIds(devIds);
|
||||
|
||||
if (CollUtil.isNotEmpty(pqDevVOList)) {
|
||||
for (PqDevVO pqDevVO : pqDevVOList) {
|
||||
if (!pqDevVO.getCheckResult().equals(CheckResultEnum.UNCHECKED.getValue())) {
|
||||
pqDevSubService.update(new LambdaUpdateWrapper<PqDevSub>()
|
||||
.set(PqDevSub::getCheckState, CheckStateEnum.CHECKED.getValue())
|
||||
.in(PqDevSub::getDevId, devIds));
|
||||
} else {
|
||||
pqDevSubService.update(new LambdaUpdateWrapper<PqDevSub>()
|
||||
.set(PqDevSub::getCheckState, CheckStateEnum.UNCHECKED.getValue())
|
||||
.in(PqDevSub::getDevId, devIds));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
List<PqDev> list = pqDevService.list(new LambdaQueryWrapper<PqDev>().in(PqDev::getPlanId, planId));
|
||||
List<PqDev> collect = list.stream().filter(x -> !x.getCheckState().equals(CheckStateEnum.UNCHECKED.getValue())).collect(Collectors.toList());
|
||||
if (CollUtil.isEmpty(collect)) {
|
||||
return this.update(new LambdaUpdateWrapper<AdPlan>()
|
||||
.set(AdPlan::getTestState, CheckStateEnum.UNCHECKED.getValue())
|
||||
.eq(AdPlan::getId, planId));
|
||||
PqDevParam.QueryParam queryParam = new PqDevParam.QueryParam();
|
||||
queryParam.setPlanId(planId);
|
||||
List<PqDevVO> pqDevVOList1 = pqDevMapper.selectByQueryParam(queryParam);
|
||||
List<PqDev> collect = pqDevVOList1.stream().filter(x -> !x.getCheckState().equals(CheckStateEnum.UNCHECKED.getValue())).collect(Collectors.toList());
|
||||
if (CollUtil.isEmpty(collect)) {
|
||||
return this.update(new LambdaUpdateWrapper<AdPlan>()
|
||||
.set(AdPlan::getTestState, CheckStateEnum.UNCHECKED.getValue())
|
||||
.eq(AdPlan::getId, planId));
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -444,19 +463,19 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
||||
|
||||
if (planList.size() > 1) {
|
||||
StringBuffer allNote = new StringBuffer();
|
||||
List<PqDev> allDevList = new ArrayList<>();
|
||||
List<PqDevVO> allDevList = new ArrayList<>();
|
||||
for (AdPlan plan : planList) {
|
||||
PqDevParam.QueryParam queryParam = new PqDevParam.QueryParam();
|
||||
queryParam.setPlanId(plan.getId());
|
||||
List<PqDev> devList = pqDevService.listByPlanId(queryParam);
|
||||
devList = devList.stream().filter(x -> !x.getCheckResult().equals(CheckResultEnum.UNCHECKED.getValue())).collect(Collectors.toList());
|
||||
allDevList.addAll(devList);
|
||||
List<PqDevVO> pqDevVOList = pqDevMapper.selectByQueryParam(queryParam);
|
||||
pqDevVOList = pqDevVOList.stream().filter(x -> !x.getCheckResult().equals(CheckResultEnum.UNCHECKED.getValue())).collect(Collectors.toList());
|
||||
allDevList.addAll(pqDevVOList);
|
||||
|
||||
allNote.append(plan.getName() + "计划" + devList.size() + "台,");
|
||||
allNote.append(plan.getName() + "计划" + pqDevVOList.size() + "台,");
|
||||
if (plan.getName().equals("概览")) {
|
||||
sheets.put(plan.getName() + "检测计划", getRows(plan.getName(), devList, maxTime, getNote(plan, devList)));
|
||||
sheets.put(plan.getName() + "检测计划", getRows(plan.getName(), pqDevVOList, maxTime, getNote(plan, pqDevVOList)));
|
||||
} else {
|
||||
sheets.put(plan.getName(), getRows(plan.getName(), devList, maxTime, getNote(plan, devList)));
|
||||
sheets.put(plan.getName(), getRows(plan.getName(), pqDevVOList, maxTime, getNote(plan, pqDevVOList)));
|
||||
}
|
||||
}
|
||||
allNote.insert(0, "说明:总计" + allDevList.size() + "台设备,");
|
||||
@@ -466,10 +485,10 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
||||
AdPlan plan = planList.get(0);
|
||||
PqDevParam.QueryParam queryParam = new PqDevParam.QueryParam();
|
||||
queryParam.setPlanId(plan.getId());
|
||||
List<PqDev> devList = pqDevService.listByPlanId(queryParam);
|
||||
devList = devList.stream().filter(x -> !x.getCheckResult().equals(CheckResultEnum.UNCHECKED.getValue())).collect(Collectors.toList());
|
||||
List<PqDevVO> pqDevVOList = pqDevMapper.selectByQueryParam(queryParam);
|
||||
pqDevVOList = pqDevVOList.stream().filter(x -> !x.getCheckResult().equals(CheckResultEnum.UNCHECKED.getValue())).collect(Collectors.toList());
|
||||
|
||||
sheets.put(plan.getName(), getRows(plan.getName(), devList, maxTime, getNote(plan, devList)));
|
||||
sheets.put(plan.getName(), getRows(plan.getName(), pqDevVOList, maxTime, getNote(plan, pqDevVOList)));
|
||||
}
|
||||
|
||||
exportPassRateExcel("数据分析结果.xlsx", maxTime, sheets);
|
||||
@@ -513,21 +532,25 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
||||
}
|
||||
|
||||
@Override
|
||||
public void importPlan(MultipartFile file, String patternId, HttpServletResponse response) {
|
||||
public boolean importPlan(MultipartFile file, String patternId, HttpServletResponse response) {
|
||||
String currrentScene = sysTestConfigService.getCurrrentScene();
|
||||
SceneEnum sceneEnum = SceneEnum.getSceneEnum(currrentScene);
|
||||
switch (sceneEnum) {
|
||||
case PROVINCE_PLATFORM:
|
||||
this.importProvincePlan(file, patternId, response);
|
||||
break;
|
||||
return this.importProvincePlan(file, patternId, response);
|
||||
case LEAVE_FACTORY_TEST:
|
||||
this.importCNPlan(file, patternId, response);
|
||||
break;
|
||||
return this.importCNPlan(file, patternId, response);
|
||||
case SELF_TEST:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean splitPlan(AdPlanParam.SplitParam param) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -545,9 +568,9 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
||||
|
||||
PqDevParam.QueryParam queryParam1 = new PqDevParam.QueryParam();
|
||||
queryParam1.setPlanId(planList.get(i).getId());
|
||||
List<PqDev> pqDevs = pqDevService.listByPlanId(queryParam1);
|
||||
pqDevService.visualizeProvinceDev(pqDevs);
|
||||
List<ProvinceDevExcel> deviceExportData = BeanUtil.copyToList(pqDevs, ProvinceDevExcel.class);
|
||||
List<PqDevVO> pqDevVOList = pqDevMapper.selectByQueryParam(queryParam1);
|
||||
pqDevService.visualizeProvinceDev(pqDevVOList);
|
||||
List<ProvinceDevExcel> deviceExportData = BeanUtil.copyToList(pqDevVOList, ProvinceDevExcel.class);
|
||||
planExcelList.get(i).setDevices(deviceExportData);
|
||||
}
|
||||
ExcelUtil.exportExcelPullDown(new ExportParams(), "检测计划导出数据.xlsx", 2, this.getPullDownList(SceneEnum.PROVINCE_PLATFORM, queryParam.getPatternId()), ProvincePlanExcel.class, planExcelList);
|
||||
@@ -568,7 +591,7 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
||||
|
||||
PqDevParam.QueryParam queryParam1 = new PqDevParam.QueryParam();
|
||||
queryParam1.setPlanId(planList.get(i).getId());
|
||||
List<PqDev> pqDevs = pqDevService.listByPlanId(queryParam1);
|
||||
List<PqDevVO> pqDevs = pqDevMapper.selectByQueryParam(queryParam1);
|
||||
pqDevService.visualizeCNDev(pqDevs);
|
||||
List<CNDevExcel> deviceExportData = BeanUtil.copyToList(pqDevs, CNDevExcel.class);
|
||||
planExcelList.get(i).setDevices(deviceExportData);
|
||||
@@ -577,7 +600,7 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void importCNPlan(MultipartFile file, String patternId, HttpServletResponse response) {
|
||||
public boolean importCNPlan(MultipartFile file, String patternId, HttpServletResponse response) {
|
||||
ImportParams params = new ImportParams();
|
||||
params.setStartSheetIndex(0);
|
||||
params.setSheetNum(1);
|
||||
@@ -598,8 +621,9 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
||||
throw new BusinessException(DetectionResponseEnum.IMPORT_DATA_FAIL);
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(planExcelList)) {
|
||||
this.importCNPlan(planExcelList, patternId);
|
||||
return this.importCNPlan(planExcelList, patternId);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -609,7 +633,7 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
||||
* @param patternId
|
||||
*/
|
||||
@Transactional
|
||||
public void importCNPlan(List<CNPlanExcel> planExcelList, String patternId) {
|
||||
public boolean importCNPlan(List<CNPlanExcel> planExcelList, String patternId) {
|
||||
List<AdPlan> adPlans = BeanUtil.copyToList(planExcelList, AdPlan.class);
|
||||
|
||||
String patternCode = dictDataService.getDictDataById(patternId).getCode();
|
||||
@@ -653,11 +677,11 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
||||
}
|
||||
// 逆向可视化
|
||||
this.reverseVisualize(adPlans);
|
||||
this.saveBatch(adPlans);
|
||||
return this.saveBatch(adPlans);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void importProvincePlan(MultipartFile file, String patternId, HttpServletResponse response) {
|
||||
public boolean importProvincePlan(MultipartFile file, String patternId, HttpServletResponse response) {
|
||||
ImportParams params = new ImportParams();
|
||||
params.setStartSheetIndex(0);
|
||||
params.setSheetNum(1);
|
||||
@@ -678,8 +702,9 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
||||
throw new BusinessException(DetectionResponseEnum.IMPORT_DATA_FAIL);
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(planExcelList)) {
|
||||
this.importProvincePlan(planExcelList, patternId);
|
||||
return this.importProvincePlan(planExcelList, patternId);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -688,7 +713,7 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
||||
* @param planExcelList
|
||||
* @param patternId
|
||||
*/
|
||||
public void importProvincePlan(List<ProvincePlanExcel> planExcelList, String patternId) {
|
||||
public boolean importProvincePlan(List<ProvincePlanExcel> planExcelList, String patternId) {
|
||||
List<AdPlan> adPlans = BeanUtil.copyToList(planExcelList, AdPlan.class);
|
||||
|
||||
String patternCode = dictDataService.getDictDataById(patternId).getCode();
|
||||
@@ -737,7 +762,7 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
||||
}
|
||||
// 逆向可视化
|
||||
this.reverseVisualize(adPlans);
|
||||
this.saveBatch(adPlans);
|
||||
return this.saveBatch(adPlans);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -766,7 +791,7 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
||||
* @param devList 设备列表
|
||||
* @return 备注信息
|
||||
*/
|
||||
private String getNote(AdPlan plan, List<PqDev> devList) {
|
||||
private String getNote(AdPlan plan, List<PqDevVO> devList) {
|
||||
StringBuffer note = new StringBuffer();
|
||||
note.append("说明:本计划共有" + devList.size() + "台设备,");
|
||||
Map<String, List<PqDev>> devTypeMap = devList.stream().collect(Collectors.groupingBy(PqDev::getDevType, Collectors.toList()));
|
||||
@@ -793,7 +818,7 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
||||
* @param note 备注
|
||||
* @return
|
||||
*/
|
||||
private List<String[]> getRows(String header, List<PqDev> devList, Integer maxTime, String note) {
|
||||
private List<String[]> getRows(String header, List<PqDevVO> devList, Integer maxTime, String note) {
|
||||
List<String[]> rows = new ArrayList<>();
|
||||
String[] row1 = new String[]{header};
|
||||
|
||||
@@ -813,7 +838,7 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
||||
for (int i = 1; i <= maxTime; i++) {
|
||||
row2[i] = i + "次检测";
|
||||
int tempI = i;
|
||||
List<PqDev> tempDevList = devList.stream().filter(dev -> dev.getReCheckNum() <= tempI).collect(Collectors.toList());
|
||||
List<PqDevVO> tempDevList = devList.stream().filter(dev -> dev.getRecheckNum() <= tempI).collect(Collectors.toList());
|
||||
long passCount = tempDevList.stream().filter(dev -> dev.getCheckResult() == CheckResultEnum.ACCORD.getValue()).count();
|
||||
row3[i] = passCount + "";
|
||||
row4[i] = total + "";
|
||||
@@ -873,7 +898,7 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
||||
}
|
||||
if (adPlan.getAssociateReport().equals(0)) {
|
||||
adPlan.setReportTemplateId(null);
|
||||
}else if (StrUtil.isNotBlank(adPlan.getReportTemplateId())) {
|
||||
} else if (StrUtil.isNotBlank(adPlan.getReportTemplateId())) {
|
||||
String[] split = adPlan.getReportTemplateId().split("_");
|
||||
String reportId = this.baseMapper.getReportIdByNameAndVersion(split[0], split[1]);
|
||||
if (ObjectUtil.isNull(reportId)) {
|
||||
|
||||
@@ -62,7 +62,7 @@ public interface DetectionValidMessage {
|
||||
|
||||
String RECHECK_NUM_FORMAT_ERROR = "检测次数格式错误,请检查recheckNum参数";
|
||||
|
||||
String PATTERN_FORMAT_ERROR = "模式格式错误,请检查patternId参数";
|
||||
String PATTERN_FORMAT_ERROR = "模式格式错误";
|
||||
|
||||
String SOURCE_IDS_NOT_EMPTY = "检测源ID不能为空,请检查sourceIds参数";
|
||||
|
||||
@@ -120,13 +120,13 @@ public interface DetectionValidMessage {
|
||||
|
||||
String BELONG_LINE_NOT_BLANK = "所属母线不能为空";
|
||||
|
||||
String PT_NOT_NULL = "PT变比不能为空";
|
||||
String PT_NOT_BLANK = "PT变比不能为空";
|
||||
|
||||
String CT_NOT_NULL = "CT变比不能为空";
|
||||
String CT_NOT_BLANK = "CT变比不能为空";
|
||||
|
||||
String WIRING_TYPE_NOT_BLANK = "接线方式不能为空";
|
||||
String CONNECTION_NOT_BLANK = "接线方式不能为空";
|
||||
|
||||
String WIRING_TYPE_FORMAT_ERROR = "接线方式格式错误";
|
||||
String CONNECTION_FORMAT_ERROR = "接线方式格式错误";
|
||||
|
||||
String DATASOURCE_ID_NOT_EMPTY = "数据源ID不能为空";
|
||||
|
||||
@@ -158,7 +158,7 @@ public interface DetectionValidMessage {
|
||||
|
||||
String CHECK_RESULT_FORMAT_ERROR = "检测结果格式错误";
|
||||
|
||||
String MONITOR_NUM_NOT_NULL = "监测点序号不能为空";
|
||||
String MONITOR_NUM_NOT_NULL = "线路号不能为空";
|
||||
|
||||
String FACTOR_FLAG_FORMAT_ERROR = "是否支持系数校准格式错误";
|
||||
|
||||
@@ -179,6 +179,20 @@ public interface DetectionValidMessage {
|
||||
|
||||
String DEV_TYPE_NAME_FORMAT_ERROR = "设备类型名称格式错误,只能包含字母、数字、中文、下划线、中划线、点号、空格,长度为1-32个字符";
|
||||
String REPORT_NAME_NOT_BLANK = "报告模板不能为空";
|
||||
String OPERATION_DATE_FORMAT_ERROR = "投运日期格式错误,请检查operationDate参数";
|
||||
|
||||
String INSPECT_DATE_FORMAT_ERROR = "定检日期格式错误,请检查inspectDate参数";
|
||||
String MONITOR_NAME_NOT_BLANK = "监测点名称不能为空";
|
||||
String MONITOR_ID_NOT_BLANK = "谐波系统监测点ID不能为空";
|
||||
String DEVICE_ID_NOT_BLANK = "所属设备ID不能为空";
|
||||
String STAT_INTERVAL_NOT_NULL = "统计间隔不能为空";
|
||||
String MONITOR_ID_PATTERN = "谐波系统监测点ID格式错误";
|
||||
String DATA_RULE_NOT_BLANK = "数据处理原则不能为空";
|
||||
String ASSOCIATE_REPORT_NOT_NULL = "是否关联报告模板不能为空";
|
||||
String PID_FORMAT_ERROR = "PID格式错误";
|
||||
String INSPECT_CHANNEL_NOT_BLANK = "可检通道不能为空";
|
||||
String INSPECT_CHANNEL_FORMAT_ERROR = "可检通道格式错误";
|
||||
String CREATE_DATE_NOT_NULL = "投运日期不能为空";
|
||||
String INSPECT_DATE_NOT_NULL = "定检日期不能为空";
|
||||
String HARM_SYS_ID_NOT_BLANK = "谐波系统设备id不能为空";
|
||||
}
|
||||
|
||||
@@ -61,8 +61,14 @@ public enum DetectionResponseEnum {
|
||||
ERROR_SYSTEM_NOT_EXIST("A02069", "该误差体系不存在,请先添加该误差体系"),
|
||||
DATA_RULE_NOT_EXIST("A02070", "该数据处理原则不存在,请先在\"数据处理原则\"字典中添加"),
|
||||
REPORT_TEMPLATE_NOT_EXIST("A02071", "该报告模板不存在,请先添加该报告模板"),
|
||||
LACK_REPORT_TEMPLATE_ID("A02072","当关联报告模板为\"是\"时,报告模板不能为空" ),
|
||||
NAME_OR_CREATEID_REPEAT("A02073","名称或装置编号重复" );
|
||||
LACK_REPORT_TEMPLATE_ID("A02072", "当关联报告模板为\"是\"时,报告模板不能为空"),
|
||||
NAME_OR_CREATEID_REPEAT("A02073", "名称或装置编号重复"),
|
||||
MONITOR_REPEAT("A02080", "当前设备下已存在相同的监测点"),
|
||||
PQ_STANDARD_DEV_REPEAT("A02090", "已存在同名的标准设备"),
|
||||
IMPORT_FLAG_NOT_UPDATE("A02091", "从谐波系统导入的设备不支持修改"),
|
||||
CONNECTION_NOT_EXIST("A02092", "该连接不存在,请先在\"接线方式\"字典中添加"),
|
||||
MONITOR_NUM_OUT_OF_RANGE("A02093", "检测点线路号超出范围,请检查线路号"),
|
||||
MONITOR_NUM_REPEAT("A02094", "改被检设备下存在相同线路号的监测点");
|
||||
|
||||
private final String code;
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@ import cn.hutool.extra.qrcode.QrCodeUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
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;
|
||||
@@ -34,9 +33,11 @@ import com.njcn.gather.detection.util.socket.cilent.NettyDevClientHandler;
|
||||
import com.njcn.gather.device.mapper.PqDevMapper;
|
||||
import com.njcn.gather.device.pojo.enums.CheckStateEnum;
|
||||
import com.njcn.gather.device.pojo.enums.DevReportStateEnum;
|
||||
import com.njcn.gather.device.pojo.po.PqDev;
|
||||
import com.njcn.gather.device.pojo.param.PqDevParam;
|
||||
import com.njcn.gather.device.pojo.po.PqDevSub;
|
||||
import com.njcn.gather.device.pojo.vo.PqDevVO;
|
||||
import com.njcn.gather.device.service.IPqDevService;
|
||||
import com.njcn.gather.device.service.IPqDevSubService;
|
||||
import com.njcn.gather.plan.pojo.enums.PlanReportStateEnum;
|
||||
import com.njcn.gather.plan.pojo.po.AdPlan;
|
||||
import com.njcn.gather.plan.service.IAdPlanService;
|
||||
@@ -158,6 +159,7 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
||||
|
||||
private final IPqDevService iPqDevService;
|
||||
private final PqDevMapper pqDevMapper;
|
||||
private final IPqDevSubService iPqDevSubService;
|
||||
|
||||
private final IDictDataService dictDataService;
|
||||
|
||||
@@ -177,6 +179,7 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
||||
|
||||
private final SocketDevResponseService socketDevResponseService;
|
||||
|
||||
|
||||
@Autowired
|
||||
private RestTemplateUtil restTemplateUtil;
|
||||
|
||||
@@ -1285,7 +1288,7 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
||||
// 将改设备的报告生成状态调整为已生成
|
||||
iPqDevService.updatePqDevReportState(devId, DevReportStateEnum.GENERATED.getValue());
|
||||
// 判断该计划下是否所有设备报告已生成,如果已生成则将计划的报告状态给为已生成
|
||||
int count = iPqDevService.countUnReportDev(planId);
|
||||
long count = iPqDevService.countUnReportDev(planId);
|
||||
LambdaUpdateWrapper<AdPlan> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.eq(AdPlan::getId, planId);
|
||||
if (count == 0) {
|
||||
@@ -1350,44 +1353,43 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
||||
@Transactional
|
||||
public boolean documented(List<String> ids) {
|
||||
if (CollUtil.isNotEmpty(ids)) {
|
||||
List<PqDevVO> pqDevVOList = pqDevMapper.listByDevIds(ids);
|
||||
List<String> devIds = new ArrayList<>();
|
||||
PqDev tempPqDev = null;
|
||||
for (String id : ids) {
|
||||
// 只有检测完成的设备才可以进行归档
|
||||
PqDev pqDev = iPqDevService.getById(id);
|
||||
if (ObjectUtil.isNotNull(pqDev)) {
|
||||
// 只有检测完成、且已生成报告的设备才可以进行归档
|
||||
if (!pqDev.getCheckState().equals(CheckStateEnum.CHECKED.getValue())) {
|
||||
throw new BusinessException(DetectionResponseEnum.DEV_UN_CHECKED);
|
||||
}
|
||||
if (!pqDev.getReportState().equals(DevReportStateEnum.GENERATED.getValue())) {
|
||||
devIds.add(id);
|
||||
tempPqDev = pqDev;
|
||||
}
|
||||
boolean update = iPqDevService.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 = iPqDevService.count(queryWrapper);
|
||||
if (count == 0) {
|
||||
// 如果非归档状态的设备数量为0,则更新计划已完成
|
||||
pqDevMapper.finishPlan(pqDev.getPlanId());
|
||||
}
|
||||
}
|
||||
PqDevVO tempPqDevVO = null;
|
||||
PqDevVO pqDevVO = null;
|
||||
|
||||
for (int i = 0; i < pqDevVOList.size(); i++) {
|
||||
pqDevVO = pqDevVOList.get(i);
|
||||
if (!pqDevVO.getCheckState().equals(CheckStateEnum.CHECKED.getValue())) {
|
||||
throw new BusinessException(DetectionResponseEnum.DEV_UN_CHECKED);
|
||||
}
|
||||
if (!pqDevVO.getReportState().equals(DevReportStateEnum.GENERATED.getValue())) {
|
||||
devIds.add(pqDevVO.getId());
|
||||
tempPqDevVO = pqDevVO;
|
||||
}
|
||||
}
|
||||
|
||||
iPqDevSubService.lambdaUpdate()
|
||||
.set(PqDevSub::getCheckState, CheckStateEnum.DOCUMENTED.getValue())
|
||||
.in(PqDevSub::getDevId, ids)
|
||||
.update();
|
||||
// 判断计划下所有设备是否都已归档,如果是则将计划改为已完成
|
||||
// 查询该计划下所有设备的检测状态,是否有不为归档的
|
||||
PqDevParam.QueryParam queryParam = new PqDevParam.QueryParam();
|
||||
queryParam.setPlanId(tempPqDevVO.getPlanId());
|
||||
List<PqDevVO> pqDevVOList1 = pqDevMapper.selectByQueryParam(queryParam);
|
||||
|
||||
long count = pqDevVOList1.stream().filter(obj -> !CheckStateEnum.DOCUMENTED.getValue().equals(obj.getCheckState())).count();
|
||||
if (count == 0) {
|
||||
// 如果非归档状态的设备数量为0,则更新计划已完成
|
||||
pqDevMapper.finishPlan(pqDevVO.getPlanId());
|
||||
}
|
||||
|
||||
if (CollUtil.isNotEmpty(devIds)) {
|
||||
DevReportParam devReportParam = new DevReportParam();
|
||||
devReportParam.setDevIdList(devIds);
|
||||
devReportParam.setPlanId(tempPqDev.getPlanId());
|
||||
AdPlan plan = adPlanService.getById(tempPqDev.getPlanId());
|
||||
devReportParam.setPlanId(tempPqDevVO.getPlanId());
|
||||
AdPlan plan = adPlanService.getById(tempPqDevVO.getPlanId());
|
||||
devReportParam.setScriptId(plan.getScriptId());
|
||||
devReportParam.setPlanCode(String.valueOf(plan.getCode()));
|
||||
this.generateReport(devReportParam);
|
||||
|
||||
Reference in New Issue
Block a user