public String depList() { /* 79 */ List list = this.archRecUserService.findDepAll(); /* 80 */ StringBuffer sb = new StringBuffer("{success:true,'totalCounts':"); /* 81 */ sb.append(list.size()).append(",result:["); /* 82 */ for (int i = 0; i < list.size(); i++) { /* 83 */ if (i > 0) { /* 84 */ sb.append(","); } /* 86 */ ArchRecUser ar = (ArchRecUser) ((Object[]) list.get(i))[0]; /* 87 */ Department dep = (Department) ((Object[]) list.get(i))[1]; /* 88 */ sb.append( "{'depId':'" + dep.getDepId() + "','depName':'" + dep.getDepName() + "','depLevel':" + dep.getDepLevel() + ","); /* 89 */ if (ar != null) /* 90 */ sb.append( "'archRecId':'" + ar.getArchRecId() + "','userId':'" + ar.getUserId() + "','fullname':'" + ar.getFullname() + "'}"); else { /* 92 */ sb.append("'archRecId':'','userId':'','fullname':''}"); } } /* 95 */ sb.append("]}"); /* 96 */ this.jsonString = sb.toString(); /* 97 */ return "success"; }
public String save() { /* 138 */ String data = getRequest().getParameter("data"); /* 139 */ if (StringUtils.isNotEmpty(data)) { /* 140 */ Gson gson = new Gson(); /* 141 */ ArchRecUser[] aru = gson.fromJson(data, new com.google.gson.reflect.TypeToken<ArchRecUser[]>() {}.getType()); /* 142 */ for (ArchRecUser archRecUser : aru) { /* 143 */ if (archRecUser.getArchRecId().longValue() == -1L) { /* 144 */ archRecUser.setArchRecId(null); } /* 146 */ if (archRecUser.getDepId() != null) { /* 147 */ Department department = (Department) this.departmentService.get(archRecUser.getDepId()); /* 148 */ archRecUser.setDepartment(department); /* 149 */ this.archRecUserService.save(archRecUser); } else { /* 151 */ setJsonString("{success:false}"); } } } /* 155 */ setJsonString("{success:true}"); /* 156 */ return "success"; }