一、自我介绍

研发10Y+, 后端技术负责;  

技术专长:后端、java、技术解决方案;

项目经验:中台建设经验,业务系统研发;


二、技术分享

解析生成csv文件

//-------------------------------------------------------------
// [工具方法-不用改]
//-------------------------------------------------------------
public static String getRetInt(String str, Pattern p) {

List<String> retaA1 = Splitter.on(",").splitToList(str);
if (retaA1.size() == 2) {

Matcher m1 = p.matcher(retaA1.get(1));
int a = 0;
while (m1.find()) {
a = Integer.parseInt(m1.group().trim());
}
return String.valueOf(a);
} else if (retaA1.size() == 3) {
Matcher m1 = p.matcher(retaA1.get(1));
int a = 0;
while (m1.find()) {
a = Integer.parseInt(m1.group().trim());
}

Matcher m2 = p.matcher(retaA1.get(2));
int b = 0;
while (m2.find()) {
b = Integer.parseInt(m2.group().trim());
}
return String.valueOf(a + b);
} else {
return "==";
}
}

/**
* CSV文件生成方法 -- [工具方法-不用改]
*
* @param head 文件头
* @param dataList 数据列表
* @param outPutPath 文件输出路径
* @param filename 文件名
* @return
*/
public static File createCSVFile(List<Object> head, List<List<Object>> dataList, String outPutPath, String filename) {

File csvFile = null;
BufferedWriter csvWtriter = null;
try {
csvFile = new File(outPutPath + File.separator + filename + ".csv");
File parent = csvFile.getParentFile();
if (parent != null && !parent.exists()) {
parent.mkdirs();
}
csvFile.createNewFile();

// GB2312使正确读取分隔符","
csvWtriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(
csvFile), "GBK"), 1024);
// 写入文件头部
writeRow(head, csvWtriter);

// 写入文件内容
for (List<Object> row : dataList) {
writeRow(row, csvWtriter);
}
csvWtriter.flush();
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
csvWtriter.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return csvFile;
}

/**
* 写一行数据方法 -- [工具方法-不用改]
*
* @param row
* @param csvWriter
* @throws IOException
*/
private static void writeRow(List<Object> row, BufferedWriter csvWriter) throws IOException {
// 写入文件头部
for (Object data : row) {
StringBuffer sb = new StringBuffer();
String rowStr = sb.append("\"").append(data).append("\",").toString();
csvWriter.write(rowStr);
}
csvWriter.newLine();
}


双指针获取List的subList

//算法!!!算法!!!算法!!!算法!!!算法!!!算法!!!算法!!!算法!!!算法!!!
for (int i = 0; i < indexArray.size(); i++) {

List<String> subList = null;
if (i < indexArray.size() - 1) {
int startIndex = indexArray.get(i);
int endIndex = indexArray.get(i + 1);
subList = tmpList.subList(startIndex, endIndex);
} else if (i == indexArray.size() - 1) {

if (indexArray.get(i) == tmpList.size() - 1) {
int startIndex = indexArray.get(i);
int endIndex = startIndex;
subList = Lists.newArrayList(tmpList.get(startIndex));
} else {
int startIndex = indexArray.get(i);
int endIndex = tmpList.size() ;
subList = tmpList.subList(startIndex, endIndex);
}
}
//算法!!!算法!!!算法!!!算法!!!算法!!!算法!!!算法!!!算法!!!算法!!!



三、立一个flag!

2023

升值加薪,

工作能有新的进展,带更多的人,赚更多的💰。

领导力、执行力比2022强;