简要描述:
- 通过SQL和关键字直接复制插入
接口版本:
版本号 | 制定人 | 制定日期 | 修订日期 |
---|---|---|---|
v3 | 陈碧贵 | 2019-01-20 | xxxx-xx-xx |
请求URL:
http://{url参数}/bo/api/v3/{mkey}/res/{resField}/copy?nodejs=common-data&nodeq=
http://localhost:58582/bo/api/v3/bo-dep /res/manager_detail/copy?nodejs=common-data&nodeq=
- {mkey} 对应mapper文件
- {resField} 对应 {mkey}里面 responseField键
请求方式:
- POST
请求头:
参数名 | 是否必须 | 类型 | 说明 |
---|---|---|---|
XownerId | 是 | string | 项目唯一ID,对应bo_project {ownerId} |
XsysId | 否 | string | 所属系统 对应 bo_system 表 |
XtenantId | 否 | string | 所属租户 对应 owner_bo_tenant 里面 ti_tenant_info 表 |
XuserFromFirstShareId | string | 否 | 一级分享用户ID, bo_user user_id |
XuserFromSecondShareId | string | 否 | 二级分享用户ID, bo_user user_id |
XverifyApi | 是 | string | 加密规则encryptByDES(`${newGuid()} |
XfilterAreaCode | 否 | string | 行政区编码, 对应 bo_sys_area area_code |
Content-Type: | 是 | string | application/json; charset=utf-8 请求类型 |
Authorization | 是 | string | 当前用户认证信息,通过登录接口获取 Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6 |
请求参数:
{
fromField:null,
targeField:null
}
{
"targetDataTime":"2021-06-26"
,"fromDataTime":"2021-06-24"
,"batO":"ui"
}
参数名 | 是否必须 | 类型 | 说明 |
---|---|---|---|
_menuId | 是 | string | 对应表bo_sys_menu 里面menu_id, 如果需要授权的接口,_menuId必须传递 |
_nodejs | 是 | string | common-data 对应/Config/AppNodeJs/Plugins/fn- common-data.js, 通过nodejs插件,对响应结果进行二次处理 common-data 普通数据(小写驼峰)common-data-under 普通数据下划线 |
_queues | 否 | string | 主键唯一标识值 (名称根据实际进行调整) {ownerId} |
返回示例:
正确时返回:
{
code: 0,
success: true,
message: "复制:成功1条,失败0条。",
}
错误时返回:
{
"code": 0,
"message": ""
"error":{
errorCode:null,
errorText:null
}
"success": false,
}
返回参数说明:
参数名 | 类型 | 说明 |
---|---|---|
success | bool | true 表示数据请求成功(跟code=0一致),调用者优先使用 |
code | int | true 表示数据请求成功(跟code=0一致),调用者优先使用 |
data | array | |
cacheType | string | redis/sqlite/local 数据来源缓存 的类型(便于开发调试和性能优化) |
cacheDate | date | 最后数据获取时间 |
复制成果后通知websoket/redis:
"subMkey": [
{
"mkey": "idc-resource-statistics-cool",
"sortId": 1
},
{
"mkey": "idc-resource-statistics-nlsite",
"sortId": 5
},
{
"mkey": "idc-resource-statistics-warm-level",
"sortId": 10
},
{
"mkey": "idc-resource-statistics-warm-system",
"sortId": 15
}
],
复制mapper核心案例:
"month": {
"subMkey": [
{
"mkey": "idc-resource-statistics-cool",
"sortId": 1
},
{
"mkey": "idc-resource-statistics-nlsite",
"sortId": 5
},
{
"mkey": "idc-resource-statistics-warm-level",
"sortId": 10
},
{
"mkey": "idc-resource-statistics-warm-system",
"sortId": 15
}
],
"copy": {
"connName": "ConnIdc",
"rules": [
{
"regex": "fromDataTime==null ||targetDataTime==null ",
"message": "来源年月和目标年月都必须填写",
"sortId": 1
},
{
//时间列 字符串转 时间,作为下一个研究条件参数
"dateField": "targetDataTime,fromDataTime",
"regex": "fromDataTime==targetDataTime",
"message": "来源年月和目标年月不能相同",
"sortId": 5
},
{
"regex": "fromDataTimeD>targetDataTimeD||targetDataTimeD>_currentDate",
"message": "来源年月必须小于目标年月且小于当前时间",
"sortId": 6
}
],
"sql": [
{
"value": "delete from idc_resource_statistics_cool where data_date=@targetDataTime; ",
"sortId": 1
},
{
"value": "delete from idc_resource_statistics_nlsite where data_date=@targetDataTime; ",
"sortId": 5
},
{
"value": "delete from idc_resource_statistics_warm_level where data_date=@targetDataTime; ",
"sortId": 10
},
{
"value": "delete from idc_resource_statistics_warm_system where data_date=@targetDataTime; ",
"sortId": 15
},
{
"value": "insert into idc_resource_statistics_cool (audit_status,audit_time,audit_user_id,back_water_in,back_water_out,cooling_tower,create_time,create_user_id,data_date,group_id,modify_time,modify_user_id,opinion,res_enum_id,sys_id,water_storage,water_supply_in,water_supply_out) ",
"sortId": 20
},
{
"value": "select audit_status,audit_time,audit_user_id,back_water_in,back_water_out,cooling_tower,create_time,create_user_id,@targetDataTime,group_id,modify_time,modify_user_id,opinion,CONCAT(substring_index(res_enum_id, '-', 3),'-',FLOOR(RAND() * 100000),'-',@_primaryIdV) res_enum_id,sys_id,water_storage,water_supply_in,water_supply_out from idc_resource_statistics_cool where data_date=@fromDataTime;",
"sortId": 25
},
{
"value": "insert into idc_resource_statistics_nlsite (audit_status,audit_time,audit_user_id,cooling_used,create_time,create_user_id,data_date,group_id,modify_time,modify_user_id,opinion,power_used,res_enum_id,site_month,site_used,sys_id,u_month,u_used,ups_used,power_percent,cooling_percent,site_percent) ",
"sortId": 30
},
{
"value": "select audit_status,audit_time,audit_user_id,cooling_used,create_time,create_user_id,@targetDataTime,group_id,modify_time,modify_user_id,opinion,power_used,CONCAT(substring_index(res_enum_id, '-', 3),'-',FLOOR(RAND() * 100000),'-',@_primaryIdV) res_enum_id,site_month,site_used,sys_id,u_month,u_used,ups_used,power_percent,cooling_percent,site_percent from idc_resource_statistics_nlsite where data_date=@fromDataTime;",
"sortId": 35
},
{
"value": "insert into idc_resource_statistics_warm_system (audit_status,audit_time,audit_user_id,ba,create_time,create_user_id,data_date,dh,group_id,ls,mj,modify_time,modify_user_id,opinion,res_enum_id,sys_id,xf,zc) ",
"sortId": 40
},
{
"value": "select audit_status,audit_time,audit_user_id,ba,create_time,create_user_id,@targetDataTime,dh,group_id,ls,mj,modify_time,modify_user_id,opinion,CONCAT(substring_index(res_enum_id, '-', 3),'-',FLOOR(RAND() * 100000),'-',@_primaryIdV) res_enum_id,sys_id,xf,zc from idc_resource_statistics_warm_system where data_date=@fromDataTime;",
"sortId": 45
},
{
"value": "insert into idc_resource_statistics_warm_level (audit_status,audit_time,audit_user_id,create_time,create_user_id,data_date,group_id,level_cy,level_yb,level_yz,level_zy,modify_time,modify_user_id,opinion,res_enum_id,sys_id)",
"sortId": 50
},
{
"value": "select audit_status,audit_time,audit_user_id,create_time,create_user_id,@targetDataTime,group_id,level_cy,level_yb,level_yz,level_zy,modify_time,modify_user_id,opinion,CONCAT(substring_index(res_enum_id, '-', 3),'-',FLOOR(RAND() * 100000),'-',@_primaryIdV) res_enum_id,sys_id from idc_resource_statistics_warm_level where data_date=@fromDataTime;",
"sortId": 55
}
]
}
},
文档更新时间: 2023-12-11 08:11 作者:admin