# 辅助核算选项 #### 新增/更新 * 接口:/costtracking/item/save * Method:POST * 数据格式:JSON * 接口说明:每批次最多处理50条记录 ##### 请求参数 | 参数 | 类型 | 必须 | 默认值 | 主键 | 描述 | | :--- | :--- | :--- | :--- | :--- | :--- | | costTrackingName | string | Y | | | 选项属于的辅助核算名称 | | name | string | Y| | |辅助核算选项名称 | | businessCode | string | Y| | Y | 辅助核算编码 | | visibilityAuthLevel | string | Y| | | 可见性授权,默认值及历史数据为
不可授权;可选值:NONE,
RESP_USER,RESP_AND_AUTH_USER;
RESP_USER表示负责人可授权,
RESP_AND_AUTH_USER表示
负责人与可见人可授权,
NONE:不可授权 | | category | string | N ||| 辅助核算选项分类,以/分隔层次,类似A/B/C | | principal | string | N ||| 负责人工号 | | departmentBizCodes | array | N ||| 可见部门编码列表 | | employeeIds | array | N ||| 可见员工工号列表 | | active | bool | N | false || 是否启用 | | visibility | enum | N | WHITE_LIST | | 辅助核算可见性,可选值: OPEN,
WHITE_LIST; OPEN表示所有部门
可见, WHITE_LIST表示仅给定
的员工列表或部门列表可见;
默认为WHITE_LIST| | tag | string | N | | |选项属性| | subsidiaryBizCodes| array | N | | |关联业务实体编码列表,如果不提供,
则可用于所有业务实体| | source | string | N | | |来源,不同来源的辅助核算授权, 不会相互影响| | dependencyBizCode | string | N | | |依赖的辅助核算选项编码,支持多选,以逗号隔开;只有当辅助核算设置了依赖, 并且这里被依赖的选项正确时,才能设置上去 | ##### 备注 **该接口采用单条失败的处理方式,即整批数据中,如果只有其中的几条因为各种原因失败,那么只有那几条数据不会被保存;其它的数据仍然会被正常处理;错误数据的主键(name)会被放在errorData里面;** **errorData为结构体, 包含出错记录主键(name), 以及与之对应的出错信息; 类似 {"项目": "部门不存在"}; 具体参见失败实例;** **为保持向后兼容, data也会包含有和errorData相同的记录,但后续可能会改变;** ##### 示例: 请求数据 ```json { "timestamp": 123456, "data": [{ "costTrackingName": "项目", "name": "2016年3月投标A", "businessCode": "2016_3_A", "visibilityAuthLevel": "NONE", "category": "2016/3", "principal": "10001", "departmentBizCodes": ["A", "B"], "employeeIds": ["10001"], "active": true }] } ``` 返回数据\(成功) ```json { "code": "ACK", "message": "", "errorData": { "2016_3_A": "部门A不存在" } } ``` 返回数据\(失败) ```json { "code": "ACK", "message": "", "errorData": {} } ``` ### 删除 * 接口:/costtracking/item/delete * Method:DELETE * 数据格式:JSON ##### 请求参数 | 参数 | 类型 | 必须 | 描述 | | :--- | :--- | :--- | :--- | | businessCode | string | Y | 业务编码 | ##### 备注 该接口采用单条失败的处理方式,即整批数据中,如果只有其中的几条因为各种原因失败,那么只有那几条数据不会被保存;其它的数据仍然会被正常处理;错误数据的主键(businessCode)会被放在errorData里面; ##### 示例 请求: ```json { "timestamp": 123456, "data": [{ "businessCode": "2016_3_A" }, { "businessCode": "2016_3_B" }] } ``` 返回数据\(成功) ```json { "code": "ACK", "message": "", "errorData": {} } ``` ### 授权 * 接口:/costtracking/item/auth * Method:POST * 数据格式:JSON * 接口说明:该接口将辅助核算选项(增量)授权给给定的部门列表 ##### 接口参数 | 参数 | 类型 | 必须 | 默认值 | 主键 | 描述 | | :--- | :--- | :--- | :--- | :--- | :--- | | businessCode | string | Y | | Y| 辅助核算选项业务编码| | departmentBizCodes | array | | | | 授权部门列表| | employeeIds | array | || |授权人员工号列表| ##### 备注 该接口采用单条失败的处理方式,即整批数据中,如果只有其中的几条因为各种原因失败,那么只有那几条数据不会被保存;其它的数据仍然会被正常处理;错误数据的主键(businessCode)会被放在errorData里面; ##### 示例 请求数据 ```json { "timestamp": 123456, "data": [{ "businessCode": "AAA", "departmentBizCodes": ["A", "B"], "employeeIds": ["1", "2"] }] } ``` 返回数据\(成功) ```json { "code": "ACK", "message": "", "errorData": {} } ``` ### 解授权 * 接口:/costtracking/item/revoke * Method:POST * 数据格式:JSON * 接口说明:该接口将辅助核算选项收回授权给给定的部门列表;如果辅助核算没有授权给任何部门,该辅助核算将会被设置为全公司可见 ##### 接口参数 | 参数 | 类型 | 必须 | 默认值 | 主键 | 描述 | | :--- | :--- | :--- | :--- | :--- | :--- | | businessCode | string | Y | | Y| 辅助核算选项业务编码| | departmentBizCodes | array | | | | 授权部门列表| | employeeIds | array | || |授权人员工号列表| ##### 备注 该接口采用单条失败的处理方式,即整批数据中,如果只有其中的几条因为各种原因失败,那么只有那几条数据不会被保存;其它的数据仍然会被正常处理;错误数据的主键(bussinessCode)会被放在errorData里面; ##### 示例 请求数据 ```json { "timestamp": 123456, "data": [{ "businessCode": "AAAA", "departmentBizCodes": ["A", "B"], "employeeIds": ["1", "2"] }] } ``` 返回数据\(成功) ```json { "code": "ACK", "message": "", "errorData": {} } ``` ### 辅助核算选项查询接口 * 接口:/costtracking/item/getCostTrackingItem?costTrackingName=170625&start=2017-01-01&end=2019-03-03&active=true * Method:GET ##### 接口参数 | 参数 | 类型 | 必须 | 默认值 | 主键 | 描述 | | :--- | :--- | :--- | :--- | :--- | :--- | | costTrackingName | string | N | | | 辅助核算名称,精确查找,不填搜索全公司| | start | date | N | | | 更新时间区间的开始时间 格式必须为yyyy-MM-dd | | end | date | N | | | 更新时间区间的结束时间 格式同上 | | active | boolean | N | false | | 启用状态,不传这个参数代表传了false | ##### 备注 /costtracking/item/getCostTrackingItem?costTrackingName=170625&start=2017-01-01&end=2019-03-03 这个相当于/costtracking/item/getCostTrackingItem?costTrackingName=170625&start=2017-01-01&end=2019-03-03&active=false ##### 示例 请求数据 ``` /costtracking/item/getCostTrackingItemcostTrackingName=170625&start=2017-01-01&end=2019-03-03&active=true ``` 返回数据\(成功) ```json { "code": "ACK", "message": "", "data": [{ "costTrackingName": "17081501", "costTrackingItemBizCode": "item1_biz_code", "costTrackingItemName": "item1", "createdAt": 1502783124296, "updatedAt": 1502783262058, "active": true, "subsidiaryCodes": null, "visibleDepartmentCodes": null, "visibleEmployeeIds": null }, { "costTrackingName": "17081501", "costTrackingItemBizCode": "分类1-1_biz_code", "costTrackingItemName": "分类1-1", "createdAt": 1502783151820, "updatedAt": 1502783262104, "active": true, "subsidiaryCodes": null, "visibleDepartmentCodes": null, "visibleEmployeeIds": null }], "args": null, "linkDetail": false, "nonBizError": false } ```