比较提交

...

134 次代码提交

作者 SHA1 备注 提交日期
  kira 235cd5a938 yinruoxi 1年前
  kira 02b29837d4 yinruoxi 1年前
  kira f09a0e076c yinruoxi 1年前
  kira 6cd69832f1 yinruoxi 1年前
  kira 428f90fe9e yinruoxi 1年前
  kira fa72ba6e7c yinruoxi 1年前
  kira abb1cae820 yinruoxi 1年前
  kira a6681263ff yinruoxi 1年前
  kira 061185f883 yinruoxi 1年前
  kira 40aa8a644b yinruoxi 1年前
  kira 0bb283962c yinruoxi 1年前
  kira 63eba19aad yinruoxi 1年前
  kira 7be72c4826 yinruoxi 1年前
  kira c3703699e0 yinruoxi 1年前
  kira e3a9575e4b yinruoxi 1年前
  kira 4fdd49ff03 yinruoxi 1年前
  kira caaa0de7b0 yinruoxi 1年前
  kira 08a4aa066e yinruoxi 1年前
  kira 72e29ae229 yinruoxi 1年前
  kira 0a9d9137c2 yinruoxi 1年前
  kira c17c376d15 yinruoxi 1年前
  kira 4ba3a3500c yinruoxi 1年前
  kira 935150179a yinruoxi 1年前
  yk e0347bdd03 解决sonar bug 1年前
  yk e7bd519568 修改upload-multi-pass接口,不请求人脸服务器 1年前
  yk 195cf40e4b fix 上传文件,后缀异常的bug 1年前
  kira 0f44fc36d3 yinruoxi 1年前
  kira 7368635047 yinruoxi 1年前
  kira bbf8c61e31 yinruoxi 1年前
  kira 6abac623d5 yinruoxi 1年前
  kira ddd9435188 yinruoxi 1年前
  kira f63ed83dfa yinruoxi 1年前
  kira 375d797854 yinruoxi 1年前
  kira 3c40ec90c4 yinruoxi 1年前
  kira 4895bf57dc yinruoxi 1年前
  kira c008226df0 yinruoxi 1年前
  kira 43f13796b1 yinruoxi 1年前
  kira 079bb832e0 yinruoxi 1年前
  kira 8d50c70df3 yinruoxi 1年前
  kira 4faefeb299 Merge remote-tracking branch 'origin/dev-liantong' into dev-liantong 1年前
  kira 374c33dc35 yinruoxi 1年前
  bogemail c990c253ec Merge pull request '修改:' (#154) from dev-liantong-stream into dev-liantong 1年前
  10710 25935d344f 修改: 1年前
  10710 5dff1ea957 修改: 1年前
  yinruoxi aec854b31d Merge pull request '修改:' (#147) from dev-liantong-stream into dev-liantong 1年前
  10710 61390fd5ac 修改: 1年前
  yinruoxi 988dc1af15 Merge pull request '修改:' (#146) from dev-liantong-stream into dev-liantong 1年前
  10710 826fcfb762 修改: 1年前
  yk c514cf4c21 文件上传修改 同步上传恢复 1年前
  yk 281f21541f 文件上传修改 同步上传恢复 1年前
  yk 9c0f845a0a fix upload part merge add log 1年前
  yk b690b27ec9 fix upload part merge 1年前
  yk a3124ce3ac fix upload part 1年前
  yk d5afa207e8 fix upload part 1年前
  yk 02bc7b90a6 fix upload part 1年前
  yk 7e52463d32 fix upload part 1年前
  yk 7f9f006dc5 fix upload part 1年前
  yk 5043a182ac fix broadcast mansInfo group:dgman:device: 1年前
  yk ae2c39eaa2 fix broadcast mansInfo group:dgman:device: 1年前
  yk 2a47cd7c07 fix broadcast mansInfo 1年前
  yk 4850513ec6 fix sysfile merge 1年前
  yk 016a2e45c7 fix sysfile merge 1年前
  yk c383a9e8d4 fix sysfile merge 1年前
  yk 6ec3cfe583 fix sysfile merge 1年前
  yk 087c54b044 fix sysfile merge 1年前
  yk 72cbd8ddc4 fix sysfile merge 1年前
  yk 7b3060d283 fix sysfile upload 1年前
  yk e0b421ce5a fix redis byte[] 1年前
  yk bd5b2ce03d fix redis byte[] 1年前
  yk 09a83c140e add message print log 1年前
  yk 720388bfd5 fix upload file change redis 1年前
  yk 7cec9a4b84 fix upload file change redis 1年前
  yk e8db9acf0f fix upload file change redis 1年前
  yk ac53791617 fix upload file 1年前
  yk 558a9d1418 fix upload file 1年前
  yk ccd12383ec fix upload file no extension 1年前
  yk ce9d9baec4 fix upload file no extension 1年前
  yk 7e1f8d8a0b fix upload pdf file 1年前
  yk 6a45d69cd5 fix upload pdf file 1年前
  yk 27d2995d9c fix upload pdf file 1年前
  yk 85e3acabe1 fix upload pdf file 1年前
  yk d38271e1d7 fix upload pdf file int cast to long 1年前
  yk 88669f4adb fix upload pdf file 1年前
  kira bd18237b17 yinruoxi 1年前
  kira dd944b49d6 Revert "yinruoxi" 1年前
  10710 f62782dc35 yinruoxi 1年前
  kira 07d2299308 Merge remote-tracking branch 'origin/dev-liantong' into dev-liantong 1年前
  10710 a1d6eb38b4 增加对推流地址的按数字人配置。 1年前
  yinruoxi 6a400e765c Merge pull request 'dev-liantong-stream' (#137) from dev-liantong-stream into dev-liantong 1年前
  kira 3f4236467c yinruoxi 1年前
  kira 41e4faf205 yinruoxi 1年前
  kira 28a23b69e6 yinruoxi 1年前
  kira 1496820e6f yinruoxi 1年前
  10710 57d0485aa0 增加按数字人code与id删除信息的功能。 1年前
  10710 97ff23656a 修改bug 1年前
  10710 532cdfd5f3 修改bug 1年前
  yinruoxi 3fff2d030d Merge pull request 'dev-liantong-stream' (#136) from dev-liantong-stream into dev-liantong 1年前
  10710 2be56eeeb9 修改bug 1年前
  10710 8ce95bc175 修改bug,增加按id和mancode查询的接口 1年前
  10710 b7e5c96cfc 修改bug 1年前
  10710 7f8019ad17 修改bug 1年前
  10710 d73719cc6e 增加对推流地址的按数字人配置。 1年前
  kira 8255db3942 yinruoxi 1年前
  kira 5e6e6cf1e0 yinruoxi 1年前
  kira 8592108b43 yinruoxi 1年前
  kira 3554cb6391 yinruoxi 1年前
  kira 6ced6bd434 yinruoxi 1年前
  kira a356847056 yinruoxi 1年前
  kira 224e518cab yinruoxi 1年前
  kira d8a45285bf yinruoxi 1年前
  kira 0a25f78d16 yinruoxi 1年前
  kira 7bc4bf2990 yinruoxi 1年前
  kira fa06dd237c yinruoxi 1年前
  kira 0dcc13e0d4 yinruoxi 1年前
  kira 8d054e62aa Merge branch 'dev' into dev-liantong 1年前
  kira a009474284 yinruoxi 1年前
  kira e4f74cd9af yinruoxi 1年前
  kira 8ae44d1ede yinruoxi 1年前
  kira 712caca014 yinruoxi 1年前
  kira 74c2c09a44 yinruoxi 1年前
  kira 8b76135c4f yinruoxi 1年前
  kira 24a32a2a39 yinruoxi 1年前
  kira 9e60e7bcbf yinruoxi 1年前
  kira e4418283b5 yinruoxi 1年前
  kira e9a59976d3 yinruoxi 1年前
  kira ef5ef97e1a yinruoxi 1年前
  kira b47e11e489 yinruoxi 1年前
  kira 074ff1162e Merge remote-tracking branch 'origin/dev' into dev-liantong 1年前
  kira 7571556288 yinruoxi 1年前
  kira 8f3f8a9815 yinruoxi 1年前
  kira e67a02c2c1 Merge remote-tracking branch 'origin/dev' into dev-liantong 1年前
  kira a85be972a3 yinruoxi 1年前
  kira 419172829f Merge remote-tracking branch 'origin/dev' into dev-liantong 1年前
  kira 5a076dc9cd yinruoxi 1年前
共有 100 个文件被更改,包括 2427 次插入291 次删除
  1. +28
    -0
      pom.xml
  2. +68
    -0
      xueyi-api/xueyi-api-file/src/main/java/com/xueyi/file/api/domain/ByteArrayMultipartFile.java
  3. +12
    -2
      xueyi-api/xueyi-api-file/src/main/java/com/xueyi/file/api/feign/RemoteFileService.java
  4. +12
    -2
      xueyi-api/xueyi-api-file/src/main/java/com/xueyi/file/api/feign/factory/RemoteFileFallbackFactory.java
  5. +0
    -6
      xueyi-api/xueyi-api-file/xueyi-api-file.iml
  6. +0
    -6
      xueyi-api/xueyi-api-job/xueyi-api-job.iml
  7. +18
    -0
      xueyi-api/xueyi-api-nlt/src/main/java/com/xueyi/nlt/api/nlt/domain/dto/DmTenantRegularDto.java
  8. +25
    -0
      xueyi-api/xueyi-api-nlt/src/main/java/com/xueyi/nlt/api/nlt/domain/po/DmTenantRegularPo.java
  9. +10
    -0
      xueyi-api/xueyi-api-nlt/src/main/java/com/xueyi/nlt/api/nlt/domain/query/DmTenantRegularQuery.java
  10. +15
    -0
      xueyi-api/xueyi-api-nlt/src/main/java/com/xueyi/nlt/api/nlt/domain/vo/DmLandingLlmUploadVo.java
  11. +7
    -4
      xueyi-api/xueyi-api-nlt/src/main/java/com/xueyi/nlt/api/nlt/feign/RemoteIntentService.java
  12. +20
    -0
      xueyi-api/xueyi-api-nlt/src/main/java/com/xueyi/nlt/api/nlt/feign/RemoteLandingLlmService.java
  13. +25
    -1
      xueyi-api/xueyi-api-nlt/src/main/java/com/xueyi/nlt/api/nlt/feign/factory/RemoteLandingLlmFallbackFactory.java
  14. +30
    -0
      xueyi-api/xueyi-api-system/src/main/java/com/xueyi/system/api/digitalmans/domain/dto/DmH5MenuDto.java
  15. +1
    -1
      xueyi-api/xueyi-api-system/src/main/java/com/xueyi/system/api/digitalmans/domain/dto/DmModelDto.java
  16. +11
    -9
      xueyi-api/xueyi-api-system/src/main/java/com/xueyi/system/api/digitalmans/domain/merge/DmMenuIconMerge.java
  17. +3
    -0
      xueyi-api/xueyi-api-system/src/main/java/com/xueyi/system/api/digitalmans/domain/merge/MergeGroup.java
  18. +4
    -0
      xueyi-api/xueyi-api-system/src/main/java/com/xueyi/system/api/digitalmans/domain/po/DmDigitalmanExtPo.java
  19. +40
    -0
      xueyi-api/xueyi-api-system/src/main/java/com/xueyi/system/api/digitalmans/domain/po/DmH5MenuPo.java
  20. +36
    -0
      xueyi-api/xueyi-api-system/src/main/java/com/xueyi/system/api/digitalmans/domain/po/DmH5TenantMenuPo.java
  21. +5
    -0
      xueyi-api/xueyi-api-system/src/main/java/com/xueyi/system/api/digitalmans/domain/po/DmManDevicePo.java
  22. +3
    -3
      xueyi-api/xueyi-api-system/src/main/java/com/xueyi/system/api/digitalmans/domain/po/DmMenuIconPo.java
  23. +2
    -0
      xueyi-api/xueyi-api-system/src/main/java/com/xueyi/system/api/digitalmans/domain/po/DmScreenIconPo.java
  24. +16
    -0
      xueyi-api/xueyi-api-system/src/main/java/com/xueyi/system/api/digitalmans/domain/query/DmH5MenuQuery.java
  25. +21
    -0
      xueyi-api/xueyi-api-system/src/main/java/com/xueyi/system/api/digitalmans/domain/vo/DmH5MenuVo.java
  26. +29
    -0
      xueyi-api/xueyi-api-system/src/main/java/com/xueyi/system/api/digitalmans/feign/RemoteModelService.java
  27. +3
    -0
      xueyi-api/xueyi-api-system/src/main/java/com/xueyi/system/api/resource/feign/RemoteH5ConfigService.java
  28. +4
    -0
      xueyi-api/xueyi-api-system/src/main/java/com/xueyi/system/api/resource/feign/factory/RemoteH5ConfigFallbackFactory.java
  29. +0
    -6
      xueyi-api/xueyi-api-system/xueyi-api-system.iml
  30. +4
    -0
      xueyi-auth/src/main/resources/bootstrap.yml
  31. +65
    -1
      xueyi-common/xueyi-common-core/src/main/java/com/xueyi/common/core/utils/file/FileUtil.java
  32. +52
    -1
      xueyi-common/xueyi-common-redis/src/main/java/com/xueyi/common/redis/utils/RedisUtil.java
  33. +4
    -0
      xueyi-gateway/src/main/resources/bootstrap.yml
  34. +98
    -5
      xueyi-modules/xueyi-file/src/main/java/com/xueyi/file/controller/SysFileController.java
  35. +5
    -0
      xueyi-modules/xueyi-file/src/main/java/com/xueyi/file/service/FastDfsSysFileServiceImpl.java
  36. +1
    -0
      xueyi-modules/xueyi-file/src/main/java/com/xueyi/file/service/ISysFileService.java
  37. +5
    -0
      xueyi-modules/xueyi-file/src/main/java/com/xueyi/file/service/LocalSysFileServiceImpl.java
  38. +30
    -0
      xueyi-modules/xueyi-file/src/main/java/com/xueyi/file/service/MinioSysFileServiceImpl.java
  39. +5
    -1
      xueyi-modules/xueyi-file/src/main/resources/bootstrap.yml
  40. +4
    -0
      xueyi-modules/xueyi-job/src/main/resources/bootstrap.yml
  41. +38
    -45
      xueyi-modules/xueyi-message/src/main/java/com/xueyi/message/transfer/controller/ApiController.java
  42. +5
    -1
      xueyi-modules/xueyi-message/src/main/resources/bootstrap.yml
  43. +5
    -1
      xueyi-modules/xueyi-modules-auth/src/main/resources/bootstrap.yml
  44. +19
    -0
      xueyi-modules/xueyi-nlt/pom.xml
  45. +192
    -11
      xueyi-modules/xueyi-nlt/src/main/java/com/xueyi/nlt/nlt/controller/DmIntentController.java
  46. +12
    -0
      xueyi-modules/xueyi-nlt/src/main/java/com/xueyi/nlt/nlt/domain/dto/InitRegularExpressionDto.java
  47. +40
    -0
      xueyi-modules/xueyi-nlt/src/main/java/com/xueyi/nlt/nlt/domain/po/InitRegularExpressionPo.java
  48. +10
    -0
      xueyi-modules/xueyi-nlt/src/main/java/com/xueyi/nlt/nlt/domain/query/InitRegularExpressionQuery.java
  49. +15
    -0
      xueyi-modules/xueyi-nlt/src/main/java/com/xueyi/nlt/nlt/domain/vo/DmKnowledgeLibAskVo.java
  50. +61
    -0
      xueyi-modules/xueyi-nlt/src/main/java/com/xueyi/nlt/nlt/domain/vo/MarkRecordVo.java
  51. +5
    -0
      xueyi-modules/xueyi-nlt/src/main/java/com/xueyi/nlt/nlt/manager/IDmIntentManager.java
  52. +40
    -0
      xueyi-modules/xueyi-nlt/src/main/java/com/xueyi/nlt/nlt/manager/impl/DmIntentManager.java
  53. +12
    -0
      xueyi-modules/xueyi-nlt/src/main/java/com/xueyi/nlt/nlt/mapper/DmTenantRegularMapper.java
  54. +19
    -0
      xueyi-modules/xueyi-nlt/src/main/java/com/xueyi/nlt/nlt/mapper/InitRegularExpressionMapper.java
  55. +5
    -0
      xueyi-modules/xueyi-nlt/src/main/java/com/xueyi/nlt/nlt/service/IDmIntentService.java
  56. +9
    -0
      xueyi-modules/xueyi-nlt/src/main/java/com/xueyi/nlt/nlt/service/impl/DmIntentServiceImpl.java
  57. +5
    -1
      xueyi-modules/xueyi-nlt/src/main/resources/bootstrap.yml
  58. +17
    -0
      xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/digitalmans/controller/DmBroadcastController.java
  59. +11
    -5
      xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/digitalmans/controller/DmDigitalmanController.java
  60. +54
    -0
      xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/digitalmans/controller/DmModelController.java
  61. +23
    -1
      xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/digitalmans/controller/DmQAndAController.java
  62. +50
    -0
      xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/digitalmans/controller/api/DmMenuApiController.java
  63. +10
    -0
      xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/digitalmans/domain/dto/DmManIconDto.java
  64. +2
    -0
      xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/digitalmans/domain/dto/DmQAndADto.java
  65. +24
    -0
      xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/digitalmans/domain/po/DmManIconPo.java
  66. +13
    -0
      xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/digitalmans/domain/query/DmManIconQuery.java
  67. +2
    -0
      xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/digitalmans/manager/IDmDigitalmanExtManager.java
  68. +9
    -0
      xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/digitalmans/manager/IDmModelManager.java
  69. +1
    -0
      xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/digitalmans/manager/impl/DmDigitalmanExtManager.java
  70. +2
    -1
      xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/digitalmans/manager/impl/DmDigitalmanManager.java
  71. +287
    -63
      xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/digitalmans/manager/impl/DmModelManager.java
  72. +0
    -9
      xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/digitalmans/manager/impl/DmScreenIconManager.java
  73. +18
    -0
      xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/digitalmans/mapper/DmH5MenuMapper.java
  74. +18
    -0
      xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/digitalmans/mapper/DmH5TenantMenuMapper.java
  75. +18
    -0
      xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/digitalmans/mapper/DmManIconMapper.java
  76. +21
    -0
      xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/digitalmans/mapper/DmMenuIconMapper.java
  77. +0
    -23
      xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/digitalmans/mapper/DmModelIconMapper.java
  78. +2
    -2
      xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/digitalmans/mapper/merge/DmModelIconMergeMapper.java
  79. +9
    -0
      xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/digitalmans/service/IDmModelService.java
  80. +4
    -0
      xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/digitalmans/service/IDmQAndAService.java
  81. +13
    -0
      xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/digitalmans/service/impl/DmModelServiceImpl.java
  82. +52
    -1
      xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/digitalmans/service/impl/DmQAndAServiceImpl.java
  83. +4
    -2
      xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/meeting/controller/api/DmMeetingInnerApiController.java
  84. +1
    -1
      xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/organize/controller/SysProfileController.java
  85. +6
    -6
      xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/pass/controller/api/DmRecognizedRecordsInnerApiController.java
  86. +28
    -3
      xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/resource/controller/DmH5ConfigController.java
  87. +208
    -17
      xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/resource/controller/DmResourcesController.java
  88. +2
    -0
      xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/resource/domain/dto/DmH5ConfigDto.java
  89. +7
    -1
      xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/resource/service/IDmH5ConfigService.java
  90. +206
    -17
      xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/resource/service/impl/DmH5ConfigServiceImpl.java
  91. +1
    -1
      xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/resource/service/impl/DmResourcesServiceImpl.java
  92. +1
    -1
      xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/staff/controller/DmStaffController.java
  93. +1
    -1
      xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/staff/controller/DmVisitorsController.java
  94. +1
    -1
      xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/staff/controller/api/DmVisitorInnerApiController.java
  95. +0
    -1
      xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/staff/service/impl/DmVisitRecordsServiceImpl.java
  96. +4
    -0
      xueyi-modules/xueyi-system/src/main/resources/bootstrap.yml
  97. +27
    -0
      xueyi-modules/xueyi-system/src/main/resources/mapper/digitalmans/DmH5MenuMapper.xml
  98. +25
    -0
      xueyi-modules/xueyi-system/src/main/resources/mapper/digitalmans/DmH5TenantMenuMergeMapper.xml
  99. +32
    -0
      xueyi-modules/xueyi-system/src/main/resources/mapper/digitalmans/DmMenuIconMergeMapper.xml
  100. +0
    -27
      xueyi-modules/xueyi-system/src/main/resources/mapper/digitalmans/DmModelIconMergeMapper.xml

+ 28
- 0
pom.xml 查看文件

@@ -380,6 +380,8 @@
<nacos.host>39.107.77.235</nacos.host>
<nacos.port>18848</nacos.port>
<nacos.namespace>6d0ee265-2a92-44cc-a6de-f34b3ea104e6</nacos.namespace>
<nacos.username>nacos</nacos.username>
<nacos.password>Digimeta@2023</nacos.password>
</properties>
<activation>
<!-- 默认环境 -->
@@ -407,6 +409,32 @@
</properties>

</profile>
<profile>
<id>test-liantong-mobilebox</id>
<properties>
<!-- 环境标识,需要与配置文件的名称相对应 -->
<activatedProperties>test-liantong-mobilebox</activatedProperties>
<nacos.host>39.107.77.235</nacos.host>
<nacos.port>18848</nacos.port>
<nacos.namespace>d4f6cba7-30ad-427c-83dd-c6f9cef117ad</nacos.namespace>
<nacos.username>nacos</nacos.username>
<nacos.password>Digimeta@2023</nacos.password>
</properties>

</profile>
<profile>
<id>prod-liantong-mobilebox</id>
<properties>
<!-- 环境标识,需要与配置文件的名称相对应 -->
<activatedProperties>prod-liantong-mobilebox</activatedProperties>
<nacos.host>192.168.0.13</nacos.host>
<nacos.port>18848</nacos.port>
<nacos.username>nacos</nacos.username>
<nacos.password>Digimeta@2023</nacos.password>
<nacos.namespace>c452d5cc-24a4-4684-804d-60ebb686cbfd</nacos.namespace>
</properties>

</profile>
</profiles>

<build>


+ 68
- 0
xueyi-api/xueyi-api-file/src/main/java/com/xueyi/file/api/domain/ByteArrayMultipartFile.java 查看文件

@@ -0,0 +1,68 @@
package com.xueyi.file.api.domain;

/**
* @author yk
* @description
* @date 2023-10-07 15:43
*/
import org.springframework.web.multipart.MultipartFile;

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;

public class ByteArrayMultipartFile implements MultipartFile {

private final byte[] content;
private final String name;
private final String originalFilename;
private final String contentType;

public ByteArrayMultipartFile(byte[] content) {
this.content = content;
this.name = "file"; // 默认字段名
this.originalFilename = "file"; // 默认文件名
this.contentType = "application/octet-stream"; // 默认内容类型
}

@Override
public String getName() {
return name;
}

@Override
public String getOriginalFilename() {
return originalFilename;
}

@Override
public String getContentType() {
return contentType;
}

@Override
public boolean isEmpty() {
return content == null || content.length == 0;
}

@Override
public long getSize() {
return content.length;
}

@Override
public byte[] getBytes() throws IOException {
return content;
}

@Override
public InputStream getInputStream() throws IOException {
return new ByteArrayInputStream(content);
}

@Override
public void transferTo(java.io.File dest) throws IOException, IllegalStateException {
// 实现此方法根据需要
}
}


+ 12
- 2
xueyi-api/xueyi-api-file/src/main/java/com/xueyi/file/api/feign/RemoteFileService.java 查看文件

@@ -6,9 +6,11 @@ import com.xueyi.file.api.domain.SysFile;
import com.xueyi.file.api.feign.factory.RemoteFileFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.scheduling.annotation.Async;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;

@@ -29,7 +31,14 @@ public interface RemoteFileService {
* @return 结果
*/
@PostMapping(value = "/inner/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
R<SysFile> upload(@RequestPart(value = "file") MultipartFile file);
@Async
R<SysFile> upload(@RequestPart(value = "file") MultipartFile file, @RequestParam (value = "extension") String extension, @RequestParam (value = "fileUuid") String fileUuid);

@PostMapping(value = "/inner/uploadNoAsync", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
R<SysFile> uploadNoAsync(@RequestPart(value = "file") MultipartFile file, @RequestParam (value = "extension") String extension, @RequestParam (value = "fileUuid") String fileUuid);

@PostMapping(value = "/inner/uploadFace", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
R<SysFile> uploadFace(@RequestPart(value = "file") MultipartFile file);

@PostMapping(value = "/inner/upload-temp", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
R<SysFile> uploadTemp(@RequestPart(value = "file") MultipartFile file);
@@ -41,7 +50,8 @@ public interface RemoteFileService {
* @return 结果
*/
@PostMapping(value = "/inner/uploadpdf", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
R<List<SysFile>> uploadPdf(@RequestPart(value = "file") MultipartFile file);
@Async
R<List<SysFile>> uploadPdf(@RequestPart(value = "file") MultipartFile file, @RequestParam (value = "fileUuid") String fileUuid);

/**
* 删除文件


+ 12
- 2
xueyi-api/xueyi-api-file/src/main/java/com/xueyi/file/api/feign/factory/RemoteFileFallbackFactory.java 查看文件

@@ -24,17 +24,27 @@ public class RemoteFileFallbackFactory implements FallbackFactory<RemoteFileServ
log.error("文件服务调用失败:{}", throwable.getMessage());
return new RemoteFileService() {
@Override
public R<SysFile> upload(MultipartFile file) {
public R<SysFile> upload(MultipartFile file, String extension, String uuid) {
return R.fail("上传文件失败:" + throwable.getMessage());
}

@Override
public R<SysFile> uploadNoAsync(MultipartFile file, String extension, String fileUuid) {
return null;
}

@Override
public R<SysFile> uploadFace(MultipartFile file) {
return R.fail("上传文件失败:" + throwable.getMessage() );
}

@Override
public R<SysFile> uploadTemp(MultipartFile file) {
return null;
}

@Override
public R<List<SysFile>> uploadPdf(MultipartFile file) {
public R<List<SysFile>> uploadPdf(MultipartFile file, String uuid) {
return R.fail("上传文件失败:" + throwable.getMessage() );
}



+ 0
- 6
xueyi-api/xueyi-api-file/xueyi-api-file.iml 查看文件

@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module version="4">
<component name="SonarLintModuleSettings">
<option name="uniqueId" value="247b44a0-c300-405f-a076-027db3e8eac7" />
</component>
</module>

+ 0
- 6
xueyi-api/xueyi-api-job/xueyi-api-job.iml 查看文件

@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module version="4">
<component name="SonarLintModuleSettings">
<option name="uniqueId" value="be41b8e4-9859-47b2-a6fe-9edd67df019c" />
</component>
</module>

+ 18
- 0
xueyi-api/xueyi-api-nlt/src/main/java/com/xueyi/nlt/api/nlt/domain/dto/DmTenantRegularDto.java 查看文件

@@ -0,0 +1,18 @@
package com.xueyi.nlt.api.nlt.domain.dto;

import com.xueyi.nlt.api.nlt.domain.po.DmTenantRegularPo;
import lombok.Data;
import lombok.EqualsAndHashCode;

@Data
@EqualsAndHashCode(callSuper = true)
public class DmTenantRegularDto extends DmTenantRegularPo {

private static final long serialVersionUID = 1L;

protected String expression;
protected String type;
protected String text;
protected String json;

}

+ 25
- 0
xueyi-api/xueyi-api-nlt/src/main/java/com/xueyi/nlt/api/nlt/domain/po/DmTenantRegularPo.java 查看文件

@@ -0,0 +1,25 @@
package com.xueyi.nlt.api.nlt.domain.po;

import com.baomidou.mybatisplus.annotation.TableName;
import com.xueyi.common.core.annotation.Excel;
import com.xueyi.common.core.web.tenant.base.TBaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serial;

import static com.xueyi.common.core.constant.basic.EntityConstants.*;

@Data
@EqualsAndHashCode(callSuper = true)
@TableName(value = "dm_tenant_regular_merge", excludeProperty = { NAME,CREATE_TIME, UPDATE_TIME})
public class DmTenantRegularPo extends TBaseEntity {

@Serial
private static final long serialVersionUID = 1L;

/** 正则id */
@Excel(name = "意图名称")
protected String regularId;

}

+ 10
- 0
xueyi-api/xueyi-api-nlt/src/main/java/com/xueyi/nlt/api/nlt/domain/query/DmTenantRegularQuery.java 查看文件

@@ -0,0 +1,10 @@
package com.xueyi.nlt.api.nlt.domain.query;

import com.xueyi.nlt.api.nlt.domain.po.DmTenantRegularPo;
import lombok.Data;
import lombok.EqualsAndHashCode;

@Data
@EqualsAndHashCode(callSuper = true)
public class DmTenantRegularQuery extends DmTenantRegularPo {
}

+ 15
- 0
xueyi-api/xueyi-api-nlt/src/main/java/com/xueyi/nlt/api/nlt/domain/vo/DmLandingLlmUploadVo.java 查看文件

@@ -0,0 +1,15 @@
package com.xueyi.nlt.api.nlt.domain.vo;


import lombok.Data;
import lombok.NoArgsConstructor;


@Data
@NoArgsConstructor
public class DmLandingLlmUploadVo {
private String category;
private String question;
private String answer;

}

+ 7
- 4
xueyi-api/xueyi-api-nlt/src/main/java/com/xueyi/nlt/api/nlt/feign/RemoteIntentService.java 查看文件

@@ -5,13 +5,13 @@ import com.xueyi.common.core.constant.basic.SecurityConstants;
import com.xueyi.common.core.constant.basic.ServiceConstants;
import com.xueyi.common.core.web.result.R;
import com.xueyi.nlt.api.netty.domain.vo.DmWebSocketMessageVo;
import com.xueyi.nlt.api.nlt.domain.dto.DmTenantRegularDto;
import com.xueyi.nlt.api.nlt.domain.vo.DmIntentVo;
import com.xueyi.nlt.api.nlt.feign.factory.RemoteIntentFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(contextId = "remoteIntentService", value = ServiceConstants.NLT_SERVICE, fallbackFactory = RemoteIntentFallbackFactory.class)
public interface RemoteIntentService {
@@ -24,4 +24,7 @@ public interface RemoteIntentService {

@PostMapping("/intent/inner/taskGenerativeKnowledge")
public R taskGenerativeKnowledge();

@GetMapping("intent/inner/getRegularList")
R<List<DmTenantRegularDto>> getRegularList(@RequestHeader(SecurityConstants.ENTERPRISE_ID) Long enterpriseId, @RequestHeader(SecurityConstants.SOURCE_NAME) String sourceName, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
}

+ 20
- 0
xueyi-api/xueyi-api-nlt/src/main/java/com/xueyi/nlt/api/nlt/feign/RemoteLandingLlmService.java 查看文件

@@ -2,11 +2,16 @@ package com.xueyi.nlt.api.nlt.feign;

import com.alibaba.fastjson2.JSONObject;
import com.xueyi.common.core.web.result.AjaxResult;
import com.xueyi.nlt.api.nlt.domain.vo.DmLandingLlmUploadVo;
import com.xueyi.nlt.api.nlt.domain.vo.DmLandingLlmVo;
import com.xueyi.nlt.api.nlt.feign.factory.RemoteLandingLlmFallbackFactory;
import com.xueyi.nlt.api.nlt.feign.factory.RemoteQAFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

/**
* 问答服务
@@ -25,4 +30,19 @@ public interface RemoteLandingLlmService {
@ResponseBody
JSONObject query(@RequestBody JSONObject jsonObject);

@PostMapping(value = "/uploadFile/uploadLearningFile",consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
@ResponseBody
String uploadLearningFile(@RequestParam(value = "category") String category,@RequestPart(value = "fileToUpload") MultipartFile file);

@PostMapping(value = "/index/addInstruction")
@ResponseBody
JSONObject addInstruction(@RequestBody DmLandingLlmUploadVo vo);

@PostMapping(value = "/uploadFile/getUploadFileList")
@ResponseBody
JSONObject getUploadFileList(@RequestParam(value = "category")String category, @RequestParam(value = "pageSize")String pageSize, @RequestParam(value = "pageNumber")String pageNumber);

@PostMapping(value = "/uploadFile/deleteFile")
@ResponseBody
JSONObject deleteFile(@RequestBody List<String> fileIds);
}

+ 25
- 1
xueyi-api/xueyi-api-nlt/src/main/java/com/xueyi/nlt/api/nlt/feign/factory/RemoteLandingLlmFallbackFactory.java 查看文件

@@ -2,12 +2,16 @@ package com.xueyi.nlt.api.nlt.feign.factory;

import com.alibaba.fastjson2.JSONObject;
import com.xueyi.common.core.web.result.AjaxResult;
import com.xueyi.nlt.api.nlt.domain.vo.DmLandingLlmUploadVo;
import com.xueyi.nlt.api.nlt.domain.vo.DmLandingLlmVo;
import com.xueyi.nlt.api.nlt.feign.RemoteLandingLlmService;
import com.xueyi.nlt.api.nlt.feign.RemoteQAService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

/**
* 会议室服务 降级处理
@@ -20,7 +24,7 @@ public class RemoteLandingLlmFallbackFactory implements FallbackFactory<RemoteLa

@Override
public RemoteLandingLlmService create(Throwable throwable) {
log.error("短信服务调用失败:{}", throwable.getMessage());
log.error("联通大模型调用失败:{}", throwable.getMessage());
return new RemoteLandingLlmService() {
@Override
public JSONObject query(DmLandingLlmVo vo) {
@@ -37,6 +41,26 @@ public class RemoteLandingLlmFallbackFactory implements FallbackFactory<RemoteLa
jResult.put("data","");
return jResult;
}

@Override
public String uploadLearningFile(String category, MultipartFile file) {
return null;
}

@Override
public JSONObject addInstruction(DmLandingLlmUploadVo vo) {
return null;
}

@Override
public JSONObject getUploadFileList(String category, String pageSize, String pageNumber) {
return AjaxResult.error("查询失败").toJson();
}

@Override
public JSONObject deleteFile(List<String> fileIds) {
return AjaxResult.error("deleteFile fail").toJson();
}
};
}
}

+ 30
- 0
xueyi-api/xueyi-api-system/src/main/java/com/xueyi/system/api/digitalmans/domain/dto/DmH5MenuDto.java 查看文件

@@ -0,0 +1,30 @@
package com.xueyi.system.api.digitalmans.domain.dto;

import com.xueyi.system.api.digitalmans.domain.po.DmH5MenuPo;
import com.xueyi.system.api.digitalmans.domain.po.DmModelPo;
import com.xueyi.system.api.resource.domain.po.DmResourcesPo;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serial;
import java.util.List;

/**
* 模型 数据传输对象
*
* @author xueyi
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class DmH5MenuDto extends DmH5MenuPo {

@Serial
private static final long serialVersionUID = 1L;

protected List<DmScreenIconDto> dmScreenIconDto;


protected List<DmH5MenuDto> children;

protected Integer level;
}

+ 1
- 1
xueyi-api/xueyi-api-system/src/main/java/com/xueyi/system/api/digitalmans/domain/dto/DmModelDto.java 查看文件

@@ -41,6 +41,6 @@ public class DmModelDto extends DmModelPo {
protected String name;

// @Correlation(groupName = Model_DmModelIcon_GROUP, keyType = OperateConstants.SubKeyType.RECEIVE)
protected List<DmScreenIconDto> dmScreenIconDtos;
protected List<DmH5MenuDto> H5Menus;

}

xueyi-api/xueyi-api-system/src/main/java/com/xueyi/system/api/digitalmans/domain/merge/DmModelIconMerge.java → xueyi-api/xueyi-api-system/src/main/java/com/xueyi/system/api/digitalmans/domain/merge/DmMenuIconMerge.java 查看文件

@@ -20,8 +20,8 @@ import java.io.Serial;
@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@TableName("dm_model_icon_merge")
public class DmModelIconMerge extends TBasisEntity {
@TableName("dm_menu_icon_merge")
public class DmMenuIconMerge extends TBasisEntity {

@Serial
private static final long serialVersionUID = 1L;
@@ -29,24 +29,26 @@ public class DmModelIconMerge extends TBasisEntity {

/** 招待任务id */
@Correlations({
@Correlation(groupName = MergeGroup.Model_DmModelIcon_GROUP, keyType = OperateConstants.SubKeyType.MERGE_MAIN),
@Correlation(groupName = MergeGroup.Icon_DmModelIcon_GROUP, keyType = OperateConstants.SubKeyType.MERGE_SLAVE)
@Correlation(groupName = MergeGroup.Menu_DmMenuIcon_GROUP, keyType = OperateConstants.SubKeyType.MERGE_MAIN),
@Correlation(groupName = MergeGroup.Icon_DmMenuIcon_GROUP, keyType = OperateConstants.SubKeyType.MERGE_SLAVE)
})
protected Long modelId;
protected Long menuId;;

/** 访客id */
@Correlations({
@Correlation(groupName = MergeGroup.Icon_DmModelIcon_GROUP, keyType = OperateConstants.SubKeyType.MERGE_MAIN),
@Correlation(groupName = MergeGroup.Model_DmModelIcon_GROUP, keyType = OperateConstants.SubKeyType.MERGE_SLAVE)
@Correlation(groupName = MergeGroup.Icon_DmMenuIcon_GROUP, keyType = OperateConstants.SubKeyType.MERGE_MAIN),
@Correlation(groupName = MergeGroup.Menu_DmMenuIcon_GROUP, keyType = OperateConstants.SubKeyType.MERGE_SLAVE)
})
protected Long iconId;



/** 优先级 */
protected Integer pos;

public DmModelIconMerge(Long modelId, Long iconId, Integer pos) {
this.modelId = modelId;
public DmMenuIconMerge(Long iconId, Long menuId, Integer pos) {
this.iconId = iconId;
this.menuId = menuId;
this.pos = pos;
}
}

+ 3
- 0
xueyi-api/xueyi-api-system/src/main/java/com/xueyi/system/api/digitalmans/domain/merge/MergeGroup.java 查看文件

@@ -13,4 +13,7 @@ public interface MergeGroup {
String Resource_DmBroadcastResource_GROUP = "Resource_DmBroadcastResource_GROUP";
String Model_DmModelIcon_GROUP = "Model_DmModelIcon_GROUP";
String Icon_DmModelIcon_GROUP = "Icon_DmModelIcon_GROUP";

String Icon_DmMenuIcon_GROUP = "Icon_DmMenuIcon_GROUP";
String Menu_DmMenuIcon_GROUP = "Menu_DmMenuIcon_GROUP";
}

+ 4
- 0
xueyi-api/xueyi-api-system/src/main/java/com/xueyi/system/api/digitalmans/domain/po/DmDigitalmanExtPo.java 查看文件

@@ -38,6 +38,10 @@ public class DmDigitalmanExtPo extends TBaseEntity {
@Excel(name = "ip地址")
protected String ipAddr;

/** 推流地址 */
@Excel(name = "推流地址")
protected String streamAddress;

/** 访客公司 */
@Excel(name = "访客公司")
protected String license;


+ 40
- 0
xueyi-api/xueyi-api-system/src/main/java/com/xueyi/system/api/digitalmans/domain/po/DmH5MenuPo.java 查看文件

@@ -0,0 +1,40 @@
package com.xueyi.system.api.digitalmans.domain.po;

import com.baomidou.mybatisplus.annotation.TableName;
import com.xueyi.common.core.annotation.Excel;
import com.xueyi.common.core.web.entity.base.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serial;
import java.util.Date;

import static com.xueyi.common.core.constant.basic.EntityConstants.REMARK;

/**
* 数字人设备管理 持久化对象
*
* @author xueyi
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName(value = "dm_h5_menu", excludeProperty = { REMARK })
public class DmH5MenuPo extends BaseEntity {

@Serial
private static final long serialVersionUID = 1L;

/** 租户名 */
@Excel(name = "父节点id")
protected Long parentId;

/** 菜单名 */
@Excel(name = "菜单名")
protected String title;

/** 菜单类型 */
@Excel(name = "菜单类型")
protected String menuType;


}

+ 36
- 0
xueyi-api/xueyi-api-system/src/main/java/com/xueyi/system/api/digitalmans/domain/po/DmH5TenantMenuPo.java 查看文件

@@ -0,0 +1,36 @@
package com.xueyi.system.api.digitalmans.domain.po;

import com.baomidou.mybatisplus.annotation.TableName;
import com.xueyi.common.core.annotation.Excel;
import com.xueyi.common.core.web.tenant.base.TBaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serial;

import static com.xueyi.common.core.constant.basic.EntityConstants.*;


/**
* 数字人主界面图标 持久化对象
*
* @author xueyi
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName(value = "dm_h5_tenant_menu_merge", excludeProperty = { STATUS,SORT,CREATE_TIME,CREATE_BY,UPDATE_TIME,UPDATE_BY,DEL_FLAG,REMARK })
public class DmH5TenantMenuPo extends TBaseEntity {

@Serial
private static final long serialVersionUID = 1L;

/** 图片id */
@Excel(name = "图片id")
protected Long menuId;

/** 广播id */
@Excel(name = "广播id")
protected Long tenantId;


}

+ 5
- 0
xueyi-api/xueyi-api-system/src/main/java/com/xueyi/system/api/digitalmans/domain/po/DmManDevicePo.java 查看文件

@@ -64,4 +64,9 @@ public class DmManDevicePo extends BaseEntity {
@Excel(name = "apk版本")
protected String apkVersion;

/* 推流地址 */
@Excel(name = "推流地址")
protected String streamUrl;

protected String configCreated;
}

xueyi-api/xueyi-api-system/src/main/java/com/xueyi/system/api/digitalmans/domain/po/DmModelIconPo.java → xueyi-api/xueyi-api-system/src/main/java/com/xueyi/system/api/digitalmans/domain/po/DmMenuIconPo.java 查看文件

@@ -18,15 +18,15 @@ import static com.xueyi.common.core.constant.basic.EntityConstants.*;
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName(value = "dm_model_icon_merge", excludeProperty = { STATUS,SORT,CREATE_TIME,CREATE_BY,UPDATE_TIME,UPDATE_BY,DEL_FLAG,REMARK })
public class DmModelIconPo extends TBaseEntity {
@TableName(value = "dm_menu_icon_merge", excludeProperty = { STATUS,SORT,CREATE_TIME,CREATE_BY,UPDATE_TIME,UPDATE_BY,DEL_FLAG,REMARK })
public class DmMenuIconPo extends TBaseEntity {

@Serial
private static final long serialVersionUID = 1L;

/** 图片id */
@Excel(name = "图片id")
protected Long modelId;
protected Long menuId;

/** 广播id */
@Excel(name = "广播id")

+ 2
- 0
xueyi-api/xueyi-api-system/src/main/java/com/xueyi/system/api/digitalmans/domain/po/DmScreenIconPo.java 查看文件

@@ -35,6 +35,8 @@ public class DmScreenIconPo extends TBaseEntity {
@Excel(name = "状态", readConverterExp = "0=:正常;1:停用")
protected String status;

protected String url;

/** 备注 */
@Excel(name = "备注")
protected String remark;


+ 16
- 0
xueyi-api/xueyi-api-system/src/main/java/com/xueyi/system/api/digitalmans/domain/query/DmH5MenuQuery.java 查看文件

@@ -0,0 +1,16 @@
package com.xueyi.system.api.digitalmans.domain.query;

import com.xueyi.system.api.digitalmans.domain.po.DmH5MenuPo;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
* 数字人设备管理 持久化对象
* 菜单查询对象 dm_h5_menu
*/
@Data
@NoArgsConstructor
public class DmH5MenuQuery extends DmH5MenuPo {


}

+ 21
- 0
xueyi-api/xueyi-api-system/src/main/java/com/xueyi/system/api/digitalmans/domain/vo/DmH5MenuVo.java 查看文件

@@ -0,0 +1,21 @@
package com.xueyi.system.api.digitalmans.domain.vo;

import com.xueyi.system.api.digitalmans.domain.dto.DmH5MenuDto;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serial;
import java.io.Serializable;
import java.util.List;

@Data
@NoArgsConstructor
public class DmH5MenuVo implements Serializable {

@Serial
private static final long serialVersionUID = 1L;

protected String devId;

protected List<DmH5MenuDto> menuList;
}

+ 29
- 0
xueyi-api/xueyi-api-system/src/main/java/com/xueyi/system/api/digitalmans/feign/RemoteModelService.java 查看文件

@@ -0,0 +1,29 @@
package com.xueyi.system.api.digitalmans.feign;

import com.xueyi.common.core.constant.basic.SecurityConstants;
import com.xueyi.common.core.constant.basic.ServiceConstants;
import com.xueyi.common.core.web.result.R;
import com.xueyi.system.api.digitalmans.domain.dto.DmH5MenuDto;
import com.xueyi.system.api.digitalmans.domain.query.DmH5MenuQuery;
import com.xueyi.system.api.digitalmans.domain.vo.DmBatchQuestionsVo;
import com.xueyi.system.api.digitalmans.domain.vo.DmH5MenuVo;
import com.xueyi.system.api.digitalmans.domain.vo.DmReceptionVo;
import com.xueyi.system.api.organize.feign.factory.RemoteUserFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(contextId = "remoteModelService", value = ServiceConstants.SYSTEM_SERVICE, fallbackFactory = RemoteUserFallbackFactory.class)
public interface RemoteModelService {


@GetMapping("/model/inner/menu_list")
@ResponseBody
public R<List<DmH5MenuDto>> getMenuList(@RequestParam(value = "devId")String devId, @RequestHeader(SecurityConstants.ENTERPRISE_ID) Long enterpriseId, @RequestHeader(SecurityConstants.SOURCE_NAME) String sourceName, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);


@PostMapping("/model/inner/menu_list")
@ResponseBody
public R<Integer> updateMenuList(@RequestBody DmH5MenuVo vo, @RequestHeader(SecurityConstants.ENTERPRISE_ID) Long enterpriseId, @RequestHeader(SecurityConstants.SOURCE_NAME) String sourceName, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
}

+ 3
- 0
xueyi-api/xueyi-api-system/src/main/java/com/xueyi/system/api/resource/feign/RemoteH5ConfigService.java 查看文件

@@ -11,4 +11,7 @@ public interface RemoteH5ConfigService {

@GetMapping("/h5config/inner/syncH5Config")
R<String> syncH5Config(@RequestParam(value = "tId",required = false) String tId);

@GetMapping("/h5config/inner/syncH5Config")
public R<String> syncH5Config(@RequestParam(value = "tId", required = false) String tId, @RequestParam(value = "manCode", required = false) String manCode);
}

+ 4
- 0
xueyi-api/xueyi-api-system/src/main/java/com/xueyi/system/api/resource/feign/factory/RemoteH5ConfigFallbackFactory.java 查看文件

@@ -16,6 +16,10 @@ public class RemoteH5ConfigFallbackFactory implements FallbackFactory<RemoteH5Co
public R<String> syncH5Config(String tId) {
return R.fail("同步配置文件失败");
}

public R<String> syncH5Config(String tId, String manCode) {
return R.fail("同步配置文件失败");
}
};
}
}

+ 0
- 6
xueyi-api/xueyi-api-system/xueyi-api-system.iml 查看文件

@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module version="4">
<component name="SonarLintModuleSettings">
<option name="uniqueId" value="be06f51a-0801-4f8b-8a91-bd836ed8ecf6" />
</component>
</module>

+ 4
- 0
xueyi-auth/src/main/resources/bootstrap.yml 查看文件

@@ -16,6 +16,8 @@ spring:
# 服务注册地址
server-addr: @nacos.host@:@nacos.port@
namespace: @nacos.namespace@
username: @nacos.username@
password: @nacos.password@
config:
# 配置中心地址
server-addr: @nacos.host@:@nacos.port@
@@ -27,3 +29,5 @@ spring:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
- application-secret-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
- application-datasource-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
username: @nacos.username@
password: @nacos.password@

+ 65
- 1
xueyi-common/xueyi-common-core/src/main/java/com/xueyi/common/core/utils/file/FileUtil.java 查看文件

@@ -2,10 +2,18 @@ package com.xueyi.common.core.utils.file;

import com.xueyi.common.core.utils.core.StrUtil;
import org.apache.commons.lang3.ArrayUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;

@@ -16,6 +24,7 @@ import java.nio.charset.StandardCharsets;
*/
public class FileUtil extends cn.hutool.core.io.FileUtil {

private static Logger logger = LoggerFactory.getLogger(FileUtil.class);
/**
* 字符常量:斜杠 {@code '/'}
*/
@@ -210,4 +219,59 @@ public class FileUtil extends cn.hutool.core.io.FileUtil {
String encode = URLEncoder.encode(s, StandardCharsets.UTF_8.toString());
return encode.replaceAll("\\+", "%20");
}


public static void mergeFile(File[] files, File destFile) {
if (files == null || files.length == 0) {
return;
}

if (destFile == null) {
destFile = new File("");
}

if (destFile.exists()) {
destFile.delete();
}
//将文件合并
FileOutputStream fos = null;
try {
fos = new FileOutputStream(destFile);
for (File file : files) {
logger.info("merge file:{},fileSize:{}", file.getAbsolutePath(),FileUtil.size(file));
FileInputStream fis = new FileInputStream(file);
byte[] bytes = new byte[1024];
int len = 0;
while ((len = fis.read(bytes)) != -1) {
fos.write(bytes, 0, len);
}
fis.close();
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
fos.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}

public static String getFileNameNoExt(String fileName) {
if (fileName == null) {
return null;
}
int point = fileName.lastIndexOf('.');
return fileName.substring(0, point);
}

public static String getFileExt(String fileName) {
if (fileName == null) {
return null;
}
int point = fileName.lastIndexOf('.');
return fileName.substring(point + 1);
}

}

+ 52
- 1
xueyi-common/xueyi-common-redis/src/main/java/com/xueyi/common/redis/utils/RedisUtil.java 查看文件

@@ -37,10 +37,61 @@ public class RedisUtil {
}

public static List<JSONObject> getJsonList(String key) {
return redisTemplate.opsForList().range(key, 0, -1).stream().map(json-> JSONObject.parseObject(json.toString())).collect(Collectors.toList());
return redisTemplate.opsForList().range(key, 0, 10).stream().map(json-> JSONObject.parseObject(json.toString())).collect(Collectors.toList());
}

public static List<Serializable> getList(String key) {
return redisTemplate.opsForList().range(key, 0, -1);
}

public static List<String> getBytesList(String key) {
List<Serializable> sers = redisTemplate.opsForList().range(key, 0, -1);
return sers.stream().map(ser-> (String) ser).collect(Collectors.toList());
}

public static void setBytesList(String key, byte[] bytes) {
redisTemplate.opsForList().leftPush(key, bytes);
}

public static Long getListCount(String key) {
return redisTemplate.opsForList().size(key);
}

public static Boolean existed(String key){
return redisTemplate.hasKey(key);
}

public static void setVal(String key, Serializable value) {
redisTemplate.opsForValue().set(key, value);
}

public static void setVal(String key, Serializable value, int seconds) {
redisTemplate.opsForValue().set(key, value, seconds, TimeUnit.SECONDS);
}

public static Serializable getVal(String key) {
return redisTemplate.opsForValue().get(key);
}

public static void increment(String key){
increment(key, 1L);
}

public static void increment(String key, long increment){
redisTemplate
.opsForValue()
.increment(key, increment);
}

public static void decrement(String key){
decrement(key, 1L);
}

public static void decrement(String key, long decrement){
redisTemplate
.opsForValue()
.decrement(key, decrement);
}


}

+ 4
- 0
xueyi-gateway/src/main/resources/bootstrap.yml 查看文件

@@ -16,6 +16,8 @@ spring:
# 服务注册地址
server-addr: @nacos.host@:@nacos.port@
namespace: @nacos.namespace@
username: @nacos.username@
password: @nacos.password@
config:
# 配置中心地址
server-addr: @nacos.host@:@nacos.port@
@@ -28,6 +30,8 @@ spring:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
- application-secret-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
- application-datasource-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
username: @nacos.username@
password: @nacos.password@
sentinel:
# 取消控制台懒加载
eager: true


+ 98
- 5
xueyi-modules/xueyi-file/src/main/java/com/xueyi/file/controller/SysFileController.java 查看文件

@@ -1,12 +1,17 @@
package com.xueyi.file.controller;


import cn.hutool.core.text.CharSequenceUtil;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson2.JSONArray;
import com.xueyi.common.core.constant.basic.SecurityConstants;
import com.xueyi.common.core.utils.core.IdUtil;
import com.xueyi.common.core.utils.file.FileTypeUtil;
import com.xueyi.common.core.utils.file.FileUtil;
import com.xueyi.common.core.utils.file.MimeTypeUtil;
import com.xueyi.common.core.web.result.AjaxResult;
import com.xueyi.common.core.web.result.R;
import com.xueyi.common.redis.utils.RedisUtil;
import com.xueyi.file.api.domain.DigitalmanLogFile;
import com.xueyi.file.api.domain.SysFile;
import com.xueyi.file.api.feign.RemoteFileManageService;
@@ -56,7 +61,81 @@ public class SysFileController {
* 文件上传 | 内部调用
*/
@PostMapping("/inner/upload")
public R<SysFile> uploadInner(MultipartFile file) {
public R<SysFile> uploadInner(MultipartFile file, String extension, String fileUuid) {
try {
log.info("文件上传开始:名:{}, 类型:{}, uuid:{}" , file.getName(), extension, fileUuid);
// 上传并返回访问地址
String url = sysFileService.uploadExactFile(file, extension);
SysFile sysFile = new SysFile();
sysFile.setUrl(url);
log.info("文件大小:{}", file.getSize());
sysFile.setSize(file.getSize());
sysFile.setName(FileUtil.getName(url));
sysFile.setNick(sysFile.getName());
remoteFileManageService.saveFileLog(sysFile, SecurityConstants.INNER);

JSONArray ja = new JSONArray();
Long size = sysFile.getSize();

JSONObject jo = new JSONObject();
jo.put("url", url);
jo.put("size", size);
ja.add(jo);

RedisUtil.setVal("saas:upload:result:"+fileUuid, ja.toJSONString());
RedisUtil.setVal("saas:upload:filename:"+fileUuid, file.getOriginalFilename());
if (CharSequenceUtil.equalsAnyIgnoreCase(extension, MimeTypeUtil.IMAGE_EXTENSION)) {
RedisUtil.setVal("saas:upload:fileType:"+fileUuid, 1);
}
if (CharSequenceUtil.equalsAnyIgnoreCase(extension, MimeTypeUtil.VIDEO_EXTENSION)) {
RedisUtil.setVal("saas:upload:fileType:"+fileUuid, 2);
}
return R.ok(sysFile);
} catch (Exception e) {
log.error("上传文件失败", e);
return R.fail(e.getMessage());
}
}

@PostMapping("/inner/uploadNoAsync")
public R<SysFile> uploadNoAsyncInner(MultipartFile file, String extension, String fileUuid) {
try {
log.info("文件上传开始:名:{}, 类型:{}, uuid:{}" , file.getName(), extension, fileUuid);
// 上传并返回访问地址
String url = sysFileService.uploadExactFile(file, extension);
SysFile sysFile = new SysFile();
sysFile.setUrl(url);
log.info("文件大小:{}", file.getSize());
sysFile.setSize(file.getSize());
sysFile.setName(FileUtil.getName(url));
sysFile.setNick(sysFile.getName());
remoteFileManageService.saveFileLog(sysFile, SecurityConstants.INNER);

JSONArray ja = new JSONArray();
Long size = sysFile.getSize();

JSONObject jo = new JSONObject();
jo.put("url", url);
jo.put("size", size);
ja.add(jo);

RedisUtil.setVal("saas:upload:result:"+fileUuid, ja.toJSONString());
RedisUtil.setVal("saas:upload:filename:"+fileUuid, file.getOriginalFilename());
if (CharSequenceUtil.equalsAnyIgnoreCase(extension, MimeTypeUtil.IMAGE_EXTENSION)) {
RedisUtil.setVal("saas:upload:fileType:"+fileUuid, 1);
}
if (CharSequenceUtil.equalsAnyIgnoreCase(extension, MimeTypeUtil.VIDEO_EXTENSION)) {
RedisUtil.setVal("saas:upload:fileType:"+fileUuid, 2);
}
return R.ok(sysFile);
} catch (Exception e) {
log.error("上传文件失败", e);
return R.fail(e.getMessage());
}
}

@PostMapping("/inner/uploadFace")
public R<SysFile> uploadFaceInner(MultipartFile file) {
try {
log.info("文件上传开始:{}" , file.getName());
// 上传并返回访问地址
@@ -99,7 +178,7 @@ public class SysFileController {
* 文件上传 | 内部调用
*/
@PostMapping("/inner/uploadpdf")
public R<List<SysFile>> uploadPdfInner(MultipartFile file) {
public R<List<SysFile>> uploadPdfInner(MultipartFile file, String fileUuid) {
try {
Long startTs = System.currentTimeMillis();
log.info("文件上传开始:{}; start ts:{}", file.getName(), startTs);
@@ -130,8 +209,22 @@ public class SysFileController {
log.info("上传第 {} 张图片完成。。。",(num-1));
};
long endTs = System.currentTimeMillis();
log.info("上传图片结束。。。,用时:{} ms", (endTs-pdfTs));
log.info("上传图片结束。。。,图片上传用时:{} ms,总用时:{} ms", (endTs-pdfTs), (endTs-startTs));

JSONArray ja = new JSONArray();
for (SysFile sf : results) {
String url = sf.getUrl();
Long size = sf.getSize();

JSONObject jo = new JSONObject();
jo.put("url", url);
jo.put("size", size);
ja.add(jo);
}

RedisUtil.setVal("saas:upload:result:"+fileUuid, ja.toJSONString());
RedisUtil.setVal("saas:upload:filename:"+fileUuid, file.getOriginalFilename());
RedisUtil.setVal("saas:upload:fileType:"+fileUuid, 1);
return R.ok(results);
} catch (Exception e) {
log.error("上传文件失败", e);
@@ -176,7 +269,7 @@ public class SysFileController {
*/
@PostMapping("/upload")
public AjaxResult upload(MultipartFile file) {
R<SysFile> R = uploadInner(file);
R<SysFile> R = uploadInner(file, FileTypeUtil.getExtension(file), IdUtil.randomUUID());
return R.isOk()
? AjaxResult.success("上传成功!", R.getData().getUrl())
: AjaxResult.error("上传失败!");
@@ -186,7 +279,7 @@ public class SysFileController {
*/
@PostMapping("/uploadpdf")
public AjaxResult uploadPdf(MultipartFile file) {
R<List<SysFile>> R = uploadPdfInner(file);
R<List<SysFile>> R = uploadPdfInner(file, IdUtil.randomUUID());
return R.isOk()
? AjaxResult.success("上传成功!", R.getData())
: AjaxResult.error("上传失败!");


+ 5
- 0
xueyi-modules/xueyi-file/src/main/java/com/xueyi/file/service/FastDfsSysFileServiceImpl.java 查看文件

@@ -41,6 +41,11 @@ public class FastDfsSysFileServiceImpl implements ISysFileService {
return domain + "/" + storePath.getFullPath();
}

@Override
public String uploadExactFile(MultipartFile file, String extension) throws Exception {
return null;
}

@Override
public String uploadTempFile(MultipartFile file) throws Exception {
return null;


+ 1
- 0
xueyi-modules/xueyi-file/src/main/java/com/xueyi/file/service/ISysFileService.java 查看文件

@@ -18,6 +18,7 @@ public interface ISysFileService {
* @return 访问地址
*/
String uploadFile(MultipartFile file) throws Exception;
String uploadExactFile(MultipartFile file, String extension) throws Exception;
String uploadTempFile(MultipartFile file) throws Exception;
String uploadFile(String fileName, File file) throws Exception;



+ 5
- 0
xueyi-modules/xueyi-file/src/main/java/com/xueyi/file/service/LocalSysFileServiceImpl.java 查看文件

@@ -40,6 +40,11 @@ public class LocalSysFileServiceImpl implements ISysFileService {
return domain + localFilePrefix + name;
}

@Override
public String uploadExactFile(MultipartFile file, String extension) throws Exception {
return null;
}

@Override
public String uploadTempFile(MultipartFile file) throws Exception {
return null;


+ 30
- 0
xueyi-modules/xueyi-file/src/main/java/com/xueyi/file/service/MinioSysFileServiceImpl.java 查看文件

@@ -5,6 +5,8 @@ import com.xueyi.file.utils.FileUploadUtils;
import io.minio.MinioClient;
import io.minio.PutObjectArgs;
import io.minio.RemoveObjectArgs;
import io.minio.messages.Retention;
import io.minio.messages.RetentionMode;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.slf4j.Logger;
@@ -19,6 +21,7 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.net.URLEncoder;
import java.time.ZonedDateTime;

/**
* Minio 文件存储
@@ -63,6 +66,31 @@ public class MinioSysFileServiceImpl implements ISysFileService {
return minioConfig.getUrl() + "/" + minioConfig.getBucketName() + "/" + fileName;
}

@Override
public String uploadExactFile(MultipartFile file, String extension) throws Exception {
String fileName = FileUploadUtils.extractFilename(file).replaceAll(extension, "");
if (fileName.charAt(fileName.length() - 1) == '.') {
fileName += extension;
} else {
fileName += "." + extension;
}
//fileName = URLEncoder.encode(fileName, "UTF-8");
log.info("Minio filename: {}" , fileName);
PutObjectArgs args = PutObjectArgs.builder()
.bucket(minioConfig.getBucketName())
.object(fileName)
.stream(file.getInputStream(), file.getSize(), -1)
.contentType(file.getContentType())
.build();
client.putObject(args);
log.info("Minio 文件上传成功");
// 获取fileName的最后一个'/'的位置的字符串,并用URLEncoder进行UTF-8编码后,再拼接到fileName中
String splitStr = fileName.substring(fileName.lastIndexOf("/") + 1);
splitStr = URLEncoder.encode(splitStr, "UTF-8");
fileName = fileName.substring(0, fileName.lastIndexOf("/") + 1) + splitStr;
return minioConfig.getUrl() + "/" + minioConfig.getBucketName() + "/" + fileName;
}

@Override
public String uploadTempFile(MultipartFile file) throws Exception {
return null;
@@ -131,12 +159,14 @@ public class MinioSysFileServiceImpl implements ISysFileService {
String fileName = file.getName();
// 获取fileName的最后一个'/'的位置的字符串,并用URLEncoder进行UTF-8编码后,再拼接到fileName中
// 使用PutObjectArgs上传文件到MinIO
ZonedDateTime end = ZonedDateTime.now().plusDays(90); // Set the end time to 90 days from now
client.putObject(
PutObjectArgs.builder()
.bucket(minioConfig.getBucketName())
.object(fileName)
.stream(new FileInputStream(file), file.length(), -1)
.contentType("application/octet-stream")
.retention(new Retention(RetentionMode.COMPLIANCE, end))
.build()
);



+ 5
- 1
xueyi-modules/xueyi-file/src/main/resources/bootstrap.yml 查看文件

@@ -20,6 +20,8 @@ spring:
# 服务注册地址
server-addr: @nacos.host@:@nacos.port@
namespace: @nacos.namespace@
username: @nacos.username@
password: @nacos.password@
config:
# 配置中心地址
server-addr: @nacos.host@:@nacos.port@
@@ -30,4 +32,6 @@ spring:
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
- application-secret-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
- application-datasource-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
- application-datasource-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
username: @nacos.username@
password: @nacos.password@

+ 4
- 0
xueyi-modules/xueyi-job/src/main/resources/bootstrap.yml 查看文件

@@ -16,6 +16,8 @@ spring:
# 服务注册地址
server-addr: @nacos.host@:@nacos.port@
namespace: @nacos.namespace@
username: @nacos.username@
password: @nacos.password@
config:
# 配置中心地址
server-addr: @nacos.host@:@nacos.port@
@@ -27,3 +29,5 @@ spring:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
- application-secret-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
- application-datasource-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
username: @nacos.username@
password: @nacos.password@

+ 38
- 45
xueyi-modules/xueyi-message/src/main/java/com/xueyi/message/transfer/controller/ApiController.java 查看文件

@@ -29,6 +29,8 @@ import com.xueyi.system.api.organize.domain.dto.SysEnterpriseDto;
import com.xueyi.system.api.resource.feign.RemoteH5ConfigService;
import com.xueyi.system.api.staff.domain.vo.DmStaffFeature;
import com.xueyi.system.api.staff.feign.RemoteStaffService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.PathVariable;
@@ -49,6 +51,8 @@ import java.util.stream.Collectors;
@RequestMapping("api")
public class ApiController {

private static final Logger log = LoggerFactory.getLogger(ApiController.class);

@Autowired
RemoteStaffService remoteStaffService;

@@ -83,12 +87,11 @@ public class ApiController {
RemoteH5ConfigService remoteH5ConfigService;



@RequestMapping(value = "/heartbeat", method = {RequestMethod.POST})
@ResponseBody
public AjaxResult heartbeat(@RequestBody DmDeviceVo vo, HttpServletResponse response) {
Long sysTime = System.currentTimeMillis();
System.out.println("heartbeat: device: " + vo.getDevId() + " timestamp: " + sysTime);
log.info("heartbeat: device: {} timestamp: {} ",vo.getDevId(), sysTime);
Integer dex_res = 0;
// 根据设备id获取租户信息
R<DmManDeviceDto> manDeviceDtoR = manDeviceService.manDeviceInfoInner(vo.getDevId());
@@ -102,7 +105,7 @@ public class ApiController {
}

// 更新心跳
redisTemplate.opsForValue().set("group:dgman:" + vo.getDevId() + ":" + MessageConstants.HEART_BEAT_SYNC,String.valueOf(sysTime));
redisTemplate.opsForValue().set("group:dgman:" + vo.getDevId() + ":" + MessageConstants.HEART_BEAT_SYNC, String.valueOf(sysTime));

String timestamp = redisTemplate.opsForValue().get("group:dgman:" + manDeviceDtoR.getData().getTId() + ":" + MessageConstants.STAFF_SYNC);

@@ -147,15 +150,14 @@ public class ApiController {
@RequestMapping(value = "/update", method = {RequestMethod.POST})
@ResponseBody
public AjaxResult update(@RequestBody DmDeviceVo vo, HttpServletResponse response) {
System.out.println(vo.toString());
String timestamp = vo.getTimestamp();
// 根据设备id获取租户信息
R<DmManDeviceDto> manDeviceDtoR = manDeviceService.manDeviceInfoInner(vo.getDevId());
if (manDeviceDtoR.isFail() || manDeviceDtoR.getData() == null ) {
if (manDeviceDtoR.isFail() || manDeviceDtoR.getData() == null) {
return AjaxResult.warn("设备号获取失败,请检查");
}
Source source = SourceUtil.getSourceCache(manDeviceDtoR.getData().getStrategyId());
if (vo.getType() !=null) {
if (vo.getType() != null) {
switch (vo.getType()) {
// 人员信息
case 0:
@@ -176,7 +178,7 @@ public class ApiController {
});
return AjaxResult.success(staffFeatureList.getData()).put("timestamp", timestamp);
case 1:
System.out.println("=========租户号:" + manDeviceDtoR.getData().getTId() + ", 数据源: " + source.getMaster() + " 设备号:" + vo.getDevId());
log.info("=========租户号:{},数据源:{}, 设备号:{}",manDeviceDtoR.getData().getTId(), source.getMaster(), vo.getDevId());
R<List<DmSkillDto>> skillList = remoteSkillService.skilllistInner(vo.getDevId(), vo.getTimestamp(), manDeviceDtoR.getData().getTId(), source.getMaster(), SecurityConstants.INNER);
if (skillList.isFail())
return AjaxResult.warn("新增失败,请检查");
@@ -194,7 +196,7 @@ public class ApiController {
return AjaxResult.success(syncDmDto.getData()).put("timestamp", timestamp);
case 3:
R<DmReceptionVo> receptionVo = remoteReceptionService.getReceptionTaskInner(manDeviceDtoR.getData().getManCode(), manDeviceDtoR.getData().getTId(), source.getMaster(), SecurityConstants.INNER);
if (receptionVo.isFail()){
if (receptionVo.isFail()) {
return AjaxResult.warn("接待模式任务获取失败,请检查");
}

@@ -219,7 +221,7 @@ public class ApiController {
// jsObject.put("msg","success");
return AjaxResult.success(receptionVo.getData());
case 4:
R<String> propertyR = remoteH5ConfigService.syncH5Config(manDeviceDtoR.getData().getTId().toString());
R<String> propertyR = remoteH5ConfigService.syncH5Config(manDeviceDtoR.getData().getTId().toString(), manDeviceDtoR.getData().getManCode().toString());
if (propertyR.isFail()) {
return AjaxResult.warn("配置同步失败,请检查");
}
@@ -238,7 +240,7 @@ public class ApiController {
}

// 根据密钥获取账户信息
R<DeviceTenantSourceMergeVo> deviceTenantSourceMergeVoR = deviceTenantMergeServicel.selectDeviceSNTenantSourceMerge(vo.getSncode(),vo.getSecret());
R<DeviceTenantSourceMergeVo> deviceTenantSourceMergeVoR = deviceTenantMergeServicel.selectDeviceSNTenantSourceMerge(vo.getSncode(), vo.getSecret());
if (deviceTenantSourceMergeVoR.isFail()) {
return AjaxResult.warn(deviceTenantSourceMergeVoR.getMsg());
}
@@ -253,13 +255,13 @@ public class ApiController {
return AjaxResult.warn("更新设备信息失败,请查询log");
}
// 调用初始化处理(数字人,数字人设备,形象,技能)
R<Integer> initResult = remoteDigitalmanService.initInner(vo.getSecret(),deviceTenantSourceMergeVoR.getData().getTenantId(),deviceTenantSourceMergeVoR.getData().getSourceSlave(),SecurityConstants.INNER);
R<Integer> initResult = remoteDigitalmanService.initInner(vo.getSecret(), deviceTenantSourceMergeVoR.getData().getTenantId(), deviceTenantSourceMergeVoR.getData().getSourceSlave(), SecurityConstants.INNER);
// 根据状态返回结果
if (initResult.isFail()) {
return AjaxResult.warn("绑定数字人失败,请联系后台人员");
}
// 更新心跳状态
redisTemplate.opsForValue().set("group:dgman:" + vo.getSncode() + ":" + MessageConstants.HEART_BEAT_SYNC,String.valueOf(System.currentTimeMillis()));
redisTemplate.opsForValue().set("group:dgman:" + vo.getSncode() + ":" + MessageConstants.HEART_BEAT_SYNC, String.valueOf(System.currentTimeMillis()));
//redisTemplate.opsForHash().(MessageConstants.REDIS_GROUP_DEVICE_HEADER,devId,dto);
//redisTemplate.
return AjaxResult.success();
@@ -267,12 +269,10 @@ public class ApiController {

/**
* 获取设备在线状态
*
*
*/
@RequestMapping(value = "/device_online_status/{devId}", method = {RequestMethod.GET})
@ResponseBody
public AjaxResult getDeviceOnlineStatus(@RequestParam(value = "devId") String devId, HttpServletResponse response){
public AjaxResult getDeviceOnlineStatus(@RequestParam(value = "devId") String devId, HttpServletResponse response) {
// 获取设备心跳状态
String timestamp = redisTemplate.opsForValue().get("group:dgman:" + devId + ":" + MessageConstants.HEART_BEAT_SYNC);

@@ -286,53 +286,44 @@ public class ApiController {
return AjaxResult.success(InitConstants.DEVICE_ACTIVATE_STATUS_OFFLINE);
}
// 设备存在缓存时判断是否超过10min
return AjaxResult.success(System.currentTimeMillis() - Long.parseLong(timestamp) >10 * 60 * 1000 ? InitConstants.DEVICE_ACTIVATE_STATUS_OFFLINE : InitConstants.DEVICE_ACTIVATE_STATUS_ONLINE);
return AjaxResult.success(System.currentTimeMillis() - Long.parseLong(timestamp) > 10 * 60 * 1000 ? InitConstants.DEVICE_ACTIVATE_STATUS_OFFLINE : InitConstants.DEVICE_ACTIVATE_STATUS_ONLINE);
}

/**
* @Author yangkai
* @Description //TODO
* @Date 2023/8/11
* @Param
* @return
*
*
* manCount
* @return manCount
* serviceTimeCount
* chatTimes
* chatDurationCount
* skillExecuteTimes
*
* <p>
* recognizedPersonCount
* servicePerCount
*
* <p>
* receptionServiceCount
* meetingServiceCount
* visitServiceCount
* largeModelKnowledgeBaseGroupChangeNum
* largeModelKnowledgeBaseChangeNum
* @Author yangkai
* @Description //TODO
* @Date 2023/8/11
* @Param
**/
@RequestMapping(value = "/broadcast", method = {RequestMethod.GET})
@ResponseBody
public R broadcast(@RequestParam(value = "channel") String channel){
public R broadcast(@RequestParam(value = "channel") String channel) {
try {
JSONObject json = new JSONObject();
/*json.put("chatTimes", 865531);
json.put("chatDurationCount", 10068);
// json.put("skillExecuteTimes", 10);
json.put("recognizedPersonCount", 13899);
json.put("receptionServiceCount", 1824);
json.put("meetingServiceCount", 1762);
json.put("visitServiceCount", 523);*/

R<JSONObject> objectR = remoteDigitalmanService.mansInfo();
JSONObject jsonObj = objectR.getData();
jsonObj.keySet().forEach(key -> json.put(key, jsonObj.get(key)));
String str = json.toJSONString();

messageQueueService.broadcast(channel, str);
log.info("broadcast----exec");
JSONObject json = new JSONObject();
R<JSONObject> objectR = remoteDigitalmanService.mansInfo();
log.info("mansInfo:{}", objectR.getData());
JSONObject jsonObj = objectR.getData();
jsonObj.keySet().forEach(key -> json.put(key, jsonObj.get(key)));
String str = json.toJSONString();
log.info("broadcast:{}", str);
messageQueueService.broadcast(channel, str);
return R.ok(str);
}catch (Exception e){
} catch (Exception e) {
e.printStackTrace();
return R.fail(e.getMessage());
}
@@ -346,7 +337,7 @@ public class ApiController {

return AjaxResult.success("false");
}
System.out.println(manDeviceDtR.getData().toString());
log.info(manDeviceDtR.getData().toString());
return AjaxResult.success("true");
}

@@ -356,10 +347,12 @@ public class ApiController {
// 根据设备id获取租户信息
R<DmManDeviceDto> manDeviceDtoR = manDeviceService.manDeviceInfoInner(deviceId);
String tenantId = null;
String manCode = null;
if (manDeviceDtoR.isOk() && manDeviceDtoR.getData() != null) {
tenantId = manDeviceDtoR.getData().getTId().toString();
manCode = manDeviceDtoR.getData().getManCode().toString();
}
R<String> propertyR = remoteH5ConfigService.syncH5Config(tenantId);
R<String> propertyR = remoteH5ConfigService.syncH5Config(tenantId, manCode);
if (propertyR.isFail()) {
return AjaxResult.warn("配置同步失败,请检查");
}


+ 5
- 1
xueyi-modules/xueyi-message/src/main/resources/bootstrap.yml 查看文件

@@ -21,6 +21,8 @@ spring:
# 服务注册地址
server-addr: @nacos.host@:@nacos.port@
namespace: @nacos.namespace@
username: @nacos.username@
password: @nacos.password@

config:
# 配置中心地址
@@ -32,4 +34,6 @@ spring:
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
- application-secret-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
- application-datasource-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
- application-datasource-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
username: @nacos.username@
password: @nacos.password@

+ 5
- 1
xueyi-modules/xueyi-modules-auth/src/main/resources/bootstrap.yml 查看文件

@@ -21,6 +21,8 @@ spring:
# 服务注册地址
server-addr: @nacos.host@:@nacos.port@
namespace: @nacos.namespace@
username: @nacos.username@
password: @nacos.password@

config:
# 配置中心地址
@@ -32,4 +34,6 @@ spring:
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
- application-secret-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
- application-datasource-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
- application-datasource-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
username: @nacos.username@
password: @nacos.password@

+ 19
- 0
xueyi-modules/xueyi-nlt/pom.xml 查看文件

@@ -52,6 +52,25 @@
<artifactId>spring-kafka</artifactId>
</dependency>

<!-- Feign框架核心 -->
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-core</artifactId>
<version>11.1</version>
</dependency>
<!-- 支持表单格式,文件上传格式 -->
<dependency>
<groupId>io.github.openfeign.form</groupId>
<artifactId>feign-form</artifactId>
<version>3.8.0</version>
</dependency>
<!-- 文件操作工具类 -->
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.11.0</version>
</dependency>

<!-- XueYi Common Log -->
<dependency>
<groupId>com.xueyi</groupId>


+ 192
- 11
xueyi-modules/xueyi-nlt/src/main/java/com/xueyi/nlt/nlt/controller/DmIntentController.java 查看文件

@@ -2,7 +2,6 @@ package com.xueyi.nlt.nlt.controller;


import co.elastic.clients.elasticsearch.ElasticsearchClient;
import co.elastic.clients.elasticsearch._types.query_dsl.MatchAllQuery;
import co.elastic.clients.elasticsearch._types.query_dsl.MatchQuery;
import co.elastic.clients.elasticsearch.core.SearchResponse;
import co.elastic.clients.elasticsearch.core.search.Hit;
@@ -31,8 +30,13 @@ import com.xueyi.nlt.api.nlt.feign.RemoteLandingLlmService;
import com.xueyi.nlt.api.nlt.feign.RemoteQAService;
import com.xueyi.nlt.netty.client.WebSocketClient;
import com.xueyi.nlt.nlt.domain.dto.DmIntentDto;
import com.xueyi.nlt.api.nlt.domain.dto.DmTenantRegularDto;
import com.xueyi.nlt.nlt.domain.dto.InitRegularExpressionDto;
import com.xueyi.nlt.nlt.domain.query.DmIntentQuery;
import com.xueyi.nlt.api.nlt.domain.query.DmTenantRegularQuery;
import com.xueyi.nlt.nlt.domain.vo.DmKnowledgeLibAskVo;
import com.xueyi.nlt.nlt.domain.vo.IntentTemplateVo;
import com.xueyi.nlt.nlt.domain.vo.MarkRecordVo;
import com.xueyi.nlt.nlt.service.IDmIntentService;
import com.xueyi.nlt.nlt.template.FreeChatTemplate;
import com.xueyi.nlt.nlt.template.GenerativeKnowledgeTemplate;
@@ -44,12 +48,10 @@ import com.xueyi.system.api.digitalmans.feign.RemoteDigitalmanService;
import com.xueyi.system.api.digitalmans.feign.RemoteManDeviceService;
import com.xueyi.system.api.digitalmans.feign.RemoteQuestionanswersService;
import com.xueyi.system.api.digitalmans.feign.RemoteSkillService;
import com.xueyi.system.api.model.LoginUser;
import com.xueyi.system.api.model.Source;
import com.xueyi.system.api.organize.domain.dto.SysEnterpriseDto;
import com.xueyi.system.api.organize.feign.RemoteEnterpriseService;
import com.xueyi.tenant.api.tenant.domain.dto.TeTenantDto;
import com.xueyi.tenant.api.tenant.feign.RemoteTenantService;
import org.apache.commons.lang.time.DateUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -58,18 +60,22 @@ import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import com.xueyi.common.core.constant.digitalman.SkillConstants.SkillType;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.io.Serializable;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;

import static com.xueyi.common.core.constant.digitalman.MessageConstants.SYS_DICT_DATA_SPLITED;
@@ -319,6 +325,14 @@ public class DmIntentController extends BaseController<DmIntentQuery, DmIntentDt

}

public AjaxResult searchQA( DmKnowledgeLibAskVo vo) {
KnowledgeVo knowledgeVo = new KnowledgeVo();
knowledgeVo.setMan_code(null);
knowledgeVo.setTenant_id(vo.getEnterpriseId());
knowledgeVo.setQuestion(vo.getQuestion());
return remoteQAService.query(knowledgeVo);
}

/**
* 联动北方大模型请求
*/
@@ -326,7 +340,53 @@ public class DmIntentController extends BaseController<DmIntentQuery, DmIntentDt
@ResponseBody
public AjaxResult searchQuestionAnswer(@RequestBody DmIntentVo intent) {
log.info("交互对象:{}",intent.toString());

R<DmManDeviceDto> manDeviceDtoR = manDeviceService.manDeviceInfoInner(intent.getDevId());
if (manDeviceDtoR.isFail()) {
return AjaxResult.error("设备号未激活或服务异常");
}
Source source = SourceUtil.getSourceCache(manDeviceDtoR.getData().getStrategyId());
R<List<DmTenantRegularDto>> regularDtosR = remoteIntentService.getRegularList(manDeviceDtoR.getData().getTId(), source.getMaster(), SecurityConstants.INNER);
if (regularDtosR.isFail()) {
return AjaxResult.error("服务异常");
}
log.info("正则表达式:{}",regularDtosR.getData());
List<DmTenantRegularDto> regularDtos = regularDtosR.getData();
IntentTemplateVo voResult = new IntentTemplateVo();
for (DmTenantRegularDto regularDto : regularDtos) {
if (isMatchRegular(intent.getContent(), regularDto.getExpression())) {

if (regularDto.getType().equals("1")) {
JSONObject jo = JSONObject.parseObject(regularDto.getJson());
voResult.setJsonFormat(JSONObject.parseObject(regularDto.getJson()));
voResult.setType("1");
} else {
voResult.setMsg(regularDto.getText());
}
return AjaxResult.success(voResult);
}
}

redisTemplate.opsForValue().increment("dashboard:recognition", 1);

//调用知识库
AjaxResult qaAjax = searchQA(intent);
log.info("知识库返回:{}",qaAjax.toString());
String content = "";
JSONObject qaJson = qaAjax.toJson();
if (qaJson.containsKey("data") && qaJson.getJSONObject("data").getString("accurate").equals("1")) {
JSONObject answer = qaJson.getJSONObject("data").getJSONArray("result").getJSONObject(0);
if (answer!= null) {
voResult.setMsg(answer.getString("answer"));
if (answer.getString("model_type").equals("1")) {
voResult.setTarget(1);
} else {
voResult.setTarget(0);
}
}
return AjaxResult.success(voResult);
}

JSONObject joResult = new JSONObject();
joResult.put("msg","");
joResult.put("target",0);
@@ -342,16 +402,121 @@ public class DmIntentController extends BaseController<DmIntentQuery, DmIntentDt
ja1.add(jo);
testJ.put("messages",ja1);
JSONObject resultJson = remoteLandingLlmService.query(testJ);
JSONArray ja = resultJson.getJSONArray("data");

if (ja.size() > 0) {
joResult.put("msg",ja.getJSONObject(0).get("text"));
joResult.put("target",1);
log.info("北方大返回:{}",resultJson.toString());
if (resultJson.get("status").equals("success")) {
JSONArray ja = resultJson.getJSONArray("data");
if (ja.size() > 0) {
String text = ja.getJSONObject(0).getString("text");
voResult.setMsg(text);
// 判断text是否为纯数字
if (text.matches("[0-9]+")) {
// 纯数字
voResult.setTarget(1);
} else {
// 非纯数字
voResult.setTarget(0);
if (ja.getJSONObject(0).containsKey("filename")) {
// TODO: 2023/9/27 合并知识到知识库
String libName = ja.getJSONObject(0).getString("filename").split("\\.")[0];
// 添加到知识数据库
}
if (ja.getJSONObject(0).containsKey("imageList") && ja.getJSONObject(0).getJSONArray("imageList").size() > 0) {
JSONObject joImage = new JSONObject();
joImage.put("imageUrl",ja.getJSONObject(0).getJSONArray("imageList").getString(0));
joImage.put("text",text);
voResult.setMsg("");
voResult.setTarget(2);
voResult.setFormat(joImage);
}
}
}
}
return AjaxResult.success(joResult);
return AjaxResult.success(voResult);
}



@PostMapping("/knowledgeQuery")
@ResponseBody
public AjaxResult knowledgeQuery(@RequestBody DmKnowledgeLibAskVo knowledgeLibAskVo) {
log.info("用户信息:{}",knowledgeLibAskVo);
// 获取用户信息
LoginUser user = SecurityUtils.getLoginUser();
String enterpriseId = (String)SecurityContextHolder.getLocalMap().get("enterprise_id");
R<SysEnterpriseDto> enterpriseDtoR = enterpriseService.getInfo(Long.parseLong(enterpriseId));
Source source = SourceUtil.getSourceCache(enterpriseDtoR.getData().getStrategyId());
JSONObject result = new JSONObject();
// 通过知识库查询数据
if (knowledgeLibAskVo.getType() == 0) {
// 知识库查询
AjaxResult qaAjax = searchQA(knowledgeLibAskVo);
log.info("知识库返回:{}",qaAjax.toString());
String content = "";
JSONObject qaJson = qaAjax.toJson();
if (qaJson.containsKey("data") && qaJson.getJSONObject("data").getString("accurate").equals("1")) {
JSONObject answer = qaJson.getJSONObject("data").getJSONArray("result").getJSONObject(0);
if (answer!= null) {
result.put("text",answer.getString("answer"));
result.put("type","1");
}
return AjaxResult.success(result);
}
} else {
JSONObject joResult = new JSONObject();
joResult.put("msg","");
joResult.put("target",0);
DmLandingLlmVo vo = new DmLandingLlmVo();
vo.setCategory(knowledgeLibAskVo.getName());
vo.addDmLlm("user", user.getUserName());
JSONObject testJ = new JSONObject();
testJ.put("category",knowledgeLibAskVo.getName());
JSONArray ja1 = new JSONArray();
JSONObject jo = new JSONObject();
jo.put("role","user");
jo.put("content",knowledgeLibAskVo.getQuestion());
ja1.add(jo);
testJ.put("messages",ja1);
JSONObject resultJson = remoteLandingLlmService.query(testJ);
log.info("北方大返回:{}",resultJson.toString());
if (resultJson.get("status").equals("success")) {
JSONArray ja = resultJson.getJSONArray("data");
if (ja.size() > 0) {
String text = ja.getJSONObject(0).getString("text");
result.put("type","5");
result.put("text",text);
result.put("llm","lagi");
if (ja.getJSONObject(0).containsKey("filename")) {
// TODO: 2023/9/27 合并知识到知识库
String libName = ja.getJSONObject(0).getString("filename").split("\\.")[0];
// 添加到知识数据库
result.put("fileName",libName);
}
if (ja.getJSONObject(0).containsKey("imageList") && ja.getJSONObject(0).getJSONArray("imageList").size() > 0) {
JSONObject joImage = new JSONObject();
result.put("imageUrl",ja.getJSONObject(0).getJSONArray("imageList").getString(0));
}
if (ja.getJSONObject(0).containsKey("context")) {
result.put("context",ja.getJSONObject(0).getString("context"));
}
}
}
}


// 判断知识库类型,如果是1,调用searchQA(),如果是2,调用remoteLandingLlmService.query()
return AjaxResult.success(result);
}
@PostMapping("/give_a_like")
@ResponseBody
public AjaxResult giveALike(@RequestBody MarkRecordVo recordVo) {
// 获取缓存nlt:record:origin前十的列表
if (redisTemplate2.opsForHash().hasKey("nlt:record:origin",String.valueOf(recordVo.getId()))) {
redisTemplate.opsForList().rightPush("nlt:record:marked", JSONObject.toJSONString(recordVo));
redisTemplate.opsForHash().delete("nlt:record:origin",String.valueOf(recordVo.getId()));
}
return AjaxResult.success();
}

/**
* 意图请求列表
*/
@@ -515,6 +680,16 @@ public class DmIntentController extends BaseController<DmIntentQuery, DmIntentDt
return R.ok(null,"处理成功");
}


@GetMapping("/inner/getRegularList")
R<List<DmTenantRegularDto>> getRegularList(@RequestHeader(SecurityConstants.ENTERPRISE_ID) Long enterpriseId, @RequestHeader(SecurityConstants.SOURCE_NAME) String sourceName, @RequestHeader(SecurityConstants.FROM_SOURCE) String source) {
// 获取正则表达式数组
DmTenantRegularQuery query = new DmTenantRegularQuery();
List<DmTenantRegularDto> regularDtos = baseService.getTenantRegularByTenantId(query);
return R.ok(regularDtos);
}


/**
* 查询意图管理
列表
@@ -631,6 +806,12 @@ public class DmIntentController extends BaseController<DmIntentQuery, DmIntentDt
return 0;
}
}

private boolean isMatchRegular(String str,String regular) {
Pattern pattern = Pattern.compile(regular);
Matcher matcher = pattern.matcher(str);
return matcher.find();
}
interface Auth {
/** 系统 - 意图管理
管理 - 列表 */


+ 12
- 0
xueyi-modules/xueyi-nlt/src/main/java/com/xueyi/nlt/nlt/domain/dto/InitRegularExpressionDto.java 查看文件

@@ -0,0 +1,12 @@
package com.xueyi.nlt.nlt.domain.dto;

import com.xueyi.nlt.nlt.domain.po.InitRegularExpressionPo;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class InitRegularExpressionDto extends InitRegularExpressionPo {
}

+ 40
- 0
xueyi-modules/xueyi-nlt/src/main/java/com/xueyi/nlt/nlt/domain/po/InitRegularExpressionPo.java 查看文件

@@ -0,0 +1,40 @@
package com.xueyi.nlt.nlt.domain.po;

import com.baomidou.mybatisplus.annotation.TableName;
import com.xueyi.common.core.annotation.Excel;
import com.xueyi.common.core.web.tenant.base.TBaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serial;

import static com.xueyi.common.core.constant.basic.EntityConstants.*;

@Data
@EqualsAndHashCode(callSuper = true)
@TableName(value = "init_regular_expression", excludeProperty = { STATUS,REMARK, CREATE_TIME, UPDATE_TIME, SORT})
public class InitRegularExpressionPo extends TBaseEntity {

@Serial
private static final long serialVersionUID = 1L;

/** 意图名称 */
@Excel(name = "意图名称")
protected String name;

/** 正则表达式 */
@Excel(name = "正则表达式")
protected String expression;

/** 意图返回类型 */
@Excel(name = "意图返回类型")
protected String type;

/** 意图返回文本 */
@Excel(name = "意图返回文本")
protected String text;

/** 意图返回json */
@Excel(name = "意图返回json")
protected String json;
}

+ 10
- 0
xueyi-modules/xueyi-nlt/src/main/java/com/xueyi/nlt/nlt/domain/query/InitRegularExpressionQuery.java 查看文件

@@ -0,0 +1,10 @@
package com.xueyi.nlt.nlt.domain.query;

import com.xueyi.nlt.nlt.domain.po.InitRegularExpressionPo;
import lombok.Data;
import lombok.EqualsAndHashCode;

@Data
@EqualsAndHashCode(callSuper = true)
public class InitRegularExpressionQuery extends InitRegularExpressionPo {
}

+ 15
- 0
xueyi-modules/xueyi-nlt/src/main/java/com/xueyi/nlt/nlt/domain/vo/DmKnowledgeLibAskVo.java 查看文件

@@ -0,0 +1,15 @@
package com.xueyi.nlt.nlt.domain.vo;

import com.xueyi.common.core.web.tenant.base.TBaseEntity;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
public class DmKnowledgeLibAskVo extends TBaseEntity {

private String question;
private Integer type;


}

+ 61
- 0
xueyi-modules/xueyi-nlt/src/main/java/com/xueyi/nlt/nlt/domain/vo/MarkRecordVo.java 查看文件

@@ -0,0 +1,61 @@
package com.xueyi.nlt.nlt.domain.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.xueyi.common.core.utils.time.LocalDateTimeSerializer;
import com.xueyi.common.core.utils.time.LocalDatetimeDeserializer;
import lombok.Data;

import java.io.Serial;
import java.time.LocalDateTime;
import java.util.List;

@Data
public class MarkRecordVo {
@Serial
private static final long serialVersionUID = 1L;


protected Long id;
protected String devId;
/** 标注来源
* 0: 知识库标注
* 1: 自由问答标注
* 2:正则表达式
*/
protected Integer type;

/** 选用的大模型
* spark:星火大模型
* zhipu:智普AI
* baidu:文心一言
* other: 其他
*/
protected String llm;

/** 是否喜欢
* -1: 未标注
* 0: 不喜欢
* 0: 喜欢位置0的答案
* 1: 喜欢位置1的答案
* 2: 喜欢位置2的答案
* 3: 喜欢位置3的答案
* ...
*/
protected Integer like;

/** 问题 */
protected String question;

/** 答案 */
protected List<String> answers;

/** 租户号 */
protected Long tenantId;

@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@JsonDeserialize(using = LocalDatetimeDeserializer.class) // 反序列化
@JsonSerialize(using = LocalDateTimeSerializer.class)
protected LocalDateTime createTime;
}

+ 5
- 0
xueyi-modules/xueyi-nlt/src/main/java/com/xueyi/nlt/nlt/manager/IDmIntentManager.java 查看文件

@@ -2,7 +2,12 @@ package com.xueyi.nlt.nlt.manager;

import com.xueyi.common.web.entity.manager.IBaseManager;
import com.xueyi.nlt.nlt.domain.dto.DmIntentDto;
import com.xueyi.nlt.api.nlt.domain.dto.DmTenantRegularDto;
import com.xueyi.nlt.nlt.domain.query.DmIntentQuery;
import com.xueyi.nlt.api.nlt.domain.query.DmTenantRegularQuery;

import java.util.List;

public interface IDmIntentManager extends IBaseManager<DmIntentQuery, DmIntentDto> {
List<DmTenantRegularDto> selectTenantRegularByTenantId(DmTenantRegularQuery query);
}

+ 40
- 0
xueyi-modules/xueyi-nlt/src/main/java/com/xueyi/nlt/nlt/manager/impl/DmIntentManager.java 查看文件

@@ -1,15 +1,55 @@
package com.xueyi.nlt.nlt.manager.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.xueyi.common.web.entity.manager.impl.BaseManagerImpl;
import com.xueyi.nlt.nlt.domain.dto.DmIntentDto;
import com.xueyi.nlt.api.nlt.domain.dto.DmTenantRegularDto;
import com.xueyi.nlt.nlt.domain.dto.InitRegularExpressionDto;
import com.xueyi.nlt.nlt.domain.model.DmIntentConverter;
import com.xueyi.nlt.nlt.domain.po.DmIntentPo;
import com.xueyi.nlt.api.nlt.domain.po.DmTenantRegularPo;
import com.xueyi.nlt.nlt.domain.po.InitRegularExpressionPo;
import com.xueyi.nlt.nlt.domain.query.DmIntentQuery;
import com.xueyi.nlt.api.nlt.domain.query.DmTenantRegularQuery;
import com.xueyi.nlt.nlt.manager.IDmIntentManager;
import com.xueyi.nlt.nlt.mapper.DmIntentMapper;
import com.xueyi.nlt.nlt.mapper.DmTenantRegularMapper;
import com.xueyi.nlt.nlt.mapper.InitRegularExpressionMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

@Component
public class DmIntentManager extends BaseManagerImpl<DmIntentQuery, DmIntentDto, DmIntentPo, DmIntentMapper, DmIntentConverter> implements IDmIntentManager {

private static final Logger log = LoggerFactory.getLogger(DmIntentManager.class);

@Autowired
DmTenantRegularMapper dmTenantRegularMapper;

@Autowired
InitRegularExpressionMapper initRegularExpressionMapper;
@Override
public List<DmTenantRegularDto> selectTenantRegularByTenantId(DmTenantRegularQuery query) {
List<DmTenantRegularPo> tenantRegularPoList = dmTenantRegularMapper.selectList(Wrappers.emptyWrapper());
log.info("tenantRegularPoList:{}",tenantRegularPoList);
List<DmTenantRegularDto> tenantRegularDtos = new ArrayList<>();
for (DmTenantRegularPo tenantRegularPo : tenantRegularPoList) {
InitRegularExpressionPo po = initRegularExpressionMapper.selectById(tenantRegularPo.getRegularId());
DmTenantRegularDto tempDto = new DmTenantRegularDto();
tempDto.setExpression(po.getExpression());
tempDto.setType(po.getType());
tempDto.setText(po.getText());
tempDto.setJson(po.getJson());
tempDto.setId(tenantRegularPo.getId());
tempDto.setRegularId(tenantRegularPo.getRegularId());
tenantRegularDtos.add(tempDto);
}
log.info("tenantRegularDtos:{}",tenantRegularDtos);
return tenantRegularDtos;
}
}

+ 12
- 0
xueyi-modules/xueyi-nlt/src/main/java/com/xueyi/nlt/nlt/mapper/DmTenantRegularMapper.java 查看文件

@@ -0,0 +1,12 @@
package com.xueyi.nlt.nlt.mapper;


import com.xueyi.common.datasource.annotation.Isolate;
import com.xueyi.common.web.entity.mapper.BaseMapper;
import com.xueyi.nlt.api.nlt.domain.dto.DmTenantRegularDto;
import com.xueyi.nlt.api.nlt.domain.po.DmTenantRegularPo;
import com.xueyi.nlt.api.nlt.domain.query.DmTenantRegularQuery;

@Isolate
public interface DmTenantRegularMapper extends BaseMapper<DmTenantRegularQuery, DmTenantRegularDto, DmTenantRegularPo> {
}

+ 19
- 0
xueyi-modules/xueyi-nlt/src/main/java/com/xueyi/nlt/nlt/mapper/InitRegularExpressionMapper.java 查看文件

@@ -0,0 +1,19 @@
package com.xueyi.nlt.nlt.mapper;


import com.xueyi.common.datasource.annotation.Master;
import com.xueyi.common.web.entity.mapper.BaseMapper;
import com.xueyi.nlt.nlt.domain.dto.InitRegularExpressionDto;
import com.xueyi.nlt.nlt.domain.po.InitRegularExpressionPo;
import com.xueyi.nlt.nlt.domain.query.InitRegularExpressionQuery;


/**
* 访客管理 数据层
*
* @author xueyi
*/
@Master
public interface InitRegularExpressionMapper extends BaseMapper<InitRegularExpressionQuery, InitRegularExpressionDto, InitRegularExpressionPo> {

}

+ 5
- 0
xueyi-modules/xueyi-nlt/src/main/java/com/xueyi/nlt/nlt/service/IDmIntentService.java 查看文件

@@ -2,7 +2,12 @@ package com.xueyi.nlt.nlt.service;

import com.xueyi.common.web.entity.service.IBaseService;
import com.xueyi.nlt.nlt.domain.dto.DmIntentDto;
import com.xueyi.nlt.api.nlt.domain.dto.DmTenantRegularDto;
import com.xueyi.nlt.nlt.domain.query.DmIntentQuery;
import com.xueyi.nlt.api.nlt.domain.query.DmTenantRegularQuery;

import java.util.List;

public interface IDmIntentService extends IBaseService<DmIntentQuery, DmIntentDto> {
List<DmTenantRegularDto> getTenantRegularByTenantId(DmTenantRegularQuery query);
}

+ 9
- 0
xueyi-modules/xueyi-nlt/src/main/java/com/xueyi/nlt/nlt/service/impl/DmIntentServiceImpl.java 查看文件

@@ -2,11 +2,20 @@ package com.xueyi.nlt.nlt.service.impl;

import com.xueyi.common.web.entity.service.impl.BaseServiceImpl;
import com.xueyi.nlt.nlt.domain.dto.DmIntentDto;
import com.xueyi.nlt.api.nlt.domain.dto.DmTenantRegularDto;
import com.xueyi.nlt.nlt.domain.query.DmIntentQuery;
import com.xueyi.nlt.api.nlt.domain.query.DmTenantRegularQuery;
import com.xueyi.nlt.nlt.manager.IDmIntentManager;
import com.xueyi.nlt.nlt.service.IDmIntentService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DmIntentServiceImpl extends BaseServiceImpl<DmIntentQuery, DmIntentDto, IDmIntentManager> implements IDmIntentService {

@Override
public List<DmTenantRegularDto> getTenantRegularByTenantId(DmTenantRegularQuery query) {
return baseManager.selectTenantRegularByTenantId(query);
}
}

+ 5
- 1
xueyi-modules/xueyi-nlt/src/main/resources/bootstrap.yml 查看文件

@@ -20,6 +20,8 @@ spring:
# 服务注册地址
server-addr: @nacos.host@:@nacos.port@
namespace: @nacos.namespace@
username: @nacos.username@
password: @nacos.password@

config:
# 配置中心地址
@@ -31,4 +33,6 @@ spring:
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
- application-secret-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
- application-datasource-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
- application-datasource-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
username: @nacos.username@
password: @nacos.password@

+ 17
- 0
xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/digitalmans/controller/DmBroadcastController.java 查看文件

@@ -11,6 +11,8 @@ import com.xueyi.common.log.enums.BusinessType;
import com.xueyi.common.security.annotation.Logical;
import com.xueyi.common.security.annotation.RequiresPermissions;
import com.xueyi.common.web.entity.controller.BaseController;
import com.xueyi.nlt.api.nlt.domain.vo.DmLandingLlmUploadVo;
import com.xueyi.nlt.api.nlt.feign.RemoteLandingLlmService;
import com.xueyi.system.api.digitalmans.domain.vo.DmBroadcastVo;
import com.xueyi.system.api.meeting.feign.RemoteMeetingService;
import com.xueyi.system.api.organize.domain.po.SysUserPo;
@@ -27,8 +29,10 @@ import com.xueyi.system.resource.domain.dto.DmResourcesDto;
import com.xueyi.system.resource.domain.model.DmResourcesConverter;
import com.xueyi.system.resource.mapper.DmResourcesMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.io.Serializable;
import java.time.LocalDateTime;
@@ -61,6 +65,9 @@ public class DmBroadcastController extends BaseController<DmBroadcastQuery, DmBr
@Autowired
private IDmDigitalmanService digitalmanService;

@Autowired
private RemoteLandingLlmService remoteLandingLlmService;

@Autowired
private ISysUserService sysUserService;

@@ -154,6 +161,11 @@ public class DmBroadcastController extends BaseController<DmBroadcastQuery, DmBr
broadcast.setId(id);
broadcast.setCreateTime(LocalDateTime.now());
broadcastManager.addBroadcastResourceMerge(id, broadcast.getResourceList());
// DmLandingLlmUploadVo vo = new DmLandingLlmUploadVo();
// vo.setCategory("bj_unicom");
// vo.setQuestion(broadcast.getName());
// vo.setAnswer(String.valueOf(id));
// remoteLandingLlmService.addInstruction(vo);
return super.add(broadcast);
}

@@ -167,6 +179,7 @@ public class DmBroadcastController extends BaseController<DmBroadcastQuery, DmBr
public AjaxResult edit(@Validated({V_E.class}) @RequestBody DmBroadcastDto broadcast) {
broadcastManager.editBroadcastResourceMerge(broadcast.getId(), broadcast.getResourceList());
broadcast.setUpdateTime(LocalDateTime.now());

return super.edit(broadcast);
}

@@ -192,6 +205,10 @@ public class DmBroadcastController extends BaseController<DmBroadcastQuery, DmBr
return super.batchRemove(idList);
}

// private mockFile (String text) {
// MultipartFile uploadfile = new MockMultipartFile("file", "test.mp3", "multipart/form-data", text.getBytes());
// }

/**
* 获取播报选择框列表
*/


+ 11
- 5
xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/digitalmans/controller/DmDigitalmanController.java 查看文件

@@ -421,14 +421,22 @@ public class DmDigitalmanController extends BaseController<DmDigitalmanQuery, Dm
if (RedisUtil.existed("dashboard:knowledge-consume")) {
knowledgeList = RedisUtil.getJsonList("dashboard:knowledge-consume");
//取值后清除缓存list,5秒后过期
RedisUtil.expire("dashboard:knowledge-consume", 5);
// RedisUtil.expire("dashboard:knowledge-consume", 5);
}
List<JSONObject> skillList = new ArrayList<>();
if (RedisUtil.existed("dashboard:skill-consume")) {
skillList = RedisUtil.getJsonList("dashboard:skill-consume");
//取值后清除缓存list,5秒后过期
RedisUtil.expire("dashboard:skill-consume", 5);
// RedisUtil.expire("dashboard:skill-consume", 5);
}
Long onlineCount = 0L;
if (RedisUtil.existed(MessageConstants.REDIS_GROUP_DEVICE_HEADER)) {
List<Object> manDeviceDtos = (List<Object>)redisTemplate.opsForHash().values(MessageConstants.REDIS_GROUP_DEVICE_HEADER);
onlineCount = manDeviceDtos.stream().filter(item->(!((DmManDeviceDto)item).getOnlineStatus().isEmpty()) &&
((DmManDeviceDto)item).getOnlineStatus().equalsIgnoreCase("1")).count();
log.info("devs:{}, onlineCount:{}",manDeviceDtos.size(), onlineCount);
}

JSONArray jsonArray = new JSONArray();
// 最近三十天的数据,服务人次,知识库增量
for (int i = 0; i < 30; i++) {
@@ -443,6 +451,7 @@ public class DmDigitalmanController extends BaseController<DmDigitalmanQuery, Dm

JSONObject json = new JSONObject();
json.put("manCount",dtos2.size());//数字人数
json.put("manOnlineCount",onlineCount);//数字人数
json.put("recognizedPersonCount", recognition);//注册人员总数
json.put("serviceTimeCount",serviceTimeCount);//总服务时间
json.put("chatTimes",conversationTimes);//对话次数
@@ -466,9 +475,6 @@ public class DmDigitalmanController extends BaseController<DmDigitalmanQuery, Dm
}





@GetMapping("/api/devInfo/{devId}")
public R<DmDigitalmanExtPo> devInfo(@PathVariable(required = true) String devId) {
if (StringUtils.isNotEmpty(devId)){


+ 54
- 0
xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/digitalmans/controller/DmModelController.java 查看文件

@@ -1,15 +1,26 @@
package com.xueyi.system.digitalmans.controller;

import com.xueyi.common.core.constant.basic.SecurityConstants;
import com.xueyi.common.core.web.result.AjaxResult;
import com.xueyi.common.core.web.result.R;
import com.xueyi.common.core.web.validate.V_A;
import com.xueyi.common.core.web.validate.V_E;
import com.xueyi.common.log.annotation.Log;
import com.xueyi.common.log.enums.BusinessType;
import com.xueyi.common.security.annotation.InnerAuth;
import com.xueyi.common.security.annotation.RequiresPermissions;
import com.xueyi.common.web.entity.controller.BaseController;
import com.xueyi.system.api.digitalmans.domain.dto.DmH5MenuDto;
import com.xueyi.system.api.digitalmans.domain.dto.DmManDeviceDto;
import com.xueyi.system.api.digitalmans.domain.dto.DmModelDto;
import com.xueyi.system.api.digitalmans.domain.query.DmH5MenuQuery;
import com.xueyi.system.api.digitalmans.domain.vo.DmH5MenuVo;
import com.xueyi.system.digitalmans.domain.dto.DmDigitalmanDto;
import com.xueyi.system.digitalmans.domain.dto.DmModelUploadDto;
import com.xueyi.system.digitalmans.domain.query.DmDigitalmanQuery;
import com.xueyi.system.digitalmans.domain.query.DmModelQuery;
import com.xueyi.system.digitalmans.service.IDmDigitalmanService;
import com.xueyi.system.digitalmans.service.IDmManDeviceService;
import com.xueyi.system.digitalmans.service.IDmModelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
@@ -29,12 +40,55 @@ public class DmModelController extends BaseController<DmModelQuery, DmModelDto,

@Autowired
IDmModelService modelService;

@Autowired
IDmManDeviceService dmManDeviceService;

@Autowired
IDmDigitalmanService dmDigitalmanService;
/** 定义节点名称 */
@Override
protected String getNodeName() {
return "模型" ;
}

/**
* 查询模型列表
*/
@InnerAuth
@GetMapping("/inner/menu_list")
public R<List<DmH5MenuDto>> getMenuList(@RequestParam(value = "devId")String devId) {
DmManDeviceDto manDeviceDto = dmManDeviceService.manDeviceInfoInner(devId);
if (manDeviceDto == null) {
return R.fail("设备不存在");
}
DmDigitalmanQuery digitalmanQuery = new DmDigitalmanQuery();
digitalmanQuery.setManCode(manDeviceDto.getManCode());
List<DmDigitalmanDto> digitalmanDtos = dmDigitalmanService.selectList(digitalmanQuery);
if (digitalmanDtos == null || digitalmanDtos.size() == 0) {
return R.fail("设备不存在");
}
DmH5MenuQuery query = new DmH5MenuQuery();
// 获取H5列表
return R.ok(super.baseService.selectH5MenuList(digitalmanDtos.get(0).getId()));
}

@PostMapping("/inner/menu_list")
@ResponseBody
public R<Integer> updateMenuList(@RequestBody DmH5MenuVo vo) {
DmManDeviceDto manDeviceDto = dmManDeviceService.manDeviceInfoInner(vo.getDevId());
if (manDeviceDto == null) {
return R.fail("设备不存在");
}
DmDigitalmanQuery digitalmanQuery = new DmDigitalmanQuery();
digitalmanQuery.setManCode(manDeviceDto.getManCode());
List<DmDigitalmanDto> digitalmanDtos = dmDigitalmanService.selectList(digitalmanQuery);
if (digitalmanDtos == null || digitalmanDtos.size() == 0) {
return R.fail("设备不存在");
}
return R.ok(baseService.updateH5MenuList(digitalmanDtos.get(0).getId(), vo.getMenuList()));
}

/**
* 查询模型列表
*/


+ 23
- 1
xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/digitalmans/controller/DmQAndAController.java 查看文件

@@ -13,6 +13,7 @@ import com.xueyi.common.security.annotation.RequiresPermissions;
import com.xueyi.common.security.utils.SecurityUtils;
import com.xueyi.common.web.entity.controller.BaseController;
import com.xueyi.nlt.api.nlt.domain.vo.TaskKnowledgeVo;
import com.xueyi.nlt.api.nlt.feign.RemoteLandingLlmService;
import com.xueyi.system.api.digitalmans.domain.vo.DmBatchQuestionsVo;
import com.xueyi.system.api.digitalmans.domain.vo.DmReceptionVo;
import com.xueyi.system.digitalmans.domain.dto.DmQAndADto;
@@ -24,6 +25,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.io.Serializable;
import java.util.ArrayList;
@@ -42,13 +44,15 @@ public class DmQAndAController extends BaseController<DmQAndAQuery, DmQAndADto,
@Autowired
RedisTemplate redisTemplate;

@Autowired
RemoteLandingLlmService remoteLandingLlmService;

/** 定义节点名称 */
@Override
protected String getNodeName() {
return "企业知识库问答" ;
}


@PostMapping("/inner/batch_insert")
@ResponseBody
public R<Integer> batchInsertInner(@RequestBody DmBatchQuestionsVo dmBatchQuestionsVo) {
@@ -128,6 +132,14 @@ public class DmQAndAController extends BaseController<DmQAndAQuery, DmQAndADto,
return super.success();
}

@PostMapping("/uploadLearningFile")
@Log(title = "资源管理 - 上传训练文件", businessType = BusinessType.UPDATE)
public AjaxResult uploadLearningFile(@RequestParam(value = "category",required = false, defaultValue = "dgmeta") String category ,@RequestPart("fileToUpload") MultipartFile file) {
String result = remoteLandingLlmService.uploadLearningFile(category,file);
JSONObject jo = JSONObject.parseObject(result);
return AjaxResult.success(jo);
}

/**
* 企业知识库问答修改
*/
@@ -161,6 +173,16 @@ public class DmQAndAController extends BaseController<DmQAndAQuery, DmQAndADto,
return super.batchRemove(idList);
}

/**
* 企业知识库问答批量删除(大模型)
*/
@DeleteMapping("/batch/llm/{idList}")
@RequiresPermissions(Auth.DM_Q_AND_A_DEL)
@Log(title = "企业知识库问答管理", businessType = BusinessType.DELETE)
public AjaxResult batchLlmRemove(@PathVariable List<String> idList) {
return AjaxResult.success(baseService.deleteLlmByIds(idList));
}

/**
* 获取企业知识库问答选择框列表
*/


+ 50
- 0
xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/digitalmans/controller/api/DmMenuApiController.java 查看文件

@@ -0,0 +1,50 @@
package com.xueyi.system.digitalmans.controller.api;

import com.xueyi.common.core.constant.basic.SecurityConstants;
import com.xueyi.common.core.web.result.AjaxResult;
import com.xueyi.common.core.web.result.R;
import com.xueyi.system.api.device.domain.vo.DeviceTenantSourceMergeVo;
import com.xueyi.system.api.digitalmans.domain.dto.DmH5MenuDto;
import com.xueyi.system.api.digitalmans.feign.RemoteModelService;
import com.xueyi.system.api.digitalmans.domain.vo.DmH5MenuVo;
import com.xueyi.system.resource.controller.api.BaseApiController;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/api/menu/")
public class DmMenuApiController extends BaseApiController {

private static final Logger log = LoggerFactory.getLogger(DmMenuApiController.class);

@Autowired
RemoteModelService remoteModelService;

@GetMapping(value = "list/{devId}")
@ResponseBody
public AjaxResult list(@PathVariable(value = "devId") String devId) {
DeviceTenantSourceMergeVo vo = super.getDeviceTenantSourceMergeVo(devId);
R<List<DmH5MenuDto>> listR = remoteModelService.getMenuList(devId,vo.getTenantId(),vo.getSourceSlave(), SecurityConstants.INNER);
if (listR.isOk()) {
return AjaxResult.success(listR.getData());
}
log.error("获取菜单列表失败{}",listR.getMsg());
return AjaxResult.error("获取菜单列表失败");
}

@PostMapping("updateMenu")
@ResponseBody
public AjaxResult updateH5List(@RequestBody DmH5MenuVo h5MenuVo) {
DeviceTenantSourceMergeVo vo = super.getDeviceTenantSourceMergeVo(h5MenuVo.getDevId());
R<Integer> listR = remoteModelService.updateMenuList(h5MenuVo, vo.getTenantId(),vo.getSourceSlave(), SecurityConstants.INNER);
if (listR.isOk()) {
return AjaxResult.success(listR.getData());
}
log.error("获取菜单列表失败{}",listR.getMsg());
return AjaxResult.error("获取菜单列表失败");
}
}

+ 10
- 0
xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/digitalmans/domain/dto/DmManIconDto.java 查看文件

@@ -0,0 +1,10 @@
package com.xueyi.system.digitalmans.domain.dto;

import com.xueyi.system.digitalmans.domain.po.DmManIconPo;
import lombok.Data;
import lombok.EqualsAndHashCode;

@Data
@EqualsAndHashCode(callSuper = true)
public class DmManIconDto extends DmManIconPo {
}

+ 2
- 0
xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/digitalmans/domain/dto/DmQAndADto.java 查看文件

@@ -22,4 +22,6 @@ public class DmQAndADto extends DmQAndAPo {

private String creator;

private String fileId;

}

+ 24
- 0
xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/digitalmans/domain/po/DmManIconPo.java 查看文件

@@ -0,0 +1,24 @@
package com.xueyi.system.digitalmans.domain.po;


import com.baomidou.mybatisplus.annotation.TableName;
import com.xueyi.common.core.web.tenant.base.TBaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serial;

import static com.xueyi.common.core.constant.basic.EntityConstants.*;

@Data
@EqualsAndHashCode(callSuper = true)
@TableName(value = "dm_man_icon_merge", excludeProperty = { NAME,SORT,STATUS,DEL_FLAG,REMARK,CREATE_BY,CREATE_TIME, UPDATE_BY,UPDATE_TIME})
public class DmManIconPo extends TBaseEntity {

@Serial
private static final long serialVersionUID = 1L;

protected Long manId;

protected Long iconId;
}

+ 13
- 0
xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/digitalmans/domain/query/DmManIconQuery.java 查看文件

@@ -0,0 +1,13 @@
package com.xueyi.system.digitalmans.domain.query;

import com.xueyi.system.digitalmans.domain.po.DmManIconPo;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serial;

@Data
@EqualsAndHashCode(callSuper = true)
public class DmManIconQuery extends DmManIconPo {

}

+ 2
- 0
xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/digitalmans/manager/IDmDigitalmanExtManager.java 查看文件

@@ -13,4 +13,6 @@ import java.util.List;
*/
public interface IDmDigitalmanExtManager extends IBaseManager<DmDigitalmanExtQuery, DmDigitalmanExtDto> {
public List<DmDigitalmanExtDto> selectByDeviceId(DmDigitalmanExtQuery query);


}

+ 9
- 0
xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/digitalmans/manager/IDmModelManager.java 查看文件

@@ -1,10 +1,15 @@
package com.xueyi.system.digitalmans.manager;

import com.xueyi.system.api.digitalmans.domain.dto.DmH5MenuDto;
import com.xueyi.system.api.digitalmans.domain.dto.DmModelDto;
import com.xueyi.system.api.digitalmans.domain.query.DmH5MenuQuery;
import com.xueyi.system.api.digitalmans.domain.vo.DmH5MenuVo;
import com.xueyi.system.digitalmans.domain.dto.DmModelUploadDto;
import com.xueyi.system.digitalmans.domain.query.DmModelQuery;
import com.xueyi.common.web.entity.manager.IBaseManager;

import java.util.List;

/**
* 模型管理 数据封装层
*
@@ -13,4 +18,8 @@ import com.xueyi.common.web.entity.manager.IBaseManager;
public interface IDmModelManager extends IBaseManager<DmModelQuery, DmModelDto> {

int uploadResourceByResourceId(DmModelUploadDto dto);

List<DmH5MenuDto> selectH5MenuList(Long manId);

Integer updateH5MenuList(Long manId, List<DmH5MenuDto> menuList);
}

+ 1
- 0
xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/digitalmans/manager/impl/DmDigitalmanExtManager.java 查看文件

@@ -28,4 +28,5 @@ public class DmDigitalmanExtManager extends BaseManagerImpl<DmDigitalmanExtQuery
.eq(DmDigitalmanExtPo::getDeviceId,query.getDeviceId()));
return mapperDto(list);
}

}

+ 2
- 1
xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/digitalmans/manager/impl/DmDigitalmanManager.java 查看文件

@@ -21,6 +21,7 @@ import com.xueyi.system.digitalmans.mapper.DmDigitalmanWorktimeMapper;
import com.xueyi.system.digitalmans.mapper.DmModelMapper;
import com.xueyi.system.organize.mapper.SysDeptExtMapper;
import com.xueyi.system.resource.mapper.DmResourcesMapper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@@ -93,7 +94,7 @@ public class DmDigitalmanManager extends BaseManagerImpl<DmDigitalmanQuery, DmDi
.lambda().eq(DmDigitalmanExtPo::getManCode,dto.getManCode()));

po.setDeptId(dto.getDeptId());
if (dto.getSetSpace() != null && dto.getSetSpace() != "") {
if (dto.getSetSpace() != null && StringUtils.isNotBlank(dto.getSetSpace())) {
po.setSetSpace(dto.getSetSpace());
}
digitalmanExtMapper.updateById(po);


+ 287
- 63
xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/digitalmans/manager/impl/DmModelManager.java 查看文件

@@ -1,28 +1,22 @@
package com.xueyi.system.digitalmans.manager.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.xueyi.common.core.constant.basic.OperateConstants;
import com.xueyi.common.web.entity.domain.SlaveRelation;
import com.xueyi.system.api.digitalmans.domain.dto.DmH5MenuDto;
import com.xueyi.system.api.digitalmans.domain.dto.DmScreenIconDto;
import com.xueyi.system.api.digitalmans.domain.po.DmModelIconPo;
import com.xueyi.system.api.digitalmans.domain.po.DmScreenIconPo;
import com.xueyi.system.digitalmans.controller.DmQAndAController;
import com.xueyi.system.api.digitalmans.domain.po.*;
import com.xueyi.system.api.digitalmans.domain.query.DmH5MenuQuery;
import com.xueyi.system.api.digitalmans.domain.vo.DmH5MenuVo;
import com.xueyi.system.digitalmans.domain.dto.DmModelUploadDto;
import com.xueyi.system.api.digitalmans.domain.po.DmDigitalmanPo;
import com.xueyi.system.api.digitalmans.domain.po.DmModelPo;
import com.xueyi.system.api.digitalmans.domain.dto.DmModelDto;
import com.xueyi.system.api.digitalmans.domain.merge.DmModelIconMerge;
import com.xueyi.system.digitalmans.domain.model.DmScreenIconConverter;
import com.xueyi.system.digitalmans.domain.po.DmManIconPo;
import com.xueyi.system.digitalmans.domain.query.DmManIconQuery;
import com.xueyi.system.digitalmans.domain.query.DmModelQuery;
import com.xueyi.system.digitalmans.domain.model.DmModelConverter;
import com.xueyi.system.digitalmans.mapper.DmDigitalmanMapper;
import com.xueyi.system.digitalmans.mapper.DmModelIconMapper;
import com.xueyi.system.digitalmans.mapper.DmModelMapper;
import com.xueyi.system.digitalmans.mapper.*;
import com.xueyi.common.web.entity.manager.impl.BaseManagerImpl;
import com.xueyi.system.digitalmans.manager.IDmModelManager;
import com.xueyi.system.api.resource.domain.po.DmResourcesPo;
import com.xueyi.system.digitalmans.mapper.DmScreenIconMapper;
import com.xueyi.system.digitalmans.mapper.merge.DmModelIconMergeMapper;
import com.xueyi.system.resource.domain.po.DmBackgroundPo;
import com.xueyi.system.resource.domain.po.DmScreenOffPo;
import com.xueyi.system.resource.mapper.DmBackgroundMapper;
@@ -37,8 +31,8 @@ import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import static com.xueyi.system.api.digitalmans.domain.merge.MergeGroup.Model_DmModelIcon_GROUP;
import java.util.function.Predicate;
import java.util.stream.Collectors;


/**
@@ -50,6 +44,7 @@ import static com.xueyi.system.api.digitalmans.domain.merge.MergeGroup.Model_DmM
public class DmModelManager extends BaseManagerImpl<DmModelQuery, DmModelDto, DmModelPo, DmModelMapper, DmModelConverter> implements IDmModelManager {

private static final Logger log = LoggerFactory.getLogger(DmModelManager.class);

@Autowired
DmResourcesMapper dmResourcesMapper;

@@ -66,7 +61,16 @@ public class DmModelManager extends BaseManagerImpl<DmModelQuery, DmModelDto, Dm
DmDigitalmanMapper digitalmanMapper;

@Autowired
DmModelIconMapper dmModelIconMapper;
DmMenuIconMapper dmMenuIconMapper;

@Autowired
DmH5TenantMenuMapper h5TenantMenuMapper;

@Autowired
DmManIconMapper dmManIconMapper;

@Autowired
DmH5MenuMapper h5MenuMapper;

@Autowired
DmScreenIconMapper dmScreenIconMapper;
@@ -127,22 +131,10 @@ public class DmModelManager extends BaseManagerImpl<DmModelQuery, DmModelDto, Dm
modelDto.setRIcon(dmResourcesMapper.selectById(modelDto.getIconId()));
}

// 获取主界面icon
List<DmModelIconPo> modelIconList = dmModelIconMapper.selectModelIconListByModelId(modelDto.getId());
log.info("主界面icon列表:{}", modelIconList);
if (modelIconList != null && modelIconList.size() > 0) {
List<DmScreenIconDto> screenIconDtos = new ArrayList<>();
modelIconList.forEach(iconItem-> {
// 获取icon
DmScreenIconPo iconPo = dmScreenIconMapper.selectById(iconItem.getIconId());
DmScreenIconDto temp = screenIconConverter.mapperDto(iconPo);
DmResourcesPo resourcesPo = dmResourcesMapper.selectById(iconPo.getResourceId());
temp.setPos(iconItem.getPos());
temp.setIconUrl(resourcesPo.getUrl());
screenIconDtos.add(temp);
});
modelDto.setDmScreenIconDtos(screenIconDtos);
}

modelDto.setH5Menus(selectH5MenuList(modelDto.getManId()));
log.info("主界面icon列表:{}", modelDto.getH5Menus());


return modelDto;
}
@@ -183,40 +175,272 @@ public class DmModelManager extends BaseManagerImpl<DmModelQuery, DmModelDto, Dm
DmDigitalmanPo po = digitalmanMapper.selectById(dto.getManId());
po.setName(dto.getName());
digitalmanMapper.updateById(po);
//更新主界面icon
List<DmModelIconPo> iconPos = dmModelIconMapper.selectModelIconListByModelId(dto.getId());
if (iconPos != null && iconPos.size() > 0) {
// 删除原有icon
dmModelIconMapper.deleteMerge(iconPos.get(0));
}
log.info("主界面icon列表:{}",dto.getDmScreenIconDtos());
if (dto.getDmScreenIconDtos() != null && dto.getDmScreenIconDtos().size() > 0) {
// 新增icon
for (DmScreenIconDto screenIconDto : dto.getDmScreenIconDtos()) {
DmScreenIconPo screenIconPo = new DmScreenIconPo();
if (screenIconDto.getId() != null && screenIconDto.getId().doubleValue() > 0) {
// 更新模型-主界面icon关系
screenIconPo = dmScreenIconMapper.selectById(screenIconDto.getId());
screenIconPo.setName(screenIconDto.getName());
screenIconPo.setResourceId(screenIconDto.getResourceId());
screenIconPo.setBroadcastId(screenIconDto.getBroadcastId());
dmScreenIconMapper.updateById(screenIconPo);
} else {
screenIconPo = new DmScreenIconPo();
screenIconPo.setName(screenIconDto.getName());
screenIconPo.setResourceId(screenIconDto.getResourceId());
screenIconPo.setBroadcastId(screenIconDto.getBroadcastId());
dmScreenIconMapper.insert(screenIconPo);
updateH5MenuList(dto.getManId(),dto.getH5Menus());
return super.update(dto);

}

@Override
public List<DmH5MenuDto> selectH5MenuList(Long manId) {
// 获取菜单列表
List<DmH5MenuPo> menuPos = h5MenuMapper.selectH5MenuList();
List<DmManIconPo> manIconPos = dmManIconMapper.selectList(Wrappers.<DmManIconPo>query().lambda().eq(DmManIconPo::getManId, manId));

log.info("菜单列表:{}", menuPos);

List<DmH5MenuDto> h5MenuDtos = new ArrayList<>();
List<DmH5MenuDto> usedH5MenuDtos = new ArrayList<>();
int level = 0;

// 构建菜单树
do {
int finalLevel = level;
if (h5MenuDtos.size() == 0) {
menuPos.stream().filter(item->item.getParentId() == 0L).forEach(item->{

DmH5MenuDto h5MenuDto = new DmH5MenuDto();
h5MenuDto.setId(item.getId());
h5MenuDto.setTitle(item.getTitle());
h5MenuDto.setChildren(new ArrayList<>());
h5MenuDto.setStatus(item.getStatus());
h5MenuDto.setLevel(finalLevel);
h5MenuDto.setCreateTime(item.getCreateTime());
h5MenuDto.setUpdateTime(item.getUpdateTime());
h5MenuDto.setCreateBy(item.getCreateBy());
h5MenuDto.setMenuType(item.getMenuType());
h5MenuDtos.add(h5MenuDto);
usedH5MenuDtos.add(h5MenuDto);
});

} else {
// 遍历h5MenuDtos,将子菜单加入到父菜单中
List<DmH5MenuDto> tmpList = new ArrayList<>();
for (DmH5MenuDto h5MenuDto : usedH5MenuDtos) {
// 遍历menuPos,将parentId与h5MenuDto的id相同的菜单加入到h5MenuDto的children中
menuPos.stream().filter(item->item.getParentId().equals(h5MenuDto.getId())).forEach(item->{
log.info("add child: {}", item);
DmH5MenuDto h5MenuDto1 = new DmH5MenuDto();
h5MenuDto1.setId(item.getId());
h5MenuDto1.setTitle(item.getTitle());
h5MenuDto1.setChildren(new ArrayList<>());
h5MenuDto1.setStatus(item.getStatus());
h5MenuDto1.setLevel(finalLevel);
h5MenuDto1.setCreateTime(item.getCreateTime());
h5MenuDto1.setUpdateTime(item.getUpdateTime());
h5MenuDto1.setCreateBy(item.getCreateBy());
h5MenuDto1.setMenuType(item.getMenuType());
h5MenuDto.getChildren().add(h5MenuDto1);
tmpList.add(h5MenuDto1);
});

}
usedH5MenuDtos.clear();
usedH5MenuDtos.addAll(tmpList);
}
level++;
Integer tmp = usedH5MenuDtos.size();

for (DmH5MenuDto tmpDto : usedH5MenuDtos) {
if (tmpDto.getMenuType().equals("F") && tmpDto.getStatus().equals("0")) {
List<DmMenuIconPo> menuIconPos = dmMenuIconMapper.selectMenuIconListByMenuId(tmpDto.getId());
// 获取数字人与Icon关联关系
List<Long> u2 = manIconPos.stream().map(DmManIconPo::getIconId).collect(Collectors.toList());
// 获取菜单与Icon关联关系
List<Long> u1 = menuIconPos.stream().map(DmMenuIconPo::getIconId).collect(Collectors.toList());
// 获取交集
List<Long> iconIdResults = u1.stream().filter(p1->u2.stream().anyMatch(p2->p1.equals(p2))).collect(Collectors.toList());
if (menuIconPos != null && menuIconPos.size() > 0) {
if (iconIdResults != null && iconIdResults.size() > 0) {
// 获取icon集合
List<DmScreenIconPo> iconPos = dmScreenIconMapper.selectBatchIds(iconIdResults);
List<DmScreenIconDto> tmpDtos = screenIconConverter.mapperDto(iconPos);
tmpDtos.forEach(item2-> {
for (DmMenuIconPo menuIconPo : menuIconPos) {
if (item2.getId().equals(menuIconPo.getIconId())) {
item2.setPos(menuIconPo.getPos());
// 获取icon 图片地址
DmResourcesPo resourcesPo = dmResourcesMapper.selectById(item2.getResourceId());
if (resourcesPo != null) {
item2.setIconUrl(resourcesPo.getUrl());
}
}
}
});
tmpDto.setDmScreenIconDto(tmpDtos);
}
}
}
// 新增模型-主界面icon关系
DmModelIconPo iconPo = new DmModelIconPo();
iconPo.setModelId(dto.getId());
iconPo.setIconId(screenIconPo.getId());
iconPo.setPos(screenIconDto.getPos());
dmModelIconMapper.insertMerge(iconPo);

}
} while (level < 2);
// 根据列表获取icon集合
// menuPos.forEach(item->{
//
// DmH5MenuDto h5MenuDto = new DmH5MenuDto();
// h5MenuDto.setId(item.getId());
// h5MenuDto.setTitle(item.getTitle());
// List<DmMenuIconPo> menuIconPos = dmMenuIconMapper.selectMenuIconListByMenuId(item.getId());
// // 获取数字人与Icon关联关系
// List<Long> u2 = manIconPos.stream().map(DmManIconPo::getIconId).collect(Collectors.toList());
// // 获取菜单与Icon关联关系
// List<Long> u1 = menuIconPos.stream().map(DmMenuIconPo::getIconId).collect(Collectors.toList());
// // 获取交集
// List<Long> iconIdResults = u1.stream().filter(p1->u2.stream().anyMatch(p2->p1.equals(p2))).collect(Collectors.toList());
// if (menuIconPos != null && menuIconPos.size() > 0) {
// if (iconIdResults != null && iconIdResults.size() > 0) {
// // 获取icon集合
// List<DmScreenIconPo> iconPos = dmScreenIconMapper.selectBatchIds(iconIdResults);
// List<DmScreenIconDto> tmpDtos = screenIconConverter.mapperDto(iconPos);
// tmpDtos.forEach(item2-> {
// for (DmMenuIconPo menuIconPo : menuIconPos) {
// if (item2.getId().equals(menuIconPo.getIconId())) {
// item2.setPos(menuIconPo.getPos());
// // 获取icon 图片地址
// DmResourcesPo resourcesPo = dmResourcesMapper.selectById(item2.getResourceId());
// if (resourcesPo != null) {
// item2.setIconUrl(resourcesPo.getUrl());
// }
// }
// }
// });
// h5MenuDto.setDmScreenIconDto(tmpDtos);
// }
// }
//
// h5MenuDtos.add(h5MenuDto);
// });
return h5MenuDtos;
}

@Override
public Integer updateH5MenuList(Long manId,List<DmH5MenuDto> menuList) {
log.info("menuList:{}",menuList);
int resultInt = 0;
List<DmManIconPo> manIconPos = dmManIconMapper.selectList(Wrappers.<DmManIconPo>query()
.lambda().eq(DmManIconPo::getManId, manId));
List<DmManIconPo> batchManIconPos = new ArrayList<>();
List<Long> u2 = manIconPos.stream().map(DmManIconPo::getIconId).collect(Collectors.toList());
List<DmH5MenuDto> usedH5MenuDtos = new ArrayList<>();
menuList.forEach(item-> {
if (item.getMenuType().equals("F") && item.getStatus().equals("0")) {
List<DmMenuIconPo> screenIconPos = dmMenuIconMapper.selectMenuIconListByMenuId(item.getId());

if (screenIconPos != null && screenIconPos.size() > 0) {
List<Long> u1 = screenIconPos.stream().map(DmMenuIconPo::getIconId).collect(Collectors.toList());
// 获取交集
List<Long> iconIdResults = u1.stream().filter(p1->u2.stream().anyMatch(p2->p1.equals(p2))).collect(Collectors.toList());
// 删除原有icon
for (Long iconId : iconIdResults) {
dmMenuIconMapper.deleteMenuIconByIconId(iconId);
}

}
log.info("主界面icon列表:{}",screenIconPos);
if(item.getDmScreenIconDto() != null && item.getDmScreenIconDto().size() > 0) {
log.info("当前菜单:{},包含icon列表:{}",item.getTitle(),item.getDmScreenIconDto());
for (DmScreenIconDto screenIconDto : item.getDmScreenIconDto()) {
DmScreenIconPo screenIconPo = new DmScreenIconPo();
if (screenIconDto.getId() != null && screenIconDto.getId().doubleValue() > 0) {
// 更新模型-主界面icon关系
screenIconPo = dmScreenIconMapper.selectById(screenIconDto.getId());
screenIconPo.setName(screenIconDto.getName());
screenIconPo.setResourceId(screenIconDto.getResourceId());
screenIconPo.setBroadcastId(screenIconDto.getBroadcastId());
screenIconPo.setUrl(screenIconDto.getUrl());
dmScreenIconMapper.updateById(screenIconPo);
} else {
if (screenIconDto.getPos() == null) {
continue;
}
screenIconPo = new DmScreenIconPo();
screenIconPo.setName(screenIconDto.getName());
screenIconPo.setResourceId(screenIconDto.getResourceId());
screenIconPo.setBroadcastId(screenIconDto.getBroadcastId());
screenIconPo.setUrl(screenIconDto.getUrl());
dmScreenIconMapper.insert(screenIconPo);
}
// 新增模型-主界面icon关系
DmMenuIconPo iconPo = new DmMenuIconPo();
iconPo.setMenuId(item.getId());
iconPo.setIconId(screenIconPo.getId());
iconPo.setPos(screenIconDto.getPos());
dmMenuIconMapper.insertMerge(iconPo);
// 定义DmManIconPo,用于批量更新
DmManIconPo manIconPo = new DmManIconPo();
manIconPo.setManId(manId);
manIconPo.setIconId(screenIconPo.getId());
batchManIconPos.add(manIconPo);
}
}
} else {
List<DmH5MenuDto> childMenuDtos = item.getChildren();
for (DmH5MenuDto childMenuDto : childMenuDtos) {
List<DmMenuIconPo> screenIconPos = dmMenuIconMapper.selectMenuIconListByMenuId(childMenuDto.getId());

if (screenIconPos != null && screenIconPos.size() > 0) {
List<Long> u1 = screenIconPos.stream().map(DmMenuIconPo::getIconId).collect(Collectors.toList());
// 获取交集
List<Long> iconIdResults = u1.stream().filter(p1->u2.stream().anyMatch(p2->p1.equals(p2))).collect(Collectors.toList());
// 删除原有icon
for (Long iconId : iconIdResults) {
dmMenuIconMapper.deleteMenuIconByIconId(iconId);
}

}
log.info("主界面icon列表:{}",screenIconPos);
if(childMenuDto.getDmScreenIconDto() != null && childMenuDto.getDmScreenIconDto().size() > 0) {
log.info("当前菜单:{},包含icon列表:{}",childMenuDto.getTitle(),childMenuDto.getDmScreenIconDto());
for (DmScreenIconDto screenIconDto : childMenuDto.getDmScreenIconDto()) {
DmScreenIconPo screenIconPo = new DmScreenIconPo();
if (screenIconDto.getId() != null && screenIconDto.getId().doubleValue() > 0) {
// 更新模型-主界面icon关系
screenIconPo = dmScreenIconMapper.selectById(screenIconDto.getId());
screenIconPo.setName(screenIconDto.getName());
screenIconPo.setResourceId(screenIconDto.getResourceId());
screenIconPo.setBroadcastId(screenIconDto.getBroadcastId());
screenIconPo.setUrl(screenIconDto.getUrl());
dmScreenIconMapper.updateById(screenIconPo);
} else {
if (screenIconDto.getPos() == null) {
continue;
}
screenIconPo = new DmScreenIconPo();
screenIconPo.setName(screenIconDto.getName());
screenIconPo.setResourceId(screenIconDto.getResourceId());
screenIconPo.setBroadcastId(screenIconDto.getBroadcastId());
screenIconPo.setUrl(screenIconDto.getUrl());
dmScreenIconMapper.insert(screenIconPo);
}
// 新增模型-主界面icon关系
DmMenuIconPo iconPo = new DmMenuIconPo();
iconPo.setMenuId(childMenuDto.getId());
iconPo.setIconId(screenIconPo.getId());
iconPo.setPos(screenIconDto.getPos());
dmMenuIconMapper.insertMerge(iconPo);
// 定义DmManIconPo,用于批量更新
DmManIconPo manIconPo = new DmManIconPo();
manIconPo.setManId(manId);
manIconPo.setIconId(screenIconPo.getId());
batchManIconPos.add(manIconPo);
}
}
}
}

});

if (manIconPos != null && manIconPos.size() > 0) {
List<Long> manIconIds = manIconPos.stream().map(DmManIconPo::getId).collect(Collectors.toList());
dmManIconMapper.deleteBatchIds(manIconIds);
}
if (batchManIconPos.size() > 0) {
// 批量新增manIcon关系
dmManIconMapper.insertBatch(batchManIconPos);
}
return batchManIconPos.size();
}
private void updateChild() {

return super.update(dto);
}

}

+ 0
- 9
xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/digitalmans/manager/impl/DmScreenIconManager.java 查看文件

@@ -1,8 +1,5 @@
package com.xueyi.system.digitalmans.manager.impl;

import com.xueyi.common.core.constant.basic.OperateConstants;
import com.xueyi.common.web.entity.domain.SlaveRelation;
import com.xueyi.system.api.digitalmans.domain.merge.DmModelIconMerge;
import com.xueyi.system.api.digitalmans.domain.po.DmScreenIconPo;
import com.xueyi.system.api.digitalmans.domain.dto.DmScreenIconDto;
import com.xueyi.system.digitalmans.domain.query.DmScreenIconQuery;
@@ -10,14 +7,8 @@ import com.xueyi.system.digitalmans.domain.model.DmScreenIconConverter;
import com.xueyi.system.digitalmans.mapper.DmScreenIconMapper;
import com.xueyi.common.web.entity.manager.impl.BaseManagerImpl;
import com.xueyi.system.digitalmans.manager.IDmScreenIconManager;
import com.xueyi.system.digitalmans.mapper.merge.DmModelIconMergeMapper;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

import static com.xueyi.system.api.digitalmans.domain.merge.MergeGroup.Icon_DmModelIcon_GROUP;

/**
* 数字人主界面图标管理 数据封装层处理
*


+ 18
- 0
xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/digitalmans/mapper/DmH5MenuMapper.java 查看文件

@@ -0,0 +1,18 @@
package com.xueyi.system.digitalmans.mapper;

import com.xueyi.common.datasource.annotation.Isolate;
import com.xueyi.common.datasource.annotation.Master;
import com.xueyi.system.api.digitalmans.domain.po.DmH5MenuPo;

import java.util.List;

/**
* 数字人主界面图标管理 数据层
*
* @author xueyi
*/
@Master
public interface DmH5MenuMapper {
List<DmH5MenuPo> selectH5MenuList();

}

+ 18
- 0
xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/digitalmans/mapper/DmH5TenantMenuMapper.java 查看文件

@@ -0,0 +1,18 @@
package com.xueyi.system.digitalmans.mapper;

import com.xueyi.common.datasource.annotation.Isolate;
import com.xueyi.system.api.digitalmans.domain.po.DmH5MenuPo;
import com.xueyi.system.api.digitalmans.domain.po.DmH5TenantMenuPo;

import java.util.List;

/**
* 数字人主界面图标管理 数据层
*
* @author xueyi
*/
@Isolate
public interface DmH5TenantMenuMapper {
List<DmH5MenuPo> selectTenantMenuList();

}

+ 18
- 0
xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/digitalmans/mapper/DmManIconMapper.java 查看文件

@@ -0,0 +1,18 @@
package com.xueyi.system.digitalmans.mapper;

import com.xueyi.common.datasource.annotation.Isolate;
import com.xueyi.common.web.entity.mapper.BaseMapper;
import com.xueyi.system.digitalmans.domain.dto.DmManIconDto;
import com.xueyi.system.digitalmans.domain.po.DmManIconPo;
import com.xueyi.system.digitalmans.domain.query.DmManIconQuery;

/**
* 数字人主界面图标管理 数据层
*
* @author xueyi
*/
@Isolate
public interface DmManIconMapper extends BaseMapper<DmManIconQuery, DmManIconDto, DmManIconPo> {


}

+ 21
- 0
xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/digitalmans/mapper/DmMenuIconMapper.java 查看文件

@@ -0,0 +1,21 @@
package com.xueyi.system.digitalmans.mapper;

import com.xueyi.common.datasource.annotation.Isolate;
import com.xueyi.system.api.digitalmans.domain.po.DmMenuIconPo;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
* 数字人主界面图标管理 数据层
*
* @author xueyi
*/
@Isolate
public interface DmMenuIconMapper {
List<DmMenuIconPo> selectMenuIconListByMenuId(@Param("menuId") Long menuId);
int insertMerge(DmMenuIconPo menuIconPo);
int deleteMerge(@Param("menuId")Long menuId);

int deleteMenuIconByIconId(@Param("iconId") Long iconId);
}

+ 0
- 23
xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/digitalmans/mapper/DmModelIconMapper.java 查看文件

@@ -1,23 +0,0 @@
package com.xueyi.system.digitalmans.mapper;

import com.xueyi.common.datasource.annotation.Isolate;
import com.xueyi.common.web.entity.mapper.BaseMapper;
import com.xueyi.system.api.digitalmans.domain.dto.DmScreenIconDto;
import com.xueyi.system.api.digitalmans.domain.po.DmModelIconPo;
import com.xueyi.system.api.digitalmans.domain.po.DmScreenIconPo;
import com.xueyi.system.digitalmans.domain.query.DmScreenIconQuery;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
* 数字人主界面图标管理 数据层
*
* @author xueyi
*/
@Isolate
public interface DmModelIconMapper {
List<DmModelIconPo> selectModelIconListByModelId(@Param("modelId") Long modelId);
int insertMerge(DmModelIconPo modelIconPo);
int deleteMerge(DmModelIconPo modelIconPo);
}

+ 2
- 2
xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/digitalmans/mapper/merge/DmModelIconMergeMapper.java 查看文件

@@ -2,7 +2,7 @@ package com.xueyi.system.digitalmans.mapper.merge;

import com.xueyi.common.datasource.annotation.Isolate;
import com.xueyi.common.web.entity.mapper.BasicMapper;
import com.xueyi.system.api.digitalmans.domain.merge.DmModelIconMerge;
import com.xueyi.system.api.digitalmans.domain.merge.DmMenuIconMerge;

/**
* 任务访客关联 数据层
@@ -10,5 +10,5 @@ import com.xueyi.system.api.digitalmans.domain.merge.DmModelIconMerge;
* @author xueyi
*/
@Isolate
public interface DmModelIconMergeMapper extends BasicMapper<DmModelIconMerge> {
public interface DmModelIconMergeMapper extends BasicMapper<DmMenuIconMerge> {
}

+ 9
- 0
xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/digitalmans/service/IDmModelService.java 查看文件

@@ -1,10 +1,15 @@
package com.xueyi.system.digitalmans.service;

import com.xueyi.system.api.digitalmans.domain.dto.DmH5MenuDto;
import com.xueyi.system.api.digitalmans.domain.query.DmH5MenuQuery;
import com.xueyi.system.api.digitalmans.domain.vo.DmH5MenuVo;
import com.xueyi.system.digitalmans.domain.dto.DmModelUploadDto;
import com.xueyi.system.digitalmans.domain.query.DmModelQuery;
import com.xueyi.system.api.digitalmans.domain.dto.DmModelDto;
import com.xueyi.common.web.entity.service.IBaseService;

import java.util.List;

/**
* 模型管理 服务层
*
@@ -12,4 +17,8 @@ import com.xueyi.common.web.entity.service.IBaseService;
*/
public interface IDmModelService extends IBaseService<DmModelQuery, DmModelDto> {
int uploadResource(DmModelUploadDto dto);

List<DmH5MenuDto> selectH5MenuList(Long manId);

Integer updateH5MenuList(Long manId, List<DmH5MenuDto> menuList);
}

+ 4
- 0
xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/digitalmans/service/IDmQAndAService.java 查看文件

@@ -4,6 +4,8 @@ import com.xueyi.system.digitalmans.domain.query.DmQAndAQuery;
import com.xueyi.system.digitalmans.domain.dto.DmQAndADto;
import com.xueyi.common.web.entity.service.IBaseService;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;

/**
@@ -13,4 +15,6 @@ import java.util.List;
*/
public interface IDmQAndAService extends IBaseService<DmQAndAQuery, DmQAndADto> {
Integer batchInsert(List<DmQAndADto> queryList);

Integer deleteLlmByIds(Collection<? extends Serializable> idList);
}

+ 13
- 0
xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/digitalmans/service/impl/DmModelServiceImpl.java 查看文件

@@ -1,6 +1,9 @@
package com.xueyi.system.digitalmans.service.impl;

import com.xueyi.system.api.digitalmans.domain.dto.DmH5MenuDto;
import com.xueyi.system.api.digitalmans.domain.dto.DmModelDto;
import com.xueyi.system.api.digitalmans.domain.query.DmH5MenuQuery;
import com.xueyi.system.api.digitalmans.domain.vo.DmH5MenuVo;
import com.xueyi.system.digitalmans.domain.dto.DmModelUploadDto;
import com.xueyi.system.digitalmans.domain.query.DmModelQuery;
import com.xueyi.system.digitalmans.service.IDmModelService;
@@ -41,4 +44,14 @@ public class DmModelServiceImpl extends BaseServiceImpl<DmModelQuery, DmModelDto
public int uploadResource(DmModelUploadDto dto) {
return modelManager.uploadResourceByResourceId(dto);
}

@Override
public List<DmH5MenuDto> selectH5MenuList(Long manId) {
return baseManager.selectH5MenuList(manId);
}

@Override
public Integer updateH5MenuList(Long manId,List<DmH5MenuDto> menuList) {
return baseManager.updateH5MenuList(manId,menuList);
}
}

+ 52
- 1
xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/digitalmans/service/impl/DmQAndAServiceImpl.java 查看文件

@@ -1,5 +1,11 @@
package com.xueyi.system.digitalmans.service.impl;

import com.alibaba.fastjson2.JSONObject;
import com.github.pagehelper.Page;
import com.xueyi.common.core.utils.ServletUtil;
import com.xueyi.common.core.utils.core.ArrayUtil;
import com.xueyi.common.core.utils.page.PageUtil;
import com.xueyi.nlt.api.nlt.feign.RemoteLandingLlmService;
import com.xueyi.system.api.organize.domain.dto.SysUserDto;
import com.xueyi.system.api.organize.domain.query.SysUserQuery;
import com.xueyi.system.digitalmans.domain.dto.DmQAndADto;
@@ -8,12 +14,19 @@ import com.xueyi.system.digitalmans.domain.query.DmQAndAQuery;
import com.xueyi.system.digitalmans.service.IDmQAndAService;
import com.xueyi.system.digitalmans.manager.IDmQAndAManager;
import com.xueyi.common.web.entity.service.impl.BaseServiceImpl;
import com.xueyi.system.digitalmans.service.IDmQuestionsService;
import com.xueyi.system.organize.service.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import static com.xueyi.common.core.web.page.TableSupport.PAGE_NUM;
import static com.xueyi.common.core.web.page.TableSupport.PAGE_SIZE;

/**
* 企业知识库问答管理 服务层处理
*
@@ -24,6 +37,11 @@ public class DmQAndAServiceImpl extends BaseServiceImpl<DmQAndAQuery, DmQAndADto

@Autowired
private ISysUserService iSysUserService;

@Autowired
private IDmQuestionsService dmQuestionsService;
@Autowired
private RemoteLandingLlmService remoteLandingLlmService;
/**
* 查询企业知识库问答对象列表 | 数据权限
*
@@ -33,7 +51,29 @@ public class DmQAndAServiceImpl extends BaseServiceImpl<DmQAndAQuery, DmQAndADto
@Override
//@DataScope(userAlias = "createBy", mapperScope = {"DmQAndAMapper"})
public List<DmQAndADto> selectListScope(DmQAndAQuery qAndA) {

// PageUtil.startPage();
// 根据knowledgeId获取知识库信息
DmQuestionsDto questionsDto = dmQuestionsService.selectById(qAndA.getKnowledgeId());
if (questionsDto != null && questionsDto.getType() != null && questionsDto.getType() == 1) {
System.out.println(ServletUtil.getParameterToInt(PAGE_SIZE));
System.out.println(ServletUtil.getParameterToInt(PAGE_NUM));
// System.out.println(page.getPageNum() + " " + page.getPageSize());
// 根据name获取上传文档列表
JSONObject jsonObject = remoteLandingLlmService.getUploadFileList(questionsDto.getName(), String.valueOf(ServletUtil.getParameterToInt(PAGE_SIZE)),String.valueOf(ServletUtil.getParameterToInt(PAGE_NUM)));
System.out.println(jsonObject.toJSONString());
if (jsonObject != null) {
List<DmQAndADto> dmQAndADtos = new ArrayList<>();
int totalRow = jsonObject.getInteger("totalRow");
for (int i = 0;i < jsonObject.getJSONArray("data").size(); i++) {
DmQAndADto dmQAndADto = new DmQAndADto();
dmQAndADto.setFileId(jsonObject.getJSONArray("data").getJSONObject(i).getString("fileId"));
dmQAndADto.setKnowledgeId(qAndA.getKnowledgeId());
dmQAndADto.setName(jsonObject.getJSONArray("data").getJSONObject(i).getString("filename"));
dmQAndADtos.add(dmQAndADto);
}
return dmQAndADtos;
}
}
SysUserQuery userQuery = new SysUserQuery();
List<SysUserDto> userDtos = iSysUserService.selectList(userQuery);

@@ -53,4 +93,15 @@ public class DmQAndAServiceImpl extends BaseServiceImpl<DmQAndAQuery, DmQAndADto
public Integer batchInsert(List<DmQAndADto> queryList) {
return baseManager.insertBatch(queryList);
}

@Override
public Integer deleteLlmByIds(Collection<? extends Serializable> idList) {
//idList转换成List<String>
List<String> ids = new ArrayList<>();
idList.forEach(id -> {
ids.add(String.valueOf(id));
});
remoteLandingLlmService.deleteFile(ids);
return ids.size();
}
}

+ 4
- 2
xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/meeting/controller/api/DmMeetingInnerApiController.java 查看文件

@@ -220,8 +220,10 @@ public class DmMeetingInnerApiController extends BaseApiController {
// 创建json
JSONObject jsonObject = new JSONObject();
jsonObject.put("meetingRoom", meetingRoom.getName());
jsonObject.put("orderName", dmStaffPo.getUserName());
jsonObject.put("orderId", dmStaffPo.getId());
if (dmStaffPo != null ) {
jsonObject.put("orderName", dmStaffPo.getUserName());
jsonObject.put("orderId", dmStaffPo.getId());
}
jsonObject.put("timestamp", list.get(0).getStartTime().getTime());
// redisTemplate.opsForValue().set("group:nlp" + ":" + dmStaffPo.getId() + ":" + "meeting",jsonObject.toString());
// 将创建临时信息添加进缓存:用户会议提醒


+ 1
- 1
xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/organize/controller/SysProfileController.java 查看文件

@@ -163,7 +163,7 @@ public class SysProfileController extends BasisController {
if (!StrUtil.equalsAnyIgnoreCase(extension, MimeTypeUtil.IMAGE_EXTENSION)) {
return error("文件格式不正确,请上传" + Arrays.toString(MimeTypeUtil.IMAGE_EXTENSION) + "格式");
}
R<SysFile> fileResult = remoteFileService.upload(file);
R<SysFile> fileResult = remoteFileService.uploadFace(file);
if (ObjectUtil.isNull(fileResult) || ObjectUtil.isNull(fileResult.getData()))
return error("文件服务异常,请联系管理员!");
String url = fileResult.getData().getUrl();


+ 6
- 6
xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/pass/controller/api/DmRecognizedRecordsInnerApiController.java 查看文件

@@ -3,7 +3,6 @@ package com.xueyi.system.pass.controller.api;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import co.elastic.clients.elasticsearch.ElasticsearchClient;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.xueyi.common.core.web.result.R;
@@ -111,7 +110,7 @@ public class DmRecognizedRecordsInnerApiController extends BaseApiController {
}

if (StringUtils.isNotEmpty(imgBase64)) {
R<SysFile> fileResult = fileService.upload(imageUtil.base64ToMultipartFile(imgBase64));
R<SysFile> fileResult = fileService.uploadFace(imageUtil.base64ToMultipartFile(imgBase64));
if (ObjectUtil.isNull(fileResult) || ObjectUtil.isNull(fileResult.getData()))
return output(ResponseCode.FILE_SERVICE_ERROR).toJSON();
String url = fileResult.getData().getUrl();
@@ -119,7 +118,7 @@ public class DmRecognizedRecordsInnerApiController extends BaseApiController {
}

dmRecognizedRecordsMapper.insert(cr);
recognizedRecordsService.saveToEs(recordsConverter.mapperDto(cr));
// recognizedRecordsService.saveToEs(recordsConverter.mapperDto(cr));

recognizedRecordsService.setRedisRecognizedCount(1);

@@ -163,7 +162,7 @@ public class DmRecognizedRecordsInnerApiController extends BaseApiController {
}
}
if (StringUtils.isNotEmpty(imgBase64)) {
R<SysFile> fileResult = fileService.upload(imageUtil.base64ToMultipartFile(imgBase64));
R<SysFile> fileResult = fileService.uploadFace(imageUtil.base64ToMultipartFile(imgBase64));
if (ObjectUtil.isNull(fileResult) || ObjectUtil.isNull(fileResult.getData()))
return output(ResponseCode.FILE_SERVICE_ERROR).toJSON();
String url = fileResult.getData().getUrl();
@@ -172,14 +171,15 @@ public class DmRecognizedRecordsInnerApiController extends BaseApiController {
dmResourcesDto.setUrl(url);
dmResourcesDto.setName("stranger");

com.alibaba.fastjson.JSONObject json = faceService.getFaceExtraction("", "", imgBase64);
/**
com.alibaba.fastjson.JSONObject json = faceService.getFaceExtraction("", "", imgBase64);

if (0!=json.getInteger("status")) {
return output(-1, json.getString("errMsg")).toJSON();
} else {
JSONArray obj = json.getJSONArray("result").getJSONObject(0).getJSONArray("faces").getJSONObject(0).getJSONArray("feature");
dmResourcesDto.setFeature(obj.toJSONString());
}
}*/

iDmResourcesService.addOne(dmResourcesDto);
cr.setFaceUrl(url);


+ 28
- 3
xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/resource/controller/DmH5ConfigController.java 查看文件

@@ -38,12 +38,17 @@ public class DmH5ConfigController extends BaseController<DmH5ConfigQuery, DmH5Co
}

@GetMapping("/inner/syncH5Config")
R<String> syncH5Config(@RequestParam(value = "tId",required = false) String tId) {
R<String> syncH5Config(@RequestParam(value = "tId",required = false) String tId,
@RequestParam(value = "manCode",required = false) String manCode) {
Long tenantId = null;
if (StringUtils.isNotEmpty(tId)) {
tenantId = Long.parseLong(tId);
}
String result = baseService.syncH5Config(tenantId);
String dmCode = null;
if (StringUtils.isNotEmpty(manCode)) {
dmCode = manCode;
}
String result = baseService.syncH5Config(tenantId, dmCode);
if (StringUtils.isNotEmpty(result)) {
return R.ok(result);
}
@@ -70,6 +75,15 @@ public class DmH5ConfigController extends BaseController<DmH5ConfigQuery, DmH5Co
return super.getInfo(id);
}

@GetMapping(value = "/{id}/{mancode}")
@RequiresPermissions(Auth.DM_H5_CONFIG_SINGLE)
public AjaxResult getInfo(@PathVariable("id") Serializable id,@PathVariable("mancode") String mancode) {
DmH5ConfigDto dto = baseService.selectbyIdCode(id, mancode);
return AjaxResult.success(dto);
}



/**
* H5配置表新增
*/
@@ -121,6 +135,17 @@ public class DmH5ConfigController extends BaseController<DmH5ConfigQuery, DmH5Co
return super.batchRemove(idList);
}

/**
* H5配置表按照数字人与id删除
*/
@DeleteMapping(value = "/{id}/{mancode}")
@RequiresPermissions(Auth.DM_H5_CONFIG_DEL)
@Log(title = "H5配置表管理", businessType = BusinessType.DELETE)
public AjaxResult batchRemove(@PathVariable("id") Serializable id,@PathVariable("mancode") String manCode) {
int result = baseService.deleteByIdCode(id, manCode);
return AjaxResult.success(result);
}

/**
* 获取H5配置表选择框列表
*/
@@ -144,4 +169,4 @@ public class DmH5ConfigController extends BaseController<DmH5ConfigQuery, DmH5Co
/** 系统 - H5配置表管理 - 删除 */
String DM_H5_CONFIG_DEL = "resource:h5config:delete";
}
}
}

+ 208
- 17
xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/resource/controller/DmResourcesController.java 查看文件

@@ -4,15 +4,19 @@ import cn.hutool.core.text.CharSequenceUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.xueyi.common.core.utils.core.IdUtil;
import com.xueyi.common.core.utils.file.FileTypeUtil;
import com.xueyi.common.core.utils.file.FileUtil;
import com.xueyi.common.core.utils.file.MimeTypeUtil;
import com.xueyi.common.core.web.result.AjaxResult;
import com.xueyi.common.core.web.result.R;
import com.xueyi.common.core.web.validate.V_E;
import com.xueyi.common.log.annotation.Log;
import com.xueyi.common.log.enums.BusinessType;
import com.xueyi.common.redis.utils.RedisUtil;
import com.xueyi.common.security.annotation.RequiresPermissions;
import com.xueyi.common.web.entity.controller.BaseController;
import com.xueyi.file.api.domain.ByteArrayMultipartFile;
import com.xueyi.file.api.domain.SysFile;
import com.xueyi.file.api.feign.RemoteFileService;
import com.xueyi.system.api.resource.domain.po.DmResourcesPo;
@@ -23,6 +27,7 @@ import com.xueyi.system.resource.service.IDmResourcesService;
import com.xueyi.system.resource.service.impl.FaceServiceImpl;
import com.xueyi.system.utils.common.ImageUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
@@ -35,10 +40,14 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.Serializable;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
* 静态资源管理 业务处理
@@ -140,22 +149,196 @@ public class DmResourcesController extends BaseController<DmResourcesQuery, DmRe
private static final String PARAM_URL = "url";

private static final String PARAM_TYPE = "type";



@PostMapping("/chunkUpload")
public AjaxResult uploadChunk(
@RequestParam("file") MultipartFile file,
@RequestParam("chunkIndex") int chunk,
@RequestParam("chunkCount") int chunks,
@RequestParam("uploadUuid") String uuid
) throws IOException {
String folder = "/home/xueyi/upload/temp/";
String key = "saas:upload:chunk:"+uuid;
File dir = new File(folder);
if (!dir.exists()) {
dir.mkdirs();
}


String fileName = FileUtil.getFileNameNoExt(file.getOriginalFilename());
if (RedisUtil.existed(key+":fileName")) {
fileName = (String) RedisUtil.getVal(key+":fileName");
} else {
RedisUtil.setVal(key+":fileName",fileName);
}

logger.info("chunkIndex:{},chunkTotal:{},fileName:{},fileOriginName:{}",chunk,chunks,file.getName(),fileName);

logger.info("upload 第{}/{} 块",chunk+1,chunks);
String path = folder + fileName + "_" + chunk + ".part";
try {
file.transferTo(new File(path));
RedisUtil.increment(key,1);
} catch (IOException e) {
e.printStackTrace();
return AjaxResult.error("文件保存失败");
}
if (((Integer) RedisUtil.getVal(key)).longValue() == chunks) {
// 合并所有分片
File[] content = new File[chunks];
for (int i = 0; i < chunks; i++) {
content[i] = new File(folder + fileName + "_" + i + ".part");
}
File destFile = new File(folder + fileName);
logger.info("合并文件:{},文件数:{}",destFile.getAbsolutePath(), content.length);
FileUtil.mergeFile(content, destFile);
// 删除分片文件
for (int i = 0; i < chunks; i++) {
new File(folder + fileName + "_" + i + ".part").delete();
}
MultipartFile multipartFile = new MockMultipartFile(fileName, new FileInputStream(destFile));

RedisUtil.expire(key, 5);
return executeUpload(multipartFile, FileTypeUtil.getExtension(file), uuid);
}

return AjaxResult.success("上传文件成功!");
}

private MultipartFile mergeChunks(List<byte[]> byteArrays) {
// 合并所有分片的byte数组为一个byte数组
int totalSize = byteArrays.stream().mapToInt(byteArray -> byteArray.length).sum();
byte[] mergedBytes = new byte[totalSize];
int currentIndex = 0;
//byteArrays 顺序颠倒
for (int i = byteArrays.size()-1; i >= 0; i--) {
byte[] bytes = byteArrays.get(i);
System.arraycopy(bytes, 0, mergedBytes, currentIndex, bytes.length);
currentIndex += bytes.length;
}
/*for (byte[] bytes : byteArrays) {
System.arraycopy(bytes, 0, mergedBytes, currentIndex, bytes.length);
currentIndex += bytes.length;
}*/
logger.info("mergeChunks count:{}", byteArrays.size());
logger.info("mergeChunks currentIndex:{}", currentIndex);

// 创建一个新的MultipartFile对象,代表合并后的文件
return new ByteArrayMultipartFile(mergedBytes);

}

/**
* 头像上传
*/
@PostMapping("/upload")
@Log(title = "资源管理 - 上传资源", businessType = BusinessType.UPDATE)
public AjaxResult upload(@RequestParam("file") MultipartFile file) {
logger.info("file contentType:{}, size:{}, name:{}, empty:{}",file.getContentType() ,file.getSize(), file.getOriginalFilename(), file.isEmpty());
String extension = FileTypeUtil.getExtension(file);
String uploadUuid = IdUtil.randomUUID();
if (!file.isEmpty()) {
String extension = FileTypeUtil.getExtension(file);
logger.info("文件类型:" + extension+",上传开始...");
logger.info("文件类型:" + extension + ",上传到MINIO开始...");
if (!CharSequenceUtil.equalsAnyIgnoreCase(extension, MimeTypeUtil.EXCEPT_ALLOWED_EXTENSION)) {
return error("文件格式不正确,请上传" + Arrays.toString(MimeTypeUtil.EXCEPT_ALLOWED_EXTENSION) + "格式");
}

if(MimeTypeUtil.PDF_EXTENSION.equalsIgnoreCase(extension)) {
R<List<SysFile>> fileResult = remoteFileService.uploadPdf(file);
if (ObjectUtil.isNull(fileResult) || ObjectUtil.isNull(fileResult.getData()))
R<SysFile> fileResult = remoteFileService.uploadNoAsync(file, extension, uploadUuid);

if (ObjectUtil.isNull(fileResult) || ObjectUtil.isNull(fileResult.getData()))
return error("文件服务异常,请联系管理员!");
String url = fileResult.getData().getUrl();

DmResourcesDto dto = new DmResourcesDto();
dto.setName(file.getOriginalFilename());
dto.setUrl(url);
if (CharSequenceUtil.equalsAnyIgnoreCase(extension, MimeTypeUtil.IMAGE_EXTENSION)) {
dto.setType(DmResourcesPo.TYPE_PIC);
}
if (CharSequenceUtil.equalsAnyIgnoreCase(extension, MimeTypeUtil.VIDEO_EXTENSION)) {
dto.setType(DmResourcesPo.TYPE_VIDEO);
}
dto.setFileSize(fileResult.getData().getSize());
dto.setFeature("");

iDmResourcesService.addOne(dto);
JSONObject jo = new JSONObject();
jo.put(PARAM_RESOURCE_ID, dto.getId());
jo.put(PARAM_URL, url);
jo.put(PARAM_TYPE, dto.getType());

AjaxResult ajax = success();
ajax.put(AjaxResult.RESULT_TAG, jo);
logger.info("上传文件成功,返回数据:" + ajax.toJson().toJSONString());
return ajax;

}
return error("上传文件异常,请联系管理员!");
}





@GetMapping("/uploadCallback")
@Log(title = "资源管理 - 上传资源回调", businessType = BusinessType.UPDATE)
public AjaxResult pdfUploadCallback(@RequestParam("uploadUuid") String uploadUuid) {

if (!RedisUtil.existed("saas:upload:result:"+uploadUuid)) {
return AjaxResult.error("上传操作可能尚未完成,请等待...");
}

String result = (String) RedisUtil.getVal("saas:upload:result:"+uploadUuid);
String fileName = (String) RedisUtil.getVal("saas:upload:filename:"+uploadUuid);
Integer fileType = (Integer) RedisUtil.getVal("saas:upload:fileType:"+uploadUuid);

JSONArray res = JSONArray.parseArray(result);
List<JSONObject> jsons = res.stream().map(sf -> (JSONObject) sf).collect(Collectors.toList());

if (RedisUtil.existed("saas:upload:callbackExec:"+uploadUuid)) {
JSONArray _res = JSONArray.parseArray((String) RedisUtil.getVal("saas:upload:callbackExec:"+uploadUuid));
return AjaxResult.success(_res);
}
JSONArray ja = new JSONArray();
for (JSONObject sf : jsons) {
String url = (String) sf.get("url");
DmResourcesDto dto = new DmResourcesDto();
dto.setName(fileName);
dto.setUrl(url);
dto.setType(fileType);
dto.setFileSize(((Integer) sf.get("size")).longValue());
dto.setFeature("");

iDmResourcesService.addOne(dto);
JSONObject jo = new JSONObject();
jo.put(PARAM_RESOURCE_ID, dto.getId());
jo.put(PARAM_URL, url);
jo.put(PARAM_TYPE, dto.getType());
ja.add(jo);
}

AjaxResult ajax = success();
ajax.put(AjaxResult.RESULT_TAG, ja);
RedisUtil.setVal("saas:upload:callbackExec:"+uploadUuid, ja.toJSONString());

logger.info("上传文件成功,返回数据:" + ajax.toJson().toJSONString());

return ajax;
}

public AjaxResult executeUpload(MultipartFile file, String extension, String uploadUuid) {
logger.info("file contentType:{}, size:{}, name:{}, empty:{}",file.getContentType() ,file.getSize(), file.getOriginalFilename(), file.isEmpty());
if (!file.isEmpty()) {
logger.info("文件类型:" + extension + ",上传到MINIO开始...");
if (!CharSequenceUtil.equalsAnyIgnoreCase(extension, MimeTypeUtil.EXCEPT_ALLOWED_EXTENSION)) {
return error("文件格式不正确,请上传" + Arrays.toString(MimeTypeUtil.EXCEPT_ALLOWED_EXTENSION) + "格式");
}

if (MimeTypeUtil.PDF_EXTENSION.equalsIgnoreCase(extension)) {
remoteFileService.uploadPdf(file, uploadUuid);
/*if (ObjectUtil.isNull(fileResult) || ObjectUtil.isNull(fileResult.getData()))
return error("文件服务异常,请联系管理员!");
JSONArray ja = new JSONArray();
for (SysFile sf : fileResult.getData()) {
@@ -172,20 +355,29 @@ public class DmResourcesController extends BaseController<DmResourcesQuery, DmRe
jo.put(PARAM_URL, url);
jo.put(PARAM_TYPE, dto.getType());
ja.add(jo);
}
}*/
AjaxResult ajax = success();
ajax.put(AjaxResult.RESULT_TAG, ja);
logger.info("上传文件成功,返回数据:" + ajax.toJson().toJSONString());
ajax.put(AjaxResult.MSG_TAG, "文件后台上传处理中...");
ajax.put("uploadUuid", uploadUuid);
logger.info("异步上传文件...");
return ajax;
} else {
R<SysFile> fileResult = remoteFileService.upload(file);
if (ObjectUtil.isNull(fileResult) || ObjectUtil.isNull(fileResult.getData()))
remoteFileService.upload(file, extension, uploadUuid);

AjaxResult ajax = success();
ajax.put(AjaxResult.MSG_TAG, "文件后台上传处理中...");
ajax.put("uploadUuid", uploadUuid);
logger.info("异步上传文件...");
return ajax;
/*if (ObjectUtil.isNull(fileResult) || ObjectUtil.isNull(fileResult.getData()))
return error("文件服务异常,请联系管理员!");
String url = fileResult.getData().getUrl();
DmResourcesDto dto = new DmResourcesDto();
String url = fileResult.getData().getUrl();*/


/*DmResourcesDto dto = new DmResourcesDto();
dto.setName(file.getOriginalFilename());
dto.setUrl(url);
if (CharSequenceUtil.equalsAnyIgnoreCase(extension, MimeTypeUtil.IMAGE_EXTENSION) ) {
if (CharSequenceUtil.equalsAnyIgnoreCase(extension, MimeTypeUtil.IMAGE_EXTENSION)) {
dto.setType(DmResourcesPo.TYPE_PIC);
}
if (CharSequenceUtil.equalsAnyIgnoreCase(extension, MimeTypeUtil.VIDEO_EXTENSION)) {
@@ -202,9 +394,8 @@ public class DmResourcesController extends BaseController<DmResourcesQuery, DmRe
AjaxResult ajax = success();
ajax.put(AjaxResult.RESULT_TAG, jo);
logger.info("上传文件成功,返回数据:" + ajax.toJson().toJSONString());
return ajax;
return ajax;*/
}

}
return error("上传文件异常,请联系管理员!");
}
@@ -221,7 +412,7 @@ public class DmResourcesController extends BaseController<DmResourcesQuery, DmRe
) {
return error("文件格式不正确,请上传" + Arrays.toString(MimeTypeUtil.IMAGE_EXTENSION) + Arrays.toString(MimeTypeUtil.IMAGE_EXTENSION) + "格式");
}
R<List<SysFile>> fileResult = remoteFileService.uploadPdf(file);
R<List<SysFile>> fileResult = remoteFileService.uploadPdf(file, IdUtil.randomUUID());
if (ObjectUtil.isNull(fileResult) || ObjectUtil.isNull(fileResult.getData()))
return error("文件服务异常,请联系管理员!");
JSONArray ja = new JSONArray();
@@ -270,7 +461,7 @@ public class DmResourcesController extends BaseController<DmResourcesQuery, DmRe
if (!CharSequenceUtil.equalsAnyIgnoreCase(extension, MimeTypeUtil.IMAGE_EXTENSION)) {
return error("文件格式不正确,请上传" + Arrays.toString(MimeTypeUtil.IMAGE_EXTENSION) + "格式");
}
R<SysFile> fileResult = remoteFileService.upload(file);
R<SysFile> fileResult = remoteFileService.uploadFace(file);
if (ObjectUtil.isNull(fileResult) || ObjectUtil.isNull(fileResult.getData()))
return error("文件服务异常,请联系管理员!");
String url = fileResult.getData().getUrl();


+ 2
- 0
xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/resource/domain/dto/DmH5ConfigDto.java 查看文件

@@ -23,4 +23,6 @@ public class DmH5ConfigDto extends DmH5ConfigPo {

/** 属性值 */
private String property;

private String manCode;
}

+ 7
- 1
xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/resource/service/IDmH5ConfigService.java 查看文件

@@ -4,6 +4,8 @@ import com.xueyi.system.resource.domain.query.DmH5ConfigQuery;
import com.xueyi.system.resource.domain.dto.DmH5ConfigDto;
import com.xueyi.common.web.entity.service.IBaseService;

import java.io.Serializable;

/**
* H5配置表管理 服务层
*
@@ -17,5 +19,9 @@ public interface IDmH5ConfigService extends IBaseService<DmH5ConfigQuery, DmH5Co
* @param tId 租户Id
* @return 结果
*/
public String syncH5Config(Long tId);
public String syncH5Config(Long tId, String manCode);

public DmH5ConfigDto selectbyIdCode(Serializable id, String manCode);

public int deleteByIdCode(Serializable id, String manCode);
}

+ 206
- 17
xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/resource/service/impl/DmH5ConfigServiceImpl.java 查看文件

@@ -1,11 +1,15 @@
package com.xueyi.system.resource.service.impl;

import com.alibaba.cloud.nacos.NacosConfigManager;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.nacos.api.exception.NacosException;
import com.aliyun.tea.utils.StringUtils;
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
import com.xueyi.common.core.constant.nacos.NacosConstants;
import com.xueyi.system.api.digitalmans.domain.dto.DmManDeviceDto;
import com.xueyi.system.digitalmans.domain.query.DmManDeviceQuery;
import com.xueyi.system.digitalmans.manager.IDmManDeviceManager;
import com.xueyi.system.digitalmans.service.IDmManDeviceService;
import com.xueyi.system.resource.domain.dto.DmH5ConfigDto;
import com.xueyi.system.resource.domain.query.DmH5ConfigQuery;
@@ -19,8 +23,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

/**
@@ -39,6 +43,8 @@ public class DmH5ConfigServiceImpl extends BaseServiceImpl<DmH5ConfigQuery, DmH5
@Autowired
IDmManDeviceService dmManDeviceService;

@Autowired
IDmManDeviceManager dmManDeviceManager;


/**
@@ -50,43 +56,144 @@ public class DmH5ConfigServiceImpl extends BaseServiceImpl<DmH5ConfigQuery, DmH5
@Override
//@DataScope(userAlias = "createBy", mapperScope = {"DmH5ConfigMapper"})
public List<DmH5ConfigDto> selectListScope(DmH5ConfigQuery h5Config) {
List<DmH5ConfigDto> resultlist = new ArrayList<>();
List<DmH5ConfigDto> list = baseManager.selectList(h5Config);
list.forEach(item-> {
list.forEach(item -> {
DmManDeviceQuery query = new DmManDeviceQuery();
query.setTId(item.getEnterpriseId());
DmManDeviceDto manDeviceDto = dmManDeviceService.selectList(query).stream().filter(device -> device.getTId().equals(item.getEnterpriseId())).findFirst().get();
if (manDeviceDto != null) {
item.setTenantName(manDeviceDto.getTenantName());
List<DmManDeviceDto> manDeviceDtos = dmManDeviceService.selectList(query).stream().filter(device -> device.getTId().equals(item.getEnterpriseId())).collect(Collectors.toList());
if (!manDeviceDtos.isEmpty()) {
for (int i = 0; i < manDeviceDtos.size(); i++) {
DmManDeviceDto items = manDeviceDtos.get(i);
String configCreated = items.getConfigCreated();
if (!StringUtils.isEmpty(configCreated) && configCreated.equals("1")) {
DmH5ConfigDto temp = new DmH5ConfigDto();
temp.setTenantName(items.getTenantName());
temp.setManCode(items.getManCode());
try {
String property = nacosConfigManager.getConfigService().getConfig(item.getName(), NacosConstants.DEFAULT_GROUP, 5000);
if(!StringUtils.isEmpty(property)){
JSONObject jo = JSON.parseObject(property);
if (jo != null && jo.containsKey("system")) {
JSONObject sys = jo.getJSONObject("system");
if (sys != null && sys.containsKey("H5")) {
JSONObject H5 = sys.getJSONObject("H5");
H5.put("streamUrl", items.getStreamUrl());
}
}
temp.setProperty(jo.toString());
}
else{
continue;
}
} catch (NacosException ne) {
log.error("H5配置表上传nacos-获取配置文件失败:{}", ne.getMessage());
}
temp.setEnterpriseId(item.getEnterpriseId());
temp.setName(item.getName());
temp.setId(item.getId());
temp.setRemark(item.getRemark());
temp.setStatus(item.getStatus());
temp.setVersion(item.getVersion());
temp.setCreateBy(item.getCreateBy());
temp.setCreateTime(item.getCreateTime());
temp.setUpdateBy(item.getUpdateBy());
temp.setUpdateName(item.getUpdateName());
temp.setUpdateTime(item.getUpdateTime());
temp.setSourceName(item.getSourceName());
temp.setSort(item.getSort());
temp.setDelFlag(item.getDelFlag());
temp.setParams(item.getParams());
temp.setOperate(item.getOperate());
temp.setCreateName(item.getCreateName());
resultlist.add(temp);
}
}
}
});
return list;
return resultlist;
}

@Override
public int insert(DmH5ConfigDto dto) {
int row = 1;
// 设置新增配置文件名
String[] strs = NacosConstants.DEFAULT_CONFIG_PATH.split("\\.");
dto.setName(strs[0] + "_" + dto.getEnterpriseId() + "." + strs[1]);
// 获取基础配置文件
try {
String property = nacosConfigManager.getConfigService().getConfig(NacosConstants.DEFAULT_CONFIG_PATH, NacosConstants.DEFAULT_GROUP, 5000);
// 设置新增配置文件名
String[] strs = NacosConstants.DEFAULT_CONFIG_PATH.split("\\.");
dto.setName(strs[0] + "_" + dto.getEnterpriseId() + "." + strs[1]);
// 新增配置文件
nacosConfigManager.getConfigService().publishConfig(dto.getName(), NacosConstants.DEFAULT_GROUP,property);
DmH5ConfigQuery query = new DmH5ConfigQuery();
query.setEnterpriseId(dto.getEnterpriseId());
List<DmH5ConfigDto> result = baseManager.selectList(query);
if (result.isEmpty()) {
String property = nacosConfigManager.getConfigService().getConfig(NacosConstants.DEFAULT_CONFIG_PATH, NacosConstants.DEFAULT_GROUP, 5000);
// 新增配置文件
nacosConfigManager.getConfigService().publishConfig(dto.getName(), NacosConstants.DEFAULT_GROUP, property);
row = super.insert(dto);
}
} catch (NacosException ne) {
log.error("H5配置表上传nacos-新增配置文件失败:{}", ne.getMessage());
}
strs = NacosConstants.DEFAULT_CONFIG_PATH.split("\\.");
dto.setName(strs[0] + "_" + dto.getEnterpriseId() + "." + strs[1]);
DmManDeviceQuery query = new DmManDeviceQuery();
query.setManCode(dto.getManCode());
List<DmManDeviceDto> mdList = dmManDeviceManager.selectList(query);
if (mdList != null && mdList.size() > 0) {
DmManDeviceDto target = mdList.get(0);
try {
String property = nacosConfigManager.getConfigService().getConfig(dto.getName(), NacosConstants.DEFAULT_GROUP, 5000);
if (!StringUtils.isEmpty(property)) {
JSONObject jo = JSON.parseObject(property);
target.setConfigCreated("1");
if (jo != null && jo.containsKey("system")) {
JSONObject sys = jo.getJSONObject("system");
if (sys != null && sys.containsKey("H5")) {
JSONObject H5 = sys.getJSONObject("H5");
String streamUrl = H5.getString("streamUrl");
target.setStreamUrl(streamUrl);

return super.insert(dto);
}
}
dmManDeviceManager.update(target);
}
} catch (NacosException ne) {
log.error("H5配置表上传nacos-新增配置文件失败:{}", ne.getMessage());
}
}
return row;
}

@Override
public int update(DmH5ConfigDto dto) {
String[] strs = NacosConstants.DEFAULT_CONFIG_PATH.split("\\.");
dto.setName(strs[0] + "_" + dto.getEnterpriseId() + "." + strs[1]);
try {
// 获取文件名
nacosConfigManager.getConfigService().publishConfig(dto.getName(), NacosConstants.DEFAULT_GROUP,dto.getProperty());
nacosConfigManager.getConfigService().publishConfig(dto.getName(), NacosConstants.DEFAULT_GROUP, dto.getProperty());
} catch (NacosException ne) {
log.error("H5配置表上传nacos-修改配置文件失败:{}", ne.getMessage());
}
if (StringUtils.isEmpty(dto.getManCode())) {
return super.update(dto);
}
DmManDeviceQuery query = new DmManDeviceQuery();
query.setManCode(dto.getManCode());
List<DmManDeviceDto> mdList = dmManDeviceManager.selectList(query);
if (mdList != null && mdList.size() > 0) {
DmManDeviceDto target = mdList.get(0);
String property = dto.getProperty();
JSONObject jo = JSON.parseObject(property);
if (jo != null && jo.containsKey("system")) {
JSONObject sys = jo.getJSONObject("system");
if (sys != null && sys.containsKey("H5")) {
JSONObject H5 = sys.getJSONObject("H5");
String streamUrl = H5.getString("streamUrl");
target.setStreamUrl(streamUrl);
dmManDeviceManager.update(target);
}
}
}
return super.update(dto);
}

@@ -101,9 +208,43 @@ public class DmH5ConfigServiceImpl extends BaseServiceImpl<DmH5ConfigQuery, DmH5
return dto;
}

public DmH5ConfigDto selectbyIdCode(Serializable id, String manCode) {
DmH5ConfigDto dto = super.selectById(id);
dto.setManCode(manCode);
String result = null;
try {
result = nacosConfigManager.getConfigService().getConfig(dto.getName(), NacosConstants.DEFAULT_GROUP, 5000);
} catch (NacosException ne) {
log.error("H5配置表nacos-获取配置文件失败:{}", ne.getMessage());
}
DmManDeviceQuery query = new DmManDeviceQuery();
query.setManCode(manCode);
List<DmManDeviceDto> mdList = dmManDeviceManager.selectList(query);
if (mdList != null && mdList.size() > 0) {
String streamUrl = mdList.get(0).getStreamUrl();
String configCreated = mdList.get(0).getConfigCreated();
if (StringUtils.isEmpty(configCreated)) {
return null;
}
if (!StringUtils.isEmpty(result)){
JSONObject jo = JSON.parseObject(result);
if (jo != null && jo.containsKey("system")) {
JSONObject sys = jo.getJSONObject("system");
if (sys != null && sys.containsKey("H5")) {
JSONObject H5 = sys.getJSONObject("H5");
H5.put("streamUrl", streamUrl);
}
}
result = jo.toString();
}
dto.setProperty(result);
}
return dto;
}

@Override
public String syncH5Config(Long tId) {
log.info("tenant_id:{}",tId);
public String syncH5Config(Long tId, String manCode) {
log.info("tenant_id:{}", tId);
if (tId == null) {
try {
return nacosConfigManager.getConfigService().getConfig(NacosConstants.DEFAULT_CONFIG_PATH, NacosConstants.DEFAULT_GROUP, 5000);
@@ -118,7 +259,35 @@ public class DmH5ConfigServiceImpl extends BaseServiceImpl<DmH5ConfigQuery, DmH5
DmH5ConfigDto dto = list.get(0);
if (dto != null) {
try {
return nacosConfigManager.getConfigService().getConfig(dto.getName(), NacosConstants.DEFAULT_GROUP, 5000);
String result = "";
result = nacosConfigManager.getConfigService().getConfig(dto.getName(), NacosConstants.DEFAULT_GROUP, 5000);
if (StringUtils.isEmpty(manCode)) {
return result;
} else {
DmManDeviceQuery query2 = new DmManDeviceQuery();
query2.setManCode(manCode);
List<DmManDeviceDto> extList = dmManDeviceManager.selectList(query2);
if (extList != null && extList.size() > 0) {
String streamUrl = extList.get(0).getStreamUrl();
String configCreated = extList.get(0).getConfigCreated();
if (!StringUtils.isEmpty(configCreated)) {
if(!StringUtils.isEmpty(result)){
JSONObject jo = JSON.parseObject(result);
if (jo != null && jo.containsKey("system")) {
JSONObject sys = jo.getJSONObject("system");
if (sys != null && sys.containsKey("H5")) {
JSONObject H5 = sys.getJSONObject("H5");
H5.put("streamUrl", streamUrl);
}
}
result = jo.toString();
}
return result;
} else {
return result;
}
}
}
} catch (NacosException ne) {
log.error("H5同步-获取配置文件失败:{}", ne.getMessage());
try {
@@ -137,4 +306,24 @@ public class DmH5ConfigServiceImpl extends BaseServiceImpl<DmH5ConfigQuery, DmH5
}
return "";
}

public int deleteByIdCode(Serializable id, String manCode) {
DmH5ConfigDto dto = super.selectById(id);
if (dto != null) {
try {
String result = nacosConfigManager.getConfigService().getConfig(dto.getName(), NacosConstants.DEFAULT_GROUP, 5000);
} catch (NacosException ne) {
log.error("H5配置表nacos-删除配置文件失败:{}", ne.getMessage());
}
}
DmManDeviceQuery query = new DmManDeviceQuery();
query.setManCode(manCode);
List<DmManDeviceDto> mdList = dmManDeviceManager.selectList(query);
if (mdList != null && mdList.size() > 0) {
DmManDeviceDto target = mdList.get(0);
target.setStreamUrl("");
dmManDeviceManager.update(target);
}
return 1;
}
}

+ 1
- 1
xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/resource/service/impl/DmResourcesServiceImpl.java 查看文件

@@ -66,7 +66,7 @@ public class DmResourcesServiceImpl extends BaseServiceImpl<DmResourcesQuery, Dm
DmResourcesDto dmResourcesDto = new DmResourcesDto();
if (StringUtils.isNotEmpty(base64Img)) {
String imgBase64 = base64Img;
R<SysFile> fileResult = fileService.upload(imageUtil.base64ToMultipartFile(imgBase64));
R<SysFile> fileResult = fileService.uploadFace(imageUtil.base64ToMultipartFile(imgBase64));
if (ObjectUtil.isNull(fileResult) || ObjectUtil.isNull(fileResult.getData()))
return R.fail(fileResult.getMsg());
String url = fileResult.getData().getUrl();


+ 1
- 1
xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/staff/controller/DmStaffController.java 查看文件

@@ -247,7 +247,7 @@ public class DmStaffController extends BaseController<DmStaffQuery, DmStaffDto,
if (!StrUtil.equalsAnyIgnoreCase(extension, MimeTypeUtil.IMAGE_EXTENSION)) {
return error("文件格式不正确,请上传" + Arrays.toString(MimeTypeUtil.IMAGE_EXTENSION) + "格式");
}
R<SysFile> fileResult = remoteFileService.upload(file);
R<SysFile> fileResult = remoteFileService.uploadFace(file);
if (ObjectUtil.isNull(fileResult) || ObjectUtil.isNull(fileResult.getData()))
return error("文件服务异常,请联系管理员!");
String url = fileResult.getData().getUrl();


+ 1
- 1
xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/staff/controller/DmVisitorsController.java 查看文件

@@ -137,7 +137,7 @@ public class DmVisitorsController extends BaseController<DmVisitorsQuery, DmVisi
if (!CharSequenceUtil.equalsAnyIgnoreCase(extension, MimeTypeUtil.IMAGE_EXTENSION)) {
return error("文件格式不正确,请上传" + Arrays.toString(MimeTypeUtil.IMAGE_EXTENSION) + "格式");
}
R<SysFile> fileResult = remoteFileService.upload(file);
R<SysFile> fileResult = remoteFileService.uploadFace(file);
if (ObjectUtil.isNull(fileResult) || ObjectUtil.isNull(fileResult.getData()))
return error("文件服务异常,请联系管理员!");
String url = fileResult.getData().getUrl();


+ 1
- 1
xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/staff/controller/api/DmVisitorInnerApiController.java 查看文件

@@ -179,7 +179,7 @@ public class DmVisitorInnerApiController extends BaseApiController {
//兼容熟人介绍生人,传递访客照片
if (StringUtils.isNotEmpty(commonDto.getVisitorBase64Img())) {
String imgBase64 = commonDto.getVisitorBase64Img();
R<SysFile> fileResult = fileService.upload(imageUtil.base64ToMultipartFile(imgBase64));
R<SysFile> fileResult = fileService.uploadFace(imageUtil.base64ToMultipartFile(imgBase64));
if (ObjectUtil.isNull(fileResult) || ObjectUtil.isNull(fileResult.getData()))
return output(ResponseCode.FILE_SERVICE_ERROR).toJSON();
String url = fileResult.getData().getUrl();


+ 0
- 1
xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/staff/service/impl/DmVisitRecordsServiceImpl.java 查看文件

@@ -43,7 +43,6 @@ public class DmVisitRecordsServiceImpl extends BaseServiceImpl<DmVisitRecordsQue
e.printStackTrace();
}*/
String timeStr = String.valueOf(System.currentTimeMillis());
timeStr.substring(timeStr.length() - 4 );

return timeStr.substring(timeStr.length() - 4 );
}


+ 4
- 0
xueyi-modules/xueyi-system/src/main/resources/bootstrap.yml 查看文件

@@ -20,6 +20,8 @@ spring:
# 服务注册地址
server-addr: @nacos.host@:@nacos.port@
namespace: @nacos.namespace@
username: @nacos.username@
password: @nacos.password@

config:
# 配置中心地址
@@ -34,5 +36,7 @@ spring:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
- application-secret-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
- application-datasource-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
username: @nacos.username@
password: @nacos.password@



+ 27
- 0
xueyi-modules/xueyi-system/src/main/resources/mapper/digitalmans/DmH5MenuMapper.xml 查看文件

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xueyi.system.digitalmans.mapper.DmH5MenuMapper">

<resultMap type="DmH5TenantMenuPo" id="DmH5TenantMenuPoResult">
<result property="menuId" column="menu_id" />
<result property="tenantId" column="tenant_id" />
</resultMap>

<resultMap type="DmH5MenuPo" id="DmH5MenuPoResult">
<result property="menuId" column="menu_id" />
<result property="tenantId" column="tenant_id" />
<result property="title" column="title" />
<result property="menuType" column="menu_type" />
<result property="status" column="status" />
</resultMap>


<select id="selectH5MenuList" resultMap="DmH5MenuPoResult">
select m.id, m.title ,m.parent_id,m.menu_type,m.status from dm_h5_menu as m
order by m.sort
</select>


</mapper>

+ 25
- 0
xueyi-modules/xueyi-system/src/main/resources/mapper/digitalmans/DmH5TenantMenuMergeMapper.xml 查看文件

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xueyi.system.digitalmans.mapper.DmH5TenantMenuMapper">

<resultMap type="DmH5TenantMenuPo" id="DmH5TenantMenuPoResult">
<result property="menuId" column="menu_id" />
<result property="tenantId" column="tenant_id" />
</resultMap>

<resultMap type="DmH5MenuPo" id="DmH5MenuPoResult">
<result property="menuId" column="menu_id" />
<result property="tenantId" column="tenant_id" />
</resultMap>


<select id="selectTenantMenuList" resultMap="DmH5MenuPoResult">
select m.id, m.title from dm_h5_tenant_menu_merge as s
where s.tenant_id = #{tenantId}
order by m.sort
</select>


</mapper>

+ 32
- 0
xueyi-modules/xueyi-system/src/main/resources/mapper/digitalmans/DmMenuIconMergeMapper.xml 查看文件

@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xueyi.system.digitalmans.mapper.DmMenuIconMapper">

<resultMap type="DmMenuIconPo" id="DmMenuIconResult">
<result property="menuId" column="menu_id" />
<result property="iconId" column="icon_id" />
<result property="pos" column="pos" />
</resultMap>



<select id="selectMenuIconListByMenuId" resultMap="DmMenuIconResult">
select s.menu_id, s.icon_id,s.pos from dm_menu_icon_merge as s
where menu_id = #{menuId}
</select>

<insert id="insertMerge" parameterType="DmMenuIconPo" >
insert into dm_menu_icon_merge(menu_id,icon_id,pos) values(#{menuId},#{iconId},#{pos})
</insert>

<delete id="deleteMerge" >
delete from dm_menu_icon_merge where menu_id = #{menuId}
</delete>

<delete id="deleteMenuIconByIconId" >
delete from dm_menu_icon_merge where icon_id = #{iconId}
</delete>
</mapper>


+ 0
- 27
xueyi-modules/xueyi-system/src/main/resources/mapper/digitalmans/DmModelIconMergeMapper.xml 查看文件

@@ -1,27 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xueyi.system.digitalmans.mapper.DmModelIconMapper">

<resultMap type="DmModelIconPo" id="DmModelIconResult">
<result property="modelId" column="model_id" />
<result property="iconId" column="icon_id" />
<result property="pos" column="pos" />
</resultMap>



<select id="selectModelIconListByModelId" resultMap="DmModelIconResult">
select s.model_id, s.icon_id,s.pos from dm_model_icon_merge as s
where model_id = #{modelId}
</select>

<insert id="insertMerge" parameterType="DmModelIconPo" >
insert into dm_model_icon_merge(model_id,icon_id,pos) values(#{modelId},#{iconId},#{pos})
</insert>

<delete id="deleteMerge" parameterType="DmModelIconPo" >
delete from dm_model_icon_merge where model_id = #{modelId}
</delete>
</mapper>

部分文件因为文件数量过多而无法显示

正在加载...
取消
保存