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..a57412c --- /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 String interfaceId; + + private String jsonParam; + +} \ 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/DhNodeFormDTO.java b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/form/DhNodeFormDTO.java new file mode 100644 index 0000000..bfd3bf8 --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/form/DhNodeFormDTO.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 DhNodeFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + private String typeCode; + + private String nodeId; + +} \ 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/VisitVisitorFormDTO.java b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/form/VisitVisitorFormDTO.java index 37233a8..affbfb2 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/form/VisitVisitorFormDTO.java +++ b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/form/VisitVisitorFormDTO.java @@ -100,6 +100,11 @@ public class VisitVisitorFormDTO implements Serializable { */ private String room; + /** + * 房屋 + */ + private String node; + /** * 客户ID */ diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/feign/PliPowerFeignClient.java b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/feign/PliPowerFeignClient.java index cfb4135..8a4e8fa 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/feign/PliPowerFeignClient.java +++ b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/feign/PliPowerFeignClient.java @@ -15,7 +15,7 @@ import org.springframework.web.bind.annotation.RequestBody; * @date: 2020/6/22 17:39 * @author: jianjun liu */ -@FeignClient(name = ServiceConstant.DATA_STATISTICAL_SERVER, fallbackFactory = PliPowerFeignClientFallBackFactory.class) +@FeignClient(name = ServiceConstant.PLI_POWER_SERVER, fallbackFactory = PliPowerFeignClientFallBackFactory.class) public interface PliPowerFeignClient { @PostMapping("/pli/power/visitVisitor/logout") diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/feign/impl/PliPowerFeignClientFallBack.java b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/feign/impl/PliPowerFeignClientFallBack.java index 232235e..d71624a 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/feign/impl/PliPowerFeignClientFallBack.java +++ b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/feign/impl/PliPowerFeignClientFallBack.java @@ -18,7 +18,7 @@ public class PliPowerFeignClientFallBack implements PliPowerFeignClient { @Override public Result visitorLogout(VisitorLogoutFormDTO formDTO) { - return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "logout",formDTO); + return ModuleUtils.feignConError(ServiceConstant.PLI_POWER_SERVER, "logout",formDTO); } } diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/visit/controller/VisitVisitorController.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/visit/controller/VisitVisitorController.java index 000175a..fcd5a63 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/visit/controller/VisitVisitorController.java +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/visit/controller/VisitVisitorController.java @@ -96,7 +96,7 @@ public class VisitVisitorController { public Result logout(@RequestBody VisitorLogoutFormDTO dto) { //效验数据 ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); - + visitVisitorService.logout(dto); return new Result(); } diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/visit/dao/VisitVisitorDao.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/visit/dao/VisitVisitorDao.java index 11c10b9..288994c 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/visit/dao/VisitVisitorDao.java +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/visit/dao/VisitVisitorDao.java @@ -1,10 +1,12 @@ package com.epmet.plugin.power.modules.visit.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.plugin.power.dto.visit.VisitVisitorDTO; import com.epmet.plugin.power.dto.visit.form.VisitVisitorChartFormDTO; import com.epmet.plugin.power.dto.visit.result.VisitVisitorChartResultDTO; import com.epmet.plugin.power.modules.visit.entity.VisitVisitorEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; import java.util.List; @@ -26,4 +28,6 @@ public interface VisitVisitorDao extends BaseDao { * @date 2022-07-26 */ List getTraffic(VisitVisitorChartFormDTO dto); + + List listByDate(@Param("dateId") String dateId); } \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/visit/service/VisitVisitorService.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/visit/service/VisitVisitorService.java index 5451f38..57d10c1 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/visit/service/VisitVisitorService.java +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/visit/service/VisitVisitorService.java @@ -5,6 +5,7 @@ import com.epmet.commons.tools.page.PageData; import com.epmet.plugin.power.dto.visit.VisitVisitorDTO; import com.epmet.plugin.power.dto.visit.form.VisitVisitorChartFormDTO; import com.epmet.plugin.power.dto.visit.form.VisitVisitorFormDTO; +import com.epmet.plugin.power.dto.visit.form.VisitorLogoutFormDTO; import com.epmet.plugin.power.dto.visit.result.VisitVisitorChartResultDTO; import com.epmet.plugin.power.modules.visit.entity.VisitVisitorEntity; @@ -99,6 +100,16 @@ public interface VisitVisitorService extends BaseService { */ void doorAuthority(VisitVisitorFormDTO dto); + /** + * 退卡登出 + * + * @param dto + * @return void + * @author generator + * @date 2022-07-26 + */ + void logout(VisitorLogoutFormDTO dto); + /** * 人流量 * 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 c769496..9c5a511 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 @@ -7,6 +7,7 @@ import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.IcNeighborHoodDTO; import com.epmet.feign.GovOrgOpenFeignClient; @@ -14,6 +15,7 @@ import com.epmet.plugin.power.dto.visit.VisitVisitorDTO; import com.epmet.plugin.power.dto.visit.form.DhPersonFormDTO; import com.epmet.plugin.power.dto.visit.form.VisitVisitorChartFormDTO; import com.epmet.plugin.power.dto.visit.form.VisitVisitorFormDTO; +import com.epmet.plugin.power.dto.visit.form.VisitorLogoutFormDTO; import com.epmet.plugin.power.dto.visit.result.VisitVisitorChartResultDTO; import com.epmet.plugin.power.modules.visit.dao.VisitVisitorDao; import com.epmet.plugin.power.modules.visit.entity.VisitVisitorEntity; @@ -139,6 +141,16 @@ public class VisitVisitorServiceImpl extends BaseServiceImpl list = baseDao.listByDate(formDTO.getDateId()); + list.forEach(item -> delAuth(item.getIdCard())); + } + @Override @Transactional(rollbackFor = Exception.class) public List getTraffic(VisitVisitorChartFormDTO dto) { @@ -166,7 +178,7 @@ public class VisitVisitorServiceImpl extends BaseServiceImpl paramsMap = new HashMap<>(4); + DhNodeFormDTO dto = new DhNodeFormDTO(); + dto.setNodeId("ORG_001"); + dto.setTypeCode("01;0;8;7"); + + String data = HttpClientManager.getInstance().sendPostByJSONAndHeader(url, JSON.toJSONString(dto), paramsMap).getData(); + + if (null == data) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询节点列表失败"); + } + JSONObject toResult = JSON.parseObject(data); + DhResult result = ConvertUtils.mapToEntity(toResult, DhResult.class); + if (null != toResult.get("success")) { + result.setCode(200); + } + if (!result.getSuccess()) { + logger.info(result.getErrMsg()); + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询节点列表失败!" + result.getErrMsg()); + } + Object registerResult = result.getData(); + + JSONArray jsonArray = JSON.parseArray(registerResult.toString()); + for (int i = 0; i < jsonArray.size(); i++) { + if (nodeName.equals(jsonArray.getJSONObject(i).get("name").toString())) { + return jsonArray.getJSONObject(i).get("id").toString(); + } + } + + return null; + } + /** * 人员预处理 * @@ -467,6 +513,59 @@ public class DhDeviceUtil { return list; } + /** + * 查询通道-从全部设备中获取 + * + * @param + * @return java.lang.String + * @author zhy + * @date 2022/5/23 11:04 + */ + public List getAllChannel(String nodeName) { + String nodeId = getNode(nodeName); + if (StringUtils.isBlank(nodeId)) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询节点失败"); + } + nodeId = nodeId.replaceAll("ORG_", ""); + String url = dhCloudProperties.getUrl().concat(GET_CHANNEL); + String urlParam = getDhUrlParams(); + url = url + urlParam; + + Map paramsMap = new HashMap<>(4); + DhChannelFormDTO dto = new DhChannelFormDTO(); + dto.setInterfaceId("admin_001_006"); + dto.setJsonParam("{\"param\":{\"unitType\":7,\"orgCode\":\"" + nodeId + "\"}}"); + + String data = HttpClientManager.getInstance().sendPostByJSONAndHeader(url, JSON.toJSONString(dto), paramsMap).getData(); + + if (null == data) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询通道列表失败"); + } + JSONObject toResult = JSON.parseObject(data); + DhResult result = ConvertUtils.mapToEntity(toResult, DhResult.class); + if (null != toResult.get("success")) { + result.setCode(200); + } + if (!result.getSuccess()) { + logger.info(result.getErrMsg()); + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询通道列表失败!" + result.getErrMsg()); + } + Object registerResult = result.getData(); + + JSONArray jsonArray = JSON.parseArray(registerResult.toString()); + + List list = new ArrayList<>(); + for (int i = 0; i < jsonArray.size(); i++) { + JSONObject jsonItem = jsonArray.getJSONObject(i); + DhChannelResultDTO channel = new DhChannelResultDTO(); + channel.setPrivilegeType("1"); + channel.setResouceCode(jsonItem.get("channelId").toString()); + list.add(channel); + } + + return list; + } + /** * 新增人员 * @@ -621,7 +720,7 @@ public class DhDeviceUtil { * @author zhy * @date 2022/5/23 11:04 */ - public String addPersonAuth(DhPersonFormDTO dto, String imgUrl) { + public String addPersonAuth(DhPersonFormDTO dto, String imgUrl, String node) { String personCard = addPersonCard(dto); if (StringUtils.isBlank(personCard)) { throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "开卡失败"); @@ -629,6 +728,7 @@ public class DhDeviceUtil { addPersonImg(dto, imgUrl); } +// List channel = getAllChannel(node); List channel = getChannel(); if (channel.isEmpty()) { throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取通道失败"); diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/visit/VisitVisitorDao.xml b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/visit/VisitVisitorDao.xml index 5ac136d..72428f9 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/visit/VisitVisitorDao.xml +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/visit/VisitVisitorDao.xml @@ -39,4 +39,13 @@ h.`hour`; + + \ No newline at end of file