2025-11-11 20:20:28 +08:00
|
|
|
package com.mini.capi.api.biz;
|
|
|
|
|
|
2025-11-11 20:55:08 +08:00
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
2025-11-11 20:20:28 +08:00
|
|
|
import com.mini.capi.biz.domain.ErpPeriodSummaryAccountWeekView;
|
|
|
|
|
import com.mini.capi.biz.domain.ErpPeriodSummaryAccountYearView;
|
2025-11-11 20:55:08 +08:00
|
|
|
import com.mini.capi.biz.domain.ErpPeriodSummaryView;
|
2025-11-11 20:20:28 +08:00
|
|
|
import com.mini.capi.biz.service.ErpPeriodSummaryAccountWeekViewService;
|
|
|
|
|
import com.mini.capi.biz.service.ErpPeriodSummaryAccountYearViewService;
|
2025-11-11 20:55:08 +08:00
|
|
|
import com.mini.capi.biz.service.ErpPeriodSummaryViewService;
|
2025-11-11 20:20:28 +08:00
|
|
|
import com.mini.capi.model.ApiResult;
|
|
|
|
|
import com.mini.capi.model.ChartResult;
|
2025-11-11 20:55:08 +08:00
|
|
|
import com.mini.capi.utils.DateUtils;
|
2025-11-11 20:20:28 +08:00
|
|
|
import jakarta.annotation.Resource;
|
2025-11-11 20:55:08 +08:00
|
|
|
import org.springframework.util.StringUtils;
|
2025-11-11 20:20:28 +08:00
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
2025-11-11 20:55:08 +08:00
|
|
|
|
2025-11-11 20:20:28 +08:00
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
@RestController
|
|
|
|
|
@RequestMapping("/appApi")
|
|
|
|
|
public class appController {
|
|
|
|
|
|
|
|
|
|
|
2025-11-11 20:55:08 +08:00
|
|
|
@Resource
|
|
|
|
|
private ErpPeriodSummaryViewService summaryViewService;
|
|
|
|
|
|
|
|
|
|
|
2025-11-11 20:20:28 +08:00
|
|
|
@Resource
|
|
|
|
|
private ErpPeriodSummaryAccountWeekViewService weekViewService;
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private ErpPeriodSummaryAccountYearViewService yearViewService;
|
|
|
|
|
|
|
|
|
|
|
2025-11-11 20:55:08 +08:00
|
|
|
/**
|
|
|
|
|
* 实时汇总
|
|
|
|
|
*/
|
|
|
|
|
@GetMapping("getSummaryChart")
|
|
|
|
|
public ApiResult<?> getSummaryChart(String cycleType) {
|
|
|
|
|
QueryWrapper<ErpPeriodSummaryView> queryWrapper = new QueryWrapper<>();
|
|
|
|
|
if (StringUtils.hasText(cycleType)) {
|
|
|
|
|
queryWrapper.eq("cycle_type", cycleType);
|
|
|
|
|
String cycleCode = DateUtils.calculateStartCycleCode(cycleType);
|
|
|
|
|
if (cycleCode != null) {
|
|
|
|
|
queryWrapper.ge("cycle_code", cycleCode);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
List<ErpPeriodSummaryView> summaryViews = summaryViewService.list(queryWrapper);
|
|
|
|
|
return ApiResult.success(summaryViews);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2025-11-11 20:20:28 +08:00
|
|
|
/**
|
|
|
|
|
* 账号周汇总
|
|
|
|
|
*/
|
|
|
|
|
@GetMapping("getCardWeekChart")
|
|
|
|
|
public ApiResult<?> getCardWeekChart() {
|
|
|
|
|
List<ChartResult> chartResults = new ArrayList<>();
|
|
|
|
|
List<ErpPeriodSummaryAccountWeekView> weekViews = weekViewService.list();
|
|
|
|
|
for (ErpPeriodSummaryAccountWeekView weekView : weekViews) {
|
|
|
|
|
chartResults.add(new ChartResult(weekView.getAccountName(), weekView.getType(), weekView.getAmount()));
|
|
|
|
|
}
|
|
|
|
|
return ApiResult.success(chartResults);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 账号年汇总
|
|
|
|
|
*/
|
|
|
|
|
@GetMapping("getCardYearChart")
|
|
|
|
|
public ApiResult<?> getCardYearChart() {
|
|
|
|
|
List<ChartResult> chartResults = new ArrayList<>();
|
|
|
|
|
List<ErpPeriodSummaryAccountYearView> weekViews = yearViewService.list();
|
|
|
|
|
for (ErpPeriodSummaryAccountYearView weekView : weekViews) {
|
|
|
|
|
chartResults.add(new ChartResult(weekView.getAccountName(), weekView.getType(), weekView.getAmount()));
|
|
|
|
|
}
|
|
|
|
|
return ApiResult.success(chartResults);
|
|
|
|
|
}
|
|
|
|
|
}
|