fix(自定义对比): 导出问题修复
This commit is contained in:
+20
-20
@@ -19,26 +19,26 @@
|
||||
</select>
|
||||
|
||||
<sql id="queryInfo">
|
||||
select i.id,
|
||||
list_name,
|
||||
group_concat(s.standard_number order by s.create_by) referenceStandard,
|
||||
(select group_concat(os.country_or_region order by s.create_by)
|
||||
from laws_custom_compare_info_standard s1
|
||||
left join laws_overseas_standard os on s1.standard_id = os.id and s1.standard_type = '2' and os.del_flag = 0
|
||||
where s1.del_flag = 0 and s1.info_id = i.id
|
||||
) referenceCountry,
|
||||
is_show,
|
||||
concat(u.realname, '(', u.username, ')') author,
|
||||
i.create_by,
|
||||
i.create_time,
|
||||
i.update_by,
|
||||
i.update_time,
|
||||
i.del_flag
|
||||
from laws_custom_compare_info i
|
||||
left join laws_custom_compare_info_standard s on i.id = s.info_id and s.del_flag = 0
|
||||
left join sys_user u on i.create_by = u.username and u.del_flag = 0
|
||||
${ew.customSqlSegment}
|
||||
group by i.id
|
||||
select * from (select i.id,
|
||||
list_name,
|
||||
group_concat(s.standard_number order by s.create_by) referenceStandard,
|
||||
(select group_concat(os.country_or_region order by s.create_by)
|
||||
from laws_custom_compare_info_standard s1
|
||||
left join laws_overseas_standard os on s1.standard_id = os.id and s1.standard_type = '2' and os.del_flag = 0
|
||||
where s1.del_flag = 0 and s1.info_id = i.id
|
||||
) referenceCountry,
|
||||
is_show,
|
||||
concat(u.realname, '(', u.username, ')') author,
|
||||
i.create_by,
|
||||
i.create_time,
|
||||
i.update_by,
|
||||
i.update_time,
|
||||
i.del_flag
|
||||
from laws_custom_compare_info i
|
||||
left join laws_custom_compare_info_standard s on i.id = s.info_id and s.del_flag = 0
|
||||
left join sys_user u on i.create_by = u.username and u.del_flag = 0
|
||||
group by i.id) t
|
||||
${ew.customSqlSegment}
|
||||
</sql>
|
||||
|
||||
<sql id="queryStandard">
|
||||
|
||||
+12
-7
@@ -107,9 +107,9 @@ public class LawsCustomCompareInfoServiceImpl extends ServiceImpl<LawsCustomComp
|
||||
QueryWrapper<LawsCustomCompareInfoVO> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.like(StringUtils.isNotBlank(lawsCustomCompareInfoVO.getListName()), "list_name", lawsCustomCompareInfoVO.getListName());
|
||||
queryWrapper.like(StringUtils.isNotBlank(lawsCustomCompareInfoVO.getReferenceStandard()), "referenceStandard", lawsCustomCompareInfoVO.getReferenceStandard());
|
||||
if (StringUtils.isNotBlank(lawsCustomCompareInfoVO.getListName())){
|
||||
List<String> list = Arrays.asList(lawsCustomCompareInfoVO.getListName().split(","));
|
||||
queryWrapper.and(qw -> list.forEach(v -> qw.or(iqw -> iqw.eq("referenceCountry", v))));
|
||||
if (StringUtils.isNotBlank(lawsCustomCompareInfoVO.getReferenceCountry())){
|
||||
List<String> list = Arrays.asList(lawsCustomCompareInfoVO.getReferenceCountry().split(","));
|
||||
queryWrapper.and(qw -> list.forEach(v -> qw.or(iqw -> iqw.like("referenceCountry", v))));
|
||||
}
|
||||
queryWrapper.like(StringUtils.isNotBlank(lawsCustomCompareInfoVO.getAuthor()), "username", lawsCustomCompareInfoVO.getAuthor());
|
||||
queryWrapper.like(StringUtils.isNotBlank(lawsCustomCompareInfoVO.getIsShow()), "is_show", lawsCustomCompareInfoVO.getIsShow());
|
||||
@@ -118,10 +118,10 @@ public class LawsCustomCompareInfoServiceImpl extends ServiceImpl<LawsCustomComp
|
||||
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
List<String> roleIds = Arrays.asList(loginUser.getRoleIds().split(","));
|
||||
if (!roleIds.contains("admin")){
|
||||
queryWrapper.eq("i.create_by", loginUser.getId());
|
||||
queryWrapper.eq("create_by", loginUser.getId());
|
||||
queryWrapper.eq("is_show", LawsCustomCompareCommon.IS_SHOW_1);
|
||||
}
|
||||
queryWrapper.eq("i.del_flag", 0);
|
||||
queryWrapper.eq("del_flag", 0);
|
||||
return lawsCustomCompareInfoMapper.queryByPage(new Page<>(pageNo, pageSize), queryWrapper);
|
||||
}
|
||||
|
||||
@@ -168,7 +168,7 @@ public class LawsCustomCompareInfoServiceImpl extends ServiceImpl<LawsCustomComp
|
||||
@Override
|
||||
public LawsCustomCompareInfoVO queryById(String id) {
|
||||
QueryWrapper<LawsCustomCompareInfoVO> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("i.id", id);
|
||||
queryWrapper.eq("id", id);
|
||||
return lawsCustomCompareInfoMapper.queryById(queryWrapper);
|
||||
}
|
||||
|
||||
@@ -455,11 +455,16 @@ public class LawsCustomCompareInfoServiceImpl extends ServiceImpl<LawsCustomComp
|
||||
if (StringUtils.isNotBlank(v.getFileId())){
|
||||
OSSFile ossFile = iossFileService.getById(v.getFileId());
|
||||
InputStream download = MinioUtil.download(ossFile.getUrl());
|
||||
inputStreamToFile(download, exportExcelTempPath);
|
||||
inputStreamToFile(download, exportExcelTempPath + File.separator + ossFile.getFileName());
|
||||
}
|
||||
}
|
||||
|
||||
public void inputStreamToFile (InputStream inputStream, String filePath) {
|
||||
File saveFile = new File(exportExcelTempPath);
|
||||
// 导出路径 没有则创建
|
||||
if (!saveFile.exists()) {
|
||||
saveFile.mkdirs();
|
||||
}
|
||||
File file = new File(filePath);
|
||||
try (FileOutputStream outputStream = new FileOutputStream(file)){
|
||||
int bytesRead;
|
||||
|
||||
Reference in New Issue
Block a user