Pārlūkot izejas kodu

成程物流完成及其它内容变更

jz.kai 2 gadi atpakaļ
vecāks
revīzija
5a10c94625

+ 1 - 1
common/src/main/java/com/jpsoft/prices/modules/base/dao/StandardDAO.java

@@ -15,5 +15,5 @@ public interface StandardDAO {
 	int delete(String id);
 	List<Standard> list();
 	List<Standard> search(Map<String,Object> searchParams,List<Sort> sortList);
-	Standard getStandard(String companyId, String destinationId, String unitName);
+	Standard getStandard(String companyId, String destinationId, String logicId, String unitName);
 }

+ 1 - 1
common/src/main/java/com/jpsoft/prices/modules/base/entity/Destination.java

@@ -26,7 +26,7 @@ public class Destination {
         @ApiModelProperty(value = "名称")
     private String name;
         @ApiModelProperty(value = "里程(公里)")
-    private String mileage;
+    private Integer mileage;
         @ApiModelProperty(value = "是否删除")
     private Boolean delFlag;
         @DateTimeFormat(pattern="yyyy-MM-dd HH:mm")

+ 1 - 1
common/src/main/java/com/jpsoft/prices/modules/base/service/StandardService.java

@@ -14,5 +14,5 @@ public interface StandardService {
 	int delete(String id);
 	List<Standard> list();
 	Page<Standard> pageSearch(Map<String, Object> searchParams,int pageNum,int pageSize,boolean count,List<Sort> sortList);
-	Standard getStandard(String companyId, String destinationId, String unitName);
+	Standard getStandard(String companyId, String destinationId, String logicId, String unitName);
 }

+ 2 - 2
common/src/main/java/com/jpsoft/prices/modules/base/service/impl/StandardServiceImpl.java

@@ -69,7 +69,7 @@ public class StandardServiceImpl implements StandardService {
 	}
 
 	@Override
-	public Standard getStandard(String companyId, String destinationId, String unitName) {
-		return standardDAO.getStandard(companyId, destinationId, unitName);
+	public Standard getStandard(String companyId, String destinationId, String logicId, String unitName) {
+		return standardDAO.getStandard(companyId, destinationId, logicId, unitName);
 	}
 }

+ 1 - 0
common/src/main/resources/mapper/base/Standard.xml

@@ -185,6 +185,7 @@ id_,company_id,destination_id,logic_id,name_,first_weight,unit_price,unit_name,s
 		WHERE del_flag = 0
 		AND company_id = #{companyId}
 		AND destination_id = #{destinationId}
+		AND logic_id = #{logicId}
 		AND unit_name LIKE CONCAT('%',#{unitName})
 	</select>
 </mapper>

+ 79 - 37
web/src/main/java/com/jpsoft/prices/modules/base/controller/InvoiceQuotesController.java

@@ -3,14 +3,8 @@ package com.jpsoft.prices.modules.base.controller;
 import com.github.pagehelper.Page;
 import com.jpsoft.prices.modules.base.dto.InvoiceInfoDTO;
 import com.jpsoft.prices.modules.base.dto.InvoiceQuotesDTO;
-import com.jpsoft.prices.modules.base.entity.Company;
-import com.jpsoft.prices.modules.base.entity.Invoice;
-import com.jpsoft.prices.modules.base.entity.InvoiceInfo;
-import com.jpsoft.prices.modules.base.entity.Standard;
-import com.jpsoft.prices.modules.base.service.CompanyService;
-import com.jpsoft.prices.modules.base.service.InvoiceInfoService;
-import com.jpsoft.prices.modules.base.service.InvoiceService;
-import com.jpsoft.prices.modules.base.service.StandardService;
+import com.jpsoft.prices.modules.base.entity.*;
+import com.jpsoft.prices.modules.base.service.*;
 import com.jpsoft.prices.modules.common.dto.MessageResult;
 import com.jpsoft.prices.modules.common.dto.Sort;
 import com.jpsoft.prices.modules.common.utils.PojoUtils;
@@ -42,6 +36,8 @@ public class InvoiceQuotesController {
     private InvoiceInfoService invoiceInfoService;
     @Autowired
     private StandardService standardService;
+    @Autowired
+    private DestinationService destinationService;
 
     @ApiOperation(value="基于物流公司的报价单比对")
     @RequestMapping(value = "quotesList",method = RequestMethod.POST)
@@ -91,7 +87,7 @@ public class InvoiceQuotesController {
 //                        continue;
 //                    }
                     if(info.getGrossWeight().compareTo(new BigDecimal(1000)) >= 0) {
-                        standard = standardService.getStandard(company.getId(), invoice.getDestinationId(), "重量");
+                        standard = standardService.getStandard(company.getId(), invoice.getDestinationId(), "e915f3a3-a431-4879-a729-a4b4d0a0e97a", "重量");
                         if(standard != null) {
                             BigDecimal tempFee = weightPlanA(standard, info);
 
@@ -111,7 +107,7 @@ public class InvoiceQuotesController {
                         }
                     }
                     if(info.getBoxLength() >= 1000 || info.getBoxWidth() >= 1000 ||info.getBoxHight() >= 1000) {
-                        standard = standardService.getStandard(company.getId(), invoice.getDestinationId(), "木箱(1米及以上)");
+                        standard = standardService.getStandard(company.getId(), invoice.getDestinationId(), "e915f3a3-a431-4879-a729-a4b4d0a0e97a", "木箱(1米及以上)");
                         if(standard != null) {
                             BigDecimal tempFee = piecePlan(standard, info);
 
@@ -131,7 +127,7 @@ public class InvoiceQuotesController {
                         }
                     }
                     if(info.getBoxLength() < 1000 && info.getBoxWidth() < 1000 && info.getBoxHight() < 1000) {
-                        standard = standardService.getStandard(company.getId(), invoice.getDestinationId(), "木箱(1米以下)");
+                        standard = standardService.getStandard(company.getId(), invoice.getDestinationId(), "e915f3a3-a431-4879-a729-a4b4d0a0e97a", "木箱(1米以下)");
                         if(standard != null) {
                             BigDecimal tempFee = piecePlan(standard, info);
 
@@ -176,7 +172,7 @@ public class InvoiceQuotesController {
                 }
 
                 if(totalWeight.compareTo(new BigDecimal(0)) > 0 && (new BigDecimal(1)).compareTo(totalWeight) >= 0) {
-                    Standard standard = standardService.getStandard(company.getId(), invoice.getDestinationId(), "重量〖0,1】");
+                    Standard standard = standardService.getStandard(company.getId(), invoice.getDestinationId(), "d4e79194-6367-4fdc-bc39-a68accdb499f", "重量〖0,1】");
                     if(standard != null) {
                         BigDecimal tempFee = weightPlanB(standard, totalWeight);
 
@@ -190,7 +186,7 @@ public class InvoiceQuotesController {
                     }
                 }
                 if(totalWeight.compareTo(new BigDecimal(1)) > 0 && (new BigDecimal(50)).compareTo(totalWeight) >= 0) {
-                    Standard standard = standardService.getStandard(company.getId(), invoice.getDestinationId(), "重量〖1,50】");
+                    Standard standard = standardService.getStandard(company.getId(), invoice.getDestinationId(), "d4e79194-6367-4fdc-bc39-a68accdb499f", "重量〖1,50】");
                     if(standard != null) {
                         BigDecimal tempFee = weightPlanB(standard, totalWeight);
 
@@ -204,7 +200,7 @@ public class InvoiceQuotesController {
                     }
                 }
                 if(totalWeight.compareTo(new BigDecimal(50)) > 0 && (new BigDecimal(100)).compareTo(totalWeight) >= 0) {
-                    Standard standard = standardService.getStandard(company.getId(), invoice.getDestinationId(), "重量〖50,100】");
+                    Standard standard = standardService.getStandard(company.getId(), invoice.getDestinationId(), "d4e79194-6367-4fdc-bc39-a68accdb499f", "重量〖50,100】");
                     if(standard != null) {
                         BigDecimal tempFee = weightPlanB(standard, totalWeight);
 
@@ -218,7 +214,7 @@ public class InvoiceQuotesController {
                     }
                 }
                 if(totalWeight.compareTo(new BigDecimal(100)) > 0 && (new BigDecimal(200)).compareTo(totalWeight) >= 0) {
-                    Standard standard = standardService.getStandard(company.getId(), invoice.getDestinationId(), "重量〖100,200】");
+                    Standard standard = standardService.getStandard(company.getId(), invoice.getDestinationId(), "d4e79194-6367-4fdc-bc39-a68accdb499f", "重量〖100,200】");
                     if(standard != null) {
                         BigDecimal tempFee = weightPlanB(standard, totalWeight);
 
@@ -232,7 +228,7 @@ public class InvoiceQuotesController {
                     }
                 }
                 if(totalWeight.compareTo(new BigDecimal(200)) > 0 && (new BigDecimal(300)).compareTo(totalWeight) >= 0) {
-                    Standard standard = standardService.getStandard(company.getId(), invoice.getDestinationId(), "重量〖200,300】");
+                    Standard standard = standardService.getStandard(company.getId(), invoice.getDestinationId(), "d4e79194-6367-4fdc-bc39-a68accdb499f", "重量〖200,300】");
                     if(standard != null) {
                         BigDecimal tempFee = weightPlanB(standard, totalWeight);
 
@@ -246,7 +242,7 @@ public class InvoiceQuotesController {
                     }
                 }
                 if(totalWeight.compareTo(new BigDecimal(300)) > 0 && (new BigDecimal(500)).compareTo(totalWeight) >= 0) {
-                    Standard standard = standardService.getStandard(company.getId(), invoice.getDestinationId(), "重量〖300,500】");
+                    Standard standard = standardService.getStandard(company.getId(), invoice.getDestinationId(), "d4e79194-6367-4fdc-bc39-a68accdb499f", "重量〖300,500】");
                     if(standard != null) {
                         BigDecimal tempFee = weightPlanB(standard, totalWeight);
 
@@ -260,7 +256,7 @@ public class InvoiceQuotesController {
                     }
                 }
                 if(totalWeight.compareTo(new BigDecimal(500)) > 0 && (new BigDecimal(1000)).compareTo(totalWeight) >= 0) {
-                    Standard standard = standardService.getStandard(company.getId(), invoice.getDestinationId(), "重量〖500,1000】");
+                    Standard standard = standardService.getStandard(company.getId(), invoice.getDestinationId(), "d4e79194-6367-4fdc-bc39-a68accdb499f", "重量〖500,1000】");
                     if(standard != null) {
                         BigDecimal tempFee = weightPlanB(standard, totalWeight);
 
@@ -274,7 +270,7 @@ public class InvoiceQuotesController {
                     }
                 }
                 if(totalWeight.compareTo(new BigDecimal(1000)) > 0 && (new BigDecimal(2000)).compareTo(totalWeight) >= 0) {
-                    Standard standard = standardService.getStandard(company.getId(), invoice.getDestinationId(), "重量〖1000,2000】");
+                    Standard standard = standardService.getStandard(company.getId(), invoice.getDestinationId(), "d4e79194-6367-4fdc-bc39-a68accdb499f", "重量〖1000,2000】");
                     if(standard != null) {
                         BigDecimal tempFee = weightPlanB(standard, totalWeight);
 
@@ -288,7 +284,7 @@ public class InvoiceQuotesController {
                     }
                 }
                 if(totalWeight.compareTo(new BigDecimal(2000)) > 0) {
-                    Standard standard = standardService.getStandard(company.getId(), invoice.getDestinationId(), "重量〖2000,∞】");
+                    Standard standard = standardService.getStandard(company.getId(), invoice.getDestinationId(), "d4e79194-6367-4fdc-bc39-a68accdb499f", "重量〖2000,∞】");
                     if(standard != null) {
                         BigDecimal tempFee = weightPlanB(standard, totalWeight);
 
@@ -301,22 +297,68 @@ public class InvoiceQuotesController {
                         totalFee = transportFee.add(deliveryFee).add(storageFee).add(insureFee).add(taxFee).add(receiptFee);
                     }
                 }
-//                if(totalWeight.compareTo(new BigDecimal(300)) > 0 && (new BigDecimal(500)).compareTo(totalWeight) >= 0) {
-//                    Standard standard = standardService.getStandard(company.getId(), invoice.getDestinationId(), "重量〖300,500】");
-//                    if(standard != null) {
-//                        BigDecimal tempFee = weightPlanB(standard, totalWeight, totalVolume);
-//
-//                        transportFee = transportFee.add(tempFee);
-//                        deliveryFee = standard.getDeliveryFee();
-//                        storageFee = standard.getStorageFee();
-//                        insureFee = new BigDecimal(invoice.getGoodsValue()).multiply(standard.getInsureFee());
-//                        taxFee = transportFee.multiply(standard.getTaxFee());
-//                        receiptFee = standard.getReceiptFee();
-//                        totalFee = transportFee.add(deliveryFee).add(storageFee).add(insureFee).add(taxFee).add(receiptFee);
-//                    }
-//                }
+                if(totalWeight.compareTo(new BigDecimal(0)) > 0 && (new BigDecimal(1000)).compareTo(totalWeight) >= 0) {
+                    Standard standard = standardService.getStandard(company.getId(), invoice.getDestinationId(), "f01af697-c6a3-4e83-a500-360926df9597", "重量〖0,1】");
+                    if(standard != null) {
+                        Destination destination = destinationService.get(invoice.getDestinationId());
+                        BigDecimal tempFee = weightPlanC(standard, totalWeight, new BigDecimal(destination.getMileage()));
+
+                        transportFee = transportFee.add(tempFee);
+                        deliveryFee = standard.getDeliveryFee();
+                        storageFee = standard.getStorageFee();
+                        insureFee = new BigDecimal(invoice.getGoodsValue()).multiply(standard.getInsureFee());
+                        taxFee = transportFee.multiply(standard.getTaxFee());
+                        receiptFee = standard.getReceiptFee();
+                        totalFee = transportFee.add(deliveryFee).add(storageFee).add(insureFee).add(taxFee).add(receiptFee);
+                    }
+                }
+                if(totalWeight.compareTo(new BigDecimal(1000)) > 0 && (new BigDecimal(3000)).compareTo(totalWeight) >= 0) {
+                    Standard standard = standardService.getStandard(company.getId(), invoice.getDestinationId(), "f01af697-c6a3-4e83-a500-360926df9597", "重量〖1,3】");
+                    if(standard != null) {
+                        Destination destination = destinationService.get(invoice.getDestinationId());
+                        BigDecimal tempFee = weightPlanC(standard, totalWeight, new BigDecimal(destination.getMileage()));
+
+                        transportFee = transportFee.add(tempFee);
+                        deliveryFee = standard.getDeliveryFee();
+                        storageFee = standard.getStorageFee();
+                        insureFee = new BigDecimal(invoice.getGoodsValue()).multiply(standard.getInsureFee());
+                        taxFee = transportFee.multiply(standard.getTaxFee());
+                        receiptFee = standard.getReceiptFee();
+                        totalFee = transportFee.add(deliveryFee).add(storageFee).add(insureFee).add(taxFee).add(receiptFee);
+                    }
+                }
+                if(totalWeight.compareTo(new BigDecimal(3000)) > 0 && (new BigDecimal(5000)).compareTo(totalWeight) >= 0) {
+                    Standard standard = standardService.getStandard(company.getId(), invoice.getDestinationId(), "f01af697-c6a3-4e83-a500-360926df9597", "重量〖3,5】");
+                    if(standard != null) {
+                        Destination destination = destinationService.get(invoice.getDestinationId());
+                        BigDecimal tempFee = weightPlanC(standard, totalWeight, new BigDecimal(destination.getMileage()));
+
+                        transportFee = transportFee.add(tempFee);
+                        deliveryFee = standard.getDeliveryFee();
+                        storageFee = standard.getStorageFee();
+                        insureFee = new BigDecimal(invoice.getGoodsValue()).multiply(standard.getInsureFee());
+                        taxFee = transportFee.multiply(standard.getTaxFee());
+                        receiptFee = standard.getReceiptFee();
+                        totalFee = transportFee.add(deliveryFee).add(storageFee).add(insureFee).add(taxFee).add(receiptFee);
+                    }
+                }
+                if(totalWeight.compareTo(new BigDecimal(5000)) > 0) {
+                    Standard standard = standardService.getStandard(company.getId(), invoice.getDestinationId(), "f01af697-c6a3-4e83-a500-360926df9597", "重量〖5,∞】");
+                    if(standard != null) {
+                        Destination destination = destinationService.get(invoice.getDestinationId());
+                        BigDecimal tempFee = weightPlanC(standard, totalWeight, new BigDecimal(destination.getMileage()));
+
+                        transportFee = transportFee.add(tempFee);
+                        deliveryFee = standard.getDeliveryFee();
+                        storageFee = standard.getStorageFee();
+                        insureFee = new BigDecimal(invoice.getGoodsValue()).multiply(standard.getInsureFee());
+                        taxFee = transportFee.multiply(standard.getTaxFee());
+                        receiptFee = standard.getReceiptFee();
+                        totalFee = transportFee.add(deliveryFee).add(storageFee).add(insureFee).add(taxFee).add(receiptFee);
+                    }
+                }
                 if(totalWeight.compareTo(new BigDecimal(5 * 1000)) <= 0 && totalVolume <= 25 * 1000000) {
-                    Standard standard = standardService.getStandard(company.getId(), invoice.getDestinationId(), "整车(4.2米)");
+                    Standard standard = standardService.getStandard(company.getId(), invoice.getDestinationId(), "27ecefdd-ed26-45ba-8995-d8e7a35bb78e", "整车(4.2米)");
                     if(standard != null) {
                         BigDecimal tempFee = rentalPlan(standard);
 
@@ -330,7 +372,7 @@ public class InvoiceQuotesController {
                     }
                 }
                 else if(totalWeight.compareTo(new BigDecimal(15 * 1000)) > 0 || totalVolume > 50 * 1000000) {
-                    Standard standard = standardService.getStandard(company.getId(), invoice.getDestinationId(), "整车(9.6米)");
+                    Standard standard = standardService.getStandard(company.getId(), invoice.getDestinationId(), "27ecefdd-ed26-45ba-8995-d8e7a35bb78e", "整车(9.6米)");
                     if(standard != null) {
                         BigDecimal tempFee = rentalPlan(standard);
 
@@ -344,7 +386,7 @@ public class InvoiceQuotesController {
                     }
                 }
                 else {
-                    Standard standard = standardService.getStandard(company.getId(), invoice.getDestinationId(), "整车(6.8米)");
+                    Standard standard = standardService.getStandard(company.getId(), invoice.getDestinationId(), "27ecefdd-ed26-45ba-8995-d8e7a35bb78e", "整车(6.8米)");
                     if(standard != null) {
                         BigDecimal tempFee = rentalPlan(standard);
 

+ 16 - 0
web/src/main/java/com/jpsoft/prices/modules/common/controller/PlansController.java

@@ -53,6 +53,22 @@ public class PlansController {
         return val;
     }
 
+    /**
+     * 计重方案(油价浮动)
+     */
+    public static BigDecimal weightPlanC(Standard standard, BigDecimal weight, BigDecimal distance){
+        BigDecimal val = new BigDecimal(0);
+        weight = weight.divide(new BigDecimal(1000));
+
+        if(weight.compareTo(standard.getFirstWeight()) <= 0){
+            weight = standard.getFirstWeight();
+        }
+
+        val = standard.getUnitPrice().multiply(weight).multiply(distance);
+
+        return val;
+    }
+
     /**
      * 整车方案
      */