|
@@ -84,6 +84,13 @@ public class DistributionRuleServiceImpl implements DistributionRuleService{
|
|
|
if (rule.getFareType() == 2 && CollectionUtils.isEmpty(rule.getFares())){
|
|
if (rule.getFareType() == 2 && CollectionUtils.isEmpty(rule.getFares())){
|
|
|
return new ResultMap(CodeType.NO_INFO, "请完善计费方式");
|
|
return new ResultMap(CodeType.NO_INFO, "请完善计费方式");
|
|
|
}
|
|
}
|
|
|
|
|
+ if (rule.getFareType() == 2){
|
|
|
|
|
+ rule.setUniformPrice(null);
|
|
|
|
|
+ }else {
|
|
|
|
|
+ if (CollectionUtils.isEmpty(rule.getFares())){
|
|
|
|
|
+ rule.setQtyFare(null);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
if (rule.getId() == null){ //新增配送规则,初始化数据
|
|
if (rule.getId() == null){ //新增配送规则,初始化数据
|
|
|
Long uu = SystemSession.getUser().getUserUU();
|
|
Long uu = SystemSession.getUser().getUserUU();
|
|
|
Long enuu = SystemSession.getUser().getEnterprise().getUu();
|
|
Long enuu = SystemSession.getUser().getEnterprise().getUu();
|
|
@@ -101,6 +108,9 @@ public class DistributionRuleServiceImpl implements DistributionRuleService{
|
|
|
}else {
|
|
}else {
|
|
|
rule.setActive(ShortConstant.NO_SHORT);
|
|
rule.setActive(ShortConstant.NO_SHORT);
|
|
|
}
|
|
}
|
|
|
|
|
+ if (rule.getFareType() == 3){ //到付类型
|
|
|
|
|
+ rule.setUniformPrice(0d);
|
|
|
|
|
+ }
|
|
|
if (!isAdd){ //若为另存为,则将主键id设为空
|
|
if (!isAdd){ //若为另存为,则将主键id设为空
|
|
|
if (rule.getId() != null){
|
|
if (rule.getId() != null){
|
|
|
rule.setId(null);
|
|
rule.setId(null);
|
|
@@ -397,9 +407,12 @@ public class DistributionRuleServiceImpl implements DistributionRuleService{
|
|
|
*/
|
|
*/
|
|
|
public Double getFareOfRule(DistributionRule rule, Double price){
|
|
public Double getFareOfRule(DistributionRule rule, Double price){
|
|
|
Double needFare = null;
|
|
Double needFare = null;
|
|
|
- if (rule.getFareType() == 1){
|
|
|
|
|
|
|
+ if (rule.getFareType() == 1 || rule.getFareType() == 3){
|
|
|
needFare = rule.getUniformPrice();
|
|
needFare = rule.getUniformPrice();
|
|
|
}else {
|
|
}else {
|
|
|
|
|
+ if (CollectionUtils.isEmpty(rule.getFares())){
|
|
|
|
|
+ throw new IllegalOperatorException("配送规则信息丢失,刷新后重试");
|
|
|
|
|
+ }
|
|
|
for (RuleQtyFare fare : rule.getFares()){
|
|
for (RuleQtyFare fare : rule.getFares()){
|
|
|
if (fare.getStart() <= price){
|
|
if (fare.getStart() <= price){
|
|
|
if (fare.getEnd() != null){
|
|
if (fare.getEnd() != null){
|