Commit a479f9969e43d1ea618cae36b132a56158f645ad
1 parent
c104c82461
Exists in
master
and in
1 other branch
儿童管理
Showing 2 changed files with 28 additions and 11 deletions
platform-common/src/main/java/com/lyms/platform/common/utils/DateUtil.java
View file @
a479f99
... | ... | @@ -406,11 +406,17 @@ |
406 | 406 | int day = daysBetween(birth,checkDate); |
407 | 407 | return day+"天"; |
408 | 408 | } |
409 | +// rightNow = Calendar.getInstance(); | |
410 | +// rightNow.setTime(checkDate); | |
411 | +// rightNow.add(Calendar.MONTH,1); | |
412 | +// rightNow.add(Calendar.YEAR,-1); | |
413 | + | |
409 | 414 | rightNow = Calendar.getInstance(); |
410 | 415 | rightNow.setTime(checkDate); |
411 | - rightNow.add(Calendar.MONTH,1); | |
416 | +// rightNow.add(Calendar.MONTH,1); | |
412 | 417 | rightNow.add(Calendar.YEAR,-1); |
413 | 418 | |
419 | + | |
414 | 420 | if (birth.getTime() > rightNow.getTime().getTime()) |
415 | 421 | { |
416 | 422 | int month = getMonthSpace(birth,checkDate); |
... | ... | @@ -468,6 +474,7 @@ |
468 | 474 | |
469 | 475 | |
470 | 476 | public static int getMonthSpace(Date date1, Date date2) { |
477 | + | |
471 | 478 | int result = 0; |
472 | 479 | |
473 | 480 | Calendar c1 = Calendar.getInstance(); |
474 | 481 | |
... | ... | @@ -478,8 +485,14 @@ |
478 | 485 | |
479 | 486 | result = c2.get(Calendar.MONDAY) - c1.get(Calendar.MONTH); |
480 | 487 | |
481 | - return result == 0 ? 1 : Math.abs(result); | |
488 | + result = result == 0 ? 1 : Math.abs(result); | |
489 | + if (Integer.parseInt(getDD(date1)) > Integer.parseInt(getDD(date2))) | |
490 | + { | |
491 | + result = result -1; | |
492 | + } | |
482 | 493 | |
494 | + return result; | |
495 | + | |
483 | 496 | } |
484 | 497 | |
485 | 498 | |
... | ... | @@ -593,7 +606,7 @@ |
593 | 606 | System.out.println(new DateTime().minusDays(77));*/ |
594 | 607 | // System.out.println(getDaySeconds()); |
595 | 608 | |
596 | - String s = getBabyMonthAge(parseYMD("2016-08-01"), new Date()); | |
609 | + String s = getBabyMonthAge(parseYMD("2015-06-07"), new Date()); | |
597 | 610 | System.out.println(s); |
598 | 611 | // SimpleDateFormat simpleDateFormat=new SimpleDateFormat("yyyy-MM-dd "); |
599 | 612 | // System.out.println(getBabyAgeMonth(parseYMD("2016-05-23"), new Date())); |
... | ... | @@ -614,8 +627,8 @@ |
614 | 627 | // System.out.println(y_m_d_h_m_s.format(startDate)); |
615 | 628 | // System.out.println(y_m_d_h_m_s.format(endtDate)); |
616 | 629 | |
617 | - Date d = parseD("7"); | |
618 | - System.out.print(getDD(d)); | |
630 | +// Date d = parseD("7"); | |
631 | +// System.out.print(getDD(d)); | |
619 | 632 | |
620 | 633 | // Date sendDate = dd.parse("02"); |
621 | 634 | // String md = DateUtil.getMMdd(new Date()); |
... | ... | @@ -624,7 +637,6 @@ |
624 | 637 | // |
625 | 638 | // Date actualSendDate = DateUtil.addDay(d, -2); |
626 | 639 | // String sendDateStr = DateUtil.getDD(actualSendDate); |
627 | -// System.out.println(sendDateStr); | |
628 | 640 | } catch (Exception e) |
629 | 641 | { |
630 | 642 |
platform-dal/src/main/java/com/lyms/platform/query/BabyModelQuery.java
View file @
a479f99
... | ... | @@ -345,9 +345,8 @@ |
345 | 345 | } |
346 | 346 | |
347 | 347 | if (null != orServiceStatus && orServiceStatus.length > 1) { |
348 | - MongoCondition con1 = MongoCondition.newInstance("serviceStatus", orServiceStatus[0], MongoOper.IS); | |
349 | - MongoCondition con = MongoCondition.newInstance("serviceStatus", orServiceStatus[1], MongoOper.IS); | |
350 | - condition = condition.orCondition(new MongoCondition[]{con1, con}); | |
348 | + Criteria c = Criteria.where("serviceStatus").in(orServiceStatus[0],orServiceStatus[1]); | |
349 | + condition.andCondition( new MongoCondition(c)); | |
351 | 350 | } |
352 | 351 | |
353 | 352 | if (null != keyword) { |
... | ... | @@ -394,8 +393,14 @@ |
394 | 393 | } |
395 | 394 | |
396 | 395 | if (null != nextDateStart && nextDateEnd != null) { |
397 | - c = Criteria.where("nextDate").gte(nextDateStart); | |
398 | - c = c.lte(nextDateEnd); | |
396 | + if (c != null) | |
397 | + { | |
398 | + Criteria nc = Criteria.where("nextDate").gte(nextDateStart).lte(nextDateEnd); | |
399 | + c.andOperator(nc); | |
400 | + } | |
401 | + else { | |
402 | + c = Criteria.where("nextDate").gte(nextDateStart).lte(nextDateEnd); | |
403 | + } | |
399 | 404 | } |
400 | 405 | |
401 | 406 | if (null != birthEnd) { |