2 Commits 38e1b09b77 ... 77b49be8ce

Autor SHA1 Mensaje Fecha
  songshuai 77b49be8ce Commit. hace 5 años
  songshuai c86d742054 支持上传私服 hace 5 años
Se han modificado 2 ficheros con 79 adiciones y 3 borrados
  1. 26 0
      pom.xml
  2. 53 3
      src/main/java/cn/efunbox/audio/utils/ExcelUtil.java

+ 26 - 0
pom.xml

@@ -179,5 +179,31 @@
 		</plugins>
 	</build>
 
+	<repositories>
+		<repository>
+			<id>nexus</id>
+			<url>http://192.168.1.96:8081/nexus/content/groups/public/</url>
+			<layout>default</layout>
+			<releases>
+				<enabled>true</enabled>
+			</releases>
+			<snapshots>
+				<enabled>true</enabled>
+			</snapshots>
+		</repository>
+	</repositories>
+	<distributionManagement>
+		<repository>
+			<id>nexus-releases</id>
+			<name>Releases</name>
+			<url>http://192.168.1.96:8081/nexus/content/repositories/releases/</url>
+		</repository>
+		<snapshotRepository>
+			<id>nexus-snapshots</id>
+			<name>Snapshots</name>
+			<url>http://192.168.1.96:8081/nexus/content/repositories/snapshots/</url>
+		</snapshotRepository>
+	</distributionManagement>
+
 
 </project>

+ 53 - 3
src/main/java/cn/efunbox/audio/utils/ExcelUtil.java

@@ -3,9 +3,13 @@ package cn.efunbox.audio.utils;
 import cn.efunbox.audio.impl.AudioServiceImpl;
 import jxl.Sheet;
 import jxl.Workbook;
+import jxl.read.biff.BiffException;
 import org.apache.commons.lang3.StringUtils;
 
 import java.io.File;
+import java.io.IOException;
+import java.sql.ResultSet;
+import java.sql.SQLException;
 import java.util.Objects;
 
 public class ExcelUtil {
@@ -169,10 +173,56 @@ public class ExcelUtil {
 
 
     public static void main(String[] args) {
-        String pathName = "C:\\Users\\Administrator\\Desktop\\移动1.xls";
+        //String pathName = "C:\\Users\\Administrator\\Desktop\\移动1.xls";
         //hyImportExcel(pathName);
-        System.out.println(AudioServiceImpl.getMicrosecondLength("https://ai-admin-audio.ai160.com/audio/050/05007001/05007001004.mp3"));
-        System.out.println(secToTime(225));
+        //System.out.println(AudioServiceImpl.getMicrosecondLength("https://ai-admin-audio.ai160.com/audio/001/00105001/00105001011.mp3"));
+        //System.out.println(secToTime(1220));
+
+        //String pathName = "C:\\Users\\Administrator\\Desktop\\移动1.xls";
+        //generatePlayTime(pathName);
+    }
+
+    public static void generatePlayTime(String name){
+
+        ResultSet rs = null;
+        DBhepler db = new DBhepler();
+        try {
+            Workbook rwb = Workbook.getWorkbook(new File(name));
+            Sheet rs1 = rwb.getSheet("专辑节目");
+
+            if (Objects.nonNull(rs1)) {
+                int clos1 = rs1.getColumns();
+                int rows1 = rs1.getRows();
+
+                for(int i = 1;i<rows1;i++){
+
+                    /*
+                    Thread.sleep(500);
+                    String resContent = rs1.getCell(1,i).getContents();
+                    rs = db.Search("select chapter_name,chapter_duration from res_ware where chapter_name = ?",new String[]{resContent});
+                    if(rs.next()){
+                        System.out.println(rs.getObject("chapter_duration")+"                                                         "+rs.getObject("chapter_name"));
+                    }
+                    */
+
+                    String chapter_url = rs1.getCell(9, i).getContents();
+                    String chapter_duration = secToTime(AudioServiceImpl.getMicrosecondLength(chapter_url));
+                    String resContent = rs1.getCell(1,i).getContents();
+                    System.out.println(chapter_duration+"                                "+resContent);
+
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }finally {
+            if(rs != null){
+                try {
+                    rs.close();
+                } catch (SQLException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
     }
 
     public static String secToTime(long time) {