if (jsonObject.get("department").equals(rongtongDept)) { summaryId = flowFactory.sendCollaboration(LOGIN_NAME, rongtongCode, null, transOrderGoodsJsonToFormExport(jsonObject, rongtongCode), null, "0", null); } else if (jsonObject.get("department").equals(neijiangDept)) { summaryId = flowFactory.sendCollaboration(LOGIN_NAME, neijiangCode, null, transOrderGoodsJsonToFormExport(jsonObject, neijiangCode), null, "0", null); }else if (jsonObject.get("department").equals(jiangyouDept)) { summaryId = flowFactory.sendCollaboration(LOGIN_NAME, jiangyouCode, null, transOrderGoodsJsonToFormExport(jsonObject, jiangyouCode), null, "0", null); }else if (jsonObject.get("department").equals(dept)) { summaryId = flowFactory.sendCollaboration(LOGIN_NAME, purchaseRequestCode, null, transOrderGoodsJsonToFormExport(jsonObject, purchaseRequestCode), null, "0", null); }else if (jsonObject.get("department").equals(dept2)) { summaryId = flowFactory.sendCollaboration(LOGIN_NAME, purchaseRequestCode2, null, transOrderGoodsJsonToFormExport(jsonObject, purchaseRequestCode2), null, "0", null); } 把这段代码改成swich的模式
时间: 2024-03-16 18:46:19 浏览: 109
Delphi中使用ISuperObject解析Json数据的实现代码
以下是使用switch语句重写的代码:
```
String department = jsonObject.get("department");
String summaryId = "";
String code = "";
String formExport = transOrderGoodsJsonToFormExport(jsonObject, code);
switch (department) {
case rongtongDept:
code = rongtongCode;
break;
case neijiangDept:
code = neijiangCode;
break;
case jiangyouDept:
code = jiangyouCode;
break;
case dept:
code = purchaseRequestCode;
break;
case dept2:
code = purchaseRequestCode2;
break;
}
summaryId = flowFactory.sendCollaboration(LOGIN_NAME, code, null, formExport, null, "0", null);
```
阅读全文