| | |
| | | PASSWORD_ERROR(-8,"密码错误"), |
| | | MOBILE_INVALID(-9,"手机号无效"), |
| | | EMAIL_INVALID(-10,"邮箱无效"), |
| | | ACCOUNT_INVALID(-11,"用户名无效"), |
| | | ACCOUNT_INVALID(-11,"账号无效"), |
| | | PASSWORD_INVALID(-12,"密码无效"), |
| | | ACCOUNT_IS_EXPIRE(-13,"用户已过期"), |
| | | ACCOUNT_IS_EXPIRE(-13,"账号已过期"), |
| | | ORGANIZATION_NOT_EXIST(-14,"组织不存在"), |
| | | ORGANIZATION_EXIST(-15,"组织已经存在"), |
| | | ORGANIZATION_PARENT_NOT_EXIST(-16,"父组织不存在"), |
| | |
| | | DICTTYPE_NOT_EXIST(-26,"字典类型不存在"), |
| | | DICTTYPE_EXIST(-27,"字典类型已经存在"), |
| | | DICTDATA_KEY_EXIST(-28,"字典数据Key已经存在"), |
| | | DICTDATA_KEY_NOT_EXIST(-29,"字典数据Key不存在") |
| | | DICTDATA_KEY_NOT_EXIST(-29,"字典数据Key不存在"), |
| | | USERNAME_INVALID(-30,"用户名称无效") |
| | | ; |
| | | private final Integer code; |
| | | private final String msg; |
| | |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | System.out.println(encrypt("123456","AD42F7787B035B7580000EF93BE20BAD")); |
| | | System.out.println(encrypt("chenkaiyu111","AD42F7787B035B7580000EF93BE20BAD")); |
| | | } |
| | | |
| | | } |
| | |
| | | return Pattern.matches(regex, ipAddress); |
| | | } |
| | | |
| | | /** |
| | | * @Description: 判断字符串是否包含中文 |
| | | * @Param: [str] |
| | | * @return: boolean |
| | | * @Author: 陈凯裕 |
| | | * @Date: 2021/4/21 |
| | | */ |
| | | public static boolean checkContainChinese(String str){ |
| | | Pattern p = Pattern.compile("[\u4e00-\u9fa5]"); |
| | | Matcher matcher = p.matcher(str); |
| | | return matcher.find(); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | public AccountDTO paramValid(){ |
| | | AccountDTO dto = new AccountDTO(); |
| | | //判断用户名是否符合条件 |
| | | //判断账号是否符合条件 |
| | | if(!RegexUtils.checkAccount(account)){ |
| | | dto.setCode(ResponseCodeEnum.ACCOUNT_INVALID.getCode()); |
| | | dto.setMsg(ResponseCodeEnum.ACCOUNT_INVALID.getMsg()); |
| | | return dto; |
| | | } |
| | | //判断用户名是否符合条件 |
| | | if(!RegexUtils.checkChinese(userName)||userName.contains(" ")){ |
| | | dto.setCode(ResponseCodeEnum.USERNAME_INVALID.getCode()); |
| | | dto.setMsg(ResponseCodeEnum.USERNAME_INVALID.getMsg()); |
| | | return dto; |
| | | } |
| | | //判断密码是否符合条件 |
| | |
| | | return dto; |
| | | } |
| | | //判断手机号是否符合条件 |
| | | if (!ObjectUtils.isEmpty(mobile)) { |
| | | if(!RegexUtils.checkMobile(mobile)){ |
| | | dto.setCode(ResponseCodeEnum.MOBILE_INVALID.getCode()); |
| | | dto.setMsg(ResponseCodeEnum.MOBILE_INVALID.getMsg()); |
| | | return dto; |
| | | } |
| | | } |
| | | //判断邮箱是否符合条件 |
| | | if (!ObjectUtils.isEmpty(email)) { |
| | | if(!RegexUtils.checkEmail(email)){ |
| | | dto.setCode(ResponseCodeEnum.EMAIL_INVALID.getCode()); |
| | | dto.setMsg(ResponseCodeEnum.EMAIL_INVALID.getMsg()); |
| | | return dto; |
| | | } |
| | | } |
| | | dto.setCode(ResponseCodeEnum.SUCCESS.getCode()); |
| | | dto.setMsg(ResponseCodeEnum.SUCCESS.getMsg()); |
| | | return dto; |
| | | |
| | | } |
| | | |
| | | public ManageAccount formConvertEntity(){ |
| | |
| | | |
| | | public AccountDTO paramValid() { |
| | | AccountDTO dto = new AccountDTO(); |
| | | //判断用户名是否有效 |
| | | if(!ObjectUtils.isEmpty(userName)){ |
| | | if(!RegexUtils.checkChinese(userName)||userName.contains(" ")){ |
| | | dto.setCode(ResponseCodeEnum.USERNAME_INVALID.getCode()); |
| | | dto.setMsg(ResponseCodeEnum.USERNAME_INVALID.getMsg()); |
| | | return dto; |
| | | } |
| | | } |
| | | //判断手机号是否符合条件 |
| | | if (!ObjectUtils.isEmpty(mobile)) { |
| | | if (!RegexUtils.checkMobile(mobile)) { |
| | |
| | | manageAccount.setWechat(wechat); |
| | | return manageAccount; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | public static AccountVO convertToQueryPage(AccountDTO dto) { |
| | | if (dto.getAccount() == null) |
| | | return null; |
| | | AccountInsertVO vo = new AccountInsertVO(); |
| | | AccountVO vo = new AccountVO(); |
| | | ManageAccount account = dto.getAccount(); |
| | | List<ManageRole> roles = dto.getRoles(); |
| | | if(!ObjectUtils.isEmpty(roles)){ |
| | |
| | | }); |
| | | } |
| | | vo.setId(account.getId()); |
| | | vo.setAccount(account.getAccount()); |
| | | vo.setUserName(account.getUserName()); |
| | | vo.setEmail(account.getEmail()); |
| | | vo.setMobile(account.getMobile()); |
| | |
| | | |
| | | private String userName; |
| | | |
| | | private String account; |
| | | |
| | | private String email; |
| | | |
| | | private String mobile; |
| | |
| | | //处理时间以及content |
| | | String[] contentArray = content.split(";"); |
| | | List<String> contentList = Arrays.asList(contentArray); |
| | | String createTimeStr = DateUtils.dateToDateString(createTime, "yyyy-MM-dd"); |
| | | String createTimeStr = DateUtils.dateToDateString(createTime, "yyyy-MM-dd HH:mm:ss"); |
| | | |
| | | vo.setAccount(account); |
| | | vo.setContent(contentList); |