@Test public void resetPassword() throws Exception { Date date = new Date(); OcpayAddressBalance ocpayAddressBalance = new OcpayAddressBalance(); for (int i = 3; i < 510; i++) { ocpayAddressBalance.setCreateTime(DateUtils.addDay(date,i)); ocpayAddressBalance.setTotalBalance(new BigDecimal("3242342424")); ocpayAddressBalance.setAddressNum(30313); this.ocpayAddressBalance.insertSelective(ocpayAddressBalance); } }
public boolean resetPassword(Integer adminId, String password,String name) throws InvalidArgumentException { if (StringUtils.isBlank(name)) throw new InvalidArgumentException("用户名不能为空!"); Admin admin = getAdminById(adminId); if (admin == null) throw new InvalidArgumentException("账号不存在!"); admin.setName(name); admin.setUpdatedBy(adminId); admin.setUpdatedAt(new Date()); if (StringUtils.isBlank(password)){ throw new InvalidArgumentException("新密码不能为空!"); }else{ password = BCrypt.hashpw(password, BCrypt.gensalt()); } admin.setPassword(password); int insert = adminMapper.updateByPrimaryKeySelective(admin); return (insert>0)?true:false; }
AdminService { public boolean resetPassword(Integer adminId, String password,String name) throws InvalidArgumentException { if (StringUtils.isBlank(name)) throw new InvalidArgumentException("用户名不能为空!"); Admin admin = getAdminById(adminId); if (admin == null) throw new InvalidArgumentException("账号不存在!"); admin.setName(name); admin.setUpdatedBy(adminId); admin.setUpdatedAt(new Date()); if (StringUtils.isBlank(password)){ throw new InvalidArgumentException("新密码不能为空!"); }else{ password = BCrypt.hashpw(password, BCrypt.gensalt()); } admin.setPassword(password); int insert = adminMapper.updateByPrimaryKeySelective(admin); return (insert>0)?true:false; } }
AdminService { public boolean resetPassword(Integer adminId, String password,String name) throws InvalidArgumentException { if (StringUtils.isBlank(name)) throw new InvalidArgumentException("用户名不能为空!"); Admin admin = getAdminById(adminId); if (admin == null) throw new InvalidArgumentException("账号不存在!"); admin.setName(name); admin.setUpdatedBy(adminId); admin.setUpdatedAt(new Date()); if (StringUtils.isBlank(password)){ throw new InvalidArgumentException("新密码不能为空!"); }else{ password = BCrypt.hashpw(password, BCrypt.gensalt()); } admin.setPassword(password); int insert = adminMapper.updateByPrimaryKeySelective(admin); return (insert>0)?true:false; }  }
AdminService { public boolean resetPassword(Integer adminId, String password,String name) throws InvalidArgumentException { if (StringUtils.isBlank(name)) throw new InvalidArgumentException("用户名不能为空!"); Admin admin = getAdminById(adminId); if (admin == null) throw new InvalidArgumentException("账号不存在!"); admin.setName(name); admin.setUpdatedBy(adminId); admin.setUpdatedAt(new Date()); if (StringUtils.isBlank(password)){ throw new InvalidArgumentException("新密码不能为空!"); }else{ password = BCrypt.hashpw(password, BCrypt.gensalt()); } admin.setPassword(password); int insert = adminMapper.updateByPrimaryKeySelective(admin); return (insert>0)?true:false; }  TokenVo login(String name, String password); Admin getAdminByName(String name); boolean addAdmin(String name, String password, String phone, String realName ,Integer adminId); boolean resetPassword(Integer adminId, String password,String name); Admin getAdminById(Integer adminId); Page getUsers(AdminReq admin); }
AdminService { public boolean resetPassword(Integer adminId, String password,String name) throws InvalidArgumentException { if (StringUtils.isBlank(name)) throw new InvalidArgumentException("用户名不能为空!"); Admin admin = getAdminById(adminId); if (admin == null) throw new InvalidArgumentException("账号不存在!"); admin.setName(name); admin.setUpdatedBy(adminId); admin.setUpdatedAt(new Date()); if (StringUtils.isBlank(password)){ throw new InvalidArgumentException("新密码不能为空!"); }else{ password = BCrypt.hashpw(password, BCrypt.gensalt()); } admin.setPassword(password); int insert = adminMapper.updateByPrimaryKeySelective(admin); return (insert>0)?true:false; }  TokenVo login(String name, String password); Admin getAdminByName(String name); boolean addAdmin(String name, String password, String phone, String realName ,Integer adminId); boolean resetPassword(Integer adminId, String password,String name); Admin getAdminById(Integer adminId); Page getUsers(AdminReq admin); static String INIT_PWD; }