|
@@ -6,6 +6,8 @@ import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.io.FileUtil;
|
|
|
import cn.hutool.core.thread.ThreadUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
+import cn.hutool.crypto.SecureUtil;
|
|
|
+import cn.hutool.crypto.symmetric.AES;
|
|
|
import cn.hutool.extra.qrcode.QrCodeUtil;
|
|
|
import cn.hutool.extra.qrcode.QrConfig;
|
|
|
import cn.hutool.http.HttpUtil;
|
|
@@ -17,15 +19,14 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.fdkankan.common.constant.*;
|
|
|
import com.fdkankan.common.exception.BusinessException;
|
|
|
-import com.fdkankan.common.util.DateExtUtil;
|
|
|
-import com.fdkankan.common.util.FileMd5Util;
|
|
|
-import com.fdkankan.common.util.FileUtils;
|
|
|
-import com.fdkankan.common.util.SnowflakeIdGenerator;
|
|
|
+import com.fdkankan.common.util.*;
|
|
|
import com.fdkankan.contro.constant.RedisConstants;
|
|
|
import com.fdkankan.contro.entity.*;
|
|
|
import com.fdkankan.contro.enums.CameraTypeEnum;
|
|
|
+import com.fdkankan.contro.httpclient.MyClient;
|
|
|
import com.fdkankan.contro.mapper.ISceneFileBuildMapper;
|
|
|
import com.fdkankan.contro.service.*;
|
|
|
+import com.fdkankan.contro.util.RsaUtils;
|
|
|
import com.fdkankan.contro.vo.ResponseSceneFile;
|
|
|
import com.fdkankan.contro.vo.ScenePlusVO;
|
|
|
import com.fdkankan.fyun.config.FYunFileConfig;
|
|
@@ -58,6 +59,7 @@ import org.springframework.util.ObjectUtils;
|
|
|
import org.springframework.web.client.RestTemplate;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
import java.io.File;
|
|
|
import java.io.IOException;
|
|
|
import java.nio.charset.StandardCharsets;
|
|
@@ -199,6 +201,8 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
|
|
|
private ISceneColdStorageService sceneColdStorageService;
|
|
|
@Autowired
|
|
|
private IntermitSceneService intermitSceneService;
|
|
|
+ @Resource
|
|
|
+ private MyClient httpClient;
|
|
|
|
|
|
@Override
|
|
|
public SceneFileBuild findByFileId(String fileId) {
|
|
@@ -356,7 +360,6 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
|
|
|
int rebuild = CommonStatus.YES.code();
|
|
|
if (ObjectUtils.isEmpty(scenePlus)) {
|
|
|
|
|
|
-
|
|
|
//清除超容量场景记录
|
|
|
exceedSpaceSceneService.repeal(camera.getId(), fileId, unicode);
|
|
|
|
|
@@ -440,10 +443,23 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
|
|
|
|
|
|
//舒淇要求场景上传取data.fdage中的用户
|
|
|
Long userId = null;
|
|
|
- userName = jsonObject.getString("account");
|
|
|
+ userName = jsonObject.getString("userId");
|
|
|
+ String password = jsonObject.getString("password");
|
|
|
log.info("场景归属账号为:account:{}", userName);
|
|
|
if(StrUtil.isNotEmpty(userName)){
|
|
|
User user = userService.getByUserName(userName);
|
|
|
+ if(Objects.isNull(user)){
|
|
|
+ //自动注册
|
|
|
+ JSONObject registerParams = new JSONObject();
|
|
|
+ registerParams.put("phoneNum", userName);
|
|
|
+ registerParams.put("password", password);
|
|
|
+ registerParams.put("msgAuthCode", "2a22bac40f44af4d3b5fdc20ea706fc5");
|
|
|
+ ResultData resultData = httpClient.postJson("http://127.0.0.1:8081/ucenter/sso/user/register", null, registerParams);
|
|
|
+ Object data = resultData.getData();
|
|
|
+ Long id = ((JSONObject)data).getLong("id");
|
|
|
+ log.info("自动注册,userId:{}", id);
|
|
|
+ user = userService.getByUserName(userName);
|
|
|
+ }
|
|
|
log.info("场景归属账号id为:userId:{}", user.getId());
|
|
|
if(Objects.nonNull(user)){
|
|
|
userId = user.getId();
|
|
@@ -831,6 +847,19 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
|
|
|
|
|
|
ScenePlusVO scenePlusVO = null;
|
|
|
|
|
|
+ //调用接口入库
|
|
|
+ Map<String, Object> signPlayload = new HashMap<>();
|
|
|
+ signPlayload.put("appId", "ucenter");
|
|
|
+ signPlayload.put("timestamp", Calendar.getInstance().getTimeInMillis());
|
|
|
+ String sign = RsaUtils.encipher(JSON.toJSONString(signPlayload), RsaUtils.publicKey);
|
|
|
+ JSONObject cameraInStoreParams = new JSONObject();
|
|
|
+ cameraInStoreParams.put("cameraType", cameraType);
|
|
|
+ cameraInStoreParams.put("snCode", mac);
|
|
|
+ ResultData resultData = httpClient.postJson("http://127.0.0.1:8081/ucenter/_inner/cameraInStore", sign, cameraInStoreParams);
|
|
|
+ Object data = resultData.getData();
|
|
|
+ Long cameraId = ((JSONObject)data).getLong("id");
|
|
|
+ log.info("自动入库,cameraId:{}", cameraId);
|
|
|
+
|
|
|
if (ObjectUtils.isEmpty(scenePro) || (!ObjectUtils.isEmpty(scenePro.getIsUpgrade()) && scenePro.getIsUpgrade() == 1)) {
|
|
|
scenePlusVO = buildScene(fileId, prefixBuffer.toString(), fdageJson, buildType, cameraType);
|
|
|
} else {
|
|
@@ -1918,13 +1947,21 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
|
|
|
}
|
|
|
|
|
|
public static void main(String[] args) throws Exception {
|
|
|
- String test = "1VCTnzsHFK9+jxvV5/YXqtdeAaCKdSBrW2NbvkFlkrYf9sWkFt1oPNr/x31clCJ02ox9+EX8dTeer+EE7K/azgHs+6W7lyi9ZcnklLbuPGdgZ32TgiL34DZKCxGZqMt+U0Mg65bgVxe01CCJZGkO7VBtZAygaNAfMUbFDYhOETU=";
|
|
|
- Base64 base64 = new Base64();
|
|
|
- // 私钥解密过程
|
|
|
- byte[] res = RSAEncrypt.decrypt(RSAEncrypt.loadPrivateKeyByStr(RSAEncrypt.loadPrivateKeyByFile()),
|
|
|
- base64.decode(test));
|
|
|
- String restr = new String(res, "UTF-8");
|
|
|
- System.out.println(restr);
|
|
|
+// String test = "1VCTnzsHFK9+jxvV5/YXqtdeAaCKdSBrW2NbvkFlkrYf9sWkFt1oPNr/x31clCJ02ox9+EX8dTeer+EE7K/azgHs+6W7lyi9ZcnklLbuPGdgZ32TgiL34DZKCxGZqMt+U0Mg65bgVxe01CCJZGkO7VBtZAygaNAfMUbFDYhOETU=";
|
|
|
+// Base64 base64 = new Base64();
|
|
|
+// // 私钥解密过程
|
|
|
+// byte[] res = RSAEncrypt.decrypt(RSAEncrypt.loadPrivateKeyByStr(RSAEncrypt.loadPrivateKeyByFile()),
|
|
|
+// base64.decode(test));
|
|
|
+// String restr = new String(res, "UTF-8");
|
|
|
+// System.out.println(restr);
|
|
|
+
|
|
|
+// AES aes = new AES();
|
|
|
+// String s = aes.decryptStr("E10ADC3949BA59ABBE56E057F20F883E");
|
|
|
+// System.out.println(s);
|
|
|
+
|
|
|
+ String s1 = MD5.md5Str("123456");
|
|
|
+ System.out.println(s1);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
@Override
|