Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dsk-operate-sys-cscec
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fulixin
dsk-operate-sys-cscec
Commits
a8f2c632
Commit
a8f2c632
authored
Dec 29, 2023
by
liuChang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug修复
parent
a7bb1234
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
+9
-3
ExportService.java
...i/src/main/java/com/dsk/search/service/ExportService.java
+9
-3
No files found.
dsk-module/dsk-biz-api/src/main/java/com/dsk/search/service/ExportService.java
View file @
a8f2c632
package
com
.
dsk
.
search
.
service
;
package
com
.
dsk
.
search
.
service
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.date.DateTime
;
import
cn.hutool.core.date.DateTime
;
import
cn.hutool.core.map.MapUtil
;
import
cn.hutool.core.map.MapUtil
;
import
com.alibaba.fastjson2.JSONObject
;
import
com.alibaba.fastjson2.JSONObject
;
...
@@ -16,6 +17,7 @@ import com.dsk.system.domain.SysUserFileRecord;
...
@@ -16,6 +17,7 @@ import com.dsk.system.domain.SysUserFileRecord;
import
com.dsk.system.domain.vo.AptitudeVo
;
import
com.dsk.system.domain.vo.AptitudeVo
;
import
com.dsk.system.service.ISysUserFileRecordService
;
import
com.dsk.system.service.ISysUserFileRecordService
;
import
com.dsk.system.utils.DskOpenApiUtil
;
import
com.dsk.system.utils.DskOpenApiUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
...
@@ -34,6 +36,7 @@ import java.util.*;
...
@@ -34,6 +36,7 @@ import java.util.*;
* @Date 2023/12/06 16:40
* @Date 2023/12/06 16:40
**/
**/
@Service
@Service
@Slf4j
public
class
ExportService
{
public
class
ExportService
{
@Autowired
@Autowired
...
@@ -47,7 +50,7 @@ public class ExportService {
...
@@ -47,7 +50,7 @@ public class ExportService {
int
exportCount
=
1
;
int
exportCount
=
1
;
if
(
RedisUtils
.
hasKey
(
"aptitudeFileExportCount"
)){
if
(
RedisUtils
.
hasKey
(
"aptitudeFileExportCount"
)){
exportCount
=
RedisUtils
.
getCacheObject
(
"aptitudeFileExportCount"
);
exportCount
=
RedisUtils
.
getCacheObject
(
"aptitudeFileExportCount"
);
if
(
exportCount
>=
3
){
if
(
exportCount
>=
3
000
){
return
AjaxResult
.
error
(
"每天最多导出3次"
);
return
AjaxResult
.
error
(
"每天最多导出3次"
);
}
}
}
}
...
@@ -55,11 +58,14 @@ public class ExportService {
...
@@ -55,11 +58,14 @@ public class ExportService {
ComposeQueryDto
composeQueryDto
=
new
ComposeQueryDto
();
ComposeQueryDto
composeQueryDto
=
new
ComposeQueryDto
();
//识别Excel内容
//识别Excel内容
List
<
AptitudeVo
>
companyNameList
=
new
ExcelUtils
<>(
AptitudeVo
.
class
).
importExcel
(
file
.
getInputStream
(),
2
);
List
<
AptitudeVo
>
companyNameList
=
new
ExcelUtils
<>(
AptitudeVo
.
class
).
importExcel
(
file
.
getInputStream
(),
2
);
if
(
companyNameList
.
isEmpty
(
))
{
if
(
CollectionUtil
.
isEmpty
(
companyNameList
))
{
throw
new
ServiceException
(
"表格中不存在待查询数据!"
);
throw
new
ServiceException
(
"表格中不存在待查询数据!"
);
}
}
List
<
String
>
list
=
new
ArrayList
<>();
List
<
String
>
list
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
companyNameList
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
companyNameList
.
size
();
i
++)
{
if
(
null
==
companyNameList
.
get
(
i
)){
return
AjaxResult
.
error
(
"上传格式有误"
);
}
if
(
i
<
500
){
if
(
i
<
500
){
list
.
add
(
companyNameList
.
get
(
i
).
getCompanyName
());
list
.
add
(
companyNameList
.
get
(
i
).
getCompanyName
());
}
}
...
@@ -81,7 +87,7 @@ public class ExportService {
...
@@ -81,7 +87,7 @@ public class ExportService {
composeQueryDto
.
setExportBackUrl
(
EXPORT_BACK_URL
);
composeQueryDto
.
setExportBackUrl
(
EXPORT_BACK_URL
);
composeQueryDto
.
setExportExeclName
(
fileName
);
composeQueryDto
.
setExportExeclName
(
fileName
);
dskOpenApiUtil
.
requestBody
(
"/operate/export/zjyj/aptitude"
,
BeanUtil
.
beanToMap
(
composeQueryDto
,
false
,
false
));
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
));
RedisUtils
.
expire
(
"aptitudeFileExportCount"
,
Duration
.
ofHours
(
24
));
return
AjaxResult
.
success
();
return
AjaxResult
.
success
();
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment