diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmInfoServiceImpl.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmInfoServiceImpl.java index 5430d51..7551fd2 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmInfoServiceImpl.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmInfoServiceImpl.java @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.TypeReference; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.IdWorker; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.google.common.collect.Lists; import com.hnac.hzims.equipment.EquipmentContants; @@ -107,7 +108,7 @@ public class EmInfoServiceImpl extends BaseServiceImpl send(@PathVariable @ApiParam("消息记录ID") Long id) { return R.data(messagePushRecordService.send(id)); } + + @GetMapping("/readMessage/{id}") + @ApiOperation("读取消息") + @ApiOperationSupport(order = 6) + public R readMessage(@PathVariable @ApiParam("消息记录ID") Long id) { + MessagePushRecordEntity record = messagePushRecordService.getById(id); + if(!record.getPusher().equals(AuthUtil.getUserId())) { + return R.fail("当前登录人不是消息推送人,修改状态失败"); + } + LambdaUpdateWrapper eq = Wrappers.lambdaUpdate() + .set(MessagePushRecordEntity::getStatus, MessageConstants.CONFIRM) + .set(MessagePushRecordEntity::getRespondTime, LocalDateTime.now()) + .eq(MessagePushRecordEntity::getId, id); + return R.status(messagePushRecordService.update(eq)); + } }