|
@@ -30,7 +30,9 @@ import com.alibaba.fastjson.JSONArray
|
|
|
import com.alibaba.fastjson.JSONObject
|
|
|
import com.persagy.base.extensions.toJson
|
|
|
import com.persagy.base.utils.SHttpUtil
|
|
|
+import com.persagy.server.syn.CustomProperties
|
|
|
import com.persagy.server.syn.Opts
|
|
|
+import com.persagy.server.syn.ServiceNameConfig
|
|
|
import com.persagy.server.syn.models.DictPlatformInfo
|
|
|
import com.persagy.server.syn.models.DictPlatformType
|
|
|
import com.persagy.server.syn.models.DictProject
|
|
@@ -39,6 +41,7 @@ import com.persagy.server.syn.models.response.*
|
|
|
import com.persagy.server.syn.services.dict.DClassDefService
|
|
|
import com.persagy.service.utils.SSpringContextUtil
|
|
|
import org.slf4j.LoggerFactory
|
|
|
+import org.springframework.web.client.RestTemplate
|
|
|
|
|
|
/**
|
|
|
* 字典API
|
|
@@ -54,6 +57,21 @@ object DictTypeApi {
|
|
|
SSpringContextUtil.getBean(Opts::class.java) as Opts
|
|
|
} // opts
|
|
|
|
|
|
+ /** 获取配置文件的服务名 */
|
|
|
+ val serviceNameConfig by lazy {
|
|
|
+ SSpringContextUtil.getBean(ServiceNameConfig::class.java) as ServiceNameConfig
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 获取配置自定义属性 */
|
|
|
+ val customProperties by lazy {
|
|
|
+ SSpringContextUtil.getBean(CustomProperties::class.java) as CustomProperties
|
|
|
+ }
|
|
|
+
|
|
|
+ /** Rest服务 */
|
|
|
+ val restTemplate by lazy {
|
|
|
+ SSpringContextUtil.getBean(RestTemplate::class.java) as RestTemplate
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 字典类型
|
|
|
*/
|
|
@@ -72,15 +90,28 @@ object DictTypeApi {
|
|
|
fun groupQuery():ArrayList<Group> {
|
|
|
var data = ArrayList<Group>()
|
|
|
try {
|
|
|
- val url = "${opts.dataPlatform}/org/group/query"
|
|
|
val jsonObject = JSONObject()
|
|
|
val jsonObject2 = JSONObject()
|
|
|
jsonObject["criteria"] = jsonObject2
|
|
|
- val postObject = SHttpUtil.postObject<GroupResponse>(url, jsonObject)
|
|
|
- DClassDefService.logger.debug("集团结果:${postObject.toJson()}")
|
|
|
- if (postObject.result == "success"){
|
|
|
- if (!postObject.data.isNullOrEmpty()){
|
|
|
- data = postObject.data!!
|
|
|
+ /** 直接 http 请求还是通过注册中心 */
|
|
|
+ if (!customProperties.eurekaorhttp) {
|
|
|
+ val url = "${opts.dataPlatform}/org/group/query"
|
|
|
+ val postObject = SHttpUtil.postObject<GroupResponse>(url, jsonObject)
|
|
|
+ DClassDefService.logger.debug("集团结果:${postObject.toJson()}")
|
|
|
+ if (postObject.result == "success"){
|
|
|
+ if (!postObject.data.isNullOrEmpty()){
|
|
|
+ data = postObject.data!!
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ /** 注册中心 */
|
|
|
+ val url = "${serviceNameConfig.DMPORG}/org/group/query"
|
|
|
+ val postForObject = restTemplate.postForObject(url, jsonObject, GroupResponse::class.java)
|
|
|
+ DClassDefService.logger.debug("集团结果:${postForObject.toJson()}")
|
|
|
+ if (postForObject.result == "success"){
|
|
|
+ if (!postForObject.data.isNullOrEmpty()){
|
|
|
+ data = postForObject.data!!
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
} catch (e: Exception) {
|
|
@@ -96,19 +127,40 @@ object DictTypeApi {
|
|
|
* @return 项目对象列表
|
|
|
*/
|
|
|
fun dictProjectQuery(code: String): ArrayList<DictProject>{
|
|
|
- val url = "${opts.dataPlatform}/org/project/query?userId=123456&groupCode=$code"
|
|
|
- val jsonObject = JSONObject()
|
|
|
- val jsonObject2 = JSONObject()
|
|
|
- jsonObject2["groupCode"] = code
|
|
|
- jsonObject["criteria"] = jsonObject2
|
|
|
- DClassDefService.logger.debug("url:${url}")
|
|
|
- DClassDefService.logger.debug("项目请求体:${jsonObject.toJson()}")
|
|
|
- val postObject = SHttpUtil.postObject<DictProjectResponse>(url, jsonObject)
|
|
|
- if (postObject.result == opts.SUCCESS_CODE){
|
|
|
- if (!postObject.data.isNullOrEmpty()){
|
|
|
- return postObject.data!!
|
|
|
+
|
|
|
+ try {
|
|
|
+ val jsonObject = JSONObject()
|
|
|
+ val jsonObject2 = JSONObject()
|
|
|
+ jsonObject2["groupCode"] = code
|
|
|
+ jsonObject["criteria"] = jsonObject2
|
|
|
+ /** 直接 http 请求还是通过注册中心 */
|
|
|
+ if (!customProperties.eurekaorhttp) {
|
|
|
+ val url = "${opts.dataPlatform}/org/project/query?userId=123456&groupCode=$code"
|
|
|
+
|
|
|
+ DClassDefService.logger.debug("url:${url}")
|
|
|
+ DClassDefService.logger.debug("项目请求体:${jsonObject.toJson()}")
|
|
|
+ val postObject = SHttpUtil.postObject<DictProjectResponse>(url, jsonObject)
|
|
|
+ if (postObject.result == opts.SUCCESS_CODE){
|
|
|
+ if (!postObject.data.isNullOrEmpty()){
|
|
|
+ return postObject.data!!
|
|
|
+ }
|
|
|
}
|
|
|
+ }else {
|
|
|
+ val url = "${serviceNameConfig.DMPORG}/org/project/query?userId=123456&groupCode=$code"
|
|
|
+ DClassDefService.logger.debug("url:${url}")
|
|
|
+ DClassDefService.logger.debug("项目请求体:${jsonObject.toJson()}")
|
|
|
+ // val postObject = SHttpUtil.postObject<DictProjectResponse>(url, jsonObject)
|
|
|
+ val postObject = restTemplate.postForObject(url, jsonObject, DictProjectResponse::class.java)
|
|
|
+ if (postObject.result == opts.SUCCESS_CODE){
|
|
|
+ if (!postObject.data.isNullOrEmpty()){
|
|
|
+ return postObject.data!!
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (e: Exception) {
|
|
|
+ e.printStackTrace()
|
|
|
}
|
|
|
+
|
|
|
return ArrayList()
|
|
|
} // Fun dictProjectQuery()
|
|
|
|
|
@@ -116,19 +168,36 @@ object DictTypeApi {
|
|
|
* 平台字典对象类型
|
|
|
*/
|
|
|
fun dictPlatform(): ArrayList<DictPlatformType>{
|
|
|
- val url = "${opts.dataPlatform}/rwd/def/class/"
|
|
|
- val jsonObject = JSONObject()
|
|
|
- val jsonObject2 = JSONObject()
|
|
|
- jsonObject2["type"] = "common"
|
|
|
- jsonObject["criteria"] = jsonObject2
|
|
|
- val postObject = SHttpUtil.postObject<DictPlatformTypeResponse>(url, jsonObject)
|
|
|
- if (postObject.result == opts.SUCCESS_CODE) {
|
|
|
- if (!postObject.data.isNullOrEmpty()){
|
|
|
- return postObject.data!!
|
|
|
+
|
|
|
+ try {
|
|
|
+ val jsonObject = JSONObject()
|
|
|
+ val jsonObject2 = JSONObject()
|
|
|
+ jsonObject2["type"] = "common"
|
|
|
+ jsonObject["criteria"] = jsonObject2
|
|
|
+ /** 直接 http 请求还是通过注册中心 */
|
|
|
+ if (!customProperties.eurekaorhttp) {
|
|
|
+ val url = "${opts.dataPlatform}/rwd/def/class/"
|
|
|
+ val postObject = SHttpUtil.postObject<DictPlatformTypeResponse>(url, jsonObject)
|
|
|
+ if (postObject.result == opts.SUCCESS_CODE) {
|
|
|
+ if (!postObject.data.isNullOrEmpty()){
|
|
|
+ return postObject.data!!
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ val url = "${serviceNameConfig.DMPRWD}/rwd/def/class/"
|
|
|
+ // val postObject = SHttpUtil.postObject<DictPlatformTypeResponse>(url, jsonObject)
|
|
|
+ val postObject = restTemplate.postForObject(url, jsonObject, DictPlatformTypeResponse::class.java)
|
|
|
+ if (postObject.result == opts.SUCCESS_CODE) {
|
|
|
+ if (!postObject.data.isNullOrEmpty()){
|
|
|
+ return postObject.data!!
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
+ } catch (e: Exception) {
|
|
|
+ e.printStackTrace()
|
|
|
}
|
|
|
return ArrayList()
|
|
|
- } // Fun dictPlatform()
|
|
|
+ }
|
|
|
|
|
|
|
|
|
/**
|
|
@@ -138,21 +207,36 @@ object DictTypeApi {
|
|
|
* @param type 平台或集团
|
|
|
*/
|
|
|
fun dictPlatformInfo(category: String,type: String): ArrayList<DictPlatformInfo>{
|
|
|
- val url = "${opts.dataPlatform}/rwd/def/funcid"
|
|
|
- val jsonObject = JSONObject()
|
|
|
- val jsonObject2 = JSONObject()
|
|
|
- jsonObject2["type"] = type
|
|
|
- jsonObject2["classCode"] = category
|
|
|
- jsonObject["criteria"] = jsonObject2
|
|
|
-
|
|
|
- val postObject = SHttpUtil.postObject<DictPlatformInfoResponse>(url, jsonObject)
|
|
|
- if (postObject.result == opts.SUCCESS_CODE) {
|
|
|
- if (!postObject.data.isNullOrEmpty()){
|
|
|
- return postObject.data!!
|
|
|
+ try {
|
|
|
+ val jsonObject = JSONObject()
|
|
|
+ val jsonObject2 = JSONObject()
|
|
|
+ jsonObject2["type"] = type
|
|
|
+ jsonObject2["classCode"] = category
|
|
|
+ jsonObject["criteria"] = jsonObject2
|
|
|
+ /** 直接 http 请求还是通过注册中心 */
|
|
|
+ if (!customProperties.eurekaorhttp) {
|
|
|
+ val url = "${opts.dataPlatform}/rwd/def/funcid"
|
|
|
+ val postObject = SHttpUtil.postObject<DictPlatformInfoResponse>(url, jsonObject)
|
|
|
+ if (postObject.result == opts.SUCCESS_CODE) {
|
|
|
+ if (!postObject.data.isNullOrEmpty()){
|
|
|
+ return postObject.data!!
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ val url = "${serviceNameConfig.DMPRWD}/rwd/def/funcid"
|
|
|
+ // val postObject = SHttpUtil.postObject<DictPlatformInfoResponse>(url, jsonObject)
|
|
|
+ val postObject = restTemplate.postForObject(url, jsonObject, DictPlatformInfoResponse::class.java)
|
|
|
+ if (postObject.result == opts.SUCCESS_CODE) {
|
|
|
+ if (!postObject.data.isNullOrEmpty()){
|
|
|
+ return postObject.data!!
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
+ } catch (e: Exception) {
|
|
|
+ e.printStackTrace()
|
|
|
}
|
|
|
return ArrayList()
|
|
|
- } // Fun dictPlatformInfo()
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 获取专业
|
|
@@ -161,17 +245,37 @@ object DictTypeApi {
|
|
|
* @return 专业列表
|
|
|
*/
|
|
|
fun dictMajor(type: String): ArrayList<DictMajorResponse.DataBean>{
|
|
|
- val url = "${opts.dataPlatform}/dic/dt/data/query?groupCode=WD&userId=123456"
|
|
|
- val jsonObject = JSONObject()
|
|
|
- val jsonObject2 = JSONObject()
|
|
|
- jsonObject2["type"] = type
|
|
|
- jsonObject["criteria"] = jsonObject2
|
|
|
- val postObject = SHttpUtil.postObject<DictMajorResponse>(url, jsonObject)
|
|
|
- if (postObject.result == opts.SUCCESS_CODE) {
|
|
|
- if (!postObject.data.isNullOrEmpty()){
|
|
|
- return postObject.data!!
|
|
|
+ try {
|
|
|
+ try {
|
|
|
+ val jsonObject = JSONObject()
|
|
|
+ val jsonObject2 = JSONObject()
|
|
|
+ jsonObject2["type"] = type
|
|
|
+ jsonObject["criteria"] = jsonObject2
|
|
|
+ if (!customProperties.eurekaorhttp) {
|
|
|
+ val url = "${opts.dataPlatform}/dic/dt/data/query?groupCode=WD&userId=123456"
|
|
|
+ val postObject = SHttpUtil.postObject<DictMajorResponse>(url, jsonObject)
|
|
|
+ if (postObject.result == opts.SUCCESS_CODE) {
|
|
|
+ if (!postObject.data.isNullOrEmpty()){
|
|
|
+ return postObject.data!!
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ val url = "${serviceNameConfig.DMPRWD}/dic/dt/data/query?groupCode=WD&userId=123456"
|
|
|
+ // val postObject = SHttpUtil.postObject<DictMajorResponse>(url, jsonObject)
|
|
|
+ val postObject = restTemplate.postForObject(url, jsonObject, DictMajorResponse::class.java)
|
|
|
+ if (postObject.result == opts.SUCCESS_CODE) {
|
|
|
+ if (!postObject.data.isNullOrEmpty()){
|
|
|
+ return postObject.data!!
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (e: Exception) {
|
|
|
+ e.printStackTrace()
|
|
|
}
|
|
|
+ } catch (e: Exception) {
|
|
|
+ e.printStackTrace()
|
|
|
}
|
|
|
+
|
|
|
return ArrayList()
|
|
|
} // Fun dictMajor()
|
|
|
|
|
@@ -180,17 +284,34 @@ object DictTypeApi {
|
|
|
* 待处理
|
|
|
*/
|
|
|
fun dictGroupScheme(groupId: String): ArrayList<DictGroupSchemeResponse.DataBean>{
|
|
|
- val url = "${opts.dataPlatform}/dict/scheme/query"
|
|
|
- val jsonObject = JSONObject()
|
|
|
- val jsonObject2 = JSONObject()
|
|
|
- jsonObject2["groupId"] = groupId
|
|
|
- jsonObject["criteria"] = jsonObject2
|
|
|
- val postObject = SHttpUtil.postObject<DictGroupSchemeResponse>(url, jsonObject)
|
|
|
- if (postObject.result == opts.SUCCESS_CODE) {
|
|
|
- if (!postObject.data.isNullOrEmpty()){
|
|
|
- return postObject.data!!
|
|
|
+
|
|
|
+ try {
|
|
|
+ val jsonObject = JSONObject()
|
|
|
+ val jsonObject2 = JSONObject()
|
|
|
+ jsonObject2["groupId"] = groupId
|
|
|
+ jsonObject["criteria"] = jsonObject2
|
|
|
+ if (!customProperties.eurekaorhttp) {
|
|
|
+ val url = "${opts.dataPlatform}/dict/scheme/query"
|
|
|
+ val postObject = SHttpUtil.postObject<DictGroupSchemeResponse>(url, jsonObject)
|
|
|
+ if (postObject.result == opts.SUCCESS_CODE) {
|
|
|
+ if (!postObject.data.isNullOrEmpty()){
|
|
|
+ return postObject.data!!
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ val url = "${serviceNameConfig.DMPRWD}/dict/scheme/query"
|
|
|
+ // val postObject = SHttpUtil.postObject<DictGroupSchemeResponse>(url, jsonObject)
|
|
|
+ val postObject = restTemplate.postForObject(url, jsonObject, DictGroupSchemeResponse::class.java)
|
|
|
+ if (postObject.result == opts.SUCCESS_CODE) {
|
|
|
+ if (!postObject.data.isNullOrEmpty()){
|
|
|
+ return postObject.data!!
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
+ } catch (e: Exception) {
|
|
|
+ e.printStackTrace()
|
|
|
}
|
|
|
+
|
|
|
return ArrayList()
|
|
|
} // Fun dictGroupScheme()
|
|
|
|
|
@@ -199,17 +320,34 @@ object DictTypeApi {
|
|
|
* 待处理
|
|
|
*/
|
|
|
fun dictSchemeCategoty(schemeId: Int): ArrayList<DictSchemeCategoryResponse.DataBean>{
|
|
|
- val url = "${opts.dataPlatform}/dict/scheme/class/query"
|
|
|
- val jsonObject = JSONObject()
|
|
|
- val jsonObject2 = JSONObject()
|
|
|
- jsonObject2["groupId"] = schemeId.toString()
|
|
|
- jsonObject["criteria"] = jsonObject2
|
|
|
- val postObject = SHttpUtil.postObject<DictSchemeCategoryResponse>(url, jsonObject)
|
|
|
- if (postObject.result == opts.SUCCESS_CODE) {
|
|
|
- if (!postObject.data.isNullOrEmpty()){
|
|
|
- return postObject.data!!
|
|
|
+
|
|
|
+ try {
|
|
|
+ val jsonObject = JSONObject()
|
|
|
+ val jsonObject2 = JSONObject()
|
|
|
+ jsonObject2["groupId"] = schemeId.toString()
|
|
|
+ jsonObject["criteria"] = jsonObject2
|
|
|
+ if (!customProperties.eurekaorhttp) {
|
|
|
+ val url = "${opts.dataPlatform}/dict/scheme/class/query"
|
|
|
+ val postObject = SHttpUtil.postObject<DictSchemeCategoryResponse>(url, jsonObject)
|
|
|
+ if (postObject.result == opts.SUCCESS_CODE) {
|
|
|
+ if (!postObject.data.isNullOrEmpty()){
|
|
|
+ return postObject.data!!
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ val url = "${serviceNameConfig.DMPRWD}/dict/scheme/class/query"
|
|
|
+ // val postObject = SHttpUtil.postObject<DictSchemeCategoryResponse>(url, jsonObject)
|
|
|
+ val postObject = restTemplate.postForObject(url, jsonObject, DictSchemeCategoryResponse::class.java)
|
|
|
+ if (postObject.result == opts.SUCCESS_CODE) {
|
|
|
+ if (!postObject.data.isNullOrEmpty()){
|
|
|
+ return postObject.data!!
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
+ } catch (e: Exception) {
|
|
|
+ e.printStackTrace()
|
|
|
}
|
|
|
+
|
|
|
return ArrayList()
|
|
|
} // Fun dictSchemeCategoty()
|
|
|
|
|
@@ -218,18 +356,34 @@ object DictTypeApi {
|
|
|
* 待处理
|
|
|
*/
|
|
|
fun dictSchemeCategotyInfo(schemeId: Int,code: String): ArrayList<DictSchemeCategoryResponseInfo.DataBean>{
|
|
|
- val url = "${opts.dataPlatform}/dict/scheme/funcid/query"
|
|
|
- val jsonObject = JSONObject()
|
|
|
- val jsonObject2 = JSONObject()
|
|
|
- jsonObject2["schemeId"] = schemeId.toString()
|
|
|
- jsonObject2["classCode"] = code
|
|
|
- jsonObject["criteria"] = jsonObject2
|
|
|
- val postObject = SHttpUtil.postObject<DictSchemeCategoryResponseInfo>(url, jsonObject)
|
|
|
- if (postObject.result == opts.SUCCESS_CODE) {
|
|
|
- if (!postObject.data.isNullOrEmpty()){
|
|
|
- return postObject.data!!
|
|
|
+ try {
|
|
|
+ val jsonObject = JSONObject()
|
|
|
+ val jsonObject2 = JSONObject()
|
|
|
+ jsonObject2["schemeId"] = schemeId.toString()
|
|
|
+ jsonObject2["classCode"] = code
|
|
|
+ jsonObject["criteria"] = jsonObject2
|
|
|
+ if (!customProperties.eurekaorhttp) {
|
|
|
+ val url = "${opts.dataPlatform}/dict/scheme/funcid/query"
|
|
|
+ val postObject = SHttpUtil.postObject<DictSchemeCategoryResponseInfo>(url, jsonObject)
|
|
|
+ if (postObject.result == opts.SUCCESS_CODE) {
|
|
|
+ if (!postObject.data.isNullOrEmpty()){
|
|
|
+ return postObject.data!!
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ val url = "${serviceNameConfig.DMPRWD}/dict/scheme/funcid/query"
|
|
|
+ // val postObject = SHttpUtil.postObject<DictSchemeCategoryResponseInfo>(url, jsonObject)
|
|
|
+ val postObject = restTemplate.postForObject(url, jsonObject, DictSchemeCategoryResponseInfo::class.java)
|
|
|
+ if (postObject.result == opts.SUCCESS_CODE) {
|
|
|
+ if (!postObject.data.isNullOrEmpty()){
|
|
|
+ return postObject.data!!
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
+ } catch (e: Exception) {
|
|
|
+ e.printStackTrace()
|
|
|
}
|
|
|
+
|
|
|
return ArrayList()
|
|
|
} // Fun dictSchemeCategotyInfo()
|
|
|
|
|
@@ -238,19 +392,35 @@ object DictTypeApi {
|
|
|
* 待处理
|
|
|
*/
|
|
|
fun dictSchemeAndProject(projectId: String): ArrayList<DictSchemeAndProjectResponse.DataBean>{
|
|
|
- val url = "${opts.dataPlatform}/dict/scheme/project/query"
|
|
|
- val jsonObject = JSONObject()
|
|
|
- val jsonObject2 = JSONObject()
|
|
|
- val jsonArray = JSONArray()
|
|
|
- jsonArray.fluentAdd(projectId)
|
|
|
- jsonObject2["projectId"] = jsonArray
|
|
|
- jsonObject["criteria"] = jsonObject2
|
|
|
- val postObject = SHttpUtil.postObject<DictSchemeAndProjectResponse>(url, jsonObject)
|
|
|
- if (postObject.result == opts.SUCCESS_CODE) {
|
|
|
- if (!postObject.data.isNullOrEmpty()){
|
|
|
- return postObject.data!!
|
|
|
+ try {
|
|
|
+ val jsonObject = JSONObject()
|
|
|
+ val jsonObject2 = JSONObject()
|
|
|
+ val jsonArray = JSONArray()
|
|
|
+ jsonArray.fluentAdd(projectId)
|
|
|
+ jsonObject2["projectId"] = jsonArray
|
|
|
+ jsonObject["criteria"] = jsonObject2
|
|
|
+ if (!customProperties.eurekaorhttp) {
|
|
|
+ val url = "${opts.dataPlatform}/dict/scheme/project/query"
|
|
|
+ val postObject = SHttpUtil.postObject<DictSchemeAndProjectResponse>(url, jsonObject)
|
|
|
+ if (postObject.result == opts.SUCCESS_CODE) {
|
|
|
+ if (!postObject.data.isNullOrEmpty()){
|
|
|
+ return postObject.data!!
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ val url = "${serviceNameConfig.DMPRWD}/dict/scheme/project/query"
|
|
|
+ // val postObject = SHttpUtil.postObject<DictSchemeAndProjectResponse>(url, jsonObject)
|
|
|
+ val postObject = restTemplate.postForObject(url, jsonObject, DictSchemeAndProjectResponse::class.java)
|
|
|
+ if (postObject.result == opts.SUCCESS_CODE) {
|
|
|
+ if (!postObject.data.isNullOrEmpty()){
|
|
|
+ return postObject.data!!
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
+ } catch (e: Exception) {
|
|
|
+ e.printStackTrace()
|
|
|
}
|
|
|
+
|
|
|
return ArrayList()
|
|
|
} // dictSchemeAndProject()
|
|
|
|
|
@@ -261,16 +431,32 @@ object DictTypeApi {
|
|
|
*/
|
|
|
fun dictGroup(groupId: String): ArrayList<DictPlatformType>{
|
|
|
//type=group&groupCode=wd
|
|
|
- val url = "${opts.dataPlatform}/rwd/def/class?groupCode=$groupId"
|
|
|
- val jsonObject = JSONObject()
|
|
|
- val jsonObject2 = JSONObject()
|
|
|
- jsonObject["criteria"] = jsonObject2
|
|
|
- val dictGroupCategoryResponse = SHttpUtil.postObject<DictPlatformTypeResponse>(url,jsonObject)
|
|
|
- if (dictGroupCategoryResponse.result == opts.SUCCESS_CODE) {
|
|
|
- if (!dictGroupCategoryResponse.data.isNullOrEmpty()){
|
|
|
- return dictGroupCategoryResponse.data!!
|
|
|
+ try {
|
|
|
+ val jsonObject = JSONObject()
|
|
|
+ val jsonObject2 = JSONObject()
|
|
|
+ jsonObject["criteria"] = jsonObject2
|
|
|
+ if (!customProperties.eurekaorhttp) {
|
|
|
+ val url = "${opts.dataPlatform}/rwd/def/class?groupCode=$groupId"
|
|
|
+ val dictGroupCategoryResponse = SHttpUtil.postObject<DictPlatformTypeResponse>(url,jsonObject)
|
|
|
+ if (dictGroupCategoryResponse.result == opts.SUCCESS_CODE) {
|
|
|
+ if (!dictGroupCategoryResponse.data.isNullOrEmpty()){
|
|
|
+ return dictGroupCategoryResponse.data!!
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ val url = "${serviceNameConfig.DMPRWD}/rwd/def/class?groupCode=$groupId"
|
|
|
+ // val dictGroupCategoryResponse = SHttpUtil.postObject<DictPlatformTypeResponse>(url,jsonObject)
|
|
|
+ val dictGroupCategoryResponse = restTemplate.postForObject(url, jsonObject, DictPlatformTypeResponse::class.java)
|
|
|
+ if (dictGroupCategoryResponse.result == opts.SUCCESS_CODE) {
|
|
|
+ if (!dictGroupCategoryResponse.data.isNullOrEmpty()){
|
|
|
+ return dictGroupCategoryResponse.data!!
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
+ } catch (e: Exception) {
|
|
|
+ e.printStackTrace()
|
|
|
}
|
|
|
+
|
|
|
return ArrayList()
|
|
|
} // Fun dictGroup()
|
|
|
|
|
@@ -278,17 +464,33 @@ object DictTypeApi {
|
|
|
* 集团下对象信息点
|
|
|
*/
|
|
|
fun dictGroupInfo(groupId: String,code: String): ArrayList<DictPlatformInfo>{
|
|
|
- val url = "${opts.dataPlatform}/rwd/def/funcid?groupCode=$groupId"
|
|
|
- val jsonObject = JSONObject()
|
|
|
- val jsonObject2 = JSONObject()
|
|
|
- jsonObject2["classCode"] = code
|
|
|
- jsonObject["criteria"] = jsonObject2
|
|
|
- val dictPlatformInfoResponse = SHttpUtil.postObject<DictPlatformInfoResponse>(url,jsonObject)
|
|
|
- if (dictPlatformInfoResponse.result == opts.SUCCESS_CODE) {
|
|
|
- if (!dictPlatformInfoResponse.data.isNullOrEmpty()){
|
|
|
- return dictPlatformInfoResponse.data!!
|
|
|
+ try {
|
|
|
+ val jsonObject = JSONObject()
|
|
|
+ val jsonObject2 = JSONObject()
|
|
|
+ jsonObject2["classCode"] = code
|
|
|
+ jsonObject["criteria"] = jsonObject2
|
|
|
+ if (!customProperties.eurekaorhttp) {
|
|
|
+ val url = "${opts.dataPlatform}/rwd/def/funcid?groupCode=$groupId"
|
|
|
+ val dictPlatformInfoResponse = SHttpUtil.postObject<DictPlatformInfoResponse>(url,jsonObject)
|
|
|
+ if (dictPlatformInfoResponse.result == opts.SUCCESS_CODE) {
|
|
|
+ if (!dictPlatformInfoResponse.data.isNullOrEmpty()){
|
|
|
+ return dictPlatformInfoResponse.data!!
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ val url = "${serviceNameConfig.DMPRWD}/rwd/def/funcid?groupCode=$groupId"
|
|
|
+ // val dictPlatformInfoResponse = SHttpUtil.postObject<DictPlatformInfoResponse>(url,jsonObject)
|
|
|
+ val dictPlatformInfoResponse = restTemplate.postForObject(url, jsonObject, DictPlatformInfoResponse::class.java)
|
|
|
+ if (dictPlatformInfoResponse.result == opts.SUCCESS_CODE) {
|
|
|
+ if (!dictPlatformInfoResponse.data.isNullOrEmpty()){
|
|
|
+ return dictPlatformInfoResponse.data!!
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
+ } catch (e: Exception) {
|
|
|
+ e.printStackTrace()
|
|
|
}
|
|
|
+
|
|
|
return ArrayList()
|
|
|
} // Fun dictGroupInfo()
|
|
|
|
|
@@ -299,17 +501,36 @@ object DictTypeApi {
|
|
|
*/
|
|
|
fun dictProject(groupCode: String,projectId: String): ArrayList<DictPlatformType>{
|
|
|
//type=group&groupCode=wd
|
|
|
- val url = "${opts.dataPlatform}/rwd/def/class?groupCode=$groupCode&projectId=$projectId"
|
|
|
- val jsonObject = JSONObject()
|
|
|
- val jsonObject2 = JSONObject()
|
|
|
- jsonObject["criteria"] = jsonObject2
|
|
|
- logger.debug("url = $url")
|
|
|
- logger.debug("boby = ${jsonObject.toJson()}")
|
|
|
- val dictGroupCategoryResponse = SHttpUtil.postObject<DictPlatformTypeResponse>(url,jsonObject)
|
|
|
- if (dictGroupCategoryResponse.result == opts.SUCCESS_CODE) {
|
|
|
- if (!dictGroupCategoryResponse.data.isNullOrEmpty()){
|
|
|
- return dictGroupCategoryResponse.data!!
|
|
|
+ try {
|
|
|
+ val jsonObject = JSONObject()
|
|
|
+ val jsonObject2 = JSONObject()
|
|
|
+ jsonObject["criteria"] = jsonObject2
|
|
|
+
|
|
|
+ if (!customProperties.eurekaorhttp) {
|
|
|
+ val url = "${opts.dataPlatform}/rwd/def/class?groupCode=$groupCode&projectId=$projectId"
|
|
|
+ logger.debug("url = $url")
|
|
|
+ logger.debug("boby = ${jsonObject.toJson()}")
|
|
|
+ val dictGroupCategoryResponse = SHttpUtil.postObject<DictPlatformTypeResponse>(url,jsonObject)
|
|
|
+ if (dictGroupCategoryResponse.result == opts.SUCCESS_CODE) {
|
|
|
+ if (!dictGroupCategoryResponse.data.isNullOrEmpty()){
|
|
|
+ return dictGroupCategoryResponse.data!!
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ val url = "${serviceNameConfig.DMPRWD}/rwd/def/class?groupCode=$groupCode&projectId=$projectId"
|
|
|
+ logger.debug("url = $url")
|
|
|
+ logger.debug("boby = ${jsonObject.toJson()}")
|
|
|
+// val dictGroupCategoryResponse = SHttpUtil.postObject<DictPlatformTypeResponse>(url,jsonObject)
|
|
|
+ val dictGroupCategoryResponse = restTemplate.postForObject(url, jsonObject, DictPlatformTypeResponse::class.java)
|
|
|
+ if (dictGroupCategoryResponse.result == opts.SUCCESS_CODE) {
|
|
|
+ if (!dictGroupCategoryResponse.data.isNullOrEmpty()){
|
|
|
+ return dictGroupCategoryResponse.data!!
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
+ } catch (e: Exception) {
|
|
|
+ e.printStackTrace()
|
|
|
}
|
|
|
return ArrayList()
|
|
|
} // Fun dictGroup()
|
|
@@ -318,20 +539,29 @@ object DictTypeApi {
|
|
|
* 集团下对象信息点
|
|
|
*/
|
|
|
fun dictProjectInfo(groupId: String,code: String,projectId: String): ArrayList<DictPlatformInfo>{
|
|
|
- val url = "${opts.dataPlatform}/rwd/def/funcid?groupCode=$groupId&projectId=$projectId"
|
|
|
val jsonObject = JSONObject()
|
|
|
val jsonObject2 = JSONObject()
|
|
|
jsonObject2["classCode"] = code
|
|
|
jsonObject["criteria"] = jsonObject2
|
|
|
- val dictPlatformInfoResponse = SHttpUtil.postObject<DictPlatformInfoResponse>(url,jsonObject)
|
|
|
- if (dictPlatformInfoResponse.result == opts.SUCCESS_CODE) {
|
|
|
- if (!dictPlatformInfoResponse.data.isNullOrEmpty()){
|
|
|
- return dictPlatformInfoResponse.data!!
|
|
|
+ if (!customProperties.eurekaorhttp) {
|
|
|
+ val url = "${opts.dataPlatform}/rwd/def/funcid?groupCode=$groupId&projectId=$projectId"
|
|
|
+ val dictPlatformInfoResponse = SHttpUtil.postObject<DictPlatformInfoResponse>(url,jsonObject)
|
|
|
+ if (dictPlatformInfoResponse.result == opts.SUCCESS_CODE) {
|
|
|
+ if (!dictPlatformInfoResponse.data.isNullOrEmpty()){
|
|
|
+ return dictPlatformInfoResponse.data!!
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ val url = "${serviceNameConfig.DMPRWD}/rwd/def/funcid?groupCode=$groupId&projectId=$projectId"
|
|
|
+// val dictPlatformInfoResponse = SHttpUtil.postObject<DictPlatformInfoResponse>(url,jsonObject)
|
|
|
+ val dictPlatformInfoResponse = restTemplate.postForObject(url, jsonObject, DictPlatformInfoResponse::class.java)
|
|
|
+ if (dictPlatformInfoResponse.result == opts.SUCCESS_CODE) {
|
|
|
+ if (!dictPlatformInfoResponse.data.isNullOrEmpty()){
|
|
|
+ return dictPlatformInfoResponse.data!!
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
return ArrayList()
|
|
|
- } // Fun dictGroupInfo()
|
|
|
-
|
|
|
-
|
|
|
+ }
|
|
|
|
|
|
-} // Object DictTypeApi
|
|
|
+}
|