Commit 6643b5e7 by xuyamei

新增单次约课case

parent 60c91044
......@@ -6,6 +6,7 @@ import com.xiaomai.client.DataUserInfo;
import com.xiaomai.enums.ApiModule;
import com.xiaomai.enums.RequestType;
import com.xiaomai.enums.Terminal;
import com.xiaomai.utils.RandomStringUtil;
import com.xiaomai.utils.XMBaseTest;
import org.springframework.stereotype.Component;
......@@ -183,7 +184,7 @@ public class ReserveCTools extends XMBaseTest {
* @param dataUserInfos
* @return: com.alibaba.fastjson.JSONObject
**/
public JSONObject getDetailById(String reserveId,DataUserInfo...dataUserInfos) {
public JSONObject getReserveDetailById(String reserveId,DataUserInfo...dataUserInfos) {
setUP("API_getDetailById");
JSONObject body = new JSONObject();
......@@ -336,4 +337,130 @@ public class ReserveCTools extends XMBaseTest {
}
/**
* @description: 检查会员课次是否冲突
* @author: xuyamei
* @date: 2024/7/30 11:18
* @param memberId 会员id
* @param scheduleId 课次id
* @return: java.lang.Boolean
**/
public Boolean checkMemberConflict(String memberId,String scheduleId){
setUP("API_checkMemberConflict");
JSONObject body = new JSONObject();
body.put("scheduleId",scheduleId);
body.put("memberId",memberId);
body.put("studioId",dataApi.getLoginInfo().getStudioId());
dataApi.doRequest(RequestType.JSON,dataparams,body.toString(),dataheadrs).assetsSuccess(true);
return dataApi.getBodyInJSON().getJSONObject("result").getBoolean("conflict");
}
/**
* @description:检查是否支持单次约课、排队
* @author: xuyamei
* @date: 2024/7/30 11:37
* @param addToQueue 是否排队
* @param courseId 课程id
* @param chiefCoachId 主教id
* @param memberId 会员id
* @param scheduleId 课次id
* @param scheduleStartTime 课次开始时间
* @param spanMinutes 上课时长
* @param receivableAmount 单次约课金额
* @return: java.lang.String
**/
public String checkAddSingleReserve(boolean addToQueue,String courseId,String chiefCoachId,String memberId,String scheduleId,long scheduleStartTime,int spanMinutes,int receivableAmount){
setUP("API_checkAddSingleReserve");
JSONObject body = new JSONObject();
body.put("addToQueue",addToQueue);
JSONArray areaIds = new JSONArray();
body.put("areaIds", areaIds); // 场地
JSONArray assistantCoachIds = new JSONArray();
body.put("assistantCoachIds",assistantCoachIds); // 助教
body.put("chiefCoachId",chiefCoachId); // 教练
body.put("memberId", memberId); // 会员id
body.put("courseId", courseId); // 课次id
body.put("objectId", RandomStringUtil.randomString(16)); // 会员id
body.put("receivableAmount", receivableAmount); // 会员id
body.put("studioId", dataApi.getLoginInfo().getStudioId());
body.put("scheduleId", scheduleId);
body.put("scheduleStartTime", scheduleStartTime);
body.put("spanMinutes", spanMinutes);
body.put("brandId", dataApi.getLoginInfo().getBrandId());
dataApi.doRequest(RequestType.JSON,dataparams,body.toString(),dataheadrs).assetsSuccess(true);
return dataApi.getBodyInJSON().getJSONObject("result").getString("resultCode");
}
/**
* @description:创建单次约课订单
* @author: xuyamei
* @date: 2024/7/30 11:48
* @param addToQueue 是否排队
* @param chiefCoachId 主教id
* @param memberId 会员id
* @param scheduleId 课次id
* @param scheduleStartTime 课次开始时间
* @param spanMinutes 上课时长
* @param receivableAmount 单次约课金额
* @return: java.lang.String
**/
public String createSingleReserve(boolean addToQueue,String courseId,String chiefCoachId,String memberId,String scheduleId,long scheduleStartTime,int spanMinutes,int receivableAmount){
setUP("API_createSingleReserve");
JSONObject body = new JSONObject();
body.put("addToQueue",addToQueue);
JSONArray areaIds = new JSONArray();
body.put("areaIds", areaIds); // 场地
JSONArray assistantCoachIds = new JSONArray();
body.put("assistantCoachIds",assistantCoachIds); // 助教
body.put("chiefCoachId",chiefCoachId); // 教练
body.put("memberId", memberId); // 会员id
body.put("courseId", courseId); // 课次id
body.put("objectId", RandomStringUtil.randomString(16)); // 会员id
body.put("receivableAmount", receivableAmount); // 会员id
body.put("studioId", dataApi.getLoginInfo().getStudioId());
body.put("scheduleId", scheduleId);
body.put("scheduleStartTime", scheduleStartTime);
body.put("spanMinutes", spanMinutes);
body.put("brandId", dataApi.getLoginInfo().getBrandId());
dataApi.doRequest(RequestType.JSON,dataparams,body.toString(),dataheadrs).assetsSuccess(true);
return dataApi.getBodyInJSON().getString("result");
}
/**
* @description:根据订单凭证id获取任务信息
* @author: xuyamei
* @date: 2024/7/30 11:56
* @param voucherId :订单id
* @return: com.alibaba.fastjson.JSONObject
**/
public JSONObject getDetailById(String voucherId){
setUP("API_singleReserve_getByVoucherId");
JSONObject body = new JSONObject();
body.put("voucherId",voucherId);
dataApi.doRequest(RequestType.JSON,dataparams,body.toString(),dataheadrs).assetsSuccess(true);
return dataApi.getBodyInJSON().getJSONObject("result");
}
}
......@@ -182,7 +182,7 @@ public class TestAddMemberReserve extends BaseTestImpl {
int[] minuteOffset = {60, 120, 180, 240, 300, 360, 420, 480, 540, 600, 660, 720, 780, 840, 900, 960, 1020, 1080, 1140, 1200, 1260};
Random random = new Random();
//1.1-创建排课日程
groupScheduleTools.createGroupRuleSchedule(courseId, dataApi.getLoginInfo().getAdminId(), todayStartTimeTamp, todayEndDateTimeTamp, new ArrayList(), new ArrayList(), false, 1,minuteOffset[random.nextInt(20)],dataUserInfo);
groupScheduleTools.createGroupRuleSchedule(courseId, dataApi.getLoginInfo().getAdminId(), todayStartTimeTamp, todayEndDateTimeTamp, new ArrayList(), new ArrayList(), true, 1,minuteOffset[random.nextInt(20)],dataUserInfo);
//1.2-查询排课日程
JSONArray getGroupRuleScheduleList = groupScheduleTools.getGroupRuleScheduleList(courseId, dataApi.getLoginInfo().getAdminId(),dataUserInfo);
//统计查询到的目标日程数量
......
......@@ -268,7 +268,7 @@ public class TestAddToQueue extends BaseTestImpl {
int[] minuteOffset = {60, 120, 180, 240, 300, 360, 420, 480, 540, 600, 660, 720, 780, 840, 900, 960, 1020, 1080, 1140, 1200, 1260};
Random random = new Random();
//1.1-创建排课日程
groupScheduleTools.createGroupRuleSchedule(courseId, dataApi.getLoginInfo().getAdminId(), todayStartTimeTamp, todayEndDateTimeTamp, new ArrayList(), new ArrayList(), false, 1,minuteOffset[random.nextInt(20)],dataUserInfo);
groupScheduleTools.createGroupRuleSchedule(courseId, dataApi.getLoginInfo().getAdminId(), todayStartTimeTamp, todayEndDateTimeTamp, new ArrayList(), new ArrayList(), true, 1,minuteOffset[random.nextInt(20)],dataUserInfo);
//1.2-查询排课日程
JSONArray getGroupRuleScheduleList = groupScheduleTools.getGroupRuleScheduleList(courseId, dataApi.getLoginInfo().getAdminId(),dataUserInfo);
//统计查询到的目标日程数量
......
......@@ -454,4 +454,49 @@ public class CourseTools extends XMBaseTest {
dataApi.doRequest(RequestType.JSON, dataparams, body.toString(), dataheadrs).assetsSuccess(true);
}
/**
* @description:编辑团课
* @author: xuyamei
* @date: 2024/7/30 10:57
* @param categoryId 课程分类
* @param courseId 课程id
* @param courseName 课程名称
* @param duration 时长
* @param singleReserve 是否支持单次预约
* @param reservePrice 单次预约价格
* @param dataUserInfo
* @return: void
**/
public void editGroupCourse(String categoryId,String courseId,String courseName,int duration,boolean singleReserve,int reservePrice,DataUserInfo...dataUserInfo){
dataApi.setApiModule(ApiModule.Polar_Course)
.setApiName("API_editGroupCourse")
.setTerminal(Terminal.B);
super.beforeDataRequest(dataUserInfo);
JSONObject body = new JSONObject();
body.put("categoryId", categoryId);
body.put("courseName", courseName);
body.put("duration", duration); // 时长
body.put("difficulty", 3); // 难度
body.put("color", "#AACF53");
body.put("calorie", "0"); // 卡路里
body.put("coverId", "0");
body.put("timeUnit", "MINUTE");
body.put("operatorId", dataApi.getLoginInfo().getAdminId());
body.put("sourceId", dataApi.getLoginInfo().getStudioId()); // 来源:场馆、品牌
body.put("sourceType", "STUDIO"); // 来源类型:场馆、品牌
body.put("brandId", dataApi.getLoginInfo().getBrandId()); // 品牌
body.put("studioId", dataApi.getLoginInfo().getStudioId());
body.put("brandCourseId", courseId);
body.put("singleReserve", singleReserve); // 是否支持单次约课
if (singleReserve){
body.put("reservePrice", reservePrice); // 单次预约的价格
}
dataApi.doRequest(RequestType.JSON, dataparams, body.toString(), dataheadrs).assetsSuccess(true);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment