Commit a0ef9ded by HlQ

[add]

1.添加文件类型32
2.新增创建人、更新人配置
3.mall 列表添加备注字段
1 parent 073b354e
package vion.config.mp;
import cn.dev33.satoken.stp.StpUtil;
import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
......@@ -7,6 +8,7 @@ import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerIntercept
import org.apache.ibatis.reflection.MetaObject;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import vion.vo.UserVO;
import java.time.LocalDateTime;
......@@ -22,12 +24,23 @@ public class MyBatisPlusConfig implements MetaObjectHandler {
this.fillHasGetter(metaObject, "createTime", LocalDateTime.now());
this.fillHasGetter(metaObject, "modifyTime", LocalDateTime.now());
this.fillHasGetter(metaObject, "updateTime", LocalDateTime.now());
try {
// 获取当前登录用户,并填充
var vo = (UserVO) StpUtil.getTokenSession().get("curLoginUser");
this.fillHasGetter(metaObject, "creator", vo.getUserid());
} catch (Exception ignored) {
}
}
@Override
public void updateFill(MetaObject metaObject) {
this.fillHasGetter(metaObject, "modifyTime", LocalDateTime.now());
this.fillHasGetter(metaObject, "updateTime", LocalDateTime.now());
try {
var vo = (UserVO) StpUtil.getTokenSession().get("curLoginUser");
this.fillHasGetter(metaObject, "updater", vo.getUserid());
} catch (Exception ignored) {
}
}
protected void fillHasGetter(MetaObject metaObject, String fieldName, Object fieldVal) {
......
......@@ -128,13 +128,14 @@ public class FileController {
}
private String getPath(FileInfoDTO dto, String filename) {
String path;
if ("storeLog".equals(dto.getFlag())) {
path = fileUrl + FileUtil.FILE_SEPARATOR + "form" + FileUtil.FILE_SEPARATOR + "storeLog" + FileUtil.FILE_SEPARATOR + dto.getStoreId() + FileUtil.FILE_SEPARATOR + dto.getSourceId() + FileUtil.FILE_SEPARATOR + filename;
} else {
path = fileUrl + FileUtil.FILE_SEPARATOR + "form" + FileUtil.FILE_SEPARATOR + dto.getStoreId() + FileUtil.FILE_SEPARATOR + dto.getSourceId() + FileUtil.FILE_SEPARATOR + filename;
}
return path;
return switch (dto.getFlag()) {
case "storeLog" ->
fileUrl + FileUtil.FILE_SEPARATOR + "form" + FileUtil.FILE_SEPARATOR + "storeLog" + FileUtil.FILE_SEPARATOR + dto.getStoreId() + FileUtil.FILE_SEPARATOR + dto.getSourceId() + FileUtil.FILE_SEPARATOR + filename;
case "monitor" ->
fileUrl + FileUtil.FILE_SEPARATOR + "form" + FileUtil.FILE_SEPARATOR + "monitor" + FileUtil.FILE_SEPARATOR + dto.getSourceId() + FileUtil.FILE_SEPARATOR + dto.getSourceId() + FileUtil.FILE_SEPARATOR + filename;
default ->
fileUrl + FileUtil.FILE_SEPARATOR + "form" + FileUtil.FILE_SEPARATOR + dto.getStoreId() + FileUtil.FILE_SEPARATOR + dto.getSourceId() + FileUtil.FILE_SEPARATOR + filename;
};
}
@PostMapping("/file/uploadFile")
......
......@@ -83,7 +83,7 @@ public class MallController {
@SaCheckPermission(value = "mall:remark:list", orRole = "admin")
public Page<RMallRemark> listRemark(RMallRemark dto) {
return mallRemarkService.lambdaQuery(dto)
.orderByDesc(RMallRemark::getCreateTime)
.orderByDesc(RMallRemark::getRemarkDate, RMallRemark::getCreateTime)
.page(Page.of(dto.getPageNum(), dto.getPageSize()));
}
......
......@@ -40,6 +40,7 @@ public class FileInfo {
* <br>21服务单等表单富文本编辑器里传图用这个类型</br>
* <br>22备件,23返修</br>
* <br>24验收报告,25竣工图纸,26点位表,27项目总结,28前期勘察,29巡检报告,30结算资料,31启动会</br>
* <br>32运维监测项目监控里富文本编辑器传图用这个类型</br>
*/
private Integer sourceType;
/**
......
package vion.model.monitor;
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 com.baomidou.mybatisplus.annotation.*;
import lombok.Getter;
import lombok.Setter;
import vion.dto.BaseDTO;
import java.time.LocalDate;
import java.util.Date;
import java.time.LocalDateTime;
/**
* mall注释关联表
......@@ -36,15 +33,15 @@ public class RMallRemark extends BaseDTO {
@TableField(value = "remark")
private String remark;
@TableField(value = "creator")
@TableField(value = "creator", fill = FieldFill.INSERT)
private String creator;
@TableField(value = "updater")
@TableField(value = "updater", fill = FieldFill.INSERT_UPDATE)
private String updater;
@TableField(value = "create_time")
private Date createTime;
@TableField(value = "create_time", fill = FieldFill.INSERT)
private LocalDateTime createTime;
@TableField(value = "update_time")
private Date updateTime;
@TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
private LocalDateTime updateTime;
}
\ No newline at end of file
......@@ -18,15 +18,14 @@ import org.springframework.transaction.annotation.Transactional;
import vion.dto.monitor.MallDTO;
import vion.mapper.monitor.MallMapper;
import vion.model.monitor.*;
import vion.service.monitor.IEventRecordService;
import vion.service.monitor.IMAccountService;
import vion.service.monitor.IMallService;
import vion.service.monitor.IRAgentEventService;
import vion.service.monitor.*;
import vion.utils.JsonUtil;
import vion.utils.TopicUtil;
import vion.vo.monitor.MallVO;
import java.util.Comparator;
import java.util.List;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
......@@ -41,6 +40,7 @@ public class MallServiceImpl extends MPJBaseServiceImpl<MallMapper, Mall> implem
private final IMAccountService accountService;
private final IEventRecordService eventRecordService;
private final IRAgentEventService agentEventService;
private final IRMallRemarkService mallRemarkService;
private final MqttClientTemplate client;
private final Converter converter;
......@@ -104,12 +104,16 @@ public class MallServiceImpl extends MPJBaseServiceImpl<MallMapper, Mall> implem
var eventRecordList = eventRecordService.list(eventRecWrapper);
var mallUid2RecMap = eventRecordList.stream().collect(Collectors.groupingBy(EventRecord::getMallUid));
var remarkList = mallRemarkService.lambdaQuery().in(RMallRemark::getMallUid, mallUidList).list();
var mallUid2RemarkMap = remarkList.stream().sorted(Comparator.comparing(RMallRemark::getRemarkDate).reversed().thenComparing(Comparator.comparing(RMallRemark::getCreateTime).reversed())).collect(Collectors.toMap(RMallRemark::getMallUid, Function.identity(), (r1, r2) -> r1));
var agentEventList = agentEventService.lambdaQuery().in(RAgentEvent::getMallUid, mallUidList).list();
var mallUid2AgentEventMap = agentEventList.stream().collect(Collectors.groupingBy(RAgentEvent::getMallUid));
r.forEach(tmp -> {
tmp.setEventRecordList(mallUid2RecMap.getOrDefault(tmp.getUid(), List.of()));
tmp.setAgentEventList(mallUid2AgentEventMap.getOrDefault(tmp.getUid(), List.of()));
tmp.setMallRemark(mallUid2RemarkMap.get(tmp.getUid()));
});
});
return mallVOPage;
......@@ -146,12 +150,16 @@ public class MallServiceImpl extends MPJBaseServiceImpl<MallMapper, Mall> implem
var eventRecordList = eventRecordService.list(eventRecWrapper);
var mallUid2RecMap = eventRecordList.stream().collect(Collectors.groupingBy(EventRecord::getMallUid));
var remarkList = mallRemarkService.lambdaQuery().in(RMallRemark::getMallUid, mallUidList).list();
var mallUid2RemarkMap = remarkList.stream().sorted(Comparator.comparing(RMallRemark::getRemarkDate).reversed().thenComparing(Comparator.comparing(RMallRemark::getCreateTime).reversed())).collect(Collectors.toMap(RMallRemark::getMallUid, Function.identity(), (r1, r2) -> r1));
var tmpAgentEventList = agentEventService.lambdaQuery().in(RAgentEvent::getMallUid, mallUidList).list();
var mallUid2AgentEventMap = tmpAgentEventList.stream().collect(Collectors.groupingBy(RAgentEvent::getMallUid));
r.forEach(tmp -> {
tmp.setEventRecordList(mallUid2RecMap.getOrDefault(tmp.getUid(), List.of()));
tmp.setAgentEventList(mallUid2AgentEventMap.getOrDefault(tmp.getUid(), List.of()));
tmp.setMallRemark(mallUid2RemarkMap.get(tmp.getUid()));
});
});
return mallVOPage;
......@@ -192,10 +200,14 @@ public class MallServiceImpl extends MPJBaseServiceImpl<MallMapper, Mall> implem
.orderByDesc("mall_uid", "event_type", "create_time");
var tmpEventRecordList = eventRecordService.list(tmpWrapper);
var tmpMallUid2RecMap = tmpEventRecordList.stream().collect(Collectors.groupingBy(EventRecord::getMallUid));
r.forEach(tmp -> {
var remarkList = mallRemarkService.lambdaQuery().in(RMallRemark::getMallUid, mallUidList).list();
var mallUid2RemarkMap = remarkList.stream().sorted(Comparator.comparing(RMallRemark::getRemarkDate).reversed().thenComparing(Comparator.comparing(RMallRemark::getCreateTime).reversed())).collect(Collectors.toMap(RMallRemark::getMallUid, Function.identity(), (r1, r2) -> r1));
r.forEach(tmp -> {
tmp.setEventRecordList(tmpMallUid2RecMap.getOrDefault(tmp.getUid(), List.of()));
tmp.setAgentEventList(mallUid2AgentEventMap.getOrDefault(tmp.getUid(), List.of()));
tmp.setMallRemark(mallUid2RemarkMap.get(tmp.getUid()));
});
});
return mallVOPage;
......
......@@ -4,6 +4,7 @@ import lombok.Getter;
import lombok.Setter;
import vion.model.monitor.EventRecord;
import vion.model.monitor.RAgentEvent;
import vion.model.monitor.RMallRemark;
import java.time.LocalDateTime;
import java.util.List;
......@@ -83,4 +84,6 @@ public class MallVO {
* 主机名
*/
private String hostname;
private RMallRemark mallRemark;
}
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!