com.ruoyi.common.utils.security.Md5Utils Java Examples
The following examples show how to use
com.ruoyi.common.utils.security.Md5Utils.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FileUploadUtils.java From supplierShop with MIT License | 5 votes |
/** * 编码文件名 */ private static final String encodingFilename(String fileName) { fileName = fileName.replace("_", " "); fileName = Md5Utils.hash(fileName + System.nanoTime() + counter++); return fileName; }
Example #2
Source File: FileUploadUtils.java From RuoYi-Vue with MIT License | 5 votes |
/** * 编码文件名 */ private static final String encodingFilename(String fileName) { fileName = fileName.replace("_", " "); fileName = Md5Utils.hash(fileName + System.nanoTime() + counter++); return fileName; }
Example #3
Source File: SysUserServiceImpl.java From supplierShop with MIT License | 4 votes |
/** * 导入用户数据 * * @param userList 用户数据列表 * @param isUpdateSupport 是否更新支持,如果已存在,则进行更新数据 * @param operName 操作用户 * @return 结果 */ @Override public String importUser(List<SysUser> userList, Boolean isUpdateSupport, String operName) { if (StringUtils.isNull(userList) || userList.size() == 0) { throw new BusinessException("导入用户数据不能为空!"); } int successNum = 0; int failureNum = 0; StringBuilder successMsg = new StringBuilder(); StringBuilder failureMsg = new StringBuilder(); String password = configService.selectConfigByKey("sys.user.initPassword"); for (SysUser user : userList) { try { // 验证是否存在这个用户 SysUser u = userMapper.selectUserByLoginName(user.getLoginName()); if (StringUtils.isNull(u)) { user.setPassword(Md5Utils.hash(user.getLoginName() + password)); user.setCreateBy(operName); this.insertUser(user); successNum++; successMsg.append("<br/>" + successNum + "、账号 " + user.getLoginName() + " 导入成功"); } else if (isUpdateSupport) { user.setUpdateBy(operName); this.updateUser(user); successNum++; successMsg.append("<br/>" + successNum + "、账号 " + user.getLoginName() + " 更新成功"); } else { failureNum++; failureMsg.append("<br/>" + failureNum + "、账号 " + user.getLoginName() + " 已存在"); } } catch (Exception e) { failureNum++; String msg = "<br/>" + failureNum + "、账号 " + user.getLoginName() + " 导入失败:"; failureMsg.append(msg + e.getMessage()); log.error(msg, e); } } if (failureNum > 0) { failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:"); throw new BusinessException(failureMsg.toString()); } else { successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:"); } return successMsg.toString(); }
Example #4
Source File: FileUploadUtils.java From RuoYi with Apache License 2.0 | 4 votes |
/** * 编码文件名 */ private static String encodingFilename(String filename) { filename = filename.replace("_", " "); filename = Md5Utils.hash(filename + System.nanoTime() + counter++); return filename; }
Example #5
Source File: SysUserServiceImpl.java From RuoYi with Apache License 2.0 | 4 votes |
/** * 导入用户数据 * * @param userList 导入的用户数据列表 * @param updateSupport 是否更新支持,如果已存在,则进行更新数据 * @param loginUser 操作用户 * @return 结果 */ @Override public String importUser(List<SysUser> userList, Boolean updateSupport, SysUser loginUser) { if (CollectionUtils.isEmpty(userList)) { throw new BusinessException("导入用户数据不能为空!"); } int successNum = 0; int failureNum = 0; final String br = "<br/>"; //当然操作用户 String operName = loginUser.getLoginName(); StringBuilder successMsg = new StringBuilder(); StringBuilder failureMsg = new StringBuilder(); String password = configService.selectConfigByKey("sys.user.initPassword"); for (SysUser user : userList) { try { // 验证是否存在这个用户 SysUser u = userMapper.selectUserByLoginName(user.getLoginName()); if (ObjectUtil.isNull(u)) { user.setPassword(Md5Utils.hash(user.getLoginName() + password)); user.setCreateBy(operName); this.insertUser(user); successNum++; successMsg.append(br).append(successNum).append("、账号 ").append(user.getLoginName()).append(" 导入成功"); } else if (updateSupport) { user.setUpdateBy(operName); this.updateUser(user); successNum++; successMsg.append(br).append(successNum).append("、账号 ").append(user.getLoginName()).append(" 更新成功"); } else { failureNum++; failureMsg.append(br).append(failureNum).append("、账号 ").append(user.getLoginName()).append(" 已存在"); } } catch (Exception e) { failureNum++; String msg = br + failureNum + "、账号 " + user.getLoginName() + " 导入失败:"; failureMsg.append(msg).append(e.getMessage()); log.error(msg, e); } } if (failureNum > 0) { failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:"); throw new BusinessException(failureMsg.toString()); } else { successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:"); } return successMsg.toString(); }