Blame view

src/main/java/com/order/erp/controller/OrderController.java 5.61 KB
“谢茂盛” authored
1
2
3
4
package com.order.erp.controller;

import com.order.erp.common.annotation.AnonymousAccess;
import com.order.erp.common.constant.ServerResult;
5
import com.order.erp.common.excel4j.exceptions.Excel4JException;
6
import com.order.erp.common.exception.BusinessException;
chenhang4442024 authored
7
import com.order.erp.domain.vo.ProducePdfVO;
8
9
import com.order.erp.domain.vo.order.*;
import com.order.erp.mapper.order.OrderBaseInfoMapper;
“谢茂盛” authored
10
import com.order.erp.service.order.OrderBaseInfoService;
谢茂盛 authored
11
12
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
13
import org.springframework.beans.factory.annotation.Autowired;
“谢茂盛” authored
14
15
16
17
18
19
20
import org.springframework.validation.annotation.Validated;
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;

import javax.annotation.Resource;
21
22
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
23
import java.util.Objects;
“谢茂盛” authored
24
25
26
27
28
29
30

/**
 * 订单基础信息表(OrderBaseInfo)表控制层
 *
 * @author makejava
 * @since 2023-09-08 15:26:43
 */
谢茂盛 authored
31
@Api(tags = "订单管理")
“谢茂盛” authored
32
33
34
35
36
37
38
39
40
@RestController
@RequestMapping("/order/erp/order")
public class OrderController {
    /**
     * 服务对象
     */
    @Resource
    private OrderBaseInfoService orderBaseInfoService;
41
42
43
    @Resource
    private OrderBaseInfoMapper orderBaseInfoMapper;
“谢茂盛” authored
44
45
46
47
48
49
50
    /**
     * 分页查询
     *
     * @param orderBaseInfoQueryVO 查询条件
     * @return 查询结果
     */
    @PostMapping("/list_by_page")
谢茂盛 authored
51
    @ApiOperation("分页查询")
“谢茂盛” authored
52
53
54
55
56
57
    @AnonymousAccess
    public ServerResult listByPage(@RequestBody @Validated OrderBaseInfoQueryVO orderBaseInfoQueryVO) {
        return orderBaseInfoService.listByPage(orderBaseInfoQueryVO);
    }

    /**
58
59
60
61
62
     * 导出订单
     *
     * @param orderBaseInfoQueryVO 查询条件
     * @return 查询结果
     */
63
    @PostMapping(value = "/export")
谢茂盛 authored
64
    @ApiOperation("导出订单")
65
    @AnonymousAccess
66
67
    public void export(HttpServletResponse response, @RequestBody @Validated OrderBaseInfoQueryVO orderBaseInfoQueryVO) throws IOException, Excel4JException {
        orderBaseInfoService.export(response, orderBaseInfoQueryVO);
68
69
70
    }

    /**
“谢茂盛” authored
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
     * 通过主键查询单条数据
     *
     * @param orderBaseInfoQueryVO 查询条件
     * @return 单条数据
     */
    @PostMapping("/query_by_id")
    public ServerResult queryById(@RequestBody OrderBaseInfoQueryVO orderBaseInfoQueryVO) {
        return orderBaseInfoService.queryById(orderBaseInfoQueryVO);
    }

    /**
     * 新增数据
     *
     * @param orderAddVO 数据VO
     * @return 新增结果
     */
    @PostMapping("/add")
谢茂盛 authored
88
    @ApiOperation("新增数据")
“谢茂盛” authored
89
90
91
92
93
94
    @AnonymousAccess
    public ServerResult add(@RequestBody OrderAddVO orderAddVO) {
        return orderBaseInfoService.add(orderAddVO);
    }

    /**
“谢茂盛” authored
95
96
97
98
99
100
     * 字段解锁申请
     *
     * @param fieldVO 查询条件
     * @return 查询结果
     */
    @PostMapping("/field_unlock_apply")
谢茂盛 authored
101
    @ApiOperation("字段解锁申请")
“谢茂盛” authored
102
103
104
105
106
107
108
    @AnonymousAccess
    public ServerResult fieldUnlockApply(@RequestBody @Validated OrderUnlockFieldApplyVO fieldVO) {
        return orderBaseInfoService.fieldUnlockApply(fieldVO);
    }


    /**
“谢茂盛” authored
109
110
     * 编辑数据
     *
111
     * @param updateVO 数据VO
“谢茂盛” authored
112
113
     * @return 编辑结果
     */
谢茂盛 authored
114
    @ApiOperation("编辑数据")
“谢茂盛” authored
115
    @PostMapping("/edit")
116
117
    public ServerResult edit(@RequestBody OrderUpdateVO updateVO) {
        return orderBaseInfoService.edit(updateVO);
“谢茂盛” authored
118
119
120
121
122
123
124
125
    }

    /**
     * 删除数据
     *
     * @param orderBaseInfoQueryVO 查询条件
     * @return 删除是否成功
     */
谢茂盛 authored
126
    @ApiOperation("删除数据")
“谢茂盛” authored
127
128
129
130
    @PostMapping("/delete_by_id")
    public ServerResult deleteById(@RequestBody OrderBaseInfoQueryVO orderBaseInfoQueryVO) {
        return orderBaseInfoService.deleteById(orderBaseInfoQueryVO);
    }
131
132
133
134
135
136
137
138
139
140

    /**
     * @param dto
     * @return ServerResult
     * @Description: 查询项目号或者内部编号
     * @Author wmr
     * @CreateTime 2023/12/21 14:50
     */
    @ApiOperation("查询项目号或者内部编号")
    @PostMapping("/queryProjectNoAndInnerNo")
141
    public ServerResult queryProjectNoAndInnerNo(@RequestBody QueryProjectNoAndInnerNoDto dto) {
142
143
144
145
146
        if (Objects.isNull(dto.getProjectNo()) && Objects.isNull(dto.getInnerNo())) {
            throw new BusinessException("请传入项目号或内部编号");
        }
        return ServerResult.success(orderBaseInfoMapper.queryProjectNoAndInnerNoDto(dto.getInnerNo() == null ? Boolean.TRUE : Boolean.FALSE, dto));
    }
qdlgxiemaosheng authored
147
148
149
150
151
152
153
154
155
156
157
158
159

    /**
     * 校验是否重复
     *
     * @param orderBaseInfoQueryVO 查询条件
     * @return 查询结果
     */
    @PostMapping("/check")
    @ApiOperation("校验是否重复")
    @AnonymousAccess
    public ServerResult check(@RequestBody OrderBaseInfoQueryVO orderBaseInfoQueryVO) {
        return orderBaseInfoService.check(orderBaseInfoQueryVO);
    }
160
chenhang4442024 authored
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
    /**
     * 一次性通过率
     *
     * @param orderOpinionLogVO 查询条件
     * @return 查询结果
     */
    @PostMapping("/passRate")
    @AnonymousAccess
    public ServerResult oneTimePassRate(@RequestBody OrderOpinionLogVO orderOpinionLogVO) {
        return orderBaseInfoService.passRate(orderOpinionLogVO);
    }

    @PostMapping("/produceReport")
    public ServerResult produceReport(@RequestBody ProducePdfVO producePdfVO) {
        return orderBaseInfoService.produceReport(producePdfVO);
    }

    @PostMapping("/send")
    public ServerResult send(@RequestBody ProducePdfVO producePdfVO) throws Exception {
        return orderBaseInfoService.send(producePdfVO);
    }
183
“谢茂盛” authored
184
185
}