Commit a03ba7f1 by 284718418@qq.com

新增的潜在客户数量,跟进的客户数量(拜访、电联),按天,周,月,年的统计

parent d6a41d78
......@@ -6,6 +6,7 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.net.URL;
import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.util.*;
import java.util.stream.Collectors;
......@@ -14,9 +15,10 @@ import cn.timer.api.bean.crm.*;
import cn.timer.api.bean.insure.InsurePolicy;
import cn.timer.api.bean.insure.InsureProductPlan;
import cn.timer.api.controller.zpgl.sevice.ZpglService;
import cn.timer.api.dao.crm.CrmClientFollowMapper;
import cn.timer.api.dao.crm.CrmRemindRuleMapper;
import cn.timer.api.dto.clazz.CityClazzDto;
import cn.timer.api.dto.crm.CrmCartogramCountExportDto;
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;
......@@ -60,8 +62,6 @@ import cn.timer.api.controller.kqgl.ClockInTool;
import cn.timer.api.dao.crm.CrmClientContactsMapper;
import cn.timer.api.dao.crm.CrmClientDataMapper;
import cn.timer.api.dao.qyzx.QyzxEmpEntAssoMapper;
import cn.timer.api.dto.crm.CrmCartogramDto;
import cn.timer.api.dto.crm.CrmClientDataImportVo;
import cn.timer.api.dto.kqmk.DailyDetailsDto;
import cn.timer.api.dto.xcgl.ImportDescriptionDto;
import cn.timer.api.utils.CheckUtil;
......@@ -101,6 +101,8 @@ public class CrmController {
@Autowired
private CrmRemindRuleMapper crmRemindRuleMapper;
@Autowired
private CrmClientFollowMapper crmClientFollowMapper;
private Integer getEmpNum(UserBean userBean) {
return userBean.getEmpNum();
......@@ -1251,6 +1253,29 @@ public class CrmController {
listAll.add(cartogram6);
// 跟进图
listAll.add(cartogram(orgCode, groupId, 7, belonger, startCreateTime, endCreateTime));
// 新增潜在客户数量跟进的客户数量
Calendar calendar= Calendar.getInstance();
SimpleDateFormat dateFormat= new SimpleDateFormat("yyyy-MM");
List<String> list = cn.timer.api.utils.DateUtil.getDayByMonth(dateFormat.format(calendar.getTime()));
CrmClientFollowCountParam param = new CrmClientFollowCountParam();
param.setStartTime(startCreateTime);
if(org.springframework.util.StringUtils.isEmpty(startCreateTime)){
calendar.set(Calendar.DAY_OF_MONTH, 1);
SimpleDateFormat df= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
param.setStartTime(df.format(calendar.getTime()));
}
if(org.springframework.util.StringUtils.isEmpty(endCreateTime)){
param.setEndTime(list.get(list.size()-1)+" 23:59:59");
}
//
List<CrmClientFollowCountDto> crm = crmClientFollowMapper.selectCrmClientFollowCount(param);
for (String day:list) {
}
listAll.add(null);
return ResultUtil.data(listAll, "获取成功");
}
......
......@@ -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,12 @@ 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);
}
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.io.Serializable;
import java.util.Date;
/**
*
* @author wuqingjun
* @date 2023年7月28日
* @version 1.0
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class CrmClientFollowCountDto implements Serializable {
@ApiModelProperty(value = "跟进数")
private 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;
}
......@@ -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;
}
}
<?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
create_user_name, DATE(create_time)
ORDER BY
create_user_name, DATE(create_time);
</select>
</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