提交 a76386c1 authored 作者: 133's avatar 133

[装备] 提交根据序列号查询装备的接口

上级 ed553dce
...@@ -23,6 +23,7 @@ public interface DeviceLibraryDao extends JpaRepository<DeviceLibrary, Integer>, ...@@ -23,6 +23,7 @@ public interface DeviceLibraryDao extends JpaRepository<DeviceLibrary, Integer>,
List<DeviceLibrary> getAllByTypeAndNameAndModel(Integer type, String name, String model); List<DeviceLibrary> getAllByTypeAndNameAndModel(Integer type, String name, String model);
List<DeviceLibrary> findAllBySeqNumberIn(List<String> seqNumbers);
/** /**
* 根据装备型号与装备所在地(多个地区)查询装备数量 * 根据装备型号与装备所在地(多个地区)查询装备数量
...@@ -67,6 +68,9 @@ public interface DeviceLibraryDao extends JpaRepository<DeviceLibrary, Integer>, ...@@ -67,6 +68,9 @@ public interface DeviceLibraryDao extends JpaRepository<DeviceLibrary, Integer>,
Integer countAllByPackingIdInAndOwnUnitInAndLifeStatusIn(List<Integer> packingIds,List<String> unitNames,List<Integer> lifeStatus); Integer countAllByPackingIdInAndOwnUnitInAndLifeStatusIn(List<Integer> packingIds,List<String> unitNames,List<Integer> lifeStatus);
Integer countAllBySeqNumberInAndOwnUnitInAndLifeStatusIn(List<String> seqNumbers,List<String> unitNames,List<Integer> lifeStatus);
List<DeviceLibrary> findAllByPackingIdInAndOwnUnit(List<Integer> packingIds,String unitNames); List<DeviceLibrary> findAllByPackingIdInAndOwnUnit(List<Integer> packingIds,String unitNames);
List<DeviceLibrary> findAllByPackingIdInAndOwnUnitIn(List<Integer> packingIds,List<String> unitNames); List<DeviceLibrary> findAllByPackingIdInAndOwnUnitIn(List<Integer> packingIds,List<String> unitNames);
...@@ -78,6 +82,11 @@ public interface DeviceLibraryDao extends JpaRepository<DeviceLibrary, Integer>, ...@@ -78,6 +82,11 @@ public interface DeviceLibraryDao extends JpaRepository<DeviceLibrary, Integer>,
@Query("update DeviceLibrary o set o.lifeStatus = :lifeStatus where o.id in :idList") @Query("update DeviceLibrary o set o.lifeStatus = :lifeStatus where o.id in :idList")
int upDateLeftStatus(Integer lifeStatus,@Param("idList") List<Integer> idList); int upDateLeftStatus(Integer lifeStatus,@Param("idList") List<Integer> idList);
@Transactional
@Modifying
@Query("update DeviceLibrary o set o.lifeStatus = :lifeStatus where o.seqNumber in :seqNumbers")
int upDateSeqNumbersLeftStatus(Integer lifeStatus,@Param("seqNumbers") List<String> seqNumbers);
@Transactional @Transactional
@Modifying @Modifying
@Query("update DeviceLibrary o set o.lifeStatus = :lifeStatus ,o.lockStatus=:lock where o.id in :idList") @Query("update DeviceLibrary o set o.lifeStatus = :lifeStatus ,o.lockStatus=:lock where o.id in :idList")
...@@ -88,6 +97,11 @@ public interface DeviceLibraryDao extends JpaRepository<DeviceLibrary, Integer>, ...@@ -88,6 +97,11 @@ public interface DeviceLibraryDao extends JpaRepository<DeviceLibrary, Integer>,
@Query("update DeviceLibrary o set o.lifeStatus = :lifeStatus ,o.locationUnit = :unitName,o.ownUnit = :unitName ,o.lockStatus=:lock where o.id in :idList") @Query("update DeviceLibrary o set o.lifeStatus = :lifeStatus ,o.locationUnit = :unitName,o.ownUnit = :unitName ,o.lockStatus=:lock where o.id in :idList")
int upDateLeftStatusAndUnitNameAndLockStatus(Integer lifeStatus,String unitName,Integer lock,@Param("idList") List<Integer> idList); int upDateLeftStatusAndUnitNameAndLockStatus(Integer lifeStatus,String unitName,Integer lock,@Param("idList") List<Integer> idList);
@Transactional
@Modifying
@Query("update DeviceLibrary o set o.lifeStatus = :lifeStatus ,o.locationUnit = :unitName,o.ownUnit = :unitName ,o.lockStatus=:lock where o.seqNumber in :seqNumbers")
int upDateSeqNumbersLeftStatusAndUnitNameAndLockStatus(Integer lifeStatus,String unitName,Integer lock,@Param("seqNumbers") List<String> seqNumbers);
@Transactional @Transactional
@Modifying @Modifying
@Query("update DeviceLibrary o set o.lifeStatus = :lifeStatus ,o.ownUnit = :unitName where o.id in :idList") @Query("update DeviceLibrary o set o.lifeStatus = :lifeStatus ,o.ownUnit = :unitName where o.id in :idList")
......
...@@ -152,4 +152,12 @@ public interface DeviceLibraryService { ...@@ -152,4 +152,12 @@ public interface DeviceLibraryService {
* 获取所有装备map * 获取所有装备map
*/ */
Map<Integer,DeviceLibrary> getAllDeviceMap(); Map<Integer,DeviceLibrary> getAllDeviceMap();
/**
* 根据单位 以及生命状态集合 查询设备数量
*/
Integer countAllRepel(List<Integer> fieldingIds,List<String> unitNames,List<String> seqNums,List<Integer> lifeStatusList);
List<DeviceLibrary> findAllBySeqNumber(List<String> seqNumbers);
} }
...@@ -5,6 +5,7 @@ import com.github.wenhao.jpa.Specifications; ...@@ -5,6 +5,7 @@ import com.github.wenhao.jpa.Specifications;
import com.tykj.dev.blockcha.subject.entity.BcHash; import com.tykj.dev.blockcha.subject.entity.BcHash;
import com.tykj.dev.blockcha.subject.service.BlockChainUtil; import com.tykj.dev.blockcha.subject.service.BlockChainUtil;
import com.tykj.dev.config.TaskBeanConfig; import com.tykj.dev.config.TaskBeanConfig;
import com.tykj.dev.config.base.DeviceLifeStatus;
import com.tykj.dev.device.library.repository.DeviceLibraryDao; import com.tykj.dev.device.library.repository.DeviceLibraryDao;
import com.tykj.dev.device.library.service.DeviceLibraryService; import com.tykj.dev.device.library.service.DeviceLibraryService;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary; import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
...@@ -433,7 +434,7 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService { ...@@ -433,7 +434,7 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
public void isInStockOrWaitRetired(List<Integer> ids) { public void isInStockOrWaitRetired(List<Integer> ids) {
ids.forEach(integer -> { ids.forEach(integer -> {
DeviceLibrary deviceLibrary = getOne(integer); DeviceLibrary deviceLibrary = getOne(integer);
if (deviceLibrary.getLifeStatus()!=2&&deviceLibrary.getLifeStatus()!=15){ if (deviceLibrary.getLifeStatus()!=2&&deviceLibrary.getLifeStatus()!=15&& !deviceLibrary.getLifeStatus().equals(DeviceLifeStatus.SEND_BACK.id)){
throw new ApiException(ResponseEntity.status(303).body("序列号"+deviceLibrary.getSeqNumber()+"的装备已被其他专管员操作")); throw new ApiException(ResponseEntity.status(303).body("序列号"+deviceLibrary.getSeqNumber()+"的装备已被其他专管员操作"));
} }
}); });
...@@ -468,6 +469,21 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService { ...@@ -468,6 +469,21 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
return libraries.stream().collect(Collectors.toMap(DeviceLibrary::getId, Function.identity())); return libraries.stream().collect(Collectors.toMap(DeviceLibrary::getId, Function.identity()));
} }
@Override
public Integer countAllRepel(List<Integer> fieldingIds, List<String> unitNames, List<String> seqNums,List<Integer> lifeStatusList) {
//判断装备序列号是否为空 是 走列装id查询。
if (seqNums!=null && seqNums.size()!=0){
return deviceLibraryDao.countAllBySeqNumberInAndOwnUnitInAndLifeStatusIn(seqNums,unitNames,lifeStatusList);
}else {
return deviceLibraryDao.countAllByPackingIdInAndOwnUnitInAndLifeStatusIn(fieldingIds,unitNames,lifeStatusList);
}
}
@Override
public List<DeviceLibrary> findAllBySeqNumber(List<String> seqNumbers) {
return deviceLibraryDao.findAllBySeqNumberIn(seqNumbers);
}
@Override @Override
public void isNotLoss(List<Integer> ids) { public void isNotLoss(List<Integer> ids) {
ids.forEach(integer -> { ids.forEach(integer -> {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论