账号及校验更改
This commit is contained in:
parent
abe4ef0db9
commit
5ab08bb841
6
pom.xml
6
pom.xml
|
|
@ -84,7 +84,11 @@
|
|||
<artifactId>slf4j-log4j12</artifactId>
|
||||
<version>1.7.26</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml</artifactId>
|
||||
<version>4.1.2</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
|
@ -377,7 +377,7 @@ public class GetBasicData {
|
|||
logBean.setGeneral_chronicles_content(logBean.getGeneral_chronicles_content());
|
||||
insertData(null, logBean, "log");
|
||||
log.info("天气预警日志更新完成");
|
||||
dailyBean.setWarning_company(data + code + dailyContentArrayArray[28] + code_chlid2);
|
||||
dailyBean.setWarning_company(data + code+code_child + dailyContentArrayArray[28] + code_chlid2);
|
||||
|
||||
//一、总体情况
|
||||
dailyBean.setOverall(data + dailyContentArrayArray[2].trim() + (classes == 1 ? data3 + "08:00," : data2 + "17:30" +
|
||||
|
|
@ -387,7 +387,7 @@ public class GetBasicData {
|
|||
dailyBean2.setOverall(data + dailyContentArrayArray[2].trim() + (classes == 1 ? data3 + "08:00," : data2 + "17:30" +
|
||||
",") + dailyContentArrayArray[3].trim() + code + "对系统检测图层中气象实况风速、温度、降雨进行查看、对专题灾害图层地震、台风防汛进行查看均正常,未对砀山辖区造成影响。通过首页公共气象图层检查砀山境内公共预警正常;降雨预报、预警正常;雷达预报正常。");
|
||||
dailyBean2.setPersonnel_daily_work(dailyBean2.getPersonnel_daily_work());
|
||||
dailyBean2.setWarning_company(data + code + dailyContentArrayArray[28] + code_chlid2);
|
||||
dailyBean2.setWarning_company(data + code+code_child + dailyContentArrayArray[28] + code_chlid2);
|
||||
insertData(dailyBean, null, "morning_daily");
|
||||
insertData(dailyBean2, null, "evening_daily");
|
||||
log.info("日志内容:" + readDutyBean());
|
||||
|
|
@ -407,6 +407,8 @@ public class GetBasicData {
|
|||
String logContent = resolveGarbledCode("E:\\bns\\config\\日志基本信息.txt");
|
||||
String videoContent = resolveGarbledCode("E:\\bns\\config\\变电站名称.txt");
|
||||
String lineContent = resolveGarbledCode("E:\\bns\\config\\线路名称.txt");
|
||||
String maximumLoad = resolveGarbledCode("E:\\bns\\config\\最大负荷.txt");
|
||||
|
||||
// String useContent = resolveGarbledCode("E:\\bns\\config\\七家公司两天记录.txt");
|
||||
String[] dailyContentArrayArray = dailyContent.split("--头部不可修改--");
|
||||
String[] logContentArrayArray = logContent.split("--头部不可修改--");
|
||||
|
|
@ -414,6 +416,7 @@ public class GetBasicData {
|
|||
String[] lineContentArrayArray = lineContent.split("--头部不可修改--");
|
||||
String[] checkContentArrayArray = checkContent.split("资源核查情况:");
|
||||
String[] checkContentNumArrayArray = checkNumContent.split("装备数量:");
|
||||
String[] maximumLoadArr = maximumLoad.split(";");
|
||||
|
||||
// log.info("------开始获取企业停电的天气数据");
|
||||
// log.info("------url:" + DataConfig.weatherUrl);
|
||||
|
|
@ -659,10 +662,12 @@ public class GetBasicData {
|
|||
//二、重要事项
|
||||
dailyBean.setImportant_matters(data + dailyContentArrayArray[5].trim());
|
||||
//随机-1 到 1 直接的两位小数
|
||||
double randomNum = Math.random() * 2 - 1;
|
||||
double randomNum = Math.random() * 8 - 4;
|
||||
double numRandom = (double) Math.round(randomNum * 100) / 100;
|
||||
//三、安全生产情况
|
||||
dailyBean.setSafety_production(data + dailyContentArrayArray[7].trim().split("--")[0] + (String.format("%.2f", Double.parseDouble(dailyContentArrayArray[7].trim().split("--")[1]) + numRandom)) + dailyContentArrayArray[7].trim().split("--")[2]);
|
||||
dailyBean.setSafety_production(data + dailyContentArrayArray[7].trim().split("--")[0] + (String.format("%" +
|
||||
".2f", Double.parseDouble(maximumLoadArr[0].split(":")[1]) + numRandom)) + dailyContentArrayArray[7].trim().split(
|
||||
"--")[2]);
|
||||
//四、值班员日常工作情况
|
||||
dailyBean.setPersonnel_daily_work(data + dailyContentArrayArray[10].trim() + "(4)资源核查情况:20:00至21:00" + checkContentArrayArray[num].trim()
|
||||
+ dailyContentArrayArray[11].trim() + communicationTestName + dailyContentArrayArray[13].trim() + dailyContentArrayArray[14].trim() + dailyExercisesName + dailyContentArrayArray[16].trim() + "砀山公司对" + videoContentStr + "视频监控进行检查,未发现问题,对" + lineContentStr + "线路视频进行检查,视频接入正常。");
|
||||
|
|
@ -737,9 +742,7 @@ public class GetBasicData {
|
|||
//二、重要事项
|
||||
dailyBean2.setImportant_matters(data + dailyContentArrayArray[5].trim());
|
||||
//三、安全生产情况
|
||||
Random random = new Random();
|
||||
//随机-1 到 1 直接的两位小数
|
||||
double randomNum = Math.random() * 2 - 1;
|
||||
double randomNum = Math.random() * 8 - 4;
|
||||
double numRandom = (double) Math.round(randomNum * 100) / 100;
|
||||
|
||||
//四、值班员日常工作情况
|
||||
|
|
@ -773,7 +776,8 @@ public class GetBasicData {
|
|||
dailyBean2.getTwoBean().setVerification_team_num("1");
|
||||
dailyBean2.getTwoBean().setVerification_equip_num(checkContentNumArrayArray[num].split("-")[2]);
|
||||
//三、安全生产情况
|
||||
dailyBean2.setSafety_production(data + dailyContentArrayArray[7].trim().split("--")[0] + (String.format("%.2f", Double.parseDouble(dailyContentArrayArray[7].trim().split("--")[1]) + numRandom)) + dailyContentArrayArray[7].trim().split("--")[2]);
|
||||
dailyBean2.setSafety_production(data + dailyContentArrayArray[7].trim().split("--")[0] + (String.format(
|
||||
"%.2f", Double.parseDouble(maximumLoadArr[1].split(":")[1]) + numRandom)) + dailyContentArrayArray[7].trim().split("--")[2]);
|
||||
insertData(dailyBean2, null, type);
|
||||
|
||||
logBean.setWeather(weatherNight);
|
||||
|
|
@ -968,6 +972,14 @@ public class GetBasicData {
|
|||
// "(6)日常操练情况:14:30至15:00,市公司对所属" + 0 + "家县公司进行日常操练,未发现其他问题" + dailyContentArrayArray[18]);
|
||||
// insertData(null, logBean, "log");
|
||||
// AutoUtils.write("E:\\bns\\config\\七家公司两天记录.txt", useLogArr[1] + "记录:" + useLogArr[2] + "记录:" + 0);
|
||||
String maximumLoad = resolveGarbledCode("E:\\bns\\config\\最大负荷.txt");
|
||||
double randomNum = Math.random() * 8 - 4;
|
||||
double numRandom = (double) Math.round(randomNum * 100) / 100;
|
||||
String[] maximumLoadArr = maximumLoad.split(";");
|
||||
System.out.println(Double.parseDouble(maximumLoadArr[0].split(":")[1])+numRandom);
|
||||
System.out.println(Double.parseDouble(maximumLoadArr[1].split(":")[1])+numRandom);
|
||||
|
||||
|
||||
}
|
||||
|
||||
String[] powerSupplyStations = {"关帝庙中心供电所", "城北中心供电所", "玄庙中心供电所", "周寨中心供电所", "城郊中心供电所", "官庄中心供电所", "李庄中心供电所", "葛集中心供电所", "唐寨中心供电所", "赵屯中心供电所", "朱楼中心供电所", "砀城客服中心供电所",};
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -16,12 +16,14 @@ public class DataConfig {
|
|||
/**
|
||||
* 用户名1 方春芳
|
||||
*/
|
||||
public static final String USER_NAME1 = "fangcf0043";
|
||||
// public static final String USER_NAME1 = "fangcf0043";
|
||||
public static final String USER_NAME1 = "wangxf0016";
|
||||
|
||||
/**
|
||||
* 密码1
|
||||
*/
|
||||
public static final String PASS1 = "fcf--2868";
|
||||
// public static final String PASS1 = "fcf--2868";
|
||||
public static final String PASS1 = "ahdl6851#*";
|
||||
|
||||
/**
|
||||
* 用户名2 王鹤
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.bonus.autoweb.base;
|
||||
|
||||
import com.bonus.autoweb.DateTimeUtils;
|
||||
import com.bonus.autoweb.UI.frame.StringHelper;
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
|
|
@ -175,4 +176,169 @@ public class DutyChangeShifts {
|
|||
|
||||
}
|
||||
|
||||
public int checkIsUpload(int classes, int type, String userName, String pass, int dataType, int frequency) {
|
||||
int count = 0;
|
||||
try {
|
||||
DutyClock dutyClock = new DutyClock(webDriver);
|
||||
String tab = "";
|
||||
String xpaht = "";
|
||||
switch (dataType){
|
||||
case 1:
|
||||
//签到
|
||||
webDriver.findElement(By.xpath("//*[@id=\"app\"]/div/section/main/div/div[1]/div[1]/div[3]/div[1]/div[2]/div/button[2]")).click();
|
||||
tab = "tab-2";
|
||||
if (frequency == 1){
|
||||
if (classes == 1){
|
||||
xpaht = "//*[@id=\"pane-2\"]/div/div[3]/div[1]/div[2]/div[3]/table/tbody/tr[1]/td[3]/div/span";
|
||||
}else{
|
||||
xpaht = "//*[@id=\"pane-2\"]/div/div[3]/div[2]/div[2]/div[3]/table/tbody/tr[1]/td[3]/div/span";
|
||||
}
|
||||
}else{
|
||||
if (classes == 1){
|
||||
xpaht = "//*[@id=\"pane-2\"]/div/div[3]/div[1]/div[2]/div[3]/table/tbody/tr[2]/td[3]/div/span";
|
||||
}else{
|
||||
xpaht = "//*[@id=\"pane-2\"]/div/div[3]/div[2]/div[2]/div[3]/table/tbody/tr[2]/td[3]/div/span";
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
//日报
|
||||
tab = "tab-4";
|
||||
webDriver.findElement(By.xpath("//*[@id=\"app\"]/div/section/main/div/div[1]/div[1]/div[3]/div[1]/div[2]/div/button[2]")).click();
|
||||
if (classes == 1){
|
||||
xpaht = "//*[@id=\"pane-4\"]/div/div[3]/div/div/div[3]/table/tbody/tr[1]/td[3]/div/div";
|
||||
}else{
|
||||
xpaht = "//*[@id=\"pane-4\"]/div/div[3]/div/div/div[3]/table/tbody/tr[2]/td[3]/div/div";
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
//日志
|
||||
tab = "tab-5";
|
||||
if (classes == 1){
|
||||
changeCheckDay();
|
||||
xpaht = "//*[@id=\"pane-5\"]/div/div[3]/div[2]/div/div[3]/table/tbody/tr/td[3]/div";
|
||||
}else{
|
||||
webDriver.findElement(By.xpath("//*[@id=\"app\"]/div/section/main/div/div[1]/div[1]/div[3]/div[1]/div[2]/div/button[2]")).click();
|
||||
xpaht = "//*[@id=\"pane-5\"]/div/div[3]/div[1]/div/div[3]/table/tbody/tr/td[3]/div";
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
//交接班
|
||||
tab = "tab-6";
|
||||
if (frequency == 1){
|
||||
if (classes == 1){
|
||||
changeCheckDay();
|
||||
xpaht = "//*[@id=\"pane-6\"]/div/div[3]/div[2]/div[2]/div[3]/table/tbody/tr[2]/td[3]/div/span";
|
||||
}else{
|
||||
webDriver.findElement(By.xpath("//*[@id=\"app\"]/div/section/main/div/div[1]/div[1]/div[3]/div[1]/div[2]/div/button[2]")).click();
|
||||
xpaht = "//*[@id=\"pane-6\"]/div/div[3]/div[1]/div[2]/div[3]/table/tbody/tr[2]/td[3]/div/span";
|
||||
}
|
||||
}else{
|
||||
if (classes == 1){
|
||||
webDriver.findElement(By.xpath("//*[@id=\"app\"]/div/section/main/div/div[1]/div[1]/div[3]/div[1]/div[2]/div/button[2]")).click();
|
||||
xpaht = "//*[@id=\"pane-6\"]/div/div[3]/div[1]/div[2]/div[3]/table/tbody/tr[1]/td[3]/div/span";
|
||||
}else{
|
||||
webDriver.findElement(By.xpath("//*[@id=\"app\"]/div/section/main/div/div[1]/div[1]/div[3]/div[1]/div[2]/div/button[2]")).click();
|
||||
xpaht = "//*[@id=\"pane-6\"]/div/div[3]/div[2]/div[2]/div[3]/table/tbody/tr[1]/td[3]/div/span";
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
//签退
|
||||
tab = "tab-2";
|
||||
if (frequency == 1){
|
||||
if (classes == 1){
|
||||
changeCheckDay();
|
||||
xpaht = "//*[@id=\"pane-2\"]/div/div[3]/div[2]/div[2]/div[3]/table/tbody/tr[1]/td[4]/div/span";
|
||||
}else{
|
||||
webDriver.findElement(By.xpath("//*[@id=\"app\"]/div/section/main/div/div[1]/div[1]/div[3]/div[1]/div[2]/div/button[2]")).click();
|
||||
xpaht = "//*[@id=\"pane-2\"]/div/div[3]/div[1]/div[2]/div[3]/table/tbody/tr[1]/td[4]/div/span";
|
||||
}
|
||||
}else{
|
||||
if (classes == 1){
|
||||
changeCheckDay();
|
||||
xpaht = "//*[@id=\"pane-2\"]/div/div[3]/div[2]/div[2]/div[3]/table/tbody/tr[2]/td[4]/div/span";
|
||||
}else{
|
||||
webDriver.findElement(By.xpath("//*[@id=\"app\"]/div/section/main/div/div[1]/div[1]/div[3]/div[1]/div[2]/div/button[2]")).click();
|
||||
xpaht = "//*[@id=\"pane-2\"]/div/div[3]/div[1]/div[2]/div[3]/table/tbody/tr[2]/td[4]/div/span";
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
dutyClock.changeTab(tab);
|
||||
WebElement webElement = webDriver.findElement(By.xpath(xpaht));
|
||||
String time = webElement.getText();
|
||||
if (StringHelper.isEmpty(time)){
|
||||
count = 0;
|
||||
log.info("数据类型:"+dataType+"classes:"+classes+"frequency:"+frequency+"上报时间:"+time);
|
||||
}else{
|
||||
log.info("数据类型:"+dataType+"classes:"+classes+"frequency:"+frequency+"上报时间:"+time);
|
||||
count = 1;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("签到任务", e);
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
public void changeCheckDay() throws Exception {
|
||||
Thread.sleep(1000*3);
|
||||
//判断当前日期是不是每月第一天的日期,true
|
||||
log.info("选择前一天----------");
|
||||
int tr = 1;
|
||||
int td = 1;
|
||||
String xpath;
|
||||
if (!DateTimeUtils.isOneDay()) {
|
||||
//不是本月第一天
|
||||
String currentDay = DateTimeUtils.getCurrentDay();
|
||||
log.info("currentDay:"+currentDay);
|
||||
int weekNum = DateTimeUtils.getWeekNum(currentDay);
|
||||
log.info("weekNum:"+weekNum);
|
||||
int dayNum = DateTimeUtils.getWeekOfDate(currentDay);
|
||||
log.info("dayNum:"+dayNum);
|
||||
if (dayNum == 1) {
|
||||
if(DateTimeUtils.getMonthOneDayIs0()){//第一天是0
|
||||
tr = weekNum;
|
||||
}else{
|
||||
tr = weekNum-1;
|
||||
if (weekNum == 1){
|
||||
tr = 5;
|
||||
}
|
||||
}
|
||||
td = 7;
|
||||
}else {
|
||||
if(DateTimeUtils.getMonthOneDayIs0()){//第一天是0
|
||||
tr = weekNum+1;
|
||||
}else{
|
||||
tr = weekNum;
|
||||
}
|
||||
td = dayNum - 1;
|
||||
}
|
||||
xpath = "//*[@id=\"app\"]/div/section/main/div/div[1]/div[1]/div[3]/div[2]/table/tbody/tr[" + tr + "]" + "/td[" + td + "]";
|
||||
} else {
|
||||
//点击上月按钮,切换至上月
|
||||
webDriver.findElement(By.xpath("//*[@id=\"app\"]/div/section/main/div/div[1]/div[1]/div[3]/div[1]/div[2]/div/button[1]")).click();
|
||||
log.info("点击上月按钮,切换至上月----------");
|
||||
Thread.sleep(300);
|
||||
|
||||
//获取上月最后一天日期
|
||||
String mothDay = DateTimeUtils.getBeforeLastMonthdate();
|
||||
//判断上个月最后一天的位置
|
||||
tr = DateTimeUtils.getWeekNum(mothDay);
|
||||
td = DateTimeUtils.getWeekOfDate(mothDay);
|
||||
xpath = "//*[@id=\"app\"]/div/section/main/div/div[1]/div[1]/div[3]/div[2]/table/tbody/tr[" + tr + "]" + "/td[" + td + "]";
|
||||
}
|
||||
log.info("前一天的地址:"+xpath);
|
||||
//选择前一天的日期
|
||||
webDriver.findElement(By.xpath(xpath)).click();
|
||||
log.info("选择前一天的日期----------");
|
||||
Thread.sleep(300);
|
||||
// //将日期选择回当日
|
||||
// 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(300);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -30,6 +30,14 @@ public class DutyClock {
|
|||
Thread.sleep(300);
|
||||
}
|
||||
|
||||
public void changeTab(String tab) throws InterruptedException {
|
||||
Thread.sleep(1000*4);
|
||||
//定位值班打卡并点击
|
||||
webDriver.findElement(By.id(tab)).click();
|
||||
log.info("定位数据类型并点击----------");
|
||||
Thread.sleep(300);
|
||||
}
|
||||
|
||||
/**
|
||||
* 值班打卡操作
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue