|  |  |  | 
|---|
|  |  |  | package com.doumee.service.business.impl; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.extension.api.R; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.metadata.IPage; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 
|---|
|  |  |  | import com.doumee.core.constants.ResponseStatus; | 
|---|
|  |  |  | import com.doumee.core.exception.BusinessException; | 
|---|
|  |  |  | import com.doumee.core.model.LoginUserInfo; | 
|---|
|  |  |  | import com.doumee.core.model.PageData; | 
|---|
|  |  |  | import com.doumee.core.model.PageWrap; | 
|---|
|  |  |  | import com.doumee.core.erp.model.openapi.request.RoleListRequest; | 
|---|
|  |  |  | import com.doumee.core.erp.model.openapi.response.DeviceListResponse; | 
|---|
|  |  |  | import com.doumee.core.erp.model.openapi.response.RoleListResponse; | 
|---|
|  |  |  | import com.doumee.core.utils.Constants; | 
|---|
|  |  |  | import com.doumee.core.utils.Utils; | 
|---|
|  |  |  | import com.doumee.dao.admin.response.MemberInfoDTO; | 
|---|
|  |  |  | import com.doumee.dao.business.*; | 
|---|
|  |  |  | import com.doumee.dao.business.join.MemberRoleJoinMapper; | 
|---|
|  |  |  | import com.doumee.dao.business.model.*; | 
|---|
|  |  |  | import com.doumee.dao.business.model.DeviceRole; | 
|---|
|  |  |  | import com.doumee.dao.business.model.Empower; | 
|---|
|  |  |  | import com.doumee.dao.business.model.Member; | 
|---|
|  |  |  | import com.doumee.dao.business.model.MemberRole; | 
|---|
|  |  |  | import com.doumee.dao.web.response.DeviceRoleVO; | 
|---|
|  |  |  | import com.doumee.service.business.DeviceRoleService; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.metadata.IPage; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 
|---|
|  |  |  | import com.doumee.service.business.MemberService; | 
|---|
|  |  |  | import com.doumee.service.business.impl.hksync.ferp.HkSyncOrgUserToHKServiceImpl; | 
|---|
|  |  |  | import com.github.yulichang.wrapper.MPJLambdaWrapper; | 
|---|
|  |  |  | import io.swagger.models.auth.In; | 
|---|
|  |  |  | import lombok.extern.slf4j.Slf4j; | 
|---|
|  |  |  | import org.apache.commons.collections.CollectionUtils; | 
|---|
|  |  |  | import org.apache.commons.lang3.StringUtils; | 
|---|
|  |  |  | import org.apache.shiro.SecurityUtils; | 
|---|
|  |  |  | import org.springframework.beans.BeanUtils; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.context.annotation.Bean; | 
|---|
|  |  |  | import org.springframework.stereotype.Service; | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.util.*; | 
|---|
|  |  |  | import java.util.stream.Collectors; | 
|---|
|  |  |  | import java.util.ArrayList; | 
|---|
|  |  |  | import java.util.Date; | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  | import java.util.Objects; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 门禁角色信息表Service实现 | 
|---|
|  |  |  | 
|---|
|  |  |  | newDeviceRole = getDeviceRole(deviceRole.getType()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | LoginUserInfo loginUserInfo = (LoginUserInfo)SecurityUtils.getSubject().getPrincipal(); | 
|---|
|  |  |  | if(loginUserInfo ==null){ | 
|---|
|  |  |  | loginUserInfo = deviceRole.getLoginUserInfo(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(null != newDeviceRole && deviceRole.getIsDefault().equals(Constants.ZERO)) { | 
|---|
|  |  |  | DeviceRole updateDeviceRole = new DeviceRole(); | 
|---|
|  |  |  | // 若现在新增数据设置默认门禁组;那么先把之前的默认门禁组状态改为不是默认的 | 
|---|
|  |  |  | 
|---|
|  |  |  | newDeviceRole = getDeviceRole(deviceRole.getType()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | LoginUserInfo loginUserInfo = (LoginUserInfo)SecurityUtils.getSubject().getPrincipal(); | 
|---|
|  |  |  | if(loginUserInfo ==null){ | 
|---|
|  |  |  | loginUserInfo = deviceRole.getLoginUserInfo(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(null != newDeviceRole  && deviceRole.getIsDefault().equals(Constants.ZERO)) { | 
|---|
|  |  |  | DeviceRole update = new DeviceRole(); | 
|---|
|  |  |  | update.setEdirot(loginUserInfo.getId().toString()); | 
|---|
|  |  |  | 
|---|
|  |  |  | continue FLAG; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | list.add(Integer.parseInt(s)); | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | list.add(Integer.parseInt(s)); | 
|---|
|  |  |  | }catch (Exception e){ | 
|---|
|  |  |  | e.printStackTrace(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return list; | 
|---|
|  |  |  | 
|---|
|  |  |  | newDeviceRole = getDeviceRole(deviceRole.getType()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | LoginUserInfo loginUserInfo = (LoginUserInfo)SecurityUtils.getSubject().getPrincipal(); | 
|---|
|  |  |  | if(loginUserInfo ==null){ | 
|---|
|  |  |  | loginUserInfo = deviceRole.getLoginUserInfo(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | List<DeviceRole> deviceRoleList = new ArrayList<>(); | 
|---|
|  |  |  | if(null != newDeviceRole) { | 
|---|
|  |  |  | DeviceRole update = new DeviceRole(); | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public List<DeviceRole> findList(DeviceRole deviceRole) { | 
|---|
|  |  |  | deviceRole.setIsdeleted(Constants.ZERO); | 
|---|
|  |  |  | QueryWrapper<DeviceRole> wrapper = new QueryWrapper<>(deviceRole); | 
|---|
|  |  |  | return deviceRoleMapper.selectList(wrapper); | 
|---|
|  |  |  | } | 
|---|