|
|
@ -10,6 +10,7 @@ import com.kiisoo.ic.store.entity.PrivilageCpUserStoreDO;
|
|
|
|
import com.kiisoo.ic.store.mapper.PrivilageCpUserStoreDOMapper;
|
|
|
|
import com.kiisoo.ic.store.mapper.PrivilageCpUserStoreDOMapper;
|
|
|
|
import com.kiisoo.ic.system.entity.SysTaskDO;
|
|
|
|
import com.kiisoo.ic.system.entity.SysTaskDO;
|
|
|
|
import com.kiisoo.ic.system.mapper.SysTaskDOMapper;
|
|
|
|
import com.kiisoo.ic.system.mapper.SysTaskDOMapper;
|
|
|
|
|
|
|
|
import com.kiisoo.ic.wx.service.QWMailListManageService;
|
|
|
|
import com.lmax.disruptor.BlockingWaitStrategy;
|
|
|
|
import com.lmax.disruptor.BlockingWaitStrategy;
|
|
|
|
import com.lmax.disruptor.RingBuffer;
|
|
|
|
import com.lmax.disruptor.RingBuffer;
|
|
|
|
import com.lmax.disruptor.dsl.Disruptor;
|
|
|
|
import com.lmax.disruptor.dsl.Disruptor;
|
|
|
@ -18,6 +19,7 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
|
import me.chanjar.weixin.common.error.WxErrorException;
|
|
|
|
import me.chanjar.weixin.common.error.WxErrorException;
|
|
|
|
import me.chanjar.weixin.cp.api.WxCpExternalContactService;
|
|
|
|
import me.chanjar.weixin.cp.api.WxCpExternalContactService;
|
|
|
|
import me.chanjar.weixin.cp.api.WxCpService;
|
|
|
|
import me.chanjar.weixin.cp.api.WxCpService;
|
|
|
|
|
|
|
|
import me.chanjar.weixin.cp.bean.WxCpUser;
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
|
|
|
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
|
|
|
import org.apache.poi.ss.usermodel.CellType;
|
|
|
|
import org.apache.poi.ss.usermodel.CellType;
|
|
|
@ -62,6 +64,10 @@ public class CustomerCountJob {
|
|
|
|
private SysTaskDOMapper sysTaskDOMapper;
|
|
|
|
private SysTaskDOMapper sysTaskDOMapper;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private QWMailListManageService qwMailListManageService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void handle(Boolean isAll,SysTaskDO sysTaskDO) throws WxErrorException, IOException {
|
|
|
|
public void handle(Boolean isAll,SysTaskDO sysTaskDO) throws WxErrorException, IOException {
|
|
|
|
|
|
|
|
|
|
|
|
//创建线程池
|
|
|
|
//创建线程池
|
|
|
@ -85,34 +91,42 @@ public class CustomerCountJob {
|
|
|
|
|
|
|
|
|
|
|
|
List<String> cpUserIds = new ArrayList<>();
|
|
|
|
List<String> cpUserIds = new ArrayList<>();
|
|
|
|
if (isAll){
|
|
|
|
if (isAll){
|
|
|
|
File file = new File("/root/account.xls");
|
|
|
|
// File file = new File("/root/account.xls");
|
|
|
|
if (file != null) {
|
|
|
|
// if (file != null) {
|
|
|
|
//获取文件名
|
|
|
|
// //获取文件名
|
|
|
|
String fileName = file.getAbsolutePath();
|
|
|
|
// String fileName = file.getAbsolutePath();
|
|
|
|
InputStream fileInput = new FileInputStream(file);
|
|
|
|
// InputStream fileInput = new FileInputStream(file);
|
|
|
|
// 根据后缀创建EXCEL对象
|
|
|
|
// // 根据后缀创建EXCEL对象
|
|
|
|
Workbook book;
|
|
|
|
// Workbook book;
|
|
|
|
if (ExcelUtils.isExcel2007(fileName)) {
|
|
|
|
// if (ExcelUtils.isExcel2007(fileName)) {
|
|
|
|
book = new XSSFWorkbook(fileInput);
|
|
|
|
// book = new XSSFWorkbook(fileInput);
|
|
|
|
} else {
|
|
|
|
// } else {
|
|
|
|
book = new HSSFWorkbook(fileInput);
|
|
|
|
// book = new HSSFWorkbook(fileInput);
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
// 得到第一个sheet
|
|
|
|
// // 得到第一个sheet
|
|
|
|
Sheet sheet = book.getSheetAt(0);
|
|
|
|
// Sheet sheet = book.getSheetAt(0);
|
|
|
|
// 得到Excel的行数
|
|
|
|
// // 得到Excel的行数
|
|
|
|
int totalRows = sheet.getPhysicalNumberOfRows();
|
|
|
|
// int totalRows = sheet.getPhysicalNumberOfRows();
|
|
|
|
|
|
|
|
//
|
|
|
|
// 循环Excel行数,获取数据
|
|
|
|
// // 循环Excel行数,获取数据
|
|
|
|
for (int r = 1; r < totalRows; r++) {
|
|
|
|
// for (int r = 1; r < totalRows; r++) {
|
|
|
|
Row dataRow = sheet.getRow(r);
|
|
|
|
// Row dataRow = sheet.getRow(r);
|
|
|
|
if (dataRow == null) {
|
|
|
|
// if (dataRow == null) {
|
|
|
|
continue;
|
|
|
|
// continue;
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
dataRow.getCell(0).setCellType(CellType.STRING);
|
|
|
|
// dataRow.getCell(0).setCellType(CellType.STRING);
|
|
|
|
String cpUserId = dataRow.getCell(0).getStringCellValue();
|
|
|
|
// String cpUserId = dataRow.getCell(0).getStringCellValue();
|
|
|
|
cpUserIds.add(cpUserId);
|
|
|
|
// cpUserIds.add(cpUserId);
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<WxCpUser> wxCpUsers = qwMailListManageService.syncUser();
|
|
|
|
|
|
|
|
System.out.println(wxCpUsers.size());
|
|
|
|
|
|
|
|
for (int i = 0; i < wxCpUsers.size(); i++) {
|
|
|
|
|
|
|
|
WxCpUser item = wxCpUsers.get(i);
|
|
|
|
|
|
|
|
String userId = item.getUserId();
|
|
|
|
|
|
|
|
cpUserIds.add(userId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}else {
|
|
|
|
}else {
|
|
|
|
List<PrivilageCpUserStoreDO> privilageCpUserStoreDOS = privilageCpUserStoreDOMapper.selectList(null);
|
|
|
|
List<PrivilageCpUserStoreDO> privilageCpUserStoreDOS = privilageCpUserStoreDOMapper.selectList(null);
|
|
|
|