After Width: | Height: | Size: 7.4 KiB |
After Width: | Height: | Size: 13 KiB |
@ -0,0 +1,3 @@
|
||||
## 新增报表
|
||||
 <br>
|
||||
状态默认为已启用。
|
After Width: | Height: | Size: 33 KiB |
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 31 KiB |
After Width: | Height: | Size: 4.9 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 24 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 136 KiB |
Before Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 8.7 KiB |
After Width: | Height: | Size: 31 KiB |
After Width: | Height: | Size: 64 KiB |
After Width: | Height: | Size: 40 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 101 KiB |
After Width: | Height: | Size: 49 KiB |
After Width: | Height: | Size: 37 KiB |
After Width: | Height: | Size: 31 KiB |
After Width: | Height: | Size: 49 KiB |
After Width: | Height: | Size: 55 KiB |
@ -0,0 +1,73 @@
|
||||
package com.anjiplus.template.gaea.business.enums;
|
||||
|
||||
/**
|
||||
* @author zhouhang
|
||||
* @description EXCEL居中方式
|
||||
* @date 2021/4/26
|
||||
*/
|
||||
public enum ExcelCenterStyleEnum {
|
||||
/**
|
||||
* 左对齐
|
||||
*/
|
||||
LEFT((short) 1, 1, "左对齐"),
|
||||
/**
|
||||
* 右对齐
|
||||
*/
|
||||
RIGHT((short) 3, 2, "右对齐"),
|
||||
/**
|
||||
* 居中
|
||||
*/
|
||||
CENTER((short) 2, 0, "居中"),
|
||||
;
|
||||
|
||||
/**
|
||||
* excel居中code
|
||||
*/
|
||||
private final short excelCode;
|
||||
|
||||
/**
|
||||
* 在线文档居中code
|
||||
*/
|
||||
private final Integer onlineExcelCode;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private final String name;
|
||||
|
||||
|
||||
public Integer getOnlineExcelCode() {
|
||||
return onlineExcelCode;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public short getExcelCode() {
|
||||
return excelCode;
|
||||
}
|
||||
|
||||
ExcelCenterStyleEnum(short excelCode, Integer onlineExcelCode, String name) {
|
||||
this.excelCode = excelCode;
|
||||
this.onlineExcelCode = onlineExcelCode;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param code excel居中样式code
|
||||
* @return Enum_ExcelCenterStyle
|
||||
* @description 根据excel居中样式获取在线文档居中样式
|
||||
* @author zhouhang
|
||||
* @date 2021/4/26
|
||||
*/
|
||||
public static ExcelCenterStyleEnum getExcelCenterStyleByExcelCenterCode(short code) {
|
||||
for (ExcelCenterStyleEnum value : ExcelCenterStyleEnum.values()) {
|
||||
if (code == value.getExcelCode()) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
return CENTER;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package com.anjiplus.template.gaea.business.enums;
|
||||
|
||||
/**
|
||||
* Created by raodeming on 2021/9/3.
|
||||
*/
|
||||
public enum ExportTypeEnum {
|
||||
|
||||
/**gaea_excel*/
|
||||
GAEA_TEMPLATE_EXCEL("gaea_template_excel", "gaea_template_excel"),
|
||||
/**gaea_pdf*/
|
||||
GAEA_TEMPLATE_PDF("gaea_template_pdf", "gaea_template_pdf"),
|
||||
;
|
||||
|
||||
private String codeValue;
|
||||
private String codeDesc;
|
||||
|
||||
private ExportTypeEnum(String codeValue, String codeDesc) {
|
||||
this.codeValue = codeValue;
|
||||
this.codeDesc = codeDesc;
|
||||
}
|
||||
|
||||
public String getCodeValue() {
|
||||
return this.codeValue;
|
||||
}
|
||||
|
||||
public String getCodeDesc() {
|
||||
return this.codeDesc;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
package com.anjiplus.template.gaea.business.modules.reportexcel.controller;
|
||||
|
||||
import com.anji.plus.gaea.annotation.Permission;
|
||||
import com.anji.plus.gaea.annotation.log.GaeaAuditLog;
|
||||
import com.anji.plus.gaea.bean.ResponseBean;
|
||||
import com.anji.plus.gaea.code.ResponseCode;
|
||||
import com.anji.plus.gaea.curd.controller.GaeaBaseController;
|
||||
import com.anji.plus.gaea.curd.service.GaeaBaseService;
|
||||
import com.anjiplus.template.gaea.business.modules.reportexcel.controller.dto.ReportExcelDto;
|
||||
import com.anjiplus.template.gaea.business.modules.reportexcel.controller.param.ReportExcelParam;
|
||||
import com.anjiplus.template.gaea.business.modules.reportexcel.dao.entity.ReportExcel;
|
||||
import com.anjiplus.template.gaea.business.modules.reportexcel.service.ReportExcelService;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* @author chenkening
|
||||
* @date 2021/4/13 15:12
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "报表表格管理")
|
||||
@Permission(code = "excelManage", name = "报表管理")
|
||||
@RequestMapping("/reportExcel")
|
||||
public class ReportExcelController extends GaeaBaseController<ReportExcelParam, ReportExcel, ReportExcelDto> {
|
||||
|
||||
@Autowired
|
||||
private ReportExcelService reportExcelService;
|
||||
|
||||
@Override
|
||||
public GaeaBaseService<ReportExcelParam, ReportExcel> getService() {
|
||||
return reportExcelService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReportExcel getEntity() {
|
||||
return new ReportExcel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReportExcelDto getDTO() {
|
||||
return new ReportExcelDto();
|
||||
}
|
||||
|
||||
@GetMapping("/detailByReportCode/{reportCode}")
|
||||
@Permission(code = "query", name = "详情")
|
||||
@GaeaAuditLog(pageTitle = "详情")
|
||||
public ResponseBean detailByReportCode(@PathVariable String reportCode) {
|
||||
ReportExcelDto reportExcelDto = reportExcelService.detailByReportCode(reportCode);
|
||||
return ResponseBean.builder().data(reportExcelDto).build();
|
||||
}
|
||||
|
||||
@PostMapping("/preview")
|
||||
@Permission(code = "view", name = "预览")
|
||||
@GaeaAuditLog(pageTitle = "预览")
|
||||
public ResponseBean preview(@RequestBody ReportExcelDto reportExcelDto) {
|
||||
ReportExcelDto result = reportExcelService.preview(reportExcelDto);
|
||||
return ResponseBean.builder().data(result).build();
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/exportExcel")
|
||||
@Permission(code = "export", name = "导出")
|
||||
@GaeaAuditLog(pageTitle = "报表导出")
|
||||
public ResponseBean exportExcel(@RequestBody ReportExcelDto reportExcelDto) {
|
||||
|
||||
return ResponseBean.builder().code(ResponseCode.SUCCESS_CODE)
|
||||
.data(reportExcelService.exportExcel(reportExcelDto))
|
||||
.message("导出成功,请稍后在文件管理中查看").build();
|
||||
}
|
||||
|
||||
// @PostMapping("/exportPdf")
|
||||
// public ResponseBean exportPdf(@RequestBody ReportExcelDto reportExcelDto) {
|
||||
// reportExcelService.exportPdf(reportExcelDto);
|
||||
// return ResponseBean.builder().code(ResponseCode.SUCCESS_CODE)
|
||||
// .build();
|
||||
// }
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
package com.anjiplus.template.gaea.business.modules.reportexcel.controller.dto;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 存储对象类
|
||||
*
|
||||
* @author Administrator
|
||||
*/
|
||||
@Data
|
||||
public class GridRecordDataModel {
|
||||
/**
|
||||
* 记录序列
|
||||
*/
|
||||
Long id;
|
||||
/**
|
||||
* 文档ID
|
||||
*/
|
||||
String list_id;
|
||||
/**
|
||||
* 本记录的行_列
|
||||
*/
|
||||
String row_col;
|
||||
/**
|
||||
* sheet序号
|
||||
*/
|
||||
String index;
|
||||
/**
|
||||
* 状态是否当前sheet页
|
||||
*/
|
||||
Integer status;
|
||||
/**
|
||||
* 块编号 第一块 fblock
|
||||
*/
|
||||
String block_id;
|
||||
/**
|
||||
* json串
|
||||
*/
|
||||
JSONObject json_data;
|
||||
/**
|
||||
* 排序位置
|
||||
*/
|
||||
Integer order;
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
Integer is_delete;
|
||||
|
||||
/**
|
||||
* sheet页数据 未编号分组
|
||||
*/
|
||||
List<JSONObject> dataList;
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
|
||||
package com.anjiplus.template.gaea.business.modules.reportexcel.controller.param;
|
||||
|
||||
import com.anji.plus.gaea.curd.params.PageParam;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
/**
|
||||
* @author chenkening
|
||||
* @date 2021/4/13 15:12
|
||||
*/
|
||||
@Data
|
||||
public class ReportExcelParam extends PageParam implements Serializable {
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
package com.anjiplus.template.gaea.business.modules.reportexcel.dao;
|
||||
|
||||
import com.anji.plus.gaea.curd.mapper.GaeaBaseMapper;
|
||||
import com.anjiplus.template.gaea.business.modules.reportexcel.dao.entity.ReportExcel;
|
||||
|
||||
/**
|
||||
* @author chenkening
|
||||
* @date 2021/4/13 15:11
|
||||
*/
|
||||
public interface ReportExcelMapper extends GaeaBaseMapper<ReportExcel> {
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package com.anjiplus.template.gaea.business.modules.reportexcel.dao.entity;
|
||||
|
||||
import com.anji.plus.gaea.curd.entity.GaeaBaseEntity;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author chenkening
|
||||
* @date 2021/4/13 15:11
|
||||
*/
|
||||
@TableName(value = "gaea_report_excel")
|
||||
@Data
|
||||
public class ReportExcel extends GaeaBaseEntity {
|
||||
|
||||
@ApiModelProperty(value = "报表编码")
|
||||
private String reportCode;
|
||||
|
||||
@ApiModelProperty(value = "数据集编码,以|分割")
|
||||
private String setCodes;
|
||||
|
||||
@ApiModelProperty(value = "数据集查询参数")
|
||||
private String setParam;
|
||||
|
||||
@ApiModelProperty(value = "报表json字符串")
|
||||
private String jsonStr;
|
||||
|
||||
@ApiModelProperty(value = "0--已禁用 1--已启用 DIC_NAME=ENABLE_FLAG")
|
||||
private Integer enableFlag;
|
||||
|
||||
@ApiModelProperty(value = "0--未删除 1--已删除 DIC_NAME=DELETE_FLAG")
|
||||
private Integer deleteFlag;
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package com.anjiplus.template.gaea.business.modules.reportexcel.service;
|
||||
|
||||
|
||||
import com.anji.plus.gaea.curd.service.GaeaBaseService;
|
||||
import com.anjiplus.template.gaea.business.modules.reportexcel.controller.dto.ReportExcelDto;
|
||||
import com.anjiplus.template.gaea.business.modules.reportexcel.controller.param.ReportExcelParam;
|
||||
import com.anjiplus.template.gaea.business.modules.reportexcel.dao.entity.ReportExcel;
|
||||
|
||||
/**
|
||||
* TODO
|
||||
*
|
||||
* @author chenkening
|
||||
* @date 2021/4/13 15:14
|
||||
*/
|
||||
public interface ReportExcelService extends GaeaBaseService<ReportExcelParam, ReportExcel> {
|
||||
|
||||
/**
|
||||
* 根据报表编码查询详情
|
||||
*
|
||||
* @param reportCode
|
||||
* @return
|
||||
*/
|
||||
ReportExcelDto detailByReportCode(String reportCode);
|
||||
|
||||
/**
|
||||
* 报表预览
|
||||
*
|
||||
* @param reportExcelDto
|
||||
* @return
|
||||
*/
|
||||
ReportExcelDto preview(ReportExcelDto reportExcelDto);
|
||||
|
||||
|
||||
/**
|
||||
* 导出为excel
|
||||
*
|
||||
* @param reportExcelDto
|
||||
* @return
|
||||
*/
|
||||
Boolean exportExcel(ReportExcelDto reportExcelDto);
|
||||
|
||||
// Boolean exportPdf(ReportExcelDto reportExcelDto);
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package com.anjiplus.template.gaea.business.modules.reportexcel.util;
|
||||
|
||||
public class MSExcelUtil {
|
||||
public static final short EXCEL_COLUMN_WIDTH_FACTOR = 256;
|
||||
public static final short EXCEL_ROW_HEIGHT_FACTOR = 20;
|
||||
public static final int UNIT_OFFSET_LENGTH = 7;
|
||||
public static final int[] UNIT_OFFSET_MAP = new int[]{0, 36, 73, 109, 146, 182, 219};
|
||||
|
||||
public static short pixel2WidthUnits(int pxs) {
|
||||
short widthUnits = (short) (EXCEL_COLUMN_WIDTH_FACTOR * (pxs / UNIT_OFFSET_LENGTH));
|
||||
widthUnits += UNIT_OFFSET_MAP[(pxs % UNIT_OFFSET_LENGTH)];
|
||||
return widthUnits;
|
||||
}
|
||||
|
||||
public static int widthUnits2Pixel(short widthUnits) {
|
||||
int pixels = (widthUnits / EXCEL_COLUMN_WIDTH_FACTOR) * UNIT_OFFSET_LENGTH;
|
||||
int offsetWidthUnits = widthUnits % EXCEL_COLUMN_WIDTH_FACTOR;
|
||||
pixels += Math.floor((float) offsetWidthUnits / ((float) EXCEL_COLUMN_WIDTH_FACTOR / UNIT_OFFSET_LENGTH));
|
||||
return pixels;
|
||||
}
|
||||
|
||||
public static int heightUnits2Pixel(short heightUnits) {
|
||||
int pixels = (heightUnits / EXCEL_ROW_HEIGHT_FACTOR);
|
||||
int offsetWidthUnits = heightUnits % EXCEL_ROW_HEIGHT_FACTOR;
|
||||
pixels += Math.floor((float) offsetWidthUnits / ((float) EXCEL_ROW_HEIGHT_FACTOR / UNIT_OFFSET_LENGTH));
|
||||
return pixels;
|
||||
}
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
use
|
||||
aj_report;
|
||||
|
||||
|
||||
CREATE TABLE `gaea_report_excel`
|
||||
(
|
||||
`id` bigint(11) NOT NULL AUTO_INCREMENT,
|
||||
`report_code` varchar(100) DEFAULT NULL COMMENT '报表编码',
|
||||
`set_codes` varchar(255) DEFAULT NULL COMMENT '数据集编码,以|分割',
|
||||
`set_param` varchar(1024) DEFAULT NULL COMMENT '数据集查询参数',
|
||||
`json_str` text COMMENT '报表json串',
|
||||
`enable_flag` int(1) DEFAULT '1' COMMENT '0--已禁用 1--已启用 DIC_NAME=ENABLE_FLAG',
|
||||
`delete_flag` int(1) DEFAULT '0' COMMENT '0--未删除 1--已删除 DIC_NAME=DELETE_FLAG',
|
||||
`create_by` varchar(255) DEFAULT NULL COMMENT '创建人',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`update_by` varchar(255) DEFAULT NULL COMMENT '更新人',
|
||||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||||
`version` int(8) DEFAULT NULL COMMENT '版本号',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
UNIQUE KEY `UNIQUE_REPORT_CODE` (`report_code`) USING BTREE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=215 DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
INSERT INTO `aj_report`.`access_authority`(`id`, `parent_target`, `target`, `target_name`, `action`, `action_name`, `sort`, `enable_flag`, `delete_flag`, `create_by`, `create_time`, `update_by`, `update_time`, `version`) VALUES (234, 'report', 'bigScreenManage', '大屏报表', 'export', '导出大屏', 234, 1, 0, 'admin', '2019-07-23 15:59:40', 'admin', '2019-07-23 15:59:40', 1);
|
||||
INSERT INTO `aj_report`.`access_authority`(`id`, `parent_target`, `target`, `target_name`, `action`, `action_name`, `sort`, `enable_flag`, `delete_flag`, `create_by`, `create_time`, `update_by`, `update_time`, `version`) VALUES (235, 'report', 'bigScreenManage', '大屏报表', 'import', '导入大屏', 235, 1, 0, 'admin', '2019-07-23 15:59:40', 'admin', '2019-07-23 15:59:40', 1);
|
||||
INSERT INTO `aj_report`.`access_authority`(`id`, `parent_target`, `target`, `target_name`, `action`, `action_name`, `sort`, `enable_flag`, `delete_flag`, `create_by`, `create_time`, `update_by`, `update_time`, `version`) VALUES (236, 'report', 'excelManage', '表格报表', 'query', '查询报表', 236, 1, 0, 'admin', '2019-07-23 15:59:40', 'admin', '2019-07-23 15:59:40', 1);
|
||||
|
||||
INSERT INTO `aj_report`.`access_role_authority`(`id`, `role_code`, `target`, `action`) VALUES (default , 'root', 'bigScreenManage', 'export');
|
||||
INSERT INTO `aj_report`.`access_role_authority`(`id`, `role_code`, `target`, `action`) VALUES (default , 'root', 'bigScreenManage', 'import');
|
||||
|
||||
|
||||
UPDATE `aj_report`.`gaea_report` SET `report_type` = 'report_screen' WHERE `report_code` in ('log_ajreport', 'car_ajreport', 'acc_ajreport');
|
||||
|
@ -0,0 +1,22 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.anjiplus.template.gaea.business.modules.data.reportexcel.dao.ReportExcelMapper">
|
||||
|
||||
<resultMap type="com.anjiplus.template.gaea.business.modules.reportexcel.dao.entity.ReportExcel" id="ReportMap">
|
||||
<!--jdbcType="{column.columnType}"-->
|
||||
<result property="id" column="id" />
|
||||
<result property="reportCode" column="report_code" />
|
||||
<result property="setCodes" column="set_codes" />
|
||||
<result property="setParam" column="set_param" />
|
||||
<result property="jsonStr" column="json_str" />
|
||||
<result property="enableFlag" column="enable_flag" />
|
||||
<result property="deleteFlag" column="delete_flag" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="version" column="version" />
|
||||
|
||||
</resultMap>
|
||||
|
||||
|
||||
</mapper>
|