管道基础大数据平台系统开发-【后端】-Server
1
13693261870
2023-02-11 30272471be13ecb9a1a711a5c037fe27127c9056
src/main/java/com/lf/server/controller/sys/ReportController.java
@@ -5,6 +5,7 @@
import com.lf.server.entity.all.ResponseMsg;
import com.lf.server.entity.sys.ReportEntity;
import com.lf.server.entity.sys.UserEntity;
import com.lf.server.helper.StringHelper;
import com.lf.server.service.all.UploadAttachService;
import com.lf.server.service.sys.ReportService;
import com.lf.server.service.sys.TokenService;
@@ -61,19 +62,6 @@
            List<ReportEntity> rs = reportService.selectByPage(name, pageSize, pageSize * (pageIndex - 1));
            return success(count, rs);
        } catch (Exception ex) {
            return fail(ex.getMessage(), null);
        }
    }
    @SysLog()
    @ApiOperation(value = "查询所有")
    @GetMapping(value = "/selectAll")
    public ResponseMsg<List<ReportEntity>> selectAll() {
        try {
            List<ReportEntity> list = reportService.selectAll();
            return success(list);
        } catch (Exception ex) {
            return fail(ex.getMessage(), null);
        }
@@ -193,4 +181,29 @@
    public void download(String guid, HttpServletResponse res) {
        uploadAttachService.download(guid, res);
    }
    @SysLog()
    @ApiOperation(value = "下载报告")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "报告ID", dataType = "Integer", paramType = "7")
    })
    @GetMapping(value = "/downloadReport")
    public void downloadReport(Integer id, HttpServletRequest req, HttpServletResponse res) {
        try {
            if (null == id || id < 1) {
                return;
            }
            ReportEntity re = reportService.selectById(id);
            if (null == re || StringHelper.isEmpty(re.getGuid()) || StringHelper.isEmpty(re.getType()) || StringHelper.isEmpty(re.getCode())) {
                return;
            }
            UserEntity ue = tokenService.getCurrentUser(req);
            reportService.createReport(ue, re, res);
        } catch (Exception ex) {
            log.error(ex.getMessage(), ex);
        }
    }
}