Commit bb0a2b6e authored by panyuli's avatar panyuli

核销二期代码

parent 9b09025c
......@@ -44,6 +44,7 @@ public class 权益一期线上用户核销中匹配兑换码兑换 extends Che
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,11 +67,13 @@ public class 权益一期线上用户核销中匹配兑换码兑换 extends Che
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+"'");
}
}
@Test
// +(invocationCount=5)
public void 兑换的权益码不存在() throws Exception {
......@@ -266,6 +269,7 @@ public class 权益一期线上用户核销中匹配兑换码兑换 extends Che
//第一次核销
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,7 +288,9 @@ public class 权益一期线上用户核销中匹配兑换码兑换 extends Che
logger.info("进行第二次核销");
response = equityPrizeService.exchange(authorization.dafuwengLogin(uid), exc_code1, null);
Thread.sleep(2000);
ChangeStock = jdbc.findSimpleResult("SELECT * FROM stock.tb_stock WHERE stock_id =1178701910023420109");
exchanggeStock = String.valueOf(ChangeStock.get("stock"));
//response.prettyPrint();
//获取到 code 数据
......@@ -315,7 +321,7 @@ public class 权益一期线上用户核销中匹配兑换码兑换 extends Che
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" +
......@@ -323,5 +329,7 @@ public class 权益一期线上用户核销中匹配兑换码兑换 extends Che
jdbc.update("DELETE FROM goods.tb_everyday_limit where app_item_id ='199280 '");
}
}
}
......@@ -7,10 +7,13 @@ 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.ArrayList;
import java.util.HashMap;
import java.util.Map;
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,107 @@ 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, ArrayList array) throws Exception {
Map<String , ArrayList> map = new HashMap<>();
map.put("equityIds", array);
// Response response = given().contentType("application/json;charset=UTF-8").cookies(cookies).params(map).get("http://" + url);
Response response = given().contentType("application/json;charset=UTF-8").cookies(cookies).params(map).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