Merge branch 'gyj' into test

This commit is contained in:
2024-09-27 10:46:58 +08:00
7 changed files with 78 additions and 41 deletions

View File

@@ -1,8 +1,8 @@
package cn.ysk.cashier.controller.shop;
import cn.ysk.cashier.annotation.AnonymousAccess;
import cn.ysk.cashier.dto.shop.*;
import cn.ysk.cashier.mybatis.entity.TbShopOpenId;
import cn.ysk.cashier.dto.shop.ShopInfoUpdateDTO;
import cn.ysk.cashier.dto.shop.ShopMsgRemoveDTO;
import cn.ysk.cashier.dto.shop.ShopMsgStateDTO;
import cn.ysk.cashier.pojo.shop.TbFullShopId;
import cn.ysk.cashier.service.shop.MsgService;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -11,7 +11,6 @@ import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.HashMap;
import java.util.List;
@RestController
@RequestMapping("/api/msg")
@@ -26,53 +25,49 @@ public class MsgController {
/**
* 获取所有订阅消息用户
*
* @return
*/
@AnonymousAccess
@GetMapping("/all")
public ResponseEntity<Page<TbFullShopId>> all(
@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer size,
@RequestParam Integer shopId,
@RequestParam(required = false) String nickName,
@RequestParam(required = false) String openId,
@RequestParam(required = false) Integer state,
@RequestParam(required = false) Integer type
) {
public ResponseEntity<Page<TbFullShopId>> all(@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer size,
@RequestParam Integer shopId,
@RequestParam(required = false) String nickName,
@RequestParam(required = false) String openId,
@RequestParam(required = false) Integer state,
@RequestParam(required = false) Integer type) {
Page<TbFullShopId> all = msgService.all(page, size, shopId, nickName, openId, state, type);
return ResponseEntity.ok(all);
}
@AnonymousAccess
@PutMapping("/shopState")
public ResponseEntity<Boolean> shopMsgState(
@Valid @RequestBody ShopMsgStateDTO shopMsgStateDTO
) {
public ResponseEntity<Boolean> shopMsgState(@Valid @RequestBody ShopMsgStateDTO shopMsgStateDTO) {
return ResponseEntity.of(msgService.updateShopState(shopMsgStateDTO));
}
@AnonymousAccess
@DeleteMapping
public ResponseEntity<Boolean> removeSubUser(
@Valid @RequestBody ShopMsgRemoveDTO shopMsgRemoveDTO
) {
public ResponseEntity<Boolean> removeSubUser(@Valid @RequestBody ShopMsgRemoveDTO shopMsgRemoveDTO) {
return ResponseEntity.of(msgService.removeSubUser(shopMsgRemoveDTO));
}
@AnonymousAccess
@PutMapping("/info")
public ResponseEntity<Boolean> updateInfo(
@Valid @RequestBody ShopInfoUpdateDTO shopInfoUpdateDTO
) {
public ResponseEntity<Boolean> updateInfo(@Valid @RequestBody ShopInfoUpdateDTO shopInfoUpdateDTO) {
return ResponseEntity.of(msgService.updateInfo(shopInfoUpdateDTO));
}
@AnonymousAccess
@GetMapping("/state")
public ResponseEntity<HashMap<String, Object>> updateInfo(
@RequestParam Integer shopId
) {
public ResponseEntity<HashMap<String, Object>> updateInfo(@RequestParam Integer shopId) {
return ResponseEntity.ok(msgService.getInfo(shopId, null));
}
/**
* 获取订阅当前用户店库存预警消息的二维码
*
* @param shopId 店铺id
* @return 订阅二维码url
*/
@GetMapping("/subQrCode")
public ResponseEntity<String> getSubQrCode(@RequestParam String shopId) {
return msgService.getSubQrCodeUrl(shopId);
}
}