Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
haoban-manage3.0
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
haoban3.0
haoban-manage3.0
Commits
9a8ca572
Commit
9a8ca572
authored
Dec 10, 2022
by
徐高华
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
群统计
parent
022f553a
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
194 additions
and
28 deletions
+194
-28
GroupChatDataApiService.java
...oban/manage/api/service/chat/GroupChatDataApiService.java
+57
-0
GroupChatDataMapper.java
...n/manage/service/dao/mapper/chat/GroupChatDataMapper.java
+5
-2
GroupChatDataService.java
...ban/manage/service/service/chat/GroupChatDataService.java
+5
-2
GroupChatDataServiceImpl.java
...e/service/service/chat/impl/GroupChatDataServiceImpl.java
+19
-9
GroupChatDataApiServiceImpl.java
...ce/service/out/impl/chat/GroupChatDataApiServiceImpl.java
+46
-0
dubbo-haoban-manage-service.xml
...ervice/src/main/resources/dubbo-haoban-manage-service.xml
+1
-0
GroupChatDataMapper.xml
...ce/src/main/resources/mapper/chat/GroupChatDataMapper.xml
+60
-15
dubbo-haoban-manage-web.xml
...3-web/src/main/webapp/WEB-INF/dubbo-haoban-manage-web.xml
+1
-0
No files found.
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/service/chat/GroupChatDataApiService.java
0 → 100644
View file @
9a8ca572
package
com
.
gic
.
haoban
.
manage
.
api
.
service
.
chat
;
import
java.util.List
;
import
com.gic.api.base.commons.BasePageInfo
;
import
com.gic.api.base.commons.Page
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.haoban.manage.api.dto.chat.GroupChatDataDTO
;
import
com.gic.haoban.manage.api.dto.qdto.chat.ChatDataSearchQDTO
;
public
interface
GroupChatDataApiService
{
/**
*
* @Title: chatDataTimer
* @Description: 统计数据定时从企微拉取
* @author xugh
* @param params
* @throws
*/
public
ServiceResponse
<
Void
>
chatDataTimer
(
String
params
);
/**
*
* @Title: listTotalData
* @Description: 总计
* @author xugh
* @param qdto
* @return
* @throws
*/
public
ServiceResponse
<
GroupChatDataDTO
>
listTotalData
(
ChatDataSearchQDTO
qdto
);
/**
*
* @Title: listForChat
* @Description: 图表数据
* @author xugh
* @param qdto
* @return
* @throws
*/
public
ServiceResponse
<
List
<
GroupChatDataDTO
>>
listForChat
(
ChatDataSearchQDTO
qdto
);
/**
*
* @Title: listStaffData
* @Description: 群主数据
* @author xugh
* @param qdto
* @param basePageInfo
* @return
* @throws
*/
public
ServiceResponse
<
Page
<
GroupChatDataDTO
>>
listStaffData
(
ChatDataSearchQDTO
qdto
,
BasePageInfo
basePageInfo
);
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/dao/mapper/chat/GroupChatDataMapper.java
View file @
9a8ca572
...
@@ -19,7 +19,9 @@ public interface GroupChatDataMapper {
...
@@ -19,7 +19,9 @@ public interface GroupChatDataMapper {
public
int
insert
(
TabGroupChatData
entity
);
public
int
insert
(
TabGroupChatData
entity
);
public
List
<
GroupChatDataDTO
>
list
(
ChatDataSearchQDTO
qdto
);
public
GroupChatDataDTO
listTotalData
(
ChatDataSearchQDTO
qdto
);
public
List
<
GroupChatDataDTO
>
listByPage
(
ChatDataSearchQDTO
qdto
);
public
List
<
GroupChatDataDTO
>
listForChat
(
ChatDataSearchQDTO
qdto
);
public
List
<
GroupChatDataDTO
>
listStaffData
(
ChatDataSearchQDTO
qdto
);
}
}
\ No newline at end of file
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/chat/GroupChatDataService.java
View file @
9a8ca572
...
@@ -19,8 +19,10 @@ public interface GroupChatDataService {
...
@@ -19,8 +19,10 @@ public interface GroupChatDataService {
*/
*/
public
void
chatDataTimer
(
String
params
);
public
void
chatDataTimer
(
String
params
);
public
Page
<
GroupChatDataDTO
>
listPage
(
ChatDataSearchQDTO
qdto
,
BasePageInfo
basePageInf
o
);
public
GroupChatDataDTO
listTotalData
(
ChatDataSearchQDTO
qdt
o
);
public
List
<
GroupChatDataDTO
>
list
(
ChatDataSearchQDTO
qdto
);
public
List
<
GroupChatDataDTO
>
listForChat
(
ChatDataSearchQDTO
qdto
);
public
Page
<
GroupChatDataDTO
>
listStaffData
(
ChatDataSearchQDTO
qdto
,
BasePageInfo
basePageInfo
);
}
}
\ No newline at end of file
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/chat/impl/GroupChatDataServiceImpl.java
View file @
9a8ca572
...
@@ -18,6 +18,7 @@ import com.gic.api.base.commons.BasePageInfo;
...
@@ -18,6 +18,7 @@ import com.gic.api.base.commons.BasePageInfo;
import
com.gic.api.base.commons.Page
;
import
com.gic.api.base.commons.Page
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.commons.util.DateUtil
;
import
com.gic.commons.util.DateUtil
;
import
com.gic.commons.util.PageHelperUtils
;
import
com.gic.commons.util.UniqueIdUtils
;
import
com.gic.commons.util.UniqueIdUtils
;
import
com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO
;
import
com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO
;
import
com.gic.haoban.manage.api.dto.chat.GroupChatDataDTO
;
import
com.gic.haoban.manage.api.dto.chat.GroupChatDataDTO
;
...
@@ -35,8 +36,9 @@ import com.gic.haoban.manage.service.service.chat.GroupChatDataService;
...
@@ -35,8 +36,9 @@ import com.gic.haoban.manage.service.service.chat.GroupChatDataService;
import
com.gic.wechat.api.dto.qywx.chat.GroupChatQwDataDTO
;
import
com.gic.wechat.api.dto.qywx.chat.GroupChatQwDataDTO
;
import
com.gic.wechat.api.dto.qywx.chat.GroupChatQwDataItemDTO
;
import
com.gic.wechat.api.dto.qywx.chat.GroupChatQwDataItemDTO
;
import
com.gic.wechat.api.service.qywx.QywxChatApiService
;
import
com.gic.wechat.api.service.qywx.QywxChatApiService
;
import
com.github.pagehelper.PageHelper
;
@Service
@Service
(
"groupChatDataService"
)
public
class
GroupChatDataServiceImpl
implements
GroupChatDataService
{
public
class
GroupChatDataServiceImpl
implements
GroupChatDataService
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
GroupChatDataService
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
GroupChatDataService
.
class
);
...
@@ -55,13 +57,21 @@ public class GroupChatDataServiceImpl implements GroupChatDataService {
...
@@ -55,13 +57,21 @@ public class GroupChatDataServiceImpl implements GroupChatDataService {
private
WxEnterpriseMapper
wxEnterpriseMapper
;
private
WxEnterpriseMapper
wxEnterpriseMapper
;
@Override
@Override
public
List
<
GroupChatDataDTO
>
list
(
ChatDataSearchQDTO
qdto
)
{
public
List
<
GroupChatDataDTO
>
list
ForChat
(
ChatDataSearchQDTO
qdto
)
{
return
null
;
return
this
.
groupChatDataMapper
.
listForChat
(
qdto
)
;
}
}
@Override
@Override
public
Page
<
GroupChatDataDTO
>
listPage
(
ChatDataSearchQDTO
qdto
,
BasePageInfo
basePageInfo
)
{
public
Page
<
GroupChatDataDTO
>
listStaffData
(
ChatDataSearchQDTO
qdto
,
BasePageInfo
basePageInfo
)
{
return
null
;
PageHelper
.
startPage
(
basePageInfo
);
List
<
GroupChatDataDTO
>
list
=
this
.
groupChatDataMapper
.
listStaffData
(
qdto
);
Page
<
GroupChatDataDTO
>
retPage
=
PageHelperUtils
.
changePageHelperToCurrentPage
(
list
,
GroupChatDataDTO
.
class
);
return
retPage
;
}
@Override
public
GroupChatDataDTO
listTotalData
(
ChatDataSearchQDTO
qdto
)
{
return
this
.
groupChatDataMapper
.
listTotalData
(
qdto
);
}
}
@Override
@Override
...
@@ -79,7 +89,7 @@ public class GroupChatDataServiceImpl implements GroupChatDataService {
...
@@ -79,7 +89,7 @@ public class GroupChatDataServiceImpl implements GroupChatDataService {
}
}
private
void
getDataFormQw
(
String
wxEnterpriseId
)
{
private
void
getDataFormQw
(
String
wxEnterpriseId
)
{
logger
.
info
(
"开始处理wxEnterpriseId={}"
,
wxEnterpriseId
);
logger
.
info
(
"开始处理wxEnterpriseId={}"
,
wxEnterpriseId
);
WxEnterpriseQwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
wxEnterpriseId
);
WxEnterpriseQwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
wxEnterpriseId
);
if
(
null
==
qwDTO
)
{
if
(
null
==
qwDTO
)
{
logger
.
info
(
"wxEnterpriseId不存在,id={}"
,
wxEnterpriseId
);
logger
.
info
(
"wxEnterpriseId不存在,id={}"
,
wxEnterpriseId
);
...
@@ -92,9 +102,9 @@ public class GroupChatDataServiceImpl implements GroupChatDataService {
...
@@ -92,9 +102,9 @@ public class GroupChatDataServiceImpl implements GroupChatDataService {
OwnerSearchQDTO
qdto
=
new
OwnerSearchQDTO
();
OwnerSearchQDTO
qdto
=
new
OwnerSearchQDTO
();
qdto
.
setWxEnterpriseId
(
wxEnterpriseId
);
qdto
.
setWxEnterpriseId
(
wxEnterpriseId
);
List
<
GroupChatOwnerDTO
>
list
=
this
.
groupChatOwnerMapper
.
listOwner
(
qdto
);
List
<
GroupChatOwnerDTO
>
list
=
this
.
groupChatOwnerMapper
.
listOwner
(
qdto
);
if
(
CollectionUtils
.
isEmpty
(
list
))
{
if
(
CollectionUtils
.
isEmpty
(
list
))
{
logger
.
info
(
"无群主记录,不处理"
);
logger
.
info
(
"无群主记录,不处理"
);
return
;
return
;
}
}
List
<
String
>
userIdList
=
null
;
List
<
String
>
userIdList
=
null
;
Map
<
String
,
String
>
staffIdMap
=
new
HashMap
<>();
Map
<
String
,
String
>
staffIdMap
=
new
HashMap
<>();
...
@@ -107,7 +117,7 @@ public class GroupChatDataServiceImpl implements GroupChatDataService {
...
@@ -107,7 +117,7 @@ public class GroupChatDataServiceImpl implements GroupChatDataService {
staffIdMap
=
list
.
stream
().
collect
(
staffIdMap
=
list
.
stream
().
collect
(
Collectors
.
toMap
(
GroupChatOwnerDTO:
:
getWxUserId
,
GroupChatOwnerDTO:
:
getStaffId
,
(
k1
,
k2
)
->
k1
));
Collectors
.
toMap
(
GroupChatOwnerDTO:
:
getWxUserId
,
GroupChatOwnerDTO:
:
getStaffId
,
(
k1
,
k2
)
->
k1
));
}
}
Date
date
=
DateUtil
.
addDay
(
DateUtil
.
getStartTimeOfDay
(),
-
1
);
Date
date
=
DateUtil
.
addDay
(
DateUtil
.
getStartTimeOfDay
(),
-
1
);
Long
time
=
date
.
getTime
()
/
1000
;
Long
time
=
date
.
getTime
()
/
1000
;
ServiceResponse
<
List
<
GroupChatQwDataDTO
>>
resp
=
this
.
qywxChatApiService
.
statistic
(
qwDTO
.
getThirdCorpid
(),
ServiceResponse
<
List
<
GroupChatQwDataDTO
>>
resp
=
this
.
qywxChatApiService
.
statistic
(
qwDTO
.
getThirdCorpid
(),
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/chat/GroupChatDataApiServiceImpl.java
0 → 100644
View file @
9a8ca572
package
com
.
gic
.
haoban
.
manage
.
service
.
service
.
out
.
impl
.
chat
;
import
java.util.List
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.gic.api.base.commons.BasePageInfo
;
import
com.gic.api.base.commons.Page
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.haoban.manage.api.dto.chat.GroupChatDataDTO
;
import
com.gic.haoban.manage.api.dto.qdto.chat.ChatDataSearchQDTO
;
import
com.gic.haoban.manage.api.service.chat.GroupChatDataApiService
;
import
com.gic.haoban.manage.service.service.chat.GroupChatDataService
;
@Service
(
"groupChatDataApiService"
)
public
class
GroupChatDataApiServiceImpl
implements
GroupChatDataApiService
{
@Autowired
private
GroupChatDataService
groupChatDataService
;
@Override
public
ServiceResponse
<
Void
>
chatDataTimer
(
String
params
)
{
this
.
groupChatDataService
.
chatDataTimer
(
params
);
return
ServiceResponse
.
success
();
}
@Override
public
ServiceResponse
<
GroupChatDataDTO
>
listTotalData
(
ChatDataSearchQDTO
qdto
)
{
GroupChatDataDTO
dto
=
this
.
groupChatDataService
.
listTotalData
(
qdto
);
return
ServiceResponse
.
success
(
dto
);
}
@Override
public
ServiceResponse
<
List
<
GroupChatDataDTO
>>
listForChat
(
ChatDataSearchQDTO
qdto
)
{
List
<
GroupChatDataDTO
>
list
=
this
.
groupChatDataService
.
listForChat
(
qdto
);
return
ServiceResponse
.
success
(
list
);
}
@Override
public
ServiceResponse
<
Page
<
GroupChatDataDTO
>>
listStaffData
(
ChatDataSearchQDTO
qdto
,
BasePageInfo
basePageInfo
)
{
Page
<
GroupChatDataDTO
>
page
=
this
.
groupChatDataService
.
listStaffData
(
qdto
,
basePageInfo
);
return
ServiceResponse
.
success
(
page
);
}
}
haoban-manage3-service/src/main/resources/dubbo-haoban-manage-service.xml
View file @
9a8ca572
...
@@ -22,6 +22,7 @@
...
@@ -22,6 +22,7 @@
<constructor-arg
index=
"0"
value=
"haoban-manage-service"
/>
<constructor-arg
index=
"0"
value=
"haoban-manage-service"
/>
</bean>
</bean>
<dubbo:service
interface=
"com.gic.haoban.manage.api.service.chat.GroupChatDataApiService"
ref=
"groupChatDataApiService"
timeout=
"10000"
/>
<dubbo:service
interface=
"com.gic.haoban.manage.api.service.chat.GroupChatPlanApiService"
ref=
"groupChatPlanApiService"
timeout=
"10000"
/>
<dubbo:service
interface=
"com.gic.haoban.manage.api.service.chat.GroupChatPlanApiService"
ref=
"groupChatPlanApiService"
timeout=
"10000"
/>
<dubbo:service
interface=
"com.gic.haoban.manage.api.service.chat.GroupChatHmApiService"
ref=
"groupChatHmApiService"
timeout=
"10000"
/>
<dubbo:service
interface=
"com.gic.haoban.manage.api.service.chat.GroupChatHmApiService"
ref=
"groupChatHmApiService"
timeout=
"10000"
/>
<dubbo:service
interface=
"com.gic.haoban.manage.api.service.chat.GroupChatApiService"
ref=
"groupChatApiService"
timeout=
"10000"
/>
<dubbo:service
interface=
"com.gic.haoban.manage.api.service.chat.GroupChatApiService"
ref=
"groupChatApiService"
timeout=
"10000"
/>
...
...
haoban-manage3-service/src/main/resources/mapper/chat/GroupChatDataMapper.xml
View file @
9a8ca572
...
@@ -68,23 +68,67 @@
...
@@ -68,23 +68,67 @@
)
)
]]>
]]>
</insert>
</insert>
<select
id=
"list"
parameterType=
"com.gic.haoban.manage.api.dto.qdto.chat.ChatDataSearchQDTO"
<select
id=
"listTotalData"
parameterType=
"com.gic.haoban.manage.api.dto.qdto.chat.ChatDataSearchQDTO"
resultType=
"com.gic.haoban.manage.api.dto.chat.GroupChatDataDTO"
>
SELECT
staffId, `date`, chatTotal, memberTotal,
SUM(newChatCnt), SUM(chatHasMsg), SUM(newMemberCnt),
SUM(memberHasMsg), SUM(msgTotal)
FROM
(SELECT
a.staff_id staffId, a.date `date`,
a.chat_total chatTotal, a.member_total memberTotal,
a.new_chat_cnt newChatCnt, a.chat_has_msg chatHasMsg, a.new_member_cnt newMemberCnt,
a.member_has_msg memberHasMsg, a.msg_total msgTotal
FROM tab_haoban_group_chat_data a
where a.wx_enterprise_id = #{wxEnterpriseId}
and a.date >= #{startDate} and a.date
<![CDATA[ <= ]]>
#{endDate}
<if
test=
"null != staffIdList and staffIdList.size > 0"
>
and a.staff_id in
<foreach
collection=
"staffIdList"
close=
")"
open=
"("
index=
"index"
item=
"staffId"
separator=
","
>
#{staffId}
</foreach>
</if>
ORDER BY a.date DESC
) tb GROUP BY staffId
</select>
<select
id=
"listForChat"
parameterType=
"com.gic.haoban.manage.api.dto.qdto.chat.ChatDataSearchQDTO"
resultType=
"com.gic.haoban.manage.api.dto.chat.GroupChatDataDTO"
>
resultType=
"com.gic.haoban.manage.api.dto.chat.GroupChatDataDTO"
>
select staffName , chatTotal from (
select
select
b.staff_name staffName ,
a.staff_id staffId ,
a.date date ,
a.date date ,
a.new_chat_cnt newChatCnt ,
sum(a.new_chat_cnt) newChatCnt ,
a.chat_total chatTotal,
sum(a.chat_has_msg) chatHasMsg ,
a.chat_has_msg chatHasMsg ,
sum(a.new_member_cnt) newMemberCnt ,
a.new_member_cnt newMemberCnt ,
sum(a.member_has_msg) memberHasMsg ,
a.member_total memberTotal ,
sum(a.msg_total) msgTotal
a.member_has_msg memberHasMsg ,
from tab_haoban_group_chat_data a
a.msg_total msgTotal ,
where a.wx_enterprise_id = #{wxEnterpriseId}
a. migrate_trainee_chat_cnt migrateTraineeChatCnt
and a.date >= #{startDate} and a.date
<![CDATA[ <= ]]>
#{endDate}
from tab_haoban_group_chat_data a left join tab_haoban_staff b on a.staff_id = b.staff_id
<if
test=
"null != staffIdList and staffIdList.size > 0"
>
and a.staff_id in
<foreach
collection=
"staffIdList"
close=
")"
open=
"("
index=
"index"
item=
"staffId"
separator=
","
>
#{staffId}
</foreach>
</if>
group by a.date
</select>
<select
id=
"listStaffData"
parameterType=
"com.gic.haoban.manage.api.dto.qdto.chat.ChatDataSearchQDTO"
resultType=
"com.gic.haoban.manage.api.dto.chat.GroupChatDataDTO"
>
SELECT
staffId, staffName, `date`, chatTotal, memberTotal,
SUM(newChatCnt), SUM(chatHasMsg), SUM(newMemberCnt),
SUM(memberHasMsg), SUM(msgTotal)
FROM
(SELECT
b.staff_name staffName, a.staff_id staffId, a.date `date`,
a.chat_total chatTotal, a.member_total memberTotal,
a.new_chat_cnt newChatCnt, a.chat_has_msg chatHasMsg, a.new_member_cnt newMemberCnt,
a.member_has_msg memberHasMsg, a.msg_total msgTotal
FROM tab_haoban_group_chat_data a LEFT JOIN tab_haoban_staff b ON a.staff_id = b.staff_id
where a.wx_enterprise_id = #{wxEnterpriseId}
where a.wx_enterprise_id = #{wxEnterpriseId}
and a.date >= #{startDate} and a.date
<![CDATA[ <= ]]>
#{endDate}
and a.date >= #{startDate} and a.date
<![CDATA[ <= ]]>
#{endDate}
<if
test=
"null != staffIdList and staffIdList.size > 0"
>
<if
test=
"null != staffIdList and staffIdList.size > 0"
>
...
@@ -94,6 +138,6 @@
...
@@ -94,6 +138,6 @@
</foreach>
</foreach>
</if>
</if>
ORDER BY a.date DESC
ORDER BY a.date DESC
)
)
tb GROUP BY staffId
</select>
</select>
</mapper>
</mapper>
\ No newline at end of file
haoban-manage3-web/src/main/webapp/WEB-INF/dubbo-haoban-manage-web.xml
View file @
9a8ca572
...
@@ -15,6 +15,7 @@
...
@@ -15,6 +15,7 @@
<dubbo:protocol
name=
"dubbo"
port=
"30009"
/>
<dubbo:protocol
name=
"dubbo"
port=
"30009"
/>
<dubbo:reference
interface=
"com.gic.haoban.manage.api.service.chat.GroupChatDataApiService"
id=
"groupChatDataApiService"
timeout=
"10000"
/>
<dubbo:reference
interface=
"com.gic.haoban.manage.api.service.chat.GroupChatPlanApiService"
id=
"groupChatPlanApiService"
timeout=
"10000"
/>
<dubbo:reference
interface=
"com.gic.haoban.manage.api.service.chat.GroupChatPlanApiService"
id=
"groupChatPlanApiService"
timeout=
"10000"
/>
<dubbo:reference
interface=
"com.gic.haoban.manage.api.service.chat.GroupChatApiService"
id=
"groupChatApiService"
timeout=
"10000"
/>
<dubbo:reference
interface=
"com.gic.haoban.manage.api.service.chat.GroupChatApiService"
id=
"groupChatApiService"
timeout=
"10000"
/>
<dubbo:reference
interface=
"com.gic.haoban.manage.api.service.chat.GroupChatHmApiService"
id=
"groupChatHmApiService"
timeout=
"10000"
/>
<dubbo:reference
interface=
"com.gic.haoban.manage.api.service.chat.GroupChatHmApiService"
id=
"groupChatHmApiService"
timeout=
"10000"
/>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment