2024-09-25 11:18:01 +08:00
|
|
|
package com.gunshi.project.xyt.service;
|
|
|
|
|
|
2024-09-26 16:08:31 +08:00
|
|
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
2024-09-25 11:18:01 +08:00
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
|
import com.gunshi.project.xyt.entity.so.BroadcastWarnPageSo;
|
|
|
|
|
import com.gunshi.project.xyt.mapper.BroadcastWarnMapper;
|
|
|
|
|
import com.gunshi.project.xyt.model.BroadcastWarn;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
2024-09-26 16:08:31 +08:00
|
|
|
import org.springframework.beans.BeanUtils;
|
2024-09-25 11:18:01 +08:00
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
import java.util.Date;
|
2024-09-26 16:08:31 +08:00
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.stream.Collectors;
|
2024-09-25 11:18:01 +08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 描述: 广播预警信息
|
|
|
|
|
* author: xusan
|
|
|
|
|
* date: 2024-09-25 10:17:54
|
|
|
|
|
*/
|
|
|
|
|
@Service
|
|
|
|
|
@Slf4j
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public class BroadcastWarnService extends ServiceImpl<BroadcastWarnMapper, BroadcastWarn>
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
public Page<BroadcastWarn> pageQuery(BroadcastWarnPageSo page) {
|
|
|
|
|
return this.baseMapper.pageQuery(page.getPageSo().toPage(),page);
|
|
|
|
|
}
|
2024-09-26 16:08:31 +08:00
|
|
|
|
|
|
|
|
public Boolean saveData(BroadcastWarn dto) {
|
|
|
|
|
List<Long> stationIds = dto.getStationIds();
|
|
|
|
|
List<BroadcastWarn> list = stationIds.stream().map(stationId->{
|
|
|
|
|
BroadcastWarn warn = new BroadcastWarn();
|
|
|
|
|
BeanUtils.copyProperties(dto,warn);
|
|
|
|
|
warn.setId(IdWorker.getId());
|
|
|
|
|
warn.setStationId(stationId);
|
|
|
|
|
warn.setCreateTime(new Date());
|
|
|
|
|
return warn;
|
|
|
|
|
}).collect(Collectors.toList());
|
|
|
|
|
return this.saveBatch(list);
|
|
|
|
|
}
|
2024-09-25 11:18:01 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|