From 9b138d5216ad21a69d0dfde310ccc81e53fb627e Mon Sep 17 00:00:00 2001
From: nidapeng <jp@doumee.com>
Date: 星期二, 09 四月 2024 15:38:31 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/1.0.1' into 1.0.1

---
 server/service/src/main/java/com/doumee/service/business/impl/TaxesServiceImpl.java |   33 ++++++++++++++++++++++++++-------
 1 files changed, 26 insertions(+), 7 deletions(-)

diff --git a/server/service/src/main/java/com/doumee/service/business/impl/TaxesServiceImpl.java b/server/service/src/main/java/com/doumee/service/business/impl/TaxesServiceImpl.java
index 2cde2ac..6b9923c 100644
--- a/server/service/src/main/java/com/doumee/service/business/impl/TaxesServiceImpl.java
+++ b/server/service/src/main/java/com/doumee/service/business/impl/TaxesServiceImpl.java
@@ -189,6 +189,20 @@
         update.setImgurl(taxes.getImgurl());
         taxesMapper.updateById(update);
 
+        //鏌ヨ寮�绁ㄦ槑缁嗚褰�
+        List<TaxDetial> taxDetialList = taxDetialMapper.selectList(new QueryWrapper<TaxDetial>().lambda()
+                .eq(TaxDetial::getTaxId,taxes.getId())
+                .eq(TaxDetial::getType,Constants.TWO));
+        if(CollectionUtils.isNotEmpty(taxDetialList)){
+            for (TaxDetial taxDetial:taxDetialList) {
+                taxesMapper.update(null,new UpdateWrapper<Taxes>().lambda()
+                                .set(Taxes::getEditDate,new Date())
+                                .set(Taxes::getEditor,user.getId())
+                        .set(Taxes::getStatus,3).eq(Taxes::getId,taxDetial.getDelTaxId()));
+            }
+        }
+
+
         //瀛樺偍寰呭姙淇℃伅
         Constants.NoticeObjectType noticeObjectType = Constants.NoticeObjectType.TAXES;
         //鍒犻櫎鍏朵粬寰呭姙
@@ -235,7 +249,9 @@
         MPJLambdaWrapper<Taxes> queryWrapper = new MPJLambdaWrapper<>();
         queryWrapper.selectAll(Taxes.class);
         queryWrapper.selectAs(Solutions::getName,Taxes::getSolutionName);
+        queryWrapper.selectAs(SystemUser::getRealname,Taxes::getCancelUserName);
         queryWrapper.leftJoin(Solutions.class,Solutions::getId,Taxes::getSolutionId);
+        queryWrapper.leftJoin(SystemUser.class,SystemUser::getId,Taxes::getCancelUserId);
         Taxes model =taxesJoinMapper.selectById(id);
         if(model==null || !Constants.equalsInteger(model.getIsdeleted(),Constants.ZERO)){
             throw  new BusinessException(ResponseStatus.DATA_EMPTY);
@@ -461,15 +477,17 @@
             //鏌ヨ姣忎釜淇濆崟涓嬪彲浠ユ姇淇濈殑閲戦
             InsuranceApply insuranceApply = insuranceApplyJoinMapper.selectJoinOne(InsuranceApply.class,new MPJLambdaWrapper<InsuranceApply>()
                     .selectAll(InsuranceApply.class)
+//                    .select(" ifnull(( select sum(td.fee) from taxes ts inner join tax_detial td on td.TAX_ID = ts.id  where ts.status  = 1 and td.INSURANCE_APPLY_ID = t.id ),0) as taxesMoney")
                     .select(" ifnull(( select sum(td.fee) from taxes ts inner join tax_detial td on td.TAX_ID = ts.id  where ts.status != 2 and td.INSURANCE_APPLY_ID = t.id ),0) as taxesMoney ")
                     .eq(InsuranceApply::getId,taxDetial.getInsuranceApplyId())
             );
-            if(Objects.isNull(insuranceApply)){
-                throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"淇濆崟鍙枫��"+taxDetial.getApplyCode()+"銆戞湭鏌ヨ鍒颁繚鍗曚俊鎭�");
-            }
-            if(insuranceApply.getCurrentFee().subtract(insuranceApply.getTaxesMoney()).compareTo(taxDetial.getFee())!=Constants.ZERO){
-                throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"淇濆崟鍙枫��"+taxDetial.getApplyCode()+"銆戝彲鎶ラ攢閲戦閿欒銆�"+insuranceApply.getCurrentFee().subtract(insuranceApply.getTaxesMoney())+"銆�");
-            }
+//            if(Objects.isNull(insuranceApply)){
+//                throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"淇濆崟鍙枫��"+taxDetial.getApplyCode()+"銆戞湭鏌ヨ鍒颁繚鍗曚俊鎭�");
+//            }
+//            if(insuranceApply.getCurrentFee().subtract(insuranceApply.getTaxesMoney()).compareTo(taxDetial.getFee())!=Constants.ZERO){
+//                //throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"淇濆崟鍙枫��"+taxDetial.getApplyCode()+"銆戝彲鎶ラ攢閲戦閿欒銆�"+insuranceApply.getCurrentFee().subtract(insuranceApply.getTaxesMoney())+"銆�");
+//                throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"淇濆崟鍙枫��"+taxDetial.getApplyCode()+"銆戝彲鎶ラ攢閲戦閿欒");
+//            }
             taxDetial.setCreator(user.getId());
             taxDetial.setCreateDate(new Date());
             taxDetial.setIsdeleted(Constants.ZERO);
@@ -648,7 +666,7 @@
             taxDetial.setTaxId(taxes.getId());
             taxDetial.setTotalFee(taxesInvoicingVO.getAmount());
             taxDetial.setFee(taxesInvoicingVO.getAmount());
-            taxDetial.setInsuranceApplyId(taxes.getApplyId());
+            taxDetial.setInsuranceApplyId(taxes.getInsuranceApplyId());
             if(taxesInvoicingVO.getType().equals(Constants.ZERO)){
                 taxDetial.setType(taxesInvoicingVO.getType());
             }else if(taxesInvoicingVO.getType().equals(Constants.ONE)){
@@ -675,6 +693,7 @@
                 taxDetial.setTotalFee(chTaxes.getPrice());
                 taxDetial.setFee(chTaxes.getPrice());
                 taxDetial.setDelTaxId(chTaxes.getId());
+                taxDetial.setInsuranceApplyId(taxes.getInsuranceApplyId());
                 taxDetial.setType(Constants.TWO);
                 taxDetailList.add(taxDetial);
             }

--
Gitblit v1.9.3