|
|
@ -1,13 +1,21 @@ |
|
|
|
package com.qs.serve.modules.bms.service.impl; |
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
|
import com.qs.serve.common.util.Assert; |
|
|
|
import com.qs.serve.modules.bms.entity.BmsSupplier; |
|
|
|
import com.qs.serve.modules.bms.service.BmsSupplierService; |
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import com.qs.serve.modules.bms.entity.BmsSupplierStatement; |
|
|
|
import com.qs.serve.modules.bms.service.BmsSupplierStatementService; |
|
|
|
import com.qs.serve.modules.bms.mapper.BmsSupplierStatementMapper; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
|
* 客户货款对账单 服务实现类 |
|
|
|
* @author YenHex |
|
|
@ -18,5 +26,43 @@ import com.qs.serve.modules.bms.mapper.BmsSupplierStatementMapper; |
|
|
|
@AllArgsConstructor |
|
|
|
public class BmsSupplierStatementServiceImpl extends ServiceImpl<BmsSupplierStatementMapper,BmsSupplierStatement> implements BmsSupplierStatementService { |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private BmsSupplierService bmsSupplierService; |
|
|
|
|
|
|
|
public boolean saveBmsSupplierStatement(BmsSupplierStatement param){ |
|
|
|
|
|
|
|
LambdaQueryWrapper<BmsSupplier> lqw = new LambdaQueryWrapper<>(); |
|
|
|
lqw.eq(BmsSupplier::getCode,param.getSupplierCode()); |
|
|
|
List<BmsSupplier> supplierList = bmsSupplierService.list(lqw); |
|
|
|
if(supplierList.size()==0){ |
|
|
|
Assert.throwEx("没有找到该客户["+param.getSupplierCode()+"]"); |
|
|
|
} |
|
|
|
|
|
|
|
LambdaQueryWrapper<BmsSupplierStatement> statementLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
|
|
|
statementLambdaQueryWrapper.eq(BmsSupplierStatement::getJslId,param.getSupplierCode()); |
|
|
|
List<BmsSupplierStatement> statementList = this.list(statementLambdaQueryWrapper); |
|
|
|
if(statementList.size()>0){ |
|
|
|
Assert.throwEx("已存在该ID["+param.getJslId()+"]"); |
|
|
|
} |
|
|
|
|
|
|
|
BmsSupplier supplier = supplierList.get(0); |
|
|
|
param.setSupplierId(supplier.getId()); |
|
|
|
param.setSupplierName(supplier.getName()); |
|
|
|
return this.save(param); |
|
|
|
} |
|
|
|
|
|
|
|
public boolean deleteBmsSupplierStatement(String jslId){ |
|
|
|
|
|
|
|
LambdaQueryWrapper<BmsSupplierStatement> statementLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
|
|
|
statementLambdaQueryWrapper.eq(BmsSupplierStatement::getJslId,jslId); |
|
|
|
List<BmsSupplierStatement> statementList = this.list(statementLambdaQueryWrapper); |
|
|
|
if(statementList.size()==0){ |
|
|
|
Assert.throwEx("不存在该ID["+jslId+"]"); |
|
|
|
} |
|
|
|
|
|
|
|
List<Long> ids = statementList.stream().map(a->a.getId()).collect(Collectors.toList()); |
|
|
|
|
|
|
|
return this.removeBatchByIds(ids); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|