需求:

在一段时间范围内,统计哪些部门员工将商机转合同的最多,并计算转化率

对于商机总数来说这里的时间范围指的是商机的创建时间

对于每个用户转化了多少个商机来说,时间范围指的是合同的创建时间

合同的创建时间即商机转合同的时间

注意:最多展示10条

接口名/index/businessChangeStatistics

请求方式Get

参数列表

传入参数:

/index/businessChangeStatistics?beginCreateTime=2021-02-02&endCreateTime=2022-02-17

beginCreateTime 开始时间

endCreateTime 结束时间

返回值:

{"msg":"操作成功","code":200,"data":[{"create_by":"zhangkai",                    用户名称"deptName":"商机部",                     部门名称"num":100,                              转化数量"radio":31.65                         转化率},{"create_by":"admin","deptName":"研发部门","num":9,"radio":2.85},{"create_by":"shangji","deptName":"新人创建演示用部门","num":1,"radio":0.32},{"create_by":"shangji1","deptName":"销售部门","num":1,"radio":0.32}]
}

步骤:

1.阅读产品文档(接口名,请求方式,参数列表)

2.根据产品的返回值和接收参数构建VO类

3.编写mapper层操作数据库

4.编写service层操作数据

5.编写controller层接收参数和返回数据

TbBusinessMapper.xml

 <select id="countAllBusiness" resultType="int">select count(id) from tb_business<where><if test="beginCreateTime != null and beginCreateTime != ''"><!-- 开始创建时间 -->and date_format(create_time,'%y-%m-%d') &gt;= date_format(#{beginCreateTime},'%y-%m-%d')</if><if test="endCreateTime != null and endCreateTime != ''"><!--  -->and date_format(create_time,'%y-%m-%d') &lt;= date_format(#{endCreateTime},'%y-%m-%d')</if></where></select>
<select id="countAllContractByUser" parameterType="com.huike.clues.domain.vo.IndexStatisticsVo"  resultType="java.util.Map">select c.create_by, count(c.id) as num ,d.`dept_name` as deptName from tb_contract cLEFT JOIN `sys_dept` dON c.`dept_id`   = d.`dept_id`<if test="indexVo.beginCreateTime != null and indexVo.beginCreateTime != ''"><!-- 开始创建时间 -->where c.`create_time` BETWEEN #{indexVo.beginCreateTime} AND #{indexVo.endCreateTime}</if>GROUP BY c.create_byORDER BY num DESCLIMIT 10</select>

TbBusinessMapper

 public int countAllBusiness(@Param("beginCreateTime") String beginCreateTime, @Param("endCreateTime") String endCreateTime);
public List<Map<String,Object>> countAllContractByUser(@Param("indexVo")IndexStatisticsVo vo);

ReportServiceImpl

 /*** 商机转换龙虎榜* @param request* @return*/@Overridepublic List<Map<String, Object>> businessChangeStatisticsForIndex(IndexStatisticsVo request) {int allBusiness=  businessMapper.countAllBusiness(request.getBeginCreateTime(),request.getEndCreateTime());List<Map<String,Object>> list= businessMapper.countAllContractByUser(request);for (Map<String, Object> datum : list) {Long num= (Long) datum.get("num");datum.put("radio",getRadio(allBusiness,num));}return list;}

IReportService

 public List<Map<String,Object>> businessChangeStatisticsForIndex(IndexStatisticsVo request);

IndexController

@GetMapping("/businessChangeStatistics")public AjaxResult businessChangeStatistics(IndexStatisticsVo request){SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");request.setBeginCreateTime(request.getBeginCreateTime()+" 00:00:00");request.setEndCreateTime(request.getEndCreateTime()+" 23:59:59");List<Map<String,Object>> list= reportService.businessChangeStatisticsForIndex(request);return AjaxResult.success(list);}

CRM--首页数据--商机转化龙虎榜 (接口实现)相关推荐

  1. PHP客户关系项目,【php源码】最新企业客户关系管理系统CRM源码|Thinkphp开发企业客户关系管理系统响应式源码 线索发掘、商机转化、客户挖掘、客户关怀、报表统计等...

    源码介绍: 悟空CRM主要面向于中小型企业,帮助中小型企业降低工作强度,提升工作效率,并有效提升项目成功率,提高企业效益. 悟空CRM能全面跟踪业务员的项目跟进流程,从线索录入.商机转换.成为客户,到 ...

  2. Python零基础速成班-第12讲-Python获取网络数据Socket,API接口,网络爬虫Crawler(制作弹幕词云)

    Python零基础速成班-第12讲-Python获取网络数据Socket,API接口,网络爬虫Crawler(制作弹幕词云) 学习目标 获取网络数据Socket API接口 网络爬虫Crawler(制 ...

  3. android预加载app,Android欢迎页预加载首页数据

    项目需求:展示欢迎页的同时执行token登录和首页预加载 背景: 在此之前,展示欢迎页和token登录等网络操作是串行的,所以用户点开App到最终看到首页的时间就是:"展示欢迎页的时间&qu ...

  4. 首页数据展示前端页面

    首页数据展示前端页面 1.首页前端实现 1.1.封装api请求,用户调用后端接口 1.1.1.创建api文件夹,创建/api/hosp/hosp.js 1.1.2.创建/api/cmn/dict.js ...

  5. 尚医通_第12章_用户平台首页数据

    尚医通_第12章_用户平台首页数据 文章目录 尚医通_第12章_用户平台首页数据 第一节.首页静态数据整合 一.首页静态数据整合 1.添加静态资源 2.修改页面布局 第二节.首页数据显示功能 一.首页 ...

  6. textarea实现datalist效果_同步纷享销客CRM合同数据至E签宝,实现全程无感完成电子合同签署!...

    最新消息:纷享销客与E签宝官方已经合作,目前正在进行技术推进,纷享会以系统集成的方式使用E签宝.1纷享销客简介 纷享销客是连接型CRM优质服务商.纷享销客连接型CRM以开放的企业级通讯为基础架构,以连 ...

  7. Python dataframe指定列顺序输出 + 列数据转化成字符 + 数据框转化成列表

    参考: (3条消息)pandas中的DataFrame按指定顺序输出所有列 - quintind的专栏 - CSDN博客 https://blog.csdn.net/quintind/article/ ...

  8. pandas使用to_datetime函数把dataframe的字符串日期数据列转化为日期格式日期数据列( strings to datetime in dataframe column)

    pandas使用to_datetime函数把dataframe的字符串日期数据列转化为日期格式日期数据列( strings to datetime in dataframe column) 目录

  9. pandas使用normalize函数将dataframe中的时间(time)数据列转化为日期(date)数据列(例如,从2019-12-25 11:30:00到2019-12-25)

    pandas使用normalize函数将dataframe中的时间(time)数据列转化为日期(date)数据列(例如,从2019-12-25 11:30:00到2019-12-25) 目录

最新文章

  1. 分分钟get「隔空传手」技能,网友:我想试试别的东西…
  2. 示波器DIY参考设计
  3. Java之——利用Comparator接口对多个排序条件进行处理
  4. 42翻转单词顺序列+注意该题找单词的方法
  5. python语句讲解_python语句讲解_python语句讲解
  6. 1112 Stucked Keyboard (20 分)【难度: 一般 / 知识点: 模拟】
  7. SUSE团队已将重心偏向GCC 7
  8. stm32F051系列教程 1.点灯
  9. java安装的时候无效参数,spring-boot 打成jar把后 启动时指定参数无效
  10. 前端开发中一些常用技巧总结
  11. JVM初识之垃圾回收机制(GC)
  12. 钽电容的命名,贴片电解电容耐压,封装
  13. LS1046A平台 网卡混杂模式,无法收到DMAC不是自己的包
  14. verilogHDL实现pwm控制
  15. 华为会员开放服务(Membership Kit),助力移动应用快速建设会员生态
  16. Excel中3个超级好用的条件求和的函数
  17. 大写字母转小写(及scanf中的间隔符号的影响)
  18. FFT(傅里叶快速变换,详细讲解+推导) 每日一遍,算法再见!
  19. 生成微信小程序指定页面二维码
  20. 1986 年德国电气商博世公司开发出面向汽车的CAN 通信协议

热门文章

  1. 对于mysql数据库视图心得_MySQl心得4--5--数据库视图
  2. [LTE] LTE系统中的ID
  3. Win7 HTTP 错误 404.17 – Not Found 请求的内容似乎是脚本,因而将无法由静态文件处理程序来处理。
  4. 从一个APK调用另一个APK的方法
  5. 《光电子学与光子学——原理与实践》课程笔记
  6. JProfiler11使用教程之JVM调优
  7. AI视频智能分析技术与应用(一)
  8. android motion linux handle,Android实现刮奖的效果
  9. 贵州发布大数据十项工程
  10. 沈阳工业大学:如何助推高校智慧校园建设?