首次提交

This commit is contained in:
tqzhang 2025-01-16 17:38:38 +08:00
parent 2979e64a70
commit b5996a8158
18 changed files with 1471 additions and 0 deletions

View File

@ -0,0 +1,78 @@
package com.bonus.autoweb.UI.entity;
import lombok.Data;
/**
* 日报实体类
* 附件八-输配电线停运及恢复
* @author ztq
*/
@Data
public class AnnexEightBean {
/**
* 特高压
*/
private String transmit_electricity_add_outage_uvh;
private String transmit_electricity_add_repair_uvh;
private String transmit_electricity_add_no_repair_uvh;
private String transmit_electricity_cumulative_outage_uvh;
private String transmit_electricity_cumulative_repair_uvh;
private String transmit_electricity_cumulative_no_repair_uvh;
/**
* 500kv
*/
private String transmit_electricity_add_outage_five;
private String transmit_electricity_add_repair_five;
private String transmit_electricity_add_no_repair_five;
private String transmit_electricity_cumulative_outage_five;
private String transmit_electricity_cumulative_repair_five;
private String transmit_electricity_cumulative_no_repair_five;
/**
* 220/300kv
*/
private String transmit_electricity_add_outage_two;
private String transmit_electricity_add_repair_two;
private String transmit_electricity_add_no_repair_two;
private String transmit_electricity_cumulative_outage_two;
private String transmit_electricity_cumulative_repair_two;
private String transmit_electricity_cumulative_no_repair_two;
/**
* 110/66kv
*/
private String transmit_electricity_add_outage_one;
private String transmit_electricity_add_repair_one;
private String transmit_electricity_add_no_repair_one;
private String transmit_electricity_cumulative_outage_one;
private String transmit_electricity_cumulative_repair_one;
private String transmit_electricity_cumulative_no_repair_one;
/**
* 35kv
*/
private String transmit_electricity_add_outage_three;
private String transmit_electricity_add_repair_three;
private String transmit_electricity_add_no_repair_three;
private String transmit_electricity_cumulative_outage_three;
private String transmit_electricity_cumulative_repair_three;
private String transmit_electricity_cumulative_no_repair_three;
/**
* 10kv
*/
private String transmit_electricity_add_outage_ten;
private String transmit_electricity_add_repair_ten;
private String transmit_electricity_add_no_repair_ten;
private String transmit_electricity_cumulative_outage_ten;
private String transmit_electricity_cumulative_repair_ten;
private String transmit_electricity_cumulative_no_repair_ten;
}

View File

@ -0,0 +1,23 @@
package com.bonus.autoweb.UI.entity;
import lombok.Data;
/**
* 包名称com.bonus.autoweb.UI.entity
* 类名称AnnexTenBean
* 类描述附件十一
* 创建人@author tqzhang
* 创建时间2023年08月01日 13:23
*/
@Data
public class AnnexElevenBean {
private String uhv;
private String fiveHundredKv;
private String twoHundredTwentyKv;
private String oneHundredTenKv;
private String thirtyFiveKv;
private String tenKv;
private String averageWaterLevel;
private String measuredValue;
private String actionHasBeenTaken;
}

View File

@ -0,0 +1,26 @@
package com.bonus.autoweb.UI.entity;
import lombok.Data;
/**
* 包名称com.bonus.autoweb.UI.entity
* 类名称AnnexFiveBean
* 类描述附件五 入境筛查和集中观察场所供电保障情况表
* 创建人@author tqzhang
* 创建时间2023年07月27日 11:29
*/
@Data
public class AnnexFiveBean {
//入境筛选和集中观察场所数量
private String airportPort;
private String venueHospital;
private String guesthouseHotel;
private String safeguardPersonnel;
//投入力量
private String electricallyGuaranteedVehicles;
private String powerGenerationVehicles;
private String dynamo;
private String remark;
}

View File

@ -0,0 +1,58 @@
package com.bonus.autoweb.UI.entity;
import lombok.Data;
/**
* 日报实体类
* 附件四-疫情防控供电保障情况统计表
* @author zys
*/
@Data
public class AnnexFourBean {
/**
* 定点医院
*/
private String designated_hospitals;
/**
* 发热门诊
*/
private String fever_clinic;
/**
* 防疫用品企业
*/
private String epidemic_enterprise;
/**
* 其他重要用户
*/
private String other_important_users;
/**
* 客户用电保障人员
*/
private String customer_power_personnel;
/**
* 电网运维保障人员
*/
private String power_devops_personnel;
/**
* 保电车辆
*/
private String electrically_vehicles;
/**
* 应急发电车
*/
private String emergency_power_vehicles;
/**
* 应急发电机
*/
private String emergency_generator;
}

View File

@ -0,0 +1,24 @@
package com.bonus.autoweb.UI.entity;
import lombok.Data;
/**
* 包名称com.bonus.autoweb.UI.entity
* 类名称AnnexTwelveBean
* 类描述附件十四 超设计风力线路数量统计表
* 创建人@author tqzhang
* 创建时间2023年07月27日 13:15
*/
@Data
public class AnnexFourteenBean {
private String uhv;
private String fiveHundredKv;
private String twoHundredTwentyKv;
private String oneHundredTenKv;
private String thirtyFiveKv;
private String tenKv;
private String averageWaterLevel;
private String measuredValue;
private String designValues;
private String actionHasBeenTaken;
}

View File

@ -0,0 +1,45 @@
package com.bonus.autoweb.UI.entity;
/**
* 日报实体类
* 附件九-台区用户停电及恢复
* @author ztq
*/
import lombok.Data;
@Data
public class AnnexNineBean {
/**
* 台区
*/
private String add_blackout_tai_district;
private String add_repair_tai_district;
private String add_no_repair_tai_district;
private String cumulative_blackout_tai_district;
private String cumulative_repair_tai_district;
private String cumulative_no_repair_tai_district;
/**
* 用户
*/
private String add_blackout_user;
private String add_repair_user;
private String add_no_repair_user;
private String cumulative_blackout_user;
private String cumulative_repair_user;
private String cumulative_no_repair_user;
/**
* 出动抢修力量
* 人员 车辆
*/
private String add_power_personnel;
private String add_power_vehicle;
private String cumulative_power_personnel;
private String cumulative_power_vehicle;
}

View File

@ -0,0 +1,55 @@
package com.bonus.autoweb.UI.entity;
import lombok.Data;
/**
* 日报实体类
* 附件一-操练情况统计表
* @author zys
*/
@Data
public class AnnexOneBean {
/**
* 操练内容选择框
* 四要素检查
* 通信测试
* 重要站线视频连线检查
*/
private String exercise_content;
/**
* 操练数量
* 人员
*/
private String exercise_person_num;
/**
* 操练数量
* 车辆
*/
private String exercise_vehicle_num;
/**
* 操练数量
* 发电车
*/
private String exercise_power_vehicle_num;
/**
* 操练数量
* 发电机
*/
private String exercise_dynamo_num;
/**
* 操练发现的问题
*/
private String exercise_find_problems;
/**
* 备注
*/
private String remark;
}

View File

@ -0,0 +1,69 @@
package com.bonus.autoweb.UI.entity;
import lombok.Data;
/**
* 日报实体类
* 附件七-变电站停运及恢复
* @author ztq
*/
@Data
public class AnnexSevenBean {
/**
* 特高压
*/
private String power_substation_add_outage_uvh;
private String power_substation_add_repair_uvh;
private String power_substation_add_no_repair_uvh;
private String power_substation_cumulative_outage_uvh;
private String power_substation_cumulative_repair_uvh;
private String power_substation_cumulative_no_repair_uvh;
/**
* 500kv
*/
private String power_substation_add_outage_five;
private String power_substation_add_repair_five;
private String power_substation_add_no_repair_five;
private String power_substation_cumulative_outage_five;
private String power_substation_cumulative_repair_five;
private String power_substation_cumulative_no_repair_five;
/**
* 220/300kv
*/
private String power_substation_add_outage_two;
private String power_substation_add_repair_two;
private String power_substation_add_no_repair_two;
private String power_substation_cumulative_outage_two;
private String power_substation_cumulative_repair_two;
private String power_substation_cumulative_no_repair_two;
/**
* 110/66kv
*/
private String power_substation_add_outage_one;
private String power_substation_add_repair_one;
private String power_substation_add_no_repair_one;
private String power_substation_cumulative_outage_one;
private String power_substation_cumulative_repair_one;
private String power_substation_cumulative_no_repair_one;
/**
* 35kv
*/
private String power_substation_add_outage_three;
private String power_substation_add_repair_three;
private String power_substation_add_no_repair_three;
private String power_substation_cumulative_outage_three;
private String power_substation_cumulative_repair_three;
private String power_substation_cumulative_no_repair_three;
}

View File

@ -0,0 +1,47 @@
package com.bonus.autoweb.UI.entity;
import lombok.Data;
/**
* 日报实体类
* 附件六-预警及应急响应情况跟踪表
* @author zys
*/
@Data
public class AnnexSixBean {
/**
* 领导及指挥人员
*/
private String leaders_command_staff;
/**
* 投入力量
* 人员
*/
private String input_amount_person;
/**
* 投入力量
* 车辆
*/
private String input_amount_vehicle;
/**
* 投入力量
* 发电车
*/
private String input_amount_power_vehicle;
/**
* 投入力量
* 发电机
*/
private String input_amount_dynamo;
/**
* 备注
*/
private String remark;
}

View File

@ -0,0 +1,24 @@
package com.bonus.autoweb.UI.entity;
import lombok.Data;
/**
* 包名称com.bonus.autoweb.UI.entity
* 类名称AnnexTenBean
* 类描述附件十
* 创建人@author tqzhang
* 创建时间2023年08月01日 13:23
*/
@Data
public class AnnexTenBean {
private String uhv;
private String fiveHundredKv;
private String twoHundredTwentyKv;
private String oneHundredTenKv;
private String thirtyFiveKv;
private String tenKv;
private String averageWaterLevel;
private String measuredValue;
private String designValues;
private String actionHasBeenTaken;
}

View File

@ -0,0 +1,24 @@
package com.bonus.autoweb.UI.entity;
import lombok.Data;
/**
* 包名称com.bonus.autoweb.UI.entity
* 类名称AnnexTwelveBean
* 类描述附件十三 超设计水位线路数量统计表仅6月-9月报送
* 创建人@author tqzhang
* 创建时间2023年07月27日 13:15
*/
@Data
public class AnnexThirteenBean {
private String uhv;
private String fiveHundredKv;
private String twoHundredTwentyKv;
private String oneHundredTenKv;
private String thirtyFiveKv;
private String tenKv;
private String averageWaterLevel;
private String measuredValue;
private String designValues;
private String actionHasBeenTaken;
}

View File

@ -0,0 +1,55 @@
package com.bonus.autoweb.UI.entity;
import lombok.Data;
/**
* 包名称com.bonus.autoweb.UI.entity
* 类名称AnnexThreeBean
* 类描述附件三 电网生产相关专业员工感染情况统计表
* 创建人@author tqzhang
* 创建时间2023年07月27日 11:18
*/
@Data
public class AnnexThreeBean {
//合计 新增
private String totalAddDiagnosed;
private String totalAddHeal;
private String totalAddSuspected;
//合计 现有
private String totalExistingDiagnosed;
private String totalExistingHeal;
private String totalExistingSuspected;
//电网调度 新增
private String dispatchAddDiagnosed;
private String dispatchAddHeal;
private String dispatchAddSuspected;
//电网调度 现有
private String dispatchExistingDiagnosed;
private String dispatchExistingHeal;
private String dispatchExistingSuspected;
//运维维修 新增
private String repairAddDiagnosed;
private String repairAddHeal;
private String repairAddSuspected;
//运维维修 现有
private String repairExistingDiagnosed;
private String repairExistingHeal;
private String repairExistingSuspected;
//营销服务 新增
private String marketingAddDiagnosed;
private String marketingAddHeal;
private String marketingAddSuspected;
//营销服务 现有
private String marketingExistingDiagnosed;
private String marketingExistingHeal;
private String marketingExistingSuspected;
//电网建设 新增
private String constructionAddDiagnosed;
private String constructionAddHeal;
private String constructionAddSuspected;
//电网建设 现有
private String constructionExistingDiagnosed;
private String constructionExistingHeal;
private String constructionExistingSuspected;
}

View File

@ -0,0 +1,24 @@
package com.bonus.autoweb.UI.entity;
import lombok.Data;
/**
* 包名称com.bonus.autoweb.UI.entity
* 类名称AnnexTwelveBean
* 类描述附件十二 超设计水位变电站数量统计表仅6月-9月报送
* 创建人@author tqzhang
* 创建时间2023年07月27日 13:15
*/
@Data
public class AnnexTwelveBean {
private String uhv;
private String fiveHundredKv;
private String twoHundredTwentyKv;
private String oneHundredTenKv;
private String thirtyFiveKv;
private String tenKv;
private String averageWaterLevel;
private String measuredValue;
private String designValues;
private String actionHasBeenTaken;
}

View File

@ -0,0 +1,53 @@
package com.bonus.autoweb.UI.entity;
import lombok.Data;
/**
* 日报实体类
* 附件二-资源核查问题数量统计表
* @author zys
*/
@Data
public class AnnexTwoBean {
/**
* 核查数量
* 人员
*/
private String verification_person_num;
/**
* 核查数量
* 队伍
*/
private String verification_team_num;
/**
* 核查数量
* 装备
*/
private String verification_equip_num;
/**
* 核查数量
* 物资
*/
private String verification_material_num;
/**
* 核查数量
* 车辆
*/
private String verification_vehicle_num;
/**
* 核查发现的问题
*/
private String verification_find_problems;
/**
* 备注
*/
private String remark;
}

View File

@ -0,0 +1,140 @@
package com.bonus.autoweb.UI.entity;
import lombok.Data;
/**
* 日报实体类
* @author zys
*/
@Data
public class DailyBean {
/**
* 总体情况
*/
private String overall;
/**
* 重要事项
*/
private String important_matters;
/**
* 安全生产情况
*/
private String safety_production;
/**
* 值班员日常工作情况
*/
private String personnel_daily_work;
/**
* 供电保障情况
* 今日重大活动保电情况
*/
private String power_guarantee_today_work;
/**
* 供电保障情况
* 明日重大保电情况
*/
private String power_guarantee_tomorrow_work;
/**
* 供电保障情况
* 今日疫情防控应急保电情况
*/
private String power_guarantee_today_pestilence;
/**
* 预警及应急响应情况
* 公司预警情况
*/
private String warning_company;
/**
* 预警及应急响应情况
* 公司应急响应情况
*/
private String warning_company_impatient;
/**
* 预警及应急响应情况
* 社会突发事件救援及处置情况
*/
private String warning_society_emergency;
/**
* 其他情况说明
*/
private String other_situations;
/**
* 附件一
*/
private AnnexOneBean oneBean;
/**
* 附件二
*/
private AnnexTwoBean twoBean;
/**
* 附件三
*/
private AnnexThreeBean threeBean;
/**
* 附件四
*/
private AnnexFourBean fourBean;
/**
* 附件五
*/
private AnnexFiveBean fiveBean;
/**
* 附件六
*/
private AnnexSixBean sixBean;
/**
* 附件七
*/
private AnnexSevenBean sevenBean;
/**
* 附件八
*/
private AnnexEightBean eightBean;
/**
* 附件九
*/
private AnnexNineBean nineBean;
/**
* 附件十
*/
private AnnexTenBean tenBean;
/**
* 附件十一
*/
private AnnexElevenBean elevenBean;
/**
* 附件十二
*/
private AnnexTwelveBean twelveBean;
/**
* 附件十三
*/
private AnnexThirteenBean thirteenBean;
/**
* 附件十四
*/
private AnnexFourteenBean fourteenBean;
}

View File

@ -0,0 +1,108 @@
package com.bonus.autoweb.UI.entity;
import lombok.Data;
import java.io.Serializable;
/**
* 日志实体类
* @author zys
*/
@Data
public class LogBean implements Serializable {
/**
* 天气
*/
private String weather;
/**
* 最低气温 0/10
*/
private String min_temperature;
/**
* 最高气温 0/10
*/
private String max_temperature;
/**
* 事件检测标题
*/
private String event_detection_title;
/**
* 事件检测内容
*/
private String event_detection_content;
/**
* 保电工作标题
*/
private String power_work_title;
/**
* 保电工作内容
*/
private String power_work_content;
/**
* 资源核查情况标题
*/
private String resource_check_title;
/**
* 资源核查情况内容
*/
private String resource_check_content;
/**
* 通信测试标题
*/
private String communications_test_title;
/**
* 通信测试内容
*/
private String communications_test_content;
/**
* 日常操作情况标题
*/
private String daily_operation_title;
/**
* 日常操作情况内容
*/
private String daily_operation_content;
/**
* 日报提报情况标题
*/
private String daily_submission_title;
/**
* 日报提报情况内容
*/
private String daily_submission_content;
/**
* 预警处置标题
*/
private String warning_disposal_title;
/**
* 预警处置内容
*/
private String warning_disposal_content;
/**
* 一般记事标题
*/
private String general_chronicles_title;
/**
* 一般记事内容
*/
private String general_chronicles_content;
}

View File

@ -0,0 +1,117 @@
package com.bonus.autoweb.UI.entity;
import com.google.gson.annotations.SerializedName;
import lombok.Data;
/**
* FileName: WeatherData
*
* @author tqzhang
* Date: 2024/4/9 14:11
* Description:天气
*/
@Data
public class WeatherData {
private int code;
private WeatherDataChild data;
public static class WeatherDataChild {
private int page;
private int rows;
private String city;
@SerializedName("weather12") // 使用注解指定 JSON 中的字段名
private String weatherNoon;
@SerializedName("weather24") // 使用注解指定 JSON 中的字段名
private String weatherNight;
@SerializedName("temperature1") // 使用注解指定 JSON 中的字段名
private String minTemperature;
@SerializedName("temperature2") // 使用注解指定 JSON 中的字段名
private String maxTemperature;
private String rectime;
public int getPage() {
return page;
}
public void setPage(int page) {
this.page = page;
}
public int getRows() {
return rows;
}
public void setRows(int rows) {
this.rows = rows;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getWeatherNoon() {
return weatherNoon;
}
public void setWeatherNoon(String weatherNoon) {
this.weatherNoon = weatherNoon;
}
public String getWeatherNight() {
return weatherNight;
}
public void setWeatherNight(String weatherNight) {
this.weatherNight = weatherNight;
}
public String getMinTemperature() {
return minTemperature;
}
public void setMinTemperature(String minTemperature) {
this.minTemperature = minTemperature;
}
public String getMaxTemperature() {
return maxTemperature;
}
public void setMaxTemperature(String maxTemperature) {
this.maxTemperature = maxTemperature;
}
public String getRectime() {
return rectime;
}
public void setRectime(String rectime) {
this.rectime = rectime;
}
@Override
public String toString() {
return "WeatherDataChild{" +
"page=" + page +
", rows=" + rows +
", city='" + city + '\'' +
", weatherNoon='" + weatherNoon + '\'' +
", weatherNight='" + weatherNight + '\'' +
", minTemperature='" + minTemperature + '\'' +
", maxTemperature='" + maxTemperature + '\'' +
", rectime='" + rectime + '\'' +
'}';
}
}
@Override
public String toString() {
return "WeatherData{" +
"code=" + code +
", data=" + data +
'}';
}
}

View File

@ -0,0 +1,501 @@
package com.bonus.autoweb.task;
import com.bonus.autoweb.DateTimeUtils;
import com.bonus.autoweb.GetBasicData;
import com.bonus.autoweb.UI.frame.StringHelper;
import com.bonus.autoweb.base.*;
import com.sun.deploy.util.StringUtils;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.slf4j.Logger;
import org.openqa.selenium.WebDriver;
import org.slf4j.LoggerFactory;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
/**
* 应急指挥中心打卡任务类
*/
public class AutoWebTask {
Logger log = LoggerFactory.getLogger(AutoWebTask.class);
/**
* 打卡任务
*
* @param classes 班次1早班 2晚班
*/
public void dutyClockTask(int classes) {
log.info("开始打卡任务---------------------");
log.info("房万春开始打卡任务---------------------");
//使用房万春账号签到
dutySigin(classes, 1, DataConfig.USER_NAME2, DataConfig.PASS2);
try {
Thread.sleep(1000 * 2);
} catch (Exception e) {
log.error("打卡任务", e);
}
//使用韩宏宇账号签到
log.info("韩宏宇开始打卡任务---------------------");
dutySigin(classes, 1, DataConfig.USER_NAME1, DataConfig.PASS1);
}
/**
* 签到任务
*
* @param classes
* @param type
* @param userName
* @param pass
* @throws Exception
*/
public int dutySigin(int classes, int type, String userName, String pass) {
//打开浏览器进入应急指挥中心网站
AutoMain autoMain = new AutoMain();
int count = 0;
try {
autoMain.initDrive(2);
WebDriver webDriver = autoMain.getWebDriver();
autoMain.startAuto(userName, pass);
DutyClock dutyClock = new DutyClock(webDriver);
dutyClock.openDutyClock();
dutyClock.dutyClockOper(classes, type);
//关闭浏览器
autoMain.closeDrive();
count = 1;
} catch (Exception e) {
log.error("签到任务", e);
} finally {
autoMain.closeDrive();
}
return count;
}
/**
* 填报日志和日报任务
*
* @param type 1 早报 2晚报
*/
public int dutyAddDailyLogsTask(int type,String username,String password) {
log.info("开始日报填写任务---------------------");
//打开浏览器进入应急指挥中心网站
AutoMain autoMain = new AutoMain();
WebDriver webDriver;
int count = 0;
try {
autoMain.initDrive(1);
autoMain.startAuto(username, password);
webDriver = autoMain.getWebDriver();
//操作日报
DutyDailyOp ddo = new DutyDailyOp(webDriver);
ddo.openDutyDaily(type);
Thread.sleep(1000);
count = 1;
} catch (Exception e) {
log.error("日报填写任务", e);
}
try {
//日报审核工作
webDriver = autoMain.getWebDriver();
DutyDailyCheck dutyDailyCheck = new DutyDailyCheck(webDriver);
dutyDailyCheck.dutyCheckOp(type);
Thread.sleep(1000);
count = 1;
} catch (Exception e) {
count = 0;
log.error("日报审核工作", e);
} finally {
autoMain.closeDrive();
}
return count;
}
public int dutyAddLogsTask(int type,String username,String password) {
log.info("开始日志填写任务---------------------");
//打开浏览器进入应急指挥中心网站
int count = 0;
AutoMain autoMain = new AutoMain();
WebDriver webDriver;
try {
autoMain.initDrive(1);
autoMain.startAuto(username, password);
//操作日志
webDriver = autoMain.getWebDriver();
DutyLogIOp dlo = new DutyLogIOp(webDriver);
dlo.openDutyLog(type);
count = 1;
} catch (Exception e) {
count = 0;
log.error("操作日志任务", e);
}finally {
autoMain.closeDrive();
}
return count;
}
/**
* 交接班任务
*
* @param classes 班次1早班 2晚班
*/
public int dutyChangeTask1(int classes,String userName,String password) {
log.info("开始交班任务---------------------");
AutoMain autoMain = new AutoMain();
int count = 0;
WebDriver webDriver;
try {
//打开浏览器进入应急指挥中心网站
autoMain.initDrive(2);
autoMain.startAuto(userName, password);
webDriver = autoMain.getWebDriver();
DutyChangeShifts dutyChangeShifts = new DutyChangeShifts(webDriver);
//进行交班工作
if (classes == 2) {
dutyChangeShifts.openChangeShifts();
dutyChangeShifts.dutychangeOper(1, 1);
} else {
dutyChangeShifts.changeDay();
}
Thread.sleep(1000);
//关闭浏览器
autoMain.closeDrive();
count = 1;
} catch (Exception e) {
count = 0;
log.error("交接班任务:" + e);
} finally {
autoMain.closeDrive();
}
return count;
}
public int dutyChangeTask2(int classes,String userName,String password) {
log.info("开始接班任务---------------------");
AutoMain autoMain = new AutoMain();
WebDriver webDriver;
int count = 0;
try {
//打开浏览器进入应急指挥中心网站
autoMain.initDrive(2);
autoMain.startAuto(userName, password);
webDriver = autoMain.getWebDriver();
DutyChangeShifts dutyChangeShifts = new DutyChangeShifts(webDriver);
//进行接班工作
dutyChangeShifts.openChangeShifts();
dutyChangeShifts.dutychangeOper(classes, 2);
//关闭浏览器
autoMain.closeDrive();
count = 1;
} catch (Exception e) {
count = 0;
log.error("交接班任务:" + e);
} finally {
autoMain.closeDrive();
}
return count;
}
/**
* 签退任务
*
* @param classes 班次1早班 2晚班
*/
public int dutySignOutTask(int classes, String userName, String pass) {
log.info("开始签退任务---------------------");
AutoMain autoMain = new AutoMain();
int count = 0;
try {
//打开浏览器进入应急指挥中心网站
autoMain.initDrive(2);
autoMain.startAuto(userName, pass);
WebDriver webDriver = autoMain.getWebDriver();
DutyClock dutyClock = new DutyClock(webDriver);
if (classes == 1) {
dutyClock.changeDay();
} else {
dutyClock.dutyClockOper(1, 2);
}
//关闭浏览器
autoMain.closeDrive();
count = 1;
} catch (Exception e) {
count = 0;
log.error("签退任务", e);
} finally {
autoMain.closeDrive();
}
return count;
}
/**
* 定时获取基础数据
*/
public int getYuJingData(int classes) {
AutoMain autoMain = new AutoMain();
WebDriver webDriver;
int count = 0;
try {
autoMain.initDrive(2);
log.info("初始化驱动成功");
autoMain.startYuJingAuto(DataConfig.USER_NAME1, DataConfig.PASS1);
log.info("startYuJingAuto成功");
//获取基础数据
webDriver = autoMain.getWebDriver();
GetBasicData gbd = new GetBasicData(webDriver);
log.info("获取天气预警值启动----");
gbd.getYuJingBasicData(classes);
count = 1;
} catch (Exception e) {
count = 0;
log.error("获取基础数据任务", e);
}finally {
autoMain.closeDrive();
}
return count;
}
/**
* 预警行动
* @param classes
* @return
*/
public int getYuJingActionData(int classes) {
AutoMain autoMain = new AutoMain();
WebDriver webDriver;
int count = 0;
try {
autoMain.initDrive(2);
log.info("初始化驱动成功");
autoMain.startYuJingActionAuto(DataConfig.USER_NAME1, DataConfig.PASS1);
log.info("startYuJingAuto成功");
//获取基础数据
webDriver = autoMain.getWebDriver();
GetBasicData gbd = new GetBasicData(webDriver);
log.info("获取天气预警值启动----");
gbd.getYuJingActionBasicData(classes);
count = 1;
} catch (Exception e) {
count = 0;
log.error("获取基础数据任务", e);
}finally {
autoMain.closeDrive();
}
return count;
}
public int getCaoLianData(int classes) {
AutoMain autoMain = new AutoMain();
WebDriver webDriver;
int count = 0;
try {
autoMain.initDrive(2);
autoMain.startCaoLianAuto(DataConfig.USER_NAME1, DataConfig.PASS1);
//获取基础数据
webDriver = autoMain.getWebDriver();
GetBasicData gbd = new GetBasicData(webDriver);
gbd.getCaoLianBasicData(classes);
count = 1;
} catch (Exception e) {
count = 0;
log.error("获取基础操练数据任务", e);
}finally {
autoMain.closeDrive();
}
return count;
}
public static void main(String[] args) {
// String content = read("C:\\Users\\24526\\Desktop\\宿州部分代码实例\\七个公司资源核查情况.txt");
// String[] array = content.toString().split("资源核查情况:");
//
// ArrayList<String> list = new ArrayList<String>();
// list.add("1");
// list.add("2");
// list.add("3");
// list.add("4");
// list.add("5");
// list.add("6");
// list.add("7");
// // 打乱顺序
// Collections.shuffle(list);
//// // 遍历取出元素
//// for (String day : list) {
//// System.out.println(day);
//// }
// System.out.println(list.get(0));
// System.out.println(array[Integer.parseInt(list.get(0))].toString());
}
public static String read(String filename){
String line;
StringBuilder content = new StringBuilder();
try {
BufferedReader reader = new BufferedReader(new FileReader(filename));
while ((line = reader.readLine()) != null) {
content.append(line).append("\n");
}
reader.close();
} catch (IOException e) {
System.out.println("An error occurred while reading the text file.");
e.printStackTrace();
}
return content.toString();
}
public int addExercisePlan(String type, String company,int code, String userName, String pass) {
AutoMain autoMain = new AutoMain();
WebDriver webDriver;
int count = 0;
try {
autoMain.initDrive(2);
autoMain.startAddExercisePlan(userName, pass);
//获取基础数据
webDriver = autoMain.getWebDriver();
GetBasicData gbd = new GetBasicData(webDriver);
gbd.addExercisePlan(type,company,code);
count = 1;
} catch (Exception e) {
count = 0;
log.error("获取基础操练数据任务", e);
}finally {
autoMain.closeDrive();
}
return count;
}
public int changeTodayPersonaTask(String username, String password) throws IOException {
log.info("开始更新人员账号---------------------");
//打开浏览器进入应急指挥中心网站
int count = 0;
AutoMain autoMain = new AutoMain();
WebDriver webDriver;
FileInputStream excelFile = null;
Workbook workbook = null;
try {
autoMain.initDrive(1);
autoMain.startAuto(username, password);
//操作日志
webDriver = autoMain.getWebDriver();
Thread.sleep(3000);
//将日期改为今天的日期
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[1]/div/div[3" +
"]/table/tbody/tr[1]/td[2]/div/div/p"));
WebElement personNameEle2 = webDriver.findElement(By.xpath("//*[@id='pane-1']/div/div[3]/div[1]/div/div[3" +
"]/table/tbody/tr[2]/td[2]/div/div/p"));
String personName = personNameEle.getText();
String personName2 = personNameEle2.getText();
log.info("今日值班长:" + personName);
log.info("今日值班人员:" + personName2);
Thread.sleep(3000);
excelFile = new FileInputStream("E:\\bns\\config\\zhibanaccount.xlsx");
workbook = new XSSFWorkbook(excelFile);
Sheet datatypeSheet = workbook.getSheetAt(0);
StringBuilder content1 = new StringBuilder();
StringBuilder content2 = new StringBuilder();
for (Row row : datatypeSheet) {
String value = "";
for (Cell cell : row) {
value += cell.getStringCellValue() + "]]]";
}
value = value.substring(0, value.length() - 3);
if (value.contains(personName)) {
System.out.println("今天值班长:" + value);
content1.append("值班长:").append(value.split("]]]")[1]).append(";密码:").append(value.split(
"]]]")[2]).append("");
}
if (value.contains(personName2)){
System.out.println("今天值班员:" + value);
content2.append("值班员:").append(value.split("]]]")[1]).append(";密码:").append(value.split(
"]]]")[2]);
}
}
System.out.println(content1);
System.out.println(content2);
AutoUtils.write("E:\\bns\\config\\今日值班账号.txt", content1 + content2.toString());
excelFile.close();
count = 1;
} catch (Exception e) {
log.error("操作日志任务", e);
} finally {
autoMain.closeDrive();
}
return count;
}
/**
* 检查数据是否上传
* @param classes 1 早上 2 下午
* @param type
* @param userName 用户名
* @param pass 密码
* @param dataType 数据上传类型
* @param frequency 人员次序
* @return 是否成功
*/
public int checkIsUpload(int classes, int type, String userName, String pass,int dataType,int frequency) {
AutoMain autoMain = new AutoMain();
WebDriver webDriver;
int count = 0;
try {
autoMain.initDrive(2);
autoMain.startAuto(DataConfig.USER_NAME3, DataConfig.PASS3);
//获取基础数据
webDriver = autoMain.getWebDriver();
DutyChangeShifts dutyChangeShifts = new DutyChangeShifts(webDriver);
count = dutyChangeShifts.checkIsUpload(classes,type,userName,pass,dataType,frequency);
autoMain.closeDrive();
} catch (Exception e) {
count = 0;
log.error("获取基础操练数据任务", e);
}finally {
autoMain.closeDrive();
}
return count;
//打开浏览器进入应急指挥中心网站
}
// public void logPreview(int i, String userName3, String pass3) {
// AutoMain autoMain = new AutoMain();
// WebDriver webDriver;
// try {
// autoMain.initDrive(2);
// autoMain.startAuto(DataConfig.USER_NAME3, DataConfig.PASS3);
// //获取基础数据
// webDriver = autoMain.getWebDriver();
// DutyDailyOp ddo = new DutyDailyOp(webDriver);
// ddo.openDutyDaily1(1);
// } catch (Exception e) {
// log.error("操作日志任务", e);
// }finally {
//// autoMain.closeDrive();
// }
// }
}