From 410227e469df13201cfe7b6d9c254b02fba5e11b Mon Sep 17 00:00:00 2001
From: renkang <8417338+k94314517@user.noreply.gitee.com>
Date: 星期四, 28 十一月 2024 14:48:51 +0800
Subject: [PATCH] 客户资料 巡检任务业务

---
 server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwContractServiceImpl.java |   42 ++++++++++++++++++++++++++++++++++++------
 1 files changed, 36 insertions(+), 6 deletions(-)

diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwContractServiceImpl.java b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwContractServiceImpl.java
index 51efed1..12784ab 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwContractServiceImpl.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwContractServiceImpl.java
@@ -294,11 +294,16 @@
         //澶勭悊
         dealBackRentBillBiz(param);
         YwContract update = new YwContract();
+        update.setId(param.getId());
         update.setEditDate(new Date());
         update.setEditor(param.getLoginUserInfo().getId());
         update.setBtActDate(update.getEditDate());
         update.setBtActUserId(update.getEditor());
-        update.setStatus(Constants.THREE);
+        if(Objects.nonNull(param.getBtWaitBill()) && param.getBtWaitBill() > Constants.ZERO){
+            update.setStatus(Constants.THREE);
+        }else{
+            update.setStatus(Constants.FOUR);
+        }
         update.setBtInfo(param.getBtInfo());
         update.setBtDate(param.getBtDate());
         update.setBtType(param.getBtType());
@@ -308,6 +313,30 @@
         ywContractMapper.updateById(update);
         dealLogBiz(param,Constants.YwLogType.CONTRACT_BACK, param.getLoginUserInfo().getRealname(),getbackRentLogByParam(param));
         return param.getId();
+    }
+
+
+    @Override
+    public  void dealTimeOut(){
+        //瀹氭椂澶勭悊鍚堝悓鎵ц涓�
+        ywContractMapper.update(new UpdateWrapper<YwContract>()
+                .lambda()
+                .set(YwContract::getStatus,Constants.ONE)
+                .set(YwContract::getEditDate,DateUtil.getCurrDateTime())
+                .eq(YwContract::getIsdeleted,Constants.ZERO)
+                .in(YwContract::getStatus,Constants.ZERO)
+                .apply(" START_DATE < NOW()  AND END_DATE > NOW() ")
+        );
+        //瀹氭椂澶勭悊鍚堝悓宸茶繃鏈�
+        ywContractMapper.update(new UpdateWrapper<YwContract>()
+                        .lambda()
+                .set(YwContract::getStatus,Constants.TWO)
+                .set(YwContract::getEditDate,DateUtil.getCurrDateTime())
+                .eq(YwContract::getIsdeleted,Constants.ZERO)
+                .in(YwContract::getStatus,Constants.ONE,Constants.ZERO)
+                .apply(" END_DATE < NOW() ")
+        );
+
     }
 
     private void dealBackRentBillBiz(YwContract param) {
@@ -328,7 +357,7 @@
                 //浠樻鐘舵�侊細0=寰呮敹娆撅紱1=宸茬粨娓咃紱2=閮ㄥ垎缁撴竻锛�3=寰呬粯娆撅紱4=寰呴��娆撅紱5=宸插叧闂�
                 // 濡傛灉鏄娂閲戞垨鑰呬繚璇侀噾锛屼笉鏀寔閫�娆撅紝淇濇寔鍘熸潵鐨勭姸鎬侊紝 0=绉熻祦璐癸紱1=鐗╀笟璐癸紱2=绉熻祦鎶奸噾锛�3=鐗╀笟鎶奸噾锛�4=姘寸數璐癸紱5=鏉傞」璐癸紱6=鍏朵粬;7=淇濊瘉閲�
                 if(Constants.equalsInteger(Constants.THREE,bill.getCostType())
-                        ||  Constants.equalsInteger(Constants.FOUR,bill.getCostType())
+                        ||  Constants.equalsInteger(Constants.TWO,bill.getCostType())
                         ||Constants.equalsInteger(Constants.SEVEN,bill.getCostType())){
                     //鎶奸噾鍜屼繚璇侀噾
                     yjBills.add(bill);
@@ -466,7 +495,7 @@
             throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"瀵逛笉璧凤紝鍚堝悓淇℃伅涓嶅瓨鍦紝璇疯繑鍥炲垪琛ㄥ埛鏂伴噸璇曪紒");
         }
 
-        SystemUser user = systemUserMapper.selectById(param.getUserId());
+        SystemUser user = systemUserMapper.selectById(param.getBtUserId());
         if(user ==null ||  (user.getDeleted()!=null&& user.getDeleted() )){
             throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"瀵逛笉璧凤紝缁忓姙浜轰俊鎭笉瀛樺湪锛�");
         }
@@ -538,7 +567,7 @@
             //濡傛灉鏈夌璧佹潯娆�
             if(Constants.formatBigdecimal(model.getZlDeposit()).compareTo(new BigDecimal(0))>0){
                     //濡傛灉鏈夌璧佹娂閲�
-                billList1.add(initDepoistBill(Constants.THREE,model,details));
+                billList1.add(initDepoistBill(Constants.TWO,model,details));
             }
             if(Constants.equalsInteger(model.getZlPayType(), Constants.ZERO)){
                 //濡傛灉鏄竴娆℃�т粯娓�
@@ -559,7 +588,7 @@
             //濡傛灉鐗╀笟鏉℃
             if(Constants.formatBigdecimal(model.getWyDeposit()).compareTo(new BigDecimal(0))>0){
                 //濡傛灉鏈夌璧佹娂閲�
-                billList2.add(initDepoistBill(Constants.FOUR,model,details));
+                billList2.add(initDepoistBill(Constants.THREE,model,details));
             }
             if(Constants.equalsInteger(model.getWyPayType(), Constants.ZERO)){
                 //濡傛灉鏄竴娆℃�т粯娓�
@@ -578,7 +607,7 @@
 
         if(model.getBillType() == 0){
             model.setBillList(billList1);
-        }else  if(model.getBillType() == 0){
+        }else  if(model.getBillType() == 1){
             model.setBillList(billList2);
         }
         int num =1;
@@ -1114,6 +1143,7 @@
                 .selectAs(YwCustomer::getName,YwContract::getRenterName )
                 .selectAs(YwProject::getName,YwContract::getProjectName )
                 .select("t3.realname",YwContract::getCreatorName )
+                .select("(select sum(r.area) from yw_contract_room cr left join yw_room r on r.id = cr.room_id where r.isdeleted=0 and cr.contract_id =t.id)",YwContract::getTotalArea )
                 .leftJoin(Company.class,Company::getId,YwContract::getCompanyId)
                 .leftJoin(SystemUser.class,SystemUser::getId,YwContract::getUserId)
                 .leftJoin(SystemUser.class,SystemUser::getId,YwContract::getCreator)

--
Gitblit v1.9.3