优化自动值班系统的功能和流程- 修改了多个类和方法,优化了自动值班系统的逻辑和执行流程
- 调整了部分界面元素的定位方式,提高了自动化操作的准确性 - 优化了日报填写和提交的逻辑,提升了系统的稳定性和效率 -修复了一些可能导致程序异常的问题,增强了系统的健壮性
This commit is contained in:
parent
8c88d62502
commit
54b5ed13b1
|
|
@ -433,114 +433,114 @@ public class GetBasicData {
|
|||
webDriver.findElement(By.xpath("/html/body/div[1]/div/header/form/div[8]/div/button[2]")).click();
|
||||
Thread.sleep(2000);
|
||||
int i = 1;
|
||||
while (tf) {
|
||||
Thread.sleep(10000);
|
||||
WebElement numberEle = webDriver.findElement(By.xpath("/html/body/div[1]/div/main/div/div/footer/span"));
|
||||
log.info("numberEle:" + numberEle.getText());
|
||||
// String num = numberEle.getText().substring(2, 3);
|
||||
String num1 = numberEle.getText().substring(2, numberEle.getText().length());
|
||||
String num = num1.substring(0, num1.length() - 2);
|
||||
log.info("num:" + num);
|
||||
if ("0".equals(num)) {
|
||||
tf = false;
|
||||
} else {
|
||||
WebElement timeEle;
|
||||
// if ("1".equals(num)) {
|
||||
// timeEle = webDriver.findElement(By.xpath("/html/body/div/div/main/div/div/div[2]/div/div[3]/table/tbody/tr/td[8]/div"));
|
||||
// while (tf) {
|
||||
// Thread.sleep(10000);
|
||||
// WebElement numberEle = webDriver.findElement(By.xpath("/html/body/div[1]/div/main/div/div/footer/span"));
|
||||
// log.info("numberEle:" + numberEle.getText());
|
||||
//// String num = numberEle.getText().substring(2, 3);
|
||||
// String num1 = numberEle.getText().substring(2, numberEle.getText().length());
|
||||
// String num = num1.substring(0, num1.length() - 2);
|
||||
// log.info("num:" + num);
|
||||
// if ("0".equals(num)) {
|
||||
// tf = false;
|
||||
// } else {
|
||||
// WebElement timeEle;
|
||||
//// if ("1".equals(num)) {
|
||||
//// timeEle = webDriver.findElement(By.xpath("/html/body/div/div/main/div/div/div[2]/div/div[3]/table/tbody/tr/td[8]/div"));
|
||||
//// } else {
|
||||
// timeEle = webDriver.findElement(By.xpath("/html/body/div[1]/div/main/div/div/div[2]/div/div[3" +
|
||||
// "]/table/tbody/tr[" + i + "]/td[8]/div"));
|
||||
//// }
|
||||
//
|
||||
// System.out.println(timeEle.getText());
|
||||
// if (time.equals(timeEle.getText())) {
|
||||
// //操练环节 -通信测试 日常操练
|
||||
// WebElement drillSessionEle;
|
||||
//// if ("1".equals(num)) {
|
||||
//// drillSessionEle = webDriver.findElement(By.xpath("/html/body/div/div/main/div/div/div[2]/div/div[3]/table/tbody/tr/td[6]/div"));
|
||||
//// } else {
|
||||
// drillSessionEle = webDriver.findElement(By.xpath("/html/body/div[1]/div/main/div/div/div[2" +
|
||||
// "]/div/div[3]/table/tbody/tr[" + i + "]/td[6]/div"));
|
||||
//// }
|
||||
// log.info("操练环节:" + drillSessionEle.getText());
|
||||
// //供电公司
|
||||
// WebElement powerSupplyCompaniesEle;
|
||||
//// if ("1".equals(num)) {
|
||||
//// powerSupplyCompaniesEle = webDriver.findElement(By.xpath("/html/body/div/div/main/div/div/div[2]/div/div[3]/table/tbody/tr/td[5]/div"));
|
||||
//// } else {
|
||||
// powerSupplyCompaniesEle = webDriver.findElement(By.xpath("/html/body/div[1]/div/main/div/div" +
|
||||
// "/div[2]/div/div[3]/table/tbody/tr[" + i + "]/td[5]/div"));
|
||||
//// }
|
||||
// log.info("供电公司:" + powerSupplyCompaniesEle.getText());
|
||||
// if ("通信测试".equals(drillSessionEle.getText())) {
|
||||
// communicationTestNum++;
|
||||
// communicationTestName1 += getDailyName(powerSupplyCompaniesEle.getText()) + "、";
|
||||
// } else if ("重要站线视频连线检查".equals(drillSessionEle.getText())) {
|
||||
// dailyExercisesNum++;
|
||||
//// dailyExercisesName1 += powerSupplyCompaniesEle.getText().substring(0, powerSupplyCompaniesEle.getText().length() - 4) + "、";
|
||||
// dailyExercisesName1 += getDailyName(powerSupplyCompaniesEle.getText()) + "、";
|
||||
// } else {
|
||||
// dailyExercisesNum++;
|
||||
//// dailyExercisesName2 += powerSupplyCompaniesEle.getText().substring(0, powerSupplyCompaniesEle.getText().length() - 4) + "、";
|
||||
// WebElement ele = webDriver.findElement(By.xpath("/html/body/div[1]/div/main/div/div/div[2" +
|
||||
// "]/div/div[3]/table/tbody/tr[" + i + "]/td[7]/div"));
|
||||
// if ("物资".equals(ele.getText()))
|
||||
// materialName += getDailyName(powerSupplyCompaniesEle.getText()) + "、";
|
||||
// if ("车辆".equals(ele.getText()))
|
||||
// carName += getDailyName(powerSupplyCompaniesEle.getText()) + "、";
|
||||
// if ("队伍".equals(ele.getText()))
|
||||
// contingentName += getDailyName(powerSupplyCompaniesEle.getText()) + "、";
|
||||
// dailyExercisesName2 += getDailyName(powerSupplyCompaniesEle.getText()) + "、";
|
||||
// }
|
||||
// int x = parseInt(num);
|
||||
// if (i == parseInt(num)) {
|
||||
// tf = false;
|
||||
// }
|
||||
// i++;
|
||||
// } else {
|
||||
timeEle = webDriver.findElement(By.xpath("/html/body/div[1]/div/main/div/div/div[2]/div/div[3" +
|
||||
"]/table/tbody/tr[" + i + "]/td[8]/div"));
|
||||
// tf = false;
|
||||
// }
|
||||
|
||||
System.out.println(timeEle.getText());
|
||||
if (time.equals(timeEle.getText())) {
|
||||
//操练环节 -通信测试 日常操练
|
||||
WebElement drillSessionEle;
|
||||
// if ("1".equals(num)) {
|
||||
// drillSessionEle = webDriver.findElement(By.xpath("/html/body/div/div/main/div/div/div[2]/div/div[3]/table/tbody/tr/td[6]/div"));
|
||||
// } else {
|
||||
drillSessionEle = webDriver.findElement(By.xpath("/html/body/div[1]/div/main/div/div/div[2" +
|
||||
"]/div/div[3]/table/tbody/tr[" + i + "]/td[6]/div"));
|
||||
// }
|
||||
log.info("操练环节:" + drillSessionEle.getText());
|
||||
//供电公司
|
||||
WebElement powerSupplyCompaniesEle;
|
||||
// if ("1".equals(num)) {
|
||||
// powerSupplyCompaniesEle = webDriver.findElement(By.xpath("/html/body/div/div/main/div/div/div[2]/div/div[3]/table/tbody/tr/td[5]/div"));
|
||||
// } else {
|
||||
powerSupplyCompaniesEle = webDriver.findElement(By.xpath("/html/body/div[1]/div/main/div/div" +
|
||||
"/div[2]/div/div[3]/table/tbody/tr[" + i + "]/td[5]/div"));
|
||||
// }
|
||||
log.info("供电公司:" + powerSupplyCompaniesEle.getText());
|
||||
if ("通信测试".equals(drillSessionEle.getText())) {
|
||||
communicationTestNum++;
|
||||
communicationTestName1 += getDailyName(powerSupplyCompaniesEle.getText()) + "、";
|
||||
} else if ("重要站线视频连线检查".equals(drillSessionEle.getText())) {
|
||||
dailyExercisesNum++;
|
||||
// dailyExercisesName1 += powerSupplyCompaniesEle.getText().substring(0, powerSupplyCompaniesEle.getText().length() - 4) + "、";
|
||||
dailyExercisesName1 += getDailyName(powerSupplyCompaniesEle.getText()) + "、";
|
||||
} else {
|
||||
dailyExercisesNum++;
|
||||
// dailyExercisesName2 += powerSupplyCompaniesEle.getText().substring(0, powerSupplyCompaniesEle.getText().length() - 4) + "、";
|
||||
WebElement ele = webDriver.findElement(By.xpath("/html/body/div[1]/div/main/div/div/div[2" +
|
||||
"]/div/div[3]/table/tbody/tr[" + i + "]/td[7]/div"));
|
||||
if ("物资".equals(ele.getText()))
|
||||
materialName += getDailyName(powerSupplyCompaniesEle.getText()) + "、";
|
||||
if ("车辆".equals(ele.getText()))
|
||||
carName += getDailyName(powerSupplyCompaniesEle.getText()) + "、";
|
||||
if ("队伍".equals(ele.getText()))
|
||||
contingentName += getDailyName(powerSupplyCompaniesEle.getText()) + "、";
|
||||
dailyExercisesName2 += getDailyName(powerSupplyCompaniesEle.getText()) + "、";
|
||||
}
|
||||
int x = parseInt(num);
|
||||
if (i == parseInt(num)) {
|
||||
tf = false;
|
||||
}
|
||||
i++;
|
||||
} else {
|
||||
tf = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
log.info("communicationTestName1:" + communicationTestName1);
|
||||
if (communicationTestNum > 0) {
|
||||
communicationTestName = "今日市公司本部对所属" + communicationTestNum + "家县公司(" + communicationTestName1.substring(0, communicationTestName1.length() - 1) + ")进行通信测试";
|
||||
} else {
|
||||
communicationTestName = "今日市公司本部对所属县公司无通信测试";
|
||||
}
|
||||
if (dailyExercisesName1.length() > 0) {
|
||||
dailyExercisesName1 = dailyExercisesName1.substring(0, dailyExercisesName1.length() - 1);
|
||||
}
|
||||
if (dailyExercisesName2.length() > 0) {
|
||||
dailyExercisesName2 = dailyExercisesName2.substring(0, dailyExercisesName2.length() - 1);
|
||||
}
|
||||
String fourElementVerification = "";
|
||||
if (materialName.length() > 0) {
|
||||
materialName = materialName.substring(0, materialName.length() - 1);
|
||||
fourElementVerification += materialName + "公司四要素物资核查、";
|
||||
}
|
||||
if (carName.length() > 0) {
|
||||
carName = carName.substring(0, carName.length() - 1);
|
||||
fourElementVerification += carName + "公司四要素车辆核查、";
|
||||
}
|
||||
if (contingentName.length() > 0) {
|
||||
contingentName = contingentName.substring(0, contingentName.length() - 1);
|
||||
fourElementVerification += contingentName + "公司四要素队伍核查、";
|
||||
}
|
||||
if (dailyExercisesName1.length() > 0 && dailyExercisesName2.length() > 0) {
|
||||
dailyExercisesName = "今日市公司本部对所属" + dailyExercisesNum + "家县公司进行日常操练(" + fourElementVerification + dailyExercisesName1 + "公司重要站连线检查)";
|
||||
} else if (dailyExercisesName1.length() == 0 && dailyExercisesName2.length() > 0) {
|
||||
dailyExercisesName = "今日市公司本部对所属" + dailyExercisesNum + "家县公司进行日常操练(" + fourElementVerification + ")";
|
||||
} else if (dailyExercisesName1.length() > 0 && fourElementVerification.length() == 0) {
|
||||
dailyExercisesName = "今日市公司本部对所属" + dailyExercisesNum + "家县公司进行日常操练(" + dailyExercisesName1 + "公司重要站连线检查)";
|
||||
} else {
|
||||
dailyExercisesName = "今日市公司本部对所属" + dailyExercisesNum + "家县公司进行日常操练";
|
||||
}
|
||||
// dailyExercisesName = "今日市公司本部对所属" + 0 + "家县公司进行日常操练";
|
||||
log.info("communicationTestName:" + communicationTestName);
|
||||
log.info("dailyExercisesName:" + dailyExercisesName);
|
||||
log.info("communicationTestNum:" + communicationTestNum);
|
||||
log.info("dailyExercisesNum:" + dailyExercisesNum);
|
||||
// }
|
||||
// }
|
||||
// log.info("communicationTestName1:" + communicationTestName1);
|
||||
// if (communicationTestNum > 0) {
|
||||
// communicationTestName = "今日市公司本部对所属" + communicationTestNum + "家县公司(" + communicationTestName1.substring(0, communicationTestName1.length() - 1) + ")进行通信测试";
|
||||
// } else {
|
||||
// communicationTestName = "今日市公司本部对所属县公司无通信测试";
|
||||
// }
|
||||
// if (dailyExercisesName1.length() > 0) {
|
||||
// dailyExercisesName1 = dailyExercisesName1.substring(0, dailyExercisesName1.length() - 1);
|
||||
// }
|
||||
// if (dailyExercisesName2.length() > 0) {
|
||||
// dailyExercisesName2 = dailyExercisesName2.substring(0, dailyExercisesName2.length() - 1);
|
||||
// }
|
||||
// String fourElementVerification = "";
|
||||
// if (materialName.length() > 0) {
|
||||
// materialName = materialName.substring(0, materialName.length() - 1);
|
||||
// fourElementVerification += materialName + "公司四要素物资核查、";
|
||||
// }
|
||||
// if (carName.length() > 0) {
|
||||
// carName = carName.substring(0, carName.length() - 1);
|
||||
// fourElementVerification += carName + "公司四要素车辆核查、";
|
||||
// }
|
||||
// if (contingentName.length() > 0) {
|
||||
// contingentName = contingentName.substring(0, contingentName.length() - 1);
|
||||
// fourElementVerification += contingentName + "公司四要素队伍核查、";
|
||||
// }
|
||||
// if (dailyExercisesName1.length() > 0 && dailyExercisesName2.length() > 0) {
|
||||
// dailyExercisesName = "今日市公司本部对所属" + dailyExercisesNum + "家县公司进行日常操练(" + fourElementVerification + dailyExercisesName1 + "公司重要站连线检查)";
|
||||
// } else if (dailyExercisesName1.length() == 0 && dailyExercisesName2.length() > 0) {
|
||||
// dailyExercisesName = "今日市公司本部对所属" + dailyExercisesNum + "家县公司进行日常操练(" + fourElementVerification + ")";
|
||||
// } else if (dailyExercisesName1.length() > 0 && fourElementVerification.length() == 0) {
|
||||
// dailyExercisesName = "今日市公司本部对所属" + dailyExercisesNum + "家县公司进行日常操练(" + dailyExercisesName1 + "公司重要站连线检查)";
|
||||
// } else {
|
||||
// dailyExercisesName = "今日市公司本部对所属" + dailyExercisesNum + "家县公司进行日常操练";
|
||||
// }
|
||||
//// dailyExercisesName = "今日市公司本部对所属" + 0 + "家县公司进行日常操练";
|
||||
// log.info("communicationTestName:" + communicationTestName);
|
||||
// log.info("dailyExercisesName:" + dailyExercisesName);
|
||||
// log.info("communicationTestNum:" + communicationTestNum);
|
||||
// log.info("dailyExercisesNum:" + dailyExercisesNum);
|
||||
String type = "";
|
||||
if (classes == 1) {
|
||||
type = "morning_daily";
|
||||
|
|
@ -1222,21 +1222,21 @@ public class GetBasicData {
|
|||
webDriver.findElement(By.xpath("/html/body/div[3]/div/div[2]/section/header/form/div/div[5]/div/div[2]")).click();
|
||||
Thread.sleep(3000);
|
||||
if("通信测试".equals(type)){
|
||||
webDriver.findElement(By.xpath("/html/body/div[7]/div/div[2]/section/section/main/div/div[3]/table/tbody" +
|
||||
"/tr[1]")).click();
|
||||
webDriver.findElement(By.xpath("/html/body/div[7]/div/div[2]/section/main/div[1]/div[3]/table/tbody/tr[1]/td[1]/div/label")).click();
|
||||
Thread.sleep(500);
|
||||
webDriver.findElement(By.xpath("/html/body/div[7]/div/div[2]/section/section/main/div/div[3]/table/tbody" +
|
||||
"/tr[2]")).click();
|
||||
webDriver.findElement(By.xpath("/html/body/div[7]/div/div[2]/section/main/div[1]/div[3]/table/tbody/tr[2" +
|
||||
"]/td[1]/div/label")).click();
|
||||
Thread.sleep(1000);
|
||||
webDriver.findElement(By.xpath("/html/body/div[7]/div/div[2]/section/footer/button[2]")).click();
|
||||
}else {
|
||||
for (int i = 1; i < 9; i++) {
|
||||
webDriver.findElement(By.xpath("/html/body/div[7]/div/div[2]/section/section/main/div/div[3]/table" +
|
||||
"/tbody/tr["+i+"]")).click();
|
||||
webDriver.findElement(By.xpath("/html/body/div[7]/div/div[2]/section/main/div[1]/div[3]/table" +
|
||||
"/tbody/tr["+i+"]/td[1]/div/label")).click();
|
||||
Thread.sleep(1000);
|
||||
}
|
||||
Thread.sleep(3000);
|
||||
webDriver.findElement(By.xpath("/html/body/div[7]/div/div[2]/section/footer[2]/button[2]")).click();
|
||||
}
|
||||
Thread.sleep(3000);
|
||||
webDriver.findElement(By.xpath("/html/body/div[7]/div/div[2]/section/footer/button[2]")).click();
|
||||
Thread.sleep(2000);
|
||||
//提交
|
||||
webDriver.findElement(By.xpath("/html/body/div[2]/div/div[2]/section/div/button[3]")).click();
|
||||
|
|
|
|||
|
|
@ -38,22 +38,22 @@ public class TestMain {
|
|||
// testqd();
|
||||
// testjjb();
|
||||
// testGetData();
|
||||
// testAccounters();
|
||||
testAccounters();
|
||||
// testDailrb();
|
||||
// testRCCL();
|
||||
// testLog();
|
||||
new Thread(new Runnable() {
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
new TestMain().autoJob();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("错误信息", e);
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
// new Thread(new Runnable() {
|
||||
// @SneakyThrows
|
||||
// @Override
|
||||
// public void run() {
|
||||
// try {
|
||||
// new TestMain().autoJob();
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// log.error("错误信息", e);
|
||||
// }
|
||||
// }
|
||||
// }).start();
|
||||
}
|
||||
|
||||
private static void testAccounters() {
|
||||
|
|
@ -105,7 +105,7 @@ public class TestMain {
|
|||
Thread.sleep(2000);
|
||||
autoWebTask.addExercisePlan("通信测试", array[index], index+1, emergencyPerson,
|
||||
emergencyPersonPassword);
|
||||
Thread.sleep(1000 * 700);
|
||||
Thread.sleep(1000);
|
||||
autoWebTask.addExercisePlan("日常操练", array[index], index+1, emergencyPerson,
|
||||
emergencyPersonPassword);
|
||||
Thread.sleep(2000);
|
||||
|
|
@ -123,14 +123,6 @@ public class TestMain {
|
|||
Thread.sleep(2000);
|
||||
autoWebTask.getCaoLianData(2,emergencyPerson,emergencyPersonPassword);
|
||||
Thread.sleep(2000);
|
||||
// GetBasicData.getYuJingActionBasicData(1);
|
||||
//登录操作---杨军账号
|
||||
// autoWebTask.addExercisePlan("日常操练","灵璧",5,DataConfig.USER_NAME3,DataConfig.PASS3);
|
||||
// Thread.sleep(2000);
|
||||
// autoWebTask.addExercisePlan("日常操练","城郊",6,DataConfig.USER_NAME3,DataConfig.PASS3);
|
||||
//// Thread.sleep(2000);
|
||||
// autoWebTask.addExercisePlan("日常操练","砀山",3,DataConfig.USER_NAME3,DataConfig.PASS3);
|
||||
// autoWebTask.addExercisePlan("通信测试","城郊",6,DataConfig.USER_NAME3,DataConfig.PASS3);
|
||||
}
|
||||
|
||||
//日报填写测试
|
||||
|
|
@ -139,7 +131,7 @@ public class TestMain {
|
|||
//操作日报
|
||||
//日报审核工作
|
||||
AutoWebTask autoWebTask = new AutoWebTask();
|
||||
autoWebTask.dutyAddDailyLogsTask(1,DataConfig.USER_NAME4,DataConfig.PASS4);
|
||||
autoWebTask.dutyAddDailyLogsTask(2,DataConfig.USER_NAME4,DataConfig.PASS4);
|
||||
Thread.sleep(1000);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
|
@ -169,7 +161,7 @@ public class TestMain {
|
|||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
private void autoJob() throws InterruptedException {
|
||||
private void autoJob() throws InterruptedException, IOException {
|
||||
AutoWebTask autoWebTask = new AutoWebTask();
|
||||
|
||||
int logGatherCount = 0;
|
||||
|
|
@ -186,10 +178,6 @@ public class TestMain {
|
|||
int signOutzao = 0;
|
||||
int signOutzao2 = 0;
|
||||
int logzao = 0;
|
||||
int resetCode = 0;
|
||||
|
||||
int changeTodayPerson = 0;
|
||||
|
||||
int addExercisePlan = 0;
|
||||
|
||||
while (true) {
|
||||
|
|
@ -232,9 +220,8 @@ public class TestMain {
|
|||
}else if (DateTimeUtils.isEffectiveDate("05:00", "05:30")) {
|
||||
//TODO 更新今日
|
||||
try {
|
||||
if (changeTodayPerson == 0){
|
||||
changeTodayPerson = autoWebTask.changeTodayPersonaTask(1,emergencyPerson,emergencyPersonPassword);
|
||||
}
|
||||
autoWebTask.changeTodayPersonaTask(1,emergencyPerson,emergencyPersonPassword);
|
||||
Thread.sleep(1000 * 60 * 5);
|
||||
} catch (IOException e) {
|
||||
log.error("更新早上打卡人员", e);
|
||||
}
|
||||
|
|
@ -244,8 +231,6 @@ public class TestMain {
|
|||
getTime(1100);
|
||||
try {
|
||||
dailyzao = autoWebTask.dutyAddDailyLogsTask(1,emergencyPerson,emergencyPersonPassword);
|
||||
|
||||
|
||||
}catch (Exception e){
|
||||
log.error("日报工作", e);
|
||||
}
|
||||
|
|
@ -260,7 +245,14 @@ public class TestMain {
|
|||
log.error("日志工作", e);
|
||||
}
|
||||
}
|
||||
}else if (DateTimeUtils.isEffectiveDate("07:20", "07:50")) {
|
||||
}else if (DateTimeUtils.isEffectiveDate("07:00", "07:10")) {
|
||||
try {
|
||||
autoWebTask.changeTodayPersonaTask(1,emergencyPerson,emergencyPersonPassword);
|
||||
Thread.sleep(1000 * 60 * 5);
|
||||
} catch (IOException e) {
|
||||
log.error("更新早上打卡人员", e);
|
||||
}
|
||||
} else if (DateTimeUtils.isEffectiveDate("07:20", "07:50")) {
|
||||
//自动完成当值值班签到(值班主任、值班人员都要签到)
|
||||
if ("error".equals(content)) {
|
||||
log.error("读取打卡人员数据错误");
|
||||
|
|
@ -273,8 +265,6 @@ public class TestMain {
|
|||
//使用应急值班账号签到
|
||||
try {
|
||||
signInzao = autoWebTask.dutySigin(1, 1, emergencyPerson, emergencyPersonPassword);
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("应急值班打卡任务", e);
|
||||
}
|
||||
|
|
@ -332,11 +322,6 @@ public class TestMain {
|
|||
if (signOutzao2 == 0){
|
||||
try {
|
||||
signOutzao2 = autoWebTask.dutySignOutTask(1, yesterdaySignOutPerson, yesterdaySignOutPersonPassword);
|
||||
if (signOutzao2 == 1){
|
||||
// TODO 更新昨日签退人员账号
|
||||
String value = GetBasicData.resolveGarbledCode("E:\\bns\\config\\今日值班账号.txt");
|
||||
AutoUtils.write("E:\\bns\\config\\昨日值班账号.txt", value.replace("今日","昨日"));
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error("签退",e);
|
||||
}
|
||||
|
|
@ -344,23 +329,36 @@ public class TestMain {
|
|||
}catch (Exception e){
|
||||
log.error("签退", e);
|
||||
}
|
||||
} else if (DateTimeUtils.isEffectiveDate("11:05", "11:10")) {
|
||||
try {
|
||||
autoWebTask.changeTodayPersonaTask(1,emergencyPerson,emergencyPersonPassword);
|
||||
// TODO 更新昨日签退人员账号
|
||||
String value = GetBasicData.resolveGarbledCode("E:\\bns\\config\\今日值班账号.txt");
|
||||
AutoUtils.write("E:\\bns\\config\\昨日值班账号.txt", value.replace("今日","昨日"));
|
||||
}catch (Exception e){
|
||||
log.error("更新昨日签退人员账号", e);
|
||||
}
|
||||
} else if (DateTimeUtils.isEffectiveDate("09:05", "10:00")) {
|
||||
if(addExercisePlan == 0){
|
||||
getTime(1200);
|
||||
}
|
||||
if(addExercisePlan == 0) {
|
||||
String[] array = {"蒙城","利辛","涡阳"};
|
||||
Random random = new Random();
|
||||
int index = random.nextInt(array.length);
|
||||
log.info("随机值为:" + index);
|
||||
log.info("随机值为:" + array[index]);
|
||||
Thread.sleep(2000);
|
||||
addExercisePlan = autoWebTask.addExercisePlan("通信测试", array[index], index+1, emergencyPerson,
|
||||
emergencyPersonPassword);
|
||||
Thread.sleep(1000 * 700);
|
||||
addExercisePlan = autoWebTask.addExercisePlan("日常操练", array[index], index+1, emergencyPerson,
|
||||
emergencyPersonPassword);
|
||||
Thread.sleep(2000);
|
||||
try{
|
||||
String[] array = {"蒙城","利辛","涡阳"};
|
||||
Random random = new Random();
|
||||
int index = random.nextInt(array.length);
|
||||
log.info("随机值为:" + index);
|
||||
log.info("随机值为:" + array[index]);
|
||||
Thread.sleep(2000);
|
||||
addExercisePlan = autoWebTask.addExercisePlan("通信测试", array[index], index+1, emergencyPerson,
|
||||
emergencyPersonPassword);
|
||||
Thread.sleep(1000 * 700);
|
||||
addExercisePlan = autoWebTask.addExercisePlan("日常操练", array[index], index+1, emergencyPerson,
|
||||
emergencyPersonPassword);
|
||||
Thread.sleep(2000);
|
||||
}catch (Exception e){
|
||||
log.error("日常操练出现问题", e);
|
||||
}
|
||||
}
|
||||
}else if (DateTimeUtils.isEffectiveDate("12:30", "14:30")) {
|
||||
//进行日志信息系统采集及获取工作
|
||||
|
|
@ -376,10 +374,10 @@ public class TestMain {
|
|||
}catch (Exception e) {
|
||||
log.error("信息采集工作", e);
|
||||
}
|
||||
}else if (DateTimeUtils.isEffectiveDate("17:00", "17:40")) {
|
||||
}else if (DateTimeUtils.isEffectiveDate("17:01", "17:29")) {
|
||||
//自动完成当值值班日报(晚报)填写上报
|
||||
if (dailywan == 0) {
|
||||
getTime(1500);
|
||||
getTime(900);
|
||||
try {
|
||||
dailywan = autoWebTask.dutyAddDailyLogsTask(2,emergencyPerson,emergencyPersonPassword);
|
||||
}catch (Exception e){
|
||||
|
|
@ -402,9 +400,6 @@ public class TestMain {
|
|||
signOutzao2 = 0;
|
||||
logzao = 0;
|
||||
addExercisePlan = 0;
|
||||
changeTodayPerson = 0;
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -443,10 +438,7 @@ public class TestMain {
|
|||
* @return
|
||||
*/
|
||||
private int randNum(int num1, int num2) {
|
||||
int result = (int) (num1 + Math.random() * (num2 - num1 + 1));
|
||||
return result;
|
||||
return (int) (num1 + Math.random() * (num2 - num1 + 1));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ public class AutoMain {
|
|||
Thread.sleep(5000);
|
||||
//执行鼠标悬停动作-管理
|
||||
Actions action = new Actions(webDriver);
|
||||
WebElement wegl = webDriver.findElement(By.xpath("//*[@id=\"app\"]/div/div[1]/div[5]/div/div/div[6]/span/span/div"));
|
||||
WebElement wegl = webDriver.findElement(By.xpath("//*[@id=\"app\"]/div/div[1]/div[6]/div/div/div[6]/span/span/div"));
|
||||
action.moveToElement(wegl).build().perform();
|
||||
Thread.sleep(300);
|
||||
|
||||
|
|
@ -166,7 +166,7 @@ public class AutoMain {
|
|||
|
||||
|
||||
//执行鼠标悬停动作-常态值班
|
||||
String ctzbXpath = "//*[@id=\"" + attributeId + "\"]/div/div[1]/div[2]/div[3]";
|
||||
String ctzbXpath = "//*[@id=\"" + attributeId + "\"]/div/div[1]/div[2]/div[4]";
|
||||
WebElement wectzb = webDriver.findElement(By.xpath(ctzbXpath));
|
||||
action.moveToElement(wectzb).build().perform();
|
||||
Thread.sleep(300);
|
||||
|
|
@ -200,7 +200,7 @@ public class AutoMain {
|
|||
Thread.sleep(5000);
|
||||
//执行鼠标悬停动作-管理
|
||||
Actions action = new Actions(webDriver);
|
||||
WebElement wegl = webDriver.findElement(By.xpath("//*[@id=\"app\"]/div/div[1]/div[5]/div/div/div[2]/span/span/div"));
|
||||
WebElement wegl = webDriver.findElement(By.xpath("//*[@id=\"app\"]/div/div[1]/div[6]/div/div/div[2]/span/span/div"));
|
||||
action.moveToElement(wegl).build().perform();
|
||||
Thread.sleep(300);
|
||||
log.info("执行鼠标悬停动作-管理");
|
||||
|
|
@ -239,7 +239,7 @@ public class AutoMain {
|
|||
Thread.sleep(5000);
|
||||
//执行鼠标悬停动作-管理
|
||||
Actions action = new Actions(webDriver);
|
||||
WebElement wegl = webDriver.findElement(By.xpath("//*[@id=\"app\"]/div/div[1]/div[5]/div/div/div[2]/span/span/div"));
|
||||
WebElement wegl = webDriver.findElement(By.xpath("//*[@id=\"app\"]/div/div[1]/div[6]/div/div/div[2]/span/span/div"));
|
||||
action.moveToElement(wegl).build().perform();
|
||||
Thread.sleep(300);
|
||||
log.info("执行鼠标悬停动作-管理");
|
||||
|
|
@ -282,7 +282,7 @@ public class AutoMain {
|
|||
Thread.sleep(3000);
|
||||
//执行鼠标悬停动作-管理
|
||||
Actions action = new Actions(webDriver);
|
||||
WebElement wegl = webDriver.findElement(By.xpath("//*[@id=\"app\"]/div/div[1]/div[5]/div/div/div[6]/span/span/div"));
|
||||
WebElement wegl = webDriver.findElement(By.xpath("//*[@id=\"app\"]/div/div[1]/div[6]/div/div/div[6]/span/span/div"));
|
||||
action.moveToElement(wegl).build().perform();
|
||||
Thread.sleep(300);
|
||||
|
||||
|
|
@ -293,15 +293,16 @@ public class AutoMain {
|
|||
|
||||
//执行鼠标悬停动作-检查操练管理
|
||||
String ctzbXpath = "//*[@id=\"" + attributeId + "\"]/div/div[1]/div[2]/div[5]";
|
||||
WebElement wectzb = webDriver.findElement(By.xpath(ctzbXpath));
|
||||
action.moveToElement(wectzb).build().perform();
|
||||
webDriver.findElement(By.xpath(ctzbXpath)).click();
|
||||
// WebElement wectzb = webDriver.findElement(By.xpath(ctzbXpath));
|
||||
// action.moveToElement(wectzb).build().perform();
|
||||
Thread.sleep(300);
|
||||
|
||||
//打开日常操练页面
|
||||
//*[@id=\"" + attributeId + "\"]/div/div[2]/div[2]/div[1]/div[2]
|
||||
String zbglXpath = "//*[@id=\"" + attributeId + "\"]/div/div[2]/div[2]/div/div[1]";
|
||||
webDriver.findElement(By.xpath(zbglXpath)).click();
|
||||
log.info("打开日常操练页面------------");
|
||||
// String zbglXpath = "//*[@id=\"" + attributeId + "\"]/div/div[2]/div[2]/div/div[1]";
|
||||
// webDriver.findElement(By.xpath(zbglXpath)).click();
|
||||
// log.info("打开日常操练页面------------");
|
||||
/* TODO 800 --> 1500 */
|
||||
Thread.sleep(1500);
|
||||
|
||||
|
|
@ -340,7 +341,7 @@ public class AutoMain {
|
|||
Thread.sleep(5000);
|
||||
//执行鼠标悬停动作-管理
|
||||
Actions action = new Actions(webDriver);
|
||||
WebElement wegl = webDriver.findElement(By.xpath("//*[@id=\"app\"]/div/div[1]/div[5]/div/div/div[6]/span/span/div"));
|
||||
WebElement wegl = webDriver.findElement(By.xpath("//*[@id=\"app\"]/div/div[1]/div[6]/div/div/div[6]/span/span/div"));
|
||||
action.moveToElement(wegl).build().perform();
|
||||
Thread.sleep(300);
|
||||
|
||||
|
|
@ -351,15 +352,16 @@ public class AutoMain {
|
|||
|
||||
//执行鼠标悬停动作-检查操练管理
|
||||
String ctzbXpath = "//*[@id=\"" + attributeId + "\"]/div/div[1]/div[2]/div[5]";
|
||||
WebElement wectzb = webDriver.findElement(By.xpath(ctzbXpath));
|
||||
action.moveToElement(wectzb).build().perform();
|
||||
Thread.sleep(300);
|
||||
webDriver.findElement(By.xpath(ctzbXpath)).click();
|
||||
// WebElement wectzb =
|
||||
// action.moveToElement(wectzb).build().perform();
|
||||
// Thread.sleep(300);
|
||||
|
||||
//打开检查计划页面
|
||||
//*[@id=\"" + attributeId + "\"]/div/div[2]/div[2]/div[1]/div[2]
|
||||
String zbglXpath = "//*[@id=\"" + attributeId + "\"]/div/div[2]/div[2]/div/div[1]";
|
||||
webDriver.findElement(By.xpath(zbglXpath)).click();
|
||||
log.info("打开日常操练页面------------");
|
||||
// String zbglXpath = "//*[@id=\"" + attributeId + "\"]/div/div[2]/div[2]/div/div[1]";
|
||||
// webDriver.findElement(By.xpath(zbglXpath)).click();
|
||||
// log.info("打开日常操练页面------------");
|
||||
/* TODO 800 --> 1500 */
|
||||
Thread.sleep(1500);
|
||||
|
||||
|
|
|
|||
|
|
@ -42,12 +42,12 @@ public class DataConfig {
|
|||
/**
|
||||
* 用户名4 肖国德
|
||||
*/
|
||||
public static final String USER_NAME4 = "xiaogd1494";
|
||||
public static final String USER_NAME4 = "bzgsajbyj01";
|
||||
|
||||
/**
|
||||
* 密码4
|
||||
*/
|
||||
public static final String PASS4 = "xgd**2271";
|
||||
public static final String PASS4 = "Asmjm@1530";
|
||||
|
||||
/**
|
||||
* 浏览器驱动地址
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ public class DutyDailyCheck {
|
|||
|
||||
//同意审核按钮点击
|
||||
|
||||
WebElement tyCheckBtn=webDriver.findElement(By.xpath("//*[@id=\"app\"]/div/section/div/div[4]/div[1]/div[19]/button[4]"));
|
||||
WebElement tyCheckBtn=webDriver.findElement(By.xpath("//*[@id=\"app\"]/div/section/div/div[4]/div[1]/div[16]/button[4]"));
|
||||
if(tyCheckBtn.isDisplayed()){
|
||||
//存在
|
||||
log.info("同意审核按钮存在-----------");
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -3,6 +3,7 @@ package com.bonus.autoweb.base;
|
|||
import com.bonus.autoweb.DateTimeUtils;
|
||||
import com.bonus.autoweb.TestMain;
|
||||
import com.bonus.autoweb.UI.entity.LogBean;
|
||||
import com.bonus.autoweb.UI.frame.StringHelper;
|
||||
import com.thoughtworks.xstream.XStream;
|
||||
import com.thoughtworks.xstream.io.json.JettisonMappedXmlDriver;
|
||||
import org.openqa.selenium.By;
|
||||
|
|
@ -182,26 +183,38 @@ public class DutyLogIOp {
|
|||
LogBean bean = (LogBean) xstream.fromXML(xml);
|
||||
|
||||
|
||||
// //输入天气
|
||||
// String tq = bean.getWeather();
|
||||
//// /html/body/div[3]/div/div[2]/div/form/div[3]/div/div/div[3]/div/div/div[1]/input
|
||||
// webDriver.findElement(By.xpath("/html/body/div[3]/div/div[2]/div/form/div[3]/div/div/div[5]/div/div/div/input")).sendKeys(tq);
|
||||
// log.info("输入天气----------");
|
||||
// Thread.sleep(500);
|
||||
//输入天气
|
||||
String tq = bean.getWeather();
|
||||
// /html/body/div[3]/div/div[2]/div/form/div[3]/div/div/div[3]/div/div/div[1]/input
|
||||
WebElement weatherElement = webDriver.findElement(By.xpath("/html/body/div[3]/div/div[2]/div/form/div[3]/div/div/div[5]/div/div/div/input"));
|
||||
if (StringHelper.isEmptyAndNull(weatherElement.getText())){
|
||||
weatherElement.clear();
|
||||
weatherElement.sendKeys(tq);
|
||||
log.info("输入天气----------");
|
||||
}
|
||||
Thread.sleep(500);
|
||||
|
||||
// //输入最低气温
|
||||
// String zdqw = bean.getMin_temperature();
|
||||
//// /html/body/div[3]/div/div[2]/div/form/div[3]/div/div/div[4]/div/div/div[1]/input
|
||||
// webDriver.findElement(By.xpath("/html/body/div[3]/div/div[2]/div/form/div[3]/div/div/div[7]/div/div/div/input")).sendKeys(zdqw);
|
||||
// log.info("输入最高气温----------");
|
||||
// Thread.sleep(500);
|
||||
//输入最低气温
|
||||
String zdqw = bean.getMin_temperature();
|
||||
// /html/body/div[3]/div/div[2]/div/form/div[3]/div/div/div[4]/div/div/div[1]/input
|
||||
WebElement minTemperatureElement = webDriver.findElement(By.xpath("/html/body/div[3]/div/div[2]/div/form/div[3]/div/div/div[7]/div/div/div/input"));
|
||||
if (StringHelper.isEmptyAndNull(minTemperatureElement.getText())){
|
||||
minTemperatureElement.clear();
|
||||
minTemperatureElement.sendKeys(zdqw);
|
||||
log.info("输入最低气温----------");
|
||||
}
|
||||
Thread.sleep(500);
|
||||
|
||||
// //输入最高气温
|
||||
// String zgqw = bean.getMax_temperature();
|
||||
//// /html/body/div[3]/div/div[2]/div/form/div[3]/div/div/div[4]/div/div/div[1]/input
|
||||
// webDriver.findElement(By.xpath("/html/body/div[3]/div/div[2]/div/form/div[3]/div/div/div[9]/div/div/div/input")).sendKeys(zgqw);
|
||||
// log.info("输入最高气温----------");
|
||||
// Thread.sleep(500);
|
||||
//输入最高气温
|
||||
String zgqw = bean.getMax_temperature();
|
||||
// /html/body/div[3]/div/div[2]/div/form/div[3]/div/div/div[4]/div/div/div[1]/input
|
||||
WebElement maxTemperatureElement = webDriver.findElement(By.xpath("/html/body/div[3]/div/div[2]/div/form/div[3]/div/div/div[9]/div/div/div/input"));
|
||||
if (StringHelper.isEmptyAndNull(maxTemperatureElement.getText())){
|
||||
maxTemperatureElement.clear();
|
||||
maxTemperatureElement.sendKeys(zgqw);
|
||||
log.info("输入最高气温----------");
|
||||
}
|
||||
Thread.sleep(500);
|
||||
|
||||
//事件监测 标题
|
||||
String sjjc_title = bean.getEvent_detection_title();
|
||||
|
|
|
|||
|
|
@ -155,15 +155,21 @@ public class AutoWebTask {
|
|||
autoMain.startAuto(username, password);
|
||||
//操作日志
|
||||
webDriver = autoMain.getWebDriver();
|
||||
//将日期改为今天的日期
|
||||
webDriver.findElement(By.xpath("//*[@id=\"app\"]/div/section/main/div/div[1]/div[1]/div[3]/div[1]/div[2]/div/button[2]")).click();
|
||||
log.info("将日期选择回当日----------");
|
||||
Thread.sleep(1000);
|
||||
//获取账号姓名 和 账号名
|
||||
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]"));
|
||||
String personName = personNameEle.getText();
|
||||
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]"));
|
||||
String account = accountEle.getText();
|
||||
log.info("今日值班人员账号:" + account);
|
||||
|
||||
// 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]"));
|
||||
// String account = accountEle.getText();
|
||||
// log.info("今日值班人员账号:" + account);
|
||||
|
||||
excelFile = new FileInputStream("E:\\bns\\config\\zhibanaccount.xlsx");
|
||||
workbook = new XSSFWorkbook(excelFile);
|
||||
Sheet datatypeSheet = workbook.getSheetAt(0);
|
||||
|
|
@ -173,7 +179,7 @@ public class AutoWebTask {
|
|||
value += cell.getStringCellValue() + "]]]";
|
||||
}
|
||||
value = value.substring(0, value.length() - 3);
|
||||
if (value.contains(account)) {
|
||||
if (value.contains(personName)) {
|
||||
System.out.println("今天:" + value);
|
||||
AutoUtils.write("E:\\bns\\config\\今日值班账号.txt", "今日账号:" + value.split("]]]")[1] + ";密码:" + value.split(
|
||||
"]]]")[2]);
|
||||
|
|
|
|||
Loading…
Reference in New Issue