guyue
2025-09-03 dd028e18a12ad9ae7c43ed09b15ddd6bde1a43e9
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
115
116
117
118
119
120
121
122
123
124
package com.linghu.controller;
 
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.linghu.model.common.ResponseResult;
import com.linghu.model.entity.Keyword;
import com.linghu.model.entity.Orders;
import com.linghu.model.dto.KeywordDto;
import com.linghu.model.dto.OrderDto;
import com.linghu.model.page.CustomPage;
import com.linghu.service.KeywordService;
import com.linghu.service.OrderService;
 
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
 
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;
 
/**
 * 订单管理接口
 */
@RestController
@RequestMapping("/orders")
@Api(value = "订单管理接口", tags = "订单管理")
public class OrderController {
 
    @Autowired
    private OrderService orderService;
 
 
    /**
     * 新增订单
     */
    @PostMapping
    @Transactional // 开启事务
    @ApiOperation(value = "新增订单")
    public ResponseResult<Orders> add(@Valid @RequestBody OrderDto orderDto) {
        return orderService.getOrdersResponseResult(orderDto);
    }
 
    /**
     * 删除订单(逻辑删除)
     */
    @DeleteMapping("/{orderId}")
    @ApiOperation(value = "删除订单")
    public ResponseResult<Void> delete(@PathVariable String orderId) {
        return orderService.getVoidResponseResult(orderId);
    }
 
 
 
    /**
     * 更新订单
     */
    @PutMapping
    @ApiOperation(value = "更新订单")
    public ResponseResult<Void> update(@Valid @RequestBody OrderDto orderDto) {
        return orderService.updateOrder(orderDto);
    }
 
 
    /**
     * 根据ID查询订单
     */
    @GetMapping("/{orderId}")
    @ApiOperation("根据ID查询订单")
    public ResponseResult<Orders> getById(@PathVariable String orderId) {
        return orderService.getOrderById(orderId);
    }
 
 
 
    /**
     * 查询订单列表
     */
    @GetMapping
    @ApiOperation("查询订单列表")
    public ResponseResult<CustomPage<Orders>> list(
            @RequestParam(required = false) Integer pageNum,
            @RequestParam(required = false) Integer pageSize,
            @RequestParam(required = false) String clientName,
            @RequestParam(required = false) Integer status,
            @RequestParam(required = false) String timeRange) {
 
        return orderService.getCustomPageResponseResult(pageNum, pageSize, clientName, status, timeRange);
    }
 
 
 
    /**
     * 获取客户列表
     * @param
     * @return
     */
    @GetMapping("/clientList")
    @ApiOperation("获取客户列表")
    public ResponseResult<CustomPage<String>> getClientList(@RequestParam(required = false) String clientName,
                                                      @RequestParam(required = false,defaultValue = "1") Integer pageNum,
                                                      @RequestParam(required = false, defaultValue = "100") Integer pageSize) {
 
        Page<String> result = orderService.getClientList(clientName,pageNum, pageSize);
 
 
        return ResponseResult.success(new CustomPage<>( result));
    }
 
 
    @GetMapping("/{orderId}/keywordList")
    @ApiOperation("获取订单关联的关键词及提问词")
    public ResponseResult<List<KeywordDto>> getKeywordList(@PathVariable String orderId){
        List<KeywordDto> result = orderService.getKeywordListByOrderId(orderId);
        return ResponseResult.success(result);
    }
}