private Map getDealRequestAccountApplyData(HttpServletRequest request,String STATUS) throws JsonParseException, JsonMappingException, IOException {
ObjectMapper mapper = new ObjectMapper(); //转换器
String applyType = request.getParameter("applyType")==null?"":request.getParameter("applyType");
HashMap mainMap = new HashMap();
if(AccountConstant.ACCOUNT_OPEN_TYPE.equals(applyType)){
String mainJSON = request.getParameter("mainData");
mainMap = (HashMap) mapper.readValue(mainJSON, Map.class);
String accountName = mainMap.get("accountName")==null?"":mainMap.get("accountName").toString().replace("(", "(").replace(")", ")");
mainMap.put("accountName", accountName);
}else if(AccountConstant.ACCOUNT_CHANGE_TYPE.equals(applyType)){
String id = request.getParameter("id")==null?"":request.getParameter("id");
String applyNo = request.getParameter("applyNo")==null?"":request.getParameter("applyNo");
String beforeJSON = request.getParameter("beforeData");
HashMap beforeMap = (HashMap) mapper.readValue(beforeJSON, Map.class);
String accountNoBefore = beforeMap.get("accountNo")==null?"":beforeMap.get("accountNo").toString();
Account account = this.mapper.getAccountByAccountNo(accountNoBefore);
mainMap.put("accountId", account.getId());
String afterJSON = request.getParameter("afterData");
HashMap afterMap = (HashMap) mapper.readValue(afterJSON, Map.class);
mainMap.putAll(afterMap);
mainMap.put("applyNo", applyNo);
mainMap.put("id", id);
}else if(AccountConstant.ACCOUNT_CLOSE_TYPE.equals(applyType)){
String id = request.getParameter("id")==null?"":request.getParameter("id");
String applyNo = request.getParameter("applyNo")==null?"":request.getParameter("applyNo");
String afterJSON = request.getParameter("afterData");
mainMap = (HashMap) mapper.readValue(afterJSON, Map.class);
String accountNo = mainMap.get("accountNo")==null?"":mainMap.get("accountNo").toString();
Account account = this.mapper.getAccountByAccountNo(accountNo);
mainMap.put("accountId", account.getId());
mainMap.put("applyNo", applyNo);
mainMap.put("id", id);
}
mainMap.put("applyType", applyType);
return mainMap = this.getDealRequestAccountApplyData(mainMap,STATUS);
}
代码问题
最新推荐文章于 2024-02-20 09:31:09 发布