修改

优质
小牛编辑
141浏览
2023-12-01

请求地址

https://api.es.xiaojukeji.com/river/Approval/update

返回数据格式

JSON

请求类型

POST

请求参数

参数名称数据类型必选说明
client_idstringyes申请应用时分配的AppKey
access_tokenstringyes授权后的access token
timestampstringyes当前时间戳
company_idstringyes企业ID
approval_typeintyes审批单类型(1-差旅 travel,目前只支持差旅的修改)
approval_idstringno审批单ID(创建api返回的滴滴内部审批单ID)
travel_detailobjectnoapproval_type=1必传,其余不传
extra_infojsonno扩展信息,自定义字段
signstringyes签名

1、计算签名时候,需要对travel_detail或者business_trip_detail值做 json_encode 处理成字符串格式,再参与签名;
2、approval_type=1时,用过车的城市之后的城市可以修改,之前的无法修改。

可修改内容

  1. 差旅开始时间
    仅当差旅行程未开始时(开始时间>当前时间,且差旅单下未产生有效订单),差旅开始时间允许修改,可以修改到的时间为当天之后,差旅结束时间之前
  2. 差旅结束时间
    差旅结束时间可以修改为当天及以后,即 newEndTime ≥ 当前日期 ,时间修改后,所有已用车城市的规则有效时间会被更新,未用车城市规则被删除然后重新创建
  3. 差旅行程
    3.1 当差旅制度-出差城市配置为由员工填写时未发生用车时,删除旧的差旅行程信息和规则,生成新的行程和规则。已发生用车时:已用车城市行程不允许修改,未用车城市行程可以修改。比如差旅行程为:北京-上海,上海-北京。如果上海发生了用车,那么北京-上海的行程是不允许修改的,上海-北京允许修改。
    3.2 当差旅制度-出差城市配置为无需员工填写时出发地、目的地城市传空

travel_detail

参数名称数据类型必选说明
start_datedateyes行程开始日期,如2017-01-10
end_datedateyes行程结束日期,如2017-02-01
tripsarrayno行程路线,行程使用的制度(regulation_id)中,出差城市配置为无需填写时,trips可为空。否则必传,需按照行程顺序填写
end_city_ruleintyes行程终点城市是否包含市内用车权限(0-不包含,1-包含),trips最后一行视为终点城市

trips

参数名称数据类型必选说明
departure_citystringyes出发地城市名称,如北京市
departure_city_idintyes出发地城市id
destination_citystringyes目的地城市名称,如上海市
destination_city_idintyes目的地城市id
start_datedateyes行程开始日期,如2017-01-10
end_datedateyes行程结束日期,如2017-01-20

差旅请求参数示例:

{   
    "client_id": "xxxxxx", 
    "access_token": "xxxxx", 
    "timestamp": "xxxxxx", 
    "company_id": "xxxxxx", 
    "approval_id": "xxxxxx",
    "approval_type": "1",
    "travel_detail": {
        "start_date": "xxxxxx",
        "end_date": "xxxxxx",
        "end_city_rule": "xxx",
        "trips": [
            {
                "departure_city_id": "110000",
                "departure_city": "北京",
                "destination_city_id": "310000",
                "destination_city": "上海",
                "start_date": "2017-03-01",
                "end_date": "2017-03-03"
            },
           {
                "departure_city_id": "310000",
                "departure_city": "上海",
                "destination_city_id": "410000",
                "destination_city": "深圳",
                "start_date": "2017-03-03",
                "end_date": "2017-03-05"
            },
            {
                "departure_city_id": "410000",
                "departure_city": "深圳",
                "destination_city_id": "110000",
                "destination_city": "北京",
                "start_date": "2017-03-05",
                "end_date": "2017-03-08"
            }
        ]
    },
    "sign": "xxxxxxxx"
}

请求示例

curl -X POST -H "content-type:application/json" \
-d '{"client_id":"client_id_test","access_token":"access_token_test","timestamp":1583487394,"company_id":"12345678980","phone":"11000001234","approval_id":"781948394919012","approval_type":1,"travel_detail":{"start_date":"2019-08-25","end_date":"2019-08-29","end_city_rule":1,"trips":[{"departure_city":"\u5317\u4eac\u5e02","departure_city_id":1,"destination_city":"\u4e0a\u6d77\u5e02","destination_city_id":11,"start_date":"2019-08-25","end_date":"2019-08-29"}]},"sign":"e54dbce9b2c6a60f6544507e280df77c"}' \
https://api.es.xiaojukeji.com/river/Approval/update

返回示例

{
    "errno": 0,
    "errmsg": "SUCCESS",
    "data": null

}

接口错误解决方案

通用错误解决文档

  1. 4xx 错误
  2. 1xxx 错误

50503(请求失败(审批单更新失败))

  1. 审批单id不在company_id这个公司中(请检查approval_id填写是否正确)
  2. 修改的某个行程正在使用中
  3. 修改的某个行程已经被使用过