Week 1
December 2, 2024About 1 min
Week 1
Interface Development: Auto-Complete Project-Related System Configuration Information
Read the source code, understand the business logic
Develop the interface
Do unit test for the interface
Interface optimizations (For same data reduce run time from 2:30 to 1:30)
Add new logic for the interface
Configure APP and Email remind functionality
Technical Points
DozerMapper Class:
map
method: Maps a source object to a destination object, commonly used for copying properties between objects.- Example:
DozerBeanMapper mapper = new DozerBeanMapper(); DestinationObject destObject = mapper.map(sourceObject, DestinationObject.class);
Upsert Operations:
- Common operations for handling duplicate keys in different databases:
INSERT ON DUPLICATE KEY UPDATE
(MySQL):INSERT INTO table (id, column1, column2) VALUES (1, 'value1', 'value2') ON DUPLICATE KEY UPDATE column1 = VALUES(column1), column2 = VALUES(column2);
- Common operations for handling duplicate keys in different databases:
INSERT IGNORE:
INSERT IGNORE
is a feature in MySQL used to ignore the record if a conflict occurs, rather than throwing an error.- Example:
INSERT IGNORE INTO table (id, column1, column2) VALUES (1, 'value1', 'value2');
Difference Between INSERT IGNORE and Upsert:
INSERT IGNORE
: Ignores conflicts and makes no changes to existing records.- Upsert: Updates existing records when conflicts occur.
Avoiding Null Pointer Exceptions:
- Instead of using
projectDTO.getProjectStatus().equals("XXX")
, which can throw a null pointer exception ifprojectDTO.getProjectStatus()
returns null, it is better to check ifprojectDTO.getProjectStatus()
is null first. - Example:
if ("XXX".equals(projectDTO.getProjectStatus())) { // Do something }
- Instead of using
@ConfigurationProperties Annotation:
- Used to load configuration properties with a specific prefix from configuration files (e.g., YAML) into a Bean.
- Example:
xxx: xxx: property1: value1 property2: value2
@ConfigurationProperties(prefix = "xxx.xxx") public class ConfigProperties { private String property1; private String property2; // Getters and Setters }
Interface Development: General Email Sending API
Project Background
- The bank provides a "One-Stop Email" service, and ZA21 has already implemented a mail client. However, to reduce permission application processes and improve usability, there is a need to encapsulate these functionalities further into a general email sending interface, achieving MAILaaS (Mail as a Service).
Key Requirements
- Support for Sending Both Plain Emails and Emails with Attachments:
- Parameters should be designed to match those of the ZA21 email message client.
- Deploy on FAAS(Function as a Service) Platform:
- The service will be deployed on the FAAS platform (China Merchant Bank's cloud platform) to ensure high availability and scalability.
- Technical Debt Rate:
- The technical debt rate must be less than 1.0%, emphasizing the importance of code quality and maintainability.
- Flexible Deployment Across Different Network Environments:
- The service should be deployable in different network environments, such as BIZ, DMZ, and office networks, based on actual needs.