Commit 6d5b2de6 by 李小龙

整理代码

parent 7c260ac2
...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService; ...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.makeit.common.page.PageReqDTO; import com.makeit.common.page.PageReqDTO;
import com.makeit.common.page.PageVO; import com.makeit.common.page.PageVO;
import com.makeit.dto.platform.alarm.PlatAlarmRecordQueryDTO; import com.makeit.dto.platform.alarm.PlatAlarmRecordQueryDTO;
import com.makeit.entity.platform.alarm.PlatAlarmConfig;
import com.makeit.entity.platform.alarm.PlatAlarmRecord; import com.makeit.entity.platform.alarm.PlatAlarmRecord;
import com.makeit.vo.platform.alarm.PlatAlarmRecordVO; import com.makeit.vo.platform.alarm.PlatAlarmRecordVO;
...@@ -28,4 +29,10 @@ public interface PlatAlarmRecordService extends IService<PlatAlarmRecord> { ...@@ -28,4 +29,10 @@ public interface PlatAlarmRecordService extends IService<PlatAlarmRecord> {
void deal(String recordId); void deal(String recordId);
void noticeRelation(String recordId); void noticeRelation(String recordId);
void noticeChildren(PlatAlarmConfig alarmConfig, PlatAlarmRecord alarmRecord);
void noticeUser(PlatAlarmConfig alarmConfig,PlatAlarmRecord alarmRecord);
void noticeDeviceAlarm(PlatAlarmConfig alarmConfig,PlatAlarmRecord alarmRecord);
} }
...@@ -9,9 +9,11 @@ import com.makeit.common.page.PageVO; ...@@ -9,9 +9,11 @@ import com.makeit.common.page.PageVO;
import com.makeit.dto.platform.alarm.PlatAlarmRecordQueryDTO; import com.makeit.dto.platform.alarm.PlatAlarmRecordQueryDTO;
import com.makeit.entity.platform.alarm.PlatAlarmConfig; import com.makeit.entity.platform.alarm.PlatAlarmConfig;
import com.makeit.entity.platform.alarm.PlatAlarmRecord; import com.makeit.entity.platform.alarm.PlatAlarmRecord;
import com.makeit.entity.platform.auth.PlatUser;
import com.makeit.entity.platform.elder.PlatElderChildrenInfo; import com.makeit.entity.platform.elder.PlatElderChildrenInfo;
import com.makeit.enums.CommonEnum; import com.makeit.enums.CommonEnum;
import com.makeit.exception.BusinessException; import com.makeit.exception.BusinessException;
import com.makeit.global.aspect.tenant.TenantIdIgnore;
import com.makeit.mapper.platform.alarm.PlatAlarmRecordMapper; import com.makeit.mapper.platform.alarm.PlatAlarmRecordMapper;
import com.makeit.service.platform.alarm.PlatAlarmConfigService; import com.makeit.service.platform.alarm.PlatAlarmConfigService;
import com.makeit.service.platform.alarm.PlatAlarmRecordService; import com.makeit.service.platform.alarm.PlatAlarmRecordService;
...@@ -139,11 +141,34 @@ public class PlatAlarmRecordServiceImpl extends ServiceImpl<PlatAlarmRecordMappe ...@@ -139,11 +141,34 @@ public class PlatAlarmRecordServiceImpl extends ServiceImpl<PlatAlarmRecordMappe
public void noticeRelation(String recordId) { public void noticeRelation(String recordId) {
PlatAlarmRecord platAlarmRecord = this.getById(recordId); PlatAlarmRecord platAlarmRecord = this.getById(recordId);
PlatAlarmConfig platAlarmConfig = platAlarmConfigService.getById(platAlarmRecord.getAlarmId()); PlatAlarmConfig platAlarmConfig = platAlarmConfigService.getById(platAlarmRecord.getAlarmId());
String elderIds = platAlarmRecord.getElderIds(); String elderIds = platAlarmRecord.getElderIds();
if (StringUtils.isBlank(elderIds)) { if (StringUtils.isBlank(elderIds)) {
throw new BusinessException("设备没绑定长者"); throw new BusinessException("设备没绑定长者");
} }
noticeChildren(platAlarmConfig,platAlarmRecord);
}
/**
* 发送消息
*/
@Transactional
@Override
public void noticeDeviceAlarm(PlatAlarmConfig alarmConfig,PlatAlarmRecord alarmRecord){
}
/**
* 通知家属
* 子女端小程序
* 短信
* 语音短信
* @param alarmConfig
* @param alarmRecord
*/
@Transactional
@TenantIdIgnore
public void noticeChildren(PlatAlarmConfig alarmConfig,PlatAlarmRecord alarmRecord){
String elderIds = alarmRecord.getElderIds();
List<PlatElderChildrenInfo> allChildInfoList = new ArrayList<>(); List<PlatElderChildrenInfo> allChildInfoList = new ArrayList<>();
String[] elderIdSplit = elderIds.split(","); String[] elderIdSplit = elderIds.split(",");
...@@ -160,7 +185,7 @@ public class PlatAlarmRecordServiceImpl extends ServiceImpl<PlatAlarmRecordMappe ...@@ -160,7 +185,7 @@ public class PlatAlarmRecordServiceImpl extends ServiceImpl<PlatAlarmRecordMappe
} }
allChildInfoList.addAll(childrenInfoList); allChildInfoList.addAll(childrenInfoList);
Set<String> phoneSet = childrenInfoList.stream().map(PlatElderChildrenInfo::getPhone).collect(Collectors.toSet()); Set<String> phoneSet = childrenInfoList.stream().map(PlatElderChildrenInfo::getPhone).collect(Collectors.toSet());
String notifyChannel = platAlarmConfig.getNotifyChannel(); String notifyChannel = alarmConfig.getNotifyChannel();
String[] split = notifyChannel.split(","); String[] split = notifyChannel.split(",");
//告警配置和租户告警 字典一致 //告警配置和租户告警 字典一致
...@@ -172,7 +197,7 @@ public class PlatAlarmRecordServiceImpl extends ServiceImpl<PlatAlarmRecordMappe ...@@ -172,7 +197,7 @@ public class PlatAlarmRecordServiceImpl extends ServiceImpl<PlatAlarmRecordMappe
MsgSendDTO msgSendDTO = new MsgSendDTO(); MsgSendDTO msgSendDTO = new MsgSendDTO();
msgSendDTO.setSendTypeEnum(sendTypeEnum); msgSendDTO.setSendTypeEnum(sendTypeEnum);
msgSendDTO.setReceiverList(phoneSet); msgSendDTO.setReceiverList(phoneSet);
msgSendDTO.setOriContent(platAlarmRecord.getContent()); msgSendDTO.setOriContent(alarmRecord.getContent());
//todo 小程序消息 //todo 小程序消息
msgUtil.send(msgSendDTO); msgUtil.send(msgSendDTO);
} }
...@@ -180,16 +205,29 @@ public class PlatAlarmRecordServiceImpl extends ServiceImpl<PlatAlarmRecordMappe ...@@ -180,16 +205,29 @@ public class PlatAlarmRecordServiceImpl extends ServiceImpl<PlatAlarmRecordMappe
} }
String childIdJoin = allChildInfoList.stream().map(BaseEntity::getId).collect(Collectors.joining(",")); String childIdJoin = allChildInfoList.stream().map(BaseEntity::getId).collect(Collectors.joining(","));
//通知的子女 //通知的子女
platAlarmConfig.setNotifyRelation(childIdJoin); alarmConfig.setNotifyRelation(childIdJoin);
platAlarmRecord.setNoticeStatus(CommonEnum.YES.getValue()); alarmRecord.setNoticeStatus(CommonEnum.YES.getValue());
updateById(platAlarmRecord); alarmRecord.setTenantId(alarmConfig.getTenantId());
saveOrUpdate(alarmRecord);
} }
/** /**
* 发送消息 * 通知工作人员
* 短信
* 语音短信
* 邮件
* @param alarmConfig
* @param alarmRecord
*/ */
public void noticeDeviceAlarm(PlatAlarmConfig alarmConfig,PlatAlarmRecord alarmRecord){ @Transactional
@Override
@TenantIdIgnore
public void noticeUser(PlatAlarmConfig alarmConfig,PlatAlarmRecord alarmRecord){
String notifyWay = alarmConfig.getNotifyWay();
List<PlatUser> platUserList = new ArrayList<>();
if(StringUtils.equals(notifyWay,"1")){
}else {
}
} }
} }
...@@ -87,4 +87,11 @@ public interface PlatOrgService extends IService<PlatOrg> { ...@@ -87,4 +87,11 @@ public interface PlatOrgService extends IService<PlatOrg> {
PageVO<PlatOrg> page(PageReqDTO<PlatOrgQueryDTO> pageReqDTO); PageVO<PlatOrg> page(PageReqDTO<PlatOrgQueryDTO> pageReqDTO);
List<PlatOrg> subOrgList(PlatOrgQueryDTO platOrgQueryDTO); List<PlatOrg> subOrgList(PlatOrgQueryDTO platOrgQueryDTO);
/**
* 组织表增加一条数据
* 增加告警配置
* @param platOrg
*/
void saveOrg(PlatOrg platOrg);
} }
...@@ -278,7 +278,7 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg> ...@@ -278,7 +278,7 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg>
PlatOrg parent = getById(dto.getParentId()); PlatOrg parent = getById(dto.getParentId());
dto.setPath(parent.getPath() + "," + parent.getId()); dto.setPath(parent.getPath() + "," + parent.getId());
} }
save(dto); saveOrg(dto);
return dto.getId(); return dto.getId();
} }
...@@ -511,4 +511,15 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg> ...@@ -511,4 +511,15 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg>
return list(queryWrapper); return list(queryWrapper);
} }
/**
* 组织表增加一条数据
* 增加告警配置
* @param platOrg
*/
@Override
public void saveOrg(PlatOrg platOrg) {
save(platOrg);
}
} }
...@@ -223,7 +223,7 @@ implements PlatTenantService { ...@@ -223,7 +223,7 @@ implements PlatTenantService {
//组织表增加一条数据 //组织表增加一条数据
PlatOrg platOrg = convertToPlatOrg(tntTenant); PlatOrg platOrg = convertToPlatOrg(tntTenant);
platOrgService.save(platOrg); platOrgService.saveOrg(platOrg);
//分配菜单 //分配菜单
assignMenuList(tntTenant.getId(),dto.getMenuIdList()); assignMenuList(tntTenant.getId(),dto.getMenuIdList());
......
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