111
k94314517
2024-01-24 e7f3835c7ffb0de6747c7c496c590f7f42e455fc
111
已添加3个文件
已修改11个文件
484 ■■■■■ 文件已修改
server/company/src/main/java/com/doumee/api/business/ApplyChagneDetailController.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/company/src/main/java/com/doumee/api/business/SolutionsController.java 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/company/src/main/java/com/doumee/api/business/TaxesController.java 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/service/src/main/java/com/doumee/dao/business/dto/DirectInvoicingDTO.java 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/service/src/main/java/com/doumee/dao/business/dto/DirectInvoicingDetailDTO.java 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/service/src/main/java/com/doumee/dao/business/dto/EntrustInvoicingDTO.java 补丁 | 查看 | 原始文档 | blame | 历史
server/service/src/main/java/com/doumee/dao/business/dto/InsuranceApplyQueryDTO.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/service/src/main/java/com/doumee/dao/business/model/ApplyChange.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/service/src/main/java/com/doumee/dao/business/model/InsuranceApply.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/service/src/main/java/com/doumee/dao/business/model/Taxes.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/service/src/main/java/com/doumee/dao/business/vo/TaxesInvoicingVO.java 60 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/service/src/main/java/com/doumee/service/business/TaxesService.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyServiceImpl.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/service/src/main/java/com/doumee/service/business/impl/TaxesServiceImpl.java 239 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/company/src/main/java/com/doumee/api/business/ApplyChagneDetailController.java
@@ -72,14 +72,14 @@
    @PostMapping("/page")
    @RequiresPermissions("business:applychagnedetail:query")
    public ApiResponse<PageData<ApplyChagneDetail>> findPage (@RequestBody PageWrap<ApplyDetailPageDTO> pageWrap) {
        return ApiResponse.success(applyChagneDetailService.findPage(pageWrap));
        return ApiResponse.success(applyChagneDetailService.findPageForCompany(pageWrap));
    }
    @ApiOperation("导出Excel")
    @PostMapping("/exportExcel")
    @RequiresPermissions("business:applychagnedetail:exportExcel")
    public void exportExcel (@RequestBody PageWrap<ApplyDetailPageDTO> pageWrap, HttpServletResponse response) {
        ExcelExporter.build(ApplyChagneDetail.class).export(applyChagneDetailService.findPage(pageWrap).getRecords(), "加减保换厂申请明细信息表", response);
        ExcelExporter.build(ApplyChagneDetail.class).export(applyChagneDetailService.findPageForCompany(pageWrap).getRecords(), "加减保换厂申请明细信息表", response);
    }
    @ApiOperation("根据ID查询")
server/company/src/main/java/com/doumee/api/business/SolutionsController.java
@@ -77,16 +77,16 @@
    @ApiOperation("列表查询")
    @PostMapping("/list")
    @RequiresPermissions("business:solutions:query")
    public ApiResponse<List<Solutions>> findList (@RequestBody Solutions pageWrap) {
        return ApiResponse.success(solutionsService.findList(pageWrap));
    }
    @ApiOperation("列表查询")
    @PostMapping("/page")
    public ApiResponse<List<Solutions>> findPage (@RequestBody Solutions solutions) {
    public ApiResponse<List<Solutions>> findList (@RequestBody Solutions solutions) {
        return ApiResponse.success(solutionsService.findList(solutions));
    }
//    @ApiOperation("列表查询")
//    @PostMapping("/page")
//    public ApiResponse<List<Solutions>> findPage (@RequestBody Solutions solutions) {
//        return ApiResponse.success(solutionsService.findList(solutions));
//    }
    @ApiOperation("导出Excel")
    @PostMapping("/exportExcel")
    @RequiresPermissions("business:solutions:exportExcel")
server/company/src/main/java/com/doumee/api/business/TaxesController.java
@@ -10,8 +10,10 @@
import com.doumee.core.model.PageWrap;
import com.doumee.core.model.PageData;
import com.doumee.core.utils.Constants;
import com.doumee.dao.business.dto.DirectInvoicingDTO;
import com.doumee.dao.business.dto.EntrustInvoicingDTO;
import com.doumee.dao.business.model.Taxes;
import com.doumee.dao.business.vo.TaxesInvoicingVO;
import com.doumee.service.business.TaxesService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -101,8 +103,35 @@
    @ApiOperation("提交委托投报开票")
    @PostMapping("/entrustInvoicing")
    public ApiResponse entrustInvoicing(@RequestBody EntrustInvoicingDTO entrustInvoicingDTOs) {
        LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
        if(!loginUserInfo.getType().equals(Constants.ONE)){
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"非企业类用户无法进行该操作");
        }
        taxesService.entrustInvoicing(entrustInvoicingDTOs);
        return ApiResponse.success(null);
    }
    @ApiOperation("提交直托投报开票")
    @PostMapping("/directInvoicing")
    public ApiResponse directInvoicing(@RequestBody DirectInvoicingDTO directInvoicingDTO) {
        LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
        if(!loginUserInfo.getType().equals(Constants.ONE)){
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"非企业类用户无法进行该操作");
        }
        taxesService.directInvoicing(directInvoicingDTO);
        return ApiResponse.success(null);
    }
    @ApiOperation(value = "获取直保数据信息",notes = "")
    @GetMapping("/getDirectTaxes")
    @RequiresPermissions("business:taxes:query")
    public ApiResponse getDirectTaxes(@RequestParam Integer id) {
        LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
        if(!loginUserInfo.getType().equals(Constants.ONE)){
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"非企业类用户无法进行该操作");
        }
        return ApiResponse.success(taxesService.getDirectTaxes(id));
    }
}
server/service/src/main/java/com/doumee/dao/business/dto/DirectInvoicingDTO.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,34 @@
package com.doumee.dao.business.dto;
import com.doumee.dao.business.model.TaxDetial;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.List;
/**
 * Created by IntelliJ IDEA.
 *
 * @Author : Rk
 * @create 2024/1/24 11:35
 */
@Data
public class DirectInvoicingDTO {
    @ApiModelProperty(value = "保单主键")
    private Integer id;
    @ApiModelProperty(value = "开票金额")
    private BigDecimal invoicingMoney;
    @ApiModelProperty(value = "接收方式 0电子发票 1纸质发票")
    private Integer type;
    @ApiModelProperty(value = "发票接收地址")
    private String address;
    @ApiModelProperty(value = "冲红单数据")
    private List<Integer> invoicingDetailDTOList;
}
server/service/src/main/java/com/doumee/dao/business/dto/DirectInvoicingDetailDTO.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,28 @@
package com.doumee.dao.business.dto;
import com.doumee.dao.business.model.TaxDetial;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.List;
/**
 * Created by IntelliJ IDEA.
 *
 * @Author : Rk
 * @create 2024/1/24 11:35
 */
@Data
public class DirectInvoicingDetailDTO {
    @ApiModelProperty(value = "主键")
    private Integer id;
    @ApiModelProperty(value = "单号")
    private String code;
    @ApiModelProperty(value = "金额")
    private BigDecimal fee;
}
server/service/src/main/java/com/doumee/dao/business/dto/EntrustInvoicingDTO.java
server/service/src/main/java/com/doumee/dao/business/dto/InsuranceApplyQueryDTO.java
@@ -53,7 +53,10 @@
    @ApiModelProperty(value = "类型 0直保 1委托投保")
    private Integer type;
    @ApiModelProperty(value = "主键列表")
    @ApiModelProperty(value = "主键列表",notes = "委托投保开票使用")
    private List<Integer> ids;
    @ApiModelProperty(value = "即将失效订单:0=否;1=是")
    private Integer loseEfficacy;
}
server/service/src/main/java/com/doumee/dao/business/model/ApplyChange.java
@@ -2,6 +2,8 @@
import com.baomidou.mybatisplus.annotation.TableField;
import com.doumee.core.annotation.excel.ExcelColumn;
import com.doumee.core.utils.Constants;
import com.doumee.dao.business.vo.TaxesInvoicingVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
@@ -176,4 +178,17 @@
    private Date endTime;
    public TaxesInvoicingVO getTaxesInvoicingVO(){
        TaxesInvoicingVO taxesInvoicingVO = new TaxesInvoicingVO();
        taxesInvoicingVO.setId(this.getId());
        taxesInvoicingVO.setSolutionsName(this.getSolutionsName());
        taxesInvoicingVO.setValidCode(this.getValidCode());
        taxesInvoicingVO.setAddNum(this.getAddNum());
        taxesInvoicingVO.setDelNum(this.getDelNum());
        taxesInvoicingVO.setAmount(this.getFee());
        taxesInvoicingVO.setType(Constants.ONE);
        return taxesInvoicingVO;
    }
}
server/service/src/main/java/com/doumee/dao/business/model/InsuranceApply.java
@@ -3,6 +3,7 @@
import com.baomidou.mybatisplus.annotation.TableField;
import com.doumee.core.annotation.excel.ExcelColumn;
import com.doumee.core.utils.Constants;
import com.doumee.dao.business.vo.TaxesInvoicingVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
@@ -86,7 +87,6 @@
    @ApiModelProperty(value = "实际保险生效起期")
    @ExcelColumn(name="实际保险生效起期")
    private Date startTime;
    @ApiModelProperty(value = "最近操作时间")
@@ -144,6 +144,9 @@
    @TableField(exist = false)
    private Date taxesLast;
    @ApiModelProperty(value = "失效剩余天数")
    @TableField(exist = false)
    private Integer loseEfficacyDays;
    @ApiModelProperty(value = "服务天数")
    @TableField(exist = false)
@@ -164,4 +167,17 @@
    @ApiModelProperty(value = "处理企业申请状态  0同意 1驳回")
    @TableField(exist = false)
    private int dealBackApply;
    public TaxesInvoicingVO getTaxesInvoicingVO(){
        TaxesInvoicingVO taxesInvoicingVO = new TaxesInvoicingVO();
        taxesInvoicingVO.setId(this.getId());
        taxesInvoicingVO.setSolutionsName(this.getSolutionsName());
        taxesInvoicingVO.setInsuranceCode(this.getCode());
        taxesInvoicingVO.setInsuranceNum(this.getInsureNum());
        taxesInvoicingVO.setStartTime(this.getStartTime());
        taxesInvoicingVO.setAmount(this.getFee());
        taxesInvoicingVO.setType(Constants.ZERO);
        return taxesInvoicingVO;
    }
}
server/service/src/main/java/com/doumee/dao/business/model/Taxes.java
@@ -2,6 +2,8 @@
import com.baomidou.mybatisplus.annotation.TableField;
import com.doumee.core.annotation.excel.ExcelColumn;
import com.doumee.core.utils.Constants;
import com.doumee.dao.business.vo.TaxesInvoicingVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
@@ -67,6 +69,7 @@
    @ApiModelProperty(value = "企业编码(关联company)", example = "1")
    @ExcelColumn(name="企业编码(关联company)")
    private Integer companyId;
    @ApiModelProperty(value = "方案编码(关联solutions)", example = "1")
    @ExcelColumn(name="方案编码(solutions)")
    private Integer solutionId;
@@ -156,6 +159,9 @@
    @TableField(exist = false)
    private String imgurlFull;
    @ApiModelProperty(value = "保单号")
    @TableField(exist = false)
    private String insuranceCode;
    @ApiModelProperty(value = "查询开始时间")
    @TableField(exist = false)
    private Date startDate;
@@ -169,4 +175,18 @@
    @ApiModelProperty(value = "冲红单列表")
    @TableField(exist = false)
    List<TaxDetial> delTaxList ;//
    public TaxesInvoicingVO getTaxesInvoicingVO(){
        TaxesInvoicingVO taxesInvoicingVO = new TaxesInvoicingVO();
        taxesInvoicingVO.setId(this.getId());
        taxesInvoicingVO.setSolutionsName(this.getSolutionName());
        taxesInvoicingVO.setInsuranceCode(this.getInsuranceCode());
        taxesInvoicingVO.setAmount(this.getPrice());
        taxesInvoicingVO.setType(Constants.TWO);
        return taxesInvoicingVO;
    }
}
server/service/src/main/java/com/doumee/dao/business/vo/TaxesInvoicingVO.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,60 @@
package com.doumee.dao.business.vo;
import com.doumee.core.utils.Constants;
import com.doumee.dao.business.model.InsuranceApply;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.poi.ss.formula.functions.T;
import java.math.BigDecimal;
import java.util.Date;
/**
 * ç›´ä¿å¼€ç¥¨ç±»
 * @author RenKang
 */
@Data
public class TaxesInvoicingVO {
    @ApiModelProperty(value = "主键")
    private Integer id;
    @ApiModelProperty(value = "类型 0保单申请 1加减保申请 2冲红单")
    private Integer type;
    @ApiModelProperty(value = "方案名称")
    private String solutionsName;
    @ApiModelProperty(value = "保单号")
    private String insuranceCode;
    @ApiModelProperty(value = "批单号")
    private String validCode;
    @ApiModelProperty(value = "投保人数")
    private Integer insuranceNum;
    @ApiModelProperty(value = "加保人数")
    private Integer addNum;
    @ApiModelProperty(value = "减保人数")
    private Integer delNum;
    @ApiModelProperty(value = "保单生效起期")
    private Date startTime;
    @ApiModelProperty(value = "保单生效止期")
    private Date endTime;
    @ApiModelProperty(value = "金额")
    private BigDecimal amount;
    @ApiModelProperty(value = "发票号")
    private String downCode;
}
server/service/src/main/java/com/doumee/service/business/TaxesService.java
@@ -2,8 +2,11 @@
import com.doumee.core.model.PageData;
import com.doumee.core.model.PageWrap;
import com.doumee.dao.business.dto.DirectInvoicingDTO;
import com.doumee.dao.business.dto.EntrustInvoicingDTO;
import com.doumee.dao.business.model.Taxes;
import com.doumee.dao.business.vo.TaxesInvoicingVO;
import java.util.List;
/**
@@ -108,4 +111,16 @@
     */
    void entrustInvoicing(EntrustInvoicingDTO entrustInvoicingDTO);
    /**
     * ç›´æ‰˜æŠ•保数据提交
     * @param directInvoicingDTO
     */
    void directInvoicing(DirectInvoicingDTO directInvoicingDTO);
    /**
     * æŸ¥è¯¢ç›´ä¿æ•°æ®
     * @param id
     * @return
     */
    List<TaxesInvoicingVO> getDirectTaxes(Integer id);
}
server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyServiceImpl.java
@@ -551,6 +551,8 @@
        queryWrapper.selectAll(InsuranceApply.class);
        queryWrapper.selectAs(Company::getName,InsuranceApply::getCompanyName);
        queryWrapper.selectAs(Solutions::getName,InsuranceApply::getSolutionsName);
        queryWrapper.select(" DATEDIFF( t.END_TIME ,now()  ) AS loseEfficacyDays ");
        queryWrapper.select(" ( select count(1) from apply_detail ad  where ad.apply_id = t.id ) as insureNum");
        queryWrapper.select(" ( select sum(td.fee) from taxes ts inner join tax_detial td on ts.TAX_ID = ts.id  where ts.status != 2 and td.INSURANCE_APPLY_ID = t.id ) as taxesMoney");
        queryWrapper.select(" ( select td.CREATE_DATE from taxes ts inner join tax_detial td on ts.TAX_ID = ts.id  where ts.status != 2 and td.INSURANCE_APPLY_ID = t.id order by td.CREATE_DATE desc limit 1 ) as taxesLast ");
        queryWrapper.leftJoin(Solutions.class,Solutions::getId,InsuranceApply::getSolutionId);
@@ -836,4 +838,5 @@
}
server/service/src/main/java/com/doumee/service/business/impl/TaxesServiceImpl.java
@@ -9,27 +9,33 @@
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.dto.DirectInvoicingDTO;
import com.doumee.dao.business.dto.DirectInvoicingDetailDTO;
import com.doumee.dao.business.dto.EntrustInvoicingDTO;
import com.doumee.dao.business.join.ApplyChangeJoinMapper;
import com.doumee.dao.business.join.InsuranceApplyJoinMapper;
import com.doumee.dao.business.join.TaxDetailJoinMapper;
import com.doumee.dao.business.join.TaxesJoinMapper;
import com.doumee.dao.business.model.*;
import com.doumee.dao.business.vo.TaxesInvoicingVO;
import com.doumee.dao.system.model.SystemUser;
import com.doumee.service.business.TaxesService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.xiaoymin.knife4j.core.util.CollectionUtils;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@@ -57,6 +63,10 @@
    private CompanyMapper companyMapper;
    @Autowired
    private InsuranceApplyJoinMapper insuranceApplyJoinMapper;
    @Autowired
    private ApplyChangeJoinMapper applyChangeJoinMapper;
    @Autowired
    private SolutionsMapper solutionsMapper;
    @Override
    public Integer create(Taxes taxes) {
@@ -420,4 +430,231 @@
    @Override
    public List<TaxesInvoicingVO> getDirectTaxes(Integer id){
        InsuranceApply queryInsuranceApply = insuranceApplyJoinMapper.selectById(id);
        if(Objects.isNull(queryInsuranceApply)){
            throw new BusinessException(ResponseStatus.DATA_EMPTY);
        }
        Solutions solutions = solutionsMapper.selectById(queryInsuranceApply.getSolutionId());
        if(Objects.isNull(solutions)){
            throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"未查询到方案信息");
        }
        if(!solutions.getType().equals(Constants.ZERO)){
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"非直保方案保单,无法进行该操作");
        }
        List<TaxesInvoicingVO>  taxesInvoicingVOList = new ArrayList<>();
        this.dealTaxesData(id,taxesInvoicingVOList);
        List<Taxes> taxesList = taxesJoinMapper.selectJoinList(Taxes.class,new MPJLambdaWrapper<Taxes>()
                .selectAll(Taxes.class)
                .selectAs(Solutions::getName,Taxes::getSolutionName)
                .selectAs(InsuranceApply::getCode,Taxes::getInsuranceCode)
                .leftJoin(Solutions.class,Solutions::getId,Taxes::getSolutionId)
                .leftJoin(InsuranceApply.class,InsuranceApply::getId,Taxes::getInsuranceApplyId)
                .eq(Taxes::getStatus,Constants.ONE)
                .eq(Taxes::getInsuranceApplyId,id)
        );
        if(CollectionUtils.isNotEmpty(taxesList)){
            for (Taxes taxes:taxesList) {
                TaxesInvoicingVO taxesInvoicingVO = taxes.getTaxesInvoicingVO();
                taxesInvoicingVOList.add(taxesInvoicingVO);
            }
        }
        return taxesInvoicingVOList;
    }
    public void dealTaxesData(Integer id,List<TaxesInvoicingVO>  taxesInvoicingVOList){
        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,id)
        );
        List<ApplyChange> applyChangeList = applyChangeJoinMapper.selectJoinList(ApplyChange.class,new MPJLambdaWrapper<ApplyChange>()
                .selectAll(ApplyChange.class)
                .selectAs(InsuranceApply::getCode,ApplyChange::getApplyCode)
                .select("( select count(1) from apply_chagne_detail ad where t.id = ad.APPLY_CHANGE_ID and ad.TYPE = 0  ) as addNum ")
                .select("( select count(1) from apply_chagne_detail ad where t.id = ad.APPLY_CHANGE_ID and ad.TYPE = 1  ) as delNum ")
                .select("( select ifnull(sum(ad.FEE),0) from apply_chagne_detail ad where t.id = ad.APPLY_CHANGE_ID  ) as changeMoney" )
                .notExists(" select 1 from taxes t1 inner join tax_detial t2 on t1.id  = t2.tax_id where t2.type = 1 and t1.status != 2 and t.id = t2.APPLY_CHANGE_ID  ")
                .leftJoin(InsuranceApply.class,InsuranceApply::getId,ApplyChange::getApplyId)
                .leftJoin(Solutions.class,Solutions::getId,InsuranceApply::getSolutionId)
                .eq(ApplyChange::getStatus,Constants.ApplyChangeStatus.APPROVE.getKey())
                .eq(ApplyChange::getType,Constants.ZERO)
                .eq(InsuranceApply::getId,id)
        );
        if(CollectionUtils.isNotEmpty(applyChangeList)){
            for (ApplyChange applyChange:applyChangeList) {
                insuranceApply.setFee(insuranceApply.getFee().subtract(applyChange.getFee()));
                TaxesInvoicingVO taxesInvoicingVO = applyChange.getTaxesInvoicingVO();
                if(!Objects.isNull(insuranceApply)){
                    taxesInvoicingVO.setAmount(BigDecimal.ZERO);
                }
                taxesInvoicingVOList.add(taxesInvoicingVO);
            }
        }
        if(!Objects.isNull(insuranceApply)){
            TaxesInvoicingVO taxesInvoicingVO = insuranceApply.getTaxesInvoicingVO();
            taxesInvoicingVOList.add(taxesInvoicingVO);
        }
    }
    /**
     * ç›´ä¿æ•°æ®æäº¤
     * @param directInvoicingDTO
     */
    @Override
    @Transactional(rollbackFor = {BusinessException.class,Exception.class})
    public void directInvoicing(DirectInvoicingDTO directInvoicingDTO){
        LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
        if(Objects.isNull(directInvoicingDTO)
                || Objects.isNull(directInvoicingDTO.getInvoicingMoney())
                || Objects.isNull(directInvoicingDTO.getType())
                || Objects.isNull(directInvoicingDTO.getInvoicingDetailDTOList())
                || StringUtils.isNotBlank(directInvoicingDTO.getAddress())
        ){
            throw new BusinessException(ResponseStatus.BAD_REQUEST);
        }
        if(!user.getType().equals(Constants.ONE)){
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"非企业用户无法进行该业务查询");
        }
        Company company = companyMapper.selectById(user.getCompanyId());
        if(Objects.isNull(company)){
            throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"未查询到企业信息");
        }
        InsuranceApply queryInsuranceApply = insuranceApplyJoinMapper.selectById(directInvoicingDTO.getId());
        if(Objects.isNull(queryInsuranceApply)){
            throw new BusinessException(ResponseStatus.DATA_EMPTY);
        }
        Solutions solutions = solutionsMapper.selectById(queryInsuranceApply.getSolutionId());
        if(Objects.isNull(solutions)){
            throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"未查询到方案信息");
        }
        if(!solutions.getType().equals(Constants.ZERO)){
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"非直保方案保单,无法进行该操作");
        }
        Taxes taxes = new Taxes();
        taxes.setCreator(user.getId());
        taxes.setCreateDate(new Date());
        taxes.setIsdeleted(Constants.ZERO);
        taxes.setStatus(Constants.ZERO);
        taxes.setCompanyId(company.getId());
        taxes.setPrice(directInvoicingDTO.getInvoicingMoney());
        taxes.setType(directInvoicingDTO.getType());
        taxes.setTaxCode(company.getTaxCode());
        taxes.setTaxAccount(company.getTaxAccount());
        taxes.setTaxAddr(company.getTaxAddr());
        taxes.setAddr(directInvoicingDTO.getAddress());
        taxes.setCompanyName(company.getName());
        taxes.setApplyType(Constants.ONE);
        taxes.setSolutionId(solutions.getId());
        taxes.setInsuranceApplyId(queryInsuranceApply.getId());
        taxesMapper.insert(taxes);
        List<TaxesInvoicingVO>  taxesInvoicingVOList = new ArrayList<>();
        this.dealTaxesData(queryInsuranceApply.getId(),taxesInvoicingVOList);
        List<TaxDetial> taxDetailList = new ArrayList<>();
        for (TaxesInvoicingVO taxesInvoicingVO:taxesInvoicingVOList) {
            if(Objects.isNull(taxesInvoicingVO)
                    || Objects.isNull(taxesInvoicingVO.getAmount())
                    || Objects.isNull(taxesInvoicingVO.getId())
                    || Objects.isNull(taxesInvoicingVO.getType())
            ){
                throw new BusinessException(ResponseStatus.BAD_REQUEST);
            }
            TaxDetial taxDetial = new TaxDetial();
            taxDetial.setCreator(user.getId());
            taxDetial.setCreateDate(new Date());
            taxDetial.setIsdeleted(Constants.ZERO);
            taxDetial.setTaxId(taxes.getId());
            taxDetial.setTotalFee(taxesInvoicingVO.getAmount());
            taxDetial.setFee(taxesInvoicingVO.getAmount());
            if(taxesInvoicingVO.getType().equals(Constants.ZERO)){
                taxDetial.setInsuranceApplyId(taxesInvoicingVO.getId());
                taxDetial.setType(taxesInvoicingVO.getType());
            }else if(taxesInvoicingVO.getType().equals(Constants.ONE)){
                taxDetial.setApplyChangeId(taxesInvoicingVO.getId());
                taxDetial.setType(taxesInvoicingVO.getType());
            }
            taxDetailList.add(taxDetial);
        }
        List<Integer> chIdList = directInvoicingDTO.getInvoicingDetailDTOList();
        if(CollectionUtils.isNotEmpty(chIdList)){
            for (Integer id:chIdList) {
                Taxes chTaxes = taxesMapper.selectById(id);
                if(Objects.isNull(chTaxes)){
                    throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"未查询到选择冲红数据");
                }
                if(!(chTaxes.getStatus().equals(Constants.ZERO)||chTaxes.getStatus().equals(Constants.ONE))){
                    throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"冲红数据状态错误");
                }
                TaxDetial taxDetial = new TaxDetial();
                taxDetial.setCreator(user.getId());
                taxDetial.setCreateDate(new Date());
                taxDetial.setIsdeleted(Constants.ZERO);
                taxDetial.setTaxId(taxes.getId());
                taxDetial.setTotalFee(chTaxes.getPrice());
                taxDetial.setFee(chTaxes.getPrice());
                taxDetial.setDelTaxId(chTaxes.getId());
                taxDetial.setType(Constants.TWO);
                taxDetailList.add(taxDetial);
            }
        }
        if(CollectionUtils.isNotEmpty(taxDetailList)){
            taxDetailJoinMapper.insertBatchSomeColumn(taxDetailList);
        }else{
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"无可开票数据,操作失败");
        }
//        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);
    }
}