新wifi厂家集成bug修复

dev
zef 4 weeks ago
parent 3c273c513a
commit e87a7524af

@ -1,5 +1,6 @@
package com.watu.wifi.controller; package com.watu.wifi.controller;
import cn.hutool.http.HttpResponse;
import com.watu.wifi.entity.ResObject; import com.watu.wifi.entity.ResObject;
import com.watu.wifi.service.impl.wifiExcelBluetoothServiceImpl; import com.watu.wifi.service.impl.wifiExcelBluetoothServiceImpl;
import com.watu.wifi.service.impl.wifiExcelServiceImpl; import com.watu.wifi.service.impl.wifiExcelServiceImpl;
@ -12,6 +13,9 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.time.Instant; import java.time.Instant;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.ZoneOffset; import java.time.ZoneOffset;
@ -66,13 +70,49 @@ public class WifiController {
// } // }
@PostMapping("/Wificd/mac_agent/index/mac.do") @PostMapping("/Wificd/mac_agent/index/mac.do")
public ResObject jsonmac(@RequestParam("apmac") String date,String gwid){ public ResObject jsonmac(@RequestParam("mac") String date,String gwid){
log.info("调用接口入参:"+date); log.info("调用接口入参:"+date);
executor.submit(()->{ executor.submit(()->{
wifiExcelBluetoothService.jsonParsingMac(date,gwid); wifiExcelBluetoothService.jsonParsingMac(date,gwid);
}); });
return new ResObject(); return new ResObject();
} }
// @PostMapping("/Wificd/mac_agent/index/ver.do")
// public void jsonver(@RequestParam("Info") String date, HttpServletResponse response){
// log.info("调用接口入参:"+date);
// response.setContentType("application/json");
// response.setCharacterEncoding("UTF-8");
// String jsonParsingVer = wifiExcelBluetoothService.jsonParsingVer(date);
//
// try (PrintWriter out = response.getWriter()) {
// out.print(jsonParsingVer);
// out.flush();
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
@PostMapping("/Wificd/mac_agent/index/ver.do")
public String jsonver(@RequestParam("Info") String date){
log.info("调用接口入参:"+date);
String jsonParsingVer = wifiExcelBluetoothService.jsonParsingVer(date);
log.info("调用接口出参:"+jsonParsingVer);
return jsonParsingVer;
}
@PostMapping("/Wificd/mac_agent/index/vssid.do")
public String jsonvssid(@RequestParam("vssid") String date){
log.info("调用接口入参:"+date);
String jsonParsingVer = wifiExcelBluetoothService.jsonParsingVer(date);
log.info("调用接口出参:"+jsonParsingVer);
return "";
}
@PostMapping("/mac.do") @PostMapping("/mac.do")
public ResObject jsonmac2(@RequestBody String date,String gwid){ public ResObject jsonmac2(@RequestBody String date,String gwid){
log.info("调用接口入参:"+date +"gwid:"+gwid); log.info("调用接口入参:"+date +"gwid:"+gwid);

@ -93,7 +93,8 @@ public class wifiExcelBluetoothServiceImpl implements wifiExcelBluetoothService
wifiName= getSafeString(dataObject, "router"); wifiName= getSafeString(dataObject, "router");
} }
//手机MAC //手机MAC
result.append(phoneMAC).append(","); String mac = convertToUpper(phoneMAC);
result.append(mac).append(",");
//信号强度 //信号强度
result.append(getSafeString(dataObject, "rssi")).append(","); result.append(getSafeString(dataObject, "rssi")).append(",");
//手机与采集设备之间的预估距离 //手机与采集设备之间的预估距离
@ -122,7 +123,8 @@ public class wifiExcelBluetoothServiceImpl implements wifiExcelBluetoothService
String collectDeviceIp = ExcelReader.getmap("collectDeviceIp", id); String collectDeviceIp = ExcelReader.getmap("collectDeviceIp", id);
result.append(collectDeviceIp).append(","); result.append(collectDeviceIp).append(",");
//路由器mac //路由器mac
result.append(wifiMAC).append("\n"); String wifimac = convertToUpper(wifiMAC);
result.append(wifimac).append("\n");
results.append(result); results.append(result);
@ -295,8 +297,9 @@ public class wifiExcelBluetoothServiceImpl implements wifiExcelBluetoothService
result.append(timestamp).append(","); result.append(timestamp).append(",");
//手机MAC //手机MAC
String safeString = getSafeString(dataObject, "s");
result.append(getSafeString(dataObject, "s")).append(","); String convertToUpper = convertToUpper(safeString);
result.append(convertToUpper).append(",");
//信号强度 //信号强度
result.append(getSafeString(dataObject, "p")).append(","); result.append(getSafeString(dataObject, "p")).append(",");
//手机与采集设备之间的预估距离 //手机与采集设备之间的预估距离
@ -317,7 +320,9 @@ public class wifiExcelBluetoothServiceImpl implements wifiExcelBluetoothService
String collectDeviceIp = ExcelReader.getmap("collectDeviceIp", gwid); String collectDeviceIp = ExcelReader.getmap("collectDeviceIp", gwid);
result.append(collectDeviceIp).append(","); result.append(collectDeviceIp).append(",");
//路由器mac //路由器mac
result.append(getSafeString(dataObject, "a")).append("\n"); String a = getSafeString(dataObject, "a");
String a1 = convertToUpper(a);
result.append(a1).append("\n");
results.append(result); results.append(result);
@ -337,6 +342,31 @@ public class wifiExcelBluetoothServiceImpl implements wifiExcelBluetoothService
return null; return null;
} }
@Override
public String jsonParsingVer(String json) {
try {
//解析json
JSONObject jsonObject = new JSONObject(json);
} catch (Exception e) {
e.printStackTrace();
System.out.println("捕获异常= "+e+"json:"+json);
}
return "{\"ap\":{\"pwd\":\"\",\"ssid\":\"\"},\"ftpserver\":{\"ip\":\"\",\"path\":\"\",\"port\":\"\",\"pwd\":\"\",\"user\":\"\"},\"httpserver\":{\"url\":\"\"},\"ntpserver\":{\"ip\":\"\"},\"reboot\":{\"value\":\"\"},\"runmode\":{\"value\":\"\"},\"transfer\":{\"value\":\"\"},\"upgrade\":{\"filename\":\"\",\"ftpport\":\"\",\"ftppwd\":\"\",\"ftpserver\":\"\",\"ftpuser\":\"\",\"isupgrade\":\"\",\"md5\":\"\",\"ver\":\"\"}}{\"ap\":{\"pwd\":\"\",\"ssid\":\"\"},\"ftpserver\":{\"ip\":\"\",\"path\":\"\",\"port\":\"\",\"pwd\":\"\",\"user\":\"\"},\"httpserver\":{\"url\":\"\"},\"ntpserver\":{\"ip\":\"\"},\"reboot\":{\"value\":\"\"},\"runmode\":{\"value\":\"\"},\"transfer\":{\"value\":\"\"},\"upgrade\":{\"filename\":\"\",\"ftpport\":\"\",\"ftppwd\":\"\",\"ftpserver\":\"\",\"ftpuser\":\"\",\"isupgrade\":\"\",\"md5\":\"\",\"ver\":\"\"}}";
}
public static String convertToUpper(String input) {
// 检查输入是否为空
if (input == null || input.isEmpty()) {
return "null";
}
// 将所有小写字母转换为大写字母
return input.toUpperCase();
}
public static String decodeUrl(String encodedString) throws UnsupportedEncodingException { public static String decodeUrl(String encodedString) throws UnsupportedEncodingException {
if(StringUtils.isEmpty(encodedString)){ if(StringUtils.isEmpty(encodedString)){

@ -5,4 +5,5 @@ public interface wifiExcelBluetoothService {
String jsonParsing(String json); String jsonParsing(String json);
String jsonParsingApmac(String json,String gwid); String jsonParsingApmac(String json,String gwid);
String jsonParsingMac(String json,String gwid); String jsonParsingMac(String json,String gwid);
String jsonParsingVer(String json);
} }

Loading…
Cancel
Save