| | |
| | | import java.util.Map; |
| | | |
| | | import com.talentcard.server.business.PageResult; |
| | | import com.talentcard.server.business.merchant.MerchantTypeCatalog; |
| | | import com.talentcard.server.common.BusinessException; |
| | | import com.talentcard.server.common.ErrorCode; |
| | | import com.talentcard.server.mapper.MerchantSettlementStatisticsMapper; |
| | |
| | | int safeSize = Math.min(Math.max(size, 1), 100); |
| | | List<Map<String, Object>> records = mapper.selectPeriodSummaries( |
| | | merchantId, |
| | | clean(merchantType), |
| | | merchantTypeCode(merchantType), |
| | | normalizedPeriod, |
| | | range.startTime(), |
| | | range.endTime(), |
| | |
| | | .toList(); |
| | | Long total = mapper.countPeriodSummaries( |
| | | merchantId, |
| | | clean(merchantType), |
| | | merchantTypeCode(merchantType), |
| | | normalizedPeriod, |
| | | range.startTime(), |
| | | range.endTime() |
| | |
| | | public Map<String, Object> overview(Long merchantId, String merchantType, String startDate, String endDate) { |
| | | requireMerchantIdWhenSpecified(merchantId); |
| | | DateRange range = range("DAY", startDate, endDate); |
| | | List<Map<String, Object>> rows = mapper.selectMerchantOverviews(merchantId, clean(merchantType), range.startTime(), range.endTime()); |
| | | List<Map<String, Object>> rows = mapper.selectMerchantOverviews(merchantId, merchantTypeCode(merchantType), range.startTime(), range.endTime()); |
| | | Map<String, Object> result = new LinkedHashMap<>(); |
| | | result.put("startDate", range.startDate() == null ? "" : range.startDate().toString()); |
| | | result.put("endDate", range.endDateInclusive() == null ? "" : range.endDateInclusive().toString()); |
| | |
| | | return overview(merchantId, null, currentMonth.atDay(1).toString(), currentMonth.atEndOfMonth().toString()); |
| | | } |
| | | |
| | | private String merchantTypeCode(String value) { |
| | | String cleaned = clean(value); |
| | | return cleaned.isBlank() ? "" : MerchantTypeCatalog.canonicalCode(cleaned); |
| | | } |
| | | |
| | | @Transactional(readOnly = true) |
| | | public Map<String, Object> dashboardCards(Long merchantId) { |
| | | requireMerchantId(merchantId); |