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 76d4e27e
authored
Dec 01, 2020
by
danmo
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
欢迎语图片修改
1 parent
107db5ce
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
2 deletions
linkwe-wecom/src/main/java/com/linkwechat/wecom/factory/impl/WeEventChangeExternalContactImpl.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeCustomerServiceImpl.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeMaterialServiceImpl.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/factory/impl/WeEventChangeExternalContactImpl.java
View file @
76d4e27
...
...
@@ -2,12 +2,14 @@ package com.linkwechat.wecom.factory.impl;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.linkwechat.common.enums.MediaType
;
import
com.linkwechat.common.utils.StringUtils
;
import
com.linkwechat.common.utils.Threads
;
import
com.linkwechat.wecom.domain.WeEmpleCodeTag
;
import
com.linkwechat.wecom.domain.WeFlowerCustomerRel
;
import
com.linkwechat.wecom.domain.WeFlowerCustomerTagRel
;
import
com.linkwechat.wecom.domain.dto.WeEmpleCodeDto
;
import
com.linkwechat.wecom.domain.dto.WeMediaDto
;
import
com.linkwechat.wecom.domain.dto.WeWelcomeMsg
;
import
com.linkwechat.wecom.domain.vo.WxCpXmlMessageVO
;
import
com.linkwechat.wecom.factory.WeCallBackEventFactory
;
...
...
@@ -44,6 +46,8 @@ public class WeEventChangeExternalContactImpl implements WeCallBackEventFactory
private
IWeFlowerCustomerRelService
weFlowerCustomerRelService
;
@Autowired
private
IWeFlowerCustomerTagRelService
weFlowerCustomerTagRelService
;
@Autowired
private
IWeMaterialService
weMaterialService
;
@Override
public
void
eventHandle
(
WxCpXmlMessageVO
message
)
{
...
...
@@ -151,8 +155,13 @@ public class WeEventChangeExternalContactImpl implements WeCallBackEventFactory
.
content
(
messageMap
.
getWelcomeMsg
()).
build
());
}
if
(
StringUtils
.
isNotEmpty
(
messageMap
.
getCategoryId
())){
weWelcomeMsgBuilder
.
image
(
WeWelcomeMsg
.
Image
.
builder
().
media_id
(
messageMap
.
getCategoryId
())
.
pic_url
(
messageMap
.
getMaterialUrl
()).
build
());
WeMediaDto
weMediaDto
=
weMaterialService
.
uploadTemporaryMaterial
(
messageMap
.
getMaterialUrl
(),
MediaType
.
IMAGE
.
getMediaType
());
Optional
.
ofNullable
(
weMediaDto
).
ifPresent
(
media
->{
weWelcomeMsgBuilder
.
image
(
WeWelcomeMsg
.
Image
.
builder
().
media_id
(
media
.
getMedia_id
())
.
pic_url
(
media
.
getUrl
()).
build
());
});
}
weCustomerService
.
sendWelcomeMsg
(
weWelcomeMsgBuilder
.
build
());
}
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeCustomerServiceImpl.java
View file @
76d4e27
...
...
@@ -26,6 +26,7 @@ import com.linkwechat.wecom.domain.vo.WeMakeCustomerTag;
import
com.linkwechat.wecom.mapper.WeCustomerMapper
;
import
com.linkwechat.wecom.service.*
;
import
com.tencent.wework.Finance
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.core.context.SecurityContext
;
import
org.springframework.security.core.context.SecurityContextHolder
;
...
...
@@ -111,6 +112,7 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
*/
@Override
public
List
<
WeCustomer
>
selectWeCustomerList
(
WeCustomer
weCustomer
)
{
long
sdk
=
Finance
.
NewSdk
();
return
weCustomerMapper
.
selectWeCustomerList
(
weCustomer
);
}
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeMaterialServiceImpl.java
View file @
76d4e27
...
...
@@ -10,15 +10,25 @@ import com.linkwechat.common.exception.wecom.WeComException;
import
com.linkwechat.common.utils.SnowFlakeUtil
;
import
com.linkwechat.common.utils.StringUtils
;
import
com.linkwechat.common.utils.file.FileUploadUtils
;
import
com.linkwechat.wecom.client.WeMediaClient
;
import
com.linkwechat.wecom.domain.WeMaterial
;
import
com.linkwechat.wecom.domain.dto.WeMediaDto
;
import
com.linkwechat.wecom.domain.vo.WeMaterialFileVO
;
import
com.linkwechat.wecom.mapper.WeMaterialMapper
;
import
com.linkwechat.wecom.service.IWeMaterialService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.fileupload.FileItem
;
import
org.apache.commons.fileupload.FileItemFactory
;
import
org.apache.commons.fileupload.disk.DiskFileItemFactory
;
import
org.apache.http.entity.ContentType
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.commons.CommonsMultipartFile
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.FileNotFoundException
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.Optional
;
...
...
@@ -37,6 +47,8 @@ public class WeMaterialServiceImpl implements IWeMaterialService {
private
WeMaterialMapper
weMaterialMapper
;
@Autowired
private
ServerConfig
serverConfig
;
@Autowired
private
WeMediaClient
weMediaClient
;
@Override
public
WeMaterialFileVO
uploadWeMaterialFile
(
MultipartFile
file
,
String
type
)
{
...
...
@@ -115,5 +127,21 @@ public class WeMaterialServiceImpl implements IWeMaterialService {
}
}
@Override
public
WeMediaDto
uploadTemporaryMaterial
(
String
url
,
String
type
)
{
try
{
File
file
=
new
File
(
url
);
FileItemFactory
factory
=
new
DiskFileItemFactory
(
16
,
null
);
FileItem
item
=
factory
.
createItem
(
file
.
getName
(),
"text/plain"
,
true
,
file
.
getName
());
MultipartFile
multipartFile
=
new
CommonsMultipartFile
(
item
);
return
weMediaClient
.
upload
(
multipartFile
,
type
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
log
.
error
(
"上传临时文件失败......url:{},type:{},ex:{},st:{}"
,
url
,
type
,
e
.
getMessage
(),
e
.
getStackTrace
());
}
return
null
;
}
}
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