Commit 07fe980f authored by wujipeng's avatar wujipeng
Browse files

优化

parent a4b39a84
......@@ -43,6 +43,11 @@
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>1.4.6</version>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.8.38</version>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
......
......@@ -40,7 +40,7 @@ public class ReportDetailBasicEntity {
@ApiModelProperty(value = "值")
private String value;
@ApiModelProperty(value = "数据类型")
@ApiModelProperty(value = "数据类型(静态值、元数据、公式、引用报表)")
private String type;
@ApiModelProperty(value = "静态值")
......
......@@ -36,7 +36,7 @@ public class TemplateDetailBasicEntity {
@ApiModelProperty(value = "值")
private String value;
@ApiModelProperty(value = "数据类型")
@ApiModelProperty(value = "数据类型(静态值、元数据、公式、引用报表)")
private String type;
@ApiModelProperty(value = "静态值")
......
package com.ruzhoukj.integration.service.impl;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.ruzhoukj.integration.mapper.TemplateMapper;
import com.ruzhoukj.integration.pojo.dto.TemplateDTO;
import com.ruzhoukj.integration.pojo.entity.*;
import com.ruzhoukj.integration.pojo.entity.TemplateConfigEntity;
import com.ruzhoukj.integration.pojo.entity.TemplateDetailBasicEntity;
import com.ruzhoukj.integration.pojo.entity.TemplateDetailMergeEntity;
import com.ruzhoukj.integration.pojo.entity.TemplateEntity;
import com.ruzhoukj.integration.pojo.vo.TemplateVO;
import com.ruzhoukj.integration.result.PageResult;
import com.ruzhoukj.integration.service.*;
import io.swagger.annotations.ApiModelProperty;
import com.ruzhoukj.integration.service.TemplateConfigService;
import com.ruzhoukj.integration.service.TemplateDetailBasicService;
import com.ruzhoukj.integration.service.TemplateDetailMergeService;
import com.ruzhoukj.integration.service.TemplateService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
......@@ -30,7 +34,7 @@ public class TemplateServiceImpl extends ServiceImpl<TemplateMapper, TemplateEnt
@Resource
private TemplateDetailBasicService templateDetailBasicService;
// @Resource
// @Resource
// private TemplateExpansionService templateExpansionService;
@Resource
private TemplateDetailMergeService templateDetailMergeService;
......@@ -43,9 +47,10 @@ public class TemplateServiceImpl extends ServiceImpl<TemplateMapper, TemplateEnt
//判断是新增还是编辑
if (templateDTO.getId() == null) {
//新增模板
templateDTO.setId("1.0");
templateDTO.setVersion("1.0");
save(templateDTO);
//初始化模板所有单元格位置
if (!ObjectUtils.isEmpty(templateDTO.getLineNumber()) && !ObjectUtils.isEmpty(templateDTO.getColumnNumber())) {
List<String> locations = new ArrayList<>();
for (int row = 1; row <= templateDTO.getLineNumber(); row++) {
for (int col = 0; col < templateDTO.getColumnNumber(); col++) {
......@@ -68,6 +73,7 @@ public class TemplateServiceImpl extends ServiceImpl<TemplateMapper, TemplateEnt
}
templateDetailBasicService.saveBatch(templateDetailList);
// templateExpansionService.saveBatch(templateExpansionList);
}
} else {
//编辑模板
updateById(templateDTO);
......@@ -89,10 +95,10 @@ public class TemplateServiceImpl extends ServiceImpl<TemplateMapper, TemplateEnt
Map<String, TemplateConfigEntity> rows = templateDTO.getRows();
Map<String, TemplateConfigEntity> columns = templateDTO.getColumns();
List<TemplateConfigEntity> templateConfigList = new ArrayList<>();
if(!ObjectUtils.isEmpty(rows)){
if (!ObjectUtils.isEmpty(rows)) {
templateConfigList.addAll(rows.values());
}
if(!ObjectUtils.isEmpty(columns)){
if (!ObjectUtils.isEmpty(columns)) {
templateConfigList.addAll(columns.values());
}
templateConfigService.saveOrUpdateBatch(templateConfigList);
......@@ -219,7 +225,7 @@ public class TemplateServiceImpl extends ServiceImpl<TemplateMapper, TemplateEnt
Map<String, TemplateConfigEntity> rows = new HashMap<>();
Map<String, TemplateConfigEntity> columns = new HashMap<>();
for (TemplateConfigEntity templateConfigEntity : templateConfigList) {
if("row".equals(templateConfigEntity.getType())){
if ("row".equals(templateConfigEntity.getType())) {
rows.put(templateConfigEntity.getNum(), templateConfigEntity);
} else {
columns.put(templateConfigEntity.getNum(), templateConfigEntity);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment