@RequestMapping(value =
"login"
)
public
void CheckUserAccount(@RequestParam(
"account"
)String account, HttpServletResponse response) throws IOException{
JSONObject json_account = JSONObject.fromObject(account);
int username = (Integer)json_account.get(
"username"
);
String password = json_account.getString(
"password"
);
logger.info(
"username = "
+ username +
" password = "
+ password);
int status;
status = checkUserAccountService.IsCorrect(username, password);
Map<String, Object> result =
new
HashMap<String, Object>();
Map<String, String> info_json =
new
HashMap<String, String>();
if
(status == 1){
info_json.put(
"status"
,
"success"
);
}
else
if
(status == 0){
info_json.put(
"status"
,
"errorpassword"
);
}
else
{
info_json.put(
"status"
,
"noexitaccount"
);
}
result.put(
"info"
, info_json);
JSONObject json_object = JSONObject.fromObject(result);
response.setContentType(
"text/json; charset=utf-8"
);
response.setHeader(
"Cache-Control"
,
"no-cache"
);
PrintWriter out = response.getWriter();
out.
print
(result);
out.
flush
();
out.close();
logger.info(
"验证结果是"
+ ((Map<String, String>)(result.get(
"info"
))).get(
"status"
));