物资字典对照问题

dev
anthonywj 2 years ago
parent 375900052a
commit fba883b0ae

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

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

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

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

@ -46,14 +46,22 @@ public class UdiContrastService {
public boolean isExit(String originUuid, String mainId, String thirdSys) { 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)) { if (CollUtil.isNotEmpty(udiRelevanceEntities)) {
return true; return true;
} else } else
return false; return false;
} else if (StrUtil.isNotEmpty(originUuid) && StrUtil.isEmpty(mainId)) { } else if (StrUtil.isNotEmpty(deviceRecordKey) && StrUtil.isEmpty(mainId)) {
List<UdiRelevanceResponse> udiRelevanceEntities = findByOriginUuid(originUuid); List<UdiRelevanceResponse> udiRelevanceEntities = findByDeviceRecordKey(deviceRecordKey);
if (CollUtil.isNotEmpty(udiRelevanceEntities)) { if (CollUtil.isNotEmpty(udiRelevanceEntities)) {
for (UdiRelevanceResponse udiRelevanceEntity : udiRelevanceEntities) { for (UdiRelevanceResponse udiRelevanceEntity : udiRelevanceEntities) {
if (StrUtil.isEmpty(udiRelevanceEntity.getMainId()) && StrUtil.isNotEmpty(udiRelevanceEntity.getOriginUuid())) { if (StrUtil.isEmpty(udiRelevanceEntity.getMainId()) && StrUtil.isNotEmpty(udiRelevanceEntity.getOriginUuid())) {
@ -72,8 +80,8 @@ public class UdiContrastService {
} }
} }
return false; return false;
} else if (StrUtil.isNotBlank(originUuid) && StrUtil.isNotBlank(mainId) && StrUtil.isNotBlank(thirdSys)) { } else if (StrUtil.isNotBlank(deviceRecordKey) && StrUtil.isNotBlank(mainId) && StrUtil.isNotBlank(thirdSys)) {
List<UdiRelevanceResponse> udiRelevanceEntities = findByUnion2(originUuid, mainId, thirdSys); List<UdiRelevanceResponse> udiRelevanceEntities = findByUnion2(deviceRecordKey, mainId, thirdSys);
if (CollUtil.isNotEmpty(udiRelevanceEntities)) { if (CollUtil.isNotEmpty(udiRelevanceEntities)) {
return true; return true;
} else } else
@ -82,23 +90,36 @@ public class UdiContrastService {
return false; 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 filterUdiRelRequest = new FilterUdiRelRequest();
filterUdiRelRequest.setMainId(mainId); filterUdiRelRequest.setMainId(mainId);
filterUdiRelRequest.setOriginUuid(originUuid); filterUdiRelRequest.setDeviceRecordKey(deviceRecordKey);
filterUdiRelRequest.setThirdSys(thirdSys); filterUdiRelRequest.setThirdSys(thirdSys);
List<UdiRelevanceResponse> udiRelevanceEntities = udiRelevanceDao.contrastJoinSelect(filterUdiRelRequest); List<UdiRelevanceResponse> udiRelevanceEntities = udiRelevanceDao.contrastJoinSelect(filterUdiRelRequest);
return udiRelevanceEntities; return udiRelevanceEntities;
} }
public List<UdiRelevanceResponse> findByUnion(String originUuid, String mainId) { public List<UdiRelevanceResponse> findByUnion(String originUuid, String mainId) {
UdiProductEntity udiProductEntity = udiProductService.findOneByOriginUuid(originUuid);
if (udiProductEntity == null) {
return null;
}
FilterUdiRelRequest filterUdiRelRequest = new FilterUdiRelRequest(); FilterUdiRelRequest filterUdiRelRequest = new FilterUdiRelRequest();
filterUdiRelRequest.setMainId(mainId); filterUdiRelRequest.setMainId(mainId);
filterUdiRelRequest.setOriginUuid(originUuid); filterUdiRelRequest.setDeviceRecordKey(udiProductEntity.getDeviceRecordKey());
List<UdiRelevanceResponse> udiRelevanceEntities = udiRelevanceDao.contrastJoinSelect(filterUdiRelRequest); List<UdiRelevanceResponse> udiRelevanceEntities = udiRelevanceDao.contrastJoinSelect(filterUdiRelRequest);
return udiRelevanceEntities; 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) { public List<UdiRelevanceResponse> findByUuid(String uuid) {
FilterUdiRelRequest filterUdiRelRequest = new FilterUdiRelRequest(); FilterUdiRelRequest filterUdiRelRequest = new FilterUdiRelRequest();
filterUdiRelRequest.setUuid(uuid); filterUdiRelRequest.setUuid(uuid);
@ -122,6 +143,14 @@ public class UdiContrastService {
return udiRelevanceEntities; 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) { public List<UdiRelevanceResponse> findByMainId(String mainId) {
FilterUdiRelRequest filterUdiRelRequest = new FilterUdiRelRequest(); FilterUdiRelRequest filterUdiRelRequest = new FilterUdiRelRequest();
filterUdiRelRequest.setMainId(mainId); filterUdiRelRequest.setMainId(mainId);
@ -194,11 +223,11 @@ public class UdiContrastService {
public Long createOnlyUuid(UdiCombineRequest udiCombineRequest, String key) { public Long createOnlyUuid(UdiCombineRequest udiCombineRequest, String key) {
List<UdiProductEntity> udiInfoEntities = udiDlHttpClient.getOrUpdateByUuid(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); return Long.valueOf(a);
}else{ } else {
UdiRelevanceEntity udiRelevanceEntity = new UdiRelevanceEntity(); UdiRelevanceEntity udiRelevanceEntity = new UdiRelevanceEntity();
udiRelevanceEntity.setUpdateTime(new Date()); udiRelevanceEntity.setUpdateTime(new Date());
udiRelevanceEntity.setModifyTime(new Date()); udiRelevanceEntity.setModifyTime(new Date());

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

@ -101,6 +101,14 @@ public class UdiProductServiceImpl implements UdiProductService {
return udiProductDao.findByOriginUuid(originUuid); 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 @Override
public boolean insertUdiInfo(UdiProductEntity udiProductEntity) { public boolean insertUdiInfo(UdiProductEntity udiProductEntity) {
udiProductEntity.setUpdateTime(new Date()); udiProductEntity.setUpdateTime(new Date());

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

Loading…
Cancel
Save