feat(oa): 新增 BOM 管理、产品管理和分类功能
- 添加 BOM 头和 BOM 明细相关实体、控制器、服务和 Mapper - 实现 BOM 头和 BOM 明细的增删查改功能 - 添加产品和产品分类相关实体、控制器、服务和 Mapper - 实现产品和产品分类的增删查改功能- 为所有新增功能添加相应的 Excel 导出功能
This commit is contained in:
@@ -0,0 +1,102 @@
|
||||
package com.gear.oa.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.constraints.*;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import com.gear.common.annotation.RepeatSubmit;
|
||||
import com.gear.common.annotation.Log;
|
||||
import com.gear.common.core.controller.BaseController;
|
||||
import com.gear.common.core.domain.PageQuery;
|
||||
import com.gear.common.core.domain.R;
|
||||
import com.gear.common.core.validate.AddGroup;
|
||||
import com.gear.common.core.validate.EditGroup;
|
||||
import com.gear.common.core.validate.QueryGroup;
|
||||
import com.gear.common.enums.BusinessType;
|
||||
import com.gear.common.utils.poi.ExcelUtil;
|
||||
import com.gear.oa.domain.vo.GearBomVo;
|
||||
import com.gear.oa.domain.bo.GearBomBo;
|
||||
import com.gear.oa.service.IGearBomService;
|
||||
import com.gear.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* BOM 头,关联产品或原材料
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-08-19
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/oa/bom")
|
||||
public class GearBomController extends BaseController {
|
||||
|
||||
private final IGearBomService iGearBomService;
|
||||
|
||||
/**
|
||||
* 查询BOM 头,关联产品或原材料列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<GearBomVo> list(GearBomBo bo, PageQuery pageQuery) {
|
||||
return iGearBomService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出BOM 头,关联产品或原材料列表
|
||||
*/
|
||||
@Log(title = "BOM 头,关联产品或原材料", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(GearBomBo bo, HttpServletResponse response) {
|
||||
List<GearBomVo> list = iGearBomService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "BOM 头,关联产品或原材料", GearBomVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取BOM 头,关联产品或原材料详细信息
|
||||
*
|
||||
* @param bomId 主键
|
||||
*/
|
||||
@GetMapping("/{bomId}")
|
||||
public R<GearBomVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long bomId) {
|
||||
return R.ok(iGearBomService.queryById(bomId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增BOM 头,关联产品或原材料
|
||||
*/
|
||||
@Log(title = "BOM 头,关联产品或原材料", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody GearBomBo bo) {
|
||||
return toAjax(iGearBomService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改BOM 头,关联产品或原材料
|
||||
*/
|
||||
@Log(title = "BOM 头,关联产品或原材料", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody GearBomBo bo) {
|
||||
return toAjax(iGearBomService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除BOM 头,关联产品或原材料
|
||||
*
|
||||
* @param bomIds 主键串
|
||||
*/
|
||||
@Log(title = "BOM 头,关联产品或原材料", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{bomIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] bomIds) {
|
||||
return toAjax(iGearBomService.deleteWithValidByIds(Arrays.asList(bomIds), true));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
package com.gear.oa.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.constraints.*;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import com.gear.common.annotation.RepeatSubmit;
|
||||
import com.gear.common.annotation.Log;
|
||||
import com.gear.common.core.controller.BaseController;
|
||||
import com.gear.common.core.domain.PageQuery;
|
||||
import com.gear.common.core.domain.R;
|
||||
import com.gear.common.core.validate.AddGroup;
|
||||
import com.gear.common.core.validate.EditGroup;
|
||||
import com.gear.common.core.validate.QueryGroup;
|
||||
import com.gear.common.enums.BusinessType;
|
||||
import com.gear.common.utils.poi.ExcelUtil;
|
||||
import com.gear.oa.domain.vo.GearBomItemVo;
|
||||
import com.gear.oa.domain.bo.GearBomItemBo;
|
||||
import com.gear.oa.service.IGearBomItemService;
|
||||
import com.gear.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* BOM 明细,存放属性–值
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-08-19
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/oa/bomItem")
|
||||
public class GearBomItemController extends BaseController {
|
||||
|
||||
private final IGearBomItemService iGearBomItemService;
|
||||
|
||||
/**
|
||||
* 查询BOM 明细,存放属性–值列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<GearBomItemVo> list(GearBomItemBo bo, PageQuery pageQuery) {
|
||||
return iGearBomItemService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出BOM 明细,存放属性–值列表
|
||||
*/
|
||||
@Log(title = "BOM 明细,存放属性–值", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(GearBomItemBo bo, HttpServletResponse response) {
|
||||
List<GearBomItemVo> list = iGearBomItemService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "BOM 明细,存放属性–值", GearBomItemVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取BOM 明细,存放属性–值详细信息
|
||||
*
|
||||
* @param itemId 主键
|
||||
*/
|
||||
@GetMapping("/{itemId}")
|
||||
public R<GearBomItemVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long itemId) {
|
||||
return R.ok(iGearBomItemService.queryById(itemId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增BOM 明细,存放属性–值
|
||||
*/
|
||||
@Log(title = "BOM 明细,存放属性–值", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody GearBomItemBo bo) {
|
||||
return toAjax(iGearBomItemService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改BOM 明细,存放属性–值
|
||||
*/
|
||||
@Log(title = "BOM 明细,存放属性–值", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody GearBomItemBo bo) {
|
||||
return toAjax(iGearBomItemService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除BOM 明细,存放属性–值
|
||||
*
|
||||
* @param itemIds 主键串
|
||||
*/
|
||||
@Log(title = "BOM 明细,存放属性–值", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{itemIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] itemIds) {
|
||||
return toAjax(iGearBomItemService.deleteWithValidByIds(Arrays.asList(itemIds), true));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
package com.gear.oa.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.constraints.*;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import com.gear.common.annotation.RepeatSubmit;
|
||||
import com.gear.common.annotation.Log;
|
||||
import com.gear.common.core.controller.BaseController;
|
||||
import com.gear.common.core.domain.PageQuery;
|
||||
import com.gear.common.core.domain.R;
|
||||
import com.gear.common.core.validate.AddGroup;
|
||||
import com.gear.common.core.validate.EditGroup;
|
||||
import com.gear.common.core.validate.QueryGroup;
|
||||
import com.gear.common.enums.BusinessType;
|
||||
import com.gear.common.utils.poi.ExcelUtil;
|
||||
import com.gear.oa.domain.vo.GearProductCategoryVo;
|
||||
import com.gear.oa.domain.bo.GearProductCategoryBo;
|
||||
import com.gear.oa.service.IGearProductCategoryService;
|
||||
|
||||
/**
|
||||
* 产品分类树
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-08-19
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/oa/productCategory")
|
||||
public class GearProductCategoryController extends BaseController {
|
||||
|
||||
private final IGearProductCategoryService iGearProductCategoryService;
|
||||
|
||||
/**
|
||||
* 查询产品分类树列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public R<List<GearProductCategoryVo>> list(GearProductCategoryBo bo) {
|
||||
List<GearProductCategoryVo> list = iGearProductCategoryService.queryList(bo);
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出产品分类树列表
|
||||
*/
|
||||
@Log(title = "产品分类树", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(GearProductCategoryBo bo, HttpServletResponse response) {
|
||||
List<GearProductCategoryVo> list = iGearProductCategoryService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "产品分类树", GearProductCategoryVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取产品分类树详细信息
|
||||
*
|
||||
* @param categoryId 主键
|
||||
*/
|
||||
@GetMapping("/{categoryId}")
|
||||
public R<GearProductCategoryVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long categoryId) {
|
||||
return R.ok(iGearProductCategoryService.queryById(categoryId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增产品分类树
|
||||
*/
|
||||
@Log(title = "产品分类树", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody GearProductCategoryBo bo) {
|
||||
return toAjax(iGearProductCategoryService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改产品分类树
|
||||
*/
|
||||
@Log(title = "产品分类树", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody GearProductCategoryBo bo) {
|
||||
return toAjax(iGearProductCategoryService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除产品分类树
|
||||
*
|
||||
* @param categoryIds 主键串
|
||||
*/
|
||||
@Log(title = "产品分类树", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{categoryIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] categoryIds) {
|
||||
return toAjax(iGearProductCategoryService.deleteWithValidByIds(Arrays.asList(categoryIds), true));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
package com.gear.oa.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.constraints.*;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import com.gear.common.annotation.RepeatSubmit;
|
||||
import com.gear.common.annotation.Log;
|
||||
import com.gear.common.core.controller.BaseController;
|
||||
import com.gear.common.core.domain.PageQuery;
|
||||
import com.gear.common.core.domain.R;
|
||||
import com.gear.common.core.validate.AddGroup;
|
||||
import com.gear.common.core.validate.EditGroup;
|
||||
import com.gear.common.core.validate.QueryGroup;
|
||||
import com.gear.common.enums.BusinessType;
|
||||
import com.gear.common.utils.poi.ExcelUtil;
|
||||
import com.gear.oa.domain.vo.GearProductVo;
|
||||
import com.gear.oa.domain.bo.GearProductBo;
|
||||
import com.gear.oa.domain.vo.dashboard.*;
|
||||
import com.gear.oa.service.IGearProductService;
|
||||
import com.gear.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 产品
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-08-19
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/oa/product")
|
||||
public class GearProductController extends BaseController {
|
||||
|
||||
private final IGearProductService iGearProductService;
|
||||
|
||||
/**
|
||||
* 查询产品列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<GearProductVo> list(GearProductBo bo, PageQuery pageQuery) {
|
||||
return iGearProductService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出产品列表
|
||||
*/
|
||||
@Log(title = "产品", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(GearProductBo bo, HttpServletResponse response) {
|
||||
List<GearProductVo> list = iGearProductService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "产品", GearProductVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取产品详细信息
|
||||
*
|
||||
* @param productId 主键
|
||||
*/
|
||||
@GetMapping("/{productId}")
|
||||
public R<GearProductVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long productId) {
|
||||
return R.ok(iGearProductService.queryById(productId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增产品
|
||||
*/
|
||||
@Log(title = "产品", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody GearProductBo bo) {
|
||||
return toAjax(iGearProductService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改产品
|
||||
*/
|
||||
@Log(title = "产品", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody GearProductBo bo) {
|
||||
return toAjax(iGearProductService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除产品
|
||||
*
|
||||
* @param productIds 主键串
|
||||
*/
|
||||
@Log(title = "产品", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{productIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] productIds) {
|
||||
return toAjax(iGearProductService.deleteWithValidByIds(Arrays.asList(productIds), true));
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 数据看板 - 获取所有数据
|
||||
// */
|
||||
// @GetMapping("/dashboard")
|
||||
// public R<ProductDashboardVO> getDashboard() {
|
||||
// return R.ok(iGearProductService.getDashboard());
|
||||
// }
|
||||
}
|
||||
52
gear-oa/src/main/java/com/gear/oa/domain/GearBom.java
Normal file
52
gear-oa/src/main/java/com/gear/oa/domain/GearBom.java
Normal file
@@ -0,0 +1,52 @@
|
||||
package com.gear.oa.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import com.gear.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* BOM 头,关联产品或原材料对象 gear_bom
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-08-19
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("gear_bom")
|
||||
public class GearBom extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
/**
|
||||
* BOM 主键ID
|
||||
*/
|
||||
@TableId(value = "bom_id")
|
||||
private Long bomId;
|
||||
/**
|
||||
* BOM 编码(可选)
|
||||
*/
|
||||
private String bomCode;
|
||||
/**
|
||||
* BOM 名称(可选)
|
||||
*/
|
||||
private String bomName;
|
||||
/**
|
||||
* 是否启用(0=否,1=是)
|
||||
*/
|
||||
private Integer isEnabled;
|
||||
/**
|
||||
* 删除标志(0=正常,1=删除)
|
||||
*/
|
||||
@TableLogic
|
||||
private Integer delFlag;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
}
|
||||
56
gear-oa/src/main/java/com/gear/oa/domain/GearBomItem.java
Normal file
56
gear-oa/src/main/java/com/gear/oa/domain/GearBomItem.java
Normal file
@@ -0,0 +1,56 @@
|
||||
package com.gear.oa.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import com.gear.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* BOM 明细,存放属性–值对象 gear_bom_item
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-08-19
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("gear_bom_item")
|
||||
public class GearBomItem extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
/**
|
||||
* BOM 明细ID
|
||||
*/
|
||||
@TableId(value = "item_id")
|
||||
private Long itemId;
|
||||
/**
|
||||
* 关联 wms_bom.bom_id
|
||||
*/
|
||||
private Long bomId;
|
||||
/**
|
||||
* 属性名称
|
||||
*/
|
||||
private String attrKey;
|
||||
/**
|
||||
* 属性值
|
||||
*/
|
||||
private String attrValue;
|
||||
/**
|
||||
* 是否启用(0=否,1=是)
|
||||
*/
|
||||
private Integer isEnabled;
|
||||
/**
|
||||
* 删除标志(0=正常,1=删除)
|
||||
*/
|
||||
@TableLogic
|
||||
private Integer delFlag;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
}
|
||||
71
gear-oa/src/main/java/com/gear/oa/domain/GearProduct.java
Normal file
71
gear-oa/src/main/java/com/gear/oa/domain/GearProduct.java
Normal file
@@ -0,0 +1,71 @@
|
||||
package com.gear.oa.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import com.gear.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 产品对象 gear_product
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-08-19
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("gear_product")
|
||||
public class GearProduct extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@TableId(value = "product_id")
|
||||
private Long productId;
|
||||
/**
|
||||
* 产品编号
|
||||
*/
|
||||
private String productCode;
|
||||
/**
|
||||
* 产品名称
|
||||
*/
|
||||
private String productName;
|
||||
/**
|
||||
* 负责人
|
||||
*/
|
||||
private String owner;
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
private String unit;
|
||||
/**
|
||||
* BOM 表头ID
|
||||
*/
|
||||
private Long bomId;
|
||||
/**
|
||||
* 产品类型(product=产品,semi=半成品,raw=原料)
|
||||
*/
|
||||
private String type;
|
||||
/**
|
||||
* 是否启用(0=否,1=是)
|
||||
*/
|
||||
private Integer isEnabled;
|
||||
/**
|
||||
* 删除标志(0=正常,1=已删除)
|
||||
*/
|
||||
@TableLogic
|
||||
private Integer delFlag;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
//分类id
|
||||
private Long categoryId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.gear.oa.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import com.gear.common.core.domain.TreeEntity;
|
||||
|
||||
/**
|
||||
* 产品分类树对象 gear_product_category
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-08-19
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("gear_product_category")
|
||||
public class GearProductCategory extends TreeEntity<GearProductCategory> {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
/**
|
||||
* 树节点唯一标识(根节点用固定值)
|
||||
*/
|
||||
@TableId(value = "category_id")
|
||||
private Long categoryId;
|
||||
/**
|
||||
* 节点名称(根节点为类型名,产品节点为product_name)
|
||||
*/
|
||||
private String categoryName;
|
||||
/**
|
||||
* 节点类型(root=根节点、product=产品节点)
|
||||
*/
|
||||
private String categoryType;
|
||||
/**
|
||||
* 同级排序号
|
||||
*/
|
||||
private Long sortNo;
|
||||
/**
|
||||
* 删除标志(0=正常,1=删除)
|
||||
*/
|
||||
@TableLogic
|
||||
private Integer delFlag;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
}
|
||||
50
gear-oa/src/main/java/com/gear/oa/domain/bo/GearBomBo.java
Normal file
50
gear-oa/src/main/java/com/gear/oa/domain/bo/GearBomBo.java
Normal file
@@ -0,0 +1,50 @@
|
||||
package com.gear.oa.domain.bo;
|
||||
|
||||
import com.gear.common.core.validate.AddGroup;
|
||||
import com.gear.common.core.validate.EditGroup;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.gear.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* BOM 头,关联产品或原材料业务对象 gear_bom
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-08-19
|
||||
*/
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class GearBomBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* BOM 主键ID
|
||||
*/
|
||||
private Long bomId;
|
||||
|
||||
/**
|
||||
* BOM 编码(可选)
|
||||
*/
|
||||
private String bomCode;
|
||||
|
||||
/**
|
||||
* BOM 名称(可选)
|
||||
*/
|
||||
private String bomName;
|
||||
|
||||
/**
|
||||
* 是否启用(0=否,1=是)
|
||||
*/
|
||||
private Integer isEnabled;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.gear.oa.domain.bo;
|
||||
|
||||
import com.gear.common.core.validate.AddGroup;
|
||||
import com.gear.common.core.validate.EditGroup;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.gear.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* BOM 明细,存放属性–值业务对象 gear_bom_item
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-08-19
|
||||
*/
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class GearBomItemBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* BOM 明细ID
|
||||
*/
|
||||
private Long itemId;
|
||||
|
||||
/**
|
||||
* 关联 wms_bom.bom_id
|
||||
*/
|
||||
private Long bomId;
|
||||
|
||||
/**
|
||||
* 属性名称
|
||||
*/
|
||||
private String attrKey;
|
||||
|
||||
/**
|
||||
* 属性值
|
||||
*/
|
||||
private String attrValue;
|
||||
|
||||
/**
|
||||
* 是否启用(0=否,1=是)
|
||||
*/
|
||||
private Integer isEnabled;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package com.gear.oa.domain.bo;
|
||||
|
||||
import com.gear.common.core.validate.AddGroup;
|
||||
import com.gear.common.core.validate.EditGroup;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.gear.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 产品业务对象 gear_product
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-08-19
|
||||
*/
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class GearProductBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
private Long productId;
|
||||
|
||||
/**
|
||||
* 产品编号
|
||||
*/
|
||||
private String productCode;
|
||||
|
||||
/**
|
||||
* 产品名称
|
||||
*/
|
||||
private String productName;
|
||||
|
||||
/**
|
||||
* 负责人
|
||||
*/
|
||||
private String owner;
|
||||
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
private String unit;
|
||||
|
||||
/**
|
||||
* BOM 表头ID
|
||||
*/
|
||||
private Long bomId;
|
||||
|
||||
/**
|
||||
* 产品类型(product=产品,semi=半成品,raw=原料)
|
||||
*/
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 是否启用(0=否,1=是)
|
||||
*/
|
||||
private Integer isEnabled;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 分类ID
|
||||
*/
|
||||
private Long categoryId;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.gear.oa.domain.bo;
|
||||
|
||||
import com.gear.common.core.validate.AddGroup;
|
||||
import com.gear.common.core.validate.EditGroup;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.gear.common.core.domain.TreeEntity;
|
||||
|
||||
/**
|
||||
* 产品分类树业务对象 gear_product_category
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-08-19
|
||||
*/
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class GearProductCategoryBo extends TreeEntity<GearProductCategoryBo> {
|
||||
|
||||
/**
|
||||
* 树节点唯一标识(根节点用固定值)
|
||||
*/
|
||||
private Long categoryId;
|
||||
|
||||
/**
|
||||
* 节点名称(根节点为类型名,产品节点为product_name)
|
||||
*/
|
||||
private String categoryName;
|
||||
|
||||
/**
|
||||
* 节点类型(root=根节点、product=产品节点)
|
||||
*/
|
||||
private String categoryType;
|
||||
|
||||
/**
|
||||
* 同级排序号
|
||||
*/
|
||||
private Long sortNo;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.gear.oa.domain.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.gear.common.annotation.ExcelDictFormat;
|
||||
import com.gear.common.convert.ExcelDictConvert;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* BOM 明细,存放属性–值视图对象 gear_bom_item
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-08-19
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class GearBomItemVo {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* BOM 明细ID
|
||||
*/
|
||||
@ExcelProperty(value = "BOM 明细ID")
|
||||
private Long itemId;
|
||||
|
||||
/**
|
||||
* 关联 wms_bom.bom_id
|
||||
*/
|
||||
@ExcelProperty(value = "关联 wms_bom.bom_id")
|
||||
private Long bomId;
|
||||
|
||||
/**
|
||||
* 属性名称
|
||||
*/
|
||||
@ExcelProperty(value = "属性名称")
|
||||
private String attrKey;
|
||||
|
||||
/**
|
||||
* 属性值
|
||||
*/
|
||||
@ExcelProperty(value = "属性值")
|
||||
private String attrValue;
|
||||
|
||||
/**
|
||||
* 是否启用(0=否,1=是)
|
||||
*/
|
||||
@ExcelProperty(value = "是否启用", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(readConverterExp = "0==否,1=是")
|
||||
private Integer isEnabled;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
58
gear-oa/src/main/java/com/gear/oa/domain/vo/GearBomVo.java
Normal file
58
gear-oa/src/main/java/com/gear/oa/domain/vo/GearBomVo.java
Normal file
@@ -0,0 +1,58 @@
|
||||
package com.gear.oa.domain.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.gear.common.annotation.ExcelDictFormat;
|
||||
import com.gear.common.convert.ExcelDictConvert;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* BOM 头,关联产品或原材料视图对象 gear_bom
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-08-19
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class GearBomVo {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* BOM 主键ID
|
||||
*/
|
||||
@ExcelProperty(value = "BOM 主键ID")
|
||||
private Long bomId;
|
||||
|
||||
/**
|
||||
* BOM 编码(可选)
|
||||
*/
|
||||
@ExcelProperty(value = "BOM 编码", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(readConverterExp = "可=选")
|
||||
private String bomCode;
|
||||
|
||||
/**
|
||||
* BOM 名称(可选)
|
||||
*/
|
||||
@ExcelProperty(value = "BOM 名称", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(readConverterExp = "可=选")
|
||||
private String bomName;
|
||||
|
||||
/**
|
||||
* 是否启用(0=否,1=是)
|
||||
*/
|
||||
@ExcelProperty(value = "是否启用", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(readConverterExp = "0==否,1=是")
|
||||
private Integer isEnabled;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.gear.oa.domain.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.gear.common.annotation.ExcelDictFormat;
|
||||
import com.gear.common.convert.ExcelDictConvert;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 产品分类树视图对象 gear_product_category
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-08-19
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class GearProductCategoryVo {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 树节点唯一标识(根节点用固定值)
|
||||
*/
|
||||
@ExcelProperty(value = "树节点唯一标识", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(readConverterExp = "根=节点用固定值")
|
||||
private Long categoryId;
|
||||
|
||||
/**
|
||||
* 父节点tree_id(根节点的父节点为null)
|
||||
*/
|
||||
@ExcelProperty(value = "父节点tree_id", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(readConverterExp = "根=节点的父节点为null")
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 节点名称(根节点为类型名,产品节点为product_name)
|
||||
*/
|
||||
@ExcelProperty(value = "节点名称", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(readConverterExp = "根=节点为类型名,产品节点为product_name")
|
||||
private String categoryName;
|
||||
|
||||
/**
|
||||
* 节点类型(root=根节点、product=产品节点)
|
||||
*/
|
||||
@ExcelProperty(value = "节点类型", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(readConverterExp = "r=oot=根节点、product=产品节点")
|
||||
private String categoryType;
|
||||
|
||||
/**
|
||||
* 同级排序号
|
||||
*/
|
||||
@ExcelProperty(value = "同级排序号")
|
||||
private Long sortNo;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
package com.gear.oa.domain.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.gear.common.annotation.ExcelDictFormat;
|
||||
import com.gear.common.convert.ExcelDictConvert;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 产品视图对象 gear_product
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-08-19
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class GearProductVo {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@ExcelProperty(value = "主键ID")
|
||||
private Long productId;
|
||||
|
||||
/**
|
||||
* 产品编号
|
||||
*/
|
||||
@ExcelProperty(value = "产品编号")
|
||||
private String productCode;
|
||||
|
||||
/**
|
||||
* 产品名称
|
||||
*/
|
||||
@ExcelProperty(value = "产品名称")
|
||||
private String productName;
|
||||
|
||||
/**
|
||||
* 负责人
|
||||
*/
|
||||
@ExcelProperty(value = "负责人")
|
||||
private String owner;
|
||||
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
@ExcelProperty(value = "单位")
|
||||
private String unit;
|
||||
|
||||
/**
|
||||
* BOM 表头ID
|
||||
*/
|
||||
@ExcelProperty(value = "BOM 表头ID")
|
||||
private Long bomId;
|
||||
|
||||
/**
|
||||
* 产品类型(product=产品,semi=半成品,raw=原料)
|
||||
*/
|
||||
@ExcelProperty(value = "产品类型", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(readConverterExp = "p=roduct=产品,semi=半成品,raw=原料")
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 是否启用(0=否,1=是)
|
||||
*/
|
||||
@ExcelProperty(value = "是否启用", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(readConverterExp = "0==否,1=是")
|
||||
private Integer isEnabled;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
/**
|
||||
* 分类ID
|
||||
*/
|
||||
@ExcelProperty(value = "分类ID")
|
||||
private Long categoryId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.gear.oa.domain.vo.dashboard;
|
||||
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 原料维度推荐VO
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-08-19
|
||||
*/
|
||||
@Data
|
||||
public class MaterialRecommendationVO {
|
||||
|
||||
/**
|
||||
* 原料名称
|
||||
*/
|
||||
private String materialName;
|
||||
|
||||
/**
|
||||
* 原料编码
|
||||
*/
|
||||
private String materialCode;
|
||||
|
||||
/**
|
||||
* 推荐采购数量
|
||||
*/
|
||||
private Integer recommendedPurchaseQuantity;
|
||||
|
||||
/**
|
||||
* 推荐供应商
|
||||
*/
|
||||
private String recommendedSupplier;
|
||||
|
||||
/**
|
||||
* 推荐原因
|
||||
*/
|
||||
private String recommendationReason;
|
||||
|
||||
/**
|
||||
* 紧急程度
|
||||
*/
|
||||
private String urgencyLevel;
|
||||
|
||||
/**
|
||||
* 预计到货时间
|
||||
*/
|
||||
private Date estimatedArrivalTime;
|
||||
|
||||
/**
|
||||
* 建议操作
|
||||
*/
|
||||
private String suggestedAction;
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.gear.oa.domain.vo.dashboard;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 订单数量统计VO
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-08-19
|
||||
*/
|
||||
@Data
|
||||
public class OrderCountStatisticsVO {
|
||||
|
||||
/**
|
||||
* 总订单数量
|
||||
*/
|
||||
private Integer totalOrderCount;
|
||||
|
||||
/**
|
||||
* 已完成订单数量
|
||||
*/
|
||||
private Integer completedOrderCount;
|
||||
|
||||
/**
|
||||
* 进行中订单数量
|
||||
*/
|
||||
private Integer inProgressOrderCount;
|
||||
|
||||
/**
|
||||
* 待处理订单数量
|
||||
*/
|
||||
private Integer pendingOrderCount;
|
||||
|
||||
/**
|
||||
* 本月新增订单数量
|
||||
*/
|
||||
private Integer monthlyNewOrderCount;
|
||||
|
||||
/**
|
||||
* 完成率
|
||||
*/
|
||||
private Double completionRate;
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.gear.oa.domain.vo.dashboard;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 订单所需产品统计VO
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-08-19
|
||||
*/
|
||||
@Data
|
||||
public class OrderProductStatisticsVO {
|
||||
|
||||
/**
|
||||
* 产品名称
|
||||
*/
|
||||
private String productName;
|
||||
|
||||
/**
|
||||
* 产品编码
|
||||
*/
|
||||
private String productCode;
|
||||
|
||||
/**
|
||||
* 订单需求数量
|
||||
*/
|
||||
private Integer orderDemandQuantity;
|
||||
|
||||
/**
|
||||
* 当前库存数量
|
||||
*/
|
||||
private Integer currentStockQuantity;
|
||||
|
||||
/**
|
||||
* 库存缺口
|
||||
*/
|
||||
private Integer stockGap;
|
||||
|
||||
/**
|
||||
* 相关订单数量
|
||||
*/
|
||||
private Integer relatedOrderCount;
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.gear.oa.domain.vo.dashboard;
|
||||
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 订单维度推荐VO
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-08-19
|
||||
*/
|
||||
@Data
|
||||
public class OrderRecommendationVO {
|
||||
|
||||
/**
|
||||
* 订单编码
|
||||
*/
|
||||
private String orderCode;
|
||||
|
||||
/**
|
||||
* 客户名称
|
||||
*/
|
||||
private String customerName;
|
||||
|
||||
/**
|
||||
* 订单状态
|
||||
*/
|
||||
private String orderStatus;
|
||||
|
||||
/**
|
||||
* 优先级
|
||||
*/
|
||||
private String priority;
|
||||
|
||||
/**
|
||||
* 推荐原因
|
||||
*/
|
||||
private String recommendationReason;
|
||||
|
||||
/**
|
||||
* 建议操作
|
||||
*/
|
||||
private String suggestedAction;
|
||||
|
||||
/**
|
||||
* 预计完成时间
|
||||
*/
|
||||
private Date estimatedCompletionTime;
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.gear.oa.domain.vo.dashboard;
|
||||
|
||||
import lombok.Data;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 产品数据看板综合VO
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-08-19
|
||||
*/
|
||||
@Data
|
||||
public class ProductDashboardVO {
|
||||
|
||||
/**
|
||||
* 产品销售情况
|
||||
*/
|
||||
private List<ProductSalesPerformanceVO> productSalesPerformance;
|
||||
|
||||
/**
|
||||
* 销售人员业绩
|
||||
*/
|
||||
private List<SalesPersonPerformanceVO> salesPersonPerformance;
|
||||
|
||||
/**
|
||||
* 总订单数量统计
|
||||
*/
|
||||
private OrderCountStatisticsVO orderCountStatistics;
|
||||
|
||||
/**
|
||||
* 订单所需的产品统计
|
||||
*/
|
||||
private List<OrderProductStatisticsVO> orderProductStatistics;
|
||||
|
||||
/**
|
||||
* 根据BOM计算的原料需求
|
||||
*/
|
||||
private List<ProductMaterialRequirementVO> productMaterialRequirements;
|
||||
|
||||
/**
|
||||
* 原料库存和需求情况
|
||||
*/
|
||||
private List<RawMaterialInventoryVO> rawMaterialInventory;
|
||||
|
||||
/**
|
||||
* 订单维度推荐
|
||||
*/
|
||||
private List<OrderRecommendationVO> orderRecommendations;
|
||||
|
||||
/**
|
||||
* 原料维度推荐
|
||||
*/
|
||||
private List<MaterialRecommendationVO> materialRecommendations;
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.gear.oa.domain.vo.dashboard;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 产品原料需求VO
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-08-19
|
||||
*/
|
||||
@Data
|
||||
public class ProductMaterialRequirementVO {
|
||||
|
||||
/**
|
||||
* 产品名称
|
||||
*/
|
||||
private String productName;
|
||||
|
||||
/**
|
||||
* 产品编码
|
||||
*/
|
||||
private String productCode;
|
||||
|
||||
/**
|
||||
* 原料名称
|
||||
*/
|
||||
private String materialName;
|
||||
|
||||
/**
|
||||
* 原料编码
|
||||
*/
|
||||
private String materialCode;
|
||||
|
||||
/**
|
||||
* 需求数量
|
||||
*/
|
||||
private Integer requiredQuantity;
|
||||
|
||||
/**
|
||||
* 当前库存数量
|
||||
*/
|
||||
private Integer currentStockQuantity;
|
||||
|
||||
/**
|
||||
* 在途数量
|
||||
*/
|
||||
private Integer inTransitQuantity;
|
||||
|
||||
/**
|
||||
* 库存缺口
|
||||
*/
|
||||
private Integer stockGap;
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.gear.oa.domain.vo.dashboard;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 产品销售情况VO
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-08-19
|
||||
*/
|
||||
@Data
|
||||
public class ProductSalesPerformanceVO {
|
||||
|
||||
/**
|
||||
* 产品名称
|
||||
*/
|
||||
private String productName;
|
||||
|
||||
/**
|
||||
* 产品编码
|
||||
*/
|
||||
private String productCode;
|
||||
|
||||
/**
|
||||
* 销售数量
|
||||
*/
|
||||
private Integer salesQuantity;
|
||||
|
||||
/**
|
||||
* 销售金额
|
||||
*/
|
||||
private Double salesAmount;
|
||||
|
||||
/**
|
||||
* 增长率
|
||||
*/
|
||||
private Double growthRate;
|
||||
|
||||
/**
|
||||
* 销售排名
|
||||
*/
|
||||
private Integer salesRank;
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.gear.oa.domain.vo.dashboard;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 原料库存和需求情况VO
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-08-19
|
||||
*/
|
||||
@Data
|
||||
public class RawMaterialInventoryVO {
|
||||
|
||||
/**
|
||||
* 原料名称
|
||||
*/
|
||||
private String materialName;
|
||||
|
||||
/**
|
||||
* 原料编码
|
||||
*/
|
||||
private String materialCode;
|
||||
|
||||
/**
|
||||
* 当前库存数量
|
||||
*/
|
||||
private Integer currentStockQuantity;
|
||||
|
||||
/**
|
||||
* 在途数量
|
||||
*/
|
||||
private Integer inTransitQuantity;
|
||||
|
||||
/**
|
||||
* 总需求数量
|
||||
*/
|
||||
private Integer totalRequiredQuantity;
|
||||
|
||||
/**
|
||||
* 库存缺口
|
||||
*/
|
||||
private Integer stockGap;
|
||||
|
||||
/**
|
||||
* 安全库存
|
||||
*/
|
||||
private Integer safetyStock;
|
||||
|
||||
/**
|
||||
* 库存状态(充足/不足/紧急)
|
||||
*/
|
||||
private String stockStatus;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.gear.oa.domain.vo.dashboard;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 销售人员业绩VO
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-08-19
|
||||
*/
|
||||
@Data
|
||||
public class SalesPersonPerformanceVO {
|
||||
|
||||
/**
|
||||
* 销售人员姓名
|
||||
*/
|
||||
private String salesPersonName;
|
||||
|
||||
/**
|
||||
* 订单数量
|
||||
*/
|
||||
private Integer orderCount;
|
||||
|
||||
/**
|
||||
* 销售金额
|
||||
*/
|
||||
private Double salesAmount;
|
||||
|
||||
/**
|
||||
* 完成率
|
||||
*/
|
||||
private Double completionRate;
|
||||
|
||||
/**
|
||||
* 业绩排名
|
||||
*/
|
||||
private Integer performanceRank;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.gear.oa.mapper;
|
||||
|
||||
import com.gear.oa.domain.GearBomItem;
|
||||
import com.gear.oa.domain.vo.GearBomItemVo;
|
||||
import com.gear.common.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* BOM 明细,存放属性–值Mapper接口
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-08-19
|
||||
*/
|
||||
public interface GearBomItemMapper extends BaseMapperPlus<GearBomItemMapper, GearBomItem, GearBomItemVo> {
|
||||
|
||||
}
|
||||
15
gear-oa/src/main/java/com/gear/oa/mapper/GearBomMapper.java
Normal file
15
gear-oa/src/main/java/com/gear/oa/mapper/GearBomMapper.java
Normal file
@@ -0,0 +1,15 @@
|
||||
package com.gear.oa.mapper;
|
||||
|
||||
import com.gear.oa.domain.GearBom;
|
||||
import com.gear.oa.domain.vo.GearBomVo;
|
||||
import com.gear.common.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* BOM 头,关联产品或原材料Mapper接口
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-08-19
|
||||
*/
|
||||
public interface GearBomMapper extends BaseMapperPlus<GearBomMapper, GearBom, GearBomVo> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.gear.oa.mapper;
|
||||
|
||||
import com.gear.oa.domain.GearProductCategory;
|
||||
import com.gear.oa.domain.vo.GearProductCategoryVo;
|
||||
import com.gear.common.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 产品分类树Mapper接口
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-08-19
|
||||
*/
|
||||
public interface GearProductCategoryMapper extends BaseMapperPlus<GearProductCategoryMapper, GearProductCategory, GearProductCategoryVo> {
|
||||
|
||||
}
|
||||
205
gear-oa/src/main/java/com/gear/oa/mapper/GearProductMapper.java
Normal file
205
gear-oa/src/main/java/com/gear/oa/mapper/GearProductMapper.java
Normal file
@@ -0,0 +1,205 @@
|
||||
package com.gear.oa.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.gear.oa.domain.GearProduct;
|
||||
import com.gear.oa.domain.vo.GearProductVo;
|
||||
import com.gear.common.core.mapper.BaseMapperPlus;
|
||||
import com.gear.oa.domain.vo.dashboard.*;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 产品Mapper接口
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-08-19
|
||||
*/
|
||||
public interface GearProductMapper extends BaseMapperPlus<GearProductMapper, GearProduct, GearProductVo> {
|
||||
|
||||
/**
|
||||
* 数据看板 - 产品销售情况
|
||||
*/
|
||||
@Select("SELECT p.product_name, p.product_code, " +
|
||||
"SUM(od.quantity) AS salesQuantity, " +
|
||||
"SUM(od.quantity) AS salesAmount, " +
|
||||
"0 AS growthRate, " +
|
||||
"RANK() OVER (ORDER BY SUM(od.quantity) DESC) AS salesRank " +
|
||||
"FROM gear_order_detail od " +
|
||||
"JOIN gear_product p ON od.product_id = p.product_id " +
|
||||
"JOIN gear_order o ON od.order_id = o.order_id " +
|
||||
"WHERE o.order_status = 2 AND o.del_flag = 0 " +
|
||||
"GROUP BY p.product_id, p.product_name, p.product_code " +
|
||||
"ORDER BY salesQuantity DESC LIMIT 10")
|
||||
List<ProductSalesPerformanceVO> selectProductSalesPerformance();
|
||||
|
||||
/**
|
||||
* 数据看板 - 销售人员业绩
|
||||
*/
|
||||
@Select("SELECT o.sales_manager AS salesPersonName, " +
|
||||
"COUNT(DISTINCT o.order_id) AS orderCount, " +
|
||||
"SUM(od.quantity) AS salesAmount, " +
|
||||
"ROUND(SUM(CASE WHEN o.order_status = 2 THEN 1 ELSE 0 END) / COUNT(*), 4) AS completionRate, " +
|
||||
"RANK() OVER (ORDER BY SUM(od.quantity) DESC) AS performanceRank " +
|
||||
"FROM gear_order o " +
|
||||
"JOIN gear_order_detail od ON o.order_id = od.order_id " +
|
||||
"WHERE o.del_flag = 0 " +
|
||||
"GROUP BY o.sales_manager " +
|
||||
"ORDER BY salesAmount DESC")
|
||||
List<SalesPersonPerformanceVO> selectSalesPersonPerformance();
|
||||
|
||||
/**
|
||||
* 数据看板 - 总订单数量统计
|
||||
*/
|
||||
@Select("SELECT " +
|
||||
"COUNT(*) AS totalOrderCount, " +
|
||||
"SUM(CASE WHEN order_status = 2 THEN 1 ELSE 0 END) AS completedOrderCount, " +
|
||||
"SUM(CASE WHEN order_status = 1 THEN 1 ELSE 0 END) AS inProgressOrderCount, " +
|
||||
"SUM(CASE WHEN order_status = 0 THEN 1 ELSE 0 END) AS pendingOrderCount, " +
|
||||
"SUM(CASE WHEN DATE_FORMAT(create_time, '%Y-%m') = DATE_FORMAT(NOW(), '%Y-%m') THEN 1 ELSE 0 END) AS monthlyNewOrderCount, " +
|
||||
"ROUND(SUM(CASE WHEN order_status = 2 THEN 1 ELSE 0 END) / COUNT(*), 4) AS completionRate " +
|
||||
"FROM gear_order WHERE del_flag = 0")
|
||||
OrderCountStatisticsVO selectOrderCountStatistics();
|
||||
|
||||
/**
|
||||
* 数据看板 - 订单所需的产品统计
|
||||
*/
|
||||
@Select("SELECT p.product_name, p.product_code, " +
|
||||
"SUM(od.quantity) AS orderDemandQuantity, " +
|
||||
"IFNULL(s.stockQuantity, 0) AS currentStockQuantity, " +
|
||||
"SUM(od.quantity) - IFNULL(s.stockQuantity, 0) AS stockGap, " +
|
||||
"COUNT(DISTINCT o.order_id) AS relatedOrderCount " +
|
||||
"FROM gear_order_detail od " +
|
||||
"JOIN gear_product p ON od.product_id = p.product_id " +
|
||||
"JOIN gear_order o ON od.order_id = o.order_id " +
|
||||
"LEFT JOIN (SELECT item_id, SUM(quantity) AS stockQuantity FROM gear_stock WHERE item_type = 'product' AND del_flag = 0 GROUP BY item_id) s ON p.product_id = s.item_id " +
|
||||
"WHERE o.order_status IN (0, 1) AND o.del_flag = 0 " +
|
||||
"GROUP BY p.product_id, p.product_name, p.product_code " +
|
||||
"ORDER BY stockGap DESC")
|
||||
List<OrderProductStatisticsVO> selectOrderProductStatistics();
|
||||
|
||||
/**
|
||||
* 数据看板 - 根据BOM计算的原料需求
|
||||
*/
|
||||
@Select("SELECT p.product_name, p.product_code, " +
|
||||
"rm.material_name AS materialName, " +
|
||||
"rm.material_code AS materialCode, " +
|
||||
"SUM(od.quantity * bi.attr_value) AS requiredQuantity, " +
|
||||
"IFNULL(s.stockQuantity, 0) AS currentStockQuantity, " +
|
||||
"IFNULL(it.inTransitQuantity, 0) AS inTransitQuantity, " +
|
||||
"SUM(od.quantity * bi.attr_value) - IFNULL(s.stockQuantity, 0) - IFNULL(it.inTransitQuantity, 0) AS stockGap " +
|
||||
"FROM gear_order_detail od " +
|
||||
"JOIN gear_product p ON od.product_id = p.product_id " +
|
||||
"JOIN gear_bom b ON p.bom_id = b.bom_id " +
|
||||
"JOIN gear_bom_item bi ON b.bom_id = bi.bom_id " +
|
||||
"JOIN gear_material rm ON bi.attr_key = rm.material_code " +
|
||||
"JOIN gear_order o ON od.order_id = o.order_id " +
|
||||
"LEFT JOIN (SELECT item_id, SUM(quantity) AS stockQuantity FROM gear_stock WHERE item_type = 'material' AND del_flag = 0 GROUP BY item_id) s ON rm.material_id = s.item_id " +
|
||||
"LEFT JOIN (SELECT material_id, SUM(quantity) AS inTransitQuantity FROM gear_purchase_plan_detail WHERE status = 1 GROUP BY material_id) it ON rm.material_id = it.material_id " +
|
||||
"WHERE o.order_status IN (0, 1) AND o.del_flag = 0 " +
|
||||
"GROUP BY p.product_id, p.product_name, p.product_code, rm.material_id, rm.material_name, rm.material_code " +
|
||||
"ORDER BY stockGap DESC")
|
||||
List<ProductMaterialRequirementVO> selectProductMaterialRequirements();
|
||||
|
||||
/**
|
||||
* 数据看板 - 原料库存和需求情况
|
||||
*/
|
||||
@Select("SELECT rm.material_name AS materialName, " +
|
||||
"rm.material_code AS materialCode, " +
|
||||
"IFNULL(s.stockQuantity, 0) AS currentStockQuantity, " +
|
||||
"IFNULL(it.inTransitQuantity, 0) AS inTransitQuantity, " +
|
||||
"IFNULL(req.requiredQuantity, 0) AS totalRequiredQuantity, " +
|
||||
"IFNULL(req.requiredQuantity, 0) - IFNULL(s.stockQuantity, 0) - IFNULL(it.inTransitQuantity, 0) AS stockGap, " +
|
||||
"0 AS safetyStock, " +
|
||||
"CASE " +
|
||||
" WHEN IFNULL(req.requiredQuantity, 0) <= IFNULL(s.stockQuantity, 0) + IFNULL(it.inTransitQuantity, 0) THEN '充足' " +
|
||||
" WHEN IFNULL(req.requiredQuantity, 0) <= IFNULL(s.stockQuantity, 0) + IFNULL(it.inTransitQuantity, 0) + 0 THEN '不足' " +
|
||||
" ELSE '紧急' " +
|
||||
"END AS stockStatus " +
|
||||
"FROM gear_material rm " +
|
||||
"LEFT JOIN (SELECT item_id, SUM(quantity) AS stockQuantity FROM gear_stock WHERE item_type = 'material' AND del_flag = 0 GROUP BY item_id) s ON rm.material_id = s.item_id " +
|
||||
"LEFT JOIN (SELECT material_id, SUM(quantity) AS inTransitQuantity FROM gear_purchase_plan_detail WHERE status = 1 GROUP BY material_id) it ON rm.material_id = it.material_id " +
|
||||
"LEFT JOIN (SELECT bi.attr_key AS material_code, SUM(od.quantity * bi.attr_value) AS requiredQuantity " +
|
||||
" FROM gear_order_detail od " +
|
||||
" JOIN gear_order o ON od.order_id = o.order_id " +
|
||||
" JOIN gear_product p ON od.product_id = p.product_id " +
|
||||
" JOIN gear_bom b ON p.bom_id = b.bom_id " +
|
||||
" JOIN gear_bom_item bi ON b.bom_id = bi.bom_id " +
|
||||
" WHERE o.order_status IN (0, 1) AND o.del_flag = 0 " +
|
||||
" GROUP BY bi.attr_key) req ON rm.material_code = req.material_code " +
|
||||
"ORDER BY stockGap DESC")
|
||||
List<RawMaterialInventoryVO> selectRawMaterialInventory();
|
||||
|
||||
/**
|
||||
* 数据看板 - 订单维度推荐
|
||||
*/
|
||||
@Select("SELECT o.order_code, o.customer_name, " +
|
||||
"CASE o.order_status " +
|
||||
" WHEN 0 THEN '新建' " +
|
||||
" WHEN 1 THEN '生产中' " +
|
||||
" WHEN 2 THEN '已完成' " +
|
||||
" WHEN 3 THEN '已取消' " +
|
||||
"END AS orderStatus, " +
|
||||
"CASE " +
|
||||
" WHEN o.order_status = 0 THEN '高' " +
|
||||
" WHEN o.order_status = 1 THEN '中' " +
|
||||
" ELSE '低' " +
|
||||
"END AS priority, " +
|
||||
"CASE " +
|
||||
" WHEN o.order_status = 0 THEN '新订单需要及时处理' " +
|
||||
" WHEN o.order_status = 1 THEN '生产中的订单需要关注进度' " +
|
||||
" ELSE '订单已完成或已取消' " +
|
||||
"END AS recommendationReason, " +
|
||||
"CASE " +
|
||||
" WHEN o.order_status = 0 THEN '开始生产' " +
|
||||
" WHEN o.order_status = 1 THEN '检查生产进度' " +
|
||||
" ELSE '无需操作' " +
|
||||
"END AS suggestedAction, " +
|
||||
"DATE_ADD(o.create_time, INTERVAL 30 DAY) AS estimatedCompletionTime " +
|
||||
"FROM gear_order o " +
|
||||
"WHERE o.order_status IN (0, 1) AND o.del_flag = 0 " +
|
||||
"ORDER BY o.create_time ASC LIMIT 10")
|
||||
List<OrderRecommendationVO> selectOrderRecommendations();
|
||||
|
||||
/**
|
||||
* 数据看板 - 原料维度推荐
|
||||
*/
|
||||
@Select("SELECT rm.material_name AS materialName, " +
|
||||
"rm.material_code AS materialCode, " +
|
||||
"GREATEST(0, IFNULL(req.requiredQuantity, 0) - IFNULL(s.stockQuantity, 0) - IFNULL(it.inTransitQuantity, 0)) AS recommendedPurchaseQuantity, " +
|
||||
"'默认供应商' AS recommendedSupplier, " +
|
||||
"CASE " +
|
||||
" WHEN IFNULL(req.requiredQuantity, 0) > IFNULL(s.stockQuantity, 0) + IFNULL(it.inTransitQuantity, 0) + 0 THEN '库存不足,需要紧急采购' " +
|
||||
" WHEN IFNULL(req.requiredQuantity, 0) > IFNULL(s.stockQuantity, 0) + IFNULL(it.inTransitQuantity, 0) THEN '库存不足,建议采购' " +
|
||||
" ELSE '库存充足' " +
|
||||
"END AS recommendationReason, " +
|
||||
"CASE " +
|
||||
" WHEN IFNULL(req.requiredQuantity, 0) > IFNULL(s.stockQuantity, 0) + IFNULL(it.inTransitQuantity, 0) + 0 THEN '紧急' " +
|
||||
" WHEN IFNULL(req.requiredQuantity, 0) > IFNULL(s.stockQuantity, 0) + IFNULL(it.inTransitQuantity, 0) THEN '一般' " +
|
||||
" ELSE '低' " +
|
||||
"END AS urgencyLevel, " +
|
||||
"DATE_ADD(NOW(), INTERVAL 7 DAY) AS estimatedArrivalTime, " +
|
||||
"CASE " +
|
||||
" WHEN IFNULL(req.requiredQuantity, 0) > IFNULL(s.stockQuantity, 0) + IFNULL(it.inTransitQuantity, 0) + 0 THEN '立即采购' " +
|
||||
" WHEN IFNULL(req.requiredQuantity, 0) > IFNULL(s.stockQuantity, 0) + IFNULL(it.inTransitQuantity, 0) THEN '计划采购' " +
|
||||
" ELSE '无需采购' " +
|
||||
"END AS suggestedAction " +
|
||||
"FROM gear_material rm " +
|
||||
"LEFT JOIN (SELECT item_id, SUM(quantity) AS stockQuantity FROM gear_stock WHERE item_type = 'material' AND del_flag = 0 GROUP BY item_id) s ON rm.material_id = s.item_id " +
|
||||
"LEFT JOIN (SELECT material_id, SUM(quantity) AS inTransitQuantity FROM gear_purchase_plan_detail WHERE status = 1 GROUP BY material_id) it ON rm.material_id = it.material_id " +
|
||||
"LEFT JOIN (SELECT bi.attr_key AS material_code, SUM(od.quantity * bi.attr_value) AS requiredQuantity " +
|
||||
" FROM gear_order_detail od " +
|
||||
" JOIN gear_order o ON od.order_id = o.order_id " +
|
||||
" JOIN gear_product p ON od.product_id = p.product_id " +
|
||||
" JOIN gear_bom b ON p.bom_id = b.bom_id " +
|
||||
" JOIN gear_bom_item bi ON b.bom_id = bi.bom_id " +
|
||||
" WHERE o.order_status IN (0, 1) AND o.del_flag = 0 " +
|
||||
" GROUP BY bi.attr_key) req ON rm.material_code = req.material_code " +
|
||||
"WHERE IFNULL(req.requiredQuantity, 0) > IFNULL(s.stockQuantity, 0) + IFNULL(it.inTransitQuantity, 0) " +
|
||||
"ORDER BY (IFNULL(req.requiredQuantity, 0) - IFNULL(s.stockQuantity, 0) - IFNULL(it.inTransitQuantity, 0)) DESC LIMIT 10")
|
||||
List<MaterialRecommendationVO> selectMaterialRecommendations();
|
||||
|
||||
Page<GearProductVo> selectVoPagePlus(Page<Object> build, @Param("ew") QueryWrapper<GearProduct> lqw);
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.gear.oa.service;
|
||||
|
||||
import com.gear.oa.domain.GearBomItem;
|
||||
import com.gear.oa.domain.vo.GearBomItemVo;
|
||||
import com.gear.oa.domain.bo.GearBomItemBo;
|
||||
import com.gear.common.core.page.TableDataInfo;
|
||||
import com.gear.common.core.domain.PageQuery;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* BOM 明细,存放属性–值Service接口
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-08-19
|
||||
*/
|
||||
public interface IGearBomItemService {
|
||||
|
||||
/**
|
||||
* 查询BOM 明细,存放属性–值
|
||||
*/
|
||||
GearBomItemVo queryById(Long itemId);
|
||||
|
||||
/**
|
||||
* 查询BOM 明细,存放属性–值列表
|
||||
*/
|
||||
TableDataInfo<GearBomItemVo> queryPageList(GearBomItemBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询BOM 明细,存放属性–值列表
|
||||
*/
|
||||
List<GearBomItemVo> queryList(GearBomItemBo bo);
|
||||
|
||||
/**
|
||||
* 新增BOM 明细,存放属性–值
|
||||
*/
|
||||
Boolean insertByBo(GearBomItemBo bo);
|
||||
|
||||
/**
|
||||
* 修改BOM 明细,存放属性–值
|
||||
*/
|
||||
Boolean updateByBo(GearBomItemBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除BOM 明细,存放属性–值信息
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.gear.oa.service;
|
||||
|
||||
import com.gear.oa.domain.GearBom;
|
||||
import com.gear.oa.domain.vo.GearBomVo;
|
||||
import com.gear.oa.domain.bo.GearBomBo;
|
||||
import com.gear.common.core.page.TableDataInfo;
|
||||
import com.gear.common.core.domain.PageQuery;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* BOM 头,关联产品或原材料Service接口
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-08-19
|
||||
*/
|
||||
public interface IGearBomService {
|
||||
|
||||
/**
|
||||
* 查询BOM 头,关联产品或原材料
|
||||
*/
|
||||
GearBomVo queryById(Long bomId);
|
||||
|
||||
/**
|
||||
* 查询BOM 头,关联产品或原材料列表
|
||||
*/
|
||||
TableDataInfo<GearBomVo> queryPageList(GearBomBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询BOM 头,关联产品或原材料列表
|
||||
*/
|
||||
List<GearBomVo> queryList(GearBomBo bo);
|
||||
|
||||
/**
|
||||
* 新增BOM 头,关联产品或原材料
|
||||
*/
|
||||
Boolean insertByBo(GearBomBo bo);
|
||||
|
||||
/**
|
||||
* 修改BOM 头,关联产品或原材料
|
||||
*/
|
||||
Boolean updateByBo(GearBomBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除BOM 头,关联产品或原材料信息
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.gear.oa.service;
|
||||
|
||||
import com.gear.oa.domain.GearProductCategory;
|
||||
import com.gear.oa.domain.vo.GearProductCategoryVo;
|
||||
import com.gear.oa.domain.bo.GearProductCategoryBo;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 产品分类树Service接口
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-08-19
|
||||
*/
|
||||
public interface IGearProductCategoryService {
|
||||
|
||||
/**
|
||||
* 查询产品分类树
|
||||
*/
|
||||
GearProductCategoryVo queryById(Long categoryId);
|
||||
|
||||
|
||||
/**
|
||||
* 查询产品分类树列表
|
||||
*/
|
||||
List<GearProductCategoryVo> queryList(GearProductCategoryBo bo);
|
||||
|
||||
/**
|
||||
* 新增产品分类树
|
||||
*/
|
||||
Boolean insertByBo(GearProductCategoryBo bo);
|
||||
|
||||
/**
|
||||
* 修改产品分类树
|
||||
*/
|
||||
Boolean updateByBo(GearProductCategoryBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除产品分类树信息
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
package com.gear.oa.service;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import com.gear.oa.domain.vo.GearProductVo;
|
||||
import com.gear.oa.domain.bo.GearProductBo;
|
||||
import com.gear.common.core.page.TableDataInfo;
|
||||
import com.gear.common.core.domain.PageQuery;
|
||||
import com.gear.oa.domain.vo.dashboard.*;
|
||||
|
||||
/**
|
||||
* 产品Service接口
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-08-19
|
||||
*/
|
||||
public interface IGearProductService {
|
||||
|
||||
/**
|
||||
* 查询产品
|
||||
*/
|
||||
GearProductVo queryById(Long productId);
|
||||
|
||||
/**
|
||||
* 查询产品列表
|
||||
*/
|
||||
TableDataInfo<GearProductVo> queryPageList(GearProductBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询产品列表
|
||||
*/
|
||||
List<GearProductVo> queryList(GearProductBo bo);
|
||||
|
||||
/**
|
||||
* 新增产品
|
||||
*/
|
||||
Boolean insertByBo(GearProductBo bo);
|
||||
|
||||
/**
|
||||
* 修改产品
|
||||
*/
|
||||
Boolean updateByBo(GearProductBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除产品信息
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
/**
|
||||
* 数据看板 - 获取所有数据
|
||||
*/
|
||||
ProductDashboardVO getDashboard();
|
||||
|
||||
/**
|
||||
* 数据看板 - 产品销售情况
|
||||
*/
|
||||
List<ProductSalesPerformanceVO> selectProductSalesPerformance();
|
||||
|
||||
/**
|
||||
* 数据看板 - 销售人员业绩
|
||||
*/
|
||||
List<SalesPersonPerformanceVO> selectSalesPersonPerformance();
|
||||
|
||||
/**
|
||||
* 数据看板 - 总订单数量统计
|
||||
*/
|
||||
OrderCountStatisticsVO selectOrderCountStatistics();
|
||||
|
||||
/**
|
||||
* 数据看板 - 订单所需的产品统计
|
||||
*/
|
||||
List<OrderProductStatisticsVO> selectOrderProductStatistics();
|
||||
|
||||
/**
|
||||
* 数据看板 - 根据BOM计算的原料需求
|
||||
*/
|
||||
List<ProductMaterialRequirementVO> selectProductMaterialRequirements();
|
||||
|
||||
/**
|
||||
* 数据看板 - 原料库存和需求情况
|
||||
*/
|
||||
List<RawMaterialInventoryVO> selectRawMaterialInventory();
|
||||
|
||||
/**
|
||||
* 数据看板 - 订单维度推荐
|
||||
*/
|
||||
List<OrderRecommendationVO> selectOrderRecommendations();
|
||||
|
||||
/**
|
||||
* 数据看板 - 原料维度推荐
|
||||
*/
|
||||
List<MaterialRecommendationVO> selectMaterialRecommendations();
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
package com.gear.oa.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.gear.common.utils.StringUtils;
|
||||
import com.gear.common.core.page.TableDataInfo;
|
||||
import com.gear.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.gear.oa.domain.bo.GearBomItemBo;
|
||||
import com.gear.oa.domain.vo.GearBomItemVo;
|
||||
import com.gear.oa.domain.GearBomItem;
|
||||
import com.gear.oa.mapper.GearBomItemMapper;
|
||||
import com.gear.oa.service.IGearBomItemService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* BOM 明细,存放属性–值Service业务层处理
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-08-19
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class GearBomItemServiceImpl implements IGearBomItemService {
|
||||
|
||||
private final GearBomItemMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询BOM 明细,存放属性–值
|
||||
*/
|
||||
@Override
|
||||
public GearBomItemVo queryById(Long itemId){
|
||||
return baseMapper.selectVoById(itemId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询BOM 明细,存放属性–值列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<GearBomItemVo> queryPageList(GearBomItemBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<GearBomItem> lqw = buildQueryWrapper(bo);
|
||||
Page<GearBomItemVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询BOM 明细,存放属性–值列表
|
||||
*/
|
||||
@Override
|
||||
public List<GearBomItemVo> queryList(GearBomItemBo bo) {
|
||||
LambdaQueryWrapper<GearBomItem> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<GearBomItem> buildQueryWrapper(GearBomItemBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<GearBomItem> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(bo.getBomId() != null, GearBomItem::getBomId, bo.getBomId());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getAttrKey()), GearBomItem::getAttrKey, bo.getAttrKey());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getAttrValue()), GearBomItem::getAttrValue, bo.getAttrValue());
|
||||
lqw.eq(bo.getIsEnabled() != null, GearBomItem::getIsEnabled, bo.getIsEnabled());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增BOM 明细,存放属性–值
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(GearBomItemBo bo) {
|
||||
GearBomItem add = BeanUtil.toBean(bo, GearBomItem.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setItemId(add.getItemId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改BOM 明细,存放属性–值
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(GearBomItemBo bo) {
|
||||
GearBomItem update = BeanUtil.toBean(bo, GearBomItem.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(GearBomItem entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除BOM 明细,存放属性–值
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteBatchIds(ids) > 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
package com.gear.oa.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.gear.common.utils.StringUtils;
|
||||
import com.gear.common.core.page.TableDataInfo;
|
||||
import com.gear.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.gear.oa.domain.bo.GearBomBo;
|
||||
import com.gear.oa.domain.vo.GearBomVo;
|
||||
import com.gear.oa.domain.GearBom;
|
||||
import com.gear.oa.mapper.GearBomMapper;
|
||||
import com.gear.oa.service.IGearBomService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* BOM 头,关联产品或原材料Service业务层处理
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-08-19
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class GearBomServiceImpl implements IGearBomService {
|
||||
|
||||
private final GearBomMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询BOM 头,关联产品或原材料
|
||||
*/
|
||||
@Override
|
||||
public GearBomVo queryById(Long bomId){
|
||||
return baseMapper.selectVoById(bomId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询BOM 头,关联产品或原材料列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<GearBomVo> queryPageList(GearBomBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<GearBom> lqw = buildQueryWrapper(bo);
|
||||
Page<GearBomVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询BOM 头,关联产品或原材料列表
|
||||
*/
|
||||
@Override
|
||||
public List<GearBomVo> queryList(GearBomBo bo) {
|
||||
LambdaQueryWrapper<GearBom> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<GearBom> buildQueryWrapper(GearBomBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<GearBom> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getBomCode()), GearBom::getBomCode, bo.getBomCode());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getBomName()), GearBom::getBomName, bo.getBomName());
|
||||
lqw.eq(bo.getIsEnabled() != null, GearBom::getIsEnabled, bo.getIsEnabled());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增BOM 头,关联产品或原材料
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(GearBomBo bo) {
|
||||
GearBom add = BeanUtil.toBean(bo, GearBom.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setBomId(add.getBomId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改BOM 头,关联产品或原材料
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(GearBomBo bo) {
|
||||
GearBom update = BeanUtil.toBean(bo, GearBom.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(GearBom entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除BOM 头,关联产品或原材料
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteBatchIds(ids) > 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
package com.gear.oa.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.gear.common.utils.StringUtils;
|
||||
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.gear.oa.domain.bo.GearProductCategoryBo;
|
||||
import com.gear.oa.domain.vo.GearProductCategoryVo;
|
||||
import com.gear.oa.domain.GearProductCategory;
|
||||
import com.gear.oa.mapper.GearProductCategoryMapper;
|
||||
import com.gear.oa.service.IGearProductCategoryService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 产品分类树Service业务层处理
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-08-19
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class GearProductCategoryServiceImpl implements IGearProductCategoryService {
|
||||
|
||||
private final GearProductCategoryMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询产品分类树
|
||||
*/
|
||||
@Override
|
||||
public GearProductCategoryVo queryById(Long categoryId){
|
||||
return baseMapper.selectVoById(categoryId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询产品分类树列表
|
||||
*/
|
||||
@Override
|
||||
public List<GearProductCategoryVo> queryList(GearProductCategoryBo bo) {
|
||||
LambdaQueryWrapper<GearProductCategory> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<GearProductCategory> buildQueryWrapper(GearProductCategoryBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<GearProductCategory> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(bo.getParentId() != null, GearProductCategory::getParentId, bo.getParentId());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getCategoryName()), GearProductCategory::getCategoryName, bo.getCategoryName());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getCategoryType()), GearProductCategory::getCategoryType, bo.getCategoryType());
|
||||
//同级排序号需要order by asc
|
||||
lqw.orderByAsc(GearProductCategory::getSortNo);
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增产品分类树
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(GearProductCategoryBo bo) {
|
||||
GearProductCategory add = BeanUtil.toBean(bo, GearProductCategory.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setCategoryId(add.getCategoryId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改产品分类树
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(GearProductCategoryBo bo) {
|
||||
GearProductCategory update = BeanUtil.toBean(bo, GearProductCategory.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(GearProductCategory entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除产品分类树
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteBatchIds(ids) > 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,228 @@
|
||||
package com.gear.oa.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.gear.common.utils.StringUtils;
|
||||
import com.gear.common.core.page.TableDataInfo;
|
||||
import com.gear.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.beans.factory.annotation.Autowired;
|
||||
import com.gear.oa.domain.bo.GearProductBo;
|
||||
import com.gear.oa.domain.vo.GearProductVo;
|
||||
import com.gear.oa.domain.vo.dashboard.*;
|
||||
import com.gear.oa.domain.GearProduct;
|
||||
import com.gear.oa.mapper.GearProductMapper;
|
||||
import com.gear.oa.service.IGearProductService;
|
||||
|
||||
/**
|
||||
* 产品Service业务层处理
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-08-19
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class GearProductServiceImpl implements IGearProductService {
|
||||
|
||||
private final GearProductMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询产品
|
||||
*/
|
||||
@Override
|
||||
public GearProductVo queryById(Long productId) {
|
||||
return baseMapper.selectVoById(productId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询产品列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<GearProductVo> queryPageList(GearProductBo bo, PageQuery pageQuery) {
|
||||
QueryWrapper<GearProduct> qw = buildQueryWrapperPlus(bo);
|
||||
Page<GearProductVo> result = baseMapper.selectVoPagePlus(pageQuery.build(), qw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
public QueryWrapper<GearProduct> buildQueryWrapperPlus(GearProductBo bo) {
|
||||
QueryWrapper<GearProduct> queryWrapper = new QueryWrapper<>();
|
||||
// 构建查询条件
|
||||
if (bo.getProductId() != null) {
|
||||
queryWrapper.eq("p.product_id", bo.getProductId());
|
||||
}
|
||||
if (bo.getCategoryId() != null) {
|
||||
queryWrapper.eq("p.category_id", bo.getCategoryId());
|
||||
}
|
||||
if (StringUtils.isNotBlank(bo.getProductCode())) {
|
||||
queryWrapper.like("p.product_code", bo.getProductCode());
|
||||
}
|
||||
if (StringUtils.isNotBlank(bo.getProductName())) {
|
||||
queryWrapper.like("p.product_name", bo.getProductName());
|
||||
}
|
||||
if (StringUtils.isNotBlank(bo.getOwner())) {
|
||||
queryWrapper.eq("p.owner", bo.getOwner());
|
||||
}
|
||||
if (StringUtils.isNotBlank(bo.getUnit())) {
|
||||
queryWrapper.eq("p.unit", bo.getUnit());
|
||||
}
|
||||
if (bo.getBomId() != null) {
|
||||
queryWrapper.eq("p.bom_id", bo.getBomId());
|
||||
}
|
||||
if (StringUtils.isNotBlank(bo.getType())) {
|
||||
queryWrapper.eq("p.type", bo.getType());
|
||||
}
|
||||
if (bo.getIsEnabled() != null) {
|
||||
queryWrapper.eq("p.is_enabled", bo.getIsEnabled());
|
||||
}
|
||||
return queryWrapper;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询产品列表
|
||||
*/
|
||||
@Override
|
||||
public List<GearProductVo> queryList(GearProductBo bo) {
|
||||
LambdaQueryWrapper<GearProduct> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<GearProduct> buildQueryWrapper(GearProductBo bo) {
|
||||
LambdaQueryWrapper<GearProduct> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(bo.getProductId() != null, GearProduct::getProductId, bo.getProductId());
|
||||
lqw.eq(bo.getCategoryId()!= null, GearProduct::getCategoryId, bo.getCategoryId());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getProductCode()), GearProduct::getProductCode, bo.getProductCode());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getProductName()), GearProduct::getProductName, bo.getProductName());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getOwner()), GearProduct::getOwner, bo.getOwner());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getUnit()), GearProduct::getUnit, bo.getUnit());
|
||||
lqw.eq(bo.getBomId() != null, GearProduct::getBomId, bo.getBomId());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getType()), GearProduct::getType, bo.getType());
|
||||
lqw.eq(bo.getIsEnabled() != null, GearProduct::getIsEnabled, bo.getIsEnabled());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增产品
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(GearProductBo bo) {
|
||||
GearProduct add = new GearProduct();
|
||||
// 设置属性
|
||||
// ...
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setProductId(add.getProductId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改产品
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(GearProductBo bo) {
|
||||
GearProduct update = new GearProduct();
|
||||
// 设置属性
|
||||
// ...
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除产品
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if (isValid) {
|
||||
// 做一些校验
|
||||
}
|
||||
return baseMapper.deleteBatchIds(ids) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据看板 - 获取所有数据
|
||||
*/
|
||||
@Override
|
||||
public ProductDashboardVO getDashboard() {
|
||||
ProductDashboardVO dashboard = new ProductDashboardVO();
|
||||
dashboard.setProductSalesPerformance(selectProductSalesPerformance());
|
||||
dashboard.setSalesPersonPerformance(selectSalesPersonPerformance());
|
||||
dashboard.setOrderCountStatistics(selectOrderCountStatistics());
|
||||
dashboard.setOrderProductStatistics(selectOrderProductStatistics());
|
||||
dashboard.setProductMaterialRequirements(selectProductMaterialRequirements());
|
||||
dashboard.setRawMaterialInventory(selectRawMaterialInventory());
|
||||
dashboard.setOrderRecommendations(selectOrderRecommendations());
|
||||
dashboard.setMaterialRecommendations(selectMaterialRecommendations());
|
||||
return dashboard;
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据看板 - 产品销售情况
|
||||
*/
|
||||
@Override
|
||||
public List<ProductSalesPerformanceVO> selectProductSalesPerformance() {
|
||||
return baseMapper.selectProductSalesPerformance();
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据看板 - 销售人员业绩
|
||||
*/
|
||||
@Override
|
||||
public List<SalesPersonPerformanceVO> selectSalesPersonPerformance() {
|
||||
return baseMapper.selectSalesPersonPerformance();
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据看板 - 总订单数量统计
|
||||
*/
|
||||
@Override
|
||||
public OrderCountStatisticsVO selectOrderCountStatistics() {
|
||||
return baseMapper.selectOrderCountStatistics();
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据看板 - 订单所需的产品统计
|
||||
*/
|
||||
@Override
|
||||
public List<OrderProductStatisticsVO> selectOrderProductStatistics() {
|
||||
return baseMapper.selectOrderProductStatistics();
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据看板 - 根据BOM计算的原料需求
|
||||
*/
|
||||
@Override
|
||||
public List<ProductMaterialRequirementVO> selectProductMaterialRequirements() {
|
||||
return baseMapper.selectProductMaterialRequirements();
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据看板 - 原料库存和需求情况
|
||||
*/
|
||||
@Override
|
||||
public List<RawMaterialInventoryVO> selectRawMaterialInventory() {
|
||||
return baseMapper.selectRawMaterialInventory();
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据看板 - 订单维度推荐
|
||||
*/
|
||||
@Override
|
||||
public List<OrderRecommendationVO> selectOrderRecommendations() {
|
||||
return baseMapper.selectOrderRecommendations();
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据看板 - 原料维度推荐
|
||||
*/
|
||||
@Override
|
||||
public List<MaterialRecommendationVO> selectMaterialRecommendations() {
|
||||
return baseMapper.selectMaterialRecommendations();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user