Commit e16f7487 authored by kongfm's avatar kongfm

Merge remote-tracking branch 'origin/developer' into developer

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