mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-14 13:42:07 +08:00
报表基础模块:1、模板接口补充校验;2、数据集实体补充organId;
This commit is contained in:
+8
@@ -62,6 +62,14 @@ public class ReportDatasetDO extends BaseDO {
|
||||
@TableField(typeHandler = CompressObjectListTypeHandler.class)
|
||||
private List<ReportDatasetParameterVO> parameters;
|
||||
|
||||
/**
|
||||
* 字段列表
|
||||
*/
|
||||
@TableField(typeHandler = CompressObjectListTypeHandler.class)
|
||||
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.template.ReportTemplateDO;
|
||||
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.datasource.ReportDatasourceService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@@ -54,6 +53,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.module.report.enums.ErrorCodeConstants.TEMPLATE_NOT_EXISTS;
|
||||
|
||||
/**
|
||||
* 报表模板信息 Service 实现类
|
||||
@@ -165,12 +165,14 @@ public class ReportTemplateServiceImpl implements ReportTemplateService {
|
||||
*/
|
||||
private void validateTemplateExists(Long id) {
|
||||
if (templateMapper.selectById(id) == null) {
|
||||
throw exception(ErrorCodeConstants.TEMPLATE_NOT_EXISTS);
|
||||
throw exception(TEMPLATE_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReportTemplateDO getReportTemplate(Long id) {
|
||||
// 校验模板
|
||||
validateTemplateExists(id);
|
||||
// 查询模板
|
||||
ReportTemplateDO template = templateMapper.selectById(id);
|
||||
if (ObjectUtil.isNotNull(template)) {
|
||||
@@ -188,6 +190,8 @@ public class ReportTemplateServiceImpl implements ReportTemplateService {
|
||||
|
||||
@Override
|
||||
public ReportDefinitionWrapper getReportTemplateDefinition(Long id) {
|
||||
// 校验模板
|
||||
validateTemplateExists(id);
|
||||
// 查询模板
|
||||
ReportTemplateDO template = templateMapper.selectById(id);
|
||||
String xmlContent = template.getContent();
|
||||
@@ -292,8 +296,11 @@ public class ReportTemplateServiceImpl implements ReportTemplateService {
|
||||
|
||||
@Override
|
||||
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();
|
||||
ReportRender reportRender = new ReportRender();
|
||||
// 解析xml
|
||||
|
||||
Reference in New Issue
Block a user