whycxzp
2024-10-21 13d2d9bc303a793d47198de8416447be113d7bbc
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
package com.whyc.webService;
 
import com.whyc.webService.dto.request.Api;
import com.whyc.webService.dto.request.RequestParam;
import com.whyc.webService.dto.response.response1.Corporation;
import com.whyc.webService.dto.response.response1.ResponseResult;
import com.whyc.webService.dto.response.response2.ResponseResult2;
import com.whyc.webService.dto.response.response2.UserInfo;
import com.whyc.webService.util.XmlParser;
import org.springframework.stereotype.Component;
 
import javax.jws.WebService;
import java.util.LinkedList;
import java.util.List;
import java.util.stream.Collectors;
 
@Component
@WebService(targetNamespace = "http://service.webService.whyc.com/",
        endpointInterface = "com.whyc.webService.IMS_Service")
public class IMS_ServiceImpl implements IMS_Service{
 
 
    /**
     *
     * @param param xml格式的字符串
     * @return xml格式的字符串
     */
    @Override
    public String getKPIValue(String param) {
        try {
 
            //解析传入参数
            RequestParam requestParam = XmlParser.parseXmlRequest(param);
            //地域代码,太供提供,作用不明
            String corporationCode = requestParam.getCorporationCode();
            //时间值,作用不明
            String time = requestParam.getTime();
            //指标
            List<Api> apis = requestParam.getApis();
            List<String> apiNameList = apis.stream().map(Api::getName).collect(Collectors.toList());
            if (apiNameList.contains("BusinessSystemLoginRoll")) {
                //单独调用,采用第二个返回值结构
                ResponseResult2 result2 = new ResponseResult2();
                List<UserInfo> userInfoList = new LinkedList<>();
                for (int i = 0; i < 2; i++) {
                    UserInfo userInfo = new UserInfo();
                    userInfo.setName("whyc");
                    userInfo.setLdapId("whyc");
                    userInfo.setSubCompany("whyc");
                    userInfo.setCorporation("whyc");
                    userInfo.setDepartment("whyc");
                    userInfo.setBureau("whyc");
                    userInfo.setIsLdapId(1);
                    userInfoList.add(userInfo);
                }
                result2.setUserInfoList(userInfoList);
                return XmlParser.toXml2(result2);
 
            }
            else if(apiNameList.contains("BusinessSystemOnlineRoll")){
                //单独调用,采用第二个返回值结构
                
            }
            else {
                //构建返回参数
                ResponseResult result =  new ResponseResult();
                result.setStatus("success");
                result.setMessage("success");
                Corporation corporations = new Corporation();
                corporations.setId(corporationCode);
                result.setCorporation(corporations);
                List<com.whyc.webService.dto.response.response1.Api> apisResponse = new LinkedList<>();
 
                int size = apis.size();
                for (int i = 0; i < size; i++) {
                    switch (apis.get(i).getName()) {
                        //1注册用户数
                        case "BusinessUserRegNum":
                            com.whyc.webService.dto.response.response1.Api apiResponse = new com.whyc.webService.dto.response.response1.Api();
                            apiResponse.setName("BusinessUserRegNum");
                            apiResponse.setValue("100");
                            apisResponse.add(apiResponse);
                            break;
 
                    }
                }
                corporations.setApis(apisResponse);
 
 
                return XmlParser.toXml(result);
            }
 
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
 
    /**
     * 咱不写
     * @param param
     * @return
     */
    @Override
    public String getStatus(String param) {
        return null;
    }
}