Commit a0ef9ded by HlQ

[add]

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