物资字典对照问题

dev
anthonywj 2 years ago
parent 375900052a
commit fba883b0ae

@ -150,9 +150,9 @@ public class UdiContrastController {
@Log(title = "耗材字典", businessType = BusinessType.UPDATE)
public BaseResponse changeVersion(@RequestBody UdiCombineRequest udiCombineRequest) {
UdiRelevanceEntity udiRelevanceEntity = udiRelevanceService.selectById(udiCombineRequest.getRelId());
if (udiContrastService.isExit(udiCombineRequest.getKeys().get(0), udiRelevanceEntity.getMainId(), null)) {
return ResultVOUtils.error(500, "已存在相同的对照关系,无法切换版本");
}
// if (udiContrastService.isExit(udiCombineRequest.getKeys().get(0), udiRelevanceEntity.getMainId(), null)) {
// return ResultVOUtils.error(500, "已存在相同的对照关系,无法切换版本");
// }
List<UdiProductEntity> udiInfoEntities = udiDlHttpClient.getUdiByUuid(udiCombineRequest.getKeys().get(0));
udiProductService.deleteByUuid(udiRelevanceEntity.getUuid());

@ -139,7 +139,7 @@ public class ThrProductsAddDiController {
}
ThrProductsAddDiEntity thrProductsAddDiEntity = thrProductsAddDiService.selecByUuid(uuids.get(0));
if (thrProductsAddDiEntity != null) {
return ResultVOUtils.error(500, "重复提交!");
return ResultVOUtils.error(500, "产品已存在,请勿重复提交!");
}
thrProductsAddDiService.addThrAddDiProducts(addThrDiProductsRequest);
return ResultVOUtils.success("提交成功!");

@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
@Data
@ -122,4 +123,5 @@ public class InvProductDetailEntity {
@TableField(value = "action")
private String action;
}

@ -78,4 +78,5 @@ public class FilterUdiRelRequest extends ListPageRequest {
private String syqsfxyjxmj;
private String mjfs;
private String categoryName;
private String deviceRecordKey;
}

@ -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);
@ -194,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;
return Long.valueOf(a);
}else{
int a = 9999;
return Long.valueOf(a);
} else {
UdiRelevanceEntity udiRelevanceEntity = new UdiRelevanceEntity();
udiRelevanceEntity.setUpdateTime(new Date());
udiRelevanceEntity.setModifyTime(new Date());

@ -31,6 +31,9 @@ public interface UdiProductService {
List<UdiProductEntity> findByOriginUuid(String originUuid);
UdiProductEntity findOneByOriginUuid(String originUuid);
boolean insertUdiInfo(UdiProductEntity udiProductEntity);
boolean insertUdiInfos(List<UdiProductEntity> udiInfoEntities);

@ -101,6 +101,14 @@ public class UdiProductServiceImpl implements UdiProductService {
return udiProductDao.findByOriginUuid(originUuid);
}
@Override
public UdiProductEntity findOneByOriginUuid(String originUuid) {
List<UdiProductEntity> udiProductEntities = findByOriginUuid(originUuid);
if (CollUtil.isNotEmpty(udiProductEntities))
return udiProductEntities.get(0);
return null;
}
@Override
public boolean insertUdiInfo(UdiProductEntity udiProductEntity) {
udiProductEntity.setUpdateTime(new Date());

@ -131,11 +131,10 @@
</select>
<select id="selectPackLevel" parameterType="java.lang.String"
resultType="java.lang.String">
select
basic_products.packLevel
select basic_products.packLevel
FROM basic_udirel
inner JOIN basic_products
ON basic_products.uuid = basic_udirel.uuid
inner JOIN basic_products
ON basic_products.uuid = basic_udirel.uuid
<where>
<if test="nameCode != '' and nameCode != null">
AND basic_products.nameCode = #{nameCode}
@ -714,6 +713,12 @@
<if test="originUuid != '' and originUuid != null">
AND basic_products.originUuid = #{originUuid}
</if>
<if test="deviceRecordKey != '' and deviceRecordKey != null">
AND basic_products.deviceRecordKey = #{deviceRecordKey}
</if>
<if test="nameCode != '' and nameCode != null">
AND basic_products.nameCode = #{nameCode}
</if>
<if test="id != '' and id != null">
AND basic_udirel.id = #{id}
</if>

Loading…
Cancel
Save