Recorded in the development of the month calendar display, customer requirements need to cancel the meeting in the calendar to exclude, the following two kinds of exclusion method of comparison, the second is logically wrong, there will be duplication. In fact, the reason is still their logical thinking is not good enough.
The first, correct:
Exclude canceled meetingsif(! Collectionutils.isempty (zhbg_hysgl_xxgl_qxydlist)) {//If a cancelled regular meeting is entered, excludeBooleanFlag =false; for(intj = 0; J < Zhbg_hysgl_xxgl_qxydlist.size ();
J + +) {Zhbg_hysgl_xxgl_qxyd Qxyd = Zhbg_hysgl_xxgl_qxydlist.get (j); String canceldate =NewJava.sql.Date (C_begin.gettime (). GetTime ()). ToString ();if(Canceldate.equalsignorecase (QXYD.GETQXRQ ())) {//Judge the date that the meeting is canceled and the date of the calendar are different, add the regular meeting flag =true; Break; }
}if(!flag) {//here to loop the properties of the entity JSON =NewJsonobject (); Json.put ("id", Bean.gethysxxglid ());
STRKSSJ = BEAN.GETLHKSSJ (); SimpleDateFormat SDF =NewSimpleDateFormat ("hh:mm");
Date sdate = Sdf.parse (STRKSSJ);
STRJSSJ = BEAN.GETLHJSSJ ();
Date edate = Sdf.parse (STRJSSJ);
BSW = Sdate.gethours () <= 12; Bxw = Edate.gethours () <= 12;if(BSW && Bxw) {STRSW ="Morning"; }else if(Sdate.gethours () > && edate.gethours () > 12) {STRSW ="Afternoon"; }Else{STRSW ="All Day"; } json.put ("Start",NewJava.sql.Date (C_begin.gettime (). GetTime ()) +" " + BEAN.GETLHKSSJ ()); Json.put ("End",NewJava.sql.Date (C_begin.gettime (). GetTime ()) +" " + BEAN.GETLHJSSJ ()); Json.put ("description", BEAN.GETLHMC ()); Json.put ("Hys", STRSW +" " + ENTXXGL.GETHYSMC ()); Json.put ("SQBM", Entxxgl.getssdw_tname ()); Json.put ("chrs", entxxgl.getrnchrs ()); Json.put ("Sfapcs",""); Json.put ("Hybztsyq","");
Jsona.add (JSON); }
}
The second type of error:
Exclude canceled meetingsif(! Collectionutils.isempty (zhbg_hysgl_xxgl_qxydlist)) {//If a cancelled regular meeting is entered, exclude for(intj = 0; J < Zhbg_hysgl_xxgl_qxydlist.size ();
J + +) {Zhbg_hysgl_xxgl_qxyd Qxyd = Zhbg_hysgl_xxgl_qxydlist.get (j); String canceldate =NewJava.sql.Date (C_begin.gettime (). GetTime ()). ToString ();if(!canceldate.equalsignorecase (QXYD.GETQXRQ ())) {//The date of the cancellation of the meeting is different from the date of the calendar, not the same as to add the regular//here to iterate over the properties of the entity JSON =NewJsonobject (); Json.put ("id", Bean.gethysxxglid ());
STRKSSJ = BEAN.GETLHKSSJ (); SimpleDateFormat SDF =NewSimpleDateFormat ("hh:mm");
Date sdate = Sdf.parse (STRKSSJ);
STRJSSJ = BEAN.GETLHJSSJ ();
Date edate = Sdf.parse (STRJSSJ);
BSW = Sdate.gethours () <= 12; Bxw = Edate.gethours () <= 12;if(BSW && Bxw) {STRSW ="Morning"; }else if(Sdate.gethours () > && edate.gethours () > 12) {STRSW ="Afternoon"; }Else{STRSW ="All Day"; } json.put ("Start",NewJava.sql.Date (C_begin.gettime (). GetTime ()) +" " + BEAN.GETLHKSSJ ()); Json.put ("End",NewJava.sql.Date (C_begin.gettime (). GetTime ()) +" " + BEAN.GETLHJSSJ ()); Json.put ("description", BEAN.GETLHMC ()); Json.put ("Hys", STRSW +" " + ENTXXGL.GETHYSMC ()); Json.put ("SQBM", Entxxgl.getssdw_tname ()); Json.put ("chrs", entxxgl.getrnchrs ()); Json.put ("Sfapcs",""); Json.put ("Hybztsyq","");
Jsona.add (JSON); }
}
}