毕设-基于SSM在线商城
@RequestMapping(value="/add",method=RequestMethod.POST) @ResponseBody @OperationLogger(modelName = "添加客户",option = "/admin/account/add") public Map<String, Object> add(String enData){ Map<String, String> map = new HashMap<>(); System.out.println(enData); try { String data = AesEncryptUtils.decrypt(enData,AesEncryptUtils.KEY);//解密前台数据 map= JsonMap.jsonMap(data); } catch (Exception e) { e.printStackTrace(); } Account account = JsonMap.mapAccount(map); Map<String, Object> ret = new HashMap<String, Object>(); if(account == null){ ret.put("type", "error"); ret.put("msg", "请填写正确的客户信息"); return ret; } if(StringUtils.isEmpty(account.getName())){ ret.put("type", "error"); ret.put("msg", "请填写客户名称"); return ret; } if(StringUtils.isEmpty(account.getPassword())){ ret.put("type", "error"); ret.put("msg", "请填写客户登录密码!"); return ret; } if(StringUtils.isEmpty(account.getTelephone())){ ret.put("msg", "请填写客服手机号"); return ret; } if(StringUtils.isEmpty(account.getIdCard())){ ret.put("type", "error"); ret.put("msg", "请填写客户身份证!"); return ret; } String rs = accountService.findIsExit(account).get("result"); if (!"notExit".equals(rs)) { ret.put("type", "error"); ret.put("msg", rs); return ret; } account.setCreateTime(new Date()); if(accountService.add(account) <= 0){ ret.put("type", "error"); ret.put("msg", "添加失败,请联系管理员!"); return ret; } ret.put("type", "success"); ret.put("msg", "添加成功!"); return ret; }
获取方式:
下一篇:
Python 实现用户名和密码登录