dsx 2 년 전
부모
커밋
206d557911
2개의 변경된 파일55개의 추가작업 그리고 19개의 파일을 삭제
  1. 40 9
      src/main/java/com/fdkankan/extend/service/impl/TowerServiceImpl.java
  2. 15 10
      src/main/java/com/fdkankan/extend/util/RsaCryptTools.java

+ 40 - 9
src/main/java/com/fdkankan/extend/service/impl/TowerServiceImpl.java

@@ -11,6 +11,7 @@ import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.fdkankan.common.constant.CommonSuccessStatus;
+import com.fdkankan.common.util.DateExtUtil;
 import com.fdkankan.extend.TowerSceneBean;
 import com.fdkankan.extend.entity.Camera;
 import com.fdkankan.extend.entity.CameraDetail;
@@ -24,6 +25,7 @@ import com.fdkankan.fyun.face.FYunFileServiceInterface;
 import com.fdkankan.redis.constant.RedisKey;
 import com.fdkankan.redis.util.RedisUtil;
 import com.fdkankan.web.response.ResultData;
+import lombok.Data;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
@@ -139,12 +141,12 @@ public class TowerServiceImpl implements ITowerService {
 
         log.info("结束下载,开始推送:{}", num);
 
-//        try {
+        try {
 //            this.dataPush(num, title, towerSceneBean.getSceneId(), towerSceneBean.getRoomId(), zipPath);
-//        }finally {
+        }finally {
 //            FileUtil.del(scenePath);
 //            FileUtil.del(sceneSourcePath);
-//        }
+        }
 
 //            FileUtil.del(scenePath);
         FileUtil.copy(zipPath, parentPath, true);
@@ -153,11 +155,6 @@ public class TowerServiceImpl implements ITowerService {
         return zipPath;
     }
 
-    public static void main(String[] args) {
-        boolean directory = FileUtil.isDirectory("/home/backend/4dkankan_v4/modeling-extend/download/KK-t-rXyBOE9LG8F/123123_456456/images/4k/");
-        System.out.println(directory);
-    }
-
     @Override
     public void packSceneData(Long companyId, List<String> nums) {
 
@@ -185,6 +182,21 @@ public class TowerServiceImpl implements ITowerService {
             List<TowerSceneBean> towerSceneBeans = JSON.parseArray(sceneStr, TowerSceneBean.class);
             List<String> titleList = towerSceneBeans.stream().map(TowerSceneBean::getName).collect(Collectors.toList());
             scenePlusList = scenePlusService.list(new LambdaQueryWrapper<ScenePlus>().in(ScenePlus::getCameraId, cameraIdList).in(ScenePlus::getTitle, titleList));
+            List<String> dbTitleList = scenePlusList.stream().map(ScenePlus::getTitle).collect(Collectors.toList());
+            List<String> notFindList = titleList.stream().filter(title -> {
+                if (dbTitleList.contains(title)) {
+                    return false;
+                }else{
+                    return true;
+                }
+            }).collect(Collectors.toList());
+            if(CollUtil.isNotEmpty(notFindList)){
+                fYunFileService.uploadFile(JSON.toJSONString(notFindList).getBytes(),
+                        ossParentPath.concat("notFind")
+                                .concat("-")
+                                .concat(DateExtUtil.format(new Date(), DateExtUtil.dateStyle7))
+                                .concat(".txt"));
+            }
         }
         if(CollUtil.isEmpty(scenePlusList)){
             return;
@@ -213,6 +225,8 @@ public class TowerServiceImpl implements ITowerService {
     @Override
     public void dataPush(String num, String title, String sceneId, String roomId, String zipPath) throws Exception {
 
+        log.info("开始组装参数");
+
         String fileMd5 = com.fdkankan.extend.util.FileUtil.getMulFileMD5(FileUtil.getInputStream(zipPath));
         String compose = sceneId.concat("+").concat(roomId).concat("+").concat(fileMd5);
         String encrypt = RsaCryptTools.encryptData(compose, privateKey);
@@ -223,6 +237,9 @@ public class TowerServiceImpl implements ITowerService {
         params.put("file", FileUtil.file(zipPath));
         params.put("manufact", manufact);
         params.put("encrypt", encrypt);
+        params.put("upUserAcct", "xxx");
+        log.info("encrypt:{}", encrypt);
+        log.info("开始推送");
         String post = HttpUtil.post(url, params);
         JSONObject jsonObject = JSON.parseObject(post);
 
@@ -230,12 +247,26 @@ public class TowerServiceImpl implements ITowerService {
 
     }
 
+    public static void main(String[] args) {
+        Map<String, Object> params = new HashMap<>();
+        params.put("stationCode", "410192010000001484");
+        params.put("roomEntityID", "000102050000000003085104");
+        params.put("file", FileUtil.file("D:\\test\\410192010000001484_000102050000000003085104.zip"));
+        params.put("manufact", "3");
+        params.put("upUserAcct", "111");
+        params.put("encrypt", "oNFZonGRrum3hldhU9AcMwP0JsXoxZocaTSTgj1h1Ag9pJzro9us0udinPr058y9KcwSPtkO58TKVE4csnasTZT00jghJQqsk0ATiNzX8QZh+F1iH33j6I3NHZu3vzjAV4lVHSo23WcEMo4s9G5dxymagYl8FKd7ua0/CYNysrs=");
+        String post = HttpUtil.post("http://120.52.136.13:2808/fileManager/uploadRsaFileZipView", params);
+        JSONObject jsonObject = JSON.parseObject(post);
+        System.out.println(jsonObject.toJSONString());
+    }
+
     private void dataPushLog(String num, String title, String resultCode, String resultMsg){
         String content = num.concat("-").concat(title).concat(" : ").concat(resultCode);
         if(StrUtil.isNotEmpty(resultMsg)){
             content = content.concat("-").concat(resultMsg);
         }
         content = content.concat("\r\n");
-        FileUtil.writeUtf8String(content, parentPath);
+        FileUtil.writeUtf8String(content, parentPath.concat("download.log"));
     }
+
 }

+ 15 - 10
src/main/java/com/fdkankan/extend/util/RsaCryptTools.java

@@ -148,16 +148,21 @@ public class RsaCryptTools {
     }
 
     public static void main(String[] args) throws NoSuchAlgorithmException, NoSuchPaddingException, IOException, BadPaddingException, IllegalBlockSizeException, InvalidKeyException, InvalidKeySpecException {
-        SecretKey secretKey = generateSecretKey(512);
-        System.out.println(secretKey.toString());
-        String enStr = encryptData("stationCode_entityID_fileMd5", secretKey.getPrivateKey());
-        System.out.println(enStr);
-        String deStr = decryptData(enStr, secretKey.getPublicKey());
-        System.out.println(deStr);
-        enStr = encryptData("站址编码_机房实体ID_文件Md5", secretKey.getPrivateKey());
-        System.out.println(enStr);
-        deStr = decryptData(enStr, secretKey.getPublicKey());
-        System.out.println(deStr);
+//        SecretKey secretKey = generateSecretKey(1024);
+//        System.out.println(secretKey.toString());
+//        String enStr = encryptData("stationCode_entityID_fileMd5", secretKey.getPrivateKey());
+//        System.out.println(enStr);
+//        String deStr = decryptData(enStr, secretKey.getPublicKey());
+//        System.out.println(deStr);
+//        enStr = encryptData("站址编码_机房实体ID_文件Md5", secretKey.getPrivateKey());
+//        System.out.println(enStr);
+//        deStr = decryptData(enStr, secretKey.getPublicKey());
+//        System.out.println(deStr);
+
+        String s = decryptData("GI/nmpgMb9KfZMf6alEK1sIE2bxIkwnk36MCdzrdKVLYFf2We1U33C+MUMYg/P7mN03Di9hNTEsGm9vp1ejnaksic7w9gEH8395cdglPEsnQmU6HhN3t1aaG43eroJoDM1IMoQiaiSnGuDZZlsos2voZiD24ojDlKRXxrTzTPz4=", "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCabrXsbyaAPH2bqrbvnaPSoViSE5v7AbUCbHNIYurXRwDqAmY7//A9JlxzKd0bGUbKKTjBHja3ESsuw+T2Wjdr3vAqMRY75bNjjVC30F1+XI7Xz6d2APRRViLA2tTVBZrb008E/KLbN+wVFcSXGn0p2WkIP+OpwwfZGSKUK+VX1wIDAQAB");
+        System.out.println(s);
+
+
     }
 
 }