|
@@ -31,16 +31,25 @@ import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.openqa.selenium.By;
|
|
|
+import org.openqa.selenium.WebDriver;
|
|
|
+import org.openqa.selenium.WebElement;
|
|
|
+import org.openqa.selenium.chrome.ChromeDriver;
|
|
|
+import org.openqa.selenium.chrome.ChromeOptions;
|
|
|
+import org.openqa.selenium.support.ui.ExpectedCondition;
|
|
|
+import org.openqa.selenium.support.ui.WebDriverWait;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.context.annotation.Lazy;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
+import java.time.Duration;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+import java.util.concurrent.TimeUnit;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
@@ -231,6 +240,140 @@ public class NoveltyCompareLiteratureService extends ServiceImpl<NoveltyCompareL
|
|
|
compareLiteratureMapper.deleteById(vo.getCompareLitertureId());
|
|
|
}
|
|
|
|
|
|
+ public Map<String, String> getReportInfoFromWD(String caseNo) {
|
|
|
+ ChromeOptions options = new ChromeOptions();
|
|
|
+// options.addArguments("user-data-dir=" + strFileSavePath);
|
|
|
+ options.addArguments("--lang=nl");
|
|
|
+ options.addArguments("--disable-popup-blocking");
|
|
|
+ options.addArguments("--disable-images");
|
|
|
+ options.addArguments("--remote-allow-origins=*");
|
|
|
+// if (isHeadless) {
|
|
|
+// options.addArguments("headless");
|
|
|
+// }
|
|
|
+
|
|
|
+ WebDriver driver = null;
|
|
|
+ Map<String, String> retObject = new HashMap<>();
|
|
|
+
|
|
|
+ try {
|
|
|
+// System.setProperty("webdriver.chrome.driver", chromeDriverPath);
|
|
|
+ driver = new ChromeDriver(options);
|
|
|
+
|
|
|
+ driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
|
|
|
+ driver.manage().timeouts().pageLoadTimeout(100, TimeUnit.SECONDS);
|
|
|
+
|
|
|
+// driver.get(iPEasyWeb);
|
|
|
+
|
|
|
+ //进入登录界面
|
|
|
+ WebElement userField = driver.findElement(By.id("txtUser"));
|
|
|
+ WebElement pwdField = driver.findElement(By.id("txtPwd"));
|
|
|
+ WebElement loginButton = driver.findElement(By.id("btnLogin"));
|
|
|
+ //输入用户名和密码
|
|
|
+ userField.clear();
|
|
|
+// userField.sendKeys(account);
|
|
|
+ pwdField.clear();
|
|
|
+// pwdField.sendKeys(password);
|
|
|
+ //点击登录按钮
|
|
|
+ loginButton.click();
|
|
|
+
|
|
|
+ //关闭提示遮罩层
|
|
|
+ WebElement closeOverlay = null;
|
|
|
+ try {
|
|
|
+ closeOverlay = driver.findElement(By.id("jpwClose"));
|
|
|
+ if (closeOverlay.isDisplayed()) {
|
|
|
+ closeOverlay.click();
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ //点击顶部菜单栏中的案件管理菜单
|
|
|
+ WebElement caseManagementMenu = driver.findElement(By.name("71A7CC35-F597-40E1-9FEF-BE622A3A3B63"));
|
|
|
+ caseManagementMenu.click();
|
|
|
+
|
|
|
+ //点击左侧 查询 菜单
|
|
|
+ WebElement searchMenu = driver.findElement(By.name("c3266ab3-521a-4815-8aaf-7dd0bc5a76af"));
|
|
|
+ searchMenu.click();
|
|
|
+
|
|
|
+ //切换到自定义报表Frame
|
|
|
+ driver.switchTo().frame(1);
|
|
|
+
|
|
|
+ WebElement inputSearch = driver.findElement(By.id("case_volume"));
|
|
|
+ inputSearch.sendKeys(caseNo.trim());
|
|
|
+
|
|
|
+ WebElement btnSearch = driver.findElement(By.id("btn_Search"));
|
|
|
+ btnSearch.click();
|
|
|
+
|
|
|
+ WebElement caseLink = driver.findElement(By.xpath("//a[contains(text()," + caseNo + ")]"));
|
|
|
+ caseLink.click();
|
|
|
+
|
|
|
+ driver.switchTo().parentFrame().switchTo().frame(2);
|
|
|
+
|
|
|
+ WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(20));
|
|
|
+ //等待页面上ID属性值为submitButton的元素加载完成
|
|
|
+ WebElement myElement = wait.until((ExpectedCondition<WebElement>) wd -> {
|
|
|
+ try {
|
|
|
+ if (wd != null) {
|
|
|
+ wd.switchTo().parentFrame().switchTo().frame(2);
|
|
|
+ return wd.findElement(By.id("libase"));
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ });
|
|
|
+
|
|
|
+ myElement.click();
|
|
|
+
|
|
|
+ // 案件号
|
|
|
+ retObject.put("CaseNo", caseNo.trim());
|
|
|
+ //案件名称
|
|
|
+ retObject.put("CaseName", driver.findElement(By.id("p_case_info__case_name")).getAttribute("value"));
|
|
|
+ //客户名称
|
|
|
+ retObject.put("CustomerName", driver.findElement(By.id("p_case_info__customer_id")).getAttribute("value"));
|
|
|
+ //业务类型
|
|
|
+ retObject.put("BusinessType", driver.findElement(By.id("p_case_info__business_type_id")).getAttribute("value"));
|
|
|
+ retObject.put("CaseState", getSelectText(driver.findElement(By.id("p_case_info__case_status_id"))));
|
|
|
+ retObject.put("ApplicationType", getSelectText(driver.findElement(By.id("p_case_info__apply_type_id"))));
|
|
|
+
|
|
|
+ //案件类型
|
|
|
+ retObject.put("CaseType", driver.findElement(By.id("p_case_info__case_type_id")).getAttribute("value"));
|
|
|
+ //委案日期
|
|
|
+ retObject.put("EntrustingDate", driver.findElement(By.id("p_case_info__charge_date")).getAttribute("value"));
|
|
|
+ //案件备注
|
|
|
+ retObject.put("CaseMemo", driver.findElement(By.id("p_case_info__remark")).getAttribute("value"));
|
|
|
+
|
|
|
+ WebElement expandInfoButton = driver.findElement(By.xpath("//span[contains(text(),'扩展信息')]"));
|
|
|
+ expandInfoButton.click();
|
|
|
+ retObject.put("CaseCoefficient", getSelectText(driver.findElement(By.id("p_case_info__case_coefficient_id"))));
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ throw new RuntimeException("An error occurred while retrieving case info", e);
|
|
|
+ } finally {
|
|
|
+ if (driver != null) {
|
|
|
+ driver.quit();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return retObject;
|
|
|
+ }
|
|
|
+
|
|
|
+ public static String getSelectText(WebElement element) {
|
|
|
+ String strValue = element.getAttribute("value");
|
|
|
+
|
|
|
+ if (strValue == null || strValue.isEmpty()) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ List<WebElement> ops = element.findElements(By.tagName("option"));
|
|
|
+ for (WebElement op : ops) {
|
|
|
+ if (op.getAttribute("value").equals(strValue)) {
|
|
|
+ return op.getText();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
public List<Integer> copyCompareFile(List<Integer> ids, Integer toProjectId, Integer fromProjectId) throws Exception {
|
|
|
|
|
|
if (ids == null || ids.size() == 0) {
|