修复装备分类树状显示bug
装备分类中显示医院,仓库
This commit is contained in:
parent
ba59c13054
commit
1557fd9e35
|
@ -0,0 +1,55 @@
|
||||||
|
package com.hivekion.baseData.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import cn.hutool.json.JSONArray;
|
||||||
|
import com.alibaba.fastjson2.JSON;
|
||||||
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
|
import com.hivekion.baseData.domain.tblhospitalVo.HospitalSearchVo;
|
||||||
|
import com.hivekion.baseData.domain.tblhospitalVo.HospitalViewVo;
|
||||||
|
import com.hivekion.common.annotation.AutoLog;
|
||||||
|
import com.hivekion.common.entity.PagedResultVo;
|
||||||
|
import com.hivekion.common.enums.OperationTypeEnum;
|
||||||
|
import com.hivekion.scenario.entity.Resource;
|
||||||
|
import com.hivekion.scenario.service.IResourceService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/basedata/hospital")
|
||||||
|
|
||||||
|
@Api(value = "医院", tags = {"装备管理-医院"})
|
||||||
|
public class TblHospitalController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IResourceService service;
|
||||||
|
@PostMapping("/getList")
|
||||||
|
@ApiOperation(value = "获取医院列表", notes = "")
|
||||||
|
@AutoLog(value = "获取医院列表", operationType = OperationTypeEnum.SELECT, module = "基础数据/医院")
|
||||||
|
public PagedResultVo<HospitalViewVo> getList(@RequestBody HospitalSearchVo vo) {
|
||||||
|
PagedResultVo<Resource> resources = this.service.listAllBuildResourceByTypeWithPage(7,vo);
|
||||||
|
PagedResultVo<HospitalViewVo> hospitalViewVoPagedResultVo = new PagedResultVo<>();
|
||||||
|
List<HospitalViewVo> hospitalViewVos = CollectionUtil.newArrayList();
|
||||||
|
|
||||||
|
resources.getData().stream().forEach(resource -> {
|
||||||
|
HospitalViewVo hospitalViewVo = new HospitalViewVo();
|
||||||
|
BeanUtil.copyProperties(resource,hospitalViewVo);
|
||||||
|
JSONObject jsonObject= (JSONObject) JSON.parse(resource.getResourceAttribut());
|
||||||
|
hospitalViewVo.setDoctorNum(jsonObject.get("doctor_num").toString());
|
||||||
|
hospitalViewVo.setHospitalBed(jsonObject.get("hospital_bed").toString());
|
||||||
|
hospitalViewVo.setNurseNum(jsonObject.get("nurse_num").toString());
|
||||||
|
|
||||||
|
// resource.getResourceAttribut()
|
||||||
|
hospitalViewVos.add(hospitalViewVo);
|
||||||
|
});
|
||||||
|
hospitalViewVoPagedResultVo.setData(hospitalViewVos);
|
||||||
|
return hospitalViewVoPagedResultVo;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,53 @@
|
||||||
|
package com.hivekion.baseData.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import com.alibaba.fastjson2.JSON;
|
||||||
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
|
import com.hivekion.baseData.domain.tblhospitalVo.HospitalSearchVo;
|
||||||
|
import com.hivekion.baseData.domain.tblhospitalVo.HospitalViewVo;
|
||||||
|
import com.hivekion.baseData.domain.tblwarehouseVo.WarehouseSearchVo;
|
||||||
|
import com.hivekion.baseData.domain.tblwarehouseVo.WarehouseViewVo;
|
||||||
|
import com.hivekion.common.annotation.AutoLog;
|
||||||
|
import com.hivekion.common.entity.PagedResultVo;
|
||||||
|
import com.hivekion.common.enums.OperationTypeEnum;
|
||||||
|
import com.hivekion.scenario.entity.Resource;
|
||||||
|
import com.hivekion.scenario.service.IResourceService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/basedata/warehouse")
|
||||||
|
|
||||||
|
@Api(value = "仓库", tags = {"装备管理-仓库"})
|
||||||
|
public class TblWareHouseController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IResourceService service;
|
||||||
|
@PostMapping("/getList")
|
||||||
|
@ApiOperation(value = "获取仓库列表", notes = "")
|
||||||
|
@AutoLog(value = "获取仓库列表", operationType = OperationTypeEnum.SELECT, module = "基础数据/仓库")
|
||||||
|
public PagedResultVo<WarehouseViewVo> getList(@RequestBody WarehouseSearchVo vo) {
|
||||||
|
PagedResultVo<Resource> resources = this.service.listAllBuildResourceByTypeWithPage(8,vo);
|
||||||
|
PagedResultVo<WarehouseViewVo> warehouseViewVoPagedResultVo = new PagedResultVo<>();
|
||||||
|
List<WarehouseViewVo> warehouseViewVos = CollectionUtil.newArrayList();
|
||||||
|
resources.getData().stream().forEach(resource -> {
|
||||||
|
WarehouseViewVo warehouseViewVo = new WarehouseViewVo();
|
||||||
|
BeanUtil.copyProperties(resource,warehouseViewVo);
|
||||||
|
JSONObject jsonObject= (JSONObject) JSON.parse(resource.getResourceAttribut());
|
||||||
|
warehouseViewVo.setMedicalNum(jsonObject.get("medical_num").toString());
|
||||||
|
warehouseViewVo.setFuelNum(jsonObject.get("fuel_num").toString());
|
||||||
|
warehouseViewVo.setAmmunitionNum(jsonObject.get("ammunition_num").toString());
|
||||||
|
warehouseViewVos.add(warehouseViewVo);
|
||||||
|
});
|
||||||
|
warehouseViewVoPagedResultVo.setData(warehouseViewVos);
|
||||||
|
return warehouseViewVoPagedResultVo;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,5 +1,6 @@
|
||||||
package com.hivekion.baseData.controller;
|
package com.hivekion.baseData.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.hivekion.baseData.domain.TblEntity;
|
import com.hivekion.baseData.domain.TblEntity;
|
||||||
import com.hivekion.baseData.entity.Fightpowerhierarchy;
|
import com.hivekion.baseData.entity.Fightpowerhierarchy;
|
||||||
import com.hivekion.baseData.service.FightpowerhierarchyService;
|
import com.hivekion.baseData.service.FightpowerhierarchyService;
|
||||||
|
@ -40,7 +41,9 @@ public class TreeController {
|
||||||
public ResponseData<List<TreeNode>> armamentTree(
|
public ResponseData<List<TreeNode>> armamentTree(
|
||||||
@ApiParam(value = "父节点ID,指定从哪个节点开始返回装备树") Integer id) {
|
@ApiParam(value = "父节点ID,指定从哪个节点开始返回装备树") Integer id) {
|
||||||
List<TreeNode> nodeList = new ArrayList<>();
|
List<TreeNode> nodeList = new ArrayList<>();
|
||||||
List<TblEntity> list = tblEntityService.list();
|
|
||||||
|
List<TblEntity> list = tblEntityService.list(new QueryWrapper<TblEntity>().notIn("ENTITYTYPE","DataModel")
|
||||||
|
.notIn("PARENTID",-3));
|
||||||
//排序
|
//排序
|
||||||
list.sort((a, b) -> {
|
list.sort((a, b) -> {
|
||||||
if (a.getDisplayIndex() == null) {
|
if (a.getDisplayIndex() == null) {
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package com.hivekion.baseData.domain;
|
package com.hivekion.baseData.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
// // import com.gitee.sunchenbin.mybatis.actable.annotation.ColumnComment;
|
// // import com.gitee.sunchenbin.mybatis.actable.annotation.ColumnComment;
|
||||||
|
@ -17,9 +19,10 @@ import org.springframework.format.annotation.DateTimeFormat;
|
||||||
@TableName(value = "tbl_entity")
|
@TableName(value = "tbl_entity")
|
||||||
public class TblEntity extends TreeEntity {
|
public class TblEntity extends TreeEntity {
|
||||||
|
|
||||||
@TableField
|
|
||||||
|
|
||||||
@CreatedBy
|
@CreatedBy
|
||||||
|
@TableId(value = "ID", type = IdType.AUTO)
|
||||||
private Integer Id;
|
private Integer Id;
|
||||||
@TableField(value="entitytype")
|
@TableField(value="entitytype")
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,8 @@ import java.util.Date;
|
||||||
@Data
|
@Data
|
||||||
public class TblEntityAddInputVo {
|
public class TblEntityAddInputVo {
|
||||||
|
|
||||||
// private Integer Id;
|
private Integer Id;
|
||||||
// private String EntityType;
|
private String entityType;
|
||||||
private String EntityName;
|
private String EntityName;
|
||||||
private Integer ParentId;
|
private Integer ParentId;
|
||||||
// private String DisplayIndex;
|
// private String DisplayIndex;
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
package com.hivekion.baseData.domain.tblhospitalVo;
|
||||||
|
|
||||||
|
import com.hivekion.common.entity.SearchInputVo;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class HospitalSearchVo extends SearchInputVo {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
package com.hivekion.baseData.domain.tblhospitalVo;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class HospitalViewVo implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
|
||||||
|
private String resourceName;
|
||||||
|
|
||||||
|
|
||||||
|
private String icon;
|
||||||
|
|
||||||
|
|
||||||
|
private String lat;
|
||||||
|
|
||||||
|
private String lng;
|
||||||
|
|
||||||
|
private String resourceAttribut;
|
||||||
|
|
||||||
|
private String doctorNum;
|
||||||
|
private String nurseNum;
|
||||||
|
private String hospitalBed;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
package com.hivekion.baseData.domain.tblwarehouseVo;
|
||||||
|
|
||||||
|
import com.hivekion.common.entity.SearchInputVo;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class WarehouseSearchVo extends SearchInputVo {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
package com.hivekion.baseData.domain.tblwarehouseVo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class WarehouseViewVo implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
|
||||||
|
private String resourceName;
|
||||||
|
|
||||||
|
|
||||||
|
private String icon;
|
||||||
|
|
||||||
|
|
||||||
|
private String lat;
|
||||||
|
|
||||||
|
private String lng;
|
||||||
|
|
||||||
|
private String resourceAttribut;
|
||||||
|
|
||||||
|
private String medicalNum;
|
||||||
|
private String fuelNum;
|
||||||
|
private String ammunitionNum;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -60,13 +60,21 @@ public class TblEntityServiceImpl extends ServiceImpl<TblEntityMapper, TblEntity
|
||||||
Long s = System.currentTimeMillis();
|
Long s = System.currentTimeMillis();
|
||||||
Date date = new Date(s);
|
Date date = new Date(s);
|
||||||
entity.setCreateTime(date);
|
entity.setCreateTime(date);
|
||||||
entity.setEntityType(getParentID(vo.getParentId()));
|
if(vo.getParentId() != -1) {
|
||||||
|
entity.setEntityType(getParentID(vo.getParentId()));
|
||||||
|
}else{
|
||||||
|
entity.setEntityType(vo.getEntityType());
|
||||||
|
}
|
||||||
if (checkNameUnique(String.valueOf(entity.getId()), entity.getEntityName(), vo.getParentId())) {
|
if (checkNameUnique(String.valueOf(entity.getId()), entity.getEntityName(), vo.getParentId())) {
|
||||||
throw new BusinessException(500, "该名称已存在");
|
throw new BusinessException(500, "该名称已存在");
|
||||||
} else {
|
} else {
|
||||||
LambdaUpdateWrapper<TblEntity> tWrapper = new LambdaUpdateWrapper<TblEntity>()
|
if(entity.getId() != null) {
|
||||||
.eq(TblEntity::getId, entity.getId());
|
LambdaUpdateWrapper<TblEntity> tWrapper = new LambdaUpdateWrapper<TblEntity>()
|
||||||
return this.saveOrUpdate(entity, tWrapper);
|
.eq(TblEntity::getId, entity.getId());
|
||||||
|
return this.saveOrUpdate(entity);
|
||||||
|
}else{
|
||||||
|
return this.save(entity);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,4 +38,6 @@ public class ResourceController {
|
||||||
return vehicleList;
|
return vehicleList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,16 @@
|
||||||
package com.hivekion.scenario.service;
|
package com.hivekion.scenario.service;
|
||||||
|
|
||||||
|
import com.hivekion.baseData.domain.tblhospitalVo.HospitalSearchVo;
|
||||||
|
import com.hivekion.baseData.domain.tblhospitalVo.HospitalViewVo;
|
||||||
|
import com.hivekion.common.entity.PagedResultVo;
|
||||||
|
import com.hivekion.common.entity.SearchInputVo;
|
||||||
import com.hivekion.scenario.entity.Resource;
|
import com.hivekion.scenario.entity.Resource;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.hivekion.scenario.entity.Vehicle;
|
import com.hivekion.scenario.entity.Vehicle;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -19,6 +24,8 @@ public interface IResourceService extends IService<Resource> {
|
||||||
|
|
||||||
public List<Resource> listAllBuildResourceByType(Integer type);
|
public List<Resource> listAllBuildResourceByType(Integer type);
|
||||||
|
|
||||||
|
public PagedResultVo<Resource> listAllBuildResourceByTypeWithPage(Integer type, SearchInputVo hospitalSearchVo);
|
||||||
|
|
||||||
public Map<Integer,Resource> listBuildResourceByType(Integer type);
|
public Map<Integer,Resource> listBuildResourceByType(Integer type);
|
||||||
|
|
||||||
public List<Vehicle> listAllVehiclesByType(Integer type,Integer resourceId);
|
public List<Vehicle> listAllVehiclesByType(Integer type,Integer resourceId);
|
||||||
|
|
|
@ -1,6 +1,19 @@
|
||||||
package com.hivekion.scenario.service.impl;
|
package com.hivekion.scenario.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.hivekion.baseData.domain.TblFuel;
|
||||||
|
import com.hivekion.baseData.domain.TblFuelVo.TblFuelViewVo;
|
||||||
|
import com.hivekion.baseData.domain.tblhospitalVo.HospitalSearchVo;
|
||||||
|
import com.hivekion.baseData.domain.tblwarehouseVo.WarehouseSearchVo;
|
||||||
|
import com.hivekion.baseData.domain.tblwarehouseVo.WarehouseViewVo;
|
||||||
|
import com.hivekion.common.entity.PagedResultVo;
|
||||||
|
import com.hivekion.common.entity.SearchInputVo;
|
||||||
import com.hivekion.scenario.entity.Resource;
|
import com.hivekion.scenario.entity.Resource;
|
||||||
import com.hivekion.scenario.entity.ResourceVehicleRela;
|
import com.hivekion.scenario.entity.ResourceVehicleRela;
|
||||||
import com.hivekion.scenario.entity.Vehicle;
|
import com.hivekion.scenario.entity.Vehicle;
|
||||||
|
@ -9,6 +22,7 @@ import com.hivekion.scenario.service.IResourceService;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.hivekion.scenario.service.IResourceVehicleRelaService;
|
import com.hivekion.scenario.service.IResourceVehicleRelaService;
|
||||||
import com.hivekion.scenario.service.IVehicleService;
|
import com.hivekion.scenario.service.IVehicleService;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
@ -44,6 +58,27 @@ public class ResourceServiceImpl extends ServiceImpl<ResourceMapper, Resource> i
|
||||||
return this.resourceMapper.selectList(queryWrapper);
|
return this.resourceMapper.selectList(queryWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PagedResultVo<Resource> listAllBuildResourceByTypeWithPage(Integer type, SearchInputVo searchInputVo) {
|
||||||
|
if(type.intValue() == 7){
|
||||||
|
HospitalSearchVo hospitalSearchVo = (HospitalSearchVo) searchInputVo;
|
||||||
|
}
|
||||||
|
if(type.intValue() ==8){
|
||||||
|
WarehouseSearchVo warehouseViewVo = (WarehouseSearchVo) searchInputVo;
|
||||||
|
}
|
||||||
|
Page<Resource> page = new Page<>(searchInputVo.getPageNum(), searchInputVo.getPageSize());
|
||||||
|
page.addOrder(new OrderItem("id", true));
|
||||||
|
LambdaQueryWrapper<Resource> lambdaQueryWrapper = Wrappers.lambdaQuery();
|
||||||
|
lambdaQueryWrapper.eq(Resource::getResourceType,type);
|
||||||
|
IPage<Resource> data = this.page(page,lambdaQueryWrapper);
|
||||||
|
Integer total = (int) data.getTotal();
|
||||||
|
PagedResultVo<Resource> result = new PagedResultVo<>(searchInputVo, total, data
|
||||||
|
.getRecords());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<Integer, Resource> listBuildResourceByType(Integer type) {
|
public Map<Integer, Resource> listBuildResourceByType(Integer type) {
|
||||||
QueryWrapper<Resource> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<Resource> queryWrapper = new QueryWrapper<>();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user