diff --git a/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/plugin/form/ApiMappingBillPlugin.java b/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/plugin/form/ApiMappingBillPlugin.java index 26f238e..f8bef17 100644 --- a/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/plugin/form/ApiMappingBillPlugin.java +++ b/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/plugin/form/ApiMappingBillPlugin.java @@ -164,6 +164,13 @@ public class ApiMappingBillPlugin extends AbstractFormPlugin implements Plugin { JSONObject responseBody = ApiEntity.getResponseBody(apiEntity); this.getView().showTipNotification("返回结果:" + responseBody.toJSONString()); } + + if ("shkd_gettoken".equals(itemKey)) { + //域名 + String domainName = dataEntity.getString("shkd_domainname"); + Map resultMap = ApiService.getBIPToken(domainName); + this.getModel().setValue("shkd_token", resultMap.get("token")); + } } /** @@ -194,108 +201,6 @@ public class ApiMappingBillPlugin extends AbstractFormPlugin implements Plugin { //目前JSONArray都是一层 JSONObject json = new JSONObject(); for (DynamicObject dynamicObject : currentFloor) { - /*String key = dynamicObject.getString("shkd_tarfield"); - Object shkd_soufield = dynamicObject.get("shkd_soufield"); - logger.info("shkd_soufield: {}", shkd_soufield); - Object value = null; - if (shkd_soufield != null && !"".equals(shkd_soufield)) { - String[] parts = shkd_soufield.toString().split("\\."); - logger.info("dynamic:{}\nparts: {}", dynamic, Arrays.toString(parts)); - if (parts.length == 1) { - if ("payeetype".equals(parts[0]) || "payertype".equals(parts[0])) { - String objectType = dynamic.getString(parts[0]); - switch (objectType) { - case "bos_org": - value = "4"; - break; - case "bd_supplier": - value = "2"; - break; - case "bd_customer": - value = "1"; - break; - case "bos_user": - value = "3"; - break; - case "other": - value = "4"; - break; - } - } else if ("debitamount".equals(parts[0])) { - // 付款金额 - BigDecimal debitamount = dynamic.getBigDecimal("debitamount"); - // 收款金额 - BigDecimal creditamount = dynamic.getBigDecimal("creditamount"); - if (debitamount.compareTo(BigDecimal.ZERO) != 0) { - value = dynamic.get("debitamount"); - } else { - value = dynamic.get("creditamount"); - } - } else if ("direction".equals(parts[0])) { - // 付款金额 - BigDecimal debitamount = dynamic.getBigDecimal("debitamount"); - // 收款金额 - BigDecimal creditamount = dynamic.getBigDecimal("creditamount"); - if (debitamount.compareTo(BigDecimal.ZERO) != 0) { - value = "1";//支出 - } else { - value = "2";//收入 - } - } else { - value = dynamic.get(parts[0]); - } - } else if (parts.length == 2) { - if ("entry".equals(parts[0])) { - DynamicObjectCollection dynamicObjectCollection = dynamic.getDynamicObjectCollection(parts[0]); - value = dynamicObjectCollection.get(0).get(parts[1]); - } else { - DynamicObject object = dynamic.getDynamicObject(parts[0]); - if (object != null) { - value = object.get(parts[1]); - } - } - } else if (parts.length == 3) { - if ("entry".equals(parts[0])) { - DynamicObjectCollection dynamicObjectCollection = dynamic.getDynamicObjectCollection(parts[0]); - DynamicObject object = dynamicObjectCollection.get(0).getDynamicObject(parts[1]); - if (object != null) { - value = object.get(parts[2]); - } - } else { - DynamicObject object = dynamic.getDynamicObject(parts[0]); - if (object != null) { - DynamicObject object1 = object.getDynamicObject(parts[1]); - if (object1 != null) { - value = object1.get(parts[2]); - } - } - } - } - } else { - value = dynamicObject.get("shkd_defaultdata"); - } - logger.info("key: {}, value: {}", key, value); - String tartype = dynamicObject.getString("shkd_tartype"); - - if ("String".equals(tartype) || "Date".equals(tartype)) { - json.put(key, value); - } else if ("Integer".equals(tartype)) { - json.put(key, Integer.parseInt(value.toString())); - } else if ("BigDecimal".equals(tartype)) { - json.put(key, new BigDecimal(value.toString())); - } else if ("对象".equals(tartype)) { - JSONObject childJson = new JSONObject(); - processFloor(childJson, key, getChildren(floors, dynamicObject.getString("shkd_tarfield")), floors, dynamic); - json.put(key, childJson); - } else if ("数组".equals(tartype)) { - JSONArray childJsonArray = new JSONArray(); - for (DynamicObject childDynamicObject : getChildren(floors, dynamicObject.getString("shkd_tarfield"))) { - JSONObject childJson = new JSONObject(); - processFloor(childJson, key, Collections.singletonList(childDynamicObject), floors, dynamic); - childJsonArray.add(childJson); - } - json.put(key, childJsonArray); - }*/ valueAssignment(dynamicObject, dynamic, json, floors); } jsonArray.add(json); @@ -303,106 +208,6 @@ public class ApiMappingBillPlugin extends AbstractFormPlugin implements Plugin { } else { logger.info("进入对象"); for (DynamicObject dynamicObject : currentFloor) { - /*String key = dynamicObject.getString("shkd_tarfield"); - Object shkd_soufield = dynamicObject.get("shkd_soufield"); - logger.info("shkd_soufield: {}", shkd_soufield); - Object value = null; - if (shkd_soufield != null && !"".equals(shkd_soufield)) { - String[] parts = shkd_soufield.toString().split("\\."); - logger.info("dynamic:{}\nparts: {}", dynamic, Arrays.toString(parts)); - if (parts.length == 1) { - if ("payeetype".equals(parts[0]) || "payertype".equals(parts[0])) { - String objectType = dynamic.getString(parts[0]); - switch (objectType) { - case "bos_org": - value = "4"; - break; - case "bd_supplier": - value = "2"; - break; - case "bd_customer": - value = "1"; - break; - case "bos_user": - value = "3"; - break; - case "other": - value = "4"; - break; - } - } else if ("debitamount".equals(parts[0])) { - // 付款金额 - BigDecimal debitamount = dynamic.getBigDecimal("debitamount"); - // 收款金额 - BigDecimal creditamount = dynamic.getBigDecimal("creditamount"); - if (debitamount.compareTo(BigDecimal.ZERO) != 0) { - value = dynamic.get("debitamount"); - } else { - value = dynamic.get("creditamount"); - } - } else if ("direction".equals(parts[0])) { - // 付款金额 - BigDecimal debitamount = dynamic.getBigDecimal("debitamount"); - // 收款金额 - BigDecimal creditamount = dynamic.getBigDecimal("creditamount"); - if (debitamount.compareTo(BigDecimal.ZERO) != 0) { - value = "1";//支出 - } else { - value = "2";//收入 - } - } else { - value = dynamic.get(parts[0]); - } - } else if (parts.length == 2) { - if ("entry".equals(parts[0])) { - DynamicObjectCollection dynamicObjectCollection = dynamic.getDynamicObjectCollection(parts[0]); - value = dynamicObjectCollection.get(0).get(parts[1]); - } else { - DynamicObject object = dynamic.getDynamicObject(parts[0]); - if (object != null) { - value = object.get(parts[1]); - } - } - } else if (parts.length == 3) { - if ("entry".equals(parts[0])) { - DynamicObjectCollection dynamicObjectCollection = dynamic.getDynamicObjectCollection(parts[0]); - DynamicObject object = dynamicObjectCollection.get(0).getDynamicObject(parts[1]); - if (object != null) { - value = object.get(parts[2]); - } - } else { - DynamicObject object = dynamic.getDynamicObject(parts[0]); - if (object != null) { - DynamicObject object1 = object.getDynamicObject(parts[1]); - if (object1 != null) { - value = object1.get(parts[2]); - } - } - } - } - } else { - value = dynamicObject.get("shkd_defaultdata"); - } - logger.info("key: {}, value: {}", key, value); - String tartype = dynamicObject.getString("shkd_tartype"); - - if ("String".equals(tartype) || "Date".equals(tartype)) { - parentJson.put(key, value); - } else if ("Integer".equals(tartype)) { - parentJson.put(key, Integer.parseInt(value.toString())); - } else if ("BigDecimal".equals(tartype)) { - parentJson.put(key, new BigDecimal(value.toString())); - } else if ("对象".equals(tartype)) { - JSONObject childJson = new JSONObject(); - processFloor(childJson, key, getChildren(floors, dynamicObject.getString("shkd_tarfield")), floors, dynamic); - parentJson.put(key, childJson); - } else if ("数组".equals(tartype)) { - JSONArray childJsonArray = new JSONArray(); - JSONObject childJson = new JSONObject(); - processFloor(childJson, key, getChildren(floors, dynamicObject.getString("shkd_tarfield")), floors, dynamic); - childJsonArray.add(childJson); - parentJson.put(key, childJsonArray); - }*/ valueAssignment(dynamicObject, dynamic, parentJson, floors); } }