package com.gkhy.safePlatform.equipment.service.impl;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.gkhy.safePlatform.account.rpc.apimodel.AccountDepartmentService;
|
import com.gkhy.safePlatform.account.rpc.apimodel.model.resp.DepInfoRPCRespDTO;
|
import com.gkhy.safePlatform.commons.enums.ResultCodes;
|
import com.gkhy.safePlatform.commons.query.PageQuery;
|
import com.gkhy.safePlatform.commons.utils.BeanCopyUtils;
|
import com.gkhy.safePlatform.commons.utils.PageUtils;
|
import com.gkhy.safePlatform.commons.vo.ResultVO;
|
import com.gkhy.safePlatform.commons.vo.SearchResultVO;
|
import com.gkhy.safePlatform.equipment.entity.*;
|
import com.gkhy.safePlatform.equipment.excepiton.EquipmentException;
|
import com.gkhy.safePlatform.equipment.model.dto.req.*;
|
import com.gkhy.safePlatform.equipment.model.dto.resp.EquipmentInfoDto;
|
import com.gkhy.safePlatform.equipment.model.dto.resp.EquipmentInfoExcel;
|
import com.gkhy.safePlatform.equipment.repository.EquipmentInfoRepository;
|
import com.gkhy.safePlatform.equipment.repository.EquipmentTypeMngRepository;
|
import com.gkhy.safePlatform.equipment.service.*;
|
import com.gkhy.safePlatform.equipment.service.baseService.*;
|
import com.gkhy.safePlatform.equipment.utils.DateUtils;
|
import com.gkhy.safePlatform.equipment.utils.QueryHelpPlus;
|
import com.gkhy.safePlatform.equipment.utils.poihelper.ExcelLogs;
|
import com.gkhy.safePlatform.equipment.utils.poihelper.ExcelUtil;
|
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.dubbo.config.annotation.DubboReference;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Service;
|
import org.springframework.util.StringUtils;
|
import org.springframework.web.multipart.MultipartFile;
|
|
import javax.servlet.http.HttpServletResponse;
|
import java.io.IOException;
|
import java.io.Serializable;
|
import java.net.URLEncoder;
|
import java.util.*;
|
import java.util.stream.Collectors;
|
|
/**
|
* 设备设施详细信息(EquipmentInfo)表服务实现类
|
*
|
* @author xurui
|
* @since 2022-07-19 14:02:50
|
*/
|
@Service("equipmentInfoService")
|
public class EquipmentInfoServiceImpl implements EquipmentInfoService {
|
|
@Autowired
|
private EquipmentInfoBaseService equipmentInfoBaseService;
|
|
@Autowired
|
private EquipmentTakecareDetailBaseService equipmentTakecareDetailBaseService;
|
|
@Autowired
|
private EquipmentTestDetailBaseService equipmentTestDetailBaseService;
|
|
@Autowired
|
private EquipmentRepairDetailBaseService equipmentRepairDetailBaseService;
|
|
@Autowired
|
private EquipmentTakecareStardardDetailBaseService equipmentTakecareStardardDetailBaseService;
|
|
@Autowired
|
private EquipmentCheckStandardDetailBaseService equipmentCheckStandardDetailBaseService;
|
|
@DubboReference(check = false)
|
private AccountDepartmentService accountDepartmentService;
|
|
@Autowired
|
private EquipmentTypeMngRepository equipmentTypeMngRepository;
|
|
@Autowired
|
public HttpServletResponse response;
|
|
@Override
|
public ResultVO queryAll(PageQuery<EquipmentInfoQueryCriteria> pageQuery) {
|
if(pageQuery.getSearchParams().getInfoType() == null){
|
return new ResultVO<>(ResultCodes.CLIENT_PARAM_ILLEGAL,"缺少infoType");
|
}
|
|
PageUtils.checkCheck(pageQuery);
|
|
Long pageIndex = pageQuery.getPageIndex();
|
Long pageSize = pageQuery.getPageSize();
|
IPage<EquipmentInfo> page = new Page<>(pageIndex, pageSize);
|
|
page = equipmentInfoBaseService.selectPage(page,
|
QueryHelpPlus.getPredicate(EquipmentInfo.class, pageQuery.getSearchParams()));
|
List<EquipmentInfoDto> respList = BeanCopyUtils.copyBeanList(page.getRecords(), EquipmentInfoDto.class);
|
|
//获取额外信息
|
respList.forEach(f->{
|
//设备保养
|
EquipmentTakecareDetailQueryCriteria criteria = new EquipmentTakecareDetailQueryCriteria();
|
criteria.setEquipmentId(f.getId());
|
criteria.setInfoTpe(pageQuery.getSearchParams().getInfoType());
|
List<EquipmentTakecareDetail> takecareDetailList = equipmentTakecareDetailBaseService.queryAll(criteria);
|
f.setTakecareDetailList(takecareDetailList);
|
|
//设备检测
|
EquipmentTestDetailQueryCriteria criteria1 = new EquipmentTestDetailQueryCriteria();
|
criteria1.setEquipmentId(f.getId());
|
criteria1.setInfoTpe(pageQuery.getSearchParams().getInfoType());
|
List<EquipmentTestDetail> testDetailList = equipmentTestDetailBaseService.queryAll(criteria1);
|
f.setTestDetailList(testDetailList);
|
|
//设备检查 TODO
|
|
|
//设备维修
|
EquipmentRepairDetailQueryCriteria criteria2 = new EquipmentRepairDetailQueryCriteria();
|
criteria2.setEquipmentId(f.getId());
|
criteria2.setInfoTpe(pageQuery.getSearchParams().getInfoType());
|
List<EquipmentRepairDetail> repairDetailList = equipmentRepairDetailBaseService.queryAll(criteria2);
|
f.setRepaireDetailList(repairDetailList);
|
|
|
// --------------------------- 获取部门信息-----------------------
|
//收集所用到的部门ID
|
Set<Long> collectDepIdSet = new HashSet();
|
collectDepIdSet.add(f.getDepartmentId());
|
collectDepIdSet.add(f.getLeadingDepartmentId());
|
collectDepIdSet.add(f.getLeadingPersonDepartmentId());
|
takecareDetailList.forEach(info->{collectDepIdSet.add(info.getLeadingPersonDepartmentId());});
|
testDetailList.forEach(info->{collectDepIdSet.add(info.getTestPersonDepartmentId());});
|
repairDetailList.forEach(info->{collectDepIdSet.add(info.getRepairPersonDepartmentId());});
|
|
//获取部门名集合
|
Map<Long,String> depNameMap = getDepName(collectDepIdSet);
|
|
//set
|
f.setDepartmentName(depNameMap.get(f.getDepartmentId()));
|
f.setLeadingDepartmentName(depNameMap.get(f.getLeadingDepartmentId()));
|
f.setLeadingPersonDepartmentName(depNameMap.get(f.getLeadingPersonDepartmentId()));
|
takecareDetailList.forEach(info->{info.setLeadingPersonDepartmentName(depNameMap.get(info.getLeadingPersonDepartmentId()));});
|
testDetailList.forEach(info->{info.setTestPersonDepartmentName(depNameMap.get(info.getTestPersonDepartmentId()));});
|
repairDetailList.forEach(info->{info.setRepairPersonDepartmentName(depNameMap.get(info.getRepairPersonDepartmentId()));});
|
|
});
|
return new SearchResultVO<>(
|
true,
|
pageIndex,
|
pageSize,page.getPages(),
|
page.getTotal(),
|
respList,
|
ResultCodes.OK
|
);
|
}
|
|
|
@Override
|
public List<EquipmentInfo> queryAll(EquipmentInfoQueryCriteria criteria) {
|
return equipmentInfoBaseService.queryAll(criteria);
|
}
|
|
@Override
|
public EquipmentInfoDto selectOne(Serializable id) {
|
EquipmentInfo equipmentInfo = equipmentInfoBaseService.getById(id);
|
if(equipmentInfo == null){
|
return null;
|
}
|
|
EquipmentInfoDto infoDto = BeanCopyUtils.copyBean(equipmentInfo, EquipmentInfoDto.class);
|
|
//设备保养
|
EquipmentTakecareDetailQueryCriteria criteria = new EquipmentTakecareDetailQueryCriteria();
|
criteria.setEquipmentId(infoDto.getId());
|
criteria.setInfoTpe(infoDto.getInfoType());
|
List<EquipmentTakecareDetail> takecareDetailList = equipmentTakecareDetailBaseService.queryAll(criteria);
|
infoDto.setTakecareDetailList(takecareDetailList);
|
|
//设备检测
|
EquipmentTestDetailQueryCriteria criteria1 = new EquipmentTestDetailQueryCriteria();
|
criteria1.setEquipmentId(infoDto.getId());
|
criteria1.setInfoTpe(infoDto.getInfoType());
|
List<EquipmentTestDetail> testDetailList = equipmentTestDetailBaseService.queryAll(criteria1);
|
infoDto.setTestDetailList(testDetailList);
|
|
//设备检查 TODO
|
|
|
//设备维修
|
EquipmentRepairDetailQueryCriteria criteria2 = new EquipmentRepairDetailQueryCriteria();
|
criteria2.setEquipmentId(infoDto.getId());
|
criteria2.setInfoTpe(infoDto.getInfoType());
|
List<EquipmentRepairDetail> repairDetailList = equipmentRepairDetailBaseService.queryAll(criteria2);
|
infoDto.setRepaireDetailList(repairDetailList);
|
|
//检查标准
|
EquipmentCheckStandardDetailQueryCriteria criteria3 = new EquipmentCheckStandardDetailQueryCriteria();
|
criteria3.setEquipmentId(infoDto.getId());
|
criteria3.setInfoTpe(infoDto.getInfoType());
|
List<EquipmentCheckStandardDetail> checkStandardDetailList = equipmentCheckStandardDetailBaseService.queryAll(criteria3);
|
infoDto.setCheckStandardeDetailList(checkStandardDetailList);
|
|
//保养标准
|
EquipmentTakecareStardardDetailQueryCriteria criteria4 = new EquipmentTakecareStardardDetailQueryCriteria();
|
criteria4.setEquipmentId(infoDto.getId());
|
criteria4.setInfoTpe(infoDto.getInfoType());
|
List<EquipmentTakecareStardardDetail> takecareStardardDetailList = equipmentTakecareStardardDetailBaseService.queryAll(criteria4);
|
infoDto.setTakecareStardardeDetailList(takecareStardardDetailList);
|
|
|
// --------------------------- 获取部门信息-----------------------
|
//收集所用到的部门ID
|
Set<Long> collectDepIdSet = new HashSet();
|
collectDepIdSet.add(infoDto.getDepartmentId());
|
collectDepIdSet.add(infoDto.getLeadingDepartmentId());
|
collectDepIdSet.add(infoDto.getLeadingPersonDepartmentId());
|
takecareDetailList.forEach(info->{collectDepIdSet.add(info.getLeadingPersonDepartmentId());});
|
testDetailList.forEach(info->{collectDepIdSet.add(info.getTestPersonDepartmentId());});
|
repairDetailList.forEach(info->{collectDepIdSet.add(info.getRepairPersonDepartmentId());});
|
|
//获取部门名集合
|
Map<Long,String> depNameMap = getDepName(collectDepIdSet);
|
|
//set
|
infoDto.setDepartmentName(depNameMap.get(infoDto.getDepartmentId()));
|
infoDto.setLeadingDepartmentName(depNameMap.get(infoDto.getLeadingDepartmentId()));
|
infoDto.setLeadingPersonDepartmentName(depNameMap.get(infoDto.getLeadingPersonDepartmentId()));
|
takecareDetailList.forEach(info->{info.setLeadingPersonDepartmentName(depNameMap.get(info.getLeadingPersonDepartmentId()));});
|
testDetailList.forEach(info->{info.setTestPersonDepartmentName(depNameMap.get(info.getTestPersonDepartmentId()));});
|
repairDetailList.forEach(info->{info.setRepairPersonDepartmentName(depNameMap.get(info.getRepairPersonDepartmentId()));});
|
|
EquipmentTypeMng typeMng = equipmentTypeMngRepository.selectOne(new QueryWrapper<EquipmentTypeMng>().eq("id",infoDto.getEquipmentTypeId()));
|
if(typeMng != null){
|
infoDto.setEquipmentTypeName(typeMng.getTypeName());
|
}
|
return infoDto;
|
}
|
|
@Override
|
public void addOrUpdate(EquipmentInfoSaveOrUpdate infoDto) {
|
if(infoDto.getInfoType() == null || infoDto.getEquipmentTypeId() == null){
|
throw new EquipmentException(ResultCodes.CLIENT_PARAM_ILLEGAL);
|
}
|
if(infoDto.getInfoType() == 3){
|
throw new EquipmentException(ResultCodes.CLIENT_PARAM_ILLEGAL);
|
}
|
|
EquipmentInfo equipmentInfo = BeanCopyUtils.copyBean(infoDto, EquipmentInfo.class);
|
//保存主数据
|
if (infoDto.getId() == null) { //新增
|
equipmentInfoBaseService.save(equipmentInfo);
|
} else {
|
equipmentInfoBaseService.update(equipmentInfo,new UpdateWrapper<EquipmentInfo>().eq("id",infoDto.getId()));
|
}
|
|
|
//保存设备保养
|
List<EquipmentTakecareDetail> takecareDetailList = infoDto.getTakecareDetailList();
|
takecareDetailList.forEach(f->{
|
f.setEquipmentId(equipmentInfo.getId());
|
f.setInfoTpe(equipmentInfo.getInfoType());
|
});
|
equipmentTakecareDetailBaseService.saveOrUpdateBatch(takecareDetailList);
|
if(StringUtils.hasText(infoDto.getDelTakecareDetails())){
|
List<Long> idList = Arrays.stream(infoDto.getDelTakecareDetails().split(",")).map(s-> Long.parseLong(s.trim()))
|
.collect(Collectors.toList());
|
|
List<EquipmentTakecareDetail> delList = new ArrayList<>();
|
idList.forEach(f->{
|
EquipmentTakecareDetail info = new EquipmentTakecareDetail();
|
info.setDelFlag(1);
|
info.setId(f);
|
delList.add(info);
|
});
|
equipmentTakecareDetailBaseService.updateBatchById(delList);
|
}
|
|
|
|
//保存设备检测
|
List<EquipmentTestDetail> testDetailList = infoDto.getTestDetailList();
|
testDetailList.forEach(f->{
|
f.setEquipmentId(equipmentInfo.getId());
|
f.setInfoTpe(equipmentInfo.getInfoType());
|
});
|
equipmentTestDetailBaseService.saveOrUpdateBatch(testDetailList);
|
if(StringUtils.hasText(infoDto.getDelTestDetails())){
|
List<Long> idList = Arrays.stream(infoDto.getDelTestDetails().split(",")).map(s-> Long.parseLong(s.trim()))
|
.collect(Collectors.toList());
|
List<EquipmentTestDetail> delList = new ArrayList<>();
|
idList.forEach(f->{
|
EquipmentTestDetail info = new EquipmentTestDetail();
|
info.setDelFlag(1);
|
info.setId(f);
|
delList.add(info);
|
});
|
equipmentTestDetailBaseService.updateBatchById(delList);
|
}
|
|
//设备检查 TODO
|
|
|
//保存设备维修
|
List<EquipmentRepairDetail> repaireDetailList = infoDto.getRepaireDetailList();
|
repaireDetailList.forEach(f->{
|
f.setEquipmentId(equipmentInfo.getId());
|
f.setInfoTpe(equipmentInfo.getInfoType());
|
});
|
equipmentRepairDetailBaseService.saveOrUpdateBatch(repaireDetailList);
|
if(StringUtils.hasText(infoDto.getDelRepaireDetails())){
|
List<Long> idList = Arrays.stream(infoDto.getDelRepaireDetails().split(",")).map(s-> Long.parseLong(s.trim()))
|
.collect(Collectors.toList());
|
List<EquipmentRepairDetail> delList = new ArrayList<>();
|
idList.forEach(f->{
|
EquipmentRepairDetail info = new EquipmentRepairDetail();
|
info.setDelFlag(1);
|
info.setId(f);
|
delList.add(info);
|
});
|
equipmentRepairDetailBaseService.updateBatchById(delList);
|
}
|
|
//保存检查标准
|
List<EquipmentCheckStandardDetail> checkStandardeDetailList = infoDto.getCheckStandardeDetailList();
|
checkStandardeDetailList.forEach(f->{
|
f.setEquipmentId(equipmentInfo.getId());
|
f.setInfoTpe(equipmentInfo.getInfoType());
|
});
|
equipmentCheckStandardDetailBaseService.saveOrUpdateBatch(checkStandardeDetailList);
|
if(StringUtils.hasText(infoDto.getDelCheckStandardeDetails())){
|
List<Long> idList = Arrays.stream(infoDto.getDelCheckStandardeDetails().split(",")).map(s-> Long.parseLong(s.trim()))
|
.collect(Collectors.toList());
|
List<EquipmentCheckStandardDetail> delList = new ArrayList<>();
|
idList.forEach(f->{
|
EquipmentCheckStandardDetail info = new EquipmentCheckStandardDetail();
|
info.setDelFlag(1);
|
info.setId(f);
|
delList.add(info);
|
});
|
equipmentCheckStandardDetailBaseService.updateBatchById(delList);
|
}
|
|
//保存保养标准
|
List<EquipmentTakecareStardardDetail> takecareStardardeDetailList = infoDto.getTakecareStardardeDetailList();
|
takecareStardardeDetailList.forEach(f->{
|
f.setEquipmentId(equipmentInfo.getId());
|
f.setInfoTpe(equipmentInfo.getInfoType());
|
});
|
equipmentTakecareStardardDetailBaseService.saveOrUpdateBatch(takecareStardardeDetailList);
|
if(StringUtils.hasText(infoDto.getDelTakecareStardardeDetails())){
|
List<Long> idList = Arrays.stream(infoDto.getDelTakecareStardardeDetails().split(",")).map(s-> Long.parseLong(s.trim()))
|
.collect(Collectors.toList());
|
List<EquipmentTakecareStardardDetail> delList = new ArrayList<>();
|
idList.forEach(f->{
|
EquipmentTakecareStardardDetail info = new EquipmentTakecareStardardDetail();
|
info.setDelFlag(1);
|
info.setId(f);
|
delList.add(info);
|
});
|
equipmentTakecareStardardDetailBaseService.updateBatchById(delList);
|
}
|
|
|
}
|
|
@Override
|
public Object statistics() {
|
QueryWrapper<EquipmentInfo> wrapper = new QueryWrapper<EquipmentInfo>()
|
.select("stop_status as stopStatus,count(0) as count")
|
.groupBy("stop_status");
|
|
List<Map<String, Object>> list = equipmentInfoBaseService.listMaps(wrapper);
|
|
|
Map<String, Object> map = new HashMap<>();
|
map.put("-1",equipmentInfoBaseService.countOverTime());//超时未保养
|
return list;
|
}
|
|
@Override
|
public Map<Long,String> getDepName(Set<Long> collectDepIdSet) {
|
Map<Long, String> depPool = new HashMap<>();
|
collectDepIdSet.forEach(depId ->{
|
// 设置部门名称
|
if (!depPool.containsKey(depId)) {
|
try {
|
ResultVO<DepInfoRPCRespDTO> rpcResult = accountDepartmentService.getDepInfoByDepId(depId);
|
if (rpcResult != null && rpcResult.getCode().equals(ResultCodes.OK.getCode())) {
|
if (rpcResult.getData() != null) {
|
DepInfoRPCRespDTO dep = (DepInfoRPCRespDTO) rpcResult.getData();
|
depPool.put(dep.getDepId(), dep.getDepName());
|
}
|
}
|
} catch (Exception e) {
|
System.out.println("exception"+e);
|
}
|
}
|
});
|
return depPool;
|
}
|
|
@Override
|
public void importData(MultipartFile file) throws IOException {
|
String contentType = file.getContentType();
|
if(!"application/vnd.ms-excel".equals(contentType)
|
&& !"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet".equals(contentType)) {
|
throw new EquipmentException("上传的excel格式错误");
|
}
|
|
Collection<EquipmentInfoImportExcel> importExcel = ExcelUtil.importExcel(EquipmentInfoImportExcel.class, file.getInputStream(), "yyyy-MM-dd HH:mm:ss", new ExcelLogs() , 0);
|
|
if (CollectionUtils.isEmpty(importExcel)) {
|
return ;
|
}
|
|
List<EquipmentInfo> respList = BeanCopyUtils.copyBeanList((List<EquipmentInfoImportExcel>)importExcel, EquipmentInfo.class);
|
|
equipmentInfoBaseService.saveBatch(respList);
|
}
|
|
@Override
|
public void delete(Long[] ids) {
|
if(ids == null){
|
throw new EquipmentException(ResultCodes.CLIENT_PARAM_ILLEGAL);
|
}
|
List<Long> idList = Arrays.asList(ids);
|
|
List<EquipmentInfo> delList = new ArrayList<>();
|
idList.forEach(f->{
|
EquipmentInfo info = new EquipmentInfo();
|
info.setDelFlag(1);
|
info.setId(f);
|
delList.add(info);
|
});
|
|
equipmentInfoBaseService.updateBatchById(delList);
|
|
}
|
|
@Override
|
public void exportTemplate() throws IOException {
|
Map<String,String> map = new LinkedHashMap<>();
|
map.put("1", "类型/类别外键");
|
map.put("2", "具体类型(页面左侧的导航栏使用) 0:仪器仪表信息 1:生产设备设施 2:安全设备设施 ");
|
map.put("3", "名称");
|
map.put("4", "位号");
|
map.put("5", "用途");
|
map.put("6", "型号");
|
map.put("7", "单位部门外键");
|
map.put("8", "设置部位");
|
map.put("9", "生产日期(yyyy-MM-dd HH:mm:ss)");
|
map.put("10", "使用期限(天)");
|
map.put("11", "生命周期 1:已使用 2:库存中 3:报废");
|
map.put("12", "投用日期(yyyy-MM-dd HH:mm:ss)");
|
map.put("13", "维修状态 1:维修中 2:已修好");
|
map.put("14", "停用状态 1:停用 2.在用 3.维修 4.报废");
|
map.put("15", "上次检查日期(yyyy-MM-dd HH:mm:ss)");
|
map.put("16", "上次检测日期(yyyy-MM-dd HH:mm:ss)");
|
map.put("17", "上次保养日期(yyyy-MM-dd HH:mm:ss)");
|
map.put("18", "下次检查日期(yyyy-MM-dd HH:mm:ss)");
|
map.put("19", "下次检测日期(yyyy-MM-dd HH:mm:ss)");
|
map.put("20", "下次保养日期(yyyy-MM-dd HH:mm:ss)");
|
map.put("21", "负责人ID外键");
|
map.put("22", "负责人部门外键");
|
map.put("23", "供应商");
|
map.put("24", "使用说明");
|
map.put("25", "是否检查 1:是 2:否");
|
map.put("26", "检查周期");
|
map.put("27", "检查提前提醒");
|
map.put("28", "是否检测 1:是 2:否");
|
map.put("29", "检测周期");
|
map.put("30", "检测提前提醒");
|
map.put("31", "是否保养 1:是 2:否");
|
map.put("32", "检查内容");
|
map.put("33", "负责部门/外键");
|
map.put("34", "检查指标");
|
map.put("35", "预警值");
|
map.put("36", "联锁值");
|
map.put("37", "停用理由");
|
map.put("38", "停用后措施");
|
map.put("39", "实际停用日期(yyyy-MM-dd HH:mm:ss)");
|
map.put("40", "停用提交人/外键");
|
map.put("41", "停用提交日期(yyyy-MM-dd HH:mm:ss)");
|
map.put("42", "恢复理由");
|
map.put("43", "恢复填报日期(yyyy-MM-dd HH:mm:ss)");
|
map.put("44", "实际恢复日期(yyyy-MM-dd HH:mm:ss)");
|
map.put("45", "报废理由");
|
map.put("46", "报废填报日期(yyyy-MM-dd HH:mm:ss)");
|
map.put("47", "实际报废日期(yyyy-MM-dd HH:mm:ss)");
|
map.put("48", "保养周期");
|
String fileName = URLEncoder.encode("设备设施管理数据导入模板.xls", "UTF-8");
|
response.setContentType("application/vnd.ms-excel");
|
response.setHeader("Content-Disposition", "attachment;filename=" + fileName + ".xlsx");
|
response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
|
|
ExcelUtil.exportExcel(map,new ArrayList<>() , response.getOutputStream());
|
response.getOutputStream().close();
|
}
|
|
@Override
|
public void exportData(EquipmentInfoQueryCriteria queryCriteria) throws IOException {
|
Map<String,String> map = new LinkedHashMap<>();
|
map.put("0", "ID");
|
map.put("1", "类型/类别外键");
|
map.put("2", "具体类型(页面左侧的导航栏使用) 0:仪器仪表信息 1:生产设备设施 2:安全设备设施 ");
|
map.put("3", "名称");
|
map.put("4", "位号");
|
map.put("5", "用途");
|
map.put("6", "型号");
|
map.put("7", "单位部门外键");
|
map.put("8", "设置部位");
|
map.put("9", "生产日期(yyyy-MM-dd HH:mm:ss)");
|
map.put("10", "使用期限(天)");
|
map.put("11", "生命周期 1:已使用 2:库存中 3:报废");
|
map.put("12", "投用日期(yyyy-MM-dd HH:mm:ss)");
|
map.put("13", "维修状态 1:维修中 2:已修好");
|
map.put("14", "停用状态 1:停用 2.在用 3.维修 4.报废");
|
map.put("15", "上次检查日期(yyyy-MM-dd HH:mm:ss)");
|
map.put("16", "上次检测日期(yyyy-MM-dd HH:mm:ss)");
|
map.put("17", "上次保养日期(yyyy-MM-dd HH:mm:ss)");
|
map.put("18", "下次检查日期(yyyy-MM-dd HH:mm:ss)");
|
map.put("19", "下次检测日期(yyyy-MM-dd HH:mm:ss)");
|
map.put("20", "下次保养日期(yyyy-MM-dd HH:mm:ss)");
|
map.put("21", "负责人ID外键");
|
map.put("22", "负责人部门外键");
|
map.put("23", "供应商");
|
map.put("24", "使用说明");
|
map.put("25", "是否检查 1:是 2:否");
|
map.put("26", "检查周期");
|
map.put("27", "检查提前提醒");
|
map.put("28", "是否检测 1:是 2:否");
|
map.put("29", "检测周期");
|
map.put("30", "检测提前提醒");
|
map.put("31", "是否保养 1:是 2:否");
|
map.put("32", "检查内容");
|
map.put("33", "负责部门/外键");
|
map.put("34", "检查指标");
|
map.put("35", "预警值");
|
map.put("36", "联锁值");
|
map.put("37", "停用理由");
|
map.put("38", "停用后措施");
|
map.put("39", "实际停用日期(yyyy-MM-dd HH:mm:ss)");
|
map.put("40", "停用提交人/外键");
|
map.put("41", "停用提交日期(yyyy-MM-dd HH:mm:ss)");
|
map.put("42", "恢复理由");
|
map.put("43", "恢复填报日期(yyyy-MM-dd HH:mm:ss)");
|
map.put("44", "实际恢复日期(yyyy-MM-dd HH:mm:ss)");
|
map.put("45", "报废理由");
|
map.put("46", "报废填报日期(yyyy-MM-dd HH:mm:ss)");
|
map.put("47", "实际报废日期(yyyy-MM-dd HH:mm:ss)");
|
map.put("48", "保养周期");
|
|
String key = DateUtils.date2String(new Date(), DateUtils.PATTERN_ALLTIME_NOSIGN) ;
|
String fileName = URLEncoder.encode("设备设施管理"+key+".xls", "UTF-8");
|
response.setContentType("application/vnd.ms-excel");
|
response.setHeader("Content-Disposition", "attachment;filename=" + fileName + ".xlsx");
|
response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
|
|
queryCriteria.setDelFlag(0);
|
List<EquipmentInfoExcel> respList = BeanCopyUtils.copyBeanList(this.queryAll(queryCriteria), EquipmentInfoExcel.class);
|
|
ExcelUtil.exportExcel(map,respList , response.getOutputStream(),DateUtils.PATTERN_STANDARD);
|
response.getOutputStream().close();
|
}
|
}
|