liusheng
2023-12-04 926b0e68e108d0866d79c1a366e3d14d1cebac4b
ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceFundServiceImpl.java
@@ -1,6 +1,7 @@
package com.ruoyi.project.service.impl;
import java.io.File;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -10,6 +11,7 @@
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.annotation.NotRepeatCommit;
import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.exception.base.BaseException;
import com.ruoyi.common.utils.ChineseUtils;
@@ -137,8 +139,18 @@
    }
    @Override
    @Transactional
    @Transactional(rollbackFor = Exception.class)
    public Boolean addFundSharedInfo(Long id) {
        log.info("fund表的id:{}", id);
        //判断一下,share表是否已经存在了
        Map<String, Object> map = new HashMap<>();
        map.put("serfunid", id);
        map.put("del_flag", 0);
        List<ServiceFundShared> serviceFundSharedList = serviceFundSharedMapper.selectByMap(map);
        if (!CollectionUtils.isEmpty(serviceFundSharedList)) {
            return true;
        }
        ServiceFund serviceFund = serviceFundMapper.selectById(id);
        ServiceFundShared serviceFundShared = DtoConversionUtils.sourceToTarget(serviceFund, ServiceFundShared.class);
        serviceFundShared.setSerfunid(serviceFundShared.getId());
@@ -668,7 +680,6 @@
    @Override
    public int countItem(Long infoid, Long itemid) {
        List<ServiceFund> serviceFunds = serviceFundMapper.getInfoByInfoId(infoid);
        int count = 0;
        for (ServiceFund s : serviceFunds) {
            long fundid = s.getId();
@@ -690,14 +701,11 @@
        if (CollectionUtils.isEmpty(serviceFunddetails)) {
            throw new BaseException("serviceFunddetails为空喽");
        }
        BigDecimal bigDecimal = new BigDecimal(0.0);
        // 保存详情数据
        for (ServiceFunddetailVO serviceFunddetailVO : serviceFunddetails) {
            if (StringUtils.isEmpty(serviceFunddetailVO.getIdcardno())) {
                throw new BaseException("请检查身份证号,身份证号为空了,姓名:" + serviceFunddetailVO.getBeneficiaryname());
            }
            if (StringUtils.isEmpty(serviceFunddetailVO.getTitle()) || ChineseUtils.isChinese(serviceFunddetailVO.getTitle())) {
                throw new BaseException("请检查职称是否为空(或不是中文),姓名:" + serviceFunddetailVO.getBeneficiaryname() + "  职称:" + serviceFunddetailVO.getTitle());
            }
            if (StringUtils.isEmpty(serviceFunddetailVO.getBankcardno())) {
                throw new BaseException("请检查银行卡号是否为空,姓名:" + serviceFunddetailVO.getBeneficiaryname());
            }
@@ -705,9 +713,13 @@
            //將附件转成json
            if (!CollectionUtils.isEmpty(serviceFunddetailVO.getAnnexfilesList())) {
                serviceFunddetailVO.setAnnexfiles(JSON.toJSONString(serviceFunddetailVO.getAnnexfilesList()));
            } else {
                serviceFunddetailVO.setAnnexfiles(null);
            }
            if (!CollectionUtils.isEmpty(serviceFunddetailVO.getInvoicefilesList())) {
                serviceFunddetailVO.setInvoicefiles(JSON.toJSONString(serviceFunddetailVO.getInvoicefilesList()));
            } else {
                serviceFunddetailVO.setInvoicefiles(null);
            }
            ServiceFunddetail serviceFunddetail = DtoConversionUtils.sourceToTarget(serviceFunddetailVO, ServiceFunddetail.class);
@@ -716,8 +728,13 @@
            } else {
                serviceFunddetailService.updateById(serviceFunddetail);
            }
        }
            bigDecimal = bigDecimal.add(BigDecimal.valueOf(serviceFunddetailVO.getAmount()));
        }
        serviceFundVO.setPretaxcost(bigDecimal.doubleValue());
        serviceFundMapper.updateById(serviceFundVO);
        return id;
    }
@@ -759,6 +776,9 @@
    @Override
    public Map<String, List<ServiceFunddetailExcel>> totaltax(TotalTaxVO totalTaxVO) {
        if (CollectionUtils.isEmpty(totalTaxVO.getFundids())) {
            throw new BaseException("请勾选之后,再进行合计个税");
        }
        Map<String, List<ServiceFunddetailExcel>> map = new HashMap<>();
        if (totalTaxVO.getIsTaxAfter() == null) {