|
|
@@ -23,10 +23,12 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import org.springblade.common.enums.BsTypeEnum;
|
|
|
import org.springblade.common.enums.CommonEnum;
|
|
|
+import org.springblade.common.enums.NumberEnum;
|
|
|
import org.springblade.core.mp.support.Condition;
|
|
|
import org.springblade.core.mp.support.Query;
|
|
|
import org.springblade.core.secure.BladeUser;
|
|
|
import org.springblade.core.secure.utils.AuthUtil;
|
|
|
+import org.springblade.core.tenant.annotation.TenantIgnore;
|
|
|
import org.springblade.core.tool.api.R;
|
|
|
import org.springblade.core.tool.utils.DateUtil;
|
|
|
import org.springblade.salesPart.corps.service.ICorpsDescService;
|
|
|
@@ -49,6 +51,8 @@ import org.springblade.salesPart.ship.service.IShipService;
|
|
|
import org.springblade.salesPart.statistics.service.IStatisticsService;
|
|
|
import org.springblade.salesPart.tireMallStatistics.service.ITireMallStatisticsService;
|
|
|
import org.springblade.salesPart.vo.AppStatisticsVo;
|
|
|
+import org.springblade.salesPart.vo.DuoDuoColumnarRzVo;
|
|
|
+import org.springblade.salesPart.vo.DuoDuoRealTimeOverviewVo;
|
|
|
import org.springblade.salesPart.vo.StatisticsVo;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
@@ -2069,4 +2073,69 @@ public class StatisticsServiceImpl implements IStatisticsService {
|
|
|
saleDetailDto.setTenantId(AuthUtil.getTenantId());
|
|
|
return orderItemsService.pointsDetailList(saleDetailDto);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @TenantIgnore
|
|
|
+ public DuoDuoRealTimeOverviewVo duoDuoRealTimeOverview(String tenantId, String year) {
|
|
|
+ DuoDuoRealTimeOverviewVo duoDuoRealTimeOverviewVo = new DuoDuoRealTimeOverviewVo();
|
|
|
+ duoDuoRealTimeOverviewVo.setAllZero();
|
|
|
+ List<PjOrder> orderList = orderService.list(new LambdaQueryWrapper<PjOrder>().eq(PjOrder::getTenantId, tenantId)
|
|
|
+ .eq(PjOrder::getIsDeleted, NumberEnum.Zero.number).eq(PjOrder::getBsType, BsTypeEnum.FINANCING_PROCUREMENT.info)
|
|
|
+ .eq(PjOrder::getWhetherRedeem, NumberEnum.Zero.number).apply("status != '录入' and DATE_FORMAT(busines_date,'%Y') = '" + year + "'"));
|
|
|
+ if (!CollectionUtils.isEmpty(orderList)) {
|
|
|
+ BigDecimal totalMoney = orderList.stream().map(PjOrder::getTotalMoney).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ BigDecimal fundingAmount = orderList.stream().map(PjOrder::getPrimaryFundingAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ duoDuoRealTimeOverviewVo.setTotalMoney(totalMoney);
|
|
|
+ duoDuoRealTimeOverviewVo.setFundingAmount(fundingAmount);
|
|
|
+ duoDuoRealTimeOverviewVo.setBondAmount(totalMoney.subtract(fundingAmount));
|
|
|
+ }
|
|
|
+ List<PjpfBalanceReset> balanceResetList = pjpfBalanceResetService.list(new LambdaQueryWrapper<PjpfBalanceReset>()
|
|
|
+ .eq(PjpfBalanceReset::getIsDeleted, NumberEnum.Zero.number)
|
|
|
+ .eq(PjpfBalanceReset::getTenantId, tenantId)
|
|
|
+ .eq(PjpfBalanceReset::getStatus, NumberEnum.ONE.number)
|
|
|
+ .apply("DATE_FORMAT(confirming_person_date,'%Y') = '" + year + "'"));
|
|
|
+ if (!CollectionUtils.isEmpty(balanceResetList)) {
|
|
|
+ duoDuoRealTimeOverviewVo.setRepayment(balanceResetList.stream().map(PjpfBalanceReset::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
+ }
|
|
|
+ PjpfFunding funding = pjpfFundingService.getOne(new LambdaQueryWrapper<PjpfFunding>()
|
|
|
+ .eq(PjpfFunding::getIsDeleted, NumberEnum.Zero.number)
|
|
|
+ .eq(PjpfFunding::getTenantId, tenantId)
|
|
|
+ .last("limit 1"));
|
|
|
+ if (!org.springframework.util.ObjectUtils.isEmpty(funding)) {
|
|
|
+ duoDuoRealTimeOverviewVo.setAmount(funding.getAvailableAmount());
|
|
|
+ duoDuoRealTimeOverviewVo.setInterest(funding.getInterest());
|
|
|
+ }
|
|
|
+ return duoDuoRealTimeOverviewVo;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @TenantIgnore
|
|
|
+ public DuoDuoColumnarRzVo duoDuoColumnarRz(String tenantId, String selectedYear) {
|
|
|
+ DuoDuoColumnarRzVo duoDuoColumnarRzVo = new DuoDuoColumnarRzVo();
|
|
|
+ List<BigDecimal> number = new ArrayList<>();
|
|
|
+ List<BigDecimal> amount = new ArrayList<>();
|
|
|
+ List<BigDecimal> primaryFundingAmount = new ArrayList<>();
|
|
|
+ // 获取当前年份
|
|
|
+ LocalDate selectedDate = LocalDate.of(Integer.parseInt(selectedYear), 12 ,31);
|
|
|
+ LocalDate now = LocalDate.now();
|
|
|
+ int year = selectedDate.getYear();
|
|
|
+ int nowMonth = selectedDate.getYear() == now.getYear() ? now.getMonthValue() : 12;
|
|
|
+ YearMonth yearMonth;
|
|
|
+ // 遍历每个月份
|
|
|
+ for (int month = NumberEnum.ONE.number; month <= nowMonth; month++) {
|
|
|
+ // 构建对应年份和月份的日期
|
|
|
+ yearMonth = YearMonth.of(year, month);
|
|
|
+ // 获取该月份的第一天和最后一天
|
|
|
+ LocalDate firstDay = yearMonth.atDay(NumberEnum.ONE.number);
|
|
|
+ LocalDate lastDay = yearMonth.atEndOfMonth();
|
|
|
+ Map<String, BigDecimal> sum = orderMapper.columnarRz(firstDay, lastDay, tenantId, null);
|
|
|
+ number.add(Objects.isNull(sum.get("goodsTotalNum")) ? FinalMap.ZERO_POINT_ZERO : sum.get("goodsTotalNum"));
|
|
|
+ amount.add(Objects.isNull(sum.get("totalMoney")) ? FinalMap.ZERO_POINT_ZERO : sum.get("totalMoney"));
|
|
|
+ primaryFundingAmount.add(Objects.isNull(sum.get("primaryFundingAmount")) ? FinalMap.ZERO_POINT_ZERO : sum.get("primaryFundingAmount"));
|
|
|
+ }
|
|
|
+ duoDuoColumnarRzVo.setNumber(number);
|
|
|
+ duoDuoColumnarRzVo.setAmount(amount);
|
|
|
+ duoDuoColumnarRzVo.setPrimaryFundingAmount(primaryFundingAmount);
|
|
|
+ return duoDuoColumnarRzVo;
|
|
|
+ }
|
|
|
}
|