Commit dc59bcea authored by chenhao's avatar chenhao

修改获取当前登录人的方法

parent b0cb1e3c
...@@ -108,6 +108,9 @@ import com.yeejoin.amos.boot.module.common.biz.service.impl.WaterResourceService ...@@ -108,6 +108,9 @@ import com.yeejoin.amos.boot.module.common.biz.service.impl.WaterResourceService
import com.yeejoin.amos.boot.module.jcs.api.dto.AircraftDto; import com.yeejoin.amos.boot.module.jcs.api.dto.AircraftDto;
import com.yeejoin.amos.boot.module.jcs.api.entity.Aircraft; import com.yeejoin.amos.boot.module.jcs.api.entity.Aircraft;
import com.yeejoin.amos.boot.module.jcs.api.enums.ExcelEnums; import com.yeejoin.amos.boot.module.jcs.api.enums.ExcelEnums;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
/** /**
* @author tb * @author tb
...@@ -187,7 +190,7 @@ public class ExcelServiceImpl { ...@@ -187,7 +190,7 @@ public class ExcelServiceImpl {
true); true);
} }
public void commonExport(HttpServletResponse response, ExcelDto excelDto,Map par) { public void commonExport(HttpServletResponse response, ExcelDto excelDto, Map par) {
switch (excelDto.getType()) { switch (excelDto.getType()) {
case "WHP": case "WHP":
...@@ -198,11 +201,12 @@ public class ExcelServiceImpl { ...@@ -198,11 +201,12 @@ public class ExcelServiceImpl {
case "XFZJ": case "XFZJ":
List<FireExpertsDto> fireExpertsDtoList = fireExpertsServiceImpl.queryForFireExpertsList(false); List<FireExpertsDto> fireExpertsDtoList = fireExpertsServiceImpl.queryForFireExpertsList(false);
QueryWrapper<DataDictionary> queryWrapper = new QueryWrapper<>(); QueryWrapper<DataDictionary> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("type","XLLX" ); queryWrapper.eq("type", "XLLX");
List<DataDictionary> list = iDataDictionaryService.list(queryWrapper); List<DataDictionary> list = iDataDictionaryService.list(queryWrapper);
for (FireExpertsDto fireExpertsDto : fireExpertsDtoList) { for (FireExpertsDto fireExpertsDto : fireExpertsDtoList) {
for (DataDictionary dataDictionary : list) { for (DataDictionary dataDictionary : list) {
if (fireExpertsDto.getHighestEducation() != null && !fireExpertsDto.getHighestEducation().equals("")) { if (fireExpertsDto.getHighestEducation() != null
&& !fireExpertsDto.getHighestEducation().equals("")) {
if (fireExpertsDto.getHighestEducation().equals(dataDictionary.getCode())) { if (fireExpertsDto.getHighestEducation().equals(dataDictionary.getCode())) {
fireExpertsDto.setHighestEducation(dataDictionary.getName()); fireExpertsDto.setHighestEducation(dataDictionary.getName());
} }
...@@ -354,7 +358,7 @@ public class ExcelServiceImpl { ...@@ -354,7 +358,7 @@ public class ExcelServiceImpl {
} else { } else {
continue; continue;
} }
positionStaffDto = Bean.toPo(getCurrentInfo(),positionStaffDto); positionStaffDto = Bean.toPo(getCurrentInfo(), positionStaffDto);
specialPositionStaffServiceImpl.createWithModel(positionStaffDto); specialPositionStaffServiceImpl.createWithModel(positionStaffDto);
} }
} }
...@@ -391,7 +395,7 @@ public class ExcelServiceImpl { ...@@ -391,7 +395,7 @@ public class ExcelServiceImpl {
} else { } else {
continue; continue;
} }
rescueEquipmentDto = Bean.toPo(getCurrentInfo(),rescueEquipmentDto); rescueEquipmentDto = Bean.toPo(getCurrentInfo(), rescueEquipmentDto);
rescueEquipmentServiceImpl.createWithModel(rescueEquipmentDto); rescueEquipmentServiceImpl.createWithModel(rescueEquipmentDto);
} }
...@@ -401,7 +405,7 @@ public class ExcelServiceImpl { ...@@ -401,7 +405,7 @@ public class ExcelServiceImpl {
private void excelImportLinkageUnitZhDto(MultipartFile multipartFile) throws Exception { private void excelImportLinkageUnitZhDto(MultipartFile multipartFile) throws Exception {
List<LinkageUnitDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, LinkageUnitDto.class, 1); List<LinkageUnitDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, LinkageUnitDto.class, 1);
if (excelDtoList != null && excelDtoList.size() > 0) { if (excelDtoList != null && excelDtoList.size() > 0) {
excelDtoList.forEach(linkageUnitDto -> { excelDtoList.forEach(linkageUnitDto -> {
if (linkageUnitDto.getLinkageUnitType() != null) { if (linkageUnitDto.getLinkageUnitType() != null) {
String[] certificates = linkageUnitDto.getLinkageUnitType().split("@"); String[] certificates = linkageUnitDto.getLinkageUnitType().split("@");
...@@ -413,7 +417,7 @@ if (excelDtoList != null && excelDtoList.size() > 0) { ...@@ -413,7 +417,7 @@ if (excelDtoList != null && excelDtoList.size() > 0) {
linkageUnitDto.setEmergencyLinkageUnit(certificates[0]); linkageUnitDto.setEmergencyLinkageUnit(certificates[0]);
linkageUnitDto.setEmergencyLinkageUnitCode(certificates[1]); linkageUnitDto.setEmergencyLinkageUnitCode(certificates[1]);
} }
linkageUnitDto =Bean.toPo(getCurrentInfo(),linkageUnitDto); linkageUnitDto = Bean.toPo(getCurrentInfo(), linkageUnitDto);
linkageUnitServiceImpl.saveLinkageModel(linkageUnitDto); linkageUnitServiceImpl.saveLinkageModel(linkageUnitDto);
}); });
} }
...@@ -469,7 +473,7 @@ if (excelDtoList != null && excelDtoList.size() > 0) { ...@@ -469,7 +473,7 @@ if (excelDtoList != null && excelDtoList.size() > 0) {
} }
break; break;
case "certificateType": //持证类别 case "certificateType": // 持证类别
if (orgUsrExcelDto.getCertificateType() != null) { if (orgUsrExcelDto.getCertificateType() != null) {
String[] certificates = orgUsrExcelDto.getCertificateType().split("@"); String[] certificates = orgUsrExcelDto.getCertificateType().split("@");
dynamicFormInstanceDto.setFieldValue(certificates[1]); dynamicFormInstanceDto.setFieldValue(certificates[1]);
...@@ -537,7 +541,7 @@ if (excelDtoList != null && excelDtoList.size() > 0) { ...@@ -537,7 +541,7 @@ if (excelDtoList != null && excelDtoList.size() > 0) {
}); });
orgUsrExcelDto.setDynamicFormValue(dynamicFormInstancelist); orgUsrExcelDto.setDynamicFormValue(dynamicFormInstancelist);
Bean.toPo(getCurrentInfo(),orgUsrExcelDto); Bean.toPo(getCurrentInfo(), orgUsrExcelDto);
try { try {
orgUsrService.saveOrgPersonExcel(orgUsrExcelDto); orgUsrService.saveOrgPersonExcel(orgUsrExcelDto);
} catch (Exception e) { } catch (Exception e) {
...@@ -556,15 +560,15 @@ if (excelDtoList != null && excelDtoList.size() > 0) { ...@@ -556,15 +560,15 @@ if (excelDtoList != null && excelDtoList.size() > 0) {
FirefightersContacts firefightersContacts = new FirefightersContacts(); FirefightersContacts firefightersContacts = new FirefightersContacts();
firefighters = Bean.toPo(item, firefighters); firefighters = Bean.toPo(item, firefighters);
firefighters = Bean.toPo(getCurrentInfo(), firefighters); firefighters = Bean.toPo(getCurrentInfo(), firefighters);
//手动添加主键,以便于给岗位、职位等实体赋值id // 手动添加主键,以便于给岗位、职位等实体赋值id
Long sequenceId =sequence.nextId(); Long sequenceId = sequence.nextId();
firefighters.setSequenceNbr(sequenceId); firefighters.setSequenceNbr(sequenceId);
item.setFirefightersId(sequenceId); item.setFirefightersId(sequenceId);
firefightersContacts = Bean.toPo(item, firefightersContacts); firefightersContacts = Bean.toPo(item, firefightersContacts);
FirefightersWorkexperience firefightersWorkexperience =new FirefightersWorkexperience(); FirefightersWorkexperience firefightersWorkexperience = new FirefightersWorkexperience();
FirefightersEducation firefightersEducation=new FirefightersEducation(); FirefightersEducation firefightersEducation = new FirefightersEducation();
FirefightersPost firefightersPost=new FirefightersPost(); FirefightersPost firefightersPost = new FirefightersPost();
firefightersWorkexperience = Bean.toPo(item, firefightersWorkexperience); firefightersWorkexperience = Bean.toPo(item, firefightersWorkexperience);
firefightersEducation = Bean.toPo(item, firefightersEducation); firefightersEducation = Bean.toPo(item, firefightersEducation);
...@@ -608,54 +612,54 @@ if (excelDtoList != null && excelDtoList.size() > 0) { ...@@ -608,54 +612,54 @@ if (excelDtoList != null && excelDtoList.size() > 0) {
firefighters.setResidence(tempCity[0]); firefighters.setResidence(tempCity[0]);
firefighters.setResidenceDetails(tempCity[1]); firefighters.setResidenceDetails(tempCity[1]);
} }
/*************************岗位职级***********************/ /************************* 岗位职级 ***********************/
if (item.getEmployeeHierarchy()!= null) { if (item.getEmployeeHierarchy() != null) {
String[] employeeHierarchy = item.getEmployeeHierarchy().split("@"); String[] employeeHierarchy = item.getEmployeeHierarchy().split("@");
firefightersPost.setEmployeeHierarchy(employeeHierarchy[0]); firefightersPost.setEmployeeHierarchy(employeeHierarchy[0]);
firefightersPost.setEmployeeHierarchyCode(employeeHierarchy[1]); firefightersPost.setEmployeeHierarchyCode(employeeHierarchy[1]);
} }
if (item.getAdministrativePosition()!= null) { if (item.getAdministrativePosition() != null) {
String[] employeeHierarchy = item.getAdministrativePosition().split("@"); String[] employeeHierarchy = item.getAdministrativePosition().split("@");
firefightersPost.setAdministrativePosition(employeeHierarchy[0]); firefightersPost.setAdministrativePosition(employeeHierarchy[0]);
firefightersPost.setAdministrativePositionCode(employeeHierarchy[1]); firefightersPost.setAdministrativePositionCode(employeeHierarchy[1]);
} }
if (item.getEmployeeHierarchy()!= null) { if (item.getEmployeeHierarchy() != null) {
String[] employeeHierarchy = item.getEmployeeHierarchy().split("@"); String[] employeeHierarchy = item.getEmployeeHierarchy().split("@");
firefightersPost.setEmployeeHierarchy(employeeHierarchy[0]); firefightersPost.setEmployeeHierarchy(employeeHierarchy[0]);
firefightersPost.setEmployeeHierarchyCode(employeeHierarchy[1]); firefightersPost.setEmployeeHierarchyCode(employeeHierarchy[1]);
} }
if (item.getPostQualification()!= null) { if (item.getPostQualification() != null) {
String[] employeeHierarchy = item.getPostQualification().split("@"); String[] employeeHierarchy = item.getPostQualification().split("@");
firefightersPost.setPostQualification(employeeHierarchy[0]); firefightersPost.setPostQualification(employeeHierarchy[0]);
firefightersPost.setPostQualificationCode(employeeHierarchy[1]); firefightersPost.setPostQualificationCode(employeeHierarchy[1]);
} }
if (item.getCategory()!= null) { if (item.getCategory() != null) {
String[] employeeHierarchy = item.getCategory().split("@"); String[] employeeHierarchy = item.getCategory().split("@");
firefightersPost.setCategory(employeeHierarchy[0]); firefightersPost.setCategory(employeeHierarchy[0]);
firefightersPost.setCategoryCode(employeeHierarchy[1]); firefightersPost.setCategoryCode(employeeHierarchy[1]);
} }
if (item.getLevel()!= null) { if (item.getLevel() != null) {
String[] employeeHierarchy = item.getLevel().split("@"); String[] employeeHierarchy = item.getLevel().split("@");
firefightersPost.setLevel(employeeHierarchy[0]); firefightersPost.setLevel(employeeHierarchy[0]);
firefightersPost.setLevelCode(employeeHierarchy[1]); firefightersPost.setLevelCode(employeeHierarchy[1]);
} }
if (item.getAreasExpertise()!= null) { if (item.getAreasExpertise() != null) {
String[] employeeHierarchy = item.getAreasExpertise().split("@"); String[] employeeHierarchy = item.getAreasExpertise().split("@");
firefightersPost.setAreasExpertise(employeeHierarchy[0]); firefightersPost.setAreasExpertise(employeeHierarchy[0]);
firefightersPost.setAreasExpertiseCode(employeeHierarchy[1]); firefightersPost.setAreasExpertiseCode(employeeHierarchy[1]);
} }
/*************************学历教育***********************/ /************************* 学历教育 ***********************/
if (item.getFirstDegree()!= null) { if (item.getFirstDegree() != null) {
String[] employeeHierarchy = item.getFirstDegree().split("@"); String[] employeeHierarchy = item.getFirstDegree().split("@");
firefightersEducation.setFirstDegree(employeeHierarchy[1]); firefightersEducation.setFirstDegree(employeeHierarchy[1]);
} }
if (item.getHighestEducation()!= null) { if (item.getHighestEducation() != null) {
String[] employeeHierarchy = item.getHighestEducation().split("@"); String[] employeeHierarchy = item.getHighestEducation().split("@");
firefightersEducation.setHighestEducation(employeeHierarchy[1]); firefightersEducation.setHighestEducation(employeeHierarchy[1]);
} }
if (item.getAcademicDegree()!= null) { if (item.getAcademicDegree() != null) {
String[] employeeHierarchy = item.getAcademicDegree().split("@"); String[] employeeHierarchy = item.getAcademicDegree().split("@");
firefightersEducation.setAcademicDegree(employeeHierarchy[1]); firefightersEducation.setAcademicDegree(employeeHierarchy[1]);
} }
...@@ -692,7 +696,6 @@ if (excelDtoList != null && excelDtoList.size() > 0) { ...@@ -692,7 +696,6 @@ if (excelDtoList != null && excelDtoList.size() > 0) {
fireStationService.saveBatch(excelEntityList); fireStationService.saveBatch(excelEntityList);
} }
private void excelImportFireTeam(MultipartFile multipartFile) throws Exception { private void excelImportFireTeam(MultipartFile multipartFile) throws Exception {
List<FireTeamDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, FireTeamDto.class, 1); List<FireTeamDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, FireTeamDto.class, 1);
List<FireTeam> excelEntityList = new ArrayList<>(); List<FireTeam> excelEntityList = new ArrayList<>();
...@@ -701,19 +704,19 @@ if (excelDtoList != null && excelDtoList.size() > 0) { ...@@ -701,19 +704,19 @@ if (excelDtoList != null && excelDtoList.size() > 0) {
FireTeam fireTeam = new FireTeam(); FireTeam fireTeam = new FireTeam();
fireTeam = Bean.toPo(item, fireTeam); fireTeam = Bean.toPo(item, fireTeam);
fireTeam = Bean.toPo(getCurrentInfo(), fireTeam); fireTeam = Bean.toPo(getCurrentInfo(), fireTeam);
/* bug2835 添加获取上级单位的信息方法 陈浩 2021-09-10 --start*/ /* bug2835 添加获取上级单位的信息方法 陈浩 2021-09-10 --start */
if(fireTeam.getCompanyName()!=null) { if (fireTeam.getCompanyName() != null) {
String[] companyArray = fireTeam.getCompanyName().split("@"); String[] companyArray = fireTeam.getCompanyName().split("@");
fireTeam.setCompany(Long.parseLong(companyArray[1])); fireTeam.setCompany(Long.parseLong(companyArray[1]));
fireTeam.setCompanyName(companyArray[0]); fireTeam.setCompanyName(companyArray[0]);
try { try {
OrgUsrFormDto companyDto =orgUsrServer.selectCompanyById(Long.parseLong(companyArray[1])); OrgUsrFormDto companyDto = orgUsrServer.selectCompanyById(Long.parseLong(companyArray[1]));
fireTeam.setCompanyCode(companyDto.getBizOrgCode()); fireTeam.setCompanyCode(companyDto.getBizOrgCode());
} catch (Exception e) { } catch (Exception e) {
} }
} }
/* bug2835 添加获取上级单位的信息方法 陈浩 2021-09-10 --end*/ /* bug2835 添加获取上级单位的信息方法 陈浩 2021-09-10 --end */
if (fireTeam.getType() != null) { if (fireTeam.getType() != null) {
String[] type = fireTeam.getType().split("@"); String[] type = fireTeam.getType().split("@");
fireTeam.setType(type[0]); fireTeam.setType(type[0]);
...@@ -776,13 +779,13 @@ if (excelDtoList != null && excelDtoList.size() > 0) { ...@@ -776,13 +779,13 @@ if (excelDtoList != null && excelDtoList.size() > 0) {
List<WaterResourceDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, WaterResourceDto.class, 1); List<WaterResourceDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, WaterResourceDto.class, 1);
excelDtoList.forEach(item -> { excelDtoList.forEach(item -> {
/*Bug 2950 消防水源,缺失设施分类、设施定义等必填字段可以上传成功 陈召 2021-10-09 */ /* Bug 2950 消防水源,缺失设施分类、设施定义等必填字段可以上传成功 陈召 2021-10-09 */
if (item.getEquipName() == null || item.getEquipName().equals(" ")) { if (item.getEquipName() == null || item.getEquipName().equals(" ")) {
throw new RuntimeException("设备定义名称为必填字段,填写后重新上传"); throw new RuntimeException("设备定义名称为必填字段,填写后重新上传");
} }
//BUG 2953 导入模板没有设备编码生成 2021-09-18 陈召开始 // BUG 2953 导入模板没有设备编码生成 2021-09-18 陈召开始
item.setEquipCode(QRCodeUtil.generateQRCode()); item.setEquipCode(QRCodeUtil.generateQRCode());
//BUG 2953 导入模板没有设备编码生成 2021-09-18 陈召结束 // BUG 2953 导入模板没有设备编码生成 2021-09-18 陈召结束
if (item.getResourceTypeName() != null) { if (item.getResourceTypeName() != null) {
String[] resourceTypeName = item.getResourceTypeName().split("@"); String[] resourceTypeName = item.getResourceTypeName().split("@");
item.setResourceTypeName(resourceTypeName[0]); item.setResourceTypeName(resourceTypeName[0]);
...@@ -850,7 +853,7 @@ if (excelDtoList != null && excelDtoList.size() > 0) { ...@@ -850,7 +853,7 @@ if (excelDtoList != null && excelDtoList.size() > 0) {
} }
if (item.getHasDrySeasonType() != null) { if (item.getHasDrySeasonType() != null) {
boolean flag= "有".equals(item.getHasDrySeasonType())?true:false; boolean flag = "有".equals(item.getHasDrySeasonType()) ? true : false;
item.setHasDrySeason(flag); item.setHasDrySeason(flag);
} }
if (item.getEquipName() != null) { if (item.getEquipName() != null) {
...@@ -872,7 +875,7 @@ if (excelDtoList != null && excelDtoList.size() > 0) { ...@@ -872,7 +875,7 @@ if (excelDtoList != null && excelDtoList.size() > 0) {
excelDtoList.forEach(fireExpertsDto -> { excelDtoList.forEach(fireExpertsDto -> {
FireExperts fireExperts = new FireExperts(); FireExperts fireExperts = new FireExperts();
fireExperts = Bean.toPo(fireExpertsDto, fireExperts); fireExperts = Bean.toPo(fireExpertsDto, fireExperts);
fireExperts = Bean.toPo(getCurrentInfo(),fireExperts); fireExperts = Bean.toPo(getCurrentInfo(), fireExperts);
if (fireExperts.getCertificatesType() != null) { if (fireExperts.getCertificatesType() != null) {
String[] certificates = fireExperts.getCertificatesType().split("@"); String[] certificates = fireExperts.getCertificatesType().split("@");
fireExperts.setCertificatesType(certificates[0]); fireExperts.setCertificatesType(certificates[0]);
...@@ -892,12 +895,12 @@ if (excelDtoList != null && excelDtoList.size() > 0) { ...@@ -892,12 +895,12 @@ if (excelDtoList != null && excelDtoList.size() > 0) {
String[] highestEducation = fireExperts.getHighestEducation().split("@"); String[] highestEducation = fireExperts.getHighestEducation().split("@");
fireExperts.setHighestEducation(highestEducation[1]); // BUG 2942 by litw 2021年9月18日 导入学历编号 fireExperts.setHighestEducation(highestEducation[1]); // BUG 2942 by litw 2021年9月18日 导入学历编号
} }
if (fireExperts.getNativePlaceVal() != null){ if (fireExperts.getNativePlaceVal() != null) {
String[] nativePlaceVal = fireExperts.getNativePlaceVal().split("@"); String[] nativePlaceVal = fireExperts.getNativePlaceVal().split("@");
fireExperts.setNativePlace(nativePlaceVal[1]); fireExperts.setNativePlace(nativePlaceVal[1]);
fireExperts.setNativePlaceVal(nativePlaceVal[0]); fireExperts.setNativePlaceVal(nativePlaceVal[0]);
} }
if (fireExperts.getResidenceDetailVal() != null){ if (fireExperts.getResidenceDetailVal() != null) {
String[] residenceDetailVal = fireExperts.getResidenceDetailVal().split("@"); String[] residenceDetailVal = fireExperts.getResidenceDetailVal().split("@");
fireExperts.setResidence(residenceDetailVal[1]); fireExperts.setResidence(residenceDetailVal[1]);
fireExperts.setResidenceDetailVal(residenceDetailVal[0]); fireExperts.setResidenceDetailVal(residenceDetailVal[0]);
...@@ -935,7 +938,7 @@ if (excelDtoList != null && excelDtoList.size() > 0) { ...@@ -935,7 +938,7 @@ if (excelDtoList != null && excelDtoList.size() > 0) {
} else if (ExcelEnums.RYZB.getType().equals(dutyType)) { } else if (ExcelEnums.RYZB.getType().equals(dutyType)) {
initDutyPersonData(sheet, dataList, dayByMonth); initDutyPersonData(sheet, dataList, dayByMonth);
dutyPersonService.saveImportData(dataList); dutyPersonService.saveImportData(dataList);
}else if (ExcelEnums.WXXFZB.getType().equals(dutyType)) { } else if (ExcelEnums.WXXFZB.getType().equals(dutyType)) {
initDutyFireFightingData(sheet, dataList, dayByMonth); initDutyFireFightingData(sheet, dataList, dayByMonth);
dutyFireFightingService.saveImportData(dataList); dutyFireFightingService.saveImportData(dataList);
} }
...@@ -1026,7 +1029,7 @@ if (excelDtoList != null && excelDtoList.size() > 0) { ...@@ -1026,7 +1029,7 @@ if (excelDtoList != null && excelDtoList.size() > 0) {
dutyPersonDto.setPostTypeName(split[0]); dutyPersonDto.setPostTypeName(split[0]);
dutyPersonDto.setPostType(split[1]); dutyPersonDto.setPostType(split[1]);
} }
//需求958 添加值班区域 导入 by kongfm 2021-09-15 // 需求958 添加值班区域 导入 by kongfm 2021-09-15
cell = row.getCell(5); cell = row.getCell(5);
if (cell != null) { if (cell != null) {
String[] dutyArea = cell.toString().split("@"); String[] dutyArea = cell.toString().split("@");
...@@ -1050,6 +1053,7 @@ if (excelDtoList != null && excelDtoList.size() > 0) { ...@@ -1050,6 +1053,7 @@ if (excelDtoList != null && excelDtoList.size() > 0) {
} }
} }
} }
private void initDutyFireFightingData(XSSFSheet sheet, List<Map<String, Object>> dataList, List<Date> dayByMonth) { private void initDutyFireFightingData(XSSFSheet sheet, List<Map<String, Object>> dataList, List<Date> dayByMonth) {
// 遍历行,i = 1,从第二行开始,第一行是表头跳过。 // 遍历行,i = 1,从第二行开始,第一行是表头跳过。
for (int i = 1; i < sheet.getPhysicalNumberOfRows(); i++) { for (int i = 1; i < sheet.getPhysicalNumberOfRows(); i++) {
...@@ -1060,11 +1064,11 @@ if (excelDtoList != null && excelDtoList.size() > 0) { ...@@ -1060,11 +1064,11 @@ if (excelDtoList != null && excelDtoList.size() > 0) {
continue; continue;
} }
Cell cell = row.getCell(4); Cell cell = row.getCell(4);
if(cell ==null ){ if (cell == null) {
continue; continue;
} }
cell = row.getCell(1); cell = row.getCell(1);
if(cell !=null ){ if (cell != null) {
String[] split = cell.toString().split("@"); String[] split = cell.toString().split("@");
dutyFireFightingDto.setTeamId(split[1]); dutyFireFightingDto.setTeamId(split[1]);
dutyFireFightingDto.setTeamName(split[0]); dutyFireFightingDto.setTeamName(split[0]);
...@@ -1103,6 +1107,7 @@ if (excelDtoList != null && excelDtoList.size() > 0) { ...@@ -1103,6 +1107,7 @@ if (excelDtoList != null && excelDtoList.size() > 0) {
dataList.add(dutyPersonDtoMap); dataList.add(dutyPersonDtoMap);
} }
} }
private void excelImportMaintenancePerson(MultipartFile multipartFile) throws Exception { private void excelImportMaintenancePerson(MultipartFile multipartFile) throws Exception {
List<MaintenancePersonExcleDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, List<MaintenancePersonExcleDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile,
MaintenancePersonExcleDto.class, 1); MaintenancePersonExcleDto.class, 1);
...@@ -1115,7 +1120,7 @@ if (excelDtoList != null && excelDtoList.size() > 0) { ...@@ -1115,7 +1120,7 @@ if (excelDtoList != null && excelDtoList.size() > 0) {
// 先填充主表的属性 // 先填充主表的属性
MaintenanceCompany maintenanceCompany = new MaintenanceCompany(); MaintenanceCompany maintenanceCompany = new MaintenanceCompany();
maintenanceCompany = Bean.toPo(maintenancePersonExcleDto, maintenanceCompany); maintenanceCompany = Bean.toPo(maintenancePersonExcleDto, maintenanceCompany);
maintenanceCompany = Bean.toPo(getCurrentInfo(),maintenanceCompany); maintenanceCompany = Bean.toPo(getCurrentInfo(), maintenanceCompany);
maintenanceCompany.setType(PERSON); maintenanceCompany.setType(PERSON);
if (maintenanceCompany.getParentId() != null) { if (maintenanceCompany.getParentId() != null) {
long getParentId = Long.valueOf(maintenancePersonExcleDto.getParentName().split("@")[1]); long getParentId = Long.valueOf(maintenancePersonExcleDto.getParentName().split("@")[1]);
...@@ -1148,22 +1153,21 @@ if (excelDtoList != null && excelDtoList.size() > 0) { ...@@ -1148,22 +1153,21 @@ if (excelDtoList != null && excelDtoList.size() > 0) {
data = initDutyCarTemplate(ids); data = initDutyCarTemplate(ids);
} else if (ExcelEnums.RYZB.getType().equals(excelDto.getType())) { } else if (ExcelEnums.RYZB.getType().equals(excelDto.getType())) {
data = initDutyPersonTemplate(ids); data = initDutyPersonTemplate(ids);
}else if(ExcelEnums.WXXFZB.getType().equals(excelDto.getType())){ } else if (ExcelEnums.WXXFZB.getType().equals(excelDto.getType())) {
data = initDutyDutyFireFightingTemplate(ids); data = initDutyDutyFireFightingTemplate(ids);
} }
// 获取日期 // 获取日期
List<Map<String, Object>> rangeDate = dutyPersonShiftService.getBaseMapper().genRangeDate(beginDate, endDate); List<Map<String, Object>> rangeDate = dutyPersonShiftService.getBaseMapper().genRangeDate(beginDate, endDate);
List<String> dayByMonth = new ArrayList<>(); List<String> dayByMonth = new ArrayList<>();
rangeDate.forEach(item -> dayByMonth.add((String) item.get("date"))); rangeDate.forEach(item -> dayByMonth.add((String) item.get("date")));
if(ExcelEnums.WXXFZB.getType().equals(excelDto.getType())) { if (ExcelEnums.WXXFZB.getType().equals(excelDto.getType())) {
exportDutyTemplate(response, excelDto.getClassUrl(), dayByMonth, excelDto, data, true,true); exportDutyTemplate(response, excelDto.getClassUrl(), dayByMonth, excelDto, data, true, true);
}else { } else {
exportDutyTemplate(response, excelDto.getClassUrl(), dayByMonth, excelDto, data, true,false); exportDutyTemplate(response, excelDto.getClassUrl(), dayByMonth, excelDto, data, true, false);
} }
} }
private List<List<Object>> initDutyDutyFireFightingTemplate(String ids) { private List<List<Object>> initDutyDutyFireFightingTemplate(String ids) {
List<List<Object>> data = new ArrayList<>(); List<List<Object>> data = new ArrayList<>();
// 根据id列表获取单位下的微型消防站集合 // 根据id列表获取单位下的微型消防站集合
...@@ -1176,12 +1180,12 @@ if (excelDtoList != null && excelDtoList.size() > 0) { ...@@ -1176,12 +1180,12 @@ if (excelDtoList != null && excelDtoList.size() > 0) {
if (!personDetailList.isEmpty()) { if (!personDetailList.isEmpty()) {
AtomicInteger row = new AtomicInteger(1); AtomicInteger row = new AtomicInteger(1);
personDetailList.forEach(o -> { personDetailList.forEach(o -> {
DutyFireFightingDto dto= (DutyFireFightingDto) Bean.mapToBean(o, DutyFireFightingDto.class); DutyFireFightingDto dto = (DutyFireFightingDto) Bean.mapToBean(o, DutyFireFightingDto.class);
ArrayList<Object> list = new ArrayList<>(); ArrayList<Object> list = new ArrayList<>();
list.add(row.getAndIncrement()); list.add(row.getAndIncrement());
list.add(dto.getTeamName() +"@" + dto.getTeamId()); list.add(dto.getTeamName() + "@" + dto.getTeamId());
list.add(dto.getUserName()+ "@" + dto.getUserId()); list.add(dto.getUserName() + "@" + dto.getUserId());
list.add(dto.getPostTypeName()+ "@" + dto.getPostType()); list.add(dto.getPostTypeName() + "@" + dto.getPostType());
list.add(o.get("fireStation")); list.add(o.get("fireStation"));
data.add(list); data.add(list);
}); });
...@@ -1200,17 +1204,17 @@ if (excelDtoList != null && excelDtoList.size() > 0) { ...@@ -1200,17 +1204,17 @@ if (excelDtoList != null && excelDtoList.size() > 0) {
data = initDutyCarInfo(beginDate, endDate, dayByMonth); data = initDutyCarInfo(beginDate, endDate, dayByMonth);
} else if (ExcelEnums.RYZB.getType().equals(excelDto.getType())) { } else if (ExcelEnums.RYZB.getType().equals(excelDto.getType())) {
data = initDutyPersonInfo(beginDate, endDate, dayByMonth); data = initDutyPersonInfo(beginDate, endDate, dayByMonth);
}else if(ExcelEnums.WXXFZB.getType().equals(excelDto.getType())){ } else if (ExcelEnums.WXXFZB.getType().equals(excelDto.getType())) {
data = initDutyDutyFireFightingTemplate(beginDate, endDate, dayByMonth); data = initDutyDutyFireFightingTemplate(beginDate, endDate, dayByMonth);
} }
exportDutyTemplate(response, excelDto.getClassUrl(), dayByMonth, excelDto, data, false,false); exportDutyTemplate(response, excelDto.getClassUrl(), dayByMonth, excelDto, data, false, false);
} }
private List<List<Object>> initDutyDutyFireFightingTemplate(String beginDate, String endDate, private List<List<Object>> initDutyDutyFireFightingTemplate(String beginDate, String endDate,
List<String> dayByMonth) throws ParseException { List<String> dayByMonth) throws ParseException {
List<DutyFireFightingDto> list=dutyFireFightingService.downloadList(beginDate, endDate); List<DutyFireFightingDto> list = dutyFireFightingService.downloadList(beginDate, endDate);
List<List<Object>> data = new ArrayList<>(); List<List<Object>> data = new ArrayList<>();
// 组装导出数据 // 组装导出数据
if (!list.isEmpty()) { if (!list.isEmpty()) {
...@@ -1287,16 +1291,14 @@ if (excelDtoList != null && excelDtoList.size() > 0) { ...@@ -1287,16 +1291,14 @@ if (excelDtoList != null && excelDtoList.size() > 0) {
return data; return data;
} }
private void exportDutyTemplate(HttpServletResponse response, String classUrl, List<String> dayByMonth, private void exportDutyTemplate(HttpServletResponse response, String classUrl, List<String> dayByMonth,
ExcelDto excelDto, List<? extends Object> data, Boolean flag,Boolean typeFlag) { ExcelDto excelDto, List<? extends Object> data, Boolean flag, Boolean typeFlag) {
try { try {
// 获取排班类型 // 获取排班类型
String[] dutyNameList = getDutyNameList(); String[] dutyNameList = getDutyNameList();
Class<?> clz = Class.forName(classUrl); Class<?> clz = Class.forName(classUrl);
ExcelUtil.createDutyTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), data, clz, ExcelUtil.createDutyTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), data, clz,
dayByMonth, dutyNameList, dataSourcesImpl, flag,typeFlag); dayByMonth, dutyNameList, dataSourcesImpl, flag, typeFlag);
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
e.printStackTrace(); e.printStackTrace();
...@@ -1446,18 +1448,21 @@ if (excelDtoList != null && excelDtoList.size() > 0) { ...@@ -1446,18 +1448,21 @@ if (excelDtoList != null && excelDtoList.size() > 0) {
break; break;
} }
} }
@Autowired @Autowired
private RedisUtils redisUtils; private RedisUtils redisUtils;
public BaseEntity getCurrentInfo() { public BaseEntity getCurrentInfo() {
BaseEntity userModel= new BaseEntity(); BaseEntity userModel = new BaseEntity();
String keyString= RequestContext.getExeUserId(); FeignClientResult<AgencyUserModel> agencyUserModel = Privilege.agencyUserClient.getme();
String token=RequestContext.getToken(); AgencyUserModel userModel1 = agencyUserModel.getResult();
ReginParams params = JSONObject.parseObject(redisUtils String keyString = userModel1.getUserId();
.get(RedisKey.buildReginKey(keyString, token)).toString(), String token = RequestContext.getToken();
ReginParams params = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(keyString, token)).toString(),
ReginParams.class); ReginParams.class);
userModel.setRecUserId(params.getUserModel().getUserId()); userModel.setRecUserId(params.getUserModel().getUserId());
userModel.setRecUserName(params.getUserModel().getUserName()); userModel.setRecUserName(params.getUserModel().getUserName());
userModel.setRecDate( new Date()); userModel.setRecDate(new Date());
return userModel; return userModel;
} }
} }
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