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
022f553a
Commit
022f553a
authored
Dec 10, 2022
by
徐高华
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
群
parent
768f1fb3
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
73 additions
and
29 deletions
+73
-29
GroupChatHmRelationMapper.java
...ge/service/dao/mapper/chat/GroupChatHmRelationMapper.java
+2
-2
GroupChatMapper.java
...aoban/manage/service/dao/mapper/chat/GroupChatMapper.java
+3
-0
GroupChatHmServiceImpl.java
...age/service/service/chat/impl/GroupChatHmServiceImpl.java
+39
-10
GroupChatHmMapper.xml
...vice/src/main/resources/mapper/chat/GroupChatHmMapper.xml
+3
-3
GroupChatHmRelationMapper.xml
.../main/resources/mapper/chat/GroupChatHmRelationMapper.xml
+16
-14
GroupChatMapper.xml
...ervice/src/main/resources/mapper/chat/GroupChatMapper.xml
+10
-0
No files found.
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/dao/mapper/chat/GroupChatHmRelationMapper.java
View file @
022f553a
...
...
@@ -17,9 +17,9 @@ import com.gic.haoban.manage.service.entity.chat.TabGroupChatHmRelation;
*/
public
interface
GroupChatHmRelationMapper
{
public
int
insert
(
TabGroupChatHmRelation
entity
);
public
int
insert
Batch
(
List
<
TabGroupChatHmRelation
>
list
);
public
int
delete
ById
(
@Param
(
"chatHmId"
)
Long
chatHmId
,
@Param
(
"groupChatId"
)
Long
groupChatId
);
public
int
delete
(
@Param
(
"chatHmId"
)
Long
chatHmId
,
@Param
(
"groupChatIdList"
)
List
<
Long
>
groupChatIdList
);
public
int
updateStatus
(
@Param
(
"chatHmId"
)
Long
chatHmId
,
@Param
(
"groupChatId"
)
Long
groupChatId
,
@Param
(
"statusFlag"
)
int
statusFlag
);
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/dao/mapper/chat/GroupChatMapper.java
View file @
022f553a
...
...
@@ -49,6 +49,9 @@ public interface GroupChatMapper {
public
TabGroupChat
selectByWxChatId
(
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
,
@Param
(
"wxChatId"
)
String
wxChatId
);
public
List
<
TabGroupChat
>
listByWxWxChatIdList
(
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
,
@Param
(
"wxChatIdList"
)
List
<
String
>
wxChatIdList
)
;
public
List
<
TabGroupChat
>
listAllNeedInit
();
public
List
<
TabGroupChat
>
listAllNeedInitWxChatIdDk
();
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/chat/impl/GroupChatHmServiceImpl.java
View file @
022f553a
...
...
@@ -40,6 +40,7 @@ import com.gic.haoban.manage.service.service.chat.GroupChatHmService;
import
com.gic.wechat.api.dto.qywx.chat.AddJoinWayDTO
;
import
com.gic.wechat.api.service.qywx.QywxChatApiService
;
import
com.github.pagehelper.PageHelper
;
import
com.google.common.collect.Sets
;
@Service
(
"groupChatHmService"
)
public
class
GroupChatHmServiceImpl
implements
GroupChatHmService
{
...
...
@@ -164,7 +165,13 @@ public class GroupChatHmServiceImpl implements GroupChatHmService {
logger
.
info
(
"hm={},群={},要删={}"
,
wxChatId
,
qwChatIdList
,
cid
.
getWxChatId
());
qwChatIdList
.
remove
(
cid
.
getWxChatId
());
// 保存活码
GroupChatHmDTO
hmDTO
=
EntityUtil
.
changeEntityByJSON
(
GroupChatHmDTO
.
class
,
hm
);
List
<
TabGroupChat
>
list
=
this
.
groupChatMapper
.
listByWxWxChatIdList
(
wxEnterpriseId
,
qwChatIdList
);
List
<
Long
>
groupChatIdList
=
list
.
stream
().
map
(
dto
->
dto
.
getGroupChatId
())
.
collect
(
Collectors
.
toList
());
hmDTO
.
setChatIdList
(
groupChatIdList
);
this
.
saveHm
(
hmDTO
);
}
}
}
...
...
@@ -183,10 +190,9 @@ public class GroupChatHmServiceImpl implements GroupChatHmService {
return
;
}
boolean
updateFlag
=
false
;
Long
hmid
=
UniqueIdUtils
.
uniqueLong
()
;
if
(
null
!=
dto
.
getChatHmId
()
)
{
Long
hmid
=
dto
.
getChatHmId
()
;
if
(
null
!=
hmid
)
{
updateFlag
=
true
;
hmid
=
dto
.
getChatHmId
();
}
else
{
hmid
=
UniqueIdUtils
.
uniqueLong
();
}
...
...
@@ -207,17 +213,39 @@ public class GroupChatHmServiceImpl implements GroupChatHmService {
joinDTO
.
setChat_id_list
(
wxChatidList
);
TabGroupChatHm
hm
=
EntityUtil
.
changeEntityByJSON
(
TabGroupChatHm
.
class
,
dto
);
hm
.
setDeleteFlag
(
0
);
hm
.
setCreateTime
(
new
Date
());
hm
.
setUpdateTime
(
new
Date
());
hm
.
setChatCount
(
wxChatidList
.
size
());
List
<
TabGroupChatHmRelation
>
relationList
=
new
ArrayList
<>();
if
(
updateFlag
)
{
joinDTO
.
setConfig_id
(
hm
.
getWxConfigId
());
ServiceResponse
<
Void
>
updateResp
=
this
.
qywxChatApiService
.
updateJoinWay
(
qwDTO
.
getDkCorpid
(),
/*
ServiceResponse<Void> updateResp = this.qywxChatApiService.updateJoinWay(qwDTO.getDkCorpid(),
secretSetting.getSecretVal(), joinDTO);
if (updateResp.isSuccess()) {
this.groupChatHmMapper.updateById(hm);
}*/
List
<
TabGroupChatHmRelation
>
oldList
=
this
.
groupChatHmRelationMapper
.
listByChatHmId
(
hmid
);
List
<
Long
>
oldIdList
=
oldList
.
stream
().
map
(
o
->
o
.
getGroupChatId
()).
collect
(
Collectors
.
toList
());
List
<
Long
>
newIdList
=
dto
.
getChatIdList
();
Sets
.
SetView
<
Long
>
delView
=
Sets
.
difference
(
Sets
.
newHashSet
(
oldIdList
),
Sets
.
newHashSet
(
newIdList
));
List
<
Long
>
delIdList
=
delView
.
stream
().
collect
(
Collectors
.
toList
());
logger
.
info
(
"要删除的群={}"
,
delIdList
);
if
(
CollectionUtils
.
isNotEmpty
(
delIdList
))
{
this
.
groupChatHmRelationMapper
.
delete
(
hmid
,
delIdList
);
}
Sets
.
SetView
<
Long
>
addView
=
Sets
.
difference
(
Sets
.
newHashSet
(
newIdList
),
Sets
.
newHashSet
(
oldIdList
));
List
<
Long
>
addIdList
=
addView
.
stream
().
collect
(
Collectors
.
toList
());
logger
.
info
(
"要新加的群={}"
,
addIdList
);
for
(
Long
chatId
:
addIdList
)
{
TabGroupChatHmRelation
entity
=
new
TabGroupChatHmRelation
();
entity
.
setChatHmId
(
hm
.
getChatHmId
());
entity
.
setWxEnterpriseId
(
wxEnterpriseId
);
entity
.
setGroupChatId
(
chatId
);
entity
.
setEnterpriseId
(
hm
.
getEnterpriseId
());
entity
.
setRelationId
(
UniqueIdUtils
.
uniqueLong
());
relationList
.
add
(
entity
);
}
if
(
CollectionUtils
.
isNotEmpty
(
relationList
))
{
this
.
groupChatHmRelationMapper
.
insertBatch
(
relationList
);
}
}
else
{
ServiceResponse
<
String
>
addResp
=
this
.
qywxChatApiService
.
addJoinWay
(
qwDTO
.
getDkCorpid
(),
...
...
@@ -237,8 +265,9 @@ public class GroupChatHmServiceImpl implements GroupChatHmService {
TabGroupChatHmRelation
entity
=
EntityUtil
.
changeEntity
(
TabGroupChatHmRelation
.
class
,
item
);
entity
.
setChatHmId
(
hm
.
getChatHmId
());
entity
.
setRelationId
(
UniqueIdUtils
.
uniqueLong
());
this
.
groupChatHmRelationMapper
.
insert
(
entity
);
relationList
.
add
(
entity
);
}
this
.
groupChatHmRelationMapper
.
insertBatch
(
relationList
);
}
}
...
...
haoban-manage3-service/src/main/resources/mapper/chat/GroupChatHmMapper.xml
View file @
022f553a
...
...
@@ -89,9 +89,9 @@
#{creatorName},
#{modifierId},
#{modifierName},
#{deleteFlag}
,
#{createTime}
,
#{updateTime}
,
0
,
now()
,
now()
,
#{chatCount},
0 , 1
)
...
...
haoban-manage3-service/src/main/resources/mapper/chat/GroupChatHmRelationMapper.xml
View file @
022f553a
...
...
@@ -26,10 +26,7 @@
create_time,
update_time
</sql>
<!-- ===================== 新增 ======================== -->
<insert
id=
"insert"
parameterType=
"com.gic.haoban.manage.service.entity.chat.TabGroupChatHmRelation"
>
<![CDATA[
<insert
id=
"insertBatch"
>
INSERT INTO tab_haoban_group_chat_hm_relation(
relation_id,
wx_enterprise_id,
...
...
@@ -40,24 +37,29 @@
status_flag,
create_time,
update_time
)VALUES(
#{relationId},
#{wxEnterpriseId},
#{enterpriseId},
#{chatHmId},
#{groupChatId},
)VALUES
<foreach
collection=
"list"
item=
"item"
separator=
","
>
( #{item.relationId},
#{item.wxEnterpriseId},
#{item.enterpriseId},
#{item.chatHmId},
#{item.groupChatId},
0,
1,
now(),
now()
)
]]
>
</foreach
>
</insert>
<!-- =====================删除==================== -->
<delete
id=
"deleteById"
>
UPDATE tab_haoban_group_chat_hm_relation SET delete_flag = 1 WHERE
where chat_hm_id = #{chatHmId} and group_chat_id= #{groupChatId}
<delete
id=
"delete"
>
UPDATE tab_haoban_group_chat_hm_relation SET delete_flag = 1 , update_time=now() WHERE
chat_hm_id = #{chatHmId} and group_chat_id in
<foreach
collection=
"groupChatIdList"
item=
"id"
close=
")"
index=
"index"
open=
"("
separator=
","
>
#{id}
</foreach>
</delete>
...
...
haoban-manage3-service/src/main/resources/mapper/chat/GroupChatMapper.xml
View file @
022f553a
...
...
@@ -183,6 +183,16 @@
and delete_flag = 0
</select>
<select
id=
"listByWxWxChatIdList"
resultMap=
"result-map-tabHaobanGroupChat"
>
select
<include
refid=
"Base_Column_List"
/>
FROM tab_haoban_group_chat WHERE wx_chat_id in
<foreach
collection=
"wxChatIdList"
close=
")"
index=
"index"
item=
"wxChatId"
open=
"("
separator=
","
>
#{wxChatId}
</foreach>
and wx_enterprise_id = #{wxEnterpriseId}
and delete_flag = 0
</select>
<select
id=
"getCountByStaffId"
resultType=
"int"
>
select count(*) from tab_haoban_group_chat where staff_id = #{staffId} and delete_flag = 0
...
...
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