Commit 526d7972a9ccf52c3e6d0e72a3376f402eaca91f
1 parent
21d8a25aca
Exists in
master
and in
6 other branches
update
Showing 2 changed files with 33 additions and 19 deletions
platform-common/src/main/java/com/lyms/platform/common/utils/DateUtil.java
View file @
526d797
... | ... | @@ -2,6 +2,7 @@ |
2 | 2 | |
3 | 3 | import org.joda.time.DateTime; |
4 | 4 | |
5 | +import java.math.BigDecimal; | |
5 | 6 | import java.text.ParseException; |
6 | 7 | import java.text.SimpleDateFormat; |
7 | 8 | import java.util.*; |
8 | 9 | |
9 | 10 | |
... | ... | @@ -1699,16 +1700,29 @@ |
1699 | 1700 | return getYmdDate(calendar.getTime()); |
1700 | 1701 | } |
1701 | 1702 | |
1702 | - public static void main(String[] args) { | |
1703 | 1703 | |
1704 | - Date bir = parseYMD("2002-10-05"); | |
1705 | - Date bir1 = parseYMD("2020-12-05"); | |
1706 | - int i = DateUtil.getAge2(bir, bir1); | |
1707 | - System.out.println(i); | |
1704 | + public static double getMonthDays(Date birth) | |
1705 | + { | |
1706 | + int month = DateUtil.getBabyAgeMonth(birth, new Date()); | |
1707 | + Date date = addMonth(birth, month); | |
1708 | + int days = daysBetween(date, new Date()); | |
1709 | + BigDecimal bg = new BigDecimal(1.0/30*days); | |
1710 | + double doubleValue = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); | |
1711 | + return doubleValue; | |
1712 | + } | |
1708 | 1713 | |
1709 | - | |
1710 | - System.out.println( DateUtil.getDayStartTime(new Date())); | |
1711 | - System.out.println( DateUtil.getDayEndTime(new Date())); | |
1714 | + public static void main(String[] args) { | |
1715 | +// | |
1716 | +// Date bir = parseYMD("2021-05-29"); | |
1717 | +// int i = DateUtil.getBabyAgeMonth(bir, new Date()); | |
1718 | +// System.out.println(i); | |
1719 | +// Date d = addMonth(bir, i); | |
1720 | +// int a = daysBetween(d, new Date()); | |
1721 | +// System.out.println(a); | |
1722 | +// BigDecimal bg = new BigDecimal(1.0/30*a); | |
1723 | +// double f1 = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); | |
1724 | +// | |
1725 | +// System.out.println(f1); | |
1712 | 1726 | } |
1713 | 1727 | |
1714 | 1728 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BabyEvaluationCriterionServiceImpl.java
View file @
526d797
... | ... | @@ -391,7 +391,7 @@ |
391 | 391 | * @param double5Z |
392 | 392 | * @return |
393 | 393 | */ |
394 | - private Map<String, Object> getStringObjectMap(Integer checkMonth, int double1Dq, int double2Dq, int double3Dq, int double4Dq, int double5Dq, Double double1Z, Double double2Z, Double double3Z, Double double4Z, Double double5Z) { | |
394 | + private Map<String, Object> getStringObjectMap(Double checkMonth, int double1Dq, int double2Dq, int double3Dq, int double4Dq, int double5Dq, Double double1Z, Double double2Z, Double double3Z, Double double4Z, Double double5Z) { | |
395 | 395 | Map<String, Object> reportMap = new HashMap<>(); |
396 | 396 | LinkedList<Object> objects1 = new LinkedList<>(); |
397 | 397 | String s1z = ""; |
398 | 398 | |
... | ... | @@ -548,21 +548,21 @@ |
548 | 548 | } |
549 | 549 | } |
550 | 550 | } |
551 | - Integer month = model.getCheckMonth(); | |
552 | - int [] months = null; | |
553 | - months = getInts(months, month); | |
554 | - int month1 = months[0]; | |
555 | - List<BabyEvaluationCriterionModel> ecmodels = mongoTemplate.find(Query.query(Criteria.where("month").lt(month1).and("type").is(3)), BabyEvaluationCriterionModel.class); | |
556 | - for (BabyEvaluationCriterionModel m : ecmodels) { | |
557 | - zl += m.getProjectVal(); | |
558 | - } | |
551 | +// Integer month = model.getCheckMonth(); | |
552 | +// int [] months = null; | |
553 | +// months = getInts(months, month); | |
554 | +// int month1 = months[0]; | |
555 | +// List<BabyEvaluationCriterionModel> ecmodels = mongoTemplate.find(Query.query(Criteria.where("month").lt(month1).and("type").is(3)), BabyEvaluationCriterionModel.class); | |
556 | +// for (BabyEvaluationCriterionModel m : ecmodels) { | |
557 | +// zl += m.getProjectVal(); | |
558 | +// } | |
559 | 559 | |
560 | 560 | DecimalFormat df = new DecimalFormat("0.00"); |
561 | 561 | String zlStr = ""; |
562 | 562 | if (zl != 0.00) { |
563 | 563 | zlStr = String.format(df.format(zl / 5)); |
564 | 564 | } |
565 | - Map<String, Object> reportMap = getStringObjectMap(DateUtil.getBabyAgeMonth(model.getBirth(), new Date() ), | |
565 | + Map<String, Object> reportMap = getStringObjectMap(DateUtil.getBabyAgeMonth(model.getBirth(), new Date())+ DateUtil.getMonthDays(model.getBirth()), | |
566 | 566 | double1Dq, double2Dq, double3Dq, double4Dq, double5Dq, double1Z, double2Z, double3Z, double4Z, double5Z); |
567 | 567 | |
568 | 568 | // 智龄、报表 |
... | ... | @@ -678,7 +678,7 @@ |
678 | 678 | if (zl != 0.00) { |
679 | 679 | zlStr = String.format(df.format(zl / 5)); |
680 | 680 | } |
681 | - Map<String, Object> reportMap = getStringObjectMap(DateUtil.getBabyAgeMonth(model.getBirth(), new Date() ), | |
681 | + Map<String, Object> reportMap = getStringObjectMap(DateUtil.getBabyAgeMonth(model.getBirth(), new Date())+ DateUtil.getMonthDays(model.getBirth()), | |
682 | 682 | double1Dq, double2Dq, double3Dq, double4Dq, double5Dq, double1Z, double2Z, double3Z, double4Z, double5Z); |
683 | 683 | |
684 | 684 | // 智龄、报表 |