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

feat(列装模块,配套设备模块,便签管理): 未打印标签查询,列装绑定,关联设备

未打印标签查询,列装绑定,关联设备
上级 75cb624c
...@@ -238,7 +238,7 @@ public class DeviceLibraryController { ...@@ -238,7 +238,7 @@ public class DeviceLibraryController {
Boolean hasUpdateTimeDim = deviceLibrarySelectVo.getUpdateTimeDim()!=null; Boolean hasUpdateTimeDim = deviceLibrarySelectVo.getUpdateTimeDim()!=null;
Boolean hasRfidCardDim = deviceLibrarySelectVo.getRfidCardDim()!=null; Boolean hasRfidCardDim = deviceLibrarySelectVo.getRfidCardDim()!=null;
//库存位置 //库存位置
Boolean hasStorageLocationDim = deviceLibrarySelectVo.getRfidCardDim()!=null; Boolean hasStorageLocationDim = deviceLibrarySelectVo.getLocationUnitDim()!=null;
//形态 //形态
// Boolean hasTypeDim = deviceLibrarySelectVo.getTypeDim()!=null; // Boolean hasTypeDim = deviceLibrarySelectVo.getTypeDim()!=null;
SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss" ); SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss" );
...@@ -968,20 +968,6 @@ public class DeviceLibraryController { ...@@ -968,20 +968,6 @@ public class DeviceLibraryController {
return deviceLibraries; return deviceLibraries;
} }
// @ApiOperation(value = "解除装备绑定", notes = "解除装备绑定")
// @GetMapping("/relieveDevice/{deviceId}")
// public ResponseEntity relieveDevice(@PathVariable("deviceId") Integer deviceId){
// deviceLibraryService.relieveDevice(deviceId);
// return ResponseEntity.ok("解除成功");
// }
// @ApiOperation(value = "进行装备绑定", notes = "进行装备绑定")
// @PostMapping("/bindingDevice")
// public ResponseEntity bindingDevice(BindingDeviceVo bindingDeviceVo){
// deviceLibraryService.bindingDevice(bindingDeviceVo);
// return ResponseEntity.ok("绑定成功");
// }
@ApiOperation(value = "进行装备绑定", notes = "进行装备绑定") @ApiOperation(value = "进行装备绑定", notes = "进行装备绑定")
@PostMapping("/boundDevice") @PostMapping("/boundDevice")
public ResponseEntity boundDevice(@RequestBody BindingDeviceVo bindingDeviceVo){ public ResponseEntity boundDevice(@RequestBody BindingDeviceVo bindingDeviceVo){
...@@ -1014,11 +1000,18 @@ public class DeviceLibraryController { ...@@ -1014,11 +1000,18 @@ public class DeviceLibraryController {
// Boolean hasTypeDim = deviceLibrarySelectVo.getTypeDim()!=null; // Boolean hasTypeDim = deviceLibrarySelectVo.getTypeDim()!=null;
SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss" ); SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss" );
List<DeviceLibrary> resultList = deviceLibraryService.getCoreDevicePage(deviceLibrarySelectVo); List<DeviceLibrary> resultList = deviceLibraryService.getCoreDevicePage(deviceLibrarySelectVo);
resultList = resultList.stream().filter(deviceLibrary -> deviceLibrary.getIsPart() == 1).collect(Collectors.toList()); // resultList = resultList.stream().filter(deviceLibrary -> deviceLibrary.getIsPart() == 1).collect(Collectors.toList());
//根据装备id查询附件 然后过滤 //根据装备id查询附件 然后过滤 0 装备 1 附件
List<DeviceLibrary> allByPartParentId = deviceLibraryService.findAllByPartParentId(deviceLibrarySelectVo.getDeviceId()); if (deviceLibrarySelectVo.getIsPart() == 0){
List<Integer> ids = allByPartParentId.stream().map(DeviceLibrary::getId).collect(Collectors.toList()); resultList = resultList.stream().filter(deviceLibrary -> !deviceLibrary.getId().equals(deviceLibrarySelectVo.getDeviceId()))
resultList = resultList.stream().filter(deviceLibrary -> !ids.contains(deviceLibrary.getId())).collect(Collectors.toList()); .collect(Collectors.toList());
}
if (deviceLibrarySelectVo.getIsPart() == 1){
List<DeviceLibrary> allByPartParentId = deviceLibraryService.findAllByPartParentId(deviceLibrarySelectVo.getDeviceId());
List<Integer> ids = allByPartParentId.stream().map(DeviceLibrary::getId).collect(Collectors.toList());
resultList = resultList.stream().filter(deviceLibrary -> !ids.contains(deviceLibrary.getId())).collect(Collectors.toList());
}
if (hasModelDim||hasLifeStatusDim||hasLocationUnitDim||hasNameDim||hasOwnUnitDim||hasSeqDim) { if (hasModelDim||hasLifeStatusDim||hasLocationUnitDim||hasNameDim||hasOwnUnitDim||hasSeqDim) {
resultList = resultList.stream().filter(deviceLibrary -> { resultList = resultList.stream().filter(deviceLibrary -> {
Boolean containModelDim = !hasModelDim||deviceLibrary.getModel().contains(deviceLibrarySelectVo.getModelDim()); Boolean containModelDim = !hasModelDim||deviceLibrary.getModel().contains(deviceLibrarySelectVo.getModelDim());
......
package com.tykj.dev.device.matching.service; package com.tykj.dev.device.matching.service;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.device.library.subject.vo.DeviceLibrarySelectVo;
import com.tykj.dev.device.matching.subject.domin.MatchingDeviceLibrary; 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.MatchingDeviceSelectVo;
import com.tykj.dev.device.matching.subject.vo.RelationDeviceVo;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
...@@ -43,6 +46,11 @@ public interface MatchingDeviceLibraryService { ...@@ -43,6 +46,11 @@ public interface MatchingDeviceLibraryService {
*/ */
Page<MatchingDeviceLibrary> getPage(MatchingDeviceSelectVo matchingDeviceSelectVo, Pageable pageable); Page<MatchingDeviceLibrary> getPage(MatchingDeviceSelectVo matchingDeviceSelectVo, Pageable pageable);
/**
* @param matchingDeviceSelectVo 装备查询vo
*/
List<MatchingDeviceLibrary> getMatchingDevicePage(MatchingDeviceSelectVo matchingDeviceSelectVo);
/** /**
* @return 所有类型 * @return 所有类型
*/ */
...@@ -60,4 +68,10 @@ public interface MatchingDeviceLibraryService { ...@@ -60,4 +68,10 @@ public interface MatchingDeviceLibraryService {
* @return 返回值是序列号列表 * @return 返回值是序列号列表
*/ */
List<String> findByModelForSeqNumber(String model); List<String> findByModelForSeqNumber(String model);
/**
* 关联装备
* @param relationDeviceVo 关联装备的vo
*/
void relationDevice(RelationDeviceVo relationDeviceVo);
} }
...@@ -9,6 +9,7 @@ import com.tykj.dev.device.matching.repository.MatchingDeviceLibraryDao; ...@@ -9,6 +9,7 @@ import com.tykj.dev.device.matching.repository.MatchingDeviceLibraryDao;
import com.tykj.dev.device.matching.service.MatchingDeviceLibraryService; import com.tykj.dev.device.matching.service.MatchingDeviceLibraryService;
import com.tykj.dev.device.matching.subject.domin.MatchingDeviceLibrary; 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.MatchingDeviceSelectVo;
import com.tykj.dev.device.matching.subject.vo.RelationDeviceVo;
import com.tykj.dev.device.user.subject.service.UserPublicService; import com.tykj.dev.device.user.subject.service.UserPublicService;
import com.tykj.dev.device.user.util.UserUtils; import com.tykj.dev.device.user.util.UserUtils;
import com.tykj.dev.misc.exception.ApiException; import com.tykj.dev.misc.exception.ApiException;
...@@ -120,14 +121,19 @@ public class MatchingDeviceLibraryServiceImpl implements MatchingDeviceLibrarySe ...@@ -120,14 +121,19 @@ public class MatchingDeviceLibraryServiceImpl implements MatchingDeviceLibrarySe
List<String> units = userPublicService.findAllUnitNameByAreaId(selectAreaId); List<String> units = userPublicService.findAllUnitNameByAreaId(selectAreaId);
//如果是市或县,筛选出创建单位在units中的设备 //如果是市或县,筛选出创建单位在units中的设备
if (selectLevel == 3 || selectLevel == 2) { if (selectLevel == 3 || selectLevel == 2) {
List<MatchingDeviceLibrary> resultList = matchingDeviceLibraryDao.findAll().stream() List<MatchingDeviceLibrary> resultList = matchingDeviceLibraryDao.findAll(getPredicate(matchingDeviceSelectVo).build())
.stream()
.filter(matchingDeviceLibraryEntity -> units.contains(matchingDeviceLibraryEntity.getCreateUnit())) .filter(matchingDeviceLibraryEntity -> units.contains(matchingDeviceLibraryEntity.getCreateUnit()))
.collect(Collectors.toList()); .collect(Collectors.toList());
// List<MatchingDeviceLibrary> resultList = matchingDeviceLibraryDao.findAll().stream()
// .filter(matchingDeviceLibraryEntity -> units.contains(matchingDeviceLibraryEntity.getCreateUnit()))
// .collect(Collectors.toList());
return PageUtil.getPerPage(matchingDeviceSelectVo.getPage(), matchingDeviceSelectVo.getSize(), resultList, pageable); return PageUtil.getPerPage(matchingDeviceSelectVo.getPage(), matchingDeviceSelectVo.getSize(), resultList, pageable);
} }
//如果是省,直接返回全部设备 //如果是省,直接返回全部设备
if (selectLevel == 1) { if (selectLevel == 1) {
List<MatchingDeviceLibrary> resultList = matchingDeviceLibraryDao.findAll(); // List<MatchingDeviceLibrary> resultList = matchingDeviceLibraryDao.findAll();
List<MatchingDeviceLibrary> resultList = matchingDeviceLibraryDao.findAll(getPredicate(matchingDeviceSelectVo).build());
return PageUtil.getPerPage(matchingDeviceSelectVo.getPage(), matchingDeviceSelectVo.getSize(), resultList, pageable); return PageUtil.getPerPage(matchingDeviceSelectVo.getPage(), matchingDeviceSelectVo.getSize(), resultList, pageable);
} else { } else {
throw new ApiException(ResultUtil.failed("单位等级只能为1,2,3")); throw new ApiException(ResultUtil.failed("单位等级只能为1,2,3"));
...@@ -135,6 +141,52 @@ public class MatchingDeviceLibraryServiceImpl implements MatchingDeviceLibrarySe ...@@ -135,6 +141,52 @@ public class MatchingDeviceLibraryServiceImpl implements MatchingDeviceLibrarySe
} }
} }
@Override
public List<MatchingDeviceLibrary> getMatchingDevicePage(MatchingDeviceSelectVo matchingDeviceSelectVo) {
PredicateBuilder<MatchingDeviceLibrary> predicateBuilder = getPredicate(matchingDeviceSelectVo);
Integer selectUnitId = matchingDeviceSelectVo.getUnitId();
Integer selectAreaId = matchingDeviceSelectVo.getAreaId();
if (selectAreaId == null) {
//如果areaId和unitId都传Null,返回当前单位的配套设备
if (selectUnitId == null) {
// predicateBuilder.eq("createUnit", userUtils.getCurrentUserUnitName());
return matchingDeviceLibraryDao.findAll(predicateBuilder.build());
}
//如果areaId为Null,unitId不为null,返回对应单位的配套设备
else {
String unitName = userPublicService.findByUnitsToname(selectUnitId);
predicateBuilder.eq("createUnit", unitName);
return matchingDeviceLibraryDao.findAll(predicateBuilder.build());
}
}
//areaId不为null,返回该区域下所有单位的配套设备
else {
//获取区域等级
Integer selectLevel = userPublicService.getArea(selectAreaId).getType();
//获取区域下所有单位名称
List<String> units = userPublicService.findAllUnitNameByAreaId(selectAreaId);
//如果是市或县,筛选出创建单位在units中的设备
if (selectLevel == 3 || selectLevel == 2) {
List<MatchingDeviceLibrary> resultList = matchingDeviceLibraryDao.findAll(getPredicate(matchingDeviceSelectVo).build())
.stream()
.filter(matchingDeviceLibraryEntity -> units.contains(matchingDeviceLibraryEntity.getCreateUnit()))
.collect(Collectors.toList());
// List<MatchingDeviceLibrary> resultList = matchingDeviceLibraryDao.findAll().stream()
// .filter(matchingDeviceLibraryEntity -> units.contains(matchingDeviceLibraryEntity.getCreateUnit()))
// .collect(Collectors.toList());
return resultList;
}
//如果是省,直接返回全部设备
if (selectLevel == 1) {
// List<MatchingDeviceLibrary> resultList = matchingDeviceLibraryDao.findAll();
List<MatchingDeviceLibrary> resultList = matchingDeviceLibraryDao.findAll(getPredicate(matchingDeviceSelectVo).build());
return resultList;
} else {
throw new ApiException(ResultUtil.failed("单位等级只能为1,2,3"));
}
}
}
/** /**
* @return 所有类型 * @return 所有类型
*/ */
...@@ -165,6 +217,14 @@ public class MatchingDeviceLibraryServiceImpl implements MatchingDeviceLibrarySe ...@@ -165,6 +217,14 @@ public class MatchingDeviceLibraryServiceImpl implements MatchingDeviceLibrarySe
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
@Override
public void relationDevice(RelationDeviceVo relationDeviceVo) {
Integer matchingDeviceId = relationDeviceVo.getMatchingDeviceId();
MatchingDeviceLibrary matchingDeviceLibrary = getOne(matchingDeviceId);
matchingDeviceLibrary.setDeviceId(relationDeviceVo.getDeviceId());
update(matchingDeviceLibrary);
}
/** /**
* @param matchingDeviceSelectVo 配套设备查询vo * @param matchingDeviceSelectVo 配套设备查询vo
* 创建通用查询条件筛选器 * 创建通用查询条件筛选器
...@@ -205,6 +265,15 @@ public class MatchingDeviceLibraryServiceImpl implements MatchingDeviceLibrarySe ...@@ -205,6 +265,15 @@ public class MatchingDeviceLibraryServiceImpl implements MatchingDeviceLibrarySe
if (matchingDeviceSelectVo.getTypeDim()!=null){ if (matchingDeviceSelectVo.getTypeDim()!=null){
predicateBuilder.like("type","%" +matchingDeviceSelectVo.getTypeDim()+"%"); predicateBuilder.like("type","%" +matchingDeviceSelectVo.getTypeDim()+"%");
} }
if (matchingDeviceSelectVo.getIsPrint()!=null){
if (matchingDeviceSelectVo.getIsPrint()==1){
predicateBuilder.notIn("rfidCardId", "");
}
else if (matchingDeviceSelectVo.getIsPrint()==0){
predicateBuilder.in("rfidCardId", "");
}
}
return predicateBuilder; return predicateBuilder;
} }
} }
...@@ -46,7 +46,7 @@ public class MatchingDeviceSaveVo { ...@@ -46,7 +46,7 @@ public class MatchingDeviceSaveVo {
// @NotNull(message = "rfidCardId不能为空") // @NotNull(message = "rfidCardId不能为空")
@ApiModelProperty(value = "rfid卡号") @ApiModelProperty(value = "rfid卡号")
private String rfidCardId; private String rfidCardId = "";
@ApiModelProperty(value = "入库的数量") @ApiModelProperty(value = "入库的数量")
private Integer storageCount; private Integer storageCount;
......
...@@ -30,6 +30,9 @@ public class MatchingDeviceSelectVo extends CustomPage { ...@@ -30,6 +30,9 @@ public class MatchingDeviceSelectVo extends CustomPage {
@ApiModelProperty(value = "区域id") @ApiModelProperty(value = "区域id")
private Integer areaId; private Integer areaId;
@ApiModelProperty(value = "查询是否打印标签(有没有表面号)装备")
private Integer isPrint;
private String typeDim; private String typeDim;
private String modelDim; private String modelDim;
......
package com.tykj.dev.device.matching.subject.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author zsp
*/
@Data
@ApiModel("关联装备的vo")
public class RelationDeviceVo {
@ApiModelProperty(name = "关联装备的id")
private Integer deviceId;
@ApiModelProperty(name = "配套设备的id")
private Integer matchingDeviceId;
}
...@@ -963,21 +963,27 @@ public class PackingController { ...@@ -963,21 +963,27 @@ public class PackingController {
List<PackingLibrary> resultList = packingLibraryService.getAllSelectPacking(selectPackingVo.getPackingIds()); List<PackingLibrary> resultList = packingLibraryService.getAllSelectPacking(selectPackingVo.getPackingIds());
//进行过滤 退装的目录下面 回收站 //进行过滤 退装的目录下面 回收站
List<Integer> statuses = new ArrayList<>(Arrays.asList(3, 4)); // List<Integer> statuses = new ArrayList<>(Arrays.asList(3, 4));
//先过滤出child为空的 //先过滤出child为空的
List<PackingLibrary> childs = resultList.stream().filter(packingLibrary -> packingLibrary.getChilds() == null || packingLibrary.getChilds().size() == 0).collect(Collectors.toList()); List<PackingLibrary> childs = resultList.stream()
.filter(packingLibrary -> (packingLibrary.getChilds() == null || packingLibrary.getChilds().size() == 0)
&& packingLibrary.getIsRoot() == 1 )
.collect(Collectors.toList());
//取出不为空的 //取出不为空的
resultList.removeAll(childs); List<Integer> ids = childs.stream().map(PackingLibrary::getId).collect(Collectors.toList());
childs.forEach(packingLibrary -> { // resultList.removeAll(childs);
List<PackingLibrary> in = packingLibraryDao.findAllByPartParentIdAndPackingStatusIn( resultList = resultList.stream().filter(packingLibrary -> !ids.contains(packingLibrary.getId())).collect(Collectors.toList());
packingLibrary.getId(), statuses);
if (in == null || in.size() == 0) { // childs.forEach(packingLibrary -> {
resultList.add(packingLibrary); // List<PackingLibrary> in = packingLibraryDao.findAllByPartParentIdAndPackingStatusIn(
} // packingLibrary.getId(), statuses);
}); // if (in == null || in.size() == 0) {
List<PackingLibrary> packingLibraries = resultList.stream().filter(packingLibrary -> packingLibrary.getIsRoot() == 0).collect(Collectors.toList()); // resultList.add(packingLibrary);
// }
// });
// List<PackingLibrary> packingLibraries = resultList.stream().filter(packingLibrary -> packingLibrary.getIsRoot() == 0).collect(Collectors.toList());
Page<PackingLibrary> perPage = PageUtil.getPerPage(selectPackingVo.getPage(), Page<PackingLibrary> perPage = PageUtil.getPerPage(selectPackingVo.getPage(),
selectPackingVo.getSize(), packingLibraries, selectPackingVo.getPageable()); selectPackingVo.getSize(), resultList, selectPackingVo.getPageable());
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("page",perPage); map.put("page",perPage);
return ResponseEntity.ok(map); return ResponseEntity.ok(map);
......
...@@ -949,12 +949,17 @@ public class PackingLibraryServiceImpl implements PackingLibraryService { ...@@ -949,12 +949,17 @@ public class PackingLibraryServiceImpl implements PackingLibraryService {
PackingLibrary originPacking = bindingPackingVo.getOriginPacking(); PackingLibrary originPacking = bindingPackingVo.getOriginPacking();
//选择要绑定的列装 //选择要绑定的列装
PackingLibrary selectPacking = bindingPackingVo.getSelectPacking(); PackingLibrary selectPacking = bindingPackingVo.getSelectPacking();
//0 是装备目录 1 附件目录
if (originPacking.getIsPart() == 0){ if (originPacking.getIsPart() == 0){
//列装是装备 //如果是装备目录 则只可以绑在列装目录下
// 要考虑要绑定的列装的是不是装备 if (selectPacking.getIsPart()!=null){
//如果是附件 不允许绑定 if(selectPacking.getIsPart() == 1){
if(selectPacking.getIsPart() == 1){ throw new ApiException("附件下不可以绑定装备");
throw new ApiException("附件下不可以绑定列装"); }
}
// 1 是列装目录 0不是
if (selectPacking.getIsRoot() == 0){
throw new ApiException("装备只能绑定在列装目录下面");
} }
} }
originPacking.setPartParentId(selectPacking.getId()); originPacking.setPartParentId(selectPacking.getId());
...@@ -983,8 +988,9 @@ public class PackingLibraryServiceImpl implements PackingLibraryService { ...@@ -983,8 +988,9 @@ public class PackingLibraryServiceImpl implements PackingLibraryService {
packingLibraryDao.findAll(getSelectSpecification22(new PackingLibrarySelectVo())); packingLibraryDao.findAll(getSelectSpecification22(new PackingLibrarySelectVo()));
packingLibraryEntities.forEach(PackingLibrary::setConfigName); packingLibraryEntities.forEach(PackingLibrary::setConfigName);
//查询列装 //查询列装
List<PackingLibrary> libraries = packingLibraryDao.findAllByIdIn(packingIds); // List<PackingLibrary> libraries = packingLibraryDao.findAllByIdIn(packingIds);
packingLibraryEntities.removeAll(libraries); packingLibraryEntities = packingLibraryEntities.stream().filter(packingLibrary -> !packingIds.contains(packingLibrary.getId())).collect(Collectors.toList());
// packingLibraryEntities.removeAll(libraries);
Map<Integer, PackingLibrary> nodeCollect = Map<Integer, PackingLibrary> nodeCollect =
packingLibraryEntities.stream().collect(Collectors.toMap(PackingLibrary::getId, packingLibraryEntity -> packingLibraryEntity)); packingLibraryEntities.stream().collect(Collectors.toMap(PackingLibrary::getId, packingLibraryEntity -> packingLibraryEntity));
return GetTreeUtils.parseTreeFromDown( return GetTreeUtils.parseTreeFromDown(
...@@ -1247,4 +1253,16 @@ public class PackingLibraryServiceImpl implements PackingLibraryService { ...@@ -1247,4 +1253,16 @@ public class PackingLibraryServiceImpl implements PackingLibraryService {
return packingLibraries; return packingLibraries;
} }
//递归取出最大目录
public PackingLibrary getPackingLibrary(PackingLibrary packingLibrary) {
Integer partParentId = packingLibrary.getPartParentId();
PackingLibrary one = getOne(partParentId);
if (one.getIsRoot() == 0) {
return getPackingLibrary(one);
} else {
return packingLibrary;
}
}
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论