6c
2025-05-07 0be0f02a23158694e6c72d899b75670283a5fcf1
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
package com.product.mobile.core.controller;
 
import com.product.admin.service.PublicService;
import com.product.core.config.CoreConst;
import com.product.core.controller.support.AbstractBaseController;
import com.product.core.entity.FieldSetEntity;
import com.product.core.entity.RequestParameterEntity;
import com.product.core.exception.BaseException;
import com.product.core.spring.context.SpringMVCContextHolder;
import com.product.mobile.core.config.MobileCoreCode;
import com.product.mobile.core.service.CommonMVCService;
import com.product.module.sys.version.ApiVersion;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
 
import javax.servlet.http.HttpServletRequest;
 
/**
 *  手机端通用查询
 *
 * @author shicf
 */
@RequestMapping("/api/mobile")
@RestController
public class CommonMVCController extends AbstractBaseController {
    @Autowired
    PublicService publicService;
    @Autowired
    CommonMVCService commonMVCService;
    /**
     * 根据业务数据,查询是否有审批流程,
     * 有则返回业务审批流程其中一个uuid
     * 无则  返回业务数据,包括所有子表,数据结构
     * @param request
     * @return
     */
    @RequestMapping(value = "/find-table/{version}", method = RequestMethod.POST)
    @ApiVersion(1)
    public String listData(HttpServletRequest request) {
        FieldSetEntity fse = null;
        Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA);
        if (bean != null) {
            RequestParameterEntity reqp = (RequestParameterEntity) bean;
            fse = reqp.getFormData();
        }
        try {
            String flow_detail_uuid=commonMVCService.getApproveDetailUUID(fse.getTableName(),fse.getString("uuid"));
            if(flow_detail_uuid==null) {
                FieldSetEntity fs=publicService.getFieldSetEntity(fse, true);
 
                return this.result_OK_List(fs);
            }else {
                return this.OK_Add(flow_detail_uuid);
            }
        } catch (BaseException e) {
            return this.error(e);
        } catch (Exception e) {
 
            return this.error(MobileCoreCode.GET_DATA_FAIL);
        }
    }
    /**
     * 加载MVC,包括,当前按钮,按钮操作界面,界面后面的更按钮
     * ///查出MVC中按钮操作的界面,界面后面的所有按钮
     *
     * @param request
     * @return
     */
    @RequestMapping(value = "/find-button-page/{version}", method = RequestMethod.POST)
    @ApiVersion(1)
    public String findMVC(HttpServletRequest request) {
        FieldSetEntity fse = null;
        Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA);
        if (bean != null) {
            RequestParameterEntity reqp = (RequestParameterEntity) bean;
            fse = reqp.getFormData();
        }
        try {
            return result_OK_List(commonMVCService.getPageButtons(fse));
        } catch (BaseException e) {
            e.printStackTrace();
            return this.error(e);
        } catch (Exception e) {
            e.printStackTrace();
            return this.error(MobileCoreCode.GET_ROUTER_FAIL);
        }
    }
    /**
     * 执行移动端送来的表达式到数据库中执行,得到结果返回
     *
     * @param request
     * @return
     */
    @RequestMapping(value = "/excute-exp/{version}", method = RequestMethod.POST)
    @ApiVersion(1)
    public String excuteExp(HttpServletRequest request) {
        FieldSetEntity fse = null;
        Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA);
        if (bean != null) {
            RequestParameterEntity reqp = (RequestParameterEntity) bean;
            fse = reqp.getFormData();
        }
        try {
            return result_OK_List(commonMVCService.excuteExp(fse.getString("exp")));
        } catch (BaseException e) {
            e.printStackTrace();
            return this.error(e);
        } catch (Exception e) {
            e.printStackTrace();
            return this.error(MobileCoreCode.GET_ROUTER_FAIL);
        }
    }
 
    /**
     * 根据按钮uuid找到连接的第一个页面
     *
     * @param request
     * @return
     */
    @RequestMapping(value = "/get-next-page-info/{version}", method = RequestMethod.POST)
    @ApiVersion(1)
    public String getNextPageByButtonUUID(HttpServletRequest request) {
        try {
            FieldSetEntity fse = null;
            Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA);
            if (bean != null) {
                RequestParameterEntity reqp = (RequestParameterEntity) bean;
                fse = reqp.getFormData();
            }
            return OK_List(commonMVCService.getNextPageByButtonUUID(fse));
        } catch (BaseException e) {
            SpringMVCContextHolder.getSystemLogger().error(e);
            e.printStackTrace();
            return error(e);
        } catch (Exception e) {
            e.printStackTrace();
            return error(MobileCoreCode.GET_MVC_PAGE_INFO_FAIL);
        }
    }
}