zbj//1.终端修改操作修改监测点信息写入日志
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
package com.njcn.device.pq.pojo.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.njcn.db.bo.BaseEntity;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author hongawen
|
||||
* @since 2023-04-12
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@TableName("pqs_terminal_logs")
|
||||
public class PqsTerminalLogs extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 终端运维日志Id
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 装置或监测点Id
|
||||
*/
|
||||
private String objIndex;
|
||||
|
||||
/**
|
||||
* 运维日志类型Id
|
||||
*/
|
||||
private String terminalType;
|
||||
|
||||
/**
|
||||
* 内容
|
||||
*/
|
||||
private String terminalDescribe;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 更新用户
|
||||
*/
|
||||
private String updateBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 创建用户
|
||||
*/
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 状态 0-删除;1-正常;默认正常
|
||||
*/
|
||||
private Integer state;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.njcn.device.pq.mapper;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.device.pq.pojo.po.PqsTerminalLogs;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author hongawen
|
||||
* @since 2023-04-12
|
||||
*/
|
||||
public interface PqsTerminalLogsMapper extends BaseMapper<PqsTerminalLogs> {
|
||||
|
||||
void InsertLog(PqsTerminalLogs terminalLogsNew);
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.njcn.device.pq.mapper;
|
||||
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author zbj
|
||||
* @since 2023-04-12
|
||||
*/
|
||||
public interface UserMapper {
|
||||
Map<String, Object> getUser(@Param("userId") String userId);
|
||||
Map<String,Object> getPointSuper(@Param("id") String id);
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?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.device.pq.mapper.PqsTerminalLogsMapper">
|
||||
|
||||
<insert id="InsertLog">
|
||||
INSERT INTO pqs_terminal_logs(`Obj_Index`,
|
||||
`Terminal_Type`,
|
||||
`Terminal_Describe`,
|
||||
`Create_Time`,
|
||||
`Create_By`,
|
||||
`State`)
|
||||
VALUES (#{objIndex},
|
||||
(SELECT Id
|
||||
FROM `sys_dict_data`
|
||||
WHERE `Code` = 'Line_Parameter'),
|
||||
#{terminalDescribe},
|
||||
now(),
|
||||
#{createBy},
|
||||
1
|
||||
)
|
||||
</insert>
|
||||
</mapper>
|
||||
@@ -0,0 +1,23 @@
|
||||
<?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.device.pq.mapper.UserMapper">
|
||||
|
||||
<select id="getUser" resultType="java.util.Map">
|
||||
SELECT `Name` as "name",Login_Name as "loginName"
|
||||
FROM `sys_user` where id = #{userId}
|
||||
</select>
|
||||
|
||||
<select id="getPointSuper" resultType="java.util.Map">
|
||||
SELECT pl.`Name` AS "mName",
|
||||
pl1.`Name` AS "pName",
|
||||
pl2.`Name` AS "devName",
|
||||
pl3.`Name` AS "subName",
|
||||
pl4.`Name` AS "urbanName"
|
||||
FROM pq_line pl
|
||||
LEFT JOIN pq_line pl1 ON pl.Pid = pl1.Id
|
||||
LEFT JOIN pq_line pl2 ON pl1.Pid = pl2.Id
|
||||
LEFT JOIN pq_line pl3 ON pl2.Pid = pl3.Id
|
||||
LEFT JOIN pq_line pl4 ON pl3.Pid = pl4.Id
|
||||
WHERE pl.Id = #{id}
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.njcn.device.pq.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.device.pq.pojo.po.PqsTerminalLogs;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author hongawen
|
||||
* @since 2023-04-12
|
||||
*/
|
||||
public interface IPqsTerminalLogsService extends IService<PqsTerminalLogs> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.njcn.device.pq.service.impl;
|
||||
|
||||
import com.njcn.device.pq.mapper.PqsTerminalLogsMapper;
|
||||
import com.njcn.device.pq.pojo.po.PqsTerminalLogs;
|
||||
import com.njcn.device.pq.service.IPqsTerminalLogsService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author hongawen
|
||||
* @since 2023-04-12
|
||||
*/
|
||||
@Service
|
||||
public class PqsTerminalLogsServiceImpl extends ServiceImpl<PqsTerminalLogsMapper, PqsTerminalLogs> implements IPqsTerminalLogsService {
|
||||
|
||||
}
|
||||
@@ -27,28 +27,27 @@ import com.njcn.device.pq.pojo.bo.excel.NodeExcel;
|
||||
import com.njcn.device.pq.pojo.bo.excel.OracleTerminalExcel;
|
||||
import com.njcn.device.pq.pojo.bo.excel.OverLimitExcel;
|
||||
import com.njcn.device.pq.pojo.bo.excel.TerminalBaseExcel;
|
||||
import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO;
|
||||
import com.njcn.device.pq.pojo.param.*;
|
||||
import com.njcn.device.pq.pojo.po.*;
|
||||
import com.njcn.device.pq.pojo.vo.*;
|
||||
import com.njcn.device.pq.service.DeviceBakService;
|
||||
import com.njcn.device.pq.service.INodeService;
|
||||
import com.njcn.device.pq.service.LineBakService;
|
||||
import com.njcn.device.pq.service.TerminalBaseService;
|
||||
import com.njcn.device.pq.service.*;
|
||||
import com.njcn.device.pq.utils.DeviceUtil;
|
||||
import com.njcn.device.pq.utils.ExcelStyleUtil;
|
||||
import com.njcn.poi.excel.ExcelUtil;
|
||||
import com.njcn.poi.util.PoiUtil;
|
||||
import com.njcn.system.api.AreaFeignClient;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.system.enums.DicDataTypeEnum;
|
||||
import com.njcn.system.pojo.po.Area;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import com.njcn.web.utils.RequestUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
@@ -73,6 +72,10 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
||||
|
||||
private final DeviceMapper deviceMapper;
|
||||
|
||||
private final UserMapper userMapper;
|
||||
|
||||
private final IPqsTerminalLogsService iPqsTerminalLogsService;
|
||||
|
||||
private final LineMapper lineMapper;
|
||||
|
||||
private final DevFuctionMapper devFuctionMapper;
|
||||
@@ -98,7 +101,6 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
||||
private final DeviceBakService deviceBakService;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 终端新增操作
|
||||
*
|
||||
@@ -696,6 +698,14 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
||||
Overlimit overlimit = new Overlimit(line.getId(), scaleResult.getData().getValue(), lineDetail.getShortCapacity(), lineDetail.getStandardCapacity(), lineDetail.getDealCapacity(), lineDetail.getDevCapacity());
|
||||
overlimitMapper.insert(overlimit);
|
||||
}
|
||||
//todo 插入日志
|
||||
String userId = RequestUtil.getUserIndex();
|
||||
//String userId = "5dd232f9a70c49c58d2f9e7f69776394";
|
||||
Map<String, Object> map = userMapper.getUser(userId);
|
||||
String userName = map.get("name").toString();
|
||||
String loginName = map.get("loginName").toString();
|
||||
LineDetail lineDetailResOld = lineDetailMapper.selectById(lineId);
|
||||
queryUpdateAndInsertLog(userName, loginName, lineDetailRes, lineDetailResOld);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -705,6 +715,68 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询监测点信息修改处,并新增日志
|
||||
*
|
||||
* @param userName
|
||||
* @param newLine
|
||||
* @param oldLine
|
||||
* @return
|
||||
*/
|
||||
@Async
|
||||
public void queryUpdateAndInsertLog(String userName, String loginName, LineDetail newLine, LineDetail oldLine) {
|
||||
Map<String, Object> map = userMapper.getPointSuper(newLine.getId());
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(userName).append("修改了").append(map.get("urbanName")).append(" - ")
|
||||
.append(map.get("subName")).append(" - ").append(map.get("devName")).append(" - ").append(map.get("pName"))
|
||||
.append(" - ").append(map.get("mName")).append(" - 监测点的参数;");
|
||||
StringBuilder sbNew = new StringBuilder();
|
||||
StringBuilder sbOld = new StringBuilder();
|
||||
sbNew.append("操作历史,");
|
||||
sbOld.append("修改后参数,");
|
||||
//pt变化
|
||||
if (!Objects.equals(newLine.getPt1(), oldLine.getPt1()) || !Objects.equals(newLine.getPt2(), oldLine.getPt2())) {
|
||||
sbNew.append("pt变比: ").append(newLine.getPt1()).append(" : ").append(newLine.getPt2()).append(";");
|
||||
sbOld.append("pt变比: ").append(oldLine.getPt1()).append(" : ").append(oldLine.getPt2()).append(";");
|
||||
}
|
||||
//ct变化
|
||||
if (!Objects.equals(newLine.getCt1(), oldLine.getCt1()) || !Objects.equals(newLine.getCt2(), oldLine.getCt2())) {
|
||||
sbNew.append("ct变比: ").append(newLine.getCt1()).append(" : ").append(newLine.getCt2()).append(";");
|
||||
sbOld.append("ct变比: ").append(oldLine.getCt1()).append(" : ").append(oldLine.getCt2()).append(";");
|
||||
}
|
||||
//设备容量
|
||||
if (!Objects.equals(newLine.getDealCapacity(), oldLine.getDealCapacity())) {
|
||||
sbNew.append("设备容量: ").append(newLine.getDealCapacity()).append(";");
|
||||
sbOld.append("设备容量: ").append(oldLine.getDealCapacity()).append(";");
|
||||
}
|
||||
//短路容量
|
||||
if (!Objects.equals(newLine.getShortCapacity(), oldLine.getShortCapacity())) {
|
||||
sbNew.append("短路容量: ").append(newLine.getShortCapacity()).append(";");
|
||||
sbOld.append("短路容量: ").append(oldLine.getShortCapacity()).append(";");
|
||||
}
|
||||
//基准容量
|
||||
if (!Objects.equals(newLine.getStandardCapacity(), oldLine.getStandardCapacity())) {
|
||||
sbNew.append("基准容量: ").append(newLine.getStandardCapacity()).append(";");
|
||||
sbOld.append("基准容量: ").append(oldLine.getStandardCapacity()).append(";");
|
||||
}
|
||||
//协议容量
|
||||
if (!Objects.equals(newLine.getDealCapacity(), oldLine.getDealCapacity())) {
|
||||
sbNew.append("协议容量: ").append(newLine.getDealCapacity()).append(";");
|
||||
sbOld.append("协议容量: ").append(oldLine.getDealCapacity()).append(";");
|
||||
}
|
||||
sb.append(sbNew).append(sbOld);
|
||||
HttpResult<DictData> dicDataByCode = dicDataFeignClient.getDicDataByCode(DicDataEnum.LINE_PARAMETER.getCode());
|
||||
DictData data = dicDataByCode.getData();
|
||||
//创建对象
|
||||
PqsTerminalLogs terminalLogsNew = new PqsTerminalLogs();
|
||||
terminalLogsNew.setObjIndex(newLine.getId());
|
||||
terminalLogsNew.setTerminalDescribe(sb.toString());
|
||||
terminalLogsNew.setCreateBy(loginName);
|
||||
terminalLogsNew.setCreateTime(LocalDateTime.now());
|
||||
terminalLogsNew.setTerminalType(data.getId());
|
||||
terminalLogsNew.setState(1);
|
||||
iPqsTerminalLogsService.save(terminalLogsNew);
|
||||
}
|
||||
|
||||
/**
|
||||
* 终端查询操作
|
||||
|
||||
@@ -302,6 +302,11 @@ public enum DicDataEnum {
|
||||
*/
|
||||
TRANS_BUSINESS("运检业务","Trans_Business"),
|
||||
|
||||
/**
|
||||
* 日志字典类型
|
||||
*/
|
||||
LINE_PARAMETER("监测点参数修改","Line_Parameter"),
|
||||
|
||||
/**
|
||||
* 接线方式
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user