javax.validation.Valid Java Examples

The following examples show how to use javax.validation.Valid. 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
Source File: CallCenterSkillController.java    From youkefu with Apache License 2.0 6 votes vote down vote up
@RequestMapping(value = "/skill/delete")
@Menu(type = "callcenter" , subtype = "callcenterresource" , access = false , admin = true)
  public ModelAndView extentiondelete(ModelMap map , HttpServletRequest request , @Valid String id) {
CallCenterSkill skill = null;
skill = skillRes.findByIdAndOrgi(id, super.getOrgi(request));
if(skill != null) {
	String hostid = skill.getHostid();
	List<SkillExtention> skillExtentionList = skillExtentionRes.findBySkillidAndOrgi(id, super.getOrgi(request)) ;
	if(skillExtentionList.size() > 0 ) {
		skillExtentionRes.delete(skillExtentionList);
	}
	skillRes.delete(skill);
	return request(super.createRequestPageTempletResponse("redirect:/admin/callcenter/skill.html?hostid="+hostid));
}
return request(super.createRequestPageTempletResponse("redirect:/admin/callcenter/skill.html"));
  }
 
Example #2
Source File: ConfigsApi.java    From identity-api-server with Apache License 2.0 6 votes vote down vote up
@Valid
@GET
@Path("/provisioning/inbound/scim")

@Produces({ "application/json" })
@ApiOperation(value = "Retrieve Server Inbound SCIM configs", notes = "Retrieve Server Inbound SCIM Configs ", response = ScimConfig.class, authorizations = {
    @Authorization(value = "BasicAuth"),
    @Authorization(value = "OAuth2", scopes = {
        
    })
}, tags={ "Server Inbound SCIM", })
@ApiResponses(value = { 
    @ApiResponse(code = 200, message = "Successful Response", response = ScimConfig.class),
    @ApiResponse(code = 400, message = "Bad Request", response = Error.class),
    @ApiResponse(code = 401, message = "Unauthorized", response = Void.class),
    @ApiResponse(code = 403, message = "Forbidden", response = Void.class),
    @ApiResponse(code = 404, message = "Not Found", response = Error.class),
    @ApiResponse(code = 500, message = "Server Error", response = Error.class)
})
public Response getInboundScimConfigs() {

    return delegate.getInboundScimConfigs();
}
 
Example #3
Source File: SyncAdminApiAccountsController.java    From exchange-gateway-rest with Apache License 2.0 6 votes vote down vote up
@RequestMapping(value = "users", method = RequestMethod.POST)
@ResponseStatus(HttpStatus.CREATED)
public RestGenericResponse createUser(@Valid @RequestBody RestApiAddUser request) throws ExecutionException, InterruptedException {

    log.info("ADD USER >>> {}", request);

    ExchangeApi api = exchangeCore.getApi();
    CompletableFuture<OrderCommand> future = new CompletableFuture<>();
    api.createUser(request.getUid(), future::complete);

    OrderCommand cmd = future.get();
    log.info("<<< ADD USER {}", cmd);

    return RestGenericResponse.builder()
            .ticket(0)
            .gatewayResultCode(0)
            .coreResultCode(cmd.resultCode.getCode())
            .data(cmd.uid)
            .description(cmd.resultCode.toString())
            .build();

}
 
Example #4
Source File: OrganizationController.java    From youkefu with Apache License 2.0 6 votes vote down vote up
@RequestMapping("/save")
@Menu(type = "apps" , subtype = "organization")
public ModelAndView save(HttpServletRequest request ,@Valid Organization organization) throws NoSuchAlgorithmException, IOException {
	if(StringUtils.isBlank(organization.getName())|| organization.getName().length()>100) {
		return request(super.createRequestPageTempletResponse("redirect:/apps/tenant/index?msg=max_illegal"));	
	}
	organizationRes.save(organization) ;
	User user = super.getUser(request);
	if(user!=null) {
		User userTemp = userRes.getOne(user.getId());
		if(userTemp!=null&&StringUtils.isBlank(user.getOrgid())) {
			userTemp.setOrgid(organization.getId());
			userTemp.setOrgi(organization.getId());
			userRes.save(userTemp);
			super.setUser(request, userTemp);
		}
	}
	ModelAndView view = request(super.createRequestPageTempletResponse("redirect:/"));
	//登录成功 判断是否进入多租户页面
	SystemConfig systemConfig = UKTools.getSystemConfig();
	if(systemConfig!=null&&systemConfig.isEnabletneant()&&systemConfig.isTenantconsole()) {
		view = request(super.createRequestPageTempletResponse("redirect:/apps/tenant/index"));
	}
	return view;
}
 
Example #5
Source File: QuickReplyController.java    From youkefu with Apache License 2.0 6 votes vote down vote up
@RequestMapping("/type/update")
@Menu(type = "apps" , subtype = "kbs")
public ModelAndView typeupdate(HttpServletRequest request ,@Valid QuickType quickType) {
	QuickType tempQuickType = quickTypeRes.findByIdAndOrgi(quickType.getId(), super.getOrgi(request)) ;
	if(tempQuickType !=null){
		//判断名称是否重复
		QuickType qr = quickTypeRes.findByOrgiAndName(super.getOrgi(request),quickType.getName());
		if(qr!=null && !qr.getId().equals(quickType.getId())) {
			return request(super.createRequestPageTempletResponse("redirect:/setting/quickreply/index.html?msg=qr_type_exist&typeid="+quickType.getId()));
		}
		tempQuickType.setName(quickType.getName());
		tempQuickType.setDescription(quickType.getDescription());
		tempQuickType.setInx(quickType.getInx());
		tempQuickType.setParentid(quickType.getParentid());
		quickTypeRes.save(tempQuickType) ;
	}
	return request(super.createRequestPageTempletResponse("redirect:/setting/quickreply/index.html?typeid="+quickType.getId()));
}
 
Example #6
Source File: PermissionManageController.java    From WeBASE-Node-Manager with Apache License 2.0 6 votes vote down vote up
/**
 * revoke Permission.
 */
@DeleteMapping(value = "")
@PreAuthorize(ConstantProperties.HAS_ROLE_ADMIN)
public Object revokePermission(@RequestBody @Valid PermissionParam permissionParam,
                             BindingResult result) throws NodeMgrException {
    checkBindResult(result);
    Instant startTime = Instant.now();
    log.info("start revokePermission startTime:{} permissionParam:{}", startTime.toEpochMilli(),
            JsonTools.toJSONString(permissionParam));

    Object res = permissionManageService.revokePermission(permissionParam);

    log.info("end revokePermission useTime:{} result:{}",
            Duration.between(startTime, Instant.now()).toMillis(), JsonTools.toJSONString(res));

    return res;
}
 
Example #7
Source File: ApplicationsApi.java    From identity-api-server with Apache License 2.0 6 votes vote down vote up
@Valid
@PUT
@Path("/resident")
@Consumes({ "application/json" })
@Produces({ "application/json" })
@ApiOperation(value = "Update Resident Application ", notes = "This API provides the capability to update the Resident Application Configuration. <br>   <b>Permission required:</b> <br>       * /permission/admin/manage/identity/applicationmgt/update <br>   <b>Scope required:</b> <br>       * internal_application_mgt_update ", response = Void.class, authorizations = {
    @Authorization(value = "BasicAuth"),
    @Authorization(value = "OAuth2", scopes = {
        
    })
}, tags={ "Resident Application", })
@ApiResponses(value = { 
    @ApiResponse(code = 200, message = "Successful", response = Void.class),
    @ApiResponse(code = 201, message = "Successful response.", response = Void.class),
    @ApiResponse(code = 400, message = "Bad Request", response = Error.class),
    @ApiResponse(code = 401, message = "Unauthorized", response = Void.class),
    @ApiResponse(code = 403, message = "Forbidden", response = Void.class),
    @ApiResponse(code = 404, message = "Not Found", response = Error.class),
    @ApiResponse(code = 409, message = "Conflict", response = Error.class),
    @ApiResponse(code = 500, message = "Server Error", response = Error.class)
})
public Response updateResidentApplication(@ApiParam(value = "This represents the provisioning configuration of the resident application." ,required=true) @Valid ProvisioningConfiguration provisioningConfiguration) {

    return delegate.updateResidentApplication(provisioningConfiguration );
}
 
Example #8
Source File: ReportDesignController.java    From youkefu with Apache License 2.0 6 votes vote down vote up
/**
 * 异步 请求 报表的模板组件
 * 
 * @param map
 * @param request
 * @param template
 * @param id
 * @return
 * @throws Exception
 */
@RequestMapping("/exp")
@Menu(type = "report", subtype = "reportdesign")
public void exp(ModelMap map, HttpServletRequest request, HttpServletResponse response , @Valid String id,@Valid String publishedid, HashMap<String,String> semap) throws Exception {
	if (!StringUtils.isBlank(id)) {
		ReportModel model = this.getModel(id, super.getOrgi(request),publishedid);
		if (model != null && !StringUtils.isBlank(model.getPublishedcubeid())) {
			List<PublishedCube> cubeList = publishedCubeRepository.findByIdAndOrgi(model.getPublishedcubeid() , super.getOrgi(request));
			if(cubeList.size() > 0) {
				PublishedCube cube = cubeList.get(0) ;
				if (canGetReportData(model, cube.getCube())) {
					ReportData reportData = null ;
					try {
						reportData = reportCubeService.getReportData(model, cube.getCube(), request, true, semap) ;
						response.setHeader("content-disposition", "attachment;filename=UCKeFu-Report-"+new SimpleDateFormat("yyyy-MM-dd").format(new Date())+".xlsx");
						new UKExcelUtil(reportData , response.getOutputStream() , model.getName()).createFile() ;
						
					}catch(Exception ex) {
						map.addAttribute("msg",ex.getMessage());
					}
				}
			}
		}
	}
	return ;
}
 
Example #9
Source File: MemberLevelController.java    From ZTuoExchange_framework with MIT License 6 votes vote down vote up
@RequiresPermissions("member:member-level:update")
@PostMapping("update")
@AccessLog(module = AdminModule.MEMBER, operation = "更新会员等级MemberLevel")
@Transactional(rollbackFor = Exception.class)
public MessageResult update(@Valid MemberLevel memberLevel, BindingResult bindingResult) throws Exception {
    MessageResult result = BindingResultUtil.validate(bindingResult);
    if (result != null) {
        return result;
    }
    if (memberLevel.getId() == null) {
        return error("主键不得为空");
    }
    MemberLevel one = memberLevelService.findOne(memberLevel.getId());
    if (one == null) {
        return error("修改对象不存在");
    }
    if (memberLevel.getIsDefault() && !one.getIsDefault())
        //修改对象为默认 原本为false 则 修改默认的等级的isDefault为false
    {
        memberLevelService.updateDefault();
    }
    MemberLevel save = memberLevelService.save(memberLevel);
    return success(save);
}
 
Example #10
Source File: OrderController.java    From code with Apache License 2.0 6 votes vote down vote up
/**
 *  保存主订单以及订单详情
 * 1.参数校验()
 * 2.查询商品信息(调用商品服务)
 * 3.计算总价
 * 4.扣库存(调用商品服务)
 * 5.订单入库
 */
@PostMapping("/create")
public ResultVO<Map<String, String>> create(@Valid OrderForm orderForm,
                                            BindingResult bindingResult) {
    // 1.参数校验
    if (bindingResult.hasErrors()) {
        log.error("[创建订单]参数不正确, orderForm={}", orderForm);
        throw new OrderException(ResultEnum.PARAM_ERROR.getCode(),
                bindingResult.getFieldError().getDefaultMessage());
    }
    OrderDTO orderDTO = OrderForm2OrderDTOConvert.convert(orderForm);
    if (CollectionUtils.isEmpty(orderDTO.getOrderDetailList())) {
        log.error("[创建订单]购物车商品信息为空");
        throw new OrderException(ResultEnum.CART_EMPTY);
    }

    // 2.创建订单
    OrderDTO order = orderService.create(orderDTO);

    Map<String, String> map = new HashMap<>();
    map.put("orderId", order.getOrderId());

    return ResultVOUtil.success(map);

}
 
Example #11
Source File: TemplateController.java    From youkefu with Apache License 2.0 6 votes vote down vote up
@RequestMapping(  "/update")
  @Menu(type = "admin" , subtype = "template" , access = false , admin = true)
  public ModelAndView update(HttpServletRequest request  , @Valid Template template) {
  	Template oldTemplate = templateRes.findByIdAndOrgi(template.getId(), super.getOrgi(request)) ;
  	if(oldTemplate!=null){
  		SysDic dic = dicRes.findById(oldTemplate.getTemplettype());
  		if(dic!=null) {
  			oldTemplate.setCode(dic.getCode());
  		}
  		if(!StringUtils.isBlank(template.getCode())) {
  			oldTemplate.setCode(template.getCode());
  		}
  		oldTemplate.setName(template.getName());
  		oldTemplate.setLayoutcols(template.getLayoutcols());
  		oldTemplate.setIconstr(template.getIconstr());
  		oldTemplate.setDatatype(template.getDatatype());
  		oldTemplate.setCharttype(template.getCharttype());
  		templateRes.save(oldTemplate) ;
  		
  		CacheHelper.getSystemCacheBean().delete(template.getId(), super.getOrgi(request)) ;
  	}
return request(super.createRequestPageTempletResponse("redirect:/admin/template/list.html?type="+template.getTemplettype()));
  }
 
Example #12
Source File: AppsController.java    From youkefu with Apache License 2.0 6 votes vote down vote up
@RequestMapping({"/apps/invite"})
@Menu(type="apps", subtype="invite")
public ModelAndView invite(ModelMap map , HttpServletRequest request , @Valid String id) throws Exception{
	OnlineUser onlineUser = onlineUserRes.findOne(id) ;
	if(onlineUser!=null){
		onlineUser.setInvitestatus(UKDataContext.OnlineUserInviteStatus.INVITE.toString());
		onlineUser.setInvitetimes(onlineUser.getInvitetimes()+1);
		onlineUserRes.save(onlineUser) ;
		OnlineUserUtils.sendWebIMClients(onlineUser.getSessionid() , onlineUser.getUserid() , "invite");
		InviteRecord record = new InviteRecord() ;
		record.setAgentno(super.getUser(request).getId());
		record.setUserid(onlineUser.getUserid());
		record.setAppid(onlineUser.getAppid());
		record.setOrgi(super.getOrgi(request));
		inviteRecordRes.save(record) ;
	}
	
	return request(super.createRequestPageTempletResponse("redirect:/apps/content.html"));
}
 
Example #13
Source File: OrderMatchInputResources.java    From match-trade with Apache License 2.0 6 votes vote down vote up
/**
 * @Title: addNewOrder
 * @Description: TODO(添加新的订单)
 * @param  参数
 * @return void 返回类型
 * @throws
 */
@PostMapping("/cancelOrder")
public JsonResult<Object> cancelOrder(@RequestBody @Valid CancelOrderParam param, BindingResult result) {
	try {
		JsonResult<Object> res=new JsonResult<Object>();
		if (result.hasErrors()) { //参数校验失败
			return res.error(result, messageSource);
		}
		//查看是否是可以撤销的状态
		template.send("cancel_order", param.toJsonString());
		return res.success("操作成功!");
	} catch (Exception e) {
		log.error("添加新的订单错误:"+e);
		e.printStackTrace();
		return new JsonResult<Object>(e);
	}
}
 
Example #14
Source File: TodoResource.java    From quarkus-deep-dive with Apache License 2.0 6 votes vote down vote up
@PATCH
@Path("/{id}")
@Transactional
@Counted(name = "updateCount", monotonic = true, description = "How many update calls have been done.")
@Timed(name = "updateTime", description = "How long does the update method takes.", unit = MetricUnits.MILLISECONDS)
public Response update(@Valid Todo todo, @PathParam("id") Long id) {
    Todo entity = Todo.findById(id);
    if (entity == null) {
        throw new WebApplicationException("Item with id of " + id + " does not exist.", 404);
    }
    entity.id = id;
    entity.completed = todo.completed;
    entity.order = todo.order;
    entity.title = todo.title;
    entity.url = todo.url;
    return Response.ok(entity).build();
}
 
Example #15
Source File: ReportController.java    From youkefu with Apache License 2.0 6 votes vote down vote up
@RequestMapping("/expids")
@Menu(type = "setting" , subtype = "reportexpids")
public void expids(ModelMap map , HttpServletRequest request , HttpServletResponse response , @Valid String[] ids) throws IOException {
	if(ids!=null && ids.length > 0){
		Iterable<Report> topicList = reportRes.findAll(Arrays.asList(ids)) ;
		MetadataTable table = metadataRes.findByTablename("uk_report") ;
		List<Map<String,Object>> values = new ArrayList<Map<String,Object>>();
		for(Report topic : topicList){
			values.add(UKTools.transBean2Map(topic)) ;
		}
		
		response.setHeader("content-disposition", "attachment;filename=UCKeFu-Report-"+new SimpleDateFormat("yyyy-MM-dd").format(new Date())+".xls");  
		if(table!=null){
			ExcelExporterProcess excelProcess = new ExcelExporterProcess( values, table, response.getOutputStream()) ;
			excelProcess.process();
		}
	}
	
    return ;
}
 
Example #16
Source File: UserResource.java    From alchemy with Apache License 2.0 6 votes vote down vote up
/**
 * {@code PUT /users} : Updates an existing User.
 *
 * @param userDTO the user to update.
 * @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the updated user.
 * @throws EmailAlreadyUsedException {@code 400 (Bad Request)} if the email is already in use.
 * @throws LoginAlreadyUsedException {@code 400 (Bad Request)} if the login is already in use.
 */
@PutMapping("/users")
@PreAuthorize("hasRole(\"" + AuthoritiesConstants.ADMIN + "\")")
public ResponseEntity<UserDTO> updateUser(@Valid @RequestBody UserDTO userDTO) {
    log.debug("REST request to update User : {}", userDTO);
    Optional<User> existingUser = userRepository.findOneByEmailIgnoreCase(userDTO.getEmail());
    if (existingUser.isPresent() && (!existingUser.get().getId().equals(userDTO.getId()))) {
        throw new EmailAlreadyUsedException();
    }
    existingUser = userRepository.findOneByLogin(userDTO.getLogin().toLowerCase());
    if (existingUser.isPresent() && (!existingUser.get().getId().equals(userDTO.getId()))) {
        throw new LoginAlreadyUsedException();
    }
    Optional<UserDTO> updatedUser = userService.updateUser(userDTO);

    return ResponseUtil.wrapOrNotFound(updatedUser,
        HeaderUtil.createAlert(applicationName, "userManagement.updated", userDTO.getLogin()));
}
 
Example #17
Source File: CoinController.java    From ZTuoExchange_framework with MIT License 6 votes vote down vote up
@RequiresPermissions("system:coin:update")
@PostMapping("update")
@AccessLog(module = AdminModule.SYSTEM, operation = "更新后台货币Coin")
public MessageResult update(
        @Valid Coin coin,
        @SessionAttribute(SysConstant.SESSION_ADMIN) Admin admin,
        String code,
        BindingResult bindingResult) {

    Assert.notNull(admin, messageSource.getMessage("DATA_EXPIRED_LOGIN_AGAIN"));
    MessageResult checkCode = checkCode(code, SysConstant.ADMIN_COIN_REVISE_PHONE_PREFIX + admin.getMobilePhone());
    if (checkCode.getCode() != 0) {
        return checkCode;
    }

    notNull(coin.getName(), "validate coin.name!");
    MessageResult result = BindingResultUtil.validate(bindingResult);
    if (result != null) {
        return result;
    }
    Coin one = coinService.findOne(coin.getName());
    notNull(one, "validate coin.name!");
    coinService.save(coin);
    return success();
}
 
Example #18
Source File: SolutionResource.java    From cubeai with Apache License 2.0 5 votes vote down vote up
/**
 * PUT  /solutions/download-count : Updates an existing solution's downloadCount.
 * @param jsonObject the JSONObject with soluton id to be updated
 * @return the ResponseEntity with status 200 (OK) and with body the updated solution, or status 400 (Bad Request)
 */
@PutMapping("/solutions/download-count")
@Timed
public ResponseEntity<Solution> updateSolutionDownloadCount(@Valid @RequestBody JSONObject jsonObject) {
    log.debug("REST request to update Solution download count : {}", jsonObject);

    Solution solution = solutionRepository.findOne(jsonObject.getLong("id"));
    solution.setDownloadCount(solution.getDownloadCount() + 1);
    solution.setLastDownload(Instant.now());
    solution.setModifiedDate(Instant.now()); // 每次更新时修改modifiedDate
    Solution result = solutionRepository.save(solution);

    return ResponseEntity.ok().body(result);
}
 
Example #19
Source File: CallCenterIvrController.java    From youkefu with Apache License 2.0 5 votes vote down vote up
@RequestMapping(value = "/ivr/update")
  @Menu(type = "callcenter" , subtype = "extention" , access = false , admin = true)
  public ModelAndView extentionupdate(ModelMap map , HttpServletRequest request , @Valid Extention extention) {
if(!StringUtils.isBlank(extention.getId())){
	Extention ext = extentionRes.findByIdAndOrgi(extention.getId(), super.getOrgi(request)) ;
	ext.setExtention(extention.getExtention());
	ext.setDescription(extention.getDescription());
	extentionRes.save(ext) ;
}
return request(super.createRequestPageTempletResponse("redirect:/admin/callcenter/ivr.html?hostid="+extention.getHostid()));
  }
 
Example #20
Source File: MetaManyToManyController.java    From youran with Apache License 2.0 5 votes vote down vote up
@Override
@PostMapping(value = "/save")
@ResponseStatus(HttpStatus.CREATED)
public ResponseEntity<MetaManyToManyShowVO> save(@Valid @RequestBody MetaManyToManyAddDTO metaManyToManyAddDTO) throws Exception {
    MetaManyToManyPO metaManyToManyPO = metaManyToManyService.save(metaManyToManyAddDTO);
    return ResponseEntity.created(new URI(apiPath + "/meta_mtm/" + metaManyToManyPO.getMtmId()))
        .body(MetaManyToManyMapper.INSTANCE.toShowVO(metaManyToManyPO));
}
 
Example #21
Source File: BlockDetailInfoController.java    From WeBASE-Collect-Bee with Apache License 2.0 5 votes vote down vote up
@PostMapping("/blockHeight/get")
@ApiOperation(value = "get block height detail", httpMethod = "POST")
public CommonResponse getBlockDetailInfoByBlockHeight(@RequestBody @Valid BlockHeightQueryReq req,
        BindingResult result) {
    if (result.hasErrors()) {
        return ResponseUtils.validateError(result);
    }
    return blockDetailInfoManager.getBlockDetailInfoByBlockHeight(req);
}
 
Example #22
Source File: ApiOrganController.java    From youkefu with Apache License 2.0 5 votes vote down vote up
/**
 * 新增或修改部门
 * @param request
 * @param user
 * @return
 */
@RequestMapping(method = RequestMethod.PUT)
@Menu(type = "apps" , subtype = "organ" , access = true)
@ApiOperation("新增或修改部门")
   public ResponseEntity<RestResult> put(HttpServletRequest request , @Valid Organ organ) {
   	if(organ != null && !StringUtils.isBlank(organ.getName())){
   		organRepository.save(organ) ;
   	}
       return new ResponseEntity<>(new RestResult(RestResultType.OK), HttpStatus.OK);
   }
 
Example #23
Source File: SettingRoleController.java    From youkefu with Apache License 2.0 5 votes vote down vote up
/**
 * 部门分配- 跳转部门列表
 * @param map
 * @param request
 * @param parent
 * @param area
 * @return
 */
@RequestMapping("/role/organ")
@Menu(type = "callout" , subtype = "productcon")
public ModelAndView callagentorganlist(ModelMap map , HttpServletRequest request , @Valid String organ) {
	
	map.addAttribute("organList",organRes.findByOrgiAndParent(super.getOrgi(request), organ));
	map.addAttribute("currentorgan",organ);
	
	List<Organ> organList = organRes.findByOrgiAndParent(super.getOrgi(request), organ);
	map.addAttribute("organList", organList);
	
	return request(super.createRequestPageTempletResponse("/apps/setting/role/organlist")) ; 
}
 
Example #24
Source File: CallCenterExtentionController.java    From youkefu with Apache License 2.0 5 votes vote down vote up
@RequestMapping(value = "/extention/update")
    @Menu(type = "callcenter" , subtype = "extention" , access = false , admin = true)
    public ModelAndView extentionupdate(ModelMap map , HttpServletRequest request , @Valid Extention extention) {
		if(!StringUtils.isBlank(extention.getId())){
			Extention ext = extentionRes.findByIdAndOrgi(extention.getId(), super.getOrgi(request)) ;
			if(ext!=null){
//				ext.setExtention(extention.getExtention());//分机号不能修改
				if(!StringUtils.isBlank(extention.getPassword())){
					ext.setPassword(extention.getPassword());
				}
				ext.setPlaynum(extention.isPlaynum());
				ext.setCallout(extention.isCallout());
				ext.setRecord(extention.isRecord());
				ext.setExtype(extention.getExtype());
				ext.setSubtype(extention.getSubtype());
				ext.setDescription(extention.getDescription());
				
				ext.setMediapath(extention.getMediapath());
				
				ext.setSiptrunk(extention.getSiptrunk());
				ext.setEnablewebrtc(extention.isEnablewebrtc());
				
				ext.setUpdatetime(new Date());
				extentionRes.save(ext) ;
				
				List<CallCenterAgent> callOutAgentList = CallOutQuene.extention(ext.getExtention()) ;
				for(CallCenterAgent callOutAgent : callOutAgentList) {
					callOutAgent.setSiptrunk(ext.getSiptrunk());
					CacheHelper.getCallCenterAgentCacheBean().put(callOutAgent.getUserid(), callOutAgent, callOutAgent.getOrgi());
				}
			}
		}
		return request(super.createRequestPageTempletResponse("redirect:/admin/callcenter/extention.html?hostid="+extention.getHostid()));
    }
 
Example #25
Source File: AreaController.java    From youkefu with Apache License 2.0 5 votes vote down vote up
@RequestMapping("/delete")
@Menu(type = "admin" , subtype = "area")
public ModelAndView delete(HttpServletRequest request ,@Valid AreaType area) {
	AreaType areaType = areaRepository.findByIdAndOrgi(area.getId(), super.getOrgi(request)) ;
	if(areaType!=null){
		areaRepository.delete(areaType);
		UKTools.initSystemArea();
	}
	return request(super.createRequestPageTempletResponse("redirect:/admin/area/index.html"));
}
 
Example #26
Source File: MemberApplicationConfigController.java    From ZTuoExchange_framework with MIT License 5 votes vote down vote up
@RequiresPermissions("system:member-application-config:merge")
@PostMapping("merge")
@AccessLog(module = AdminModule.SYSTEM, operation = "实名认证配置修改")
public MessageResult merge(@Valid MemberApplicationConfig memberApplicationConfig, BindingResult bindingResult){
    MessageResult result = BindingResultUtil.validate(bindingResult);
    if(result!=null) {
        return result ;
    }
    memberApplicationConfigService.save(memberApplicationConfig);
    return MessageResult.getSuccessInstance("保存成功",memberApplicationConfig);
}
 
Example #27
Source File: NoticeController.java    From youkefu with Apache License 2.0 5 votes vote down vote up
@RequestMapping(value = "/edit/save")
  @Menu(type = "notice" , subtype = "noticebus")
  public ModelAndView editsave(ModelMap map , HttpServletRequest request , @Valid String id ,@Valid Notice notice) {
String msg="edit_failure";
ModelAndView view = request(super.createRequestPageTempletResponse("redirect:/notice/business/detail.html?id="+id+"&msg="+msg));
if (UKDataContext.NoticeType.SYSTEMUPGRADE.toString().equals(notice.getType())) {
	request(super.createRequestPageTempletResponse("redirect:/notice/system/detail.html?id="+id+"&msg="+msg));
}
if (!StringUtils.isBlank(id)) {
	Notice notic = noticeRes.findByIdAndOrgi(id, super.getOrgi(request));
	if (notic != null) {
		
		notic.setContent(notice.getContent());
		notic.setKeyword(notice.getKeyword());
		notic.setSummary(notice.getSummary());
		notic.setTags(notice.getTags());
		notic.setTitle(notice.getTitle());
		notic.setUpdatetime(new Date());
		notic.setSmsserver(notice.getSmsserver());
		notic.setSmstemplate(notice.getSmstemplate());
		notic.setEmailserver(notice.getEmailserver());
		notic.setEmailtemplate(notice.getEmailtemplate());
		noticeRes.save(notic) ;
		msg = "edit_success" ;
		view = request(super.createRequestPageTempletResponse("redirect:/notice/business/detail.html?id="+id+"&msg="+msg));
		if (UKDataContext.NoticeType.SYSTEMUPGRADE.toString().equals(notic.getType())) {
			request(super.createRequestPageTempletResponse("redirect:/notice/system/detail.html?id="+id+"&msg="+msg));
		}
	}
}
return view ;
  }
 
Example #28
Source File: UserController.java    From cola with MIT License 5 votes vote down vote up
@ApiOperation(value = "修改密码")
@PostMapping("/updatePassword")
public ResponseEntity<UserDto> updatePassword(@RequestBody @Valid @ApiParam("修改密码参数") UpdatePasswordDto updatePasswordDto,
											  @AuthenticationPrincipal AuthenticatedUser authenticatedUser) {

	updatePasswordDto.setId(authenticatedUser.getId());
	userService.updatePassword(updatePasswordDto);

	return ResponseEntity.ok().build();
}
 
Example #29
Source File: CubeController.java    From youkefu with Apache License 2.0 5 votes vote down vote up
@RequestMapping("/list")
@Menu(type = "report" , subtype = "cube" )
public ModelAndView list(ModelMap map , HttpServletRequest request , @Valid String typeid) {
	//List<CubeType> cubeTypeList = cubeTypeRes.findByOrgi(super.getOrgi(request)) ; 
	if(!StringUtils.isBlank(typeid)){
    	map.put("cubeType", cubeTypeRes.findByIdAndOrgi(typeid, super.getOrgi(request))) ;
		map.put("cubeList", cubeRes.getByOrgiAndTypeid(super.getOrgi(request) , typeid , new PageRequest(super.getP(request), super.getPs(request)))) ;
	}else{
		map.put("cubeList", cubeRes.getByOrgi(super.getOrgi(request), new PageRequest(super.getP(request), super.getPs(request)))) ;
	}
	//map.put("pubCubeTypeList", cubeTypeList) ;
	map.put("typeid", typeid);
	return request(super.createRequestPageTempletResponse("/apps/business/report/cube/list"));
}
 
Example #30
Source File: InventoryApi.java    From springdoc-openapi with Apache License 2.0 5 votes vote down vote up
@Operation(description = "adds an inventory item", operationId = "addInventory", summary = "Adds an item to the system", tags = {
		"admins", })
@ApiResponses(value = { @ApiResponse(responseCode = "201", description = "item created"),
		@ApiResponse(responseCode = "400", description = "invalid input, object invalid"),
		@ApiResponse(responseCode = "409", description = "an existing item already exists") })
@PostMapping(value = "/inventory", consumes = { "application/json" })
ResponseEntity<Void> addInventory(
		@io.swagger.v3.oas.annotations.parameters.RequestBody(description = "Inventory item to do") @Valid @RequestBody InventoryItem body);