Przeglądaj źródła

增加允许呼入

develop
bin 3 lat temu
rodzic
commit
09f57bf762
3 zmienionych plików z 28 dodań i 7 usunięć
  1. +12
    -1
      src/main/java/com/ssjl/zhaobiao/guizhou/entity/IOT/Api/IotApiWhiteList.java
  2. +13
    -6
      src/main/java/com/ssjl/zhaobiao/guizhou/service/impl/GZPlatformSettingService.java
  3. +3
    -0
      src/main/java/com/ssjl/zhaobiao/guizhou/utils/GZHttpUtil.java

+ 12
- 1
src/main/java/com/ssjl/zhaobiao/guizhou/entity/IOT/Api/IotApiWhiteList.java Wyświetl plik

@@ -23,7 +23,18 @@ public class IotApiWhiteList {
item.setPressKey(key); item.setPressKey(key);
item.setSos(isSos); item.setSos(isSos);
whiteList.add(item); whiteList.add(item);

}
public void addPhone(String phone, String relationship, String key, int inComing, int callOut, int isSos){
IotApiWhiteListItem item = new IotApiWhiteListItem();
item.setRelationship(relationship);
item.setPhone(phone);
item.setCallOut(callOut);
item.setInComing(inComing);
item.setLevel(1);
item.setOuttime("");
item.setPressKey(key);
item.setSos(isSos);
whiteList.add(item);
} }


public String getSerialNo() { public String getSerialNo() {


+ 13
- 6
src/main/java/com/ssjl/zhaobiao/guizhou/service/impl/GZPlatformSettingService.java Wyświetl plik

@@ -115,7 +115,8 @@ public class GZPlatformSettingService implements IGZPlatformSettingService {
IotApiWhiteList whiteList = new IotApiWhiteList(); IotApiWhiteList whiteList = new IotApiWhiteList();
whiteList.setSerialNo(imei); whiteList.setSerialNo(imei);
if(dbConfig.getAffectionPhone() == null || !dbConfig.getAffectionPhone().equals(config.getAffectionPhone()) || if(dbConfig.getAffectionPhone() == null || !dbConfig.getAffectionPhone().equals(config.getAffectionPhone()) ||
dbConfig.getAddressBook() == null || !dbConfig.getAddressBook().equals(config.getAddressBook())){
dbConfig.getAddressBook() == null || !dbConfig.getAddressBook().equals(config.getAddressBook()) ||
dbConfig.getWhitePhone() == null || !dbConfig.getWhitePhone().equals(config.getWhiteList())){
// if(true){ // if(true){
// SOS // SOS
String sos = config.getSosPhone(); String sos = config.getSosPhone();
@@ -161,6 +162,17 @@ public class GZPlatformSettingService implements IGZPlatformSettingService {
hadSos = hadSos ? hadSos : isSos; hadSos = hadSos ? hadSos : isSos;
whiteList.addPhone(aphone, relationship, "", (isSos? 1 : 0)); whiteList.addPhone(aphone, relationship, "", (isSos? 1 : 0));
} }
// 允许呼入
String whitePhone = config.getWhiteList();
phones = whitePhone.split(",");
for (int i = 0; i < phones.length; i++) {
String aphone = phones[i];
if(!Strings.isNullOrEmpty(aphone) && aphone.indexOf("*") < 0){
isSos = aphone.equals(sos);
hadSos = hadSos ? hadSos : isSos;
whiteList.addPhone(aphone, "", "", 2, 3, (isSos? 1 : 0));
}
}
// sos不在通讯录或亲情号码中,则另外加入白名单 // sos不在通讯录或亲情号码中,则另外加入白名单
if(!hadSos){ if(!hadSos){
whiteList.addPhone(sos, "", "", 1); whiteList.addPhone(sos, "", "", 1);
@@ -174,11 +186,6 @@ public class GZPlatformSettingService implements IGZPlatformSettingService {
} }
} }







if(allSuccess){ if(allSuccess){
// 存入数据库 // 存入数据库
dbConfig.setDeviceImei(imei); dbConfig.setDeviceImei(imei);


+ 3
- 0
src/main/java/com/ssjl/zhaobiao/guizhou/utils/GZHttpUtil.java Wyświetl plik

@@ -4,6 +4,7 @@ import com.ssjl.zhaobiao.guizhou.entity.GZRequest;
import com.ssjl.zhaobiao.guizhou.entity.GZRequestStatus; import com.ssjl.zhaobiao.guizhou.entity.GZRequestStatus;
import com.ssjl.zhaobiao.guizhou.entity.GZResponse; import com.ssjl.zhaobiao.guizhou.entity.GZResponse;
import com.ssjl.zhaobiao.guizhou.entity.IMessageContent; import com.ssjl.zhaobiao.guizhou.entity.IMessageContent;
import lombok.extern.slf4j.Slf4j;
import okhttp3.Headers; import okhttp3.Headers;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
@@ -11,6 +12,7 @@ import org.springframework.stereotype.Component;


import java.io.IOException; import java.io.IOException;


@Slf4j
@Component @Component
public class GZHttpUtil { public class GZHttpUtil {
@Autowired @Autowired
@@ -46,6 +48,7 @@ public class GZHttpUtil {
byte[] res = httpUtil.postBytes(url, b, headers); byte[] res = httpUtil.postBytes(url, b, headers);
return res; return res;
} catch (IOException e) { } catch (IOException e) {
log.info("目标地址:" + url);
e.printStackTrace(); e.printStackTrace();
throw e; throw e;
} }


Ładowanie…
Anuluj
Zapisz