package com.iformall.common;


import java.text.MessageFormat;

/**
 * @author chenkx
 * @date 2017-12-28.
 */
public enum ErrorCode{

    /**
     * 系统级别
     * 1000-1999
     */
    SYS_SERVER_ERROR(1000, "系统繁忙"),
    SYS_PARAMETER_ERROR(1001, "参数不合法"),
    SYS_PARAMETER_NOT_NULL(1002, "参数不能为空"),
    SYS_PARAMETER_TYPE_ERROR(1003, "参数类型异常"),
    SYS_PARAMETER_CAST_ERROR(1004, "参数转换异常"),
    SYS_PARAMETER_EMPTY_ERROR(1005, "参数转换异常"),
    SYS_BEAN_EMPTY_PROPERTY_ERROR(1006, "实体转换异常"),
    SYS_MEDIATYPE_NOT_SUPPORT(1007, "不支持的媒体类型"),
    SYS_NULLPOINTER_ERROR(1008, "空指针异常"),
    SYS_METHOD_NOT_SUPPORT(1009, "不支持的请求类型"),
    SYS_CLASSCAST_ERROR(1010, "类型转换异常"),
    SYS_NUMBER_FORMAT_ERROR(1011, "数字转化异常"),
    SYS_EXTEND_JSON_ERROR(1012, "JSON格式异常"),
    SYS_REPEAT_SUBMIT_EXCEPTION(1013, "请勿重复操作"),
    REPORT_TYPE_UNKNOWN(1014, "不支持的报表类型"),
    SYS_MCH_NOT_FOUND(1015, "微信商户号未找到"),
    SYS_AUTH_ERROR(1016, "该用户没有权限访问"),

    /**
     * 菜单
     */
    MENU_NAME_EMPTY(1020, "菜单名称不能为空"),
    MENU_PARENT_EMPTY(1021, "上级菜单不能为空"),
    MENU_URL_EMPTY(1022, "菜单URL不能为空"),
    MENU_PARENT_NOT_CATEGORY(1023, "上级菜单只能为目录类型"),
    MENU_PARENT_NOT_MENU(1024, "上级菜单只能为菜单类型"),
    MENU_SYS_NOT_DEL(1025, "系统菜单, 不能删除"),
    MENU_CHILD_NOT_DEL(1026, "请先删除子菜单或按钮"),
    /**
     * 数据库
     */
    DB_FAIL(1045, "数据库访问出错"),

    /**
     * 网络
     */
    TOO_MANY_REQUEST(1050, "太多的请求访问"),

    LOGIN_DENIED(1051, "登录失败"),
    NET_TOKEN_INVALID(1052, "TOKEN无效"),
    NET_TOKEN_EMPTY(1053, "TOKEN不能为空"),

    /**
     * 第三方开发者
     */
    DEV_ID_NOT_FOUND(1200, "未知的第三方开发者"),
    DEV_ID_IS_DISABLED(1201, "第三方开发者已被禁用"),
    DEV_ID_REQ_KEY_IS_NULL(1202, "开发者request key未设置"),
    DEV_ID_RES_KEY_IS_NULL(1203, "开发者response Key未设置"),
    DEV_ID_SIGN_ERR(1204, "开发者签名错误"),


    /**
     * 业务级别
     */
    /**
     * 用户2000-2099
     */
    USER_PASSWD_ERR(1987, "用户名或者密码错误"),
    USER_IS_MULTI(1988, "有多个手机号，请联系富茂管理员"),
    USER_IS_NOT_MEMBER(1989,"用户还未授权手机号成为会员"),
    USER_PHONE_IS_NOT_FOUND(1990,"手机号不存在"),
    USER_DEL_SELF(1991,"用户删除自己"),
    USER_NOT_ADMIN(1992,"用户非超管"),
    USER_NO_PERMISSION(1993,"用户无此权限"),
    USER_USE_ROLE(1994,"用户使用此角色"),
    USER_IS_EMPTY(2000, "用户不存在"),
    PASSWORD_ERROR(2001, "密码错误"),
    USER_IS_LOCKED(2003, "用户已经被禁用不能登录，请与管理员联系"),
    NEW_USER_FAILD(2004, "创建新用户失败"),
    BUSER_NOT_IN_APP(2005, "用户不是此app用户"),
    KAPCHA_NOT_VALID(2006, "验证码已失效"),
    KAPCHA_NOT_EQUAL(2007, "验证码不正确"),
    USER_NAME_IS_FOUND(2008,"用户名已存在"),
    USER_PHONE_IS_FOUND(2009,"手机号已存在"),
    MEMBER_IS_LOCKED(2010, "当前会员已被锁定"),

    /**
     * 商场/商户
     */
    MALL_INFO_NOT_FOUND(2010, "商场信息没找到"),
    MERCHANT_INFO_NOT_FOUND(2011, "商户信息没找到"),
    MERCHANT_INFO_NOT_EQUAL(2012, "商户信息不对应"),
    MERCHANT_INFO_NOT_VALID(2013, "商户信息禁用"),
    MERCHANT_REPORT_DATE_NOT_VALID(999, "上报日期大于当天"),
    MERCHANT_NAME_IS_FOUND(2014, "商户名称已存在"),
    MERCHANT_CAR_NOT_DEL(2015, "停车商户不能被删除"),
    MERCHANT_BUSER_NOT_VALID(2016, "商户用户不存在或已被禁用"),
    /**
     * 券
     */
    COUPON_IS_EMPTY(2020, "此券不存在"),
    COUPON_IS_NOT_FREE(2021, "此券不免费"),
    COUPON_IS_TAKE_OFF(2022, "此券已作废"),
    COUPON_IS_EXPIRED(2023, "此券已过期"),
    COUPON_IS_SELL_OUT(2024, "此券已售罄"),

    COUPON_TYPE_IS_NOT_ACTIVE(2025, "此券不能用于主动领取"),
    COUPON_TYPE_IS_NOT_PASSIVE(2026, "此券不能用于定向投放"),
    COUPON_CHANNEL_IS_EXISTED(2027, "此券已投放过"),
    COUPON_SEND_IS_EXISTED(2028, "此券已经添加到该渠道"),
    COUPON_SEND_IS_INVALID(2029, "此发券渠道不存在"),
    COUPON_SEND_IS_INVALID_TIME(2030, "投放的时间超出劵的有效期"),
    COUPON_CHANNEL_IS_TAKE_OFF(2031, "此券已下架"),
    COUPON_MERCHANT_NOT_FOUND(2032, "卡券关联商户未发现"),
    COUPON_CHANNEL_IS_NOT_STARTED(2033, "此券活动未开始"),
    COUPON_CHANNEL_IS_END(2033, "此券活动已结束"),
    COUPON_STOCK_ERR(2034, "券库存设置错误"),
    COUPON_VALID_DATE_ERR(2035, "券有效期设置错误"),
    COUPON_STOCK_VALID_DATE_SETTING_ERR(2036, "券库存有效期未修改"),
    COUPON_STOCK_DATE_NO_CAR(2037, "券库存不支持停车券"),

    COUPON_SCORE_NOT_IN_RANGE(2038, "您的成长值/等级与要求不符"),
    COUPON_STOCK_NO_EQUAL_ERR(2039, "券库存设置要保证同增同减"),
    COUPON_STOCK_ENDTIME_ERR(2043, "抱歉，有效期截止时间只能增加不能减少！"),
    COUPON_STOCK_INV_ERR(20144, "抱歉，库存只能增加不能减少！"),

    PUSH_LIMIT_UP_TO_1DAYLIMIT(2040, "此用户一天内发券到达疲劳度限制"),
    PUSH_LIMIT_UP_TO_COUPONLIMIT(2041, "此用户发此券到达疲劳度限制"),
    PUSH_LIMIT_NOT_INRANG(2042, "不在疲劳度允许的时间段"),

    COUPON_ONLY_FOR_NEW_MEMBER(2044, "您已经参加过新会员活动"),
    COUPON_ALREADY_IN_NEW_MEMBER(2045, "您正在参加别的新会员活动"),
    COUPON_VALID_NOT_SUPPORTED(2046, "券类型不支持"),
    /**
     * 车流 2040
     */
    CAR_PARK_NOT_FOUND(2049, "车场未找到"),
    CAR_VENDOR_NOT_SUPPORT(2050, "不支持的停车厂家"),

    ETCP_LOGIN_FAIL(2051, "ETCP共同登录失败"),
    ETCP_BIND_FAIL(2052, "ETCP绑车牌失败"),
    ETCP_UNBIND_FAIL(2053, "ETCP解绑车牌失败"),
    ETCP_STOP_FEE_FAIL(2054, "ETCP停车费失败"),
    ETCP_QUAN_TEMP_FAIL(2055, "ETCP优免券模板失败"),
    ETCP_QUAN_SEND_FAIL(2056, "ETCP优免券发放失败"),
    ETCP_CMD_FAIL(2057, "ETCP网络异常"),

    TJD_BIND_FAIL(2060,"TJD绑车牌失败"),
    TJD_UNBIND_FAIL(2061,"TJD解绑车牌失败"),
    TJD_STOP_FEE_FAIL(2062, "TJD停车费失败"),
    TJD_DEDUCE_FEE_FAIL(2063, "TJD停车费抵扣失败"),


    /**
     * 游戏
     */
    GAME_NOT_FOUND(2070, "游戏未找到"),

    /**
     * 订单
     */
    REMAIN_IS_EMPTY(3000, "库存不足"),
    ORDER_IS_LIMITED(3001, "购买超限"),
    ORDER_IS_FAIL(3002, "订单失败"),
    ORDER_IS_NOT_FIND(3003, "订单不存在"),
    ORDER_IS_NOT_PAY(3004, "订单已不能进行支付"),
    ORDER_SAVE_ERR(3005,"订单保存失败"),
    ORDER_UPDATE_ERR(3006,"订单更新失败"),
    REMAIN_BACK_FAIL(3007, "库存恢复失败"),
    ORDER_HAD_PAY(3008, "订单已支付"),
    ORDER_HAD_CANCEL(3009, "订单已取消"),
    ORDER_PRESS_IS_OVERTIME(3010, "砍价已过期"),
    ORDER_PRESS_IS_COMPLETE(3011, "砍价已完成"),
    ORDER_UNPAID(3012, "您有未支付的订单"),
    ORDER_USER_NOT_MATCH(2013, "订单用户不匹配"),
    ORDER_COUPON_CHANNEL_NOT_MATCH(2014, "订单渠道不匹配"),
    ORDER_COUPON_NOT_MATCH(2015, "订单券不匹配"),

    /**
     * 卡券
     */
    COUPON_ORDER_SAVE_ERR(3999, "卡券保存失败"),
    COUPON_ORDER_IS_NULL(4000, "卡券不存在"),
    COUPON_ORDER_IS_USED(4001, "卡券已核销"),
    COUPON_ORDER_IS_OVER_TIME(4002, "卡券已过期"),
    COUPON_ORDER_IS_INVALID(4003, "卡券已经作废"),
    COUPON_ORDER_BUSER_IS_NULL(4004, "卡券B端用户不存在"),
    COUPON_ORDER_MERANT_IS_NULL(4005, "卡券商户不存在"),
    COUPON_ORDER_IS_EARLIER_THAN_VALIDDATE(4006, "卡券使用期还未开始"),
    COUPON_ORDER_IS_LATER_THAN_VALIDDATE(4007, "卡券使用期已结束"),
    COUPON_ORDER_IS_PRE_VERIFY(4008, "卡券已被预核销"),
    COUPON_SEND_LIMIT_VERIFY(4009, "商户购券数错误"),
    COUPON_HANDSEL_VERIFY(4010, "商户发券异常"),
    COUPON_MANJIAN_USE_PRICE_NO_ALLOW_(4011, "满减券金额不符合条件"),
    COUPON_ORDER_TYPE_NOT_SUPPORTED(4012, "券类型不支持"),

    /**
     * 卡
     */
    CARD_IS_NOT_FOUND(9001, "优惠卡不存在"),
    CARD_REMAIN_AMOUNT_IS_NOT_ENOUGH(9002, "优惠卡余额不足"),
    CARD_IS_NOT_COST(9003, "优惠卡未消费，退款请用卡券退款，钱直接退回购买人手里"),
    CARD_TRANSFERED(9004, "卡已被领取"),
    CARD_TRANSFER_INVALID(9005, "卡转赠已失效"),
    CARD_SUBSIDY_NOT_SET(9006, "卡补贴未设置"),

    /**
     * 卡消费
     */
    CARD_SPEND_IS_PAID(9050, "卡消费已支付"),
    CARD_SPEND_IS_NOT_PREV(9051, "卡消费不是预消费订单"),
    CARD_SPEND_IS_NOT_FOUND(9052, "卡消费信息未找到"),

    /**
     * 砍价
     */
    COUPON_PRESS_HAD_FINISHED(9070, "砍价已完成"),
    COUPON_PRESS_IS_OVERTIME(9071, "砍价已超时"),
    COUPON_PRESS_IS_EXIST(9072, "此人已参与此次砍价"),

    /**
     * 卡密
     */
    COUPON_PASSWORD_NOT_FOUND(9501, "兑换码未找到"),
    COUPON_PASSWORD_HAD_USED(9502, "兑换码已使用"),
    COUPON_PASSWORD_IS_CANCELED(9503, "兑换码已作废"),

    /**
     * 微信
     */
    SESSION_KEY_DECODE_ERR(11001, "session_key/openId解密失败"),
    NICK_NAME_DECODE_ERR(11002, "nickName,unionId解密失败"),
    PHONE_DECODE_ERR(11003, "Phone解密失败"),
    NICK_NAME_NOT_FOUND(11004, "nickName,unionId未授权"),
    PHONE_NOT_FOUND(11005, "Phone未授权"),
    PHONE_IS_ENCRYPTED(11006, "Phone已加密"),
    TEMPLATE_SEND_FAILED(11007, "小程序模板消息发送失败"),
    WE_RUN_DATA_DECODE_ERR(11008, "运动信息解密失败"),
    MP_TEMPLATE_SEND_FAILED(11009, "公众号模板消息发送失败"),
    UNIFORM_SEND_FAILED(11010, "小程序统一消息发送失败"),
    USER_LOGIN_FAILED(11011, "微信用户未登录或登录有问题"),
    USER_NOT_AUTH_PHONE(11012, "用户小程序未授权手机号码"),

    /**
     * POS
     */
    POS_CONFIG_NOT_FOUND(11100, "POS会员相关未设置"),
    POS_CONFIG_MEM_DISCOUNT_DISABLE(11101, "POS会员折扣未启用"),
    POS_CONFIG_MEM_COUPON_DISABLE(11102, "POS会员优惠券未启用"),
    POS_CONFIG_MEM_CARD_DISABLE(11103, "POS会员卡支付未启用"),
    POS_COUPON_ORDER_NOT_VERIFY(11104, "此券未核销"),
    POS_COUPON_ORDER_VERIFY_NOT_CANCEL(11105, "此券核销无法取消"),
    POS_COUPON_PAY_ERROR(11106, "POS券包支付异常"),
    POS_COUPON_REFUND_ERROR(11107, "POS券包退款异常"),
    POS_CARD_PAY_NOT_CANCEL(11108, "卡支付无法取消"),
    POS_CARD_ONLY_SUPPORT_PAY(11109, "卡支付只支持支付"),
    POS_CARD_OWNER_NOT_EQUAL(11110, "卡拥有者不对应"),
    POS_ORDER_HAD_SYNCED(11111, "订单已同步"),
    POS_ORDER_NOT_FOUND(11112, "订单未找到"),
    POS_CMD_FAIL(11200, "POS命令错误"),


    /**
     * 支付
     */
    PAY_ORDER_REFUND(11994, "订单退款中"),
    PAY_ORDER_PAYING(11995, "订单支付中"),
    PAY_ORDER_NOT_PAY(11996, "订单未支付"),
    PAY_ORDER_CLOSED(11997, "订单已关闭"),
    PAY_ORDER_REVERSE(11998, "订单已撤销"),
    PAY_ORDER_NOT_FOUND(12000, "支付订单不存在"),
    PAY_ORDER_EXIST(12001, "支付订单已存在"),
    PAY_ORDER_ERROR(12002, "支付订单异常"),
    PAY_ORDER_NOTIFY_CHECK_SIGN_ERROR(12003 , "支付验签失败"),
    PAY_ORDER_IS_ZERO(12004, "支付订单金额为0"),
    PAY_ORDER_IS_NOT_PAYMENT(12005, "不是支付订单"),
    PREPAY_ID_IS_EMPTY(12006, "prepay_id是空值"),
    PAY_ORDER_QUERY_ERROR(12007, "支付订单查询异常"),

    REFUND_ORDER_EXIST(12010, "退款订单已存在"),
    REFUND_PAY_ORDER_IS_NOT_EXIST(12011, "退款支付订单不存在"),
    REFUND_PAY_ORDER_IS_ZERO(12012, "退款支付订单金额为0"),
    REFUND_ORDER_ERROR(12013, "退款订单异常"),
    REFUND_ORDER_NOTIFY_CHECK_SIGN_ERROR(12014, "退款验签失败"),
    REFUND_ORDER_BUSER_IS_NULL(12015, "B端用户不存在"),
    REFUND_ORDER_BUSER_NOT_EQUAL(12016, "B端用户无操作权限"),

    APP_ID_NOT_FOUND(12020, "APPID没找到"),
    MCH_INFO_NOT_FOUND(12021, "微信商户平台信息没找到"),
    MCH_INFO_NOT_EQUAL(12022, "微信商户平台信息不对应"),
    API_KEY_NOT_FOUND(12023, "支付密钥未配置"),
    CERT_PATH_NOT_FOUND(12024, "双向证书未配置"),

    PROFIT_SHARING_REQUEST_FAILED(12030, "分账请求失败"),
    PROFIT_SHARING_APPLY_FAILED(12031, "分账业务失败"),
    PROFIT_SHARING_RETURN_INVALID(12032, "分账请求返回校验失败"),
    PROFIT_SHARING_RECEIVER_INVALID(12033, "分账接受方查寻无效"),
    PROFIT_SHARING_QUERY_REQUEST_FAILED(12034, "分账查询请求失败"),
    PROFIT_SHARING_QUERY_APPLY_FAILED(12035, "分账查询业务失败"),
    PROFIT_SHARING_QUERY_RETURN_INVALID(12036, "分账查询返回校验失败"),
    PROFIT_SHARING_RECEIVER_ADD_FAILED(12037, "分账账户添加失败"),
    PROFIT_SHARING_RECEIVER_DEL_FAILED(12038, "分账账户删除失败"),
    PROFIT_SHARING_NUM_UP_LIMIT(12039, "分账次数超限"),
    PROFIT_SHARING_QUERY_UNKNOWN_TYPE(12040, "分账查询类型不支持"),
    PROFIT_SHARING_RECEIVER_UNKNOWN(12041, "收款方账户异常"),
    /**
     * 核销
     */
    VERIFY_ERROR(12050, "核销异常"),
    VERIFY_PRE_BUSER_NOT_EQUAL(12051, "预核销操作员不一致,请先取消上次预核销"),
    VERIFY_PRE_POS_ORDER_IS_EMPTY(12052, "预核销POS订单ID为空"),
    VERIFY_PRE_POS_ORDER_NOT_EQUAL(12053, "预核销POS订单不一致,请先取消上次预核销"),
    VERIFY_PRE_POS_ORDER_PRICE_ISSUE(12054, "预核销券金额失败，请确定券金额是否合适"),
    VERIFY_BUSER_MERCHANT_NOT_BELONG(12055, "核销员不属于此商户"),
    VERIFY_POS_ORDER_NOT_EQUAL(12056, "核销POS订单不一致,请先取消上次预核销"),
    VERIFY_COUPON_TYPE_NOT_SUPPORT(12057, "核销不支持此券类型"),
    VERIFY_MANJIAN_USER_PRICE_NOT_TOUCH(12058, "金额未达到满减券使用金额"),
    MSG_REPEAT_SEND(12061, "短信重复发送"),
    VERIFY_COUPON_ORDER_MERCHANT_IS_NULL(12062, "卡券核销失败,请查看适用门店"),


    /**
     * 解单
     */
    DALIY_REPORT_VOLUME_TODAY_NULL(12070, "今日解单不存在"),
    DALIY_REPORT_VOLUME_WEEK_NULL(12071, "无解单数据"),

    /**
     * 模板消息
     */
    TEMPLATE_NOT_FOUND(12090, "模板不存在"),
    TEMPLATE_FORMID_NOT_FOUND(12091, "formId不存在"),

    /**
     *
     * 短信
     *
     * */
    MSG_SERVER_NOT_FIND(12100,"您还未接入短信运营商,请联系平台管理员"),
    MSG_TEMPLATE_REPEAT(12101,"您添加的短信模板已存在"),
    MSG_SIGNATURE_CONTENT_ERROR(12102,"短信签名或内容错误"),
    MSG_TEMPLATE_CREATE_ERROR(12103,"创建模板失败"),
    MSG_VERIFY_CODE_NOT_FOUND(12104,"短信验证码不存在或失效"),
    MSG_TEMPLATE_NOT_FOUND(12105,"短信模板不存在"),
    MSG_REQUEST_PARAMS_ERROR(12106,"参数错误"),
    MSG_SEND_ERROR(12107,"发送短信失败"),
    MSG_METHOD_REQUEST_ERROR(12108,"接口请求错误"),
    MSG_PHONE_NOT_FOUND(12109,"请输入手机号"),
    MSG_SEND_WAY_CHOOSE_ERROR(12110,"请确定发送的方式"),
    MSG_SUM_ZERO(12111,"短信数量为0"),
    MSG_SUM_INSUFFICENT(12112,"短信数量不足"),
    MSG_NO_VALID_PHONE(12113,"没有可以发送的手机号"),
    MSG_SEND_INTERFACE_ERROR(12114,"短信运营商返回错误"),
    /**
     * 会员
     */
    MEM_IMPORT_ERR(13000, "数据导入失败,请检查数据,尝试重新导入"),
    MEM_SCORE_NOT_ENOUGH(13001, "成长值不够扣减值"),
    CREDIT_ZERO(13100,"本次操作积分为零"),
    CREDIT_NOT_ENOUGH(13101, "积分不够扣减值"),
    USER_NOT_MEMBER(13102, "该用户不是小程序会员"),
    OUT_OF_CREDIT(13103, "超出最大积分"),


    /**
     * 标签
     */
    TAGS_MATCHED_NULL(14000, "此标签没命中用户"),


    /**
     * 租赁合同
     * */
    RENT_CONTRACT_IS_NOT_FOUND(15000,"租赁合同不存在"),
    RENT_CONTRACT_IS_TERMINATED(15001,"租赁合同已终止"),
    RENT_CONTRACT_WITH_SHOP_IS_FOUND(15002,"店铺存在已关联的合同"),
    /**
     * 物业合同
     * */
    PROPERTY_CONTRACT_IS_NOT_FOUND(16000,"物业合同不存在"),

    /**
     * 租赁账单
     * */
    BILL_RENT_IS_NOT_FOUND(17000,"租赁账单不存在"),

    /**
     * 租赁押金账单
     * */

    BILL_RENT_DEPOSIT_IS_NOT_FOUND(18000,"租赁押金账单不存在"),

    /**
     * 物业账单
     * */

    BILL_PROPERTY_IS_NOT_FOUND(19000,"物业账单不存在"),


    /**
     * 押金账单
     * */
    BILL_PROPERTY_DEPOSIT_IS_NOT_FOUND(20000,"物业押金账单不存在"),
    BILL_OTHER_DEPOSIT_IS_NOT_FOUND(200001, "其他押金账单不存在"),

    /**
     * 日常费用账单
     * */
    BILL_ROUTINE_IS_NOT_FOUND(21000,"账单不存在"),
    BILL_UPDATE_FAILED(21001,"账单更新失败"),
    BILL_OWE_ZERO(21002,"账单欠缴为0"),
    BILL_PAY_ERROR(21003,"账单支付错误"),
    BILL_IS_FOUND(21004, "创建的账单已存在"),
    /**
     * 商铺
     * */
    SHOP_IS_NOT_FOUND(22000,"商铺不存在"),
    SHOP_IS_RENT(22001,"商铺已出租"),
    SHOP_NOT_SELECTED(22002, "未选择商铺"),
    SHOP_BAN_DELETED(22003, "已出租的商铺无法删除"),
    SHOP_DELETED_BY_ADMIN(22004, "仅系统管理员能删除该商铺"),
    SHOP_CONTRACT_HAS_CONNECT(22005, "有合同签约此商铺，请先解除相应的合同再删除"),

    /**
     * 迈外迪
     */
    WIWIDE_INFO_NOT_FOUND(23001,"迈外迪信息未找到"),
    WIWIDE_INFO_NOT_READY(23002,"迈外迪信息未就绪"),


    /**
     * 审批流
     */
    FLOW_FAIL(24000, "审批流操作出错"),
    FLOW_INST_NOT_EXIST(24001, "任务不存在"),
    /**
     * 微信第三方
     */
    WEAPP_APPID_NOT_AUTH(24100, "appid未授权"),
    WEAPP_BASIC_SET_ERR(24101, "基础配置错误"),
    WEAPP_BASIC_SET_DOMAIN_ERR(24102, "基础服务器域名配置错误"),
    WEAPP_EXT_SET_ERR(24103, "扩展配置错误"),
    WEAPP_CODE_COMMIT_ERR(24104, "code提交失败"),
    WEAPP_AUDIT_ERR(24105, "提交审核失败"),
    WEAPP_HAD_AUDITING(24106, "已有审核中"),
    WEAPP_NOT_AUDITED(24107, "审核未通过"),
    WEAPP_APP_RELEASEED(24108, "已发布"),

    WECHAT_LOGIN_KEY_OVERTIME(24130, "已过期"),
    WECHAT_LOGIN_USER_SELECT(24131, "请选择要登录的用户"),
    WECHAT_LOGIN_NOT_BIND(24132, "您的微信号未绑定,请登录后绑定"),

    /**
     * 屏广告
     */
    SCREENAD_NOT_FOUND(25000, "屏广告未找到"),

    /**
     * IOT设备
     */
    DEVICE_NOT_FOUND(26000, "设备未注册到系统"),
    DEVICE_ALREADY_EXIST(26001, "设备已经存在"),
    DEVICE_QRCODE_GET_FAILED(26002, "微信二维码生成失败,请重试"),
    DEVICE_REACHED_MAX_NUMBER(26003, "设备已经达到最大数量"),
    DEVICE_HAS_BEEN_BOUND(26004, "设备已经绑定到其他商户"),
    DEVICE_SIGN_INVALID(26005, "设备签名无效"),
    /**
     * 消息组件
     */
    MSG_MODEL_NOT_FOUND(27000, "找不到短信模板"),
    MSG_CONFIG_NOT_FOUND(27001, "找不到短信配置"),
    MSG_CONFIG_ACCOUNT(27002, "短信条数剩余不足"),

    MSG_INSIDE_ERROR(271001, "内部消息转发失败"),

    /**
     * 拼团
     */
    ORDER_GROUP_COOPERATING_FAILD(28001, "参团失败"),
    ORDER_GROUP_COOPERATING_FINISHED(28002, "拼团人数已满"),
    ORDER_GROUP_COOPERATING_ATTEND(28003, "您已参与拼团"),
    ORDER_GROUP_COOPERATING_UNPAID(28004, "您有未支付的拼团订单"),


    /**
     * 导入导出
     */
    EXCEL_EXPORT_ERROR(29001, "Excel数据导出出错"),
    EXCEL_IMPORT_ERROR(29002, "Excel数据导入出错"),

    TOPIC_EXIST_NAME(29100, "已存在投放的专题"),


    /**
     * 活动
     */
    ACTIVITY_PERSON_LIMITED(30000, "活动报名人数超过限制"),
    ACTIVITY_JOIN_NOT_FOUND(30001, "对不起，您未报名参加该活动"),
    ACTIVITY_JOINED(30002, "您已报名该活动"),
    ACTIVITY_JOIN_TIME_END(30003, "活动报名时间已结束"),
    ACTIVITY_SEND_ERROR(30004, "活动投放到宣传页失败，宣传页显示已达七条上限!"),
    ACTIVITY_TIME_ERROR(30005, "活动报名结束时间不能大于活动结束时间"),
    ACTIVITY_WAIT_CONFIRMED(30006, "您报名的活动还在审核中"),
    ACTIVITY_EXPIRED(30007, "您报名的活动已过期"),

    /**
     * 文件上传
     */
    PICTURE_SIZE_EXCEED(40001, "图片超过2M限制"),
    PICTURE_ANALYZING_ERROR(40002, "您上传的图片无法解析，请检查"),

    /**
     * 电费生成配置
     */
    POWER_BILL_CONFIGU_NOT_FOUND(50001, "未配置电费账单生成规则"),

    // 品牌 51000 begin
    BRAND_NOT_FOUND(51000, "品牌不存在"),
    // 品牌 51999 end

    // 业态 52000 begin
    BUSINESS_NOT_FOUND(52000, "业态不存在"),
    // 业态 52999 end

    // 招商管理 53000 begin
    INVEST_CUSTOMER_NOT_FOUND(53000, "客户信息不存在"),
    INVEST_UNKNOW_ERRROR(53001, "客户信息不存在"),
    INVEST_PARAMETER_NOT_FOUND(53002, "不能为空"),
    INVEST_RESULT_NOT_FOUND(53003, "不存在"),
    // 招商管理 53999 end


    /**
     * 首页浮屠广告
     */
    FLOATING_LAYER_FOUND(60001, "首页广告已存在，请先下线再重新投放"),


    ;

    private int code;
    private String message;

    ErrorCode(int code, String message) {
        this.code = code;
        this.message = message;
    }

    public int getCode() {
        return code;
    }

    public String getMessage(Object... param) {
        if (param.length == 0) {
            return message;
        }
        return MessageFormat.format(message, param);
    }

    public static ErrorCode getByCode(int code) {
        ErrorCode[] values = ErrorCode.values();
        for (ErrorCode value : values) {
            if (value.getCode() == code) {
                return value;
            }

        }
        return null;
    }
}
