---
title: "2. 组织人事字段解密"
docId: "952443847496081408"
source: "https://weapp.eteams.cn/build/techdoc/wdoc/index.html#/public/repository/91f5067f-775e-48f4-93a2-ce84ca0b9c2e/doc/952443847496081408"
---
1. 接口

```java
com.weaver.common.hrm.manage.datasecurity.HrmCommDsDataSecurityHandler#decriptEmployeeSysField
```

- 入参说明

| 参数 | 类型 | 说明 |
| --- | --- | --- |
| beans | List<T> | 需要解密的数据，任意bean |
| tenantKey | String | 租户key |
| getSetPairMap | Map<HrmEncryptFieldType,         Pair<Function<T, String>,BiConsumer<T, String>>> | 需要解密字段描述 |

- HrmEncryptFieldType说明
  
    1. mobile 手机
    2. email 邮箱
    3. telephone 电话
    4. resp_desc 职责描述
    5. other_telephone 其他电话
    6. fax 传真
    7. office 办公室
- Pair<Function<T, String>,BiConsumer<T, String>>说明
  
  > 左值：bean中解密字段getter的Function
  > 
  > 右值：bean中解密字段setter的BiConsumer
- 调用示例：

```java
public WeaResult check(Map<String, Object> params) {
        String tenantKey = Util.null2String(params.get("tenantKey"));
        long id = Util.getLongValue(params.get("id") + "");
        HrmComInfoCacheHandler comInfoCacheHandler = I18nContextUtil.getBean(HrmComInfoCacheHandler.class);
        HrmEmployeeComInfo info = comInfoCacheHandler.getCacheById(HrmEmployeeComInfo.class, id);
        HrmCommDsDataSecurityHandler dataSecurityHandler = I18nContextUtil.getBean(HrmCommDsDataSecurityHandler.class);
        List<HrmEmployeeComInfo> hrmEmployeeComInfos = Lists.newArrayList(info);
        dataSecurityHandler.decriptEmployeeSysField(hrmEmployeeComInfos,
                tenantKey, ImmutableMapUtil.of(
                        HrmEncryptFieldType.mobile, Pair.of(HrmEmployeeComInfo::getMobile, HrmEmployeeComInfo::setMobile),
                        HrmEncryptFieldType.email, Pair.of(HrmEmployeeComInfo::getEmail, HrmEmployeeComInfo::setEmail)
                )
        );

        return WeaResult.success(info); // info中手机、邮箱是解密成功的内容
    }
```
