// Get details of Task/Card/Story @RequestMapping(value = "/{userId}/edit/{type}/{typeId}", method = RequestMethod.GET) public String getTypeDetails( @ModelAttribute("project") Project project, @PathVariable Long userId, @PathVariable String type, @PathVariable Long typeId, ModelMap model) { if (type.contentEquals("story")) { List ls = userDao.getStoryById(typeId); Story s = (Story) ls.get(0); model.addAttribute("story", s); } else if (type.contentEquals("cards")) { List lc = userDao.getCardById(typeId); Card c = (Card) lc.get(0); model.addAttribute("cards", c); } else if (type.contentEquals("tasks")) { List lt = userDao.getTaskById(typeId); Task t = (Task) lt.get(0); model.addAttribute("tasks", t); } List p = userDao.getProjectById(userId); Project ps = (Project) p.get(0); model.addAttribute("project", ps.getProjectname()); model.addAttribute("type", type); model.addAttribute("userid", userId); return "Details"; }
@RequiresPermissions({"categoryWord-delete"}) @RequestMapping( method = RequestMethod.POST, value = "/deleteCategoryWord", headers = "Accept=application/json") public @ResponseBody boolean deleteCategoryWord(@RequestBody List list) throws Exception { OperationLog operationLog = systemLogService.record("类别词", "批量删除", "类别词列表:"); String logParams = ""; for (int i = 0; i < list.size(); i++) { LinkedHashMap<String, String> map = (LinkedHashMap<String, String>) list.get(i); Set<String> keySet = map.keySet(); String id = map.get("id"); // 与元数据关联的不能删除 String esglisgAb = map.get("esglisgAb"); List<Metadata> metadatas = metadataService.findBy("categoryWordId", esglisgAb); if (metadatas.size() > 0) { return false; } categoryWordService.deleteById(id); logParams += esglisgAb + ","; } operationLog.setParams("类别词列表(英文缩写):" + logParams); systemLogService.updateResult(operationLog); return true; }
// Redirect to User Dashboard @RequestMapping(value = "/{userid}", method = RequestMethod.GET) public String login(@PathVariable Long userid, ModelMap model) { try { List<User> l = userDao.getUserById(userid); User u = l.get(0); String tType = u.getTenanttype(); if (tType.contentEquals("kanban")) { List<Card> card = userDao.getCardsById(userid); model.addAttribute("userid", userid); model.addAttribute("tenant", tType); model.addAttribute("cards", card); } else if (tType.contentEquals("scrum")) { List<Story> story = userDao.getStorysById(userid); model.addAttribute("userid", userid); model.addAttribute("tenant", tType); model.addAttribute("story", story); } else if (tType.contentEquals("waterfall")) { List<Task> task = userDao.getTasksById(userid); model.addAttribute("userid", userid); model.addAttribute("tenant", tType); model.addAttribute("tasks", task); } } catch (Exception e) { return "Login"; } return "Dashboard"; }
private static String getCommaseparatedStringFromList(List controllIdList) { StringBuilder result = new StringBuilder(); for (int i = 0; i < controllIdList.size(); i++) { Map map = (Map) controllIdList.get(i); if (map.get("control_ids") != null) { result.append(map.get("control_ids")); result.append(","); } } return result.length() > 0 ? result.substring(0, result.length() - 1) : ""; }
// Redirect to Add page to create new Task/Card/Story @RequestMapping(value = "/{userId}/add/{type}", method = RequestMethod.GET) public String getAdd( @ModelAttribute("project") Project project, @PathVariable Long userId, @PathVariable String type, ModelMap model) { List p = userDao.getProjectById(userId); Project ps = (Project) p.get(0); model.addAttribute("project", ps.getProjectname()); model.addAttribute("type", type); model.addAttribute("userid", userId); return "Add"; }
// Create New user @RequestMapping(value = "/signup", method = RequestMethod.POST) public String createUser(@ModelAttribute("user") User user, ModelMap model) { String tenant = user.getTenanttype(); if (tenant.contentEquals("kanban")) { Tenant t = new Tenant("Card Name", "Card Description", "Card Type", "Assigned To"); userDao.createUser(user, t); } else if (tenant.contentEquals("scrum")) { Tenant t = new Tenant( "Story Title", "Story Description", "Total Hours", "Remaining Hours", "Assigned To"); userDao.createUser(user, t); } else if (tenant.contentEquals("waterfall")) { Tenant t = new Tenant("Task Name", "Task Description", "Start Date", "Finish Date", "Assigned To"); userDao.createUser(user, t); } List u = userDao.getByEmail(user.getEmail()); User us = (User) u.get(0); model.addAttribute("tenant", tenant); model.addAttribute("userId", us.getId()); return "Project"; }
@RequiresPermissions({"categoryWord-add"}) @RequestMapping( method = RequestMethod.POST, value = "/saveCategoryWord/{type}", headers = "Accept=application/json") public @ResponseBody boolean saveCategoryWord( @RequestBody List list, @PathVariable String type) { // type 1 insert 2 update OperationLog operationLog = systemLogService.record("类别词", "批量保存", "类别词列表:"); String logParams = ""; for (int i = 0; i < list.size(); i++) { LinkedHashMap<String, String> map = (LinkedHashMap<String, String>) list.get(i); List<CategoryWord> list1 = categoryWordService.findBy("englishWord", map.get("esglisgAb")); List<CategoryWord> list2 = categoryWordService.findBy("chineseWord", map.get("chineseWord")); if ((list1.size() > 0 || list2.size() > 0) && type.equals("1")) { return false; } CategoryWord categoryWord = null; if (type.equals("1")) { categoryWord = new CategoryWord(); } else if (type.equals("2")) { categoryWord = categoryWordService.getById(map.get("id")); } categoryWord.setId(map.get("id")); categoryWord.setChineseWord(map.get("chineseWord")); // TZB没有englishWord // categoryWord.setEnglishWord(map.get("englishWord")); categoryWord.setEnglishWord(map.get("esglisgAb")); categoryWord.setEsglisgAb(map.get("esglisgAb")); categoryWord.setRemark(map.get("remark")); categoryWord.setOptDate(DateUtils.format(new Date())); categoryWord.setOptUser(SecurityUtils.getSubject().getPrincipal().toString()); categoryWordService.save(categoryWord); logParams += categoryWord.getChineseWord() + ","; } operationLog.setParams("类别词列表:" + logParams); systemLogService.updateResult(operationLog); return true; }
private List getHederAndValueOfPersonInfo(List infoList) throws ParseException { List headerAndValueList = new ArrayList(); for (int i = 0; i < infoList.size(); i++) { Map map = (Map) infoList.get(i); Set set = map.keySet(); for (Object s : set) { if (map.get(s) != null && !Utils.isEmpty(map.get(s).toString().trim()) && !("id").equals(s)) { Map header = new HashMap(); header.put("header", WordUtils.capitalize(s.toString().replace("_", " "))); // if(Utils.isValidXlsStrToDate(map.get(s).toString())) // header.put("value",Utils.getXlsDateToString(map.get(s).toString())); // else header.put("value", map.get(s).toString()); headerAndValueList.add(header); } } } return headerAndValueList; }
// Get project status @RequestMapping(value = "/{userId}/status", method = RequestMethod.GET) public String showStatus(@PathVariable Long userId, ModelMap model) throws SQLException { User u = (User) userDao.getUserById(userId).get(0); Project p = (Project) userDao.getProjectById(userId).get(0); if (u.getTenanttype().contentEquals("kanban")) { List l = userDao.cardCount(userId); List<Object[]> resultList = l; Map<String, Integer> resultMap = new HashMap<>(resultList.size()); int a[] = new int[4]; int i = 0; for (Object[] result : resultList) { String name = (String) result[0]; int count = ((Number) result[1]).intValue(); a[i] = count; i++; resultMap.put(name, count); } model.addAttribute("a", a); } else if (u.getTenanttype().contentEquals("scrum")) { List<Long> t = userDao.tCount(userId); List<Long> r = userDao.rCount(userId); Long tr = t.get(0); Long rr = r.get(0); int tHours = Long.valueOf(tr).intValue(); int rHours = Long.valueOf(rr).intValue(); List<Integer> actual = new ArrayList<>(); List<Integer> initial = new ArrayList<>(); int burnDown = 2 * 5; while (rHours > 0) { actual.add(rHours); rHours = rHours - burnDown; } while (tHours > 0) { initial.add(tHours); tHours = tHours - burnDown; } int k = 0; int l = 1; List<Integer[]> dataArray = new ArrayList<>(); for (int item : actual) { Integer[] o = {k, item, initial.get(k)}; dataArray.add(o); k++; } if (initial.size() > actual.size()) { for (int item : initial) { if (l > actual.size()) { Integer[] o = {l, 0, item}; dataArray.add(o); } l++; } Integer[] o = {l, 0, 0}; dataArray.add(o); } else if (initial.size() < actual.size()) { for (int item : initial) { if (l > initial.size()) { Integer[] o = {l, item, 0}; dataArray.add(o); } l++; } Integer[] o = {l, 0, 0}; dataArray.add(o); } else if (initial.size() == actual.size()) { Integer[] o = {k, 0, 0}; dataArray.add(o); } model.addAttribute("dataArray", dataArray); } else if (u.getTenanttype().contentEquals("waterfall")) { List l = userDao.taskCount(userId); List<Object[]> resultList = l; Map<String, Integer> resultMap = new HashMap<>(resultList.size()); int a[] = {0, 0, 0}; for (Object[] result : resultList) { String name = (String) result[0]; int count = ((Number) result[1]).intValue(); if (name.contentEquals("Requested")) { a[0] = count; } else if (name.contentEquals("In Progress")) { a[1] = count; } else if (name.contentEquals("Completed")) { a[2] = count; } resultMap.put(name, count); } model.addAttribute("a", a); } model.addAttribute("tenant", u.getTenanttype()); model.addAttribute("project", p.getProjectname()); model.addAttribute("userid", userId); return "Status"; }
private Map getFirstProjectTransactionMap(List proactiveTransactionList) { return (proactiveTransactionList != null && proactiveTransactionList.size() > 0) ? (Map) proactiveTransactionList.get(0) : new HashMap(); }