diff --git a/epmet-plugins-common/src/main/java/com/epmet/plugin/commons/redis/RedisKeys.java b/epmet-plugins-common/src/main/java/com/epmet/plugin/commons/redis/RedisKeys.java index c38a55c..10ead82 100644 --- a/epmet-plugins-common/src/main/java/com/epmet/plugin/commons/redis/RedisKeys.java +++ b/epmet-plugins-common/src/main/java/com/epmet/plugin/commons/redis/RedisKeys.java @@ -23,21 +23,21 @@ public class RedisKeys { * 海康accessToken */ public static String getHikTokenKey() { - return "hik:token"; + return rootPrefix.concat("hik:token"); } /** * 大华publicKey */ public static String getDhPublicKey() { - return "dh:public"; + return rootPrefix.concat("dh:public"); } /** * 大华token */ public static String getDhToken() { - return "dh:token"; + return rootPrefix.concat("dh:token"); } } diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/form/DhChannelFormDTO.java b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/form/DhChannelFormDTO.java new file mode 100644 index 0000000..7ab1b72 --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/form/DhChannelFormDTO.java @@ -0,0 +1,23 @@ +package com.epmet.plugin.power.dto.visit.form; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * 海康社区人员信息下放 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-20 + */ +@Data +public class DhChannelFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + private Integer pageNum; + + private Integer pageSize; + +} \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/form/DhDeptFormDTO.java b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/form/DhDeptFormDTO.java new file mode 100644 index 0000000..456179d --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/form/DhDeptFormDTO.java @@ -0,0 +1,27 @@ +package com.epmet.plugin.power.dto.visit.form; + +import com.epmet.plugin.power.dto.visit.result.DhChannelResultDTO; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + + +/** + * 海康社区人员信息下放 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-20 + */ +@Data +public class DhDeptFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + private String name; + + private String description; + + private Long parentId; + +} \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/form/DhIdentityFormDTO.java b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/form/DhIdentityFormDTO.java new file mode 100644 index 0000000..c30adda --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/form/DhIdentityFormDTO.java @@ -0,0 +1,29 @@ +package com.epmet.plugin.power.dto.visit.form; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * 海康社区人员信息下放 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-20 + */ +@Data +public class DhIdentityFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + private String name; + + private Double subsidyAmount; + + private Integer isCashRecharge; + + private Integer isMachineRecharge; + + private String description; + +} \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/form/DhPlanFormDTO.java b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/form/DhPlanFormDTO.java new file mode 100644 index 0000000..7719a5a --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/form/DhPlanFormDTO.java @@ -0,0 +1,27 @@ +package com.epmet.plugin.power.dto.visit.form; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * 海康社区人员信息下放 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-20 + */ +@Data +public class DhPlanFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + private String detail; + + private String memo; + + private String name; + + private Integer type; + +} \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/pom.xml b/epmet-plugins-module/pli-power-base/pli-power-base-server/pom.xml index 0b22591..0c50438 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/pom.xml +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/pom.xml @@ -175,8 +175,8 @@ 111 222 - https://api2.hik-cloud.com - 111 + http://112.6.213.175:8314 + shundeju @@ -190,10 +190,10 @@ - + - root - Abc@123456 + epmet_pli_power_user + EpmEt-db-UsEr 0 192.168.1.140 @@ -206,7 +206,7 @@ false - 192.168.43.186 + 192.168.43.84 false @@ -233,8 +233,8 @@ 111 222 - https://api2.hik-cloud.com - 111 + http://112.6.213.175:8314 + shundeju @@ -295,8 +295,8 @@ 111 222 - https://api2.hik-cloud.com - 111 + http://112.6.213.175:8314 + shundeju @@ -352,8 +352,8 @@ 90688b09bb9d40088f7be404ccb347c7 7b1940707a4240be9c794c5a967a30c9 - https://api2.hik-cloud.com - 111 + http://112.6.213.175:8314 + shundeju @@ -412,8 +412,8 @@ 90688b09bb9d40088f7be404ccb347c7 7b1940707a4240be9c794c5a967a30c9 - https://api2.hik-cloud.com - 111 + http://112.6.213.175:8314 + shundeju diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/visit/service/impl/VisitVisitorServiceImpl.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/visit/service/impl/VisitVisitorServiceImpl.java index a923a45..286461b 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/visit/service/impl/VisitVisitorServiceImpl.java +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/visit/service/impl/VisitVisitorServiceImpl.java @@ -131,6 +131,7 @@ public class VisitVisitorServiceImpl extends BaseServiceImpl paramsMap = new HashMap<>(4); + DhDeptFormDTO dto = new DhDeptFormDTO(); + dto.setName("访客部门"); + dto.setParentId(1L); - String data = HttpClientManager.getInstance().sendPostByJSONAndHeader(url, StringUtils.EMPTY, paramsMap).getData(); + String data = HttpClientManager.getInstance().sendPostByJSONAndHeader(url, JSON.toJSONString(dto), paramsMap).getData(); if (null == data) { throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询部门列表失败"); @@ -162,11 +162,15 @@ public class DhDeviceUtil { throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询部门列表失败"); } Object registerResult = result.getData(); - JSONArray jsonArray = JSON.parseArray(registerResult.toString()); - JSONObject jsonObject = jsonArray.getJSONObject(0); + JSONObject jsonObject = JSON.parseObject(registerResult.toString()); if (null != jsonObject) { - return Long.parseLong(jsonObject.get("deptId").toString()); + return Long.parseLong(jsonObject.toString()); } +// JSONArray jsonArray = JSON.parseArray(registerResult.toString()); +// JSONObject jsonObject = jsonArray.getJSONObject(0); +// if (null != jsonObject) { +// return Long.parseLong(jsonObject.get("deptId").toString()); +// } return 0L; } @@ -184,8 +188,13 @@ public class DhDeviceUtil { url = url + urlParam; Map paramsMap = new HashMap<>(4); + DhIdentityFormDTO dto = new DhIdentityFormDTO(); + dto.setName("访客"); + dto.setSubsidyAmount(0D); + dto.setIsCashRecharge(1); + dto.setIsMachineRecharge(1); - String data = HttpClientManager.getInstance().sendPostByJSONAndHeader(url, StringUtils.EMPTY, paramsMap).getData(); + String data = HttpClientManager.getInstance().sendPostByJSONAndHeader(url, JSON.toJSONString(dto), paramsMap).getData(); if (null == data) { throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取身份列表失败"); @@ -209,21 +218,25 @@ public class DhDeviceUtil { } /** - * 查询开门计划 + * 新增开门计划 * * @param * @return java.lang.String * @author zhy * @date 2022/5/23 11:04 */ - public String getPlan() { + public Long getPlan() { String url = dhCloudProperties.getUrl().concat(GET_DOOR_PLAN); String urlParam = getDhUrlParams(); url = url + urlParam; Map paramsMap = new HashMap<>(4); + DhPlanFormDTO dto = new DhPlanFormDTO(); + dto.setDetail("{\\\"monday\\\":[\\\"00:00-23:59\\\",\\\"00:00-00:00\\\",\\\"00:00-00:00\\\",\\\"00:00-00:00\\\"],\\\"tuesday\\\":[\\\"00:00-23:59\\\",\\\"00:00-00:00\\\",\\\"00:00-00:00\\\",\\\"00:00-00:00\\\"],\\\"wednesday\\\":[\\\"00:00-23:59\\\",\\\"00:00-00:00\\\",\\\"00:00-00:00\\\",\\\"00:00-00:00\\\"],\\\"thursday\\\":[\\\"00:00-23:59\\\",\\\"00:00-00:00\\\",\\\"00:00-00:00\\\",\\\"00:00-00:00\\\"],\\\"friday\\\":[\\\"00:00-23:59\\\",\\\"00:00-00:00\\\",\\\"00:00-00:00\\\",\\\"00:00-00:00\\\"],\\\"saturday\\\":[\\\"00:00-23:59\\\",\\\"00:00-00:00\\\",\\\"00:00-00:00\\\",\\\"00:00-00:00\\\"],\\\"sunday\\\":[\\\"00:00-23:59\\\",\\\"00:00-00:00\\\",\\\"00:00-00:00\\\",\\\"00:00-00:00\\\"]}"); + dto.setName("访客计划"); + dto.setType(1); - String data = HttpClientManager.getInstance().sendPostByJSONAndHeader(url, StringUtils.EMPTY, paramsMap).getData(); + String data = HttpClientManager.getInstance().sendPostByJSONAndHeader(url, JSON.toJSONString(dto), paramsMap).getData(); if (null == data) { throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询开门计划失败"); @@ -238,12 +251,16 @@ public class DhDeviceUtil { throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询开门计划失败"); } Object registerResult = result.getData(); - JSONArray jsonArray = JSON.parseArray(registerResult.toString()); - JSONObject jsonObject = jsonArray.getJSONObject(0); + JSONObject jsonObject = JSON.parseObject(registerResult.toString()); if (null != jsonObject) { - return jsonObject.get("id").toString(); + return Long.parseLong(jsonObject.toString()); } - return ""; +// JSONArray jsonArray = JSON.parseArray(registerResult.toString()); +// JSONObject jsonObject = jsonArray.getJSONObject(0); +// if (null != jsonObject) { +// return jsonObject.get("id").toString(); +// } + return null; } /** @@ -260,8 +277,11 @@ public class DhDeviceUtil { url = url + urlParam; Map paramsMap = new HashMap<>(4); + DhChannelFormDTO dto = new DhChannelFormDTO(); + dto.setPageSize(1000); + dto.setPageSize(1); - String data = HttpClientManager.getInstance().sendPostByJSONAndHeader(url, StringUtils.EMPTY, paramsMap).getData(); + String data = HttpClientManager.getInstance().sendPostByJSONAndHeader(url, JSON.toJSONString(dto), paramsMap).getData(); if (null == data) { throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询通道列表失败"); @@ -449,7 +469,7 @@ public class DhDeviceUtil { public String addPersonAuth(DhPersonFormDTO dto, String imgUrl) { String personCard = addPersonCard(dto); List channel = getChannel(); - String plan = getPlan(); + Long plan = getPlan(); if (StringUtils.isBlank(personCard)) { return "开卡失败"; @@ -459,7 +479,7 @@ public class DhDeviceUtil { if (channel.isEmpty()) { return "获取通道失败"; } - if (StringUtils.isBlank(plan)) { + if (plan == null) { return "获取开门计划失败"; } DhAuthFormDTO authFormDTO = new DhAuthFormDTO(); @@ -468,7 +488,7 @@ public class DhDeviceUtil { url = url + urlParam; authFormDTO.setCardNumber(personCard); - authFormDTO.setTimeQuantumId(plan); + authFormDTO.setTimeQuantumId(plan.toString()); authFormDTO.setCardPrivilegeDetails(channel); Map paramsMap = new HashMap<>(4);