Foming 3 years ago
parent 4fefe37cfe
commit bf6f3d9254

@ -0,0 +1,25 @@
package com.anjiplus.template.gaea.business.modules.data.report.constant;
import java.util.ArrayList;
import java.util.List;
/**
*
*/
public class ExpConstant {
public static final String[] FUNCTION = new String[]{"=SUM(", "=AVERAGE(", "=MAX(", "=MIN(", "=IF(", "=AND(", "=OR(", "=CONCAT("};
public static List<Integer> getExpFunction(String e) {
List<Integer> counts = new ArrayList<>();
for (int i = 0; i < FUNCTION.length; i++) {
if(e.contains(FUNCTION[i])){
counts.add(i);
}
}
return counts;
}
}

@ -0,0 +1,60 @@
package com.anjiplus.template.gaea.business.modules.data.report.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.curd.controller.GaeaBaseController;
import com.anji.plus.gaea.curd.service.GaeaBaseService;
import com.anjiplus.template.gaea.business.modules.data.report.controller.dto.ReportDto;
import com.anjiplus.template.gaea.business.modules.data.report.controller.param.ReportParam;
import com.anjiplus.template.gaea.business.modules.data.report.dao.entity.Report;
import com.anjiplus.template.gaea.business.modules.data.report.service.ReportService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* TODO
*
* @author chenkening
* @date 2021/3/26 10:19
*/
@RestController
@Api(tags = "报表数据管理")
@RequestMapping("/report")
public class ReportController extends GaeaBaseController<ReportParam, Report, ReportDto> {
@Autowired
private ReportService reportService;
@Override
public GaeaBaseService<ReportParam, Report> getService() {
return reportService;
}
@Override
public Report getEntity() {
return new Report();
}
@Override
public ReportDto getDTO() {
return new ReportDto();
}
@DeleteMapping("/delReport")
@Permission(
code = "DELETE",
name = "删除"
)
@GaeaAuditLog(
pageTitle = "删除"
)
public ResponseBean delReport(@RequestBody ReportDto reportDto) {
reportService.delReport(reportDto);
return ResponseBean.builder().build();
}
}

@ -0,0 +1,44 @@
package com.anjiplus.template.gaea.business.modules.data.report.controller.dto;
import com.anji.plus.gaea.curd.dto.GaeaBaseDTO;
import lombok.Data;
import java.io.Serializable;
/**
* TODO
*
* @author chenkening
* @date 2021/3/26 10:34
*/
@Data
public class ReportDto extends GaeaBaseDTO implements Serializable {
/** 报表名称 */
private String reportName;
/** 报表编码 */
private String reportCode;
/**数据集编码,以|分割*/
private String setCodes;
/** 分组 */
private String reportGroup;
/** 备注 */
private String reportDesc;
/** 数据集查询参数 */
private String setParam;
/** 报表json字符串 */
private String jsonStr;
/** 报表类型 */
private String reportType;
/** 数据总计 */
private long total;
}

@ -0,0 +1,30 @@
package com.anjiplus.template.gaea.business.modules.data.report.controller.param;
import com.anji.plus.gaea.annotation.Query;
import com.anji.plus.gaea.constant.QueryEnum;
import com.anji.plus.gaea.curd.params.PageParam;
import lombok.Data;
import java.io.Serializable;
/**
* TODO
*
* @author chenkening
* @date 2021/3/26 10:40
*/
@Data
public class ReportParam extends PageParam implements Serializable{
/** 报表名称 */
@Query(QueryEnum.LIKE)
private String reportName;
/** 报表编码 */
@Query(QueryEnum.LIKE)
private String reportCode;
/** 报表类型 */
@Query(QueryEnum.EQ)
private String reportType;
}

@ -0,0 +1,13 @@
package com.anjiplus.template.gaea.business.modules.data.report.dao;
import com.anji.plus.gaea.curd.mapper.GaeaBaseMapper;
import com.anjiplus.template.gaea.business.modules.data.report.dao.entity.Report;
/**
* TODO
*
* @author chenkening
* @date 2021/3/26 10:19
*/
public interface ReportMapper extends GaeaBaseMapper<Report> {
}

@ -0,0 +1,41 @@
package com.anjiplus.template.gaea.business.modules.data.report.dao.entity;
import com.anji.plus.gaea.annotation.Unique;
import com.anji.plus.gaea.curd.entity.GaeaBaseEntity;
import com.anjiplus.template.gaea.common.RespCommonCode;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* TODO
*
* @author chenkening
* @date 2021/3/26 10:20
*/
@TableName(value="gaea_report")
@Data
public class Report extends GaeaBaseEntity {
@ApiModelProperty(value = "名称")
private String reportName;
@ApiModelProperty(value = "报表编码")
@Unique(code = RespCommonCode.REPORT_CODE_ISEXIST)
private String reportCode;
@ApiModelProperty(value = "分组")
private String reportGroup;
@ApiModelProperty(value = "报表描述")
private String reportDesc;
@ApiModelProperty(value = "报表类型")
private String reportType;
@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,17 @@
package com.anjiplus.template.gaea.business.modules.data.report.service;
import com.anji.plus.gaea.curd.service.GaeaBaseService;
import com.anjiplus.template.gaea.business.modules.data.report.controller.dto.ReportDto;
import com.anjiplus.template.gaea.business.modules.data.report.controller.param.ReportParam;
import com.anjiplus.template.gaea.business.modules.data.report.dao.entity.Report;
/**
* TODO
*
* @author chenkening
* @date 2021/3/26 10:35
*/
public interface ReportService extends GaeaBaseService<ReportParam, Report> {
void delReport(ReportDto reportDto);
}

@ -0,0 +1,45 @@
package com.anjiplus.template.gaea.business.modules.data.report.service.impl;
import com.anji.plus.gaea.curd.mapper.GaeaBaseMapper;
import com.anjiplus.template.gaea.business.modules.data.report.controller.dto.ReportDto;
import com.anjiplus.template.gaea.business.modules.data.report.dao.ReportMapper;
import com.anjiplus.template.gaea.business.modules.data.report.dao.entity.Report;
import com.anjiplus.template.gaea.business.modules.data.report.service.ReportService;
import com.anjiplus.template.gaea.business.modules.data.reportexcel.dao.ReportExcelMapper;
import com.anjiplus.template.gaea.business.modules.data.reportexcel.dao.entity.ReportExcel;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* TODO
*
* @author chenkening
* @date 2021/3/26 10:35
*/
@Service
public class ReportServiceImpl implements ReportService {
private Logger logger = LoggerFactory.getLogger(this.getClass());
@Autowired
private ReportMapper reportMapper;
@Autowired
private ReportExcelMapper reportExcelMapper;
@Override
public GaeaBaseMapper<Report> getMapper() {
return reportMapper;
}
@Override
public void delReport(ReportDto reportDto) {
deleteById(reportDto.getId());
QueryWrapper<ReportExcel> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("report_code" , reportDto.getReportCode());
reportExcelMapper.delete(queryWrapper);
}
}
Loading…
Cancel
Save