16 changed files with 600 additions and 11 deletions
			
			
		@ -0,0 +1,26 @@ | 
				
			|||
package com.epmet.commons.tools.feign; | 
				
			|||
 | 
				
			|||
import com.epmet.commons.tools.constant.ServiceConstant; | 
				
			|||
import com.epmet.commons.tools.feign.fallback.CommonUserFeignClientFallBackFactory; | 
				
			|||
import com.epmet.commons.tools.redis.common.bean.CustomerStaffInfoCache; | 
				
			|||
import com.epmet.commons.tools.utils.Result; | 
				
			|||
import org.springframework.cloud.openfeign.FeignClient; | 
				
			|||
import org.springframework.web.bind.annotation.PathVariable; | 
				
			|||
import org.springframework.web.bind.annotation.PostMapping; | 
				
			|||
 | 
				
			|||
 | 
				
			|||
/** | 
				
			|||
 * @Description | 
				
			|||
 * @Author sun | 
				
			|||
 */ | 
				
			|||
@FeignClient(name = ServiceConstant.DATA_AGGREGATOR_SERVER, fallbackFactory = CommonUserFeignClientFallBackFactory.class) | 
				
			|||
public interface CommonUserFeignClient { | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * desc:根据工作人员Id 获取工作人员信息 | 
				
			|||
     * @param staffId | 
				
			|||
     * @return | 
				
			|||
     */ | 
				
			|||
    @PostMapping("/data/aggregator/epmetuser/getStaffInfo/{staffId}") | 
				
			|||
    Result<CustomerStaffInfoCache> getStaffInfo(@PathVariable("staffId") String staffId); | 
				
			|||
} | 
				
			|||
@ -0,0 +1,19 @@ | 
				
			|||
package com.epmet.commons.tools.feign.fallback; | 
				
			|||
 | 
				
			|||
import com.epmet.commons.tools.exception.ExceptionUtils; | 
				
			|||
import com.epmet.commons.tools.feign.CommonUserFeignClient; | 
				
			|||
import feign.hystrix.FallbackFactory; | 
				
			|||
import lombok.extern.slf4j.Slf4j; | 
				
			|||
import org.springframework.stereotype.Component; | 
				
			|||
 | 
				
			|||
@Component | 
				
			|||
@Slf4j | 
				
			|||
public class CommonUserFeignClientFallBackFactory implements FallbackFactory<CommonUserFeignClient> { | 
				
			|||
    private CommonUserFeignClientFallback fallback = new CommonUserFeignClientFallback(); | 
				
			|||
 | 
				
			|||
    @Override | 
				
			|||
    public CommonUserFeignClient create(Throwable cause) { | 
				
			|||
        log.error(String.format("FeignClient调用发生异常,异常信息:%s", ExceptionUtils.getThrowableErrorStackTrace(cause))); | 
				
			|||
        return fallback; | 
				
			|||
    } | 
				
			|||
} | 
				
			|||
@ -0,0 +1,23 @@ | 
				
			|||
package com.epmet.commons.tools.feign.fallback; | 
				
			|||
 | 
				
			|||
import com.epmet.commons.tools.constant.ServiceConstant; | 
				
			|||
import com.epmet.commons.tools.feign.CommonUserFeignClient; | 
				
			|||
import com.epmet.commons.tools.redis.common.bean.CustomerStaffInfoCache; | 
				
			|||
import com.epmet.commons.tools.utils.ModuleUtils; | 
				
			|||
import com.epmet.commons.tools.utils.Result; | 
				
			|||
import org.springframework.stereotype.Component; | 
				
			|||
 | 
				
			|||
/** | 
				
			|||
 * 调用政府端权限 | 
				
			|||
 * @Author wxz | 
				
			|||
 * @Description | 
				
			|||
 * @Date 2020/4/24 11:17 | 
				
			|||
 **/ | 
				
			|||
@Component | 
				
			|||
public class CommonUserFeignClientFallback implements CommonUserFeignClient { | 
				
			|||
 | 
				
			|||
    @Override | 
				
			|||
    public Result<CustomerStaffInfoCache> getStaffInfo(String staffId) { | 
				
			|||
        return  ModuleUtils.feignConError(ServiceConstant.DATA_AGGREGATOR_SERVER, "getStaffInfo", staffId); | 
				
			|||
    } | 
				
			|||
} | 
				
			|||
@ -0,0 +1,100 @@ | 
				
			|||
/** | 
				
			|||
 * 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.commons.tools.redis.common; | 
				
			|||
 | 
				
			|||
import cn.hutool.core.bean.BeanUtil; | 
				
			|||
import com.alibaba.fastjson.JSON; | 
				
			|||
import com.epmet.commons.tools.exception.RenException; | 
				
			|||
import com.epmet.commons.tools.feign.CommonUserFeignClient; | 
				
			|||
import com.epmet.commons.tools.redis.RedisKeys; | 
				
			|||
import com.epmet.commons.tools.redis.RedisUtils; | 
				
			|||
import com.epmet.commons.tools.redis.common.bean.CustomerStaffInfoCache; | 
				
			|||
import com.epmet.commons.tools.utils.ConvertUtils; | 
				
			|||
import com.epmet.commons.tools.utils.Result; | 
				
			|||
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 CustomerStaffRedis { | 
				
			|||
    @Autowired | 
				
			|||
    private RedisUtils redisUtils; | 
				
			|||
    @Autowired | 
				
			|||
    private CommonUserFeignClient commonUserFeignClient; | 
				
			|||
 | 
				
			|||
    //@PostConstruct
 | 
				
			|||
    public void init(){ | 
				
			|||
        CustomerStaffInfoCache role = this.getRole("45687aa479955f9d06204d415238f7cc", "9e37adcce6472152e6508a19d3683e02"); | 
				
			|||
        System.out.println(JSON.toJSONString(role)); | 
				
			|||
    } | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * @Description  查询工作人员的角色 | 
				
			|||
     * @Param customerId | 
				
			|||
     * @Param userId | 
				
			|||
     * @author zxc | 
				
			|||
     * @date 2021/6/15 3:20 下午 | 
				
			|||
     */ | 
				
			|||
    public CustomerStaffInfoCache getRole(String customerId, String staffId){ | 
				
			|||
        String key =  RedisKeys.getCustomerStaffInfoKey(customerId,staffId); | 
				
			|||
        Map<String, Object> roleMap = redisUtils.hGetAll(key); | 
				
			|||
        boolean empty = roleMap.isEmpty(); | 
				
			|||
        if (!empty){ | 
				
			|||
            CustomerStaffInfoCache result = ConvertUtils.mapToEntity(roleMap, CustomerStaffInfoCache.class); | 
				
			|||
            return result; | 
				
			|||
        } | 
				
			|||
        try { | 
				
			|||
            Result<CustomerStaffInfoCache> staffResult = commonUserFeignClient.getStaffInfo(staffId); | 
				
			|||
            if (staffResult == null || !staffResult.success()){ | 
				
			|||
                throw new RenException("获取工作人员信息失败"); | 
				
			|||
            } | 
				
			|||
            if (staffResult.getData() == null){ | 
				
			|||
                return null; | 
				
			|||
            } | 
				
			|||
            Map<String, Object> map = BeanUtil.beanToMap(staffResult.getData(), false, true); | 
				
			|||
            redisUtils.hMSet(key,map); | 
				
			|||
        } catch (Exception e) { | 
				
			|||
            e.printStackTrace(); | 
				
			|||
        } | 
				
			|||
        return null; | 
				
			|||
    } | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * @Description  放入缓存角色 | 
				
			|||
     * @Param customerId | 
				
			|||
     * @Param userId | 
				
			|||
     * @Param dto | 
				
			|||
     * @author zxc | 
				
			|||
     * @date 2021/6/15 4:01 下午 | 
				
			|||
     */ | 
				
			|||
    public void setRole(String customerId, String staffId, CustomerStaffInfoCache dto){ | 
				
			|||
        String key =  RedisKeys.getCustomerStaffInfoKey(customerId,staffId); | 
				
			|||
        Map<String, Object> map = BeanUtil.beanToMap(dto, false, true); | 
				
			|||
        redisUtils.hMSet(key, map,NOT_EXPIRE); | 
				
			|||
    } | 
				
			|||
 | 
				
			|||
} | 
				
			|||
@ -0,0 +1,62 @@ | 
				
			|||
package com.epmet.commons.tools.redis.common.bean; | 
				
			|||
 | 
				
			|||
import lombok.Data; | 
				
			|||
 | 
				
			|||
import java.io.Serializable; | 
				
			|||
import java.util.Map; | 
				
			|||
 | 
				
			|||
/** | 
				
			|||
 * @Author zxc | 
				
			|||
 * @DateTime 2021/6/15 10:00 上午 | 
				
			|||
 * @DESC | 
				
			|||
 */ | 
				
			|||
@Data | 
				
			|||
public class CustomerStaffInfoCache implements Serializable { | 
				
			|||
 | 
				
			|||
    private static final long serialVersionUID = -4078910245000135305L; | 
				
			|||
    /** | 
				
			|||
     * 工作人员所属组织ID | 
				
			|||
     */ | 
				
			|||
    private String agencyId; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 工作人员所属组织名称 | 
				
			|||
     */ | 
				
			|||
    private String agencyName; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 工作人员ID | 
				
			|||
     */ | 
				
			|||
    private String staffId; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 真实姓名 | 
				
			|||
     */ | 
				
			|||
    private String realName; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 性别0.未知,1男,2.女 | 
				
			|||
     */ | 
				
			|||
    private Integer gender; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 手机号-唯一键 | 
				
			|||
     */ | 
				
			|||
    private String mobile; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 头像 | 
				
			|||
     */ | 
				
			|||
    private String headPhoto; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 角色map key为角色key value 为角色名称 | 
				
			|||
     */ | 
				
			|||
    private Map<String,String> roleMap; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 工作人员所在网格及部门列表 | 
				
			|||
     */ | 
				
			|||
    private StaffOrgsCache orgInfo; | 
				
			|||
 | 
				
			|||
} | 
				
			|||
@ -0,0 +1,54 @@ | 
				
			|||
/** | 
				
			|||
 * 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.commons.tools.redis.common.bean; | 
				
			|||
 | 
				
			|||
import lombok.Data; | 
				
			|||
 | 
				
			|||
import java.io.Serializable; | 
				
			|||
import java.util.List; | 
				
			|||
 | 
				
			|||
/** | 
				
			|||
 * desc: 工作人员所属的组织关系 | 
				
			|||
 * @date 2021/8/19 10:07 上午 | 
				
			|||
 */ | 
				
			|||
@Data | 
				
			|||
public class StaffOrgsCache implements Serializable { | 
				
			|||
 | 
				
			|||
	private static final long serialVersionUID = 1L; | 
				
			|||
 | 
				
			|||
	/** | 
				
			|||
	 * 所属组织的上级组织 | 
				
			|||
	 */ | 
				
			|||
	private IdAndName parentAgency; | 
				
			|||
 | 
				
			|||
	/** | 
				
			|||
	 * 所属网格列表 | 
				
			|||
	 */ | 
				
			|||
	private List<IdAndName> gridList; | 
				
			|||
 | 
				
			|||
	/** | 
				
			|||
	 * 所属部门 | 
				
			|||
	 */ | 
				
			|||
	private List<IdAndName> deptList; | 
				
			|||
 | 
				
			|||
	@Data | 
				
			|||
	class IdAndName { | 
				
			|||
		private String id; | 
				
			|||
		private String name; | 
				
			|||
	} | 
				
			|||
} | 
				
			|||
@ -0,0 +1,63 @@ | 
				
			|||
package com.epmet.dataaggre.dto.epmetuser.result; | 
				
			|||
 | 
				
			|||
import com.epmet.commons.tools.redis.common.bean.StaffOrgsCache; | 
				
			|||
import lombok.Data; | 
				
			|||
 | 
				
			|||
import java.io.Serializable; | 
				
			|||
import java.util.Map; | 
				
			|||
 | 
				
			|||
/** | 
				
			|||
 * @Author zxc | 
				
			|||
 * @DateTime 2021/6/15 10:00 上午 | 
				
			|||
 * @DESC | 
				
			|||
 */ | 
				
			|||
@Data | 
				
			|||
public class CustomerStaffResultDTO implements Serializable { | 
				
			|||
 | 
				
			|||
    private static final long serialVersionUID = 6989603307304337912L; | 
				
			|||
    /** | 
				
			|||
     * 工作人员所属组织ID | 
				
			|||
     */ | 
				
			|||
    private String agencyId; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 工作人员所属组织名称 | 
				
			|||
     */ | 
				
			|||
    private String agencyName; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 工作人员ID | 
				
			|||
     */ | 
				
			|||
    private String staffId; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 真实姓名 | 
				
			|||
     */ | 
				
			|||
    private String realName; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 性别0.未知,1男,2.女 | 
				
			|||
     */ | 
				
			|||
    private Integer gender; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 手机号-唯一键 | 
				
			|||
     */ | 
				
			|||
    private String mobile; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 头像 | 
				
			|||
     */ | 
				
			|||
    private String headPhoto; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 角色map key为角色key value 为角色名称 | 
				
			|||
     */ | 
				
			|||
    private Map<String,String> roleMap; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 工作人员所在网格及部门列表 | 
				
			|||
     */ | 
				
			|||
    private StaffOrgsCache orgInfo; | 
				
			|||
 | 
				
			|||
} | 
				
			|||
@ -0,0 +1,62 @@ | 
				
			|||
package com.epmet.dto; | 
				
			|||
 | 
				
			|||
import lombok.Data; | 
				
			|||
 | 
				
			|||
import java.io.Serializable; | 
				
			|||
import java.util.Map; | 
				
			|||
 | 
				
			|||
/** | 
				
			|||
 * @Author zxc | 
				
			|||
 * @DateTime 2021/6/15 10:00 上午 | 
				
			|||
 * @DESC | 
				
			|||
 */ | 
				
			|||
@Data | 
				
			|||
public class CustomerStaffInfoDTO implements Serializable { | 
				
			|||
 | 
				
			|||
    private static final long serialVersionUID = -4078910245000135305L; | 
				
			|||
    /** | 
				
			|||
     * 工作人员所属组织ID | 
				
			|||
     */ | 
				
			|||
    private String agencyId; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 工作人员所属组织名称 | 
				
			|||
     */ | 
				
			|||
    private String agencyName; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 工作人员ID | 
				
			|||
     */ | 
				
			|||
    private String staffId; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 真实姓名 | 
				
			|||
     */ | 
				
			|||
    private String realName; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 性别0.未知,1男,2.女 | 
				
			|||
     */ | 
				
			|||
    private Integer gender; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 手机号-唯一键 | 
				
			|||
     */ | 
				
			|||
    private String mobile; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 头像 | 
				
			|||
     */ | 
				
			|||
    private String headPhoto; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 角色map key为角色key value 为角色名称 | 
				
			|||
     */ | 
				
			|||
    private Map<String,String> roleMap; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 工作人员所在网格及部门列表 | 
				
			|||
     */ | 
				
			|||
    private StaffOrgsDTO orgInfo; | 
				
			|||
 | 
				
			|||
} | 
				
			|||
@ -0,0 +1,54 @@ | 
				
			|||
/** | 
				
			|||
 * 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.dto; | 
				
			|||
 | 
				
			|||
import lombok.Data; | 
				
			|||
 | 
				
			|||
import java.io.Serializable; | 
				
			|||
import java.util.List; | 
				
			|||
 | 
				
			|||
/** | 
				
			|||
 * desc: 工作人员所属的组织关系 | 
				
			|||
 * @date 2021/8/19 10:07 上午 | 
				
			|||
 */ | 
				
			|||
@Data | 
				
			|||
public class StaffOrgsDTO implements Serializable { | 
				
			|||
 | 
				
			|||
	private static final long serialVersionUID = 1L; | 
				
			|||
 | 
				
			|||
	/** | 
				
			|||
	 * 所属组织的上级组织 | 
				
			|||
	 */ | 
				
			|||
	private IdAndName parentAgency; | 
				
			|||
 | 
				
			|||
	/** | 
				
			|||
	 * 所属网格列表 | 
				
			|||
	 */ | 
				
			|||
	private List<IdAndName> gridList; | 
				
			|||
 | 
				
			|||
	/** | 
				
			|||
	 * 所属部门 | 
				
			|||
	 */ | 
				
			|||
	private List<IdAndName> deptList; | 
				
			|||
 | 
				
			|||
	@Data | 
				
			|||
	class IdAndName { | 
				
			|||
		private String id; | 
				
			|||
		private String name; | 
				
			|||
	} | 
				
			|||
} | 
				
			|||
@ -0,0 +1,75 @@ | 
				
			|||
/** | 
				
			|||
 * 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); | 
				
			|||
    } | 
				
			|||
 | 
				
			|||
} | 
				
			|||
					Loading…
					
					
				
		Reference in new issue