diff --git a/adc-da-report/src/main/java/com/adc/da/report/controller/ReportLogBookController.java b/adc-da-report/src/main/java/com/adc/da/report/controller/ReportLogBookController.java new file mode 100644 index 0000000..281ad62 --- /dev/null +++ b/adc-da-report/src/main/java/com/adc/da/report/controller/ReportLogBookController.java @@ -0,0 +1,113 @@ +package com.adc.da.report.controller; + +import com.adc.da.report.eo.ReportLogBook; +import com.adc.da.report.service.IReportLogService; +import com.adc.da.report.vo.DeleteParamRequestVO; +import com.adc.da.report.vo.ReportLogPageVO; +import com.adc.da.util.http.ResponseMessage; +import com.adc.da.util.http.Result; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * @Author bu + */ +@Api(tags = "报告日志book管理") +@RequestMapping("/${restPath}/reportLogBook") +@RestController +public class ReportLogBookController { + + @Autowired + private IReportLogService reportLogService; + + /** + * @param reportLogPageVO + * @return com.adc.da.util.http.ResponseMessage + * @author bu + * @date 2023-05-06 + * @description 分页查询 + */ + @PostMapping(value = "/page") + @ApiOperation(value = "分页查询") + @ApiImplicitParam(name = "reportLogPageVO", value = "查询条件VO", dataType = "ReportLogPageVO") + public ResponseMessage> page(@RequestBody ReportLogPageVO reportLogPageVO){ + + //分页查询 + Page reportLogIPage = reportLogService.selectPage(reportLogPageVO); + return Result.success(reportLogIPage); + } + + /** + * @param reportLogPageVO + * @return com.adc.da.util.http.ResponseMessage + * @author bu + * @date 2023-05-06 + * @description 列表查询 + */ + @PostMapping("/list") + @ApiOperation(value = "列表查询") + @ApiImplicitParam(name = "reportLogPageVO", value = "查询条件VO", dataType = "ReportLogPageVO") + public ResponseMessage> list(@RequestBody ReportLogPageVO reportLogPageVO) { + + //列表查询 + List reportLogBookList = reportLogService.selectList(reportLogPageVO); + return Result.success(reportLogBookList); + } + + /** + * @param id + * @return com.adc.da.util.http.ResponseMessage + * @author bu + * @date 2023-05-06 + * @description 根据id查询 + */ + @GetMapping("/info/{id}") + @ApiOperation(value = "根据id查询") + @ApiImplicitParam(name = "id", value = "主键ID", dataType = "String") + public ResponseMessage info(@PathVariable("id") String id){ + + //根据id查询 + ReportLogBook reportLogBook = reportLogService.selectById(id); + return Result.success(reportLogBook); + } + + /** + * @param reportLogBook + * @return com.adc.da.util.http.ResponseMessage + * @author bu + * @date 2023-05-06 + * @description 单条数据新增/更改 + */ + @PostMapping("/saveOrUpdate") + @ApiOperation(value = "单条数据新增/更改") + @ApiImplicitParam(name = "reportLog", value = " ReportLog实体", dataType = "ReportLog") + public ResponseMessage saveOrUpdate(@RequestBody ReportLogBook reportLogBook){ + + //单条数据新增/更改 + reportLogService.saveOrUpdateSingle(reportLogBook); + return Result.success(reportLogBook.getId()); + } + + /** + * @param deleteParamRequestVO + * @return com.adc.da.util.http.ResponseMessage + * @author bu + * @date 2023-05-06 + * @description 根据id或id数组进行删除 + */ + @DeleteMapping("/delete") + @ApiOperation(value = "单条/批量删除数据") + public ResponseMessage delete(@RequestBody DeleteParamRequestVO deleteParamRequestVO){ + + //单条/批量删除数据 + reportLogService.deleteById(deleteParamRequestVO); + return Result.success(); + } + +} diff --git a/adc-da-report/src/main/java/com/adc/da/report/controller/ReportManageConroller.java b/adc-da-report/src/main/java/com/adc/da/report/controller/ReportManageConroller.java index 2916ee5..2439227 100644 --- a/adc-da-report/src/main/java/com/adc/da/report/controller/ReportManageConroller.java +++ b/adc-da-report/src/main/java/com/adc/da/report/controller/ReportManageConroller.java @@ -1,9 +1,12 @@ package com.adc.da.report.controller; +import com.adc.da.login.util.UserUtils; import com.adc.da.report.annotation.ReportLog; import com.adc.da.report.dao.mysql.ReportDao; +import com.adc.da.report.dao.mysql.ReportLogDao; import com.adc.da.report.eo.FileEntity; 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.IReportService; import com.adc.da.report.util.LocalFileUtil; @@ -74,6 +77,8 @@ public class ReportManageConroller { @Autowired private ReportDao reportDao; + @Autowired + private ReportLogDao reportLogDao; /** * 新增或编辑报告 * @param vo @@ -165,6 +170,13 @@ public class ReportManageConroller { String html = reportService.reportHtml(id); Map map = new HashMap<>(); map.put("content", html); + + ReportLogBook reportLog = new ReportLogBook(); + reportLog.setReportId(id); + reportLog.setType(1); + reportLog.setUpdateTime(new Date()); + reportLog.setUserId(UserUtils.getUserId()); + reportLogDao.insert(reportLog); return Result.success(map); } @@ -330,7 +342,7 @@ public class ReportManageConroller { */ @ApiOperation(value = "|下载文件") @GetMapping("/download") - public void downloadPic(HttpServletResponse response, String fileId) throws IOException { + public void downloadPic(HttpServletResponse response, String fileId,String repostId) throws IOException { try { FileEntity entity = fileService.getFile(fileId); @@ -351,6 +363,12 @@ public class ReportManageConroller { } catch (Exception ex) { log.info(ex.getMessage(),ex); } + ReportLogBook reportLog = new ReportLogBook(); + reportLog.setReportId(repostId); + reportLog.setType(2); + reportLog.setUpdateTime(new Date()); + reportLog.setUserId(UserUtils.getUserId()); + reportLogDao.insert(reportLog); } diff --git a/adc-da-report/src/main/java/com/adc/da/report/dao/mysql/ReportLogDao.java b/adc-da-report/src/main/java/com/adc/da/report/dao/mysql/ReportLogDao.java new file mode 100644 index 0000000..27c6ac4 --- /dev/null +++ b/adc-da-report/src/main/java/com/adc/da/report/dao/mysql/ReportLogDao.java @@ -0,0 +1,47 @@ +package com.adc.da.report.dao.mysql; + + +import com.adc.da.report.eo.ReportLogBook; +import com.adc.da.report.vo.ReportLogPageVO; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * @author bu + * @version 1.0 + * @description 报告日志 Mapper接口 + * @date 2023-05-06 + */ +public interface ReportLogDao extends BaseMapper { + + /** + * @param reportLogPageVO + * @param page + * @author bu + * @date 2023-05-06 + * @description 使用分页插件进行查询 + */ + List selectPage(Page page, @Param("pageVO") ReportLogPageVO reportLogPageVO); + + /** + * @param reportLogPageVO + * @param page + * @author bu + * @date 2023-05-06 + * @description 使用分页插件进行查询总数 + */ + Long selectPageCount(@Param("pageVO") ReportLogPageVO reportLogPageVO); + + /** + * @param reportLogPageVO + * @return java.util.List + * @author bu + * @date 2023-05-06 + * @description 列表查询 + */ + List queryList(@Param("pageVO") ReportLogPageVO reportLogPageVO); + +} diff --git a/adc-da-report/src/main/java/com/adc/da/report/eo/ReportLogBook.java b/adc-da-report/src/main/java/com/adc/da/report/eo/ReportLogBook.java new file mode 100644 index 0000000..5ac309c --- /dev/null +++ b/adc-da-report/src/main/java/com/adc/da/report/eo/ReportLogBook.java @@ -0,0 +1,45 @@ +package com.adc.da.report.eo; + + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.util.Date; + +/** + * @author bu + * @version 1.0 + * @description 报告日志 + * @date 2023-05-06 + */ +@Data +@TableName("report_log") +public class ReportLogBook { + + @TableId("id") + private String id; + /** + * 报告id + */ + @TableField("report_id") + private String reportId; + + /** + * 类型 1预览 2下载 3点赞 + */ + private Integer type; + + /** + * 操作人 + */ + @TableField("user_id") + private String userId; + + /** + * 操作时间 + */ + @TableField("update_time") + private Date updateTime; +} diff --git a/adc-da-report/src/main/java/com/adc/da/report/service/IReportLogService.java b/adc-da-report/src/main/java/com/adc/da/report/service/IReportLogService.java new file mode 100644 index 0000000..158a554 --- /dev/null +++ b/adc-da-report/src/main/java/com/adc/da/report/service/IReportLogService.java @@ -0,0 +1,27 @@ +package com.adc.da.report.service; + +import com.adc.da.report.eo.ReportLogBook; +import com.adc.da.report.vo.DeleteParamRequestVO; +import com.adc.da.report.vo.ReportLogPageVO; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; + +import java.util.List; + +/** + * @author bu + * @version 1.0 + * @description 报告日志 + * @date 2023-05-06 + */ +public interface IReportLogService { + + Page selectPage(ReportLogPageVO reportLogPageVO); + + List selectList(ReportLogPageVO reportLogPageVO); + + ReportLogBook selectById(String id); + + void saveOrUpdateSingle(ReportLogBook reportLogBook); + + void deleteById(DeleteParamRequestVO deleteParamVO); +} diff --git a/adc-da-report/src/main/java/com/adc/da/report/service/impl/IReportLogServiceImpl.java b/adc-da-report/src/main/java/com/adc/da/report/service/impl/IReportLogServiceImpl.java new file mode 100644 index 0000000..27cff3b --- /dev/null +++ b/adc-da-report/src/main/java/com/adc/da/report/service/impl/IReportLogServiceImpl.java @@ -0,0 +1,110 @@ +package com.adc.da.report.service.impl; + + +import com.adc.da.report.dao.mysql.ReportLogDao; +import com.adc.da.report.eo.ReportLogBook; +import com.adc.da.report.service.IReportLogService; +import com.adc.da.report.vo.DeleteParamRequestVO; +import com.adc.da.report.vo.ReportLogPageVO; +import com.adc.da.util.utils.StringUtils; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.util.ObjectUtils; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author bu + * @version 1.0 + * @description 报告日志 服务实现类 + * @date 2023-05-06 + */ +@Slf4j +@Service +public class IReportLogServiceImpl extends ServiceImpl implements IReportLogService { + + /** + * @param reportLogPageVO + * @return + * @author bu + * @date 2023-05-06 + * @description 分页查询 + */ + public Page selectPage(ReportLogPageVO reportLogPageVO){ + Page page = new Page<>(reportLogPageVO.getCurrent(), + reportLogPageVO.getSize()); + page.setRecords(baseMapper.selectPage(page, reportLogPageVO)); + Long total = baseMapper.selectPageCount(reportLogPageVO); + page.setTotal(total); + return page; + } + + /** + * @param reportLogPageVO + * @return java.util.List + * @author bu + * @date 2023-05-06 + * @description 列表查询 + */ + public List selectList(ReportLogPageVO reportLogPageVO) { + return baseMapper.queryList(reportLogPageVO); + } + + /** + * @param id + * @return com.adc.da.report.entity.ReportLog + * @author bu + * @date 2023-05-06 + * @description 根据id查询 + */ + public ReportLogBook selectById(String id) { + return baseMapper.selectById(id); + } + + /** + * @param reportLogBook + * @return boolean + * @author bu + * @date 2023-05-06 + * @description 单条数据新增/更改 + */ + public void saveOrUpdateSingle(ReportLogBook reportLogBook) { + if (StringUtils.isEmpty(reportLogBook.getId())) { + baseMapper.insert(reportLogBook); + } else { + baseMapper.updateById(reportLogBook); + } + } + + /** + * @param deleteParamVO + * @return void + * @author bu + * @date 2023-05-06 + * @description 根据id或id数组进行删除 + */ + public void deleteById(DeleteParamRequestVO deleteParamVO) { + if (ObjectUtils.isEmpty(deleteParamVO)) { + return; + } + List ids = new ArrayList<>(); + + if (!ObjectUtils.isEmpty(deleteParamVO.getId())) { + ids.add(deleteParamVO.getId()); + } + if (!ObjectUtils.isEmpty(deleteParamVO.getIds())) { + ids.addAll(deleteParamVO.getIds()); + } + if (ObjectUtils.isEmpty(deleteParamVO)) { + return; + } +// Q wrapper = new EntityWrapper(); +// wrapper.in("id",ids); +// ReportLog reportLog = new ReportLog(); +// reportLog.setDel(YesOrNoEnum.YES.getValue()); +// baseMapper.update(reportLog,wrapper); + } +} diff --git a/adc-da-report/src/main/java/com/adc/da/report/vo/ReportLogPageVO.java b/adc-da-report/src/main/java/com/adc/da/report/vo/ReportLogPageVO.java new file mode 100644 index 0000000..9b86d93 --- /dev/null +++ b/adc-da-report/src/main/java/com/adc/da/report/vo/ReportLogPageVO.java @@ -0,0 +1,31 @@ +package com.adc.da.report.vo; + +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * @author bu + * @version 1.0 + * @description 报告日志查询条件VO + * @date 2023-05-06 + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class ReportLogPageVO extends BasePageVO { + + + /** + * + */ + private String reportId; + + /** + * 类型 1预览 2下载 3点赞 + */ + private Integer type; + + /** + * 操作人 + */ + private String userId; +} diff --git a/adc-da-report/src/main/resources/mybatis/mapper/mysql/ReportLogMapper.xml b/adc-da-report/src/main/resources/mybatis/mapper/mysql/ReportLogMapper.xml new file mode 100644 index 0000000..a1f9090 --- /dev/null +++ b/adc-da-report/src/main/resources/mybatis/mapper/mysql/ReportLogMapper.xml @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + + report_log + + + + + id, + update_time, + report_id, type, user_id + + + + + + AND del = '${@com.adc.da.sys.constant.YesOrNoEnum@NO.value}' + + + AND report_id LIKE CONCAT(CONCAT('%',#{pageVO.reportId}),'%') + + + AND type = #{pageVO.type} + + + AND user_id LIKE CONCAT(CONCAT('%',#{pageVO.userId}),'%') + + + + + + + + + + + + + + + diff --git a/adc-da-report/target/classes/com/adc/da/report/controller/ReportManageConroller.class b/adc-da-report/target/classes/com/adc/da/report/controller/ReportManageConroller.class deleted file mode 100644 index c97520f..0000000 Binary files a/adc-da-report/target/classes/com/adc/da/report/controller/ReportManageConroller.class and /dev/null differ diff --git a/adc-da-report/target/classes/com/adc/da/report/service/impl/IReportServiceImpl.class b/adc-da-report/target/classes/com/adc/da/report/service/impl/IReportServiceImpl.class deleted file mode 100644 index e97a2ca..0000000 Binary files a/adc-da-report/target/classes/com/adc/da/report/service/impl/IReportServiceImpl.class and /dev/null differ diff --git a/adc-da-report/target/classes/com/adc/da/report/util/PdfUtil.class b/adc-da-report/target/classes/com/adc/da/report/util/PdfUtil.class deleted file mode 100644 index fafc618..0000000 Binary files a/adc-da-report/target/classes/com/adc/da/report/util/PdfUtil.class and /dev/null differ diff --git a/adc-da-report/target/classes/com/adc/da/report/util/PptUtil.class b/adc-da-report/target/classes/com/adc/da/report/util/PptUtil.class deleted file mode 100644 index 595c61b..0000000 Binary files a/adc-da-report/target/classes/com/adc/da/report/util/PptUtil.class and /dev/null differ diff --git a/adc-da-report/target/classes/mybatis/mapper/mysql/ReportManageMapper.xml b/adc-da-report/target/classes/mybatis/mapper/mysql/ReportManageMapper.xml deleted file mode 100644 index d877337..0000000 --- a/adc-da-report/target/classes/mybatis/mapper/mysql/ReportManageMapper.xml +++ /dev/null @@ -1,228 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -