| 
					
				 | 
			
			
				@@ -1,7 +1,18 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 package com.jjt.biz.controller; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.nio.charset.StandardCharsets; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.List; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import javax.annotation.Resource; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import javax.servlet.http.HttpServletResponse; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.jjt.biz.domain.BluetoothInfo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.jjt.biz.domain.WifiInfo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.jjt.biz.service.IBluetoothInfoService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.jjt.biz.service.IWifiInfoService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.jjt.biz.vo.IllegalVO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.jjt.biz.vo.WifiInfoVO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.jjt.common.utils.StringUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.jjt.common.utils.sign.Base64; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.security.access.prepost.PreAuthorize; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.web.bind.annotation.GetMapping; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -23,37 +34,100 @@ import com.jjt.common.core.page.TableDataInfo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  * 关键字Controller 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- *  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  * @author ruoyi 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  * @date 2023-07-06 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 @RestController 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 @RequestMapping("/biz/keyInfo") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-public class KeyInfoController extends BaseController 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+public class KeyInfoController extends BaseController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Resource 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private IKeyInfoService keyInfoService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Resource 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private IBluetoothInfoService bluetoothInfoService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Resource 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private IWifiInfoService wifiInfoService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * 查询关键字列表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @PreAuthorize("@ss.hasPermi('biz:keyInfo:list')") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @GetMapping("/list") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    public TableDataInfo list(KeyInfo keyInfo) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public TableDataInfo list(KeyInfo keyInfo) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         startPage(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<KeyInfo> list = keyInfoService.selectKeyInfoList(keyInfo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return getDataTable(list); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * 查询关键字列表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @GetMapping("/replay") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public AjaxResult replay() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<KeyInfo> list = keyInfoService.selectKeyInfoList(new KeyInfo()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<WifiInfo> wifiInfos = wifiInfoService.selectWifiInfoList(new WifiInfo()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        wifiInfos.forEach(info -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            info.setIsIllegal("N"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (StringUtils.isNotEmpty(info.getAuthPage())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                IllegalVO illegal = isIllegal(list, info.getAuthPage()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (illegal.isIllegal()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    info.setIsIllegal("Y"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    info.setKeyType(illegal.getKeyType()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                isIllegal(list, info.getSsid()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            IllegalVO illegal = isIllegal(list, info.getSsid()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (illegal.isIllegal()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                info.setIsIllegal("Y"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                info.setKeyType(illegal.getKeyType()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            wifiInfoService.updateWifiInfo(info); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<BluetoothInfo> bluetoothInfos = bluetoothInfoService.selectBluetoothInfoList(new BluetoothInfo()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        bluetoothInfos.forEach(info -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            info.setIsIllegal("N"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            IllegalVO illegal = isIllegal(list, info.getName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (illegal.isIllegal()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                info.setIsIllegal("Y"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                info.setKeyType(illegal.getKeyType()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            illegal = isIllegal(list, info.getFileName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (illegal.isIllegal()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                info.setIsIllegal("Y"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                info.setKeyType(illegal.getKeyType()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            bluetoothInfoService.updateBluetoothInfo(info); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return AjaxResult.success(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private IllegalVO isIllegal(List<KeyInfo> keyInfoList, String content) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        IllegalVO result = new IllegalVO(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        result.setIllegal(false); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        for (KeyInfo keyInfo : keyInfoList) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            String[] keys = keyInfo.getKeyWords().split(","); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            for (String key : keys) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (content.contains(key)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    result.setIllegal(true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    result.setKeyType(keyInfo.getKeyType()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * 导出关键字列表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @PreAuthorize("@ss.hasPermi('biz:keyInfo:export')") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Log(title = "关键字", businessType = BusinessType.EXPORT) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @PostMapping("/export") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    public void export(HttpServletResponse response, KeyInfo keyInfo) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public void export(HttpServletResponse response, KeyInfo keyInfo) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<KeyInfo> list = keyInfoService.selectKeyInfoList(keyInfo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         ExcelUtil<KeyInfo> util = new ExcelUtil<KeyInfo>(KeyInfo.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         util.exportExcel(response, list, "关键字数据"); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -64,8 +138,7 @@ public class KeyInfoController extends BaseController 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @PreAuthorize("@ss.hasPermi('biz:keyInfo:query')") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @GetMapping(value = "/{keyId}") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    public AjaxResult getInfo(@PathVariable("keyId") Long keyId) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public AjaxResult getInfo(@PathVariable("keyId") Long keyId) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return success(keyInfoService.selectKeyInfoByKeyId(keyId)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -75,8 +148,7 @@ public class KeyInfoController extends BaseController 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @PreAuthorize("@ss.hasPermi('biz:keyInfo:add')") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Log(title = "关键字", businessType = BusinessType.INSERT) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @PostMapping 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    public AjaxResult add(@RequestBody KeyInfo keyInfo) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public AjaxResult add(@RequestBody KeyInfo keyInfo) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return toAjax(keyInfoService.insertKeyInfo(keyInfo)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -86,8 +158,7 @@ public class KeyInfoController extends BaseController 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @PreAuthorize("@ss.hasPermi('biz:keyInfo:edit')") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Log(title = "关键字", businessType = BusinessType.UPDATE) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @PutMapping 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    public AjaxResult edit(@RequestBody KeyInfo keyInfo) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public AjaxResult edit(@RequestBody KeyInfo keyInfo) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return toAjax(keyInfoService.updateKeyInfo(keyInfo)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -96,9 +167,8 @@ public class KeyInfoController extends BaseController 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @PreAuthorize("@ss.hasPermi('biz:keyInfo:remove')") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Log(title = "关键字", businessType = BusinessType.DELETE) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	@DeleteMapping("/{keyIds}") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    public AjaxResult remove(@PathVariable Long[] keyIds) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @DeleteMapping("/{keyIds}") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public AjaxResult remove(@PathVariable Long[] keyIds) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return toAjax(keyInfoService.deleteKeyInfoByKeyIds(keyIds)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 |