bug: 政策法规资料导出问题

This commit is contained in:
wxyclub
2023-11-30 09:31:33 +08:00
parent 6928005f01
commit b859379639
4 changed files with 7 additions and 16 deletions
@@ -107,7 +107,7 @@ public class SarLawsInformationController extends BaseController<SarLawsInformat
@ApiOperation("导出政策法规资料信息")
@GetMapping("/exportLawsInformationInfo")
public ResponseMessage<?> exportLawsInformationInfo(SarLawsInformation sarLawsInformation, HttpServletResponse response,
public ResponseMessage<?> exportLawsInformationInfo(SarLawsInformation sarLawsInformation, String userId, HttpServletResponse response,
HttpServletRequest request) {
OutputStream os = null;
Workbook workbook = null;
@@ -119,13 +119,16 @@ public class SarLawsInformationController extends BaseController<SarLawsInformat
response.setHeader("Content-Disposition",
"attachment; filename=" + ReadExcel.encodeFileName(sarLawsInformation.getExportName()+".xlsx",
request));
if (StringUtils.isBlank(userId)) {
return Result.error("导出失败,用户ID为空");
}
// 导出数据,若指定了值则使用ids字段条件导出,否则根据条件导出
if (StrUtil.isNotBlank(sarLawsInformation.getExportIds())) {
List<String> idList = Arrays.asList(sarLawsInformation.getExportIds().split(","));
datas = informationService.getLawsInformationByIds(idList);
} else {
// 导出所有数据
datas = informationService.getAllLawsInformation(sarLawsInformation);
datas = informationService.getAllLawsInformation(sarLawsInformation, userId);
}
List<SarLawsInformationExport> datasExport = new ArrayList<>();
for (SarLawsInformation data : datas) {
@@ -36,7 +36,7 @@ public interface SarLawsInformationService extends IService<SarLawsInformation>
* @param sarLawsInformation 法规资料对象,用于查询
* @return 法规资料列表
*/
List<SarLawsInformation> getAllLawsInformation(SarLawsInformation sarLawsInformation);
List<SarLawsInformation> getAllLawsInformation(SarLawsInformation sarLawsInformation, String userId);
ResponseMessage<?> importLawsInformationInfo(MultipartFile file);
}
@@ -355,8 +355,7 @@ public class SarLawsInformationServiceImpl extends ServiceImpl<SarLawsInformatio
}
@Override
public List<SarLawsInformation> getAllLawsInformation(SarLawsInformation sarLawsInformation) {
String userId = LoginUserUtil.getUserId();
public List<SarLawsInformation> getAllLawsInformation(SarLawsInformation sarLawsInformation, String userId) {
// 查询有权限的资料ID
LambdaQueryWrapper<SarLawsInformationAuth> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SarLawsInformationAuth::getUserId, userId);
@@ -156,22 +156,11 @@ public class SarLawsTopicServiceImpl extends ServiceImpl<SarLawsTopicMapper, Sar
return false;
}
SarLawsTopic lawsTopicInfoDB = getLawsTopicInfo(lawsTopic.getId());
log.error("====================新的================" + sdf.format(lawsTopic.getStartTime()));
log.error("====================旧的================" + sdf.format(lawsTopicInfoDB.getStartTime()));
if (lawsTopic.getCloseTime()!= null) {
log.error("====================新的================" + sdf.format(lawsTopic.getCloseTime()));
}
if (lawsTopicInfoDB.getCloseTime() != null) {
log.error("====================旧的================" + sdf.format(lawsTopicInfoDB.getCloseTime()));
}
List<String> compareList = compareLawsTopic(lawsTopicInfoDB, lawsTopic);
if (compareLawsTopic(lawsTopicInfoDB, lawsTopic).size() == 0) {
return true;
}
lawsTopic.setModifyTime(new Date());
for (String s : compareList) {
log.error("====================变更项====================" + s);
}
int update = this.baseMapper.updateById(lawsTopic);
// 比较列表字段是否经过修改,如果经过修改,先删除,再添加
if (compareList.contains("课题组会议列表被变更")) {