| Rev |
Age |
Author |
Path |
Log message |
Diff |
| 37789 |
8 d 9 h |
amit |
/trunk/profitmandi-common/src/main/java/com/spice/profitmandi/common/util/ |
FormattingUtils.formatDigit: print whole numbers, as intended
digitFormatter set the MINIMUM fraction digits twice and never set the
maximum, so Java's default of 3 applied: formatDigit(84745.76f) rendered
"84,745.758" - float noise at three decimals - where a whole number was
meant. The second call was clearly a typo for setMaximumFractionDigits(0).
Only one other call site (ItemCriteria "with Selling Price >= ..."), which
passes whole rupees and is unaffected. Needed by the B2C return refund,
which prints whole-rupee amounts on screen and in mails. |
|
| 37768 |
12 d 3 h |
amit |
/trunk/profitmandi-common/src/main/java/com/spice/profitmandi/common/util/ |
feat(supplier): GstinUtil - read state code / PAN from a GSTIN so the GSTIN decides a supplier's state |
|
| 37672 |
19 d 9 h |
amit |
/trunk/profitmandi-common/src/main/java/com/spice/profitmandi/common/util/ |
Add BrowserLane: machine-wide interlock so only one headless Chrome runs at a time
Every ChromeDriver tree on the app box costs ~850MB RSS, on a host holding a
-Xmx8g tomcat and a -Xmx2g cron jar on 16GB that has been kernel-OOM-killed
twice with tomcat the victim. Peak concurrent drivers is the number that
matters, not drivers per day.
Measured on the oppo/realme lane: a 25-imei chunk takes 505s (12s driver
startup, then ~19.7s an imei) against a fixed 20s fixedDelay, i.e. a 96% duty
cycle. Meanwhile tomcat starts its own driver 8 times a day for the knowlarity
scrape. On 17-Sep that scrape ran 11:40:00-11:41:07 and the lane's next driver
came up at 11:42:21 -- it cleared by 74 seconds, by luck. At a 96% duty cycle
the collision cannot be dodged by choosing better times, only by serialising.
The two JVMs are separate processes owned by different users, so an in-process
flag cannot see across the boundary. Uses an OS file lock at
/var/lock/sd-browser.lock (overridable via -Dsd.browser.lock), created 0666 on
first use because cron runs as root and tomcat as tomcat and whichever starts
first creates it. A file lock rather than a marker file so the kernel reclaims
it when the holder dies: verified by SIGKILLing the holder mid-hold, the next
JVM acquired in 264ms. A ReentrantLock gates it first, since a second thread in
the same JVM would otherwise get OverlappingFileLockException rather than block.
Callers wait rather than skip. The knowlarity scrape needs 67s against a lane
busy 96% of the time, so skip-on-contention would mean it essentially never
refreshed again. Eight scrapes a day costs the imei lane about nine minutes of
waiting in total.
Fails open if the lock file is unusable (missing /var/lock, read-only mount, dev
laptop): serialising within the JVM only, rather than stopping imei activation
over what is a safety interlock. |
|
| 37668 |
20 d 2 h |
amit |
/trunk/profitmandi-common/src/main/ |
Validate GSTIN shape, state code and checksum
isValidGstNumber accepted any 15-character string, so a pincode (110095, rejected only for
length) and junk (Hdjiekwbdbsjskz) reached fofo_store.gst_number, which billing sends to NIC
as the recipient - the invoice is then refused and the goods cannot ship.
Now: 2-digit state code + PAN + entity + Z + mod-36 check digit, trimmed and upper-cased.
Blank still passes (the field is optional); callers needing one present check that themselves.
Checked against live data: 1,569 of 1,570 well-formed partner GSTINs pass, the one that fails
(HRSP330) has a genuinely wrong check digit.
Adds RTLR_1020 / RTLR_1021 for the invalid and mismatched cases. |
|
| 37489 |
36 d 3 h |
amit |
/trunk/profitmandi-common/src/main/java/com/spice/profitmandi/common/util/ |
Restore Utils.html and Utils.htmlJson removed by r37477
r37477 reorganised Utils while consolidating the mail APIs and dropped its only two
instance methods. They have no Java callers -- they exist solely for Velocity, where
AppConfig binds new Utils() as $vmUtils -- so the compiler, IDE find-usages and any
grep over *.java all reported them dead.
With htmlJson gone, data-paramslist="$vmUtils.htmlJson(...)" stopped rendering usable
JSON on every report link (admin.vm:840, admin.vm:910, reports.vm:51). reports.js:7
then read $(this).data("paramslist") as undefined and returned true, letting the
browser follow the plain <a href> natively -- a GET against the @PostMapping
/reports/{projectName}/{fileName} (ReportsController:126), answered with GE_1007
"Request method 'GET' not supported". The modal POST path was the only way that
endpoint was ever reachable, so every partner report broke at once.
Confirmed against prod: zero occurrences in fofo.log for Aug 13/20/26/28/30, and 87
today starting 18:37:23, right after today's ROOT.war deploy. 13 distinct reports hit.
$vmUtils.html had two further callers that also come back:
offer_margin_detail_partner.vm:12 and :241 (offer description and notes).
Restored verbatim from r37476, and commented as template-only so the next refactor
does not read them as dead code again. |
|
| 37477 |
36 d 5 h |
amit |
/trunk/profitmandi-common/src/main/java/com/spice/profitmandi/common/ |
mail: one way to send mail, and nothing sends inline
There were three overlapping APIs -- Utils.sendMail* (7 static overloads),
EmailServiceImpl.sendMail* (7 more) and MailOutboxService.queueMail* (20). The
first two built their own MimeMessage, hardcoded From: noreply@smartdukaan.com
in eleven places, and pushed straight down whichever JavaMailSender the caller
passed.
That From is why mail was refused: an authenticated Workspace session may send
only as the account it logged in as, and noreply@ is a different identity in the
same domain. Sending inline also meant a failed send was lost outright and took
the calling job down with it, which is how one expired credential came to mark
ten report jobs FAILED.
New in profitmandi-common:
MailQueue - the single entry point; queue() returns once the mail is
recorded, not once it is sent
MailRequest - one value object replacing the 34 overloads
MailSenderType - GOOGLE (authenticated, From rewritten) or RELAY (IP-authorised)
The interface lives in common while MailOutboxService implements it in dao,
because dao depends on common and not the reverse -- Utils and EmailService
could not otherwise reach the outbox at all.
Utils and EmailService keep their signatures so the ~38 call sites still
compile, but now delegate and ignore the JavaMailSender argument; choosing a
transport was never the caller's business. Both are marked deprecated.
MailQueueHolder bridges the static helpers to the bean and is documented as a
compromise, not a pattern. |
|
| 37397 |
42 d 2 h |
amit |
/trunk/profitmandi-common/src/main/java/com/spice/profitmandi/common/util/ |
Consolidate insurance invoice line rendering; drop dead thermal-printing path
Remove the unused 58/80mm thermal chain (InvoiceFormatter, PrinterType and the
PrinterType overload of generateAndWrite) - its only caller was a commented-out
endpoint, and it bypassed the insurance line folding in DocumentData.items().
Drop generateMarginSchemeInvoice, a no-op alias for generateInvoiceV2 with no
production callers. |
|
| 37141 |
74 d 6 h |
amit |
/trunk/profitmandi-common/src/main/java/com/spice/profitmandi/common/util/ |
Add FormattingUtils.formatNicDate(LocalDate) -> dd/MM/yyyy for NIC/IRP e-invoice date fields (DocDt, preceding-invoice InvDt); used by note IRN paths in profitmandi-dao r37140 |
|
| 37070 |
85 d 4 h |
amit |
/trunk/profitmandi-common/src/main/java/com/spice/profitmandi/common/util/ |
Add StringUtils.normalizeWhitespace for input whitespace normalization (T9.5 sanitizer dependency) |
|
| 37066 |
88 d 2 h |
amit |
/trunk/profitmandi-common/ |
Modular invoice/note PDF generation: extract DocumentRenderer + reusable sections + two-axis tax abstraction out of PdfUtils (now thin shims); folded per-tax invoice columns; note Invoice-Ref + type detection; golden-image test harness |
|
| 37062 |
88 d 5 h |
amit |
/trunk/profitmandi-common/src/main/java/com/spice/profitmandi/common/util/ |
Revert PdfUtils to pre-refactor version (r36674) to unbreak trunk; modular doc-generation refactor still in progress |
|
| 37052 |
88 d 10 h |
amit |
/trunk/profitmandi-common/ |
Delegate invoice/note PDF rendering to DocumentRenderer; add poNumber/orderDate to InvoicePdfModel; add pdfbox test dep + captureGolden flag for golden-image tests |
|
| 36674 |
134 d 3 h |
amit |
/trunk/profitmandi-common/src/main/java/com/spice/profitmandi/common/ |
Add irnErrorMessage to InvoicePdfModel and show e-invoice error on PDF where IRN would appear |
|
| 36623 |
138 d 7 h |
amit |
/trunk/profitmandi-common/ |
Remove ThriftConfig dependency and Thrift client wrappers
- Removed ThriftConfig from build.gradle dependency
- Deleted entire thrift/clients/ directory (16 RPC client files)
- Removed Thrift-dependent methods from Utils.java (getRechargeDisplayStatus, getOrderStatus, getWarehouseClient, etc.)
- Deleted dead code: HelperServiceUtils.java, OrderObject.java
- Moved to profitmandi-dao: WalletHistoryModel.java, ExcelUtils.java, CustomOrder.java |
|
| 36572 |
143 d 8 h |
amit |
/trunk/ |
fix: add debit note PDF labels, HDFC UTR duplicate lock, AJAX error handlers in common.js |
|
| 36183 |
185 d 8 h |
amit |
/trunk/profitmandi-common/src/main/java/com/spice/profitmandi/common/util/ |
Credit Note PDF fixes: null guard on msAddDataCell, doc-type-aware labels (invoice/credit note/challan), conditional Order Id column, HSN code support |
|
| 36177 |
187 d 2 h |
amit |
/trunk/profitmandi-common/src/main/java/com/spice/profitmandi/common/util/ |
Fix currency format for negative amounts and use explicit symbol removal
Previous regex fix missed negative amounts like -Rs.500.50. Now uses explicit
replace("Rs.", "") for Java 8 en_IN locale with ₹ fallback for newer JDKs.
Handles both positive (Rs.17,618.00) and negative (-Rs.500.50) correctly. |
|
| 36176 |
187 d 2 h |
amit |
/trunk/profitmandi-common/src/main/java/com/spice/profitmandi/common/util/ |
Simplify invoice currency format fix for Java 8 compatibility
Use single regex replaceFirst to strip any non-numeric prefix (Rs., ₹, etc.)
instead of getCurrency().getSymbol() which may return a different symbol than
what format() produces on Java 8. |
|
| 36175 |
187 d 2 h |
amit |
/trunk/profitmandi-common/src/main/java/com/spice/profitmandi/common/util/ |
Fix leading dot in invoice currency formatting
indianCurrencyFormat.format() produces 'Rs.17,618.00' and the regex [^0-9,.]
was keeping the dot from 'Rs.' resulting in '.17,618.00'. Now strips the
currency symbol properly using getCurrency().getSymbol() with a fallback
regex to remove any remaining non-numeric prefix. |
|
| 36145 |
187 d 11 h |
amit |
/trunk/profitmandi-common/src/main/java/com/spice/profitmandi/common/util/ |
Credit Note label support: CREDIT NOTE DETAILS / CN No: for credit note documents |
|