Browse Source

修改一些导出问题

小么熊🐻 1 year ago
parent
commit
a823abb0d7

+ 8 - 0
nbjk-admin/src/test/java/com/miaxis/test/ReadFileNameTest.java

@@ -19,6 +19,8 @@ import org.springframework.test.context.junit4.SpringRunner;
 import java.io.File;
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.IOException;
+import java.util.Arrays;
+import java.util.Comparator;
 import java.util.List;
 import java.util.List;
 
 
 @ActiveProfiles("dev")
 @ActiveProfiles("dev")
@@ -245,6 +247,12 @@ public class ReadFileNameTest {
                 }
                 }
             }
             }
 
 
+
+
+
+
+
+
 }
 }
 
 
 
 

+ 27 - 1
nbjk-admin/src/test/java/com/miaxis/test/Test.java

@@ -1,5 +1,9 @@
 package com.miaxis.test;
 package com.miaxis.test;
 
 
+import java.io.File;
+import java.util.Arrays;
+import java.util.Comparator;
+
 public class Test {
 public class Test {
 
 
     public static void main(String[] args) {
     public static void main(String[] args) {
@@ -20,7 +24,29 @@ public class Test {
 
 
         **/
         **/
 
 
-        System.out.println(System.currentTimeMillis());
+        //System.out.println(System.currentTimeMillis());
+
+
+
+            String folderPath = "H:/河南省"; // 替换为你的文件夹路径
+            File folder = new File(folderPath);
+            File[] files = folder.listFiles();
+
+            if (files != null) {
+
+
+                Arrays.sort(files, new Comparator<File>() {
+                    @Override
+                    public int compare(File file1, File file2) {
+                        return file1.getName().compareTo(file2.getName());
+                    }
+                });
+
+
+                for (File file : files) {
+                    System.out.println(file.getName());
+                }
+            }
 
 
     }
     }
 
 

+ 38 - 12
nbjk-admin/src/test/java/com/miaxis/test/WxGzhTest.java

@@ -3,8 +3,9 @@ package com.miaxis.test;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
 import com.miaxis.NbjkApplication;
 import com.miaxis.NbjkApplication;
+import com.miaxis.vip.domain.VipExamVideo;
+import com.miaxis.vip.service.IVipExamVideoService;
 import com.miaxis.wx.dto.WxFreepublish;
 import com.miaxis.wx.dto.WxFreepublish;
-import com.miaxis.wx.dto.WxMaterialList;
 import com.miaxis.wx.service.IWxGzhService;
 import com.miaxis.wx.service.IWxGzhService;
 import com.miaxis.wx.service.IWxService;
 import com.miaxis.wx.service.IWxService;
 import org.junit.Test;
 import org.junit.Test;
@@ -15,6 +16,7 @@ import org.springframework.test.context.junit4.SpringRunner;
 
 
 import java.io.IOException;
 import java.io.IOException;
 import java.util.HashMap;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 import java.util.Map;
 
 
 @SpringBootTest(classes = NbjkApplication.class)
 @SpringBootTest(classes = NbjkApplication.class)
@@ -25,6 +27,9 @@ public class WxGzhTest {
     private IWxGzhService wxGzhService;
     private IWxGzhService wxGzhService;
     @Autowired
     @Autowired
     private IWxService wxService;
     private IWxService wxService;
+    @Autowired
+    private IVipExamVideoService vipExamVideoService;
+
 
 
     @Test
     @Test
     public void getUserInfo() throws IOException {
     public void getUserInfo() throws IOException {
@@ -48,12 +53,13 @@ public class WxGzhTest {
     }
     }
 
 
     @Test
     @Test
-    public void getWxFreepublish() {
+    public void getWxFreepublish() throws InterruptedException {
         String token = wxGzhService.getGzhToken();
         String token = wxGzhService.getGzhToken();
         int totalCount = 0;
         int totalCount = 0;
         int countPerPage = 20;
         int countPerPage = 20;
 
 
-      //  do {
+        do {
+
             WxFreepublish wxFreepublish = new WxFreepublish();
             WxFreepublish wxFreepublish = new WxFreepublish();
             wxFreepublish.setOffset(String.valueOf(totalCount));
             wxFreepublish.setOffset(String.valueOf(totalCount));
             wxFreepublish.setCount(String.valueOf(countPerPage));
             wxFreepublish.setCount(String.valueOf(countPerPage));
@@ -64,7 +70,7 @@ public class WxGzhTest {
             JSONArray jsonArray = json.getJSONArray("item");
             JSONArray jsonArray = json.getJSONArray("item");
 
 
             if (jsonArray==null || jsonArray.isEmpty()) {
             if (jsonArray==null || jsonArray.isEmpty()) {
-              //  break;
+                break;
             }
             }
 
 
             for (int i = 0; i < jsonArray.size(); i++) {
             for (int i = 0; i < jsonArray.size(); i++) {
@@ -74,18 +80,38 @@ public class WxGzhTest {
                 JSONArray newsItem = content.getJSONArray("news_item");
                 JSONArray newsItem = content.getJSONArray("news_item");
                 JSONObject newsItem0 = newsItem.getJSONObject(0);
                 JSONObject newsItem0 = newsItem.getJSONObject(0);
                 String title = newsItem0.getString("title");
                 String title = newsItem0.getString("title");
-                String url = newsItem0.getString("url");
-                String thumbUrl = newsItem0.getString("thumb_url");
+                String url = newsItem0.getString("url");    //播放地址
+                String thumbUrl = newsItem0.getString("thumb_url"); //图片URL
                 String isDeleted = newsItem0.getString("is_deleted");
                 String isDeleted = newsItem0.getString("is_deleted");
 
 
-                System.out.println(articleId);
-                System.out.println(title);
-                System.out.println(url);
-                System.out.println(thumbUrl);
-                System.out.println(isDeleted);
+                System.out.println("articleId:"+articleId);
+                System.out.println("tltile:"+title);
+                System.out.println("url:"+url);
+                System.out.println("thumbUrl:"+thumbUrl);
+                System.out.println("isDeleted:"+isDeleted);
                 System.out.println(result);
                 System.out.println(result);
+
+
+                if("false".equals(isDeleted)){ //未删除
+                    VipExamVideo vipExamVideo = new VipExamVideo();
+                    vipExamVideo.setVideoName(title);
+                    List<VipExamVideo> vipExamVideoList = vipExamVideoService.getVipExamVideoByName(vipExamVideo);
+
+                    if(vipExamVideoList!=null && vipExamVideoList.size()>0) {
+                        VipExamVideo examDb = vipExamVideoList.get(0);
+                        examDb.setVideoUrl(url);
+                        examDb.setVideoCover(thumbUrl);
+                        vipExamVideoService.updateById(examDb);
+                    }
+
+
+                }
+
+
             }
             }
-      //  } while (true);
+            totalCount += jsonArray.size();
+            Thread.sleep(13000);
+        } while (true);
 
 
 
 
     }
     }

+ 2 - 0
nbjk-service/src/main/java/com/miaxis/vip/mapper/VipExamVideoMapper.java

@@ -19,4 +19,6 @@ public interface VipExamVideoMapper extends BaseMapper<VipExamVideo> {
      */
      */
     public List<VipExamVideo> selectVipExamVideoList(VipExamVideo vipExamVideo);
     public List<VipExamVideo> selectVipExamVideoList(VipExamVideo vipExamVideo);
 
 
+    public List<VipExamVideo> getVipExamVideoByName(VipExamVideo vipExamVideo);
+
 }
 }

+ 3 - 0
nbjk-service/src/main/java/com/miaxis/vip/service/IVipExamVideoService.java

@@ -18,4 +18,7 @@ public interface IVipExamVideoService extends IService<VipExamVideo>{
      * @return 考场视频集合
      * @return 考场视频集合
      */
      */
     public List<VipExamVideo> selectVipExamVideoList(VipExamVideo vipExamVideo);
     public List<VipExamVideo> selectVipExamVideoList(VipExamVideo vipExamVideo);
+
+    public List<VipExamVideo> getVipExamVideoByName(VipExamVideo vipExamVideo);
+
 }
 }

+ 6 - 0
nbjk-service/src/main/java/com/miaxis/vip/service/impl/VipExamVideoServiceImpl.java

@@ -30,4 +30,10 @@ public class VipExamVideoServiceImpl extends ServiceImpl<VipExamVideoMapper, Vip
     public List<VipExamVideo> selectVipExamVideoList(VipExamVideo vipExamVideo){
     public List<VipExamVideo> selectVipExamVideoList(VipExamVideo vipExamVideo){
         return vipExamVideoMapper.selectVipExamVideoList(vipExamVideo);
         return vipExamVideoMapper.selectVipExamVideoList(vipExamVideo);
     }
     }
+
+
+    public List<VipExamVideo> getVipExamVideoByName(VipExamVideo vipExamVideo) {
+        return vipExamVideoMapper.getVipExamVideoByName(vipExamVideo);
+    }
+
 }
 }

+ 11 - 0
nbjk-service/src/main/resources/mapper/vip/VipExamVideoMapper.xml

@@ -46,4 +46,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         order by exam_id,seq
         order by exam_id,seq
     </select>
     </select>
 
 
+
+
+    <select id="getVipExamVideoByName" parameterType="com.miaxis.vip.domain.VipExamVideo" resultMap="VipExamVideoResult">
+        <include refid="selectVipExamVideoVo"/>
+        <where>
+            <if test="videoName != null  and videoName != ''"> and video_name = #{videoName} </if>
+        </where>
+    </select>
+
+
+
 </mapper>
 </mapper>