Batch » History » Version 11
Soh Keong, 11/07/2023 04:23 PM
1 | 1 | Soh Keong | {{toc}} |
---|---|---|---|
2 | |||
3 | h1. Batches |
||
4 | |||
5 | h2. PurgeRP |
||
6 | |||
7 | Program Class : ECpurgeRP |
||
8 | Run Indicator : |
||
9 | 10 | Soh Keong | > 0 - First Time run only, For earn, get from table MEMBER_ACCOUNT |
10 | 3 | Soh Keong | |
11 | 9 | Soh Keong | > 1 - Calculate Earn and Utilize RP from table TRANSACTION |
12 | 3 | Soh Keong | |
13 | 11 | Soh Keong | -> 2 - Calculate Utilized RP and Deduct from ProcessDate Balance- |
14 | 3 | Soh Keong | |
15 | 1 | Soh Keong | > 3 - Purge expired RP |
16 | 3 | Soh Keong | |
17 | 11 | Soh Keong | -> 4 - Add missing RP by period- |
18 | 7 | Soh Keong | |
19 | 11 | Soh Keong | -> -4 - Roll back (4)- |
20 | 7 | Soh Keong | |
21 | 1 | Soh Keong | > -3 - Roll back (3) |
22 | |||
23 | 11 | Soh Keong | -> -2 - Roll back (2)- |
24 | 1 | Soh Keong | |
25 | 11 | Soh Keong | > -1 - Roll back (1) |
26 | |||
27 | h2. Verification SQL |
||
28 | |||
29 | h3. First Run |
||
30 | |||
31 | <pre> |
||
32 | SELECT A.MEMBER_ID, A.RP_BALANCE, A.RP1_BALANCE, D.RP_EARN |
||
33 | FROM MEMBER_ACCOUNT A, RP_PURGE D |
||
34 | WHERE A.MEMBER_ID = D.MEMBER_ID AND |
||
35 | A.MEMBER_ID = D.MEMBER_ID AND D.PROCESS_DATE = 202312 AND |
||
36 | (A.RP_BALANCE + A.RP1_BALANCE) != D.RP_EARN |
||
37 | </pre> |
||
38 | |||
39 | h3. Transaction Table |
||
40 | |||
41 | <pre> |
||
42 | SELECT A.MEMBER_ID, A.SHOPPER_ID, |
||
43 | A.TOTAL_RP_EARNED, A.TOTAL_RP1_EARNED, |
||
44 | A.TOTAL_RP_UTILIZED, A.TOTAL_RP1_UTILIZED, |
||
45 | B.RP_EARN, B.RP_UTILIZE |
||
46 | FROM TRANSACTION_112023 A, RP_PURGE B |
||
47 | WHERE (A.SHOPPER_ID = B.MEMBER_ID OR A.MEMBER_ID = B.MEMBER_ID) AND |
||
48 | ((A.TOTAL_RP_EARNED + A.TOTAL_RP1_EARNED) != B.RP_EARN OR |
||
49 | (A.TOTAL_RP_UTILIZED + A.TOTAL_RP1_UTILIZED) != B.RP_UTILIZE) AND |
||
50 | B.PROCESS_DATE = 202312 |
||
51 | </pre> |
||
52 | |||
53 | h3. Daily Check |
||
54 | |||
55 | <pre> |
||
56 | SELECT A.MEMBER_ID |
||
57 | FROM MEMBER_ACCOUNT A |
||
58 | WHERE A.RP_BALANCE + A.RP1_BALANCE != ( |
||
59 | SELECT SUM(B.RP_TO_BE_EXPIRED) |
||
60 | FROM RP_PURGE B |
||
61 | WHERE B.MEMBER_ID = A.MEMBER_ID AND |
||
62 | B.EXPIRY_DATE > CURRENT DATE |
||
63 | ) |
||
64 | </pre> |
||
65 | 2 | Soh Keong | |
66 | |||
67 | h2. Report |
||
68 | |||
69 | Program Class : GenHKRPDaily |
||
70 | Steps : |
||
71 | # Call webservice (EcHkMemberController.getRPBalanceExpiryDateList) get HK & MC RP balance with expiry date. |
||
72 | # Write RP to file name : RPyymmdd.HK |