个人处理结算异步通知接口(被回调对象)
2017-11-13 14:47
369 查看
/** * 个人处理结算异步通知 * * @param dto * @return */ @RequestMapping(value = "/personal") @ResponseBody public Object personal(HttpServletRequest request, HttpServletResponse response){ Map<String, String> result = new HashMap<String, String>(); result.put("respCode", "N"); try { String content = this.getRequestBody(request); logger.info("收到结算系统结果回调:{}", content); WithdrawCallbackDto dto=JSON.parseObject(content, WithdrawCallbackDto.class); logger.info("个人:收到结算系统结果回调:{}", dto); if (!checkSmtSign(dto)) { result.put("respMsg", "验签失败"); return result; } //查询个人提现记录流水 WithdrawPersonalFlowEntity entity=withdrawPersonalFlowService.queryPersonalFlowByFlowNo(dto.getOutTradeNo()); if(entity==null){ result.put("respMsg", "操作失败:个人提现流水不存在"); return result; } //校验提现流水状态是否支持退款和更新状态操作 if(entity.getStatus()==WithdrawStatusEnum.ACCEPT.getStatus()){ result.put("respCode", "Y"); // 准备个人提现流水更新参数准备 SettlementResponseDto responseDto = personalParametersPrepare(dto); // 代表结算成功 if (dto.getRespCode().equals("100005")) { //更新个人提现流水操作 withdrawPersonalFlowService.updateFlowBySmt(responseDto); }else{// 代表结算失败 //更新个人提现流水操作 withdrawPersonalFlowService.updateFlowBySmt(responseDto); //个人退还提现本金参数准备 WithdrawRefundDto refundDto=personalRefundOfCommissionCharge(dto); //个人提现,退还本金处理 withdrawPersonalFlowService.refund(refundDto); } result.put("respMsg","验签成功,个人退款成功"); }else{ result.put("respMsg", "操作失败:个人提现流水状态有误"); return result; } } catch (PaycoreException e) { logger.error("个人处理结算系统异步回调失败, {}", e); result.put("respMsg", e.getErrorMsg()); return result; } catch(Exception e){ logger.error("个人处理结算系统异步回调失败, {}", e); result.put("respMsg","系统异常" ); return result; } return result; }
回调验签
private boolean checkSmtSign(WithdrawCallbackDto dto){
String[] exceptParams = {"signCode", "signType"};
return SignatureUtil.callBackVerify(dto, exceptParams);
}xml 配置
<bean id="signUtil" class="com.qbao.signature.sign.client.CuratorZookeeperClient" init-method="init" lazy-init="false"> <property name="connectString" value="${zk.hosts}" /> <property name="needsAll" value="true" /> </bean> <bean id="verifyUtil" class="com.qbao.signature.verify.client.CuratorZookeeperClient" init-method="init" lazy-init="false"> <property name="connectString" value="${zk.hosts}"/> </bean>
相关文章推荐
- jersey处理支付宝异步回调通知的问题:java.lang.IllegalArgumentException: Error parsing media type 'application/x-www-form-urlencoded; text/html; charset=UTF-8'
- Android开发之图片处理专题(二):利用AsyncTask和回调接口实现图片的异步加载和压缩
- c# 支付宝新版接口异步通知notify_url、Return_url处理
- 支付宝接口异步回调不通知 服务器的原因
- 支付宝即时到账接口,异步回调post请求的接受,Jersey 处理post参数的方法
- 关于在用异步消息处理机制使用Message.Obtain()方法(而非New Message)获得一个Message对象的好处
- Nodejs异步回调之异常处理实例分析
- 支付宝接口使用文档说明 支付宝异步通知(notify_url)与return_url.
- 接口对象的实例化在接口回调中的使用
- 工商银行支付接口-处理工行支付成功后的消息通知
- 异步调用WebService抛出ArgumentException"异步处理过程中出现错误。未完成的多个异步并发操作需要唯一的状态对象"
- Servlet接口与ServletContext对象(有读写处理)
- 支付宝接口使用文档说明 支付宝异步通知(notify_url)与return_url. .
- 初识安卓之:异步备份手机短信,详解自定义接口,回调抽象方法
- 深入浅析NodeJs并发异步的回调处理
- jQuery的promise与deferred对象在异步回调中的作用
- 支付宝中的手机网站支付接口,php版 notify_url.php 异步通知页面未成功执行
- 银行支付回调接口通知失败后,过段时间又通知成功
- jQuery的promise与deferred对象在异步回调中的作用
- Spring 【Aspectj】【注解】引入通知 ------ 为【目标对象】添加,【新接口】及【实现】