Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
platform
/
platform-cdp-server
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 07b52206
authored
Nov 02, 2023
by
zhouhaibao
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
[+]新增查询数量接口
1 parent
14c86920
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
60 additions
and
5 deletions
platform-cdp-api/src/main/java/cn/com/glsx/cdp/api/customer/CustomerSopJourneyFeignClient.java
platform-cdp/src/main/java/cn/com/glsx/cdp/modules/api/customer/CustomerSopJourneyController.java
platform-cdp/src/main/java/cn/com/glsx/cdp/modules/mapper/CustomerSopJourneyMapper.java
platform-cdp/src/main/java/cn/com/glsx/cdp/modules/service/CustomerSopJourneyService.java
platform-cdp/src/main/resources/mapper/CustomerSopJourneyMapper.xml
platform-cdp/src/test/java/cn/com/glsx/cn/com/glsx/TestApplication.java
platform-cdp-api/src/main/java/cn/com/glsx/cdp/api/customer/CustomerSopJourneyFeignClient.java
View file @
07b5220
...
...
@@ -10,6 +10,7 @@ import org.springframework.web.bind.annotation.PostMapping;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
java.util.Map
;
import
java.util.List
;
/**
...
...
@@ -39,5 +40,7 @@ public interface CustomerSopJourneyFeignClient {
@PostMapping
(
"/statistics"
)
Result
<
List
<
CustomerSopJourneyStatisticsDTO
>>
statisticsCustomerSopJourney
(
@RequestBody
CustomerSopJourneySearch
request
);
@Operation
(
description
=
"查询客户旅程客户数量"
)
@PostMapping
(
"/journeycount"
)
Result
<
Map
<
String
,
Integer
>>
customerSopJourneyCount
(
@RequestBody
CustomerSopJourneySearch
request
);
}
platform-cdp/src/main/java/cn/com/glsx/cdp/modules/api/customer/CustomerSopJourneyController.java
View file @
07b5220
...
...
@@ -21,6 +21,7 @@ import org.springframework.web.bind.annotation.*;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
@Slf4j
...
...
@@ -94,4 +95,15 @@ public class CustomerSopJourneyController implements CustomerSopJourneyFeignClie
return
Result
.
failure
(
SysConstants
.
ResultStatus
.
failure
.
getCode
(),
e
.
getMessage
());
}
}
@Operation
(
description
=
"查询客户旅程客户数量"
)
@PostMapping
(
"/journeycount"
)
@Override
public
Result
<
Map
<
String
,
Integer
>>
customerSopJourneyCount
(
@RequestBody
CustomerSopJourneySearch
request
)
{
log
.
info
(
"查询客户旅程客户数量参数:{}"
,
request
);
RpcPagination
<
CustomerSopJourneyBO
>
pagination
=
CommonUtils
.
getRpcPagination
(
request
,
CustomerSopJourneyBO
.
class
);
Map
<
String
,
Integer
>
data
=
customerSopJourneyService
.
customerSopJourneyCount
(
pagination
.
getCondition
());
log
.
info
(
"查询客户旅程客户数量返回:{}"
,
data
);
return
Result
.
success
(
data
);
}
}
platform-cdp/src/main/java/cn/com/glsx/cdp/modules/mapper/CustomerSopJourneyMapper.java
View file @
07b5220
...
...
@@ -4,13 +4,19 @@ import cn.com.glsx.cdp.modules.entity.CustomerSopJourney;
import
cn.com.glsx.cdp.modules.model.CustomerSopJourneyBO
;
import
cn.com.glsx.cdp.modules.model.customer.CustomerSopJourneyStatisticsDTO
;
import
com.glsx.plat.mybatis.mapper.CommonBaseMapper
;
import
org.apache.ibatis.annotations.MapKey
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.Map
;
@Mapper
public
interface
CustomerSopJourneyMapper
extends
CommonBaseMapper
<
CustomerSopJourney
>
{
List
<
CustomerSopJourneyBO
>
listCustomerSopJourney
(
CustomerSopJourneyBO
customerSopJourneyBO
);
List
<
CustomerSopJourneyStatisticsDTO
>
statisticsCustomerSopJourney
(
CustomerSopJourneyBO
request
);
@MapKey
(
"sop_journey_stage"
)
List
<
Map
<
String
,
Integer
>>
customerSopJourneyCount
(
CustomerSopJourneyBO
customerSopJourneyBO
);
}
\ No newline at end of file
platform-cdp/src/main/java/cn/com/glsx/cdp/modules/service/CustomerSopJourneyService.java
View file @
07b5220
...
...
@@ -19,9 +19,7 @@ import org.springframework.transaction.annotation.Propagation;
import
org.springframework.transaction.annotation.Transactional
;
import
tk.mybatis.mapper.entity.Example
;
import
java.util.Arrays
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.*
;
@Slf4j
@Service
...
...
@@ -93,4 +91,14 @@ public class CustomerSopJourneyService {
throw
new
RpcServiceException
(
DefaultErrorEnum
.
DATABASE_ERROR
);
}
}
public
Map
<
String
,
Integer
>
customerSopJourneyCount
(
CustomerSopJourneyBO
customerSopJourneyBO
)
{
Map
<
String
,
Integer
>
stringIntegerMap
=
new
HashMap
<>();
List
<
Map
<
String
,
Integer
>>
maps
=
customerSopJourneyMapper
.
customerSopJourneyCount
(
customerSopJourneyBO
);
System
.
out
.
println
(
maps
);
for
(
Map
<
String
,
Integer
>
map
:
maps
)
{
stringIntegerMap
.
put
(
map
.
get
(
"sop_journey_stage"
)+
""
,
Integer
.
parseInt
(
map
.
get
(
"count"
)+
""
));
}
return
stringIntegerMap
;
}
}
platform-cdp/src/main/resources/mapper/CustomerSopJourneyMapper.xml
View file @
07b5220
...
...
@@ -25,6 +25,7 @@
<result
column=
"updated_time"
jdbcType=
"TIMESTAMP"
property=
"updatedTime"
/>
<result
column=
"del_flag"
jdbcType=
"INTEGER"
property=
"delFlag"
/>
</resultMap>
<resultMap
id=
"BOResultMap"
type=
"cn.com.glsx.cdp.modules.model.CustomerSopJourneyBO"
extends=
"BaseResultMap"
>
<association
property=
"customer"
javaType=
"cn.com.glsx.cdp.modules.model.CustomerBO"
>
<result
column=
"org_id"
jdbcType=
"VARCHAR"
property=
"orgId"
/>
...
...
@@ -56,6 +57,7 @@
<result
column=
"c_ex_json"
jdbcType=
"LONGVARCHAR"
property=
"exJson"
/>
</association>
</resultMap>
<sql
id=
"Base_Column_List"
>
<!--
WARNING - @mbg.generated
...
...
@@ -158,5 +160,16 @@
</where>
group by csj.sop_journey_id, csj.sop_journey_stage
</select>
<select
id=
"customerSopJourneyCount"
resultType=
"java.util.Map"
parameterType=
"cn.com.glsx.cdp.modules.model.CustomerSopJourneyBO"
>
select
csj.sop_journey_stage as sop_journey_stage,count(1) as count
from cdp_customer_sop_journey csj
left join cdp_customer c on csj.one_id = c.one_id and c.del_flag = 0
<where>
<include
refid=
"base_param"
/>
</where>
group by csj.sop_journey_stage
</select>
</mapper>
\ No newline at end of file
platform-cdp/src/test/java/cn/com/glsx/cn/com/glsx/TestApplication.java
View file @
07b5220
package
cn
.
com
.
glsx
.
cn
.
com
.
glsx
;
import
cn.com.glsx.Application
;
import
cn.com.glsx.cdp.modules.model.CustomerSopJourneyBO
;
import
cn.com.glsx.cdp.modules.service.CustomerSopJourneyService
;
import
cn.com.glsx.cdp.modules.service.UserDemoService
;
import
com.alibaba.fastjson.JSONObject
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.test.context.junit4.SpringJUnit4ClassRunner
;
import
java.util.Map
;
/**
* 测试spring cloud 服务调用方式
*/
...
...
@@ -18,9 +23,17 @@ public class TestApplication {
@Autowired
private
UserDemoService
userDemoService
;
@Autowired
private
CustomerSopJourneyService
customerSopJourneyService
;
@Test
public
void
test
()
{
CustomerSopJourneyBO
customerSopJourneyBO
=
new
CustomerSopJourneyBO
();
customerSopJourneyBO
.
setSopJourneyId
(
"xblc7"
);
customerSopJourneyBO
.
setOrgId
(
"44211227"
);
customerSopJourneyBO
.
setSopFollowUpPersonPhone
(
"13800000001"
);
Map
<
String
,
Integer
>
stringIntegerMap
=
customerSopJourneyService
.
customerSopJourneyCount
(
customerSopJourneyBO
);
System
.
out
.
println
(
JSONObject
.
toJSONString
(
stringIntegerMap
));
}
}
\ No newline at end of file
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