feat(flow): 添加排产单管理功能模块

- 创建排产单主实体类、业务对象和视图对象
- 创建排产单明细实体类、业务对象和视图对象
- 实现排产单主和明细的服务层接口及实现类
- 添加排产单主和明细的数据访问层映射器
- 配置MyBatis映射XML文件
- 实现排产单主和明细的控制器REST接口
- 添加分页查询、新增、修改、删除等基本操作功能
- 集成Excel导出功能
- 添加数据验证和业务逻辑处理
This commit is contained in:
2026-06-23 13:52:30 +08:00
parent 1f16c984a8
commit faaa5b1b75
24 changed files with 1771 additions and 0 deletions

View File

@@ -0,0 +1,114 @@
package com.klp.flow.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.flow.domain.bo.SchProdScheduleDetailBo;
import com.klp.flow.domain.vo.SchProdScheduleDetailVo;
import com.klp.flow.domain.SchProdScheduleDetail;
import com.klp.flow.mapper.SchProdScheduleDetailMapper;
import com.klp.flow.service.ISchProdScheduleDetailService;
import java.util.List;
import java.util.Map;
import java.util.Collection;
/**
* 排产单明细Service业务层处理
*
* @author klp
* @date 2026-06-23
*/
@RequiredArgsConstructor
@Service
public class SchProdScheduleDetailServiceImpl implements ISchProdScheduleDetailService {
private final SchProdScheduleDetailMapper baseMapper;
/**
* 查询排产单明细
*/
@Override
public SchProdScheduleDetailVo queryById(Long scheduleDetailId){
return baseMapper.selectVoById(scheduleDetailId);
}
/**
* 查询排产单明细列表
*/
@Override
public TableDataInfo<SchProdScheduleDetailVo> queryPageList(SchProdScheduleDetailBo bo, PageQuery pageQuery) {
LambdaQueryWrapper<SchProdScheduleDetail> lqw = buildQueryWrapper(bo);
Page<SchProdScheduleDetailVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
return TableDataInfo.build(result);
}
/**
* 查询排产单明细列表
*/
@Override
public List<SchProdScheduleDetailVo> queryList(SchProdScheduleDetailBo bo) {
LambdaQueryWrapper<SchProdScheduleDetail> lqw = buildQueryWrapper(bo);
return baseMapper.selectVoList(lqw);
}
private LambdaQueryWrapper<SchProdScheduleDetail> buildQueryWrapper(SchProdScheduleDetailBo bo) {
Map<String, Object> params = bo.getParams();
LambdaQueryWrapper<SchProdScheduleDetail> lqw = Wrappers.lambdaQuery();
lqw.eq(bo.getScheduleId() != null, SchProdScheduleDetail::getScheduleId, bo.getScheduleId());
lqw.eq(bo.getOrderDetailId() != null, SchProdScheduleDetail::getOrderDetailId, bo.getOrderDetailId());
lqw.eq(StringUtils.isNotBlank(bo.getSpec()), SchProdScheduleDetail::getSpec, bo.getSpec());
lqw.eq(StringUtils.isNotBlank(bo.getMaterial()), SchProdScheduleDetail::getMaterial, bo.getMaterial());
lqw.eq(bo.getScheduleWeight() != null, SchProdScheduleDetail::getScheduleWeight, bo.getScheduleWeight());
lqw.eq(StringUtils.isNotBlank(bo.getProductType()), SchProdScheduleDetail::getProductType, bo.getProductType());
return lqw;
}
/**
* 新增排产单明细
*/
@Override
public Boolean insertByBo(SchProdScheduleDetailBo bo) {
SchProdScheduleDetail add = BeanUtil.toBean(bo, SchProdScheduleDetail.class);
validEntityBeforeSave(add);
boolean flag = baseMapper.insert(add) > 0;
if (flag) {
bo.setScheduleDetailId(add.getScheduleDetailId());
}
return flag;
}
/**
* 修改排产单明细
*/
@Override
public Boolean updateByBo(SchProdScheduleDetailBo bo) {
SchProdScheduleDetail update = BeanUtil.toBean(bo, SchProdScheduleDetail.class);
validEntityBeforeSave(update);
return baseMapper.updateById(update) > 0;
}
/**
* 保存前的数据校验
*/
private void validEntityBeforeSave(SchProdScheduleDetail entity){
//TODO 做一些数据校验,如唯一约束
}
/**
* 批量删除排产单明细
*/
@Override
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
if(isValid){
//TODO 做一些业务上的校验,判断是否需要校验
}
return baseMapper.deleteBatchIds(ids) > 0;
}
}

View File

@@ -0,0 +1,133 @@
package com.klp.flow.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.flow.domain.bo.SchProdScheduleBo;
import com.klp.flow.domain.vo.SchProdScheduleVo;
import com.klp.flow.domain.SchProdSchedule;
import com.klp.flow.mapper.SchProdScheduleMapper;
import com.klp.flow.service.ISchProdScheduleService;
import java.util.List;
import java.util.Map;
import java.util.Collection;
/**
* 排产单主Service业务层处理
*
* @author klp
* @date 2026-06-23
*/
@RequiredArgsConstructor
@Service
public class SchProdScheduleServiceImpl implements ISchProdScheduleService {
private final SchProdScheduleMapper baseMapper;
/**
* 查询排产单主
*/
@Override
public SchProdScheduleVo queryById(Long scheduleId){
return baseMapper.selectVoById(scheduleId);
}
/**
* 查询排产单主列表
*/
@Override
public TableDataInfo<SchProdScheduleVo> queryPageList(SchProdScheduleBo bo, PageQuery pageQuery) {
LambdaQueryWrapper<SchProdSchedule> lqw = buildQueryWrapper(bo);
Page<SchProdScheduleVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
return TableDataInfo.build(result);
}
/**
* 查询排产单主列表
*/
@Override
public List<SchProdScheduleVo> queryList(SchProdScheduleBo bo) {
LambdaQueryWrapper<SchProdSchedule> lqw = buildQueryWrapper(bo);
return baseMapper.selectVoList(lqw);
}
private LambdaQueryWrapper<SchProdSchedule> buildQueryWrapper(SchProdScheduleBo bo) {
Map<String, Object> params = bo.getParams();
LambdaQueryWrapper<SchProdSchedule> lqw = Wrappers.lambdaQuery();
lqw.eq(StringUtils.isNotBlank(bo.getScheduleNo()), SchProdSchedule::getScheduleNo, bo.getScheduleNo());
lqw.eq(bo.getProdDate() != null, SchProdSchedule::getProdDate, bo.getProdDate());
lqw.eq(bo.getScheduleStatus() != null, SchProdSchedule::getScheduleStatus, bo.getScheduleStatus());
lqw.eq(bo.getTotalPlanWeight() != null, SchProdSchedule::getTotalPlanWeight, bo.getTotalPlanWeight());
lqw.eq(StringUtils.isNotBlank(bo.getRelContractNo()), SchProdSchedule::getRelContractNo, bo.getRelContractNo());
lqw.eq(StringUtils.isNotBlank(bo.getBusinessUser()), SchProdSchedule::getBusinessUser, bo.getBusinessUser());
lqw.eq(StringUtils.isNotBlank(bo.getBusinessPhone()), SchProdSchedule::getBusinessPhone, bo.getBusinessPhone());
lqw.eq(bo.getOrderDate() != null, SchProdSchedule::getOrderDate, bo.getOrderDate());
lqw.like(StringUtils.isNotBlank(bo.getCustomerName()), SchProdSchedule::getCustomerName, bo.getCustomerName());
lqw.eq(bo.getDeliveryCycle() != null, SchProdSchedule::getDeliveryCycle, bo.getDeliveryCycle());
lqw.eq(StringUtils.isNotBlank(bo.getUsePurpose()), SchProdSchedule::getUsePurpose, bo.getUsePurpose());
lqw.eq(StringUtils.isNotBlank(bo.getProductType()), SchProdSchedule::getProductType, bo.getProductType());
lqw.eq(StringUtils.isNotBlank(bo.getThicknessTolerance()), SchProdSchedule::getThicknessTolerance, bo.getThicknessTolerance());
lqw.eq(StringUtils.isNotBlank(bo.getWidthTolerance()), SchProdSchedule::getWidthTolerance, bo.getWidthTolerance());
lqw.eq(StringUtils.isNotBlank(bo.getSurfaceQuality()), SchProdSchedule::getSurfaceQuality, bo.getSurfaceQuality());
lqw.eq(StringUtils.isNotBlank(bo.getSurfaceTreatment()), SchProdSchedule::getSurfaceTreatment, bo.getSurfaceTreatment());
lqw.eq(StringUtils.isNotBlank(bo.getInnerDiameter()), SchProdSchedule::getInnerDiameter, bo.getInnerDiameter());
lqw.eq(StringUtils.isNotBlank(bo.getOuterDiameter()), SchProdSchedule::getOuterDiameter, bo.getOuterDiameter());
lqw.eq(StringUtils.isNotBlank(bo.getPackReq()), SchProdSchedule::getPackReq, bo.getPackReq());
lqw.eq(StringUtils.isNotBlank(bo.getCutEdgeReq()), SchProdSchedule::getCutEdgeReq, bo.getCutEdgeReq());
lqw.eq(StringUtils.isNotBlank(bo.getSingleCoilWeight()), SchProdSchedule::getSingleCoilWeight, bo.getSingleCoilWeight());
lqw.eq(StringUtils.isNotBlank(bo.getWeightDeviation()), SchProdSchedule::getWeightDeviation, bo.getWeightDeviation());
lqw.eq(StringUtils.isNotBlank(bo.getOtherTechReq()), SchProdSchedule::getOtherTechReq, bo.getOtherTechReq());
lqw.eq(StringUtils.isNotBlank(bo.getPaymentDesc()), SchProdSchedule::getPaymentDesc, bo.getPaymentDesc());
lqw.eq(StringUtils.isNotBlank(bo.getReturnReason()), SchProdSchedule::getReturnReason, bo.getReturnReason());
return lqw;
}
/**
* 新增排产单主
*/
@Override
public Boolean insertByBo(SchProdScheduleBo bo) {
SchProdSchedule add = BeanUtil.toBean(bo, SchProdSchedule.class);
validEntityBeforeSave(add);
boolean flag = baseMapper.insert(add) > 0;
if (flag) {
bo.setScheduleId(add.getScheduleId());
}
return flag;
}
/**
* 修改排产单主
*/
@Override
public Boolean updateByBo(SchProdScheduleBo bo) {
SchProdSchedule update = BeanUtil.toBean(bo, SchProdSchedule.class);
validEntityBeforeSave(update);
return baseMapper.updateById(update) > 0;
}
/**
* 保存前的数据校验
*/
private void validEntityBeforeSave(SchProdSchedule entity){
//TODO 做一些数据校验,如唯一约束
}
/**
* 批量删除排产单主
*/
@Override
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
if(isValid){
//TODO 做一些业务上的校验,判断是否需要校验
}
return baseMapper.deleteBatchIds(ids) > 0;
}
}

View File

@@ -0,0 +1,110 @@
package com.klp.flow.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 lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import com.klp.flow.domain.bo.SchSaleScheduleRelBo;
import com.klp.flow.domain.vo.SchSaleScheduleRelVo;
import com.klp.flow.domain.SchSaleScheduleRel;
import com.klp.flow.mapper.SchSaleScheduleRelMapper;
import com.klp.flow.service.ISchSaleScheduleRelService;
import java.util.List;
import java.util.Map;
import java.util.Collection;
/**
* 销售订单-排产单多对多关联Service业务层处理
*
* @author klp
* @date 2026-06-23
*/
@RequiredArgsConstructor
@Service
public class SchSaleScheduleRelServiceImpl implements ISchSaleScheduleRelService {
private final SchSaleScheduleRelMapper baseMapper;
/**
* 查询销售订单-排产单多对多关联
*/
@Override
public SchSaleScheduleRelVo queryById(Long relId){
return baseMapper.selectVoById(relId);
}
/**
* 查询销售订单-排产单多对多关联列表
*/
@Override
public TableDataInfo<SchSaleScheduleRelVo> queryPageList(SchSaleScheduleRelBo bo, PageQuery pageQuery) {
LambdaQueryWrapper<SchSaleScheduleRel> lqw = buildQueryWrapper(bo);
Page<SchSaleScheduleRelVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
return TableDataInfo.build(result);
}
/**
* 查询销售订单-排产单多对多关联列表
*/
@Override
public List<SchSaleScheduleRelVo> queryList(SchSaleScheduleRelBo bo) {
LambdaQueryWrapper<SchSaleScheduleRel> lqw = buildQueryWrapper(bo);
return baseMapper.selectVoList(lqw);
}
private LambdaQueryWrapper<SchSaleScheduleRel> buildQueryWrapper(SchSaleScheduleRelBo bo) {
Map<String, Object> params = bo.getParams();
LambdaQueryWrapper<SchSaleScheduleRel> lqw = Wrappers.lambdaQuery();
lqw.eq(bo.getOrderId() != null, SchSaleScheduleRel::getOrderId, bo.getOrderId());
lqw.eq(bo.getScheduleId() != null, SchSaleScheduleRel::getScheduleId, bo.getScheduleId());
lqw.eq(bo.getRelWeight() != null, SchSaleScheduleRel::getRelWeight, bo.getRelWeight());
return lqw;
}
/**
* 新增销售订单-排产单多对多关联
*/
@Override
public Boolean insertByBo(SchSaleScheduleRelBo bo) {
SchSaleScheduleRel add = BeanUtil.toBean(bo, SchSaleScheduleRel.class);
validEntityBeforeSave(add);
boolean flag = baseMapper.insert(add) > 0;
if (flag) {
bo.setRelId(add.getRelId());
}
return flag;
}
/**
* 修改销售订单-排产单多对多关联
*/
@Override
public Boolean updateByBo(SchSaleScheduleRelBo bo) {
SchSaleScheduleRel update = BeanUtil.toBean(bo, SchSaleScheduleRel.class);
validEntityBeforeSave(update);
return baseMapper.updateById(update) > 0;
}
/**
* 保存前的数据校验
*/
private void validEntityBeforeSave(SchSaleScheduleRel entity){
//TODO 做一些数据校验,如唯一约束
}
/**
* 批量删除销售订单-排产单多对多关联
*/
@Override
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
if(isValid){
//TODO 做一些业务上的校验,判断是否需要校验
}
return baseMapper.deleteBatchIds(ids) > 0;
}
}