Commit 63e9681a authored by xiamengchen's avatar xiamengchen

新增我的客户

parent 1f474103
package com.kjj.bean.whoSawMe;
import lombok.Data;
@Data
public class ChatList {
private int chatContentType;
private String content;
private long id;
private boolean mine;
private int readFlag;
private Long receiverId;
private Long senderId;
}
package com.kjj.bean.whoSawMe;
import lombok.Data;
import java.util.List;
import java.util.Map;
@Data
public class LinkList {
private Map<String, Object> session;
}
package com.kjj.bean.whoSawMe;
import lombok.Data;
@Data
public class RemindInfo {
private String id;
private String remindContent;
private int remindStatus;
private Long remindTime;
}
......@@ -7,8 +7,7 @@ import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.*;
import static com.kjj.config.BasicConfig.BOSS_EDITCONFIG;
......@@ -21,6 +20,10 @@ public class ForwardAndRead implements Authorization {
private Long sellerId;
private String visitId;
private String insuranceId;
private String forwardTime;
private String activityConfId;
private String lottery_scId;
private String activityCustomPrizeId;
@BeforeClass
public void setUp() throws IOException{
......@@ -39,6 +42,8 @@ public class ForwardAndRead implements Authorization {
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.FORWARD, "接口请求失败", response.body().asString()));
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data, network.message(param, BasicConfig.FORWARD, "转发素材失败", response.body().asString()));
forwardTime = response.jsonPath().getString("timestamp");
}
@Test(description = "代理人转发名片", priority = 2)
......@@ -55,10 +60,68 @@ public class ForwardAndRead implements Authorization {
Assert.assertTrue(forwardResult, network.message(param, BasicConfig.FORWARD, "转发名片失败", response.body().asString()));
}
// @Test(description = "代理人转发抽奖", priority = 3)
// public void 转发抽奖() throws IOException{
// // 获取抽奖素材ID
// lottery_scId = getContentScId(BasicConfig.LOTTERY_CONTENTID);
//
// // 获取指定中奖客户信息
// Map<String, String> custInfos = new HashMap<>();
// custInfos.put("avatar", getUserInfo(BasicConfig.AGENT_TKU).get("avatar"));
// custInfos.put("visitorId", encodeId(decodeTku(BasicConfig.AGENT_TKU).get("userId")));
// custInfos.put("visitorNickname", getUserInfo(BasicConfig.AGENT_TKU).get("wxName"));
//
// // 指定客户中奖
// List<Object> winners = new ArrayList<>();
// winners.add(custInfos);
// param = new HashMap<>();
// param.put("scid", lottery_scId);
// param.put("winners", winners);
// response = network.postResponse(param, BasicConfig.LOTTERRY_addWinnersEn);
// String winnerId = response.jsonPath().getString("data[0].winnerId");
// Assert.assertNotNull(winnerId, network.message(param, BasicConfig.LOTTERRY_addWinnersEn, "添加中奖客户失败", response.body().asString()));
//
// // 保存抽奖配置
// List<String> winnerIds = new ArrayList<>();
// winnerIds.add(winnerId);
// Map<String, Object> prizeDetails = new HashMap<>();
// prizeDetails.put("customPrizeRate", 100);
// prizeDetails.put("customPrizeType", 1);
// prizeDetails.put("prizeImg", "https://yun.duiba.com.cn/kjj-prize-nodeimages/redbag.png");
// prizeDetails.put("prizeName", "奖品红包");
// prizeDetails.put("totalStock", 1);
// prizeDetails.put("winnerIds", winnerIds);
//
// param = new HashMap<>();
// param.put("pageTitle", "暖心冬日好礼");
// param.put("prizeDetails", prizeDetails);
// param.put("scid", lottery_scId);
// response = network.postResponse(param, BasicConfig.LOTTERRY_saveOrUpdateConf);
// activityConfId = response.jsonPath().getString("data");
// Assert.assertNotNull(activityConfId, network.message(param, BasicConfig.LOTTERRY_saveOrUpdateConf, "抽奖配置保存失败,未生成活动ID", response.body().asString()));
//
// // 获取配置详情
// param = new HashMap<>();
// param.put("scid", lottery_scId);
// param.put("activityConfId", activityConfId);
// response = network.getResponse(param, BasicConfig.LOTTERRY_getConf);
// activityCustomPrizeId = response.jsonPath().getString("data.prizeDetails[0].activityCustomPrizeId");
// Assert.assertEquals(response.jsonPath().getString("data.activityConfId"), activityConfId, network.message(param, BasicConfig.LOTTERRY_getConf, "获取配置与预期不对应", response.body().asString()));
// Assert.assertNotNull(activityCustomPrizeId, network.message(param, BasicConfig.LOTTERRY_getConf, "activityCustomPrizeId值为空", response.body().asString()));
//
// // 分享抽奖
// param = new HashMap<>();
// param.put("scId", lottery_scId);
// param.put("forwardType", 1);
// response = network.getResponse(param, BasicConfig.FORWARD);
// Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.FORWARD, "接口请求失败", response.body().asString()));
// Assert.assertTrue(response.jsonPath().getBoolean("data"), network.message(param, BasicConfig.FORWARD, "分享抽奖活动失败", response.body().asString()));
// }
// 访客访问素材及产生线索
@Test(description = "访客阅读文章", priority = 3)
public void 访客阅读文章() throws IOException{
sellerId = (Long) getUserInfo(BasicConfig.VISITOR2_TKU).get("sellerId");
sellerId = decodeTku(BasicConfig.VISITOR2_TKU).get("sellerId");
network.agentCookies.put("tku", BasicConfig.AGENT_TKU);
param = new HashMap<>();
param.put("scid", articleScId);
......@@ -73,8 +136,6 @@ public class ForwardAndRead implements Authorization {
@Test(description = "访客领取赠险", priority = 4)
public void 领取赠险() throws IOException{
response = network.getResponse(BasicConfig.USER_INFO);
System.out.println(response.body().asString());
// 获取赠险insuranceId
param = new HashMap<>();
param.put("scid", articleScId);
......@@ -96,11 +157,31 @@ public class ForwardAndRead implements Authorization {
Assert.assertEquals(data, "success", network.message(param, BasicConfig.SELLERCARD_SENDPUSHFORSCAN, "领取赠险失败", response.body().asString()));
}
// @Test(description = "访客阅读抽奖工具", priority = 5)
// public void 参与抽奖() throws IOException{
// param = new HashMap<>();
// param.put("scid", lottery_scId);
// param.put("bizNo", activityConfId);
// param.put("from", 0);
// response = network.getResponse(param, BasicConfig.CONTENT_READ);
// String visitId = response.jsonPath().getString("data.visitId");
// }
//
// @Test(description = "点击抽奖", priority = 6)
// public void 点击抽奖() throws IOException{
// param = new HashMap<>();
// param.put("id", activityCustomPrizeId);
// param.put("scid", lottery_scId);
// param.put("activityConfId", activityConfId);
// response = network.postResponse(param, )
// }
// // 访客增加访问记录
// @Test(description = "增加动态访问记录", priority = 5)
// public void 增加动态访问记录() throws IOException{
// param = new HashMap<>();
// param.put("scid", articleScId);
// param.put("forwardTime", forwardTime);
// response = network.postResponse(param, BasicConfig.DYNAMIC_ADDVISIT);
// Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.DYNAMIC_ADDVISIT, "接口请求失败", response.body().asString()));
// Assert.assertTrue(response.jsonPath().getBoolean("data"), network.message(param, BasicConfig.DYNAMIC_ADDVISIT, "增加访问记录失败", response.body().asString()));
......@@ -159,17 +240,15 @@ public class ForwardAndRead implements Authorization {
}
// 获取用户信息
public Map<String, Object> getUserInfo(String userTku){
public Map<String, String> getUserInfo(String userTku){
network.agentCookies.put("tku", userTku);
response = network.getResponse(BasicConfig.USER_INFO);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(BasicConfig.USER_INFO, "接口调用失败", response.body().asString()));
String avatar = response.jsonPath().getString("data.avatar");
String wxName = response.jsonPath().getString("data.wxName");
Long sellerId = response.jsonPath().getLong("data.sellerId");
Long userId = response.jsonPath().getLong("data.userId");
Map<String, Object> infos = new HashMap<>();
Map<String, String> infos = new HashMap<>();
infos.put("avatar", avatar);
infos.put("wxName", wxName);
infos.put("sellerId", sellerId);
infos.put("userId", userId);
network.agentCookies.put("tku", BasicConfig.VISITOR2_TKU);
return infos;
}
......
package com.kjj.cases.assistant.whoSawMe;
import com.kjj.bean.whoSawMe.ChatList;
import com.kjj.bean.whoSawMe.CustFavorite;
import com.kjj.bean.whoSawMe.LinkList;
import com.kjj.bean.whoSawMe.RemindInfo;
import com.kjj.cases.admin.Authorization;
import com.kjj.config.BasicConfig;
import com.kjj.utils.BaseUtils;
import com.kjj.utils.JsonUtil;
import com.kjj.utils.ThreadSleepUtils;
import freemarker.template.utility.DateUtil;
import io.restassured.response.Response;
import org.apache.commons.lang.time.DateUtils;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import org.testng.collections.Lists;
import javax.xml.crypto.Data;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.text.SimpleDateFormat;
import java.util.*;
// 我的客户-首页
public class MyCustomer implements Authorization {
......@@ -26,6 +32,8 @@ public class MyCustomer implements Authorization {
private long visitor1UserId;
private String sessionId;
private int visitCount;
private Long timeStamp;
private String id; // 自定义提醒事项id
@BeforeClass
public void setUp() throws IOException{
......@@ -55,6 +63,20 @@ public class MyCustomer implements Authorization {
Assert.assertNotNull(unreadCount, network.message(BasicConfig.SELLERUNREADMESSAGE, "获取未读消息数失败", response.body().asString()));
}
// 消息通知页_对话记录
@Test(description = "消息通知页_对话记录", priority = 99)
public void 消息通知页_对话记录() throws IOException{
param = new HashMap<>();
param.put("pageIndex", 1);
param.put("pageSize", 90);
response = network.getResponse(param, BasicConfig.CHAT_LINKMANLIST);
List<LinkList> linkLists = JsonUtil.parseResponseToPageBean(response, LinkList.class);
String sessionIds = (String) linkLists.get(0).getSession().get("sessionId");
String lastContent = (String) linkLists.get(0).getSession().get("lastContent");
Assert.assertEquals(sessionIds, sessionId, network.message(param, BasicConfig.CHAT_LINKMANLIST, "对话记录sessionId有误", response.body().asString()));
Assert.assertEquals(lastContent, "Hello", network.message(param, BasicConfig.CHAT_LINKMANLIST, "对话记录最后一条内容错误", response.body().asString()));
}
// 标签管理页_新建标签
@Test(description = "标签管理_新建标签", priority =3)
public void 标签管理_新建标签() throws IOException{
......@@ -95,7 +117,7 @@ public class MyCustomer implements Authorization {
}
// 标签管理_删除标签
@Test(description = "标签管理_删除标签", priority = 5)
@Test(description = "标签管理_删除标签", priority = 100)
public void 标签管理_删除标签() throws IOException{
// 删除标签
List<String> ids = Lists.newArrayList();
......@@ -126,7 +148,6 @@ public class MyCustomer implements Authorization {
response = network.postResponse(param, BasicConfig.CUSTOMERSEARCH);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.CUSTOMERSEARCH, "接口请求失败", response.body().asString()));
long userId = response.jsonPath().getLong("data.list[0].userId");
System.out.println(userId);
Assert.assertEquals(userId, visitor1UserId, network.message(param, BasicConfig.CUSTOMERSEARCH, "最新访问记录首位用户userId错误", response.body().asString()));
}
......@@ -192,7 +213,6 @@ public class MyCustomer implements Authorization {
param.put("pageSize", 20);
param.put("sortType", 3);
response = network.postResponse(param, BasicConfig.CUSTOMERSEARCH);
System.out.println(response.body().asString());
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.CUSTOMERSEARCH, "接口请求失败", response.body().asString()));
long userId = response.jsonPath().getLong("data.list[0].userId");
Assert.assertEquals(userId, visitor1UserId, network.message(param, BasicConfig.CUSTOMERSEARCH, "客户userId不匹配", response.body().asString()));
......@@ -296,7 +316,7 @@ public class MyCustomer implements Authorization {
response = network.getResponse(param, BasicConfig.CUSTINFO);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.CUSTINFO, "接口请求失败", response.body().asString()));
Long sellerId = response.jsonPath().getLong("data.sellerId");
sessionId = response.jsonPath().getString("sessionId");
sessionId = response.jsonPath().getString("data.sessionId");
Assert.assertEquals(sellerId, far.decodeTku(BasicConfig.VISITOR2_TKU).get("sellerId"), network.message(param, BasicConfig.CUSTINFO, "访客所属销售员sellerId不符", response.body().asString()));
Assert.assertNotNull(sessionId, network.message(param, BasicConfig.CUSTINFO, "访客sessionId为空", response.body().asString()));
}
......@@ -410,7 +430,7 @@ public class MyCustomer implements Authorization {
public void 客户详情页_任务蒙层() throws IOException{
param = new HashMap<>();
param.put("sceneCode", "noviceTask_visitorsCustomerInfoComplete");
response = network.getResponse(param, BasicConfig.NOVICE_MONGOLIANLAYERISPLAY);
response = network.postResponse(param, BasicConfig.NOVICE_MONGOLIANLAYERISPLAY);
boolean isDisplay = response.jsonPath().getBoolean("data.isDisplay");
Assert.assertFalse(isDisplay, network.message(param, BasicConfig.NOVICE_MONGOLIANLAYERISPLAY, "任务蒙层展示判断错误", response.body().asString()));
}
......@@ -431,7 +451,7 @@ public class MyCustomer implements Authorization {
param.put("pageIndex", 1);
param.put("paheSize", 30);
response = network.getResponse(param, BasicConfig.CONTENTVISITRECORD);
int totalCount = response.jsonPath().getInt("data.totalCount");
int totalCount = response.jsonPath().getInt("data.custVisitList.totalCount");
Assert.assertEquals(totalCount, visitCount, network.message(param, BasicConfig.CONTENTVISITRECORD, "访问记录总数与来访次数不符", response.body().asString()));
}
......@@ -467,5 +487,349 @@ public class MyCustomer implements Authorization {
Assert.assertEquals(contentId, BasicConfig.ARTICLE_CONTENTID, network.message(param, BasicConfig.CUSTFAVORITE, "用户产生动作的素材ID有误", response.body().asString()));
}
// 客户信息_客户管理_备注和标签
@Test(description = "备注和标签", priority = 30)
public void 客户信息_客户管理_备注和标签() throws IOException{
List<String> tagIds = new ArrayList<>();
tagIds.add(createTagId);
String custUserId = String.valueOf(visitor1UserId);
// 设置客户备注和标签信息
param = new HashMap<>();
param.put("custUserId", custUserId);
param.put("memo", "备忘录内容");
param.put("remarkName", "备注昵称");
param.put("tagIds", tagIds);
response = network.postResponse(param, BasicConfig.UPDATETAGANDMEMO);
Assert.assertTrue(response.jsonPath().getBoolean("data"), network.message(param, BasicConfig.UPDATETAGANDMEMO, "设置备注信息失败", response.body().asString()));
// 查询用户头部信息
param = new HashMap<>();
param.put("custUserId", visitor1UserId);
response = network.getResponse(param, BasicConfig.CUSTINFOHEADER);
String remarkName = response.jsonPath().getString("data.remarkName");
Assert.assertEquals(remarkName, "备注昵称", network.message(param, BasicConfig.CUSTINFOHEADER, "备注昵称与预期不符", response.body().asString()));
// 查询用户标签和备注信息
param = new HashMap<>();
param.put("userId", visitor1UserId);
response = network.getResponse(param, BasicConfig.GETTAGANDREMIND);
String memo = response.jsonPath().getString("data.memo");
String tagId = response.jsonPath().getString("data.tagList[0].id");
Assert.assertEquals(memo, "备忘录内容", network.message(param, BasicConfig.GETTAGANDREMIND, "备忘内容与预期不符", response.body().asString()));
Assert.assertEquals(tagId, createTagId, network.message(param, BasicConfig.GETTAGANDREMIND, "标签id与预期不符", response.body().asString()));
}
// 客户信息_客户管理_自定义提醒事项
@Test(description = "客户信息_客户管理_自定义提醒事项", priority = 31)
public void 客户信息_客户管理_自定义提醒事项() throws IOException{
param = new HashMap<>();
param.put("remindContent", "自定义提醒");
param.put("remindTime", roundUpToGetCurrentTimestamp());
param.put("userId", visitor1UserId);
response = network.postResponse(param, BasicConfig.UPDATECUSTREMIND);
String remindId = response.jsonPath().getString("data");
Assert.assertNotNull(remindId, network.message(param, BasicConfig.UPDATECUSTREMIND, "自定义提醒id为空", response.body().asString()));
// 查询未提醒事件列表
param = new HashMap<>();
param.put("pageIndex", 1);
param.put("pageSize", 20);
param.put("userId", visitor1UserId);
param.put("remindStatus", 0);
response = network.getResponse(param, BasicConfig.GETREMINDINFOS);
List<RemindInfo> remindInfos = JsonUtil.parseResponseToPageBean(response, RemindInfo.class);
for(RemindInfo remindInfo : remindInfos){
int remindStatus = remindInfo.getRemindStatus();
Assert.assertEquals(remindStatus, 0, network.message(param, BasicConfig.GETREMINDINFOS, "有状态为非未提醒事件", response.body().asString()));
}
id = remindInfos.get(0).getId();
Long stamp = remindInfos.get(0).getRemindTime();
Assert.assertEquals(id, remindId, network.message(param, BasicConfig.GETREMINDINFOS, "事件id与预期不符", response.body().asString()));
Assert.assertEquals(stamp, roundUpToGetCurrentTimestamp(), network.message(param, BasicConfig.GETREMINDINFOS, "事件触发时间与预期不符", response.body().asString()));
}
// 客户信息_客户管理_修改提醒事项
@Test(description = "客户信息_客户管理_修改提醒事项", priority = 32)
public void 客户信息_客户管理_修改提醒事项() throws IOException{
param = new HashMap<>();
param.put("id", id);
param.put("remindContent", "修改自定义提醒");
param.put("remindTime", roundUpToGetCurrentTimestamp());
param.put("userId", visitor1UserId);
response = network.postResponse(param, BasicConfig.UPDATECUSTREMIND);
String desc = response.jsonPath().getString("desc");
Assert.assertEquals(desc, "OK", network.message(param, BasicConfig.UPDATECUSTREMIND, "修改提醒事项失败", response.body().asString()));
// 查询未提醒事件列表
param = new HashMap<>();
param.put("pageIndex", 1);
param.put("pageSize", 20);
param.put("userId", visitor1UserId);
param.put("remindStatus", 0);
response = network.getResponse(param, BasicConfig.GETREMINDINFOS);
List<RemindInfo> remindInfos = JsonUtil.parseResponseToPageBean(response, RemindInfo.class);
String id = remindInfos.get(0).getId();
String remindContent = remindInfos.get(0).getRemindContent();
Assert.assertEquals(id, id, network.message(param, BasicConfig.GETREMINDINFOS, "事件id与预期不符", response.body().asString()));
Assert.assertEquals(remindContent, "修改自定义提醒", network.message(param, BasicConfig.GETREMINDINFOS, "修改提醒内容未生效", response.body().asString()));
}
//客户信息_客户管理_删除自定义提醒
@Test(description = "客户信息_客户管理_删除自定义提醒", priority = 33)
public void 客户信息_客户管理_删除自定义提醒() throws IOException{
// 删除待提醒事件
param = new HashMap<>();
param.put("pageIndex", 1);
param.put("pageSize", 20);
param.put("userId", visitor1UserId);
param.put("remindStatus", 0);
response = network.getResponse(param, BasicConfig.GETREMINDINFOS);
List<RemindInfo> remindInfos = JsonUtil.parseResponseToPageBean(response, RemindInfo.class);
for (RemindInfo remindInfo : remindInfos){
String id = remindInfo.getId();
param = new HashMap<>();
param.put("id", id);
param.put("userId", visitor1UserId);
response = network.postResponse(param, BasicConfig.DELETEREMIND);
boolean data =response.jsonPath().getBoolean("data");
Assert.assertTrue(data, network.message(param, BasicConfig.DELETEREMIND, "删除失败", response.body().asString()));
}
// 确认全部删除
param = new HashMap<>();
param.put("pageIndex", 1);
param.put("pageSize", 20);
param.put("userId", visitor1UserId);
param.put("remindStatus", 0);
response = network.getResponse(param, BasicConfig.GETREMINDINFOS);
List<Object> list = response.jsonPath().getList("data.list");
Assert.assertEquals(list.size(), 0, network.message(param, BasicConfig.GETREMINDINFOS, "待提醒事件未全部删除", response.body().asString()));
}
// 客户信息_客户管理_生日提醒
@Test(description = "客户信息_客户管理_生日提醒", priority = 34)
public void 客户信息_客户管理_生日提醒() throws IOException{
String userId = String.valueOf(visitor1UserId);
// 开启生日提醒
param = new HashMap<>();
param.put("birthRemind", true);
param.put("birthday", "07-30");
param.put("userId", userId);
response = network.postResponse(param, BasicConfig.UPDATEBIRTHREMIND);
Assert.assertTrue(response.jsonPath().getBoolean("data"), network.message(param, BasicConfig.UPDATEBIRTHREMIND, "开启生日提醒失败", response.body().asString()));
// 检查是否开启
param = new HashMap<>();
param.put("userId", visitor1UserId);
response = network.getResponse(param, BasicConfig.GETCUSTREMINDINFO);
boolean birthRemind = response.jsonPath().getBoolean("data.birthRemind");
String birthday = response.jsonPath().getString("data.birthday");
Assert.assertTrue(birthRemind, network.message(param, BasicConfig.GETCUSTREMINDINFO, "生日提醒未开启", response.body().asString()));
Assert.assertEquals(birthday, "07-30", network.message(param, BasicConfig.GETCUSTREMINDINFO, "生日日期不正确", response.body().asString()));
// 关闭生日提醒
param = new HashMap<>();
param.put("birthRemind", false);
param.put("userId", userId);
response = network.postResponse(param, BasicConfig.UPDATEBIRTHREMIND);
Assert.assertTrue(response.jsonPath().getBoolean("data"), network.message(param, BasicConfig.UPDATEBIRTHREMIND, "关闭生日提醒失败", response.body().asString()));
// 检查是否关闭
param = new HashMap<>();
param.put("userId", visitor1UserId);
response = network.getResponse(param, BasicConfig.CUSTOMERDETAIL);
birthRemind = response.jsonPath().getBoolean("data.birthRemind");
Assert.assertFalse(birthRemind, network.message(param, BasicConfig.CUSTOMERDETAIL, "生日提醒未关闭", response.body().asString()));
}
// 客户信息_客户管理_节日提醒
@Test(description = "客户信息_客户管理_节日提醒", priority = 35)
public void 客户信息_客户管理_节日提醒() throws IOException{
String userId = String.valueOf(visitor1UserId);
// 开启节日提醒
param = new HashMap<>();
param.put("holidayRemind", true);
param.put("userId", userId);
response = network.postResponse(param, BasicConfig.UPDATEHOLIDAYREMIND);
Assert.assertTrue(response.jsonPath().getBoolean("data"), network.message(param, BasicConfig.UPDATEHOLIDAYREMIND, "节日提醒开启失败", response.body().asString()));
// 检查是否开启
param = new HashMap<>();
param.put("userId", visitor1UserId);
response = network.getResponse(param, BasicConfig.GETTAGANDREMIND);
boolean holidayRemind = response.jsonPath().getBoolean("data.holidayRemind");
Assert.assertTrue(holidayRemind, network.message(param, BasicConfig.GETTAGANDREMIND, "节日提醒未开启", response.body().asString()));
// 关闭节日提醒
param.clear();
param.put("holidayRemind", false);
param.put("userId", userId);
response = network.postResponse(param, BasicConfig.UPDATEHOLIDAYREMIND);
Assert.assertTrue(response.jsonPath().getBoolean("data"), network.message(param, BasicConfig.UPDATEHOLIDAYREMIND, "节日提醒关闭失败", response.body().asString()));
// 检查是否关闭
param = new HashMap<>();
param.put("userId", visitor1UserId);
response = network.getResponse(param, BasicConfig.GETCUSTREMINDINFO);
holidayRemind = response.jsonPath().getBoolean("data.holidayRemind");
Assert.assertFalse(holidayRemind, network.message(param, BasicConfig.GETTAGANDREMIND, "节日提醒未关闭", response.body().asString()));
}
// 客户信息_客户关系链_统计信息
@Test(description = "客户信息_客户关系链_统计信息", priority = 36)
public void 客户信息_客户关系链_统计信息() throws IOException{
param = new HashMap<>();
param.put("custUserId", far.decodeTku(BasicConfig.AGENT_TKU).get("userId"));
response = network.getResponse(param, BasicConfig.RELATIONINFO_HEADER);
String name = response.jsonPath().getString("data.name");
Assert.assertEquals(name, BasicConfig.WECHAT_NAME, network.message(param, BasicConfig.RELATIONINFO_HEADER, "客户姓名不正确", response.body().asString()));
}
// 客户信息_客户关系链_人脉列表
@Test(description = "客户信息_客户关系链_人脉列表", priority = 37)
public void 客户信息_客户关系链_人脉列表() throws IOException{
param = new HashMap<>();
param.put("custUserId", far.decodeTku(BasicConfig.AGENT_TKU).get("userId"));
param.put("type", 1);
param.put("pageSize", 20);
param.put("pageIndex", 1);
response = network.getResponse(param, BasicConfig.RELATIONINFO_LIST);
Object data =response.jsonPath().getJsonObject("data");
Assert.assertNotNull(data, network.message(param, BasicConfig.RELATIONINFO_LIST, "返回响应为空", response.body().asString()));
}
// 客户信息_客户关系链_邀请排行
@Test(description = "客户信息_客户关系链_邀请排行", priority = 38)
public void 客户信息_客户关系链_邀请排行() throws IOException{
param = new HashMap<>();
param.put("type", 2);
param.put("pageSize", 20);
param.put("pageIndex", 1);
response = network.getResponse(param, BasicConfig.RELATIONINFO_RANKING);
Object data = response.jsonPath().getJsonObject("data");
Assert.assertNotNull(data, network.message(param, BasicConfig.RELATIONINFO_RANKING, "返回响应为空", response.body().asString()));
}
//客户信息_更多资料
@Test(description = "客户信息_更多资料", priority = 39)
public void 客户信息_更多资料() throws IOException{
// 更新资料信息
List<Object> baseMaterial = new ArrayList<>();
List<Object> otherMaterial = new ArrayList<>();
Map<String, List<Object>> extraMaterial = new HashMap<>();
extraMaterial.put("baseMaterial", baseMaterial);
extraMaterial.put("otherMaterial", otherMaterial);
String userId = String.valueOf(visitor1UserId);
param = new HashMap<>();
param.put("age", "11");
param.put("birthRemind", true);
param.put("birthday", "07-31");
param.put("birthdayType", 2);
param.put("custArea", "");
param.put("custCity", "北区");
param.put("custGender", 1);
param.put("custPhone", "13705566425");
param.put("extraMaterial", extraMaterial);
param.put("familyStatus", "家庭情况");
param.put("haveCar", false);
param.put("haveHouse", true);
param.put("healthStatus", "健康状态");
param.put("insuranceBuyStatus", "保险购买情况");
param.put("userId", userId);
param.put("yearIncome", 10000);
response = network.postResponse(param, BasicConfig.UPDATECUSTMATERIAL);
Assert.assertTrue(response.jsonPath().getBoolean("data"), network.message(param, BasicConfig.UPDATECUSTMATERIAL, "修改保存失败", response.body().asString()));
// 查看修改
param = new HashMap<>();
param.put("userId", visitor1UserId);
response = network.getResponse(param, BasicConfig.CUSTOMERDETAIL);
boolean haveCar = response.jsonPath().getBoolean("data.haveCar");
boolean haveHouse = response.jsonPath().getBoolean("data.haveHouse");
boolean birthRemind = response.jsonPath().getBoolean("data.birthRemind");
Assert.assertFalse(haveCar, network.message(param, BasicConfig.CUSTOMERDETAIL, "客户资料内容有误", response.body().asString()));
Assert.assertTrue(haveHouse, network.message(param, BasicConfig.CUSTOMERDETAIL, "客户资料内容有误", response.body().asString()));
Assert.assertTrue(birthRemind, network.message(param, BasicConfig.CUSTOMERDETAIL, "客户资料内容有误", response.body().asString()));
}
// 客户详情页_留言
@Test(description = "客户详情页_留言", priority = 40)
public void 客户详情页_留言() throws IOException{
// 判断销售员是否首次访问新功能(留言)
param = new HashMap<>();
param.put("type", 20);
response = network.getResponse(param, BasicConfig.NEWFUNC_FIRSTVISIT);
boolean data =response.jsonPath().getBoolean("data");
Assert.assertFalse(data, network.message(param, BasicConfig.NEWFUNC_FIRSTVISIT, "判断错误,用户非首次访问", response.body().asString()));
}
// 客户详情页_留言_发送消息
@Test(description = "客户详情页_留言_发送消息", priority = 41)
public void 客户详情页_留言_发送消息() throws IOException{
param = new HashMap<>();
param.put("content", "Hello");
param.put("role", "1");
param.put("sessionId", sessionId);
response= network.postResponse(param, BasicConfig.CHAT_SEND);
Assert.assertEquals(response.jsonPath().getString("desc"), "OK", network.message(param, BasicConfig.CHAT_SEND, "消息发送失败", response.body().asString()));
}
// 客户详情页_留言_聊天内容
@Test(description = "客户详情页_留言_聊天内容", priority = 42)
public void 客户详情页_留言_聊天内容() throws IOException{
param = new HashMap<>();
param.put("pageSize", 30);
param.put("isPushMessage", true);
param.put("role", 1);
param.put("sessionId", sessionId);
response = network.getResponse(param, BasicConfig.CHAT_LIST);
List<ChatList> chatLists = JsonUtil.parseResponseToPageBean(response, ChatList.class);
if(chatLists.size() != 0){
Long senderId = chatLists.get(chatLists.size()-1).getSenderId();
long receiverId = chatLists.get(chatLists.size()-1).getReceiverId();
String content = chatLists.get(chatLists.size()-1).getContent();
Assert.assertEquals(senderId, far.decodeTku(BasicConfig.VISITOR2_TKU).get("sellerId"), network.message(param, BasicConfig.CHAT_LIST, "发送者sellerId错误", response.body().asString()));
Assert.assertEquals(receiverId, visitor1UserId, network.message(param, BasicConfig.CHAT_LIST, "接收者userId错误", response.body().asString()));
Assert.assertEquals(content, "Hello", network.message(param, BasicConfig.CHAT_LIST, "消息内容错误", response.body().asString()));
}else {
Assert.assertTrue(true, network.message(param, BasicConfig.CHAT_LIST, "聊天记录为空", response.body().asString()));
}
}
// 客户详情页_留言_留言对象是否关注公众号
@Test(description = "客户详情页_留言_留言对象是否关注公众号", priority = 43)
public void 客户详情页_留言_留言对象是否关注公众号() throws IOException{
param = new HashMap<>();
param.put("targetSid", far.decodeTku(BasicConfig.VISITOR2_TKU).get("sellerId"));
response = network.getResponse(param, BasicConfig.CHAT_GETSUBSCRIBESTATUS);
int subscribe = response.jsonPath().getInt("data.subscribe");
Assert.assertEquals(subscribe, 1, network.message(param, BasicConfig.CHAT_GETSUBSCRIBESTATUS, "判断用户是否关注公众号失败", response.body().asString()));
}
// // 客户详情页_留言_用户回复
// @Test(description = "客户详情页_留言_用户回复", priority = 44)
// public void 客户详情页_留言_用户回复() throws IOException{
//
// }
public Long roundUpToGetCurrentTimestamp(){
// 向上取整获取当前时间戳(半小时为单位)
Date current = new Date();
Calendar calendar = Calendar.getInstance();
calendar.clear();
calendar.setTime(current);
int minute = calendar.get(Calendar.MINUTE);
if(minute <= 30){
calendar.set(Calendar.MILLISECOND, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MINUTE, 30);
}else {
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
calendar.set(Calendar.MINUTE, 30);
calendar.add(Calendar.HOUR, 1);
}
Date AfterChange = calendar.getTime();
return AfterChange.getTime();
}
}
......@@ -238,7 +238,7 @@ public class MyForward implements Authorization {
response = network.getResponse(param, BasicConfig.FORWARD_VISITRECORD);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.FORWARD_VISITRECORD, "接口请求失败", response.body().asString()));
String encodeUserId = response.jsonPath().getString("data.list[0].userId");
Assert.assertEquals(encodeUserId, far.encodeId((Long) far.getUserInfo(VISITOR1_TKU).get("userId")), network.message(param, FORWARD_VISITRECORD, "筛选结果首条记录userId与预期不符", response.body().asString()));
Assert.assertEquals(encodeUserId, visitorEncodeUserId, network.message(param, FORWARD_VISITRECORD, "筛选结果首条记录userId与预期不符", response.body().asString()));
}
// 获取素材转发关系链
......
......@@ -263,7 +263,7 @@ public class WhoSawMe implements Authorization {
boolean hasSubordinate = response.jsonPath().getBoolean("data.hasSubordinate");
int teamNumber = response.jsonPath().getInt("data.teamNumber");
Assert.assertTrue(hasSubordinate, network.message(param, BasicConfig.BOSS_ROLE, "用户查询无下级", response.body().asString()));
Assert.assertEquals(teamNumber, 2, network.message(param, BasicConfig.BOSS_ROLE, "代理人团队人数有误", response.body().asString()));
Assert.assertTrue(teamNumber >= 2, network.message(param, BasicConfig.BOSS_ROLE, "代理人团队人数有误", response.body().asString()));
}
// 代理人团队成员数
......@@ -274,7 +274,7 @@ public class WhoSawMe implements Authorization {
response = network.getResponse(param, BasicConfig.TEAMMEMBERNUM);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.TEAMMEMBERNUM, "接口请求失败", response.body().asString()));
int personalNum = response.jsonPath().getInt("data.personalNum");
Assert.assertEquals(personalNum, 2, network.message(param, BasicConfig.TEAMMEMBERNUM, "代理人团队人数有误", response.body().asString()));
Assert.assertTrue(personalNum >= 2, network.message(param, BasicConfig.TEAMMEMBERNUM, "代理人团队人数有误", response.body().asString()));
}
// // 获取今日团队数据
......@@ -294,28 +294,28 @@ public class WhoSawMe implements Authorization {
// Assert.assertEquals(gainSaleClueNum, 8, network.message(param, BasicConfig.TEAMDATA, "获得线索数量不为2", response.body().asString()));
// }
// 获取个人排行列表
@Test(description = "获取个人排行列表", priority = 22)
public void 获取个人排行列表() throws IOException{
param= new HashMap<>();
param.put("pageIndex", 1);
param.put("pageSize", 20);
param.put("sortType", 4);
param.put("superiorId", xxxSellerId);
param.put("listType", 4);
param.put("team", false);
response = network.getResponse(param, BasicConfig.TEAMRANKINGLIST);
Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.TEAMRANKINGLIST, "接口请求失败", response.body().asString()));
List<RankingList> rankingLists = JsonUtil.parseResponseToPageBean(response, RankingList.class);
List<String> memberSids = Lists.newArrayList();
memberSids.add(far.encodeId(xxxSellerId));
memberSids.add(far.encodeId(far.decodeTku(BasicConfig.AGENT_TKU).get("sellerId")));
Assert.assertEquals(rankingLists.size(), 2, network.message(param, BasicConfig.TEAMRANKINGLIST, "排行榜人员数有误", response.body().asString()));
for (int i = 0; i < rankingLists.size(); i++){
boolean isExist = memberSids.contains(rankingLists.get(i).getSellerId());
Assert.assertTrue(isExist, network.message(param, BasicConfig.TEAMRANKINGLIST, "排行榜内成员sid有误", response.body().asString()));
}
}
// // 获取个人排行列表
// @Test(description = "获取个人排行列表", priority = 22)
// public void 获取个人排行列表() throws IOException{
// param= new HashMap<>();
// param.put("pageIndex", 1);
// param.put("pageSize", 20);
// param.put("sortType", 4);
// param.put("superiorId", xxxSellerId);
// param.put("listType", 4);
// param.put("team", false);
// response = network.getResponse(param, BasicConfig.TEAMRANKINGLIST);
// Assert.assertTrue(response.jsonPath().getBoolean("success"), network.message(param, BasicConfig.TEAMRANKINGLIST, "接口请求失败", response.body().asString()));
// List<RankingList> rankingLists = JsonUtil.parseResponseToPageBean(response, RankingList.class);
// List<String> memberSids = Lists.newArrayList();
// memberSids.add(far.encodeId(xxxSellerId));
// memberSids.add(far.encodeId(far.decodeTku(BasicConfig.AGENT_TKU).get("sellerId")));
// Assert.assertTrue(rankingLists.size() >= 2, network.message(param, BasicConfig.TEAMRANKINGLIST, "排行榜人员数有误", response.body().asString()));
// for (int i = 0; i < rankingLists.size(); i++){
// boolean isExist = memberSids.contains(rankingLists.get(i).getSellerId());
// Assert.assertTrue(isExist, network.message(param, BasicConfig.TEAMRANKINGLIST, "排行榜内成员sid有误", response.body().asString()));
// }
// }
// 团队任务
......@@ -474,7 +474,7 @@ public class WhoSawMe implements Authorization {
public void 查看转发素材访问列表() throws IOException{
// 获取首条素材列表中首条动态id
param = new HashMap<>();
param.put("sellerId", far.getUserInfo(BasicConfig.VISITOR2_TKU).get("sellerId"));
param.put("sellerId", xxxSellerId);
param.put("pageSize", 20);
param.put("pageIndex", 1);
param.put("sortType", 4);
......@@ -561,7 +561,7 @@ public class WhoSawMe implements Authorization {
public void tearDown() throws IOException{
// 登陆管理后台调用管理后台接口删除成员
param = new HashMap<>();
param.put("superiorSid", far.getUserInfo(BasicConfig.VISITOR2_TKU).get("sellerId"));
param.put("superiorSid", xxxSellerId);
param.put("childSid", childSellerId);
response = network.postResponse(param, BasicConfig.MANAGER_SELLERTEAM_REMOVEMEMBER);
Assert.assertTrue(response.jsonPath().getBoolean("data"), network.message(param, BasicConfig.MANAGER_SELLERTEAM_REMOVEMEMBER, "删除成员失败", response.body().asString()));
......
......@@ -610,6 +610,7 @@ public class BasicConfig {
public static final String VISITHEADER = HOST + "/kjy/mp/visit/header/v2";
public static final String SELLERWEEKLY = HOST + "/kjy/mp/whoSawMe/sellerWeekly";
public static final String WEEKLY_LIST = HOST + "/kjy/mp/seller/weekly/list";
public static final String NEWFUNC_FIRSTVISIT = HOST + "/kjy/mp/newFunction/sellerFirstVisit";
// *************** 支付 ***************
......@@ -729,10 +730,27 @@ public class BasicConfig {
public static final String CUSTMATERIALS = HOST + "/kjy/mp/whoSawMe/materials";
public static final String CUSTLOTTERIES = HOST + "/kjy/mp/whoSawMe/lotteries";
public static final String CUSTFAVORITE = HOST + "/kjy/mp/whoSawMe/custFavorite";
public static final String GETTAGANDREMIND = HOST + "/kjy/mp/seller/getTagAndRemindInfo";
public static final String UPDATECUSTREMIND = HOST + "/kjy/mp/seller/saveOrUpdateCustomRemind";
public static final String GETREMINDINFOS = HOST + "/kjy/mp/seller/getRemindInfos";
public static final String DELETEREMIND = HOST + "/kjy/mp/seller/deleteCustomRemind";
public static final String UPDATEBIRTHREMIND = HOST + "/kjy/mp/seller/updateBirthdayRemindInfo";
public static final String UPDATEHOLIDAYREMIND = HOST + "/kjy/mp/seller/updateHolidayRemindInfo";
public static final String GETCUSTREMINDINFO = HOST + "/kjy/mp/seller/getCustomerRemindInfo";
public static final String CUSTOMERDETAIL = HOST + "/kjy/mp/seller/v2/customer/detail";
public static final String RELATIONINFO_HEADER = HOST + "/kjy/mp/seller/customer/getRelationInfoHeader";
public static final String RELATIONINFO_LIST = HOST + "/kjy/mp/seller/customer/getRelationInfoList";
public static final String RELATIONINFO_RANKING = HOST + "/kjy/mp/seller/customer/relation/ranking";
public static final String UPDATECUSTMATERIAL = HOST + "/kjy/mp/seller/v2/customer/material/saveOrUpdate";
// *************** 标签管理 ***************
public static final String TAG_ADDORUPDATE = HOST + "/kjy/mp/sellerTag/addOrUpdateTag";
public static final String TAG_GETLIST = HOST + "/kjy/mp/sellerTag/getTagList";
public static final String TAG_DELETE = HOST + "/kjy/mp/sellerTag/deleteTag";
// *************** 留言 ***************
public static final String CHAT_SEND = HOST + "/kjy/mp/chat/send";
public static final String CHAT_LIST = HOST + "/kjy/mp/chat/list";
public static final String CHAT_GETSUBSCRIBESTATUS = HOST + "/kjy/mp/chat/getSubscribeStatus";
public static final String CHAT_LINKMANLIST = HOST + "/kjy/mp/chat/sellerLinkmanList";
// *************** 文章 ***************
......
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