package com.hxhq.business.utils.lang;

import com.hxhq.business.utils.JctUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;

/**
 * @author tanfei
 */
public class ZcgJcnrUtil {
    private static final Logger logger = LoggerFactory.getLogger(ZcgJcnrUtil.class.getName());
    private static HashMap<String,String> mapLang=new HashMap<>();
    static {
        mapLang.put("关联药剂","Contained Substance");
        mapLang.put("钥匙发放","Issue Key");
        mapLang.put("钥匙归还","Return Key");
        mapLang.put("批量钥匙归还","Batch Return");
        mapLang.put("接收人","Recipient");
        mapLang.put("发放人","Issuer");
        mapLang.put("钥匙1归还人","Key 1 Returner");
        mapLang.put("钥匙2归还人","Key 2 Returner");
        mapLang.put("钥匙1领取人","Key 1 Recipient");
        mapLang.put("钥匙2领取人","Key 2 Recipient");

        mapLang.put("稽查轨迹","Track Record");
        mapLang.put("签名信息","Signature information");
    }

    public static void main(String[] args) {
        Map<String, String> formData = new LinkedHashMap<>();
        formData.put("申请备注", "1111");
        formData.put("审核备注", "22");
        logger.info(getJcnrEn(formData));
    }
    /**
     * 获取英文
     * @param name
     * @return
     */
    public static String getEn(String name) {
        return   mapLang.get(name);
    }


    /**
     * 稽查名称英文
     * @param map
     * @return
     */
    public static String getJcnrEn(Map<String, String> map) {
        Map<String, String> result =new LinkedHashMap<>();
        for (Map.Entry<String, String> entry : map.entrySet()) {
            result.put(mapLang.get(entry.getKey()),entry.getValue());
        }
        return JctUtil.formatStr(result);
    }

    /**
     * 稽查名称英文
     * @param map
     * @return
     */
    public static Map<String, String> getMapEn(Map<String, String> map) {
        Map<String, String> result =new LinkedHashMap<>();
        for (Map.Entry<String, String> entry : map.entrySet()) {
            result.put(mapLang.get(entry.getKey()),entry.getValue());
        }
        return result;
    }

}
