package com.sptg.gateway.controller.estate;

import com.baomidou.mybatisplus.plugins.Page;
import com.sptg.common.core.beans.ResultBean;
import com.sptg.common.core.beans.ResultEnum;
import com.sptg.common.core.constant.OperationConstant;
import com.sptg.common.core.constant.SysLogConstant;
import com.sptg.common.core.util.WebUtils;
import com.sptg.common.security.annotation.Security;
import com.sptg.common.security.enums.DataFormatEnum;
import com.sptg.common.security.service.SecurityServiceInterface;
import com.sptg.estate.api.constant.EstateSecurityToken;
import com.sptg.estate.api.dto.AccessCardDto;
import com.sptg.estate.api.dto.ServerUserDto;
import com.sptg.estate.api.entity.*;
import com.sptg.estate.api.feigns.AccessCardFeign;
import com.sptg.estate.api.feigns.ResidentialFeign;
import com.sptg.estate.api.feigns.ServerUserFeign;
import com.sptg.estate.api.vo.DevicesAccessPushVO;
import com.sptg.permissions.api.entity.Account;
import com.sptg.permissions.api.entity.Organization;
import com.sptg.permissions.api.feigns.ConfFeign;
import com.sptg.permissions.api.feigns.OrgFeign;
import com.sptg.statistics.api.constant.SysLogMenuConstant;
import com.sptg.statistics.api.entity.SysOperationLog;
import com.sptg.statistics.api.feigns.SysOperationLogFeign;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;

import javax.xml.ws.Service;
import java.text.SimpleDateFormat;
import java.util.*;

/**
 * title: ServerUserController
 * package: com.sptg.gateway.controller.estate
 * description: 服务人员- 网关控制器
 */
@Slf4j
@RestController
@RequestMapping("/estate/serverUser")
@RequiredArgsConstructor
public class ServerUserController {

    private final ConfFeign confFeign;
    private final SecurityServiceInterface<Account> securityServiceInterface;
    private final ServerUserFeign serverUserFeign;
    private final SysOperationLogFeign sysOperationLogFeign;
    private final ResidentialFeign residentialFeign;
    private final OrgFeign orgFeign;
    private final AccessCardFeign accessCardFeign;

    /**
     * 功能描述:服务人员管理页面
     *
     * @return ModelAndView
     */
    @RequestMapping("/index")
    @Security(token = EstateSecurityToken.ESTATE_SERVER_USER_MANAGE)
    public ModelAndView index() {
        ModelAndView modelAndView = new ModelAndView("estate/server-user-manage");
        modelAndView.addObject("fastDfsServer", this.confFeign.getFileServerHost());
        return modelAndView;
    }

    /**
     * 功能描述:展示服务人员列表
     *
     * @param serverUserDto
     * @param page
     * @return ResultBean<Page < ServerUser>>
     */
    @RequestMapping("/showServerUserList")
    @Security(token = EstateSecurityToken.ESTATE_SERVER_USER_MANAGE)
    public ResultBean<Page<ServerUser>> showServerUserList(ServerUserDto serverUserDto, Page<ServerUser> page) {
        Account account = securityServiceInterface.getOnLineUser();
        Organization userOrg = this.orgFeign.getOrgById(account.getOrgId());
        if (userOrg.getOrgType() == OperationConstant.THREE) {
            serverUserDto.setEstatePosition(account.getOrgPosition());
        } else {
            serverUserDto.setOrgPosition(account.getOrgPosition());
        }
        serverUserDto.setPage(page);
        ResultBean<Page<ServerUser>> pageResultBean;
        //门禁卡
        AccessCardDto accessCardDto = new AccessCardDto();
        //判断是否传入卡号
        if (StringUtils.isNotBlank(serverUserDto.getCardNo())) {
            if (userOrg.getOrgType() == OperationConstant.THREE) {
                accessCardDto.setEstatePosition(serverUserDto.getEstatePosition());
            } else {
                accessCardDto.setOrgPosition(serverUserDto.getOrgPosition());
            }
            accessCardDto.setCardNo(serverUserDto.getCardNo());
            accessCardDto.setType(OperationConstant.FOUR);
            List<AccessCard> accessCardList = this.accessCardFeign.getListByCardNoAndDate(accessCardDto);
            if (accessCardList.size() > 0) {
                List<String> userIds = new ArrayList<>();
                accessCardList.forEach(accessCard -> userIds.add(accessCard.getUserId()));
                serverUserDto.setIds(userIds);
                pageResultBean = this.serverUserFeign.pagingByServerUserIds(serverUserDto);
            } else {
                pageResultBean = new ResultBean<>(ResultEnum.SUCCESS, page);
            }
        } else {
            pageResultBean = this.serverUserFeign.showServerUserList(serverUserDto);
        }
        //查询卡信息和人脸
        if (pageResultBean != null && pageResultBean.getData() != null) {
            Page<ServerUser> resultPage = pageResultBean.getData();
            if (null != resultPage) {
                List<ServerUser> records = resultPage.getRecords();
                if (null != records && !records.isEmpty()) {
                    records.forEach(u -> {
                        //卡信息
                        AccessCardDto dto = new AccessCardDto();
                        dto.setUserId(String.valueOf(u.getId()));
                        dto.setType(OperationConstant.FOUR);
                        List<AccessCard> accessCardList = accessCardFeign.getAccessCardByUserIdAndType(dto);
                        if (null != accessCardList && !accessCardList.isEmpty()) {
                            u.setAccessCard(accessCardList.get(0));
                        }
                        //人脸信息
                        ResultBean<ServerUser> bean = serverUserFeign.findServerUserCardAndFaceById(u.getId());
                        if (null != bean.getData().getServerUserFaceImage()) {
                            u.setServerUserFaceImage(bean.getData().getServerUserFaceImage());
                        }
                    });
                }
            }
        }
        return pageResultBean;
    }

    /**
     * 功能描述:新增页面初始化
     *
     * @return ModelAndView
     */
    @GetMapping(value = "/add")
    @Security(token = EstateSecurityToken.ESTATE_SERVER_USER_ADD, format = DataFormatEnum.VIEW)
    public ModelAndView add() {
        return new ModelAndView("estate/server-user-add");
    }

    /**
     * 功能描述:新增服务人员
     *
     * @param serverUser 服务人员对象
     * @return ResultBean<Boolean>
     */
    @PostMapping(value = "/addOrEditServerUser")
    @Security(token = EstateSecurityToken.ESTATE_SERVER_USER_ADD, format = DataFormatEnum.JSON)
    public ResultBean<Boolean> addOrEditServerUser(ServerUser serverUser) {
        //登陆用户
        Account onLineUser = this.securityServiceInterface.getOnLineUser();
        //操作事件
        int operationEvent = SysLogConstant.ALTER_EVENT;
        ServerUser oldObj = new ServerUser();
        //新增时
        if (serverUser.getId() == null) {
            serverUser.setCreateAccountId(onLineUser.getId());
            serverUser.setCreateAccountName(onLineUser.getLoginName());
            serverUser.setOrgId(onLineUser.getOrgId());
            serverUser.setRootOrgId(onLineUser.getRootOrgId());
            //获取小区位置
            Residential residential = this.residentialFeign.findResidentialById(serverUser.getResidentialId());
            serverUser.setOrgPosition(residential.getOrgPosition());
            serverUser.setEstatePosition(residential.getEstatePosition());
            operationEvent = SysLogConstant.ADD_EVENT;
            oldObj = serverUser;
        }else{
            oldObj = this.serverUserFeign.findServerUserById(serverUser.getId()).getData();
        }
        ResultBean<Boolean> resultBean = this.serverUserFeign.insertOrUpdateServerUser(serverUser);
        Boolean result = resultBean.getData();
        if (result != null && result) {
            /*---------------------------------------------------记录日志--------------------------------------------------------*/
            ServerUser newObj = new ServerUser();
            if (serverUser.getId() != null){
                newObj = this.serverUserFeign.findServerUserById(serverUser.getId()).getData();
            }
            SysOperationLog sysOperationLog = new SysOperationLog(SysLogMenuConstant.ESTATE_SERVER_USER_MANAGE, operationEvent,
                    WebUtils.getIp(), serverUser, onLineUser,oldObj,newObj);
            sysOperationLogFeign.info(sysOperationLog);
            /*-------------------------------------------------------------------------------------------------------------------*/
        }
        return resultBean;
    }

    /**
     * 功能描述:修改/详细页面
     *
     * @param id
     * @return ModelAndView
     */
    @GetMapping(value = "/findServerUserById/{id}")
    @Security(token = EstateSecurityToken.ESTATE_SERVER_USER_MANAGE, format = DataFormatEnum.VIEW)
    public ModelAndView findServerUserById(@PathVariable(value = "id") long id) {
        ModelAndView modelAndView = new ModelAndView("estate/server-user-add");
        ResultBean<ServerUser> resultBean = serverUserFeign.findServerUserById(id);
        ServerUser serverUser = resultBean.getData();
        List<ServerUserDetail> serverUserDetailList = this.serverUserFeign.findServerUserDetailList(id);
        if (null != serverUserDetailList) {
            StringBuffer sb = new StringBuffer();
            for (ServerUserDetail serverUserDetail : serverUserDetailList) {
                if (sb.length() == 0) {
                    sb.append(serverUserDetail.getUnitId());
                } else {
                    sb.append("," + serverUserDetail.getUnitId());
                }
            }
            serverUser.setUnitIds(sb.toString());
        }
        modelAndView.addObject("serverUser", serverUser);
        return modelAndView;
    }

    /**
     * 功能描述:根据id删除人员服务
     *
     * @param id
     * @return ResultBean<Boolean>
     */
    @PostMapping(value = "/deleteServerUser/{id}")
    @Security(token = EstateSecurityToken.ESTATE_SERVER_USER_DELETE, format = DataFormatEnum.JSON)
    public ResultBean<Boolean> deleteServerUser(@PathVariable(value = "id") long id) {
        ResultBean<Boolean> resultBean = this.serverUserFeign.deleteServerUser(id);
        boolean resultData = resultBean.getData();
        if (resultData) {
            ResultBean<ServerUser> oldObj = this.serverUserFeign.findServerUserById(id);
            /*---------------------------------------------------记录日志--------------------------------------------------------*/
            //登陆用户
            Account onLineUser = this.securityServiceInterface.getOnLineUser();
            //添加系统日志
            ServerUser serverUser = new ServerUser();
            serverUser.setId(id);
            SysOperationLog sysOperationLog = new SysOperationLog(SysLogMenuConstant.ESTATE_SERVER_USER_MANAGE, SysLogConstant.DELETE_EVENT,
                    WebUtils.getIp(), serverUser, onLineUser,oldObj);
            sysOperationLogFeign.info(sysOperationLog);
            /*-------------------------------------------------------------------------------------------------------------------*/
        }
        return resultBean;
    }

    /**
     * 功能描述:批量删除服务人员
     *
     * @param ids
     * @return ResultBean<Boolean>
     */
    @PostMapping(value = "/deleteServerUserList")
    @Security(token = EstateSecurityToken.ESTATE_SERVER_USER_DELETE, format = DataFormatEnum.JSON)
    public ResultBean<Boolean> deleteServerUserList(@RequestBody List<String> ids) {
        if (null == ids || ids.size() <= 0) {
            //  参数异常
            return new ResultBean<>(ResultEnum.PARAMETER_ANOMALY);
        }
        ServerUserDto serverUserDto = new ServerUserDto();
        serverUserDto.setIds(ids);
        ResultBean<Boolean> resultBean = this.serverUserFeign.deleteServerUserList(serverUserDto);
        Boolean result = resultBean.getData();
        if (result != null && result) {
            /*---------------------------------------------------记录日志--------------------------------------------------------*/
            //登陆用户
            Account onLineUser = this.securityServiceInterface.getOnLineUser();
            //添加删除日志
            SysOperationLog sysOperationLog = new SysOperationLog(SysLogMenuConstant.ESTATE_SERVER_USER_MANAGE, SysLogConstant.DELETE_EVENT, WebUtils.getIp(), serverUserDto, onLineUser);
            sysOperationLogFeign.info(sysOperationLog);
            /*-----------------------------------------------------------------------------------------------------------------*/
        }
        return resultBean;
    }

    /**
     * 功能描述:禁用启用服务人员
     *
     * @param id
     * @param isEnable
     * @return ResultBean<Boolean>
     */
    @PostMapping(value = "/updateIsEnable")
    @Security(token = EstateSecurityToken.ESTATE_SERVER_USER_ENABLE, format = DataFormatEnum.JSON)
    public ResultBean<Boolean> updateIsEnable(@RequestParam(value = "id") long id, @RequestParam(value = "isEnable") int isEnable) {
        ServerUser oldObj = this.serverUserFeign.findServerUserById(id).getData();
        ResultBean<Boolean> resultBean = this.serverUserFeign.updateIsEnable(id, isEnable);
        Boolean result = resultBean.getData();
        if (result != null && result) {
            ServerUser newObj = this.serverUserFeign.findServerUserById(id).getData();
            /*---------------------------------------------------记录日志--------------------------------------------------------*/
            //登陆用户
            Account onLineUser = this.securityServiceInterface.getOnLineUser();
            String message = "";
            if (isEnable == 0) {
                message = "启用服务人员";
            } else if (isEnable == 1) {
                message = "禁用服务人员";
            }
            ServerUser serverUser = new ServerUser();
            serverUser.setId(id);
            SysOperationLog sysOperationLog = new SysOperationLog(SysLogMenuConstant.ESTATE_SERVER_USER_MANAGE, SysLogConstant.ALTER_EVENT,
                    WebUtils.getIp(), message, serverUser, onLineUser,oldObj,newObj);
            sysOperationLogFeign.info(sysOperationLog);
            /*-------------------------------------------------------------------------------------------------------------------*/
        }
        return resultBean;
    }

    /**
     * 功能描述:开门权限页面初始化
     *
     * @param id
     * @param name
     * @return ModelAndView
     */
    @GetMapping(value = "/openPermission/{name}/{id}")
    @Security(token = EstateSecurityToken.ESTATE_SERVER_USER_OPEN_DOOR, format = DataFormatEnum.VIEW)
    public ModelAndView openPermission(@PathVariable(value = "id") long id, @PathVariable(value = "name") String name) {
        ResultBean<ServerUser> resultBean = serverUserFeign.findServerUserCardAndFaceById(id);
        ServerUser serverUser = resultBean.getData();
        String url = "estate/server-user-open-permission";
        if (null != serverUser) {
            serverUser.setName(name);
            Integer isEnable = serverUser.getIsEnable();
            if (isEnable != null && isEnable == OperationConstant.ONE) {
                //禁用状态
                url = "estate/server-user-open-permission-detail";
            }
        }
        ModelAndView modelAndView = new ModelAndView(url);
        modelAndView.addObject("serverUser", serverUser);
        modelAndView.addObject("fastDfsServer", this.confFeign.getFileServerHost());
        return modelAndView;
    }

    /**
     * 功能描述:特殊门禁权限页面初始化
     *
     * @return ModelAndView
     */
    @GetMapping(value = "/specialOpenPermission/{name}/{id}")
    @Security(token = EstateSecurityToken.ESTATE_SERVER_USER_OPEN_SPECIAL_DOOR, format = DataFormatEnum.VIEW)
    public ModelAndView specialOpenPermission(@PathVariable(value = "id") long id, @PathVariable(value = "name") String name) {
        ResultBean<ServerUser> resultBean = serverUserFeign.findServerUserCardAndFaceById(id);
        ServerUser serverUser = resultBean.getData();
        String url = "estate/access-devices-manual-push";
        ModelAndView modelAndView = new ModelAndView(url);
        modelAndView.addObject("user", serverUser);
        modelAndView.addObject("userType", OperationConstant.FOUR); //服务人员特殊开门权限
        return modelAndView;
    }

    /**
     * 功能描述:添加或修改(含删除)开门权限
     * @param accessCard
     * @param imgUri
     * @param faceCode
     * @return ResultBean<Boolean>
     *
     *
     */
//    @PostMapping(value = "/addOrEditOpenPermission")
//    @Security(token = EstateSecurityToken.ESTATE_SERVER_USER_OPEN_DOOR,format = DataFormatEnum.JSON)
//    public ResultBean<Boolean> addOrEditOpenPermission(AccessCard accessCard,String imageId,String imgUri,String faceCode){
//        //登陆用户
//        Account onLineUser = this.securityServiceInterface.getOnLineUser();
//        ServerUser serverUser=new ServerUser();
//        serverUser.setId(Long.valueOf(accessCard.getUserId()));
//        //添加门禁卡信息
//        serverUser.setAccessCard(accessCard);
//
//        ServerUserFaceImage serverUserFaceImage=new ServerUserFaceImage();
//        if(StringUtils.isNotBlank(imageId)){
//            serverUserFaceImage.setId(Long.valueOf(imageId));
//        }
//        serverUserFaceImage.setServerUserId(Long.valueOf(accessCard.getUserId()));
//        serverUserFaceImage.setImageUri(imgUri);
//        serverUserFaceImage.setFaceCode(faceCode);
//        serverUser.setServerUserFaceImage(serverUserFaceImage);
//
//        //新增门禁卡信息
//        if(accessCard.getId()==null){
//            accessCard.setCreateAccountId(onLineUser.getId());
//            accessCard.setCreateDate(new Date());
//            accessCard.setRootOrgId(onLineUser.getRootOrgId());
//        }
//        ResultBean<Boolean> resultBean=serverUserFeign.addOrEditOpenPermission(serverUser);
//        Boolean result=resultBean.getData();
//        if(result!=null&&result){
//            /*---------------------------------------------------记录日志--------------------------------------------------------*/
//            String message="添加/修改开门权限";
//            SysOperationLog sysOperationLog=new SysOperationLog(SysLogMenuConstant.ESTATE_SERVER_USER_MANAGE, SysLogConstant.ALTER_EVENT,
//                    WebUtils.getIp(),message,serverUser,onLineUser);
//            sysOperationLogFeign.info(sysOperationLog);
//            /*-------------------------------------------------------------------------------------------------------------------*/
//        }
//        return resultBean;
//    }

    /**
     * 功能描述:添加或修改(含删除)开门权限
     *
     * @param accessCard
     * @param imgUri
     * @param faceCode
     * @return ResultBean<Boolean>
     */
    @PostMapping(value = "/addOrEditOpenPermission")
    @Security(token = EstateSecurityToken.ESTATE_SERVER_USER_OPEN_DOOR, format = DataFormatEnum.JSON)
    public ResultBean<Boolean> addOrEditOpenPermission(AccessCard accessCard, String imageId, String imgUri, String faceCode, Integer deviceAccessType, String imgBeginDate, String imgEndDate, Integer openPermissionType) {
        //登陆用户
        ServerUser oldObj = this.serverUserFeign.findServerUserById(Long.parseLong(accessCard.getUserId())).getData();
        Account onLineUser = this.securityServiceInterface.getOnLineUser();
        ServerUser serverUser = new ServerUser();
        serverUser.setId(Long.valueOf(accessCard.getUserId()));

        if (openPermissionType == 1) {
            ServerUserFaceImage serverUserFaceImage = new ServerUserFaceImage();
            if (StringUtils.isNotBlank(imageId)) {
                serverUserFaceImage.setId(Long.valueOf(imageId));
            }
            try {
                SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
                serverUserFaceImage.setBeginDate(simpleDateFormat.parse(imgBeginDate));
                serverUserFaceImage.setEndDate(simpleDateFormat.parse(imgEndDate));
            } catch (Exception e) {
                log.error(e.getMessage());
            }
            serverUserFaceImage.setServerUserId(Long.valueOf(accessCard.getUserId()));
            serverUserFaceImage.setImageUri(imgUri);
            serverUserFaceImage.setFaceCode(faceCode);
            serverUser.setServerUserFaceImage(serverUserFaceImage);
        } else if (openPermissionType == 2) {
            //添加门禁卡信息
            serverUser.setAccessCard(accessCard);
            //新增门禁卡信息
            if (accessCard.getId() == null) {
                accessCard.setCreateAccountId(onLineUser.getId());
                accessCard.setCreateDate(new Date());
                accessCard.setRootOrgId(onLineUser.getRootOrgId());
            }
        }
        serverUser.setDeviceAccessType(deviceAccessType);
        serverUser.setOpenPermissionType(openPermissionType);
        ResultBean<Boolean> resultBean = serverUserFeign.addOrEditOpenPermission(serverUser);
        Boolean result = resultBean.getData();
        if (result != null && result) {
            ServerUser newObj = this.serverUserFeign.findServerUserById(Long.parseLong(accessCard.getUserId())).getData();
            /*---------------------------------------------------记录日志--------------------------------------------------------*/
            String message = "添加/修改开门权限";
            SysOperationLog sysOperationLog = new SysOperationLog(SysLogMenuConstant.ESTATE_SERVER_USER_MANAGE, SysLogConstant.ALTER_EVENT,
                    WebUtils.getIp(), message, serverUser, onLineUser,oldObj,newObj);
            sysOperationLogFeign.info(sysOperationLog);
            /*-------------------------------------------------------------------------------------------------------------------*/
        }
        return resultBean;
    }

    /**
     * 功能描述:添加或修改(含删除)特殊门禁开门权限
     *
     * @param devicesAccessPushVO
     * @return ResultBean<Boolean>
     */
    @PostMapping(value = "/accessDevicesManualPush")
    @Security(token = EstateSecurityToken.ESTATE_SERVER_USER_OPEN_SPECIAL_DOOR, format = DataFormatEnum.JSON)
    public ResultBean<Boolean> accessDevicesManualPush(DevicesAccessPushVO devicesAccessPushVO) {
        //登陆用户
        ResultBean<ServerUser> oldObj = this.serverUserFeign.findServerUserById(devicesAccessPushVO.getUserId());
        Account onLineUser = this.securityServiceInterface.getOnLineUser();
        Long serverId = devicesAccessPushVO.getUserId();
        Integer pushMaterial = devicesAccessPushVO.getPushMaterial();
        Integer pushType = devicesAccessPushVO.getPushType();
        Integer operType = devicesAccessPushVO.getOperType();
        List<Long> deviceIdList = devicesAccessPushVO.getDeviceIdList();
        if (operType.equals(OperationConstant.ONE)) {
            if (serverId == null || pushMaterial == null || pushType == null || deviceIdList == null || deviceIdList.size() <= 0) {
                return new ResultBean<>(ResultEnum.PARAMETER_ANOMALY);
            }
        } else if (serverId == null) {
            return new ResultBean<>(ResultEnum.PARAMETER_ANOMALY);
        }

        devicesAccessPushVO.setOnLineUser(onLineUser);
        ResultBean<Boolean> resultBean = serverUserFeign.accessDevicesManualPush(devicesAccessPushVO);
        Boolean result = resultBean.getData();
        if (result != null && result) {
            ResultBean<ServerUser> newObj = this.serverUserFeign.findServerUserById(devicesAccessPushVO.getUserId());
            /*---------------------------------------------------记录日志--------------------------------------------------------*/
            String message = "添加/修改服务人员特殊开门权限";
            SysOperationLog sysOperationLog = new SysOperationLog(SysLogMenuConstant.ESTATE_SERVER_USER_MANAGE, SysLogConstant.ALTER_EVENT,
                    WebUtils.getIp(), message, devicesAccessPushVO, onLineUser,oldObj,newObj);
            sysOperationLogFeign.info(sysOperationLog);
            /*-------------------------------------------------------------------------------------------------------------------*/
        }
        return resultBean;
    }

    /**
     * 功能描述:删除门禁卡
     *
     * @param id
     * @return ResultBean<Boolean>
     */
    @GetMapping(value = "/deleteCard/{id}")
    @Security(token = EstateSecurityToken.ESTATE_ACCESS_SPECIAL_PUSH, format = DataFormatEnum.JSON)
    public ResultBean<Boolean> deleteCard(@PathVariable(value = "id") Long id) {
        AccessCardDto accessCardDto = new AccessCardDto();
        accessCardDto.setType(OperationConstant.FOUR);
        accessCardDto.setUserId(id.toString());
        List<AccessCard> accessCardList = accessCardFeign.getAccessCardByUserIdAndType(accessCardDto);
        if (accessCardList.size() > 0) {
            AccessCard accessCard = accessCardList.get(0);
            AccessCardDto cardDto = new AccessCardDto();
            BeanUtils.copyProperties(accessCard, cardDto);
            ResultBean<Boolean> bean = accessCardFeign.deleteAccessCard(cardDto);
            return bean;
        } else {
            return new ResultBean<>(ResultEnum.ERROR);
        }
    }

    /**
     * 功能描述:删除人脸
     *
     * @param id
     * @return ResultBean<Boolean>
     */
    @GetMapping(value = "/deleteFace/{id}")
    @Security(token = EstateSecurityToken.ESTATE_ACCESS_SPECIAL_PUSH, format = DataFormatEnum.JSON)
    public ResultBean<Boolean> deleteFace(@PathVariable(value = "id") Long id) {
        ServerUserFaceImage serverUserFaceImage = new ServerUserFaceImage();
        serverUserFaceImage.setServerUserId(id);
        ResultBean<Boolean> bean = serverUserFeign.deleteServerUserFaceImage(serverUserFaceImage);
        return bean;
    }
}
