fix:制造商数据操作bug处理
parent
7bcc08ff0e
commit
adae1ab595
|
|
@ -18,6 +18,7 @@ import com.ruoyi.sip.domain.VendorInfo;
|
|||
import com.ruoyi.sip.mapper.VendorInfoMapper;
|
||||
import com.ruoyi.sip.service.IOmsWarehouseInfoService;
|
||||
import com.ruoyi.sip.service.IVendorInfoService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
|
@ -29,6 +30,7 @@ import com.ruoyi.common.core.text.Convert;
|
|||
* @author ruoyi
|
||||
* @date 2025-07-23
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class VendorInfoServiceImpl implements IVendorInfoService {
|
||||
@Autowired
|
||||
|
|
@ -74,9 +76,10 @@ public class VendorInfoServiceImpl implements IVendorInfoService {
|
|||
public int insertVendorInfo(VendorInfo vendorInfo) {
|
||||
lock.lock();
|
||||
try {
|
||||
|
||||
checkUnqCode(vendorInfo);
|
||||
vendorInfo.setVendorStatus(VendorInfo.VendorStatusEnum.NORMAL.getCode());
|
||||
if (StringUtils.isEmpty(vendorInfo.getVendorStatus())) {
|
||||
vendorInfo.setVendorStatus(VendorInfo.VendorStatusEnum.NORMAL.getValue());
|
||||
}
|
||||
vendorInfo.setCreateTime(DateUtils.getNowDate());
|
||||
vendorInfo.setCreateBy(ShiroUtils.getUserId().toString());
|
||||
return vendorInfoMapper.insertVendorInfo(vendorInfo);
|
||||
|
|
@ -85,7 +88,6 @@ public class VendorInfoServiceImpl implements IVendorInfoService {
|
|||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void checkUnqCode(VendorInfo vendorInfo) {
|
||||
|
|
@ -97,6 +99,7 @@ public class VendorInfoServiceImpl implements IVendorInfoService {
|
|||
count = Math.toIntExact(vendorInfos.stream().filter(vendorInfo1 -> !vendorInfo1.getVendorId().equals(vendorInfo.getVendorId())).count());
|
||||
}
|
||||
if (count > 0) {
|
||||
log.error("制造商编码重复,保存失败");
|
||||
throw new ServiceException("制造商编码重复,保存失败");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue