Commit 258bba6ff274af5bcbdd665e4bbd99c96c304852

Authored by liquanyu
1 parent e67d58eed3

update

Showing 2 changed files with 46 additions and 76 deletions

platform-biz-service/src/main/java/com/lyms/platform/permission/service/impl/LisServiceImpl.java View file @ 258bba6
... ... @@ -33,29 +33,21 @@
33 33 System.out.println("saveLis data size = "+ lisList.size());
34 34 if (CollectionUtils.isNotEmpty(lisList))
35 35 {
36   - CountDownLatch countDownLatch = new CountDownLatch(1);
37   - new Thread(new LisSaveTask(countDownLatch,masterLisMapper,lisList)).start();
  36 + int batchSize = 10;
  37 + //线程数
  38 + int threadCount = lisList.size()%batchSize == 0 ? lisList.size()/batchSize : lisList.size()/batchSize+1;
  39 + System.out.println("threadCount = "+ threadCount);
  40 + CountDownLatch countDownLatch = new CountDownLatch(threadCount);
  41 + int end = 0;
  42 + for (int i = 0; i < lisList.size(); i += batchSize) {
  43 + end = (end + batchSize);
  44 + if (end > lisList.size()) {
  45 + end = lisList.size();
  46 + }
  47 + List<LisReportModel> models = lisList.subList(i, end);
  48 + new Thread(new LisSaveTask(countDownLatch,masterLisMapper,models)).start();
  49 + }
38 50 countDownLatch.await();
39   -
40   -// int batchSize = 10;
41   -// //线程数
42   -// int threadCount = lisList.size()%batchSize == 0 ? lisList.size()/batchSize : lisList.size()/batchSize+1;
43   -// System.out.println("threadCount = "+ threadCount);
44   -// CountDownLatch countDownLatch = new CountDownLatch(threadCount);
45   -// int end = 0;
46   -// for (int i = 0; i < lisList.size(); i += batchSize) {
47   -// end = (end + batchSize);
48   -// if (end > lisList.size()) {
49   -// end = lisList.size();
50   -// }
51   -// List<LisReportModel> models = lisList.subList(i, end);
52   -// new Thread(new LisSaveTask(countDownLatch,masterLisMapper,models)).start();
53   -// System.out.println("spit end");
54   -// }
55   -// countDownLatch.await();
56   -
57   - System.out.println("exce end");
58   -
59 51 }
60 52 return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
61 53 }
... ... @@ -63,34 +55,6 @@
63 55 {
64 56 return new BaseResponse().setErrorcode(ErrorCodeConstants.SYSTEM_ERROR).setErrormsg(ErrorCodeConstants.SYSTEM_ERROR_DESCRIPTION);
65 57 }
66   -
67   -// try {
68   -// System.out.println("saveLis data size = "+ lisList.size());
69   -// if (CollectionUtils.isNotEmpty(lisList))
70   -// {
71   -// new Thread(new Runnable() {
72   -// @Override
73   -// public void run() {
74   -// for(LisReportModel model : lisList)
75   -// {
76   -// List<LisReportModel> dbLis = masterLisMapper.queryLisDataByModel(model);
77   -// if (CollectionUtils.isEmpty(dbLis))
78   -// {
79   -// masterLisMapper.saveLisData(model);
80   -// }
81   -//
82   -// }
83   -// }
84   -// },"saveLisDataThread").start();
85   -//
86   -// }
87   -// return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
88   -// }
89   -// catch (Exception e)
90   -// {
91   -// return new BaseResponse().setErrorcode(ErrorCodeConstants.SYSTEM_ERROR).setErrormsg(ErrorCodeConstants.SYSTEM_ERROR_DESCRIPTION);
92   -// }
93   -
94 58 }
95 59  
96 60 @Override
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/LisController.java View file @ 258bba6
... ... @@ -55,35 +55,41 @@
55 55 {
56 56 for(LisReportModelRequest lisRequest : models)
57 57 {
58   - LisReportModel model = new LisReportModel();
59   - List<LisReportItemModel> items = lisRequest.getItems();
60   - if (CollectionUtils.isNotEmpty(items))
  58 + try {
  59 + LisReportModel model = new LisReportModel();
  60 + List<LisReportItemModel> items = lisRequest.getItems();
  61 + if (CollectionUtils.isNotEmpty(items))
  62 + {
  63 + model.setItemJson(JsonUtil.array2JsonString(items));
  64 + }
  65 +
  66 + model.setStatus(lisRequest.getStatus());
  67 + model.setId(lisRequest.getId());
  68 + model.setVcCardNo(lisRequest.getVcCardNo());
  69 + model.setHospitalId(lisRequest.getHospitalId());
  70 + model.setLisId(lisRequest.getLisId());
  71 + model.setAge(lisRequest.getAge());
  72 + model.setName(lisRequest.getName());
  73 + model.setBhnum(lisRequest.getBhnum());
  74 + model.setPhone(lisRequest.getPhone());
  75 + model.setSex(lisRequest.getSex());
  76 + model.setTitle(lisRequest.getTitle());
  77 + model.setType(lisRequest.getType());
  78 + model.setChecker(lisRequest.getChecker());
  79 + model.setApplyDept(lisRequest.getApplyDept());
  80 + model.setApplyDoctor(lisRequest.getApplyDoctor());
  81 + model.setApplyTime(DateUtil.parseYMDHMS(lisRequest.getApplyTime()));
  82 + model.setPublishTime(DateUtil.parseYMDHMS(lisRequest.getPublishTime()));
  83 + model.setModified(DateUtil.parseYMDHMS(lisRequest.getModified()));
  84 + model.setCreated(DateUtil.parseYMDHMS(lisRequest.getCreated()));
  85 + model.setCheckTime(DateUtil.parseYMDHMS(lisRequest.getCheckTime()));
  86 +
  87 + list.add(model);
  88 + }catch (Exception e)
61 89 {
62   - model.setItemJson(JsonUtil.array2JsonString(items));
  90 + continue;
63 91 }
64 92  
65   - model.setStatus(lisRequest.getStatus());
66   - model.setId(lisRequest.getId());
67   - model.setVcCardNo(lisRequest.getVcCardNo());
68   - model.setHospitalId(lisRequest.getHospitalId());
69   - model.setLisId(lisRequest.getLisId());
70   - model.setAge(lisRequest.getAge());
71   - model.setName(lisRequest.getName());
72   - model.setBhnum(lisRequest.getBhnum());
73   - model.setPhone(lisRequest.getPhone());
74   - model.setSex(lisRequest.getSex());
75   - model.setTitle(lisRequest.getTitle());
76   - model.setType(lisRequest.getType());
77   - model.setChecker(lisRequest.getChecker());
78   - model.setApplyDept(lisRequest.getApplyDept());
79   - model.setApplyDoctor(lisRequest.getApplyDoctor());
80   - model.setApplyTime(DateUtil.parseYMDHMS(lisRequest.getApplyTime()));
81   - model.setPublishTime(DateUtil.parseYMDHMS(lisRequest.getPublishTime()));
82   - model.setModified(DateUtil.parseYMDHMS(lisRequest.getModified()));
83   - model.setCreated(DateUtil.parseYMDHMS(lisRequest.getCreated()));
84   - model.setCheckTime(DateUtil.parseYMDHMS(lisRequest.getCheckTime()));
85   -
86   - list.add(model);
87 93  
88 94 }
89 95 }