qianlishi 3 years ago
commit 1f0d2ea0cd

@ -43,11 +43,11 @@ public class ReportController extends GaeaBaseController<ReportParam, Report, Re
return new ReportDto(); return new ReportDto();
} }
@GetMapping("/copy") @PostMapping("/copy")
@Permission(code = "copy", name = "复制") @Permission(code = "copy", name = "复制")
@GaeaAuditLog(pageTitle = "复制") @GaeaAuditLog(pageTitle = "复制")
public ResponseBean copy(@RequestParam("reportId") Long reportId) { public ResponseBean copy(@RequestBody ReportDto dto) {
reportService.copy(reportId); reportService.copy(dto);
return ResponseBean.builder().build(); return ResponseBean.builder().build();
} }
} }

@ -21,7 +21,7 @@ public interface ReportService extends GaeaBaseService<ReportParam, Report> {
/** /**
* *
* @param reportId * @param dto
*/ */
void copy(Long reportId); void copy(ReportDto dto);
} }

@ -3,7 +3,9 @@ package com.anjiplus.template.gaea.business.modules.report.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.anji.plus.gaea.exception.BusinessExceptionBuilder;
import com.anji.plus.gaea.utils.GaeaBeanUtils; import com.anji.plus.gaea.utils.GaeaBeanUtils;
import com.anjiplus.template.gaea.business.code.ResponseCode;
import com.anjiplus.template.gaea.business.enums.ReportTypeEnum; import com.anjiplus.template.gaea.business.enums.ReportTypeEnum;
import com.anjiplus.template.gaea.business.modules.dashboard.dao.entity.ReportDashboard; import com.anjiplus.template.gaea.business.modules.dashboard.dao.entity.ReportDashboard;
import com.anjiplus.template.gaea.business.modules.dashboard.service.ReportDashboardService; import com.anjiplus.template.gaea.business.modules.dashboard.service.ReportDashboardService;
@ -16,6 +18,7 @@ import com.anjiplus.template.gaea.business.modules.report.service.ReportService;
import com.anjiplus.template.gaea.business.modules.reportexcel.dao.entity.ReportExcel; import com.anjiplus.template.gaea.business.modules.reportexcel.dao.entity.ReportExcel;
import com.anjiplus.template.gaea.business.modules.reportexcel.service.ReportExcelService; import com.anjiplus.template.gaea.business.modules.reportexcel.service.ReportExcelService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -107,10 +110,16 @@ public class ReportServiceImpl implements ReportService {
} }
@Override @Override
public void copy(Long reportId) { public void copy(ReportDto dto) {
Report report = selectOne(reportId); if (null == dto.getId()) {
throw BusinessExceptionBuilder.build(ResponseCode.NOT_NULL, "id");
}
if (StringUtils.isBlank(dto.getReportCode())) {
throw BusinessExceptionBuilder.build(ResponseCode.NOT_NULL, "报表编码");
}
Report report = selectOne(dto.getId());
String reportCode = report.getReportCode(); String reportCode = report.getReportCode();
Report copyReport = copyReport(report); Report copyReport = copyReport(report, dto);
//复制主表数据 //复制主表数据
insert(copyReport); insert(copyReport);
String copyReportCode = copyReport.getReportCode(); String copyReportCode = copyReport.getReportCode();
@ -150,17 +159,12 @@ public class ReportServiceImpl implements ReportService {
} }
} }
private Report copyReport(Report report){ private Report copyReport(Report report, ReportDto dto){
//复制主表数据 //复制主表数据
Report copyReport = new Report(); Report copyReport = new Report();
GaeaBeanUtils.copyAndFormatter(report, copyReport); GaeaBeanUtils.copyAndFormatter(report, copyReport);
copyReport.setId(null); copyReport.setReportCode(dto.getReportCode());
String copyReportCode = copyReport.getReportCode().concat("_").concat(String.valueOf(System.currentTimeMillis())); copyReport.setReportName(dto.getReportName());
if (copyReportCode.length() >= 100) {
copyReportCode = copyReportCode.substring(0, 100);
}
copyReport.setReportCode(copyReportCode);
copyReport.setReportName(copyReport.getReportName().concat("_copy"));
return copyReport; return copyReport;
} }

@ -3,7 +3,7 @@
<div class="admin-title" @click="goBigScreen"> <div class="admin-title" @click="goBigScreen">
<div class="con"> <div class="con">
<img src="../../../../../static/logo-dp.png" width="50" /> <img src="../../../../../static/logo-dp.png" width="50" />
<span class="version">V0.9.7</span> <span class="version">V0.9.7.2</span>
</div> </div>
</div> </div>
<el-menu <el-menu

Loading…
Cancel
Save