feat(wms): 新增其他收支管理功能
- 新增其他收支实体类WmsOtherIncome及其相关VO、BO类 - 实现其他收支的增删改查接口IWmsOtherIncomeService - 添加其他收支控制器WmsOtherIncomeController支持RESTful请求 - 配置MyBatis映射文件及Mapper接口支持数据库操作 - 在应付和应收业务中增加时间范围筛选字段和逻辑
This commit is contained in:
@@ -0,0 +1,113 @@
|
||||
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.WmsOtherIncomeBo;
|
||||
import com.klp.domain.vo.WmsOtherIncomeVo;
|
||||
import com.klp.domain.WmsOtherIncome;
|
||||
import com.klp.mapper.WmsOtherIncomeMapper;
|
||||
import com.klp.service.IWmsOtherIncomeService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 其他收支Service业务层处理
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-09-26
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class WmsOtherIncomeServiceImpl implements IWmsOtherIncomeService {
|
||||
|
||||
private final WmsOtherIncomeMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询其他收支
|
||||
*/
|
||||
@Override
|
||||
public WmsOtherIncomeVo queryById(Long otherIncomeId){
|
||||
return baseMapper.selectVoById(otherIncomeId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询其他收支列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<WmsOtherIncomeVo> queryPageList(WmsOtherIncomeBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<WmsOtherIncome> lqw = buildQueryWrapper(bo);
|
||||
Page<WmsOtherIncomeVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询其他收支列表
|
||||
*/
|
||||
@Override
|
||||
public List<WmsOtherIncomeVo> queryList(WmsOtherIncomeBo bo) {
|
||||
LambdaQueryWrapper<WmsOtherIncome> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<WmsOtherIncome> buildQueryWrapper(WmsOtherIncomeBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<WmsOtherIncome> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(bo.getIncomeDate() != null, WmsOtherIncome::getIncomeDate, bo.getIncomeDate());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getIncomeType()), WmsOtherIncome::getIncomeType, bo.getIncomeType());
|
||||
lqw.eq(bo.getAmount() != null, WmsOtherIncome::getAmount, bo.getAmount());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getSource()), WmsOtherIncome::getSource, bo.getSource());
|
||||
lqw.eq(bo.getType() != null, WmsOtherIncome::getType, bo.getType());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增其他收支
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(WmsOtherIncomeBo bo) {
|
||||
WmsOtherIncome add = BeanUtil.toBean(bo, WmsOtherIncome.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setOtherIncomeId(add.getOtherIncomeId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改其他收支
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(WmsOtherIncomeBo bo) {
|
||||
WmsOtherIncome update = BeanUtil.toBean(bo, WmsOtherIncome.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(WmsOtherIncome entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除其他收支
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteBatchIds(ids) > 0;
|
||||
}
|
||||
}
|
||||
@@ -73,6 +73,10 @@ public class WmsPayableServiceImpl implements IWmsPayableService {
|
||||
lqw.eq(bo.getPaidAmount() != null, "p.paid_amount", bo.getPaidAmount());
|
||||
lqw.eq(bo.getBalanceAmount() != null, "p.balance_amount", bo.getBalanceAmount());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getStatus()), "p.status", bo.getStatus());
|
||||
//按照创建时间筛选
|
||||
if (bo.getStartTime() != null && bo.getEndTime() != null){
|
||||
lqw.between("p.create_time", bo.getStartTime(), bo.getEndTime());
|
||||
}
|
||||
return lqw;
|
||||
}
|
||||
|
||||
|
||||
@@ -75,6 +75,10 @@ public class WmsReceivableServiceImpl implements IWmsReceivableService {
|
||||
lqw.eq(bo.getPaidAmount() != null, "r.paid_amount", bo.getPaidAmount());
|
||||
lqw.eq(bo.getBalanceAmount() != null, "r.balance_amount", bo.getBalanceAmount());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getStatus()), "r.status", bo.getStatus());
|
||||
//根据创建时间查询范围Date startTime Date endTime
|
||||
if (bo.getStartTime() != null && bo.getEndTime() != null) {
|
||||
lqw.between("r.create_time", bo.getStartTime(), bo.getEndTime());
|
||||
}
|
||||
return lqw;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user