|  | @@ -3,6 +3,7 @@ package com.ruoyi.finance.service.impl;
 | 
	
		
			
				|  |  |  import com.alibaba.fastjson.JSONArray;
 | 
	
		
			
				|  |  |  import com.alibaba.fastjson.JSONObject;
 | 
	
		
			
				|  |  |  import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 | 
	
		
			
				|  |  | +import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 | 
	
		
			
				|  |  |  import com.ruoyi.approvalFlow.domain.AuditItems;
 | 
	
		
			
				|  |  |  import com.ruoyi.approvalFlow.service.impl.AuditItemsAbout;
 | 
	
		
			
				|  |  |  import com.ruoyi.approvalFlow.service.impl.AuditItemsServiceImpl;
 | 
	
	
		
			
				|  | @@ -75,6 +76,7 @@ import java.io.File;
 | 
	
		
			
				|  |  |  import java.io.FileOutputStream;
 | 
	
		
			
				|  |  |  import java.io.OutputStream;
 | 
	
		
			
				|  |  |  import java.math.BigDecimal;
 | 
	
		
			
				|  |  | +import java.text.ParseException;
 | 
	
		
			
				|  |  |  import java.text.SimpleDateFormat;
 | 
	
		
			
				|  |  |  import java.util.*;
 | 
	
		
			
				|  |  |  import java.util.stream.Collectors;
 | 
	
	
		
			
				|  | @@ -727,20 +729,35 @@ public class TFeeServiceImpl implements ITFeeService {
 | 
	
		
			
				|  |  |              tWareHouseFees.setTimeExamine(null);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          List<FeeVO> list = tFeeMapper.selectFinancialLedgerList(tWareHouseFees);
 | 
	
		
			
				|  |  | -        for (FeeVO feeVO:list) {
 | 
	
		
			
				|  |  | +        for (int i = 0; i < list.size(); i++) {
 | 
	
		
			
				|  |  |              FeeDTO feeDTO = new FeeDTO();
 | 
	
		
			
				|  |  |              feeDTO.setFDc(tWareHouseFees.getfDc());
 | 
	
		
			
				|  |  | -            feeDTO.setFCorpId(feeVO.getfCorpid());
 | 
	
		
			
				|  |  | -            feeDTO.setFAuditList(tWareHouseFees.getTimeExamine());
 | 
	
		
			
				|  |  | -            feeDTO.setFBstimeExamine(tWareHouseFees.getfBstimeExamine());
 | 
	
		
			
				|  |  | +            feeDTO.setFCorpId(list.get(i).getfCorpid());
 | 
	
		
			
				|  |  | +            BigDecimal amount = new BigDecimal("0.00");
 | 
	
		
			
				|  |  | +            BigDecimal stlamount = new BigDecimal("0.00");
 | 
	
		
			
				|  |  | +            if (ObjectUtils.isNotNull(list.get(i).getReviewDate())) {
 | 
	
		
			
				|  |  | +                List<String> list1 = new ArrayList<>();
 | 
	
		
			
				|  |  | +                list1.add(list.get(i).getReviewDate());
 | 
	
		
			
				|  |  | +                list1.add(list.get(i).getReviewDate());
 | 
	
		
			
				|  |  | +                if (tWareHouseFees.getSwitchSection() == 1) {
 | 
	
		
			
				|  |  | +                    feeDTO.setFAuditList(list1);
 | 
	
		
			
				|  |  | +                } else {
 | 
	
		
			
				|  |  | +                    feeDTO.setFBstimeExamine(list1);
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            } else {
 | 
	
		
			
				|  |  | +                feeDTO.setFAuditList(null);
 | 
	
		
			
				|  |  | +                feeDTO.setFBstimeExamine(null);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |              List<FeeVO> feeVOList = tFeeMapper.selectFinancialLedgerDetails(feeDTO);
 | 
	
		
			
				|  |  |              // 应收费用
 | 
	
		
			
				|  |  | -            BigDecimal amount = feeVOList.stream().map(FeeVO::getFAmount).reduce(BigDecimal::add).orElse(BigDecimal.ZERO);
 | 
	
		
			
				|  |  | +            amount = amount.add(feeVOList.stream().map(FeeVO::getFAmount).reduce(BigDecimal::add).orElse(BigDecimal.ZERO));
 | 
	
		
			
				|  |  |              // 已收费用
 | 
	
		
			
				|  |  | -            BigDecimal stlamount = feeVOList.stream().map(FeeVO::getFStlamount).reduce(BigDecimal::add).orElse(BigDecimal.ZERO);
 | 
	
		
			
				|  |  | -            feeVO.setFAmount(amount);
 | 
	
		
			
				|  |  | -            feeVO.setNnfinished(amount.subtract(stlamount));
 | 
	
		
			
				|  |  | -            feeVO.setFStlamount(stlamount);
 | 
	
		
			
				|  |  | +            stlamount = stlamount.add(feeVOList.stream().map(FeeVO::getFStlamount).reduce(BigDecimal::add).orElse(BigDecimal.ZERO));
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            list.get(i).setFAmount(amount);
 | 
	
		
			
				|  |  | +            list.get(i).setNnfinished(amount.subtract(stlamount));
 | 
	
		
			
				|  |  | +            list.get(i).setFStlamount(stlamount);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          return list;
 | 
	
		
			
				|  |  |      }
 | 
	
	
		
			
				|  | @@ -1901,7 +1918,7 @@ public class TFeeServiceImpl implements ITFeeService {
 | 
	
		
			
				|  |  |              map.put("message", "费用明细数据有误,请找管理员");
 | 
	
		
			
				|  |  |          } else if ("DZ".equals(type) || "KHDZ".equals(type)) {
 | 
	
		
			
				|  |  |              BigDecimal subtract = amount.subtract(accamount);
 | 
	
		
			
				|  |  | -            if(subtract.compareTo(new BigDecimal(0)) == 0){
 | 
	
		
			
				|  |  | +            if (subtract.compareTo(new BigDecimal(0)) == 0) {
 | 
	
		
			
				|  |  |                  if (subtract.compareTo(money) <= 0) {
 | 
	
		
			
				|  |  |                      flag = false;
 | 
	
		
			
				|  |  |                      map.put("message", "提单号" + bills.getfMblno() + "的" + tFees.getfName() + "对账金额超过可对账金额,当前可对账金额为" + subtract + "元");
 |