Commit eaa473a6 authored by Allen Chen's avatar Allen Chen

commit

parent daf19865
......@@ -51,5 +51,29 @@ public class CollectMailDetailEntity {
@TableField(value = "consoWarehouseCode")
private String consoWarehouseCode;
/**
* 状态 长
*/
@TableField(value = "length")
private Integer length;
/**
* 状态 宽
*/
@TableField(value = "width")
private Integer width;
/**
* 状态 高
*/
@TableField(value = "height")
private Integer height;
/**
* 状态 重
*/
@TableField(value = "weight")
private Integer weight;
}
......@@ -51,5 +51,29 @@ public class CollectOutMailDetailEntity {
@TableField(value = "consoWarehouseCode")
private String consoWarehouseCode;
/**
* 状态 长
*/
@TableField(value = "length")
private Integer length;
/**
* 状态 宽
*/
@TableField(value = "width")
private Integer width;
/**
* 状态 高
*/
@TableField(value = "height")
private Integer height;
/**
* 状态 重
*/
@TableField(value = "weight")
private Integer weight;
}
......@@ -43,4 +43,28 @@ public class LogOrderMailDetailEntity {
@TableField(value = "mailNo")
private String mailNo;
/**
* 状态 长
*/
@TableField(value = "length")
private Integer length;
/**
* 状态 宽
*/
@TableField(value = "width")
private Integer width;
/**
* 状态 高
*/
@TableField(value = "height")
private Integer height;
/**
* 状态 重
*/
@TableField(value = "weight")
private Integer weight;
}
package org.ta.pddserver.utils;
import lombok.Data;
public class PddJYPriceTool {
public static int getTotalFee(String type, int length, int width, int height, int weight, boolean international) {
public static FeeResult getTotalFee(String type, int length, int width, int height, int weight, boolean international) {
if (international) {
// 国际件
return 0;
// return PddOverseaPriceTool.FreightCostCalculation(type, length, width, height, weight);
int exchange = 1;
return PddOverseaPriceTool.FreightCostCalculation(type, length, width, height, weight, exchange);
} else {
// 国内件 属于退件
return PddNationalPriceTool.FreightCostCalculation(length, width, height, weight);
}
}
@Data
public static class FeeResult{
int weight;
int rentFee;
int freightFee;
}
}
......@@ -33,18 +33,21 @@ public class PddNationalPriceTool {
/*
* 根据类型、重量(g) 计算运费
* */
public static int FreightCostCalculation(int length, int width, int height, int weight) {
public static PddJYPriceTool.FeeResult FreightCostCalculation(int length, int width, int height, int weight) {
PddJYPriceTool.FeeResult result = new PddJYPriceTool.FeeResult();
int price = initalPrice;
if (weight < initialWeight) {
return price;
if (weight > initialWeight) {
int pw = weight - initialWeight;
int pc = pw / excessWeight;
if (pw % excessWeight != 0) {
pc += 1;
}
price = price + pc * excessPrice;
log.info("续重数量:{}", pc);
}
int pw = weight - initialWeight;
int pc = pw / excessWeight;
if (pw % excessWeight != 0) {
pc += 1;
}
price = price + pc * excessPrice;
log.info("续重数量:{}", pc);
return price;
result.setRentFee(0);
result.setFreightFee(price);
result.setWeight(weight);
return result;
}
}
package org.ta.pddserver.utils;
import java.util.HashMap;
import java.util.Map;
public class PddOverseaPriceTool {
//首重重量
// 首重重量
private static int initialWeight = 1000;
//上限重量
private static int maxWeight = 20000;
// 基础上限重量
private static int baseMaxWeight = 20000;
// 最大重量
private static int maxWeight = 300000;
// 普货首重价格
private static int gInitalPrice = 1850;
//特货首重价格
// 特货首重价格
private static int sInitalPrice = 2800;
//超重计费标准
......@@ -22,56 +21,72 @@ public class PddOverseaPriceTool {
//超重价格
private static int excessPrice = 175;
//标椎边长度
private static int standard = 100;
//标椎边长度
private static int baseSingleLength = 100;
//标准三边之和
private static int maxStandard = 160;
private static int baseSumLength = 160;
//最大单边长度
private static int maxSingleLength = 250;
//最大三边之和
private static int maxSumLength = 250;
/*
* 根据类型、重量(g) 计算运费
* */
public static Map FreightCostCalculation(String type, int length, int width, int height, int weight, int exchange) {
Map map = new HashMap();
public static PddJYPriceTool.FeeResult FreightCostCalculation(String type, int length, int width, int height, int weight, int exchange) {
int price = 0;
boolean key = true;
int excess = 0;
int max = length + width + height;
if (length > maxSingleLength || width > maxSingleLength || height > maxSingleLength || max > maxSumLength) {
//三边各超100或者和超160
return null;
}
if (weight > maxWeight) {
//超重无法计算
return null;
}
PddJYPriceTool.FeeResult result = new PddJYPriceTool.FeeResult();
int price = 0;
if (exchange == 2) {
// 改派
price = 2400;
}
if (exchange == 3) {
price = 1200;
}
//判断边长是否符合标准
if (length > standard || width > standard || height > standard || max > maxStandard) {
int compWeight = weight;
if (weight > baseMaxWeight || length > baseSingleLength || width > baseSingleLength || height > baseSingleLength || max > baseSumLength) {
//三边各超100或者和超160
key = false;
} else {
int newWeight = length * width * height / 6000 + 1;
compWeight = Math.max(compWeight, newWeight);
}
result.setWeight(compWeight);
int excess = 0;
// 判断重量是否超重
//分析重量
if (compWeight > initialWeight) {
//计算超出重量
compWeight = compWeight - initialWeight;
excess = excessPrice * ((int) Math.ceil(compWeight / excessWeight));
}
// 判断重量是否超重
if (weight > maxWeight) {
//超重无法计算
key = false;
} else {
//分析重量
if (weight > initialWeight) {
//计算超出重量
weight = weight - initialWeight;
excess = excessPrice * ((int) Math.ceil(weight / excessWeight));
}
}
if (key) {
//计算价格
if (type.equals("NORMAL")) {
//普货
price = gInitalPrice + excess;
} else {
price = sInitalPrice + excess;
}
}
//计算价格
if (type.equals("NORMAL")) {
//普货
price = price + gInitalPrice + excess;
} else {
price = price + sInitalPrice + excess;
}
map.put("price", price);
map.put("key", key);
return map;
result.setRentFee(0);
result.setFreightFee(price);
return result;
}
}
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