添加各种名称校验

This commit is contained in:
hzj
2024-12-23 09:44:38 +08:00
parent b93faee241
commit 5f14f8fe2f
2 changed files with 11 additions and 2 deletions

View File

@@ -31,6 +31,7 @@ import com.njcn.csdevice.pojo.vo.ProjectEquipmentVO;
import com.njcn.csdevice.service.*; import com.njcn.csdevice.service.*;
import com.njcn.csdevice.util.QRCodeUtil; import com.njcn.csdevice.util.QRCodeUtil;
import com.njcn.csdevice.utils.ExcelStyleUtil; import com.njcn.csdevice.utils.ExcelStyleUtil;
import com.njcn.csdevice.utils.StringUtil;
import com.njcn.db.constant.DbConstant; import com.njcn.db.constant.DbConstant;
import com.njcn.oss.constant.OssPath; import com.njcn.oss.constant.OssPath;
import com.njcn.oss.utils.FileStorageUtil; import com.njcn.oss.utils.FileStorageUtil;
@@ -109,6 +110,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
if(Objects.nonNull (one)){ if(Objects.nonNull (one)){
throw new BusinessException ("设备名称不能重复"); throw new BusinessException ("设备名称不能重复");
} }
StringUtil.containsSpecialCharacters(csEquipmentDeliveryAddParm.getNdid());
CsEquipmentDeliveryPO po = this.queryEquipmentPOByndid (csEquipmentDeliveryAddParm.getNdid()); CsEquipmentDeliveryPO po = this.queryEquipmentPOByndid (csEquipmentDeliveryAddParm.getNdid());
if(!Objects.isNull (po)){ if(!Objects.isNull (po)){
throw new BusinessException (AlgorithmResponseEnum.NDID_ERROR); throw new BusinessException (AlgorithmResponseEnum.NDID_ERROR);
@@ -223,6 +225,9 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
@Override @Override
public Boolean updateEquipmentDelivery(CsEquipmentDeliveryAuditParm csEquipmentDeliveryAuditParm) { public Boolean updateEquipmentDelivery(CsEquipmentDeliveryAuditParm csEquipmentDeliveryAuditParm) {
StringUtil.containsSpecialCharacters(csEquipmentDeliveryAuditParm.getNdid());
boolean result; boolean result;
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getNdid,csEquipmentDeliveryAuditParm.getNdid()) lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getNdid,csEquipmentDeliveryAuditParm.getNdid())
@@ -233,6 +238,10 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
if (countByAccount >= 1) { if (countByAccount >= 1) {
throw new BusinessException(AlgorithmResponseEnum.NDID_ERROR); throw new BusinessException(AlgorithmResponseEnum.NDID_ERROR);
} }
List<CsEquipmentDeliveryPO> list = this.lambdaQuery().ne(CsEquipmentDeliveryPO::getNdid, csEquipmentDeliveryAuditParm.getNdid()).eq(CsEquipmentDeliveryPO::getName, csEquipmentDeliveryAuditParm.getName()).ne(CsEquipmentDeliveryPO::getRunStatus, 0).list();
if(!CollectionUtils.isEmpty (list)){
throw new BusinessException ("设备名称不能重复");
}
CsEquipmentDeliveryPO csEquipmentDeliveryPo = new CsEquipmentDeliveryPO(); CsEquipmentDeliveryPO csEquipmentDeliveryPo = new CsEquipmentDeliveryPO();
BeanUtils.copyProperties (csEquipmentDeliveryAuditParm, csEquipmentDeliveryPo); BeanUtils.copyProperties (csEquipmentDeliveryAuditParm, csEquipmentDeliveryPo);
result = this.updateById(csEquipmentDeliveryPo); result = this.updateById(csEquipmentDeliveryPo);

View File

@@ -213,7 +213,7 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
if(record.getId()!=null){ if(record.getId()!=null){
BeanUtils.copyProperties(record, wlRecord); BeanUtils.copyProperties(record, wlRecord);
LambdaQueryWrapper<WlRecord> qw = new LambdaQueryWrapper(); LambdaQueryWrapper<WlRecord> qw = new LambdaQueryWrapper();
qw.eq(WlRecord::getItemName,record.getItemName()).eq(WlRecord::getType,0).eq(WlRecord::getState,1).ne(WlRecord::getId,record.getId()); qw.eq(WlRecord::getItemName,record.getItemName()).isNull(WlRecord::getPId).eq(WlRecord::getType,0).eq(WlRecord::getState,1).ne(WlRecord::getId,record.getId());
List<WlRecord> wlRecordList = this.baseMapper.selectList(qw); List<WlRecord> wlRecordList = this.baseMapper.selectList(qw);
//方案名称重复校验 //方案名称重复校验
if(!wlRecordList.isEmpty()){ if(!wlRecordList.isEmpty()){
@@ -222,7 +222,7 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
this.updateById(wlRecord); this.updateById(wlRecord);
}else{ }else{
LambdaQueryWrapper<WlRecord> qw = new LambdaQueryWrapper(); LambdaQueryWrapper<WlRecord> qw = new LambdaQueryWrapper();
qw.eq(WlRecord::getItemName,record.getItemName()).eq(WlRecord::getType,0).eq(WlRecord::getState,1); qw.eq(WlRecord::getItemName,record.getItemName()).isNull(WlRecord::getPId).eq(WlRecord::getType,0).eq(WlRecord::getState,1);
List<WlRecord> wlRecordList = this.baseMapper.selectList(qw); List<WlRecord> wlRecordList = this.baseMapper.selectList(qw);
//方案名称重复校验 //方案名称重复校验
if(!wlRecordList.isEmpty()){ if(!wlRecordList.isEmpty()){