From d41bd90bb4cc53cb5dbcdd275ffad04571e03755 Mon Sep 17 00:00:00 2001
From: k94314517 <8417338+k94314517@user.noreply.gitee.com>
Date: 星期二, 02 四月 2024 14:02:53 +0800
Subject: [PATCH] git ch
---
server/service/src/main/java/com/doumee/service/business/impl/UnionApplyServiceImpl.java | 109 +++++++++++++++++++++++++++++++-----------------------
1 files changed, 63 insertions(+), 46 deletions(-)
diff --git a/server/service/src/main/java/com/doumee/service/business/impl/UnionApplyServiceImpl.java b/server/service/src/main/java/com/doumee/service/business/impl/UnionApplyServiceImpl.java
index da340b8..2e4a817 100644
--- a/server/service/src/main/java/com/doumee/service/business/impl/UnionApplyServiceImpl.java
+++ b/server/service/src/main/java/com/doumee/service/business/impl/UnionApplyServiceImpl.java
@@ -26,7 +26,6 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.doumee.service.business.third.SignService;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
-import io.swagger.models.auth.In;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -390,7 +389,7 @@
eq(Solutions::getType,Constants.ONE)
.eq(Solutions::getIsdeleted,Constants.ZERO)
.eq(Solutions::getDataType,Constants.ZERO)
- .eq(Solutions::getBaseId,saveUnionApplyDTO.getBaseSolutionId()));
+ .eq(Solutions::getId,saveUnionApplyDTO.getBaseSolutionId()));
//鏌ヨ鏂规鏁版嵁
if(solutions == null){
throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"瀵逛笉璧凤紝鏂规淇℃伅鏈夎锛岃鍒锋柊椤甸潰閲嶈瘯");
@@ -496,7 +495,7 @@
multifileMapper.delete(new QueryWrapper<Multifile>()
.lambda()
.apply(" multifile.id in ( select i.id from insurance_apply i where i.UNION_APPLY_ID = "+unionApply.getId()+" ) ")
- .eq(Multifile::getObjType,Constants.MultiFile.COMPANY_TBD_SIGNED.getKey()));
+ .eq(Multifile::getObjType,Constants.MultiFile.BD_APPLY_PDF.getKey()));
}
insuranceApplyJoinMapper.update(null,new UpdateWrapper<InsuranceApply>().lambda()
.set(InsuranceApply::getUnionApplyId,null)
@@ -580,7 +579,7 @@
multifile.setCreator(user.getId());
multifile.setCreateDate(new Date());
multifile.setCreateDate(new Date());
- multifile.setObjType(Constants.MultiFile.COMPANY_TBD_SIGNED.getKey());
+ multifile.setObjType(Constants.MultiFile.BD_APPLY_PDF.getKey());
multifile.setType(Constants.TWO);
multifileMapper.insert(multifile);
@@ -651,7 +650,7 @@
}
Multifile f = multifileMapper.selectOne(new QueryWrapper<Multifile>().lambda()
.eq(Multifile::getObjId,unionApply.getId())
- .eq(Multifile::getObjType,Constants.MultiFile.HBD_BD_SIGNED_PDF.getKey())
+ .eq(Multifile::getObjType,Constants.MultiFile.HBD_BD_APPLY_PDF.getKey())
.eq(Multifile::getIsdeleted,Constants.ZERO)
.last("limit 1"));
if(f == null || StringUtils.isBlank(f.getFileurl())){
@@ -695,7 +694,8 @@
|| Objects.isNull(unionApplyBXDDTO.getStartTime())
|| Objects.isNull(unionApplyBXDDTO.getEndTime())
|| StringUtils.isBlank(unionApplyBXDDTO.getCode())
- || Objects.isNull(unionApplyBXDDTO.getUnionApplyBXDDDetailTOList())
+ || StringUtils.isBlank(unionApplyBXDDTO.getFileUrl())
+ || StringUtils.isBlank(unionApplyBXDDTO.getFileName())
){
throw new BusinessException(ResponseStatus.BAD_REQUEST);
}
@@ -711,7 +711,7 @@
throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝璇ュ悎骞跺崟鐘舵�佸凡娴佽浆锛屽綋鍓嶄笉鏀寔璇ユ搷浣渵");
}
//鍔犱环鍙傛暟
- List<UnionApplyBXDDDetailTO> unionApplyBXDDDetailTOList = unionApplyBXDDTO.getUnionApplyBXDDDetailTOList();
+ List<UnionApplyBXDDetailDTO> unionApplyBXDDetailDTOList = unionApplyBXDDTO.getUnionApplyBXDDDetailDTOList();
//鎵�鏈夋姇淇濈敵璇蜂繚鍗曟槑缁嗚
List<ApplyDetail> applyDetailList = applyDetailJoinMapper.selectList(new QueryWrapper<ApplyDetail>().lambda().select(ApplyDetail::getPrice)
@@ -727,60 +727,49 @@
//褰撳墠鏃ユ湡鍦ㄧ粨鏉熸棩鏈熶箣鍚�
useDays = -1;
}
-
BigDecimal sumFee = BigDecimal.ZERO;
BigDecimal sumCurrFee = BigDecimal.ZERO;
-
- for (UnionApplyBXDDDetailTO unionApplyBXDDDetailTO:unionApplyBXDDDetailTOList) {
- InsuranceApply insuranceApply = insuranceApplyJoinMapper.selectById(unionApplyBXDDDetailTO.getApplyId());
- if(Objects.isNull(insuranceApply)||!Constants.equalsInteger(insuranceApply.getIsdeleted(),Constants.ZERO)){
- throw new BusinessException(ResponseStatus.DATA_EMPTY);
+ List<InsuranceApply> insuranceApplyList = insuranceApplyJoinMapper.selectList(new QueryWrapper<InsuranceApply>()
+ .lambda().eq(InsuranceApply::getUnionApplyId,unionApply.getId()));
+ for (InsuranceApply insuranceApply:insuranceApplyList) {
+ BigDecimal price = insuranceApply.getPrice();
+ Optional<UnionApplyBXDDetailDTO> unionApplyBXDDDetailTO= unionApplyBXDDetailDTOList.stream().filter(m->m.getApplyId().equals(insuranceApply.getId())).findFirst();
+ if(unionApplyBXDDDetailTO.isPresent()){
+ UnionApplyBXDDetailDTO unionApplyBXDDetailDTO = unionApplyBXDDDetailTO.get();
+ price = price.add(unionApplyBXDDetailDTO.getServerMoney());
+ //涓婁紶淇濆崟淇℃伅
+ if(StringUtils.isNotBlank(unionApplyBXDDetailDTO.getFileUrl())){
+ Multifile multifile = new Multifile();
+ multifile.setIsdeleted(Constants.ZERO);
+ multifile.setCreator(user.getId());
+ multifile.setCreateDate(new Date());
+ multifile.setObjId(insuranceApply.getId());
+ multifile.setObjType(Constants.MultiFile.BD_DONE_PDF.getKey());
+ multifile.setType(Constants.TWO);
+ multifile.setFileurl(unionApplyBXDDetailDTO.getFileUrl());
+ multifile.setName(unionApplyBXDDetailDTO.getFileName());
+ multifileMapper.insert(multifile);
+ insuranceApply.setUnionApplyTbdStatus(Constants.ONE);
+ }else{
+ insuranceApply.setUnionApplyTbdStatus(Constants.ZERO);
+ }
}
- if(!insuranceApply.getStatus().equals(Constants.InsuranceApplyStatus.PLATFORM_CHECK_PASS.getKey())){
- throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝璇ユ姇淇濆崟鐘舵�佸凡娴佽浆锛屽綋鍓嶄笉鏀寔璇ユ搷浣渵");
- }
- List<ApplyDetail> applyDetails = applyDetailList.stream().filter(m->m.getApplyId().equals(unionApplyBXDDDetailTO.getApplyId())).collect(Collectors.toList());
- if(CollectionUtils.isEmpty(applyDetails)){
- throw new BusinessException(ResponseStatus.DATA_EMPTY);
- }
- //鎻愪氦鍚庣殑鏂颁环鏍� 鍔犱笂鏈嶅姟璐�
- BigDecimal price = applyDetails.get(Constants.ZERO).getPrice().add(unionApplyBXDDDetailTO.getServerMoney());
- //瀹為檯宸蹭骇鐢熻垂鐢�
+ //瀹為檯宸蹭骇鐢熻垂鐢紙鍗曚汉锛�
BigDecimal currentFee = BigDecimal.ZERO;
if(useDays==-1){
currentFee = new BigDecimal(maxDays).multiply(price);
}else if(useDays>0){
currentFee = new BigDecimal(useDays).multiply(price);
}
- //涓婁紶淇濆崟淇℃伅
- if(StringUtils.isNotBlank(unionApplyBXDDDetailTO.getFileUrl())){
- Multifile multifile = new Multifile();
- multifile.setIsdeleted(Constants.ZERO);
- multifile.setCreator(user.getId());
- multifile.setCreateDate(new Date());
- multifile.setObjId(insuranceApply.getId());
- multifile.setObjType(Constants.MultiFile.BD_DONE_PDF.getKey());
- multifile.setType(Constants.TWO);
- multifile.setFileurl(unionApplyBXDDDetailTO.getFileUrl());
- multifile.setName(unionApplyBXDDDetailTO.getFileName());
- multifileMapper.insert(multifile);
- insuranceApply.setUnionApplyTbdStatus(Constants.ONE);
- }else{
- insuranceApply.setUnionApplyTbdStatus(Constants.ZERO);
- }
+
+ List<ApplyDetail> applyDetails = applyDetailList.stream().filter(m->m.getApplyId().equals(insuranceApply.getId())).collect(Collectors.toList());
//鏇存柊鎶曚繚鐢宠鍗�
insuranceApplyJoinMapper.update(null,new UpdateWrapper<InsuranceApply>().lambda()
- .set(InsuranceApply::getFee,
- new BigDecimal(applyDetails.size())
- .multiply(price)
- )
.set(InsuranceApply::getStatus,Constants.InsuranceApplyStatus.WTB_DONE.getKey())
- .set(InsuranceApply::getUnionApplyTbdStatus,3)
.set(InsuranceApply::getFee,price.multiply(new BigDecimal(applyDetails.size())).multiply(new BigDecimal(maxDays)))
.set(InsuranceApply::getCurrentFee,currentFee.multiply(new BigDecimal(applyDetails.size())))
.set(InsuranceApply::getStartTime,unionApplyBXDDTO.getStartTime())
.set(InsuranceApply::getEndTime,unionApplyBXDDTO.getEndTime())
- .set(InsuranceApply::getUnionApplyTbdStatus,insuranceApply.getUnionApplyTbdStatus())
.set(InsuranceApply::getEditDate,new Date())
.set(InsuranceApply::getEditor,user.getId())
.eq(InsuranceApply::getId,insuranceApply.getId()));
@@ -795,10 +784,10 @@
.set(ApplyDetail::getEndTime,unionApplyBXDDTO.getEndTime())
.in(ApplyDetail::getId,applyDetails.stream().map(m->m.getId()).collect(Collectors.toList()))
);
-
sumFee = sumFee.add(price.multiply(new BigDecimal(applyDetails.size())).multiply(new BigDecimal(maxDays)));
sumCurrFee = sumCurrFee.add(currentFee.multiply(new BigDecimal(applyDetails.size())));
}
+
unionApplyMapper.update(null,new UpdateWrapper<UnionApply>()
.lambda()
.set(UnionApply::getStatus,Constants.UnionApplyStatus.FINISH)
@@ -838,4 +827,32 @@
}
+
+
+ @Override
+ @Transactional(rollbackFor = {Exception.class,BusinessException.class})
+ public void updateUnionApplyCurrentFee(Integer id){
+ List<UnionApply> unionApplyList = unionApplyJoinMapper.selectJoinList(UnionApply.class,new MPJLambdaWrapper<UnionApply>()
+ .selectAll(UnionApply.class)
+ .eq(UnionApply::getIsdeleted,Constants.ZERO)
+ .eq(UnionApply::getStatus,Constants.UnionApplyStatus.FINISH)
+ .eq(!Objects.isNull(id),UnionApply::getId,id)
+ .le(UnionApply::getStartTime,DateUtil.getDate(new Date(),"yyyy-MM-dd") + " 00:00:00")
+ .ge(UnionApply::getEndTime,DateUtil.getDate(new Date(),"yyyy-MM-dd") + " 23:59:59")
+ );
+
+ if(CollectionUtils.isNotEmpty(unionApplyList)){
+ for (UnionApply unionApply:unionApplyList) {
+ List<InsuranceApply> insuranceApplyList = insuranceApplyJoinMapper
+ .selectList(new QueryWrapper<InsuranceApply>().lambda()
+ .eq(InsuranceApply::getUnionApplyId,unionApply.getId()));
+ if(CollectionUtils.isNotEmpty(insuranceApplyList)){
+ unionApply.setCurrentFee(insuranceApplyList.stream().map(m->m.getCurrentFee()).reduce(BigDecimal.ZERO,BigDecimal::add));
+ unionApplyMapper.updateById(unionApply);
+ }
+ }
+ }
+ }
+
+
}
--
Gitblit v1.9.3