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 c771008e
authored
Mar 01, 2021
by
sunxiwang
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge remote-tracking branch 'origin/back_end_dev' into back_end_dev
2 parents
3e2cea67
a80b4575
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
263 additions
and
108 deletions
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeCommunityNewGroupController.java
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WePosterController.java
linkwe-admin/src/main/resources/bootstrap.properties
linkwe-common/pom.xml
linkwe-common/src/main/java/com/linkwechat/common/core/elasticsearch/ElasticSearch.java
linkwe-common/src/main/java/com/linkwechat/common/utils/wecom/RSAUtil.java
linkwe-common/src/main/java/com/tencent/wework/FinanceUtils.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/java/com/linkwechat/wecom/service/impl/WePosterServiceImpl.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeSensitiveServiceImpl.java
linkwe-wecom/src/main/resources/mapper/wecom/WeCommunityNewGroupMapper.xml
linkwe-wecom/src/main/resources/mapper/wecom/WeCustomerMessageOriginalMapper.xml
linkwe-wecom/src/main/resources/mapper/wecom/WeCustomerMessgaeResultMapper.xml
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeCommunityNewGroupController.java
View file @
c771008
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
...
...
@@ -36,25 +46,28 @@ import java.util.stream.Collectors;
@RequestMapping
(
value
=
"communityNewGroup"
)
public
class
WeCommunityNewGroupController
extends
BaseController
{
@Autowired
private
IWeCommunityNewGroupService
weCommunityNewGroupService
;
@Autowired
private
IWeCommunityNewGroupService
weCommunityNewGroupService
;
/**
* 查询新客自动拉群列表
*/
@ApiOperation
(
value
=
"查询新客自动拉群列表"
,
httpMethod
=
"GET"
)
@ApiOperation
(
value
=
"查询新客自动拉群列表"
,
httpMethod
=
"GET"
)
@PreAuthorize
(
"@ss.hasPermi('wecom:communityNewGroup:list')"
)
@GetMapping
(
"/list"
)
public
TableDataInfo
list
(
WeCommunityNewGroup
communityNewGroup
)
{
public
TableDataInfo
list
(
@RequestParam
(
value
=
"empleCodeName"
,
required
=
false
)
String
empleCodeName
,
@RequestParam
(
value
=
"createBy"
,
required
=
false
)
String
createBy
,
@RequestParam
(
value
=
"beginTime"
,
required
=
false
)
String
beginTime
,
@RequestParam
(
value
=
"endTime"
,
required
=
false
)
String
endTime
)
{
startPage
();
List
<
WeCommunityNewGroupVo
>
communityNewGroupVos
=
weCommunityNewGroupService
.
selectWeCommunityNewGroupList
(
communityNewGroup
);
List
<
WeCommunityNewGroupVo
>
communityNewGroupVos
=
weCommunityNewGroupService
.
selectWeCommunityNewGroupList
(
empleCodeName
,
createBy
,
beginTime
,
endTime
);
return
getDataTable
(
communityNewGroupVos
);
}
/**
* 获取新客自动拉群详细信息
*/
@ApiOperation
(
value
=
"获取新客自动拉群详细信息"
,
httpMethod
=
"GET"
)
@ApiOperation
(
value
=
"获取新客自动拉群详细信息"
,
httpMethod
=
"GET"
)
@PreAuthorize
(
"@ss.hasPermi('wecom:communityNewGroup:query')"
)
@GetMapping
(
value
=
"/{id}"
)
public
AjaxResult
<
WeCommunityNewGroupVo
>
getInfo
(
@PathVariable
(
"newGroupId"
)
@ApiParam
(
"主键ID"
)
Long
newGroupId
)
{
...
...
@@ -64,7 +77,7 @@ public class WeCommunityNewGroupController extends BaseController {
/**
* 修改新客自动拉群
*/
@ApiOperation
(
value
=
"修改新客自动拉群"
,
httpMethod
=
"PUT"
)
@ApiOperation
(
value
=
"修改新客自动拉群"
,
httpMethod
=
"PUT"
)
@PreAuthorize
(
"@ss.hasPermi('wecom:communityNewGroup:edit')"
)
@Log
(
title
=
"新客自动拉群"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
(
"/update"
)
...
...
@@ -77,7 +90,7 @@ public class WeCommunityNewGroupController extends BaseController {
/**
* 删除新客自动拉群
*/
@ApiOperation
(
value
=
"删除新客自动拉群"
,
httpMethod
=
"DELETE"
)
@ApiOperation
(
value
=
"删除新客自动拉群"
,
httpMethod
=
"DELETE"
)
@PreAuthorize
(
"@ss.hasPermi('wecom:communityNewGroup:remove')"
)
@Log
(
title
=
"新客自动拉群"
,
businessType
=
BusinessType
.
DELETE
)
@DeleteMapping
(
"/delete/{ids}"
)
...
...
@@ -90,7 +103,7 @@ public class WeCommunityNewGroupController extends BaseController {
/**
* 新增新客自动拉群
*/
@ApiOperation
(
value
=
"新增新客自动拉群"
,
httpMethod
=
"POST"
)
@ApiOperation
(
value
=
"新增新客自动拉群"
,
httpMethod
=
"POST"
)
@PreAuthorize
(
"@ss.hasPermi('wecom:communityNewGroup:add')"
)
@Log
(
title
=
"新客自动拉群"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
(
"/add"
)
...
...
@@ -100,9 +113,9 @@ public class WeCommunityNewGroupController extends BaseController {
return
AjaxResult
.
success
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
if
(
e
instanceof
WeComException
){
if
(
e
instanceof
WeComException
)
{
return
AjaxResult
.
error
(
e
.
getMessage
());
}
else
{
}
else
{
return
AjaxResult
.
error
(
"请求接口异常!"
);
}
}
...
...
@@ -110,4 +123,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-admin/src/main/java/com/linkwechat/web/controller/wecom/WePosterController.java
View file @
c771008
...
...
@@ -79,7 +79,7 @@ public class WePosterController extends BaseController {
poster
.
setMediaType
(
null
);
wePosterService
.
generateSimpleImg
(
poster
);
wePosterService
.
saveOrUpdate
(
poster
);
List
<
WePosterSubassembly
>
posterSubassemblyList
=
wePosterSubassemblyService
.
lambdaQuery
().
eq
(
WePosterSubassembly:
:
getPosterId
,
poster
.
getId
()).
eq
(
WePosterSubassembly:
:
getDelFlag
,
1
).
list
();
List
<
WePosterSubassembly
>
posterSubassemblyList
=
wePosterSubassemblyService
.
lambdaQuery
().
eq
(
WePosterSubassembly:
:
getPosterId
,
poster
.
getId
()).
eq
(
WePosterSubassembly:
:
getDelFlag
,
0
).
list
();
Map
<
Long
,
WePosterSubassembly
>
posterSubassemblyMap
=
posterSubassemblyList
.
stream
().
collect
(
Collectors
.
toMap
(
WePosterSubassembly:
:
getId
,
p
->
p
));
if
(!
CollectionUtils
.
isEmpty
(
poster
.
getPosterSubassemblyList
()))
{
List
<
WePosterSubassembly
>
insertList
=
new
ArrayList
<>();
...
...
@@ -104,8 +104,7 @@ public class WePosterController extends BaseController {
}
List
<
WePosterSubassembly
>
deleteList
=
new
ArrayList
<>(
posterSubassemblyMap
.
values
());
if
(!
CollectionUtils
.
isEmpty
(
deleteList
))
{
deleteList
.
forEach
(
wePosterSubassembly
->
wePosterSubassembly
.
setDelFlag
(
1
));
wePosterSubassemblyService
.
updateBatchById
(
deleteList
);
wePosterSubassemblyService
.
update
(
Wrappers
.
lambdaUpdate
(
WePosterSubassembly
.
class
).
set
(
WePosterSubassembly:
:
getDelFlag
,
1
).
in
(
WePosterSubassembly:
:
getId
,
deleteList
.
stream
().
map
(
WePosterSubassembly:
:
getId
).
collect
(
Collectors
.
toList
())));
}
return
AjaxResult
.
success
(
"修改成功"
);
}
...
...
linkwe-admin/src/main/resources/bootstrap.properties
View file @
c771008
spring.cloud.nacos.config.server-
addr
=
${NACOS_SERVER:119.45.28.29:10848}
spring.cloud.nacos.config.namespace
=
627a666a-76b2-42ad-a1b0-70a12d2c73fd
spring.application.name
=
link-wechat
spring.cloud.nacos.config.file-
extension
=
yaml
spring.cloud.nacos.config.username
=
dev
spring.cloud.nacos.config.password
=
dev
\ No newline at end of file
spring.cloud.nacos.config.file-
extension
=
yaml
\ No newline at end of file
linkwe-common/pom.xml
View file @
c771008
...
...
@@ -149,8 +149,6 @@
</dependency>
<!--防止进入swagger页面报类型转换错误,排除2.9.2中的引用,手动增加1.5.21版本-->
<dependency>
<groupId>
io.swagger
</groupId>
...
...
@@ -245,6 +243,23 @@
<artifactId>
cos_api
</artifactId>
<version>
5.6.24
</version>
</dependency>
<!-- 增加RSA PKCS1解密支持 -->
<dependency>
<groupId>
org.bouncycastle
</groupId>
<artifactId>
bcprov-jdk15on
</artifactId>
<version>
1.68
</version>
</dependency>
<dependency>
<groupId>
org.bouncycastle
</groupId>
<artifactId>
bcpg-jdk15on
</artifactId>
<version>
1.68
</version>
</dependency>
<dependency>
<groupId>
org.bouncycastle
</groupId>
<artifactId>
bcpkix-jdk15on
</artifactId>
<version>
1.68
</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
linkwe-common/src/main/java/com/linkwechat/common/core/elasticsearch/ElasticSearch.java
View file @
c771008
...
...
@@ -97,12 +97,16 @@ public class ElasticSearch {
return
;
}
CreateIndexRequest
request
=
new
CreateIndexRequest
(
idxName
);
GetIndexRequest
getIndexRequest
=
new
GetIndexRequest
(
idxName
);
buildSetting
(
request
);
request
.
mapping
(
builder
);
// request.settings() 手工指定Setting
CreateIndexResponse
res
=
restHighLevelClient
.
indices
().
create
(
request
,
RequestOptions
.
DEFAULT
);
if
(!
res
.
isAcknowledged
())
{
log
.
info
(
"初始化失败"
);
boolean
exists
=
restHighLevelClient
.
indices
().
exists
(
getIndexRequest
,
RequestOptions
.
DEFAULT
);
if
(!
exists
)
{
CreateIndexResponse
res
=
restHighLevelClient
.
indices
().
create
(
request
,
RequestOptions
.
DEFAULT
);
if
(!
res
.
isAcknowledged
())
{
log
.
info
(
"初始化失败"
);
}
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
...
...
linkwe-common/src/main/java/com/linkwechat/common/utils/wecom/RSAUtil.java
View file @
c771008
package
com
.
linkwechat
.
common
.
utils
.
wecom
;
import
sun.security.util.DerInputStream
;
import
sun.security.util.DerValue
;
import
org.bouncycastle.openssl.PEMKeyPair
;
import
org.bouncycastle.openssl.PEMParser
;
import
org.bouncycastle.openssl.jcajce.JcaPEMKeyConverter
;
import
javax.crypto.BadPaddingException
;
import
javax.crypto.Cipher
;
import
javax.crypto.IllegalBlockSizeException
;
import
javax.crypto.NoSuchPaddingException
;
import
java.io.IOException
;
import
java.math.BigInteger
;
import
java.security.InvalidKeyException
;
import
java.security.KeyFactory
;
import
java.security.NoSuchAlgorithmException
;
import
java.security.PrivateKey
;
import
java.security.spec.InvalidKeySpecException
;
import
java.security.spec.RSAPrivateCrtKeySpec
;
import
java.io.Reader
;
import
java.io.StringReader
;
import
java.nio.charset.StandardCharsets
;
import
java.security.*
;
import
java.util.Base64
;
/**
...
...
@@ -26,51 +24,42 @@ public class RSAUtil {
/**
* RSA pkcs1 2048bit 解密工具,
* 获取私钥PrivateKey
*
* @param privKeyPEM 2048bit pkcs1格式,base64编码后的RSA字符串
* @return
PrivateKey,
用于解密 decryptRSA
* @return
PrivateKey,
用于解密 decryptRSA
* @throws IOException 异常
* @throws NoSuchAlgorithmException 异常
* @throws InvalidKeySpecException 异常
*/
public
static
PrivateKey
getPrivateKey
(
String
privKeyPEM
)
throws
IOException
,
NoSuchAlgorithmException
,
InvalidKeySpecException
{
String
privKeyPEMnew
=
privKeyPEM
.
replaceAll
(
"\\r\\n"
,
""
)
//看看保存到数据库的这个字符是不是有\r,如果没有,那就只需要替换掉"\\n"
.
replaceAll
(
"\n"
,
""
)
.
replace
(
"-----BEGIN RSA PRIVATE KEY-----"
,
""
)
.
replace
(
"-----END RSA PRIVATE KEY-----"
,
""
);
byte
[]
bytes
=
java
.
util
.
Base64
.
getDecoder
().
decode
(
privKeyPEMnew
);
DerInputStream
derReader
=
new
DerInputStream
(
bytes
);
DerValue
[]
seq
=
derReader
.
getSequence
(
0
);
BigInteger
modulus
=
seq
[
1
].
getBigInteger
();
BigInteger
publicExp
=
seq
[
2
].
getBigInteger
();
BigInteger
privateExp
=
seq
[
3
].
getBigInteger
();
BigInteger
prime1
=
seq
[
4
].
getBigInteger
();
BigInteger
prime2
=
seq
[
5
].
getBigInteger
();
BigInteger
exp1
=
seq
[
6
].
getBigInteger
();
BigInteger
exp2
=
seq
[
7
].
getBigInteger
();
BigInteger
crtCoef
=
seq
[
8
].
getBigInteger
();
RSAPrivateCrtKeySpec
keySpec
=
new
RSAPrivateCrtKeySpec
(
modulus
,
publicExp
,
privateExp
,
prime1
,
prime2
,
exp1
,
exp2
,
crtCoef
);
KeyFactory
keyFactory
=
KeyFactory
.
getInstance
(
"RSA"
);
PrivateKey
privateKey
=
keyFactory
.
generatePrivate
(
keySpec
);
public
static
PrivateKey
getPrivateKey
(
String
privKeyPEM
)
throws
IOException
{
PrivateKey
privateKey
=
null
;
Reader
privateKeyReader
=
new
StringReader
(
privKeyPEM
);
PEMParser
privatePemParser
=
new
PEMParser
(
privateKeyReader
);
Object
privateObject
=
privatePemParser
.
readObject
();
if
(
privateObject
instanceof
PEMKeyPair
)
{
PEMKeyPair
pemKeyPair
=
(
PEMKeyPair
)
privateObject
;
JcaPEMKeyConverter
converter
=
new
JcaPEMKeyConverter
().
setProvider
(
"BC"
);
privateKey
=
converter
.
getPrivateKey
(
pemKeyPair
.
getPrivateKeyInfo
());
}
return
privateKey
;
}
/**
* RSA pkcs1 2048bit 解密工具,
* @param str 被解密的字符串
*
* @param str 被解密的字符串
* @param privateKey 私钥对象 从 getPrivateKey 获取
* @return 解密后数据
* @throws NoSuchPaddingException 异常
* @throws NoSuchAlgorithmException 异常
* @throws InvalidKeyException 异常
* @throws BadPaddingException 异常
* @throws NoSuchPaddingException
异常
* @throws NoSuchAlgorithmException
异常
* @throws InvalidKeyException
异常
* @throws BadPaddingException
异常
* @throws IllegalBlockSizeException 异常
*/
public
static
String
decryptRSA
(
String
str
,
PrivateKey
privateKey
)
throws
NoSuchPaddingException
,
NoSuchAlgorithmException
,
InvalidKeyException
,
BadPaddingException
,
IllegalBlockSizeException
{
Cipher
cipher
=
Cipher
.
getInstance
(
"RSA"
);
cipher
.
init
(
Cipher
.
DECRYPT_MODE
,
privateKey
);
byte
[]
randomkeybyte
=
Base64
.
getDecoder
().
decode
(
str
);
byte
[]
finalrandomkeybyte
=
cipher
.
doFinal
(
randomkeybyte
);
return
new
String
(
finalrandomkeybyte
);
public
static
String
decryptRSA
(
String
str
,
PrivateKey
privateKey
)
throws
NoSuchPaddingException
,
NoSuchAlgorithmException
,
InvalidKeyException
,
BadPaddingException
,
IllegalBlockSizeException
,
NoSuchProviderException
{
Security
.
addProvider
(
new
org
.
bouncycastle
.
jce
.
provider
.
BouncyCastleProvider
()
);
Cipher
rsa
=
Cipher
.
getInstance
(
"RSA/ECB/PKCS1Padding"
,
"BC"
);
rsa
.
init
(
Cipher
.
DECRYPT_MODE
,
privateKey
);
byte
[]
utf8
=
rsa
.
doFinal
(
Base64
.
getDecoder
().
decode
(
str
)
);
return
new
String
(
utf8
,
StandardCharsets
.
UTF_8
);
}
}
linkwe-common/src/main/java/com/tencent/wework/FinanceUtils.java
View file @
c771008
...
...
@@ -5,7 +5,6 @@ import com.alibaba.fastjson.JSONArray;
import
com.alibaba.fastjson.JSONObject
;
import
com.linkwechat.common.config.CosConfig
;
import
com.linkwechat.common.config.RuoYiConfig
;
import
com.linkwechat.common.constant.Constants
;
import
com.linkwechat.common.constant.WeConstans
;
import
com.linkwechat.common.core.redis.RedisCache
;
import
com.linkwechat.common.utils.DateUtils
;
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/mapper/WeCommunityNewGroupMapper.java
View file @
c771008
...
...
@@ -21,7 +21,8 @@ public interface WeCommunityNewGroupMapper extends BaseMapper<WeCommunityNewGrou
* @param communityNewGroup 搜索信息
* @return {@link WeCommunityNewGroup}s
*/
List
<
WeCommunityNewGroupVo
>
selectWeCommunityNewGroupList
(
WeCommunityNewGroup
communityNewGroup
);
List
<
WeCommunityNewGroupVo
>
selectWeCommunityNewGroupList
(
@Param
(
"empleCodeName"
)
String
empleCodeName
,
@Param
(
"createBy"
)
String
createBy
,
@Param
(
"beginTime"
)
String
beginTime
,
@Param
(
"endTime"
)
String
endTime
);
/**
* 获取新客自动拉群详细信息
...
...
@@ -38,4 +39,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 @
c771008
...
...
@@ -26,13 +26,13 @@ public interface IWeCommunityNewGroupService extends IService<WeCommunityNewGrou
/**
* 查询新客自动拉群列表
*
* @param communityNewGroup 搜索信息
* @return {@link WeCommunityNewGroup}s
*/
List
<
WeCommunityNewGroupVo
>
selectWeCommunityNewGroupList
(
WeCommunityNewGroup
communityNewGroup
);
List
<
WeCommunityNewGroupVo
>
selectWeCommunityNewGroupList
(
String
empleCodeName
,
String
createBy
,
String
beginTime
,
String
endTime
);
/**
* 获取新客自动拉群详细信息
*
* @param newGroupId 主键id
* @return {@link WeCommunityNewGroupVo} 自动拉群信息
*/
...
...
@@ -40,6 +40,7 @@ public interface IWeCommunityNewGroupService extends IService<WeCommunityNewGrou
/**
* 修改新客自动拉群
*
* @param communityNewGroupDto 信息
* @return 结果
*/
...
...
@@ -51,5 +52,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 @
c771008
...
...
@@ -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
);
...
...
@@ -115,9 +115,9 @@ public class WeCommunityNewGroupServiceImpl extends ServiceImpl<WeCommunityNewG
}
@Override
public
List
<
WeCommunityNewGroupVo
>
selectWeCommunityNewGroupList
(
WeCommunityNewGroup
communityNewGroup
)
{
List
<
WeCommunityNewGroupVo
>
weCommunityNewGroupVos
=
weCommunityNewGroupMapper
.
selectWeCommunityNewGroupList
(
communityNewGroup
);
if
(
CollectionUtil
.
isNotEmpty
(
weCommunityNewGroupVos
))
{
public
List
<
WeCommunityNewGroupVo
>
selectWeCommunityNewGroupList
(
String
empleCodeName
,
String
createBy
,
String
beginTime
,
String
endTime
)
{
List
<
WeCommunityNewGroupVo
>
weCommunityNewGroupVos
=
weCommunityNewGroupMapper
.
selectWeCommunityNewGroupList
(
empleCodeName
,
createBy
,
beginTime
,
endTime
);
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/java/com/linkwechat/wecom/service/impl/WePosterServiceImpl.java
View file @
c771008
...
...
@@ -126,13 +126,24 @@ public class WePosterServiceImpl extends ServiceImpl<WePosterMapper, WePoster> i
poster
.
setSampleImgPath
(
poster
.
getBackgroundImgPath
());
return
poster
.
getBackgroundImgPath
();
}
Map
<
Long
,
Font
>
fontMap
=
poster
.
getPosterSubassemblyList
().
stream
().
filter
(
wePosterSubassembly
->
wePosterSubassembly
.
getType
().
equals
(
1
))
Set
<
String
>
existFontId
=
new
HashSet
<>();
Map
<
String
,
Font
>
fontMap
=
poster
.
getPosterSubassemblyList
().
stream
().
filter
(
wePosterSubassembly
->
wePosterSubassembly
.
getType
().
equals
(
1
))
.
peek
(
wePosterSubassembly
->
{
if
(
wePosterSubassembly
.
getFontId
()
==
null
)
{
if
(
wePosterSubassembly
.
getFontId
()
==
null
)
{
wePosterSubassembly
.
setFontId
(
0L
);
}
})
.
collect
(
Collectors
.
toMap
(
WePosterSubassembly:
:
getFontId
,
wePosterSubassembly
->
posterFontService
.
getFont
(
wePosterSubassembly
.
getFontId
(),
wePosterSubassembly
.
getFontSize
(),
wePosterSubassembly
.
getFontStyle
())));
.
filter
(
wePosterSubassembly
->
{
if
(
existFontId
.
contains
(
wePosterSubassembly
.
getFontId
()+
"_"
+
wePosterSubassembly
.
getFontSize
()+
"_"
+
wePosterSubassembly
.
getFontStyle
())){
return
false
;
}
else
{
existFontId
.
add
(
wePosterSubassembly
.
getFontId
()+
"_"
+
wePosterSubassembly
.
getFontSize
()+
"_"
+
wePosterSubassembly
.
getFontStyle
());
return
true
;
}
})
.
collect
(
Collectors
.
toMap
(
wePosterSubassembly
->
{
return
wePosterSubassembly
.
getFontId
()+
"_"
+
wePosterSubassembly
.
getFontSize
()+
"_"
+
wePosterSubassembly
.
getFontStyle
();
},
wePosterSubassembly
->
posterFontService
.
getFont
(
wePosterSubassembly
.
getFontId
(),
wePosterSubassembly
.
getFontSize
(),
wePosterSubassembly
.
getFontStyle
())));
Map
<
String
,
NetFileUtils
.
FileCallable
>
fileCallableMap
=
poster
.
getPosterSubassemblyList
().
stream
().
map
(
WePosterSubassembly:
:
getImgPath
).
filter
(
StringUtils:
:
isNotBlank
).
distinct
().
collect
(
Collectors
.
toMap
(
s
->
s
,
NetFileUtils:
:
getNetFile
));
if
(
CollectionUtils
.
isEmpty
(
fileCallableMap
))
{
fileCallableMap
=
new
HashMap
<>();
...
...
@@ -151,7 +162,7 @@ public class WePosterServiceImpl extends ServiceImpl<WePosterMapper, WePoster> i
poster
.
setHeight
(
backgroundImg
.
getHeight
());
poster
.
getPosterSubassemblyList
().
forEach
(
wePosterSubassembly
->
{
if
(
wePosterSubassembly
.
getType
().
equals
(
1
))
{
Font
font
=
fontMap
.
get
(
wePosterSubassembly
.
getFontId
());
Font
font
=
fontMap
.
get
(
wePosterSubassembly
.
getFontId
()
+
"_"
+
wePosterSubassembly
.
getFontSize
()+
"_"
+
wePosterSubassembly
.
getFontStyle
()
);
FontMetrics
fontMetrics
=
ImageUtils
.
getFontMetrics
(
font
);
Color
color
;
if
(
StringUtils
.
isNotBlank
(
wePosterSubassembly
.
getFontColor
()))
{
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeSensitiveServiceImpl.java
View file @
c771008
...
...
@@ -257,7 +257,7 @@ public class WeSensitiveServiceImpl implements IWeSensitiveService {
private
void
addHitSensitiveList
(
List
<
JSONObject
>
json
,
WeSensitive
weSensitive
)
{
elasticSearch
.
createIndex2
(
WeConstans
.
WECOM_SENSITIVE_HIT_INDEX
,
getSensitiveHitMapping
());
boolean
sendMessage
=
false
;
if
(
weSensitive
.
getAlertFlag
().
equals
(
1
))
{
if
(
weSensitive
.
getAlertFlag
().
equals
(
1
)
&&
CollectionUtils
.
isNotEmpty
(
json
)
)
{
//发送消息通知给相应的审计人
WeCorpAccount
weCorpAccount
=
weCorpAccountService
.
findValidWeCorpAccount
();
String
auditUserId
=
weSensitive
.
getAuditUserId
();
...
...
@@ -268,7 +268,7 @@ public class WeSensitiveServiceImpl implements IWeSensitiveService {
pushDto
.
setTouser
(
auditUserId
);
pushDto
.
setMsgtype
(
MessageType
.
TEXT
.
getMessageType
());
pushDto
.
setText
(
textMessageDto
);
weMessagePushClient
.
sendMessageToUser
(
pushDto
,
weCorpAccount
.
getAgentId
());
weMessagePushClient
.
sendMessageToUser
(
pushDto
,
weCorpAccount
.
getAgentId
());
sendMessage
=
true
;
}
//批量提交插入记录
...
...
linkwe-wecom/src/main/resources/mapper/wecom/WeCommunityNewGroupMapper.xml
View file @
c771008
...
...
@@ -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,16 +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>
emple_code_name LIKE CONCAT("%",#{empleCodeName},"%") AND del_flag = 0
</where>
<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>
</select>
<select
id=
"selectWeCommunityNewGroupById"
...
...
@@ -49,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
linkwe-wecom/src/main/resources/mapper/wecom/WeCustomerMessageOriginalMapper.xml
View file @
c771008
...
...
@@ -40,6 +40,7 @@
AND wcm.create_by=#{sender}
</if>
</where>
ORDER BY wcmo.create_time DESC
</select>
<select
id=
"findCustomerMessagePushDetail"
resultType=
"com.linkwechat.wecom.domain.vo.CustomerMessagePushVo"
>
...
...
linkwe-wecom/src/main/resources/mapper/wecom/WeCustomerMessgaeResultMapper.xml
View file @
c771008
...
...
@@ -25,7 +25,7 @@
chat_name
)
VALUES
<foreach
collection=
"
list
"
item=
"item"
separator=
","
index=
"index"
>
<foreach
collection=
"
customers
"
item=
"item"
separator=
","
index=
"index"
>
(#{item.messgaeResultId},
#{item.messageId},
#{item.externalUserid},
...
...
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