sinake
9 天以前 7d2f250b0aaeff2497e581e2a89643f93ffaba68
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
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.core.domain.entity.SysUser;
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 com.ruoyi.system.service.ISysUserService;
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 = "供者转运登记",tags = {"供者转运登记"})
@RestController
@RequestMapping("/project/transport")
public class ServiceTransportController extends BaseController {
    @Autowired
    private IServiceTransportService serviceTransportService;
 
    @Autowired
    private ServiceTransportFileServiceImpl serviceTransportFileService;
 
    @Autowired
    private ISysUserService userService;
 
    /**
     * 查询供者转运登记列表
     */
    @ApiOperation("查询供者转运登记列表")
    // @PreAuthorize("@ss.hasPermi('system:transport:list')")
    @PostMapping("/list")
    public Map<String, Object> list(@RequestBody ServiceTransport serviceTransport) {
        Long userId= getUserId();
        SysUser user = userService.selectUserById(userId);
        if(user!=null&&user.getUserType()!=null&&!user.getUserType().equals("00")){
            serviceTransport.setNotAdminId(user.getUserName());
        }
        Page<ServiceTransport> serviceTransportPage = serviceTransportService.queryList(serviceTransport);
        return getDataTable(serviceTransportPage.getRecords(), (int) serviceTransportPage.getTotal());
    }
 
    /**
     * 查询供者转运登记列表
     */
    @ApiOperation("转运登记状态统计")
    // @PreAuthorize("@ss.hasPermi('system:transport:list')")
    @PostMapping("/totalServiceTransportState")
    public List<Map<String,Object>> totalState(@RequestBody ServiceTransport serviceTransport) {
        Long userId= getUserId();
        SysUser user = userService.selectUserById(userId);
        if(user!=null&&user.getUserType()!=null&&!user.getUserType().equals("00")){
            serviceTransport.setNotAdminId(user.getUserName());
        }
 
        return serviceTransportService.totalState(serviceTransport);
    }
 
    /**
     * 导出供者转运登记列表
     */
    @ApiOperation("导出供者转运登记列表")
    // @PreAuthorize("@ss.hasPermi('system:transport:export')")
    @Log(title = "供者转运登记", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(ServiceTransport serviceTransport) {
        Long userId= getUserId();
        SysUser user = userService.selectUserById(userId);
        if(user!=null&&user.getUserType()!=null&&!user.getUserType().equals("00")){
            serviceTransport.setNotAdminId(user.getUserId()+"");
        }
        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());
            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.getId(), serviceTransport.getCaseNo(), getNickName());
        }
        return toAjax(b);
    }
 
    /**
     * 删除供者转运登记
     */
    @ApiOperation("删除供者转运登记")
    // @PreAuthorize("@ss.hasPermi('system:transport:remove')")
    @Log(title = "供者转运登记", businessType = BusinessType.DELETE)
    @GetMapping("/remove/{id}")
    public AjaxResult remove(@PathVariable Long id) {
        ServiceTransport serviceTransport = new ServiceTransport();
        serviceTransport.setId(id);
        serviceTransport.setDelFlag(1);
        return toAjax(serviceTransportService.updateById(serviceTransport));
    }
}