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 Project: ZTuoExchange_framework   Author: sengeiou   File: CoinController.java    License: 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 #2
Source Project: youkefu   Author: zhangyanbo2007   File: CallCenterSkillController.java    License: 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 #3
Source Project: youkefu   Author: zhangyanbo2007   File: ReportController.java    License: 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 #4
Source Project: youkefu   Author: zhangyanbo2007   File: AppsController.java    License: 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 #5
Source Project: code   Author: lastwhispers   File: OrderController.java    License: 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 #6
Source Project: identity-api-server   Author: wso2   File: ApplicationsApi.java    License: 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 #7
Source Project: WeBASE-Node-Manager   Author: WeBankFinTech   File: PermissionManageController.java    License: 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 #8
Source Project: youkefu   Author: zhangyanbo2007   File: OrganizationController.java    License: 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 #9
Source Project: exchange-gateway-rest   Author: exchange-core   File: SyncAdminApiAccountsController.java    License: 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 #10
Source Project: youkefu   Author: zhangyanbo2007   File: QuickReplyController.java    License: 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 #11
Source Project: youkefu   Author: zhangyanbo2007   File: ReportDesignController.java    License: 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 #12
Source Project: youkefu   Author: zhangyanbo2007   File: TemplateController.java    License: 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 #13
Source Project: identity-api-server   Author: wso2   File: ConfigsApi.java    License: 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 #14
Source Project: ZTuoExchange_framework   Author: homeyanmi   File: MemberLevelController.java    License: 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 #15
Source Project: match-trade   Author: sdgdsffdsfff   File: OrderMatchInputResources.java    License: 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 #16
Source Project: quarkus-deep-dive   Author: cescoffier   File: TodoResource.java    License: 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 #17
Source Project: alchemy   Author: binglind   File: UserResource.java    License: 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 #18
Source Project: springdoc-openapi   Author: springdoc   File: InventoryItem.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Get id
 *
 * @return id
 **/
@Schema(example = "d290f1ee-6c54-4b01-90e6-d701748f0851", required = true)
@NotNull

@Valid
public UUID getId() {
	return id;
}
 
Example #19
Source Project: flair-engine   Author: viz-centric   File: QueryResource.java    License: Apache License 2.0 5 votes vote down vote up
@PostMapping(value = "/queries/{connectionLinkId}", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public ResponseEntity<String> executeQuery(@PathVariable String connectionLinkId, @Valid @RequestBody QueryDTO queryDTO) throws JSONException, SQLException {
    log.info(" Connection name with out metadata : " + connectionLinkId);
    Connection connection = connectionService.findByConnectionLinkId(connectionLinkId);
    if (connection == null) {
        return ResponseEntity.badRequest().body(null);
    }
    FlairQuery query = new FlairQuery(queryDTO.interpret(), queryDTO.isMetaRetrieved());
    return ResponseEntity.ok(queryService.executeQuery(connection, query).getResult());
}
 
Example #20
Source Project: identity-api-server   Author: wso2   File: InboundProtocolListItem.java    License: Apache License 2.0 5 votes vote down vote up
@ApiModelProperty(example = "/t/carbon.super/api/server/v1/applications/29048810-1447-4ea0-a348-30d15ab65fa3/inbound-protocols/saml", required = true, value = "")
@JsonProperty("self")
@Valid
@NotNull(message = "Property self cannot be null.")

public String getSelf() {
    return self;
}
 
Example #21
Source Project: youkefu   Author: zhangyanbo2007   File: ApiIMController.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 返回访客历史消息
 * @param request
 * @param userid	访客ID
 * @p 分页信息
 * @return
 */
@RequestMapping(value = "/satis")
@Menu(type = "apps" , subtype = "webim" , access = true)
@ApiOperation("获取满意度调查")
   public ResponseEntity<RestResult> satis(HttpServletRequest request , @Valid String orgi) {
	Map<String,Object> statfMap = new HashMap<String,Object>();
	statfMap.put("commentList" , UKeFuDic.getInstance().getDic(UKDataContext.UKEFU_SYSTEM_COMMENT_DIC)) ;
	statfMap.put("commentItemList" , UKeFuDic.getInstance().getDic(UKDataContext.UKEFU_SYSTEM_COMMENT_ITEM_DIC)) ;
       return new ResponseEntity<>(new RestResult(RestResultType.OK, statfMap), HttpStatus.OK);
   }
 
Example #22
Source Project: springdoc-openapi   Author: springdoc   File: TweetController.java    License: Apache License 2.0 5 votes vote down vote up
@ApiResponses(value = { @ApiResponse(responseCode = "200", description = "update Tweet"),
		@ApiResponse(responseCode = "404", description = "tweet not found") })
@PutMapping("/tweets/{id}")
public Mono<ResponseEntity<TweetDTO>> updateTweet(@PathVariable(value = "id") String tweetId,
		@Valid @RequestBody TweetDTO tweetDTO) {
	return null;
}
 
Example #23
Source Project: youran   Author: cai3178940   File: MetaFieldController.java    License: Apache License 2.0 5 votes vote down vote up
@Override
@PostMapping(value = "/save")
@ResponseStatus(HttpStatus.CREATED)
public ResponseEntity<MetaFieldShowVO> save(@Valid @RequestBody MetaFieldAddDTO metaFieldAddDTO) throws Exception {
    if (metaFieldAddDTO.getDefaultValue() == null) {
        metaFieldAddDTO.setDefaultValue(GenerateConst.METAFIELD_NULL_VALUE);
    }
    MetaFieldPO metaFieldPO = metaFieldService.save(metaFieldAddDTO);
    return ResponseEntity.created(new URI(apiPath + "/meta_field/" + metaFieldPO.getFieldId()))
        .body(MetaFieldMapper.INSTANCE.toShowVO(metaFieldPO));
}
 
Example #24
Source Project: spring-microservice-exam   Author: wells2333   File: DeptController.java    License: MIT License 5 votes vote down vote up
/**
 * 更新部门
 *
 * @param dept dept
 * @return ResponseBean
 * @author tangyi
 * @date 2018/8/28 10:22
 */
@PutMapping
@AdminTenantTeacherAuthorization
@ApiOperation(value = "更新部门信息", notes = "根据部门id更新部门的基本信息")
@ApiImplicitParam(name = "dept", value = "部门实体", required = true, dataType = "Dept")
@Log("更新部门")
public ResponseBean<Boolean> update(@RequestBody @Valid Dept dept) {
    dept.setCommonValue(SysUtil.getUser(), SysUtil.getSysCode(), SysUtil.getTenantCode());
    return new ResponseBean<>(deptService.update(dept) > 0);
}
 
Example #25
Source Project: youkefu   Author: zhangyanbo2007   File: UsersResourceController.java    License: Apache License 2.0 5 votes vote down vote up
@RequestMapping("/bpm/users")
  @Menu(type = "res" , subtype = "users")
  public ModelAndView bpmusers(ModelMap map , HttpServletRequest request , @Valid String q , @Valid String id) {
if(q==null){
	q = "" ;
}
map.addAttribute("usersList", getUsers(request, q)) ;
      return request(super.createRequestPageTempletResponse("/public/bpmusers"));
  }
 
Example #26
Source Project: youkefu   Author: zhangyanbo2007   File: ApiIMController.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 设置消息有用
 * @param request
 * @param userid	访客ID
 * @p 分页信息
 * @return
 */
@RequestMapping(value = "/message/useful")
@Menu(type = "apps" , subtype = "webim" , access = true)
@ApiOperation("获取满意度调查")
   public ResponseEntity<RestResult> useful(HttpServletRequest request , @Valid String orgi , @Valid String id) {
	if(!StringUtils.isBlank(id)){
   		ChatMessage chatMessage = chatMessageRes.findById(id) ;
   		chatMessage.setUseful(true);
   		chatMessage.setUsetime(new Date());
   		chatMessageRes.save(chatMessage) ;
   	}
       return new ResponseEntity<>(new RestResult(RestResultType.OK), HttpStatus.OK);
   }
 
Example #27
Source Project: youkefu   Author: zhangyanbo2007   File: ContactsController.java    License: Apache License 2.0 5 votes vote down vote up
@RequestMapping(  "/embed/save")
  @Menu(type = "contacts" , subtype = "embedsave")
  public ModelAndView embedsave(HttpServletRequest request  , @Valid Contacts contacts, @Valid String ani) {
contacts.setCreater(super.getUser(request).getId());
contacts.setOrgi(super.getOrgi(request));
contacts.setOrgan(super.getUser(request).getOrgan());
contacts.setPinyin(PinYinTools.getInstance().getFirstPinYin(contacts.getName()));
if(StringUtils.isBlank(contacts.getCusbirthday())) {
	contacts.setCusbirthday(null);
}
contactsRes.save(contacts) ;
      return request(super.createRequestPageTempletResponse("redirect:/apps/contacts/embed/index.html"+(!StringUtils.isBlank(ani) ? "?ani="+ani : null)));
  }
 
Example #28
Source Project: springdoc-openapi   Author: springdoc   File: PetApi.java    License: Apache License 2.0 5 votes vote down vote up
@Operation(summary = "Add a new pet to the store", description = "", security = {
		@SecurityRequirement(name = "petstore_auth", scopes = { "write:pets", "read:pets" }) }, tags = { "pet" })
@ApiResponses(value = { @ApiResponse(responseCode = "405", description = "Invalid input") })
@PostMapping(value = "/pet", consumes = { "application/json", "application/xml" })
default void addPet(
		@io.swagger.v3.oas.annotations.parameters.RequestBody(description = "Pet object that needs to be added to the store", required = true) @Valid @RequestBody Pet pet) {
	// return getDelegate().addPet(pet);
}
 
Example #29
Source Project: we-cmdb   Author: WeBankPartners   File: ApiV2Controller.java    License: Apache License 2.0 5 votes vote down vote up
@PostMapping("/users/create")
public List<UserDto> createUsers(@Valid @RequestBody List<UserDto> userDtos) {
    userDtos.forEach(userDto->{
        if (StringUtils.isBlank(userDto.getPassword())) {
            userDto.setPassword(passwordEncoder.encode(userDto.getUsername()));
        } else {
            userDto.setPassword(passwordEncoder.encode(userDto.getPassword()));
        }
    });
    return staticDtoService.create(UserDto.class, userDtos);
}
 
Example #30
Source Project: youkefu   Author: zhangyanbo2007   File: AgentController.java    License: Apache License 2.0 5 votes vote down vote up
@RequestMapping("/summary/edit")
  @Menu(type = "workorders" , subtype = "add" , access = false)
  public ModelAndView editSummary(ModelMap map , HttpServletRequest request , @Valid String contactsid, @Valid String userid , @Valid String agentserviceid, @Valid String agentuserid, @Valid String id ,@Valid String sort) {
map.addAttribute("userid", userid);
map.addAttribute("contactsid", contactsid);
map.addAttribute("agentserviceid", agentserviceid);
map.addAttribute("agentuserid", agentuserid);
AgentServiceSummary summary = serviceSummaryRes.findByIdAndOrgi(id, super.getOrgi(request));
map.addAttribute("summary", summary);
map.addAttribute("sort", sort);
map.addAttribute("tagsSummary", tagRes.findByOrgiAndTagtype(super.getOrgi(request) , UKDataContext.ModelType.SUMMARY.toString())) ;
      return request(super.createRequestPageTempletResponse("/apps/agent/editsummary"));
  }