Commit eaa473a6 authored by Allen Chen's avatar Allen Chen

commit

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