Commit 68881eaf by 翁国栋

Merge remote-tracking branch 'origin/feature_20230426_test' into feature_20230426_test

parents 632b2d01 ab8133df
package cn.timer.api.bean.crm;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
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.*;
import java.util.Date;
/**
* Title: 客户跟进动态日志表
*
* @Description:
* @author wuqingjun
* @date 2023年7月31日
* @version 1.0
*/
@Entity
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "crm_client_log")
@ApiModel("客户跟进动态日志表")
public class CrmClientLog extends Model<CrmClientLog> {
private static final long serialVersionUID = -7362549097557018582L;
@Id
@GeneratedValue
@TableId(type = IdType.AUTO)
@ApiModelProperty(value = "编号")
private Integer id;
@ApiModelProperty(value = "客户数据id")
private Integer cid;
@ApiModelProperty(value = "变更前客户数据状态")
private Integer beforeClientStatus;
@ApiModelProperty(value = "变更后客户数据状态")
private Integer afterClientStatus;
@ApiModelProperty(value = "创建人")
private Integer createUser;
@ApiModelProperty(value = "企业id")
private Integer orgCode;
@ApiModelProperty(value = "创建人姓名")
private String createUserName;
@ApiModelProperty(value = "备注")
private String remark;
@TableField(fill = FieldFill.INSERT)
@ApiModelProperty(value = "创建时间")
private Date createTime;
}
......@@ -10,6 +10,9 @@ package cn.timer.api.dao.crm;
import java.util.List;
import cn.timer.api.dto.crm.CrmCartogramCountExportDto;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.RequestParam;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
......@@ -38,4 +41,41 @@ public interface CrmClientDataMapper extends BaseMapper<CrmClientData> {
@RequestParam(name = "belongGroup", required = false) Integer belongGroup,
@RequestParam(name = "startCreateTime", required = false) String startCreateTime,
@RequestParam(name = "endCreateTime", required = false) String endCreateTime);
}
List<CrmClientData> getCrmClientData(@Param("empNum") Integer empNum, @Param("orgCode") Integer orgCode,
@Param("groupId") Integer groupId, @Param("status") Integer status,
@Param("like") String like, @Param("startCreateTime") String startCreateTime,
@Param("endCreateTime") String endCreateTime, @Param("startFollowTime") String startFollowTime,
@Param("endFollowTime") String endFollowTime, @Param("typei") Integer typei,
@Param("unfollowedDays") Integer unfollowedDays, @Param("followNumber") Integer followNumber,
@Param("industry") Integer industry);
IPage<CrmClientData> getCrmClientData1(IPage<CrmClientData> page,
@Param("empNum") Integer empNum, @Param("orgCode") Integer orgCode,
@Param("groupId") Integer groupId, @Param("status") Integer status,
@Param("like") String like, @Param("startCreateTime") String startCreateTime,
@Param("endCreateTime") String endCreateTime, @Param("startFollowTime") String startFollowTime,
@Param("endFollowTime") String endFollowTime,@Param("type") Integer type,
@Param("ifPhone") String ifPhone,@Param("customerowner") String customerowner,
@Param("unfollowedDays") Integer unfollowedDays, @Param("followNumber") Integer followNumber,
@Param("industry") Integer industry);
IPage<CrmClientData> getCrmClientData2(IPage<CrmClientData> page,
@Param("empNum") Integer empNum, @Param("orgCode") Integer orgCode,
@Param("groupId") Integer groupId, @Param("status") Integer status,
@Param("like") String like, @Param("startCreateTime") String startCreateTime,
@Param("endCreateTime") String endCreateTime, @Param("startFollowTime") String startFollowTime,
@Param("endFollowTime") String endFollowTime,@Param("type") Integer type,
@Param("ifPhone") String ifPhone,@Param("customerowner") String customerowner,
@Param("unfollowedDays") Integer unfollowedDays, @Param("followNumber") Integer followNumber,
@Param("industry") Integer industry);
List<CrmClientData> getCrmClientData3(@Param("empNum") Integer empNum, @Param("orgCode") Integer orgCode,
@Param("groupId") Integer groupId, @Param("status") Integer status,
@Param("like") String like, @Param("startCreateTime") String startCreateTime,
@Param("endCreateTime") String endCreateTime, @Param("startFollowTime") String startFollowTime,
@Param("endFollowTime") String endFollowTime,@Param("type") Integer type,
@Param("ifPhone") String ifPhone,@Param("customerowner") String customerowner,
@Param("unfollowedDays") Integer unfollowedDays, @Param("followNumber") Integer followNumber,
@Param("industry") Integer industry);
}
\ No newline at end of file
......@@ -7,9 +7,16 @@
*/
package cn.timer.api.dao.crm;
import cn.timer.api.dto.crm.CrmCartogramCountExportDto;
import cn.timer.api.dto.crm.CrmClientFollowCountDto;
import cn.timer.api.dto.crm.CrmClientFollowCountParam;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.timer.api.bean.crm.CrmClientFollow;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
/**
* Title: CrmClientFollowMapper.java
......@@ -20,5 +27,25 @@ import cn.timer.api.bean.crm.CrmClientFollow;
* @version 1.0
*/
public interface CrmClientFollowMapper extends BaseMapper<CrmClientFollow> {
/**
* 根据条件查询 统计跟进数据
* @param param
* @return
*/
List<CrmClientFollowCountDto> selectCrmClientFollowCount(@Param("param") CrmClientFollowCountParam param);
/**
* 根据条件查询 统计跟进数据 需要显示的人数
* @param param
* @return
*/
List<CrmClientFollowCountDto> selectCrmClientFollowList(@Param("param") CrmClientFollowCountParam param);
/**
* 根据条件查询 统计跟进数据
* @param param
* @return
*/
Integer selectCountByParam(@Param("param") CrmClientFollowCountParam param);
}
package cn.timer.api.dao.crm;
import cn.timer.api.bean.crm.CrmClientLog;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* Title: 客户跟进动态日志表
*
* @Description:
* @author wuqingjun
* @date 2023年7月31日
* @version 1.0
*/
public interface CrmClientLogMapper extends BaseMapper<CrmClientLog> {
}
package cn.timer.api.dto.crm;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.awt.*;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
*
* @author wuqingjun
* @date 2023年7月28日
* @version 1.0
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class CrmClientFollowCountDto implements Serializable {
@ApiModelProperty(value = "跟进数")
private List<Integer> followCount;
@ApiModelProperty(value = "创建人")
private Integer createUser;
@ApiModelProperty(value = "创建人姓名")
private String createUserName;
@ApiModelProperty(value = "时间")
private String createTime;
}
package cn.timer.api.dto.crm;
import cn.timer.api.config.exception.ValidationMsg;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
/**
*
* @author wuqingjun
* @date 2023年7月28日
* @version 1.0
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class CrmClientFollowCountParam implements Serializable {
private static final long serialVersionUID = -1230023773946170911L;
/**
* 开始时间
*/
@ApiModelProperty(value = "开始时间")
private String startTime;
/**
* 结束时间
*/
@ApiModelProperty(value = "结束时间")
private String endTime;
/**
* 当前企业id
*/
@ApiModelProperty(value = "当前企业id")
private Integer orgCode;
/**
* 当前用户ID
*/
@ApiModelProperty(value = "当前用户ID")
private Integer createUser;
}
package cn.timer.api.dto.crm;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.List;
/**
*
* @author wuqingjun
* @date 2023年7月28日
* @version 1.0
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class CrmClientFollowListDto implements Serializable {
@ApiModelProperty(value = "时间")
private List<String> createStr;
private List<CrmClientFollowCountDto> dtos;
}
......@@ -3,12 +3,10 @@ package cn.timer.api.utils;
import java.text.Format;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.*;
import cn.hutool.core.util.StrUtil;
import org.springframework.util.StringUtils;
public class DateUtil {
......@@ -479,4 +477,40 @@ public class DateUtil {
calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMinimum(Calendar.DAY_OF_MONTH));
return dft.format(calendar.getTime());
}
/**
* 获取当前月的所有天数
* @param yearMonth
* @return
*/
public static List<String> getDayByMonth(String yearMonth){
List<String> list = new ArrayList<>();
if(StringUtils.isEmpty(yearMonth)){
return list;
}
String[] year_monnth = yearMonth.split("-");
Calendar calendar = Calendar.getInstance(Locale.CHINA);
calendar.set(Integer.parseInt(year_monnth[0]), Integer.parseInt(year_monnth[1])-1, 1);
int year = calendar.get(Calendar.YEAR);//年份
int month = calendar.get(Calendar.MONTH) + 1;//月份
int day = calendar.getActualMaximum(Calendar.DATE);
for (int i = 1; i <= day; i++) {
String date=null;
if(month<10 && i<10){
date = String.valueOf(year)+"-0"+month+"-0"+i;
}
if(month<10 && i>=10){
date = String.valueOf(year)+"-0"+month+"-"+i;
}
if(month>=10 && i<10){
date = String.valueOf(year)+"-"+month+"-0"+i;
}
if(month>=10 && i>=10){
date = String.valueOf(year)+"-"+month+"-"+i;
}
list.add(date);
}
return list;
}
}
......@@ -6,11 +6,12 @@
<select id="crmCartogram"
resultType="cn.timer.api.dto.crm.CrmCartogramDto">
SELECT
province_id,province as provinceName,count(province_id) num
province_id,city as provinceName,count(address) num
FROM
crm_client_data
WHERE
org_code = #{orgCode}
and client_cellphone != ''
<if test='null != belongUser and belongUser !=""'>AND
belong_user = #{belongUser}
</if>
......@@ -24,7 +25,7 @@
create_time <![CDATA[<=]]> #{endCreateTime}
</if>
GROUP BY
province_id
city
</select>
<select id="selectCrmCartogramCount" resultType="cn.timer.api.dto.crm.CrmCartogramCountExportDto">
SELECT belong_user_name,
......@@ -50,4 +51,192 @@
</where>
GROUP BY ccd.belong_user
</select>
<select id="getCrmClientData" resultType="CrmClientData">
SELECT *
FROM crm_client_data ccd
WHERE ccd.org_code = #{orgCode}
AND ccd.belong_user = #{empNum}
<if test="industry != null and industry > 0">
AND ccd.industry = #{industry}
</if>
<if test="groupId != null and groupId > 0">
AND ccd.belong_group = #{groupId}
</if>
<if test="status != null and status > 0">
AND ccd.client_status = #{status}
</if>
<if test="typei != null and typei > 0">
AND ccd.client_type = #{typei}
</if>
<if test="startCreateTime != null and endCreateTime != null">
AND ccd.create_time BETWEEN #{startCreateTime} AND #{endCreateTime}
</if>
<if test="startFollowTime != null and endFollowTime != null">
AND ccd.last_follow_time BETWEEN #{startFollowTime} AND #{endFollowTime}
</if>
<if test="like != null and like.trim().length() > 0">
AND (ccd.belong_user_name LIKE CONCAT('%', #{like}, '%')
OR ccd.client_name LIKE CONCAT('%', #{like}, '%')
OR ccd.client_cellphone LIKE CONCAT('%', #{like}, '%'))
</if>
<if test="unfollowedDays != null and unfollowedDays > 0">
AND DATEDIFF(NOW(), (SELECT MAX(last_follow_time) FROM crm_client_follow ccf WHERE ccf.cid = ccd.id)) >= #{unfollowedDays}
</if>
<if test="followNumber != null and followNumber > 0">
AND (
SELECT COUNT(*)
FROM crm_client_follow ccf
WHERE ccf.cid = ccd.id
) >= #{followNumber}
</if>
ORDER BY ccd.create_time DESC
</select>
<select id="getCrmClientData1" resultType="CrmClientData">
SELECT ccd.*
FROM crm_client_data ccd
WHERE ccd.org_code = #{orgCode}
AND ccd.belong_user = #{empNum}
<if test="industry != null and industry > 0">
AND ccd.industry = #{industry}
</if>
<if test="groupId != null and groupId >= 0">
AND ccd.belong_group = #{groupId}
</if>
<if test="type != null and type >= 0">
AND ccd.client_type = #{type}
</if>
<if test="ifPhone != null and ifPhone != '' and ifPhone == '1'">
AND ccd.client_cellphone LIKE '%1'
</if>
<if test="ifPhone != null and ifPhone != '' and ifPhone == '2'">
AND (ccd.client_cellphone IS NULL OR ccd.client_cellphone = '')
</if>
<if test="status != null and status >= 0">
AND ccd.client_status = #{status}
</if>
<if test="customerowner != null and customerowner != ''">
AND ccd.belong_user_name LIKE CONCAT('%', #{customerowner}, '%')
</if>
<if test="startCreateTime != null and startCreateTime != '' and endCreateTime != null and endCreateTime != '' ">
AND ccd.create_time BETWEEN #{startCreateTime} AND #{endCreateTime}
</if>
<if test="startFollowTime != null and endFollowTime != null">
AND ccd.last_follow_time BETWEEN #{startFollowTime} AND #{endFollowTime}
</if>
<if test="like != null and like.trim().length() > 0">
AND (ccd.client_name LIKE CONCAT('%', #{like}, '%') OR ccd.client_cellphone LIKE CONCAT('%', #{like}, '%'))
</if>
<if test="unfollowedDays != null and unfollowedDays > 0">
AND DATEDIFF(NOW(), (SELECT MAX(last_follow_time) FROM crm_client_follow ccf WHERE ccf.cid = ccd.id)) >= #{unfollowedDays}
</if>
<if test="followNumber != null and followNumber > 0">
AND (
SELECT COUNT(*)
FROM crm_client_follow
WHERE cid = ccd.id
) >= #{followNumber}
</if>
ORDER BY ccd.create_time DESC
</select>
<select id="getCrmClientData2" resultType="CrmClientData">
SELECT *
FROM crm_client_data ccd
WHERE ccd.org_code = #{orgCode}
AND ccd.belong_user = #{empNum}
<if test="industry != null and industry > 0">
AND ccd.industry = #{industry}
</if>
<if test="groupId != null and groupId >= 0">
AND ccd.belong_group = #{groupId}
</if>
<if test="type != null and type >= 0">
AND ccd.client_type = #{type}
</if>
<if test="customerowner != null and customerowner != ''">
AND ccd.belong_user_name LIKE CONCAT('%', #{customerowner}, '%')
</if>
<if test="status != null and status >= 0">
AND ccd.client_status = #{status}
</if>
<if test="keywordStr != null and keywordStr != ''">
AND ccd.belong_group IN (${keywordStr})
</if>
<if test="ifPhone != null and ifPhone != '' and ifPhone == '1'">
AND ccd.client_cellphone LIKE '%1'
</if>
<if test="ifPhone != null and ifPhone != '' and ifPhone == '2'">
AND (ccd.client_cellphone IS NULL OR ccd.client_cellphone = '')
</if>
<if test="startCreateTime != null and startCreateTime != '' and endCreateTime != null and endCreateTime != '' ">
AND ccd.create_time BETWEEN #{startCreateTime} AND #{endCreateTime}
</if>
<if test="startFollowTime != null and endFollowTime != null">
AND ccd.last_follow_time BETWEEN #{startFollowTime} AND #{endFollowTime}
</if>
<if test="like != null and like.trim().length() > 0">
AND (ccd.client_name LIKE CONCAT('%', #{like}, '%') OR ccd.client_cellphone LIKE CONCAT('%', #{like}, '%'))
</if>
<if test="unfollowedDays != null and unfollowedDays > 0">
AND DATEDIFF(NOW(), (SELECT MAX(last_follow_time) FROM crm_client_follow ccf WHERE ccf.cid = ccd.id)) >= #{unfollowedDays}
</if>
<if test="followNumber != null and followNumber > 0">
AND (
SELECT COUNT(*)
FROM crm_client_follow
WHERE cid = ccd.id
) >= #{followNumber}
</if>
ORDER BY ccd.create_time DESC;
</select>
<select id="getCrmClientData3" resultType="CrmClientData">
SELECT *
FROM crm_client_data ccd
WHERE ccd.belong_group = #{gid}
<if test="industry != null and industry > 0">
AND ccd.industry = #{industry}
</if>
<if test="groupId != null and groupId >= 0">
AND ccd.belong_group = #{groupId}
</if>
<if test="type != null and type >= 0">
AND ccd.client_type = #{type}
</if>
<if test="customerowner != null and customerowner != ''">
AND ccd.belong_user_name LIKE CONCAT('%', #{customerowner}, '%')
</if>
<if test="status != null and status >= 0">
AND ccd.client_status = #{status}
</if>
<if test="ifPhone != null and ifPhone != '' and ifPhone == '1'">
AND ccd.client_cellphone LIKE '%1'
</if>
<if test="ifPhone != null and ifPhone != '' and ifPhone == '2'">
AND (ccd.client_cellphone IS NULL OR ccd.client_cellphone = '')
</if>
<if test="startCreateTime != null and startCreateTime != '' and endCreateTime != null and endCreateTime != '' ">
AND ccd.create_time BETWEEN #{startCreateTime} AND #{endCreateTime}
</if>
<if test="startFollowTime != null and endFollowTime != null">
AND ccd.last_follow_time BETWEEN #{startFollowTime} AND #{endFollowTime}
</if>
<if test="like != null and like.trim().length() > 0">
AND (ccd.client_name LIKE CONCAT('%', #{like}, '%') OR ccd.client_cellphone LIKE CONCAT('%', #{like}, '%'))
</if>
<if test="unfollowedDays != null and unfollowedDays > 0">
AND DATEDIFF(NOW(), (SELECT MAX(last_follow_time) FROM crm_client_follow ccf WHERE ccf.cid = ccd.id)) >= #{unfollowedDays}
</if>
<if test="followNumber != null and followNumber > 0">
AND (
SELECT COUNT(*)
FROM crm_client_follow
WHERE cid = ccd.id
) >= #{followNumber}
</if>
ORDER BY ccd.create_time DESC;
</select>
</mapper>
\ No newline at end of file
<?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.CrmClientFollowMapper">
<select id="selectCrmClientFollowCount" resultType="cn.timer.api.dto.crm.CrmClientFollowCountDto">
SELECT
create_user_name createUserName,
create_user createUser,
DATE(create_time) AS createTime,
COUNT(*) AS followCount
FROM
crm_client_follow
<where>
<if test='null != param.startTime and param.startTime !=""'>
AND create_time <![CDATA[>=]]> #{param.startTime}
</if>
<if test='null != param.endTime and param.endTime !=""'>
AND create_time <![CDATA[<=]]> #{param.endTime}
</if>
<if test='null != param.orgCode and param.orgCode !=""'>
AND org_code = #{param.orgCode}
</if>
</where>
GROUP BY
createUser, DATE(create_time)
ORDER BY
createUser, DATE(create_time);
</select>
<select id="selectCrmClientFollowList" resultType="cn.timer.api.dto.crm.CrmClientFollowCountDto">
SELECT
create_user_name createUserName,
create_user createUser
FROM
crm_client_follow
<where>
<if test='null != param.startTime and param.startTime !=""'>
AND create_time <![CDATA[>=]]> #{param.startTime}
</if>
<if test='null != param.endTime and param.endTime !=""'>
AND create_time <![CDATA[<=]]> #{param.endTime}
</if>
<if test='null != param.orgCode and param.orgCode !=""'>
AND org_code = #{param.orgCode}
</if>
</where>
GROUP BY
createUser
ORDER BY
createUser
</select>
<select id="selectCountByParam" resultType="int">
SELECT
COUNT(*)
FROM
crm_client_follow
<where>
<if test='null != param.startTime and param.startTime !=""'>
AND DATE(create_time) = #{param.startTime}
</if>
<if test='null != param.createUser and param.createUser !=""'>
AND create_user = #{param.createUser}
</if>
<if test='null != param.orgCode and param.orgCode !=""'>
AND org_code = #{param.orgCode}
</if>
</where>
</select>
</mapper>
\ No newline at end of file
<?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.CrmClientLogMapper">
</mapper>
\ No newline at end of file
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