Skip to content

Commit

Permalink
Merge pull request #266 from Jzow/master
Browse files Browse the repository at this point in the history
Add a line function and fix some bugs
  • Loading branch information
Jzow authored Dec 7, 2023
2 parents 4680410 + 9d25b33 commit b2dd430
Show file tree
Hide file tree
Showing 30 changed files with 1,362 additions and 236 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,16 @@

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.wansenai.dto.product.QueryProductStockKeepUnitDTO;
import com.wansenai.service.product.ProductStockKeepUnitService;
import com.wansenai.dto.report.QueryProductStockDTO;
import com.wansenai.service.product.ProductStockService;
import com.wansenai.utils.enums.BaseCodeEnum;
import com.wansenai.utils.response.Response;
import com.wansenai.vo.product.ProductStockKeepUnitVO;
import com.wansenai.vo.report.ProductStockSkuVO;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
* <p>
* 产品价格扩展 前端控制器
Expand Down Expand Up @@ -52,4 +55,9 @@ public Response<IPage<ProductStockKeepUnitVO>> getProductExtendPrice(@RequestBod
public Response<ProductStockKeepUnitVO> getProductByBarCode(@PathVariable("barCode") String barCode, @PathVariable("warehouseId")Long warehouseId) {
return productStockService.getProductByBarCode(barCode, warehouseId);
}

@PostMapping("productStockSku")
public Response<List<ProductStockSkuVO>> getProductStockInfo(@RequestBody QueryProductStockDTO queryProductStockDTO) {
return productStockService.getProductStockSkuList(queryProductStockDTO);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public Response<StatisticalDataVO> getStatisticalData() {
}

@PostMapping("productStock")
public Response<IPage<ProductStockVO>> getProductStock(@RequestBody QueryProductStockDTO queryProductStockDTO) {
public Response<IPage<ProductStockSkuVO>> getProductStock(@RequestBody QueryProductStockDTO queryProductStockDTO) {
return receiptService.getProductStock(queryProductStockDTO);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import com.wansenai.entities.product.ProductStock;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wansenai.vo.product.ProductStockKeepUnitVO;
import com.wansenai.vo.report.ProductStockVO;
import com.wansenai.vo.report.ProductStockSkuVO;

import java.util.List;

Expand All @@ -36,7 +36,7 @@ public interface ProductStockMapper extends BaseMapper<ProductStock> {

ProductStockKeepUnitVO getProductSkuDetail(Long productId, Long warehouseId, String barCode);

Page<ProductStockVO> getProductStock(IPage<QueryProductStockDTO> pageObject, QueryProductStockDTO queryProductStockDTO);
Page<ProductStockSkuVO> getProductStock(IPage<QueryProductStockDTO> pageObject, QueryProductStockDTO queryProductStockDTO);

List<ProductStockVO> getProductStockList(QueryProductStockDTO queryProductStockDTO);
List<ProductStockSkuVO> getProductStockList(QueryProductStockDTO queryProductStockDTO);
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
WHERE p.id= #{productId} AND ps.warehouse_id = #{warehouseId} AND sku.product_bar_code = #{barCode}
</select>

<select id="getProductStock" resultType="com.wansenai.vo.report.ProductStockVO" parameterType="com.baomidou.mybatisplus.extension.plugins.pagination.Page">
<select id="getProductStock" resultType="com.wansenai.vo.report.ProductStockSkuVO" parameterType="com.baomidou.mybatisplus.extension.plugins.pagination.Page">
SELECT ps.id, p.product_name, p.id AS productId, p.product_model, p.product_standard, p.product_color,sku.product_bar_code, p.product_weight, p.warehouse_shelves,
sku.product_unit, sku.retail_price AS unit_price, p.product_manufacturer,pc.category_name AS product_category_name,
ps.current_stock_quantity AS current_stock, ps.init_stock_quantity AS initial_stock, w.warehouse_name, w.id AS warehouseId,
Expand All @@ -94,7 +94,7 @@
</where>
</select>

<select id="getProductStockList" resultType="com.wansenai.vo.report.ProductStockVO" parameterType="com.wansenai.dto.report.QueryProductStockDTO">
<select id="getProductStockList" resultType="com.wansenai.vo.report.ProductStockSkuVO" parameterType="com.wansenai.dto.report.QueryProductStockDTO">
SELECT ps.id, p.product_name, p.id AS productId, p.product_model, p.product_standard, p.product_color,sku.product_bar_code, p.product_weight, p.warehouse_shelves,
sku.product_unit, sku.retail_price AS unit_price, p.product_manufacturer,pc.category_name AS product_category_name,
ps.current_stock_quantity AS current_stock, ps.init_stock_quantity AS initial_stock, w.warehouse_name, w.id AS warehouseId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import java.math.BigDecimal;

@Data
public class ProductStockVO {
public class ProductStockSkuVO {

@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,38 +142,32 @@ public Operator getOperatorById(Long id) {

@Override
public Response<List<OperatorVO>> getOperatorListByType(String type) {
if(!StringUtils.hasLength(type)) {
return Response.responseMsg(BaseCodeEnum.PARAMETER_NULL);
}

var operatorVOS = new ArrayList<OperatorVO>();
if (type.equals("所有")) {
var operator = lambdaQuery()
.eq(Operator::getStatus, CommonConstants.STATUS_NORMAL)
.eq(Operator::getDeleteFlag, CommonConstants.NOT_DELETED)
.list();
if (operator.isEmpty()) {
return Response.responseMsg(BaseCodeEnum.QUERY_DATA_EMPTY);
if (!operator.isEmpty()) {
operator.forEach(item -> {
OperatorVO operatorVO = new OperatorVO();
BeanUtils.copyProperties(item, operatorVO);
operatorVOS.add(operatorVO);
});
}
operator.forEach(item -> {
OperatorVO operatorVO = new OperatorVO();
BeanUtils.copyProperties(item, operatorVO);
operatorVOS.add(operatorVO);
});
} else {
var operator = lambdaQuery()
.eq(Operator::getType, type)
.eq(Operator::getStatus, CommonConstants.STATUS_NORMAL)
.eq(Operator::getDeleteFlag, CommonConstants.NOT_DELETED)
.list();
if (operator.isEmpty()) {
return Response.responseMsg(BaseCodeEnum.QUERY_DATA_EMPTY);
if (!operator.isEmpty()) {
operator.forEach(item -> {
OperatorVO operatorVO = new OperatorVO();
BeanUtils.copyProperties(item, operatorVO);
operatorVOS.add(operatorVO);
});
}
operator.forEach(item -> {
OperatorVO operatorVO = new OperatorVO();
BeanUtils.copyProperties(item, operatorVO);
operatorVOS.add(operatorVO);
});
}
return Response.responseData(operatorVOS);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.wansenai.dto.product.QueryProductStockKeepUnitDTO;
import com.wansenai.dto.report.QueryProductStockDTO;
import com.wansenai.entities.product.ProductStock;
import com.baomidou.mybatisplus.extension.service.IService;
import com.wansenai.utils.response.Response;
import com.wansenai.vo.product.ProductStockKeepUnitVO;
import com.wansenai.vo.product.ProductStockVO;
import com.wansenai.vo.report.ProductStockSkuVO;

import java.util.List;

Expand All @@ -35,4 +37,5 @@ public interface ProductStockService extends IService<ProductStock> {

List<ProductStockVO> getProductStockList(Long productSukId);

Response<List<ProductStockSkuVO>> getProductStockSkuList(QueryProductStockDTO queryProductStockDTO);
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wansenai.mappers.product.ProductStockMapper;
import com.wansenai.service.BaseService;
import com.wansenai.utils.SnowflakeIdUtil;
import com.wansenai.dto.product.*;
Expand Down Expand Up @@ -61,14 +62,17 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl

private final BaseService baseService;

public ProductServiceImpl(ProductMapper productMapper, ProductStockKeepUnitService productStockKeepUnitService, ProductStockService productStockService, ProductCategoryService productCategoryService, ProductImageService productImageService, ProductUnitService productUnitService, BaseService baseService) {
private final ProductStockMapper productStockMapper;

public ProductServiceImpl(ProductMapper productMapper, ProductStockKeepUnitService productStockKeepUnitService, ProductStockService productStockService, ProductCategoryService productCategoryService, ProductImageService productImageService, ProductUnitService productUnitService, BaseService baseService, ProductStockMapper productStockMapper) {
this.productMapper = productMapper;
this.productStockKeepUnitService = productStockKeepUnitService;
this.productStockService = productStockService;
this.productCategoryService = productCategoryService;
this.productImageService = productImageService;
this.productUnitService = productUnitService;
this.baseService = baseService;
this.productStockMapper = productStockMapper;
}

public String getStringValue(String str) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,17 @@

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wansenai.dto.product.QueryProductStockKeepUnitDTO;
import com.wansenai.service.product.ProductStockService;
import com.wansenai.dto.report.QueryProductStockDTO;
import com.wansenai.entities.product.ProductStock;
import com.wansenai.mappers.product.ProductStockMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wansenai.service.product.ProductStockService;
import com.wansenai.service.warehouse.WarehouseService;
import com.wansenai.utils.response.Response;
import com.wansenai.vo.product.ProductStockKeepUnitVO;
import com.wansenai.vo.product.ProductStockVO;
import com.wansenai.vo.report.ProductStockSkuVO;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

Expand Down Expand Up @@ -76,4 +78,10 @@ public List<ProductStockVO> getProductStockList(Long productSukId) {

return productStockVos;
}

@Override
public Response<List<ProductStockSkuVO>> getProductStockSkuList(QueryProductStockDTO queryProductStockDTO) {
var data = productStockMapper.getProductStockList(queryProductStockDTO);
return Response.responseData(data);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public interface ReceiptService {

Response<Page<ReceiptDetailVO>> getOtherDetail(QueryReceiptDTO receiptDTO);

Response<IPage<ProductStockVO>> getProductStock(QueryProductStockDTO queryProductStockDTO);
Response<IPage<ProductStockSkuVO>> getProductStock(QueryProductStockDTO queryProductStockDTO);

Response<Page<StockFlowVO>> getStockFlow(QueryStockFlowDTO queryStockFlowDTO);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,7 @@ private Page<ReceiptDetailVO> getReceiptPurchaseDetailVOList(QueryReceiptDTO rec
}

@Override
public Response<IPage<ProductStockVO>> getProductStock(QueryProductStockDTO queryProductStockDTO) {
public Response<IPage<ProductStockSkuVO>> getProductStock(QueryProductStockDTO queryProductStockDTO) {
var page = new Page<QueryProductStockDTO>(queryProductStockDTO.getPage(), queryProductStockDTO.getPageSize());
// 获取默认仓库
// var warehouse = warehouseService.getDefaultWarehouse();
Expand Down
28 changes: 28 additions & 0 deletions web/src/api/product/model/productModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@ export interface QueryProductReq {
enableBatchNumber: number
}

export interface ProductStockSkuReq {
warehouseId: number | string;
productInfo: string;
productCategoryId: number | string;
warehouseShelves: string;
isExportDetail: boolean;
}

export interface ProductInfoDetailResp {
productId: string;
productCategoryId: string;
Expand Down Expand Up @@ -106,6 +114,26 @@ export interface ProductPriceResp {
stockList: ProductStockResp[];
}

export interface ProductStockSkuResp {
id: string;
productId: string;
warehouseId: string;
productBarcode: string;
warehouseName: string;
productName: string;
productCategoryName: string;
productStandard: string;
productModel: string;
productColor: string;
productUnit: string;
warehouseShelves: string;
productWeight: number;
unitPrice: number;
initialStock: number;
currentStock: number;
stockAmount: number;
}

export interface ProductStockResp {
productStockId: number | string;
warehouseId: number | string;
Expand Down
12 changes: 11 additions & 1 deletion web/src/api/product/product.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
QueryProductReq,
UpdateBatchProductInfoReq,
ProductExtendPriceResp,
QueryProductExtendPriceReq,
QueryProductExtendPriceReq, ProductStockSkuReq, ProductStockSkuResp,
} from "@/api/product/model/productModel";
import {ErrorMessageMode, SuccessMessageMode} from "#/axios";

Expand All @@ -20,6 +20,7 @@ enum Api {
updateBatchProductInfo = '/product/updateBatchProductInfo',
getProductSku = '/product/sku/pageList',
getProductSkuByBarCode = '/product/sku/getProduct',
getProductListInfo = '/product/sku/productStockSku'
}

export function getProductCode() {
Expand Down Expand Up @@ -112,4 +113,13 @@ export function getProductSkuByBarCode(barCode: number | string, warehouseId: nu
url: `${Api.getProductSkuByBarCode}/${barCode}/${warehouseId}`,
}
);
}

export function getProductStockSku(params: ProductStockSkuReq) {
return defHttp.post<BaseDataResp<ProductStockSkuResp[]>>(
{
url: Api.getProductListInfo,
params
}
);
}
Loading

0 comments on commit b2dd430

Please sign in to comment.