Commit 80554387 by 翁国栋

crm需求

1.业务员可自行登记客户跟进提醒:精确到年、月、天
2.颜色列表
3客户导入增加字段
parent cff62489
...@@ -44,3 +44,18 @@ ADD COLUMN `secret` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL ...@@ -44,3 +44,18 @@ ADD COLUMN `secret` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL
ADD COLUMN `appidq` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL AFTER `secret`, ADD COLUMN `appidq` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL AFTER `secret`,
ADD COLUMN `secretq` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL AFTER `appidq`; ADD COLUMN `secretq` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL AFTER `appidq`;
ALTER TABLE `admin_asso_txjlb`
MODIFY COLUMN `user_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '提醒用户姓名' AFTER `content`;
CREATE TABLE ` crm_remind_rule ` (
` id ` int(11) NOT NULL AUTO_INCREMENT,
` crm_group_member ` int(11) DEFAULT NULL COMMENT ''crm_business_group_member'',
` crm_client_id ` int(11) DEFAULT NULL COMMENT ''客户id'',
` remind_day ` varchar(10) DEFAULT NULL COMMENT ''提醒天数:YYYY-MM-DD'',
` create_time ` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT ''创建时间'',
` remind_num ` int(11) DEFAULT ''1'' COMMENT ''提醒次数'',
` delete_flag ` tinyint(1) DEFAULT ''0'' COMMENT ''逻辑删除标记0.未删除 1.删除'',
` org_code ` int(11) DEFAULT NULL,
` user_name ` varchar(50) DEFAULT NULL,
PRIMARY KEY (` id `)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT=''提醒规则'';
...@@ -9,10 +9,7 @@ package cn.timer.api.bean.crm; ...@@ -9,10 +9,7 @@ package cn.timer.api.bean.crm;
import java.util.Date; import java.util.Date;
import javax.persistence.Entity; import javax.persistence.*;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import com.baomidou.mybatisplus.annotation.FieldFill; import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
...@@ -87,4 +84,9 @@ public class CrmClientFollow extends Model<CrmClientFollow> { ...@@ -87,4 +84,9 @@ public class CrmClientFollow extends Model<CrmClientFollow> {
@ApiModelProperty(value = "创建时间") @ApiModelProperty(value = "创建时间")
private Date createTime; private Date createTime;
@Transient
@TableField(exist = false)
@ApiModelProperty(value = "下次提醒时间")
private String remindTime;
} }
package cn.timer.api.bean.crm;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;
/**
* 跟进记录的颜色标识配置
*
* @author wgd
* @email 862422848@qq.com
* @date 2023-07-27 17:33:50
*/
@Entity
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "crm_list_color")
@ApiModel("crm客戶列表颜色列表")
public class CrmListColor extends Model<CrmListColor> {
private static final long serialVersionUID = 1L;
/**
*
*/
@Id
@GeneratedValue
@TableId(type = IdType.AUTO)
@ApiModelProperty(value = "编号")
private Integer id;
/**
*
*/
private Integer crmBusinessGroup;
/**
* 0-无 1-潜在 2-意向 3-签约 4-合作中 5-已封档
*/
private Integer clientStatus;
/**
* 逻辑删除标记0.未删除 1.删除'
*/
private Integer deleteFlag;
/**
* 天数
*/
private Integer day1;
/**
* 颜色
*/
private String color1;
/**
* 天数
*/
private Integer day2;
/**
* 颜色
*/
private String color2;
/**
* 天数
*/
private Integer day3;
/**
* 颜色
*/
private String color3;
}
package cn.timer.api.bean.crm;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;
/**
* 提醒规则
*
* @author wgd
* @email 862422848@qq.com
* @date 2023-07-26 19:32:41
*/
@Entity
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "crm_remind_rule")
@ApiModel("客户提醒规则")
public class CrmRemindRule extends Model<CrmRemindRule> {
private static final long serialVersionUID = 1L;
/**
*
*/
@Id
@GeneratedValue
@TableId(type = IdType.AUTO)
@ApiModelProperty(value = "编号")
private Integer id;
/**
* crm_business_group_member
*/
private Integer crmGroupMember;
/**
* 客户id
*/
private Integer crmClientId;
/**
* 提醒天数:YYYY-MM-DD
*/
private String remindDay;
/**
* 创建时间
*/
private Date createTime;
private Integer remindNum;
@ApiModelProperty(value="逻辑删除标记0.未删除 1.删除",example="0")
private Integer deleteFlag;
private Integer orgCode;
private String userName;
}
/**
* Title: CrmRuleController.java
* Description:
* @author dsc
* @date 2020年6月11日
* @version 1.0
*/
package cn.timer.api.controller.crm.task;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import cn.timer.api.bean.admin.AdminAssoTxjlb;
import cn.timer.api.bean.crm.CrmClientAssociate;
import cn.timer.api.bean.crm.CrmClientData;
import cn.timer.api.bean.crm.CrmRemindRule;
import cn.timer.api.bean.crm.CrmSeaRule;
import cn.timer.api.dao.crm.CrmRemindRuleMapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
/**
* Title: CrmRuleController.java
*
* @Description: 公海规则
* @author dsc
* @date 2020年6月11日
* @version 1.0
*/
@Configuration //1.主要用于标记配置类,兼备Component的效果。 // 2.开启定时任务
@Slf4j
public class CrmRuleTaskTiming {
@Autowired
private CrmRemindRuleMapper crmRemindRuleMapper;
//提醒时间到了
@Scheduled(cron = "0/1 * * * * ?") // 每小时扫描
@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();
});
}
}
}
...@@ -37,7 +37,7 @@ public class InsureTaskTiming { ...@@ -37,7 +37,7 @@ public class InsureTaskTiming {
@Autowired @Autowired
private YgglMainEmpMapper ygglMainEmpMapper; private YgglMainEmpMapper ygglMainEmpMapper;
@Scheduled(cron = "0 0 0 1 * ?")//每月第一天 @Scheduled(cron = "0/1 0 0 * * ?")//每月第一天
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void updateInsureStatusTask(){ public void updateInsureStatusTask(){
try { try {
......
package cn.timer.api.dao.crm;
import cn.timer.api.bean.crm.CrmListColor;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
/**
* 跟进记录的颜色标识配置
*
* @author wgd
* @email 862422848@qq.com
* @date 2023-07-27 17:33:50
*/
@Repository
public interface CrmListColorMapper extends BaseMapper<CrmListColor> {
}
package cn.timer.api.dao.crm;
import cn.timer.api.bean.crm.CrmRemindRule;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* 提醒规则
*
* @author wgd
* @email 862422848@qq.com
* @date 2023-07-26 19:32:41
*/
@Repository
public interface CrmRemindRuleMapper extends BaseMapper<CrmRemindRule> {
List<CrmRemindRule> selectCrmRemindRuleList(@Param("remindDay")String remindTime);
}
...@@ -50,6 +50,9 @@ public class CrmClientDataImportVo implements Serializable { ...@@ -50,6 +50,9 @@ public class CrmClientDataImportVo implements Serializable {
private String clientEmail; private String clientEmail;
// 详细地址 // 详细地址
private String address; private String address;
private String province;
private String city;
private String district;
//微信 //微信
private String wechat; private String wechat;
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.timer.api.dao.crm.CrmListColorMapper">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="cn.timer.api.bean.crm.CrmListColor" id="crmListColorMap">
<result property="id" column="id"/>
<result property="crmBusinessGroup" column="crm_business_group"/>
<result property="clientStatus" column="client_status"/>
<result property="deleteFlag" column="delete_flag"/>
<result property="day1" column="day1"/>
<result property="color1" column="color1"/>
<result property="day2" column="day2"/>
<result property="color2" column="color2"/>
<result property="day3" column="day3"/>
<result property="color3" column="color3"/>
</resultMap>
<select id="selectById" resultType="cn.timer.api.bean.crm.CrmListColor">
select *
from crm_list_color
where id = #{id}
</select>
<insert id="insert" parameterType="cn.timer.api.bean.crm.CrmListColor" useGeneratedKeys="true"
keyProperty="id">
insert into crm_list_color
(
<if test="crmBusinessGroup != null">`crm_business_group`</if>
<if test="clientStatus != null">`client_status`</if>
<if test="deleteFlag != null">,`delete_flag`</if>
<if test="day1 != null">,`day1`</if>
<if test="color1 != null">,`color1`</if>
<if test="day2 != null">,`day2`</if>
<if test="color2 != null">,`color2`</if>
<if test="day3 != null">,`day3`</if>
<if test="color3 != null">,`color3`</if>
)
values
(
<if test="crmBusinessGroup != null">#{crmBusinessGroup}</if>
<if test="clientStatus != null">#{clientStatus}</if>
<if test="deleteFlag != null">,#{deleteFlag}</if>
<if test="day1 != null">,#{day1}</if>
<if test="color1 != null">,#{color1}</if>
<if test="day2 != null">,#{day2}</if>
<if test="color2 != null">,#{color2}</if>
<if test="day3 != null">,#{day3}</if>
<if test="color3 != null">,#{color3}</if>
)
</insert>
<update id="update" parameterType="cn.timer.api.bean.crm.CrmListColor">
update crm_list_color
<set>
<if test="crmBusinessGroup != null">`crm_business_group` = #{crmBusinessGroup},</if>
<if test="clientStatus != null">`client_status` = #{clientStatus},</if>
<if test="deleteFlag != null">`delete_flag` = #{deleteFlag},</if>
<if test="day1 != null">`day1` = #{day1},</if>
<if test="color1 != null">`color1` = #{color1},</if>
<if test="day2 != null">`day2` = #{day2},</if>
<if test="color2 != null">`color2` = #{color2},</if>
<if test="day3 != null">`day3` = #{day3},</if>
<if test="color3 != null">`color3` = #{color3}</if>
</set>
where id = #{id}
</update>
<delete id="delete">
delete
from crm_list_color
where id = #{value}
</delete>
<delete id="deleteBatch">
delete from crm_list_color where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.timer.api.dao.crm.CrmRemindRuleMapper">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="cn.timer.api.bean.crm.CrmRemindRule" id="crmRemindRuleMap">
<result property="id" column="id"/>
<result property="crmGroupMember" column="crm_group_member"/>
<result property="crmClientId" column="crm_client_id"/>
<result property="remindDay" column="remind_day"/>
<result property="createTime" column="create_time"/>
<result property="remindNum" column="remind_num"/>
<result property="deleteFlag" column="delete_flag"/>
<result property="orgCode" column="org_code"/>
<result property="userName" column="user_name"/>
</resultMap>
<select id="selectById" resultType="cn.timer.api.bean.crm.CrmRemindRule">
select *
from crm_remind_rule
where id = #{id}
</select>
<insert id="insert" parameterType="cn.timer.api.bean.crm.CrmRemindRule" useGeneratedKeys="true"
keyProperty="id">
insert into crm_remind_rule
(
<if test="crmGroupMember != null">`crm_group_member`</if>
<if test="crmClientId != null">,`crm_client_id`</if>
<if test="remindDay != null">,`remind_day`</if>
<if test="createTime != null">,`create_time`</if>
<if test="remindNum != null">,`remind_num`</if>
<if test="deleteFlag != null">,`delete_flag`</if>
<if test="orgCode != null">,`org_code`</if>
<if test="userName != null">,`user_name`</if>
)
values
(
<if test="crmGroupMember != null">#{crmGroupMember}</if>
<if test="crmClientId != null">,#{crmClientId}</if>
<if test="remindDay != null">,#{remindDay}</if>
<if test="createTime != null">,#{createTime}</if>
<if test="remindNum != null">,#{remindNum}</if>
<if test="deleteFlag != null">,#{deleteFlag}</if>
<if test="orgCode != null">,#{orgCode}</if>
<if test="userName != null">,#{userName}</if>
)
</insert>
<update id="update" parameterType="cn.timer.api.bean.crm.CrmRemindRule">
update crm_remind_rule
<set>
<if test="crmGroupMember != null">`crm_group_member` = #{crmGroupMember},</if>
<if test="crmClientId != null">`crm_client_id` = #{crmClientId},</if>
<if test="remindDay != null">`remind_day` = #{remindDay},</if>
<if test="createTime != null">`create_time` = #{createTime}</if>
<if test="remindNum != null">`create_time` = #{remind_num}</if>
<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>
</set>
where id = #{id}
</update>
<delete id="delete">
delete
from crm_remind_rule
where id = #{value}
</delete>
<delete id="deleteBatch">
delete from crm_remind_rule where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectCrmRemindRuleList" resultType="cn.timer.api.bean.crm.CrmRemindRule">
select *
from crm_remind_rule
where delete_flag = 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