I wrote a JAVASDK for Kingdee Cloud
AD |
backgroundShortly after joining, I was responsible for a financial module of the company, which mainly required monthly financial statements and then reconciliation. For small companies, financial personnel can generally complete most tasks through data collection and perspective analysis using Excel
background
Shortly after joining, I was responsible for a financial module of the company, which mainly required monthly financial statements and then reconciliation. For small companies, financial personnel can generally complete most tasks through data collection and perspective analysis using Excel. But my company is considered a medium-sized one and has introduced many systems. The sales management end includes ERP, OMS, WMS, etc., while the finance end mainly uses Kingdee system. To be more precise, I am currently using the SaaS version of Kingdee Cloud. So in order to assist finance in faster reconciliation, the IT department needs to collect and integrate data from various business systems into a database, and then perform reports or BI presentations
Just now, my former colleague made a small system that has such a function, so I went to see if I could reuse it directly, and then went to look at the source code, which is all hard coding. Although it can meet the current functionality, once a new feature is added, a large amount of duplicate code needs to be copied and pieced together, and modifying a feature requires modifying multiple places at the same time. Only one of the business methods is shown below.
At this moment, I am thinking about whether I can write a universal SDK for docking with Kingdee, shielding all details of Kingdee operations, and only providing corresponding login authentication (only requiring the client to provide the corresponding account password), query, save, update, delete, and other interfaces. However, based on years of development experience, I believe that Kingdee will definitely provide such an SDK, so I went to the official search and couldn't find it after searching for a long time (it is said that it already exists). After all, I maintain the system and code on my own, so I can't let myself become so numb, so I still need to do something interesting to make the work not too boring. Therefore, I spent some time manually writing a Kingdee SDK while balancing my daily work. Currently, I have hung it on Gitee, and I feel that the effect is quite good. Interested students can take a look. The following figure shows the statistics of the code base.
Below, I can briefly analyze the structure of the code for everyone.
Kingdee k3coud web API parsing
Firstly, several pain points need to be addressed
- The client should no longer care about login authentication issues, just provide the account password
- Out-of-the-box interface with minimal range of interface parameters
- Object oriented programming rather than exposing a large number of properties or methods originating from an object to various parts of the code
- SDK has high scalability
Before addressing the pain points mentioned above, we need to consider from an abstract perspective what kind of role the Kingdee system belongs to relative to our current platform. Actually, it can be likened to a database, where I need to use my username and password to operate it (query, add, delete, update). So before writing the specific implementation, I first made a top-level decision
Actually, after reading this interface and each method, it's clear what to do next. Let me briefly analyze:
GetEndPoint: The service address provided by the client
GetService: What service, add or query
GetAuth: authentication function
Execute: Execute requests and process data
In that case, we will solve the problemPain point 1The login issue is equivalent to built-in login, and the client does not need to worry. And it also solved the problemPain point 4There is an extension issue with the SDK. If Kingdee adds new service functions in the future, I just need to inherit the Common Service class.
Next is how to make it more convenient for the client to operate. At this moment, I am thinking of various template operations in Spring, such as JdbcTemplate, RedisTemplate, and so on. Thinking about their ideas, it feels very intuitive and convenient. So I created a K3CloudTemplate, and you can take a look at the following implementation:
This will solve the problemPain point 2We can use it out of the box and minimize the parameter range (such as BillQuery and BillSave, where we can view Kingdee's forms as individual objects and extract commonalities instead of passing a large number of parameters). So let's take a look at how forms are abstractly encapsulated.
Firstly, I roughly looked at the request document of Kingdee and found that different interface requests require passing common parameters, such as formId. Therefore, the form should also have a top-level parent class to facilitate shared properties or behaviors. Then there is the top-level entity BillEntity.
The next step is to extend according to different form types, as follows:
It can be seen that BillQuery is significantly different from BillSave. BillQuery is a bit more complex because the query responds to more business scenarios, such as which fields need to be queried, what conditions are, and how many rows are returned. These are all encapsulated in the BillQuery object. If you use a process oriented and heap code mindset to write this query, you may encounter the situation at the beginning of the article where you need to concatenate query fields, conditions, etc. according to Kingdee's API, rather than treating it as a query object and blocking some common actions. This explains whyPain point 3The problem of object attribute decentralization
summary
summary
- Technology ultimately serves the business. Before starting, measure the business boundaries of all parties in order to abstract and make trade-offs
- Being able to use object-oriented programming means never having to be process oriented and not overly encapsulated
- Drawing on classic open-source framework ideas and best practices
- Not reproducing wheels
- Independent thinking ability, not numb or particular
Thank you for reading. It's not easy to code. Could you please share it or give a thumbs up and attention
Disclaimer: The content of this article is sourced from the internet. The copyright of the text, images, and other materials belongs to the original author. The platform reprints the materials for the purpose of conveying more information. The content of the article is for reference and learning only, and should not be used for commercial purposes. If it infringes on your legitimate rights and interests, please contact us promptly and we will handle it as soon as possible! We respect copyright and are committed to protecting it. Thank you for sharing.(Email:[email protected])
Mobile advertising space rental |
Tag: wrote JAVASDK for Kingdee Cloud
Is the world ready to receive ChatGPT therapists?
NextStarting from a video business, the founder has left abroad and has not returned yet. Who still misses LeEco?
Guess you like
-
The 2025 Chinese New Year (Spring Festival) film box office has exploded, exceeding 3 billion RMB and setting a new record for presales!Detail
2025-01-29 11:55:06 1
-
Seres and Beihang University Join Hands to Build an Innovative Ecosystem, Deepening Industry-Academia-Research Collaboration and Promoting Technological TransformationDetail
2025-01-28 14:46:18 1
-
Douyin 2024 Platform Governance Report: Safeguarding Security, Building a Better CommunityDetail
2025-01-28 14:25:55 1
-
Chinese Scientists Develop a Lightweight Bionic Dexterous Hand with 19 Degrees of Freedom, Promising to Revolutionize Prosthetic and Robotics TechnologyDetail
2025-01-28 14:16:39 1
-
DeepSeek: A Chinese AI Startup's Meteoric Rise Shakes Up Global Tech and Sends US Stocks PlungingDetail
2025-01-28 14:13:23 1
-
WeChat's New Year's Red Envelope Feature Gets a Voice Message Upgrade for Warmer Wishes!Detail
2025-01-26 11:37:36 1
-
360 Digital Security Group and Zhibangyang Education Technology Join Forces to Build a New Ecosystem for Cybersecurity and AI Talent CultivationDetail
2025-01-24 15:09:51 1
-
Visionox Achieves Mass Production of AMOLED with Solid-State Laser Annealing (SLA) Technology, Ushering in a New Era for the Display IndustryDetail
2025-01-24 14:34:23 1
-
Seres at the Davos Forum: The Path to Globalizing New Energy Vehicles Through Cooperation in the Intelligent EraDetail
2025-01-23 13:28:12 1
-
Amazon to Close All French-Speaking Quebec Warehouses, Laying Off Nearly 2,000 EmployeesDetail
2025-01-23 10:51:23 1
-
The official launch of the 2025 Electric Bicycle Trade-in Policy: Upgraded Subsidy Standards, Procedures, and PromotionDetail
2025-01-23 10:48:52 1
-
Xbox Series X|S Officially Supports External Hard Drives Larger Than 16TB: Saying Goodbye to Storage WorriesDetail
2025-01-23 10:39:19 1
-
Leaders from the Beijing Chaoyang District CPPCC Visited Quantum Leap Group, Affirming its Contributions and Future Prospects in the Silver Hair EconomyDetail
2025-01-22 17:06:56 1
-
China's Car Imports Remain Sluggish in 2024: 12% Decline, Sharp Drop in New Energy VehiclesDetail
2025-01-22 11:37:25 1
-
China Railway Group Limited (CRGL) officially debunks "speed-up" ticket booking software: Not a shortcut, but a pathway to riskDetail
2025-01-22 11:36:09 1
-
Dago Bio Completes Over $20 Million A+ Round Funding to Accelerate Novel Molecular Glue Drug DevelopmentDetail
2025-01-22 11:34:05 11
-
Rapid Degradation of Global Lake Submerged Vegetation: Satellite Observations Reveal a Critical Period of Ecosystem ShiftDetail
2025-01-22 11:29:03 1
-
Star Ace Capital Group and Abu Dhabi Investment Office Partner to Build a Global Esports Industry BenchmarkDetail
2025-01-22 11:27:50 1
-
Hisense Television Leads the 100-Inch Large-Screen Market in 2024, Achieving an Unparalleled Industry LegacyDetail
2025-01-22 11:12:49 1
-
WeChat Launches "Gifts" Feature: Streamlining Gift-Giving and Powering Social Commerce GrowthDetail
2025-01-21 16:05:45 1