mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
报表基础模块:1、模板接口补充校验;2、数据集实体补充organId;
This commit is contained in:
-1
@@ -12,7 +12,6 @@ public final class ErrorCodeConstants {
|
|||||||
|
|
||||||
// ========== UREPORT template模块 1-003-001-000 ==========
|
// ========== UREPORT template模块 1-003-001-000 ==========
|
||||||
public static ErrorCode TEMPLATE_NOT_EXISTS = new ErrorCode(1_003_001_001, "报表模板信息不存在");
|
public static ErrorCode TEMPLATE_NOT_EXISTS = new ErrorCode(1_003_001_001, "报表模板信息不存在");
|
||||||
public static ErrorCode TEMPLATE_GENERATE_EXCEL_ERROR = new ErrorCode(1_003_001_002, "模板excel生成异常");
|
|
||||||
|
|
||||||
// ========== UREPORT datasource模块 1-003-002-000 ==========
|
// ========== UREPORT datasource模块 1-003-002-000 ==========
|
||||||
public static ErrorCode DATASOURCE_NOT_EXISTS = new ErrorCode(1_003_002_001, "报表数据源不存在");
|
public static ErrorCode DATASOURCE_NOT_EXISTS = new ErrorCode(1_003_002_001, "报表数据源不存在");
|
||||||
|
|||||||
+8
@@ -62,6 +62,14 @@ public class ReportDatasetDO extends BaseDO {
|
|||||||
@TableField(typeHandler = CompressObjectListTypeHandler.class)
|
@TableField(typeHandler = CompressObjectListTypeHandler.class)
|
||||||
private List<ReportDatasetParameterVO> parameters;
|
private List<ReportDatasetParameterVO> parameters;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 字段列表
|
||||||
|
*/
|
||||||
@TableField(typeHandler = CompressObjectListTypeHandler.class)
|
@TableField(typeHandler = CompressObjectListTypeHandler.class)
|
||||||
private List<ReportDatasetFieldVO> fields;
|
private List<ReportDatasetFieldVO> fields;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 组织id
|
||||||
|
*/
|
||||||
|
private Long organId;
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-3
@@ -38,7 +38,6 @@ import com.cf.imes.module.report.dal.dataobject.dataset.ReportDatasetDO;
|
|||||||
import com.cf.imes.module.report.dal.dataobject.datasource.ReportDatasourceDO;
|
import com.cf.imes.module.report.dal.dataobject.datasource.ReportDatasourceDO;
|
||||||
import com.cf.imes.module.report.dal.dataobject.template.ReportTemplateDO;
|
import com.cf.imes.module.report.dal.dataobject.template.ReportTemplateDO;
|
||||||
import com.cf.imes.module.report.dal.mysql.template.ReportTemplateMapper;
|
import com.cf.imes.module.report.dal.mysql.template.ReportTemplateMapper;
|
||||||
import com.cf.imes.module.report.enums.ErrorCodeConstants;
|
|
||||||
import com.cf.imes.module.report.service.dataset.ReportDatasetService;
|
import com.cf.imes.module.report.service.dataset.ReportDatasetService;
|
||||||
import com.cf.imes.module.report.service.datasource.ReportDatasourceService;
|
import com.cf.imes.module.report.service.datasource.ReportDatasourceService;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
@@ -54,6 +53,7 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
import static com.cf.imes.module.report.enums.ErrorCodeConstants.TEMPLATE_NOT_EXISTS;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 报表模板信息 Service 实现类
|
* 报表模板信息 Service 实现类
|
||||||
@@ -165,12 +165,14 @@ public class ReportTemplateServiceImpl implements ReportTemplateService {
|
|||||||
*/
|
*/
|
||||||
private void validateTemplateExists(Long id) {
|
private void validateTemplateExists(Long id) {
|
||||||
if (templateMapper.selectById(id) == null) {
|
if (templateMapper.selectById(id) == null) {
|
||||||
throw exception(ErrorCodeConstants.TEMPLATE_NOT_EXISTS);
|
throw exception(TEMPLATE_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ReportTemplateDO getReportTemplate(Long id) {
|
public ReportTemplateDO getReportTemplate(Long id) {
|
||||||
|
// 校验模板
|
||||||
|
validateTemplateExists(id);
|
||||||
// 查询模板
|
// 查询模板
|
||||||
ReportTemplateDO template = templateMapper.selectById(id);
|
ReportTemplateDO template = templateMapper.selectById(id);
|
||||||
if (ObjectUtil.isNotNull(template)) {
|
if (ObjectUtil.isNotNull(template)) {
|
||||||
@@ -188,6 +190,8 @@ public class ReportTemplateServiceImpl implements ReportTemplateService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ReportDefinitionWrapper getReportTemplateDefinition(Long id) {
|
public ReportDefinitionWrapper getReportTemplateDefinition(Long id) {
|
||||||
|
// 校验模板
|
||||||
|
validateTemplateExists(id);
|
||||||
// 查询模板
|
// 查询模板
|
||||||
ReportTemplateDO template = templateMapper.selectById(id);
|
ReportTemplateDO template = templateMapper.selectById(id);
|
||||||
String xmlContent = template.getContent();
|
String xmlContent = template.getContent();
|
||||||
@@ -292,8 +296,11 @@ public class ReportTemplateServiceImpl implements ReportTemplateService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Report generateReport(ReportTemplateGenerateReqDTO reqDTO) {
|
public Report generateReport(ReportTemplateGenerateReqDTO reqDTO) {
|
||||||
|
Long templateId = reqDTO.getTemplateId();
|
||||||
|
// 校验模板
|
||||||
|
validateTemplateExists(templateId);
|
||||||
// 查询模板
|
// 查询模板
|
||||||
ReportTemplateDO template = templateMapper.selectById(reqDTO.getTemplateId());
|
ReportTemplateDO template = templateMapper.selectById(templateId);
|
||||||
String xmlContent = template.getContent();
|
String xmlContent = template.getContent();
|
||||||
ReportRender reportRender = new ReportRender();
|
ReportRender reportRender = new ReportRender();
|
||||||
// 解析xml
|
// 解析xml
|
||||||
|
|||||||
Reference in New Issue
Block a user