|
|
@@ -8,14 +8,19 @@ import org.springblade.core.tool.api.R;
|
|
|
import org.springblade.los.Util.IDeptUtils;
|
|
|
import org.springblade.los.app.service.IndexService;
|
|
|
import org.springblade.los.business.aea.mapper.AeaBillsMapper;
|
|
|
+import org.springblade.los.business.amends.entity.Amends;
|
|
|
import org.springblade.los.business.amends.mapper.AmendsMapper;
|
|
|
import org.springblade.los.business.customsDeclaration.mapper.CustomsDeclarationMapper;
|
|
|
import org.springblade.los.business.sea.entity.Bills;
|
|
|
import org.springblade.los.business.sea.mapper.BillsMapper;
|
|
|
+import org.springblade.los.finance.fee.entity.FeeCenter;
|
|
|
+import org.springblade.los.finance.fee.mapper.FeeCenterMapper;
|
|
|
import org.springblade.los.finance.fee.mapper.FinAccBillsMapper;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* @author :jixinyuan
|
|
|
@@ -30,18 +35,37 @@ public class IndexServiceImpl implements IndexService {
|
|
|
private final CustomsDeclarationMapper customsDeclarationMapper;
|
|
|
private final AmendsMapper amendsMapper;
|
|
|
private final FinAccBillsMapper finAccBillsMapper;
|
|
|
+ private final FeeCenterMapper feeCenterMapper;
|
|
|
private final IDeptUtils deptUtils;
|
|
|
|
|
|
@Override
|
|
|
public R profit(String type, String startDate, String endDate) {
|
|
|
|
|
|
+ BigDecimal amountD = new BigDecimal("0.00");
|
|
|
+ BigDecimal amountC = new BigDecimal("0.00");
|
|
|
List<Bills> billsList = billsMapper.selectList(new LambdaQueryWrapper<Bills>()
|
|
|
.eq(Bills::getTenantId, AuthUtil.getTenantId())
|
|
|
.eq(Bills::getIsDeleted, 0)
|
|
|
- .apply("find_in_set(bill_type,'DD,MM')")
|
|
|
- .eq(ObjectUtils.isNotNull(type),Bills::getBranchId, type)
|
|
|
+ .apply("find_in_set(bill_type,'DD,MM')")
|
|
|
+ .eq(ObjectUtils.isNotNull(type), Bills::getBranchId, type)
|
|
|
.ge(ObjectUtils.isNotNull(startDate), Bills::getBillDate, startDate)
|
|
|
.le(ObjectUtils.isNotNull(endDate), Bills::getBillDate, endDate));
|
|
|
+ amountD = billsList.stream().map(Bills::getAmountDrLoc).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ amountC = billsList.stream().map(Bills::getAmountCrLoc).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ List<Amends> amendsList = amendsMapper.selectList(new LambdaQueryWrapper<Amends>()
|
|
|
+ .eq(Amends::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(Amends::getIsDeleted, 0)
|
|
|
+ .apply("find_in_set(business_type,'ASE,ASI')")
|
|
|
+ .eq(ObjectUtils.isNotNull(type), Amends::getBranchId, type)
|
|
|
+ .ge(ObjectUtils.isNotNull(startDate), Amends::getBillDate, startDate)
|
|
|
+ .le(ObjectUtils.isNotNull(endDate), Amends::getBillDate, endDate));
|
|
|
+ if (!amendsList.isEmpty()) {
|
|
|
+ List<Long> ids = amendsList.stream().map(Amends::getId).collect(Collectors.toList());
|
|
|
+ List<FeeCenter> feeCenterList = feeCenterMapper.selectList(new LambdaQueryWrapper<FeeCenter>()
|
|
|
+ .eq(FeeCenter::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(FeeCenter::getIsDeleted, 0)
|
|
|
+ .in(FeeCenter::getId, ids));
|
|
|
+ }
|
|
|
|
|
|
return null;
|
|
|
}
|