Merge remote-tracking branch 'origin/test' into test
This commit is contained in:
commit
b6792ccf99
|
|
@ -41,12 +41,6 @@ public class TbConsInfoFlowController {
|
||||||
public ResponseEntity<Object> stockCount(@RequestBody TbProductStockCountQueryCriteria criteria) throws ParseException {
|
public ResponseEntity<Object> stockCount(@RequestBody TbProductStockCountQueryCriteria criteria) throws ParseException {
|
||||||
return new ResponseEntity<>(tbConsInfoFlowService.stockCount(criteria),HttpStatus.OK);
|
return new ResponseEntity<>(tbConsInfoFlowService.stockCount(criteria),HttpStatus.OK);
|
||||||
}
|
}
|
||||||
//
|
|
||||||
// @PostMapping("/list")
|
|
||||||
// @ApiOperation("耗材库存统计列表")
|
|
||||||
// public ResponseEntity<Object> stockList(@RequestBody TbProductStockCountQueryCriteria criteria) throws ParseException {
|
|
||||||
// return new ResponseEntity<>(tbConsInfoFlowService.stockList(criteria),HttpStatus.OK);
|
|
||||||
// }
|
|
||||||
|
|
||||||
@PostMapping("/stock")
|
@PostMapping("/stock")
|
||||||
@ApiOperation("耗材库存记录列表")
|
@ApiOperation("耗材库存记录列表")
|
||||||
|
|
|
||||||
|
|
@ -18,11 +18,6 @@ import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
|
|
||||||
/**
|
|
||||||
* @website https://eladmin.vip
|
|
||||||
* @author lyf
|
|
||||||
* @date 2024-01-19
|
|
||||||
**/
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@Api(tags = "商品库存记录管理")
|
@Api(tags = "商品库存记录管理")
|
||||||
|
|
@ -60,7 +55,7 @@ public class TbProductStockDetailController {
|
||||||
|
|
||||||
@PostMapping("/stock")
|
@PostMapping("/stock")
|
||||||
@ApiOperation("商品库存记录列表")
|
@ApiOperation("商品库存记录列表")
|
||||||
public ResponseEntity<Object> queryPage(@RequestBody TbProductStockDetailQueryCriteria criteria){
|
public ResponseEntity<Object> queryPage(@RequestBody TbProductStockDetailQueryCriteria criteria) throws ParseException {
|
||||||
return new ResponseEntity<>(tbProductStockDetailService.queryPage(criteria),HttpStatus.OK);
|
return new ResponseEntity<>(tbProductStockDetailService.queryPage(criteria),HttpStatus.OK);
|
||||||
}
|
}
|
||||||
// @GetMapping("/sum")
|
// @GetMapping("/sum")
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,6 @@ import cn.ysk.cashier.dto.BaseQueryDto;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
/**
|
|
||||||
* @website https://eladmin.vip
|
|
||||||
* @author lyf
|
|
||||||
* @date 2024-01-19
|
|
||||||
**/
|
|
||||||
@Data
|
@Data
|
||||||
public class TbProductStockCountQueryCriteria extends BaseQueryDto {
|
public class TbProductStockCountQueryCriteria extends BaseQueryDto {
|
||||||
|
|
||||||
|
|
@ -18,6 +13,8 @@ public class TbProductStockCountQueryCriteria extends BaseQueryDto {
|
||||||
|
|
||||||
private String categoryId;
|
private String categoryId;
|
||||||
|
|
||||||
|
private String type;
|
||||||
|
|
||||||
private Integer page = 0;
|
private Integer page = 0;
|
||||||
|
|
||||||
private Integer size = 10;
|
private Integer size = 10;
|
||||||
|
|
@ -39,4 +36,10 @@ public class TbProductStockCountQueryCriteria extends BaseQueryDto {
|
||||||
this.categoryId = categoryId;
|
this.categoryId = categoryId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setType(String type) {
|
||||||
|
if (StringUtils.isNotBlank(type)) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,42 +1,14 @@
|
||||||
package cn.ysk.cashier.dto.product;
|
package cn.ysk.cashier.dto.product;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import cn.ysk.cashier.annotation.Query;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @website https://eladmin.vip
|
|
||||||
* @author lyf
|
|
||||||
* @date 2024-01-19
|
|
||||||
**/
|
|
||||||
@Data
|
@Data
|
||||||
public class TbProductStockDetailQueryCriteria{
|
public class TbProductStockDetailQueryCriteria extends TbProductStockCountQueryCriteria{
|
||||||
|
|
||||||
/** 精确 */
|
|
||||||
// @Query
|
|
||||||
// private String skuId;
|
|
||||||
|
|
||||||
/** 精确 */
|
|
||||||
@Query
|
|
||||||
private String productId;
|
|
||||||
@Query
|
|
||||||
private String shopId;
|
|
||||||
/** 精确 */
|
|
||||||
// @Query
|
|
||||||
// private String productName;
|
|
||||||
|
|
||||||
private String column;
|
private String column;
|
||||||
|
//操作类型
|
||||||
@Query(type = Query.Type.IN)
|
private List<String> types;
|
||||||
private List<String> type;
|
|
||||||
/** BETWEEN */
|
|
||||||
@Query(type = Query.Type.BETWEEN)
|
|
||||||
private List<Long> createdAt;
|
|
||||||
// @Query
|
|
||||||
// private Long createTime;
|
|
||||||
// @Query
|
|
||||||
// private Long endTime;
|
|
||||||
|
|
||||||
private Integer page;
|
private Integer page;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,12 +9,6 @@ import org.springframework.data.jpa.repository.Query;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author lyf
|
|
||||||
* @website https://eladmin.vip
|
|
||||||
* @date 2024-03-02
|
|
||||||
**/
|
|
||||||
public interface ProductStockCountRepository extends JpaRepository<TbProductStockListDto, Integer> {
|
public interface ProductStockCountRepository extends JpaRepository<TbProductStockListDto, Integer> {
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -34,7 +28,8 @@ public interface ProductStockCountRepository extends JpaRepository<TbProductStoc
|
||||||
" INNER JOIN tb_product pro ON d.product_id = pro.id " +
|
" INNER JOIN tb_product pro ON d.product_id = pro.id " +
|
||||||
" AND pro.shop_id = :shopId " +
|
" AND pro.shop_id = :shopId " +
|
||||||
" AND (:categoryId IS NULL OR pro.category_id = :categoryId) " +
|
" AND (:categoryId IS NULL OR pro.category_id = :categoryId) " +
|
||||||
" AND (:productName IS NULL OR d.product_name LIKE %:productName%) " +
|
" AND (:productName IS NULL OR pro.name LIKE %:productName%) " +
|
||||||
|
" AND (:type IS NULL OR pro.type_enum = :type) " +
|
||||||
" WHERE " +
|
" WHERE " +
|
||||||
" d.shop_id = :shopId " +
|
" d.shop_id = :shopId " +
|
||||||
"AND d.created_at > :startTime " +
|
"AND d.created_at > :startTime " +
|
||||||
|
|
@ -47,7 +42,8 @@ public interface ProductStockCountRepository extends JpaRepository<TbProductStoc
|
||||||
" INNER JOIN tb_product pro ON d.product_id = pro.id " +
|
" INNER JOIN tb_product pro ON d.product_id = pro.id " +
|
||||||
" and pro.shop_id = :shopId " +
|
" and pro.shop_id = :shopId " +
|
||||||
" and (:categoryId IS NULL OR pro.category_id = :categoryId) " +
|
" and (:categoryId IS NULL OR pro.category_id = :categoryId) " +
|
||||||
" AND (:productName IS NULL OR d.product_name LIKE %:productName%) " +
|
" AND (:productName IS NULL OR pro.name LIKE %:productName%) " +
|
||||||
|
" AND (:type IS NULL OR pro.type_enum = :type) " +
|
||||||
" WHERE " +
|
" WHERE " +
|
||||||
" d.shop_id = :shopId " +
|
" d.shop_id = :shopId " +
|
||||||
" AND d.created_at > :startTime " +
|
" AND d.created_at > :startTime " +
|
||||||
|
|
@ -55,9 +51,8 @@ public interface ProductStockCountRepository extends JpaRepository<TbProductStoc
|
||||||
" GROUP BY " +
|
" GROUP BY " +
|
||||||
" d.product_id "
|
" d.product_id "
|
||||||
, nativeQuery = true)
|
, nativeQuery = true)
|
||||||
Page<TbProductStockListDto> productStock(String shopId,
|
Page<TbProductStockListDto> productStock(String shopId, String productName, String categoryId, String type,
|
||||||
String productName,
|
long startTime, long endTime, Pageable pageable);
|
||||||
String categoryId, long startTime, long endTime, Pageable pageable);
|
|
||||||
|
|
||||||
@Query("SELECT new cn.ysk.cashier.vo.TbProductStockCountVo( " +
|
@Query("SELECT new cn.ysk.cashier.vo.TbProductStockCountVo( " +
|
||||||
" SUM( pro.stockNumber ) , " +
|
" SUM( pro.stockNumber ) , " +
|
||||||
|
|
@ -70,17 +65,18 @@ public interface ProductStockCountRepository extends JpaRepository<TbProductStoc
|
||||||
" SUM( CASE WHEN detail.type = '退单' THEN ABS(detail.stockNumber) ELSE 0 END ))" +
|
" SUM( CASE WHEN detail.type = '退单' THEN ABS(detail.stockNumber) ELSE 0 END ))" +
|
||||||
"FROM " +
|
"FROM " +
|
||||||
" TbProductStockDetail detail " +
|
" TbProductStockDetail detail " +
|
||||||
" INNER JOIN TbProduct pro ON detail.productId = pro.id " +
|
" INNER JOIN TbProduct pro ON detail.productId = pro.id " +
|
||||||
" AND pro.shopId = :shopId " +
|
" AND pro.shopId = :shopId " +
|
||||||
" AND ( :categoryId IS NULL OR pro.categoryId = :categoryId ) " +
|
" AND ( :categoryId IS NULL OR pro.categoryId = :categoryId ) " +
|
||||||
" AND ( :productName IS NULL OR detail.productName LIKE %:productName% ) " +
|
" AND ( :productName IS NULL OR pro.name LIKE %:productName% ) " +
|
||||||
|
" AND ( :type IS NULL OR pro.typeEnum = :type ) " +
|
||||||
"WHERE " +
|
"WHERE " +
|
||||||
" detail.shopId = :shopId " +
|
" detail.shopId = :shopId " +
|
||||||
" AND detail.createdAt > :startTime " +
|
" AND detail.createdAt > :startTime " +
|
||||||
" AND detail.createdAt < :endTime")
|
" AND detail.createdAt < :endTime")
|
||||||
TbProductStockCountVo productStockCount(String shopId,
|
TbProductStockCountVo productStockCount(String shopId,
|
||||||
String productName,
|
String productName,
|
||||||
String categoryId, long startTime, long endTime);
|
String categoryId, String type, long startTime, long endTime);
|
||||||
|
|
||||||
|
|
||||||
@Query(value = "SELECT " +
|
@Query(value = "SELECT " +
|
||||||
|
|
|
||||||
|
|
@ -1,35 +1,28 @@
|
||||||
/*
|
|
||||||
* Copyright 2019-2020 Zheng Jie
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
package cn.ysk.cashier.repository.product;
|
package cn.ysk.cashier.repository.product;
|
||||||
|
|
||||||
import cn.ysk.cashier.pojo.product.TbProductStockDetail;
|
import cn.ysk.cashier.pojo.product.TbProductStockDetail;
|
||||||
|
import org.springframework.data.domain.Page;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||||
import org.springframework.data.jpa.repository.Query;
|
import org.springframework.data.jpa.repository.Query;
|
||||||
import org.springframework.data.repository.query.Param;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
|
||||||
* @website https://eladmin.vip
|
|
||||||
* @author lyf
|
|
||||||
* @date 2024-01-19
|
|
||||||
**/
|
|
||||||
public interface TbProductStockDetailRepository extends JpaRepository<TbProductStockDetail, Long>, JpaSpecificationExecutor<TbProductStockDetail> {
|
public interface TbProductStockDetailRepository extends JpaRepository<TbProductStockDetail, Long>, JpaSpecificationExecutor<TbProductStockDetail> {
|
||||||
|
|
||||||
@Query("select sum(detail.stockNumber) from TbProductStockDetail detail where detail.productId =:product")
|
@Query("SELECT detail FROM TbProductStockDetail detail " +
|
||||||
BigDecimal sumStockNumber(@Param("product") String product);
|
"INNER JOIN TbProduct pro ON detail.productId = pro.id " +
|
||||||
|
"AND pro.shopId = :shopId " +
|
||||||
|
"AND (:categoryId IS NULL OR pro.categoryId = :categoryId) " +
|
||||||
|
"AND (:productName IS NULL OR pro.name LIKE %:productName%) " +
|
||||||
|
"AND (:type IS NULL OR pro.typeEnum = :type) " +
|
||||||
|
"where detail.shopId = :shopId " +
|
||||||
|
"AND detail.createdAt > :startTime " +
|
||||||
|
"AND detail.createdAt < :endTime " +
|
||||||
|
"AND detail.type IN :types " +
|
||||||
|
"ORDER BY detail.id DESC")
|
||||||
|
Page<TbProductStockDetail> findByProductParam(String shopId, String productName, String categoryId, String type,
|
||||||
|
List<String> types,
|
||||||
|
long startTime, long endTime, Pageable pageable);
|
||||||
}
|
}
|
||||||
|
|
@ -5,7 +5,6 @@ import cn.hutool.core.util.StrUtil;
|
||||||
import cn.ysk.cashier.dto.product.*;
|
import cn.ysk.cashier.dto.product.*;
|
||||||
import cn.ysk.cashier.exception.BadRequestException;
|
import cn.ysk.cashier.exception.BadRequestException;
|
||||||
import cn.ysk.cashier.mybatis.mapper.TbProducSkutMapper;
|
import cn.ysk.cashier.mybatis.mapper.TbProducSkutMapper;
|
||||||
import cn.ysk.cashier.pojo.order.TbOrderInfo;
|
|
||||||
import cn.ysk.cashier.pojo.product.TbProduct;
|
import cn.ysk.cashier.pojo.product.TbProduct;
|
||||||
import cn.ysk.cashier.pojo.product.TbProductStockDetail;
|
import cn.ysk.cashier.pojo.product.TbProductStockDetail;
|
||||||
import cn.ysk.cashier.pojo.shop.TbShopUnit;
|
import cn.ysk.cashier.pojo.shop.TbShopUnit;
|
||||||
|
|
@ -29,20 +28,12 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import javax.persistence.EntityManager;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
/**
|
|
||||||
* @website https://eladmin.vip
|
|
||||||
* @description 服务实现
|
|
||||||
* @author lyf
|
|
||||||
* @date 2024-01-19
|
|
||||||
**/
|
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@Slf4j
|
@Slf4j
|
||||||
|
|
@ -55,7 +46,6 @@ public class TbProductStockDetailServiceImpl implements TbProductStockDetailServ
|
||||||
private final TbShopUnitRepository shopUnitRepository;
|
private final TbShopUnitRepository shopUnitRepository;
|
||||||
private final StockCountRepository stockCountRepository;
|
private final StockCountRepository stockCountRepository;
|
||||||
private final ProductStockCountRepository stockRepository;
|
private final ProductStockCountRepository stockRepository;
|
||||||
private final EntityManager entityManager;
|
|
||||||
private final TbOrderInfoRepository tbOrderInfoRepository;
|
private final TbOrderInfoRepository tbOrderInfoRepository;
|
||||||
private final TbProducSkutMapper skutMapper;
|
private final TbProducSkutMapper skutMapper;
|
||||||
|
|
||||||
|
|
@ -68,29 +58,37 @@ public class TbProductStockDetailServiceImpl implements TbProductStockDetailServ
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String,Object> queryPage(TbProductStockDetailQueryCriteria criteria){
|
public Map<String,Object> queryPage(TbProductStockDetailQueryCriteria criteria) throws ParseException {
|
||||||
|
if (criteria.getStartTime() == null || criteria.getEndTime() == null) {
|
||||||
|
criteria.setEndTime(new Date());
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
criteria.setStartTime(sdf.parse("2024-01-01"));//创建2024年1月1日的Date对象
|
||||||
|
}
|
||||||
if(StringUtils.isNotBlank(criteria.getColumn())){
|
if(StringUtils.isNotBlank(criteria.getColumn())){
|
||||||
switch (criteria.getColumn()){
|
switch (criteria.getColumn()){
|
||||||
case "addCountNumber":
|
case "addCountNumber":
|
||||||
criteria.setType(Arrays.asList("供应商入库", "盘点入库", "其他入库", "退单"));
|
criteria.setTypes(Arrays.asList("供应商入库", "盘点入库", "其他入库", "退单"));
|
||||||
break;
|
break;
|
||||||
case "addNumber":
|
case "addNumber":
|
||||||
criteria.setType(Arrays.asList("供应商入库", "盘点入库", "其他入库"));
|
criteria.setTypes(Arrays.asList("供应商入库", "盘点入库", "其他入库"));
|
||||||
break;
|
break;
|
||||||
case "refundNumber":
|
case "refundNumber":
|
||||||
criteria.setType(Arrays.asList("退单"));
|
criteria.setTypes(Collections.singletonList("退单"));
|
||||||
break;
|
break;
|
||||||
case "subCountNumber":
|
case "subCountNumber":
|
||||||
criteria.setType(Arrays.asList("供应商出库","其他出库","盘点出库","售出记录","报损"));
|
criteria.setTypes(Arrays.asList("供应商出库","其他出库","盘点出库","售出记录","报损"));
|
||||||
break;
|
break;
|
||||||
case "subNumber":
|
case "subNumber":
|
||||||
criteria.setType(Arrays.asList("供应商出库","其他出库","盘点出库","售出记录"));
|
criteria.setTypes(Arrays.asList("供应商出库","其他出库","盘点出库","售出记录"));
|
||||||
break;
|
break;
|
||||||
case "saleNumber":
|
case "saleNumber":
|
||||||
criteria.setType(Arrays.asList("售出记录"));
|
criteria.setTypes(Collections.singletonList("售出记录"));
|
||||||
break;
|
break;
|
||||||
case "lossNumber":
|
case "lossNumber":
|
||||||
criteria.setType(Arrays.asList("报损"));
|
criteria.setTypes(Collections.singletonList("报损"));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
criteria.setTypes(Arrays.asList("供应商入库", "盘点入库", "其他入库", "退单","供应商出库","其他出库","盘点出库","售出记录","报损"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -98,16 +96,16 @@ public class TbProductStockDetailServiceImpl implements TbProductStockDetailServ
|
||||||
Sort sort = Sort.by(Sort.Direction.DESC, "id");
|
Sort sort = Sort.by(Sort.Direction.DESC, "id");
|
||||||
Pageable pageable = PageRequest.of(criteria.getPage(), criteria.getSize(), sort);
|
Pageable pageable = PageRequest.of(criteria.getPage(), criteria.getSize(), sort);
|
||||||
|
|
||||||
Page<TbProductStockDetail> page = tbProductStockDetailRepository.findAll((root, criteriaQuery, criteriaBuilder)
|
Page<TbProductStockDetail> page = tbProductStockDetailRepository.findByProductParam(
|
||||||
-> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
|
criteria.getShopId().toString(), criteria.getProductName(),
|
||||||
|
criteria.getCategoryId(),criteria.getType(),
|
||||||
|
criteria.getTypes() ,
|
||||||
|
criteria.getStartTime().getTime(), criteria.getEndTime().getTime(), pageable);
|
||||||
Page<TbProductStockDetailDto> map = page.map(tbProductStockDetailMapper::toDto);
|
Page<TbProductStockDetailDto> map = page.map(tbProductStockDetailMapper::toDto);
|
||||||
|
|
||||||
for (TbProductStockDetailDto tbProductStockDetailDto : map.getContent()) {
|
for (TbProductStockDetailDto tbProductStockDetailDto : map.getContent()) {
|
||||||
if (StrUtil.isNotBlank(tbProductStockDetailDto.getOrderId())) {
|
if (StrUtil.isNotBlank(tbProductStockDetailDto.getOrderId())) {
|
||||||
TbOrderInfo tbOrderInfo = tbOrderInfoRepository.findById(Integer.valueOf(tbProductStockDetailDto.getOrderId())).orElse(null);
|
tbOrderInfoRepository.findById(Integer.valueOf(tbProductStockDetailDto.getOrderId())).ifPresent(tbOrderInfo -> tbProductStockDetailDto.setOrderNo(tbOrderInfo.getOrderNo()));
|
||||||
if (tbOrderInfo != null) {
|
|
||||||
tbProductStockDetailDto.setOrderNo(tbOrderInfo.getOrderNo());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
tbProductStockDetailDto.setTypes();
|
tbProductStockDetailDto.setTypes();
|
||||||
}
|
}
|
||||||
|
|
@ -125,7 +123,7 @@ public class TbProductStockDetailServiceImpl implements TbProductStockDetailServ
|
||||||
criteria.setStartTime(sdf.parse("2024-01-01"));//创建2024年1月1日的Date对象
|
criteria.setStartTime(sdf.parse("2024-01-01"));//创建2024年1月1日的Date对象
|
||||||
}
|
}
|
||||||
return stockRepository.productStockCount(criteria.getShopId().toString(), criteria.getProductName(),
|
return stockRepository.productStockCount(criteria.getShopId().toString(), criteria.getProductName(),
|
||||||
criteria.getCategoryId(), criteria.getStartTime().getTime(), criteria.getEndTime().getTime());
|
criteria.getCategoryId(),criteria.getType(), criteria.getStartTime().getTime(), criteria.getEndTime().getTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -140,12 +138,10 @@ public class TbProductStockDetailServiceImpl implements TbProductStockDetailServ
|
||||||
Page<TbProductStockListDto> tbProductStockCountDtos = stockRepository.productStock(
|
Page<TbProductStockListDto> tbProductStockCountDtos = stockRepository.productStock(
|
||||||
criteria.getShopId().toString(),
|
criteria.getShopId().toString(),
|
||||||
criteria.getProductName(),
|
criteria.getProductName(),
|
||||||
criteria.getCategoryId(),
|
criteria.getCategoryId(),criteria.getType(),
|
||||||
criteria.getStartTime().getTime(), criteria.getEndTime().getTime(), pageable);
|
criteria.getStartTime().getTime(), criteria.getEndTime().getTime(), pageable);
|
||||||
if (!tbProductStockCountDtos.isEmpty()) {
|
if (!tbProductStockCountDtos.isEmpty()) {
|
||||||
tbProductStockCountDtos.getContent().parallelStream().forEach(s->{
|
tbProductStockCountDtos.getContent().parallelStream().forEach(s-> s.setCountNumber(s.getStockNumber().add(s.getSubCountNumber())));
|
||||||
s.setCountNumber(s.getStockNumber().add(s.getSubCountNumber()));
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
return PageUtil.toPage(tbProductStockCountDtos);
|
return PageUtil.toPage(tbProductStockCountDtos);
|
||||||
}
|
}
|
||||||
|
|
@ -164,14 +160,6 @@ public class TbProductStockDetailServiceImpl implements TbProductStockDetailServ
|
||||||
return tbProductStockDetailMapper.toDto(tbProductStockDetail);
|
return tbProductStockDetailMapper.toDto(tbProductStockDetail);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public HashMap<String, BigDecimal> sumStockNumber(String productId) {
|
|
||||||
BigDecimal bigDecimal = tbProductStockDetailRepository.sumStockNumber(productId);
|
|
||||||
HashMap<String, BigDecimal> map = new HashMap<>();
|
|
||||||
map.put("exchange",bigDecimal);
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void frmLoss(TbProductFrmLossDto resources) {
|
public void frmLoss(TbProductFrmLossDto resources) {
|
||||||
TbProduct product = tbProductRepository.findById(Integer.valueOf(resources.getProductId())).orElse(null);
|
TbProduct product = tbProductRepository.findById(Integer.valueOf(resources.getProductId())).orElse(null);
|
||||||
|
|
|
||||||
|
|
@ -2,27 +2,18 @@ package cn.ysk.cashier.service.product;
|
||||||
|
|
||||||
import cn.ysk.cashier.dto.product.TbProductFrmLossDto;
|
import cn.ysk.cashier.dto.product.TbProductFrmLossDto;
|
||||||
import cn.ysk.cashier.dto.product.TbProductStockCountQueryCriteria;
|
import cn.ysk.cashier.dto.product.TbProductStockCountQueryCriteria;
|
||||||
import cn.ysk.cashier.dto.rabbit.StockRecordMsg;
|
|
||||||
import cn.ysk.cashier.pojo.product.TbProductStockDetail;
|
|
||||||
import cn.ysk.cashier.dto.product.TbProductStockDetailDto;
|
import cn.ysk.cashier.dto.product.TbProductStockDetailDto;
|
||||||
import cn.ysk.cashier.dto.product.TbProductStockDetailQueryCriteria;
|
import cn.ysk.cashier.dto.product.TbProductStockDetailQueryCriteria;
|
||||||
|
import cn.ysk.cashier.pojo.product.TbProductStockDetail;
|
||||||
import cn.ysk.cashier.vo.TbProductStockCountVo;
|
import cn.ysk.cashier.vo.TbProductStockCountVo;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.text.ParseException;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.List;
|
|
||||||
import java.io.IOException;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.text.ParseException;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
|
||||||
* @website https://eladmin.vip
|
|
||||||
* @description 服务接口
|
|
||||||
* @author lyf
|
|
||||||
* @date 2024-01-19
|
|
||||||
**/
|
|
||||||
public interface TbProductStockDetailService {
|
public interface TbProductStockDetailService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -33,7 +24,7 @@ public interface TbProductStockDetailService {
|
||||||
*/
|
*/
|
||||||
Map<String,Object> queryAll(TbProductStockDetailQueryCriteria criteria, Pageable pageable);
|
Map<String,Object> queryAll(TbProductStockDetailQueryCriteria criteria, Pageable pageable);
|
||||||
|
|
||||||
Map<String,Object> queryPage(TbProductStockDetailQueryCriteria criteria);
|
Map<String,Object> queryPage(TbProductStockDetailQueryCriteria criteria) throws ParseException;
|
||||||
TbProductStockCountVo stockCount(TbProductStockCountQueryCriteria criteria) throws ParseException;
|
TbProductStockCountVo stockCount(TbProductStockCountQueryCriteria criteria) throws ParseException;
|
||||||
Map<String,Object> stockList(TbProductStockCountQueryCriteria criteria) throws ParseException;
|
Map<String,Object> stockList(TbProductStockCountQueryCriteria criteria) throws ParseException;
|
||||||
|
|
||||||
|
|
@ -51,8 +42,6 @@ public interface TbProductStockDetailService {
|
||||||
*/
|
*/
|
||||||
TbProductStockDetailDto findById(Long id);
|
TbProductStockDetailDto findById(Long id);
|
||||||
|
|
||||||
HashMap<String, BigDecimal> sumStockNumber(String productId);
|
|
||||||
|
|
||||||
void frmLoss(TbProductFrmLossDto resources);
|
void frmLoss(TbProductFrmLossDto resources);
|
||||||
/**
|
/**
|
||||||
* 创建
|
* 创建
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue