Commit d0b12d09ad3ac8e9a26d24eac018ac2bb73d3c32
1 parent
a6d2aa95c3
Exists in
master
and in
6 other branches
commit
Showing 5 changed files with 35 additions and 3 deletions
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/ArchiveDataDao.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/ArchiveDataDaoImpl.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/ArchiveDataServicer.java
- platform-job-index/src/main/java/com/lyms/platform/job/index/restore/data/SyncDataWork.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/RemoteController.java
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/ArchiveDataDao.java
View file @
d0b12d0
| 1 | 1 | package com.lyms.platform.biz.dal; |
| 2 | 2 | |
| 3 | +import com.lyms.platform.common.dao.operator.MongoCondition; | |
| 4 | +import com.lyms.platform.common.dao.operator.MongoOper; | |
| 3 | 5 | import com.lyms.platform.common.dao.operator.MongoQuery; |
| 4 | 6 | import com.lyms.platform.pojo.ArchiveData; |
| 7 | +import com.lyms.platform.pojo.Patients; | |
| 5 | 8 | |
| 6 | 9 | import java.util.List; |
| 7 | 10 | |
| ... | ... | @@ -12,5 +15,10 @@ |
| 12 | 15 | List<ArchiveData> query(MongoQuery query); |
| 13 | 16 | |
| 14 | 17 | void saveArchiveData(ArchiveData data); |
| 18 | + | |
| 19 | + long count(MongoQuery query); | |
| 20 | + | |
| 21 | + | |
| 22 | + void updatePatient(ArchiveData obj, String id); | |
| 15 | 23 | } |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/ArchiveDataDaoImpl.java
View file @
d0b12d0
| ... | ... | @@ -3,9 +3,12 @@ |
| 3 | 3 | import com.lyms.platform.biz.dal.ArchiveDataDao; |
| 4 | 4 | import com.lyms.platform.biz.dal.IAntExChuDao; |
| 5 | 5 | import com.lyms.platform.common.dao.BaseMongoDAOImpl; |
| 6 | +import com.lyms.platform.common.dao.operator.MongoCondition; | |
| 7 | +import com.lyms.platform.common.dao.operator.MongoOper; | |
| 6 | 8 | import com.lyms.platform.common.dao.operator.MongoQuery; |
| 7 | 9 | import com.lyms.platform.pojo.AntExChuModel; |
| 8 | 10 | import com.lyms.platform.pojo.ArchiveData; |
| 11 | +import com.lyms.platform.pojo.Patients; | |
| 9 | 12 | import org.springframework.stereotype.Repository; |
| 10 | 13 | |
| 11 | 14 | import java.util.List; |
| ... | ... | @@ -23,6 +26,14 @@ |
| 23 | 26 | @Override |
| 24 | 27 | public void saveArchiveData(ArchiveData data) { |
| 25 | 28 | save(data); |
| 29 | + } | |
| 30 | + | |
| 31 | + public long count(MongoQuery query) { | |
| 32 | + return (int) count(query.convertToMongoQuery()); | |
| 33 | + } | |
| 34 | + | |
| 35 | + public void updatePatient(ArchiveData data, String id) { | |
| 36 | + update(new MongoQuery(new MongoCondition("id", id, MongoOper.IS)).convertToMongoQuery(), data); | |
| 26 | 37 | } |
| 27 | 38 | } |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/ArchiveDataServicer.java
View file @
d0b12d0
| ... | ... | @@ -3,6 +3,7 @@ |
| 3 | 3 | import com.lyms.platform.biz.dal.ArchiveDataDao; |
| 4 | 4 | import com.lyms.platform.common.dao.operator.MongoQuery; |
| 5 | 5 | import com.lyms.platform.pojo.ArchiveData; |
| 6 | +import com.lyms.platform.query.ArchiveDataQuery; | |
| 6 | 7 | import org.springframework.beans.factory.annotation.Autowired; |
| 7 | 8 | import org.springframework.stereotype.Service; |
| 8 | 9 | |
| 9 | 10 | |
| ... | ... | @@ -21,9 +22,20 @@ |
| 21 | 22 | return archiveDataDao.query(query); |
| 22 | 23 | } |
| 23 | 24 | |
| 25 | + | |
| 24 | 26 | public void saveArchiveData(ArchiveData data) { |
| 25 | 27 | archiveDataDao.saveArchiveData(data); |
| 26 | 28 | } |
| 27 | 29 | |
| 30 | + public void addOrUpdate(ArchiveData data) { | |
| 31 | + ArchiveDataQuery archiveDataQuery = new ArchiveDataQuery(); | |
| 32 | + archiveDataQuery.setId(data.getId()); | |
| 33 | + MongoQuery query = archiveDataQuery.convertToQuery(); | |
| 34 | + if (archiveDataDao.count(query) == 0) { | |
| 35 | + saveArchiveData(data); | |
| 36 | + } else { | |
| 37 | + archiveDataDao.updatePatient(data, data.getId()); | |
| 38 | + } | |
| 39 | + } | |
| 28 | 40 | } |
platform-job-index/src/main/java/com/lyms/platform/job/index/restore/data/SyncDataWork.java
View file @
d0b12d0
| ... | ... | @@ -180,11 +180,12 @@ |
| 180 | 180 | |
| 181 | 181 | private long readLastSyncTime() |
| 182 | 182 | { |
| 183 | + long time = 900000L; | |
| 183 | 184 | try |
| 184 | 185 | { |
| 185 | 186 | if (-1 != lastSyncTime) |
| 186 | 187 | { |
| 187 | - return lastSyncTime; | |
| 188 | + return lastSyncTime -time; | |
| 188 | 189 | } |
| 189 | 190 | RandomAccessFile randomAccessFile = new RandomAccessFile(new File(FILE_PATH), "rw"); |
| 190 | 191 | String line = randomAccessFile.readLine(); |
| ... | ... | @@ -196,7 +197,7 @@ |
| 196 | 197 | { |
| 197 | 198 | logger.error("read last sync time error.", e); |
| 198 | 199 | } |
| 199 | - return lastSyncTime; | |
| 200 | + return lastSyncTime -time; | |
| 200 | 201 | } |
| 201 | 202 | |
| 202 | 203 | /** |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/RemoteController.java
View file @
d0b12d0