From b775bd00e11cfd575b067f6394684849a0796479 Mon Sep 17 00:00:00 2001
From: k94314517 <8417338+k94314517@user.noreply.gitee.com>
Date: 星期四, 14 九月 2023 17:45:25 +0800
Subject: [PATCH] 111
---
server/src/main/java/doumeemes/service/business/impl/DeviceServiceImpl.java | 21 +++++++++++----------
1 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/server/src/main/java/doumeemes/service/business/impl/DeviceServiceImpl.java b/server/src/main/java/doumeemes/service/business/impl/DeviceServiceImpl.java
index c9fb3a3..d8eb021 100644
--- a/server/src/main/java/doumeemes/service/business/impl/DeviceServiceImpl.java
+++ b/server/src/main/java/doumeemes/service/business/impl/DeviceServiceImpl.java
@@ -241,7 +241,7 @@
queryDeviceExtDTO1.setRootDepartId(user.getRootDepartment().getId());
List<DeviceExtListVO> list1= deviceExtService.getListByCondition(queryDeviceExtDTO1);*/
if(list.size()>0){
- return ApiResponse.failed("璁惧缂栫爜锛屼笉鍏佽娣诲姞");
+ return ApiResponse.failed("璁惧缂栫爜宸插瓨鍦紝涓嶅厑璁告坊鍔�");
}
device.setDeleted(Constants.ZERO);
device.setCreateTime(new Date());
@@ -293,8 +293,8 @@
}
List<String> departName = new ArrayList<>();
List<String> procedureName = new ArrayList<>();
- plansList.forEach(s->{
-
+ int num =0;
+ for(DeviceImportDTO s : plansList){
if (StringUtils.isBlank(s.getDeviceName())
|| s.getDeviceName().length() > 50
|| StringUtils.isBlank(s.getDepartName())
@@ -303,14 +303,13 @@
|| StringUtils.isBlank(s.getFinishWarehouseLocationName())){
throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"瀵煎叆鏁版嵁鍐呭鏈夎");
}
- if(isRepeatCode(s.getDeviceCode(),plansList)){
+ if(isRepeatCode(s,num,plansList)){
throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"鏂囨。涓澶囧彿銆�"+s.getDeviceCode()+"銆戦噸澶嶏紒");
}
departName.add(s.getDepartName());
procedureName.add(s.getProcedureName());
- });
-
-
+ num++;
+ }
plansList.forEach(s->{
@@ -431,12 +430,14 @@
});
}
- private boolean isRepeatCode(String deviceCode, List<DeviceImportDTO> plansList) {
- if(StringUtils.isNotBlank(deviceCode)){
+ private boolean isRepeatCode(DeviceImportDTO s,int num,List<DeviceImportDTO> plansList) {
+ if(StringUtils.isNotBlank(s.getDeviceCode())){
+ int tNum = 0;
for(DeviceImportDTO d :plansList){
- if(StringUtils.equals(deviceCode, d.getDeviceCode())){
+ if(num != tNum && StringUtils.equals(s.getDeviceCode(), d.getDeviceCode())){
return true;
}
+ tNum++;
}
}
return false;
--
Gitblit v1.9.3