删除不要的代码
This commit is contained in:
parent
d8c306a651
commit
b40811d2d7
60
pom.xml
60
pom.xml
@ -268,66 +268,6 @@
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>com.lz.crawler</groupId>
|
||||
<artifactId>crawler-tools</artifactId>
|
||||
<version>2.9-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- seleniumhq -->
|
||||
<dependency>
|
||||
<groupId>org.seleniumhq.selenium</groupId>
|
||||
<artifactId>selenium-java</artifactId>
|
||||
<version>3.141.59</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.seleniumhq.selenium</groupId>
|
||||
<artifactId>selenium-support</artifactId>
|
||||
<version>3.141.59</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.seleniumhq.selenium</groupId>
|
||||
<artifactId>selenium-api</artifactId>
|
||||
<version>3.141.59</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.seleniumhq.selenium</groupId>
|
||||
<artifactId>selenium-remote-driver</artifactId>
|
||||
<version>3.141.59</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.seleniumhq.selenium</groupId>
|
||||
<artifactId>selenium-chrome-driver</artifactId>
|
||||
<version>3.141.59</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.seleniumhq.selenium</groupId>
|
||||
<artifactId>selenium-firefox-driver</artifactId>
|
||||
<version>3.141.59</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.codeborne</groupId>
|
||||
<artifactId>phantomjsdriver</artifactId>
|
||||
<version>1.4.4</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.seleniumhq.selenium</groupId>
|
||||
<artifactId>selenium-htmlunit-driver</artifactId>
|
||||
<version>2.52.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- guava -->
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>23.0</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
||||
@ -1,91 +0,0 @@
|
||||
package com.lz.common.utils;
|
||||
|
||||
import com.admin.crawler.engine.utils.ToolsOrderUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.openqa.selenium.Dimension;
|
||||
import org.openqa.selenium.OutputType;
|
||||
import org.openqa.selenium.TakesScreenshot;
|
||||
import org.openqa.selenium.phantomjs.PhantomJSDriver;
|
||||
import org.openqa.selenium.phantomjs.PhantomJSDriverService;
|
||||
import org.openqa.selenium.remote.DesiredCapabilities;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
|
||||
@Slf4j
|
||||
public class CutLongImageUtils {
|
||||
|
||||
public static String getLongImageUrl(String httpUrl) {
|
||||
String url = null;
|
||||
//设置必要参数
|
||||
DesiredCapabilities dcaps = new DesiredCapabilities();
|
||||
//ssl证书支持
|
||||
dcaps.setCapability("acceptSslCerts", true);
|
||||
//截屏支持
|
||||
dcaps.setCapability("takesScreenshot", true);
|
||||
//css搜索支持
|
||||
dcaps.setCapability("cssSelectorsEnabled", true);
|
||||
//js支持
|
||||
dcaps.setJavascriptEnabled(true);
|
||||
if(OSUtils.isMacOSX()){
|
||||
//驱动支持(第二参数表明的是你的phantomjs引擎所在的路径,使用whereis phantomjs可以查看)
|
||||
dcaps.setCapability(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, "/usr/local/bin/phantomjs");
|
||||
}else if(OSUtils.isWindows()){
|
||||
dcaps.setCapability(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, "xxxxxxxxx");
|
||||
}else if(OSUtils.isLinux()){
|
||||
dcaps.setCapability(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, "/usr/bin/phantomjs");
|
||||
}
|
||||
//驱动支持
|
||||
//创建无界面浏览器对象
|
||||
PhantomJSDriver driver = new PhantomJSDriver(dcaps);
|
||||
String fileName1 = null;
|
||||
try {
|
||||
// 让浏览器访问空间主页
|
||||
//设置隐性等待(作用于全局)
|
||||
driver.manage().timeouts().implicitlyWait(1, TimeUnit.SECONDS);
|
||||
|
||||
driver.get(httpUrl);
|
||||
|
||||
|
||||
Long width = (Long) driver.executeScript("return document.body.parentNode.scrollWidth");
|
||||
Long height = (Long) driver.executeScript("return document.body.parentNode.scrollHeight");
|
||||
System.out.println("width=" + width + ",height=" + height);
|
||||
Dimension dimension = new Dimension(width.intValue(), height.intValue());
|
||||
driver.manage().window().setSize(dimension);
|
||||
|
||||
String userHome = System.getProperty("user.home");
|
||||
if (!userHome.endsWith("/")) {
|
||||
userHome = userHome + "/";
|
||||
}
|
||||
userHome = userHome + "captcha/";
|
||||
fileName1 = userHome + ToolsOrderUtil.getUserPoolOrder("pic") + "screenshot1.png";
|
||||
log.info("文件名 = " + fileName1);
|
||||
File screenshot = (File) ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
|
||||
BufferedImage fullImg = ImageIO.read(screenshot);
|
||||
ImageIO.write(fullImg, "png", screenshot);
|
||||
File screenshotLocation = new File(fileName1);
|
||||
FileUtils.copyFile(screenshot, screenshotLocation);
|
||||
url = OSSUtils.uploadImage(fileName1);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
//关闭并退出浏览器
|
||||
System.out.println("=============================");
|
||||
driver.close();
|
||||
driver.quit();
|
||||
File file = new File(fileName1);
|
||||
if (file.exists()) {
|
||||
file.delete();
|
||||
}
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println(getLongImageUrl("https://www.csdn.net/"));
|
||||
}
|
||||
}
|
||||
@ -1,20 +1,14 @@
|
||||
package com.lz.modules.app.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.dingtalk.api.response.OapiCrmAuthGroupMemberListResponse;
|
||||
import com.lz.common.utils.CutLongImageUtils;
|
||||
import com.lz.common.utils.R;
|
||||
import com.lz.common.utils.StringUtil;
|
||||
import com.lz.modules.app.dao.DepartmentsDao;
|
||||
import com.lz.modules.app.dto.ApprovalDto;
|
||||
import com.lz.modules.app.dto.RecordDetailDto;
|
||||
import com.lz.modules.app.entity.DepartmentsEntity;
|
||||
import com.lz.modules.app.entity.DepartmentsStaffRelateEntity;
|
||||
import com.lz.modules.app.entity.StaffEntity;
|
||||
import com.lz.modules.app.enums.ResultRecordStatusEnum;
|
||||
import com.lz.modules.app.enums.RoleEnums;
|
||||
import com.lz.modules.app.model.TaskModel;
|
||||
import com.lz.modules.app.resp.Step;
|
||||
@ -22,13 +16,11 @@ import com.lz.modules.app.service.DepartmentsService;
|
||||
import com.lz.modules.app.service.DepartmentsStaffRelateService;
|
||||
import com.lz.modules.app.service.StaffService;
|
||||
import com.lz.modules.flow.dao.StaffRoleMapper;
|
||||
import com.lz.modules.flow.entity.RecordAuth;
|
||||
import com.lz.modules.flow.entity.StaffRole;
|
||||
import com.lz.modules.flow.model.FlowModel;
|
||||
import com.lz.modules.flow.service.RecordAuthService;
|
||||
import com.lz.modules.flow.service.StaffRoleService;
|
||||
import com.lz.modules.sys.dao.SysUserDao;
|
||||
import com.lz.modules.sys.entity.SysUserEntity;
|
||||
import com.lz.modules.sys.entity.app.ResultDetail;
|
||||
import com.lz.modules.sys.entity.app.ResultRecord;
|
||||
import com.lz.modules.sys.service.SysUserService;
|
||||
@ -37,15 +29,12 @@ import com.lz.modules.sys.service.app.ResultRecordService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.repository.reactive.RxJava2CrudRepository;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@ -332,11 +321,5 @@ public class TestController {
|
||||
return staffRoleService.commentList(taskModel);
|
||||
}
|
||||
|
||||
//http://localhost:8080/lz_management/test/cutimage
|
||||
@RequestMapping("/test/cutimage")
|
||||
public R cutimage() {
|
||||
String url = CutLongImageUtils.getLongImageUrl("https://www.baidu.com/");
|
||||
return R.ok().put("url",url);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user