private List phoneList = new ArrayList<>();
private Map<String,String> phoneNameMap = new HashMap<>();
public void initPhone(){
phoneList.add(“17078388295”);
phoneList.add(“13980337439”);
phoneList.add(“14575535933”);
phoneList.add(“19902496992”);
phoneList.add(“18549641558”);
phoneList.add(“17005930322”);
phoneList.add(“18468618874”);
phoneList.add(“18576581848”);
phoneList.add(“15978226424”);
phoneList.add(“15542823911”);
phoneList.add(“17526304161”);
phoneList.add(“15422018558”);
phoneList.add(“17269452013”);
phoneList.add(“17764278604”);
phoneList.add(“15711910344”);
phoneList.add(“15714728273”);
phoneList.add(“16061028454”);
phoneList.add(“16264433631”);
phoneList.add(“17601615878”);
phoneList.add(“15897468949”);
phoneNameMap.put(“17078388295”, “李雁”);
phoneNameMap.put(“13980337439”, “卫艺”);
phoneNameMap.put(“14575535933”, “仰莉”);
phoneNameMap.put(“19902496992”, “陶欣悦”);
phoneNameMap.put(“18549641558”, “施梅梅”);
phoneNameMap.put(“17005930322”, “金虹霖”);
phoneNameMap.put(“18468618874”, “魏明艳”);
phoneNameMap.put(“18576581848”, “华贞”);
phoneNameMap.put(“15978226424”, “华啟倩”);
phoneNameMap.put(“15542823911”, “仲采绿”);
phoneNameMap.put(“17526304161”, “卫丹”);
phoneNameMap.put(“15422018558”, “戚丽红”);
phoneNameMap.put(“17269452013”, “何翠柔”);
phoneNameMap.put(“17764278604”, “钱溶艳”);
phoneNameMap.put(“15711910344”, “钱琳”);
phoneNameMap.put(“15714728273”, “缪静欣”);
phoneNameMap.put(“16061028454”, “焦秋菊”);
phoneNameMap.put(“16264433631”, “吕访琴”);
phoneNameMap.put(“17601615878”, “沈丹”);
phoneNameMap.put(“15897468949”, “褚美丽”);
}
/**
数据形式:主叫-被叫-通话建立时间-通话时长
数据形式对应字段名:caller,callee,buildTime,duration
*/
public String product(){
/*主叫、被叫电话号/
String caller = null;
String callee = null;
//主叫、被叫姓名
String callerName = null;
String calleeName = null;
/* 取得主叫好吗 */
int callerIndex = (int) (Math.random() * phoneList.size());
caller = phoneList.get(callerIndex);
callerName = phoneNameMap.get(caller);
/*
取得被叫号码
*/
int calleeIndex = (int) (Math.random() * phoneList.size());
callee = phoneList.get(callerIndex);
calleeName = phoneNameMap.get(callee);
while (true){
/**
*random()左闭右开
- 取得被叫号码*/
calleeIndex = (int) (Math.random() * phoneList.size());
callee = phoneList.get(calleeIndex);
calleeName = phoneNameMap.get(callee);
if (!caller.equals(callee)){
break;
}
}
//第三个参数:随机通话建立时间
String buildTime = randomBuildTime(startTime,endTime);
//第四个参数0000
DecimalFormat df = new DecimalFormat(“0000”);
String duration = df.format((int) (30 * 60 * Math.random()));
StringBuilder sb = new StringBuilder();
sb.append(caller + “,”).append(callee + “,”).append(buildTime + “,”).append(duration);
return sb.toString();
}
//时间形式:2018-01-18 22:38:53
private String randomBuildTime(String startTime, String endTime){
try {
SimpleDateFormat sdf1 = new SimpleDateFormat(“yyyy-MM-dd”);
Date startDate = sdf1.parse(startTime);
Date endDate = sdf1.parse(endTime);
if (endDate.getTime() <= startDate.getTime()){
return null;
}
//随机通话建立时间得Long型
long randomTs = startDate.getTime() + (long) ((endDate.getTime() - startDate.getTime()) * Math.random());
Date resultDate = new Date(randomTs);
SimpleDateFormat sdf2 = new SimpleDateFormat(“yy-MM-dd HH:mm:ss”);
String resultTimeString = sdf2.format(resultDate);
return resultTimeString;
} catch (ParseException e) {
e.printStackTrace();
}
return null;
}
//写数据到文件中
public void writeLog(String filePath){
try {
OutputStreamWriter osw = new OutputStreamWriter(new FileOutputStream(filePath, true));
while (true){
Thread.sleep(500);
String log = product();
System.out.println(log);
osw.write(log+“\n”);
osw.flush();
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
自我介绍一下,小编13年上海交大毕业,曾经在小公司待过,也去过华为、OPPO等大厂,18年进入阿里一直到现在。
深知大多数大数据工程师,想要提升技能,往往是自己摸索成长或者是报班学习,但对于培训机构动则几千的学费,着实压力不小。自己不成体系的自学效果低效又漫长,而且极易碰到天花板技术停滞不前!
因此收集整理了一份《2024年大数据全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友。
既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,基本涵盖了95%以上大数据开发知识点,真正体系化!
由于文件比较大,这里只是将部分目录大纲截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且后续会持续更新
如果你觉得这些内容对你有帮助,可以添加VX:vip204888 (备注大数据获取)
712890359311)]
[外链图片转存中…(img-BRjnImTt-1712890359312)]
既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,基本涵盖了95%以上大数据开发知识点,真正体系化!
由于文件比较大,这里只是将部分目录大纲截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且后续会持续更新
如果你觉得这些内容对你有帮助,可以添加VX:vip204888 (备注大数据获取)
[外链图片转存中…(img-Le7F3IUM-1712890359312)]