利辛自动化小程序
This commit is contained in:
parent
54a371441b
commit
247a0ec432
|
|
@ -1,5 +1,6 @@
|
||||||
package com.bonus.autoweb.task;
|
package com.bonus.autoweb.task;
|
||||||
|
|
||||||
|
import com.bonus.autoweb.DateTimeUtils;
|
||||||
import com.bonus.autoweb.GetBasicData;
|
import com.bonus.autoweb.GetBasicData;
|
||||||
import com.bonus.autoweb.base.*;
|
import com.bonus.autoweb.base.*;
|
||||||
import org.apache.poi.ss.usermodel.Cell;
|
import org.apache.poi.ss.usermodel.Cell;
|
||||||
|
|
@ -17,6 +18,8 @@ import java.io.BufferedReader;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileReader;
|
import java.io.FileReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 应急指挥中心打卡任务类
|
* 应急指挥中心打卡任务类
|
||||||
|
|
@ -162,26 +165,31 @@ public class AutoWebTask {
|
||||||
"]/table/tbody/tr[1]/td[2]/div/div/p[1]"));
|
"]/table/tbody/tr[1]/td[2]/div/div/p[1]"));
|
||||||
String personLeaderName = personLeaderNameEle.getText();
|
String personLeaderName = personLeaderNameEle.getText();
|
||||||
log.info("今日值班长:" + personLeaderName);
|
log.info("今日值班长:" + personLeaderName);
|
||||||
WebElement accountLeaderEle = webDriver.findElement(By.xpath("//*[@id='pane-1']/div/div[3]/div/div/div[3" +
|
|
||||||
"]/table/tbody/tr[1]/td[2]/div/div/p[2]"));
|
// WebElement accountLeaderEle = webDriver.findElement(By.xpath("//*[@id='pane-1']/div/div[3]/div/div/div[3" +
|
||||||
String accountLeader = accountLeaderEle.getText();
|
// "]/table/tbody/tr[1]/td[2]/div/div/p[2]"));
|
||||||
log.info("今日值班长:" + accountLeader);
|
// String accountLeader = accountLeaderEle.getText();
|
||||||
|
// log.info("今日值班长账号:" + accountLeader);
|
||||||
|
|
||||||
//获取值班员账号姓名 和 账号名
|
//获取值班员账号姓名 和 账号名
|
||||||
WebElement personNameEle = webDriver.findElement(By.xpath("//*[@id='pane-1']/div/div[3]/div/div/div[3" +
|
WebElement personNameEle = webDriver.findElement(By.xpath("//*[@id='pane-1']/div/div[3]/div/div/div[3" +
|
||||||
"]/table/tbody/tr[2]/td[2]/div/div/p[1]"));
|
"]/table/tbody/tr[2]/td[2]/div/div/p[1]"));
|
||||||
String personName = personNameEle.getText();
|
String personName = personNameEle.getText();
|
||||||
log.info("今日值班人员:" + personName);
|
log.info("今日值班人员:" + personName);
|
||||||
WebElement accountEle = webDriver.findElement(By.xpath("//*[@id='pane-1']/div/div[3]/div/div/div[3" +
|
|
||||||
"]/table/tbody/tr[2]/td[2]/div/div/p[2]"));
|
// WebElement accountEle = webDriver.findElement(By.xpath("//*[@id='pane-1']/div/div[3]/div/div/div[3" +
|
||||||
String account = accountEle.getText();
|
// "]/table/tbody/tr[2]/td[2]/div/div/p[2]"));
|
||||||
log.info("今日值班人员账号:" + account);
|
// String account = accountEle.getText();
|
||||||
|
// log.info("今日值班人员账号:" + account);
|
||||||
|
|
||||||
Thread.sleep(3000);
|
Thread.sleep(3000);
|
||||||
excelFile = new FileInputStream("E:\\bns\\config\\zhibanaccount.xlsx");
|
excelFile = new FileInputStream("E:\\bns\\config\\zhibanaccount.xlsx");
|
||||||
workbook = new XSSFWorkbook(excelFile);
|
workbook = new XSSFWorkbook(excelFile);
|
||||||
Sheet datatypeSheet = workbook.getSheetAt(0);
|
Sheet datatypeSheet = workbook.getSheetAt(0);
|
||||||
String personLeaderPassword = "";
|
String personLeaderPassword = "";
|
||||||
String personPassword = "";
|
String personPassword = "";
|
||||||
|
String account = "";
|
||||||
|
String accountLeader = "";
|
||||||
int rowNum = 0;
|
int rowNum = 0;
|
||||||
for (Row row : datatypeSheet) {
|
for (Row row : datatypeSheet) {
|
||||||
String value = "";
|
String value = "";
|
||||||
|
|
@ -190,15 +198,17 @@ public class AutoWebTask {
|
||||||
}
|
}
|
||||||
value = value.substring(0, value.length() - 3);
|
value = value.substring(0, value.length() - 3);
|
||||||
try{
|
try{
|
||||||
if (value.contains(account)) {
|
if (value.contains(personName)) {
|
||||||
personPassword = value.split("]]]")[2];
|
personPassword = value.split("]]]")[2];
|
||||||
|
account = value.split("]]]")[1];
|
||||||
}
|
}
|
||||||
}catch (IndexOutOfBoundsException ignored){
|
}catch (IndexOutOfBoundsException ignored){
|
||||||
log.error("出现异常:"+personName+"账号内容出错,在表格的第"+rowNum+"行附近");
|
log.error("出现异常:"+personName+"账号内容出错,在表格的第"+rowNum+"行附近");
|
||||||
}
|
}
|
||||||
try{
|
try{
|
||||||
if (value.contains(accountLeader)) {
|
if (value.contains(personLeaderName)) {
|
||||||
personLeaderPassword = value.split("]]]")[2];
|
personLeaderPassword = value.split("]]]")[2];
|
||||||
|
accountLeader = value.split("]]]")[1];
|
||||||
}
|
}
|
||||||
}catch (IndexOutOfBoundsException ignored){
|
}catch (IndexOutOfBoundsException ignored){
|
||||||
log.error("出现异常:"+personLeaderName+"账号内容出错,在表格的第"+rowNum+"行附近");
|
log.error("出现异常:"+personLeaderName+"账号内容出错,在表格的第"+rowNum+"行附近");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue