汇客huikeCRM项目实战-牛刀小试
来自编程小趴菜的分享~~
希望对你有所帮助~~
你的小小的赞就是对我最大的鼓励~~
有不明白的地方可以私信解答~
目录
任务一:线索捞取为负数bug修复
任务二:权限管理-用户管理-高级搜索-手机号搜索不可用
任务三:公海池-创建时间搜索 -没有效果
任务四:商机管理-商机状态搜索框不可用
任务五:线索管理- 线索id和手机号应该支持模糊搜索
任务六:线索管理-添加线索-活动信息-应该只展示 正在活动时间内的活动
注意:第二天的任务还是比较简单的,主要是一些bug的修复,这些bug主要原因是写sql语句的时候,缺少进行相应的判断引起的
策略:首先打开前端项目,使用F12抓包,看请求的路径是哪里,然后找到对应的代码位置进行修改
任务一:线索捞取为负数bug修复
在serviceImpl实现的代码地方添加对应的逻辑判断
if (asignRecords >= rulePool.getMaxNunmber()) {int num = 0;if (rulePool.getMaxNunmber() - asignRecords <= 0) {num = 0;}throw new CustomException("捞取失败!最大保有量(" + rulePool.getMaxNunmber() + "),剩余可以捞取" + (num) + "条线索");}
完整代码:
/*** 批量捞取** @param clueIds 线索id* @param userId 当前用户id* @return*/@Overridepublic String gain(Long[] clueIds, Long userId) {// 是否批量捞取boolean isBatch = clueIds.length > 1 ? true : false;TbRulePool rulePool = rulePoolService.selectTbRulePoolByType(TbRulePool.RuleType.CLUES.getValue());// 统计当前分配人所有线索int asignRecords = assignRecordMapper.countAssignCluesByUser(userId);// rulePool.getMaxNunmber() 当前分配人的最大捞取量if (asignRecords >= rulePool.getMaxNunmber()) {int num = 0;if (rulePool.getMaxNunmber() - asignRecords <= 0) {num = 0;}throw new CustomException("捞取失败!最大保有量(" + rulePool.getMaxNunmber() + "),剩余可以捞取" + (num) + "条线索");}for (int i = 0; i < clueIds.length; i++) {Long clueId = clueIds[i];// 超过最大保有量if (asignRecords + i >= rulePool.getMaxNunmber()) {throw new CustomException("捞取失败!保有量达到上线,最多选择" + rulePool.getMaxNunmber() + "条线索");}// 最近捞取记录TbAssignRecord assignRecord = assignRecordMapper.selectAssignRecordByAssignId(clueId,TbAssignRecord.RecordType.CLUES.getValue());if (assignRecord != null && assignRecord.getUserId().equals(userId)) {Date repeatGetTime = JobUtils.getDate(rulePool.getRepeatGetTime().intValue(), rulePool.getRepeatType(),assignRecord.getCreateTime());// 捞取限制时间内,不让捞取if (DateUtils.getNowDate().before(repeatGetTime)) {// 批量捞取跳过if (isBatch) {continue;} else {throw new CustomException("捞取失败!需要在 " + DateUtils.dateTimeHm(repeatGetTime) + " 后捞取");}}}// 捞取后下次跟进时间,及状态重置tbClueMapper.resetNextTimeAndStatus(clueId, TbClue.StatusType.UNFOLLOWED.getValue());// 新建分配记录TbAssignRecord tbAssignRecord = addNewRecord(clueId, userId);Date endDate = HuiKeCrmDateUtils.getEndDateByRule(tbAssignRecord);tbClueMapper.updateClueEndTimeById(clueId, endDate);}return "全部捞取成功";}
任务二:权限管理-用户管理-高级搜索-手机号搜索不可用
查看代码可以发现,对应的SysUserMapper.xml文件中,没有对手机号搜索的判断,只需要加上就行
解决代码:
<!-- 数据范围过滤 --><if test="phonenumber != null and phonenumber != ''">AND u.phonenumber = #{phonenumber}</if><!-- 数据范围过滤 -->
完整代码:
<select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult">select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from sys_user uleft join sys_dept d on u.dept_id = d.dept_idwhere u.del_flag = '0'<if test="userName != null and userName != ''">AND u.user_name like concat('%', #{userName}, '%')</if><if test="status != null and status != ''">AND u.status = #{status}</if><if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->AND date_format(u.create_time,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d')</if><if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->AND date_format(u.create_time,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d')</if><if test="deptId != null and deptId != 0">AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{deptId}, ancestors) ))</if><!-- 数据范围过滤 --><if test="phonenumber != null and phonenumber != ''">AND u.phonenumber = #{phonenumber}</if><!-- 数据范围过滤 --><if test="params.dataScope != null and params.dataScope != ''">AND (${params.dataScope})</if></select>
任务三:公海池-创建时间搜索 -没有效果
其原理基本上同任务二,主要是xml文件的判断问题
解决代码:
<!--添加对时间的判断--><if test="beginCreateTime != null and endCreateTime != null "> and DATE_FORMAT(create_time,'%Y-%m-%d') BETWEEN #{beginCreateTime} AND #{endCreateTime}</if>
完整代码:
<select id="selectTbBusinessPool" parameterType="TbBusiness" resultMap="TbBusinessResult"><include refid="selectTbBusinessVo"/><where><if test="id != null and id != ''"> and id = #{id}</if><if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if><if test="phone != null and phone != ''"> and phone = #{phone}</if><if test="channel != null and channel != ''"> and channel = #{channel}</if><if test="activityId != null "> and activity_id = #{activityId}</if><if test="provinces != null and provinces != ''"> and provinces = #{provinces}</if><if test="city != null and city != ''"> and city = #{city}</if><if test="sex != null and sex != ''"> and sex = #{sex}</if><if test="age != null "> and age = #{age}</if><if test="weixin != null and weixin != ''"> and weixin = #{weixin}</if><if test="qq != null and qq != ''"> and qq = #{qq}</if><if test="level != null and level != ''"> and level = #{level}</if><if test="subject != null and subject != ''"> and subject = #{subject}</if><if test="courseId != null "> and course_id = #{courseId}</if><if test="occupation != null and occupation != ''"> and occupation = #{occupation}</if><if test="education != null and education != ''"> and education = #{education}</if><if test="job != null and job != ''"> and job = #{job}</if><if test="salary != null and salary != ''"> and salary = #{salary}</if><if test="major != null and major != ''"> and major = #{major}</if><if test="expectedSalary != null and expectedSalary != ''"> and expected_salary = #{expectedSalary}</if><if test="reasons != null and reasons != ''"> and reasons = #{reasons}</if><if test="plan != null and plan != ''"> and plan = #{plan}</if><if test="planTime != null "> and plan_time = #{planTime}</if><if test="otherIntention != null and otherIntention != ''"> and other_intention = #{otherIntention}</if><if test="nextTime != null "> and next_time = #{nextTime}</if><!--添加对时间的判断--><if test="beginCreateTime != null and endCreateTime != null ">and DATE_FORMAT(create_time,'%Y-%m-%d')BETWEEN #{beginCreateTime} AND #{endCreateTime}</if>and status IN ('3','4')</where></select>
任务四:商机管理-商机状态搜索框不可用
原理同上
解决代码:
<!-- 数据范围过滤 --><if test="status != null and status != ''"> and b.status = #{status}</if>
完整代码:
<select id="selectTbBusinessList" parameterType="TbBusiness" resultMap="TbBusinessAssignResult"><include refid="selectTbBusinesAssignVo"/><where><if test="id != null and id != ''"> and b.id like concat('%', #{id}, '%')</if><if test="name != null and name != ''"> and b.name like concat('%', #{name}, '%')</if><if test="phone != null and phone != ''"> and b.phone like concat('%', #{phone}, '%')</if><if test="channel != null and channel != ''"> and b.channel = #{channel}</if><if test="activityId != null "> and b.activity_id = #{activityId}</if><if test="provinces != null and provinces != ''"> and b.provinces = #{provinces}</if><if test="city != null and city != ''"> and b.city = #{city}</if><if test="sex != null and sex != ''"> and b.sex = #{sex}</if><if test="age != null "> and b.age = #{age}</if><if test="weixin != null and weixin != ''"> and b.weixin = #{weixin}</if><if test="qq != null and qq != ''"> and b.qq = #{qq}</if><if test="level != null and level != ''"> and b.level = #{level}</if><if test="subject != null and subject != ''"> and b.subject = #{subject}</if><if test="courseId != null "> and b.course_id = #{courseId}</if><if test="occupation != null and occupation != ''"> and b.occupation = #{occupation}</if><if test="education != null and education != ''"> and b.education = #{education}</if><if test="job != null and job != ''"> and b.job = #{job}</if><if test="salary != null and salary != ''"> and b.salary = #{salary}</if><if test="major != null and major != ''"> and b.major = #{major}</if><if test="expectedSalary != null and expectedSalary != ''"> and b.expected_salary = #{expectedSalary}</if><if test="reasons != null and reasons != ''"> and b.reasons = #{reasons}</if><if test="plan != null and plan != ''"> and b.plan = #{plan}</if><if test="planTime != null "> and b.plan_time = #{planTime}</if><if test="otherIntention != null and otherIntention != ''"> and b.other_intention = #{otherIntention}</if><if test="nextTime != null "> and b.next_time = #{nextTime}</if><if test="beginCreateTime != null and endCreateTime != null "> and DATE_FORMAT(b.create_time,'%Y-%m-%d') BETWEEN #{beginCreateTime} AND #{endCreateTime}</if><!-- 数据范围过滤 --><if test="status != null and status != ''"> and b.status = #{status}</if>AND (r.latest = '1' OR r.id IS NULL)AND (r.type = '1' OR r.id IS NULL)</where><!-- 数据范围过滤 --><if test="params.dataScope != null and params.dataScope != ''">AND (${params.dataScope} OR r.id IS NULL)</if>ORDER BY b.`create_time` DESC</select>
任务五:线索管理- 线索id和手机号应该支持模糊搜索
在对应的xml文件中对这两个字段加上like查询
解决代码:
<!--加上对手机号和id的like模糊查询--><if test="id != null and id != ''"> and clue.id like concat('%', #{id}, '%')</if><if test="name != null and name != ''"> and clue.name like concat('%', #{name}, '%')</if><if test="phone != null and phone != ''"> and clue.phone like concat('%', #{phone}, '%')</if>
完整代码:
<select id="selectTbClueList" parameterType="TbClue" resultMap="TbClueAssignResult"><include refid="selectTbClueAssignVo"/><where><!--加上对手机号和id的like模糊查询--><if test="id != null and id != ''"> and clue.id like concat('%', #{id}, '%')</if><if test="name != null and name != ''"> and clue.name like concat('%', #{name}, '%')</if><if test="phone != null and phone != ''"> and clue.phone like concat('%', #{phone}, '%')</if><if test="channel != null and channel != ''"> and clue.channel = #{channel}</if><if test="activityId != null and activityId != ''"> and clue.activity_id = #{activityId}</if><if test="sex != null and sex != ''"> and clue.sex = #{sex}</if><if test="age != null "> and clue.age = #{age}</if><if test="weixin != null and weixin != ''"> and clue.weixin = #{weixin}</if><if test="qq != null and qq != ''"> and clue.qq = #{qq}</if><if test="level != null and level != ''"> and clue.level = #{level}</if><if test="subject != null and subject != ''"> and clue.subject = #{subject}</if><if test="params.beginCreateTime != null and params.beginCreateTime != ''"><!-- 开始创建时间 -->and date_format(clue.create_time,'%y%m%d') >= date_format(#{params.beginCreateTime},'%y%m%d')</if><if test="params.endCreateTime != null and params.endCreateTime != ''"><!-- -->and date_format(clue.create_time,'%y%m%d') <= date_format(#{params.endCreateTime},'%y%m%d')</if><if test="nextTime != null "> and clue.next_time = #{nextTime}</if><if test="owner != null and owner != ''"> and r.user_name like concat('%', #{owner}, '%')</if><!-- 线索状态没有被查询,这里去掉状态转而添加if --><if test="status != null and status !=''"> and clue.status = #{status}</if><if test="status == null or status == ''"> and clue.status in ('1','2')</if>AND (r.latest = '1' OR r.id IS NULL)AND (r.type = '0' OR r.id IS NULL)</where><!-- 数据范围过滤 --><if test="params.dataScope != null and params.dataScope != ''">AND (${params.dataScope} OR r.id IS NULL)</if>order by clue.create_time desc</select>
任务六:线索管理-添加线索-活动信息-应该只展示 正在活动时间内的活动
查询时对当前时间进行判断 ,在此提供一个简单方案,在查询结果返回前端时对其进行数据处理,过滤掉失效时间的活动
解决代码:
Date nowTime = new Date();List<TbActivity> collect = tbActivities
.stream().filter(item -> item.getEndTime()
.compareTo(nowTime) == 1).collect(Collectors.toList());
以上就是今天的任务啦,希望对你有所帮助~~
汇客huikeCRM项目实战-牛刀小试相关推荐
- 汇客huikeCRM项目实战-初出茅庐
来自编程小趴菜的分享~~ 希望对你有所帮助~~ 你的小小的赞就是对我最大的鼓励~~ 有不明白的地方可以私信解答~ 文章目录 任务一:运行后端代码和前端代码 任务二:技术调研,接口权限,数据权限控制,自 ...
- 汇客huikeCRM项目实战-熟能生巧
任务目录: 开胃菜一:统计分析--线索统计--线索转化率漏斗图 开胃菜二:首页--商机转化龙虎榜接口 开胃菜二:首页--线索转化龙虎榜接口 任务一:首页--待办数据统计接口 任务二:统计分析-客户统计 ...
- 个人博客系统--项目实战
个人博客系统–项目实战 先附上设计文档和项目源码. 个人博客设计文档 Github 这项目大概做了十多天,其基本功能都实现了,因为没有美工的关系,界面可能有点丑,请谅解. 后台采用SSH技术,版本为: ...
- php实战搭建博客,yii2项目实战-博客管理平台的搭建
作者:白狼 出处:http://www.manks.top/document/yii2-blog-manage.html 本文版权归作者,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置 ...
- SpringBoot仿牛客论坛项目实战
Community 论坛项目 转载请附带原文链接: 1. 环境搭建与技术栈说明 1.0 项目架构图 1.1 技术要求 熟悉快速开发框架:SpringBoot2.3.x 整合 SpringMVC + M ...
- 传智播客——OA项目实战(四)阿汤哥真情流露
今天是OA的最后一天,讲了很多零碎的东西,后来阿汤哥讲到情深处,向我们毫无保留的研讨自己是人生观和学习方法. 阿汤哥的世界观:万物都需要平衡,在各种平衡中前进看起来慢其实是最快. 阿汤哥的学习方法:暂 ...
- Vue.js实训【基础理论(5天)+项目实战(5天)】博客汇总表【详细笔记】
目 录 前言 基础理论(5天) 基础理论-Day01 基础理论-Day02 基础理论-Day03 基础理论-Day04 基础理论-Day05 项目实战 项目实战-Day01 项目实战-Day02 ...
- Node项目实战开发-博客系统
Nodejs项目实战开发-博客系统(已完结) 个人博客系统 欢迎访问我的博客~ MaXiaoYu's Bolg 前言: 开发技术 技术 版本 Node ^14.3.0 ejs ^3.1.3 expre ...
- php博客视频教程,ThinkPHP5 博客项目实战视频教程
ThinkPHP是为了简化企业级应用开发和敏捷WEB应用开发而诞生的.最早诞生于2006年初,2007年元旦正式更名为ThinkPHP,并且遵循Apache2开源协议发布.ThinkPHP从诞生以来一 ...
- yii2项目实战-博客管理平台的搭建
登录 | 注册 收藏成功 确定 收藏失败,请重新收藏 确定 查看所有私信查看所有通知 暂没有新通知 返回通知列表 下一条 上一条 分享资讯 传PPT/文档 提问题 写博客 传资源 创建项目 创建代码片 ...
最新文章
- 干货|全球人工智能专利分布战情图
- nginx限制ip,只允许域名访问
- JavsScript中DOM的基本操作
- android 粘性service,Android服务1 Service
- 面向接口编程的优点_为什么我们要面向接口编程
- Matlab 读取excel文件提示服务器出现意外情况或无法读取问题解决
- 由底层和逻辑说开去--c++之引用的深入剖析
- iOS:重识Transform和frame
- 四叶草关闭啰嗦模式_教你如何解决 Win7 64位卡LOGO(四叶草)
- CIH病毒的分析与清除
- css在线代码生成工具汇总
- 高级会计职称计算机考什么,高级会计师考试要考哪些科目
- 林海峰讲的python_线性回归模型与最小二乘法(附python源码)
- MySQL Error 1114
- 华硕笔记本进入pe系统-华硕电脑从U盘启动-实测有效-转载--记录用
- 联想微型计算机c325参数,联想一体机c325性能表现 联想一体机c325配置参数
- 从三个层面来谈下自己的团队管理心得及感悟
- 华为android版本7.0,永不卡!华为手机全面升级安卓7.0:逆天
- 2021年中国宽带网速发展状况分析:我国宽带网速增长快速[图]
- OpenCV视频质量诊断----视频遮挡诊断
热门文章
- Goolgle Analytics
- 方正飞鸿:工作流在OA系统中的重要性
- 抓取lol全英雄图(不含皮肤)
- 国足3比1叙利亚,晋级世预赛12强赛,国足会在12强赛中取得怎样的成绩呢?
- t6服务器验证密码失败,用友T6软件T6服务无法启动,提示SA密码错误
- Educational Codeforces Round 91 (Rated for Div. 2) D. Berserk And Fireball
- OSChina 周四乱弹 —— 人类首张黑洞照片
- 数论进阶——莫比乌斯反演
- html制作好看的五子棋(源码)
- 解决问题:Unable to connect to Redis