diff --git a/base-service/src/main/java/com/hzya/frame/sysnew/grovy/service/impl/GroovyIntegrationServiceImpl.java b/base-service/src/main/java/com/hzya/frame/sysnew/grovy/service/impl/GroovyIntegrationServiceImpl.java index ee5ee3a1..ac2aaef4 100644 --- a/base-service/src/main/java/com/hzya/frame/sysnew/grovy/service/impl/GroovyIntegrationServiceImpl.java +++ b/base-service/src/main/java/com/hzya/frame/sysnew/grovy/service/impl/GroovyIntegrationServiceImpl.java @@ -34,49 +34,67 @@ public class GroovyIntegrationServiceImpl implements IGroovyIntegrationService { } public static void main(String[] args) { - java.lang.String str = "{\"data\":{\"enablestate\":\"2\",\"user_password\":\"Hzya@1314\",\"gender\":\"12312\",\"user_name\":\"测试用户\",\"modify_time\":1719305835000,\"document_rule_num\":112,\"pk_org\":{\"org_mnecode\":\"1\",\"modify_time\":1718866279000,\"document_rule_num\":4,\"add_status\":\"0\",\"org_address\":\"1\",\"delete_status\":\"1\",\"org_innercode\":\"1\",\"id\":\"f7a8cee35fce4aa8ab266b3c7f125d7d\",\"data_status\":\"F\",\"modify_user_id\":\"1\",\"org_name\":\"开发部\",\"sorts\":4,\"document_rule\":\"ZZ-2024-06-20-00004\",\"create_user_id\":\"1\",\"create_time\":1718864103000,\"company_id\":\"Y\",\"org_memo\":\"1\",\"update_status\":\"0\",\"sts\":\"Y\",\"org_tel\":\"1\",\"org_id\":\"Y\",\"org_ncindustry\":\"1\",\"org_fatherorg\":\"c4913dde8da142bab4206fc084269382\",\"org_code\":\"003\",\"org_principal\":\"1\",\"org_countryzone\":\"1\"},\"add_status\":\"0\",\"pwdlevelcode\":\"\",\"user_type\":\"1\",\"user_code\":\"17633965916\",\"delete_status\":\"1\",\"id\":\"d99fe4e1c211450a960f7a1057da0d2c\",\"data_status\":\"F\",\"modify_user_id\":\"1\",\"sorts\":346,\"document_rule\":\"YH-2024-06-25-00112\",\"create_user_id\":\"1\",\"create_time\":1719305229000,\"company_id\":\"Y\",\"user_code_q\":\"KP003\",\"format\":\"ZH-CN\",\"mobile\":\"123123\",\"identityverifycode\":\"静态密码验证\",\"islocked\":\"N\",\"update_status\":\"0\",\"base_doc_type\":\"0\",\"sts\":\"Y\",\"login_name\":\"123123\",\"pwdparam\":\"2024-06-17\",\"org_id\":\"Y\",\"abledate\":\"2024-06-17 00:00:00\",\"isca\":\"Y\",\"contentlang\":\"ZH\"},\"query\":\"[]\",\"header\":\"[{\\\"parameterType\\\":\\\"fundamental\\\",\\\"length\\\":\\\"100\\\",\\\"index\\\":0,\\\"description\\\":\\\"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA87rrNR\\\",\\\"concreteType\\\":\\\"String\\\",\\\"id\\\":\\\"7127798c-b731-453a-b3ac-cfe9033eeace\\\",\\\"parameterName\\\":\\\"pubKey\\\",\\\"required\\\":true,\\\"example\\\":\\\"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA87rrNREgMNeOEOwlvM2iqqEfshDadRHziDSB2PbRnoMqSv1nGr3XBlZuseNj5HmxDEkLhOdfyw0yjzoz3wK7XhFpeN4Iyf7NT7hps5jAQMEpnul9Qwmj5qUr/eK5SaO9H8n7sh9BvCdrX9oRUh+U2/ceA3O+y/MUHk5DRvSadc8FhpqbOaNBbAzPnyYAwpVUPvaJ90jcGN1ZG99HR1GEzC+Cn9s6vgt7dYL6ysMs36bSP47xraDSxpfr0CLwa6JV/9KjLIeqL1ZaMtK0CJ1zJGCBA6O6kgxeE9Ul7q2lSS6mPAEJ78izaTYsrjhLpKT+eTtFBOLFbiCrbLp8tVE5kwIDAQAB\\\"},{\\\"parameterType\\\":\\\"fundamental\\\",\\\"length\\\":\\\"50\\\",\\\"index\\\":1,\\\"description\\\":\\\"OA\\\",\\\"concreteType\\\":\\\"String\\\",\\\"id\\\":\\\"7f965281-df0f-4d2f-b005-07e061fcde49\\\",\\\"parameterName\\\":\\\"client_id\\\",\\\"required\\\":true,\\\"example\\\":\\\"OA\\\"},{\\\"parameterType\\\":\\\"authport\\\",\\\"length\\\":\\\"50\\\",\\\"index\\\":2,\\\"concreteType\\\":\\\"String\\\",\\\"id\\\":\\\"cbc0e105-17c0-4385-8863-8903303edc1f\\\",\\\"parameterName\\\":\\\"access_token\\\",\\\"example\\\":[\\\"attribute\\\",\\\"data\\\",\\\"access_token\\\"]}]\",\"body\":\"[{\\\"index\\\":0,\\\"id\\\":\\\"beeedbc6-24c2-4093-9a5e-20fced9fb1b4\\\",\\\"parameterName\\\":\\\"body\\\",\\\"first\\\":true}]\"}"; + java.lang.String str = "{\"data\":{\"year\":\"2024\",\"prepared\":\"demo\",\"modify_time\":1730863191000,\"num\":\"13\",\"gl_detail\":[{\"create_user_id\":\"1\",\"amount\":\"5000\",\"formmain_id\":\"9da5a28900084951913df0d233427178\",\"create_time\":1730863191000,\"company_id\":\"0\",\"globalcreditamount\":\"0\",\"modify_time\":1730863191000,\"localcreditamount\":\"0\",\"localdebitamount\":\"5000\",\"explanation\":\"演示分录1\",\"globaldebitamount\":\"5000\",\"detail_id\":\"1\",\"groupdebitamount\":\"5000\",\"sts\":\"Y\",\"currtype_code\":\"CNY\",\"org_id\":\"0\",\"busidate\":\"2024-11-05\",\"groupcreditamount\":\"0\",\"detailindex\":\"1\",\"account_code\":\"100210\",\"id\":\"0eb6d3d5f12944e1bcbb00883cc4f13e\",\"data_status\":\"Y\",\"modify_user_id\":\"1\",\"sorts\":1},{\"create_user_id\":\"1\",\"amount\":\"5000\",\"formmain_id\":\"9da5a28900084951913df0d233427178\",\"create_time\":1730863191000,\"company_id\":\"0\",\"globalcreditamount\":\"5000\",\"modify_time\":1730863191000,\"localcreditamount\":\"5000\",\"localdebitamount\":\"0\",\"explanation\":\"演示分录2\",\"globaldebitamount\":\"0\",\"detail_id\":\"2\",\"groupdebitamount\":\"0\",\"sts\":\"Y\",\"currtype_code\":\"CNY\",\"org_id\":\"0\",\"busidate\":\"2024-11-05\",\"groupcreditamount\":\"5000\",\"detailindex\":\"2\",\"account_code\":\"2231\",\"id\":\"db9c531af7a94af2975d1c9f1ae21813\",\"data_status\":\"Y\",\"modify_user_id\":\"1\",\"sorts\":2}],\"document_rule_num\":1,\"add_status\":\"0\",\"vouchertype\":\"01\",\"attachment\":\"0\",\"delete_status\":\"1\",\"id\":\"9da5a28900084951913df0d233427178\",\"data_status\":\"Y\",\"modify_user_id\":\"1\",\"sorts\":1,\"document_rule\":\"PZ-20241106-00001\",\"create_user_id\":\"1\",\"period\":\"11\",\"create_time\":1730863191000,\"company_id\":\"Y\",\"update_status\":\"1\",\"accbook_code\":\"101-0002\",\"sts\":\"Y\",\"org_id\":\"Y\",\"prepareddate\":\"2024-11-05\",\"voucher_id\":\"1\",\"gl_fixtmpfreevalue\":[{\"create_user_id\":\"1\",\"formmain_id\":\"9da5a28900084951913df0d233427178\",\"create_time\":1730863191000,\"company_id\":\"0\",\"checktypecode\":\"0012\",\"modify_time\":1730863191000,\"checkvaluecode\":\"101\",\"detail_id\":\"2\",\"sts\":\"Y\",\"org_id\":\"0\",\"voucher_id\":\"1\",\"id\":\"779d40051ae3470583885d9c202d5ba1\",\"data_status\":\"Y\",\"modify_user_id\":\"1\",\"sorts\":1},{\"create_user_id\":\"1\",\"formmain_id\":\"9da5a28900084951913df0d233427178\",\"create_time\":1730863191000,\"company_id\":\"0\",\"checktypecode\":\"0006\",\"modify_time\":1730863191000,\"checkvaluecode\":\"000001\",\"detail_id\":\"2\",\"sts\":\"Y\",\"org_id\":\"0\",\"voucher_id\":\"1\",\"id\":\"f313361e495445958245ec61a00a1216\",\"data_status\":\"Y\",\"modify_user_id\":\"1\",\"sorts\":2}]},\"query\":\"[]\",\"header\":\"[{\\\"parameterType\\\":\\\"fundamental\\\",\\\"index\\\":0,\\\"concreteType\\\":\\\"String\\\",\\\"id\\\":\\\"77ba4bd1-c693-488f-b3b7-69bb4c02be76\\\",\\\"parameterName\\\":\\\"pubKey\\\",\\\"example\\\":\\\"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmlnN6sXjhJN6wUY0DILqiIL1ZX9ZU5Q40Hrr+4qhf3fddV/+/D1CyJo7aVGd3mJjD1BC1RXtnfxetaLzLrfTViq80RQvmmmKgt6rKiYMiW8ibcWoKaWMvwrlm0uT7RzYeXDP0l4qvoe8vjVWL63mQbx0y17p4opwTA9BV7P/CZ+9QyIJstN+yAg/owlNn48Jq4WspQps0/Zl/HvpiRjAPggVOqZLXkCjoBGrpNn/tlrDFbt+btK7tjhvsfT1zPMVAq8dNUKCMw5LoLsMxfT/ZWlI62zUAIbyO2/0iv5kCZw0I+DxPmGKVEOQ4x9FwXosSSD202H93CuBvVy/P31iUwIDAQAB\\\"},{\\\"parameterType\\\":\\\"fundamental\\\",\\\"index\\\":1,\\\"concreteType\\\":\\\"String\\\",\\\"id\\\":\\\"df32aa53-9c8e-4d31-8a9b-d78bc70f9214\\\",\\\"parameterName\\\":\\\"client_id\\\",\\\"example\\\":\\\"u8c\\\"},{\\\"parameterType\\\":\\\"authport\\\",\\\"index\\\":2,\\\"concreteType\\\":\\\"String\\\",\\\"id\\\":\\\"de304f55-ca04-47d9-93f9-70b52d9bba50\\\",\\\"parameterName\\\":\\\"access_token\\\",\\\"example\\\":[\\\"attribute\\\",\\\"data\\\",\\\"access_token\\\"]}]\",\"body\":\"[{\\\"parameterType\\\":\\\"complex\\\",\\\"children\\\":[{\\\"parameterType\\\":\\\"complex\\\",\\\"children\\\":[{\\\"parameterType\\\":\\\"fundamental\\\",\\\"concreteType\\\":\\\"String\\\",\\\"index\\\":2,\\\"parameterName\\\":\\\"accbookCode\\\",\\\"id\\\":\\\"95ff2224-bdb7-4a9d-a45b-8c19f444022b\\\",\\\"example\\\":\\\"X0644-0001\\\"},{\\\"parameterType\\\":\\\"fundamental\\\",\\\"concreteType\\\":\\\"String\\\",\\\"index\\\":3,\\\"parameterName\\\":\\\"prepareddate\\\",\\\"id\\\":\\\"7106bf79-133c-446e-be58-bf18d43a7c14\\\",\\\"example\\\":\\\"2023-09-19\\\"},{\\\"parameterType\\\":\\\"fundamental\\\",\\\"concreteType\\\":\\\"String\\\",\\\"index\\\":4,\\\"parameterName\\\":\\\"year\\\",\\\"id\\\":\\\"9b005ca9-e246-41c0-bbbb-aead5d6f44f1\\\",\\\"example\\\":\\\"2023\\\"},{\\\"parameterType\\\":\\\"fundamental\\\",\\\"concreteType\\\":\\\"String\\\",\\\"index\\\":5,\\\"parameterName\\\":\\\"num\\\",\\\"id\\\":\\\"fbe1d3a2-69e9-4df7-91d0-bb9005cd333e\\\",\\\"example\\\":\\\"4\\\"},{\\\"parameterType\\\":\\\"complexlist\\\",\\\"children\\\":[{\\\"parameterType\\\":\\\"fundamental\\\",\\\"concreteType\\\":\\\"String\\\",\\\"index\\\":7,\\\"parameterName\\\":\\\"detailindex\\\",\\\"id\\\":\\\"386e20b9-5992-4a95-8fa7-fb64677d55e9\\\",\\\"example\\\":\\\"1\\\"},{\\\"parameterType\\\":\\\"fundamental\\\",\\\"concreteType\\\":\\\"String\\\",\\\"index\\\":8,\\\"parameterName\\\":\\\"explanation\\\",\\\"id\\\":\\\"20cab876-bd5a-46b8-96ba-7112104a273f\\\",\\\"example\\\":\\\"测试\\\"},{\\\"parameterType\\\":\\\"fundamental\\\",\\\"concreteType\\\":\\\"String\\\",\\\"index\\\":9,\\\"parameterName\\\":\\\"accountCode\\\",\\\"id\\\":\\\"e1a89672-8449-4bda-a404-478f0594ac70\\\",\\\"example\\\":\\\"150401\\\"},{\\\"parameterType\\\":\\\"fundamental\\\",\\\"concreteType\\\":\\\"String\\\",\\\"index\\\":10,\\\"parameterName\\\":\\\"currtypeCode\\\",\\\"id\\\":\\\"43b33900-c5da-4afb-bbd7-0865bd02db58\\\",\\\"example\\\":\\\"CNY\\\"},{\\\"parameterType\\\":\\\"fundamental\\\",\\\"concreteType\\\":\\\"String\\\",\\\"index\\\":11,\\\"parameterName\\\":\\\"amount\\\",\\\"id\\\":\\\"4b0fd6a4-b1d0-489e-aec1-ca509e9221ad\\\",\\\"example\\\":\\\"1000\\\"},{\\\"parameterType\\\":\\\"fundamental\\\",\\\"concreteType\\\":\\\"String\\\",\\\"index\\\":12,\\\"parameterName\\\":\\\"localdebitamount\\\",\\\"id\\\":\\\"9a43ad19-f903-4a8a-a5ac-f13c9fba445e\\\",\\\"example\\\":\\\"1000\\\"},{\\\"parameterType\\\":\\\"fundamental\\\",\\\"concreteType\\\":\\\"String\\\",\\\"index\\\":13,\\\"parameterName\\\":\\\"localcreditamount\\\",\\\"id\\\":\\\"df2d1f92-89cb-411d-83ba-62366e931dba\\\",\\\"example\\\":\\\"0\\\"},{\\\"parameterType\\\":\\\"fundamental\\\",\\\"concreteType\\\":\\\"String\\\",\\\"index\\\":14,\\\"parameterName\\\":\\\"groupdebitamount\\\",\\\"id\\\":\\\"61965366-0500-40d7-bae4-5dd16eb90761\\\",\\\"example\\\":\\\"1000\\\"},{\\\"parameterType\\\":\\\"fundamental\\\",\\\"concreteType\\\":\\\"String\\\",\\\"index\\\":15,\\\"parameterName\\\":\\\"groupcreditamount\\\",\\\"id\\\":\\\"bdc3c6c2-de87-45f1-85cf-24f3b92920c6\\\",\\\"example\\\":\\\"0\\\"},{\\\"parameterType\\\":\\\"fundamental\\\",\\\"concreteType\\\":\\\"String\\\",\\\"index\\\":16,\\\"parameterName\\\":\\\"globaldebitamount\\\",\\\"id\\\":\\\"a6069792-2a6b-43ba-97d7-504e1c5e3156\\\",\\\"example\\\":\\\"1000\\\"},{\\\"parameterType\\\":\\\"fundamental\\\",\\\"concreteType\\\":\\\"String\\\",\\\"index\\\":17,\\\"parameterName\\\":\\\"globalcreditamount\\\",\\\"id\\\":\\\"528b2c6b-86a5-47ec-8b26-00259dacb0b4\\\",\\\"example\\\":\\\"0\\\"},{\\\"parameterType\\\":\\\"fundamental\\\",\\\"concreteType\\\":\\\"String\\\",\\\"index\\\":18,\\\"parameterName\\\":\\\"busidate\\\",\\\"id\\\":\\\"11636e2a-b9d8-4ee3-81fc-0e809d11bf4f\\\",\\\"example\\\":\\\"2023-09-19\\\"},{\\\"parameterType\\\":\\\"complexlist\\\",\\\"children\\\":[{\\\"parameterType\\\":\\\"fundamental\\\",\\\"concreteType\\\":\\\"String\\\",\\\"index\\\":20,\\\"parameterName\\\":\\\"checktypecode\\\",\\\"id\\\":\\\"b56bf160-7180-47ea-996a-acd8307eb5fa\\\",\\\"example\\\":\\\"0004\\\"},{\\\"parameterType\\\":\\\"fundamental\\\",\\\"concreteType\\\":\\\"String\\\",\\\"index\\\":21,\\\"parameterName\\\":\\\"checkvaluecode\\\",\\\"id\\\":\\\"88d4fbb0-d3b7-4f1e-981d-71e60d10e603\\\",\\\"example\\\":\\\"X0015\\\"}],\\\"concreteType\\\":\\\"ObjectCom\\\",\\\"index\\\":19,\\\"parameterName\\\":\\\"ass\\\",\\\"id\\\":\\\"c10103af-f382-4c9b-a8f4-0738b664abb0\\\"}],\\\"concreteType\\\":\\\"ObjectCom\\\",\\\"index\\\":6,\\\"parameterName\\\":\\\"detail\\\",\\\"id\\\":\\\"70f9d810-039e-4884-b986-bc5b75331fb4\\\"},{\\\"parameterType\\\":\\\"fundamental\\\",\\\"concreteType\\\":\\\"String\\\",\\\"index\\\":22,\\\"parameterName\\\":\\\"period\\\",\\\"id\\\":\\\"de91d6ad-c07b-4f84-a8c9-52e87de39d50\\\",\\\"example\\\":\\\"09\\\"},{\\\"parameterType\\\":\\\"fundamental\\\",\\\"concreteType\\\":\\\"String\\\",\\\"index\\\":23,\\\"parameterName\\\":\\\"vouchertype\\\",\\\"id\\\":\\\"5de12ed3-d27e-4848-a008-5fb2e5c656a8\\\",\\\"example\\\":\\\"01\\\"},{\\\"parameterType\\\":\\\"fundamental\\\",\\\"concreteType\\\":\\\"String\\\",\\\"index\\\":24,\\\"parameterName\\\":\\\"attachment\\\",\\\"id\\\":\\\"cc0ae4fb-5f33-46c9-a0bf-775b46ae8511\\\",\\\"example\\\":\\\"0\\\"},{\\\"parameterType\\\":\\\"fundamental\\\",\\\"concreteType\\\":\\\"String\\\",\\\"index\\\":25,\\\"parameterName\\\":\\\"prepared\\\",\\\"id\\\":\\\"4b1622d6-980e-4920-82d0-e078e8bdb009\\\",\\\"example\\\":\\\"zhuc\\\"}],\\\"concreteType\\\":\\\"Object\\\",\\\"index\\\":1,\\\"parameterName\\\":\\\"sendData\\\",\\\"id\\\":\\\"2fc2918b-73fd-4c31-ba9f-1721132f1fdf\\\"}],\\\"concreteType\\\":\\\"Object\\\",\\\"index\\\":0,\\\"id\\\":\\\"669eebef-e4ae-474e-9b88-46a5490dc3db\\\",\\\"parameterName\\\":\\\"body\\\",\\\"first\\\":true}]\"}"; A88772 s = new A88772(); s.execute(str); } static class A88772 { String execute(String jsonStr) { - com.alibaba.fastjson.JSONObject returnObject = new com.alibaba.fastjson.JSONObject(); - com.alibaba.fastjson.JSONObject bodys = new com.alibaba.fastjson.JSONObject(); - com.alibaba.fastjson.JSONObject reqData = com.alibaba.fastjson.JSON.parseObject(jsonStr); com.alibaba.fastjson.JSONObject data = reqData.getJSONObject("data"); - com.alibaba.fastjson.JSONObject ufinterfaceObject = new com.alibaba.fastjson.JSONObject(); - ufinterfaceObject.put("billtype", "customer"); - ufinterfaceObject.put("isexchange", "Y"); - ufinterfaceObject.put("replace", "Y"); - ufinterfaceObject.put("sender", "openUser"); - ufinterfaceObject.put("account", "ycjf"); - ufinterfaceObject.put("groupcode", "ycjf"); - com.alibaba.fastjson.JSONObject billObject = new com.alibaba.fastjson.JSONObject(); - com.alibaba.fastjson.JSONObject billheadObject = new com.alibaba.fastjson.JSONObject(); - billheadObject.put("code", data.get("code")); - billheadObject.put("custprop", data.get("custprop")); - billheadObject.put("custstate", data.get("custstate")); - billheadObject.put("pk_custclass", data.get("pk_custclass")); - billheadObject.put("pk_country", data.get("pk_country")); - billheadObject.put("pk_timezone", "P0800"); - billheadObject.put("pk_format", "ZH-CN"); - billheadObject.put("enablestate", data.get("enablestate")); - billheadObject.put("name", data.get("name")); - billheadObject.put("pk_group", data.get("pk_group")); - billheadObject.put("pk_org", data.get("pk_org")); - billheadObject.put("taxpayerid", data.get("taxpayerid")); - billObject.put("billhead", billheadObject); - ufinterfaceObject.put("bill", billObject); - bodys.put("ufinterface", ufinterfaceObject); - returnObject.put("bodys",bodys.toJSONString()); + com.alibaba.fastjson.JSONArray gl_detail = data.getJSONArray("gl_detail"); + com.alibaba.fastjson.JSONArray gl_fixtmpfreevalue = data.getJSONArray("gl_fixtmpfreevalue"); + + com.alibaba.fastjson.JSONObject returnObject = new com.alibaba.fastjson.JSONObject(); + com.alibaba.fastjson.JSONObject sendData = new com.alibaba.fastjson.JSONObject(); + sendData.put("accbookCode",data.getString("accbook_code")); + sendData.put("prepareddate",data.getString("prepareddate")); + sendData.put("year",data.getString("year")); + sendData.put("num",data.getString("num")); + sendData.put("period",data.getString("period")); + sendData.put("vouchertype",data.getString("vouchertype")); + sendData.put("attachment",data.getString("attachment")); + sendData.put("prepared",data.getString("prepared")); + com.alibaba.fastjson.JSONArray detail = new com.alibaba.fastjson.JSONArray(); + if(gl_detail != null && gl_detail.size() > 0){ + for (int i = 0; i < gl_detail.size(); i++) { + com.alibaba.fastjson.JSONObject detaildata = gl_detail.getJSONObject(i); + com.alibaba.fastjson.JSONObject object1 = new com.alibaba.fastjson.JSONObject(); + object1.put("detailindex",detaildata.getString("detailindex")); + object1.put("explanation",detaildata.getString("explanation")); + object1.put("accountCode",detaildata.getString("account_code")); + object1.put("currtypeCode",detaildata.getString("currtype_code")); + object1.put("amount",detaildata.getString("amount")); + object1.put("localdebitamount",detaildata.getString("localdebitamount")); + object1.put("localcreditamount",detaildata.getString("localcreditamount")); + object1.put("groupdebitamount",detaildata.getString("groupdebitamount")); + object1.put("groupcreditamount",detaildata.getString("groupcreditamount")); + object1.put("globaldebitamount",detaildata.getString("globaldebitamount")); + object1.put("globalcreditamount",detaildata.getString("globalcreditamount")); + object1.put("busidate",detaildata.getString("busidate")); + detail.add(object1); + if(gl_fixtmpfreevalue != null && gl_fixtmpfreevalue.size() > 0){ + com.alibaba.fastjson.JSONArray ass = new com.alibaba.fastjson.JSONArray(); + for (int i1 = 0; i1 < gl_fixtmpfreevalue.size(); i1++) { + if(gl_fixtmpfreevalue.getJSONObject(i1).getString("voucher_id").equals(data.getString("voucher_id")) + && gl_fixtmpfreevalue.getJSONObject(i1).getString("detail_id").equals(detaildata.getString("detail_id"))){ + com.alibaba.fastjson.JSONObject assdetail1 = new com.alibaba.fastjson.JSONObject(); + assdetail1.put("checktypecode",gl_fixtmpfreevalue.getJSONObject(i1).getString("checktypecode")); + assdetail1.put("checkvaluecode",gl_fixtmpfreevalue.getJSONObject(i1).getString("checkvaluecode")); + ass.add(assdetail1); + } + } + if(ass.size() > 0){ + object1.put("ass",ass); + + } + } + } + } + sendData.put("detail",detail); + returnObject.put("bodys",sendData); return returnObject.toJSONString(); - - - - - } } diff --git a/base-webapp/pom.xml b/base-webapp/pom.xml index 3507e248..f751b1fe 100644 --- a/base-webapp/pom.xml +++ b/base-webapp/pom.xml @@ -18,11 +18,11 @@ base-service ${revision} - - - - - + + com.hzya.frame + fw-bip + ${revision} + diff --git a/fw-bip/pom.xml b/fw-bip/pom.xml new file mode 100644 index 00000000..f0f762fa --- /dev/null +++ b/fw-bip/pom.xml @@ -0,0 +1,85 @@ + + + + kangarooDataCenterV3 + com.hzya.frame + ${revision} + + 4.0.0 + fw-bip + jar + ${revision} + + + + com.hzya.frame + base-service + ${revision} + + + mysql + mysql-connector-java + ${mysql-connector-java} + + + + com.hzya.bip + pubbaseapp_nccloud_rtLevel + 1 + system + ${basedir}/src/main/webapp/WEB-INF/lib/pubbaseapp_nccloud_rtLevel-1.jar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + none + execute + true + + + + + repackage + + + + + + + diff --git a/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/dao/IBipArchivesDao.java b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/dao/IBipArchivesDao.java new file mode 100644 index 00000000..02516313 --- /dev/null +++ b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/dao/IBipArchivesDao.java @@ -0,0 +1,15 @@ +package com.hzya.frame.bip.v3.v2207.dao; + +import com.hzya.frame.basedao.dao.IBaseDao; +import com.hzya.frame.bip.v3.v2207.entity.BipArchivesEntity; +import com.hzya.frame.bip.v3.v2207.entity.BipOrgsEntity; + +import java.util.List; + + +public interface IBipArchivesDao extends IBaseDao { + + List queryArchivesData(BipArchivesEntity archivesEntity); + List queryArchivesDatays(BipArchivesEntity archivesEntity); + +} diff --git a/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/dao/IBipOrgsDao.java b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/dao/IBipOrgsDao.java new file mode 100644 index 00000000..0ad05a4c --- /dev/null +++ b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/dao/IBipOrgsDao.java @@ -0,0 +1,17 @@ +package com.hzya.frame.bip.v3.v2207.dao; + +import com.hzya.frame.basedao.dao.IBaseDao; +import com.hzya.frame.bip.v3.v2207.entity.BipOrgsEntity; + +import java.util.List; + + +public interface IBipOrgsDao extends IBaseDao { + + /** + * 查询BIP业务单元 + * @param BipOrgsEntity + * @return + */ + List thirdInterfaceGetOrgs(BipOrgsEntity BipOrgsEntity); +} diff --git a/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/dao/IBipOrgsDetailsDao.java b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/dao/IBipOrgsDetailsDao.java new file mode 100644 index 00000000..e0e6ea3f --- /dev/null +++ b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/dao/IBipOrgsDetailsDao.java @@ -0,0 +1,17 @@ +package com.hzya.frame.bip.v3.v2207.dao; + +import com.hzya.frame.basedao.dao.IBaseDao; +import com.hzya.frame.bip.v3.v2207.entity.BipOrgsDetailsEntity; + +import java.util.List; + + +public interface IBipOrgsDetailsDao extends IBaseDao { + + /** + * 查询BIP业务单元银行账户 + * @param BipOrgsDetailsEntity + * @return + */ + List thirdInterfaceGetOrgsDetails(BipOrgsDetailsEntity BipOrgsDetailsEntity); +} diff --git a/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/dao/IBipSupplierDao.java b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/dao/IBipSupplierDao.java new file mode 100644 index 00000000..ba069080 --- /dev/null +++ b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/dao/IBipSupplierDao.java @@ -0,0 +1,18 @@ +package com.hzya.frame.bip.v3.v2207.dao; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.hzya.frame.basedao.dao.IBaseDao; +import com.hzya.frame.bip.v3.v2207.entity.BipSupplierEntity; + +import java.util.List; + + +public interface IBipSupplierDao extends IBaseDao { + + /** + * 查询BIP供应商 + * @param bipSupplierEntity + * @return + */ + List thirdInterfaceGetSupplier(BipSupplierEntity bipSupplierEntity); +} diff --git a/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/dao/IBipSupplierDetailsDao.java b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/dao/IBipSupplierDetailsDao.java new file mode 100644 index 00000000..2edaa29e --- /dev/null +++ b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/dao/IBipSupplierDetailsDao.java @@ -0,0 +1,18 @@ +package com.hzya.frame.bip.v3.v2207.dao; + +import com.hzya.frame.basedao.dao.IBaseDao; +import com.hzya.frame.bip.v3.v2207.entity.BipSupplierDetailsEntity; +import com.hzya.frame.bip.v3.v2207.entity.BipSupplierEntity; + +import java.util.List; + + +public interface IBipSupplierDetailsDao extends IBaseDao { + + /** + * 查询BIP供应商明细 + * @param bipSupplierDetailsEntity + * @return + */ + List thirdInterfaceGetSupplierDetails(BipSupplierDetailsEntity bipSupplierDetailsEntity); +} diff --git a/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/dao/impl/BipArchivesDaoImpl.java b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/dao/impl/BipArchivesDaoImpl.java new file mode 100644 index 00000000..987d702c --- /dev/null +++ b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/dao/impl/BipArchivesDaoImpl.java @@ -0,0 +1,25 @@ +package com.hzya.frame.bip.v3.v2207.dao.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.hzya.frame.basedao.dao.MybatisGenericDao; +import com.hzya.frame.bip.v3.v2207.dao.IBipArchivesDao; +import com.hzya.frame.bip.v3.v2207.dao.IBipOrgsDao; +import com.hzya.frame.bip.v3.v2207.entity.BipArchivesEntity; +import com.hzya.frame.bip.v3.v2207.entity.BipOrgsEntity; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Repository("bipArchivesDaoImpl") +public class BipArchivesDaoImpl extends MybatisGenericDao implements IBipArchivesDao { + + @Override + public List queryArchivesData(BipArchivesEntity entity) { + List o = super.query(getSqlIdPrifx() + "queryArchivesData", entity); + return o; + } @Override + public List queryArchivesDatays(BipArchivesEntity entity) { + List o = super.query(getSqlIdPrifx() + "queryArchivesDatays", entity); + return o; + } +} diff --git a/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/dao/impl/BipOrgsDaoImpl.java b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/dao/impl/BipOrgsDaoImpl.java new file mode 100644 index 00000000..478c54ca --- /dev/null +++ b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/dao/impl/BipOrgsDaoImpl.java @@ -0,0 +1,24 @@ +package com.hzya.frame.bip.v3.v2207.dao.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.hzya.frame.basedao.dao.MybatisGenericDao; +import com.hzya.frame.bip.v3.v2207.dao.IBipOrgsDao; +import com.hzya.frame.bip.v3.v2207.dao.IBipSupplierDao; +import com.hzya.frame.bip.v3.v2207.entity.BipOrgsEntity; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Repository("bipOrgsDaoImpl") +public class BipOrgsDaoImpl extends MybatisGenericDao implements IBipOrgsDao { + /** + * 查询BIP业务单元 + * @param BipOrgsEntity + * @return + */ + @DS("oracle91") + @Override + public List thirdInterfaceGetOrgs(BipOrgsEntity BipOrgsEntity) { + return super.query("com.hzya.frame.bip.v3.v2207.dao.impl.BipOrgsDaoImpl.thirdInterfaceGetOrgs",BipOrgsEntity); + } +} diff --git a/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/dao/impl/BipOrgsDetailsDaoImpl.java b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/dao/impl/BipOrgsDetailsDaoImpl.java new file mode 100644 index 00000000..5d51da6d --- /dev/null +++ b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/dao/impl/BipOrgsDetailsDaoImpl.java @@ -0,0 +1,19 @@ +package com.hzya.frame.bip.v3.v2207.dao.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.hzya.frame.basedao.dao.MybatisGenericDao; +import com.hzya.frame.bip.v3.v2207.dao.IBipOrgsDetailsDao; +import com.hzya.frame.bip.v3.v2207.dao.IBipSupplierDetailsDao; +import com.hzya.frame.bip.v3.v2207.entity.BipOrgsDetailsEntity; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Repository("bipOrgsDetailsDaoImpl") +public class BipOrgsDetailsDaoImpl extends MybatisGenericDao implements IBipOrgsDetailsDao { + @DS("oracle91") + @Override + public List thirdInterfaceGetOrgsDetails(BipOrgsDetailsEntity bipOrgsDetailsEntity) { + return super.query("com.hzya.frame.bip.v3.v2207.dao.impl.BipOrgsDetailsDaoImpl.thirdInterfaceGetOrgsDetails",bipOrgsDetailsEntity); + } +} diff --git a/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/dao/impl/BipSupplierDaoImpl.java b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/dao/impl/BipSupplierDaoImpl.java new file mode 100644 index 00000000..9abe9ee7 --- /dev/null +++ b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/dao/impl/BipSupplierDaoImpl.java @@ -0,0 +1,25 @@ +package com.hzya.frame.bip.v3.v2207.dao.impl; + +import cn.hutool.http.HttpRequest; +import com.baomidou.dynamic.datasource.annotation.DS; +import com.hzya.frame.basedao.dao.MybatisGenericDao; +import com.hzya.frame.bip.v3.v2207.dao.IBipSupplierDao; +import com.hzya.frame.bip.v3.v2207.entity.BipSupplierEntity; +import com.hzya.frame.util.HttpUtil; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Repository("bipSupplierDaoImpl") +public class BipSupplierDaoImpl extends MybatisGenericDao implements IBipSupplierDao { + /** + * 查询BIP供应商 + * @param bipSupplierEntity + * @return + */ + @DS("oracle91") + @Override + public List thirdInterfaceGetSupplier(BipSupplierEntity bipSupplierEntity) { + return super.query("com.hzya.frame.bip.v3.v2207.dao.impl.BipSupplierDaoImpl.thirdInterfaceGetSupplier",bipSupplierEntity); + } +} diff --git a/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/dao/impl/BipSupplierDetailsDaoImpl.java b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/dao/impl/BipSupplierDetailsDaoImpl.java new file mode 100644 index 00000000..89443371 --- /dev/null +++ b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/dao/impl/BipSupplierDetailsDaoImpl.java @@ -0,0 +1,20 @@ +package com.hzya.frame.bip.v3.v2207.dao.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.hzya.frame.basedao.dao.MybatisGenericDao; +import com.hzya.frame.bip.v3.v2207.dao.IBipSupplierDao; +import com.hzya.frame.bip.v3.v2207.dao.IBipSupplierDetailsDao; +import com.hzya.frame.bip.v3.v2207.entity.BipSupplierDetailsEntity; +import com.hzya.frame.bip.v3.v2207.entity.BipSupplierEntity; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Repository("bipSupplierDetailsDaoImpl") +public class BipSupplierDetailsDaoImpl extends MybatisGenericDao implements IBipSupplierDetailsDao { + @DS("oracle91") + @Override + public List thirdInterfaceGetSupplierDetails(BipSupplierDetailsEntity bipSupplierDetailsEntity) { + return super.query("com.hzya.frame.bip.v3.v2207.dao.impl.BipSupplierDetailsDaoImpl.thirdInterfaceGetSupplierDetails",bipSupplierDetailsEntity); + } +} diff --git a/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/dps/service/IPayMentService.java b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/dps/service/IPayMentService.java new file mode 100644 index 00000000..ba800dce --- /dev/null +++ b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/dps/service/IPayMentService.java @@ -0,0 +1,38 @@ +package com.hzya.frame.bip.v3.v2207.dps.service; + +import com.alibaba.fastjson.JSONObject; + + +public interface IPayMentService { + + /** + * + * @content 获取杭泰OA付款单传递CFS + * @Param + * @Return + * @Author hecan + * @Date 2023/10/16 11:59 + * **/ + String sendOAPayMentToCFS(JSONObject jsonObject, String type); + + /** + * + * @content 获取CFS登录校验码 + * @Param + * @Return + * @Author hecan + * @Date 2023/10/16 13:37 + * **/ + String sendCFSToken(String name, String password); + + /** + * + * @content 获取杭泰OA报销单传递CFS + * @Param + * @Return + * @Author hecan + * @Date 2023/10/16 16:17 + * **/ + String sendExpenseToCFS(JSONObject jsonObject); + +} diff --git a/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/dps/service/impl/PayMentServiceImpl.java b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/dps/service/impl/PayMentServiceImpl.java new file mode 100644 index 00000000..1b9308a5 --- /dev/null +++ b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/dps/service/impl/PayMentServiceImpl.java @@ -0,0 +1,389 @@ +package com.hzya.frame.bip.v3.v2207.dps.service.impl; + +import cn.hutool.http.HttpRequest; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.bip.v3.v2207.dps.service.IPayMentService; +import com.hzya.frame.dateutil.DateUtil; +import org.dom4j.Document; +import org.dom4j.DocumentHelper; +import org.dom4j.Element; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; +import org.xml.sax.InputSource; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import java.io.StringReader; +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + + +@Service(value = "payMentServiceImpl") +public class PayMentServiceImpl implements IPayMentService { + + private static final Logger logger = LoggerFactory.getLogger(PayMentServiceImpl.class); + + private static final String NAME="admin"; + private static final String PASSWORD="aHRzejg4OA=="; + private static final String CFSURL="http://101.132.140.208:26883/erp/services/";//测试端口:26893,正式端口:26883 + + /** + * + * @content 杭泰OA付款单传递CFS 注:付款单,资金归集,资金拨付,同名账户划转和借款单都用同一个接口 + * @Param + * @Return + * @Author hecan + * @Date 2023/10/13 10:40 + * **/ + public String sendOAPayMentToCFS(JSONObject jsonStr,String type){ + logger.info("开始执行杭泰OA付款单传递CFS"); + try { + String cfsToken = sendCFSToken(NAME, PASSWORD); + if(null!=cfsToken) { + String jsonStrObj = jsonStr.getString("jsonStr"); + JSONObject jsonObjectMain = JSON.parseObject(jsonStrObj); + String erpVoucherNo = jsonObjectMain.getString("erpVoucherNo");//OA主键 + String purpose = jsonObjectMain.getString("purpose");//摘要 + String isForindividual = "0";//是否对私付款 + StringBuffer stringBuffer = new StringBuffer(); + String documentType=null; + switch (type){ + case "pay"://付款单 + documentType="01"; + break; + case "fundc"://资金归集 + documentType="02"; + break; + case "funda"://资金拨付 + documentType="03"; + break; + case "acc"://同名账户划转 + documentType="04"; + break; + case "loan"://借款单 + documentType="05"; + break; + default: + break; + } + JSONArray jsonStrList = jsonObjectMain.getJSONArray("details"); + if (null != jsonStrList && jsonStrList.size() > 0) { + for (Object seeyonEntity : jsonStrList) { + JSONObject jsonObjectFormson = JSON.parseObject(JSON.toJSONString(seeyonEntity)); + String payerAccName = jsonObjectFormson.getString("payerAccName");//转出方账户名(付款账户) + String payerAccNo = jsonObjectFormson.getString("payerAccNo");//转出方账号(付款账号) + String curCode = jsonObjectFormson.getString("curCode");//付款方币种 + String payeeAccName = jsonObjectFormson.getString("payeeAccName");//收款人帐户名称 + String payeeAccNo = jsonObjectFormson.getString("payeeAccNo");//收款方账户号 + BigDecimal amount = jsonObjectFormson.getBigDecimal("amount");//发生额 + String payeeBankCode = jsonObjectFormson.getString("payeeBankCode");//联行号 + String isQuick = jsonObjectFormson.getString("isQuick");//加急标志 + String payType = jsonObjectFormson.getString("payType");//结算方式 + String businessType = jsonObjectFormson.getString("businessType");//业务类别 + stringBuffer.append("\n"); + stringBuffer.append("" + nullConvert(documentType) + "\n"); + stringBuffer.append("" + nullConvert(erpVoucherNo) + "\n"); + //stringBuffer.append(""+"浙江杭泰数智能源开发有限公司"+"\n"); + stringBuffer.append(""+nullConvert(payerAccName)+"\n"); + //stringBuffer.append("" +"71010122002702903"+ "\n"); + stringBuffer.append("" + nullConvert(payerAccNo) + "\n"); + stringBuffer.append("" + nullConvert(curCode) + "\n"); + stringBuffer.append("" + nullConvert(payeeAccName) + "\n"); + stringBuffer.append("" + nullConvert(payeeAccNo) + "\n"); + stringBuffer.append("" + nullConvert(String.valueOf(amount)) + "\n"); + //stringBuffer.append(""+"301331000029"+"\n"); + stringBuffer.append(""+nullConvert(payeeBankCode)+"\n"); + stringBuffer.append("" + nullConvert(isQuick) + "\n"); + stringBuffer.append("" + nullConvert(isForindividual) + "\n"); + stringBuffer.append("" + nullConvert(payType) + "\n"); + stringBuffer.append("" + nullConvert(purpose) + "\n"); + stringBuffer.append("" + nullConvert(businessType) + "\n"); + stringBuffer.append("" + nullConvert(jsonObjectFormson.getString("debitByCustomer")) + "\n");//借方客商辅助核算编码 + stringBuffer.append("" + nullConvert(payeeAccNo) + "\n");//借方银行账户辅助核算编码 + stringBuffer.append("" + nullConvert(jsonObjectFormson.getString("debitByPersonnel")) + "\n");//借方人员辅助核算编码 + stringBuffer.append("" + nullConvert(jsonObjectFormson.getString("creditByCustomer")) + "\n");//贷方客商辅助核算编码 + stringBuffer.append("" + nullConvert(payerAccNo) + "\n");//贷方银行辅助核算编码 + stringBuffer.append("\n"); + } + } else { + stringBuffer.append("\n"); + stringBuffer.append("" + nullConvert(erpVoucherNo) + ""); + stringBuffer.append("" + nullConvert(purpose) + ""); + stringBuffer.append("" + nullConvert(isForindividual) + ""); + stringBuffer.append("\n"); + } + String result=null; + String xml= requestXML(cfsToken,"BkPaymentMainExchange",stringBuffer,"OA付款单同步发送"); + String url = "HTSZ_OA_BkPaymentMainWebService?wsdl"; + switch (type){ + case "pay"://付款单 + logger.info("OA付款单发送CFS的请求参数为:{}", xml); + result = HttpRequest.post(CFSURL+url).header("Content-Type", "soap/xml").timeout(30000).body(xml).execute().body(); + logger.info("OA付款单发送CFS的返回参数为:{}", result); + break; + case "fundc"://资金归集 + logger.info("OA资金归集发送CFS的请求参数为:{}", xml); + result = HttpRequest.post(CFSURL+url).header("Content-Type", "soap/xml").timeout(30000).body(xml).execute().body(); + logger.info("OA资金归集发送CFS的返回参数为:{}", result); + break; + case "funda"://资金调拨 + logger.info("OA资金拨付发送CFS的请求参数为:{}", xml); + result = HttpRequest.post(CFSURL+url).header("Content-Type", "soap/xml").timeout(30000).body(xml).execute().body(); + logger.info("OA资金拨付发送CFS的返回参数为:{}", result); + break; + case "acc"://同名账户划转 + logger.info("OA同名账户划转发送CFS的请求参数为:{}", xml); + result = HttpRequest.post(CFSURL+url).header("Content-Type", "soap/xml").timeout(30000).body(xml).execute().body(); + logger.info("OA同名账户划转发送CFS的返回参数为:{}", result); + break; + case "loan"://借款单 + logger.info("OA借还款发送CFS的请求参数为:{}", xml); + result = HttpRequest.post(CFSURL+url).header("Content-Type", "soap/xml").timeout(30000).body(xml).execute().body(); + logger.info("OA借还款发送CFS的返回参数为:{}", result); + break; + default: + break; + } + return analyzeXML(result,"pay"); + }else{ + logger.info("请先登录CFS登录接口获取Token"); + return null; + } + } catch (Exception e) { + e.printStackTrace(); + logger.info("杭泰OA付款单传递CFS错误,原因为:{}", e.getMessage()); + } + return null; + } + + /** + * + * @content 获取CFS登录校验码 + * @Param + * @Return + * @Author hecan + * @Date 2023/10/13 15:38 + * **/ + public String sendCFSToken(String name,String password) { + try { + String xml="\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + "\n" + + "\n" + + "LogOn\n" + + ""+DateUtil.dateToString(new Date(), "yyyy-MM-dd HH:mm:ss")+"\n" + + "OA\n" + + "CFS\n" + + "OA登录验证发送\n" + + "\n" + + "\n" + + ""+name+"\n" + + ""+password+"\n" + + "\n" + + "\n" + + " ]]>\n" + + " \n" + + " \n" + + " \n" + + ""; + logger.info("CFS登录的请求参数为:{}",xml); + String url="HTSZ_OA_LogOnWebService?wsdl"; + String result = HttpRequest.post(CFSURL+url).header("Content-Type", "soap/xml").timeout(30000).body(xml).execute().body(); + logger.info("CFS登录的返回参数为:{}",result); + return analyzeXML(result,"login"); + }catch (Exception e){ + e.printStackTrace(); + logger.info("获取CFS登录失败,原因为:{}",e.getMessage()); + } + return null; + } + + /** + * + * @content 获取杭泰OA报销单传递CFS + * @Param + * @Return + * @Author hecan + * @Date 2023/10/16 16:17 + * **/ + @Override + public String sendExpenseToCFS(JSONObject jsonStr) { + logger.info("开始执行杭泰OA报销单传递CFS"); + try { + String token = sendCFSToken(NAME, PASSWORD); + if(null != token){ + String jsonStrObj = jsonStr.getString("jsonStr"); + JSONObject jsonObjectMain = JSON.parseObject(jsonStrObj); + String erpVoucherNo = jsonObjectMain.getString("erpVoucherNo");//OA主键 + String purpose = jsonObjectMain.getString("purpose");//摘要 + StringBuffer stringBuffer = new StringBuffer(); + JSONArray jsonStrList = jsonObjectMain.getJSONArray("details"); + if(null != jsonStrList && jsonStrList.size()>0){ + for (Object o : jsonStrList) { + JSONObject jsonObjectDetails = JSON.parseObject(JSON.toJSONString(o)); + String payerAccName = jsonObjectDetails.getString("payerAccName");//转出方账户名(付款账户) + String payerAccNo = jsonObjectDetails.getString("payerAccNo");//转出方账号(付款账号) + String curCode = jsonObjectDetails.getString("curCode");//付款方币种 + String payeeAccName = jsonObjectDetails.getString("payeeAccName");//收款人帐户名称 + String payeeAccNo = jsonObjectDetails.getString("payeeAccNo");//收款方账户号 + BigDecimal amount = jsonObjectDetails.getBigDecimal("amount");//发生额 + String payeeBankCode = jsonObjectDetails.getString("payeeBankCode");//联行号 + String isQuick = jsonObjectDetails.getString("isQuick");//加急标志 + String payType = jsonObjectDetails.getString("payType");//结算方式 + stringBuffer.append("\n"); + stringBuffer.append("" + nullConvert(erpVoucherNo) + "\n"); + stringBuffer.append("" + nullConvert(payerAccName) + "\n"); + //stringBuffer.append(""+"浙江杭泰数智能源开发有限公司"+"\n"); + stringBuffer.append("" + nullConvert(payerAccNo) + "\n"); + //stringBuffer.append("" +"71010122002702903"+ "\n"); + stringBuffer.append("" + nullConvert(curCode) + "\n"); + stringBuffer.append("" + nullConvert(payeeAccName) + "\n"); + stringBuffer.append("" + nullConvert(payeeAccNo) + "\n"); + stringBuffer.append("" + nullConvert(String.valueOf(amount)) + "\n"); + stringBuffer.append("" + nullConvert(payeeBankCode) + "\n"); + //stringBuffer.append(""+"301331000029"+"\n"); + stringBuffer.append("" + nullConvert(isQuick) + "\n"); + stringBuffer.append("" + nullConvert(payType) + "\n"); + stringBuffer.append("" + nullConvert(purpose) + "\n"); + stringBuffer.append("\n"); + } + } else { + stringBuffer.append("\n"); + stringBuffer.append("" + erpVoucherNo + "\n"); + stringBuffer.append("" + purpose + "\n"); + stringBuffer.append("\n"); + } + String xml= requestXML(token,"BkExpenseExchange",stringBuffer,"OA费用报销单同步发送"); + logger.info("OA报销单发送CFS的请求参数为:{}", xml); + String url = "HTSZ_OA_BkExpenseWebService?wsdl"; + String result = HttpRequest.post(CFSURL+url).header("Content-Type", "soap/xml").timeout(30000).body(xml).execute().body(); + logger.info("OA报销单发送CFS的返回参数为:{}", result); + return analyzeXML(result,"pay"); + } + }catch (Exception e){ + logger.info("杭泰OA报销单传递CFS错误,原因为:{}", e.getMessage()); + } + return null; + } + + //null转成空字符串 + private static String nullConvert(String str){ + if (null == str){ + return ""; + } + return str; + } + + private String requestXML(String token,String code,StringBuffer stringBuffer,String remark){ + String xml = "\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + "\n" + + "\n" + + "" + code + "\n" + + "" + DateUtil.dateToString(new Date(), "yyyy-MM-dd HH:mm:ss") + "\n" + + "OA\n" + + "CFS\n" + + "" + remark + "\n" + + "" + token + "\n" + + "\n" + + "\n" + + "\n"; + if (stringBuffer != null) { + xml += stringBuffer.toString(); + xml += "\n" + + "\n" + + "\n" + + " ]]>\n" + + " \n" + + " \n" + + " \n" + + ""; + } else { + xml += "\n" + + "\n" + + "\n" + + "]]>\n" + + " \n" + + " \n" + + " \n" + + ""; + } + return xml; + } + + /** + * + * @content 解析CFS返回的xml格式 + * @Param + * @Return + * @Author hecan + * @Date 2023/10/19 14:07 + * **/ + private static String analyzeXML(String result,String type){ + try { + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + DocumentBuilder builder = factory.newDocumentBuilder(); + org.w3c.dom.Document document = builder.parse(new InputSource(new StringReader(result))); + org.w3c.dom.Element bodyElement = (org.w3c.dom.Element) document.getElementsByTagName("ns:return").item(0); + if (null!=bodyElement) { + String textContent = bodyElement.getTextContent(); + Document documentContext = DocumentHelper.parseText(textContent); + Element rootElement = documentContext.getRootElement(); + Element body = rootElement.element("body"); + if (null != body) { + switch (type) { + case "login"://登录 + Element sessionId = body.element("sessionId"); + if (null != sessionId) { + logger.info("CFS登录的登录校验码为:{}", sessionId.getText()); + return sessionId.getText(); + } else { + logger.info("CFS登录的登录校验码没有获取到,请重新获取"); + return null; + } + case "pay"://付款单和报销单 + Element list = body.element("list"); + List elements = list.elements(); + String serialNo = null; + String statusMsg = null; + String erpVoucherNoCfs = null; + for (Element element : elements) { + serialNo = element.element("serialNo").getText(); + statusMsg = element.element("statusMsg").getText(); + erpVoucherNoCfs = element.element("erpVoucherNo").getText(); + } + JSONObject jsonObject=new JSONObject(); + jsonObject.put("erpVoucherNoCfs",erpVoucherNoCfs); + jsonObject.put("statusMsg",statusMsg); + jsonObject.put("serialNo",serialNo); + //return "当前单据:" + erpVoucherNoCfs + ",传递CFS返回信息:" + statusMsg + ",流水号:" + serialNo; + return jsonObject.toJSONString(); + default: + break; + } + } + } + }catch (Exception e){ + logger.info("解析CFS返回的xml格式错误:{}",e.getMessage()); + } + return null; + } + + +} diff --git a/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/dps/task/ElectronicTask.java b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/dps/task/ElectronicTask.java new file mode 100644 index 00000000..a5b46c5d --- /dev/null +++ b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/dps/task/ElectronicTask.java @@ -0,0 +1,194 @@ +package com.hzya.frame.bip.v3.v2207.dps.task; + +import cn.hutool.core.util.StrUtil; +import cn.hutool.http.HttpRequest; +import cn.hutool.http.HttpUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.bip.v3.v2207.dps.service.IPayMentService; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.scheduling.annotation.EnableScheduling; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.io.File; +import java.util.HashMap; + + +@EnableScheduling +@Component +public class ElectronicTask { + static Logger logger= LoggerFactory.getLogger(ElectronicTask.class); + + @Resource + private IPayMentService payMentService; + //@Resource + //private ISeeYonDao seeYonDao; + //@Resource + //private ICtpAttachmentDao ctpAttachmentDao; + + + //@Scheduled(cron = "0 20 10 * * ?") + //public void sendElectronicToCFS() { + // logger.info("CFS电子回单共享开始执行---------->"); + // try { + // String token = payMentService.sendCFSToken("admin", "aHRzejg4OA=="); + // if(null!=token) { + // List seeyonEntities = seeYonDao.selectOAListByTypeformmain_0327(new SeeyonEntity()); + // if (seeyonEntities != null && seeyonEntities.size() > 0) { + // for (SeeyonEntity seeyonEntity : seeyonEntities) { + // String bankAcc = seeyonEntity.getField0137();//付款账号 + // //String bankAcc="03005389347"; + // String erpVoucherNo = seeyonEntity.getId();//OA付款单号 + // String xml = "\n" + + // " \n" + + // " \n" + + // " \n" + + // " \n" + + // " \n" + + // " \n" + + // "\n" + + // "\n" + + // "BkReceiptQueryExchange\n" + + // "" + DateUtil.dateToString(new Date(), "yyyy-mm-dd hh:mm:ss") + "\n" + + // "CFS\n" + + // "OA\n" + + // "OA电子回单共享发送\n" + + // "" + token + "\n" + + // "\n" + + // "\n" + + // "" + bankAcc + "\n" + + // "" + erpVoucherNo + "\n" + + // "\n" + + // "\n" + + // " ]]>\n" + + // " \n" + + // " \n" + + // " \n" + + // ""; + // logger.info("CFS电子回单共享请求参数为:{}", xml); + // String url = "http://101.132.140.208:26893/erp/services/HTSZ_OA_BkReceiptQueryWebService?wsdl"; + // String result = HttpRequest.post(url).header("Content-Type", "soap/xml").timeout(30000).body(xml).execute().body(); + // logger.info("CFS电子回单共享请求参数为:{}", result); + // DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + // DocumentBuilder builder = factory.newDocumentBuilder(); + // org.w3c.dom.Document document = builder.parse(new InputSource(new StringReader(result))); + // org.w3c.dom.Element bodyElement = (org.w3c.dom.Element) document.getElementsByTagName("ns:return").item(0); + // if (null != bodyElement) { + // String textContent = bodyElement.getTextContent(); + // Document documentContext = DocumentHelper.parseText(textContent); + // Element rootElement = documentContext.getRootElement(); + // Element body = rootElement.element("body"); + // if("0000".equalsIgnoreCase(rootElement.element("head").element("returnCode").getText())){ + // if (null != body) { + // Element listElc = body.element("list"); + // List elementsElc = listElc.elements(); + // for (Element element : elementsElc) { + // String fielPath = element.element("filePath").getText();//电子回单附件路径 + // if (fielPath != null && fielPath!="") { + // // String fielPath="C:\\Users\\笃曙\\Desktop\\15HZ000342CIBN2023091100066856211000001.pdf"; + // File file = new File(fielPath); + // JSONObject jsonObject = fileUpload(file); + // logger.info("上传返回的附件id为:{}", jsonObject.getString("fileUrl")); + // if (jsonObject.getString("fileUrl") != null) { + // //表单的附件字段=ctpAttachment的Sub_reference,表单的Summary_id=ctpAttachment的att_reference + // String sub_reference = String.valueOf(UUIDLong.longUUID()); + // seeyonEntity.setField0264(sub_reference); + // seeYonDao.updateFormformmain_0327(seeyonEntity); + // //根据附件id查询附件业务数据 + // String file_url = jsonObject.getString("fileUrl"); + // CtpAttachmentEntity ctpAttachmentEntity = new CtpAttachmentEntity(); + // ctpAttachmentEntity.setFile_url(file_url); + // String att_reference = seeyonEntity.getSummary_id();//Summary_id + // ctpAttachmentEntity.setSub_reference(sub_reference); + // ctpAttachmentEntity.setAtt_reference(att_reference); + // List ctpAttachmentEntities = ctpAttachmentDao.queryCtpAttachment(ctpAttachmentEntity); + // //如果没有查询到数据,就新增附件业务,否则更新 + // if (ctpAttachmentEntities.size() == 0) { + // String category = jsonObject.getString("category"); + // String type = jsonObject.getString("type"); + // String filename = jsonObject.getString("filename"); + // String mime_type = jsonObject.getString("mimeType"); + // String attachment_size = jsonObject.getString("size"); + // String id = String.valueOf(UUIDLong.longUUID()); + // ctpAttachmentEntity.setCategory(category); + // ctpAttachmentEntity.setFilename(filename); + // ctpAttachmentEntity.setType(type); + // ctpAttachmentEntity.setMime_type(mime_type); + // ctpAttachmentEntity.setAttachment_size(attachment_size); + // ctpAttachmentEntity.setId(id); + // ctpAttachmentEntity.setCategory("66"); + // ctpAttachmentEntity.setCreatedate(new Date()); + // ctpAttachmentDao.saveCtpAttachment(ctpAttachmentEntity); + // } else { + // if (ctpAttachmentEntities.size() > 1) { + // throw new BaseSystemException("OA附件业务表中查到多条记录"); + // } + // //更新数据到OA附件业务表中 + // ctpAttachmentDao.updateCtpAttachment(ctpAttachmentEntity); + // } + // } + // } + // } + // } + // }else{ + // logger.info("CFS电子回单返回得错误编码:{},以及返回的错误信息:{}",rootElement.element("head").element("returnCode").getText(),rootElement.element("head").element("returnMsg").getText()); + // } + // } + // } + // } + // } + // }catch (Exception e){ + // logger.info("CFS电子回单共享错误:{}",e.getMessage()); + // } + //} + + + public static JSONObject fileUpload(File file) { + if (null != file) { + try { + HashMap paramMap = new HashMap<>(); + paramMap.put("file", file); + String url = "/seeyon/rest/attachment?token=@token@";//如果后面加上applicationCategory=1&extensions=&firstSave=true,附件业务自动生成一条记录 + url = url.replaceAll("@token@", getToken()); + String result = HttpUtil.post("http://60.204.152.210" + url, paramMap); + if (StrUtil.isNotBlank(result)) { + logger.info("附件上传结果"+result); + JSONObject jsonObject = JSONObject.parseObject(result); + String atts = jsonObject.get("atts").toString(); + if (StrUtil.isNotEmpty(atts)) { + JSONArray jsonArray = JSONArray.parseArray(atts); + JSONObject res = (JSONObject) jsonArray.get(0); + /* String fileUrl = res.getString("fileUrl"); + logger.info("附件id:" + fileUrl); + return fileUrl;*/ + return res; + } + } + }catch (Exception e){ + logger.error("附件上传失败"+e.getMessage()); + } + } + return null; + } + + private static String getToken() { + //获取oatoken + HashMap hashMap = new HashMap<>(); + hashMap.put("userName", "hzyaRest"); + hashMap.put("password", "a5ce21b8-91db-4cec-b3e3-3e44719655fd"); + hashMap.put("loginName","bdmanager"); + String result = HttpUtil.post("http://60.204.152.210" + "/seeyon/rest/token", JSON.toJSONString(hashMap)); + JSONObject jsonObject = JSONObject.parseObject(result); + if (null != jsonObject) { + logger.info(result); + logger.info("======token:{}======" + jsonObject.getString("id")); + return jsonObject.getString("id"); + } + return null; + } +} diff --git a/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/entity/BipArchivesEntity.java b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/entity/BipArchivesEntity.java new file mode 100644 index 00000000..eef1c56d --- /dev/null +++ b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/entity/BipArchivesEntity.java @@ -0,0 +1,188 @@ +package com.hzya.frame.bip.v3.v2207.entity; + +import cn.dev33.satoken.stp.StpUtil; +import com.hzya.frame.uuid.UUIDUtils; +import com.hzya.frame.web.entity.BaseEntity; + +import java.util.Date; + +/** + * (BdCorp)实体类 + * + * @author makejava + * @since 2023-09-06 14:47:18 + */ +public class BipArchivesEntity extends BaseEntity { + + private String archivesType;//类型 + private String leftCode;//左编码 + private String rightCode;//右编码 + + private String leftAppId;//左应用id + private String leftAppCode;//左应用编码 + private String leftAppName;//左应用名称 + private String leftApiId;//左接口ID + private String leftId;//左id + private String leftName;//左名称 + private String rightAppId;//右应用id + private String rightAppCode;//右应用编码 + private String rightAppName;//右应用名称 + private String rightApiId;//右接口ID + private String rightId;//右id + private String rightName;//右名称 + private String leftOrg;//左公司 + private String rightOrg;//右公司 + + public String getArchivesType() { + return archivesType; + } + + public void setArchivesType(String archivesType) { + this.archivesType = archivesType; + } + + public String getLeftCode() { + return leftCode; + } + + public void setLeftCode(String leftCode) { + this.leftCode = leftCode; + } + + public String getRightCode() { + return rightCode; + } + + public void setRightCode(String rightCode) { + this.rightCode = rightCode; + } + + public String getLeftAppId() { + return leftAppId; + } + + public void setLeftAppId(String leftAppId) { + this.leftAppId = leftAppId; + } + + public String getLeftAppCode() { + return leftAppCode; + } + + public void setLeftAppCode(String leftAppCode) { + this.leftAppCode = leftAppCode; + } + + public String getLeftAppName() { + return leftAppName; + } + + public void setLeftAppName(String leftAppName) { + this.leftAppName = leftAppName; + } + + public String getLeftApiId() { + return leftApiId; + } + + public void setLeftApiId(String leftApiId) { + this.leftApiId = leftApiId; + } + + public String getLeftId() { + return leftId; + } + + public void setLeftId(String leftId) { + this.leftId = leftId; + } + + public String getLeftName() { + return leftName; + } + + public void setLeftName(String leftName) { + this.leftName = leftName; + } + + public String getRightAppId() { + return rightAppId; + } + + public void setRightAppId(String rightAppId) { + this.rightAppId = rightAppId; + } + + public String getRightAppCode() { + return rightAppCode; + } + + public void setRightAppCode(String rightAppCode) { + this.rightAppCode = rightAppCode; + } + + public String getRightAppName() { + return rightAppName; + } + + public void setRightAppName(String rightAppName) { + this.rightAppName = rightAppName; + } + + public String getRightApiId() { + return rightApiId; + } + + public void setRightApiId(String rightApiId) { + this.rightApiId = rightApiId; + } + + public String getRightId() { + return rightId; + } + + public void setRightId(String rightId) { + this.rightId = rightId; + } + + public String getRightName() { + return rightName; + } + + public void setRightName(String rightName) { + this.rightName = rightName; + } + + public String getLeftOrg() { + return leftOrg; + } + + public void setLeftOrg(String leftOrg) { + this.leftOrg = leftOrg; + } + + public String getRightOrg() { + return rightOrg; + } + + public void setRightOrg(String rightOrg) { + this.rightOrg = rightOrg; + } + + public void setCreate() { + this.setId(UUIDUtils.getUUID()); + this.setSts("Y"); + this.setCreate_user_id("1"); + this.setModify_user_id("1"); + this.setCreate_time(new Date()); + this.setModify_time(new Date()); + this.setOrg_id("0"); + this.setCompanyId("0"); + } + //修改信息 + public void setUpdate() { + this.setModify_user_id("1"); + this.setModify_time(new Date()); + } +} + diff --git a/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/entity/BipArchivesEntity.xml b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/entity/BipArchivesEntity.xml new file mode 100644 index 00000000..1a2f96ab --- /dev/null +++ b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/entity/BipArchivesEntity.xml @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/entity/BipAss.java b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/entity/BipAss.java new file mode 100644 index 00000000..ebb9d80b --- /dev/null +++ b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/entity/BipAss.java @@ -0,0 +1,24 @@ +package com.hzya.frame.bip.v3.v2207.entity; + + +public class BipAss { + private String checktypecode; + private String checkvaluecode; + + + public String getChecktypecode() { + return checktypecode; + } + + public void setChecktypecode(String checktypecode) { + this.checktypecode = checktypecode; + } + + public String getCheckvaluecode() { + return checkvaluecode; + } + + public void setCheckvaluecode(String checkvaluecode) { + this.checkvaluecode = checkvaluecode; + } +} \ No newline at end of file diff --git a/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/entity/BipCashflow.java b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/entity/BipCashflow.java new file mode 100644 index 00000000..f29cb81c --- /dev/null +++ b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/entity/BipCashflow.java @@ -0,0 +1,23 @@ +package com.hzya.frame.bip.v3.v2207.entity; + + +public class BipCashflow { + private String money; + private String pk_cashflow; + + public String getMoney() { + return money; + } + + public void setMoney(String money) { + this.money = money; + } + + public String getPk_cashflow() { + return pk_cashflow; + } + + public void setPk_cashflow(String pk_cashflow) { + this.pk_cashflow = pk_cashflow; + } +} \ No newline at end of file diff --git a/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/entity/BipOrgsDetailsEntity.java b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/entity/BipOrgsDetailsEntity.java new file mode 100644 index 00000000..67f3d8e3 --- /dev/null +++ b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/entity/BipOrgsDetailsEntity.java @@ -0,0 +1,65 @@ +package com.hzya.frame.bip.v3.v2207.entity; + +import com.hzya.frame.web.entity.BaseEntity; + +/**** + * BIP组织账户 + * @content: + * @author 👻👻👻👻👻👻👻👻 gjh + * @date 2023-10-24 10:03 + * @param + * @return + **/ +public class BipOrgsDetailsEntity extends BaseEntity { + + /*开户行编码*/ + private String bankCode; + /*开户行名称*/ + private String bankName; + /*账户*/ + private String accnum; + /*与组织关联的字段*/ + private String controlorg; + /*联行号*/ + private String cnapsCode; + + public String getCnapsCode() { + return cnapsCode; + } + + public void setCnapsCode(String cnapsCode) { + this.cnapsCode = cnapsCode; + } + + public String getControlorg() { + return controlorg; + } + + public void setControlorg(String controlorg) { + this.controlorg = controlorg; + } + + public String getBankCode() { + return bankCode; + } + + public void setBankCode(String bankCode) { + this.bankCode = bankCode; + } + + public String getBankName() { + return bankName; + } + + public void setBankName(String bankName) { + this.bankName = bankName; + } + + public String getAccnum() { + return accnum; + } + + public void setAccnum(String accnum) { + this.accnum = accnum; + } +} diff --git a/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/entity/BipOrgsDetailsEntity.xml b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/entity/BipOrgsDetailsEntity.xml new file mode 100644 index 00000000..14fcaaa6 --- /dev/null +++ b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/entity/BipOrgsDetailsEntity.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + bankdoc.code as bankCode,bankdoc.name as bankName,bankaccbas.accnum,bankaccbas.controlorg,bankaccbas.combinenum as cnapsCode + + + + + + + + + + + + + + diff --git a/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/entity/BipOrgsEntity.java b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/entity/BipOrgsEntity.java new file mode 100644 index 00000000..ec5d7572 --- /dev/null +++ b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/entity/BipOrgsEntity.java @@ -0,0 +1,63 @@ +package com.hzya.frame.bip.v3.v2207.entity; + +import com.hzya.frame.web.entity.BaseEntity; + +/** + * @description: BIP组织 entity + * @tableName: org_orgs + * @entityName: BipOrgsEntity + * @author: gjh + * @history: 1.0 + */ +public class BipOrgsEntity extends BaseEntity { + /*单位编码*/ + private String code; + /*开户单位*/ + private String name; + /*BIPID*/ + private String tripartiteId; + private String pk_financeorg; + private String orgsts; + + public String getOrgsts() { + return orgsts; + } + + public void setOrgsts(String orgsts) { + this.orgsts = orgsts; + } + + public String getPk_financeorg() { + return pk_financeorg; + } + + public void setPk_financeorg(String pk_financeorg) { + this.pk_financeorg = pk_financeorg; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getTripartiteId() { + return tripartiteId; + } + + public void setTripartiteId(String tripartiteId) { + this.tripartiteId = tripartiteId; + } + + +} diff --git a/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/entity/BipOrgsEntity.xml b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/entity/BipOrgsEntity.xml new file mode 100644 index 00000000..272541a7 --- /dev/null +++ b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/entity/BipOrgsEntity.xml @@ -0,0 +1,98 @@ + + + + + + + + + + + + + orgs.pk_financeorg as tripartiteId, + orgs.name , + orgs.code, + max(org_bank.ts)as ts + + + + + bankdoc.code as bankCode,bankdoc.name as bankName,bankaccbas.accnum,bankaccbas.controlorg + + + + + + + + + + + + + + + + + + + + diff --git a/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/entity/BipSupplierDetailsEntity.java b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/entity/BipSupplierDetailsEntity.java new file mode 100644 index 00000000..48c6d9c4 --- /dev/null +++ b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/entity/BipSupplierDetailsEntity.java @@ -0,0 +1,77 @@ +package com.hzya.frame.bip.v3.v2207.entity; + +import com.hzya.frame.web.entity.BaseEntity; + +public class BipSupplierDetailsEntity extends BaseEntity { + + private String code; + private String name; + /*开户行*/ + private String splitbank; + /*银行账号*/ + private String bankaccno; + /*是否默认*/ + private String isdefault; + /*联行号*/ + private String combinno; + + private String tripartiteId; + + public String getCombinno() { + return combinno; + } + + public void setCombinno(String combinno) { + this.combinno = combinno; + } + + public String getTripartiteId() { + return tripartiteId; + } + + public void setTripartiteId(String tripartiteId) { + this.tripartiteId = tripartiteId; + } + + public String getIsdefault() { + return isdefault; + } + + public void setIsdefault(String isdefault) { + this.isdefault = isdefault; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getSplitbank() { + return splitbank; + } + + public void setSplitbank(String splitbank) { + this.splitbank = splitbank; + } + + public String getBankaccno() { + return bankaccno; + } + + public void setBankaccno(String bankaccno) { + this.bankaccno = bankaccno; + } + + +} diff --git a/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/entity/BipSupplierDetailsEntity.xml b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/entity/BipSupplierDetailsEntity.xml new file mode 100644 index 00000000..64933d2f --- /dev/null +++ b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/entity/BipSupplierDetailsEntity.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + splitbank,bankaccno,combinno,name,code + + + + + + + + + + + + + + diff --git a/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/entity/BipSupplierEntity.java b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/entity/BipSupplierEntity.java new file mode 100644 index 00000000..53190872 --- /dev/null +++ b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/entity/BipSupplierEntity.java @@ -0,0 +1,92 @@ +package com.hzya.frame.bip.v3.v2207.entity; + +import com.hzya.frame.web.entity.BaseEntity; + +/** + * @description: BIP供应商 entity + * @tableName: BD_SUPPLIER + * @entityName: BipSupplierEntity + * @author: gjh + * @history: 1.0 + */ +public class BipSupplierEntity extends BaseEntity { + + private String code; + private String name; + /*税号*/ + private String taxpayerid; + /*地址*/ + private String def1; + /*电话*/ + private String def2; + /*联系人*/ + private String def3; + private String tripartiteId; + + public String getTripartiteId() { + return tripartiteId; + } + + public void setTripartiteId(String tripartiteId) { + this.tripartiteId = tripartiteId; + } + + private String ts; + + public String getTs() { + return ts; + } + + public void setTs(String ts) { + this.ts = ts; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getTaxpayerid() { + return taxpayerid; + } + + public void setTaxpayerid(String taxpayerid) { + this.taxpayerid = taxpayerid; + } + + public String getDef1() { + return def1; + } + + public void setDef1(String def1) { + this.def1 = def1; + } + + public String getDef2() { + return def2; + } + + public void setDef2(String def2) { + this.def2 = def2; + } + + public String getDef3() { + return def3; + } + + public void setDef3(String def3) { + this.def3 = def3; + } + +} diff --git a/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/entity/BipSupplierEntity.xml b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/entity/BipSupplierEntity.xml new file mode 100644 index 00000000..2854fcd2 --- /dev/null +++ b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/entity/BipSupplierEntity.xml @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + + supplier.code,supplier.name,supplier.taxpayerid,bank.def1,bank.def2,bank.def3,supplier.ts, supplier.pk_cust_sup as tripartiteId + + + + splitbank,bankaccno,name,code + + + + + + + + + + + + + + + + + + + + diff --git a/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/entity/BipTokenVo.java b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/entity/BipTokenVo.java new file mode 100644 index 00000000..f01ede61 --- /dev/null +++ b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/entity/BipTokenVo.java @@ -0,0 +1,13 @@ +package com.hzya.frame.bip.v3.v2207.entity; + +import com.hzya.frame.web.entity.BaseEntity; + +/** + * com.hzya.frame.bip.v3.v2207.entity + * + * @author makejava + * @date 2024-05 -27 11:24 + */ + +public class BipTokenVo extends BaseEntity { +} diff --git a/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/entity/BipVoucher.java b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/entity/BipVoucher.java new file mode 100644 index 00000000..b2138afe --- /dev/null +++ b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/entity/BipVoucher.java @@ -0,0 +1,150 @@ +package com.hzya.frame.bip.v3.v2207.entity; + +import java.util.List; + +public class BipVoucher { + private List details; + private List detail; + private String no; + private String pk_corp; + private String pk_glorgbook; + private String pk_prepared; + private String pk_vouchertype; + private String pk_voucher; + private String period; + private String vouchertype; + private String attachment; + private String year; + private String prepared; + private String prepareddate; + private String num; + private String accbookCode; + + public List getDetails() { + return details; + } + + public void setDetails(List details) { + this.details = details; + } + + public String getNo() { + return no; + } + + public void setNo(String no) { + this.no = no; + } + + public String getPk_corp() { + return pk_corp; + } + + public void setPk_corp(String pk_corp) { + this.pk_corp = pk_corp; + } + + public String getPk_glorgbook() { + return pk_glorgbook; + } + + public void setPk_glorgbook(String pk_glorgbook) { + this.pk_glorgbook = pk_glorgbook; + } + + public String getPk_prepared() { + return pk_prepared; + } + + public void setPk_prepared(String pk_prepared) { + this.pk_prepared = pk_prepared; + } + + public String getPk_vouchertype() { + return pk_vouchertype; + } + + public void setPk_vouchertype(String pk_vouchertype) { + this.pk_vouchertype = pk_vouchertype; + } + + public String getPk_voucher() { + return pk_voucher; + } + + public void setPk_voucher(String pk_voucher) { + this.pk_voucher = pk_voucher; + } + + public List getDetail() { + return detail; + } + + public void setDetail(List detail) { + this.detail = detail; + } + + public String getPeriod() { + return period; + } + + public void setPeriod(String period) { + this.period = period; + } + + public String getVouchertype() { + return vouchertype; + } + + public void setVouchertype(String vouchertype) { + this.vouchertype = vouchertype; + } + + public String getAttachment() { + return attachment; + } + + public void setAttachment(String attachment) { + this.attachment = attachment; + } + + public String getYear() { + return year; + } + + public void setYear(String year) { + this.year = year; + } + + public String getPrepared() { + return prepared; + } + + public void setPrepared(String prepared) { + this.prepared = prepared; + } + + public String getPrepareddate() { + return prepareddate; + } + + public void setPrepareddate(String prepareddate) { + this.prepareddate = prepareddate; + } + + public String getNum() { + return num; + } + + public void setNum(String num) { + this.num = num; + } + + public String getAccbookCode() { + return accbookCode; + } + + public void setAccbookCode(String accbookCode) { + this.accbookCode = accbookCode; + } +} \ No newline at end of file diff --git a/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/entity/BipVoucherDetails.java b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/entity/BipVoucherDetails.java new file mode 100644 index 00000000..252b7fba --- /dev/null +++ b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/entity/BipVoucherDetails.java @@ -0,0 +1,186 @@ +package com.hzya.frame.bip.v3.v2207.entity; + +import java.util.List; + +public class BipVoucherDetails { + private List ass; + private List cashflow; + private String creditamount; + private String debitamount; + private String explanation; + private String localcreditamount; + private String localdebitamount; + private String pk_accsubj; + private String pk_currtype; + private String debitquantity; + private String price; + private String accountCode; + private String amount; + private String globalcreditamount; + private String globaldebitamount; + private String groupdebitamount; + private String currtypeCode; + private String busidate; + private String groupcreditamount; + private String detailindex; + + public List getAss() { + return ass; + } + + public void setAss(List ass) { + this.ass = ass; + } + + public List getCashflow() { + return cashflow; + } + + public void setCashflow(List cashflow) { + this.cashflow = cashflow; + } + + public String getCreditamount() { + return creditamount; + } + + public void setCreditamount(String creditamount) { + this.creditamount = creditamount; + } + + public String getDebitamount() { + return debitamount; + } + + public void setDebitamount(String debitamount) { + this.debitamount = debitamount; + } + + public String getExplanation() { + return explanation; + } + + public void setExplanation(String explanation) { + this.explanation = explanation; + } + + public String getLocalcreditamount() { + return localcreditamount; + } + + public void setLocalcreditamount(String localcreditamount) { + this.localcreditamount = localcreditamount; + } + + public String getLocaldebitamount() { + return localdebitamount; + } + + public void setLocaldebitamount(String localdebitamount) { + this.localdebitamount = localdebitamount; + } + + public String getPk_accsubj() { + return pk_accsubj; + } + + public void setPk_accsubj(String pk_accsubj) { + this.pk_accsubj = pk_accsubj; + } + + public String getPk_currtype() { + return pk_currtype; + } + + public void setPk_currtype(String pk_currtype) { + this.pk_currtype = pk_currtype; + } + + public String getDebitquantity() { + return debitquantity; + } + + public void setDebitquantity(String debitquantity) { + this.debitquantity = debitquantity; + } + + public String getPrice() { + return price; + } + + public void setPrice(String price) { + this.price = price; + } + + public String getAccountCode() { + return accountCode; + } + + public void setAccountCode(String accountCode) { + this.accountCode = accountCode; + } + + public String getAmount() { + return amount; + } + + public void setAmount(String amount) { + this.amount = amount; + } + + public String getGlobalcreditamount() { + return globalcreditamount; + } + + public void setGlobalcreditamount(String globalcreditamount) { + this.globalcreditamount = globalcreditamount; + } + + public String getGlobaldebitamount() { + return globaldebitamount; + } + + public void setGlobaldebitamount(String globaldebitamount) { + this.globaldebitamount = globaldebitamount; + } + + public String getGroupdebitamount() { + return groupdebitamount; + } + + public void setGroupdebitamount(String groupdebitamount) { + this.groupdebitamount = groupdebitamount; + } + + public String getCurrtypeCode() { + return currtypeCode; + } + + public void setCurrtypeCode(String currtypeCode) { + this.currtypeCode = currtypeCode; + } + + public String getBusidate() { + return busidate; + } + + public void setBusidate(String busidate) { + this.busidate = busidate; + } + + public String getGroupcreditamount() { + return groupcreditamount; + } + + public void setGroupcreditamount(String groupcreditamount) { + this.groupcreditamount = groupcreditamount; + } + + public String getDetailindex() { + return detailindex; + } + + public void setDetailindex(String detailindex) { + this.detailindex = detailindex; + } +} \ No newline at end of file diff --git a/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/service/IBipPzService.java b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/service/IBipPzService.java new file mode 100644 index 00000000..1582e8d7 --- /dev/null +++ b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/service/IBipPzService.java @@ -0,0 +1,12 @@ +package com.hzya.frame.bip.v3.v2207.service; + + +import com.hzya.frame.basedao.service.IBaseService; +import com.hzya.frame.bip.v3.v2207.entity.BipTokenVo; +import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity; + +public interface IBipPzService extends IBaseService{ + + + SysExtensionApiEntity getPz(SysExtensionApiEntity entity); +} \ No newline at end of file diff --git a/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/service/IBipSsoService.java b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/service/IBipSsoService.java new file mode 100644 index 00000000..2f8fe71e --- /dev/null +++ b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/service/IBipSsoService.java @@ -0,0 +1,31 @@ +package com.hzya.frame.bip.v3.v2207.service; + + +import com.hzya.frame.basedao.service.IBaseService; +import com.hzya.frame.bip.v3.v2207.entity.BipTokenVo; +import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity; +import com.hzya.frame.web.entity.JsonResultEntity; + +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; + +public interface IBipSsoService extends IBaseService{ +/** + * + * @content Bip单点统一认证接口 + * @author laborer + * @date 2024/5/30 0030 13:45 + * + */ + + String erpSso(HttpServletRequest request, String ticket)throws Exception; + /** + * + * @content 此方法获取sso动态加密,heade参数动态传入 + * @author laborer + * @date 2024/5/27 0027 11:38 + * + */ + SysExtensionApiEntity ssoEncrypt(SysExtensionApiEntity entity); +} \ No newline at end of file diff --git a/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/service/IBipV32207BillService.java b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/service/IBipV32207BillService.java new file mode 100644 index 00000000..31806e42 --- /dev/null +++ b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/service/IBipV32207BillService.java @@ -0,0 +1,19 @@ +package com.hzya.frame.bip.v3.v2207.service; + + +import com.hzya.frame.basedao.service.IBaseService; +import com.hzya.frame.bip.v3.v2207.entity.BipTokenVo; +import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity; + +public interface IBipV32207BillService extends IBaseService{ +/** + * + * @content 此方法获取BIPtoken,heade参数动态传入 + * @author laborer + * @date 2024/5/27 0027 11:38 + * + */ + + SysExtensionApiEntity getBipBill(SysExtensionApiEntity entity); + SysExtensionApiEntity getBipBillYs(SysExtensionApiEntity entity); +} \ No newline at end of file diff --git a/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/service/IBipV32207Service.java b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/service/IBipV32207Service.java new file mode 100644 index 00000000..d5bb362b --- /dev/null +++ b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/service/IBipV32207Service.java @@ -0,0 +1,49 @@ +package com.hzya.frame.bip.v3.v2207.service; + + +import com.alibaba.fastjson.JSONObject; +import com.baomidou.dynamic.datasource.annotation.DS; +import com.hzya.frame.basedao.service.IBaseService; +import com.hzya.frame.bip.v3.v2207.entity.BipSupplierEntity; +import com.hzya.frame.web.entity.JsonResultEntity; + +public interface IBipV32207Service extends IBaseService{ + + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Description 获取token + **/ + JsonResultEntity thirdInterfaceGetToken(JSONObject jsonObject); + + + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Description 获取供应商 + **/ + @DS("oracle91") + JsonResultEntity thirdInterfaceGetSupplier(JSONObject jsonObject); + + + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Description 新增供应商 + **/ + JsonResultEntity thirdInterfaceSaveSupplier(JSONObject jsonObject); + + /** + * 供应商传递OA + * @param jsonObject + * @return + */ + JsonResultEntity thirdInterfaceSendOa(JSONObject jsonObject) throws Exception; + + /** + * 获取BIP组织数据 + * @param jsonObject + * @return + */ + JsonResultEntity thirdInterfaceGetOrgs(JSONObject jsonObject); +} \ No newline at end of file diff --git a/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/service/IBipV32207TokenService.java b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/service/IBipV32207TokenService.java new file mode 100644 index 00000000..fb452978 --- /dev/null +++ b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/service/IBipV32207TokenService.java @@ -0,0 +1,22 @@ +package com.hzya.frame.bip.v3.v2207.service; + + +import com.alibaba.fastjson.JSONObject; +import com.baomidou.dynamic.datasource.annotation.DS; +import com.hzya.frame.basedao.service.IBaseService; +import com.hzya.frame.bip.v3.v2207.entity.BipSupplierEntity; +import com.hzya.frame.bip.v3.v2207.entity.BipTokenVo; +import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity; +import com.hzya.frame.web.entity.JsonResultEntity; + +public interface IBipV32207TokenService extends IBaseService{ +/** + * + * @content 此方法获取BIPtoken,heade参数动态传入 + * @author laborer + * @date 2024/5/27 0027 11:38 + * + */ + + SysExtensionApiEntity getBipToken(SysExtensionApiEntity entity); +} \ No newline at end of file diff --git a/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/service/impl/BipPzServiceImpl.java b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/service/impl/BipPzServiceImpl.java new file mode 100644 index 00000000..b41af4e6 --- /dev/null +++ b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/service/impl/BipPzServiceImpl.java @@ -0,0 +1,72 @@ +package com.hzya.frame.bip.v3.v2207.service.impl; + + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.basedao.service.impl.BaseService; +import com.hzya.frame.bip.v3.v2207.dao.IBipArchivesDao; +import com.hzya.frame.bip.v3.v2207.entity.BipArchivesEntity; +import com.hzya.frame.bip.v3.v2207.entity.BipAss; +import com.hzya.frame.bip.v3.v2207.entity.BipTokenVo; +import com.hzya.frame.bip.v3.v2207.entity.BipVoucher; +import com.hzya.frame.bip.v3.v2207.entity.BipVoucherDetails; +import com.hzya.frame.bip.v3.v2207.service.IBipPzService; +import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity; +import com.hzya.frame.web.entity.BaseResult; +import jdk.nashorn.internal.ir.annotations.Reference; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.Arrays; +import java.util.List; + + +@Service(value = "bipPzService") +public class BipPzServiceImpl extends BaseService implements IBipPzService { + private final Logger logger = LoggerFactory.getLogger(this.getClass()); + + @Resource + private IBipArchivesDao bipArchivesDao; + /** + * @param entity + * @return com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity + * @Author lvleigang + * @Description 组装凭证数据 + * @Date 10:52 上午 2024/11/5 + **/ + @Override + public SysExtensionApiEntity getPz(SysExtensionApiEntity entity) { + String bodys = entity.getBodys(); + BipVoucher voucher = JSONObject.parseObject(bodys, BipVoucher.class); + List fzhs = Arrays.asList(new String[]{"1", "2", "6", "73", "D01", "jobass", "93", "96", "22"}); + if (voucher.getDetails() != null && voucher.getDetails().size() > 0) { + for (int a = 0; a < voucher.getDetails().size(); a++) { + BipVoucherDetails voucherDetails = voucher.getDetails().get(a); + if (voucherDetails.getAss() != null && voucherDetails.getAss().size() > 0) { + for (int b = 0; b < voucherDetails.getAss().size(); b++) { + BipAss ass = voucherDetails.getAss().get(b); + if (ass.getChecktypecode() != null && !"".equals(ass.getChecktypecode())) { + //存在需要转换的 + if (fzhs.contains(ass.getChecktypecode())) { + BipArchivesEntity archivesEntity = new BipArchivesEntity(); + archivesEntity.setArchivesType(ass.getChecktypecode()); + archivesEntity.setLeftCode(ass.getCheckvaluecode()); + archivesEntity.setLeftOrg(voucher.getPk_corp()); + + List archivesEntities = bipArchivesDao.queryArchivesData(archivesEntity); + if (archivesEntities != null && archivesEntities.size() > 0) { + ass.setCheckvaluecode(archivesEntities.get(0).getRightCode()); + } + } + } + } + } + } + } + bodys = JSON.toJSONString(voucher); + entity.setBodys(bodys); + return entity; + } +} diff --git a/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/service/impl/BipSsoServiceImpl.java b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/service/impl/BipSsoServiceImpl.java new file mode 100644 index 00000000..c1d69514 --- /dev/null +++ b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/service/impl/BipSsoServiceImpl.java @@ -0,0 +1,114 @@ +package com.hzya.frame.bip.v3.v2207.service.impl; + + +import cn.hutool.core.util.StrUtil; +import cn.hutool.http.HttpException; +import cn.hutool.http.HttpRequest; +import com.alibaba.fastjson.JSON; +import com.hzya.frame.basedao.service.impl.BaseService; +import com.hzya.frame.bip.v3.v2207.entity.BipTokenVo; +import com.hzya.frame.bip.v3.v2207.service.IBipSsoService; +import com.hzya.frame.iputil.IPUtil; +import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity; +import nccloud.security.impl.SignatureTookKit; +import org.apache.commons.codec.binary.Base64; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; + +import javax.servlet.http.HttpServletRequest; +import java.util.Map; + + +@Service(value = "BipSsoServiceImpl") +public class BipSsoServiceImpl extends BaseService implements IBipSsoService { + private final Logger logger = LoggerFactory.getLogger(this.getClass()); + private final String BASEURL = "http://192.168.2.237:8099/seeyon/thirdpartyController.do?ticket="; + private final String ESBURL = "http://127.0.0.1:9081/kangarooDataCenterV3/entranceController/externalCallInterface"; + /** + * + * @content Bip单点统一认证接口 + * @author laborer + * @date 2024/5/30 0030 13:45 + * + */ + + @Override + public String erpSso(HttpServletRequest request,String userCode)throws Exception { + logger.info("当前IP地址为"+ JSON.toJSONString(IPUtil.getIpAddress(request))); + String result = ""; + boolean flag = true; +// logger.info("接收到致远OA认证参数的ticket:{}",ticket); + //通过ticket获取OA用户信息 +// String userCode = HttpUtil.get(BASEURL+ticket); + logger.info("获取到的OA用户信息:{}",userCode); + String dsname = "ycjf"; + String client_id = "OAREST";//第三方系统id + StringBuffer sb = new StringBuffer(); + if(StrUtil.isNotEmpty(userCode)){ + try { + logger.info("开始加密"); + String security = genKey(userCode,userCode + (System.currentTimeMillis() + "").substring(0, 6)); + logger.info("加密结束:{}",security); + sb.append("type=type_security&dsname="+dsname+"&usercode="+userCode+"&client_id="+client_id+"&security="+security); + String baseUrl = "http://10.75.51.78:8899/service/genThirdPartyAccessToken?"+sb.toString(); + logger.info("请求BIPtokenbaseUrl:{}",baseUrl); + result = HttpRequest.post(baseUrl) + .header("Content-Type", "application/x-www-form-urlencoded")//头信息,多个头信息多次调用此方法即可 + .header("Content-Length", "10000")//头信息,多个头信息多次调用此方法即可 + .header("userid", "admin")//头信息,多个头信息多次调用此方法即可 + .body("{}")//表单内容 + .timeout(20000)//超时,毫秒 + .execute().body(); + logger.info("获取到的BIPtoken信息:{}",result); + } catch (HttpException e) { + flag=false; + e.printStackTrace(); + } + } + if(flag){ + String indexUR = "http://10.75.51.78:8899/nccloud/resources/uap/rbac/thirdpartylogin/main/index.html?accesstoken="+result+"&redirect_uri=http://10.75.51.78:8899/nccloud/resources/workbench/public/common/main/index.html#"; + logger.info(indexUR); + return indexUR; + }else{ + return "http://10.75.51.78:8899/nccloud/resources/uap/rbac/login/main/index.html"; + } + } + /** + * + * @content 此方法获取sso动态加密,heade参数动态传入 + * @author laborer + * @date 2024/5/27 0027 11:38 + * + */ + + @Override + public SysExtensionApiEntity ssoEncrypt(SysExtensionApiEntity entity) { + try { + Map headers = entity.getHeaders(); + String userCode = headers.get("usercode");//用户编码 + String dsname = headers.get("dsname");//数据源 + String client_id = headers.get("client_id");//第三方系统id + StringBuffer sb = new StringBuffer(); + String security = genKey(userCode,userCode + (System.currentTimeMillis() + "").substring(0, 6)); + StringBuffer querys = new StringBuffer(); + querys.append("type=type_security"); + querys.append("&dsname="+dsname); + querys.append("&usercode="+userCode); + querys.append("&client_id="+client_id); + querys.append("&security="+security); + entity.setQuerys(querys.toString()); + headers.put("Content-Type", "application/x-www-form-urlencoded"); + headers.put("userid", "admin"); + entity.setHeaders(headers); + } catch (Exception e) { + e.printStackTrace(); + } + return entity; + } + /**获取NCC的key*/ + private static String genKey(String userid, String key) throws Exception { + return new Base64().encodeToString(SignatureTookKit.digestSign(userid.getBytes(), key.getBytes())); + } + +} diff --git a/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/service/impl/BipV32207BillServiceImpl.java b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/service/impl/BipV32207BillServiceImpl.java new file mode 100644 index 00000000..1511d1ee --- /dev/null +++ b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/service/impl/BipV32207BillServiceImpl.java @@ -0,0 +1,134 @@ +package com.hzya.frame.bip.v3.v2207.service.impl; + + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.basedao.service.impl.BaseService; +import com.hzya.frame.bip.v3.v2207.dao.IBipArchivesDao; +import com.hzya.frame.bip.v3.v2207.entity.BipArchivesEntity; +import com.hzya.frame.bip.v3.v2207.entity.BipAss; +import com.hzya.frame.bip.v3.v2207.entity.BipTokenVo; +import com.hzya.frame.bip.v3.v2207.entity.BipVoucher; +import com.hzya.frame.bip.v3.v2207.entity.BipVoucherDetails; +import com.hzya.frame.bip.v3.v2207.service.IBipV32207BillService; +import com.hzya.frame.bip.v3.v2207.service.IBipV32207TokenService; +import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity; +import com.hzya.frame.util.bipV3.Encryption; +import com.hzya.frame.util.bipV3.SHA256Util; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.net.URLEncoder; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +@Service(value = "BipV32207BillServiceImpl") +public class BipV32207BillServiceImpl extends BaseService implements IBipV32207BillService { + private final Logger logger = LoggerFactory.getLogger(this.getClass()); + @Resource + private IBipArchivesDao bipArchivesDao; + /** + * + * @content 此方法获取拼接单据动态加密,heade参数动态传入 + * @author laborer + * @date 2024/5/27 0027 11:38 + * + */ + + @Override + public SysExtensionApiEntity getBipBill(SysExtensionApiEntity entity) { + try { + Map headers = entity.getHeaders(); + String client_id = headers.get("client_id"); + //token信息 + String access_token = headers.get("access_token"); + //公钥 + String pubKey = headers.get("pubKey"); + StringBuffer sb = new StringBuffer(); + sb.append(client_id); + String parm = entity.getBodys(); + if (StringUtils.isNotBlank(parm)) { + sb.append(parm); + } + sb.append(pubKey); + // 签名 + String sign = SHA256Util.getSHA256(sb.toString(), pubKey); + StringBuffer querys = new StringBuffer(); + querys.append("access_token="+access_token); + querys.append("&signature="+sign); + querys.append("&client_id="+client_id); + entity.setQuerys(querys.toString()); + headers.put("signature",sign); +// headers.put("content-type","application/x-www-form-urlencoded"); + } catch (Exception e) { + e.printStackTrace(); + } + return entity; + } + @Override + public SysExtensionApiEntity getBipBillYs(SysExtensionApiEntity entity) { + try { + String bodys = entity.getBodys(); + BipVoucher voucher = JSONObject.parseObject(bodys, BipVoucher.class); + List fzhs = Arrays.asList(new String[]{"0012", "0006", "0004"}); + if (voucher.getDetail() != null && voucher.getDetail().size() > 0) { + for (int a = 0; a < voucher.getDetail().size(); a++) { + BipVoucherDetails voucherDetails = voucher.getDetail().get(a); + if (voucherDetails.getAss() != null && voucherDetails.getAss().size() > 0) { + for (int b = 0; b < voucherDetails.getAss().size(); b++) { + BipAss ass = voucherDetails.getAss().get(b); + if (ass.getChecktypecode() != null && !"".equals(ass.getChecktypecode())) { + //存在需要转换的 + if (fzhs.contains(ass.getChecktypecode())) { + BipArchivesEntity archivesEntity = new BipArchivesEntity(); + archivesEntity.setArchivesType(ass.getChecktypecode()); + archivesEntity.setLeftCode(ass.getCheckvaluecode()); + archivesEntity.setLeftOrg(voucher.getPk_corp()); + + List archivesEntities = bipArchivesDao.queryArchivesDatays(archivesEntity); + if (archivesEntities != null && archivesEntities.size() > 0) { + ass.setCheckvaluecode(archivesEntities.get(0).getRightCode()); + } + } + } + } + } + } + } + bodys = JSON.toJSONString(voucher); + entity.setBodys(bodys); + + Map headers = entity.getHeaders(); + String client_id = headers.get("client_id"); + //token信息 + String access_token = headers.get("access_token"); + //公钥 + String pubKey = headers.get("pubKey"); + StringBuffer sb = new StringBuffer(); + sb.append(client_id); + String parm = entity.getBodys(); + if (StringUtils.isNotBlank(parm)) { + sb.append(parm); + } + sb.append(pubKey); + // 签名 + String sign = SHA256Util.getSHA256(sb.toString(), pubKey); + StringBuffer querys = new StringBuffer(); + querys.append("access_token="+access_token); + querys.append("&signature="+sign); + querys.append("&client_id="+client_id); + entity.setQuerys(querys.toString()); + headers.put("signature",sign); +// headers.put("content-type","application/x-www-form-urlencoded"); + } catch (Exception e) { + e.printStackTrace(); + } + return entity; + } +} diff --git a/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/service/impl/BipV32207ServiceImpl.java b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/service/impl/BipV32207ServiceImpl.java new file mode 100644 index 00000000..841e291b --- /dev/null +++ b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/service/impl/BipV32207ServiceImpl.java @@ -0,0 +1,480 @@ +package com.hzya.frame.bip.v3.v2207.service.impl; + + +import cn.hutool.http.HttpRequest; +import cn.hutool.json.JSONUtil; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson2.JSON; +import com.baomidou.dynamic.datasource.annotation.DS; +import com.google.gson.Gson; +import com.hzya.frame.base.PluginBaseEntity; +import com.hzya.frame.basedao.service.impl.BaseService; +import com.hzya.frame.bip.v3.v2207.dao.IBipOrgsDao; +import com.hzya.frame.bip.v3.v2207.dao.IBipOrgsDetailsDao; +import com.hzya.frame.bip.v3.v2207.dao.IBipSupplierDao; +import com.hzya.frame.bip.v3.v2207.dao.IBipSupplierDetailsDao; +import com.hzya.frame.bip.v3.v2207.entity.BipOrgsDetailsEntity; +import com.hzya.frame.bip.v3.v2207.entity.BipOrgsEntity; +import com.hzya.frame.bip.v3.v2207.entity.BipSupplierDetailsEntity; +import com.hzya.frame.bip.v3.v2207.entity.BipSupplierEntity; +import com.hzya.frame.bip.v3.v2207.service.IBipV32207Service; +import com.hzya.frame.dateutil.DateUtil; +import com.hzya.frame.util.PluginUtils; +import com.hzya.frame.util.bipV3.Encryption; +import com.hzya.frame.util.bipV3.SHA256Util; +import com.hzya.frame.util.oldNcc.CompressUtil; +import com.hzya.frame.util.oldNcc.Decryption; +import com.hzya.frame.web.entity.BaseResult; +import com.hzya.frame.web.entity.JsonResultEntity; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + + +import java.net.URLEncoder; +import java.util.*; + + +@Service(value = "bipV32207Service") +public class BipV32207ServiceImpl extends BaseService implements IBipV32207Service { + private final Logger logger = LoggerFactory.getLogger(this.getClass()); + //定义项目开始同步日期 + private String ts = "2023-09-30 15:47:08"; + //组织的同步日期 + private String orgsts = "2023-09-30 15:47:08"; + @Autowired + private IBipSupplierDao bipSupplierDao; + + @Autowired + private IBipSupplierDetailsDao bipSupplierDetailsDao; + + @Autowired + private IBipOrgsDao bipOrgsDao; + + @Autowired + private IBipOrgsDetailsDao bipOrgsDetailsDao; + + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Description 获取token + **/ + @Override + public JsonResultEntity thirdInterfaceGetToken(JSONObject object) { + JSONObject jsonObject = getstrObj("jsonStr", object); + String client_id = jsonObject.getString("client_id"); + String pubKey = jsonObject.getString("pubKey"); + String client_secret = jsonObject.getString("client_secret"); + String username = jsonObject.getString("username"); + String pwd = jsonObject.getString("pwd"); + String busi_center = jsonObject.getString("busi_center"); + String dsname = jsonObject.getString("dsname"); + String baseUrl = jsonObject.getString("baseUrl"); + Map paramMap = new HashMap(); + // 密码模式认证 + paramMap.put("grant_type", "password"); + // 第三方应用id + paramMap.put("client_id", client_id); + // 第三方应用secret 公钥加密 + try { + paramMap.put("client_secret", URLEncoder.encode(Encryption.pubEncrypt(pubKey, client_secret), "utf-8")); + } catch (Exception e) { + e.printStackTrace(); + } + // ncc用户名 + paramMap.put("username", username); + // 密码 公钥加密 + try { + paramMap.put("password", URLEncoder.encode(Encryption.pubEncrypt(pubKey, pwd), "utf-8")); + } catch (Exception e) { + return BaseResult.getFailureMessageEntity("获取token失败"); + } + // 账套编码 + paramMap.put("biz_center", busi_center); + // 签名 + String sign = SHA256Util.getSHA256(client_id + client_secret + username + pwd + pubKey, pubKey); + paramMap.put("signature", sign); + paramMap.put("dsname", dsname); + String url = baseUrl + "/nccloud/opm/accesstoken"; + String mediaType = "application/x-www-form-urlencoded"; + String token = null; + try { + token = doPostHutool(url, paramMap, mediaType, null, "", "token"); + } catch (Exception e) { + return BaseResult.getFailureMessageEntity("获取token失败"); + } + if (JSONUtil.isTypeJSON(token)) { + JSONObject jsonObject1 = JSONObject.parseObject(token); + return BaseResult.getSuccessMessageEntity("获取token成功", jsonObject1); + } else { + return BaseResult.getSuccessMessageEntity("获取token成功", token); + } + } + + /** + * 发送post请求 + * + * @param baseUrl + * @param paramMap + * @param mediaType + * @param headers + * @param json + * @return + */ + private String doPostHutool(String baseUrl, Map paramMap, String mediaType, Map headers, String json, String type) { + String result = null; + + try { + StringBuffer sb = new StringBuffer(); + sb.append(baseUrl); + if (paramMap != null) { + sb.append("?"); + for (Map.Entry entry : paramMap.entrySet()) { + String key = entry.getKey(); + String value = entry.getValue(); + sb.append(key + "=" + value).append("&"); + } + } + if ("bill".equals(type)) { + sb.append("?"); + for (Map.Entry entry : headers.entrySet()) { + String key = entry.getKey(); + String value = entry.getValue(); + sb.append(key + "=" + value).append("&"); + } + } + baseUrl = sb.toString().substring(0, sb.toString().length() - 1); + HttpRequest re = HttpRequest.post(baseUrl); + re.addHeaders(headers); + result = re.body(json) + .timeout(2000000)//超时,毫秒 + .execute().body(); + + } catch (Exception e) { + e.printStackTrace(); + } + + + return result; + } + + /** + * @param key + * @param object + * @return com.alibaba.fastjson.JSONObject + * @Author lvleigang + * @Description 获取对象转换成jsonobj + * @Date 11:51 下午 2023/7/10 + **/ + public JSONObject getstrObj(String key, JSONObject object) { + if (checkStr(object.getString(key))) { + return object.getJSONObject(key); + } + return new JSONObject(); + } + + /** + * @param str + * @return void + * @Author lvleigang + * @Description 校验字符串 + * @Date 11:41 上午 2022/12/7 + **/ + protected Boolean checkStr(String str) { + Boolean flag = true; + if (str == null || "".equals(str)) { + flag = false; + } + return flag; + } + + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Description 获取供应商 + **/ + @Override + public JsonResultEntity thirdInterfaceGetSupplier(JSONObject jsonObject) { + BipSupplierEntity bipSupplierEntity = getData("jsonStr", jsonObject, BipSupplierEntity.class); + //设置查询区间 + bipSupplierEntity.setTs(ts); + logger.info("查询供应商数据,当前TS:"+ts); + List bipSupplierEntities = bipSupplierDao.thirdInterfaceGetSupplier(bipSupplierEntity); + //更新TS时间 + ts = DateUtil.dateToString(new Date(),"yyyy-MM-dd HH:mm:ss"); + logger.info("TS已更新:"+ts); + //System.out.println("查询供应商明细"); + logger.info("查询供应商明细"+JSON.toJSONString(bipSupplierEntities)); + List jsonObjectList=new ArrayList<>(); + //[{"code":"SL20231101727","dataSourceCode":"master","name":"无锡恒君安管理咨询有限公司","taxpayerid":"91320205MAD2HAQN6Q","tripartiteId":"0001A31000000002M3TS","ts":"2023-11-16 14:05:10"}] + + List bipSupplierDetails = null; + for (BipSupplierEntity supplierEntity : bipSupplierEntities) { + List list=new ArrayList<>(); + JSONObject jsonObjectResult=new JSONObject(); + jsonObjectResult.put("code",supplierEntity.getCode()); + jsonObjectResult.put("name",supplierEntity.getName()); + jsonObjectResult.put("taxpayerid",supplierEntity.getTaxpayerid()); + jsonObjectResult.put("def1",supplierEntity.getDef1()); + jsonObjectResult.put("def2",supplierEntity.getDef2()); + jsonObjectResult.put("def3",supplierEntity.getDef3()); + jsonObjectResult.put("tripartiteId",supplierEntity.getTripartiteId()); + //根据供应商编码和名称查询明细 + String code = supplierEntity.getCode(); + String name = supplierEntity.getName(); + //System.out.println("根据供应处名称,编码获取明细数据:code:"+code +"name:"+name); + logger.info("根据供应处名称,编码获取明细数据:code:"+code +"name:"+name); + BipSupplierDetailsEntity bipSupplierDetailsEntity = new BipSupplierDetailsEntity(); + bipSupplierDetailsEntity.setCode(code); + bipSupplierDetailsEntity.setName(name); + logger.info("根据供应商编码,名称查询银行档案 {}",JSON.toJSONString(bipSupplierDetailsEntity)); + List bipSupplierDetailsEntities = queryBipSupplierDetails(bipSupplierDetailsEntity) ; +// /bipSupplierDetails.stream().filter(that-> code.equalsIgnoreCase(that.getCode() ) && name.equalsIgnoreCase(that.getName() ) ).collect(Collectors.toList()); + logger.info("根据供应处名称,编码获取明细数据 bipSupplierDetailsEntities值:{}",JSON.toJSONString(bipSupplierDetailsEntities)); + if (bipSupplierDetailsEntities.size()>0 && null!=bipSupplierDetailsEntities){ + bipSupplierDetailsEntities.get(0).setIsdefault("-8073674727882144390"); + for (BipSupplierDetailsEntity supplierDetailsEntity : bipSupplierDetailsEntities) { + JSONObject jsonObjectDetails=new JSONObject(); + jsonObjectDetails.put("splitbank",supplierDetailsEntity.getSplitbank()); + jsonObjectDetails.put("bankaccno",supplierDetailsEntity.getBankaccno()); + jsonObjectDetails.put("combinno",supplierDetailsEntity.getCombinno()); + jsonObjectDetails.put("isdefault",supplierDetailsEntity.getIsdefault()); + list.add(jsonObjectDetails); + } + } + jsonObjectResult.put("details",list); + jsonObjectList.add(jsonObjectResult); + } + return BaseResult.getSuccessMessageEntity("查询成功",jsonObjectList); + } + @DS("oracle91") + private List queryBipSupplierDetails(BipSupplierDetailsEntity bipSupplierDetailsEntity){ +// BipSupplierDetailsEntity bipSupplierDetailsEntity=new BipSupplierDetailsEntity(); +// bipSupplierDetailsEntity.setCode(supplierEntity.getCode()); +// bipSupplierDetailsEntity.setName(supplierEntity.getName()); + + List bipSupplierDetailsEntities = bipSupplierDetailsDao.thirdInterfaceGetSupplierDetails(bipSupplierDetailsEntity); + return bipSupplierDetailsEntities; + } + + + /** + * 获取BIP组织数据 + * @param jsonObject + * @return + */ + @Override + public JsonResultEntity thirdInterfaceGetOrgs(JSONObject jsonObject) { + BipOrgsEntity bipOrgsEntity = getData("jsonStr", jsonObject, BipOrgsEntity.class); + //设置查询区间 + bipOrgsEntity.setOrgsts(orgsts); + logger.info("查询组织数据,当前TS:" + orgsts); + List bipOrgsEntities = bipOrgsDao.thirdInterfaceGetOrgs(bipOrgsEntity); + //更新TS时间 + orgsts = DateUtil.dateToString(new Date(), "yyyy-MM-dd HH:mm:ss"); + logger.info("组织TS已更新:" + orgsts); + logger.info("查询组织明细" + JSON.toJSONString(bipOrgsEntities)); + List jsonObjectList = new ArrayList<>(); + if (null != bipOrgsEntities && bipOrgsEntities.size() > 0) { + for (BipOrgsEntity orgsEntity : bipOrgsEntities) { + List list = new ArrayList<>(); + JSONObject jsonObjectResult = new JSONObject(); + jsonObjectResult.put("code", orgsEntity.getCode());//单位编码 + jsonObjectResult.put("name", orgsEntity.getName());//单位名称 + jsonObjectResult.put("tripartiteId", orgsEntity.getTripartiteId());//BIPID + //根据组织主键查询明细 + String tripartiteId = orgsEntity.getTripartiteId(); + //System.out.println("根据供应处名称,编码获取明细数据:code:"+code +"name:"+name); + logger.info("根据组织主键获取明细数据:pk_financeorg:{}", tripartiteId); + BipOrgsDetailsEntity bipOrgsDetailsEntity = new BipOrgsDetailsEntity(); + bipOrgsDetailsEntity.setControlorg(tripartiteId); + List bipOrgsDetailsEntities = queryBipOrgsDetails(bipOrgsDetailsEntity); + if (bipOrgsDetailsEntities.size() > 0 && null != bipOrgsDetailsEntities) { + for (BipOrgsDetailsEntity orgsDetailsEntity : bipOrgsDetailsEntities) { + JSONObject jsonObjectDetails = new JSONObject(); + jsonObjectDetails.put("bankCode", orgsDetailsEntity.getBankCode());//开户行编码 + jsonObjectDetails.put("bankName", orgsDetailsEntity.getBankName());//开户行名称 + jsonObjectDetails.put("accnum", orgsDetailsEntity.getAccnum());//账户 + jsonObjectDetails.put("cnapsCode", orgsDetailsEntity.getCnapsCode());//联行号 + list.add(jsonObjectDetails); + } + } + jsonObjectResult.put("details", list); + jsonObjectList.add(jsonObjectResult); + } + } + return BaseResult.getSuccessMessageEntity("查询成功", jsonObjectList); + } + private List queryBipOrgsDetails(BipOrgsDetailsEntity bipOrgsDetailsEntity){ + List bipOrgsDetailsEntities = bipOrgsDetailsDao.thirdInterfaceGetOrgsDetails(bipOrgsDetailsEntity); + return bipOrgsDetailsEntities; + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Description 新增供应商 + **/ + @Override + public JsonResultEntity thirdInterfaceSaveSupplier(JSONObject object) { + JSONObject jsonObject = getstrObj("jsonStr", object); + //认证access_token + String access_token = jsonObject.getString("access_token"); + //认证security_key + String security_key = jsonObject.getString("security_key"); + //服务器ip:port + String baseUrl = jsonObject.getString("baseUrl"); + //api方法 + String apiUrl = jsonObject.getString("apiUrl"); + //发送的数据 + String sendData =jsonObject.getString("sendData"); + //对应于在第三方应用注册当中的app_id + String client_id = jsonObject.getString("client_id"); + //公钥 + String pubKey = jsonObject.getString("pubKey"); + //接口调用业务标识 + String busi_id = jsonObject.getString("busi_id"); + //重复调用检查 + String repeat_check = jsonObject.getString("repeat_check"); + //返回值压缩加密级别 + String secret_level = jsonObject.getString("secret_level") == null ? "L0": jsonObject.getString("secret_level") ; + try { + String returnStr = sendApi(access_token, security_key, baseUrl,apiUrl,sendData,client_id,pubKey,busi_id,repeat_check,secret_level); + if(JSONUtil.isTypeJSON(returnStr)){ + JSONObject jsonObject1 = JSONObject.parseObject(returnStr); + return BaseResult.getSuccessMessageEntity("发送数据成功",jsonObject1); + }else { + return BaseResult.getSuccessMessageEntity("发送数据成功",returnStr); + } + } catch (Exception e) { + return BaseResult.getFailureMessageEntity("发送数据错误"); + } + } + + /** + * 供应商传递OA + * @param jsonObject + * @return + */ + @Override + public JsonResultEntity thirdInterfaceSendOa(JSONObject jsonObject) throws Exception { + JSONObject jsonObjectStr = getstrObj("jsonStr", jsonObject); + PluginBaseEntity pluginBaseEntity = PluginUtils.getPluginsById(jsonObjectStr.getString("plug_id")); + JsonResultEntity s = pluginBaseEntity.executeBusiness(jsonObjectStr); + return BaseResult.getSuccessMessageEntity("传递成功"); + } + + + /** + * @param access_token 认证access_token + * @param security_key 认证security_key + * @param baseUrl 服务器ip:port + * @param apiUrl api方法 + * @param putParameter 发送的数据 + * @param client_id 对应于在第三方应用注册当中的app_id + * @param pubKey 公钥 + * @param busi_id 接口调用业务标识 + * @param repeat_check 重复调用检查 + * @param secret_level 返回值压缩加密级别 + * @return java.lang.String + * @Author lvleigang + * @Description 发起api接口 + * @Date 9:52 上午 2023/8/22 + **/ + private String sendApi(String access_token, String security_key, String baseUrl, String apiUrl, String putParameter, String client_id, String pubKey, String busi_id, String repeat_check, String secret_level) throws Exception{ + // header 参数 + Map headermap = new HashMap<>(); + headermap.put("access_token", access_token); + headermap.put("client_id", client_id); + StringBuffer sb = new StringBuffer(); + sb.append(client_id); + if (StringUtils.isNotBlank(putParameter)) { + sb.append(putParameter); + } + sb.append(pubKey); + String sign = SHA256Util.getSHA256(sb.toString(), pubKey); + headermap.put("signature", sign); + if (StringUtils.isNotBlank(busi_id)) { + headermap.put("busi_id", busi_id); + } + if (StringUtils.isNotBlank(repeat_check)) { + headermap.put("repeat_check", repeat_check); + } + String mediaType = "application/json;charset=utf-8"; + // 表体数据json + // 根据安全级别选择加密或压缩请求表体参数 + String json = dealRequestBody(putParameter, security_key, secret_level); + // 返回值 + String sendUrl = baseUrl + apiUrl; + String result = doPostHutool(sendUrl, null, mediaType, headermap, json, "bill"); + String changeData = dealResponseBody(result, security_key, secret_level); + return changeData; + } + + // 返回值进行过加密和压缩,对返回值进行解压和解密 + private static String dealResponseBody(String source, String security_key, String level) throws Exception { + String result = null; + if (StringUtils.isEmpty(level) || SecretConst.LEVEL0.equals(level)) { + result = source; + } else if (SecretConst.LEVEL1.equals(level)) { + result = Decryption.symDecrypt(security_key, source); + } else if (SecretConst.LEVEL2.equals(level)) { + result = CompressUtil.gzipDecompress(source); + } else if (SecretConst.LEVEL3.equals(level)) { + result = CompressUtil.gzipDecompress(Decryption.symDecrypt(security_key, source)); + } else if (SecretConst.LEVEL4.equals(level)) { + result = Decryption.symDecrypt(security_key, CompressUtil.gzipDecompress(source)); + } else { + throw new Exception("无效的安全等级"); + } + + return result; + } + + // 根据安全级别设置,表体是否加密或压缩 + private static String dealRequestBody(String source, String security_key, String level) throws Exception { + String result = null; + if (StringUtils.isEmpty(level) || SecretConst.LEVEL0.equals(level)) { + result = source; + } else if (SecretConst.LEVEL1.equals(level)) { + result = Encryption.symEncrypt(security_key, source); + } else if (SecretConst.LEVEL2.equals(level)) { + result = CompressUtil.gzipCompress(source); + } else if (SecretConst.LEVEL3.equals(level)) { + result = Encryption.symEncrypt(security_key, CompressUtil.gzipCompress(source)); + } else if (SecretConst.LEVEL4.equals(level)) { + result = CompressUtil.gzipCompress(Encryption.symEncrypt(security_key, source)); + } else { + throw new Exception("无效的安全等级"); + } + + return result; + } + + class SecretConst { + /** + * LEVEL0 不压缩、不加密 + */ + public static final String LEVEL0 = "L0"; + /** + * LEVEL1 只加密、不压缩 + */ + public static final String LEVEL1 = "L1"; + /** + * LEVEL2 只压缩、不加密 + */ + public static final String LEVEL2 = "L2"; + /** + * LEVEL3 先压缩、后加密 + */ + public static final String LEVEL3 = "L3"; + /** + * LEVEL4 先加密、后压缩 + */ + public static final String LEVEL4 = "L4"; + } +} diff --git a/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/service/impl/BipV32207TokenServiceImpl.java b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/service/impl/BipV32207TokenServiceImpl.java new file mode 100644 index 00000000..0d6fda14 --- /dev/null +++ b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/service/impl/BipV32207TokenServiceImpl.java @@ -0,0 +1,92 @@ +package com.hzya.frame.bip.v3.v2207.service.impl; + + +import cn.hutool.http.HttpRequest; +import cn.hutool.json.JSONUtil; +import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson2.JSON; +import com.baomidou.dynamic.datasource.annotation.DS; +import com.hzya.frame.base.PluginBaseEntity; +import com.hzya.frame.basedao.service.impl.BaseService; +import com.hzya.frame.bip.v3.v2207.dao.IBipOrgsDao; +import com.hzya.frame.bip.v3.v2207.dao.IBipOrgsDetailsDao; +import com.hzya.frame.bip.v3.v2207.dao.IBipSupplierDao; +import com.hzya.frame.bip.v3.v2207.dao.IBipSupplierDetailsDao; +import com.hzya.frame.bip.v3.v2207.entity.*; +import com.hzya.frame.bip.v3.v2207.service.IBipV32207Service; +import com.hzya.frame.bip.v3.v2207.service.IBipV32207TokenService; +import com.hzya.frame.dateutil.DateUtil; +import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity; +import com.hzya.frame.util.PluginUtils; +import com.hzya.frame.util.bipV3.Encryption; +import com.hzya.frame.util.bipV3.SHA256Util; +import com.hzya.frame.util.oldNcc.CompressUtil; +import com.hzya.frame.util.oldNcc.Decryption; +import com.hzya.frame.web.entity.BaseResult; +import com.hzya.frame.web.entity.JsonResultEntity; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.net.URLEncoder; +import java.util.*; + + +@Service(value = "bipV32207TokenService") +public class BipV32207TokenServiceImpl extends BaseService implements IBipV32207TokenService { + private final Logger logger = LoggerFactory.getLogger(this.getClass()); + /** + * + * @content 此方法获取BIPtoken,heade参数动态传入 + * @author laborer + * @date 2024/5/27 0027 11:38 + * + */ + + @Override + public SysExtensionApiEntity getBipToken(SysExtensionApiEntity entity) { + try { + Map headers = entity.getHeaders(); + String client_id = headers.get("client_id"); + Map paramMap = new HashMap(); + // 密码模式认证 + paramMap.put("grant_type", "client_credentials"); + // 第三方应用id + paramMap.put("client_id", client_id); + // 第三方应用secret] + String client_secret = headers.get("client_secret"); + // 账套编码 + String busi_center = headers.get("busi_center"); + //用户编码 + String usercode = headers.get("usercode"); + //数据库编码 + String dsname = headers.get("dsname"); + String pubKey = headers.get("pubKey"); + // 第三方应用secret 公钥加密] + paramMap.put("client_secret", URLEncoder.encode(Encryption.pubEncrypt(pubKey, client_secret), "utf-8")); + // 账套编码 + paramMap.put("biz_center", busi_center); + // // TODO 传递数据源和ncc登录用户 + paramMap.put("dsname", dsname); + paramMap.put("usercode", usercode); + // 签名 + String sign = SHA256Util.getSHA256(client_id + client_secret + pubKey,pubKey); + paramMap.put("signature", sign); + StringBuffer querys = new StringBuffer(); + querys.append("biz_center="+busi_center); + querys.append("&grant_type="+"client_credentials"); + querys.append("&signature="+sign); + querys.append("&dsname="+dsname); + querys.append("&client_secret="+URLEncoder.encode(Encryption.pubEncrypt(pubKey, client_secret), "utf-8")); + querys.append("&usercode="+usercode); + querys.append("&client_id="+client_id); + entity.setQuerys(querys.toString()); + headers.put("content-type","application/x-www-form-urlencoded"); + } catch (Exception e) { + e.printStackTrace(); + } + return entity; + } +} diff --git a/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/util/BipUtil.java b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/util/BipUtil.java new file mode 100644 index 00000000..a7bfe324 --- /dev/null +++ b/fw-bip/src/main/java/com/hzya/frame/bip/v3/v2207/util/BipUtil.java @@ -0,0 +1,65 @@ +package com.hzya.frame.bip.v3.v2207.util; + +import cn.hutool.core.util.StrUtil; +import cn.hutool.http.HttpRequest; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; + +/** + * com.hzya.frame.bip.v3.v2207.util + * + * @author makejava + * @date 2024-05 -30 14:20 + */ + +public class BipUtil { + /** + * + * @content 发送单据到BIP系统 + * @author laborer + * @date 2024/6/21 0021 10:51 + * + */ + + public static String sendU9cTOBipEsb(String parm, String apiCode,String token){ + String baseUrl = "http://127.0.0.1:9999/kangarooDataCenterV3/entranceController/externalCallInterface"; + System.out.println("推送参数"+parm); + String result = HttpRequest.post(baseUrl) + .header("appId", "800023")//头信息,多个头信息多次调用此方法即可 + .header("access_token", token)//头信息,多个头信息多次调用此方法即可 + .header("apiCode", apiCode)//头信息,多个头信息多次调用此方法即可 + .header("publicKey", "ZJYA1vBeY1ai53iNmbAEsw6DImjkXGBkdMailxcBdliFC85Ce7eDIk+3zDUT+v578prj")//头信息,多个头信息多次调用此方法即可 + .header("secretKey", "7Gp6OjHrIaQ6R3tXGPrI4morjQyWL+qu4JJschQnkBRtv26VDgGFVYKOy5kMZfd/j3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=")//头信息,多个头信息多次调用此方法即可 + .body(parm)//表单内容 + .timeout(20000)//超时,毫秒 + .execute().body(); + System.out.println("返回参数"+result); + if(StrUtil.isNotEmpty(result)){ + return analytic(result); + } + return null; + } + public static String getBipToken(String userCode, String apiCode){ + String baseUrl = "http://127.0.0.1:9999/kangarooDataCenterV3/entranceController/externalCallInterface"; + String result = HttpRequest.post(baseUrl) + .header("appId", "800023")//头信息,多个头信息多次调用此方法即可 + .header("apiCode", apiCode)//头信息,多个头信息多次调用此方法即可 + .header("usercode", userCode)//头信息,多个头信息多次调用此方法即可 + .header("publicKey", "ZJYA1vBeY1ai53iNmbAEsw6DImjkXGBkdMailxcBdliFC85Ce7eDIk+3zDUT+v578prj")//头信息,多个头信息多次调用此方法即可 + .header("secretKey", "7Gp6OjHrIaQ6R3tXGPrI4morjQyWL+qu4JJschQnkBRtv26VDgGFVYKOy5kMZfd/j3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=")//头信息,多个头信息多次调用此方法即可 + .body("")//表单内容 + .timeout(20000)//超时,毫秒 + .execute().body(); + System.out.println("返回参数"+result); + if(StrUtil.isNotEmpty(result)){ + JSONObject obj = JSON.parseObject( analytic(result)); + JSONObject data = obj.getJSONObject("data"); + return data.getString("access_token"); + } + return null; + } + public static String analytic(String parm){ + JSONObject main = JSON.parseObject(parm); + return main.getString("attribute"); + } +} diff --git a/fw-bip/src/main/resources/lib/DataApiSdk-jar-with-dependencies.jar b/fw-bip/src/main/resources/lib/DataApiSdk-jar-with-dependencies.jar new file mode 100644 index 00000000..85b98bf5 Binary files /dev/null and b/fw-bip/src/main/resources/lib/DataApiSdk-jar-with-dependencies.jar differ diff --git a/fw-bip/src/main/resources/lib/bcprov-jdk15on-1.57.jar b/fw-bip/src/main/resources/lib/bcprov-jdk15on-1.57.jar new file mode 100644 index 00000000..5a10986b Binary files /dev/null and b/fw-bip/src/main/resources/lib/bcprov-jdk15on-1.57.jar differ diff --git a/fw-bip/src/main/resources/lib/bcprov-jdk15on-1.70.jar b/fw-bip/src/main/resources/lib/bcprov-jdk15on-1.70.jar new file mode 100644 index 00000000..0e4198e5 Binary files /dev/null and b/fw-bip/src/main/resources/lib/bcprov-jdk15on-1.70.jar differ diff --git a/fw-bip/src/main/resources/lib/openBasicSDK-2.1.230630.jar b/fw-bip/src/main/resources/lib/openBasicSDK-2.1.230630.jar new file mode 100644 index 00000000..e7e5ce1b Binary files /dev/null and b/fw-bip/src/main/resources/lib/openBasicSDK-2.1.230630.jar differ diff --git a/fw-bip/src/main/resources/lib/pubbaseapp_nccloud_rtLevel-1.jar b/fw-bip/src/main/resources/lib/pubbaseapp_nccloud_rtLevel-1.jar new file mode 100644 index 00000000..78aedbcf Binary files /dev/null and b/fw-bip/src/main/resources/lib/pubbaseapp_nccloud_rtLevel-1.jar differ diff --git a/fw-bip/src/main/resources/lib/yonyoulog.jar b/fw-bip/src/main/resources/lib/yonyoulog.jar new file mode 100644 index 00000000..06a4fa84 Binary files /dev/null and b/fw-bip/src/main/resources/lib/yonyoulog.jar differ diff --git a/fw-bip/src/main/webapp/WEB-INF/lib/DataApiSdk-jar-with-dependencies.jar b/fw-bip/src/main/webapp/WEB-INF/lib/DataApiSdk-jar-with-dependencies.jar new file mode 100644 index 00000000..85b98bf5 Binary files /dev/null and b/fw-bip/src/main/webapp/WEB-INF/lib/DataApiSdk-jar-with-dependencies.jar differ diff --git a/fw-bip/src/main/webapp/WEB-INF/lib/bcprov-jdk15on-1.57.jar b/fw-bip/src/main/webapp/WEB-INF/lib/bcprov-jdk15on-1.57.jar new file mode 100644 index 00000000..5a10986b Binary files /dev/null and b/fw-bip/src/main/webapp/WEB-INF/lib/bcprov-jdk15on-1.57.jar differ diff --git a/fw-bip/src/main/webapp/WEB-INF/lib/bcprov-jdk15on-1.70.jar b/fw-bip/src/main/webapp/WEB-INF/lib/bcprov-jdk15on-1.70.jar new file mode 100644 index 00000000..0e4198e5 Binary files /dev/null and b/fw-bip/src/main/webapp/WEB-INF/lib/bcprov-jdk15on-1.70.jar differ diff --git a/fw-bip/src/main/webapp/WEB-INF/lib/openBasicSDK-2.1.230630.jar b/fw-bip/src/main/webapp/WEB-INF/lib/openBasicSDK-2.1.230630.jar new file mode 100644 index 00000000..e7e5ce1b Binary files /dev/null and b/fw-bip/src/main/webapp/WEB-INF/lib/openBasicSDK-2.1.230630.jar differ diff --git a/fw-bip/src/main/webapp/WEB-INF/lib/pubbaseapp_nccloud_rtLevel-1.jar b/fw-bip/src/main/webapp/WEB-INF/lib/pubbaseapp_nccloud_rtLevel-1.jar new file mode 100644 index 00000000..78aedbcf Binary files /dev/null and b/fw-bip/src/main/webapp/WEB-INF/lib/pubbaseapp_nccloud_rtLevel-1.jar differ diff --git a/fw-bip/src/main/webapp/WEB-INF/lib/yonyoulog.jar b/fw-bip/src/main/webapp/WEB-INF/lib/yonyoulog.jar new file mode 100644 index 00000000..06a4fa84 Binary files /dev/null and b/fw-bip/src/main/webapp/WEB-INF/lib/yonyoulog.jar differ diff --git a/fw-bip/src/main/webapp/WEB-INF/web.xml b/fw-bip/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 00000000..d80081d1 --- /dev/null +++ b/fw-bip/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,6 @@ + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index 2d3edc15..5b4fdf24 100644 --- a/pom.xml +++ b/pom.xml @@ -19,6 +19,17 @@ + fw-bip + + + + + + + + + + com.hzya.frame kangarooDataCenterV3 @@ -114,11 +125,6 @@ httpclient ${httpclient.version} - - org.apache.httpcomponents - httpmime - 4.5.13 - org.springframework.boot spring-boot-starter-cache @@ -411,16 +417,6 @@ alibaba-dingtalk-service-sdk 2.0.0 - - commons-net - commons-net - 3.8.0 - - - com.jcraft - jsch - 0.1.53 - @@ -471,33 +467,33 @@ maven-war-plugin - - - - - - - - - - - - - - - - - - - - - - - - - - - + + ${basedir}/../base-service/src/main/webapp/WEB-INF/lib + WEB-INF/lib/ + false + + + **/*.jar + + + + ${basedir}/../fw-bip/src/main/webapp/WEB-INF/lib + WEB-INF/lib/ + false + + + **/*.jar + + + + ${basedir}/../fw-ningbobank/src/main/webapp/WEB-INF/lib + WEB-INF/lib/ + false + + + **/*.jar + +