Bladeren bron

订单结算bugfix

zhijiezhao 2 jaren geleden
bovenliggende
commit
a934d5bb59

+ 11 - 0
src/main/java/com/caimei/modules/order/service/CmPayShopService.java

@@ -1293,6 +1293,17 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
                     newOrderDao.insertSettleRecord(settleRecord);
                     // 修改cm_split_account settlestatus
                     newOrderDao.updateSettleStatus(shopOrderId, 3);
+                    //计算供应商成本,结算金额,修改结算状态
+                    Double shouldPayShopAmount = newOrderDao.findShouldPayShopAmount(shopOrderId);
+                    //计算供应商成本,结算金额,修改结算状态
+                    Double settleSum = newOrderDao.findSettleSum(shopOrderId);
+                    if (shouldPayShopAmount > settleSum) {
+                        //成本>结算金额,部分结算
+                        newOrderDao.updateShopOrderSettleStatus(shopOrderId, 2);
+                    } else {
+                        //成本=结算金额 全部结算
+                        newOrderDao.updateShopOrderSettleStatus(shopOrderId, 3);
+                    }
                 }
                 //解锁
                 redisService.remove("SDJSS");

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

@@ -776,6 +776,13 @@ public class CmPayShopController extends BaseController {
      */
     @RequestMapping("settlement")
     public String settlement(Double settleAmount, String shopOrderId,RedirectAttributes redirectAttributes) throws Exception {
+        Double shouldPayShopAmount = newOrderDao.findShouldPayShopAmount(shopOrderId);
+        Double settleSum = newOrderDao.findSettleSum(shopOrderId);
+        if(settleSum>=shouldPayShopAmount){
+            addMessage(redirectAttributes, "此订单已结算完毕!");
+            return "redirect:" + Global.getAdminPath() + "/shopOrder/settlement";
+        }
+        if(settleSum>=shouldPayShopAmount){}
         Integer SDJSS = (Integer) redisService.get("SDJSS");
         //验锁
         if (null != SDJSS && SDJSS > 0) {

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

@@ -344,7 +344,7 @@
             <table class="table table-striped table-bordered table-condensed pay-table">
                 <tr>
                     <th style="width:20px;">
-                        <input type="checkbox" data-shoporderid="${s.shopOrderID}" data-shopid="${s.shopID}" data-isPayShopOtherFee="${s.payShopOtherFee}"/>
+                        <input type="checkbox" class="checkShop" data-shoporderid="${s.shopOrderID}" data-shopid="${s.shopID}" data-isPayShopOtherFee="${s.payShopOtherFee}" onclick="changeCheck()"/>
                     </th>
                     <th>子订单编号(ID)</th>
                     <th colspan="3">订单编号(ID)</th>
@@ -623,6 +623,14 @@
 <div class="pagination">${page}</div>
 
 <script>
+    function changeCheck(){
+        var checked = $('input[type=checkbox]:checked');
+        if (checked.length >= 1) {
+            // $(".checkShop").attr('disabled','true');
+            alertx("请最多选择一个子订单进行结算");
+            return false;
+        }
+    }
     (function () {
         var payTableEle = $('.pay-table'),
             payProductEle = $('.pay-product-item');

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

@@ -271,7 +271,7 @@
     <c:forEach items="${pr}" var="p" varStatus="pvs">
         <tr>
             <td>${pvs.index}</td>
-            <td>${p.settleTime}</td>
+            <td><fmt:formatDate value="${p.settleTime}" pattern="yyyy-MM-dd HH:mm"/></td>
             <td>${p.settleType eq 1 ? "成本结算":"佣金结算"}</td>
             <td>${p.settleAmount}</td>
         </tr>