Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xm-sportstest
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xiamai-test
xm-sportstest
Commits
1944cf46
Commit
1944cf46
authored
Jul 03, 2024
by
DuJunLi
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
ssh://xmgit.ixm5.cn:10022/xiamai-test/xm-sportstest
parents
74a0ac2d
3291e581
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
62 additions
and
264 deletions
+62
-264
src/main/java/com/xiaomai/cases/lunar/minmembercard/MinCardTools.java
+37
-0
src/main/java/com/xiaomai/cases/lunar/reserve/TestAddMemberReserve.java
+1
-1
src/main/java/com/xiaomai/cases/lunar/reserve/TestAddToQueue.java
+1
-1
src/main/java/com/xiaomai/cases/lunar/reserve/TestGetGroupBookingRules.java
+1
-1
src/main/java/com/xiaomai/cases/lunar/reserve/TestMemberTimetable.java
+1
-1
src/main/java/com/xiaomai/cases/lunar/reserve/TestXCXSignIn.java
+1
-1
src/main/java/com/xiaomai/cases/polar/finance/order/TestDiscard.java
+0
-0
src/main/java/com/xiaomai/cases/polar/finance/revenueAndExpenditure/ResourceUtil.java
+0
-131
src/main/java/com/xiaomai/cases/polar/finance/revenueAndExpenditure/RevenueAndExpenditureTools.java
+20
-20
src/main/java/com/xiaomai/cases/polar/finance/revenueAndExpenditure/SignatureVO.java
+0
-104
src/main/java/com/xiaomai/cases/polar/finance/revenueAndExpenditure/TestUploadResources.java
+0
-4
No files found.
src/main/java/com/xiaomai/cases/lunar/minmembercard/MinCardTools.java
0 → 100644
View file @
1944cf46
package
com
.
xiaomai
.
cases
.
lunar
.
minmembercard
;
import
com.alibaba.fastjson.JSONObject
;
import
com.xiaomai.client.DataUserInfo
;
import
com.xiaomai.enums.ApiModule
;
import
com.xiaomai.enums.RequestType
;
import
com.xiaomai.enums.Terminal
;
import
com.xiaomai.utils.XMBaseTest
;
public
class
MinCardTools
extends
XMBaseTest
{
/**
* @param
* @description:小程序查看在售会员卡
* @author: yangjian
**/
public
JSONObject
fetchOnSaleMemberCard
(
String
title
,
DataUserInfo
...
dataUserInfos
)
{
dataApi
.
setApiModule
(
ApiModule
.
Lunar_Card
)
.
setApiName
(
"API_fetchOnSaleMemberCard"
)
.
setTerminal
(
Terminal
.
minApp
);
super
.
beforeDataRequest
(
dataUserInfos
);
JSONObject
jsonObject
=
new
JSONObject
();
//jsonObject.put("memberCardIds","");
jsonObject
.
put
(
"current"
,
0
);
jsonObject
.
put
(
"size"
,
20
);
jsonObject
.
put
(
"title"
,
title
);
jsonObject
.
put
(
"brandId"
,
xmAppApi
.
getLoginInfo
().
getBrandId
());
jsonObject
.
put
(
"studioId"
,
xmAppApi
.
getLoginInfo
().
getStudioId
());
dataApi
.
doRequest
(
RequestType
.
JSON
,
dataparams
,
jsonObject
.
toJSONString
(),
dataheadrs
).
assetsSuccess
(
true
);
JSONObject
response
=
dataApi
.
getBodyInJSON
();
return
response
;
}
}
src/main/java/com/xiaomai/cases/lunar/reserve/TestAddMemberReserve.java
View file @
1944cf46
...
@@ -76,7 +76,7 @@ public class TestAddMemberReserve extends BaseTestImpl {
...
@@ -76,7 +76,7 @@ public class TestAddMemberReserve extends BaseTestImpl {
@BeforeClass
@BeforeClass
public
void
beforeTest
(){
public
void
beforeTest
(){
setTestInfo
(
ApiModule
.
Lunar_Reserve
,
"API_memberTimetable"
,
LoginAccount
.
X
YM_MINIAPPC
,
Terminal
.
minApp
,
"xym"
);
setTestInfo
(
ApiModule
.
Lunar_Reserve
,
"API_memberTimetable"
,
LoginAccount
.
G
YM_MINIAPPC
,
Terminal
.
minApp
,
"xym"
);
super
.
beforeTest
();
super
.
beforeTest
();
}
}
...
...
src/main/java/com/xiaomai/cases/lunar/reserve/TestAddToQueue.java
View file @
1944cf46
...
@@ -82,7 +82,7 @@ public class TestAddToQueue extends BaseTestImpl {
...
@@ -82,7 +82,7 @@ public class TestAddToQueue extends BaseTestImpl {
@BeforeClass
@BeforeClass
public
void
beforeTest
(){
public
void
beforeTest
(){
setTestInfo
(
ApiModule
.
Lunar_Reserve
,
"API_addToQueue"
,
LoginAccount
.
X
YM_MINIAPPC
,
Terminal
.
minApp
,
"xym"
);
setTestInfo
(
ApiModule
.
Lunar_Reserve
,
"API_addToQueue"
,
LoginAccount
.
G
YM_MINIAPPC
,
Terminal
.
minApp
,
"xym"
);
super
.
beforeTest
();
super
.
beforeTest
();
}
}
...
...
src/main/java/com/xiaomai/cases/lunar/reserve/TestGetGroupBookingRules.java
View file @
1944cf46
...
@@ -32,7 +32,7 @@ public class TestGetGroupBookingRules extends BaseTestImpl {
...
@@ -32,7 +32,7 @@ public class TestGetGroupBookingRules extends BaseTestImpl {
@BeforeClass
@BeforeClass
public
void
beforeTest
()
{
public
void
beforeTest
()
{
setTestInfo
(
ApiModule
.
Lunar_Reserve
,
"API_getGroupBookingRules"
,
LoginAccount
.
X
YM_MINIAPPC
,
Terminal
.
minApp
,
"xym"
);
setTestInfo
(
ApiModule
.
Lunar_Reserve
,
"API_getGroupBookingRules"
,
LoginAccount
.
G
YM_MINIAPPC
,
Terminal
.
minApp
,
"xym"
);
super
.
beforeTest
();
super
.
beforeTest
();
}
}
...
...
src/main/java/com/xiaomai/cases/lunar/reserve/TestMemberTimetable.java
View file @
1944cf46
...
@@ -28,7 +28,7 @@ public class TestMemberTimetable extends BaseTestImpl {
...
@@ -28,7 +28,7 @@ public class TestMemberTimetable extends BaseTestImpl {
UserTools
userTools
;
UserTools
userTools
;
@BeforeClass
@BeforeClass
public
void
beforeTest
(){
public
void
beforeTest
(){
setTestInfo
(
ApiModule
.
Lunar_Reserve
,
"API_memberTimetable"
,
LoginAccount
.
X
YM_MINIAPPC
,
Terminal
.
minApp
,
"xym"
);
setTestInfo
(
ApiModule
.
Lunar_Reserve
,
"API_memberTimetable"
,
LoginAccount
.
G
YM_MINIAPPC
,
Terminal
.
minApp
,
"xym"
);
super
.
beforeTest
();
super
.
beforeTest
();
}
}
...
...
src/main/java/com/xiaomai/cases/lunar/reserve/TestXCXSignIn.java
View file @
1944cf46
...
@@ -77,7 +77,7 @@ public class TestXCXSignIn extends BaseTestImpl {
...
@@ -77,7 +77,7 @@ public class TestXCXSignIn extends BaseTestImpl {
@BeforeClass
@BeforeClass
public
void
beforeTest
(){
public
void
beforeTest
(){
setTestInfo
(
ApiModule
.
Lunar_Reserve
,
"API_signInByScanCode"
,
LoginAccount
.
X
YM_MINIAPPC
,
Terminal
.
minApp
,
"xym"
);
setTestInfo
(
ApiModule
.
Lunar_Reserve
,
"API_signInByScanCode"
,
LoginAccount
.
G
YM_MINIAPPC
,
Terminal
.
minApp
,
"xym"
);
super
.
beforeTest
();
super
.
beforeTest
();
}
}
...
...
src/main/java/com/xiaomai/cases/polar/finance/order/TestDiscard.java
View file @
1944cf46
This diff is collapsed.
Click to expand it.
src/main/java/com/xiaomai/cases/polar/finance/revenueAndExpenditure/ResourceUtil.java
deleted
100644 → 0
View file @
74a0ac2d
package
com
.
xiaomai
.
cases
.
polar
.
finance
.
revenueAndExpenditure
;
import
org.apache.http.Consts
;
import
org.apache.http.HttpEntity
;
import
org.apache.http.HttpResponse
;
import
org.apache.http.client.config.RequestConfig
;
import
org.apache.http.client.methods.HttpPost
;
import
org.apache.http.entity.ContentType
;
import
org.apache.http.entity.mime.HttpMultipartMode
;
import
org.apache.http.entity.mime.MultipartEntityBuilder
;
import
org.apache.http.entity.mime.content.StringBody
;
import
org.apache.http.impl.client.CloseableHttpClient
;
import
org.apache.http.impl.client.HttpClients
;
import
org.apache.log4j.Logger
;
import
java.io.BufferedReader
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStreamReader
;
/**
* @Author adu
* @Description 传文件留到阿里云oss
* @Date 13:13 2021-04-22
*/
public
class
ResourceUtil
{
public
static
final
Logger
logger
=
Logger
.
getLogger
(
ResourceUtil
.
class
);
public
static
final
String
OSS_ACCESS_KEY_ID
=
"OSSAccessKeyId"
;
public
static
final
String
POLICY
=
"policy"
;
public
static
final
String
SIGNATURE
=
"Signature"
;
public
static
final
String
KEY
=
"key"
;
public
static
final
String
SUCCESS_ACTION_STATUS
=
"success_action_status"
;
public
static
final
String
FILE
=
"file"
;
public
static
final
String
CALL_BACK
=
"callback"
;
public
static
final
String
RESPONSE_STATUS
=
"200"
;
public
static
final
String
CONTENT_TYPE
=
"multipart/form-data"
;
/**
* 上传文件留到阿里云oss
*
* @param inputStream 文件流
* @param fileName 文件名称
* @param signatureVO 临时访问阿里云授权签名
* @return true 上传成功,false 失败
* @throws IOException 关闭文件流或httpClient连接时可能会异常
*/
public
static
boolean
uploadFile
(
InputStream
inputStream
,
String
fileName
,
SignatureVO
signatureVO
,
int
timeout
)
throws
IOException
{
CloseableHttpClient
client
=
HttpClients
.
createDefault
();
RequestConfig
requestConfig
=
RequestConfig
.
custom
()
//connectTimeout:指客户端和服务器建立连接的timeout,
.
setConnectTimeout
(
2000
)
//connectionRequestTimout:指从连接池获取连接的timeout
.
setConnectionRequestTimeout
(
2000
)
//socketTimeout:指客户端从服务器读取数据的timeout,超出后会抛出SocketTimeOutException,根据需要自定义
.
setSocketTimeout
(
timeout
)
.
build
();
HttpPost
post
=
new
HttpPost
(
signatureVO
.
getHost
());
post
.
setConfig
(
requestConfig
);
BufferedReader
br
=
null
;
try
{
// 参数顺序问题,该死的回调,千万要注意参数的顺序,死坑死坑
MultipartEntityBuilder
builder
=
MultipartEntityBuilder
.
create
();
builder
.
setMode
(
HttpMultipartMode
.
BROWSER_COMPATIBLE
);
StringBody
accessKeyId
=
new
StringBody
(
signatureVO
.
getAccessId
(),
ContentType
.
MULTIPART_FORM_DATA
);
builder
.
addPart
(
OSS_ACCESS_KEY_ID
,
accessKeyId
);
StringBody
policy
=
new
StringBody
(
signatureVO
.
getPolicy
(),
ContentType
.
MULTIPART_FORM_DATA
);
builder
.
addPart
(
POLICY
,
policy
);
StringBody
callBackStr
=
new
StringBody
(
signatureVO
.
getCallback
(),
ContentType
.
MULTIPART_FORM_DATA
);
builder
.
addPart
(
CALL_BACK
,
callBackStr
);
StringBody
signature
=
new
StringBody
(
signatureVO
.
getSignature
(),
ContentType
.
MULTIPART_FORM_DATA
);
builder
.
addPart
(
SIGNATURE
,
signature
);
// 兼容key中的中文名称
StringBody
key
=
new
StringBody
(
signatureVO
.
getKey
(),
ContentType
.
APPLICATION_JSON
);
builder
.
addPart
(
KEY
,
key
);
builder
.
addBinaryBody
(
FILE
,
inputStream
,
ContentType
.
create
(
CONTENT_TYPE
),
fileName
);
StringBody
successActionStatus
=
new
StringBody
(
RESPONSE_STATUS
,
ContentType
.
MULTIPART_FORM_DATA
);
builder
.
addPart
(
SUCCESS_ACTION_STATUS
,
successActionStatus
);
HttpEntity
entity
=
builder
.
build
();
post
.
setEntity
(
entity
);
//发送请求
HttpResponse
response
=
client
.
execute
(
post
);
int
status
=
response
.
getStatusLine
().
getStatusCode
();
if
(
Integer
.
valueOf
(
RESPONSE_STATUS
).
equals
(
status
))
{
return
true
;
}
else
{
entity
=
response
.
getEntity
();
if
(
entity
!=
null
)
{
inputStream
=
entity
.
getContent
();
br
=
new
BufferedReader
(
new
InputStreamReader
(
inputStream
,
Consts
.
UTF_8
));
StringBuilder
message
=
new
StringBuilder
();
String
body
;
while
((
body
=
br
.
readLine
())
!=
null
)
{
message
.
append
(
body
);
}
logger
.
error
(
"文件上传失败!message:{}"
+
message
);
}
return
true
;
}
}
catch
(
Exception
e
)
{
logger
.
error
(
"文件上传异常!"
,
e
);
}
finally
{
if
(
br
!=
null
){
br
.
close
();
}
inputStream
.
close
();
client
.
close
();
}
return
false
;
}
}
src/main/java/com/xiaomai/cases/polar/finance/revenueAndExpenditure/RevenueAndExpenditureTools.java
View file @
1944cf46
...
@@ -172,26 +172,26 @@ public class RevenueAndExpenditureTools extends XMBaseTest {
...
@@ -172,26 +172,26 @@ public class RevenueAndExpenditureTools extends XMBaseTest {
dataApi
.
doRequest
(
RequestType
.
JSON
,
dataparams
,
jsonObject
.
toJSONString
(),
dataheadrs
).
assetsSuccess
(
true
);
dataApi
.
doRequest
(
RequestType
.
JSON
,
dataparams
,
jsonObject
.
toJSONString
(),
dataheadrs
).
assetsSuccess
(
true
);
JSONObject
response
=
dataApi
.
getBodyInJSON
();
JSONObject
response
=
dataApi
.
getBodyInJSON
();
String
resourceId
=
XMJSONPath
.
readPath
(
response
,
"$.result.resourceId"
);
//
String resourceId = XMJSONPath.readPath(response, "$.result.resourceId");
String
accessId
=
XMJSONPath
.
readPath
(
response
,
"$.result.accessId"
);
//
String accessId = XMJSONPath.readPath(response, "$.result.accessId");
String
policy
=
XMJSONPath
.
readPath
(
response
,
"$.result.policy"
);
//
String policy = XMJSONPath.readPath(response, "$.result.policy");
String
signature
=
XMJSONPath
.
readPath
(
response
,
"$.result.signature"
);
//
String signature = XMJSONPath.readPath(response, "$.result.signature");
String
key
=
XMJSONPath
.
readPath
(
response
,
"$.result.key"
);
//
String key = XMJSONPath.readPath(response, "$.result.key");
String
callback
=
XMJSONPath
.
readPath
(
response
,
"$.result.callback"
);
//
String callback = XMJSONPath.readPath(response, "$.result.callback");
String
host
=
XMJSONPath
.
readPath
(
response
,
"$.result.host"
);
//
String host = XMJSONPath.readPath(response, "$.result.host");
//
//
InputStream
inputStream
=
new
FileInputStream
(
filePath
);
//
InputStream inputStream = new FileInputStream(filePath);
SignatureVO
signatureVO
=
new
SignatureVO
();
//
SignatureVO signatureVO = new SignatureVO();
signatureVO
.
setAccessId
(
accessId
);
//
signatureVO.setAccessId(accessId);
signatureVO
.
setPolicy
(
policy
);
//
signatureVO.setPolicy(policy);
signatureVO
.
setCallback
(
callback
);
//
signatureVO.setCallback(callback);
signatureVO
.
setKey
(
key
);
//
signatureVO.setKey(key);
signatureVO
.
setSignature
(
signature
);
//
signatureVO.setSignature(signature);
signatureVO
.
setHost
(
host
);
//
signatureVO.setHost(host);
signatureVO
.
setResourceId
(
Long
.
valueOf
(
resourceId
));
//
signatureVO.setResourceId(Long.valueOf(resourceId));
//
ResourceUtil
.
uploadFile
(
inputStream
,
filePath
,
signatureVO
,
5000
);
//
ResourceUtil.uploadFile(inputStream, filePath, signatureVO, 5000);
return
response
;
return
response
;
}
}
...
...
src/main/java/com/xiaomai/cases/polar/finance/revenueAndExpenditure/SignatureVO.java
deleted
100644 → 0
View file @
74a0ac2d
/*
* Copyright © 2020 Hangzhou Jiejing Technology Co., Ltd. All rights reserved.
*
* The copyright of the company's program code belongs to Hangzhou Jiejing Technology Co., Ltd.
* No one can illegally copy it without the explicit permission of this website.
* Official website: www.xiaomai5.com
*
* Copyright © 2020 杭州杰竞科技有限公司 版权所有.
*
* 本公司程序代码的版权归杭州杰竞科技有限公司所有,未经本网站的明确许可,任何人不得非法复制。
* 官网: www.xiaomai5.com
*/
package
com
.
xiaomai
.
cases
.
polar
.
finance
.
revenueAndExpenditure
;
/**
* @author adu
* @date 2021-04-22
*/
public
class
SignatureVO
{
//资源ID
private
Long
resourceId
;
//接入ID
private
String
accessId
;
//访问策略
private
String
policy
;
//签名
private
String
signature
;
//对象路径
private
String
key
;
//接入点
private
String
host
;
//过期时间
private
String
expire
;
//回调地址
private
String
callback
;
public
Long
getResourceId
()
{
return
resourceId
;
}
public
void
setResourceId
(
Long
resourceId
)
{
this
.
resourceId
=
resourceId
;
}
public
String
getAccessId
()
{
return
accessId
;
}
public
void
setAccessId
(
String
accessId
)
{
this
.
accessId
=
accessId
;
}
public
String
getPolicy
()
{
return
policy
;
}
public
void
setPolicy
(
String
policy
)
{
this
.
policy
=
policy
;
}
public
String
getSignature
()
{
return
signature
;
}
public
void
setSignature
(
String
signature
)
{
this
.
signature
=
signature
;
}
public
String
getKey
()
{
return
key
;
}
public
void
setKey
(
String
key
)
{
this
.
key
=
key
;
}
public
String
getHost
()
{
return
host
;
}
public
void
setHost
(
String
host
)
{
this
.
host
=
host
;
}
public
String
getExpire
()
{
return
expire
;
}
public
void
setExpire
(
String
expire
)
{
this
.
expire
=
expire
;
}
public
String
getCallback
()
{
return
callback
;
}
public
void
setCallback
(
String
callback
)
{
this
.
callback
=
callback
;
}
}
src/main/java/com/xiaomai/cases/polar/finance/revenueAndExpenditure/TestUploadResources.java
View file @
1944cf46
...
@@ -123,10 +123,6 @@ public class TestUploadResources extends XMBaseTest {
...
@@ -123,10 +123,6 @@ public class TestUploadResources extends XMBaseTest {
JSONObject
listByVoucherIdResult
=
orderTools
.
listByVoucherId
(
getDetailId
);
JSONObject
listByVoucherIdResult
=
orderTools
.
listByVoucherId
(
getDetailId
);
id1
=
listByVoucherIdResult
.
getJSONArray
(
"result"
).
getJSONObject
(
0
).
getString
(
"id"
);
//收支的id
id1
=
listByVoucherIdResult
.
getJSONArray
(
"result"
).
getJSONObject
(
0
).
getString
(
"id"
);
//收支的id
//上传资源
JSONObject
resourceResult
=
revenueAndExpenditureTools
.
mobileResource
(
"VOUCHER_INFO"
,
"BRAND"
,
"imgFile/test1.jpg"
);
String
resourceId
=
XMJSONPath
.
readPath
(
resourceResult
,
"$.result.resourceId"
);
//上传图片
//上传图片
JSONObject
jsonObject
=
new
JSONObject
();
JSONObject
jsonObject
=
new
JSONObject
();
...
...
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