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 b37ea21a
authored
Sep 25, 2023
by
谢海旭
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
[+]新增旅程客户数据导出接口
1 parent
55ba8505
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
188 additions
and
15 deletions
platform-process/src/main/java/cn/com/glsx/process/config/WebConfig.java
platform-process/src/main/java/cn/com/glsx/process/modules/controller/SopInstController.java
platform-process/src/main/java/cn/com/glsx/process/modules/model/SopCustomerExcelDTO.java
platform-process/src/main/java/cn/com/glsx/process/modules/service/SopInstService.java
platform-process/src/main/java/cn/com/glsx/process/config/WebConfig.java
View file @
b37ea21
...
@@ -61,16 +61,16 @@ public class WebConfig implements WebMvcConfigurer {
...
@@ -61,16 +61,16 @@ public class WebConfig implements WebMvcConfigurer {
//1.加入的顺序就是拦截器执行的顺序,
//1.加入的顺序就是拦截器执行的顺序,
//2.按顺序执行所有拦截器的preHandle
//2.按顺序执行所有拦截器的preHandle
//3.所有的preHandle 执行完再执行全部postHandle 最后是postHandle
//3.所有的preHandle 执行完再执行全部postHandle 最后是postHandle
//4.sop登录不拦截
//4.sop登录不拦截
TODO 所有请求暂时不校验登录
registry
.
addInterceptor
(
visitInterceptor
)
//
registry.addInterceptor(visitInterceptor)
.
addPathPatterns
(
"/**"
)
//
.addPathPatterns("/**")
.
excludePathPatterns
(
"/"
)
//
.excludePathPatterns("/")
.
excludePathPatterns
(
"/login"
)
//
.excludePathPatterns("/login")
.
excludePathPatterns
(
"/actuator/**"
)
//
.excludePathPatterns("/actuator/**")
.
excludePathPatterns
(
"/api/**"
)
//
.excludePathPatterns("/api/**")
.
excludePathPatterns
(
"/sop/**"
)
//
.excludePathPatterns("/sop/**")
.
excludePathPatterns
(
uploadProperties
.
getFilepath
())
//
.excludePathPatterns(uploadProperties.getFilepath())
.
excludePathPatterns
(
"/swagger-resources/**"
,
"/swagger-ui/**"
,
"/v3/**"
,
"/doc.html"
);
//
.excludePathPatterns("/swagger-resources/**", "/swagger-ui/**", "/v3/**", "/doc.html");
registry
.
addInterceptor
(
logInterceptor
).
addPathPatterns
(
"/**"
);
registry
.
addInterceptor
(
logInterceptor
).
addPathPatterns
(
"/**"
);
}
}
...
...
platform-process/src/main/java/cn/com/glsx/process/modules/controller/SopInstController.java
View file @
b37ea21
...
@@ -19,6 +19,7 @@ import org.springframework.validation.annotation.Validated;
...
@@ -19,6 +19,7 @@ import org.springframework.validation.annotation.Validated;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.Map
;
import
java.util.Map
;
@Slf4j
@Slf4j
...
@@ -55,11 +56,11 @@ public class SopInstController extends BaseController {
...
@@ -55,11 +56,11 @@ public class SopInstController extends BaseController {
return
sopInstService
.
stageUpdate
(
body
);
return
sopInstService
.
stageUpdate
(
body
);
}
}
// @Operation(summary = "查询模板实例客户分页列表", description = "查询模板实例客户分页列表
")
@Operation
(
summary
=
"导出客户数据"
,
description
=
"导出客户数据
"
)
//
@GetMapping("/customers/export")
@GetMapping
(
"/customers/export"
)
// public Result<PageInfo<CustomerSopJourneyDTO>> customersExport(SopCustomerSearch search
) {
public
void
customersExport
(
SopCustomerSearch
search
,
HttpServletResponse
response
)
{
// return null
;
sopInstService
.
customersExport
(
search
,
response
)
;
//
}
}
@Operation
(
summary
=
"查询模板实例客户详细信息"
,
description
=
"查询模板实例客户详细信息"
)
@Operation
(
summary
=
"查询模板实例客户详细信息"
,
description
=
"查询模板实例客户详细信息"
)
@GetMapping
(
"/customers/detail"
)
@GetMapping
(
"/customers/detail"
)
...
...
platform-process/src/main/java/cn/com/glsx/process/modules/model/SopCustomerExcelDTO.java
0 → 100644
View file @
b37ea21
package
cn
.
com
.
glsx
.
process
.
modules
.
model
;
import
com.alibaba.excel.annotation.ExcelIgnore
;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
java.util.Date
;
/**
*
*/
public
class
SopCustomerExcelDTO
{
@ExcelProperty
(
"客户姓名"
)
private
String
customerName
;
@ExcelProperty
(
"客户电话"
)
private
String
customerPhone
;
@ExcelProperty
(
"微信昵称"
)
private
String
wechatNickname
;
@ExcelProperty
(
"旅程"
)
private
String
sopJourneyName
;
@ExcelProperty
(
"进入旅程时间"
)
private
Date
sopJourneyEnterTime
;
@ExcelProperty
(
"所处旅程天数"
)
private
int
sopJourneyDays
;
@ExcelProperty
(
"旅程阶段"
)
private
String
sopJourneyStage
;
/**
* 进入当前sop旅程阶段时间
*/
@ExcelIgnore
private
Date
sopJourneyStageEnterTime
;
@ExcelProperty
(
"所处旅程阶段天数"
)
private
int
sopJourneyStageDays
;
public
String
getCustomerName
()
{
return
customerName
;
}
public
void
setCustomerName
(
String
customerName
)
{
this
.
customerName
=
customerName
;
}
public
String
getCustomerPhone
()
{
return
customerPhone
;
}
public
void
setCustomerPhone
(
String
customerPhone
)
{
this
.
customerPhone
=
customerPhone
;
}
public
String
getWechatNickname
()
{
return
wechatNickname
;
}
public
void
setWechatNickname
(
String
wechatNickname
)
{
this
.
wechatNickname
=
wechatNickname
;
}
public
String
getSopJourneyName
()
{
return
sopJourneyName
;
}
public
void
setSopJourneyName
(
String
sopJourneyName
)
{
this
.
sopJourneyName
=
sopJourneyName
;
}
public
Date
getSopJourneyEnterTime
()
{
return
sopJourneyEnterTime
;
}
public
void
setSopJourneyEnterTime
(
Date
sopJourneyEnterTime
)
{
this
.
sopJourneyEnterTime
=
sopJourneyEnterTime
;
}
public
int
getSopJourneyDays
()
{
Date
now
=
new
Date
();
long
nowTime
=
now
.
getTime
();
long
enterTime
=
sopJourneyEnterTime
.
getTime
();
long
num
=
nowTime
-
enterTime
;
return
(
int
)
(
num
/
24
/
60
/
60
/
1000
);
}
public
void
setSopJourneyDays
(
int
sopJourneyDays
)
{
this
.
sopJourneyDays
=
sopJourneyDays
;
}
public
String
getSopJourneyStage
()
{
return
sopJourneyStage
;
}
public
void
setSopJourneyStage
(
String
sopJourneyStage
)
{
this
.
sopJourneyStage
=
sopJourneyStage
;
}
public
Date
getSopJourneyStageEnterTime
()
{
return
sopJourneyStageEnterTime
;
}
public
void
setSopJourneyStageEnterTime
(
Date
sopJourneyStageEnterTime
)
{
this
.
sopJourneyStageEnterTime
=
sopJourneyStageEnterTime
;
}
public
int
getSopJourneyStageDays
()
{
// TODO 注意空指针
Date
now
=
new
Date
();
long
nowTime
=
now
.
getTime
();
long
enterTime
=
sopJourneyStageEnterTime
.
getTime
();
long
num
=
nowTime
-
enterTime
;
return
(
int
)
(
num
/
24
/
60
/
60
/
1000
);
}
public
void
setSopJourneyStageDays
(
int
sopJourneyStageDays
)
{
this
.
sopJourneyStageDays
=
sopJourneyStageDays
;
}
}
\ No newline at end of file
\ No newline at end of file
platform-process/src/main/java/cn/com/glsx/process/modules/service/SopInstService.java
View file @
b37ea21
...
@@ -18,9 +18,11 @@ import cn.com.glsx.process.modules.rabbitmq.MsgProducer;
...
@@ -18,9 +18,11 @@ import cn.com.glsx.process.modules.rabbitmq.MsgProducer;
import
cn.com.glsx.process.modules.rabbitmq.RabbitMQConstants
;
import
cn.com.glsx.process.modules.rabbitmq.RabbitMQConstants
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageInfo
;
import
com.github.pagehelper.PageInfo
;
import
com.glsx.plat.core.enums.SysConstants
;
import
com.glsx.plat.core.web.Result
;
import
com.glsx.plat.core.web.Result
;
import
com.glsx.plat.exception.ResultException
;
import
com.glsx.plat.exception.ResultException
;
import
com.glsx.plat.exception.SystemMessage
;
import
com.glsx.plat.exception.SystemMessage
;
import
com.glsx.plat.office.excel.EasyExcelUtils
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Lists
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -29,6 +31,7 @@ import org.springframework.util.Assert;
...
@@ -29,6 +31,7 @@ import org.springframework.util.Assert;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.StringUtils
;
import
org.springframework.util.StringUtils
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.*
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
...
@@ -382,6 +385,7 @@ public class SopInstService {
...
@@ -382,6 +385,7 @@ public class SopInstService {
/**
/**
* 单个更新旅程客户阶段
* 单个更新旅程客户阶段
* TODO 增加mq消息发送给cdp
*
*
* @param body
* @param body
* @return
* @return
...
@@ -395,4 +399,55 @@ public class SopInstService {
...
@@ -395,4 +399,55 @@ public class SopInstService {
request
.
setOprBy
(
body
.
getOprBy
());
request
.
setOprBy
(
body
.
getOprBy
());
return
customerSopJourneyFeignClientT
.
modifyStage
(
request
);
return
customerSopJourneyFeignClientT
.
modifyStage
(
request
);
}
}
public
void
customersExport
(
SopCustomerSearch
search
,
HttpServletResponse
response
)
{
search
.
setPageSize
(
5000
);
// TODO 空判断
SopInst
sopInst
=
sopInstMapper
.
selectByPrimaryKey
(
search
.
getSopJourneyId
());
List
<
SopCustomerExcelDTO
>
data
=
new
ArrayList
<>();
List
<
CustomerSopJourneyDTO
>
customerSopJourneyDTOList
=
new
ArrayList
<>();
getCustomersForExcel
(
search
,
customerSopJourneyDTOList
);
if
(
CollectionUtils
.
isEmpty
(
customerSopJourneyDTOList
))
{
return
;
}
customerSopJourneyDTOList
.
parallelStream
().
forEach
(
customerSopJourneyDTO
->
{
SopCustomerExcelDTO
sopCustomerExcelDTO
=
new
SopCustomerExcelDTO
();
sopCustomerExcelDTO
.
setCustomerName
(
customerSopJourneyDTO
.
getCustomerName
());
sopCustomerExcelDTO
.
setCustomerPhone
(
customerSopJourneyDTO
.
getCustomerPhone
());
sopCustomerExcelDTO
.
setWechatNickname
(
customerSopJourneyDTO
.
getWechatNickname
());
sopCustomerExcelDTO
.
setSopJourneyName
(
sopInst
.
getInstName
());
sopCustomerExcelDTO
.
setSopJourneyEnterTime
(
customerSopJourneyDTO
.
getSopJourneyEnterTime
());
sopCustomerExcelDTO
.
setSopJourneyStage
(
customerSopJourneyDTO
.
getSopJourneyStage
());
sopCustomerExcelDTO
.
setSopJourneyStageEnterTime
(
customerSopJourneyDTO
.
getSopJourneyStageEnterTime
());
data
.
add
(
sopCustomerExcelDTO
);
});
try
{
EasyExcelUtils
.
writeExcel
(
response
,
data
,
"客户数据"
,
"客户数据"
,
SopCustomerExcelDTO
.
class
);
}
catch
(
Exception
e
)
{
throw
ResultException
.
create
(
SystemMessage
.
DATA_HANDLE_ERROR
.
getCode
(),
"客户数据导出处理异常"
);
}
}
private
void
getCustomersForExcel
(
SopCustomerSearch
search
,
List
<
CustomerSopJourneyDTO
>
customerSopJourneyDTOList
)
{
Result
<
PageInfo
<
CustomerSopJourneyDTO
>>
customersResult
=
customers
(
search
);
if
(!
SysConstants
.
ResultStatus
.
success
.
getCode
().
equals
(
customersResult
.
getCode
()))
{
throw
ResultException
.
create
(
SystemMessage
.
MICROSERVICE_CALL_FAIL
.
getCode
(),
"查询客户数据接口异常"
);
}
PageInfo
<
CustomerSopJourneyDTO
>
pageInfo
=
customersResult
.
getData
();
List
<
CustomerSopJourneyDTO
>
list
=
pageInfo
.
getList
();
if
(
CollectionUtils
.
isEmpty
(
list
))
{
return
;
}
customerSopJourneyDTOList
.
addAll
(
list
);
if
(
search
.
getPageNumber
()
<
pageInfo
.
getPages
())
{
search
.
setPageNumber
(
search
.
getPageNumber
()
+
1
);
getCustomersForExcel
(
search
,
customerSopJourneyDTOList
);
}
}
}
}
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