diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/controller/shop/TbShopPurveyorTransactController.java b/eladmin-system/src/main/java/cn/ysk/cashier/controller/shop/TbShopPurveyorTransactController.java index af196e69..b4057457 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/controller/shop/TbShopPurveyorTransactController.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/controller/shop/TbShopPurveyorTransactController.java @@ -15,21 +15,16 @@ */ package cn.ysk.cashier.controller.shop; -import cn.hutool.core.date.DateTime; -import cn.ysk.cashier.annotation.Log; +import cn.ysk.cashier.dto.shop.TbShopPurveyorTransactQueryCriteria; import cn.ysk.cashier.pojo.shop.TbShopPurveyorTransact; import cn.ysk.cashier.service.shop.TbShopPurveyorTransactService; -import cn.ysk.cashier.dto.shop.TbShopPurveyorTransactQueryCriteria; -import org.springframework.data.domain.Pageable; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; -import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; -import io.swagger.annotations.*; -import java.io.IOException; -import javax.servlet.http.HttpServletResponse; /** * @website https://eladmin.vip diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/repository/shop/TbShopPurveyorTransactRepository.java b/eladmin-system/src/main/java/cn/ysk/cashier/repository/shop/TbShopPurveyorTransactRepository.java index e9e5320d..76f9c919 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/repository/shop/TbShopPurveyorTransactRepository.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/repository/shop/TbShopPurveyorTransactRepository.java @@ -52,6 +52,6 @@ public interface TbShopPurveyorTransactRepository extends JpaRepository queryTransactDate(String type, String shopId, String name, Pageable page); @Query(value = "SELECT IFNULL(count(b.id),0) AS waitNumber FROM tb_shop_purveyor_transact b WHERE" + - " b.purveyor_id = :purveyorId AND (:type IS NULL OR b.type = :type) AND b.`status`= :status",nativeQuery = true) - Map findByStatusSum(@Param("purveyorId") String purveyorId,@Param("type")String type,@Param("status")Integer status); + " b.purveyor_id = :purveyorId AND (:type IS NULL OR b.type = :type) AND b.`status`= 0",nativeQuery = true) + Map findByStatusSum(@Param("purveyorId") String purveyorId,@Param("type")String type); } \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/productimpl/TbProductStockOperateServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/productimpl/TbProductStockOperateServiceImpl.java index d233a6b4..c6e3b30b 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/productimpl/TbProductStockOperateServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/productimpl/TbProductStockOperateServiceImpl.java @@ -188,9 +188,15 @@ public class TbProductStockOperateServiceImpl implements TbProductStockOperateSe purveyorTransact.setRemark(resources.getRemark()); purveyorTransact.setCreatedAt(times); purveyorTransact.setUpdatedAt(times); - purveyorTransact.setTotalAmount(resources.getTotalAmount()); - purveyorTransact.setPaidAmount(resources.getPaidAmount()); - purveyorTransact.setWaitAmount(resources.getTotalAmount().subtract(resources.getPaidAmount())); + if("reject".equals(resources.getType())){ + purveyorTransact.setTotalAmount(resources.getTotalAmount().negate()); + purveyorTransact.setPaidAmount(resources.getPaidAmount()); + purveyorTransact.setWaitAmount((resources.getTotalAmount().subtract(resources.getPaidAmount())).negate()); + }else{ + purveyorTransact.setTotalAmount(resources.getTotalAmount()); + purveyorTransact.setPaidAmount(resources.getPaidAmount()); + purveyorTransact.setWaitAmount((resources.getTotalAmount().subtract(resources.getPaidAmount()))); + } if (resources.getTotalAmount().compareTo(resources.getPaidAmount()) <= 0) { purveyorTransact.setStatus(1); } else { diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopPurveyorTransactServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopPurveyorTransactServiceImpl.java index 8f2d7e71..a035d2cf 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopPurveyorTransactServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopPurveyorTransactServiceImpl.java @@ -63,7 +63,7 @@ public class TbShopPurveyorTransactServiceImpl implements TbShopPurveyorTransact @Override public Map queryTransactSum(TbShopPurveyorTransactQueryCriteria criteria) { Map bySum = tbShopPurveyorTransactRepository.findBySum(criteria.getPurveyorId(), criteria.getType()); - Map byStatusSum = tbShopPurveyorTransactRepository.findByStatusSum(criteria.getPurveyorId(), criteria.getType(), 0); + Map byStatusSum = tbShopPurveyorTransactRepository.findByStatusSum(criteria.getPurveyorId(), criteria.getType()); Map sumMap = new HashMap<>(bySum); sumMap.put("waitNumber", byStatusSum.get("waitNumber")); return sumMap;