|
@@ -4,16 +4,18 @@ package com.anjiplus.template.gaea.business.modules.reportshare.service.impl;
|
|
import com.anji.plus.gaea.constant.BaseOperationEnum;
|
|
import com.anji.plus.gaea.constant.BaseOperationEnum;
|
|
import com.anji.plus.gaea.curd.mapper.GaeaBaseMapper;
|
|
import com.anji.plus.gaea.curd.mapper.GaeaBaseMapper;
|
|
import com.anji.plus.gaea.exception.BusinessException;
|
|
import com.anji.plus.gaea.exception.BusinessException;
|
|
|
|
+import com.anjiplus.template.gaea.business.enums.EnableFlagEnum;
|
|
|
|
+import com.anjiplus.template.gaea.business.modules.reportshare.controller.dto.ReportShareDto;
|
|
import com.anjiplus.template.gaea.business.modules.reportshare.dao.ReportShareMapper;
|
|
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.dao.entity.ReportShare;
|
|
import com.anjiplus.template.gaea.business.modules.reportshare.service.ReportShareService;
|
|
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.DateUtil;
|
|
-import com.anjiplus.template.gaea.business.util.MD5Util;
|
|
|
|
-import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
-import java.util.Date;
|
|
|
|
import java.util.UUID;
|
|
import java.util.UUID;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -24,6 +26,13 @@ import java.util.UUID;
|
|
@Service
|
|
@Service
|
|
public class ReportShareServiceImpl implements ReportShareService {
|
|
public class ReportShareServiceImpl implements ReportShareService {
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 默认跳转路由为aj的页面
|
|
|
|
+ */
|
|
|
|
+ private static final String SHARE_FLAG = "#/aj/";
|
|
|
|
+
|
|
|
|
+ private static final String SHARE_URL = "#";
|
|
|
|
+
|
|
@Autowired
|
|
@Autowired
|
|
private ReportShareMapper reportShareMapper;
|
|
private ReportShareMapper reportShareMapper;
|
|
|
|
|
|
@@ -38,6 +47,22 @@ public class ReportShareServiceImpl implements ReportShareService {
|
|
return reportShare;
|
|
return reportShare;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public ReportShare insertShare(ReportShareDto dto) {
|
|
|
|
+ ReportShare entity = new ReportShare();
|
|
|
|
+ BeanUtils.copyProperties(dto, entity);
|
|
|
|
+ insert(entity);
|
|
|
|
+ return entity;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public ReportShare detailByCode(String shareCode) {
|
|
|
|
+ LambdaQueryWrapper<ReportShare> wrapper = Wrappers.lambdaQuery();
|
|
|
|
+ wrapper.eq(ReportShare::getShareCode, shareCode);
|
|
|
|
+ wrapper.eq(ReportShare::getEnableFlag, EnableFlagEnum.ENABLE.getCodeDesc());
|
|
|
|
+ return selectOne(wrapper);
|
|
|
|
+ }
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public void processBeforeOperation(ReportShare entity, BaseOperationEnum operationEnum) throws BusinessException {
|
|
public void processBeforeOperation(ReportShare entity, BaseOperationEnum operationEnum) throws BusinessException {
|
|
switch (operationEnum) {
|
|
switch (operationEnum) {
|
|
@@ -48,9 +73,11 @@ public class ReportShareServiceImpl implements ReportShareService {
|
|
//http://127.0.0.1:9095/reportDashboard/getData
|
|
//http://127.0.0.1:9095/reportDashboard/getData
|
|
String shareCode = UUID.randomUUID().toString();
|
|
String shareCode = UUID.randomUUID().toString();
|
|
entity.setShareCode(shareCode);
|
|
entity.setShareCode(shareCode);
|
|
- if (StringUtils.isNotBlank(entity.getShareUrl())) {
|
|
|
|
|
|
+ if (entity.getShareUrl().contains(SHARE_URL)) {
|
|
String prefix = entity.getShareUrl().substring(0, entity.getShareUrl().indexOf("#"));
|
|
String prefix = entity.getShareUrl().substring(0, entity.getShareUrl().indexOf("#"));
|
|
- entity.setShareUrl(prefix + "#/bigscreen/viewer?reportCode=" + entity.getReportCode());
|
|
|
|
|
|
+ entity.setShareUrl(prefix + SHARE_FLAG + shareCode);
|
|
|
|
+ } else {
|
|
|
|
+ entity.setShareUrl(entity.getShareUrl() + SHARE_FLAG + shareCode);
|
|
}
|
|
}
|
|
entity.setShareValidTime(DateUtil.getFutureDateTmdHms(entity.getShareValidType()));
|
|
entity.setShareValidTime(DateUtil.getFutureDateTmdHms(entity.getShareValidType()));
|
|
break;
|
|
break;
|