package com.dxhy.erp.utils;

import org.apache.commons.lang.StringUtils;

/**
 * @author dxhy
 */
public class CompareNameUtils {

    /**
     * 购方名称、原名称与机构对比
     * 
     * @param gfName
     * @param orgName
     * @param extfl
     * @return
     */
    public static Boolean compareName(String gfName, String orgName, String extfl) {
        return (StringUtils.isNotBlank(gfName) && StringUtils.isNotBlank(orgName)
            && changeBrackets(gfName).equals(changeBrackets(orgName)))
            || (StringUtils.isNotBlank(gfName) && StringUtils.isNotBlank(extfl)
                && changeBrackets(gfName).equals(changeBrackets(extfl)));
    }

    /**
     * 购方名称与机构对比
     * 
     * @param gfName
     * @param orgName
     * @return
     */
    public static Boolean compareName(String gfName, String orgName) {
        return StringUtils.isNotBlank(gfName) && StringUtils.isNotBlank(orgName)
            && changeBrackets(gfName).equals(changeBrackets(orgName));
    }

    /**
     * 统一中英文括号
     * 
     * @param paramString
     * @return
     */
    public static String changeBrackets(String paramString) {
        return paramString.replace("（", "(").replace("(", "(").replace("）", ")").replace(")", ")");
    }

}
