Commit f2f23b45 authored by panyuli's avatar panyuli

Merge branch 'pyl'

parents 47be2a10 f12851d3
......@@ -44,6 +44,7 @@ public class 权益一期线上用户核销中匹配兑换码兑换_DuibaTest ex
Response response = equityPrizeService.exchange(authorization.dafuwengLogin(uid), exc_code, null);
Thread.sleep(2000);
Map<String, Object> ChangeStock = jdbc.findSimpleResult("SELECT * FROM stock.tb_stock WHERE stock_id =1173112680215170105");
String exchanggeStock = String.valueOf(ChangeStock.get("stock"));
......@@ -66,9 +67,11 @@ public class 权益一期线上用户核销中匹配兑换码兑换_DuibaTest ex
throw new Exception("异常信息打印:" + e);
}
jdbc.update("update goods.tb_equity_goods_record set consumer_id=null ,partner_user_id=null" +
" ,app_item_id=null ,verification_time=null ,order_num=null where exc_code = '"+exc_code+"'");
}finally {
jdbc.update("update goods.tb_equity_goods_record set consumer_id=null ,partner_user_id=null" +
" ,app_item_id=null ,verification_time=null ,order_num=null where exc_code = '"+exc_code+"'");
}
}
@Test
......@@ -266,6 +269,7 @@ public class 权益一期线上用户核销中匹配兑换码兑换_DuibaTest ex
//第一次核销
logger.info("用户第一次核销");
Response response = equityPrizeService.exchange(authorization.dafuwengLogin(uid), exc_code, null);
Thread.sleep(2000);
Map<String, Object> ChangeStock = jdbc.findSimpleResult("SELECT * FROM stock.tb_stock WHERE stock_id =1178701910023420109");
//第一次兑换之后的商品的库存成功
String exchanggeStock = String.valueOf(ChangeStock.get("stock"));
......@@ -284,8 +288,10 @@ public class 权益一期线上用户核销中匹配兑换码兑换_DuibaTest ex
logger.info("进行第二次核销");
response = equityPrizeService.exchange(authorization.dafuwengLogin(uid), exc_code1, null);
ChangeStock = jdbc.findSimpleResult("SELECT * FROM stock.tb_stock WHERE stock_id =1178701910023420109");
exchanggeStock = String.valueOf(ChangeStock.get("stock"));
Thread.sleep(2000);
ChangeStock = jdbc.findSimpleResult("SELECT * FROM stock.tb_stock WHERE stock_id =1178701910023420109");
exchanggeStock = String.valueOf(ChangeStock.get("stock"));
//response.prettyPrint();
//获取到 code 数据
code = response.jsonPath().getString("code");
......@@ -315,12 +321,14 @@ public class 权益一期线上用户核销中匹配兑换码兑换_DuibaTest ex
throw new Exception("异常信息打印:" + e);
}finally {
jdbc.update("update goods.tb_equity_goods_record set consumer_id=null ,partner_user_id=null" +
" ,app_item_id=null ,verification_time=null ,order_num=null where exc_code = '"+exc_code+"'");
jdbc.update("update goods.tb_equity_goods_record set consumer_id=null ,partner_user_id=null" +
" ,app_item_id=null ,verification_time=null ,order_num=null where exc_code = '"+exc_code1+"'");
jdbc.update("DELETE FROM goods.tb_everyday_limit where app_item_id ='199280 '");
}
jdbc.update("update goods.tb_equity_goods_record set consumer_id=null ,partner_user_id=null" +
" ,app_item_id=null ,verification_time=null ,order_num=null where exc_code = '"+exc_code+"'");
jdbc.update("update goods.tb_equity_goods_record set consumer_id=null ,partner_user_id=null" +
" ,app_item_id=null ,verification_time=null ,order_num=null where exc_code = '"+exc_code1+"'");
jdbc.update("DELETE FROM goods.tb_everyday_limit where app_item_id ='199280 '");
}
}
......
package http.service.Activity;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import http.service.Authorization;
import io.restassured.http.Cookies;
import io.restassured.response.Response;
......@@ -7,10 +9,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.testng.Assert;
import org.testng.annotations.Test;
import java.util.HashMap;
import java.util.Map;
import java.util.*;
import static base.Postman.logger;
import static io.restassured.RestAssured.given;
@Service
......@@ -22,6 +25,7 @@ public class equityPrizeService {
/**
* 核销一期 /aaw/equityPrize/exchange
* 匹配兑换码兑换 一期-线上核销
* Request Method: POST
*
* @param excCode 兑换码
......@@ -46,6 +50,108 @@ public class equityPrizeService {
return response;
}
/**
* 核销二期匹配 权益及兑换码兑换-线上核销
* 权益商品列表
* /chw//chw/visual-editor/equityGoodsList
* Request Method: GET
*
* @param equityId 权益id
* @return
* @throws Exception
*/
public Response chwequityGoodsList(Map cookies, String equityId) throws Exception {
Response response = given().cookies(cookies).get(activityHost + "/chw/visual-editor/equityGoodsList?equityId="+equityId);
try {
// Assert.assertEquals(response.jsonPath().getString("success"), "true", "/aaw/equityPrize/exchange接口失败");
Assert.assertEquals(String.valueOf(response.getStatusCode()), "200", "/chw//chw/visual-editor/equityGoodsList接口失败");
} catch (Exception e) {
throw new Exception("/chw/visual-editor/equityGoodsList接口失败,返回信息:" + response.asString());
} catch (Error er) {
throw new Exception("/chw/visual-editor/equityGoodsList接口失败,返回信息:" + response.asString());
}
return response;
}
@Test
/*
*q权益二期匹配 权益及兑换码兑换-线上核销
* 商品兑换首页
* /gaw/equityPrize/index
* * Request Method: post
* equityId 权益id , appitemid 商品id , appSkuid
* */
public Response gawequityPrizeindex( Map cookies,String equityId ,String appItemId ,String appSkuId) throws Exception {
logger.info(activityHost + "/gaw/equityPrize/index?equityId="+equityId+"&appItemId="+appItemId+"&appSkuId="+appSkuId);
Response response = given().cookies(cookies).get(activityHost + "/gaw/equityPrize/index?equityId="+equityId+"&appItemId="+appItemId+"&appSkuId="+appSkuId);
try {
Assert.assertEquals(String.valueOf(response.getStatusCode()), "200", "/gaw/equityPrize/index接口失败");
} catch (Exception e) {
throw new Exception("/gaw/equityPrize/index接口失败,返回信息:" + response.asString());
} catch (Error er) {
throw new Exception("/gaw/equityPrize/index接口失败,返回信息:" + response.asString());
}
return response;
}
/*
* 权益核销【匹配 权益及兑换码兑换-线上核销】
* 权益兑换接口sku /gaw/equityPrize/exchange
*
* */
public Response gawequityPrizeexchange( Map cookies,String excCode,String appItemId,
String equityId,String appSkuId) throws Exception {
Map<String, String> map = new HashMap<>();
map.put("excCode", excCode);
map.put("appItemId", appItemId);
map.put("equityId", equityId);
map.put("appSkuId", appSkuId);
map.put("validate", "undefined");
//token 代码中写死的测试token
map.put("token", "yrJRr7Cddp2YeQd");
Response response = given().cookies(cookies).params(map).post(activityHost + "/gaw/equityPrize/exchange");
try {
Assert.assertEquals(String.valueOf(response.getStatusCode()), "200", "/gaw/equityPrize/exchange接口失败");
} catch (Exception e) {
throw new Exception("/gaw/equityPrize/exchange接口失败,返回信息:" + response.asString());
} catch (Error er) {
throw new Exception("/gaw/equityPrize/exchange接口失败,返回信息:" + response.asString());
}
return response;
}
/*
* 权益核销【匹配 权益及兑换码兑换-线上核销】
* 权益列表 /chw/visual-editor/findEquityListByIds
*
* */
public Response chwvisualeditorfindEquityListByIds(Map cookies, List<Integer> array) throws Exception {
// JSONObject json = new JSONObject();
// json.put("equityIds", array);
Map<String, List<Integer>> map = new HashMap<>();
map.put("equityIds", array);
Response response = given().contentType("application/json;charset=UTF-8").cookies(cookies).body(map).post(activityHost + "/chw/visual-editor/findEquityListByIds");
//Response response = given().contentType("application/json;charset=UTF-8").body("{\"equityIds\":[25,24]}").cookies(cookies).post(activityHost + "/chw/visual-editor/findEquityListByIds");
try {
Assert.assertEquals(String.valueOf(response.getStatusCode()), "200", " /chw/visual-editor/findEquityListByIds接口失败");
} catch (Exception e) {
throw new Exception("/gaw/equityPrize/exchange接口失败,返回信息:" + response.asString());
} catch (Error er) {
throw new Exception("/gaw/equityPrize/exchange接口失败,返回信息:" + response.asString());
}
return response;
}
}
\ No newline at end of file
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