QyWechatStatisticController.java 3.15 KB
package cn.com.glsx.entmicro.controller;

import cn.com.glsx.entmicro.request.one.template.TemplateSearchRequest;
import cn.com.glsx.entmicro.request.qystatistic.QyWechatStatisticRequest;
import cn.com.glsx.entmicro.response.one.template.TemplateResponse;
import cn.com.glsx.entmicro.response.qystatistic.QyWechatStatisticResponse;
import cn.com.glsx.entmicro.response.qystatistic.QyWechatStatisticStaffWeekVo;
import cn.com.glsx.entmicro.utils.Pagination;
import cn.com.glsx.framework.core.exception.RpcServiceException;
import cn.com.glsx.framework.rop.response.RopResponse;
import com.rop.annotation.NeedInSessionType;
import com.rop.annotation.ServiceMethod;
import com.rop.annotation.ServiceMethodBean;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;

import java.util.ArrayList;
import java.util.List;

/**
 * @author wangxw
 * @version 1.0.0
 * @ClassName QyWechatStatisticController.java
 * @description: 企微端-客户统计数据接口
 * @createTime 2021年11月15日 19:51:00
 */
@Slf4j
@Api("企微端-客户统计数据接口")
@ServiceMethodBean(version = "1.0.0", needInSession = NeedInSessionType.YES)
public class QyWechatStatisticController {

    @ServiceMethod(method = "entmicro.api.qywechat.customer.statistic.week")
    @ApiOperation("企微端-周报接口")
    public RopResponse<QyWechatStatisticResponse> getQywechatCustomerStatisticWeek(QyWechatStatisticRequest request) {
        try {
            QyWechatStatisticResponse qyWechatStatisticResponse = new QyWechatStatisticResponse();
            qyWechatStatisticResponse.setMerchantId(1);
            qyWechatStatisticResponse.setMerchantName("广联");
            qyWechatStatisticResponse.setTotalCount(1000);
            qyWechatStatisticResponse.setApplyCount(500);
            qyWechatStatisticResponse.setApplyDegree(50.0);
            qyWechatStatisticResponse.setWeekName("1108-1114");
            qyWechatStatisticResponse.setNewlyQyCount(50);
            qyWechatStatisticResponse.setNewlyQyDegree(40.0);
            qyWechatStatisticResponse.setFlowQyCount(20);
            qyWechatStatisticResponse.setFlowQyDegree(30.0);
            qyWechatStatisticResponse.setChampionStaffName("张衡");
            qyWechatStatisticResponse.setStaffWeekList(initStaffList());
            return RopResponse.success(qyWechatStatisticResponse);
        } catch (RpcServiceException e) {
            log.info("=======GroupOneTemplateController__invoke__getGroupOnePage__exception:{}", e.getMessage());
            return RopResponse.error(e.getErrId(), e.getMessage());
        }
    }

    private List<QyWechatStatisticStaffWeekVo> initStaffList() {
        List<QyWechatStatisticStaffWeekVo> qyWechatStatisticStaffWeekVos = new ArrayList<>();
        qyWechatStatisticStaffWeekVos.add(new QyWechatStatisticStaffWeekVo(1, "王五", 10));
        qyWechatStatisticStaffWeekVos.add(new QyWechatStatisticStaffWeekVo(2, "张二", 20));
        qyWechatStatisticStaffWeekVos.add(new QyWechatStatisticStaffWeekVo(3, "陆陆", 50));
        qyWechatStatisticStaffWeekVos.add(new QyWechatStatisticStaffWeekVo(4, "其他", 10));
        return qyWechatStatisticStaffWeekVos;
    }
}