Search in sources :

Example 81 with PostMapping

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

the class OpcFileController method queryAttachment.

/**
 * 根据ID查询附件信息.
 *
 * @param id the id
 *
 * @return the wrapper
 */
@PostMapping(value = "/queryAttachmentById/{id}")
@ApiOperation(httpMethod = "POST", value = "根据ID查询附件信息")
public Wrapper<OptAttachmentRespDto> queryAttachment(@PathVariable Long id) {
    logger.info("queryAttachment -根据ID查询文件信息. id={}", id);
    OptAttachmentRespDto optAttachmentRespDto = optAttachmentService.queryAttachmentById(id);
    return WrapMapper.ok(optAttachmentRespDto);
}
Also used : OptAttachmentRespDto(com.paascloud.provider.model.dto.attachment.OptAttachmentRespDto) PostMapping(org.springframework.web.bind.annotation.PostMapping) ApiOperation(io.swagger.annotations.ApiOperation)

Example 82 with PostMapping

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

the class PtcPayController method alipayCallback.

/**
 * 支付宝回调信息.
 *
 * @param request the request
 *
 * @return the object
 */
@PostMapping("/alipayCallback")
@ApiOperation(httpMethod = "POST", value = "支付宝回调信息")
public Object alipayCallback(HttpServletRequest request) {
    logger.info("收到支付宝回调信息");
    Map<String, String> params = Maps.newHashMap();
    Map requestParams = request.getParameterMap();
    for (Object o : requestParams.keySet()) {
        String name = (String) o;
        String[] values = (String[]) requestParams.get(name);
        String valueStr = "";
        for (int i = 0; i < values.length; i++) {
            valueStr = (i == values.length - 1) ? valueStr + values[i] : valueStr + values[i] + ",";
        }
        params.put(name, valueStr);
    }
    logger.info("支付宝回调,sign:{},trade_status:{},参数:{}", params.get("sign"), params.get("trade_status"), params.toString());
    // 非常重要,验证回调的正确性,是不是支付宝发的.并且呢还要避免重复通知.
    params.remove("sign_type");
    try {
        boolean alipayRSACheckedV2 = AlipaySignature.rsaCheckV2(params, Configs.getAlipayPublicKey(), "utf-8", Configs.getSignType());
        if (!alipayRSACheckedV2) {
            return WrapMapper.error("非法请求,验证不通过,再恶意请求我就报警找网警了");
        }
    } catch (AlipayApiException e) {
        logger.error("支付宝验证回调异常", e);
    }
    // todo 验证各种数据
    Wrapper serverResponse = ptcAlipayService.aliPayCallback(params);
    if (serverResponse.success()) {
        return PtcApiConstant.AlipayCallback.RESPONSE_SUCCESS;
    }
    return PtcApiConstant.AlipayCallback.RESPONSE_FAILED;
}
Also used : Wrapper(com.paascloud.wrapper.Wrapper) AlipayApiException(com.alipay.api.AlipayApiException) Map(java.util.Map) PostMapping(org.springframework.web.bind.annotation.PostMapping) ApiOperation(io.swagger.annotations.ApiOperation)

Example 83 with PostMapping

use of org.springframework.web.bind.annotation.PostMapping in project mzzb-server by mingzuozhibi.

the class SessionController method sessionLogin.

@PostMapping(value = "/api/session", produces = MEDIA_TYPE)
public String sessionLogin(@JsonArg("$.username") String username, @JsonArg("$.password") String password) {
    User user = dao.lookup(User.class, "username", username);
    if (user == null) {
        if (LOGGER.isInfoEnabled()) {
            infoRequest("[用户名称不存在: username={}]", username);
        }
        return errorMessage("用户名称不存在");
    }
    UserDetails userDetails = new UserDetailsImpl(user);
    if (!userDetails.getPassword().equals(password)) {
        if (LOGGER.isInfoEnabled()) {
            infoRequest("[用户密码错误: username={}]", username);
        }
        return errorMessage("用户密码错误");
    }
    if (!userDetails.isEnabled()) {
        if (LOGGER.isWarnEnabled()) {
            warnRequest("[用户已被停用: username={}]", username);
        }
        return errorMessage("用户已被停用");
    }
    doLoginSuccess(userDetails);
    onLoginSuccess(username, true);
    JSONObject session = buildSession();
    if (LOGGER.isInfoEnabled()) {
        infoRequest("[用户成功登入: session={}]", session);
    }
    return objectResult(session);
}
Also used : UserDetailsImpl(mingzuozhibi.security.UserDetailsImpl) User(mingzuozhibi.persist.core.User) UserDetails(org.springframework.security.core.userdetails.UserDetails) JSONObject(org.json.JSONObject) PostMapping(org.springframework.web.bind.annotation.PostMapping)

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