Ver Fonte

修改成本

huangzhiguo há 1 ano atrás
pai
commit
9bc018431a

+ 7 - 8
src/main/java/com/caimei/modules/order/web/CmPayShopController.java

@@ -202,7 +202,7 @@ public class CmPayShopController extends BaseController {
          * promotionFullReduction   促销满减优惠(不考虑凑单促销)
          */
         String shopOrderID = newShopOrder.getId();
-        Double freight = newShopOrder.getShopPostFee();
+        Double freight = null == newShopOrder.getShopPostFee() ? 0d : newShopOrder.getShopPostFee();
         Double thirdPartyFee = newShopOrder.getShopOtherFee() == null ? 0d : newShopOrder.getShopOtherFee();
         String costType = newShopOrder.getCostType();
         Double proportional = newShopOrder.getProportional();
@@ -220,8 +220,7 @@ public class CmPayShopController extends BaseController {
         double totalCostFee = 0D;
         double totalTaxesFee = 0D;
         NewShopOrder shopOrder = newShopOrderService.get(shopOrderID);
-        // 初始运费
-        Double postFee = null == shopOrder.getShopPostFee() ? 0d : shopOrder.getShopPostFee();
+
         String dbcostType = shopOrder.getCostType();
         String cmChangePayShopRecondId = "0";
         if (StringUtils.isEmpty(dbcostType)) {
@@ -363,8 +362,10 @@ public class CmPayShopController extends BaseController {
                     cmChangePayShopProduct.setSingleShouldPayTotalTax(orderProduct.getSingleShouldPayTotalTax());
                     cmChangePayShopProductService.save(cmChangePayShopProduct);
                 }
-
+                // 成本
                 orderProduct.setCostPrice(costPrice);
+                // 成本 不含税
+                orderProduct.setCostPriceTax(product.getCostPrice() == null ? 0d : product.getCostPrice());
                 orderProduct.setOrganizeCostPrice(organizeCostPrice);
                 orderProduct.setCmCostPrice(cmCostPrice);
                 // 同步使用机构税率 作为供应商税率
@@ -527,10 +528,8 @@ public class CmPayShopController extends BaseController {
         shopOrder.setModifyShouldPayNote(modifyShouldPayNote);  //备注
         shopOrder.setModifyShouldPayUserID(UserUtils.getUser().getId());  //修改人的用户id
         shopOrder.setModifyShouldPayDate(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));  //修改时间
-        double shouldPayShopAmount = shopOrder.getShopProductAmount();
-        if (null != shopOrder.getShopPostFee()) {
-            shouldPayShopAmount += (shopOrder.getShopPostFee() - postFee);
-        }
+        double shouldPayShopAmount = shopOrder.getShopProductAmount() + (null != shopOrder.getShopPostFee() ? shopOrder.getShopPostFee() : 0d);
+
         if (shopOrder.getPayedShopAmount() != null && shouldPayShopAmount == shopOrder.getPayedShopAmount()) {
             shopOrder.setPayStatus("3");
         }

+ 1 - 0
src/main/resources/mappings/modules/order/OrderProductMapper.xml

@@ -477,6 +477,7 @@
     <update id="updateProductFee">
         UPDATE cm_order_product
         SET costPrice               = #{costPrice},
+            costPriceTax            = #{costPriceTax},
             organizeCostPrice       = #{organizeCostPrice},
             cmCostPrice             = #{cmCostPrice},
             shopPercent             = #{shopPercent},