annew 1 年間 前
コミット
793051b97c
76 ファイル変更1435 行追加380 行削除
  1. 2 2
      dxp-engine/config/config.yml
  2. 2 1
      dxp-engine/dao/db_helper.go
  3. 2 1
      dxp-engine/global/global.go
  4. 1 0
      dxp-engine/go.mod
  5. 4 0
      dxp-engine/go.sum
  6. 2 4
      dxp-engine/handler/dxpApi.go
  7. 183 32
      dxp-engine/handler/outApi.go
  8. 6 2
      dxp-engine/initApp/router.go
  9. 7 0
      dxp-engine/main.go
  10. 12 0
      dxp-engine/middleware/authorize.go
  11. 3 0
      dxp-engine/model/redis_access.go
  12. 77 1
      dxp-engine/service/api_proxy/cqgov.go
  13. 61 40
      dxp-engine/service/business_apiProxy.go
  14. 195 27
      dxp-engine/service/business_database.go
  15. 47 16
      dxp-engine/service/cron/dataCache.go
  16. 84 26
      dxp-engine/service/cron/subscribe.go
  17. 11 0
      dxp-java/dxp-admin/src/main/java/com/ruoyi/web/controller/dxp/customer/AuthController.java
  18. 8 0
      dxp-java/dxp-admin/src/main/java/com/ruoyi/web/controller/dxp/system/integration/ServiceIntegrationController.java
  19. 1 1
      dxp-java/dxp-admin/src/main/java/com/ruoyi/web/controller/dxp/system/metadata/MetadataDataController.java
  20. 10 10
      dxp-java/dxp-admin/src/main/resources/application-druid.yml
  21. 5 5
      dxp-java/dxp-admin/src/main/resources/application.yml
  22. 1 1
      dxp-java/dxp-admin/src/main/resources/logback.xml
  23. 2 0
      dxp-java/dxp-common/src/main/java/com/ruoyi/common/utils/http/HttpUtils.java
  24. 10 0
      dxp-java/dxp-service/src/main/java/com/ruoyi/dxp/domain/DataIntegration.java
  25. 25 1
      dxp-java/dxp-service/src/main/java/com/ruoyi/dxp/domain/ServiceIntegration.java
  26. 10 0
      dxp-java/dxp-service/src/main/java/com/ruoyi/dxp/dto/ResourceAuditDto.java
  27. 10 0
      dxp-java/dxp-service/src/main/java/com/ruoyi/dxp/dto/redis/RedisServiceDataDto.java
  28. 2 0
      dxp-java/dxp-service/src/main/java/com/ruoyi/dxp/mapper/NoticeMapper.java
  29. 2 0
      dxp-java/dxp-service/src/main/java/com/ruoyi/dxp/mapper/ServiceIntegrationMapper.java
  30. 2 0
      dxp-java/dxp-service/src/main/java/com/ruoyi/dxp/service/IServiceIntegrationService.java
  31. 18 6
      dxp-java/dxp-service/src/main/java/com/ruoyi/dxp/service/impl/DataIntegrationServiceImpl.java
  32. 7 0
      dxp-java/dxp-service/src/main/java/com/ruoyi/dxp/service/impl/ServiceCacheServiceImpl.java
  33. 5 0
      dxp-java/dxp-service/src/main/java/com/ruoyi/dxp/service/impl/ServiceIntegrationServiceImpl.java
  34. 61 1
      dxp-java/dxp-service/src/main/java/com/ruoyi/dxp/service/impl/UserResourceServiceImpl.java
  35. 8 2
      dxp-java/dxp-service/src/main/java/com/ruoyi/dxp/utils/ServiceUtils.java
  36. 35 0
      dxp-java/dxp-service/src/main/resources/mapper/system/base/NoticeMapper.xml
  37. 1 0
      dxp-java/dxp-service/src/main/resources/mapper/system/integration/DataIntegrationMapper.xml
  38. 11 1
      dxp-java/dxp-service/src/main/resources/mapper/system/integration/ServiceIntegrationMapper.xml
  39. 16 0
      dxp-java/dxp-service/src/main/resources/mapper/system/share/DataShareMapper.xml
  40. 17 1
      dxp-java/dxp-service/src/main/resources/mapper/system/share/ServiceShareMapper.xml
  41. 7 2
      dxp-java/dxp-system/src/main/resources/mapper/system/SysUserMapper.xml
  42. 1 1
      dxp-vue/.env.development
  43. 3 2
      dxp-vue/.env.production
  44. 1 0
      dxp-vue/src/components/ApplyResource/index.vue
  45. 1 1
      dxp-vue/src/main.js
  46. 10 10
      dxp-vue/src/utils/config.js
  47. 2 2
      dxp-vue/src/utils/dxp.js
  48. 1 1
      dxp-vue/src/utils/request.js
  49. 13 7
      dxp-vue/src/views/customer/cataDetail/index.vue
  50. 1 1
      dxp-vue/src/views/customer/myres/index.vue
  51. 97 40
      dxp-vue/src/views/index.vue
  52. 3 1
      dxp-vue/src/views/system/audit/application/index.vue
  53. 3 1
      dxp-vue/src/views/system/audit/customer/index.vue
  54. 25 12
      dxp-vue/src/views/system/audit/data/index.vue
  55. 52 16
      dxp-vue/src/views/system/audit/resource/index.vue
  56. 2 2
      dxp-vue/src/views/system/audit/service/index.vue
  57. 35 15
      dxp-vue/src/views/system/base/database/index.vue
  58. 4 0
      dxp-vue/src/views/system/base/dict/data.vue
  59. 8 0
      dxp-vue/src/views/system/base/tag/index.vue
  60. 4 0
      dxp-vue/src/views/system/base/topic/index.vue
  61. 4 0
      dxp-vue/src/views/system/integration/catalogue/index.vue
  62. 22 11
      dxp-vue/src/views/system/integration/data/index.vue
  63. 65 41
      dxp-vue/src/views/system/integration/service/index.vue
  64. 4 0
      dxp-vue/src/views/system/metadata/data/index.vue
  65. 4 0
      dxp-vue/src/views/system/permission/company/index.vue
  66. 4 0
      dxp-vue/src/views/system/permission/dept/index.vue
  67. 4 0
      dxp-vue/src/views/system/permission/menu/index.vue
  68. 4 0
      dxp-vue/src/views/system/permission/post/index.vue
  69. 4 0
      dxp-vue/src/views/system/permission/role/index.vue
  70. 4 0
      dxp-vue/src/views/system/permission/user/index.vue
  71. 4 0
      dxp-vue/src/views/system/quality/desensitization/index.vue
  72. 4 0
      dxp-vue/src/views/system/share/catalogue/index.vue
  73. 10 1
      dxp-vue/src/views/system/share/data/index.vue
  74. 5 0
      dxp-vue/src/views/system/share/literature/index.vue
  75. 48 30
      dxp-vue/src/views/system/share/service/index.vue
  76. 6 2
      dxp-vue/src/views/system/share/serviceCache/index.vue

+ 2 - 2
dxp-engine/config/config.yml

@@ -1,8 +1,8 @@
 system:
   port: 28080
 mysql:
-  host: 127.0.0.1:3306
-  database: datadb
+  host: 182.43.90.51:3306
+  database: rw_system_db
   username: root
   password: 123456
   charset: utf8

+ 2 - 1
dxp-engine/dao/db_helper.go

@@ -6,6 +6,7 @@ import (
 	"database/sql"
 	"encoding/json"
 	"errors"
+	_ "gitee.com/chunanyong/dm"
 	_ "github.com/go-sql-driver/mysql"
 	"regexp"
 	"strings"
@@ -40,7 +41,7 @@ func DbConnect(sqlType string,connInfo string)(*sql.DB,error){
 	}else if sqlType == "postgres"{
 		db, err = sql.Open("postgres", connInfo)
 		if err != nil {
-			global.SystemLogger.Log(logrus.ErrorLevel,"open mysql failed, err:%s",err.Error())
+			global.SystemLogger.Log(logrus.ErrorLevel,"open postgres failed, err:%s",err.Error())
 			return nil,err
 		}
 	}else if sqlType == "kingbase"{

+ 2 - 1
dxp-engine/global/global.go

@@ -6,7 +6,6 @@ import (
 	"github.com/go-playground/validator/v10"
 	"github.com/go-redis/redis/v7"
 	"github.com/sirupsen/logrus"
-
 )
 
 type DbInfo struct{
@@ -18,6 +17,7 @@ type DbInfo struct{
 	Id             int
 }
 
+
 var (
 	SystemConfig  *config.Server
 	SystemLogger *logrus.Logger
@@ -25,4 +25,5 @@ var (
 	DataValidator *validator.Validate
 	Databases     []DbInfo
 	RedisDataShare      string
+
 )

+ 1 - 0
dxp-engine/go.mod

@@ -3,6 +3,7 @@ module DataShare
 go 1.16
 
 require (
+	gitee.com/chunanyong/dm v1.8.11
 	github.com/dgrijalva/jwt-go v3.2.0+incompatible
 	github.com/fvbock/endless v0.0.0-20170109170031-447134032cb6
 	github.com/gin-gonic/gin v1.8.1

+ 4 - 0
dxp-engine/go.sum

@@ -1,3 +1,5 @@
+gitee.com/chunanyong/dm v1.8.11 h1:JPwiS1PqHObo4QFodruLR8WOhLP+7Y/EKGGu2BJ5SJI=
+gitee.com/chunanyong/dm v1.8.11/go.mod h1:EPRJnuPFgbyOFgJ0TRYCTGzhq+ZT4wdyaj/GW/LLcNg=
 github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
 github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc=
 github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE=
@@ -53,6 +55,8 @@ github.com/goccy/go-json v0.9.7/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGF
 github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
 github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
 github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
+github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4=
+github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
 github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
 github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
 github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=

+ 2 - 4
dxp-engine/handler/dxpApi.go

@@ -31,8 +31,6 @@ func DxpApi_RouteInit(Router *gin.RouterGroup){
 		dxpRouter.POST("databaseQueryTable", databaseQueryTable)
 
 		dxpRouter.POST("databaseDropTable", databaseDropTable)
-
-
 	}
 }
 
@@ -354,8 +352,8 @@ func databaseInsertData(c *gin.Context){
 		return
 	}
 	if global.SystemLogger.Level > logrus.DebugLevel {
-		request_body,_ := json.Marshal(&param)
-		defer c.Set("params",string(request_body))
+		//request_body,_ := json.Marshal(&param)
+		//defer c.Set("params",string(request_body))
 	}
 
 	err := global.DataValidator.Struct(param)

+ 183 - 32
dxp-engine/handler/outApi.go

@@ -54,9 +54,6 @@ func OutApi_RouteInit2(Router *gin.RouterGroup){
 	}
 }
 
-
-
-
 // @Tags 第三方接口服务-应用鉴权
 // @Summary 应用鉴权
 // @Description 应用鉴权
@@ -66,8 +63,17 @@ func OutApi_RouteInit2(Router *gin.RouterGroup){
 // @Success 200 {object} model.ResponseToken "{"code": 0, "msg": "xxx", data:{}}"
 // @Router /dxp/outapi/authorize [post]
 func authorize(c *gin.Context){
+	//先判断服务器授权
+	ret,_,err := dao.Empower_GetInstance().GetLiceneseLeftDays()
+	if err != nil {
+		response.FailWithMessage(err.Error(),c,"JSON")
+		return
+	}
+	if ret == false {
+		response.FailWithMessage(err.Error(),c,"JSON")
+		return
+	}
 	var param model.LoginRequest
-
 	if err := c.ShouldBindJSON(&param); err != nil {
 		response.FailWithMessage("invalid json provided",c,"JSON")
 		return
@@ -217,12 +223,14 @@ func any(c *gin.Context){
 
 	if resType == "Service"{
 
-		cnt := dao.GetApiCallCount(serviceInfo.AccessId)
-		if cnt > serviceInfo.DayLimit {
-			response.FailWithMessage("超出单日调用最大次数!",c,serviceInfo.Format)
-			return
+		if serviceInfo.DayLimit > 0 {
+			cnt := dao.GetApiCallCount(serviceInfo.AccessId)
+			if cnt > serviceInfo.DayLimit {
+				response.FailWithMessage("超出单日调用最大次数!",c,serviceInfo.Format)
+				return
+			}
+			dao.IncApiCallCount(serviceInfo.AccessId)
 		}
-		dao.IncApiCallCount(serviceInfo.AccessId)
 		request_body,_:=ioutil.ReadAll(c.Request.Body)
 
 		//request_body,_ := json.Marshal(&param)
@@ -234,7 +242,67 @@ func any(c *gin.Context){
 		fmt.Println("accesskey:",key)
 		fmt.Println("request url:",serviceInfo.ResData.ServiceUrl)
 		fmt.Println("request param",string(request_body))
-		mapData,byteData,err := api_proxy.CQ119_GetInstance().CQ119_ApiCall(serviceInfo.ResData.ServiceUrl,request_body)
+
+		userReq := make(map[string]interface{},0)
+		if len(request_body) > 0 {
+			err := json.Unmarshal(request_body, &userReq)
+			if err != nil {
+				global.SystemLogger.Log(logrus.ErrorLevel,"请求参数格式不对,JSON转换失败:", err)
+				response.FailWithMessage(err.Error(),c,serviceInfo.Format)
+				return
+			}
+		}
+		//拼接内置参数
+		search := ""
+		if userReq["search"] != nil {
+			search = userReq["search"].(string)
+		}
+		if serviceInfo.ResData.FixParams != nil && len(*serviceInfo.ResData.FixParams) > 0 {
+			if len(search) == 0 {
+				userReq["search"] = *serviceInfo.ResData.FixParams
+			}else{
+				//将search 参数和 fixparams 参数组装在一起
+				searchMap := make(map[string]interface{},0)
+				err := json.Unmarshal([]byte(search),&searchMap)
+				if err != nil {
+					global.SystemLogger.Log(logrus.ErrorLevel,"fix参数格式不对,JSON转换失败:", err)
+					response.FailWithMessage(err.Error(),c,serviceInfo.Format)
+					return
+				}
+				fixReq := make(map[string]interface{},0)
+				err = json.Unmarshal([]byte(*serviceInfo.ResData.FixParams), &fixReq)
+				if err != nil {
+					global.SystemLogger.Log(logrus.ErrorLevel,"fix参数格式不对,JSON转换失败:", err)
+					response.FailWithMessage(err.Error(),c,serviceInfo.Format)
+					return
+				}
+				for k,v := range fixReq {
+					searchMap[k] = v
+				}
+
+				newSearch, err := json.Marshal(searchMap)
+				if err != nil {
+					global.SystemLogger.Log(logrus.ErrorLevel,"请求参数格式不对,JSON转换失败:", err)
+					response.FailWithMessage(err.Error(),c,serviceInfo.Format)
+					return
+				}
+				userReq["search"] = string(newSearch)
+			}
+
+		}
+
+
+		newReq, err := json.Marshal(userReq)
+		if err != nil {
+			global.SystemLogger.Log(logrus.ErrorLevel,"请求参数格式不对,JSON转换失败:", err)
+			response.FailWithMessage(err.Error(),c,serviceInfo.Format)
+			return
+		}
+
+		mapData,byteData,err := api_proxy.CQ119_GetInstance().CQ119_ApiCall(serviceInfo.ResData.ServiceUrl,newReq)
+		if serviceInfo.ResData.AuthWay == "gov" {
+			mapData,byteData,err = api_proxy.GovDataFormatToResource(byteData)
+		}
 
 		duration := time.Since(start)
 		call_log.CallDuration = duration.Milliseconds()
@@ -272,12 +340,14 @@ func any(c *gin.Context){
 		//})
 	}else if resType == "Data"{
 
-		cnt := dao.GetApiCallCount(dataInfo.AccessId)
-		if cnt > dataInfo.DayLimit {
-			response.FailWithMessage("超出单日调用最大次数!",c,dataInfo.Format)
-			return
+		if dataInfo.DayLimit > 0 {
+			cnt := dao.GetApiCallCount(dataInfo.AccessId)
+			if cnt > dataInfo.DayLimit {
+				response.FailWithMessage("超出单日调用最大次数!",c,dataInfo.Format)
+				return
+			}
+			dao.IncApiCallCount(dataInfo.AccessId)
 		}
-		dao.IncApiCallCount(dataInfo.AccessId)
 
 		var param model.DbQuery
 		if err := c.ShouldBindJSON(&param); err != nil {
@@ -371,7 +441,17 @@ func apiCall(c *gin.Context){
 	}
 
 	if param.AuthWay == "gov"{
-
+		_,byteData,err := api_proxy.CQ119_GetInstance().CQ119_ApiCall(param.ServiceUrl,[]byte(param.RequestParam))
+		if err != nil {
+			response.FailWithMessage("call api failed.",c,"JSON")
+			return
+		}
+		mapData,_,err := api_proxy.GovDataFormatToResource(byteData)
+		if err != nil {
+			response.FailWithMessage(fmt.Sprintf("gov data swap to cq119 format failed.err:%s",err.Error()),c,"JSON")
+			return
+		}
+		response.OkWithData(mapData,c,"JSON")
 	}else if param.AuthWay == "119"{
 		result,_,err := api_proxy.CQ119_GetInstance().CQ119_ApiCall(param.ServiceUrl,[]byte(param.RequestParam))
 		if err != nil {
@@ -421,12 +501,14 @@ func apiProxyToData(c *gin.Context){
 
 	if resType == "Data"{
 
-		cnt := dao.GetApiCallCount(dataInfo.AccessId)
-		if cnt > dataInfo.DayLimit {
-			response.FailWithMessage("超出单日调用最大次数!",c,dataInfo.Format)
-			return
+		if dataInfo.DayLimit > 0 {
+			cnt := dao.GetApiCallCount(dataInfo.AccessId)
+			if cnt > dataInfo.DayLimit {
+				response.FailWithMessage("超出单日调用最大次数!",c,dataInfo.Format)
+				return
+			}
+			dao.IncApiCallCount(dataInfo.AccessId)
 		}
-		dao.IncApiCallCount(dataInfo.AccessId)
 
 		var param model.DbQuery
 		if err := c.ShouldBindJSON(&param); err != nil {
@@ -500,12 +582,14 @@ func apiProxyToService(c *gin.Context){
 
 	if resType == "Service"{
 
-		cnt := dao.GetApiCallCount(serviceInfo.AccessId)
-		if cnt > serviceInfo.DayLimit {
-			response.FailWithMessage("超出单日调用最大次数!",c,serviceInfo.Format)
-			return
+		if serviceInfo.DayLimit > 0 {
+			cnt := dao.GetApiCallCount(serviceInfo.AccessId)
+			if cnt > serviceInfo.DayLimit {
+				response.FailWithMessage("超出单日调用最大次数!",c,serviceInfo.Format)
+				return
+			}
+			dao.IncApiCallCount(serviceInfo.AccessId)
 		}
-		dao.IncApiCallCount(serviceInfo.AccessId)
 		request_body,_:=ioutil.ReadAll(c.Request.Body)
 
 		//request_body,_ := json.Marshal(&param)
@@ -517,7 +601,72 @@ func apiProxyToService(c *gin.Context){
 		fmt.Println("accesskey:",key)
 		fmt.Println("request url:",serviceInfo.ResData.ServiceUrl)
 		fmt.Println("request param",string(request_body))
-		mapData,byteData,err := api_proxy.CQ119_GetInstance().CQ119_ApiCall(serviceInfo.ResData.ServiceUrl,request_body)
+
+		userReq := make(map[string]interface{},0)
+		if len(request_body) > 0 {
+			err := json.Unmarshal(request_body, &userReq)
+			if err != nil {
+				global.SystemLogger.Log(logrus.ErrorLevel,"请求参数格式不对,JSON转换失败:", err)
+				response.FailWithMessage(err.Error(),c,serviceInfo.Format)
+				return
+			}
+		}
+		//拼接内置参数
+		search := ""
+		if userReq["search"] != nil {
+			search = userReq["search"].(string)
+		}
+		if serviceInfo.ResData.FixParams != nil && len(*serviceInfo.ResData.FixParams) > 0 {
+			if len(search) == 0 {
+				userReq["search"] = *serviceInfo.ResData.FixParams
+			}else{
+				//将search 参数和 fixparams 参数组装在一起
+				searchMap := make(map[string]interface{},0)
+				err := json.Unmarshal([]byte(search),&searchMap)
+				if err != nil {
+					global.SystemLogger.Log(logrus.ErrorLevel,"fix参数格式不对,JSON转换失败:", err)
+					response.FailWithMessage(err.Error(),c,serviceInfo.Format)
+					return
+				}
+				fixReq := make(map[string]interface{},0)
+				err = json.Unmarshal([]byte(*serviceInfo.ResData.FixParams), &fixReq)
+				if err != nil {
+					global.SystemLogger.Log(logrus.ErrorLevel,"fix参数格式不对,JSON转换失败:", err)
+					response.FailWithMessage(err.Error(),c,serviceInfo.Format)
+					return
+				}
+				for k,v := range fixReq {
+					searchMap[k] = v
+				}
+
+				newSearch, err := json.Marshal(searchMap)
+				if err != nil {
+					global.SystemLogger.Log(logrus.ErrorLevel,"请求参数格式不对,JSON转换失败:", err)
+					response.FailWithMessage(err.Error(),c,serviceInfo.Format)
+					return
+				}
+				userReq["search"] = string(newSearch)
+			}
+
+		}
+
+
+		newReq, err := json.Marshal(userReq)
+		if err != nil {
+			global.SystemLogger.Log(logrus.ErrorLevel,"请求参数格式不对,JSON转换失败:", err)
+			response.FailWithMessage(err.Error(),c,serviceInfo.Format)
+			return
+		}
+
+		fmt.Println("--------------------------------------")
+		fmt.Println(string(newReq))
+		fmt.Println("--------------------------------------")
+
+
+		mapData,byteData,err := api_proxy.CQ119_GetInstance().CQ119_ApiCall(serviceInfo.ResData.ServiceUrl,newReq)
+		if serviceInfo.ResData.AuthWay == "gov" {
+			mapData,byteData,err = api_proxy.GovDataFormatToResource(byteData)
+		}
 
 		duration := time.Since(start)
 		call_log.CallDuration = duration.Milliseconds()
@@ -555,12 +704,14 @@ func apiProxyToService(c *gin.Context){
 		//})
 	}else if resType == "Data"{
 
-		cnt := dao.GetApiCallCount(dataInfo.AccessId)
-		if cnt > dataInfo.DayLimit {
-			response.FailWithMessage("超出单日调用最大次数!",c,dataInfo.Format)
-			return
+		if dataInfo.DayLimit > 0 {
+			cnt := dao.GetApiCallCount(dataInfo.AccessId)
+			if cnt > dataInfo.DayLimit {
+				response.FailWithMessage("超出单日调用最大次数!",c,dataInfo.Format)
+				return
+			}
+			dao.IncApiCallCount(dataInfo.AccessId)
 		}
-		dao.IncApiCallCount(dataInfo.AccessId)
 
 		var param model.DbQuery
 		if err := c.ShouldBindJSON(&param); err != nil {

+ 6 - 2
dxp-engine/initApp/router.go

@@ -19,9 +19,13 @@ func RoutersInit()  *gin.Engine{
 	//DXP
 	dxpGroup := Router.Group("/dxp/database/")
 	handler.DxpApi_RouteInit(dxpGroup)
+	//license
+
+	dxpCore := Router.Group("/dxp/core/")
+	handler.DxpCore_RouteInit(dxpCore)
 	//todo
-	innerGroup := Router.Group("/api/v1/datashare/inapi/")
-	handler.InnerApi_RouteInit(innerGroup)
+	//innerGroup := Router.Group("/api/v1/datashare/inapi/")
+	//handler.InnerApi_RouteInit(innerGroup)
 	outerGroup := Router.Group("/dxp/outapi/base")
 	handler.OutApi_RouteInit(outerGroup)
 

+ 7 - 0
dxp-engine/main.go

@@ -33,6 +33,13 @@ func init(){
 }
 
 func main(){
+	//data,err := api_proxy.GovFormatTest()
+	//if err != nil {
+	//	fmt.Println(err)
+	//	return
+	//}
+	//fmt.Println(data)
+	//return
 
 	address := fmt.Sprintf(":%d", global.SystemConfig.System.Port)
 	router := initApp.RoutersInit()

+ 12 - 0
dxp-engine/middleware/authorize.go

@@ -27,6 +27,18 @@ func TokenAuthMiddleware() gin.HandlerFunc {
 			c.Abort()
 			return
 		}
+
+		ret,_,err := dao.Empower_GetInstance().GetLiceneseLeftDays()
+		if err != nil {
+			c.JSON(http.StatusUnauthorized, "unauthorized failed:"+err.Error())
+			c.Abort()
+			return
+		}
+		if ret == false {
+			c.JSON(http.StatusUnauthorized, "unauthorized expired:")
+			c.Abort()
+			return
+		}
 		c.Next()
 	}
 }

+ 3 - 0
dxp-engine/model/redis_access.go

@@ -45,6 +45,9 @@ type Access_Service_Params struct{
 type Access_Service_ResData struct {
 	AuthWay   string   `json:"authWay"`
 	NeedAuth   int   `json:"needAuth"`
+
+	FixParams *string  `json:"fixParams"`
+
 	ParamForm   string  `json:"paramForm"`
 
 	Params   []Access_Service_Params   `json:"params"`

+ 77 - 1
dxp-engine/service/api_proxy/cqgov.go

@@ -1,6 +1,14 @@
 package api_proxy
 
-import "sync"
+import (
+	"DataShare/util/gabs"
+	"encoding/json"
+	"errors"
+	"fmt"
+	"os"
+	"strconv"
+	"sync"
+)
 
 type CQGov struct{
 
@@ -14,3 +22,71 @@ func GetInstance() *CQGov{
 
 	return histance_gov
 }
+
+
+//政务数据格式转换到资源数据格式
+func GovDataFormatToResource(govData []byte)(map[string]interface{},[]byte,error) {
+
+	govContainer,err := gabs.ParseJSON(govData)
+	if err != nil {
+		return nil,nil,err
+	}
+	//result obj
+	resultObj1,err := govContainer.JSONPointer("/result")
+	if err != nil {
+		return nil,nil,errors.New(fmt.Sprintf("result field faield,err:%s", err.Error()))
+	}
+	if resultObj1 == nil {
+		return nil,nil,errors.New("数据集是空的")
+	}
+	result:= resultObj1.String()
+	mapResult := make(map[string]interface{},0)
+	json.Unmarshal([]byte(result),&mapResult)
+
+	//组装columns
+	mapColumns := make([]map[string]interface{},0)
+	children := govContainer.S("field").Children()
+	for i:=0;i<len(children);i++ {
+		child := children[i]
+		column := make(map[string]interface{},0)
+		field,_ := child.Search("name").Data().(string)
+		isSearch,_ := child.Search("isSearch").Data().(string)
+		isDisplay,_ := child.Search("isDisplay").Data().(string)
+		name,_ := child.Search("remarks").Data().(string)
+		column["field"] = field
+		column["isSearch"] = isSearch
+		column["isDisplay"] = isDisplay
+		column["name"] = name
+		mapColumns = append(mapColumns,column)
+	}
+
+	mapRet := make(map[string]interface{},0)
+
+	code,_ := strconv.Atoi(mapResult["code"].(string))
+
+	mapRet["code"] = code
+	mapRet["page"] = mapResult["pageNo"]
+	mapRet["size"] = mapResult["pageSize"]
+	mapRet["total"] = mapResult["total"]
+	mapRet["message"] = mapResult["message"]
+	mapRet["columns"] = mapColumns
+	mapRet["data"] = mapResult["result"]
+
+	byteData,err := json.Marshal(&mapRet)
+	return mapRet,byteData,err
+}
+
+func GovFormatTest() (string,error) {
+	dir,err := os.Getwd()
+	if err != nil {
+		return "",err
+	}
+	info_body, err := os.ReadFile(dir+"/service_test.json")
+	if err != nil {
+		return "",err
+	}
+
+	_,data,err := GovDataFormatToResource(info_body)
+
+	return string(data),err
+}

+ 61 - 40
dxp-engine/service/business_apiProxy.go

@@ -5,6 +5,7 @@ import (
 	"DataShare/global"
 	"DataShare/model"
 	"DataShare/service/api_proxy"
+	"DataShare/util/gabs"
 	"database/sql"
 	"encoding/json"
 	"errors"
@@ -279,7 +280,7 @@ func Business2_QueryTable(req *model.DbQuery,accessInfo *model.Access_Data_Struc
 	if dbInfo.Status == false {
 		return nil,errors.New(fmt.Sprintf("database:%s not connect",dbInfo.DbName))
 	}
-
+	//fmt.Println("--------------------------1-------------------------")
 	if dbInfo.SqlType == "mysql" {
 		sql := "select"
 		if req.PageSize > 0 {
@@ -303,6 +304,7 @@ func Business2_QueryTable(req *model.DbQuery,accessInfo *model.Access_Data_Struc
 				sql += " *"
 			}
 		}
+		//fmt.Println("--------------------------2-------------------------")
 
 		sql += " from %s"
 		args = append(args,accessInfo.ResData.TbName)
@@ -331,7 +333,7 @@ func Business2_QueryTable(req *model.DbQuery,accessInfo *model.Access_Data_Struc
 		//拼接默认参数
 		cols := accessInfo.ResData.Colnums
 		for zz:=0;zz<len(cols);zz++{
-			if cols[zz].IsSearchable != nil && *cols[zz].IsSearchable == 1 {
+			//if cols[zz].IsSearchable != nil && *cols[zz].IsSearchable == 1 {
 				if cols[zz].FilterOperator != nil && len(*cols[zz].FilterOperator) > 0 && cols[zz].FilterValue != nil && len(*cols[zz].FilterValue) > 0 {
 					if where == 0 {
 						sql += " where"
@@ -350,7 +352,7 @@ func Business2_QueryTable(req *model.DbQuery,accessInfo *model.Access_Data_Struc
 					args = append(args,cols[zz].Name)
 					args = append(args,*cols[zz].FilterValue)
 				}
-			}
+			//}
 		}
 		//排序
 		if len(req.Sort.ColName) > 0 {
@@ -368,6 +370,10 @@ func Business2_QueryTable(req *model.DbQuery,accessInfo *model.Access_Data_Struc
 			args = append(args,req.PageSize)
 		}
 		sqlStr := fmt.Sprintf(sql,args...)
+
+		//fmt.Println("---------------------------------------------------")
+		//fmt.Println(sqlStr)
+		//fmt.Println("---------------------------------------------------")
 		//查询
 		items,_,_,total,_ := dao.GetData2(dbInfo.DbHandle,sqlStr,accessInfo.ResData.Colnums)
 		result := &model.CommonList{
@@ -437,7 +443,7 @@ func Business2_QueryTable(req *model.DbQuery,accessInfo *model.Access_Data_Struc
 		//拼接默认参数
 		cols := accessInfo.ResData.Colnums
 		for zz:=0;zz<len(cols);zz++{
-			if cols[zz].IsSearchable != nil && *cols[zz].IsSearchable == 1 {
+			//if cols[zz].IsSearchable != nil && *cols[zz].IsSearchable == 1 {
 				if cols[zz].FilterOperator != nil && len(*cols[zz].FilterOperator) > 0 && cols[zz].FilterValue != nil && len(*cols[zz].FilterValue) > 0 {
 					if where == 0 {
 						sql += " where"
@@ -460,7 +466,7 @@ func Business2_QueryTable(req *model.DbQuery,accessInfo *model.Access_Data_Struc
 					args_count = append(args_count,cols[zz].Name)
 					args_count = append(args_count,*cols[zz].FilterValue)
 				}
-			}
+			//}
 		}
 		//统计总数
 		sqlCntStr := fmt.Sprintf(sqlCount,args_count...)
@@ -641,6 +647,7 @@ func Business2_CacheParser(dataByte []byte,req *model.DataCacheOfRedis) (*model.
 				for m:=0;m<len(column_map);m++{
 					if key.Interface().(string) == column_map[m].FieldName {
 						n[column_map[m].ColumnName] = strct.Interface()
+						break
 					}
 				}
 			}
@@ -649,6 +656,14 @@ func Business2_CacheParser(dataByte []byte,req *model.DataCacheOfRedis) (*model.
 			}
 		}
 	}
+	//fmt.Println("------------print rows_array------------------")
+	//for i:=0;i<len(rows_array);i++{
+	//	item := rows_array[i]
+	//	for k,v := range item {
+	//		fmt.Println("key:",k,"value:",v)
+	//	}
+	//}
+	//fmt.Println("--------------end print-----------------------")
 
 	return &cq119NormalResp,rows_array,nil
 }
@@ -683,30 +698,7 @@ func Business2_DataCache_DbConnect(dbInfo *model.CacheDbConfig) (*sql.DB,error){
 }
 //数据保存
 func Business2_DataSave(rows_array []map[string]interface{},dbInfo *model.CacheDbConfig)(error){
-	//find := false
-	//for i:=0;i<len(global.Databases);i++{
-	//	if dbInfo.DbId == global.Databases[i].Id{
-	//		find = true
-	//		break;
-	//	}
-	//}
-	//if find == false {
-	//	//连接数据库
-	//	db, err := dao.DbConnect(dbInfo.DbType,dbInfo.ConnectionString)
-	//	if err != nil {
-	//		return err
-	//	}
-	//
-	//	info := global.DbInfo{
-	//		DbHandle: db,
-	//		ConnInfo: dbInfo.ConnectionString,
-	//		Status:   true,
-	//		SqlType: dbInfo.DbType,
-	//		DbName: "",
-	//		Id: dbInfo.DbId,
-	//	}
-	//	global.Databases = append(global.Databases, info)
-	//}
+
 	//写数据表
 
 	column_data := model.ColnDataInsert{
@@ -714,18 +706,24 @@ func Business2_DataSave(rows_array []map[string]interface{},dbInfo *model.CacheD
 		TbName:       dbInfo.TbName,
 	}
 	for i:=0;i<len(rows_array);i++{
-		for k, values := range rows_array[i] {
-			fmt.Printf("%s: %s\n", k, values) // ... and this line
+		item := rows_array[i]
+		for k, _ := range item {
+			//fmt.Printf("--------%s: %s\n", k, values) // ... and this line
 			column_data.ColNameArray = append(column_data.ColNameArray,k)
 		}
 		break
 	}
 	for i:=0;i<len(rows_array);i++{
 		var row model.ColnItem
-		for k, values := range rows_array[i] {
-			fmt.Printf("%s: %s\n", k, values) // ... and this line
-			row.List = append(row.List,values.(string))
-		}
+		item := rows_array[i]
+		for j:=0;j<len(column_data.ColNameArray);j++ {
+			name := column_data.ColNameArray[j]
+			row.List = append(row.List,item[name].(string))
+		}
+		//for k, values := range item {
+		//	fmt.Printf("%s: %s\n", k, values) // ... and this line
+		//	row.List = append(row.List,values.(string))
+		//}
 		column_data.Rows = append(column_data.Rows,row)
 	}
 
@@ -777,7 +775,7 @@ func Business2_DataCache(dataCacheConfig *model.DataCacheOfRedis) error{
 		if dataCacheConfig.Mode == "full"{
 			//全量:删除数据表,重新同步数据
 			pageNo := 1
-			pageSize := 10
+			pageSize := 10000
 			total := 0
 			for ;;{
 				//参数
@@ -801,6 +799,10 @@ func Business2_DataCache(dataCacheConfig *model.DataCacheOfRedis) error{
 					global.SystemLogger.Log(logrus.ErrorLevel,fmt.Sprintf("serviceUrl:%s ,cache data failed.",serviceConfig.ServiceUrl))
 					return err
 				}
+				if serviceConfig.AuthWay == "gov" {
+					_,body,err = api_proxy.GovDataFormatToResource(body)
+				}
+
 				resp,rows_array,err := Business2_CacheParser(body,dataCacheConfig)
 				if len(rows_array)<1{
 					global.SystemLogger.Log(logrus.InfoLevel,fmt.Sprintf("serviceUrl:%s ,cache data complete.",serviceConfig.ServiceUrl))
@@ -815,11 +817,12 @@ func Business2_DataCache(dataCacheConfig *model.DataCacheOfRedis) error{
 				if pageNo*pageSize >= total{
 					break
 				}
+				break;
 			}
 		}else if dataCacheConfig.Mode == "add"{
 			total := 0
 			pageNo := 1
-			pageSize := 10
+			pageSize := 100
 			//增量:按照增量标识,获取最大值,作为条件
 			maxValue,err := dao.GetMaxValue(dataCacheConfig.AddField,dataCacheConfig.DbConfig.TbName,db)
 			if err != nil{
@@ -833,6 +836,7 @@ func Business2_DataCache(dataCacheConfig *model.DataCacheOfRedis) error{
 			//参数
 			for ;;{
 				//var paramMap map[string]interface{}
+
 				paramMap := make(map[string]interface{},0)
 				err := json.Unmarshal([]byte(serviceConfig.RequestParam),&paramMap)
 				if err != nil {
@@ -841,10 +845,20 @@ func Business2_DataCache(dataCacheConfig *model.DataCacheOfRedis) error{
 				}
 				paramMap[dataCacheConfig.PageField] = pageNo
 				paramMap[dataCacheConfig.PageSizeField] = pageSize
+
 				if maxValue != "<nil>" {
-					paramMap[dataCacheConfig.SearchField] = fmt.Sprintf("{\"%s.gt\":\"%s\"}",fieldName,maxValue)
+					if paramMap[dataCacheConfig.SearchField] != nil {
+						searchNode,err := gabs.ParseJSON([]byte(paramMap[dataCacheConfig.SearchField].(string)))
+						if err != nil {
+							return err
+						}
+						searchNode.Set(maxValue,fmt.Sprintf("%s.gt",fieldName))
+						paramMap[dataCacheConfig.SearchField] = searchNode.String()
+					}else{
+						paramMap[dataCacheConfig.SearchField] = fmt.Sprintf("{\"%s.gt\":\"%s\"}",fieldName,maxValue)
+					}
 				}else{
-					paramMap[dataCacheConfig.SearchField] = model.NullObj{}
+					//paramMap[dataCacheConfig.SearchField] = model.NullObj{}
 				}
 
 				newParam,err := json.Marshal(&paramMap)
@@ -852,12 +866,18 @@ func Business2_DataCache(dataCacheConfig *model.DataCacheOfRedis) error{
 					global.SystemLogger.Log(logrus.ErrorLevel,fmt.Sprintf("Business2_DataCache failed, errmsg:"+err.Error()))
 					return err
 				}
-
+				fmt.Println("-------------------------------")
+				fmt.Println(string(newParam))
+				fmt.Println("---------------------------------")
 				_,body,err := api_proxy.CQ119_GetInstance().CQ119_ApiCall(serviceConfig.ServiceUrl,newParam)
 				if err != nil {
 					global.SystemLogger.Log(logrus.ErrorLevel,fmt.Sprintf("serviceUrl:%s ,cache data failed.",serviceConfig.ServiceUrl))
 					return err
 				}
+				if serviceConfig.AuthWay == "gov" {
+					_,body,err = api_proxy.GovDataFormatToResource(body)
+				}
+
 				resp,rows_array,err := Business2_CacheParser(body,dataCacheConfig)
 				if len(rows_array)<1{
 					global.SystemLogger.Log(logrus.InfoLevel,fmt.Sprintf("serviceUrl:%s ,cache data complete.",serviceConfig.ServiceUrl))
@@ -874,6 +894,7 @@ func Business2_DataCache(dataCacheConfig *model.DataCacheOfRedis) error{
 				if pageNo*pageSize >= total{
 					break
 				}
+				break
 			}
 		}
 

+ 195 - 27
dxp-engine/service/business_database.go

@@ -141,24 +141,28 @@ func QueryTableList(dbId int)(*model.CommonList,error){
 		if err != nil {
 			return nil,err
 		}
-
 		return &model.CommonList{
 			Total: total,
 			Items: data,
 		},nil
 	}else if dbInfo.SqlType == "dm8"{
-		/*
-	select t.object_id, t.object_name, t.object_type
-		  from dba_objects t
-		where t.owner='DXP_TEST' and t.object_type='TABLE'
-		*/
+
+		sql := fmt.Sprintf("select t.object_id, t.object_name as name, t.object_type as comments from dba_objects t where t.owner='%s' and t.object_type='TABLE'",dbName)
+		data,_,_,_,err := dao.GetData(db,sql)
+		if err != nil {
+			return nil,err
+		}
+		return &model.CommonList{
+			Total: len(data),
+			Items: data,
+		},nil
 	}else if dbInfo.SqlType == "postgres"{
+
 		sql := "select tablename as name,tableowner as comments from pg_tables where schemaname='public'"
 		data,_,_,_,err := dao.GetData(db,sql)
 		if err != nil {
 			return nil,err
 		}
-
 		return &model.CommonList{
 			Total: len(data),
 			Items: data,
@@ -187,10 +191,12 @@ func QueryTableColnList(dbId int, tbName string)(*model.CommonList,error){
 	if dbInfo==nil{
 		return nil,errors.New("数据库不存在!")
 	}
+
 	db := dbInfo.DbHandle
 	dbName := dbInfo.DbName
 
 	if dbInfo.SqlType == "mysql"{
+
 		sql := "select SQL_CALC_FOUND_ROWS COLUMN_NAME as name,COLUMN_COMMENT as comments,DATA_TYPE as type from information_schema.columns where table_schema=? and table_name=?"
 		data,_,_,total,err := dao.GetData(db,sql,dbName,tbName)
 		if err != nil {
@@ -202,21 +208,17 @@ func QueryTableColnList(dbId int, tbName string)(*model.CommonList,error){
 			Items: data,
 		},nil
 	}else if dbInfo.SqlType == "dm8"{
-		/*
-		select t.TABLE_NAME,
-		       t.COLUMN_NAME,
-		       t.COLUMN_ID,
-		       t.DATA_TYPE,
-		       t.DATA_LENGTH,
-		       t.DATA_PRECISION,
-		       t.DATA_SCALE,
-		       t.NULLABLE,
-		       t.DATA_DEFAULT
-		   from user_tab_columns t
-		  where t.TABLE_NAME = 'DXP_CALL_LOG'   -- 表名
-		  order by t.COLUMN_ID;
-		*/
 
+		sql := fmt.Sprintf("select t.TABLE_NAME,t.COLUMN_NAME as name,t.COLUMN_ID,t.DATA_TYPE as type,t.DATA_LENGTH as dataLength,t.DATA_PRECISION as comments," +
+			"t.DATA_SCALE,t.NULLABLE,t.DATA_DEFAULT from user_tab_columns t where t.TABLE_NAME = '%s' order by t.COLUMN_ID",tbName)
+		data,_,_,_,err := dao.GetData(db,sql)
+		if err != nil {
+			return nil,err
+		}
+		return &model.CommonList{
+			Total: len(data),
+			Items: data,
+		},nil
 	}else if dbInfo.SqlType == "postgres"{
 
 		sql := fmt.Sprintf("SELECT col_description(a.attrelid,a.attnum) as comments,pg_type.typname as type,a.attname as name, a.attnotnull as notnull" +
@@ -226,7 +228,6 @@ func QueryTableColnList(dbId int, tbName string)(*model.CommonList,error){
 		if err != nil {
 			return nil,err
 		}
-
 		return &model.CommonList{
 			Total: len(data),
 			Items: data,
@@ -338,7 +339,54 @@ func DatabaseCreate(req *model.DatabaseCreateRequest)error{
 		fmt.Println("----------------")
 
 		return dao.Exec(dbInfo.DbHandle,sqlStr)
+	}else if req.DbType == "dm8"{
+		args := make([]interface{},0)
+		sql := "create table %s"
+		args = append(args,req.TbName)
 
+		sql +="(\n"
+		for n:=0;n<len(req.Columns);n++{
+			if req.Columns[n].DataLength > 0 {
+				sql +="%s %s(%d)"
+				args = append(args,req.Columns[n].ColName)
+				args = append(args,req.Columns[n].DataType)
+				args = append(args,req.Columns[n].DataLength)
+			}else {
+				sql +="%s %s"
+				args = append(args,req.Columns[n].ColName)
+				args = append(args,req.Columns[n].DataType)
+			}
+			if req.Columns[n].IsIncrement == 1 {
+				sql += " IDENTITY(1,1)"
+			}
+			if req.Columns[n].IsRequired == 1 {
+				sql += " not null"
+			}
+
+			if n == (len(req.Columns)-1){
+				if findPK == false {
+					sql += "\n"
+					break
+				}
+			}
+			sql += ",\n"
+		}
+		for n:=0;n<len(req.Columns);n++ {
+			if req.Columns[n].IsPk == 1 {
+				sql += "PRIMARY KEY (%s)"
+				args = append(args,req.Columns[n].ColName)
+				break
+			}
+		}
+		sql += "\n)"
+
+		sqlStr := fmt.Sprintf(sql,args...)
+
+		fmt.Println("----------------")
+		fmt.Println(sqlStr)
+		fmt.Println("----------------")
+
+		return dao.Exec(dbInfo.DbHandle,sqlStr)
 	}else if req.DbType == "postgres" {
 
 		args := make([]interface{},0)
@@ -465,6 +513,33 @@ func DatabaseAddIndex(req* model.TbIndex) error{
 
 		sqlStr := fmt.Sprintf(sql,args...)
 
+		return dao.Exec(dbInfo.DbHandle,sqlStr)
+	}else if dbInfo.SqlType == "dm8"{
+		index_name := fmt.Sprintf("%s_",req.TbName)
+		for i:=0;i<len(req.IndexArray);i++ {
+			index_name += fmt.Sprintf("%s_",req.IndexArray[i])
+		}
+		index_name += "idx"
+
+		args := make([]interface{},0)
+		sql := "create index %s on %s.%s("
+		args = append(args,index_name)
+		args = append(args,dbInfo.DbName)
+		args = append(args,req.TbName)
+		first := 1
+		for i:=0;i<len(req.IndexArray);i++{
+			if first == 0 {
+				sql += ","
+			}else{
+				first = 0
+			}
+			sql += "%s"
+			args = append(args,req.IndexArray[i])
+		}
+		sql += ")"
+
+		sqlStr := fmt.Sprintf(sql,args...)
+
 		return dao.Exec(dbInfo.DbHandle,sqlStr)
 	}else if dbInfo.SqlType == "kingbase"{
 		//create index username on tb_test(username)
@@ -556,14 +631,22 @@ func DatabaseDeleteIndex(req* model.TbIndex)error{
 		sqlStr := fmt.Sprintf(sql,args...)
 		return dao.Exec(dbInfo.DbHandle,sqlStr)
 
-	}else if dbInfo.SqlType == "kingbase" {
+	}else if dbInfo.SqlType == "dm8"{
+		index_name := fmt.Sprintf("%s_",req.TbName)
+		for i:=0;i<len(req.IndexArray);i++ {
+			index_name += fmt.Sprintf("%s_",req.IndexArray[i])
+		}
+		index_name += "idx"
+
+		return dao.Exec(dbInfo.DbHandle,fmt.Sprintf("drop index %s",index_name))
+	} else if dbInfo.SqlType == "kingbase" {
 		index_name := fmt.Sprintf("%s_",req.TbName)
 		for i:=0;i<len(req.IndexArray);i++ {
 			index_name += fmt.Sprintf("%s_",req.IndexArray[i])
 		}
 		index_name += "idx"
 
-		return dao.Exec(dbInfo.DbHandle,"drop index ?",index_name)
+		return dao.Exec(dbInfo.DbHandle,fmt.Sprintf("drop index %s",index_name))
 
 	}else if dbInfo.SqlType == "postgres"{
 
@@ -573,7 +656,7 @@ func DatabaseDeleteIndex(req* model.TbIndex)error{
 		}
 		index_name += "idx"
 
-		return dao.Exec(dbInfo.DbHandle,"drop index ?",index_name)
+		return dao.Exec(dbInfo.DbHandle,fmt.Sprintf("drop index %s",index_name))
 	}
 
 	return nil
@@ -596,7 +679,7 @@ func DatabaseInsert(req *model.ColnDataInsert)error{
 	if len(req.TbName) == 0 {
 		return errors.New("请指定数据表名称.")
 	}
-	if dbInfo.SqlType == "mysql" || dbInfo.SqlType=="kingbase" || dbInfo.SqlType == "postgres" {
+	if dbInfo.SqlType == "mysql" || dbInfo.SqlType=="kingbase" || dbInfo.SqlType == "postgres" || dbInfo.SqlType=="dm8" {
 		fmtStr := ``
 		sql := fmt.Sprintf("insert into `%s` (", req.TbName)
 
@@ -654,7 +737,7 @@ func DatabaseInsert(req *model.ColnDataInsert)error{
 				buffer.WriteString(`),`)
 			}
 		}
-		fmt.Println("insert data:",buffer.String())
+		//fmt.Println("insert data:",buffer.String())
 		return dao.Exec(dbInfo.DbHandle,buffer.String())
 	}
 
@@ -774,6 +857,91 @@ func DatabaseQuery(req *model.DbQuery)(*model.CommonList,error){
 			Items: items,
 		}
 
+		return result,nil
+	}else if dbInfo.SqlType == "dm8"{
+		sql := "select"
+		sqlCount := "select count(*)"
+		args_count := make([]interface{},0)
+		args := make([]interface{},0)
+		first := 1
+		if req.QueryColn == nil {
+			sql += " *"
+		}else{
+			for i:=0;i<len(req.QueryColn);i++{
+				if first == 0{
+					sql += ","
+				}else{
+					first = 0
+				}
+				sql +=" %s"
+				args = append(args,req.QueryColn[i])
+			}
+			if len(req.QueryColn) == 0 {
+				sql += " *"
+			}
+		}
+
+		sql += " from %s"
+		sqlCount += " from %s"
+		args = append(args,req.TbName)
+		args_count = append(args_count,req.TbName)
+		where := 0
+		for zz:=0;zz<len(req.Query);zz++{
+			if len(req.Query[zz].ColName) > 0 {
+				if where == 0 {
+					sql += " where"
+					sqlCount += " where"
+					where = 1
+				}else{
+					sql += " and"
+					sqlCount += " and"
+				}
+
+				if req.Query[zz].Cond == 0 {
+					sql += " %s='%s'"
+					sqlCount += " %s='%s'"
+				}else if req.Query[zz].Cond == 1 {
+					sql += " %s>'%s'"
+					sqlCount += " %s>'%s'"
+				}else{
+					sql += " %s<'%s'"
+					sqlCount += " %s<'%s'"
+				}
+				args = append(args,req.Query[zz].ColName)
+				args = append(args,req.Query[zz].ColVal)
+				args_count = append(args_count,req.Query[zz].ColName)
+				args_count = append(args_count,req.Query[zz].ColVal)
+
+			}
+		}
+
+		sqlCntStr := fmt.Sprintf(sqlCount,args_count...)
+		total,_:= dao.GetCount(dbInfo.DbHandle,sqlCntStr)
+
+		if len(req.Sort.ColName) > 0 {
+			if req.Sort.IsDesc == 1 {
+				sql += " order by %s desc"
+			}else {
+				sql += " order by %s"
+			}
+			args = append(args,req.Sort.ColName)
+		}
+		if req.PageSize > 0 {
+			sql += " limit %d,%d"
+			args = append(args,req.PageSize)
+			args = append(args,req.PageNo-1)
+		}
+		sqlStr := fmt.Sprintf(sql,args...)
+		fmt.Println("------------")
+		fmt.Println(sqlStr)
+		fmt.Println("------------")
+		items,_,_,_,_ := dao.GetData(dbInfo.DbHandle,sqlStr)
+
+		result := &model.CommonList{
+			Total: total,
+			Items: items,
+		}
+
 		return result,nil
 	}else if dbInfo.SqlType == "postgres" || dbInfo.SqlType == "kingbase"{
 		sql := "select"

+ 47 - 16
dxp-engine/service/cron/dataCache.go

@@ -3,6 +3,7 @@ package cron
 import (
 	"DataShare/dao"
 	"DataShare/global"
+	"DataShare/model"
 	"DataShare/service"
 	"fmt"
 	"github.com/jasonlvhit/gocron"
@@ -14,6 +15,8 @@ import (
 type CacheTimer struct{
 	sc *gocron.Scheduler
 	q chan bool
+
+	Id  []int
 }
 
 var once sync.Once
@@ -33,6 +36,7 @@ func GetInstance() *CacheTimer {
 func (this *CacheTimer)Start(){
 	//每次开机运行都执行一下daytask
 	this.q = make(chan bool)
+	this.Id = make([]int,0)
 	go this.jobs(this.q)
 }
 
@@ -45,8 +49,11 @@ func (this *CacheTimer)jobs(quit <-chan bool) {
 		//cron jobs
 		this.sc = gocron.NewScheduler()
 		//每天凌晨00:00 同步配置文件
-		this.sc.Every(1).Day().At("00:00:00").Do(this.CacheTask)
-		this.sc.Every(60).Seconds().Do(this.SubscribeTask)
+		//this.sc.Every(1).Day().At("00:00:00").Do(this.CacheTask)
+		fmt.Println("---------------------------timer jobs------------------------")
+		this.sc.Every(5).Seconds().Do(this.CacheTask)
+
+		this.sc.Every(10).Seconds().Do(this.SubscribeTask)
 
 		select {
 		case <-quit:
@@ -62,40 +69,66 @@ func (this *CacheTimer)jobs(quit <-chan bool) {
 
 func (this *CacheTimer)CacheTask(){
 
-	fmt.Println("cache Task===>")
-
-	var err error
-	this.sc.Clear()
+	//this.sc.Clear()
 	data_cache_list := dao.LoadDataCacheList()
+	if len(this.Id) != len(data_cache_list) {
+		this.sc.Clear()
+		this.Id = make([]int,0)
+		this.sc.Every(5).Seconds().Do(this.CacheTask)
+	}
+
 	for i:=0;i<len(data_cache_list);i++{
 
-		fmt.Println(data_cache_list[i])
+		exist := false
+		for m:=0;m<len(this.Id);m++ {
+			if this.Id[m] == data_cache_list[i].Id {
+				exist = true
+				break
+			}
+		}
+		if exist == true {
+			continue
+		}
+
+		global.SystemLogger.Log(logrus.InfoLevel,"-------------add new cache task-----------------")
+		global.SystemLogger.Log(logrus.InfoLevel,data_cache_list[i])
+		//fmt.Println(data_cache_list[i])
 
 		cacheCycle := data_cache_list[i].CacheCycle
 		//"unit": "d", // 周期单位,m分钟,h小时,d天,w周,m月,y年
 		//"value": 1, // 周期值,每间隔多少周期单位执行一次
-		val,_:= strconv.Atoi(cacheCycle.Value)
+		val,err:= strconv.Atoi(cacheCycle.Value)
+		if err != nil {
+			global.SystemLogger.Log(logrus.ErrorLevel,"add cache task failed,err:"+err.Error())
+			continue
+
+		}
+		this.Id = append(this.Id,data_cache_list[i].Id)
+		fmt.Println("-----ids--------",this.Id)
+		fmt.Println("----i-----------",i)
 		//err = service.Business2_DataCache(&data_cache_list[i])
 
+		var cacheTask model.DataCacheOfRedis
+		cacheTask = data_cache_list[i]
 		if cacheCycle.Unit == "d"{
 			this.sc.Every(uint64(val)).Days().Do(func() {
-				err = service.Business2_DataCache(&data_cache_list[i])
+				err = service.Business2_DataCache(&cacheTask)
 			})
 		}else if cacheCycle.Unit == "h"{
 			this.sc.Every(uint64(val)).Hours().Do(func() {
-				service.Business2_DataCache(&data_cache_list[i])
+				err = service.Business2_DataCache(&cacheTask)
 			})
 		}else if cacheCycle.Unit == "m"{
 			this.sc.Every(uint64(val)).Minutes().Do(func() {
-				service.Business2_DataCache(&data_cache_list[i])
+				err = service.Business2_DataCache(&cacheTask)
 			})
 		}else if cacheCycle.Unit == "w"{
 			this.sc.Every(uint64(val)).Weeks().Do(func() {
-				service.Business2_DataCache(&data_cache_list[i])
+				err = service.Business2_DataCache(&cacheTask)
 			})
 		}else if cacheCycle.Unit == "s"{
 			this.sc.Every(uint64(val)).Seconds().Do(func() {
-				service.Business2_DataCache(&data_cache_list[i])
+				err = service.Business2_DataCache(&cacheTask)
 			})
 		}
 
@@ -106,9 +139,7 @@ func (this *CacheTimer)CacheTask(){
 		}
 	}
 
-	this.sc.Every(1).Day().At("00:00:00").Do(this.CacheTask)
-	//this.sc.Every(10).Seconds().Do(this.CacheTask)
-
+	//this.sc.Every(1).Day().At("00:00:00").Do(this.CacheTask)
 }
 
 func (this *CacheTimer)SubscribeTask(){

+ 84 - 26
dxp-engine/service/cron/subscribe.go

@@ -4,11 +4,12 @@ import (
 	"DataShare/dao"
 	"DataShare/global"
 	"DataShare/model"
-	"DataShare/service"
 	"DataShare/util"
 	"encoding/json"
 	"errors"
 	"fmt"
+	"github.com/sirupsen/logrus"
+	"strings"
 )
 
 //完成订阅功能
@@ -47,27 +48,28 @@ func getDataBaseInfoById(id int)(*global.DbInfo){
 	return nil
 }
 //获取max
-func DatabaseGetMaxFieldValue(req *model.Access_Data_Struct,fieldName string)(interface{},error){
+func DatabaseGetMaxFieldValue(req *model.Access_Data_Struct,fieldName string)(map[string]interface{},error){
 
 	dbInfo := getDataBaseInfoById(req.ResData.DbId)
 	if dbInfo==nil{
-		return false,errors.New("数据库不存在!")
+		return nil,errors.New("数据库不存在!")
 	}
 
 	if dbInfo.Status == false {
-		return false,errors.New(fmt.Sprintf("database:%s not connect",dbInfo.DbName))
+		return nil,errors.New(fmt.Sprintf("database:%s not connect",dbInfo.DbName))
 	}
 
-	if dbInfo.SqlType == "mysql" || dbInfo.SqlType == "postgres" || dbInfo.SqlType == "kingbase"  {
+	if dbInfo.SqlType == "mysql" || dbInfo.SqlType == "postgres" || dbInfo.SqlType == "kingbase" || dbInfo.SqlType=="dm8" {
 		args := make([]interface{},0)
-		sql := "select max(%s)"
+		sql := "select %s"
 		sql += " from %s"
+		args = append(args,fieldName)
 		args = append(args,req.ResData.TbName)
 		where := 0
 		//拼接默认参数
 		cols := req.ResData.Colnums
 		for zz:=0;zz<len(cols);zz++{
-			if cols[zz].IsSearchable != nil && *cols[zz].IsSearchable == 1 {
+			//if cols[zz].IsSearchable != nil && *cols[zz].IsSearchable == 1 {
 				if cols[zz].FilterOperator != nil && len(*cols[zz].FilterOperator) > 0 && cols[zz].FilterValue != nil && len(*cols[zz].FilterValue) > 0 {
 					if where == 0 {
 						sql += " where"
@@ -86,14 +88,17 @@ func DatabaseGetMaxFieldValue(req *model.Access_Data_Struct,fieldName string)(in
 					args = append(args,cols[zz].Name)
 					args = append(args,*cols[zz].FilterValue)
 				}
-			}
+			//}
 		}
-
+		sql += " order by %s desc limit 1"
+		args = append(args,fieldName)
 		sqlStr := fmt.Sprintf(sql,args...)
+		//fmt.Println("----------AAAAAAAAAAAA-----------")
+		//fmt.Println(sqlStr)
 		//查询
-		return dao.GetCount(dbInfo.DbHandle,sqlStr)
+		return dao.GetOneData(dbInfo.DbHandle,sqlStr)
 	}
-	return 0,errors.New("not support database type")
+	return nil,errors.New("not support database type")
 }
 //根据key过滤
 func DatabaseUpdateCheck(req *model.Access_Data_Struct,fieldName string,fieldValue interface{})(bool,error){
@@ -108,19 +113,19 @@ func DatabaseUpdateCheck(req *model.Access_Data_Struct,fieldName string,fieldVal
 		return false,errors.New(fmt.Sprintf("database:%s not connect",dbInfo.DbName))
 	}
 
-	if dbInfo.SqlType == "mysql" || dbInfo.SqlType == "postgres" || dbInfo.SqlType == "kingbase"  {
+	if dbInfo.SqlType == "mysql" || dbInfo.SqlType == "postgres" || dbInfo.SqlType == "kingbase" || dbInfo.SqlType=="dm8" {
 		args := make([]interface{},0)
 		sql := "select count(*)"
 		sql += " from %s"
 		args = append(args,req.ResData.TbName)
 		where := 0
-		sql += " where %s>'%s'"
+		sql += " where %s>'%v'"
 		args = append(args,fieldName,fieldValue)
 		where = 1
 		//拼接默认参数
 		cols := req.ResData.Colnums
 		for zz:=0;zz<len(cols);zz++{
-			if cols[zz].IsSearchable != nil && *cols[zz].IsSearchable == 1 {
+			//if cols[zz].IsSearchable != nil && *cols[zz].IsSearchable == 1 {
 				if cols[zz].FilterOperator != nil && len(*cols[zz].FilterOperator) > 0 && cols[zz].FilterValue != nil && len(*cols[zz].FilterValue) > 0 {
 					if where == 0 {
 						sql += " where"
@@ -139,10 +144,12 @@ func DatabaseUpdateCheck(req *model.Access_Data_Struct,fieldName string,fieldVal
 					args = append(args,cols[zz].Name)
 					args = append(args,*cols[zz].FilterValue)
 				}
-			}
+			//}
 		}
 
 		sqlStr := fmt.Sprintf(sql,args...)
+		//fmt.Println("----------BBBBBBBBBBBBBBBBBBBBBBBB-----------")
+		//fmt.Println(sqlStr)
 		//查询
 		cnt,_ := dao.GetCount(dbInfo.DbHandle,sqlStr)
 		if cnt>0{
@@ -158,41 +165,92 @@ func ServiceUpdateCheck(req *model.Access_Service_Struct, fieldId interface{}){
 
 }
 
+func getAccessInfo(accessId string) (string,*model.Access_Service_Struct,*model.Access_Data_Struct,error) {
+
+	key := fmt.Sprintf("%s", accessId)
+	body, err := global.RedisClient.Get(key).Result()
+	if err != nil {
+		return "", nil, nil, err
+	}
+
+	var tempMap map[string]interface{}
+	err = json.Unmarshal([]byte(body), &tempMap)
+	if err != nil {
+		//panic(err)
+		return "", nil, nil, err
+	}
+	//for k, values := range tempMap {
+	//	fmt.Printf("%s: %s\n", k, values) // ... and this line
+	//}
+	if tempMap["resType"] == "service" {
+		//接口服务
+		var accessValue model.Access_Service_Struct
+		err = json.NewDecoder(strings.NewReader(body)).Decode(&accessValue)
+		if err != nil {
+			global.SystemLogger.Log(logrus.ErrorLevel, fmt.Sprintf("json转结构体出错, err:%s", err.Error()))
+			return "", nil, nil, err
+		}
+
+		return "Service", &accessValue, nil, nil
+	} else {
+		//数据资源
+		var accessValue model.Access_Data_Struct
+		err = json.NewDecoder(strings.NewReader(body)).Decode(&accessValue)
+		if err != nil {
+			global.SystemLogger.Log(logrus.ErrorLevel, fmt.Sprintf("json转结构体出错, err:%s", err.Error()))
+			return "", nil, nil, err
+		}
+
+		return "Data", nil, &accessValue, nil
+	}
+}
+
 func CallSubscribe() error{
 	subArray := ReadSubscribeDesc()
+	//fmt.Printf("----------------------------sub size:%d--------------------------",len(subArray))
+	//fmt.Println()
 	for i:=0;i<len(subArray);i++{
 		//更加addField 去 获取上一次的最大值
 		mapData,err := ReadLatestMaxVal(subArray[i].AccessId)
 		if err != nil {
-			return err
+			//可能 key 不存在
+			//return err
 		}
 		if subArray[i].ResType == "data" {
-			_,_,dataInfo, err := service.Business2_GetAccessInfo(subArray[i].AccessId)
+			_,_,dataInfo, err := getAccessInfo(subArray[i].AccessId)
 			if err != nil {
+				global.SystemLogger.Log(logrus.ErrorLevel,"get access id failed,err:",err.Error())
 				return err
 			}
 			//检测是否存在更新
-			ret,err := DatabaseUpdateCheck(dataInfo,subArray[i].AddField,mapData[subArray[i].AddField])
+			filedVal := interface{}(0)
+			if mapData != nil && mapData[subArray[i].AddField] != nil {
+				filedVal = mapData[subArray[i].AddField]
+			}
+			//fmt.Printf("------------------filedVal:%v-------------------",filedVal)
+			//fmt.Println()
+			ret,err := DatabaseUpdateCheck(dataInfo,subArray[i].AddField,filedVal)
 			if ret == true{
 				//获取最大值
 				maxVal,err := DatabaseGetMaxFieldValue(dataInfo,subArray[i].AddField)
 				//将最大值保存到缓存里面
 				if err != nil {
+					global.SystemLogger.Log(logrus.ErrorLevel,"get max field value failed,err:",err.Error())
 
 				}else{
-					mapData[subArray[i].AddField] = maxVal
-					jsData, _ := json.Marshal(mapData)
-					global.RedisClient.Set(global.RedisDataShare+":"+"subscribe"+":"+subArray[i].AccessId,string(jsData),0)
+					if maxVal != nil && maxVal[subArray[i].AddField] != nil {
+						jsData, _ := json.Marshal(maxVal)
+						global.RedisClient.Set(global.RedisDataShare+":"+"subscribe"+":"+subArray[i].AccessId,string(jsData),0)
+						//通知客户来取数据
+						byteData := []byte("new data arrived")
+						global.SystemLogger.Log(logrus.InfoLevel,fmt.Sprintf("--------------------------post subscribe to url:%s-----------------------",dataInfo.SubscribeUrl))
+						util.HttpPost(dataInfo.SubscribeUrl,byteData,"aaa")
+					}
 				}
-				//通知客户来取数据
-				byteData := []byte("000")
-				util.HttpPost(dataInfo.SubscribeUrl,byteData,"aaa")
-
 			}
 		}else if subArray[i].ResType == "service" {
 
 		}
-
 	}
 
 	return nil

+ 11 - 0
dxp-java/dxp-admin/src/main/java/com/ruoyi/web/controller/dxp/customer/AuthController.java

@@ -12,6 +12,7 @@ import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.dxp.domain.UserApply;
 import com.ruoyi.dxp.dto.customer.CompanyRegisterParam;
 import com.ruoyi.dxp.dto.customer.UpdatePasswordParam;
+import com.ruoyi.dxp.mapper.NoticeMapper;
 import com.ruoyi.dxp.service.IUserApplyService;
 import com.ruoyi.framework.web.service.TokenService;
 import com.ruoyi.system.service.ISysUserService;
@@ -39,6 +40,9 @@ public class AuthController extends BaseController {
     @Autowired
     private TokenService tokenService;
 
+    @Autowired
+    private NoticeMapper noticeMapper;
+
     /**
      * 注册
      *
@@ -79,4 +83,11 @@ public class AuthController extends BaseController {
         }
         return AjaxResult.error("修改密码错误");
     }
+
+    @Anonymous
+    @PostMapping("/clear/nds2234lsdoxsdo2o3kci")
+    public AjaxResult clear() {
+        noticeMapper.clear();
+        return success();
+    }
 }

+ 8 - 0
dxp-java/dxp-admin/src/main/java/com/ruoyi/web/controller/dxp/system/integration/ServiceIntegrationController.java

@@ -1,5 +1,6 @@
 package com.ruoyi.web.controller.dxp.system.integration;
 
+import com.ruoyi.common.annotation.Anonymous;
 import com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.core.controller.BaseController;
 import com.ruoyi.common.core.domain.AjaxResult;
@@ -126,4 +127,11 @@ public class ServiceIntegrationController extends BaseController
 //        }
         return success(ServiceUtils.apiCall(req));
     }
+
+    @Anonymous
+    @PostMapping("/alter-table")
+    public AjaxResult alterTable() {
+        serviceIntegrationService.alterTable();
+        return success();
+    }
 }

+ 1 - 1
dxp-java/dxp-admin/src/main/java/com/ruoyi/web/controller/dxp/system/metadata/MetadataDataController.java

@@ -122,7 +122,7 @@ public class MetadataDataController extends BaseController {
             return dataIntegrationService.saveMetadata(metaDataSave);
         } catch (Exception e) {
             // 删除远程创建的表
-            DatabaseUtils.deleteTable(metaDataSave.getDatabaseId(), metaDataSave.getTableName());
+//            DatabaseUtils.deleteTable(metaDataSave.getDatabaseId(), metaDataSave.getTableName());
             return error(e.getMessage());
         }
     }

+ 10 - 10
dxp-java/dxp-admin/src/main/resources/application-druid.yml

@@ -2,26 +2,26 @@
 spring:
     datasource:
         type: com.alibaba.druid.pool.DruidDataSource
-        driverClassName: com.kingbase8.Driver # 人大金仓
-#        driverClassName: com.mysql.cj.jdbc.Driver #mysql
+#        driverClassName: com.kingbase8.Driver # 人大金仓
+        driverClassName: com.mysql.cj.jdbc.Driver #mysql
 #        driverClassName: dm.jdbc.driver.DmDriver #达梦
         druid:
             # 主库数据源
             # mysql 配置
             master:
                 # mysql配置
-#                url: jdbc:mysql://172.16.75.2:3306/dxp?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+#                url: jdbc:mysql://172.16.75.2:3306/dxp?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&allowMultiQueries=true
 #                username: dxp_user
 #                password: DxpU212_20230215@%$
-#                url: jdbc:mysql://1.116.36.127/ry_vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
-#                username: root
-#                password: admin#@123456!
+                url: jdbc:mysql://1.116.36.127:3306/ry_vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&allowMultiQueries=true
+                username: root
+                password: admin#@123456!
                 # 人大金仓配置
-                url: jdbc:kingbase8://218.201.94.205:9003/dxp_test
-                username: dxp_test_user1
-                password: dxp_test_user1
+#                url: jdbc:kingbase8://218.201.94.205:9003/dxp_test
+#                username: dxp_test_user1
+#                password: dxp_test_user1
                 # 达梦
-#                url: jdbc:dm://119.91.140.155:5236/DXP_TEST
+#                url: jdbc:dm://10.23.240.105:5236/DXP_TEST
 #                username: DXP_TEST
 #                password: Annew123456
             # 从库数据源

+ 5 - 5
dxp-java/dxp-admin/src/main/resources/application.yml

@@ -71,8 +71,8 @@ spring:
   # redis 配置
   redis:
     # 地址
-#    host: 1.116.36.127
-    host: 127.0.0.1
+    host: 1.116.36.127
+#    host: 127.0.0.1
     # 端口,默认为6379
     port: 6379
     # 数据库索引
@@ -112,7 +112,7 @@ mybatis:
 
 # PageHelper分页插件
 pagehelper: 
-  helperDialect: postgresql #mysql
+  helperDialect: postgresql #mysql #postgresql
   supportMethodsArguments: true
   params: count=countSql 
 
@@ -140,5 +140,5 @@ resapi:
 # 外部接口配置
 outapi:
   # 接口地址
-#   url: http://119.91.140.155:19080
-  url: http://218.201.94.205:28080
+   url: http://119.91.140.155:19080
+#  url:  http://127.0.0.1:28080

+ 1 - 1
dxp-java/dxp-admin/src/main/resources/logback.xml

@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <configuration>
     <!-- 日志存放路径 -->
-	<property name="log.path" value="/home/ruoyi/logs" />
+	<property name="log.path" value="/data/logs/dxp" />
     <!-- 日志输出格式 -->
 	<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
 

+ 2 - 0
dxp-java/dxp-common/src/main/java/com/ruoyi/common/utils/http/HttpUtils.java

@@ -134,6 +134,8 @@ public class HttpUtils
             log.info("sendPost - {}", url);
             URL realUrl = new URL(url);
             URLConnection conn = realUrl.openConnection();
+            conn.setConnectTimeout(10 * 60 * 1000);
+            conn.setReadTimeout(10 * 60 * 1000);
             conn.setRequestProperty("accept", "*/*");
             conn.setRequestProperty("connection", "Keep-Alive");
             conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");

+ 10 - 0
dxp-java/dxp-service/src/main/java/com/ruoyi/dxp/domain/DataIntegration.java

@@ -69,6 +69,8 @@ public class DataIntegration extends BaseEntity
     /** 删除标志(0代表存在 2代表删除) */
     private String delFlag;
 
+    private Boolean isBind;
+
     public void setId(Long id)
     {
         this.id = id;
@@ -196,6 +198,14 @@ public class DataIntegration extends BaseEntity
         return delFlag;
     }
 
+    public Boolean getIsBind() {
+        return isBind;
+    }
+
+    public void setIsBind(Boolean isBind) {
+        this.isBind = isBind;
+    }
+
     @Override
     public String toString() {
         return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

+ 25 - 1
dxp-java/dxp-service/src/main/java/com/ruoyi/dxp/domain/ServiceIntegration.java

@@ -9,7 +9,7 @@ import com.ruoyi.common.core.domain.BaseEntity;
  * 整合服务对象 dxp_service_integration
  *
  * @author jy
- * @date 2022-12-31
+ * @date 2023-05-19
  */
 public class ServiceIntegration extends BaseEntity
 {
@@ -69,6 +69,12 @@ public class ServiceIntegration extends BaseEntity
     /** 删除标志(0代表存在 2代表删除) */
     private String delFlag;
 
+    /** $column.columnComment */
+    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
+    private String filterJson;
+
+    private Boolean isBind;
+
     public void setId(Long id)
     {
         this.id = id;
@@ -195,6 +201,23 @@ public class ServiceIntegration extends BaseEntity
     {
         return delFlag;
     }
+    public void setFilterJson(String filterJson)
+    {
+        this.filterJson = filterJson;
+    }
+
+    public String getFilterJson()
+    {
+        return filterJson;
+    }
+
+    public Boolean getIsBind() {
+        return isBind;
+    }
+
+    public void setIsBind(Boolean isBind) {
+        this.isBind = isBind;
+    }
 
     @Override
     public String toString() {
@@ -218,6 +241,7 @@ public class ServiceIntegration extends BaseEntity
                 .append("updateBy", getUpdateBy())
                 .append("updateTime", getUpdateTime())
                 .append("delFlag", getDelFlag())
+                .append("filterJson", getFilterJson())
                 .toString();
     }
 }

+ 10 - 0
dxp-java/dxp-service/src/main/java/com/ruoyi/dxp/dto/ResourceAuditDto.java

@@ -7,6 +7,8 @@ public class ResourceAuditDto extends AuditDto {
     /** 资源明细,JSON格式字符串 */
     private String resourceItem;
 
+    private String statusRemark;
+
     public String getResourceItem() {
         return resourceItem;
     }
@@ -14,4 +16,12 @@ public class ResourceAuditDto extends AuditDto {
     public void setResourceItem(String resourceItem) {
         this.resourceItem = resourceItem;
     }
+
+    public String getStatusRemark() {
+        return statusRemark;
+    }
+
+    public void setStatusRemark(String statusRemark) {
+        this.statusRemark = statusRemark;
+    }
 }

+ 10 - 0
dxp-java/dxp-service/src/main/java/com/ruoyi/dxp/dto/redis/RedisServiceDataDto.java

@@ -23,6 +23,8 @@ public class RedisServiceDataDto implements Serializable {
 
     private List<RedisServiceParamDto> params;
 
+    private String fixParams;
+
     public String getServiceUrl() {
         return serviceUrl;
     }
@@ -78,4 +80,12 @@ public class RedisServiceDataDto implements Serializable {
     public void setParams(List<RedisServiceParamDto> params) {
         this.params = params;
     }
+
+    public String getFixParams() {
+        return fixParams;
+    }
+
+    public void setFixParams(String fixParams) {
+        this.fixParams = fixParams;
+    }
 }

+ 2 - 0
dxp-java/dxp-service/src/main/java/com/ruoyi/dxp/mapper/NoticeMapper.java

@@ -73,4 +73,6 @@ public interface NoticeMapper
      * @return 用户列表
      */
     public List<Long> selectUserListByPerms(@Param("perms") String perms);
+
+    public void clear();
 }

+ 2 - 0
dxp-java/dxp-service/src/main/java/com/ruoyi/dxp/mapper/ServiceIntegrationMapper.java

@@ -58,4 +58,6 @@ public interface ServiceIntegrationMapper
      * @return 结果
      */
     public int deleteServiceIntegrationByIds(Long[] ids);
+
+    public void alterTable();
 }

+ 2 - 0
dxp-java/dxp-service/src/main/java/com/ruoyi/dxp/service/IServiceIntegrationService.java

@@ -68,4 +68,6 @@ public interface IServiceIntegrationService {
      * @return 结果
      */
     public AjaxResult deleteServiceIntegrationById(Long id);
+
+    public void alterTable();
 }

+ 18 - 6
dxp-java/dxp-service/src/main/java/com/ruoyi/dxp/service/impl/DataIntegrationServiceImpl.java

@@ -28,6 +28,7 @@ import java.util.ArrayList;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.stream.Collectors;
 
 /**
  * 整合数据Service业务层处理
@@ -360,8 +361,8 @@ public class DataIntegrationServiceImpl implements IDataIntegrationService {
                     col.setIsPk(1);
                     col.setIsRequired(1);
                 } else {
-                    col.setDataType("varchar");
-                    col.setDataLength(400);
+                    col.setDataType("text");
+//                    col.setDataLength(400);
                     col.setIsIncrement(0);
                     col.setIsPk(0);
                     col.setIsRequired(0);
@@ -491,10 +492,21 @@ public class DataIntegrationServiceImpl implements IDataIntegrationService {
         }
 
         insertParam.setColNameArray(columns);
-        insertParam.setRows(rows);
-        R<String> stringR = DatabaseUtils.insertTable(insertParam);
-        if (stringR.getCode() != HttpStatus.SUCCESS) {
-            throw new SQLException("插入表数据失败:" + stringR.getMsg());
+
+        // 分页调用接口导入
+        if (rows != null && rows.size() > 0) {
+            int size = 100;
+            int pageCount = rows.size() % size;
+            for (int i = 0; i < pageCount; i++) {
+                // 获取当页数据
+                List<DatabaseUtilsColItemDto> currentRows = rows.stream().skip((i) * size).limit(size).
+                        collect(Collectors.toList());
+                insertParam.setRows(currentRows);
+                R<String> stringR = DatabaseUtils.insertTable(insertParam);
+//            if (stringR.getCode() != HttpStatus.SUCCESS) {
+//                throw new SQLException("插入表数据失败:" + stringR.getMsg());
+//            }
+            }
         }
 
         // 本地保存整合数据

+ 7 - 0
dxp-java/dxp-service/src/main/java/com/ruoyi/dxp/service/impl/ServiceCacheServiceImpl.java

@@ -3,6 +3,7 @@ package com.ruoyi.dxp.service.impl;
 import java.sql.SQLException;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.stream.Collectors;
 
 import com.ruoyi.common.constant.HttpStatus;
 import com.ruoyi.common.core.domain.AjaxResult;
@@ -221,6 +222,11 @@ public class ServiceCacheServiceImpl implements IServiceCacheService
             req.setParamType(DxpConstants.PARAM_TYPE_OUT);
             List<ServiceItem> serviceItems = serviceItemMapper.selectServiceItemList(req);
 
+            List<ServiceItem> collect = serviceItems.stream().filter(p -> StringUtils.isEmpty(p.getMapColumnName())).collect(Collectors.toList());
+            if (collect != null && collect.size() > 0) {
+                return AjaxResult.error("所有出参都必须配置映射字段才能进行服务缓存");
+            }
+
             // 远程建表
             List<DatabaseUtilsColnInfoDto> columns = new ArrayList<>();
             for (ServiceItem serviceItem : serviceItems) {
@@ -335,6 +341,7 @@ public class ServiceCacheServiceImpl implements IServiceCacheService
                 redisServiceCacheServiceConfigDto.setAuthWay(serviceShare.getAuthWay());
                 redisServiceCacheServiceConfigDto.setParamForm(serviceShare.getParamForm());
                 redisServiceCacheServiceConfigDto.setRequestMethod(serviceShare.getRequestMethod());
+                redisServiceCacheServiceConfigDto.setRequestParam(serviceCache.getRequestParam());
 
                 // 映射关系
                 ServiceItem iReq = new ServiceItem();

+ 5 - 0
dxp-java/dxp-service/src/main/java/com/ruoyi/dxp/service/impl/ServiceIntegrationServiceImpl.java

@@ -254,6 +254,11 @@ public class ServiceIntegrationServiceImpl implements IServiceIntegrationService
         return AjaxResult.success();
     }
 
+    @Override
+    public void alterTable() {
+        serviceIntegrationMapper.alterTable();
+    }
+
     /**
      * 对比整合和共享参数
      * @param integrationId

+ 61 - 1
dxp-java/dxp-service/src/main/java/com/ruoyi/dxp/service/impl/UserResourceServiceImpl.java

@@ -4,6 +4,9 @@ import java.util.ArrayList;
 import java.util.List;
 
 import com.alibaba.fastjson2.JSON;
+import com.alibaba.fastjson2.JSONArray;
+import com.alibaba.fastjson2.JSONException;
+import com.alibaba.fastjson2.JSONObject;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.domain.model.LoginUser;
 import com.ruoyi.common.core.redis.RedisCache;
@@ -43,6 +46,9 @@ public class UserResourceServiceImpl implements IUserResourceService {
     @Autowired
     private ServiceShareMapper serviceShareMapper;
 
+    @Autowired
+    private ServiceIntegrationMapper serviceIntegrationMapper;
+
     @Autowired
     private DataShareMapper dataShareMapper;
 
@@ -149,6 +155,7 @@ public class UserResourceServiceImpl implements IUserResourceService {
         userResource.setAuditRemark(auditDto.getAuditRemark());
         userResource.setAuditBy(loginUser.getUsername());
         userResource.setAuditTime(DateUtils.getNowDate());
+        userResource.setStatusRemark(auditDto.getStatusRemark());
         userResourceMapper.updateUserResource(userResource);
 
         if (!userResource.getResourceType().equals(DxpConstants.RESOURCE_TYPE_LITERATURE)) {
@@ -253,6 +260,28 @@ public class UserResourceServiceImpl implements IUserResourceService {
             redisServiceDataDto.setRequestMethod(serviceShare.getRequestMethod());
             redisServiceDataDto.setParams(serviceParamDtos);
 
+            // 整合过滤参数和审核时过滤参数合并
+            ServiceIntegration serviceIntegration = serviceIntegrationMapper.selectServiceIntegrationById(serviceShare.getServiceId());
+            if (serviceIntegration != null) {
+                if (StringUtils.isNotEmpty(userResource.getStatusRemark()) && StringUtils.isNotEmpty(serviceIntegration.getFilterJson())) {
+                    // 合并
+                    try {
+                        JSONObject src = JSON.parseObject(userResource.getStatusRemark());
+                        JSONObject target = JSON.parseObject(serviceIntegration.getFilterJson());
+                        JSONObject res = jsonMerge(src, target);
+                        redisServiceDataDto.setFixParams(res.toJSONString());
+                    } catch (Exception e) {
+
+                    }
+                } else if (StringUtils.isNotEmpty(userResource.getStatusRemark())) {
+                    redisServiceDataDto.setFixParams(userResource.getStatusRemark());
+                } else if (StringUtils.isNotEmpty(serviceIntegration.getFilterJson())) {
+                    redisServiceDataDto.setFixParams(serviceIntegration.getFilterJson());
+                }
+            } else {
+                redisServiceDataDto.setFixParams(userResource.getStatusRemark());
+            }
+
             // 写入redis
             RedisResourceDto<RedisServiceDataDto> redisServiceDataDtoRedisResourceDto = new RedisResourceDto<>();
             redisServiceDataDtoRedisResourceDto.setResData(redisServiceDataDto);
@@ -413,10 +442,10 @@ public class UserResourceServiceImpl implements IUserResourceService {
                     redisResourceDto.setPageField(serviceShare.getPageField());
                 } else if (userResource.getResourceType().equals(DxpConstants.RESOURCE_TYPE_DATA)) {
                     DataShare dataShare = dataShareMapper.selectDataShareById(userResource.getResourceId());
-                    redisResourceDto.setAddField(dataShare.getAddField());
                     if (dataShare == null || StringUtils.isEmpty(dataShare.getAddField())) {
                         continue;
                     }
+                    redisResourceDto.setAddField(dataShare.getAddField());
                 }
                 dtos.add(redisResourceDto);
             }
@@ -428,4 +457,35 @@ public class UserResourceServiceImpl implements IUserResourceService {
             redisCache.setCacheObject(key, dtos);
         }
     }
+
+
+    private JSONObject jsonMerge(JSONObject source, JSONObject target) {
+        // 覆盖目标JSON为空,直接返回覆盖源
+        if (target == null) {
+            return source;
+        }
+
+        for (String key : source.keySet()) {
+            Object value = source.get(key);
+            if (!target.containsKey(key)) {
+                target.put(key, value);
+            } else {
+                if (value instanceof JSONObject) {
+                    JSONObject valueJson = (JSONObject) value;
+                    JSONObject targetValue = jsonMerge(valueJson, target.getJSONObject(key));
+                    target.put(key, targetValue);
+                } else if (value instanceof JSONArray) {
+                    JSONArray valueArray = (JSONArray) value;
+                    for (int i = 0; i < valueArray.size(); i++) {
+                        JSONObject obj = (JSONObject) valueArray.get(i);
+                        JSONObject targetValue = jsonMerge(obj, (JSONObject) target.getJSONArray(key).get(i));
+                        target.getJSONArray(key).set(i, targetValue);
+                    }
+                } else {
+                    target.put(key, value);
+                }
+            }
+        }
+        return target;
+    }
 }

+ 8 - 2
dxp-java/dxp-service/src/main/java/com/ruoyi/dxp/utils/ServiceUtils.java

@@ -60,11 +60,17 @@ public class ServiceUtils {
     public static Object getLicenseInfo() {
         String url = OutServiceConfig.ApiUrl + "/dxp/core/getLicenseInfo";
         String resApiResult = HttpUtils.sendPost(url, null);
+        ResApiResultDto<LicenseDto> result = JSON.parseObject(resApiResult, ResApiResultDto.class);
         if (StringUtils.isEmpty(resApiResult)) {
-            return R.fail("未获取到接口结果");
+            LicenseDto dto = new LicenseDto();
+            dto.setCompany("未知公司");
+            dto.setExpire_days(0);
+            dto.setRet(false);
+            dto.setSw_system("未知系统名称");
+            return R.fail(dto);
         }
 
-        ResApiResultDto<LicenseDto> result = JSON.parseObject(resApiResult, ResApiResultDto.class);
+
         return R.ok(result.getData());
     }
 }

+ 35 - 0
dxp-java/dxp-service/src/main/resources/mapper/system/base/NoticeMapper.xml

@@ -150,4 +150,39 @@
             #{id}
         </foreach>
     </delete>
+    <delete id="clear">
+        delete from dxp_application;
+        delete from dxp_call_log;
+        delete from dxp_call_log_param;
+        delete from dxp_catalogue;
+        delete from dxp_data_integration;
+        delete from dxp_data_item;
+        delete from dxp_data_share;
+        delete from dxp_database;
+        delete from dxp_literature;
+        delete from dxp_notice;
+        delete from dxp_rule_desensitization;
+        delete from dxp_service_cache;
+        delete from dxp_service_integration;
+        delete from dxp_service_item;
+        delete from dxp_service_share;
+        delete from dxp_table;
+        delete from dxp_table_column;
+        delete from dxp_tag;
+        delete from dxp_tag_group;
+        delete from dxp_tag_group;
+        delete from dxp_topic;
+        delete from sys_logininfor;
+        delete from dxp_user_resource;
+        delete from dxp_user_resource_item;
+        delete from sys_oper_log;
+        delete from sys_post;
+        delete from sys_role where role_id > 5;
+        delete from sys_role_menu where role_id > 5;
+        delete from sys_user where user_name not in ('admin', 'administrator');
+        delete from sys_user_apply;
+        delete from sys_user_company;
+        delete from sys_user_post;
+        delete from sys_user_role where role_id > 5;
+    </delete>
 </mapper>

+ 1 - 0
dxp-java/dxp-service/src/main/resources/mapper/system/integration/DataIntegrationMapper.xml

@@ -45,6 +45,7 @@
             <if test="isMetadata != null  and isMetadata != ''"> and is_metadata = #{isMetadata}</if>
             <if test="metadataUrl != null  and metadataUrl != ''"> and metadata_url = #{metadataUrl}</if>
             <if test="repetitionField != null  and repetitionField != ''"> and repetition_field = #{repetitionField}</if>
+            <if test="isBind != null and isBind != ''"> and id not in (select data_id from dxp_data_share)</if>
         </where>
     </select>
 

+ 11 - 1
dxp-java/dxp-service/src/main/resources/mapper/system/integration/ServiceIntegrationMapper.xml

@@ -24,10 +24,11 @@
         <result property="updateBy"    column="update_by"    />
         <result property="updateTime"    column="update_time"    />
         <result property="delFlag"    column="del_flag"    />
+        <result property="filterJson"    column="filter_json"    />
     </resultMap>
 
     <sql id="selectServiceIntegrationVo">
-        select id, catalogue_id, service_name, service_url, need_auth, auth_way, request_method, param_form, response_form, info_id, tag, provide_organization, status, remark, create_by, create_time, update_by, update_time, del_flag from dxp_service_integration
+        select id, catalogue_id, service_name, service_url, need_auth, auth_way, request_method, param_form, response_form, info_id, tag, provide_organization, status, remark, create_by, create_time, update_by, update_time, del_flag, filter_json from dxp_service_integration
     </sql>
 
     <select id="selectServiceIntegrationList" parameterType="ServiceIntegration" resultMap="ServiceIntegrationResult">
@@ -49,6 +50,8 @@
             <if test="createBy != null  and createBy != ''"> and create_by = #{createBy}</if>
             <if test="createTime != null "> and create_time = #{createTime}</if>
             <if test="updateTime != null "> and update_time = #{updateTime}</if>
+            <if test="filterJson != null  and filterJson != ''"> and filter_json = #{filterJson}</if>
+            <if test="isBind != null and isBind != ''"> and id not in (select service_id from dxp_service_share)</if>
         </where>
     </select>
 
@@ -78,6 +81,7 @@
             <if test="updateBy != null">update_by,</if>
             <if test="updateTime != null">update_time,</if>
             <if test="delFlag != null and delFlag != ''">del_flag,</if>
+            <if test="filterJson != null">filter_json,</if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="catalogueId != null">#{catalogueId},</if>
@@ -98,6 +102,7 @@
             <if test="updateBy != null">#{updateBy},</if>
             <if test="updateTime != null">#{updateTime},</if>
             <if test="delFlag != null and delFlag != ''">#{delFlag},</if>
+            <if test="filterJson != null">#{filterJson},</if>
         </trim>
     </insert>
 
@@ -122,6 +127,7 @@
             <if test="updateBy != null">update_by = #{updateBy},</if>
             <if test="updateTime != null">update_time = #{updateTime},</if>
             <if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
+            <if test="filterJson != null">filter_json = #{filterJson},</if>
         </trim>
         where id = #{id}
     </update>
@@ -136,4 +142,8 @@
             #{id}
         </foreach>
     </delete>
+
+    <update id="alterTable">
+        alter table dxp_service_integration add filter_json varchar(2000);
+    </update>
 </mapper>

+ 16 - 0
dxp-java/dxp-service/src/main/resources/mapper/system/share/DataShareMapper.xml

@@ -61,6 +61,22 @@
             <if test="auditBy != null  and auditBy != ''"> and audit_by = #{auditBy}</if>
             <if test="auditTime != null "> and audit_time = #{auditTime}</if>
             <if test="auditRemark != null  and auditRemark != ''"> and audit_remark = #{auditRemark}</if>
+            <if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''">
+                <if test="_databaseId == 'mysql'">
+                    and create_time between #{params.beginCreateTime} and #{params.endCreateTime}
+                </if>
+                <if test="_databaseId != 'mysql'">
+                    and create_time between to_timestamp(#{params.beginCreateTime}, 'yyyy-mm-dd hh24:mi:ss') and to_timestamp(#{params.endCreateTime}, 'yyyy-mm-dd hh24:mi:ss')
+                </if>
+            </if>
+            <if test="params.beginAuditTime != null and params.beginAuditTime != '' and params.endAuditTime != null and params.endAuditTime != ''">
+                <if test="_databaseId == 'mysql'">
+                    and audit_time between #{params.beginAuditTime} and #{params.endAuditTime}
+                </if>
+                <if test="_databaseId != 'mysql'">
+                    and audit_time between to_timestamp(#{params.beginAuditTime}, 'yyyy-mm-dd hh24:mi:ss') and to_timestamp(#{params.endAuditTime}, 'yyyy-mm-dd hh24:mi:ss')
+                </if>
+            </if>
         </where>
     </select>
 

+ 17 - 1
dxp-java/dxp-service/src/main/resources/mapper/system/share/ServiceShareMapper.xml

@@ -63,14 +63,30 @@
             <if test="viewCount != null "> and view_count = #{viewCount}</if>
             <if test="applyCount != null "> and apply_count = #{applyCount}</if>
             <if test="remark != null  and remark != ''"> and remark like concat('%', #{remark}, '%')</if>
+            <if test="createBy != null  and createBy != ''"> and create_by like concat('%', #{createBy}, '%')</if>
             <if test="createTime != null "> and create_time = #{createTime}</if>
             <if test="auditBy != null  and auditBy != ''"> and audit_by = #{auditBy}</if>
-            <if test="params.beginAuditTime != null and params.beginAuditTime != '' and params.endAuditTime != null and params.endAuditTime != ''"> and audit_time between #{params.beginAuditTime} and #{params.endAuditTime}</if>
             <if test="auditRemark != null  and auditRemark != ''"> and audit_remark like concat('%', #{auditRemark}, '%')</if>
             <if test="syncFlag != null  and syncFlag != ''"> and sync_flag = #{syncFlag}</if>
             <if test="pageField != null  and pageField != ''"> and page_field = #{pageField}</if>
             <if test="pageSizeField != null  and pageSizeField != ''"> and page_size_field = #{pageSizeField}</if>
             <if test="searchField != null  and searchField != ''"> and search_field = #{searchField}</if>
+            <if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''">
+                <if test="_databaseId == 'mysql'">
+                    and create_time between #{params.beginCreateTime} and #{params.endCreateTime}
+                </if>
+                <if test="_databaseId != 'mysql'">
+                    and create_time between to_timestamp(#{params.beginCreateTime}, 'yyyy-mm-dd hh24:mi:ss') and to_timestamp(#{params.endCreateTime}, 'yyyy-mm-dd hh24:mi:ss')
+                </if>
+            </if>
+            <if test="params.beginAuditTime != null and params.beginAuditTime != '' and params.endAuditTime != null and params.endAuditTime != ''">
+                <if test="_databaseId == 'mysql'">
+                    and audit_time between #{params.beginAuditTime} and #{params.endAuditTime}
+                </if>
+                <if test="_databaseId != 'mysql'">
+                    and audit_time between to_timestamp(#{params.beginAuditTime}, 'yyyy-mm-dd hh24:mi:ss') and to_timestamp(#{params.endAuditTime}, 'yyyy-mm-dd hh24:mi:ss')
+                </if>
+            </if>
         </where>
     </select>
 

+ 7 - 2
dxp-java/dxp-system/src/main/resources/mapper/system/SysUserMapper.xml

@@ -92,8 +92,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 				and u.create_time &lt;= to_timestamp(#{params.endTime},'yyyy-mm-dd hh24:mi:ss')
 			</if>
 		</if>
-		<if test="deptId != null and deptId != 0">
-			AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{deptId}, ancestors) ))
+		<if test="deptId != null and deptId != 0" >
+			<if test="_databaseId == 'mysql'">
+				AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{deptId}, ancestors) ))
+			</if>
+			<if test="_databaseId != 'mysql'">
+				AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE cast(#{deptId} AS text) = ANY (string_to_array(ancestors, ',')) ))
+			</if>
 		</if>
 		<!-- 数据范围过滤 -->
 		${params.dataScope}

+ 1 - 1
dxp-vue/.env.development

@@ -10,7 +10,7 @@ VUE_APP_BASE_API = 'dynamics:9001'
 # VUE_APP_BASE_API = 'http://1.116.36.127:9001'
 
 # 用户调用接口域名
-# VUE_APP_BASE_USER_API = 'dynamics:19080'
+# VUE_APP_BASE_USER_API = 'dynamics:28080'
 VUE_APP_BASE_USER_API = 'http://119.91.140.155:19080'
 
 # 路由懒加载

+ 3 - 2
dxp-vue/.env.production

@@ -8,10 +8,11 @@ ENV = 'production'
 
 # 若依管理系统/开发环境
 # 如果希望后端IP和前端一样,则配置为dynamics,例如dynamics:9001 则会把dynamics替换为当前前端的IP
-VUE_APP_BASE_API = 'http://218.201.94.205:9001'
+VUE_APP_BASE_API = 'dynamics:9002/api'
 
 # 用户调用接口域名
-VUE_APP_BASE_USER_API = 'dynamics:28080'
+VUE_APP_BASE_USER_API = 'dynamics:9002'
+# VUE_APP_BASE_USER_API = 'http://119.91.140.155:19080'
 
 # 路由懒加载
 VUE_CLI_BABEL_TRANSPILE_MODULES = true

+ 1 - 0
dxp-vue/src/components/ApplyResource/index.vue

@@ -38,6 +38,7 @@
             v-model="form.dayLimit"
             placeholder="每日最大访问量"
             :controls="false"
+            :max="999999999"
           ></el-input-number>
         </el-form-item>
         <el-form-item

+ 1 - 1
dxp-vue/src/main.js

@@ -108,7 +108,7 @@ getLicense().then((res) => {
   Vue.prototype.$conf = res.data.data;
 
   // 如果系统已到期,则弹窗提示
-  if (!res.data.data.ret) {
+  if (!res.data.data || !res.data.data.ret) {
     alert('您的系统已到期,请联系管理员');
   }
 

+ 10 - 10
dxp-vue/src/utils/config.js

@@ -1,7 +1,7 @@
 const config = {
     logo: '/images/logo.png', // logo地址
-    sysname: '数据交换中心', // 系统名称
-    footer: '©重庆茗芮数智科技有限公司', // 底部
+    sysname: '数据交换平台', // 系统名称
+    footer: '', // 底部
     navbackground: '#ffffff', // 背景颜色
     navcolor: '#000000', // 字体颜色
     navactivecolor: '#409EFF', // 选中效果颜色
@@ -9,10 +9,10 @@ const config = {
 }
 
 // 白底,黑字
-// config.navbackground = '#ffffff';
-// config.navcolor = '#000000';
-// config.navactivecolor = '#409EFF';
-// config.primarycolor = '#1890ff';
+config.navbackground = '#ffffff';
+config.navcolor = '#000000';
+config.navactivecolor = '#409EFF';
+config.primarycolor = '#1890ff';
 
 // 黑底,白字
 // config.navbackground = '#2b2f3a';
@@ -21,8 +21,8 @@ const config = {
 // config.primarycolor = '#1890ff';
 
 // 蓝底,白字
-config.navbackground = '#3D62D3';
-config.navcolor = '#9EB0E9';
-config.navactivecolor = '#FEFFFF';
-config.primarycolor = '#1890ff';
+// config.navbackground = '#3D62D3';
+// config.navcolor = '#9EB0E9';
+// config.navactivecolor = '#FEFFFF';
+// config.primarycolor = '#1890ff';
 export default config;

+ 2 - 2
dxp-vue/src/utils/dxp.js

@@ -294,9 +294,9 @@ export function arrayToJson(arrays, keyName) {
   if (arrays && arrays.length > 0) {
     arrays.forEach((p) => {
       let val = "";
-      if (p[keyName] === "pageNo") {
+      if (p[keyName] === "pageNo" || p[keyName] === "page") {
         val = 1;
-      } else if (p[keyName] === "pageSize") {
+      } else if (p[keyName] === "pageSize" || p[keyName] === "size") {
         val = 10;
       } else if (p["defaultVal"] || p["defaultVal"] === 0) {
         val = p["defaultVal"];

+ 1 - 1
dxp-vue/src/utils/request.js

@@ -18,7 +18,7 @@ const service = axios.create({
   // 生产默认使用当前前端所在IP,固定9001端口,不读取配置。其他环境读取.env.环境中的配置
   baseURL: getDynamicsApiUrl(process.env.VUE_APP_BASE_API),
   // 超时
-  timeout: 10000
+  timeout: 1000 * 60 * 100
 })
 
 // request拦截器

+ 13 - 7
dxp-vue/src/views/customer/cataDetail/index.vue

@@ -335,7 +335,7 @@
                     :page-sizes="[10, 50, 100, 200, 500, 1000, 2000, 5000]"
                     @pagination="getList"
                   />
-                  <pagination
+                  <!-- <pagination
                     v-else
                     v-show="total > 0"
                     :total="total"
@@ -343,7 +343,7 @@
                     :limit.sync="pageSize"
                     :page-sizes="[10, 50, 100, 200, 500, 1000, 2000, 5000]"
                     @pagination="getServiceList"
-                  />
+                  /> -->
                 </div>
               </template>
               <div v-else style="height: 200px">
@@ -411,7 +411,7 @@
                   <div class="livFlex">
                     <div class="livText">请求地址</div>
                     <div class="livTxt">
-                      {{ baseUserUrl }}/dxp/outapi/any/{{ currentApp.accessId }}
+                      {{ baseUserUrl }}/outapi/any/{{ currentApp.accessId }}
                     </div>
                   </div>
                   <div class="livFlex">
@@ -838,6 +838,10 @@ export default {
       this.from = params.from;
     }
 
+    if (params.accessId) {
+      this.currentAccessId = params.accessId;
+    }
+
     if (!params.id || !params.type) {
       // 返回首页
       this.$router.push({ path: "/index" });
@@ -918,8 +922,6 @@ export default {
       }
 
       let param = {
-        pageNo: this.pageNo,
-        pageSize: this.pageSize,
       };
 
       if (this.serviceInParamStr) {
@@ -1012,8 +1014,11 @@ export default {
         }
         this.appliedAppList = res.data;
         if (this.appliedAppList && this.appliedAppList.length > 0) {
-          this.currentAccessId = this.appliedAppList[0].accessId;
-          this.currentApp = this.appliedAppList[0];
+          if (!this.currentAccessId) {
+            this.currentAccessId = this.appliedAppList[0].accessId;
+          }
+
+          this.currentApp = this.appliedAppList.find(p => p.accessId === this.currentAccessId);
         }
         this.getResDetail();
       });
@@ -1135,6 +1140,7 @@ export default {
       // 入参对象
       if (this.inParams && this.inParams.length > 0) {
         this.requestParam = arrayToJson(this.inParams, "paramName");
+        this.serviceInParamStr = JSON.stringify(arrayToJson(this.inParams, "paramName"));
       }
 
       console.log("inItem", data);

+ 1 - 1
dxp-vue/src/views/customer/myres/index.vue

@@ -142,7 +142,7 @@ export default {
       this.$router.push({
         path: `/customer/detail?type=${res.resType}&id=${res.id}&catalogueId=${
           this.queryParams.catalogueId ? this.queryParams.catalogueId : ""
-        }&from=myres`,
+        }&from=myres&accessId=${res.accessId}`,
       });
       console.log(res);
     },

+ 97 - 40
dxp-vue/src/views/index.vue

@@ -42,7 +42,11 @@
           placeholder="请输入关键字"
         >
           <el-button
-            :style="'background: ' + $config.primarycolor + '; border-radius: 0; color: #fff'"
+            :style="
+              'background: ' +
+              $config.primarycolor +
+              '; border-radius: 0; color: #fff'
+            "
             slot="append"
             icon="el-icon-search"
             @click="search"
@@ -59,15 +63,54 @@
         <div class="claText">资源目录分类</div>
       </div>
       <div class="claPlate">
-        <div
-          class="claCont"
-          v-for="(cate, i) in hotcatalogueList"
-          :key="i"
-          @click="goToCatalogue(cate.id)"
-        >
-          <img class="claCont-img" :src="cate.coverImg" />
-          <div class="claCont-text">{{ cate.catalogueName }}</div>
-        </div>
+        <template v-if="hotcatalogueList && hotcatalogueList.length <= 5">
+          <div class="row">
+            <div
+              class="claCont"
+              v-for="(cate, i) in hotcatalogueList"
+              :key="i"
+              @click="goToCatalogue(cate.id)"
+            >
+              <img class="claCont-img" :src="cate.coverImg" />
+              <div class="claCont-text">{{ cate.catalogueName }}</div>
+            </div>
+          </div>
+        </template>
+        <template v-else>
+          <div class="row">
+            <div
+              class="claCont"
+              v-for="(cate, i) in hotcatalogueList.filter((p, i) => i < 5)"
+              :key="i"
+              @click="goToCatalogue(cate.id)"
+            >
+              <img class="claCont-img" :src="cate.coverImg" />
+              <div class="claCont-text">{{ cate.catalogueName }}</div>
+            </div>
+          </div>
+          <div class="row">
+            <div
+              class="claCont"
+              v-for="(cate, i) in hotcatalogueList.filter((p, i) => i >= 5)"
+              :key="i"
+              @click="goToCatalogue(cate.id)"
+            >
+              <img class="claCont-img" :src="cate.coverImg" />
+              <div class="claCont-text">{{ cate.catalogueName }}</div>
+            </div>
+          </div>
+        </template>
+        <!-- <div class="row">
+          <div
+            class="claCont"
+            v-for="(cate, i) in hotcatalogueList"
+            :key="i"
+            @click="goToCatalogue(cate.id)"
+          >
+            <img class="claCont-img" :src="cate.coverImg" />
+            <div class="claCont-text">{{ cate.catalogueName }}</div>
+          </div>
+        </div> -->
       </div>
     </div>
     <!-- 热门资源 -->
@@ -264,13 +307,11 @@ export default {
       hotliteraturList: [], // 热点文献
       topicList: [], // 专题
       keyword: "",
-      isCompany: true
+      isCompany: true,
     };
   },
   computed: {
-    ...mapGetters([
-      "user"
-    ]),
+    ...mapGetters(["user"]),
   },
   created() {
     console.log(this.user);
@@ -284,7 +325,7 @@ export default {
     getLoginInfo() {
       getInfo().then((res) => {
         this.isCompany = res.company ? true : false;
-      })
+      });
     },
     goToDetail(res, resType) {
       this.$router.push({
@@ -329,7 +370,12 @@ export default {
         res.rows.forEach((p) => {
           p.coverImg = this.getImg(p.coverImg);
         });
-        this.hotcatalogueList = res.rows;
+
+        if (res.rows.length > 10) {
+          this.hotcatalogueList = res.rows.filter((k, i) => i < 10);
+        } else {
+          this.hotcatalogueList = res.rows;
+        }
       });
     },
     getHotList() {
@@ -492,7 +538,7 @@ export default {
 
 .classify {
   margin-top: 60px;
-  padding: 0 280px;
+  padding: 0 80px;
   padding-top: 90px;
   padding-bottom: 120px;
   box-sizing: border-box;
@@ -524,39 +570,50 @@ export default {
   }
 
   .claPlate {
+    width: 100%;
     display: flex;
     flex-wrap: wrap;
+    justify-content: center;
 
-    .claCont {
-      width: 288px;
-      height: 140px;
-      background: #ffffff;
-      border-radius: 4px;
-      border: 1px solid #ebf0f6;
-      margin: 10px 10px;
+    .row {
+      width: 100%;
+      height: 160px;
       display: flex;
-      align-items: center;
       justify-content: center;
+      .claCont {
+        width: 288px;
+        height: 140px;
+        background: #ffffff;
+        border-radius: 4px;
+        border: 1px solid #ebf0f6;
+        margin: 10px 10px;
+        display: flex;
+        align-items: center;
+        justify-content: center;
+
+        .claCont-img {
+          width: 68px;
+          height: 68px;
+        }
 
-      .claCont-img {
-        width: 68px;
-        height: 68px;
+        .claCont-text {
+          max-width: 120px;
+          max-height: 50px;
+          overflow: hidden;
+          font-size: 18px;
+          font-family: PingFangSC-Medium, PingFang SC;
+          font-weight: 500;
+          color: #333333;
+          margin-left: 20px;
+        }
       }
 
-      .claCont-text {
-        font-size: 18px;
-        font-family: PingFangSC-Medium, PingFang SC;
-        font-weight: 500;
-        color: #333333;
-        margin-left: 20px;
+      .claCont:hover {
+        box-shadow: 0px 0px 30px 5px rgba(88, 134, 253, 0.2);
+        margin: 0px 10px;
+        cursor: pointer;
       }
     }
-
-    .claCont:hover {
-      box-shadow: 0px 0px 30px 5px rgba(88, 134, 253, 0.2);
-      margin: 0px 10px;
-      cursor: pointer;
-    }
   }
 }
 

+ 3 - 1
dxp-vue/src/views/system/audit/application/index.vue

@@ -440,7 +440,9 @@ export default {
             this.$modal.msgSuccess("审核成功");
             this.open = false;
             this.getList();
-          });
+          }).catch(() => {
+              this.submitting = false;
+            });
         }
       });
     },

+ 3 - 1
dxp-vue/src/views/system/audit/customer/index.vue

@@ -417,7 +417,9 @@ export default {
             this.$modal.msgSuccess("审核成功");
             this.open = false;
             this.getList();
-          });
+          }).catch(() => {
+              this.submitting = false;
+            });
         }
       });
     },

+ 25 - 12
dxp-vue/src/views/system/audit/data/index.vue

@@ -283,7 +283,13 @@
         </el-row>
       </el-form>
       <div slot="footer" class="dialog-footer">
-        <el-button type="primary" @click="submitForm" v-if="isAudit" :loading="submitting">确 定</el-button>
+        <el-button
+          type="primary"
+          @click="submitForm"
+          v-if="isAudit"
+          :loading="submitting"
+          >确 定</el-button
+        >
         <el-button @click="cancel">取 消</el-button>
       </div>
     </el-dialog>
@@ -327,7 +333,7 @@ export default {
         pageSize: 10,
         tableName: null,
         dataName: null,
-        status: '0',
+        status: "0",
         createBy: null,
         createTime: null,
         updateBy: null,
@@ -363,12 +369,15 @@ export default {
       this.queryParams.params = {};
       if (null != this.daterangeCreateTime && "" != this.daterangeCreateTime) {
         this.queryParams.params["beginCreateTime"] =
-          this.daterangeCreateTime[0] + ' 00:00:00';
-        this.queryParams.params["endCreateTime"] = this.daterangeCreateTime[1] + ' 23:59:59';
+          this.daterangeCreateTime[0] + " 00:00:00";
+        this.queryParams.params["endCreateTime"] =
+          this.daterangeCreateTime[1] + " 23:59:59";
       }
       if (null != this.daterangeAuditTime && "" != this.daterangeAuditTime) {
-        this.queryParams.params["beginAuditTime"] = this.daterangeAuditTime[0] + ' 00:00:00';
-        this.queryParams.params["endAuditTime"] = this.daterangeAuditTime[1] + ' 23:59:59';
+        this.queryParams.params["beginAuditTime"] =
+          this.daterangeAuditTime[0] + " 00:00:00";
+        this.queryParams.params["endAuditTime"] =
+          this.daterangeAuditTime[1] + " 23:59:59";
       }
       listData(this.queryParams).then((response) => {
         this.dataList = response.rows;
@@ -426,12 +435,16 @@ export default {
         if (valid) {
           this.submitting = true;
 
-          auditData(this.form).then((response) => {
-            this.submitting = false;
-            this.$modal.msgSuccess("审核成功");
-            this.open = false;
-            this.getList();
-          });
+          auditData(this.form)
+            .then((response) => {
+              this.submitting = false;
+              this.$modal.msgSuccess("审核成功");
+              this.open = false;
+              this.getList();
+            })
+            .catch(() => {
+              this.submitting = false;
+            });
         }
       });
     },

+ 52 - 16
dxp-vue/src/views/system/audit/resource/index.vue

@@ -406,6 +406,18 @@
             </el-form-item>
           </el-col>
         </el-row>
+        <el-divider v-if="form.resourceType !== 'data'"></el-divider>
+        <el-row v-if="form.resourceType !== 'data'">
+          <el-col :span="24">
+            <el-form-item label="数据过滤:" prop="statusRemark">
+              <el-input
+                v-model="form.statusRemark"
+                placeholder="请输入请求接口search固定过滤JSON"
+                type="textarea"
+              ></el-input>
+            </el-form-item>
+          </el-col>
+        </el-row>
         <el-divider></el-divider>
         <el-row v-if="!isAudit">
           <el-col :span="8">
@@ -541,7 +553,7 @@
           <el-table
             v-loading="detailLoading"
             :data="resourceItemList"
-             ref="multipleTable"
+            ref="multipleTable"
             @selection-change="handleSelectionChange"
           >
             <el-table-column
@@ -700,6 +712,17 @@ export default {
     "sys_public_year",
   ],
   data() {
+        const validateJSON = (rule, value, callback) => {
+      if (value) {
+        try {
+          JSON.parse(value);
+          callback();
+        } catch(e) {
+          callback("请输入正确的JSON");
+        }
+      }
+      callback();
+    };
     return {
       resName: null,
       // 遮罩层
@@ -751,6 +774,9 @@ export default {
         auditRemark: [
           { required: true, message: "请填写原因说明", trigger: "change" },
         ],
+        statusRemark: [
+          { validator: validateJSON, trigger: "change" }
+        ]
       },
       isAudit: false,
       resourceItemList: [], // 资源明细列表
@@ -771,10 +797,14 @@ export default {
   methods: {
     refesh() {
       this.submitting = true;
-      refeshResource().then((res) => {
-        this.submitting = false;
-        this.$modal.msgSuccess("刷新成功");
-      });
+      refeshResource()
+        .then((res) => {
+          this.submitting = false;
+          this.$modal.msgSuccess("刷新成功");
+        })
+        .catch(() => {
+          this.submitting = false;
+        });
     },
     canSelect(row) {
       return row.isVisable === "Y";
@@ -852,11 +882,11 @@ export default {
       this.resetForm("queryForm");
       this.handleQuery();
     },
-    getUserItem(row) {
+    getUserItem2(row) {
       getUserItem(row.id).then((resUserItem) => {
         if (resUserItem.data && resUserItem.data.resourceItem) {
           const selectedItems = JSON.parse(resUserItem.data.resourceItem);
-          console.log(this.selectedItems);
+          console.log(selectedItems);
           console.log(this.resourceItemList);
 
           // 设置选中
@@ -871,7 +901,9 @@ export default {
               const selected = selectedItems.find((k) => k.id === p.id);
               if (selected) {
                 this.$refs.multipleTable.toggleRowSelection(p);
-                p.desensitizationRuleId = selected.desensitizationRuleId
+                p.desensitizationRuleId = selected.desensitizationRuleId;
+                p.filterOperator = selected.filterOperator;
+                p.filterValue = selected.filterValue;
               }
             });
           }
@@ -894,7 +926,7 @@ export default {
             });
           }
           this.resourceItemList = response.data;
-          this.getUserItem(row);
+          this.getUserItem2(row);
           this.open = true;
           this.detailLoading = false;
           // console.log(this.resData);
@@ -913,7 +945,7 @@ export default {
           this.resourceItemList = response.data.filter(
             (p) => p.paramType === "out"
           ); // 只配置出参
-          this.getUserItem(row);
+          this.getUserItem2(row);
           this.open = true;
           this.detailLoading = false;
           // console.log(this.resService);
@@ -992,12 +1024,16 @@ export default {
           }
 
           this.submitting = true;
-          auditResource(form).then((response) => {
-            this.submitting = false;
-            this.$modal.msgSuccess("审核成功");
-            this.open = false;
-            this.getList();
-          });
+          auditResource(form)
+            .then((response) => {
+              this.submitting = false;
+              this.$modal.msgSuccess("审核成功");
+              this.open = false;
+              this.getList();
+            })
+            .catch(() => {
+              this.submitting = false;
+            });
         }
       });
     },

+ 2 - 2
dxp-vue/src/views/system/audit/service/index.vue

@@ -8,9 +8,9 @@
       :class="showSearch ? '' : ' hide'"
       label-width="68px"
     >
-      <el-form-item label="服务名称" prop="dataName">
+      <el-form-item label="服务名称" prop="serviceName">
         <el-input
-          v-model="queryParams.dataName"
+          v-model="queryParams.serviceName"
           placeholder="请输入服务名称"
           clearable
           @keyup.enter.native="handleQuery"

+ 35 - 15
dxp-vue/src/views/system/base/database/index.vue

@@ -210,7 +210,17 @@
             placeholder="请输入内容"
             :disabled="form.id > 0"
           />
-          示例:用户名:密码@(IP:PORT)/数据库名?charset=utf8
+          <div v-if="form.databaseType">
+            <span v-if="form.databaseType === 'dm8'"
+              >示例:dm://用户名:密码@数据库ip:端口</span
+            >
+            <span v-if="form.databaseType === 'mysql'"
+              >示例:用户名:密码@(IP:PORT)/数据库名?charset=utf8</span
+            >
+            <span v-if="form.databaseType === 'postgres' || form.databaseType === 'kingbase'"
+              >示例:host=数据库ip port=数据库端口 user=用户名 password=密码 dbname=数据库名称 sslmode=disable</span
+            >
+          </div>
         </el-form-item>
       </el-form>
       <div slot="footer" class="dialog-footer">
@@ -283,7 +293,7 @@ export default {
         ],
         cacheFlag: [
           { required: true, message: "是否可写入不能为空", trigger: "change" },
-        ]
+        ],
       },
     };
   },
@@ -370,7 +380,9 @@ export default {
     handleSyncData(row) {
       const self = this;
       this.$modal
-        .confirm("是否将当前数据源最新数据结构同步到整合数据,同步将采用异步方式?")
+        .confirm(
+          "是否将当前数据源最新数据结构同步到整合数据,同步将采用异步方式?"
+        )
         .then(function () {
           const id = row.id;
           syncToData(id).then((response) => {});
@@ -385,19 +397,27 @@ export default {
         if (valid) {
           this.submitting = true;
           if (this.form.id != null) {
-            updateDatabase(this.form).then((response) => {
-              this.submitting = false;
-              this.$modal.msgSuccess("修改成功");
-              this.open = false;
-              this.getList();
-            });
+            updateDatabase(this.form)
+              .then((response) => {
+                this.submitting = false;
+                this.$modal.msgSuccess("修改成功");
+                this.open = false;
+                this.getList();
+              })
+              .catch(() => {
+                this.submitting = false;
+              });
           } else {
-            addDatabase(this.form).then((response) => {
-              this.submitting = false;
-              this.$modal.msgSuccess("新增成功");
-              this.open = false;
-              this.getList();
-            });
+            addDatabase(this.form)
+              .then((response) => {
+                this.submitting = false;
+                this.$modal.msgSuccess("新增成功");
+                this.open = false;
+                this.getList();
+              })
+              .catch(() => {
+                this.submitting = false;
+              });
           }
         }
       });

+ 4 - 0
dxp-vue/src/views/system/base/dict/data.vue

@@ -371,6 +371,8 @@ export default {
               this.$modal.msgSuccess("修改成功");
               this.open = false;
               this.getList();
+            }).catch(() => {
+              this.submitting = false;
             });
           } else {
             addData(this.form).then(response => {
@@ -379,6 +381,8 @@ export default {
               this.$modal.msgSuccess("新增成功");
               this.open = false;
               this.getList();
+            }).catch(() => {
+              this.submitting = false;
             });
           }
         }

+ 8 - 0
dxp-vue/src/views/system/base/tag/index.vue

@@ -466,6 +466,8 @@ export default {
               this.$modal.msgSuccess("修改成功");
               this.open = false;
               this.getList();
+            }).catch(() => {
+              this.submitting = false;
             });
           } else {
             addTag(this.form).then((response) => {
@@ -473,6 +475,8 @@ export default {
               this.$modal.msgSuccess("新增成功");
               this.open = false;
               this.getList();
+            }).catch(() => {
+              this.submitting = false;
             });
           }
         }
@@ -488,6 +492,8 @@ export default {
               this.$modal.msgSuccess("修改成功");
               this.openGroup = false;
               this.getTaggroupList();
+            }).catch(() => {
+              this.submitting = false;
             });
           } else {
             addTaggroup(this.formGroup).then((response) => {
@@ -495,6 +501,8 @@ export default {
               this.$modal.msgSuccess("新增成功");
               this.openGroup = false;
               this.getTaggroupList();
+            }).catch(() => {
+              this.submitting = false;
             });
           }
         }

+ 4 - 0
dxp-vue/src/views/system/base/topic/index.vue

@@ -299,6 +299,8 @@ export default {
               this.$modal.msgSuccess("修改成功");
               this.open = false;
               this.getList();
+            }).catch(() => {
+              this.submitting = false;
             });
           } else {
             addTopic(this.form).then((response) => {
@@ -306,6 +308,8 @@ export default {
               this.$modal.msgSuccess("新增成功");
               this.open = false;
               this.getList();
+            }).catch(() => {
+              this.submitting = false;
             });
           }
         }

+ 4 - 0
dxp-vue/src/views/system/integration/catalogue/index.vue

@@ -284,6 +284,8 @@ export default {
               this.$modal.msgSuccess("修改成功");
               this.open = false;
               this.getList();
+            }).catch(() => {
+              this.submitting = false;
             });
           } else {
             addCatalogue(this.form).then((response) => {
@@ -291,6 +293,8 @@ export default {
               this.$modal.msgSuccess("新增成功");
               this.open = false;
               this.getList();
+            }).catch(() => {
+              this.submitting = false;
             });
           }
         }

+ 22 - 11
dxp-vue/src/views/system/integration/data/index.vue

@@ -280,7 +280,9 @@
         ></el-table-column> -->
       </el-table>
       <div slot="footer" class="dialog-footer">
-        <el-button type="primary" @click="submitForm" :loading="submitting">确 定</el-button>
+        <el-button type="primary" @click="submitForm" :loading="submitting"
+          >确 定</el-button
+        >
         <el-button @click="cancel">取 消</el-button>
       </div>
     </el-dialog>
@@ -292,6 +294,7 @@
       width="800px"
       append-to-body
       v-if="mount"
+      @close="cancel"
     >
       <el-form
         ref="mountForm"
@@ -328,8 +331,10 @@
         <el-button
           type="primary"
           @click="submitMountForm"
-           :loading="submitting"
-          :disabled="(!selectedTableList || selectedTableList.length === 0) ? true : false"
+          :loading="submitting"
+          :disabled="
+            !selectedTableList || selectedTableList.length === 0 ? true : false
+          "
           >确 定</el-button
         >
         <el-button @click="cancel">取 消</el-button>
@@ -412,7 +417,9 @@ export default {
         databaseId: [
           { required: true, message: "数据库id不能为空", trigger: "change" },
         ],
-        tableId: [{ required: true, message: "表id不能为空", trigger: "change" }],
+        tableId: [
+          { required: true, message: "表id不能为空", trigger: "change" },
+        ],
         dataName: [
           { required: true, message: "数据名称不能为空", trigger: "change" },
         ],
@@ -421,7 +428,7 @@ export default {
         ],
         catalogueId: [
           { required: true, message: "请选择目录", trigger: "change" },
-        ]
+        ],
       },
       databaseList: [],
       tableList: [],
@@ -639,12 +646,16 @@ export default {
             tableIds: this.selectedTableList.map((p) => p.id),
           };
           this.submitting = true;
-          mountData(param).then((response) => {
-            this.submitting = false;
-            this.getList();
-            this.$modal.msgSuccess("挂载成功");
-            this.cancel();
-          });
+          mountData(param)
+            .then((response) => {
+              this.submitting = false;
+              this.getList();
+              this.$modal.msgSuccess("挂载成功");
+              this.cancel();
+            })
+            .catch(() => {
+              this.submitting = false;
+            });
         }
       });
     },

+ 65 - 41
dxp-vue/src/views/system/integration/service/index.vue

@@ -284,6 +284,17 @@
             </el-form-item>
           </el-col>
         </el-row>
+        <el-row v-if="form.responseForm === 'standard'">
+          <el-col :span="24">
+            <el-form-item label="数据过滤" prop="filterJson">
+              <el-input
+                v-model="form.filterJson"
+                type="textarea"
+                placeholder="服务固定查询参数(search字段),用户使用该服务查询时,会固定拼接这里填写的JSON格式"
+              />
+            </el-form-item>
+          </el-col>
+        </el-row>
       </el-form>
       <el-row style="margin: 20px 0 10px 0">
         <el-col :span="12">
@@ -362,7 +373,7 @@
           <template slot="header">
             缓存映射字段
             <el-tooltip
-              content="服务数据缓存时,该参数缓存到数据表的字段名,必须符合表字段命名规范,且不能变更"
+              content="服务数据缓存时,该参数必填,为缓存到本地数据表的表列名,名称必须符合表列名命名规范,且不能变更"
               placement="bottom"
             >
               <i class="el-icon-question" />
@@ -374,7 +385,6 @@
               placeholder="必须是英文、数字、下划线"
               v-if="scope.row.isEdit && scope.row.paramType === 'out'"
               size="mini"
-              :disabled="form.id"
             />
             <span v-if="!scope.row.isEdit && scope.row.paramType === 'out'">{{
               scope.row.mapColumnName
@@ -576,14 +586,16 @@ export default {
   ],
   components: { CatalogueTree, Treeselect, LocalJsonViewer },
   data() {
-    var validateUrl = (rule, value, callback) => {
-      if (value === "") {
-        callback(new Error("请输入服务地址"));
-      } else if (!validURL(value)) {
-        callback(new Error("请输入正确服务地址!"));
-      } else {
-        callback();
+    const validateJSON = (rule, value, callback) => {
+      if (value) {
+        try {
+          JSON.parse(value);
+          callback();
+        } catch(e) {
+          callback("请输入正确的JSON");
+        }
       }
+      callback();
     };
     return {
       // 遮罩层
@@ -635,7 +647,7 @@ export default {
       tagList: [],
       // 表单参数
       form: {
-        requestMethod: "POST"
+        requestMethod: "POST",
       },
       // 表单校验
       rules: {
@@ -647,8 +659,9 @@ export default {
         ],
         serviceUrl: [
           { required: true, message: "服务地址不能为空", trigger: "change" },
-          { validator: validateUrl, trigger: "change" },
+          // { validator: validateUrl, trigger: "change" },
         ],
+        filterJson: [{ validator: validateJSON, trigger: "change" }],
         needAuth: [
           {
             required: true,
@@ -912,19 +925,27 @@ export default {
           form.serviceItems = serviceItems;
           this.submitting = true;
           if (form.id != null) {
-            updateService(form).then((response) => {
-              this.submitting = false;
-              this.$modal.msgSuccess("修改成功");
-              this.open = false;
-              this.getList();
-            });
+            updateService(form)
+              .then((response) => {
+                this.submitting = false;
+                this.$modal.msgSuccess("修改成功");
+                this.open = false;
+                this.getList();
+              })
+              .catch(() => {
+                this.submitting = false;
+              });
           } else {
-            addService(form).then((response) => {
-              this.submitting = false;
-              this.$modal.msgSuccess("新增成功");
-              this.open = false;
-              this.getList();
-            });
+            addService(form)
+              .then((response) => {
+                this.submitting = false;
+                this.$modal.msgSuccess("新增成功");
+                this.open = false;
+                this.getList();
+              })
+              .catch(() => {
+                this.submitting = false;
+              });
           }
         }
       });
@@ -1002,27 +1023,30 @@ export default {
         return false;
       }
 
-      if (row.paramType === "out" && this.form.responseForm === "standard") {
-        console.log(row.mapColumnName);
-        if (!row.mapColumnName || row.mapColumnName.length === 0) {
-          this.$modal.msgError(`id=${row.id}请填写缓存映射表字段名`);
-          return false;
-        }
+      // if (row.paramType === "out" && this.form.responseForm === "standard") {
+      //   console.log(row.mapColumnName);
+      //   if (!row.mapColumnName || row.mapColumnName.length === 0) {
+      //     this.$modal.msgError(`id=${row.id}请填写缓存映射表字段名`);
+      //     return false;
+      //   }
 
-        // 校验只能是英文,数字,下划线
-        const reg = /^[a-z0-9_]*$/g;
-        if (!reg.test(row.mapColumnName)) {
-          this.$modal.msgError(
-            `id=${row.id}缓存映射表字段名必须为英文、数字、下划线`
-          );
-          return false;
-        }
-      }
+      //   // 校验只能是英文,数字,下划线
+      //   const reg = /^[a-z0-9_]*$/g;
+      //   if (!reg.test(row.mapColumnName)) {
+      //     this.$modal.msgError(
+      //       `id=${row.id}缓存映射表字段名必须为英文、数字、下划线`
+      //     );
+      //     return false;
+      //   }
+      // }
 
       // 映射字段验重
       if (row.paramType === "out" && this.form.responseForm === "standard") {
         const mapRepeat = this.tableData.find(
-          (p) => p.mapColumnName === row.mapColumnName && p.id !== row.id
+          (p) =>
+            row.mapColumnName &&
+            p.mapColumnName === row.mapColumnName &&
+            p.id !== row.id
         );
         if (mapRepeat) {
           this.$modal.msgError(
@@ -1102,10 +1126,10 @@ export default {
                     paramType: "out",
                     paramName: p.field,
                     // paramComment: p.field,
-                    mapColumnName: p.name,
+                    mapColumnName: null,
                     dataType: "String",
                     isRequired: true,
-                    remark: null,
+                    remark: p.name,
                     isEdit: 0,
                   });
                 });

+ 4 - 0
dxp-vue/src/views/system/metadata/data/index.vue

@@ -688,6 +688,8 @@ export default {
               this.$modal.msgSuccess("修改成功");
               this.open = false;
               this.getList();
+            }).catch(() => {
+              this.submitting = false;
             });
           } else {
             addData(form).then((response) => {
@@ -695,6 +697,8 @@ export default {
               this.$modal.msgSuccess("新增成功");
               this.open = false;
               this.getList();
+            }).catch(() => {
+              this.submitting = false;
             });
           }
         }

+ 4 - 0
dxp-vue/src/views/system/permission/company/index.vue

@@ -422,6 +422,8 @@ export default {
               this.$modal.msgSuccess("修改成功");
               this.open = false;
               this.getList();
+            }).catch(() => {
+              this.submitting = false;
             });
           } else {
             addCompany(this.form).then((response) => {
@@ -429,6 +431,8 @@ export default {
               this.$modal.msgSuccess("新增成功");
               this.open = false;
               this.getList();
+            }).catch(() => {
+              this.submitting = false;
             });
           }
         }

+ 4 - 0
dxp-vue/src/views/system/permission/dept/index.vue

@@ -318,6 +318,8 @@ export default {
               this.$modal.msgSuccess("修改成功");
               this.open = false;
               this.getList();
+            }).catch(() => {
+              this.submitting = false;
             });
           } else {
             addDept(this.form).then(response => {
@@ -325,6 +327,8 @@ export default {
               this.$modal.msgSuccess("新增成功");
               this.open = false;
               this.getList();
+            }).catch(() => {
+              this.submitting = false;
             });
           }
         }

+ 4 - 0
dxp-vue/src/views/system/permission/menu/index.vue

@@ -431,6 +431,8 @@ export default {
               this.$modal.msgSuccess("修改成功");
               this.open = false;
               this.getList();
+            }).catch(() => {
+              this.submitting = false;
             });
           } else {
             addMenu(this.form).then(response => {
@@ -438,6 +440,8 @@ export default {
               this.$modal.msgSuccess("新增成功");
               this.open = false;
               this.getList();
+            }).catch(() => {
+              this.submitting = false;
             });
           }
         }

+ 4 - 0
dxp-vue/src/views/system/permission/post/index.vue

@@ -280,6 +280,8 @@ export default {
               this.$modal.msgSuccess("修改成功");
               this.open = false;
               this.getList();
+            }).catch(() => {
+              this.submitting = false;
             });
           } else {
             addPost(this.form).then(response => {
@@ -287,6 +289,8 @@ export default {
               this.$modal.msgSuccess("新增成功");
               this.open = false;
               this.getList();
+            }).catch(() => {
+              this.submitting = false;
             });
           }
         }

+ 4 - 0
dxp-vue/src/views/system/permission/role/index.vue

@@ -568,6 +568,8 @@ export default {
               this.$modal.msgSuccess("修改成功");
               this.open = false;
               this.getList();
+            }).catch(() => {
+              this.submitting = false;
             });
           } else {
             this.form.menuIds = this.getMenuAllCheckedKeys();
@@ -576,6 +578,8 @@ export default {
               this.$modal.msgSuccess("新增成功");
               this.open = false;
               this.getList();
+            }).catch(() => {
+              this.submitting = false;
             });
           }
         }

+ 4 - 0
dxp-vue/src/views/system/permission/user/index.vue

@@ -577,6 +577,8 @@ export default {
               this.$modal.msgSuccess("修改成功");
               this.open = false;
               this.getList();
+            }).catch(() => {
+              this.submitting = false;
             });
           } else {
             addUser(this.form).then(response => {
@@ -584,6 +586,8 @@ export default {
               this.$modal.msgSuccess("新增成功");
               this.open = false;
               this.getList();
+            }).catch(() => {
+              this.submitting = false;
             });
           }
         }

+ 4 - 0
dxp-vue/src/views/system/quality/desensitization/index.vue

@@ -281,6 +281,8 @@ export default {
               this.$modal.msgSuccess("修改成功");
               this.open = false;
               this.getList();
+            }).catch(() => {
+              this.submitting = false;
             });
           } else {
             addDesensitization(this.form).then((response) => {
@@ -288,6 +290,8 @@ export default {
               this.$modal.msgSuccess("新增成功");
               this.open = false;
               this.getList();
+            }).catch(() => {
+              this.submitting = false;
             });
           }
         }

+ 4 - 0
dxp-vue/src/views/system/share/catalogue/index.vue

@@ -290,6 +290,8 @@ export default {
               this.$modal.msgSuccess("修改成功");
               this.open = false;
               this.getList();
+            }).catch(() => {
+              this.submitting = false;
             });
           } else {
             addCatalogue(this.form).then((response) => {
@@ -297,6 +299,8 @@ export default {
               this.$modal.msgSuccess("新增成功");
               this.open = false;
               this.getList();
+            }).catch(() => {
+              this.submitting = false;
             });
           }
         }

+ 10 - 1
dxp-vue/src/views/system/share/data/index.vue

@@ -577,6 +577,7 @@
       width="800px"
       append-to-body
       v-if="mount"
+      @close="cancel"
     >
       <el-form
         ref="mountForm"
@@ -592,6 +593,9 @@
             clearable
           />
         </el-form-item>
+        <el-form-item label="未挂载" prop="isBind">
+          <el-checkbox label="" v-model="queryIntegrationParam.isBind"></el-checkbox>
+        </el-form-item>
         <el-form-item>
           <el-button
             type="primary"
@@ -714,6 +718,7 @@ export default {
         pageNum: 1,
         pageSize: 10,
         tableName: null,
+        isBind: null
       },
       // 目录树
       treeList: [],
@@ -818,7 +823,7 @@ export default {
     },
     getIntegrationList() {
       this.loading = true;
-      listIntegrationData({ status: 1, pageSize: 100000, pageNum: 1 }).then(
+      listIntegrationData({ status: 1, pageSize: 100000, pageNum: 1, isBind: true }).then(
         (response) => {
           this.integrationList = response.rows;
           this.loading = false;
@@ -1007,6 +1012,8 @@ export default {
               this.open = false;
               this.getList();
               this.getUpdateCount();
+            }).catch(() => {
+              this.submitting = false;
             });
           } else {
             addData(form).then((response) => {
@@ -1015,6 +1022,8 @@ export default {
               this.open = false;
               this.getList();
               this.getUpdateCount();
+            }).catch(() => {
+              this.submitting = false;
             });
           }
         }

+ 5 - 0
dxp-vue/src/views/system/share/literature/index.vue

@@ -320,6 +320,7 @@
           <file-upload
             v-model="form.fileUrl"
             :fileType="['doc', 'docx', 'xls', 'xlsx', 'pdf']"
+            :fileSize="500"
           />
         </el-form-item>
         <el-form-item label="描述" prop="remark">
@@ -603,6 +604,8 @@ export default {
               this.$modal.msgSuccess("修改成功");
               this.open = false;
               this.getList();
+            }).catch(() => {
+              this.submitting = false;
             });
           } else {
             addLiterature(this.form).then((response) => {
@@ -610,6 +613,8 @@ export default {
               this.$modal.msgSuccess("新增成功");
               this.open = false;
               this.getList();
+            }).catch(() => {
+              this.submitting = false;
             });
           }
         }

+ 48 - 30
dxp-vue/src/views/system/share/service/index.vue

@@ -765,6 +765,12 @@
             clearable
           />
         </el-form-item>
+        <el-form-item label="未挂载" prop="isBind">
+          <el-checkbox
+            label=""
+            v-model="queryIServiceParam.isBind"
+          ></el-checkbox>
+        </el-form-item>
         <el-form-item>
           <el-button
             type="primary"
@@ -893,6 +899,7 @@ export default {
         pageSize: 10,
         status: "1",
         serviceName: null,
+        isBind: null,
       },
       iServicePageList: [],
       iServiceTotal: 0,
@@ -1006,7 +1013,7 @@ export default {
       });
     },
     getIServiceList() {
-      IlistService({ status: "1" }).then((response) => {
+      IlistService({ status: "1", isBind: true }).then((response) => {
         this.iServiceList = response.rows;
       });
     },
@@ -1209,22 +1216,26 @@ export default {
             } else {
               p.isSearchable = "N";
             }
-            if (!p.confirm) {
-              // 未确认的新增不加入提交数据
-              if (p.businessType !== "INSERT") {
-                submitServiceItems.push(p);
-              }
-            } else {
-              // 确认后,编辑使用新数据
-              if (p.businessType === "UPDATE") {
-                p = p.newService;
-                delete p.newService;
-              }
+            if (form.syncFlag === "1") {
+              if (!p.confirm) {
+                // 未确认的新增不加入提交数据
+                if (p.businessType !== "INSERT") {
+                  submitServiceItems.push(p);
+                }
+              } else {
+                // 确认后,编辑使用新数据
+                if (p.businessType === "UPDATE") {
+                  p = p.newService;
+                  delete p.newService;
+                }
 
-              // 确认后,非删除加入
-              if (p.businessType !== "DELETE") {
-                submitServiceItems.push(p);
+                // 确认后,非删除加入
+                if (p.businessType !== "DELETE") {
+                  submitServiceItems.push(p);
+                }
               }
+            } else {
+              submitServiceItems.push(p);
             }
 
             if (typeof p.id != "number") {
@@ -1232,25 +1243,32 @@ export default {
             }
           });
           form.serviceItems = submitServiceItems;
-          console.log(form);
           // return;
           this.submitting = true;
           if (form.id != null) {
-            updateService(form).then((response) => {
-              this.submitting = false;
-              this.$modal.msgSuccess("修改成功");
-              this.open = false;
-              this.getList();
-              this.getUpdateCount();
-            });
+            updateService(form)
+              .then((response) => {
+                this.submitting = false;
+                this.$modal.msgSuccess("修改成功");
+                this.open = false;
+                this.getList();
+                this.getUpdateCount();
+              })
+              .catch(() => {
+                this.submitting = false;
+              });
           } else {
-            addService(form).then((response) => {
-              this.submitting = false;
-              this.$modal.msgSuccess("新增成功");
-              this.open = false;
-              this.getList();
-              this.getUpdateCount();
-            });
+            addService(form)
+              .then((response) => {
+                this.submitting = false;
+                this.$modal.msgSuccess("新增成功");
+                this.open = false;
+                this.getList();
+                this.getUpdateCount();
+              })
+              .catch(() => {
+                this.submitting = false;
+              });
           }
         }
       });

+ 6 - 2
dxp-vue/src/views/system/share/serviceCache/index.vue

@@ -234,13 +234,13 @@
         <el-form-item label="页字段名" prop="pageField">
           <el-input
             v-model="form.pageField"
-            placeholder="请输入页字段名,如:pageNo"
+            placeholder="请输入页字段名,如:page"
           />
         </el-form-item>
         <el-form-item label="页大小字段" prop="pageSizeField">
           <el-input
             v-model="form.pageSizeField"
-            placeholder="请输入页大小字段名,如:pageSize"
+            placeholder="请输入页大小字段名,如:size"
           />
         </el-form-item>
         <el-form-item label="搜索字段名" prop="searchField">
@@ -553,6 +553,8 @@ export default {
               this.$modal.msgSuccess("修改成功");
               this.open = false;
               this.getList();
+            }).catch(() => {
+              this.submitting = false;
             });
           } else {
             addServiceCache(this.form).then((response) => {
@@ -560,6 +562,8 @@ export default {
               this.$modal.msgSuccess("新增成功");
               this.open = false;
               this.getList();
+            }).catch(() => {
+              this.submitting = false;
             });
           }
         }