Commit 88cc2321 by 汪志阳

modify:bug 修改

parent ee0017fa
......@@ -163,8 +163,6 @@ public class PlatElderSleepController {
@ApiOperation("测试")
@GetMapping("test11")
@AuthIgnore
@TenantIdIgnore
public ApiResponseEntity<Void> test11(@RequestParam String id) {
PlatAlarmRecord alarmRecord = platAlarmRecordService.getById(id);
PlatAlarmConfig alarmConfig = alarmConfigService.getById(alarmRecord.getAlarmId());
......
......@@ -36,7 +36,6 @@ import com.makeit.global.aspect.tenant.TenantIdIgnore;
import com.makeit.mapper.platform.alarm.PlatAlarmRecordMapper;
import com.makeit.mapper.platform.elder.PlatElderChildrenInfoMapper;
import com.makeit.module.iot.service.IotDevicePropertiesOperateService;
import com.makeit.module.system.entity.SysDictionary;
import com.makeit.module.system.service.SysDictionaryService;
import com.makeit.service.platform.alarm.PlatAlarmConfigService;
import com.makeit.service.platform.alarm.PlatAlarmRecordService;
......@@ -356,40 +355,46 @@ public class PlatAlarmRecordServiceImpl extends ServiceImpl<PlatAlarmRecordMappe
if (CollUtil.isEmpty(childInfoList)) {
return list;
}
PlatDevice device = platDeviceService.getById(alarmRecord.getDeviceId());
PageReqDTO<PlatDeviceQueryDTO> pageReqDTO = new PageReqDTO<>();
pageReqDTO.setPage(1);
pageReqDTO.setLimit(1);
PlatDeviceQueryDTO queryDTO = new PlatDeviceQueryDTO();
queryDTO.setId(alarmRecord.getDeviceId());
queryDTO.setOriDeviceId(device.getOriDeviceId());
queryDTO.setTenantId(alarmRecord.getTenantId());
pageReqDTO.setData(queryDTO);
PageVO<PlatDeviceListVO> platPage = platDeviceService.platPage(pageReqDTO);
String regionName = "";
if (platPage != null && CollUtil.isNotEmpty(platPage.getList())) {
regionName = platPage.getList().get(0).getSpaceName();
}
if (StrUtil.isBlank(regionName)) {
regionName = StrUtil.isNotBlank(alarmRecord.getRegionName()) ? alarmRecord.getRegionName() : " ";
}
List<SysDictionary> dictList = sysDictionaryService.list(Wrappers.<SysDictionary>lambdaQuery().like(SysDictionary::getCode, "alarm.alarmType"));
Map<String, SysDictionary> dictMap = StreamUtil.toMapDep(dictList, SysDictionary::getValue);
SysDictionary dictionary = dictMap.get(alarmRecord.getAlarmType());
String finalRegionName = regionName;
PlatElder elder = platElderService.getById(alarmRecord.getElderIds());
childInfoList.forEach(c -> {
if (StrUtil.isBlank(c.getWeChatOpenid())) {
return;
}
MsgSendDTO.ReceiverInfo receiverInfo = new MsgSendDTO.ReceiverInfo();
receiverInfo.setRegionName(finalRegionName);
receiverInfo.setName(alarmRecord.getElderName());
receiverInfo.setName(elder.getName());
receiverInfo.setWeChatOpenid(c.getWeChatOpenid());
receiverInfo.setAlarmDate(alarmRecord.getAlarmDate());
receiverInfo.setAlarmType(dictionary != null ? dictionary.getName() : alarmRecord.getAlarmType());
receiverInfo.setAlarmType(DICT_MAP.get(alarmRecord.getAlarmType()));
list.add(receiverInfo);
});
return list;
}
private static final Map<String, String> DICT_MAP = new HashMap<>();
static {
DICT_MAP.put("1", "长者跌倒");
DICT_MAP.put("2", "呼吸异常");
DICT_MAP.put("3", "心率异常");
DICT_MAP.put("4", "行为异常");
DICT_MAP.put("5", "离床告警");
}
/**
* 通知工作人员
* 短信
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment