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 a564f800
authored
Nov 12, 2021
by
danmo
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
增加添加活码统计
1 parent
c04843bd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
15 deletions
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/vo/qr/WeQrCodeScanCountVo.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeQrCodeServiceImpl.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/vo/qr/WeQrCodeScanCountVo.java
View file @
a564f80
...
...
@@ -16,10 +16,10 @@ import java.util.List;
public
class
WeQrCodeScanCountVo
{
@ApiModelProperty
(
"今日扫码次数"
)
private
Integer
today
;
private
Integer
today
=
0
;
@ApiModelProperty
(
"累计扫码次数"
)
private
Integer
total
;
private
Integer
total
=
0
;
@ApiModelProperty
(
"时间横坐标"
)
private
List
<
String
>
xAxis
;
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeQrCodeServiceImpl.java
View file @
a564f80
...
...
@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.github.pagehelper.PageInfo
;
import
com.linkwechat.common.exception.wecom.WeComException
;
import
com.linkwechat.common.utils.DateUtils
;
import
com.linkwechat.common.utils.StringUtils
;
import
com.linkwechat.wecom.client.WeExternalContactClient
;
import
com.linkwechat.wecom.domain.WeCustomer
;
...
...
@@ -24,8 +25,7 @@ import com.linkwechat.wecom.service.*;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.*
;
import
java.util.stream.Collectors
;
/**
...
...
@@ -105,7 +105,7 @@ public class WeQrCodeServiceImpl extends ServiceImpl<WeQrCodeMapper, WeQrCode> i
public
PageInfo
<
WeQrCodeDetailVo
>
getQrCodeList
(
WeQrCodeListQuery
qrCodeListQuery
)
{
List
<
WeQrCodeDetailVo
>
weQrCodeList
=
new
ArrayList
<>();
List
<
Long
>
qrCodeIdList
=
this
.
baseMapper
.
getQrCodeList
(
qrCodeListQuery
);
if
(
CollectionUtil
.
isNotEmpty
(
qrCodeIdList
))
{
if
(
CollectionUtil
.
isNotEmpty
(
qrCodeIdList
))
{
List
<
WeQrCodeDetailVo
>
qrDetailByQrIds
=
this
.
baseMapper
.
getQrDetailByQrIds
(
qrCodeIdList
);
weQrCodeList
.
addAll
(
qrDetailByQrIds
);
}
...
...
@@ -121,9 +121,9 @@ public class WeQrCodeServiceImpl extends ServiceImpl<WeQrCodeMapper, WeQrCode> i
@Override
public
void
delQrCode
(
List
<
Long
>
qrIds
)
{
List
<
WeQrCode
>
weQrCodes
=
this
.
listByIds
(
qrIds
);
if
(
CollectionUtil
.
isNotEmpty
(
weQrCodes
))
{
if
(
CollectionUtil
.
isNotEmpty
(
weQrCodes
))
{
weQrCodes
.
forEach
(
item
->
item
.
setDelFlag
(
1
));
if
(
this
.
updateBatchById
(
weQrCodes
))
{
if
(
this
.
updateBatchById
(
weQrCodes
))
{
//删除标签数据
tagRelService
.
delBatchByQrIds
(
qrIds
);
//删除活码范围数据
...
...
@@ -132,8 +132,8 @@ public class WeQrCodeServiceImpl extends ServiceImpl<WeQrCodeMapper, WeQrCode> i
attachmentsService
.
delBatchByQrIds
(
qrIds
);
}
//异步删除企微活码---最好使用mq
ThreadUtil
.
execute
(()
->
weQrCodes
.
forEach
(
item
->{
if
(
StringUtils
.
isNotEmpty
(
item
.
getConfigId
()))
{
ThreadUtil
.
execute
(()
->
weQrCodes
.
forEach
(
item
->
{
if
(
StringUtils
.
isNotEmpty
(
item
.
getConfigId
()))
{
externalContactClient
.
delContactWay
(
item
.
getConfigId
());
}
}));
...
...
@@ -142,14 +142,34 @@ public class WeQrCodeServiceImpl extends ServiceImpl<WeQrCodeMapper, WeQrCode> i
@Override
public
WeQrCodeScanCountVo
getWeQrCodeScanCount
(
WeQrCodeListQuery
qrCodeListQuery
)
{
WeQrCodeScanCountVo
scanCountVo
=
new
WeQrCodeScanCountVo
();
List
<
String
>
xAxis
=
new
ArrayList
<>();
List
<
Integer
>
yAxis
=
new
ArrayList
<>();
Long
qrId
=
qrCodeListQuery
.
getQrId
();
String
beginTime
=
qrCodeListQuery
.
getBeginTime
(
);
String
endTime
=
qrCodeListQuery
.
getEndTime
(
);
Date
beginTime
=
DateUtils
.
dateTime
(
DateUtils
.
YYYY_MM_DD
,
qrCodeListQuery
.
getBeginTime
()
);
Date
endTime
=
DateUtils
.
dateTime
(
DateUtils
.
YYYY_MM_DD
,
qrCodeListQuery
.
getEndTime
()
);
WeQrCode
weQrCode
=
getById
(
qrId
);
String
state
=
weQrCode
.
getState
();
//todo 计算
//weCustomerService.list(new LambdaQueryWrapper<WeCustomer>().eq(WeCustomer::getStatus))
return
null
;
Map
<
String
,
List
<
WeCustomer
>>
customerMap
=
new
HashMap
<>();
List
<
WeCustomer
>
customerList
=
weCustomerService
.
list
(
new
LambdaQueryWrapper
<
WeCustomer
>().
eq
(
WeCustomer:
:
getState
,
weQrCode
.
getState
()));
if
(
CollectionUtil
.
isNotEmpty
(
customerList
))
{
scanCountVo
.
setTotal
(
customerList
.
size
());
long
count
=
customerList
.
stream
().
filter
(
item
->
ObjectUtil
.
equal
(
DateUtils
.
getDate
(),
DateUtils
.
parseDateToStr
(
DateUtils
.
YYYY_MM_DD
,
item
.
getFirstAddTime
()))).
count
();
scanCountVo
.
setToday
(
Long
.
valueOf
(
count
).
intValue
());
Map
<
String
,
List
<
WeCustomer
>>
listMap
=
customerList
.
stream
().
collect
(
Collectors
.
groupingBy
(
item
->
DateUtils
.
parseDateToStr
(
DateUtils
.
YYYY_MM_DD
,
item
.
getFirstAddTime
())));
customerMap
.
putAll
(
listMap
);
}
DateUtils
.
findDates
(
beginTime
,
endTime
).
stream
().
map
(
d
->
DateUtils
.
parseDateToStr
(
DateUtils
.
YYYY_MM_DD
,
d
))
.
forEach
(
date
->
{
xAxis
.
add
(
date
);
if
(
CollectionUtil
.
isNotEmpty
(
customerMap
.
get
(
date
)))
{
yAxis
.
add
(
customerMap
.
get
(
date
).
size
());
}
else
{
yAxis
.
add
(
0
);
}
});
scanCountVo
.
setXAxis
(
xAxis
);
scanCountVo
.
setYAxis
(
yAxis
);
return
scanCountVo
;
}
/**
...
...
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