商品修改不能改库存,首页商品排行
This commit is contained in:
parent
b65bc317bd
commit
0ad9234279
|
|
@ -43,8 +43,8 @@ public class SummaryController {
|
||||||
|
|
||||||
@GetMapping("/dateProduct")
|
@GetMapping("/dateProduct")
|
||||||
private Object shopSummaryProduct(@RequestParam Integer shopId,@RequestParam Integer day,
|
private Object shopSummaryProduct(@RequestParam Integer shopId,@RequestParam Integer day,
|
||||||
@RequestParam Integer page){
|
@RequestParam Integer page, @RequestParam Integer size){
|
||||||
return summaryService.selectSummaryProduct(shopId,day,page);
|
return summaryService.selectSummaryProduct(shopId,day,page,size);
|
||||||
}
|
}
|
||||||
@GetMapping("/datePayType")
|
@GetMapping("/datePayType")
|
||||||
private Object shopSummaryPayType(@RequestParam Integer shopId,@RequestParam Integer day){
|
private Object shopSummaryPayType(@RequestParam Integer shopId,@RequestParam Integer day){
|
||||||
|
|
|
||||||
|
|
@ -23,9 +23,9 @@ public interface ShopUserDutyDetailRepository extends JpaRepository<TbShopUserDu
|
||||||
"WHERE user.shop_id = :shopId" +
|
"WHERE user.shop_id = :shopId" +
|
||||||
" AND user.login_time BETWEEN :startTime AND :endTime" +
|
" AND user.login_time BETWEEN :startTime AND :endTime" +
|
||||||
" GROUP BY product.product_id" +
|
" GROUP BY product.product_id" +
|
||||||
" Limit :currentPage,5", nativeQuery = true)
|
" Limit :currentPage, :currentSize", nativeQuery = true)
|
||||||
List<Object[]> searchByDutyId(@Param("shopId") Integer shopId, @Param("startTime") Date startTime, @Param("endTime") Date endTime
|
List<Object[]> searchByDutyId(@Param("shopId") Integer shopId, @Param("startTime") Date startTime, @Param("endTime") Date endTime
|
||||||
,@Param("currentPage") Integer currentPage);
|
,@Param("currentPage") Integer currentPage, @Param("currentSize")Integer currentSize);
|
||||||
|
|
||||||
|
|
||||||
@Query(value = "SELECT\n" +
|
@Query(value = "SELECT\n" +
|
||||||
|
|
|
||||||
|
|
@ -51,10 +51,10 @@ public interface TbProductSkuRepository extends JpaRepository<TbProductSku, Inte
|
||||||
@Modifying
|
@Modifying
|
||||||
@Query("update FROM TbProductSku sku set sku.costPrice=:costPrice,sku.coverImg =:coverImg, " +
|
@Query("update FROM TbProductSku sku set sku.costPrice=:costPrice,sku.coverImg =:coverImg, " +
|
||||||
"sku.firstShared=:firstShared,sku.memberPrice = :memberPrice,sku.originPrice = :originPrice, " +
|
"sku.firstShared=:firstShared,sku.memberPrice = :memberPrice,sku.originPrice = :originPrice, " +
|
||||||
"sku.salePrice=:salePrice,sku.specSnap =:specSnap,sku.stockNumber = :stockNumber " +
|
"sku.salePrice=:salePrice,sku.specSnap =:specSnap " +
|
||||||
"WHERE sku.barCode = :barCode and sku.id =:id")
|
"WHERE sku.barCode = :barCode and sku.id =:id")
|
||||||
Integer updateByBarCode(@Param("barCode") String barCode, @Param("costPrice")BigDecimal costPrice, @Param("coverImg")String coverImg,
|
Integer updateByBarCode(@Param("barCode") String barCode, @Param("costPrice")BigDecimal costPrice, @Param("coverImg")String coverImg,
|
||||||
@Param("firstShared")BigDecimal firstShared,@Param("memberPrice")BigDecimal memberPrice,@Param("originPrice") BigDecimal originPrice,
|
@Param("firstShared")BigDecimal firstShared,@Param("memberPrice")BigDecimal memberPrice,@Param("originPrice") BigDecimal originPrice,
|
||||||
@Param("salePrice")BigDecimal salePrice,@Param("specSnap") String specSnap,@Param("stockNumber") Double stockNumber,@Param("id") Integer id);
|
@Param("salePrice")BigDecimal salePrice,@Param("specSnap") String specSnap,@Param("id") Integer id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -17,7 +17,7 @@ public interface SummaryService {
|
||||||
Map<String,Object> selectSummaryToday(Integer shopId);
|
Map<String,Object> selectSummaryToday(Integer shopId);
|
||||||
|
|
||||||
Map<String,Object> selectSummaryAmount(Integer shopId, Integer day);
|
Map<String,Object> selectSummaryAmount(Integer shopId, Integer day);
|
||||||
Map<String,Object> selectSummaryProduct(Integer shopId, Integer day,Integer page);
|
Map<String,Object> selectSummaryProduct(Integer shopId, Integer day,Integer page,Integer size);
|
||||||
|
|
||||||
Map<String,Object> selectSummaryPayType(Integer shopId, Integer day);
|
Map<String,Object> selectSummaryPayType(Integer shopId, Integer day);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -170,9 +170,9 @@ public class SummaryServiceImpl implements SummaryService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String,Object> selectSummaryProduct(Integer shopId, Integer day,Integer currentPage){
|
public Map<String,Object> selectSummaryProduct(Integer shopId, Integer day,Integer currentPage, Integer currentSize){
|
||||||
//根据时间商品排行
|
//根据时间商品排行
|
||||||
currentPage = (currentPage - 1) * 5;
|
currentPage = (currentPage - 1) * currentSize;
|
||||||
HashMap<String, Object> map = new HashMap<>();
|
HashMap<String, Object> map = new HashMap<>();
|
||||||
Date startTime ;
|
Date startTime ;
|
||||||
Date endTime ;
|
Date endTime ;
|
||||||
|
|
@ -188,7 +188,7 @@ public class SummaryServiceImpl implements SummaryService {
|
||||||
}else {
|
}else {
|
||||||
throw new BadRequestException("日期有误");
|
throw new BadRequestException("日期有误");
|
||||||
}
|
}
|
||||||
List<Object[]> objects = shopUserDutyDetailRepository.searchByDutyId(shopId,startTime,endTime,currentPage);
|
List<Object[]> objects = shopUserDutyDetailRepository.searchByDutyId(shopId,startTime,endTime,currentPage,currentSize);
|
||||||
List<ProductVO> list = new ArrayList<>();
|
List<ProductVO> list = new ArrayList<>();
|
||||||
for (Object[] o :objects) {
|
for (Object[] o :objects) {
|
||||||
ProductVO productVO = new ProductVO();
|
ProductVO productVO = new ProductVO();
|
||||||
|
|
@ -202,10 +202,10 @@ public class SummaryServiceImpl implements SummaryService {
|
||||||
Tuple tuple = shopUserDutyDetailRepository.searchByDutyIdSum(shopId, startTime, endTime);
|
Tuple tuple = shopUserDutyDetailRepository.searchByDutyIdSum(shopId, startTime, endTime);
|
||||||
//分页数据
|
//分页数据
|
||||||
Tuple tuple1 = shopUserDutyDetailRepository.searchCount(shopId, startTime, endTime);
|
Tuple tuple1 = shopUserDutyDetailRepository.searchCount(shopId, startTime, endTime);
|
||||||
map.put("productCount",tuple.get(0, BigDecimal.class));
|
map.put("productCount",tuple == null? 0:tuple.get(0, BigDecimal.class));
|
||||||
map.put("productSum",tuple.get(1, BigDecimal.class));
|
map.put("productSum",tuple == null? 0:tuple.get(1, BigDecimal.class));
|
||||||
map.put("totalProduct",list);
|
map.put("totalProduct",list);
|
||||||
map.put("total",tuple1.get(0, BigInteger.class));
|
map.put("total",tuple1 == null?0:tuple1.get(0, BigInteger.class));
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -324,7 +324,7 @@ public class TbProductServiceImpl implements TbProductService {
|
||||||
TbProductSku tbProductSku = tbProductSkuRepository.searchBarCode(sku.getBarCode());
|
TbProductSku tbProductSku = tbProductSkuRepository.searchBarCode(sku.getBarCode());
|
||||||
if (tbProductSku != null){
|
if (tbProductSku != null){
|
||||||
tbProductSkuRepository.updateByBarCode(sku.getBarCode(),sku.getCostPrice(),sku.getCoverImg(),sku.getFirstShared(),sku.getMemberPrice(),
|
tbProductSkuRepository.updateByBarCode(sku.getBarCode(),sku.getCostPrice(),sku.getCoverImg(),sku.getFirstShared(),sku.getMemberPrice(),
|
||||||
sku.getOriginPrice(),sku.getSalePrice(),sku.getSpecSnap(),sku.getStockNumber(),tbProductSku.getId());
|
sku.getOriginPrice(),sku.getSalePrice(),sku.getSpecSnap(),tbProductSku.getId());
|
||||||
}else {
|
}else {
|
||||||
if ("sku".equals(save.getTypeEnum())) {
|
if ("sku".equals(save.getTypeEnum())) {
|
||||||
tbProductSkuRepository.deleteByProductId(String.valueOf(save.getId()));
|
tbProductSkuRepository.deleteByProductId(String.valueOf(save.getId()));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue