From f8b1073fbb28d37e08016eed32c682f8c5eae391 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期五, 02 二月 2024 17:26:32 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 server/service/src/main/java/com/doumee/service/business/impl/TaxesServiceImpl.java |   95 +++++++++++++++++++++++------------------------
 1 files changed, 46 insertions(+), 49 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 34b0053..c744882 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
@@ -8,10 +8,7 @@
 import com.doumee.core.model.PageWrap;
 import com.doumee.core.utils.Constants;
 import com.doumee.core.utils.Utils;
-import com.doumee.dao.business.CompanyMapper;
-import com.doumee.dao.business.SolutionsMapper;
-import com.doumee.dao.business.TaxDetialMapper;
-import com.doumee.dao.business.TaxesMapper;
+import com.doumee.dao.business.*;
 import com.doumee.dao.business.dto.DirectInvoicingDTO;
 import com.doumee.dao.business.dto.DirectInvoicingDetailDTO;
 import com.doumee.dao.business.dto.EntrustInvoicingDTO;
@@ -67,7 +64,8 @@
     private ApplyChangeJoinMapper applyChangeJoinMapper;
     @Autowired
     private SolutionsMapper solutionsMapper;
-
+    @Autowired
+    private NoticesMapper noticesMapper;
     @Override
     public Integer create(Taxes taxes) {
         taxesMapper.insert(taxes);
@@ -118,6 +116,10 @@
                 }
             }
         }
+        //瀛樺偍寰呭姙淇℃伅
+        Constants.NoticeObjectType noticeObjectType = Constants.NoticeObjectType.TAXES;
+        //鍒犻櫎鍏朵粬寰呭姙
+        noticesMapper.delete(new QueryWrapper<Notices>().lambda().eq(Notices::getObjType,noticeObjectType.getKey()).eq(Notices::getObjId,model.getId()));
     }
 
     private List<TaxDetial> getDetailListById(Integer id) {
@@ -127,11 +129,12 @@
     private List<TaxDetial> getJoinDetailListById(Integer id) {
         MPJLambdaWrapper<TaxDetial> queryWrapper = new MPJLambdaWrapper<>();
         queryWrapper.selectAll(TaxDetial.class);
+        queryWrapper.selectAs(Solutions::getName,TaxDetial::getSolutionName);
         queryWrapper.selectAs(Taxes::getDoneCode,TaxDetial::getTaxDoneCode);
         queryWrapper.selectAs(Taxes::getCreateDate,TaxDetial::getTaxCreateDate);
         queryWrapper.selectAs(InsuranceApply::getCode,TaxDetial::getApplyCode);
-        queryWrapper.selectAs(ApplyChange::getCode,TaxDetial::getChangApplyCode);
-        queryWrapper.select("(CASE t.type\n" +
+        queryWrapper.selectAs(ApplyChange::getValidCode,TaxDetial::getChangApplyCode);
+/*        queryWrapper.select("(CASE t.type\n" +
                 "WHEN 0 THEN (select count(1) from apply_detail c where c.APPLY_ID=t.INSURANCE_APPLY_ID) \n" +
                 "ELSE 0  \n" +
                 "END) as applyNum,\n" +
@@ -142,11 +145,15 @@
                 "(CASE t.type \n" +
                 "WHEN 1 THEN  (select count(1) from apply_chagne_detail c where c.APPLY_CHANGE_ID=t.APPLY_CHANGE_ID)  \n" +
                 "ELSE 0  \n" +
-                "END) as applyChangeAddNum");
+                "END) as applyChangeAddNum");*/
         queryWrapper.leftJoin(InsuranceApply.class,InsuranceApply::getId,TaxDetial::getInsuranceApplyId);
+        queryWrapper.leftJoin(Solutions.class,Solutions::getId,InsuranceApply::getSolutionId);
         queryWrapper.leftJoin(ApplyChange.class,ApplyChange::getId,TaxDetial::getApplyChangeId);
         queryWrapper.leftJoin(Taxes.class,Taxes::getId,TaxDetial::getDelTaxId);
+        queryWrapper.eq(  TaxDetial::getTaxId,id);
         List<TaxDetial> detialList =  taxDetailJoinMapper.selectJoinList(TaxDetial.class,queryWrapper.orderByAsc(TaxDetial::getType));
+
+
         return detialList;
     }
 
@@ -181,6 +188,12 @@
         update.setDoneDate(update.getEditDate());
         update.setImgurl(taxes.getImgurl());
         taxesMapper.updateById(update);
+
+        //瀛樺偍寰呭姙淇℃伅
+        Constants.NoticeObjectType noticeObjectType = Constants.NoticeObjectType.TAXES;
+        //鍒犻櫎鍏朵粬寰呭姙
+        noticesMapper.delete(new QueryWrapper<Notices>().lambda().eq(Notices::getObjType,noticeObjectType.getKey()).eq(Notices::getObjId,taxes.getId()));
+
     }
 
     @Override
@@ -236,11 +249,12 @@
             List<TaxDetial> applyList = new ArrayList<>();//鎶曚繚鍜屽姞鍑忎繚
             List<TaxDetial> delList = new ArrayList<>();//鍐茬孩鍗�
             if(detialList!=null){
-                for(TaxDetial d :delList){
-                    d.setSolutionName(model.getSolutionName());
+                for(TaxDetial d :detialList){
+//                    d.setSolutionName(model.getSolutionName());
                     d.setFee(Constants.formatBigdecimal(d.getFee()));
                     d.setTotalFee(Constants.formatBigdecimal(d.getTotalFee()));
-                    if(Constants.equalsInteger(d.getType(),Constants.ZERO) || Constants.equalsInteger(d.getType(),Constants.ONE)){
+                    if(Constants.equalsInteger(d.getType(),Constants.ZERO)
+                            || Constants.equalsInteger(d.getType(),Constants.ONE)){
                         applyList.add(d);
                     }else  if(Constants.equalsInteger(d.getType(),Constants.TWO)){
                         delList.add(d);
@@ -426,6 +440,17 @@
             taxDetial.setType(Constants.ZERO);
         }
         taxDetailJoinMapper.insertBatchSomeColumn(taxDetialList);
+
+
+        //瀛樺偍寰呭姙淇℃伅
+        Constants.NoticeObjectType noticeObjectType = Constants.NoticeObjectType.TAXES;
+        //鍒犻櫎鍏朵粬寰呭姙
+        noticesMapper.delete(new QueryWrapper<Notices>().lambda().eq(Notices::getObjType,noticeObjectType.getKey()).eq(Notices::getObjId,taxes.getId()));
+        Notices notices = new Notices(noticeObjectType,Constants.ZERO,taxes.getId(),taxes.getPrice().toString(),
+                taxes.getCompanyId(), Constants.NoticeType.ZERO);
+        noticesMapper.insert(notices);
+
+
     }
 
 
@@ -472,6 +497,7 @@
                         .selectAll(InsuranceApply.class)
                         .selectAs(Solutions::getName,InsuranceApply::getSolutionsName)
                         .select(" ( select count(1) from apply_detail ad  where ad.apply_id = t.id ) as insureNum")
+                        .leftJoin(Solutions.class,Solutions::getId,InsuranceApply::getSolutionId)
                         .notExists(" select 1 from taxes t1 inner join tax_detial t2 on t1.id  = t2.tax_id where t2.type = 0 and t1.status != 2 and t.id = t2.INSURANCE_APPLY_ID  ")
                         .eq(InsuranceApply::getStatus,Constants.InsuranceApplyStatus.UPLOAD_INSURANCE.getKey())
                         .eq(InsuranceApply::getId,id)
@@ -495,7 +521,7 @@
         if(CollectionUtils.isNotEmpty(applyChangeList)){
             for (ApplyChange applyChange:applyChangeList) {
                 insuranceApply.setFee(insuranceApply.getFee().subtract(applyChange.getFee()));
-                TaxesInvoicingVO taxesInvoicingVO = applyChange.getTaxesInvoicingVO();
+                TaxesInvoicingVO taxesInvoicingVO = applyChange.toTaxesInvoicingVO();
                 if(!Objects.isNull(insuranceApply)){
                     taxesInvoicingVO.setAmount(BigDecimal.ZERO);
                 }
@@ -521,7 +547,7 @@
                 || Objects.isNull(directInvoicingDTO.getInvoicingMoney())
                 || Objects.isNull(directInvoicingDTO.getType())
                 || Objects.isNull(directInvoicingDTO.getInvoicingDetailDTOList())
-                || StringUtils.isNotBlank(directInvoicingDTO.getAddress())
+                || StringUtils.isBlank(directInvoicingDTO.getAddress())
         ){
             throw new BusinessException(ResponseStatus.BAD_REQUEST);
         }
@@ -617,43 +643,14 @@
             throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鏃犲彲寮�绁ㄦ暟鎹紝鎿嶄綔澶辫触");
         }
 
+        //瀛樺偍寰呭姙淇℃伅
+        Constants.NoticeObjectType noticeObjectType = Constants.NoticeObjectType.TAXES;
+        //鍒犻櫎鍏朵粬寰呭姙
+        noticesMapper.delete(new QueryWrapper<Notices>().lambda().eq(Notices::getObjType,noticeObjectType.getKey()).eq(Notices::getObjId,taxes.getId()));
+        Notices notices = new Notices(noticeObjectType,Constants.ZERO,taxes.getId(),taxes.getPrice().toString(),
+                taxes.getCompanyId(), Constants.NoticeType.ZERO);
+        noticesMapper.insert(notices);
 
-//        List<DirectInvoicingDetailDTO> directInvoicingDetailDTOList = directInvoicingDTO.getDirectInvoicingDetailDTOList();
-//        for (DirectInvoicingDetailDTO directInvoicingDetailDTO:directInvoicingDetailDTOList) {
-//            if(Objects.isNull(directInvoicingDetailDTO)
-//                    || Objects.isNull(directInvoicingDetailDTO.getId())
-//                    || Objects.isNull(directInvoicingDetailDTO.getType())
-//                    || Objects.isNull(directInvoicingDetailDTO.getFee())
-//            ){
-//                throw new BusinessException(ResponseStatus.BAD_REQUEST);
-//            }
-//
-//            if(directInvoicingDetailDTO.getType().equals(Constants.ZERO)){
-//                //淇濆崟
-//                InsuranceApply insuranceApply =  insuranceApplyJoinMapper.selectJoinOne(InsuranceApply.class,
-//                        new MPJLambdaWrapper<InsuranceApply>()
-//                                .selectAll(InsuranceApply.class)
-//                                .selectAs(Solutions::getName,InsuranceApply::getSolutionsName)
-//                                .select(" ( select count(1) from apply_detail ad  where ad.apply_id = t.id ) as insureNum")
-//                                .notExists(" select 1 from taxes t1 inner join tax_detial t2 on t1.id  = t2.tax_id where t2.type = 0 and t1.status != 2 and t.id = t2.INSURANCE_APPLY_ID  ")
-//                                .eq(InsuranceApply::getStatus,Constants.InsuranceApplyStatus.UPLOAD_INSURANCE.getKey())
-//                                .eq(InsuranceApply::getId,directInvoicingDetailDTO.getId())
-//                );
-//                if(Objects.isNull(insuranceApply)){
-//                    throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"淇濆崟鍙枫��"+insuranceApply.getCode()+"銆戞湭鏌ヨ鍒颁繚鍗曚俊鎭�");
-//                }
-//
-//
-//
-//            }else if(directInvoicingDetailDTO.getType().equals(Constants.ZERO)){
-//                //鍔犲噺淇�
-//            }else{
-//                //鍐茬孩鍗�
-//            }
-//
-//
-//        }
-//        taxDetailJoinMapper.insertBatchSomeColumn(taxDetialList);
     }
 
 

--
Gitblit v1.9.3