GxyJobEntity gxyJobEntity1 = new GxyJobEntity(); gxyJobEntity1.setUserId("user001"); gxyJobEntity1.setPlanId("plan001"); gxyJobEntity1.setStudentId("stu001"); System.out.println(gxyJobEntity1); String str = JSONUtil.toJsonStr(gxyJobEntity1); System.out.println(str); GxyJobEntity studentEntity= JSONUtil.toBean(str,GxyJobEntity.class); System.out.println(studentEntity); System.out.println(gxyJobEntity1.equals(studentEntity));
输出:
GxyJobEntity [jobId=null, studentId=stu001, planId=plan001, userId=user001]
{"studentId":"stu001","planId":"plan001","userId":"user001"}
GxyJobEntity [jobId=null, studentId=stu001, planId=plan001, userId=user001]
false
计算 当前时间 now 和 时间 date 之间间隔的天数:
long daysUnSign = DateUtil.betweenDay(date, now, false) - 1;