获取当前登录用户
//获取当前登录的用户
LoginUser loginUser = SecurityUtils.getLoginUser();
String username = loginUser.getUsername();
SysUser user = loginUser.getUser();
身份证提取出生日期
// 出生日期
String birthday = "";
Long age = new Long(0);
String sfzh = compUser.getIdCard();
if (StringUtils.isNotEmpty(sfzh)) {
// 身份证号不为空
if (sfzh.length() == 15) {
birthday = "19" + sfzh.substring(6, 8) + "-" + sfzh.substring(8, 10) + "-" + sfzh.substring(10, 12);
} else if (sfzh.length() == 18) {
birthday = sfzh.substring(6, 10) + "-" + sfzh.substring(10, 12) + "-" + sfzh.substring(12, 14);
}
System.out.println("268:userId=" + userId + "n 生日:" + birthday + "n 身份证:" + sfzh);
if (StringUtils.isNotEmpty(birthday)) {
System.out.println("270:userId=" + userId + "n 生日:" + birthday + "n 身份证:" + sfzh);
age = (System.currentTimeMillis() - simpleDateFormat.parse(birthday).getTime()) / 31536000000L;
}
compAtteDay1.setAge(age);
System.out.println("286:" + sfzh + "n userId:" + userId);
SQL语句
# 1.查看表结构
show create table ;
字符串操作
//字符串是否完全相同
str1.equals(str2);//返回值Boolean