@RequestMapping public @ResponseBody JsonMessage exportConstant() { JsonMessage message = new JsonMessage(); Map<String, Object> constant = new HashMap<String, Object>(); for (Operation operation : LocalTransaction.Operation.values()) { if ("".equals(operation.getCommandId())) { // 如果commandID没有,使用Type作为操作标识 constant.put(operation.name(), operation.getType()); } else { // 否则,使用commandID作为操作标识 constant.put(operation.name(), operation.getCommandId()); } } for (CommType commType : LocalTransaction.CommType.values()) { constant.put(commType.name(), commType.name()); } message.setMessage(constant); return message; }
@RequestMapping public @ResponseBody JsonMessage get(@RequestParam("id") Long id) { JsonMessage message = new JsonMessage(); try { LocalTransaction lt = localTransactionManager.load(id); Map<String, Object> map = lt.toMap(null, null); message.setMessage(map); } catch (PlatformException e) { e.printStackTrace(); message.setSuccess(Boolean.FALSE); message.setMessage(e.getMessage()); } catch (Exception e) { e.printStackTrace(); message.setSuccess(Boolean.FALSE); message.setMessage(e.getMessage()); } return message; }
@RequestMapping public @ResponseBody JsonMessage checkCardOptFinish(HttpServletRequest request) { JsonMessage message = new JsonMessage(); try { String sessionId = ServletRequestUtils.getStringParameter(request, "sessionId"); boolean flag = localTransactionManager.checkCardOptFinish(sessionId); if (!flag) { message.setSuccess(flag); } } catch (PlatformException e) { e.printStackTrace(); message.setSuccess(Boolean.FALSE); message.setMessage(e.getMessage()); } catch (Exception e) { e.printStackTrace(); message.setSuccess(Boolean.FALSE); message.setMessage(e.getMessage()); } return message; }