feat:核销列表

This commit is contained in:
dzc committed 2026-06-10 19:18:07 +08:00
1 parent 18b55ebb82
commit 95949c9194
11 files changed
+113 -21

No files matched your search

@@ -77,4 +77,13 @@ public class HardOrderDto extends HardOrderEntity implements BaseIsIncludeTreeIn
*/
private Boolean productDescIsNotEmpty = false;
/**
* 权限相关
*/
List<Long> scopeDeptIds;
/**
* 统计是否查询子部门
*/
Boolean totalIsFindChildren = false;
}
@@ -1,8 +1,9 @@
package com.bsd.pjcloud.hard.controller.order;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bsd.pjcloud.common.core.util.R;
import com.bsd.pjcloud.common.data.datascope.DataScope;
import com.bsd.pjcloud.common.security.service.PjcloudUser;
import com.bsd.pjcloud.common.security.util.SecurityUtils;
import com.bsd.pjcloud.hard.api.dto.order.HardOrderDto;
import com.bsd.pjcloud.hard.api.vo.order.HardCanteenProductTotalVo;
import com.bsd.pjcloud.hard.service.HardCanteenTotalService;
@@ -10,7 +11,6 @@ import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springdoc.core.annotations.ParameterObject;
import org.springframework.http.HttpHeaders;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@@ -35,7 +35,10 @@ public class HardCanteenDeptTotalController {
@PostMapping("/list-by-dept")
public R<List<HardCanteenProductTotalVo>> listByDept(@RequestBody HardOrderDto dto) {
DataScope dataScope = null;
return R.ok(canteenTotalService.listByDept(dto, dataScope));
PjcloudUser user = SecurityUtils.getUser();
dto.setTotalIsFindChildren(true);
return R.ok(canteenTotalService.listByDept(dto, user, dataScope));
}
}
@@ -21,6 +21,7 @@ import com.bsd.pjcloud.hard.service.HardCanteenTotalService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import org.springdoc.core.annotations.ParameterObject;
import org.springframework.http.HttpHeaders;
@@ -93,7 +94,7 @@ public class HardCanteenTotalController {
@Operation(summary = "食堂菜品购买统计", description = "食堂菜品购买统计")
@PostMapping("/proudct-total")
public R<Page<HardCanteenProductTotalVo>> productTotal(@ParameterObject Page page, @RequestBody HardOrderDto dto) {
DataScope dataScope = null;
DataScope dataScope = DataScope.of().only(true);
return R.ok(canteenTotalService.productTotal(page, dto, dataScope));
}
@@ -25,6 +25,7 @@ import com.bsd.pjcloud.common.security.service.PjcloudUser;
import com.bsd.pjcloud.common.security.util.SecurityUtils;
import com.bsd.pjcloud.hard.api.constant.HardTypeEnum;
import com.bsd.pjcloud.hard.api.constant.order.HardHourTypeEnum;
import com.bsd.pjcloud.hard.api.constant.order.HardOrderStatusEnum;
import com.bsd.pjcloud.hard.api.constant.order.HardOrderTypeEnum;
import com.bsd.pjcloud.hard.api.constant.order.HardPayTypeEnum;
import com.bsd.pjcloud.hard.api.dto.app.HardAppCreateOrderScancode;
@@ -44,11 +45,7 @@ import com.bsd.pjcloud.hard.api.vo.order.app.HardTakeOutDeliveryTimeOptionVO;
import com.bsd.pjcloud.hard.api.vo.order.excel.HardOrderExcelVo;
import com.bsd.pjcloud.hard.mapper.order.HardOrderMapper;
import com.bsd.pjcloud.hard.api.vo.order.HardOnlineCanteenStatsVo;
import com.bsd.pjcloud.hard.service.HardManagerService;
import com.bsd.pjcloud.hard.service.HardOnlineCanteenStatsService;
import com.bsd.pjcloud.hard.service.HardOrderService;
import com.bsd.pjcloud.hard.service.HardTakeOutDeliveryTimeOptionService;
import com.bsd.pjcloud.hard.service.HardOrderSyncService;
import com.bsd.pjcloud.hard.service.*;
import com.bsd.pjcloud.wallet.api.constant.WalletTypeEnum;
import com.bsd.pjcloud.wallet.api.feign.RemoteMchService;
import com.bsd.pjcloud.wallet.api.vo.MchManageVo;
@@ -91,6 +88,7 @@ public class HardOrderController {
private final HardManagerService hardManagerService;
private final HardOnlineCanteenStatsService hardOnlineCanteenStatsService;
private final HardOrderSyncService hardOrderSyncService;
private final HardCanteenTotalService canteenTotalService;
private final HardOrderMapper hardOrderMapper;
@@ -177,6 +175,32 @@ public class HardOrderController {
return R.ok(hardwareOrderService.pagejoin(page, dto));
}
@Operation(summary = "app查询食堂订餐的所有商户统计", description = "app查询食堂订餐的所有商户统计")
@GetMapping("/app/caneen-rserve-mch-total")
public R appCaneenRserveMchTotal() {
DataScope dataScope = null;
PjcloudUser user = SecurityUtils.getUser();
HardOrderDto dto = new HardOrderDto();
dto.setTotalIsFindChildren(false);
return R.ok(canteenTotalService.listByDept(dto, user, dataScope));
}
@Operation(summary = "app查询食堂订餐订单列表", description = "app查询食堂订餐订单列表")
@GetMapping("/app/caneen-rserve-page-join")
public R appCaneenRservePageJoin(@ParameterObject Page page, @ParameterObject HardOrderDto dto) {
dto.setIsFindCarList(true);
dto.setIsFindApptList(true);
dto.setOrderType(HardOrderTypeEnum.RESERVE.getType());
dto.setOrderStatusCodes(List.of(HardOrderStatusEnum.PAY.getType(), HardOrderStatusEnum.CANCEL.getType()));
DataScope dataScope = DataScope.of().only(true);
dataScope.setScopeDeptName("user_dept_id");
return R.ok(hardwareOrderService.scopePageList(page, dto, dataScope));
}
@Operation(summary = "app查询食堂订单列表", description = "app查询订单列表")
@GetMapping("/app/caneen-page-join")
public R appCaneenPageJoin(@ParameterObject Page page, @ParameterObject HardOrderDto dto) {
@@ -3,6 +3,7 @@ package com.bsd.pjcloud.hard.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bsd.pjcloud.common.data.datascope.DataScope;
import com.bsd.pjcloud.common.security.service.PjcloudUser;
import com.bsd.pjcloud.hard.api.dto.order.HardCarDto;
import com.bsd.pjcloud.hard.api.dto.order.app.HardAppProductByCanteenDto;
import com.bsd.pjcloud.hard.api.dto.order.app.HardAppProductByClassifyDto;
@@ -52,5 +53,5 @@ public interface HardCanteenTotalService {
/**
* 食堂菜品购买部门统计
*/
List<HardCanteenProductTotalVo> listByDept(HardOrderDto dto, DataScope dataScope);
List<HardCanteenProductTotalVo> listByDept(HardOrderDto dto, PjcloudUser user, DataScope dataScope);
}
@@ -3,9 +3,9 @@ package com.bsd.pjcloud.hard.service.impl.order;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.LocalDateTimeUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bsd.pjcloud.admin.api.entity.SysDept;
import com.bsd.pjcloud.admin.api.feign.RemoteDataScopeService;
import com.bsd.pjcloud.admin.api.feign.RemoteDeptService;
import com.bsd.pjcloud.canteen.api.feign.RemoteCanteenCategoryService;
import com.bsd.pjcloud.canteen.entity.CanteenCategoryEntity;
@@ -13,6 +13,8 @@ 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.common.data.datascope.PjcloudDefaultDataScopeHandle;
import com.bsd.pjcloud.common.security.service.PjcloudUser;
import com.bsd.pjcloud.hard.api.constant.order.HardOrderStatusEnum;
import com.bsd.pjcloud.hard.api.constant.total.DateRangeTypeEnum;
import com.bsd.pjcloud.hard.api.dto.order.HardCarDto;
@@ -28,6 +30,7 @@ import com.bsd.pjcloud.hard.api.vo.order.app.HardAppProductLikeTopVo;
import com.bsd.pjcloud.hard.mapper.order.HardCarMapper;
import com.bsd.pjcloud.hard.mapper.order.HardOrderMapper;
import com.bsd.pjcloud.hard.service.HardCanteenTotalService;
import com.bsd.pjcloud.wallet.api.dto.MchManageDto;
import com.bsd.pjcloud.wallet.api.feign.RemoteMchService;
import com.bsd.pjcloud.wallet.api.vo.MchManageVo;
import lombok.RequiredArgsConstructor;
@@ -66,7 +69,7 @@ public class HardCanteenTotalServiceImpl implements HardCanteenTotalService {
private final RemoteDeptService remoteDeptService;
private final RemoteMchService remoteMchService;
private final RemoteDataScopeService dataScopeService;
private final RemoteCanteenCategoryService canteenCategoryService;
/**
@@ -173,7 +176,11 @@ public class HardCanteenTotalServiceImpl implements HardCanteenTotalService {
@Override
public Page<HardCanteenProductTotalVo> productTotal(Page page, HardOrderDto dto, DataScope dataScope) {
dto.setOrderStatusCodes(HardOrderStatusEnum.getPaySuccessCodes());
Page<HardCanteenProductTotalVo> pageList = hardCarMapper.productTotal(page, dto, dataScope);
new PjcloudDefaultDataScopeHandle(dataScopeService).calcScope(dataScope);
if (ObjectUtil.isNotEmpty(dataScope.getDeptList())) {
dto.setScopeDeptIds(dataScope.getDeptList());
}
Page<HardCanteenProductTotalVo> pageList = hardCarMapper.productTotal(page, dto, null);
if (ObjectUtil.isNotEmpty(pageList)) {
for (HardCanteenProductTotalVo v : pageList.getRecords()) {
LocalDate localDate = v.getCreateTime().toLocalDate();
@@ -196,14 +203,17 @@ public class HardCanteenTotalServiceImpl implements HardCanteenTotalService {
* 食堂菜品购买部门统计
*/
@Override
public List<HardCanteenProductTotalVo> listByDept(HardOrderDto dto, DataScope dataScope) {
public List<HardCanteenProductTotalVo> listByDept(HardOrderDto dto, PjcloudUser user, DataScope dataScope) {
dto.setOrderStatusCodes(HardOrderStatusEnum.getPaySuccessCodes());
// 查询所有的自营食堂
List<MchManageVo> mchList = remoteMchService.getByTypes(List.of(MerchantTypeEnum.CANTEEN.getType())).getData();
MchManageDto mchListDto = new MchManageDto();
mchListDto.setTypesList(List.of(MerchantTypeEnum.CANTEEN.getType()));
mchListDto.setScopeUserDeptId(user.getDeptId());
List<MchManageVo> mchList = remoteMchService.list(mchListDto).getData();
if (ObjectUtil.isEmpty(mchList)) return null;
dto.setMchIds(mchList.stream().map(MchManageVo::getId).toList());
List<HardCanteenProductTotalVo> list = hardCarMapper.listByDept(dto, dataScope);
if (ObjectUtil.isNotEmpty(list)) {
if (ObjectUtil.isNotEmpty(list) && ObjectUtil.isNotEmpty(dto.getTotalIsFindChildren()) && dto.getTotalIsFindChildren()) {
// 限制最大线程数为10
int threadCount = Math.min(list.size(), 10);
ExecutorService executorService = Executors.newFixedThreadPool(threadCount);
@@ -138,12 +138,21 @@
<if test="dto.hourType != null and dto.hourType != '' ">
and o.hour_type = #{dto.hourType}
</if>
<if test="dto.orderType != null and dto.orderType != '' ">
and o.order_type = #{dto.orderType}
</if>
<if test="dto.merchantId != null">
and o.merchant_id = #{dto.merchantId}
</if>
<if test="dto.isOfflineOrder != null">
and o.is_offline_order = #{dto.isOfflineOrder}
</if>
<if test="dto.scopeDeptIds != null and dto.scopeDeptIds.size() != 0">
and o.dept_id IN
<foreach collection="dto.scopeDeptIds" item="v" open="(" close=")" separator=",">
#{v}
</foreach>
</if>
<if test="dto.deptIds != null and dto.deptIds.size() != 0">
<choose>
<when test="dto.isInclude != null and dto.isInclude == true">
@@ -238,6 +247,15 @@
#{v}
</foreach>
</if>
<if test="dto.mchIds != null and dto.mchIds.size() != 0">
and o.merchant_id in
<foreach collection="dto.mchIds" item="v" open="(" close=")" separator=",">
#{v}
</foreach>
</if>
<if test="dto.orderType != null and dto.orderType != '' ">
and o.order_type = #{dto.orderType}
</if>
<if test="dto.hourType != null and dto.hourType != '' ">
and o.hour_type = #{dto.hourType}
</if>
@@ -99,13 +99,17 @@ public interface RemoteDeptService {
/**
* 获得指定部门的所有子部门
*
* @param deptId
* @return
*/
@GetMapping("/dept/getDescendantList/{deptId}")
R<List<SysDept>> getDescendantList(@PathVariable Long deptId);
/**
* 获得指定部门的所有子部门
*/
@NoToken
@GetMapping("/dept/inner/getDescendantList/{deptId}")
R<List<SysDept>> getInnerDescendantList(@PathVariable Long deptId);
/**
* 查询部门所属的分组部门
@@ -30,6 +30,7 @@ import com.bsd.pjcloud.common.data.datascope.DataScope;
import com.bsd.pjcloud.common.data.tenant.TenantContextHolder;
import com.bsd.pjcloud.common.excel.annotation.RequestExcel;
import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
import com.bsd.pjcloud.common.feign.annotation.NoToken;
import com.bsd.pjcloud.common.log.annotation.SysLog;
import com.bsd.pjcloud.common.security.annotation.HasPermission;
import com.bsd.pjcloud.common.security.annotation.Inner;
@@ -165,11 +166,17 @@ public class SysDeptController {
* @return 返回子级
*/
@GetMapping(value = "/getDescendantList/{deptId}")
public R getDescendantList(@PathVariable Long deptId) {
public R<List<SysDept>> getDescendantList(@PathVariable Long deptId) {
return R.ok(sysDeptService.listDescendant(deptId));
}
@Inner
@GetMapping("/inner/getDescendantList/{deptId}")
R<List<SysDept>> getInnerDescendantList(@PathVariable Long deptId) {
return R.ok(sysDeptService.listDescendant(deptId));
}
@Inner
@GetMapping(value = "/leader/{deptId}")
public R getAllDeptLeader(@PathVariable Long deptId) {
@@ -34,4 +34,9 @@ public class MchManageDto extends MchManageEntity {
* 分类名
*/
private String catgoryName;
/**
* 权限用户部门id
*/
private Long scopeUserDeptId;
}
@@ -14,7 +14,6 @@ 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.R;
import com.bsd.pjcloud.common.data.datascope.DataScope;
import com.bsd.pjcloud.common.data.resolver.ParamResolver;
import com.bsd.pjcloud.common.log.annotation.SysLog;
import com.bsd.pjcloud.common.security.annotation.Inner;
import com.bsd.pjcloud.common.security.service.PjcloudUser;
@@ -55,6 +54,17 @@ public class MchManageController {
@Inner
@PostMapping("/list")
public R<List<MchManageVo>> remoteList(@RequestBody MchManageDto body) {
if (ObjectUtil.isNotEmpty(body.getScopeUserDeptId())) {
MchManageVo targetMch = mchManageService.getViewsCanteenMchByDeptId(body.getScopeUserDeptId());
if (ObjectUtil.isNotEmpty(targetMch)) {
body.setIds(List.of(targetMch.getId()));
} else {
List<SysDept> deptIdList = remoteDeptService.getInnerDescendantList(body.getScopeUserDeptId()).getData();
if (ObjectUtil.isNotEmpty(deptIdList)) {
body.setDeptIds(deptIdList.stream().map(SysDept::getDeptId).toList());
}
}
}
List<MchManageVo> list = mchManageService.list(body);
return R.ok(list);
}