CRM项目后端使用对象封装总览信息提交到前端实现总预览效果------CRM项目

package com.alatus.web;

import com.alatus.result.Result;
import com.alatus.result.SummaryData;
import com.alatus.service.StatisticService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class SummaryController {
    @Resource
    private StatisticService statisticService;

    @GetMapping(value = "/api/summary/data")
    public Result getSummary(){
        SummaryData summaryData = statisticService.loadSummary();
        return Result.OK(summaryData);
    }
}
package com.alatus.web;

import com.alatus.result.Result;
import com.alatus.result.SummaryData;
import com.alatus.service.StatisticService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class SummaryController {
    @Resource
    private StatisticService statisticService;

    @GetMapping(value = "/api/summary/data")
    public Result getSummary(){
        SummaryData summaryData = statisticService.loadSummary();
        return Result.OK(summaryData);
    }
}

package com.alatus.service;

import com.alatus.result.SummaryData;

public interface StatisticService {
    SummaryData loadSummary();
}
package com.alatus.service;

import com.alatus.result.SummaryData;

public interface StatisticService {
    SummaryData loadSummary();
}
package com.alatus.service.impl;

import com.alatus.manager.StatisticManager;
import com.alatus.result.SummaryData;
import com.alatus.service.StatisticService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

@Service
public class StatisticServiceImpl implements StatisticService {
    @Resource
    private StatisticManager statisticManager;
    @Override
    public SummaryData loadSummary() {
        return statisticManager.loadSummaryData();
    }
}
package com.alatus.service.impl;

import com.alatus.manager.StatisticManager;
import com.alatus.result.SummaryData;
import com.alatus.service.StatisticService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

@Service
public class StatisticServiceImpl implements StatisticService {
    @Resource
    private StatisticManager statisticManager;
    @Override
    public SummaryData loadSummary() {
        return statisticManager.loadSummaryData();
    }
}
package com.alatus.manager;


import com.alatus.mapper.TActivityMapper;
import com.alatus.mapper.TClueMapper;
import com.alatus.mapper.TCustomerMapper;
import com.alatus.mapper.TTranMapper;
import com.alatus.result.SummaryData;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Component;

import java.math.BigDecimal;

@Component
public class StatisticManager {
    @Resource
    private TActivityMapper tActivityMapper;
    @Resource
    private TClueMapper tClueMapper;
    @Resource
    private TCustomerMapper tCustomerMapper;
    @Resource
    private TTranMapper tTranMapper;
    public SummaryData loadSummaryData() {
        //有效的市场活动总数
        Integer effectiveActivityCount = 0;

        //总的市场活动数
        Integer totalActivityCount = 0;

        //线索总数
        Integer totalClueCount = 0;

        //客户总数
        Integer totalCustomerCount = 0;

        //成功的交易额
        BigDecimal successTranAmount = new BigDecimal(0);

        //总的交易额(包含成功和不成功的)
        BigDecimal totalTranAmount = new BigDecimal(0);
        return SummaryData.builder()
                .effectiveActivityCount(effectiveActivityCount)
                .totalActivityCount(totalActivityCount)
                .totalClueCount(totalClueCount)
                .totalCustomerCount(totalCustomerCount)
                .successTranAmount(successTranAmount)
                .totalTranAmount(totalTranAmount)
                .build();
    }
}
package com.alatus.manager;

import com.alatus.mapper.TActivityMapper;
import com.alatus.mapper.TClueMapper;
import com.alatus.mapper.TCustomerMapper;
import com.alatus.mapper.TTranMapper;
import com.alatus.result.SummaryData;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Component;

import java.math.BigDecimal;

@Component
public class StatisticManager {
    @Resource
    private TActivityMapper tActivityMapper;
    @Resource
    private TClueMapper tClueMapper;
    @Resource
    private TCustomerMapper tCustomerMapper;
    @Resource
    private TTranMapper tTranMapper;
    public SummaryData loadSummaryData() {
        //有效的市场活动总数
        Integer effectiveActivityCount = 0;

        //总的市场活动数
        Integer totalActivityCount = 0;

        //线索总数
        Integer totalClueCount = 0;

        //客户总数
        Integer totalCustomerCount = 0;

        //成功的交易额
        BigDecimal successTranAmount = new BigDecimal(0);

        //总的交易额(包含成功和不成功的)
        BigDecimal totalTranAmount = new BigDecimal(0);
        return SummaryData.builder()
                .effectiveActivityCount(effectiveActivityCount)
                .totalActivityCount(totalActivityCount)
                .totalClueCount(totalClueCount)
                .totalCustomerCount(totalCustomerCount)
                .successTranAmount(successTranAmount)
                .totalTranAmount(totalTranAmount)
                .build();
    }
}
package com.alatus.result;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;

@Builder
@AllArgsConstructor
@NoArgsConstructor
@Data
public class SummaryData {

    //有效的市场活动总数
    private Integer effectiveActivityCount;

    //总的市场活动数
    private Integer totalActivityCount;

    //线索总数
    private Integer totalClueCount;

    //客户总数
    private Integer totalCustomerCount;

    //成功的交易额
    private BigDecimal successTranAmount;

    //总的交易额(包含成功和不成功的)
    private BigDecimal totalTranAmount;

}
package com.alatus.result;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;

@Builder
@AllArgsConstructor
@NoArgsConstructor
@Data
public class SummaryData {

    //有效的市场活动总数
    private Integer effectiveActivityCount;

    //总的市场活动数
    private Integer totalActivityCount;

    //线索总数
    private Integer totalClueCount;

    //客户总数
    private Integer totalCustomerCount;

    //成功的交易额
    private BigDecimal successTranAmount;

    //总的交易额(包含成功和不成功的)
    private BigDecimal totalTranAmount;

}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值