资料中心-行为日志分析
parent
5c8f2bf8f7
commit
4e58af3753
|
|
@ -78,6 +78,6 @@ public class DocCenterController extends AbstractCommonFileController {
|
|||
|
||||
@Override
|
||||
public String getGroupId() {
|
||||
return "doccenter";
|
||||
return "zzzx";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,39 @@
|
|||
package com.gunshi.project.ss.controller;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.gunshi.core.result.R;
|
||||
import com.gunshi.project.ss.entity.so.DocOperateLogPageSo;
|
||||
import com.gunshi.project.ss.model.DocOperateLog;
|
||||
import com.gunshi.project.ss.service.DocOperateLogService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Tag(name = "资料中心-行为日志")
|
||||
@RestController
|
||||
@RequestMapping(value = "/docOperateLog")
|
||||
public class DocOperateLogController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private DocOperateLogService docOperateLogService;
|
||||
|
||||
|
||||
@PostMapping("/add")
|
||||
public R<Boolean> addDocOperateLog(@RequestBody DocOperateLog docOperateLog) {
|
||||
boolean save = docOperateLogService.save(docOperateLog);
|
||||
return R.ok(save);
|
||||
}
|
||||
|
||||
@PostMapping("/page")
|
||||
public R<Page<DocOperateLog>> pageInfo(@RequestBody DocOperateLogPageSo pageSo) {
|
||||
Page<DocOperateLog> page = docOperateLogService.pageInfo(pageSo);
|
||||
return R.ok(page);
|
||||
}
|
||||
}
|
||||
|
|
@ -106,18 +106,21 @@ public class StStbprpBController {
|
|||
|
||||
@Operation(summary = "雨量站详情带雨量列表")
|
||||
@PostMapping("/rainfallStationDetails/rainfallList")
|
||||
@Deprecated(since = "代码重构-废弃")
|
||||
public R<List<HomeStStbprpBVo>> rainfallStationDetailsList(@RequestBody @Validated HomeStStbprpBSo dto) {
|
||||
return R.ok(service.rainfallStationDetailsList(dto));
|
||||
}
|
||||
|
||||
@Operation(summary = "水库站点详情带实时水位列表")
|
||||
@PostMapping("/reservoirStationDetails/realTimeWaterLevelList")
|
||||
@Deprecated(since = "代码重构-废弃")
|
||||
public R<List<HomeStStbprpBVo>> reservoirStationDetailsList() {
|
||||
return R.ok(service.reservoirStationDetailsList());
|
||||
}
|
||||
|
||||
@Operation(summary = "输/放水管流量站点详情带实时流量列表")
|
||||
@PostMapping("/trafficSiteDetails/realTimeTrafficList")
|
||||
@Deprecated(since = "代码重构-废弃")
|
||||
public R<List<HomeStStbprpBVo>> trafficStationDetailsList() {
|
||||
return R.ok(service.flowStationDetailsList());
|
||||
}
|
||||
|
|
@ -131,6 +134,7 @@ public class StStbprpBController {
|
|||
|
||||
@Operation(summary = "雨情站点下拉")
|
||||
@PostMapping("/rain/list")
|
||||
@Deprecated(since = "代码重构-废弃")
|
||||
public R<List<StStatusVo>> rainList() {
|
||||
return R.ok(service.rainList());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,23 @@
|
|||
package com.gunshi.project.ss.entity.so;
|
||||
|
||||
import com.gunshi.db.dto.DateTimeRangeSo;
|
||||
import com.gunshi.db.dto.PageSo;
|
||||
import com.sun.star.util.DateTimeRange;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class DocOperateLogPageSo {
|
||||
@NotNull(message = "分页参数不能为空")
|
||||
@Schema(description = "分页参数")
|
||||
private PageSo pageSo;
|
||||
|
||||
@Schema(description = "操作类型 1新增 2编辑 3删除 4预览 5下载")
|
||||
private Integer operateType;
|
||||
|
||||
@Schema(description="时间段")
|
||||
private DateTimeRangeSo dateTimeRangeSo;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package com.gunshi.project.ss.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.gunshi.project.ss.model.DocOperateLog;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface DocOperateLogMapper extends BaseMapper<DocOperateLog> {
|
||||
}
|
||||
|
|
@ -14,6 +14,7 @@ import jakarta.validation.constraints.NotNull;
|
|||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -81,6 +82,15 @@ public class DocCenter {
|
|||
@Schema(description = "0未废止 1已废止")
|
||||
private Integer isAbolish;
|
||||
|
||||
@TableField("draft_unit")
|
||||
@Schema(description = "起草单位")
|
||||
private String draftUnit;
|
||||
|
||||
@TableField("make_time")
|
||||
@Schema(description = "编制时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
private LocalDateTime makeTime;
|
||||
|
||||
@TableField(exist = false)
|
||||
@Schema(description = "归档人名称")
|
||||
private String userName;
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ public class DocOperateLog {
|
|||
|
||||
@TableField("operate_type")
|
||||
@Schema(description = "操作类型")
|
||||
private String operateType;
|
||||
private Integer operateType;
|
||||
|
||||
@TableField("doc_number")
|
||||
@Schema(description = "相关档案编号")
|
||||
|
|
@ -35,9 +35,9 @@ public class DocOperateLog {
|
|||
@Schema(description = "档案名称")
|
||||
private String docName;
|
||||
|
||||
@TableField("file_id")
|
||||
@Schema(description = "文件id")
|
||||
private Long fileId;
|
||||
@TableField("file_name")
|
||||
@Schema(description = "文件名称")
|
||||
private String fileName;
|
||||
|
||||
@TableField("create_time")
|
||||
@Schema(description = "操作时间")
|
||||
|
|
@ -47,8 +47,4 @@ public class DocOperateLog {
|
|||
@TableField(exist = false)
|
||||
@Schema(description = "用户名称")
|
||||
private String userName;
|
||||
|
||||
@TableField(exist = false)
|
||||
@Schema(description = "操作类型名称")
|
||||
private String operateTypeName;
|
||||
}
|
||||
|
|
@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gunshi.project.ss.entity.vo.UserRoleVo;
|
||||
import com.gunshi.project.ss.mapper.DocCategoryMapper;
|
||||
import com.gunshi.project.ss.mapper.DocCenterMapper;
|
||||
import com.gunshi.project.ss.model.DocCategory;
|
||||
import com.gunshi.project.ss.model.DocCenter;
|
||||
import com.gunshi.project.ss.model.DocPermissionConfig;
|
||||
|
|
@ -31,8 +32,7 @@ public class DocCategoryService extends ServiceImpl<DocCategoryMapper, DocCatego
|
|||
private DocPermissionConfigService docPermissionConfigService;
|
||||
|
||||
@Autowired
|
||||
private DocCenterService docCenterService;
|
||||
|
||||
private DocCenterMapper docCenterMapper;
|
||||
|
||||
|
||||
public DocCategory tree() {
|
||||
|
|
@ -147,7 +147,9 @@ public class DocCategoryService extends ServiceImpl<DocCategoryMapper, DocCatego
|
|||
}
|
||||
}else{
|
||||
//TODO 三级类目,如果关联有档案,则无法删除
|
||||
Long count = docCenterService.lambdaQuery().eq(DocCenter::getDocCategoryId, id).count();
|
||||
LambdaQueryWrapper<DocCenter> lambdaQueryWrapper= new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(DocCenter::getDocCategoryId, id);
|
||||
Long count = docCenterMapper.selectCount(lambdaQueryWrapper);
|
||||
if(count > 0){
|
||||
throw new IllegalArgumentException("对不起,该类目一下关联有档案,无法删除");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,6 +33,9 @@ public class DocCenterService extends ServiceImpl<DocCenterMapper, DocCenter> {
|
|||
@Autowired
|
||||
private SysUserMapper sysUserMapper;
|
||||
|
||||
@Autowired
|
||||
private DocOperateLogService docOperateLogService;
|
||||
|
||||
public Page<DocCenter> pageInfo(DocCenterPageSo pageSo){
|
||||
LambdaQueryWrapper<DocCenter> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(DocCenter::getDocCategoryId,pageSo.getDocCategoryId());
|
||||
|
|
@ -98,6 +101,7 @@ public class DocCenterService extends ServiceImpl<DocCenterMapper, DocCenter> {
|
|||
docCenter.setAbolishTime(null);
|
||||
}
|
||||
boolean save = this.save(docCenter);
|
||||
docOperateLogService.saveLog(docCenter,1);
|
||||
return save;
|
||||
}
|
||||
|
||||
|
|
@ -142,6 +146,7 @@ public class DocCenterService extends ServiceImpl<DocCenterMapper, DocCenter> {
|
|||
if(versionLe.size() > 0){
|
||||
updateBatchById(versionLe);
|
||||
}
|
||||
docOperateLogService.saveLog(center,3);
|
||||
return center;
|
||||
}
|
||||
|
||||
|
|
@ -172,6 +177,7 @@ public class DocCenterService extends ServiceImpl<DocCenterMapper, DocCenter> {
|
|||
updateById(replaceOne);
|
||||
}
|
||||
boolean flag = updateById(docCenter);
|
||||
docOperateLogService.saveLog(docCenter,2);
|
||||
return flag;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,70 @@
|
|||
package com.gunshi.project.ss.service;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.gunshi.project.ss.entity.so.DocOperateLogPageSo;
|
||||
|
||||
import com.gunshi.project.ss.mapper.DocOperateLogMapper;
|
||||
|
||||
import com.gunshi.project.ss.model.DocCenter;
|
||||
import com.gunshi.project.ss.model.DocOperateLog;
|
||||
import com.gunshi.project.ss.model.FileAssociations;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.system.mapper.SysUserMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class DocOperateLogService extends ServiceImpl<DocOperateLogMapper, DocOperateLog> {
|
||||
|
||||
@Autowired
|
||||
private SysUserMapper sysUserMapper;
|
||||
|
||||
public Page<DocOperateLog> pageInfo(DocOperateLogPageSo pageSo) {
|
||||
LambdaQueryWrapper<DocOperateLog> queryWrapper = new LambdaQueryWrapper<>();
|
||||
if(pageSo.getDateTimeRangeSo() != null){
|
||||
queryWrapper.ge(DocOperateLog::getCreateTime,pageSo.getDateTimeRangeSo().getStart());
|
||||
queryWrapper.le(DocOperateLog::getCreateTime,pageSo.getDateTimeRangeSo().getEnd());
|
||||
}
|
||||
if(pageSo.getOperateType() != null){
|
||||
queryWrapper.eq(DocOperateLog::getOperateType,pageSo.getOperateType());
|
||||
}
|
||||
queryWrapper.orderByDesc(DocOperateLog::getCreateTime);
|
||||
Page<DocOperateLog> docOperateLogPage = this.baseMapper.selectPage(pageSo.getPageSo().toPage(), queryWrapper);
|
||||
for (DocOperateLog record : docOperateLogPage.getRecords()) {
|
||||
SysUser sysUser = sysUserMapper.selectUserById(record.getUserId());
|
||||
if(sysUser != null){
|
||||
record.setUserName(sysUser.getNickName());
|
||||
}
|
||||
}
|
||||
return docOperateLogPage;
|
||||
}
|
||||
|
||||
public void saveLog(DocCenter docCenter,Integer operateType){
|
||||
DocOperateLog docOperateLog = new DocOperateLog();
|
||||
docOperateLog.setDocName(docCenter.getDocName());
|
||||
docOperateLog.setOperateType(operateType);
|
||||
docOperateLog.setCreateTime(LocalDateTime.now());
|
||||
docOperateLog.setDocNumber(docCenter.getDocNumber());
|
||||
docOperateLog.setUserId(docCenter.getUserId());
|
||||
List<FileAssociations> files = docCenter.getFiles();
|
||||
if(files!=null && files.size()>0){
|
||||
List<String> collect = files.stream()
|
||||
.map(o -> o.getFileName())
|
||||
.collect(Collectors.toList());
|
||||
String fileNames = String.join(",", collect);
|
||||
docOperateLog.setFileName(fileNames);
|
||||
}
|
||||
save(docOperateLog);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue