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 8e4f9f12
authored
Mar 01, 2021
by
leejoker
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge remote-tracking branch 'origin/back_end_dev' into back_end_dev
2 parents
459ae79b
a5bb1986
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
134 additions
and
11 deletions
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeCommunityNewGroupController.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/mapper/WeCommunityNewGroupMapper.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeCommunityNewGroupService.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeCommunityNewGroupServiceImpl.java
linkwe-wecom/src/main/resources/mapper/wecom/WeCommunityNewGroupMapper.xml
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeCommunityNewGroupController.java
View file @
8e4f9f1
package
com
.
linkwechat
.
web
.
controller
.
wecom
;
package
com
.
linkwechat
.
web
.
controller
.
wecom
;
import
cn.hutool.core.collection.CollectionUtil
;
import
com.linkwechat.common.annotation.Log
;
import
com.linkwechat.common.annotation.Log
;
import
com.linkwechat.common.core.controller.BaseController
;
import
com.linkwechat.common.core.controller.BaseController
;
import
com.linkwechat.common.core.domain.AjaxResult
;
import
com.linkwechat.common.core.domain.AjaxResult
;
...
@@ -7,6 +8,7 @@ import com.linkwechat.common.core.page.TableDataInfo;
...
@@ -7,6 +8,7 @@ import com.linkwechat.common.core.page.TableDataInfo;
import
com.linkwechat.common.enums.BusinessType
;
import
com.linkwechat.common.enums.BusinessType
;
import
com.linkwechat.common.exception.wecom.WeComException
;
import
com.linkwechat.common.exception.wecom.WeComException
;
import
com.linkwechat.common.utils.StringUtils
;
import
com.linkwechat.common.utils.StringUtils
;
import
com.linkwechat.common.utils.file.FileUtils
;
import
com.linkwechat.wecom.domain.WeCommunityNewGroup
;
import
com.linkwechat.wecom.domain.WeCommunityNewGroup
;
import
com.linkwechat.wecom.domain.WeEmpleCode
;
import
com.linkwechat.wecom.domain.WeEmpleCode
;
import
com.linkwechat.wecom.domain.dto.WeCommunityNewGroupDto
;
import
com.linkwechat.wecom.domain.dto.WeCommunityNewGroupDto
;
...
@@ -21,9 +23,17 @@ import org.springframework.stereotype.Controller;
...
@@ -21,9 +23,17 @@ import org.springframework.stereotype.Controller;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.net.URL
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Optional
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
java.util.zip.ZipEntry
;
import
java.util.zip.ZipOutputStream
;
/**
/**
* 社群运营 新客自动拉群 Controller
* 社群运营 新客自动拉群 Controller
...
@@ -110,4 +120,72 @@ public class WeCommunityNewGroupController extends BaseController {
...
@@ -110,4 +120,72 @@ public class WeCommunityNewGroupController extends BaseController {
}
}
/**
* 员工活码批量下载
*
* @param ids 新客自动拉群ids
* @param request 请求
* @param response 输出
* @throws Exception
*/
@ApiOperation
(
value
=
"员工活码批量下载"
,
httpMethod
=
"GET"
)
@PreAuthorize
(
"@ss.hasPermi('wecom:code:downloadBatch')"
)
@Log
(
title
=
"员工活码批量下载"
,
businessType
=
BusinessType
.
OTHER
)
@GetMapping
(
"/downloadBatch"
)
public
void
downloadBatch
(
String
ids
,
HttpServletRequest
request
,
HttpServletResponse
response
){
List
<
String
>
idList
=
Arrays
.
stream
(
Optional
.
ofNullable
(
ids
).
orElse
(
""
).
split
(
","
))
.
filter
(
StringUtils:
:
isNotEmpty
).
collect
(
Collectors
.
toList
());
try
{
List
<
WeCommunityNewGroupVo
>
weCommunityNewGroupVos
=
weCommunityNewGroupService
.
selectWeCommunityNewGroupByIds
(
idList
);
//zip输出流
ZipOutputStream
zos
=
new
ZipOutputStream
(
response
.
getOutputStream
());
if
(
CollectionUtil
.
isNotEmpty
(
weCommunityNewGroupVos
)){
for
(
WeCommunityNewGroupVo
communityNewGroupVo
:
weCommunityNewGroupVos
){
String
qrCode
=
communityNewGroupVo
.
getQrCode
();
if
(
StringUtils
.
isEmpty
(
qrCode
)){
continue
;
}
URL
url
=
new
URL
(
qrCode
);
//每个二维码名称
String
fileName
=
communityNewGroupVo
.
getEmpleCodeName
()+
communityNewGroupVo
.
getActivityScene
()+
".jpg"
;
zos
.
putNextEntry
(
new
ZipEntry
(
fileName
));
InputStream
fis
=
url
.
openConnection
().
getInputStream
();
byte
[]
buffer
=
new
byte
[
1024
];
int
r
=
0
;
while
((
r
=
fis
.
read
(
buffer
))
!=
-
1
)
{
zos
.
write
(
buffer
,
0
,
r
);
}
fis
.
close
();
}
}
//关闭zip输出流
zos
.
flush
();
zos
.
close
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
catch
(
Exception
e
){
e
.
printStackTrace
();
}
}
@ApiOperation
(
value
=
"员工活码下载"
,
httpMethod
=
"GET"
)
@PreAuthorize
(
"@ss.hasPermi('wecom:code:download')"
)
@Log
(
title
=
"员工活码下载"
,
businessType
=
BusinessType
.
OTHER
)
@GetMapping
(
"/download"
)
public
void
download
(
String
id
,
HttpServletRequest
request
,
HttpServletResponse
response
){
WeCommunityNewGroupVo
communityNewGroupVo
=
weCommunityNewGroupService
.
selectWeCommunityNewGroupById
(
Long
.
valueOf
(
id
));
if
(
StringUtils
.
isEmpty
(
communityNewGroupVo
.
getQrCode
())){
return
;
}
else
{
try
{
FileUtils
.
downloadFile
(
communityNewGroupVo
.
getQrCode
(),
response
.
getOutputStream
());
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/mapper/WeCommunityNewGroupMapper.java
View file @
8e4f9f1
...
@@ -38,4 +38,12 @@ public interface WeCommunityNewGroupMapper extends BaseMapper<WeCommunityNewGrou
...
@@ -38,4 +38,12 @@ public interface WeCommunityNewGroupMapper extends BaseMapper<WeCommunityNewGrou
*/
*/
int
batchRemoveWeCommunityNewGroupIds
(
List
<
String
>
idList
);
int
batchRemoveWeCommunityNewGroupIds
(
List
<
String
>
idList
);
/**
* 通过id查询新客自动拉群信息列表
*
* @param ids id列表
* @return {@link WeCommunityNewGroup} 新客自动拉群信息
*/
List
<
WeCommunityNewGroupVo
>
selectWeCommunityNewGroupByIds
(
@Param
(
"ids"
)
List
<
String
>
ids
);
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeCommunityNewGroupService.java
View file @
8e4f9f1
...
@@ -33,6 +33,7 @@ public interface IWeCommunityNewGroupService extends IService<WeCommunityNewGrou
...
@@ -33,6 +33,7 @@ public interface IWeCommunityNewGroupService extends IService<WeCommunityNewGrou
/**
/**
* 获取新客自动拉群详细信息
* 获取新客自动拉群详细信息
*
* @param newGroupId 主键id
* @param newGroupId 主键id
* @return {@link WeCommunityNewGroupVo} 自动拉群信息
* @return {@link WeCommunityNewGroupVo} 自动拉群信息
*/
*/
...
@@ -40,6 +41,7 @@ public interface IWeCommunityNewGroupService extends IService<WeCommunityNewGrou
...
@@ -40,6 +41,7 @@ public interface IWeCommunityNewGroupService extends IService<WeCommunityNewGrou
/**
/**
* 修改新客自动拉群
* 修改新客自动拉群
*
* @param communityNewGroupDto 信息
* @param communityNewGroupDto 信息
* @return 结果
* @return 结果
*/
*/
...
@@ -52,4 +54,21 @@ public interface IWeCommunityNewGroupService extends IService<WeCommunityNewGrou
...
@@ -52,4 +54,21 @@ public interface IWeCommunityNewGroupService extends IService<WeCommunityNewGrou
* @return
* @return
*/
*/
int
batchRemoveWeCommunityNewGroupIds
(
List
<
String
>
idList
);
int
batchRemoveWeCommunityNewGroupIds
(
List
<
String
>
idList
);
/**
* 通过id查询新客自动拉群信息
*
* @param id id
* @return {@link WeCommunityNewGroup} 新客自动拉群信息
*/
WeCommunityNewGroupVo
selectWeCommunityNewGroupById
(
long
id
);
/**
* 通过id查询新客自动拉群信息列表
*
* @param ids id列表
* @return {@link WeCommunityNewGroup} 新客自动拉群信息
*/
List
<
WeCommunityNewGroupVo
>
selectWeCommunityNewGroupByIds
(
List
<
String
>
ids
);
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeCommunityNewGroupServiceImpl.java
View file @
8e4f9f1
...
@@ -61,7 +61,7 @@ public class WeCommunityNewGroupServiceImpl extends ServiceImpl<WeCommunityNewG
...
@@ -61,7 +61,7 @@ public class WeCommunityNewGroupServiceImpl extends ServiceImpl<WeCommunityNewG
//检查群活码是否存在
//检查群活码是否存在
WeGroupCode
weGroupCode
=
weGroupCodeMapper
.
selectWeGroupCodeById
(
communityNewGroupDto
.
getGroupCodeId
());
WeGroupCode
weGroupCode
=
weGroupCodeMapper
.
selectWeGroupCodeById
(
communityNewGroupDto
.
getGroupCodeId
());
if
(
null
!=
weGroupCode
)
{
if
(
null
!=
weGroupCode
)
{
throw
new
WeComException
(
"群活码不存在!"
);
throw
new
WeComException
(
"群活码不存在!"
);
}
}
WeEmpleCode
weEmpleCode
=
getWeEmpleCode
(
communityNewGroupDto
);
WeEmpleCode
weEmpleCode
=
getWeEmpleCode
(
communityNewGroupDto
);
...
@@ -71,7 +71,7 @@ public class WeCommunityNewGroupServiceImpl extends ServiceImpl<WeCommunityNewG
...
@@ -71,7 +71,7 @@ public class WeCommunityNewGroupServiceImpl extends ServiceImpl<WeCommunityNewG
WeExternalContactDto
qrCode
=
weEmpleCodeService
.
getQrCode
(
weContactWay
);
WeExternalContactDto
qrCode
=
weEmpleCodeService
.
getQrCode
(
weContactWay
);
//保存新客自动拉群信息
//保存新客自动拉群信息
WeCommunityNewGroup
communityNewGroup
=
new
WeCommunityNewGroup
();
WeCommunityNewGroup
communityNewGroup
=
new
WeCommunityNewGroup
();
communityNewGroup
.
setNewGroupId
(
weGroupCode
.
getId
());
communityNewGroup
.
setNewGroupId
(
weGroupCode
.
getId
());
communityNewGroup
.
setEmpleCodeName
(
communityNewGroupDto
.
getActivityScene
());
communityNewGroup
.
setEmpleCodeName
(
communityNewGroupDto
.
getActivityScene
());
communityNewGroup
.
setDelFlag
(
0
);
communityNewGroup
.
setDelFlag
(
0
);
...
@@ -117,7 +117,7 @@ public class WeCommunityNewGroupServiceImpl extends ServiceImpl<WeCommunityNewG
...
@@ -117,7 +117,7 @@ public class WeCommunityNewGroupServiceImpl extends ServiceImpl<WeCommunityNewG
@Override
@Override
public
List
<
WeCommunityNewGroupVo
>
selectWeCommunityNewGroupList
(
WeCommunityNewGroup
communityNewGroup
)
{
public
List
<
WeCommunityNewGroupVo
>
selectWeCommunityNewGroupList
(
WeCommunityNewGroup
communityNewGroup
)
{
List
<
WeCommunityNewGroupVo
>
weCommunityNewGroupVos
=
weCommunityNewGroupMapper
.
selectWeCommunityNewGroupList
(
communityNewGroup
);
List
<
WeCommunityNewGroupVo
>
weCommunityNewGroupVos
=
weCommunityNewGroupMapper
.
selectWeCommunityNewGroupList
(
communityNewGroup
);
if
(
CollectionUtil
.
isNotEmpty
(
weCommunityNewGroupVos
))
{
if
(
CollectionUtil
.
isNotEmpty
(
weCommunityNewGroupVos
))
{
List
<
Long
>
newGroupIdList
=
weCommunityNewGroupVos
.
stream
().
map
(
WeCommunityNewGroupVo:
:
getNewGroupId
).
collect
(
Collectors
.
toList
());
List
<
Long
>
newGroupIdList
=
weCommunityNewGroupVos
.
stream
().
map
(
WeCommunityNewGroupVo:
:
getNewGroupId
).
collect
(
Collectors
.
toList
());
List
<
WeEmpleCodeUseScop
>
useScopList
=
iWeEmpleCodeUseScopService
.
selectWeEmpleCodeUseScopListByIds
(
newGroupIdList
);
List
<
WeEmpleCodeUseScop
>
useScopList
=
iWeEmpleCodeUseScopService
.
selectWeEmpleCodeUseScopListByIds
(
newGroupIdList
);
List
<
WeEmpleCodeTag
>
tagList
=
weEmpleCodeTagService
.
selectWeEmpleCodeTagListByIds
(
newGroupIdList
);
List
<
WeEmpleCodeTag
>
tagList
=
weEmpleCodeTagService
.
selectWeEmpleCodeTagListByIds
(
newGroupIdList
);
...
@@ -139,7 +139,7 @@ public class WeCommunityNewGroupServiceImpl extends ServiceImpl<WeCommunityNewG
...
@@ -139,7 +139,7 @@ public class WeCommunityNewGroupServiceImpl extends ServiceImpl<WeCommunityNewG
@Override
@Override
public
WeCommunityNewGroupVo
selectWeCommunityNewGroupById
(
Long
newGroupId
)
{
public
WeCommunityNewGroupVo
selectWeCommunityNewGroupById
(
Long
newGroupId
)
{
WeCommunityNewGroupVo
weCommunityNewGroupVo
=
weCommunityNewGroupMapper
.
selectWeCommunityNewGroupById
(
newGroupId
);
WeCommunityNewGroupVo
weCommunityNewGroupVo
=
weCommunityNewGroupMapper
.
selectWeCommunityNewGroupById
(
newGroupId
);
if
(
null
!=
weCommunityNewGroupVo
)
{
if
(
null
!=
weCommunityNewGroupVo
)
{
List
<
WeGroupCodeActual
>
weGroupCodeActuals
=
getWeGroupCodeActuals
(
weCommunityNewGroupVo
);
List
<
WeGroupCodeActual
>
weGroupCodeActuals
=
getWeGroupCodeActuals
(
weCommunityNewGroupVo
);
weCommunityNewGroupVo
.
setWeGroupUserScops
(
weGroupCodeActuals
);
weCommunityNewGroupVo
.
setWeGroupUserScops
(
weGroupCodeActuals
);
List
<
WeEmpleCodeUseScop
>
useScopList
=
iWeEmpleCodeUseScopService
.
selectWeEmpleCodeUseScopListByIds
(
Lists
.
newArrayList
(
weCommunityNewGroupVo
.
getNewGroupId
()));
List
<
WeEmpleCodeUseScop
>
useScopList
=
iWeEmpleCodeUseScopService
.
selectWeEmpleCodeUseScopListByIds
(
Lists
.
newArrayList
(
weCommunityNewGroupVo
.
getNewGroupId
()));
...
@@ -166,13 +166,13 @@ public class WeCommunityNewGroupServiceImpl extends ServiceImpl<WeCommunityNewG
...
@@ -166,13 +166,13 @@ public class WeCommunityNewGroupServiceImpl extends ServiceImpl<WeCommunityNewG
//检查群活码是否存在
//检查群活码是否存在
WeGroupCode
weGroupCode
=
weGroupCodeMapper
.
selectWeGroupCodeById
(
communityNewGroupDto
.
getGroupCodeId
());
WeGroupCode
weGroupCode
=
weGroupCodeMapper
.
selectWeGroupCodeById
(
communityNewGroupDto
.
getGroupCodeId
());
if
(
null
!=
weGroupCode
)
{
if
(
null
!=
weGroupCode
)
{
throw
new
WeComException
(
"群活码不存在!"
);
throw
new
WeComException
(
"群活码不存在!"
);
}
}
//查询新客自动拉群信息
//查询新客自动拉群信息
WeCommunityNewGroup
communityNewGroup
=
weCommunityNewGroupMapper
.
selectById
(
communityNewGroupDto
.
getGroupCodeId
());
WeCommunityNewGroup
communityNewGroup
=
weCommunityNewGroupMapper
.
selectById
(
communityNewGroupDto
.
getGroupCodeId
());
if
(
null
!=
communityNewGroup
)
{
if
(
null
!=
communityNewGroup
)
{
throw
new
WeComException
(
"信息不存在!"
);
throw
new
WeComException
(
"信息不存在!"
);
}
}
...
@@ -216,4 +216,13 @@ public class WeCommunityNewGroupServiceImpl extends ServiceImpl<WeCommunityNewG
...
@@ -216,4 +216,13 @@ public class WeCommunityNewGroupServiceImpl extends ServiceImpl<WeCommunityNewG
return
weCommunityNewGroupMapper
.
batchRemoveWeCommunityNewGroupIds
(
idList
);
return
weCommunityNewGroupMapper
.
batchRemoveWeCommunityNewGroupIds
(
idList
);
}
}
@Override
public
WeCommunityNewGroupVo
selectWeCommunityNewGroupById
(
long
id
)
{
return
weCommunityNewGroupMapper
.
selectWeCommunityNewGroupById
(
id
);
}
@Override
public
List
<
WeCommunityNewGroupVo
>
selectWeCommunityNewGroupByIds
(
List
<
String
>
ids
)
{
return
weCommunityNewGroupMapper
.
selectWeCommunityNewGroupByIds
(
ids
);
}
}
}
linkwe-wecom/src/main/resources/mapper/wecom/WeCommunityNewGroupMapper.xml
View file @
8e4f9f1
...
@@ -5,8 +5,7 @@
...
@@ -5,8 +5,7 @@
<mapper
namespace=
"com.linkwechat.wecom.mapper.WeCommunityNewGroupMapper"
>
<mapper
namespace=
"com.linkwechat.wecom.mapper.WeCommunityNewGroupMapper"
>
<sql
id=
"selectSql"
>
<sql
id=
"selectSql"
>
SELECT
SELECT new_group_id,
new_group_id,
emple_code_name,
emple_code_name,
group_code_id,
group_code_id,
create_by,
create_by,
...
@@ -20,8 +19,7 @@
...
@@ -20,8 +19,7 @@
is_join_confirm_friends,
is_join_confirm_friends,
media_id,
media_id,
join_friend_nums
join_friend_nums
FROM
FROM we_community_new_group
we_community_new_group
</sql>
</sql>
<update
id=
"batchRemoveWeCommunityNewGroupIds"
>
<update
id=
"batchRemoveWeCommunityNewGroupIds"
>
update we_community_new_group set
update we_community_new_group set
...
@@ -29,7 +27,7 @@
...
@@ -29,7 +27,7 @@
where new_group_id in
where new_group_id in
<foreach
collection=
"ids"
item=
"id"
index=
"index"
<foreach
collection=
"ids"
item=
"id"
index=
"index"
separator=
","
open=
"("
close=
")"
>
separator=
","
open=
"("
close=
")"
>
#{
newGroupI
d}
#{
i
d}
</foreach>
</foreach>
</update>
</update>
...
@@ -62,4 +60,15 @@
...
@@ -62,4 +60,15 @@
</where>
</where>
</select>
</select>
<select
id=
"selectWeCommunityNewGroupByIds"
resultType=
"com.linkwechat.wecom.domain.vo.WeCommunityNewGroupVo"
>
<include
refid=
"selectSql"
/>
<where>
new_group_id in
<foreach
collection=
"ids"
item=
"id"
index=
"index"
separator=
","
open=
"("
close=
")"
>
#{id}
</foreach>
</where>
</select>
</mapper>
</mapper>
\ No newline at end of file
\ 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