Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
江名洋
/
linkwe-scrm
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 88972b8e
authored
Feb 25, 2021
by
淡漠
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
统计修改,新客拉群API
1 parent
9398c04a
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
72 additions
and
40 deletions
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeCommunityNewGroupController.java
linkwe-quartz/src/main/java/com/linkwechat/quartz/task/GroupChatStatisticTask.java
linkwe-quartz/src/main/java/com/linkwechat/quartz/task/PageHomeDataTask.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/client/WeCustomerClient.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeCommunityNewGroup.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeGroupStatistic.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeUserBehaviorData.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/dto/GroupChatStatisticDto.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/dto/UserBehaviorDataDto.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/mapper/WeUserBehaviorDataMapper.java
linkwe-wecom/src/main/resources/mapper/wecom/WeUserBehaviorDataMapper.xml
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeCommunityNewGroupController.java
View file @
88972b8
...
@@ -12,6 +12,9 @@ import com.linkwechat.wecom.domain.WeEmpleCode;
...
@@ -12,6 +12,9 @@ import com.linkwechat.wecom.domain.WeEmpleCode;
import
com.linkwechat.wecom.domain.dto.WeCommunityNewGroupDto
;
import
com.linkwechat.wecom.domain.dto.WeCommunityNewGroupDto
;
import
com.linkwechat.wecom.domain.vo.WeCommunityNewGroupVo
;
import
com.linkwechat.wecom.domain.vo.WeCommunityNewGroupVo
;
import
com.linkwechat.wecom.service.IWeCommunityNewGroupService
;
import
com.linkwechat.wecom.service.IWeCommunityNewGroupService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.stereotype.Controller
;
...
@@ -28,6 +31,7 @@ import java.util.stream.Collectors;
...
@@ -28,6 +31,7 @@ import java.util.stream.Collectors;
* @author kewen
* @author kewen
* @date 2021-02-19
* @date 2021-02-19
*/
*/
@Api
(
description
=
"新客自动拉群 Controller"
)
@Controller
@Controller
@RequestMapping
(
value
=
"communityNewGroup"
)
@RequestMapping
(
value
=
"communityNewGroup"
)
public
class
WeCommunityNewGroupController
extends
BaseController
{
public
class
WeCommunityNewGroupController
extends
BaseController
{
...
@@ -38,6 +42,7 @@ public class WeCommunityNewGroupController extends BaseController {
...
@@ -38,6 +42,7 @@ public class WeCommunityNewGroupController extends BaseController {
/**
/**
* 查询新客自动拉群列表
* 查询新客自动拉群列表
*/
*/
@ApiOperation
(
value
=
"查询新客自动拉群列表"
,
httpMethod
=
"GET"
)
@PreAuthorize
(
"@ss.hasPermi('wecom:communityNewGroup:list')"
)
@PreAuthorize
(
"@ss.hasPermi('wecom:communityNewGroup:list')"
)
@GetMapping
(
"/list"
)
@GetMapping
(
"/list"
)
public
TableDataInfo
list
(
WeCommunityNewGroup
communityNewGroup
)
{
public
TableDataInfo
list
(
WeCommunityNewGroup
communityNewGroup
)
{
...
@@ -49,15 +54,17 @@ public class WeCommunityNewGroupController extends BaseController {
...
@@ -49,15 +54,17 @@ public class WeCommunityNewGroupController extends BaseController {
/**
/**
* 获取新客自动拉群详细信息
* 获取新客自动拉群详细信息
*/
*/
@ApiOperation
(
value
=
"获取新客自动拉群详细信息"
,
httpMethod
=
"GET"
)
@PreAuthorize
(
"@ss.hasPermi('wecom:communityNewGroup:query')"
)
@PreAuthorize
(
"@ss.hasPermi('wecom:communityNewGroup:query')"
)
@GetMapping
(
value
=
"/{id}"
)
@GetMapping
(
value
=
"/{id}"
)
public
AjaxResult
getInfo
(
@PathVariable
(
"newGroupId"
)
Long
newGroupId
)
{
public
AjaxResult
getInfo
(
@PathVariable
(
"newGroupId"
)
@ApiParam
(
"主键ID"
)
Long
newGroupId
)
{
return
AjaxResult
.
success
(
weCommunityNewGroupService
.
selectWeCommunityNewGroupById
(
newGroupId
));
return
AjaxResult
.
success
(
weCommunityNewGroupService
.
selectWeCommunityNewGroupById
(
newGroupId
));
}
}
/**
/**
* 修改新客自动拉群
* 修改新客自动拉群
*/
*/
@ApiOperation
(
value
=
"修改新客自动拉群"
,
httpMethod
=
"PUT"
)
@PreAuthorize
(
"@ss.hasPermi('wecom:communityNewGroup:edit')"
)
@PreAuthorize
(
"@ss.hasPermi('wecom:communityNewGroup:edit')"
)
@Log
(
title
=
"新客自动拉群"
,
businessType
=
BusinessType
.
UPDATE
)
@Log
(
title
=
"新客自动拉群"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
(
"/update"
)
@PutMapping
(
"/update"
)
...
@@ -70,6 +77,7 @@ public class WeCommunityNewGroupController extends BaseController {
...
@@ -70,6 +77,7 @@ public class WeCommunityNewGroupController extends BaseController {
/**
/**
* 删除新客自动拉群
* 删除新客自动拉群
*/
*/
@ApiOperation
(
value
=
"删除新客自动拉群"
,
httpMethod
=
"DELETE"
)
@PreAuthorize
(
"@ss.hasPermi('wecom:communityNewGroup:remove')"
)
@PreAuthorize
(
"@ss.hasPermi('wecom:communityNewGroup:remove')"
)
@Log
(
title
=
"新客自动拉群"
,
businessType
=
BusinessType
.
DELETE
)
@Log
(
title
=
"新客自动拉群"
,
businessType
=
BusinessType
.
DELETE
)
@DeleteMapping
(
"/delete/{ids}"
)
@DeleteMapping
(
"/delete/{ids}"
)
...
@@ -82,6 +90,7 @@ public class WeCommunityNewGroupController extends BaseController {
...
@@ -82,6 +90,7 @@ public class WeCommunityNewGroupController extends BaseController {
/**
/**
* 新增新客自动拉群
* 新增新客自动拉群
*/
*/
@ApiOperation
(
value
=
"新增新客自动拉群"
,
httpMethod
=
"POST"
)
@PreAuthorize
(
"@ss.hasPermi('wecom:communityNewGroup:add')"
)
@PreAuthorize
(
"@ss.hasPermi('wecom:communityNewGroup:add')"
)
@Log
(
title
=
"新客自动拉群"
,
businessType
=
BusinessType
.
INSERT
)
@Log
(
title
=
"新客自动拉群"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
(
"/add"
)
@PostMapping
(
"/add"
)
...
...
linkwe-quartz/src/main/java/com/linkwechat/quartz/task/GroupChatStatisticTask.java
View file @
88972b8
...
@@ -55,7 +55,7 @@ public class GroupChatStatisticTask {
...
@@ -55,7 +55,7 @@ public class GroupChatStatisticTask {
idList
.
add
(
weGroup
.
getOwner
());
idList
.
add
(
weGroup
.
getOwner
());
ownerFilter
.
setUserid_list
(
idList
);
ownerFilter
.
setUserid_list
(
idList
);
query
.
setOwnerFilter
(
ownerFilter
);
query
.
setOwnerFilter
(
ownerFilter
);
GroupChatStatisticDto
groupChatStatistic
=
weCustomerClient
.
getGroupChatStatistic
(
query
);
GroupChatStatisticDto
groupChatStatistic
=
weCustomerClient
.
getGroupChatStatistic
GroupByDay
(
query
);
List
<
GroupChatStatisticDto
.
GroupchatStatisticData
>
items
=
groupChatStatistic
.
getItems
();
List
<
GroupChatStatisticDto
.
GroupchatStatisticData
>
items
=
groupChatStatistic
.
getItems
();
if
(
CollectionUtil
.
isNotEmpty
(
items
)){
if
(
CollectionUtil
.
isNotEmpty
(
items
)){
items
.
forEach
(
groupchatStatisticData
->
{
items
.
forEach
(
groupchatStatisticData
->
{
...
...
linkwe-quartz/src/main/java/com/linkwechat/quartz/task/PageHomeDataTask.java
View file @
88972b8
...
@@ -95,12 +95,12 @@ public class PageHomeDataTask {
...
@@ -95,12 +95,12 @@ public class PageHomeDataTask {
String
today
=
DateUtil
.
today
();
String
today
=
DateUtil
.
today
();
String
yesterday
=
DateUtil
.
yesterday
().
toDateStr
();
String
yesterday
=
DateUtil
.
yesterday
().
toDateStr
();
//客户统计
//客户统计
WePageCountDto
newTime
=
weUserBehaviorDataService
.
getCountDataByDay
(
today
,
"d"
);
WePageCountDto
newTime
=
weUserBehaviorDataService
.
getCountDataByDay
(
today
,
"d
ay
"
);
/**
/**
* 昨日
* 昨日
*/
*/
//客户统计
//客户统计
WePageCountDto
lastTime
=
weUserBehaviorDataService
.
getCountDataByDay
(
yesterday
,
"d"
);
WePageCountDto
lastTime
=
weUserBehaviorDataService
.
getCountDataByDay
(
yesterday
,
"d
ay
"
);
WePageStaticDataDto
.
PageStaticData
pageStaticData
=
setPageStaticData
(
newTime
,
lastTime
);
WePageStaticDataDto
.
PageStaticData
pageStaticData
=
setPageStaticData
(
newTime
,
lastTime
);
...
@@ -120,12 +120,12 @@ public class PageHomeDataTask {
...
@@ -120,12 +120,12 @@ public class PageHomeDataTask {
* 本周
* 本周
*/
*/
//客户统计
//客户统计
WePageCountDto
newTime
=
weUserBehaviorDataService
.
getCountDataByDay
(
DateUtil
.
today
(),
"w"
);
WePageCountDto
newTime
=
weUserBehaviorDataService
.
getCountDataByDay
(
DateUtil
.
today
(),
"w
eek
"
);
/**
/**
* 上周
* 上周
*/
*/
//客户统计
//客户统计
WePageCountDto
lastTime
=
weUserBehaviorDataService
.
getCountDataByDay
(
DateUtil
.
lastWeek
().
toDateStr
(),
"w"
);
WePageCountDto
lastTime
=
weUserBehaviorDataService
.
getCountDataByDay
(
DateUtil
.
lastWeek
().
toDateStr
(),
"w
eek
"
);
WePageStaticDataDto
.
PageStaticData
pageStaticData
=
setPageStaticData
(
newTime
,
lastTime
);
WePageStaticDataDto
.
PageStaticData
pageStaticData
=
setPageStaticData
(
newTime
,
lastTime
);
...
@@ -142,12 +142,12 @@ public class PageHomeDataTask {
...
@@ -142,12 +142,12 @@ public class PageHomeDataTask {
* 本周
* 本周
*/
*/
//客户统计
//客户统计
WePageCountDto
newTime
=
weUserBehaviorDataService
.
getCountDataByDay
(
DateUtil
.
today
(),
"m"
);
WePageCountDto
newTime
=
weUserBehaviorDataService
.
getCountDataByDay
(
DateUtil
.
today
(),
"m
onth
"
);
/**
/**
* 上周
* 上周
*/
*/
//客户统计
//客户统计
WePageCountDto
lastTime
=
weUserBehaviorDataService
.
getCountDataByDay
(
DateUtil
.
lastMonth
().
toDateStr
(),
"m"
);
WePageCountDto
lastTime
=
weUserBehaviorDataService
.
getCountDataByDay
(
DateUtil
.
lastMonth
().
toDateStr
(),
"m
onth
"
);
WePageStaticDataDto
.
PageStaticData
pageStaticData
=
setPageStaticData
(
newTime
,
lastTime
);
WePageStaticDataDto
.
PageStaticData
pageStaticData
=
setPageStaticData
(
newTime
,
lastTime
);
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/client/WeCustomerClient.java
View file @
88972b8
...
@@ -100,10 +100,18 @@ public interface WeCustomerClient {
...
@@ -100,10 +100,18 @@ public interface WeCustomerClient {
UserBehaviorDataDto
getUserBehaviorData
(
@JSONBody
UserBehaviorDataQuery
query
);
UserBehaviorDataDto
getUserBehaviorData
(
@JSONBody
UserBehaviorDataQuery
query
);
/**
/**
*
联系客户统计
*
群聊数据统计(按群主聚合的方式)
* @return
* @return
*/
*/
@Request
(
url
=
"/externalcontact/groupchat/statistic"
,
@Request
(
url
=
"/externalcontact/groupchat/statistic"
,
type
=
"POST"
)
type
=
"POST"
)
GroupChatStatisticDto
getGroupChatStatistic
(
@JSONBody
GroupChatStatisticQuery
query
);
GroupChatStatisticDto
getGroupChatStatistic
(
@JSONBody
GroupChatStatisticQuery
query
);
/**
* 群聊数据统计(按自然日聚合的方式)
* @return
*/
@Request
(
url
=
"/externalcontact/groupchat/statistic_group_by_day"
,
type
=
"POST"
)
GroupChatStatisticDto
getGroupChatStatisticGroupByDay
(
@JSONBody
GroupChatStatisticQuery
query
);
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeCommunityNewGroup.java
View file @
88972b8
...
@@ -2,6 +2,8 @@ package com.linkwechat.wecom.domain;
...
@@ -2,6 +2,8 @@ package com.linkwechat.wecom.domain;
import
com.linkwechat.common.core.domain.BaseEntity
;
import
com.linkwechat.common.core.domain.BaseEntity
;
import
com.linkwechat.common.utils.SnowFlakeUtil
;
import
com.linkwechat.common.utils.SnowFlakeUtil
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.Data
;
/**
/**
...
@@ -10,6 +12,7 @@ import lombok.Data;
...
@@ -10,6 +12,7 @@ import lombok.Data;
* @author kewen
* @author kewen
* @date 2021-02-19
* @date 2021-02-19
*/
*/
@ApiModel
@Data
@Data
public
class
WeCommunityNewGroup
extends
BaseEntity
{
public
class
WeCommunityNewGroup
extends
BaseEntity
{
...
@@ -21,46 +24,55 @@ public class WeCommunityNewGroup extends BaseEntity {
...
@@ -21,46 +24,55 @@ public class WeCommunityNewGroup extends BaseEntity {
/**
/**
* 员工活码名称
* 员工活码名称
*/
*/
@ApiModelProperty
(
"员工活码名称"
)
private
String
empleCodeName
;
private
String
empleCodeName
;
/**
/**
* 活动场景
* 活动场景
*/
*/
@ApiModelProperty
(
"活动场景"
)
private
String
activityScene
;
private
String
activityScene
;
/**
/**
* 欢迎语
* 欢迎语
*/
*/
@ApiModelProperty
(
"欢迎语"
)
private
String
welcomeMsg
;
private
String
welcomeMsg
;
/**
/**
* 二维码链接
* 二维码链接
*/
*/
@ApiModelProperty
(
"二维码链接"
)
private
String
qrCode
;
private
String
qrCode
;
/**
/**
* 客户添加时无需经过确认自动成为好友:1:是;0:否
* 客户添加时无需经过确认自动成为好友:1:是;0:否
*/
*/
@ApiModelProperty
(
"客户添加时无需经过确认自动成为好友:1:是;0:否"
)
private
Boolean
isJoinConfirmFriends
;
private
Boolean
isJoinConfirmFriends
;
/**
/**
* 添加好友数
* 添加好友数
*/
*/
@ApiModelProperty
(
"添加好友数"
)
private
Integer
joinFriendNums
;
private
Integer
joinFriendNums
;
/**
/**
* 群活码ID
* 群活码ID
*/
*/
@ApiModelProperty
(
"群活码ID"
)
private
Long
groupCodeId
;
private
Long
groupCodeId
;
/**
/**
* 素材的id
* 素材的id
*/
*/
@ApiModelProperty
(
"素材的id"
)
private
Long
mediaId
;
private
Long
mediaId
;
/**
/**
* 0 未删除 1 已删除
* 0 未删除 1 已删除
*/
*/
@ApiModelProperty
(
"0 未删除 1 已删除"
)
private
int
delFlag
;
private
int
delFlag
;
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeGroupStatistic.java
View file @
88972b8
...
@@ -46,7 +46,7 @@ public class WeGroupStatistic implements Serializable {
...
@@ -46,7 +46,7 @@ public class WeGroupStatistic implements Serializable {
* 数据日期
* 数据日期
*/
*/
@Excel
(
name
=
"数据日期"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd"
)
@Excel
(
name
=
"数据日期"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd
HH:mm:ss
"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
)
private
Date
statTime
;
private
Date
statTime
;
/**
/**
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeUserBehaviorData.java
View file @
88972b8
...
@@ -45,7 +45,7 @@ public class WeUserBehaviorData implements Serializable {
...
@@ -45,7 +45,7 @@ public class WeUserBehaviorData implements Serializable {
* 数据日期,为当日0点的时间戳
* 数据日期,为当日0点的时间戳
*/
*/
@Excel
(
name
=
"数据日期,为当日0点的时间戳"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd"
)
@Excel
(
name
=
"数据日期,为当日0点的时间戳"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd
HH:mm:ss
"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
)
private
Date
statTime
;
private
Date
statTime
;
/**
/**
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/dto/GroupChatStatisticDto.java
View file @
88972b8
...
@@ -23,10 +23,12 @@ public class GroupChatStatisticDto {
...
@@ -23,10 +23,12 @@ public class GroupChatStatisticDto {
/**
/**
* 数据日期,为当日0点的时间戳
* 数据日期,为当日0点的时间戳
*/
*/
@JSONField
(
format
=
"unixtime"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
)
private
Date
statTime
;
private
Date
statTime
;
public
void
setStatTime
(
Long
statTime
)
{
this
.
statTime
=
new
Date
(
statTime
*
1000
);
}
private
StatisticData
data
;
private
StatisticData
data
;
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/dto/UserBehaviorDataDto.java
View file @
88972b8
package
com
.
linkwechat
.
wecom
.
domain
.
dto
;
package
com
.
linkwechat
.
wecom
.
domain
.
dto
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
lombok.Data
;
import
lombok.Data
;
import
java.util.Date
;
import
java.util.Date
;
...
@@ -12,8 +10,7 @@ import java.util.List;
...
@@ -12,8 +10,7 @@ import java.util.List;
* @author danmo
* @author danmo
*/
*/
@Data
@Data
public
class
UserBehaviorDataDto
{
public
class
UserBehaviorDataDto
{
private
List
<
BehaviorData
>
behaviorData
;
private
List
<
BehaviorData
>
behaviorData
;
...
@@ -23,37 +20,40 @@ public class UserBehaviorDataDto {
...
@@ -23,37 +20,40 @@ public class UserBehaviorDataDto {
/**
/**
* 数据日期,为当日0点的时间戳
* 数据日期,为当日0点的时间戳
*/
*/
@JSONField
(
format
=
"unixtime"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
)
private
Date
statTime
;
private
Date
statTime
;
public
void
setStatTime
(
Long
statTime
)
{
this
.
statTime
=
new
Date
(
statTime
*
1000
);
}
/**
/**
* 聊天总数, 成员有主动发送过消息的单聊总数。
* 聊天总数, 成员有主动发送过消息的单聊总数。
*/
*/
private
Integer
chatCnt
;
private
Integer
chatCnt
=
0
;
/**
/**
* 发送消息数,成员在单聊中发送的消息总数。
* 发送消息数,成员在单聊中发送的消息总数。
*/
*/
private
Integer
messageCnt
;
private
Integer
messageCnt
=
0
;
/**
/**
* 已回复聊天占比,浮点型,客户主动发起聊天后,成员在一个自然日内有回复过消息的聊天数/客户主动发起的聊天数比例,不包括群聊,仅在确有聊天时返回。
* 已回复聊天占比,浮点型,客户主动发起聊天后,成员在一个自然日内有回复过消息的聊天数/客户主动发起的聊天数比例,不包括群聊,仅在确有聊天时返回。
*/
*/
private
Float
replyPercentage
;
private
Float
replyPercentage
=
0.00f
;
/**
/**
* 平均首次回复时长,单位为分钟,即客户主动发起聊天后,成员在一个自然日内首次回复的时长间隔为首次回复时长,所有聊天的首次回复总时长/已回复的聊天总数即为平均首次回复时长,不包括群聊,仅在确有聊天时返回。
* 平均首次回复时长,单位为分钟,即客户主动发起聊天后,成员在一个自然日内首次回复的时长间隔为首次回复时长,所有聊天的首次回复总时长/已回复的聊天总数即为平均首次回复时长,不包括群聊,仅在确有聊天时返回。
*/
*/
private
Integer
avgReplyTime
;
private
Integer
avgReplyTime
=
0
;
/**
/**
* 删除/拉黑成员的客户数,即将成员删除或加入黑名单的客户数。
* 删除/拉黑成员的客户数,即将成员删除或加入黑名单的客户数。
*/
*/
private
Integer
negativeFeedbackCnt
;
private
Integer
negativeFeedbackCnt
=
0
;
/**
/**
* 主动向客户发起的好友申请数量
* 主动向客户发起的好友申请数量
*/
*/
private
Integer
newApplyCnt
;
private
Integer
newApplyCnt
=
0
;
/**
/**
* 新增客户数,成员新添加的客户数量。
* 新增客户数,成员新添加的客户数量。
*/
*/
private
Integer
newContactCnt
;
private
Integer
newContactCnt
=
0
;
}
}
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/mapper/WeUserBehaviorDataMapper.java
View file @
88972b8
...
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
...
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import
com.linkwechat.wecom.domain.WeUserBehaviorData
;
import
com.linkwechat.wecom.domain.WeUserBehaviorData
;
import
com.linkwechat.wecom.domain.dto.WePageCountDto
;
import
com.linkwechat.wecom.domain.dto.WePageCountDto
;
import
com.linkwechat.wecom.domain.query.WePageStateQuery
;
import
com.linkwechat.wecom.domain.query.WePageStateQuery
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.List
;
...
@@ -20,7 +21,7 @@ public interface WeUserBehaviorDataMapper extends BaseMapper<WeUserBehaviorData>
...
@@ -20,7 +21,7 @@ public interface WeUserBehaviorDataMapper extends BaseMapper<WeUserBehaviorData>
* @param dateTime
* @param dateTime
* @return WeUserBehaviorDataDto
* @return WeUserBehaviorDataDto
*/
*/
public
WePageCountDto
getCountDataByDay
(
String
dateTime
,
String
type
);
public
WePageCountDto
getCountDataByDay
(
@Param
(
"dateTime"
)
String
dateTime
,
@Param
(
"type"
)
String
type
);
/**
/**
* 按天维度查询数据统计
* 按天维度查询数据统计
...
...
linkwe-wecom/src/main/resources/mapper/wecom/WeUserBehaviorDataMapper.xml
View file @
88972b8
...
@@ -19,25 +19,25 @@
...
@@ -19,25 +19,25 @@
<select
id=
"getCountDataByDay"
resultType=
"com.linkwechat.wecom.domain.dto.WePageCountDto"
>
<select
id=
"getCountDataByDay"
resultType=
"com.linkwechat.wecom.domain.dto.WePageCountDto"
>
select
select
date_format(stat_time, '%Y-%m-%d') as x_time
date_format(stat_time, '%Y-%m-%d') as x_time
,
sum(new_apply_cnt
) as new_apply_cnt,
IFNULL(sum(new_apply_cnt),0
) as new_apply_cnt,
sum(new_contact_cnt) as new_contact_cnt
IFNULL(sum(new_contact_cnt),0) as new_contact_cnt,
sum(chat_cnt) as chat_cnt
IFNULL(sum(chat_cnt),0) as chat_cnt,
sum(new_contact_cnt) as message_cnt
IFNULL(sum(message_cnt),0) as message_cnt,
sum(new_contact_cnt) as reply_percentage
IFNULL(sum(reply_percentage),0) as reply_percentage,
sum(new_contact_cnt) as avg_reply_time
IFNULL(sum(avg_reply_time),0) as avg_reply_time,
sum(new_contact_cnt
) as negative_feedback_cnt
IFNULL(sum(negative_feedback_cnt),0
) as negative_feedback_cnt
from we_user_behavior_data
from we_user_behavior_data
<where>
<where>
<choose>
<choose>
<when
test=
"type !=null and type == 'd'"
>
<when
test=
"type !=null and type == 'd
ay
'"
>
date_format(stat_time, '%Y-%m-%d') = date_format(#{dateTime}, '%Y-%m-%d');
date_format(stat_time, '%Y-%m-%d') = date_format(#{dateTime}, '%Y-%m-%d');
</when>
</when>
<when
test=
"type !=null and type == 'w'"
>
<when
test=
"type !=null and type == 'w
eek
'"
>
YEARWEEK(date_format(stat_time,'%Y-%m-%d')) = YEARWEEK(date_format(#{dateTime}, '%Y-%m-%d')
}
);
YEARWEEK(date_format(stat_time,'%Y-%m-%d')) = YEARWEEK(date_format(#{dateTime}, '%Y-%m-%d'));
</when>
</when>
<when
test=
"type !=null and type == 'm'"
>
<when
test=
"type !=null and type == 'm
onth
'"
>
DATE_FORMAT(
date_format(stat_time,'%Y-%m')) = DATE_FORMAT(date_format(#{dateTime}, '%Y-%m')
);
DATE_FORMAT(
stat_time,'%Y-%m') = DATE_FORMAT(#{dateTime}, '%Y-%m'
);
</when>
</when>
<!--查询今年-->
<!--查询今年-->
<otherwise>
<otherwise>
...
...
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