package com.sdtool.common.datas;

import com.sdtool.common.entity.system.KeyValuePair;

/**
 * Created by Administrator on 2017-03-30.
 * redis存储的key前缀
 */
public class RedisKeys {

    /**
     * 限流，ip调用次数
     */
    public static final String KEY_REQUESTLIMIT = "redis.reqlimit";

    public static final String KEY_AUTHCODE = "redis.authcode";

    /**
     * session
     */
    public static final String KEY_SESSIONS = "redis.sessions";

    /**
     * ERP平台所有工厂客户列表
     */
    public static final String KEY_SUPPLIER_PLATFORM = "redis.platform.supplier";
    public static final String KEY_SUPPLIER_SHARDING_KEY_PLATFORM = "redis.platform.supplier.sharding.key";
    public static final String KEY_SUPPLIER_ITEM_CODE_PLATFORM = "redis.platform.supplier.itemcode";

    public static final String KEY_ERP_ACCESS_TOKEN_VALUE = "redis.erp.access.token.value";
    public static final String KEY_ERP_ACCESS_TOKEN_DATE = "redis.erp.access.token.date";

    //部门
    public static final String KEY_DEPT = "redis.dept";
    // 人员
    public static final String KEY_ACCOUNT_ERP_CHECK = "redis.account.erp.check";

    public static final String KEY_ACCOUNT_MALL_CHECK = "redis.account.mall.check";

    /**
     * 单个redis节点的分布式锁
     */
    public static final String KEY_SYSLOCK = "redis.lock";

    /**
     * 存储所有的系统菜单，以hash结构存储，如果内存占用高，可把key写成纯数字
     */
    public static final String KEY_SYSMENUS = "redis.sysmenus";

    /**
     * 存储所有的系统角色，以hash结构存储，如果内存占用高，可把key写成纯数字
     */
    public static final String KEY_SYSROLES = "redis.sysroles";

    public static final String KEY_SYSROLEMENUS = "redis.sysrolemenus";

    /**
     * 存储角色的菜单和功能
     */
    public static final String KEY_SYSROLEACTIONS = "redis.sysroleactions";

    /**
     * 存储用户角色，每个用户一个键值
     * 当前服务端未保存用户和session的对应关系，导致无法快速获取用户的角色关系
     * 这里在首次从数据库中获取时进行存储，在修改员工档案的时候删除键值并修改
     * 存储方式为hashlist，redis键为用户id，hash键为roleid，值为userrole.json
     */
    public static final String KEY_SYSUSERROLES = "redis.sysuserrole";

    /**
     * 系统配置
     */
    public static final String KEY_CONFIGVALUE = "redis.configvalue";

    /**
     * 字典数据类型
     */
    public static final String KEY_ERPDICTTYPE = "redis.dicttype";

    /**
     * 字典数据
     */
    public static final String KEY_ERPDICTDATA = "redis.dictdata";

    /**
     * 业务脚本
     */
    public static final String KEY_BUSINESSSCRIPT = "redis.businessscript";

    public static final String KEY_SCRIPTCOMPILE = "redis.scriptcompile";

    /**
     * 网站内容
     */
    public static final String KEY_SITE_CONTENT = "redis.site.content";

    /**
     * 消息类型
     */
    public static final String KEY_ERP_NOTICEMESSAGE = "redis.erp.noticemessage";

    /**
     * 单据打印次数
     */
    public static final String KEY_ERP_ITEMPRINTCOUNT = "redis.erp.itemprintcount";

    //科目档案
    public static final String KEY_ERP_FINANCE_ACCOUNT = "redis.erp.finance.account";

    /**
     * 固定科目设置值
     */
    public static final KeyValuePair[] SUPPLIER_ACCOUNT_CONFIGARR = {
            new KeyValuePair("UnionPayAccount", "在线银联支付收款对应科目"),
            new KeyValuePair("AliPayAccount", "在线支付宝支付收款对应科目"),
            new KeyValuePair("WxPayAccount", "在线微信支付收款对应科目"),
            new KeyValuePair("ChargeAgainstAccount", "预存款冲抵收款对应科目"),
            new KeyValuePair("WebOrderJoinAccount", "网站订单对接收款对应科目"),
            new KeyValuePair("HSTYPayAccount", "在线汇旺财支付收款对应科目")
    };

    /**
     * 待支付的单据
     * 如果支付完成或者超时，则删除
     * 方便收到支付通知后获取数据
     */
    public static final String KEY_ERP_PAYTRADENO = "redis.erp.pay.tradeno";

    /**
     * 用户订阅消息
     * 键值为方便hscan查找，存储方式 messageCode-idUser-0
     * 结尾加一个-0，为了hscan查找时可以定位，避免id前面相同的时候查找 例如1和11
     * 如通过messageCode查找 messageCode-*-0
     * 通过idUser查找 *-idUser-0
     */
    public static final String KEY_ERP_USERNOTICEMESSAGE = "redis.erp.usernoticemessage";

    /**
     * 消息组
     * 每个消息组为一个set，存放websocket的userid（当前为登录账号）
     */
    public static final String KEY_ERP_NOTICEMSGGROUP = "redis.erp.noticemsggroup";

    /**
     * 登录用户，一直记录，用户登录则记录下信息
     * 方便后续业务和websocket查询用户信息
     */
    public static final String KEY_ERP_LOGINUSER = "redis.erp.loginuser";

    /**
     * 用户配置信息
     */
    public static final String KEY_ERP_PERSONCONFIG = "redis.erp.personconfig";

    /**
     * 在线用户
     */
    public static final String KEY_ERP_ONLINEUSER = "redis.erp.onlineuser";


    /**
     * 查询统计
     */
    public static final String KEY_ERP_INQUIREINFO = "redis.erp.inquireinfo";

    /**
     * 系统表单
     */
    public static final String KEY_FORMTOKEN = "redis.formtoken";

    public static final String KEY_FORMTOKENEX = "redis.formtokenex";

    /**
     * 仪表盘
     */
    public static final String KEY_ERPCARDPANEL = "redis.cardpanel";

    /**
     * 业务锁定数据
     * 例如锁定workpart锁定
     * 保留数据，避免上es或者数据库中查找
     */
    public static final String KEY_ERP_LOCK_DATA = "redis.erplock.data";
    public static final String KEY_ERP_LOCK_USERDATA = "redis.erplock.userdata";

    /**
     * 机台上机人员
     */
    public static final String KEY_ERP_MACHINE_ON_WORK = "redis.erp.machineonwork";

    /**
     * 专班组版workpart锁定
     */
    public static final String KEY_ERP_EXCLUSIVE_LOCKPART = "redis.erplock.exclusivelockpart";

    /**
     * 系统默认需要的配置，防止未初始化，客户端报错
     */
    public static final String[] SUPPLIER_SYSTEM_CONFIGARR = {
            "SYSTEM_VERSION"
    };

    /**
     * 网站信息配置主键
     * 网站名称
     * 联系电话
     * 营业时间
     * 企业地址
     * 版权信息
     * 备案号
     */
    public static final String[] SUPPLIER_SITEINFO_CONFIGARR = {
            "SiteName",
            "SitePhone",
            "SiteTime",
            "SiteAddress",
            "SiteCopyRight",
            "SiteICP"
    };

    public static final String[] ERP_NOTICE_MESSAGE_GROUP = {
            "test"
    };

    //分厂
    public static final String KEY_COMPANY_INFO = "redis.company.info";

    //产品
    public static final String KEY_PRODUCT_INFO = "redis.erp.product.info";

    public static final String KEY_PRODUCT_DETAIL = "redis.erp.product.detail";

    public static final String KEY_PRODUCT_TYPE = "redis.erp.product.type";

    public static final String KEY_PRODUCT_PARAMETER = "redis.erp.product.parameter";

    public static final String KEY_PRODUCT_CENTER_PARAMETER = "redis.erp.product.center.parameter";

    public static final String KEY_PRODUCT_PAGE_PRICE_INFO = "redis.erp.product.pagePrice";

    public static final String KEY_PRODUCT_EXAMPLE_IMAGE = "redis.erp.product.example.image";

    public static final String KEY_PRODUCT_ROOM = "redis.erp.product.room";

    /**
     * 订单生命周期list池，单线程读取写入数据库
     */
    public static final String KEY_ERP_ORDER_CYCLE_ITEM = "redis.erp.order.cycle.item";

    /**
     * 批量下单的文件编号和订单信息
     */
    public static final String KEY_ERP_ORDER_BATCH_FILE_CODE = "redis.erp.order.batch.file.code";

    //region 客户

    public static final String KEY_ERP_CLIENT_INDUSTRY_INFO = "redis.erp.client.industry.info";

    /**
     * 客户余额
     */
    public static final String KEY_ERP_CLIENT_BALANCE = "redis.erp.client.moneybalance";

    public static final String KEY_ERP_CLIENT_LEVEL = "redis.erp.client.clientlevel";

    //endregion

    //region 纸张相关、辅料类型
    public static final String KEY_ERP_PAPER_BRAND = "redis.erp.paper.brand";
    //纸张开数档案
    public static final String KEY_ERP_PAPER_CUT_INFO = "redis.erp.paper.cut.info";
    //开纸尺寸档案
    public static final String KEY_ERP_PAPER_CUT_SIZE_INFO = "redis.erp.paper.cut.size.info";
    //辅料类型
    public static final String KEY_ERP_MATERIAL_TYPE = "redis.erp.material.type";
    // 辅料纸张数量库存
    public static final String KEY_ERP_MATERIAL_QTY_BALANCE = "redis.erp.material.qty.balance";

    // 纸张与辅料入库的总金额和总数量，方便后续计算加权平均
    public static final String KEY_ERP_MATERIAL_STOCK_IN_MONEY = "redis.erp.material.stock.in.money";
    public static final String KEY_ERP_MATERIAL_STOCK_IN_QTY = "redis.erp.material.stock.in.qty";
    //订单工序领料工作锁定
    public static final String KEY_ERP_WORKING_ORDER_PROCESS_PICKING = "redis.erp.working.order.process.picking";
    /**
     * 辅料纸张数量虚拟库存，用于预出库锁定，不存数据库
     * 预出库锁定，出库解锁
     */
    public static final String KEY_ERP_MATERIAL_VIRTUAL_BALANCE = "redis.erp.material.virtual.balance";

    /**
     * 库房盘点状态
     */
    public static final String KEY_ERP_STOCK_CHECK_STATUS = "redis.erp.stock.check.status";


    //endregion

    /**
     * PDFMonitor用的
     */

    //施工单版心尺寸
    public static final String KEY_ERP_BREEDPLATESIZE = "redis.erp.breedplatesize";

    public static final String KEY_PDF_PRINTBILLDETAIL = "redis.pdf.printbilldetail";
    public static final String KEY_PDF_HADREBUILDPLATE = "redis.pdf.hadrebuildplate";
    public static final String KEY_PDF_VOIDPRINTBILLID = "redis.pdf.voidprintbillid";

    public static final String KEY_PDF_ORDER_TASK_LIST = "redis.pdf.order.task";
    public static final String KEY_PDF_ORDER_TASK_HAD_PLATE = "redis.pdf.order.task.had.plate";


    // 机型机台
    public static final String KEY_ERP_MACHINE_TYPE = "redis.erp.machine.type";
    public static final String KEY_ERP_MACHINE_INFO = "redis.erp.machine.info";
    public static final String KEY_ERP_DEVELOP_CLIENT_INFO = "redis.erp.develop.client";
    public static final String KEY_ERP_DEVELOP_CLIENT_CODE = "redis.erp.develop.client.code";

    // 单据定义
    public static final String KEY_ERP_BILL_DEFINE = "redis.erp.bill.define";
    // 库房
    public static final String KEY_ERP_STOCKROOM = "redis.erp.stockroom";

    // 版芯档案
    public static final String KEY_ERP_PLATE_TEMPLATE = "redis.erp.plate.template";
    // 版式标题
    public static final String KEY_ERP_PLATE_TITLE = "redis.erp.plate.title";

    // 纸杯版式定义
    public static final String KEY_ERP_CUP_PLATE_TEMPLATE = "redis.erp.cup.plate.template";

    /**
     * 专版施工单拼版任务
     */
    public static final String KEY_VERSION_EXCLUSIVETASK = "redis.erp.version.exclusivetask";

    /**
     * 专版拼版个人任务数量
     */
    public static final String KEY_SPLICEWORKCOUNT = "redis.erp.spliceworkcount";

    /**
     * 施工单最新消息
     */
    public static final String KEY_ERP_PRINTBILLMESSAGE = "redis.erp.printbillmessage";

    public static final String KEY_ERP_PRINT_BREED_MESSAGE = "redis.erp.print.breed.message";
    /**
     * 施工单版本号
     */
    public static final String KEY_VERSION_PRINTBILL = "redis.erp.version.printbill";

    //班组
    public static final String KEY_ERP_WORK_TEAM = "redis.erp.work.team";
    //班组人员
    public static final String KEY_ERP_WORK_TEAM_PERSON = "redis.erp.work.team.person";
    //版印刷工序调度排序
    public static final String KEY_BREED_TASK_SCHEDULE_SORT = "redis.breedtask.schedule.sort";
    //异步处理施工单生命周期队列
    public static final String KEY_ERP_PRINTBILL_CYCLE_ITEM = "redis.printbill.cycle.item";

    //版任务的实时状态
    public static final String KEY_ERP_BREEDTASKSTATUS = "redis.printbill.breed.taskStatus";

    //region pc商城用户
    public static final String KEY_ERP_MALL_User = "redis.erp.mall.user";

    public static final String KEY_ERP_MALL_SOCIAL_User = "redis.erp.mall.user.social";

    public static final String KEY_ERP_MALL_POSTER_LOCATION = "redis.erp.mall.poster.location";
    //用户级别
    public static final String KEY_ERP_MALL_USER_LEVEL = "redis.erp.mall.user.level";
    //endregion

    //region 版本号

    //ERP订单
    public static final String KEY_ERP_VERSION_ORDER = "redis.erp.version.order";

    public static final String KEY_ERP_VERSION_DELIVER_INFORM = "redis.erp.version.deliver.inform";

    public static final String KEY_ERP_VERSION_RECEIVABLE = "redis.erp.version.receivable";

    //endregion

    //region 修图模块
    /**
     * 上班修图人员
     * hash列表，值为上班时间
     */
    public static final String KEY_IMAGE_DESIGNER = "redis.image.designer";

    /**
     * 修图分配方式，全局控制0或者没有表示自动分配，1手工分配 2单人模式（自己下单分给自己)
     */
    public static final String KEY_IMAGE_DESIGNER_WORK_KIND = "redis.image.designer.work.kind";
    /**
     * 修图人员上班状态
     * 1正常上班 2忙碌不接单
     */
    public static final String KEY_IMAGE_DESIGNER_STATE = "redis.image_designer_state";

    /**
     * 修图人员排序状态
     */
    public static final String KEY_IMAGE_DESIGNER_SORT_NUM = "redis.image.designer.sort.num";

    /**
     * 修图人员P数
     * 有序集合
     */
    public static final String KEY_DESIGNER_WORK_IMAGE_COUNT = "redis.designer.work.image.count";
    /**
     * 修图人员暂停订单数
     * hash
     */
    public static final String KEY_DESIGNER_WORK_ORDER_COUNT = "redis.designer.work.order.count";

    /**
     * 记录上一次订单分配修图人员id
     * 订单分配时候，首先判断此键值，如果存在，则直接分配给对应的修图人员，然后删除键值
     * 修图人员退回订单,写入此键值
     */
    public static final String KEY_ORDER_IMAGE_DISPATCH_LAST = "redis.order.image.dispatch.last";

    /**
     * 手动分配订单异步记录，先锁定，防止重复分配，修图记录完成后（包括修图人退回、完成、强制完成、校稿审核）从redis中删除
     */
    public static final String KEY_ORDER_IMAGE_MANUAL_ITEM = "redis.order.image.manual.item";
    //endregion

    /**
     * 科目余额
     */
    public static final String KEY_ERP_ACCOUNT_BALANCE = "redis.erp.account.money.balance";

    public static final String KEY_ERP_ACCOUNT_LAST_PERIOD = "redis.erp.account.last.period";


    //region 数据锁定

    //产品档案
    public static final String KEY_ERP_WORKING_PRODUCT_INFO = "redis.erp.working.product.info";

    //产品下载
    public static final String KEY_ERP_WORKING_PRODUCT_DOWN = "redis.erp.working.product.down";

    public static final String KEY_ERP_WORKING_ERP_PRINT_ORDER = "redis.erp.working.print.order";

    public static final String KEY_ERP_WORKING_ERP_ORDER_TASK = "redis.erp.working.order.task";
    //商城订单
    public static final String KEY_ERP_WORKING_MALL_ORDER = "redis.erp.working.mall.order";

    public static final String KEY_ERP_WORKING_PRINT_ORDER_IMAGE_DISPATCH = "redis.erp.working.order.image.dispatch";

    public static final String KEY_ERP_WORKING_JOIN_MALL_ORDER = "redis.erp.working.Join.mall.order";

    //endregion


    //region 在线设计
    //模板--给模板编辑用的,不记录item,全文记录jsonContent
    public static final String KEY_DESIGNER_DESIGN_TEMPLATE_EDIT = "redis.designer.design.template.edit";
    //模板--给后面流程用的,记录itemList,不记录jsonContent
    public static final String KEY_DESIGNER_DESIGN_TEMPLATE_IMPOSITION = "redis.designer.design.template.imposition";
    //模板--给前端传入参数后生成的临时模板,如果要生成订单则传入下一步,否则过期自动清除
    public static final String KEY_DESIGNER_DESIGN_TEMPLATE_SESSION = "redis.designer.design.template.session";

    //订单--给模板编辑用的,不记录item,全文记录jsonContent
    public static final String KEY_DESIGNER_DESIGN_ORDER_EDIT = "redis.designer.design.order.edit";
    //订单--给后面流程用的,记录itemList,不记录jsonContent
    public static final String KEY_DESIGNER_DESIGN_ORDER_IMPOSITION = "redis.designer.design.order.imposition";

    public static final String KEY_DESIGNER_DESIGN_FONT = "redis.designer.design.font";
    //系统流转间暂存token
    public static final String KEY_DESIGNER_SYS_USER_TOKEN = "redis.designer.sys.user.token";

    public static final String KEY_DESIGNER_SVG_TASK_LIST = "redis.designer.svg.task.list";
    public static final String KEY_DESIGNER_PDF_CALLBACK_LIST = "redis.designer.pdf.callback.list";
    //endregion

    private RedisKeys() {
    }
}
