Browse Source

# 设备编码生成方式改为雪花编码

# 消息读取接口修改
zhongwei
haungxing 2 years ago
parent
commit
9820536938
  1. 3
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmInfoServiceImpl.java
  2. 22
      hzims-service/message/src/main/java/com/hnac/hzims/message/controller/MessagePushRecordController.java

3
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.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.hnac.hzims.equipment.EquipmentContants; import com.hnac.hzims.equipment.EquipmentContants;
@ -107,7 +108,7 @@ public class EmInfoServiceImpl extends BaseServiceImpl<EmInfoMapper, EmInfoEntit
// 验证设备信息 // 验证设备信息
this.validEmInfo(em_info); this.validEmInfo(em_info);
EmInfoEntity infoEntity = em_info.getInfo(); EmInfoEntity infoEntity = em_info.getInfo();
//infoEntity.setNumber(Func.); infoEntity.setNumber(Long.toString(IdWorker.getId()));
if (this.save(infoEntity)) { if (this.save(infoEntity)) {
this.getStationCodeStoreRedis(); this.getStationCodeStoreRedis();
Long infoId = em_info.getInfo().getId(); Long infoId = em_info.getInfo().getId();

22
hzims-service/message/src/main/java/com/hnac/hzims/message/controller/MessagePushRecordController.java

@ -1,7 +1,10 @@
package com.hnac.hzims.message.controller; package com.hnac.hzims.message.controller;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.message.MessageConstants;
import com.hnac.hzims.message.entity.MessagePushRecordEntity; import com.hnac.hzims.message.entity.MessagePushRecordEntity;
import com.hnac.hzims.message.service.IMessagePushRecordService; import com.hnac.hzims.message.service.IMessagePushRecordService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
@ -10,9 +13,11 @@ import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController; import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.time.LocalDateTime;
import java.util.List; import java.util.List;
@RestController @RestController
@ -53,8 +58,23 @@ public class MessagePushRecordController extends BladeController {
@GetMapping("/send/{id}") @GetMapping("/send/{id}")
@ApiOperation("推送消息记录") @ApiOperation("推送消息记录")
@ApiOperationSupport(order = 4) @ApiOperationSupport(order = 5)
public R<Boolean> send(@PathVariable @ApiParam("消息记录ID") Long id) { public R<Boolean> send(@PathVariable @ApiParam("消息记录ID") Long id) {
return R.data(messagePushRecordService.send(id)); return R.data(messagePushRecordService.send(id));
} }
@GetMapping("/readMessage/{id}")
@ApiOperation("读取消息")
@ApiOperationSupport(order = 6)
public R<Boolean> readMessage(@PathVariable @ApiParam("消息记录ID") Long id) {
MessagePushRecordEntity record = messagePushRecordService.getById(id);
if(!record.getPusher().equals(AuthUtil.getUserId())) {
return R.fail("当前登录人不是消息推送人,修改状态失败");
}
LambdaUpdateWrapper<MessagePushRecordEntity> eq = Wrappers.<MessagePushRecordEntity>lambdaUpdate()
.set(MessagePushRecordEntity::getStatus, MessageConstants.CONFIRM)
.set(MessagePushRecordEntity::getRespondTime, LocalDateTime.now())
.eq(MessagePushRecordEntity::getId, id);
return R.status(messagePushRecordService.update(eq));
}
} }

Loading…
Cancel
Save