@RequestMapping(value = "/user", method = RequestMethod.PUT) @Transactional public ResponseEntity<Client> doIt(@RequestBody Client client, Authentication authentication) { List<String> errors = DomainValidator.checkForErrors(client); if (!errors.isEmpty()) { return new ResponseEntity<Client>(new Client(client, errors), HttpStatus.BAD_REQUEST); } HttpStatus status = null; List<GrantedAuthority> authorities = new ArrayList<>(); authorities.add(new SimpleGrantedAuthority("USER")); if (ApplicationSecurity.isRoot(authentication)) { if (ApplicationSecurity.isRoot(client.getUsername())) { return new ResponseEntity<Client>( new Client(client, cannotChangeRootPassword), HttpStatus.BAD_REQUEST); } status = upsert(client, authorities); } else if (StringUtils.equals(client.getUsername(), authentication.getName())) { if (!userDetailsManager.userExists(client.getUsername())) { return new ResponseEntity<Client>(new Client(client, mustBeRoot), HttpStatus.BAD_REQUEST); } User user = new User(client.getUsername(), client.getPassword(), authorities); userDetailsManager.updateUser(user); status = HttpStatus.OK; } else { return new ResponseEntity<Client>(HttpStatus.FORBIDDEN); } return new ResponseEntity<Client>(new Client(client), status); }
/** GET /account -> get the current user. */ @RequestMapping( value = "/account", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @Timed public ResponseEntity<UserDTO> getAccount() { User user = userService.getUserWithAuthorities(); if (user == null) { return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR); } List<String> roles = new ArrayList<>(); for (Authority authority : user.getAuthorities()) { roles.add(authority.getName()); } return new ResponseEntity<>( new UserDTO( user.getLogin(), null, user.getFirstName(), user.getLastName(), user.getEmail(), user.getLangKey(), roles), HttpStatus.OK); }
@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; }
/** * 填充数据 * * @param list 数据库有效数据列表 * @return 填充的数据 */ private <T extends TrendValue> List<T> fulldata( List<T> list, DateFormat format, int field, Date start, Date end, Class<T> clazz) { Map<String, T> map = tomap(list); Calendar calendar = Calendar.getInstance(); calendar.setTime(start); List<T> nlist = new ArrayList<>(); while (calendar.getTime().before(end)) { String keytime = format.format(calendar.getTime()); T value = map.get(keytime); if (value == null) { value = AfReflecter.newInstance(clazz); value.setEmpty(); value.setDate(keytime); value.setTime(calendar.getTime()); nlist.add(value); } else { nlist.add(value); map.remove(keytime); } calendar.add(field, 1); } for (Map.Entry<String, T> entry : map.entrySet()) { nlist.add(entry.getValue()); } return nlist; }
@RequestMapping("/events/{eventName}/fields") public List<String> getAllFields(@PathVariable("eventName") String eventName) { List<String> fields = new ArrayList<>(); fields.addAll(FIXED_FIELDS); fields.addAll(ticketFieldRepository.findFieldsForEvent(eventName)); return fields; }
@RequestMapping( value = "/product/{prod}/component/{comp}/property/{prop}/rule/{rule}", method = RequestMethod.DELETE) @Transactional public ResponseEntity<PropertyResult> resticted( @PathVariable("prod") String product, @PathVariable("comp") String component, @PathVariable("prop") String property, @PathVariable("rule") String rule) { PropertyKey key = new PropertyKey(product, component, property, rule); Property fromRequest = new Property(key, null); List<String> errors = DomainValidator.checkForErrors(key); if (!errors.isEmpty()) { return new ResponseEntity<PropertyResult>( new PropertyResult(fromRequest, errors), HttpStatus.BAD_REQUEST); } if (!properties.exists(key)) { return new ResponseEntity<PropertyResult>( new PropertyResult(fromRequest, Property.NOT_FOUND), HttpStatus.NOT_FOUND); } properties.delete(key); return new ResponseEntity<PropertyResult>(HttpStatus.OK); }
@ResponseBody @RequestMapping( value = "chooseDeviceBYBBSA", method = RequestMethod.POST, produces = MediaTypes.JSON) public Map<String, Object> chooseDeviceBYBBSA( @RequestParam("id") Integer id, HttpServletRequest request) throws SQLException { List<GroupBean> groupBeanList = new ArrayList<GroupBean>(); if (id == 0) { List<GroupBean> firstLevelDeviceList = groupService.findFirstLevelDeviceGroup(); groupBeanList.addAll(firstLevelDeviceList); } else { List<GroupBean> childDeviceGroup = groupService.findDeviceGroupWithId(id); groupBeanList.addAll(childDeviceGroup); BLGroup groupNode = groupService.findByGroupId(id); if (groupNode.getGROUP_TYPE_ID() == 1) { List<GroupBean> staticDeviceList = groupService.findStaticDeviceNode(id); groupBeanList.addAll(staticDeviceList); } else { List<GroupBean> smartDeviceList = groupService.findSmartDeviceNode(id); groupBeanList.addAll(smartDeviceList); } } Map<String, Object> resultMap = new HashMap<String, Object>(); resultMap.put("data", groupBeanList); // resultMap.put("data",deviceFilter.deviceFilterRole(groupBeanList,UserNameUtil.getUserNameByRequest(request)) ); return resultMap; }
@ResponseBody @RequestMapping(value = "chooseJobs", method = RequestMethod.POST, produces = MediaTypes.JSON) public Map<String, Object> chooseJobs(@RequestParam("id") Integer id) { /** * 根节点下不会直接挂载作业,其他节点下可以挂载子节点和作业 * * <p>如果传入的id是0,代表根节点,此时获取根节点下所有子节点 当点击一个子节点后,判断此节点是否为智能节点,如果是智能节点,则查找smart_group_query表 * 如果是非智能节点,则获取此节点下的子节点和作业 GROUP_TYPE_ID=9 代表智能节点; GROUP_TYPE_ID=4代表非智能节点 */ List<GroupBean> groupBeanList = new ArrayList<GroupBean>(); if (id == 0) { List<GroupBean> firstLevelJobGroupList = groupService.findFirstLevelJobGroup(); groupBeanList.addAll(firstLevelJobGroupList); } else { List<GroupBean> childJobGroup = groupService.findChildJobGroup(id); groupBeanList.addAll(childJobGroup); BLGroup groupNode = groupService.findByGroupId(id); if (groupNode.getGROUP_TYPE_ID() == 4) { List<GroupBean> staticJobList = groupService.findStaticJob(groupNode); groupBeanList.addAll(staticJobList); } else { List<GroupBean> smartJobList = groupService.findSmartJob(groupNode); groupBeanList.addAll(smartJobList); } } Map<String, Object> resultMap = new HashMap<String, Object>(); resultMap.put("data", groupBeanList); return resultMap; }
@RequestMapping(value = "/productos", params = "term", produces = "application/json") public @ResponseBody List<LabelValueBean> productos( HttpServletRequest request, @RequestParam("term") String filtro) { for (String nombre : request.getParameterMap().keySet()) { log.debug("Param: {} : {}", nombre, request.getParameterMap().get(nombre)); } Map<String, Object> params = new HashMap<>(); params.put("almacen", request.getSession().getAttribute("almacenId")); params.put("filtro", filtro); params = productoDao.lista(params); List<LabelValueBean> valores = new ArrayList<>(); List<Producto> productos = (List<Producto>) params.get("productos"); for (Producto producto : productos) { StringBuilder sb = new StringBuilder(); sb.append(producto.getSku()); sb.append(" | "); sb.append(producto.getNombre()); sb.append(" | "); sb.append(producto.getDescripcion()); sb.append(" | "); sb.append(producto.getExistencia()).append(" ").append(producto.getUnidadMedida()); sb.append(" | "); sb.append(producto.getPrecioUnitario()); valores.add(new LabelValueBean(producto.getId(), sb.toString())); } return valores; }
// 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"; }
@RequestMapping(value = "/product/{prod}", method = RequestMethod.DELETE) @Transactional public ResponseEntity<ProductResult> doIt( @PathVariable("prod") String product, Authentication auth) { if (!ApplicationSecurity.isRoot(auth)) { return new ResponseEntity<ProductResult>(HttpStatus.FORBIDDEN); } Product reqProduct = new Product(product, null); List<String> errors = DomainValidator.checkForErrors(reqProduct); if (!errors.isEmpty()) { return new ResponseEntity<ProductResult>( new ProductResult(reqProduct, errors), HttpStatus.BAD_REQUEST); } if (!products.exists(reqProduct.getName())) { return new ResponseEntity<ProductResult>( new ProductResult(reqProduct, Product.NOT_FOUND), HttpStatus.NOT_FOUND); } products.delete(reqProduct.getName()); components.deleteByKeyProduct(reqProduct.getName()); properties.deleteByKeyProduct(reqProduct.getName()); userProducts.deleteByKeyProduct(reqProduct.getName()); return new ResponseEntity<ProductResult>(HttpStatus.OK); }
@RequiresPermissions({"categoryWord-get"}) @RequestMapping( method = RequestMethod.POST, value = "/query", headers = "Accept=application/json") public @ResponseBody Map<String, Object> query(@RequestBody Map<String, String> params) { List<CategoryWord> rows = categoryWordService.findLikeAnyWhere(params); Map<String, Object> result = new HashMap<String, Object>(); result.put("total", rows.size()); result.put("rows", rows); return result; }
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"; }
// 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"; }
@RequestMapping("/drug") public String search( @RequestParam(value = "name", defaultValue = "") String name, @RequestParam(value = "limit", defaultValue = "10") int limit, @RequestParam(value = "skip", defaultValue = "0") int skip) throws IOException { name = fixTerm.makeFdaSafe(name); if (name.length() == 0) { return "[]"; } List<DrugSearchResult> rv = new LinkedList<DrugSearchResult>(); Set<String> uniis = this.getUniisByName(name); Map<String, Set<String>> brandNames = this.getBrandNamesByNameAndUniis(name, uniis); // create full list of drug search results for (String unii : uniis) { for (String brandName : brandNames.get(unii)) { DrugSearchResult res = new DrugSearchResult(); res.setUnii(unii); res.setBrandName(brandName); rv.add(res); } } // sort the list of drug search results by custom comparator Collections.sort(rv, new DrugSearchComparator(name)); // implement skip/limit if (rv.size() > 0) { rv = rv.subList(skip, Math.min(rv.size(), skip + limit)); } // fill in details for all the results we're returning for (DrugSearchResult res : rv) { res.setRxcui(this.getRxcuiByUnii(res.getUnii())); res.setGenericName(this.getGenericNameByRxcui(res.getRxcui())); if (res.getActiveIngredients().isEmpty() && res.getGenericName() != null) { res.setActiveIngredients( new TreeSet<String>(Arrays.asList(res.getGenericName().split(", ")))); } } ObjectMapper mapper = new ObjectMapper(); return mapper.writeValueAsString(rv); }
/** GET -> get all the permission_group records for a user */ @RequestMapping(value = "/{username}", method = RequestMethod.GET) @ResponseBody public ApiResponse<List<String>> getAllPermissionGroupsByUsername(@PathVariable String username) { LOG.debug("REST request to get all Groups"); final ApiResponse<List<String>> apiResponse = new ApiResponse<List<String>>(); List<String> groupList = null; try { groupList = groupService.getPermissionGroupNamesByUsername(username); apiResponse.setData(groupList); } catch (Exception e) { throw new LucasRuntimeException(LucasRuntimeException.INTERNAL_ERROR, e); } LOG.debug("Size{}", groupList.size()); return apiResponse; }
@RequestMapping(value = "/products", produces = MediaType.APPLICATION_JSON_VALUE) @ResponseBody public String getProducts() throws JsonProcessingException { List<Product> products = new ArrayList<>(); products.addAll(asList(new Product("Super Glue"), new Product("Kool-Aide"))); Optional<Product> externalProduct = Optional.empty(); try { String externalProductString = restTemplate.getForObject("http://localhost:6789/external-product", String.class); externalProduct = Optional.of(new Product(externalProductString)); } catch (RestClientException e) { // server is down - ignore } externalProduct.ifPresent(products::add); return jsonMapper.writeValueAsString(products); }
@RequiresPermissions({"categoryWord-delete"}) @RequestMapping( method = RequestMethod.POST, value = "/deleteCategoryWord2", headers = "Accept=application/json") public @ResponseBody boolean deleteCategoryWord2(@RequestBody CategoryWord categoryWord) throws Exception { OperationLog operationLog = systemLogService.record("类别词", "删除", "名称:" + categoryWord.getChineseWord()); String id = categoryWord.getId(); // 与元数据关联的不能删除 String esglisgAb = categoryWord.getEsglisgAb(); List<Metadata> metadatas = metadataService.findBy("categoryWordId", esglisgAb); if (metadatas.size() > 0) { return false; } categoryWordService.delete(categoryWord); systemLogService.updateResult(operationLog); return true; }
private void setControlActive( List<Control> controlList, List<Control> controlListForTable, String[] controlIds) { for (Control control : controlList) { control.setActive(false); for (int i = 0; i < controlIds.length; i++) { if (control.getId() == Long.parseLong(Utils.isEmpty(controlIds[i]) ? "0" : controlIds[i])) { control.setActive(true); } } controlListForTable.add(control); } }
@RequiresPermissions({"categoryWord-get"}) @RequestMapping( method = RequestMethod.GET, value = "/getAll", headers = "Accept=application/json") public @ResponseBody Map<String, Object> getAll(HttpServletRequest req) { int pageNo = Integer.parseInt(req.getParameter("page")); int rowCount = Integer.parseInt(req.getParameter("rows")); String englishWord = req.getParameter("englishWord"); String chineseWord = req.getParameter("chineseWord"); String esglisgAb = req.getParameter("esglisgAb"); String remark = req.getParameter("remark"); List<SearchCondition> searchConds = new ArrayList<SearchCondition>(); StringBuffer hql = new StringBuffer("select c from CategoryWord c where 1=1 "); if (null != englishWord && !"".equals(englishWord)) { hql.append(" and englishWord like ?"); searchConds.add(new SearchCondition("englishWord", "%" + englishWord + "%")); } if (null != chineseWord && !"".equals(chineseWord)) { hql.append(" and chineseWord like ?"); try { chineseWord = URLDecoder.decode(chineseWord, "utf-8"); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } searchConds.add(new SearchCondition("chineseWord", "%" + chineseWord + "%")); } if (null != esglisgAb && !"".equals(esglisgAb)) { hql.append(" and esglisgAb like ?"); searchConds.add(new SearchCondition("esglisgAb", "%" + esglisgAb + "%")); } if (null != remark && !"".equals(remark)) { hql.append(" and remark like ?"); try { remark = URLDecoder.decode(remark, "utf-8"); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } searchConds.add(new SearchCondition("remark", "%" + remark + "%")); } hql.append(" order by esglisgAb"); // Page page = categoryWordService.getAll(rowCount); Page page = new Page(); if (searchConds.size() <= 0) { page = categoryWordService.getPageBy(hql.toString(), rowCount); } else { page = categoryWordService.getPageBy(hql.toString(), rowCount, searchConds); } page.setPage(pageNo); List<CategoryWord> list = categoryWordService.findBy(hql.toString(), page, searchConds); HashMap<String, Object> map = new HashMap<String, Object>(); map.put("total", page.getResultCount()); map.put("rows", list); return map; }
// 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"; }
@SendTo("/topic/jobs/terms") @MessageMapping("/jobs/terms") public List<TechnicalTermResponse> countTechnicalTerms() { List<TechnicalTermResponse> terms = new LinkedList<>(); jsonConfigRepository .getSkillConfig() .stream() .forEach( term -> { Map<String, Double> avgSalary = vietnamWorksJobStatisticService.getAverageSalaryBySkill(term, JOB_LEVEL_ALL); terms.add( new TechnicalTermResponse.Builder() .withTerm(term.getKey()) .withLabel(term.getLabel()) .withCount(vietnamWorksJobStatisticService.count(term)) .withAverageSalaryMin(avgSalary.get("SALARY_MIN")) .withAverageSalaryMax(avgSalary.get("SALARY_MAX")) .build()); }); return terms; }
private Object[] getPossibleValues( MethodParameter methodParameter, AnnotatedParameters actionDescriptor) { try { Class<?> parameterType = methodParameter.getNestedParameterType(); Object[] possibleValues; Class<?> nested; if (Enum[].class.isAssignableFrom(parameterType)) { possibleValues = parameterType.getComponentType().getEnumConstants(); } else if (Enum.class.isAssignableFrom(parameterType)) { possibleValues = parameterType.getEnumConstants(); } else if (Collection.class.isAssignableFrom(parameterType) && Enum.class.isAssignableFrom( nested = TypeDescriptor.nested(methodParameter, 1).getType())) { possibleValues = nested.getEnumConstants(); } else { Select select = methodParameter.getParameterAnnotation(Select.class); if (select != null) { Class<? extends Options> optionsClass = select.options(); Options options = optionsClass.newInstance(); // collect call values to pass to options.get List<Object> from = new ArrayList<Object>(); for (String paramName : select.args()) { AnnotatedParameter parameterValue = actionDescriptor.getAnnotatedParameter(paramName); if (parameterValue != null) { from.add(parameterValue.getCallValue()); } } Object[] args = from.toArray(); possibleValues = options.get(select.value(), args); } else { possibleValues = new Object[0]; } } return possibleValues; } catch (Exception e) { throw new RuntimeException(e); } }
/** * 지정한 조건의 top10을 조회한다. * * @param clusterName Hadoop Cluster명 * @param searchType 조회 유형 * @param startDate 시작 날짜 * @param endDate 종료 날짜 * @return top10 목록 */ @RequestMapping(value = "top10", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) @ResponseBody public Response top10( @RequestParam(defaultValue = "") String clusterName, @RequestParam(defaultValue = "ACT") String searchType, @RequestParam(defaultValue = "") String startDate, @RequestParam(defaultValue = "") String endDate) { EngineService engineService = this.getEngineService(clusterName); FileSystemAuditRemoteService service = engineService.getFileSystemAuditRemoteService(); int level = getSessionUserLevel(); String username = level == 1 ? "" : getSessionUsername(); Response response = new Response(); List<Top10> top10s = service.auditTop10(startDate, endDate, searchType, username); response.getList().addAll(top10s); response.setTotal(top10s.size()); response.setSuccess(true); return response; }
@RequestMapping(value = "/proveedores", params = "term", produces = "application/json") public @ResponseBody List<LabelValueBean> proveedores( HttpServletRequest request, @RequestParam("term") String filtro) { for (String nombre : request.getParameterMap().keySet()) { log.debug("Param: {} : {}", nombre, request.getParameterMap().get(nombre)); } Map<String, Object> params = new HashMap<>(); params.put("empresa", request.getSession().getAttribute("empresaId")); params.put("filtro", filtro); params = proveedorDao.lista(params); List<LabelValueBean> valores = new ArrayList<>(); List<Proveedor> proveedores = (List<Proveedor>) params.get("proveedores"); for (Proveedor proveedor : proveedores) { StringBuilder sb = new StringBuilder(); sb.append(proveedor.getNombre()); sb.append(" | "); sb.append(proveedor.getRfc()); sb.append(" | "); sb.append(proveedor.getNombreCompleto()); valores.add(new LabelValueBean(proveedor.getId(), sb.toString(), proveedor.getNombre())); } return valores; }
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; }
@RequestMapping(value = "/events", method = GET, headers = "Authorization") public List<EventListItem> getAllEventsForExternal( Principal principal, HttpServletRequest request) { List<Integer> userOrganizations = userManager .findUserOrganizations(principal.getName()) .stream() .map(Organization::getId) .collect(Collectors.toList()); return eventManager .getActiveEvents() .stream() .filter(e -> userOrganizations.contains(e.getOrganizationId())) .sorted( (e1, e2) -> e1.getBegin() .withZoneSameInstant(ZoneId.systemDefault()) .compareTo(e2.getBegin().withZoneSameInstant(ZoneId.systemDefault()))) .map( s -> new EventListItem( s, request.getContextPath(), descriptionsLoader.eventDescriptions())) .collect(Collectors.toList()); }
@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; }
/** * Controller to get control list of transaction type * * @param request * @param model * @return */ @RequestMapping(value = "/icga/InternalCtrlGapAnalysisAC.html", method = RequestMethod.GET) public String getInternalControlGapAC(HttpServletRequest request, Model model) { List thirdPartyTransactionControlList = new ArrayList(); List generalLedgerTransactionControlList = new ArrayList(); List customerTransactionControlList = new ArrayList(); logger.debug("Existing controls start."); try { thirdPartyTransactionControlList = adminService.getControlListByTransactionType( TransactionType.THIRD_PARTY_TRANSACTION.getValue()); logger.debug( "Third Party Transaction Control list size = " + thirdPartyTransactionControlList.size()); generalLedgerTransactionControlList = adminService.getControlListByTransactionType(TransactionType.GENERAL_LEDGER.getValue()); logger.debug( "General Ledger Transaction Control list size = " + generalLedgerTransactionControlList.size()); customerTransactionControlList = adminService.getControlListByTransactionType( TransactionType.CUSTOMER_TRANSACTION.getValue()); logger.debug( "Customer Transaction Control list size = " + customerTransactionControlList.size()); } catch (Exception ex) { logger.debug("CERROR:: Internal Control Gap Analysis " + ex); } model.addAttribute("thirdPartyTransactionControlList", thirdPartyTransactionControlList); model.addAttribute("generalLedgerTransactionControlList", generalLedgerTransactionControlList); model.addAttribute("customerTransactionControlList", customerTransactionControlList); model.addAttribute("mainTabId", Utils.getMessageBundlePropertyValue("mainTab.icga")); model.addAttribute( "subTabId", Utils.getMessageBundlePropertyValue("subTabId.analyzeByControls")); adminService.addNode( Utils.getMessageBundlePropertyValue("landingPage.analyzeByControls"), 2, request); return "common/InternalCtrlGapAnalysisAC"; }