| | |
| | | import com.bstek.dorado.annotation.Expose; |
| | | import com.bstek.dorado.data.entity.EntityState; |
| | | import com.bstek.dorado.data.entity.EntityUtils; |
| | | import com.fzzy.api.Constant; |
| | | import com.fzzy.sys.entity.SysUser; |
| | | import com.fzzy.sys.repository.UserRepository; |
| | | import org.apache.commons.lang.math.RandomUtils; |
| | | import org.bouncycastle.crypto.generators.BCrypt; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; |
| | | import org.springframework.security.crypto.password.PasswordEncoder; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | |
| | | @Autowired |
| | | private UserRepository userRepository; |
| | | |
| | | private BCryptPasswordEncoder bCryptPasswordEncoder; |
| | | |
| | | /** |
| | | * sys.userPR#findAll |
| | |
| | | //密码加密 |
| | | int salt = RandomUtils.nextInt(27); |
| | | salt += 4; |
| | | bCryptPasswordEncoder = new BCryptPasswordEncoder(salt); |
| | | String password = bCryptPasswordEncoder.encode(entity.getPassword()); |
| | | // bCryptPasswordEncoder = new BCryptPasswordEncoder(salt); |
| | | // String password = bCryptPasswordEncoder.encode(entity.getPassword()); |
| | | // boolean b= bCryptPasswordEncoder.matches(entity.getPassword(),password); |
| | | entity.setPassword(password); |
| | | entity.setPassword(entity.getPassword()); |
| | | entity.setSalt(String.valueOf(salt)); |
| | | } |
| | | // 手动将doradoEntity对象转换为标准Bean对象 |
| | |
| | | //密码加密 |
| | | int salt = RandomUtils.nextInt(27); |
| | | salt += 4; |
| | | bCryptPasswordEncoder = new BCryptPasswordEncoder(salt); |
| | | String password = bCryptPasswordEncoder.encode(Constant.DEFAULT_USER_PASSWORD); |
| | | entity.setPassword(password); |
| | | // bCryptPasswordEncoder = new BCryptPasswordEncoder(salt); |
| | | // String password = bCryptPasswordEncoder.encode(Constant.DEFAULT_USER_PASSWORD); |
| | | entity.setPassword(entity.getPassword()); |
| | | entity.setSalt(String.valueOf(salt)); |
| | | |
| | | SysUser data = new SysUser(); |