34 changed files with 1030 additions and 21 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,19 @@ |
|||
package com.epmet.dataaggre.dto.epmetuser.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Description |
|||
* @Author zhaoqifeng |
|||
* @Data 2021/8/19 14:06 |
|||
*/ |
|||
@Data |
|||
public class RoleUsersFormDTO implements Serializable { |
|||
private static final long serialVersionUID = -7732382052293191415L; |
|||
@NotBlank(message = "角色ID不能为空") |
|||
private String roleId; |
|||
private String customerId; |
|||
} |
@ -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,23 @@ |
|||
package com.epmet.dataaggre.dto.epmetuser.result; |
|||
|
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Description |
|||
* @Author zhaoqifeng |
|||
* @Date 2021/8/19 14:16 |
|||
*/ |
|||
@NoArgsConstructor |
|||
@Data |
|||
public class RoleListResultDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = -9030492894290373999L; |
|||
private String roleId; |
|||
private String description; |
|||
private String roleName; |
|||
private String roleKey; |
|||
private Integer staffNum; |
|||
} |
@ -0,0 +1,25 @@ |
|||
package com.epmet.dataaggre.dto.epmetuser.result; |
|||
|
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @Description |
|||
* @Author zhaoqifeng |
|||
* @Date 2021/8/19 14:06 |
|||
*/ |
|||
@NoArgsConstructor |
|||
@Data |
|||
public class RoleUsersResultDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 7109847663910323991L; |
|||
private String staffId; |
|||
private String name; |
|||
private String headPhoto; |
|||
private String orgName; |
|||
private String gender; |
|||
private List<String> roles; |
|||
} |
@ -0,0 +1,19 @@ |
|||
package com.epmet.dataaggre.dto.govorg; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Description |
|||
* @Author zhaoqifeng |
|||
* @Date 2021/8/19 14:21 |
|||
*/ |
|||
@Data |
|||
public class OrgDTO implements Serializable { |
|||
private static final long serialVersionUID = -3659371769044867016L; |
|||
private String orgId; |
|||
private String orgName; |
|||
private String orgType; |
|||
private Integer staffNum; |
|||
} |
@ -0,0 +1,39 @@ |
|||
package com.epmet.dataaggre.dto.govorg; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Description |
|||
* @Author zhaoqifeng |
|||
* @Date 2021/8/19 14:50 |
|||
*/ |
|||
@Data |
|||
public class ReceiverDTO implements Serializable { |
|||
private static final long serialVersionUID = 7756394210796777416L; |
|||
/** |
|||
* ID |
|||
*/ |
|||
private String staffId; |
|||
/** |
|||
* 姓名 |
|||
*/ |
|||
private String staffName; |
|||
/** |
|||
* 头像 |
|||
*/ |
|||
private String headPhoto; |
|||
/** |
|||
* 所属组织目前显示两级 |
|||
*/ |
|||
private String orgName; |
|||
/** |
|||
* 1:已读;0:未读 |
|||
*/ |
|||
private String readFlag; |
|||
/** |
|||
* 1男2女0未知 |
|||
*/ |
|||
private String gender; |
|||
} |
@ -0,0 +1,22 @@ |
|||
package com.epmet.dataaggre.dto.govorg.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @author Administrator |
|||
*/ |
|||
@Data |
|||
public class ReceiversFormDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = -1588067365064394258L; |
|||
@NotBlank(message = "消息ID不能为空") |
|||
private String infoId; |
|||
private Integer pageNo = 1; |
|||
private Integer pageSize = 10; |
|||
private String readFlag; |
|||
|
|||
|
|||
} |
@ -0,0 +1,18 @@ |
|||
package com.epmet.dataaggre.dto.govorg.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Description |
|||
* @Author zhaoqifeng |
|||
* @Date 2021/8/19 14:18 |
|||
*/ |
|||
@Data |
|||
public class SubOrgFormDTO implements Serializable { |
|||
private static final long serialVersionUID = -3651225675593357002L; |
|||
@NotBlank(message = "组织ID不能为空") |
|||
private String agencyId; |
|||
} |
@ -0,0 +1,19 @@ |
|||
package com.epmet.dataaggre.dto.govorg.result; |
|||
|
|||
import com.epmet.dataaggre.dto.govorg.ReceiverDTO; |
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author Administrator |
|||
*/ |
|||
@NoArgsConstructor |
|||
@Data |
|||
public class ReceiversResultDTO implements Serializable { |
|||
private static final long serialVersionUID = 255217078396991037L; |
|||
private Integer total; |
|||
private List<ReceiverDTO> dataList; |
|||
} |
@ -0,0 +1,20 @@ |
|||
package com.epmet.dataaggre.dto.govorg.result; |
|||
|
|||
import com.epmet.dataaggre.dto.govorg.OrgDTO; |
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @Description |
|||
* @Author zhaoqifeng |
|||
* @Date 2021/8/19 14:20 |
|||
*/ |
|||
@Data |
|||
public class SubOrgResultDTO implements Serializable { |
|||
private static final long serialVersionUID = 3080780461845963616L; |
|||
private List<OrgDTO> subAgencyList; |
|||
private List<OrgDTO> departmentList; |
|||
private List<OrgDTO> gridList; |
|||
} |
@ -0,0 +1,40 @@ |
|||
package com.epmet.dataaggre.controller; |
|||
|
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.commons.tools.validator.ValidatorUtils; |
|||
import com.epmet.dataaggre.dto.govorg.form.ReceiversFormDTO; |
|||
import com.epmet.dataaggre.dto.govorg.result.ReceiversResultDTO; |
|||
import com.epmet.dataaggre.service.epmetmessage.EpmetMessageService; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import javax.annotation.Resource; |
|||
|
|||
/** |
|||
* @Description |
|||
* @Author zhaoqifeng |
|||
* @Date 2021/8/19 14:45 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("info") |
|||
public class InfoController { |
|||
@Resource |
|||
private EpmetMessageService epmetMessageService; |
|||
|
|||
/** |
|||
* @Description 已读未读列表 |
|||
* @Param formDTO |
|||
* @Return {@link Result<ReceiversResultDTO>} |
|||
* @Author zhaoqifeng |
|||
* @Date 2021/8/19 14:49 |
|||
*/ |
|||
@PostMapping("receivers") |
|||
public Result<ReceiversResultDTO> receivers(@RequestBody ReceiversFormDTO formDTO) { |
|||
ValidatorUtils.validateEntity(formDTO); |
|||
ReceiversResultDTO result = epmetMessageService.getReceiverList(formDTO); |
|||
return new Result<ReceiversResultDTO>().ok(result); |
|||
|
|||
} |
|||
} |
@ -0,0 +1,18 @@ |
|||
package com.epmet.dataaggre.service.epmetmessage; |
|||
|
|||
import com.epmet.dataaggre.dto.govorg.form.ReceiversFormDTO; |
|||
import com.epmet.dataaggre.dto.govorg.result.ReceiversResultDTO; |
|||
|
|||
/** |
|||
* @author Administrator |
|||
*/ |
|||
public interface EpmetMessageService { |
|||
/** |
|||
* @Description 获取已读未读人员列表 |
|||
* @Param formDTO |
|||
* @Return {@link ReceiversResultDTO} |
|||
* @Author zhaoqifeng |
|||
* @Date 2021/8/19 14:56 |
|||
*/ |
|||
ReceiversResultDTO getReceiverList(ReceiversFormDTO formDTO); |
|||
} |
@ -0,0 +1,32 @@ |
|||
package com.epmet.dataaggre.service.epmetmessage.impl; |
|||
|
|||
import com.epmet.commons.dynamic.datasource.annotation.DataSource; |
|||
import com.epmet.dataaggre.constant.DataSourceConstant; |
|||
import com.epmet.dataaggre.dto.govorg.form.ReceiversFormDTO; |
|||
import com.epmet.dataaggre.dto.govorg.result.ReceiversResultDTO; |
|||
import com.epmet.dataaggre.service.epmetmessage.EpmetMessageService; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
/** |
|||
* @Description |
|||
* @Author zhaoqifeng |
|||
* @Date 2021/8/19 15:23 |
|||
*/ |
|||
@Service |
|||
@DataSource(DataSourceConstant.EPMET_MESSAGE) |
|||
@Slf4j |
|||
public class EpmetMessageServiceImpl implements EpmetMessageService { |
|||
/** |
|||
* @param formDTO |
|||
* @Description 获取已读未读人员列表 |
|||
* @Param formDTO |
|||
* @Return {@link ReceiversResultDTO} |
|||
* @Author zhaoqifeng |
|||
* @Date 2021/8/19 14:56 |
|||
*/ |
|||
@Override |
|||
public ReceiversResultDTO getReceiverList(ReceiversFormDTO formDTO) { |
|||
return null; |
|||
} |
|||
} |
@ -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