11 changed files with 54 additions and 353 deletions
@ -1,47 +0,0 @@ |
|||||
/** |
|
||||
* Copyright 2018 人人开源 https://www.renren.io
|
|
||||
* <p> |
|
||||
* This program is free software: you can redistribute it and/or modify |
|
||||
* it under the terms of the GNU General Public License as published by |
|
||||
* the Free Software Foundation, either version 3 of the License, or |
|
||||
* (at your option) any later version. |
|
||||
* <p> |
|
||||
* This program is distributed in the hope that it will be useful, |
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
* GNU General Public License for more details. |
|
||||
* <p> |
|
||||
* You should have received a copy of the GNU General Public License |
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||
*/ |
|
||||
|
|
||||
package com.epmet.redis; |
|
||||
|
|
||||
import com.epmet.commons.tools.redis.RedisUtils; |
|
||||
import org.springframework.beans.factory.annotation.Autowired; |
|
||||
import org.springframework.stereotype.Component; |
|
||||
|
|
||||
/** |
|
||||
* 政府工作人员表 |
|
||||
* |
|
||||
* @author generator generator@elink-cn.com |
|
||||
* @since v1.0.0 2020-04-18 |
|
||||
*/ |
|
||||
@Component |
|
||||
public class CustomerStaffRedis { |
|
||||
@Autowired |
|
||||
private RedisUtils redisUtils; |
|
||||
|
|
||||
public void delete(Object[] ids) { |
|
||||
|
|
||||
} |
|
||||
|
|
||||
public void set(){ |
|
||||
|
|
||||
} |
|
||||
|
|
||||
public String get(String id){ |
|
||||
return null; |
|
||||
} |
|
||||
|
|
||||
} |
|
@ -1,75 +0,0 @@ |
|||||
/** |
|
||||
* Copyright 2018 人人开源 https://www.renren.io
|
|
||||
* <p> |
|
||||
* This program is free software: you can redistribute it and/or modify |
|
||||
* it under the terms of the GNU General Public License as published by |
|
||||
* the Free Software Foundation, either version 3 of the License, or |
|
||||
* (at your option) any later version. |
|
||||
* <p> |
|
||||
* This program is distributed in the hope that it will be useful, |
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
* GNU General Public License for more details. |
|
||||
* <p> |
|
||||
* You should have received a copy of the GNU General Public License |
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||
*/ |
|
||||
|
|
||||
package com.epmet.redis; |
|
||||
|
|
||||
import cn.hutool.core.bean.BeanUtil; |
|
||||
import com.epmet.commons.tools.redis.RedisKeys; |
|
||||
import com.epmet.commons.tools.redis.RedisUtils; |
|
||||
import com.epmet.commons.tools.utils.ConvertUtils; |
|
||||
import com.epmet.dto.CustomerStaffInfoDTO; |
|
||||
import org.springframework.beans.factory.annotation.Autowired; |
|
||||
import org.springframework.stereotype.Component; |
|
||||
|
|
||||
import java.util.Map; |
|
||||
|
|
||||
import static com.epmet.commons.tools.redis.RedisUtils.NOT_EXPIRE; |
|
||||
|
|
||||
/** |
|
||||
* 工作人员-角色关系表 |
|
||||
* |
|
||||
* @author generator generator@elink-cn.com |
|
||||
* @since v1.0.0 2020-04-22 |
|
||||
*/ |
|
||||
@Component |
|
||||
public class StaffInfoRedis { |
|
||||
@Autowired |
|
||||
private RedisUtils redisUtils; |
|
||||
|
|
||||
/** |
|
||||
* @Description 查询工作人员的角色 |
|
||||
* @Param customerId |
|
||||
* @Param userId |
|
||||
* @author zxc |
|
||||
* @date 2021/6/15 3:20 下午 |
|
||||
*/ |
|
||||
public CustomerStaffInfoDTO getRole(String customerId, String staffId){ |
|
||||
String key = RedisKeys.getCustomerStaffInfoKey(customerId,staffId); |
|
||||
Map<String, Object> roleMap = redisUtils.hGetAll(key); |
|
||||
boolean empty = roleMap.isEmpty(); |
|
||||
if (!empty){ |
|
||||
CustomerStaffInfoDTO result = ConvertUtils.mapToEntity(roleMap, CustomerStaffInfoDTO.class); |
|
||||
return result; |
|
||||
} |
|
||||
return null; |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* @Description 放入缓存角色 |
|
||||
* @Param customerId |
|
||||
* @Param userId |
|
||||
* @Param dto |
|
||||
* @author zxc |
|
||||
* @date 2021/6/15 4:01 下午 |
|
||||
*/ |
|
||||
public void setRole(String customerId,String staffId,CustomerStaffInfoDTO dto){ |
|
||||
String key = RedisKeys.getCustomerStaffInfoKey(customerId,staffId); |
|
||||
Map<String, Object> map = BeanUtil.beanToMap(dto, false, true); |
|
||||
redisUtils.hMSet(key, map,NOT_EXPIRE); |
|
||||
} |
|
||||
|
|
||||
} |
|
@ -1,86 +0,0 @@ |
|||||
/** |
|
||||
* Copyright 2018 人人开源 https://www.renren.io
|
|
||||
* <p> |
|
||||
* This program is free software: you can redistribute it and/or modify |
|
||||
* it under the terms of the GNU General Public License as published by |
|
||||
* the Free Software Foundation, either version 3 of the License, or |
|
||||
* (at your option) any later version. |
|
||||
* <p> |
|
||||
* This program is distributed in the hope that it will be useful, |
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
* GNU General Public License for more details. |
|
||||
* <p> |
|
||||
* You should have received a copy of the GNU General Public License |
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||
*/ |
|
||||
|
|
||||
package com.epmet.redis; |
|
||||
|
|
||||
import cn.hutool.core.bean.BeanUtil; |
|
||||
import com.epmet.commons.tools.redis.RedisUtils; |
|
||||
import com.epmet.commons.tools.utils.ConvertUtils; |
|
||||
import com.epmet.dto.CustomerAgencyUserRoleDTO; |
|
||||
import org.springframework.beans.factory.annotation.Autowired; |
|
||||
import org.springframework.stereotype.Component; |
|
||||
|
|
||||
import java.util.Map; |
|
||||
|
|
||||
import static com.epmet.commons.tools.redis.RedisUtils.NOT_EXPIRE; |
|
||||
|
|
||||
/** |
|
||||
* 工作人员-角色关系表 |
|
||||
* |
|
||||
* @author generator generator@elink-cn.com |
|
||||
* @since v1.0.0 2020-04-22 |
|
||||
*/ |
|
||||
@Component |
|
||||
public class StaffRoleRedis { |
|
||||
@Autowired |
|
||||
private RedisUtils redisUtils; |
|
||||
|
|
||||
public void delete(Object[] ids) { |
|
||||
|
|
||||
} |
|
||||
|
|
||||
public void set(){ |
|
||||
|
|
||||
} |
|
||||
|
|
||||
public String get(String id){ |
|
||||
return null; |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* @Description 查询工作人员的角色 |
|
||||
* @Param customerId |
|
||||
* @Param userId |
|
||||
* @author zxc |
|
||||
* @date 2021/6/15 3:20 下午 |
|
||||
*/ |
|
||||
public CustomerAgencyUserRoleDTO getRole(String customerId, String userId){ |
|
||||
String key = "epmet:staffrole:"+customerId+":"+userId; |
|
||||
Map<String, Object> roleMap = redisUtils.hGetAll(key); |
|
||||
boolean empty = roleMap.isEmpty(); |
|
||||
if (!empty){ |
|
||||
CustomerAgencyUserRoleDTO result = ConvertUtils.mapToEntity(roleMap, CustomerAgencyUserRoleDTO.class); |
|
||||
return result; |
|
||||
} |
|
||||
return null; |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* @Description 放入缓存角色 |
|
||||
* @Param customerId |
|
||||
* @Param userId |
|
||||
* @Param dto |
|
||||
* @author zxc |
|
||||
* @date 2021/6/15 4:01 下午 |
|
||||
*/ |
|
||||
public void setRole(String customerId,String userId,CustomerAgencyUserRoleDTO dto){ |
|
||||
String key = "epmet:staffrole:"+customerId+":"+userId; |
|
||||
Map<String, Object> map = BeanUtil.beanToMap(dto, false, true); |
|
||||
redisUtils.hMSet(key, map,NOT_EXPIRE); |
|
||||
} |
|
||||
|
|
||||
} |
|
Loading…
Reference in new issue