Search in sources :

Example 71 with PostMapping

use of org.springframework.web.bind.annotation.PostMapping in project zhcet-web by zhcet-amu.

the class NotificationSendingController method handleSentNotification.

@PostMapping
public String handleSentNotification(@Valid Notification notification, BindingResult bindingResult, RedirectAttributes redirectAttribute) {
    User user = userService.getLoggedInUser().orElseThrow(() -> new AccessDeniedException("403"));
    if (bindingResult.hasErrors()) {
        redirectAttribute.addFlashAttribute("notification", notification);
        redirectAttribute.addFlashAttribute("org.springframework.validation.BindingResult.notification", bindingResult);
    } else {
        notification.setSender(user);
        notificationSendingService.sendNotification(notification);
        redirectAttribute.addFlashAttribute("notification_success", "Notification sending in background");
    }
    return "redirect:/management/notification/send";
}
Also used : AccessDeniedException(org.springframework.security.access.AccessDeniedException) User(amu.zhcet.data.user.User) PostMapping(org.springframework.web.bind.annotation.PostMapping)

Example 72 with PostMapping

use of org.springframework.web.bind.annotation.PostMapping in project paascloud-master by paascloud.

the class UacDictCommonController method checkDictCode.

/**
 * 检测菜单编码是否已存在
 *
 * @param mdcDictCheckCodeDto the mdc dict check code dto
 *
 * @return the wrapper
 */
@PostMapping(value = "/checkDictCode")
@ApiOperation(httpMethod = "POST", value = "检测数据字典编码是否已存在")
public Wrapper<Boolean> checkDictCode(@ApiParam(name = "uacMenuCheckCodeDto", value = "id与url") @RequestBody MdcDictCheckCodeDto mdcDictCheckCodeDto) {
    logger.info("检测数据字典编码是否已存在 mdcDictCheckCodeDto={}", mdcDictCheckCodeDto);
    Long id = mdcDictCheckCodeDto.getDictId();
    String dictCode = mdcDictCheckCodeDto.getDictCode();
    Example example = new Example(MdcDict.class);
    Example.Criteria criteria = example.createCriteria();
    if (id != null) {
        criteria.andNotEqualTo("id", id);
    }
    criteria.andEqualTo("dictCode", dictCode);
    int result = mdcDictService.selectCountByExample(example);
    return WrapMapper.ok(result < 1);
}
Also used : Example(tk.mybatis.mapper.entity.Example) PostMapping(org.springframework.web.bind.annotation.PostMapping) ApiOperation(io.swagger.annotations.ApiOperation)

Example 73 with PostMapping

use of org.springframework.web.bind.annotation.PostMapping in project paascloud-master by paascloud.

the class UacDictCommonController method checkDictName.

/**
 * 检测数据字典名称是否已存在.
 *
 * @param mdcDictCheckNameDto the mdc dict check name dto
 *
 * @return the wrapper
 */
@PostMapping(value = "/checkDictName")
@ApiOperation(httpMethod = "POST", value = "检测数据字典名称是否已存在")
public Wrapper<Boolean> checkDictName(@ApiParam(name = "uacMenuCheckCodeDto", value = "id与url") @RequestBody MdcDictCheckNameDto mdcDictCheckNameDto) {
    logger.info("检测数据字典名称是否已存在 mdcDictCheckNameDto={}", mdcDictCheckNameDto);
    Long id = mdcDictCheckNameDto.getDictId();
    String dictName = mdcDictCheckNameDto.getDictName();
    Example example = new Example(MdcDict.class);
    Example.Criteria criteria = example.createCriteria();
    if (id != null) {
        criteria.andNotEqualTo("id", id);
    }
    criteria.andEqualTo("dictName", dictName);
    int result = mdcDictService.selectCountByExample(example);
    return WrapMapper.ok(result < 1);
}
Also used : Example(tk.mybatis.mapper.entity.Example) PostMapping(org.springframework.web.bind.annotation.PostMapping) ApiOperation(io.swagger.annotations.ApiOperation)

Example 74 with PostMapping

use of org.springframework.web.bind.annotation.PostMapping in project paascloud-master by paascloud.

the class MdcExceptionMainController method queryLogListWithPage.

/**
 * 异常日志列表.
 *
 * @param mdcExceptionQueryDto the mdc exception query dto
 *
 * @return the wrapper
 */
@PostMapping(value = "/queryListWithPage")
@ApiOperation(httpMethod = "POST", value = "查询日志列表")
public Wrapper queryLogListWithPage(@ApiParam(name = "mdcExceptionQueryDto", value = "异常查询条件") @RequestBody MdcExceptionQueryDto mdcExceptionQueryDto) {
    logger.info("查询日志处理列表 mdcExceptionQueryDto={}", mdcExceptionQueryDto);
    PageInfo pageInfo = mdcExceptionLogService.queryExceptionListWithPage(mdcExceptionQueryDto);
    return WrapMapper.ok(pageInfo);
}
Also used : PageInfo(com.github.pagehelper.PageInfo) PostMapping(org.springframework.web.bind.annotation.PostMapping) ApiOperation(io.swagger.annotations.ApiOperation)

Example 75 with PostMapping

use of org.springframework.web.bind.annotation.PostMapping in project paascloud-master by paascloud.

the class EmailController method sendRestEmailCode.

/**
 * 发送短信验证码.
 *
 * @param sendEmailMessage the send email message
 *
 * @return the wrapper
 */
@PostMapping(value = "/sendRestEmailCode")
@ApiOperation(httpMethod = "POST", value = "发送注册短信验证码")
public Wrapper<String> sendRestEmailCode(@RequestBody SendEmailMessage sendEmailMessage) {
    LoginAuthDto loginAuthDto = this.getLoginAuthDto();
    emailService.sendEmailCode(sendEmailMessage, loginAuthDto.getLoginName());
    return WrapMapper.ok();
}
Also used : LoginAuthDto(com.paascloud.base.dto.LoginAuthDto) PostMapping(org.springframework.web.bind.annotation.PostMapping) ApiOperation(io.swagger.annotations.ApiOperation)

Aggregations

PostMapping (org.springframework.web.bind.annotation.PostMapping)83 ApiOperation (io.swagger.annotations.ApiOperation)21 Profile (com.erudika.scoold.core.Profile)20 Post (com.erudika.scoold.core.Post)9 Example (tk.mybatis.mapper.entity.Example)8 HashMap (java.util.HashMap)7 Service (org.apereo.cas.authentication.principal.Service)6 ResponseEntity (org.springframework.http.ResponseEntity)6 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)6 LoginAuthDto (com.paascloud.base.dto.LoginAuthDto)5 AuthenticationResult (org.apereo.cas.authentication.AuthenticationResult)5 RegisteredService (org.apereo.cas.services.RegisteredService)5 User (amu.zhcet.data.user.User)4 Report (com.erudika.scoold.core.Report)4 IOException (java.io.IOException)4 Map (java.util.Map)4 Credential (org.apereo.cas.authentication.Credential)4 Reply (com.erudika.scoold.core.Reply)3 Log (io.github.tesla.ops.common.Log)3 LinkedHashMap (java.util.LinkedHashMap)3