Documentation
¶
Index ¶
- Variables
- func DeleteEventByCode(code string) (err error)
- func DeleteEventByID(id int64) (err error)
- func GetEventExtendDistinctList(extendNum int) (dataList []string, err error)
- func Init() (err error)
- func InsertEvent(args *FieldsEvent) (err error)
- func InsertEventList(args []FieldsEvent) (err error)
- type ArgsGetEventLevelCountByExtend
- type ArgsGetEventList
- type DataArgsDataGetEventLevelCountRanking
- type DataGetAnalysisModelSupplierRFMOrderDaysByCompanyOrder
- type DataGetEventLevelCount
- type DataGetEventLevelCountByExtend
- type DataGetEventLevelCountByExtendOne
- type FieldsEvent
- type GetEventCodeBySystemData
Constants ¶
This section is empty.
Variables ¶
var ( //OpenSub 是否启动订阅 OpenSub = false )
Functions ¶
func DeleteEventByCode ¶
DeleteEventByCode 批量删除指标的所有事件
func GetEventExtendDistinctList ¶
GetEventExtendDistinctList 获取指定维度的所有可选值
func InsertEventList ¶
func InsertEventList(args []FieldsEvent) (err error)
InsertEventList 插入一组新的预警事件
Types ¶
type ArgsGetEventLevelCountByExtend ¶
type ArgsGetEventLevelCountByExtend struct {
//指标编码
Code string `db:"code" json:"code" check:"des" min:"1" max:"50" empty:"true" index:"true" field_list:"true"`
//扩展维度1
// 可建议特别的维度关系,例如特定供应商的数据、特定地区的数据等
Extend1 string `db:"extend1" json:"extend1" index:"true" field_list:"true"`
//扩展维度2
Extend2 string `db:"extend2" json:"extend2" index:"true" field_list:"true"`
//扩展维度3
Extend3 string `db:"extend3" json:"extend3" index:"true" field_list:"true"`
//扩展维度4
Extend4 string `db:"extend4" json:"extend4" index:"true" field_list:"true"`
//扩展维度5
Extend5 string `db:"extend5" json:"extend5" index:"true" field_list:"true"`
}
ArgsGetEventLevelCountByExtend 获取指定维度的风险事件数量关系参数
type ArgsGetEventList ¶
type ArgsGetEventList struct {
//分页
Pages CoreSQL2.ArgsPages `json:"pages"`
//指标编码
Code string `db:"code" json:"code" check:"des" min:"1" max:"50" index:"true" field_list:"true"`
//触发时间范围
// 例如:2021-01-01
BetweenAt CoreSQL2.ArgsTimeBetween `json:"betweenAt"`
//预警等级
// 根据项目需求划定等级
// 例如:0 低风险; 1 中风险; 2 高风险
Level int `db:"level" json:"level" index:"true" field_list:"true"`
//来源指标值的系统和ID
// 避免重复触发预警
FromSystem string `db:"from_system" json:"fromSystem" check:"des" min:"1" max:"50" empty:"true" index:"true" field_list:"true"`
FromID int64 `db:"from_id" json:"fromID" check:"id" empty:"true" index:"true" field_list:"true"`
//触发类型
// 根据项目需求划定类型,可以留空
FromType string `db:"from_type" json:"fromType" check:"des" min:"1" max:"50" empty:"true" index:"true" field_list:"true"`
//扩展维度1
// 可建议特别的维度关系,例如特定供应商的数据、特定地区的数据等
Extend1 string `db:"extend1" json:"extend1" index:"true" field_list:"true"`
//扩展维度2
Extend2 string `db:"extend2" json:"extend2" index:"true" field_list:"true"`
//扩展维度3
Extend3 string `db:"extend3" json:"extend3" index:"true" field_list:"true"`
//扩展维度4
Extend4 string `db:"extend4" json:"extend4" index:"true" field_list:"true"`
//扩展维度5
Extend5 string `db:"extend5" json:"extend5" index:"true" field_list:"true"`
//是否删除
IsRemove bool `db:"is_remove" json:"isRemove" check:"bool"`
//搜索
Search string `json:"search" check:"search" empty:"true"`
}
ArgsGetEventList 获取预警事件列表参数
type DataArgsDataGetEventLevelCountRanking ¶
type DataArgsDataGetEventLevelCountRanking struct {
//指标编码
Code string `db:"code" json:"code" check:"des" min:"1" max:"50" index:"true" field_list:"true"`
//预警等级
// 根据项目需求划定等级
// 例如:0 低风险; 1 中风险; 2 高风险
Level int `db:"level" json:"level"`
//数量
Count int64 `db:"count" json:"count"`
}
func GetEventLevelCountRanking ¶
func GetEventLevelCountRanking(args *ArgsGetEventLevelCountByExtend) (dataList []DataArgsDataGetEventLevelCountRanking)
GetEventLevelCountRanking 获取指标的数量排名
type DataGetAnalysisModelSupplierRFMOrderDaysByCompanyOrder ¶
type DataGetAnalysisModelSupplierRFMOrderDaysByCompanyOrder struct {
//code
Code string `json:"code"`
//最大值
MaxVal float64 `json:"maxVal"`
//平均值
AvgVal float64 `json:"avgVal"`
//排名
Rank int64 `json:"rank"`
//等级
Level int `json:"level"`
//desc
Desc string `json:"desc"`
}
func GetAnalysisModelByCompany ¶
func GetAnalysisModelByCompany(code, supplierName, purchaseObject string) (data DataGetAnalysisModelSupplierRFMOrderDaysByCompanyOrder)
GetAnalysisModelByCompany 专用场景风险评估数据
type DataGetEventLevelCount ¶
type DataGetEventLevelCount struct {
//预警等级
// 根据项目需求划定等级
// 例如:0 低风险; 1 中风险; 2 高风险
Level int `db:"level" json:"level"`
//数量
Count int64 `db:"count" json:"count"`
}
func GetEventLevelCount ¶
func GetEventLevelCount() (dataList []DataGetEventLevelCount)
GetEventLevelCount 获取风险等级统计 该方法会无视维度,获取所有风险等级的数量统计
type DataGetEventLevelCountByExtend ¶
type DataGetEventLevelCountByExtend struct {
//预警等级
// 根据项目需求划定等级
// 例如:0 低风险; 1 中风险; 2 高风险
Level int `db:"level" json:"level"`
//数量
Count int64 `db:"count" json:"count"`
}
DataGetEventLevelCountByExtend 获取指定维度的风险事件数量关系数据
func GetEventLevelCountByExtend ¶
func GetEventLevelCountByExtend(args *ArgsGetEventLevelCountByExtend) (dataList []DataGetEventLevelCountByExtend)
GetEventLevelCountByExtend 获取指定维度的风险事件数量关系 该方法需指定具体维度,以获取指定维度的风险等级数量统计
type DataGetEventLevelCountByExtendOne ¶
type DataGetEventLevelCountByExtendOne struct {
//维度名称
ExtendVal string `db:"extend_val" json:"extendVal"`
//预警等级
// 根据项目需求划定等级
// 例如:0 低风险; 1 中风险; 2 高风险
Level int `db:"level" json:"level"`
//数量
Count int64 `db:"count" json:"count"`
//该维度下合计数量
AllCount int64 `db:"all_count" json:"allCount"`
}
DataGetEventLevelCountByExtendOne 获取指定维度的风险事件数量关系数据
func GetEventLevelCountByExtendOne ¶
func GetEventLevelCountByExtendOne(extend int) (dataList []DataGetEventLevelCountByExtendOne)
GetEventLevelCountByExtendOne 获取指定维度的风险事件数量关系
func GetEventLevelCountByExtendOneTop10 ¶
func GetEventLevelCountByExtendOneTop10(extend int) (dataList []DataGetEventLevelCountByExtendOne)
GetEventLevelCountByExtendOneTop10 获取指定维度的风险事件数量关系前10 * 注意,反馈的数据可能会超出10个,因为是按照组反馈的,请接口或前端根据extend合并处理 每个extend的level至多3条,前10则最多反馈30条数据 可能会反馈多余不相关的数据,所以需重新做合并处理
type FieldsEvent ¶
type FieldsEvent struct {
// ID
ID int64 `db:"id" json:"id" check:"id" unique:"true"`
//创建时间
CreateAt time.Time `db:"create_at" json:"createAt" default:"now()"`
//更新时间
UpdateAt time.Time `db:"update_at" json:"updateAt" default:"now()"`
//删除时间
DeleteAt time.Time `db:"delete_at" json:"deleteAt" default:"0" index:"true"`
//指标编码
Code string `db:"code" json:"code" check:"des" min:"1" max:"50" index:"true" field_list:"true"`
//年月日
// 可任意持续,如年,或仅年月
// 不建议构建小时及以下级别的指标
// 同一个维度和时间范围,仅会存在一个数据,否则将覆盖
YearMD string `db:"year_md" json:"yearMD" index:"true" field_list:"true" field_search:"true"`
//预警等级
// 根据项目需求划定等级
// 例如:0 低风险; 1 中风险; 2 高风险
Level int `db:"level" json:"level" index:"true" field_list:"true" field_search:"true"`
//来源指标值的系统和ID
// 避免重复触发预警
FromSystem string `db:"from_system" json:"fromSystem" check:"des" min:"1" max:"50" index:"true" field_list:"true"`
FromID int64 `db:"from_id" json:"fromID" check:"id" index:"true" field_list:"true"`
//触发类型
// 根据项目需求划定类型,可以留空
FromType string `db:"from_type" json:"fromType" check:"des" min:"1" max:"100" index:"true" field_list:"true"`
//扩展维度1
// 可建议特别的维度关系,例如特定供应商的数据、特定地区的数据等
Extend1 string `db:"extend1" json:"extend1" index:"true" field_list:"true"`
//扩展维度2
Extend2 string `db:"extend2" json:"extend2" index:"true" field_list:"true"`
//扩展维度3
Extend3 string `db:"extend3" json:"extend3" index:"true" field_list:"true"`
//扩展维度4
Extend4 string `db:"extend4" json:"extend4" index:"true" field_list:"true"`
//扩展维度5
Extend5 string `db:"extend5" json:"extend5" index:"true" field_list:"true"`
//指标预警阈值,触发预警时的值
Threshold int64 `db:"threshold" json:"threshold" index:"true"`
//触发值
IndexVal float64 `db:"index_val" json:"indexVal" field_search:"true" field_list:"true"`
//备注信息
Remark string `db:"remark" json:"remark" check:"des" min:"1" max:"3000" empty:"true" field_list:"true" field_search:"true"`
}
func GetEventByID ¶
func GetEventByID(id int64) (data FieldsEvent, err error)
GetEventByID 通过ID获取风险详情
func GetEventList ¶
func GetEventList(args *ArgsGetEventList) (dataList []FieldsEvent, dataCount int64, err error)
GetEventList 获取预警事件列表
type GetEventCodeBySystemData ¶
type GetEventCodeBySystemData struct {
Code string `db:"code" json:"code"`
}
func GetEventCodeBySystem ¶
func GetEventCodeBySystem() (dataList []GetEventCodeBySystemData, err error)
GetEventCodeBySystem 获取指标事件中的指标编码