plc,故障日志修改
This commit is contained in:
parent
36bcbc0349
commit
fbba27eb92
@ -28,6 +28,7 @@ import com.das.modules.equipment.mapper.SysIotModelMapper;
|
|||||||
import com.das.modules.equipment.mapper.SysIotModelServiceMapper;
|
import com.das.modules.equipment.mapper.SysIotModelServiceMapper;
|
||||||
import com.das.modules.equipment.service.SysIotModelService;
|
import com.das.modules.equipment.service.SysIotModelService;
|
||||||
import com.das.modules.data.service.TDEngineService;
|
import com.das.modules.data.service.TDEngineService;
|
||||||
|
import com.das.modules.record.service.SysRecordLogService;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@ -61,6 +62,9 @@ public class SysIotModelServiceImpl implements SysIotModelService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private DataServiceImpl dataService;
|
private DataServiceImpl dataService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
SysRecordLogService sysRecordLogService;
|
||||||
|
|
||||||
public SysIotModelVo creatSysIotModel(SysIotModelDto sysIotModelDto) {
|
public SysIotModelVo creatSysIotModel(SysIotModelDto sysIotModelDto) {
|
||||||
SysIotModel sysIotModel = new SysIotModel();
|
SysIotModel sysIotModel = new SysIotModel();
|
||||||
BeanCopyUtils.copy(sysIotModelDto, sysIotModel);
|
BeanCopyUtils.copy(sysIotModelDto, sysIotModel);
|
||||||
@ -453,6 +457,7 @@ public class SysIotModelServiceImpl implements SysIotModelService {
|
|||||||
map.put(sysIotModelField.getAttributeCode(), sysIotModelField.getDataType());
|
map.put(sysIotModelField.getAttributeCode(), sysIotModelField.getDataType());
|
||||||
//创建低频超级表
|
//创建低频超级表
|
||||||
tdEngineService.addStableColumn(sysIotModel.getIotModelCode(), "l_", map);
|
tdEngineService.addStableColumn(sysIotModel.getIotModelCode(), "l_", map);
|
||||||
|
sysRecordLogService.createRecordLog("/系统管理/物模型配置","新增低频TD超级表字段"+"表名:l_" +sysIotModel.getIotModelCode()+",字段:"+map);
|
||||||
addModelFieldCache(lowCreateList.get(i));
|
addModelFieldCache(lowCreateList.get(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -468,6 +473,7 @@ public class SysIotModelServiceImpl implements SysIotModelService {
|
|||||||
map.put(sysIotModelField.getAttributeCode(), sysIotModelField.getDataType());
|
map.put(sysIotModelField.getAttributeCode(), sysIotModelField.getDataType());
|
||||||
//创建高频超级表
|
//创建高频超级表
|
||||||
tdEngineService.addStableColumn(sysIotModel.getIotModelCode(), "h_", map);
|
tdEngineService.addStableColumn(sysIotModel.getIotModelCode(), "h_", map);
|
||||||
|
sysRecordLogService.createRecordLog("/系统管理/物模型配置","新增低频TD超级表字段"+"表名:h_" +sysIotModel.getIotModelCode()+",字段:"+map);
|
||||||
addModelFieldCache(highCreateList.get(i));
|
addModelFieldCache(highCreateList.get(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -535,6 +541,7 @@ public class SysIotModelServiceImpl implements SysIotModelService {
|
|||||||
if (sysIotModelField.getAttributeType() == 199) {
|
if (sysIotModelField.getAttributeType() == 199) {
|
||||||
String modelCode = dataService.iotModelMap.get(sysIotModelField.getIotModelId().toString());
|
String modelCode = dataService.iotModelMap.get(sysIotModelField.getIotModelId().toString());
|
||||||
tdEngineService.createCalStable(modelCode, sysIotModelField.getAttributeCode(), sysIotModelField.getDataType());
|
tdEngineService.createCalStable(modelCode, sysIotModelField.getAttributeCode(), sysIotModelField.getDataType());
|
||||||
|
sysRecordLogService.createRecordLog("/系统管理/物模型配置","创建计算超级表"+"c_" + modelCode + "_" + sysIotModelField.getAttributeCode());
|
||||||
} else {
|
} else {
|
||||||
//创建type为138 139 140的超级表
|
//创建type为138 139 140的超级表
|
||||||
//如果新增的是第一条记录 创建tdengine超级表 分为高频和低频
|
//如果新增的是第一条记录 创建tdengine超级表 分为高频和低频
|
||||||
@ -549,6 +556,7 @@ public class SysIotModelServiceImpl implements SysIotModelService {
|
|||||||
map.put(sysIotModelField.getAttributeCode(), sysIotModelField.getDataType());
|
map.put(sysIotModelField.getAttributeCode(), sysIotModelField.getDataType());
|
||||||
//创建低频超级表
|
//创建低频超级表
|
||||||
tdEngineService.createStable(sysIotModel.getIotModelCode(), "l_", map);
|
tdEngineService.createStable(sysIotModel.getIotModelCode(), "l_", map);
|
||||||
|
sysRecordLogService.createRecordLog("/系统管理/物模型配置","创建低频TD超级表"+"l_" +sysIotModel.getIotModelCode());
|
||||||
}
|
}
|
||||||
if (sysIotModelField.getHighSpeed() == 1) {
|
if (sysIotModelField.getHighSpeed() == 1) {
|
||||||
SysIotModel sysIotModel = sysIotModelMapper.selectById(sysIotModelField.getIotModelId());
|
SysIotModel sysIotModel = sysIotModelMapper.selectById(sysIotModelField.getIotModelId());
|
||||||
@ -556,6 +564,7 @@ public class SysIotModelServiceImpl implements SysIotModelService {
|
|||||||
map.put(sysIotModelField.getAttributeCode(), sysIotModelField.getDataType());
|
map.put(sysIotModelField.getAttributeCode(), sysIotModelField.getDataType());
|
||||||
//创建高频超级表
|
//创建高频超级表
|
||||||
tdEngineService.createStable(sysIotModel.getIotModelCode(), "h_", map);
|
tdEngineService.createStable(sysIotModel.getIotModelCode(), "h_", map);
|
||||||
|
sysRecordLogService.createRecordLog("/系统管理/物模型配置","创建高频TD超级表"+"h_" +sysIotModel.getIotModelCode());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//stable已经存在,新增stable列
|
//stable已经存在,新增stable列
|
||||||
@ -565,6 +574,7 @@ public class SysIotModelServiceImpl implements SysIotModelService {
|
|||||||
map.put(sysIotModelField.getAttributeCode(), sysIotModelField.getDataType());
|
map.put(sysIotModelField.getAttributeCode(), sysIotModelField.getDataType());
|
||||||
//创建低频超级表
|
//创建低频超级表
|
||||||
tdEngineService.addStableColumn(sysIotModel.getIotModelCode(), "l_", map);
|
tdEngineService.addStableColumn(sysIotModel.getIotModelCode(), "l_", map);
|
||||||
|
sysRecordLogService.createRecordLog("/系统管理/物模型配置","新增低频TD超级表字段"+"表名:l_" +sysIotModel.getIotModelCode()+",字段:"+map);
|
||||||
}
|
}
|
||||||
if (sysIotModelField.getHighSpeed() == 1) {
|
if (sysIotModelField.getHighSpeed() == 1) {
|
||||||
SysIotModel sysIotModel = sysIotModelMapper.selectById(sysIotModelField.getIotModelId());
|
SysIotModel sysIotModel = sysIotModelMapper.selectById(sysIotModelField.getIotModelId());
|
||||||
@ -572,6 +582,7 @@ public class SysIotModelServiceImpl implements SysIotModelService {
|
|||||||
map.put(sysIotModelField.getAttributeCode(), sysIotModelField.getDataType());
|
map.put(sysIotModelField.getAttributeCode(), sysIotModelField.getDataType());
|
||||||
//创建高频超级表
|
//创建高频超级表
|
||||||
tdEngineService.addStableColumn(sysIotModel.getIotModelCode(), "h_", map);
|
tdEngineService.addStableColumn(sysIotModel.getIotModelCode(), "h_", map);
|
||||||
|
sysRecordLogService.createRecordLog("/系统管理/物模型配置","新增高频TD超级表字段"+"表名:h_" +sysIotModel.getIotModelCode()+",字段:"+map);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -587,6 +598,7 @@ public class SysIotModelServiceImpl implements SysIotModelService {
|
|||||||
Long iotModelId = sysIotModelField.getIotModelId();
|
Long iotModelId = sysIotModelField.getIotModelId();
|
||||||
String modelCode = dataService.iotModelMap.get(iotModelId.toString());
|
String modelCode = dataService.iotModelMap.get(iotModelId.toString());
|
||||||
tdEngineService.deleteStable("c_" + modelCode + "_" + sysIotModelField.getAttributeCode());
|
tdEngineService.deleteStable("c_" + modelCode + "_" + sysIotModelField.getAttributeCode());
|
||||||
|
sysRecordLogService.createRecordLog("/系统管理/物模型配置","删除TD超级表"+"c_" + modelCode + "_" + sysIotModelField.getAttributeCode());
|
||||||
} else {
|
} else {
|
||||||
String stableName = null;
|
String stableName = null;
|
||||||
SysIotModel sysIotModel = sysIotModelMapper.selectById(sysIotModelField.getIotModelId());
|
SysIotModel sysIotModel = sysIotModelMapper.selectById(sysIotModelField.getIotModelId());
|
||||||
@ -602,10 +614,12 @@ public class SysIotModelServiceImpl implements SysIotModelService {
|
|||||||
List<SysIotModelField> sysIotModelFields = sysIotModelFieldMapper.selectList(queryWrapper);
|
List<SysIotModelField> sysIotModelFields = sysIotModelFieldMapper.selectList(queryWrapper);
|
||||||
if (CollectionUtils.isNotEmpty(sysIotModelFields) && sysIotModelFields.size() > 1) {
|
if (CollectionUtils.isNotEmpty(sysIotModelFields) && sysIotModelFields.size() > 1) {
|
||||||
tdEngineService.deleteColumn(stableName, sysIotModelField.getAttributeCode());
|
tdEngineService.deleteColumn(stableName, sysIotModelField.getAttributeCode());
|
||||||
|
sysRecordLogService.createRecordLog("/系统管理/物模型配置","删除TD超级表"+ stableName +"中字段:"+ sysIotModelField.getAttributeCode());
|
||||||
}
|
}
|
||||||
//物模型属性只剩下最后一个删除表
|
//物模型属性只剩下最后一个删除表
|
||||||
if (CollectionUtils.isNotEmpty(sysIotModelFields) && sysIotModelFields.size() == 1) {
|
if (CollectionUtils.isNotEmpty(sysIotModelFields) && sysIotModelFields.size() == 1) {
|
||||||
tdEngineService.deleteStable(stableName);
|
tdEngineService.deleteStable(stableName);
|
||||||
|
sysRecordLogService.createRecordLog("/系统管理/物模型配置","删除TD超级表"+ stableName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ public class FaultRecorderController {
|
|||||||
String code = jsonObject.getString("deviceCode");
|
String code = jsonObject.getString("deviceCode");
|
||||||
String startTime = jsonObject.getString("startTime");
|
String startTime = jsonObject.getString("startTime");
|
||||||
String endTime = jsonObject.getString("endTime");
|
String endTime = jsonObject.getString("endTime");
|
||||||
List<FileNode> result = faultRecorderService.getDirOrFileList("故障录波",code,startTime,endTime);
|
List<FileNode> result = faultRecorderService.getDirOrFileList("Tracelog",code,startTime,endTime);
|
||||||
return R.success(result);
|
return R.success(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,9 +135,9 @@ public class MinioViewsServcie {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
if (StringUtils.isBlank(directoryName)) {
|
if (StringUtils.isBlank(directoryName)) {
|
||||||
build = ListObjectsArgs.builder().bucket(minioProperties.getBucket()).recursive(false).build();
|
build = ListObjectsArgs.builder().bucket(minioProperties.getBucket()).recursive(true).build();
|
||||||
} else {
|
} else {
|
||||||
build = ListObjectsArgs.builder().bucket(minioProperties.getBucket()).prefix(directoryName+"/").recursive(false).build();
|
build = ListObjectsArgs.builder().bucket(minioProperties.getBucket()).prefix(directoryName+"/").recursive(true).build();
|
||||||
}
|
}
|
||||||
Iterable<Result<Item>> results = minioClient.listObjects(build);
|
Iterable<Result<Item>> results = minioClient.listObjects(build);
|
||||||
for (Result<Item> result : results) {
|
for (Result<Item> result : results) {
|
||||||
@ -161,7 +161,7 @@ public class MinioViewsServcie {
|
|||||||
lastModifyTime = zonedDateTime.format(dateFormat);
|
lastModifyTime = zonedDateTime.format(dateFormat);
|
||||||
}
|
}
|
||||||
if (parts.length > 0) {
|
if (parts.length > 0) {
|
||||||
String nodeName = parts[1];
|
String nodeName = parts[2];
|
||||||
int type = isDir ? 0 : 1;
|
int type = isDir ? 0 : 1;
|
||||||
itemName= isDir ? itemName.substring(0,itemName.lastIndexOf("/")) : itemName;
|
itemName= isDir ? itemName.substring(0,itemName.lastIndexOf("/")) : itemName;
|
||||||
FileNode node = new FileNode(nodeName, type,size,lastModifyTime,"/"+itemName);
|
FileNode node = new FileNode(nodeName, type,size,lastModifyTime,"/"+itemName);
|
||||||
|
@ -44,7 +44,7 @@ public class PlcLogsController {
|
|||||||
String code = jsonObject.getString("deviceCode");
|
String code = jsonObject.getString("deviceCode");
|
||||||
String startTime = jsonObject.getString("startTime");
|
String startTime = jsonObject.getString("startTime");
|
||||||
String endTime = jsonObject.getString("endTime");
|
String endTime = jsonObject.getString("endTime");
|
||||||
List<FileNode> result = plcLogService.getDirOrFileList("日志",code,startTime,endTime);
|
List<FileNode> result = plcLogService.getDirOrFileList("Statuscode",code,startTime,endTime);
|
||||||
return R.success(result);
|
return R.success(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,40 @@
|
|||||||
|
package com.das.modules.record.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@TableName("sys_record_log")
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class SysRecordLog {
|
||||||
|
@TableId(value = "id", type = IdType.ASSIGN_ID)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@TableField("user_id")
|
||||||
|
private String userId;
|
||||||
|
|
||||||
|
@TableField("user_name")
|
||||||
|
private String username;
|
||||||
|
|
||||||
|
@TableField("group_by")
|
||||||
|
private String groupBy;
|
||||||
|
|
||||||
|
@TableField("ip_address")
|
||||||
|
private String ipAddress;
|
||||||
|
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@TableField("opt_time")
|
||||||
|
private Date optTime;
|
||||||
|
|
||||||
|
@TableField("opt_desc")
|
||||||
|
private String optDesc;
|
||||||
|
}
|
@ -0,0 +1,10 @@
|
|||||||
|
package com.das.modules.record.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.das.modules.record.domain.SysRecordLog;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface SysRecordLogMapper extends BaseMapper<SysRecordLog> {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
package com.das.modules.record.service;
|
||||||
|
|
||||||
|
public interface SysRecordLogService {
|
||||||
|
|
||||||
|
void createRecordLog(String group, String desc);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
package com.das.modules.record.service.impl;
|
||||||
|
|
||||||
|
import cn.dev33.satoken.stp.StpUtil;
|
||||||
|
import com.das.common.config.SessionUtil;
|
||||||
|
import com.das.modules.auth.domain.vo.SysUserVo;
|
||||||
|
import com.das.modules.plc.mapper.SysRunLogDescMapper;
|
||||||
|
import com.das.modules.record.domain.SysRecordLog;
|
||||||
|
import com.das.modules.record.mapper.SysRecordLogMapper;
|
||||||
|
import com.das.modules.record.service.SysRecordLogService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class SysRecordLogServiceImpl implements SysRecordLogService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysRecordLogMapper sysRecordLogMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void createRecordLog(String group, String desc) {
|
||||||
|
SysRecordLog sysRecordLog = new SysRecordLog();
|
||||||
|
SysUserVo sysUserVo = (SysUserVo) StpUtil.getTokenSession().get(SessionUtil.SESSION_USER_KEY);
|
||||||
|
sysRecordLog.setUsername(sysUserVo.getAccount());
|
||||||
|
sysRecordLog.setUserId(sysUserVo.getAccount());
|
||||||
|
sysRecordLog.setOptTime(new Date());
|
||||||
|
sysRecordLog.setGroupBy(group);
|
||||||
|
sysRecordLog.setOptDesc(desc);
|
||||||
|
sysRecordLogMapper.insert(sysRecordLog);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user