Commit 30aac9aa by yangjian

会员积分-部分

parent 77770012
package com.xiaomai.cases.polar.points;
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;
@Component("pointsMinTools")//小程序会员积分工具类
public class PointsMInTools extends XMBaseTest {
public void setUp(String name, DataUserInfo...dataUserInfo) {
dataApi.setApiModule(ApiModule.Lunar_Points)
.setApiName(name)
.setTerminal(Terminal.B);//这个到时候要改
}
/**
* @param
* @description:小程序-我的-获取积分
* @author: yangjian
* @param memberId 会员id
**/
public JSONObject memberPoint_getAccount(String memberId, DataUserInfo... dataUserInfos) {
dataApi.setApiModule(ApiModule.Lunar_Points)
.setApiName("API_memberPoint_getAccount")
.setTerminal(Terminal.B);
super.beforeDataRequest(dataUserInfos);
JSONObject jsonObject = new JSONObject();
jsonObject.put("memberId", memberId);
jsonObject.put("brandId", dataApi.getLoginInfo().getBrandId());
dataApi.doRequest(RequestType.JSON, dataparams, jsonObject.toJSONString(), dataheadrs).assetsSuccess(true);
JSONObject response = dataApi.getBodyInJSON();
return response;
}
/**
* @param
* @description:小程序-我的-获取积分
* @author: yangjian
* @param memberId 会员id
**/
public JSONObject findStatementPage(String memberId,String incTag, DataUserInfo... dataUserInfos) {
dataApi.setApiModule(ApiModule.Lunar_Points)
.setApiName("API_findStatementPage")
.setTerminal(Terminal.B);
super.beforeDataRequest(dataUserInfos);
JSONObject jsonObject = new JSONObject();
jsonObject.put("current", 0);
jsonObject.put("size", 20);
jsonObject.put("memberId", memberId);
jsonObject.put("brandId", dataApi.getLoginInfo().getBrandId());
if (!incTag.equals("")){
jsonObject.put("incTag", incTag);//true为获取tab;false为消耗tab
}
dataApi.doRequest(RequestType.JSON, dataparams, jsonObject.toJSONString(), dataheadrs).assetsSuccess(true);
JSONObject response = dataApi.getBodyInJSON();
return response;
}
}
package com.xiaomai.cases.polar.points;
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;
import java.util.ArrayList;
import java.util.List;
@Component("pointsTools")//B端会员积分工具类
public class PointsTools extends XMBaseTest {
public void setUp(String name, DataUserInfo...dataUserInfo) {
dataApi.setApiModule(ApiModule.Polar_Points)
.setApiName(name)
.setTerminal(Terminal.B);//这个到时候要改
}
/**
* @param
* @description:会员积分帐户列表
* @author: yangjian
* @param studioId 场馆id不传则为品牌端操作
**/
public JSONObject findAccountPagePermission(String studioId,String memberId, DataUserInfo... dataUserInfos) {
dataApi.setApiModule(ApiModule.Polar_Points)
.setApiName("API_findAccountPagePermission")
.setTerminal(Terminal.B);
super.beforeDataRequest(dataUserInfos);
List<String> memberIds = new ArrayList<>();
memberIds.add(memberId);
JSONObject jsonObject = new JSONObject();
jsonObject.put("gtTotalAwardBalance", 0);
jsonObject.put("current", 0);
jsonObject.put("size", 20);
jsonObject.put("sort", "TOTAL_AWARD_BALANCE_DESC");
if (!studioId.equals("")){
jsonObject.put("studioId", studioId);//传studioId则为场馆操作;不传则为品牌操作
}
if (!memberId.equals("")){
jsonObject.put("memberIds", memberIds);//传studioId则为场馆操作;不传则为品牌操作
}
jsonObject.put("brandId", dataApi.getLoginInfo().getBrandId());
jsonObject.put("operatorId", dataApi.getLoginInfo().getAdminId());
dataApi.doRequest(RequestType.JSON, dataparams, jsonObject.toJSONString(), dataheadrs).assetsSuccess(true);
JSONObject response = dataApi.getBodyInJSON();
return response;
}
/**
* @param
* @description:积分记录列表
* @author: yangjian
* @param studioId 场馆id不传则为品牌端操作
**/
public JSONObject findStatementPagePermission(String studioId, DataUserInfo... dataUserInfos) {
dataApi.setApiModule(ApiModule.Polar_Points)
.setApiName("API_findStatementPagePermission")
.setTerminal(Terminal.B);
super.beforeDataRequest(dataUserInfos);
JSONObject jsonObject = new JSONObject();
jsonObject.put("current", 0);
jsonObject.put("size", 20);
jsonObject.put("startCreated", null);
jsonObject.put("endCreated", null);
if (!studioId.equals("")){
jsonObject.put("studioId", dataApi.getLoginInfo().getStudioId());//传studioId则为场馆操作;不传则为品牌操作
}
jsonObject.put("brandId", dataApi.getLoginInfo().getBrandId());
jsonObject.put("operatorId", dataApi.getLoginInfo().getAdminId());
dataApi.doRequest(RequestType.JSON, dataparams, jsonObject.toJSONString(), dataheadrs).assetsSuccess(true);
JSONObject response = dataApi.getBodyInJSON();
return response;
}
/**
* @param
* @description:积分帐户导出
* @author: yangjian
* @param studioId 场馆id不传则为品牌端操作
**/
public JSONObject exportAccount(String studioId, DataUserInfo... dataUserInfos) {
dataApi.setApiModule(ApiModule.Polar_Points)
.setApiName("API_exportAccount")
.setTerminal(Terminal.B);
super.beforeDataRequest(dataUserInfos);
JSONObject jsonObject = new JSONObject();
jsonObject.put("current", 0);
jsonObject.put("size", 20);
jsonObject.put("gtTotalAwardBalance", 0);
jsonObject.put("sort", "TOTAL_AWARD_BALANCE_DESC");
if (!studioId.equals("")){
jsonObject.put("studioId", dataApi.getLoginInfo().getStudioId());//传studioId则为场馆操作;不传则为品牌操作
}
jsonObject.put("brandId", dataApi.getLoginInfo().getBrandId());
jsonObject.put("operatorId", dataApi.getLoginInfo().getAdminId());
dataApi.doRequest(RequestType.JSON, dataparams, jsonObject.toJSONString(), dataheadrs).assetsSuccess(true);
JSONObject response = dataApi.getBodyInJSON();
return response;
}
/**
* @param
* @description:积分记录导出
* @author: yangjian
* @param studioId 场馆id不传则为品牌端操作
**/
public JSONObject exportStatement(String studioId, DataUserInfo... dataUserInfos) {
dataApi.setApiModule(ApiModule.Polar_Points)
.setApiName("API_exportStatement")
.setTerminal(Terminal.B);
super.beforeDataRequest(dataUserInfos);
JSONObject jsonObject = new JSONObject();
if (!studioId.equals("")){
jsonObject.put("studioId", dataApi.getLoginInfo().getStudioId());//传studioId则为场馆操作;不传则为品牌操作
}
jsonObject.put("brandId", dataApi.getLoginInfo().getBrandId());
jsonObject.put("operatorId", dataApi.getLoginInfo().getAdminId());
dataApi.doRequest(RequestType.JSON, dataparams, jsonObject.toJSONString(), dataheadrs).assetsSuccess(true);
JSONObject response = dataApi.getBodyInJSON();
return response;
}
/**
* @param
* @description:获取积分规则
* @author: yangjian
* @param studioId 场馆id不传则为品牌端操作
**/
public JSONObject memberPoint_findRule(String studioId, DataUserInfo... dataUserInfos) {
dataApi.setApiModule(ApiModule.Polar_Points)
.setApiName("API_memberPoint_findRule")
.setTerminal(Terminal.B);
super.beforeDataRequest(dataUserInfos);
JSONObject jsonObject = new JSONObject();
if (!studioId.equals("")){
jsonObject.put("studioId", dataApi.getLoginInfo().getStudioId());//传studioId则为场馆操作;不传则为品牌操作
}
jsonObject.put("brandId", dataApi.getLoginInfo().getBrandId());
jsonObject.put("operatorId", dataApi.getLoginInfo().getAdminId());
dataApi.doRequest(RequestType.JSON, dataparams, jsonObject.toJSONString(), dataheadrs).assetsSuccess(true);
JSONObject response = dataApi.getBodyInJSON();
return response;
}
/**
* @param
* @description:保存积分规则
* @author: yangjian
* @param studioId 场馆id不传则为品牌端操作
**/
public JSONObject memberPoint_saveRule(String studioId, DataUserInfo... dataUserInfos) {
dataApi.setApiModule(ApiModule.Polar_Points)
.setApiName("API_memberPoint_saveRule")
.setTerminal(Terminal.B);
super.beforeDataRequest(dataUserInfos);
String description ="{\"items\":[{\"content\":\"自动化规则说明\",\"type\":\"TEXT\",\"aspect\":\"\"}]}";
JSONObject jsonObject1 = new JSONObject();
jsonObject1.put("ruleType", "BIND_WECHAT");//绑定公众号
jsonObject1.put("state","YES");
jsonObject1.put("fixedPointAmount", "19");
JSONObject jsonObject2 = new JSONObject();
jsonObject2.put("ruleType", "CHECK_IN_GROUP_CLASS");//团课签到
jsonObject2.put("state","YES");
jsonObject2.put("fixedPointAmount", "1");//1积分
jsonObject2.put("fixedPointLimitPerDay", "100");//上限
JSONObject jsonObject3 = new JSONObject();
jsonObject3.put("ruleType", "CHECK_IN_PRIVATE_CLASS");//私教课签到
jsonObject3.put("state","YES");
jsonObject3.put("fixedPointAmount", "2");//2积分
jsonObject3.put("fixedPointLimitPerDay", "100");//上限
JSONObject jsonObject4 = new JSONObject();
jsonObject4.put("ruleType", "CHECK_IN_TRAINING_CAMP");//训练营签到
jsonObject4.put("state","YES");
jsonObject4.put("fixedPointAmount", "3");//3积分
jsonObject4.put("fixedPointLimitPerDay", "100");//上限
JSONObject jsonObject5 = new JSONObject();
jsonObject5.put("ruleType", "CHECK_IN_VENUE_ENTRY");//入场签到
jsonObject5.put("state","YES");
jsonObject5.put("fixedPointAmount", "4");//4积分
jsonObject5.put("fixedPointLimitPerDay", "100");//上限
JSONObject jsonObject6 = new JSONObject();
jsonObject6.put("ruleType", "CHECK_IN_VENUE_RESERVE");//约场签到
jsonObject6.put("state","YES");
jsonObject6.put("fixedPointAmount", "5");//5积分
jsonObject6.put("fixedPointLimitPerDay", "100");//上限
JSONObject jsonObject7 = new JSONObject();
jsonObject7.put("ruleType", "SIGN_MEMBER_CARD");//会员卡实付满100,送6积分
jsonObject7.put("state","YES");
jsonObject7.put("accumulativePointAmount", "6");//6积分
jsonObject7.put("accumulativeBizAmount", "100");//满100
JSONObject jsonObject8 = new JSONObject();
jsonObject8.put("ruleType", "REFUND_MEMBER_CARD");//会员卡实退满100,扣7积分
jsonObject8.put("state","YES");
jsonObject8.put("accumulativeBizAmount", "7");//7积分
jsonObject8.put("accumulativePointAmount", "100");
JSONObject jsonObject9 = new JSONObject();
jsonObject9.put("ruleType", "SIGN_DEPOSIT_CARD");//训练营实付满100,送8积分
jsonObject9.put("state","YES");
jsonObject9.put("accumulativePointAmount", "8");//8积分
jsonObject9.put("accumulativeBizAmount", "100");//上限
JSONObject jsonObject10 = new JSONObject();
jsonObject10.put("ruleType", "REFUND_TRAINING_CAMP");//训练营实退满100
jsonObject10.put("state","YES");
jsonObject10.put("accumulativePointAmount", "9");
jsonObject10.put("accumulativeBizAmount", "100");
JSONObject jsonObject11 = new JSONObject();
jsonObject11.put("ruleType", "SIGN_DEPOSIT_CARD");//储值卡实付款满100
jsonObject11.put("state","YES");
jsonObject11.put("accumulativePointAmount", "10");
jsonObject11.put("accumulativeBizAmount", "100");
JSONObject jsonObject12 = new JSONObject();
jsonObject12.put("ruleType", "CHECK_IN_TRAINING_CAMP");//储值卡实退款满100
jsonObject12.put("state","YES");
jsonObject12.put("accumulativePointAmount", "11");
jsonObject12.put("accumulativeBizAmount", "100");
JSONObject jsonObject13 = new JSONObject();
jsonObject13.put("ruleType", "SIGN_EXPERIENCE_CARD");//体验卡实付款满100
jsonObject13.put("state","YES");
jsonObject13.put("accumulativePointAmount", "12");
jsonObject13.put("accumulativeBizAmount", "100");
JSONObject jsonObject14 = new JSONObject();
jsonObject14.put("ruleType", "REFUND_EXPERIENCE_CARD");//体验卡实退款满100
jsonObject14.put("state","YES");
jsonObject14.put("accumulativePointAmount", "13");
jsonObject14.put("accumulativeBizAmount", "100");
JSONObject jsonObject15 = new JSONObject();
jsonObject15.put("ruleType", "SIGN_GOODS");//物品实付款满100
jsonObject15.put("state","YES");
jsonObject15.put("accumulativePointAmount", "14");
jsonObject15.put("accumulativeBizAmount", "100");
JSONObject jsonObject16 = new JSONObject();
jsonObject16.put("ruleType", "REFUND_GOODS");//物品实退款满100
jsonObject16.put("state","YES");
jsonObject16.put("accumulativePointAmount", "15");
jsonObject16.put("accumulativeBizAmount", "100");
JSONObject jsonObject17 = new JSONObject();
jsonObject17.put("ruleType", "SIGN_VENUE_RESERVE");//场地预约实付款满100
jsonObject17.put("state","YES");
jsonObject17.put("accumulativePointAmount", "16");
jsonObject17.put("accumulativeBizAmount", "100");
JSONObject jsonObject18 = new JSONObject();
jsonObject18.put("ruleType", "SIGN_SINGLE_RESERVE");//单次约课实付款满100
jsonObject18.put("state","YES");
jsonObject18.put("accumulativePointAmount", "17");
jsonObject18.put("accumulativeBizAmount", "100");
JSONObject jsonObject19 = new JSONObject();
jsonObject19.put("ruleType", "SIGN_ACTIVITY");//活动报名实付款满100
jsonObject19.put("state","YES");
jsonObject19.put("accumulativePointAmount", "18");
jsonObject19.put("accumulativeBizAmount", "100");
List<JSONObject> ruleItemList = new ArrayList<>();//规则数组
ruleItemList.add(jsonObject1);
ruleItemList.add(jsonObject2);
ruleItemList.add(jsonObject3);
ruleItemList.add(jsonObject4);
ruleItemList.add(jsonObject5);
ruleItemList.add(jsonObject6);
ruleItemList.add(jsonObject7);
ruleItemList.add(jsonObject8);
ruleItemList.add(jsonObject9);
ruleItemList.add(jsonObject10);
ruleItemList.add(jsonObject11);
ruleItemList.add(jsonObject12);
ruleItemList.add(jsonObject13);
ruleItemList.add(jsonObject14);
ruleItemList.add(jsonObject15);
ruleItemList.add(jsonObject16);
ruleItemList.add(jsonObject17);
ruleItemList.add(jsonObject18);
ruleItemList.add(jsonObject19);
JSONObject jsonObject = new JSONObject();
if (!studioId.equals("")){
jsonObject.put("studioId", dataApi.getLoginInfo().getStudioId());//传studioId则为场馆操作;不传则为品牌操作
}
jsonObject.put("brandId", dataApi.getLoginInfo().getBrandId());
jsonObject.put("operatorId", dataApi.getLoginInfo().getAdminId());
jsonObject.put("enableMemberPoint", "YES");//积分功能是否打开
jsonObject.put("memberPointName", "自动化积分");//积分名称
jsonObject.put("ruleItemList", ruleItemList);//积分规则
jsonObject.put("validPeriod", "1");
jsonObject.put("description", description);
dataApi.doRequest(RequestType.JSON, dataparams, jsonObject.toJSONString(), dataheadrs).assetsSuccess(true);
JSONObject response = dataApi.getBodyInJSON();
return response;
}
/**
* @param
* @description:批量增加-积分
* @author: yangjian
* @param studioId 场馆id不传则为品牌端操作
* @param amount 增加的积分数
* @param memberId 增加积分的会员
**/
public JSONObject batchAwardPoint(String amount,String memberId,String studioId, DataUserInfo... dataUserInfos) {
dataApi.setApiModule(ApiModule.Polar_Points)
.setApiName("API_batchAwardPoint")
.setTerminal(Terminal.B);
super.beforeDataRequest(dataUserInfos);
List<String> memberIds = new ArrayList<>();
memberIds.add(memberId);
JSONObject jsonObject = new JSONObject();
jsonObject.put("amount", amount);
jsonObject.put("memberIds", memberIds);
if (!studioId.equals("")){
jsonObject.put("studioId", dataApi.getLoginInfo().getStudioId());//传studioId则为场馆操作;不传则为品牌操作
}
jsonObject.put("brandId", dataApi.getLoginInfo().getBrandId());
jsonObject.put("operatorId", dataApi.getLoginInfo().getAdminId());
jsonObject.put("memo", "自动化积分批量增加");
dataApi.doRequest(RequestType.JSON, dataparams, jsonObject.toJSONString(), dataheadrs).assetsSuccess(true);
JSONObject response = dataApi.getBodyInJSON();
return response;
}
/**
* @param
* @description:批量扣减-积分
* @author: yangjian
* @param studioId 场馆id不传则为品牌端操作
* @param amount 扣减的积分数
* @param memberId 扣减积分的会员
**/
public JSONObject batchDeductPoint(String amount,String memberId,String studioId, DataUserInfo... dataUserInfos) {
dataApi.setApiModule(ApiModule.Polar_Points)
.setApiName("API_batchDeductPoint")
.setTerminal(Terminal.B);
super.beforeDataRequest(dataUserInfos);
List<String> memberIds = new ArrayList<>();
memberIds.add(memberId);
JSONObject jsonObject = new JSONObject();
jsonObject.put("amount", amount);
jsonObject.put("memberIds", memberIds);
if (!studioId.equals("")){
jsonObject.put("studioId", dataApi.getLoginInfo().getStudioId());//传studioId则为场馆操作;不传则为品牌操作
}
jsonObject.put("brandId", dataApi.getLoginInfo().getBrandId());
jsonObject.put("operatorId", dataApi.getLoginInfo().getAdminId());
jsonObject.put("memo", "自动化积分批量增扣减");
dataApi.doRequest(RequestType.JSON, dataparams, jsonObject.toJSONString(), dataheadrs).assetsSuccess(true);
JSONObject response = dataApi.getBodyInJSON();
return response;
}
/**
* @param
* @description:批量清零-积分
* @author: yangjian
* @param studioId 场馆id不传则为品牌端操作
* @param memberId 扣减积分的会员
**/
public JSONObject batchClearPoint(String memberId,String studioId, DataUserInfo... dataUserInfos) {
dataApi.setApiModule(ApiModule.Polar_Points)
.setApiName("API_batchClearPoint")
.setTerminal(Terminal.B);
super.beforeDataRequest(dataUserInfos);
List<String> memberIds = new ArrayList<>();
memberIds.add(memberId);
JSONObject jsonObject = new JSONObject();
jsonObject.put("memberIds", memberIds);
if (!studioId.equals("")){
jsonObject.put("studioId", dataApi.getLoginInfo().getStudioId());//传studioId则为场馆操作;不传则为品牌操作
}
jsonObject.put("brandId", dataApi.getLoginInfo().getBrandId());
jsonObject.put("operatorId", dataApi.getLoginInfo().getAdminId());
jsonObject.put("memo", "自动化积分批量增清零");
dataApi.doRequest(RequestType.JSON, dataparams, jsonObject.toJSONString(), dataheadrs).assetsSuccess(true);
JSONObject response = dataApi.getBodyInJSON();
return response;
}
/**
* @param
* @description:会员详情-增加积分
* @author: yangjian
* @param memberId 增加积分的会员
* @param amount 增加的积分数
**/
public JSONObject manualAwardPoint(String amount,String memberId, DataUserInfo... dataUserInfos) {
dataApi.setApiModule(ApiModule.Polar_Points)
.setApiName("API_manualAwardPoint")
.setTerminal(Terminal.B);
super.beforeDataRequest(dataUserInfos);
JSONObject jsonObject = new JSONObject();
jsonObject.put("amount", amount);
jsonObject.put("memberId", memberId);
jsonObject.put("brandId", dataApi.getLoginInfo().getBrandId());
jsonObject.put("operatorId", dataApi.getLoginInfo().getAdminId());
jsonObject.put("studioId", dataApi.getLoginInfo().getStudioId());
jsonObject.put("memo", "自动化积分学员详情-增加积分");
dataApi.doRequest(RequestType.JSON, dataparams, jsonObject.toJSONString(), dataheadrs).assetsSuccess(true);
JSONObject response = dataApi.getBodyInJSON();
return response;
}
/**
* @param
* @description:会员详情-扣减积分
* @author: yangjian
* @param memberId 扣减积分的会员
* @param amount 扣减的积分数
**/
public JSONObject manualDeductPoint(String amount,String memberId, DataUserInfo... dataUserInfos) {
dataApi.setApiModule(ApiModule.Polar_Points)
.setApiName("API_manualDeductPoint")
.setTerminal(Terminal.B);
super.beforeDataRequest(dataUserInfos);
JSONObject jsonObject = new JSONObject();
jsonObject.put("amount", amount);
jsonObject.put("memberId", memberId);
jsonObject.put("brandId", dataApi.getLoginInfo().getBrandId());
jsonObject.put("operatorId", dataApi.getLoginInfo().getAdminId());
jsonObject.put("studioId", dataApi.getLoginInfo().getStudioId());
jsonObject.put("memo", "自动化积分学员详情-扣减积分");
dataApi.doRequest(RequestType.JSON, dataparams, jsonObject.toJSONString(), dataheadrs).assetsSuccess(true);
JSONObject response = dataApi.getBodyInJSON();
return response;
}
//导出记录列表-品牌
public JSONObject pageStudioExportRecord(String studioId, DataUserInfo...userInfos){
dataApi.setApiModule(ApiModule.Polar_Export)
.setApiName("API_pageStudioExportRecord")
.setTerminal(Terminal.B);
super.beforeDataRequest(userInfos);
JSONObject object = new JSONObject();
object.put("current",1);
object.put("size",20);
object.put("brandId",dataApi.getLoginInfo().getBrandId());
if (!studioId.equals("")){
object.put("studioId", dataApi.getLoginInfo().getStudioId());//传studioId则为场馆操作;不传则为品牌操作
}
object.put("operatorId",dataApi.getLoginInfo().getAdminId());
dataApi.doRequest(RequestType.JSON,dataparams,object.toString(),dataheadrs).assetsSuccess(true);
return dataApi.getBodyInJSON();
}
}
package com.xiaomai.cases.polar.points;
import com.xiaomai.cases.polar.training.TrainingTools;
import com.xiaomai.enums.ApiModule;
import com.xiaomai.enums.LoginAccount;
import com.xiaomai.enums.Terminal;
import com.xiaomai.utils.XMBaseTest;
import com.xiaomai.utils.XMJSONPath;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import javax.annotation.Resource;
public class TestBatchPoints extends XMBaseTest {
@BeforeMethod
public void beforeTest(){
xmAppApi.setApiModule(ApiModule.Polar_Points)
.setApiName("API_batchClearPoint")
.setLoginUser(LoginAccount.GYM_PROD)
.setTerminal(Terminal.B);
dal.setCase_owner("yangjian")
.setCase_name(Thread.currentThread().getStackTrace()[1].getFileName().split("\\.")[0]);
super.beforeTest();
}
@Resource(name = "pointsTools")
PointsTools pointsTools;
@Resource(name = "trainingTools")
TrainingTools trainingTools;
@Test(description = "品牌手动-积分")
public void testBatchClearPoint() throws InterruptedException {
String phone = "13357537209";
String memberId = trainingTools.searchTargerMember(phone);
//获取品牌初始会员的发放积分数、已使用积分数、剩余积分数
int BetotalAwardBalance = Integer.parseInt(XMJSONPath.readPath(pointsTools.findAccountPagePermission("",memberId), "$.result.records[0].totalAwardBalance"));//发放积分数
int BealreadyUsedBalance = Integer.parseInt(XMJSONPath.readPath(pointsTools.findAccountPagePermission("",memberId), "$.result.records[0].alreadyUsedBalance"));//已用积分数
int BeleftBalance = Integer.parseInt(XMJSONPath.readPath(pointsTools.findAccountPagePermission("",memberId), "$.result.records[0].leftBalance"));//剩余积分数
System.out.println("betotal--------"+BetotalAwardBalance);
System.out.println("beuse--------"+BealreadyUsedBalance);
System.out.println("beleft--------"+BeleftBalance);
int before = Integer.parseInt(XMJSONPath.readPath(pointsTools.findStatementPagePermission(""), "$.result.total"));//积分记录列表总条数
//品牌操作批量增加
Thread.sleep(1000);
pointsTools.batchAwardPoint("1",memberId,"");
int AftotalAwardBalance1 = Integer.parseInt(XMJSONPath.readPath(pointsTools.findAccountPagePermission("",memberId), "$.result.records[0].totalAwardBalance"));//发放积分数
int AfleftBalance1 = Integer.parseInt(XMJSONPath.readPath(pointsTools.findAccountPagePermission("",memberId), "$.result.records[0].leftBalance"));//剩余积分数
System.out.println("aftotal1--------"+AftotalAwardBalance1);
System.out.println("afleft1--------"+AfleftBalance1);
Assert.assertEquals(AftotalAwardBalance1,BetotalAwardBalance+1);//断言发放积分数+1
Assert.assertEquals(AfleftBalance1,BeleftBalance+1);//断言剩余积分数+1
//核对积分记录
Thread.sleep(1000);
int after1 = Integer.parseInt(XMJSONPath.readPath(pointsTools.findStatementPagePermission(""), "$.result.total"));
System.out.println("after1--------"+after1);
Assert.assertEquals(after1,before+1);//断言积分记录+1条记录
String str = Integer.toString(AfleftBalance1);
Assert.assertEquals(XMJSONPath.readPath(dataApi.getApi_response(), "$.result.records[0].transactionType"), "IN_MANUAL_GIVE", "第一条记录非手动增加记录");//断言列表第一条手动增加积分的记录
Assert.assertEquals(XMJSONPath.readPath(dataApi.getApi_response(), "$.result.records[0].accountLeftBalance"), str, "积分记录明细中,剩余积分和积分帐户对不上");//断言积分记录中的剩余积分
//品牌操作批量扣减
Thread.sleep(1000);
pointsTools.batchDeductPoint("1",memberId,"");//会员详情扣减1积分
//核对积分帐户的积分的变化
int AfalreadyUsedBalance2 = Integer.parseInt(XMJSONPath.readPath(pointsTools.findAccountPagePermission("",memberId), "$.result.records[0].alreadyUsedBalance"));//已使用积分积分数
int AfleftBalance2 = Integer.parseInt(XMJSONPath.readPath(pointsTools.findAccountPagePermission("",memberId), "$.result.records[0].leftBalance"));//剩余积分数
System.out.println("aftuse2--------"+AfalreadyUsedBalance2);
System.out.println("afleft2--------"+AfleftBalance2);
Assert.assertEquals(AfalreadyUsedBalance2,BealreadyUsedBalance+1);//断言已使用积分数+1
Assert.assertEquals(AfleftBalance2,AfleftBalance1-1);//断言剩余积分数-1
//核对积分记录
Thread.sleep(1000);
int after2 = Integer.parseInt(XMJSONPath.readPath(pointsTools.findStatementPagePermission(""), "$.result.total"));
System.out.println("after2--------"+after2);
Assert.assertEquals(after2,after1+1);//断言积分记录+1条记录
String str1 = Integer.toString(AfleftBalance2);
Assert.assertEquals(XMJSONPath.readPath(dataApi.getApi_response(), "$.result.records[0].transactionType"), "OUT_MANUAL_DEDUCT", "第一条记录非手动扣减记录");//断言列表第一条手动扣减积分的记录
Assert.assertEquals(XMJSONPath.readPath(dataApi.getApi_response(), "$.result.records[0].accountLeftBalance"), str1, "积分记录明细中,剩余积分和积分帐户对不上");//断言积分记录中的剩余积分
//品牌操作批量清零
Thread.sleep(1000);
pointsTools.batchClearPoint(memberId,"");
int AfleftBalance3 = Integer.parseInt(XMJSONPath.readPath(pointsTools.findAccountPagePermission("",memberId), "$.result.records[0].leftBalance"));//剩余积分数
Assert.assertEquals(AfleftBalance3,0);//断言剩余积分数等于0
//品牌积分导出
pointsTools.exportAccount("");//积分帐户导出
pointsTools.pageStudioExportRecord("");//查看导出记录
Thread.sleep(2000);
Assert.assertEquals(XMJSONPath.readPath(dataApi.getApi_response(), "$.result.records[0].workflowName"), "导出会员积分账户", "未生成导出会员积分账户记录");//断言有导出记录
pointsTools.exportStatement("");//积分记录导出
pointsTools.pageStudioExportRecord("");//查看导出记录
Thread.sleep(2000);
Assert.assertEquals(XMJSONPath.readPath(dataApi.getApi_response(), "$.result.records[0].workflowName"), "导出会员积分记录", "未生成导出会员积分记录");//断言有导出记录
}
}
package com.xiaomai.cases.polar.points;
import com.alibaba.fastjson.JSONObject;
import com.xiaomai.cases.polar.coupon.CouponTools;
import com.xiaomai.cases.polar.export.ExportTool;
import com.xiaomai.cases.polar.member.Tools;
import com.xiaomai.cases.polar.training.TrainingTools;
import com.xiaomai.enums.ApiModule;
import com.xiaomai.enums.LoginAccount;
import com.xiaomai.enums.Terminal;
import com.xiaomai.utils.XMBaseTest;
import com.xiaomai.utils.XMJSONPath;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import javax.annotation.Resource;
public class TestFindAccountPagePermission extends XMBaseTest {
@BeforeMethod
public void beforeTest(){
xmAppApi.setApiModule(ApiModule.Polar_Points)
.setApiName("API_findAccountPagePermission")
.setLoginUser(LoginAccount.GYM_PROD)
.setTerminal(Terminal.B);
dal.setCase_owner("yangjian")
.setCase_name(Thread.currentThread().getStackTrace()[1].getFileName().split("\\.")[0]);
super.beforeTest();
}
@Resource(name = "pointsTools")
PointsTools pointsTools;
@Resource(name = "tools")
Tools tools;
@Resource(name = "trainingTools")
TrainingTools trainingTools;
@Test(description = "场馆手动-积分")
public void testFindAccountPagePermission(){
String phone = "13357537209";
String memberId = trainingTools.searchTargerMember(phone);
if (memberId.isEmpty()) {
memberId = tools.create("杨剑积分", phone).getString("result");
}
//获取场馆初始会员的发放积分数、已使用积分数、剩余积分数
int BetotalAwardBalance = Integer.parseInt(XMJSONPath.readPath(pointsTools.findAccountPagePermission(xmAppApi.getLoginInfo().getStudioId(),memberId), "$.result.records[0].totalAwardBalance"));//发放积分数
int BealreadyUsedBalance = Integer.parseInt(XMJSONPath.readPath(pointsTools.findAccountPagePermission(xmAppApi.getLoginInfo().getStudioId(),memberId), "$.result.records[0].alreadyUsedBalance"));//已用积分数
int BeleftBalance = Integer.parseInt(XMJSONPath.readPath(pointsTools.findAccountPagePermission(xmAppApi.getLoginInfo().getStudioId(),memberId), "$.result.records[0].leftBalance"));//剩余积分数
System.out.println("betotal--------"+BetotalAwardBalance);
System.out.println("beuse--------"+BealreadyUsedBalance);
System.out.println("beleft--------"+BeleftBalance);
int before = Integer.parseInt(XMJSONPath.readPath(pointsTools.findStatementPagePermission(xmAppApi.getLoginInfo().getStudioId()), "$.result.total"));//积分记录列表总条数
System.out.println("before--------"+before);
pointsTools.manualAwardPoint("1",memberId);//会员详情增加1积分
//核对积分帐户的积分的变化
int AftotalAwardBalance1 = Integer.parseInt(XMJSONPath.readPath(pointsTools.findAccountPagePermission(xmAppApi.getLoginInfo().getStudioId(),memberId), "$.result.records[0].totalAwardBalance"));//发放积分数
int AfleftBalance1 = Integer.parseInt(XMJSONPath.readPath(pointsTools.findAccountPagePermission(xmAppApi.getLoginInfo().getStudioId(),memberId), "$.result.records[0].leftBalance"));//剩余积分数
System.out.println("aftotal1--------"+AftotalAwardBalance1);
System.out.println("afleft1--------"+AfleftBalance1);
Assert.assertEquals(AftotalAwardBalance1,BetotalAwardBalance+1);//断言发放积分数+1
Assert.assertEquals(AfleftBalance1,BeleftBalance+1);//断言剩余积分数+1
//核对积分记录
int after1 = Integer.parseInt(XMJSONPath.readPath(pointsTools.findStatementPagePermission(xmAppApi.getLoginInfo().getStudioId()), "$.result.total"));
System.out.println("after1--------"+after1);
Assert.assertEquals(after1,before+1);//断言积分记录+1条记录
String str = Integer.toString(AfleftBalance1);
Assert.assertEquals(XMJSONPath.readPath(dataApi.getApi_response(), "$.result.records[0].transactionType"), "IN_MANUAL_GIVE", "第一条记录非手动增加记录");//断言列表第一条手动增加积分的记录
Assert.assertEquals(XMJSONPath.readPath(dataApi.getApi_response(), "$.result.records[0].accountLeftBalance"), str, "积分记录明细中,剩余积分和积分帐户对不上");//断言积分记录中的剩余积分
pointsTools.manualDeductPoint("1",memberId);//会员详情扣减1积分
//核对积分帐户的积分的变化
int AfalreadyUsedBalance2 = Integer.parseInt(XMJSONPath.readPath(pointsTools.findAccountPagePermission(xmAppApi.getLoginInfo().getStudioId(),memberId), "$.result.records[0].alreadyUsedBalance"));//已使用积分积分数
int AfleftBalance2 = Integer.parseInt(XMJSONPath.readPath(pointsTools.findAccountPagePermission(xmAppApi.getLoginInfo().getStudioId(),memberId), "$.result.records[0].leftBalance"));//剩余积分数
System.out.println("aftuse2--------"+AfalreadyUsedBalance2);
System.out.println("afleft2--------"+AfleftBalance2);
Assert.assertEquals(AfalreadyUsedBalance2,BealreadyUsedBalance+1);//断言已使用积分数+1
Assert.assertEquals(AfleftBalance2,AfleftBalance1-1);//断言剩余积分数-1
//核对积分记录
int after2 = Integer.parseInt(XMJSONPath.readPath(pointsTools.findStatementPagePermission(xmAppApi.getLoginInfo().getStudioId()), "$.result.total"));
System.out.println("after2--------"+after2);
Assert.assertEquals(after2,after1+1);//断言积分记录+1条记录
String str1 = Integer.toString(AfleftBalance2);
Assert.assertEquals(XMJSONPath.readPath(dataApi.getApi_response(), "$.result.records[0].transactionType"), "OUT_MANUAL_DEDUCT", "第一条记录非手动扣减记录");//断言列表第一条手动扣减积分的记录
Assert.assertEquals(XMJSONPath.readPath(dataApi.getApi_response(), "$.result.records[0].accountLeftBalance"), str1, "积分记录明细中,剩余积分和积分帐户对不上");//断言积分记录中的剩余积分
}
}
......@@ -34,6 +34,7 @@ public class ApiModule {
public static String Polar_Invitation = "polar_invitation";
public static String Polar_Registration = "polar_registration";//活动报名
public static String Polar_Charts = "polar_charts";//会员排行榜-B
public static String Polar_Points = "polar_points";//会员积分
public static String Polar_MemberEntry="polar_memberEntry";//入场
public static String Polar_Export="polar_export";//导出
......@@ -55,6 +56,7 @@ public class ApiModule {
public static String Lunar_Goods="lunar_goods";//物品
public static String Lunar_Registration = "lunar_registration";//活动报名
public static String Lunar_Charts = "lunar_charts";//会员排行榜-小程序
public static String Lunar_Points = "lunar_points";//会员积分
public static String Lunar_Invitation = "lunar_invitation";
......
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