|
|
@@ -18,6 +18,7 @@ package org.springblade.mocha.controller;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import io.swagger.annotations.ApiParam;
|
|
|
@@ -30,12 +31,14 @@ import javax.validation.Valid;
|
|
|
|
|
|
import org.springblade.core.mp.support.Condition;
|
|
|
import org.springblade.core.mp.support.Query;
|
|
|
+import org.springblade.core.secure.utils.AuthUtil;
|
|
|
import org.springblade.core.secure.utils.SecureUtil;
|
|
|
import org.springblade.core.tool.api.R;
|
|
|
import org.springblade.core.tool.utils.Func;
|
|
|
import org.springblade.core.excel.util.ExcelUtil;
|
|
|
import org.springblade.mocha.excel.PriceImport;
|
|
|
import org.springblade.mocha.excel.PriceItemExcel;
|
|
|
+import org.springblade.system.entity.AuthClient;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import org.springblade.mocha.entity.PriceItem;
|
|
|
@@ -44,8 +47,10 @@ import org.springblade.mocha.service.IPriceItemService;
|
|
|
import org.springblade.core.boot.ctrl.BladeController;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* 价格管理明细表 控制器
|
|
|
@@ -172,10 +177,37 @@ public class PriceItemController extends BladeController {
|
|
|
@ApiOperationSupport(order = 12)
|
|
|
@ApiOperation(value = "获取销售价格", notes = "传入excel")
|
|
|
public R getSalePrice(@ApiParam(value = "大字", required = true) @RequestParam String code,
|
|
|
- @ApiParam(value = "是否运费", required = true) @RequestParam Integer ids,
|
|
|
- @ApiParam(value = "是否标签", required = true) @RequestParam Integer ids)
|
|
|
+ @ApiParam(value = "是否运费", required = true) @RequestParam Integer isFreight,
|
|
|
+ @ApiParam(value = "是否标签", required = true) @RequestParam Integer isLabel)
|
|
|
{
|
|
|
-
|
|
|
+ BigDecimal saleMoney=BigDecimal.ZERO;
|
|
|
+ BigDecimal reduce=BigDecimal.ZERO;
|
|
|
+ BigDecimal freight=BigDecimal.ZERO;
|
|
|
+ BigDecimal label=BigDecimal.ZERO;
|
|
|
+ LambdaQueryWrapper<PriceItem> priceItemLambdaQueryWrapper=new LambdaQueryWrapper<>();
|
|
|
+ priceItemLambdaQueryWrapper
|
|
|
+ .eq(PriceItem::getIsDeleted,0)
|
|
|
+ .eq(PriceItem::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(PriceItem::getCode,code);
|
|
|
+ List<PriceItem> priceItemList = priceItemService.list(priceItemLambdaQueryWrapper);
|
|
|
+
|
|
|
+ if(CollectionUtils.isNotEmpty(priceItemList))
|
|
|
+ {
|
|
|
+
|
|
|
+ reduce = priceItemList.stream().filter(e -> e.getSalesPrice() != null).map(PriceItem::getSalesPrice).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ if(isFreight!=null && isFreight==1)
|
|
|
+ {
|
|
|
+ freight=priceItemList.stream().filter(e -> e.getFreightFees() != null).map(PriceItem::getFreightFees).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ }
|
|
|
+ if(isLabel!=null && isLabel==1)
|
|
|
+ {
|
|
|
+ label=priceItemList.stream().filter(e -> e.getLabelFees() != null).map(PriceItem::getLabelFees).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ saleMoney=(reduce.add(freight)).add(label);
|
|
|
+
|
|
|
+ return R.data(saleMoney);
|
|
|
}
|
|
|
|
|
|
|