[修改] 报告管理 操作日志 新增 修改 预览 下载 删除

This commit is contained in:
bupengxiang
2023-05-15 14:39:13 +08:00
parent 03ba9069e6
commit e844a6fdba
7 changed files with 77 additions and 16 deletions
@@ -25,6 +25,7 @@ public class secrecyDDLTimer {
@Autowired
ReportDao reportDao;
// @Scheduled(cron="0 0 0 * * *")
@Scheduled(cron="0 0/10 * * * ?")
public void timingOpen() {
log.info("**********************保密到期定时任务开始**********************");
@@ -1,11 +1,11 @@
package com.adc.da.report.aspect;
import com.adc.da.login.util.CommonUtils;
import com.adc.da.login.util.UserUtils;
import com.adc.da.report.annotation.ReportLog;
import com.adc.da.report.eo.LogEntity;
import com.adc.da.report.eo.ReportEntity;
import com.adc.da.report.service.ILogService;
import com.adc.da.report.vo.ReportVo;
import com.adc.da.sys.entity.UserEO;
import com.adc.da.util.http.ResponseMessage;
import com.adc.da.util.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
@@ -13,16 +13,14 @@ import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import javax.annotation.Resource;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import java.lang.reflect.Method;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Optional;
/**
* @Author doudxw
@@ -64,9 +62,7 @@ public class ReportLogAspect {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
LogEntity entity = new LogEntity();
String account = Optional.ofNullable(CommonUtils.getUserInfo()).orElse(new UserEO()).getAccount();
account = StringUtils.isEmpty(account) ? "未知用户" : account;
entity.setAccount(account);
entity.setAccount(UserUtils.getUser().getAccount());
entity.setClassName(cs.getName());
entity.setOperateTime(format.format(new Date()));
entity.setMethod(name);
@@ -74,11 +70,11 @@ public class ReportLogAspect {
entity.setUsid(CommonUtils.getUserId());
//新增或者编辑操作
if ("新增或编辑".equals(description)) {
Map<String, String> map = (Map<String, String>) returnValue.getData();
String reportName = map.get("reportName");
ReportEntity reportEntity = (ReportEntity) returnValue.getData();
String reportName = reportEntity.getName();
entity.setReportName(reportName);
ReportVo vo = (ReportVo) args[0];
if (StringUtils.isNotEmpty(vo.getId())) {
ReportEntity vo = (ReportEntity) args[0];
if (StringUtils.isEmpty(vo.getId())) {
entity.setDescription("新增");
} else {
entity.setDescription("编辑");
@@ -6,9 +6,11 @@ import com.adc.da.report.annotation.ReportLog;
import com.adc.da.report.dao.mysql.ReportDao;
import com.adc.da.report.dao.mysql.ReportLogBookDao;
import com.adc.da.report.eo.FileEntity;
import com.adc.da.report.eo.LogEntity;
import com.adc.da.report.eo.ReportEntity;
import com.adc.da.report.eo.ReportLogBook;
import com.adc.da.report.service.IFileService;
import com.adc.da.report.service.ILogService;
import com.adc.da.report.service.IReportService;
import com.adc.da.report.util.LocalFileUtil;
import com.adc.da.report.util.OSSClientUtil;
@@ -90,6 +92,8 @@ public class ReportManageConroller {
@Resource
private WaterMarkUtil waterMarkUtil;
@Resource
private ILogService logService;
/**
* 新增或编辑报告
* 弃用
@@ -124,11 +128,12 @@ public class ReportManageConroller {
*/
@ApiOperation("新增或编辑报告")
@PostMapping("/saveOrUpdate")
// @ReportLog(description = "新增或编辑")
@ReportLog(description = "新增或编辑")
public ResponseMessage saveOrUpdate(@RequestBody ReportEntity reportEntity) throws IOException {
reportService.addOrUpdate(reportEntity);
return Result.success();
ReportEntity re = new ReportEntity();
BeanUtils.copyProperties(reportEntity,re);
reportService.addOrUpdate(re);
return Result.success(reportEntity);
}
/**
* 判断报告名称是否被占用
@@ -534,9 +539,26 @@ public class ReportManageConroller {
reportLog.setUpdateTime(new Date());
reportLog.setUserId(UserUtils.getUserId());
reportLogBookDao.insert(reportLog);
//报告日志管理
ReportEntity reportEntity = reportDao.selectById(repostId);
reportLog(reportEntity.getName(),"下载");
}
}
public void reportLog(String reportName,String desc){
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
LogEntity entity = new LogEntity();
entity.setAccount(UserUtils.getUser().getAccount());
entity.setClassName("com.adc.da.report.controller.ReportManageConroller");
entity.setOperateTime(format.format(new Date()));
entity.setMethod("downloadPic");
entity.setUsid(UserUtils.getUserId());
entity.setReportName(reportName);
entity.setDescription(desc);
logService.insert(entity);
}
/**
* 权限审批流程 添加报告按钮 可添加的报告
@@ -118,6 +118,8 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
@Resource
private UserEODao userEODao;
@Resource
private ILogService logService;
@Override
@@ -705,9 +707,24 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
reportDetailVo.setDownPower(1);
}
}
//报告日志管理
reportLog(reportDetailVo.getName(),"预览");
return Result.success(reportDetailVo);
}
public void reportLog(String reportName,String desc){
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
LogEntity entity = new LogEntity();
entity.setAccount(UserUtils.getUser().getAccount());
entity.setClassName("com.adc.da.report.service.impl.IReportServiceImpl");
entity.setOperateTime(format.format(new Date()));
entity.setMethod("reportDetail");
entity.setUsid(UserUtils.getUserId());
entity.setReportName(reportName);
entity.setDescription(desc);
logService.insert(entity);
}
/**
* 创建htmlstring
*
@@ -2,11 +2,14 @@ package com.adc.da.report.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.adc.da.login.util.UserUtils;
import com.adc.da.report.dao.mysql.PowerApplyDao;
import com.adc.da.report.dao.mysql.ReportDao;
import com.adc.da.report.dao.mysql.TtReportManageActDao;
import com.adc.da.report.eo.LogEntity;
import com.adc.da.report.eo.ReportEntity;
import com.adc.da.report.eo.TtReportManageAct;
import com.adc.da.report.service.ILogService;
import com.adc.da.report.service.IReportContentService;
import com.adc.da.report.service.ITtReportManageActService;
import com.adc.da.report.vo.DeleteParamRequestVO;
@@ -22,7 +25,9 @@ import org.springframework.util.ObjectUtils;
import javax.annotation.Resource;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
@@ -38,6 +43,9 @@ public class ITtReportManageActServiceImpl extends ServiceImpl<TtReportManageAct
@Autowired
ReportDao reportDao;
@Resource
private ILogService logService;
@Autowired
PowerApplyDao powerApplyDao;
@@ -132,12 +140,14 @@ public class ITtReportManageActServiceImpl extends ServiceImpl<TtReportManageAct
if (reportEntity == null){
//保存报告
reportDao.saveReportAct(ttReportManageAct);
reportLog(ttReportManageAct.getName(),"新增");
}else {
//更改
ReportEntity reportEntity1 = new ReportEntity();
BeanUtil.copyProperties(ttReportManageAct,reportEntity1);
reportEntity1.setId(ttReportManageAct.getDataId());
reportDao.updateById(reportEntity);
reportLog(reportEntity.getName(),"修改");
}
try {
iReportContentService.insertReportContent(ttReportManageAct.getDataId(), ttReportManageAct.getFileId());
@@ -146,4 +156,19 @@ public class ITtReportManageActServiceImpl extends ServiceImpl<TtReportManageAct
log.error("获取报告内容失败", e);
}
}
public void reportLog(String reportName,String desc){
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
LogEntity entity = new LogEntity();
entity.setAccount(UserUtils.getUser().getAccount());
entity.setClassName("com.adc.da.report.service.impl.ITtReportManageActServiceImpl");
entity.setOperateTime(format.format(new Date()));
entity.setMethod("saveOrUpdataReport");
entity.setUsid(UserUtils.getUserId());
entity.setReportName(reportName);
entity.setDescription(desc);
logService.insert(entity);
}
}