Commit 9eac2333 authored by zhengyi's avatar zhengyi

实时计价接口包装单位参数bug修复

parent b5768c79
......@@ -5,7 +5,6 @@ import cn.iocoder.yudao.module.product.dal.dataobject.product.ProductPriceDO;
import cn.iocoder.yudao.module.product.dto.CouponAvailableDto;
import cn.iocoder.yudao.module.product.dto.CouponAvailableGroupDto;
import cn.iocoder.yudao.module.product.vo.coupon.CouponInfoVO;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -203,6 +202,13 @@ public class ProdConditionParam {
@ApiModelProperty(value = "活动优惠运费总金额")
private BigDecimal discountFreightTotalPrice = BigDecimal.ZERO;
@ApiModelProperty("包装单位")
private String unit;
@ApiModelProperty("入仓参数(此参数为前端实时计价接口参数,保持与订单入仓参数一致)")
private WarehouseInInfoParam warehouseInInfoVO;
/**
* 运费用金额单位ID
*/
......
package cn.iocoder.yudao.module.product.param;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
/**
* 入仓货物详情 Response VO
* @author yanghao
*/
@Data
public class WarehouseInInfoParam {
@ApiModelProperty(value = "是否多规格")
private Boolean isMultiSpecification;
@ApiModelProperty(value = "入仓次数")
private Integer totalRecords;
@ExcelProperty("箱/件数")
@ApiModelProperty(value = "箱/件数", required = true)
private Integer cartonsNum;
@ExcelProperty("类型")
@ApiModelProperty(value = "类型,多了还是少了,见字典order_item_status", required = true)
private Integer diffType;
@ExcelProperty("箱/件数差")
@ApiModelProperty(value = "箱/件数差", required = true)
private Integer cartonsNumDiff;
@ExcelProperty("所有箱内总货物数量")
@ApiModelProperty(value = "所有箱内总货物数量")
private Integer quantityAll;
@ExcelProperty("单位")
@ApiModelProperty(value = "单位", required = true)
private String unit;
@ApiModelProperty(value = "入仓规格类型")
private Integer specificationType;
@ApiModelProperty(value = "单位-拼接所有")
private String units;
/**
* 箱规
*/
@ExcelProperty("箱规")
@ApiModelProperty(value = "箱规")
private String boxGauge;
@ExcelProperty("体积")
@ApiModelProperty(value = "体积")
private BigDecimal volume;
@ExcelProperty("重量")
@ApiModelProperty(value = "重量")
private BigDecimal weight;
@ExcelProperty("快递单号")
@ApiModelProperty(value = "快递单号")
private String expressNo;
@ExcelProperty("备注")
@ApiModelProperty(value = "备注")
private String remark;
@ExcelProperty("最早入仓时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "入仓时间")
private Date firstInTime;
@ExcelProperty("创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "创建时间", required = true)
private Date createTime;
/**
* 重货方数
*/
@ApiModelProperty(value = "入仓货物-重货方数")
private BigDecimal heavyNumber;
/**
* 泡货方数
*/
@ApiModelProperty(value = "入仓货物-泡货方数")
private BigDecimal lightNumber;
@ApiModelProperty(value = "混箱状态, 1-混箱")
private Integer mixStatus = 0;
@ApiModelProperty(value = "入仓影像列表")
private List<String> pictureUrls;
}
package cn.iocoder.yudao.module.product.controller.admin.prod;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
import cn.iocoder.yudao.module.product.component.ProdCostCalculation;
......@@ -15,6 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
......@@ -43,49 +45,22 @@ public class ProdLinePriceController {
*/
@PostMapping("/calculation")
@ApiOperation("计算单种运输方式的商品费用(单个商品也做数组传参)")
public CommonResult<CalculationCostResultDto> calculationProdCost(
@RequestBody ConditionParam param) {
//记录的参数日志
//String listToString = JSON.toJSONString(param);
//JsonUtils.SaveLog(listToString);
if (CollectionUtil.isEmpty(param.getProdConditionParamList())) {
public CommonResult<CalculationCostResultDto> calculationProdCost(@RequestBody ConditionParam param) {
if (CollectionUtil.isEmpty(param.getProdConditionParamList())){
return error(ORDER_ITEM_PROD_NOT_EXISTS);
}
// 前端实时计价时需要将订单的固定价格参数进行格式化,转为未定价,否则不会去查询当前实时价格
param.setProdConditionParamList(
param.getProdConditionParamList().stream().
peek(it -> it.setIsPriced(false)).
collect(Collectors.toList()));
//获取价格信息
List<ProdConditionParam> prodConditionParams =
prodCostCalculation.obtainProdLineOnePrice(
param.getProdConditionParamList(),
"",
Objects.nonNull(param.getCustomsType()) ? param.getCustomsType() : 1,
param.getCustomerId(),
param.getTransportId(),
param.getLineId(),
param.getChannelId(),
false);
CalculationCostResultDto dto =
prodCostCalculation.calculationProdCost(prodConditionParams,
"",
param.getOrderType(),
Objects.nonNull(param.getCustomsType()) ? param.getCustomsType() : 1,
Objects.nonNull(param.getIsCargoControl()) && param.getIsCargoControl() ? 1 : 0,
param.getUserId(),
param.getCustomerId(),
param.getConsignorCustomerId(),
param.getConsigneeCustomerId(),
param.getConsignorCustomerContactsId(),
param.getConsigneeCustomerContactsId(),
param.getTransportId(),
param.getLineId(),
param.getChannelId());
param.setProdConditionParamList(param.getProdConditionParamList().stream().peek(it->{
it.setIsPriced(false);
it.setPackages(Arrays.asList(Objects.isNull(it.getWarehouseInInfoVO()) ? it.getUnit().split(StrUtil.COMMA) : it.getWarehouseInInfoVO().getUnits().split(StrUtil.COMMA)));
}).collect(Collectors.toList()));
List<ProdConditionParam> prodConditionParams = prodCostCalculation.obtainProdLineOnePrice(param.getProdConditionParamList(), "",
Objects.nonNull(param.getCustomsType()) ? param.getCustomsType() : 1, param.getCustomerId(),
param.getTransportId(), param.getLineId(), param.getChannelId(), false);
CalculationCostResultDto dto = prodCostCalculation.calculationProdCost(prodConditionParams, "",
param.getOrderType(), Objects.nonNull(param.getCustomsType()) ? param.getCustomsType() : 1, Objects.nonNull(param.getIsCargoControl()) && param.getIsCargoControl() ? 1 : 0,
param.getUserId(), param.getCustomerId(), param.getConsignorCustomerId(), param.getConsigneeCustomerId(),
param.getConsignorCustomerContactsId(), param.getConsigneeCustomerContactsId(), param.getTransportId(), param.getLineId(), param.getChannelId());
return success(dto);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment