Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
仟微科技
Link Wechat
提交
5eeba376
Link Wechat
项目概览
仟微科技
/
Link Wechat
通知
48
Star
3
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Link Wechat
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
5eeba376
编写于
5月 25, 2021
作者:
1
1539136324@qq.com
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
优化提取企业微信回调接口所需参数,由配置文件调整至数据库中;
上级
a102c340
变更
18
隐藏空白更改
内联
并排
Showing
18 changed file
with
155 addition
and
100 deletion
+155
-100
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeCallBackController.java
...linkwechat/web/controller/wecom/WeCallBackController.java
+77
-37
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeTaskFissionController.java
...kwechat/web/controller/wecom/WeTaskFissionController.java
+1
-1
linkwe-admin/src/main/resources/application.yml
linkwe-admin/src/main/resources/application.yml
+17
-25
linkwe-admin/src/main/resources/bootstrap.properties
linkwe-admin/src/main/resources/bootstrap.properties
+2
-2
linkwe-common/src/main/java/com/linkwechat/common/config/CosConfig.java
...src/main/java/com/linkwechat/common/config/CosConfig.java
+1
-1
linkwe-common/src/main/java/com/linkwechat/common/core/domain/BaseEntity.java
...in/java/com/linkwechat/common/core/domain/BaseEntity.java
+2
-2
linkwe-common/src/main/java/com/linkwechat/common/core/domain/entity/WeCorpAccount.java
...m/linkwechat/common/core/domain/entity/WeCorpAccount.java
+14
-1
linkwe-common/src/main/java/com/linkwechat/common/utils/SecurityUtils.java
.../main/java/com/linkwechat/common/utils/SecurityUtils.java
+4
-0
linkwe-common/src/main/java/com/linkwechat/common/utils/wecom/WxCryptUtil.java
...n/java/com/linkwechat/common/utils/wecom/WxCryptUtil.java
+1
-1
linkwe-common/src/main/java/com/tencent/wework/FinanceUtils.java
...common/src/main/java/com/tencent/wework/FinanceUtils.java
+1
-1
linkwe-framework/src/main/java/com/linkwechat/framework/config/MyBatisPlusConfig.java
...va/com/linkwechat/framework/config/MyBatisPlusConfig.java
+9
-4
linkwe-quartz/src/main/java/com/linkwechat/quartz/task/RyTask.java
...artz/src/main/java/com/linkwechat/quartz/task/RyTask.java
+12
-12
linkwe-wecom/src/main/java/com/linkwechat/wecom/factory/WeStrategyBeanFactory.java
...a/com/linkwechat/wecom/factory/WeStrategyBeanFactory.java
+1
-0
linkwe-wecom/src/main/java/com/linkwechat/wecom/factory/impl/customer/WeCallBackAddExternalContactImpl.java
...ctory/impl/customer/WeCallBackAddExternalContactImpl.java
+1
-1
linkwe-wecom/src/main/java/com/linkwechat/wecom/factory/impl/party/WeCallBackCreatePartyImpl.java
...t/wecom/factory/impl/party/WeCallBackCreatePartyImpl.java
+1
-2
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeDepartmentService.java
...va/com/linkwechat/wecom/service/IWeDepartmentService.java
+1
-1
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeDepartmentServiceImpl.java
...inkwechat/wecom/service/impl/WeDepartmentServiceImpl.java
+9
-8
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeTaskFissionServiceImpl.java
...nkwechat/wecom/service/impl/WeTaskFissionServiceImpl.java
+1
-1
未找到文件。
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeCallBackController.java
浏览文件 @
5eeba376
package
com.linkwechat.web.controller.wecom
;
import
cn.hutool.core.util.StrUtil
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.linkwechat.common.constant.Constants
;
import
com.linkwechat.common.core.domain.entity.WeCorpAccount
;
import
com.linkwechat.common.core.domain.model.LoginUser
;
import
com.linkwechat.common.utils.SecurityUtils
;
import
com.linkwechat.common.utils.StringUtils
;
import
com.linkwechat.common.utils.Threads
;
import
com.linkwechat.common.utils.wecom.WxCryptUtil
;
import
com.linkwechat.framework.web.service.SysLoginService
;
import
com.linkwechat.web.controller.common.CommonController
;
import
com.linkwechat.wecom.domain.vo.WxCpXmlMessageVO
;
import
com.linkwechat.wecom.factory.WeCallBackEventFactory
;
import
com.linkwechat.wecom.factory.WeEventHandle
;
import
com.linkwechat.wecom.service.IWeCorpAccountService
;
import
com.thoughtworks.xstream.XStream
;
import
com.thoughtworks.xstream.security.AnyTypePermission
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -14,6 +23,7 @@ import me.chanjar.weixin.common.util.xml.XStreamInitializer;
import
me.chanjar.weixin.cp.bean.WxCpXmlMessage
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.security.core.userdetails.UserDetailsService
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletRequest
;
...
...
@@ -28,56 +38,86 @@ import javax.servlet.http.HttpServletRequest;
@RequestMapping
(
"/wecom/callback"
)
public
class
WeCallBackController
extends
CommonController
{
@Autowired
private
WeEventHandle
weEventHandle
;
WeEventHandle
weEventHandle
;
@Autowired
IWeCorpAccountService
iWeCorpAccountService
;
@Autowired
SysLoginService
sysLoginService
;
@Value
(
"${wecome.callBack.appIdOrCorpId}"
)
private
String
appIdOrCorpId
;
@Value
(
"${wecome.callBack.token}"
)
private
String
token
;
@Value
(
"${wecome.callBack.encodingAesKey}"
)
private
String
encodingAesKey
;
@PostMapping
(
value
=
"/recive"
)
public
String
recive
(
@RequestBody
String
msg
,
@RequestParam
(
name
=
"msg_signature"
)
String
signature
,
String
timestamp
,
String
nonce
)
{
WxCryptUtil
wxCryptUtil
=
new
WxCryptUtil
(
token
,
encodingAesKey
,
appIdOrCorpId
);
try
{
String
decrypt
=
wxCryptUtil
.
decrypt
(
signature
,
timestamp
,
nonce
,
msg
);
WxCpXmlMessageVO
wxCpXmlMessage
=
StrXmlToBean
(
decrypt
);
log
.
info
(
"企微回调通知接口 wxCpXmlMessage:{}"
,
JSONObject
.
toJSONString
(
wxCpXmlMessage
));
public
String
recivePost
(
@RequestBody
String
msg
,
@RequestParam
(
name
=
"msg_signature"
)
String
signature
,
String
timestamp
,
String
nonce
,
String
corpId
)
{
if
(
StrUtil
.
isEmpty
(
corpId
)){
return
"error"
;
}
WeCorpAccount
weCorpAccount
=
iWeCorpAccountService
.
getOne
(
new
LambdaQueryWrapper
<
WeCorpAccount
>()
.
eq
(
WeCorpAccount:
:
getCorpId
,
corpId
)
.
eq
(
WeCorpAccount:
:
getStatus
,
Constants
.
NORMAL_CODE
)
.
eq
(
WeCorpAccount:
:
getDelFlag
,
Constants
.
NORMAL_CODE
));
if
(
null
!=
weCorpAccount
){
// //校验当前租户账号是否授权登录了,如果未登录,则无密钥登录
// LoginUser loginUser
// = SecurityUtils.getLoginUser();
// if(null == loginUser){
// sysLoginService.noPwdLogin(weCorpAccount.getCorpAccount());
// }
WxCryptUtil
wxCryptUtil
=
new
WxCryptUtil
(
weCorpAccount
.
getToken
(),
weCorpAccount
.
getEncodingAesKey
(),
weCorpAccount
.
getCorpId
());
try
{
WeCallBackEventFactory
factory
=
weEventHandle
.
factory
(
wxCpXmlMessage
.
getEvent
());
if
(
factory
!=
null
){
Threads
.
SINGLE_THREAD_POOL
.
submit
(()
->
factory
.
eventHandle
(
wxCpXmlMessage
));
String
decrypt
=
wxCryptUtil
.
decrypt
(
signature
,
timestamp
,
nonce
,
msg
);
WxCpXmlMessageVO
wxCpXmlMessage
=
StrXmlToBean
(
decrypt
);
log
.
info
(
"企微回调通知接口 wxCpXmlMessage:{}"
,
JSONObject
.
toJSONString
(
wxCpXmlMessage
));
try
{
WeCallBackEventFactory
factory
=
weEventHandle
.
factory
(
wxCpXmlMessage
.
getEvent
());
if
(
factory
!=
null
){
Threads
.
SINGLE_THREAD_POOL
.
submit
(()
->
factory
.
eventHandle
(
wxCpXmlMessage
));
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
decrypt
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();;
String
sRespData
=
WxCryptUtil
.
getTextRespData
(
"success"
);
return
wxCryptUtil
.
encrypt
(
sRespData
);
}
return
decrypt
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();;
String
sRespData
=
WxCryptUtil
.
getTextRespData
(
"success"
);
return
wxCryptUtil
.
encrypt
(
sRespData
);
}
return
"error"
;
}
@GetMapping
(
value
=
"/recive"
)
public
String
recive
(
HttpServletRequest
request
)
{
// 微信加密签名
String
sVerifyMsgSig
=
request
.
getParameter
(
"msg_signature"
);
// 时间戳
String
sVerifyTimeStamp
=
request
.
getParameter
(
"timestamp"
);
// 随机数
String
sVerifyNonce
=
request
.
getParameter
(
"nonce"
);
// 随机字符串
String
sVerifyEchoStr
=
request
.
getParameter
(
"echostr"
);
WxCryptUtil
wxCryptUtil
=
new
WxCryptUtil
(
token
,
encodingAesKey
,
appIdOrCorpId
);
try
{
return
wxCryptUtil
.
verifyURL
(
sVerifyMsgSig
,
sVerifyTimeStamp
,
sVerifyNonce
,
sVerifyEchoStr
);
}
catch
(
Exception
e
)
{
public
String
reciveGet
(
String
msg_signature
,
String
timestamp
,
String
nonce
,
String
echostr
,
String
corpId
)
{
if
(
StrUtil
.
isEmpty
(
corpId
)){
return
"error"
;
}
WeCorpAccount
weCorpAccount
=
iWeCorpAccountService
.
getOne
(
new
LambdaQueryWrapper
<
WeCorpAccount
>()
.
eq
(
WeCorpAccount:
:
getCorpId
,
corpId
)
.
eq
(
WeCorpAccount:
:
getStatus
,
Constants
.
NORMAL_CODE
)
.
eq
(
WeCorpAccount:
:
getDelFlag
,
Constants
.
NORMAL_CODE
));
if
(
null
!=
weCorpAccount
){
WxCryptUtil
wxCryptUtil
=
new
WxCryptUtil
(
weCorpAccount
.
getToken
(),
weCorpAccount
.
getEncodingAesKey
(),
weCorpAccount
.
getCorpId
());
try
{
return
wxCryptUtil
.
verifyURL
(
msg_signature
,
timestamp
,
nonce
,
echostr
);
}
catch
(
Exception
e
)
{
return
"error"
;
}
}
return
"error"
;
}
private
WxCpXmlMessageVO
StrXmlToBean
(
String
xmlStr
){
...
...
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeTaskFissionController.java
浏览文件 @
5eeba376
...
...
@@ -229,7 +229,7 @@ public class WeTaskFissionController extends BaseController {
public
AjaxResult
<
JSONObject
>
upload
(
@RequestParam
(
value
=
"file"
)
MultipartFile
file
)
throws
IOException
{
String
url
=
FileUploadUtils
.
upload2Cos
(
file
,
cosConfig
);
JSONObject
json
=
new
JSONObject
();
json
.
put
(
"rewardImageUrl"
,
cosConfig
.
getImgUrlPrefix
()+
url
);
json
.
put
(
"rewardImageUrl"
,
cosConfig
.
get
Cos
ImgUrlPrefix
()+
url
);
return
AjaxResult
.
success
(
json
);
}
...
...
linkwe-admin/src/main/resources/application.yml
浏览文件 @
5eeba376
...
...
@@ -12,15 +12,20 @@ ruoyi:
# 是否开启文件云上传(使用的是腾讯云,如果开启了,则需要配置腾讯云存储相关信息;如果关闭了则文件存储再本地,需要配置本地路径)
file
:
startCosUpload
:
true
#图片在系统中的访问前缀,图片无论是上传云端还是服务器本地,都通过本地读取资源,然后返回前端
imgUrlPrefix
:
#腾讯云对象存储
cos
:
#id
secretId
:
#密钥
secretKey
:
#地区
region
:
#区块空间
bucketName
:
# 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /app/project/pic)
#profile: /data/jenkins_home/app/project/
#访问前缀
cosImgUrlPrefix
:
# 获取ip地址开关
addressEnabled
:
false
# 验证码类型 math 数组计算 char 字符验证
...
...
@@ -59,7 +64,7 @@ ruoyi:
-
/wecom/community/h5/**
-
/weixin/auth/**
-
/wecom/material/temporaryMaterialMediaId
-
/common/findImage
# 开发环境配置
server
:
# 服务器的HTTP端口,默认为8090
...
...
@@ -80,15 +85,15 @@ logging:
level
:
com.ruoyi
:
debug
org.springframework
:
warn
path
:
./logs
path
:
log
:
./logs
#H5地址路径
H5
:
url
:
fissionUrl
:
fissionGroupUrl
:
url
:
http://h5.linkwechat.cn/index.html
fissionUrl
:
http://h5.linkwechat.cn/index.html
fissionGroupUrl
:
http://h5.linkwechat.cn/fission.html
# Spring配置
spring
:
# 资源信息
...
...
@@ -101,7 +106,7 @@ spring:
druid
:
# 主库数据源
master
:
url
:
jdbc:mysql://127.0.0.1:10179/l
w-tes
t?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
url
:
jdbc:mysql://127.0.0.1:10179/l
ink-wecha
t?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username
:
root
password
:
root
# 从库数据源
...
...
@@ -210,14 +215,6 @@ mybatis-plus:
logic-delete-value
:
1
logic-not-delete-value
:
0
## MyBatis配置
#mybatis:
# # 搜索指定包别名
# typeAliasesPackage: com.linkwechat.**.domain
# # 配置mapper的扫描,找到所有的mapper.xml映射文件
# mapperLocations: classpath*:mapper/**/*Mapper.xml
# # 加载全局的配置文件
# configLocation: classpath:mybatis/mybatis-config.xml
# PageHelper分页插件
pagehelper
:
...
...
@@ -246,8 +243,8 @@ xss:
elasticsearch
:
schema
:
http
address
:
userName
:
password
:
userName
:
"
elastic"
password
:
"
0p-0p-0p-"
connectTimeout
:
10000
socketTimeout
:
10000
connectionRequestTimeout
:
10000
...
...
@@ -320,16 +317,11 @@ wecome:
-
we_user
-
we_customer
-
we_tag_group
#企微回调通知配置
callBack
:
appIdOrCorpId
:
token
:
encodingAesKey
:
# JS SDK 身份校验url
authorizeUrl
:
# JS SDK身份校验成功后的redirect url
authorizeRedirectUrl
:
weixin
:
appid
:
secret
:
\ No newline at end of file
appid
:
wxa57479bcd3f15461
secret
:
f23f4becdcac9819f292a3754fd8f84e
\ No newline at end of file
linkwe-admin/src/main/resources/bootstrap.properties
浏览文件 @
5eeba376
spring.cloud.nacos.config.server-addr
=
${NACOS_SERVER:119.45.28.29:10848}
spring.cloud.nacos.config.namespace
=
01cf833f-249e-4483-a286-46d37f018fe7
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.enabled
=
false
\ No newline at end of file
spring.cloud.nacos.config.enabled
=
true
\ No newline at end of file
linkwe-common/src/main/java/com/linkwechat/common/config/CosConfig.java
浏览文件 @
5eeba376
...
...
@@ -20,6 +20,6 @@ public class CosConfig {
private
String
bucketName
;
private
String
i
mgUrlPrefix
;
private
String
cosI
mgUrlPrefix
;
}
linkwe-common/src/main/java/com/linkwechat/common/core/domain/BaseEntity.java
浏览文件 @
5eeba376
...
...
@@ -34,7 +34,7 @@ public class BaseEntity implements Serializable
/** 创建时间 */
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@ApiModelProperty
(
hidden
=
true
)
private
Date
createTime
=
new
Date
()
;
private
Date
createTime
;
/** 更新者 */
@ApiModelProperty
(
hidden
=
true
)
...
...
@@ -43,7 +43,7 @@ public class BaseEntity implements Serializable
/** 更新时间 */
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@ApiModelProperty
(
hidden
=
true
)
private
Date
updateTime
=
new
Date
()
;
private
Date
updateTime
;
/** 备注 */
@TableField
(
exist
=
false
)
...
...
linkwe-common/src/main/java/com/linkwechat/common/core/domain/entity/WeCorpAccount.java
浏览文件 @
5eeba376
...
...
@@ -56,7 +56,7 @@ public class WeCorpAccount extends BaseEntity
/** 删除标志(0代表存在 2代表删除) */
@ApiModelProperty
(
"删除标志(0代表存在 2代表删除)"
)
private
String
delFlag
=
new
String
(
"0"
)
;
private
String
delFlag
;
@ApiModelProperty
(
"外部联系人密钥"
)
...
...
@@ -85,4 +85,17 @@ public class WeCorpAccount extends BaseEntity
@ApiModelProperty
(
"企业管理员账号"
)
private
String
corpAccount
;
@ApiModelProperty
(
"应用回调token密钥"
)
private
String
token
;
@ApiModelProperty
(
"应用回调消息体加密密钥"
)
private
String
encodingAesKey
;
}
linkwe-common/src/main/java/com/linkwechat/common/utils/SecurityUtils.java
浏览文件 @
5eeba376
...
...
@@ -87,4 +87,8 @@ public class SecurityUtils
{
return
userId
!=
null
&&
1L
==
userId
;
}
}
linkwe-common/src/main/java/com/linkwechat/common/utils/wecom/WxCryptUtil.java
浏览文件 @
5eeba376
...
...
@@ -261,13 +261,13 @@ public class WxCryptUtil {
SecretKeySpec
keySpec
=
new
SecretKeySpec
(
this
.
aesKey
,
"AES"
);
IvParameterSpec
iv
=
new
IvParameterSpec
(
Arrays
.
copyOfRange
(
this
.
aesKey
,
0
,
16
));
cipher
.
init
(
Cipher
.
DECRYPT_MODE
,
keySpec
,
iv
);
// 使用BASE64对密文进行解码
byte
[]
encrypted
=
Base64
.
decodeBase64
(
cipherText
);
// 解密
original
=
cipher
.
doFinal
(
encrypted
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
new
WeComException
(
e
.
getMessage
());
}
...
...
linkwe-common/src/main/java/com/tencent/wework/FinanceUtils.java
浏览文件 @
5eeba376
...
...
@@ -286,7 +286,7 @@ public class FinanceUtils {
getMediaData
(
sdkfileid
,
""
,
""
,
filePath
,
fileName
);
CosConfig
cosConfig
=
SpringUtils
.
getBean
(
CosConfig
.
class
);
String
suffix
=
fileName
.
substring
(
fileName
.
lastIndexOf
(
"."
)
+
1
);
StringBuilder
cosUrl
=
new
StringBuilder
(
cosConfig
.
getImgUrlPrefix
());
StringBuilder
cosUrl
=
new
StringBuilder
(
cosConfig
.
get
Cos
ImgUrlPrefix
());
String
cosFilePath
=
FileUploadUtils
.
upload2Cos
(
new
FileInputStream
(
new
File
(
filePath
,
fileName
)),
suffix
,
cosConfig
);
cosUrl
.
append
(
cosFilePath
);
data
.
put
(
"attachment"
,
cosUrl
.
toString
());
...
...
linkwe-framework/src/main/java/com/linkwechat/framework/config/MyBatisPlusConfig.java
浏览文件 @
5eeba376
...
...
@@ -7,6 +7,7 @@ import com.github.pagehelper.PageInterceptor;
import
com.linkwechat.common.config.RuoYiConfig
;
import
com.linkwechat.common.config.WeComeConfig
;
import
com.linkwechat.common.core.domain.entity.WeCorpAccount
;
import
com.linkwechat.common.core.domain.model.LoginUser
;
import
com.linkwechat.common.utils.SecurityUtils
;
import
net.sf.jsqlparser.expression.Expression
;
import
net.sf.jsqlparser.expression.StringValue
;
...
...
@@ -44,11 +45,15 @@ public class MyBatisPlusConfig {
public
Expression
getTenantId
()
{
try
{
WeCorpAccount
weCorpAccount
=
SecurityUtils
.
getLoginUser
().
getUser
().
getWeCorpAccount
();
if
(
null
!=
weCorpAccount
){
return
new
StringValue
(
weCorpAccount
.
getCorpId
());
LoginUser
loginUser
=
SecurityUtils
.
getLoginUser
();
if
(
null
!=
loginUser
){
WeCorpAccount
weCorpAccount
=
loginUser
.
getUser
().
getWeCorpAccount
();
if
(
null
!=
weCorpAccount
){
return
new
StringValue
(
weCorpAccount
.
getCorpId
());
}
}
}
catch
(
Exception
e
){
return
null
;
}
...
...
linkwe-quartz/src/main/java/com/linkwechat/quartz/task/RyTask.java
浏览文件 @
5eeba376
...
...
@@ -103,18 +103,18 @@ public class RyTask {
}
public
void
WeCustomers
()
{
//查询系统所有客户
List
<
WeCustomer
>
cacheList
=
redisCache
.
getCacheList
(
WeConstans
.
WECUSTOMERS_KEY
);
if
(
CollectionUtils
.
isEmpty
(
cacheList
))
{
List
<
WeCustomer
>
customers
=
weCustomerService
.
selectWeCustomerList
(
null
);
redisCache
.
setCacheList
(
WeConstans
.
WECUSTOMERS_KEY
,
customers
);
}
else
{
List
<
WeCustomer
>
customers
=
weCustomerService
.
selectWeCustomerList
(
null
);
List
<
WeCustomer
>
weCustomers
=
redisCache
.
getCacheList
(
WeConstans
.
WECUSTOMERS_KEY
);
if
(
CollectionUtils
.
isNotEmpty
(
weCustomers
)
&&
weCustomers
.
size
()
<
customers
.
size
())
{
redisCache
.
setCacheList
(
WeConstans
.
WECUSTOMERS_KEY
,
customers
);
}
}
//
//查询系统所有客户
//
List<WeCustomer> cacheList = redisCache.getCacheList(WeConstans.WECUSTOMERS_KEY);
//
if (CollectionUtils.isEmpty(cacheList)) {
//
List<WeCustomer> customers = weCustomerService.selectWeCustomerList(null);
//
redisCache.setCacheList(WeConstans.WECUSTOMERS_KEY, customers);
//
} else {
//
List<WeCustomer> customers = weCustomerService.selectWeCustomerList(null);
//
List<WeCustomer> weCustomers = redisCache.getCacheList(WeConstans.WECUSTOMERS_KEY);
//
if (CollectionUtils.isNotEmpty(weCustomers) && weCustomers.size() < customers.size()) {
//
redisCache.setCacheList(WeConstans.WECUSTOMERS_KEY, customers);
//
}
//
}
}
private
void
setRedisCacheSeqValue
(
AtomicLong
index
)
{
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/factory/WeStrategyBeanFactory.java
浏览文件 @
5eeba376
...
...
@@ -14,6 +14,7 @@ import java.util.concurrent.ConcurrentHashMap;
**/
@Service
public
class
WeStrategyBeanFactory
{
@Autowired
private
final
Map
<
String
,
WeEventStrategy
>
eventStrategyMap
=
new
ConcurrentHashMap
<>();
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/factory/impl/customer/WeCallBackAddExternalContactImpl.java
浏览文件 @
5eeba376
...
...
@@ -166,7 +166,7 @@ public class WeCallBackAddExternalContactImpl extends WeEventStrategy {
// 新客拉群创建的员工活码欢迎语图片(群活码图片)
String
codeUrl
=
weGroupCodeService
.
selectGroupCodeUrlByEmplCodeState
(
state
);
if
(
StringUtils
.
isNotNull
(
codeUrl
))
{
buildWelcomeMsgImg
(
weWelcomeMsgBuilder
,
codeUrl
,
codeUrl
.
replaceAll
(
cosConfig
.
getImgUrlPrefix
(),
""
));
buildWelcomeMsgImg
(
weWelcomeMsgBuilder
,
codeUrl
,
codeUrl
.
replaceAll
(
cosConfig
.
get
Cos
ImgUrlPrefix
(),
""
));
}
// 普通员工活码欢迎语图片
else
if
(
StringUtils
.
isNotEmpty
(
messageMap
.
getCategoryId
()))
{
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/factory/impl/party/WeCallBackCreatePartyImpl.java
浏览文件 @
5eeba376
package
com.linkwechat.wecom.factory.impl.party
;
import
com.linkwechat.wecom.domain.WeDepartment
;
import
com.linkwechat.wecom.domain.vo.WxCpXmlMessageVO
;
import
com.linkwechat.wecom.factory.WeEventStrategy
;
import
com.linkwechat.wecom.service.IWeDepartmentService
;
...
...
@@ -22,7 +21,7 @@ public class WeCallBackCreatePartyImpl extends WeEventStrategy {
@Override
public
void
eventHandle
(
WxCpXmlMessageVO
message
)
{
try
{
weDepartmentService
.
insertWeDepartmentNoToWeCom
(
setWeDepartMent
(
message
));
weDepartmentService
.
save
(
setWeDepartMent
(
message
));
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
log
.
error
(
e
.
getMessage
());
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeDepartmentService.java
浏览文件 @
5eeba376
...
...
@@ -30,7 +30,7 @@ public interface IWeDepartmentService extends IService<WeDepartment>
*/
public
void
insertWeDepartment
(
WeDepartment
weDepartment
);
public
int
insertWeDepartmentNoToWeCom
(
WeDepartment
weDepartment
);
//
public int insertWeDepartmentNoToWeCom(WeDepartment weDepartment);
/**
* 修改企业微信组织架构相关
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeDepartmentServiceImpl.java
浏览文件 @
5eeba376
...
...
@@ -103,14 +103,15 @@ public class WeDepartmentServiceImpl extends ServiceImpl<WeDepartmentMapper,WeDe
}
@Override
public
int
insertWeDepartmentNoToWeCom
(
WeDepartment
weDepartment
)
{
WeDepartment
department
=
this
.
baseMapper
.
selectWeDepartmentById
(
weDepartment
.
getId
());
if
(
department
!=
null
){
return
0
;
}
return
this
.
baseMapper
.
insertWeDepartment
(
weDepartment
);
}
// @Override
// public int insertWeDepartmentNoToWeCom(WeDepartment weDepartment) {
// WeDepartment department = this.baseMapper.selectWeDepartmentById(weDepartment.getId());
// if (department !=null){
// return 0;
// }
//
// return saveOrUpdate(weDepartment);
// }
/**
* 修改企业微信组织架构相关
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeTaskFissionServiceImpl.java
浏览文件 @
5eeba376
...
...
@@ -453,7 +453,7 @@ public class WeTaskFissionServiceImpl extends ServiceImpl<WeTaskFissionMapper, W
throw
new
WeComException
(
"生成二维码异常"
);
}
}
return
cosConfig
.
getImgUrlPrefix
()
+
qrCode
;
return
cosConfig
.
get
Cos
ImgUrlPrefix
()
+
qrCode
;
}
else
{
throw
new
WeComException
(
"生成二维码异常,用户信息不存在"
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录