新增图表接口
This commit is contained in:
55
src/main/java/com/mini/capi/api/biz/appController.java
Normal file
55
src/main/java/com/mini/capi/api/biz/appController.java
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
package com.mini.capi.api.biz;
|
||||||
|
|
||||||
|
import com.mini.capi.biz.domain.ErpPeriodSummaryAccountWeekView;
|
||||||
|
import com.mini.capi.biz.domain.ErpPeriodSummaryAccountYearView;
|
||||||
|
import com.mini.capi.biz.service.ErpPeriodSummaryAccountWeekViewService;
|
||||||
|
import com.mini.capi.biz.service.ErpPeriodSummaryAccountYearViewService;
|
||||||
|
import com.mini.capi.model.ApiResult;
|
||||||
|
import com.mini.capi.model.ChartResult;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/appApi")
|
||||||
|
public class appController {
|
||||||
|
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ErpPeriodSummaryAccountWeekViewService weekViewService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ErpPeriodSummaryAccountYearViewService yearViewService;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 账号周汇总
|
||||||
|
*/
|
||||||
|
@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);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,6 +3,7 @@ package com.mini.capi.model;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class ChartResult implements Serializable {
|
public class ChartResult implements Serializable {
|
||||||
@@ -12,10 +13,10 @@ public class ChartResult implements Serializable {
|
|||||||
|
|
||||||
private String type;
|
private String type;
|
||||||
|
|
||||||
private String value;
|
private BigDecimal value;
|
||||||
|
|
||||||
|
|
||||||
public ChartResult(String name, String type, String value) {
|
public ChartResult(String name, String type, BigDecimal value) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.value = value;
|
this.value = value;
|
||||||
|
|||||||
Reference in New Issue
Block a user