Commit af7dcd1e authored by kongfm's avatar kongfm

修复bug2657

parent 7b79fdbe
......@@ -70,4 +70,11 @@ public interface OrgUsrMapper extends BaseMapper<OrgUsr> {
List<CheckObjectDto> getCompanyAndKeySite(Long companyId);
List<UserUnitDto> getUserUnit(String id, String type, String code);
/**
* 导出机场单位带过滤 bug2657 by kongfm
* @param parentId
* @return
*/
List< OrgUsrExcelDto> exportPersonToExcelByParentId(Long parentId);
}
......@@ -227,4 +227,11 @@ public interface IOrgUsrService {
List<OrgUsr> getPersonListByParentId(Long id);
/**
* 根据parentId 导出机场单位人员 bug2657 by kongfm
* @param parentId
* @return
*/
List<OrgUsrExcelDto> exportPersonToExcelByParentId(Long parentId);
}
......@@ -406,4 +406,39 @@ LEFT JOIN (
</select>
<!--BUG2657 导出选中单位及子单位人员数据 by kongfm-->
<select id="exportPersonToExcelByParentId" resultType="com.yeejoin.amos.boot.module.common.api.dto.OrgUsrExcelDto">
select
a.biz_org_name bizOrgName,
(select c.biz_org_name from cb_org_usr c where c.sequence_nbr=a.parent_id) parentId,
b.*
from cb_org_usr a LEFT JOIN
(SELECT
instance_id,
max(case field_code when 'administrativePositionCode' then field_value_label end) administrativePositionCode,
max(case field_code when 'auditCycle' then field_value_label end) auditCycle,
max(case field_code when 'certificatesNumber' then field_value end) certificatesNumber,
max(case field_code when 'certificatesTypeCode' then field_value_label end) certificatesTypeCode,
max(case field_code when 'certificateType' then field_value_label end) certificateType,
max(case field_code when 'fireManagementPostCode' then field_value_label end) fireManagementPostCode,
max(case field_code when 'gender' then field_value_label end) gender,
max(case field_code when 'internalPositionCode' then field_value_label end) internalPositionCode,
max(case field_code when 'personNumber' then field_value end) personNumber,
max(case field_code when 'positionType' then field_value_label end) positionType,
max(case field_code when 'safetyTraining' then field_value_label end) safetyTraining,
max(case field_code when 'stateCode' then field_value_label end) stateCode,
max(case field_code when 'telephone' then field_value end) telephone
FROM cb_dynamic_form_instance GROUP BY instance_id) b
on b.instance_id=a.sequence_nbr where a.biz_org_name is not null and a.is_delete = 0
and a.biz_org_type = "PERSON"
<if test="parentId != null and parentId != -1 ">
and a.biz_org_code like
concat((select t.biz_org_code from cb_org_usr t where t.sequence_nbr = #{parentId}), '%')
</if>
</select>
</mapper>
......@@ -1322,11 +1322,14 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
wrapper.eq(OrgUsr::getBizOrgType, OrgPersonEnum.人员.getKey());
return this.baseMapper.selectList(wrapper);
}
@Override
@Override
public List<OrgUsrExcelDto> exportPersonToExcelByParentId(Long parentId) {
return orgUsrMapper.exportPersonToExcelByParentId(parentId);
}
@Override
public List<Map<String, Object>> getLoginUserDetails (AgencyUserModel user) {
// 获取登陆人关联账号
......
......@@ -146,4 +146,18 @@ public class ExcelController extends BaseController {
throw new RuntimeException("系统异常!");
}
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "导出公用类带过滤参数")
@PostMapping("/exportByParams/{type}")
public void getFireStationFileByParams(HttpServletResponse response, @PathVariable(value = "type") String type, @RequestParam(value = "params") String params) {
try {
ExcelEnums excelEnums= ExcelEnums.getByKey(type);
ExcelDto excelDto = new ExcelDto(excelEnums.getFileName(), excelEnums.getSheetName(), excelEnums.getClassUrl(), excelEnums.getType());
excelService.exportByParams(response, excelDto, params);
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("系统异常!");
}
}
}
......@@ -40,6 +40,7 @@ import org.springframework.util.StringUtils;
import org.springframework.web.multipart.MultipartFile;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.InputStream;
......@@ -1047,4 +1048,79 @@ public class ExcelServiceImpl {
}
return data;
}
public void exportByParams(HttpServletResponse response, ExcelDto excelDto, String params) {
switch (excelDto.getType()) {
case "WHP":
List<FireChemicalDto> data = fireChemicalServiceImpl.queryForFireChemicalList(false);
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), data,
FireChemicalDto.class, dataSourcesImpl, false);
break;
case "XFZJ":
List<FireExpertsDto> fireExpertsDtoList = fireExpertsServiceImpl.queryForFireExpertsList(false);
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(),
fireExpertsDtoList, FireExpertsDto.class, dataSourcesImpl, false);
break;
case "SYXX":
List<WaterResourceDto> waterResourceDtoList = waterResourceServiceImpl.exportToExcel(true);
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(),
waterResourceDtoList, WaterResourceDto.class, dataSourcesImpl, false);
break;
case "HKQ":
List<AircraftDto> aircraftDtoList = aircraftServiceImpl.queryAircraftDtoForList(false);
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(),
aircraftDtoList, AircraftDto.class, dataSourcesImpl, false);
break;
case "XFDW":
List<FireTeamDto> fireTeamDtoList = fireTeamService.queryFireTeamForList(false);
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), fireTeamDtoList,
FireTeamDto.class, dataSourcesImpl, false);
break;
case "WXXFZ":
List<FireStationDto> fireStationDtoList = fireStationService.queryForFireStationList(false);
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(),
fireStationDtoList, FireStationDto.class, null, false);
break;
case "XFRY":
List<FirefightersExcelDto> firefightersExcelDtoList = firefightersService.exportToExcel(false);
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(),
firefightersExcelDtoList, FirefightersExcelDto.class, null, false);
break;
case "WBRY":
List<MaintenancePersonExcleDto> maintenancePersonExcelDtoList =
maintenanceCompanyService.exportToMaintenancePersonExcel();
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(),
maintenancePersonExcelDtoList, MaintenancePersonExcleDto.class, null, false);
break;
case "KEYSITE":
List<KeySiteExcleDto> keySiteDtoList = keySiteService.exportToExcel();
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(),
keySiteDtoList, KeySiteExcleDto.class, null, false);
break;
case "JCDWRY":
// 机场单位人员参数传递为 parentId = xxxxxxx
String parentIdStr = params.split("=")[1];
Long parentId = -1l;
try {
parentId = Long.parseLong(parentIdStr);
} catch (NumberFormatException e) {
throw new BadRequest("导出机场单位时未传递正确parentId");
}
List<OrgUsrExcelDto> orgUsrList = orgUsrService.exportPersonToExcelByParentId(parentId);
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(),
orgUsrList, OrgUsrExcelDto.class, null, false);
break;
case "LDDW":
List<LinkageUnitDto> LinkageUnitDtoList = linkageUnitServiceImpl.exportToExcel();
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(),
LinkageUnitDtoList, LinkageUnitDto.class, null, false);
break;
default:
break;
}
}
}
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