leomon
2025-06-05 a3fffa17c643bb96159a23880e1749c486279906
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
package com.oying.modules.message.rest;
 
import com.oying.annotation.Log;
import com.oying.modules.message.domain.MessageOrderSeller;
import com.oying.modules.message.domain.MessageOrderSeller;
import com.oying.modules.message.service.MessageOrderSellerService;
import com.oying.modules.message.domain.dto.MessageOrderSellerQueryCriteria;
import com.oying.utils.R;
import lombok.RequiredArgsConstructor;
import java.util.List;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.oying.utils.PageResult;
 
/**
* @author 李萌
* @date 2025-05-20
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "卖家端订单消息通知")
@RequestMapping("/api/message/messageOrderSeller")
public class MessageOrderSellerController {
 
    private final MessageOrderSellerService messageOrderSellerService;
 
//    @ApiOperation("导出数据")
//    @GetMapping(value = "/download")
//    @PreAuthorize("@el.check('messageOrderSeller:list')")
//    public void exportMessageOrderSeller(HttpServletResponse response, MessageOrderSellerQueryCriteria criteria) throws IOException {
//        messageOrderSellerService.download(messageOrderSellerService.queryAll(criteria), response);
//    }
 
    @GetMapping
    @ApiOperation("查询卖家端订单消息通知")
    @PreAuthorize("@el.check('messageOrderSeller:list')")
    public R<PageResult<MessageOrderSeller>> queryMessageOrderSeller(MessageOrderSellerQueryCriteria criteria){
        Page<Object> page = new Page<>(criteria.getPage(), criteria.getSize());
//        return new ResponseEntity<>(messageOrderSellerService.queryAll(criteria,page),HttpStatus.OK);
        return R.success(messageOrderSellerService.queryAll(criteria,page));
    }
 
//    @PostMapping
//    @Log("新增卖家端订单消息通知")
//    @ApiOperation("新增卖家端订单消息通知")
//    @PreAuthorize("@el.check('messageOrderSeller:add')")
//    public ResponseEntity<Object> createMessageOrderSeller(@Validated @RequestBody MessageOrderSeller resources){
//        messageOrderSellerService.create(resources);
//        return new ResponseEntity<>(HttpStatus.CREATED);
//    }
//
//    @PutMapping
//    @Log("修改卖家端订单消息通知")
//    @ApiOperation("修改卖家端订单消息通知")
//    @PreAuthorize("@el.check('messageOrderSeller:edit')")
//    public ResponseEntity<Object> updateMessageOrderSeller(@Validated @RequestBody MessageOrderSeller resources){
//        messageOrderSellerService.update(resources);
//        return new ResponseEntity<>(HttpStatus.NO_CONTENT);
//    }
//
//    @DeleteMapping
//    @Log("删除卖家端订单消息通知")
//    @ApiOperation("删除卖家端订单消息通知")
//    @PreAuthorize("@el.check('messageOrderSeller:del')")
//    public ResponseEntity<Object> deleteMessageOrderSeller(@ApiParam(value = "传ID数组[]") @RequestBody List<Integer> ids) {
//        messageOrderSellerService.deleteAll(ids);
//        return new ResponseEntity<>(HttpStatus.OK);
//    }
 
    //订单状态变化通知
    @GetMapping("/status/{order_id}")
    @ApiOperation("查询一条订单状态变化通知")
    public R<String> getMessageOrderSeller(@PathVariable Integer order_id) {
        MessageOrderSeller messageOrderSeller = messageOrderSellerService.findByOrderId(order_id);
        String message = messageOrderSeller.getMessageType();
 
//        return new ResponseEntity<>(message, HttpStatus.OK);
        return R.success(message);
    }
    //订单送达通知
    @GetMapping("/deliver/{order_id}")
    @ApiOperation("查询一条订单送达通知")
    public R<String> getMessageOrderSellerDeliver(@PathVariable Integer order_id) {
        MessageOrderSeller messageOrderSeller = messageOrderSellerService.findByOrderId(order_id);
        String message = messageOrderSeller.getMessageType();
        //如果MessageType为订单送达,则返回message——content
        if (message.equals("买家下单")) {
            String messageContent = messageOrderSeller.getMessageContent();
//            return new ResponseEntity<>(messageContent, HttpStatus.OK);
            return R.success(messageContent);
        }else{
            //返回没送达
//            return new ResponseEntity<>("买家没下单", HttpStatus.OK);
            return R.fail("没送达");
        }
    }
    //实现点击跳转到订单详情
    @GetMapping("/link/{order_id}")
    @ApiOperation("点击跳转到订单详情")
    public R<String> getMessageOrderSellerLink(@PathVariable Integer order_id) {
        MessageOrderSeller messageOrderSeller = messageOrderSellerService.findByOrderId(order_id);
        String link = messageOrderSeller.getLink();
//        return new ResponseEntity<>(link, HttpStatus.OK);
        return R.success(link);
    }
 
}