|
|
|
@ -11,6 +11,7 @@ import com.ruoyi.common.utils.StringUtils;
|
|
|
|
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
|
|
|
|
import com.ruoyi.ehsRescueTeam.domain.EhsRescueTeam;
|
|
|
|
|
import com.ruoyi.ehsRescueTeam.service.IEhsRescueTeamService;
|
|
|
|
|
import com.ruoyi.ehsRescueTeamWorker.domain.EhsRescueTeamWorker;
|
|
|
|
|
import com.ruoyi.ehsRescueTeamWorker.service.IEhsRescueTeamWorkerService;
|
|
|
|
|
import com.ruoyi.system.service.ISysDictDataService;
|
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
@ -22,9 +23,8 @@ import org.springframework.web.bind.annotation.*;
|
|
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 应急救援队伍管理Controller
|
|
|
|
@ -59,13 +59,39 @@ public class EhsRescueTeamController extends BaseController {
|
|
|
|
|
/**
|
|
|
|
|
* 导出应急救援队伍管理列表
|
|
|
|
|
*/
|
|
|
|
|
@PreAuthorize("@ss.hasPermi('ehs:ehsRescueTeam:export')")
|
|
|
|
|
/*@PreAuthorize("@ss.hasPermi('ehs:ehsRescueTeam:export')")
|
|
|
|
|
@Log(title = "应急救援队伍管理", businessType = BusinessType.EXPORT)
|
|
|
|
|
@PostMapping("/export")
|
|
|
|
|
public void export(HttpServletResponse response, EhsRescueTeam ehsRescueTeam) {
|
|
|
|
|
List<EhsRescueTeam> list = ehsRescueTeamService.selectEhsRescueTeamList(ehsRescueTeam);
|
|
|
|
|
ExcelUtil<EhsRescueTeam> util = new ExcelUtil<>(EhsRescueTeam.class);
|
|
|
|
|
util.exportExcel(response, list, "应急救援队伍管理数据");
|
|
|
|
|
}*/
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 要求队导出表格内容包含:队伍名称,队长,队员信息
|
|
|
|
|
* @param response
|
|
|
|
|
* @param ehsRescueTeam
|
|
|
|
|
*/
|
|
|
|
|
//@PreAuthorize("@ss.hasPermi('ehs:ehsRescueTeam:export')")
|
|
|
|
|
@Log(title = "应急救援队伍管理", businessType = BusinessType.EXPORT)
|
|
|
|
|
@PostMapping("/export")
|
|
|
|
|
public void export(HttpServletResponse response, EhsRescueTeam ehsRescueTeam) {
|
|
|
|
|
List<EhsRescueTeam> list = ehsRescueTeamService.selectEhsRescueTeamList(ehsRescueTeam);
|
|
|
|
|
// Map的key为队伍id,map的value为负责人
|
|
|
|
|
Map<Long, String> map = list.stream().collect(Collectors.toMap(
|
|
|
|
|
EhsRescueTeam::getId,
|
|
|
|
|
item -> item.getDutyer() == null ? "" : item.getDutyer()
|
|
|
|
|
));
|
|
|
|
|
List<Long> teamIds = list.stream().map(EhsRescueTeam::getId).collect(Collectors.toList());
|
|
|
|
|
// 根据teamIdList查询人员表
|
|
|
|
|
List<EhsRescueTeamWorker> teamWorkerList = ehsRescueTeamWorkerService.listWorkerByTeamIds(teamIds);
|
|
|
|
|
teamWorkerList.forEach(item -> {
|
|
|
|
|
// 给每个人员的负责人属性赋值
|
|
|
|
|
item.setDutyer(map.get(item.getRescueTeamId()));
|
|
|
|
|
});
|
|
|
|
|
ExcelUtil<EhsRescueTeamWorker> util = new ExcelUtil<>(EhsRescueTeamWorker.class);
|
|
|
|
|
util.exportExcel(response, teamWorkerList, "应急救援队伍管理数据");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|