Commit a8f2c632 authored by liuChang's avatar liuChang

bug修复

parent a7bb1234
package com.dsk.search.service;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.map.MapUtil;
import com.alibaba.fastjson2.JSONObject;
......@@ -16,6 +17,7 @@ import com.dsk.system.domain.SysUserFileRecord;
import com.dsk.system.domain.vo.AptitudeVo;
import com.dsk.system.service.ISysUserFileRecordService;
import com.dsk.system.utils.DskOpenApiUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
......@@ -34,6 +36,7 @@ import java.util.*;
* @Date 2023/12/06 16:40
**/
@Service
@Slf4j
public class ExportService {
@Autowired
......@@ -47,7 +50,7 @@ public class ExportService {
int exportCount = 1;
if (RedisUtils.hasKey("aptitudeFileExportCount")){
exportCount = RedisUtils.getCacheObject("aptitudeFileExportCount");
if (exportCount>=3){
if (exportCount>=3000){
return AjaxResult.error("每天最多导出3次");
}
}
......@@ -55,11 +58,14 @@ public class ExportService {
ComposeQueryDto composeQueryDto = new ComposeQueryDto();
//识别Excel内容
List<AptitudeVo> companyNameList = new ExcelUtils<>(AptitudeVo.class).importExcel(file.getInputStream(), 2);
if (companyNameList.isEmpty()) {
if (CollectionUtil.isEmpty(companyNameList)) {
throw new ServiceException("表格中不存在待查询数据!");
}
List<String> list = new ArrayList<>();
for (int i = 0; i < companyNameList.size(); i++) {
if (null==companyNameList.get(i)){
return AjaxResult.error("上传格式有误");
}
if (i<500){
list.add(companyNameList.get(i).getCompanyName());
}
......@@ -81,7 +87,7 @@ public class ExportService {
composeQueryDto.setExportBackUrl(EXPORT_BACK_URL);
composeQueryDto.setExportExeclName(fileName);
dskOpenApiUtil.requestBody("/operate/export/zjyj/aptitude", BeanUtil.beanToMap(composeQueryDto,false,false));
RedisUtils.setCacheObject("aptitudeFileExportCount",exportCount);
RedisUtils.setCacheObject("aptitudeFileExportCount",exportCount+1);
RedisUtils.expire("aptitudeFileExportCount", Duration.ofHours(24));
return AjaxResult.success();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment