Commit e1feb7f9 authored by chenzhao's avatar chenzhao

Merge branch 'developer' of http://172.16.10.76/moa/amos-boot-biz into developer

parents 20e2a67e 9019dd78
...@@ -45,4 +45,7 @@ public class RequestData { ...@@ -45,4 +45,7 @@ public class RequestData {
@ApiModelProperty(value = "类型code") @ApiModelProperty(value = "类型code")
private String alertTypeCode; private String alertTypeCode;
@ApiModelProperty(value = "排序")
private String orderTime;
} }
...@@ -84,7 +84,7 @@ public class ExcelUtil { ...@@ -84,7 +84,7 @@ public class ExcelUtil {
*/ */
public static void createDutyTemplate(HttpServletResponse response, String fileName, String sheetName, public static void createDutyTemplate(HttpServletResponse response, String fileName, String sheetName,
List<? extends Object> data, Class<?> model, List<String> dayByMonth, String[] dutyNameList, List<? extends Object> data, Class<?> model, List<String> dayByMonth, String[] dutyNameList,
DataSources dataDictionaryMapper, boolean flag, boolean typeFlag) { DataSources dataDictionaryMapper, boolean flag, String typeFlag,boolean isTemplete) {
HorizontalCellStyleStrategy horizontalCellStyleStrategy = setMyCellStyle(); HorizontalCellStyleStrategy horizontalCellStyleStrategy = setMyCellStyle();
try { try {
...@@ -126,9 +126,12 @@ public class ExcelUtil { ...@@ -126,9 +126,12 @@ public class ExcelUtil {
} }
// String s = new String(fileName.getBytes(), "UTF-8"); // String s = new String(fileName.getBytes(), "UTF-8");
// response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(s, "UTF-8")); // response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(s, "UTF-8"));
ExcelWriterSheetBuilder excelWriterSheetBuilder = null;
; ExcelWriterSheetBuilder excelWriterSheetBuilder =EasyExcel
if (typeFlag) { .write(getOutputStream(fileName, response, ExcelTypeEnum.XLSX))
.head(dutyCarTitleList)
.excelType(ExcelTypeEnum.XLSX).sheet(sheetName);
if ("WXXFZB".equals(typeFlag) && isTemplete) {
List<Map<Integer, String[]>> fireStationExplicitListConstraintMap = new ArrayList<Map<Integer, String[]>>(); List<Map<Integer, String[]>> fireStationExplicitListConstraintMap = new ArrayList<Map<Integer, String[]>>();
List<List<Object>> resultList =new ArrayList<List<Object>>(); List<List<Object>> resultList =new ArrayList<List<Object>>();
data.stream().forEach(i -> { data.stream().forEach(i -> {
...@@ -143,27 +146,49 @@ public class ExcelUtil { ...@@ -143,27 +146,49 @@ public class ExcelUtil {
detail.remove(detail.size()-1); detail.remove(detail.size()-1);
resultList.add(detail); resultList.add(detail);
}); });
excelWriterSheetBuilder= EasyExcel excelWriterSheetBuilder.registerWriteHandler(
.write(getOutputStream(fileName, response, ExcelTypeEnum.XLSX)) new TemplateDynamicCellWriteHandlerDate(fireStationExplicitListConstraintMap))
.head(dutyCarTitleList) .registerWriteHandler(new TemplateCellWriteHandler())
.excelType(ExcelTypeEnum.XLSX).sheet(sheetName) .registerWriteHandler(horizontalCellStyleStrategy);
excelWriterSheetBuilder.doWrite(resultList);
}
else if("JJZB".equals(typeFlag) && isTemplete){
List<Map<Integer, String[]>> fireStationExplicitListConstraintMap = new ArrayList<Map<Integer, String[]>>();
List<List<Object>> resultList =new ArrayList<List<Object>>();
data.stream().forEach(i -> {
Map<Integer, String[]> map = new HashMap<>();
List<Object> detail = (List<Object>) i;
// 微型消防站中的对应单位微型消防站下拉列表数据的集合
List<String> fireStationDetailList = (List<String>) detail.get(detail.size()-1);
String[] strings = new String[fireStationDetailList.size()];
List<String> postTypeNameDetailList = (List<String>) detail.get(detail.size()-2);
String[] postTypeNamestrings = new String[postTypeNameDetailList.size()];
List<String> userNameDetailList = (List<String>) detail.get(detail.size()-3);
String[] userNamestrings = new String[userNameDetailList.size()];
map.put(4, fireStationDetailList.toArray(strings));
map.put(3, postTypeNameDetailList.toArray(postTypeNamestrings));
map.put(2, userNameDetailList.toArray(userNamestrings));
map.putAll(explicitListConstraintMap);
fireStationExplicitListConstraintMap.add(map);
detail.remove(detail.size()-1);
detail.remove(detail.size()-1);
detail.remove(detail.size()-1);
resultList.add(detail);
});
excelWriterSheetBuilder
.registerWriteHandler( .registerWriteHandler(
new TemplateDynamicCellWriteHandlerDate(fireStationExplicitListConstraintMap)) new TemplateDynamicCellWriteHandlerDate(fireStationExplicitListConstraintMap))
.registerWriteHandler(new TemplateCellWriteHandler()) .registerWriteHandler(new TemplateCellWriteHandler())
.registerWriteHandler(horizontalCellStyleStrategy); .registerWriteHandler(horizontalCellStyleStrategy);
excelWriterSheetBuilder.doWrite(resultList); excelWriterSheetBuilder.doWrite(resultList);
} else { }else {
excelWriterSheetBuilder= EasyExcel excelWriterSheetBuilder = excelWriterSheetBuilder
.write(getOutputStream(fileName, response, ExcelTypeEnum.XLSX))
.head(dutyCarTitleList)
.excelType(ExcelTypeEnum.XLSX).sheet(sheetName)
.registerWriteHandler( .registerWriteHandler(
new TemplateCellWriteHandlerDate(explicitListConstraintMap)) new TemplateCellWriteHandlerDate(explicitListConstraintMap))
.registerWriteHandler(new TemplateCellWriteHandler()) .registerWriteHandler(new TemplateCellWriteHandler())
.registerWriteHandler(horizontalCellStyleStrategy); .registerWriteHandler(horizontalCellStyleStrategy);
excelWriterSheetBuilder.doWrite(data); excelWriterSheetBuilder.doWrite(data);
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
throw new RuntimeException("系统异常!"); throw new RuntimeException("系统异常!");
......
...@@ -128,4 +128,8 @@ public interface DutyPersonShiftMapper extends BaseMapper<DutyPersonShift> { ...@@ -128,4 +128,8 @@ public interface DutyPersonShiftMapper extends BaseMapper<DutyPersonShift> {
* @return * @return
*/ */
List<Map<String, Object>> getDutyForSpecifyDate(String duty); List<Map<String, Object>> getDutyForSpecifyDate(String duty);
Map<String, Object> getFireTeamBySequenceNbr (Long sequenceNbr);
List<Map<String, Object>> getFirstAidForTypeCodeAndCompanyId(Long company);
} }
...@@ -242,4 +242,7 @@ public interface IOrgUsrService { ...@@ -242,4 +242,7 @@ public interface IOrgUsrService {
public List<OrgUsr> getPersonListByParentIds(List<String> ids) ; public List<OrgUsr> getPersonListByParentIds(List<String> ids) ;
List<OrgUsrFormDto> getUnSyncOrgCompanyList(List<Long> companyIdList); List<OrgUsrFormDto> getUnSyncOrgCompanyList(List<Long> companyIdList);
public OrgUsr getDetailById( Long id);
} }
...@@ -308,4 +308,37 @@ AND NAME IS NOT NULL ...@@ -308,4 +308,37 @@ AND NAME IS NOT NULL
GROUP BY GROUP BY
NAME NAME
</select> </select>
<select id='getFireTeamBySequenceNbr' resultType="map">
SELECT
name
FROM
cb_fire_team
WHERE
sequence_nbr = #{sequenceNbr} and is_delete=0
</select>
<select id='getFirstAidForTypeCodeAndCompanyId' resultType="map">>
SELECT
name,
sequence_nbr
FROM
cb_fire_team
WHERE
company = #{company}
AND is_delete = 0
AND type_code = (
SELECT
CODE
FROM
cb_data_dictionary
WHERE
`name` = '企(事)业单位医疗救援队(站)'
AND type = 'XFJGLX'
)
</select>
</mapper> </mapper>
...@@ -56,6 +56,8 @@ public class AlertCalledZhDto { ...@@ -56,6 +56,8 @@ public class AlertCalledZhDto {
@ApiModelProperty(value = "纬度") @ApiModelProperty(value = "纬度")
private String latitude; private String latitude;
@ApiModelProperty(value = "标题")
private String alertTypeName;
@ApiModelProperty(value = "响应级别字典code 为了过滤用(只有航空器故障有)") @ApiModelProperty(value = "响应级别字典code 为了过滤用(只有航空器故障有)")
private String responseLevelCode; private String responseLevelCode;
......
...@@ -60,7 +60,17 @@ ...@@ -60,7 +60,17 @@
<if test='par.whether24!=false'> <if test='par.whether24!=false'>
and a.call_time &gt;= (NOW() - interval 24 hour) and a.call_time &gt;= (NOW() - interval 24 hour)
</if> </if>
ORDER BY a.call_time DESC <if test='par.orderTime=="1"'>
ORDER BY a.call_time DESC
</if>
<if test='par.orderTime=="2"'>
ORDER BY a.call_time
</if>
<if test='par.orderTime==null'>
ORDER BY a.call_time DESC
</if>
<if test='pageNum!=null and pageSize !=null'> <if test='pageNum!=null and pageSize !=null'>
limit #{pageNum},#{pageSize} limit #{pageNum},#{pageSize}
</if> </if>
......
...@@ -14,17 +14,13 @@ import org.typroject.tyboot.core.foundation.utils.Bean; ...@@ -14,17 +14,13 @@ import org.typroject.tyboot.core.foundation.utils.Bean;
import com.yeejoin.amos.boot.biz.common.entity.DataDictionary; import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl; import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl;
import com.yeejoin.amos.boot.module.common.api.dto.DutyFirstAidDto; import com.yeejoin.amos.boot.module.common.api.dto.DutyFirstAidDto;
import com.yeejoin.amos.boot.module.common.api.entity.FireTeam;
import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr; import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr;
import com.yeejoin.amos.boot.module.common.api.mapper.DutyPersonShiftMapper; import com.yeejoin.amos.boot.module.common.api.mapper.DutyPersonShiftMapper;
import com.yeejoin.amos.boot.module.common.api.service.IDutyFirstAidService; import com.yeejoin.amos.boot.module.common.api.service.IDutyFirstAidService;
import com.yeejoin.amos.boot.module.common.api.service.IFireTeamService;
@Service @Service
public class DutyFirstAidServiceImpl extends DutyCommonServiceImpl implements IDutyFirstAidService { public class DutyFirstAidServiceImpl extends DutyCommonServiceImpl implements IDutyFirstAidService {
@Autowired
IFireTeamService fireTeamService;
@Autowired @Autowired
DutyPersonShiftMapper dutyPersonShiftMapper; DutyPersonShiftMapper dutyPersonShiftMapper;
...@@ -41,8 +37,11 @@ public class DutyFirstAidServiceImpl extends DutyCommonServiceImpl implements ID ...@@ -41,8 +37,11 @@ public class DutyFirstAidServiceImpl extends DutyCommonServiceImpl implements ID
@Override @Override
public DutyFirstAidDto save(DutyFirstAidDto dto) { public DutyFirstAidDto save(DutyFirstAidDto dto) {
FireTeam fireStationDtoResult = fireTeamService.getFireTeamBySequenceNbr(Long.parseLong(dto.getFirstAidId())); Map<String, Object> fireStationDtoResult = dutyPersonShiftMapper.getFireTeamBySequenceNbr(Long.parseLong(dto.getFirstAidId()));
dto.setFirstAid(fireStationDtoResult.getName()); if(fireStationDtoResult==null || !fireStationDtoResult.containsKey("name")) {
throw new RuntimeException("此120急救站不存在");
}
dto.setFirstAid(fireStationDtoResult.get("name").toString());
Map<String, Object> map = Bean.BeantoMap(dto); Map<String, Object> map = Bean.BeantoMap(dto);
Long instanceId = excuteDynamicFormInstance(dto.getUserId(), map, this.getGroupCode()); Long instanceId = excuteDynamicFormInstance(dto.getUserId(), map, this.getGroupCode());
saveDutyPersonShiftDetail(instanceId, dto.getDutyShift(), dto.getStartTime()); saveDutyPersonShiftDetail(instanceId, dto.getDutyShift(), dto.getStartTime());
...@@ -114,35 +113,36 @@ public class DutyFirstAidServiceImpl extends DutyCommonServiceImpl implements ID ...@@ -114,35 +113,36 @@ public class DutyFirstAidServiceImpl extends DutyCommonServiceImpl implements ID
public List< Map<String, Object>> getFirstAidExportData(List<String> ids) { public List< Map<String, Object>> getFirstAidExportData(List<String> ids) {
List< Map<String, Object>> resultList = new ArrayList<Map<String, Object>>(); List< Map<String, Object>> resultList = new ArrayList<Map<String, Object>>();
String dicCodeString = "830";
String typeString = "XFJGLX"; String typeString = "XFJGLX";
ids.stream().forEach(i->{
List<OrgUsr> personList = orgUsrServiceImpl.getPersonListByParentIds(ids); Map<String, Object> detailMap = new HashMap<String, Object>();
personList.stream().forEach(i -> { List<OrgUsr> personList = orgUsrServiceImpl.getPersonListByParentId(Long.parseLong(i));
String userNameString =i.getBizOrgName()+ "@" +i.getSequenceNbr(); List<String> userNameList= new ArrayList<String>();
Map<String, Object> map = new HashMap<String, Object>(); personList.stream().forEach(m -> {
List<FireTeam> list = fireTeamService.getFirstAidForTypeCodeAndCompanyId(dicCodeString, typeString, String userNameString =m.getBizOrgName()+ "@" +m.getSequenceNbr();
Long.parseLong(i.getParentId())); userNameList.add(userNameString);
List<String> firstAidSimpleList = new ArrayList<String>();
List<String> companySimpleList = new ArrayList<String>();
list.stream().forEach(m -> {
String firstAidNameString = m.getName() + "@" + m.getSequenceNbr();
String companyNameString = m.getCompanyName() + "@" + m.getCompany();
firstAidSimpleList.add(firstAidNameString);
companySimpleList.add(companyNameString);
}); });
detailMap.put("userName", userNameList);
OrgUsr companyDetail = orgUsrServiceImpl.getDetailById(Long.parseLong(i));
String companyNameString = companyDetail.getBizOrgName()+ "@" +companyDetail.getSequenceNbr();
detailMap.put("companyName", companyNameString);
List<DataDictionary> dataDicList= dataDictionaryService.getByType(typeString); List<DataDictionary> dataDicList= dataDictionaryService.getByType(typeString);
List<String> dataDicSimpleList = new ArrayList<String>(); List<String> dataDicSimpleList = new ArrayList<String>();
dataDicList.stream().forEach(l->{ dataDicList.stream().forEach(l->{
String dataDic = l.getName() + "@" +l.getCode(); String dataDic = l.getName() + "@" +l.getCode();
dataDicSimpleList.add(dataDic); dataDicSimpleList.add(dataDic);
}); });
map.put("firstAidName", firstAidSimpleList); detailMap.put("postTypeName",dataDicSimpleList);
map.put("companyName", companySimpleList); List<Map<String, Object>> list = dutyPersonShiftMapper.getFirstAidForTypeCodeAndCompanyId(
map.put("userName", userNameString); Long.parseLong(i));
map.put("postTypeName",dataDicSimpleList);
resultList.add(map); List<String> firstAidSimpleList = new ArrayList<String>();
list.stream().forEach(m -> {
String firstAidNameString = m.get("name").toString() + "@" + m.get("sequence_nbr").toString();
firstAidSimpleList.add(firstAidNameString);
});
detailMap.put("firstAidName", firstAidSimpleList);
resultList.add(detailMap);
}); });
return resultList; return resultList;
} }
......
...@@ -1733,4 +1733,12 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -1733,4 +1733,12 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
} }
return allUnSyncCompanyList; return allUnSyncCompanyList;
} }
public OrgUsr getDetailById( Long id){
LambdaQueryWrapper<OrgUsr> queryWrapper = new LambdaQueryWrapper<OrgUsr>();
queryWrapper.eq(OrgUsr::getIsDelete, false);
queryWrapper.eq(OrgUsr::getSequenceNbr, id);
return this.baseMapper.selectOne(queryWrapper);
}
} }
...@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.jcs.biz.service.impl; ...@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.jcs.biz.service.impl;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams; import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.entity.DataDictionary; import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
...@@ -10,6 +11,7 @@ import com.yeejoin.amos.boot.biz.common.utils.EnumsUtils; ...@@ -10,6 +11,7 @@ import com.yeejoin.amos.boot.biz.common.utils.EnumsUtils;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey; import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils; import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.common.api.dto.FormValue; import com.yeejoin.amos.boot.module.common.api.dto.FormValue;
import com.yeejoin.amos.boot.module.common.api.entity.FirefightersPost;
import com.yeejoin.amos.boot.module.common.api.feign.EquipFeignClient; import com.yeejoin.amos.boot.module.common.api.feign.EquipFeignClient;
import com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl; import com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledObjsDto; import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledObjsDto;
...@@ -25,11 +27,7 @@ import com.yeejoin.amos.boot.module.jcs.api.dto.PowerTransferCompanyZHDto; ...@@ -25,11 +27,7 @@ import com.yeejoin.amos.boot.module.jcs.api.dto.PowerTransferCompanyZHDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.SchedulingReportingDto; import com.yeejoin.amos.boot.module.jcs.api.dto.SchedulingReportingDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.TemplateDto; import com.yeejoin.amos.boot.module.jcs.api.dto.TemplateDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.TemplateExtendDto; import com.yeejoin.amos.boot.module.jcs.api.dto.TemplateExtendDto;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertCalled; import com.yeejoin.amos.boot.module.jcs.api.entity.*;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertFormValue;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertSubmitted;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertSubmittedObject;
import com.yeejoin.amos.boot.module.jcs.api.entity.Template;
import com.yeejoin.amos.boot.module.jcs.api.enums.AlertBusinessTypeEnum; import com.yeejoin.amos.boot.module.jcs.api.enums.AlertBusinessTypeEnum;
import com.yeejoin.amos.boot.module.jcs.api.enums.AlertSchedulingTypeEnum; import com.yeejoin.amos.boot.module.jcs.api.enums.AlertSchedulingTypeEnum;
import com.yeejoin.amos.boot.module.jcs.api.enums.AlertSubmitTypeEnum; import com.yeejoin.amos.boot.module.jcs.api.enums.AlertSubmitTypeEnum;
...@@ -99,7 +97,8 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -99,7 +97,8 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
@Autowired @Autowired
EquipFeignClient equipFeignClient; EquipFeignClient equipFeignClient;
@Autowired
PowerTransferCompanyResourcesServiceImpl powerTransferCompanyResourcesService;
@Autowired @Autowired
AlertSubmittedMapper alertSubmittedMapper; AlertSubmittedMapper alertSubmittedMapper;
...@@ -360,6 +359,8 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -360,6 +359,8 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
} }
// 更新所有车辆状态为执勤 // 更新所有车辆状态为执勤
equipFeignClient.updateCarStatus(carStatusInfoDtoList); equipFeignClient.updateCarStatus(carStatusInfoDtoList);
//跟车辆状态
powerTransferCompanyResourcesService.update(new UpdateWrapper<PowerTransferCompanyResources>().eq("resources_id", transferCarIdList).set("status", FireCarStatusEnum.返队.getCode()));
} }
// 4.发送任务消息 // 4.发送任务消息
......
...@@ -17,6 +17,7 @@ import com.yeejoin.amos.boot.biz.common.utils.RedisUtils; ...@@ -17,6 +17,7 @@ import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.common.api.dto.CompanyPerson; import com.yeejoin.amos.boot.module.common.api.dto.CompanyPerson;
import com.yeejoin.amos.boot.module.common.api.dto.DutyCarDto; import com.yeejoin.amos.boot.module.common.api.dto.DutyCarDto;
import com.yeejoin.amos.boot.module.common.api.dto.DutyFireFightingDto; import com.yeejoin.amos.boot.module.common.api.dto.DutyFireFightingDto;
import com.yeejoin.amos.boot.module.common.api.dto.DutyFirstAidDto;
import com.yeejoin.amos.boot.module.common.api.dto.DutyPersonDto; import com.yeejoin.amos.boot.module.common.api.dto.DutyPersonDto;
import com.yeejoin.amos.boot.module.common.api.dto.DutyPersonShiftDto; import com.yeejoin.amos.boot.module.common.api.dto.DutyPersonShiftDto;
import com.yeejoin.amos.boot.module.common.api.dto.DutyShiftDto; import com.yeejoin.amos.boot.module.common.api.dto.DutyShiftDto;
...@@ -186,7 +187,7 @@ public class ExcelServiceImpl { ...@@ -186,7 +187,7 @@ public class ExcelServiceImpl {
@Autowired @Autowired
OrgUsrSafeReportServiceImpl orgUsrSafeReportService; OrgUsrSafeReportServiceImpl orgUsrSafeReportService;
@Autowired @Autowired
IDutyFirstAidService dutyFirstAidService; IDutyFirstAidService dutyFirstAidService;
...@@ -331,6 +332,9 @@ public class ExcelServiceImpl { ...@@ -331,6 +332,9 @@ public class ExcelServiceImpl {
case "XFAQBG": case "XFAQBG":
excelImportSafeReport(multipartFile); excelImportSafeReport(multipartFile);
break; break;
case "JJZB":
excelImportDutyPerson(multipartFile, "JJZB");
break;
} }
return; return;
} }
...@@ -951,8 +955,65 @@ public class ExcelServiceImpl { ...@@ -951,8 +955,65 @@ public class ExcelServiceImpl {
} 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);
} else if (ExcelEnums.JJZB.getType().equals(dutyType)) {
initDutyFirstAidData(sheet, dataList, dayByMonth);
dutyFireFightingService.saveImportData(dataList);
}
}
}
private void initDutyFirstAidData(XSSFSheet sheet, List<Map<String, Object>> dataList, List<Date> dayByMonth) {
for (int i = 1; i < sheet.getPhysicalNumberOfRows(); i++) {
DutyFirstAidDto dutyFirstAidDto = new DutyFirstAidDto();
// row是一行数据,row.getCell(i),代表拿到这一行,第i列数据
Row row = sheet.getRow(i);
if (row == null) {
continue;
}
Cell cell = row.getCell(2);
if (cell == null) {
continue;
}
cell = row.getCell(1);
if (cell != null) {
String[] split = cell.toString().split("@");
dutyFirstAidDto.setTeamId(split[1]);
dutyFirstAidDto.setTeamName(split[0]);
}
cell = row.getCell(2);
if (cell != null) {
String[] splitStr = cell.toString().split("@");
dutyFirstAidDto.setUserName(splitStr[0]);
dutyFirstAidDto.setUserId(splitStr[1]);
}
cell = row.getCell(3);
if (cell != null) {
String[] splitStr = cell.toString().split("@");
dutyFirstAidDto.setPostTypeName(splitStr[0]);
dutyFirstAidDto.setPostType(splitStr[1]);
}
cell = row.getCell(4);
if (cell != null) {
String[] splitStr = cell.toString().split("@");
dutyFirstAidDto.setFirstAid(splitStr[0]);
dutyFirstAidDto.setFirstAidId(splitStr[1]);
}
List<DutyPersonShiftDto> dutyShift = new ArrayList<>();
for (int j = 0; j < dayByMonth.size(); j++) {
cell = row.getCell(5 + j);
String dutyType = cell == null ? "" : cell.toString();
if (!StringUtils.isEmpty(dutyType)) {
DutyPersonShiftDto dutyPersonShiftDto = new DutyPersonShiftDto();
dutyPersonShiftDto.setDutyDate(dayByMonth.get(j));
dutyPersonShiftDto.setShiftId(Long.valueOf(dutyType.split("@")[1]));
dutyShift.add(dutyPersonShiftDto);
}
} }
dutyFirstAidDto.setDutyShift(dutyShift);
Map<String, Object> dutyPersonDtoMap = Bean.BeantoMap(dutyFirstAidDto);
dataList.add(dutyPersonDtoMap);
} }
} }
private void excelImportSafeReport(MultipartFile multipartFile) throws Exception { private void excelImportSafeReport(MultipartFile multipartFile) throws Exception {
...@@ -965,10 +1026,11 @@ public class ExcelServiceImpl { ...@@ -965,10 +1026,11 @@ public class ExcelServiceImpl {
&& !fileName.toLowerCase().endsWith(ExcelTypeEnum.XLSX.getValue())) { && !fileName.toLowerCase().endsWith(ExcelTypeEnum.XLSX.getValue())) {
throw new Exception("文件类型异常!"); throw new Exception("文件类型异常!");
} }
List<OrgUsrSafeReportExcelDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, OrgUsrSafeReportExcelDto.class, 1); List<OrgUsrSafeReportExcelDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile,
OrgUsrSafeReportExcelDto.class, 1);
List<OrgUsrSafeReport> excelEntityList = new ArrayList<>(); List<OrgUsrSafeReport> excelEntityList = new ArrayList<>();
excelDtoList.forEach(fireExpertsDto -> { excelDtoList.forEach(fireExpertsDto -> {
OrgUsrSafeReport reportExcel= new OrgUsrSafeReport(); OrgUsrSafeReport reportExcel = new OrgUsrSafeReport();
reportExcel = Bean.toPo(fireExpertsDto, reportExcel); reportExcel = Bean.toPo(fireExpertsDto, reportExcel);
reportExcel = Bean.toPo(getCurrentInfo(), reportExcel); reportExcel = Bean.toPo(getCurrentInfo(), reportExcel);
if (reportExcel.getCompany() != null) { if (reportExcel.getCompany() != null) {
...@@ -1192,19 +1254,16 @@ public class ExcelServiceImpl { ...@@ -1192,19 +1254,16 @@ public class ExcelServiceImpl {
} else if (ExcelEnums.WXXFZB.getType().equals(excelDto.getType())) { } else if (ExcelEnums.WXXFZB.getType().equals(excelDto.getType())) {
data = initDutyDutyFireFightingTemplate(ids); data = initDutyDutyFireFightingTemplate(ids);
} else if (ExcelEnums.JJZB.getType().equals(excelDto.getType())) { } else if (ExcelEnums.JJZB.getType().equals(excelDto.getType())) {
//data = initDutyDutyFirstAidTemplate(ids); data = initDutyDutyFirstAidTemplate(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())) { exportDutyTemplate(response, excelDto.getClassUrl(), dayByMonth, excelDto, data, true,
exportDutyTemplate(response, excelDto.getClassUrl(), dayByMonth, excelDto, data, true, true); excelDto.getType(),true);
} else {
exportDutyTemplate(response, excelDto.getClassUrl(), dayByMonth, excelDto, data, true, false);
}
} }
private List<List<Object>> initDutyDutyFirstAidTemplate(String ids) { private List<List<Object>> initDutyDutyFirstAidTemplate(String ids) {
List<List<Object>> data = new ArrayList<>(); List<List<Object>> data = new ArrayList<>();
// 根据id列表获取单位下的微型消防站集合 // 根据id列表获取单位下的微型消防站集合
...@@ -1219,15 +1278,16 @@ public class ExcelServiceImpl { ...@@ -1219,15 +1278,16 @@ public class ExcelServiceImpl {
personDetailList.forEach(o -> { personDetailList.forEach(o -> {
ArrayList<Object> list = new ArrayList<>(); ArrayList<Object> list = new ArrayList<>();
list.add(row.getAndIncrement()); list.add(row.getAndIncrement());
list.add(null); list.add(o.get("companyName"));
list.add(null); list.add(o.get("userName"));
list.add(null); list.add(o.get("postTypeName"));
list.add(o.get("fireStation")); list.add(o.get("firstAidName"));
data.add(list); data.add(list);
}); });
} }
return data; return data;
} }
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列表获取单位下的微型消防站集合
...@@ -1265,13 +1325,37 @@ public class ExcelServiceImpl { ...@@ -1265,13 +1325,37 @@ public class ExcelServiceImpl {
} 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 = initDutyDutyFireFighting(beginDate, endDate, dayByMonth);
} else if (ExcelEnums.JJZB.getType().equals(excelDto.getType())) {
data = initDutyDutyFirstAid(beginDate, endDate, dayByMonth);
} }
exportDutyTemplate(response, excelDto.getClassUrl(), dayByMonth, excelDto, data, false, false); exportDutyTemplate(response, excelDto.getClassUrl(), dayByMonth, excelDto, data, false, ExcelEnums.WXXFZB.getType(),false);
}
private List<List<Object>> initDutyDutyFirstAid(String beginDate, String endDate, List<String> dayByMonth) throws ParseException {
List<DutyFirstAidDto> list = dutyFirstAidService.downloadList(beginDate, endDate);
List<List<Object>> data = new ArrayList<>();
// 组装导出数据
if (!list.isEmpty()) {
AtomicInteger row = new AtomicInteger(1);
list.forEach(o -> {
ArrayList<Object> detailList = new ArrayList<>();
detailList.add(row.getAndIncrement());
detailList.add(o.getTeamName());
detailList.add(o.getUserName());
detailList.add(o.getPostTypeName());
detailList.add(o.getFirstAid());
List<DutyPersonShiftDto> dutyShift = o.getDutyShift();
initDutyShift(dayByMonth, dutyShift, detailList);
data.add(detailList);
});
}
return data;
} }
private List<List<Object>> initDutyDutyFireFightingTemplate(String beginDate, String endDate, private List<List<Object>> initDutyDutyFireFighting(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);
...@@ -1352,13 +1436,13 @@ public class ExcelServiceImpl { ...@@ -1352,13 +1436,13 @@ public class ExcelServiceImpl {
} }
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, String typeFlag,boolean isTemplete) {
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,isTemplete);
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
e.printStackTrace(); e.printStackTrace();
......
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