feat:隐私协议

This commit is contained in:
dzc committed 2026-06-11 13:39:13 +08:00
1 parent 95949c9194
commit 756d3caab3
14 files changed
+141 -23

No files matched your search

@@ -86,4 +86,9 @@ public class HardOrderDto extends HardOrderEntity implements BaseIsIncludeTreeIn
* 统计是否查询子部门
*/
Boolean totalIsFindChildren = false;
/**
* `apptId`不为null
*/
Boolean apptIdNotNull = false;
}
@@ -4,6 +4,8 @@ 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.constant.order.HardOrderTypeEnum;
import com.bsd.pjcloud.hard.api.constant.order.HardPayTypeEnum;
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;
@@ -2,6 +2,7 @@ package com.bsd.pjcloud.hard.controller.order;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bsd.pjcloud.common.core.constant.enums.MerchantTypeEnum;
import com.bsd.pjcloud.common.core.util.R;
import com.bsd.pjcloud.common.data.datascope.DataScope;
import com.bsd.pjcloud.common.security.annotation.Inner;
@@ -18,6 +19,9 @@ import com.bsd.pjcloud.hard.api.vo.order.app.HardAppProductByCanteenVo;
import com.bsd.pjcloud.hard.api.vo.order.app.HardAppProductByClassifyVo;
import com.bsd.pjcloud.hard.api.vo.order.app.HardAppProductLikeTopVo;
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 io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
@@ -42,6 +46,8 @@ public class HardCanteenTotalController {
private final HardCanteenTotalService canteenTotalService;
private final RemoteMchService remoteMchService;
/* ************************************* start app start ************************************* */
/**
@@ -88,14 +94,28 @@ public class HardCanteenTotalController {
@PostMapping("/proudct-total-by-dept")
public R<List<HardCanteenProductTotalVo>> productTotalByDept(@ParameterObject Page page, @RequestBody HardOrderDto dto) {
DataScope dataScope = null;
// 查询商户
MchManageDto mchManageDto = new MchManageDto();
mchManageDto.setTypesList(List.of(MerchantTypeEnum.CANTEEN.getType()));
List<MchManageVo> mchList = remoteMchService.scopeList(mchManageDto).getData();
if (ObjectUtil.isNotEmpty(mchList) && ObjectUtil.isEmpty(dto.getMchIds())) {
dto.setMchIds(mchList.stream().map(MchManageVo::getId).toList());
}
return R.ok(canteenTotalService.productTotalByDept(page, dto, dataScope));
}
@Operation(summary = "食堂菜品购买统计", description = "食堂菜品购买统计")
@PostMapping("/proudct-total")
public R<Page<HardCanteenProductTotalVo>> productTotal(@ParameterObject Page page, @RequestBody HardOrderDto dto) {
DataScope dataScope = DataScope.of().only(true);
return R.ok(canteenTotalService.productTotal(page, dto, dataScope));
// 查询商户
MchManageDto mchManageDto = new MchManageDto();
mchManageDto.setTypesList(List.of(MerchantTypeEnum.CANTEEN.getType()));
List<MchManageVo> mchList = remoteMchService.scopeList(mchManageDto).getData();
if (ObjectUtil.isNotEmpty(mchList) && ObjectUtil.isEmpty(dto.getMchIds())) {
dto.setMchIds(mchList.stream().map(MchManageVo::getId).toList());
}
return R.ok(canteenTotalService.productTotal(page, dto, null));
}
@Operation(summary = "菜品出售统计", description = "菜品出售统计")
@@ -30,6 +30,7 @@ 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;
import com.bsd.pjcloud.hard.api.dto.hard.CurrentUserHardTypeInfoDto;
import com.bsd.pjcloud.hard.api.dto.hard.HandCancelCodeDto;
import com.bsd.pjcloud.hard.api.dto.hard.HardOfflinePayDto;
import com.bsd.pjcloud.hard.api.dto.order.HardOnlineCanteenStatsQueryDto;
import com.bsd.pjcloud.hard.api.dto.order.HardOrderDto;
@@ -47,6 +48,7 @@ import com.bsd.pjcloud.hard.mapper.order.HardOrderMapper;
import com.bsd.pjcloud.hard.api.vo.order.HardOnlineCanteenStatsVo;
import com.bsd.pjcloud.hard.service.*;
import com.bsd.pjcloud.wallet.api.constant.WalletTypeEnum;
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 jakarta.servlet.http.HttpServletResponse;
@@ -177,13 +179,13 @@ public class HardOrderController {
@Operation(summary = "app查询食堂订餐的所有商户统计", description = "app查询食堂订餐的所有商户统计")
@GetMapping("/app/caneen-rserve-mch-total")
public R appCaneenRserveMchTotal() {
public R appCaneenRserveMchTotal(@ParameterObject HardOrderDto dto) {
DataScope dataScope = null;
PjcloudUser user = SecurityUtils.getUser();
HardOrderDto dto = new HardOrderDto();
dto.setOrderType(HardOrderTypeEnum.RESERVE.getType());
dto.setTotalIsFindChildren(false);
dto.setApptIdNotNull(true);
return R.ok(canteenTotalService.listByDept(dto, user, dataScope));
}
@@ -194,9 +196,17 @@ public class HardOrderController {
dto.setIsFindApptList(true);
dto.setOrderType(HardOrderTypeEnum.RESERVE.getType());
dto.setOrderStatusCodes(List.of(HardOrderStatusEnum.PAY.getType(), HardOrderStatusEnum.CANCEL.getType()));
dto.setApptIdNotNull(true);
DataScope dataScope = DataScope.of().only(true);
dataScope.setScopeDeptName("user_dept_id");
DataScope dataScope = null;
// 查询商户
MchManageDto mchManageDto = new MchManageDto();
mchManageDto.setTypesList(List.of(MerchantTypeEnum.CANTEEN.getType()));
List<MchManageVo> mchList = mchService.scopeList(mchManageDto).getData();
if (ObjectUtil.isNotEmpty(mchList) && ObjectUtil.isEmpty(dto.getMchIds())) {
dto.setMchIds(mchList.stream().map(MchManageVo::getId).toList());
}
return R.ok(hardwareOrderService.scopePageList(page, dto, dataScope));
}
@@ -346,6 +356,18 @@ public class HardOrderController {
return R.ok(hardwareOrderService.appCreateActOrder(body));
}
@Operation(summary = "app核销线上预订", description = "app核销线上预订")
@PutMapping("/app/rserve-cancel-order/{orderId}")
@Idempotent(expireTime = 1, key = "'/hard-order/app/rserve-cancel-order' + #orderId ", info = "正在核销中,请勿重复操作")
public R<Boolean> appRserveCancelOrder(@PathVariable Long orderId) {
PjcloudUser user = SecurityUtils.getUser();
HandCancelCodeDto body = new HandCancelCodeDto();
body.setUserId(user.getId());
body.setOrderId(orderId);
body.setHardwareId(-1L);
return R.ok(hardwareOrderService.handCancelCode(body));
}
/* ************************************* end app end ************************************* */
@Operation(summary = "分页查询", description = "分页查询")
@@ -176,10 +176,6 @@ public class HardCanteenTotalServiceImpl implements HardCanteenTotalService {
@Override
public Page<HardCanteenProductTotalVo> productTotal(Page page, HardOrderDto dto, DataScope dataScope) {
dto.setOrderStatusCodes(HardOrderStatusEnum.getPaySuccessCodes());
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()) {
@@ -208,8 +204,8 @@ public class HardCanteenTotalServiceImpl implements HardCanteenTotalService {
// 查询所有的自营食堂
MchManageDto mchListDto = new MchManageDto();
mchListDto.setTypesList(List.of(MerchantTypeEnum.CANTEEN.getType()));
mchListDto.setScopeUserDeptId(user.getDeptId());
List<MchManageVo> mchList = remoteMchService.list(mchListDto).getData();
// mchListDto.setScopeUserDeptId(user.getDeptId());
List<MchManageVo> mchList = remoteMchService.scopeList(mchListDto).getData();
if (ObjectUtil.isEmpty(mchList)) return null;
dto.setMchIds(mchList.stream().map(MchManageVo::getId).toList());
List<HardCanteenProductTotalVo> list = hardCarMapper.listByDept(dto, dataScope);
@@ -222,21 +222,29 @@ public class HardOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardOrder
HardOrderDto dto = new HardOrderDto();
dto.setId(id);
HardOrderVo detail = baseMapper.join(dto);
RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
if (ObjectUtil.isNotEmpty(detail)) {
// 用户
if (ObjectUtil.isNotEmpty(detail.getUserId())) {
List<UserVO> userVoList = userService.getUserDeptByIds(List.of(detail.getUserId())).getData();
if (ObjectUtil.isNotEmpty(userVoList) && ObjectUtil.isNotEmpty(userVoList.get(0))) {
DataUtil.convertUserDept(detail, userVoList.get(0));
CompletableFuture<Void> findUserFuture = CompletableFuture.runAsync(() -> {
if (ObjectUtil.isNotEmpty(detail.getUserId())) {
List<UserVO> userVoList = userService.getUserDeptByIds(List.of(detail.getUserId())).getData();
if (ObjectUtil.isNotEmpty(userVoList) && ObjectUtil.isNotEmpty(userVoList.get(0))) {
DataUtil.convertUserDept(detail, userVoList.get(0));
}
}
}
});
// 商户
if (ObjectUtil.isNotEmpty(detail.getMerchantId())) {
R<MchManageVo> mch = remoteMchService.getById(detail.getMerchantId());
if (ObjectUtil.isNotEmpty(mch.getData())) {
WalletDataUtil.convertMch(detail, mch.getData());
CompletableFuture<Void> findMchFuture = CompletableFuture.runAsync(() -> {
RequestContextHolder.setRequestAttributes(requestAttributes);
if (ObjectUtil.isNotEmpty(detail.getMerchantId())) {
R<MchManageVo> mch = remoteMchService.getById(detail.getMerchantId());
if (ObjectUtil.isNotEmpty(mch.getData())) {
WalletDataUtil.convertMch(detail, mch.getData());
}
}
}
});
// 二维码
if (isHaveCode(detail)) {
WalletCodeUseEntity codeDetail = remoteCodeUseService.getByBizId(detail.getId()).getData();
@@ -244,6 +252,24 @@ public class HardOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardOrder
detail.setReserveCode(codeDetail.getCode());
}
}
// 购物车
CompletableFuture<Void> findCarFuture = CompletableFuture.runAsync(() -> {
RequestContextHolder.setRequestAttributes(requestAttributes);
List<HardCarEntity> carList = hardCarService.getByParentCarId(detail.getParentCarId());
List<HardCarVo> carVoList = BeanUtils.toBean(carList, HardCarVo.class);
detail.setCarList(carVoList);
});
// 预约订单
CompletableFuture<Void> findApptFuture = CompletableFuture.runAsync(() -> {
RequestContextHolder.setRequestAttributes(requestAttributes);
HardApptEntity apptDetail = hardApptService.getById(detail.getApptId());
if (ObjectUtil.isEmpty(apptDetail)) return;
detail.setApptTitle(apptDetail.getTitle());
detail.setApptHourType(apptDetail.getHourType());
detail.setApptStartTime(apptDetail.getStartTime());
detail.setApptEndTime(apptDetail.getEndTime());
});
CompletableFuture.allOf(findUserFuture, findMchFuture, findCarFuture, findApptFuture).join();
}
return detail;
}
@@ -241,6 +241,12 @@
o.hour_type not in ('-1')
<where>
<include refid="whereA"/>
<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>
<if test="dto.orderStatusCodes != null and dto.orderStatusCodes.size() != 0">
and o.order_status in
<foreach collection="dto.orderStatusCodes" item="v" open="(" close=")" separator=",">
@@ -85,6 +85,9 @@
<sql id="whereA">
a.del_flag = '0'
<if test="dto.apptIdNotNull != null and dto.apptIdNotNull == true ">
and a.appt_id is not null
</if>
<if test="dto.hardId != null">
and a.hard_id = #{dto.hardId}
</if>
@@ -220,6 +220,11 @@ public class MchManageEntity extends Model<MchManageEntity> {
@Data
public static class FunctionScope {
/**
* 是否开启商城
*/
private Boolean mallEnable;
/**
* 是否启用报餐
*/
@@ -21,6 +21,9 @@ public interface RemoteMchService {
@PostMapping("/mch-manage/list")
R<List<MchManageVo>> list(@RequestBody MchManageDto body);
@PostMapping("/mch-manage/scope-list")
R<List<MchManageVo>> scopeList(@RequestBody MchManageDto body);
@NoToken
@GetMapping("/mch-manage/get-by-types")
R<List<MchManageVo>> getByTypes(@RequestParam List<String> types);
@@ -104,6 +104,12 @@ public class WalletCodeUseController {
dto.setUserId(user.getId());
return R.ok(walletCodeUseService.pageJoin(page, dto));
}
@Operation(summary = "根据短码查询加密信息", description = "根据短码查询加密信息")
@GetMapping("/app/get-by-short-code")
public R appGetByShortCode(@RequestParam String shortCode) {
return R.ok(walletCodeUseService.getByShortCode(shortCode));
}
/* ************************************* end app end ************************************* */
/* ************************************* start android start ************************************* */
@@ -51,6 +51,13 @@ public class MchManageController {
private final RemoteUserService remoteUserService;
/* ************************************* start 远程调用 start ************************************* */
@PostMapping("/scope-list")
public R<List<MchManageVo>> scopeList(@RequestBody MchManageDto body) {
List<MchManageVo> list = mchManageService.scopeList(body, DataScope.of().only(true));
return R.ok(list);
}
@Inner
@PostMapping("/list")
public R<List<MchManageVo>> remoteList(@RequestBody MchManageDto body) {
@@ -37,6 +37,8 @@ public interface MchManageService extends IService<MchManageEntity> {
List<MchManageVo> list(MchManageDto dto);
List<MchManageVo> scopeList(MchManageDto dto, DataScope dataScope);
MchManageVo getByDeptId(Long deptId, MerchantTypeEnum type);
MchManageVo getFirstMch(List<Long> deptIds, List<MerchantTypeEnum> mchTypeList);
@@ -318,6 +318,21 @@ public class MchManageServiceImpl extends ServiceImpl<MchManageMapper, MchManage
return list;
}
@Override
public List<MchManageVo> scopeList(MchManageDto dto, DataScope dataScope) {
List<MchManageVo> list = baseMapper.scopeList(dto, dataScope);
if (ObjectUtil.isEmpty(list)) return null;
// 部门
List<Long> deptIds = list.stream().map(MchManageVo::getDeptId).distinct().toList();
if (ObjectUtil.isNotEmpty(deptIds)) {
R<Map<Long, SysDept>> deptList = remoteDeptService.getDeptByDeptIds(deptIds);
if (ObjectUtil.isNotEmpty(deptList.getData())) {
DataUtil.convertDeptList(list, deptList.getData());
}
}
return list;
}
@Override
public MchManageVo getByDeptId(Long deptId, MerchantTypeEnum type) {
MchManageEntity mchManage = baseMapper.selectOne(new LambdaQueryWrapper<MchManageEntity>()