Commit a07aa094 by DuJunLi

优化代码,新增优惠券相关case

parent 12635d76
...@@ -184,6 +184,60 @@ public class CouponTools extends BaseTestImpl { ...@@ -184,6 +184,60 @@ public class CouponTools extends BaseTestImpl {
dataApi.doRequest(RequestType.JSON, dataparams, body.toString(), dataheadrs).assetsSuccess(true); dataApi.doRequest(RequestType.JSON, dataparams, body.toString(), dataheadrs).assetsSuccess(true);
} }
/**
* 优惠券详情-查看已发放/已使用优惠券
* @param couponId 优惠券ID
* @param status 优惠券的适用状态,""表示已发放列表的状态,USED是已使用
*/
public void getCouponReceiveRecord(String couponId,String status){
setUP("API_getCouponReceiveRecord");
JSONObject body = new JSONObject();
body.put("operatorId", dataApi.getLoginInfo().getAdminId());
body.put("studioId", dataApi.getLoginInfo().getStudioId());
body.put("brandId", dataApi.getLoginInfo().getBrandId());
body.put("current", 0);
body.put("size", 500);
body.put("couponId", couponId);
body.put("status", status);
if(status.isEmpty()){
body.put("status", null);
}
dataApi.doRequest(RequestType.JSON, dataparams, body.toString(), dataheadrs).assetsSuccess(true);
}
/**
* 会员详情-查看会员已领取/已发放优惠券
* @param memberId 会员ID
* @param status 优惠券状态:待使用"AVAILABLE", 已使用"USED", 已过期"EXPIRED",已作废"ABANDONED"
*/
public void getMemberReceivedCoupon(String memberId,String status){
setUP("API_getMemberReceivedCoupon");
JSONObject body = new JSONObject();
body.put("operatorId", dataApi.getLoginInfo().getAdminId());
body.put("studioId", dataApi.getLoginInfo().getStudioId());
body.put("brandId", dataApi.getLoginInfo().getBrandId());
body.put("current", 0);
body.put("size", 500);
body.put("receiverId", memberId);
body.put("status", status);
dataApi.doRequest(RequestType.JSON, dataparams, body.toString(), dataheadrs).assetsSuccess(true);
}
/**
* 作废会员已领取/已发放的优惠券
* @param recordId 对应的记录ID
*/
public void abandonMembercouponReceiveRecord(String recordId){
setUP("API_abandonMembercouponReceiveRecord");
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", recordId);
dataApi.doRequest(RequestType.JSON, dataparams, body.toString(), dataheadrs).assetsSuccess(true);
}
} }
\ No newline at end of file
package com.xiaomai.cases.polar.coupon; package com.xiaomai.cases.polar.coupon;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.xiaomai.basetest.BaseTestImpl; import com.xiaomai.cases.polar.finance.order.OrderTools;
import com.xiaomai.cases.polar.member.Tools; import com.xiaomai.cases.polar.member.Tools;
import com.xiaomai.cases.polar.schedule.camp.SelectTargetTrainingCampAndGetInfo;
import com.xiaomai.cases.polar.training.TrainingTools; import com.xiaomai.cases.polar.training.TrainingTools;
import com.xiaomai.enums.ApiModule; import com.xiaomai.enums.ApiModule;
import com.xiaomai.enums.LoginAccount; import com.xiaomai.enums.LoginAccount;
...@@ -25,7 +26,7 @@ import java.util.List; ...@@ -25,7 +26,7 @@ import java.util.List;
* data 2024/7/27 17:16 * data 2024/7/27 17:16
*/ */
public class TestBatchSendCouponToMember extends BaseTestImpl { public class TestBatchSendCouponToMember extends SelectTargetTrainingCampAndGetInfo {
@Resource(name = "couponTools") @Resource(name = "couponTools")
CouponTools couponTools; CouponTools couponTools;
String memberId = ""; String memberId = "";
...@@ -34,6 +35,9 @@ public class TestBatchSendCouponToMember extends BaseTestImpl { ...@@ -34,6 +35,9 @@ public class TestBatchSendCouponToMember extends BaseTestImpl {
@Resource(name = "trainingTools") @Resource(name = "trainingTools")
TrainingTools trainingTools; TrainingTools trainingTools;
@Resource(name = "orderTools")
OrderTools orderTools;
String title = ""; String title = "";
String couponId = ""; String couponId = "";
...@@ -64,13 +68,14 @@ public class TestBatchSendCouponToMember extends BaseTestImpl { ...@@ -64,13 +68,14 @@ public class TestBatchSendCouponToMember extends BaseTestImpl {
int quantityBefore = Integer.valueOf(XMJSONPath.readPath(dataApi.getApi_response(), "$.result.quantity")); int quantityBefore = Integer.valueOf(XMJSONPath.readPath(dataApi.getApi_response(), "$.result.quantity"));
int inventoryBefore = Integer.valueOf(XMJSONPath.readPath(dataApi.getApi_response(), "$.result.inventory")); int inventoryBefore = Integer.valueOf(XMJSONPath.readPath(dataApi.getApi_response(), "$.result.inventory"));
int receivedBefore = Integer.valueOf(XMJSONPath.readPath(dataApi.getApi_response(), "$.result.received")); int receivedBefore = Integer.valueOf(XMJSONPath.readPath(dataApi.getApi_response(), "$.result.received"));
Double preferential=Double.valueOf(XMJSONPath.readPath(dataApi.getApi_response(), "$.result.preferential"));
//4.操作定向发放优惠券 //4.操作定向发放优惠券
//搜索目标会员 //搜索目标会员
String phone = "17682302508"; String phone = "15558121569";
memberId = trainingTools.searchTargerMember(phone); memberId = trainingTools.searchTargerMember(phone);
if (memberId.isEmpty()) { if (memberId.isEmpty()) {
memberId = tools.create("测试机吴彦祖", phone).getString("result"); memberId = tools.create("杜君丽", phone).getString("result");
} }
JSONObject body = new JSONObject(); JSONObject body = new JSONObject();
List<String> receiverIds = new ArrayList<>(); List<String> receiverIds = new ArrayList<>();
...@@ -101,9 +106,107 @@ public class TestBatchSendCouponToMember extends BaseTestImpl { ...@@ -101,9 +106,107 @@ public class TestBatchSendCouponToMember extends BaseTestImpl {
Assert.assertTrue(Integer.valueOf(XMJSONPath.readPath(dataApi.getApi_response(), "$.result.inventory"))+1==inventoryBefore,"优惠券发放给会员后,剩余库存没减少"); Assert.assertTrue(Integer.valueOf(XMJSONPath.readPath(dataApi.getApi_response(), "$.result.inventory"))+1==inventoryBefore,"优惠券发放给会员后,剩余库存没减少");
Assert.assertTrue(Integer.valueOf(XMJSONPath.readPath(dataApi.getApi_response(), "$.result.received"))-1==receivedBefore,"优惠券发放给会员后,已发放数据不对"); Assert.assertTrue(Integer.valueOf(XMJSONPath.readPath(dataApi.getApi_response(), "$.result.received"))-1==receivedBefore,"优惠券发放给会员后,已发放数据不对");
//优惠券详情-已发放记录
couponTools.getCouponReceiveRecord(couponId,"");
Long countR= XMJSONPath.getJSONArrayByReadPath(dataApi.getApi_response(), "$.result.records").toJavaList(JSONObject.class).stream().filter(e ->
e.getString("couponId").equals(couponId)).count();
Assert.assertTrue(countR==1,"操作定向发放优惠券后,发给一个学员,然后在优惠券详情已发放列表没匹配到数据");
String goalRecordId=XMJSONPath.getJSONArrayByReadPath(dataApi.getApi_response(), "$.result.records").toJavaList(JSONObject.class).stream().filter(e ->
e.getString("couponId").equals(couponId)).map(e->e.getString("id")).findFirst().orElse(null);
//会员详情-优惠券-已发放优惠券:待使用列表check
couponTools.getMemberReceivedCoupon(memberId,"AVAILABLE");
Assert.assertTrue(XMJSONPath.getJSONArrayByReadPath(dataApi.getApi_response(), "$.result.records").toJavaList(JSONObject.class).stream().filter(e ->
e.getString("id").equals(goalRecordId)).count()==1,"操作定向发放优惠券后,发给一个学员,然后在会员详情-优惠券-待使用列表没匹配到数据");
//操作修改剩余库存
couponTools.modifyCouponInventory(couponId,10);
//剩余库存修改成功后,优惠券详情check 总数据,剩余库存,已发放数量
couponTools.getCouponDetail(couponId);
Assert.assertTrue(Integer.valueOf(XMJSONPath.readPath(dataApi.getApi_response(), "$.result.quantity"))==11,"修改剩余库存后,优惠券的总数量对不上了");
Assert.assertTrue(Integer.valueOf(XMJSONPath.readPath(dataApi.getApi_response(), "$.result.inventory"))==10,"修改剩余库存后,剩余库存数量对不上");
Assert.assertTrue(Integer.valueOf(XMJSONPath.readPath(dataApi.getApi_response(), "$.result.received"))==1,"优惠券发放给会员后,已发放数据不对");
//操作失效优惠券
couponTools.InvalidCoupon(couponId);
//查看优惠券详情,check状态
couponTools.getCouponDetail(couponId);
Assert.assertTrue(XMJSONPath.readPath(dataApi.getApi_response(),"$.result.status").equals("VOIDED"),"操作失效优惠券后,查看优惠券详情,后端返回的状态值不是VOIDED");
//操作给刚发放优惠券的会员 去买训练营(使用优惠券)
trainingTools.doSignCampOrder(memberId,this.price-preferential,this.campId,goalRecordId);
String orderId=XMJSONPath.readPath(dataApi.getApi_response(),"$.result");
//优惠券详情-已使用优惠券check
couponTools.getCouponReceiveRecord(couponId,"USED");
Long countRUse= XMJSONPath.getJSONArrayByReadPath(dataApi.getApi_response(), "$.result.records").toJavaList(JSONObject.class).stream().
filter(e ->
e.getString("couponId").equals(couponId)).
filter(e ->
e.getString("status").equals("USED")).count();
Assert.assertTrue(countRUse==1,"定向发放优惠券后,学员使用了优惠券,在优惠券详情-已使用记录中数据没匹配上");
//会员详情-优惠券-已使用优惠券 为 1check
couponTools.getMemberReceivedCoupon(memberId,"USED");
Assert.assertTrue(XMJSONPath.getJSONArrayByReadPath(dataApi.getApi_response(), "$.result.records").toJavaList(JSONObject.class).stream().filter(e ->
e.getString("id").equals(goalRecordId)). filter(e ->
e.getString("status").equals("USED")).count()==1,"会员使用优惠券后,会员详情-优惠券-已使用优惠券列表数据没有目标数据");
//会员详情-优惠券-目标待使用优惠券为0
couponTools.getMemberReceivedCoupon(memberId,"AVAILABLE");
Assert.assertTrue(XMJSONPath.getJSONArrayByReadPath(dataApi.getApi_response(), "$.result.records").toJavaList(JSONObject.class).stream().filter(e ->
e.getString("id").equals(goalRecordId)). filter(e ->
e.getString("status").equals("AVAILABLE")).count()==0,"会员使用优惠券后,会员详情-优惠券-待使用优惠券列表数据还有目标数据");
//用完优惠券后check,优惠券详情已核销数量
couponTools.getCouponDetail(couponId);
Assert.assertTrue(Integer.valueOf(XMJSONPath.readPath(dataApi.getApi_response(), "$.result.verified"))==1,"优惠券发放给会员,会员适用后,对应优惠券已使用数量不对");
//操作作废订单,check优惠券是否返还给会员,优惠券中已发放数量中核销数量是否同步更新
orderTools.discard(orderId,"重复录入","自动化测试作废训练营订单");
//优惠券详情-已使用优惠券check
couponTools.getCouponReceiveRecord(couponId,"USED");
Assert.assertTrue(XMJSONPath.getJSONArrayByReadPath(dataApi.getApi_response(), "$.result.records").toJavaList(JSONObject.class).stream().
filter(e ->
e.getString("couponId").equals(couponId)).
filter(e ->
e.getString("status").equals("USED")).count()==0,"学员使用了优惠券报名,订单被作废后,在优惠券详情-已使用记录中数据还存在");
//会员详情-优惠券-已使用优惠券check(退)
couponTools.getMemberReceivedCoupon(memberId,"USED");
Assert.assertTrue(XMJSONPath.getJSONArrayByReadPath(dataApi.getApi_response(), "$.result.records").toJavaList(JSONObject.class).stream().filter(e ->
e.getString("id").equals(goalRecordId)). filter(e ->
e.getString("status").equals("USED")).count()==0,"会员使用优惠券后,再操作作废订单,会员详情-优惠券-已使用优惠券列表数据还有目标数据");
//会员详情-优惠券-已发放check(+1)
couponTools.getMemberReceivedCoupon(memberId,"AVAILABLE");
Assert.assertTrue(XMJSONPath.getJSONArrayByReadPath(dataApi.getApi_response(), "$.result.records").toJavaList(JSONObject.class).stream().filter(e ->
e.getString("id").equals(goalRecordId)).count()==1,"会员使用优惠券下单,作废订单后,然后在会员详情-优惠券-待使用列表没匹配到数据");
//优惠券详情-已发放记录-操作作废优惠券
couponTools.abandonMembercouponReceiveRecord(goalRecordId);
//优惠券详情,已发放记录列表,优惠券状态为已作废
couponTools.getCouponReceiveRecord(couponId,"");
Long countRAbandon= XMJSONPath.getJSONArrayByReadPath(dataApi.getApi_response(), "$.result.records").toJavaList(JSONObject.class).stream().filter(e ->
e.getString("couponId").equals(couponId)).filter(e ->
e.getString("status").equals("ABANDONED")).count();
Assert.assertTrue(countR==1,"操作定向发放优惠券后,再作废优惠券,然后在优惠券详情已发放列表没匹配到数据");
//会员详情-优惠券-已作废优惠券check
couponTools.getMemberReceivedCoupon(memberId,"ABANDONED");
Assert.assertTrue(XMJSONPath.getJSONArrayByReadPath(dataApi.getApi_response(), "$.result.records").toJavaList(JSONObject.class).stream().filter(e ->
e.getString("id").equals(goalRecordId)).filter(e ->
e.getString("status").equals("ABANDONED")).count()==1,"作废会员优惠券后,会员详情-优惠券-已作废优惠券列表数据没有目标数据");
//会员详情-优惠券-已发放check(-1)
couponTools.getMemberReceivedCoupon(memberId,"AVAILABLE");
Assert.assertTrue(XMJSONPath.getJSONArrayByReadPath(dataApi.getApi_response(), "$.result.records").toJavaList(JSONObject.class).stream().filter(e ->
e.getString("id").equals(goalRecordId)).filter(e ->
e.getString("status").equals("AVAILABLE")).count()==0,"作废会员优惠券后,然后在会员详情-优惠券-待使用列表还能匹配到数据");
//最后要删除刚创建的训练营活动
trainingTools.deleteTraining(this.campId);
} }
} }
......
...@@ -88,7 +88,7 @@ public class TestEditCampRuleSchedule extends SelectTargetTrainingCampAndGetInfo ...@@ -88,7 +88,7 @@ public class TestEditCampRuleSchedule extends SelectTargetTrainingCampAndGetInfo
memberId = tools.create("晨晨爸爸", phone).getString("result"); memberId = tools.create("晨晨爸爸", phone).getString("result");
} }
//给会员报名 //给会员报名
trainingTools.doSignCampOrder(memberId, this.price, this.campId); trainingTools.doSignCampOrder(memberId, this.price, this.campId,"");
orderId = XMJSONPath.readPath(dataApi.getApi_response(), "$.result"); orderId = XMJSONPath.readPath(dataApi.getApi_response(), "$.result");
Thread.sleep(2000); Thread.sleep(2000);
......
...@@ -67,7 +67,7 @@ public class TestEditCampScheduleItem extends SelectTargetTrainingCampAndGetInfo ...@@ -67,7 +67,7 @@ public class TestEditCampScheduleItem extends SelectTargetTrainingCampAndGetInfo
"1140", super.openEndDate, true, "1140", super.openEndDate, true,
String.valueOf(loopNum)); String.valueOf(loopNum));
//查询排课日程:根据训练营和关联课程查询 //查询排课日程:根据训练营和关联课程查询
campScheduleTools.getCampRuleScheduleList(campId, super.courseId, ""); campScheduleTools.getCampRuleScheduleList(super.campId, super.courseId, "");
Assert.assertTrue(XMJSONPath.getJSONArrayByReadPath(dataApi.getApi_response(), "$.result").size() == 1, "排课创建成功后,日程中没查询到对应数据"); Assert.assertTrue(XMJSONPath.getJSONArrayByReadPath(dataApi.getApi_response(), "$.result").size() == 1, "排课创建成功后,日程中没查询到对应数据");
ruldId = XMJSONPath.getJSONArrayByReadPath(dataApi.getApi_response(), "$.result").getJSONObject(0).getString("ruleId"); ruldId = XMJSONPath.getJSONArrayByReadPath(dataApi.getApi_response(), "$.result").getJSONObject(0).getString("ruleId");
//获取训练营活动已排课课次数 //获取训练营活动已排课课次数
...@@ -116,8 +116,8 @@ public class TestEditCampScheduleItem extends SelectTargetTrainingCampAndGetInfo ...@@ -116,8 +116,8 @@ public class TestEditCampScheduleItem extends SelectTargetTrainingCampAndGetInfo
} }
@Test(description = "编辑当前及后续课次", priority = 1) @Test(description = "编辑当前及后续课次",dependsOnMethods = {"testEditCurrentCampSchedule"},alwaysRun=true)
public void testEditCurrentAndSubsequentCampSchedule() { public void testEditCurrentAndSubsequentCampSchedule() throws InterruptedException {
//获取存量场地 //获取存量场地
List<String> venueAreaIds = groupScheduleTools.getStockArea("流星花园秘密基地"); List<String> venueAreaIds = groupScheduleTools.getStockArea("流星花园秘密基地");
//获取下下周二的课次ID //获取下下周二的课次ID
...@@ -179,8 +179,9 @@ public class TestEditCampScheduleItem extends SelectTargetTrainingCampAndGetInfo ...@@ -179,8 +179,9 @@ public class TestEditCampScheduleItem extends SelectTargetTrainingCampAndGetInfo
}); });
} }
//后续检查点check //后续检查点check
Thread.sleep(1000);
//1.查询排课日程:根据训练营查询,应该对应训练营可以查到2条数据,原日程和修改后生成的日程 //1.查询排课日程:根据训练营查询,应该对应训练营可以查到2条数据,原日程和修改后生成的日程
campScheduleTools.getCampRuleScheduleList(campId, "", ""); campScheduleTools.getCampRuleScheduleList(super.campId, super.courseId, "");
Assert.assertTrue(XMJSONPath.getJSONArrayByReadPath(dataApi.getApi_response(), "$.result").size() == 2, "编辑当前及后续课次成功后,日程中没查询到2条对应数据"); Assert.assertTrue(XMJSONPath.getJSONArrayByReadPath(dataApi.getApi_response(), "$.result").size() == 2, "编辑当前及后续课次成功后,日程中没查询到2条对应数据");
//1.1获取到新生成的排课日程ID //1.1获取到新生成的排课日程ID
//过滤出刚创建的日程 //过滤出刚创建的日程
......
...@@ -64,7 +64,7 @@ public class TestGetCampScheduleItemDetail extends SelectTargetTrainingCampAndGe ...@@ -64,7 +64,7 @@ public class TestGetCampScheduleItemDetail extends SelectTargetTrainingCampAndGe
memberId = tools.create("阿杜", phone).getString("result"); memberId = tools.create("阿杜", phone).getString("result");
} }
//给会员报名 //给会员报名
trainingTools.doSignCampOrder(memberId, this.price, this.campId); trainingTools.doSignCampOrder(memberId, this.price, this.campId,"");
orderId = XMJSONPath.readPath(dataApi.getApi_response(), "$.result"); orderId = XMJSONPath.readPath(dataApi.getApi_response(), "$.result");
trainingTools.getTrainingApplyRecordsList(this.campId, phone); trainingTools.getTrainingApplyRecordsList(this.campId, phone);
String memberCardId = XMJSONPath.getJSONArrayByReadPath(dataApi.getApi_response(), "$.result").getJSONObject(0).getString("memberCardId"); String memberCardId = XMJSONPath.getJSONArrayByReadPath(dataApi.getApi_response(), "$.result").getJSONObject(0).getString("memberCardId");
......
package com.xiaomai.cases.polar.schedule.group; package com.xiaomai.cases.polar.schedule.group;
import com.alibaba.druid.util.StringUtils;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.xiaomai.basetest.BaseTestImpl; import com.xiaomai.basetest.BaseTestImpl;
...@@ -97,7 +98,10 @@ public class TestCreateGroupRuleSchedule extends BaseTestImpl { ...@@ -97,7 +98,10 @@ public class TestCreateGroupRuleSchedule extends BaseTestImpl {
.map(e -> e.getString("scheduleId"))//获取scheduleId .map(e -> e.getString("scheduleId"))//获取scheduleId
.findFirst().orElse(null); .findFirst().orElse(null);
Assert.assertTrue(scheduleId!=null||!scheduleId.isEmpty(),"刚创建的规则中,没查询到今天对应的课次"); // Assert.assertTrue(scheduleId!=null||!scheduleId.isEmpty(),"刚创建的规则中,没查询到今天对应的课次");//你这个判断,如果scheduleID != null 不成立,就会走到 !scheduleId.isEmpty(),此时shcdueId是null,使用.isEmpry就空指针了
Assert.assertTrue(!StringUtils.isEmpty(scheduleId),"刚创建的规则中,没查询到今天对应的课次");
//创建今日待上课的排课后查询今日待上课的数据 //创建今日待上课的排课后查询今日待上课的数据
long num= homeTools.queryTodaySchedule().getJSONArray("result").toJavaList(JSONObject.class).stream() long num= homeTools.queryTodaySchedule().getJSONArray("result").toJavaList(JSONObject.class).stream()
......
...@@ -40,7 +40,7 @@ public class TestDelGroupScheduleItem extends UniversalDataScheduling { ...@@ -40,7 +40,7 @@ public class TestDelGroupScheduleItem extends UniversalDataScheduling {
//获取下周四的课次ID(匹配到刚创建的规则ID) //获取下周四的课次ID(匹配到刚创建的规则ID)
Set<String> scheduleIds = groupScheduleTools.getTableDate(10,groupRuldId); Set<String> scheduleIds = groupScheduleTools.getTableDate(10,groupRuldId);
//如果课次ID有值则继续走删除的case //如果课次ID有值则继续走删除的case
if (!scheduleIds.isEmpty()) { if (scheduleIds!= null && scheduleIds.size() != 0) {
scheduleIds.stream().forEach(scheduleId -> { scheduleIds.stream().forEach(scheduleId -> {
JSONObject body = new JSONObject(); JSONObject body = new JSONObject();
body.put("operatorId", xmAppApi.getLoginInfo().getAdminId()); body.put("operatorId", xmAppApi.getLoginInfo().getAdminId());
...@@ -62,12 +62,12 @@ public class TestDelGroupScheduleItem extends UniversalDataScheduling { ...@@ -62,12 +62,12 @@ public class TestDelGroupScheduleItem extends UniversalDataScheduling {
} }
@Test(description = "删除当前及后续课次", priority = 1) @Test(description = "删除当前及后续课次", dependsOnMethods = {"testDelCurrentGroupSchedule"},alwaysRun = true)
public void testDelCurrentAndSubsequentGroupSchedule() { public void testDelCurrentAndSubsequentGroupSchedule() {
//获取下周三的课次ID(匹配到对应的规则ID) //获取下周三的课次ID(匹配到对应的规则ID)
Set<String> scheduleIds = groupScheduleTools.getTableDate(9,groupRuldId); Set<String> scheduleIds = groupScheduleTools.getTableDate(9,groupRuldId);
//如果课次ID有值则继续走删除的case //如果课次ID有值则继续走删除的case
if (!scheduleIds.isEmpty()) { if (scheduleIds!= null && scheduleIds.size() != 0) {
scheduleIds.stream().forEach(scheduleId -> { scheduleIds.stream().forEach(scheduleId -> {
JSONObject body = new JSONObject(); JSONObject body = new JSONObject();
body.put("operatorId", xmAppApi.getLoginInfo().getAdminId()); body.put("operatorId", xmAppApi.getLoginInfo().getAdminId());
......
...@@ -44,7 +44,7 @@ public class TestEditGroupSchedule extends UniversalDataScheduling { ...@@ -44,7 +44,7 @@ public class TestEditGroupSchedule extends UniversalDataScheduling {
//获取下周四的课次ID(匹配到刚创建的规则ID) //获取下周四的课次ID(匹配到刚创建的规则ID)
scheduleIdsN = groupScheduleTools.getTableDate(10,groupRuldId); scheduleIdsN = groupScheduleTools.getTableDate(10,groupRuldId);
//如果课次ID有值则继续走删除的case //如果课次ID有值则继续走删除的case
if (!scheduleIdsN.isEmpty()) { if ( scheduleIdsN!= null && scheduleIdsN.size() != 0) {
scheduleIdsN.stream().forEach(scheduleId -> { scheduleIdsN.stream().forEach(scheduleId -> {
JSONObject body = new JSONObject(); JSONObject body = new JSONObject();
body.put("operatorId", xmAppApi.getLoginInfo().getAdminId()); body.put("operatorId", xmAppApi.getLoginInfo().getAdminId());
...@@ -87,12 +87,12 @@ public class TestEditGroupSchedule extends UniversalDataScheduling { ...@@ -87,12 +87,12 @@ public class TestEditGroupSchedule extends UniversalDataScheduling {
} }
@Test(description = "编辑当前及后续课次", priority = 1) @Test(description = "编辑当前及后续课次", dependsOnMethods = {"testEditCurrentGroupSchedule"},alwaysRun=true)
public void testEditCurrentAndSubsequentGroupSchedule() { public void testEditCurrentAndSubsequentGroupSchedule() {
//获取下周二的课次ID(匹配到刚创建的规则ID) //获取下周二的课次ID(匹配到刚创建的规则ID)
Set<String> scheduleIds = groupScheduleTools.getTableDate(8,groupRuldId); Set<String> scheduleIds = groupScheduleTools.getTableDate(8,groupRuldId);
//如果课次ID有值则继续走编辑的case //如果课次ID有值则继续走编辑的case
if (!scheduleIds.isEmpty()) { if (scheduleIds!= null && scheduleIds.size() != 0) {
scheduleIds.stream().forEach(scheduleId -> { scheduleIds.stream().forEach(scheduleId -> {
JSONObject body = new JSONObject(); JSONObject body = new JSONObject();
body.put("operatorId", xmAppApi.getLoginInfo().getAdminId()); body.put("operatorId", xmAppApi.getLoginInfo().getAdminId());
...@@ -129,7 +129,7 @@ public class TestEditGroupSchedule extends UniversalDataScheduling { ...@@ -129,7 +129,7 @@ public class TestEditGroupSchedule extends UniversalDataScheduling {
//查看下周三课次是否同步被修改 //查看下周三课次是否同步被修改
Set<String> scheduleIdX = groupScheduleTools.getTableDate(9,newGroupRuldId); Set<String> scheduleIdX = groupScheduleTools.getTableDate(9,newGroupRuldId);
String startStamp2 = CommUtil.getWholeHourTimeStamp(9,"13:00"); String startStamp2 = CommUtil.getWholeHourTimeStamp(9,"13:00");
if (!scheduleIdX.isEmpty()) { if (scheduleIdX!= null && scheduleIdX.size() != 0) {
scheduleIdX.stream().forEach(scheduleId1 -> { scheduleIdX.stream().forEach(scheduleId1 -> {
//编辑成功后check同规则中下周三课次详情修改内容是否同步成功 //编辑成功后check同规则中下周三课次详情修改内容是否同步成功
checkData(scheduleId1,startStamp2); checkData(scheduleId1,startStamp2);
...@@ -142,7 +142,7 @@ public class TestEditGroupSchedule extends UniversalDataScheduling { ...@@ -142,7 +142,7 @@ public class TestEditGroupSchedule extends UniversalDataScheduling {
//获取下周一的课次ID,查看下周一课次是否还是原来的(没被修改,还是原来的规则) //获取下周一的课次ID,查看下周一课次是否还是原来的(没被修改,还是原来的规则)
Set<String> scheduleId1 = groupScheduleTools.getTableDate(7,groupRuldId); Set<String> scheduleId1 = groupScheduleTools.getTableDate(7,groupRuldId);
String startStamp3=CommUtil.getWholeHourTimeStamp(7,"13:00"); String startStamp3=CommUtil.getWholeHourTimeStamp(7,"13:00");
if (!scheduleId1.isEmpty()) { if (scheduleId1!= null && scheduleId1.size() != 0) {
scheduleId1.stream().forEach(scheduleId0 -> { scheduleId1.stream().forEach(scheduleId0 -> {
//编辑成功后check同规则中下周一课次详情 //编辑成功后check同规则中下周一课次详情
groupScheduleTools.getScheduleItemDetail(scheduleId0); groupScheduleTools.getScheduleItemDetail(scheduleId0);
......
...@@ -5,6 +5,7 @@ import com.xiaomai.enums.ApiModule; ...@@ -5,6 +5,7 @@ import com.xiaomai.enums.ApiModule;
import com.xiaomai.enums.LoginAccount; import com.xiaomai.enums.LoginAccount;
import com.xiaomai.enums.RequestType; import com.xiaomai.enums.RequestType;
import com.xiaomai.enums.Terminal; import com.xiaomai.enums.Terminal;
import com.xiaomai.utils.CommUtil;
import com.xiaomai.utils.RandomStringUtil; import com.xiaomai.utils.RandomStringUtil;
import com.xiaomai.utils.XMJSONPath; import com.xiaomai.utils.XMJSONPath;
import org.testng.Assert; import org.testng.Assert;
...@@ -13,6 +14,8 @@ import org.testng.annotations.BeforeClass; ...@@ -13,6 +14,8 @@ import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
/** /**
* 对报名中的活动操作立即成营 * 对报名中的活动操作立即成营
...@@ -38,10 +41,10 @@ public class TestDoForceOpenTraining extends BaseCreateTrainingData { ...@@ -38,10 +41,10 @@ public class TestDoForceOpenTraining extends BaseCreateTrainingData {
public void testForceOpenTraining() throws InterruptedException { public void testForceOpenTraining() throws InterruptedException {
//1.创建训练营活动:保存并发布 //1.创建训练营活动:保存并发布
id = trainingTools.createThenPublishTraining(String.valueOf(currentTimestamp + 30000), applyEndTime, courseId, openStartDate, id = trainingTools.createThenPublishTraining(CommUtil.getTodayGoalTime(20), applyEndTime, courseId, openStartDate,
openEndDate, 0.01, trainingTitle, 2, 1, trainerListIdS, "YES"); openEndDate, 0.01, trainingTitle, 2, 1, trainerListIdS, "YES");
if (id.isEmpty()) { if (id.isEmpty()) {
id = trainingTools.createThenPublishTraining(String.valueOf(currentTimestamp + 30000), applyEndTime, courseId, openStartDate, id = trainingTools.createThenPublishTraining(CommUtil.getTodayGoalTime(20), applyEndTime, courseId, openStartDate,
openEndDate, 0.01, trainingTitle + RandomStringUtil.randomString(3), 2, 1, trainerListIdS, "YES"); openEndDate, 0.01, trainingTitle + RandomStringUtil.randomString(3), 2, 1, trainerListIdS, "YES");
} }
//2.查看活动详情,check 活动状态 //2.查看活动详情,check 活动状态
...@@ -66,18 +69,29 @@ public class TestDoForceOpenTraining extends BaseCreateTrainingData { ...@@ -66,18 +69,29 @@ public class TestDoForceOpenTraining extends BaseCreateTrainingData {
Assert.assertTrue(XMJSONPath.getJSONArrayByReadPath(dataApi.getApi_response(), "$.result").size() > 0, "活动创建后,根据活动名称全局搜索没有数据"); Assert.assertTrue(XMJSONPath.getJSONArrayByReadPath(dataApi.getApi_response(), "$.result").size() > 0, "活动创建后,根据活动名称全局搜索没有数据");
Thread.sleep(20000);//延迟20秒后,活动达到报名时间(可能状态没同步,定时任务没到时间执行,但是数据库中已是报名中)
//4.对报名中的活动操作立即成营 //4.对报名中的活动操作立即成营
//搜索列表中有没有报名中APPLYING的训练营,如果有,就操作立即成营
List<String> statuApplying = new ArrayList<>();
statuApplying.add("APPLYING");//报名中
trainingTools.searchTrainingList("","",statuApplying);
String goalId="";
int goalN= XMJSONPath.getJSONArrayByReadPath(dataApi.getApi_response(),"$.result.records").size();
if(goalN>0){
goalId=XMJSONPath.readPath(dataApi.getApi_response(),"$.result.records[0].id");
JSONObject body1 = new JSONObject(); JSONObject body1 = new JSONObject();
body1.put("operatorId", dataApi.getLoginInfo().getAdminId()); body1.put("operatorId", dataApi.getLoginInfo().getAdminId());
body1.put("studioId", dataApi.getLoginInfo().getStudioId()); body1.put("studioId", dataApi.getLoginInfo().getStudioId());
body1.put("brandId", dataApi.getLoginInfo().getBrandId()); body1.put("brandId", dataApi.getLoginInfo().getBrandId());
body1.put("id", id); body1.put("id", goalId);
xmAppApi.doRequest(RequestType.JSON, params, body1.toString(), headers).assetsSuccess(true); xmAppApi.doRequest(RequestType.JSON, params, body1.toString(), headers).assetsSuccess(true);
} }
}
@AfterTest(description = "删除此case创建的训练营活动") @AfterTest(description = "删除此case创建的训练营活动")
public void delData() { public void delData() {
if (!id.isEmpty()) { if (!id.isEmpty()) {
......
...@@ -53,7 +53,7 @@ public class TestDoSignCampOrder extends SelectTargetTrainingCampAndGetInfo { ...@@ -53,7 +53,7 @@ public class TestDoSignCampOrder extends SelectTargetTrainingCampAndGetInfo {
memberId = tools.create("阿杜", phone).getString("result"); memberId = tools.create("阿杜", phone).getString("result");
} }
//给会员报名 //给会员报名
trainingTools.doSignCampOrder(memberId, this.price, this.campId); trainingTools.doSignCampOrder(memberId, this.price, this.campId,"");
Thread.sleep(1000); Thread.sleep(1000);
//报名成功后根据会员手机号,在报名会员列表搜索报名数据 //报名成功后根据会员手机号,在报名会员列表搜索报名数据
trainingTools.getTrainingApplyRecordsList(this.campId, phone); trainingTools.getTrainingApplyRecordsList(this.campId, phone);
......
...@@ -5,6 +5,7 @@ import com.xiaomai.enums.ApiModule; ...@@ -5,6 +5,7 @@ import com.xiaomai.enums.ApiModule;
import com.xiaomai.enums.LoginAccount; import com.xiaomai.enums.LoginAccount;
import com.xiaomai.enums.RequestType; import com.xiaomai.enums.RequestType;
import com.xiaomai.enums.Terminal; import com.xiaomai.enums.Terminal;
import com.xiaomai.utils.CommUtil;
import com.xiaomai.utils.RandomStringUtil; import com.xiaomai.utils.RandomStringUtil;
import com.xiaomai.utils.XMJSONPath; import com.xiaomai.utils.XMJSONPath;
import org.testng.Assert; import org.testng.Assert;
...@@ -86,56 +87,55 @@ public class TestEditTraining extends BaseCreateTrainingData { ...@@ -86,56 +87,55 @@ public class TestEditTraining extends BaseCreateTrainingData {
} }
@Test(description = "编辑已发布训练营活动",priority = 1) @Test(description = "编辑已发布训练营活动", priority = 1)
public void editPublishTraining() throws InterruptedException { public void editPublishTraining() throws InterruptedException {
//1.查询关联对应课程的活动数据 //1.查询关联对应课程的活动数据
trainingTools.searchTrainingList(courseId, "",new ArrayList<>()); trainingTools.searchTrainingList(courseId, "", new ArrayList<>());
int listCountBefore = XMJSONPath.getJSONArrayByReadPath(dataApi.getApi_response(), "$.result.records").size(); int listCountBefore = XMJSONPath.getJSONArrayByReadPath(dataApi.getApi_response(), "$.result.records").size();
//2.创建已发布的训练营活动 //2.创建已发布的训练营活动,报名开始时间晚于当前时间半小时
oneKeytTrainingId = trainingTools.oneKeyCreateTraining(courseId, trainerListIdS); oneKeytTrainingId = trainingTools.oneKeyCreateTraining(courseId, trainerListIdS, CommUtil.getTodayGoalTime(30));
Thread.sleep(2000); Thread.sleep(2000);
//3.列表搜索数据check //3.列表搜索数据check
trainingTools.searchTrainingList(courseId,"", new ArrayList<>()); trainingTools.searchTrainingList(courseId, "", new ArrayList<>());
int listCountAfter = XMJSONPath.getJSONArrayByReadPath(dataApi.getApi_response(), "$.result.records").size(); Long list = XMJSONPath.getJSONArrayByReadPath(dataApi.getApi_response(), "$.result.records").toJavaList(JSONObject.class).stream()
Assert.assertEquals(listCountAfter, (listCountBefore + 1), "训练营活动创建成功列表数据没增加"); .filter(object -> object.getString("id").equals(oneKeytTrainingId)).count();
/* List<JSONObject> list=XMJSONPath.getJSONArrayByReadPath(dataApi.getApi_response(), "$.result.records").toJavaList(JSONObject.class).stream() Assert.assertTrue(list == 1, "训练营活动创建成功列表数据没增加");
.filter(object -> object.getString("id").equals(oneKeytTrainingId)).collect(Collectors.toList()); */
JSONObject goalObject = XMJSONPath.getJSONArrayByReadPath(dataApi.getApi_response(), "$.result.records").toJavaList(JSONObject.class).stream() JSONObject goalObject = XMJSONPath.getJSONArrayByReadPath(dataApi.getApi_response(), "$.result.records").toJavaList(JSONObject.class).stream()
.filter(object -> object.getString("id").equals(oneKeytTrainingId)).findFirst().orElse(null);//返回第一个对象,没有就返回空 .filter(object -> object.getString("id").equals(oneKeytTrainingId)).findFirst().orElse(null);//返回第一个对象,没有就返回空
if(goalObject!=null){ if (goalObject != null) {
String title=goalObject.getString("title"); String title = goalObject.getString("title");
String applyEndTime=goalObject.getString("applyEndTime"); String applyEndTime = goalObject.getString("applyEndTime");
String applyStartTime=goalObject.getString("applyStartTime"); String applyStartTime = goalObject.getString("applyStartTime");
String openStartDate=goalObject.getString("openStartDate"); String openStartDate = goalObject.getString("openStartDate");
String openEndDate=goalObject.getString("openEndDate"); String openEndDate = goalObject.getString("openEndDate");
//4.编辑已发布的活动(训练营名称,关联课程,开营时间,总课次数,售价,报名开始时间,报名结束时间不能修改)check不能修改的传值后也不会改变 //4.编辑已发布的活动(训练营名称,关联课程,开营时间,总课次数,售价,报名开始时间,报名结束时间不能修改)check不能修改的传值后也不会改变
JSONObject editBody = new JSONObject(); JSONObject editBody = new JSONObject();
editBody.put("operatorId", xmAppApi.getLoginInfo().getAdminId()); editBody.put("operatorId", xmAppApi.getLoginInfo().getAdminId());
editBody.put("studioId", xmAppApi.getLoginInfo().getStudioId()); // 场馆 editBody.put("studioId", xmAppApi.getLoginInfo().getStudioId()); // 场馆
editBody.put("brandId", xmAppApi.getLoginInfo().getBrandId()); editBody.put("brandId", xmAppApi.getLoginInfo().getBrandId());
editBody.put("applyEndTime", applyEndTime);//报名结束时间 editBody.put("applyEndTime", applyEndTime);//报名结束时间
editBody.put("applyStartTime",applyStartTime );//报名开始时间 editBody.put("applyStartTime", applyStartTime);//报名开始时间
editBody.put("courseId", courseId); //关联课程ID editBody.put("courseId", courseId); //关联课程ID
editBody.put("creatorId", xmAppApi.getLoginInfo().getAdminId()); // 创建人即操作者 editBody.put("creatorId", xmAppApi.getLoginInfo().getAdminId()); // 创建人即操作者
editBody.put("openEndDate", openEndDate); //开营结束时间 editBody.put("openEndDate", openEndDate); //开营结束时间
editBody.put("openStartDate", openStartDate); //开营开始时间 editBody.put("openStartDate", openStartDate); //开营开始时间
editBody.put("price", 10); //售卖价格 editBody.put("price", 10); //售卖价格
editBody.put("surfaceUrl", "https://xiaomai-res.oss-cn-hangzhou.aliyuncs.com/xmfit/course_cover/training_camp_0.png"); // 默认活动封面图 editBody.put("surfaceUrl", "https://xiaomai-res.oss-cn-hangzhou.aliyuncs.com/xmfit/course_cover/training_camp_0.png"); // 默认活动封面图
editBody.put("title","title" );//名称不能修改,这里故意修改了,等保存后check数据 editBody.put("title", "title");//名称不能修改,这里故意修改了,等保存后check数据
editBody.put("totalClassHour", 20); // 总课时数,不能修改,这里故意修改了,等保存后check数据 editBody.put("totalClassHour", 20); // 总课时数,不能修改,这里故意修改了,等保存后check数据
editBody.put("traineeLowerLimit", 1); // 开营人数 editBody.put("traineeLowerLimit", 1); // 开营人数
editBody.put("traineeUpperLimit", 99); // 人数上限 editBody.put("traineeUpperLimit", 99); // 人数上限
editBody.put("trainerList", trainerListIdS); // 上课教练 editBody.put("trainerList", trainerListIdS); // 上课教练
editBody.put("xcxSaleStatus", "YES"); //开启小程序售卖 editBody.put("xcxSaleStatus", "YES"); //开启小程序售卖
editBody.put("underlinePrice", 29.9);//可以修改 editBody.put("underlinePrice", 29.9);//可以修改
editBody.put("id",oneKeytTrainingId); //活动ID editBody.put("id", oneKeytTrainingId); //活动ID
xmAppApi.doRequest(RequestType.JSON, params, editBody.toString(), headers).assetsSuccess(true); xmAppApi.doRequest(RequestType.JSON, params, editBody.toString(), headers).assetsSuccess(true);
//5.查看活动详情,check 不能修改项和一修改项是否被同步修改 //5.查看活动详情,check 不能修改项和一修改项是否被同步修改
trainingTools.findTrainingDetailById(oneKeytTrainingId); trainingTools.findTrainingDetailById(oneKeytTrainingId);
//5.1不能修改的字段check(修改后和修改前比对) //5.1不能修改的字段check(修改后和修改前比对)
Assert.assertEquals(XMJSONPath.readPath(dataApi.getApi_response(),"$.result.title"),title); Assert.assertEquals(XMJSONPath.readPath(dataApi.getApi_response(), "$.result.title"), title);
Assert.assertEquals(XMJSONPath.readPath(dataApi.getApi_response(),"$.result.totalClassHour"),"2"); Assert.assertEquals(XMJSONPath.readPath(dataApi.getApi_response(), "$.result.totalClassHour"), "2");
Assert.assertEquals(Double.valueOf(XMJSONPath.readPath(dataApi.getApi_response(), "$.result.price")), 0.00); Assert.assertEquals(Double.valueOf(XMJSONPath.readPath(dataApi.getApi_response(), "$.result.price")), 0.00);
//5.2可以修改字段check是否被同步修改 //5.2可以修改字段check是否被同步修改
Assert.assertEquals(Double.valueOf(XMJSONPath.readPath(dataApi.getApi_response(), "$.result.underlinePrice")), 29.90); Assert.assertEquals(Double.valueOf(XMJSONPath.readPath(dataApi.getApi_response(), "$.result.underlinePrice")), 29.90);
......
...@@ -46,7 +46,7 @@ public class TestSearchTrainingAccountRecordsList extends SelectTargetTrainingCa ...@@ -46,7 +46,7 @@ public class TestSearchTrainingAccountRecordsList extends SelectTargetTrainingCa
memberId = tools.create("自动化报名训练营的潜在学员", phone).getString("result"); memberId = tools.create("自动化报名训练营的潜在学员", phone).getString("result");
} }
//给会员报名 //给会员报名
trainingTools.doSignCampOrder(memberId, this.price, this.campId); trainingTools.doSignCampOrder(memberId, this.price, this.campId,"");
orderId = XMJSONPath.readPath(dataApi.getApi_response(), "$.result"); orderId = XMJSONPath.readPath(dataApi.getApi_response(), "$.result");
} }
......
...@@ -85,7 +85,7 @@ public class TestSignWaitingCampOrder extends SelectTargetTrainingCampAndGetInfo ...@@ -85,7 +85,7 @@ public class TestSignWaitingCampOrder extends SelectTargetTrainingCampAndGetInfo
Thread.sleep(3000); Thread.sleep(3000);
//再次报名该训练营活动-报名成功 //再次报名该训练营活动-报名成功
trainingTools.doSignCampOrder(memberId, this.price, this.campId); trainingTools.doSignCampOrder(memberId, this.price, this.campId,"");
String orderId1 = XMJSONPath.readPath(dataApi.getApi_response(), "$.result"); String orderId1 = XMJSONPath.readPath(dataApi.getApi_response(), "$.result");
//报名成功后根据会员手机号,在报名会员列表搜索报名数据 //报名成功后根据会员手机号,在报名会员列表搜索报名数据
...@@ -98,7 +98,7 @@ public class TestSignWaitingCampOrder extends SelectTargetTrainingCampAndGetInfo ...@@ -98,7 +98,7 @@ public class TestSignWaitingCampOrder extends SelectTargetTrainingCampAndGetInfo
//订单作废后,学员还能继续报名check //订单作废后,学员还能继续报名check
Thread.sleep(3000); Thread.sleep(3000);
trainingTools.doSignCampOrder(memberId, this.price, this.campId); trainingTools.doSignCampOrder(memberId, this.price, this.campId,"");
String orderId2 = XMJSONPath.readPath(dataApi.getApi_response(), "$.result"); String orderId2 = XMJSONPath.readPath(dataApi.getApi_response(), "$.result");
//继续作废订单,然后删除训练营活动 //继续作废订单,然后删除训练营活动
......
...@@ -131,6 +131,45 @@ public class TrainingTools extends XMBaseTest { ...@@ -131,6 +131,45 @@ public class TrainingTools extends XMBaseTest {
} }
/** /**
* 引用时可以继承 BaseCreateTrainingData 这个类,然后直接传值就可以
* 价格0元,一键创建已发布且报名中的训练营活动
*@param applyStartTime 报名开始时间,要早于第二天的0点,最好是晚于当前时间半个小时
* @param courseId 需要传入课程ID
* @param trainerList 需要传入教练
* @return 活动ID
*/
public String oneKeyCreateTraining(String courseId, List<String> trainerList,String applyStartTime) {
setUP("API_createThenPublishTraining");
String courseName = "训练营课程-感统课";
String trainingTitle = "三期36天训练营感统课" + RandomStringUtil.randomString(5);
JSONObject body = new JSONObject();
body.put("operatorId", dataApi.getLoginInfo().getAdminId());
body.put("studioId", dataApi.getLoginInfo().getStudioId()); // 场馆
body.put("brandId", dataApi.getLoginInfo().getBrandId());
body.put("applyEndTime", applyEndTime1);//报名结束时间
body.put("applyStartTime", applyStartTime);//报名开始时间
body.put("courseId", courseId); //关联课程ID
body.put("creatorId", dataApi.getLoginInfo().getAdminId()); // 创建人即操作者
body.put("openEndDate", openEndDate0); //开营结束时间
body.put("openStartDate", openStartDate0); //开营开始时间
body.put("price", 0); //售卖价格
body.put("surfaceUrl", "https://xiaomai-res.oss-cn-hangzhou.aliyuncs.com/xmfit/course_cover/training_camp_0.png"); // 默认活动封面图
body.put("title", trainingTitle);
body.put("totalClassHour", 2); // 总课次数
body.put("traineeLowerLimit", 1); // 开营人数
body.put("traineeUpperLimit", 99); // 人数上限
body.put("trainerList", trainerList); // 上课教练
body.put("xcxSaleStatus", "YES"); //开启小程序售卖
body.put("underlinePrice", 19.9); //划线价
//图文介绍不设置,所以回归时check下 图文介绍
dataApi.doRequest(RequestType.JSON, dataparams, body.toString(), dataheadrs).assetsSuccess(true);
return XMJSONPath.readPath(dataApi.getApi_response(), "$.result");
}
/**
* 提供训练营活动名称,课程ID和教练ID 快速创建未发布的活动 * 提供训练营活动名称,课程ID和教练ID 快速创建未发布的活动
* *
* @param title 训练营活动名称,可以传空,有默认值 * @param title 训练营活动名称,可以传空,有默认值
...@@ -300,13 +339,17 @@ public class TrainingTools extends XMBaseTest { ...@@ -300,13 +339,17 @@ public class TrainingTools extends XMBaseTest {
* @param memberId 会员ID * @param memberId 会员ID
* @param receivableAmount 支付金额 * @param receivableAmount 支付金额
* @param campId 训练营活动ID * @param campId 训练营活动ID
* @param userCouponId 已发放给学员的优惠券记录ID
*/ */
public void doSignCampOrder(String memberId,Double receivableAmount,String campId){ public void doSignCampOrder(String memberId,Double receivableAmount,String campId,String userCouponId){
setUP("API_signOrderCamp"); setUP("API_signOrderCamp");
JSONObject body = new JSONObject(); JSONObject body = new JSONObject();
body.put("operatorId", dataApi.getLoginInfo().getAdminId()); body.put("operatorId", dataApi.getLoginInfo().getAdminId());
body.put("studioId", dataApi.getLoginInfo().getStudioId()); body.put("studioId", dataApi.getLoginInfo().getStudioId());
body.put("brandId", dataApi.getLoginInfo().getBrandId()); body.put("brandId", dataApi.getLoginInfo().getBrandId());
if(userCouponId!=null||!userCouponId.isEmpty()){
body.put("userCouponId", userCouponId);
}
body.put("salesmanId",dataApi.getLoginInfo().getAdminId()); body.put("salesmanId",dataApi.getLoginInfo().getAdminId());
body.put("operationTime", TimeUtils.getCurrentTime()); body.put("operationTime", TimeUtils.getCurrentTime());
......
...@@ -279,7 +279,7 @@ public class CommUtil { ...@@ -279,7 +279,7 @@ public class CommUtil {
} }
/** /**
* *获取指定时间的整点
* @param n 整数 * @param n 整数
* @param time 整点时间 比如13:00 * @param time 整点时间 比如13:00
* @return * @return
...@@ -346,9 +346,20 @@ public class CommUtil { ...@@ -346,9 +346,20 @@ public class CommUtil {
return getStringTimestamp(getNextXWeekEndXDayDataS, "yyyy-MM-dd HH:mm:ss"); return getStringTimestamp(getNextXWeekEndXDayDataS, "yyyy-MM-dd HH:mm:ss");
} }
/**
* 晚于当前时间 多少分钟
* @param minutes 分钟
* @return
*/
public static String getTodayGoalTime(int minutes){
Date getNextXWeekStartDayData= new DateTime(now).plusMinutes(minutes).toDate();
String getNextXWeekStartXDayDataS = getFormatTimeStr(getNextXWeekStartDayData, "yyyy-MM-dd HH:mm:ss");//时间格式转化为string
return getStringTimestamp(getNextXWeekStartXDayDataS, "yyyy-MM-dd HH:mm:ss");
}
public static void main(String[] args) { public static void main(String[] args) {
getWholeHourTimestamp(); /* getWholeHourTimestamp();
Date getWeekStartDayData = getStartOfDateWeek(now);//获取本周的第一天 Date getWeekStartDayData = getStartOfDateWeek(now);//获取本周的第一天
Date getNextWeekXDayData=addNDays(getWeekStartDayData,9); Date getNextWeekXDayData=addNDays(getWeekStartDayData,9);
String getNextWeekXDayDataS = new SimpleDateFormat("yyyy-MM-dd").format(getNextWeekXDayData.getTime()); String getNextWeekXDayDataS = new SimpleDateFormat("yyyy-MM-dd").format(getNextWeekXDayData.getTime());
...@@ -372,7 +383,11 @@ public class CommUtil { ...@@ -372,7 +383,11 @@ public class CommUtil {
LocalDateTime future = now.plusSeconds(2); LocalDateTime future = now.plusSeconds(2);
System.out.println("未来2秒时间: " + future); System.out.println("未来2秒时间: " + future);
System.out.println("%%%%%"+getXEndOfDateNextXWeek(-1,2)); System.out.println("%%%%%"+getXEndOfDateNextXWeek(-1,2));*/
Date getNextXWeekStartDayData= new DateTime(now).plusMinutes(30).toDate();
String getNextXWeekStartXDayDataS = getFormatTimeStr(getNextXWeekStartDayData, "yyyy-MM-dd HH:mm:ss");//时间格式转化为string
System.out.println( "((((((("+getStringTimestamp(getNextXWeekStartXDayDataS, "yyyy-MM-dd HH:mm:ss"));
......
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