fix:食堂菜品预约修改统计

This commit is contained in:
dzc committed 2026-07-29 10:06:10 +08:00
1 parent dfac86d46d
commit d96206828e
7 files changed
+45 -13

No files matched your search

@@ -1,5 +1,7 @@
package com.bsd.pjcloud.hard.api.dto.order;
import com.bsd.pjcloud.admin.api.vo.base.BaseIsDeepDeptTreeInterface;
import com.bsd.pjcloud.admin.api.vo.base.BaseIsIncludeTreeInterface;
import com.bsd.pjcloud.hard.api.entity.order.HardCarEntity;
import lombok.Data;
@@ -8,7 +10,7 @@ import java.time.LocalDateTime;
import java.util.List;
@Data
public class HardCarDto extends HardCarEntity {
public class HardCarDto extends HardCarEntity implements BaseIsIncludeTreeInterface {
private Long orderId;
@@ -28,4 +30,15 @@ public class HardCarDto extends HardCarEntity {
private LocalDateTime[] apptUseDateTimeList;
/**
* 前端树搜索
*/
private Long deptId;
private List<Long> deptIds;
private List<Long> userDeptIds;
private Boolean isInclude;
}
@@ -109,7 +109,7 @@ public class HardOrderDto extends HardOrderEntity implements BaseIsIncludeTreeIn
private List<Long> appWardUserIds;
/**
* `apptId`不为null
* `apptId`或者`appt_rule_id`不为null(筛选预约订单)
*/
Boolean apptIdNotNull = false;
Boolean apptIdOrApptRuleIdNotNull = false;
}
@@ -56,7 +56,7 @@ public class HardCanteenApptTotalController {
dto.setMchIds(mchList.stream().map(MchManageVo::getId).toList());
}
dto.setOrderType(HardOrderTypeEnum.RESERVE.getType());
dto.setApptIdNotNull(true);
dto.setApptIdOrApptRuleIdNotNull(true);
return R.ok(canteenApptTotalService.productReservTotal(page, dto, null));
}
@@ -73,7 +73,7 @@ public class HardCanteenApptTotalController {
dto.setMchIds(mchList.stream().map(MchManageVo::getId).toList());
}
dto.setOrderType(HardOrderTypeEnum.RESERVE.getType());
dto.setApptIdNotNull(true);
dto.setApptIdOrApptRuleIdNotNull(true);
return R.ok(canteenApptTotalService.productReservTotal(page, dto, null));
}
@@ -44,7 +44,7 @@ public class HardCanteenDeptTotalController {
PjcloudUser user = SecurityUtils.getUser();
dto.setTotalIsFindChildren(true);
dto.setApptIdNotNull(true);
dto.setApptIdOrApptRuleIdNotNull(true);
return R.ok(canteenTotalService.listByDept(dto, user, dataScope));
}
@@ -221,7 +221,7 @@ public class HardOrderController {
PjcloudUser user = SecurityUtils.getUser();
dto.setOrderType(HardOrderTypeEnum.RESERVE.getType());
dto.setTotalIsFindChildren(false);
dto.setApptIdNotNull(true);
dto.setApptIdOrApptRuleIdNotNull(true);
return R.ok(canteenTotalService.listByDept(dto, user, dataScope));
}
@@ -232,7 +232,7 @@ public class HardOrderController {
dto.setIsFindApptList(true);
dto.setOrderType(HardOrderTypeEnum.RESERVE.getType());
dto.setOrderStatusCodes(List.of(HardOrderStatusEnum.PAY.getType(), HardOrderStatusEnum.CANCEL.getType()));
dto.setApptIdNotNull(true);
dto.setApptIdOrApptRuleIdNotNull(true);
DataScope dataScope = null;
@@ -249,8 +249,8 @@
o.hour_type not in ('-1')
<where>
<include refid="whereA"/>
<if test="dto.apptIdNotNull != null and dto.apptIdNotNull == true ">
and o.appt_id is not null
<if test="dto.apptIdOrApptRuleIdNotNull != null and dto.apptIdOrApptRuleIdNotNull == true ">
and (o.appt_id is not null or o.appt_rule_id is not null)
</if>
<if test="dto.createTimeList != null and dto.createTimeList.length == 2">
and o.create_time between #{dto.createTimeList[0]} and #{dto.createTimeList[1]}
@@ -403,6 +403,25 @@
#{v}
</foreach>
</if>
<if test="dto.deptId != null">
and o.user_dept_id = #{dto.deptId}
</if>
<if test="dto.userDeptIds != null and dto.userDeptIds.size() != 0">
<choose>
<when test="dto.isInclude != null and dto.isInclude == true">
and o.user_dept_id IN
</when>
<when test="dto.isInclude != null and dto.isInclude == false">
and o.user_dept_id NOT IN
</when>
<otherwise>
and o.user_dept_id IN
</otherwise>
</choose>
<foreach collection="dto.userDeptIds" item="v" open="(" close=")" separator=",">
#{v}
</foreach>
</if>
</where>
group by o.merchant_id, a.product_id
order by o.merchant_id, SUM(a.product_count) desc
@@ -424,8 +443,8 @@
<if test="dto.orderStatus != null">
and o.order_status = #{dto.orderStatus}
</if>
<if test="dto.apptIdNotNull != null and dto.apptIdNotNull == true ">
and o.appt_id is not null
<if test="dto.apptIdOrApptRuleIdNotNull != null and dto.apptIdOrApptRuleIdNotNull == true ">
and (o.appt_id is not null or o.appt_rule_id is not null)
</if>
<if test="dto.orderStatusCodes != null and dto.orderStatusCodes.size() != 0">
and o.order_status in
@@ -50,7 +50,7 @@
<sql id="whereA">
a.del_flag = '0'
<if test="dto.apptIdNotNull != null and dto.apptIdNotNull == true ">
<if test="dto.apptIdOrApptRuleIdNotNull != null and dto.apptIdOrApptRuleIdNotNull == true ">
and (a.appt_id is not null or a.appt_rule_id is not null)
</if>
<if test="dto.hardId != null">