智慧农业后台管理
guoshilong
2022-07-22 fdff4ca4813fc77a9006309ed4e5c232b4f3c85e
src/main/java/org/springblade/modules/sale/controller/SaleController.java
@@ -113,12 +113,12 @@
   @ApiOperationSupport(order = 6)
   @ApiOperation(value = "新增或修改", notes = "传入sale")
   public R submit(@Valid @RequestBody SaleVO sale) {
      boolean res = farmProductStockService.stockCompare(sale.getSaleNum(),sale.getStrainId());
      boolean res = farmProductStockService.stockCompare(sale.getSaleNum(),sale.getProid());
      if (!res){
         throw new org.springblade.core.log.exception.ServiceException(StringUtil.format("当前库存不足!"));
      }else {
         //库存充足,减去相应库存
         farmProductStockService.stockReduce(sale.getSaleNum(),sale.getStrainId());
         farmProductStockService.stockReduce(sale.getSaleNum(),sale.getProid());
      }
      return R.status(saleService.saveOrUpdate(sale));
   }
@@ -138,16 +138,16 @@
    * 大屏销售统计
    */
   @GetMapping("/selctSaletCount")
   public R selctSaletCount() {
      return R.data(saleService.selctSaletCount());
   public R selctSaletCount(String farmId) {
      return R.data(saleService.selctSaletCount(farmId));
   }
   /**
    * 统计今年和去年的销售总额
    */
   @GetMapping("/selctSaletZ")
   public R selctSaletZ() {
      return R.data(saleService.selctSaletZ());
   public R selctSaletZ(SaleVO sale) {
      return R.data(saleService.selctSaletZ(sale));
   }
   /**
@@ -164,8 +164,8 @@
    * 按行政区统计市场流通
    */
   @GetMapping("/selectMarketDistrict")
   public R selectMarketDistrict() {
      return R.data(saleService.selectMarketDistrict());
   public R selectMarketDistrict(String farmId) {
      return R.data(saleService.selectMarketDistrict(farmId));
   }
}