Subversion Repositories SmartDukaan

Rev

Go to most recent revision | Show changed files | Directory listing | RSS feed

Filtering Options

Rev Age Author Path Log message Diff
37398 44 d 14 h amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/ Share one insurance invoice line builder across partner and standalone invoices

Extract InsuranceInvoiceLine next to the partner invoice builder so both callers
- OrderServiceImpl.getInvoicePdfModel(FofoOrder) and the standalone policy
invoice in InsuranceController - produce the SAC, tax split and description from
one place. Arithmetic is unchanged (verified bit-identical); policyPlan is null
for policies sold outside a device sale, so it falls back to a generic plan name
instead of printing null.

Add IciciLombardService.policyCertificatePath so the service that writes the
certificate owns the path; callers were rebuilding it and hardcoding the prod
directory, so lookups silently missed off prod.

Add selectByInvoiceNumbersAndProviderId so bulk invoice downloads fetch policies
in one query instead of one per invoice.
 
37397 44 d 14 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.
 
37396 44 d 15 h amit /trunk/profitmandi-fofo/src/main/resources/ observability: delete the log4j1 config left alongside log4j2.xml in fofo

The module logs through log4j2 (log4j2.xml). This log4j.properties is a
log4j1-era leftover that nothing reads.
 
37395 44 d 15 h amit /trunk/profitmandi-cron/src/main/java/com/smartdukaan/cron/ observability: retire the dead Nagios monitoring path, migrate balance signals to Micrometer

There is no Nagios server and the NRPE daemons have been removed from every
host, so the properties files written under /var/log/services were being
produced for nobody.

Deleted:
- CronMetricsService: zero references. Spring instantiated the @Service so its
constructor registered three meters, but nothing ever incremented them --
cron_execution_* read 0 in prometheus while cron_job_count_total (from
CronJobMonitorAspect) had recorded 1,597 executions.
- NagiosMonitoringScheduledSkeleton.

Removed the nagios properties writes from ScheduledSkeleton (-155 lines) and
KnowlarityCallMonitorScheduler (-46, including its now-purposeless
markTaskComplete helper). These recorded a per-job 0/1 status that
CronJobMonitorAspect already captures properly as success, failure and
duration metrics.

Kept the two signals that are genuinely useful: SMS gateway balance and the
ThinkWalnut recharge wallet balance now publish as Micrometer gauges via the
new BalanceGauges component, scraped from /actuator/prometheus. -1 means 'not
read yet' so a scrape before the first run is distinguishable from a real zero.

No behaviour change to any scheduled job. Compiles clean.
 
37394 44 d 15 h ranu /trunk/ total show on warehouse wise stock value on item detail  
37393 44 d 18 h amit /trunk/profitmandi-cron/src/main/java/com/smartdukaan/cron/scheduled/ Vivo IMEI activation: validate captcha solver response before submitting to Vivo

The captcha solver at 45.79.121.178 was down from 09-Jul-2026 to 25-Aug-2026
(uwsgi never restarted after a host reboot). nginx returned a 502 page for
every request. RestClient.executeJson returns the response body regardless of
HTTP status, so CaptchaService handed that HTML page to Vivo as the captcha
code and Vivo logged it as 'Found invalid captcha' - indistinguishable from an
ordinary wrong guess. The outage went unnoticed for 46 days.

CaptchaService now checks the response against the solver model's own 31-class
alphabet (^[1-9A-HK-NP-Z]{4}$) and returns null for anything else, logging the
offending payload. VivoImeiActivationService skips the IMEI when the code is
null instead of posting the garbage; it is retried on the next run.

Also drops a System.out.println of the full base64 captcha image.
 
37392 45 d 16 h vikas /trunk/profitmandi-web/src/main/java/com/spice/profitmandi/web/v2/controller/ Whatsapp Apis  
37391 45 d 17 h vikas /trunk/profitmandi-web/src/main/java/com/spice/profitmandi/web/services/ Whatsapp Apis  
37390 45 d 17 h ranu /trunk/profitmandi-fofo/src/main/java/com/spice/profitmandi/web/controller/ total show on warehouse wise stock value on item detail  
37389 45 d 18 h ranu /trunk/profitmandi-fofo/src/main/java/com/spice/profitmandi/web/controller/ total show on warehouse wise stock value on item detail  
37388 45 d 18 h vikas /trunk/ Whatsapp Apis  
37387 45 d 19 h vikas /trunk/profitmandi-web/src/main/java/com/spice/profitmandi/web/v2/controller/ Disable UPI data  
37386 45 d 21 h ranu /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/dao/service/ aging stock report put dp after stock qty  
37385 45 d 22 h vikas /trunk/profitmandi-fofo/src/main/ Added Notice and PJP access to akhil.kumar@smartdukaan.com  
37384 45 d 22 h amit /trunk/profitmandi-fofo/src/main/webapp/WEB-INF/views/ftl/ Fix My Stock brand tile styling on partner dashboard: use object-fit contain so brand wordmarks are not cropped, replace absolute-positioned ribbon hack with in-flow flex layout, and centre the brand columns instead of the hard-coded 10rem left margin  
37383 46 d 0 h vikas /trunk/profitmandi-web/src/main/java/com/spice/profitmandi/web/v2/controller/ Disable UPI data  
37382 48 d 16 h amit /trunk/profitmandi-web/src/main/java/com/spice/profitmandi/web/v2/controller/fofo/ Unbreak profitmandi-web: pass the optional fofoId r37377 added

r37377 widened PurchaseReturnOrderRepository.selectByWarehouseIdsAndDateRange
with an optional fofoId so the FOFO Sale Returns partner filter could be a
predicate rather than a post-filter. r37378 updated the FOFO caller; this web
caller was missed, so it still passed 4 arguments to a 5-argument method and
profitmandi-web has not compiled since - the web war could not be built at all.

/return/invoice has no partner picker (its only params are fromDate/toDate; the
fofoId param elsewhere in this controller belongs to searchDebitNotes), so null
is the right value: the impl only adds the fofoId predicate when non-null, which
is exactly this endpoint's pre-r37377 behaviour. No listing change.

The other three methods r37377 added - selectPendingByWarehouseIds,
selectUnreceivedSince, selectEarliestCreateTimestamp - have no web callers; the
pending-queue screen is FOFO-only, so nothing else was left half-migrated.

Verified all five modules compile.
 
37381 48 d 16 h amit /trunk/profitmandi-web/src/main/java/com/spice/profitmandi/web/ Guard empty item IN () and null billing address on the app sale-details paths

Mirrors fofo r37380 on the profitmandi-web side, where the same two defects exist.

V2FofoOrderController (live mobile-app API, not the dormant fofo V2):
- sale details built itemIds from fofoOrderItems and passed them straight to
itemRepository.selectByIds. An insurance-only sale has no fofo_order_item row,
so the list is empty and selectAllByInOrderByDesc throws "List should not be
empty". The sibling sale-search method in this same file was already guarded;
the detail method was not.
- customerBillingAddressObj was put into the response unconditionally, so an
order with customerAddressId 0 (no address is required for a plain POS sale)
returned null and the app had no name or phone to show. Fall back to the
customer's own name and mobile, matching the invoice PDF. Applied at both sites.

CustomerController: same empty-IN exposure in the customer order-history batch
fetch, where a customer whose only order is an insurance sale yields no order
items. Adds the java.util.HashMap import this file needed (it imports java.util
members individually).

Verified profitmandi-web compiles clean with these changes. Note trunk currently
does NOT build: V2FofoPurchaseReturnController:635 still calls the 4-arg
selectByWarehouseIdsAndDateRange that r37377 widened to 5 args (r37378 updated
the fofo caller but not this one). That break is untouched here and needs its
own fix before a web war can be built.
 
37380 48 d 16 h amit /trunk/profitmandi-fofo/src/main/java/com/spice/profitmandi/web/controller/ Fix /saleDetails 500 on insurance-only orders and null billing name/phone

Two defects on the sale-details screen, both from a legitimately-empty source.

1. /saleDetails 500s on an insurance-only order. A policy is not a catalog item,
so an insurance sale carries no fofo_order_item row; itemIds comes out empty and
itemRepository.selectByIds hits GenericRepositoryImpl.selectAllByInOrderByDesc,
which throws "List should not be empty" to guard against an empty IN (). The
same guard already exists two methods below at the sale-search site, so this
carries it across to the detail site. 346 orders across 95 partners are affected
- every insurance-only order ever written. The screen already loads the policies
and the view renders them, so nothing else was needed to display the sale.

2. Billing name and phone rendered as the literal
.getName(). A plain POS sale does not require an
address (only insurance does), so ~140k orders across 1038 partners carry
customerAddressId 0 and the lookup returns null. The existing guard covered the
address *string* but the object was added to the model unconditionally, and
Velocity prints an unresolvable reference verbatim. Fall back to the customer's
own name and mobile, which the invoice PDF already does via
OrderServiceImpl.createCustomAddressWithoutId - so screen and invoice now agree.
The fallback is transient and never persisted; a missing customer row is
swallowed deliberately, since this feeds a display field and throwing would turn
blank text into a 500.

Applied at both model-writing sites in this controller.
 
37379 48 d 20 h amit /trunk/profitmandi-common/ Restore insurance lines on invoice PDFs dropped by the r37066 renderer refactor

The modular doc-generation extraction moved the item table into ItemsTableSection,
which iterates only DocumentData.items() -> model.getOrderItems(). The legacy
renderer also emitted a row per CustomInsurancePolicy (PdfUtils r36674, lines
241-261); that block was lost in the extraction and nothing consumed
getInsurancePolicies() any more.

Effect: an extended-warranty policy is not a catalog item, so it has no
fofo_order_item row. Insurance sold after the device sale gets its own invoice
whose only line is the policy, so the whole table came out empty and the totals
- which SummarySection derives from the table, not from FofoOrder.totalAmount -
printed as 0.00 / 'Zero Rupees Only' (e.g. HRJND1424/94). On a combined
device+insurance invoice the policy line vanished silently and the invoice total
and GST were understated by the premium. InsuranceController's insurer document
pack, whose model carries policies and no order items at all, hit an NPE.

Fold the policies in at DocumentData.items(), the single accessor every section
reads, so the fix covers all callers at once. Column mapping mirrors the legacy
renderer: quantity 1, no discount, taxable value repeated in the Rate column.
Only the applicable tax side is populated (CGST/SGST or IGST) rather than both
as the policy model carries them, matching how real order items are built, so
ItemsTableSection's taxAmount = cgst+sgst+igst stays correct on margin-scheme
invoices. With no policies the model's own list is returned untouched.

Tests: InsuranceInvoiceRenderTest asserts on extracted PDF text (insurance-only,
intra/inter-state GST split, combined invoice, and a no-insurance control), so it
holds on any machine unlike the pixel goldens; three golden baselines added.
Verified all 14 pre-existing golden fixtures render byte-identical before and
after.

Also set java.awt.headless=true on the test JVM: the golden harness rasterizes
through PDFBox, whose font handling calls
GraphicsEnvironment.getLocalGraphicsEnvironment() and made the forked JVM attach
to the macOS window server as a Foreground app, stealing focus on every run.
Test-only property, no effect on the built war.
 

Show All