超市,食堂模块接口
This commit is contained in:
1 parent
2529a05743
commit
9ab12753b8
17 files changed
+378
-5
No files matched your search
+44
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2018-2025, pjcloud All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the pig4cloud.com developer nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
* Author: pjcloud
|
||||
*
|
||||
*/
|
||||
|
||||
package com.bsd.pjcloud.canteen.api.feign;
|
||||
|
||||
|
||||
import com.bsd.pjcloud.common.core.constant.ServiceNameConstants;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* @author zjf
|
||||
* @date 2018/6/22
|
||||
*/
|
||||
@FeignClient(contextId = "remoteUserService", value = ServiceNameConstants.CANTEEN_SERVICE)
|
||||
public interface RemoteCanteenCategoryService {
|
||||
|
||||
|
||||
/**
|
||||
* 查询所有的菜品分类
|
||||
* @param categoryType 餐段类型,1早餐 2中 3晚餐 不传默认所有
|
||||
* @return R
|
||||
*/
|
||||
@GetMapping("/canteenCategory/getAllSimple")
|
||||
R getAllSimple(@RequestParam(value = "categoryType",required = false) String categoryType);
|
||||
|
||||
}
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2018-2025, pjcloud All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the pig4cloud.com developer nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
* Author: pjcloud
|
||||
*
|
||||
*/
|
||||
|
||||
package com.bsd.pjcloud.canteen.api.feign;
|
||||
|
||||
|
||||
import com.bsd.pjcloud.canteen.dto.CanteenSpuUpdateStockReqDTO;
|
||||
import com.bsd.pjcloud.common.core.constant.ServiceNameConstants;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
/**
|
||||
* @author zjf
|
||||
* @date 2018/6/22
|
||||
*/
|
||||
@FeignClient(contextId = "remoteUserService", value = ServiceNameConstants.CANTEEN_SERVICE)
|
||||
public interface RemoteCanteenSpuService {
|
||||
|
||||
|
||||
/**
|
||||
* 获取菜品列表
|
||||
* @param categoryId 不填默认查全部
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/canteenSpu/ad/getCanteenSpuList")
|
||||
R getCanteenSpuList(@RequestParam(value = "categoryId",required = false)String categoryId);
|
||||
|
||||
|
||||
/**
|
||||
* 扣减菜品库存
|
||||
* @param updateStockReqDTO
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/canteenSpu/ad/updateSkuStock")
|
||||
R getAllSimple(@RequestBody CanteenSpuUpdateStockReqDTO updateStockReqDTO);
|
||||
|
||||
}
|
||||
+1
-1
@@ -7,7 +7,7 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* @author ml
|
||||
* 菜品下拉框主页展示
|
||||
* 后台每日菜谱菜品下拉框
|
||||
*/
|
||||
@Data
|
||||
public class DailyMenuAll {
|
||||
|
||||
+82
@@ -0,0 +1,82 @@
|
||||
package com.bsd.pjcloud.canteen.vo;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@Schema(description = "安卓机在线点餐获取菜品信息")
|
||||
public class ADCanteenSpuListVO {
|
||||
|
||||
|
||||
/**
|
||||
* 商品 SPU 编号,自增
|
||||
*/
|
||||
@Schema(description="商品 SPU 编号,自增")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 商品名称
|
||||
*/
|
||||
@Schema(description="商品名称")
|
||||
private String name;
|
||||
|
||||
|
||||
/**
|
||||
* 商品分类编号
|
||||
*/
|
||||
@Schema(description="商品分类编号")
|
||||
private Long categoryId;
|
||||
|
||||
/**
|
||||
* 商品封面图
|
||||
*/
|
||||
@Schema(description="商品封面图")
|
||||
private String picUrl;
|
||||
|
||||
|
||||
/**
|
||||
* 商品价格,单位使用:分
|
||||
*/
|
||||
@Schema(description="商品价格,单位使用:分")
|
||||
private Integer price;
|
||||
|
||||
|
||||
/**
|
||||
* 市场价,单位使用:分
|
||||
*/
|
||||
@Schema(description="市场价,单位使用:分")
|
||||
private Integer marketPrice;
|
||||
|
||||
|
||||
/**
|
||||
* 库存
|
||||
*/
|
||||
@Schema(description="库存")
|
||||
private Integer stock;
|
||||
|
||||
|
||||
/**
|
||||
* 商品销量
|
||||
*/
|
||||
@Schema(description="商品销量")
|
||||
private Integer salesCount;
|
||||
|
||||
|
||||
/**
|
||||
* 商户编号
|
||||
*/
|
||||
@Schema(description="商户编号")
|
||||
private Long merchantId;
|
||||
|
||||
/**
|
||||
* 部门id
|
||||
*/
|
||||
@Schema(description="部门id")
|
||||
private Long deptId;
|
||||
|
||||
|
||||
}
|
||||
+2
-2
@@ -134,8 +134,8 @@ public class CanteenCategoryController {
|
||||
public R getAllSimple(@RequestParam(value = "categoryType",required = false)String categoryType) {
|
||||
LambdaQueryWrapper<CanteenCategoryEntity> wrapper = Wrappers.lambdaQuery();
|
||||
wrapper.orderByAsc(CanteenCategoryEntity::getSort);
|
||||
wrapper.eq(StringUtils.isNotEmpty(categoryType),CanteenCategoryEntity::getCategoryType,categoryType);
|
||||
List<CanteenCategoryEntity> list = canteenCategoryService.list(wrapper);
|
||||
wrapper.apply(StringUtils.isNotEmpty(categoryType),"FIND_IN_SET({0}, your_column_name)",categoryType);
|
||||
List<CanteenCategoryEntity> list = canteenCategoryService.listScope(wrapper);
|
||||
return R.ok(list);
|
||||
}
|
||||
}
|
||||
+11
@@ -131,8 +131,19 @@ public class CanteenSpuController {
|
||||
// --------------APP-----------------
|
||||
|
||||
|
||||
/**
|
||||
* 获取菜品列表
|
||||
* @param categoryId 分类编号,不传默认查询全部
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/ad/getCanteenSpuList")
|
||||
public R getCanteenSpuList(@RequestParam(value = "categoryId",required = false)String categoryId){
|
||||
return canteenSpuService.getCanteenSpuList(categoryId);
|
||||
}
|
||||
|
||||
@PostMapping("/ad/updateSkuStock")
|
||||
@SysLog("更新菜品库存")
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenSpu_edit')" )
|
||||
public R updateSkuStock(@RequestBody CanteenSpuUpdateStockReqDTO updateStockReqDTO){
|
||||
return canteenSpuService.updateSkuStock(updateStockReqDTO);
|
||||
}
|
||||
|
||||
+10
@@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bsd.pjcloud.canteen.entity.CanteenCategoryEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface CanteenCategoryService extends IService<CanteenCategoryEntity> {
|
||||
|
||||
|
||||
@@ -15,4 +17,12 @@ public interface CanteenCategoryService extends IService<CanteenCategoryEntity>
|
||||
* @return
|
||||
*/
|
||||
Page<CanteenCategoryEntity> selectPageByScope(Page page, LambdaQueryWrapper<CanteenCategoryEntity> wrapper);
|
||||
|
||||
|
||||
/**
|
||||
* 获取菜品分类
|
||||
* @param wrapper
|
||||
* @return
|
||||
*/
|
||||
List<CanteenCategoryEntity> listScope(LambdaQueryWrapper<CanteenCategoryEntity> wrapper);
|
||||
}
|
||||
+7
@@ -27,4 +27,11 @@ public interface CanteenSpuService extends IService<CanteenSpuEntity> {
|
||||
*/
|
||||
R updateSkuStock(CanteenSpuUpdateStockReqDTO updateStockReqDTO);
|
||||
|
||||
|
||||
/**
|
||||
* 根据菜品分类id获取菜品信息
|
||||
* @param categoryId
|
||||
* @return
|
||||
*/
|
||||
R getCanteenSpuList(String categoryId);
|
||||
}
|
||||
+5
@@ -26,4 +26,9 @@ public class CanteenCategoryServiceImpl extends ServiceImpl<CanteenCategoryMappe
|
||||
|
||||
return baseMapper.selectPageByScope(page,wrapper,DataScope.of());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CanteenCategoryEntity> listScope(LambdaQueryWrapper<CanteenCategoryEntity> wrapper) {
|
||||
return baseMapper.selectListByScope(wrapper,DataScope.of());
|
||||
}
|
||||
}
|
||||
+11
@@ -8,12 +8,15 @@ import com.bsd.pjcloud.canteen.entity.CanteenSpuEntity;
|
||||
import com.bsd.pjcloud.canteen.mapper.CanteenSpuMapper;
|
||||
import com.bsd.pjcloud.canteen.service.CanteenDailyMenuService;
|
||||
import com.bsd.pjcloud.canteen.service.CanteenSpuService;
|
||||
import com.bsd.pjcloud.canteen.vo.ADCanteenSpuListVO;
|
||||
import com.bsd.pjcloud.common.core.util.BeanUtils;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@@ -51,6 +54,14 @@ public class CanteenSpuServiceImpl extends ServiceImpl<CanteenSpuMapper, Canteen
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@Override
|
||||
public R getCanteenSpuList(String categoryId) {
|
||||
List<CanteenSpuEntity> canteenSpuEntities = baseMapper.selectListByScope(new LambdaQueryWrapper<CanteenSpuEntity>()
|
||||
.eq(StringUtils.isNotEmpty(categoryId), CanteenSpuEntity::getCategoryId, categoryId),DataScope.of());
|
||||
List<ADCanteenSpuListVO> bean = BeanUtils.toBean(canteenSpuEntities, ADCanteenSpuListVO.class);
|
||||
return R.ok(bean);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+10
@@ -67,6 +67,16 @@ public interface ServiceNameConstants {
|
||||
*/
|
||||
String CANTEEN_SERVICE = "pjcloud-canteen-biz";
|
||||
|
||||
/**
|
||||
* 超市服务
|
||||
*/
|
||||
String SUPERMARKET_SERVICE = "pjcloud-supermarket-biz";
|
||||
|
||||
/**
|
||||
* 超市erp服务
|
||||
*/
|
||||
String SUPERMARKET_ERP_SERVICE = "pjcloud-supermarket-erp-biz";
|
||||
|
||||
/**
|
||||
* 钱包模块
|
||||
*/
|
||||
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2018-2025, pjcloud All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the pig4cloud.com developer nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
* Author: pjcloud
|
||||
*
|
||||
*/
|
||||
|
||||
package com.bsd.pjcloud.supermarket.api.feign;
|
||||
|
||||
|
||||
import com.bsd.pjcloud.common.core.constant.ServiceNameConstants;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
/**
|
||||
* @author zjf
|
||||
* @date 2018/6/22
|
||||
*/
|
||||
@FeignClient(contextId = "remoteUserService", value = ServiceNameConstants.SUPERMARKET_SERVICE)
|
||||
public interface RemoteSupermarketCategoryService {
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询所有的分类
|
||||
* @return R
|
||||
*/
|
||||
@GetMapping("/supermarketCategory/simpleAll")
|
||||
R getSimpleAll();
|
||||
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2018-2025, pjcloud All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the pig4cloud.com developer nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
* Author: pjcloud
|
||||
*
|
||||
*/
|
||||
|
||||
package com.bsd.pjcloud.supermarket.api.feign;
|
||||
|
||||
|
||||
import com.bsd.pjcloud.common.core.constant.ServiceNameConstants;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.feign.annotation.NoToken;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zjf
|
||||
* @date 2018/6/22
|
||||
*/
|
||||
@FeignClient(contextId = "remoteUserService", value = ServiceNameConstants.SUPERMARKET_SERVICE)
|
||||
public interface RemoteSupermarketSpuService {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
+1
-1
@@ -123,7 +123,7 @@ public class SupermarketCategoryController {
|
||||
|
||||
|
||||
/**
|
||||
* 下拉查询
|
||||
* 获取所有分类
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "下拉查询")
|
||||
|
||||
+16
-1
@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.log.annotation.SysLog;
|
||||
import com.bsd.pjcloud.common.security.util.SecurityUtils;
|
||||
import com.bsd.pjcloud.supermarket.dto.SupermarketSpuUpdateStockReqDTO;
|
||||
import com.bsd.pjcloud.supermarket.entity.SupermarketSpuEntity;
|
||||
import com.bsd.pjcloud.supermarket.service.SupermarketSpuService;
|
||||
@@ -52,7 +53,7 @@ public class SupermarketSpuController {
|
||||
wrapper.eq(StrUtil.isNotBlank(supermarketSpu.getProductCode()),SupermarketSpuEntity::getProductCode,supermarketSpu.getProductCode());
|
||||
wrapper.eq(StrUtil.isNotBlank(supermarketSpu.getBarcode()),SupermarketSpuEntity::getBarcode,supermarketSpu.getBarcode());
|
||||
wrapper.eq(StrUtil.isNotBlank(supermarketSpu.getProductName()),SupermarketSpuEntity::getProductName,supermarketSpu.getProductName());
|
||||
return R.ok(supermarketSpuService.page(page, wrapper));
|
||||
return R.ok(supermarketSpuService.pageScope(page, wrapper));
|
||||
}
|
||||
|
||||
|
||||
@@ -78,6 +79,7 @@ public class SupermarketSpuController {
|
||||
@PostMapping
|
||||
@PreAuthorize("@pms.hasPermission('supermarket_supermarketSpu_add')" )
|
||||
public R save(@RequestBody SupermarketSpuEntity supermarketSpu) {
|
||||
supermarketSpu.setDeptId(SecurityUtils.getUser().getDeptId());
|
||||
return supermarketSpuService.saveSpu(supermarketSpu);
|
||||
}
|
||||
|
||||
@@ -126,4 +128,17 @@ public class SupermarketSpuController {
|
||||
public R updateSkuStock(@RequestBody SupermarketSpuUpdateStockReqDTO updateStockReqDTO){
|
||||
return supermarketSpuService.updateSpuStock(updateStockReqDTO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 条件查询
|
||||
* @param supermarketSpu 商品spu
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "条件查询所有" , description = "条件查询所有" )
|
||||
@GetMapping("/selectListAll" )
|
||||
@PreAuthorize("@pms.hasPermission('supermarket_supermarketSpu_view')" )
|
||||
public R getSupermarketSpuPage(@ParameterObject SupermarketSpuEntity supermarketSpu) {
|
||||
return R.ok(supermarketSpuService.selectListAllScope(supermarketSpu));
|
||||
}
|
||||
}
|
||||
+18
@@ -1,5 +1,7 @@
|
||||
package com.bsd.pjcloud.supermarket.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.supermarket.dto.SupermarketSpuUpdateStockReqDTO;
|
||||
@@ -25,4 +27,20 @@ public interface SupermarketSpuService extends IService<SupermarketSpuEntity> {
|
||||
* @return
|
||||
*/
|
||||
R updateSpuStock(SupermarketSpuUpdateStockReqDTO updateStockReqDTO);
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param page
|
||||
* @param wrapper
|
||||
* @return
|
||||
*/
|
||||
Object pageScope(Page page, LambdaQueryWrapper<SupermarketSpuEntity> wrapper);
|
||||
|
||||
/**
|
||||
* 根据条件查询所有数据,app/收银机接口
|
||||
* @param supermarketSpu
|
||||
* @return
|
||||
*/
|
||||
Object selectListAllScope(SupermarketSpuEntity supermarketSpu);
|
||||
}
|
||||
+15
@@ -1,8 +1,10 @@
|
||||
package com.bsd.pjcloud.supermarket.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.supermarket.dto.SupermarketSpuUpdateStockReqDTO;
|
||||
import com.bsd.pjcloud.supermarket.entity.SupermarketAuxiliaryCodeEntity;
|
||||
import com.bsd.pjcloud.supermarket.entity.SupermarketSpuEntity;
|
||||
@@ -123,4 +125,17 @@ public class SupermarketSpuServiceImpl extends ServiceImpl<SupermarketSpuMapper,
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object pageScope(Page page, LambdaQueryWrapper<SupermarketSpuEntity> wrapper) {
|
||||
return baseMapper.selectPageByScope(page, wrapper, DataScope.of());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object selectListAllScope(SupermarketSpuEntity supermarketSpu) {
|
||||
|
||||
return null;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user