package com.engine.organization.wrapper;

import com.engine.common.util.ServiceUtil;
import com.engine.organization.service.JclOrgService;
import com.engine.organization.service.impl.JclOrgServiceImpl;
import com.engine.organization.util.OrganizationWrapper;
import org.apache.commons.lang3.StringUtils;
import weaver.hrm.User;

/**
 * @author:dxfeng
 * @createTime: 2022/08/02
 * @version: 1.0
 */
public class JclOrgWrapper extends OrganizationWrapper {
    private JclOrgService getJclOrgService(User user) {
        return ServiceUtil.getService(JclOrgServiceImpl.class, user);
    }


    public String getEcOrgId(String jclId, String type) {
        if (StringUtils.isAnyBlank(jclId, type)) {
            return null;
        }
        //switch (type) {
        //    case "1":
        //        return EcHrmRelationUtil.getEcCompanyId(jclId);
        //    case "2":
        //        return EcHrmRelationUtil.getEcDepartmentId(jclId);
        //    case "3":
        //    default:
        //        return "";
        //}
        return jclId;
    }

    public String getJclOrgId(String ecId, String type) {
        if (StringUtils.isAnyBlank(ecId, type)) {
            return null;
        }
        //String jclOrgId = "";
        //switch (type) {
        //    case "1":
        //        CompPO jclCompanyId = EcHrmRelationUtil.getJclCompanyId(ecId);
        //        if (null != jclCompanyId) {
        //            jclOrgId = jclCompanyId.getId().toString();
        //        }
        //        break;
        //    case "2":
        //        DepartmentPO jclDepartmentId = EcHrmRelationUtil.getJclDepartmentId(ecId);
        //        if (null != jclDepartmentId) {
        //            jclOrgId = jclDepartmentId.getId().toString();
        //        }
        //    case "3":
        //    default:
        //        break;
        //}
        return ecId;
    }

    public void syncCusFieldData(String id) {
        // CusFieldDataTrigger.run(StringUtils.isNotBlank(id) ? Long.parseLong(id) : null);
    }

    public void supplementResourceInfo(Integer userId) {
        getJclOrgService(user).supplementResourceInfo(userId);
    }
}
