Commit 9f011e61 authored by chenhao's avatar chenhao

提交消防队伍的excle数据帅选功能

parent 0354406e
...@@ -50,7 +50,6 @@ public interface FireTeamMapper extends BaseMapper<FireTeam> { ...@@ -50,7 +50,6 @@ public interface FireTeamMapper extends BaseMapper<FireTeam> {
*/ */
IPage<FireTeamCardDto> getFireTeamForPage(Page page, FireTeamListDto par); IPage<FireTeamCardDto> getFireTeamForPage(Page page, FireTeamListDto par);
List<FireTeamDto> listFireTeamDto(Boolean isDelete);
/** /**
* 根据队伍id查询队伍下人员列表 * 根据队伍id查询队伍下人员列表
...@@ -105,5 +104,9 @@ public interface FireTeamMapper extends BaseMapper<FireTeam> { ...@@ -105,5 +104,9 @@ public interface FireTeamMapper extends BaseMapper<FireTeam> {
*/ */
List<FireTeam> byTeamId(Long teamId); List<FireTeam> byTeamId(Long teamId);
List<FireTeamDto> listFireTeamDto(Boolean isDelete, String nodeId, String nodeType, String name, String typeCode,List<String> nodeIds);
List<FireTeamDto> listFireTeamDtoTree(Boolean isDelete);
} }
package com.yeejoin.amos.boot.module.common.api.service; package com.yeejoin.amos.boot.module.common.api.service;
import java.util.List;
import com.yeejoin.amos.boot.module.common.api.dto.FireTeamZhDto; import com.yeejoin.amos.boot.module.common.api.dto.FireTeamZhDto;
import com.yeejoin.amos.boot.module.common.api.dto.RequestData; import com.yeejoin.amos.boot.module.common.api.dto.RequestData;
import com.yeejoin.amos.boot.module.common.api.entity.FireTeam; import com.yeejoin.amos.boot.module.common.api.entity.FireTeam;
import java.util.List;
import java.util.Map;
/** /**
* 消防队伍 服务类 * 消防队伍 服务类
* *
......
...@@ -70,6 +70,36 @@ ...@@ -70,6 +70,36 @@
from cb_fire_team t from cb_fire_team t
left join cb_fire_team p on t.parent = p.sequence_nbr left join cb_fire_team p on t.parent = p.sequence_nbr
where t.is_delete = #{isDelete} where t.is_delete = #{isDelete}
<if test='nodeType != null and nodeType == "1" and nodeIds != null'>
and t.company in
<foreach collection="nodeIds" separator="," open="(" item="nodeId" close=")">
#{nodeId}
</foreach>
</if>
<if test='nodeType != null and nodeType == "0" and nodeIds != null'>
<if test="nodeIds.size() > 0" >
and t.parent in
<foreach collection="nodeIds" separator="," open="(" item="nodeId" close=")">
#{nodeId}
</foreach>
or t.sequence_nbr = #{nodeId}
</if>
<if test="nodeIds.size() == 0" >
and t.sequence_nbr = #{nodeId}
</if>
</if>
<if test='name!=null and name!=""'>
and t.name like CONCAT( '%', #{name}),'%')
</if>
<if test='typeCode!=null and typeCode!=""'>
and t.type_code = #{typeCode}
</if>
</select>
<select id="listFireTeamDtoTree" resultType="com.yeejoin.amos.boot.module.common.api.dto.FireTeamDto">
select t.*, p.name parentName
from cb_fire_team t
left join cb_fire_team p on t.parent = p.sequence_nbr
where t.is_delete = #{isDelete}
</select> </select>
<!--消防队伍列表按时间倒叙排列order by x.rec_date desc 2021-09-08 by kongfm --> <!--消防队伍列表按时间倒叙排列order by x.rec_date desc 2021-09-08 by kongfm -->
......
package com.yeejoin.amos.boot.module.common.biz.service.impl; package com.yeejoin.amos.boot.module.common.biz.service.impl;
import static org.hamcrest.CoreMatchers.nullValue;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import com.yeejoin.amos.boot.module.common.api.dto.FirefightersExcelDto;
import com.yeejoin.amos.boot.module.common.api.dto.FirefightersInfoDto;
import com.yeejoin.amos.boot.module.common.api.dto.FirefightersZhDto;
import com.yeejoin.amos.boot.module.common.api.entity.FirefightersContacts;
import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.RegionModel;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.rdbms.annotation.Condition; import org.typroject.tyboot.core.rdbms.annotation.Condition;
...@@ -26,9 +16,16 @@ import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl; ...@@ -26,9 +16,16 @@ import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl;
import com.yeejoin.amos.boot.biz.common.utils.Menu; import com.yeejoin.amos.boot.biz.common.utils.Menu;
import com.yeejoin.amos.boot.biz.common.utils.TreeParser; import com.yeejoin.amos.boot.biz.common.utils.TreeParser;
import com.yeejoin.amos.boot.module.common.api.dto.FirefightersDto; import com.yeejoin.amos.boot.module.common.api.dto.FirefightersDto;
import com.yeejoin.amos.boot.module.common.api.dto.FirefightersExcelDto;
import com.yeejoin.amos.boot.module.common.api.dto.FirefightersInfoDto;
import com.yeejoin.amos.boot.module.common.api.dto.FirefightersZhDto;
import com.yeejoin.amos.boot.module.common.api.entity.Firefighters; import com.yeejoin.amos.boot.module.common.api.entity.Firefighters;
import com.yeejoin.amos.boot.module.common.api.entity.FirefightersContacts;
import com.yeejoin.amos.boot.module.common.api.mapper.FirefightersMapper; import com.yeejoin.amos.boot.module.common.api.mapper.FirefightersMapper;
import com.yeejoin.amos.boot.module.common.api.service.IFirefightersService; import com.yeejoin.amos.boot.module.common.api.service.IFirefightersService;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.RegionModel;
/** /**
* 消防队员 服务实现类 * 消防队员 服务实现类
...@@ -37,95 +34,100 @@ import com.yeejoin.amos.boot.module.common.api.service.IFirefightersService; ...@@ -37,95 +34,100 @@ import com.yeejoin.amos.boot.module.common.api.service.IFirefightersService;
* @date 2021-06-07 * @date 2021-06-07
*/ */
@Service @Service
public class FirefightersServiceImpl extends BaseService<FirefightersDto, Firefighters, FirefightersMapper> implements IFirefightersService { public class FirefightersServiceImpl extends BaseService<FirefightersDto, Firefighters, FirefightersMapper>
implements IFirefightersService {
@Autowired @Autowired
FirefightersMapper firefightersMapper; FirefightersMapper firefightersMapper;
@Autowired @Autowired
DataDictionaryServiceImpl iDataDictionaryService; DataDictionaryServiceImpl iDataDictionaryService;
@Autowired @Autowired
FirefightersContactsServiceImpl firefightersContactsService; FirefightersContactsServiceImpl firefightersContactsService;
@Override @Override
public List<FirefightersZhDto> getFirefighters(int pageNum, int pageSize, FirefightersDto par) { public List<FirefightersZhDto> getFirefighters(int pageNum, int pageSize, FirefightersDto par) {
return firefightersMapper.getFirefighters(pageNum, pageSize, par); return firefightersMapper.getFirefighters(pageNum, pageSize, par);
} }
@Override @Override
public Map<String, Long> getFirefightersCount(int pageNum, int pageSize, FirefightersDto par) { public Map<String, Long> getFirefightersCount(int pageNum, int pageSize, FirefightersDto par) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return firefightersMapper.getFirefightersCount(pageNum, pageSize, par); return firefightersMapper.getFirefightersCount(pageNum, pageSize, par);
} }
@Override @Override
public Map<String, Object> listToSelectById(Long id) { public Map<String, Object> listToSelectById(Long id) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return firefightersMapper.listToSelectById(id); return firefightersMapper.listToSelectById(id);
} }
@Override @Override
public void saveFirefighters(FirefightersInfoDto firefighters) { public void saveFirefighters(FirefightersInfoDto firefighters) {
Firefighters firefighter = firefighters.getFirefighters(); Firefighters firefighter = firefighters.getFirefighters();
// 现居住地保存地址信息 户籍所在地信息 BUG3553 bykongfm // 现居住地保存地址信息 户籍所在地信息 BUG3553 bykongfm
// BUG2168 居住地户籍所在地为空判断 bykongfm // BUG2168 居住地户籍所在地为空判断 bykongfm
if(firefighter.getResidenceDetails() != null) { if (firefighter.getResidenceDetails() != null) {
FeignClientResult<RegionModel> region = Systemctl.regionClient.getRegion(Long.parseLong(firefighter.getResidenceDetails())); FeignClientResult<RegionModel> region = Systemctl.regionClient
firefighter.setResidence(region.getResult().getRegionName()); .getRegion(Long.parseLong(firefighter.getResidenceDetails()));
} firefighter.setResidence(region.getResult().getRegionName());
if(firefighter.getNativePlace() != null) { }
FeignClientResult<RegionModel> nativePlace = Systemctl.regionClient.getRegion(Long.parseLong(firefighter.getNativePlace())); if (firefighter.getNativePlace() != null) {
firefighter.setNativePlaceValue(nativePlace.getResult().getRegionName()); FeignClientResult<RegionModel> nativePlace = Systemctl.regionClient
} .getRegion(Long.parseLong(firefighter.getNativePlace()));
save(firefighter); firefighter.setNativePlaceValue(nativePlace.getResult().getRegionName());
FirefightersContacts firefightersContact = firefighters.getFirefightersContacts(); }
firefightersContact.setFirefightersId(firefighter.getSequenceNbr()); save(firefighter);
firefightersContactsService.save(firefightersContact); FirefightersContacts firefightersContact = firefighters.getFirefightersContacts();
firefighters.setFirefightersContacts(firefightersContact); firefightersContact.setFirefightersId(firefighter.getSequenceNbr());
firefighters.setFirefighters(firefighter); firefightersContactsService.save(firefightersContact);
} firefighters.setFirefightersContacts(firefightersContact);
firefighters.setFirefighters(firefighter);
@Override }
public Firefighters selectByAmosOrgId(Long id) {
@Override
QueryWrapper<Firefighters> queryWrapper = new QueryWrapper<>(); public Firefighters selectByAmosOrgId(Long id) {
queryWrapper.eq("amos_user_id",id);
Firefighters firefighters = firefightersMapper.selectOne(queryWrapper); QueryWrapper<Firefighters> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("amos_user_id", id);
return firefighters; Firefighters firefighters = firefightersMapper.selectOne(queryWrapper);
}
return firefighters;
/** }
* 导出列表
*/ /**
public List<FirefightersExcelDto> exportToExcel(@Condition(Operator.eq) Boolean isDelete,Map par) { * 导出列表
String name =par.containsKey("name")?par.get("name").toString():null; */
String postQualification =par.containsKey("postQualification")?par.get("postQualification").toString():null; public List<FirefightersExcelDto> exportToExcel(@Condition(Operator.eq) Boolean isDelete, Map par) {
String fireTeamId =par.containsKey("fireTeamId")?par.get("fireTeamId").toString():null; if (par == null || par.size() < 1) {
String state =par.containsKey("state")?par.get("state").toString():null; return firefightersMapper.exportToExcel(isDelete, null, null, null, null, null, null);
String areasExpertise =par.containsKey("areasExpertise")?par.get("areasExpertise").toString():null; }
String jobTitle =par.containsKey("jobTitle")?par.get("jobTitle").toString():null; String name = par.containsKey("name") ? par.get("name").toString() : null;
return firefightersMapper.exportToExcel(isDelete,name,postQualification,fireTeamId,state,areasExpertise,jobTitle); String postQualification = par.containsKey("postQualification") ? par.get("postQualification").toString()
} : null;
String fireTeamId = par.containsKey("fireTeamId") ? par.get("fireTeamId").toString() : null;
String state = par.containsKey("state") ? par.get("state").toString() : null;
@Override String areasExpertise = par.containsKey("areasExpertise") ? par.get("areasExpertise").toString() : null;
public List<Menu> getFirefightersJobTitleCount() throws Exception { String jobTitle = par.containsKey("jobTitle") ? par.get("jobTitle").toString() : null;
return firefightersMapper.exportToExcel(isDelete, name, postQualification, fireTeamId, state, areasExpertise,
QueryWrapper<DataDictionary> queryWrapper = new QueryWrapper<>(); jobTitle);
queryWrapper.eq("type", "GWMC"); }
queryWrapper.orderByAsc("sort_num");
Collection<DataDictionary> list = iDataDictionaryService.list(queryWrapper); @Override
List<Menu> menus = TreeParser.getTree(null, list, DataDictionary.class.getName(), "getCode", 0, "getName", public List<Menu> getFirefightersJobTitleCount() throws Exception {
"getParent", firefightersMapper.getFirefightersJobTitleCount());
return menus; QueryWrapper<DataDictionary> queryWrapper = new QueryWrapper<>();
} queryWrapper.eq("type", "GWMC");
queryWrapper.orderByAsc("sort_num");
Collection<DataDictionary> list = iDataDictionaryService.list(queryWrapper);
public List<String> getFirefightersName( ) { List<Menu> menus = TreeParser.getTree(null, list, DataDictionary.class.getName(), "getCode", 0, "getName",
"getParent", firefightersMapper.getFirefightersJobTitleCount());
return firefightersMapper.getFirefightersName(); return menus;
}
}
public List<String> getFirefightersName() {
return firefightersMapper.getFirefightersName();
}
} }
...@@ -244,7 +244,7 @@ public class ExcelServiceImpl { ...@@ -244,7 +244,7 @@ public class ExcelServiceImpl {
AircraftDto.class, dataSourcesImpl, false); AircraftDto.class, dataSourcesImpl, false);
break; break;
case "XFDW": case "XFDW":
List<FireTeamDto> fireTeamDtoList = fireTeamService.queryFireTeamForList(false); List<FireTeamDto> fireTeamDtoList = fireTeamService.queryFireTeamForList(false, par);
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), fireTeamDtoList, ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), fireTeamDtoList,
FireTeamDto.class, dataSourcesImpl, false); FireTeamDto.class, dataSourcesImpl, false);
break; break;
...@@ -1551,7 +1551,7 @@ public class ExcelServiceImpl { ...@@ -1551,7 +1551,7 @@ public class ExcelServiceImpl {
AircraftDto.class, dataSourcesImpl, false); AircraftDto.class, dataSourcesImpl, false);
break; break;
case "XFDW": case "XFDW":
List<FireTeamDto> fireTeamDtoList = fireTeamService.queryFireTeamForList(false); List<FireTeamDto> fireTeamDtoList = fireTeamService.queryFireTeamForList(false,null);
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), fireTeamDtoList, ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), fireTeamDtoList,
FireTeamDto.class, dataSourcesImpl, false); FireTeamDto.class, dataSourcesImpl, false);
break; break;
......
...@@ -141,10 +141,30 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire ...@@ -141,10 +141,30 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire
return this.baseMapper.listFireTeamById(teamId); return this.baseMapper.listFireTeamById(teamId);
} }
public List<FireTeamDto> queryFireTeamForList(Boolean isDelete) { public List<FireTeamDto> queryFireTeamForListTree(Boolean isDelete) {
return fireTeamMapper.listFireTeamDto(isDelete); return fireTeamMapper.listFireTeamDtoTree(isDelete);
}
public List<FireTeamDto> queryFireTeamForList(Boolean isDelete,Map map) {
if(map== null || map.size()<1) {
return fireTeamMapper.listFireTeamDto(isDelete,null,null,null,null,null);
}
String nodeId =map.containsKey("nodeId")?map.get("nodeId").toString():null;
String nodeType =map.containsKey("nodeType")?map.get("nodeType").toString():null;
String name =map.containsKey("name")?map.get("name").toString():null;
String typeCode =map.containsKey("typeCode")?map.get("typeCode").toString():null;
List<String> nodeIdsList=null;
// 查询单位
if (Objects.equals("1", nodeType)) {
List<OrgUsr> companyDeptList = orgUsrService.listOrgUserById(Long.parseLong(nodeId));
nodeIdsList = companyDeptList.stream().map(e -> e.getSequenceNbr().toString()).collect(Collectors.toList());
}
// 查询队伍
if (Objects.equals("0", nodeType)) {
List<FireTeam> teamList = listFireTeamById(Long.parseLong(nodeId));
nodeIdsList = teamList.stream().map(e -> e.getSequenceNbr().toString()).collect(Collectors.toList());
}
return fireTeamMapper.listFireTeamDto(isDelete,nodeId,nodeType,name,typeCode,nodeIdsList);
} }
/** /**
* 根据列表构造队伍树 * 根据列表构造队伍树
* *
...@@ -179,7 +199,7 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire ...@@ -179,7 +199,7 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire
}); });
// 消防队伍 // 消防队伍
List<MenuFrom> teamMenuList = Lists.newArrayList(); List<MenuFrom> teamMenuList = Lists.newArrayList();
List<FireTeamDto> teamList = this.queryFireTeamForList(false); List<FireTeamDto> teamList = this.queryFireTeamForList(false,null);
teamList.forEach(team -> { teamList.forEach(team -> {
if (ValidationUtil.isEmpty(team.getParent())) { if (ValidationUtil.isEmpty(team.getParent())) {
// 将单位下没有上级队伍的队伍直接挂在单位下(方便组成树结构) // 将单位下没有上级队伍的队伍直接挂在单位下(方便组成树结构)
......
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 to comment