提交 230ea3eb authored 作者: zhoushaopan's avatar zhoushaopan

feat(装备模块,配套设备模块,单位模块): 修改单位替换老数据,新增存放位置id字段

修改单位替换老数据,新增存放位置id字段
上级 64c236d1
......@@ -17,6 +17,7 @@ import com.tykj.dev.device.library.subject.domin.DeviceLog;
import com.tykj.dev.device.library.subject.vo.*;
import com.tykj.dev.device.user.cache.UnitsCache;
import com.tykj.dev.device.user.subject.entity.Units;
import com.tykj.dev.device.user.subject.service.UnitStoreLocationService;
import com.tykj.dev.device.user.subject.service.UnitsService;
import com.tykj.dev.device.user.util.UserUtils;
//import com.tykj.dev.misc.base.DeviceLifeStatus;
......@@ -237,6 +238,8 @@ public class DeviceLibraryController {
return ResultUtil.success(deviceLibraryEntities);
}
@Autowired
private UnitStoreLocationService unitStoreLocationService;
@ApiOperation(value = "模糊查询核心装备分页", notes = "可以通过这个接口查询装备列表")
@PostMapping("/core/feature/summary")
public ResponseEntity selectCoreDevicePage(@RequestBody DeviceLibrarySelectVo deviceLibrarySelectVo) {
......@@ -282,7 +285,8 @@ public class DeviceLibraryController {
List<String> names = new ArrayList<>();
List<String> ownUnits = new ArrayList<>();
List<String> locationUnits = new ArrayList<>();
Set<String> storageLocation = new HashSet<>();
// Set<String> storageLocation = new HashSet<>();
List<Integer> storageLocationId = new ArrayList<>();
//形态
List<Integer> types = new ArrayList<>();
resultList.forEach(deviceVo -> {
......@@ -292,10 +296,12 @@ public class DeviceLibraryController {
names.add(deviceVo.getName());
ownUnits.add(deviceVo.getOwnUnit());
locationUnits.add(deviceVo.getLocationUnit());
storageLocation.add(deviceVo.getStorageLocation());
storageLocationId.add(deviceVo.getStorageLocationId());
types.add(deviceVo.getType());
});
});
Map<Integer, String> byStorageLocationIds = unitStoreLocationService.findByStorageLocationIds(storageLocationId
.stream().distinct().collect(Collectors.toList()));
map.put("pages",deviceLibraryEntities);
//修改 增加排序
//做一下去重
......@@ -309,14 +315,14 @@ public class DeviceLibraryController {
List<String> finalLocationUnits = DeviceModelSort.unitToSort(locationUnits);
map.put("locationUnits",finalLocationUnits.stream().distinct().collect(Collectors.toList()));
map.put("lifeStatus",status.stream().map(integer -> new LifeStatusVo(integer,lifeStatusMap.get(integer))).collect(Collectors.toList()));
map.put("storageLocation",storageLocation);
map.put("storageLocationIds",byStorageLocationIds);
//形态
List<TypeVo> typeVoList = types.stream().distinct().map(integer -> new TypeVo(integer, styleMap.get(integer))).sorted(Comparator.comparing(TypeVo::getType)).collect(Collectors.toList());
map.put("types",typeVoList);
return ResultUtil.success(map);
}
@ApiOperation(value = "查询省直属模糊查询核心装备分页", notes = "可以通过这个接口查询装备列表")
@ApiOperation(value = "查询省直属模糊查询核心装备分页", notes = "可以通过这个接口查询装备列表,省直属")
@PostMapping("/core/feature/under/summary")
public ResponseEntity selectUnderCoreDevicePage(@RequestBody DeviceLibrarySelectVo deviceLibrarySelectVo) {
......@@ -434,7 +440,7 @@ public class DeviceLibraryController {
return ResultUtil.success(map);
}
@ApiOperation(value = "模糊查询日常管理装备父子分页", notes = "可以通过这个接口查询装备列表")
@ApiOperation(value = "模糊查询日常管理装备父子分页", notes = "可以通过这个接口查询装备列表,本级")
@PostMapping("/core/feature/summary/daily")
public ResponseEntity selectDailyDevicePage(@RequestBody DeviceLibrarySelectVo deviceLibrarySelectVo){
Boolean hasModelDim = deviceLibrarySelectVo.getModelDim()!=null;
......@@ -610,7 +616,7 @@ public class DeviceLibraryController {
return ResultUtil.success(map);
}
@ApiOperation(value = "模糊查询核心装备统计分页", notes = "可以通过这个接口查询装备列表")
@ApiOperation(value = "模糊查询核心装备统计分页", notes = "可以通过这个接口查询装备列表,全省设备库")
@PostMapping("/core/stat/summary")
public ResponseEntity getDeviceStatisticsPage(@RequestBody DeviceLibrarySelectVo deviceLibrarySelectVo) {
List<DeviceStatisticsVo> deviceStatisticsVoList = deviceLibraryService.getDeviceStatisticsPage(deviceLibrarySelectVo, deviceLibrarySelectVo.getPageable(),deviceLibrarySelectVo.getPageable().getSort());
......
......@@ -160,12 +160,15 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
Integer selectLevel;
List<String> units;
if (selectAreaId==0){
//区域id为0 就是直属(原来)
selectLevel=2;
units = userPublicService.findAllUnitNameByType2();
}else {
selectLevel = userPublicService.getArea(selectAreaId).getType();
//查询该区域下的所有单位
units = userPublicService.findAllUnitNameByAreaId(selectAreaId);
// units = userPublicService.findAllUnitNameByAreaId(selectAreaId);//修改了地区
units = userPublicService.findByAreaExhibitionIdSubordinateAll(selectAreaId).stream().map(Units::getName)
.collect(Collectors.toList());
}
//市或县筛选出装备所属单位在units列表中的装备 zsp:或者所在
if (selectLevel == 3 || selectLevel == 2 || selectLevel ==4) {
......
......@@ -48,7 +48,7 @@ public class DeviceLibraryUpdateVo {
@ApiModelProperty("库存位置")
private String storageLocation;
@ApiModelProperty("库存位置id")
@ApiModelProperty("库存位置Id")
private Integer storageLocationId;
@ApiModelProperty("备注")
......
......@@ -14,6 +14,7 @@ import com.tykj.dev.device.matching.service.MatchingDeviceLibraryService;
import com.tykj.dev.device.matching.subject.domin.MatchingDeviceLibrary;
import com.tykj.dev.device.matching.subject.vo.MatchingDeviceSelectVo;
import com.tykj.dev.device.matching.subject.vo.RelationDeviceVo;
import com.tykj.dev.device.user.subject.entity.Units;
import com.tykj.dev.device.user.subject.service.UnitsService;
import com.tykj.dev.device.user.subject.service.UserPublicService;
import com.tykj.dev.device.user.util.UserUtils;
......@@ -189,7 +190,10 @@ public class MatchingDeviceLibraryServiceImpl implements MatchingDeviceLibrarySe
//获取区域等级
Integer selectLevel = userPublicService.getArea(selectAreaId).getType();
//获取区域下所有单位名称
List<String> units = userPublicService.findAllUnitNameByAreaId(selectAreaId);
// List<String> units = userPublicService.findAllUnitNameByAreaId(selectAreaId);
List<String> units = userPublicService.findByAreaExhibitionIdSubordinateAll(selectAreaId).stream()
.map(Units::getName).collect(Collectors.toList());
// List<Integer> units = userPublicService.findAllUnitIdByAreaId(selectAreaId);
//如果是市或县,筛选出创建单位在units中的设备
if (selectLevel == 3 || selectLevel == 2) {
......
......@@ -8,4 +8,6 @@ import java.util.List;
public interface UnitStoreLocationDao extends JpaRepository<UnitStoreLocation, Integer>, JpaSpecificationExecutor<UnitStoreLocation> {
List<UnitStoreLocation> findAllByUnitIdAndTypeName(Integer unitId,String typeName);
List<UnitStoreLocation> findAllByIdIn(List<Integer> ids);
}
......@@ -5,6 +5,7 @@ import com.tykj.dev.device.user.subject.entity.UnitStoreLocation;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* @author zjm
......@@ -17,4 +18,11 @@ public interface UnitStoreLocationService extends PublicService<UnitStoreLocatio
List<UnitStoreLocation> findAllByUnitIdAndTypeName(UnitStoreLocationVo unitStoreLocationVo);
Map<Integer,String> findByUnitIdToDeviceMap(Integer unitId);
/**
* 根据id查询名称
* @param ids id集合
* @return map key为id value 名称
*/
Map<Integer,String> findByStorageLocationIds(List<Integer> ids);
}
......@@ -4,6 +4,7 @@ import com.tykj.dev.device.user.base.req.UnitStoreLocationVo;
import com.tykj.dev.device.user.subject.dao.UnitStoreLocationDao;
import com.tykj.dev.device.user.subject.entity.UnitStoreLocation;
import com.tykj.dev.device.user.subject.service.UnitStoreLocationService;
import com.tykj.dev.misc.base.BaseEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -40,6 +41,12 @@ public class UnitStoreLocationServiceImpl implements UnitStoreLocationService {
.collect(Collectors.toMap(UnitStoreLocation::getId,UnitStoreLocation::getStoreName));
}
@Override
public Map<Integer, String> findByStorageLocationIds(List<Integer> ids) {
List<UnitStoreLocation> storeLocations = unitStoreLocationDao.findAllByIdIn(ids);
return storeLocations.stream().collect(Collectors.toMap(BaseEntity::getId, UnitStoreLocation::getStoreName));
}
@Override
public UnitStoreLocation save(UnitStoreLocation unitStoreLocation) {
return unitStoreLocationDao.save(unitStoreLocation);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论