@RequestMapping( value = "supportGroupList", method = RequestMethod.POST, produces = "application/json") public @ResponseBody List<SupportGroup> supportGroupList(@RequestBody String projectCode) { PersonDao personDao = (PersonDao) appContext.getBean("personDao"); return personDao.getSupportGroupList(projectCode); }
@RequestMapping(value = "listaBen", method = RequestMethod.POST, produces = "application/json") public @ResponseBody List<Person> listaBen(@RequestBody ProjectPerson projectPerson) { PersonDao personDao = (PersonDao) appContext.getBean("personDao"); List<Person> people = personDao.findByTypeAndProjectCode( projectPerson.getPersonCode(), projectPerson.getProjectCode()); return people; }
@RequestMapping( value = "volunteerTypeList", method = RequestMethod.POST, produces = "application/json") public @ResponseBody List<String> volunteerTypeList(@RequestBody String projectCode) { PersonDao personDao = (PersonDao) appContext.getBean("personDao"); return personDao.getVolunteerTypeList(projectCode); }
@RequestMapping( value = "beneficiarySeen", method = RequestMethod.POST, produces = "application/json") public @ResponseBody List<Person> beneficiarySeen(@RequestBody Filter filter) { PersonDao personDao = (PersonDao) appContext.getBean("personDao"); List<Person> people = personDao.findByFilter(filter); return people; }
@RequestMapping( value = "delayedMilestoneList", method = RequestMethod.POST, produces = "application/json") public @ResponseBody List<DelayedMilestone> delayedMilestoneList( @RequestBody String projectCode) { PersonDao personDao = (PersonDao) appContext.getBean("personDao"); return personDao.getDelayedMilestoneList(projectCode); }
@RequestMapping( value = "personByPersonId", method = RequestMethod.POST, produces = "application/json") public @ResponseBody List<Person> personByPersonId(@RequestBody ProjectPerson projectPerson) { PersonDao personDao = (PersonDao) appContext.getBean("personDao"); List<Person> person = personDao.findPersonByPersonId(projectPerson.getPersonId(), projectPerson.getPersonCode()); return person; }
@RequestMapping( value = "deletePerson", method = RequestMethod.POST, produces = "application/json") public @ResponseBody String deletePerson(@RequestBody Person person) { PersonDao personDao = (PersonDao) appContext.getBean("personDao"); person.setEndDate(new Date()); // personDao.delete(person); personDao.merge(person); return "OK"; }
@RequestMapping( value = "changePassword", method = RequestMethod.POST, produces = "application/json") public @ResponseBody Login changePassword(@RequestBody Login login) { PersonDao personDao = (PersonDao) appContext.getBean("personDao"); login.setDepartment(login.getUsername().toUpperCase()); login.setInsertDate(new Date()); personDao.saveLogin(login); return login; }
@RequestMapping( value = "updateOldPassword", method = RequestMethod.POST, produces = "application/json") public @ResponseBody Login updateOldPassword(@RequestBody Login login) { PersonDao personDao = (PersonDao) appContext.getBean("personDao"); List<Login> loginList = personDao.getLogin(login); int loginId = 0; if (loginList.size() > 0) { loginId = loginList.get(0).getLoginId(); } login.setLoginId(loginId); login.setEndDate(new Date()); personDao.mergeLogin(login); return login; }
@RequestMapping( value = "submitCredentials", method = RequestMethod.POST, produces = "application/json") public @ResponseBody LoginBean submitCredentials(@RequestBody Login login) { PersonDao personDao = (PersonDao) appContext.getBean("personDao"); List<Login> loginList = personDao.getLogin(login); String department = null; if (loginList.size() > 0) { department = loginList.get(0).getDepartment(); } LoginBean loginBean = new LoginBean(); loginBean.setDepartment(department); loginBean.setUsername(login.getUsername()); loginBean.setAccessToken("owjehfuowm893uhiuhnkasdbcfik"); return loginBean; }
@RequestMapping( value = "inserisciBen", method = RequestMethod.POST, produces = "application/json") public @ResponseBody String inserisciBen(@RequestBody GlobalPerson globalPerson) { ProjectPerson projectPerson = globalPerson.getProjectPerson(); Person person = globalPerson.getPerson(); PersonDao personDao = (PersonDao) appContext.getBean("personDao"); if (globalPerson != null && person != null && person.getPersonId() != null) { // sono in update List<Person> beneficiarioPresente = personDao.findById(globalPerson.getPerson().getPersonId()); if (beneficiarioPresente.size() > 0) { addSibling(globalPerson, person); personDao.merge(person); } } else { // insert // sto aggiungendo un nominativo ma devo controllare se esiste gia a db. In tal caso introduco // solo ProjectPerson if (person.getFirstName() != null && person.getLastName() != null && person.getThirdName() != null) { String isNamePresent = personDao.checkNames(globalPerson); if (isNamePresent != null && "-1".equals(isNamePresent)) return "threeNamesError"; if (isNamePresent != null && Integer.valueOf(isNamePresent) > 0) { person.setPersonId(Integer.valueOf(isNamePresent)); ProjectPerson pp = new ProjectPerson(); pp.setPersonId(Integer.valueOf(isNamePresent)); pp.setProjectCode(globalPerson.getProjectPerson().getProjectCode()); pp.setPersonCode(globalPerson.getProjectPerson().getPersonCode()); Set<ProjectPerson> prS = new HashSet<ProjectPerson>(); prS.add(pp); person.setProjectPersons(prS); personDao.merge(person); return "threeNamesAnotherProgram"; } } if (person.getFirstName() != null && person.getLastName() != null && person.getVillage() != null) { String isNamePresent = personDao.checkNames(globalPerson); if (isNamePresent != null && "-3".equals(isNamePresent)) return "twoNamesVillagesError"; } if (person.getFileNumber() != null) { String isFileNumberPresent = personDao.checkFileNumber(globalPerson); if (isFileNumberPresent != null) return "fileNumberError"; } projectPerson.setPersonCode(projectPerson.getPersonCode()); projectPerson.setProjectCode(projectPerson.getProjectCode()); Set<ProjectPerson> prSet = new HashSet<ProjectPerson>(); prSet.add(projectPerson); person.setProjectPersons(prSet); person.setPersonId(100); person.setInsertDate(new Date()); addSibling(globalPerson, person); personDao.save(person); } return null; }