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);
}
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;
}
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);
}
Aggregations