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 b4072ea3
authored
Apr 24, 2021
by
孙喜旺
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
素材上传接口
1 parent
61e5536e
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
21 additions
and
35 deletions
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeCustomerController.java
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeMaterialController.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/client/WeMediaClient.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeMaterialService.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeMaterialServiceImpl.java
pom.xml
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeCustomerController.java
View file @
b4072ea
...
@@ -7,13 +7,11 @@ import com.linkwechat.common.core.controller.BaseController;
...
@@ -7,13 +7,11 @@ import com.linkwechat.common.core.controller.BaseController;
import
com.linkwechat.common.core.domain.AjaxResult
;
import
com.linkwechat.common.core.domain.AjaxResult
;
import
com.linkwechat.common.core.page.TableDataInfo
;
import
com.linkwechat.common.core.page.TableDataInfo
;
import
com.linkwechat.common.enums.BusinessType
;
import
com.linkwechat.common.enums.BusinessType
;
import
com.linkwechat.common.utils.Threads
;
import
com.linkwechat.common.utils.poi.ExcelUtil
;
import
com.linkwechat.common.utils.poi.ExcelUtil
;
import
com.linkwechat.wecom.domain.WeCustomer
;
import
com.linkwechat.wecom.domain.WeCustomer
;
import
com.linkwechat.wecom.domain.vo.WeMakeCustomerTag
;
import
com.linkwechat.wecom.domain.vo.WeMakeCustomerTag
;
import
com.linkwechat.wecom.service.IWeCustomerService
;
import
com.linkwechat.wecom.service.IWeCustomerService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.security.core.context.SecurityContext
;
import
org.springframework.security.core.context.SecurityContext
;
import
org.springframework.security.core.context.SecurityContextHolder
;
import
org.springframework.security.core.context.SecurityContextHolder
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.validation.annotation.Validated
;
...
...
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeMaterialController.java
View file @
b4072ea
...
@@ -145,4 +145,11 @@ public class WeMaterialController extends BaseController {
...
@@ -145,4 +145,11 @@ public class WeMaterialController extends BaseController {
return
AjaxResult
.
success
(
weMediaDto
);
return
AjaxResult
.
success
(
weMediaDto
);
}
}
@Log
(
title
=
"上传素材图片"
,
businessType
=
BusinessType
.
OTHER
)
@PostMapping
(
"/uploadimg"
)
@ApiOperation
(
"上传素材图片"
)
public
AjaxResult
<
WeMediaDto
>
uploadImg
(
MultipartFile
file
){
return
AjaxResult
.
success
(
materialService
.
uploadImg
(
file
));
}
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/client/WeMediaClient.java
View file @
b4072ea
...
@@ -19,23 +19,13 @@ import java.io.InputStream;
...
@@ -19,23 +19,13 @@ import java.io.InputStream;
*/
*/
@BaseRequest
(
interceptor
=
WeAccessTokenInterceptor
.
class
)
@BaseRequest
(
interceptor
=
WeAccessTokenInterceptor
.
class
)
public
interface
WeMediaClient
{
public
interface
WeMediaClient
{
/**
* 上传临时素材
* @param file
* @param type
* @return
*/
@Post
(
url
=
"/media/upload"
)
WeMediaDto
upload
(
@DataFile
(
value
=
"media"
)
File
file
,
@Query
(
"type"
)
String
type
);
/**
/**
* 上传图片
* 上传图片
* @param multipartFile
* @param multipartFile
* @return
* @return
*/
*/
@Post
(
url
=
"/media/uploadimg"
)
@Post
(
url
=
"/media/uploadimg"
)
WeMediaDto
uploadimg
(
@DataFile
(
value
=
"fi
l
e"
)
MultipartFile
multipartFile
);
WeMediaDto
uploadimg
(
@DataFile
(
value
=
"fi
eldNameHer
e"
)
MultipartFile
multipartFile
);
/**
/**
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeMaterialService.java
View file @
b4072ea
...
@@ -84,14 +84,6 @@ public interface IWeMaterialService {
...
@@ -84,14 +84,6 @@ public interface IWeMaterialService {
*/
*/
void
resetCategory
(
String
categoryId
,
String
materials
);
void
resetCategory
(
String
categoryId
,
String
materials
);
/**
* 上传企微临时素材
* @param url 素材路径
* @param type 素材类型
* @return
*/
public
WeMediaDto
uploadTemporaryMaterial
(
String
url
,
String
type
);
/**
/**
* 上传企微临时素材
* 上传企微临时素材
...
@@ -102,4 +94,10 @@ public interface IWeMaterialService {
...
@@ -102,4 +94,10 @@ public interface IWeMaterialService {
*/
*/
public
WeMediaDto
uploadTemporaryMaterial
(
String
url
,
String
type
,
String
name
);
public
WeMediaDto
uploadTemporaryMaterial
(
String
url
,
String
type
,
String
name
);
/**
* 上传素材图片
* @param file
* @return
*/
WeMediaDto
uploadImg
(
MultipartFile
file
);
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeMaterialServiceImpl.java
View file @
b4072ea
...
@@ -123,18 +123,6 @@ public class WeMaterialServiceImpl implements IWeMaterialService {
...
@@ -123,18 +123,6 @@ public class WeMaterialServiceImpl implements IWeMaterialService {
}
}
@Override
@Override
public
WeMediaDto
uploadTemporaryMaterial
(
String
url
,
String
type
)
{
try
{
File
file
=
new
File
(
url
);
return
weMediaClient
.
upload
(
file
,
type
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
log
.
error
(
"上传临时文件失败......url:{},type:{},ex:{},st:{}"
,
url
,
type
,
e
.
getMessage
(),
e
.
getStackTrace
());
}
return
null
;
}
@Override
public
WeMediaDto
uploadTemporaryMaterial
(
String
url
,
String
type
,
String
name
)
{
public
WeMediaDto
uploadTemporaryMaterial
(
String
url
,
String
type
,
String
name
)
{
HttpURLConnection
conn
=
null
;
HttpURLConnection
conn
=
null
;
try
{
try
{
...
@@ -155,4 +143,9 @@ public class WeMaterialServiceImpl implements IWeMaterialService {
...
@@ -155,4 +143,9 @@ public class WeMaterialServiceImpl implements IWeMaterialService {
return
null
;
return
null
;
}
}
@Override
public
WeMediaDto
uploadImg
(
MultipartFile
file
)
{
return
weMediaClient
.
uploadimg
(
file
);
}
}
}
pom.xml
View file @
b4072ea
...
@@ -31,7 +31,7 @@
...
@@ -31,7 +31,7 @@
<poi.version>
3.17
</poi.version>
<poi.version>
3.17
</poi.version>
<velocity.version>
1.7
</velocity.version>
<velocity.version>
1.7
</velocity.version>
<jwt.version>
0.9.0
</jwt.version>
<jwt.version>
0.9.0
</jwt.version>
<forest.version>
1.5.0
-RC3
</forest.version>
<forest.version>
1.5.0
</forest.version>
<lombok.version>
1.18.16
</lombok.version>
<lombok.version>
1.18.16
</lombok.version>
<reflectasm.version>
1.11.9
</reflectasm.version>
<reflectasm.version>
1.11.9
</reflectasm.version>
<hutool.version>
5.4.1
</hutool.version>
<hutool.version>
5.4.1
</hutool.version>
...
@@ -211,7 +211,7 @@
...
@@ -211,7 +211,7 @@
<!--forset-->
<!--forset-->
<dependency>
<dependency>
<groupId>
com.dtflys.forest
</groupId>
<groupId>
com.dtflys.forest
</groupId>
<artifactId>
spring-boot-starter-forest
</artifactId>
<artifactId>
forest-spring-boot-starter
</artifactId>
<version>
${forest.version}
</version>
<version>
${forest.version}
</version>
</dependency>
</dependency>
...
...
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