diff --git a/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/controller/CanteenCategoryController.java b/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/controller/CanteenCategoryController.java index 96ff72bc2..a040ca38e 100644 --- a/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/controller/CanteenCategoryController.java +++ b/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/controller/CanteenCategoryController.java @@ -32,50 +32,53 @@ import java.util.List; */ @RestController @RequiredArgsConstructor -@RequestMapping("/canteenCategory" ) -@Tag(description = "canteenCategory" , name = "菜品分类管理" ) +@RequestMapping("/canteenCategory") +@Tag(description = "canteenCategory", name = "菜品分类管理") @SecurityRequirement(name = HttpHeaders.AUTHORIZATION) public class CanteenCategoryController { - private final CanteenCategoryService canteenCategoryService; + private final CanteenCategoryService canteenCategoryService; /** * 分页查询 - * @param page 分页对象 + * + * @param page 分页对象 * @param canteenCategory 菜品分类 * @return */ - @Operation(summary = "分页查询" , description = "分页查询" ) - @GetMapping("/page" ) - @PreAuthorize("@pms.hasPermission('canteen_canteenCategory_view')" ) + @Operation(summary = "分页查询", description = "分页查询") + @GetMapping("/page") + @PreAuthorize("@pms.hasPermission('canteen_canteenCategory_view')") public R getCanteenCategoryPage(@ParameterObject Page page, @ParameterObject CanteenCategoryEntity canteenCategory) { LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(); - wrapper.like(StrUtil.isNotBlank(canteenCategory.getName()),CanteenCategoryEntity::getName,canteenCategory.getName()); + wrapper.like(StrUtil.isNotBlank(canteenCategory.getName()), CanteenCategoryEntity::getName, canteenCategory.getName()); return R.ok(canteenCategoryService.selectPageByScope(page, wrapper)); } /** * 通过id查询菜品分类 + * * @param id id * @return R */ - @Operation(summary = "通过id查询" , description = "通过id查询" ) - @GetMapping("/{id}" ) - @PreAuthorize("@pms.hasPermission('canteen_canteenCategory_view')" ) - public R getById(@PathVariable("id" ) Long id) { + @Operation(summary = "通过id查询", description = "通过id查询") + @GetMapping("/{id}") + @PreAuthorize("@pms.hasPermission('canteen_canteenCategory_view')") + public R getById(@PathVariable("id") Long id) { return R.ok(canteenCategoryService.getById(id)); } /** * 新增菜品分类 + * * @param canteenCategory 菜品分类 * @return R */ - @Operation(summary = "新增菜品分类" , description = "新增菜品分类" ) - @SysLog("新增菜品分类" ) + @Operation(summary = "新增菜品分类", description = "新增菜品分类") + @SysLog("新增菜品分类") @PostMapping - @PreAuthorize("@pms.hasPermission('canteen_canteenCategory_add')" ) + @PreAuthorize("@pms.hasPermission('canteen_canteenCategory_add')") public R save(@RequestBody CanteenCategoryEntity canteenCategory) { canteenCategory.setDeptId(SecurityUtils.getUser().getDeptId()); return R.ok(canteenCategoryService.save(canteenCategory)); @@ -83,26 +86,28 @@ public class CanteenCategoryController { /** * 修改菜品分类 + * * @param canteenCategory 菜品分类 * @return R */ - @Operation(summary = "修改菜品分类" , description = "修改菜品分类" ) - @SysLog("修改菜品分类" ) + @Operation(summary = "修改菜品分类", description = "修改菜品分类") + @SysLog("修改菜品分类") @PutMapping - @PreAuthorize("@pms.hasPermission('canteen_canteenCategory_edit')" ) + @PreAuthorize("@pms.hasPermission('canteen_canteenCategory_edit')") public R updateById(@RequestBody CanteenCategoryEntity canteenCategory) { return R.ok(canteenCategoryService.updateById(canteenCategory)); } /** * 通过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_canteenCategory_del')" ) + @PreAuthorize("@pms.hasPermission('canteen_canteenCategory_del')") public R removeById(@RequestBody Long[] ids) { return R.ok(canteenCategoryService.removeBatchByIds(CollUtil.toList(ids))); } @@ -110,14 +115,15 @@ public class CanteenCategoryController { /** * 导出excel 表格 + * * @param canteenCategory 查询条件 - * @param ids 导出指定ID + * @param ids 导出指定ID * @return excel 文件流 */ @ResponseExcel @GetMapping("/export") - @PreAuthorize("@pms.hasPermission('canteen_canteenCategory_export')" ) - public List export(CanteenCategoryEntity canteenCategory,Long[] ids) { + @PreAuthorize("@pms.hasPermission('canteen_canteenCategory_export')") + public List export(CanteenCategoryEntity canteenCategory, Long[] ids) { return canteenCategoryService.list(Wrappers.lambdaQuery(canteenCategory).in(ArrayUtil.isNotEmpty(ids), CanteenCategoryEntity::getId, ids)); } @@ -126,21 +132,20 @@ public class CanteenCategoryController { /** * 查询所有的菜品分类 + * * @param categoryType 餐段类型,1早餐 2中 3晚餐 不传默认所有 * @return R */ - @Operation(summary = "通过id查询" , description = "通过id查询" ) - @GetMapping("/getAllSimple" ) - @PreAuthorize("@pms.hasPermission('canteen_canteenCategory_view')" ) - public R getAllSimple(@RequestParam(value = "categoryType",required = false)String categoryType) { + @Operation(summary = "通过id查询", description = "通过id查询") + @GetMapping("/getAllSimple") + @PreAuthorize("@pms.hasPermission('canteen_canteenCategory_view')") + public R getAllSimple(@RequestParam(value = "categoryType", required = false) String categoryType) { LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(); wrapper.orderByAsc(CanteenCategoryEntity::getSort); - wrapper.apply(StringUtils.isNotEmpty(categoryType),"FIND_IN_SET({0}, your_column_name)",categoryType); + wrapper.apply(StringUtils.isNotEmpty(categoryType), "FIND_IN_SET({0}, your_column_name)", categoryType); List list = canteenCategoryService.listScope(wrapper); return R.ok(list); } - - } \ No newline at end of file diff --git a/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/service/impl/CanteenDailyMenuServiceImpl.java b/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/service/impl/CanteenDailyMenuServiceImpl.java index 171363133..6b3ccee4c 100644 --- a/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/service/impl/CanteenDailyMenuServiceImpl.java +++ b/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/service/impl/CanteenDailyMenuServiceImpl.java @@ -98,24 +98,14 @@ public class CanteenDailyMenuServiceImpl extends ServiceImpl 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()); - } - } + remoteMqttEventService.sendCanteenProductChangeMsg(null); return true; } diff --git a/pjcloud-mqtt/pjcloud-mqtt-api/src/main/java/com/bsd/pjcloud/mqtt/api/feign/RemoteMqttEventService.java b/pjcloud-mqtt/pjcloud-mqtt-api/src/main/java/com/bsd/pjcloud/mqtt/api/feign/RemoteMqttEventService.java index ca77a61d1..758bae1da 100644 --- a/pjcloud-mqtt/pjcloud-mqtt-api/src/main/java/com/bsd/pjcloud/mqtt/api/feign/RemoteMqttEventService.java +++ b/pjcloud-mqtt/pjcloud-mqtt-api/src/main/java/com/bsd/pjcloud/mqtt/api/feign/RemoteMqttEventService.java @@ -30,28 +30,28 @@ public interface RemoteMqttEventService { */ @NoToken @GetMapping("/mqtt/send-canteen-product-change-msg") - R sendCanteenProductChangeMsg(@RequestParam Long mchDeptId); + R sendCanteenProductChangeMsg(@RequestParam(required = false) Long mchDeptId); /** * 食堂分类变化 */ @NoToken @GetMapping("/mqtt/send-canteen-classify-change-msg") - R sendCanteenClassifyChangeMsg(@RequestParam Long mchDeptId); + R sendCanteenClassifyChangeMsg(@RequestParam(required = false) Long mchDeptId); /** * 超市商品变化 */ @NoToken @GetMapping("/mqtt/send-supermarket-product-change-msg") - R sendSupermarketProductChangeMsg(@RequestParam Long mchDeptId); + R sendSupermarketProductChangeMsg(@RequestParam(required = false) Long mchDeptId); /** * 超市分类变化 */ @NoToken @GetMapping("/mqtt/send-supermarket-classify-change-msg") - R sendSupermarketClassifyChangeMsg(@RequestParam Long mchDeptId); + R sendSupermarketClassifyChangeMsg(@RequestParam(required = false) Long mchDeptId); /** * 人脸变化 diff --git a/pjcloud-mqtt/pjcloud-mqtt-biz/src/main/java/com/bsd/pjcloud/mqtt/controller/MqttEventController.java b/pjcloud-mqtt/pjcloud-mqtt-biz/src/main/java/com/bsd/pjcloud/mqtt/controller/MqttEventController.java index fbdccc096..7fd01978f 100644 --- a/pjcloud-mqtt/pjcloud-mqtt-biz/src/main/java/com/bsd/pjcloud/mqtt/controller/MqttEventController.java +++ b/pjcloud-mqtt/pjcloud-mqtt-biz/src/main/java/com/bsd/pjcloud/mqtt/controller/MqttEventController.java @@ -1,5 +1,6 @@ package com.bsd.pjcloud.mqtt.controller; +import cn.hutool.core.util.ObjectUtil; import com.bsd.pjcloud.common.core.util.R; import com.bsd.pjcloud.common.security.annotation.Inner; import com.bsd.pjcloud.mqtt.constant.MqttActionEnum; @@ -45,7 +46,9 @@ public class MqttEventController { @GetMapping("/send-canteen-product-change-msg") public R sendCanteenProductChangeMsg(@RequestParam Long mchDeptId) { MqttBaseDto dto = new MqttBaseDto<>(); - dto.setMerchantDeptId(mchDeptId); + if (ObjectUtil.isNotEmpty(mchDeptId)) { + dto.setMerchantDeptId(mchDeptId); + } dto.setAction(MqttActionEnum.CANTEEN_PRODUCT); return R.ok(mqttEventService.defaultAction(dto)); } @@ -57,7 +60,9 @@ public class MqttEventController { @GetMapping("/send-canteen-classify-change-msg") public R sendCanteenClassifyChangeMsg(@RequestParam Long mchDeptId) { MqttBaseDto dto = new MqttBaseDto<>(); - dto.setMerchantDeptId(mchDeptId); + if (ObjectUtil.isNotEmpty(mchDeptId)) { + dto.setMerchantDeptId(mchDeptId); + } dto.setAction(MqttActionEnum.CANTEEN_CLASSIFY); return R.ok(mqttEventService.defaultAction(dto)); } @@ -69,7 +74,9 @@ public class MqttEventController { @GetMapping("/send-supermarket-product-change-msg") public R sendSupermarketProductChangeMsg(@RequestParam Long mchDeptId) { MqttBaseDto dto = new MqttBaseDto<>(); - dto.setMerchantDeptId(mchDeptId); + if (ObjectUtil.isNotEmpty(mchDeptId)) { + dto.setMerchantDeptId(mchDeptId); + } dto.setAction(MqttActionEnum.SUPERMARKET_PRODUCT); return R.ok(mqttEventService.defaultAction(dto)); } @@ -81,7 +88,9 @@ public class MqttEventController { @GetMapping("/send-supermarket-classify-change-msg") public R sendSupermarketClassifyChangeMsg(@RequestParam Long mchDeptId) { MqttBaseDto dto = new MqttBaseDto<>(); - dto.setMerchantDeptId(mchDeptId); + if (ObjectUtil.isNotEmpty(mchDeptId)) { + dto.setMerchantDeptId(mchDeptId); + } dto.setAction(MqttActionEnum.SUPERMARKET_CLASSIFY); return R.ok(mqttEventService.defaultAction(dto)); }