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
74a0ac2d
Commit
74a0ac2d
authored
Jul 03, 2024
by
DuJunLi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加训练营课程,创建,编辑,查询列表,全局搜索工具类
parent
1ac0654d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
109 additions
and
0 deletions
+109
-0
src/main/java/com/xiaomai/cases/polar/course/CourseTools.java
+109
-0
No files found.
src/main/java/com/xiaomai/cases/polar/course/CourseTools.java
View file @
74a0ac2d
...
...
@@ -7,8 +7,12 @@ import com.xiaomai.enums.ApiModule;
import
com.xiaomai.enums.RequestType
;
import
com.xiaomai.enums.Terminal
;
import
com.xiaomai.utils.XMBaseTest
;
import
com.xiaomai.utils.XMJSONPath
;
import
org.springframework.stereotype.Component
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* @BelongsProject: xm-sportstest
* @BelongsPackage: com.xiaomai.cases.polar.course
...
...
@@ -297,4 +301,109 @@ public class CourseTools extends XMBaseTest {
return
dataApi
.
getBodyInJSON
().
getBoolean
(
"result"
);
}
/**
* 创建训练营课程
* @param courseName 课程名称
* @param categoryId 课程分类
* @param duration 课程时长
* @param color 课程对应的课表颜色
* @return 返回课程ID
*/
public
String
createTrainingCampCourse
(
String
courseName
,
String
categoryId
,
String
duration
,
String
color
){
dataApi
.
setApiModule
(
ApiModule
.
Polar_Course
)
.
setApiName
(
"API_createTrainingCampCourse"
)
.
setTerminal
(
Terminal
.
B
);
super
.
beforeDataRequest
();
JSONObject
body
=
new
JSONObject
();
body
.
put
(
"operatorId"
,
dataApi
.
getLoginInfo
().
getAdminId
());
body
.
put
(
"studioId"
,
dataApi
.
getLoginInfo
().
getStudioId
());
body
.
put
(
"brandId"
,
dataApi
.
getLoginInfo
().
getBrandId
());
body
.
put
(
"courseName"
,
courseName
);
body
.
put
(
"duration"
,
duration
);
body
.
put
(
"color"
,
color
);
body
.
put
(
"categoryId"
,
categoryId
);
body
.
put
(
"timeUnit"
,
"MINUTE"
);
dataApi
.
doRequest
(
RequestType
.
JSON
,
dataparams
,
body
.
toString
(),
dataheadrs
).
assetsSuccess
(
true
);
return
XMJSONPath
.
readPath
(
dataApi
.
getApi_response
(),
"$.result"
);
}
/**
* 编辑训练营课程
* @param brandCourseId 课程ID
* @param courseName
* @param categoryId 课程分类ID
* @param duration 课程时长
* @param color 课表颜色
* @return 返回课程ID
*/
public
String
editTrainingCampCourse
(
String
brandCourseId
,
String
courseName
,
String
categoryId
,
String
duration
,
String
color
){
dataApi
.
setApiModule
(
ApiModule
.
Polar_Course
)
.
setApiName
(
"API_editTrainingCampCourse"
)
.
setTerminal
(
Terminal
.
B
);
super
.
beforeDataRequest
();
JSONObject
body
=
new
JSONObject
();
body
.
put
(
"operatorId"
,
dataApi
.
getLoginInfo
().
getAdminId
());
body
.
put
(
"studioId"
,
dataApi
.
getLoginInfo
().
getStudioId
());
body
.
put
(
"brandId"
,
dataApi
.
getLoginInfo
().
getBrandId
());
body
.
put
(
"courseName"
,
courseName
);
body
.
put
(
"duration"
,
duration
);
body
.
put
(
"color"
,
color
);
body
.
put
(
"categoryId"
,
categoryId
);
body
.
put
(
"timeUnit"
,
"MINUTE"
);
body
.
put
(
"brandCourseId"
,
brandCourseId
);
dataApi
.
doRequest
(
RequestType
.
JSON
,
dataparams
,
body
.
toString
(),
dataheadrs
).
assetsSuccess
(
true
);
return
XMJSONPath
.
readPath
(
dataApi
.
getApi_response
(),
"$.result"
);
}
/**
* 训练营课程列表查询
* @param categoryIds 不根据课程分类查询时传null即 new ArrayList<>();
* @param courseState 停用OFF,启用ON
* @param courseNameLike 根据课程名称 此场景是创建训练营活动时选择课程然后根据课程名称搜索
*/
public
void
getTrainingCampCourseList
(
List
<
String
>
categoryIds
,
String
courseState
,
String
courseNameLike
){
dataApi
.
setApiModule
(
ApiModule
.
Polar_Course
)
.
setApiName
(
"API_getTrainingCampCourse"
)
.
setTerminal
(
Terminal
.
B
);
super
.
beforeDataRequest
();
JSONObject
body
=
new
JSONObject
();
body
.
put
(
"operatorId"
,
dataApi
.
getLoginInfo
().
getAdminId
());
body
.
put
(
"studioId"
,
dataApi
.
getLoginInfo
().
getStudioId
());
body
.
put
(
"brandId"
,
dataApi
.
getLoginInfo
().
getBrandId
());
body
.
put
(
"categoryIds"
,
categoryIds
);
body
.
put
(
"size"
,
100
);
//每页100条数据
body
.
put
(
"current"
,
0
);
body
.
put
(
"courseState"
,
courseState
);
body
.
put
(
"courseNameLike"
,
courseNameLike
);
dataApi
.
doRequest
(
RequestType
.
JSON
,
dataparams
,
body
.
toString
(),
dataheadrs
).
assetsSuccess
(
true
);
}
/**
* 根据课程类型和课程名称 全局搜索课程
* @param courseNameLike 课程名称
* @param courseType 课程类型 团课:GROUP_CLASS;私教:PERSONAL;训练营课:TRAINING_CAMP
*/
public
void
globalSearchCourse
(
String
courseNameLike
,
String
courseType
){
dataApi
.
setApiModule
(
ApiModule
.
Polar_Course
)
.
setApiName
(
"API_globalSearchCourse"
)
.
setTerminal
(
Terminal
.
B
);
super
.
beforeDataRequest
();
JSONObject
body
=
new
JSONObject
();
body
.
put
(
"operatorId"
,
dataApi
.
getLoginInfo
().
getAdminId
());
body
.
put
(
"studioId"
,
dataApi
.
getLoginInfo
().
getStudioId
());
body
.
put
(
"brandId"
,
dataApi
.
getLoginInfo
().
getBrandId
());
body
.
put
(
"courseNameLike"
,
courseNameLike
);
body
.
put
(
"size"
,
20
);
//每页20条数据
body
.
put
(
"current"
,
0
);
body
.
put
(
"courseType"
,
courseType
);
dataApi
.
doRequest
(
RequestType
.
JSON
,
dataparams
,
body
.
toString
(),
dataheadrs
).
assetsSuccess
(
true
);
}
}
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