报表分享init

Raod 3 years ago
parent 2e2b7fe0d0
commit 15dea081b2

@ -13,7 +13,7 @@ import com.anjiplus.template.gaea.business.modules.dashboard.controller.dto.Repo
import com.anjiplus.template.gaea.business.modules.dashboard.dao.ReportDashboardMapper;
import com.anjiplus.template.gaea.business.modules.dashboard.service.ChartStrategy;
import com.anjiplus.template.gaea.business.modules.dashboard.service.ReportDashboardService;
import com.anjiplus.template.gaea.business.modules.dashboard.util.DateUtil;
import com.anjiplus.template.gaea.business.util.DateUtil;
import com.anjiplus.template.gaea.business.modules.dashboardwidget.controller.dto.ReportDashboardWidgetDto;
import com.anjiplus.template.gaea.business.modules.dashboardwidget.controller.dto.ReportDashboardWidgetValueDto;
import com.anjiplus.template.gaea.business.modules.dashboard.dao.entity.ReportDashboard;

@ -0,0 +1,66 @@
package com.anjiplus.template.gaea.business.modules.reportshare.controller;
import com.anji.plus.gaea.annotation.AccessKey;
import com.anji.plus.gaea.annotation.Permission;
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.anji.plus.gaea.utils.GaeaBeanUtils;
import com.anji.plus.gaea.utils.GaeaUtils;
import com.anjiplus.template.gaea.business.modules.reportshare.controller.dto.ReportShareDto;
import com.anjiplus.template.gaea.business.modules.reportshare.controller.param.ReportShareParam;
import com.anjiplus.template.gaea.business.modules.reportshare.dao.entity.ReportShare;
import com.anjiplus.template.gaea.business.modules.reportshare.service.ReportShareService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @desc controller
* @author Raod
* @date 2021-08-18 13:37:26.663
**/
@RestController
@Api(tags = "报表分享管理")
@RequestMapping("/reportShare")
@Permission(code = "ReportShare", name = "报表分享管理")
public class ReportShareController extends GaeaBaseController<ReportShareParam, ReportShare, ReportShareDto> {
@Autowired
private ReportShareService reportShareService;
@Override
public GaeaBaseService<ReportShareParam, ReportShare> getService() {
return reportShareService;
}
@Override
public ReportShare getEntity() {
return new ReportShare();
}
@Override
public ReportShareDto getDTO() {
return new ReportShareDto();
}
@GetMapping({"/{id}"})
@AccessKey
@Override
@Permission(code = "detail", name = "明细")
public ResponseBean detail(@PathVariable("id") Long id) {
this.logger.info("{}根据ID查询服务开始id为{}", this.getClass().getSimpleName(), id);
ReportShare result = reportShareService.getDetail(id);
ReportShareDto dto = this.getDTO();
GaeaBeanUtils.copyAndFormatter(result, dto);
ResponseBean responseBean = this.responseSuccessWithData(this.resultDtoHandle(dto));
this.logger.info("{}根据ID查询结束结果{}", this.getClass().getSimpleName(), GaeaUtils.toJSONString(responseBean));
return responseBean;
}
}

@ -0,0 +1,46 @@
package com.anjiplus.template.gaea.business.modules.reportshare.controller.dto;
import java.io.Serializable;
import com.anji.plus.gaea.curd.dto.GaeaBaseDTO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
*
* @description dto
* @author Raod
* @date 2021-08-18 13:37:26.663
**/
@Data
public class ReportShareDto extends GaeaBaseDTO implements Serializable {
/** 分享编码系统生成默认UUID */
@ApiModelProperty(value = "分享编码系统生成默认UUID")
private String shareCode;
/** 分享有效期类型DIC_NAME=SHARE_VAILD */
@ApiModelProperty(value = "分享有效期类型DIC_NAME=SHARE_VAILD")
private Integer shareValidType;
/** 分享有效期 */
@ApiModelProperty(value = "分享有效期")
private Date shareValidTime;
/** 分享url */
@ApiModelProperty(value = "分享url")
private String shareUrl;
/** 报表编码 */
@ApiModelProperty(value = "报表编码")
private String reportCode;
/** 0--已禁用 1--已启用 DIC_NAME=ENABLE_FLAG */
@ApiModelProperty(value = "0--已禁用 1--已启用 DIC_NAME=ENABLE_FLAG")
private Integer enableFlag;
/** 0--未删除 1--已删除 DIC_NAME=DELETE_FLAG */
@ApiModelProperty(value = "0--未删除 1--已删除 DIC_NAME=DELETE_FLAG")
private Integer deleteFlag;
}

@ -0,0 +1,16 @@
/**/
package com.anjiplus.template.gaea.business.modules.reportshare.controller.param;
import com.anji.plus.gaea.curd.params.PageParam;
import lombok.Data;
import java.io.Serializable;
/**
* @desc ReportShare
* @author Raod
* @date 2021-08-18 13:37:26.663
**/
@Data
public class ReportShareParam extends PageParam implements Serializable{
}

@ -0,0 +1,15 @@
package com.anjiplus.template.gaea.business.modules.reportshare.dao;
import com.anji.plus.gaea.curd.mapper.GaeaBaseMapper;
import com.anjiplus.template.gaea.business.modules.reportshare.dao.entity.ReportShare;
import org.apache.ibatis.annotations.Mapper;
/**
* ReportShare Mapper
* @author Raod
* @date 2021-08-18 13:37:26.663
**/
@Mapper
public interface ReportShareMapper extends GaeaBaseMapper<ReportShare> {
}

@ -0,0 +1,40 @@
package com.anjiplus.template.gaea.business.modules.reportshare.dao.entity;
import lombok.Data;
import io.swagger.annotations.ApiModelProperty;
import com.anji.plus.gaea.curd.entity.GaeaBaseEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import javax.validation.constraints.*;
import java.util.Date;
/**
* @description entity
* @author Raod
* @date 2021-08-18 13:37:26.663
**/
@TableName(value="gaea_report_share")
@Data
public class ReportShare extends GaeaBaseEntity {
/** 分享编码系统生成默认UUID */
private String shareCode;
/** 分享有效期类型DIC_NAME=SHARE_VAILD */
private Integer shareValidType;
/** 分享有效期 */
private Date shareValidTime;
/** 分享url */
private String shareUrl;
/** 报表编码 */
private String reportCode;
/** 0--已禁用 1--已启用 DIC_NAME=ENABLE_FLAG */
private Integer enableFlag;
/** 0--未删除 1--已删除 DIC_NAME=DELETE_FLAG */
private Integer deleteFlag;
}

@ -0,0 +1,23 @@
package com.anjiplus.template.gaea.business.modules.reportshare.service;
import com.anji.plus.gaea.curd.service.GaeaBaseService;
import com.anjiplus.template.gaea.business.modules.reportshare.controller.param.ReportShareParam;
import com.anjiplus.template.gaea.business.modules.reportshare.dao.entity.ReportShare;
/**
* @desc ReportShare
* @author Raod
* @date 2021-08-18 13:37:26.663
**/
public interface ReportShareService extends GaeaBaseService<ReportShareParam, ReportShare> {
/***
*
*
* @param id
* @return
*/
ReportShare getDetail(Long id);
}

@ -0,0 +1,64 @@
package com.anjiplus.template.gaea.business.modules.reportshare.service.impl;
import com.anji.plus.gaea.constant.BaseOperationEnum;
import com.anji.plus.gaea.curd.mapper.GaeaBaseMapper;
import com.anji.plus.gaea.exception.BusinessException;
import com.anjiplus.template.gaea.business.modules.reportshare.dao.ReportShareMapper;
import com.anjiplus.template.gaea.business.modules.reportshare.dao.entity.ReportShare;
import com.anjiplus.template.gaea.business.modules.reportshare.service.ReportShareService;
import com.anjiplus.template.gaea.business.util.DateUtil;
import com.anjiplus.template.gaea.business.util.MD5Util;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.UUID;
/**
* @desc ReportShare
* @author Raod
* @date 2021-08-18 13:37:26.663
**/
@Service
public class ReportShareServiceImpl implements ReportShareService {
@Autowired
private ReportShareMapper reportShareMapper;
@Override
public GaeaBaseMapper<ReportShare> getMapper() {
return reportShareMapper;
}
@Override
public ReportShare getDetail(Long id) {
ReportShare reportShare = this.selectOne(id);
return reportShare;
}
@Override
public void processBeforeOperation(ReportShare entity, BaseOperationEnum operationEnum) throws BusinessException {
switch (operationEnum) {
case INSERT:
//前端地址 window.location.href https://report.anji-plus.com/index.html#/report/bigscreen
//截取#之前的内容
//http://localhost:9528/#/bigscreen/viewer?reportCode=bigScreen2
//http://127.0.0.1:9095/reportDashboard/getData
String shareCode = UUID.randomUUID().toString();
entity.setShareCode(shareCode);
if (StringUtils.isNotBlank(entity.getShareUrl())) {
String prefix = entity.getShareUrl().substring(0, entity.getShareUrl().indexOf("#"));
entity.setShareUrl(prefix + "#/bigscreen/viewer?reportCode=" + entity.getReportCode());
}
entity.setShareValidTime(DateUtil.getFutureDateTmdHms(entity.getShareValidType()));
break;
case UPDATE:
break;
default:
break;
}
}
}

@ -1,7 +1,8 @@
package com.anjiplus.template.gaea.business.modules.dashboard.util;
package com.anjiplus.template.gaea.business.util;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
/**
@ -44,4 +45,25 @@ public class DateUtil {
return null;
}
}
/**
*
*
* @param day
* @return
*/
public static Date getFutureDateTmdHms(int day) {
if (day <= 0) {
//默认2099年
return parse("2099-01-01", defaultDatePattern);
}
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.DAY_OF_YEAR, calendar.get(Calendar.DAY_OF_YEAR) + day);
return calendar.getTime();
}
public static void main(String[] args) {
Date futureDateTmdHms = getFutureDateTmdHms(7);
System.out.println(futureDateTmdHms);
}
}

@ -0,0 +1,26 @@
<!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.reportshare.dao.ReportShareMapper">
<resultMap type="com.anjiplus.template.gaea.business.modules.reportshare.dao.entity.ReportShare" id="ReportShareMap">
<!--jdbcType="{column.columnType}"-->
<result property="id" column="id" />
<result property="shareCode" column="share_code" />
<result property="shareValidType" column="share_valid_type" />
<result property="shareValidTime" column="share_valid_time" />
<result property="shareUrl" column="share_url" />
<result property="reportCode" column="report_code" />
<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>
<sql id="Base_Column_List">
id,share_code,share_valid_type,share_valid_time,share_url,report_code,enable_flag,delete_flag,create_by,create_time,update_by,update_time,version
</sql>
</mapper>
Loading…
Cancel
Save