提交 65ac8293 authored 作者: zhoushaopan's avatar zhoushaopan

feat(列装模块,申请模块,装备模块): 申请模块新增查询可试用装备接口,装备新增根据列装id集合查询接口

申请模块新增查询可试用装备接口,装备新增根据列装id集合查询接口
上级 85fe0d16
......@@ -628,6 +628,33 @@ public class DeviceApplyController {
return ResponseEntity.ok("办结成功");
}
@ApiOperation(value = "查询试用的装备", notes = "查询试用的装备")
@PostMapping("/tryOutDevice")
@Transactional(rollbackFor = Exception.class)
public ResponseEntity tryOutDevice(@RequestBody SelectTryOutDeviceVo selectTryOutDeviceVo) {
List<Integer> packingIds = selectTryOutDeviceVo.getPackingIds();
Map<String,Object> map = new HashMap<>();
List<String> models = packingLibraryService.findByIds(packingIds).stream().
map(PackingLibrary::getModel).distinct().collect(Collectors.toList());
List<DeviceLibrary> deviceLibraries = deviceLibraryService.findAllByPackingIdsIn(packingIds,
selectTryOutDeviceVo.getPageable());
deviceLibraries.forEach(DeviceLibrary::setConfigName);
Map<String, List<DeviceLibrary>> modelMap = deviceLibraries.stream()
.collect(groupingBy(DeviceLibrary::getModel));
map.put("models",models);
map.put("modelMap",modelMap);
return ResponseEntity.ok(map);
}
@ApiOperation(value = "根据装备序列号查询装备", notes = "根据装备序列号查询装备")
@PostMapping("/selectBySeqNumber")
@Transactional(rollbackFor = Exception.class)
public ResponseEntity selectBySeqNumber(@RequestBody List<String> seqNumbers) {
List<DeviceLibrary> deviceLibraries = deviceLibraryService.findAllBySeqNumber(seqNumbers);
deviceLibraries.forEach(DeviceLibrary::setConfigName);
return ResponseEntity.ok(deviceLibraries);
}
/**
* 转实体
......
package com.tykj.dev.device.apply.subject.vo;
import com.tykj.dev.misc.base.CustomPage;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author zsp
*/
@Data
@ApiModel("查询已经入库的试用装备的vo")
public class SelectTryOutDeviceVo extends CustomPage {
@ApiModelProperty(value = "列装id的集合",example = "1,2,3")
private List<Integer> packingIds;
@ApiModelProperty(value = "型号", example = "bmxx")
public String model;
@ApiModelProperty(value = "类型", example = "1")
public Integer type;
@ApiModelProperty(value = "密级", example = "1")
public Integer secretLevel;
@ApiModelProperty(value = "可见范围(应用领域)", example = "1")
public Integer invisibleRange;
@ApiModelProperty(value = "名称", example = "BM-1")
public String name;
@ApiModelProperty(value = "配用范围", example = "1")
public Integer matchingRange;
}
......@@ -761,6 +761,14 @@ public class DeviceLibraryController {
deviceLogService.addLog(deviceLogDto);
deviceLibraryEntity.setRecord(libraryUpdateVo.getRecord());
}
//add 装备是否试用
if (libraryUpdateVo.getTryOutDevice()!=null && !libraryUpdateVo.getTryOutDevice().equals(deviceLibraryEntity.getTryOutDevice())){
DeviceLogDto deviceLogDto = new DeviceLogDto(deviceEditVo.getDeviceId(),
"将试用类型改为"+libraryUpdateVo.getTryOutDevice(), null,null,null);
deviceLogService.addLog(deviceLogDto);
deviceLibraryEntity.setTryOutDevice(libraryUpdateVo.getTryOutDevice());
}
deviceLibraryService.update(deviceLibraryEntity);
}
//添加绑定配件
......
package com.tykj.dev.device.library.repository;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
......@@ -166,6 +167,8 @@ public interface DeviceLibraryDao extends JpaRepository<DeviceLibrary, Integer>,
List<DeviceLibrary> findAllByPackingId(Integer packingIds);
List<DeviceLibrary> findAllByPackingIdIn(List<Integer> packingIds, Pageable pageable);
List<DeviceLibrary> findAllByPackingIdIn(List<Integer> packingIds);
......
......@@ -218,6 +218,11 @@ public interface DeviceLibraryService {
*/
List<DeviceLibrary> findAllByPackingId(Integer packingId);
/**
* 通过列装id查询所有装备
*/
List<DeviceLibrary> findAllByPackingIdsIn(List<Integer> packingIds,Pageable pageable);
/**
* 根据partParentId查询附件
* @param id 装备的id
......
......@@ -656,6 +656,11 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
return deviceLibraryDao.findAllByPackingId(packingId);
}
@Override
public List<DeviceLibrary> findAllByPackingIdsIn(List<Integer> packingIds,Pageable pageable) {
return deviceLibraryDao.findAllByPackingIdIn(packingIds,pageable);
}
@Override
public List<DeviceLibrary> findAllByPartParentId(Integer id) {
return deviceLibraryDao.findAllByPartParentId(id);
......
......@@ -51,5 +51,8 @@ public class DeviceLibraryUpdateVo {
@ApiModelProperty("备注")
private String record;
@ApiModelProperty(value = "是否是试用装备",notes = "0 是正式 1 是测试")
private Integer tryOutDevice = 0;
}
......@@ -7,6 +7,7 @@ import com.tykj.dev.device.packing.subject.vo.*;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.List;
......@@ -236,4 +237,10 @@ public interface PackingLibraryService{
*/
List<PackingLibrary> getAllSelectPacking(List<Integer> packingIds);
/**
* @param ids 列装库主键Id
* 根据ids获取列装
*/
List<PackingLibrary> findByIds(@RequestBody List<Integer> ids);
}
......@@ -1013,6 +1013,11 @@ public class PackingLibraryServiceImpl implements PackingLibraryService {
).stream().sorted(Comparator.comparing(PackingLibrary::getModel)).collect(Collectors.toList());
}
@Override
public List<PackingLibrary> findByIds(List<Integer> ids) {
return packingLibraryDao.findAllByIdIn(ids);
}
private Specification<PackingLibrary> getSelectSpecification(PackingLibrarySelectVo packingLibrarySelectVo) {
PredicateBuilder<PackingLibrary> predicateBuilder = Specifications.and();
Integer level = userUtils.getCurrentUnitLevel();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论