💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
## 一、概述 平台预留了一些待定的常量,在业务系统中,进行实例化(具体化),使得平台的某些系统模块功能起作用; 以下分章节,分别阐述各种预留的待定产量及其用法; 清单: | 序号 | 待定常量 | | --- | --- | | 1 | RayPromisedDepartmentType | | 2 | RayPromisedDepartmentId | | 3 | RayPromisedDepartmentType | | 4 | RayPromisedDomainType| | 5 | RayPromisedRoleId| | 6 | RayPromisedStaffBusinessId| | 7 | RayPromisedStaffIdentityId| | 8 | RayPromisedStaffLevelId| | 9 | RayPromisedStaffRelationType | | 10 | RayPromisedStaffType| | 11| RayPromisedStaffTrackType| | 12| RayPromisedStaffAccountChangeMethod| ## 二、定制单位类型、部门类型和账号类型 单位、部门和账号,有时候需要结合业务的需要,进行类型的定制化,这里就可以使用平台预留的这三个类型机制待定常量进行定制化定义了; 默认情况下,如果业务系统不需要启用这三个类型,则使用三个类型对应字段的地方都赋值0即可; ``` RayPromisedDepartmentType RayPromisedDomainType RayPromisedStaffType ``` ``` public class RayAppDepartmentType extends RayPromisedAware implements RayPromisedDepartmentType { public static final long schoolClass = 1; public static final long schoolDepartment = 2; @Override public List<StaticDict> getDataListForSelect() { list.add(new StaticDict(0, "所有")); list.add(new StaticDict(schoolClass, "班级")); list.add(new StaticDict(schoolDepartment, "行政部门")); return list; } } ``` ## 三、定制账号关系 SysStaffRelation记录账号之间的关系,这个是一个通用设定,在不同的业务系统中,可以有不同的用途,下面以物联卡系统的代理关系作为实例,说明如何使用; ### **定义业务用的账户关系常量** ``` public class RayiotSysStaffRelationType extends RayPromisedAware implements RayPromisedStaffRelationType { public static final long parent_agent = 1;// public static final long topagent_creator = 2;// @Override public List<StaticDict> getDataListForSelect() { list.add(new StaticDict(0, "所有")); list.add(new StaticDict(parent_agent, "父级代理商")); list.add(new StaticDict(topagent_creator, "顶级代理商创建者")); return list; } } ``` >[danger] 这些配置都是按照约定配置,无需特别配置,按照接口实现即可,如果配置了多个同接口实现,则需要用@RayConventionEnabled来注解启用的那个实现; ### **使用** 上面定义了业务系统中账号关系的具体用法,这样,就可以在业务中,具体使用账号关系了; ``` SysStaff staffobj = staffCreateExecutor.create("", mobile, staffName, 0, RayiotFrameworkLevelConstants.agentDepartment, RayiotFrameworkLevelConstants.agentRole, RayiotFrameworkLevelConstants.agentIdentity, 0, "", "", model.getCurLoginData().getCurStaffId(), RayiotSysStaffRelationType.parent_agent, "", 0); ``` >[danger] > 1、上面就是创建一个代理商的下级代理商代码,里面用了账号关系了,通过这个来记录代理关系; > 2、可以通过平台提供的接口(015平台约定参数,如/api/system/common/raypromise/staff/relationtype/list),查看所有业务定义的相关属性元素了; ## 四、定制角色、部门、账号身份、账号等级、账户业务 业务系统中,有时候需要一些特定的角色、部门、账号身份及账号业务; 定制账号身份举例: ``` public class RmallPromisedStaffIdentityId extends RayPromisedAware implements RayPromisedStaffIdentityId { public static final long memberIdentity = 1; public static final long lobbyIdentity = 2; public static final long countyIdentity = 3; public static final long cityIdentity = 4; public static final long provinceIdentity = 5; public static final long resourceProviderIdentity = 100; @Override public List<StaticDict> getDataListForSelect() { list.add(new StaticDict(0, "所有")); list.add(new StaticDict(memberIdentity, "会员")); list.add(new StaticDict(lobbyIdentity, "营业厅")); list.add(new StaticDict(countyIdentity, "县级分公司")); list.add(new StaticDict(cityIdentity, "市级分公司")); list.add(new StaticDict(provinceIdentity, "省级子公司")); return list; } } ``` 定制部门举例: ``` public class RayiotPromisedDepartmentId extends RayPromisedAware implements RayPromisedDepartmentId { public static final long cardUserDepartment = 3; public static final long topAgentDepartment = 4; public static final long wechatTopAgentDepartment = 5; public static final long apiTopAgentDepartment = 6; public static final long agentDepartment = 7; @Override public List<StaticDict> getDataListForSelect() { list.add(new StaticDict(0, "所有")); list.add(new StaticDict(cardUserDepartment, "用户部门")); list.add(new StaticDict(topAgentDepartment, "顶级代理商部门")); list.add(new StaticDict(wechatTopAgentDepartment, "微信接入代理部门")); list.add(new StaticDict(apiTopAgentDepartment, "api接入代理部门")); list.add(new StaticDict(agentDepartment, "代理商部门")); return list; } } ``` 定制账号角色举例: ``` public class RayiotPromisedRoleId extends RayPromisedAware implements RayPromisedRoleId { public static final long cardUserRole = 100; public static final long topAgentRole = 101; public static final long wechatTopAgentRole = 102; public static final long apiTopAgentRole = 103; public static final long agentRole = 104; @Override public List<StaticDict> getDataListForSelect() { list.add(new StaticDict(0, "所有")); list.add(new StaticDict(cardUserRole, "用户角色")); list.add(new StaticDict(topAgentRole, "顶级代理商角色")); list.add(new StaticDict(wechatTopAgentRole, "微信接入代理角色")); list.add(new StaticDict(apiTopAgentRole, "api接入代理角色")); list.add(new StaticDict(agentRole, "代理商角色")); return list; } } ``` 定制账号业务举例: ``` public class RayiotPromisedStaffBusinessId extends RayPromisedAware implements RayPromisedStaffBusinessId { public static final long innerUser = 1; public static final long wechatUser = 2; @Override public List<StaticDict> getDataListForSelect() { list.add(new StaticDict(0, "所有")); list.add(new StaticDict(innerUser, "平台内部用户")); list.add(new StaticDict(wechatUser, "微信接入用户")); return list; } } ``` 定制账号等级举例: ``` public class RmallPromisedStaffLevelId extends RayPromisedAware implements RayPromisedStaffLevelId { public static final long l1 = 1; public static final long l2 = 2; public static final long l3 = 3; public static final long l4 = 4; public static final long l5 = 5; public static final long l6 = 6; public static final long l7 = 7; public static final long l8 = 8; public static final long l9 = 9; public static final long l10 = 10; public static final long l11 = 11; public static final long l12 = 12; public static final long l13 = 13; public static final long l14 = 14; public static final long l15 = 15; @Override public List<StaticDict> getDataListForSelect() { list.add(new StaticDict(l1, "1级")); list.add(new StaticDict(l2, "2级")); list.add(new StaticDict(l3, "3级")); list.add(new StaticDict(l4, "4级")); list.add(new StaticDict(l5, "5级")); list.add(new StaticDict(l6, "6级")); list.add(new StaticDict(l7, "7级")); list.add(new StaticDict(l8, "8级")); list.add(new StaticDict(l9, "9级")); list.add(new StaticDict(l10, "10级")); list.add(new StaticDict(l11, "11级")); list.add(new StaticDict(l12, "12级")); list.add(new StaticDict(l13, "13级")); list.add(new StaticDict(l14, "14级")); list.add(new StaticDict(l15, "15级")); return list; } } ``` ## 五、定制异步执行事件类型 业务系统中,有时候需要在应用中产生一些异步任务,由调度服务去执行这些具体的异步任务,为了通用化处理,平台引入了定制的异步执行事件类型; ``` public class RayiotPromisedAsynExecuteType extends RayPromisedAware implements RayPromisedAsynExecuteType { public static final long activateCard = 1; public static final long addWhiteNumber = 2; @Override public List<StaticDict> getDataListForSelect() { list.add(new StaticDict(activateCard, "激活卡片")); list.add(new StaticDict(addWhiteNumber, "白名单")); return list; } } ``` 用途可参考:[项目实战/后端开发/多线程与并发/异步事件机制](../%E5%A4%9A%E7%BA%BF%E7%A8%8B%E4%B8%8E%E5%B9%B6%E5%8F%91/%E5%BC%82%E6%AD%A5%E4%BA%8B%E4%BB%B6%E6%9C%BA%E5%88%B6.md)