调用第三方接口缴费的通用逻辑
生活随笔
收集整理的這篇文章主要介紹了
调用第三方接口缴费的通用逻辑
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
下面是我總結的調用第三方接口繳費的通用邏輯
代碼邏輯如下:
代碼示例:
public RestDTO<BaseDTO> charge(Param param)throws Exception {String xxxx = "xxxxxxxxxxxxxxxxxxxxxxxxx";String xxx = "xxxxxxxxxxxxxxxxxxxxxxx";User user = Mapper.getUserById(param.getUserId()); String pwd = SeUtil.checkHashKey(user.getUser(), param.getPwd(),param);//校驗密碼if (!user.getPwd().equals(pwd)) {throw new ServiceException(Error.errorPwd);}//隨機生成一個唯一的id值Long orderId = Long.valueOf(orderNoService.getNextId());String xxx = FileMd5Util.md5Hex(xxx + xxx + param.xxxxx+param.xxxx + orderId);Map<String, String> map = new HashMap<String, String>();map.put("xxxxxx", xxxxxxxx);map.put("xxxxx", xxxxxx));map.put("xxxx", xxxx);map.put("xxxx", xxxxx);map.put("xxxxx", xxxxxx);String rslt = APIProxy.getExample().get("https://xxxxxx.cn.com/ossxay/xxxxxx", map);logger.info("充值/繳費返回值 {}", rslt);if (!rslt.contains("\"error_code\":0")) {throw new ServiceException(Error.error500);}RestDTO<BaseDTO> dto = new RestDTO<BaseDTO>();dto.setStatus(RestStatus.SUCCESS);dto.setMessage("充值成功/繳費成功");return dto; }總結
以上是生活随笔為你收集整理的调用第三方接口缴费的通用逻辑的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: FreeMarkerConfigurer
- 下一篇: 通过组策略实现客户端注册证书