Commit ea68655f by 谢海旭

v5.7.0版本 飞行督导:后台-督导管理,对接产值等指标

1 parent 0f8dfe0e
......@@ -3,6 +3,7 @@ package cn.com.glsx.dj.supervisor.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
......@@ -29,6 +30,13 @@ public class SupervisorDetailQueryDTO implements Serializable {
private Integer bizType;
/**
* 日期类型:0,按指定时段;1,按周;2,按月;3,按年;4,全部
*/
@ApiModelProperty(value = "日期类型", example = "0", required = true, notes = "日期类型:0,按指定时段;1,按周;2,按月;3,按年;4,全部")
@NotNull
private Integer dateType;
/**
* 查询开始日期,格式 yyyy-MM-dd
*/
@ApiModelProperty(notes = "查询开始日期,格式 yyyy-MM-dd")
......
......@@ -35,6 +35,7 @@ import com.github.pagehelper.PageHelper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.dubbo.config.annotation.DubboReference;
import org.apache.commons.lang3.StringUtils;
import org.oreframework.distribute.lock.annotation.GlsxDistributeLockable;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -200,7 +201,7 @@ public class SupervisorTaskInfoService {
*/
private BigDecimal getMerchantListMonthlyOutput(List<Integer> merchantIdList) {
DashboardQueryReq req = new DashboardQueryReq();
req.setDateType(0);
req.setDateType(4);
req.setStartDate(DateUtil.beginOfMonth(new Date()).toDateStr());
req.setEndDate(DateUtil.endOfMonth(new Date()).toDateStr());
req.setMerchantIds(merchantIdList);
......@@ -265,10 +266,18 @@ public class SupervisorTaskInfoService {
*/
public List<MerchantStaffResponse> listAllSupervisors() {
//查询督导人员列表
return getMerchantStaffByPhone(null);
}
private List<MerchantStaffResponse> getMerchantStaffByPhone(String phone) {
MerchantStaffRequest staffRequest = new MerchantStaffRequest();
staffRequest.setMerchantNo(env.getProperty("glsk_merchant_id", Integer.class, 44205577));
staffRequest.setRoleName(env.getProperty("glsk_supervisor_role_name", String.class, "飞行督导"));
staffRequest.setDelFlag((byte) 0);
if (StringUtils.isNotBlank(phone)) {
staffRequest.setStaffPhone(phone);
}
// 过滤被删除被禁用的员工
RpcResponse<List<MerchantStaffResponse>> response = merchantStaffRemote.findMerchantStaffListRemote(staffRequest);
if (response.hasResult()) {
......@@ -729,41 +738,111 @@ public class SupervisorTaskInfoService {
/**
* 督导管理详情页 - 核心指标汇总
* <p>包含:团队人员数、产值、转化率、客单价</p>
* <p>TODO: 业务取值逻辑待对接,暂时占位返回</p>
*
* @param request 查询参数(督导手机号、业务类型、起止日期)
* @return 汇总指标
*/
public SupervisorDetailSummaryDTO getDetailSummary(SupervisorDetailQueryDTO request) {
// TODO: 对接业务系统获取团队人员数、产值、转化率、客单价
log.info("督导管理详情页汇总 - 占位实现,request={}", request);
String supervisorPhone = request.getSupervisorPhone();
String supervisorId = getSupervisorUUIDByPhone(supervisorPhone);
if (supervisorId == null) return null;
DashboardQueryReq req = new DashboardQueryReq();
req.setSupervisorId(supervisorId);
req.setBizs(request.getBizType());
req.setDateType(request.getDateType());
req.setStartDate(request.getStartDate());
req.setEndDate(request.getEndDate());
SupervisorDashboardVO dashboardData = supervisorDashboardService.getDashboardData(req);
DashboardMetrics metrics = dashboardData.getMetrics();
SupervisorDetailSummaryDTO summary = new SupervisorDetailSummaryDTO();
summary.setTeamStaffCount(0);
summary.setOutputValue(java.math.BigDecimal.ZERO);
summary.setConversionRate(java.math.BigDecimal.ZERO);
summary.setAvgOrderValue(java.math.BigDecimal.ZERO);
if (metrics == null) {
return summary;
}
summary.setTeamStaffCount(metrics.getStaffCount());
summary.setOutputValue(metrics.getTotalOutput());
summary.setConversionRate(metrics.getAvgConversion());
summary.setAvgOrderValue(metrics.getAvgUnitPrice());
return summary;
}
//
/**
* 通过飞行督导手机号查询督导uuid
*
* @param supervisorPhone
* @return
*/
private String getSupervisorUUIDByPhone(String supervisorPhone) {
List<MerchantStaffResponse> supervisorList = getMerchantStaffByPhone(supervisorPhone);
if (CollectionUtils.isEmpty(supervisorList)) {
return null;
}
return summary;
String supervisorId = supervisorList.get(0).getUuid();
return supervisorId;
}
/**
* 督导管理详情页 - 驻店销售明细分页列表
* <p>TODO: 业务取值逻辑待对接,暂时占位返回</p>
*
* @param pagination 分页查询参数(督导手机号、业务类型、起止日期、分页)
* @return 驻店销售明细分页列表
*/
public RpcPagination<SupervisorDetailStaffDTO> pageDetailStaff(RpcPagination<SupervisorDetailQueryDTO> pagination) {
// TODO: 对接业务系统获取驻店销售明细列表
log.info("督导管理详情页驻店销售分页列表 - 占位实现,pagination={}", pagination);
RpcPagination<SupervisorDetailStaffDTO> result = new RpcPagination<>();
result.setPageNum(pagination.getPageNum());
result.setPageSize(pagination.getPageSize());
result.setTotal(0L);
result.setPages(0);
result.setList(new java.util.ArrayList<>());
SupervisorDetailQueryDTO request = pagination.getCondition();
String supervisorPhone = request.getSupervisorPhone();
String supervisorId = getSupervisorUUIDByPhone(supervisorPhone);
if (supervisorId == null) return result;
DashboardQueryReq req = new DashboardQueryReq();
req.setSupervisorId(supervisorId);
req.setBizs(request.getBizType());
req.setDateType(request.getDateType());
req.setStartDate(request.getStartDate());
req.setEndDate(request.getEndDate());
SupervisorDashboardVO dashboardData = supervisorDashboardService.getDashboardData(req);
List<EmployeeRanking> employeeList = dashboardData.getEmployeeList();
// 处理空列表
if (CollectionUtils.isEmpty(employeeList)) {
return result;
}
// 逻辑分页
int pageNum = pagination.getPageNum() > 0 ? pagination.getPageNum() : 1;
int pageSize = pagination.getPageSize() > 0 ? pagination.getPageSize() : 10;
int total = employeeList.size();
int pages = (total + pageSize - 1) / pageSize;
int fromIndex = (pageNum - 1) * pageSize;
int toIndex = Math.min(fromIndex + pageSize, total);
List<SupervisorDetailStaffDTO> pageList = new java.util.ArrayList<>();
if (fromIndex < total) {
List<EmployeeRanking> subList = employeeList.subList(fromIndex, toIndex);
for (EmployeeRanking employee : subList) {
SupervisorDetailStaffDTO dto = new SupervisorDetailStaffDTO();
dto.setStaffName(employee.getEmployeeName());
dto.setStaffPhone(employee.getEmployeePhone());
dto.setBizNames(employee.getBussinessType());
dto.setOutputValue(employee.getPersonalOutput());
dto.setConversionRate(employee.getPersonalConversion());
dto.setAvgOrderValue(employee.getPersonalUnitPrice());
pageList.add(dto);
}
}
result.setTotal((long) total);
result.setPages(pages);
result.setList(pageList);
return result;
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!