Commit 2afa12abcd916ccd0af65ddb79869543d6b97003

Authored by liquanyu
1 parent db143205b8
Exists in master

儿童统计

Showing 3 changed files with 18 additions and 10 deletions

platform-common/src/main/java/com/lyms/platform/common/utils/DateUtil.java View file @ 2afa12a
... ... @@ -7,9 +7,11 @@
7 7 import java.util.Calendar;
8 8 import java.util.Date;
9 9 import java.util.GregorianCalendar;
  10 +import java.util.concurrent.locks.Lock;
  11 +import java.util.concurrent.locks.ReentrantLock;
10 12  
11 13 public class DateUtil {
12   -
  14 + private static Lock lock = new ReentrantLock();
13 15 public static SimpleDateFormat dd = new SimpleDateFormat("dd");
14 16 public static SimpleDateFormat ymd = new SimpleDateFormat("yyyyMMdd");
15 17 public static SimpleDateFormat y_m_d = new SimpleDateFormat("yyyy-MM-dd");
16 18  
17 19  
... ... @@ -215,10 +217,14 @@
215 217 if (s == null) {
216 218 return null;
217 219 }
  220 +
218 221 try {
  222 + lock.lock();
219 223 return y_m_d.parse(s);
220 224 } catch (Exception e) {
221 225 return null;
  226 + }finally {
  227 + lock.unlock();
222 228 }
223 229 }
224 230  
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java View file @ 2afa12a
... ... @@ -776,7 +776,7 @@
776 776  
777 777 String weight = checkModel.getWeight();
778 778 if (com.lyms.platform.common.utils.StringUtils.isNotEmpty(weight)) {
779   - String value = babyCheckFacade.getGrowthValue(birth,Double.parseDouble(weight),babyModel.getSex(),3);
  779 + String value = babyCheckFacade.getGrowthValue(birth,Double.parseDouble(weight),babyModel.getSex(),0);
780 780 checkModel.setWeightEvaluate(value);
781 781 }
782 782  
platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/GrowthCountTask.java View file @ 2afa12a
1 1 package com.lyms.platform.operate.web.utils;
2 2  
3   -import com.lyms.platform.biz.service.BabyBookbuildingService;
4 3 import com.lyms.platform.biz.service.BabyCheckService;
5 4 import com.lyms.platform.common.utils.ExceptionUtils;
6 5 import com.lyms.platform.operate.web.result.BabyGrowthCountResult;
7 6 import com.lyms.platform.query.BabyCheckModelQuery;
8   -import com.lyms.platform.query.BabyModelQuery;
9 7 import org.apache.commons.collections.CollectionUtils;
10 8  
11 9 import java.util.ArrayList;
... ... @@ -34,7 +32,7 @@
34 32 List<BabyGrowthCountResult> results = new ArrayList<>();
35 33 if (CollectionUtils.isNotEmpty(growth)) {
36 34  
37   - int batchSize = 1;
  35 + int batchSize = 2;
38 36 int end = 0;
39 37 List<Future> futures = new ArrayList<>();
40 38 for (int i = 0; i < growth.size(); i += batchSize) {
41 39  
... ... @@ -73,13 +71,17 @@
73 71 Future f = pool.submit(c);
74 72 futures.add(f);
75 73 }
76   - for (Future f : futures) {
77   - try {
78   - results.addAll((List) f.get(30, TimeUnit.SECONDS));
79   - } catch (Exception e) {
80   - ExceptionUtils.catchException(e, "baby growth count");
  74 + if (CollectionUtils.isNotEmpty(futures))
  75 + {
  76 + for (Future f : futures) {
  77 + try {
  78 + results.addAll((List) f.get(30, TimeUnit.SECONDS));
  79 + } catch (Exception e) {
  80 + ExceptionUtils.catchException(e, "baby growth count");
  81 + }
81 82 }
82 83 }
  84 +
83 85 }
84 86  
85 87 return results;