瀏覽代碼

账单推送增加按钮限制

yanliming 4 年之前
父節點
當前提交
2e5dfc6aa9

+ 3 - 0
common/src/main/java/com/jpsoft/enterprise/modules/base/entity/BillInfo.java

@@ -63,5 +63,8 @@ public class BillInfo {
     @ApiModelProperty(value = "微信展示头部图片")
     private String picUrl;
 
+    @ApiModelProperty(value = "是否支付")
+    private Boolean isPay;
+
 
 }

+ 3 - 8
common/src/main/java/com/jpsoft/enterprise/modules/base/service/impl/BillInfoServiceImpl.java

@@ -55,9 +55,6 @@ public class BillInfoServiceImpl implements BillInfoService {
 
     @Override
     public int updateDelOrderInfo(BillInfo model){
-
-        int affectCount = 0;
-
         List<BillDetailInfo> list = billDetailInfoDAO.findByBillId(model.getId());
 
         for (BillDetailInfo billDetailInfo:list) {
@@ -72,15 +69,13 @@ public class BillInfoServiceImpl implements BillInfoService {
                     billDetailInfo.setDelFlag(true);
                     billDetailInfo.setUpdateBy(model.getUpdateBy());
                     billDetailInfo.setUpdateTime(model.getUpdateTime());
-                    int countBillDetail = billDetailInfoDAO.update(billDetailInfo);
-
-                    if(countBillDetail>0){
-                        affectCount = billInfoDAO.update(model);
-                    }
+                    billDetailInfoDAO.update(billDetailInfo);
                 }
             }
         }
 
+        int affectCount = billInfoDAO.update(model);
+
         return affectCount;
     }
 

+ 34 - 0
web/src/main/java/com/jpsoft/enterprise/modules/base/controller/BillDetailController.java

@@ -573,4 +573,38 @@ public class BillDetailController {
 
         return msgResult;
     }
+
+
+    @ApiOperation(value="获取主账单信息")
+    @GetMapping("getBillInfo/{billId}")
+    public MessageResult<Boolean> getBillInfo(@PathVariable("billId") String billId){
+        MessageResult<Boolean> msgResult = new MessageResult<>();
+
+        try {
+            boolean showPushBtn = false;
+
+            List<BillDetailInfo> list = billDetailInfoService.findByBillId(billId);
+
+            for (BillDetailInfo billDetailInfo:list) {
+                OrderInfo orderInfo = orderInfoService.get(billDetailInfo.getOrderId());
+                if(orderInfo!=null){
+                    if(orderInfo.getPayStatus()==20){
+                        showPushBtn = true;
+                        break;
+                    }
+                }
+            }
+
+            msgResult.setResult(true);
+            msgResult.setData(showPushBtn);
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
 }

+ 28 - 0
web/src/main/java/com/jpsoft/enterprise/modules/base/controller/BillInfoController.java

@@ -2,8 +2,12 @@ package com.jpsoft.enterprise.modules.base.controller;
 
 
 import com.github.pagehelper.Page;
+import com.jpsoft.enterprise.modules.base.entity.BillDetailInfo;
 import com.jpsoft.enterprise.modules.base.entity.BillInfo;
+import com.jpsoft.enterprise.modules.base.entity.OrderInfo;
+import com.jpsoft.enterprise.modules.base.service.BillDetailInfoService;
 import com.jpsoft.enterprise.modules.base.service.BillInfoService;
+import com.jpsoft.enterprise.modules.base.service.OrderInfoService;
 import com.jpsoft.enterprise.modules.common.dto.MessageResult;
 import com.jpsoft.enterprise.modules.common.dto.Sort;
 import com.jpsoft.enterprise.modules.common.utils.PojoUtils;
@@ -27,6 +31,12 @@ public class BillInfoController {
     @Autowired
     private BillInfoService billInfoService;
 
+    @Autowired
+    private BillDetailInfoService billDetailInfoService;
+
+    @Autowired
+    private OrderInfoService orderInfoService;
+
     @ApiOperation(value="创建空记录")
     @GetMapping("create")
     public MessageResult<BillInfo> create(){
@@ -218,6 +228,24 @@ public class BillInfoController {
 
         Page<BillInfo> page = billInfoService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
 
+        for (BillInfo billInfo:page) {
+            List<BillDetailInfo> list = billDetailInfoService.findByBillId(billInfo.getId());
+
+            for (BillDetailInfo billDetailInfo:list) {
+                OrderInfo orderInfo = orderInfoService.get(billDetailInfo.getOrderId());
+                if(orderInfo!=null){
+                    if(orderInfo.getPayStatus()==20){
+                        billInfo.setIsPay(true);
+                    }
+                    break;
+                }
+            }
+
+            if(billInfo.getIsPay() == null){
+                billInfo.setIsPay(false);
+            }
+        }
+
 
         msgResult.setResult(true);
         msgResult.setData(PojoUtils.pageWrapper(page));