package nckd.jimin.jyyy.hr.hrmp.hrpi.explugin;

import kd.bos.dataentity.utils.ObjectUtils;
import kd.bos.permission.model.UserParam;
import kd.hr.hbp.business.service.ext.ISyncUserService;
import kd.hr.hbp.common.ext.SyncParamModel;

import java.util.Map;

public class SyncUserServiceEx implements ISyncUserService {
    /**
     * 替换生成平台用户的用户名为人员工号
     * SyncParamModel的属性 UserParam，是同步到平台的入参
     * UserParam.getUserParam()是参数的具体入参，修改dataMap 的值put替换标品的就可以 SyncParamModel 里面有自然人信息可以用来查询
     * @param syncParamModel
     */
    @Override
    public void updateSyncUserParam(SyncParamModel syncParamModel) {
        UserParam userParam = syncParamModel.getUserParam();
        Map<String, Object> dataMap = userParam.getDataMap();
        if(!ObjectUtils.isEmpty(dataMap)) {
            String number = syncParamModel.getPersonDy().getString("number");   //人员工号
            dataMap.put("username", number);
        }
    }
}