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 fe0e451c
authored
Sep 26, 2023
by
zhouhaibao
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge remote-tracking branch 'origin/v1.0.1' into v1.0.1
2 parents
0d46bfb4
59de6caf
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
159 additions
and
40 deletions
platform-process-api/src/main/java/cn/com/glsx/process/modules/entity/SopInstNode.java
platform-process-api/src/main/java/cn/com/glsx/process/modules/model/SopInstCustomerStatisticDTO.java
platform-process-api/src/main/java/cn/com/glsx/process/modules/model/SopInstDTO.java
platform-process/src/main/java/cn/com/glsx/process/job/xxljob/core/SopXxlJobUtil.java
platform-process/src/main/java/cn/com/glsx/process/modules/client/CustomerSopJourneyFeignClient_T.java
platform-process/src/main/java/cn/com/glsx/process/modules/controller/SopController.java
platform-process/src/main/java/cn/com/glsx/process/modules/controller/SopInstController.java
platform-process/src/main/java/cn/com/glsx/process/modules/rabbitmq/MsgProducer.java
platform-process/src/main/java/cn/com/glsx/process/modules/rabbitmq/RabbitConfig.java
platform-process/src/main/java/cn/com/glsx/process/modules/service/SopInstService.java
platform-process-api/src/main/java/cn/com/glsx/process/modules/entity/SopInstNode.java
View file @
fe0e451
...
@@ -117,7 +117,7 @@ public class SopInstNode {
...
@@ -117,7 +117,7 @@ public class SopInstNode {
* 每日执行次数限制,0表示不限制。
* 每日执行次数限制,0表示不限制。
*/
*/
@Column
(
name
=
"daily_count"
)
@Column
(
name
=
"daily_count"
)
private
Integer
dailyCount
;
private
Integer
dailyCount
=
0
;
@Transient
@Transient
private
List
<
SopInstNode
>
sopInstNodeList
;
private
List
<
SopInstNode
>
sopInstNodeList
;
...
...
platform-process-api/src/main/java/cn/com/glsx/process/modules/model/SopInstCustomerStatisticDTO.java
0 → 100644
View file @
fe0e451
package
cn
.
com
.
glsx
.
process
.
modules
.
model
;
import
cn.com.glsx.process.modules.entity.SopInst
;
import
lombok.Data
;
import
org.springframework.beans.BeanUtils
;
import
java.util.Map
;
@Data
public
class
SopInstCustomerStatisticDTO
extends
SopInst
{
/**
* 客户统计数据:Map<阶段, 客户数>
*/
private
Map
<
String
,
Long
>
statistics
;
public
SopInstCustomerStatisticDTO
(
SopInst
inst
)
{
BeanUtils
.
copyProperties
(
inst
,
this
);
}
}
\ No newline at end of file
\ No newline at end of file
platform-process-api/src/main/java/cn/com/glsx/process/modules/model/SopInstDTO.java
View file @
fe0e451
...
@@ -3,6 +3,7 @@ package cn.com.glsx.process.modules.model;
...
@@ -3,6 +3,7 @@ package cn.com.glsx.process.modules.model;
import
cn.com.glsx.process.modules.entity.SopInstLink
;
import
cn.com.glsx.process.modules.entity.SopInstLink
;
import
cn.com.glsx.process.modules.entity.SopInstNode
;
import
cn.com.glsx.process.modules.entity.SopInstNode
;
import
cn.com.glsx.process.modules.entity.SopTplGrant
;
import
cn.com.glsx.process.modules.entity.SopTplGrant
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
...
@@ -39,8 +40,10 @@ public class SopInstDTO {
...
@@ -39,8 +40,10 @@ public class SopInstDTO {
*/
*/
private
String
instRemark
;
private
String
instRemark
;
@JsonFormat
(
timezone
=
"GMT+8"
,
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
createTime
;
private
Date
createTime
;
@JsonFormat
(
timezone
=
"GMT+8"
,
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
updateTime
;
private
Date
updateTime
;
/**
/**
...
...
platform-process/src/main/java/cn/com/glsx/process/job/xxljob/core/SopXxlJobUtil.java
View file @
fe0e451
...
@@ -67,7 +67,7 @@ public class SopXxlJobUtil {
...
@@ -67,7 +67,7 @@ public class SopXxlJobUtil {
job
=
new
XxlJobInfo
();
job
=
new
XxlJobInfo
();
}
}
job
.
setJobDesc
(
"加载所有SOP实例任务"
);
job
.
setJobDesc
(
"加载所有SOP实例任务"
);
job
.
setScheduleConf
(
"10
*/5 *
* * ?"
);
job
.
setScheduleConf
(
"10
0 */2
* * ?"
);
job
.
setExecutorHandler
(
SOP_LOAD_JOB_ID
);
job
.
setExecutorHandler
(
SOP_LOAD_JOB_ID
);
job
.
setBusKey
(
SOP_LOAD_JOB_ID
);
job
.
setBusKey
(
SOP_LOAD_JOB_ID
);
job
.
setTriggerStatus
(
1
);
job
.
setTriggerStatus
(
1
);
...
...
platform-process/src/main/java/cn/com/glsx/process/modules/client/CustomerSopJourneyFeignClient_T.java
View file @
fe0e451
package
cn
.
com
.
glsx
.
process
.
modules
.
client
;
package
cn
.
com
.
glsx
.
process
.
modules
.
client
;
import
cn.com.glsx.cdp.modules.model.customer.CustomerSopJourneyDTO
;
import
cn.com.glsx.cdp.modules.model.customer.*
;
import
cn.com.glsx.cdp.modules.model.customer.CustomerSopJourneyDetailDTO
;
import
cn.com.glsx.cdp.modules.model.customer.CustomerSopJourneySearch
;
import
cn.com.glsx.cdp.modules.model.customer.ModifySopJourneyStageRequest
;
import
com.github.pagehelper.PageInfo
;
import
com.github.pagehelper.PageInfo
;
import
com.glsx.plat.core.web.Result
;
import
com.glsx.plat.core.web.Result
;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.Operation
;
...
@@ -13,6 +10,8 @@ import org.springframework.web.bind.annotation.PostMapping;
...
@@ -13,6 +10,8 @@ import org.springframework.web.bind.annotation.PostMapping;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
java.util.List
;
/**
/**
* @Title: CustomerSopJourneyFeignClient.java
* @Title: CustomerSopJourneyFeignClient.java
* @Description: 客户sop旅程
* @Description: 客户sop旅程
...
@@ -35,4 +34,8 @@ public interface CustomerSopJourneyFeignClient_T {
...
@@ -35,4 +34,8 @@ public interface CustomerSopJourneyFeignClient_T {
@Operation
(
description
=
"修改客户旅程"
)
@Operation
(
description
=
"修改客户旅程"
)
@PostMapping
(
"/sopJourneyStage/modify"
)
@PostMapping
(
"/sopJourneyStage/modify"
)
Result
<
Boolean
>
modifyStage
(
@RequestBody
ModifySopJourneyStageRequest
request
);
Result
<
Boolean
>
modifyStage
(
@RequestBody
ModifySopJourneyStageRequest
request
);
@Operation
(
description
=
"查询客户旅程客户统计数据"
)
@PostMapping
(
"/statistics"
)
Result
<
List
<
CustomerSopJourneyStatisticsDTO
>>
statisticsCustomerSopJourney
(
@RequestBody
CustomerSopJourneySearch
request
);
}
}
platform-process/src/main/java/cn/com/glsx/process/modules/controller/SopController.java
View file @
fe0e451
...
@@ -23,7 +23,7 @@ import lombok.extern.slf4j.Slf4j;
...
@@ -23,7 +23,7 @@ import lombok.extern.slf4j.Slf4j;
@Slf4j
@Slf4j
@Tag
(
name
=
"sop服务"
)
@Tag
(
name
=
"sop服务"
)
@RestController
@RestController
@RequestMapping
(
value
=
"/sop"
)
@RequestMapping
(
value
=
"/sop
/api
"
)
@ResponseResultBody
@ResponseResultBody
public
class
SopController
{
public
class
SopController
{
...
...
platform-process/src/main/java/cn/com/glsx/process/modules/controller/SopInstController.java
View file @
fe0e451
...
@@ -4,11 +4,9 @@ import cn.com.glsx.cdp.modules.model.customer.CustomerSopJourneyDTO;
...
@@ -4,11 +4,9 @@ import cn.com.glsx.cdp.modules.model.customer.CustomerSopJourneyDTO;
import
cn.com.glsx.cdp.modules.model.customer.CustomerSopJourneyDetailDTO
;
import
cn.com.glsx.cdp.modules.model.customer.CustomerSopJourneyDetailDTO
;
import
cn.com.glsx.process.modules.BaseController
;
import
cn.com.glsx.process.modules.BaseController
;
import
cn.com.glsx.process.modules.entity.SopInst
;
import
cn.com.glsx.process.modules.entity.SopInst
;
import
cn.com.glsx.process.modules.model.SopCustomerSearch
;
import
cn.com.glsx.process.modules.model.*
;
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.modules.service.SopInstService
;
import
cn.com.glsx.process.util.FileUploadServerData
;
import
com.github.pagehelper.PageInfo
;
import
com.github.pagehelper.PageInfo
;
import
com.glsx.plat.core.annotation.ResponseResultBody
;
import
com.glsx.plat.core.annotation.ResponseResultBody
;
import
com.glsx.plat.core.web.Result
;
import
com.glsx.plat.core.web.Result
;
...
@@ -19,7 +17,6 @@ import org.springframework.validation.annotation.Validated;
...
@@ -19,7 +17,6 @@ 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
...
@@ -44,6 +41,12 @@ public class SopInstController extends BaseController {
...
@@ -44,6 +41,12 @@ public class SopInstController extends BaseController {
return
sopInstService
.
selectByGroupId
(
search
);
return
sopInstService
.
selectByGroupId
(
search
);
}
}
@Operation
(
summary
=
"查询门店下SOP模板实例分页列表(包含客户统计数据)"
,
description
=
"查询门店下SOP模板实例分页列表(包含客户统计数据)"
)
@GetMapping
(
"/customer/statistic"
)
public
PageInfo
<
SopInstCustomerStatisticDTO
>
selectByGroupIdWithCustomer
(
@Validated
SopInstSearch
search
)
{
return
sopInstService
.
selectByGroupIdWithCustomer
(
search
);
}
@Operation
(
summary
=
"查询模板实例客户分页列表"
,
description
=
"查询模板实例客户分页列表"
)
@Operation
(
summary
=
"查询模板实例客户分页列表"
,
description
=
"查询模板实例客户分页列表"
)
@GetMapping
(
"/customers"
)
@GetMapping
(
"/customers"
)
public
Result
<
PageInfo
<
CustomerSopJourneyDTO
>>
customers
(
SopCustomerSearch
search
)
{
public
Result
<
PageInfo
<
CustomerSopJourneyDTO
>>
customers
(
SopCustomerSearch
search
)
{
...
@@ -58,8 +61,8 @@ public class SopInstController extends BaseController {
...
@@ -58,8 +61,8 @@ public class SopInstController extends BaseController {
@Operation
(
summary
=
"导出客户数据"
,
description
=
"导出客户数据"
)
@Operation
(
summary
=
"导出客户数据"
,
description
=
"导出客户数据"
)
@GetMapping
(
"/customers/export"
)
@GetMapping
(
"/customers/export"
)
public
void
customersExport
(
SopCustomerSearch
search
,
HttpServletResponse
response
)
{
public
FileUploadServerData
customersExport
(
SopCustomerSearch
search
)
{
sopInstService
.
customersExport
(
search
,
response
);
return
sopInstService
.
customersExport
(
search
);
}
}
@Operation
(
summary
=
"查询模板实例客户详细信息"
,
description
=
"查询模板实例客户详细信息"
)
@Operation
(
summary
=
"查询模板实例客户详细信息"
,
description
=
"查询模板实例客户详细信息"
)
...
...
platform-process/src/main/java/cn/com/glsx/process/modules/rabbitmq/MsgProducer.java
View file @
fe0e451
...
@@ -35,8 +35,9 @@ public class MsgProducer implements RabbitTemplate.ConfirmCallback {
...
@@ -35,8 +35,9 @@ public class MsgProducer implements RabbitTemplate.ConfirmCallback {
*/
*/
public
void
topicSend
(
String
exchange
,
String
routingKey
,
Object
content
)
{
public
void
topicSend
(
String
exchange
,
String
routingKey
,
Object
content
)
{
CorrelationData
correlationId
=
new
CorrelationData
(
UUID
.
randomUUID
().
toString
());
CorrelationData
correlationId
=
new
CorrelationData
(
UUID
.
randomUUID
().
toString
());
log
.
info
(
"消息id:{},推送数据到mq:{}"
,
correlationId
,
JSON
.
toJSONString
(
content
));
String
contentJson
=
JSON
.
toJSONString
(
content
);
rabbitTemplate
.
convertAndSend
(
exchange
,
routingKey
,
content
,
correlationId
);
log
.
info
(
"消息id:{},推送数据到mq:{}"
,
correlationId
,
contentJson
);
rabbitTemplate
.
convertAndSend
(
exchange
,
routingKey
,
contentJson
,
correlationId
);
}
}
/**
/**
...
@@ -47,8 +48,9 @@ public class MsgProducer implements RabbitTemplate.ConfirmCallback {
...
@@ -47,8 +48,9 @@ public class MsgProducer implements RabbitTemplate.ConfirmCallback {
*/
*/
public
void
topicSend
(
String
routingKey
,
Object
content
)
{
public
void
topicSend
(
String
routingKey
,
Object
content
)
{
CorrelationData
correlationId
=
new
CorrelationData
(
UUID
.
randomUUID
().
toString
());
CorrelationData
correlationId
=
new
CorrelationData
(
UUID
.
randomUUID
().
toString
());
log
.
info
(
"消息id:{},推送数据到mq:{}"
,
correlationId
,
JSON
.
toJSONString
(
content
));
String
contentJson
=
JSON
.
toJSONString
(
content
);
rabbitTemplate
.
convertAndSend
(
RabbitMQConstants
.
TOPIC_EXCHANGE_PLATFORM_PROCESS
,
routingKey
,
content
,
correlationId
);
log
.
info
(
"消息id:{},推送数据到mq:{}"
,
correlationId
,
contentJson
);
rabbitTemplate
.
convertAndSend
(
RabbitMQConstants
.
TOPIC_EXCHANGE_PLATFORM_PROCESS
,
routingKey
,
contentJson
,
correlationId
);
}
}
/**
/**
...
...
platform-process/src/main/java/cn/com/glsx/process/modules/rabbitmq/RabbitConfig.java
View file @
fe0e451
...
@@ -2,6 +2,7 @@ package cn.com.glsx.process.modules.rabbitmq;
...
@@ -2,6 +2,7 @@ package cn.com.glsx.process.modules.rabbitmq;
import
org.springframework.amqp.core.*
;
import
org.springframework.amqp.core.*
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
...
@@ -9,13 +10,34 @@ import org.springframework.context.annotation.Configuration;
...
@@ -9,13 +10,34 @@ import org.springframework.context.annotation.Configuration;
@Configuration
@Configuration
public
class
RabbitConfig
{
public
class
RabbitConfig
{
public
static
final
String
DATA_REPORT_QUEUE_NAME
=
"dataReport_queue"
;
public
static
final
String
DATA_REPORT_EXCHANGE_NAME
=
"dataReport_exchange"
;
public
static
final
String
DATA_REPORT_TOPIC
=
"dataReport.#"
;
//声明topic交换机
//声明topic交换机
@Bean
@Bean
public
TopicExchange
topicExchange
(){
public
TopicExchange
topicExchange
()
{
//durable(true) 持久化,mq重启之后交换机还在
//durable(true) 持久化,mq重启之后交换机还在
return
ExchangeBuilder
.
topicExchange
(
RabbitMQConstants
.
TOPIC_EXCHANGE_PLATFORM_PROCESS
).
durable
(
true
).
build
();
return
ExchangeBuilder
.
topicExchange
(
RabbitMQConstants
.
TOPIC_EXCHANGE_PLATFORM_PROCESS
).
durable
(
true
).
build
();
}
}
@Bean
(
name
=
"dataReportQueue"
)
public
Queue
dataReportQueue
()
{
return
new
Queue
(
DATA_REPORT_QUEUE_NAME
,
true
);
}
@Bean
(
name
=
"dataReportTopicExchange"
)
public
TopicExchange
dataReportTopicExchange
()
{
return
new
TopicExchange
(
DATA_REPORT_EXCHANGE_NAME
);
}
@Bean
public
Binding
bindingDataReport
(
@Qualifier
(
"dataReportQueue"
)
Queue
dataReportQueue
,
@Qualifier
(
"dataReportTopicExchange"
)
TopicExchange
dataReportTopicExchange
)
{
return
BindingBuilder
.
bind
(
dataReportQueue
).
to
(
dataReportTopicExchange
).
with
(
DATA_REPORT_TOPIC
);
}
}
}
platform-process/src/main/java/cn/com/glsx/process/modules/service/SopInstService.java
View file @
fe0e451
package
cn
.
com
.
glsx
.
process
.
modules
.
service
;
package
cn
.
com
.
glsx
.
process
.
modules
.
service
;
import
cn.com.glsx.cdp.api.customer.CustomerSopJourneyFeignClient
;
import
cn.com.glsx.cdp.api.customer.CustomerSopJourneyFeignClient
;
import
cn.com.glsx.cdp.modules.model.customer.CustomerSopJourneyDTO
;
import
cn.com.glsx.cdp.modules.model.customer.*
;
import
cn.com.glsx.cdp.modules.model.customer.CustomerSopJourneyDetailDTO
;
import
cn.com.glsx.cdp.modules.model.customer.CustomerSopJourneySearch
;
import
cn.com.glsx.cdp.modules.model.customer.ModifySopJourneyStageRequest
;
import
cn.com.glsx.process.modules.client.CustomerSopJourneyFeignClient_T
;
import
cn.com.glsx.process.modules.client.CustomerSopJourneyFeignClient_T
;
import
cn.com.glsx.process.modules.converter.SopInstConverter
;
import
cn.com.glsx.process.modules.converter.SopInstConverter
;
import
cn.com.glsx.process.modules.converter.SopTplConverter
;
import
cn.com.glsx.process.modules.converter.SopTplConverter
;
...
@@ -15,7 +12,10 @@ import cn.com.glsx.process.modules.mapper.*;
...
@@ -15,7 +12,10 @@ import cn.com.glsx.process.modules.mapper.*;
import
cn.com.glsx.process.modules.model.*
;
import
cn.com.glsx.process.modules.model.*
;
import
cn.com.glsx.process.modules.model.enums.SopInstStatusEnum
;
import
cn.com.glsx.process.modules.model.enums.SopInstStatusEnum
;
import
cn.com.glsx.process.modules.rabbitmq.MsgProducer
;
import
cn.com.glsx.process.modules.rabbitmq.MsgProducer
;
import
cn.com.glsx.process.modules.rabbitmq.RabbitConfig
;
import
cn.com.glsx.process.modules.rabbitmq.RabbitMQConstants
;
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.PageHelper
;
import
com.github.pagehelper.PageInfo
;
import
com.github.pagehelper.PageInfo
;
import
com.glsx.plat.core.enums.SysConstants
;
import
com.glsx.plat.core.enums.SysConstants
;
...
@@ -31,7 +31,8 @@ import org.springframework.util.Assert;
...
@@ -31,7 +31,8 @@ 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.io.ByteArrayOutputStream
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
...
@@ -66,7 +67,7 @@ public class SopInstService {
...
@@ -66,7 +67,7 @@ public class SopInstService {
private
CustomerSopJourneyFeignClient_T
customerSopJourneyFeignClientT
;
private
CustomerSopJourneyFeignClient_T
customerSopJourneyFeignClientT
;
@Autowired
@Autowired
private
MsgProducer
msgProducer
;
private
MsgProducer
msgProducer
;
/**
/**
* 根据id查询
* 根据id查询
...
@@ -109,7 +110,7 @@ public class SopInstService {
...
@@ -109,7 +110,7 @@ public class SopInstService {
* @param instId
* @param instId
* @return
* @return
*/
*/
public
boolean
delete
(
String
instId
)
{
public
boolean
delete
(
String
instId
)
{
int
i
=
sopInstMapper
.
deleteByPrimaryKey
(
instId
);
int
i
=
sopInstMapper
.
deleteByPrimaryKey
(
instId
);
if
(
i
>
0
)
{
if
(
i
>
0
)
{
return
true
;
return
true
;
...
@@ -130,6 +131,34 @@ public class SopInstService {
...
@@ -130,6 +131,34 @@ public class SopInstService {
}
}
/**
/**
* 首页统计接口
* 查询门店下SOP模板实例分页列表(包含客户统计数据)
*/
public
PageInfo
<
SopInstCustomerStatisticDTO
>
selectByGroupIdWithCustomer
(
SopInstSearch
search
)
{
PageHelper
.
startPage
(
search
.
getPageNumber
(),
search
.
getPageSize
());
List
<
SopInst
>
list
=
sopInstMapper
.
selectByGroupId
(
search
);
if
(
CollectionUtils
.
isEmpty
(
list
))
{
return
new
PageInfo
<>();
}
// 获取实例id列表
List
<
SopInstCustomerStatisticDTO
>
res
=
list
.
stream
().
map
(
SopInstCustomerStatisticDTO:
:
new
).
collect
(
Collectors
.
toList
());
List
<
String
>
instIds
=
res
.
stream
().
filter
(
p
->
StringUtils
.
hasLength
(
p
.
getInstId
())).
map
(
p
->
p
.
getInstId
()).
collect
(
Collectors
.
toList
());
if
(
CollectionUtils
.
isEmpty
(
instIds
))
{
return
new
PageInfo
<>(
res
);
}
// feign 阶段-客户统计数据
CustomerSopJourneySearch
req
=
new
CustomerSopJourneySearch
();
req
.
setSopJourneyIds
(
instIds
);
Result
<
List
<
CustomerSopJourneyStatisticsDTO
>>
result
=
customerSopJourneyFeignClientT
.
statisticsCustomerSopJourney
(
req
);
if
(
result
!=
null
&&
!
CollectionUtils
.
isEmpty
(
result
.
getData
()))
{
Map
<
String
,
List
<
CustomerSopJourneyStatisticsDTO
>>
resultMap
=
result
.
getData
().
stream
().
collect
(
Collectors
.
groupingBy
(
p
->
p
.
getSopJourneyId
()));
res
.
forEach
(
p
->
p
.
setStatistics
(
resultMap
.
getOrDefault
(
p
.
getInstId
(),
new
ArrayList
<>())
.
stream
().
collect
(
Collectors
.
toMap
(
i
->
i
.
getSopJourneyStage
(),
i
->
i
.
getCount
(),
Long:
:
sum
))));
}
return
new
PageInfo
<>(
res
);
}
/**
* 通过实例默认输入参数查询指定门店模板实例
* 通过实例默认输入参数查询指定门店模板实例
*
*
* @param customData
* @param customData
...
@@ -172,7 +201,7 @@ public class SopInstService {
...
@@ -172,7 +201,7 @@ public class SopInstService {
/**
/**
* 更新门店模板实例默认参数的自定义参数
* 更新门店模板实例默认参数的自定义参数
*
*
* @param instId 实例id
* @param instId
实例id
* @param customData 自定义参数
* @param customData 自定义参数
* @return
* @return
*/
*/
...
@@ -326,7 +355,7 @@ public class SopInstService {
...
@@ -326,7 +355,7 @@ public class SopInstService {
//页面选择是否跳过处理
//页面选择是否跳过处理
SopInstNode
sopInstNodeTemp
=
customNodesMap
.
get
(
sopInstNode
.
getNodeId
());
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
);
sopInstNodes
.
add
(
sopInstNode
);
});
});
sopInstNodeMapper
.
insertList
(
sopInstNodes
);
sopInstNodeMapper
.
insertList
(
sopInstNodes
);
...
@@ -339,7 +368,7 @@ public class SopInstService {
...
@@ -339,7 +368,7 @@ public class SopInstService {
* @param search
* @param search
* @return
* @return
*/
*/
public
Result
<
PageInfo
<
CustomerSopJourneyDTO
>>
customers
(
SopCustomerSearch
search
)
{
public
Result
<
PageInfo
<
CustomerSopJourneyDTO
>>
customers
(
SopCustomerSearch
search
)
{
String
sopJourneyId
=
search
.
getSopJourneyId
();
String
sopJourneyId
=
search
.
getSopJourneyId
();
SopInst
sopInst
=
sopInstMapper
.
selectByPrimaryKey
(
sopJourneyId
);
SopInst
sopInst
=
sopInstMapper
.
selectByPrimaryKey
(
sopJourneyId
);
if
(
Objects
.
isNull
(
sopInst
))
{
if
(
Objects
.
isNull
(
sopInst
))
{
...
@@ -356,16 +385,16 @@ public class SopInstService {
...
@@ -356,16 +385,16 @@ public class SopInstService {
String
sopJourneyStage
=
search
.
getSopJourneyStage
();
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
();
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
.
setCustomerName
(
search
.
getCustomerName
());
request
.
setWechatNickname
(
search
.
getWechatNickname
());
request
.
setWechatNickname
(
search
.
getWechatNickname
());
String
sopFollowUpPersonId
=
search
.
getSopFollowUpPersonId
();
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
.
setSopFollowUpPersonPhone
(
search
.
getSopFollowUpPersonPhone
());
request
.
setSopJourneyEnterTimeBegin
(
search
.
getSopJourneyEnterTimeBegin
());
request
.
setSopJourneyEnterTimeBegin
(
search
.
getSopJourneyEnterTimeBegin
());
...
@@ -391,26 +420,56 @@ public class SopInstService {
...
@@ -391,26 +420,56 @@ public class SopInstService {
* @return
* @return
*/
*/
public
Result
<
Boolean
>
stageUpdate
(
SopJourneyStageUpdate
body
)
{
public
Result
<
Boolean
>
stageUpdate
(
SopJourneyStageUpdate
body
)
{
String
orgId
=
body
.
getOrgId
();
String
sopJourneyId
=
body
.
getSopJourneyId
();
String
oneId
=
body
.
getOneId
();
Result
<
CustomerSopJourneyDetailDTO
>
detail
=
customerSopJourneyFeignClientT
.
detail
(
orgId
,
sopJourneyId
,
oneId
);
if
(!
SysConstants
.
ResultStatus
.
success
.
getCode
().
equals
(
detail
.
getCode
()))
{
throw
ResultException
.
create
(
SystemMessage
.
ARGS_ERROR
.
getCode
(),
"查询客户信息异常"
);
}
CustomerSopJourneyDetailDTO
customerDetail
=
detail
.
getData
();
if
(
Objects
.
isNull
(
customerDetail
))
{
throw
ResultException
.
create
(
SystemMessage
.
ARGS_ERROR
.
getCode
(),
"客户信息不存在"
);
}
ModifySopJourneyStageRequest
request
=
new
ModifySopJourneyStageRequest
();
ModifySopJourneyStageRequest
request
=
new
ModifySopJourneyStageRequest
();
request
.
setOrgId
(
body
.
getOrgId
()
);
request
.
setOrgId
(
orgId
);
request
.
setSopJourneyId
(
body
.
getSopJourneyId
()
);
request
.
setSopJourneyId
(
sopJourneyId
);
request
.
setOneIds
(
Lists
.
newArrayList
(
body
.
getOneId
()
));
request
.
setOneIds
(
Lists
.
newArrayList
(
oneId
));
request
.
setSopJourneyStage
(
body
.
getSopJourneyStage
());
request
.
setSopJourneyStage
(
body
.
getSopJourneyStage
());
request
.
setOprBy
(
body
.
getOprBy
());
request
.
setOprBy
(
body
.
getOprBy
());
return
customerSopJourneyFeignClientT
.
modifyStage
(
request
);
Result
<
Boolean
>
booleanResult
=
customerSopJourneyFeignClientT
.
modifyStage
(
request
);
Date
now
=
new
Date
();
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
HashMap
<
String
,
Object
>
mqMap
=
new
HashMap
<>();
mqMap
.
put
(
"org_id"
,
orgId
);
mqMap
.
put
(
"add_way"
,
"SOP"
);
mqMap
.
put
(
"customer_phone"
,
customerDetail
.
getCustomerPhone
());
mqMap
.
put
(
"event_time"
,
sdf
.
format
(
now
));
mqMap
.
put
(
"event_type"
,
"MODIFY_SOP_JOURNEY_STAGE"
);
mqMap
.
put
(
"platform"
,
"WebPage"
);
mqMap
.
put
(
"extra"
,
body
);
msgProducer
.
topicSend
(
RabbitConfig
.
DATA_REPORT_EXCHANGE_NAME
,
"dataReport.customer.event"
,
Lists
.
newArrayList
(
mqMap
));
return
booleanResult
;
}
}
public
void
customersExport
(
SopCustomerSearch
search
,
HttpServletResponse
response
)
{
public
FileUploadServerData
customersExport
(
SopCustomerSearch
search
)
{
search
.
setPageSize
(
5000
);
search
.
setPageSize
(
5000
);
// TODO 空判断
SopInst
sopInst
=
sopInstMapper
.
selectByPrimaryKey
(
search
.
getSopJourneyId
());
SopInst
sopInst
=
sopInstMapper
.
selectByPrimaryKey
(
search
.
getSopJourneyId
());
if
(
Objects
.
isNull
(
sopInst
))
{
throw
ResultException
.
create
(
SystemMessage
.
ARGS_ERROR
.
getCode
(),
"模板实例不存在"
);
}
List
<
SopCustomerExcelDTO
>
data
=
new
ArrayList
<>();
List
<
SopCustomerExcelDTO
>
data
=
new
ArrayList
<>();
List
<
CustomerSopJourneyDTO
>
customerSopJourneyDTOList
=
new
ArrayList
<>();
List
<
CustomerSopJourneyDTO
>
customerSopJourneyDTOList
=
new
ArrayList
<>();
getCustomersForExcel
(
search
,
customerSopJourneyDTOList
);
getCustomersForExcel
(
search
,
customerSopJourneyDTOList
);
if
(
CollectionUtils
.
isEmpty
(
customerSopJourneyDTOList
))
{
if
(
CollectionUtils
.
isEmpty
(
customerSopJourneyDTOList
))
{
return
;
return
null
;
}
}
customerSopJourneyDTOList
.
parallelStream
().
forEach
(
customerSopJourneyDTO
->
{
customerSopJourneyDTOList
.
parallelStream
().
forEach
(
customerSopJourneyDTO
->
{
...
@@ -426,7 +485,13 @@ public class SopInstService {
...
@@ -426,7 +485,13 @@ public class SopInstService {
});
});
try
{
try
{
EasyExcelUtils
.
writeExcel
(
response
,
data
,
"客户数据"
,
"客户数据"
,
SopCustomerExcelDTO
.
class
);
ByteArrayOutputStream
outputStream
=
new
ByteArrayOutputStream
();
EasyExcelUtils
.
writeExcel
(
outputStream
,
data
,
"客户数据"
,
SopCustomerExcelDTO
.
class
);
byte
[]
bytes
=
outputStream
.
toByteArray
();
Date
now
=
new
Date
();
FileUploadServerData
fileUploadServerData
=
FileUploadUtil
.
uploadToFileSystem
(
String
.
format
(
"客户数据_%d"
,
now
.
getTime
()),
bytes
,
"xlsx"
);
return
fileUploadServerData
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
ResultException
.
create
(
SystemMessage
.
DATA_HANDLE_ERROR
.
getCode
(),
"客户数据导出处理异常"
);
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