许鹏程
2024-11-05 9824fc1a7b71cb4d617ea18cab36b8c179e6a37c
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
package com.product.face.controller;
 
import com.product.core.entity.FieldSetEntity;
import com.product.core.exception.BaseException;
import com.product.core.spring.context.SpringMVCContextHolder;
import com.product.face.config.ErrorCode;
import com.product.face.config.FaceConst;
import com.product.face.service.FaceApplyService;
import com.product.module.sys.version.ApiVersion;
import com.product.util.BaseUtil;
import com.product.util.support.AbstractBaseController;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
 
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
 
/**
 * @Author cheng
 * @Date 2023/5/17 10:17
 * @Desc 表单应用控制层
 */
@RestController
@RequestMapping("/api/face/apply")
public class FaceApplyController extends AbstractBaseController {
 
    @Resource
    private FaceApplyService faceApplyService;
 
    /**
     * 获取表格列配置
     *
     * @param request
     * @return
     */
    @PostMapping("/get-list-column/{version}")
    @ApiVersion(1)
    public String getListColumn(HttpServletRequest request) {
        try {
            FieldSetEntity fse = BaseUtil.getFieldSetEntity(request, FaceConst.TABLE_FACE_CONFIG);
            return success(faceApplyService.getFaceListConf(fse));
        } catch (BaseException e) {
            e.printStackTrace();
            return error(e);
        } catch (Exception e) {
            e.printStackTrace();
            SpringMVCContextHolder.getSystemLogger().error(e);
            return error(ErrorCode.GET_FACE_COLUMN_FAIL, e);
        }
    }
 
    /**
     * 录入表单获取配置
     *
     * @param request
     * @return
     */
    @PostMapping("/get-form-conf/{version}")
    @ApiVersion(1)
    public String getFormConf(HttpServletRequest request) {
        try {
            FieldSetEntity fse = BaseUtil.getFieldSetEntity(request, FaceConst.TABLE_FACE_CONFIG);
            return faceApplyService.getFaceFormConfig(fse);
        } catch (BaseException e) {
            e.printStackTrace();
            return error(e);
        } catch (Exception e) {
            e.printStackTrace();
            SpringMVCContextHolder.getSystemLogger().error(e);
            return error(ErrorCode.GET_FACE_CONFIG_FAIL, e);
        }
    }
 
    /**
     * 获取表单中使用的参照
     */
    @PostMapping("/get-face-reference/{version}")
    @ApiVersion(1)
    public String getFaceReference(HttpServletRequest request) {
        try {
            FieldSetEntity fse = BaseUtil.getFieldSetEntity(request);
            return BaseUtil.success(faceApplyService.getFaceReference(fse));
        } catch (BaseException e) {
            e.printStackTrace();
            return error(e);
        } catch (Exception e) {
            e.printStackTrace();
            SpringMVCContextHolder.getSystemLogger().error(e);
            return error(ErrorCode.GET_FACE_CONFIG_FAIL, e);
        }
    }
}