Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
仟微科技
Link Wechat
提交
eb3f2259
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 搜索 >>
提交
eb3f2259
编写于
6月 08, 2021
作者:
1
1539136324@qq.com
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
群活码二维码生成逻辑优化移动至后端
上级
ae70522d
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
65 addition
and
7 deletion
+65
-7
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeGroupCodeController.java
...inkwechat/web/controller/wecom/WeGroupCodeController.java
+19
-3
linkwe-common/pom.xml
linkwe-common/pom.xml
+4
-0
linkwe-common/src/main/java/com/linkwechat/common/constant/Constants.java
...c/main/java/com/linkwechat/common/constant/Constants.java
+6
-0
linkwe-common/src/main/java/com/linkwechat/common/core/domain/entity/WeCorpAccount.java
...m/linkwechat/common/core/domain/entity/WeCorpAccount.java
+7
-0
linkwe-common/src/main/java/com/linkwechat/common/utils/QREncode.java
...n/src/main/java/com/linkwechat/common/utils/QREncode.java
+21
-3
linkwe-framework/src/main/java/com/linkwechat/framework/web/service/UserDetailsServiceImpl.java
...kwechat/framework/web/service/UserDetailsServiceImpl.java
+6
-0
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeCorpAccountServiceImpl.java
...nkwechat/wecom/service/impl/WeCorpAccountServiceImpl.java
+2
-1
未找到文件。
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeGroupCodeController.java
浏览文件 @
eb3f2259
...
...
@@ -6,21 +6,25 @@ import com.linkwechat.common.constant.HttpStatus;
import
com.linkwechat.common.constant.WeConstans
;
import
com.linkwechat.common.core.controller.BaseController
;
import
com.linkwechat.common.core.domain.AjaxResult
;
import
com.linkwechat.common.core.domain.model.LoginUser
;
import
com.linkwechat.common.core.page.TableDataInfo
;
import
com.linkwechat.common.enums.BusinessType
;
import
com.linkwechat.common.utils.QREncode
;
import
com.linkwechat.common.utils.SecurityUtils
;
import
com.linkwechat.common.utils.StringUtils
;
import
com.linkwechat.common.utils.file.FileUtils
;
import
com.linkwechat.framework.web.domain.server.SysFile
;
import
com.linkwechat.framework.web.service.FileService
;
import
com.linkwechat.wecom.domain.WeGroupCode
;
import
com.linkwechat.wecom.domain.WeGroupCodeActual
;
import
com.linkwechat.wecom.service.IWeGroupCodeService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.awt.image.BufferedImage
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.net.URL
;
...
...
@@ -43,7 +47,12 @@ import java.util.zip.ZipOutputStream;
@RequestMapping
(
"/wecom/groupCode"
)
public
class
WeGroupCodeController
extends
BaseController
{
@Autowired
private
IWeGroupCodeService
groupCodeService
;
IWeGroupCodeService
groupCodeService
;
@Autowired
FileService
fileService
;
/**
* 查询客户群活码列表
...
...
@@ -127,13 +136,20 @@ public class WeGroupCodeController extends BaseController {
// @PreAuthorize("@ss.hasPermi('drainageCode:group:add')")
@Log
(
title
=
"客户群活码"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
public
AjaxResult
add
(
@Validated
@RequestBody
WeGroupCode
weGroupCode
)
{
public
AjaxResult
add
(
@Validated
@RequestBody
WeGroupCode
weGroupCode
)
throws
IOException
{
// 唯一性检查
if
(!
groupCodeService
.
checkActivityNameUnique
(
weGroupCode
))
{
return
AjaxResult
.
error
(
"添加群活码失败,活码名称 "
+
weGroupCode
.
getActivityName
()
+
" 已存在"
);
}
AjaxResult
ajax
=
AjaxResult
.
success
();
weGroupCode
.
setCreateBy
(
SecurityUtils
.
getUsername
());
// weGroupCode.setCodeUrl(
// fileService.upload(QREncode.getQRCodeMultipartFile(
// SecurityUtils.getLoginUser().getUser().getWeCorpAccount().getH5DoMainName()+"/mobile/#/groupCode?id="+weGroupCode.getId()
// ,weGroupCode.getActivityHeadUrl())).getImgUrlPrefix()
// );
groupCodeService
.
insertWeGroupCode
(
weGroupCode
);
ajax
.
put
(
"id"
,
weGroupCode
.
getId
());
return
ajax
;
...
...
linkwe-common/pom.xml
浏览文件 @
eb3f2259
...
...
@@ -264,6 +264,10 @@
<groupId>
com.github.jsqlparser
</groupId>
<artifactId>
jsqlparser
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework
</groupId>
<artifactId>
spring-test
</artifactId>
</dependency>
</dependencies>
...
...
linkwe-common/src/main/java/com/linkwechat/common/constant/Constants.java
浏览文件 @
eb3f2259
package
com.linkwechat.common.constant
;
import
io.swagger.models.auth.In
;
/**
* 通用常量信息
*
...
...
@@ -166,6 +168,10 @@ public class Constants
public
static
final
String
HANDLE_SUCCESS
=
"3"
;
/**总公司节点类型的CORP*/
public
static
final
Integer
CORP_TYPE_ADMIN
=
1
;
...
...
linkwe-common/src/main/java/com/linkwechat/common/core/domain/entity/WeCorpAccount.java
浏览文件 @
eb3f2259
...
...
@@ -114,9 +114,16 @@ public class WeCorpAccount extends BaseEntity
private
String
fissionGroupUrl
;
@ApiModelProperty
(
"H5域名"
)
private
String
h5DoMainName
;
@ApiModelProperty
(
"会话私钥"
)
private
String
financePrivateKey
;
@ApiModelProperty
(
"账号类型(1:超管体系公司账号;2:普通下级公司体系账号)"
)
private
Integer
corpType
;
}
linkwe-common/src/main/java/com/linkwechat/common/utils/QREncode.java
浏览文件 @
eb3f2259
...
...
@@ -19,6 +19,8 @@ import com.google.zxing.common.BitMatrix;
import
com.google.zxing.qrcode.QRCodeWriter
;
import
com.google.zxing.qrcode.decoder.ErrorCorrectionLevel
;
import
com.linkwechat.common.constant.Constants
;
import
org.springframework.mock.web.MockMultipartFile
;
import
org.springframework.web.multipart.MultipartFile
;
public
class
QREncode
{
...
...
@@ -169,7 +171,7 @@ public class QREncode {
* @param output 输出流
* @throws Exception
*/
public
void
getQRCode
(
String
content
,
String
logoUrl
,
OutputStream
output
)
throws
Exception
{
public
static
void
getQRCode
(
String
content
,
String
logoUrl
,
OutputStream
output
)
throws
Exception
{
BufferedImage
image
=
crateQRCode
(
content
,
logoUrl
);
if
(
StringUtils
.
isNotNull
(
image
))
{
ImageIO
.
write
(
image
,
IMAGE_FORMAT
,
output
);
...
...
@@ -186,9 +188,22 @@ public class QREncode {
}
}
public
static
MultipartFile
getQRCodeMultipartFile
(
String
content
,
String
logoUrl
)
throws
IOException
{
BufferedImage
bufferedImage
=
crateQRCode
(
content
,
logoUrl
);
//读取图片转换为 BufferedImage
ByteArrayOutputStream
baos
=
new
ByteArrayOutputStream
();
ImageIO
.
write
(
bufferedImage
,
"jpg"
,
baos
);
//转换为MultipartFile
return
new
MockMultipartFile
(
"groupQrCode"
,
"groupQrCode.jpg"
,
"text/plain"
,
baos
.
toByteArray
());
}
@SuppressWarnings
({
"unchecked"
,
"rawtypes"
})
public
static
void
main
(
String
[]
args
)
throws
Exception
{
String
text
=
"http://
open.weixin.qq.com/qr/code/?username=LinkWeChat2021
"
;
String
text
=
"http://
linkwechat.cn/mobile/#/groupCode?id=f251619cd5d548b9ba67ab74f40f2b74
"
;
int
width
=
300
;
int
height
=
300
;
String
format
=
"png"
;
...
...
@@ -196,6 +211,9 @@ public class QREncode {
hints
.
put
(
EncodeHintType
.
CHARACTER_SET
,
Constants
.
UTF8
);
BitMatrix
bitMatrix
=
new
MultiFormatWriter
().
encode
(
text
,
BarcodeFormat
.
QR_CODE
,
width
,
height
,
hints
);
File
outputFile
=
new
File
(
"d:"
+
File
.
separator
+
"qr.png"
);
QREncode
.
writeToFile
(
bitMatrix
,
format
,
outputFile
);
// QREncode.writeToFile(bitMatrix, format, outputFile);
getQRCode
(
text
,
""
,
new
FileOutputStream
(
outputFile
));
}
}
linkwe-framework/src/main/java/com/linkwechat/framework/web/service/UserDetailsServiceImpl.java
浏览文件 @
eb3f2259
...
...
@@ -140,6 +140,12 @@ public class UserDetailsServiceImpl implements UserDetailsService
iWeCorpAccountService
.
getOne
(
new
LambdaQueryWrapper
<
WeCorpAccount
>().
eq
(
WeCorpAccount:
:
getCorpAccount
,
username
)
.
eq
(
WeCorpAccount:
:
getDelFlag
,
Constants
.
NORMAL_CODE
))
);
}
else
{
//超管体系下的账号
user
.
setWeCorpAccount
(
iWeCorpAccountService
.
getOne
(
new
LambdaQueryWrapper
<
WeCorpAccount
>().
eq
(
WeCorpAccount:
:
getCorpType
,
Constants
.
CORP_TYPE_ADMIN
))
);
}
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeCorpAccountServiceImpl.java
浏览文件 @
eb3f2259
...
...
@@ -63,7 +63,8 @@ public class WeCorpAccountServiceImpl extends ServiceImpl<WeCorpAccountMapper,We
return
ruoYiConfig
.
isStartTenant
()?
WeCorpAccount
.
builder
().
build
():
this
.
getOne
(
new
LambdaQueryWrapper
<
WeCorpAccount
>()
.
eq
(
WeCorpAccount:
:
getDelFlag
,
Constants
.
NORMAL_CODE
)
.
eq
(
WeCorpAccount:
:
getStatus
,
Constants
.
NORMAL_CODE
));
.
eq
(
WeCorpAccount:
:
getStatus
,
Constants
.
NORMAL_CODE
)
.
eq
(
WeCorpAccount:
:
getCorpType
,
Constants
.
CORP_TYPE_ADMIN
));
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录