use of org.springframework.web.bind.annotation.ResponseBody in project production_ssm by megagao.
the class ManufactureController method deleteBatch.
@RequestMapping(value = "/delete_batch")
@ResponseBody
private CustomResult deleteBatch(String[] ids) throws Exception {
System.out.println(ids);
CustomResult result = manufactureService.deleteBatch(ids);
return result;
}
use of org.springframework.web.bind.annotation.ResponseBody in project production_ssm by megagao.
the class LoginController method ajaxLogin.
/**
* shiro ajax登录
*/
@RequestMapping(value = "/ajaxLogin")
@ResponseBody
public Map<String, Object> ajaxLogin(@RequestParam String username, @RequestParam String password, @RequestParam(required = false) String randomcode, HttpSession session) throws Exception {
Map<String, Object> map = CollectionsFactory.newHashMap();
if (randomcode != null && !randomcode.equals("")) {
// 取出session的验证码(正确的验证码)
String validateCode = (String) session.getAttribute(VALIDATE_CODE);
// 页面中输入的验证和session中的验证进行对比
if (validateCode != null && !randomcode.equals(validateCode)) {
// 如果校验失败,将验证码错误失败信息放入map中
map.put("msg", "randomcode_error");
// 直接返回,不再校验账号和密码
return map;
}
}
Subject currentUser = SecurityUtils.getSubject();
if (!currentUser.isAuthenticated()) {
UsernamePasswordToken token = new UsernamePasswordToken(username, password);
try {
currentUser.login(token);
} catch (UnknownAccountException ex) {
map.put("msg", "account_error");
} catch (IncorrectCredentialsException ex) {
map.put("msg", "password_error");
} catch (AuthenticationException ex) {
map.put("msg", "authentication_error");
}
}
// 返回json数据
return map;
}
use of org.springframework.web.bind.annotation.ResponseBody in project production_ssm by megagao.
the class PCountCheckController method deleteBatch.
@RequestMapping(value = "/delete_batch")
@ResponseBody
private CustomResult deleteBatch(String[] ids) throws Exception {
System.out.println(ids);
CustomResult result = pCountCheckService.deleteBatch(ids);
return result;
}
use of org.springframework.web.bind.annotation.ResponseBody in project production_ssm by megagao.
the class PCountCheckController method insert.
@RequestMapping(value = "/insert", method = RequestMethod.POST)
@ResponseBody
private CustomResult insert(@Valid ProcessCountCheck processCountCheck, BindingResult bindingResult) throws Exception {
CustomResult result;
if (bindingResult.hasErrors()) {
FieldError fieldError = bindingResult.getFieldError();
return CustomResult.build(100, fieldError.getDefaultMessage());
}
result = pCountCheckService.insert(processCountCheck);
return result;
}
use of org.springframework.web.bind.annotation.ResponseBody in project leopard by tanhaichao.
the class MultiVersionRequestMappingInfoBuilder method getHeaders.
// TODO 测试类
@Override
public void getHeaders(RequestMapping annotation, Method method, ExtensiveDomain extensiveDomain, Map<String, String> headers) {
ResponseBody anno = method.getAnnotation(ResponseBody.class);
if (anno == null) {
return;
}
if (headers.containsKey("version")) {
return;
}
headers.put("version", "0.2");
}
Aggregations