Commit 4adeb36c by zhangyuxiao

Merge remote-tracking branch 'origin/master'

parents 27ffe591 a89574b2
......@@ -22,7 +22,7 @@ public class TestSwitchStudio extends XMBaseTest {
.setCase_name(Thread.currentThread().getStackTrace()[1].getFileName().split("\\.")[0]);
super.beforeTest();
}
@Test(description = "切换场馆")
//@Test(description = "切换场馆")
public void testSwitchStudio() {
AdminTools tools =new AdminTools();
......
......@@ -263,22 +263,20 @@ public class TestCenterData extends XMBaseTest {
//3.校验销售数据-按照来源为无筛选数据明细-上述签单实收金额应不变
JSONObject afterResourceDataDetail1 = salesDataTools.resourceDataDetail(TimeUtils.getTodayTime(), TimeUtils.getTodayEndTime(), "-1", "DAY", "NEW_MEMBER_COUNT_DESC");
BigDecimal afterResourceDataDetailActualAmount1 = new BigDecimal(afterResourceDataDetail1.getJSONObject("result").getJSONArray("records").getJSONObject(0).getString("actualAmount"));
Assert.assertEquals(afterResourceDataDetailActualAmount1, actualAmount, "退单订单之后,销售数据明细来源为无的签单实收金额不应有变动");
Assert.assertEquals(afterResourceDataDetailActualAmount1, resourceDataDetailActualAmount, "退单订单之后,销售数据明细来源为无的签单实收金额不应有变动");
//4.校验销售数据-按照添加人是当前人筛选数据明细-上述签单实收金额应不变
JSONObject afterCreatorDataDetail1 = salesDataTools.creatorDataDetail(TimeUtils.getTodayTime(), TimeUtils.getTodayEndTime(), xmAppApi.getLoginInfo().getAdminId(), "DAY", "NEW_MEMBER_COUNT_DESC");
BigDecimal afterCreatorDataDetailActualAmount1 = new BigDecimal(afterCreatorDataDetail1.getJSONObject("result").getJSONArray("records").getJSONObject(0).getString("actualAmount"));
Assert.assertEquals(afterCreatorDataDetailActualAmount1, actualAmount, "退单订单之后,销售数据明细筛选添加人是当前人的签单实收金额不应有变动");
Assert.assertEquals(afterCreatorDataDetailActualAmount1, creatorDataDetailActualAmount, "退单订单之后,销售数据明细筛选添加人是当前人的签单实收金额不应有变动");
//5.校验销售数据-按照跟进销售为无筛选数据明细-上述签单实收金额应不变
JSONObject afterSalesDataDetail1 = salesDataTools.salesDataDetail(TimeUtils.getTodayTime(), TimeUtils.getTodayEndTime(), "-1", "DAY", "NEW_MEMBER_COUNT_DESC");
BigDecimal afterSalesDataDetailActualAmount1 = new BigDecimal(afterSalesDataDetail1.getJSONObject("result").getJSONArray("records").getJSONObject(0).getString("actualAmount"));
Assert.assertEquals(afterSalesDataDetailActualAmount1, actualAmount, "退单订单之后,销售数据明细筛选跟进销售为无的签单实收金额不应有变动");
Assert.assertEquals(afterSalesDataDetailActualAmount1, salesDataDetailActualAmount, "退单订单之后,销售数据明细筛选跟进销售为无的签单实收金额不应有变动");
//作废退单订单,为了下述流程可以作废签单订单
......@@ -296,9 +294,6 @@ public class TestCenterData extends XMBaseTest {
JSONObject refundDiscardResult = orderTools.discard(refundOrderGetDetailId, "重复录入", "已作废退单订单" + RandomStringUtil.randomString(10));
}
}
//③作废签单--校验签单实收金额减少
......@@ -325,37 +320,36 @@ public class TestCenterData extends XMBaseTest {
//校验:
//1.校验作废签单订单之后销售数据-数据分析汇总的签单实收金额是否减少
JSONObject afterAnalysis=salesDataTools.centerData("DAY",TimeUtils.getTodayEndTime(),TimeUtils.getTodayTime());
BigDecimal afterActualAmount=new BigDecimal(afterAnalysis.getJSONObject("result").getString("actualAmount"));//签单实收金额
Assert.assertEquals(afterActualAmount,actualAmount.subtract(BigDecimal.valueOf(paidAmount)),"作废签单订单之后,销售数据数据分析的签单实收金额未减少对应的签单实收金额");
JSONObject afterAnalysis = salesDataTools.centerData("DAY", TimeUtils.getTodayEndTime(), TimeUtils.getTodayTime());
BigDecimal afterActualAmount = new BigDecimal(afterAnalysis.getJSONObject("result").getString("actualAmount"));//签单实收金额
Assert.assertEquals(afterActualAmount, actualAmount.subtract(BigDecimal.valueOf(paidAmount)), "作废签单订单之后,销售数据数据分析的签单实收金额未减少对应的签单实收金额");
//2.校验销售数据-趋势图的签单实收金额是否减少
JSONObject afterTrendResult=salesDataTools.trend("DAY","SIGN_ORDER_ACTUAL_AMOUNT",TimeUtils.getTodayEndTime(),TimeUtils.getTodayTime());
BigDecimal afterValue=new BigDecimal(afterTrendResult.getJSONArray("result").getJSONObject(0).getJSONArray("items").getJSONObject(0).getString("value"));
Assert.assertEquals(afterValue,actualAmount.subtract(BigDecimal.valueOf(paidAmount)),"作废签单订单之后,销售数据趋势图的签单实收金额未减少对应的签单实收金额");
JSONObject afterTrendResult = salesDataTools.trend("DAY", "SIGN_ORDER_ACTUAL_AMOUNT", TimeUtils.getTodayEndTime(), TimeUtils.getTodayTime());
BigDecimal afterValue = new BigDecimal(afterTrendResult.getJSONArray("result").getJSONObject(0).getJSONArray("items").getJSONObject(0).getString("value"));
Assert.assertEquals(afterValue, actualAmount.subtract(BigDecimal.valueOf(paidAmount)), "作废签单订单之后,销售数据趋势图的签单实收金额未减少对应的签单实收金额");
//3.校验销售数据-按照来源为无筛选数据明细-上述签单实收金额是否减少
JSONObject afterResourceDataDetail=salesDataTools.resourceDataDetail(TimeUtils.getTodayTime(),TimeUtils.getTodayEndTime(),"-1","DAY","NEW_MEMBER_COUNT_DESC");
BigDecimal afterResourceDataDetailActualAmount=new BigDecimal(afterResourceDataDetail.getJSONObject("result").getJSONArray("records").getJSONObject(0).getString("actualAmount"));
Assert.assertEquals(afterResourceDataDetailActualAmount,actualAmount.subtract(BigDecimal.valueOf(paidAmount)),"作废签单订单之后,销售数据明细来源为无的签单实收金额未减少对应的签单实收金额");
JSONObject afterResourceDataDetail = salesDataTools.resourceDataDetail(TimeUtils.getTodayTime(), TimeUtils.getTodayEndTime(), "-1", "DAY", "NEW_MEMBER_COUNT_DESC");
BigDecimal afterResourceDataDetailActualAmount = new BigDecimal(afterResourceDataDetail.getJSONObject("result").getJSONArray("records").getJSONObject(0).getString("actualAmount"));
Assert.assertEquals(afterResourceDataDetailActualAmount, afterResourceDataDetailActualAmount1.subtract(BigDecimal.valueOf(paidAmount)), "作废签单订单之后,销售数据明细来源为无的签单实收金额未减少对应的签单实收金额");
//4.校验销售数据-按照添加人是当前人筛选数据明细-上述签单实收金额是否减少
JSONObject afterCreatorDataDetail=salesDataTools.creatorDataDetail(TimeUtils.getTodayTime(),TimeUtils.getTodayEndTime(),xmAppApi.getLoginInfo().getAdminId(),"DAY","NEW_MEMBER_COUNT_DESC");
BigDecimal afterCreatorDataDetailActualAmount=new BigDecimal(afterCreatorDataDetail.getJSONObject("result").getJSONArray("records").getJSONObject(0).getString("actualAmount"));
Assert.assertEquals(afterCreatorDataDetailActualAmount,actualAmount.subtract(BigDecimal.valueOf(paidAmount)),"作废签单订单之后,销售数据明细筛选添加人是当前人的签单实收金额未减少对应的签单实收金额");
JSONObject afterCreatorDataDetail = salesDataTools.creatorDataDetail(TimeUtils.getTodayTime(), TimeUtils.getTodayEndTime(), xmAppApi.getLoginInfo().getAdminId(), "DAY", "NEW_MEMBER_COUNT_DESC");
BigDecimal afterCreatorDataDetailActualAmount = new BigDecimal(afterCreatorDataDetail.getJSONObject("result").getJSONArray("records").getJSONObject(0).getString("actualAmount"));
Assert.assertEquals(afterCreatorDataDetailActualAmount, afterCreatorDataDetailActualAmount1.subtract(BigDecimal.valueOf(paidAmount)), "作废签单订单之后,销售数据明细筛选添加人是当前人的签单实收金额未减少对应的签单实收金额");
//5.校验销售数据-按照跟进销售为无筛选数据明细-上述签单实收金额是否减少
JSONObject afterSalesDataDetail=salesDataTools.salesDataDetail(TimeUtils.getTodayTime(),TimeUtils.getTodayEndTime(),"-1","DAY","NEW_MEMBER_COUNT_DESC");
BigDecimal afterSalesDataDetailActualAmount=new BigDecimal(afterSalesDataDetail.getJSONObject("result").getJSONArray("records").getJSONObject(0).getString("actualAmount"));
Assert.assertEquals(afterSalesDataDetailActualAmount,actualAmount.subtract(BigDecimal.valueOf(paidAmount)),"作废签单订单之后,销售数据明细筛选跟进销售为无的签单实收金额未减少对应的签单实收金额");
JSONObject afterSalesDataDetail = salesDataTools.salesDataDetail(TimeUtils.getTodayTime(), TimeUtils.getTodayEndTime(), "-1", "DAY", "NEW_MEMBER_COUNT_DESC");
BigDecimal afterSalesDataDetailActualAmount = new BigDecimal(afterSalesDataDetail.getJSONObject("result").getJSONArray("records").getJSONObject(0).getString("actualAmount"));
Assert.assertEquals(afterSalesDataDetailActualAmount, afterSalesDataDetailActualAmount1.subtract(BigDecimal.valueOf(paidAmount)), "作废签单订单之后,销售数据明细筛选跟进销售为无的签单实收金额未减少对应的签单实收金额");
}
}
}
}
package com.xiaomai.cases.polar.eleContract;
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.eleContract
* @Author: xuyamei
* @CreateTime: 2024-08-05 13:55
* @Description: 电子合同工具类
* @Version: 1.0
*/
@Component("eleContractTools")
public class EleContractTools extends XMBaseTest {
public void setUp(String name, DataUserInfo...dataUserInfo) {
dataApi.setApiModule(ApiModule.Polar_EleContract)
.setApiName(name)
.setTerminal(Terminal.B);
super.beforeDataRequest(dataUserInfo);
}
/**
* @description: 查询电子合同模版列表
* @author: xuyamei
* @date: 2024/8/5 14:38
* @return: com.alibaba.fastjson.JSONArray
**/
public JSONArray getNormalTemplateList(String name) {
setUp("API_getNormalTemplateList");
String body = "{\"tenantId\":\""+dataApi.getLoginInfo().getStudioId()+"\",\"name\": \""+name+"\"}";
dataApi.doRequest(RequestType.JSON,dataparams,body,dataheadrs).assetsSuccess(true);
return dataApi.getBodyInJSON().getJSONArray("result");
}
/**
* @description:获取充值单列表
* @author: xuyamei
* @date: 2024/8/5 15:14
* @return: com.alibaba.fastjson.JSONArray
**/
public JSONArray getBalanceList(){
setUp("API_getBalanceList");
JSONObject body = new JSONObject();
body.put("tenantId",dataApi.getLoginInfo().getStudioId());
body.put("brandId",dataApi.getLoginInfo().getBrandId());
body.put("studioId",dataApi.getLoginInfo().getStudioId());
body.put("operatorId",dataApi.getLoginInfo().getAdminId());
dataApi.doRequest(RequestType.JSON,dataparams,body.toString(),dataheadrs).assetsSuccess(true);
return dataApi.getBodyInJSON().getJSONArray("result");
}
public JSONArray getValidBalanceList(){
setUp("API_getValidBalanceList");
JSONObject body = new JSONObject();
body.put("tenantId",dataApi.getLoginInfo().getStudioId());
body.put("brandId",dataApi.getLoginInfo().getBrandId());
body.put("studioId",dataApi.getLoginInfo().getStudioId());
body.put("operatorId",dataApi.getLoginInfo().getAdminId());
dataApi.doRequest(RequestType.JSON,dataparams,body.toString(),dataheadrs).assetsSuccess(true);
return dataApi.getBodyInJSON().getJSONArray("result");
}
/**
* @description: 获取租户的预警配置
* @author: xuyamei
* @date: 2024/8/5 15:20
* @return: com.alibaba.fastjson.JSONObject
**/
public JSONObject getBalanceWarning(){
setUp("API_getBalanceWarning");
JSONObject body = new JSONObject();
body.put("tenantId",dataApi.getLoginInfo().getStudioId());
body.put("brandId",dataApi.getLoginInfo().getBrandId());
body.put("studioId",dataApi.getLoginInfo().getStudioId());
body.put("operatorId",dataApi.getLoginInfo().getAdminId());
dataApi.doRequest(RequestType.JSON,dataparams,body.toString(),dataheadrs).assetsSuccess(true);
return dataApi.getBodyInJSON().getJSONObject("result");
}
/**
* @description:获取合同编辑展示页-首次创建
* @author: xuyamei
* @date: 2024/8/5 17:49
* @param templateId :合同模版id
* @return: com.alibaba.fastjson.JSONObject
**/
public JSONObject getContractEditDisplay(String templateId){
setUp("API_getContractEditDisplay");
JSONObject body = new JSONObject();
body.put("templateId",templateId);
body.put("adminId",dataApi.getLoginInfo().getAdminId());
body.put("studioId",dataApi.getLoginInfo().getStudioId());
dataApi.doRequest(RequestType.JSON,dataparams,body.toString(),dataheadrs).assetsSuccess(true);
return dataApi.getBodyInJSON().getJSONObject("result");
}
/**
* @description:获取发起合同任务的状态
* @author: xuyamei
* @date: 2024/8/5 18:52
* @param id :合同id
* @return: boolean
**/
public boolean getStartContractV2Result(String id){
setUp("API_getStartContractV2Result");
String body = "{\"id\":\""+id+"\"}";
dataApi.doRequest(RequestType.JSON,dataparams,body,dataheadrs).assetsSuccess(true);
return dataApi.getBodyInJSON().getBoolean("result");
}
/**
* @description:获取合同列表
* @author: xuyamei
* @date: 2024/8/5 19:14
* @param targetId : 学员id
* @param associatedId :订单id
* @return: com.alibaba.fastjson.JSONObject
**/
public JSONObject getContractPage(String targetId,String associatedId,String status){
setUp("API_getContractPage");
JSONObject body = new JSONObject();
body.put("targetId",targetId);
body.put("associatedId",associatedId);
body.put("size",10);
body.put("current",0);
body.put("brandId",dataApi.getLoginInfo().getBrandId());
body.put("studioId",dataApi.getLoginInfo().getStudioId());
body.put("operatorId",dataApi.getLoginInfo().getAdminId());
if (!status.equals("")){
JSONArray statusList = new JSONArray();
statusList.add(status);
body.put("statusList",statusList);
}
dataApi.doRequest(RequestType.JSON,dataparams,body.toString(),dataheadrs).assetsSuccess(true);
return dataApi.getBodyInJSON().getJSONObject("result");
}
/**
* @description:撤回合同
* @author: xuyamei
* @date: 2024/8/6 10:40
* @param contractId
* @return: void
**/
public void retractContract(String contractId){
setUp("API_retractContract");
JSONObject body = new JSONObject();
body.put("id",contractId);
body.put("brandId",dataApi.getLoginInfo().getBrandId());
body.put("studioId",dataApi.getLoginInfo().getStudioId());
body.put("operatorId",dataApi.getLoginInfo().getAdminId());
dataApi.doRequest(RequestType.JSON,dataparams,body.toString(),dataheadrs).assetsSuccess(true);
}
public JSONObject getContract(String contractId){
setUp("API_getContract");
JSONObject body = new JSONObject();
body.put("id",contractId);
body.put("brandId",dataApi.getLoginInfo().getBrandId());
body.put("studioId",dataApi.getLoginInfo().getStudioId());
body.put("operatorId",dataApi.getLoginInfo().getAdminId());
dataApi.doRequest(RequestType.JSON,dataparams,body.toString(),dataheadrs).assetsSuccess(true);
return dataApi.getBodyInJSON().getJSONObject("result");
}
/**
* @description: 电子合同关联订单
* @author: xuyamei
* @date: 2024/8/6 15:02
* @param contractId :合同id
* @param associatedNo :订单号
* @param associatedId 订单id
* @return: void
**/
public void associate(String contractId,String associatedNo,String associatedId){
setUp("API_associate");
JSONObject body = new JSONObject();
body.put("contractId",contractId);
body.put("associatedNo",associatedNo);
body.put("associatedId",associatedId);
body.put("brandId",dataApi.getLoginInfo().getBrandId());
body.put("studioId",dataApi.getLoginInfo().getStudioId());
body.put("operatorId",dataApi.getLoginInfo().getAdminId());
dataApi.doRequest(RequestType.JSON,dataparams,body.toString(),dataheadrs).assetsSuccess(true);
}
/**
* @description:合同取消关联订单
* @author: xuyamei
* @date: 2024/8/6 15:47
* @param contractId 合同id
* @return: void
**/
public void disAssociate(String contractId){
setUp("API_disAssociate");
JSONObject body = new JSONObject();
body.put("id",contractId);
body.put("brandId",dataApi.getLoginInfo().getBrandId());
body.put("studioId",dataApi.getLoginInfo().getStudioId());
body.put("operatorId",dataApi.getLoginInfo().getAdminId());
dataApi.doRequest(RequestType.JSON,dataparams,body.toString(),dataheadrs).assetsSuccess(true);
}
public void setBalanceWarning(int balanceWarning,String id){
setUp("API_setBalanceWarning");
JSONObject body = new JSONObject();
body.put("warnAmount",balanceWarning);
body.put("brandId",xmAppApi.getLoginInfo().getBrandId());
body.put("studioId",xmAppApi.getLoginInfo().getStudioId());
body.put("operatorId",xmAppApi.getLoginInfo().getAdminId());
body.put("notifyPhone","13120057004");
body.put("id",id);
dataApi.doRequest(RequestType.JSON,dataparams,body.toString(),dataheadrs).assetsSuccess(true);
}
/**
* @description 复制签署地址
* @author: xuyamei
* @date: 2024/8/6 16:58
* @param id:合同id
* @return: java.lang.String
**/
public String getContractSignUrl(String id){
setUp("API_getContractSignUrl");
JSONObject body = new JSONObject();
body.put("brandId",xmAppApi.getLoginInfo().getBrandId());
body.put("studioId",xmAppApi.getLoginInfo().getStudioId());
body.put("operatorId",xmAppApi.getLoginInfo().getAdminId());
body.put("id",id);
dataApi.doRequest(RequestType.JSON,dataparams,body.toString(),dataheadrs).assetsSuccess(true);
return dataApi.getBodyInJSON().getString("result");
}
/**
* @description: 重新认证前置校验-存在待家长签署,签署中的合同都不允许重新认证
* @author: xuyamei
* @date: 2024/8/6 17:08
* @return: boolean
**/
public boolean checkBeforeResetVerify(){
setUp("API_checkBeforeResetVerify");
String body = "{\"tenantId\":\""+dataApi.getLoginInfo().getStudioId()+"\"}";
dataApi.doRequest(RequestType.JSON,dataparams,body.toString(),dataheadrs).assetsSuccess(true);
return dataApi.getBodyInJSON().getBoolean("result");
}
}
package com.xiaomai.cases.polar.eleContract;
import com.alibaba.fastjson.JSONObject;
import com.xiaomai.basetest.BaseTestImpl;
import com.xiaomai.enums.ApiModule;
import com.xiaomai.enums.LoginAccount;
import com.xiaomai.enums.RequestType;
import com.xiaomai.enums.Terminal;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
/**
* @BelongsProject: xm-sportstest
* @BelongsPackage: com.xiaomai.cases.polar.eleContract
* @Author: xuyamei
* @CreateTime: 2024-08-05 16:23
* @Description: 校验租户合同配置
* @Version: 1.0
*/
public class TestCheckContractConfig extends BaseTestImpl {
@BeforeMethod
@Override
public void beforeTest(){
setTestInfo(ApiModule.Polar_EleContract,"API_checkContractConfig", LoginAccount.DZHT_PROD, Terminal.B,"xym");
super.beforeTest();
}
@Test
public void testCheckContractConfig(){
JSONObject body = new JSONObject();
body.put("tenantId",xmAppApi.getLoginInfo().getStudioId());
body.put("brandId",xmAppApi.getLoginInfo().getBrandId());
body.put("studioId",xmAppApi.getLoginInfo().getStudioId());
body.put("operatorId",xmAppApi.getLoginInfo().getAdminId());
body.put("checkAll", true);
String[] types = {"VERIFY_RESULT","COMPANY_SIGNATURE","HAS_LEFT"};
body.put("checkTypes", types);
xmAppApi.doRequest(RequestType.JSON,params,body.toString(),headers).assetsSuccess(true);
JSONObject response = xmAppApi.getBodyInJSON().getJSONObject("result");
Assert.assertFalse(response.getBoolean("checkPass"));
String[] checkTypes = {"VERIFY_RESULT","COMPANY_SIGNATURE","HAS_LEFT"};
for (int i = 0; i < checkTypes.length; i++){
Assert.assertTrue(response.getJSONObject("checkFailResult").getBoolean(checkTypes[i]));
}
}
}
package com.xiaomai.cases.polar.eleContract;
import com.xiaomai.basetest.BaseTestImpl;
import com.xiaomai.enums.ApiModule;
import com.xiaomai.enums.LoginAccount;
import com.xiaomai.enums.RequestType;
import com.xiaomai.enums.Terminal;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
/**
* @BelongsProject: xm-sportstest
* @BelongsPackage: com.xiaomai.cases.polar.eleContract
* @Author: xuyamei
* @CreateTime: 2024-08-05 11:36
* @Description: 查询企业授权结果
* @Version: 1.0
*/
public class TestGetCompanyAuthSignResult extends BaseTestImpl {
@BeforeMethod
@Override
public void beforeTest(){
setTestInfo(ApiModule.Polar_EleContract,"API_getCompanyAuthSignResult", LoginAccount.DZHT_PROD, Terminal.B,"xym");
super.beforeTest();
}
@Test
public void testGetCompanyAuthSignResult(){
String body = "{\"tenantId\":\""+xmAppApi.getLoginInfo().getStudioId()+"\"}";
xmAppApi.doRequest(RequestType.JSON,params,body,headers).assetsSuccess(true);
Assert.assertTrue(xmAppApi.getBodyInJSON().getJSONObject("result").getBoolean("isSuccess"),"场馆已经授权,但查到的结果不是true");
}
}
package com.xiaomai.cases.polar.eleContract;
import com.xiaomai.basetest.BaseTestImpl;
import com.xiaomai.enums.ApiModule;
import com.xiaomai.enums.LoginAccount;
import com.xiaomai.enums.RequestType;
import com.xiaomai.enums.Terminal;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
/**
* @BelongsProject: xm-sportstest
* @BelongsPackage: com.xiaomai.cases.polar.eleContract
* @Author: xuyamei
* @CreateTime: 2024-08-05 11:52
* @Description: 获取企业实名证书
* @Version: 1.0
*/
public class TestGetCompanyCert extends BaseTestImpl {
@BeforeMethod
@Override
public void beforeTest(){
setTestInfo(ApiModule.Polar_EleContract,"API_getCompanyCert", LoginAccount.DZHT_PROD, Terminal.B,"xym");
super.beforeTest();
}
@Test
public void testGetCompanyCert(){
String body = "{\"tenantId\":\""+xmAppApi.getLoginInfo().getStudioId()+"\"}";
xmAppApi.doRequest(RequestType.JSON,params,body,headers).assetsSuccess(true);
Assert.assertEquals(xmAppApi.getBodyInJSON().getJSONObject("result").getString("sequenceNo"),"4CB4000000000000094C2A93","获取实名认证证书失败");
}
}
package com.xiaomai.cases.polar.eleContract;
import com.xiaomai.basetest.BaseTestImpl;
import com.xiaomai.enums.ApiModule;
import com.xiaomai.enums.LoginAccount;
import com.xiaomai.enums.RequestType;
import com.xiaomai.enums.Terminal;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
/**
* @BelongsProject: xm-sportstest
* @BelongsPackage: com.xiaomai.cases.polar.eleContract
* @Author: xuyamei
* @CreateTime: 2024-08-05 11:40
* @Description: 获取企业最新一次成功的认证结果
* @Version: 1.0
*/
public class TestGetCompanyLastSuccessVerifyResult extends BaseTestImpl {
@BeforeMethod
@Override
public void beforeTest(){
setTestInfo(ApiModule.Polar_EleContract,"API_getCompanyLastSuccessVerifyResult", LoginAccount.DZHT_PROD, Terminal.B,"xym");
super.beforeTest();
}
@Test
public void testGetCompanyLastSuccessVerifyResult(){
String body = "{\"tenantId\":\""+xmAppApi.getLoginInfo().getStudioId()+"\"}";
xmAppApi.doRequest(RequestType.JSON,params,body,headers).assetsSuccess(true);
Assert.assertEquals(xmAppApi.getBodyInJSON().getJSONObject("result").getString("status"),"AUDIT_SUCCEEDED","场馆已经授权,但查到的结果不是true");
}
}
package com.xiaomai.cases.polar.eleContract;
import com.xiaomai.basetest.BaseTestImpl;
import com.xiaomai.enums.ApiModule;
import com.xiaomai.enums.LoginAccount;
import com.xiaomai.enums.RequestType;
import com.xiaomai.enums.Terminal;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
/**
* @BelongsProject: xm-sportstest
* @BelongsPackage: com.xiaomai.cases.polar.eleContract
* @Author: xuyamei
* @CreateTime: 2024-08-05 11:28
* @Description: 获取企业最新的认证结果-只有状态
* @Version: 1.0
*/
public class TestGetCompanyLastVerifyStatus extends BaseTestImpl {
@BeforeMethod
@Override
public void beforeTest(){
setTestInfo(ApiModule.Polar_EleContract,"API_getCompanyLastVerifyStatus", LoginAccount.DZHT_PROD, Terminal.B,"xym");
super.beforeTest();
}
@Test
public void testGetCompanyLastVerifyStatus(){
String body = "{\"tenantId\":\""+xmAppApi.getLoginInfo().getStudioId()+"\"}";
xmAppApi.doRequest(RequestType.JSON,params,body,headers).assetsSuccess(true);
Assert.assertEquals(xmAppApi.getBodyInJSON().getJSONObject("result").getString("status"),"AUDIT_SUCCEEDED","场馆已经认证,获取的企业最新的认证结果返回的不是AUDIT_SUCCEEDED");
}
}
package com.xiaomai.cases.polar.eleContract;
import com.xiaomai.basetest.BaseTestImpl;
import com.xiaomai.enums.ApiModule;
import com.xiaomai.enums.LoginAccount;
import com.xiaomai.enums.RequestType;
import com.xiaomai.enums.Terminal;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
/**
* @BelongsProject: xm-sportstest
* @BelongsPackage: com.xiaomai.cases.polar.eleContract
* @Author: xuyamei
* @CreateTime: 2024-08-05 11:44
* @Description: 获取企业签章
* @Version: 1.0
*/
public class TestGetCompanySignature extends BaseTestImpl {
@BeforeMethod
@Override
public void beforeTest(){
setTestInfo(ApiModule.Polar_EleContract,"API_getCompanySignature", LoginAccount.DZHT_PROD, Terminal.B,"xym");
super.beforeTest();
}
@Test
public void testGetCompanySignature(){
String body = "{\"tenantId\":\""+xmAppApi.getLoginInfo().getStudioId()+"\"}";
xmAppApi.doRequest(RequestType.JSON,params,body,headers).assetsSuccess(true);
Assert.assertEquals(xmAppApi.getBodyInJSON().getJSONObject("result").getString("signatureUrl"),"https://fit-resource-pub.xiaomai5.com/fitness/1796482011391729666/BRAND/eleContract/1815396391027736577/20240722224002/signature.png","获取企业签章失败");
}
}
package com.xiaomai.cases.polar.eleContract;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.xiaomai.basetest.BaseTestImpl;
import com.xiaomai.enums.ApiModule;
import com.xiaomai.enums.LoginAccount;
import com.xiaomai.enums.RequestType;
import com.xiaomai.enums.Terminal;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import javax.annotation.Resource;
/**
* @BelongsProject: xm-sportstest
* @BelongsPackage: com.xiaomai.cases.polar.eleContract
* @Author: xuyamei
* @CreateTime: 2024-08-05 17:21
* @Description: 获取合同编辑展示页-首次创建
* @Version: 1.0
*/
public class TestGetContractEditDisplay extends BaseTestImpl {
@Resource(name = "eleContractTools")
EleContractTools eleContractTools;
@BeforeMethod
@Override
public void beforeTest(){
setTestInfo(ApiModule.Polar_EleContract,"API_getContractEditDisplay", LoginAccount.DZHT_PROD, Terminal.B,"xym");
super.beforeTest();
}
@Test
public void testGetContractEditDisplay(){
// 查询指定的模版
String templateId = eleContractTools.getNormalTemplateList("自动化").getJSONObject(0).getString("id");
JSONObject body = new JSONObject();
body.put("adminId",xmAppApi.getLoginInfo().getAdminId());
body.put("templateId",templateId);
body.put("studioId",xmAppApi.getLoginInfo().getStudioId());
xmAppApi.doRequest(RequestType.JSON,params,body.toString(),headers).assetsSuccess(true);
JSONObject response = xmAppApi.getBodyInJSON().getJSONObject("result");
JSONArray contractPdfVOList = response.getJSONArray("contractPdfVOList");
for (int i = 0; i < contractPdfVOList.getJSONObject(0).getJSONArray("contractFieldVOList").size(); i++){
if (contractPdfVOList.getJSONObject(0).getJSONArray("contractFieldVOList").getJSONObject(i).getString("templateField").equals("COMPANY_NAME")){
// 验证返回的公司名称
Assert.assertTrue(contractPdfVOList.getJSONObject(0).getJSONArray("contractFieldVOList").getJSONObject(i).getString("value").equals("杭州牧歌供应链管理有限公司"));
}else if (contractPdfVOList.getJSONObject(0).getJSONArray("contractFieldVOList").getJSONObject(i).getString("templateField").equals("TENANT_NAME")){
// 验证返回的场馆名称
Assert.assertTrue(contractPdfVOList.getJSONObject(0).getJSONArray("contractFieldVOList").getJSONObject(i).getString("value").equals("小小瑜伽城西银泰西湖场馆"));
}
}
Assert.assertTrue(response.getJSONObject("templateVO").getJSONArray("fieldConfigVOList").size()>=6,"模版字段数量大于等于6");
}
}
package com.xiaomai.cases.polar.eleContract;
import com.xiaomai.basetest.BaseTestImpl;
import com.xiaomai.enums.ApiModule;
import com.xiaomai.enums.LoginAccount;
import com.xiaomai.enums.RequestType;
import com.xiaomai.enums.Terminal;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
/**
* @BelongsProject: xm-sportstest
* @BelongsPackage: com.xiaomai.cases.polar.eleContract
* @Author: xuyamei
* @CreateTime: 2024-08-05 11:58
* @Description: 获取合同模版列表
* @Version: 1.0
*/
public class TestGetNormalTemplateList extends BaseTestImpl {
@BeforeMethod
@Override
public void beforeTest(){
setTestInfo(ApiModule.Polar_EleContract,"API_getNormalTemplateList", LoginAccount.DZHT_PROD, Terminal.B,"xym");
super.beforeTest();
}
@Test
public void testGetNormalTemplateList(){
String body = "{\"tenantId\":\""+xmAppApi.getLoginInfo().getStudioId()+"\"}";
xmAppApi.doRequest(RequestType.JSON,params,body,headers).assetsSuccess(true);
Assert.assertTrue(xmAppApi.getBodyInJSON().getJSONArray("result").size()>=1,"获取模版管理列表数据失败");
}
}
package com.xiaomai.cases.polar.eleContract;
import com.alibaba.fastjson.JSONObject;
import com.xiaomai.basetest.BaseTestImpl;
import com.xiaomai.enums.ApiModule;
import com.xiaomai.enums.LoginAccount;
import com.xiaomai.enums.RequestType;
import com.xiaomai.enums.Terminal;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import javax.annotation.Resource;
/**
* @BelongsProject: xm-sportstest
* @BelongsPackage: com.xiaomai.cases.polar.eleContract
* @Author: xuyamei
* @CreateTime: 2024-08-06 16:33
* @Description: 剩余份数小于设置的预警值合同管理提示条
* @Version: 1.0
*/
public class TestGetShowResidueCount extends BaseTestImpl {
@Resource(name = "eleContractTools")
EleContractTools eleContractTools;
@BeforeMethod
@Override
public void beforeTest(){
setTestInfo(ApiModule.Polar_EleContract,"API_getShowResidueCount", LoginAccount.DZHT_PROD, Terminal.B,"xym");
super.beforeTest();
}
@Test
public void testGetShowResidueCount(){
int warning = 1000;
// 查询预警记录id
JSONObject balanceWarning = eleContractTools.getBalanceWarning();
String id = balanceWarning.getString("id");
// 先设置预警值
eleContractTools.setBalanceWarning(warning, id);
// 查询剩余份数小于设置的预警值合同管理提示条
JSONObject body = new JSONObject();
body.put("tenantId",xmAppApi.getLoginInfo().getStudioId());
body.put("studioId",xmAppApi.getLoginInfo().getStudioId());
body.put("brandId",xmAppApi.getLoginInfo().getBrandId());
body.put("operatorId",xmAppApi.getLoginInfo().getAdminId());
xmAppApi.doRequest(RequestType.JSON,params,body.toString(),headers).assetsSuccess(true);
Assert.assertTrue(xmAppApi.getBodyInJSON().getInteger("result") == warning);
}
}
package com.xiaomai.cases.polar.eleContract;
import com.alibaba.fastjson.JSONObject;
import com.xiaomai.basetest.BaseTestImpl;
import com.xiaomai.enums.ApiModule;
import com.xiaomai.enums.LoginAccount;
import com.xiaomai.enums.RequestType;
import com.xiaomai.enums.Terminal;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
/**
* @BelongsProject: xm-sportstest
* @BelongsPackage: com.xiaomai.cases.polar.eleContract
* @Author: xuyamei
* @CreateTime: 2024-08-05 15:33
* @Description:获取合同充值套餐列表
* @Version: 1.0
*/
public class TestGetSuiteList extends BaseTestImpl {
@BeforeMethod
@Override
public void beforeTest(){
setTestInfo(ApiModule.Polar_EleContract,"API_getSuiteList", LoginAccount.DZHT_PROD, Terminal.B,"xym");
super.beforeTest();
}
@Test
public void testGetValidBalanceList() {
JSONObject body = new JSONObject();
body.put("brandId", xmAppApi.getLoginInfo().getBrandId());
body.put("studioId", xmAppApi.getLoginInfo().getStudioId());
body.put("operatorId", xmAppApi.getLoginInfo().getAdminId());
xmAppApi.doRequest(RequestType.JSON, params, body.toString(), headers).assetsSuccess(true);
String[] keys = new String[]{"productCode","productName","validPeriodYear","amount","price","oriUnitPrice","unitPrice"};
String[] values1 = new String[]{"E_CONT_100_1Y","电子合同100份","1","100","49800","698","498"};
String[] values2 = new String[]{"E_CONT_200_1Y","电子合同200份","1","200","79600","598","398"};
String[] values3 = new String[]{"E_CONT_500_2Y","电子合同500份","2","500","149000","498","298"};
String[] values4 = new String[]{"E_CONT_1000_2Y","电子合同1000份","2","1000","198000","398","198"};
for (int i = 0; i < 4; i++){
String[] values = i == 0 ? values1 : i == 1 ? values2 : i == 2 ? values3 : values4;
for (int j = 0; j < keys.length; j++){
Assert.assertEquals(xmAppApi.getBodyInJSON().getJSONArray("result").getJSONObject(i).getString(keys[j]),values[j]);
}
}
}
}
package com.xiaomai.cases.polar.eleContract;
import com.xiaomai.basetest.BaseTestImpl;
import com.xiaomai.enums.ApiModule;
import com.xiaomai.enums.LoginAccount;
import com.xiaomai.enums.RequestType;
import com.xiaomai.enums.Terminal;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import javax.annotation.Resource;
/**
* @BelongsProject: xm-sportstest
* @BelongsPackage: com.xiaomai.cases.polar.eleContract
* @Author: xuyamei
* @CreateTime: 2024-08-05 13:54
* @Description: 获取单个合同模板
* @Version: 1.0
*/
public class TestGetTemplate extends BaseTestImpl {
@Resource(name = "eleContractTools")
EleContractTools eleContractTools;
@BeforeMethod
@Override
public void beforeTest(){
setTestInfo(ApiModule.Polar_EleContract,"API_getTemplate", LoginAccount.DZHT_PROD, Terminal.B,"xym");
super.beforeTest();
}
@Test
public void testGetTemplate(){
String id = eleContractTools.getNormalTemplateList("").getJSONObject(0).getString("id");
String body = "{\"id\":\""+id+"\"}";
xmAppApi.doRequest(RequestType.JSON,params,body,headers).assetsSuccess(true);
Assert.assertEquals(xmAppApi.getBodyInJSON().getJSONObject("result").getString("id"),id);
}
}
package com.xiaomai.cases.polar.eleContract;
import com.xiaomai.basetest.BaseTestImpl;
import com.xiaomai.enums.ApiModule;
import com.xiaomai.enums.LoginAccount;
import com.xiaomai.enums.RequestType;
import com.xiaomai.enums.Terminal;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
/**
* @BelongsProject: xm-sportstest
* @BelongsPackage: com.xiaomai.cases.polar.eleContract
* @Author: xuyamei
* @CreateTime: 2024-08-06 16:46
* @Description: 获取租户是否购买结果
* @Version: 1.0
*/
public class TestGetTenantPurchaseFlag extends BaseTestImpl {
@BeforeMethod
@Override
public void beforeTest(){
setTestInfo(ApiModule.Polar_EleContract,"API_getTenantPurchaseFlag", LoginAccount.DZHT_PROD, Terminal.B,"xym");
super.beforeTest();
}
@Test
public void testGetTenantPurchaseFlag(){
String body = "{\"tenantId\":\""+xmAppApi.getLoginInfo().getStudioId()+"\"}";
xmAppApi.doRequest(RequestType.JSON,params,body,headers).assetsSuccess(true);
Assert.assertTrue(xmAppApi.getBodyInJSON().getBoolean("result"),"场馆已经购买但是返回的false");
}
}
package com.xiaomai.cases.polar.eleContract;
import com.alibaba.fastjson.JSONObject;
import com.xiaomai.basetest.BaseTestImpl;
import com.xiaomai.enums.ApiModule;
import com.xiaomai.enums.LoginAccount;
import com.xiaomai.enums.RequestType;
import com.xiaomai.enums.Terminal;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import javax.annotation.Resource;
/**
* @BelongsProject: xm-sportstest
* @BelongsPackage: com.xiaomai.cases.polar.eleContract
* @Author: xuyamei
* @CreateTime: 2024-08-05 14:55
* @Description: 获取租户有效余额记录
* @Version: 1.0
*/
public class TestGetValidBalanceList extends BaseTestImpl {
@Resource(name = "eleContractTools")
EleContractTools eleContractTools;
@BeforeMethod
@Override
public void beforeTest(){
setTestInfo(ApiModule.Polar_EleContract,"API_getValidBalanceList", LoginAccount.DZHT_PROD, Terminal.B,"xym");
super.beforeTest();
}
@Test
public void testGetValidBalanceList(){
JSONObject body = new JSONObject();
body.put("tenantId",xmAppApi.getLoginInfo().getStudioId());
body.put("brandId",xmAppApi.getLoginInfo().getBrandId());
body.put("studioId",xmAppApi.getLoginInfo().getStudioId());
body.put("operatorId",xmAppApi.getLoginInfo().getAdminId());
xmAppApi.doRequest(RequestType.JSON,params,body.toString(),headers).assetsSuccess(true);
Assert.assertTrue(xmAppApi.getBodyInJSON().getJSONArray("result").size()>0,"获取租户有效余额记录失败");
// 和充值记录的数据对比
String[] keys = {"id","tenantId","productCode","purchaseAmount","startTime","endTime","payChannel"};
for (int i = 0; i < keys.length; i++){
Assert.assertEquals(xmAppApi.getBodyInJSON().getJSONArray("result").getJSONObject(0).getString(keys[i]),eleContractTools.getBalanceList().getJSONObject(0).getString(keys[i]),"获取租户有效余额记录与充值记录列表内容对比");
}
}
}
package com.xiaomai.cases.polar.eleContract;
import com.alibaba.fastjson.JSONObject;
import com.xiaomai.basetest.BaseTestImpl;
import com.xiaomai.enums.ApiModule;
import com.xiaomai.enums.LoginAccount;
import com.xiaomai.enums.RequestType;
import com.xiaomai.enums.Terminal;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import javax.annotation.Resource;
import java.util.Random;
/**
* @BelongsProject: xm-sportstest
* @BelongsPackage: com.xiaomai.cases.polar.eleContract
* @Author: xuyamei
* @CreateTime: 2024-08-05 15:25
* @Description: 设置租户的预警配置
* @Version: 1.0
*/
public class TestSetBalanceWarning extends BaseTestImpl {
@Resource(name = "eleContractTools")
EleContractTools eleContractTools;
@BeforeMethod
@Override
public void beforeTest(){
setTestInfo(ApiModule.Polar_EleContract,"API_setBalanceWarning", LoginAccount.DZHT_PROD, Terminal.B,"xym");
super.beforeTest();
}
@Test
public void testSetBalanceWarning(){
// 获取预警id
JSONObject balanceWarning = eleContractTools.getBalanceWarning();
String id = balanceWarning.getString("id");
Random random = new Random();
int amount = random.nextInt(100);
JSONObject body = new JSONObject();
body.put("warnAmount",amount);
body.put("brandId",xmAppApi.getLoginInfo().getBrandId());
body.put("studioId",xmAppApi.getLoginInfo().getStudioId());
body.put("operatorId",xmAppApi.getLoginInfo().getAdminId());
body.put("notifyPhone","13120057004");
body.put("id",id);
xmAppApi.doRequest(RequestType.JSON,params,body.toString(),headers).assetsSuccess(true);
// 设置完成后查询设置的预警值
balanceWarning = eleContractTools.getBalanceWarning();
String[] keys = {"warnAmount","notifyPhone","id"};
String[] values = {amount+"","13120057004",id};
for (int i = 0; i < keys.length; i++){
Assert.assertEquals(balanceWarning.getString(keys[i]),values[i]);
}
}
}
package com.xiaomai.cases.polar.eleContract;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.xiaomai.basetest.BaseTestImpl;
import com.xiaomai.cases.polar.finance.order.OrderTools;
import com.xiaomai.cases.polar.training.TrainingTools;
import com.xiaomai.enums.ApiModule;
import com.xiaomai.enums.LoginAccount;
import com.xiaomai.enums.RequestType;
import com.xiaomai.enums.Terminal;
import com.xiaomai.utils.TimeUtils;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import javax.annotation.Resource;
/**
* @BelongsProject: xm-sportstest
* @BelongsPackage: com.xiaomai.cases.polar.eleContract
* @Author: xuyamei
* @CreateTime: 2024-08-05 18:01
* @Description: 发起合同、撤回合同
* @Version: 1.0
*/
public class TestStartContractV2 extends BaseTestImpl {
@Resource(name = "eleContractTools")
EleContractTools eleContractTools;
@Resource(name = "trainingTools")
TrainingTools trainingTools;
@Resource(name = "orderTools")
OrderTools orderTools;
@BeforeMethod
@Override
public void beforeTest(){
setTestInfo(ApiModule.Polar_EleContract,"API_startContractV2", LoginAccount.DZHT_PROD, Terminal.B,"xym");
super.beforeTest();
}
private String eleContractId;
private String studentId;
@Test(description = "发起电子合同")
public void testStartContractV2(){
// 查询发起的合同的学员
studentId = trainingTools.searchTargerMember("13120057004");
// 获取合同模版编辑内容
String templateId = eleContractTools.getNormalTemplateList("自动化").getJSONObject(0).getString("id");
JSONObject getContractEditDisplay = eleContractTools.getContractEditDisplay(templateId);
String contractName = "自动化发起合同"+ TimeUtils.getCurrentTime();
JSONObject body = new JSONObject();
body.put("targetId",studentId); // 学员id
body.put("studioId",xmAppApi.getLoginInfo().getStudioId()); // 学员id
body.put("adminId",xmAppApi.getLoginInfo().getAdminId()); // 学员id
// contractList 存放模版具体的内容
JSONArray contractList = new JSONArray();
JSONObject contract = new JSONObject();
contract.put("studioId",xmAppApi.getLoginInfo().getStudioId());
contract.put("contractName",contractName);
contract.put("templateId",templateId);
JSONArray contractFiledRequestList = new JSONArray();
int size = getContractEditDisplay.getJSONObject("templateVO").getJSONArray("fieldConfigVOList").size();
// 企业信息和场馆信息塞进去
for (int i = 0;i<getContractEditDisplay.getJSONArray("contractPdfVOList").getJSONObject(0).getJSONArray("contractFieldVOList").size();i++){
JSONObject contractFiledRequest = new JSONObject();
contractFiledRequest.put("id",getContractEditDisplay.getJSONArray("contractPdfVOList").getJSONObject(0).getJSONArray("contractFieldVOList").getJSONObject(i).getString("id"));
contractFiledRequest.put("templateField",getContractEditDisplay.getJSONArray("contractPdfVOList").getJSONObject(0).getJSONArray("contractFieldVOList").getJSONObject(i).getString("templateField"));
contractFiledRequest.put("value",getContractEditDisplay.getJSONArray("contractPdfVOList").getJSONObject(0).getJSONArray("contractFieldVOList").getJSONObject(i).getString("value"));
contractFiledRequestList.add(contractFiledRequest);
}
// 模版中的其余信息
for (int i=0;i<size;i++){
JSONObject contractFiledRequest = new JSONObject();
String templateField = getContractEditDisplay.getJSONObject("templateVO").getJSONArray("fieldConfigVOList").getJSONObject(i).getString("templateField");
if (!templateField.equals("COMPANY_NAME") && !templateField.equals("TENANT_NAME") && !templateField.equals("COMPANY_SIGNATURE") && !templateField.equals("PERSON_SIGNATURE")) { // 获取的内容不包含类型为企业名称、校区名称、企业签章、家长签字
contractFiledRequest.put("id", getContractEditDisplay.getJSONObject("templateVO").getJSONArray("fieldConfigVOList").getJSONObject(i).getString("id"));
contractFiledRequest.put("templateField", templateField);
contractFiledRequest.put("value", "");
contractFiledRequestList.add(contractFiledRequest);
} else if(templateField.equals("MEMBER_NAME")){
contractFiledRequest.put("id", getContractEditDisplay.getJSONObject("templateVO").getJSONArray("fieldConfigVOList").getJSONObject(i).getString("id"));
contractFiledRequest.put("templateField", templateField);
contractFiledRequest.put("value", "测试学员");
contractFiledRequestList.add(contractFiledRequest);
} else if (templateField.equals("PHONE")){
contractFiledRequest.put("id", getContractEditDisplay.getJSONObject("templateVO").getJSONArray("fieldConfigVOList").getJSONObject(i).getString("id"));
contractFiledRequest.put("templateField", templateField);
contractFiledRequest.put("value", "13120057004");
contractFiledRequestList.add(contractFiledRequest);
}
}
contract.put("contractFiledRequestList",contractFiledRequestList);
contractList.add(contract);
body.put("contractList",contractList);
xmAppApi.doRequest(RequestType.JSON,params,body.toString(),headers).assetsSuccess(true);
String taskId = xmAppApi.getBodyInJSON().getString("result");
// 获取发起合同任务的状态
eleContractTools.getStartContractV2Result(taskId);
while (true){
boolean result = eleContractTools.getStartContractV2Result(taskId);
if (result){
break;
}
}
// 验证1:合同列表 合同状态为待签署
boolean dataExist = false;
JSONArray getContractPage = eleContractTools.getContractPage(studentId,"","").getJSONArray("records");
for (int i=0;i<getContractPage.size();i++){
if (getContractPage.getJSONObject(i).getString("name").equals(contractName)){
dataExist = true;
eleContractId = getContractPage.getJSONObject(i).getString("id");
Assert.assertEquals(getContractPage.getJSONObject(i).getString("contractStatus"),"WAIT_C");
}
}
Assert.assertTrue(dataExist,"发起合同后在合同列表没有查到相关合同");
// 待签署的合同数量
int total = Integer.parseInt(eleContractTools.getContractPage("","","WAIT_C").getString("total"));
// 验证2:校验锁定额度
int lockAmount =eleContractTools.getValidBalanceList().getJSONObject(0).getInteger("lockAmount");
Assert.assertTrue(lockAmount==total,"锁定额度与合同列表中待签署合同数量不一致");
// 验证3:合同状态、归属人
JSONObject getContract = eleContractTools.getContract(eleContractId);
String[] keys = {"contractStatus","targetId"};
String[] values = {"WAIT_C",studentId};
for (int i=0;i<keys.length;i++){
Assert.assertEquals(getContract.getString(keys[i]),values[i],"合同状态、归属人与预期不一致");
}
}
@Test(priority = 1,description = "复制签署地址")
public void testGetContractSignUrl(){
String URL= eleContractTools.getContractSignUrl(eleContractId);
Assert.assertTrue(!URL.equals(""),"复制签署地址失败");
// 验证一下有待签署的合同,不允许重新认证
Assert.assertTrue(eleContractTools.checkBeforeResetVerify(),"有待签署的合同,但是重新认证校验返回的false");
}
@Test(priority = 1,description = "关联订单")
public void testAssociate(){
// 关联订单
// 查询学员关联的id
JSONObject body = new JSONObject();
body.put("current",0);
body.put("size",20);
body.put("receiverId",studentId);
body.put("supplierId",xmAppApi.getLoginInfo().getStudioId());
body.put("type","SIGN");
String[] status = {"WAITING", "PAID", "ARREARS"};
body.put("states",status);
body.put("brandId",xmAppApi.getLoginInfo().getBrandId());
body.put("studioId",xmAppApi.getLoginInfo().getStudioId());
body.put("operatorId",xmAppApi.getLoginInfo().getAdminId());
JSONArray pageVoucher = orderTools.pageVoucher(body);
// 获取一条订单id
String orderId = "";
String businessNo = "";
for (int i=0;i<pageVoucher.size();i++){
if (pageVoucher.getJSONObject(i).getString("source").equals("OFFLINE_SOURCE")){
businessNo = pageVoucher.getJSONObject(i).getString("businessNo");
orderId = pageVoucher.getJSONObject(i).getString("id");
}
}
eleContractTools.associate(eleContractId,businessNo,orderId);
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
// 验证1:合同详情 合同关联的订单id
JSONObject getContract = eleContractTools.getContract(eleContractId);
Assert.assertEquals(getContract.getString("associatedNo"),businessNo,"合同关联的订单号与实际不一致");
Assert.assertEquals(getContract.getString("associatedId"),orderId,"合同关联的订单id与实际不一致");
}
@Test(priority = 3,description = "取消关联订单")
public void testDisAssociate(){
// 取消关联
eleContractTools.disAssociate(eleContractId);
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
// 验证1:合同详情 合同关联的订单id
JSONObject getContract = eleContractTools.getContract(eleContractId);
Assert.assertEquals(getContract.getString("associatedNo"),"","合同取消关联的订单后关联的订单不为空");
}
@Test(priority = 4,description = "撤销电子合同")
public void testRetractContract(){
eleContractTools.retractContract(eleContractId);
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
// 验证1:合同详情 合同状态为已撤回
JSONObject getContract = eleContractTools.getContract(eleContractId);
Assert.assertEquals(getContract.getString("contractStatus"),"REVOKE","合同状态非已撤回");
// 待签署的合同数量
int total = Integer.parseInt(eleContractTools.getContractPage("","","WAIT_C").getString("total"));
// 验证2:校验锁定额度
int lockAmount =eleContractTools.getValidBalanceList().getJSONObject(0).getInteger("lockAmount");
Assert.assertTrue(lockAmount==total,"锁定额度与合同列表中待签署合同数量不一致");
}
}
......@@ -41,7 +41,7 @@ public class TestGetXmPayResult extends XMBaseTest {
String success=xmAppApi.getBodyInJSON().getString("success");
String transState=xmAppApi.getBodyInJSON().getJSONObject("result").getString("transState");
Assert.assertEquals(success,"true","查询订单使用小麦收银支付结果失败");
Assert.assertEquals(transState,"PAY_SUCCESS","支付成功流水状态未是支付成功");
Assert.assertEquals(transState,"PAY_IN","支付成功流水状态未是支付成功");
}
......
......@@ -47,7 +47,7 @@ public class TestListRelatedRecordsById extends XMBaseTest {
String transState = response.getJSONArray("result").getJSONObject(0).getString("transState");
String payId = response.getJSONArray("result").getJSONObject(0).getString("id");//收款流水ID
Assert.assertEquals(success, "true", "获取退款成功流水的查看关联交易失败");
Assert.assertEquals(transState, "PAY_SUCCESS", "退款成功流水的查看关联交易-收款流水的状态未是收款成功");
Assert.assertEquals(transState, "PAY_IN", "退款成功流水的查看关联交易-收款流水的状态未是收款成功");
try {
Thread.sleep(1000);
......
......@@ -157,6 +157,24 @@ public class OrderTools extends XMBaseTest {
}
/**
* @description:查询的订单
* @author: xuyamei
* @date: 2024/8/6 15:12
* @param jsonObject 请求参数
* @return: com.alibaba.fastjson.JSONObject
**/
public JSONArray pageVoucher(JSONObject jsonObject ){
dataApi.setApiModule(ApiModule.Polar_Finance)
.setApiName("API_pageVoucher")
.setTerminal(Terminal.B);
super.beforeDataRequest();
dataApi.doRequest(RequestType.JSON, dataparams, jsonObject.toJSONString(), dataheadrs).assetsSuccess(true);
JSONObject response=dataApi.getBodyInJSON();
return response.getJSONObject("result").getJSONArray("records");
}
/**
* @param
......
......@@ -655,7 +655,7 @@ public class ReserveTools extends XMBaseTest {
* @param scheduleId : 课次id
* @return: void
**/
public void delPersonalScheduleItem(String scheduleId){
public void delPersonalScheduleItem(String scheduleId) {
setUp("API_delPersonalScheduleItem");
JSONObject body = new JSONObject();
body.put("operatorId", dataApi.getLoginInfo().getAdminId());
......
......@@ -23,6 +23,7 @@ public class ApiModule {
public static String Polar_Schedule="polar_schedule";//课程排期
public static String Polar_Card="polar_card";//会员卡
public static String Polar_Training="polar_training";//训练营活动
public static String Polar_EleContract="polar_eleContract";//训练营活动
public static String Polar_Coupon="polar_coupon";//优惠券
......
......@@ -18,6 +18,7 @@ public class LoginAccount {
public static String XYM_MINIAPPC = "xym_miniAppC";
public static String GYM_MINIAPPC = "gym_miniAppC";
public static String XYY_PROD = "xyy_prod";
public static String DZHT_PROD = "dzht_prod"; // 电子合同账户
}
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