diff --git a/apps/iot/src/endpoint/iot_jinzhi_endpoint.erl b/apps/iot/src/endpoint/iot_jinzhi_endpoint.erl index 4c61691..98a9c17 100644 --- a/apps/iot/src/endpoint/iot_jinzhi_endpoint.erl +++ b/apps/iot/src/endpoint/iot_jinzhi_endpoint.erl @@ -205,17 +205,14 @@ format_event(LocationCode, DynamicLocationCode, EventType, #{<<"event_code">> := }, iolist_to_binary(jiffy:encode(ReqData, [force_utf8])). --spec generate_task_id(DynamicLocationCode :: binary(), EventCode :: binary()) -> binary(). -generate_task_id(DynamicLocationCode, EventCode) when is_binary(DynamicLocationCode), is_binary(EventCode) -> - case byte_size(DynamicLocationCode) of - 22 -> - LocCode = binary_part(DynamicLocationCode, 0, 17), +-spec generate_task_id(LocationCode :: binary(), EventCode :: binary()) -> binary(). +generate_task_id(LocationCode, EventCode) when is_binary(LocationCode), is_binary(EventCode) -> + case byte_size(LocationCode) > 22 of + true -> + LocCode = binary_part(LocationCode, 0, 22), <>; - 28 -> - LocCode = binary_part(DynamicLocationCode, 0, 22), - <>; - _ -> - <> + false -> + <> end. -spec generate_private_key(PriFile :: string()) -> public_key:private_key(). diff --git a/docs/jinzhi.md b/docs/jinzhi.md index b4e6bd5..9b7c930 100644 --- a/docs/jinzhi.md +++ b/docs/jinzhi.md @@ -1,11 +1,11 @@ # 事件分类 ```text -23103 鼠类监测 event_code: -20407 异物占道 event_code: -10404 垃圾溢满 event_code: -22503 后厨非标着装 event_code: -23104 动火离人 event_code: +23103 鼠类监测 event_code: 11 +20407 异物占道 event_code: 13 +10404 垃圾溢满 event_code: 14 +22503 后厨非标着装 event_code: 12 +23104 动火离人 event_code: 15 ``` 1、鼠类检测 0508103010001050300001 朴苑餐厅