出入退货单 金额为负数
This commit is contained in:
parent
b04661d0a9
commit
0623562cd0
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -52,6 +52,6 @@ public interface TbShopPurveyorTransactRepository extends JpaRepository<TbShopPu
|
|||
Page<PurveyorTransactVO> 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<String,Object> 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<String,Object> findByStatusSum(@Param("purveyorId") String purveyorId,@Param("type")String type);
|
||||
}
|
||||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ public class TbShopPurveyorTransactServiceImpl implements TbShopPurveyorTransact
|
|||
@Override
|
||||
public Map<String, Object> queryTransactSum(TbShopPurveyorTransactQueryCriteria criteria) {
|
||||
Map<String, Object> bySum = tbShopPurveyorTransactRepository.findBySum(criteria.getPurveyorId(), criteria.getType());
|
||||
Map<String, Object> byStatusSum = tbShopPurveyorTransactRepository.findByStatusSum(criteria.getPurveyorId(), criteria.getType(), 0);
|
||||
Map<String, Object> byStatusSum = tbShopPurveyorTransactRepository.findByStatusSum(criteria.getPurveyorId(), criteria.getType());
|
||||
Map<String, Object> sumMap = new HashMap<>(bySum);
|
||||
sumMap.put("waitNumber", byStatusSum.get("waitNumber"));
|
||||
return sumMap;
|
||||
|
|
|
|||
Loading…
Reference in New Issue