Commit b25adaf78e0e54e9414ff8bf1bc9bd041f25c8fe
1 parent
c7192465e4
Exists in
dev
#fix:优化儿保消息通知小程序查询逻辑
Showing 1 changed file with 5 additions and 4 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyMsgFacade.java
View file @
b25adaf
| ... | ... | @@ -150,18 +150,19 @@ |
| 150 | 150 | List<BabyMsgModelRecord> models = babyMsgService.queryMsgRecordList(msgQuery); |
| 151 | 151 | if (CollectionUtils.isNotEmpty(models)){ |
| 152 | 152 | BabyMsgModelRecord msgModelRecord= models.get(0); |
| 153 | + msgQuery.setId(msgModelRecord.getMsgId()); | |
| 154 | + List<BabyMsgModel> msgModels= babyMsgService.queryMsgList(msgQuery); | |
| 155 | + BabyMsgModel msgModel= msgModels.get(0); | |
| 153 | 156 | if (msgModelRecord.getState()==0){ |
| 154 | 157 | msgModelRecord.setState(1); |
| 155 | 158 | Update update= MongoConvertHelper |
| 156 | 159 | .convertToNativeUpdate(ReflectionUtils.getUpdateField(msgModelRecord)); |
| 157 | 160 | mongoTemplate.updateMulti(msgQuery.convertToQuery().convertToMongoQuery(),update, MsgModelRecord.class); |
| 158 | - msgQuery.setId(msgModelRecord.getMsgId()); | |
| 159 | - List<BabyMsgModel> msgModels= babyMsgService.queryMsgList(msgQuery); | |
| 160 | - BabyMsgModel msgModel= msgModels.get(0); | |
| 161 | 161 | msgModel.setReadNum(msgModel.getReadNum()!=null?msgModel.getReadNum()+1:1); |
| 162 | 162 | babyMsgService.updateMsg(msgModel); |
| 163 | - msgModelRecord.setReadNum(msgModel.getReadNum()); | |
| 164 | 163 | babyMsgService.updateRecordMsg(msgModelRecord); |
| 164 | + }else { | |
| 165 | + msgModelRecord.setReadNum(msgModel.getReadNum()); | |
| 165 | 166 | } |
| 166 | 167 | objectResponse.setObject(msgModelRecord); |
| 167 | 168 | } |