Browse Source

补充文档缺失接口

lyhzzz 2 năm trước cách đây
mục cha
commit
b2d7e53cd0
35 tập tin đã thay đổi với 2081 bổ sung22 xóa
  1. 240 0
      src/main/java/com/fdkankan/ucenter/common/FileUtil.java
  2. 465 0
      src/main/java/com/fdkankan/ucenter/common/RSAEncrypt.java
  3. 5 0
      src/main/java/com/fdkankan/ucenter/common/constants/ConstantFilePath.java
  4. 2 1
      src/main/java/com/fdkankan/ucenter/config/WebAppConfig.java
  5. 3 0
      src/main/java/com/fdkankan/ucenter/constant/LoginConstant.java
  6. 129 0
      src/main/java/com/fdkankan/ucenter/controller/HotShopController.java
  7. 9 5
      src/main/java/com/fdkankan/ucenter/controller/SceneApplyController.java
  8. 9 0
      src/main/java/com/fdkankan/ucenter/controller/SceneController.java
  9. 84 0
      src/main/java/com/fdkankan/ucenter/controller/api/VaildCamerasController.java
  10. 51 12
      src/main/java/com/fdkankan/ucenter/controller/app/SceneApiController.java
  11. 72 0
      src/main/java/com/fdkankan/ucenter/entity/HotShop.java
  12. 66 0
      src/main/java/com/fdkankan/ucenter/entity/VaildCameras.java
  13. 1 1
      src/main/java/com/fdkankan/ucenter/generate/AutoGenerate.java
  14. 5 0
      src/main/java/com/fdkankan/ucenter/httpClient/client/LaserClient.java
  15. 18 0
      src/main/java/com/fdkankan/ucenter/httpClient/service/LaserService.java
  16. 18 0
      src/main/java/com/fdkankan/ucenter/mapper/IHotShopMapper.java
  17. 18 0
      src/main/java/com/fdkankan/ucenter/mapper/IVaildCamerasMapper.java
  18. 16 0
      src/main/java/com/fdkankan/ucenter/service/IHotShopService.java
  19. 8 0
      src/main/java/com/fdkankan/ucenter/service/ISceneProService.java
  20. 2 0
      src/main/java/com/fdkankan/ucenter/service/ISceneService.java
  21. 22 0
      src/main/java/com/fdkankan/ucenter/service/IVaildCamerasService.java
  22. 7 0
      src/main/java/com/fdkankan/ucenter/service/impl/AgentAuditServiceImpl.java
  23. 1 0
      src/main/java/com/fdkankan/ucenter/service/impl/AppSceneService.java
  24. 20 0
      src/main/java/com/fdkankan/ucenter/service/impl/HotShopServiceImpl.java
  25. 267 0
      src/main/java/com/fdkankan/ucenter/service/impl/SceneApiService.java
  26. 76 2
      src/main/java/com/fdkankan/ucenter/service/impl/SceneProServiceImpl.java
  27. 11 0
      src/main/java/com/fdkankan/ucenter/service/impl/SceneServiceImpl.java
  28. 127 0
      src/main/java/com/fdkankan/ucenter/service/impl/VaildCamerasServiceImpl.java
  29. 22 0
      src/main/java/com/fdkankan/ucenter/vo/RequestHotShop.java
  30. 273 0
      src/main/java/com/fdkankan/ucenter/vo/ResponseScene.java
  31. 11 0
      src/main/java/com/fdkankan/ucenter/vo/SceneBySnCodeVo.java
  32. 4 0
      src/main/java/com/fdkankan/ucenter/vo/request/SceneParam.java
  33. 5 0
      src/main/resources/mapper/ucenter/HotShopMapper.xml
  34. 9 1
      src/main/resources/mapper/ucenter/SceneProMapper.xml
  35. 5 0
      src/main/resources/mapper/ucenter/VaildCamerasMapper.xml

+ 240 - 0
src/main/java/com/fdkankan/ucenter/common/FileUtil.java

@@ -0,0 +1,240 @@
+package com.fdkankan.ucenter.common;
+
+import java.io.*;
+import java.nio.ByteBuffer;
+import java.nio.MappedByteBuffer;
+import java.nio.channels.FileChannel;
+import java.nio.channels.FileChannel.MapMode;
+
+/**
+ * @author MeepoGuan
+ *
+ * <p>Description: file_util</p>
+ *
+ * 2017年4月30日
+ *
+ */
+public class FileUtil {
+
+/*	public static void main(String[] args) {
+		String dirName = "d:/FH/topic/";// 创建目录
+		FileUtil.createDir(dirName);
+	}*/
+
+	/**
+	 * 创建目录
+	 * 
+	 * @param destDirName
+	 *            目标目录名
+	 * @return 目录创建成功返回true,否则返回false
+	 */
+	public static boolean createDir(String destDirName) {
+		File dir = new File(destDirName);
+		if (dir.exists()) {
+			return false;
+		}
+		if (!destDirName.endsWith(File.separator)) {
+			destDirName = destDirName + File.separator;
+		}
+		// 创建单个目录
+		if (dir.mkdirs()) {
+			return true;
+		} else {
+			return false;
+		}
+	}
+
+	/**
+	 * 删除文件
+	 * 
+	 * @param filePathAndName
+	 *            String 文件路径及名称 如c:/fqf.txt
+	 * @return boolean
+	 */
+	public static void delFile(String filePathAndName) {
+		try {
+			String filePath = filePathAndName;
+			filePath = filePath.toString();
+			File myDelFile = new File(filePath);
+			myDelFile.delete();
+
+		} catch (Exception e) {
+			System.out.println("删除文件操作出错");
+			e.printStackTrace();
+
+		}
+
+	}
+
+	/**
+	 * 读取到字节数组0
+	 * 
+	 * @param filePath //路径
+	 * @throws IOException
+	 */
+	public static byte[] getContent(String filePath) throws IOException {
+		File file = new File(filePath);
+		long fileSize = file.length();
+		if (fileSize > Integer.MAX_VALUE) {
+			System.out.println("file too big...");
+			return null;
+		}
+		FileInputStream fi = new FileInputStream(file);
+		byte[] buffer = new byte[(int) fileSize];
+		int offset = 0;
+		int numRead = 0;
+		while (offset < buffer.length
+				&& (numRead = fi.read(buffer, offset, buffer.length - offset)) >= 0) {
+			offset += numRead;
+		}
+		// 确保所有数据均被读取
+		if (offset != buffer.length) {
+			throw new IOException("Could not completely read file "
+					+ file.getName());
+		}
+		fi.close();
+		return buffer;
+	}
+
+	/**
+	 * 读取到字节数组1
+	 * 
+	 * @param filePath
+	 * @return
+	 * @throws IOException
+	 */
+	public static byte[] toByteArray(String filePath) throws IOException {
+
+		File f = new File(filePath);
+		if (!f.exists()) {
+			throw new FileNotFoundException(filePath);
+		}
+		ByteArrayOutputStream bos = new ByteArrayOutputStream((int) f.length());
+		BufferedInputStream in = null;
+		try {
+			in = new BufferedInputStream(new FileInputStream(f));
+			int buf_size = 1024;
+			byte[] buffer = new byte[buf_size];
+			int len = 0;
+			while (-1 != (len = in.read(buffer, 0, buf_size))) {
+				bos.write(buffer, 0, len);
+			}
+			return bos.toByteArray();
+		} catch (IOException e) {
+			e.printStackTrace();
+			throw e;
+		} finally {
+			try {
+				in.close();
+			} catch (IOException e) {
+				e.printStackTrace();
+			}
+			bos.close();
+		}
+	}
+
+	/**
+	 * 读取到字节数组2
+	 * 
+	 * @param filePath
+	 * @return
+	 * @throws IOException
+	 */
+	public static byte[] toByteArray2(String filePath) throws IOException {
+
+		File f = new File(filePath);
+		if (!f.exists()) {
+			throw new FileNotFoundException(filePath);
+		}
+
+		FileChannel channel = null;
+		FileInputStream fs = null;
+		try {
+			fs = new FileInputStream(f);
+			channel = fs.getChannel();
+			ByteBuffer byteBuffer = ByteBuffer.allocate((int) channel.size());
+			while ((channel.read(byteBuffer)) > 0) {
+				// do nothing
+				// System.out.println("reading");
+			}
+			return byteBuffer.array();
+		} catch (IOException e) {
+			e.printStackTrace();
+			throw e;
+		} finally {
+			try {
+				channel.close();
+			} catch (IOException e) {
+				e.printStackTrace();
+			}
+			try {
+				fs.close();
+			} catch (IOException e) {
+				e.printStackTrace();
+			}
+		}
+	}
+
+	/**
+	 * Mapped File way MappedByteBuffer 可以在处理大文件时,提升性能
+	 * 
+	 * @param filePath
+	 * @return
+	 * @throws IOException
+	 */
+	public static byte[] toByteArray3(String filePath) throws IOException {
+
+		FileChannel fc = null;
+		RandomAccessFile rf = null;
+		try {
+			rf = new RandomAccessFile(filePath, "r");
+			fc = rf.getChannel();
+			MappedByteBuffer byteBuffer = fc.map(MapMode.READ_ONLY, 0,
+					fc.size()).load();
+			//System.out.println(byteBuffer.isLoaded());
+			byte[] result = new byte[(int) fc.size()];
+			if (byteBuffer.remaining() > 0) {
+				// System.out.println("remain");
+				byteBuffer.get(result, 0, byteBuffer.remaining());
+			}
+			return result;
+		} catch (IOException e) {
+			e.printStackTrace();
+			throw e;
+		} finally {
+			try {
+				rf.close();
+				fc.close();
+			} catch (IOException e) {
+				e.printStackTrace();
+			}
+		}
+	}
+
+    public static File[] sort(File[] s) {
+        //中间值
+        File temp = null;
+        //外循环:我认为最小的数,从0~长度-1
+        for (int j = 0; j < s.length - 1; j++) {
+            //最小值:假设第一个数就是最小的
+            String min = s[j].getName();
+            //记录最小数的下标的
+            int minIndex = j;
+            //内循环:拿我认为的最小的数和后面的数一个个进行比较
+            for (int k = j + 1; k < s.length; k++) {
+                //找到最小值
+                if (Integer.parseInt(min.substring(0, min.indexOf("."))) > Integer.parseInt(s[k].getName().substring(0, s[k].getName().indexOf(".")))) {
+                    //修改最小
+                    min = s[k].getName();
+                    minIndex = k;
+                }
+            }
+            //当退出内层循环就找到这次的最小值
+            //交换位置
+            temp = s[j];
+            s[j] = s[minIndex];
+            s[minIndex] = temp;
+        }
+        return s;
+    }
+}

+ 465 - 0
src/main/java/com/fdkankan/ucenter/common/RSAEncrypt.java

@@ -0,0 +1,465 @@
+package com.fdkankan.ucenter.common;
+
+import org.apache.commons.codec.binary.Base64;
+import org.springframework.util.ResourceUtils;
+import sun.misc.BASE64Decoder;
+
+import javax.crypto.BadPaddingException;
+import javax.crypto.Cipher;
+import javax.crypto.IllegalBlockSizeException;
+import javax.crypto.NoSuchPaddingException;
+import java.io.*;
+import java.security.*;
+import java.security.interfaces.RSAPrivateKey;
+import java.security.interfaces.RSAPublicKey;
+import java.security.spec.InvalidKeySpecException;
+import java.security.spec.PKCS8EncodedKeySpec;
+import java.security.spec.X509EncodedKeySpec;
+
+
+public class RSAEncrypt {
+
+    /**
+     * 字节数据转字符串专用集合
+     */
+    private static final char[] HEX_CHAR = {'0', '1', '2', '3', '4', '5', '6',
+            '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
+
+    private static final String PRIVATE_KEY = "classpath:key/private_pkcs8.pem";
+
+    private static final String PUBLIC_KEY = "classpath:key/public.pem";
+    /**
+     * RSA最大解密密文大小
+     */
+    private static final int MAX_DECRYPT_BLOCK = 128;
+    /**
+     * 随机生成密钥对
+     */
+    public static void genKeyPair(String filePath) {
+        // KeyPairGenerator类用于生成公钥和私钥对,基于RSA算法生成对象
+        KeyPairGenerator keyPairGen = null;
+        try {
+            keyPairGen = KeyPairGenerator.getInstance("RSA");
+        } catch (NoSuchAlgorithmException e) {
+            e.printStackTrace();
+        }
+        // 初始化密钥对生成器,密钥大小为96-1024位
+        keyPairGen.initialize(1024, new SecureRandom());
+        // 生成一个密钥对,保存在keyPair中
+        KeyPair keyPair = keyPairGen.generateKeyPair();
+        // 得到私钥
+        RSAPrivateKey privateKey = (RSAPrivateKey) keyPair.getPrivate();
+        // 得到公钥
+        RSAPublicKey publicKey = (RSAPublicKey) keyPair.getPublic();
+        try {
+            // 得到公钥字符串
+            Base64 base64 = new Base64();
+            String publicKeyString = new String(base64.encode(publicKey.getEncoded()));
+            // 得到私钥字符串
+            String privateKeyString = new String(base64.encode(privateKey.getEncoded()));
+            // 将密钥对写入到文件
+            FileWriter pubfw = new FileWriter(filePath + PUBLIC_KEY);
+            FileWriter prifw = new FileWriter(filePath + PRIVATE_KEY);
+            BufferedWriter pubbw = new BufferedWriter(pubfw);
+            BufferedWriter pribw = new BufferedWriter(prifw);
+            pubbw.write(publicKeyString);
+            pribw.write(privateKeyString);
+            pubbw.flush();
+            pubbw.close();
+            pubfw.close();
+            pribw.flush();
+            pribw.close();
+            prifw.close();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * 从文件中输入流中加载公钥
+     *
+     * @throws Exception 加载公钥时产生的异常
+     */
+    public static String loadPublicKeyByFile() throws Exception {
+        try {
+            BufferedReader br = new BufferedReader(new FileReader(ResourceUtils.getFile(PUBLIC_KEY)));
+            String readLine = null;
+            StringBuilder sb = new StringBuilder();
+            while ((readLine = br.readLine()) != null) {
+                if (readLine.charAt(0) == '-') {
+                    continue;
+                } else {
+                    sb.append(readLine);
+                    sb.append('\r');
+                }
+            }
+            br.close();
+            return sb.toString();
+        } catch (IOException e) {
+            throw new Exception("公钥数据流读取错误");
+        } catch (NullPointerException e) {
+            throw new Exception("公钥输入流为空");
+        }
+    }
+
+    /**
+     * 从文件中输入流中加载公钥
+     *
+     * @throws Exception 加载公钥时产生的异常
+     */
+    public static String loadPublicKeyByFile(String publicKy) throws Exception {
+        try {
+            BufferedReader br = new BufferedReader(new FileReader(new File(publicKy)));
+            String readLine = null;
+            StringBuilder sb = new StringBuilder();
+            while ((readLine = br.readLine()) != null) {
+                if (readLine.charAt(0) == '-') {
+                    continue;
+                } else {
+                    sb.append(readLine);
+                    sb.append('\r');
+                }
+            }
+            br.close();
+            return sb.toString();
+        } catch (IOException e) {
+            throw new Exception("公钥数据流读取错误");
+        } catch (NullPointerException e) {
+            throw new Exception("公钥输入流为空");
+        }
+    }
+
+    /**
+     * 从字符串中加载公钥
+     *
+     * @param publicKeyStr 公钥数据字符串
+     * @throws Exception 加载公钥时产生的异常
+     */
+    public static RSAPublicKey loadPublicKeyByStr(String publicKeyStr)
+            throws Exception {
+        try {
+            BASE64Decoder base64 = new BASE64Decoder();
+            byte[] buffer = base64.decodeBuffer(publicKeyStr);
+            KeyFactory keyFactory = KeyFactory.getInstance("RSA");
+            X509EncodedKeySpec keySpec = new X509EncodedKeySpec(buffer);
+            return (RSAPublicKey) keyFactory.generatePublic(keySpec);
+        } catch (NoSuchAlgorithmException e) {
+            throw new Exception("无此算法");
+        } catch (InvalidKeySpecException e) {
+            throw new Exception("公钥非法");
+        } catch (NullPointerException e) {
+            throw new Exception("公钥数据为空");
+        }
+    }
+
+    /**
+     * 从文件中加载私钥
+     *
+     * @return 是否成功
+     * @throws Exception
+     */
+    public static String loadPrivateKeyByFile() throws Exception {
+        try {
+            InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("key/private_pkcs8.pem");
+            StringBuilder builder = new StringBuilder();
+            InputStreamReader reader = new InputStreamReader(inputStream , "UTF-8" );
+            BufferedReader bfReader = new BufferedReader( reader );
+            String tmpContent = null;
+            while ((tmpContent = bfReader.readLine()) != null) {
+                if (tmpContent.charAt(0) == '-') {
+                    continue;
+                } else {
+                    builder.append(tmpContent);
+                    builder.append('\r');
+                }
+            }
+            bfReader.close();
+            return builder.toString();
+//            BufferedReader br = new BufferedReader(new FileReader(ResourceUtils.getFile(PRIVATE_KEY)));
+//            String readLine = null;
+//            StringBuilder sb = new StringBuilder();
+//            while ((readLine = br.readLine()) != null) {
+//                if (readLine.charAt(0) == '-') {
+//                    continue;
+//                } else {
+//                    sb.append(readLine);
+//                    sb.append('\r');
+//                }
+//            }
+//            br.close();
+//            return sb.toString();
+        } catch (IOException e) {
+            throw new Exception("私钥数据读取错误");
+        } catch (NullPointerException e) {
+            throw new Exception("私钥输入流为空");
+        }
+    }
+
+    /**
+     * 从文件中加载私钥
+     *
+     * @return 是否成功
+     * @throws Exception
+     */
+    public static String loadPrivateKeyByFile(String filePath) throws Exception {
+        try {
+            InputStream inputStream = new FileInputStream(filePath);
+            StringBuilder builder = new StringBuilder();
+            InputStreamReader reader = new InputStreamReader(inputStream , "UTF-8" );
+            BufferedReader bfReader = new BufferedReader( reader );
+            String tmpContent = null;
+            while ((tmpContent = bfReader.readLine()) != null) {
+                if (tmpContent.charAt(0) == '-') {
+                    continue;
+                } else {
+                    builder.append(tmpContent);
+                    builder.append('\r');
+                }
+            }
+            bfReader.close();
+            return builder.toString();
+//            BufferedReader br = new BufferedReader(new FileReader(ResourceUtils.getFile(PRIVATE_KEY)));
+//            String readLine = null;
+//            StringBuilder sb = new StringBuilder();
+//            while ((readLine = br.readLine()) != null) {
+//                if (readLine.charAt(0) == '-') {
+//                    continue;
+//                } else {
+//                    sb.append(readLine);
+//                    sb.append('\r');
+//                }
+//            }
+//            br.close();
+//            return sb.toString();
+        } catch (IOException e) {
+            throw new Exception("私钥数据读取错误");
+        } catch (NullPointerException e) {
+            throw new Exception("私钥输入流为空");
+        }
+    }
+
+    public static RSAPrivateKey loadPrivateKeyByStr(String privateKeyStr)
+            throws Exception {
+        try {
+            BASE64Decoder base64Decoder = new BASE64Decoder();
+            byte[] buffer = base64Decoder.decodeBuffer(privateKeyStr);
+            PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(buffer);
+            KeyFactory keyFactory = KeyFactory.getInstance("RSA");
+            return (RSAPrivateKey) keyFactory.generatePrivate(keySpec);
+        } catch (NoSuchAlgorithmException e) {
+            throw new Exception("无此算法");
+        } catch (InvalidKeySpecException e) {
+            throw new Exception("私钥非法");
+        } catch (NullPointerException e) {
+            throw new Exception("私钥数据为空");
+        }
+    }
+
+    /**
+     * 公钥加密过程
+     *
+     * @param publicKey     公钥
+     * @param plainTextData 明文数据
+     * @return
+     * @throws Exception 加密过程中的异常信息
+     */
+    public static byte[] encrypt(RSAPublicKey publicKey, byte[] plainTextData)
+            throws Exception {
+        if (publicKey == null) {
+            throw new Exception("加密公钥为空, 请设置");
+        }
+        Cipher cipher = null;
+        try {
+            // 使用默认RSA
+            cipher = Cipher.getInstance("RSA");
+            // cipher= Cipher.getInstance("RSA", new BouncyCastleProvider());
+            cipher.init(Cipher.ENCRYPT_MODE, publicKey);
+            byte[] output = cipher.doFinal(plainTextData);
+            return output;
+        } catch (NoSuchAlgorithmException e) {
+            throw new Exception("无此加密算法");
+        } catch (NoSuchPaddingException e) {
+            e.printStackTrace();
+            return null;
+        } catch (InvalidKeyException e) {
+            throw new Exception("加密公钥非法,请检查");
+        } catch (IllegalBlockSizeException e) {
+            throw new Exception("明文长度非法");
+        } catch (BadPaddingException e) {
+            throw new Exception("明文数据已损坏");
+        }
+    }
+
+    /**
+     * 私钥加密过程
+     *
+     * @param privateKey    私钥
+     * @param plainTextData 明文数据
+     * @return
+     * @throws Exception 加密过程中的异常信息
+     */
+    public static byte[] encrypt(RSAPrivateKey privateKey, byte[] plainTextData)
+            throws Exception {
+        if (privateKey == null) {
+            throw new Exception("加密私钥为空, 请设置");
+        }
+        Cipher cipher = null;
+        try {
+            // 使用默认RSA
+            cipher = Cipher.getInstance("RSA");
+            cipher.init(Cipher.ENCRYPT_MODE, privateKey);
+            byte[] output = cipher.doFinal(plainTextData);
+            return output;
+        } catch (NoSuchAlgorithmException e) {
+            throw new Exception("无此加密算法");
+        } catch (NoSuchPaddingException e) {
+            e.printStackTrace();
+            return null;
+        } catch (InvalidKeyException e) {
+            throw new Exception("加密私钥非法,请检查");
+        } catch (IllegalBlockSizeException e) {
+            throw new Exception("明文长度非法");
+        } catch (BadPaddingException e) {
+            throw new Exception("明文数据已损坏");
+        }
+    }
+
+    /**
+     * 私钥解密过程
+     *
+     * @param privateKey 私钥
+     * @param cipherData 密文数据
+     * @return 明文
+     * @throws Exception 解密过程中的异常信息
+     */
+    public static byte[] decrypt(RSAPrivateKey privateKey, byte[] cipherData)
+            throws Exception {
+        if (privateKey == null) {
+            throw new Exception("解密私钥为空, 请设置");
+        }
+        Cipher cipher = null;
+        try {
+            // 使用默认RSA
+            cipher = Cipher.getInstance("RSA");
+//             cipher= Cipher.getInstance("RSA", new BouncyCastleProvider());
+            cipher.init(Cipher.DECRYPT_MODE, privateKey);
+            /*byte[] output = cipher.doFinal(cipherData);
+            return output;*/
+            return getDecrytedData(cipherData, cipher);
+        } catch (NoSuchAlgorithmException e) {
+            throw new Exception("无此解密算法");
+        } catch (NoSuchPaddingException e) {
+            e.printStackTrace();
+            return null;
+        } catch (InvalidKeyException e) {
+            throw new Exception("解密私钥非法,请检查");
+        } catch (IllegalBlockSizeException e) {
+            throw new Exception("密文长度非法");
+        } catch (BadPaddingException e) {
+            throw new Exception("密文数据已损坏");
+        }
+    }
+
+    /**
+     * 公钥解密过程
+     *
+     * @param publicKey  公钥
+     * @param cipherData 密文数据
+     * @return 明文
+     * @throws Exception 解密过程中的异常信息
+     */
+    public static byte[] decrypt(RSAPublicKey publicKey, byte[] cipherData)
+            throws Exception {
+        if (publicKey == null) {
+            throw new Exception("解密公钥为空, 请设置");
+        }
+        Cipher cipher = null;
+        try {
+            // 使用默认RSA
+            cipher = Cipher.getInstance("RSA");
+            // cipher= Cipher.getInstance("RSA", new BouncyCastleProvider());
+            cipher.init(Cipher.DECRYPT_MODE, publicKey);
+            /*byte[] output = cipher.doFinal(cipherData);
+            return output;*/
+            return getDecrytedData(cipherData, cipher);
+        } catch (NoSuchAlgorithmException e) {
+            throw new Exception("无此解密算法");
+        } catch (NoSuchPaddingException e) {
+            e.printStackTrace();
+            return null;
+        } catch (InvalidKeyException e) {
+            throw new Exception("解密公钥非法,请检查");
+        } catch (IllegalBlockSizeException e) {
+            throw new Exception("密文长度非法");
+        } catch (BadPaddingException e) {
+            throw new Exception("密文数据已损坏");
+        }
+    }
+
+    private static byte[] getDecrytedData(byte[] cipherData, Cipher cipher) throws IllegalBlockSizeException, BadPaddingException, IOException {
+//        int inputLen = cipherData.length;
+////        ByteArrayOutputStream out = new ByteArrayOutputStream();
+////        int offSet = 0;
+////        byte[] cache;
+////        int i = 0;
+////        // 对数据分段解密
+////        while (inputLen - offSet > 0) {
+////            if (inputLen - offSet > MAX_DECRYPT_BLOCK) {
+////                cache = cipher.doFinal(cipherData, offSet, MAX_DECRYPT_BLOCK);
+////            } else {
+////                cache = cipher.doFinal(cipherData, offSet, inputLen - offSet);
+////            }
+////            out.write(cache, 0, cache.length);
+////            i++;
+////            offSet = i * MAX_DECRYPT_BLOCK;
+////        }
+////        byte[] decryptedData = out.toByteArray();
+////        out.close();
+////        return decryptedData;
+        int inputLen = cipherData.length;
+        ByteArrayOutputStream out = new ByteArrayOutputStream();
+        int offSet = 0;
+
+        for(int i = 0; inputLen - offSet > 0; offSet = i * 256) {
+            byte[] cache;
+            if(inputLen - offSet > 256) {
+                cache = cipher.doFinal(cipherData, offSet, 256);
+            } else {
+                cache = cipher.doFinal(cipherData, offSet, inputLen - offSet);
+            }
+            out.write(cache, 0, cache.length);
+            ++i;
+        }
+
+        byte[] decryptedData = out.toByteArray();
+        out.close();
+        return decryptedData;
+    }
+
+    /**
+     * 字节数据转十六进制字符串
+     *
+     * @param data 输入数据
+     * @return 十六进制内容
+     */
+    public static String byteArrayToString(byte[] data) {
+        StringBuilder stringBuilder = new StringBuilder();
+        for (int i = 0; i < data.length; i++) {
+            // 取出字节的高四位 作为索引得到相应的十六进制标识符 注意无符号右移
+            stringBuilder.append(HEX_CHAR[(data[i] & 0xf0) >>> 4]);
+            // 取出字节的低四位 作为索引得到相应的十六进制标识符
+            stringBuilder.append(HEX_CHAR[(data[i] & 0x0f)]);
+            if (i < data.length - 1) {
+                stringBuilder.append(' ');
+            }
+        }
+        return stringBuilder.toString();
+    }
+
+    public static void main(String[] args) throws Exception {
+
+
+
+    }
+
+}

+ 5 - 0
src/main/java/com/fdkankan/ucenter/common/constants/ConstantFilePath.java

@@ -30,4 +30,9 @@ public class ConstantFilePath {
 
     public static final String SCENE_USER_PATH_V4 = SCENE_V4_PATH + "%s/user/";
 
+    // 代理商
+    public static final String AGENT_PATH = "/mnt/4Dkankan/agent/";
+    public final static String OSS_SCENE_PATH_V4 = "scene_edit_data/%s/";
+
+
 }

+ 2 - 1
src/main/java/com/fdkankan/ucenter/config/WebAppConfig.java

@@ -36,7 +36,8 @@ public class WebAppConfig implements WebMvcConfigurer {
 						"/inner/**",
 						"/_manage/**",
 						"/agentAduit/**",
-						"/laser/**"
+						"/laser/**",
+						"/vaild/**"
 				);
 
 		registry.addInterceptor(appInterceptor).addPathPatterns("/app/**")

+ 3 - 0
src/main/java/com/fdkankan/ucenter/constant/LoginConstant.java

@@ -115,4 +115,7 @@ public class LoginConstant {
     public static final int FAILURE_CODE_3035 = 3035;
     public static final String FAILURE_MSG_3035 = "二维码已失效,请重新获取";
 
+    public static final int FAILURE_CODE_3036 = 3036;
+    public static final String FAILURE_MSG_3036= "文本超过长度限制";
+
 }

+ 129 - 0
src/main/java/com/fdkankan/ucenter/controller/HotShopController.java

@@ -0,0 +1,129 @@
+package com.fdkankan.ucenter.controller;
+
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.fdkankan.common.exception.BusinessException;
+import com.fdkankan.ucenter.common.Result;
+import com.fdkankan.ucenter.constant.LoginConstant;
+import com.fdkankan.ucenter.entity.HotShop;
+import com.fdkankan.ucenter.service.IHotShopService;
+import com.fdkankan.ucenter.vo.RequestHotShop;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * <p>
+ * 热点与商品关联表 前端控制器
+ * </p>
+ *
+ * @author 
+ * @since 2022-11-02
+ */
+@RestController
+@RequestMapping("/hot/shop")
+public class HotShopController {
+
+    @Autowired
+    IHotShopService hotShopService;
+
+
+    /**
+     * 热点id找小程序商品id
+     */
+    @RequestMapping(value = "/findGoodIdByHotId")
+    public Result<List<HotShop>> findGoodIdByHotId(@RequestBody RequestHotShop param) throws Exception {
+        if(StringUtils.isEmpty(param.getHotId()) || StringUtils.isEmpty(param.getOrigin())){
+            throw new BusinessException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
+        }
+        LambdaQueryWrapper<HotShop> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(HotShop::getHotId,param.getHotId());
+        wrapper.eq(HotShop::getOrigin,param.getOrigin());
+        if(StringUtils.isNotBlank(param.getPageSid())){
+            wrapper.eq(HotShop::getPageSid,param.getPageSid());
+        }
+        return Result.success(hotShopService.list(wrapper));
+    }
+
+    /**
+     * 热点id找小程序商品id
+     */
+    @RequestMapping(value = "/findGoodIdByHotIdList")
+    public Result<List<HotShop>> findGoodIdByHotIdList(@RequestBody RequestHotShop param) throws Exception {
+        if(StringUtils.isEmpty(param.getHotId()) || StringUtils.isEmpty(param.getOrigin())){
+            throw new BusinessException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
+        }
+        LambdaQueryWrapper<HotShop> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(HotShop::getHotId,param.getHotId());
+        wrapper.eq(HotShop::getOrigin,param.getOrigin());
+        return Result.success(hotShopService.list(wrapper));
+    }
+
+    /**
+     * 保存热点与商品关联
+     */
+    @RequestMapping(value = "/saveHotShop")
+    public Result saveHotShop(@RequestBody RequestHotShop param) throws Exception {
+        if(StringUtils.isEmpty(param.getHotId()) && StringUtils.isEmpty(param.getOrigin())){
+            throw new BusinessException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
+        }
+
+        String[] pageSids = null;
+        if(StringUtils.isNotEmpty(param.getPageSid())){
+            pageSids = param.getPageSid().split(",");
+        }
+        HotShop hotShopEntity = null;
+
+        //查看是否有已经关联的商品,有则删除
+        LambdaQueryWrapper<HotShop> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(HotShop::getHotId,param.getHotId());
+        wrapper.eq(HotShop::getOrigin,param.getOrigin());
+        hotShopService.remove(wrapper);
+
+
+        if(StringUtils.isNotEmpty(param.getGoodsIds())){
+            String[] ids = param.getGoodsIds().split(",");
+            for(int i = 0, len = ids.length; i < len; i ++){
+                hotShopEntity = new HotShop();
+                hotShopEntity.setHotId(param.getHotId());
+                hotShopEntity.setSceneNum(param.getSceneNum());
+                hotShopEntity.setPageSid("0");
+                if(pageSids != null){
+                    hotShopEntity.setPageSid(pageSids[i]);
+                }
+                hotShopEntity.setGoodId(Long.valueOf(ids[i]));
+                hotShopEntity.setOrigin(param.getOrigin());
+                hotShopService.save(hotShopEntity);
+            }
+        }
+        return Result.success();
+    }
+
+    /**
+     * 删除热点商品关联
+     */
+    @RequestMapping(value = "/deleteGoodsHot")
+    public Result deleteGoodsHot(@RequestBody RequestHotShop param) throws Exception {
+        if(StringUtils.isEmpty(param.getHotId()) && StringUtils.isEmpty(param.getOrigin())){
+            throw new BusinessException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
+        }
+        LambdaQueryWrapper<HotShop> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(HotShop::getHotId,param.getHotId());
+        wrapper.eq(HotShop::getOrigin,param.getOrigin());
+        if(StringUtils.isNotBlank(param.getPageSid())){
+            wrapper.eq(HotShop::getPageSid,param.getPageSid());
+        }
+        List<HotShop> list = hotShopService.list(wrapper);
+        if(list != null && list.size() == 1){
+            hotShopService.removeById(list.get(0).getId());
+        }
+        return Result.success();
+    }
+}
+

+ 9 - 5
src/main/java/com/fdkankan/ucenter/controller/SceneApplyController.java

@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.fdkankan.common.constant.ErrorCode;
 import com.fdkankan.common.exception.BusinessException;
+import com.fdkankan.ucenter.constant.LoginConstant;
 import com.fdkankan.ucenter.entity.SceneApply;
 import com.fdkankan.ucenter.service.ISceneApplyService;
 import com.fdkankan.ucenter.common.ResultData;
@@ -33,13 +34,16 @@ public class SceneApplyController {
      * 新增演示场景申请
      */
     @PostMapping("/save")
-    public ResultData save(@RequestBody SceneApply sceneApplyEntity){
-        if(StringUtils.isEmpty(sceneApplyEntity.getName()) || StringUtils.isEmpty(sceneApplyEntity.getPhone())
-         || StringUtils.isEmpty(sceneApplyEntity.getCompany()) || StringUtils.isEmpty(sceneApplyEntity.getJob())
-        || StringUtils.isEmpty(sceneApplyEntity.getCountry())){
+    public ResultData save(@RequestBody SceneApply param){
+        if(StringUtils.isEmpty(param.getName()) || StringUtils.isEmpty(param.getPhone())
+         || StringUtils.isEmpty(param.getCompany()) || StringUtils.isEmpty(param.getJob())
+        || StringUtils.isEmpty(param.getCountry())){
             throw new BusinessException(ErrorCode.MISSING_REQUIRED_PARAMETERS);
         }
-        sceneApplyService.save(sceneApplyEntity);
+        if(param.getName().length() >50 || param.getCompany().length() >200){
+            throw new BusinessException(LoginConstant.FAILURE_CODE_3036, LoginConstant.FAILURE_MSG_3036);
+        }
+        sceneApplyService.save(param);
         return ResultData.ok();
     }
 

+ 9 - 0
src/main/java/com/fdkankan/ucenter/controller/SceneController.java

@@ -74,6 +74,15 @@ public class SceneController extends BaseController {
         JSONObject jsonObject = sceneProService.newList(param, username);
         return Result.success(jsonObject.getJSONObject("pageInfo"));
     }
+
+    /**
+     * 获取场景详情
+     */
+    @RequestMapping(value = "/detail", method = RequestMethod.POST)
+    public Result getSceneDetail(@RequestBody SceneParam param) throws Exception {
+        return Result.success(sceneProService.getSceneDetail(param.getSceneNum()));
+    }
+
     @PostMapping("/copyScene")
     public Result copyScene(@RequestBody SceneParam param,@RequestHeader String token) throws Exception {
         String username = JwtUtil.getUsername(token);

+ 84 - 0
src/main/java/com/fdkankan/ucenter/controller/api/VaildCamerasController.java

@@ -0,0 +1,84 @@
+package com.fdkankan.ucenter.controller.api;
+
+import com.fdkankan.common.exception.BusinessException;
+import com.fdkankan.ucenter.common.BaseController;
+import com.fdkankan.ucenter.common.Result;
+import com.fdkankan.ucenter.constant.LoginConstant;
+import com.fdkankan.ucenter.service.IVaildCamerasService;
+import lombok.extern.log4j.Log4j2;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.util.StringUtils;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * 本地化版本获取每个公司可使用的相机
+ * Created by Hb_zzZ on 2020/4/2.
+ */
+@Log4j2
+/**本地化版本获取每个公司可使用的相机*/
+@RestController
+@RequestMapping("/vaild/cameras")
+public class VaildCamerasController extends BaseController {
+
+    @Autowired
+    private IVaildCamerasService vaildCameraService;
+
+    /**
+     * 获取企业可用相机列表
+     * @param
+     * @return
+     */
+    @RequestMapping(value = "/getVaildCameras")
+    public Result getVaildCameras() throws Exception{
+        String file = request.getParameter("file");
+        String companyName = request.getParameter("companyName");
+        if(StringUtils.isEmpty(file) || StringUtils.isEmpty(companyName)){
+            log.info("file:" + file);
+            log.info("companyName:" + companyName);
+            throw new BusinessException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
+        }
+
+        return vaildCameraService.getVaildCameras(file, companyName);
+    }
+
+    /**
+     * 新增企业可用相机列表
+     * @param
+     * @return
+     */
+    @RequestMapping(value = "/addVaildCameras")
+    public Result addVaildCameras() throws Exception{
+        String companyName = request.getParameter("companyName");
+        String macId = request.getParameter("macId");
+        String wifiName = request.getParameter("wifiName");
+
+        if(StringUtils.isEmpty(macId) || StringUtils.isEmpty(companyName)){
+            log.info("macId:" + macId);
+            log.info("companyName:" + companyName);
+            throw new BusinessException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
+        }
+
+        return vaildCameraService.addVaildCameras(macId, companyName, wifiName);
+    }
+
+    /**
+     * 删除企业可用相机列表
+     * @param
+     * @return
+     */
+    @RequestMapping(value = "/deleteVaildCameras")
+    public Result deleteVaildCameras() throws Exception{
+        String companyName = request.getParameter("companyName");
+        String macId = request.getParameter("macId");
+
+        if(StringUtils.isEmpty(macId) || StringUtils.isEmpty(companyName)){
+            log.info("macId:" + macId);
+            log.info("companyName:" + companyName);
+            throw new BusinessException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
+        }
+
+        return vaildCameraService.deleteVaildCameras(macId, companyName);
+    }
+
+}

+ 51 - 12
src/main/java/com/fdkankan/ucenter/controller/app/SceneApiController.java

@@ -37,6 +37,7 @@ import com.fdkankan.ucenter.service.ISceneProService;
 import com.fdkankan.ucenter.service.ISceneStatisticsService;
 import com.fdkankan.ucenter.service.IUserService;
 import com.fdkankan.ucenter.service.impl.LoginService;
+import com.fdkankan.ucenter.service.impl.SceneApiService;
 import com.fdkankan.ucenter.vo.request.LoginParam;
 import com.fdkankan.ucenter.vo.request.RequestSceneStatistics;
 import com.fdkankan.ucenter.vo.response.LoginVo;
@@ -44,21 +45,16 @@ import com.fdkankan.ucenter.vo.response.SceneInfoVo;
 import com.fdkankan.ucenter.vo.response.UserVo;
 import java.io.File;
 import java.net.URLEncoder;
-import java.util.Arrays;
-import java.util.HashMap;
+import java.util.*;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
+import org.joda.time.DateTime;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 @Slf4j
 @RestController
@@ -91,13 +87,12 @@ public class SceneApiController extends BaseController {
     private ISceneProEditService sceneProEditService;
     @Autowired
     private FYunFileServiceInterface fYunFileService;
+    @Autowired
+    SceneApiService sceneApiService;
 
     @Value("${main.url}")
     private String mainUrl;
 
-    @Value("${scene.url}")
-    private String sceneUrl;
-
     @Value("${scene.pro.url}")
     private String sceneProUrl;
 
@@ -118,7 +113,7 @@ public class SceneApiController extends BaseController {
     }
 
 
-    //跳转到编辑页面
+    //app 使用跳转到编辑页面
     @RequestMapping("/goEditScenePage")
     public void goEditScenePage(HttpServletRequest request, HttpServletResponse response) throws Exception{
         String phoneNum = request.getParameter("phoneNum");
@@ -391,4 +386,48 @@ public class SceneApiController extends BaseController {
     }
 
 
+    /**
+     * 内部使用查询场景名称和场景码
+     */
+    @RequestMapping(value = "/getScenesBySnCode", method = RequestMethod.GET)
+    public Result getScenesBySnCode(String snCode) throws Exception{
+        return sceneApiService.getScenesBySnCode(snCode,getToken());
+    }
+
+    /**
+     * 思为获取场景列表
+     */
+    @RequestMapping(value = "/siweiSceneList", method = RequestMethod.GET)
+    public Result siweiSceneList(HttpServletRequest request) throws Exception{
+        return Result.success(sceneApiService.siweiSceneList(request,getToken()));
+    }
+
+    /**
+     * 场景浏览
+     * @param scene
+     * @return
+     */
+    @RequestMapping(value = "/loadAllScene", method = RequestMethod.POST)
+    public Result loadAllScene(@RequestBody JSONObject param) throws Exception {
+        return Result.success(sceneApiService.loadAllScene(param));
+    }
+
+    /**
+     * 增加场景下载次数
+     */
+    @RequestMapping(value = "/addDownloadNum", method = RequestMethod.GET)
+    public Result addDownloadNum(HttpServletRequest request) throws Exception{
+        sceneApiService.addDownloadNum(request.getParameter("sceneNum"));
+        return Result.success();
+    }
+
+    /**
+     * 获取编辑页面的资源下载路径
+     */
+    @RequestMapping(value = "/getEditDataUrl")
+    public Result getEditDataUrl(HttpServletRequest request) throws Exception{
+        List<String> result = sceneApiService.getEditDataUrl(request.getParameter("num"));
+        return Result.success(result);
+    }
+
 }

+ 72 - 0
src/main/java/com/fdkankan/ucenter/entity/HotShop.java

@@ -0,0 +1,72 @@
+package com.fdkankan.ucenter.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.io.Serializable;
+import java.util.Date;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * <p>
+ * 热点与商品关联表
+ * </p>
+ *
+ * @author 
+ * @since 2022-11-02
+ */
+@Getter
+@Setter
+@TableName("t_hot_shop")
+public class HotShop implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 热点id
+     */
+    @TableField("hot_id")
+    private String hotId;
+
+    /**
+     * 商品id
+     */
+    @TableField("good_id")
+    private Long goodId;
+
+    /**
+     * 场景码
+     */
+    @TableField("scene_num")
+    private String sceneNum;
+
+    /**
+     * 热点里卡夹的sid
+     */
+    @TableField("page_sid")
+    private String pageSid;
+
+    /**
+     * 起源的小程序
+     */
+    @TableField("origin")
+    private String origin;
+
+    @TableField("create_time")
+    private String createTime;
+
+    @TableField("update_time")
+    private String updateTime;
+
+    @TableField("rec_status")
+    @TableLogic(value = "A",delval = "I")
+    private String recStatus;
+
+
+}

+ 66 - 0
src/main/java/com/fdkankan/ucenter/entity/VaildCameras.java

@@ -0,0 +1,66 @@
+package com.fdkankan.ucenter.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.io.Serializable;
+import java.util.Date;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * <p>
+ * 代理商可用相机表
+ * </p>
+ *
+ * @author 
+ * @since 2022-11-02
+ */
+@Getter
+@Setter
+@TableName("t_vaild_cameras")
+public class VaildCameras implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 公司名称
+     */
+    @TableField("company_name")
+    private String companyName;
+
+    /**
+     * 相机文件地址
+     */
+    @TableField("file_path")
+    private String filePath;
+
+    /**
+     * 文件名称
+     */
+    @TableField("wifi_name")
+    private String wifiName;
+
+    /**
+     * 设备macId
+     */
+    @TableField("devicemac")
+    private String devicemac;
+
+    @TableField("rec_status")
+    @TableLogic(value = "A",delval = "I")
+    private String recStatus;
+
+    @TableField("create_time")
+    private String createTime;
+
+    @TableField("update_time")
+    private String updateTime;
+
+
+}

+ 1 - 1
src/main/java/com/fdkankan/ucenter/generate/AutoGenerate.java

@@ -18,7 +18,7 @@ public class AutoGenerate {
         String path =System.getProperty("user.dir") ;
 
         generate(path,"ucenter", getTables(new String[]{
-                "t_scene_statistics",
+                "t_hot_shop",
         }));
 
 //        generate(path,"goods", getTables(new String[]{

+ 5 - 0
src/main/java/com/fdkankan/ucenter/httpClient/client/LaserClient.java

@@ -45,4 +45,9 @@ public interface LaserClient {
      */
     @Post("/laser/init/{sceneNum}/saveOrEdit")
     Result saveOrEdit(@Var("sceneNum") String sceneNum, @JSONBody  Map<String,Object> params);
+    /**
+     * 新增场景
+     */
+    @Post("/laser/4dage/scene/getScenesBySnCode")
+    Result getScenesBySnCode(@JSONBody Map<String, String> param, @Header("fdToken") String token) ;
 }

+ 18 - 0
src/main/java/com/fdkankan/ucenter/httpClient/service/LaserService.java

@@ -12,6 +12,7 @@ import com.fdkankan.ucenter.entity.User;
 import com.fdkankan.ucenter.httpClient.client.LaserClient;
 import com.fdkankan.ucenter.service.ICameraService;
 import com.fdkankan.ucenter.service.IUserService;
+import com.fdkankan.ucenter.vo.SceneBySnCodeVo;
 import com.fdkankan.ucenter.vo.response.SceneNumVo;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
@@ -186,4 +187,21 @@ public class LaserService {
         }
     }
 
+    public List<SceneBySnCodeVo> getScenesBySnCode(String snCode, String token) {
+        List<SceneBySnCodeVo> sceneVo = new ArrayList<>();
+        try {
+            HashMap<String ,String> param = new HashMap<>();
+            param.put("snCode",snCode);
+            Result responseEntity = laserClient.getScenesBySnCode(param, token);
+            if( responseEntity.getCode() != HttpStatus.OK.value()){
+                log.error("根据snCode获取激光转台场景失败!");
+                return sceneVo;
+            }
+            sceneVo = JSONObject.parseObject(JSONObject.toJSONString(responseEntity.getData()), List.class);
+        }catch (Exception e){
+            log.error("根据snCode获取激光转台场景失败!",e);
+        }
+        return sceneVo ;
+    }
+
 }

+ 18 - 0
src/main/java/com/fdkankan/ucenter/mapper/IHotShopMapper.java

@@ -0,0 +1,18 @@
+package com.fdkankan.ucenter.mapper;
+
+import com.fdkankan.ucenter.entity.HotShop;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ * 热点与商品关联表 Mapper 接口
+ * </p>
+ *
+ * @author 
+ * @since 2022-11-02
+ */
+@Mapper
+public interface IHotShopMapper extends BaseMapper<HotShop> {
+
+}

+ 18 - 0
src/main/java/com/fdkankan/ucenter/mapper/IVaildCamerasMapper.java

@@ -0,0 +1,18 @@
+package com.fdkankan.ucenter.mapper;
+
+import com.fdkankan.ucenter.entity.VaildCameras;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ * 代理商可用相机表 Mapper 接口
+ * </p>
+ *
+ * @author 
+ * @since 2022-11-02
+ */
+@Mapper
+public interface IVaildCamerasMapper extends BaseMapper<VaildCameras> {
+
+}

+ 16 - 0
src/main/java/com/fdkankan/ucenter/service/IHotShopService.java

@@ -0,0 +1,16 @@
+package com.fdkankan.ucenter.service;
+
+import com.fdkankan.ucenter.entity.HotShop;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 热点与商品关联表 服务类
+ * </p>
+ *
+ * @author 
+ * @since 2022-11-02
+ */
+public interface IHotShopService extends IService<HotShop> {
+
+}

+ 8 - 0
src/main/java/com/fdkankan/ucenter/service/ISceneProService.java

@@ -1,14 +1,18 @@
 package com.fdkankan.ucenter.service;
 
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fdkankan.ucenter.common.Result;
 import com.fdkankan.ucenter.entity.CameraDetail;
 import com.fdkankan.ucenter.entity.ScenePlus;
 import com.fdkankan.ucenter.entity.ScenePro;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.fdkankan.ucenter.vo.ResponseScene;
 import com.fdkankan.ucenter.vo.request.SceneParam;
 import com.fdkankan.ucenter.vo.response.GroupByCount;
 import com.fdkankan.ucenter.vo.response.SceneInfoVo;
 import com.fdkankan.ucenter.vo.response.SceneNumVo;
+import com.fdkankan.ucenter.vo.response.SceneVo;
 
 import java.util.HashMap;
 import java.util.List;
@@ -77,4 +81,8 @@ public interface ISceneProService extends IService<ScenePro> {
      void copyFdage(String oldDataSource, String newDataSource, String buildModelPath, String time) throws Exception;
 
     void copySceneNoCheck(String sceneNum) throws Exception;
+
+    ResponseScene getSceneDetail(String sceneNum);
+
+    Page<SceneVo> pageListAndFolder(Page<Object> page, SceneParam param);
 }

+ 2 - 0
src/main/java/com/fdkankan/ucenter/service/ISceneService.java

@@ -25,4 +25,6 @@ public interface ISceneService extends IService<Scene> {
     List<Scene> getListByNums(List<String> numList);
 
     JSONObject pageList(SceneParam param);
+
+    Scene getByNum(String sceneNum);
 }

+ 22 - 0
src/main/java/com/fdkankan/ucenter/service/IVaildCamerasService.java

@@ -0,0 +1,22 @@
+package com.fdkankan.ucenter.service;
+
+import com.fdkankan.ucenter.common.Result;
+import com.fdkankan.ucenter.entity.VaildCameras;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 代理商可用相机表 服务类
+ * </p>
+ *
+ * @author 
+ * @since 2022-11-02
+ */
+public interface IVaildCamerasService extends IService<VaildCameras> {
+
+    Result getVaildCameras(String file, String companyName) throws Exception;
+
+    Result addVaildCameras(String macId, String companyName, String wifiName);
+
+    Result deleteVaildCameras(String macId, String companyName);
+}

+ 7 - 0
src/main/java/com/fdkankan/ucenter/service/impl/AgentAuditServiceImpl.java

@@ -37,6 +37,13 @@ public class AgentAuditServiceImpl extends ServiceImpl<IAgentAuditMapper, AgentA
         if(!param.getEmail().matches(ConstantRegex.EMAIL_REGEX)){
             throw new BusinessException(LoginConstant.FAILURE_CODE_3019, LoginConstant.FAILURE_MSG_3019);
         }
+        if(param.getName().length() >200 || param.getAddress().length() >200
+                || param.getSurName().length() >50 || param.getUserName().length() >50){
+            if(StringUtils.isNotBlank(param.getStoreAddress()) && param.getStoreAddress().length() >200){
+                throw new BusinessException(LoginConstant.FAILURE_CODE_3036, LoginConstant.FAILURE_MSG_3036);
+            }
+            throw new BusinessException(LoginConstant.FAILURE_CODE_3036, LoginConstant.FAILURE_MSG_3036);
+        }
 
         AgentAudit agentAuditEntity = new AgentAudit();
         BeanUtils.copyProperties(param, agentAuditEntity);

+ 1 - 0
src/main/java/com/fdkankan/ucenter/service/impl/AppSceneService.java

@@ -1,6 +1,7 @@
 package com.fdkankan.ucenter.service.impl;
 
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fdkankan.common.util.JwtUtil;
 import com.fdkankan.ucenter.common.constants.ConstantFilePath;
 import com.fdkankan.common.constant.SceneConstant;
 import com.fdkankan.common.exception.BusinessException;

+ 20 - 0
src/main/java/com/fdkankan/ucenter/service/impl/HotShopServiceImpl.java

@@ -0,0 +1,20 @@
+package com.fdkankan.ucenter.service.impl;
+
+import com.fdkankan.ucenter.entity.HotShop;
+import com.fdkankan.ucenter.mapper.IHotShopMapper;
+import com.fdkankan.ucenter.service.IHotShopService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 热点与商品关联表 服务实现类
+ * </p>
+ *
+ * @author 
+ * @since 2022-11-02
+ */
+@Service
+public class HotShopServiceImpl extends ServiceImpl<IHotShopMapper, HotShop> implements IHotShopService {
+
+}

+ 267 - 0
src/main/java/com/fdkankan/ucenter/service/impl/SceneApiService.java

@@ -0,0 +1,267 @@
+package com.fdkankan.ucenter.service.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fdkankan.common.exception.BusinessException;
+import com.fdkankan.common.util.FileUtils;
+import com.fdkankan.redis.constant.RedisKey;
+import com.fdkankan.redis.util.RedisUtil;
+import com.fdkankan.ucenter.common.PageInfo;
+import com.fdkankan.ucenter.common.Result;
+import com.fdkankan.ucenter.common.constants.ConstantFilePath;
+import com.fdkankan.ucenter.constant.CameraConstant;
+import com.fdkankan.ucenter.constant.LoginConstant;
+import com.fdkankan.ucenter.entity.*;
+import com.fdkankan.ucenter.httpClient.service.LaserService;
+import com.fdkankan.ucenter.service.*;
+import com.fdkankan.ucenter.util.DateUserUtil;
+import com.fdkankan.ucenter.vo.SceneBySnCodeVo;
+import com.fdkankan.ucenter.vo.request.SceneParam;
+import com.fdkankan.ucenter.vo.response.SceneVo;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.*;
+
+@Service
+public class SceneApiService {
+
+    @Autowired
+    RedisUtil redisUtil;
+    @Autowired
+    ICameraService cameraService;
+    @Autowired
+    ICameraDetailService cameraDetailService;
+    @Autowired
+    ISceneService sceneService;
+    @Autowired
+    ISceneProService sceneProService;
+    @Autowired
+    IScenePlusService scenePlusService;
+    @Autowired
+    ISceneEditInfoService sceneEditInfoService;
+    @Autowired
+    IScenePlusExtService scenePlusExtService;
+    @Autowired
+    ISceneProEditService sceneProEditService;
+    @Autowired
+    LaserService laserService;
+    @Autowired
+    IUserService userService;
+
+    public Result getScenesBySnCode(String snCode, String token) {
+        User user = checkToken(token);
+        if(StringUtils.isEmpty(snCode)){
+            throw new BusinessException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
+        }
+
+        Camera cameraEntity = cameraService.getBySnCode(snCode);
+        if(cameraEntity == null ){
+            throw new BusinessException(CameraConstant.FAILURE_CODE_6018, CameraConstant.FAILURE_MSG_6018);
+        }
+        CameraDetail cameraDetailEntity = cameraDetailService.getByCameraId(cameraEntity.getId());
+        if(cameraDetailEntity == null ){
+            throw new BusinessException(CameraConstant.FAILURE_CODE_6018, CameraConstant.FAILURE_MSG_6018);
+        }
+        if(!cameraDetailEntity.getUserId().equals(user.getId())){
+            return Result.success();
+        }
+        if(cameraDetailEntity.getType() == 10 ){    //激光场景
+            List<SceneBySnCodeVo> scenesBySnCode = laserService.getScenesBySnCode(snCode, token);
+            return Result.success(scenesBySnCode);
+        }
+        List<SceneBySnCodeVo> sceneVo = new ArrayList<>();
+
+        LambdaQueryWrapper<ScenePro> proWr = new LambdaQueryWrapper<>();
+        proWr.eq(ScenePro::getCameraId,cameraEntity.getId());
+        proWr.eq(ScenePro::getIsUpgrade,0);
+        proWr.eq(ScenePro::getUserId,user.getId());
+        proWr.ne(ScenePro::getSceneSource,11);
+        List<ScenePro> list = sceneProService.list(proWr);
+        for (ScenePro scenePro : list) {
+            SceneBySnCodeVo sceneBySnCodeVo = new SceneBySnCodeVo();
+            sceneBySnCodeVo.setSceneNum(scenePro.getNum());
+            sceneBySnCodeVo.setSceneName(scenePro.getSceneName());
+            sceneVo.add(sceneBySnCodeVo);
+        }
+
+        LambdaQueryWrapper<ScenePlus> pluWr = new LambdaQueryWrapper<>();
+        pluWr.eq(ScenePlus::getCameraId,cameraEntity.getId());
+        pluWr.eq(ScenePlus::getUserId,user.getId());
+        pluWr.ne(ScenePlus::getSceneSource,11);
+        List<ScenePlus> list1 = scenePlusService.list(pluWr);
+
+        for (ScenePlus scenePlus : list1) {
+            SceneBySnCodeVo sceneBySnCodeVo = new SceneBySnCodeVo();
+            sceneBySnCodeVo.setSceneNum(scenePlus.getNum());
+            sceneBySnCodeVo.setSceneName(scenePlus.getTitle());
+            sceneVo.add(sceneBySnCodeVo);
+        }
+        return Result.success(sceneVo);
+    }
+
+    private User checkToken (String token){
+        if(StringUtils.isEmpty(token)){
+            throw new BusinessException(3004, "无token参数");
+        }
+        String redisKey = String.format(RedisKey.TOKEN_V3,token);
+
+        if( !redisUtil.hasKey(redisKey)){
+            throw new BusinessException(3004, "token参数不正确");
+        }
+        User user = userService.getByToken(token);
+        if(user == null){
+            throw new BusinessException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
+        }
+        return user;
+    }
+
+    public PageInfo siweiSceneList(HttpServletRequest request, String token) {
+        User user = checkToken(token);
+        String pageNumStr = request.getParameter("pageNum");
+        String pageSizeStr = request.getParameter("pageSize");
+
+        String sceneName = request.getParameter("sceneName");
+        String snCode = request.getParameter("snCode");
+        String startDate = request.getParameter("startDate");
+        String endDate = request.getParameter("endDate");
+        String num = request.getParameter("num");
+
+        Integer pageNum = 1;
+        Integer pageSize = 10;
+        if(StringUtils.isNotEmpty(pageNumStr)){
+            pageNum = Integer.valueOf(pageNumStr);
+        }
+
+        if(StringUtils.isNotEmpty(pageSizeStr)){
+            pageSize = Integer.valueOf(pageSizeStr);
+        }
+        SceneParam param  = new SceneParam();
+        param.setHasFolder(0);
+        param.setPageNum(pageNum);
+        param.setPageSize(pageSize);
+        param.setSnCode(snCode);
+        param.setStartTime(startDate);
+        param.setEndTime(endDate);
+        param.setUserId(user.getId());
+        Page<SceneVo> sceneVoPage = sceneProService.pageListAndFolder(new Page<>(param.getPageNum(),param.getPageSize()),param);
+        List<Map<String, Object>> list = new ArrayList<>();
+        for (SceneVo sceneVo : sceneVoPage.getRecords()) {
+            HashMap<String,Object> map = new HashMap<>();
+            map.put("num", sceneVo.getNum());
+            map.put("sceneName", sceneVo.getSceneName());
+            Camera cameraEntity = cameraService.getById(sceneVo.getCameraId());
+            if(cameraEntity != null){
+                map.put("snCode", cameraEntity.getSnCode());
+            }
+            map.put("webSite", sceneVo.getWebSite());
+            map.put("createDate", DateUserUtil.getDate(sceneVo.getCreateTime()).getTime());
+            map.put("createTime", sceneVo.getCreateTime());
+            map.put("thumb", sceneVo.getThumb());
+            map.put("isUpgrade", sceneVo.getIsUpgrade());
+
+            if(sceneVo.getIsUpgrade() == 0){
+                ScenePro scenePro = sceneProService.getById(sceneVo.getId());
+                if(scenePro!= null){
+                    map.put("shootCount", scenePro.getShootCount());
+                    SceneProEdit sceneProEdit = sceneProEditService.getByProId(scenePro.getId());
+                    map.put("version", sceneProEdit.getVersion());
+                }
+            }
+            if(sceneVo.getIsUpgrade() == 1){
+                ScenePlus scenePlus = scenePlusService.getById(sceneVo.getId());
+                if(scenePlus!= null){
+                    ScenePlusExt ext = scenePlusExtService.getByPlusId(scenePlus.getId());
+                    map.put("shootCount", ext.getShootCount());
+                    SceneEditInfo editInfo = sceneEditInfoService.getByScenePlusId(scenePlus.getId());
+                    map.put("version", editInfo.getVersion());
+                }
+            }
+
+            list.add(map);
+        }
+        Page<Map<String, Object>> page = new Page<Map<String, Object>>(pageNum, pageSize);
+        page.setTotal(sceneVoPage.getTotal());
+        page.setRecords(list);
+        return PageInfo.PageInfo(page);
+    }
+
+    public PageInfo loadAllScene(JSONObject param) {
+        String searchKey = param.getString("searchKey");
+        Integer pageNum = param.getInteger("pageNum") == null ?1 : param.getInteger("pageNum");
+        Integer pageSize = param.getInteger("pageSize")== null ?10 : param.getInteger("pageSize");
+
+
+        if(param.getInteger("sceneScheme") == 4){
+            LambdaQueryWrapper<ScenePro> wrapper = new LambdaQueryWrapper<>();
+            wrapper.in(ScenePro::getStatus, Arrays.asList(1,-2));
+            if(StringUtils.isNotEmpty(searchKey)){
+                wrapper.like(ScenePro::getSceneName,searchKey);
+                wrapper.or().like(ScenePro::getNum,searchKey);
+            }
+            wrapper.orderByDesc(ScenePro::getCreateTime);
+            Page<ScenePro> proPage = sceneProService.page(new Page<>(pageNum,pageSize),wrapper);
+            return PageInfo.PageInfo(proPage);
+        }
+        LambdaQueryWrapper<Scene> wrapper = new LambdaQueryWrapper<>();
+        wrapper.in(Scene::getStatus, Arrays.asList(1,-2));
+        if(StringUtils.isNotEmpty(searchKey)){
+            wrapper.like(Scene::getSceneName,searchKey);
+            wrapper.or().like(Scene::getNum,searchKey);
+        }
+        wrapper.orderByDesc(Scene::getCreateTime);
+        Page<Scene> proPage = sceneService.page(new Page<>(pageNum,pageSize),wrapper);
+        return PageInfo.PageInfo(proPage);
+    }
+
+    public void addDownloadNum(String sceneNum) {
+        if(StringUtils.isEmpty(sceneNum)){
+            throw new BusinessException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
+        }
+        ScenePro scenePro = sceneProService.getByNum(sceneNum);
+        if(scenePro != null){
+            SceneProEdit sceneProEditEntity = sceneProEditService.getByProId(scenePro.getId());
+            if(sceneProEditEntity.getDownloadNum() == null){
+                sceneProEditEntity.setDownloadNum(1);
+            }else{
+                sceneProEditEntity.setDownloadNum(sceneProEditEntity.getDownloadNum() + 1);
+            }
+            sceneProEditService.updateById(sceneProEditEntity);
+        }
+    }
+
+    public List<String> getEditDataUrl(String num) {
+
+        if(StringUtils.isEmpty(num)){
+            throw new BusinessException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
+        }
+        List<String> result = new ArrayList<>();
+        ScenePro scenePro = sceneProService.getByNum(num);
+        if(scenePro != null){
+            List<String> urlList = new ArrayList<>();
+            FileUtils.readfilePath(ConstantFilePath.SCENE_PATH + "data/data" + num, urlList);
+            FileUtils.readfilePath(ConstantFilePath.SCENE_PATH + "images/images" + num, urlList);
+            FileUtils.readfilePath(ConstantFilePath.SCENE_PATH + "voice/voice" + num, urlList);
+            if(urlList.size() > 0){
+                for(String url : urlList){
+                    result.add(url.replace(ConstantFilePath.BASE_PATH + "/", ""));
+                }
+            }
+        }else {
+            ScenePlus plus = scenePlusService.getByNum(num);
+            if(plus != null){
+                List<String> urlList = new ArrayList<>();
+                FileUtils.readfilePath(ConstantFilePath.SCENE_V4_PATH + num, urlList);
+                if(urlList.size() > 0){
+                    for(String url : urlList){
+                        result.add(url.replace(ConstantFilePath.SCENE_V4_PATH , "scene_edit_data/"));
+                    }
+                }
+            }
+        }
+        return result;
+    }
+}

+ 76 - 2
src/main/java/com/fdkankan/ucenter/service/impl/SceneProServiceImpl.java

@@ -29,6 +29,7 @@ import com.fdkankan.ucenter.mapper.ISceneProMapper;
 import com.fdkankan.ucenter.mapper.ISceneUpgradeMapper;
 import com.fdkankan.ucenter.service.*;
 import com.fdkankan.ucenter.util.DateUserUtil;
+import com.fdkankan.ucenter.vo.ResponseScene;
 import com.fdkankan.ucenter.vo.request.SceneParam;
 import com.fdkankan.ucenter.vo.response.GroupByCount;
 import com.fdkankan.ucenter.vo.response.SceneInfoVo;
@@ -47,6 +48,7 @@ import java.util.stream.Collectors;
 import javax.annotation.Resource;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
+import org.joda.time.DateTime;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
@@ -82,6 +84,8 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
     @Autowired
     private IScenePlusExtService scenePlusExtService;
     @Autowired
+    private ISceneEditInfoService sceneEditInfoService;
+    @Autowired
     private ICameraDetailService cameraDetailService;
     @Autowired
     private IFolderService folderService;
@@ -94,8 +98,6 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
     @Autowired
     private ISceneProEditService sceneProEditService;
     @Autowired
-    private ISceneEditInfoService sceneEditInfoService;
-    @Autowired
     private RedisUtil redisUtil;
     @Resource
     private ISceneUpgradeMapper sceneUpgradeMapper;
@@ -372,6 +374,11 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
     }
 
     @Override
+    public Page<SceneVo> pageListAndFolder(Page<Object> page, SceneParam param) {
+       return  getBaseMapper().pageListAndFolder(new Page<>(param.getPageNum(),param.getPageSize()),param);
+    }
+
+    @Override
     public JSONObject newList(SceneParam param, String username) {
         User user = userService.getByUserName(username);
         param.setSourceList(getSceneSource(param.getSceneSource()));
@@ -1056,4 +1063,71 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
         mqMsg.setPath(scenePlusExt.getDataSource());
         mqProducer.sendByWorkQueue(queueObjModelingPre,mqMsg);
     }
+
+    @Override
+    public ResponseScene getSceneDetail(String sceneNum) {
+        ResponseScene vo = new ResponseScene();
+        Scene sceneEntity = sceneService.getByNum(sceneNum);
+        if(sceneEntity != null){
+            return getResponseScene(vo, sceneEntity);
+        }
+
+        ScenePro sceneProEntity = this.getByNum(sceneNum);
+        if(sceneProEntity != null){
+            SceneProEdit  sceneProEditEntity = sceneProEditService.getByProId(sceneProEntity.getId());
+            return getResponseProScene(vo, sceneProEntity, sceneProEditEntity);
+        }
+        ScenePlus scenePlus = scenePlusService.getByNum(sceneNum);
+        if(scenePlus != null){
+            ScenePlusExt ext = scenePlusExtService.getByPlusId(scenePlus.getId());
+            SceneEditInfo sceneEditInfo = sceneEditInfoService.getByScenePlusId(scenePlus.getId());
+            return getResponseProScene(vo, scenePlus, ext,sceneEditInfo);
+
+        }
+        return vo;
+    }
+
+    private ResponseScene getResponseScene(ResponseScene vo, Scene sceneEntity) {
+        if (sceneEntity != null){
+            BeanUtils.copyProperties(sceneEntity, vo);
+
+            vo.setThumbImg(sceneEntity.getThumbStatus());
+            vo.setCreateTime(new DateTime(sceneEntity.getCreateTime()).toString("yyyy-MM-dd HH:mm"));
+            vo.setSceneIndex(sceneEntity.getStyle());
+            vo.setHasBGM(sceneEntity.getBgMusic());
+            vo.setCameraType(sceneEntity.getSceneScheme());
+            vo.setIsPublic(StringUtils.isEmpty(sceneEntity.getSceneKey()) ? 0 : 1);
+        }
+        return vo;
+    }
+    private ResponseScene getResponseProScene(ResponseScene vo, ScenePro sceneProEntity, SceneProEdit sceneProEditEntity) {
+        if (sceneProEntity != null){
+            BeanUtils.copyProperties(sceneProEditEntity, vo);
+            BeanUtils.copyProperties(sceneProEntity, vo);
+            vo.setCreateTime(new DateTime(sceneProEntity.getCreateTime()).toString("yyyy-MM-dd HH:mm"));
+            vo.setCameraType(sceneProEntity.getSceneScheme());
+
+            vo.setThumbImg(sceneProEditEntity.getThumbStatus());
+            vo.setHasBGM(sceneProEditEntity.getBgMusic());
+            vo.setIsPublic(StringUtils.isEmpty(sceneProEditEntity.getSceneKey()) ? 0 : 1);
+        }
+        return vo;
+    }
+    private ResponseScene getResponseProScene(ResponseScene vo, ScenePlus plus, ScenePlusExt ext,SceneEditInfo editInfo) {
+        if (plus != null){
+            BeanUtils.copyProperties(plus, vo);
+            BeanUtils.copyProperties(ext, vo);
+            BeanUtils.copyProperties(editInfo, vo);
+
+            vo.setNum(plus.getNum());
+            vo.setSceneName(plus.getTitle());
+            vo.setCreateTime(new DateTime(plus.getCreateTime()).toString("yyyy-MM-dd HH:mm"));
+            vo.setCameraType(ext.getSceneScheme());
+
+            vo.setThumbImg(1);
+            vo.setHasBGM(editInfo.getMusic());
+            vo.setIsPublic(StringUtils.isEmpty(editInfo.getScenePassword()) ? 0 : 1);
+        }
+        return vo;
+    }
 }

+ 11 - 0
src/main/java/com/fdkankan/ucenter/service/impl/SceneServiceImpl.java

@@ -95,4 +95,15 @@ public class SceneServiceImpl extends ServiceImpl<ISceneMapper, Scene> implement
         jsonObject.put("sceneNum",page.getTotal() );
         return jsonObject;
     }
+
+    @Override
+    public Scene getByNum(String sceneNum) {
+        LambdaQueryWrapper<Scene> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(Scene::getNum,sceneNum);
+        List<Scene> list = this.list(wrapper);
+        if(list != null && list.size() >0){
+            return list.get(0);
+        }
+        return null;
+    }
 }

+ 127 - 0
src/main/java/com/fdkankan/ucenter/service/impl/VaildCamerasServiceImpl.java

@@ -0,0 +1,127 @@
+package com.fdkankan.ucenter.service.impl;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.fdkankan.common.constant.SceneConstant;
+import com.fdkankan.common.exception.BusinessException;
+import com.fdkankan.common.util.AesUtil;
+import com.fdkankan.common.util.FileUtils;
+import com.fdkankan.ucenter.common.FileUtil;
+import com.fdkankan.ucenter.common.RSAEncrypt;
+import com.fdkankan.ucenter.common.Result;
+import com.fdkankan.ucenter.common.constants.ConstantFilePath;
+import com.fdkankan.ucenter.constant.CameraConstant;
+import com.fdkankan.ucenter.constant.LoginConstant;
+import com.fdkankan.ucenter.entity.VaildCameras;
+import com.fdkankan.ucenter.mapper.IVaildCamerasMapper;
+import com.fdkankan.ucenter.service.IVaildCamerasService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+/**
+ * <p>
+ * 代理商可用相机表 服务实现类
+ * </p>
+ *
+ * @author 
+ * @since 2022-11-02
+ */
+@Service
+public class VaildCamerasServiceImpl extends ServiceImpl<IVaildCamerasMapper, VaildCameras> implements IVaildCamerasService {
+
+    @Value("${main.url}")
+    private String mainUrl;
+
+    @Override
+    public Result getVaildCameras(String file, String companyName) throws Exception {
+        LambdaQueryWrapper<VaildCameras> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(VaildCameras::getCompanyName,companyName);
+        List<VaildCameras> vaildCamerasEntityList = this.list(wrapper);
+        if(vaildCamerasEntityList == null || vaildCamerasEntityList.size() <= 0){
+            throw new BusinessException(CameraConstant.FAILURE_CODE_6011, CameraConstant.FAILURE_MSG_6011);
+        }
+
+        //生成需要加密的文件
+        UUID uuid = UUID.randomUUID();
+        String key = uuid.toString().replace("-","").substring(0,16);
+
+        JSONArray array = new JSONArray();
+        JSONObject object = null;
+        for(VaildCameras vaildCamerasEntity: vaildCamerasEntityList){
+            object = new JSONObject();
+            object.put("Devicemac", vaildCamerasEntity.getDevicemac());
+            array.add(object);
+        }
+        String aesData = AesUtil.encryptAES(array.toString(), key, key);
+
+        String dataPath = ConstantFilePath.AGENT_PATH + companyName + File.separator + System.currentTimeMillis() + "_" + Math.random()*100 + "_key.txt";
+        FileUtils.writeFile(dataPath, key);
+
+        String secretPath = ConstantFilePath.AGENT_PATH + companyName + "/secret/";
+        String fileName = System.currentTimeMillis() + "_public.pem";
+        File targetFile = new File(secretPath + fileName);
+        if(!targetFile.getParentFile().exists()){
+            targetFile.getParentFile().mkdirs();
+        }
+        FileUtils.writeFile(secretPath + fileName, file);
+
+        if(!new File(secretPath + fileName).exists()){
+            throw new BusinessException(LoginConstant.FAILURE_CODE_3018, LoginConstant.FAILURE_MSG_3018);
+        }
+
+        byte[] data = RSAEncrypt.encrypt(RSAEncrypt.loadPublicKeyByStr(RSAEncrypt.loadPublicKeyByFile(secretPath + fileName)),
+                FileUtil.toByteArray3(dataPath));
+
+        //加密后的文件地址
+        String resultPath = ConstantFilePath.AGENT_PATH + companyName + "/secretData/";
+        String resultName = System.currentTimeMillis() + "_data.txt";
+        FileUtils.writeFile(resultPath, resultName, data);
+
+        Map map = new HashMap();
+        map.put("aecData", aesData);
+        map.put("keyUrl", mainUrl + "agent/" + companyName + "/secretData/" + resultName);
+        return Result.success(map);
+    }
+
+    @Override
+    public Result addVaildCameras(String macId, String companyName, String wifiName) {
+        String regex = "^[a-z0-9A-Z#]+$";
+        if(!macId.matches(regex) || macId.length() != 25 || macId.indexOf("#") != 12){
+            throw new BusinessException(SceneConstant.FAILURE_CODE_5012, SceneConstant.FAILURE_MSG_5012);
+        }
+
+        LambdaQueryWrapper<VaildCameras> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(VaildCameras::getCompanyName,companyName);
+        wrapper.eq(VaildCameras::getDevicemac,macId);
+        List<VaildCameras> vaildCamerasEntityList = this.list(wrapper);
+
+        if(vaildCamerasEntityList.size()>0 ){
+            throw new BusinessException(CameraConstant.FAILURE_CODE_6001, CameraConstant.FAILURE_MSG_6001);
+        }
+
+        VaildCameras vaildCameras = new VaildCameras();
+        vaildCameras.setDevicemac(macId);
+        vaildCameras.setWifiName(wifiName);
+        vaildCameras.setCompanyName(companyName);
+        this.save(vaildCameras);
+
+        return Result.success();
+    }
+
+    @Override
+    public Result deleteVaildCameras(String macId, String companyName) {
+        LambdaQueryWrapper<VaildCameras> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(VaildCameras::getCompanyName,companyName);
+        wrapper.eq(VaildCameras::getDevicemac,macId);
+        this.remove(wrapper);
+        return Result.success();
+    }
+}

+ 22 - 0
src/main/java/com/fdkankan/ucenter/vo/RequestHotShop.java

@@ -0,0 +1,22 @@
+package com.fdkankan.ucenter.vo;
+
+import lombok.Data;
+
+/**
+ * Created by Hb_zzZ on 2020/3/5.
+ */
+@Data
+public class RequestHotShop {
+
+    private Long goodId;
+
+    private String hotId;
+
+    private String sceneNum;
+
+    private String goodsIds;
+
+    private String pageSid;
+
+    private String origin;
+}

+ 273 - 0
src/main/java/com/fdkankan/ucenter/vo/ResponseScene.java

@@ -0,0 +1,273 @@
+package com.fdkankan.ucenter.vo;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigInteger;
+
+@Data
+public class ResponseScene implements Serializable {
+
+    private static final long serialVersionUID = 2454435822930272529L;
+
+    private Long id;
+
+    /**"场景缩略图", name = "thumb*/
+    private String thumb;
+
+    /**"大场景的密钥", name = "sceneKey*/
+    private String sceneKey;
+
+    /**"场景名称", name = "sceneName*/
+    private String sceneName;
+
+    /**"场景描述", name = "sceneDec*/
+    private String sceneDec;
+
+    /**"0表示其他,1表示文博,2表示地产,3表示电商,4表示餐饮,5表示家居", name = "sceneType*/
+    private int sceneType;
+
+    /**"场景封面图是否默认", name = "thumbImg*/
+    private int thumbImg;
+
+    /**"版本", name = "version*/
+    private int version;
+
+    /**"0表示默认,user表示自己上传", name = "markerLogo*/
+    private String markerLogo;
+
+    /**"0表示默认,user表示自己上传", name = "floorLogo*/
+    private String floorLogo;
+
+    /**"标记大小", name = "floorLogoSize*/
+    private int floorLogoSize;
+
+    /**"表示初始点信息", name = "entry*/
+    private String entry;
+
+    /**"创建时间", name = "createTime*/
+    private String createTime;
+
+    /**"拍摄数量", name = "shootCount*/
+    private int shootCount;
+
+    /**"0表示未建好,1表示建好,-1表示出错,-2表示不要在官网上显示", name = "status*/
+    private int status;
+
+    /**"模型贴图的风格", name = "sceneIndex*/
+    private int sceneIndex;
+
+    /**"背景音乐名称", name = "hasBGM*/
+    private String hasBGM;
+
+    /**"方案:1是双目,2是转台,3是六目", name = "cameraType*/
+    private int cameraType;
+
+    /**"是否公开,0公开,1加密", name = "isPublic*/
+    private int isPublic;
+
+    /**"要gps定位", name = "gps*/
+    private String gps;
+
+    /**"相机的Mac地址", name = "childName*/
+    private String childName;
+
+    /**"用户名", name = "userName*/
+    private String userName;
+
+    /**"昵称", name = "nickName*/
+    private String nickName;
+
+    /**"浏览次数", name = "viewCount*/
+    private int viewCount;
+
+    /**"场景的链接地址", name = "webSite*/
+    private String webSite;
+
+    /**"原始的大场景数据", name = "dataSource*/
+    private String dataSource;
+
+    /**"0表示未付款,1表示付款了,-1表示欠费(八目场景指锁住),-2表示临时空间(八目场景)", name = "payStatus*/
+    private int payStatus;
+
+    /**"手机id", name = "phoneId*/
+    private String phoneId;
+
+    /**"大场景序号", name = "num*/
+    private String num;
+
+    /**"1表示推荐,0表示正常", name = "recommend*/
+    private int recommend;
+
+    /**"表示缩略图是否存在", name = "thumbStatus*/
+    private int thumbStatus;
+
+    /**"要上传的热点的id集合,用逗号隔开", name = "hotsIds*/
+    private String hotsIds;
+
+    /**"大场景初始点的id", name = "initialPointId*/
+    private String initialPointId;
+
+    /**"风格", name = "style*/
+    private int style;
+
+    /**"方案:1是双目,2是转台,3是六目", name = "sceneScheme*/
+    private int sceneScheme;
+
+    /**"背景音乐名称", name = "bgMusic*/
+    private String bgMusic;
+
+    /**"用户id", name = "userId*/
+    private Long userId;
+
+    /**"相机id", name = "cameraId*/
+    private Long cameraId;
+
+    /**"使用容量", name = "space*/
+    private BigInteger space;
+
+    /**"创建日期时间戳", name = "createDate*/
+    private Long createDate;
+
+    /**"分享的logo和生成二维码的logo", name = "shareLogo*/
+    private String shareLogo;
+
+    /**"小地图浏览", name = "mapVisi*/
+    private int mapVisi;
+
+    /**"自动导览", name = "tourVisi*/
+    private int tourVisi;
+
+    /**"vr模式", name = "vrVisi*/
+    private int vrVisi;
+    
+
+    /**
+     * 普通录屏文件地址
+     */
+    private String screencapVoiceSrc;
+
+    /**
+     * 录音文件地址
+     */
+    private String screencapVoiceSound;
+
+    /**
+     * 同步录音文件地址
+     */
+    private String screencapVoiceSoundsync;
+
+    /**
+     * 选择的类型,sound为screencapVoiceSound,file为screencapVoiceSrc
+     */
+    private String screencapVoiceType;
+
+    /**
+     * 录屏文件地址
+     */
+    private String playData;
+
+
+    /**
+     * 重新建模的版本
+     */
+    private int floorEditVer;
+
+    /**
+     * 正式发布重新建模的版本
+     */
+    private int floorPublishVer;
+
+    /**
+     * 录屏图片
+     */
+    private String screencapThumb;
+
+    /**
+     * cad平面图参数
+     */
+    private String cadInfo;
+
+    /**
+     * cad平面图参数
+     */
+    private String floorPlanPng;
+
+    /**
+     * 展示页面是否显示标尺
+     */
+    private int rulerVisi;
+
+    /**
+     * 展示页面cad图在平面图是否显示
+     */
+    private int cadImgVisi;
+
+    private int panoVisi;
+
+    private int m2dVisi;
+
+    private int m3dVisi;
+
+    private int measureVisi;
+
+    private String videos;
+
+    private String snCode;
+
+    private String overlay;
+
+    private Integer showLogoBottom;
+
+    private String recStatus;
+
+    private Integer needKey;
+
+    private String buildType;
+
+    private Integer imagesVersion;
+
+    private String bgMusicName;
+
+    /**
+     * 协作者用户id
+     */
+    private String cooperationUserId;
+
+    private String cooperationUserName;
+
+    private Integer sceneSource;
+
+    private boolean jumpScene;
+
+    /**
+     * 服务器的服务商
+     */
+    private String ecs;
+
+    /**
+     * 场景来源方式,为app提供,0相机,1用户,2协作者
+     */
+    private Integer sceneSourceType;
+
+    /**
+     * 随心装场景码
+     */
+    private String vrNum;
+
+    /**
+     * 随心装场景码
+     */
+    private String vrThumb;
+
+    /**
+     * 旋转角度
+     */
+    private String floorPlanAngle;
+
+    private Integer isFolder;
+
+    private String videosUser;
+
+    private Integer isUpgrade;
+}

+ 11 - 0
src/main/java/com/fdkankan/ucenter/vo/SceneBySnCodeVo.java

@@ -0,0 +1,11 @@
+package com.fdkankan.ucenter.vo;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+public class SceneBySnCodeVo implements Serializable {
+    private String sceneNum;    //场景码
+    private String sceneName;   //场景名称
+}

+ 4 - 0
src/main/java/com/fdkankan/ucenter/vo/request/SceneParam.java

@@ -27,4 +27,8 @@ public class SceneParam extends RequestBase {
     private Integer status;
 
     private Integer isObj;
+
+    private String startTime;
+    private String endTime;
+    private String num;
 }

+ 5 - 0
src/main/resources/mapper/ucenter/HotShopMapper.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.fdkankan.ucenter.mapper.IHotShopMapper">
+
+</mapper>

+ 9 - 1
src/main/resources/mapper/ucenter/SceneProMapper.xml

@@ -129,7 +129,15 @@
             and u.user_name like CONCAT('%',#{param.userName},'%')
             and coo.rec_status = 'A'
         </if>
-
+        <if test="param.startTime !=null and param.startTime !=''">
+            and p.create_time &gt;= #{param.startTime}
+        </if>
+        <if test="param.endTime !=null and param.endTime !=''">
+            and p.create_time &lt;= #{param.endTime}
+        </if>
+        <if test="param.num !=null and param.num !=''">
+            and p.num =  #{param.num}
+        </if>
     </sql>
 
 </mapper>

+ 5 - 0
src/main/resources/mapper/ucenter/VaildCamerasMapper.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.fdkankan.ucenter.mapper.IVaildCamerasMapper">
+
+</mapper>