liusheng
2025-12-26 2944ea778f0fc87c8e09ae47200d9de8069049e3
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
125
package com.ruoyi.web.controller.project;
 
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.project.domain.ServiceTransport;
import com.ruoyi.project.domain.ServiceTransportFile;
import com.ruoyi.project.service.IServiceTransportService;
import com.ruoyi.project.service.impl.ServiceTransportFileServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
import java.util.Arrays;
import java.util.List;
import java.util.Map;
 
/**
 * 供者转运登记Controller
 *
 * @author ruoyi
 * @date 2025-12-15
 */
@Api(description = "供者转运登记")
@RestController
@RequestMapping("/system/transport")
public class ServiceTransportController extends BaseController {
    @Autowired
    private IServiceTransportService serviceTransportService;
 
    @Autowired
    private ServiceTransportFileServiceImpl serviceTransportFileService;
 
    /**
     * 查询供者转运登记列表
     */
    @ApiOperation("查询供者转运登记列表")
    // @PreAuthorize("@ss.hasPermi('system:transport:list')")
    @PostMapping("/list")
    public Map<String, Object> list(ServiceTransport serviceTransport) {
        Page<ServiceTransport> serviceTransportPage = serviceTransportService.queryList(serviceTransport);
        return getDataTable(serviceTransportPage.getRecords(), (int) serviceTransportPage.getTotal());
    }
 
    /**
     * 导出供者转运登记列表
     */
    @ApiOperation("导出供者转运登记列表")
    // @PreAuthorize("@ss.hasPermi('system:transport:export')")
    @Log(title = "供者转运登记", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(ServiceTransport serviceTransport) {
        List<ServiceTransport> list = serviceTransportService.queryList(serviceTransport).getRecords();
        ExcelUtil<ServiceTransport> util = new ExcelUtil<ServiceTransport>(ServiceTransport.class);
        return util.exportExcel(list, "供者转运登记数据");
    }
 
    /**
     * 获取供者转运登记详细信息
     */
    @ApiOperation("获取供者转运登记详细信息")
    // @PreAuthorize("@ss.hasPermi('system:transport:query')")
    @GetMapping(value = "/getInfo/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        ServiceTransport transport = serviceTransportService.getById(id);
        if (ObjectUtils.isNotEmpty(transport)) {
            //补充 附件
            ServiceTransportFile serviceTransportFile = new ServiceTransportFile();
            serviceTransportFile.setDelFlag(0);
            serviceTransportFile.setTransportId(transport.getId());
            serviceTransportFile.setCaseNo(transport.getCaseNo());
            List<ServiceTransportFile> serviceTransportFiles = serviceTransportFileService.queryList(serviceTransportFile);
            transport.setAnnexfilesList(serviceTransportFiles);
        }
        return AjaxResult.success(transport);
    }
 
    /**
     * 新增供者转运登记
     */
    @ApiOperation("新增供者转运登记")
    // @PreAuthorize("@ss.hasPermi('system:transport:add')")
    @Log(title = "供者转运登记", businessType = BusinessType.INSERT)
    @PostMapping("/add")
//    @RepeatSubmit
    public AjaxResult add(@RequestBody ServiceTransport serviceTransport) {
        boolean save = serviceTransportService.save(serviceTransport);
        if (save) {
            serviceTransportFileService.addList(serviceTransport.getAnnexfilesList(), serviceTransport.getId(), serviceTransport.getCaseNo(), getNickName());
        }
        return toAjax(save);
    }
 
    /**
     * 修改供者转运登记
     */
    @ApiOperation("修改供者转运登记")
    // @PreAuthorize("@ss.hasPermi('system:transport:edit')")
    @Log(title = "供者转运登记", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
//    @RepeatSubmit
    public AjaxResult edit(@RequestBody ServiceTransport serviceTransport) {
        boolean b = serviceTransportService.updateById(serviceTransport);
        if (b) {
            serviceTransportFileService.updateList(serviceTransport.getAnnexfilesList(), serviceTransport.getReportId(), serviceTransport.getCaseNo(), getNickName());
        }
        return toAjax(b);
    }
 
    /**
     * 删除供者转运登记
     */
    @ApiOperation("删除供者转运登记")
    // @PreAuthorize("@ss.hasPermi('system:transport:remove')")
    @Log(title = "供者转运登记", businessType = BusinessType.DELETE)
    @GetMapping("/remove/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids) {
        return toAjax(serviceTransportService.removeByIds(Arrays.asList(ids)));
    }
}