Przeglądaj źródła

oss文件上传

zhuwei 3 miesięcy temu
rodzic
commit
35dbfa4458

+ 3 - 3
blade-common/src/main/java/org/springblade/common/utils/CommonUtil.java

@@ -147,10 +147,10 @@ public class CommonUtil {
             //获取OSS文件流
             URL url = new URL(urlStr);
             URLConnection conn = url.openConnection();
-            // 设置连接超时时间
+      /*      // 设置连接超时时间
             conn.setConnectTimeout(10000); // 5秒
             // 设置读取超时时间
-            conn.setReadTimeout(10000); // 5秒
+            conn.setReadTimeout(10000); // 5秒*/
             conn.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)");
             return conn.getInputStream();
         } catch (Exception e) {
@@ -576,7 +576,7 @@ public class CommonUtil {
         String formatName = "JPEG";
         ByteArrayInputStream bais = new ByteArrayInputStream(imageData);
         BufferedImage originalImage = ImageIO.read(bais);
-        long sizeLimit = 366912000; //358KB
+        long sizeLimit = 1024*1024*5; //5M
         int width = 768;
         int height = 1024;
         Image scaledImage = originalImage.getScaledInstance(width, height, Image.SCALE_SMOOTH);

+ 5 - 0
blade-ops/blade-resource/pom.xml

@@ -145,6 +145,10 @@
             <artifactId>lombok</artifactId>
             <scope>provided</scope>
         </dependency>
+        <dependency>
+            <groupId>org.springblade</groupId>
+            <artifactId>blade-starter-oss</artifactId>
+        </dependency>
     </dependencies>
 
 
@@ -169,6 +173,7 @@
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-antrun-plugin</artifactId>
+                <version>1.8</version>
             </plugin>
         </plugins>
     </build>

+ 4 - 4
blade-ops/blade-resource/src/main/java/org/springblade/resource/builder/oss/OssBuilder.java

@@ -77,7 +77,7 @@ public class OssBuilder {
 	}
 
 	/**
-	 * 获取template
+	 * 获取template.
 	 *
 	 * @param code 资源编号
 	 * @return OssTemplate
@@ -86,9 +86,8 @@ public class OssBuilder {
 		String tenantId = AuthUtil.getTenantId();
 		Oss oss = getOss(tenantId, code);
 
-
 		//oss.setEndpoint("http://183.247.216.148:9000/");
-
+		// oss.setEndpoint("https://xinan1.zos.ctyun.cn");
 		Oss ossCached = ossPool.get(tenantId);
 		OssTemplate template = templatePool.get(tenantId);
 		// 若为空或者不一致,则重新加载
@@ -113,7 +112,7 @@ public class OssBuilder {
 						template = TencentCosBuilder.template(oss, ossRule);
 					} else if (oss.getCategory() == OssEnum.HUAWEI.getCategory()) {
 						template = HuaweiObsBuilder.template(oss, ossRule);
-					} else if (oss.getCategory() == OssEnum.AMAZONS3.getCategory()) {
+					}else if (oss.getCategory() == OssEnum.AMAZONS3.getCategory()){
 						template = AmazonS3OssBuilder.template(oss, ossRule);
 					}
 					templatePool.put(tenantId, template);
@@ -121,6 +120,7 @@ public class OssBuilder {
 				}
 			}
 		}
+		System.out.println("oss="+oss.getEndpoint());
 		return template;
 	}
 

+ 1 - 1
blade-service/blade-e-visa/src/main/java/org/springblade/evisa/service/impl/EVDataServiceImpl.java

@@ -694,7 +694,7 @@ public class EVDataServiceImpl implements EVDataService {
 
         Object[] result = null;
         String fileUrl = pdfUrl;
-        if (list.size() >= 1000 || fileByte.length > 1000 * 1000 * 1000) {
+        if (list.size() >= 10 || fileByte.length > 10 * 1000 * 1000) {
             String inUrl = "/inp/" + DateUtil.today();
             String outUrl = "/out/" + DateUtil.today();
             SignFtpUtil.FTPCreateDir(inUrl);

+ 8 - 8
blade-service/blade-e-visa/src/main/java/org/springblade/evisa/service/impl/EVisaServiceImpl.java

@@ -852,9 +852,9 @@ public class EVisaServiceImpl implements EVisaService {
         try {
             String sys_isonline = ParamCache.getValue(CommonConstant.SYS_ISONLINE);
             if ("20".equals(sys_isonline) || SystemUtils.isWindows() || SystemUtils.isMacOs()) {
-                SIGN_HOST = "219.151.181.43";
+                SIGN_HOST = "113.250.191.113";
             }
-            SIGN_HOST = "219.151.181.43";
+            SIGN_HOST = "113.250.191.113";
             System.out.println("电签Ip===:" + SIGN_HOST);
             PaperlessClient paperlessClient = new PaperlessClient(SIGN_HOST, SIGN_PORT, 24000000, 81000000);
             System.out.println("paperlessClient创建成功");
@@ -1058,7 +1058,7 @@ public class EVisaServiceImpl implements EVisaService {
         try {
             String sys_isonline = ParamCache.getValue(CommonConstant.SYS_ISONLINE);
             if ("20".equals(sys_isonline) || SystemUtils.isWindows() || SystemUtils.isMacOs()) {
-                SIGN_HOST = "219.151.181.43";
+                SIGN_HOST = "113.250.191.113";
             }
             System.out.println("电签Ip===:" + SIGN_HOST);
             PaperlessClient paperlessClient = new PaperlessClient(SIGN_HOST, SIGN_PORT, 240000000, 810000000);
@@ -1317,7 +1317,7 @@ public class EVisaServiceImpl implements EVisaService {
         try {
             String sys_isonline = ParamCache.getValue(CommonConstant.SYS_ISONLINE);
             if ("20".equals(sys_isonline) || SystemUtils.isWindows() || SystemUtils.isMacOs()) {
-                SIGN_HOST = "219.151.181.43";
+                SIGN_HOST = "113.250.191.113";
             }
             System.out.println("电签Ip===:" + SIGN_HOST);
             PaperlessClient paperlessClient = new PaperlessClient(SIGN_HOST, SIGN_PORT, 240000000, 810000000);
@@ -1396,7 +1396,7 @@ public class EVisaServiceImpl implements EVisaService {
         try {
             String sys_isonline = ParamCache.getValue(CommonConstant.SYS_ISONLINE);
             if ("20".equals(sys_isonline) || SystemUtils.isWindows() || SystemUtils.isMacOs()) {
-                SIGN_HOST = "219.151.181.43";
+                SIGN_HOST = "113.250.191.113";
             }
             System.out.println("电签Ip===:" + SIGN_HOST);
             PaperlessClient paperlessClient = new PaperlessClient(SIGN_HOST, SIGN_PORT, 240000000, 810000000);
@@ -1681,7 +1681,7 @@ public class EVisaServiceImpl implements EVisaService {
         try {
             String sys_isonline = ParamCache.getValue(CommonConstant.SYS_ISONLINE);
             if ("20".equals(sys_isonline) || SystemUtils.isWindows() || SystemUtils.isMacOs()) {
-                SIGN_HOST = "219.151.181.43";
+                SIGN_HOST = "113.250.191.113";
             }
             PaperlessClient paperlessClient = new PaperlessClient(SIGN_HOST, SIGN_PORT, 240000000, 810000000);
             paperlessClient.setSSL(false);
@@ -1708,7 +1708,7 @@ public class EVisaServiceImpl implements EVisaService {
             List<PdfBean> pdfBeans = new ArrayList<>();
             PdfBean pdfBean = new PdfBean();
             pdfBean.setBizSerialNo(GUIDUtil.generateId());
-            pdfBean.setInputSource("/mnt/sdc/signInfo" + loPdfurl);
+            pdfBean.setInputSource("/data/sdc/signInfo" + loPdfurl);
             pdfBean.setInputType(BaseConstants.INPUT_TYPE_FILEPATH);
             pdfBeans.add(pdfBean);
             requestBody.setPdfBeans(pdfBeans);
@@ -1721,7 +1721,7 @@ public class EVisaServiceImpl implements EVisaService {
             requestBody.setSealStrategies(sealStrategies);
 
             //签章后文件保存地址,不为空时,直接将签章文件保存在此地址,不再返回签章后文档数据;ftp:auto
-            requestBody.setOutputFilepath("/mnt/sdc/signInfo" + outPdfUrl);
+            requestBody.setOutputFilepath("/data/sdc/signInfo" + outPdfUrl);
 
             //时间戳方式,默认为0;0:实时访问CFCA 时间戳服务;1:使用从CFCA购置并在本地部署的时间戳服务器产品;
             requestBody.setTimestampChannel(BaseConstants.TIME_STAMP_CHANNEL_CFCA);

+ 6 - 8
blade-service/blade-e-visa/src/main/java/org/springblade/evisa/utils/SignFtpUtil.java

@@ -16,8 +16,8 @@ public class SignFtpUtil {
     private static final int PORT = 6233 ;
     private static final String USER = "signAdmin";
     private static final String PASS = "123456";
-    private static final int CONNECT_TIMEOUT = 900000; // 30秒
-    private static final int DATA_TIMEOUT = 90000; // 30秒
+    private static final int CONNECT_TIMEOUT = 9000000; // 30秒
+    private static final int DATA_TIMEOUT = 900000; // 30秒
 
     /**
      *  获取ftp 客户端
@@ -34,7 +34,7 @@ public class SignFtpUtil {
             // 连接到FTP服务器
             String sys_isonline = ParamCache.getValue(CommonConstant.SYS_ISONLINE);
             if("20".equals(sys_isonline) || SystemUtils.isWindows() || SystemUtils.isMacOs()){
-                SERVER = "219.151.185.227";
+                SERVER = "113.250.191.113";
             }
             System.out.println("ftp上传ip地址:"+SERVER);
             ftp.connect(SERVER, PORT);
@@ -231,9 +231,7 @@ public class SignFtpUtil {
         }
     }
 
-/*    public static void main(String[] args) {
-        String inUrl = "/inp/" + DateUtil.today();
-        System.out.println(inUrl);
-        FTPCreateDir(inUrl);
-    }*/
+
+
+
 }

+ 1 - 0
pom.xml

@@ -118,6 +118,7 @@
                     <configuration>
                         <fork>true</fork>
                         <finalName>${project.build.finalName}</finalName>
+                        <includeSystemScope>true</includeSystemScope>
                     </configuration>
                     <executions>
                         <execution>