Commit 42cd994b authored by 高建强's avatar 高建强

item:解决移动端巡检离线模式问题appDownloadDatas

parent 28decfa2
......@@ -4,6 +4,7 @@ import com.yeejoin.equipmanage.common.entity.*;
import com.yeejoin.equipmanage.common.vo.BuildingTreeVo;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
/**
......@@ -18,47 +19,47 @@ public class AppDownloadVO {
/**
* 装备
*/
private List<DownloadEquipmentDataVO> downloadEquipmentDatas;
private List<DownloadEquipmentDataVO> downloadEquipmentDatas = new ArrayList<>();
/**
* 车辆
*/
private List<Car> downloadCarDatas;
private List<Car> downloadCarDatas = new ArrayList<>();
/**
* 建筑
*/
private List<BuildingTreeVo> buildTree;
private List<BuildingTreeVo> buildTree = new ArrayList<>();
/**
*设备对应性能指标
*/
private List<EquipmentSpecificIndex> equipmentSpecificIndexs;
private List<EquipmentSpecificIndex> equipmentSpecificIndexs = new ArrayList<>();
/**
*性能指标模板
*/
private List<EquipmentIndex> equipmentIndex;
private List<EquipmentIndex> equipmentIndex = new ArrayList<>();
/**
*货位
*/
private List<WarehouseStructure> warehouseStructure;
private List<WarehouseStructure> warehouseStructure = new ArrayList<>();
/**
* 车载装备
*/
private List<EquipmentOnCar> equipmentOnCar;
private List<EquipmentOnCar> equipmentOnCar = new ArrayList<>();
/**
* 车载灭火药剂
*/
private List<ExtinguishantOnCar> extinguishantOnCar;
private List<ExtinguishantOnCar> extinguishantOnCar = new ArrayList<>();
/**
*报废原因
*/
private List<SystemDic> reason;
private List<SystemDic> reason = new ArrayList<>();
}
package com.yeejoin.equipmanage.service.impl;
import javax.annotation.Resource;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.equipmanage.common.entity.FormGroup;
import com.yeejoin.equipmanage.common.entity.SystemDic;
import com.yeejoin.equipmanage.common.entity.vo.AppDownloadVO;
import com.yeejoin.equipmanage.common.enums.GroupCodeEnum;
import com.yeejoin.equipmanage.common.utils.FileUploadFactory;
import com.yeejoin.equipmanage.common.utils.FileUploadTypeEnum;
import com.yeejoin.equipmanage.common.utils.ImportFile;
import com.yeejoin.equipmanage.common.vo.BuildingTreeVo;
import com.yeejoin.equipmanage.mapper.EquipmentMapper;
import com.yeejoin.equipmanage.mapper.ExtinguishantOnCarMapper;
import com.yeejoin.equipmanage.service.*;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import com.yeejoin.equipmanage.common.utils.FileUploadFactory;
import com.yeejoin.equipmanage.common.utils.FileUploadTypeEnum;
import com.yeejoin.equipmanage.common.utils.ImportFile;
import org.typroject.tyboot.core.foundation.utils.Bean;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
@Service
public class DownloadFileService implements IDownloadFileService {
@Autowired
@Lazy
@Autowired
@Lazy
private FileUploadFactory factory;
@Autowired
private IFormInstanceService iFormInstanceService;
private IFormInstanceService iFormInstanceService;
@Autowired
private IFormGroupService iFormGroupService;
private IFormGroupService iFormGroupService;
@Autowired
private ICarService carService;
private ICarService carService;
@Autowired
private EquipmentMapper equipmentMapper;
private EquipmentMapper equipmentMapper;
@Autowired
private IExtinguishantOnCarService extinguishantOnCarService;
private IExtinguishantOnCarService extinguishantOnCarService;
@Autowired
private IEquipmentIndexService equipmentIndexService;
private IEquipmentIndexService equipmentIndexService;
@Autowired
private IEquipmentSpecificIndexSerivce equipmentSpecificIndexSerivce;
private IEquipmentSpecificIndexSerivce equipmentSpecificIndexSerivce;
@Autowired
private IWarehouseStructureService warehouseStructureService;
private IWarehouseStructureService warehouseStructureService;
@Autowired
private ISystemDicService systemDicService;
private ISystemDicService systemDicService;
@Autowired
private IEquipmentOnCarService equipmentOnCarService;
@Resource(name = "fileUploadFactory")
public void setFactory(FileUploadFactory factory) {
this.factory = factory;
}
@Override
public HSSFWorkbook DownloadFile(String type) {
ImportFile up = factory.create(FileUploadTypeEnum.getEnum(type));
HSSFWorkbook workbook =(HSSFWorkbook) up.downloadImportFile();
return workbook;
}
@Override
public AppDownloadVO appDownloadDatas() {
AppDownloadVO appDownload = new AppDownloadVO();
//建筑信息
FormGroup formGroup = iFormGroupService.getByUniqueKey(GroupCodeEnum.ALL_BUILDING.getGroupCode());
List<Map<String, Object>> allList = iFormInstanceService.getSpecialChildrenList(null);
List<BuildingTreeVo> allListVo = buildBuildingData(formGroup, allList);
appDownload.setBuildTree(allListVo);
//车辆信息
appDownload.setDownloadCarDatas(carService.list());
//装备信息
appDownload.setDownloadEquipmentDatas(equipmentMapper.getDownloadEquipmentData());
//性能指标模板
appDownload.setEquipmentIndex(equipmentIndexService.list());
//性能指标
appDownload.setEquipmentSpecificIndexs(equipmentSpecificIndexSerivce.list());
//仓库
appDownload.setWarehouseStructure(warehouseStructureService.list());
//车载装备
appDownload.setEquipmentOnCar(equipmentOnCarService.list());
//车载灭火药剂
appDownload.setExtinguishantOnCar(extinguishantOnCarService.list());
//报废原因
appDownload.setReason(systemDicService.list(new QueryWrapper<SystemDic>().eq("type", "ScrapReason")));
return appDownload;
}
/**
* 建筑树数据处理
* @param formGroup
* @param allList
* @return
*/
private List<BuildingTreeVo> buildBuildingData(FormGroup formGroup, List<Map<String, Object>> allList) {
List<BuildingTreeVo> allListVo = Bean.listMap2ListBean(allList, BuildingTreeVo.class);
BuildingTreeVo treeNode = new BuildingTreeVo();
treeNode.setInstanceId(formGroup.getId());
treeNode.setInstanceName(formGroup.getGroupName());
treeNode.setParentId("-1");
treeNode.setGroupType(formGroup.getGroupType());
treeNode.setGroupCode(formGroup.getGroupCode());
allListVo.add(treeNode);
return allListVo;
}
private IEquipmentOnCarService equipmentOnCarService;
@Resource(name = "fileUploadFactory")
public void setFactory(FileUploadFactory factory) {
this.factory = factory;
}
@Override
public HSSFWorkbook DownloadFile(String type) {
ImportFile up = factory.create(FileUploadTypeEnum.getEnum(type));
HSSFWorkbook workbook = (HSSFWorkbook) up.downloadImportFile();
return workbook;
}
@Override
public AppDownloadVO appDownloadDatas() {
AppDownloadVO appDownload = new AppDownloadVO();
//建筑信息
FormGroup formGroup = iFormGroupService.getByUniqueKey(GroupCodeEnum.ALL_BUILDING.getGroupCode());
List<Map<String, Object>> allList = iFormInstanceService.getSpecialChildrenList(null);
List<BuildingTreeVo> allListVo = buildBuildingData(formGroup, allList);
appDownload.setBuildTree(allListVo);
//车辆信息
appDownload.setDownloadCarDatas(carService.list());
//装备信息
// appDownload.setDownloadEquipmentDatas(equipmentMapper.getDownloadEquipmentData());
//
// //性能指标模板
// appDownload.setEquipmentIndex(equipmentIndexService.list(queryWrapper1));
//
// //性能指标
// appDownload.setEquipmentSpecificIndexs(equipmentSpecificIndexSerivce.list(queryWrapper));
//仓库
appDownload.setWarehouseStructure(warehouseStructureService.list());
//车载装备
appDownload.setEquipmentOnCar(equipmentOnCarService.list());
//车载灭火药剂
appDownload.setExtinguishantOnCar(extinguishantOnCarService.list());
//报废原因
appDownload.setReason(systemDicService.list(new QueryWrapper<SystemDic>().eq("type", "ScrapReason")));
return appDownload;
}
/**
* 建筑树数据处理
*
* @param formGroup
* @param allList
* @return
*/
private List<BuildingTreeVo> buildBuildingData(FormGroup formGroup, List<Map<String, Object>> allList) {
List<BuildingTreeVo> allListVo = Bean.listMap2ListBean(allList, BuildingTreeVo.class);
BuildingTreeVo treeNode = new BuildingTreeVo();
treeNode.setInstanceId(formGroup.getId());
treeNode.setInstanceName(formGroup.getGroupName());
treeNode.setParentId("-1");
treeNode.setGroupType(formGroup.getGroupType());
treeNode.setGroupCode(formGroup.getGroupCode());
allListVo.add(treeNode);
return allListVo;
}
}
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