Commit b71f8f67 by 谢海旭

v5.7.0版本 飞行督导-后台-督导管理-汇总

1 parent 90408508
package cn.com.glsx.dj.supervisor.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* 督导管理汇总数据 DTO
*
* @author xiehx
* @date 2026-03-12
*/
@Data
public class SupervisorManageSummaryDTO implements Serializable {
/**
* 在职督导总人数
*/
@ApiModelProperty(notes = "在职督导总人数")
private Integer totalCount;
/**
* 管理门店总数(所有督导负责的门店去重后的总数)
*/
@ApiModelProperty(notes = "管理门店总数")
private Integer managedStoreCount;
/**
* 本月总产值(单位:万,保留1位小数)
*/
@ApiModelProperty(notes = "本月总产值(单位:万,保留1位小数)")
private BigDecimal monthlyOutput;
}
......@@ -2,6 +2,11 @@ package cn.com.glsx.dj.supervisor.remote;
import cn.com.glsx.dj.supervisor.dto.*;
import cn.com.glsx.dj.supervisor.dto.AudioReceptionDTO;
import cn.com.glsx.dj.supervisor.dto.AudioSummaryDTO;
import cn.com.glsx.dj.supervisor.dto.SupervisorManageSummaryDTO;
import cn.com.glsx.dj.supervisor.dto.SupervisorTaskDTO;
import cn.com.glsx.dj.supervisor.dto.SupervisorTaskQueryDTO;
import cn.com.glsx.dj.supervisor.model.SupervisorAudioReviewInfo;
import cn.com.glsx.framework.core.annotation.*;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
......@@ -96,4 +101,12 @@ public interface SupervisorTaskInfoRemote {
@ApiParams({@ApiParam(name = "request", notes = "督导管理的门店id列表", dataType = ApiParam.DataTypeEnum.ARRAY, required = true)})
@ApiResponse("督导团队概况信息")
RpcResponse<SupervisorTeamOverviewDTO> getTeamOverview(SupervisorTaskQueryDTO request);
/**
* 督导管理汇总
*/
@ApiMethod("督导管理汇总")
@ApiParams({@ApiParam(name = "request", notes = "不需要参数,传null即可", dataType = ApiParam.DataTypeEnum.OBJECT, required = false)})
@ApiResponse("汇总数据")
RpcResponse<SupervisorManageSummaryDTO> getManageSummary();
}
\ No newline at end of file
......@@ -50,4 +50,14 @@ public interface SupervisorTaskInfoMapper extends OreMapper<SupervisorTaskInfo>
List<TrainingListDTO> queryCoachingTrainingList(@Param("storeManagerPhone") String storeManagerPhone,
@Param("startDate") String startDate,
@Param("endDate") String endDate);
List<Integer> queryMerchantBySupervisorPhone(@Param("phoneList") List<String> phoneList);
/**
* 查询给定门店列表下的全部驻店人员uuid列表
*
* @param merchantIdList
* @return
*/
List<String> queryStoreManagerUuidByMerchantId(@Param("merchantIdList") List<Integer> merchantIdList);
}
\ No newline at end of file
package cn.com.glsx.dj.supervisor.remote;
import cn.com.glsx.dj.supervisor.dto.*;
import cn.com.glsx.dj.supervisor.dto.AudioReceptionDTO;
import cn.com.glsx.dj.supervisor.dto.AudioSummaryDTO;
import cn.com.glsx.dj.supervisor.dto.SupervisorManageSummaryDTO;
import cn.com.glsx.dj.supervisor.dto.SupervisorTaskDTO;
import cn.com.glsx.dj.supervisor.dto.SupervisorTaskQueryDTO;
import cn.com.glsx.dj.supervisor.model.SupervisorAudioReviewInfo;
import cn.com.glsx.dj.supervisor.service.SupervisorAudioReviewInfoService;
import cn.com.glsx.dj.supervisor.service.SupervisorTaskInfoService;
......@@ -177,4 +182,20 @@ public class SupervisorTaskInfoRemoteImpl implements SupervisorTaskInfoRemote {
return RpcResponse.error(DefaultErrorEnum.SERVER_ERROR, e.getMessage());
}
}
@Override
public RpcResponse<SupervisorManageSummaryDTO> getManageSummary() {
try {
log.info("督导管理汇总 - 开始查询");
SupervisorManageSummaryDTO result = supervisorTaskInfoService.getManageSummary();
log.info("督导管理汇总 - 查询成功:{}", result);
return RpcResponse.success(result);
} catch (RpcServiceException e) {
log.error("cn.com.glsx.dj.supervisor.remote.SupervisorTaskInfoRemoteImpl.getManageSummary error {}", e);
return RpcResponse.error(e.getError(), e.getMessage());
} catch (Exception e) {
log.error("cn.com.glsx.dj.supervisor.remote.SupervisorTaskInfoRemoteImpl.getManageSummary system error {}", e);
return RpcResponse.error(DefaultErrorEnum.SERVER_ERROR, e.getMessage());
}
}
}
package cn.com.glsx.dj.supervisor.service;
import cn.com.glsx.dj.supervisor.dto.CoursePushDTO;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import org.apache.commons.collections.CollectionUtils;
import org.oreframework.distribute.lock.annotation.GlsxDistributeLockable;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.alibaba.fastjson.JSON;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import cn.com.glsx.dj.peanalysis.dto.req.output.SceneBaseReq;
import cn.com.glsx.dj.peanalysis.dto.res.output.SceneOutputResponse;
import cn.com.glsx.dj.peanalysis.remote.BusinessSceneAnalysisRemote;
import cn.com.glsx.dj.smartcarlife.dto.merchantPerformanceConfig.StaffBaseInfoDTO;
import cn.com.glsx.dj.smartcarlife.remote.StaffBaseInfoRemote;
import cn.com.glsx.dj.supervisor.dto.SupervisorTaskDTO;
import cn.com.glsx.dj.supervisor.dto.SupervisorTaskQueryDTO;
import cn.com.glsx.dj.supervisor.dto.SupervisorTaskSummaryDTO;
import cn.com.glsx.dj.supervisor.dto.SupervisorTeamOverviewDTO;
import cn.com.glsx.dj.supervisor.dto.*;
import cn.com.glsx.dj.supervisor.enums.ReviewStatusEnum;
import cn.com.glsx.dj.supervisor.enums.TaskStatusEnum;
import cn.com.glsx.dj.supervisor.enums.TaskTypeEnum;
......@@ -42,9 +19,13 @@ import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import cn.com.glsx.framework.core.enums.DefaultErrorEnum;
import cn.com.glsx.framework.core.exception.RpcServiceException;
import cn.com.glsx.framework.core.util.RpcAssert;
import cn.com.glsx.merchants.dto.beisen.BeiSenEmployeeListResonseDTO;
import cn.com.glsx.merchants.model.request.MerchantStaffRequest;
import cn.com.glsx.merchants.model.response.MerchantStaffResponse;
import cn.com.glsx.merchants.remote.MerchantStaffRemote;
import com.alibaba.fastjson.JSON;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.oreframework.distribute.lock.annotation.GlsxDistributeLockable;
......@@ -55,10 +36,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
@Service
......@@ -155,6 +133,58 @@ public class SupervisorTaskInfoService {
}
/**
* 督导管理汇总
* 1. 查询全部督导列表
* 2. 将督导手机号微批查询北森在职状态,统计在职总人数
* 3. 按督导手机号查询 director_config 表,统计管理门店数
*
* @return 汇总数据
*/
public SupervisorManageSummaryDTO getManageSummary() {
SupervisorManageSummaryDTO summary = new SupervisorManageSummaryDTO();
summary.setTotalCount(0);
summary.setManagedStoreCount(0);
summary.setMonthlyOutput(java.math.BigDecimal.ZERO);
// 1. 查询全部督导列表
List<MerchantStaffResponse> supervisorList = listAllSupervisors();
if (CollectionUtils.isEmpty(supervisorList)) {
log.info("督导列表为空,返回默认汇总");
return summary;
}
List<String> phoneList = supervisorList.stream()
.map(MerchantStaffResponse::getStaffPhone)
.filter(phone -> phone != null && !phone.isEmpty())
.distinct()
.collect(Collectors.toList());
// 2. 批量查询北森信息,统计在职人数
int onlineCount = 0;
if (!phoneList.isEmpty()) {
List<BeiSenEmployeeListResonseDTO> beisenList = supervisorLearningCenterService.listEmployeeInfoByStaffPhone(phoneList);
if (beisenList != null) {
onlineCount = (int) beisenList.stream()
.filter(emp -> Integer.valueOf(1).equals(emp.getZzStatus())) // 注意这里的值跟数据库中的是反的
.count();
}
}
summary.setTotalCount(onlineCount);
// 3. 查询 director_config 表,统计所有督导负责的门店(director_type=6,平台中飞行督导)
List<Integer> merchantIdList = supervisorTaskInfoMapper.queryMerchantBySupervisorPhone(phoneList);
summary.setManagedStoreCount(merchantIdList.size());
// TODO 对接接口,查询统计本月内总产值
List<String> staffUuidList = supervisorTaskInfoMapper.queryStoreManagerUuidByMerchantId(merchantIdList);
// DateUtil.beginOfMonth(new Date())
summary.setMonthlyOutput(java.math.BigDecimal.ZERO);
return summary;
}
/**
* 查询所有飞行督导人员
* @return
*/
......
......@@ -186,5 +186,26 @@
</if>
ORDER BY create_time DESC
</select>
<select id="queryMerchantBySupervisorPhone" resultType="java.lang.Integer">
SELECT DISTINCT merchant_id
FROM dj_car_life_shop_merchant_director_config
WHERE deleted_flag = 'N'
AND director_type = 6
AND director_phone IN
<foreach collection="phoneList" open="(" item="i" close=")" separator=",">
#{i}
</foreach>
</select>
<select id="queryStoreManagerUuidByMerchantId" resultType="java.lang.String">
SELECT DISTINCT staff_uuid
FROM dj_car_life_staff_account_record
WHERE deleted_flag = 'N'
AND job_type = 11
AND created_source = 6
AND merchant_id IN
<foreach collection="merchantIdList" open="(" item="i" close=")" separator=",">
#{i}
</foreach>
</select>
</mapper>
\ No newline at end of file
package cn.com.glsx.dj.supervisor.service;
import cn.com.glsx.dj.supervisor.dto.SupervisorManageSummaryDTO;
import cn.com.glsx.dj.supervisor.dto.SupervisorTaskDTO;
import cn.com.glsx.dj.supervisor.model.SupervisorTaskCourse;
import cn.com.glsx.dj.supervisor.model.SupervisorTaskImage;
......@@ -54,4 +55,10 @@ public class SupervisorTaskInfoServiceTest extends BaseServiceTest {
Long id = supervisorTaskInfoService.submitCoaching(request);
System.out.println(id);
}
@Test
public void testGetManageSummary() {
SupervisorManageSummaryDTO manageSummary = supervisorTaskInfoService.getManageSummary();
System.out.println(JSON.toJSONString(manageSummary));
}
}
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!