修改首页总数,读取通讯录账号。

dev_0531
kevin jiang 5 years ago
parent 847ef92b2d
commit 1b2c4dda74

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

Loading…
Cancel
Save