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 d61a52e2
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
740b9259
af1af0f0
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
165 additions
and
42 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 @
d61a52e
package
com
.
linkwechat
.
web
.
controller
.
wecom
;
import
cn.hutool.core.collection.CollectionUtil
;
import
com.linkwechat.common.annotation.Log
;
import
com.linkwechat.common.core.controller.BaseController
;
import
com.linkwechat.common.core.domain.AjaxResult
;
...
...
@@ -7,6 +8,7 @@ import com.linkwechat.common.core.page.TableDataInfo;
import
com.linkwechat.common.enums.BusinessType
;
import
com.linkwechat.common.exception.wecom.WeComException
;
import
com.linkwechat.common.utils.StringUtils
;
import
com.linkwechat.common.utils.file.FileUtils
;
import
com.linkwechat.wecom.domain.WeCommunityNewGroup
;
import
com.linkwechat.wecom.domain.WeEmpleCode
;
import
com.linkwechat.wecom.domain.dto.WeCommunityNewGroupDto
;
...
...
@@ -21,9 +23,17 @@ import org.springframework.stereotype.Controller;
import
org.springframework.validation.annotation.Validated
;
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.List
;
import
java.util.Optional
;
import
java.util.stream.Collectors
;
import
java.util.zip.ZipEntry
;
import
java.util.zip.ZipOutputStream
;
/**
* 社群运营 新客自动拉群 Controller
...
...
@@ -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 @
d61a52e
...
...
@@ -38,4 +38,12 @@ public interface WeCommunityNewGroupMapper extends BaseMapper<WeCommunityNewGrou
*/
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 @
d61a52e
...
...
@@ -33,6 +33,7 @@ public interface IWeCommunityNewGroupService extends IService<WeCommunityNewGrou
/**
* 获取新客自动拉群详细信息
*
* @param newGroupId 主键id
* @return {@link WeCommunityNewGroupVo} 自动拉群信息
*/
...
...
@@ -40,6 +41,7 @@ public interface IWeCommunityNewGroupService extends IService<WeCommunityNewGrou
/**
* 修改新客自动拉群
*
* @param communityNewGroupDto 信息
* @return 结果
*/
...
...
@@ -51,5 +53,22 @@ public interface IWeCommunityNewGroupService extends IService<WeCommunityNewGrou
* @param idList id列表
* @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 @
d61a52e
...
...
@@ -32,7 +32,7 @@ import java.util.stream.Collectors;
*/
@Service
@Slf4j
public
class
WeCommunityNewGroupServiceImpl
extends
ServiceImpl
<
WeCommunityNewGroupMapper
,
WeCommunityNewGroup
>
implements
IWeCommunityNewGroupService
{
public
class
WeCommunityNewGroupServiceImpl
extends
ServiceImpl
<
WeCommunityNewGroupMapper
,
WeCommunityNewGroup
>
implements
IWeCommunityNewGroupService
{
@Autowired
private
WeGroupCodeMapper
weGroupCodeMapper
;
...
...
@@ -61,7 +61,7 @@ public class WeCommunityNewGroupServiceImpl extends ServiceImpl<WeCommunityNewG
//检查群活码是否存在
WeGroupCode
weGroupCode
=
weGroupCodeMapper
.
selectWeGroupCodeById
(
communityNewGroupDto
.
getGroupCodeId
());
if
(
null
!=
weGroupCode
)
{
if
(
null
!=
weGroupCode
)
{
throw
new
WeComException
(
"群活码不存在!"
);
}
WeEmpleCode
weEmpleCode
=
getWeEmpleCode
(
communityNewGroupDto
);
...
...
@@ -71,7 +71,7 @@ public class WeCommunityNewGroupServiceImpl extends ServiceImpl<WeCommunityNewG
WeExternalContactDto
qrCode
=
weEmpleCodeService
.
getQrCode
(
weContactWay
);
//保存新客自动拉群信息
WeCommunityNewGroup
communityNewGroup
=
new
WeCommunityNewGroup
();
WeCommunityNewGroup
communityNewGroup
=
new
WeCommunityNewGroup
();
communityNewGroup
.
setNewGroupId
(
weGroupCode
.
getId
());
communityNewGroup
.
setEmpleCodeName
(
communityNewGroupDto
.
getActivityScene
());
communityNewGroup
.
setDelFlag
(
0
);
...
...
@@ -117,7 +117,7 @@ public class WeCommunityNewGroupServiceImpl extends ServiceImpl<WeCommunityNewG
@Override
public
List
<
WeCommunityNewGroupVo
>
selectWeCommunityNewGroupList
(
WeCommunityNewGroup
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
<
WeEmpleCodeUseScop
>
useScopList
=
iWeEmpleCodeUseScopService
.
selectWeEmpleCodeUseScopListByIds
(
newGroupIdList
);
List
<
WeEmpleCodeTag
>
tagList
=
weEmpleCodeTagService
.
selectWeEmpleCodeTagListByIds
(
newGroupIdList
);
...
...
@@ -139,7 +139,7 @@ public class WeCommunityNewGroupServiceImpl extends ServiceImpl<WeCommunityNewG
@Override
public
WeCommunityNewGroupVo
selectWeCommunityNewGroupById
(
Long
newGroupId
)
{
WeCommunityNewGroupVo
weCommunityNewGroupVo
=
weCommunityNewGroupMapper
.
selectWeCommunityNewGroupById
(
newGroupId
);
if
(
null
!=
weCommunityNewGroupVo
)
{
if
(
null
!=
weCommunityNewGroupVo
)
{
List
<
WeGroupCodeActual
>
weGroupCodeActuals
=
getWeGroupCodeActuals
(
weCommunityNewGroupVo
);
weCommunityNewGroupVo
.
setWeGroupUserScops
(
weGroupCodeActuals
);
List
<
WeEmpleCodeUseScop
>
useScopList
=
iWeEmpleCodeUseScopService
.
selectWeEmpleCodeUseScopListByIds
(
Lists
.
newArrayList
(
weCommunityNewGroupVo
.
getNewGroupId
()));
...
...
@@ -166,13 +166,13 @@ public class WeCommunityNewGroupServiceImpl extends ServiceImpl<WeCommunityNewG
//检查群活码是否存在
WeGroupCode
weGroupCode
=
weGroupCodeMapper
.
selectWeGroupCodeById
(
communityNewGroupDto
.
getGroupCodeId
());
if
(
null
!=
weGroupCode
)
{
if
(
null
!=
weGroupCode
)
{
throw
new
WeComException
(
"群活码不存在!"
);
}
//查询新客自动拉群信息
WeCommunityNewGroup
communityNewGroup
=
weCommunityNewGroupMapper
.
selectById
(
communityNewGroupDto
.
getGroupCodeId
());
if
(
null
!=
communityNewGroup
)
{
if
(
null
!=
communityNewGroup
)
{
throw
new
WeComException
(
"信息不存在!"
);
}
...
...
@@ -216,4 +216,13 @@ public class WeCommunityNewGroupServiceImpl extends ServiceImpl<WeCommunityNewG
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 @
d61a52e
...
...
@@ -5,23 +5,21 @@
<mapper
namespace=
"com.linkwechat.wecom.mapper.WeCommunityNewGroupMapper"
>
<sql
id=
"selectSql"
>
SELECT
new_group_id,
emple_code_name,
group_code_id,
create_by,
create_time,
update_by,
update_time,
del_flag,
activity_scene,
welcome_msg,
qr_code,
is_join_confirm_friends,
media_id,
join_friend_nums
FROM
we_community_new_group
SELECT new_group_id,
emple_code_name,
group_code_id,
create_by,
create_time,
update_by,
update_time,
del_flag,
activity_scene,
welcome_msg,
qr_code,
is_join_confirm_friends,
media_id,
join_friend_nums
FROM we_community_new_group
</sql>
<update
id=
"batchRemoveWeCommunityNewGroupIds"
>
update we_community_new_group set
...
...
@@ -29,29 +27,29 @@
where new_group_id in
<foreach
collection=
"ids"
item=
"id"
index=
"index"
separator=
","
open=
"("
close=
")"
>
#{
newGroupI
d}
#{
i
d}
</foreach>
</update>
<select
id=
"selectWeCommunityNewGroupList"
resultType=
"com.linkwechat.wecom.domain.vo.WeCommunityNewGroupVo"
>
<include
refid=
"selectSql"
/>
<where>
del_flag = 0
<if
test=
"empleCodeName!=null and empleCodeName!=''"
>
AND
emple_code_name LIKE CONCAT("%",#{empleCodeName},"%")
</if>
<if
test=
"beginTime != null and beginTime != ''"
>
<!-- 开始时间检索 -->
AND date_format(create_time,'%y%m%d')
>
= date_format(#{beginTime},'%y%m%d')
</if>
<include
refid=
"selectSql"
/>
<where>
del_flag = 0
<if
test=
"empleCodeName!=null and empleCodeName!=''"
>
AND
emple_code_name LIKE CONCAT("%",#{empleCodeName},"%")
</if>
<if
test=
"beginTime != null and beginTime != ''"
>
<!-- 开始时间检索 -->
AND date_format(create_time,'%y%m%d')
>
= date_format(#{beginTime},'%y%m%d')
</if>
<if
test=
"endTime != null and endTime != ''"
>
<!-- 结束时间检索 -->
AND date_format(create_time,'%y%m%d')
<
= date_format(#{endTime},'%y%m%d')
</if>
<if
test=
"createBy!=null and createBy!=''"
>
AND create_by LIKE CONCAT("%",#{createBy},"%")
</if>
</where>
<if
test=
"endTime != null and endTime != ''"
>
<!-- 结束时间检索 -->
AND date_format(create_time,'%y%m%d')
<
= date_format(#{endTime},'%y%m%d')
</if>
<if
test=
"createBy!=null and createBy!=''"
>
AND create_by LIKE CONCAT("%",#{createBy},"%")
</if>
</where>
</select>
<select
id=
"selectWeCommunityNewGroupById"
...
...
@@ -62,4 +60,15 @@
</where>
</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>
\ 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