Commit d950a270 by xuyamei

增加预约、取消预约

parent d06c7d95
......@@ -20,7 +20,7 @@ import org.springframework.stereotype.Component;
public class CourseTools extends XMBaseTest {
/**
* @description:创建课程
* @description:创建私教课程
* @author: xuyamei
* @date: 2024/5/6 10:53
* @param courseName:课程名称
......
......@@ -37,7 +37,7 @@ public class CardTools extends XMBaseTest {
JSONObject Object = new JSONObject();
Object.put("identifier", xmAppApi.getLoginInfo().getUser());
Object.put("benefitType", "BALANCE");
Object.put("targetScope", "GROUP_CLASS_COURSE");
Object.put("targetScope", "GROUP_CLASS_AND_PERSONAL_COURSE");
Object.put("balance", "30");
Object.put("reserveLimitType", "UN_LIMIT");
Object.put("reserveLimitNumber", 0);
......@@ -102,6 +102,26 @@ public JSONObject fetchPageOfMemberCard(DataUserInfo...dataUserInfos) {
return response;
}
public JSONObject fetchPageOfMemberCard(String courseId,DataUserInfo...dataUserInfos) {
dataApi.setApiModule(ApiModule.Polar_Card)
.setApiName("API_fetchPageOfMemberCard")
.setTerminal(Terminal.B);
super.beforeDataRequest(dataUserInfos);
JSONObject jsonObject = new JSONObject();
//jsonObject.put("shelfState",shelfState);//启用状态
//jsonObject.put("xcxSaleStatus",xcxSaleStatus);//售卖状态
jsonObject.put("courseId",courseId);
jsonObject.put("current",0);
jsonObject.put("size",20);
jsonObject.put("studioId", xmAppApi.getLoginInfo().getStudioId());
jsonObject.put("brandId", xmAppApi.getLoginInfo().getBrandId());
jsonObject.put("operatorId", xmAppApi.getLoginInfo().getAdminId());
dataApi.doRequest(RequestType.JSON, dataparams, jsonObject.toJSONString(), dataheadrs).assetsSuccess(true);
JSONObject response=dataApi.getBodyInJSON();
return response.getJSONObject("result");
}
/**
* @param
* @description:会员卡搜索
......@@ -224,10 +244,38 @@ public JSONObject membercardsearch( DataUserInfo...dataUserInfos) {
}
/**
* @description:查询会员可用于约课的会员卡
* @author: xuyamei
* @date: 2024/6/23 12:38
* @param courseId:课程id
* @param courseType:课程类型 GROUP_CLASS
* @param accountType:账户类型 MEMBER
* @param memberId 会员id
* @param reserveDate:约课时间
* @param dataUserInfos
* @return: com.alibaba.fastjson.JSONArray
**/
public JSONArray listUserReservableBenefit(String courseId,String courseType,String accountType,String memberId,long reserveDate,DataUserInfo...dataUserInfos) {
dataApi.setApiModule(ApiModule.Polar_Card)
.setApiName("API_listUserReservableBenefit")
.setTerminal(Terminal.B);
super.beforeDataRequest(dataUserInfos);
JSONObject jsonObject = new JSONObject();
jsonObject.put("courseId", courseId);
jsonObject.put("courseType", courseType);
jsonObject.put("accountType", accountType);
jsonObject.put("memberId", memberId);
jsonObject.put("reserveDate", reserveDate);
jsonObject.put("studioId", dataApi.getLoginInfo().getStudioId());
jsonObject.put("brandId", dataApi.getLoginInfo().getBrandId());
jsonObject.put("operatorId", dataApi.getLoginInfo().getAdminId());
dataApi.doRequest(RequestType.JSON, dataparams, jsonObject.toJSONString(), dataheadrs).assetsSuccess(true);
return dataApi.getBodyInJSON().getJSONArray("result");
}
......
package com.xiaomai.cases.polar.reserve;
import com.alibaba.fastjson.JSONArray;
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;
import org.springframework.stereotype.Component;
/**
* @BelongsProject: xm-sportstest
* @BelongsPackage: com.xiaomai.cases.polar.reserve
* @Author: xuyamei
* @CreateTime: 2024-06-12 08:36
* @Description: 预约工具类
* @Version: 1.0
*/
@Component("reserveTools")
public class ReserveTools extends XMBaseTest {
/**
* @description: 添加预约
* @author: xuyamei
* @date: 2024/6/12 09:36
* @param areaId 场地
* @param assistantCoachId 助教id
* @param benefitId 会员卡权益id
* @param chiefCoachId 主教id
* @param memberId 会员id
* @param reserveMemberNum 预约人数
* @param scheduleId 课次id
* @param scheduleStartTime 上课时间
* @param dataUserInfos 登录用户信息
* @return: java.lang.String 预约id
**/
public String addReserve(String areaId,String assistantCoachId,String benefitId,String chiefCoachId,String memberId,int reserveMemberNum,String scheduleId,long scheduleStartTime,boolean success,DataUserInfo...dataUserInfos) {
dataApi.setApiModule(ApiModule.Polar_Reserve)
.setApiName("API_addReserve")
.setTerminal(Terminal.B);
super.beforeDataRequest(dataUserInfos);
JSONObject body = new JSONObject();
JSONArray areaIds = new JSONArray(); // 场地,私教约课会用到
if (!areaId.equals("")){
areaIds.add(areaId);
}
body.put("areaIds",areaIds);
JSONArray coachIds = new JSONArray(); // 助教Ids
if (!assistantCoachId.equals("")){
coachIds.add(assistantCoachId);
}
body.put("assistantCoachIds",coachIds);
body.put("benefitId",benefitId); //会员卡权益Id
body.put("brandId", dataApi.getLoginInfo().getBrandId());
body.put("chiefCoachId", chiefCoachId); // 主教id
body.put("memberId", memberId); // 会员id
body.put("operatorId", dataApi.getLoginInfo().getAdminId()); // 操作人id
body.put("studioId", dataApi.getLoginInfo().getStudioId());
body.put("planCheckBalance", 1); // 计划扣除额度
body.put("reserveMemberNum", reserveMemberNum); // 预约人数
body.put("scheduleId", scheduleId); // 课次id
body.put("scheduleStartTime", scheduleStartTime); // 课次id
dataApi.doRequest(RequestType.JSON,params,body.toString(),headers).assetsSuccess(success);
if (success){
return dataApi.getBodyInJSON().getJSONObject("result").getString("reserveId");
}
return dataApi.getBodyInJSON().toString();
}
/**
* @description:获取会员预约记录列表
* @author: xuyamei
* @date: 2024/6/12 15:26
* @param courseId 课程id
* @param reserveStateSet 预约状态
* @param signState 签到状态
* @param coachId 教练id
* @param scheduleStartTime 上课开始时间
* @param scheduleEndDate 上课结束时间
* @param memberId 会员id
* @param courseType 课程类型 GROUP_CLASS:团课
* @param dataUserInfos
* @return: com.alibaba.fastjson.JSONObject
**/
public JSONArray getPageByMember(String courseId,String reserveStateSet,String signState,String coachId,Long scheduleStartTime,long scheduleEndDate,String memberId,String courseType,DataUserInfo...dataUserInfos){
dataApi.setApiModule(ApiModule.Polar_Reserve)
.setApiName("API_memberReserve_getPageByMember")
.setTerminal(Terminal.B);
super.beforeDataRequest(dataUserInfos);
JSONObject body = new JSONObject();
body.put("current",0);
body.put("size",20);
if (!courseId.equals("")){
body.put("courseId",courseId);
}
if (!reserveStateSet.equals("")){
JSONArray reserveState = new JSONArray();
reserveState.add(reserveStateSet);
body.put("reserveStateSet",reserveState);
}
if (!signState.equals("")){
body.put("signInState",signState);
}
if (!coachId.equals("")){
body.put("coachId",coachId);
}
if (scheduleStartTime != null){
body.put("scheduleStartTime",scheduleStartTime);
body.put("scheduleEndDate",scheduleEndDate);
}
if(!memberId.equals("")){
body.put("memberId",memberId);
}
body.put("courseType",courseType);
body.put("brandId", dataApi.getLoginInfo().getBrandId());
body.put("operatorId", dataApi.getLoginInfo().getAdminId()); // 操作人id
body.put("studioId", dataApi.getLoginInfo().getStudioId());
dataApi.doRequest(RequestType.JSON,params,body.toString(),headers).assetsSuccess(true);
return dataApi.getBodyInJSON().getJSONObject("result").getJSONArray("records");
}
/**
* @description:预约记录列表
* @author: xuyamei
* @date: 2024/6/13 11:42
* @param courseId 课程id
* @param reserveState 预约状态
* @param signState 签到状态
* @param coachId 教练id
* @param scheduleStartTime 上课开始时间
* @param scheduleEndDate 上课结束时间
* @param memberId 会员id
* @param courseType 课程类型 GROUP_CLASS:团课
* @param dataUserInfos
* @return: com.alibaba.fastjson.JSONArray
**/
public JSONArray getPageByStudio(String courseId,String reserveState,String signState,String coachId,Long scheduleStartTime,Long scheduleEndDate,String memberId,String courseType,DataUserInfo...dataUserInfos){
dataApi.setApiModule(ApiModule.Polar_Reserve)
.setApiName("API_memberReserve_getPageByStudio")
.setTerminal(Terminal.B);
super.beforeDataRequest(dataUserInfos);
JSONObject body = new JSONObject();
body.put("current",0);
body.put("size",20);
if (!courseId.equals("")){
body.put("courseId",courseId);
}
if (!reserveState.equals("")){
body.put("reserveState",reserveState);
}
if (!signState.equals("")){
body.put("signInState",signState);
}
if (!coachId.equals("")){
body.put("coachId",coachId);
}
if (scheduleStartTime != null){
body.put("scheduleStartTime",scheduleStartTime);
body.put("scheduleEndDate",scheduleEndDate);
}
if(!memberId.equals("")){
body.put("memberId",memberId);
}
body.put("courseType",courseType);
body.put("brandId", dataApi.getLoginInfo().getBrandId());
body.put("operatorId", dataApi.getLoginInfo().getAdminId()); // 操作人id
body.put("studioId", dataApi.getLoginInfo().getStudioId());
dataApi.doRequest(RequestType.JSON,params,body.toString(),headers).assetsSuccess(true);
return dataApi.getBodyInJSON().getJSONObject("result").getJSONArray("records");
}
/**
* @description:根据id获取预约记录信息
* @author: xuyamei
* @date: 2024/6/13 11:51
* @param reserveId: 预约id
* @return:
**/
public JSONObject getDetailById(String reserveId,DataUserInfo...dataUserInfos) {
dataApi.setApiModule(ApiModule.Polar_Reserve)
.setApiName("API_memberReserve_getDetailById")
.setTerminal(Terminal.B);
super.beforeDataRequest(dataUserInfos);
JSONObject body = new JSONObject();
body.put("reserveId",reserveId);
body.put("brandId", dataApi.getLoginInfo().getBrandId());
body.put("operatorId", dataApi.getLoginInfo().getAdminId()); // 操作人id
body.put("studioId", dataApi.getLoginInfo().getStudioId());
dataApi.doRequest(RequestType.JSON,params,body.toString(),headers).assetsSuccess(true);
return dataApi.getBodyInJSON().getJSONObject("result");
}
public void cancelMemberReserve(String reserveId,boolean success){
dataApi.setApiModule(ApiModule.Polar_Reserve)
.setApiName("API_memberReserve_cancel")
.setTerminal(Terminal.B);
super.beforeDataRequest();
JSONArray reserveIds = new JSONArray();
reserveIds.add(reserveId);
JSONObject body = new JSONObject();
body.put("reserveIds",reserveIds);
body.put("brandId", dataApi.getLoginInfo().getBrandId());
body.put("operatorId", dataApi.getLoginInfo().getAdminId()); // 操作人id
body.put("studioId", dataApi.getLoginInfo().getStudioId());
dataApi.doRequest(RequestType.JSON,params,body.toString(),headers).assetsSuccess(success);
}
}
......@@ -49,7 +49,7 @@ public class GroupScheduleTools extends XMBaseTest {
* @param force 是否冲突
* @param endType 排课结束方式:1 按日期,2 按次数
*/
public void createGroupRuleSchedule(String courseId, String chiefCoachId, String startDate, String endDate, List<String> venueAreaIds, List<String> assistCoachIds, Boolean force, int endType) {
public void createGroupRuleSchedule(String courseId, String chiefCoachId, String startDate, String endDate, List<String> venueAreaIds, List<String> assistCoachIds, Boolean force, int endType,int minuteOffset) {
setUP("API_createGroupRuleSchedule");
JSONObject body = new JSONObject();
body.put("operatorId", dataApi.getLoginInfo().getAdminId());
......@@ -59,7 +59,7 @@ public class GroupScheduleTools extends XMBaseTest {
body.put("chiefCoachId", chiefCoachId);
body.put("minMemberNum", 2); // 开课人数
body.put("maxMemberNum", 999); //人数上限
body.put("minuteOffset", 480); //上课开始时间
body.put("minuteOffset", minuteOffset); //上课开始时间
body.put("startDate", startDate); //排课开始日期
body.put("endDate", endDate); //排课结束日期
String[] weekDaysArray = {"MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY", "SATURDAY", "SUNDAY"};
......@@ -133,13 +133,13 @@ public class GroupScheduleTools extends XMBaseTest {
* 删除团课排课日程
* @param ruleId
*/
public void delGroupRuleSchedule(String ruleId){
public void delGroupRuleSchedule(String ruleId, Boolean force){
setUP("API_delGroupRuleSchedule");
JSONObject body = new JSONObject();
body.put("operatorId", dataApi.getLoginInfo().getAdminId());
body.put("studioId", dataApi.getLoginInfo().getStudioId());
body.put("brandId", dataApi.getLoginInfo().getBrandId());
body.put("force", false);
body.put("force", force);
body.put("ruleId", ruleId);
dataApi.doRequest(RequestType.JSON, params, body.toString(), headers).assetsSuccess(true);
......@@ -227,10 +227,99 @@ public class GroupScheduleTools extends XMBaseTest {
}
/**
* @description:获取课次详情
* @author: xuyamei
* @date: 2024/6/23 17:45
* @param scheduleId
* @return: com.alibaba.fastjson.JSONObject
**/
public JSONObject getScheduleItemDetail(String scheduleId){
setUP("API_getScheduleItemDetail");
JSONObject body = new JSONObject();
body.put("operatorId", dataApi.getLoginInfo().getAdminId());
body.put("studioId", dataApi.getLoginInfo().getStudioId());
body.put("brandId", dataApi.getLoginInfo().getBrandId());
body.put("id", scheduleId);
dataApi.doRequest(RequestType.JSON, dataparams, body.toString(), dataheadrs).assetsSuccess(true);
return dataApi.getBodyInJSON().getJSONObject("result");
}
/**
* @description:查询课表
* @author: xuyamei
* @date: 2024/6/23 17:46
* @param startDate
* @param endDate
* @return: com.alibaba.fastjson.JSONArray
**/
public JSONArray getGroupScheduleTable(Long startDate,Long endDate){
setUP("API_getGroupScheduleTable");
JSONObject body = new JSONObject();
body.put("operatorId", dataApi.getLoginInfo().getAdminId());
body.put("studioId", dataApi.getLoginInfo().getStudioId());
body.put("brandId", dataApi.getLoginInfo().getBrandId());
body.put("startDate", startDate);
body.put("endDate", endDate);
dataApi.doRequest(RequestType.JSON, dataparams, body.toString(), dataheadrs).assetsSuccess(true);
return dataApi.getBodyInJSON().getJSONObject("result").getJSONArray("timetableGroups").getJSONObject(0).getJSONArray("timetableList");
}
/**
* @description:TODO
* @author: xuyamei
* @date: 2024/6/23 20:45
* @param scheduleId:课次id
* @param startTime:开始时间
* @param chiefCoachId:教练
* @param minMemberNum:开课人数
* @param maxMemberNum:最大人数上限
* @param dataUserInfos
* @return: void
**/
public void editGroupSchedule(String scheduleId,Long startTime,String chiefCoachId,int minMemberNum,int maxMemberNum,DataUserInfo...dataUserInfos){
setUP("API_editGroupSchedule",dataUserInfos);
JSONObject body = new JSONObject();
body.put("operatorId", dataApi.getLoginInfo().getAdminId());
body.put("studioId", dataApi.getLoginInfo().getStudioId());
body.put("brandId", dataApi.getLoginInfo().getBrandId());
body.put("scheduleId", scheduleId);
body.put("startTime", startTime);
body.put("chiefCoachId", chiefCoachId);
body.put("applyRestRule", false);
body.put("minMemberNum", minMemberNum);
body.put("maxMemberNum", maxMemberNum);
body.put("venueAreaIds", new ArrayList());
body.put("assistCoachIds", new ArrayList());
body.put("spanMinutes", 60);
body.put("force", false);
dataApi.doRequest(RequestType.JSON, dataparams, body.toString(), dataheadrs).assetsSuccess(true);
}
/**
* @description:删除单个排课
* @author: xuyamei
* @date: 2024/6/23 21:12
* @param scheduleId :排课id
* @param dataUserInfos
* @return: void
**/
public void delGroupScheduleItem(String scheduleId,DataUserInfo...dataUserInfos){
setUP("API_delGroupScheduleItem",dataUserInfos);
JSONObject body = new JSONObject();
body.put("operatorId", dataApi.getLoginInfo().getAdminId());
body.put("studioId", dataApi.getLoginInfo().getStudioId());
body.put("brandId", dataApi.getLoginInfo().getBrandId());
body.put("scheduleId", scheduleId);
body.put("applyRestRule", false);
dataApi.doRequest(RequestType.JSON, dataparams, body.toString(), dataheadrs).assetsSuccess(true);
}
}
......
......@@ -75,14 +75,14 @@ public class TestCreateGroupRuleSchedule extends BaseTestImpl {
List<String> assistCoachIdS = groupScheduleTools.getStudioAdminId(chiefCoachId);
//1-创建排课日程
groupScheduleTools.createGroupRuleSchedule(courseId, chiefCoachIdS, todayStartTimeTamp, endDateTimeTamp, venueAreaIds, assistCoachIdS, false, 1);
groupScheduleTools.createGroupRuleSchedule(courseId, chiefCoachIdS, todayStartTimeTamp, endDateTimeTamp, venueAreaIds, assistCoachIdS, false, 1,480);
//2-查询排课日程
JSONArray result = groupScheduleTools.getGroupRuleScheduleList(courseId, chiefCoachIdS);
Assert.assertTrue(result.size() >= 1);
//统计查询到的目标日程数量
int size = result.size();
String ruldId = XMJSONPath.readPath(result.getJSONObject(0), "$.ruleId");
groupScheduleTools.delGroupRuleSchedule(ruldId);
groupScheduleTools.delGroupRuleSchedule(ruldId,true);
JSONArray result2 = groupScheduleTools.getGroupRuleScheduleList(courseId, chiefCoachIdS);
//删除成功后,统计查询到的目标日程数量是否-1
Assert.assertEquals(result2.size(), size - 1);
......
......@@ -62,7 +62,7 @@ public class TestEditGroupRuleSchedule extends BaseTestImpl {
assistCoachIds.add("吴彦祖");
List<String> assistCoachIdS = groupScheduleTools.getStudioAdminId(chiefCoachId);
//1-创建排课日程
groupScheduleTools.createGroupRuleSchedule(courseId, chiefCoachIdS, theDayBeforeYesterdayTimeTamp, endDateTimeTamp, new ArrayList<>(), assistCoachIdS, false, 1);
groupScheduleTools.createGroupRuleSchedule(courseId, chiefCoachIdS, theDayBeforeYesterdayTimeTamp, endDateTimeTamp, new ArrayList<>(), assistCoachIdS, false, 1,720);
//2-查询排课日程
JSONArray result = groupScheduleTools.getGroupRuleScheduleList(courseId, chiefCoachIdS);
Assert.assertTrue(result.size() >= 1);
......@@ -98,7 +98,7 @@ public class TestEditGroupRuleSchedule extends BaseTestImpl {
Assert.assertTrue(XMJSONPath.getJSONArrayByReadPath(detailResult,"$.result.venueAreaIds").containsAll(venueAreaIds),"设置有空改为有数据后没生效");
//5-删除日程
groupScheduleTools.delGroupRuleSchedule(ruldId);
groupScheduleTools.delGroupRuleSchedule(ruldId,true);
......
......@@ -17,6 +17,9 @@ public class ApiModule {
public static String Polar_Schedule="polar_schedule";//课程排期
public static String Polar_Reserve="polar_reserve";//预约
......
......@@ -11,8 +11,8 @@ public class LoginAccount {
public static String ZYX_DEV = "zyx_dev";
public static String ADU_PROD = "gym_prod_du";
public static String GYM_PROD = "GYM_PROd" +
"";
public static String GYM_PROD = "gym_prod";
public static String XYM_PROD = "xym_prod";
}
......@@ -62,7 +62,7 @@ public class CommonLogin {
String brandId = userInfo.getBrandId();
String studioId = userInfo.getStudioId();
String user = userInfo.getUser();
url = host + "/polar/anon/login/loginAdmin?sfl=0.0&sft=20.0&version=1.0&sfr=0.0&build=1&platform=iOS&sfb=0.0";
url = host + "/polar/anon/login/loginAdmin?version=1.0&sfb=0.0&build=1&deviceType=ios&sft=20.0&sfl=0.0&sfr=0.0";
// B端登录URL
logger.info("B端登录URL==>>" + url);
String data = "{\"accountNo\":\"" + accountNo + "\",\"certificate\":\"0000\",\"loginTerm\":\"FITNESS_ADMIN_APP\",\"loginMode\":\"PHONE_AUTH_CODE\",\"serverType\": \"B_LOGIN\"}";
......
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