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

---
 server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwContractRevenueServiceImpl.java |   57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 57 insertions(+), 0 deletions(-)

diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwContractRevenueServiceImpl.java b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwContractRevenueServiceImpl.java
index 01e6e53..7a0754c 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwContractRevenueServiceImpl.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwContractRevenueServiceImpl.java
@@ -1,9 +1,19 @@
 package com.doumee.service.business.impl;
 
+import com.doumee.core.constants.ResponseStatus;
+import com.doumee.core.exception.BusinessException;
+import com.doumee.core.model.LoginUserInfo;
 import com.doumee.core.model.PageData;
 import com.doumee.core.model.PageWrap;
+import com.doumee.core.utils.Constants;
 import com.doumee.core.utils.Utils;
+import com.doumee.dao.business.YwAccountMapper;
+import com.doumee.dao.business.YwContractBillMapper;
 import com.doumee.dao.business.YwContractRevenueMapper;
+import com.doumee.dao.business.dao.CompanyMapper;
+import com.doumee.dao.business.model.Company;
+import com.doumee.dao.business.model.YwAccount;
+import com.doumee.dao.business.model.YwContractBill;
 import com.doumee.dao.business.model.YwContractRevenue;
 import com.doumee.service.business.YwContractRevenueService;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -14,7 +24,9 @@
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
 
+import java.util.Date;
 import java.util.List;
+import java.util.Objects;
 
 /**
  * 杩愮淮鍚堝悓鏀舵敮娴佹按Service瀹炵幇
@@ -27,9 +39,54 @@
     @Autowired
     private YwContractRevenueMapper ywContractRevenueMapper;
 
+    @Autowired
+    private YwContractBillMapper ywContractBillMapper;
+
+    @Autowired
+    private CompanyMapper companyMapper;
+
+    @Autowired
+    private YwAccountMapper ywAccountMapper;
+
     @Override
     public Integer create(YwContractRevenue ywContractRevenue) {
+        if(Objects.isNull(ywContractRevenue)
+        || Objects.isNull(ywContractRevenue.getActReceivableFee())
+                || Objects.isNull(ywContractRevenue.getActPayDate())
+                || Objects.isNull(ywContractRevenue.getPayType())
+                || Objects.isNull(ywContractRevenue.getCompanyId())
+                || Objects.isNull(ywContractRevenue.getAccountId())
+                || Objects.isNull(ywContractRevenue.getBillId())
+        ){
+             throw new BusinessException(ResponseStatus.BAD_REQUEST);
+        }
+        YwContractBill ywContractBill = ywContractBillMapper.selectById(ywContractRevenue.getBillId());
+        if(Objects.isNull(ywContractBill)){
+            throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"鏈煡璇㈠埌璐﹀崟淇℃伅");
+        }
+        Company company =companyMapper.selectById(ywContractRevenue.getCompanyId());
+        if(Objects.isNull(company)){
+            throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"鏈煡璇㈠埌鎵�灞炲叕鍙镐俊鎭�");
+        }
+        YwAccount ywAccount =ywAccountMapper.selectById(ywContractRevenue.getAccountId());
+        if(Objects.isNull(ywAccount)){
+            throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"鏈煡璇㈠埌鏀舵敮璐︽埛淇℃伅");
+        }
+        LoginUserInfo loginUserInfo = ywContractRevenue.getLoginUserInfo();
+        ywContractRevenue.setCreateDate(new Date());
+        ywContractRevenue.setCreator(loginUserInfo.getId());
+        ywContractRevenue.setIsdeleted(Constants.ZERO);
+        ywContractRevenue.setStatus(Constants.ZERO);
+        ywContractRevenue.setContractId(ywContractBill.getContractId());
+        ywContractRevenue.setRevenueType(ywContractBill.getBillType());
         ywContractRevenueMapper.insert(ywContractRevenue);
+        //鏍规嵁鏀舵敮鎯呭喌 鏇存柊璐﹀崟鏁版嵁
+
+
+
+
+
+
         return ywContractRevenue.getId();
     }
 

--
Gitblit v1.9.3