Commit 8d4983ac943bd71da45a5fe351b28435aa2fd8f6

Authored by liquanyu
1 parent 24af75dd2d

update code

Showing 6 changed files with 56 additions and 15 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyBookbuildingFacade.java View file @ 8d4983a
... ... @@ -31,7 +31,9 @@
31 31 import org.apache.commons.lang.math.*;
32 32 import org.apache.commons.lang.math.NumberUtils;
33 33 import org.springframework.beans.factory.annotation.Autowired;
  34 +import org.springframework.beans.factory.annotation.Qualifier;
34 35 import org.springframework.data.domain.Sort;
  36 +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
35 37 import org.springframework.stereotype.Component;
36 38  
37 39 import javax.servlet.http.HttpServletResponse;
38 40  
... ... @@ -114,11 +116,11 @@
114 116 private OrganizationGroupsFacade groupsFacade;
115 117  
116 118  
  119 + @Autowired
  120 + @Qualifier("commonThreadPool")
  121 + private ThreadPoolTaskExecutor commonThreadPool;
117 122  
118 123  
119   - private static ExecutorService pool = Executors.newFixedThreadPool(10);
120   -
121   -
122 124 public BaseResponse getBabyBase(String babyId) {
123 125 //查询儿童的基本信息
124 126 BabyBasicResult base = new BabyBasicResult();
... ... @@ -1635,7 +1637,7 @@
1635 1637 organizationService,
1636 1638 babyCheckFacade,
1637 1639 ms,request.getIsArea(),hospitalName);
1638   - Future f = pool.submit(c);
  1640 + Future f = commonThreadPool.submit(c);
1639 1641 futures.add(f);
1640 1642 }
1641 1643 if (CollectionUtils.isNotEmpty(futures))
... ... @@ -2197,7 +2199,7 @@
2197 2199 }
2198 2200 };
2199 2201  
2200   - Future f = pool.submit(c);
  2202 + Future f = commonThreadPool.submit(c);
2201 2203 futures.add(f);
2202 2204 }
2203 2205 for (Future f : futures) {
... ... @@ -2482,7 +2484,7 @@
2482 2484 }
2483 2485 };
2484 2486  
2485   - Future f = pool.submit(c);
  2487 + Future f = commonThreadPool.submit(c);
2486 2488 futures.add(f);
2487 2489 }
2488 2490 if (CollectionUtils.isNotEmpty(futures))
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/CorrectDataFacade.java View file @ 8d4983a
... ... @@ -12,6 +12,8 @@
12 12 import org.slf4j.Logger;
13 13 import org.slf4j.LoggerFactory;
14 14 import org.springframework.beans.factory.annotation.Autowired;
  15 +import org.springframework.beans.factory.annotation.Qualifier;
  16 +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
15 17 import org.springframework.stereotype.Component;
16 18  
17 19 import java.util.ArrayList;
18 20  
... ... @@ -37,8 +39,11 @@
37 39 @Autowired
38 40 private AntenatalExaminationService anExService;
39 41  
40   - private ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(5, 10, 1, TimeUnit.MINUTES, new LinkedBlockingQueue<Runnable>(5000));
  42 + @Autowired
  43 + @Qualifier("commonThreadPool")
  44 + private ThreadPoolTaskExecutor commonThreadPool;
41 45  
  46 +
42 47 /**
43 48 *
44 49 * 纠正数据
... ... @@ -60,7 +65,7 @@
60 65 if (end > patientses.size()) {
61 66 end = patientses.size();
62 67 }
63   - threadPoolExecutor.submit(new CorrectDataWorker(patientses.subList(i, end),postReviewService,patientsService,anExService,antExFacade,counter));
  68 + commonThreadPool.submit(new CorrectDataWorker(patientses.subList(i, end),postReviewService,patientsService,anExService,antExFacade,counter));
64 69 }
65 70 logger.info("hand hospitalId :" +hospitalId+", update count "+counter.get());
66 71 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientFacade.java View file @ 8d4983a
... ... @@ -27,6 +27,8 @@
27 27 import org.slf4j.Logger;
28 28 import org.slf4j.LoggerFactory;
29 29 import org.springframework.beans.factory.annotation.Autowired;
  30 +import org.springframework.beans.factory.annotation.Qualifier;
  31 +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
30 32 import org.springframework.stereotype.Component;
31 33 import org.springframework.util.StopWatch;
32 34  
33 35  
... ... @@ -82,8 +84,11 @@
82 84 @Autowired
83 85 private OrganizationGroupsFacade groupsFacade;
84 86  
85   - private ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(15, 20, 1, TimeUnit.MINUTES, new LinkedBlockingQueue<Runnable>(5000));
  87 + @Autowired
  88 + @Qualifier("commonThreadPool")
  89 + private ThreadPoolTaskExecutor commonThreadPool;
86 90  
  91 +
87 92 /**
88 93 * 修改产妇的社区
89 94 *
... ... @@ -518,7 +523,7 @@
518 523 if (end > patientses.size()) {
519 524 end = patientses.size();
520 525 }
521   - listFuture.add(threadPoolExecutor.submit(new QuanChanPatientWorker(patientses.subList(i, end), hospital, usersService, postReviewService, matDeliverService, patientsService, organizationService, basicConfigService)));
  526 + listFuture.add(commonThreadPool.submit(new QuanChanPatientWorker(patientses.subList(i, end), hospital, usersService, postReviewService, matDeliverService, patientsService, organizationService, basicConfigService)));
522 527 }
523 528 for (Future f : listFuture) {
524 529 try {
... ... @@ -541,7 +546,7 @@
541 546 if (end > patientses.size()) {
542 547 end = patientses.size();
543 548 }
544   - listFuture.add(threadPoolExecutor.submit(new QuanPatientWorker(patientses.subList(i, end), usersService, hospital, antExService, basicConfigService, patientsService, organizationService)));
  549 + listFuture.add(commonThreadPool.submit(new QuanPatientWorker(patientses.subList(i, end), usersService, hospital, antExService, basicConfigService, patientsService, organizationService)));
545 550 }
546 551 for (Future f : listFuture) {
547 552 try {
... ... @@ -569,7 +574,7 @@
569 574 if (end > patientses.size()) {
570 575 end = patientses.size();
571 576 }
572   - listFuture.add(threadPoolExecutor.submit(new WorkHR(patientses.subList(i, end), usersService, hospital, basicConfigService, antExService, patientsService, organizationService)));
  577 + listFuture.add(commonThreadPool.submit(new WorkHR(patientses.subList(i, end), usersService, hospital, basicConfigService, antExService, patientsService, organizationService)));
573 578 }
574 579 for (Future f : listFuture) {
575 580 try {
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/RiskReportFacade.java View file @ 8d4983a
... ... @@ -23,7 +23,9 @@
23 23 import com.lyms.platform.query.*;
24 24 import org.apache.commons.collections.CollectionUtils;
25 25 import org.springframework.beans.factory.annotation.Autowired;
  26 +import org.springframework.beans.factory.annotation.Qualifier;
26 27 import org.springframework.data.domain.Sort;
  28 +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
27 29 import org.springframework.stereotype.Component;
28 30  
29 31 import java.text.DecimalFormat;
30 32  
... ... @@ -33,8 +35,11 @@
33 35 @Component
34 36 public class RiskReportFacade {
35 37  
36   - private static ExecutorService pool = Executors.newFixedThreadPool(4);
  38 + @Autowired
  39 + @Qualifier("commonThreadPool")
  40 + private ThreadPoolTaskExecutor commonThreadPool;
37 41  
  42 +
38 43 @Autowired
39 44 private PatientsService patientsService;
40 45  
... ... @@ -136,7 +141,7 @@
136 141 patientsService, levelConfig,
137 142 patientsQuery,
138 143 allPatientCount);
139   - Future f = pool.submit(c);
  144 + Future f = commonThreadPool.submit(c);
140 145 futures.add(f);
141 146 }
142 147  
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/ViewFacade.java View file @ 8d4983a
... ... @@ -1945,8 +1945,32 @@
1945 1945 return br;
1946 1946 }
1947 1947  
  1948 +
1948 1949 private ResidentsArchiveResult getResidentsPageResult(ResidentsArchiveModel model) {
1949 1950 ResidentsPageResult result = new ResidentsPageResult();
  1951 + result.setUsername(model.getUsername());
  1952 + result.setSex(SexEnum.getTextById(Integer.valueOf(model.getSex())));
  1953 + result.setBirthday(DateUtil.getyyyy_MM_dd(model.getBirthday()));
  1954 + result.setCountry(getBasicConfig(model.getCountryId()));
  1955 + result.setNation(getBasicConfig(model.getNationId()));
  1956 + result.setMarriage(FunvCommonUtil.getBaseicConfigByid(model.getMarriageId(), basicConfigService));
  1957 + result.setCertificateType(FunvCommonUtil.getBaseicConfigByid(model.getCertificateTypeId(), basicConfigService));
  1958 + result.setCertificateNum(model.getCertificateNum());
  1959 + result.setCensusType(FunvCommonUtil.getBaseicConfigByid(model.getLevelTypeId(), basicConfigService));
  1960 + result.setLevelType(FunvCommonUtil.getBaseicConfigByid(model.getLiveTypeId(), basicConfigService));
  1961 + result.setLevelType(FunvCommonUtil.getBaseicConfigByid(model.getLevelTypeId(), basicConfigService));
  1962 + result.setProfessionType(FunvCommonUtil.getBaseicConfigByid(model.getProfessionTypeId(), basicConfigService));
  1963 + result.setAge(DateUtil.getAge(model.getBirthday(),new Date()));
  1964 +
  1965 +
  1966 +// //手机号
  1967 +// private String phone;
  1968 +// //工作单位
  1969 +// private String workUnit;
  1970 +// //居住地
  1971 +// private String liveAddress;
  1972 +// //户籍地址
  1973 +// private String addressRegister;
1950 1974  
1951 1975 return null;
1952 1976 }
platform-operate-api/src/main/resources/spring/applicationContext.xml View file @ 8d4983a
... ... @@ -60,7 +60,7 @@
60 60  
61 61 <bean id="commonThreadPool" class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor">
62 62 <!-- 核心线程数,默认为1 -->
63   - <property name="corePoolSize" value="10"/>
  63 + <property name="corePoolSize" value="20"/>
64 64  
65 65 <!-- 最大线程数,默认为Integer.MAX_VALUE -->
66 66 <property name="maxPoolSize" value="50" />