Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f754cf61c4 | |||
| e32e820417 | |||
| 158917f2bc | |||
| 2df06d9597 | |||
| 81da6e54ca | |||
| 1f4e8c7e25 | |||
| f90a3228b9 |
@@ -46,7 +46,7 @@ public interface WlRecordFeignClient {
|
||||
HttpResult<Boolean> updateTestRecord(@RequestBody @Validated WlRecordParam.UpdateRecord record);
|
||||
|
||||
|
||||
@GetMapping("/dayDealNoEndTimeEvent")
|
||||
@PostMapping("/dayDealNoEndTimeEvent")
|
||||
void dayDealNoEndTimeEvent(@RequestParam("date") String date);
|
||||
|
||||
@GetMapping("/getWlAssByWlId")
|
||||
|
||||
@@ -47,7 +47,8 @@ public class CsDevModelQueryParm {
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
||||
private String versionEndDate;
|
||||
|
||||
@ApiModelProperty(value = "装置型号")
|
||||
private String devType;
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
package com.njcn.csdevice.pojo.param;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Pattern;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -35,7 +32,7 @@ public class CsEquipmentDeliveryAddParm{
|
||||
*/
|
||||
@ApiModelProperty(value="网络设备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;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.njcn.csdevice.pojo.param;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@@ -34,9 +35,11 @@ public class WlRecordParam {
|
||||
private String lineId;
|
||||
|
||||
@ApiModelProperty("项目起始时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime proStartTime;
|
||||
|
||||
@ApiModelProperty("项目结束时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime proEndTime;
|
||||
|
||||
@ApiModelProperty("测试项名称")
|
||||
|
||||
@@ -107,6 +107,14 @@ public class EquipmentDeliveryController extends BaseController {
|
||||
public HttpResult<Boolean> updateEquipmentDelivery(@RequestBody @Validated CsEquipmentDeliveryAuditParm csEquipmentDeliveryAuditParm ){
|
||||
String methodDescribe = getMethodDescribe("updateEquipmentDelivery");
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@@ -127,6 +127,20 @@ public class WlRecordController extends BaseController {
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增或修改方案
|
||||
*/
|
||||
|
||||
@@ -33,13 +33,10 @@
|
||||
</if>
|
||||
|
||||
<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 test="csDevModelQueryParm.devType != null and csDevModelQueryParm.devType != ''">-->
|
||||
<!-- AND a.dev_type = #{csDevModelQueryParm.devType}-->
|
||||
<!-- </if>-->
|
||||
<if test="csDevModelQueryParm.name != null and csDevModelQueryParm.name != ''">
|
||||
AND a.name = #{csDevModelQueryParm.name}
|
||||
AND a.name LIKE concat('%',#{csDevModelQueryParm.name},'%')
|
||||
</if>
|
||||
order by a.version_date desc
|
||||
</select>
|
||||
|
||||
@@ -63,6 +63,8 @@ public interface IWlRecordService extends IService<WlRecord> {
|
||||
*/
|
||||
void updateTestRecord(WlRecordParam.UpdateRecord record);
|
||||
|
||||
void updateRecordData(WlRecordParam.UpdateRecord record);
|
||||
|
||||
/**
|
||||
* 新增或修改方案
|
||||
* @param record
|
||||
|
||||
@@ -1,37 +1,32 @@
|
||||
package com.njcn.csdevice.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.alibaba.nacos.shaded.com.google.gson.Gson;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.csdevice.mapper.CsDevModelMapper;
|
||||
import com.njcn.csdevice.pojo.dto.CsDevModelDto;
|
||||
import com.njcn.csdevice.pojo.param.CsDevModelAddParm;
|
||||
import com.njcn.csdevice.pojo.param.CsDevModelAuditParm;
|
||||
import com.njcn.csdevice.pojo.param.CsDevModelQueryListParm;
|
||||
import com.njcn.csdevice.pojo.param.CsDevModelQueryParm;
|
||||
import com.njcn.csdevice.pojo.po.CsDataArray;
|
||||
import com.njcn.csdevice.pojo.po.CsDataSet;
|
||||
import com.njcn.csdevice.pojo.po.CsDevModelPO;
|
||||
import com.njcn.csdevice.pojo.vo.CsDevModelPageVO;
|
||||
import com.njcn.csdevice.service.CsDevModelService;
|
||||
import com.njcn.csdevice.service.ICsDataArrayService;
|
||||
import com.njcn.csdevice.service.ICsDataSetService;
|
||||
import com.njcn.redis.pojo.enums.AppRedisKey;
|
||||
import com.njcn.redis.utils.RedisUtil;
|
||||
import com.njcn.system.api.DictTreeFeignClient;
|
||||
import com.njcn.system.pojo.po.SysDicTreePO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.sql.Date;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -50,6 +45,7 @@ public class CsDevModelServiceImpl extends ServiceImpl<CsDevModelMapper, CsDevMo
|
||||
private final ICsDataSetService csDataSetService;
|
||||
private final ICsDataArrayService csDataArrayService;
|
||||
private final RedisUtil redisUtil;
|
||||
private final DictTreeFeignClient dictTreeFeignClient;
|
||||
|
||||
@Override
|
||||
public void refreshDevModelCache() {
|
||||
@@ -128,7 +124,14 @@ public class CsDevModelServiceImpl extends ServiceImpl<CsDevModelMapper, CsDevMo
|
||||
@Override
|
||||
public IPage<CsDevModelPageVO> queryPage(CsDevModelQueryParm csDevModelQueryParm) {
|
||||
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);
|
||||
return returnpage;
|
||||
}
|
||||
|
||||
@@ -238,7 +238,11 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
if (countByAccount >= 1) {
|
||||
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)){
|
||||
throw new BusinessException ("设备名称不能重复");
|
||||
}
|
||||
@@ -449,6 +453,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
//第一个sheet为台账信息
|
||||
params.setStartSheetIndex(0);
|
||||
params.setSheetNum(1);
|
||||
String regex = "^[A-Za-z0-9]{6,32}$";
|
||||
try {
|
||||
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++) {
|
||||
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 ( ));
|
||||
if(!Objects.isNull (po)){
|
||||
DeviceExcelTemplete.IllegalityDeviceExcelTemplete idlegalityDeviceException = new DeviceExcelTemplete.IllegalityDeviceExcelTemplete();
|
||||
|
||||
@@ -206,6 +206,20 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
||||
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
|
||||
public void updateSchemeRecord(WlRecordParam.UpdateRecord record) {
|
||||
WlRecord wlRecord = new WlRecord();
|
||||
@@ -682,7 +696,7 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
||||
StatisticalDataDTO statisticalDataDTO = commonMapper.getLineRtData(influxQueryWrapper);
|
||||
if(Objects.nonNull(statisticalDataDTO)){
|
||||
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();
|
||||
if(hour>6){
|
||||
WlRecord wlRecord = new WlRecord();
|
||||
|
||||
@@ -6,7 +6,6 @@ import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -46,7 +45,4 @@ public class CsEventUserQueryPage extends CsEventUserQueryParam{
|
||||
|
||||
@ApiModelProperty(value = "测点id")
|
||||
private String lineId;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -45,10 +45,14 @@ public class CsEventUserQueryParam {
|
||||
|
||||
private String level;
|
||||
@ApiModelProperty(value="起始时间")
|
||||
// @NotNull(message="起始时间不能为空!")
|
||||
private String startTime;
|
||||
|
||||
@ApiModelProperty(value="结束时间")
|
||||
// @NotNull(message="结束时间不能为空!")
|
||||
private String endTime;
|
||||
|
||||
@ApiModelProperty(value = "事件类型 Evt_Sys_DipStr:电压暂降 Evt_Sys_SwlStr:电压暂升 Evt_Sys_IntrStr:电压中断")
|
||||
private String eventType;
|
||||
|
||||
@ApiModelProperty(value = "位置 grid:电网侧 load:负载侧")
|
||||
private String location;
|
||||
}
|
||||
@@ -140,7 +140,6 @@
|
||||
AND DATE(b.start_time) >= DATE(#{csEventUserQueryPage.startTime})
|
||||
</if>
|
||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.target != null and csEventUserQueryPage.target.size()>0">
|
||||
|
||||
and b.tag in
|
||||
<foreach collection="csEventUserQueryPage.target" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
@@ -160,7 +159,15 @@
|
||||
|
||||
</if>
|
||||
<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>
|
||||
order by b.start_time desc
|
||||
</select>
|
||||
|
||||
@@ -243,11 +243,11 @@ public class DataServiceImpl implements IDataService {
|
||||
unit = "k" + item2.getUnit();
|
||||
break;
|
||||
default:
|
||||
re = statisticalDataDTO.getValue();
|
||||
re = Objects.isNull(statisticalDataDTO) ? 3.14159 : statisticalDataDTO.getValue();
|
||||
unit = item2.getUnit();
|
||||
break;
|
||||
}
|
||||
vo.setAvgValue(Double.valueOf(df.format(re)));
|
||||
vo.setAvgValue(Objects.equals(re,3.14159) ? 3.14159 : Double.parseDouble(df.format(re)));
|
||||
}else {
|
||||
if (Objects.nonNull(statisticalDataDTO)) {
|
||||
re = statisticalDataDTO.getValue();
|
||||
@@ -270,10 +270,10 @@ public class DataServiceImpl implements IDataService {
|
||||
re = Objects.isNull(statisticalDataDTO) ? 3.14159 : statisticalDataDTO.getValue() / pt / ct / 1000;
|
||||
break;
|
||||
default:
|
||||
re = statisticalDataDTO.getValue();
|
||||
re = Objects.isNull(statisticalDataDTO) ? 3.14159 : statisticalDataDTO.getValue();
|
||||
break;
|
||||
}
|
||||
vo.setAvgValue(Double.valueOf(df.format(re)));
|
||||
vo.setAvgValue(Objects.equals(re,3.14159) ? 3.14159 : Double.parseDouble(df.format(re)));
|
||||
}else {
|
||||
if (Objects.nonNull(statisticalDataDTO)) {
|
||||
re = statisticalDataDTO.getValue();
|
||||
|
||||
Reference in New Issue
Block a user