/*
|
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
|
*
|
* Redistribution and use in source and binary forms, with or without
|
* modification, are permitted provided that the following conditions are met:
|
*
|
* Redistributions of source code must retain the above copyright notice,
|
* this list of conditions and the following disclaimer.
|
* Redistributions in binary form must reproduce the above copyright
|
* notice, this list of conditions and the following disclaimer in the
|
* documentation and/or other materials provided with the distribution.
|
* Neither the name of the dreamlu.net developer nor the names of its
|
* contributors may be used to endorse or promote products derived from
|
* this software without specific prior written permission.
|
* Author: Chill 庄骞 (smallchill@163.com)
|
*/
|
package org.sxkj.fw.record.service.impl;
|
|
import org.springblade.core.secure.utils.AuthUtil;
|
import org.sxkj.common.utils.HeaderUtils;
|
import org.sxkj.fw.record.dto.FwDroneFlightRecordDTO;
|
import org.sxkj.fw.record.entity.FwDroneFlightRecordEntity;
|
import org.sxkj.fw.record.param.FwDroneFlightRecordExportParam;
|
import org.sxkj.fw.record.vo.FwDroneFlightRecordVO;
|
import org.sxkj.fw.record.excel.FwDroneFlightRecordExcel;
|
import org.sxkj.fw.record.mapper.FwDroneFlightRecordMapper;
|
import org.sxkj.fw.record.service.IFwDroneFlightRecordService;
|
import org.springframework.stereotype.Service;
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import org.springblade.core.mp.base.BaseServiceImpl;
|
import org.sxkj.system.cache.RegionCache;
|
import org.sxkj.system.cache.SysCache;
|
import org.sxkj.system.entity.Dept;
|
import org.sxkj.system.entity.Region;
|
|
import java.util.List;
|
import java.util.Map;
|
import java.util.stream.Collectors;
|
|
/**
|
* 无人机飞行记录表 服务实现类
|
*
|
* @author lw
|
* @since 2026-01-08
|
*/
|
@Service
|
public class FwDroneFlightRecordServiceImpl extends BaseServiceImpl<FwDroneFlightRecordMapper, FwDroneFlightRecordEntity> implements IFwDroneFlightRecordService {
|
|
@Override
|
public IPage<FwDroneFlightRecordVO> selectFwDroneFlightRecordPage(IPage<FwDroneFlightRecordVO> page, FwDroneFlightRecordDTO fwDroneFlightRecord) {
|
Dept dept = SysCache.getDept(Long.valueOf(AuthUtil.getDeptId()));
|
Region byCode = RegionCache.getByCode(dept.getAreaCode());
|
fwDroneFlightRecord.setRegionCode(HeaderUtils.formatAreaCode(byCode.getCode()));
|
fwDroneFlightRecord.setCurrentDeptId(AuthUtil.getDeptId());
|
return page.setRecords(baseMapper.selectFwDroneFlightRecordPage(page, fwDroneFlightRecord));
|
}
|
|
|
@Override
|
public Map<String, List<FwDroneFlightRecordExcel>> exportFwDroneFlightRecord(FwDroneFlightRecordExportParam fwDroneFlightRecord) {
|
Dept dept = SysCache.getDept(Long.valueOf(AuthUtil.getDeptId()));
|
Region byCode = RegionCache.getByCode(dept.getAreaCode());
|
fwDroneFlightRecord.setRegionCode(HeaderUtils.formatAreaCode(byCode.getCode()));
|
fwDroneFlightRecord.setCurrentDeptId(AuthUtil.getDeptId());
|
List<FwDroneFlightRecordExcel> fwDroneFlightRecordList = baseMapper.exportFwDroneFlightRecord(fwDroneFlightRecord);
|
// 按照 无人机名称 和 序列号 组合进行分组,键格式为 "id_serialNo"
|
Map<String, List<FwDroneFlightRecordExcel>> groupedMap = fwDroneFlightRecordList.stream()
|
.collect(Collectors.groupingBy(item -> item.getDroneName() + "_" + item.getSerialNo()));
|
return groupedMap;
|
}
|
|
}
|