|
|
@@ -6,21 +6,31 @@ import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import org.springblade.core.secure.utils.AuthUtil;
|
|
|
import org.springblade.core.tool.api.R;
|
|
|
+import org.springblade.los.Util.IDeptUtils;
|
|
|
import org.springblade.los.basic.cur.service.IBCurrencyService;
|
|
|
+import org.springblade.los.business.aea.entity.AeaBills;
|
|
|
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.entity.CustomsDeclaration;
|
|
|
+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.business.sea.mapper.ContainersBillsMapper;
|
|
|
import org.springblade.los.finance.fee.entity.FeeCenter;
|
|
|
import org.springblade.los.finance.fee.mapper.FeeCenterMapper;
|
|
|
+import org.springblade.los.finance.invoices.entity.FinInvoices;
|
|
|
+import org.springblade.los.finance.invoices.mapper.FinInvoicesMapper;
|
|
|
+import org.springblade.los.finance.stl.entity.FinStlBills;
|
|
|
+import org.springblade.los.finance.stl.mapper.FinStlBillsMapper;
|
|
|
import org.springblade.los.statisticAnalysis.DecisionAnalysis;
|
|
|
import org.springblade.los.statisticAnalysis.FinanceProfit;
|
|
|
import org.springblade.los.statisticAnalysis.service.IStatisticAnalysisService;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.math.RoundingMode;
|
|
|
import java.text.DateFormat;
|
|
|
+import java.text.NumberFormat;
|
|
|
import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
@@ -36,10 +46,14 @@ public class StatisticAnalysisServiceImpl implements IStatisticAnalysisService {
|
|
|
|
|
|
private final BillsMapper billsMapper;
|
|
|
private final AeaBillsMapper aeaBillsMapper;
|
|
|
- private final ContainersBillsMapper containersBillsMapper;
|
|
|
+ private final CustomsDeclarationMapper customsDeclarationMapper;
|
|
|
private final AmendsMapper amendsMapper;
|
|
|
private final FeeCenterMapper feeCenterMapper;
|
|
|
private final IBCurrencyService bCurrencyService;
|
|
|
+ private final FinStlBillsMapper finStlBillsMapper;
|
|
|
+ private final FinInvoicesMapper finInvoicesMapper;
|
|
|
+
|
|
|
+ private final IDeptUtils deptUtils;
|
|
|
|
|
|
@Override
|
|
|
public R<IPage<DecisionAnalysis>> decisionAnalysis(DecisionAnalysis decisionAnalysis, IPage<DecisionAnalysis> page) {
|
|
|
@@ -73,7 +87,7 @@ public class StatisticAnalysisServiceImpl implements IStatisticAnalysisService {
|
|
|
}
|
|
|
} else if (financeProfit.getBillType().contains("BGSE") || financeProfit.getBillType().contains("BGSI")
|
|
|
|| financeProfit.getBillType().contains("BGAE") || financeProfit.getBillType().contains("BGAI")) {
|
|
|
- List<FinanceProfit> financeProfitListBg = containersBillsMapper.financeProfit(financeProfit);
|
|
|
+ List<FinanceProfit> financeProfitListBg = customsDeclarationMapper.financeProfit(financeProfit);
|
|
|
if (!financeProfitListBg.isEmpty()) {
|
|
|
financeProfitList.addAll(financeProfitListBg);
|
|
|
}
|
|
|
@@ -248,4 +262,265 @@ public class StatisticAnalysisServiceImpl implements IStatisticAnalysisService {
|
|
|
}
|
|
|
return R.data(page.setRecords(financeProfitList));
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public R<Map<String, Object>> businessSum(String dateStart, String dateEnd) {
|
|
|
+ long HYJK;
|
|
|
+ long HYCK;
|
|
|
+ long KYJK;
|
|
|
+ long KYCK;
|
|
|
+ LambdaQueryWrapper<Bills> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ lambdaQueryWrapper.eq(Bills::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(Bills::getIsDeleted, 0)
|
|
|
+ .lt(Bills::getBillDate, dateStart)
|
|
|
+ .gt(Bills::getBillDate, dateEnd);
|
|
|
+ if (!AuthUtil.getUserRole().contains("admin") && !AuthUtil.getUserRole().contains("财务")) {
|
|
|
+ lambdaQueryWrapper.apply("find_in_set(team_id,'" + AuthUtil.getPostId() + "')");
|
|
|
+ }
|
|
|
+ if (!AuthUtil.getUserRole().contains("admin")) {
|
|
|
+ lambdaQueryWrapper.eq(Bills::getBranchId, deptUtils.getDeptPid());
|
|
|
+ }
|
|
|
+ lambdaQueryWrapper.eq(Bills::getBusinessType, "SE");
|
|
|
+ HYCK = billsMapper.selectCount(lambdaQueryWrapper);
|
|
|
+ lambdaQueryWrapper.eq(Bills::getBusinessType, "SI");
|
|
|
+ HYJK = billsMapper.selectCount(lambdaQueryWrapper);
|
|
|
+
|
|
|
+ LambdaQueryWrapper<AeaBills> aeaBillsLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ aeaBillsLambdaQueryWrapper.eq(AeaBills::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(AeaBills::getIsDeleted, 0)
|
|
|
+ .lt(AeaBills::getBillDate, dateStart)
|
|
|
+ .gt(AeaBills::getBillDate, dateEnd);
|
|
|
+ if (!AuthUtil.getUserRole().contains("admin") && !AuthUtil.getUserRole().contains("财务")) {
|
|
|
+ aeaBillsLambdaQueryWrapper.apply("find_in_set(team_id,'" + AuthUtil.getPostId() + "')");
|
|
|
+ }
|
|
|
+ if (!AuthUtil.getUserRole().contains("admin")) {
|
|
|
+ aeaBillsLambdaQueryWrapper.eq(AeaBills::getBranchId, deptUtils.getDeptPid());
|
|
|
+ }
|
|
|
+ aeaBillsLambdaQueryWrapper.eq(AeaBills::getBusinessType, "AE");
|
|
|
+ KYCK = aeaBillsMapper.selectCount(aeaBillsLambdaQueryWrapper);
|
|
|
+ aeaBillsLambdaQueryWrapper.eq(AeaBills::getBusinessType, "AI");
|
|
|
+ KYJK = aeaBillsMapper.selectCount(aeaBillsLambdaQueryWrapper);
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ map.put("HYJK", HYJK);
|
|
|
+ map.put("HYCK", HYCK);
|
|
|
+ map.put("KYJK", KYJK);
|
|
|
+ map.put("KYCK", KYCK);
|
|
|
+ return R.data(map);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public R<Map<String, Object>> approvalData(String dateStart, String dateEnd) {
|
|
|
+ long HYJK;
|
|
|
+ long HYCK;
|
|
|
+ long KYJK;
|
|
|
+ long KYCK;
|
|
|
+ long SEA;
|
|
|
+ long SIA;
|
|
|
+ long AEA;
|
|
|
+ long AIA;
|
|
|
+ long BGSE;
|
|
|
+ long BGSI;
|
|
|
+ long BGAE;
|
|
|
+ long BGAI;
|
|
|
+ long FFSQ;
|
|
|
+ long FPSQ;
|
|
|
+ //海运进出口
|
|
|
+ LambdaQueryWrapper<Bills> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ lambdaQueryWrapper.eq(Bills::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(Bills::getIsDeleted, 0)
|
|
|
+ .lt(Bills::getBillDate, dateStart)
|
|
|
+ .gt(Bills::getBillDate, dateEnd)
|
|
|
+ .apply("find_in_set(status,'1,2')");
|
|
|
+ if (!AuthUtil.getUserRole().contains("admin") && !AuthUtil.getUserRole().contains("财务")) {
|
|
|
+ lambdaQueryWrapper.apply("find_in_set(team_id,'" + AuthUtil.getPostId() + "')");
|
|
|
+ }
|
|
|
+ if (!AuthUtil.getUserRole().contains("admin")) {
|
|
|
+ lambdaQueryWrapper.eq(Bills::getBranchId, deptUtils.getDeptPid());
|
|
|
+ }
|
|
|
+ lambdaQueryWrapper.eq(Bills::getBusinessType, "SE");
|
|
|
+ HYCK = billsMapper.selectCount(lambdaQueryWrapper);
|
|
|
+ lambdaQueryWrapper.eq(Bills::getBusinessType, "SI");
|
|
|
+ HYJK = billsMapper.selectCount(lambdaQueryWrapper);
|
|
|
+
|
|
|
+ //空运进出口
|
|
|
+ LambdaQueryWrapper<AeaBills> aeaBillsLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ aeaBillsLambdaQueryWrapper.eq(AeaBills::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(AeaBills::getIsDeleted, 0)
|
|
|
+ .lt(AeaBills::getBillDate, dateStart)
|
|
|
+ .gt(AeaBills::getBillDate, dateEnd)
|
|
|
+ .apply("find_in_set(status,'1,2')");
|
|
|
+ if (!AuthUtil.getUserRole().contains("admin") && !AuthUtil.getUserRole().contains("财务")) {
|
|
|
+ aeaBillsLambdaQueryWrapper.apply("find_in_set(team_id,'" + AuthUtil.getPostId() + "')");
|
|
|
+ }
|
|
|
+ if (!AuthUtil.getUserRole().contains("admin")) {
|
|
|
+ aeaBillsLambdaQueryWrapper.eq(AeaBills::getBranchId, deptUtils.getDeptPid());
|
|
|
+ }
|
|
|
+ aeaBillsLambdaQueryWrapper.eq(AeaBills::getBusinessType, "AE");
|
|
|
+ KYCK = aeaBillsMapper.selectCount(aeaBillsLambdaQueryWrapper);
|
|
|
+ aeaBillsLambdaQueryWrapper.eq(AeaBills::getBusinessType, "AI");
|
|
|
+ KYJK = aeaBillsMapper.selectCount(aeaBillsLambdaQueryWrapper);
|
|
|
+
|
|
|
+ //Amends 海、空运进出口
|
|
|
+ LambdaQueryWrapper<Amends> amendsLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ amendsLambdaQueryWrapper.eq(Amends::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(Amends::getIsDeleted, 0)
|
|
|
+ .lt(Amends::getBillDate, dateStart)
|
|
|
+ .gt(Amends::getBillDate, dateEnd)
|
|
|
+ .apply("find_in_set(status,'1,2')");
|
|
|
+ if (!AuthUtil.getUserRole().contains("admin") && !AuthUtil.getUserRole().contains("财务")) {
|
|
|
+ amendsLambdaQueryWrapper.apply("find_in_set(team_id,'" + AuthUtil.getPostId() + "')");
|
|
|
+ }
|
|
|
+ if (!AuthUtil.getUserRole().contains("admin")) {
|
|
|
+ amendsLambdaQueryWrapper.eq(Amends::getBranchId, deptUtils.getDeptPid());
|
|
|
+ }
|
|
|
+ amendsLambdaQueryWrapper.eq(Amends::getBusinessType, "SEA");
|
|
|
+ SEA = amendsMapper.selectCount(amendsLambdaQueryWrapper);
|
|
|
+ amendsLambdaQueryWrapper.eq(Amends::getBusinessType, "SIA");
|
|
|
+ SIA = amendsMapper.selectCount(amendsLambdaQueryWrapper);
|
|
|
+ amendsLambdaQueryWrapper.eq(Amends::getBusinessType, "AEA");
|
|
|
+ AEA = amendsMapper.selectCount(amendsLambdaQueryWrapper);
|
|
|
+ amendsLambdaQueryWrapper.eq(Amends::getBusinessType, "AIA");
|
|
|
+ AIA = amendsMapper.selectCount(amendsLambdaQueryWrapper);
|
|
|
+
|
|
|
+ //报关 海、空运进出口
|
|
|
+ LambdaQueryWrapper<CustomsDeclaration> customsDeclarationLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ customsDeclarationLambdaQueryWrapper.eq(CustomsDeclaration::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(CustomsDeclaration::getIsDeleted, 0)
|
|
|
+ .lt(CustomsDeclaration::getBillDate, dateStart)
|
|
|
+ .gt(CustomsDeclaration::getBillDate, dateEnd)
|
|
|
+ .apply("find_in_set(status,'1,2')");
|
|
|
+ if (!AuthUtil.getUserRole().contains("admin") && !AuthUtil.getUserRole().contains("财务")) {
|
|
|
+ customsDeclarationLambdaQueryWrapper.apply("find_in_set(team_id,'" + AuthUtil.getPostId() + "')");
|
|
|
+ }
|
|
|
+ if (!AuthUtil.getUserRole().contains("admin")) {
|
|
|
+ customsDeclarationLambdaQueryWrapper.eq(CustomsDeclaration::getBranchId, deptUtils.getDeptPid());
|
|
|
+ }
|
|
|
+ customsDeclarationLambdaQueryWrapper.eq(CustomsDeclaration::getBusinessType, "BGSE");
|
|
|
+ BGSE = customsDeclarationMapper.selectCount(customsDeclarationLambdaQueryWrapper);
|
|
|
+ customsDeclarationLambdaQueryWrapper.eq(CustomsDeclaration::getBusinessType, "BGSI");
|
|
|
+ BGSI = customsDeclarationMapper.selectCount(customsDeclarationLambdaQueryWrapper);
|
|
|
+ customsDeclarationLambdaQueryWrapper.eq(CustomsDeclaration::getBusinessType, "BGAE");
|
|
|
+ BGAE = customsDeclarationMapper.selectCount(customsDeclarationLambdaQueryWrapper);
|
|
|
+ customsDeclarationLambdaQueryWrapper.eq(CustomsDeclaration::getBusinessType, "BGAI");
|
|
|
+ BGAI = customsDeclarationMapper.selectCount(customsDeclarationLambdaQueryWrapper);
|
|
|
+
|
|
|
+ //付费申请
|
|
|
+ LambdaQueryWrapper<FinStlBills> finStlBillsLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ finStlBillsLambdaQueryWrapper.eq(FinStlBills::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(FinStlBills::getIsDeleted, 0)
|
|
|
+ .lt(FinStlBills::getBillDate, dateStart)
|
|
|
+ .gt(FinStlBills::getBillDate, dateEnd)
|
|
|
+ .apply("find_in_set(status,'1,2')");
|
|
|
+ if (!AuthUtil.getUserRole().contains("admin")) {
|
|
|
+ finStlBillsLambdaQueryWrapper.eq(FinStlBills::getBranchId, deptUtils.getDeptPid());
|
|
|
+ }
|
|
|
+ finStlBillsLambdaQueryWrapper.eq(FinStlBills::getBusinessType, "FFSQ");
|
|
|
+ FFSQ = finStlBillsMapper.selectCount(finStlBillsLambdaQueryWrapper);
|
|
|
+
|
|
|
+ //发票申请
|
|
|
+ LambdaQueryWrapper<FinInvoices> finInvoicesLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ finInvoicesLambdaQueryWrapper.eq(FinInvoices::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(FinInvoices::getIsDeleted, 0)
|
|
|
+ .lt(FinInvoices::getBillDate, dateStart)
|
|
|
+ .gt(FinInvoices::getBillDate, dateEnd)
|
|
|
+ .apply("find_in_set(status,'1,2')");
|
|
|
+ if (!AuthUtil.getUserRole().contains("admin")) {
|
|
|
+ finInvoicesLambdaQueryWrapper.eq(FinInvoices::getBranchId, deptUtils.getDeptPid());
|
|
|
+ }
|
|
|
+ finInvoicesLambdaQueryWrapper.eq(FinInvoices::getType, "申请");
|
|
|
+ FPSQ = finInvoicesMapper.selectCount(finInvoicesLambdaQueryWrapper);
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ map.put("HYJK", HYJK);
|
|
|
+ map.put("HYCK", HYCK);
|
|
|
+ map.put("KYJK", KYJK);
|
|
|
+ map.put("KYCK", KYCK);
|
|
|
+ map.put("SEA", SEA);
|
|
|
+ map.put("SIA", SIA);
|
|
|
+ map.put("AEA", AEA);
|
|
|
+ map.put("AIA", AIA);
|
|
|
+ map.put("BGSE", BGSE);
|
|
|
+ map.put("BGSI", BGSI);
|
|
|
+ map.put("BGAE", BGAE);
|
|
|
+ map.put("BGAI", BGAI);
|
|
|
+ map.put("FFSQ", FFSQ);
|
|
|
+ map.put("FPSQ", FPSQ);
|
|
|
+ return R.data(map);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public R<Map<String, Object>> completionRate(String dateStart, String dateEnd) {
|
|
|
+ long sum;
|
|
|
+ long refurbishment;
|
|
|
+ long complete;
|
|
|
+ LambdaQueryWrapper<Bills> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ lambdaQueryWrapper.eq(Bills::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(Bills::getIsDeleted, 0)
|
|
|
+ .lt(Bills::getBillDate, dateStart)
|
|
|
+ .gt(Bills::getBillDate, dateEnd);
|
|
|
+ if (!AuthUtil.getUserRole().contains("admin") && !AuthUtil.getUserRole().contains("财务")) {
|
|
|
+ lambdaQueryWrapper.apply("find_in_set(team_id,'" + AuthUtil.getPostId() + "')");
|
|
|
+ }
|
|
|
+ if (!AuthUtil.getUserRole().contains("admin")) {
|
|
|
+ lambdaQueryWrapper.eq(Bills::getBranchId, deptUtils.getDeptPid());
|
|
|
+ }
|
|
|
+ lambdaQueryWrapper.eq(Bills::getBusinessType, "SE");
|
|
|
+ List<Bills> HYCKList = billsMapper.selectList(lambdaQueryWrapper);
|
|
|
+ lambdaQueryWrapper.eq(Bills::getBusinessType, "SI");
|
|
|
+ List<Bills> HYJKList = billsMapper.selectList(lambdaQueryWrapper);
|
|
|
+
|
|
|
+ LambdaQueryWrapper<AeaBills> aeaBillsLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ aeaBillsLambdaQueryWrapper.eq(AeaBills::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(AeaBills::getIsDeleted, 0)
|
|
|
+ .lt(AeaBills::getBillDate, dateStart)
|
|
|
+ .gt(AeaBills::getBillDate, dateEnd);
|
|
|
+ if (!AuthUtil.getUserRole().contains("admin") && !AuthUtil.getUserRole().contains("财务")) {
|
|
|
+ aeaBillsLambdaQueryWrapper.apply("find_in_set(team_id,'" + AuthUtil.getPostId() + "')");
|
|
|
+ }
|
|
|
+ if (!AuthUtil.getUserRole().contains("admin")) {
|
|
|
+ aeaBillsLambdaQueryWrapper.eq(AeaBills::getBranchId, deptUtils.getDeptPid());
|
|
|
+ }
|
|
|
+ aeaBillsLambdaQueryWrapper.eq(AeaBills::getBusinessType, "AE");
|
|
|
+ List<AeaBills> KYCKList = aeaBillsMapper.selectList(aeaBillsLambdaQueryWrapper);
|
|
|
+ aeaBillsLambdaQueryWrapper.eq(AeaBills::getBusinessType, "AI");
|
|
|
+ List<AeaBills> KYJKList = aeaBillsMapper.selectList(aeaBillsLambdaQueryWrapper);
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ sum = HYCKList.size() + HYJKList.size() + KYCKList.size() + KYJKList.size();
|
|
|
+ refurbishment = HYCKList.stream().filter(e -> e.getBillStatus() == 1).count() +
|
|
|
+ HYJKList.stream().filter(e -> e.getBillStatus() == 1).count() +
|
|
|
+ KYCKList.stream().filter(e -> e.getBillStatus() == 1).count() +
|
|
|
+ KYJKList.stream().filter(e -> e.getBillStatus() == 1).count();
|
|
|
+ complete = HYCKList.stream().filter(e -> e.getStatus() == 3).count() +
|
|
|
+ HYJKList.stream().filter(e -> e.getStatus() == 3).count() +
|
|
|
+ KYCKList.stream().filter(e -> e.getStatus() == 3).count() +
|
|
|
+ KYJKList.stream().filter(e -> e.getStatus() == 3).count();
|
|
|
+ map.put("sum", sum);
|
|
|
+ map.put("refurbishment", refurbishment);
|
|
|
+ map.put("complete", complete);
|
|
|
+ NumberFormat nf = NumberFormat.getNumberInstance();
|
|
|
+ nf.setMaximumFractionDigits(2);
|
|
|
+ nf.setMinimumFractionDigits(2);
|
|
|
+ nf.setRoundingMode(RoundingMode.HALF_UP);
|
|
|
+ nf.setGroupingUsed(false);
|
|
|
+ if (sum == 0) {
|
|
|
+ map.put("rate", 0);
|
|
|
+ } else {
|
|
|
+ map.put("rate", nf.format((complete / sum * 100)));
|
|
|
+ }
|
|
|
+ return R.data(map);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public R<List<Map<String, Object>>> trend(String date, String type) {
|
|
|
+ if ("1".equals(type)) {
|
|
|
+ List<Map<String, Object>> mapList = billsMapper.trend(AuthUtil.getTenantId(), deptUtils.getDeptPid(),
|
|
|
+ AuthUtil.getPostId(), date);
|
|
|
+ return R.data(mapList);
|
|
|
+ } else if ("2".equals(type)) {
|
|
|
+ List<Map<String, Object>> mapList = aeaBillsMapper.trend(AuthUtil.getTenantId(), deptUtils.getDeptPid(),
|
|
|
+ AuthUtil.getPostId(), date);
|
|
|
+ return R.data(mapList);
|
|
|
+ } else {
|
|
|
+ return R.fail("参数错误");
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|