杜洪波
2026-03-24 616ca0caf25685efec6094686f01c0413f869af9
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
package com.product.saas.controller;
 
import javax.servlet.http.HttpServletRequest;
 
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
 
import com.product.admin.config.SystemCode;
import com.product.core.controller.support.AbstractBaseController;
import com.product.core.entity.FieldSetEntity;
import com.product.module.sys.version.ApiVersion;
import com.product.saas.config.SaasCode;
import com.product.saas.config.SaasConst;
import com.product.saas.service.SaasClientService;
import com.product.util.BaseUtil;
 
/**
 *    SAAS系统租户     
 *
 */
@RequestMapping("/api/saas-client")
@RestController
public class SaasClientController extends AbstractBaseController{
 
    @Autowired
    SaasClientService saasClientService;
    
    /**
     *     租户列表
     * @param request
     * @return
     */
    @RequestMapping("/list-client/{version}")
    @ApiVersion(1)
    public String listClient(HttpServletRequest request) {
        try {
            FieldSetEntity fse = BaseUtil.getFieldSetEntity(request, SaasConst.PRODUCT_SYS_CLIENTS);
            if(BaseUtil.strIsNull(fse.getString(SaasConst.CPAGE)) || BaseUtil.strIsNull(fse.getString(SaasConst.PAGESIZE))) {
                return error(SystemCode.SYSTEM_CPAGES_NOT_NULL.getValue(), SystemCode.SYSTEM_CPAGES_NOT_NULL.getText());
            }
            return OK_List(saasClientService.listClient(fse));
        } catch (Exception e) {
            e.printStackTrace();
            return error(SaasCode.TENANT_INFO_GET_LIST_FAIL.getValue(), SaasCode.TENANT_INFO_GET_LIST_FAIL.getText() + e.getMessage());
        }
    }
    
    /**
     *     租户列表
     * @param request
     * @return
     */
    @RequestMapping("/find-client/{version}")
    @ApiVersion(1)
    public String findClient(HttpServletRequest request) {
        try {
            FieldSetEntity fse = BaseUtil.getFieldSetEntity(request, SaasConst.PRODUCT_SYS_CLIENTS);
            if(BaseUtil.strIsNull(fse.getUUID())) {
                return error(SystemCode.SYSTEM_FORM_COUNT.getValue(), SystemCode.SYSTEM_FORM_COUNT.getText());
            }
            return OK_List(saasClientService.findClient(fse.getUUID()));
        } catch (Exception e) {
            e.printStackTrace();
            return error(SaasCode.TENANT_INFO_GET_LIST_FAIL.getValue(), SaasCode.TENANT_INFO_GET_LIST_FAIL.getText() + e.getMessage());
        }
    }
}