// Path: ssopay-qywx-bean/src/main/java/com/ssopay/qywx/base/Result.java
// public class Result implements Serializable {
// 	private static final long serialVersionUID = 1L;
// 	
// 	private Integer code = -1;
// 	private String msg;
// 	private String url;
// 	private Long time = new Date().getTime();
// 	private List<ResultMap> data;
// 	public Integer getCode() {
// 		return code;
// 	}
// 	public void setCode(Integer code) {
// 		this.code = code;
// 	}
// 	public String getMsg() {
// 		return msg;
// 	}
// 	public void setMsg(String msg) {
// 		this.msg = msg;
// 	}
// 	public String getUrl() {
// 		return url;
// 	}
// 	public void setUrl(String url) {
// 		this.url = url;
// 	}
// 	public Long getTime() {
// 		return time;
// 	}
// 	public void setTime(Long time) {
// 		this.time = time;
// 	}
// 	public List<ResultMap> getData() {
// 		return data;
// 	}
// 	public void setData(List<ResultMap> data) {
// 		this.data = data;
// 	}
// 
// }
// 
// Path: ssopay-qywx-admin/src/main/java/com/ssopay/qywx/jcaptcha/JCaptchaServiceSingleton.java
// public class JCaptchaServiceSingleton {
// 
// 	private static ImageCaptchaService instance = null;
// 
// 	private JCaptchaServiceSingleton() {
// 	}
// 
// 	// 使用synchronized关键字解决线程不安全
// 	public synchronized static ImageCaptchaService getInstance() {
// 		if (instance == null) {
// 			instance = new DefaultManageableImageCaptchaService(
// 					new FastHashMapCaptchaStore(), new GMailEngine(), 180,
// 					100000, 75000);
// 		}
// 		return instance;
// 	}
// 
// }


import java.awt.image.BufferedImage;
import java.io.IOException;
import java.util.Random;
import javax.imageio.ImageIO;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.shiro.web.filter.authc.FormAuthenticationFilter;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ssopay.qywx.base.Result;
import com.ssopay.qywx.jcaptcha.JCaptchaServiceSingleton;
package com.ssopay.qywx.login.web;





/**
 * 
 * @ClassName: LoginController
 * @Description: TODO(负责打开登录页面(GET请求)和登录出错页面(POST请求)，真正登录的POST请求由Filter完成)
 * @author ssopay
 * @date 2017年7月6日 下午3:55:28
 *
 */
@Controller
public class LoginController {

	@RequestMapping(value = "login", method = RequestMethod.GET)
	public String login(Model model) {
		//生成一个四位随机数给登录面使用，每次背景不同 1000-3999之间
		Random random = new Random();
		int x = random.nextInt(3999 - 1000 + 1) + 1000;
		model.addAttribute("random", x);
		return "login";
	}

	@RequestMapping(value = "login", method = RequestMethod.POST)
	@ResponseBody
// Path: ssopay-qywx-bean/src/main/java/com/ssopay/qywx/base/Result.java
// public class Result implements Serializable {
// 	private static final long serialVersionUID = 1L;
// 	
// 	private Integer code = -1;
// 	private String msg;
// 	private String url;
// 	private Long time = new Date().getTime();
// 	private List<ResultMap> data;
// 	public Integer getCode() {
// 		return code;
// 	}
// 	public void setCode(Integer code) {
// 		this.code = code;
// 	}
// 	public String getMsg() {
// 		return msg;
// 	}
// 	public void setMsg(String msg) {
// 		this.msg = msg;
// 	}
// 	public String getUrl() {
// 		return url;
// 	}
// 	public void setUrl(String url) {
// 		this.url = url;
// 	}
// 	public Long getTime() {
// 		return time;
// 	}
// 	public void setTime(Long time) {
// 		this.time = time;
// 	}
// 	public List<ResultMap> getData() {
// 		return data;
// 	}
// 	public void setData(List<ResultMap> data) {
// 		this.data = data;
// 	}
// 
// }
// 
// Path: ssopay-qywx-admin/src/main/java/com/ssopay/qywx/jcaptcha/JCaptchaServiceSingleton.java
// public class JCaptchaServiceSingleton {
// 
// 	private static ImageCaptchaService instance = null;
// 
// 	private JCaptchaServiceSingleton() {
// 	}
// 
// 	// 使用synchronized关键字解决线程不安全
// 	public synchronized static ImageCaptchaService getInstance() {
// 		if (instance == null) {
// 			instance = new DefaultManageableImageCaptchaService(
// 					new FastHashMapCaptchaStore(), new GMailEngine(), 180,
// 					100000, 75000);
// 		}
// 		return instance;
// 	}
// 
// }


// Path: ssopay-qywx-admin/src/main/java/com/ssopay/qywx/login/web/LoginController.java
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.util.Random;
import javax.imageio.ImageIO;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.shiro.web.filter.authc.FormAuthenticationFilter;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ssopay.qywx.base.Result;
import com.ssopay.qywx.jcaptcha.JCaptchaServiceSingleton;

package com.ssopay.qywx.login.web;





/**
 * 
 * @ClassName: LoginController
 * @Description: TODO(负责打开登录页面(GET请求)和登录出错页面(POST请求)，真正登录的POST请求由Filter完成)
 * @author ssopay
 * @date 2017年7月6日 下午3:55:28
 *
 */
@Controller
public class LoginController {

	@RequestMapping(value = "login", method = RequestMethod.GET)
	public String login(Model model) {
		//生成一个四位随机数给登录面使用，每次背景不同 1000-3999之间
		Random random = new Random();
		int x = random.nextInt(3999 - 1000 + 1) + 1000;
		model.addAttribute("random", x);
		return "login";
	}

	@RequestMapping(value = "login", method = RequestMethod.POST)
	@ResponseBody
	public Result fail(String username, HttpServletRequest request) {