下面是实现了Runnable接口的类
package com.dahuatech.salescloud.performance.service.impl;
import java.util.ArrayList;
import java.util.List;
import com.dahuatech.salescloud.performance.model.excel.TaskReportExcel;
/**
-
@ClassName: DealExcel.java
-
@Description:
-
@author : ben.Zhou
-
@version : V1.0
-
@Date : 2021/3/10 10:16
*/
class DealExcel implements Runnable{List list;
private String thread_name;
private Boolean success=false;
public DealExcel(String thread_name,List list) {
this.thread_name = thread_name;
this.list=list;
}public int deal() {
List list_k = new ArrayList<>();
TaskReportExcel k = new TaskReportExcel();
//NutDao dao = Dao.getDao();
for(String s : list) {
k.setEmployeeNo(s);
try {
//dao.insert(k);暂时注释掉
} catch (Exception e) {
System.out.println(s+">>>>>>>>>>>已经插入!");
}
}
return list.size();
}@Override
public void run() {
System.out.println(this.thread_name+“"+Thread.currentThread().getName()+“开始处理…”);
int deal = this.deal();
success = true;
System.out.println(this.thread_name+"”+Thread.currentThread().getName()+“处理完成”+deal+“条数据”);public Boolean getSuccess() {
return success;
}public String getThread_name() {
return thread_name;
}
}
未完待续,请关注下面文章新大陆–多线程–进阶3