|
|
@@ -0,0 +1,92 @@
|
|
|
+package com.fdkankan.task;
|
|
|
+
|
|
|
+import cn.hutool.core.date.DateUtil;
|
|
|
+import com.fdkankan.fyun.face.FYunFileServiceInterface;
|
|
|
+import com.fdkankan.task.config.SendMessage;
|
|
|
+import com.fdkankan.task.entity.TbScene;
|
|
|
+import com.fdkankan.task.entity.TbScenePro;
|
|
|
+import com.fdkankan.task.entity.TbUser;
|
|
|
+import com.fdkankan.task.mapper.TbSceneMapper;
|
|
|
+import com.fdkankan.task.mapper.TbUserMapper;
|
|
|
+import com.fdkankan.task.service.TbSceneProService;
|
|
|
+import com.fdkankan.task.service.TbSceneService;
|
|
|
+import com.fdkankan.task.service.TbUserService;
|
|
|
+import com.mybatisflex.annotation.UseDataSource;
|
|
|
+import com.mybatisflex.core.datasource.DataSourceKey;
|
|
|
+import com.mybatisflex.core.query.QueryWrapper;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.junit.jupiter.api.Test;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.boot.test.context.SpringBootTest;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
+import java.util.concurrent.CompletableFuture;
|
|
|
+
|
|
|
+@SpringBootTest
|
|
|
+public class TestZfbV2 {
|
|
|
+
|
|
|
+ static String dataFmt = "yyyyMMddHHmmssSSSS";
|
|
|
+ @Autowired
|
|
|
+ TbSceneMapper tbSceneMapper;
|
|
|
+ @Autowired
|
|
|
+ TbUserService tbUserService;
|
|
|
+ @Autowired
|
|
|
+ SendMessage sendMessage;
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 5838794f1754_202403221055576280:;/home/ubuntu/data/5838794f1754_202403221055576280:;https://zfb-zhm-test.oss-cn-shenzhen.aliyuncs.com/5838794f1754_202403221055576280/:;zip.Zip:;zh1K6M5HIz8:;1:;18036323123:;1:;1058:;sfm
|
|
|
+ 41143603_20240321144623:;/home/ubuntu/data/41143603_20240321144623:;https://zfb-zhm-test.oss-cn-shenzhen.aliyuncs.com/41143603_20240321144623/:;zip.Zip:;zh1AgtOB5cm:;1:;15105227207:;1:;1058:;sfm */
|
|
|
+ @Test
|
|
|
+ void test2() throws Exception {
|
|
|
+ DataSourceKey.use("old-zfb");
|
|
|
+ QueryWrapper queryWrapper = QueryWrapper.create()
|
|
|
+ .where("status = -1 and id >= 508729 and algorithm!="+"'simple'");
|
|
|
+ List<TbScene> tbScenes = tbSceneMapper.selectListByQuery(queryWrapper);
|
|
|
+ List<String > msgList = new ArrayList<>();
|
|
|
+ for (TbScene tbScene : tbScenes) {
|
|
|
+ TbUser user = tbUserService.getById(tbScene.getUserId());
|
|
|
+ String unicode = getV2DataSource(tbScene.getDatasource());
|
|
|
+ String parametr = "";
|
|
|
+ parametr+=unicode+":;"+v2Path+unicode+":;"+ossMain+unicode+"/:;"+"zip.Zip"+":;"+tbScene.getNum()+":;"+1;
|
|
|
+ parametr+=":;"+user.getUserName();
|
|
|
+ parametr+=":;"+1;
|
|
|
+ parametr += ":;" + user.getCompanyId();
|
|
|
+ parametr+=":;"+tbScene.getAlgorithm();
|
|
|
+ msgList.add(parametr);
|
|
|
+ }
|
|
|
+ System.out.println(msgList.size());
|
|
|
+ for (String msg : msgList) {
|
|
|
+ sendMessage.sendTov2Message(msg);
|
|
|
+ Thread.sleep(1000L);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void test1(){
|
|
|
+ sendMessage.sendTov2Message("41126488_20240322103814:;/home/ubuntu/data/41126488_20240322103814:;https://zfb-zhm-test.oss-cn-shenzhen.aliyuncs.com/41126488_20240322103814/:;zip.Zip:;zhpznCvKqOL:;1:;15751815667:;1:;1058:;sfm");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public static String v2Path = "/home/ubuntu/data/";
|
|
|
+ public static String ossMain = "https://zfb-zhm-test.oss-cn-shenzhen.aliyuncs.com/";
|
|
|
+
|
|
|
+
|
|
|
+ public static String getV2DataSource(String ossPath){
|
|
|
+ if(StringUtils.isBlank(ossPath)){
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ //http://zfb-zhm-test.oss-cn-shenzhen.aliyuncs.com/5603e0f0c45b45be99850bd5a577b0a3_2019032011090494/zip.Zip
|
|
|
+ ossPath = ossPath.replace("http://zfb-zhm-test.oss-cn-shenzhen.aliyuncs.com/","");
|
|
|
+ ossPath = ossPath.replace("https://zfb-zhm-test.oss-cn-shenzhen.aliyuncs.com/","");
|
|
|
+ ossPath = ossPath.replace("/zip.Zip","");
|
|
|
+ return ossPath;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+
|