faet:食堂下发
This commit is contained in:
1 parent
80276298c3
commit
ecf050204a
5 files changed
+84
-51
No files matched your search
@@ -122,6 +122,12 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.bsd</groupId>
|
||||
<artifactId>pjcloud-mqtt-api</artifactId>
|
||||
<version>5.7.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<profiles>
|
||||
<profile>
|
||||
|
||||
+43
-38
@@ -38,24 +38,25 @@ import java.util.List;
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/canteenDailyMenu" )
|
||||
@Tag(description = "canteenDailyMenu" , name = "每日菜谱管理" )
|
||||
@RequestMapping("/canteenDailyMenu")
|
||||
@Tag(description = "canteenDailyMenu", name = "每日菜谱管理")
|
||||
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
|
||||
public class CanteenDailyMenuController {
|
||||
|
||||
private final CanteenDailyMenuService canteenDailyMenuService;
|
||||
private final CanteenDailyMenuService canteenDailyMenuService;
|
||||
|
||||
private final CanteenSpuService canteenSpuService;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param page 分页对象
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param canteenDailyMenu 每日菜谱
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "分页查询" , description = "分页查询" )
|
||||
@GetMapping("/page" )
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenDailyMenu_view')" )
|
||||
@Operation(summary = "分页查询", description = "分页查询")
|
||||
@GetMapping("/page")
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenDailyMenu_view')")
|
||||
public R getCanteenDailyMenuPage(@ParameterObject Page page, @ParameterObject CanteenDailyMenuEntity canteenDailyMenu) {
|
||||
LambdaQueryWrapper<CanteenDailyMenuEntity> wrapper = Wrappers.lambdaQuery();
|
||||
return R.ok(canteenDailyMenuService.page(page, wrapper));
|
||||
@@ -64,25 +65,27 @@ public class CanteenDailyMenuController {
|
||||
|
||||
/**
|
||||
* 通过id查询每日菜谱
|
||||
*
|
||||
* @param id id
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "通过id查询" , description = "通过id查询" )
|
||||
@GetMapping("/{id}" )
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenDailyMenu_view')" )
|
||||
public R getById(@PathVariable("id" ) Long id) {
|
||||
@Operation(summary = "通过id查询", description = "通过id查询")
|
||||
@GetMapping("/{id}")
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenDailyMenu_view')")
|
||||
public R getById(@PathVariable("id") Long id) {
|
||||
return R.ok(canteenDailyMenuService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增每日菜谱
|
||||
*
|
||||
* @param canteenDailyMenu 每日菜谱
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "新增每日菜谱" , description = "新增每日菜谱" )
|
||||
@SysLog("新增每日菜谱" )
|
||||
@Operation(summary = "新增每日菜谱", description = "新增每日菜谱")
|
||||
@SysLog("新增每日菜谱")
|
||||
@PostMapping
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenDailyMenu_add')" )
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenDailyMenu_add')")
|
||||
public R save(@RequestBody CanteenDailyMenuEntity canteenDailyMenu) {
|
||||
canteenDailyMenu.setDeptId(SecurityUtils.getUser().getDeptId());
|
||||
canteenDailyMenuService.saveToday(canteenDailyMenu);
|
||||
@@ -91,46 +94,48 @@ public class CanteenDailyMenuController {
|
||||
|
||||
/**
|
||||
* 修改每日菜谱
|
||||
*
|
||||
* @param canteenDailyMenu 每日菜谱
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "修改每日菜谱" , description = "修改每日菜谱" )
|
||||
@SysLog("修改每日菜谱" )
|
||||
@Operation(summary = "修改每日菜谱", description = "修改每日菜谱")
|
||||
@SysLog("修改每日菜谱")
|
||||
@PutMapping
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenDailyMenu_edit')" )
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenDailyMenu_edit')")
|
||||
public R updateById(@RequestBody CanteenDailyMenuEntity canteenDailyMenu) {
|
||||
return R.ok(canteenDailyMenuService.updateById(canteenDailyMenu));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除每日菜谱
|
||||
*
|
||||
* @param ids id列表
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "通过id删除每日菜谱" , description = "通过id删除每日菜谱" )
|
||||
@SysLog("通过id删除每日菜谱" )
|
||||
@Operation(summary = "通过id删除每日菜谱", description = "通过id删除每日菜谱")
|
||||
@SysLog("通过id删除每日菜谱")
|
||||
@DeleteMapping
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenDailyMenu_del')" )
|
||||
public R removeById(@RequestBody Long[] ids) {
|
||||
return R.ok(canteenDailyMenuService.removeBatchByIds(CollUtil.toList(ids)));
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenDailyMenu_del')")
|
||||
public R removeById(@RequestBody Long[] ids, @RequestParam Long merchantId) {
|
||||
return R.ok(canteenDailyMenuService.delByIds(CollUtil.toList(ids), merchantId));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导出excel 表格
|
||||
*
|
||||
* @param canteenDailyMenu 查询条件
|
||||
* @param ids 导出指定ID
|
||||
* @param ids 导出指定ID
|
||||
* @return excel 文件流
|
||||
*/
|
||||
@ResponseExcel
|
||||
@GetMapping("/export")
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenDailyMenu_export')" )
|
||||
public List<CanteenDailyMenuEntity> export(CanteenDailyMenuEntity canteenDailyMenu,Long[] ids) {
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenDailyMenu_export')")
|
||||
public List<CanteenDailyMenuEntity> export(CanteenDailyMenuEntity canteenDailyMenu, Long[] ids) {
|
||||
return canteenDailyMenuService.list(Wrappers.lambdaQuery(canteenDailyMenu).in(ArrayUtil.isNotEmpty(ids), CanteenDailyMenuEntity::getId, ids));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取指定周时间
|
||||
*
|
||||
@@ -143,25 +148,25 @@ public class CanteenDailyMenuController {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 通过id查询每日菜谱
|
||||
*
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "菜品下拉列表" )
|
||||
@GetMapping("/selectFoodList" )
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenSpu_view')" )
|
||||
public R selectFoodList(@RequestParam(value = "spuName",required = false) String skuName) {
|
||||
@Operation(summary = "菜品下拉列表")
|
||||
@GetMapping("/selectFoodList")
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenSpu_view')")
|
||||
public R selectFoodList(@RequestParam(value = "spuName", required = false) String skuName) {
|
||||
LambdaQueryWrapper<CanteenSpuEntity> wrapper = Wrappers.lambdaQuery();
|
||||
wrapper.like(StrUtil.isNotBlank(skuName),CanteenSpuEntity::getName,skuName);
|
||||
wrapper.like(StrUtil.isNotBlank(skuName), CanteenSpuEntity::getName, skuName);
|
||||
return R.ok(canteenSpuService.selectFoodList(wrapper));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当天指定菜品
|
||||
*/
|
||||
@Operation(summary = "获取当天指定菜品" )
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenSpu_view')" )
|
||||
@Operation(summary = "获取当天指定菜品")
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenSpu_view')")
|
||||
@GetMapping("/selectTimeFood")
|
||||
public R<List<DailyMenuAll>> selectTimeFood(String time, Long merchantId, Long categoryId) {
|
||||
if (ObjectUtil.isEmpty(time)) {
|
||||
@@ -171,14 +176,14 @@ public class CanteenDailyMenuController {
|
||||
}
|
||||
|
||||
|
||||
// ---------AD------------
|
||||
// ---------AD------------
|
||||
@GetMapping("/ad/getCanteenList")
|
||||
@SysLog("查询每日菜品列表")
|
||||
public R getCanteenList(@RequestParam("day") String day,
|
||||
@RequestParam(value = "hourType", required = false) Integer hourType,
|
||||
@RequestParam(value = "categoryId", required = false) Long categoryId) {
|
||||
|
||||
return R.ok(canteenDailyMenuService.getCanteenMenuListScope(day,hourType,categoryId));
|
||||
return R.ok(canteenDailyMenuService.getCanteenMenuListScope(day, hourType, categoryId));
|
||||
}
|
||||
|
||||
// --------------APP---------------
|
||||
@@ -187,10 +192,10 @@ public class CanteenDailyMenuController {
|
||||
/**
|
||||
* 获取分页菜品
|
||||
*/
|
||||
@Operation(summary = "分页查询" , description = "分页查询" )
|
||||
@Operation(summary = "分页查询", description = "分页查询")
|
||||
@PostMapping("/app/page")
|
||||
public R<Page> selectTimeFoodPage(@ParameterObject Page page, @RequestBody @Validated DailyMenuDTO dailyMenuDTO) {
|
||||
return R.ok(canteenDailyMenuService.selectTimeFoodPage(page,dailyMenuDTO));
|
||||
return R.ok(canteenDailyMenuService.selectTimeFoodPage(page, dailyMenuDTO));
|
||||
}
|
||||
|
||||
|
||||
|
||||
+6
@@ -6,6 +6,7 @@ import com.bsd.pjcloud.canteen.dto.DailyMenuAll;
|
||||
import com.bsd.pjcloud.canteen.dto.app.DailyMenuDTO;
|
||||
import com.bsd.pjcloud.canteen.entity.CanteenDailyMenuEntity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public interface CanteenDailyMenuService extends IService<CanteenDailyMenuEntity> {
|
||||
@@ -13,6 +14,7 @@ public interface CanteenDailyMenuService extends IService<CanteenDailyMenuEntity
|
||||
|
||||
/**
|
||||
* 获取当天指定菜品
|
||||
*
|
||||
* @param time
|
||||
* @param merchantId
|
||||
* @param categoryId
|
||||
@@ -23,6 +25,7 @@ public interface CanteenDailyMenuService extends IService<CanteenDailyMenuEntity
|
||||
|
||||
/**
|
||||
* 获取指定周时间
|
||||
*
|
||||
* @param index
|
||||
* @return
|
||||
*/
|
||||
@@ -31,9 +34,12 @@ public interface CanteenDailyMenuService extends IService<CanteenDailyMenuEntity
|
||||
|
||||
void saveToday(CanteenDailyMenuEntity canteenDailyMenu);
|
||||
|
||||
Boolean delByIds(ArrayList<Long> list, Long merchantId);
|
||||
|
||||
|
||||
/**
|
||||
* ad机获取每次菜品
|
||||
*
|
||||
* @param day
|
||||
* @param hourType
|
||||
* @param categoryId
|
||||
|
||||
+29
-12
@@ -1,5 +1,6 @@
|
||||
package com.bsd.pjcloud.canteen.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.nacos.common.utils.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@@ -14,6 +15,9 @@ import com.bsd.pjcloud.canteen.mapper.CanteenDailyMenuMapper;
|
||||
import com.bsd.pjcloud.canteen.service.CanteenDailyMenuService;
|
||||
import com.bsd.pjcloud.canteen.vo.app.DailyMenuAppVO;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.mqtt.api.feign.RemoteMqttEventService;
|
||||
import com.bsd.pjcloud.wallet.api.feign.RemoteMchService;
|
||||
import com.bsd.pjcloud.wallet.api.vo.MchManageVo;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -35,8 +39,11 @@ import java.util.stream.Collectors;
|
||||
@AllArgsConstructor
|
||||
public class CanteenDailyMenuServiceImpl extends ServiceImpl<CanteenDailyMenuMapper, CanteenDailyMenuEntity> implements CanteenDailyMenuService {
|
||||
|
||||
|
||||
private final CanteenSpuService canteenSpuService;
|
||||
|
||||
private final RemoteMqttEventService remoteMqttEventService;
|
||||
private final RemoteMchService remoteMchService;
|
||||
|
||||
@Override
|
||||
public List<DailyMenuAll> selectTimeFood(String time, Long merchantId, Long categoryId) {
|
||||
List<DailyMenuAll> dailyMenuAllES = new ArrayList<>();
|
||||
@@ -84,7 +91,6 @@ public class CanteenDailyMenuServiceImpl extends ServiceImpl<CanteenDailyMenuMap
|
||||
|
||||
@Override
|
||||
public void saveToday(CanteenDailyMenuEntity canteenDailyMenu) {
|
||||
|
||||
canteenDailyMenu.getSpuIds().forEach(x -> {
|
||||
CanteenDailyMenuEntity todayDO = new CanteenDailyMenuEntity();
|
||||
BeanUtils.copyProperties(canteenDailyMenu, todayDO);
|
||||
@@ -92,19 +98,30 @@ public class CanteenDailyMenuServiceImpl extends ServiceImpl<CanteenDailyMenuMap
|
||||
baseMapper.insert(todayDO);
|
||||
});
|
||||
// 发送mq消息
|
||||
//todo 邓的mq
|
||||
// EventDto eventDto = new EventDto()
|
||||
// .setHardwareType(HardwareTypeEnum.CANTEEN)
|
||||
// .setHardwareId(null);
|
||||
// CookbookProductEvent productEvent = new CookbookProductEvent(this, eventDto);
|
||||
// eventPublisher.publishEvent(productEvent);
|
||||
if (ObjectUtil.isNotEmpty(canteenDailyMenu.getMerchantId())) {
|
||||
MchManageVo mch = remoteMchService.getById(canteenDailyMenu.getMerchantId()).getData();
|
||||
if (ObjectUtil.isNotEmpty(mch)) {
|
||||
remoteMqttEventService.sendCanteenProductChangeMsg(mch.getDeptId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Boolean delByIds(ArrayList<Long> list, Long merchantId) {
|
||||
baseMapper.deleteByIds(list);
|
||||
// 发送mq消息
|
||||
if (ObjectUtil.isNotEmpty(merchantId)) {
|
||||
MchManageVo mch = remoteMchService.getById(merchantId).getData();
|
||||
if (ObjectUtil.isNotEmpty(mch)) {
|
||||
remoteMqttEventService.sendCanteenProductChangeMsg(mch.getDeptId());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getCanteenMenuListScope(String day, Integer hourType, Long categoryId) {
|
||||
return baseMapper.getCanteenMenuList(day, hourType, categoryId,DataScope.of());
|
||||
return baseMapper.getCanteenMenuList(day, hourType, categoryId, DataScope.of());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -119,9 +136,9 @@ public class CanteenDailyMenuServiceImpl extends ServiceImpl<CanteenDailyMenuMap
|
||||
if (CollectionUtils.isNotEmpty(canteenDailyMenuEntities)) {
|
||||
List<Long> spuIds = canteenDailyMenuEntities.stream().map(CanteenDailyMenuEntity::getSpuId).distinct().collect(Collectors.toList());
|
||||
LambdaQueryWrapper<CanteenSpuEntity> onlineFoodSpuDOLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
onlineFoodSpuDOLambdaQueryWrapper.eq(null!=dailyMenuDTO.getCategoryId(),CanteenSpuEntity::getCategoryId, dailyMenuDTO.getCategoryId());
|
||||
onlineFoodSpuDOLambdaQueryWrapper.eq(null != dailyMenuDTO.getCategoryId(), CanteenSpuEntity::getCategoryId, dailyMenuDTO.getCategoryId());
|
||||
onlineFoodSpuDOLambdaQueryWrapper.in(CanteenSpuEntity::getId, spuIds);
|
||||
List<CanteenSpuEntity> canteenSpuEntities = canteenSpuService.list(onlineFoodSpuDOLambdaQueryWrapper);
|
||||
List<CanteenSpuEntity> canteenSpuEntities = canteenSpuService.list(onlineFoodSpuDOLambdaQueryWrapper);
|
||||
// 按 id 分组成 Map
|
||||
Map<Long, CanteenSpuEntity> spuEntityMap = canteenSpuEntities.stream()
|
||||
.collect(Collectors.toMap(CanteenSpuEntity::getId, spu -> spu));
|
||||
|
||||
-1
@@ -45,7 +45,6 @@ import com.bsd.pjcloud.wallet.service.WalletManageService;
|
||||
import com.bsd.pjcloud.wallet.service.WalletRechargeApplyService;
|
||||
import com.bsd.pjcloud.wallet.service.WalletTransactionService;
|
||||
import com.bsd.pjcloud.wallet.service.WalletTypeService;
|
||||
import com.bsd.pjcloud.wallet.service.impl.WalletManageServiceImpl;
|
||||
import com.bsd.pjcloud.wallet.utils.flow.FlowUtil;
|
||||
import com.bsd.pjcloud.wallet.utils.flow.dto.WalletRechargeApplyFlowDto;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
Reference in new issue
Block a user