0302-海宁管户报表优化+客群代码初稿
This commit is contained in:
@@ -97,6 +97,13 @@ public class GridCmpmController extends BaseController {
|
||||
return gridCmpmService.selectCustManagerResult();
|
||||
}
|
||||
|
||||
@GetMapping("/custManager/custLevel/list")
|
||||
@Log(title = "绩效网格-管户报表星级列表")
|
||||
@ApiOperation("管户报表星级列表")
|
||||
public AjaxResult getCustLevelListForManager() {
|
||||
return success(gridCmpmService.getCustLevelListForManager());
|
||||
}
|
||||
|
||||
@GetMapping("/custLevel/count")
|
||||
@Log(title = "绩效网格-查询客户分层等级")
|
||||
@ApiOperation("查询客户分层等级")
|
||||
|
||||
@@ -18,4 +18,8 @@ public class CustManagerDTO {
|
||||
@ApiModelProperty(value = "网点名",notes = "")
|
||||
private String branchId;
|
||||
|
||||
/** 状态类型:current(本月)、last(上月)、rise(上升)、fall(下降) */
|
||||
@ApiModelProperty(value = "状态类型", notes = "current(本月)、last(上月)、rise(上升)、fall(下降)")
|
||||
private String statusType;
|
||||
|
||||
}
|
||||
|
||||
@@ -152,6 +152,13 @@ public class GridCmpmService {
|
||||
return new DwbRetailResultVO();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取管户报表星级列表
|
||||
*/
|
||||
public List<String> getCustLevelListForManager() {
|
||||
return gridCmpmMapper.getCustLevelList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 每月定时设置统计数据
|
||||
*/
|
||||
@@ -226,7 +233,6 @@ public class GridCmpmService {
|
||||
// 获取上月各星级客户数
|
||||
Map<String, Integer> historyLevelCountMap = getCustLevelCountMap(custManagerDTO, "last");
|
||||
Map<String, Integer> custLevelCompLm = calculateLevelChanges(historyLevelCountMap, currentLevelCountMap);
|
||||
vo.setCustLevelCompLm(custLevelCompLm);
|
||||
|
||||
// 在 vo.setCustLevelCompLm 之前,按顺序重新组织数据
|
||||
String[] order = {"5星", "4星", "3星", "2星", "1星", "基础", "长尾"};
|
||||
|
||||
@@ -35,4 +35,12 @@ public interface RegionGridListService {
|
||||
|
||||
List<RegionGridListVO> getSecGridListByManager(RegionGridListDTO regionGridListDTO);
|
||||
|
||||
/**
|
||||
* 查询网格内所有客户(不限制客户类型,用于导入客群)
|
||||
* @param regionGrid 地理网格对象
|
||||
* @return 网格内所有客户列表
|
||||
*/
|
||||
List<RegionCustUser> selectAllCustFromGrid(RegionGrid regionGrid);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.ruoyi.ibs.grid.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.ruoyi.common.core.domain.entity.SysDept;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.common.utils.bean.BeanUtils;
|
||||
import com.ruoyi.ibs.draw.domain.dto.grid.CustCountDTO;
|
||||
@@ -429,4 +430,25 @@ public class RegionGridListServiceImpl implements RegionGridListService {
|
||||
|
||||
return secGridListByManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询网格内所有客户(不限制客户类型,用于导入客群)
|
||||
* @param regionGrid 地理网格对象
|
||||
* @return 网格内所有客户列表
|
||||
*/
|
||||
@Override
|
||||
public List<RegionCustUser> selectAllCustFromGrid(RegionGrid regionGrid) {
|
||||
LambdaQueryWrapper<RegionCustUser> queryWrapper = new LambdaQueryWrapper<>();
|
||||
// 根据网格等级判断使用一级还是二级网格ID查询
|
||||
if (regionGrid.getGridLevel().equals("1")) {
|
||||
queryWrapper.eq(RegionCustUser::getTopGridId, regionGrid.getGridId());
|
||||
} else if (regionGrid.getGridLevel().equals("2")) {
|
||||
queryWrapper.eq(RegionCustUser::getSecGridId, regionGrid.getGridId());
|
||||
} else {
|
||||
throw new ServiceException("无效的网格等级: " + regionGrid.getGridLevel());
|
||||
}
|
||||
// 不限制客户类型,查询所有类型的客户
|
||||
return regionCustUserMapper.selectList(queryWrapper);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -142,6 +142,28 @@
|
||||
<if test="managerId != null and managerId !='' ">and manager_id = #{managerId}</if>
|
||||
<if test="outletId != null and outletId !='' ">and outlet_id = #{outletId}</if>
|
||||
<if test="branchId != null and branchId !='' ">and branch_id = #{branchId}</if>
|
||||
<if test="statusType != null and statusType !=''">
|
||||
<choose>
|
||||
<when test="statusType == 'current'">
|
||||
<!-- 本月:本月是指定星级的客户 -->
|
||||
and cust_level = #{custLevel}
|
||||
</when>
|
||||
<when test="statusType == 'last'">
|
||||
<!-- 上月:上月是指定星级的客户 -->
|
||||
and cust_level_lm = #{custLevel}
|
||||
</when>
|
||||
<when test="statusType == 'rise'">
|
||||
<!-- 上升:上升到指定星级的客户(本月是指定星级,上月星级更低) -->
|
||||
and cust_level = #{custLevel}
|
||||
and cust_level_comp_lm like '上升%'
|
||||
</when>
|
||||
<when test="statusType == 'fall'">
|
||||
<!-- 下降:从指定星级下降的客户(上月是指定星级,本月星级更低) -->
|
||||
and cust_level_lm = #{custLevel}
|
||||
and cust_level_comp_lm like '下降%'
|
||||
</when>
|
||||
</choose>
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
@@ -438,6 +460,7 @@
|
||||
select distinct
|
||||
cust_level
|
||||
from dwb_retail_cust_level_manager_detail_875
|
||||
order by cust_level
|
||||
</select>
|
||||
|
||||
<select id="getCustCountByLevel" resultType="int">
|
||||
|
||||
Reference in New Issue
Block a user