Commit 0d4f27a3 by 范富荣

feat: 美团差旅公司月度报告新增重点问题聚焦

1 parent cddf64c3
...@@ -63,5 +63,8 @@ public class CompanyMonthlyReportDTO implements Serializable { ...@@ -63,5 +63,8 @@ public class CompanyMonthlyReportDTO implements Serializable {
@ApiModelProperty("商务差旅部门花费占比集合") @ApiModelProperty("商务差旅部门花费占比集合")
private List<TravelDeptDTO> travelDeptSpendList; private List<TravelDeptDTO> travelDeptSpendList;
@ApiModelProperty("重点问题聚焦列表")
private List<DeptIssueItemDTO> focusIssues;
} }
...@@ -38,6 +38,13 @@ public interface StaffMeituanOrderMapper extends OreMapper<StaffMeituanOrder> { ...@@ -38,6 +38,13 @@ public interface StaffMeituanOrderMapper extends OreMapper<StaffMeituanOrder> {
@Param("endTime") LocalDateTime endTime); @Param("endTime") LocalDateTime endTime);
/** /**
* 公司维度在指定月份内,按入住时间统计差旅超长入住记录
*/
List<StaffMeituanOrder> selectCompanyTravelExceedByCheckinTime(@Param("minRoomNightCount") Integer minRoomNightCount,
@Param("startTime") LocalDateTime startTime,
@Param("endTime") LocalDateTime endTime);
/**
* 查询某部门在指定月份内,按离店时间统计差旅超长入住记录 * 查询某部门在指定月份内,按离店时间统计差旅超长入住记录
*/ */
List<StaffMeituanOrder> selectTravelExceedByCheckoutTime(@Param("directOrgId") Long directOrgId, List<StaffMeituanOrder> selectTravelExceedByCheckoutTime(@Param("directOrgId") Long directOrgId,
......
...@@ -567,6 +567,33 @@ public class StaffMeituanOrderService { ...@@ -567,6 +567,33 @@ public class StaffMeituanOrderService {
.sorted(Comparator.comparing(TravelDeptDTO::getTotalAmount).reversed()) .sorted(Comparator.comparing(TravelDeptDTO::getTotalAmount).reversed())
.collect(Collectors.toList()); .collect(Collectors.toList());
// 重点问题聚焦
Integer travelExceedDayNum = env.getProperty("staff.meituan.order.send.qw.travel.exceed.day", Integer.class, 7);
// 用餐招待超标人员及次数
List<DeptIssueItemDTO> focusIssues = new ArrayList<>();
Map<String, Long> dinnerExceedByStaff = dinnerLast.stream()
.filter(o -> Objects.equals(o.getIsExceed(), MeituanExceedEnum.EXCEED.getCode()))
.collect(Collectors.groupingBy(StaffMeituanOrder::getStaffName, Collectors.counting()));
dinnerExceedByStaff.entrySet().stream()
.sorted((a1, a2) -> Long.compare(a2.getValue(), a1.getValue()))
.forEach(entry -> focusIssues.add(DeptIssueItemDTO.builder()
.sceneType(MeituanSceneTypeEnum.BUSINESS_DINNER.getCode())
.staffName(entry.getKey())
.value(entry.getValue().intValue())
.build()));
// 差旅住宿连续超天数人员(公司维度,全量)
List<StaffMeituanOrder> companyTravelExceed = staffMeituanOrderMapper.selectCompanyTravelExceedByCheckinTime(
travelExceedDayNum, lastMonthStart, lastMonthEnd);
if (CollectionUtils.isNotEmpty(companyTravelExceed)) {
companyTravelExceed.forEach(o -> focusIssues.add(DeptIssueItemDTO.builder()
.sceneType(MeituanSceneTypeEnum.BUSINESS_TRAVEL.getCode())
.staffName(o.getStaffName())
.value(o.getRoomNightCount())
.build()));
}
return CompanyMonthlyReportDTO.builder() return CompanyMonthlyReportDTO.builder()
.monthValue(monthValue) .monthValue(monthValue)
.monthStartDay(monthStartDay) .monthStartDay(monthStartDay)
...@@ -580,6 +607,7 @@ public class StaffMeituanOrderService { ...@@ -580,6 +607,7 @@ public class StaffMeituanOrderService {
.deptSpendList(deptSpendList) .deptSpendList(deptSpendList)
.dinnerDeptSpendList(dinnerDeptSpendList) .dinnerDeptSpendList(dinnerDeptSpendList)
.travelDeptSpendList(travelDeptSpendList) .travelDeptSpendList(travelDeptSpendList)
.focusIssues(focusIssues)
.build(); .build();
} }
......
...@@ -96,6 +96,19 @@ ...@@ -96,6 +96,19 @@
order by room_night_count desc order by room_night_count desc
</select> </select>
<!-- 公司维度在指定月份内,按入住时间统计差旅超长入住记录 -->
<select id="selectCompanyTravelExceedByCheckinTime" resultMap="BaseResultMap">
SELECT
staff_name, checkin_time, checkout_time, room_night_count
FROM dj_car_life_staff_meituan_order
WHERE scene_type = 3
AND room_night_count &gt;= #{minRoomNightCount}
AND deleted_flag = 'N'
AND (checkin_time BETWEEN #{startTime} AND #{endTime} or checkout_time BETWEEN #{startTime} AND #{endTime})
group by staff_name, checkin_time, checkout_time, room_night_count
order by room_night_count desc
</select>
<!-- 查询某部门在指定月份内,按离店时间统计差旅超长入住记录 --> <!-- 查询某部门在指定月份内,按离店时间统计差旅超长入住记录 -->
<select id="selectTravelExceedByCheckoutTime" resultMap="BaseResultMap"> <select id="selectTravelExceedByCheckoutTime" resultMap="BaseResultMap">
SELECT SELECT
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!