From 7694708b91af01b0a49912fe119540b01d0c9d5d Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期四, 01 二月 2024 20:45:58 +0800
Subject: [PATCH] 开发业务接口

---
 server/service/src/main/java/com/doumee/service/business/impl/TaxesServiceImpl.java |   31 ++++++++++++++++++-------------
 1 files changed, 18 insertions(+), 13 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 e560f5e..b81bc0a 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
@@ -127,11 +127,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,10 +143,12 @@
                 "(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;
     }
@@ -236,11 +239,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);
@@ -290,8 +294,8 @@
             queryWrapper.eq(Taxes::getCompanyId,-1);//璁剧疆鏃犳晥璁块棶
         }else{
             queryWrapper.in(Taxes::getCompanyId,user.getCompanyIdList());
-            queryWrapper.ge(pageWrap.getModel().getStartDate() != null,Taxes::getCreateDate, Utils.Date.getStart(pageWrap.getModel().getStartDate()));
-            queryWrapper.le(SignRecord::getCreateDate, Utils.Date.getEnd(pageWrap.getModel().getEndDate()));
+            queryWrapper.ge(pageWrap.getModel().getStartDate() != null,Taxes::getCreateDate, pageWrap.getModel().getStartDate());
+            queryWrapper.le(pageWrap.getModel().getEndDate() != null,Taxes::getCreateDate, pageWrap.getModel().getEndDate());
             queryWrapper.eq(pageWrap.getModel().getTaxBank() != null,Taxes::getTaxBank, pageWrap.getModel().getTaxBank());
             queryWrapper.eq(pageWrap.getModel().getTaxBank() != null,Taxes::getTaxBank, pageWrap.getModel().getTaxBank());
             queryWrapper.eq(pageWrap.getModel().getRemark() != null,Taxes::getRemark, pageWrap.getModel().getRemark());
@@ -340,8 +344,8 @@
             throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"闈炰紒涓氱敤鎴锋棤娉曡繘琛岃涓氬姟鏌ヨ");
         }
         if(!Objects.isNull(queryModel)){
-            queryWrapper.ge(pageWrap.getModel().getStartDate() != null,Taxes::getCreateDate, Utils.Date.getStart(pageWrap.getModel().getStartDate()));
-            queryWrapper.le(SignRecord::getCreateDate, Utils.Date.getEnd(pageWrap.getModel().getEndDate()));
+            queryWrapper.ge(pageWrap.getModel().getStartDate() != null,Taxes::getCreateDate, (pageWrap.getModel().getStartDate()));
+            queryWrapper.le(pageWrap.getModel().getEndDate() != null,Taxes::getCreateDate,  (pageWrap.getModel().getEndDate()));
             queryWrapper.eq(!Objects.isNull(queryModel.getInsuranceApplyId()),Taxes::getInsuranceApplyId,queryModel.getInsuranceApplyId());
             queryWrapper.eq(!Objects.isNull(queryModel.getStatus()),Taxes::getStatus,queryModel.getStatus());
         }
@@ -472,6 +476,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 +500,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);
                 }
@@ -503,7 +508,7 @@
             }
         }
         if(!Objects.isNull(insuranceApply)){
-            TaxesInvoicingVO taxesInvoicingVO = insuranceApply.getTaxesInvoicingVO();
+            TaxesInvoicingVO taxesInvoicingVO = insuranceApply.toTaxesInvoicingVO();
             taxesInvoicingVOList.add(taxesInvoicingVO);
         }
     }
@@ -521,7 +526,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);
         }

--
Gitblit v1.9.3