| Line 51... |
Line 51... |
| 51 |
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(DATE_PATTERN);
|
51 |
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(DATE_PATTERN);
|
| 52 |
String formattedDateTime = localDate.format(formatter);
|
52 |
String formattedDateTime = localDate.format(formatter);
|
| 53 |
return formattedDateTime;
|
53 |
return formattedDateTime;
|
| 54 |
}
|
54 |
}
|
| 55 |
|
55 |
|
| - |
|
56 |
public static final String toString(LocalDateTime localDateTime){
|
| - |
|
57 |
if(localDateTime == null){
|
| - |
|
58 |
return null;
|
| - |
|
59 |
}
|
| - |
|
60 |
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd-MM-YYYY HH:mm:ss");
|
| - |
|
61 |
return localDateTime.format(formatter);
|
| - |
|
62 |
}
|
| - |
|
63 |
|
| 56 |
public static final LocalDateTime toDateTime(String dateTimeString) throws DateTimeParseException{
|
64 |
public static final LocalDateTime toDateTime(String dateTimeString) throws DateTimeParseException{
|
| 57 |
if(dateTimeString == null || dateTimeString.equals("0") || dateTimeString.isEmpty()){
|
65 |
if(dateTimeString == null || dateTimeString.equals("0") || dateTimeString.isEmpty()){
|
| 58 |
return null;
|
66 |
return null;
|
| 59 |
}
|
67 |
}
|
| 60 |
return LocalDateTime.parse(dateTimeString);
|
68 |
return LocalDateTime.parse(dateTimeString);
|
| Line 130... |
Line 138... |
| 130 |
|
138 |
|
| 131 |
}
|
139 |
}
|
| 132 |
|
140 |
|
| 133 |
public static String generatePolicyNumber(String prefix, int sequence){
|
141 |
public static String generatePolicyNumber(String prefix, int sequence){
|
| 134 |
String policyNumber = String.format(prefix + "%06d", sequence);
|
142 |
String policyNumber = String.format(prefix + "%06d", sequence);
|
| 135 |
LOGGER.info("Generated Policy Number {}", policyNumber);
|
143 |
LOGGER.info("Generated Policy Number [{}]", policyNumber);
|
| 136 |
return policyNumber;
|
144 |
return policyNumber;
|
| 137 |
}
|
145 |
}
|
| 138 |
|
146 |
|
| 139 |
public static String generateFofoStoreSequence(String prefix, int sequence){
|
147 |
public static String generateFofoStoreSequence(String prefix, int sequence){
|
| 140 |
String fofoStoreSequenceNumber = String.format(prefix + "%03d", sequence);
|
148 |
String fofoStoreSequenceNumber = String.format(prefix + "%03d", sequence);
|
| 141 |
LOGGER.info("Generated Fofo Store Sequence Number {}", fofoStoreSequenceNumber);
|
149 |
LOGGER.info("Generated Fofo Store Sequence Number [{}]", fofoStoreSequenceNumber);
|
| 142 |
return fofoStoreSequenceNumber;
|
150 |
return fofoStoreSequenceNumber;
|
| 143 |
}
|
151 |
}
|
| - |
|
152 |
|
| - |
|
153 |
public static String generateOxigenRechageRequestId(String prefix, int sequence){
|
| - |
|
154 |
String oxigenRechargeRequestId = String.format(prefix + "%07d", sequence);
|
| - |
|
155 |
LOGGER.info("Generated Oxigen Recharge Request Id [{}]", oxigenRechargeRequestId);
|
| - |
|
156 |
return oxigenRechargeRequestId;
|
| - |
|
157 |
}
|
| - |
|
158 |
|
| - |
|
159 |
public static String toOxigenRechargeRequestDate(LocalDateTime now){
|
| - |
|
160 |
StringBuilder oxigenRechargeRequestDate = new StringBuilder();
|
| - |
|
161 |
oxigenRechargeRequestDate.append(now.getYear());
|
| - |
|
162 |
oxigenRechargeRequestDate.append(now.getMonthValue());
|
| - |
|
163 |
oxigenRechargeRequestDate.append(now.getDayOfMonth());
|
| - |
|
164 |
oxigenRechargeRequestDate.append(now.getHour());
|
| - |
|
165 |
oxigenRechargeRequestDate.append(now.getMinute());
|
| - |
|
166 |
oxigenRechargeRequestDate.append(now.getSecond());
|
| - |
|
167 |
return oxigenRechargeRequestDate.toString();
|
| - |
|
168 |
}
|
| - |
|
169 |
|
| - |
|
170 |
public static LocalDateTime fromOxigenRechargeRequestDate(String oxigenRechargeRequestDate){
|
| - |
|
171 |
int year = Integer.parseInt(oxigenRechargeRequestDate.substring(0, 3));
|
| - |
|
172 |
int month = Integer.parseInt(oxigenRechargeRequestDate.substring(4, 5));
|
| - |
|
173 |
int dayOfMonth = Integer.parseInt(oxigenRechargeRequestDate.substring(6, 7));
|
| - |
|
174 |
int hour = Integer.parseInt(oxigenRechargeRequestDate.substring(8, 9));
|
| - |
|
175 |
int minute = Integer.parseInt(oxigenRechargeRequestDate.substring(10, 11));
|
| - |
|
176 |
int second = Integer.parseInt(oxigenRechargeRequestDate.substring(12, 13));
|
| - |
|
177 |
return LocalDateTime.of(year, month, dayOfMonth, hour, minute, second);
|
| - |
|
178 |
}
|
| 144 |
|
179 |
|
| 145 |
}
|
180 |
}
|