Merge remote-tracking branch 'origin/test' into test
This commit is contained in:
commit
5e8e6661b9
|
|
@ -38,7 +38,7 @@ public interface TbShopCategoryRepository extends JpaRepository<TbShopCategory,
|
|||
@Query("SELECT category FROM TbShopCategory category where category.tree IN :ids and category.id != category.tree")
|
||||
List<TbShopCategory> findChildren(@Param("ids")List<Integer> ids);
|
||||
|
||||
@Query(" SELECT category FROM TbShopCategory category where category.shopId = :shopId")
|
||||
@Query(" SELECT category FROM TbShopCategory category where category.shopId = :shopId and (category.pid is null or category.pid = '')")
|
||||
Page<TbShopCategory> findAllBy(@Param("shopId") String shopId,Pageable pageable);
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ import java.text.ParseException;
|
|||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@Service
|
||||
|
|
@ -243,34 +244,45 @@ public class TbProductStockDetailServiceImpl implements TbProductStockDetailServ
|
|||
|
||||
@Override
|
||||
public void addSaleRecord(Integer orderId) {
|
||||
List<StockCountDTO> stockCountDTOS = stockCountRepository.countStockById(orderId);
|
||||
log.info("查询到订单id: {}的所有库存数据: {}", orderId, stockCountDTOS);
|
||||
stockCountDTOS.forEach(s -> {
|
||||
//客座费不统计
|
||||
if (s.getProId() > 0) {
|
||||
if (s.getStockCount() > 0) {
|
||||
TbProductStockDetail productStockDetail = new TbProductStockDetail();
|
||||
productStockDetail.setCreatedAt(System.currentTimeMillis());
|
||||
productStockDetail.setUpdatedAt(System.currentTimeMillis());
|
||||
productStockDetail.setShopId(s.getShopId());
|
||||
productStockDetail.setProductId(s.getProId().toString());
|
||||
productStockDetail.setProductName(s.getProName());
|
||||
productStockDetail.setOrderId(orderId.toString());
|
||||
// productStockDetail.setSkuId(s.getSkuId().toString());
|
||||
productStockDetail.setIsStock(s.getIsStock());//是否开启库存
|
||||
productStockDetail.setLeftNumber(s.getStockNumber() + s.getStockCount());//原库存
|
||||
productStockDetail.setSpecSnap(s.getSpecSnap());
|
||||
productStockDetail.setUnitName(s.getUnitName());
|
||||
productStockDetail.setStockNumber(-Double.valueOf(s.getStockCount()));
|
||||
productStockDetail.setSourcePath("NORMAL");
|
||||
productStockDetail.setType("售出记录");
|
||||
productStockDetail.setRemark("售出记录:" + orderId);
|
||||
productStockDetail.setSubType(-1);
|
||||
tbProductStockDetailRepository.save(productStockDetail);
|
||||
}
|
||||
skutMapper.incrRealSalesNumber(s.getSkuId().intValue(), s.getStockCount());
|
||||
// 先进行延迟
|
||||
CompletableFuture<Void> delayFuture = CompletableFuture.runAsync(() -> {
|
||||
try {
|
||||
Thread.sleep(3000L);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
});
|
||||
|
||||
delayFuture.thenRun(() -> {
|
||||
List<StockCountDTO> stockCountDTOS = stockCountRepository.countStockById(orderId);
|
||||
log.info("查询到订单id: {}的所有库存数据: {}", orderId, stockCountDTOS);
|
||||
stockCountDTOS.forEach(s -> {
|
||||
if (s.getProId() > 0) {
|
||||
if (s.getStockCount() > 0) {
|
||||
TbProductStockDetail productStockDetail = new TbProductStockDetail();
|
||||
productStockDetail.setCreatedAt(System.currentTimeMillis());
|
||||
productStockDetail.setUpdatedAt(System.currentTimeMillis());
|
||||
productStockDetail.setShopId(s.getShopId());
|
||||
productStockDetail.setProductId(s.getProId().toString());
|
||||
productStockDetail.setProductName(s.getProName());
|
||||
productStockDetail.setOrderId(orderId.toString());
|
||||
// productStockDetail.setSkuId(s.getSkuId().toString());
|
||||
productStockDetail.setIsStock(s.getIsStock());// 是否开启库存
|
||||
productStockDetail.setLeftNumber(s.getStockNumber() + s.getStockCount());// 原库存
|
||||
productStockDetail.setSpecSnap(s.getSpecSnap());
|
||||
productStockDetail.setUnitName(s.getUnitName());
|
||||
productStockDetail.setStockNumber(-Double.valueOf(s.getStockCount()));
|
||||
productStockDetail.setSourcePath("NORMAL");
|
||||
productStockDetail.setType("售出记录");
|
||||
productStockDetail.setRemark("售出记录:" + orderId);
|
||||
productStockDetail.setSubType(-1);
|
||||
tbProductStockDetailRepository.save(productStockDetail);
|
||||
}
|
||||
skutMapper.incrRealSalesNumber(s.getSkuId().intValue(), s.getStockCount());
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ public class TbShopCategoryServiceImpl implements TbShopCategoryService {
|
|||
.filter(d -> d.getTree()==null || d.getId().equals(d.getTree()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
return PageUtil.toPage(result, page.getTotalElements()-children.size());
|
||||
return PageUtil.toPage(result, page.getTotalElements());
|
||||
}
|
||||
|
||||
// @Override
|
||||
|
|
|
|||
Loading…
Reference in New Issue