Produced by Araxis Merge on 1/17/2019 10:54:18 AM Central Standard Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | v1_iter_1_VIP_Build_4_Dec_2018_CG.zip\v1_iter_1_VIP_Build_4\portlets\caret-portlet\docroot\WEB-INF\src\gov\va\caret\service\impl | FmsOgSupport.java | Wed Jan 16 16:07:20 2019 UTC |
| 2 | v1_iter_1_VIP_Build_4_Dec_2018_CG.zip\v1_iter_1_VIP_Build_4\portlets\caret-portlet\docroot\WEB-INF\src\gov\va\caret\service\impl | FmsOgSupport.java | Wed Jan 16 20:12:20 2019 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 1334 |
| Changed | 1 | 2 |
| Inserted | 0 | 0 |
| Removed | 0 | 0 |
| Whitespace | |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
| 1 | package go v.va.caret .service.i mpl; | |
| 2 | ||
| 3 | import jav a.text.Dat eFormatSym bols; | |
| 4 | import jav a.text.Mes sageFormat ; | |
| 5 | import jav a.util.Arr ayList; | |
| 6 | import jav a.util.Cal endar; | |
| 7 | import jav a.util.Dat e; | |
| 8 | import jav a.util.Has hMap; | |
| 9 | import jav a.util.Has hSet; | |
| 10 | import jav a.util.Lis t; | |
| 11 | import jav a.util.Loc ale; | |
| 12 | import jav a.util.Map ; | |
| 13 | import jav a.util.Set ; | |
| 14 | ||
| 15 | import com .liferay.p ortal.kern el.excepti on.PortalE xception; | |
| 16 | import com .liferay.p ortal.kern el.excepti on.SystemE xception; | |
| 17 | import com .liferay.p ortal.kern el.log.Log ; | |
| 18 | import com .liferay.p ortal.kern el.log.Log FactoryUti l; | |
| 19 | import com .liferay.p ortal.kern el.util.Pr opsUtil; | |
| 20 | import com .liferay.p ortal.kern el.util.St ringPool; | |
| 21 | import com .liferay.p ortal.serv ice.Servic eContext; | |
| 22 | import com .liferay.p ortal.serv ice.UserLo calService Util; | |
| 23 | import com .liferay.p ortal.util .PortalUti l; | |
| 24 | import com .liferay.u til.portle t.PortletP rops; | |
| 25 | ||
| 26 | import gov .va.caret. Applicatio nWorkFlowE xception; | |
| 27 | import gov .va.caret. model.BgLa e; | |
| 28 | import gov .va.caret. model.BoxG p; | |
| 29 | import gov .va.caret. model.FmsO g; | |
| 30 | import gov .va.caret. model.FmsO gWrapper; | |
| 31 | import gov .va.caret. model.StiP t; | |
| 32 | import gov .va.caret. model.Vend r; | |
| 33 | import gov .va.caret. model.WorI m; | |
| 34 | import gov .va.caret. model.impl .BgLaeImpl ; | |
| 35 | import gov .va.caret. model.supp ort.Vendor ; | |
| 36 | import gov .va.caret. model.supp ort.occ.St ipendConfi g; | |
| 37 | import gov .va.caret. service.Bg LaeLocalSe rviceUtil; | |
| 38 | import gov .va.caret. service.Ca retLocalSe rviceUtil; | |
| 39 | import gov .va.caret. service.St iPtLocalSe rviceUtil; | |
| 40 | import gov .va.caret. service.Ve ndrLocalSe rviceUtil; | |
| 41 | import gov .va.caret. service.Wo rImLocalSe rviceUtil; | |
| 42 | import gov .va.caret. service.th read.NonCl usteredMon itor; | |
| 43 | import gov .va.caret. util.Caret Util; | |
| 44 | import gov .va.caret. util.Toolb ox; | |
| 45 | import gov .va.caret. workflow.O wnerQueue; | |
| 46 | import gov .va.caret. workflow.Q ueAction; | |
| 47 | ||
| 48 | public cla ss FmsOgSu pport exte nds FmsOgW rapper { | |
| 49 | ||
| 50 | pr ivate stat ic final l ong serial VersionUID = 1L; | |
| 51 | ||
| 52 | pr ivate stat ic Log _lo g = LogFac toryUtil.g etLog( Fms OgSupport. class ); | |
| 53 | ||
| 54 | pu blic stati c final St ring FMS_O UTGOING_RE ADY = "FMS _OUTGOING_ READY"; | |
| 55 | pu blic stati c final St ring FMS_I NCOMING_LO ADED = "FM S_INCOMING _LOADED"; | |
| 56 | pu blic stati c final in t LAST_DAY _OF_FMS_MO NTH = 27; | |
| 57 | ||
| 58 | pu blic FmsOg Support(Fm sOg fmsOg) { | |
| 59 | supe r(fmsOg); | |
| 60 | } | |
| 61 | ||
| 62 | // Wo rkItemSupp ort workit em = null; | |
| 63 | ||
| 64 | // pu blic stati c void moc kMonth ( ) { | |
| 65 | // | |
| 66 | // if ( !CaretUti l.isMockFm sInitEnabl ed() ) { | |
| 67 | // _log.i nfo("FMS m ock not en abled: moc k.fms.init .enabled") ; | |
| 68 | // return ; | |
| 69 | // } | |
| 70 | // | |
| 71 | // Cale ndar calen dar = Cale ndar.getIn stance(); | |
| 72 | // cale ndar.set( Calendar.D AY_OF_MONT H, 1); | |
| 73 | // cale ndar.set( Calendar.H OUR_OF_DAY , 0); | |
| 74 | // cale ndar.set( Calendar.M INUTE, 0); | |
| 75 | // cale ndar.set( Calendar.M ILLISECOND , 22); | |
| 76 | // | |
| 77 | // List <Date> lis t = new Ar rayList<Da te> (); | |
| 78 | //// list .add( cale ndar.getTi me() ); | |
| 79 | // for ( int i = 8; i > 1; i-- ) { | |
| 80 | // calend ar.roll(Ca lendar.MON TH, false) ; | |
| 81 | // if ( c alendar.ge t(Calendar .MONTH) == Calendar. DECEMBER ) { | |
| 82 | // calendar .roll(Cale ndar.YEAR, false); | |
| 83 | // } | |
| 84 | // list.a dd( calend ar.getTime () ); | |
| 85 | // } | |
| 86 | // for ( int i = list.size( )-1; i >= 0; i-- ) { | |
| 87 | // calend ar.setTime ( list.get ( i ) ); | |
| 88 | // try { | |
| 89 | // Calendar cloned = (Calendar) calendar.c lone(); | |
| 90 | // BgLae bg Lae0 = Ven dor.initMo nth( calen dar ); | |
| 91 | // | |
| 92 | // for ( St iPt stiPt: StiPtLoca lServiceUt il.getStiP ts(-1, -1) ) { | |
| 93 | // if ( stiPt .getStipen dStartDate ().before( cloned.ge tTime() ) && stiPt.g etStipendA pprovedDat e() != nul l && Stipe ndConfig.P AYMENT_FIN ANCE.equal s( stiPt.g etStipendS tatus()) ) { | |
| 94 | // if ( stiPt.g etPayslipD ate() == n ull ) { | |
| 95 | // Date stipendSt artDate = stiPt.getS tipendStar tDate(); | |
| 96 | // Stri ng payment = stiPt.g etPayment( ); | |
| 97 | // Stri ng tierHou rs = stiPt .getTierHo urs(); | |
| 98 | // Stri ng blsRate Hourly = s tiPt.getBl sRateHourl y(); | |
| 99 | // if ( StipendCo nfig.RECUR RING.equal s( stiPt.g etStipendT ype() ) ) { | |
| 100 | // stiPt. setOneTime Payment( I nitialPaym ent.getFin alAmount ( stipendSt artDate, p ayment, ti erHours, b lsRateHour ly, Stipen dConfig.ge tPayday( c loned ) ) ); | |
| 101 | // } | |
| 102 | // } | |
| 103 | // st iPt.setCyc leId( bgLa e0.getBgLa eId() ); | |
| 104 | // St iPtLocalSe rviceUtil. updateStiP t(stiPt); | |
| 105 | // } | |
| 106 | // } | |
| 107 | // bgLae0 = stageMont h(cloned); | |
| 108 | // mockServ ice ( (Cal endar)cale ndar.clone (), mockAp prove ( (C alendar)ca lendar.clo ne(), bgLa e0 ) ); | |
| 109 | // } catc h (Applica tionWorkFl owExceptio n e) { | |
| 110 | // e.printS tackTrace( ); | |
| 111 | // } catc h (SystemE xception e ) { | |
| 112 | // e.printS tackTrace( ); | |
| 113 | // } catc h (PortalE xception e ) { | |
| 114 | // // TODO Auto-gener ated catch block | |
| 115 | // e.printS tackTrace( ); | |
| 116 | // } | |
| 117 | // } | |
| 118 | // } | |
| 119 | ||
| 120 | ||
| 121 | pu blic stati c BgLae st ageMonth(C alendar ca lendar) th rows Syste mException , PortalEx ception { | |
| 122 | ||
| 123 | Serv iceContext sc = new ServiceCon text(); | |
| 124 | sc.s etUserId( UserLocalS erviceUtil .getDefaul tUserId( P ortalUtil. getDefault CompanyId( ) ) ); | |
| 125 | sc.s etCompanyI d( PortalU til.getDef aultCompan yId() ); | |
| 126 | sc.s etCreateDa te( new Da te() ); | |
| 127 | sc.s etAddGuest Permission s(false); | |
| 128 | ||
| 129 | ||
| 130 | BgLa e boxGpLae = Vendor. initMonth( Calendar. getInstanc e(), false ); | |
| 131 | ||
| 132 | BgLa e bgLae0 = Vendor.in itMonth( c alendar ); | |
| 133 | bgLa e0.setLarg eText( Sti pendConfig .STAGED + Toolbox.fo rmatDate( calendar.g etTime() ) ); | |
| 134 | Care tLocalServ iceUtil.sa ve( bgLae0 ); | |
| 135 | if ( CaretUtil .isEmailEn abled() ) { | |
| 136 | Map<St ring,Objec t> otherIn fo = new H ashMap<Str ing,Object >(); | |
| 137 | otherI nfo.put("t o", PropsU til.get( " stage.mont h.email.to " ) ); | |
| 138 | otherI nfo.put("f rom", Prop sUtil.get( "stage.mo nth.email. from" ) ); | |
| 139 | String month = T oolbox.MON THS[calend ar.get( Ca lendar.MON TH) ]; | |
| 140 | otherI nfo.put("s ubject", M essageForm at.format( PortletPr ops.get( " stage.mont h.email.su bject" ), month ) ); | |
| 141 | otherI nfo.put("b ody", Mess ageFormat. format( Po rtletProps .get( "sta ge.month.e mail.body" ), month) ); | |
| 142 | CaretU til.sendPa ymentNotif icationMai l( otherIn fo ); | |
| 143 | } el se { | |
| 144 | _log.i nfo("Email s not enab led: email .enabled") ; | |
| 145 | } | |
| 146 | ||
| 147 | ||
| 148 | retu rn bgLae0; | |
| 149 | } | |
| 150 | ||
| 151 | pu blic stati c BgLae st ageWeek(Ca lendar cal endar) thr ows System Exception, PortalExc eption { | |
| 152 | ||
| 153 | Serv iceContext sc = new ServiceCon text(); | |
| 154 | sc.s etUserId( UserLocalS erviceUtil .getDefaul tUserId( P ortalUtil. getDefault CompanyId( ) ) ); | |
| 155 | sc.s etCompanyI d( PortalU til.getDef aultCompan yId() ); | |
| 156 | sc.s etCreateDa te( new Da te() ); | |
| 157 | sc.s etAddGuest Permission s(false); | |
| 158 | ||
| 159 | //-- ---------- ---- | |
| 160 | ||
| 161 | BgLa e bgLae = null; | |
| 162 | long lockId = 0; | |
| 163 | int count = 0; | |
| 164 | doub le total = 0; | |
| 165 | for ( StiPt st iPt: StiPt LocalServi ceUtil.fin dByUpdateP ending(Sti pendConfig .ONE_TIME, sc.getCre ateDate() ) ) { | |
| 166 | ||
| 167 | if ( s tiPt != nu ll && stiP t.getCycle Id() > 0 ) { | |
| 168 | BgLae bg l = BgLaeL ocalServic eUtil.fetc hBgLae( st iPt.getCyc leId() ); | |
| 169 | if ( bgl != null & & bgLae != null && / /daily was already s taged/subm itted for this payme nt... | |
| 170 | bg l.getLarge Text().sta rtsWith(St ipendConfi g.STAGED) || | |
| 171 | bg l.getLarge Text().sta rtsWith("F MS") || | |
| 172 | bg l.getBoxGp Id() == bg Lae.getBox GpId() ) { | |
| 173 | _log.warn( "Payment s ubmitted p reviously " + stiPt. getStiPtId () + " wit h transact ion ID " + bgl); | |
| 174 | continue; | |
| 175 | } | |
| 176 | } | |
| 177 | if ( b gLae == nu ll ) { | |
| 178 | boolean isThursday = false, | |
| 179 | is MonthLastD ay = false ; | |
| 180 | ||
| 181 | Calendar today = C alendar.ge tInstance( ); | |
| 182 | if ( tod ay.get(Cal endar.DAY_ OF_WEEK) = = Calendar .THURSDAY ) { | |
| 183 | isThursday = true; | |
| 184 | } | |
| 185 | if ( tod ay.get(Cal endar.DAY_ OF_MONTH) == LAST_DA Y_OF_FMS_M ONTH ) { | |
| 186 | isMonthLas tDay = tru e; | |
| 187 | } | |
| 188 | ||
| 189 | if ( isT hursday || isMonthLa stDay ) { | |
| 190 | bgLae = Ve ndor.getPa ymentStep( sc); //Fir st the wee kly schedu le if not used, othe rwise mont hly | |
| 191 | if ( bgLae .getLargeT ext().star tsWith("FM S_") || bg Lae.getLar geText().s tartsWith( StipendCon fig.COMPLE TED) ) { / /payment w as already submitted /responded , re-issue as daily. .. | |
| 192 | bg Lae = null ; | |
| 193 | } | |
| 194 | } | |
| 195 | ||
| 196 | if ( bgL ae == null ){ | |
| 197 | bgLae = Bg LaeLocalSe rviceUtil. getLastBgL ae( Toolbo x.getBgLae Day() ); | |
| 198 | if ( bgLae != null & & ( bgLae. getLargeTe xt().start sWith("FMS _") || bgL ae.getLarg eText().st artsWith(S tipendConf ig.COMPLET ED) ) ) { | |
| 199 | bg Lae = null ; | |
| 200 | } | |
| 201 | } | |
| 202 | ||
| 203 | if ( bgL ae == null ){ | |
| 204 | //set up n ew daily p ayment req uest... | |
| 205 | Calendar c alendar2 = Calendar. getInstanc e(); | |
| 206 | BoxGp boxG p = Vendor .getOneTim eDailyBg(c alendar2); | |
| 207 | bgLae = ne w BgLaeImp l(); | |
| 208 | bgLae.setO wnerId( To olbox.getB gLaeDay() ); | |
| 209 | bgLae.setB oxGpId( bo xGp.getBox GpId() ); | |
| 210 | } | |
| 211 | ||
| 212 | bgLae.se tLargeText ( StipendC onfig.STAG ED + Toolb ox.formatD ateTime( s c.getCreat eDate()) ) ; | |
| 213 | CaretLoc alServiceU til.save(b gLae); | |
| 214 | ||
| 215 | ||
| 216 | } | |
| 217 | ||
| 218 | lockId = NonClus teredMonit or.lock(bg Lae.getBox GpId(), bg Lae.getBgL aeId()); | |
| 219 | if ( b gLae.getBg LaeId() != lockId ){ //could no t capture lock... | |
| 220 | _log.err or("multip le process es not all owed to su bmit to OC C FM for p ayment con currently" ); | |
| 221 | //protec t against race condi tion, 1 su bmit to OC C FM at a time... | |
| 222 | continue ; | |
| 223 | } | |
| 224 | ||
| 225 | stiPt. setCycleId ( bgLae.ge tBgLaeId() ); | |
| 226 | CaretL ocalServic eUtil.save ( stiPt ); | |
| 227 | double amount; | |
| 228 | ||
| 229 | if ( s tiPt.getPa yslipDate( ) == null ){ | |
| 230 | amount = Double.va lueOf( sti Pt.getOneT imePayment () ); | |
| 231 | } else { | |
| 232 | amount = Double.va lueOf( sti Pt.getPaym ent() ); | |
| 233 | } | |
| 234 | total = total + amount; | |
| 235 | if ( _ log.isInfo Enabled() ) { | |
| 236 | _log.inf o("Staged payment:" + stiPt.ge tOneTimePa yment() + " for Vend or:" + sti Pt.getVend rId() + " with cycle Id:" + bgL ae.getBgLa eId() ); | |
| 237 | } | |
| 238 | ||
| 239 | NonClu steredMoni tor.unlock ( bgLae.ge tBoxGpId() ); | |
| 240 | count+ +; | |
| 241 | } | |
| 242 | ||
| 243 | //-- ---------- ---- | |
| 244 | ||
| 245 | BgLa e bgLae0 = Vendor.in itWeek( ca lendar, sc ); | |
| 246 | bgLa e0.setLarg eText( Sti pendConfig .STAGED + Toolbox.fo rmatDate( calendar.g etTime() ) ); | |
| 247 | Care tLocalServ iceUtil.sa ve( bgLae0 ); | |
| 248 | ||
| 249 | Map< String,Obj ect> other Info = new HashMap<S tring,Obje ct>(); | |
| 250 | othe rInfo.put( "to", Prop sUtil.get( "stage.we ek.email.t o" ) ); | |
| 251 | othe rInfo.put( "from", Pr opsUtil.ge t( "stage. week.email .from" ) ) ; | |
| 252 | othe rInfo.put( "subject", PortletPr ops.get( " stage.week .email.sub ject" ) ); | |
| 253 | othe rInfo.put( "body", Po rtletProps .get( "sta ge.week.em ail.body" ) ); | |
| 254 | if ( CaretUtil .isEmailEn abled() ) { | |
| 255 | CaretU til.sendPa ymentNotif icationMai l( otherIn fo ); | |
| 256 | } el se { | |
| 257 | _log.w arn("Email s disabled "); | |
| 258 | } | |
| 259 | ||
| 260 | retu rn bgLae0; | |
| 261 | } | |
| 262 | ||
| 263 | pu blic stati c BgLae st ageDaily( ServiceCon text sc ) throws App licationWo rkFlowExce ption, Sys temExcepti on { | |
| 264 | ||
| 265 | ||
| 266 | bool ean isThur sday = fal se; | |
| 267 | bool ean isMont hLastDay = false; | |
| 268 | ||
| 269 | Cale ndar today = Calenda r.getInsta nce(); | |
| 270 | if ( today.get (Calendar. DAY_OF_WEE K) == Cale ndar.THURS DAY ) { | |
| 271 | isThur sday = tru e; | |
| 272 | } | |
| 273 | // toda y.roll(Cal endar.DAY_ OF_MONTH, true); | |
| 274 | if ( today.get (Calendar. DAY_OF_MON TH) == LAS T_DAY_OF_F MS_MONTH ) { | |
| 275 | isMont hLastDay = true; | |
| 276 | } | |
| 277 | ||
| 278 | BgLa e bgLae = null; | |
| 279 | if ( isThursda y || isMon thLastDay ) { | |
| 280 | bgLae = Vendor.g etPaymentS tep(sc); / /First the weekly sc hedule if not used, otherwise monthly | |
| 281 | if ( b gLae.getLa rgeText(). startsWith ("FMS_") | | bgLae.ge tLargeText ().startsW ith(Stipen dConfig.CO MPLETED) ) { //payme nt was alr eady submi tted/respo nded, re-i ssue as da ily... | |
| 282 | bgLae = null; | |
| 283 | } | |
| 284 | } | |
| 285 | ||
| 286 | long ownerId = Toolbox.g etBgLaeDay (); | |
| 287 | if ( bgLae == null ){ | |
| 288 | bgLae = BgLaeLoc alServiceU til.getLas tBgLae( ow nerId ); | |
| 289 | if ( b gLae != nu ll && ( bg Lae.getLar geText().s tartsWith( "FMS_") || bgLae.get LargeText( ).startsWi th(Stipend Config.COM PLETED) ) ) { | |
| 290 | bgLae = null; | |
| 291 | } | |
| 292 | } | |
| 293 | ||
| 294 | if ( bgLae == null ){ | |
| 295 | //set up new dai ly payment request.. . | |
| 296 | Calend ar calenda r = Calend ar.getInst ance(); | |
| 297 | BoxGp boxGp = Ve ndor.getOn eTimeDaily Bg(calenda r); | |
| 298 | bgLae = new BgLa eImpl(); | |
| 299 | bgLae. setOwnerId ( ownerId ); | |
| 300 | bgLae. setBoxGpId ( boxGp.ge tBoxGpId() ); | |
| 301 | } | |
| 302 | ||
| 303 | bgLa e.setLarge Text( Stip endConfig. STAGED + T oolbox.for matDateTim e( sc.getC reateDate( )) ); | |
| 304 | Care tLocalServ iceUtil.sa ve(bgLae); | |
| 305 | ||
| 306 | retu rn bgLae; | |
| 307 | ||
| 308 | } | |
| 309 | ||
| 310 | ||
| 311 | pr ivate stat ic BgLae m ockApprove ( Calendar calendar, BgLae bgL ae ) throw s Applicat ionWorkFlo wException , SystemEx ception { | |
| 312 | // BoxG p boxGp = Vendor.get RecurringB oxGp( cale ndar ); | |
| 313 | // int ownerMonth = calenda r.get( Cal endar.MONT H ) + cale ndar.get( Calendar.Y EAR )* 12; | |
| 314 | // BgLa e bgLae = BgLaeLocal ServiceUti l.getBgLae Associatio n( ownerMo nth, boxGp .getBoxGpI d() ); | |
| 315 | ||
| 316 | // if ( bgLae == null ) { | |
| 317 | // try { | |
| 318 | // bgLae = new BgLaeI mpl(); | |
| 319 | // bgLae.se tOwnerId( ownerMonth ); | |
| 320 | // bgLae.se tBoxGpId( boxGp.getB oxGpId() ) ; | |
| 321 | // bgLae.se tLargeText ( StipendC onfig.STAG ED + Toolb ox.formatD ate( calen dar.getTim e() ) ); | |
| 322 | // BgLaeLoc alServiceU til.addBgL ae( bgLae) ; | |
| 323 | // _log.inf o("created ..:" + bgL ae ); | |
| 324 | // } catc h (SystemE xception e ) { | |
| 325 | // e.printS tackTrace( ); | |
| 326 | // } | |
| 327 | // } | |
| 328 | if ( bgLae.get LargeText( ).startsWi th(Stipend Config.STA GED) ) { | |
| 329 | CaretL ocalServic eUtil.setF msOut( cal endar.getT ime(), bgL ae, true ) ;//String. valueOf( b gLae.getOw nerId() ), String.va lueOf( bgL ae.getBgLa eId() ) | |
| 330 | } | |
| 331 | retu rn bgLae; | |
| 332 | } | |
| 333 | ||
| 334 | // pu blic stati c void moc kService ( Calendar calendar, BgLae bgLa e ) { | |
| 335 | // | |
| 336 | // | |
| 337 | // try { | |
| 338 | // _log.i nfo("Using BgLae:" + bgLae + " , with Box GpId:" + b gLae.getBo xGpId() ); | |
| 339 | // if ( b gLae != nu ll && !bgL ae.getLarg eText().st artsWith(" COMPLETED- ") ) { | |
| 340 | // | |
| 341 | // CaretLoc alServiceU til.mockSe rvice( Str ing.valueO f( bgLae.g etOwnerId( ) ), Strin g.valueOf( bgLae.get BgLaeId() ), true ); | |
| 342 | // Double u pdates = l oadPayLog( bgLae, cal endar.getT ime() ); | |
| 343 | // if ( upd ates != nu ll ) { | |
| 344 | // try { | |
| 345 | // Bg Num num = new BoxNum berSupport ( BoxGpLoc alServiceU til.getBox GroupBgNum ( CbopcFmD ashboardCo nfig.AVAIL ABLE_ID ). get(0) ); | |
| 346 | // nu m.setValue ( num.getV alue() - u pdates ); | |
| 347 | // Ca retLocalSe rviceUtil. save(num); | |
| 348 | // } catch (A pplication WorkFlowEx ception e) { | |
| 349 | // e. printStack Trace(); | |
| 350 | // } | |
| 351 | // } | |
| 352 | // | |
| 353 | // //// | |
| 354 | // List<Fms Ic> list = CaretLoca lServiceUt il.getFmsI n( (int)bg Lae.getOwn erId(), bg Lae.getBgL aeId(), "R EJECTED", 0, 50); // TODO ident ify all in coming rej ection sta tuses | |
| 355 | // try { | |
| 356 | // do { | |
| 357 | // fo r ( FmsIc fmsIc: lis t ) { | |
| 358 | // FmsO g og = Fms OgLocalSer viceUtil.g etFmsOg( L ong.valueO f(fmsIc.ge tVoucherId () ) ); | |
| 359 | // PayL g payLg = new PayLgI mpl(); | |
| 360 | // payL g.setAmoun t( Double. valueOf(fm sIc.getAmo unt()) ); | |
| 361 | // // payL g.setCreat ionDate(ca lendar.get Time()); | |
| 362 | // payL g.setPayme ntDate( fm sIc.getCre ationDate( ) ); | |
| 363 | // payL g.setReaso n(StipendC onfig.PAYM ENT_REJECT ED); | |
| 364 | // payL g.setCycle Id( og.get CycleId()) ; | |
| 365 | // payL g.setStatu s(StringPo ol.BLANK); | |
| 366 | // payL g.setVendr Id( og.get VendrId() ); | |
| 367 | // payL g.setFmsIc Id( fmsIc. getFmsIcId () ); | |
| 368 | //// payL g.setPayme ntMethod(p aymentMeth od); | |
| 369 | //// payL g.setPayme ntNumber(p aymentNumb er); | |
| 370 | // | |
| 371 | // _log .info("add ing..." + payLg); | |
| 372 | // Care tLocalServ iceUtil.sa ve(payLg); | |
| 373 | // fmsI c.setType( "failure-l oaded"); | |
| 374 | // FmsI cLocalServ iceUtil.up dateFmsIc( fmsIc); | |
| 375 | // upda tes = (upd ates == nu ll)? Doubl e.valueOf( 0): update s; | |
| 376 | // | |
| 377 | // StiP t stiPt = new Paymen tLog(payLg ).getStipe ndConfig() ; | |
| 378 | // | |
| 379 | // _log .info("put ting on ho ld..." + s tiPt); | |
| 380 | // stiP t.setStipe ndStatus(S tipendConf ig.ON_HOLD ); | |
| 381 | // Care tLocalServ iceUtil.sa ve(stiPt); | |
| 382 | // | |
| 383 | // Vend r vendr = VendrLocal ServiceUti l.fetchVen dr(stiPt.g etVendrId( )); | |
| 384 | // if ( vendr != null ) { | |
| 385 | // vendr. setStatus( StipendCo nfig.ON_HO LD ); | |
| 386 | // CaretL ocalServic eUtil.save (vendr); | |
| 387 | // } el se { | |
| 388 | // _log.e rror("Coul d not plac e hold on Vendor:" + stiPt.get VendrId() ); | |
| 389 | // } | |
| 390 | // | |
| 391 | // WorI m worIm = WorImLocal ServiceUti l.getWorIm (stiPt.get WorImId()) ; | |
| 392 | // WorI m wis = Ca retUtil.cr eateWorkIt em( Servic eContextTh readLocal. getService Context(), worIm.get GroupId(), | |
| 393 | // worIm.ge tClassId() , worIm.ge tClassPk() , worIm.ge tPersnId() , WorkType .REJECTED_ PAYMENT.na me(), worI m.getCareg iverId(), null ); | |
| 394 | // wis. setQueueId (OwnerQueu e.REJ_PAY_ Q.getQueue Id()); | |
| 395 | // wis. setVcgId(w orIm.getVc gId()); | |
| 396 | // wis. setGroupId (payLg.get PaymentLog Id()); | |
| 397 | // wis. setStatus( CaretStrPo ol.HOLD_PL ACED_ON_AC COUNT); | |
| 398 | // _log .info("cre ating hold work item ..." + wis ); | |
| 399 | // Care tLocalServ iceUtil.sa ve(wis); | |
| 400 | // | |
| 401 | // WorS e workItem Step = new WorSeImpl (); | |
| 402 | // work ItemStep.s etWorImId( wis.getWo rImId() ); | |
| 403 | // work ItemStep.s etCreation Date( Serv iceContext ThreadLoca l.getServi ceContext( ).getCreat eDate() ); | |
| 404 | // work ItemStep.s etUserId( ServiceCon textThread Local.getS erviceCont ext().getU serId() ); | |
| 405 | // int count = Wo rSeLocalSe rviceUtil. getCount ( wis.getWo rImId() ); | |
| 406 | // work ItemStep.s etStep( (c ount < 10? "0":Strin gPool.BLAN K) + count + StringP ool.COLON + wis.getT ype() + St ringPool.C OLON + wis .getStatus () ); | |
| 407 | // work ItemStep.s etStepNumb er(count+1 ); | |
| 408 | // Care tLocalServ iceUtil.sa ve( workIt emStep ); | |
| 409 | // } | |
| 410 | // li st = Caret LocalServi ceUtil.get FmsIn( (in t)bgLae.ge tOwnerId() , bgLae.ge tBgLaeId() , "REJECTE D", 0, 50) ; | |
| 411 | // } while ( list.size( ) > 0 ); | |
| 412 | // bgLae.setL argeText( "COMPLETED -" + bgLae .getLargeT ext().subs tring(bgLa e.getLarge Text().ind exOf("-"), bgLae.get LargeText( ).length() -1 ) ); | |
| 413 | // CaretLocal ServiceUti l.save(bgL ae); | |
| 414 | // } catch (SystemExc eption e) { | |
| 415 | // e.printSta ckTrace(); | |
| 416 | // } catch (PortalExc eption e) { | |
| 417 | // e.printSta ckTrace(); | |
| 418 | // } | |
| 419 | // | |
| 420 | // } | |
| 421 | // } ca tch (Appli cationWork FlowExcept ion e) { | |
| 422 | // e.prin tStackTrac e(); | |
| 423 | // } | |
| 424 | // } | |
| 425 | ||
| 426 | // pu blic stati c Double l oadPayLog( BgLae bgLa e, Date cr eateDate ) throws Ap plicationW orkFlowExc eption { | |
| 427 | // | |
| 428 | // List <FmsIc> li st = Caret LocalServi ceUtil.get FmsIn( (in t)bgLae.ge tOwnerId() , bgLae.ge tBgLaeId() , "success ful", 0, 5 0); | |
| 429 | // int errs = 0; | |
| 430 | // Doub le updates = null; | |
| 431 | // doub le rejects = 0; | |
| 432 | // | |
| 433 | // do { | |
| 434 | // try { | |
| 435 | // for ( Fm sIc fmsIc: list ) { | |
| 436 | // // search for lump s um types | |
| 437 | // // create pay-log fo r each ite m | |
| 438 | // | |
| 439 | // FmsOg og = FmsOgLoca lServiceUt il.getFmsO g( Long.va lueOf( fms Ic.getVouc herId() ) ); | |
| 440 | // double cou nt = 0; | |
| 441 | // double amo unt = 0; | |
| 442 | // //TODO: re name FmsOg stiPt col umn to ven drId | |
| 443 | // Set<Long> configs = new HashSe t<Long>(); | |
| 444 | // for ( StiP t config: StiPtLocal ServiceUti l.findByVe ndorCycle( og.getVen drId(), o g.getCycle Id() ) ) { | |
| 445 | // co nfigs.add( config.get StiPtId()) ; | |
| 446 | // if ( Stipend Config.REC URRING.equ als( confi g.getStipe ndType() ) ){ | |
| 447 | // if ( config.ge tPayslipDa te() == nu ll ) { | |
| 448 | // amount = Double. valueOf( c onfig.getO neTimePaym ent() ); | |
| 449 | // config .setPaysli pDate( cre ateDate ); | |
| 450 | // } el se { | |
| 451 | // amount = Double. valueOf( c onfig.getP ayment() ) ; | |
| 452 | // } | |
| 453 | // coun t = count + amount; | |
| 454 | // } else { | |
| 455 | // amou nt = Doubl e.valueOf( config.ge tOneTimePa yment() ); | |
| 456 | // coun t = count + amount; | |
| 457 | //// conf ig.setStip endStatus( StipendCo nfig.OBSOL ETE_PAYMEN T ); | |
| 458 | // conf ig.setPays lipDate( c reateDate ); | |
| 459 | // } | |
| 460 | // Ca retLocalSe rviceUtil. save(confi g); | |
| 461 | // } | |
| 462 | // for ( Long stiPtId: configs ) { | |
| 463 | // Lu mCg lumCg = new LumC gImpl(); | |
| 464 | // lu mCg.setCyc leId( fmsI c.getCycle Id() ); | |
| 465 | // lu mCg.setSti PtId( stiP tId ); | |
| 466 | // lu mCg.setVen drId( og.g etVendrId( ) ); | |
| 467 | // lu mCg.setSta tus( fmsIc .getStatus () ); | |
| 468 | // Lu mCgLocalSe rviceUtil. addLumCg( lumCg ); | |
| 469 | // } | |
| 470 | // PayLg payL g = new Pa yLgImpl(); | |
| 471 | // payLg.setA mount( Dou ble.valueO f( fmsIc.g etAmount() ) ); | |
| 472 | // payLg.setP aymentDate ( fmsIc.ge tCreationD ate() ); | |
| 473 | // payLg.setR eason( fms Ic.getStat us() ); | |
| 474 | // payLg.setV endrId( og .getVendrI d() ); | |
| 475 | // payLg.setF msIcId( fm sIc.getFms IcId() ); | |
| 476 | //// payLg.setC reationDat e(createDa te); | |
| 477 | //// payLg.setP aymentMeth od(payment Method); | |
| 478 | //// payLg.setP aymentNumb er(payment Number); | |
| 479 | // payLg.setC ycleId( og .getCycleI d() ); | |
| 480 | //// pa yLg.setSta tus( "" ); | |
| 481 | // CaretLocal ServiceUti l.save(pay Lg); | |
| 482 | // | |
| 483 | // _log.info( "Payment c omparison for Lumps, we logged :" + count + ", we e xpected:" + fmsIc.ge tAmount() ); | |
| 484 | // fmsIc.setT ype("succe ssful-load ed"); | |
| 485 | // FmsIcLocal ServiceUti l.updateFm sIc(fmsIc) ; | |
| 486 | // updates = (updates = = null)? D ouble.valu eOf(fmsIc. getAmount( )) : updat es + Doubl e.valueOf( fmsIc.getA mount()); | |
| 487 | // } | |
| 488 | // | |
| 489 | // | |
| 490 | // list = C aretLocalS erviceUtil .getFmsIn( (int)bgLa e.getOwner Id(), bgLa e.getBgLae Id(), "suc cessful", 0, 50); | |
| 491 | // if ( upd ates == nu ll ) { | |
| 492 | // updates = 0.0; | |
| 493 | // } | |
| 494 | // | |
| 495 | // } catc h (SystemE xception e ) { | |
| 496 | // e.printS tackTrace( ); | |
| 497 | // errs++; | |
| 498 | // } catc h (NumberF ormatExcep tion e) { | |
| 499 | // e.printS tackTrace( ); | |
| 500 | // } catc h (PortalE xception e ) { | |
| 501 | // e.printS tackTrace( ); | |
| 502 | // } | |
| 503 | // } wh ile ( list .size() > 1 && errs < 1 ); | |
| 504 | // | |
| 505 | // | |
| 506 | // //// Manage the rejected payments.. . | |
| 507 | // list = CaretLo calService Util.getFm sIn( (int) bgLae.getO wnerId(), bgLae.getB gLaeId(), "REJECTED" , 0, 50); //TODO ide ntify all incoming r ejection s tatuses | |
| 508 | // try { | |
| 509 | // do { | |
| 510 | // for ( FmsIc fmsI c: list ) { | |
| 511 | // // searc h for lump sum types | |
| 512 | // // creat e pay-log for each i tem | |
| 513 | // | |
| 514 | // FmsOg og = FmsOgLo calService Util.getFm sOg( Long. valueOf( f msIc.getVo ucherId() ) ); | |
| 515 | // | |
| 516 | // double c ount = 0; | |
| 517 | // double a mount = 0; | |
| 518 | // Set<Long > configs = new Hash Set<Long>( ); | |
| 519 | // List<Wor Im> reject edWorks = new ArrayL ist<WorIm> (); | |
| 520 | // for ( St iPt config : StiPtLoc alServiceU til.findBy VendorCycl e( og.getV endrId(), og.getCyc leId() ) ) { | |
| 521 | // configs.ad d(config.g etStiPtId( )); | |
| 522 | // if ( Stipe ndConfig.R ECURRING.e quals( con fig.getSti pendType() ) ){ | |
| 523 | // if ( config. getPayslip Date() == null ) { | |
| 524 | // amou nt += Doub le.valueOf ( config.g etOneTimeP ayment() ) ; | |
| 525 | // conf ig.setPays lipDate( c reateDate ); | |
| 526 | // } else { | |
| 527 | // amou nt += Doub le.valueOf ( config.g etPayment( ) ); | |
| 528 | // } | |
| 529 | // co unt = coun t + amount ; | |
| 530 | // } else { | |
| 531 | // am ount += Do uble.value Of( config .getOneTim ePayment() ); | |
| 532 | // co unt = coun t + amount ; | |
| 533 | // co nfig.setPa yslipDate( createDat e ); | |
| 534 | // } | |
| 535 | // | |
| 536 | // config.set StipendSta tus(Stipen dConfig.ON _HOLD); | |
| 537 | // _log.info( "putting o n hold..." + config) ; | |
| 538 | // CaretLocal ServiceUti l.save(con fig); | |
| 539 | // | |
| 540 | // WorIm worI m = WorImL ocalServic eUtil.getW orIm( conf ig.getWorI mId() ); | |
| 541 | // WorIm reje ctedWorIm = CaretUti l.createWo rkItem( Se rviceConte xtThreadLo cal.getSer viceContex t(), worIm .getGroupI d(), | |
| 542 | // worI m.getClass Id(), worI m.getClass Pk(), worI m.getPersn Id(), Work Type.REJEC TED_PAYMEN T.name(), worIm.getC aregiverId (), | |
| 543 | // Work Type.REJEC TED_PAYMEN T.getDueDa te( Servic eContextTh readLocal. getService Context(). getCreateD ate() ) ); | |
| 544 | // rejectedWo rIm.setQue ueId(Owner Queue.REJ_ PAY_Q.getQ ueueId()); | |
| 545 | // rejectedWo rIm.setVcg Id(worIm.g etVcgId()) ; | |
| 546 | // | |
| 547 | // rejectedWo rIm.setSta tus(CaretS trPool.HOL D_PLACED_O N_ACCOUNT) ; | |
| 548 | // _log.info( "creating hold work item..." + rejectedW orIm); | |
| 549 | // rejectedWo rks.add(re jectedWorI m); | |
| 550 | // | |
| 551 | // } | |
| 552 | // | |
| 553 | // for ( Lo ng stiPtId : configs ) { | |
| 554 | // LumCg lumC g = new Lu mCgImpl(); | |
| 555 | // lumCg.setC ycleId( fm sIc.getCyc leId() ); | |
| 556 | // lumCg.setS tiPtId( st iPtId ); | |
| 557 | // lumCg.setV endrId( og .getVendrI d() ); | |
| 558 | // lumCg.setS tatus( fms Ic.getStat us() ); | |
| 559 | // LumCgLocal ServiceUti l.addLumCg ( lumCg ); | |
| 560 | // } | |
| 561 | // PayLg pa yLg = new PayLgImpl( ); | |
| 562 | // payLg.se tAmount( a mount ); | |
| 563 | // payLg.se tPaymentDa te( fmsIc. getCreatio nDate() ); | |
| 564 | // payLg.se tReason( S tipendConf ig.PAYMENT _REJECTED ); | |
| 565 | // payLg.se tCycleId( og.getCycl eId() ); | |
| 566 | // payLg.se tVendrId( og.getVend rId() ); | |
| 567 | // payLg.se tFmsIcId( fmsIc.getF msIcId() ) ; | |
| 568 | // CaretLoc alServiceU til.save(p ayLg); | |
| 569 | // | |
| 570 | // for ( Wo rIm reject edWork : r ejectedWor ks ) { | |
| 571 | // rejectedWo rk.setGrou pId( payLg .getPaymen tLogId() ) ; | |
| 572 | // CaretLocal ServiceUti l.save(rej ectedWork) ; | |
| 573 | // } | |
| 574 | // | |
| 575 | // _log.inf o("Payment compariso n for Lump rejection , we logge d:" + coun t + ", we expected:" + fmsIc.g etAmount() ); | |
| 576 | // fmsIc.se tType("fai lure-loade d"); | |
| 577 | // FmsIcLoc alServiceU til.update FmsIc(fmsI c); | |
| 578 | // rejects = rejects + Double.v alueOf(fms Ic.getAmou nt()); | |
| 579 | // } | |
| 580 | // | |
| 581 | // list = CaretLoca lServiceUt il.getFmsI n( (int)bg Lae.getOwn erId(), bg Lae.getBgL aeId(), "R EJECTED", 0, 50); | |
| 582 | // } wh ile ( list .size() > 0 ); | |
| 583 | // } ca tch (Syste mException e) { | |
| 584 | // e.prin tStackTrac e(); | |
| 585 | // } ca tch (Porta lException e) { | |
| 586 | // e.prin tStackTrac e(); | |
| 587 | // } | |
| 588 | // _log .info("Tot al Succesf ul Payment s we logge d:" + upda tes ); | |
| 589 | // _log .info("Tot al Rejecti ons we log ged:" + re jects ); | |
| 590 | // | |
| 591 | // try { | |
| 592 | // bgLae. setLargeTe xt( bgLae. getLargeTe xt().repla ceAll(FMS_ INCOMING_L OADED, Sti pendConfig .COMPLETED ) + " S:" + updates + " R:" + rejects ); | |
| 593 | // CaretL ocalServic eUtil.save (bgLae); | |
| 594 | // BgNum num = new BoxNumberS upport( Bo xGpLocalSe rviceUtil. getBoxGrou pBgNum( Cb opcFmDashb oardConfig .AVAILABLE _ID ).get( 0) ); | |
| 595 | // num.se tValue( nu m.getValue () - updat es - rejec ts ); | |
| 596 | // CaretL ocalServic eUtil.save (num); | |
| 597 | // | |
| 598 | // BgNum threshold = BoxGpLoc alServiceU til.getBox GroupBgNum ( CbopcFmD ashboardCo nfig.THRES HOLD_ID ). get(0); | |
| 599 | // if ( t hreshold.g etValue() > num.getV alue() && CaretUtil. isEmailEna bled()) { | |
| 600 | // Map<Stri ng,Object> otherInfo = new Has hMap<Strin g,Object>( ); | |
| 601 | // otherInf o.put("to" , PropsUti l.get( "oc cfm.thresh old.email. to" ) ); | |
| 602 | // otherInfo. put("from" , PropsUti l.get( "oc cfm.thresh old.email. from" ) ); //"
|
|
| 603 | // otherInf o.put("sub ject", Por tletProps. get( "occf m.threshol d.email.su bject" ) ) ; | |
| 604 | // otherInf o.put("bod y", Portle tProps.get ( "occfm.t hreshold.e mail.body" ) ); | |
| 605 | // CaretUti l.sendPaym entNotific ationMail( otherInfo) ; | |
| 606 | // } | |
| 607 | // | |
| 608 | // } ca tch (Appli cationWork FlowExcept ion e) { | |
| 609 | // e.prin tStackTrac e(); | |
| 610 | // } | |
| 611 | // | |
| 612 | // retu rn updates ; | |
| 613 | // } | |
| 614 | ||
| 615 | ||
| 616 | pu blic stati c void rem oveHold(Se rviceConte xt sc, Set <Long> wor kIds) thro ws SystemE xception, PortalExce ption { | |
| 617 | ||
| 618 | for ( long wor kId: workI ds ) { | |
| 619 | ||
| 620 | WorIm work = Wor ImLocalSer viceUtil.g etWorIm(wo rkId); | |
| 621 | Vendr vendr = Ve ndrLocalSe rviceUtil. findByPers nId(work.g etCaregive rId()); | |
| 622 | for ( StiPt stiP t: StiPtLo calService Util.findB yVendorId( vendr.get VendrId(), new Stri ng[] {Stip endConfig. ON_HOLD} ) ) { | |
| 623 | stiPt.se tStipendSt atus( Stip endConfig. PAYMENT_FI NANCE ); | |
| 624 | CaretLoc alServiceU til.save(s tiPt); | |
| 625 | } | |
| 626 | if ( S tipendConf ig.ON_HOLD .equals( v endr.getSt atus() ) ) { | |
| 627 | vendr.se tStatus( S tringPool. BLANK ); | |
| 628 | CaretLoc alServiceU til.save(v endr); | |
| 629 | } | |
| 630 | ||
| 631 | work.s etCompleti onBy(sc.ge tUserId()) ; | |
| 632 | work.s etCompleti onDate(sc. getCreateD ate()); | |
| 633 | work.s etStatus(Q ueAction.H OLD_REMOVE D.name()); | |
| 634 | work.s etQueueId( OwnerQueue .VERIFIED_ COMPLETED_ Q.getQueue Id()); | |
| 635 | CaretL ocalServic eUtil.save (work); | |
| 636 | ||
| 637 | } | |
| 638 | ||
| 639 | ||
| 640 | } | |
| 641 | ||
| 642 | pu blic stati c void Sub mitStagedP ayments() throws App licationWo rkFlowExce ption { | |
| 643 | // T ODO Auto-g enerated m ethod stub | |
| 644 | ||
| 645 | Date logDate = new Date( ); | |
| 646 | ||
| 647 | List <BgLae> ge tAllStaged = BgLaeLo calService Util.getSt aged( Tool box.getBgL aeDay() ); | |
| 648 | // if ( CaretUtil .isMockFms Enabled() ) { | |
| 649 | //mock the FMS s ervice res ponse... | |
| 650 | // for ( BgLae bgLa e: getAllS taged ) { | |
| 651 | // CaretLoc alServiceU til.mockSe rvice( Str ing.valueO f( bgLae.g etOwnerId( ) ), Strin g.valueOf( bgLae.get BgLaeId() ), true ); | |
| 652 | // //TODO: test it wh ere a resp onse is no t returned and addit ional paym ents are s ubmitted | |
| 653 | // FmsOgSup port.loadP ayLog( bgL ae, logDat e ); | |
| 654 | // } | |
| 655 | // } el se { | |
| 656 | int i = 0; | |
| 657 | for ( BgLae bgLa e: getAllS taged ) { | |
| 658 | i++; | |
| 659 | CaretLoc alServiceU til.setFms Out( logDa te, bgLae, i == getA llStaged.s ize() ); | |
| 660 | bgLae.se tLargeText ( bgLae.ge tLargeText ().replace All(Stipen dConfig.ST AGED, FMS_ OUTGOING_R EADY)); | |
| 661 | CaretLoc alServiceU til.save(b gLae); | |
| 662 | _log.inf o(FMS_OUTG OING_READY + " Owner Id:" + bgL ae.getOwne rId() + ", BgLaeId:" + bgLae.g etBgLaeId( ) ); | |
| 663 | } | |
| 664 | // } | |
| 665 | ||
| 666 | } | |
| 667 | ||
| 668 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.