11
This commit is contained in:
1 parent
f0412a73cf
commit
307b332e4a
4 files changed
+32
-11
No files matched your search
+1
-1
@@ -145,7 +145,7 @@ public class CanteenCategoryController {
|
||||
wrapper.like(StringUtils.isNotBlank(name), CanteenCategoryEntity::getName, name);
|
||||
wrapper.orderByAsc(CanteenCategoryEntity::getSort);
|
||||
wrapper.apply(StringUtils.isNotEmpty(categoryType), "FIND_IN_SET({0}, your_column_name)", categoryType);
|
||||
List<CanteenCategoryEntity> list = canteenCategoryService.listScope(wrapper);
|
||||
List<CanteenCategoryEntity> list = canteenCategoryService.list(wrapper);
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
|
||||
+1
-3
@@ -59,13 +59,12 @@ public class HardCanteenTotalController {
|
||||
/**
|
||||
* 近一周各个食堂菜品购买统计
|
||||
*/
|
||||
@Inner(value = false)
|
||||
@Operation(summary = "近一周各个食堂菜品购买统计", description = "近一周各个食堂菜品购买统计")
|
||||
@PostMapping("/app/product-by-canteen")
|
||||
public R<List<Map<String, List<HardAppProductByCanteenVo>>>> productByCanteen(@RequestBody HardAppProductByCanteenDto dto) {
|
||||
PjcloudUser user = SecurityUtils.getUser();
|
||||
if (ObjectUtil.isNotEmpty(user)) {
|
||||
dto.setUserId(user.getId());
|
||||
// dto.setUserId(user.getId());
|
||||
}
|
||||
return R.ok(canteenTotalService.productByCanteen(dto));
|
||||
}
|
||||
@@ -73,7 +72,6 @@ public class HardCanteenTotalController {
|
||||
/**
|
||||
* 个人菜品喜好排行
|
||||
*/
|
||||
@Inner(value = false)
|
||||
@Operation(summary = "个人菜品喜好排行", description = "个人菜品喜好排行")
|
||||
@PostMapping("/app/product-like-top")
|
||||
public R<List<HardAppProductLikeTopVo>> productLikeTop(@RequestBody HardAppProductLikeTopDto dto) {
|
||||
|
||||
+27
-7
@@ -10,6 +10,7 @@ import com.bsd.pjcloud.canteen.api.feign.RemoteCanteenCategoryService;
|
||||
import com.bsd.pjcloud.canteen.entity.CanteenCategoryEntity;
|
||||
import com.bsd.pjcloud.common.core.constant.enums.MerchantTypeEnum;
|
||||
import com.bsd.pjcloud.common.core.constant.enums.YesNoEnum;
|
||||
import com.bsd.pjcloud.common.core.util.CollectionUtils;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.hard.api.constant.order.HardOrderStatusEnum;
|
||||
import com.bsd.pjcloud.hard.api.constant.total.DateRangeTypeEnum;
|
||||
@@ -114,6 +115,7 @@ public class HardCanteenTotalServiceImpl implements HardCanteenTotalService {
|
||||
}
|
||||
|
||||
List<HardAppProductByCanteenVo> totalList = hardCarMapper.productByCanteen(dto);
|
||||
disposeProductByCanteen(totalList);
|
||||
|
||||
if (ObjectUtil.isNotEmpty(totalList)) {
|
||||
for (Map<String, List<HardAppProductByCanteenVo>> map : result) {
|
||||
@@ -121,13 +123,13 @@ public class HardCanteenTotalServiceImpl implements HardCanteenTotalService {
|
||||
String canteenName = entry.getKey();
|
||||
List<HardAppProductByCanteenVo> currentCanteenList = entry.getValue();
|
||||
for (HardAppProductByCanteenVo vo : currentCanteenList) {
|
||||
dateList.stream().filter(item -> ObjectUtil.equals(item.getCanteenName(), canteenName) && ObjectUtil.equals(item.getTime(), vo.getTime())).findFirst().ifPresent(target -> {
|
||||
target.setCanteenId(vo.getCanteenId());
|
||||
target.setCanteenName(canteenName);
|
||||
target.setPayCount(vo.getPayCount());
|
||||
target.setTotalPrice(vo.getTotalPrice());
|
||||
target.setTimeCount(vo.getTimeCount());
|
||||
target.setPayUserCount(vo.getPayUserCount());
|
||||
totalList.stream().filter(item -> ObjectUtil.equals(item.getCanteenName(), canteenName) && ObjectUtil.equals(item.getTime(), vo.getTime())).findFirst().ifPresent(target -> {
|
||||
vo.setCanteenId(target.getCanteenId());
|
||||
vo.setCanteenName(canteenName);
|
||||
vo.setPayCount(target.getPayCount());
|
||||
vo.setTotalPrice(target.getTotalPrice());
|
||||
vo.setTimeCount(target.getTimeCount());
|
||||
vo.setPayUserCount(target.getPayUserCount());
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -340,4 +342,22 @@ public class HardCanteenTotalServiceImpl implements HardCanteenTotalService {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void disposeProductByCanteen(List<HardAppProductByCanteenVo> list) {
|
||||
if (ObjectUtil.isEmpty(list)) return;
|
||||
// 处理商户
|
||||
List<Long> canteenIdList = list.stream().map(HardAppProductByCanteenVo::getCanteenId).filter(ObjectUtil::isNotEmpty).distinct().toList();
|
||||
if (ObjectUtil.isNotEmpty(canteenIdList)) {
|
||||
List<MchManageVo> mchList = remoteMchService.getByIds(canteenIdList).getData();
|
||||
if (ObjectUtil.isNotEmpty(mchList)) {
|
||||
Map<Long, MchManageVo> mchMap = CollectionUtils.convertMap(mchList, MchManageVo::getId);
|
||||
for (HardAppProductByCanteenVo i : list) {
|
||||
MchManageVo mch = mchMap.get(i.getCanteenId());
|
||||
if (ObjectUtil.isNotEmpty(mch)) {
|
||||
i.setCanteenName(mch.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+3
@@ -300,6 +300,7 @@
|
||||
left join pjcloudx_canteen.canteen_spu s on a.product_id = s.id
|
||||
<where>
|
||||
a.del_flag = '0'
|
||||
and s.category_id is not null
|
||||
<if test="dto.userId != null and dto.userId != '' ">
|
||||
and o.user_id = #{dto.userId}
|
||||
</if>
|
||||
@@ -318,6 +319,7 @@
|
||||
</where>
|
||||
group by s.category_id
|
||||
order by s.category_id
|
||||
limit 5
|
||||
</select>
|
||||
|
||||
<select id="productByCanteen" resultType="com.bsd.pjcloud.hard.api.vo.order.app.HardAppProductByCanteenVo">
|
||||
@@ -335,6 +337,7 @@
|
||||
<where>
|
||||
a.del_flag = '0'
|
||||
and o.pay_time is not null
|
||||
and o.merchant_id is not null
|
||||
<if test="dto.userId != null and dto.userId != '' ">
|
||||
and o.user_id = #{dto.userId}
|
||||
</if>
|
||||
|
||||
Reference in new issue
Block a user