提交 d59a4300 authored 作者: zhoushaopan's avatar zhoushaopan

[装备controller]新增形态

上级 27df49ec
......@@ -783,16 +783,16 @@ public class JavaToPdfHtmlFreeMarker {
List<String> stringList = check.getStrings().stream().sorted(Comparator.comparing(String::toString)).collect(Collectors.toList());
int max = toMaxList(check.getStrings()) + 1;
if (i + max == 34) {
if (i + max == 30) {
check.setSeqStirng(toALLSeqStirng(stringList));
check.setOneCount(max - 1);
checkList2.add(check);
lists.add(checkList2);
checkList2 = new ArrayList<>();
i = 0;
} else if (i + max > 34) {
} else if (i + max > 30) {
//当前页面少了多少行
int differ = 34 - i;
int differ = 30 - i;
check.setSeqStirng(toALLSeqStirng(stringList.subList(0, (differ-1) * 7)));
check.setOneCount(differ - 1);
checkList2.add(check);
......@@ -801,25 +801,25 @@ public class JavaToPdfHtmlFreeMarker {
List<String> strings = stringList.subList((differ-1) * 7, stringList.size());
Integer max2 = toMaxList(strings);
int count = (max2 % 34 > 0) ? max2 / 34 + 1 : max2 / 34;
int count = (max2 % 30 > 0) ? max2 / 30 + 1 : max2 / 30;
if (count != 1) {
int o = 1;
while (o <= count - 1) {
Check check1 = new Check();
check1.setSeqStirng(toALLSeqStirng(strings.subList((o - 1) * 7 * 34, o * 7 * 34)));
check1.setOneCount(34);
check1.setSeqStirng(toALLSeqStirng(strings.subList((o - 1) * 7 * 30, o * 7 * 30)));
check1.setOneCount(30);
checkList2.add(check1);
lists.add(checkList2);
checkList2 = new ArrayList<>();
o++;
}
List<String> endList = strings.subList((count - 1) * 7 * 34, strings.size());
List<String> endList = strings.subList((count - 1) * 7 * 30, strings.size());
Integer max4 = toMaxList(endList);
int count1 = (max4 % 34 > 0) ? max4 / 34 + 1 : max4 / 34;
if (count1 == 34) {
int count1 = (max4 % 30 > 0) ? max4 / 30 + 1 : max4 / 30;
if (count1 == 30) {
Check check1 = new Check();
check1.setSeqStirng(toALLSeqStirng(endList));
check1.setOneCount(34);
check1.setOneCount(30);
checkList2.add(check1);
lists.add(checkList2);
checkList2 = new ArrayList<>();
......@@ -1771,16 +1771,16 @@ public class JavaToPdfHtmlFreeMarker {
List<String> stringList = check.getStrings().stream().sorted(Comparator.comparing(String::toString)).collect(Collectors.toList());
int max = toMaxList(check.getStrings()) + 1;
if (i + max == 34) {
if (i + max == 30) {
check.setSeqStirng(toALLSeqStirng(stringList));
check.setOneCount(max - 1);
checkList2.add(check);
lists.add(checkList2);
checkList2 = new ArrayList<>();
i = 0;
} else if (i + max > 34) {
} else if (i + max > 30) {
//当前页面少了多少行
int differ = 34 - i;
int differ = 30 - i;
check.setSeqStirng(toALLSeqStirng(stringList.subList(0, (differ-1) * 7)));
check.setOneCount(differ - 1);
checkList2.add(check);
......@@ -1789,25 +1789,25 @@ public class JavaToPdfHtmlFreeMarker {
List<String> strings = stringList.subList((differ-1) * 7, stringList.size());
Integer max2 = toMaxList(strings);
int count = (max2 % 34 > 0) ? max2 / 34 + 1 : max2 / 34;
int count = (max2 % 30 > 0) ? max2 / 30 + 1 : max2 / 30;
if (count != 1) {
int o = 1;
while (o <= count - 1) {
ExportDevice check1 = new ExportDevice();
check1.setSeqStirng(toALLSeqStirng(strings.subList((o - 1) * 7 * 34, o * 7 * 34)));
check1.setOneCount(34);
check1.setSeqStirng(toALLSeqStirng(strings.subList((o - 1) * 7 * 30, o * 7 * 30)));
check1.setOneCount(30);
checkList2.add(check1);
lists.add(checkList2);
checkList2 = new ArrayList<>();
o++;
}
List<String> endList = strings.subList((count - 1) * 7 * 34, strings.size());
List<String> endList = strings.subList((count - 1) * 7 * 30, strings.size());
Integer max4 = toMaxList(endList);
int count1 = (max4 % 34 > 0) ? max4 / 34 + 1 : max4 / 34;
if (count1 == 34) {
int count1 = (max4 % 30 > 0) ? max4 / 30 + 1 : max4 / 30;
if (count1 == 30) {
ExportDevice check1 = new ExportDevice();
check1.setSeqStirng(toALLSeqStirng(endList));
check1.setOneCount(34);
check1.setOneCount(30);
checkList2.add(check1);
lists.add(checkList2);
checkList2 = new ArrayList<>();
......
......@@ -206,6 +206,9 @@ public class DeviceLibraryController {
Boolean hasRfidCardDim = deviceLibrarySelectVo.getRfidCardDim()!=null;
//库存位置
Boolean hasStorageLocationDim = deviceLibrarySelectVo.getRfidCardDim()!=null;
//形态
// Boolean hasTypeDim = deviceLibrarySelectVo.getTypeDim()!=null;
SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss" );
List<DeviceLibrary> resultList = deviceLibraryService.getCoreDevicePage(deviceLibrarySelectVo);
if (hasModelDim||hasLifeStatusDim||hasLocationUnitDim||hasNameDim||hasOwnUnitDim||hasSeqDim) {
......@@ -219,6 +222,8 @@ public class DeviceLibraryController {
Boolean containUpdateTimeDim = !hasUpdateTimeDim||sdf.format(deviceLibrary.getUpdateTime()).contains(deviceLibrarySelectVo.getUpdateTimeDim());
Boolean containRfidCardDim = !hasRfidCardDim||(deviceLibrary.getRfidCardId()!=null&&deviceLibrary.getRfidCardId().contains(deviceLibrarySelectVo.getRfidCardDim()));
Boolean containStorageLocationDim = !hasStorageLocationDim||deviceLibrary.getStorageLocation().contains(deviceLibrarySelectVo.getStorageLocationDim());
// Boolean containTypeDim = !hasTypeDim||deviceLibrary.getType().contains(deviceLibrarySelectVo.getTypeDim());
return containModelDim&&containNameDim&&containSeqDim&&containLocationUnitDim&&containOwnUnitDim&&containLifeStatusDim&&containUpdateTimeDim&&containRfidCardDim&&containStorageLocationDim;
}).collect(Collectors.toList());
}
......@@ -226,6 +231,9 @@ public class DeviceLibraryController {
Page<DeviceLibrary> deviceLibraryEntities = PageUtil.getPerPage(deviceLibrarySelectVo.getPage(), deviceLibrarySelectVo.getSize(), resultList, deviceLibrarySelectVo.getPageable());
Map<String,Object> map = new HashMap<>();
Map<Integer,String> lifeStatusMap = configCache.getLifeStatusMap();
//
Map<Integer, String> styleMap = configCache.getStyleMap();
Set<Integer> status = new HashSet<>();
// Set<String> models = new HashSet<>();
List<String> models = new ArrayList<>();
......@@ -236,6 +244,8 @@ public class DeviceLibraryController {
List<String> locationUnits = new ArrayList<>();
// Set<String> locationUnits = new HashSet<>();
Set<String> storageLocation = new HashSet<>();
//形态
List<Integer> types = new ArrayList<>();
resultList.forEach(deviceVo -> {
deviceVo.setConfigName();
status.add(deviceVo.getLifeStatus());
......@@ -244,6 +254,7 @@ public class DeviceLibraryController {
ownUnits.add(deviceVo.getOwnUnit());
locationUnits.add(deviceVo.getLocationUnit());
storageLocation.add(deviceVo.getStorageLocation());
types.add(deviceVo.getType());
});
map.put("pages",deviceLibraryEntities);
......@@ -262,7 +273,9 @@ public class DeviceLibraryController {
map.put("locationUnits",finalLocationUnits);
map.put("lifeStatus",status.stream().map(integer -> new LifeStatusVo(integer,lifeStatusMap.get(integer))).collect(Collectors.toList()));
map.put("storageLocation",storageLocation);
// System.out.println("222");
//形态
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);
}
......@@ -277,6 +290,9 @@ public class DeviceLibraryController {
Boolean hasLifeStatusDim = deviceLibrarySelectVo.getLifeStatusDim()!=null;
//添加存储位置的查询
Boolean hasStorageLocationDim = deviceLibrarySelectVo.getStorageLocationDim() != null;
//添加装备形态的查询
Boolean hasTypeDim = deviceLibrarySelectVo.getTypeDim() != null;
Map<String,Object> map = new HashMap<>();
List<DeviceLibrary> resultList = deviceLibraryService.getList(deviceLibrarySelectVo);
......@@ -290,7 +306,7 @@ public class DeviceLibraryController {
Boolean containOwnUnitDim = !hasOwnUnitDim||deviceLibrary.getOwnUnit().contains(deviceLibrarySelectVo.getOwnUnitDim());
Boolean containLifeStatusDim = !hasLifeStatusDim||deviceLibrary.getLifeStatusName().contains(deviceLibrarySelectVo.getLifeStatusDim());
Boolean containStorageLocationDim = !hasStorageLocationDim||deviceLibrary.getStorageLocation().contains(deviceLibrarySelectVo.getStorageLocationDim());
// Boolean containTypeDim = !hasTypeDim||deviceLibrary.getStorageLocation().contains(deviceLibrarySelectVo.getTypeDim());
return containModelDim&&containNameDim&&containSeqDim&&containLocationUnitDim&&containOwnUnitDim&&containLifeStatusDim&&containStorageLocationDim;
}).collect(Collectors.toList());
}
......@@ -333,6 +349,9 @@ public class DeviceLibraryController {
);
Map<Integer,String> lifeStatusMap = configCache.getLifeStatusMap();
Map<Integer,String> matchingRangeMap = configCache.getMatchingRangeMap();
//形态
Map<Integer, String> styleMap = configCache.getStyleMap();
Set<Integer> status = new HashSet<>();
// Set<String> models = new HashSet<>();
List<String> models = new ArrayList<>();
......@@ -343,8 +362,9 @@ public class DeviceLibraryController {
// Set<String> ownUnits = new HashSet<>();
List<String> locationUnits = new ArrayList<>();
// Set<String> locationUnits = new HashSet<>();
Set<Integer> matchingRanges = new HashSet<>();
//添加装备形态
Set<Integer> types = new HashSet<>();
resultList.forEach(deviceVo -> {
deviceVo.setConfigName();
status.add(deviceVo.getLifeStatus());
......@@ -353,6 +373,8 @@ public class DeviceLibraryController {
ownUnits.add(deviceVo.getOwnUnit());
locationUnits.add(deviceVo.getLocationUnit());
matchingRanges.add(deviceVo.getMatchingRange());
//添加形态
types.add(deviceVo.getType());
});
List<String> finalModels = models.stream().distinct().collect(Collectors.toList());
List<String> modelToSort = DeviceModelSort.modelToSort(finalModels);
......@@ -367,6 +389,7 @@ public class DeviceLibraryController {
map.put("matchingRanges",matchingRanges.stream().map(integer -> new LifeStatusVo(integer,matchingRangeMap.get(integer))).collect(Collectors.toList()));
Page<DeviceLibrary> deviceLibraryEntities = PageUtil.getPerPage(deviceLibrarySelectVo.getPage(), deviceLibrarySelectVo.getSize(), containList, deviceLibrarySelectVo.getPageable());
map.put("pages",deviceLibraryEntities);
map.put("types",types.stream().map(integer -> new TypeVo(integer,styleMap.get(integer))).collect(Collectors.toList()));
return ResultUtil.success(map);
}
......@@ -435,6 +458,7 @@ public class DeviceLibraryController {
// Page<DeviceStatisticsVo> deviceStatisticsVos = PageUtil.getPerPage(deviceLibrarySelectVo.getPage(), deviceLibrarySelectVo.getSize(), deviceStatisticsVoList, deviceLibrarySelectVo.getPageable());
Page<DeviceStatisticsVo> deviceStatisticsVos = PageUtil.getPerPage(deviceLibrarySelectVo.getPage(), deviceLibrarySelectVo.getSize(), deviceStatisticsVoSorts, deviceLibrarySelectVo.getPageable());
Map<String,Object> map = new HashMap<>();
Map<Integer, String> styleMap = configCache.getStyleMap();
// Set<String> models = deviceStatisticsVoList.stream().map(DeviceStatisticsVo::getModel).collect(Collectors.toSet());
// Set<String> modelToSort = DeviceModelSort.modelToSort(models);
List<String> models = deviceStatisticsVoList.stream().map(DeviceStatisticsVo::getModel).distinct().collect(Collectors.toList());
......@@ -442,8 +466,12 @@ public class DeviceLibraryController {
map.put("pages",deviceStatisticsVos);
map.put("models",modelToSort);
//名称排序
map.put("names",deviceStatisticsVoList.stream().map(DeviceStatisticsVo::getName).distinct().sorted(Comparator.comparing(String::toString)).collect(Collectors.toList())
);
map.put("names",deviceStatisticsVoList.stream().map(DeviceStatisticsVo::getName).distinct().sorted(Comparator.comparing(String::toString)).collect(Collectors.toList()));
//形态
// map.put("typeName",deviceStatisticsVoList.stream().map(DeviceStatisticsVo::getTypeName).distinct().sorted(Comparator.comparing(String::toString)).collect(Collectors.toList()));
List<Integer> types = deviceStatisticsVoList.stream().map(DeviceStatisticsVo::getType).distinct().collect(Collectors.toList());
Collections.sort(types);
map.put("types",types.stream().map(integer -> new TypeVo(integer,styleMap.get(integer))).collect(Collectors.toList()));
return ResultUtil.success(map);
}
......
......@@ -205,19 +205,22 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
d.setModel(deviceLibrarySelectVo.getModel());
d.setName(deviceLibrarySelectVo.getName());
d.setContent(deviceLibrarySelectVo.getContent());
d.setType(deviceLibrarySelectVo.getType());
//获取所有的核心装备
List<DeviceLibrary> libraryEntities = getCoreDevicePage(d);
if (libraryEntities.size() > 0) {
Map<String, List<DeviceLibrary>> map = libraryEntities.stream().collect(groupingBy(deviceLibrary -> deviceLibrary.getModel()+"Ǵ"+deviceLibrary.getName()));
// Map<String, List<DeviceLibrary>> map = libraryEntities.stream().collect(groupingBy(deviceLibrary -> deviceLibrary.getModel()+"Ǵ"+deviceLibrary.getName()));
Map<String, List<DeviceLibrary>> map = libraryEntities.stream().collect(groupingBy(deviceLibrary -> deviceLibrary.getModel()+"Ǵ"+deviceLibrary.getName()+"Ǵ"+deviceLibrary.getType()));
//按型号遍历统计各种状态的装备数量
for (String s : map.keySet()) {
String[] strings = s.split("Ǵ");
if (strings.length == 2) {
if (strings.length == 3) {
DeviceStatisticsVo deviceStatisticsVo = new DeviceStatisticsVo();
List<Integer> deviceIds = new ArrayList<>();
List<String> devSeqs = new ArrayList<>();
deviceStatisticsVo.setModel(strings[0]);
deviceStatisticsVo.setName(strings[1]);
deviceStatisticsVo.setType(Integer.valueOf(strings[2]));
// deviceStatisticsVo.setDeviceNumber(map.get(s).size());
// deviceStatisticsVo.setDeviceIds(map.get(s).stream().map(DeviceLibrary::getId).collect(Collectors.toList()));
int num = 0;
......@@ -333,6 +336,8 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
deviceIds.removeAll(useIds);
deviceStatisticsVo.setOtherNumIds(deviceIds);
deviceStatisticsVo.setSeqs(StringSplitUtil.stringListToString(DeviceSeqUtil.getContinuousSeqs(devSeqs)));
deviceStatisticsVos.add(deviceStatisticsVo);
}
}
......@@ -794,6 +799,8 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
}
//新增库房位置
predicateBuilder.eq(deviceLibrarySelectVo.getStorageLocation() != null,"storageLocation",deviceLibrarySelectVo.getStorageLocation());
//新增装备的形态
predicateBuilder.eq(deviceLibrarySelectVo.getType() != null,"type",deviceLibrarySelectVo.getType());
}
return predicateBuilder;
}
......
......@@ -122,4 +122,10 @@ public class DeviceLibrarySelectVo extends CustomPage {
@ApiModelProperty(value = "存储位置的模糊查询字段")
private String storageLocationDim;
// @ApiModelProperty(value = "装备形态")
// private String typeName;
//
@ApiModelProperty(value = "装备形态模糊查询字段")
private String typeDim;
}
......@@ -79,4 +79,8 @@ public class DeviceStatisticsVo {
@ApiModelProperty(value = "序列号区间")
public String seqs;
@ApiModelProperty(value = "装备形态")
public Integer type;
}
package com.tykj.dev.device.library.subject.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
/**
* DATE:2021-7-27
* Author:zsp
*/
@Data
@AllArgsConstructor
@ApiModel("装备形态类")
public class TypeVo {
private Integer type;
@ApiModelProperty(value = "形态")
private String typeName;
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论