From d3767d594de66cb5f9d1294931acefea1866f783 Mon Sep 17 00:00:00 2001
From: renkang <8417338+k94314517@user.noreply.gitee.com>
Date: 星期五, 24 一月 2025 18:24:25 +0800
Subject: [PATCH] 客户资料 巡检任务业务
---
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwContractBillServiceImpl.java | 685 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 673 insertions(+), 12 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 88d3a28..436e79a 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
@@ -2,14 +2,19 @@
import com.doumee.biz.system.SystemDictDataBiz;
import com.doumee.core.constants.ResponseStatus;
+import com.doumee.core.excel.ExcelReplaceCommon;
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.DateUtil;
import com.doumee.core.utils.Utils;
import com.doumee.dao.business.*;
+import com.doumee.dao.business.dto.YwSmsEmailBillCallDTO;
import com.doumee.dao.business.model.*;
+import com.doumee.dao.business.vo.YwContractBillCallDataVO;
+import com.doumee.dao.business.vo.YwContractBillDataVO;
import com.doumee.dao.system.MultifileMapper;
import com.doumee.dao.system.model.Multifile;
import com.doumee.dao.system.model.SystemUser;
@@ -19,12 +24,19 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
+import lombok.extern.java.Log;
import org.apache.commons.lang3.StringUtils;
+import org.checkerframework.checker.units.qual.C;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
+import javax.servlet.http.HttpServletResponse;
+import java.io.File;
import java.math.BigDecimal;
+import java.net.URLEncoder;
+import java.nio.charset.Charset;
import java.util.*;
import java.util.stream.Collectors;
@@ -54,7 +66,18 @@
@Autowired
private YwContractMapper ywContractMapper;
+ @Autowired
+ private YwAccountMapper ywAccountMapper;
+ @Autowired
+ private MemberMapper memberMapper;
+
+ @Autowired
+ private YwTempConfigMapper ywTempConfigMapper;
+
+
+ @Value("${zip_file_path}")
+ private String zipFilePath;
@Override
public Integer create(YwContractBill ywContractBill) {
@@ -98,11 +121,14 @@
ywContractBill.setEndDate(ywContractBill.getPlanPayDate());
}
//鏌ヨ鍚堝悓涓嬬殑鏈�澶х殑搴忓彿
- List<YwContractBill> ywContractBillList = ywContractBillMapper.selectList(new QueryWrapper<YwContractBill>().lambda().eq(YwContractBill::getContractId,ywContract.getId()).orderByDesc(YwContractBill::getId));
+ List<YwContractBill> ywContractBillList = ywContractBillMapper.selectList(new QueryWrapper<YwContractBill>()
+ .lambda().eq(YwContractBill::getContractId,ywContract.getId())
+ .in(YwContractBill::getCostType,Constants.ZERO,Constants.SIX,Constants.FOUR,Constants.FIVE,7)
+ .orderByDesc(YwContractBill::getId));
if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(ywContractBillList)){
ywContractBill.setSortnum(ywContractBillList.size() + 1 );
}else{
- ywContractBill.setSortnum(Constants.ZERO);
+ ywContractBill.setSortnum(0);
}
ywContractBillMapper.insert(ywContractBill);
@@ -186,32 +212,57 @@
public YwContractBill getDetail(Integer id) {
YwContractBill ywContractBill = ywContractBillMapper.selectJoinOne(YwContractBill.class,
new MPJLambdaWrapper<YwContractBill>().selectAll(YwContractBill.class)
- .select(" ( select ifnull(sum(yw.ACT_RECEIVABLE_FEE),0) from yw_contract_revenue yw where yw.bill_id = t.id and yw.status = 0 and yw.isdeleted = 0 ) as actReceivableFee ")
+ //.select(" ( select ifnull(sum(case when yw.REVENUE_TYPE = 0 then yw.ACT_RECEIVABLE_FEE else -yw.ACT_RECEIVABLE_FEE end),0) from yw_contract_revenue yw where yw.bill_id = t.id and yw.status = 0 and yw.isdeleted = 0 ) as actReceivableFee ")
+ .select(" ( select ifnull( sum( CASE WHEN t.bill_type = 0 and yw.REVENUE_TYPE = 0 THEN yw.ACT_RECEIVABLE_FEE when t.bill_type = 0 and yw.REVENUE_TYPE = 1 then -yw.ACT_RECEIVABLE_FEE when t.bill_type = 1 and yw.REVENUE_TYPE = 0 then -yw.ACT_RECEIVABLE_FEE else yw.ACT_RECEIVABLE_FEE END),0) from yw_contract_revenue yw where yw.bill_id = t.id and yw.status = 0 and yw.isdeleted = 0 ) as actReceivableFee ")
.selectAs(YwContract::getCode,YwContractBill::getContractCode)
.selectAs(YwCustomer::getName,YwContractBill::getCustomerName)
+ .selectAs(Company::getId,YwContractBill::getCompanyId)
.selectAs(Company::getName,YwContractBill::getCompanyName)
+ .selectAs(SystemUser::getRealname,YwContractBill::getRealname)
.leftJoin(YwContract.class,YwContract::getId,YwContractBill::getContractId)
.leftJoin(YwCustomer.class,YwCustomer::getId,YwContract::getRenterId)
.leftJoin(Company.class,Company::getId,YwContract::getCompanyId)
+ .leftJoin(SystemUser.class,SystemUser::getId,YwContractBill::getCreator)
.eq(YwContractBill::getIsdeleted,Constants.ZERO)
.eq(YwContractBill::getId,id));
if(Objects.isNull(ywContractBill)){
throw new BusinessException(ResponseStatus.DATA_EMPTY);
}
+ ywContractBill.setNeedReceivableFee(
+ ywContractBill.getReceivableFee().subtract(ywContractBill.getActReceivableFee())
+ );
//鎴挎簮鏁版嵁
- ywContractBill.setYwContractRoomList(ywContractRoomMapper.selectJoinList(YwContractRoom.class,new MPJLambdaWrapper<YwContractRoom>()
+ ywContractBill.setYwContractRoomList(
+ ywContractRoomMapper.selectJoinList(YwContractRoom.class,new MPJLambdaWrapper<YwContractRoom>()
.selectAll(YwContractRoom.class)
.selectAs(YwProject::getName,YwRoom::getProjectName)
.selectAs(YwFloor::getName,YwRoom::getFloorName)
.selectAs(YwBuilding::getName,YwRoom::getBuildingName)
+ .selectAs(YwRoom::getCode,YwContractRoom::getRoomName)
+ .selectAs(YwRoom::getArea,YwContractRoom::getArea)
.leftJoin(YwRoom.class,YwRoom::getId,YwContractRoom::getRoomId)
.leftJoin(YwFloor.class,YwFloor::getId,YwRoom::getFloor)
.leftJoin(YwProject.class,YwProject::getId,YwRoom::getProjectId)
.leftJoin(YwBuilding.class,YwBuilding::getId,YwRoom::getBuildingId)
- .eq(YwContractRoom::getContractId,id)
- .eq(YwContractRoom::getType,Constants.ONE)
+ .eq(Constants.equalsInteger(ywContractBill.getType(),Constants.ONE),YwContractRoom::getContractId,id)
+ .eq(Constants.equalsInteger(ywContractBill.getType(),Constants.ONE),YwContractRoom::getType,Constants.ONE)
+ .eq(Constants.equalsInteger(ywContractBill.getType(),Constants.ZERO) || Constants.equalsInteger(ywContractBill.getType(),Constants.TWO),YwContractRoom::getContractId,ywContractBill.getContractId())
+ .eq(Constants.equalsInteger(ywContractBill.getType(),Constants.ZERO)| Constants.equalsInteger(ywContractBill.getType(),Constants.TWO),YwContractRoom::getType,Constants.ZERO)
));
+
+ //鏀舵敮璁板綍
+ ywContractBill.setYwContractRevenueList(
+ ywContractRevenueMapper.selectJoinList(YwContractRevenue.class,new MPJLambdaWrapper<YwContractRevenue>()
+ .selectAll(YwContractRevenue.class)
+ .selectAs(YwCustomer::getName,YwContractRevenue::getCustomerName)
+ .leftJoin(YwContract.class,YwContract::getId,YwContractRevenue::getContractId)
+ .leftJoin(YwCustomer.class,YwCustomer::getId,YwContract::getRenterId)
+ .eq(YwContractRevenue::getStatus,Constants.ZERO)
+ .eq(YwContractRevenue::getBillId,ywContractBill.getId())
+ .orderByDesc(YwContractRevenue::getId)
+ )
+ );
//闄勪欢鏁版嵁
List<Multifile> multifileList = multifileMapper.selectJoinList(Multifile.class,new MPJLambdaWrapper<Multifile>()
@@ -254,7 +305,7 @@
YwContractBill model = pageWrap.getModel();
IPage<YwContractBill> iPage = ywContractBillMapper.selectJoinPage(page,YwContractBill.class,
queryWrapper.selectAll(YwContractBill.class)
- .select(" ( select ifnull(sum(yw.ACT_RECEIVABLE_FEE),0) from yw_contract_revenue yw where yw.bill_id = t.id and yw.status = 0 and yw.isdeleted = 0 ) as actReceivableFee ")
+ .select(" ( select ifnull( sum( CASE WHEN t.bill_type = 0 and yw.REVENUE_TYPE = 0 THEN yw.ACT_RECEIVABLE_FEE when t.bill_type = 0 and yw.REVENUE_TYPE = 1 then -yw.ACT_RECEIVABLE_FEE when t.bill_type = 1 and yw.REVENUE_TYPE = 0 then -yw.ACT_RECEIVABLE_FEE else yw.ACT_RECEIVABLE_FEE END),0) from yw_contract_revenue yw where yw.bill_id = t.id and yw.status = 0 and yw.isdeleted = 0 ) as actReceivableFee ")
.selectAs(YwContract::getCode,YwContractBill::getContractCode)
.selectAs(YwCustomer::getName,YwContractBill::getCustomerName)
.leftJoin(YwContract.class,YwContract::getId,YwContractBill::getContractId)
@@ -270,11 +321,18 @@
YwContractBill::getPayStatus,model.getPayStatus())
.eq(Objects.nonNull(model)&&Objects.nonNull(model.getType()),
YwContractBill::getType,model.getType())
+ .le(Objects.nonNull(model)&&Objects.nonNull(model.getIsOverdue())&&Constants.equalsInteger(model.getIsOverdue(),Constants.ONE),
+ YwContractBill::getPlanPayDate, DateUtil.getCurrDateTime())
+ .eq(Objects.nonNull(model)&&Objects.nonNull(model.getIsOverdue())&&Constants.equalsInteger(model.getIsOverdue(),Constants.ONE),
+ YwContractBill::getStatus, Constants.ZERO)
.eq(Objects.nonNull(model)&&Objects.nonNull(model.getContractId()),
YwContractBill::getContractId,model.getContractId())
+ .like(Objects.nonNull(model)&&StringUtils.isNotBlank(model.getContractCode()),
+ YwContract::getCode,model.getContractCode())
.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())) )
- ;
+ .le(Objects.nonNull(model)&&Objects.nonNull(model.getPlanPayDateEnd()),YwContractBill::getPlanPayDate, Utils.Date.getEnd(model.getPlanPayDateEnd()))
+ .orderByDesc(YwContractBill::getId));
+
this.dealRoomDetail(iPage.getRecords());
for (YwContractBill ywContractBill:iPage.getRecords()) {
//闇�鏀堕噾棰�
@@ -292,6 +350,78 @@
}else{
ywContractBill.setIsOverdue(Constants.ZERO);
}
+ //妤煎畤鍚嶇О
+ List<YwContractRoom> ywContractRoomList = ywContractBill.getYwContractRoomList();
+ if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(ywContractRoomList)){
+ StringBuilder roomPathName = new StringBuilder();
+ for (YwContractRoom ywContractRoom:ywContractRoomList) {
+ if(StringUtils.isNotBlank(ywContractRoom.getProjectName())){
+ roomPathName.append(ywContractRoom.getProjectName()+"/");
+ }
+ if(StringUtils.isNotBlank(ywContractRoom.getBuildingName())){
+ roomPathName.append(ywContractRoom.getBuildingName()+"/");
+ }
+ if(StringUtils.isNotBlank(ywContractRoom.getFloorName())){
+ roomPathName.append(ywContractRoom.getFloorName()+"/");
+ }
+ if(StringUtils.isNotBlank(ywContractRoom.getRoomName())){
+ roomPathName.append(ywContractRoom.getRoomName());
+ }
+ if(StringUtils.isNotBlank(roomPathName)){
+ roomPathName.append(";");
+ }
+ }
+ ywContractBill.setRoomPathName(roomPathName.toString());
+ }
+ }
+
+ return PageData.from(iPage);
+ }
+
+ /**
+ * 閫炬湡璐﹀崟
+ * @param pageWrap
+ * @return
+ */
+ @Override
+ public PageData<YwContractBill> findPageForOverdue(PageWrap<YwContractBill> pageWrap) {
+ IPage<YwContractBill> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity());
+ MPJLambdaWrapper<YwContractBill> queryWrapper = new MPJLambdaWrapper<>();
+ Utils.MP.blankToNull(pageWrap.getModel());
+ YwContractBill model = pageWrap.getModel();
+ IPage<YwContractBill> iPage = ywContractBillMapper.selectJoinPage(page,YwContractBill.class,
+ queryWrapper.selectAll(YwContractBill.class)
+ .select(" ( select ifnull( sum( CASE WHEN t.bill_type = 0 and yw.REVENUE_TYPE = 0 THEN yw.ACT_RECEIVABLE_FEE when t.bill_type = 0 and yw.REVENUE_TYPE = 1 then -yw.ACT_RECEIVABLE_FEE when t.bill_type = 1 and yw.REVENUE_TYPE = 0 then -yw.ACT_RECEIVABLE_FEE else yw.ACT_RECEIVABLE_FEE END),0) from yw_contract_revenue yw where yw.bill_id = t.id and yw.status = 0 and yw.isdeleted = 0 ) as actReceivableFee ")
+ .selectAs(YwContract::getCode,YwContractBill::getContractCode)
+ .selectAs(YwCustomer::getName,YwContractBill::getCustomerName)
+ .leftJoin(YwContract.class,YwContract::getId,YwContractBill::getContractId)
+ .leftJoin(YwCustomer.class,YwCustomer::getId,YwContract::getRenterId)
+ .eq(YwContractBill::getIsdeleted,Constants.ZERO)
+ .like(Objects.nonNull(model)&&StringUtils.isNotBlank(model.getCustomerName()),
+ YwCustomer::getName,model.getCustomerName())
+ .eq(Objects.nonNull(model)&&Objects.nonNull(model.getStatus()),
+ YwContractBill::getStatus,model.getStatus())
+ .eq(Objects.nonNull(model)&&Objects.nonNull(model.getBillType()),
+ YwContractBill::getBillType,model.getBillType())
+ .eq(Objects.nonNull(model)&&Objects.nonNull(model.getPayStatus()),
+ YwContractBill::getPayStatus,model.getPayStatus())
+ .in(Objects.nonNull(model)&&Objects.nonNull(model.getPayStatus()),
+ YwContractBill::getPayStatus,Constants.ZERO,Constants.THREE,Constants.TWO,Constants.FOUR)
+ .eq(Objects.nonNull(model)&&Objects.nonNull(model.getType()),
+ YwContractBill::getType,model.getType())
+ .le(Objects.nonNull(model)&&Objects.nonNull(model.getIsOverdue())&&Constants.equalsInteger(model.getIsOverdue(),Constants.ONE),
+ YwContractBill::getPlanPayDate, DateUtil.getCurrDateTime())
+ .eq(Objects.nonNull(model)&&Objects.nonNull(model.getIsOverdue())&&Constants.equalsInteger(model.getIsOverdue(),Constants.ONE),
+ YwContractBill::getStatus, Constants.ZERO)
+ .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()))
+ .orderByDesc(YwContractBill::getId));
+ this.dealRoomDetail(iPage.getRecords());
+ for (YwContractBill ywContractBill:iPage.getRecords()) {
+ //闇�鏀堕噾棰�
+ ywContractBill.setNeedReceivableFee(
+ ywContractBill.getReceivableFee().subtract(ywContractBill.getActReceivableFee())
+ );
//妤煎畤鍚嶇О
List<YwContractRoom> ywContractRoomList = ywContractBill.getYwContractRoomList();
if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(ywContractRoomList)){
@@ -361,9 +491,9 @@
if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(ywContractRoomList)){
for (YwContractBill ywContractBill:ywContractBillList) {
- if(Constants.equalsInteger(ywContractBill.getType(),Constants.ZERO)){
+ if(Constants.equalsInteger(ywContractBill.getType(),Constants.ZERO) || Constants.equalsInteger(ywContractBill.getType(),Constants.TWO)){
ywContractBill.setYwContractRoomList(
- ywContractRoomList.stream().filter(i->Constants.equalsInteger(i.getType(),Constants.ZERO)&&Constants.equalsInteger(i.getContractId(),ywContractBill.getContractId())).collect(Collectors.toList())
+ ywContractRoomList.stream().filter(i->(Constants.equalsInteger(i.getType(),Constants.TWO)||Constants.equalsInteger(i.getType(),Constants.ZERO))&&Constants.equalsInteger(i.getContractId(),ywContractBill.getContractId())).collect(Collectors.toList())
);
}else{
ywContractBill.setYwContractRoomList(
@@ -402,7 +532,7 @@
for (String codeDate:codeDateSet) {
//鑾峰彇褰撳墠鏃ユ湡鐨勬暟鎹�
List<YwContractBill> codeDateBillList =
- ywContractBillList.stream().filter(i->i.getCodeDate().equals(codeDate)).collect(Collectors.toList());
+ ywContractBillList.stream().filter(i->StringUtils.isNotBlank(i.getCodeDate()) && i.getCodeDate().equals(codeDate)).collect(Collectors.toList());
if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isEmpty(codeDateBillList)){
continue;
}
@@ -429,5 +559,536 @@
}
+ @Override
+ public List<YwContractBill> getCanBackBill(YwContractBill model) {
+ List<YwContractBill> list = ywContractBillMapper.selectJoinList(YwContractBill.class,
+ new MPJLambdaWrapper<YwContractBill>().selectAll(YwContractBill.class)
+// .select(" ( select ifnull(sum(case when yw.REVENUE_TYPE = 0 then yw.ACT_RECEIVABLE_FEE else -yw.ACT_RECEIVABLE_FEE end),0) from yw_contract_revenue yw where yw.bill_id = t.id and yw.status = 0 and yw.isdeleted = 0 ) as actReceivableFee ")
+ .select(" ( select ifnull( sum( CASE WHEN t.bill_type = 0 and yw.REVENUE_TYPE = 0 THEN yw.ACT_RECEIVABLE_FEE when t.bill_type = 0 and yw.REVENUE_TYPE = 1 then -yw.ACT_RECEIVABLE_FEE when t.bill_type = 1 and yw.REVENUE_TYPE = 0 then -yw.ACT_RECEIVABLE_FEE else yw.ACT_RECEIVABLE_FEE END),0) from yw_contract_revenue yw where yw.bill_id = t.id and yw.status = 0 and yw.isdeleted = 0 ) as actReceivableFee ")
+ .selectAs(YwContract::getCode,YwContractBill::getContractCode)
+ .selectAs(YwCustomer::getName,YwContractBill::getCustomerName)
+ .leftJoin(YwContract.class,YwContract::getId,YwContractBill::getContractId)
+ .leftJoin(YwCustomer.class,YwCustomer::getId,YwContract::getRenterId)
+ .eq(YwContractBill::getIsdeleted,Constants.ZERO)
+ .in(YwContractBill::getCostType,Constants.ZERO,Constants.ONE,Constants.FOUR,Constants.FIVE,7)
+ .eq(Objects.nonNull(model)&&Objects.nonNull(model.getContractId()),
+ YwContractBill::getContractId,model.getContractId())
+ .and(Objects.nonNull(model)&&Objects.nonNull(model.getPlanPayDateEnd()),
+ i->i.le(YwContractBill::getStartDate, Utils.Date.getEnd(model.getPlanPayDateEnd())).or()
+ .in(YwContractBill::getPayStatus,Constants.ONE,Constants.TWO) ))
+ ;
+
+ for (YwContractBill ywContractBill:list) {
+ ywContractBill.setNeedReceivableFee(ywContractBill.getReceivableFee().subtract(ywContractBill.getActReceivableFee()));
+ }
+ return list;
+ }
+
+
+ @Override
+ public YwContractBillDataVO getWaitDealList(Integer contractId){
+ YwContractBillDataVO ywContractBillDataVO = new YwContractBillDataVO();
+ ywContractBillDataVO.setInAmount(Constants.ZERO);
+ ywContractBillDataVO.setInFee(BigDecimal.ZERO);
+ ywContractBillDataVO.setPayAmount(Constants.ZERO);
+ ywContractBillDataVO.setPayFee(BigDecimal.ZERO);
+ MPJLambdaWrapper<YwContractBill> queryWrapper = new MPJLambdaWrapper<YwContractBill>();
+ queryWrapper.selectAll(YwContractBill.class)
+ .select(" ( select ifnull( sum( CASE WHEN t.bill_type = 0 and yw.REVENUE_TYPE = 0 THEN yw.ACT_RECEIVABLE_FEE when t.bill_type = 0 and yw.REVENUE_TYPE = 1 then -yw.ACT_RECEIVABLE_FEE when t.bill_type = 1 and yw.REVENUE_TYPE = 0 then -yw.ACT_RECEIVABLE_FEE else yw.ACT_RECEIVABLE_FEE END),0) from yw_contract_revenue yw where yw.bill_id = t.id and yw.status = 0 and yw.isdeleted = 0 ) as actReceivableFee ")
+ .selectAs(YwContract::getCode,YwContractBill::getContractCode)
+ .selectAs(YwCustomer::getName,YwContractBill::getCustomerName)
+ .leftJoin(YwContract.class,YwContract::getId,YwContractBill::getContractId)
+ .leftJoin(YwCustomer.class,YwCustomer::getId,YwContract::getRenterId)
+ .eq(YwContractBill::getIsdeleted,Constants.ZERO)
+ .in(YwContractBill::getPayStatus,Constants.ZERO,Constants.TWO,Constants.THREE,Constants.FOUR)
+ .eq(YwContractBill::getContractId,contractId)
+ .orderByDesc(YwContractBill::getId);
+ List<YwContractBill> list = ywContractBillMapper.selectJoinList(YwContractBill.class,queryWrapper);
+ if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(list)){
+ for (YwContractBill ywContractBill:list) {
+ //闇�鏀堕噾棰�
+ ywContractBill.setNeedReceivableFee(
+ ywContractBill.getReceivableFee().subtract(ywContractBill.getActReceivableFee())
+ );
+ //鏀舵璐﹀崟
+ if(Constants.equalsInteger(ywContractBill.getBillType(),Constants.ZERO)){
+ //搴旀敹閲戦 灏忎簬 瀹炴敹閲戦 澶氭敹閲戦 搴旇鏄��娆�
+ if(ywContractBill.getNeedReceivableFee().compareTo(BigDecimal.ZERO)<Constants.ZERO){
+ ywContractBillDataVO.setPayAmount(ywContractBillDataVO.getPayAmount()+1);
+ ywContractBillDataVO.setPayFee(ywContractBillDataVO.getPayFee().add(ywContractBill.getNeedReceivableFee().abs()));
+ }else if(ywContractBill.getNeedReceivableFee().compareTo(BigDecimal.ZERO)>Constants.ZERO){
+ ywContractBillDataVO.setInAmount(ywContractBillDataVO.getInAmount()+1);
+ ywContractBillDataVO.setInFee(ywContractBillDataVO.getInFee().add(ywContractBill.getNeedReceivableFee().abs()));
+ }
+ }else{
+ //浠樻璐﹀崟
+ //搴斾粯閲戦 灏忎簬 瀹炰粯閲戦 搴旇鏄粯娆炬
+ if(ywContractBill.getNeedReceivableFee().compareTo(BigDecimal.ZERO)<Constants.ZERO){
+ ywContractBillDataVO.setPayAmount(ywContractBillDataVO.getPayAmount()+1);
+ ywContractBillDataVO.setPayFee(ywContractBillDataVO.getPayFee().add(ywContractBill.getNeedReceivableFee().abs()));
+ }else{
+ ywContractBillDataVO.setInAmount(ywContractBillDataVO.getInAmount()+1);
+ ywContractBillDataVO.setInFee(ywContractBillDataVO.getInFee().add(ywContractBill.getNeedReceivableFee().abs()));
+ }
+ }
+ }
+ ywContractBillDataVO.setYwContractBillList(list);
+ }
+
+ return ywContractBillDataVO;
+ }
+
+
+
+
+ @Override
+ public List<YwContractBillCallDataVO> getNoticeCustomerData(List<Integer> billIds){
+ List<YwContractBillCallDataVO> ywContractBillCallDataVOList = new ArrayList<>();
+ List<YwContractBill> ywContractBillList = ywContractBillMapper.selectJoinList(YwContractBill.class,new MPJLambdaWrapper<YwContractBill>()
+ .selectAll(YwContractBill.class)
+ .selectAs(YwCustomer::getName,YwContractBill::getCustomerName)
+ .selectAs(YwCustomer::getUserId,YwContractBill::getCustomerUserId)
+ .selectAs(YwCustomer::getId,YwContractBill::getCustomerId)
+ .leftJoin(YwContract.class,YwContract::getId,YwContractBill::getContractId)
+ .leftJoin(YwCustomer.class,YwCustomer::getId,YwContract::getRenterId)
+ .in(YwContractBill::getId,billIds)
+ );
+ if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isEmpty(ywContractBillList) ||
+ !Constants.equalsInteger(billIds.size(),ywContractBillList.size())
+ ){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"璐﹀崟鏁版嵁閿欒锛岃鍒锋柊閲嶈瘯");
+ }
+ this.dealRoomDetail(ywContractBillList);
+ for (YwContractBill ywContractBill:ywContractBillList) {
+ YwContractBillCallDataVO ywContractBillCallDataVO = new YwContractBillCallDataVO();
+ ywContractBillCallDataVO.setBillId(ywContractBill.getId());
+ ywContractBillCallDataVO.setCustomerName(ywContractBill.getCustomerName());
+ ywContractBillCallDataVO.setUserId(ywContractBill.getCustomerUserId());
+ //鏌ヨ瀹㈡埛涓嬬殑鎵�鏈変汉鍛�
+ ywContractBillCallDataVO.setMemberList(
+ memberMapper.selectList(new QueryWrapper<Member>().lambda().eq(Member::getCustomerId,ywContractBill.getCustomerId())
+ .eq(Member::getIsdeleted,Constants.ZERO))
+ );
+ ywContractBillCallDataVOList.add(ywContractBillCallDataVO);
+ }
+ return ywContractBillCallDataVOList;
+ }
+
+
+ @Override
+ public void downloadCallFeeDoc(List<Integer> billIds, LoginUserInfo loginUserInfo,HttpServletResponse response){
+ try {
+ List<YwContractBill> ywContractBillList = ywContractBillMapper.selectJoinList(YwContractBill.class,new MPJLambdaWrapper<YwContractBill>()
+ .selectAll(YwContractBill.class)
+ .selectAs(YwCustomer::getName,YwContractBill::getCustomerName)
+ .selectAs(YwCustomer::getUserId,YwContractBill::getCustomerUserId)
+ .selectAs(YwCustomer::getId,YwContractBill::getCustomerId)
+ .selectAs(YwContractDetail::getPrice,YwContractBill::getPrice)
+ .selectAs(YwContract::getCompanyId,YwContractBill::getCompanyId)
+ .selectAs(YwContractDetail::getCircleType,YwContractBill::getCircleType)
+ .selectAs(YwContractDetail::getType,YwContractBill::getDetailType)
+ .selectAs(YwContract::getZlPayType,YwContractBill::getZlPayType)
+ .selectAs(YwContract::getWyPayType,YwContractBill::getWyPayType)
+ .select(" ( select ifnull(sum(y.rent_area),0) from yw_room y left join yw_contract_room yr on y.id = yr.room_id where yr.contract_id = t.contract_id and y.IS_INVESTMENT = 0 and yr.type = 0 ) " , YwContractBill::getTotalArea)
+ .leftJoin(YwContract.class,YwContract::getId,YwContractBill::getContractId)
+ .leftJoin(YwCustomer.class,YwCustomer::getId,YwContract::getRenterId)
+ .leftJoin(YwContractDetail.class,YwContractDetail::getId,YwContractBill::getDetailId)
+ .in(YwContractBill::getId,billIds)
+ );
+ this.dealRoomDetail(ywContractBillList);
+ List<YwTempConfig> ywTempConfigList = ywTempConfigMapper.selectList(new QueryWrapper<YwTempConfig>().lambda().eq(YwTempConfig::getIsdeleted,Constants.ZERO));
+ if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isEmpty(ywTempConfigList)){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鏈煡璇㈠埌妯℃澘閰嶇疆椤�,璇疯仈绯荤鐞嗗憳");
+ }
+ List<YwTempConfig> tempList = ywTempConfigList.stream().filter(i->Constants.equalsInteger(i.getType(),Constants.FOUR)||
+ Constants.equalsInteger(i.getType(),Constants.FIVE)||
+ Constants.equalsInteger(i.getType(),Constants.SIX)).collect(Collectors.toList());
+ if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isEmpty(tempList)){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鏈煡璇㈠埌妯℃澘閰嶇疆椤�,璇疯仈绯荤鐞嗗憳");
+ }
+ List<File> fileList = new ArrayList<>();
+ for (YwContractBill ywContractBill:ywContractBillList) {
+ List<YwTempConfig> dealList = this.dealTempData(tempList,ywContractBill,loginUserInfo);
+ String fileName = "鍌垂閫氱煡鍗昣" +ywContractBill.getCode() +"_" + System.currentTimeMillis()+".docx";
+ YwTempConfig ywTempConfig = new YwTempConfig();
+ if(Constants.equalsInteger(ywContractBill.getType(),Constants.ZERO)){
+ Optional<YwTempConfig> optional = ywTempConfigList.stream().filter(i->Constants.equalsInteger(i.getType(),Constants.TWO)).findAny();
+ if (optional.isPresent()) {
+ ywTempConfig = optional.get();
+ }
+ }else{
+ Optional<YwTempConfig> optional = ywTempConfigList.stream().filter(i->Constants.equalsInteger(i.getType(),Constants.THREE)).findAny();
+ if (optional.isPresent()) {
+ ywTempConfig = optional.get();
+ }
+ }
+ if(Objects.isNull(ywTempConfig)){
+ throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"妯℃澘淇℃伅寮傚父,璇疯仈绯荤鐞嗗憳");
+ }
+ String path = ExcelReplaceCommon.modifyWordTemplate(ywTempConfig.getUrl(),dealList,fileName,zipFilePath);
+ File f = new File(path);
+ if(f !=null && f.isFile()){
+ fileList.add(f);
+ }
+ if(fileList == null || fileList.size() == 0){
+ throw new BusinessException(ResponseStatus.DATA_EMPTY);
+ }
+ }
+ String fileName = "鍌垂閫氱煡鍗�-" +System.currentTimeMillis();
+ String encodeFileName = URLEncoder.encode(fileName, Charset.forName("UTF-8").toString())+".zip";
+ response.setHeader("Content-Disposition","attachment;filename=" + encodeFileName);
+ response.setContentType("application/octet-stream");
+ response.setHeader("eva-opera-type", "download");
+ response.setHeader("eva-download-filename", encodeFileName);
+ Constants.packFilesToZip(fileList,response.getOutputStream());
+ } catch (Exception e) {
+ throw new BusinessException(ResponseStatus.EXPORT_EXCEL_ERROR, e);
+ }
+ }
+
+
+ public List<YwTempConfig> dealTempData(List<YwTempConfig> ywTempConfigList , YwContractBill ywContractBill, LoginUserInfo loginUserInfo){
+ //鏌ヨ鏀舵敮璐﹀彿鏁版嵁
+ YwAccount ywAccount = ywAccountMapper.selectOne(new QueryWrapper<YwAccount>().lambda().eq(YwAccount::getIsdeleted,Constants.ZERO).eq(YwAccount::getStatus,Constants.ZERO).eq(YwAccount::getCompanyId,ywContractBill.getCompanyId())
+ .orderByDesc(YwAccount::getId)
+ .last(" limit 1 "));
+
+ List<YwTempConfig> dealList = new ArrayList<>();
+ for (YwTempConfig y:ywTempConfigList) {
+ if(y.getTitle().equals("${璐圭敤鍚嶇О}")&&Objects.nonNull(ywContractBill.getCostType())){
+ //璐圭敤绫诲瀷锛�0=绉熻祦璐癸紱1=鐗╀笟璐癸紱2=绉熻祦鎶奸噾锛�3=鐗╀笟鎶奸噾锛�4=姘寸數璐癸紱5=鏉傞」璐癸紱6=鍏朵粬; 7=淇濊瘉閲�
+ if(Constants.equalsInteger(ywContractBill.getCostType(),Constants.ZERO)){
+ y.setUrl("绉熻祦璐�");
+ }else if(Constants.equalsInteger(ywContractBill.getCostType(),Constants.ONE)){
+ y.setUrl("鐗╀笟璐�");
+ }else if(Constants.equalsInteger(ywContractBill.getCostType(),Constants.TWO)){
+ y.setUrl("绉熻祦鎶奸噾");
+ }else if(Constants.equalsInteger(ywContractBill.getCostType(),Constants.THREE)){
+ y.setUrl("鐗╀笟鎶奸噾");
+ }else if(Constants.equalsInteger(ywContractBill.getCostType(),Constants.FOUR)){
+ y.setUrl("姘寸數璐�");
+ }else if(Constants.equalsInteger(ywContractBill.getCostType(),Constants.FIVE)){
+ y.setUrl("鏉傞」璐�");
+ }else if(Constants.equalsInteger(ywContractBill.getCostType(),Constants.SIX)){
+ y.setUrl("鍏朵粬");
+ }else if(Constants.equalsInteger(ywContractBill.getCostType(),Constants.SEVEN)){
+ y.setUrl("淇濊瘉閲�");
+ }
+ }else if(y.getTitle().equals("${璁¤垂鍛ㄦ湡}")&&Objects.nonNull(ywContractBill.getDetailType())){
+ if(Constants.equalsInteger(ywContractBill.getDetailType(),Constants.ZERO)){
+ //绉熻祦鏀粯鏂瑰紡 0=涓�娆℃�т粯娆撅紱1=姣忎笁涓湀涓�浠橈紱2=鍏釜鏈堜竴浠橈紱3=涓�骞翠竴浠�
+ if(Objects.nonNull(ywContractBill.getZlPayType())){
+ if(Constants.equalsInteger(ywContractBill.getZlPayType(),Constants.ZERO)){
+ y.setUrl("涓�娆℃�т粯娆�");
+ }else if(Constants.equalsInteger(ywContractBill.getZlPayType(),Constants.ONE)){
+ y.setUrl("姣忎笁涓湀涓�浠�");
+ }else if(Constants.equalsInteger(ywContractBill.getZlPayType(),Constants.TWO)){
+ y.setUrl("鍏釜鏈堜竴浠�");
+ }else if(Constants.equalsInteger(ywContractBill.getZlPayType(),Constants.THREE)){
+ y.setUrl("涓�骞翠竴浠�");
+ }
+ }
+ }else{
+ //鐗╀笟鏀粯鏂瑰紡 0=涓�娆℃�т粯娆撅紱1=姣忎笁涓湀涓�浠橈紱2=鍏釜鏈堜竴浠橈紱3=涓�骞翠竴浠�
+ if(Objects.nonNull(ywContractBill.getWyPayType())){
+ if(Constants.equalsInteger(ywContractBill.getWyPayType(),Constants.ZERO)){
+ y.setUrl("涓�娆℃�т粯娆�");
+ }else if(Constants.equalsInteger(ywContractBill.getWyPayType(),Constants.ONE)){
+ y.setUrl("姣忎笁涓湀涓�浠�");
+ }else if(Constants.equalsInteger(ywContractBill.getWyPayType(),Constants.TWO)){
+ y.setUrl("鍏釜鏈堜竴浠�");
+ }else if(Constants.equalsInteger(ywContractBill.getWyPayType(),Constants.THREE)){
+ y.setUrl("涓�骞翠竴浠�");
+ }
+ }
+ }
+ }else if(y.getTitle().equals("${鍗曚环}")&&Objects.nonNull(ywContractBill.getPrice())){
+ y.setUrl(ywContractBill.getPrice().toString());
+ }else if(y.getTitle().equals("${鍗曚綅}")&&Objects.nonNull(ywContractBill.getCircleType())){
+ //浠樻鍛ㄦ湡绫诲瀷 0=鍏冩瘡骞崇背澶�;1=鍏冩瘡骞崇背鏈�;2=鍏冩瘡骞崇背骞�;3=鍏冩瘡澶�;4=鍏冩瘡鏈�;5=鍏冩瘡骞�;6=鍏冩瘡鍦�;
+ if(Constants.equalsInteger(ywContractBill.getCircleType(),Constants.ZERO)){
+ y.setUrl("鍏冩瘡骞崇背澶�");
+ }else if(Constants.equalsInteger(ywContractBill.getCircleType(),Constants.ONE)){
+ y.setUrl("鍏冩瘡骞崇背鏈�");
+ }else if(Constants.equalsInteger(ywContractBill.getCircleType(),Constants.TWO)){
+ y.setUrl("鍏冩瘡骞崇背骞�");
+ } else if(Constants.equalsInteger(ywContractBill.getCircleType(),Constants.THREE)){
+ y.setUrl("鍏冩瘡澶�");
+ } else if(Constants.equalsInteger(ywContractBill.getCircleType(),Constants.FOUR)){
+ y.setUrl("鍏冩瘡鏈�");
+ } else if(Constants.equalsInteger(ywContractBill.getCircleType(),Constants.FIVE)){
+ y.setUrl("鍏冩瘡骞�");
+ } else if(Constants.equalsInteger(ywContractBill.getCircleType(),Constants.SIX)){
+ y.setUrl("鍏冩瘡鍦�");
+ }
+ }else if(y.getTitle().equals("${搴旀敹鏃ユ湡}")&&Objects.nonNull(ywContractBill.getPlanPayDate())){
+ y.setUrl(DateUtil.formatDate(ywContractBill.getPlanPayDate(),"yyyy-MM-dd"));
+ }else if(y.getTitle().equals("${搴旀敹閲戦}")&&Objects.nonNull(ywContractBill.getReceivableFee())){
+ y.setUrl(ywContractBill.getReceivableFee().toString());
+ }else if(y.getTitle().equals("${璐﹀崟澶囨敞}")){
+ if(StringUtils.isNotBlank(ywContractBill.getRemark())){
+ y.setUrl(ywContractBill.getRemark());
+ }else{
+ y.setUrl("");
+ }
+ }else if(y.getTitle().equals("${绉熷鍚嶇О}")&&StringUtils.isNotBlank(ywContractBill.getCustomerName())){
+ y.setUrl(ywContractBill.getCustomerName());
+ }else if(y.getTitle().equals("${鎴块棿淇℃伅}")){
+ if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(ywContractBill.getYwContractRoomList())){
+ StringBuilder roomPathName = new StringBuilder();
+ for (YwContractRoom ywContractRoom:ywContractBill.getYwContractRoomList()) {
+ if(StringUtils.isNotBlank(ywContractRoom.getProjectName())){
+ roomPathName.append(ywContractRoom.getProjectName()+"/");
+ }
+ if(StringUtils.isNotBlank(ywContractRoom.getBuildingName())){
+ roomPathName.append(ywContractRoom.getBuildingName()+"/");
+ }
+ if(StringUtils.isNotBlank(ywContractRoom.getFloorName())){
+ roomPathName.append(ywContractRoom.getFloorName()+"/");
+ }
+ if(StringUtils.isNotBlank(ywContractRoom.getRoomName())){
+ roomPathName.append(ywContractRoom.getRoomName());
+ }
+ if(StringUtils.isNotBlank(roomPathName)){
+ roomPathName.append(";");
+ }
+ }
+ y.setUrl(roomPathName.toString());
+ }
+ }else if(y.getTitle().equals("${绉熻祦闈㈢Н}")&&Objects.nonNull(ywContractBill.getTotalArea())){
+ y.setUrl(ywContractBill.getTotalArea().toString());
+ }else if(y.getTitle().equals("${鎵�灞炲叕鍙歌处鎴峰悕绉皚")){
+ if(Objects.nonNull(ywAccount)&&StringUtils.isNotBlank(ywAccount.getName())){
+ y.setUrl(ywAccount.getName());
+ }else{
+ y.setUrl("-");
+ }
+ }else if(y.getTitle().equals("${鎵�灞炲叕鍙搁摱琛岃处鍙穧")){
+ y.setUrl("鎵�灞炲叕鍙搁摱琛岃处鍙�");
+ if(Objects.nonNull(ywAccount)&&StringUtils.isNotBlank(ywAccount.getName())){
+ y.setUrl(ywAccount.getName());
+ }else{
+ y.setUrl("-");
+ }
+ }else if(y.getTitle().equals("${鎵�灞炲叕鍙稿紑鎴烽摱琛寎")){
+ if(Objects.nonNull(ywAccount)&&StringUtils.isNotBlank(ywAccount.getBankNo())){
+ y.setUrl(ywAccount.getBankNo());
+ }else{
+ y.setUrl("-");
+ }
+ }else if(y.getTitle().equals("${閫氱煡鍗曠敓鎴愭棩鏈焳")){
+ y.setUrl(DateUtil.formatDate(new Date(),"yyyy-MM-dd"));
+ }else if(y.getTitle().equals("${鍒惰〃浜哄悕绉皚")){
+ y.setUrl(loginUserInfo.getRealname());
+ }
+ dealList.add(y);
+ }
+ return dealList;
+ }
+
+
+ @Override
+ public void sendSmsEmail(List<YwSmsEmailBillCallDTO> ywSmsEmailBillCallDTOList,SmsEmailServiceImpl smsEmailService,LoginUserInfo loginUserInfo){
+ if(CollectionUtils.isEmpty(ywSmsEmailBillCallDTOList)){
+ throw new BusinessException(ResponseStatus.BAD_REQUEST);
+ }
+ List<YwTempConfig> ywTempConfigList = ywTempConfigMapper.selectList(new QueryWrapper<YwTempConfig>().lambda().eq(YwTempConfig::getIsdeleted,Constants.ZERO));
+ if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isEmpty(ywTempConfigList)){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鏈煡璇㈠埌妯℃澘閰嶇疆椤�,璇疯仈绯荤鐞嗗憳");
+ }
+ List<YwTempConfig> tempList = ywTempConfigList.stream().filter(i->Constants.equalsInteger(i.getType(),Constants.FOUR)||
+ Constants.equalsInteger(i.getType(),Constants.FIVE)||
+ Constants.equalsInteger(i.getType(),Constants.SIX)).collect(Collectors.toList());
+ if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isEmpty(tempList)){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鏈煡璇㈠埌妯℃澘閰嶇疆椤�,璇疯仈绯荤鐞嗗憳");
+ }
+ Optional<YwTempConfig> smsTempConfigOptional = ywTempConfigList.stream().filter(i->Constants.equalsInteger(i.getType(),Constants.ZERO)).findAny();
+ Optional<YwTempConfig> emailTempConfigOptional = ywTempConfigList.stream().filter(i->Constants.equalsInteger(i.getType(),Constants.ONE)).findAny();
+ for (YwSmsEmailBillCallDTO ywSmsEmailBillCallDTO:ywSmsEmailBillCallDTOList) {
+ if(Objects.isNull(ywSmsEmailBillCallDTO)
+ || Objects.isNull(ywSmsEmailBillCallDTO.getBillId())
+ || Objects.isNull(ywSmsEmailBillCallDTO.getUserId())
+ ||Objects.isNull(ywSmsEmailBillCallDTO.getSendEmail())
+ || Objects.isNull(ywSmsEmailBillCallDTO.getSendSms())
+ ){
+ throw new BusinessException(ResponseStatus.BAD_REQUEST);
+ }
+
+ YwContractBill ywContractBill = ywContractBillMapper.selectJoinOne(YwContractBill.class,new MPJLambdaWrapper<YwContractBill>()
+ .selectAll(YwContractBill.class)
+ .selectAs(YwCustomer::getName,YwContractBill::getCustomerName)
+ .selectAs(YwCustomer::getUserId,YwContractBill::getCustomerUserId)
+ .selectAs(YwCustomer::getId,YwContractBill::getCustomerId)
+ .selectAs(YwContractDetail::getPrice,YwContractBill::getPrice)
+ .selectAs(YwContract::getCompanyId,YwContractBill::getCompanyId)
+ .selectAs(YwContractDetail::getCircleType,YwContractBill::getCircleType)
+ .selectAs(YwContractDetail::getType,YwContractBill::getDetailType)
+ .selectAs(YwContract::getZlPayType,YwContractBill::getZlPayType)
+ .selectAs(YwContract::getWyPayType,YwContractBill::getWyPayType)
+ .select(" ( select ifnull(sum(r.rent_area),0) from yw_room y left join yw_contract_room yr on y.id = yr.room_id where yr.contract_id = t.contract_id and y.IS_INVESTMENT = 0 and yr.type = 0 ) " , YwContractBill::getTotalArea)
+ .leftJoin(YwContract.class,YwContract::getId,YwContractBill::getContractId)
+ .leftJoin(YwCustomer.class,YwCustomer::getId,YwContract::getRenterId)
+ .leftJoin(YwContractDetail.class,YwContractDetail::getId,YwContractBill::getDetailId)
+ .eq(YwContractBill::getId,ywSmsEmailBillCallDTO.getBillId())
+ .last( "limit 1" )
+ );
+ this.dealTempData(tempList,ywContractBill,loginUserInfo);
+ Member member = memberMapper.selectById(ywSmsEmailBillCallDTO.getUserId());
+ if(Objects.isNull(member)){
+ throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"瀛樺湪鏈煡璇㈠埌鐨勪汉鍛樹俊鎭�");
+ }
+ if(Objects.nonNull(member)){
+ if(Constants.equalsInteger(ywSmsEmailBillCallDTO.getSendSms(),Constants.ONE) && StringUtils.isNotBlank(member.getPhone())
+ && smsTempConfigOptional.isPresent()){
+ String content = this.dealTempSmsEmailData(smsTempConfigOptional.get().getTitle(),tempList,ywContractBill,loginUserInfo);
+ smsEmailService.sendBillSms(content,member.getPhone(),ywContractBill.getId());
+ }
+ if(Constants.equalsInteger(ywSmsEmailBillCallDTO.getSendEmail(),Constants.ONE) && StringUtils.isNotBlank(member.getEmail())
+ && emailTempConfigOptional.isPresent()){
+ String content = this.dealTempSmsEmailData(emailTempConfigOptional.get().getTitle(),tempList,ywContractBill,loginUserInfo);
+ smsEmailService.sendEmail(content,member.getEmail(),ywContractBill.getId());
+ }
+ }
+ }
+
+ }
+
+
+ public String dealTempSmsEmailData(String tempStr,List<YwTempConfig> ywTempConfigList , YwContractBill ywContractBill, LoginUserInfo loginUserInfo){
+ //鏌ヨ鏀舵敮璐﹀彿鏁版嵁
+ YwAccount ywAccount = ywAccountMapper.selectOne(new QueryWrapper<YwAccount>().lambda().eq(YwAccount::getIsdeleted,Constants.ZERO).eq(YwAccount::getStatus,Constants.ZERO).eq(YwAccount::getCompanyId,ywContractBill.getCompanyId())
+ .orderByDesc(YwAccount::getId)
+ .last(" limit 1 "));
+ for (YwTempConfig y:ywTempConfigList) {
+ if(y.getTitle().equals("${璐圭敤鍚嶇О}")&&Objects.nonNull(ywContractBill.getCostType())){
+ //璐圭敤绫诲瀷锛�0=绉熻祦璐癸紱1=鐗╀笟璐癸紱2=绉熻祦鎶奸噾锛�3=鐗╀笟鎶奸噾锛�4=姘寸數璐癸紱5=鏉傞」璐癸紱6=鍏朵粬; 7=淇濊瘉閲�
+ if(Constants.equalsInteger(ywContractBill.getCostType(),Constants.ZERO)){
+ tempStr.replace("${璐圭敤鍚嶇О}","绉熻祦璐�");
+ }else if(Constants.equalsInteger(ywContractBill.getCostType(),Constants.ONE)){
+ tempStr.replace("${璐圭敤鍚嶇О}","鐗╀笟璐�");
+ }else if(Constants.equalsInteger(ywContractBill.getCostType(),Constants.TWO)){
+ tempStr.replace("${璐圭敤鍚嶇О}","绉熻祦鎶奸噾");
+ }else if(Constants.equalsInteger(ywContractBill.getCostType(),Constants.THREE)){
+ tempStr.replace("${璐圭敤鍚嶇О}","鐗╀笟鎶奸噾");
+ }else if(Constants.equalsInteger(ywContractBill.getCostType(),Constants.FOUR)){
+ tempStr.replace("${璐圭敤鍚嶇О}","姘寸數璐�");
+ }else if(Constants.equalsInteger(ywContractBill.getCostType(),Constants.FIVE)){
+ tempStr.replace("${璐圭敤鍚嶇О}","鏉傞」璐�");
+ }else if(Constants.equalsInteger(ywContractBill.getCostType(),Constants.SIX)){
+ tempStr.replace("${璐圭敤鍚嶇О}","鍏朵粬");
+ }else if(Constants.equalsInteger(ywContractBill.getCostType(),Constants.SEVEN)){
+ tempStr.replace("${璐圭敤鍚嶇О}","淇濊瘉閲�");
+ }
+ }else if(y.getTitle().equals("${璁¤垂鍛ㄦ湡}")&&Objects.nonNull(ywContractBill.getDetailType())){
+ if(Constants.equalsInteger(ywContractBill.getDetailType(),Constants.ZERO)){
+ //绉熻祦鏀粯鏂瑰紡 0=涓�娆℃�т粯娆撅紱1=姣忎笁涓湀涓�浠橈紱2=鍏釜鏈堜竴浠橈紱3=涓�骞翠竴浠�
+ if(Objects.nonNull(ywContractBill.getZlPayType())){
+ if(Constants.equalsInteger(ywContractBill.getZlPayType(),Constants.ZERO)){
+ tempStr.replace("${璁¤垂鍛ㄦ湡}","涓�娆℃�т粯娆�");
+ }else if(Constants.equalsInteger(ywContractBill.getZlPayType(),Constants.ONE)){
+ tempStr.replace("${璁¤垂鍛ㄦ湡}","姣忎笁涓湀涓�浠�");
+ }else if(Constants.equalsInteger(ywContractBill.getZlPayType(),Constants.TWO)){
+ tempStr.replace("${璁¤垂鍛ㄦ湡}","鍏釜鏈堜竴浠�");
+ }else if(Constants.equalsInteger(ywContractBill.getZlPayType(),Constants.THREE)){
+ tempStr.replace("${璁¤垂鍛ㄦ湡}","涓�骞翠竴浠�");
+ }
+ }
+ }else{
+ //鐗╀笟鏀粯鏂瑰紡 0=涓�娆℃�т粯娆撅紱1=姣忎笁涓湀涓�浠橈紱2=鍏釜鏈堜竴浠橈紱3=涓�骞翠竴浠�
+ if(Objects.nonNull(ywContractBill.getWyPayType())){
+ if(Constants.equalsInteger(ywContractBill.getWyPayType(),Constants.ZERO)){
+ tempStr.replace("${璁¤垂鍛ㄦ湡}","涓�娆℃�т粯娆�");
+ }else if(Constants.equalsInteger(ywContractBill.getWyPayType(),Constants.ONE)){
+ tempStr.replace("${璁¤垂鍛ㄦ湡}","姣忎笁涓湀涓�浠�");
+ }else if(Constants.equalsInteger(ywContractBill.getWyPayType(),Constants.TWO)){
+ tempStr.replace("${璁¤垂鍛ㄦ湡}","鍏釜鏈堜竴浠�");
+ }else if(Constants.equalsInteger(ywContractBill.getWyPayType(),Constants.THREE)){
+ tempStr.replace("${璁¤垂鍛ㄦ湡}","涓�骞翠竴浠�");
+ }
+ }
+ }
+ }else if(y.getTitle().equals("${鍗曚环}")&&Objects.nonNull(ywContractBill.getPrice())){
+ tempStr.replace("${鍗曚环}",ywContractBill.getPrice().toString());
+ }else if(y.getTitle().equals("${鍗曚綅}")&&Objects.nonNull(ywContractBill.getCircleType())){
+ //浠樻鍛ㄦ湡绫诲瀷 0=鍏冩瘡骞崇背澶�;1=鍏冩瘡骞崇背鏈�;2=鍏冩瘡骞崇背骞�;3=鍏冩瘡澶�;4=鍏冩瘡鏈�;5=鍏冩瘡骞�;6=鍏冩瘡鍦�;
+ if(Constants.equalsInteger(ywContractBill.getCircleType(),Constants.ZERO)){
+ tempStr.replace("${鍗曚綅}","鍏冩瘡骞崇背澶�");
+ }else if(Constants.equalsInteger(ywContractBill.getCircleType(),Constants.ONE)){
+ tempStr.replace("${鍗曚綅}","鍏冩瘡骞崇背鏈�");
+ }else if(Constants.equalsInteger(ywContractBill.getCircleType(),Constants.TWO)){
+ tempStr.replace("${鍗曚綅}","鍏冩瘡骞崇背骞�");
+ } else if(Constants.equalsInteger(ywContractBill.getCircleType(),Constants.THREE)){
+ tempStr.replace("${鍗曚綅}","鍏冩瘡澶�");
+ } else if(Constants.equalsInteger(ywContractBill.getCircleType(),Constants.FOUR)){
+ tempStr.replace("${鍗曚綅}","鍏冩瘡鏈�");
+ } else if(Constants.equalsInteger(ywContractBill.getCircleType(),Constants.FIVE)){
+ tempStr.replace("${鍗曚綅}","鍏冩瘡骞�");
+ } else if(Constants.equalsInteger(ywContractBill.getCircleType(),Constants.SIX)){
+ tempStr.replace("${鍗曚綅}","鍏冩瘡鍦�");
+ }
+ }else if(y.getTitle().equals("${搴旀敹鏃ユ湡}")&&Objects.nonNull(ywContractBill.getPlanPayDate())){
+ tempStr.replace("${搴旀敹鏃ユ湡}",DateUtil.formatDate(ywContractBill.getPlanPayDate(),"yyyy-MM-dd"));
+ }else if(y.getTitle().equals("${搴旀敹閲戦}")&&Objects.nonNull(ywContractBill.getReceivableFee())){
+ tempStr.replace("${搴旀敹閲戦}",ywContractBill.getReceivableFee().toString());
+ }else if(y.getTitle().equals("${璐﹀崟澶囨敞}")){
+ if(StringUtils.isNotBlank(ywContractBill.getRemark())){
+ tempStr.replace("${璐﹀崟澶囨敞}",ywContractBill.getRemark());
+ }else{
+ tempStr.replace("${璐﹀崟澶囨敞}","");
+ }
+ }else if(y.getTitle().equals("${绉熷鍚嶇О}")&&StringUtils.isNotBlank(ywContractBill.getCustomerName())){
+ tempStr.replace("${绉熷鍚嶇О}",ywContractBill.getCustomerName());
+ }else if(y.getTitle().equals("${鎴块棿淇℃伅}")){
+ if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(ywContractBill.getYwContractRoomList())){
+ StringBuilder roomPathName = new StringBuilder();
+ for (YwContractRoom ywContractRoom:ywContractBill.getYwContractRoomList()) {
+ if(StringUtils.isNotBlank(ywContractRoom.getProjectName())){
+ roomPathName.append(ywContractRoom.getProjectName()+"/");
+ }
+ if(StringUtils.isNotBlank(ywContractRoom.getBuildingName())){
+ roomPathName.append(ywContractRoom.getBuildingName()+"/");
+ }
+ if(StringUtils.isNotBlank(ywContractRoom.getFloorName())){
+ roomPathName.append(ywContractRoom.getFloorName()+"/");
+ }
+ if(StringUtils.isNotBlank(ywContractRoom.getRoomName())){
+ roomPathName.append(ywContractRoom.getRoomName());
+ }
+ if(StringUtils.isNotBlank(roomPathName)){
+ roomPathName.append(";");
+ }
+ }
+ tempStr.replace("${鎴块棿淇℃伅}",roomPathName.toString());
+ }
+ }else if(y.getTitle().equals("${绉熻祦闈㈢Н}")&&Objects.nonNull(ywContractBill.getTotalArea())){
+ tempStr.replace("${绉熻祦闈㈢Н}",ywContractBill.getTotalArea().toString());
+ }else if(y.getTitle().equals("${鎵�灞炲叕鍙歌处鎴峰悕绉皚")){
+ if(Objects.nonNull(ywAccount)&&StringUtils.isNotBlank(ywAccount.getName())){
+ tempStr.replace("${鎵�灞炲叕鍙歌处鎴峰悕绉皚",ywAccount.getName());
+ }else{
+ tempStr.replace("${鎵�灞炲叕鍙歌处鎴峰悕绉皚","-");
+ }
+ }else if(y.getTitle().equals("${鎵�灞炲叕鍙搁摱琛岃处鍙穧")){
+ if(Objects.nonNull(ywAccount)&&StringUtils.isNotBlank(ywAccount.getName())){
+ tempStr.replace("${鎵�灞炲叕鍙搁摱琛岃处鍙穧",ywAccount.getName());
+ }else{
+ tempStr.replace("${鎵�灞炲叕鍙搁摱琛岃处鍙穧","-");
+ }
+ }else if(y.getTitle().equals("${鎵�灞炲叕鍙稿紑鎴烽摱琛寎")){
+ if(Objects.nonNull(ywAccount)&&StringUtils.isNotBlank(ywAccount.getBankNo())){
+ tempStr.replace("${鎵�灞炲叕鍙稿紑鎴烽摱琛寎",ywAccount.getBankNo());
+ }else{
+ tempStr.replace("${鎵�灞炲叕鍙稿紑鎴烽摱琛寎","-");
+ }
+ }else if(y.getTitle().equals("${閫氱煡鍗曠敓鎴愭棩鏈焳")){
+ tempStr.replace("${閫氱煡鍗曠敓鎴愭棩鏈焳",DateUtil.formatDate(new Date(),"yyyy-MM-dd"));
+ }else if(y.getTitle().equals("${鍒惰〃浜哄悕绉皚")){
+ tempStr.replace("${鍒惰〃浜哄悕绉皚",loginUserInfo.getRealname());
+ }
+ }
+ return tempStr;
+ }
+
+
}
--
Gitblit v1.9.3