更新
This commit is contained in:
parent
67efd8a404
commit
f91f1716ab
50
data/magic-api/api/B-传输日志/日志/保存报价询价同步日志.ms
Normal file
50
data/magic-api/api/B-传输日志/日志/保存报价询价同步日志.ms
Normal file
@ -0,0 +1,50 @@
|
||||
{
|
||||
"properties" : { },
|
||||
"id" : "copy1747380095360d17588",
|
||||
"script" : null,
|
||||
"groupId" : "6ee06a9b9fe04b85b70a9364ef324ab4",
|
||||
"name" : "保存报价询价同步日志",
|
||||
"createTime" : 1747380116583,
|
||||
"updateTime" : null,
|
||||
"lock" : null,
|
||||
"createBy" : null,
|
||||
"updateBy" : null,
|
||||
"path" : "/savepriceapprova",
|
||||
"method" : "POST",
|
||||
"parameters" : [ ],
|
||||
"options" : [ {
|
||||
"name" : "wrap_request_parameter",
|
||||
"value" : "data",
|
||||
"description" : null,
|
||||
"required" : false,
|
||||
"dataType" : "String",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : null,
|
||||
"error" : null,
|
||||
"expression" : null,
|
||||
"children" : null
|
||||
}, {
|
||||
"name" : "permission",
|
||||
"value" : "send:log:save",
|
||||
"description" : "允许拥有该权限的访问",
|
||||
"required" : false,
|
||||
"dataType" : "String",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : null,
|
||||
"error" : null,
|
||||
"expression" : null,
|
||||
"children" : null
|
||||
} ],
|
||||
"requestBody" : "",
|
||||
"headers" : [ ],
|
||||
"paths" : [ ],
|
||||
"responseBody" : null,
|
||||
"description" : null,
|
||||
"requestBodyDefinition" : null,
|
||||
"responseBodyDefinition" : null
|
||||
}
|
||||
================================
|
||||
data.create_time = new Date()
|
||||
return db.table('send_log_priceapprova').primary('log_id',uuid()).save(data)
|
50
data/magic-api/api/B-传输日志/日志/保存领料同步日志.ms
Normal file
50
data/magic-api/api/B-传输日志/日志/保存领料同步日志.ms
Normal file
@ -0,0 +1,50 @@
|
||||
{
|
||||
"properties" : { },
|
||||
"id" : "copy1747118188498d320",
|
||||
"script" : null,
|
||||
"groupId" : "6ee06a9b9fe04b85b70a9364ef324ab4",
|
||||
"name" : "保存领料同步日志",
|
||||
"createTime" : null,
|
||||
"updateTime" : 1747118204682,
|
||||
"lock" : null,
|
||||
"createBy" : null,
|
||||
"updateBy" : null,
|
||||
"path" : "/savematerialreqbill",
|
||||
"method" : "POST",
|
||||
"parameters" : [ ],
|
||||
"options" : [ {
|
||||
"name" : "wrap_request_parameter",
|
||||
"value" : "data",
|
||||
"description" : null,
|
||||
"required" : false,
|
||||
"dataType" : "String",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : null,
|
||||
"error" : null,
|
||||
"expression" : null,
|
||||
"children" : null
|
||||
}, {
|
||||
"name" : "permission",
|
||||
"value" : "send:log:save",
|
||||
"description" : "允许拥有该权限的访问",
|
||||
"required" : false,
|
||||
"dataType" : "String",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : null,
|
||||
"error" : null,
|
||||
"expression" : null,
|
||||
"children" : null
|
||||
} ],
|
||||
"requestBody" : "",
|
||||
"headers" : [ ],
|
||||
"paths" : [ ],
|
||||
"responseBody" : null,
|
||||
"description" : null,
|
||||
"requestBodyDefinition" : null,
|
||||
"responseBodyDefinition" : null
|
||||
}
|
||||
================================
|
||||
data.create_time = new Date()
|
||||
return db.table('send_log_materialreqbill').primary('log_id',uuid()).save(data)
|
126
data/magic-api/api/B-同步日志/修改报价同步.ms
Normal file
126
data/magic-api/api/B-同步日志/修改报价同步.ms
Normal file
@ -0,0 +1,126 @@
|
||||
{
|
||||
"properties" : { },
|
||||
"id" : "copy1747380151826d80978",
|
||||
"script" : null,
|
||||
"groupId" : "4506c21162d24d4c81bad5bc8707672a",
|
||||
"name" : "修改报价同步",
|
||||
"createTime" : 1747380163630,
|
||||
"updateTime" : null,
|
||||
"lock" : null,
|
||||
"createBy" : null,
|
||||
"updateBy" : null,
|
||||
"path" : "/updatepriceapprova",
|
||||
"method" : "POST",
|
||||
"parameters" : [ ],
|
||||
"options" : [ {
|
||||
"name" : "wrap_request_parameter",
|
||||
"value" : "data",
|
||||
"description" : null,
|
||||
"required" : false,
|
||||
"dataType" : "String",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : null,
|
||||
"error" : null,
|
||||
"expression" : null,
|
||||
"children" : null
|
||||
}, {
|
||||
"name" : "permission",
|
||||
"value" : "send:log:save",
|
||||
"description" : "允许拥有该权限的访问",
|
||||
"required" : false,
|
||||
"dataType" : "String",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : null,
|
||||
"error" : null,
|
||||
"expression" : null,
|
||||
"children" : null
|
||||
} ],
|
||||
"requestBody" : "",
|
||||
"headers" : [ ],
|
||||
"paths" : [ ],
|
||||
"responseBody" : "{\n \"code\": 500,\n \"message\": \"系统内部出现错误\",\n \"data\": null,\n \"timestamp\": 1701350039104,\n \"executeTime\": 4\n}",
|
||||
"description" : null,
|
||||
"requestBodyDefinition" : null,
|
||||
"responseBodyDefinition" : {
|
||||
"name" : "",
|
||||
"value" : "",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Object",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ {
|
||||
"name" : "code",
|
||||
"value" : "500",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Integer",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
}, {
|
||||
"name" : "message",
|
||||
"value" : "系统内部出现错误",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "String",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
}, {
|
||||
"name" : "data",
|
||||
"value" : "null",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Object",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
}, {
|
||||
"name" : "timestamp",
|
||||
"value" : "1701350039104",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Long",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
}, {
|
||||
"name" : "executeTime",
|
||||
"value" : "4",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Integer",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
} ]
|
||||
}
|
||||
}
|
||||
================================
|
||||
|
||||
|
||||
|
||||
data.update_time = new Date()
|
||||
return db.table("send_syn_priceapprova").primary('send_id')
|
||||
.update(data)
|
126
data/magic-api/api/B-同步日志/修改领料同步.ms
Normal file
126
data/magic-api/api/B-同步日志/修改领料同步.ms
Normal file
@ -0,0 +1,126 @@
|
||||
{
|
||||
"properties" : { },
|
||||
"id" : "copy1747118253162d84764",
|
||||
"script" : null,
|
||||
"groupId" : "4506c21162d24d4c81bad5bc8707672a",
|
||||
"name" : "修改领料同步",
|
||||
"createTime" : null,
|
||||
"updateTime" : 1747129492177,
|
||||
"lock" : null,
|
||||
"createBy" : null,
|
||||
"updateBy" : null,
|
||||
"path" : "/updatematerialreqbill",
|
||||
"method" : "POST",
|
||||
"parameters" : [ ],
|
||||
"options" : [ {
|
||||
"name" : "wrap_request_parameter",
|
||||
"value" : "data",
|
||||
"description" : null,
|
||||
"required" : false,
|
||||
"dataType" : "String",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : null,
|
||||
"error" : null,
|
||||
"expression" : null,
|
||||
"children" : null
|
||||
}, {
|
||||
"name" : "permission",
|
||||
"value" : "send:log:save",
|
||||
"description" : "允许拥有该权限的访问",
|
||||
"required" : false,
|
||||
"dataType" : "String",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : null,
|
||||
"error" : null,
|
||||
"expression" : null,
|
||||
"children" : null
|
||||
} ],
|
||||
"requestBody" : "",
|
||||
"headers" : [ ],
|
||||
"paths" : [ ],
|
||||
"responseBody" : "{\n \"code\": 500,\n \"message\": \"系统内部出现错误\",\n \"data\": null,\n \"timestamp\": 1701350039104,\n \"executeTime\": 4\n}",
|
||||
"description" : null,
|
||||
"requestBodyDefinition" : null,
|
||||
"responseBodyDefinition" : {
|
||||
"name" : "",
|
||||
"value" : "",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Object",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ {
|
||||
"name" : "code",
|
||||
"value" : "500",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Integer",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
}, {
|
||||
"name" : "message",
|
||||
"value" : "系统内部出现错误",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "String",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
}, {
|
||||
"name" : "data",
|
||||
"value" : "null",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Object",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
}, {
|
||||
"name" : "timestamp",
|
||||
"value" : "1701350039104",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Long",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
}, {
|
||||
"name" : "executeTime",
|
||||
"value" : "4",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Integer",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
} ]
|
||||
}
|
||||
}
|
||||
================================
|
||||
|
||||
|
||||
|
||||
data.update_time = new Date()
|
||||
return db.table("send_syn_materialreqbill").primary('send_id')
|
||||
.update(data)
|
126
data/magic-api/api/B-同步日志/报价待同步保存.ms
Normal file
126
data/magic-api/api/B-同步日志/报价待同步保存.ms
Normal file
@ -0,0 +1,126 @@
|
||||
{
|
||||
"properties" : { },
|
||||
"id" : "copy1747380139022d12449",
|
||||
"script" : null,
|
||||
"groupId" : "4506c21162d24d4c81bad5bc8707672a",
|
||||
"name" : "报价待同步保存",
|
||||
"createTime" : 1747380149469,
|
||||
"updateTime" : null,
|
||||
"lock" : null,
|
||||
"createBy" : null,
|
||||
"updateBy" : null,
|
||||
"path" : "/savepriceapprova",
|
||||
"method" : "POST",
|
||||
"parameters" : [ ],
|
||||
"options" : [ {
|
||||
"name" : "wrap_request_parameter",
|
||||
"value" : "data",
|
||||
"description" : null,
|
||||
"required" : false,
|
||||
"dataType" : "String",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : null,
|
||||
"error" : null,
|
||||
"expression" : null,
|
||||
"children" : null
|
||||
}, {
|
||||
"name" : "permission",
|
||||
"value" : "send:log:save",
|
||||
"description" : "允许拥有该权限的访问",
|
||||
"required" : false,
|
||||
"dataType" : "String",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : null,
|
||||
"error" : null,
|
||||
"expression" : null,
|
||||
"children" : null
|
||||
} ],
|
||||
"requestBody" : "",
|
||||
"headers" : [ ],
|
||||
"paths" : [ ],
|
||||
"responseBody" : "{\n \"code\": 200,\n \"message\": \"success\",\n \"data\": \"17a8bc5553e2400badd36ea784255c01\",\n \"timestamp\": 1701350036264,\n \"executeTime\": 4\n}",
|
||||
"description" : null,
|
||||
"requestBodyDefinition" : null,
|
||||
"responseBodyDefinition" : {
|
||||
"name" : "",
|
||||
"value" : "",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Object",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ {
|
||||
"name" : "code",
|
||||
"value" : "200",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Integer",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
}, {
|
||||
"name" : "message",
|
||||
"value" : "success",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "String",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
}, {
|
||||
"name" : "data",
|
||||
"value" : "17a8bc5553e2400badd36ea784255c01",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "String",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
}, {
|
||||
"name" : "timestamp",
|
||||
"value" : "1701350036264",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Long",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
}, {
|
||||
"name" : "executeTime",
|
||||
"value" : "4",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Integer",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
} ]
|
||||
}
|
||||
}
|
||||
================================
|
||||
|
||||
|
||||
|
||||
data.create_time = new Date()
|
||||
return db.table("send_syn_priceapprova").primary('send_id', () => uuid())
|
||||
.save(data)
|
173
data/magic-api/api/B-同步日志/查询报价同步日志.ms
Normal file
173
data/magic-api/api/B-同步日志/查询报价同步日志.ms
Normal file
@ -0,0 +1,173 @@
|
||||
{
|
||||
"properties" : { },
|
||||
"id" : "copy1747380121763d51481",
|
||||
"script" : null,
|
||||
"groupId" : "4506c21162d24d4c81bad5bc8707672a",
|
||||
"name" : "查询报价同步日志",
|
||||
"createTime" : null,
|
||||
"updateTime" : 1747380132413,
|
||||
"lock" : null,
|
||||
"createBy" : null,
|
||||
"updateBy" : null,
|
||||
"path" : "/querypriceapprova",
|
||||
"method" : "GET",
|
||||
"parameters" : [ {
|
||||
"name" : "sendType",
|
||||
"value" : "TuiHuo",
|
||||
"description" : null,
|
||||
"required" : false,
|
||||
"dataType" : "String",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : null,
|
||||
"error" : null,
|
||||
"expression" : null,
|
||||
"children" : null
|
||||
}, {
|
||||
"name" : "sendStatus3",
|
||||
"value" : "3",
|
||||
"description" : null,
|
||||
"required" : false,
|
||||
"dataType" : "String",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : null,
|
||||
"error" : null,
|
||||
"expression" : null,
|
||||
"children" : null
|
||||
}, {
|
||||
"name" : "crmId",
|
||||
"value" : "665532391d23d0000111cab9",
|
||||
"description" : null,
|
||||
"required" : false,
|
||||
"dataType" : "String",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : null,
|
||||
"error" : null,
|
||||
"expression" : null,
|
||||
"children" : null
|
||||
}, {
|
||||
"name" : "sendSyn",
|
||||
"value" : "0",
|
||||
"description" : null,
|
||||
"required" : false,
|
||||
"dataType" : "String",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : null,
|
||||
"error" : null,
|
||||
"expression" : null,
|
||||
"children" : null
|
||||
} ],
|
||||
"options" : [ ],
|
||||
"requestBody" : "",
|
||||
"headers" : [ ],
|
||||
"paths" : [ ],
|
||||
"responseBody" : "{\n \"code\": 200,\n \"message\": \"success\",\n \"data\": [],\n \"timestamp\": 1716889610473,\n \"executeTime\": 8\n}",
|
||||
"description" : null,
|
||||
"requestBodyDefinition" : null,
|
||||
"responseBodyDefinition" : {
|
||||
"name" : "",
|
||||
"value" : "",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Object",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ {
|
||||
"name" : "code",
|
||||
"value" : "200",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Integer",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
}, {
|
||||
"name" : "message",
|
||||
"value" : "success",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "String",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
}, {
|
||||
"name" : "data",
|
||||
"value" : "",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Array",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
}, {
|
||||
"name" : "timestamp",
|
||||
"value" : "1716889610473",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Long",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
}, {
|
||||
"name" : "executeTime",
|
||||
"value" : "8",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Integer",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
} ]
|
||||
}
|
||||
}
|
||||
================================
|
||||
//查询本机mysql
|
||||
return db.select(
|
||||
"""
|
||||
SELECT * FROM `send_syn_priceapprova` where
|
||||
send_type=#{sendType}
|
||||
<if test="dataId != null">
|
||||
and dsf_id=#{dataId}
|
||||
</if>
|
||||
<if test="datapId != null">
|
||||
and dsfzhu_id=#{datapId}
|
||||
</if>
|
||||
<if test="sendSyn != null">
|
||||
and send_syn=#{sendSyn}
|
||||
</if>
|
||||
<if test="sendStatus != null">
|
||||
and send_status=#{sendStatus}
|
||||
</if>
|
||||
<if test="crmId != null">
|
||||
and crm_id=#{crmId}
|
||||
</if>
|
||||
<if test="dsfId != null">
|
||||
and dsf_id=#{dsfId}
|
||||
</if>
|
||||
<if test="sendStatus3 != null">
|
||||
and send_status!=#{sendStatus3}
|
||||
</if>
|
||||
order by create_time desc
|
||||
|
||||
""");
|
173
data/magic-api/api/B-同步日志/查询领料同步日志.ms
Normal file
173
data/magic-api/api/B-同步日志/查询领料同步日志.ms
Normal file
@ -0,0 +1,173 @@
|
||||
{
|
||||
"properties" : { },
|
||||
"id" : "copy1747118211168d30333",
|
||||
"script" : null,
|
||||
"groupId" : "4506c21162d24d4c81bad5bc8707672a",
|
||||
"name" : "查询领料同步日志",
|
||||
"createTime" : null,
|
||||
"updateTime" : 1747118228927,
|
||||
"lock" : null,
|
||||
"createBy" : null,
|
||||
"updateBy" : null,
|
||||
"path" : "/querymaterialreqbill",
|
||||
"method" : "GET",
|
||||
"parameters" : [ {
|
||||
"name" : "sendType",
|
||||
"value" : "TuiHuo",
|
||||
"description" : null,
|
||||
"required" : false,
|
||||
"dataType" : "String",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : null,
|
||||
"error" : null,
|
||||
"expression" : null,
|
||||
"children" : null
|
||||
}, {
|
||||
"name" : "sendStatus3",
|
||||
"value" : "3",
|
||||
"description" : null,
|
||||
"required" : false,
|
||||
"dataType" : "String",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : null,
|
||||
"error" : null,
|
||||
"expression" : null,
|
||||
"children" : null
|
||||
}, {
|
||||
"name" : "crmId",
|
||||
"value" : "665532391d23d0000111cab9",
|
||||
"description" : null,
|
||||
"required" : false,
|
||||
"dataType" : "String",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : null,
|
||||
"error" : null,
|
||||
"expression" : null,
|
||||
"children" : null
|
||||
}, {
|
||||
"name" : "sendSyn",
|
||||
"value" : "0",
|
||||
"description" : null,
|
||||
"required" : false,
|
||||
"dataType" : "String",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : null,
|
||||
"error" : null,
|
||||
"expression" : null,
|
||||
"children" : null
|
||||
} ],
|
||||
"options" : [ ],
|
||||
"requestBody" : "",
|
||||
"headers" : [ ],
|
||||
"paths" : [ ],
|
||||
"responseBody" : "{\n \"code\": 200,\n \"message\": \"success\",\n \"data\": [],\n \"timestamp\": 1716889610473,\n \"executeTime\": 8\n}",
|
||||
"description" : null,
|
||||
"requestBodyDefinition" : null,
|
||||
"responseBodyDefinition" : {
|
||||
"name" : "",
|
||||
"value" : "",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Object",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ {
|
||||
"name" : "code",
|
||||
"value" : "200",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Integer",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
}, {
|
||||
"name" : "message",
|
||||
"value" : "success",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "String",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
}, {
|
||||
"name" : "data",
|
||||
"value" : "",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Array",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
}, {
|
||||
"name" : "timestamp",
|
||||
"value" : "1716889610473",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Long",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
}, {
|
||||
"name" : "executeTime",
|
||||
"value" : "8",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Integer",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
} ]
|
||||
}
|
||||
}
|
||||
================================
|
||||
//查询本机mysql
|
||||
return db.select(
|
||||
"""
|
||||
SELECT * FROM `send_syn_materialreqbill` where
|
||||
send_type=#{sendType}
|
||||
<if test="dataId != null">
|
||||
and dsf_id=#{dataId}
|
||||
</if>
|
||||
<if test="datapId != null">
|
||||
and dsfzhu_id=#{datapId}
|
||||
</if>
|
||||
<if test="sendSyn != null">
|
||||
and send_syn=#{sendSyn}
|
||||
</if>
|
||||
<if test="sendStatus != null">
|
||||
and send_status=#{sendStatus}
|
||||
</if>
|
||||
<if test="crmId != null">
|
||||
and crm_id=#{crmId}
|
||||
</if>
|
||||
<if test="dsfId != null">
|
||||
and dsf_id=#{dsfId}
|
||||
</if>
|
||||
<if test="sendStatus3 != null">
|
||||
and send_status!=#{sendStatus3}
|
||||
</if>
|
||||
order by create_time desc
|
||||
|
||||
""");
|
126
data/magic-api/api/B-同步日志/领料待同步保存.ms
Normal file
126
data/magic-api/api/B-同步日志/领料待同步保存.ms
Normal file
@ -0,0 +1,126 @@
|
||||
{
|
||||
"properties" : { },
|
||||
"id" : "copy1747118238121d79879",
|
||||
"script" : null,
|
||||
"groupId" : "4506c21162d24d4c81bad5bc8707672a",
|
||||
"name" : "领料待同步保存",
|
||||
"createTime" : null,
|
||||
"updateTime" : 1747118249721,
|
||||
"lock" : null,
|
||||
"createBy" : null,
|
||||
"updateBy" : null,
|
||||
"path" : "/savematerialreqbill",
|
||||
"method" : "POST",
|
||||
"parameters" : [ ],
|
||||
"options" : [ {
|
||||
"name" : "wrap_request_parameter",
|
||||
"value" : "data",
|
||||
"description" : null,
|
||||
"required" : false,
|
||||
"dataType" : "String",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : null,
|
||||
"error" : null,
|
||||
"expression" : null,
|
||||
"children" : null
|
||||
}, {
|
||||
"name" : "permission",
|
||||
"value" : "send:log:save",
|
||||
"description" : "允许拥有该权限的访问",
|
||||
"required" : false,
|
||||
"dataType" : "String",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : null,
|
||||
"error" : null,
|
||||
"expression" : null,
|
||||
"children" : null
|
||||
} ],
|
||||
"requestBody" : "",
|
||||
"headers" : [ ],
|
||||
"paths" : [ ],
|
||||
"responseBody" : "{\n \"code\": 200,\n \"message\": \"success\",\n \"data\": \"17a8bc5553e2400badd36ea784255c01\",\n \"timestamp\": 1701350036264,\n \"executeTime\": 4\n}",
|
||||
"description" : null,
|
||||
"requestBodyDefinition" : null,
|
||||
"responseBodyDefinition" : {
|
||||
"name" : "",
|
||||
"value" : "",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Object",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ {
|
||||
"name" : "code",
|
||||
"value" : "200",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Integer",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
}, {
|
||||
"name" : "message",
|
||||
"value" : "success",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "String",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
}, {
|
||||
"name" : "data",
|
||||
"value" : "17a8bc5553e2400badd36ea784255c01",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "String",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
}, {
|
||||
"name" : "timestamp",
|
||||
"value" : "1701350036264",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Long",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
}, {
|
||||
"name" : "executeTime",
|
||||
"value" : "4",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Integer",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
} ]
|
||||
}
|
||||
}
|
||||
================================
|
||||
|
||||
|
||||
|
||||
data.create_time = new Date()
|
||||
return db.table("send_syn_materialreqbill").primary('send_id', () => uuid())
|
||||
.save(data)
|
@ -50,7 +50,7 @@ public class ProjectNewOpportunityController {
|
||||
);*/
|
||||
|
||||
|
||||
List<CrmFXApiParam> paramList = Arrays.asList(new CrmFXApiParam("EQ", "name", "华润新能源(禹城)风力发电场项目"));
|
||||
List<CrmFXApiParam> paramList = Arrays.asList(new CrmFXApiParam("EQ", "name", "集成测试-商机"));
|
||||
|
||||
JSONObject jsonject = fxapi.getSynNewDataObj(false, "商机", apiName, paramList);
|
||||
JSONArray array = jsonject.getJSONObject("data").getJSONArray("dataList");
|
||||
@ -140,13 +140,13 @@ public class ProjectNewOpportunityController {
|
||||
|
||||
//编码
|
||||
datajson.put("number",number);
|
||||
datajson.put("group_number","01");//项目分类
|
||||
datajson.put("group_number","XM-01");//项目分类
|
||||
datajson.put("name",nameData);//项目名称
|
||||
datajson.put("f9w5_crmid",dataId);//CRMID
|
||||
datajson.put("enable","1");//使用状态
|
||||
datajson.put("status","C");//数据状态
|
||||
//创建组织
|
||||
datajson.put("createorg_number","zycxjtpoc.test");
|
||||
datajson.put("createorg_number","zyierp");
|
||||
dataarr.add(datajson);
|
||||
params.put("data",dataarr);
|
||||
log.info("--请求json---" + params.toJSONString());
|
||||
@ -168,12 +168,12 @@ public class ProjectNewOpportunityController {
|
||||
*/
|
||||
public void getSynDataSave(StringBuffer stringBuffer,Boolean sendFlag,FXHTTP fxapi,String dataId,String nameData,String obj,JSONObject str) {
|
||||
String syn_type = "0";//同步类型 0新增 1修改 2删除
|
||||
String res_url = "http://192.168.31.158:8022/ierp/kapi/v2/f9w5/basedata/bd_project/projectSave";
|
||||
String res_url = "http://192.168.31.233:8022/ierp/kapi/v2/f9w5/basedata/bd_project/projectSave";
|
||||
String res_param = obj;
|
||||
String res = "";
|
||||
try {
|
||||
String accessToken = "2096108315279888384_hjuaG4aAhb6aY7DOaoUmDLzx4lBXY3q4q5n7PvEVsq740PNMWx1X1q4CD1wljgW33pj5Ie8lbXCG3a2CIDFgxqGrmo2TCg5ss6kY03";
|
||||
// String accessToken = new KDTokenController().getKDAccessToken();
|
||||
//String accessToken = "2096108315279888384_hjuaG4aAhb6aY7DOaoUmDLzx4lBXY3q4q5n7PvEVsq740PNMWx1X1q4CD1wljgW33pj5Ie8lbXCG3a2CIDFgxqGrmo2TCg5ss6kY03";
|
||||
String accessToken = new KDTokenController().getKDAccessTokenTest();
|
||||
|
||||
|
||||
Map<String, String> headers = new HashMap<String, String>();
|
||||
@ -350,7 +350,7 @@ public class ProjectNewOpportunityController {
|
||||
datajson.put("enable","2");//使用状态 禁用
|
||||
datajson.put("status","C");//数据状态
|
||||
//创建组织
|
||||
datajson.put("createorg_number","zycxjtpoc.test");
|
||||
datajson.put("createorg_number","zyierp");
|
||||
dataarr.add(datajson);
|
||||
params.put("data",dataarr);
|
||||
log.info("--请求json---" + params.toJSONString());
|
||||
|
@ -50,7 +50,7 @@ public class ProjectObjController {
|
||||
);*/
|
||||
|
||||
|
||||
List<CrmFXApiParam> paramList = Arrays.asList(new CrmFXApiParam("EQ", "name", "测试"));
|
||||
List<CrmFXApiParam> paramList = Arrays.asList(new CrmFXApiParam("EQ", "name", "集成测试--预签-设计文件"));
|
||||
|
||||
JSONObject jsonject = fxapi.getSynNewDataObj(false, "项目启动单", apiName, paramList);
|
||||
JSONArray array = jsonject.getJSONObject("data").getJSONArray("dataList");
|
||||
@ -140,13 +140,13 @@ public class ProjectObjController {
|
||||
|
||||
//编码
|
||||
datajson.put("number",number);
|
||||
datajson.put("group_number","02");//项目分类
|
||||
datajson.put("group_number","XM-01");//项目分类
|
||||
datajson.put("name",nameData);//项目名称
|
||||
datajson.put("f9w5_crmid",dataId);//CRMID
|
||||
datajson.put("enable","1");//使用状态
|
||||
datajson.put("status","C");//数据状态
|
||||
//创建组织
|
||||
datajson.put("createorg_number","zycxjtpoc.test");
|
||||
datajson.put("createorg_number","zyierp");
|
||||
dataarr.add(datajson);
|
||||
params.put("data",dataarr);
|
||||
log.info("--请求json---" + params.toJSONString());
|
||||
@ -168,12 +168,12 @@ public class ProjectObjController {
|
||||
*/
|
||||
public void getSynDataSave(StringBuffer stringBuffer,Boolean sendFlag,FXHTTP fxapi,String dataId,String nameData,String obj,JSONObject str) {
|
||||
String syn_type = "0";//同步类型 0新增 1修改 2删除
|
||||
String res_url = "http://192.168.31.158:8022/ierp/kapi/v2/f9w5/basedata/bd_project/projectSave";
|
||||
String res_url = "http://192.168.31.233:8022/ierp/kapi/v2/f9w5/basedata/bd_project/projectSave";
|
||||
String res_param = obj;
|
||||
String res = "";
|
||||
try {
|
||||
String accessToken = "2096108315279888384_sk2dyYgkHyM1NTWf3w6iZuCElVY8wY7OPRb27af3EAkuzbsSbQChg0AMt5hoLGUqHVkDmHsucRLvpyd8FoS77k46strtfebvRzp205";
|
||||
// String accessToken = new KDTokenController().getKDAccessToken();
|
||||
// String accessToken = "2096108315279888384_sk2dyYgkHyM1NTWf3w6iZuCElVY8wY7OPRb27af3EAkuzbsSbQChg0AMt5hoLGUqHVkDmHsucRLvpyd8FoS77k46strtfebvRzp205";
|
||||
String accessToken = new KDTokenController().getKDAccessTokenTest();
|
||||
|
||||
|
||||
Map<String, String> headers = new HashMap<String, String>();
|
||||
|
@ -59,7 +59,7 @@ public class UsceController {
|
||||
datajson.put("createtime", "2012-02-26 11:04:43");
|
||||
JSONArray arr = new JSONArray();
|
||||
String[] strings = {
|
||||
"王小龙"
|
||||
"苗依达"
|
||||
};
|
||||
|
||||
// 将字符串添加到 JSONArray 中
|
||||
@ -185,9 +185,11 @@ public class UsceController {
|
||||
|
||||
JSONArray entryentity = str.getJSONArray("entryentity");
|
||||
String deptNumber = "";
|
||||
String position = "";
|
||||
if (entryentity != null) {
|
||||
JSONObject deptobj = (JSONObject) entryentity.get(0);
|
||||
deptNumber = deptobj.getString("dpt_number");
|
||||
position = deptobj.getString("position");
|
||||
}
|
||||
|
||||
|
||||
@ -222,6 +224,7 @@ public class UsceController {
|
||||
map.put("body.data.object_data.field_T1xid__c", number);//编码
|
||||
map.put("body.data.object_data.user_name", phone);
|
||||
map.put("body.data.object_data.email", email);
|
||||
map.put("body.data.object_data.position", position);
|
||||
|
||||
if (enable.equals("2")) {
|
||||
map.put("body.data.object_data.status", "1");
|
||||
|
@ -29,8 +29,8 @@ public class customerController {
|
||||
static Logger log = LoggerFactory.getLogger("customer");
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
new customerController().getSynDataUpdate();
|
||||
new customerController().getSynKHUPdate();
|
||||
new customerController().getSynDataAdd();
|
||||
new customerController().getSynKH();
|
||||
|
||||
}
|
||||
|
||||
@ -44,15 +44,15 @@ public class customerController {
|
||||
|
||||
String apiName = "AccountObj";
|
||||
|
||||
List<CrmFXApiParam> paramList = Arrays.asList(
|
||||
/* List<CrmFXApiParam> paramList = Arrays.asList(
|
||||
new CrmFXApiParam("GT", "last_modified_time", System.currentTimeMillis() - (1000 * 60 * 60 * 24)),
|
||||
new CrmFXApiParam("IS", "erp_id__c", ""),
|
||||
new CrmFXApiParam("ISN", "erp_category__c", ""),
|
||||
new CrmFXApiParam("EQ", "life_status", "normal")
|
||||
);
|
||||
);*/
|
||||
|
||||
|
||||
/* List<CrmFXApiParam> paramList = Arrays.asList(new CrmFXApiParam("EQ", "name", "河北省水利行业协会"));*/
|
||||
List<CrmFXApiParam> paramList = Arrays.asList(new CrmFXApiParam("EQ", "name", "灵宝市窄口水务管理局"));
|
||||
|
||||
JSONObject jsonject = fxapi.getSynNewDataObj(false, "客户", apiName, paramList);
|
||||
JSONArray array = jsonject.getJSONObject("data").getJSONArray("dataList");
|
||||
@ -166,8 +166,53 @@ public class customerController {
|
||||
groupstandardarr.add(groupstandardjson);
|
||||
datajson.put("entry_groupstandard",groupstandardarr);//分类标准
|
||||
|
||||
|
||||
|
||||
JSONArray lxrarr = new JSONArray();
|
||||
JSONObject jsonjectZ = fxapi.getSynDataObj("客户下联系人", "ContactObj", "account_id", dataId);
|
||||
JSONArray arrayZ = jsonjectZ.getJSONObject("data").getJSONArray("dataList");
|
||||
if (!arrayZ.isEmpty()){
|
||||
for (int j = 0; j < arrayZ.size(); j++) {
|
||||
|
||||
JSONObject stra = arrayZ.getJSONObject(j);
|
||||
JSONObject lxrjson = new JSONObject();
|
||||
lxrjson.put("contactperson",GcjJson.getNodeValue(stra, "JSON.name"));
|
||||
lxrjson.put("contactpersonpost",GcjJson.getNodeValue(stra, "JSON.job_title"));
|
||||
lxrjson.put("dept",GcjJson.getNodeValue(stra, "JSON.department"));
|
||||
lxrjson.put("email",GcjJson.getNodeValue(stra, "JSON.email"));
|
||||
lxrjson.put("phone",GcjJson.getNodeValue(stra, "JSON.mobile1"));
|
||||
if(j==0){
|
||||
lxrjson.put("isdefault_linkman",true);
|
||||
}
|
||||
|
||||
lxrarr.add(lxrjson);
|
||||
}
|
||||
datajson.put("entry_linkman",lxrarr);//联系人
|
||||
}
|
||||
|
||||
JSONArray groupstandardarr2 = new JSONArray();
|
||||
JSONObject groupstandardjson2 = new JSONObject();
|
||||
groupstandardjson2.put("bank_number","001100001509");
|
||||
groupstandardjson2.put("accountname","1");
|
||||
groupstandardjson2.put("currency_number","CNY");
|
||||
groupstandardjson2.put("bankaccount","1");
|
||||
groupstandardjson2.put("isdefault_bank",true);
|
||||
groupstandardarr2.add(groupstandardjson2);
|
||||
|
||||
|
||||
JSONObject groupstandardjson3 = new JSONObject();
|
||||
groupstandardjson3.put("bank_number","001110012009");
|
||||
groupstandardjson3.put("accountname","2");
|
||||
groupstandardjson3.put("currency_number","CNY");
|
||||
groupstandardjson3.put("bankaccount","2");
|
||||
groupstandardjson3.put("isdefault_bank",false);
|
||||
groupstandardarr2.add(groupstandardjson3);
|
||||
|
||||
|
||||
datajson.put("entry_bank",groupstandardarr2);//银行信息
|
||||
|
||||
//创建组织
|
||||
datajson.put("createorg_number","zycxjtpoc.test");
|
||||
datajson.put("createorg_number","zyierp");
|
||||
dataarr.add(datajson);
|
||||
params.put("data",dataarr);
|
||||
log.info("--请求json---" + params.toJSONString());
|
||||
@ -189,12 +234,12 @@ public class customerController {
|
||||
*/
|
||||
public void getSynDataSave(StringBuffer stringBuffer,Boolean sendFlag,FXHTTP fxapi,String dataId,String nameData,String obj,JSONObject str) {
|
||||
String syn_type = "0";//同步类型 0新增 1修改 2删除
|
||||
String res_url = "http://192.168.31.158:8022/ierp/kapi/v2/f9w5/basedata/bd_customer/customerSave";
|
||||
String res_url = "http://192.168.31.233:8022/ierp/kapi/v2/f9w5/basedata/bd_customer/customerSave";
|
||||
String res_param = obj;
|
||||
String res = "";
|
||||
try {
|
||||
// String token = "2096108315279888384_HJyMZK1Lco9gSZUKU1ipq85P5J32eQDdaz8WgChd1DvHrPZylIodiBmBYa8U2smKVC8MKAspXtjNQ2Fjw5MlWXDnkn5nPFPQWzSB03";
|
||||
String accessToken = new KDTokenController().getKDAccessToken();
|
||||
String accessToken = new KDTokenController().getKDAccessTokenTest();
|
||||
|
||||
|
||||
Map<String, String> headers = new HashMap<String, String>();
|
||||
@ -278,7 +323,7 @@ public class customerController {
|
||||
);*/
|
||||
|
||||
|
||||
List<CrmFXApiParam> paramList = Arrays.asList(new CrmFXApiParam("EQ", "name", "河北省水利行业协会"));
|
||||
List<CrmFXApiParam> paramList = Arrays.asList(new CrmFXApiParam("EQ", "name", "国网湖北省电力有限公司武汉供电公司"));
|
||||
|
||||
JSONObject jsonject = fxapi.getSynNewDataObj(false, "客户", apiName, paramList);
|
||||
JSONArray array = jsonject.getJSONObject("data").getJSONArray("dataList");
|
||||
@ -382,7 +427,7 @@ public class customerController {
|
||||
//编码
|
||||
datajson.put("number",account_no);
|
||||
datajson.put("paymentcurrency_number","CNY");//付款币种.货币代码
|
||||
datajson.put("name",nameData);//客户名称
|
||||
datajson.put("name","新-"+nameData);//客户名称
|
||||
datajson.put("f9w5_crmid",dataId);//CRMID
|
||||
// datajson.put("settlementtypeid_number","JSFS04");//结算方式
|
||||
|
||||
@ -393,8 +438,32 @@ public class customerController {
|
||||
groupstandardarr.add(groupstandardjson);
|
||||
datajson.put("entry_groupstandard",groupstandardarr);//分类标准
|
||||
|
||||
|
||||
JSONArray groupstandardarr2 = new JSONArray();
|
||||
JSONObject groupstandardjson2 = new JSONObject();
|
||||
groupstandardjson2.put("bank_number","001100001509");
|
||||
groupstandardjson2.put("accountname","1");
|
||||
groupstandardjson2.put("currency_number","CNY");
|
||||
groupstandardjson2.put("bankaccount","1");
|
||||
groupstandardjson2.put("isdefault_bank",true);
|
||||
groupstandardarr2.add(groupstandardjson2);
|
||||
|
||||
|
||||
JSONObject groupstandardjson3 = new JSONObject();
|
||||
groupstandardjson3.put("bank_number","001110012009");
|
||||
groupstandardjson3.put("accountname","2");
|
||||
groupstandardjson3.put("currency_number","CNY");
|
||||
groupstandardjson3.put("bankaccount","2");
|
||||
groupstandardjson3.put("isdefault_bank",false);
|
||||
groupstandardarr2.add(groupstandardjson3);
|
||||
|
||||
|
||||
datajson.put("entry_bank",groupstandardarr2);//银行信息
|
||||
|
||||
|
||||
|
||||
//创建组织
|
||||
datajson.put("createorg_number","zycxjtpoc.test");
|
||||
datajson.put("createorg_number","zyierp");
|
||||
dataarr.add(datajson);
|
||||
params.put("data",dataarr);
|
||||
log.info("--请求json---" + params.toJSONString());
|
||||
@ -414,12 +483,12 @@ public class customerController {
|
||||
|
||||
public void getSynDataSaveup(StringBuffer stringBuffer,Boolean sendFlag,FXHTTP fxapi,String dataId,String nameData,String obj,JSONObject str) {
|
||||
String syn_type = "1";//同步类型 0新增 1修改 2删除
|
||||
String res_url = "http://192.168.31.158:8022/ierp/kapi/v2/f9w5/basedata/bd_customer/customerSave";
|
||||
String res_url = "http://192.168.31.233:8022/ierp/kapi/v2/f9w5/basedata/bd_customer/customerSave";
|
||||
String res_param = obj;
|
||||
String res = "";
|
||||
try {
|
||||
// String token = "2096108315279888384_HJyMZK1Lco9gSZUKU1ipq85P5J32eQDdaz8WgChd1DvHrPZylIodiBmBYa8U2smKVC8MKAspXtjNQ2Fjw5MlWXDnkn5nPFPQWzSB03";
|
||||
String accessToken = new KDTokenController().getKDAccessToken();
|
||||
String accessToken = new KDTokenController().getKDAccessTokenTest();
|
||||
|
||||
|
||||
|
||||
|
@ -42,7 +42,7 @@ public class customergroupController {
|
||||
Boolean sendFlag = false;//是否阻断
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
|
||||
String sendUrl = "http://192.168.31.158:8022/ierp/kapi/v2/f9w5/basedata/bd_customergroup/customergroupSave";
|
||||
String sendUrl = "http://192.168.31.233:8022/ierp/kapi/v2/f9w5/basedata/bd_customergroup/customergroupSave";
|
||||
String sendBody = "";
|
||||
String sendRes = "";
|
||||
|
||||
@ -63,7 +63,7 @@ public class customergroupController {
|
||||
|
||||
|
||||
// String token = "2096108315279888384_Y8HeV0864EhPN9oPNs57p3B6tpFipZoQB6NMm1aczKr1QGotVhrr6FIpOfz4H67lNpol7NvBPXIb93t8U2UddG1SFKdXy5h78Sl502";
|
||||
String accessToken = new KDTokenController().getKDAccessToken();
|
||||
String accessToken = new KDTokenController().getKDAccessTokenTest();
|
||||
|
||||
if (accessToken == null || accessToken.equals("")) {
|
||||
logger.info("金蝶token为空或不存在");
|
||||
@ -80,7 +80,10 @@ public class customergroupController {
|
||||
|
||||
datajson.put("number",value);
|
||||
datajson.put("name",label);
|
||||
datajson.put("parent_number","01");//上级是中国
|
||||
datajson.put("parent_number","K001");//上级是中国
|
||||
datajson.put("standard_number","JBFLBZ");//基本分类标准
|
||||
datajson.put("createorg_number","zyierp");//上级是中国
|
||||
|
||||
|
||||
dataarr.add(datajson);
|
||||
params.put("data",dataarr);
|
||||
|
@ -0,0 +1,324 @@
|
||||
package org.ssssssss.magicboot.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.xxl.job.core.context.XxlJobHelper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.ssssssss.magicboot.fxapi.HttpClientResult;
|
||||
import org.ssssssss.magicboot.fxapi.HttpClientUtils;
|
||||
import org.ssssssss.magicboot.fxapi.XKTokenAccess;
|
||||
import org.ssssssss.magicboot.fxapi.model.CrmFXApiParam;
|
||||
import org.ssssssss.magicboot.zdyutils.FXHTTP;
|
||||
import org.ssssssss.magicboot.zdyutils.GcjJson;
|
||||
import org.ssssssss.magicboot.zdyutils.MagicApi;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/materialreqbill")
|
||||
public class materialreqbillController {
|
||||
static Logger log = LoggerFactory.getLogger("customer");
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
// new materialreqbillController().getSynDataAdd();
|
||||
new materialreqbillController().materialreqbillSave();
|
||||
|
||||
}
|
||||
|
||||
public void getSynDataAdd() throws Exception {
|
||||
FXHTTP fxapi = new FXHTTP();
|
||||
XKTokenAccess xktonken = new XKTokenAccess();
|
||||
// 查询magic接口
|
||||
//获取时间戳
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
String time = sdf.format(System.currentTimeMillis() - (1000 * 60 * 60));
|
||||
|
||||
String apiName = "shipping_application__c";
|
||||
|
||||
/* List<CrmFXApiParam> paramList = Arrays.asList(
|
||||
new CrmFXApiParam("GT", "last_modified_time", System.currentTimeMillis() - (1000 * 60 * 60 * 24)),
|
||||
new CrmFXApiParam("IS", "erp_id__c", ""),
|
||||
new CrmFXApiParam("EQ", "life_status", "normal")
|
||||
);*/
|
||||
|
||||
|
||||
List<CrmFXApiParam> paramList = Arrays.asList(new CrmFXApiParam("EQ", "name", "FHSQ-2025-05-120001"));
|
||||
|
||||
JSONObject jsonject = fxapi.getSynNewDataObj(true, "发货申请", apiName, paramList);
|
||||
JSONArray array = jsonject.getJSONObject("data").getJSONArray("dataList");
|
||||
|
||||
|
||||
for (int i = 0; i < array.size(); i++) {
|
||||
JSONObject str = array.getJSONObject(i);
|
||||
String dataId = GcjJson.getNodeValue(str, "JSON._id") != null ? GcjJson.getNodeValue(str, "JSON._id").toString() : "";
|
||||
String nameData = GcjJson.getNodeValue(str, "JSON.name") != null ? GcjJson.getNodeValue(str, "JSON.name").toString() : "";
|
||||
|
||||
String syn_type = "0";//同步类型 0新增 1修改 2删除
|
||||
log.info("-------------------开始执行发货申请" + i + " -------------------" + nameData);
|
||||
XxlJobHelper.log("-------------------开始执行发货申请" + i + " -------------------" + nameData);
|
||||
|
||||
Boolean sendFlag = false;
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
|
||||
try {
|
||||
boolean tbflag = false;
|
||||
//验证数据是否已存在
|
||||
JSONObject dataSyn = MagicApi.getSendSYNDatamaterialreqbill("FHD", syn_type, dataId);
|
||||
|
||||
if (dataSyn != null && dataId.equals(dataSyn.getString("crmId"))) {
|
||||
log.info("数据已存在-" + nameData);
|
||||
XxlJobHelper.log("--数据已存在---" + nameData);
|
||||
tbflag = true;
|
||||
}
|
||||
if (tbflag) {
|
||||
continue;
|
||||
}
|
||||
log.info("发货申请待同步数据-" + i + " ------" + nameData);
|
||||
JSONObject jsonObjectData = new JSONObject();
|
||||
jsonObjectData.put("send_type", "FHD"); //业务类型
|
||||
jsonObjectData.put("send_syn", "0"); //同步类型 0新增 1修改 2删除
|
||||
jsonObjectData.put("crm_id", dataId);//数据id
|
||||
jsonObjectData.put("crmzhu_id", dataId);//数据id
|
||||
jsonObjectData.put("send_status", 3);//同步状态 true同步成功 false同步失败 3待同步
|
||||
jsonObjectData.put("crm_code", nameData);//数据名称
|
||||
jsonObjectData.put("mark", nameData);//标识
|
||||
jsonObjectData.put("crm_json", str.toJSONString());//标识
|
||||
|
||||
MagicApi.saveSendSYNDatamaterialreqbill(jsonObjectData);
|
||||
} catch (Exception e) {
|
||||
continue;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void materialreqbillSave() throws Exception {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
|
||||
FXHTTP fxapi = new FXHTTP();
|
||||
String resJsonStr = MagicApi.getWNRES("http://localhost:18088/syn/querymaterialreqbill?sendType=FHD&sendStatus=3&sendSyn=0", "");
|
||||
JSONObject resJson = JSON.parseObject(resJsonStr);
|
||||
if (resJson != null) {
|
||||
log.info("待同步发货申请数" + resJson.getJSONArray("data").size());
|
||||
for (int i = 0; i < resJson.getJSONArray("data").size(); i++) {
|
||||
|
||||
JSONObject getData = resJson.getJSONArray("data").getJSONObject(i);
|
||||
JSONObject str = getData.getJSONObject("crmJson");
|
||||
String syn_type = "0";//同步类型 0新增 1修改 2删除
|
||||
Boolean sendFlag = false;
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
boolean tbflag = false;
|
||||
// 构建json
|
||||
|
||||
String dataId = GcjJson.getNodeValue(str, "JSON._id") != null ? GcjJson.getNodeValue(str, "JSON._id").toString() : "";
|
||||
String nameData = GcjJson.getNodeValue(str, "JSON.name") != null ? GcjJson.getNodeValue(str, "JSON.name").toString() : "";
|
||||
|
||||
String remark = GcjJson.getNodeValue(str, "JSON.remark__c") != null ? GcjJson.getNodeValue(str, "JSON.remark__c").toString() : "";
|
||||
String contractno = GcjJson.getNodeValue(str, "JSON.contract_number_text__c") != null ? GcjJson.getNodeValue(str, "JSON.contract_number_text__c").toString() : "";
|
||||
|
||||
|
||||
String cemployeeid = "";
|
||||
if (GcjJson.getNodeValue(str, "JSON.owner__r.id") != null) {
|
||||
cemployeeid = GcjJson.getNodeValue(str, "JSON.owner__r.id").toString();
|
||||
cemployeeid = fxapi.getDataBYID("PersonnelObj", "_id", cemployeeid, "JSON.data.dataList[0].field_T1xid__c");
|
||||
}
|
||||
/* if (StringUtils.isBlank(cemployeeid)) {
|
||||
sendFlag = true;
|
||||
stringBuffer.append("销售员不存在\n");
|
||||
}*/
|
||||
String cdeptid = "";
|
||||
if (GcjJson.getNodeValue(str, "JSON.owner_department_id") != null) {
|
||||
String dept_id = GcjJson.getNodeValue(str, "JSON.owner_department_id").toString();
|
||||
cdeptid = fxapi.getDataBYID("DepartmentObj", "dept_id", dept_id, "JSON.data.dataList[0].field_Vj6sf__c");
|
||||
}
|
||||
String strJson = "";
|
||||
try{
|
||||
JSONObject dataSyn = MagicApi.getSendSYNDatamaterialreqbill("FHD", syn_type, dataId,"3");
|
||||
if (dataSyn != null && dataId.equals(dataSyn.getString("crmId"))) {
|
||||
log.info("数据已存在-" + nameData);
|
||||
XxlJobHelper.log("--数据已存在---" + nameData);
|
||||
tbflag = true;
|
||||
}
|
||||
if (tbflag) {
|
||||
continue;
|
||||
}
|
||||
|
||||
JSONObject params = new JSONObject();
|
||||
|
||||
JSONArray dataarr = new JSONArray();
|
||||
JSONObject datajson = new JSONObject();
|
||||
//编号
|
||||
datajson.put("billno",nameData);
|
||||
datajson.put("comment",remark);
|
||||
datajson.put("biztime",sdf.format(GcjJson.getNodeValue(str, "JSON.application_date__c")));
|
||||
datajson.put("contractno",contractno);//contractno
|
||||
|
||||
datajson.put("supplyownertype","bos_org");//货主类型 为啥不用客户
|
||||
datajson.put("org_number","zyierp");
|
||||
datajson.put("applydept_number","004");
|
||||
datajson.put("biztype_number","320");
|
||||
datajson.put("billtype_number","im_MaterialReqBill_STD_BT_S");
|
||||
datajson.put("bizorg_number","ZHY");
|
||||
datajson.put("supplyowner_number","ZHY");
|
||||
datajson.put("crmid",dataId);
|
||||
|
||||
|
||||
JSONArray groupstandardarr = new JSONArray();
|
||||
|
||||
JSONObject jsonjectZ = fxapi.getZDYSynDataObj("发货申请明细", "shipping_product__c", "shipping_application__c", dataId);
|
||||
JSONArray arrayZ = jsonjectZ.getJSONObject("data").getJSONArray("dataList");
|
||||
for (int j = 0; j < arrayZ.size(); j++) {
|
||||
JSONObject stra = arrayZ.getJSONObject(j);
|
||||
|
||||
JSONObject groupstandardjson = new JSONObject();
|
||||
|
||||
groupstandardjson.put("qty",GcjJson.getNodeValue(stra, "JSON.current_application_quanti__c"));
|
||||
|
||||
|
||||
String is_pickup__c = GcjJson.getNodeValue(stra, "JSON.is_pickup__c") != null ? GcjJson.getNodeValue(stra, "JSON.is_pickup__c").toString() : "";
|
||||
if("yes".equals(is_pickup__c)){
|
||||
groupstandardjson.put("ispikeup",true);
|
||||
} else if ("no".equals(is_pickup__c)) {
|
||||
groupstandardjson.put("ispikeup",false);
|
||||
}
|
||||
|
||||
String temporary_direct_delivery__c = GcjJson.getNodeValue(stra, "JSON.temporary_direct_delivery__c") != null ? GcjJson.getNodeValue(stra, "JSON.temporary_direct_delivery__c").toString() : "";
|
||||
if("yes".equals(temporary_direct_delivery__c)){
|
||||
groupstandardjson.put("isdiscovery",true);
|
||||
} else if ("no".equals(temporary_direct_delivery__c)) {
|
||||
groupstandardjson.put("isdiscovery",false);
|
||||
}
|
||||
|
||||
String isspecialask = GcjJson.getNodeValue(stra, "JSON.special_requirements_flag__c") != null ? GcjJson.getNodeValue(stra, "JSON.special_requirements_flag__c").toString() : "";
|
||||
if("yes".equals(isspecialask)){
|
||||
groupstandardjson.put("isspecialask",true);
|
||||
} else if ("no".equals(isspecialask)) {
|
||||
groupstandardjson.put("isspecialask",false);
|
||||
}
|
||||
|
||||
String isemergency = GcjJson.getNodeValue(stra, "JSON.is_urgent__c") != null ? GcjJson.getNodeValue(stra, "JSON.is_urgent__c").toString() : "";
|
||||
if("yes".equals(isemergency)){
|
||||
groupstandardjson.put("isemergency",true);
|
||||
} else if ("no".equals(isemergency)) {
|
||||
groupstandardjson.put("isemergency",false);
|
||||
}
|
||||
//设计文件编码
|
||||
groupstandardjson.put("designfileno",GcjJson.getNodeValue(stra, "JSON.design_file_encoding__c"));
|
||||
|
||||
groupstandardjson.put("crmentryid",GcjJson.getNodeValue(stra, "JSON._id"));
|
||||
//批号
|
||||
groupstandardjson.put("lotnumber",GcjJson.getNodeValue(stra, "JSON.batch_number__c"));
|
||||
//产品编码
|
||||
groupstandardjson.put("material_number",GcjJson.getNodeValue(stra, "JSON.material_name__c"));
|
||||
//仓库编码
|
||||
groupstandardjson.put("warehouse_number",GcjJson.getNodeValue(stra, "JSON.warehouse_code__c"));
|
||||
//项目编码
|
||||
groupstandardjson.put("project_number",GcjJson.getNodeValue(stra, "JSON.project_code__c"));
|
||||
groupstandardjson.put("ecostcenter_number","CHDL001");
|
||||
|
||||
|
||||
groupstandardarr.add(groupstandardjson);
|
||||
|
||||
}
|
||||
|
||||
datajson.put("billentry",groupstandardarr);//明细
|
||||
dataarr.add(datajson);
|
||||
params.put("data",dataarr);
|
||||
log.info("--请求json---" + params.toJSONString());
|
||||
System.out.println("--请求json:---" +params.toJSONString());
|
||||
strJson = params.toJSONString();
|
||||
|
||||
}catch (Exception e) {
|
||||
sendFlag = true;
|
||||
stringBuffer.append("参数解析错误,请联系开发人员");
|
||||
e.printStackTrace();
|
||||
}
|
||||
getSynDataSave(stringBuffer,sendFlag,fxapi,dataId,nameData,strJson,getData);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 写数据
|
||||
*/
|
||||
public void getSynDataSave(StringBuffer stringBuffer,Boolean sendFlag,FXHTTP fxapi,String dataId,String nameData,String obj,JSONObject str) {
|
||||
String syn_type = "0";//同步类型 0新增 1修改 2删除
|
||||
String res_url = "http://192.168.31.233:8022/ierp/kapi/v2/f9w5/im/im_materialreqbill/materialreqbillSave";
|
||||
String res_param = obj;
|
||||
String res = "";
|
||||
try {
|
||||
// String accessToken = "2095345516136108032_XQmekTd9H2mWOICLK86jt4bMzjP53Bm4KrspyFaPG790rSA6k3CdpwJ9fSx9RiBhK63rKELG7oIyLPdeNgpXu47zRh6Ndnud9jf009";
|
||||
String accessToken = new KDTokenController().getKDAccessTokenTest();
|
||||
|
||||
|
||||
Map<String, String> headers = new HashMap<String, String>();
|
||||
headers.put("accessToken", accessToken);//放token
|
||||
HttpClientResult rtn = HttpClientUtils.doPostJson(res_url, headers, obj);
|
||||
String resStr = rtn.getContent();
|
||||
JSONObject resjs = JSONObject.parseObject(resStr);
|
||||
res = resStr;
|
||||
if (resjs != null && resjs.getBoolean("status")) {
|
||||
JSONObject successdata = resjs.getJSONObject("data");
|
||||
JSONArray result = successdata.getJSONArray("result");
|
||||
JSONObject erpdata = (JSONObject) result.get(0);
|
||||
String erpid = erpdata.getString("id");
|
||||
|
||||
Map<String, Object> paramMap = new HashMap<String, Object>();
|
||||
paramMap.put("erp_id__c", erpid);//数据ID
|
||||
paramMap.put("sync_status__c", "option_sync_success__c");
|
||||
paramMap.put("sync_info__c", resjs.getString("message"));
|
||||
//回写json
|
||||
fxapi.upSynZDYFieldParam("", "shipping_application__c", dataId, paramMap);
|
||||
}else{
|
||||
sendFlag=true;
|
||||
stringBuffer.append("发货申请创建接口调用失败:"+resjs.getString("message"));
|
||||
Map<String, Object> paramMap = new HashMap<String, Object>();
|
||||
paramMap.put("sync_status__c", "option_sync_failure__c");
|
||||
paramMap.put("sync_info__c", stringBuffer);
|
||||
//回写json
|
||||
fxapi.upSynZDYFieldParam("", "shipping_application__c", dataId, paramMap);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
sendFlag = true;
|
||||
stringBuffer.append("发货申请创建接口调用失败,请检查网络配置");
|
||||
Map<String, Object> paramMap = new HashMap<String, Object>();
|
||||
paramMap.put("sync_status__c", "option_sync_failure__c");
|
||||
paramMap.put("sync_info__c", stringBuffer);
|
||||
//回写json
|
||||
fxapi.upSynFieldParam("", "shipping_application__c", dataId, paramMap);
|
||||
}
|
||||
|
||||
JSONObject sendData = new JSONObject();
|
||||
|
||||
sendData.put("send_status", !sendFlag);//同步状态 true同步成功 false同步失败 3待同步
|
||||
|
||||
sendData.put("send_id", str.getString("sendId")); //send_id
|
||||
MagicApi.updateSendSYUPDATEmaterialreqbill(sendData);
|
||||
|
||||
JSONObject logData = new JSONObject();
|
||||
logData.put("log_type", "FHD"); //业务类型
|
||||
logData.put("log_status", !sendFlag);//同步状态 true同步成功 false同步失败 3待同步
|
||||
logData.put("syn_type", syn_type);//同步类型 0新增 1修改 2删除
|
||||
logData.put("data_id", dataId);//数据id
|
||||
logData.put("data_name", nameData);//数据名称
|
||||
logData.put("res_body", "同步成功");//返回值
|
||||
logData.put("res_url", res_url);//
|
||||
logData.put("res_param", res_param);//
|
||||
logData.put("res_res", res);//
|
||||
if (sendFlag) {
|
||||
logData.put("res_body", stringBuffer.toString());//返回值
|
||||
}
|
||||
//写入传输日志
|
||||
MagicApi.saveCustomermaterialreqbill(logData);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,337 @@
|
||||
package org.ssssssss.magicboot.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.xxl.job.core.context.XxlJobHelper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.ssssssss.magicboot.fxapi.HttpClientResult;
|
||||
import org.ssssssss.magicboot.fxapi.HttpClientUtils;
|
||||
import org.ssssssss.magicboot.fxapi.XKTokenAccess;
|
||||
import org.ssssssss.magicboot.fxapi.model.CrmFXApiParam;
|
||||
import org.ssssssss.magicboot.zdyutils.FXHTTP;
|
||||
import org.ssssssss.magicboot.zdyutils.GcjJson;
|
||||
import org.ssssssss.magicboot.zdyutils.MagicApi;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/materialreqbillv2")
|
||||
public class materialreqbillXTController {
|
||||
static Logger log = LoggerFactory.getLogger("materialreqbillv2");
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
new materialreqbillXTController().getSynDataAdd();
|
||||
new materialreqbillXTController().materialreqbillSave();
|
||||
//new materialreqbillXTController().doOperation("682f14a051a7140001ecc663","audit");
|
||||
}
|
||||
|
||||
public void getSynDataAdd() throws Exception {
|
||||
FXHTTP fxapi = new FXHTTP();
|
||||
XKTokenAccess xktonken = new XKTokenAccess();
|
||||
// 查询magic接口
|
||||
//获取时间戳
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
String time = sdf.format(System.currentTimeMillis() - (1000 * 60 * 60));
|
||||
|
||||
String apiName = "shipping_application__c";
|
||||
|
||||
/* List<CrmFXApiParam> paramList = Arrays.asList(
|
||||
new CrmFXApiParam("GT", "last_modified_time", System.currentTimeMillis() - (1000 * 60 * 60 * 24)),
|
||||
new CrmFXApiParam("IS", "erp_id__c", ""),
|
||||
new CrmFXApiParam("EQ", "life_status", "normal")
|
||||
);*/
|
||||
|
||||
|
||||
List<CrmFXApiParam> paramList = Arrays.asList(new CrmFXApiParam("EQ", "name", "FHSQ202505220003"));
|
||||
|
||||
JSONObject jsonject = fxapi.getSynNewDataObj(true, "发货申请", apiName, paramList);
|
||||
JSONArray array = jsonject.getJSONObject("data").getJSONArray("dataList");
|
||||
|
||||
|
||||
for (int i = 0; i < array.size(); i++) {
|
||||
JSONObject str = array.getJSONObject(i);
|
||||
String dataId = GcjJson.getNodeValue(str, "JSON._id") != null ? GcjJson.getNodeValue(str, "JSON._id").toString() : "";
|
||||
String nameData = GcjJson.getNodeValue(str, "JSON.name") != null ? GcjJson.getNodeValue(str, "JSON.name").toString() : "";
|
||||
|
||||
String syn_type = "0";//同步类型 0新增 1修改 2删除
|
||||
log.info("-------------------开始执行发货申请" + i + " -------------------" + nameData);
|
||||
XxlJobHelper.log("-------------------开始执行发货申请" + i + " -------------------" + nameData);
|
||||
|
||||
Boolean sendFlag = false;
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
|
||||
try {
|
||||
boolean tbflag = false;
|
||||
//验证数据是否已存在
|
||||
JSONObject dataSyn = MagicApi.getSendSYNDatamaterialreqbill("FHD", syn_type, dataId);
|
||||
|
||||
if (dataSyn != null && dataId.equals(dataSyn.getString("crmId"))) {
|
||||
log.info("数据已存在-" + nameData);
|
||||
XxlJobHelper.log("--数据已存在---" + nameData);
|
||||
tbflag = true;
|
||||
}
|
||||
if (tbflag) {
|
||||
continue;
|
||||
}
|
||||
log.info("发货申请待同步数据-" + i + " ------" + nameData);
|
||||
JSONObject jsonObjectData = new JSONObject();
|
||||
jsonObjectData.put("send_type", "FHD"); //业务类型
|
||||
jsonObjectData.put("send_syn", "0"); //同步类型 0新增 1修改 2删除
|
||||
jsonObjectData.put("crm_id", dataId);//数据id
|
||||
jsonObjectData.put("crmzhu_id", dataId);//数据id
|
||||
jsonObjectData.put("send_status", 3);//同步状态 true同步成功 false同步失败 3待同步
|
||||
jsonObjectData.put("crm_code", nameData);//数据名称
|
||||
jsonObjectData.put("mark", nameData);//标识
|
||||
jsonObjectData.put("crm_json", str.toJSONString());//标识
|
||||
|
||||
MagicApi.saveSendSYNDatamaterialreqbill(jsonObjectData);
|
||||
} catch (Exception e) {
|
||||
continue;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void materialreqbillSave() throws Exception {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
|
||||
FXHTTP fxapi = new FXHTTP();
|
||||
String resJsonStr = MagicApi.getWNRES("http://localhost:18088/syn/querymaterialreqbill?sendType=FHD&sendStatus=3&sendSyn=0", "");
|
||||
JSONObject resJson = JSON.parseObject(resJsonStr);
|
||||
if (resJson != null) {
|
||||
log.info("待同步发货申请数" + resJson.getJSONArray("data").size());
|
||||
for (int i = 0; i < resJson.getJSONArray("data").size(); i++) {
|
||||
|
||||
JSONObject getData = resJson.getJSONArray("data").getJSONObject(i);
|
||||
JSONObject str = getData.getJSONObject("crmJson");
|
||||
String syn_type = "0";//同步类型 0新增 1修改 2删除
|
||||
Boolean sendFlag = false;
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
boolean tbflag = false;
|
||||
// 构建json
|
||||
|
||||
String dataId = GcjJson.getNodeValue(str, "JSON._id") != null ? GcjJson.getNodeValue(str, "JSON._id").toString() : "";
|
||||
String nameData = GcjJson.getNodeValue(str, "JSON.name") != null ? GcjJson.getNodeValue(str, "JSON.name").toString() : "";
|
||||
|
||||
String sjerpid = GcjJson.getNodeValue(str, "JSON.design_file_ERPID__c") != null ? GcjJson.getNodeValue(str, "JSON.design_file_ERPID__c").toString() : "";
|
||||
String contractno = GcjJson.getNodeValue(str, "JSON.contract_number_text__c") != null ? GcjJson.getNodeValue(str, "JSON.contract_number_text__c").toString() : "";
|
||||
|
||||
|
||||
String cemployeeid = "";
|
||||
if (GcjJson.getNodeValue(str, "JSON.owner__r.id") != null) {
|
||||
cemployeeid = GcjJson.getNodeValue(str, "JSON.owner__r.id").toString();
|
||||
cemployeeid = fxapi.getDataBYID("PersonnelObj", "_id", cemployeeid, "JSON.data.dataList[0].field_T1xid__c");
|
||||
}
|
||||
/* if (StringUtils.isBlank(cemployeeid)) {
|
||||
sendFlag = true;
|
||||
stringBuffer.append("销售员不存在\n");
|
||||
}*/
|
||||
String cdeptid = "";
|
||||
if (GcjJson.getNodeValue(str, "JSON.owner_department_id") != null) {
|
||||
String dept_id = GcjJson.getNodeValue(str, "JSON.owner_department_id").toString();
|
||||
cdeptid = fxapi.getDataBYID("DepartmentObj", "dept_id", dept_id, "JSON.data.dataList[0].field_Vj6sf__c");
|
||||
}
|
||||
String strJson = "";
|
||||
try{
|
||||
JSONObject dataSyn = MagicApi.getSendSYNDatamaterialreqbill("FHD", syn_type, dataId,"3");
|
||||
if (dataSyn != null && dataId.equals(dataSyn.getString("crmId"))) {
|
||||
log.info("数据已存在-" + nameData);
|
||||
XxlJobHelper.log("--数据已存在---" + nameData);
|
||||
tbflag = true;
|
||||
}
|
||||
if (tbflag) {
|
||||
continue;
|
||||
}
|
||||
|
||||
JSONObject params = new JSONObject();
|
||||
|
||||
JSONArray dataarr = new JSONArray();
|
||||
JSONObject datajson = new JSONObject();
|
||||
|
||||
//datajson.put("org_number","zyierp");
|
||||
datajson.put("org","ZHY");
|
||||
datajson.put("bizorg","ZHY");
|
||||
datajson.put("biztime",sdf.format(GcjJson.getNodeValue(str, "JSON.application_date__c")));
|
||||
datajson.put("applyuser","ID-000016");
|
||||
datajson.put("applydept","004");
|
||||
datajson.put("contractno",contractno);//contractno
|
||||
datajson.put("crmid",dataId);
|
||||
datajson.put("erpId",sjerpid);//设计文件erpID //design_file_ERPID__c
|
||||
|
||||
//编号
|
||||
// datajson.put("billno",nameData);
|
||||
//datajson.put("comment",remark);
|
||||
|
||||
|
||||
JSONArray groupstandardarr = new JSONArray();
|
||||
|
||||
JSONObject jsonjectZ = fxapi.getZDYSynDataObj("发货申请明细", "shipping_product__c", "shipping_application__c", dataId);
|
||||
JSONArray arrayZ = jsonjectZ.getJSONObject("data").getJSONArray("dataList");
|
||||
for (int j = 0; j < arrayZ.size(); j++) {
|
||||
JSONObject stra = arrayZ.getJSONObject(j);
|
||||
|
||||
JSONObject groupstandardjson = new JSONObject();
|
||||
|
||||
groupstandardjson.put("qty",GcjJson.getNodeValue(stra, "JSON.current_application_quanti__c"));
|
||||
//产品编码
|
||||
groupstandardjson.put("material",GcjJson.getNodeValue(stra, "JSON.material_name__c"));
|
||||
// groupstandardjson.put("material","10060030170");
|
||||
//仓库编码
|
||||
groupstandardjson.put("warehouse",GcjJson.getNodeValue(stra, "JSON.warehouse_code__c"));
|
||||
groupstandardjson.put("location",GcjJson.getNodeValue(stra, "JSON.warehouse_position__c"));
|
||||
|
||||
//批号
|
||||
groupstandardjson.put("lot",GcjJson.getNodeValue(stra, "JSON.batch_number__c"));
|
||||
groupstandardjson.put("ecostcenter","ZHY");
|
||||
|
||||
//项目编码
|
||||
groupstandardjson.put("project",GcjJson.getNodeValue(stra, "JSON.project_code__c"));
|
||||
|
||||
//设计文件明细ERPID
|
||||
groupstandardjson.put("erpEntryId",GcjJson.getNodeValue(stra, "JSON.design_file_erp_detail_id__c"));
|
||||
// groupstandardjson.put("erpEntryId","2216158993854770176");
|
||||
|
||||
groupstandardjson.put("crmentryid",GcjJson.getNodeValue(stra, "JSON._id"));
|
||||
|
||||
groupstandardjson.put("tracknumber_number",GcjJson.getNodeValue(stra, "JSON.shipping_tracking_number__c"));
|
||||
|
||||
|
||||
groupstandardarr.add(groupstandardjson);
|
||||
|
||||
}
|
||||
|
||||
datajson.put("entryList",groupstandardarr);//明细
|
||||
// dataarr.add(datajson);
|
||||
// params.put("data",dataarr);
|
||||
params= datajson;
|
||||
log.info("--请求json---" + params.toJSONString());
|
||||
System.out.println("--请求json:---" +params.toJSONString());
|
||||
strJson = params.toJSONString();
|
||||
|
||||
}catch (Exception e) {
|
||||
sendFlag = true;
|
||||
stringBuffer.append("参数解析错误,请联系开发人员");
|
||||
e.printStackTrace();
|
||||
}
|
||||
getSynDataSave(stringBuffer,sendFlag,fxapi,dataId,nameData,strJson,getData);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 写数据
|
||||
*/
|
||||
public void getSynDataSave(StringBuffer stringBuffer,Boolean sendFlag,FXHTTP fxapi,String dataId,String nameData,String obj,JSONObject str) {
|
||||
String syn_type = "0";//同步类型 0新增 1修改 2删除
|
||||
String res_url = "http://192.168.31.233:8022/ierp/kapi/v2/f9w5/im/materialreqbill/push";
|
||||
String res_param = obj;
|
||||
String res = "";
|
||||
try {
|
||||
// String accessToken = "2095345516136108032_XQmekTd9H2mWOICLK86jt4bMzjP53Bm4KrspyFaPG790rSA6k3CdpwJ9fSx9RiBhK63rKELG7oIyLPdeNgpXu47zRh6Ndnud9jf009";
|
||||
String accessToken = new KDTokenController().getKDAccessTokenTest();
|
||||
|
||||
|
||||
Map<String, String> headers = new HashMap<String, String>();
|
||||
headers.put("accessToken", accessToken);//放token
|
||||
HttpClientResult rtn = HttpClientUtils.doPostJson(res_url, headers, obj);
|
||||
String resStr = rtn.getContent();
|
||||
JSONObject resjs = JSONObject.parseObject(resStr);
|
||||
res = resStr;
|
||||
if (resjs != null && resjs.getBoolean("status")) {
|
||||
JSONObject successdata = resjs.getJSONObject("data");
|
||||
JSONArray result = successdata.getJSONArray("result");
|
||||
JSONObject erpdata = (JSONObject) result.get(0);
|
||||
String erpid = erpdata.getString("id");
|
||||
|
||||
Map<String, Object> paramMap = new HashMap<String, Object>();
|
||||
paramMap.put("erp_id__c", erpid);//数据ID
|
||||
paramMap.put("sync_status__c", "option_sync_success__c");
|
||||
paramMap.put("sync_info__c", resjs.getString("message"));
|
||||
//回写json
|
||||
fxapi.upSynZDYFieldParam("", "shipping_application__c", dataId, paramMap);
|
||||
//调用提交
|
||||
this.doOperation(dataId,"submit");
|
||||
}else{
|
||||
sendFlag=true;
|
||||
stringBuffer.append("发货申请创建接口调用失败:"+resjs.getString("message"));
|
||||
Map<String, Object> paramMap = new HashMap<String, Object>();
|
||||
paramMap.put("sync_status__c", "option_sync_failure__c");
|
||||
paramMap.put("sync_info__c", stringBuffer);
|
||||
//回写json
|
||||
fxapi.upSynZDYFieldParam("", "shipping_application__c", dataId, paramMap);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
sendFlag = true;
|
||||
stringBuffer.append("发货申请创建接口调用失败,请检查网络配置");
|
||||
Map<String, Object> paramMap = new HashMap<String, Object>();
|
||||
paramMap.put("sync_status__c", "option_sync_failure__c");
|
||||
paramMap.put("sync_info__c", stringBuffer);
|
||||
//回写json
|
||||
fxapi.upSynZDYFieldParam("", "shipping_application__c", dataId, paramMap);
|
||||
}
|
||||
|
||||
JSONObject sendData = new JSONObject();
|
||||
|
||||
sendData.put("send_status", !sendFlag);//同步状态 true同步成功 false同步失败 3待同步
|
||||
|
||||
sendData.put("send_id", str.getString("sendId")); //send_id
|
||||
MagicApi.updateSendSYUPDATEmaterialreqbill(sendData);
|
||||
|
||||
JSONObject logData = new JSONObject();
|
||||
logData.put("log_type", "FHD"); //业务类型
|
||||
logData.put("log_status", !sendFlag);//同步状态 true同步成功 false同步失败 3待同步
|
||||
logData.put("syn_type", syn_type);//同步类型 0新增 1修改 2删除
|
||||
logData.put("data_id", dataId);//数据id
|
||||
logData.put("data_name", nameData);//数据名称
|
||||
logData.put("res_body", "同步成功");//返回值
|
||||
logData.put("res_url", res_url);//
|
||||
logData.put("res_param", res_param);//
|
||||
logData.put("res_res", res);//
|
||||
if (sendFlag) {
|
||||
logData.put("res_body", stringBuffer.toString());//返回值
|
||||
}
|
||||
//写入传输日志
|
||||
MagicApi.saveCustomermaterialreqbill(logData);
|
||||
}
|
||||
|
||||
public void doOperation(String crmId,String operation) throws Exception {
|
||||
//操作类型:submit:提交;audit:审核;撤销:unsubmit;删除:delete;反审核:unaudit
|
||||
String res_url = "http://192.168.31.233:8022/ierp/kapi/v2/f9w5/im/materialreqbill/doOperation";
|
||||
JSONObject datajson = new JSONObject();
|
||||
datajson.put("crmId",crmId);
|
||||
datajson.put("operation",operation);
|
||||
|
||||
String obj = datajson.toJSONString();
|
||||
|
||||
String accessToken = new KDTokenController().getKDAccessTokenTest();
|
||||
|
||||
|
||||
Map<String, String> headers = new HashMap<String, String>();
|
||||
headers.put("accessToken", accessToken);//放token
|
||||
HttpClientResult rtn = HttpClientUtils.doPostJson(res_url, headers, obj);
|
||||
String resStr = rtn.getContent();
|
||||
JSONObject resjs = JSONObject.parseObject(resStr);
|
||||
|
||||
if (resjs != null && resjs.getBoolean("status")) {
|
||||
JSONObject successdata = resjs.getJSONObject("data");
|
||||
String crmid = successdata.getString("crmid");
|
||||
String erpid = successdata.getString("pkId");
|
||||
String billno = successdata.getString("billno");
|
||||
|
||||
}else{
|
||||
//响应的消息
|
||||
String message = resjs.getString("message");
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,323 @@
|
||||
package org.ssssssss.magicboot.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.xxl.job.core.context.XxlJobHelper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.ssssssss.magicboot.fxapi.HttpClientResult;
|
||||
import org.ssssssss.magicboot.fxapi.HttpClientUtils;
|
||||
import org.ssssssss.magicboot.fxapi.XKTokenAccess;
|
||||
import org.ssssssss.magicboot.fxapi.model.CrmFXApiParam;
|
||||
import org.ssssssss.magicboot.zdyutils.FXHTTP;
|
||||
import org.ssssssss.magicboot.zdyutils.GcjJson;
|
||||
import org.ssssssss.magicboot.zdyutils.MagicApi;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/priceapprova")
|
||||
public class priceapprovaController {
|
||||
static Logger log = LoggerFactory.getLogger("priceapprova");
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
new priceapprovaController().getSynDataAdd();
|
||||
new priceapprovaController().priceapprovaSave();
|
||||
|
||||
}
|
||||
|
||||
public void getSynDataAdd() throws Exception {
|
||||
FXHTTP fxapi = new FXHTTP();
|
||||
XKTokenAccess xktonken = new XKTokenAccess();
|
||||
// 查询magic接口
|
||||
//获取时间戳
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
String time = sdf.format(System.currentTimeMillis() - (1000 * 60 * 60));
|
||||
|
||||
String apiName = "project_quote_quotation__c";
|
||||
|
||||
/* List<CrmFXApiParam> paramList = Arrays.asList(
|
||||
new CrmFXApiParam("GT", "last_modified_time", System.currentTimeMillis() - (1000 * 60 * 60 * 24)),
|
||||
new CrmFXApiParam("IS", "erp_id__c", ""),
|
||||
new CrmFXApiParam("EQ", "life_status", "normal")
|
||||
);*/
|
||||
|
||||
|
||||
List<CrmFXApiParam> paramList = Arrays.asList(new CrmFXApiParam("EQ", "name", "BJD-2025-05-230001"));
|
||||
|
||||
JSONObject jsonject = fxapi.getSynNewDataObj(true, "项目报价询价", apiName, paramList);
|
||||
JSONArray array = jsonject.getJSONObject("data").getJSONArray("dataList");
|
||||
|
||||
|
||||
for (int i = 0; i < array.size(); i++) {
|
||||
JSONObject str = array.getJSONObject(i);
|
||||
String dataId = GcjJson.getNodeValue(str, "JSON._id") != null ? GcjJson.getNodeValue(str, "JSON._id").toString() : "";
|
||||
String nameData = GcjJson.getNodeValue(str, "JSON.name") != null ? GcjJson.getNodeValue(str, "JSON.name").toString() : "";
|
||||
|
||||
String syn_type = "0";//同步类型 0新增 1修改 2删除
|
||||
log.info("-------------------开始执行项目报价询价" + i + " -------------------" + nameData);
|
||||
XxlJobHelper.log("-------------------开始执行项目报价询价" + i + " -------------------" + nameData);
|
||||
|
||||
Boolean sendFlag = false;
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
|
||||
try {
|
||||
boolean tbflag = false;
|
||||
//验证数据是否已存在
|
||||
JSONObject dataSyn = MagicApi.getSendSYNDatapriceapprova("priceapprova", syn_type, dataId);
|
||||
|
||||
if (dataSyn != null && dataId.equals(dataSyn.getString("crmId"))) {
|
||||
log.info("数据已存在-" + nameData);
|
||||
XxlJobHelper.log("--数据已存在---" + nameData);
|
||||
tbflag = true;
|
||||
}
|
||||
if (tbflag) {
|
||||
continue;
|
||||
}
|
||||
log.info("项目报价询价申请待同步数据-" + i + " ------" + nameData);
|
||||
JSONObject jsonObjectData = new JSONObject();
|
||||
jsonObjectData.put("send_type", "priceapprova"); //业务类型
|
||||
jsonObjectData.put("send_syn", "0"); //同步类型 0新增 1修改 2删除
|
||||
jsonObjectData.put("crm_id", dataId);//数据id
|
||||
jsonObjectData.put("crmzhu_id", dataId);//数据id
|
||||
jsonObjectData.put("send_status", 3);//同步状态 true同步成功 false同步失败 3待同步
|
||||
jsonObjectData.put("crm_code", nameData);//数据名称
|
||||
jsonObjectData.put("mark", nameData);//标识
|
||||
jsonObjectData.put("crm_json", str.toJSONString());//标识
|
||||
|
||||
MagicApi.saveSendSYNDatapriceapprova(jsonObjectData);
|
||||
} catch (Exception e) {
|
||||
continue;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void priceapprovaSave() throws Exception {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
|
||||
FXHTTP fxapi = new FXHTTP();
|
||||
String resJsonStr = MagicApi.getWNRES("http://localhost:18088/syn/querypriceapprova?sendType=priceapprova&sendStatus=3&sendSyn=0", "");
|
||||
JSONObject resJson = JSON.parseObject(resJsonStr);
|
||||
if (resJson != null) {
|
||||
log.info("待同步项目报价询价申请数" + resJson.getJSONArray("data").size());
|
||||
for (int i = 0; i < resJson.getJSONArray("data").size(); i++) {
|
||||
|
||||
JSONObject getData = resJson.getJSONArray("data").getJSONObject(i);
|
||||
JSONObject str = getData.getJSONObject("crmJson");
|
||||
String syn_type = "0";//同步类型 0新增 1修改 2删除
|
||||
Boolean sendFlag = false;
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
boolean tbflag = false;
|
||||
// 构建json
|
||||
|
||||
String dataId = GcjJson.getNodeValue(str, "JSON._id") != null ? GcjJson.getNodeValue(str, "JSON._id").toString() : "";
|
||||
String nameData = GcjJson.getNodeValue(str, "JSON.name") != null ? GcjJson.getNodeValue(str, "JSON.name").toString() : "";
|
||||
|
||||
String warranty = GcjJson.getNodeValue(str, "JSON.field_I3e77__c") != null ? GcjJson.getNodeValue(str, "JSON.field_I3e77__c").toString() : "";
|
||||
|
||||
String project_location = GcjJson.getNodeValue(str, "JSON.project_location__c") != null ? GcjJson.getNodeValue(str, "JSON.project_location__c").toString() : "";
|
||||
String crspdencestd = GcjJson.getNodeValue(str, "JSON.field_h1HJx__c") != null ? GcjJson.getNodeValue(str, "JSON.field_h1HJx__c").toString() : "";
|
||||
|
||||
String correspondence = GcjJson.getNodeValue(str, "JSON.field_6p1ku__c") != null ? GcjJson.getNodeValue(str, "JSON.field_6p1ku__c").toString() : "";
|
||||
String platform_manufacturer_text__c = GcjJson.getNodeValue(str, "JSON.platform_manufacturer_text__c") != null ? GcjJson.getNodeValue(str, "JSON.platform_manufacturer_text__c").toString() : "";
|
||||
String quote_requirements__c = GcjJson.getNodeValue(str, "JSON.quote_requirements__c") != null ? GcjJson.getNodeValue(str, "JSON.quote_requirements__c").toString() : "";
|
||||
|
||||
|
||||
|
||||
String cemployeeid = "";
|
||||
if (GcjJson.getNodeValue(str, "JSON.owner__r.id") != null) {
|
||||
cemployeeid = GcjJson.getNodeValue(str, "JSON.owner__r.id").toString();
|
||||
cemployeeid = fxapi.getDataBYID("PersonnelObj", "_id", cemployeeid, "JSON.data.dataList[0].field_T1xid__c");
|
||||
}
|
||||
/* if (StringUtils.isBlank(cemployeeid)) {
|
||||
sendFlag = true;
|
||||
stringBuffer.append("销售员不存在\n");
|
||||
}*/
|
||||
String cdeptid = "";
|
||||
if (GcjJson.getNodeValue(str, "JSON.owner_department_id") != null) {
|
||||
String dept_id = GcjJson.getNodeValue(str, "JSON.owner_department_id").toString();
|
||||
cdeptid = fxapi.getDataBYID("DepartmentObj", "dept_id", dept_id, "JSON.data.dataList[0].field_Vj6sf__c");
|
||||
}
|
||||
String strJson = "";
|
||||
try{
|
||||
JSONObject dataSyn = MagicApi.getSendSYNDataquerypriceapprova("priceapprova", syn_type, dataId,"3");
|
||||
if (dataSyn != null && dataId.equals(dataSyn.getString("crmId"))) {
|
||||
log.info("数据已存在-" + nameData);
|
||||
XxlJobHelper.log("--数据已存在---" + nameData);
|
||||
tbflag = true;
|
||||
}
|
||||
if (tbflag) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
JSONObject params = new JSONObject();
|
||||
|
||||
JSONArray dataarr = new JSONArray();
|
||||
JSONObject datajson = new JSONObject();
|
||||
//编号
|
||||
datajson.put("billno",nameData);
|
||||
datajson.put("f9w5_crmid",dataId);
|
||||
datajson.put("istax","0");
|
||||
|
||||
|
||||
datajson.put("f9w5_billtype_number","f9w5_pmp_priceapproval_BT_XMBJ");
|
||||
datajson.put("billcretype","3");
|
||||
datajson.put("currency_number","CNY");
|
||||
datajson.put("pricelisttypeid_number","JMLX_SYS_CG");
|
||||
datajson.put("org_number","ZHY");
|
||||
datajson.put("f9w5_warranty",warranty);
|
||||
datajson.put("f9w5_projectlocation",project_location);
|
||||
datajson.put("f9w5_crspdencestd",crspdencestd);
|
||||
datajson.put("f9w5_correspondence",correspondence);
|
||||
|
||||
|
||||
datajson.put("f9w5_quotereq",quote_requirements__c);//其他服务要求
|
||||
datajson.put("f9w5_platform",platform_manufacturer_text__c);
|
||||
String implementation_needed__c = GcjJson.getNodeValue(str, "JSON.implementation_needed__c") != null ? GcjJson.getNodeValue(str, "JSON.implementation_needed__c").toString() : "";
|
||||
if("yes".equals(implementation_needed__c)){
|
||||
datajson.put("f9w5_implementation","0");
|
||||
} else if ("no".equals(implementation_needed__c)) {
|
||||
datajson.put("f9w5_implementation","1");
|
||||
}
|
||||
//是否送检
|
||||
String is_inspected__c = GcjJson.getNodeValue(str, "JSON.is_inspected__c") != null ? GcjJson.getNodeValue(str, "JSON.is_inspected__c").toString() : "";
|
||||
if("yes".equals(is_inspected__c)){
|
||||
datajson.put("f9w5_isinspected","0");
|
||||
} else if ("no".equals(is_inspected__c)) {
|
||||
datajson.put("f9w5_isinspected","1");
|
||||
}
|
||||
|
||||
JSONArray groupstandardarr = new JSONArray();
|
||||
JSONObject jsonjectZ = fxapi.getZDYSynDataObj("项目报价询价申请明细", "quote_details__c", "project_quote_quotation__c", dataId);
|
||||
JSONArray arrayZ = jsonjectZ.getJSONObject("data").getJSONArray("dataList");
|
||||
for (int j = 0; j < arrayZ.size(); j++) {
|
||||
JSONObject stra = arrayZ.getJSONObject(j);
|
||||
JSONObject groupstandardjson = new JSONObject();
|
||||
// groupstandardjson.put("priceandtax",GcjJson.getNodeValue(stra, "JSON.quote_price__c"));
|
||||
|
||||
//产品编码
|
||||
groupstandardjson.put("material_number",GcjJson.getNodeValue(stra, "JSON.product_code_text__c"));
|
||||
|
||||
groupstandardjson.put("user_operatornumber","ID-000016");
|
||||
groupstandardjson.put("dept_number","004");
|
||||
//供应商编码
|
||||
// groupstandardjson.put("supplierid_number",GcjJson.getNodeValue(stra, "JSON.supplier_code__c"));
|
||||
groupstandardjson.put("supplierid_number","Sup-000001");
|
||||
|
||||
groupstandardjson.put("f9w5_mtdescription",GcjJson.getNodeValue(stra, "JSON.material_description__c"));
|
||||
groupstandardjson.put("f9w5_modelnum",GcjJson.getNodeValue(stra, "JSON.specification_model__c"));
|
||||
|
||||
groupstandardjson.put("f9w5_crmentryid",GcjJson.getNodeValue(stra, "JSON._id"));
|
||||
|
||||
// groupstandardjson.put("taxrateid_number","V13");
|
||||
// groupstandardjson.put("invoicetype",GcjJson.getNodeValue(stra, "JSON.invoice_type__c"));
|
||||
// groupstandardjson.put("settlementtype",GcjJson.getNodeValue(stra, "JSON.payment_method__c"));
|
||||
|
||||
groupstandardarr.add(groupstandardjson);
|
||||
|
||||
}
|
||||
|
||||
datajson.put("priceentryentity",groupstandardarr);//明细
|
||||
dataarr.add(datajson);
|
||||
params.put("data",dataarr);
|
||||
log.info("--请求json---" + params.toJSONString());
|
||||
System.out.println("--请求json:---" +params.toJSONString());
|
||||
strJson = params.toJSONString();
|
||||
|
||||
}catch (Exception e) {
|
||||
sendFlag = true;
|
||||
stringBuffer.append("参数解析错误,请联系开发人员");
|
||||
e.printStackTrace();
|
||||
}
|
||||
getSynDataSave(stringBuffer,sendFlag,fxapi,dataId,nameData,strJson,getData);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 写数据
|
||||
*/
|
||||
public void getSynDataSave(StringBuffer stringBuffer,Boolean sendFlag,FXHTTP fxapi,String dataId,String nameData,String obj,JSONObject str) {
|
||||
String syn_type = "0";//同步类型 0新增 1修改 2删除
|
||||
String res_url = "http://192.168.31.233:8022/ierp/kapi/v2/f9w5/pmp/f9w5_pmp_priceapproval/priceapprovalSave";
|
||||
String res_param = obj;
|
||||
String res = "";
|
||||
try {
|
||||
// String accessToken = "2095345516136108032_XQmekTd9H2mWOICLK86jt4bMzjP53Bm4KrspyFaPG790rSA6k3CdpwJ9fSx9RiBhK63rKELG7oIyLPdeNgpXu47zRh6Ndnud9jf009";
|
||||
String accessToken = new KDTokenController().getKDAccessTokenTest();
|
||||
|
||||
|
||||
Map<String, String> headers = new HashMap<String, String>();
|
||||
headers.put("accessToken", accessToken);//放token
|
||||
HttpClientResult rtn = HttpClientUtils.doPostJson(res_url, headers, obj);
|
||||
String resStr = rtn.getContent();
|
||||
JSONObject resjs = JSONObject.parseObject(resStr);
|
||||
res = resStr;
|
||||
if (resjs != null && resjs.getBoolean("status")) {
|
||||
JSONObject successdata = resjs.getJSONObject("data");
|
||||
JSONArray result = successdata.getJSONArray("result");
|
||||
JSONObject erpdata = (JSONObject) result.get(0);
|
||||
String erpid = erpdata.getString("id");
|
||||
|
||||
Map<String, Object> paramMap = new HashMap<String, Object>();
|
||||
paramMap.put("erp_id__c", erpid);//数据ID
|
||||
paramMap.put("sync_status__c", "option_sync_success__c");
|
||||
paramMap.put("sync_info__c", resjs.getString("message"));
|
||||
//回写json
|
||||
fxapi.upSynZDYFieldParam("", "project_quote_quotation__c", dataId, paramMap);
|
||||
}else{
|
||||
sendFlag=true;
|
||||
stringBuffer.append("项目报价询价申请创建接口调用失败:"+resjs.getString("message"));
|
||||
Map<String, Object> paramMap = new HashMap<String, Object>();
|
||||
paramMap.put("sync_status__c", "option_sync_failure__c");
|
||||
paramMap.put("sync_info__c", stringBuffer);
|
||||
//回写json
|
||||
fxapi.upSynZDYFieldParam("", "project_quote_quotation__c", dataId, paramMap);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
sendFlag = true;
|
||||
stringBuffer.append("项目报价询价申请创建接口调用失败,请检查网络配置");
|
||||
Map<String, Object> paramMap = new HashMap<String, Object>();
|
||||
paramMap.put("sync_status__c", "option_sync_failure__c");
|
||||
paramMap.put("sync_info__c", stringBuffer);
|
||||
//回写json
|
||||
fxapi.upSynFieldParam("", "project_quote_quotation__c", dataId, paramMap);
|
||||
}
|
||||
|
||||
JSONObject sendData = new JSONObject();
|
||||
|
||||
sendData.put("send_status", !sendFlag);//同步状态 true同步成功 false同步失败 3待同步
|
||||
|
||||
sendData.put("send_id", str.getString("sendId")); //send_id
|
||||
MagicApi.updateSendSYUPDATEpriceapprova(sendData);
|
||||
|
||||
JSONObject logData = new JSONObject();
|
||||
logData.put("log_type", "priceapprova"); //业务类型
|
||||
logData.put("log_status", !sendFlag);//同步状态 true同步成功 false同步失败 3待同步
|
||||
logData.put("syn_type", syn_type);//同步类型 0新增 1修改 2删除
|
||||
logData.put("data_id", dataId);//数据id
|
||||
logData.put("data_name", nameData);//数据名称
|
||||
logData.put("res_body", "同步成功");//返回值
|
||||
logData.put("res_url", res_url);//
|
||||
logData.put("res_param", res_param);//
|
||||
logData.put("res_res", res);//
|
||||
if (sendFlag) {
|
||||
logData.put("res_body", stringBuffer.toString());//返回值
|
||||
}
|
||||
//写入传输日志
|
||||
MagicApi.savesavepriceapprovaLog(logData);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,298 @@
|
||||
package org.ssssssss.magicboot.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.xxl.job.core.context.XxlJobHelper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.ssssssss.magicboot.fxapi.HttpClientResult;
|
||||
import org.ssssssss.magicboot.fxapi.HttpClientUtils;
|
||||
import org.ssssssss.magicboot.fxapi.XKTokenAccess;
|
||||
import org.ssssssss.magicboot.fxapi.model.CrmFXApiParam;
|
||||
import org.ssssssss.magicboot.zdyutils.FXHTTP;
|
||||
import org.ssssssss.magicboot.zdyutils.GcjJson;
|
||||
import org.ssssssss.magicboot.zdyutils.MagicApi;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/returnapplication")
|
||||
public class returnapplicationController {
|
||||
static Logger log = LoggerFactory.getLogger("returnapplication");
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
new returnapplicationController().getSynDataAdd();
|
||||
new returnapplicationController().materialreqbillSave();
|
||||
|
||||
}
|
||||
|
||||
public void getSynDataAdd() throws Exception {
|
||||
FXHTTP fxapi = new FXHTTP();
|
||||
XKTokenAccess xktonken = new XKTokenAccess();
|
||||
// 查询magic接口
|
||||
//获取时间戳
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
String time = sdf.format(System.currentTimeMillis() - (1000 * 60 * 60));
|
||||
|
||||
String apiName = "return_application__c";
|
||||
|
||||
/* List<CrmFXApiParam> paramList = Arrays.asList(
|
||||
new CrmFXApiParam("GT", "last_modified_time", System.currentTimeMillis() - (1000 * 60 * 60 * 24)),
|
||||
new CrmFXApiParam("IS", "erp_id__c", ""),
|
||||
new CrmFXApiParam("EQ", "life_status", "normal")
|
||||
);*/
|
||||
|
||||
|
||||
List<CrmFXApiParam> paramList = Arrays.asList(new CrmFXApiParam("EQ", "name", "THSQ20250507-0001"));
|
||||
|
||||
JSONObject jsonject = fxapi.getSynNewDataObj(true, "退货申请", apiName, paramList);
|
||||
JSONArray array = jsonject.getJSONObject("data").getJSONArray("dataList");
|
||||
|
||||
|
||||
for (int i = 0; i < array.size(); i++) {
|
||||
JSONObject str = array.getJSONObject(i);
|
||||
String dataId = GcjJson.getNodeValue(str, "JSON._id") != null ? GcjJson.getNodeValue(str, "JSON._id").toString() : "";
|
||||
String nameData = GcjJson.getNodeValue(str, "JSON.name") != null ? GcjJson.getNodeValue(str, "JSON.name").toString() : "";
|
||||
|
||||
String syn_type = "0";//同步类型 0新增 1修改 2删除
|
||||
log.info("-------------------开始执行退货申请" + i + " -------------------" + nameData);
|
||||
XxlJobHelper.log("-------------------开始执行退货申请" + i + " -------------------" + nameData);
|
||||
|
||||
Boolean sendFlag = false;
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
|
||||
try {
|
||||
boolean tbflag = false;
|
||||
//验证数据是否已存在
|
||||
JSONObject dataSyn = MagicApi.getSendSYNDatamaterialreqbill("THD", syn_type, dataId);
|
||||
|
||||
if (dataSyn != null && dataId.equals(dataSyn.getString("crmId"))) {
|
||||
log.info("数据已存在-" + nameData);
|
||||
XxlJobHelper.log("--数据已存在---" + nameData);
|
||||
tbflag = true;
|
||||
}
|
||||
if (tbflag) {
|
||||
continue;
|
||||
}
|
||||
log.info("退货申请待同步数据-" + i + " ------" + nameData);
|
||||
JSONObject jsonObjectData = new JSONObject();
|
||||
jsonObjectData.put("send_type", "THD"); //业务类型
|
||||
jsonObjectData.put("send_syn", "0"); //同步类型 0新增 1修改 2删除
|
||||
jsonObjectData.put("crm_id", dataId);//数据id
|
||||
jsonObjectData.put("crmzhu_id", dataId);//数据id
|
||||
jsonObjectData.put("send_status", 3);//同步状态 true同步成功 false同步失败 3待同步
|
||||
jsonObjectData.put("crm_code", nameData);//数据名称
|
||||
jsonObjectData.put("mark", nameData);//标识
|
||||
jsonObjectData.put("crm_json", str.toJSONString());//标识
|
||||
|
||||
MagicApi.saveSendSYNDatamaterialreqbill(jsonObjectData);
|
||||
} catch (Exception e) {
|
||||
continue;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void materialreqbillSave() throws Exception {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
|
||||
FXHTTP fxapi = new FXHTTP();
|
||||
String resJsonStr = MagicApi.getWNRES("http://localhost:18088/syn/querymaterialreqbill?sendType=THD&sendStatus=3&sendSyn=0", "");
|
||||
JSONObject resJson = JSON.parseObject(resJsonStr);
|
||||
if (resJson != null) {
|
||||
log.info("待同步退货申请数" + resJson.getJSONArray("data").size());
|
||||
for (int i = 0; i < resJson.getJSONArray("data").size(); i++) {
|
||||
|
||||
JSONObject getData = resJson.getJSONArray("data").getJSONObject(i);
|
||||
JSONObject str = getData.getJSONObject("crmJson");
|
||||
String syn_type = "0";//同步类型 0新增 1修改 2删除
|
||||
Boolean sendFlag = false;
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
boolean tbflag = false;
|
||||
// 构建json
|
||||
|
||||
String dataId = GcjJson.getNodeValue(str, "JSON._id") != null ? GcjJson.getNodeValue(str, "JSON._id").toString() : "";
|
||||
String nameData = GcjJson.getNodeValue(str, "JSON.name") != null ? GcjJson.getNodeValue(str, "JSON.name").toString() : "";
|
||||
|
||||
String remark = GcjJson.getNodeValue(str, "JSON.remark__c") != null ? GcjJson.getNodeValue(str, "JSON.remark__c").toString() : "";
|
||||
String contractno = GcjJson.getNodeValue(str, "JSON.contract_number_text__c") != null ? GcjJson.getNodeValue(str, "JSON.contract_number_text__c").toString() : "";
|
||||
|
||||
String erpid = GcjJson.getNodeValue(str, "JSON.erp_outbound_id__c") != null ? GcjJson.getNodeValue(str, "JSON.erp_outbound_id__c").toString() : "";
|
||||
|
||||
|
||||
String cemployeeid = "";
|
||||
if (GcjJson.getNodeValue(str, "JSON.owner__r.id") != null) {
|
||||
cemployeeid = GcjJson.getNodeValue(str, "JSON.owner__r.id").toString();
|
||||
cemployeeid = fxapi.getDataBYID("PersonnelObj", "_id", cemployeeid, "JSON.data.dataList[0].field_T1xid__c");
|
||||
}
|
||||
/* if (StringUtils.isBlank(cemployeeid)) {
|
||||
sendFlag = true;
|
||||
stringBuffer.append("销售员不存在\n");
|
||||
}*/
|
||||
String cdeptid = "";
|
||||
if (GcjJson.getNodeValue(str, "JSON.owner_department_id") != null) {
|
||||
String dept_id = GcjJson.getNodeValue(str, "JSON.owner_department_id").toString();
|
||||
cdeptid = fxapi.getDataBYID("DepartmentObj", "dept_id", dept_id, "JSON.data.dataList[0].field_Vj6sf__c");
|
||||
}
|
||||
String strJson = "";
|
||||
try{
|
||||
JSONObject dataSyn = MagicApi.getSendSYNDatamaterialreqbill("THD", syn_type, dataId,"3");
|
||||
if (dataSyn != null && dataId.equals(dataSyn.getString("crmId"))) {
|
||||
log.info("数据已存在-" + nameData);
|
||||
XxlJobHelper.log("--数据已存在---" + nameData);
|
||||
tbflag = true;
|
||||
}
|
||||
if (tbflag) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
JSONObject datajson = new JSONObject();
|
||||
//编号
|
||||
datajson.put("billno",nameData);
|
||||
datajson.put("biztime",sdf.format(GcjJson.getNodeValue(str, "JSON.return_date__c")));
|
||||
datajson.put("contractno",contractno);//contractno
|
||||
datajson.put("applydept","004");
|
||||
datajson.put("applyuser","ID-000016");
|
||||
datajson.put("bizorg","ZHY");
|
||||
datajson.put("org","ZHY");
|
||||
datajson.put("crmid",dataId);
|
||||
datajson.put("erpid",erpid);
|
||||
|
||||
JSONArray groupstandardarr = new JSONArray();
|
||||
|
||||
JSONObject jsonjectZ = fxapi.getZDYSynDataObj("退货申请明细", "return_application_details__c", "field_Ok1G3__c", dataId);
|
||||
JSONArray arrayZ = jsonjectZ.getJSONObject("data").getJSONArray("dataList");
|
||||
for (int j = 0; j < arrayZ.size(); j++) {
|
||||
JSONObject stra = arrayZ.getJSONObject(j);
|
||||
|
||||
JSONObject groupstandardjson = new JSONObject();
|
||||
|
||||
groupstandardjson.put("qty",GcjJson.getNodeValue(stra, "JSON.quantity__c"));
|
||||
|
||||
|
||||
|
||||
//设计文件编码
|
||||
groupstandardjson.put("designfileno",GcjJson.getNodeValue(stra, "JSON.design_file_encoding__c"));
|
||||
|
||||
groupstandardjson.put("crmentryid",GcjJson.getNodeValue(stra, "JSON._id"));
|
||||
//批号
|
||||
groupstandardjson.put("lot",GcjJson.getNodeValue(stra, "JSON.batch_number__c"));
|
||||
//产品编码
|
||||
groupstandardjson.put("material",GcjJson.getNodeValue(stra, "JSON.material_name__c"));
|
||||
//仓库编码
|
||||
groupstandardjson.put("warehouse",GcjJson.getNodeValue(stra, "JSON.warehouse_code__c"));
|
||||
//仓位
|
||||
|
||||
//项目编码
|
||||
groupstandardjson.put("project",GcjJson.getNodeValue(stra, "JSON.project_code__c"));
|
||||
groupstandardjson.put("ecostcenter","ZHY");
|
||||
|
||||
groupstandardjson.put("erpEntryId",GcjJson.getNodeValue(stra, "JSON.erp_outbound_line_id__c"));
|
||||
|
||||
|
||||
groupstandardarr.add(groupstandardjson);
|
||||
|
||||
}
|
||||
|
||||
datajson.put("entryList",groupstandardarr);//明细
|
||||
|
||||
log.info("--请求json---" + datajson.toJSONString());
|
||||
System.out.println("--请求json:---" +datajson.toJSONString());
|
||||
strJson = datajson.toJSONString();
|
||||
|
||||
}catch (Exception e) {
|
||||
sendFlag = true;
|
||||
stringBuffer.append("参数解析错误,请联系开发人员");
|
||||
e.printStackTrace();
|
||||
}
|
||||
getSynDataSave(stringBuffer,sendFlag,fxapi,dataId,nameData,strJson,getData);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 写数据
|
||||
*/
|
||||
public void getSynDataSave(StringBuffer stringBuffer,Boolean sendFlag,FXHTTP fxapi,String dataId,String nameData,String obj,JSONObject str) {
|
||||
String syn_type = "0";//同步类型 0新增 1修改 2删除
|
||||
String res_url = "http://192.168.31.233:8022/ierp/kapi/v2/f9w5/im/materialreqbill/save";
|
||||
String res_param = obj;
|
||||
String res = "";
|
||||
try {
|
||||
// String accessToken = "2095345516136108032_XQmekTd9H2mWOICLK86jt4bMzjP53Bm4KrspyFaPG790rSA6k3CdpwJ9fSx9RiBhK63rKELG7oIyLPdeNgpXu47zRh6Ndnud9jf009";
|
||||
String accessToken = new KDTokenController().getKDAccessTokenTest();
|
||||
|
||||
|
||||
Map<String, String> headers = new HashMap<String, String>();
|
||||
headers.put("accessToken", accessToken);//放token
|
||||
HttpClientResult rtn = HttpClientUtils.doPostJson(res_url, headers, obj);
|
||||
String resStr = rtn.getContent();
|
||||
JSONObject resjs = JSONObject.parseObject(resStr);
|
||||
res = resStr;
|
||||
if (resjs != null && resjs.getBoolean("status")) {
|
||||
JSONObject successdata = resjs.getJSONObject("data");
|
||||
JSONArray result = successdata.getJSONArray("result");
|
||||
JSONObject erpdata = (JSONObject) result.get(0);
|
||||
String erpid = erpdata.getString("id");
|
||||
|
||||
Map<String, Object> paramMap = new HashMap<String, Object>();
|
||||
paramMap.put("erp_id__c", erpid);//数据ID
|
||||
paramMap.put("sync_status__c", "option_sync_success__c");
|
||||
paramMap.put("sync_info__c", resjs.getString("message"));
|
||||
//回写json
|
||||
fxapi.upSynZDYFieldParam("", "return_application__c", dataId, paramMap);
|
||||
}else{
|
||||
sendFlag=true;
|
||||
stringBuffer.append("退货申请创建接口调用失败:"+resjs.getString("message"));
|
||||
Map<String, Object> paramMap = new HashMap<String, Object>();
|
||||
paramMap.put("sync_status__c", "option_sync_failure__c");
|
||||
paramMap.put("sync_info__c", stringBuffer);
|
||||
//回写json
|
||||
fxapi.upSynZDYFieldParam("", "return_application__c", dataId, paramMap);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
sendFlag = true;
|
||||
stringBuffer.append("退货申请创建接口调用失败,请检查网络配置");
|
||||
Map<String, Object> paramMap = new HashMap<String, Object>();
|
||||
paramMap.put("sync_status__c", "option_sync_failure__c");
|
||||
paramMap.put("sync_info__c", stringBuffer);
|
||||
//回写json
|
||||
fxapi.upSynFieldParam("", "return_application__c", dataId, paramMap);
|
||||
}
|
||||
|
||||
JSONObject sendData = new JSONObject();
|
||||
|
||||
sendData.put("send_status", !sendFlag);//同步状态 true同步成功 false同步失败 3待同步
|
||||
|
||||
sendData.put("send_id", str.getString("sendId")); //send_id
|
||||
MagicApi.updateSendSYUPDATEmaterialreqbill(sendData);
|
||||
|
||||
JSONObject logData = new JSONObject();
|
||||
logData.put("log_type", "THD"); //业务类型
|
||||
logData.put("log_status", !sendFlag);//同步状态 true同步成功 false同步失败 3待同步
|
||||
logData.put("syn_type", syn_type);//同步类型 0新增 1修改 2删除
|
||||
logData.put("data_id", dataId);//数据id
|
||||
logData.put("data_name", nameData);//数据名称
|
||||
logData.put("res_body", "同步成功");//返回值
|
||||
logData.put("res_url", res_url);//
|
||||
logData.put("res_param", res_param);//
|
||||
logData.put("res_res", res);//
|
||||
if (sendFlag) {
|
||||
logData.put("res_body", stringBuffer.toString());//返回值
|
||||
}
|
||||
//写入传输日志
|
||||
MagicApi.saveCustomermaterialreqbill(logData);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -223,12 +223,12 @@ public class salesPredictionController {
|
||||
*/
|
||||
public void getSynDataSave(StringBuffer stringBuffer,Boolean sendFlag,FXHTTP fxapi,String dataId,String nameData,String obj,JSONObject str) {
|
||||
String syn_type = "0";//同步类型 0新增 1修改 2删除
|
||||
String res_url = "http://192.168.31.158:8022/ierp/kapi/v2/f9w5/sm/f9w5_salespred/salespredSave";
|
||||
String res_url = "http://192.168.31.233:8022/ierp/kapi/v2/f9w5/sm/f9w5_salespred/salespredSave";
|
||||
String res_param = obj;
|
||||
String res = "";
|
||||
try {
|
||||
String accessToken = "2096108315279888384_8elReBSzvx315JiLWiH82YKJGosF3G2kN688q05rHUritX9x3fWS3lmetalPeMe3HceZV7fK1GdSJsk1J46A3S0VkOxIUqf7wnS207";
|
||||
// String accessToken = new KDTokenController().getKDAccessToken();
|
||||
// String accessToken = "2096108315279888384_8elReBSzvx315JiLWiH82YKJGosF3G2kN688q05rHUritX9x3fWS3lmetalPeMe3HceZV7fK1GdSJsk1J46A3S0VkOxIUqf7wnS207";
|
||||
String accessToken = new KDTokenController().getKDAccessTokenTest();
|
||||
|
||||
|
||||
Map<String, String> headers = new HashMap<String, String>();
|
||||
|
@ -48,6 +48,26 @@ public class MagicApi {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
public static void saveCustomermaterialreqbill(JSONObject data) {
|
||||
System.out.println(data);
|
||||
try {
|
||||
String res = HttpSend.sendMagicPost(
|
||||
"http://127.0.0.1:18088/send/log/savematerialreqbill"
|
||||
, data);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
public static void savesavepriceapprovaLog(JSONObject data) {
|
||||
System.out.println(data);
|
||||
try {
|
||||
String res = HttpSend.sendMagicPost(
|
||||
"http://127.0.0.1:18088/send/log/savepriceapprova"
|
||||
, data);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
public static void saveSPLog(JSONObject data) {
|
||||
System.out.println(data);
|
||||
try {
|
||||
@ -303,6 +323,28 @@ public class MagicApi {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void saveSendSYNDatapriceapprova(JSONObject data) {
|
||||
System.out.println(data.toJSONString());
|
||||
try {
|
||||
String res = HttpSend.sendMagicPost(
|
||||
"http://127.0.0.1:18088/syn/savepriceapprova"
|
||||
, data);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
public static void saveSendSYNDatamaterialreqbill(JSONObject data) {
|
||||
System.out.println(data.toJSONString());
|
||||
try {
|
||||
String res = HttpSend.sendMagicPost(
|
||||
"http://127.0.0.1:18088/syn/savematerialreqbill"
|
||||
, data);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void saveSendSYNDataSP(JSONObject data) {
|
||||
System.out.println(data.toJSONString());
|
||||
try {
|
||||
@ -353,6 +395,26 @@ public class MagicApi {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
public static void updateSendSYUPDATEpriceapprova(JSONObject data) {
|
||||
System.out.println(data.toJSONString());
|
||||
try {
|
||||
String res = HttpSend.sendMagicPost(
|
||||
"http://127.0.0.1:18088/syn/updatepriceapprova"
|
||||
, data);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
public static void updateSendSYUPDATEmaterialreqbill(JSONObject data) {
|
||||
System.out.println(data.toJSONString());
|
||||
try {
|
||||
String res = HttpSend.sendMagicPost(
|
||||
"http://127.0.0.1:18088/syn/updatematerialreqbill"
|
||||
, data);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
public static void updateSendSYUPDATESP(JSONObject data) {
|
||||
System.out.println(data.toJSONString());
|
||||
try {
|
||||
@ -402,6 +464,42 @@ public class MagicApi {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static JSONObject getSendSYNDatamaterialreqbill(String type, String syn, String dataId) {
|
||||
|
||||
try {
|
||||
String res = HttpSend.sendMagicGet(
|
||||
"http://127.0.0.1:18088/syn/querymaterialreqbill?sendType=" + URLEncoder.encode(type, "UTF-8")
|
||||
+ "&crmId=" + URLEncoder.encode(dataId, "UTF-8")
|
||||
+ "&sendSyn=" + URLEncoder.encode(syn, "UTF-8")
|
||||
, "");
|
||||
JSONObject resJson = JSONObject.parseObject(res);
|
||||
|
||||
if (resJson.getJSONArray("data").size() > 0) {
|
||||
return resJson.getJSONArray("data").getJSONObject(0);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public static JSONObject getSendSYNDatapriceapprova(String type, String syn, String dataId) {
|
||||
|
||||
try {
|
||||
String res = HttpSend.sendMagicGet(
|
||||
"http://127.0.0.1:18088/syn/querypriceapprova?sendType=" + URLEncoder.encode(type, "UTF-8")
|
||||
+ "&crmId=" + URLEncoder.encode(dataId, "UTF-8")
|
||||
+ "&sendSyn=" + URLEncoder.encode(syn, "UTF-8")
|
||||
, "");
|
||||
JSONObject resJson = JSONObject.parseObject(res);
|
||||
|
||||
if (resJson.getJSONArray("data").size() > 0) {
|
||||
return resJson.getJSONArray("data").getJSONObject(0);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public static JSONObject getSendSYNDataCustomer(String type, String syn, String dataId) {
|
||||
|
||||
try {
|
||||
@ -475,6 +573,44 @@ public class MagicApi {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public static JSONObject getSendSYNDataquerypriceapprova(String type, String syn, String dataId, String sendStatus3) {
|
||||
|
||||
try {
|
||||
String res = HttpSend.sendMagicGet(
|
||||
"http://127.0.0.1:18088/syn/querypriceapprova?sendType=" + URLEncoder.encode(type, "UTF-8")
|
||||
+ "&crmId=" + URLEncoder.encode(dataId, "UTF-8")
|
||||
+ "&sendSyn=" + URLEncoder.encode(syn, "UTF-8")
|
||||
+ "&sendStatus3="+sendStatus3
|
||||
, "");
|
||||
JSONObject resJson = JSONObject.parseObject(res);
|
||||
|
||||
if (resJson.getJSONArray("data").size() > 0) {
|
||||
return resJson.getJSONArray("data").getJSONObject(0);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public static JSONObject getSendSYNDatamaterialreqbill(String type, String syn, String dataId, String sendStatus3) {
|
||||
|
||||
try {
|
||||
String res = HttpSend.sendMagicGet(
|
||||
"http://127.0.0.1:18088/syn/querymaterialreqbill?sendType=" + URLEncoder.encode(type, "UTF-8")
|
||||
+ "&crmId=" + URLEncoder.encode(dataId, "UTF-8")
|
||||
+ "&sendSyn=" + URLEncoder.encode(syn, "UTF-8")
|
||||
+ "&sendStatus3="+sendStatus3
|
||||
, "");
|
||||
JSONObject resJson = JSONObject.parseObject(res);
|
||||
|
||||
if (resJson.getJSONArray("data").size() > 0) {
|
||||
return resJson.getJSONArray("data").getJSONObject(0);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public static JSONObject getSendSYNDataCustomer(String type, String syn, String dataId, String sendStatus3) {
|
||||
|
||||
try {
|
||||
|
Loading…
x
Reference in New Issue
Block a user