广州市综治平台后端
xusd
2025-06-11 9c5b59c61e66bfe8be20a2c02a2be2b021670ee4
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
package cn.huge.module.ctuser.controller;
 
import cn.huge.base.common.utils.ReturnFailUtils;
import cn.huge.base.common.utils.ReturnSucUtils;
import cn.huge.module.ctuser.service.ExcelOperCtunitService;
import cn.huge.module.syncgrid.service.ThGridUnitService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartHttpServletRequest;
 
import javax.servlet.http.HttpServletRequest;
 
/**
 * @title: Excel表格操作接口api-单位组织相关
 * @description: Excel表格操作接口api-单位组织相关
 * @company: hugeinfo
 * @author: liyj
 * @time: 2024-08-19 20:04:19
 * @version: 1.0.0
 */
@Slf4j
@RestController
@RequestMapping("/api/excel/oper/ctunit")
public class ExcelOperCtunitController {
 
    @Autowired(required = false)
    private HttpServletRequest request;
    @Autowired
    private ExcelOperCtunitService excelOperCtunitService;
 
    /**
     * 通过Excel创建单位和账号
     *
     * 该方法处理通过上传Excel文件来创建单位和账号的请求。它接收一个MultipartHttpServletRequest对象,
     * 并调用ExcelOperCtunitService的inputByExcel241124方法来处理Excel文件。
     * 如果处理成功,返回一个表示成功的响应对象;如果处理过程中出现异常,返回一个表示失败的响应对象。
     *
     * @param request 包含上传的Excel文件的HTTP请求对象
     * @return 处理结果,成功时返回成功响应对象,失败时返回失败响应对象
     */
    @PostMapping("/inputByExcel241124")
    public Object inputByExcel241124(MultipartHttpServletRequest request) {
        try {
            // 调用服务层方法处理Excel文件,创建单位和账号
            excelOperCtunitService.inputByExcel241124(request);
            // 处理成功,返回成功响应信息
            return ReturnSucUtils.getRepInfo();
        } catch (Exception e) {
            // 处理过程中出现异常,返回失败响应信息
            return ReturnFailUtils.getRepInfo();
        }
    }
 
    /**
     * 通过Excel创建单位和账号(Excel表:越秀区矛盾纠纷系统新开通账号信息表-250304.xlsx)
     *
     * 该方法处理通过上传Excel文件来创建单位和账号的请求。它接收一个MultipartHttpServletRequest对象,
     * 并调用ExcelOperCtunitService的inputByExcel241124方法来处理Excel文件。
     * 如果处理成功,返回一个表示成功的响应对象;如果处理过程中出现异常,返回一个表示失败的响应对象。
     *
     * @param request 包含上传的Excel文件的HTTP请求对象
     * @return 处理结果,成功时返回成功响应对象,失败时返回失败响应对象
     */
    @PostMapping("/inputByExcel250304")
    public Object inputByExcel250304(MultipartHttpServletRequest request) {
        try {
            // 调用服务层方法处理Excel文件,创建单位和账号
            excelOperCtunitService.inputByExcel250304(request);
            // 处理成功,返回成功响应信息
            return ReturnSucUtils.getRepInfo();
        } catch (Exception e) {
            // 处理过程中出现异常,返回失败响应信息
            return ReturnFailUtils.getRepInfo();
        }
    }
}