From 6be859f745beaa13a831f3291147612f66b9d776 Mon Sep 17 00:00:00 2001
From: liukangdong <898885815@qq.com>
Date: 星期二, 26 十一月 2024 09:42:21 +0800
Subject: [PATCH] ll
---
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwContractBillServiceImpl.java | 54 +++++++++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 47 insertions(+), 7 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 05c57c5..7d4dc16 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
@@ -27,9 +27,7 @@
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
-import java.util.Date;
-import java.util.List;
-import java.util.Objects;
+import java.util.*;
import java.util.stream.Collectors;
/**
@@ -57,7 +55,6 @@
-
@Override
public Integer create(YwContractBill ywContractBill) {
if(Objects.isNull(ywContractBill)
@@ -67,9 +64,10 @@
|| Objects.isNull(ywContractBill.getCostType())
|| Objects.isNull(ywContractBill.getBillType())
|| Objects.isNull(ywContractBill.getCompanyId())
- || Objects.isNull(ywContractBill.getStartDate())
- || Objects.isNull(ywContractBill.getEndDate())
|| com.github.xiaoymin.knife4j.core.util.CollectionUtils.isEmpty(ywContractBill.getYwContractRoomList())
+ || Objects.nonNull(ywContractBill.getFeeType())
+ || (Constants.equalsInteger(ywContractBill.getFeeType(),Constants.ZERO)&& (Objects.isNull(ywContractBill.getStartDate())
+ || Objects.isNull(ywContractBill.getEndDate())))
){
throw new BusinessException(ResponseStatus.BAD_REQUEST);
}
@@ -78,7 +76,7 @@
ywContractBill.setCreateDate(new Date());
ywContractBill.setCreator(loginUserInfo.getId());
ywContractBill.setIsdeleted(Constants.ZERO);
- ywContractBill.setType(Constants.contractBillType.create);
+ ywContractBill.setType(Constants.ONE);
ywContractBill.setStatus(Constants.ZERO);
ywContractBillMapper.insert(ywContractBill);
@@ -158,6 +156,7 @@
}
+ @Override
public YwContractBill getDetail(Integer id) {
YwContractBill ywContractBill = ywContractBillMapper.selectJoinOne(YwContractBill.class,
new MPJLambdaWrapper<YwContractBill>().selectAll(YwContractBill.class)
@@ -322,6 +321,47 @@
+ @Override
+ public void dealDayBillCode(){
+ List<YwContractBill> ywContractBillList = ywContractBillMapper.selectJoinList(YwContractBill.class,
+ new MPJLambdaWrapper<YwContractBill>()
+ .selectAll(YwContractBill.class)
+ .select(" DATE(CREATE_DATE) as codeDate")
+ .isNull(YwContractBill::getCode)
+ .orderByAsc(YwContractBill::getId)
+ );
+ if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(ywContractBillList)){
+ List<String> codeDateList = ywContractBillList.stream().map(i->i.getCodeDate()).collect(Collectors.toList());
+ if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(codeDateList)){
+ Set<String> codeDateSet = new HashSet<String>(codeDateList);
+ for (String codeDate:codeDateSet) {
+ //鑾峰彇褰撳墠鏃ユ湡鐨勬暟鎹�
+ List<YwContractBill> codeDateBillList =
+ ywContractBillList.stream().filter(i->i.getCodeDate().equals(codeDate)).collect(Collectors.toList());
+ if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isEmpty(codeDateBillList)){
+ continue;
+ }
+ //鏌ヨ鏈�澶х殑鍗曞彿
+ YwContractBill ywContractBill = ywContractBillMapper.selectOne(new QueryWrapper<YwContractBill>().lambda()
+ .isNotNull(YwContractBill::getCode)
+ .apply(" CREATE_DATE like '"+codeDate+"%' ")
+ .orderByDesc(YwContractBill::getId)
+ );
+ Integer maxCode = Constants.ONE;
+ if(Objects.nonNull(ywContractBill)){
+ maxCode = Integer.valueOf(ywContractBill.getCode().replace("ZD"+codeDate,""));
+ }
+ for (YwContractBill contractBill:codeDateBillList) {
+ maxCode = maxCode + 1;
+ contractBill.setCode("ZD" + codeDate + "-" + StringUtils.leftPad(maxCode.toString() , 4,"0"));
+ ywContractBillMapper.update(null, new UpdateWrapper<YwContractBill>().lambda().set(YwContractBill::getCode,contractBill.getCode())
+ .eq(YwContractBill::getId,ywContractBill.getId()));
+ }
+ }
+ }
+ }
+ }
+
}
--
Gitblit v1.9.3