From 027ee354f145886cb4280cc980af41e9304c7888 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期一, 25 十一月 2024 15:28:14 +0800
Subject: [PATCH] 开发更新

---
 server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwContractServiceImpl.java |   70 ++++++++++++++++++++++++++---------
 1 files changed, 52 insertions(+), 18 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 bf37d57..df4f44f 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
@@ -87,26 +87,59 @@
     }
     /**
      * 閫�绉熸彁浜�
-     * @param model
+     * @param param
      * @return
      */
     @Override
     @Transactional(rollbackFor = {BusinessException.class,Exception.class})
-    public  Integer backRent(YwContract model){
-        isParamValidCreated(model);
+    public  Integer backRent(YwContract param){
+        isParamValidBackRent(param);
+        //澶勭悊
+        dealBackRentBillBiz(param);
+        YwContract update = new YwContract();
+        update.setEditDate(new Date());
+        update.setEditor(param.getLoginUserInfo().getId());
+        update.setBtActDate(update.getEditDate());
+        update.setBtActUserId(update.getEditor());
+        update.setStatus(Constants.THREE);
+        update.setBtInfo(param.getBtInfo());
+        update.setBtDate(param.getBtDate());
+        update.setBtType(param.getBtType());
+        update.setBtUserId(param.getBtUserId());
+        update.setBtFee(param.getBtFee());
+        ywContractMapper.updateById(update);
+        dealLogBiz(param,Constants.YwLogType.CONTRACT_BACK,null,null);
+        return param.getId();
+    }
 
-        model.setCreator(model.getLoginUserInfo().getId());
-        model.setIsdeleted(Constants.ZERO);
-        model.setCreateDate(new Date());
-        model.setStatus(Constants.ZERO);
-        model.setEditDate(model.getCreateDate());
-        model.setEditor(model.getCreator());
-        model.setStatus(Constants.ZERO);//寰呮墽琛�
-        ywContractMapper.insert(model);
-        dealDetailListBiz(model);//澶勭悊鏉℃淇℃伅
-        dealMultifileBiz(model);//澶勭悊闄勪欢淇℃伅
-        dealLogBiz(model,Constants.YwLogType.CONTRACT_CREATE,null,null);//璁板綍鏂板缓鏃ュ織
-        return model.getId();
+    private void dealBackRentBillBiz(YwContract param) {
+    }
+
+    private void isParamValidBackRent(YwContract param) {
+        if(param.getId()==null
+                || param.getBtType() == null
+                || param.getBtDate() == null
+                || param.getBtUserId() == null
+                || param.getBtSignDate() == null
+                ||StringUtils.isBlank( param.getBtInfo())){
+            throw new BusinessException(ResponseStatus.BAD_REQUEST);
+        }
+        YwContract model = ywContractMapper.selectById(param.getId());
+        if(model==null || Constants.equalsInteger(model.getIsdeleted(),Constants.ONE)){
+            throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"瀵逛笉璧凤紝鍚堝悓淇℃伅涓嶅瓨鍦紝璇疯繑鍥炲垪琛ㄥ埛鏂伴噸璇曪紒");
+        }
+
+        SystemUser user = systemUserMapper.selectById(param.getUserId());
+        if(user ==null ||  (user.getDeleted()!=null&& user.getDeleted() )){
+            throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"瀵逛笉璧凤紝缁忓姙浜轰俊鎭笉瀛樺湪锛�");
+        }
+        if(param.getAddBillList()!=null && param.getAddBillList().size()>0){
+            for(YwContractBill bill: param.getAddBillList()){
+                if(bill.getCostType() == null){
+
+                }
+            }
+        }
     }
 
     private void dealDetailListBiz(YwContract model) {
@@ -211,10 +244,10 @@
         bill.setStatus(Constants.ZERO);
         bill.setStartDate(model.getStartDate());
         bill.setEndDate(model.getEndDate());
-        bill.setType(type);
+        bill.setType(Constants.ZERO);
+        bill.setCostType(type);
         bill.setTotleFee(type==Constants.THREE?model.getZlDeposit():model.getWyDeposit());//鎶奸噾璐圭敤
         bill.setSortnum(0);
-        bill.setTitle(type==Constants.THREE?"绉熻祦鎶奸噾":"鐗╀笟鎶奸噾" );
         return bill;
     }
 
@@ -416,7 +449,8 @@
         bill.setContractId(model.getId());
         bill.setStatus(Constants.ZERO);
         bill.setDetailId(d.getId());
-        bill.setType(d.getType());
+        bill.setCostType(d.getType());
+        bill.setType(Constants.ZERO);
         return bill;
     }
 

--
Gitblit v1.9.3