| | |
| | | @Autowired |
| | | private IUserService userService; |
| | | |
| | | private Map<String, Integer> loginFailures = new HashMap<>(); |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | */ |
| | | @RequestMapping(value = "/login", method = RequestMethod.POST) |
| | | public String loginVali(String username, String password, String remember, Model model, HttpServletRequest request) { |
| | | Integer f = loginFailures.get(username); |
| | | f = f == null ? 0 : f; |
| | | // 校验账号,密码是否正确,如果错误,对次数进行加1 |
| | | IShiro shiroFactory = ShiroFactroy.me(); |
| | | User user = userService.getByAccount(username); |
| | | if(null == user){ |
| | | f++; |
| | | loginFailures.put(username, f); |
| | | }else { |
| | | // 校验密码 |
| | | ShiroUser shiroUser1 = shiroFactory.shiroUser(user); |
| | | SimpleAuthenticationInfo info = shiroFactory.info(shiroUser1, user, username); |
| | | String pass = ShiroKit.md5(password, user.getSalt()); |
| | | if(!info.getCredentials().equals(pass)){ |
| | | f++; |
| | | loginFailures.put(username, f); |
| | | if(f<5){ |
| | | model.addAttribute("number", "3"); |
| | | } |
| | | if(f==5){ |
| | | model.addAttribute("number", "5"); |
| | | } |
| | | model.addAttribute("message","账号或密码错误!"); |
| | | return "/login.html"; |
| | | } |
| | | } |
| | | model.addAttribute("number", "3"); |
| | | Subject currentUser = ShiroKit.getSubject(); |
| | | UsernamePasswordToken token = new UsernamePasswordToken(username, password.toCharArray()); |
| | |
| | | token.setRememberMe(false);//关闭记住我功能 |
| | | currentUser.login(token); |
| | | |
| | | // 登录成功,错误次数值改0 |
| | | loginFailures.put(username, 0); |
| | | |
| | | ShiroUser shiroUser = ShiroKit.getUser(); |
| | | super.getSession().setAttribute("shiroUser", shiroUser); |
| | | super.getSession().setAttribute("username", shiroUser.getAccount()); |
| | |
| | | GROUP BY `month` |
| | | </select> |
| | | <select id="getDataStatisticsOrderCount" resultType="com.stylefeng.guns.modular.system.controller.resp.PerformanceTableResp"> |
| | | SELECT date_format(o.createTime, '%Y-%m') AS monthTime,COUNT(o.id) AS amount,d.name AS userName |
| | | SELECT date_format(o.createTime, '%Y-%m') AS monthTime,COUNT(o.id) AS amount,d.userName |
| | | FROM t_order o |
| | | LEFT JOIN t_driver d ON o.driverId = d.id |
| | | LEFT JOIN (SELECT id,name AS userName from t_driver) d ON o.driverId = d.id |
| | | <where> |
| | | <if test="agentId != null"> |
| | | AND o.agentId = #{agentId} |
| | |
| | | AND date_format(o.createTime, '%Y-%m') LIKE concat('',#{monthDate},'%') |
| | | </if> |
| | | AND (o.`state` = 107 OR o.`state` = 108 OR o.`state` = 109) |
| | | AND d.userName is not null |
| | | </where> |
| | | GROUP BY monthTime,userName |
| | | ORDER BY amount DESC |
| | |
| | | GROUP BY `month` |
| | | </select> |
| | | <select id="getDataStatisticsOrderCountByIds" resultType="com.stylefeng.guns.modular.system.controller.resp.PerformanceTableResp"> |
| | | SELECT date_format(o.createTime, '%Y-%m') AS monthTime,COUNT(o.id) AS amount,d.name AS userName |
| | | SELECT date_format(o.createTime, '%Y-%m') AS monthTime,COUNT(o.id) AS amount,d.userName |
| | | FROM t_order o |
| | | LEFT JOIN t_driver d ON o.driverId = d.id |
| | | LEFT JOIN (SELECT id,name AS userName from t_driver) d ON o.driverId = d.id |
| | | <where> |
| | | <if test="ids != null and ids.size() > 0"> |
| | | AND o.agentId IN |
| | |
| | | AND date_format(o.createTime, '%Y-%m') LIKE concat('',#{monthDate},'%') |
| | | </if> |
| | | AND (o.`state` = 107 OR o.`state` = 108 OR o.`state` = 109) |
| | | AND d.userName is not null |
| | | </where> |
| | | GROUP BY monthTime,userName |
| | | ORDER BY amount DESC |
| | |
| | | cw.type = 2 AND cw.businessType = #{type} AND cw.code = #{code} |
| | | </select> |
| | | <select id="getDataStatisticsIncomeOrCommission" resultType="com.stylefeng.guns.modular.system.controller.resp.PerformanceTableResp"> |
| | | SELECT date_format(r.createTime, '%Y-%m') AS monthTime,SUM(r.amount) AS amount,d.name AS userName |
| | | SELECT date_format(r.createTime, '%Y-%m') AS monthTime,SUM(r.amount) AS amount,d.userName |
| | | FROM t_revenue r |
| | | LEFT JOIN t_driver d ON r.userId = d.id |
| | | LEFT JOIN (SELECT id,name AS userName from t_driver) d ON r.userId = d.id |
| | | LEFT JOIN t_order o ON r.orderId = o.id |
| | | <where> |
| | | <if test="agentId != null"> |
| | |
| | | ORDER BY amount DESC |
| | | </select> |
| | | <select id="getDataStatisticsIncomeOrCommissionByIds" resultType="com.stylefeng.guns.modular.system.controller.resp.PerformanceTableResp"> |
| | | SELECT date_format(r.createTime, '%Y-%m') AS monthTime,SUM(r.amount) AS amount,d.name AS userName |
| | | SELECT date_format(r.createTime, '%Y-%m') AS monthTime,SUM(r.amount) AS amount,d.userName |
| | | FROM t_revenue r |
| | | LEFT JOIN t_driver d ON r.userId = d.id |
| | | LEFT JOIN (SELECT id,name AS userName from t_driver) d ON r.userId = d.id |
| | | LEFT JOIN t_order o ON r.orderId = o.id |
| | | <where> |
| | | <if test="ids != null and ids.size() > 0"> |