From 0b87957ee3e835c843408fc19bec659ca161fad8 Mon Sep 17 00:00:00 2001
From: renkang <8417338+k94314517@user.noreply.gitee.com>
Date: 星期一, 25 十一月 2024 18:41:50 +0800
Subject: [PATCH] 客户资料 巡检任务业务

---
 server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwContractBillServiceImpl.java |   43 ++++++++++++++++++++++++++-----------------
 1 files changed, 26 insertions(+), 17 deletions(-)

diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwContractBillServiceImpl.java b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwContractBillServiceImpl.java
index 7d4dc16..cd31b01 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwContractBillServiceImpl.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwContractBillServiceImpl.java
@@ -8,10 +8,7 @@
 import com.doumee.core.model.PageWrap;
 import com.doumee.core.utils.Constants;
 import com.doumee.core.utils.Utils;
-import com.doumee.dao.business.YwContractBillMapper;
-import com.doumee.dao.business.YwContractRevenueMapper;
-import com.doumee.dao.business.YwContractRoomMapper;
-import com.doumee.dao.business.YwRoomMapper;
+import com.doumee.dao.business.*;
 import com.doumee.dao.business.model.*;
 import com.doumee.dao.system.MultifileMapper;
 import com.doumee.dao.system.model.Multifile;
@@ -53,6 +50,9 @@
     @Autowired
     private SystemDictDataBiz systemDictDataBiz;
 
+    @Autowired
+    private YwContractMapper ywContractMapper;
+
 
 
     @Override
@@ -71,6 +71,14 @@
         ){
             throw new BusinessException(ResponseStatus.BAD_REQUEST);
         }
+        YwContract ywContract = ywContractMapper.selectById(ywContractBill.getContractId());
+        if(Objects.isNull(ywContract)){
+            throw new BusinessException(ResponseStatus.DATA_EMPTY);
+        }
+        if(Constants.equalsInteger(ywContract.getStatus(),Constants.THREE)){
+            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鍚堝悓鐘舵�佸凡娴佽浆,鏃犳硶杩涜璇ユ搷浣�");
+        }
+
         LoginUserInfo loginUserInfo = ywContractBill.getLoginUserInfo();
         ywContractBill.setReceivableFee(ywContractBill.getTotleFee());
         ywContractBill.setCreateDate(new Date());
@@ -170,6 +178,7 @@
         if(Objects.isNull(ywContractBill)){
             throw new BusinessException(ResponseStatus.DATA_EMPTY);
         }
+
         //鎴挎簮鏁版嵁
         ywContractBill.setYwContractRoomList(ywContractRoomMapper.selectJoinList(YwContractRoom.class,new MPJLambdaWrapper<YwContractRoom>()
                 .selectAll(YwContractRoom.class)
@@ -183,16 +192,7 @@
                 .eq(YwContractRoom::getContractId,id)
                 .eq(YwContractRoom::getType,Constants.ONE)
         ));
-        //鏀舵敮鏄庣粏
-        ywContractBill.setYwContractRevenueList(
-            ywContractRevenueMapper.selectJoinList(YwContractRevenue.class,new MPJLambdaWrapper<YwContractRevenue>()
-                            .selectAll(YwContractRevenue.class)
-                            .selectAs(YwCustomer::getName,YwContractRevenue::getCustomerNme)
-                            .leftJoin(YwContract.class,YwContract::getId,YwContractRevenue::getContractId)
-                            .leftJoin(YwCustomer.class,YwCustomer::getId,YwContract::getRenterId)
-                    .eq(YwContractRevenue::getBillId,id)
-            )
-        );
+
         //闄勪欢鏁版嵁
         List<Multifile> multifileList = multifileMapper.selectList(new QueryWrapper<Multifile>().lambda()
                 .eq(Multifile::getObjId,id)
@@ -246,8 +246,8 @@
                             YwContractBill::getType,model.getType())
                     .eq(Objects.nonNull(model)&&Objects.nonNull(model.getContractId()),
                             YwContractBill::getContractId,model.getContractId())
-                .ge(YwContractBill::getPlanPayDate, Utils.Date.getStart(model.getPlanPayDateStart()))
-                .le(YwContractBill::getPlanPayDate, Utils.Date.getEnd(model.getPlanPayDateEnd())) )
+                .ge(Objects.nonNull(model)&&Objects.nonNull(model.getPlanPayDateStart()),YwContractBill::getPlanPayDate, Utils.Date.getStart(model.getPlanPayDateStart()))
+                .le(Objects.nonNull(model)&&Objects.nonNull(model.getPlanPayDateEnd()),YwContractBill::getPlanPayDate, Utils.Date.getEnd(model.getPlanPayDateEnd())) )
         ;
         this.dealRoomDetail(iPage.getRecords());
         for (YwContractBill ywContractBill:iPage.getRecords()) {
@@ -255,6 +255,16 @@
             ywContractBill.setNeedReceivableFee(
                     ywContractBill.getReceivableFee().subtract(ywContractBill.getActReceivableFee())
             );
+            //鏄惁閫炬湡
+            if(Constants.equalsInteger(ywContractBill.getStatus(),Constants.ZERO) && (Constants.equalsInteger(ywContractBill.getPayStatus(),Constants.ZERO)
+            || Constants.equalsInteger(ywContractBill.getPayStatus(),Constants.TWO)
+            || Constants.equalsInteger(ywContractBill.getPayStatus(),Constants.THREE)
+            || Constants.equalsInteger(ywContractBill.getPayStatus(),Constants.FOUR))
+            && ywContractBill.getEndDate().getTime() < System.currentTimeMillis()){
+                ywContractBill.setIsOverdue(Constants.ONE);
+            }else{
+                ywContractBill.setIsOverdue(Constants.ZERO);
+            }
             //妤煎畤鍚嶇О
             List<YwContractRoom> ywContractRoomList = ywContractBill.getYwContractRoomList();
             StringBuilder roomPathName = new StringBuilder();
@@ -276,7 +286,6 @@
                 }
             }
             ywContractBill.setRoomPathName(roomPathName.toString());
-
         }
 
         return PageData.from(iPage);

--
Gitblit v1.9.3