diff --git a/platform-common/src/main/java/com/lyms/platform/common/utils/DateUtil.java b/platform-common/src/main/java/com/lyms/platform/common/utils/DateUtil.java index 36e81db..9cddd60 100644 --- a/platform-common/src/main/java/com/lyms/platform/common/utils/DateUtil.java +++ b/platform-common/src/main/java/com/lyms/platform/common/utils/DateUtil.java @@ -2,6 +2,7 @@ package com.lyms.platform.common.utils; import org.joda.time.DateTime; +import java.math.BigDecimal; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.*; @@ -1699,16 +1700,29 @@ public class DateUtil { return getYmdDate(calendar.getTime()); } - public static void main(String[] args) { - - Date bir = parseYMD("2002-10-05"); - Date bir1 = parseYMD("2020-12-05"); - int i = DateUtil.getAge2(bir, bir1); - System.out.println(i); + public static double getMonthDays(Date birth) + { + int month = DateUtil.getBabyAgeMonth(birth, new Date()); + Date date = addMonth(birth, month); + int days = daysBetween(date, new Date()); + BigDecimal bg = new BigDecimal(1.0/30*days); + double doubleValue = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); + return doubleValue; + } - System.out.println( DateUtil.getDayStartTime(new Date())); - System.out.println( DateUtil.getDayEndTime(new Date())); + public static void main(String[] args) { +// +// Date bir = parseYMD("2021-05-29"); +// int i = DateUtil.getBabyAgeMonth(bir, new Date()); +// System.out.println(i); +// Date d = addMonth(bir, i); +// int a = daysBetween(d, new Date()); +// System.out.println(a); +// BigDecimal bg = new BigDecimal(1.0/30*a); +// double f1 = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); +// +// System.out.println(f1); } } diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BabyEvaluationCriterionServiceImpl.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BabyEvaluationCriterionServiceImpl.java index a36d435..0df0d9c 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BabyEvaluationCriterionServiceImpl.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BabyEvaluationCriterionServiceImpl.java @@ -391,7 +391,7 @@ public class BabyEvaluationCriterionServiceImpl implements BabyEvaluationCriteri * @param double5Z * @return */ - private Map getStringObjectMap(Integer checkMonth, int double1Dq, int double2Dq, int double3Dq, int double4Dq, int double5Dq, Double double1Z, Double double2Z, Double double3Z, Double double4Z, Double double5Z) { + private Map getStringObjectMap(Double checkMonth, int double1Dq, int double2Dq, int double3Dq, int double4Dq, int double5Dq, Double double1Z, Double double2Z, Double double3Z, Double double4Z, Double double5Z) { Map reportMap = new HashMap<>(); LinkedList objects1 = new LinkedList<>(); String s1z = ""; @@ -548,21 +548,21 @@ public class BabyEvaluationCriterionServiceImpl implements BabyEvaluationCriteri } } } - Integer month = model.getCheckMonth(); - int [] months = null; - months = getInts(months, month); - int month1 = months[0]; - List ecmodels = mongoTemplate.find(Query.query(Criteria.where("month").lt(month1).and("type").is(3)), BabyEvaluationCriterionModel.class); - for (BabyEvaluationCriterionModel m : ecmodels) { - zl += m.getProjectVal(); - } +// Integer month = model.getCheckMonth(); +// int [] months = null; +// months = getInts(months, month); +// int month1 = months[0]; +// List ecmodels = mongoTemplate.find(Query.query(Criteria.where("month").lt(month1).and("type").is(3)), BabyEvaluationCriterionModel.class); +// for (BabyEvaluationCriterionModel m : ecmodels) { +// zl += m.getProjectVal(); +// } DecimalFormat df = new DecimalFormat("0.00"); String zlStr = ""; if (zl != 0.00) { zlStr = String.format(df.format(zl / 5)); } - Map reportMap = getStringObjectMap(DateUtil.getBabyAgeMonth(model.getBirth(), new Date() ), + Map reportMap = getStringObjectMap(DateUtil.getBabyAgeMonth(model.getBirth(), new Date())+ DateUtil.getMonthDays(model.getBirth()), double1Dq, double2Dq, double3Dq, double4Dq, double5Dq, double1Z, double2Z, double3Z, double4Z, double5Z); // 智龄、报表 @@ -678,7 +678,7 @@ public class BabyEvaluationCriterionServiceImpl implements BabyEvaluationCriteri if (zl != 0.00) { zlStr = String.format(df.format(zl / 5)); } - Map reportMap = getStringObjectMap(DateUtil.getBabyAgeMonth(model.getBirth(), new Date() ), + Map reportMap = getStringObjectMap(DateUtil.getBabyAgeMonth(model.getBirth(), new Date())+ DateUtil.getMonthDays(model.getBirth()), double1Dq, double2Dq, double3Dq, double4Dq, double5Dq, double1Z, double2Z, double3Z, double4Z, double5Z); // 智龄、报表