7 Commits

Author SHA1 Message Date
xy
f754cf61c4 微调 2025-01-13 09:58:09 +08:00
xy
e32e820417 微调 2025-01-13 09:41:23 +08:00
xy
158917f2bc 新增测试项修改功能 2025-01-09 11:52:41 +08:00
xy
2df06d9597 代码优化 2025-01-08 15:44:26 +08:00
xy
81da6e54ca DVR界面添加条件筛选 2025-01-06 19:18:30 +08:00
xy
1f4e8c7e25 设备录入添加正则判断 2025-01-03 14:40:51 +08:00
xy
f90a3228b9 bug调整 2025-01-03 13:13:28 +08:00
15 changed files with 95 additions and 35 deletions

View File

@@ -46,7 +46,7 @@ public interface WlRecordFeignClient {
HttpResult<Boolean> updateTestRecord(@RequestBody @Validated WlRecordParam.UpdateRecord record); HttpResult<Boolean> updateTestRecord(@RequestBody @Validated WlRecordParam.UpdateRecord record);
@GetMapping("/dayDealNoEndTimeEvent") @PostMapping("/dayDealNoEndTimeEvent")
void dayDealNoEndTimeEvent(@RequestParam("date") String date); void dayDealNoEndTimeEvent(@RequestParam("date") String date);
@GetMapping("/getWlAssByWlId") @GetMapping("/getWlAssByWlId")

View File

@@ -47,7 +47,8 @@ public class CsDevModelQueryParm {
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private String versionEndDate; private String versionEndDate;
@ApiModelProperty(value = "装置型号")
private String devType;

View File

@@ -1,13 +1,10 @@
package com.njcn.csdevice.pojo.param; package com.njcn.csdevice.pojo.param;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern; import javax.validation.constraints.Pattern;
import java.util.Date;
/** /**
* *
@@ -35,7 +32,7 @@ public class CsEquipmentDeliveryAddParm{
*/ */
@ApiModelProperty(value="网络设备ID") @ApiModelProperty(value="网络设备ID")
@NotBlank(message="网络设备ID不能为空") @NotBlank(message="网络设备ID不能为空")
@Pattern(regexp = "^[A-Za-z0-9]{1,32}$", message = "网络设备ID只可为(数字,字母)") @Pattern(regexp = "^[A-Za-z0-9]{6,32}$", message = "网络设备ID只可为数字字母,长度至少为6位")
private String ndid; private String ndid;
/** /**

View File

@@ -1,5 +1,6 @@
package com.njcn.csdevice.pojo.param; package com.njcn.csdevice.pojo.param;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
@@ -34,9 +35,11 @@ public class WlRecordParam {
private String lineId; private String lineId;
@ApiModelProperty("项目起始时间") @ApiModelProperty("项目起始时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime proStartTime; private LocalDateTime proStartTime;
@ApiModelProperty("项目结束时间") @ApiModelProperty("项目结束时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime proEndTime; private LocalDateTime proEndTime;
@ApiModelProperty("测试项名称") @ApiModelProperty("测试项名称")

View File

@@ -107,6 +107,14 @@ public class EquipmentDeliveryController extends BaseController {
public HttpResult<Boolean> updateEquipmentDelivery(@RequestBody @Validated CsEquipmentDeliveryAuditParm csEquipmentDeliveryAuditParm ){ public HttpResult<Boolean> updateEquipmentDelivery(@RequestBody @Validated CsEquipmentDeliveryAuditParm csEquipmentDeliveryAuditParm ){
String methodDescribe = getMethodDescribe("updateEquipmentDelivery"); String methodDescribe = getMethodDescribe("updateEquipmentDelivery");
Boolean flag = csEquipmentDeliveryService.updateEquipmentDelivery(csEquipmentDeliveryAuditParm); Boolean flag = csEquipmentDeliveryService.updateEquipmentDelivery(csEquipmentDeliveryAuditParm);
if (flag){
//查询mqtt用户名和密码是否存在
boolean result = mqttUserService.findMqttUser(csEquipmentDeliveryAuditParm.getNdid());
if (result){
//初始化装置mqtt连接信息(使用sha256加密)
mqttUserService.insertMqttUser(csEquipmentDeliveryAuditParm.getNdid());
}
}
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
} }

View File

@@ -127,6 +127,20 @@ public class WlRecordController extends BaseController {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
} }
/**
* 修改测试项日志
*/
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.UPDATE)
@PostMapping("/updateRecordData")
@ApiOperation("修改测试项日志")
@ApiImplicitParam(name = "record", value = "测试项日志信息", required = true)
public HttpResult<Boolean> updateRecordData(@RequestBody @Validated WlRecordParam.UpdateRecord record) {
String methodDescribe = getMethodDescribe("updateRecordData");
LogUtil.njcnDebug(log, "{},修改的测试项日志信息:{}", methodDescribe, record);
wlRecordService.updateRecordData(record);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
/** /**
* 新增或修改方案 * 新增或修改方案
*/ */

View File

@@ -33,13 +33,10 @@
</if> </if>
<if test="csDevModelQueryParm.devName != null and csDevModelQueryParm.devName != ''"> <if test="csDevModelQueryParm.devName != null and csDevModelQueryParm.devName != ''">
AND a.dev_type_name LIKE concat('%',#{csDevModelQueryParm.devName},'%') AND a.dev_type_name = #{csDevModelQueryParm.devName}
</if> </if>
<!-- <if test="csDevModelQueryParm.devType != null and csDevModelQueryParm.devType != ''">-->
<!-- AND a.dev_type = #{csDevModelQueryParm.devType}-->
<!-- </if>-->
<if test="csDevModelQueryParm.name != null and csDevModelQueryParm.name != ''"> <if test="csDevModelQueryParm.name != null and csDevModelQueryParm.name != ''">
AND a.name = #{csDevModelQueryParm.name} AND a.name LIKE concat('%',#{csDevModelQueryParm.name},'%')
</if> </if>
order by a.version_date desc order by a.version_date desc
</select> </select>

View File

@@ -63,6 +63,8 @@ public interface IWlRecordService extends IService<WlRecord> {
*/ */
void updateTestRecord(WlRecordParam.UpdateRecord record); void updateTestRecord(WlRecordParam.UpdateRecord record);
void updateRecordData(WlRecordParam.UpdateRecord record);
/** /**
* 新增或修改方案 * 新增或修改方案
* @param record * @param record

View File

@@ -1,37 +1,32 @@
package com.njcn.csdevice.service.impl; package com.njcn.csdevice.service.impl;
import cn.hutool.core.collection.CollUtil;
import com.alibaba.nacos.shaded.com.google.gson.Gson;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.csdevice.mapper.CsDevModelMapper; import com.njcn.csdevice.mapper.CsDevModelMapper;
import com.njcn.csdevice.pojo.dto.CsDevModelDto;
import com.njcn.csdevice.pojo.param.CsDevModelAddParm; import com.njcn.csdevice.pojo.param.CsDevModelAddParm;
import com.njcn.csdevice.pojo.param.CsDevModelAuditParm; import com.njcn.csdevice.pojo.param.CsDevModelAuditParm;
import com.njcn.csdevice.pojo.param.CsDevModelQueryListParm; import com.njcn.csdevice.pojo.param.CsDevModelQueryListParm;
import com.njcn.csdevice.pojo.param.CsDevModelQueryParm; import com.njcn.csdevice.pojo.param.CsDevModelQueryParm;
import com.njcn.csdevice.pojo.po.CsDataArray;
import com.njcn.csdevice.pojo.po.CsDataSet;
import com.njcn.csdevice.pojo.po.CsDevModelPO; import com.njcn.csdevice.pojo.po.CsDevModelPO;
import com.njcn.csdevice.pojo.vo.CsDevModelPageVO; import com.njcn.csdevice.pojo.vo.CsDevModelPageVO;
import com.njcn.csdevice.service.CsDevModelService; import com.njcn.csdevice.service.CsDevModelService;
import com.njcn.csdevice.service.ICsDataArrayService; import com.njcn.csdevice.service.ICsDataArrayService;
import com.njcn.csdevice.service.ICsDataSetService; import com.njcn.csdevice.service.ICsDataSetService;
import com.njcn.redis.pojo.enums.AppRedisKey;
import com.njcn.redis.utils.RedisUtil; import com.njcn.redis.utils.RedisUtil;
import com.njcn.system.api.DictTreeFeignClient;
import com.njcn.system.pojo.po.SysDicTreePO;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.sql.Date; import java.sql.Date;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.stream.Collectors;
/** /**
* *
@@ -50,6 +45,7 @@ public class CsDevModelServiceImpl extends ServiceImpl<CsDevModelMapper, CsDevMo
private final ICsDataSetService csDataSetService; private final ICsDataSetService csDataSetService;
private final ICsDataArrayService csDataArrayService; private final ICsDataArrayService csDataArrayService;
private final RedisUtil redisUtil; private final RedisUtil redisUtil;
private final DictTreeFeignClient dictTreeFeignClient;
@Override @Override
public void refreshDevModelCache() { public void refreshDevModelCache() {
@@ -128,7 +124,14 @@ public class CsDevModelServiceImpl extends ServiceImpl<CsDevModelMapper, CsDevMo
@Override @Override
public IPage<CsDevModelPageVO> queryPage(CsDevModelQueryParm csDevModelQueryParm) { public IPage<CsDevModelPageVO> queryPage(CsDevModelQueryParm csDevModelQueryParm) {
Page<CsDevModelPageVO> returnpage = new Page<> (csDevModelQueryParm.getPageNum ( ), csDevModelQueryParm.getPageSize ( )); Page<CsDevModelPageVO> returnpage = new Page<> (csDevModelQueryParm.getPageNum ( ), csDevModelQueryParm.getPageSize ( ));
if (Objects.nonNull (csDevModelQueryParm.getDevType()) && StringUtils.isNotBlank(csDevModelQueryParm.getDevType())) {
SysDicTreePO po = dictTreeFeignClient.queryById(csDevModelQueryParm.getDevType()).getData();
if (Objects.isNull (po)) {
throw new BusinessException("装置型号字典缺失");
} else {
csDevModelQueryParm.setDevName(po.getName());
}
}
returnpage = this.getBaseMapper ().getPage(returnpage,csDevModelQueryParm); returnpage = this.getBaseMapper ().getPage(returnpage,csDevModelQueryParm);
return returnpage; return returnpage;
} }

View File

@@ -238,7 +238,11 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
if (countByAccount >= 1) { if (countByAccount >= 1) {
throw new BusinessException(AlgorithmResponseEnum.NDID_ERROR); throw new BusinessException(AlgorithmResponseEnum.NDID_ERROR);
} }
List<CsEquipmentDeliveryPO> list = this.lambdaQuery().ne(CsEquipmentDeliveryPO::getNdid, csEquipmentDeliveryAuditParm.getNdid()).eq(CsEquipmentDeliveryPO::getName, csEquipmentDeliveryAuditParm.getName()).ne(CsEquipmentDeliveryPO::getRunStatus, 0).list(); List<CsEquipmentDeliveryPO> list = this.lambdaQuery()
.ne(CsEquipmentDeliveryPO::getId, csEquipmentDeliveryAuditParm.getId())
.ne(CsEquipmentDeliveryPO::getNdid, csEquipmentDeliveryAuditParm.getNdid())
.eq(CsEquipmentDeliveryPO::getName, csEquipmentDeliveryAuditParm.getName())
.ne(CsEquipmentDeliveryPO::getRunStatus, 0).list();
if(!CollectionUtils.isEmpty (list)){ if(!CollectionUtils.isEmpty (list)){
throw new BusinessException ("设备名称不能重复"); throw new BusinessException ("设备名称不能重复");
} }
@@ -449,6 +453,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
//第一个sheet为台账信息 //第一个sheet为台账信息
params.setStartSheetIndex(0); params.setStartSheetIndex(0);
params.setSheetNum(1); params.setSheetNum(1);
String regex = "^[A-Za-z0-9]{6,32}$";
try { try {
ExcelImportResult<DeviceExcelTemplete> terminalBaseList = ExcelImportUtil.importExcelMore (file.getInputStream ( ), DeviceExcelTemplete.class, params); ExcelImportResult<DeviceExcelTemplete> terminalBaseList = ExcelImportUtil.importExcelMore (file.getInputStream ( ), DeviceExcelTemplete.class, params);
//如果存在非法数据,将不合格的数据导出 //如果存在非法数据,将不合格的数据导出
@@ -457,6 +462,15 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
for (int i = 0; i < terminalBaseList.getList ( ).size ( ); i++) { for (int i = 0; i < terminalBaseList.getList ( ).size ( ); i++) {
DeviceExcelTemplete deviceExcelTemplete = terminalBaseList.getList ( ).get (i); DeviceExcelTemplete deviceExcelTemplete = terminalBaseList.getList ( ).get (i);
if(!deviceExcelTemplete.getNdid().matches(regex)){
DeviceExcelTemplete.IllegalityDeviceExcelTemplete idlegalityDeviceException = new DeviceExcelTemplete.IllegalityDeviceExcelTemplete();
BeanUtils.copyProperties(deviceExcelTemplete,idlegalityDeviceException);
idlegalityDeviceException.setMsg("网络设备ID只可为数字或字母,长度至少为6位");
falseCollect.add(idlegalityDeviceException);
continue;
}
CsEquipmentDeliveryPO po = this.queryEquipmentPOByndid (deviceExcelTemplete.getNdid ( )); CsEquipmentDeliveryPO po = this.queryEquipmentPOByndid (deviceExcelTemplete.getNdid ( ));
if(!Objects.isNull (po)){ if(!Objects.isNull (po)){
DeviceExcelTemplete.IllegalityDeviceExcelTemplete idlegalityDeviceException = new DeviceExcelTemplete.IllegalityDeviceExcelTemplete(); DeviceExcelTemplete.IllegalityDeviceExcelTemplete idlegalityDeviceException = new DeviceExcelTemplete.IllegalityDeviceExcelTemplete();

View File

@@ -206,6 +206,20 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
overlimitService.saveOrUpdate(overlimit); overlimitService.saveOrUpdate(overlimit);
} }
@Override
public void updateRecordData(WlRecordParam.UpdateRecord record) {
LambdaQueryWrapper<WlRecord> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(WlRecord::getId, record.getId());
WlRecord wlRecord = this.getOne(queryWrapper);
if (Objects.isNull(wlRecord)) {
throw new BusinessException("测试项缺失!");
} else {
wlRecord.setStartTime(record.getProStartTime());
wlRecord.setEndTime(record.getProEndTime());
}
this.updateById(wlRecord);
}
@Override @Override
public void updateSchemeRecord(WlRecordParam.UpdateRecord record) { public void updateSchemeRecord(WlRecordParam.UpdateRecord record) {
WlRecord wlRecord = new WlRecord(); WlRecord wlRecord = new WlRecord();
@@ -682,7 +696,7 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
StatisticalDataDTO statisticalDataDTO = commonMapper.getLineRtData(influxQueryWrapper); StatisticalDataDTO statisticalDataDTO = commonMapper.getLineRtData(influxQueryWrapper);
if(Objects.nonNull(statisticalDataDTO)){ if(Objects.nonNull(statisticalDataDTO)){
LocalDateTime endTime = statisticalDataDTO.getTime().atOffset(ZoneOffset.ofHours(0)).toLocalDateTime(); LocalDateTime endTime = statisticalDataDTO.getTime().atOffset(ZoneOffset.ofHours(0)).toLocalDateTime();
Duration duration = Duration.between(now, endTime); Duration duration = Duration.between(endTime,now);
long hour = duration.toHours(); long hour = duration.toHours();
if(hour>6){ if(hour>6){
WlRecord wlRecord = new WlRecord(); WlRecord wlRecord = new WlRecord();

View File

@@ -6,7 +6,6 @@ import lombok.NoArgsConstructor;
import javax.validation.constraints.Min; import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.util.List;
/** /**
* *
@@ -46,7 +45,4 @@ public class CsEventUserQueryPage extends CsEventUserQueryParam{
@ApiModelProperty(value = "测点id") @ApiModelProperty(value = "测点id")
private String lineId; private String lineId;
} }

View File

@@ -45,10 +45,14 @@ public class CsEventUserQueryParam {
private String level; private String level;
@ApiModelProperty(value="起始时间") @ApiModelProperty(value="起始时间")
// @NotNull(message="起始时间不能为空!")
private String startTime; private String startTime;
@ApiModelProperty(value="结束时间") @ApiModelProperty(value="结束时间")
// @NotNull(message="结束时间不能为空!")
private String endTime; private String endTime;
@ApiModelProperty(value = "事件类型 Evt_Sys_DipStr:电压暂降 Evt_Sys_SwlStr:电压暂升 Evt_Sys_IntrStr:电压中断")
private String eventType;
@ApiModelProperty(value = "位置 grid:电网侧 load:负载侧")
private String location;
} }

View File

@@ -140,7 +140,6 @@
AND DATE(b.start_time) &gt;= DATE(#{csEventUserQueryPage.startTime}) AND DATE(b.start_time) &gt;= DATE(#{csEventUserQueryPage.startTime})
</if> </if>
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.target != null and csEventUserQueryPage.target.size()>0"> <if test="csEventUserQueryPage!=null and csEventUserQueryPage.target != null and csEventUserQueryPage.target.size()>0">
and b.tag in and b.tag in
<foreach collection="csEventUserQueryPage.target" index="index" item="item" open="(" separator="," close=")"> <foreach collection="csEventUserQueryPage.target" index="index" item="item" open="(" separator="," close=")">
#{item} #{item}
@@ -160,7 +159,15 @@
</if> </if>
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.level != null and csEventUserQueryPage.level !=''"> <if test="csEventUserQueryPage!=null and csEventUserQueryPage.level != null and csEventUserQueryPage.level !=''">
AND b.level =#{ csEventUserQueryPage.level} AND b.level = #{ csEventUserQueryPage.level}
</if>
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.eventType != null and csEventUserQueryPage.eventType !=''">
AND b.tag = #{csEventUserQueryPage.eventType}
</if>
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.location != null and csEventUserQueryPage.location !=''">
AND b.location = #{csEventUserQueryPage.location}
</if> </if>
order by b.start_time desc order by b.start_time desc
</select> </select>

View File

@@ -243,11 +243,11 @@ public class DataServiceImpl implements IDataService {
unit = "k" + item2.getUnit(); unit = "k" + item2.getUnit();
break; break;
default: default:
re = statisticalDataDTO.getValue(); re = Objects.isNull(statisticalDataDTO) ? 3.14159 : statisticalDataDTO.getValue();
unit = item2.getUnit(); unit = item2.getUnit();
break; break;
} }
vo.setAvgValue(Double.valueOf(df.format(re))); vo.setAvgValue(Objects.equals(re,3.14159) ? 3.14159 : Double.parseDouble(df.format(re)));
}else { }else {
if (Objects.nonNull(statisticalDataDTO)) { if (Objects.nonNull(statisticalDataDTO)) {
re = statisticalDataDTO.getValue(); re = statisticalDataDTO.getValue();
@@ -270,10 +270,10 @@ public class DataServiceImpl implements IDataService {
re = Objects.isNull(statisticalDataDTO) ? 3.14159 : statisticalDataDTO.getValue() / pt / ct / 1000; re = Objects.isNull(statisticalDataDTO) ? 3.14159 : statisticalDataDTO.getValue() / pt / ct / 1000;
break; break;
default: default:
re = statisticalDataDTO.getValue(); re = Objects.isNull(statisticalDataDTO) ? 3.14159 : statisticalDataDTO.getValue();
break; break;
} }
vo.setAvgValue(Double.valueOf(df.format(re))); vo.setAvgValue(Objects.equals(re,3.14159) ? 3.14159 : Double.parseDouble(df.format(re)));
}else { }else {
if (Objects.nonNull(statisticalDataDTO)) { if (Objects.nonNull(statisticalDataDTO)) {
re = statisticalDataDTO.getValue(); re = statisticalDataDTO.getValue();