11-14-更改供应商条件

This commit is contained in:
2025-11-14 15:02:41 +08:00
parent 3e85e79bdd
commit e704522965

View File

@ -36,7 +36,10 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDate; import java.time.LocalDate;
import java.util.*; import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
/** /**
* 供应商信息Service业务层处理 * 供应商信息Service业务层处理
@ -358,12 +361,12 @@ public class XzdSupplierInfoServiceImpl extends ServiceImpl<XzdSupplierInfoMappe
* @return 是否修改成功 * @return 是否修改成功
*/ */
@Override @Override
@Transactional // @Transactional
public Boolean updateByBo(XzdSupplierInfoBo bo) { public Boolean updateByBo(XzdSupplierInfoBo bo) {
XzdSupplierInfo update = MapstructUtils.convert(bo, XzdSupplierInfo.class); XzdSupplierInfo update = MapstructUtils.convert(bo, XzdSupplierInfo.class);
XzdSupplierInfoVo old = baseMapper.selectVoById(update.getId()); XzdSupplierInfoVo old = baseMapper.selectVoById(update.getId());
setValue(Collections.singletonList(old)); // setValue(Collections.singletonList(old));
validEntityBeforeSave(update); validEntityBeforeSave(update);
boolean b = baseMapper.updateById(update) > 0; boolean b = baseMapper.updateById(update) > 0;
@ -371,7 +374,9 @@ public class XzdSupplierInfoServiceImpl extends ServiceImpl<XzdSupplierInfoMappe
//处理资质信息更新 //处理资质信息更新
if (bo.getQualifications() != null && !bo.getQualifications().isEmpty()){ if (bo.getQualifications() != null && !bo.getQualifications().isEmpty()){
if (old.getQualifications() != null && !old.getQualifications().isEmpty()){ if (old.getQualifications() != null && !old.getQualifications().isEmpty()){
xzdSupplierQualificationService.removeByIds(old.getQualifications()); LambdaQueryWrapper<XzdSupplierQualification> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(XzdSupplierQualification::getSupplierId,old.getId());
xzdSupplierQualificationService.remove(lambdaQueryWrapper);
} }
for (XzdSupplierQualification qualification : bo.getQualifications()) { for (XzdSupplierQualification qualification : bo.getQualifications()) {
qualification.setSupplierId(update.getId()); qualification.setSupplierId(update.getId());
@ -379,7 +384,9 @@ public class XzdSupplierInfoServiceImpl extends ServiceImpl<XzdSupplierInfoMappe
xzdSupplierQualificationService.saveBatch(bo.getQualifications()); xzdSupplierQualificationService.saveBatch(bo.getQualifications());
}else { }else {
if (old.getQualifications() != null && !old.getQualifications().isEmpty()){ if (old.getQualifications() != null && !old.getQualifications().isEmpty()){
xzdSupplierQualificationService.removeByIds(old.getQualifications()); LambdaQueryWrapper<XzdSupplierQualification> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(XzdSupplierQualification::getSupplierId,old.getId());
xzdSupplierQualificationService.remove(lambdaQueryWrapper);
} }
} }
@ -393,7 +400,11 @@ public class XzdSupplierInfoServiceImpl extends ServiceImpl<XzdSupplierInfoMappe
//处理地址信息 //处理地址信息
if (bo.getAddresses() != null && !bo.getAddresses().isEmpty()){ if (bo.getAddresses() != null && !bo.getAddresses().isEmpty()){
if (old.getAddresses() != null && !old.getAddresses().isEmpty()){ if (old.getAddresses() != null && !old.getAddresses().isEmpty()){
xzdAddressInfoService.removeByIds(old.getAddresses()); LambdaQueryWrapper<XzdAddressInfo> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(XzdAddressInfo::getCustomerinformationId,old.getId());
lambdaQueryWrapper.eq(XzdAddressInfo::getType, "2");
xzdAddressInfoService.remove(lambdaQueryWrapper);
// xzdAddressInfoService.removeByIds(old.getAddresses());
} }
for (XzdAddressInfo address : bo.getAddresses()) { for (XzdAddressInfo address : bo.getAddresses()) {
address.setType("2"); address.setType("2");
@ -402,14 +413,22 @@ public class XzdSupplierInfoServiceImpl extends ServiceImpl<XzdSupplierInfoMappe
xzdAddressInfoService.saveBatch(bo.getAddresses()); xzdAddressInfoService.saveBatch(bo.getAddresses());
}else { }else {
if (old.getAddresses() != null && !old.getAddresses().isEmpty()){ if (old.getAddresses() != null && !old.getAddresses().isEmpty()){
xzdAddressInfoService.removeByIds(old.getAddresses()); // xzdAddressInfoService.removeByIds(old.getAddresses());
LambdaQueryWrapper<XzdAddressInfo> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(XzdAddressInfo::getCustomerinformationId,old.getId());
lambdaQueryWrapper.eq(XzdAddressInfo::getType, "2");
xzdAddressInfoService.remove(lambdaQueryWrapper);
} }
} }
//处理联系人信息 //处理联系人信息
if (bo.getContacts() != null && !bo.getContacts().isEmpty()){ if (bo.getContacts() != null && !bo.getContacts().isEmpty()){
if (old.getContacts() != null && !old.getContacts().isEmpty()){ if (old.getContacts() != null && !old.getContacts().isEmpty()){
xzdContactService.removeByIds(old.getContacts()); LambdaQueryWrapper<XzdContact> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(XzdContact::getCustomerinformationId,old.getId());
lambdaQueryWrapper.eq(XzdContact::getType, "2");
xzdContactService.remove(lambdaQueryWrapper);
// xzdContactService.removeByIds(old.getContacts());
} }
for (XzdContact contact : bo.getContacts()) { for (XzdContact contact : bo.getContacts()) {
contact.setType("2"); contact.setType("2");
@ -418,14 +437,22 @@ public class XzdSupplierInfoServiceImpl extends ServiceImpl<XzdSupplierInfoMappe
xzdContactService.saveBatch(bo.getContacts()); xzdContactService.saveBatch(bo.getContacts());
}else { }else {
if (old.getContacts() != null && !old.getContacts().isEmpty()){ if (old.getContacts() != null && !old.getContacts().isEmpty()){
xzdContactService.removeByIds(old.getContacts()); LambdaQueryWrapper<XzdContact> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(XzdContact::getCustomerinformationId,old.getId());
lambdaQueryWrapper.eq(XzdContact::getType, "2");
xzdContactService.remove(lambdaQueryWrapper);
// xzdContactService.removeByIds(old.getContacts());
} }
} }
//处理证照信息 //处理证照信息
if (bo.getCertificates() != null && !bo.getCertificates().isEmpty()){ if (bo.getCertificates() != null && !bo.getCertificates().isEmpty()){
if (old.getCertificates() != null && !old.getCertificates().isEmpty()){ if (old.getCertificates() != null && !old.getCertificates().isEmpty()){
xzdCertificateInfoService.removeByIds(old.getCertificates()); LambdaQueryWrapper<XzdCertificateInfo> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(XzdCertificateInfo::getCustomerinformationId,old.getId());
lambdaQueryWrapper.eq(XzdCertificateInfo::getType, "2");
xzdCertificateInfoService.remove(lambdaQueryWrapper);
// xzdCertificateInfoService.removeByIds(old.getCertificates());
} }
for (XzdCertificateInfo certificate : bo.getCertificates()) { for (XzdCertificateInfo certificate : bo.getCertificates()) {
certificate.setType("2"); certificate.setType("2");
@ -434,7 +461,11 @@ public class XzdSupplierInfoServiceImpl extends ServiceImpl<XzdSupplierInfoMappe
xzdCertificateInfoService.saveBatch(bo.getCertificates()); xzdCertificateInfoService.saveBatch(bo.getCertificates());
}else { }else {
if (old.getCertificates() != null && !old.getCertificates().isEmpty()){ if (old.getCertificates() != null && !old.getCertificates().isEmpty()){
xzdCertificateInfoService.removeByIds(old.getCertificates()); LambdaQueryWrapper<XzdCertificateInfo> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(XzdCertificateInfo::getCustomerinformationId,old.getId());
lambdaQueryWrapper.eq(XzdCertificateInfo::getType, "2");
xzdCertificateInfoService.remove(lambdaQueryWrapper);
// xzdCertificateInfoService.removeByIds(old.getCertificates());
} }
} }
@ -470,7 +501,7 @@ public class XzdSupplierInfoServiceImpl extends ServiceImpl<XzdSupplierInfoMappe
//如果不为空则删除 //如果不为空则删除
if (oldList != null && !oldList.isEmpty()){ if (oldList != null && !oldList.isEmpty()){
xzdYhxxService.removeByIds(oldList); xzdYhxxService.remove(queryWrapper);
} }
} }
@ -502,14 +533,21 @@ public class XzdSupplierInfoServiceImpl extends ServiceImpl<XzdSupplierInfoMappe
xzdCustomertypeInfoService.saveBatch(bo.getCustomerTypes()); xzdCustomertypeInfoService.saveBatch(bo.getCustomerTypes());
}else { }else {
if (old.getCustomerTypes() != null && !old.getCustomerTypes().isEmpty()){ if (old.getCustomerTypes() != null && !old.getCustomerTypes().isEmpty()){
xzdCustomertypeInfoService.removeByIds(old.getCustomerTypes()); LambdaQueryWrapper<XzdCustomertypeInfo> xzdCustomertypeInfoLambdaQueryWrapper = new LambdaQueryWrapper<>();
xzdCustomertypeInfoLambdaQueryWrapper.eq(XzdCustomertypeInfo::getType,"2");
xzdCustomertypeInfoLambdaQueryWrapper.eq(XzdCustomertypeInfo::getCustomerinformationId, update.getId());
xzdCustomertypeInfoService.remove(xzdCustomertypeInfoLambdaQueryWrapper);
// xzdCustomertypeInfoService.removeByIds(old.getCustomerTypes());
} }
} }
//处理供应物料 //处理供应物料
if (bo.getMaterials() != null && !bo.getMaterials().isEmpty()){ if (bo.getMaterials() != null && !bo.getMaterials().isEmpty()){
if (old.getMaterials() != null && !old.getMaterials().isEmpty()){ if (old.getMaterials() != null && !old.getMaterials().isEmpty()){
xzdSupplyMaterialsService.removeByIds(old.getMaterials()); LambdaQueryWrapper<XzdSupplyMaterials> xzdCustomertypeInfoLambdaQueryWrapper = new LambdaQueryWrapper<>();
xzdCustomertypeInfoLambdaQueryWrapper.eq(XzdSupplyMaterials::getSupplierId, update.getId());
xzdSupplyMaterialsService.remove(xzdCustomertypeInfoLambdaQueryWrapper);
// xzdSupplyMaterialsService.removeByIds(old.getMaterials());
} }
for (XzdSupplyMaterials customerType : bo.getMaterials()) { for (XzdSupplyMaterials customerType : bo.getMaterials()) {
customerType.setSupplierId(update.getId()); customerType.setSupplierId(update.getId());
@ -517,14 +555,19 @@ public class XzdSupplierInfoServiceImpl extends ServiceImpl<XzdSupplierInfoMappe
xzdSupplyMaterialsService.saveBatch(bo.getMaterials()); xzdSupplyMaterialsService.saveBatch(bo.getMaterials());
}else { }else {
if (old.getMaterials() != null && !old.getMaterials().isEmpty()){ if (old.getMaterials() != null && !old.getMaterials().isEmpty()){
xzdSupplyMaterialsService.removeByIds(old.getMaterials()); LambdaQueryWrapper<XzdSupplyMaterials> xzdCustomertypeInfoLambdaQueryWrapper = new LambdaQueryWrapper<>();
xzdCustomertypeInfoLambdaQueryWrapper.eq(XzdSupplyMaterials::getSupplierId, update.getId());
xzdSupplyMaterialsService.remove(xzdCustomertypeInfoLambdaQueryWrapper);
} }
} }
//供应商评价 //供应商评价
if (bo.getEvaluations() != null && !bo.getEvaluations().isEmpty()){ if (bo.getEvaluations() != null && !bo.getEvaluations().isEmpty()){
if (old.getEvaluations() != null && !old.getEvaluations().isEmpty()){ if (old.getEvaluations() != null && !old.getEvaluations().isEmpty()){
xzdSupplierEvaluationService.removeByIds(old.getEvaluations()); LambdaQueryWrapper<XzdSupplierEvaluation> xzdCustomertypeInfoLambdaQueryWrapper = new LambdaQueryWrapper<>();
xzdCustomertypeInfoLambdaQueryWrapper.eq(XzdSupplierEvaluation::getSupplierId, update.getId());
xzdSupplierEvaluationService.remove(xzdCustomertypeInfoLambdaQueryWrapper);
// xzdSupplierEvaluationService.removeByIds(old.getEvaluations());
} }
for (XzdSupplierEvaluation customerType : bo.getEvaluations()) { for (XzdSupplierEvaluation customerType : bo.getEvaluations()) {
customerType.setSupplierId(update.getId()); customerType.setSupplierId(update.getId());
@ -532,14 +575,21 @@ public class XzdSupplierInfoServiceImpl extends ServiceImpl<XzdSupplierInfoMappe
xzdSupplierEvaluationService.saveBatch(bo.getEvaluations()); xzdSupplierEvaluationService.saveBatch(bo.getEvaluations());
}else { }else {
if (old.getEvaluations() != null && !old.getEvaluations().isEmpty()){ if (old.getEvaluations() != null && !old.getEvaluations().isEmpty()){
xzdSupplierEvaluationService.removeByIds(old.getEvaluations()); LambdaQueryWrapper<XzdSupplierEvaluation> xzdCustomertypeInfoLambdaQueryWrapper = new LambdaQueryWrapper<>();
xzdCustomertypeInfoLambdaQueryWrapper.eq(XzdSupplierEvaluation::getSupplierId, update.getId());
xzdSupplierEvaluationService.remove(xzdCustomertypeInfoLambdaQueryWrapper);
// xzdSupplierEvaluationService.removeByIds(old.getEvaluations());
} }
} }
//项目信息 //项目信息
if (bo.getProjects() != null && !bo.getProjects().isEmpty()){ if (bo.getProjects() != null && !bo.getProjects().isEmpty()){
if (old.getProjects() != null && !old.getProjects().isEmpty()){ if (old.getProjects() != null && !old.getProjects().isEmpty()){
xzdProjectInfoService.removeByIds(old.getProjects()); LambdaQueryWrapper<XzdProjectInfo> xzdCustomertypeInfoLambdaQueryWrapper = new LambdaQueryWrapper<>();
xzdCustomertypeInfoLambdaQueryWrapper.eq(XzdProjectInfo::getCustomerinformationId, update.getId());
xzdCustomertypeInfoLambdaQueryWrapper.eq(XzdProjectInfo::getType,"2");
xzdProjectInfoService.remove(xzdCustomertypeInfoLambdaQueryWrapper);
// xzdProjectInfoService.removeByIds(old.getProjects());
} }
for (XzdProjectInfo project : bo.getProjects()) { for (XzdProjectInfo project : bo.getProjects()) {
project.setCustomerinformationId(update.getId()); project.setCustomerinformationId(update.getId());
@ -548,7 +598,11 @@ public class XzdSupplierInfoServiceImpl extends ServiceImpl<XzdSupplierInfoMappe
xzdProjectInfoService.saveBatch(bo.getProjects()); xzdProjectInfoService.saveBatch(bo.getProjects());
}else { }else {
if (old.getProjects() != null && !old.getProjects().isEmpty()){ if (old.getProjects() != null && !old.getProjects().isEmpty()){
xzdProjectInfoService.removeByIds(old.getProjects()); LambdaQueryWrapper<XzdProjectInfo> xzdCustomertypeInfoLambdaQueryWrapper = new LambdaQueryWrapper<>();
xzdCustomertypeInfoLambdaQueryWrapper.eq(XzdProjectInfo::getCustomerinformationId, update.getId());
xzdCustomertypeInfoLambdaQueryWrapper.eq(XzdProjectInfo::getType,"2");
xzdProjectInfoService.remove(xzdCustomertypeInfoLambdaQueryWrapper);
// xzdProjectInfoService.removeByIds(old.getProjects());
} }
} }
@ -556,7 +610,11 @@ public class XzdSupplierInfoServiceImpl extends ServiceImpl<XzdSupplierInfoMappe
//合同信息 //合同信息
if (bo.getContracts() != null && !bo.getContracts().isEmpty()){ if (bo.getContracts() != null && !bo.getContracts().isEmpty()){
if (old.getContracts() != null && !old.getContracts().isEmpty()){ if (old.getContracts() != null && !old.getContracts().isEmpty()){
xzdContractInfoService.removeByIds(old.getContracts()); LambdaQueryWrapper<XzdContractInfo> xzdCustomertypeInfoLambdaQueryWrapper = new LambdaQueryWrapper<>();
xzdCustomertypeInfoLambdaQueryWrapper.eq(XzdContractInfo::getCustomerinformationId, update.getId());
xzdCustomertypeInfoLambdaQueryWrapper.eq(XzdContractInfo::getType,"2");
xzdContractInfoService.remove(xzdCustomertypeInfoLambdaQueryWrapper);
// xzdContractInfoService.removeByIds(old.getContracts());
} }
for (XzdContractInfo contract : bo.getContracts()) { for (XzdContractInfo contract : bo.getContracts()) {
contract.setType("2"); contract.setType("2");
@ -565,7 +623,11 @@ public class XzdSupplierInfoServiceImpl extends ServiceImpl<XzdSupplierInfoMappe
xzdContractInfoService.saveBatch(bo.getContracts()); xzdContractInfoService.saveBatch(bo.getContracts());
}else { }else {
if (old.getContracts() != null && !old.getContracts().isEmpty()){ if (old.getContracts() != null && !old.getContracts().isEmpty()){
xzdContractInfoService.removeByIds(old.getContracts()); LambdaQueryWrapper<XzdContractInfo> xzdCustomertypeInfoLambdaQueryWrapper = new LambdaQueryWrapper<>();
xzdCustomertypeInfoLambdaQueryWrapper.eq(XzdContractInfo::getCustomerinformationId, update.getId());
xzdCustomertypeInfoLambdaQueryWrapper.eq(XzdContractInfo::getType,"2");
xzdContractInfoService.remove(xzdCustomertypeInfoLambdaQueryWrapper);
// xzdContractInfoService.removeByIds(old.getContracts());
} }
} }