Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
haoban-manage3.0
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
QianQiXiang
haoban-manage3.0
Commits
befa51aa
Commit
befa51aa
authored
May 18, 2020
by
fudahua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gic跳转登录
parent
c7bf90ba
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
75 additions
and
5 deletions
+75
-5
ServiceTest.java
haoban-manage3-service/src/test/java/ServiceTest.java
+32
-4
Setest.java
haoban-manage3-service/src/test/java/Setest.java
+35
-0
LoginController.java
...com/gic/haoban/manage/web/controller/LoginController.java
+8
-1
No files found.
haoban-manage3-service/src/test/java/ServiceTest.java
View file @
befa51aa
...
@@ -20,6 +20,8 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
...
@@ -20,6 +20,8 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import
javax.imageio.ImageIO
;
import
javax.imageio.ImageIO
;
import
java.awt.image.BufferedImage
;
import
java.awt.image.BufferedImage
;
import
java.io.ByteArrayOutputStream
;
import
java.io.ByteArrayOutputStream
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.net.URL
;
import
java.net.URL
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
...
@@ -187,9 +189,9 @@ public void sendMessage() {
...
@@ -187,9 +189,9 @@ public void sendMessage() {
@Test
@Test
public
void
extensionList2
()
{
public
void
extensionList2
()
{
String
img
=
"
https://pic01-10001430.image.myqcloud.com/53205d69-01f1-4706-a258-014d59d8d106
"
;
String
img
=
"
d:/test2.jpg
"
;
byte
[]
aByte
=
get
Byte
(
img
);
byte
[]
aByte
=
get
FileByteArray
(
new
File
(
img
)
);
JSONResponse
response
=
qywxSuiteApiService
.
uploadMedia
(
"ww9ede832a84b7ae5f"
,
"ww2c34dc56739bb105"
,
aByte
,
QywxMediaTypeEnum
.
IMAGE
.
getCode
());
JSONResponse
response
=
qywxSuiteApiService
.
uploadMedia
(
"ww9ede832a84b7ae5f"
,
"ww2c34dc56739bb105"
,
aByte
,
"测试文件"
,
QywxMediaTypeEnum
.
IMAGE
.
getCode
());
System
.
out
.
println
(
JSONObject
.
toJSONString
(
response
));
System
.
out
.
println
(
JSONObject
.
toJSONString
(
response
));
}
}
...
@@ -201,7 +203,7 @@ public void sendMessage() {
...
@@ -201,7 +203,7 @@ public void sendMessage() {
// JSONResponse response = qywxSuiteApiService.uploadMedia("ww9ede832a84b7ae5f", "ww2c34dc56739bb105", aByte, QywxMediaTypeEnum.IMAGE.getCode());
// JSONResponse response = qywxSuiteApiService.uploadMedia("ww9ede832a84b7ae5f", "ww2c34dc56739bb105", aByte, QywxMediaTypeEnum.IMAGE.getCode());
// System.out.println(JSONObject.toJSONString(response));
// System.out.println(JSONObject.toJSONString(response));
QywxImageExternalMessageDTO
messageDTO
=
new
QywxImageExternalMessageDTO
();
QywxImageExternalMessageDTO
messageDTO
=
new
QywxImageExternalMessageDTO
();
messageDTO
.
setMediaId
(
"
3U5qDJRn46ZPUCQk3h2-7iqESryRICPLv6XHFEGy0r7MIJMVNkzpDjpPOo6k-R2uB
"
);
messageDTO
.
setMediaId
(
"
msg59NLDQAANPwzc9aMWNCBky8EElovyg
"
);
messageDTO
.
setSenderUserId
(
"9ae4c4f1277340a186b16a17d937c72c"
);
messageDTO
.
setSenderUserId
(
"9ae4c4f1277340a186b16a17d937c72c"
);
List
<
String
>
list
=
new
ArrayList
<>();
List
<
String
>
list
=
new
ArrayList
<>();
list
.
add
(
"wm59NLDQAAL0fHb-QEbx-U9pdtRFA1bg"
);
list
.
add
(
"wm59NLDQAAL0fHb-QEbx-U9pdtRFA1bg"
);
...
@@ -252,4 +254,30 @@ public void sendMessage() {
...
@@ -252,4 +254,30 @@ public void sendMessage() {
}
}
}
}
public
static
byte
[]
getFileByteArray
(
File
file
)
{
long
fileSize
=
file
.
length
();
if
(
fileSize
>
Integer
.
MAX_VALUE
)
{
System
.
out
.
println
(
"file too big..."
);
return
null
;
}
byte
[]
buffer
=
null
;
try
(
FileInputStream
fi
=
new
FileInputStream
(
file
))
{
buffer
=
new
byte
[(
int
)
fileSize
];
int
offset
=
0
;
int
numRead
=
0
;
while
(
offset
<
buffer
.
length
&&
(
numRead
=
fi
.
read
(
buffer
,
offset
,
buffer
.
length
-
offset
))
>=
0
)
{
offset
+=
numRead
;
}
// 确保所有数据均被读取
if
(
offset
!=
buffer
.
length
)
{
throw
new
IOException
(
"Could not completely read file "
+
file
.
getName
());
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
buffer
;
}
}
}
haoban-manage3-service/src/test/java/Setest.java
0 → 100644
View file @
befa51aa
import
cn.hutool.crypto.SecureUtil
;
import
cn.hutool.crypto.symmetric.AES
;
import
com.alibaba.fastjson.JSONObject
;
import
com.gic.haoban.manage.api.dto.SyncSingleDealDTO
;
import
com.gic.haoban.manage.api.service.DealSyncOperationApiService
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.test.context.ContextConfiguration
;
import
org.springframework.test.context.junit4.SpringJUnit4ClassRunner
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
public
class
Setest
{
@Autowired
private
DealSyncOperationApiService
dealSyncOperationApiService
;
@Test
public
void
test
()
{
Map
<
String
,
String
>
ret
=
new
HashMap
<>();
ret
.
put
(
"test"
,
"test"
);
ret
.
put
(
"name"
,
"name11"
);
AES
aes
=
SecureUtil
.
aes
(
"test111111111113"
.
getBytes
());
String
code
=
aes
.
encryptHex
(
JSONObject
.
toJSONString
(
ret
));
System
.
out
.
println
(
code
);
String
str
=
aes
.
decryptStr
(
code
);
System
.
out
.
println
(
str
);
}
}
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/controller/LoginController.java
View file @
befa51aa
package
com
.
gic
.
haoban
.
manage
.
web
.
controller
;
package
com
.
gic
.
haoban
.
manage
.
web
.
controller
;
import
cn.hutool.crypto.SecureUtil
;
import
cn.hutool.crypto.symmetric.AES
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.gic.haoban.manage.api.dto.EnterpriseDetailDTO
;
import
com.gic.haoban.manage.api.dto.EnterpriseDetailDTO
;
import
com.gic.haoban.manage.api.service.WxEnterpriseRelatedApiService
;
import
com.gic.haoban.manage.api.service.WxEnterpriseRelatedApiService
;
...
@@ -45,6 +47,9 @@ import javax.servlet.http.HttpServletResponse;
...
@@ -45,6 +47,9 @@ import javax.servlet.http.HttpServletResponse;
public
class
LoginController
extends
WebBaseController
{
public
class
LoginController
extends
WebBaseController
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
LoginController
.
class
);
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
LoginController
.
class
);
private
static
final
String
LOGIN_KEY
=
"haoban#login$key"
;
@Autowired
@Autowired
StaffApiService
staffApiService
;
StaffApiService
staffApiService
;
...
@@ -145,7 +150,8 @@ public class LoginController extends WebBaseController{
...
@@ -145,7 +150,8 @@ public class LoginController extends WebBaseController{
@RequestMapping
(
"gic-login"
)
@RequestMapping
(
"gic-login"
)
public
HaobanResponse
ywLogin
(
String
random
,
HttpServletResponse
response
)
{
public
HaobanResponse
ywLogin
(
String
random
,
HttpServletResponse
response
)
{
//判断是否存在random
//判断是否存在random
String
o
=
(
String
)
RedisUtil
.
getCache
(
random
);
AES
aes
=
SecureUtil
.
aes
(
LOGIN_KEY
.
getBytes
());
String
o
=
aes
.
decryptStr
(
random
);
if
(
o
==
null
){
if
(
o
==
null
){
return
resultResponse
(
HaoBanErrCode
.
ERR_4
);
return
resultResponse
(
HaoBanErrCode
.
ERR_4
);
}
}
...
@@ -157,6 +163,7 @@ public class LoginController extends WebBaseController{
...
@@ -157,6 +163,7 @@ public class LoginController extends WebBaseController{
logger
.
info
(
"登录用户不存在!"
);
logger
.
info
(
"登录用户不存在!"
);
return
resultResponse
(
HaoBanErrCode
.
ERR_6
);
return
resultResponse
(
HaoBanErrCode
.
ERR_6
);
}
}
SecureUtil
.
aes
()
//TODO 获取超级管理员账号接口
//TODO 获取超级管理员账号接口
StaffDTO
staff
=
staffApiService
.
selectByNationcodeAndPhoneNumber
(
detailDTO
.
getWxEnterpriseId
(),
"86"
,
loginPhoneNumber
);
StaffDTO
staff
=
staffApiService
.
selectByNationcodeAndPhoneNumber
(
detailDTO
.
getWxEnterpriseId
(),
"86"
,
loginPhoneNumber
);
if
(
null
==
staff
)
{
if
(
null
==
staff
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment