|
|
|
@ -46,14 +46,22 @@ public class UdiContrastService {
|
|
|
|
|
|
|
|
|
|
public boolean isExit(String originUuid, String mainId, String thirdSys) {
|
|
|
|
|
|
|
|
|
|
if (StrUtil.isNotEmpty(originUuid) && StrUtil.isNotEmpty(mainId) && StrUtil.isBlank(thirdSys)) {
|
|
|
|
|
List<UdiRelevanceResponse> udiRelevanceEntities = findByUnion(originUuid, mainId);
|
|
|
|
|
|
|
|
|
|
String deviceRecordKey = null;
|
|
|
|
|
if (StrUtil.isNotEmpty(originUuid)) {
|
|
|
|
|
UdiProductEntity udiProductEntity = udiProductService.findOneByOriginUuid(originUuid);
|
|
|
|
|
if (udiProductEntity != null)
|
|
|
|
|
deviceRecordKey = udiProductEntity.getDeviceRecordKey();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (StrUtil.isNotEmpty(deviceRecordKey) && StrUtil.isNotEmpty(mainId) && StrUtil.isBlank(thirdSys)) {
|
|
|
|
|
List<UdiRelevanceResponse> udiRelevanceEntities = findDrkByUnion(deviceRecordKey, mainId);
|
|
|
|
|
if (CollUtil.isNotEmpty(udiRelevanceEntities)) {
|
|
|
|
|
return true;
|
|
|
|
|
} else
|
|
|
|
|
return false;
|
|
|
|
|
} else if (StrUtil.isNotEmpty(originUuid) && StrUtil.isEmpty(mainId)) {
|
|
|
|
|
List<UdiRelevanceResponse> udiRelevanceEntities = findByOriginUuid(originUuid);
|
|
|
|
|
} else if (StrUtil.isNotEmpty(deviceRecordKey) && StrUtil.isEmpty(mainId)) {
|
|
|
|
|
List<UdiRelevanceResponse> udiRelevanceEntities = findByDeviceRecordKey(deviceRecordKey);
|
|
|
|
|
if (CollUtil.isNotEmpty(udiRelevanceEntities)) {
|
|
|
|
|
for (UdiRelevanceResponse udiRelevanceEntity : udiRelevanceEntities) {
|
|
|
|
|
if (StrUtil.isEmpty(udiRelevanceEntity.getMainId()) && StrUtil.isNotEmpty(udiRelevanceEntity.getOriginUuid())) {
|
|
|
|
@ -72,8 +80,8 @@ public class UdiContrastService {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
} else if (StrUtil.isNotBlank(originUuid) && StrUtil.isNotBlank(mainId) && StrUtil.isNotBlank(thirdSys)) {
|
|
|
|
|
List<UdiRelevanceResponse> udiRelevanceEntities = findByUnion2(originUuid, mainId, thirdSys);
|
|
|
|
|
} else if (StrUtil.isNotBlank(deviceRecordKey) && StrUtil.isNotBlank(mainId) && StrUtil.isNotBlank(thirdSys)) {
|
|
|
|
|
List<UdiRelevanceResponse> udiRelevanceEntities = findByUnion2(deviceRecordKey, mainId, thirdSys);
|
|
|
|
|
if (CollUtil.isNotEmpty(udiRelevanceEntities)) {
|
|
|
|
|
return true;
|
|
|
|
|
} else
|
|
|
|
@ -82,23 +90,36 @@ public class UdiContrastService {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private List<UdiRelevanceResponse> findByUnion2(String originUuid, String mainId, String thirdSys) {
|
|
|
|
|
private List<UdiRelevanceResponse> findByUnion2(String deviceRecordKey, String mainId, String thirdSys) {
|
|
|
|
|
FilterUdiRelRequest filterUdiRelRequest = new FilterUdiRelRequest();
|
|
|
|
|
filterUdiRelRequest.setMainId(mainId);
|
|
|
|
|
filterUdiRelRequest.setOriginUuid(originUuid);
|
|
|
|
|
filterUdiRelRequest.setDeviceRecordKey(deviceRecordKey);
|
|
|
|
|
filterUdiRelRequest.setThirdSys(thirdSys);
|
|
|
|
|
List<UdiRelevanceResponse> udiRelevanceEntities = udiRelevanceDao.contrastJoinSelect(filterUdiRelRequest);
|
|
|
|
|
return udiRelevanceEntities;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<UdiRelevanceResponse> findByUnion(String originUuid, String mainId) {
|
|
|
|
|
UdiProductEntity udiProductEntity = udiProductService.findOneByOriginUuid(originUuid);
|
|
|
|
|
if (udiProductEntity == null) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
FilterUdiRelRequest filterUdiRelRequest = new FilterUdiRelRequest();
|
|
|
|
|
filterUdiRelRequest.setMainId(mainId);
|
|
|
|
|
filterUdiRelRequest.setOriginUuid(originUuid);
|
|
|
|
|
filterUdiRelRequest.setDeviceRecordKey(udiProductEntity.getDeviceRecordKey());
|
|
|
|
|
List<UdiRelevanceResponse> udiRelevanceEntities = udiRelevanceDao.contrastJoinSelect(filterUdiRelRequest);
|
|
|
|
|
return udiRelevanceEntities;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<UdiRelevanceResponse> findDrkByUnion(String deviceRecordKey, String mainId) {
|
|
|
|
|
FilterUdiRelRequest filterUdiRelRequest = new FilterUdiRelRequest();
|
|
|
|
|
filterUdiRelRequest.setMainId(mainId);
|
|
|
|
|
filterUdiRelRequest.setDeviceRecordKey(deviceRecordKey);
|
|
|
|
|
List<UdiRelevanceResponse> udiRelevanceEntities = udiRelevanceDao.contrastJoinSelect(filterUdiRelRequest);
|
|
|
|
|
return udiRelevanceEntities;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public List<UdiRelevanceResponse> findByUuid(String uuid) {
|
|
|
|
|
FilterUdiRelRequest filterUdiRelRequest = new FilterUdiRelRequest();
|
|
|
|
|
filterUdiRelRequest.setUuid(uuid);
|
|
|
|
@ -122,6 +143,14 @@ public class UdiContrastService {
|
|
|
|
|
return udiRelevanceEntities;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<UdiRelevanceResponse> findByDeviceRecordKey(String deviceRecordKey) {
|
|
|
|
|
FilterUdiRelRequest filterUdiRelRequest = new FilterUdiRelRequest();
|
|
|
|
|
filterUdiRelRequest.setDeviceRecordKey(deviceRecordKey);
|
|
|
|
|
List<UdiRelevanceResponse> udiRelevanceEntities = udiRelevanceDao.contrastJoinSelect(filterUdiRelRequest);
|
|
|
|
|
return udiRelevanceEntities;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public List<UdiRelevanceResponse> findByMainId(String mainId) {
|
|
|
|
|
FilterUdiRelRequest filterUdiRelRequest = new FilterUdiRelRequest();
|
|
|
|
|
filterUdiRelRequest.setMainId(mainId);
|
|
|
|
@ -147,6 +176,11 @@ public class UdiContrastService {
|
|
|
|
|
udiRelevanceEntity.setSupName(udiCombineRequest.getSupName());
|
|
|
|
|
udiRelevanceEntity.setId(gennerOrderUtils.getRelId());
|
|
|
|
|
udiRelevanceEntity.setIsDisable(false);
|
|
|
|
|
|
|
|
|
|
if (udiInfoEntities.get(0).getDiType() == ConstantStatus.DI_TYPE_SYDY) {
|
|
|
|
|
udiRelevanceEntity.setIsUseDy(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
udiRelevanceService.insertUdiRelevance(udiRelevanceEntity);
|
|
|
|
|
insertUdiInfos(udiInfoEntities);
|
|
|
|
|
}
|
|
|
|
@ -189,11 +223,11 @@ public class UdiContrastService {
|
|
|
|
|
public Long createOnlyUuid(UdiCombineRequest udiCombineRequest, String key) {
|
|
|
|
|
List<UdiProductEntity> udiInfoEntities = udiDlHttpClient.getOrUpdateByUuid(key);
|
|
|
|
|
|
|
|
|
|
if(udiInfoEntities==null || udiInfoEntities.size()==0){
|
|
|
|
|
if (udiInfoEntities == null || udiInfoEntities.size() == 0) {
|
|
|
|
|
//为了处理审核时的线上问题
|
|
|
|
|
int a=9999;
|
|
|
|
|
int a = 9999;
|
|
|
|
|
return Long.valueOf(a);
|
|
|
|
|
}else{
|
|
|
|
|
} else {
|
|
|
|
|
UdiRelevanceEntity udiRelevanceEntity = new UdiRelevanceEntity();
|
|
|
|
|
udiRelevanceEntity.setUpdateTime(new Date());
|
|
|
|
|
udiRelevanceEntity.setModifyTime(new Date());
|
|
|
|
@ -201,6 +235,9 @@ public class UdiContrastService {
|
|
|
|
|
if (StrUtil.isNotBlank(udiCombineRequest.getSupName())) {
|
|
|
|
|
udiRelevanceEntity.setSupName(udiCombineRequest.getSupName());
|
|
|
|
|
}
|
|
|
|
|
if (udiInfoEntities.get(0).getDiType() == ConstantStatus.DI_TYPE_SYDY) {
|
|
|
|
|
udiRelevanceEntity.setIsUseDy(true);
|
|
|
|
|
}
|
|
|
|
|
Long relId = gennerOrderUtils.getRelId();
|
|
|
|
|
udiRelevanceEntity.setId(relId);
|
|
|
|
|
udiRelevanceEntity.setIsDisable(false);
|
|
|
|
|