feat:用户部门
This commit is contained in:
1 parent
28afa35b35
commit
0798720bd6
5 files changed
+62
-5
No files matched your search
+5
@@ -14,6 +14,11 @@ import java.util.List;
|
||||
@NoArgsConstructor
|
||||
public class PanelCanteenVo {
|
||||
|
||||
/**
|
||||
* 商品名
|
||||
*/
|
||||
private String productName;
|
||||
|
||||
/**
|
||||
* 用餐时间段(早中晚)
|
||||
*/
|
||||
|
||||
+5
@@ -140,4 +140,9 @@ public interface HardOrderMapper extends PjcloudBaseMapper<HardOrderEntity> {
|
||||
* 用餐数据统计(根据时间段和日期分类统计)
|
||||
*/
|
||||
List<PanelCanteenVo> groupByTimeAndHourType(@Param("dto") PanelCanteenDto dto);
|
||||
|
||||
/**
|
||||
* 用餐数据统计(根据时间段和日期分类统计)
|
||||
*/
|
||||
List<PanelCanteenVo> top(@Param("dto") PanelCanteenDto dto);
|
||||
}
|
||||
+27
-3
@@ -1,5 +1,7 @@
|
||||
package com.bsd.pjcloud.hard.service.impl.order;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
@@ -1376,9 +1378,31 @@ public class HardOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardOrder
|
||||
RequestContextHolder.setRequestAttributes(requestAttributes);
|
||||
List<Long> userIds = list.stream().map(HardOrderVo::getUserId).filter(ObjectUtil::isNotEmpty).distinct().toList();
|
||||
if (ObjectUtil.isNotEmpty(userIds)) {
|
||||
List<UserVO> userList = userService.getUserDeptByIds(new ArrayList<>(userIds)).getData();
|
||||
List<UserVO> userList = userService.getUserDeptByIds(userIds).getData();
|
||||
if (ObjectUtil.isNotEmpty(userList)) {
|
||||
DataUtil.convertUserDeptList(list, CollectionUtils.convertMap(userList, UserVO::getUserId));
|
||||
Map<Long, UserVO> map = CollectionUtils.convertMap(userList, UserVO::getUserId);
|
||||
for (HardOrderVo item : list) {
|
||||
UserVO userVO = map.get(item.getUserId());
|
||||
if (ObjectUtil.isEmpty(userVO)) continue;
|
||||
item.setUsername(userVO.getName());
|
||||
item.setUserMobile(userVO.getPhone());
|
||||
item.setUserAvatar(userVO.getAvatar());
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
// 当前部门
|
||||
CompletableFuture<Void> currentDeptFuture = CompletableFuture.runAsync(() -> {
|
||||
RequestContextHolder.setRequestAttributes(requestAttributes);
|
||||
List<Long> deptIds = list.stream().map(HardOrderVo::getUserDeptId).filter(ObjectUtil::isNotEmpty).distinct().toList();
|
||||
if (ObjectUtil.isNotEmpty(deptIds)) {
|
||||
Map<Long, SysDept> deptList = deptService.getDeptByDeptIds(deptIds).getData();
|
||||
if (ObjectUtil.isNotEmpty(deptList)) {
|
||||
for (HardOrderVo item : list) {
|
||||
SysDept dept = deptList.get(item.getUserDeptId());
|
||||
if (ObjectUtil.isEmpty(dept)) continue;
|
||||
item.setUserDeptName(dept.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -1428,6 +1452,6 @@ public class HardOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardOrder
|
||||
v.setCarList(carVoList);
|
||||
}
|
||||
}
|
||||
CompletableFuture.allOf(deptFuture, mchFuture, deviceFuture, walletFuture).join();
|
||||
CompletableFuture.allOf(deptFuture, mchFuture, deviceFuture, currentDeptFuture, walletFuture).join();
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -77,7 +77,7 @@ public class PanelCanteenServiceImpl implements PanelCanteenService {
|
||||
*/
|
||||
@Override
|
||||
public List<PanelCanteenVo> groupByTimeAndCustomHour(PanelCanteenDto dto) {
|
||||
return List.of();
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -85,7 +85,7 @@ public class PanelCanteenServiceImpl implements PanelCanteenService {
|
||||
*/
|
||||
@Override
|
||||
public List<PanelCanteenVo> top(PanelCanteenDto dto) {
|
||||
return null;
|
||||
return hardOrderMapper.top(dto);
|
||||
}
|
||||
|
||||
private List<PanelCanteenVo> generatePanelCanteenList(LocalDateTime[] totalTimeList) {
|
||||
|
||||
+23
@@ -577,4 +577,27 @@
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="top" resultType="com.bsd.pjcloud.hard.api.vo.hard.PanelCanteenVo">
|
||||
select a.product_name as productName,
|
||||
sum(a.product_count) as buyProductCount
|
||||
from hard_car a
|
||||
inner join hard_parent_car p on a.parent_car_id = p.id and p.del_flag = '0'
|
||||
inner join hard_order o on o.parent_car_id = p.id and o.del_flag = '0' and o.hour_type is not null and
|
||||
o.hour_type not in ('-1', 'null')
|
||||
<where>
|
||||
a.del_flag = '0'
|
||||
<if test="dto.totalTimeList != null and dto.totalTimeList.length == 2">
|
||||
and o.create_time between #{dto.totalTimeList[0]} and #{dto.totalTimeList[1]}
|
||||
</if>
|
||||
<if test="dto.hourType != null and dto.hourType != '' ">
|
||||
and o.hour_type = #{dto.hourType}
|
||||
</if>
|
||||
</where>
|
||||
group by a.product_id
|
||||
order by sum(a.product_count) desc
|
||||
<if test="dto.limit != null">
|
||||
limit #{dto.limit}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Reference in new issue
Block a user