116 lines
3.7 KiB
Java
116 lines
3.7 KiB
Java
|
|
package com.klp.service.impl;
|
|||
|
|
|
|||
|
|
import cn.hutool.core.bean.BeanUtil;
|
|||
|
|
import com.klp.common.core.page.TableDataInfo;
|
|||
|
|
import com.klp.common.core.domain.PageQuery;
|
|||
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|||
|
|
import com.klp.common.utils.StringUtils;
|
|||
|
|
import lombok.RequiredArgsConstructor;
|
|||
|
|
import org.springframework.stereotype.Service;
|
|||
|
|
import com.klp.domain.bo.WmsPayableBo;
|
|||
|
|
import com.klp.domain.vo.WmsPayableVo;
|
|||
|
|
import com.klp.domain.WmsPayable;
|
|||
|
|
import com.klp.mapper.WmsPayableMapper;
|
|||
|
|
import com.klp.service.IWmsPayableService;
|
|||
|
|
|
|||
|
|
import java.util.List;
|
|||
|
|
import java.util.Map;
|
|||
|
|
import java.util.Collection;
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 应付款管理(宽松版)Service业务层处理
|
|||
|
|
*
|
|||
|
|
* @author klp
|
|||
|
|
* @date 2025-08-13
|
|||
|
|
*/
|
|||
|
|
@RequiredArgsConstructor
|
|||
|
|
@Service
|
|||
|
|
public class WmsPayableServiceImpl implements IWmsPayableService {
|
|||
|
|
|
|||
|
|
private final WmsPayableMapper baseMapper;
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 查询应付款管理(宽松版)
|
|||
|
|
*/
|
|||
|
|
@Override
|
|||
|
|
public WmsPayableVo queryById(Long payableId){
|
|||
|
|
return baseMapper.selectVoById(payableId);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 查询应付款管理(宽松版)列表
|
|||
|
|
*/
|
|||
|
|
@Override
|
|||
|
|
public TableDataInfo<WmsPayableVo> queryPageList(WmsPayableBo bo, PageQuery pageQuery) {
|
|||
|
|
LambdaQueryWrapper<WmsPayable> lqw = buildQueryWrapper(bo);
|
|||
|
|
Page<WmsPayableVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
|||
|
|
return TableDataInfo.build(result);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 查询应付款管理(宽松版)列表
|
|||
|
|
*/
|
|||
|
|
@Override
|
|||
|
|
public List<WmsPayableVo> queryList(WmsPayableBo bo) {
|
|||
|
|
LambdaQueryWrapper<WmsPayable> lqw = buildQueryWrapper(bo);
|
|||
|
|
return baseMapper.selectVoList(lqw);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private LambdaQueryWrapper<WmsPayable> buildQueryWrapper(WmsPayableBo bo) {
|
|||
|
|
Map<String, Object> params = bo.getParams();
|
|||
|
|
LambdaQueryWrapper<WmsPayable> lqw = Wrappers.lambdaQuery();
|
|||
|
|
lqw.eq(bo.getSupplierId() != null, WmsPayable::getSupplierId, bo.getSupplierId());
|
|||
|
|
lqw.eq(bo.getOrderId() != null, WmsPayable::getOrderId, bo.getOrderId());
|
|||
|
|
lqw.eq(bo.getDueDate() != null, WmsPayable::getDueDate, bo.getDueDate());
|
|||
|
|
lqw.eq(bo.getAmount() != null, WmsPayable::getAmount, bo.getAmount());
|
|||
|
|
lqw.eq(bo.getPaidAmount() != null, WmsPayable::getPaidAmount, bo.getPaidAmount());
|
|||
|
|
lqw.eq(bo.getBalanceAmount() != null, WmsPayable::getBalanceAmount, bo.getBalanceAmount());
|
|||
|
|
lqw.eq(StringUtils.isNotBlank(bo.getStatus()), WmsPayable::getStatus, bo.getStatus());
|
|||
|
|
return lqw;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 新增应付款管理(宽松版)
|
|||
|
|
*/
|
|||
|
|
@Override
|
|||
|
|
public Boolean insertByBo(WmsPayableBo bo) {
|
|||
|
|
WmsPayable add = BeanUtil.toBean(bo, WmsPayable.class);
|
|||
|
|
validEntityBeforeSave(add);
|
|||
|
|
boolean flag = baseMapper.insert(add) > 0;
|
|||
|
|
if (flag) {
|
|||
|
|
bo.setPayableId(add.getPayableId());
|
|||
|
|
}
|
|||
|
|
return flag;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 修改应付款管理(宽松版)
|
|||
|
|
*/
|
|||
|
|
@Override
|
|||
|
|
public Boolean updateByBo(WmsPayableBo bo) {
|
|||
|
|
WmsPayable update = BeanUtil.toBean(bo, WmsPayable.class);
|
|||
|
|
validEntityBeforeSave(update);
|
|||
|
|
return baseMapper.updateById(update) > 0;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 保存前的数据校验
|
|||
|
|
*/
|
|||
|
|
private void validEntityBeforeSave(WmsPayable entity){
|
|||
|
|
//TODO 做一些数据校验,如唯一约束
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 批量删除应付款管理(宽松版)
|
|||
|
|
*/
|
|||
|
|
@Override
|
|||
|
|
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
|||
|
|
if(isValid){
|
|||
|
|
//TODO 做一些业务上的校验,判断是否需要校验
|
|||
|
|
}
|
|||
|
|
return baseMapper.deleteBatchIds(ids) > 0;
|
|||
|
|
}
|
|||
|
|
}
|