Conflicting tests on higher-level institutions bug fixes

Source: Internet
Author: User

Describe:

1. The upper body may be empty.

2. When the agency is added, the parent organization is selected, and before the submission, another user deletes the institution, and the previous user submits the form again, prompting the save to be successful and the operation should fail.

Idea: In the upper body is not empty, before saving to query judgment, if you save a moment to query the institution exists can save the success, or save the hint "save failed, please check the organization exists, and then try again!" ”;

@RequiresPermissions ("Sys:office:edit") @RequestMapping (value= "Save")     PublicString Save (Office office, model model, Redirectattributes redirectattributes) {if(Global.isdemomode ()) {AddMessage (redirectattributes,"Demo mode, no operation allowed!" "); return"Redirect:" + AdminPath + "/sys/office/";} if(!Beanvalidator (model, office)) {            returnform (Office, model); }if("". Equals (Office.getparent (). GetName ()))                    {officeservice.save (Office); if(Office.getchilddeptlist ()! =NULL) {Office Childoffice=NULL;  for(String id:office.getChildDeptList ()) {Childoffice=NewOffice (); Childoffice.setname (Dictutils.getdictlabel (ID,"Sys_office_common", "Unknown"));                    Childoffice.setparent (Office);                    Childoffice.setarea (Office.getarea ()); Childoffice.settype ("2"); Childoffice.setgrade (String.valueof (integer.valueof (Office.getgrade ())+1));                    Childoffice.setuseable (Global.yes);                Officeservice.save (Childoffice); }} addmessage (Redirectattributes,"Save Agency" + office.getname () + "Success"); }Else{    //if (! (""). Equals (Office.getparent (). GetName () ))) {//Add a subordinate institution            intm =Officeservice.findbyparentid (Office.getparent (). GetName ()); if(m==0) {addmessage (redirectattributes,"Save failed, please check if the organization exists, and then try again!" " ); }Else{officeservice.save (office); if(Office.getchilddeptlist ()! =NULL) {Office Childoffice=NULL;  for(String id:office.getChildDeptList ()) {Childoffice=NewOffice (); Childoffice.setname (Dictutils.getdictlabel (ID,"Sys_office_common", "Unknown"));                    Childoffice.setparent (Office);                    Childoffice.setarea (Office.getarea ()); Childoffice.settype ("2");
Childoffice.setgrade (string.valueof (integer.valueof (Office.getgrade ()) +1)); Childoffice.setuseable (Global.yes); Officeservice.save (Childoffice); }} addmessage (Redirectattributes, "save Agency" + office.getname () + "' Success"); }} String id = "0". Equals (Office.getparentid ())? "" : Office.getparentid (); return "Redirect:" + AdminPath + "/sys/office/forlist?id=" +id+ "&parentids=" + Office.getparentids (); }

Conflicting tests on higher-level institutions bug fixes

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.