Selaa lähdekoodia

Merge remote-tracking branch 'origin/developerD' into developerA

# Conflicts:
#	src/main/java/com/caimei/modules/order/web/CmPayShopController.java
zhijiezhao 1 vuosi sitten
vanhempi
commit
dc9dc52296

+ 9 - 0
src/main/java/com/caimei/modules/order/entity/NewOrderProduct.java

@@ -88,6 +88,7 @@ public class NewOrderProduct extends DataEntity<NewOrderProduct> {
     // *****************  虚拟字段
     private Integer deliveryNum; // 发货数量
     private Integer outStoreTimes;  // 发货批次
+    private Double costPriceTax;  // 成本价 不含税
     private Double costPrice; // 成本价(快照商品成本价格)
     private Double organizeCostPrice; // 集团成本价
     private Double cmCostPrice; // 采美成本价
@@ -647,6 +648,14 @@ public class NewOrderProduct extends DataEntity<NewOrderProduct> {
         this.outStoreTimes = outStoreTimes;
     }
 
+    public Double getCostPriceTax() {
+        return costPriceTax;
+    }
+
+    public void setCostPriceTax(Double costPriceTax) {
+        this.costPriceTax = costPriceTax;
+    }
+
     public Double getCostPrice() {
         return costPrice;
     }

+ 15 - 24
src/main/java/com/caimei/modules/order/web/CmPayShopController.java

@@ -362,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);
                 // 同步使用机构税率 作为供应商税率
@@ -638,32 +640,22 @@ public class CmPayShopController extends BaseController {
                     orderProduct.setShouldPayTotalTax(singleShouldPayTotalTax * (num + presentNum - returnNum));
                     totalTaxesFee += singleShouldPayTotalTax * (num + presentNum - returnNum);
                 }
-                //总税费
-                shopOrder.setShopTaxFee(totalTaxesFee);
-                //商品费
-                shopOrder.setShopProductAmount(totalCostFee);
+                shopOrder.setShopTaxFee(totalTaxesFee); //总税费
+                shopOrder.setShopProductAmount(totalCostFee); //商品费
             }
             // 比列成本
             if ("2".equals(costType)) {
                 shopOrder.setProportional(proportional);
-                //总税费
-                shopOrder.setShopTaxFee(0D);
-                //子订单金额
-                Double productAmount = shopOrder.getProductAmount();
-                //商品费
-                shopOrder.setShopProductAmount(productAmount * proportional / 100);
+                shopOrder.setShopTaxFee(0D); //总税费
+                Double productAmount = shopOrder.getProductAmount();//子订单金额
+                shopOrder.setShopProductAmount(productAmount * proportional / 100); //商品费
             }
-            //运费
-            shopOrder.setShopPostFee(freight);
-            //付第三方
-            shopOrder.setShopOtherFee(thirdPartyFee);
+            shopOrder.setShopPostFee(freight); //运费
+            shopOrder.setShopOtherFee(thirdPartyFee); //付第三方
             shopOrder.setCostType(costType);
-            //备注
-            shopOrder.setModifyShouldPayNote(modifyShouldPayNote);
-            //修改人的用户id
-            shopOrder.setModifyShouldPayUserID(UserUtils.getUser().getId());
-            //修改时间
-            shopOrder.setModifyShouldPayDate(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
+            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() + shopOrder.getShopPostFee() + shopOrder.getShopTaxFee();
             if (shopOrder.getPayedShopAmount() != null && shouldPayShopAmount < shopOrder.getPayedShopAmount()) {
@@ -671,9 +663,8 @@ public class CmPayShopController extends BaseController {
                 res.put("msg", "付供应商的金额不能小于已付款金额");
                 return res;
             } else {
-                if (shopOrder.getPayedShopAmount() != null && shouldPayShopAmount == shopOrder.getPayedShopAmount()) {
+                if (shopOrder.getPayedShopAmount() != null && shouldPayShopAmount == shopOrder.getPayedShopAmount())
                     shopOrder.setPayStatus("3");
-                }
                 shopOrder.setShouldPayShopAmount(shouldPayShopAmount);
             }
             newShopOrderService.modifyPayShopAmount(shopOrder, orderProducts);
@@ -697,7 +688,7 @@ public class CmPayShopController extends BaseController {
         int weekIdx = instance.get(Calendar.DAY_OF_WEEK) - 1;
         String format = new SimpleDateFormat("HH:mm:ss").format(new Date());
         Integer substring = Integer.valueOf(format.substring(0, 2));
-        ids.forEach(i -> {
+        ids.forEach(i->{
             //当前时间周五下午到周日都返回1不能结算,其他时间看够不够24小时
             if ((5 == weekIdx && substring > 14) || 6 == weekIdx || 7 == weekIdx) {
                 flag.set(1);

+ 2 - 2
src/main/java/com/caimei/modules/order/web/CmShopOrderController.java

@@ -222,9 +222,9 @@ public class CmShopOrderController extends BaseController {
         for (NewOrderProduct p : list.get(0).getNewOrderProducts()) {
             Double newCostPrice = 0d;
             newCostPrice = p.getCostPrice();
-            if ("0".equals(p.getIncludedTax()) && null != p.getTaxRate() && p.getTaxRate() > 0d) {
+            /*if ("0".equals(p.getIncludedTax()) && null != p.getTaxRate() && p.getTaxRate() > 0d) {
                 p.setCostPrice(MathUtil.div(p.getCostPrice(), MathUtil.div(MathUtil.add(p.getTaxRate(), 100), 100)).doubleValue());
-            }
+            }*/
             p.setNewCostPrice(newCostPrice);
         }
         BigDecimal payShopOtherFee = cmPayShopRecordDao.findPayShopOtherFee(newShopOrder.getShopOrderID());

+ 2 - 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},
@@ -561,6 +562,7 @@
                cs.organizeId      AS organizeId,
                cs.unit as productUnit,
                (cop.discountPrice - cop.costPrice - cop.cmCostPrice) as brokerage,
+               cop.costPriceTax            AS costPriceTax,
                cop.costPrice               AS costPrice,
                ifnull(cop.organizeCostPrice, 0)       AS organizeCostPrice,
                ifnull(cop.cmCostPrice, 0)             AS cmCostPrice,

+ 1 - 1
src/main/webapp/WEB-INF/views/modules/order/cmPayShopChange.jsp

@@ -241,7 +241,7 @@
                             <td width="40%" id="productName${index.index}">${product.name}</td>
                             <td width="30%"><input id="costPrice" style="width: 80px;float: left"
                                                    name="newOrderProducts[${index.index}].costPrice"
-                                                   value="${product.costPrice}"
+                                                   value="${product.costPriceTax}"
                                                    onchange="changeShouldPay(this,${index.index})"/>
                                 <c:if test="${product.includedTax != null and product.includedTax != '' and product.includedTax ne 2}">
                                     <label style="color: red">