| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- package com.sqx.modules.chats.controller;
- import com.sqx.modules.chats.entity.Chats;
- import com.sqx.modules.chats.service.ChatsService;
- import com.sqx.modules.chats.utils.Result;
- import icu.xuyijie.secureapi.annotation.DecryptParam;
- import io.swagger.annotations.Api;
- import io.swagger.annotations.ApiOperation;
- import io.swagger.annotations.ApiParam;
- import org.springframework.beans.factory.annotation.Autowired;
- 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.RequestMapping;
- import org.springframework.web.bind.annotation.RestController;
- @RestController
- @Api(value="聊天会话",tags={"聊天会话"})
- @RequestMapping(value = "/chats")
- public class ChatsController {
- @Autowired
- private ChatsService service;
- @GetMapping("/count")
- @ApiOperation("商家端未读消息")
- public Result count(@ApiParam("店铺id(总后台商户传0)") @DecryptParam Long storeId) {
- return service.count(storeId);
- }
- @GetMapping("/userCount")
- @ApiOperation("用户端未读消息")
- public Result userCount(@ApiParam("店铺id(总后台商户传0)") @DecryptParam Long userId) {
- return service.userCount(userId);
- }
- @GetMapping("/list")
- @ApiOperation("商家端会话列表")
- public Result findAll(@ApiParam("店铺id(总后台商户传0)") @DecryptParam Long storeId,
- @ApiParam("用户类型(0全部 1用户 2 骑手 3商家)") @DecryptParam(required = false) Long type,
- @ApiParam("关键字") @DecryptParam(required = false) String keyWord,
- @ApiParam("开始时间") @DecryptParam(required = false) String starTime,
- @ApiParam("结束时间") @DecryptParam(required = false) String endTime,
- @ApiParam("用户昵称") @DecryptParam(required = false) String userName) {
- return service.findAll(storeId, keyWord,type,starTime,endTime);
- }
- @GetMapping("/listRead")
- @ApiOperation("商家端已读会话列表")
- public Result findRead(@ApiParam("店铺id(总后台商户传0)") @DecryptParam Long storeId,
- @ApiParam("用户类型") @DecryptParam(required = false) Long type,
- @ApiParam("关键字") @DecryptParam(required = false) String keyWord,
- @ApiParam("开始时间") @DecryptParam(required = false) String starTime,
- @ApiParam("结束时间") @DecryptParam(required = false) String endTime,
- @ApiParam("用户昵称") @DecryptParam(required = false) String userName) {
- return service.findRead(storeId, keyWord,type,starTime,endTime);
- }
- @GetMapping("/listUnRead")
- @ApiOperation("商家端未读会话列表")
- public Result findUnRead(@ApiParam("店铺id(总后台商户传0)") @DecryptParam Long storeId,
- @ApiParam("用户类型") @DecryptParam(required = false) Long type,
- @ApiParam("关键字") @DecryptParam(required = false) String keyWord,
- @ApiParam("开始时间") @DecryptParam(required = false) String starTime,
- @ApiParam("结束时间") @DecryptParam(required = false) String endTime,
- @ApiParam("用户昵称") @DecryptParam(required = false) String userName) {
- return service.findUnRead(storeId, keyWord,type,starTime,endTime);
- }
- @GetMapping("/userList")
- @ApiOperation("用户端会话列表")
- public Result userList(Long userId) {
- return service.userList(userId);
- }
- @GetMapping("/find")
- @ApiOperation("查询")
- public Result findOne(Long id) {
- return service.findOne(id);
- }
- @PostMapping("/save")
- @ApiOperation("用户端发起聊天")
- public Result saveBody(@RequestBody Chats entity) {
- return service.saveBody(entity);
- }
- @PostMapping("/update")
- @ApiOperation("修改")
- public Result updateBody(@RequestBody Chats entity) {
- return service.updateBody(entity);
- }
- @GetMapping("/delete")
- @ApiOperation("删除聊天会话")
- public Result delete(Long id) {
- return service.delete(id);
- }
- }
|