Java Code Examples for org.springframework.web.bind.annotation.RequestMethod#POST

The following examples show how to use org.springframework.web.bind.annotation.RequestMethod#POST . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
/**
 * API to post a bunch of strings
 *
 */
@ApiOperation(value = APIOperation.KEY_SET_POST_VALUE, notes = APIOperation.KEY_SET_POST_NOTES)
@RequestMapping(value = APIV2.KEY_SET_POST, method = RequestMethod.POST, produces = { API.API_CHARSET })
@ResponseStatus(HttpStatus.OK)
public APIResponseDTO postSources(
		@ApiParam(name = APIParamName.PRODUCT_NAME, required = true, value = APIParamValue.PRODUCT_NAME) @PathVariable(APIParamName.PRODUCT_NAME) String productName,
		@ApiParam(name = APIParamName.VERSION, required = true, value = APIParamValue.VERSION) @PathVariable(value = APIParamName.VERSION) String version,
		@ApiParam(name = APIParamName.LOCALE, required = true, value = APIParamValue.LOCALE) @PathVariable(value = APIParamName.LOCALE) String locale,
		@ApiParam(name = APIParamName.COMPONENT, required = true, value = APIParamValue.COMPONENT) @PathVariable(APIParamName.COMPONENT) String component,
		@RequestBody List<KeySourceCommentDTO> sourceSet,
		@ApiParam(name = APIParamName.COLLECT_SOURCE, value = APIParamValue.COLLECT_SOURCE) @RequestParam(value = APIParamName.COLLECT_SOURCE, required = false, defaultValue = "false") String collectSource,
		HttpServletRequest request) throws JsonProcessingException {
	request.setAttribute(ConstantsKeys.KEY, ConstantsKeys.JSON_KEYSET);
	ObjectMapper mapper = new ObjectMapper();
	String requestJson = mapper.writeValueAsString(sourceSet);
	if (!StringUtils.isEmpty(requestJson)) {
		request.setAttribute(ConstantsKeys.SOURCE, requestJson);
	}
	return super.handleResponse(APIResponseStatus.OK, "Recieved the sources and comments(please use translation-product-component-api to confirm it).");
}
 
Example 2
Source Project: SSMBlogv2   File: UploadfileController.java    License: MIT License 6 votes vote down vote up
@RequestMapping(value = "uploadImg", method = RequestMethod.POST)
public void uploadImg(
		HttpServletRequest request,
		HttpServletResponse response,
		@RequestParam(value = "editormd-image-file", required = false) MultipartFile file) {
		log.info("upload img");
	try {
		request.setCharacterEncoding("utf-8");
		response.setHeader("Content-Type", "text/html");
		String suffix = file.getOriginalFilename().substring(
                file.getOriginalFilename().lastIndexOf("."));
		String filePath = "/upload/" + DateUtil.getDays() + "/" + Myutil.random(5) + suffix;
		String resultPath = UploadUtil.uploadImg(filePath, file.getInputStream());
		System.out.println("path="+resultPath);
		response.getWriter().write( "{\"success\": 1, \"message\":\"�ϴ��ɹ�\",\"url\":\"" + filePath + "\"}" );
	} catch (Exception e) {
		e.printStackTrace();
		log.error("upload failed ", e);
		try {
			response.getWriter().write( "{\"success\": 0, \"message\":\"�ϴ�ʧ��\",\"url\":\""+ "\"}" );
		} catch (IOException e1) {
			e1.printStackTrace();
		}
	}
}
 
Example 3
@RequestMapping(value = { "/student/change-pwd" }, method = RequestMethod.POST)
public @ResponseBody Message changePassword(@RequestBody User user){
	Message message = new Message();
	UserInfo userInfo = (UserInfo) SecurityContextHolder.getContext()
			.getAuthentication().getPrincipal();
	try{
		String password = user.getPassword() + "{" + userInfo.getUsername() + "}";
		PasswordEncoder passwordEncoder = new StandardPasswordEncoderForSha1();
		String resultPassword = passwordEncoder.encode(password);
		user.setPassword(resultPassword);
		user.setUserName(userInfo.getUsername());
		userService.updateUserPwd(user, null);
	}catch(Exception e){
		e.printStackTrace();
		message.setResult(e.getClass().getName());
	}
	
	return message;
}
 
Example 4
/**
 * 编辑
 * @return
 */
@RequestMapping(params = "doEdit",method ={RequestMethod.GET, RequestMethod.POST})
@ResponseBody
public AjaxJson doEdit(@ModelAttribute AlipayReceivetext alipayReceivetext){
	AjaxJson j = new AjaxJson();
	try {
		alipayReceivetextDao.update(alipayReceivetext);
		j.setMsg("编辑成功");
	} catch (Exception e) {
	    log.info(e.getMessage());
		j.setSuccess(false);
		j.setMsg("编辑失败");
	}
	return j;
}
 
Example 5
Source Project: NFVO   File: RestNetworkServiceRecord.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * This operation is used to execute a script (or a command) on a specific VNF record during
 * runtime
 *
 * @param idNsr : the id of Network Service Record
 * @param idVnfr : the id of Virtual Network Function Record
 * @throws NotFoundException
 */
@ApiOperation(
    value = "Execute a script (or a command) on a specific VNF record of a specific NS record",
    notes =
        "Executes a script inside the given VNFR. The id of NSR and the id of the VNFR are specified in the URL")
@RequestMapping(value = "{idNsr}/vnfrecords/{idVnfr}/execute-script", method = RequestMethod.POST)
@ResponseStatus(HttpStatus.NO_CONTENT)
public void executeScript(
    @PathVariable("idNsr") String idNsr,
    @PathVariable("idVnfr") String idVnfr,
    @RequestHeader(value = "project-id") String projectId,
    @RequestBody String scriptContent)
    throws InterruptedException, ExecutionException, NotFoundException, BadFormatException {

  VirtualNetworkFunctionRecord vnfr =
      networkServiceRecordManagement.getVirtualNetworkFunctionRecord(idNsr, idVnfr, projectId);

  // TODO: generate randomly script name
  String scriptName = "ob_runtime_script";
  Script script = new Script();
  script.setName(scriptName);
  script.setPayload(scriptContent.getBytes());

  log.info("Executing script: " + script + " on VNFR: " + vnfr.getName());
  log.info("Script content:\n----------\n" + scriptContent + "\n----------\n");
  networkServiceRecordManagement.executeScript(idNsr, idVnfr, projectId, script);
}
 
Example 6
Source Project: batch-scheduler   File: ArgumentController.java    License: MIT License 5 votes vote down vote up
@RequestMapping(method = RequestMethod.POST)
@ResponseBody
public String postArgumentDefine(HttpServletResponse response, HttpServletRequest request) {
    ArgumentDefineEntity argumentDefine = parse(request);

    if (argumentDefine.getArgId().isEmpty()) {
        response.setStatus(421);
        return Hret.error(421, "参数编码必须由1-30位字母、数字组成", null);
    }

    if (argumentDefine.getArgDesc().isEmpty()) {
        response.setStatus(421);
        return Hret.error(421, "请输入详细的参数描述信息", null);
    }

    if (argumentDefine.getArgType() == null) {
        response.setStatus(421);
        return Hret.error(421, "请选择参数类型", null);
    }

    if ("1".equals(argumentDefine.getArgType()) && argumentDefine.getArgValue().isEmpty()) {
        response.setStatus(421);
        return Hret.error(421, "请填写固定参数,参数值", null);
    }

    if ("4".equals(argumentDefine.getArgType()) && argumentDefine.getBindAsOfDate() == null) {
        response.setStatus(421);
        return Hret.error(421, "批次类型参数,请选择是否与数据日期绑定", null);
    }
    RetMsg retMsg = argumentService.addArgument(argumentDefine);
    if (SysStatus.SUCCESS_CODE == retMsg.getCode()) {
        return Hret.success(retMsg);
    }
    response.setStatus(421);
    return Hret.error(retMsg);
}
 
Example 7
@RequestMapping(value = "/multipartfilearray", method = RequestMethod.POST)
public String processMultipartFileArray(@RequestParam(required = false) MultipartFile[] file,
		@RequestPart(required = false) Map<String, String> json, Model model) throws IOException {

	if (file != null && file.length > 0) {
		byte[] content = file[0].getBytes();
		Assert.assertArrayEquals(content, file[1].getBytes());
		model.addAttribute("fileContent", content);
	}
	if (json != null) {
		model.addAttribute("jsonContent", json);
	}

	return "redirect:/index";
}
 
Example 8
Source Project: MonitorClient   File: Communication.java    License: Apache License 2.0 5 votes vote down vote up
/**
   * 移除对应的文件
   * @data 2017年4月23日
   * @param request
   * @return
   */
  @RequestMapping(value="/editFile",method=RequestMethod.POST, produces = "application/json; charset=utf-8")
  public String editFile(HttpServletRequest request){
  	try{
  		int token =  Integer.parseInt(DataUtil.decode(request.getParameter("_"),aESHander));
   	int token1 = Integer.parseInt(DataUtil.getTimeStamp());
   	if( Math.abs(token1 - token) >60){
   		return DataUtil.toJson(returnMessage(-12,"Edit File"));
   	}
  	}catch (Exception e) {
	IOC.log.error(e.getMessage());
	return DataUtil.toJson(returnMessage(-8,"Edit File"));
}
  	String indexPath = DataUtil.slashDeal(DataUtil.decode(request.getParameter("indexPath"),aESHander));
  	String fileName = indexPath.substring(indexPath.lastIndexOf(File.separator));
  	byte[] contentBytes = DataUtil.urlDecode(request.getParameter("content")).getBytes();   // 暂定

  	// 先放入缓存文件中
  	ConfigBean configBean = IOC.instance().getClassobj(ConfigBean.class);
  	String cachFileStr = configBean.getCachPath()+File.separator+fileName;
  	File file = new File(cachFileStr);
  	if(file.exists()){
  		FileUtil.deleteAll(file);
  	}
FileUtil.write(cachFileStr, contentBytes,false);

  	if(repaireThread.edit(indexPath,cachFileStr))
      {
	return DataUtil.toJson(returnMessage(1,"Edit File: "+indexPath));
      }    		        
 
  	return DataUtil.toJson(returnMessage(-2,"Edit File"+indexPath));
  }
 
Example 9
Source Project: onboard   File: SigninController.java    License: Apache License 2.0 5 votes vote down vote up
@RequestMapping(value = "/signin", method = RequestMethod.POST)
@ResponseBody
public UserDTO signIn(@RequestBody User user) throws Exception {
    User currentUser = userService.login(user.getEmail(), user.getPassword());

    if (currentUser != null) {
        return UserTransform.userToUserDTO(currentUser);
    } else {
        throw new NoPermissionException("用户名或密码错误");
    }
}
 
Example 10
/**
 * Updates the survey logo
 * @param file
 * @param surveyDefinitionId
 * @param proceed
 * @param principal
 * @param uiModel
 * @param httpServletRequest
 * @return
 */
@SuppressWarnings("unchecked")
@Secured({"ROLE_ADMIN","ROLE_SURVEY_ADMIN"})
@RequestMapping(value = "/logo",method = RequestMethod.POST, produces = "text/html")
public String updateLogo(@RequestParam("file") MultipartFile file,
		@RequestParam("id") Long surveyDefinitionId,
		@RequestParam(value = "_proceed", required = false) String proceed,
		Principal principal,
		Model uiModel, HttpServletRequest httpServletRequest) {
	try {
		User user = userService.user_findByLogin(principal.getName());
		//Check if the user is authorized
		if(!securityService.userIsAuthorizedToManageSurvey(surveyDefinitionId, user)) {
			log.warn("Unauthorized access to url path " + httpServletRequest.getPathInfo() + " attempted by user login:" + principal.getName() + "from IP:" + httpServletRequest.getLocalAddr());
			return "accessDenied";	
		}
		
		GlobalSettings globalSettings = applicationSettingsService.getSettings();
		
		//validate content type
		if (file.isEmpty() || !globalSettings.getValidImageTypesAsList().contains(file.getContentType().toLowerCase())) {
			uiModel.addAttribute("surveyDefinition", surveySettingsService.surveyDefinition_findById(surveyDefinitionId));
			uiModel.addAttribute("invalidFile", true);
			return "settings/surveyDefinitions/logo";
		} 
		
		SurveyDefinition surveyDefinition =surveySettingsService.surveyDefinition_updateLogo(surveyDefinitionId,file.getBytes());
		uiModel.asMap().clear();
		return "settings/surveyDefinitions/saved";
	}
	catch (Exception e) {
		log.error(e.getMessage(),e);
		throw (new RuntimeException(e));
	}	

}
 
Example 11
Source Project: songjhh_blog   File: UserController.java    License: Apache License 2.0 5 votes vote down vote up
@RequestMapping(value = "/login",method = RequestMethod.POST)
public String login(UserCustom userCustom, Model model) {
    Subject subject = SecurityUtils.getSubject();
    if(!subject.isAuthenticated()) {
        UsernamePasswordToken token = new UsernamePasswordToken(userCustom.getUsername(), userCustom.getPassword());
        token.setRememberMe(true);
        try {
            subject.login(token);
            Session session = subject.getSession();
            userService.updateLoginLastTime(userService.getByUserName(userCustom.getUsername()),session);
            return "redirect:/";
        } catch (UnknownAccountException uae) {
            model.addAttribute("errorMsg", "username wasn't in the system.");
        } catch (IncorrectCredentialsException ice){
            model.addAttribute("errorMsg", "password didn't match.");
        } catch (LockedAccountException lae) {
            model.addAttribute("errorMsg", "account for that username is locked - can't login.");
        } catch (ExcessiveAttemptsException  eae) {
            model.addAttribute("errorMsg", "password lost miss too much,please try again later.");
        } catch (AuthenticationException ae) {
            model.addAttribute("errorMsg", "unexpected condition.");
        }
        model.addAttribute("userCustom", userCustom);
        return "user/login";
    }
    return "redirect:/";
}
 
Example 12
Source Project: spring-boot   File: ZTreeController.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * add
 *
 * @return
 */
@RequestMapping(value = "/add.html", method = RequestMethod.POST)
@ResponseBody
public String add(@RequestParam(value = "name", required = true) String name,
                  @RequestParam(value = "level", required = true) Integer level,
                  @RequestParam(value = "index", required = true) Integer index,
                  @RequestParam(value = "pId", required = true) Long pId,
                  @RequestParam(value = "isParent", required = true) boolean isParent, @RequestParam(value = "menu_type", required = false) TreeNodeType menuType) {
    logger.info("add new treeNode : name={},level={},index={},pId={},isParent={} , menuType={}", name, level, index, pId, isParent, menuType);

    treeNodeService.add(name, level, index, isParent, pId, menuType);
    return "add succeed.";
}
 
Example 13
Source Project: steady   File: ApplicationController.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * Provides application-specific changes required to update the current dependency to the provided one.
 * Requires that the given dependency has a valid library Id.
 *
 * @return 404 {@link HttpStatus#NOT_FOUND} if application with given GAV does not exist, 200 {@link HttpStatus#OK} if the application is found
 * @param mvnGroup a {@link java.lang.String} object.
 * @param artifact a {@link java.lang.String} object.
 * @param version a {@link java.lang.String} object.
 * @param digest a {@link java.lang.String} object.
 * @param otherVersion a {@link com.sap.psr.vulas.backend.model.LibraryId} object.
 * @param space a {@link java.lang.String} object.
 */
@RequestMapping(value = "/{mvnGroup:.+}/{artifact:.+}/{version:.+}/deps/{digest}/updateChanges", method = RequestMethod.POST, consumes = {"application/json;charset=UTF-8"}, produces = {"application/json;charset=UTF-8"})
@JsonView(Views.DepDetails.class) // extends View LibDetails that allows to see the properties
public ResponseEntity<com.sap.psr.vulas.backend.model.DependencyUpdate> getUpdateChanges(@PathVariable String mvnGroup, @PathVariable String artifact, @PathVariable String version, @PathVariable String digest, @RequestBody LibraryId otherVersion,
		@ApiIgnore @RequestHeader(value=Constants.HTTP_SPACE_HEADER, required=false) String space) {

	Space s = null;
	try {
		s = this.spaceRepository.getSpace(space);
	} catch (Exception e){
		log.error("Error retrieving space: " + e);
		return new ResponseEntity<com.sap.psr.vulas.backend.model.DependencyUpdate>(HttpStatus.NOT_FOUND);
	}
	try {

		// To throw an exception if the entity is not found
		final Application a = ApplicationRepository.FILTER.findOne(this.appRepository.findByGAV(mvnGroup,artifact,version,s));

		final Dependency dep = a.getDependency(digest);
		if(dep==null) {
			log.error("App " + a.toString() + " has no dependency with digest [" + digest + "]: No update changes will be returned");
			return new ResponseEntity<com.sap.psr.vulas.backend.model.DependencyUpdate>(HttpStatus.NOT_FOUND);
		}

		// Pre-requisite: The dependency has to have a library id known to Maven
		if(dep.getLib().getLibraryId()==null) {
			log.error("App " + a.toString() + " dependency with digest [" + digest + "] has no library id");
			return new ResponseEntity<com.sap.psr.vulas.backend.model.DependencyUpdate>(HttpStatus.BAD_REQUEST);
		}

		dep.setTraces(this.traceRepository.findTracesOfLibrary(a, dep.getLib()));
		final JarDiffResult jdr = ServiceWrapper.getInstance().diffJars(dep.getLib().getLibraryId().toSharedType(), otherVersion.toSharedType());

		final DependencyUpdate depUpdate = new DependencyUpdate(dep.getLib().getLibraryId(),otherVersion);


		// Metrics related to touch points (from traces or static analysis)
		final Collection<TouchPoint> touch_points = dep.getTouchPoints();

		if(touch_points!=null) {

			Set<TouchPoint> callsToModify = new HashSet<TouchPoint>();


			for(TouchPoint tp: touch_points) {
				// Only A2L is relevant, as only this direction requires modification at app side
				if(tp.getDirection()==TouchPoint.Direction.A2L) {
					if(jdr.isDeleted(tp.getTo().toSharedType())) {
						callsToModify.add(tp);
						log.debug("Touch point callee " + tp.getTo().toString() + " deleted from " + dep.getLib().getLibraryId().toString() + " to " + otherVersion);
					}
				}
			}


			depUpdate.setCallsToModify(callsToModify);

		}

		return new ResponseEntity<com.sap.psr.vulas.backend.model.DependencyUpdate>(depUpdate, HttpStatus.OK);
	}
	catch(ServiceConnectionException sce) {
		return new ResponseEntity<com.sap.psr.vulas.backend.model.DependencyUpdate>(HttpStatus.INTERNAL_SERVER_ERROR);
	}
	catch(EntityNotFoundException enfe) {
		return new ResponseEntity<com.sap.psr.vulas.backend.model.DependencyUpdate>(HttpStatus.NOT_FOUND);
	}
}
 
Example 14
@RequestMapping(value = "usergroup/add", method = RequestMethod.POST)
@ApiOperation(value = "新增用户组", httpMethod = "POST")
public @ResponseBody WrapperResponse<String> addUserGroup(@RequestBody AddUserGroupParam param){
	permissionService.addUserGroup(LoginContext.getIntFormatUserId(), param);
	return new WrapperResponse<>();
}
 
Example 15
@RequestMapping(value = "/getProvCityArea", method = RequestMethod.POST)
public List<AreaDto> getProvCityArea(@RequestBody AreaDto areaDto);
 
Example 16
@RequestMapping(method = RequestMethod.POST, value = "/acl/user/generic/")
public @ResponseBody HttpEntity<List<String>> addACLUserGeneric(
		@RequestBody UserACLRequestSet aclSet) {
	List<String> result = new ArrayList<String>();
	try {
		SecurityACLDAO securityACLDAO = beanFactory.getBean(
				Constants.SECURITYACL_DAO, SecurityACLDAO.class);

		logger.debug("entityList size:" + aclSet.getAclList().size());
		String entityId = null;
		for (UserACLRequest acl : aclSet.getAclList()) {
			entityId = acl.getEntityId();
			String repoName = classToRepoMap.get(acl.getEntityClassName());
			CrudRepository repo = getRepo(repoName);
			AbstractSecuredEntity securedEntity = (AbstractSecuredEntity) repo
					.findOne(Long.parseLong(entityId));
			if (securedEntity == null) {
				result.add("Entity of type " + acl.getEntityClassName()
						+ " with id " + acl.getEntityId() + " not found");
				continue;
			}
			UserEntity userEntity = userEntityRepo.findByUsername(acl
					.getUserName());
			if (userEntity == null) {
				result.add("User " + acl.getUserName() + " not found");
				continue;
			}
			boolean res = securityACLDAO.addAccessControlEntry(
					securedEntity,
					new PrincipalSid(userEntity.getUsername()),
					getPermissionFromNumber(acl.getPermission()));
			if (res) {
				// on sucess don't add msg to result list
				logger.debug("Added ACL for:" + acl.toString());
			} else {
				result.add("Failed to add ACL for:" + acl.toString());
			}
		}
	} catch (Exception e) {
		logger.warn("", e);
		result.add("Exception:" + e.getMessage());
	}
	if (result.isEmpty()) {
		result.add("Successfully added all ACLs");
		return new ResponseEntity<List<String>>(result, HttpStatus.OK);
	} else {
		return new ResponseEntity<List<String>>(result, HttpStatus.OK);
	}
}
 
Example 17
Source Project: PhotoAlbum-api   File: PhotoController.java    License: MIT License 4 votes vote down vote up
@RequestMapping(method = RequestMethod.POST)
public ResponseEntity<?> createPhoto(@Valid @RequestBody PhotoRequest photoRequest) {
  return new ResponseEntity<>(this.photoService.createPhoto(photoRequest), HttpStatus.CREATED);
}
 
Example 18
Source Project: wind-im   File: ConfigManageController.java    License: Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("unchecked")
@RequestMapping(method = RequestMethod.POST, value = "/updateConfig")
@ResponseBody
public String updateSiteConfig(HttpServletRequest request, @RequestBody byte[] bodyParam) {
	try {
		PluginProto.ProxyPluginPackage pluginPackage = PluginProto.ProxyPluginPackage.parseFrom(bodyParam);

		String siteUserId = getRequestSiteUserId(pluginPackage);

		if (!isManager(siteUserId)) {
			throw new UserPermissionException("Current user is not a manager");
		}
		Map<String, String> dataMap = GsonUtils.fromJson(pluginPackage.getData(), Map.class);
		logger.info("siteUserId={} update config={}", siteUserId, dataMap);
		Map<Integer, String> configMap = new HashMap<Integer, String>();
		if (StringUtils.isNotEmpty(trim(dataMap.get("site_name")))) {
			configMap.put(ConfigProto.ConfigKey.SITE_NAME_VALUE, trim(dataMap.get("site_name")));
		}
		if (StringUtils.isNotEmpty(trim(dataMap.get("site_address")))) {
			configMap.put(ConfigProto.ConfigKey.SITE_ADDRESS_VALUE, trim(dataMap.get("site_address")));
		}
		if (StringUtils.isNotEmpty(trim(dataMap.get("site_port")))) {
			configMap.put(ConfigProto.ConfigKey.SITE_PORT_VALUE, trim(dataMap.get("site_port")));
		}
		if (StringUtils.isNotEmpty(trim(dataMap.get("group_members_count")))) {
			configMap.put(ConfigProto.ConfigKey.GROUP_MEMBERS_COUNT_VALUE,
					trim(dataMap.get("group_members_count")));
		}
		if (StringUtils.isNotEmpty(trim(dataMap.get("pic_path")))) {
			configMap.put(ConfigProto.ConfigKey.PIC_PATH_VALUE, trim(dataMap.get("pic_path")));
		}
		if (StringUtils.isNotEmpty(dataMap.get("site_logo"))) {
			configMap.put(ConfigProto.ConfigKey.SITE_LOGO_VALUE, dataMap.get("site_logo"));
		}
		if (StringUtils.isNotEmpty(dataMap.get("uic_status"))) {
			configMap.put(ConfigProto.ConfigKey.INVITE_CODE_STATUS_VALUE, dataMap.get("uic_status"));
		}
		if (StringUtils.isNotEmpty(dataMap.get("realName_status"))) {
			configMap.put(ConfigProto.ConfigKey.REALNAME_STATUS_VALUE, dataMap.get("realName_status"));
		}
		if (StringUtils.isNotEmpty(dataMap.get("u2_encryption_status"))) {
			configMap.put(ConfigProto.ConfigKey.U2_ENCRYPTION_STATUS_VALUE, dataMap.get("u2_encryption_status"));
		}

		if (StringUtils.isNotEmpty(dataMap.get("add_friends_status"))) {
			configMap.put(ConfigProto.ConfigKey.CONFIG_FRIEND_REQUEST_VALUE, dataMap.get("add_friends_status"));
		}

		if (StringUtils.isNotEmpty(dataMap.get("create_groups_status"))) {
			configMap.put(ConfigProto.ConfigKey.CONFIG_CREATE_GROUP_VALUE, dataMap.get("create_groups_status"));
		}

		if (StringUtils.isNotEmpty(dataMap.get("group_qrcode_expire_time"))) {
			configMap.put(ConfigProto.ConfigKey.GROUP_QR_EXPIRE_TIME_VALUE,
					dataMap.get("group_qrcode_expire_time"));
		}

		if (StringUtils.isNotEmpty(dataMap.get("push_client_status"))) {
			configMap.put(ConfigProto.ConfigKey.PUSH_CLIENT_STATUS_VALUE, dataMap.get("push_client_status"));
		}
		if (StringUtils.isNotEmpty(dataMap.get("log_level"))) {
			String logLevel = dataMap.get("log_level");
			configMap.put(ConfigProto.ConfigKey.LOG_LEVEL_VALUE, logLevel);
			Level level = Level.INFO;
			if ("DEBUG".equalsIgnoreCase(logLevel)) {
				level = Level.DEBUG;
			} else if ("ERROR".equalsIgnoreCase(logLevel)) {
				level = Level.ERROR;
			}
			// 更新日志级别
			AkxLog4jManager.setLogLevel(level);
		}
		// 普通管理员无权限
		if (isAdmin(siteUserId) && StringUtils.isNotEmpty(trim(dataMap.get("site_manager")))) {
			configMap.put(ConfigProto.ConfigKey.SITE_MANAGER_VALUE, trim(dataMap.get("site_manager")));
		}
		if (configManageService.updateSiteConfig(siteUserId, configMap)) {
			return SUCCESS;
		}
	} catch (InvalidProtocolBufferException e) {
		logger.error("update site config error", e);
	} catch (UserPermissionException u) {
		logger.error("update site config error : " + u.getMessage());
		return NO_PERMISSION;
	}
	return ERROR;
}
 
Example 19
/**
 * whk2000 사용자 웹훅 연결 테스트
 * @param 
 * @return 
 * @exception Exception
 */
@RequestMapping(method=RequestMethod.POST, value="/whk/whk2000/whk2000/selectWhk2000WebhookConnectTest.do")
public ModelAndView selectWhk2000WebhookConnectTest(HttpServletRequest request, HttpServletResponse response, ModelMap model ) throws Exception {
	try{
		
		//리퀘스트에서 넘어온 파라미터를 맵으로 세팅
		Map<String, String> paramMap = RequestConvertor.requestParamToMapAddSelInfo(request, true);
		
		//사용자 명
		String usrNm = paramMap.get("whkRegUsrNm");
		
		//플랫폼 종류
		String platformTypeCd = paramMap.get("platformTypeCd");
		
		//사용자 웹훅 url
		String webhookUrl = paramMap.get("webhookUrl");
		
		//웹훅 내용
		String inMessage = "["+usrNm+"] 님께서 Webhook 연결을 시도합니다.";
		
		//타입에 따라 등록, 수정
		String proStatus = paramMap.get("proStatus");
		
		//등록
		if("I".equals(proStatus)){
			inMessage += "\n- 연결을 성공했습니다.";
		}
		//수정
		else{
			inMessage += "\n- 옵션 항목이 수정되었습니다.";
		}
		
		//사용자 웹훅 테스트
		webhookSend.webhookConnectTest(inMessage, webhookUrl, platformTypeCd);
		
		//오류 발생한경우 오류 내역 전송
		model.addAttribute("returnData", webhookSend.getReturnDataList());
		return new ModelAndView("jsonView", model);
	}
	catch(UserDefineException ude) {
		//조회실패 메시지 세팅
		model.addAttribute("returnData", webhookSend.getReturnDataList());
		return new ModelAndView("jsonView", model);
	}
	catch(Exception ex){
		Log.error("selectWhk2000WebhookConnectTest()", ex);
		
		//조회실패 메시지 세팅
		model.addAttribute("message", egovMessageSource.getMessage("fail.request.msg"));
		return new ModelAndView("jsonView", model);
	}
}
 
Example 20
/**
 * 获取用户任务
 *
 * @param user 用户信息
 */
@RequestMapping(value = "/getUserTasks", method = RequestMethod.POST)
public List<ComplaintDto> getUserTasks(@RequestBody AuditUser user);