From 8a7797cf8ba37fa1beec625209a6964a3668b994 Mon Sep 17 00:00:00 2001 From: k94314517 <8417338+k94314517@user.noreply.gitee.com> Date: 星期二, 23 一月 2024 18:18:33 +0800 Subject: [PATCH] 111 --- server/service/src/main/java/com/doumee/service/business/impl/TaxesServiceImpl.java | 403 ++++++++++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 325 insertions(+), 78 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 aa73613..27ae00a 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 @@ -1,36 +1,176 @@ package com.doumee.service.business.impl; +import com.doumee.biz.system.SystemDictDataBiz; +import com.doumee.core.constants.ResponseStatus; +import com.doumee.core.exception.BusinessException; +import com.doumee.core.model.LoginUserInfo; import com.doumee.core.model.PageData; 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.TaxDetialMapper; import com.doumee.dao.business.TaxesMapper; -import com.doumee.dao.business.model.Taxes; +import com.doumee.dao.business.dto.EntrustInvoicingDTO; +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.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.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.util.ArrayList; +import java.util.Date; import java.util.List; +import java.util.Objects; /** * 鍙戠エ淇℃伅琛⊿ervice瀹炵幇 * @author 姹熻箘韫� - * @date 2024/01/15 15:07 + * @date 2024/01/16 10:03 */ @Service public class TaxesServiceImpl implements TaxesService { @Autowired private TaxesMapper taxesMapper; + @Autowired + private TaxDetialMapper taxDetialMapper; + @Autowired + private TaxesJoinMapper taxesJoinMapper; + @Autowired + private TaxDetailJoinMapper taxDetailJoinMapper; + @Autowired + private SystemDictDataBiz systemDictDataBiz; + @Autowired + private CompanyMapper companyMapper; + @Autowired + private InsuranceApplyJoinMapper insuranceApplyJoinMapper; @Override public Integer create(Taxes taxes) { taxesMapper.insert(taxes); return taxes.getId(); + } + + /** + * 閫�鍥炵敵璇� + * @param taxes + */ + @Override + @Transactional + public void backApply(Taxes taxes) { + if(taxes.getId() == null ){ + throw new BusinessException(ResponseStatus.BAD_REQUEST); + } + Taxes model = taxesMapper.selectById(taxes.getId()); + if(model == null ||Constants.equalsInteger(model.getIsdeleted(),Constants.ONE)){ + throw new BusinessException(ResponseStatus.DATA_EMPTY); + } + if(!Constants.equalsInteger(taxes.getStatus(), Constants.ZERO)){ + throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"褰撳墠鍙戠エ鐘舵�佷笉鏀寔鎾ゅ洖鐢宠锛�"); + } + LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); + Taxes update = new Taxes(); + update.setId(taxes.getId()); + update.setImgurl(taxes.getImgurl()); + update.setEditDate(new Date()); + update.setStatus(Constants.TWO); + update.setEditor(user.getId()); + update.setCancelUserId(user.getId()); + update.setCancelDate(update.getEditDate()); + update.setCancelInfo(taxes.getCancelInfo()); + taxesMapper.updateById(update); + + List<TaxDetial> detialList = getDetailListById(taxes.getId()); + if(detialList!=null && detialList.size()>0){ + for(TaxDetial detial :detialList){ + //绫诲瀷 0淇濆崟鐢宠 1鍔犲噺淇濈敵璇� 2鍐茬孩鍗� + if(Constants.equalsInteger(detial.getType(),Constants.TWO)){ + //濡傛灉鏄啿绾㈠崟锛岃繕鍘熻鐢宠涓哄凡寮�绁� + Taxes tu = new Taxes(); + tu.setId(detial.getDelTaxId()); + tu.setEditDate(new Date()); + tu.setStatus(Constants.ONE); + tu.setEditor(user.getId()); + taxesMapper.updateById(tu); + } + } + } + } + + private List<TaxDetial> getDetailListById(Integer id) { + List<TaxDetial> detialList = taxDetialMapper.selectList(new QueryWrapper<TaxDetial>().lambda().eq(TaxDetial::getTaxId,id).eq(TaxDetial::getIsdeleted,Constants.ZERO)); + return detialList; + } + private List<TaxDetial> getJoinDetailListById(Integer id) { + MPJLambdaWrapper<TaxDetial> queryWrapper = new MPJLambdaWrapper<>(); + queryWrapper.selectAll(TaxDetial.class); + 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" + + "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" + + "(CASE t.type \n" + + "WHEN 1 THEN (select count(1) from apply_chagne_detail c where c.APPLY_CHANGE_ID=t.INSURANCE_APPLY_ID) \n" + + "ELSE 0 \n" + + "END) as applyChangeAddNum,\n" + + "(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"); + queryWrapper.leftJoin(InsuranceApply.class,InsuranceApply::getId,TaxDetial::getInsuranceApplyId); + queryWrapper.leftJoin(ApplyChange.class,ApplyChange::getId,TaxDetial::getApplyChangeId); + queryWrapper.leftJoin(Taxes.class,Taxes::getId,TaxDetial::getDelTaxId); + List<TaxDetial> detialList = taxDetailJoinMapper.selectJoinList(TaxDetial.class,queryWrapper.orderByAsc(TaxDetial::getType)); + return detialList; + } + + + /** + * 涓婁紶鍙戠エ鍑瘉 + * @param taxes + */ + @Override + public void doneApply(Taxes taxes) { + if(taxes.getId() == null + ||StringUtils.isBlank(taxes.getImgurl()) + ||StringUtils.isBlank(taxes.getDoneCode())){ + throw new BusinessException(ResponseStatus.BAD_REQUEST); + } + Taxes model = taxesMapper.selectById(taxes.getId()); + if(model == null ||Constants.equalsInteger(model.getIsdeleted(),Constants.ONE)){ + throw new BusinessException(ResponseStatus.DATA_EMPTY); + } + if(!Constants.equalsInteger(taxes.getStatus(), Constants.ZERO)){ + throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"褰撳墠鍙戠エ鐘舵�佷笉鏀寔涓婁紶鍙戠エ淇℃伅锛�"); + } + LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); + Taxes update = new Taxes(); + update.setId(taxes.getId()); + update.setImgurl(taxes.getImgurl()); + update.setEditDate(new Date()); + update.setStatus(Constants.ONE); + update.setEditor(user.getId()); + update.setDoneCode(taxes.getDoneCode()); + update.setDoneUserId(user.getId()); + update.setDoneDate(update.getEditDate()); + update.setImgurl(taxes.getImgurl()); + taxesMapper.updateById(update); } @Override @@ -69,7 +209,49 @@ @Override public Taxes findById(Integer id) { - return taxesMapper.selectById(id); + MPJLambdaWrapper<Taxes> queryWrapper = new MPJLambdaWrapper<>(); + queryWrapper.selectAll(Taxes.class); + queryWrapper.selectAs(Solutions::getName,Taxes::getSolutionName); + queryWrapper.leftJoin(Solutions.class,Solutions::getId,Taxes::getSolutionId); + Taxes model =taxesJoinMapper.selectById(id); + if(model==null || !Constants.equalsInteger(model.getIsdeleted(),Constants.ZERO)){ + throw new BusinessException(ResponseStatus.DATA_EMPTY); + } + if(Constants.equalsInteger(model.getType(),Constants.ZERO)){ + List<TaxDetial> detialList = getDetailsApplysListById(id); + model.setApplyList(detialList); + }else{ + //鏌ヨ鏄庣粏鍒楄〃 + List<TaxDetial> detialList = getJoinDetailListById(id); + List<TaxDetial> applyList = new ArrayList<>();//鎶曚繚鍜屽姞鍑忎繚 + List<TaxDetial> delList = new ArrayList<>();//鍐茬孩鍗� + if(detialList!=null){ + for(TaxDetial d :delList){ + 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)){ + applyList.add(d); + }else if(Constants.equalsInteger(d.getType(),Constants.TWO)){ + delList.add(d); + } + } + } + model.setApplyList(applyList); + model.setDelTaxList(delList); + } + return model; + } + + private List<TaxDetial> getDetailsApplysListById(Integer id) { + MPJLambdaWrapper<TaxDetial> queryWrapper = new MPJLambdaWrapper<>(); + queryWrapper.selectAll(TaxDetial.class); + queryWrapper.selectAs(InsuranceApply::getCode,TaxDetial::getApplyCode); + queryWrapper.selectAs(Solutions::getName,TaxDetial::getSolutionName); + queryWrapper.leftJoin(InsuranceApply.class,InsuranceApply::getId,TaxDetial::getInsuranceApplyId); + queryWrapper.leftJoin(Solutions.class,Solutions::getId,InsuranceApply::getSolutionId); + List<TaxDetial> detialList = taxDetailJoinMapper.selectJoinList(TaxDetial.class,queryWrapper.orderByAsc(TaxDetial::getType)); + return detialList; } @Override @@ -86,86 +268,44 @@ @Override public PageData<Taxes> findPage(PageWrap<Taxes> pageWrap) { + LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); IPage<Taxes> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity()); - QueryWrapper<Taxes> queryWrapper = new QueryWrapper<>(); + MPJLambdaWrapper<Taxes> queryWrapper = new MPJLambdaWrapper<>(); + queryWrapper.selectAll(Taxes.class); + queryWrapper.selectAs(SystemUser::getRealname,Taxes::getCreatorName); + queryWrapper.leftJoin(SystemUser.class,SystemUser::getId,Taxes::getCreator); Utils.MP.blankToNull(pageWrap.getModel()); - if (pageWrap.getModel().getId() != null) { - queryWrapper.lambda().eq(Taxes::getId, pageWrap.getModel().getId()); + queryWrapper.eq(Taxes::getIsdeleted, Constants.ZERO); + if(user.getCompanyIdList() == null || user.getCompanyIdList().size() == 0){ + 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.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()); + queryWrapper.eq(pageWrap.getModel().getStatus() != null,Taxes::getStatus, pageWrap.getModel().getStatus()); + queryWrapper.eq(pageWrap.getModel().getCompanyId() != null,Taxes::getCompanyId, pageWrap.getModel().getCompanyId()); + queryWrapper.eq(pageWrap.getModel().getType() != null,Taxes::getType, pageWrap.getModel().getType()); + queryWrapper.eq(pageWrap.getModel().getTaxCode() != null,Taxes::getTaxCode, pageWrap.getModel().getTaxCode()); + queryWrapper.eq(pageWrap.getModel().getTaxAccount() != null,Taxes::getTaxAccount, pageWrap.getModel().getTaxAccount()); + queryWrapper.eq(pageWrap.getModel().getTaxAddr() != null,Taxes::getTaxAddr, pageWrap.getModel().getTaxAddr()); + queryWrapper.eq(pageWrap.getModel().getAddr() !=null,Taxes::getAddr, pageWrap.getModel().getAddr()); + queryWrapper.like(pageWrap.getModel().getCompanyName() != null,Taxes::getCompanyName, pageWrap.getModel().getCompanyName()); + queryWrapper.eq(pageWrap.getModel().getApplyType() != null,Taxes::getApplyType, pageWrap.getModel().getApplyType()); + queryWrapper.orderByDesc(Taxes::getCreateDate); } - if (pageWrap.getModel().getCreator() != null) { - queryWrapper.lambda().eq(Taxes::getCreator, pageWrap.getModel().getCreator()); - } - if (pageWrap.getModel().getCreateDate() != null) { - queryWrapper.lambda().ge(Taxes::getCreateDate, Utils.Date.getStart(pageWrap.getModel().getCreateDate())); - queryWrapper.lambda().le(Taxes::getCreateDate, Utils.Date.getEnd(pageWrap.getModel().getCreateDate())); - } - if (pageWrap.getModel().getEditor() != null) { - queryWrapper.lambda().eq(Taxes::getEditor, pageWrap.getModel().getEditor()); - } - if (pageWrap.getModel().getEditDate() != null) { - queryWrapper.lambda().ge(Taxes::getEditDate, Utils.Date.getStart(pageWrap.getModel().getEditDate())); - queryWrapper.lambda().le(Taxes::getEditDate, Utils.Date.getEnd(pageWrap.getModel().getEditDate())); - } - if (pageWrap.getModel().getTaxBank() != null) { - queryWrapper.lambda().eq(Taxes::getTaxBank, pageWrap.getModel().getTaxBank()); - } - if (pageWrap.getModel().getIsdeleted() != null) { - queryWrapper.lambda().eq(Taxes::getIsdeleted, pageWrap.getModel().getIsdeleted()); - } - if (pageWrap.getModel().getRemark() != null) { - queryWrapper.lambda().eq(Taxes::getRemark, pageWrap.getModel().getRemark()); - } - if (pageWrap.getModel().getStatus() != null) { - queryWrapper.lambda().eq(Taxes::getStatus, pageWrap.getModel().getStatus()); - } - if (pageWrap.getModel().getCompanyId() != null) { - queryWrapper.lambda().eq(Taxes::getCompanyId, pageWrap.getModel().getCompanyId()); - } - if (pageWrap.getModel().getPrice() != null) { - queryWrapper.lambda().eq(Taxes::getPrice, pageWrap.getModel().getPrice()); - } - if (pageWrap.getModel().getType() != null) { - queryWrapper.lambda().eq(Taxes::getType, pageWrap.getModel().getType()); - } - if (pageWrap.getModel().getTaxCode() != null) { - queryWrapper.lambda().eq(Taxes::getTaxCode, pageWrap.getModel().getTaxCode()); - } - if (pageWrap.getModel().getTaxAccount() != null) { - queryWrapper.lambda().eq(Taxes::getTaxAccount, pageWrap.getModel().getTaxAccount()); - } - if (pageWrap.getModel().getTaxAddr() != null) { - queryWrapper.lambda().eq(Taxes::getTaxAddr, pageWrap.getModel().getTaxAddr()); - } - if (pageWrap.getModel().getAddr() != null) { - queryWrapper.lambda().eq(Taxes::getAddr, pageWrap.getModel().getAddr()); - } - if (pageWrap.getModel().getCompanyName() != null) { - queryWrapper.lambda().eq(Taxes::getCompanyName, pageWrap.getModel().getCompanyName()); - } - if (pageWrap.getModel().getImgurl() != null) { - queryWrapper.lambda().eq(Taxes::getImgurl, pageWrap.getModel().getImgurl()); - } - if (pageWrap.getModel().getApplyType() != null) { - queryWrapper.lambda().eq(Taxes::getApplyType, pageWrap.getModel().getApplyType()); - } - if (pageWrap.getModel().getCancelDate() != null) { - queryWrapper.lambda().ge(Taxes::getCancelDate, Utils.Date.getStart(pageWrap.getModel().getCancelDate())); - queryWrapper.lambda().le(Taxes::getCancelDate, Utils.Date.getEnd(pageWrap.getModel().getCancelDate())); - } - if (pageWrap.getModel().getCancelInfo() != null) { - queryWrapper.lambda().eq(Taxes::getCancelInfo, pageWrap.getModel().getCancelInfo()); - } - if (pageWrap.getModel().getCancelUserId() != null) { - queryWrapper.lambda().eq(Taxes::getCancelUserId, pageWrap.getModel().getCancelUserId()); - } - for(PageWrap.SortData sortData: pageWrap.getSorts()) { - if (sortData.getDirection().equalsIgnoreCase(PageWrap.DESC)) { - queryWrapper.orderByDesc(sortData.getProperty()); - } else { - queryWrapper.orderByAsc(sortData.getProperty()); + PageData<Taxes> result =PageData.from(taxesJoinMapper.selectJoinPage(page,Taxes.class, queryWrapper)); + if(result!=null && result.getRecords()!=null){ + String path =systemDictDataBiz.queryByCode(Constants.OSS,Constants.RESOURCE_PATH).getCode()+systemDictDataBiz.queryByCode(Constants.OSS,Constants.TAXES_FILE).getCode(); + for(Taxes t : result.getRecords()){ + if(StringUtils.isNotBlank(t.getImgurl())){ + t.setImgurlFull(path + t.getImgurl()); + } } } - return PageData.from(taxesMapper.selectPage(page, queryWrapper)); + return result; } @Override @@ -173,4 +313,111 @@ QueryWrapper<Taxes> wrapper = new QueryWrapper<>(taxes); return taxesMapper.selectCount(wrapper); } + + + @Override + public PageData<Taxes> findPageForCompany(PageWrap<Taxes> pageWrap) { + LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); + IPage<Taxes> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity()); + MPJLambdaWrapper<Taxes> queryWrapper = new MPJLambdaWrapper<>(); + queryWrapper.selectAll(Taxes.class); + queryWrapper.selectAs(SystemUser::getRealname,Taxes::getCreatorName); + queryWrapper.leftJoin(SystemUser.class,SystemUser::getId,Taxes::getCreator); + Utils.MP.blankToNull(pageWrap.getModel()); + queryWrapper.eq(Taxes::getIsdeleted, Constants.ZERO); + Taxes queryModel = pageWrap.getModel(); + if(!user.getType().equals(Constants.ONE)){ + 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.eq(!Objects.isNull(queryModel.getInsuranceApplyId()),Taxes::getInsuranceApplyId,queryModel.getInsuranceApplyId()); + queryWrapper.eq(!Objects.isNull(queryModel.getStatus()),Taxes::getStatus,queryModel.getStatus()); + } + + queryWrapper.orderByAsc(Taxes::getCreateDate); + PageData<Taxes> result =PageData.from(taxesJoinMapper.selectJoinPage(page,Taxes.class, queryWrapper)); + if(result!=null && result.getRecords()!=null){ + String path =systemDictDataBiz.queryByCode(Constants.OSS,Constants.RESOURCE_PATH).getCode()+systemDictDataBiz.queryByCode(Constants.OSS,Constants.TAXES_FILE).getCode(); + for(Taxes t : result.getRecords()){ + if(StringUtils.isNotBlank(t.getImgurl())){ + t.setImgurlFull(path + t.getImgurl()); + } + } + } + return result; + } + + + + + + @Override + @Transactional(rollbackFor = {BusinessException.class,Exception.class}) + public void entrustInvoicing(EntrustInvoicingDTO entrustInvoicingDTO){ + LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); + if(Objects.isNull(entrustInvoicingDTO) + || Objects.isNull(entrustInvoicingDTO.getInvoicingMoney()) + || Objects.isNull(entrustInvoicingDTO.getType()) + || Objects.isNull(entrustInvoicingDTO.getTaxDetialList()) + || StringUtils.isNotBlank(entrustInvoicingDTO.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(),"鏈煡璇㈠埌浼佷笟淇℃伅"); + } + 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(entrustInvoicingDTO.getInvoicingMoney()); + taxes.setType(entrustInvoicingDTO.getType()); + taxes.setTaxCode(company.getTaxCode()); + taxes.setTaxAccount(company.getTaxAccount()); + taxes.setTaxAddr(company.getTaxAddr()); + taxes.setAddr(entrustInvoicingDTO.getAddress()); + taxes.setCompanyName(company.getName()); + taxes.setApplyType(Constants.ZERO); + taxesMapper.insert(taxes); + + List<TaxDetial> taxDetialList = entrustInvoicingDTO.getTaxDetialList(); + for (TaxDetial taxDetial:taxDetialList) { + if(Objects.isNull(taxDetial) + || Objects.isNull(taxDetial.getInsuranceApplyId()) + || Objects.isNull(taxDetial.getFee()) + ){ + throw new BusinessException(ResponseStatus.BAD_REQUEST); + } + //鏌ヨ姣忎釜淇濆崟涓嬪彲浠ユ姇淇濈殑閲戦 + InsuranceApply insuranceApply = insuranceApplyJoinMapper.selectJoinOne(InsuranceApply.class,new MPJLambdaWrapper<InsuranceApply>() + .selectAll(InsuranceApply.class) + .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 ") + .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())+"銆�"); + } + taxDetial.setCreator(user.getId()); + taxDetial.setCreateDate(new Date()); + taxDetial.setIsdeleted(Constants.ZERO); + taxDetial.setTaxId(taxes.getId()); + taxDetial.setTotalFee(insuranceApply.getCurrentFee()); + taxDetial.setType(Constants.ZERO); + } + taxDetailJoinMapper.insertBatchSomeColumn(taxDetialList); + } + + + } -- Gitblit v1.9.3