Browse Source

付款,部分退款逻辑

huangzhiguo 1 year ago
parent
commit
8ed8ef94e1

+ 29 - 8
src/main/java/com/caimei/modules/order/service/CmPayShopService.java

@@ -292,12 +292,22 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
                         p.setDiscountPrice(MathUtil.div(p.getDiscountPrice(), MathUtil.div(MathUtil.add(p.getTaxRate(), 100), 100)).doubleValue());
                         p.setDiscountPrice(MathUtil.div(p.getDiscountPrice(), MathUtil.div(MathUtil.add(p.getTaxRate(), 100), 100)).doubleValue());
                     }*/
                     }*/
                     // 付采美总金额
                     // 付采美总金额
-                    allServeAmount = MathUtil.add(allServeAmount, MathUtil.mul(p.getNum(), p.getCmCostPrice())).doubleValue();
+                    allServeAmount = MathUtil.add(allServeAmount, MathUtil.mul(MathUtil.sub(p.getNum(),p.getReturnedNum()), p.getCmCostPrice())).doubleValue();
                     // 子订单利润
                     // 子订单利润
-                    if (p.getProductType() == 0) {
-                        brokerage = MathUtil.add(brokerage, MathUtil.mul(p.getBrokerage(), p.getNum())).doubleValue();
-                    } else {
+                    if (p.getReturnedNum().equals(p.getNum())) {
                         brokerage = MathUtil.add(brokerage, 0).doubleValue();
                         brokerage = MathUtil.add(brokerage, 0).doubleValue();
+                    } else if (p.getReturnedNum() < p.getNum()) {
+                        if (p.getProductType() == 0) {
+                            brokerage = MathUtil.add(brokerage, MathUtil.mul(p.getBrokerage(), MathUtil.sub(p.getNum(), p.getReturnedNum()))).doubleValue();
+                        } else {
+                            brokerage = MathUtil.add(brokerage, 0).doubleValue();
+                        }
+                    } else {
+                        if (p.getProductType() == 0) {
+                            brokerage = MathUtil.add(brokerage, MathUtil.mul(p.getBrokerage(), p.getNum())).doubleValue();
+                        } else {
+                            brokerage = MathUtil.add(brokerage, 0).doubleValue();
+                        }
                     }
                     }
                 }
                 }
                 so.setBrokerage(brokerage);
                 so.setBrokerage(brokerage);
@@ -451,11 +461,22 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
                         p.setDiscountPrice(MathUtil.div(p.getDiscountPrice(), MathUtil.div(MathUtil.add(p.getTaxRate(), 100), 100)).doubleValue());
                         p.setDiscountPrice(MathUtil.div(p.getDiscountPrice(), MathUtil.div(MathUtil.add(p.getTaxRate(), 100), 100)).doubleValue());
                     }*/
                     }*/
                     // 付采美总金额
                     // 付采美总金额
-                    allServeAmount = MathUtil.add(allServeAmount, MathUtil.mul(p.getNum(), p.getCmCostPrice())).doubleValue();
-                    if (p.getProductType() == 0) {
-                        brokerage = MathUtil.add(brokerage, MathUtil.mul(p.getBrokerage(), p.getNum())).doubleValue();
-                    } else {
+                    allServeAmount = MathUtil.add(allServeAmount, MathUtil.mul(MathUtil.sub(p.getNum(),p.getReturnedNum()), p.getCmCostPrice())).doubleValue();
+                    // 子订单利润
+                    if (p.getReturnedNum().equals(p.getNum())) {
                         brokerage = MathUtil.add(brokerage, 0).doubleValue();
                         brokerage = MathUtil.add(brokerage, 0).doubleValue();
+                    } else if (p.getReturnedNum() < p.getNum()) {
+                        if (p.getProductType() == 0) {
+                            brokerage = MathUtil.add(brokerage, MathUtil.mul(p.getBrokerage(), MathUtil.sub(p.getNum(), p.getReturnedNum()))).doubleValue();
+                        } else {
+                            brokerage = MathUtil.add(brokerage, 0).doubleValue();
+                        }
+                    } else {
+                        if (p.getProductType() == 0) {
+                            brokerage = MathUtil.add(brokerage, MathUtil.mul(p.getBrokerage(), p.getNum())).doubleValue();
+                        } else {
+                            brokerage = MathUtil.add(brokerage, 0).doubleValue();
+                        }
                     }
                     }
                 }
                 }
                 so.setBrokerage(brokerage);
                 so.setBrokerage(brokerage);

+ 16 - 4
src/main/java/com/caimei/modules/order/service/CmRefundShopService.java

@@ -186,10 +186,20 @@ public class CmRefundShopService extends CrudService<CmRefundShopDao, CmRefundSh
                     returnNum = returnNum == null ? 0 : returnNum;
                     returnNum = returnNum == null ? 0 : returnNum;
                     p.setReturnedNum(returnNum);
                     p.setReturnedNum(returnNum);
                     // 子订单利润
                     // 子订单利润
-                    if (p.getProductType() == 0) {
-                        brokerage = MathUtil.add(brokerage, MathUtil.mul(p.getBrokerage(), p.getNum())).doubleValue();
-                    } else {
+                    if (p.getReturnedNum().equals(p.getNum())) {
                         brokerage = MathUtil.add(brokerage, 0).doubleValue();
                         brokerage = MathUtil.add(brokerage, 0).doubleValue();
+                    } else if (p.getReturnedNum() < p.getNum()) {
+                        if (p.getProductType() == 0) {
+                            brokerage = MathUtil.add(brokerage, MathUtil.mul(p.getBrokerage(), MathUtil.sub(p.getNum(), p.getReturnedNum()))).doubleValue();
+                        } else {
+                            brokerage = MathUtil.add(brokerage, 0).doubleValue();
+                        }
+                    } else {
+                        if (p.getProductType() == 0) {
+                            brokerage = MathUtil.add(brokerage, MathUtil.mul(p.getBrokerage(), p.getNum())).doubleValue();
+                        } else {
+                            brokerage = MathUtil.add(brokerage, 0).doubleValue();
+                        }
                     }
                     }
                 }
                 }
                 so.setBrokerage(brokerage);
                 so.setBrokerage(brokerage);
@@ -247,7 +257,9 @@ public class CmRefundShopService extends CrudService<CmRefundShopDao, CmRefundSh
                 so.setReceiptTotalFee(receiptTotalFee);
                 so.setReceiptTotalFee(receiptTotalFee);
                 // 获取抹平金额
                 // 获取抹平金额
                 CmPayShopRecord PayedRecord = cmRefundShopRecordDao.getPayedRecordByShopOrderId(so.getShopOrderID());
                 CmPayShopRecord PayedRecord = cmRefundShopRecordDao.getPayedRecordByShopOrderId(so.getShopOrderID());
-                so.setWipePayment(PayedRecord.getWipePayment());
+                if (null != PayedRecord) {
+                    so.setWipePayment(PayedRecord.getWipePayment());
+                }
 
 
                 CmRefundShopRecord record = refundRecord.stream().filter(r -> r.getShopOrderID().equals(so.getShopOrderID().toString())).findAny().get();
                 CmRefundShopRecord record = refundRecord.stream().filter(r -> r.getShopOrderID().equals(so.getShopOrderID().toString())).findAny().get();
                 List<NewOrderProduct> orderProductList = newOrderProductDao.findByShopOrderID(so.getShopOrderID());
                 List<NewOrderProduct> orderProductList = newOrderProductDao.findByShopOrderID(so.getShopOrderID());

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

@@ -122,7 +122,7 @@
                a.shopOrderID      AS "shopOrderID",
                a.shopOrderID      AS "shopOrderID",
                a.shopOrderNo      AS "shopOrderNo",
                a.shopOrderNo      AS "shopOrderNo",
                SUM(a.payAmount)   AS "payAmount",
                SUM(a.payAmount)   AS "payAmount",
-               SUM(a.wipePayment) AS "wipePayment",
+               ifnull(SUM(a.wipePayment), 0) AS "wipePayment",
                a.payType          AS "payType",
                a.payType          AS "payType",
                a.payTime          AS "payTime",
                a.payTime          AS "payTime",
                a.wipeTime         AS "wipeTime",
                a.wipeTime         AS "wipeTime",

+ 2 - 2
src/main/webapp/WEB-INF/views/modules/consult/type/cmConsulttypeList.jsp

@@ -73,9 +73,9 @@
     <shiro:hasPermission name="user:agency:cmConsulttype">
     <shiro:hasPermission name="user:agency:cmConsulttype">
         <li class="active"><a href="${ctx}/consult/type/cmConsulttype/">咨询类别设置</a></li>
         <li class="active"><a href="${ctx}/consult/type/cmConsulttype/">咨询类别设置</a></li>
     </shiro:hasPermission>
     </shiro:hasPermission>
-    <shiro:hasPermission name="user:agency:cmrenaksList">
+    <<%--shiro:hasPermission name="user:agency:cmrenaksList">
         <li><a href="${ctx}/new/user/agency/cmrenaksList">咨询关键词库</a></li>
         <li><a href="${ctx}/new/user/agency/cmrenaksList">咨询关键词库</a></li>
-    </shiro:hasPermission>
+    </shiro:hasPermission>--%>
 </ul>
 </ul>
 <form:form id="searchForm" modelAttribute="cmConsulttype" action="${ctx}/consult/type/cmConsulttype/" method="post"
 <form:form id="searchForm" modelAttribute="cmConsulttype" action="${ctx}/consult/type/cmConsulttype/" method="post"
            class="breadcrumb form-search">
            class="breadcrumb form-search">

+ 4 - 2
src/main/webapp/WEB-INF/views/modules/order/cmPayShopCheck.jsp

@@ -348,10 +348,12 @@
                         </c:forEach>
                         </c:forEach>
                     </td>
                     </td>
                     <td>
                     <td>
-                            ${s.income}
+                        <c:if test="${empty s.brokerage}">0.00</c:if>
+                        <c:if test="${not empty s.brokerage}">${s.brokerage}</c:if>
+                         <%--   ${s.income}
                         <c:if test="${not empty s.rebateFee}">
                         <c:if test="${not empty s.rebateFee}">
                             <span style="color: red">(含返佣服务费¥${s.rebateFee})</span>
                             <span style="color: red">(含返佣服务费¥${s.rebateFee})</span>
-                        </c:if>
+                        </c:if>--%>
                     </td>
                     </td>
                     <td>
                     <td>
                         <label class="clubFreight" style="display: none">
                         <label class="clubFreight" style="display: none">

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

@@ -610,7 +610,7 @@
                                     0.00
                                     0.00
                                 </c:if>
                                 </c:if>
                             </td>
                             </td>
-                            <td><fmt:formatNumber value="${p.cmCostPrice}" type="number" pattern="#,##0.00"/></td>
+                            <td><fmt:formatNumber value="${p.returnedNum == p.returnedNum ? 0.00 : p.cmCostPrice}" type="number" pattern="#,##0.00"/></td>
                             <td class="p-taxes">${(p.includedTax ne '' and p.includedTax eq 0 and p.invoiceType eq 3)?'---':empty p.supplierTaxRate?0.0:p.supplierTaxRate}${(p.includedTax ne '' and p.includedTax eq 0 and p.invoiceType eq 3)?'':'%'}</td>
                             <td class="p-taxes">${(p.includedTax ne '' and p.includedTax eq 0 and p.invoiceType eq 3)?'---':empty p.supplierTaxRate?0.0:p.supplierTaxRate}${(p.includedTax ne '' and p.includedTax eq 0 and p.invoiceType eq 3)?'':'%'}</td>
                             <td class="p-taxes">${(p.includedTax ne '' and (p.includedTax eq 1 or (p.includedTax eq 0 and p.invoiceType eq 3)))?'---': empty p.singleShouldPayTotalTax ?0.00:p.singleShouldPayTotalTax}</td>
                             <td class="p-taxes">${(p.includedTax ne '' and (p.includedTax eq 1 or (p.includedTax eq 0 and p.invoiceType eq 3)))?'---': empty p.singleShouldPayTotalTax ?0.00:p.singleShouldPayTotalTax}</td>
                             <td class="p-taxes-t"><c:choose>
                             <td class="p-taxes-t"><c:choose>

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

@@ -360,7 +360,7 @@
                                     0.00
                                     0.00
                                 </c:if>
                                 </c:if>
                             </td>
                             </td>
-                            <td><fmt:formatNumber value="${p.cmCostPrice}" type="number" pattern="#,##0.00"/></td>
+                            <td><fmt:formatNumber value="${p.returnedNum == p.returnedNum ? 0.00 : p.cmCostPrice}" type="number" pattern="#,##0.00"/></td>
                             <td class="p-taxes">${(p.includedTax ne '' and p.includedTax eq 0 and p.invoiceType eq 3)?'---':empty p.supplierTaxRate?0.0:p.supplierTaxRate}${(p.includedTax ne '' and p.includedTax eq 0 and p.invoiceType eq 3)?'':'%'}</td>
                             <td class="p-taxes">${(p.includedTax ne '' and p.includedTax eq 0 and p.invoiceType eq 3)?'---':empty p.supplierTaxRate?0.0:p.supplierTaxRate}${(p.includedTax ne '' and p.includedTax eq 0 and p.invoiceType eq 3)?'':'%'}</td>
                             <td class="p-taxes">${(p.includedTax ne '' and (p.includedTax eq 1 or (p.includedTax eq 0 and p.invoiceType eq 3)))?'---': empty p.singleShouldPayTotalTax ?0.00:p.singleShouldPayTotalTax}</td>
                             <td class="p-taxes">${(p.includedTax ne '' and (p.includedTax eq 1 or (p.includedTax eq 0 and p.invoiceType eq 3)))?'---': empty p.singleShouldPayTotalTax ?0.00:p.singleShouldPayTotalTax}</td>
                             <td class="p-taxes-t"><c:choose>
                             <td class="p-taxes-t"><c:choose>

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

@@ -692,7 +692,7 @@
                                     0.00
                                     0.00
                                 </c:if>
                                 </c:if>
                             </td>
                             </td>
-                            <td><fmt:formatNumber value="${p.cmCostPrice}" type="number" pattern="#,##0.00"/></td>
+                            <td><fmt:formatNumber value="${p.returnedNum == p.returnedNum ? 0.00 : p.cmCostPrice}" type="number" pattern="#,##0.00"/></td>
                             <td class="p-taxes">${(p.includedTax ne '' and p.includedTax eq 0 and p.invoiceType eq 3)?'---':empty p.supplierTaxRate?0.0:p.supplierTaxRate}${(p.includedTax ne '' and p.includedTax eq 0 and p.invoiceType eq 3)?'':'%'}</td>
                             <td class="p-taxes">${(p.includedTax ne '' and p.includedTax eq 0 and p.invoiceType eq 3)?'---':empty p.supplierTaxRate?0.0:p.supplierTaxRate}${(p.includedTax ne '' and p.includedTax eq 0 and p.invoiceType eq 3)?'':'%'}</td>
                             <td class="p-taxes">${(p.includedTax ne '' and (p.includedTax eq 1 or (p.includedTax eq 0 and p.invoiceType eq 3)))?'---': empty p.singleShouldPayTotalTax ?0.00:p.singleShouldPayTotalTax}</td>
                             <td class="p-taxes">${(p.includedTax ne '' and (p.includedTax eq 1 or (p.includedTax eq 0 and p.invoiceType eq 3)))?'---': empty p.singleShouldPayTotalTax ?0.00:p.singleShouldPayTotalTax}</td>
                             <td class="p-taxes-t"><c:choose>
                             <td class="p-taxes-t"><c:choose>

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

@@ -368,7 +368,7 @@
 										0.00
 										0.00
 									</c:if>
 									</c:if>
 								</td>
 								</td>
-								<td><fmt:formatNumber value="${p.cmCostPrice}" type="number" pattern="#,##0.00"/></td>
+								<td><fmt:formatNumber value="${p.returnedNum == p.returnedNum ? 0.00 : p.cmCostPrice}" type="number" pattern="#,##0.00"/></td>
 								<td class="p-taxes">${(p.includedTax ne '' and p.includedTax eq 0 and p.invoiceType eq 3)?'---':empty p.supplierTaxRate?0.0:p.supplierTaxRate}${(p.includedTax ne '' and p.includedTax eq 0 and p.invoiceType eq 3)?'':'%'}</td>
 								<td class="p-taxes">${(p.includedTax ne '' and p.includedTax eq 0 and p.invoiceType eq 3)?'---':empty p.supplierTaxRate?0.0:p.supplierTaxRate}${(p.includedTax ne '' and p.includedTax eq 0 and p.invoiceType eq 3)?'':'%'}</td>
 								<td class="p-taxes">${(p.includedTax ne '' and (p.includedTax eq 1 or (p.includedTax eq 0 and p.invoiceType eq 3)))?'---': empty p.singleShouldPayTotalTax ?0.00:p.singleShouldPayTotalTax}</td>
 								<td class="p-taxes">${(p.includedTax ne '' and (p.includedTax eq 1 or (p.includedTax eq 0 and p.invoiceType eq 3)))?'---': empty p.singleShouldPayTotalTax ?0.00:p.singleShouldPayTotalTax}</td>
 								<td class="p-taxes-t"><c:choose>
 								<td class="p-taxes-t"><c:choose>

+ 2 - 2
src/main/webapp/WEB-INF/views/modules/userNew/ReportList.jsp

@@ -263,9 +263,9 @@
 <shiro:hasPermission name="user:agency:cmConsulttype">
 <shiro:hasPermission name="user:agency:cmConsulttype">
     <li><a href="${ctx}/consult/type/cmConsulttype/">咨询类别设置</a></li>
     <li><a href="${ctx}/consult/type/cmConsulttype/">咨询类别设置</a></li>
 </shiro:hasPermission>
 </shiro:hasPermission>
-<shiro:hasPermission name="user:agency:cmrenaksList">
+<%--<shiro:hasPermission name="user:agency:cmrenaksList">
     <li><a href="${ctx}/new/user/agency/cmrenaksList">咨询关键词库</a></li>
     <li><a href="${ctx}/new/user/agency/cmrenaksList">咨询关键词库</a></li>
-</shiro:hasPermission>
+</shiro:hasPermission>--%>
 </ul>
 </ul>
 <form:form id="searchForm" modelAttribute="cmReport" action="${ctx}/new/user/agency/ReportList" method="post"
 <form:form id="searchForm" modelAttribute="cmReport" action="${ctx}/new/user/agency/ReportList" method="post"
            class="breadcrumb form-search">
            class="breadcrumb form-search">

+ 2 - 2
src/main/webapp/WEB-INF/views/modules/userNew/cmRegistRemarksList.jsp

@@ -85,9 +85,9 @@
     <shiro:hasPermission name="user:agency:cmConsulttype">
     <shiro:hasPermission name="user:agency:cmConsulttype">
         <li><a href="${ctx}/consult/type/cmConsulttype/">咨询类别设置</a></li>
         <li><a href="${ctx}/consult/type/cmConsulttype/">咨询类别设置</a></li>
     </shiro:hasPermission>
     </shiro:hasPermission>
-    <shiro:hasPermission name="user:agency:cmrenaksList">
+<%--    <shiro:hasPermission name="user:agency:cmrenaksList">
         <li><a href="${ctx}/new/user/agency/cmrenaksList">咨询关键词库</a></li>
         <li><a href="${ctx}/new/user/agency/cmrenaksList">咨询关键词库</a></li>
-    </shiro:hasPermission>
+    </shiro:hasPermission>--%>
 </ul>
 </ul>
 <br/>
 <br/>
 <form:form id="searchForm" modelAttribute="cmClubRemarks" action="${ctx}/new/user/agency/regist" method="post"
 <form:form id="searchForm" modelAttribute="cmClubRemarks" action="${ctx}/new/user/agency/regist" method="post"

+ 2 - 2
src/main/webapp/WEB-INF/views/modules/userNew/cmRemaksList.jsp

@@ -41,9 +41,9 @@
     <shiro:hasPermission name="user:agency:cmConsulttype">
     <shiro:hasPermission name="user:agency:cmConsulttype">
         <li><a href="${ctx}/consult/type/cmConsulttype/">咨询类别设置</a></li>
         <li><a href="${ctx}/consult/type/cmConsulttype/">咨询类别设置</a></li>
     </shiro:hasPermission>
     </shiro:hasPermission>
-    <shiro:hasPermission name="user:agency:cmrenaksList">
+<%--    <shiro:hasPermission name="user:agency:cmrenaksList">
         <li class="active"><a href="${ctx}/new/user/agency/cmrenaksList">咨询关键词库</a></li>
         <li class="active"><a href="${ctx}/new/user/agency/cmrenaksList">咨询关键词库</a></li>
-    </shiro:hasPermission>
+    </shiro:hasPermission>--%>
 </ul>
 </ul>
 <form:form id="searchForm" modelAttribute="cmRemaks" action="${ctx}/new/user/agency/cmrenaksList" method="post"
 <form:form id="searchForm" modelAttribute="cmRemaks" action="${ctx}/new/user/agency/cmrenaksList" method="post"
            class="breadcrumb form-search">
            class="breadcrumb form-search">

+ 2 - 2
src/main/webapp/WEB-INF/views/modules/userNew/cmUnRegistRemarksList.jsp

@@ -56,9 +56,9 @@
     <shiro:hasPermission name="user:agency:cmConsulttype">
     <shiro:hasPermission name="user:agency:cmConsulttype">
         <li><a href="${ctx}/consult/type/cmConsulttype/">咨询类别设置</a></li>
         <li><a href="${ctx}/consult/type/cmConsulttype/">咨询类别设置</a></li>
     </shiro:hasPermission>
     </shiro:hasPermission>
-    <shiro:hasPermission name="user:agency:cmrenaksList">
+    <%--<shiro:hasPermission name="user:agency:cmrenaksList">
         <li><a href="${ctx}/new/user/agency/cmrenaksList">咨询关键词库</a></li>
         <li><a href="${ctx}/new/user/agency/cmrenaksList">咨询关键词库</a></li>
-    </shiro:hasPermission>
+    </shiro:hasPermission>--%>
 </ul>
 </ul>
 <br/>
 <br/>
 <form:form id="searchForm" modelAttribute="visit" action="${ctx}/new/user/visit/unregist" method="post"
 <form:form id="searchForm" modelAttribute="visit" action="${ctx}/new/user/visit/unregist" method="post"