系统更新

This commit is contained in:
zfh 2025-02-28 16:27:11 +08:00
parent ac520b2e4c
commit 9d46f884bc
3 changed files with 77 additions and 19 deletions

View File

@ -70,7 +70,18 @@ public class DutyChangeShifts {
//交接事项说明
if (type == 1) {
// /html/body/div[3]/div/div[2]/div/form/div[7]/div/div[1]/textarea
webDriver.findElement(By.xpath("/html/body/div[3]/div/div[2]/div/form/div[2]/div/div[1]/textarea")).sendKeys("正常");
try {
webDriver.findElement(By.xpath("/html/body/div[3]/div/div[2]/div/form/div[2]/div/div[1]/textarea")).sendKeys("正常");
}catch (Exception e){
log.info("交接事项说明div[3]不存在----------");
}
try {
webDriver.findElement(By.xpath("/html/body/div[8]/div/div[2]/div/form/div[2]/div/div[1]/textarea")).sendKeys("正常");
}catch (Exception e){
log.info("交接事项说明div[8]不存在----------");
}
log.info("交接事项说明----------");
Thread.sleep(500);
//提交
@ -175,4 +186,4 @@ public class DutyChangeShifts {
}
}
}

View File

@ -12,7 +12,7 @@ import org.slf4j.Logger;
* 值班打卡
*/
public class DutyClock {
private Logger log = LoggerFactory.getLogger(DutyClock.class);
private Logger log = LoggerFactory.getLogger(DutyClock.class);
private WebDriver webDriver;
@ -21,9 +21,8 @@ public class DutyClock {
}
public void openDutyClock() throws InterruptedException {
Thread.sleep(1000*4);
Thread.sleep(1000 * 4);
//定位值班打卡并点击
webDriver.findElement(By.id("tab-2")).click();
log.info("定位值班打卡并点击----------");
@ -64,14 +63,47 @@ public class DutyClock {
xpaht = "//*[@id=\"pane-2\"]/div/div[3]/div[2]/div[1]/div[2]/button[2]";
}
}
Thread.sleep(1000*4);
Thread.sleep(1000 * 4);
webDriver.findElement(By.xpath(xpaht)).click();
log.info("打卡签到----------");
Thread.sleep(1000*5);
Thread.sleep(1000 * 5);
//判断是否有相应的元素
try {
Thread.sleep(2000);
webDriver.findElement(By.xpath("html/body/div[2]/div/div[3]/button[2]")).click();
log.info("确认提前签到div[2]----------");
} catch (Exception e) {
log.info("无确认框,在时间范围内----------");
}
//判断是否有相应的元素
try {
Thread.sleep(2000);
webDriver.findElement(By.xpath("html/body/div[6]/div/div[3]/button[2]")).click();
log.info("确认提前签到div[6]----------");
} catch (Exception e) {
log.info("无确认框,在时间范围内----------");
}
try {
//点击弹出框确认
webDriver.findElement(By.xpath("/html/body/div[2]/div/div[2]/div/div[2]/div[1]")).click();
} catch (Exception e) {
log.info("当前打卡确认按钮不存在div[2]");
}
try {
//点击弹出框确认
webDriver.findElement(By.xpath("/html/body/div[3]/div/div[2]/div/div[2]/div[1]")).click();
} catch (Exception e) {
log.info("当前打卡按钮不存在div[3]");
}
//点击弹出框确认
webDriver.findElement(By.xpath("/html/body/div[2]/div/div[2]/div/div[2]/div[1]")).click();
// webDriver.findElement(By.xpath("/html/body/div[2]/div/div[2]/div/div[2]/div[1]")).click();
log.info("点击弹出框确认----------");
Thread.sleep(800);
}
@ -99,19 +131,19 @@ public class DutyClock {
td = dayNum - 1;
}*/
if (dayNum == 1) {
if(DateTimeUtils.getMonthOneDayIs0()){//第一天是0
if (DateTimeUtils.getMonthOneDayIs0()) {//第一天是0
tr = weekNum;
}else{
tr = weekNum-1;
if (weekNum == 1){
} else {
tr = weekNum - 1;
if (weekNum == 1) {
tr = 5;
}
}
td = 7;
}else {
if(DateTimeUtils.getMonthOneDayIs0()){//第一天是0
tr = weekNum+1;
}else{
} else {
if (DateTimeUtils.getMonthOneDayIs0()) {//第一天是0
tr = weekNum + 1;
} else {
tr = weekNum;
}
td = dayNum - 1;
@ -124,7 +156,7 @@ public class DutyClock {
Thread.sleep(300);
//获取上月最后一天日期
String mothDay=DateTimeUtils.getBeforeLastMonthdate();
String mothDay = DateTimeUtils.getBeforeLastMonthdate();
//判断上个月最后一天的位置
tr = DateTimeUtils.getWeekNum(mothDay);
td = DateTimeUtils.getWeekOfDate(mothDay);
@ -144,7 +176,7 @@ public class DutyClock {
Thread.sleep(3000);
//进行晚班签退操作
log.info("进行晚班签退操作----------");
dutyClockOper(2,2);
dutyClockOper(2, 2);
Thread.sleep(300);

View File

@ -349,6 +349,21 @@ public class DutyLogIOp {
log.info("提交日志----------");
Thread.sleep(2000);
//判断是否有相应的元素
try{
Thread.sleep(2000);
webDriver.findElement(By.xpath("html/body/div[3]/div/div[3]/button[2]")).click();
log.info("是否确认签到----------");
}catch (Exception e){
log.info("无确认框在时间范围内div[3]----------");
}
try{
Thread.sleep(2000);
webDriver.findElement(By.xpath("html/body/div[4]/div/div[3]/button[2]")).click();
log.info("是否确认签到----------");
}catch (Exception e){
log.info("无确认框在时间范围内div[4]----------");
}
//点击弹出框确认 /html/body/div[4]/div/div[3]/button[2]
WebElement qrBtn = webDriver.findElement(By.xpath("/html/body/div[4]/div/div[3]/button[2]"));
@ -379,7 +394,7 @@ public class DutyLogIOp {
WebElement dutyIframe = webDriver.findElement(By.id("zbgln"));
webDriver.switchTo().frame(dutyIframe);
log.info("定位值班管理iframe的标签----------");
Thread.sleep(500);
Thread.sleep(3000);
}