feat: 新增报表接口 文件内容存数据库
现在报表添加接口,会同时将报表文件的内容存入数据库
This commit is contained in:
@@ -79,7 +79,7 @@ public class ReportManageConroller {
|
||||
@ApiOperation("新增或编辑报告")
|
||||
@PostMapping("/add")
|
||||
@ReportLog(description = "新增或编辑")
|
||||
public ResponseMessage add(@RequestBody ReportVo vo) {
|
||||
public ResponseMessage add(@RequestBody ReportVo vo) throws IOException {
|
||||
ReportEntity entity = new ReportEntity();
|
||||
BeanUtils.copyProperties(vo, entity);
|
||||
String name = reportService.insert(entity, vo.getLabelList());
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.adc.da.report.vo.ReportQueryVo;
|
||||
import com.adc.da.report.vo.ReportVo;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -20,7 +21,7 @@ public interface IReportService {
|
||||
* @param labelList
|
||||
* @return 报告名称
|
||||
*/
|
||||
String insert(ReportEntity entity, List<String> labelList);
|
||||
String insert(ReportEntity entity, List<String> labelList) throws IOException;
|
||||
|
||||
/**
|
||||
* 报告列表展示
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.adc.da.report.eo.FileEntity;
|
||||
import com.adc.da.report.eo.ReportEntity;
|
||||
import com.adc.da.report.eo.ReportLabelEntity;
|
||||
import com.adc.da.report.eo.ReportUserEntity;
|
||||
import com.adc.da.report.service.IReportContentService;
|
||||
import com.adc.da.report.service.IReportLabelService;
|
||||
import com.adc.da.report.service.IReportService;
|
||||
import com.adc.da.report.service.ITreeLabelService;
|
||||
@@ -40,6 +41,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import javax.annotation.Resource;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -93,6 +95,9 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
|
||||
@Autowired
|
||||
private RoleEODao roleEODao;
|
||||
|
||||
@Resource
|
||||
private IReportContentService iReportContentService;
|
||||
|
||||
@Autowired
|
||||
private LocalFileUtil localFileUtil;
|
||||
|
||||
@@ -105,7 +110,7 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public String insert(ReportEntity entity, List<String> labelList) {
|
||||
public String insert(ReportEntity entity, List<String> labelList) throws IOException {
|
||||
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
if (StringUtils.isEmpty(entity.getId())) {
|
||||
@@ -130,6 +135,9 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
|
||||
reportLabelDao.insert(reportLabelEntity);
|
||||
});
|
||||
|
||||
//插入报表内容表
|
||||
iReportContentService.insertReportContent(entity.getId() ,entity.getFileId());
|
||||
|
||||
CommonUtils.threadPoolExecutor().execute(() -> {
|
||||
//生成html
|
||||
try {
|
||||
@@ -223,7 +231,6 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
|
||||
idSet.add(reportLabelEntity.getReportId());
|
||||
});
|
||||
}
|
||||
// TODO ES模糊查询
|
||||
|
||||
IPage<ReportVo> list = reportDao.list(page, vo, idSet);
|
||||
|
||||
|
||||
@@ -2,124 +2,21 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.adc.da.report.dao.mysql.ReportDao">
|
||||
|
||||
|
||||
<!-- <select id="list" parameterType="com.adc.da.report.vo.ReportQueryVo" resultType="com.adc.da.report.vo.ReportVo">-->
|
||||
|
||||
<!-- select t1.id,t1.labelOneId,t1.labelTwoId,t1.labelThreeId,t1.labelOneName,t1.labelTwoName,t1.labelThreeName,t1.name,t1.year,t1.keyContent,t1.mainContent-->
|
||||
<!-- ,t1.department,date_format(t1.updateDate,'%Y-%m-%d') createDate,t1.fileId-->
|
||||
<!-- from(-->
|
||||
|
||||
<!-- (-->
|
||||
<!-- select distinct b1.*,(case when b3.name is null then '-' else b3.name end) labelOneName-->
|
||||
<!-- ,(case when b4.name is null then '-' else b4.name end) labelTwoName-->
|
||||
<!-- ,(case when b5.name is null then '-' else b5.name end) labelThreeName from-->
|
||||
<!-- (select * from TT_REPORT_MANAGE )b1-->
|
||||
<!-- left join TR_REPORT_USER b2 on b1.id=b2.reportId-->
|
||||
<!-- left join TS_LABEL b3 on b1.labelOneId=b3.id-->
|
||||
<!-- left join TS_LABEL b4 on b1.labelTwoId=b4.id-->
|
||||
<!-- left join TS_LABEL b5 on b1.labelThreeId=b5.id-->
|
||||
<!-- where b1.del_flag='0' and(b3.name is null or b4.name is null or b5.name is null )-->
|
||||
|
||||
<!-- <!–文本搜索–>-->
|
||||
<!-- <if test="Vo.keyContent !=null and Vo.keyContent !=''">-->
|
||||
<!-- and (b1.name like "%"#{Vo.keyContent}"%" or b1.keycontent like "%"#{Vo.keyContent}"%"-->
|
||||
<!-- or b1.maincontent like "%"#{Vo.keyContent}"%" or b1.department like "%"#{Vo.keyContent}"%")-->
|
||||
<!-- </if>-->
|
||||
|
||||
<!-- <!–年份搜索–>-->
|
||||
<!-- <if test="Vo.year !=null and Vo.year.size() >0">-->
|
||||
<!-- and b1.year in-->
|
||||
<!-- <foreach collection="Vo.year" item="year" open="(" separator="," close=")">-->
|
||||
<!-- #{year}-->
|
||||
<!-- </foreach>-->
|
||||
<!-- </if>-->
|
||||
|
||||
<!-- <!–标签搜索–>-->
|
||||
<!-- <if test="Vo.labelOneId !=null and Vo.labelOneId.size() >0">-->
|
||||
<!-- and b1.labelOneId in-->
|
||||
<!-- <foreach collection="Vo.labelOneId" item="labelOneId" open="(" separator="," close=")">-->
|
||||
<!-- #{labelOneId}-->
|
||||
<!-- </foreach>-->
|
||||
<!-- </if>-->
|
||||
|
||||
<!-- <if test="Vo.labelTwoId !=null and Vo.labelTwoId.size() >0">-->
|
||||
<!-- and b1.labelTwoId in-->
|
||||
<!-- <foreach collection="Vo.labelTwoId" item="labelTwoId" open="(" separator="," close=")">-->
|
||||
<!-- #{labelTwoId}-->
|
||||
<!-- </foreach>-->
|
||||
<!-- </if>-->
|
||||
|
||||
<!-- <if test="Vo.labelThreeId !=null and Vo.labelThreeId.size() >0">-->
|
||||
<!-- and b1.labelThreeId in-->
|
||||
<!-- <foreach collection="Vo.labelThreeId" item="labelThreeId" open="(" separator="," close=")">-->
|
||||
<!-- #{labelThreeId}-->
|
||||
<!-- </foreach>-->
|
||||
<!-- </if>-->
|
||||
|
||||
<!-- <if test="Vo.usid !=null and Vo.usid !=''">-->
|
||||
<!-- and b2.userId=#{Vo.usid}-->
|
||||
<!-- </if>-->
|
||||
|
||||
<!-- ORDER BY updateDate desc limit 999999999-->
|
||||
<!-- )-->
|
||||
<!-- UNION ALL-->
|
||||
<!-- (select distinct a1.* ,a3.name labelOneName,a4.name labelTwoName,a5.name labelThreeName from(select * from TT_REPORT_MANAGE ) a1-->
|
||||
<!-- left join TR_REPORT_USER a2 on a1.id=a2.reportId-->
|
||||
<!-- left join TS_LABEL a3 on a1.labelOneId=a3.id-->
|
||||
<!-- left join TS_LABEL a4 on a1.labelTwoId=a4.id-->
|
||||
<!-- left join TS_LABEL a5 on a1.labelThreeId=a5.id-->
|
||||
<!-- where a1.del_flag='0' and (a3.name is not null and a4.name is not null and a5.name is not null )-->
|
||||
<!-- <!–文本搜索–>-->
|
||||
<!-- <if test="Vo.keyContent !=null and Vo.keyContent !=''">-->
|
||||
<!-- and (a1.name like "%"#{Vo.keyContent}"%" or a1.keycontent like "%"#{Vo.keyContent}"%"-->
|
||||
<!-- or a1.maincontent like "%"#{Vo.keyContent}"%" or a1.department like "%"#{Vo.keyContent}"%" )-->
|
||||
<!-- </if>-->
|
||||
|
||||
<!-- <!–年份搜索–>-->
|
||||
<!-- <if test="Vo.year !=null and Vo.year.size >0">-->
|
||||
<!-- and a1.year in-->
|
||||
<!-- <foreach collection="Vo.year" item="year" open="(" separator="," close=")">-->
|
||||
<!-- #{year}-->
|
||||
<!-- </foreach>-->
|
||||
<!-- </if>-->
|
||||
|
||||
<!-- <!–标签搜索–>-->
|
||||
<!-- <if test="Vo.labelOneId !=null and Vo.labelOneId.size() >0">-->
|
||||
<!-- and a1.labelOneId in-->
|
||||
<!-- <foreach collection="Vo.labelOneId" item="labelOneId" open="(" separator="," close=")">-->
|
||||
<!-- #{labelOneId}-->
|
||||
<!-- </foreach>-->
|
||||
<!-- </if>-->
|
||||
|
||||
<!-- <if test="Vo.labelTwoId !=null and Vo.labelTwoId.size() >0">-->
|
||||
<!-- and a1.labelTwoId in-->
|
||||
<!-- <foreach collection="Vo.labelTwoId" item="labelTwoId" open="(" separator="," close=")">-->
|
||||
<!-- #{labelTwoId}-->
|
||||
<!-- </foreach>-->
|
||||
<!-- </if>-->
|
||||
|
||||
<!-- <if test="Vo.labelThreeId !=null and Vo.labelThreeId.size() >0">-->
|
||||
<!-- and a1.labelThreeId in-->
|
||||
<!-- <foreach collection="Vo.labelThreeId" item="labelThreeId" open="(" separator="," close=")">-->
|
||||
<!-- #{labelThreeId}-->
|
||||
<!-- </foreach>-->
|
||||
<!-- </if>-->
|
||||
|
||||
<!-- <if test="Vo.usid !=null and Vo.usid !=''">-->
|
||||
<!-- and a2.userId=#{Vo.usid}-->
|
||||
<!-- </if>-->
|
||||
<!-- ORDER BY updateDate desc limit 999999999)-->
|
||||
<!-- )t1-->
|
||||
|
||||
|
||||
<!-- </select>-->
|
||||
|
||||
<select id="list" parameterType="com.adc.da.report.vo.ReportQueryVo" resultType="com.adc.da.report.vo.ReportVo">
|
||||
SELECT DISTINCT t.id, t.year, t.name, t.keycontent, t.fileId, t.createDate, t.department, t.maincontent,
|
||||
t.confidentialLevel, t.privacyLevel
|
||||
SELECT DISTINCT
|
||||
t.id,
|
||||
t.year,
|
||||
t.name,
|
||||
t.keycontent,
|
||||
t.fileId,
|
||||
t.createDate,
|
||||
t.department,
|
||||
t.maincontent,
|
||||
t.confidentialLevel,
|
||||
t.privacyLevel
|
||||
FROM `tt_report_manage` AS t
|
||||
INNER JOIN ts_report_label AS trl ON t.id = trl.report_id
|
||||
WHERE 1 = 1
|
||||
WHERE t.delFlag = 0
|
||||
|
||||
<!--报表名称搜索-->
|
||||
<if test="Vo.name != null and Vo.name != ''">
|
||||
|
||||
Reference in New Issue
Block a user