当前位置: 首页 > news >正文

HFM深入技术学习系列之四--调用API生成日记账

概述

本文描述使用HFM提供的SDK自动生成日记账

介绍

分为三个步骤
1 获得进入HFM的session
2 获得JournalOM
3 使用JournalOM保存日记账

用到的包

fmcommon.jar
fm-web-objectmodel.jar
hssutil.jar

代码示例

获取JournalOM

ISecurityManager tpMNG  = HSSUtilManager.getSecurityManager();
String ssoToken = tpMNG.authenticateUser(USERNAME, PASSWORD);
SessionOM adminSessionOM = new SessionOM();
adminSessionInfo1 = adminSessionOM.createSession(ssoToken, Locale.ENGLISH, HFM_DEV, FINCAPP);
JournalOM adminJournalOM = new JournalOM(adminSessionInfo1);

生成日记账

JSONObject json = (JSONObject) jsonObj;
labels.add((String) json.get("label")) ;
try {journal = journalOM.getJournalByName((String) json.get("label"), (String) json.get("scenario"), (String) json.get("year"), (String) json.get("period"));journalOM.performJournalAction(labels, (String) json.get("scenario"), (String) json.get("year"), (String) json.get("period"), JOURNAL_ACTION.JBA_DELETE);
}
catch (Exception e){System.out.println(e.getMessage());
}
journal.setLabel((String) json.get("label"));
journal.setBalancedType(JOURNAL_BALANCE_TYPE.JBTF_UNBALANCED);
journal.setSecurity((String) json.get("security"));
journal.setType(JOURNAL_TYPE.JTF_REGULAR);
journal.setSingleEntity((String) json.get("singleEntity"));
journal.setSingleParent((String) json.get("singleParent"));
journal.setStatus(JOURNAL_STATUS.JSF_WORKING);
year = new JournalDimension();
period = new JournalDimension();
value = new JournalDimension();
scenario = new JournalDimension();
scenario.setName("Scenario");
scenario.setMember((String) json.get("scenario"));
year.setName("Year");
year.setMember((String) json.get("year"));
period.setName("Period");
period.setMember((String) json.get("period"));
value.setName("Value");
value.setMember((String) json.get("value"));
povs.add(scenario);
povs.add(year);
povs.add(period);
povs.add(value);
JSONArray journalLines = (JSONArray) json.get("lines");
List<JournalLineItem> journalLineItems = new ArrayList<JournalLineItem>();
i=0;
for (Object jsonLineObj : journalLines) {JSONObject jsonLine = (JSONObject) jsonLineObj;entity = new JournalDimension();account = new JournalDimension();icp = new JournalDimension();custom1 = new JournalDimension();custom2 = new JournalDimension();custom3 = new JournalDimension();custom4 = new JournalDimension();journalDimensions = new ArrayList<JournalDimension>();lineItem = new JournalLineItem();entity.setName("Entity");entity.setMember((String) jsonLine.get("entity"));account.setName("Account");account.setMember((String) jsonLine.get("account"));icp.setName("ICP");icp.setMember((String) jsonLine.get("icp"));custom1.setName("Custom1");custom1.setMember((String) jsonLine.get("custom1"));custom2.setName("Custom2");custom2.setMember((String) jsonLine.get("custom2"));custom3.setName("Custom3");custom3.setMember((String) jsonLine.get("custom3"));custom4.setName("Custom4");custom4.setMember((String) jsonLine.get("custom4"));journalDimensions.add(entity);journalDimensions.add(account);journalDimensions.add(icp);journalDimensions.add(custom1);journalDimensions.add(custom2);journalDimensions.add(custom3);journalDimensions.add(custom4);lineItem.setLineItemDimensions(journalDimensions);lineItem.setAmount((String) jsonLine.get("amount"));lineType = (String) jsonLine.get("linetype");if (lineType.equals("dr")) {lineItem.setDebitUnit(DEBIT_CREDIT_UNIT.JE_TYPE_DEBIT);} else {lineItem.setDebitUnit(DEBIT_CREDIT_UNIT.JE_TYPE_CREDIT);}journalLineItems.add(i, lineItem);i++;
}
journal.setPov(povs);
journal.setLineItems(journalLineItems);
journalOM.saveJournal(journal);

http://www.mrgr.cn/news/11082.html

相关文章:

  • 22. K8S及DevOps
  • 牛客笔试训练
  • python-Flask 全方位指南:从入门到模块化开发与代码保护
  • Django | 从中间件的角度来认识Django发送邮件功能
  • 从数据生成到图数据库:Linux下Neo4j的CSV导入
  • 双非地信(gis)研究生好的就业意见有哪些
  • VUE使用websocket
  • 环境模拟新篇章:GMS地下水数值模拟技术
  • 不使用 JS 纯 CSS 获取屏幕宽高
  • 关于el-table的扩展表格expand
  • Clickhouse集群化(三)集群化部署
  • 周报(8.12-8.18)
  • SystemTap(stap)架构和原理介绍,以及脚本编写举例
  • 动手学深度学习7.7. 稠密连接网络(DenseNet)-笔记练习(PyTorch)
  • OpenCV杂项图像变换(1)自适应阈值处理函数adaptiveThreshold()的使用
  • 【STM32】时钟体系
  • 本地部署docker文档
  • Windows10安装Docker详细图解
  • 数据赋能(187)——开发:数据产品——概述、关注焦点
  • 系规学习第17天