|
@@ -245,6 +245,14 @@ public class ContractInventoryFormServiceImpl extends BaseServiceImpl<ContractIn
|
|
|
}
|
|
|
//移除所有已经存在的节点,保存
|
|
|
List<ContractInventoryForm> list = excels.stream().filter(l -> l.getStatus() == 0).collect(Collectors.toList());
|
|
|
+ //判断要新增的数据中,清单编号是否已经存在
|
|
|
+ List<String> collect = list.stream().map(l -> l.getFormNumber()).collect(Collectors.toList());
|
|
|
+ if (nodes != 0 && collect.size() > 0){
|
|
|
+ List<String> numbers = baseMapper.getAllEqualsNumber(contractId,collect);
|
|
|
+ if (numbers.size() > 0){
|
|
|
+ throw new ServiceException("以下清单编号已经存在:["+StringUtils.join(numbers,",")+"],请修改excel后重新导入");
|
|
|
+ }
|
|
|
+ }
|
|
|
endTotal = list.size();
|
|
|
this.saveBatch(list);
|
|
|
|
|
@@ -340,6 +348,15 @@ public class ContractInventoryFormServiceImpl extends BaseServiceImpl<ContractIn
|
|
|
*/
|
|
|
@Override
|
|
|
public void add(ContractInventoryForm form) {
|
|
|
+ if (StringUtils.isNotBlank(form.getFormNumber())) {
|
|
|
+ //判断清单编号是否存在
|
|
|
+ long count = this.count(new LambdaQueryWrapper<ContractInventoryForm>()
|
|
|
+ .eq(ContractInventoryForm::getContractId,form.getContractId())
|
|
|
+ .eq(ContractInventoryForm::getFormNumber,form.getFormNumber()));
|
|
|
+ if (count > 0){
|
|
|
+ throw new ServiceException("新增失败:清单编号不能重复");
|
|
|
+ }
|
|
|
+ }
|
|
|
//如果为增补清单,那么节点类型必须为清单节点
|
|
|
if (form.getIsSupplement() == 1){
|
|
|
if (form.getIsFormNode() == 0){
|
|
@@ -413,6 +430,16 @@ public class ContractInventoryFormServiceImpl extends BaseServiceImpl<ContractIn
|
|
|
public void updateForm(ContractInventoryForm form) {
|
|
|
//获取当前节点信息
|
|
|
ContractInventoryForm nodeInfo = this.getById(form.getId());
|
|
|
+ if (StringUtils.isNotBlank(form.getFormNumber())) {
|
|
|
+ //判断清单编号是否存在
|
|
|
+ long count = this.count(new LambdaQueryWrapper<ContractInventoryForm>()
|
|
|
+ .eq(ContractInventoryForm::getContractId,form.getContractId())
|
|
|
+ .eq(ContractInventoryForm::getFormNumber,form.getFormNumber())
|
|
|
+ .ne(ContractInventoryForm::getId,form.getId()));
|
|
|
+ if (count > 0){
|
|
|
+ throw new ServiceException("修改失败:清单编号不能重复");
|
|
|
+ }
|
|
|
+ }
|
|
|
//判断节点是否已经锁定
|
|
|
if (nodeInfo.getIsLock() == 1){
|
|
|
throw new ServiceException("当前节点已经被锁定不能修改");
|