大理海康接口 房屋部分 接口实现以及测试完善
diff --git a/src/main/java/com/supwisdom/dlpay/hk/Test/ApiServiceTest.java b/src/main/java/com/supwisdom/dlpay/hk/Test/ApiServiceTest.java
index 98ec71d..5242ad8 100644
--- a/src/main/java/com/supwisdom/dlpay/hk/Test/ApiServiceTest.java
+++ b/src/main/java/com/supwisdom/dlpay/hk/Test/ApiServiceTest.java
@@ -2,12 +2,12 @@
 

 import com.google.gson.Gson;

 import com.supwisdom.dlpay.DoorApplication;

-import com.supwisdom.dlpay.hk.bean.ApiToken;

-import com.supwisdom.dlpay.hk.bean.CommunityBean;

-import com.supwisdom.dlpay.hk.bean.CommunityIdBean;

+import com.supwisdom.dlpay.hk.bean.*;

 import com.supwisdom.dlpay.hk.common.Resp;

 import com.supwisdom.dlpay.hk.domain.TCommunity;

 import com.supwisdom.dlpay.hk.domain.THKBuilding;

+import com.supwisdom.dlpay.hk.domain.TRoom;

+import com.supwisdom.dlpay.hk.domain.TUnit;

 import com.supwisdom.dlpay.hk.service.ApiService;

 import org.junit.Before;

 import org.junit.Test;

@@ -112,18 +112,137 @@
     public void addBuildings(){

         THKBuilding building = new THKBuilding();

         building.setCommunityId("a095174cb8974523a9d9b63e8448c151");

-        building.setBuildingName("1230测试楼栋1");

-        building.setBuildingNumber("1");

+        building.setBuildingName("1231测试楼栋1");

+        building.setBuildingNumber("20");

         building.setFloorUpCount("10");

         building.setFloorDownCount("1");

         building.setFloorFamilyCount("5");

         building.setBuildingUnitSize("3");

+        //buildingId:f99cdcd72aa54725b7804e2449c32061

 

         try {

             Resp resp = apiService.addBuildings(token, building);

+            Gson gson = new Gson();

+            String data = gson.toJson(resp.getData());

+            BuildingIdBean bean = gson.fromJson(data, BuildingIdBean.class);

+            System.out.println(bean.getBuildingId());

+        } catch (Exception e) {

+            e.printStackTrace();

+        }

+    }

+

+    @Test

+    public void addUnits(){

+        TUnit unit = new TUnit();

+        unit.setBuildingId("f99cdcd72aa54725b7804e2449c32061");

+        unit.setUnitName("楼栋1第3单元");

+        unit.setUnitNumber("3");

+        //unitId:9f5f02d8527e4b74bc46f2ee8791256c

+

+        try {

+            Resp resp = apiService.addUnits(token, unit);

+            Gson gson = new Gson();

+            String data = gson.toJson(resp.getData());

+            UnitIdBean bean = gson.fromJson(data, UnitIdBean.class);

+            System.out.println(bean.getUnitId());

+        } catch (Exception e) {

+            e.printStackTrace();

+        }

+    }

+

+    @Test

+    public void addRoom(){

+        TRoom room = new TRoom();

+        room.setUnitId("9f5f02d8527e4b74bc46f2ee8791256c");

+        room.setFloorNumber("10");

+        room.setRoomNumber("05");

+        room.setRoomName("楼栋1第三单元10层05室");

+        //roomId:e41bb127ec7c4abcb1e7f8aadf1b712c

+

+        try {

+            Resp resp = apiService.addRooms(token, room);

+            Gson gson = new Gson();

+            String data = gson.toJson(resp.getData());

+            RoomIdBean bean = gson.fromJson(data, RoomIdBean.class);

+            System.out.println(bean.getRoomId());

+        } catch (Exception e) {

+            e.printStackTrace();

+        }

+    }

+

+    @Test

+    public void findRoomsByNumber(){

+        String communityId="a095174cb8974523a9d9b63e8448c151";

+        String buildingNumber="20";

+        String unitNumber="3";

+        String roomNumber="1005";

+

+        try {

+            Resp resp = apiService.findRoomsByNumber(token, communityId, buildingNumber, unitNumber, roomNumber);

+            Gson gson = new Gson();

+            String data = gson.toJson(resp.getData());

+            FindRoomBean bean = gson.fromJson(data, FindRoomBean.class);

+            System.out.println(bean.getRoomId());

+            System.out.println(bean.getPath());

+            System.out.println(bean.getAddress());

+        } catch (Exception e) {

+            e.printStackTrace();

+        }

+    }

+

+    //当前只支持根据关联ID查询(正常roomId查询为null)

+    @Test

+    public void findRoomsById(){

+        String roomId="532d4505819641499302b4a1b0d56a29";

+

+        try {

+            Resp resp = apiService.findRoomsById(token, roomId);

+            Gson gson = new Gson();

+            String data = gson.toJson(resp.getData());

+            FindRoomBean bean = gson.fromJson(data, FindRoomBean.class);

+            System.out.println(bean.getRoomId());

+            System.out.println(bean.getPath());

+            System.out.println(bean.getAddress());

+        } catch (Exception e) {

+            e.printStackTrace();

+        }

+    }

+

+    @Test

+    public void deleteBuildings(){

+        String buildingId="01234567890123456789012345678901";

+

+        try {

+            Resp resp = apiService.deleteBuildings(token, buildingId);

+            System.out.println(resp.getMessage());

+        } catch (Exception e) {

+            e.printStackTrace();

+        }

+

+    }

+

+    @Test

+    public void deleteUnits(){

+        String unitId="01234567890123456789012345678901";

+

+        try {

+            Resp resp = apiService.deleteUnits(token, unitId);

+            System.out.println(resp.getMessage());

+        } catch (Exception e) {

+            e.printStackTrace();

+        }

+

+    }

+

+    @Test

+    public void deleteRooms(){

+        String roomId ="01234567890132456789012345678901";

+        try {

+            Resp resp = apiService.deleteRooms(token, roomId);

             System.out.println(resp.getMessage());

         } catch (Exception e) {

             e.printStackTrace();

         }

     }

+

 }

diff --git a/src/main/java/com/supwisdom/dlpay/hk/bean/BuildingIdBean.java b/src/main/java/com/supwisdom/dlpay/hk/bean/BuildingIdBean.java
new file mode 100644
index 0000000..e206285
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/hk/bean/BuildingIdBean.java
@@ -0,0 +1,22 @@
+package com.supwisdom.dlpay.hk.bean;

+

+import java.io.Serializable;

+

+public class BuildingIdBean implements Serializable {

+    private String buildingId;

+

+    public BuildingIdBean() {

+    }

+

+    public BuildingIdBean(String buildingId) {

+        this.buildingId = buildingId;

+    }

+

+    public String getBuildingId() {

+        return buildingId;

+    }

+

+    public void setBuildingId(String buildingId) {

+        this.buildingId = buildingId;

+    }

+}

diff --git a/src/main/java/com/supwisdom/dlpay/hk/bean/FindRoomBean.java b/src/main/java/com/supwisdom/dlpay/hk/bean/FindRoomBean.java
new file mode 100644
index 0000000..2c67f84
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/hk/bean/FindRoomBean.java
@@ -0,0 +1,42 @@
+package com.supwisdom.dlpay.hk.bean;

+

+import java.io.Serializable;

+

+public class FindRoomBean implements Serializable {

+    private String roomId;

+    private String path;

+    private String address;

+

+    public FindRoomBean() {

+    }

+

+    public FindRoomBean(String roomId, String path, String address) {

+        this.roomId = roomId;

+        this.path = path;

+        this.address = address;

+    }

+

+    public String getRoomId() {

+        return roomId;

+    }

+

+    public void setRoomId(String roomId) {

+        this.roomId = roomId;

+    }

+

+    public String getPath() {

+        return path;

+    }

+

+    public void setPath(String path) {

+        this.path = path;

+    }

+

+    public String getAddress() {

+        return address;

+    }

+

+    public void setAddress(String address) {

+        this.address = address;

+    }

+}

diff --git a/src/main/java/com/supwisdom/dlpay/hk/bean/FindRoomNumberBean.java b/src/main/java/com/supwisdom/dlpay/hk/bean/FindRoomNumberBean.java
new file mode 100644
index 0000000..258b92f
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/hk/bean/FindRoomNumberBean.java
@@ -0,0 +1,50 @@
+package com.supwisdom.dlpay.hk.bean;

+

+public class FindRoomNumberBean {

+    private String communityId;

+    private String buildingNumber;

+    private String unitNumber;

+    private String roomNumber;

+

+    public FindRoomNumberBean() {

+    }

+

+    public FindRoomNumberBean(String communityId, String buildingNumber, String unitNumber, String roomNumber) {

+        this.communityId = communityId;

+        this.buildingNumber = buildingNumber;

+        this.unitNumber = unitNumber;

+        this.roomNumber = roomNumber;

+    }

+

+    public String getCommunityId() {

+        return communityId;

+    }

+

+    public void setCommunityId(String communityId) {

+        this.communityId = communityId;

+    }

+

+    public String getBuildingNumber() {

+        return buildingNumber;

+    }

+

+    public void setBuildingNumber(String buildingNumber) {

+        this.buildingNumber = buildingNumber;

+    }

+

+    public String getUnitNumber() {

+        return unitNumber;

+    }

+

+    public void setUnitNumber(String unitNumber) {

+        this.unitNumber = unitNumber;

+    }

+

+    public String getRoomNumber() {

+        return roomNumber;

+    }

+

+    public void setRoomNumber(String roomNumber) {

+        this.roomNumber = roomNumber;

+    }

+}

diff --git a/src/main/java/com/supwisdom/dlpay/hk/bean/PersonBean.java b/src/main/java/com/supwisdom/dlpay/hk/bean/PersonBean.java
new file mode 100644
index 0000000..01291cf
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/hk/bean/PersonBean.java
@@ -0,0 +1,213 @@
+package com.supwisdom.dlpay.hk.bean;

+

+import java.util.List;

+

+public class PersonBean {

+

+    private String unionId;

+    private String personName;

+    private Integer gender;//性别

+    private Integer credentialType;//证件类型

+    private String credentialNumber;//证件号码

+    private String mobile;

+    private String birthday;//例:2019-12-31

+    private String personRemark;

+    private String nation;

+    private Integer educationalLevel;//文化程度

+    private String workUnit;

+    private String position;//职务

+    private Integer religion;//宗教信仰

+    private String englishName;

+    private String email;

+    private String addressDetail;

+    private String provinceCode;

+    private String cityCode;

+    private String countyCode;

+    private List<String> personCommunityRels;

+

+    public PersonBean() {

+    }

+

+    public PersonBean(String unionId, String personName, Integer gender, Integer credentialType, String credentialNumber, String mobile, String birthday, String personRemark, String nation, Integer educationalLevel, String workUnit, String position, Integer religion, String englishName, String email, String addressDetail, String provinceCode, String cityCode, String countyCode, List<String> personCommunityRels) {

+        this.unionId = unionId;

+        this.personName = personName;

+        this.gender = gender;

+        this.credentialType = credentialType;

+        this.credentialNumber = credentialNumber;

+        this.mobile = mobile;

+        this.birthday = birthday;

+        this.personRemark = personRemark;

+        this.nation = nation;

+        this.educationalLevel = educationalLevel;

+        this.workUnit = workUnit;

+        this.position = position;

+        this.religion = religion;

+        this.englishName = englishName;

+        this.email = email;

+        this.addressDetail = addressDetail;

+        this.provinceCode = provinceCode;

+        this.cityCode = cityCode;

+        this.countyCode = countyCode;

+        this.personCommunityRels = personCommunityRels;

+    }

+

+    public String getUnionId() {

+        return unionId;

+    }

+

+    public void setUnionId(String unionId) {

+        this.unionId = unionId;

+    }

+

+    public String getPersonName() {

+        return personName;

+    }

+

+    public void setPersonName(String personName) {

+        this.personName = personName;

+    }

+

+    public Integer getGender() {

+        return gender;

+    }

+

+    public void setGender(Integer gender) {

+        this.gender = gender;

+    }

+

+    public Integer getCredentialType() {

+        return credentialType;

+    }

+

+    public void setCredentialType(Integer credentialType) {

+        this.credentialType = credentialType;

+    }

+

+    public String getCredentialNumber() {

+        return credentialNumber;

+    }

+

+    public void setCredentialNumber(String credentialNumber) {

+        this.credentialNumber = credentialNumber;

+    }

+

+    public String getMobile() {

+        return mobile;

+    }

+

+    public void setMobile(String mobile) {

+        this.mobile = mobile;

+    }

+

+    public String getBirthday() {

+        return birthday;

+    }

+

+    public void setBirthday(String birthday) {

+        this.birthday = birthday;

+    }

+

+    public String getPersonRemark() {

+        return personRemark;

+    }

+

+    public void setPersonRemark(String personRemark) {

+        this.personRemark = personRemark;

+    }

+

+    public String getNation() {

+        return nation;

+    }

+

+    public void setNation(String nation) {

+        this.nation = nation;

+    }

+

+    public Integer getEducationalLevel() {

+        return educationalLevel;

+    }

+

+    public void setEducationalLevel(Integer educationalLevel) {

+        this.educationalLevel = educationalLevel;

+    }

+

+    public String getWorkUnit() {

+        return workUnit;

+    }

+

+    public void setWorkUnit(String workUnit) {

+        this.workUnit = workUnit;

+    }

+

+    public String getPosition() {

+        return position;

+    }

+

+    public void setPosition(String position) {

+        this.position = position;

+    }

+

+    public Integer getReligion() {

+        return religion;

+    }

+

+    public void setReligion(Integer religion) {

+        this.religion = religion;

+    }

+

+    public String getEnglishName() {

+        return englishName;

+    }

+

+    public void setEnglishName(String englishName) {

+        this.englishName = englishName;

+    }

+

+    public String getEmail() {

+        return email;

+    }

+

+    public void setEmail(String email) {

+        this.email = email;

+    }

+

+    public String getAddressDetail() {

+        return addressDetail;

+    }

+

+    public void setAddressDetail(String addressDetail) {

+        this.addressDetail = addressDetail;

+    }

+

+    public String getProvinceCode() {

+        return provinceCode;

+    }

+

+    public void setProvinceCode(String provinceCode) {

+        this.provinceCode = provinceCode;

+    }

+

+    public String getCityCode() {

+        return cityCode;

+    }

+

+    public void setCityCode(String cityCode) {

+        this.cityCode = cityCode;

+    }

+

+    public String getCountyCode() {

+        return countyCode;

+    }

+

+    public void setCountyCode(String countyCode) {

+        this.countyCode = countyCode;

+    }

+

+    public List<String> getPersonCommunityRels() {

+        return personCommunityRels;

+    }

+

+    public void setPersonCommunityRels(List<String> personCommunityRels) {

+        this.personCommunityRels = personCommunityRels;

+    }

+}

diff --git a/src/main/java/com/supwisdom/dlpay/hk/bean/RoomIdBean.java b/src/main/java/com/supwisdom/dlpay/hk/bean/RoomIdBean.java
new file mode 100644
index 0000000..a7cf2bb
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/hk/bean/RoomIdBean.java
@@ -0,0 +1,22 @@
+package com.supwisdom.dlpay.hk.bean;

+

+import java.io.Serializable;

+

+public class RoomIdBean implements Serializable {

+    private String roomId;

+

+    public RoomIdBean() {

+    }

+

+    public RoomIdBean(String roomId) {

+        this.roomId = roomId;

+    }

+

+    public String getRoomId() {

+        return roomId;

+    }

+

+    public void setRoomId(String roomId) {

+        this.roomId = roomId;

+    }

+}

diff --git a/src/main/java/com/supwisdom/dlpay/hk/bean/UnitIdBean.java b/src/main/java/com/supwisdom/dlpay/hk/bean/UnitIdBean.java
new file mode 100644
index 0000000..87dda0d
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/hk/bean/UnitIdBean.java
@@ -0,0 +1,22 @@
+package com.supwisdom.dlpay.hk.bean;

+

+import java.io.Serializable;

+

+public class UnitIdBean implements Serializable {

+    private String unitId;

+

+    public UnitIdBean() {

+    }

+

+    public UnitIdBean(String unitId) {

+        this.unitId = unitId;

+    }

+

+    public String getUnitId() {

+        return unitId;

+    }

+

+    public void setUnitId(String unitId) {

+        this.unitId = unitId;

+    }

+}

diff --git a/src/main/java/com/supwisdom/dlpay/hk/common/Constant.java b/src/main/java/com/supwisdom/dlpay/hk/common/Constant.java
index 2562a41..0bddc5a 100644
--- a/src/main/java/com/supwisdom/dlpay/hk/common/Constant.java
+++ b/src/main/java/com/supwisdom/dlpay/hk/common/Constant.java
@@ -39,7 +39,7 @@
     static public final String ADD_ROOMS = "https://api2.hik-cloud.com/api/v1/estate/system/rooms";

 

     //根据编号查询户室  路径后跟属性和参数

-    static public final String FIND_ROOMS_BY_NUMBER = "https://api2.hik-cloud.com/v1/estate/system/rooms/actions/info";

+    static public final String FIND_ROOMS_BY_NUMBER = "https://api2.hik-cloud.com/api/v1/estate/system/rooms/actions/info";

 

     //根据户室ID查询户室  路径后跟属性和参数

     static public final String FIND_ROOMS_BY_ID = "https://api2.hik-cloud.com/api/v1/estate/system/rooms/actions/infoById";

diff --git a/src/main/java/com/supwisdom/dlpay/hk/domain/TPerson.java b/src/main/java/com/supwisdom/dlpay/hk/domain/TPerson.java
new file mode 100644
index 0000000..511480b
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/hk/domain/TPerson.java
@@ -0,0 +1,232 @@
+package com.supwisdom.dlpay.hk.domain;

+

+import javax.persistence.Column;

+import javax.persistence.Entity;

+import javax.persistence.Id;

+import javax.persistence.Table;

+import java.util.List;

+import java.util.Map;

+

+@Entity

+@Table(name = "TB_PERSON")

+public class TPerson {

+    private String unionId;

+    private String personName;

+    private Integer gender;//性别

+    private Integer credentialType;//证件类型

+    private String credentialNumber;//证件号码

+    private String mobile;

+    private String birthday;//例:2019-12-31

+    private String personRemark;

+    private String nation;

+    private Integer educationalLevel;//文化程度

+    private String workUnit;

+    private String position;//职务

+    private Integer religion;//宗教信仰

+    private String englishName;

+    private String email;

+    private String addressDetail;

+    private String provinceCode;

+    private String cityCode;

+    private String countyCode;

+

+

+    public TPerson() {

+    }

+

+    public TPerson(String unionId, String personName, Integer gender, Integer credentialType, String credentialNumber, String mobile, String birthday, String personRemark, String nation, Integer educationalLevel, String workUnit, String position, Integer religion, String englishName, String email, String addressDetail, String provinceCode, String cityCode, String countyCode) {

+        this.unionId = unionId;

+        this.personName = personName;

+        this.gender = gender;

+        this.credentialType = credentialType;

+        this.credentialNumber = credentialNumber;

+        this.mobile = mobile;

+        this.birthday = birthday;

+        this.personRemark = personRemark;

+        this.nation = nation;

+        this.educationalLevel = educationalLevel;

+        this.workUnit = workUnit;

+        this.position = position;

+        this.religion = religion;

+        this.englishName = englishName;

+        this.email = email;

+        this.addressDetail = addressDetail;

+        this.provinceCode = provinceCode;

+        this.cityCode = cityCode;

+        this.countyCode = countyCode;

+    }

+

+    @Id

+    @Column(name = "UNIONID", unique = true, nullable = false, length = 64)

+    public String getUnionId() {

+        return unionId;

+    }

+

+    public void setUnionId(String unionId) {

+        this.unionId = unionId;

+    }

+

+    @Column(name = "PERSONNAME",length = 25)

+    public String getPersonName() {

+        return personName;

+    }

+

+    public void setPersonName(String personName) {

+        this.personName = personName;

+    }

+

+    @Column(name = "GENDER",length = 1)

+    public Integer getGender() {

+        return gender;

+    }

+

+    public void setGender(Integer gender) {

+        this.gender = gender;

+    }

+

+    @Column(name = "CREDENTIALTYPE",length = 1)

+    public Integer getCredentialType() {

+        return credentialType;

+    }

+

+    public void setCredentialType(Integer credentialType) {

+        this.credentialType = credentialType;

+    }

+

+    @Column(name = "CREDENTIALNUMBER",length = 18)

+    public String getCredentialNumber() {

+        return credentialNumber;

+    }

+

+    public void setCredentialNumber(String credentialNumber) {

+        this.credentialNumber = credentialNumber;

+    }

+

+    @Column(name = "MOBILE",length = 20)

+    public String getMobile() {

+        return mobile;

+    }

+

+    public void setMobile(String mobile) {

+        this.mobile = mobile;

+    }

+

+    @Column(name = "BIRTHDAY",length = 10)

+    public String getBirthday() {

+        return birthday;

+    }

+

+    public void setBirthday(String birthday) {

+        this.birthday = birthday;

+    }

+

+    @Column(name = "PERSONREMARK",length = 25)

+    public String getPersonRemark() {

+        return personRemark;

+    }

+

+    public void setPersonRemark(String personRemark) {

+        this.personRemark = personRemark;

+    }

+

+    @Column(name = "NATION",length = 16)

+    public String getNation() {

+        return nation;

+    }

+

+    public void setNation(String nation) {

+        this.nation = nation;

+    }

+

+    @Column(name = "EDUCATIONALLEVEL",length = 1)

+    public Integer getEducationalLevel() {

+        return educationalLevel;

+    }

+

+    public void setEducationalLevel(Integer educationalLevel) {

+        this.educationalLevel = educationalLevel;

+    }

+

+    @Column(name = "WORKUNIT",length = 40)

+    public String getWorkUnit() {

+        return workUnit;

+    }

+

+    public void setWorkUnit(String workUnit) {

+        this.workUnit = workUnit;

+    }

+

+    @Column(name = "POSITION",length = 15)

+    public String getPosition() {

+        return position;

+    }

+

+    public void setPosition(String position) {

+        this.position = position;

+    }

+

+    @Column(name = "RELIGION",length = 1)

+    public Integer getReligion() {

+        return religion;

+    }

+

+    public void setReligion(Integer religion) {

+        this.religion = religion;

+    }

+

+    @Column(name = "ENGLISHNAME",length = 50)

+    public String getEnglishName() {

+        return englishName;

+    }

+

+    public void setEnglishName(String englishName) {

+        this.englishName = englishName;

+    }

+

+    @Column(name = "EMAIL",length = 30)

+    public String getEmail() {

+        return email;

+    }

+

+    public void setEmail(String email) {

+        this.email = email;

+    }

+

+    @Column(name = "ADDRESSDETAIL",length = 50)

+    public String getAddressDetail() {

+        return addressDetail;

+    }

+

+    public void setAddressDetail(String addressDetail) {

+        this.addressDetail = addressDetail;

+    }

+

+    @Column(name = "PROVINCECODE",length = 32)

+    public String getProvinceCode() {

+        return provinceCode;

+    }

+

+    public void setProvinceCode(String provinceCode) {

+        this.provinceCode = provinceCode;

+    }

+

+    @Column(name = "CITYCODE",length = 32)

+    public String getCityCode() {

+        return cityCode;

+    }

+

+    public void setCityCode(String cityCode) {

+        this.cityCode = cityCode;

+    }

+

+    @Column(name = "COUNTYCODE",length = 32)

+    public String getCountyCode() {

+        return countyCode;

+    }

+

+    public void setCountyCode(String countyCode) {

+        this.countyCode = countyCode;

+    }

+

+

+}

diff --git a/src/main/java/com/supwisdom/dlpay/hk/domain/TPersonRoom.java b/src/main/java/com/supwisdom/dlpay/hk/domain/TPersonRoom.java
new file mode 100644
index 0000000..d7bf51f
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/hk/domain/TPersonRoom.java
@@ -0,0 +1,65 @@
+package com.supwisdom.dlpay.hk.domain;

+

+import javax.persistence.*;

+

+@Entity

+@Table(name = "TB_PERSON_ROOM")

+public class TPersonRoom {

+

+    private TPersonRoomId id;

+    private Integer identityType;//身份类型

+    private String checkInDate;//例:2019-12-31

+    private String checkOutDate;

+

+    public TPersonRoom() {

+    }

+

+    public TPersonRoom(TPersonRoomId id, Integer identityType, String checkInDate, String checkOutDate) {

+        this.id = id;

+        this.identityType = identityType;

+        this.checkInDate = checkInDate;

+        this.checkOutDate = checkOutDate;

+    }

+

+    @EmbeddedId

+    @AttributeOverrides({

+            @AttributeOverride(name = "personId", column = @Column(name = "PERSONID", nullable = false, length = 64)),

+            @AttributeOverride(name = "communityId", column = @Column(name = "COMMUNITYID", nullable = false, length = 32)),

+            @AttributeOverride(name = "buildingId", column = @Column(name = "BUILDINGID", nullable = false, length = 32)),

+            @AttributeOverride(name = "unitId", column = @Column(name = "UNITID", nullable = false, length = 32)),

+            @AttributeOverride(name = "roomId", column = @Column(name = "ROOMID", nullable = false, length = 32))})

+    public TPersonRoomId getId() {

+        return id;

+    }

+

+    public void setId(TPersonRoomId id) {

+        this.id = id;

+    }

+

+    @Column(name = "IDENTITYTYPE", length = 1)

+    public Integer getIdentityType() {

+        return identityType;

+    }

+

+    public void setIdentityType(Integer identityType) {

+        this.identityType = identityType;

+    }

+

+    @Column(name = "CHECKINDATE", length = 25)

+    public String getCheckInDate() {

+        return checkInDate;

+    }

+

+    public void setCheckInDate(String checkInDate) {

+        this.checkInDate = checkInDate;

+    }

+

+    @Column(name = "CHECKOUTDATE", length = 25)

+    public String getCheckOutDate() {

+        return checkOutDate;

+    }

+

+    public void setCheckOutDate(String checkOutDate) {

+        this.checkOutDate = checkOutDate;

+    }

+}

diff --git a/src/main/java/com/supwisdom/dlpay/hk/domain/TPersonRoomId.java b/src/main/java/com/supwisdom/dlpay/hk/domain/TPersonRoomId.java
new file mode 100644
index 0000000..83bd795
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/hk/domain/TPersonRoomId.java
@@ -0,0 +1,70 @@
+package com.supwisdom.dlpay.hk.domain;

+

+import javax.persistence.Column;

+import javax.persistence.Embeddable;

+import java.io.Serializable;

+

+@Embeddable

+public class TPersonRoomId implements Serializable {

+    private String personId;

+    private String communityId;

+    private String buildingId;

+    private String unitId;

+    private String roomId;

+

+    public TPersonRoomId() {

+    }

+

+    public TPersonRoomId(String personId, String communityId, String buildingId, String unitId, String roomId) {

+        this.personId = personId;

+        this.communityId = communityId;

+        this.buildingId = buildingId;

+        this.unitId = unitId;

+        this.roomId = roomId;

+    }

+

+    @Column(name = "PERSONID", nullable = false, length = 64)

+    public String getPersonId() {

+        return personId;

+    }

+

+    public void setPersonId(String personId) {

+        this.personId = personId;

+    }

+

+    @Column(name = "COMMUNITYID", nullable = false, length = 32)

+    public String getCommunityId() {

+        return communityId;

+    }

+

+    public void setCommunityId(String communityId) {

+        this.communityId = communityId;

+    }

+

+    @Column(name = "BUILDINGID", nullable = false, length = 32)

+    public String getBuildingId() {

+        return buildingId;

+    }

+

+    public void setBuildingId(String buildingId) {

+        this.buildingId = buildingId;

+    }

+

+    @Column(name = "UNITID", nullable = false, length = 32)

+    public String getUnitId() {

+        return unitId;

+    }

+

+    public void setUnitId(String unitId) {

+        this.unitId = unitId;

+    }

+

+    @Column(name = "ROOMID", nullable = false, length = 32)

+    public String getRoomId() {

+        return roomId;

+    }

+

+    public void setRoomId(String roomId) {

+        this.roomId = roomId;

+    }

+}

diff --git a/src/main/java/com/supwisdom/dlpay/hk/service/ApiService.java b/src/main/java/com/supwisdom/dlpay/hk/service/ApiService.java
index 1af3337..a751ed7 100644
--- a/src/main/java/com/supwisdom/dlpay/hk/service/ApiService.java
+++ b/src/main/java/com/supwisdom/dlpay/hk/service/ApiService.java
@@ -2,6 +2,7 @@
 

 import com.supwisdom.dlpay.hk.bean.ApiToken;

 import com.supwisdom.dlpay.hk.bean.CommunityBean;

+import com.supwisdom.dlpay.hk.bean.PersonBean;

 import com.supwisdom.dlpay.hk.common.Resp;

 import com.supwisdom.dlpay.hk.domain.TCommunity;

 import com.supwisdom.dlpay.hk.domain.THKBuilding;

@@ -53,4 +54,10 @@
     //删除户室

     public Resp deleteRooms(String token,String roomId) throws Exception;

 

+

+    /******人员******/

+

+    //新增人员

+    public Resp addPerson(String token, PersonBean bean) throws Exception;

+

 }

diff --git a/src/main/java/com/supwisdom/dlpay/hk/service/impl/ApiServiceImpl.java b/src/main/java/com/supwisdom/dlpay/hk/service/impl/ApiServiceImpl.java
index 44c8471..6fe350b 100644
--- a/src/main/java/com/supwisdom/dlpay/hk/service/impl/ApiServiceImpl.java
+++ b/src/main/java/com/supwisdom/dlpay/hk/service/impl/ApiServiceImpl.java
@@ -106,7 +106,7 @@
     @Override

     public Resp communitiesList(String token) throws Exception {

         String url = Constant.COMMUNITIES_LIST;

-        paramHeader.put("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8");

+        paramHeader.put("Content-Type", "application/json;charset=UTF-8");

         paramHeader.put("Authorization", "bearer "+token);

 

         String result = HTTPSClientUtil.doGet(httpClient, url, paramHeader, paramBody);

@@ -119,20 +119,58 @@
     @Override

     public Resp addBuildings(String token, THKBuilding building) throws Exception{

         String url = Constant.ADD_BUILDINGS;

-        paramHeader.put("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8");

+        paramHeader.put("Content-Type", "application/json;charset=UTF-8");

         paramHeader.put("Authorization", "bearer "+token);

 

-        paramBody.put("unionId", building.getUnionId());

-        paramBody.put("communityId", building.getCommunityId());

-        paramBody.put("buildingName", building.getBuildingName());

-        paramBody.put("buildingNumber", building.getBuildingNumber());

-        paramBody.put("floorUpCount",building.getFloorUpCount());

-        paramBody.put("floorDownCount", building.getFloorDownCount());

-        paramBody.put("floorFamilyCount", building.getFloorFamilyCount());

-        paramBody.put("buildingUnitSize", building.getBuildingUnitSize());

-        paramBody.put("buildingRemark", building.getBuildingRemark());

+        Gson gson = new Gson();

+        String jsonStr = gson.toJson(building);

 

-        String result = HTTPSClientUtil.doPost(httpClient, url, paramHeader, paramBody);

+        String result = HTTPSClientUtil.doPostJson(httpClient, url, paramHeader, paramBody,jsonStr);

+

+

+        Resp resp = gson.fromJson(result, Resp.class);

+        return resp;

+    }

+

+    @Override

+    public Resp addUnits(String token, TUnit unit) throws Exception {

+        String url = Constant.ADD_UNITS;

+        paramHeader.put("Content-Type", "application/json;charset=UTF-8");

+        paramHeader.put("Authorization", "bearer "+token);

+

+        Gson gson = new Gson();

+        String jsonStr = gson.toJson(unit);

+

+        String result = HTTPSClientUtil.doPostJson(httpClient, url, paramHeader, paramBody, jsonStr);

+

+        Resp resp = gson.fromJson(result, Resp.class);

+        return resp;

+    }

+

+    @Override

+    public Resp addRooms(String token, TRoom room) throws Exception {

+        String url = Constant.ADD_ROOMS;

+        paramHeader.put("Content-Type", "application/json;charset=UTF-8");

+        paramHeader.put("Authorization", "bearer "+token);

+

+        Gson gson = new Gson();

+        String jsonStr = gson.toJson(room);

+

+        String result = HTTPSClientUtil.doPostJson(httpClient, url, paramHeader, paramBody, jsonStr);

+

+        Resp resp = gson.fromJson(result, Resp.class);

+        return resp;

+    }

+

+    @Override

+    public Resp findRoomsByNumber(String token, String communityId, String buildingNumber, String unitNumber, String roomNumber) throws Exception {

+        String url = Constant.FIND_ROOMS_BY_NUMBER;

+        paramHeader.put("Content-Type", "application/json;charset=UTF-8");

+        paramHeader.put("Authorization", "bearer "+token);

+

+        url=url+"?communityId="+communityId+"&buildingNumber="+buildingNumber+"&unitNumber="+unitNumber+"&roomNumber="+roomNumber;

+

+        String result = HTTPSClientUtil.doGet(httpClient, url, paramHeader, paramBody);

 

         Gson gson = new Gson();

         Resp resp = gson.fromJson(result, Resp.class);

@@ -140,38 +178,64 @@
     }

 

     @Override

-    public Resp addUnits(String token, TUnit unit) throws Exception {

-        return null;

-    }

-

-    @Override

-    public Resp addRooms(String token, TRoom room) throws Exception {

-        return null;

-    }

-

-    @Override

-    public Resp findRoomsByNumber(String token, String communityId, String buildingNumber, String unitNumber, String roomNumber) throws Exception {

-        return null;

-    }

-

-    @Override

     public Resp findRoomsById(String token, String roomId) throws Exception {

-        return null;

+        String url = Constant.FIND_ROOMS_BY_ID;

+        paramHeader.put("Content-Type", "application/json;charset=UTF-8");

+        paramHeader.put("Authorization", "bearer "+token);

+

+        url=url+"?roomId="+roomId;

+

+        String result = HTTPSClientUtil.doGet(httpClient, url, paramHeader, paramBody);

+

+        Gson gson = new Gson();

+        Resp resp = gson.fromJson(result, Resp.class);

+        return resp;

     }

 

     @Override

     public Resp deleteBuildings(String token, String buildingId) throws Exception {

-        return null;

+        String url = Constant.DELETE_BUILDINGS;

+        paramHeader.put("Content-Type", "application/json;charset=UTF-8");

+        paramHeader.put("Authorization", "bearer "+token);

+

+        String urlFinal = url + buildingId;

+

+        String result = HTTPSClientUtil.doDelete(httpClient, urlFinal, paramHeader, paramBody);

+

+        Gson gson = new Gson();

+        Resp resp = gson.fromJson(result, Resp.class);

+        return resp;

     }

 

     @Override

     public Resp deleteUnits(String token, String unitId) throws Exception {

-        return null;

+        String url = Constant.DELETE_UNITS;

+

+        paramHeader.put("Content-Type", "application/json;charset=UTF-8");

+        paramHeader.put("Authorization", "bearer "+token);

+

+        String urlFinal = url + unitId;

+

+        String result = HTTPSClientUtil.doDelete(httpClient, urlFinal, paramHeader, paramBody);

+

+        Gson gson = new Gson();

+        Resp resp = gson.fromJson(result, Resp.class);

+        return resp;

     }

 

     @Override

     public Resp deleteRooms(String token, String roomId) throws Exception {

-        return null;

+        String url = Constant.DELETE_ROOMS;

+        paramHeader.put("Content-Type", "application/json;charset=UTF-8");

+        paramHeader.put("Authorization", "bearer "+token);

+

+        String urlFinal = url + roomId;

+

+        String result = HTTPSClientUtil.doDelete(httpClient, urlFinal, paramHeader, paramBody);

+

+        Gson gson = new Gson();

+        Resp resp = gson.fromJson(result, Resp.class);

+        return resp;

     }