Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
platform
/
platform-process-server
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit abf7e298
authored
Sep 26, 2023
by
谢海旭
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
旅程客户数据导出接口调整为返回文件url
1 parent
67114fea
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
12 deletions
platform-process/src/main/java/cn/com/glsx/process/modules/controller/SopInstController.java
platform-process/src/main/java/cn/com/glsx/process/modules/service/SopInstService.java
platform-process/src/main/java/cn/com/glsx/process/modules/controller/SopInstController.java
View file @
abf7e29
...
...
@@ -9,6 +9,7 @@ import cn.com.glsx.process.modules.model.SopInstDTO;
import
cn.com.glsx.process.modules.model.SopInstSearch
;
import
cn.com.glsx.process.modules.model.SopJourneyStageUpdate
;
import
cn.com.glsx.process.modules.service.SopInstService
;
import
cn.com.glsx.process.util.FileUploadServerData
;
import
com.github.pagehelper.PageInfo
;
import
com.glsx.plat.core.annotation.ResponseResultBody
;
import
com.glsx.plat.core.web.Result
;
...
...
@@ -19,7 +20,6 @@ import org.springframework.validation.annotation.Validated;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.Map
;
@Slf4j
...
...
@@ -58,8 +58,8 @@ public class SopInstController extends BaseController {
@Operation
(
summary
=
"导出客户数据"
,
description
=
"导出客户数据"
)
@GetMapping
(
"/customers/export"
)
public
void
customersExport
(
SopCustomerSearch
search
,
HttpServletResponse
response
)
{
sopInstService
.
customersExport
(
search
,
response
);
public
FileUploadServerData
customersExport
(
SopCustomerSearch
search
)
{
return
sopInstService
.
customersExport
(
search
);
}
@Operation
(
summary
=
"查询模板实例客户详细信息"
,
description
=
"查询模板实例客户详细信息"
)
...
...
platform-process/src/main/java/cn/com/glsx/process/modules/service/SopInstService.java
View file @
abf7e29
...
...
@@ -16,6 +16,8 @@ import cn.com.glsx.process.modules.model.*;
import
cn.com.glsx.process.modules.model.enums.SopInstStatusEnum
;
import
cn.com.glsx.process.modules.rabbitmq.MsgProducer
;
import
cn.com.glsx.process.modules.rabbitmq.RabbitMQConstants
;
import
cn.com.glsx.process.util.FileUploadServerData
;
import
cn.com.glsx.process.util.FileUploadUtil
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageInfo
;
import
com.glsx.plat.core.enums.SysConstants
;
...
...
@@ -31,7 +33,7 @@ import org.springframework.util.Assert;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.StringUtils
;
import
java
x.servlet.http.HttpServletResponse
;
import
java
.io.ByteArrayOutputStream
;
import
java.util.*
;
import
java.util.stream.Collectors
;
...
...
@@ -326,7 +328,7 @@ public class SopInstService {
//页面选择是否跳过处理
SopInstNode
sopInstNodeTemp
=
customNodesMap
.
get
(
sopInstNode
.
getNodeId
());
sopInstNode
.
setNodeSkip
(!
Objects
.
isNull
(
sopInstNodeTemp
)
?
sopInstNodeTemp
.
getNodeSkip
():
SopInstNode
.
NODE_SKIP_FALSE
);
sopInstNode
.
setNodeSkip
(!
Objects
.
isNull
(
sopInstNodeTemp
)
?
sopInstNodeTemp
.
getNodeSkip
()
:
SopInstNode
.
NODE_SKIP_FALSE
);
sopInstNodes
.
add
(
sopInstNode
);
});
sopInstNodeMapper
.
insertList
(
sopInstNodes
);
...
...
@@ -356,16 +358,16 @@ public class SopInstService {
String
sopJourneyStage
=
search
.
getSopJourneyStage
();
request
.
setSopJourneyStages
(
StringUtils
.
hasLength
(
sopJourneyStage
)
?
Lists
.
newArrayList
(
sopJourneyStage
)
:
null
);
request
.
setSopJourneyStages
(
StringUtils
.
hasLength
(
sopJourneyStage
)
?
Lists
.
newArrayList
(
sopJourneyStage
)
:
null
);
String
customerPhone
=
search
.
getCustomerPhone
();
request
.
setCustomerPhones
(
StringUtils
.
hasLength
(
customerPhone
)
?
Lists
.
newArrayList
(
customerPhone
)
:
null
);
request
.
setCustomerPhones
(
StringUtils
.
hasLength
(
customerPhone
)
?
Lists
.
newArrayList
(
customerPhone
)
:
null
);
request
.
setCustomerName
(
search
.
getCustomerName
());
request
.
setWechatNickname
(
search
.
getWechatNickname
());
String
sopFollowUpPersonId
=
search
.
getSopFollowUpPersonId
();
request
.
setSopFollowUpPersonIds
(
StringUtils
.
hasLength
(
sopFollowUpPersonId
)
?
Lists
.
newArrayList
(
sopFollowUpPersonId
)
:
null
);
request
.
setSopFollowUpPersonIds
(
StringUtils
.
hasLength
(
sopFollowUpPersonId
)
?
Lists
.
newArrayList
(
sopFollowUpPersonId
)
:
null
);
request
.
setSopFollowUpPersonPhone
(
search
.
getSopFollowUpPersonPhone
());
request
.
setSopJourneyEnterTimeBegin
(
search
.
getSopJourneyEnterTimeBegin
());
...
...
@@ -400,17 +402,19 @@ public class SopInstService {
return
customerSopJourneyFeignClientT
.
modifyStage
(
request
);
}
public
void
customersExport
(
SopCustomerSearch
search
,
HttpServletResponse
response
)
{
public
FileUploadServerData
customersExport
(
SopCustomerSearch
search
)
{
search
.
setPageSize
(
5000
);
// TODO 空判断
SopInst
sopInst
=
sopInstMapper
.
selectByPrimaryKey
(
search
.
getSopJourneyId
());
if
(
Objects
.
isNull
(
sopInst
))
{
throw
ResultException
.
create
(
SystemMessage
.
ARGS_ERROR
.
getCode
(),
"模板实例不存在"
);
}
List
<
SopCustomerExcelDTO
>
data
=
new
ArrayList
<>();
List
<
CustomerSopJourneyDTO
>
customerSopJourneyDTOList
=
new
ArrayList
<>();
getCustomersForExcel
(
search
,
customerSopJourneyDTOList
);
if
(
CollectionUtils
.
isEmpty
(
customerSopJourneyDTOList
))
{
return
;
return
null
;
}
customerSopJourneyDTOList
.
parallelStream
().
forEach
(
customerSopJourneyDTO
->
{
...
...
@@ -426,7 +430,11 @@ public class SopInstService {
});
try
{
EasyExcelUtils
.
writeExcel
(
response
,
data
,
"客户数据"
,
"客户数据"
,
SopCustomerExcelDTO
.
class
);
ByteArrayOutputStream
outputStream
=
new
ByteArrayOutputStream
();
EasyExcelUtils
.
writeExcel
(
outputStream
,
data
,
"客户数据"
,
SopCustomerExcelDTO
.
class
);
byte
[]
bytes
=
outputStream
.
toByteArray
();
FileUploadServerData
fileUploadServerData
=
FileUploadUtil
.
uploadToFileSystem
(
"客户数据"
,
bytes
,
"xlsx"
);
return
fileUploadServerData
;
}
catch
(
Exception
e
)
{
throw
ResultException
.
create
(
SystemMessage
.
DATA_HANDLE_ERROR
.
getCode
(),
"客户数据导出处理异常"
);
}
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment