From 60f9aa05a0017236dc356b3f09eef27afceffabf Mon Sep 17 00:00:00 2001 From: Narayanan Madaswamy Date: Sun, 2 Aug 2026 14:34:21 +0530 Subject: [PATCH] Query 19,20,21,22 migrated - Find same case details in punching screen in case of co-applicant --- .../java/lib/models/DuplicateDetailsData.java | 15 +++ .../compile/default-compile/inputFiles.lst | 1 + .../lib/models/MessageDetailsTest.class | Bin 1217 -> 1217 bytes .../WEB-INF/app/edp/punching/initcase.jsp | 2 +- .../build/WebContent/js/ajax-dynamic-list.js | 14 +- .../build/WebContent/js/appjs/docupdate.js | 120 ------------------ .../WebContent/js/edp/punching/initiation.js | 43 +++++-- .../matrix/nimble/controller/DocAjax.class | Bin 4255 -> 0 bytes .../java/matrix/nimble/controller/Ajax.java | 10 -- .../matrix/nimble/controller/DocAjax.java | 62 --------- .../controllers/PunchingController.java | 31 +++++ .../matrix/services/edp/PunchingService.java | 46 +++++++ .../services/edp/PunchingServiceTest.java | 33 +++++ .../db/004_application_workflow_no_views.sql | 66 ++++++++++ index.sql | 4 +- latest_queries.qry | 1 - 16 files changed, 233 insertions(+), 215 deletions(-) create mode 100644 cygnus-lib/src/main/java/lib/models/DuplicateDetailsData.java delete mode 100644 cygnus-onprem-app/build/WebContent/js/appjs/docupdate.js delete mode 100644 cygnus-onprem-app/build/classes/matrix/nimble/controller/DocAjax.class delete mode 100644 cygnus-onprem-app/src/main/java/matrix/nimble/controller/DocAjax.java create mode 100644 cygnus-onprem-db/src/main/resources/db/004_application_workflow_no_views.sql diff --git a/cygnus-lib/src/main/java/lib/models/DuplicateDetailsData.java b/cygnus-lib/src/main/java/lib/models/DuplicateDetailsData.java new file mode 100644 index 0000000..f73268d --- /dev/null +++ b/cygnus-lib/src/main/java/lib/models/DuplicateDetailsData.java @@ -0,0 +1,15 @@ +package lib.models; + +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +/** Existing application details used by the case-initiation duplicate checks. */ +public record DuplicateDetailsData(List> records) { + public DuplicateDetailsData { + records = records == null ? List.of() : records.stream() + .map(record -> Collections.unmodifiableMap(new LinkedHashMap<>(record))) + .toList(); + } +} diff --git a/cygnus-lib/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/cygnus-lib/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst index cef0985..4264197 100644 --- a/cygnus-lib/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst +++ b/cygnus-lib/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -6,6 +6,7 @@ /Users/maddy/Projects/cygnus/matrix/cygnus-lib/src/main/java/lib/models/ApplicationSaveResult.java /Users/maddy/Projects/cygnus/matrix/cygnus-lib/src/main/java/lib/models/CasePunching.java /Users/maddy/Projects/cygnus/matrix/cygnus-lib/src/main/java/lib/models/CaseSaveRequest.java +/Users/maddy/Projects/cygnus/matrix/cygnus-lib/src/main/java/lib/models/DuplicateDetailsData.java /Users/maddy/Projects/cygnus/matrix/cygnus-lib/src/main/java/lib/models/MessageDetails.java /Users/maddy/Projects/cygnus/matrix/cygnus-lib/src/main/java/lib/models/Option.java /Users/maddy/Projects/cygnus/matrix/cygnus-lib/src/main/java/lib/models/PunchedRecordsData.java diff --git a/cygnus-lib/target/test-classes/lib/models/MessageDetailsTest.class b/cygnus-lib/target/test-classes/lib/models/MessageDetailsTest.class index 1d4fbe1a8115a57ed2cce05c94eaeceab2cb0cd1..491ee2764d4ed7c955acd4ba6addcad311a3dd9c 100644 GIT binary patch delta 589 zcmYjOO;6iE5Ph==*m0JC4f$$I2&B+pK9Uw%pira;3`9anWdf)NWJSOYfgtqEZ-}<1 zia$XPC2FOrTzlxP|DwO4>TH4vYwgUe=k0qlvv-lZNb=|3uipWbuxdddWFRcjgWhIw zjAK*Tl!;l08juowh!L{toU-bG7EA*J8fvR+a``YQF@(7KMX6{KDFbPVCwQvW3Ir^^kj2;3?=8;>~ja;Uz}}_N4!~x1bvi1YWV# zX~4uBTiFF*9Wco#`^n=!FJBWawfFPvm@R5+#Obf=$W^M ztoRLfA&n*`Z2b@H`4#GYEeRX*l6&sUJvrx|_s*?zYy9`0AHM)Jux>&S^6FIN4HJ>> zMA;!kp1ps4Xv2Ud5ygmlD?TdISYbkDL$e2hIO2?uUm6$-b`(;TwxT)E<2-TYU zOJ%pdZ^J=eqJSb{^vz+o9flv;;X(NM6Tzs}cWg|dVxp`jslr0HQB@n1%iJZz8hf4X znZ>yUEm4kB=5w1z zk0h3`tS)J_l)__)Rn1H9G&`Q(Z0rVY&)@g_!1Mi6I;5t*W3rD@ z;?5CwwLb1$dn6EHew>d)nzak8to<@Woh!dMN1esoV2AntI=7jxx6SqNz@e{wJY<_5 nRvhti*bgk12e~r*l|X{Elbj&MzDZ=cUgykR`4ZNcDe&YUVY*BU diff --git a/cygnus-onprem-app/build/WebContent/WEB-INF/app/edp/punching/initcase.jsp b/cygnus-onprem-app/build/WebContent/WEB-INF/app/edp/punching/initcase.jsp index 23b7961..41c0a8e 100644 --- a/cygnus-onprem-app/build/WebContent/WEB-INF/app/edp/punching/initcase.jsp +++ b/cygnus-onprem-app/build/WebContent/WEB-INF/app/edp/punching/initcase.jsp @@ -23,7 +23,7 @@ - + diff --git a/cygnus-onprem-app/build/WebContent/js/ajax-dynamic-list.js b/cygnus-onprem-app/build/WebContent/js/ajax-dynamic-list.js index 3700891..22756fe 100644 --- a/cygnus-onprem-app/build/WebContent/js/ajax-dynamic-list.js +++ b/cygnus-onprem-app/build/WebContent/js/ajax-dynamic-list.js @@ -40,7 +40,7 @@ Owner of DHTMLgoodies.com var ajax_optionDiv = false; var ajax_optionDiv_iframe = false; - var ajax_list_MSIE = false; + var ajax_list_MSIE = false; var currentListIndex = 0; @@ -81,13 +81,7 @@ Owner of DHTMLgoodies.com document.getElementsByName(ajax_list_activeInput.name + '_pincode')[0].value = inputObj.id.split("#-#")[1]; document.getElementsByName(ajax_list_activeInput.name + '_citylist')[0].value = inputObj.id.split("#-#")[2]; } - //$('#'+ajax_list_activeInput.name + '_pincode').val(inputObj.id.split("#-#")[1]); - //$('#'+ajax_list_activeInput.name + '_citylist').val(inputObj.id.split("#-#")[2]); } - - //var f1=setTimeout('ajax_list_activeInput.focus()',1); - //var f2=setTimeout('ajax_list_activeInput.value = ajax_list_activeInput.value',1); - ajax_options_hide(); } @@ -269,7 +263,7 @@ Owner of DHTMLgoodies.com function ajax_option_keyNavigation(e) { - if(!ajax_optionDiv)return; + if(!ajax_optionDiv)return; if(ajax_optionDiv.style.display=='none')return; if(e.keyCode==38){ // Up arrow @@ -302,7 +296,7 @@ Owner of DHTMLgoodies.com function autoHideList(e) { - var source = e.target; + var source = e.target; if (source.nodeType == 3) // defeat Safari bug source = source.parentNode; if(source.tagName.toLowerCase()!='input' && source.tagName.toLowerCase()!='textarea') @@ -310,4 +304,4 @@ Owner of DHTMLgoodies.com document.getElementsByName(ajax_list_activeInput.name + '_hidden')[0].value = ''; ajax_options_hide(); } - } + } diff --git a/cygnus-onprem-app/build/WebContent/js/appjs/docupdate.js b/cygnus-onprem-app/build/WebContent/js/appjs/docupdate.js deleted file mode 100644 index 5bc1023..0000000 --- a/cygnus-onprem-app/build/WebContent/js/appjs/docupdate.js +++ /dev/null @@ -1,120 +0,0 @@ -var currow=null; -function ValidateEntry(flag) -{ - validate(document.getElementById("doctype"),flag,''); - validate(document.getElementById("docholdername"),flag,'SplInstruction'); - if(validateHidden && $("#serviceprovider_hidden").val()=='') - { - $("#serviceprovider").val(''); - } - validate(document.getElementById("serviceprovider"),flag,'SplInstruction'); - var temp=$("#uniqueno").attr("onblur").replace( "validate(","" ).replace( ")","").replace(/'/g,"").split(","); - validate(document.getElementById("uniqueno"),flag,temp[2]); - var temp=$("#yearmonth").attr("onblur").replace( "validate(","" ).replace( ")","").replace(/'/g,"").split(","); - validate(document.getElementById("yearmonth"),temp[1],temp[2]); - validate(document.getElementById("city"),flag,''); -} -function AddNewDoc() -{ - ValidateEntry('t'); - if(checkForm()) - { - UpdateDoc(); - } - else - { - CallMessage('VLFRM:error:There are one or more error(s) in form. Please correct them and try again.',3000,200,300); - } -} -function AddDocRow(data,did,vname) -{ - var tbody = $('#doclist'); - var totdocs= $('#doclist tr').length; - var row = null; - if(data.doc_id=='0') - { - row = $('').attr("did",did).attr("onclick","GetRowData(this)").appendTo(tbody); - } - else - { - if(currow != null) - { - row = $("#doclist tr:eq("+currow+")"); - $(row).html(''); - totdocs = currow; - } - } - $('').text(totdocs+1).appendTo(row); - $('').text(data.docholdername).appendTo(row); - $('').attr("dtype",data.doctype).text($("#doctype option[value='"+data.doctype+"']").text()).appendTo(row); - $('').attr("id",data.serviceprovider_hidden).text(data.serviceprovider).appendTo(row); - $('').attr("title",data.city).text(data.uniqueno).appendTo(row); - $('').text(data.yearmonth).appendTo(row); - $('').attr("id",data.vendor_id).text((vname.length > 0 ? vname:$("#vendor_id option[value='"+data.vendor_id+"']").text())).appendTo(row); - $('').text("").appendTo(row); -} -function GetRowData(drow) -{ - currow = $(drow).index(); - $("#doctype").val($(drow).find('td').eq(2).attr("dtype")); - $("#doctype").trigger("change"); - $("#docholdername").val($(drow).find('td').eq(1).text().trim()); - $("#serviceprovider").val($(drow).find('td').eq(3).text().trim()); - $("#serviceprovider_hidden").val($(drow).find('td').eq(3).attr("id")); - $("#uniqueno").val($(drow).find('td').eq(4).text().trim()); - $("#yearmonth").val($(drow).find('td').eq(5).text().trim()); - $("#city").val($(drow).find('td').eq(4).attr("title").trim()); - //$("#vendor_id").val($(drow).find('td').eq(6).attr("id")); - ValidateEntry('t'); - $("#doc_id").val($(drow).attr("did")); -} -function resetDocForm() -{ - validateHidden = false; - document.getElementById('docdetails').reset(); - $('#city').val("-1"); - $('#vendor_id').empty().append(''); - currow = null; -} -function UpdateDoc() -{ - var jsonString = JSON.stringify($('#docdetails').serializeObject()).substring(); - jsonString = '{'+jsonString.substring(1, jsonString.length-1)+',"uuid":"'+$("#uuid").val()+'","usid":"'+$("#usid").val()+'"}'; - $.ajax({ - url:"doc/updcasedocs", - type:"POST", - contentType: "application/json; charset=utf-8", - data: jsonString, //Stringified Json Object - async: false, //Cross-domain requests and dataType: "jsonp" requests do not support synchronous operation - cache: false, //This will force requested pages not to be cached by the browser - processData:false, //To avoid making query String instead of JSON - success: function(resposeJsonObject){ - var dataArray = jQuery.parseJSON(resposeJsonObject); - if(dataArray.status.search("error") > -1) - { - CallMessage(dataArray.result,3000,200,300); - } - else - { - AddDocRow(dataArray.result,dataArray.did,''); - resetDocForm(); - } - } - }); -} -$.fn.serializeObject = function() -{ - var o = {}; - var a = this.serializeArray(); - $.each(a, function() { - if (o[this.name] !== undefined) { - if (!o[this.name].push) { - o[this.name] = [o[this.name]]; - } - o[this.name].push(this.value || ''); - } else { - o[this.name] = this.value || ''; - } - }); - return o; -}; \ No newline at end of file diff --git a/cygnus-onprem-app/build/WebContent/js/edp/punching/initiation.js b/cygnus-onprem-app/build/WebContent/js/edp/punching/initiation.js index c8a4e6a..69c9494 100644 --- a/cygnus-onprem-app/build/WebContent/js/edp/punching/initiation.js +++ b/cygnus-onprem-app/build/WebContent/js/edp/punching/initiation.js @@ -20,6 +20,13 @@ var FocusAfter="customername"; var CHECKBOX_FIELDS=new Set(["rv","sradd","rtv","ov","soadd","otv","rco","pv","rcp","ocp","spadd","refv","docv"]); var DUPLICATE_OPERATION={R:19,O:20,P:21,A:22}; var PUNCHED_RECORDS_URL="punchedrecs"; +var DUPLICATE_DETAILS_URL="findsdet"; +var DUPLICATE_FIELDS={ + 19:["raddr1","raddr2","raddr3","rlandmark","rcolony","colr","rcity","rpincode","rphone"], + 20:["companyname","oaddr1","oaddr2","oaddr3","olandmark","ocolony","colo","ocity","opincode","ophone","extension"], + 21:["paddr1","paddr2","paddr3","plandmark","pcolony","colp","pcity","ppincode"], + 22:["bankcode","bank_branch_id","product","loanamount","apptype","contactperson","specialinst"] +}; function InitPage() { @@ -98,10 +105,6 @@ function AddNewRecord() } FillDetails(recpos); } -function AfterResponse(response,oprID) -{ - if(oprID>=19 && oprID<=22) handleDuplicateDetailsResponse(response,oprID); -} async function loadPunchedRecords(portfolioId,documentCaseId) { try @@ -126,16 +129,37 @@ async function loadPunchedRecords(portfolioId,documentCaseId) } finally{$("#ajaxmsg").remove();} } -function handleDuplicateDetailsResponse(response,oprID) +function handleDuplicateDetailsResponse(records,oprID) { - var rows=response.split(RowDelim).slice(0,-1); if($("#portfolio_id").val()==81) { - for(var index=0;indexlR$WEfCAY-sR;>52o0!ovO7s8*~~06 zyMc({tM&cXqG&5ttteIn9|4NR`l`0p_p?6#0e|=NvDW&%vrDp@tXA^*O2e zw2{af_E@5KWWr461!}igww2!|pfoiP2?RQwj9Cu_bs+>%D{w=%Wt)2oQzNE3Xb@UJ z?{?BgcF1roIW7qU`Ekn=h<3k{9UZh{e=cL>&913jznOO24A; z$g9L#Lle!2#%RVGfx3qNmhA_&w{$mXh)H>p^1HcdL+AFB+oiNcpyoJ*Z357+o}=gq zY4nB=HewUQ?B%i+lfJRsxNGTlsLZgEOhZzjeujUEo}NS|qhgD|tL7<7F^%idfx3F! zgB>ci3*1?G03@?k-ZH(!?yNInWIMBl=Y_BnodTL%KFDNdepE52XpSEmsaWkiEI}7` ztJo#5blxb&Fob)thYaNkbaqoYcJbJk$DkxBXTK!U@LHY$9)-hJM()%T!d~!lA@pN_4(FXBu>vH8V)i3 zJ5s4gs<%_a>lv;6eW@LTUB&TXfzdsC2fF$PBYXA^_D1BLBwnhFIg6N_-1 zpUIiA$cSN2(p6tF?qoBjYxA(hBA)3^TWK@rI@1<~v4U;MRCZ#K8Pjm5SZc>(Dhz>@ z3v1ZUf+b<3L+KDQV5C*Q()5nLGJz#h>hS=^WHBCJKtgH0c}T;AKs;^bXMEGAO*`Yb zv51k$n3)mE{ElNcNBph5NK<2@1kHvp1)CJJ3UUb{$|=5vzUWYteCp7UV|kMlYH*np zjg2u4%nP-|r-o?;GbVT1r(s55#R47=k6X0R)^MDwV~vd(PB4$TdY*d?Z|0#TvYdS@ zFQWwz8s5$`E+-#ic3q2$hIg`9%*95-yJ@JTN5gwLQRIh#*6@DmfhT((^gU?S@L_>f zyaagQ7Gw+4Ab%}aw#qF(%Ikurm9l25hKE@fE6n%RKF+XFZGq+f)MrWv0jYOEA6+3N zazOnrF$G2qD{Hd6effVBu++|71v~BEwHm%c=29&!t@SvEG1;6C;R3$S>PVXUTqkXM z-ma`MMzyAc%|lY-n<0D)vkdVrGoK#ky|%Aly3C8Frae_kZOK`w=G8BY?#@+x-W z>xISO+XA;9k9vF&6g=JzULh^*;Qf)YG8{{Qt08ViKX>^a|O$hVPO!D!TqK zn$+-pX733NKNJX+$$g9;h45pEQAdm}*X{A>X8nZc*u_I5pGXTUK?j3)Bqwig*0P(b z_{({Tz~U|6Tou)vYc>Dk%9}i;LDn8gTaY1jczgqV+Z>~Sg)4TQRp{o4q(jQ{!}2oE>mW`0d9#|o_E?5p{&O7yVo0D*sS zUxF)VM9&r6GJFxY?Om(CM!#bg4SJ*AEI(`YxcnsaR{2?1{BWi{8PHpkL4ETTba3I; zOW2mIRW_(+u{s_OELYp)x^|^)z8`42jFf@{52|9h8V+22?By5Y`hAztU4y3)okgEM zIE$gv(DZ|65!7FoRI5#ki2jCT@CqIn4hJt`c5Lt=q72bcu2dHqiDk1vEe8mb1PWht$gMv@^iWL-m(ic@w zP}N`k5nr)_m{0qn3LdJj{fw_z!OmxW(dWwv`+_ejOSmFw>QjggE8*b4aG-+WzJcLj zSRELy4c89z=wD1~S8#4vf8rv(nyd@g1!nQJaNRO75}U<04utDwaq%?P`0QUH`%>@} z_tT$dvsQM#$3_N8JB!viwTc9v)PF!7x$+sgVBNI^VeLGRYd{`UoWvb$m-B?L;CLn4 zd8Rk>IPd0q;_QjKc_5!&B`c#LA@Y$EBE7aJ$;rnuZa5x;=Vvh657jjT2moZL{SkLxF(fSfxU-4X=HvWkSHTbh%HFfs>!tpZhQLLPQ{SSg jsonMap=new HashMap(); - String [] splitted = (jsonString.replace(":\"\"", ":\"null\"").replace("\",\"","!R0@W@0L!").replace("\":\"","!C@~@L!").replace("{\"", "").replace("\"}", "")).split("!R0@W@0L!"); - String query=""; - String opron = GlobalClass.DateTime("yyyy/MM/dd",new java.util.Date()); - for(int indx=0;indx < splitted.length; indx++) - { - jsonMap.put(splitted[indx].split("!C@~@L!")[0], splitted[indx].split("!C@~@L!")[1]); - } - String opr = jsonMap.get("doc_id").toString().equals("0") ? "ADD DOC":"UPDATE DOC"; - if(jsonMap.get("doc_id").toString().equals("0")) - { - query = "INSERT INTO case_documents(uuid, doctype, bank_id, docholdername, serviceprovider,uniqueno, yearmonth,"; - query += "city, docvendor, addedby, addedon) values (''"+jsonMap.get("uuid")+"'',"+jsonMap.get("doctype")+","; - query += jsonMap.get("serviceprovider_hidden")+",''"+jsonMap.get("docholdername")+"'',''"+jsonMap.get("serviceprovider")+"'',"; - query += "''"+jsonMap.get("uniqueno")+"'',''"+jsonMap.get("yearmonth")+"'',''"+jsonMap.get("city")+"'',"; - query += jsonMap.get("vendor_id")+","+jsonMap.get("usid")+",''"+opron+"'')"; - } - else - { - query = "update case_documents set doctype=''"+jsonMap.get("doctype")+"'',bank_id="+jsonMap.get("serviceprovider_hidden")+","; - query += "docholdername=''"+jsonMap.get("docholdername")+"'',serviceprovider=''"+jsonMap.get("serviceprovider")+"'',"; - query += "uniqueno=''"+jsonMap.get("uniqueno")+"'',yearmonth=''"+jsonMap.get("yearmonth")+"'',"; - query += "city=''"+jsonMap.get("city")+"'',docvendor=''"+jsonMap.get("vendor_id")+"'',"; - query += "addedby="+jsonMap.get("usid")+",addedon=''"+jsonMap.get("opr")+"'' where doc_id="+jsonMap.get("doc_id"); - } - qparams = new String[]{query,jsonMap.get("usid").toString(),opr,opron}; - String response="failed"; - DBFunctions DBF=new DBFunctions("D001"); - DBF.setProcessFlag(true); - DBF.FetchRunQuery(354, qparams); - if(DBF.isProcessFlag()) - { - response="{\"status\":\"success\",\"did\":\""+DBF.getProcResult()+"\",\"result\":"+jsonString+"}"; - } - else - { - response="{\"status\":\"success\",\"did\":\""+jsonMap.get("doc_id")+"\",\"result\":\""+DBF.getErrMsg()+"\"}"; - } - return response; - } -} diff --git a/cygnus-onprem-app/src/main/java/matrix/nimble/edp/punching/controllers/PunchingController.java b/cygnus-onprem-app/src/main/java/matrix/nimble/edp/punching/controllers/PunchingController.java index f404194..13eb8aa 100644 --- a/cygnus-onprem-app/src/main/java/matrix/nimble/edp/punching/controllers/PunchingController.java +++ b/cygnus-onprem-app/src/main/java/matrix/nimble/edp/punching/controllers/PunchingController.java @@ -26,6 +26,7 @@ import lib.models.ApplicationSaveResult; import lib.models.CaseSaveRequest; import lib.models.MessageDetails; import lib.models.PunchedRecordsData; +import lib.models.DuplicateDetailsData; import lib.constants.ApplicationMessage; import matrix.nimble.security.PayloadCryptoService; import lib.exceptions.ApplicationException; @@ -40,6 +41,7 @@ public class PunchingController extends AbstractAuthenticatedController { private static final String INIT_VIEW_ROUTE = "initview"; private static final String CASE_ADD_ROUTE = "caseadd"; private static final String CASE_EDIT_ROUTE = "caseedit"; + private static final String DUPLICATE_DETAILS_ROUTE = "findsdet"; private final PunchingService punchingService; private final PayloadCryptoService cryptoService; @@ -90,6 +92,35 @@ public class PunchingController extends AbstractAuthenticatedController { } } + @RequestMapping(value = DUPLICATE_DETAILS_ROUTE, method = RequestMethod.GET, + produces = MediaType.APPLICATION_JSON_VALUE) + @ResponseBody + public ResponseEntity> findDuplicateDetails( + @RequestParam("applicationNumber") String applicationNumber, + @RequestParam("portfolioId") Short portfolioId, + @RequestParam("queryId") Integer queryId, + HttpSession httpSession) { + ApiAuthorization authorization = authorizeApiPage(INIT_VIEW_ROUTE, httpSession); + if (!authorization.isGranted()) { + return ResponseEntity.status(authorization.error().getHttpStatus()) + .body(ApiResponse.failure(authorization.error())); + } + try { + DuplicateDetailsData data = punchingService.findDuplicateDetails( + applicationNumber, portfolioId, queryId, authorization.session()); + return ResponseEntity.ok(ApiResponse.success( + data, new MessageDetails(ApplicationMessage.APPLICATIONS_LOADED))); + } catch (ApplicationException exception) { + LOGGER.log(Level.WARNING, "Duplicate detail search was rejected", exception); + MessageDetails details = new MessageDetails(exception.getApplicationMessage()); + return ResponseEntity.status(details.getHttpStatus()).body(ApiResponse.failure(details)); + } catch (RuntimeException exception) { + LOGGER.log(Level.SEVERE, "Unable to search duplicate details", exception); + MessageDetails details = new MessageDetails(ApplicationMessage.INTERNAL_SERVER_ERROR); + return ResponseEntity.status(details.getHttpStatus()).body(ApiResponse.failure(details)); + } + } + @RequestMapping(value = "application-save", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) diff --git a/cygnus-onprem-app/src/main/java/matrix/services/edp/PunchingService.java b/cygnus-onprem-app/src/main/java/matrix/services/edp/PunchingService.java index 12b5024..6e05fd4 100644 --- a/cygnus-onprem-app/src/main/java/matrix/services/edp/PunchingService.java +++ b/cygnus-onprem-app/src/main/java/matrix/services/edp/PunchingService.java @@ -12,6 +12,8 @@ import java.util.List; import java.util.Map; import java.util.regex.Pattern; import java.sql.SQLException; +import java.sql.Date; +import java.time.LocalDate; import org.springframework.stereotype.Service; import org.springframework.beans.factory.annotation.Autowired; @@ -22,6 +24,7 @@ import lib.models.ApplicationSaveResult; import lib.models.MessageDetails; import lib.models.Option; import lib.models.PunchedRecordsData; +import lib.models.DuplicateDetailsData; import lib.models.UserSession; import lib.constants.ApplicationMessage; import lib.exceptions.ApplicationException; @@ -42,6 +45,10 @@ public class PunchingService { private static final Short ACTIVE = Short.valueOf((short) 1); private static final int PUNCHED_RECORDS_QUERY = 24; + private static final int RESIDENCE_DETAILS_QUERY = 19; + private static final int OFFICE_DETAILS_QUERY = 20; + private static final int PROPERTY_DETAILS_QUERY = 21; + private static final int CO_APPLICANT_DETAILS_QUERY = 22; private static final Pattern DYNAMIC_FIELD = Pattern.compile( "(?:field(?:[1-9]|1[0-2]|150(?:_2)?)|dtfield1)", Pattern.CASE_INSENSITIVE); private static final SqlArrayParameter GENERAL_OPTION_TYPES = @@ -117,6 +124,45 @@ public class PunchingService { } } + public DuplicateDetailsData findDuplicateDetails( + String applicationNumber, Short portfolioId, Integer queryId, UserSession session) { + if (dbExecutor == null) { + throw new IllegalStateException("Duplicate-detail dependencies are not configured"); + } + if (blank(applicationNumber) || portfolioId == null || portfolioId <= 0 + || queryId == null || session == null) { + throw new ApplicationException( + ApplicationMessage.APPLICATION_VALIDATION_FAILED, "Duplicate search details are invalid"); + } + + Date receivedDate = Date.valueOf(LocalDate.now()); + Object[] parameters = switch (queryId) { + case RESIDENCE_DETAILS_QUERY, OFFICE_DETAILS_QUERY, CO_APPLICANT_DETAILS_QUERY -> + new Object[] {applicationNumber.trim(), portfolioId, receivedDate, + session.getCompanyId(), session.getBranchId()}; + case PROPERTY_DETAILS_QUERY -> + new Object[] {applicationNumber.trim(), portfolioId, + session.getCompanyId(), session.getBranchId(), receivedDate}; + default -> throw new ApplicationException( + ApplicationMessage.APPLICATION_VALIDATION_FAILED, "Unsupported duplicate search type"); + }; + + try { + List> records = dbExecutor.query(queryId, parameters).stream() + .map(row -> { + Map record = new LinkedHashMap<>(); + row.asMap().forEach((name, value) -> record.put(name, value == null ? "" : value)); + return record; + }) + .toList(); + return new DuplicateDetailsData(records); + } catch (ApplicationException exception) { + throw exception; + } catch (RuntimeException exception) { + throw databaseFailure(exception); + } + } + private Map toPunchedRecord(RowView row) { Map record = new LinkedHashMap<>(); row.asMap().forEach((name, value) -> { diff --git a/cygnus-onprem-app/src/test/java/matrix/services/edp/PunchingServiceTest.java b/cygnus-onprem-app/src/test/java/matrix/services/edp/PunchingServiceTest.java index 9347074..5749123 100644 --- a/cygnus-onprem-app/src/test/java/matrix/services/edp/PunchingServiceTest.java +++ b/cygnus-onprem-app/src/test/java/matrix/services/edp/PunchingServiceTest.java @@ -14,6 +14,9 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.concurrent.atomic.AtomicReference; +import java.sql.Date; +import java.time.LocalDate; +import lib.exceptions.ApplicationException; import lib.models.PunchedRecordsData; import lib.models.UserSession; import lib.models.Option; @@ -22,6 +25,36 @@ import org.junit.jupiter.api.Test; class PunchingServiceTest { + @Test + void loadsDuplicateDetailsWithAllowlistedQueryAndSessionScope() { + AtomicReference query = new AtomicReference<>(); + AtomicReference parameters = new AtomicReference<>(); + RowView row = row(new LinkedHashMap<>(Map.of("paddr1", "House 1", "pcolony", 42))); + CygnusDbExecutor executor = (CygnusDbExecutor) Proxy.newProxyInstance( + getClass().getClassLoader(), new Class[] {CygnusDbExecutor.class}, + (proxy, method, args) -> { + if (method.getName().equals("query") && args.length == 2) { + query.set((Integer) args[0]); + parameters.set(((Object[]) args[1]).clone()); + return List.of(row); + } + throw new UnsupportedOperationException(method.toString()); + }); + PunchingService service = new PunchingService( + new CommonService(), executor, new ObjectMapper()); + UserSession session = UserSession.builder() + .companyId((short) 3).branchId((short) 7).build(); + + var result = service.findDuplicateDetails(" APP-1 ", (short) 38, 21, session); + + assertEquals(21, query.get()); + assertArrayEquals(new Object[] {"APP-1", (short) 38, (short) 3, (short) 7, + Date.valueOf(LocalDate.now())}, parameters.get()); + assertEquals("House 1", result.records().getFirst().get("paddr1")); + assertThrows(ApplicationException.class, + () -> service.findDuplicateDetails("APP-1", (short) 38, 23, session)); + } + @Test void loadsPunchedRecordsAsFormShapedObjectsAndMergesDynamicFields() { AtomicReference parameters = new AtomicReference<>(); diff --git a/cygnus-onprem-db/src/main/resources/db/004_application_workflow_no_views.sql b/cygnus-onprem-db/src/main/resources/db/004_application_workflow_no_views.sql new file mode 100644 index 0000000..fe3c103 --- /dev/null +++ b/cygnus-onprem-db/src/main/resources/db/004_application_workflow_no_views.sql @@ -0,0 +1,66 @@ +-- Remove view/materialized-view dependencies from the application-save workflow. +-- Each replacement expands the original view predicate against its base tables. +DO $migration$ +DECLARE + change record; + definition text; +BEGIN + FOR change IN + SELECT * + FROM (VALUES + ( + 'public.autocut(integer,text,integer)'::regprocedure, + 'FROM main_mainopr WHERE uuid = unqueid', + 'FROM main m JOIN main_operations mo ON mo.uuid::text = m.uuid::text WHERE m.isdeleted = 0 AND m.uuid = unqueid' + ), + ( + 'public.autocut(integer,text,integer)'::regprocedure, + 'SELECT rv,ov,pv,rcolony,ocolony,pcolony,company_id,branch_id,oprsendon,allocationon,earlier,negative', + 'SELECT m.rv,m.ov,m.pv,m.rcolony,m.ocolony,m.pcolony,m.company_id,m.branch_id,mo.oprsendon,mo.allocationon,mo.earlier,mo.negative' + ), + ( + 'public.dedupebyuuid(text,integer,text,text,integer)'::regprocedure, + 'from cutoff_operations where uuid=uniqueid', + 'from (select c.*, mo.cutoffon from main c join main_operations mo on mo.uuid::text = c.uuid::text join portfolio p on p.portfolio_id = c.portfolio_id join company co on co.company_id = c.company_id where c.isdeleted = 0 and mo.sdone = 0) source_case where uuid=uniqueid' + ), + ( + 'public.smsentry(text,integer,text,integer,integer,integer,integer)'::regprocedure, + 'from cutoff_operations where uuid=uniqueid', + 'from (select c.*, p.portname from main c join main_operations mo on mo.uuid::text = c.uuid::text join portfolio p on p.portfolio_id = c.portfolio_id join company co on co.company_id = c.company_id where c.isdeleted = 0 and mo.sdone = 0) source_case where uuid=uniqueid' + ), + ( + 'public.checkaddress(text,text,integer,text,integer,text,date,integer,timestamp without time zone,integer)'::regprocedure, + 'from mview_main_mainopr where', + 'from (select m.*, mo.cutoffon from main m join main_operations mo on mo.uuid::text = m.uuid::text where m.isdeleted = 0 and m.receivedate > (current_date - interval ''6 months'')) prior_cases where' + ), + ( + 'public.checkphonenos(text,text,text,integer,text,date,timestamp without time zone,integer)'::regprocedure, + 'from mview_main_mainopr where', + 'from (select m.*, mo.cutoffon from main m join main_operations mo on mo.uuid::text = m.uuid::text where m.isdeleted = 0 and m.receivedate > (current_date - interval ''6 months'')) prior_cases where' + ), + ( + 'public.checknamedob(text,text,integer,text,date)'::regprocedure, + 'from mview_main_namedob_ear where', + 'from (select m.* from main m where m.dob::text <> '''' and m.dob is not null and m.isdeleted = 0 and m.receivedate > (current_date - interval ''6 months'')) prior_namedob_cases where' + ), + ( + 'public.sendtooperation(character,integer,character,integer,integer,integer,integer)'::regprocedure, + 'from main_mainopr m where', + 'from (select mn.*, mo.batch, mo.rvdone, mo.rvdoneon, mo.rvdoneby, mo.ovdone, mo.ovdoneon, mo.ovdoneby, mo.tvrdone, mo.tvrdoneon, mo.tvrdoneby, mo.pvdone, mo.pvdoneon, mo.pvdoneby, mo.docdone, mo.docdoneon, mo.docdoneby from main mn join main_operations mo on mo.uuid::text = mn.uuid::text where mn.isdeleted = 0) m where' + ) + ) AS replacements(function_oid, old_sql, new_sql) + LOOP + definition := pg_get_functiondef(change.function_oid); + + -- Makes the migration safe to re-run after a successful deployment. + IF position(change.old_sql IN definition) = 0 THEN + IF position(change.new_sql IN definition) = 0 THEN + RAISE EXCEPTION 'Expected SQL was not found in %', change.function_oid; + END IF; + CONTINUE; + END IF; + + EXECUTE replace(definition, change.old_sql, change.new_sql); + END LOOP; +END +$migration$; diff --git a/index.sql b/index.sql index f98b065..55cd518 100644 --- a/index.sql +++ b/index.sql @@ -1,2 +1,4 @@ CREATE INDEX idx_portfolio_branch_active_name -ON portfolio (branch_id, isactive, portname); \ No newline at end of file +ON portfolio (branch_id, isactive, portname); + +CREATE INDEX idx_main_applno_portfolio_company_branch_date_deleted ON main (applno, portfolio_id, company_id, branch_id, receivedate, isdeleted); \ No newline at end of file diff --git a/latest_queries.qry b/latest_queries.qry index 5d0be44..390434f 100644 --- a/latest_queries.qry +++ b/latest_queries.qry @@ -384,7 +384,6 @@ Query350!C0L!insert!C0L!insert into main (portfolio_id,mvcode,bank_branch_id,app Query351!C0L!select!C0L!SELECT uid, doctype, docpath FROM tagged_docs where uuid='val0' and vistype='val1' and isdeleted=0 Query352!C0L!procedure!C0L!select tagdocs('val0','val1','val2','val3',val4,'val5') Query353!C0L!procedure!C0L!select updateemployee('val0',val1,'val2','val3') -Query354!C0L!procedure!C0L!select updatecasedocs('val0',val1,'val2','val3') Query355!C0L!procedure!C0L!select portwisephotomis('val0', 'val1', val2, val3, val4, 'val5', 'val6', 'val7', 'val8') Query400!C0L!insert!C0L!Insert into main (portfolio_id,mvcode,bank_branch_id,applno,product,loanamount,customername,apptype,category,dob,contactperson,mobileno,raddr1,raddr2,raddr3,rlandmark,Rcolony,rcity,rpincode,rphone,companyname,oaddr1,oaddr2,oaddr3,olandmark,Ocolony,ocity,opincode,department,designation,ophone,extension,paddr1,paddr2,paddr3,plandmark,Pcolony,pcity,ppincode,refname1,refaddress1,refcontactno1,refname2,refaddress2,refcontactno2,rv,rtv,ov,otv,pv,refv,docv,rco,rcp,ocp,specialinst,sradd,soadd,spadd,fathername,field1,field2,field3,field4,field5,field6,dtfield1,bankcode,company_id,branch_id,addedby,addedon,receivedate,uuid) values (,''xmvcodex'',80,''val3'',(case when ''val4''=''LAP'' then ''LAP'' when ''val4''=''Home Loan'' then ''Home Loan'' else ''-1'' end),'''',''val1'',''Applicant'',''-1'',NULL,NULL,''val11'',(case when ''val7''=''Residence verification'' then ''RadDrXS-val9 -ERadDrX'' else ''RadDrXS- -ERadDrX'' end),''RadDrX1'',''RadDrX2'',NULL,0,''-1'',NULL,(case when ''val7''=''Residence verification'' then ''val10'' else '''' end),'''',(case when ''val7''=''Office verification'' then ''OadDrXS-val9-EOadDrX'' else ''OadDrXS--EOadDrX'' end),''OadDrX1'',''OadDrX2'',NULL,0,''-1'',NULL,'''',''val13'',(case when ''val7''=''Office verification'' then ''val10'' else '''' end),'''',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,(case when ''val7''=''Residence verification'' then 1 else 0 end),0,(case when ''val7''=''Office verification'' then 1 else 0 end),0,0,0,0,0,0,0,'''',0,0,0,NULL,'''',NULL,NULL,NULL,NULL,NULL,''val5'',NULL,val12,val13,0,''val14'',''val50'','''') Query401!C0L!select!C0L!select uuid,product,maincompany_o,bkbranchname,to_char(receivedate,'DD/MM/YYYY') as recdate,applno,upper(customername) cname,bank_branch_id,'For YES BANK Ltd Internal Use Only','VENDOR PRE-SIGN UP CHECK REPORT',' ',' ','Initiated Date ',receivedate_o,' ','Completed Date ',sdoneon_o,'1. GENERAL INFORMATION','Vendor to be empanelled ',': '||upper(customername_o),'Product ',': '||upper(product_o),'Nature of business ',':'||upper(compprof_o),'Off.Address with pin code',': '||upper(oaddr_o),'Phone No/Mobile',': '||ophone_o,'Email ID','define','Type Of Establishment',': '||upper(busitype_o),'Name of Proprietor/Director/Partners',': '||upper(field30_1_o),' ',' ','1. OFFICE VERIFICATION','Date and Time of visit',coalesce(': '||visitdate_o||' '||visittime_o,': '),'Contacted Person',coalesce(': '||upper(metperson_o),':'),'Area of office',coalesce(': '||upper(field30_4_o),':'),'Infrastructure Details ',' ','1. Furniture',coalesce(': '||upper(stockdet_o),''),'2.Telephones',coalesce(': '||field30_14_o,':'),'3.Fax',coalesce(': '||field30_15_o,':'),'4.Computer',coalesce(': '||field30_10_o,':'),'5.AC',coalesce(': '||field30_12_o,':'),'6.Internet',': ','7.Cabin/Cubicles','define',' ','Business activity',': '||upper(busiact_o),'Office name board',': '||upper(bizboard_o),'Manpower',': '||totemp_o,'No of years in business',': '||coalesce(yrstot_o,'0')||' Years and '||coalesce(mnthtot_o,'0')||' Month','Office',': '||upper(ownership_o),'Neighbour check and Confirmation : '||upper(fieldtext_1_o),' ','Office Locality :','1)',(case when upper(locality_O)='POSH' then 'images/tick.gif' else 'images/untick.jpg' end),'Posh',(case when upper(locality_O)='UPPER CLASS' then 'images/tick.gif' else 'images/untick.jpg' end),'Upper Class',(case when upper(locality_O)='MIDDLE CLASS' then 'images/tick.gif' else 'images/untick.jpg' end),'Middle Class',(case when upper(locality_O)='LOWER MIDDLE CLASS' then 'images/tick.gif' else 'images/untick.jpg' end),'Lower Middle Class',(case when upper(locality_O)='SLUM' then 'images/tick.gif' else 'images/untick.jpg' end),'Slum',' ','2)',(case when upper(locality_O)='COMMERCIAL' then 'images/tick.gif' else 'images/untick.jpg' end),'Commercial',(case when upper(locality_O)='RESIDENTIAL' then 'images/tick.gif' else 'images/untick.jpg' end),'Residential Area',(case when upper(locality_O)='SMALL SCALE INDUSTRIAL AREA' then 'images/tick.gif' else 'images/untick.jpg' end),'Small/Medium','img','Shops',(case when upper(locality_O)='SHOP/OFFICE COMPLEX' then 'images/tick.gif' else 'images/untick.jpg' end),'Market Area',(case when upper(locality_O)='OTHERS' then 'images/tick.gif' else 'images/untick.jpg' end),'Other',' ','Work Experience & Business Detailsof The Vendor','Previous Experience',': '||upper(prevjobdet_o),'Profile /Goodwill',': '||upper(busiact_o),'Fraud History',': '||(case when upper(redalert_o)='YES' then upper(alertrem_o) else '' end),'Prior terminations',': '||'NA','Police Verification',': '||'NA',' ','Additional Information','PAN details of the Vendor',': '||panno_o,'Bank Account details',': '||upper(bank_o),' ','Reference Check Details : NA',' ','Reference Check Details : NA',' ','Risk Alert and Other details :',(case when upper(redalert_o)='YES' then upper(alertrem_o) else 'NA' end),' ','Final Remarks of office verification :',upper(remarks_o),'3.DETAILS AND RESIDENCE VERIFICATION(Proprietor/Partner/Director as applicable)','Name of the Proprietor/Partnor/Director :',upper(spsname_r),'DOB & Qualifications ',': '||upper(dob_r)||' and '||upper(field30_11_r),'DOB & Qualifications ','define','Residence Address With Pin Code ',': '||upper(raddr_r),'Name Board ',': '||upper(nameplate_r),'Date and Time of visit',': '||visitdate_r||' : '||visittime_r,'Person contacted during visit',': '||upper(metperson_r)||'('||upper(metrela_r)||')','Ownership Status',upper(rowner_r),'Marital status & Family Structure',': '||upper(maritial_r)||'( Total family member-'||totmem_r,'Years in corrent residence',': '||upper(yrsadd_r)||' Years and '||coalesce(upper(mnthadd_r),'0')||' Month ','Years in city',': '||upper(yrscity_r)||' Years and '||coalesce(upper(mnthcity_r),'0')||' Month ',' ','Observations',' ','Type of Residence','Locality of Residence',' ',(case when upper(restype_r)='INDEPENDENT HOUSE' then 'images/tick.gif' else 'images/untick.jpg' end),'Independent House',(case when upper(locality_r)='POSH' then 'images/tick.gif' else 'images/untick.jpg' end),'Posh',(case when upper(locality_r)='HOUSING COMPLEX' then 'images/tick.gif' else 'images/untick.jpg' end),'Housing Complex',(case when upper(restype_r)='FLAT' then 'images/tick.gif' else 'images/untick.jpg' end),'Flat',(case when upper(LOCALITY_r)='UPPER MIDDLE CLASS' then 'images/tick.gif' else 'images/untick.jpg' end),'Upper Middle Class',(case when upper(locality_r)='SMALL/MEDIUM SHOPS' then 'images/tick.gif' else 'images/untick.jpg' end),'Small/Medium Shops',(case when upper(restype_r)='SLUM' then 'images/tick.gif' else 'images/untick.jpg' end),'Slum',(case when upper(LOCALITY_r)='MIDDLE CLASS' then 'images/tick.gif' else 'images/untick.jpg' end),'Middle Class',(case when upper(LOCALITY_r)='MARKET AREA' then 'images/tick.gif' else 'images/untick.jpg' end),'Market Area',(case when upper(restype_r)='SITTING CHAWL/HUTMENT' then 'images/tick.gif' else 'images/untick.jpg' end),'Hutment',(case when upper(LOCALITY_r)='LOWER MIDDLE CLASS' then 'images/tick.gif' else 'images/untick.jpg' end),'Lower Middle Class',(case when upper(LOCALITY_r)='OTHER' then 'images/tick.gif' else 'images/untick.jpg' end),'Other',(case when upper(restype_r)='CHAWL' then 'images/tick.gif' else 'images/untick.jpg' end),'Chawl',(case when upper(LOCALITY_r)='UNDER DEVELOPMENT AREA' then 'images/tick.gif' else 'images/untick.jpg' end),'Under-development Area',' ',(case when upper(restype_r)='SMALL UNIT WITHIN HOUSE' then 'images/tick.gif' else 'images/untick.jpg' end),'Small unit within house',(case when upper(LOCALITY_r)='SLUM' then 'images/tick.gif' else 'images/untick.jpg' end),'Slum',' ',' ',(case when upper(LOCALITY_r)='COMMERCIAL AREA' then 'images/tick.gif' else 'images/untick.jpg' end),'Commercial Area',' ','Area :',upper(carpetarea_r),' ',' ',' ','Construction','Exterior','Interior',(case when upper(construction_r)='PUKKA' then 'images/tick.gif' else 'images/untick.jpg' end),'Pukka',(case when upper(FURLEVEL_r)='HIGH' then 'images/tick.gif' else 'images/untick.jpg' end),'Good',(case when upper(INTERIOR_r)='WELL FURNISHED' then 'images/tick.gif' else 'images/untick.jpg' end),'Good',(case when upper(CONSTRUCTION_r)='SEMI PUKKA' then 'images/tick.gif' else 'images/untick.jpg' end),'Semi-Pukka',(case when upper(FURLEVEL_r)='MIDDLE' then 'images/tick.gif' else 'images/untick.jpg' end),'Average',(case when upper(INTERIOR_r)='AVERAGELY FURNISHED' then 'images/tick.gif' else 'images/untick.jpg' end),'Average',(case when upper(CONSTRUCTION_r)='TEMPORARY' then 'images/tick.gif' else 'images/untick.jpg' end),'Temporary',(case when upper(FURLEVEL_r)='POOR' then 'images/tick.gif' else 'images/untick.jpg' end),'Poor',(case when upper(INTERIOR_r)='POORLY FURNISHED' then 'images/tick.gif' else 'images/untick.jpg' end),'Poor',(case when upper(CONSTRUCTION_r)='BRICK WALLED' then 'images/tick.gif' else 'images/untick.jpg' end),'Brick Walled',(case when upper(FURLEVEL_r)='LIFT PRESENT' then 'images/tick.gif' else 'images/untick.jpg' end),'Lift Present(Y/N)',' ',(case when upper(CONSTRUCTION_r)='PLASTERED' then 'images/tick.gif' else 'images/untick.jpg' end),'Plastered',(case when upper(chkfield12_r)='X' then 'images/tick.gif' else 'images/untick.jpg' end),'Watchman Present',' ',' ','Interior Condition','Durables Owned','Vehicles Owned','Income Group',(case when upper(field30_25_r)='PAINTED' then 'images/tick.gif' else 'images/untick.jpg' end),'Painted',(case when upper(field30_15_r)='X' then 'images/tick.gif' else 'images/untick.jpg' end),'TV',(case when upper(chkfield1_r)='X' then 'images/tick.gif' else 'images/untick.jpg' end),'Two Wheelers',(case when upper(field30_24_r)='HIG' then 'images/tick.gif' else 'images/untick.jpg' end),'HIG',(case when upper(field30_25_r)='FURNISHED' then 'images/tick.gif' else 'images/untick.jpg' end),'Furnished',(case when upper(field30_21_r)='X' then 'images/tick.gif' else 'images/untick.jpg' end),'AC',(case when upper(field30_18_r)='X' then 'images/tick.gif' else 'images/untick.jpg' end),'Cars',(case when upper(field30_24_r)='MIG' then 'images/tick.gif' else 'images/untick.jpg' end),'MIG',(case when upper(field30_25_r)='CARPETED' then 'images/tick.gif' else 'images/untick.jpg' end),'Carpeted',(case when upper(field30_17_r)='X' then 'images/tick.gif' else 'images/untick.jpg' end),'Fridge',' ',(case when upper(field30_24_r)='LIG' then 'images/tick.gif' else 'images/untick.jpg' end),'LIG',(case when upper(field30_25_r)='CURTAINS' then 'images/tick.gif' else 'images/untick.jpg' end),'Curtains',(case when upper(field30_19_r)='X' then 'images/tick.gif' else 'images/untick.jpg' end),'Music System',' ',' ',(case when upper(chkfield17_r)='X' then 'images/tick.gif' else 'images/untick.jpg' end),'Clean',(case when upper(chkfield16_r)='X' then 'images/tick.gif' else 'images/untick.jpg' end),'Sofa',' ',' ',' ','Neighbour/TPC Check : '||upper(fieldtext_1_r),'Risk Alert and Other details :',(case when upper(redalert_r)='YES' then upper(alertrem_r) else 'NA' end),' ','Final Remarks of Residence verification :',upper(remarks_r),' ','4.DEDUPE CHECK STATUS (To be carried out at the bank and incorporated in the report)','Outcome of CIBIL check',': '||upper(negremarks_d),'Internal Dedupe Check',': '||upper(earremarks_d),' ','5.DOCUMENT VERIFICATION:','1)','NA','2)','NA','3)','NA','4)','NA','5)','NA','6)','NA',' ','6.SUMMARY :','Office Profile/Verification Status',': '||upper(status_o),'Residence Verification Status',': '||upper(status_r),'Previous Work Experience Check Status',': NA','Vendor Reference Status',': NA','Document Verification Status',': NA',' ','OVERALL STATUS',upper(overallstatus_o),' ','images/signs/'||sdoneby_o||'.png',' ',' ','Reviewed By -',upper(reportdoneby_o),' ','Stamp of Agency and Signature',' ','Date:',sdoneon from banklist_main_all m where (val0) val1