Commit 16338669 by 翁国栋

8小时提醒点击详情跳转到页面

parent ca7b13fb
......@@ -84,3 +84,7 @@ ALTER TABLE `timer_test_0620`.`crm_client_follow`
ADD COLUMN `contract_end_date` datetime NULL COMMENT '合同到期时间' AFTER `client_status`,
ADD COLUMN `contract_signing_date` varchar(50) NULL COMMENT '签约时间' AFTER `contract_end_date`;
ALTER TABLE `crm_remind_rule`
ADD COLUMN `crm_client_follow_id` int(11) NULL DEFAULT NULL COMMENT '跟进记录id' AFTER `user_name`;
ADD COLUMN `is_remind` tinyint(1) NULL DEFAULT 0 COMMENT '是否已提醒0.未 1.已提醒' AFTER `crm_client_follow_id`;
......@@ -69,4 +69,10 @@ public class CrmRemindRule extends Model<CrmRemindRule> {
private String userName;
private Integer crmClientFollowId;
private Integer isRemind;
}
......@@ -13,6 +13,7 @@ import java.util.*;
import java.util.stream.Collectors;
import cn.timer.api.bean.crm.*;
import cn.timer.api.bean.htzz.HtzzAssoHtgx;
import cn.timer.api.bean.insure.InsurePolicy;
import cn.timer.api.bean.insure.InsureProductPlan;
import cn.timer.api.bean.qyzx.QyzxEmpLogin;
......@@ -24,6 +25,7 @@ import cn.timer.api.dto.crm.*;
import cn.timer.api.dto.insure.PolicyDto;
import cn.timer.api.dto.yggl.YgCityDto;
import cn.timer.api.utils.ExcelUtils;
import io.swagger.models.auth.In;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.checkerframework.checker.units.qual.A;
import org.slf4j.Logger;
......@@ -1066,6 +1068,7 @@ public class CrmController {
crmRemindRule.setOrgCode(userBean.getOrgCode());
crmRemindRule.setUserName(oldData.getClientName());
crmRemindRule.setCreateTime(new Date());
crmRemindRule.setCrmClientFollowId(crmClientFollow.getId());
crmRemindRule.insert();
}
/*** 客户跟进动态日志 ***/
......@@ -2050,57 +2053,15 @@ public class CrmController {
if (endFollowTime != null && !("").equals(endFollowTime)) {
endFollowTime = endFollowTime.substring(0, 10) + " 23:59:59";
}
QyzxEmpEntAsso qyzxEmpEntAsso = QyzxEmpEntAsso.builder().build()
.selectOne(new LambdaQueryWrapper<QyzxEmpEntAsso>().eq(QyzxEmpEntAsso::getOrgCode, orgCode)
.eq(QyzxEmpEntAsso::getEmpNum, empNum));
if (qyzxEmpEntAsso != null && qyzxEmpEntAsso.getUserType() != null
&& (qyzxEmpEntAsso.getUserType() == SysRoleType.U_TYPE_ADMIN.getType()
|| qyzxEmpEntAsso.getUserType() == SysRoleType.U_TYPE_C_ADMIN.getType())) {
IPage<CrmClientData> page = new Page<CrmClientData>(pageNumber, pageSize);
List<CrmBusinessGroupMember> grouplis = CrmBusinessGroupMember.builder().build().selectList(new QueryWrapper<CrmBusinessGroupMember>().lambda().eq(CrmBusinessGroupMember::getEmpNum, userBean.getEmpNum())
.eq(CrmBusinessGroupMember::getOrgCode, userBean.getOrgCode()));
String keywordStr = "";
IPage<CrmClientData> datas;
Integer count = new LambdaQueryChainWrapper<QyzxEmpEntAsso>(qyzxEmpEntAssoMapper)
.eq(QyzxEmpEntAsso::getEmpNum, userBean.getEmpNum())
.eq(QyzxEmpEntAsso::getOrgCode, userBean.getOrgCode())
.in(QyzxEmpEntAsso::getUserType, "0,1")
.count();
if(count > 0) {
datas = crmClientDataMapper.getCrmClientData4(page,empNum, orgCode, groupId, status, like,startCreateTime,endCreateTime,startFollowTime,endFollowTime,type,ifPhone,customerowner,unfollowedDays,followNumber,industry,remindDay);
}else {
if(grouplis.size()>0 && grouplis != null) {
StringBuffer sb = new StringBuffer();
for(CrmBusinessGroupMember grp : grouplis) {
sb.append(grp.getGid()).append(",");
}
keywordStr = sb.deleteCharAt(sb.length() - 1).toString();
}
datas = crmClientDataMapper.getCrmClientData5(page,empNum, orgCode, groupId, status, like,startCreateTime,endCreateTime,startFollowTime,endFollowTime,type,ifPhone,customerowner,unfollowedDays,followNumber,industry,remindDay);
}
return ResultUtil.pageData(datas.getRecords(), datas.getTotal(), "查询成功");
} else {
// 当前用户管理的组
List<Integer> gids = MyManageGroup(empNum, orgCode);
List<CrmClientData> crmClientDatas = new ArrayList<CrmClientData>();
if(gids.size()>0) {
for (Integer gid : gids) {
List<CrmClientData> datas = crmClientDataMapper.getCrmClientData6(empNum, orgCode, groupId, status, like, startCreateTime, endCreateTime, startFollowTime, endFollowTime, type, ifPhone, customerowner, unfollowedDays, followNumber, industry,gid,remindDay);
for (CrmClientData data : datas)
List<CrmClientData> datas = crmClientDataMapper.getCrmClientData6(empNum, orgCode, groupId, status, like, startCreateTime, endCreateTime, startFollowTime, endFollowTime, type, ifPhone, customerowner, unfollowedDays, followNumber, industry,null,remindDay);
for (CrmClientData data : datas){
crmClientDatas.add(data);
}
}
List<CrmClientData> result = getPageList(crmClientDatas, pageNumber, pageSize,
Comparator.comparing(CrmClientData::getCreateTime).reversed());
return ResultUtil.pageData(result, (long) crmClientDatas.size(), "查询成功");
}
}
@PostMapping(value = "/get_crm_top_count")
......@@ -2134,4 +2095,25 @@ public class CrmController {
return ResultUtil.data(crmClientFollowMapper.getFollowLine(param), "成功");
}
@ApiOperation(value = "获取待提醒跟进客户列表")
@PostMapping(value = "/get_remind_follow_List")
public Result<Object> get_remind_follow_List(@CurrentUser UserBean userBean) {
String today=DateUtil.today();
List<CrmRemindRule> crmRemindRuleList = CrmRemindRule.builder().build().selectList(new QueryWrapper<CrmRemindRule>().lambda()
.eq(CrmRemindRule::getCrmGroupMember,userBean.getEmpNum()).eq(CrmRemindRule::getDeleteFlag,0)
.eq(CrmRemindRule::getOrgCode,userBean.getOrgCode()).le(CrmRemindRule::getRemindDay,today));
return ResultUtil.data(crmRemindRuleList, "成功");
}
@ApiOperation(value = "更改为已读状态")
@GetMapping(value = "/updateRemindRule")
public Result<Object> updateRemindRule(@CurrentUser UserBean userBean, @RequestParam("id") Integer id) {
CrmRemindRule crmRemindRule = CrmRemindRule.builder().id(id).build();
if(crmRemindRule!=null) {
crmRemindRule.setIsRemind(1);
crmRemindRule.updateById();
}
return ResultUtil.data("成功");
}
}
......@@ -46,27 +46,27 @@ public class CrmRuleTaskTiming {
private CrmRemindRuleMapper crmRemindRuleMapper;
//提醒时间到了
@Scheduled(cron = "0 0 4 * * ?") // 每日4点扫描
@Transactional
public void getTimeRules() {
String today=DateUtil.today();
List<CrmRemindRule> crmRemindRuleList = crmRemindRuleMapper.selectCrmRemindRuleList(today);
if(crmRemindRuleList!=null&&crmRemindRuleList.size()>0){
//发送系统通知
crmRemindRuleList.forEach(v->{
AdminAssoTxjlb adminAssoTxjlb = AdminAssoTxjlb.builder().build();
adminAssoTxjlb.setEmpNum(v.getCrmGroupMember());
adminAssoTxjlb.setOrgCode(v.getOrgCode());
adminAssoTxjlb.setUserName(v.getUserName());
adminAssoTxjlb.setTxType(1);
adminAssoTxjlb.setTxstate(0);
adminAssoTxjlb.setContent("您有一位客户["+v.getUserName()+"]需要跟进");
adminAssoTxjlb.setAddtime(new Date().getTime());
adminAssoTxjlb.insert();
v.setDeleteFlag(1);
v.updateById();
});
}
}
// @Scheduled(cron = "0 0 0/10 * * ? ") // 每日十小时扫描
// @Transactional
// public void getTimeRules() {
// String today=DateUtil.today();
// List<CrmRemindRule> crmRemindRuleList = crmRemindRuleMapper.selectCrmRemindRuleList(today);
// if(crmRemindRuleList!=null&&crmRemindRuleList.size()>0){
// //发送系统通知
// crmRemindRuleList.forEach(v->{
// AdminAssoTxjlb adminAssoTxjlb = AdminAssoTxjlb.builder().build();
// adminAssoTxjlb.setEmpNum(v.getCrmGroupMember());
// adminAssoTxjlb.setOrgCode(v.getOrgCode());
// adminAssoTxjlb.setUserName(v.getUserName());
// adminAssoTxjlb.setTxType(1);
// adminAssoTxjlb.setTxstate(0);
// adminAssoTxjlb.setContent("您有一位客户["+v.getUserName()+"]需要跟进");
// adminAssoTxjlb.setAddtime(new Date().getTime());
// adminAssoTxjlb.insert();
// v.setIsRemind(1);
// v.updateById();
// });
// }
// }
}
......@@ -14,6 +14,8 @@
<result property="deleteFlag" column="delete_flag"/>
<result property="orgCode" column="org_code"/>
<result property="userName" column="user_name"/>
<result property="crmClientFollowId" column="crm_client_follow_id"/>
<result property="isRemind" column="is_remind"/>
</resultMap>
<select id="selectById" resultType="cn.timer.api.bean.crm.CrmRemindRule">
......@@ -35,6 +37,8 @@
<if test="deleteFlag != null">,`delete_flag`</if>
<if test="orgCode != null">,`org_code`</if>
<if test="userName != null">,`user_name`</if>
<if test="crmClientFollowId != null">,`crm_client_follow_id`</if>
<if test="isRemind != null">,`is_remind`</if>
)
values
(
......@@ -46,6 +50,8 @@
<if test="deleteFlag != null">,#{deleteFlag}</if>
<if test="orgCode != null">,#{orgCode}</if>
<if test="userName != null">,#{userName}</if>
<if test="crmClientFollowId != null">,#{crmClientFollowId}</if>
<if test="isRemind != null">,#{isRemind}</if>
)
</insert>
......@@ -61,6 +67,8 @@
<if test="deleteFlag != null">`create_time` = #{delete_flag}</if>
<if test="orgCode != null">`org_code` = #{orgCode}</if>
<if test="userName != null">`user_name` = #{userName}</if>
<if test="crmClientFollowId != null">`crm_client_follow_id` = #{crmClientFollowId}</if>
<if test="isRemind != null">`is_remind` = #{isRemind}</if>
</set>
where id = #{id}
</update>
......@@ -81,7 +89,7 @@
<select id="selectCrmRemindRuleList" resultType="cn.timer.api.bean.crm.CrmRemindRule">
select *
from crm_remind_rule
where delete_flag = 0 and remind_day>=#{remindDay}
where delete_flag = 0 and is_remind=0 and remind_day>=#{remindDay}
</select>
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment