广州市综治平台后端
xusd
2025-06-07 36306491396230522fa20585c2621a7fc899849a
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
package cn.huge.module.file.controller.client;
 
import cn.huge.base.common.utils.ObjectUtils;
import cn.huge.base.common.utils.ReturnFailUtils;
import cn.huge.base.common.utils.ReturnSucUtils;
import cn.huge.module.file.domain.po.FileInfo;
import cn.huge.module.file.service.FileInfoService;
import cn.huge.module.sys.dto.FileInfoBaseDTO;
import io.lettuce.core.dynamic.annotation.Param;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;
 
/**
 * @title: 附件信息表接口api-web端
 * @description: 附件信息表接口api-web端
 * @company: hugeinfo
 * @author: liyj
 * @time: 2024-08-28 20:06:18
 * @version: 1.0.0
 */
@Slf4j
@RestController
@RequestMapping("/api/client/fileInfo")
public class FileInfoClientController {
 
    @Autowired(required = false)
    private HttpServletRequest request;
 
    @Autowired
    private FileInfoService service;
 
    /**
     * 根据多个所属编号查询附件并根据先根据ownerId再根据附件类型分组
     * @url {ctx}/api/client/fileInfo/listIdTypeInfoByOwnerIdList
     * @return Object
     */
    @PostMapping("/listIdTypeInfoByOwnerIdList")
    public Object listIdTypeInfoByOwnerIdList(@RequestBody  Map<String, Object> term) {
        try {
            return ReturnSucUtils.getRepInfo(service.listIdTypeInfoByOwnerIdList(term));
        } catch (Exception e) {
            return ReturnFailUtils.getRepInfo();
        }
    }
 
    /**
     * 根据多个所属编号查询附件
     * @url {ctx}/api/client/fileInfo/listInfoByOwnerIdList
     * @return Object
     */
    @PostMapping("/listInfoByOwnerIdList")
    public Object listInfoByOwnerIdList(@RequestBody Map<String, Object> term) {
        try {
            return ReturnSucUtils.getRepInfo(service.listInfoByOwnerIdList(term));
        } catch (Exception e) {
            return ReturnFailUtils.getRepInfo();
        }
    }
 
    /**
     * 根据id查询
     * @url {ctx}/api/client/fileInfo/getFileInfoById
     * @return Object
     */
    @GetMapping("/getFileInfoById")
    public Object getFileInfoById(@RequestParam(value = "id") String id) {
        try {
            FileInfoBaseDTO fileInfoBaseDTO = new FileInfoBaseDTO();
            FileInfo fileInfo = service.getById(id);
            if (ObjectUtils.isNotEmpty(fileInfo)){
                BeanUtils.copyProperties(fileInfo, fileInfoBaseDTO);
            }
            return ReturnSucUtils.getRepInfo(fileInfoBaseDTO);
        } catch (Exception e) {
            return ReturnFailUtils.getRepInfo();
        }
    }
 
    /**
     * 根据条件查询附件
     * @url {ctx}/api/client/fileInfo/listFileInfoByTerms
     * @return Object
     */
    @PostMapping("/listFileInfoByTerms")
    public Object listFileInfoByTerms(@RequestBody Map<String, Object> term) {
        try {
            return ReturnSucUtils.getRepInfo(service.listFileInfoByTerms(term));
        } catch (Exception e) {
            return ReturnFailUtils.getRepInfo();
        }
    }
 
    /**
     * 跟进文件ID复制文件(逻辑复制)
     *
     * @param mainId    所属业务主体编号
     * @param ownerId   所属业务编号
     * @param ownerType 所属业务类型
     * @param fileId   文件ID
     * @return Object
     * @url {ctx}/api/client/fileInfo/copyFile?mainId=&ownerId=&ownerType=&fileId=
     */
    @GetMapping("/copyFile")
    public Object copyFile(@RequestParam(value = "mainId") String mainId,
                           @RequestParam(value = "ownerId") String ownerId,
                           @RequestParam(value = "ownerType") String ownerType, @RequestParam(value = "fileId") String fileId) {
        try {
            service.webCopyFile(fileId, mainId, ownerId, ownerType);
            return ReturnSucUtils.getRepInfo("文件复制成功!");
        } catch (Exception e) {
            return ReturnFailUtils.getRepInfo();
        }
    }
 
}